K
K
KeeperDAO
Search…
HidingBook API
KeeperDAO's Hiding Game RESTful API makes it easy to integrate into your dApp.
The base endpoint is: https://hidingbook.keeperdao.com/api/v1/
  • Limit order protocol: 0xv4 RFQ orders
  • All endpoints return JSON
  • Response format
    • success
      • {"orders": [], "message": "Ok"}
      • {"orders": [{"order": ....... ], "message": "Ok"}
    • error
      • {"error": "Insufficient maker balance", "code": -2001}
      • {"error": "Invalid param", "code": -2010, "message": "txOrigin failed validation"}

GET /info

Returns all general information needed to populate the user interface.
  • URL
    /info
  • Method:
    GET
  • Success Response:
    1
    {
    2
    "result": {
    3
    "orderDetails": {
    4
    "verifyingContract": "0xdef1c0ded9bec7f1a1670819833240f027b25eff",
    5
    "chainId": 1,
    6
    "txOrigin": "0xbd49a97300e10325c78d6b4ec864af31623bb5dd",
    7
    "taker": "0x0000000000000000000000000000000000000000",
    8
    "pool": "0x0000000000000000000000000000000000000000000000000000000000000017"
    9
    },
    10
    "tokenList": {
    11
    "name": "Hiding Game",
    12
    "timestamp": "2020-12-07T10:35:15+00:00",
    13
    "version": {
    14
    "major": 1,
    15
    "minor": 0,
    16
    "patch": 0
    17
    },
    18
    "keywords": [
    19
    "keeperdao",
    20
    "rook",
    21
    "list"
    22
    ],
    23
    "tokens": [
    24
    {
    25
    "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
    26
    "chainId": 1,
    27
    "name": "USDCoin",
    28
    "symbol": "USDC",
    29
    "decimals": 6,
    30
    "logoURI": "https://tokens.1inch.exchange/0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48.png"
    31
    },
    32
    {
    33
    "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
    34
    "chainId": 1,
    35
    "name": "WrappedEther",
    36
    "symbol": "WETH",
    37
    "decimals": 18,
    38
    "logoURI": "https://tokens.1inch.exchange/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.png"
    39
    },
    40
    {
    41
    "address": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
    42
    "chainId": 1,
    43
    "name": "DaiStablecoin",
    44
    "symbol": "DAI",
    45
    "decimals": 18,
    46
    "logoURI": "https://tokens.1inch.exchange/0x6b175474e89094c44da98b954eedeac495271d0f.png"
    47
    },
    48
    {
    49
    "address": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
    50
    "chainId": 1,
    51
    "name": "TetherUSD",
    52
    "symbol": "USDT",
    53
    "decimals": 6,
    54
    "logoURI": "https://tokens.1inch.exchange/0xdac17f958d2ee523a2206206994597c13d831ec7.png"
    55
    }
    56
    ],
    57
    "logoURI": "https://miro.medium.com/fit/c/96/96/1*WXMtamzK0_QHWP6dJqFdtA.jpeg"
    58
    },
    59
    "recommendedMinTradeAmounts": {
    60
    "TODO": 1337
    61
    }
    62
    },
    63
    "message": "Ok"
    64
    }
    Copied!

GET /tokenList

Returns list of supported tokens.
  • URL
    /tokenList
  • Method:
    GET
  • Success Response:
    1
    {
    2
    "result": {
    3
    "name": "Hiding Game",
    4
    "timestamp": "2020-12-07T10:35:15+00:00",
    5
    "version": {
    6
    "major": 1,
    7
    "minor": 0,
    8
    "patch": 0
    9
    },
    10
    "keywords": [
    11
    "keeperdao",
    12
    "rook",
    13
    "list"
    14
    ],
    15
    "tokens": [
    16
    {
    17
    "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
    18
    "chainId": 1,
    19
    "name": "USDCoin",
    20
    "symbol": "USDC",
    21
    "decimals": 6,
    22
    "logoURI": "https://tokens.1inch.exchange/0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48.png"
    23
    },
    24
    {
    25
    "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
    26
    "chainId": 1,
    27
    "name": "WrappedEther",
    28
    "symbol": "WETH",
    29
    "decimals": 18,
    30
    "logoURI": "https://tokens.1inch.exchange/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.png"
    31
    },
    32
    {
    33
    "address": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
    34
    "chainId": 1,
    35
    "name": "DaiStablecoin",
    36
    "symbol": "DAI",
    37
    "decimals": 18,
    38
    "logoURI": "https://tokens.1inch.exchange/0x6b175474e89094c44da98b954eedeac495271d0f.png"
    39
    },
    40
    {
    41
    "address": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
    42
    "chainId": 1,
    43
    "name": "TetherUSD",
    44
    "symbol": "USDT",
    45
    "decimals": 6,
    46
    "logoURI": "https://tokens.1inch.exchange/0xdac17f958d2ee523a2206206994597c13d831ec7.png"
    47
    }
    48
    ],
    49
    "logoURI": "https://miro.medium.com/fit/c/96/96/1*WXMtamzK0_QHWP6dJqFdtA.jpeg"
    50
    },
    51
    "message": "Ok"
    52
    }
    Copied!

POST /orders

Post an array of 0x orders to the order book.
  • URL
    /orders
  • Method:
    POST
  • Data Params
    1
    [
    2
    {
    3
    'maker': '0xca77dc47eec9e1c46c9f541ba0f222e741d6236b',
    4
    'taker': '0x0000000000000000000000000000000000000000',
    5
    'makerAmount': '93981000000000000',
    6
    'takerAmount': '50000000',
    7
    'makerToken': '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
    8
    'takerToken': '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
    9
    'salt': '1611073656000',
    10
    'expiry': '1611074656',
    11
    'chainId': 1,
    12
    'txOrigin': '0xbd49a97300e10325c78d6b4ec864af31623bb5dd',
    13
    'pool': '0x0000000000000000000000000000000000000000000000000000000000000017',
    14
    'verifyingContract': '0xdef1c0ded9bec7f1a1670819833240f027b25eff',
    15
    'signature': {
    16
    'signatureType': 3,
    17
    'v': 28,
    18
    'r': '0x6a3182de881d03f216bdcbbc5d78c3c1b86b19c880eef7b1f5cde26cc202a142',
    19
    's': '0x7c68df85de87098c97110515a64f27b9c0ff918abfeed375700d7df653f88ee7'
    20
    }
    21
    },
    22
    {
    23
    'maker': '0xca77dc47eec9e1c46c9f541ba0f222e741d6236b',
    24
    'taker': '0x0000000000000000000000000000000000000000',
    25
    'makerAmount': '50000000',
    26
    'takerAmount': '93981000000000000',
    27
    'makerToken': '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
    28
    'takerToken': '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
    29
    'salt': '1611073656000',
    30
    'expiry': '1611074656',
    31
    'chainId': 1,
    32
    'txOrigin': '0xbd49a97300e10325c78d6b4ec864af31623bb5dd',
    33
    'pool': '0x0000000000000000000000000000000000000000000000000000000000000017',
    34
    'verifyingContract': '0xdef1c0ded9bec7f1a1670819833240f027b25eff',
    35
    'signature': {
    36
    'signatureType': 3,
    37
    'v': 28,
    38
    'r': '0x21dc310bff19f899781a70b52940aee98eaa4dcfaee89274de3e300ca716f9f8',
    39
    's': '0x40967fc8ba28e0eff8c707521e9a81ab396a8b55bda88c3f07aad4ae5da584dd'
    40
    }
    41
    }
    42
    ]
    Copied!
  • Success Response:
    1
    {
    2
    'result': {
    3
    'hashList': [
    4
    '0x345cfe65093ee90aec8824be4b7c24070cf56240e04b6fb6e5b1e003f24527f9',
    5
    '0xeb49fb338838615720dd8423650df146db7b1e6408f747733ff01b11383a91a8'
    6
    ]
    7
    },
    8
    'message': 'Order creation succeeded'
    9
    }
    Copied!

GET /orders

Get orders from the order book.
  • URL
    /orders
  • Method:
    GET
  • URL Params
    Option 1: open=True
    Option 2: maker=[address]
  • Sample Call:
    /orders?open=True
    /orders?maker=0xca77dc47eec9e1c46c9f541ba0f222e741d6236b
  • Success Response:
    1
    {
    2
    "orders": [
    3
    {
    4
    "order": {
    5
    "maker": "0xca77dc47eec9e1c46c9f541ba0f222e741d6236b",
    6
    "taker": "0x0000000000000000000000000000000000000000",
    7
    "makerAmount": "25000000",
    8
    "takerAmount": "46990500000000000",
    9
    "makerToken": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
    10
    "takerToken": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
    11
    "salt": "1611000201000",
    12
    "expiry": "1611001201",
    13
    "chainId": 1,
    14
    "txOrigin": "0xbd49a97300e10325c78d6b4ec864af31623bb5dd",
    15
    "pool": "0x0000000000000000000000000000000000000000000000000000000000000017",
    16
    "verifyingContract": "0xdef1c0ded9bec7f1a1670819833240f027b25eff",
    17
    "signature": {
    18
    "signatureType": 3,
    19
    "v": 28,
    20
    "r": "0xc6e19b108ca4d059d2999e8011237f7a73a4b034993bc4256ab9bc8e6dddf220",
    21
    "s": "0x1f2fd0d9ccb5e022b1f51dd0ad76695ebabdcfbb276aa3b2d306dd1952ca9531"
    22
    }
    23
    },
    24
    "metaData": {
    25
    "orderHash": "0xd505bf04b6cd3efe0c71568441b639cc1767af04480040933fa67b73a4e317f5",
    26
    "makerBalance_makerToken": 1047850867,
    27
    "makerAllowance_makerToken": 115792089237316195423570985008687907853269984665640564039457584007913129634083,
    28
    "status": 4,
    29
    "filledAmount_takerToken": 0,
    30
    "remainingFillableAmount_takerToken": 0
    31
    }
    32
    },
    33
    {
    34
    "order": {
    35
    "maker": "0xca77dc47eec9e1c46c9f541ba0f222e741d6236b",
    36
    "taker": "0x0000000000000000000000000000000000000000",
    37
    "makerAmount": "50000000",
    38
    "takerAmount": "93981000000000000",
    39
    "makerToken": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
    40
    "takerToken": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
    41
    "salt": "1611073656000",
    42
    "expiry": "1611074656",
    43
    "chainId": 1,
    44
    "txOrigin": "0xbd49a97300e10325c78d6b4ec864af31623bb5dd",
    45
    "pool": "0x0000000000000000000000000000000000000000000000000000000000000017",
    46
    "verifyingContract": "0xdef1c0ded9bec7f1a1670819833240f027b25eff",
    47
    "signature": {
    48
    "signatureType": 3,
    49
    "v": 28,
    50
    "r": "0x21dc310bff19f899781a70b52940aee98eaa4dcfaee89274de3e300ca716f9f8",
    51
    "s": "0x40967fc8ba28e0eff8c707521e9a81ab396a8b55bda88c3f07aad4ae5da584dd"
    52
    }
    53
    },
    54
    "metaData": {
    55
    "orderHash": "0xeb49fb338838615720dd8423650df146db7b1e6408f747733ff01b11383a91a8",
    56
    "makerBalance_makerToken": 1121680797,
    57
    "makerAllowance_makerToken": 115792089237316195423570985008687907853269984665640564039457584007913129634083,
    58
    "status": 1,
    59
    "filledAmount_takerToken": 0,
    60
    "remainingFillableAmount_takerToken": 93981000000000000
    61
    }
    62
    },
    63
    {
    64
    "order": {
    65
    "maker": "0xca77dc47eec9e1c46c9f541ba0f222e741d6236b",
    66
    "taker": "0x0000000000000000000000000000000000000000",
    67
    "makerAmount": "25000000",
    68
    "takerAmount": "46990500000000000",
    69
    "makerToken": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
    70
    "takerToken": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
    71
    "salt": "1610994465000",
    72
    "expiry": "1610995465",
    73
    "chainId": 1,
    74
    "txOrigin": "0xbd49a97300e10325c78d6b4ec864af31623bb5dd",
    75
    "pool": "0x0000000000000000000000000000000000000000000000000000000000000017",
    76
    "verifyingContract": "0xdef1c0ded9bec7f1a1670819833240f027b25eff",
    77
    "signature": {
    78
    "signatureType": 3,
    79
    "v": 27,
    80
    "r": "0x5ba37acf248a3b210d52fb89602e27e3ab0020d4ccba3ed131f9ed8db9292884",
    81
    "s": "0x684a65e09e1edf2347d7a34837c4b85d0df49be415159c71c2ad07252113c08c"
    82
    }
    83
    },
    84
    "metaData": {
    85
    "orderHash": "0x62521dcb7c3dc153e9ef7fb2d1ae4df955cacf369f381c4547578b8e316030dc",
    86
    "makerBalance_makerToken": 1047850867,
    87
    "makerAllowance_makerToken": 115792089237316195423570985008687907853269984665640564039457584007913129634083,
    88
    "status": 4,
    89
    "filledAmount_takerToken": 0,
    90
    "remainingFillableAmount_takerToken": 0
    91
    }
    92
    }
    93
    ],
    94
    "message": "Ok"
    95
    }
    Copied!

DELETE /orders [Soft Cancel]

Cancel an array of 0x orders without paying gas. This API informs all keepers that you wish for this order to not be filled. Keepers will be disincentivize to fill a soft canceled order via the Coordination Game. Do note that it will be technically possible for the order to be filled on chain by any whitelisted keeper even after being soft canceled. But a keeper who fills a soft canceled order will be punished, so keepers are incentivized to be on their best behavior. We recommend that you use this soft cancel API for low to medium priority cancels. If you wish to make an emergency high priority cancel, or if you suspect that a keeper is already attempting to fill your order, please make an on chain cancel to the blockchain to guarantee that the order cannot be filled.
In order to make a soft cancel, you must sign a message hash with the private key who's address is the maker of the order you wish to cancel.
Calling this API sets the softCancel property in the order's metaData. The order is considered soft canceled when the softCancel property is less than the current unix epoch time in seconds.
Steps:
1
1.) Build the message text
2
message_text = 'soft cancel order: ' + str(orderHash.lower())
3
message_text = 'soft cancel order: 0xf98099dbfb5e9c9b3e79c9f66ae0a97f8a6bdb264780bd4480e0616a00d626bf'
4
5
2.) Hash the message text
6
7
3.) Sign the hashed message with your private key
8
9
4.) Call this API with the signature and orderHash
Copied!
  • URL
    /orders
  • Method:
    DELETE
  • Data Params
    1
    [
    2
    {
    3
    'orderHash': '0x26368e875790de2513d451c71bb12e5b83b1f897322ee24cd5c246a64628e294',
    4
    'signature': {
    5
    'v': 27,
    6
    'r': '0xf2342382c6f830699955d3b6e357073b5195016c08b8a8c67828ea9d05812214',
    7
    's': '0x12672adc8cb27639785ff4cc3349a6162a66faac6c6c268bad9e96b8d7a8da2f'
    8
    }
    9
    }
    10
    ]
    Copied!
  • Success Response:
    1
    {
    2
    'result': {
    3
    'hashList': [
    4
    '0x26368e875790de2513d451c71bb12e5b83b1f897322ee24cd5c246a64628e294'
    5
    ]
    6
    },
    7
    'message': 'Soft order cancel succeeded'
    8
    }
    Copied!

GET /suggestedReturn

Get suggested trade return based on current DEX prices.
  • URL
    /suggestedReturn
  • Method:
    GET
  • URL Params
    type=[market]
    tokenIn=[address]
    tokenOut=[address]
    amountIn=[amount]
  • Sample Call:
    1
    /suggestedReturn?type=market&tokenIn=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2&tokenOut=0x6b175474e89094c44da98b954eedeac495271d0f&amountIn=134548728591769453840
    Copied!
  • Success Response:
    1
    {"result": 174879564424376618057728, "message": "Ok"}
    Copied!

GET /balances

Get token and ether balances.
  • URL
    /balances
  • Method:
    GET
  • URL Params
    user=[address]
  • Sample Call:
    1
    /balances?address=0xcA77Dc47eec9E1C46c9F541ba0f222E741d6236b
    Copied!
  • Success Response:
    1
    {
    2
    "result": {
    3
    "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee": {
    4
    "balance": 9511349808089782810,
    5
    "decimals": 18
    6
    },
    7
    "0x6b175474e89094c44da98b954eedeac495271d0f": {
    8
    "balance": 0,
    9
    "decimals": 18
    10
    },
    11
    "0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359": {
    12
    "balance": 0,
    13
    "decimals": 18
    14
    }
    15
    },
    16
    "message": "Ok"
    17
    }
    Copied!
Note: The Hiding Book API is under continuous development and is subject to change.

Error codes

1
{
2
-1000: "Unknown error while processing request",
3
-1001: "Down for maintenance. Check back soon",
4
-1002: "Invalid Api Key",
5
-2000: "Invalid request",
6
-2001: "Insufficient maker balance",
7
-2002: "Insufficient maker allowance",
8
-2003: "Order expired",
9
-2004: "orderHash not valid",
10
-2005: "No order matching orderHash",
11
-2006: "Failed to cancel order",
12
-2007: "Order signer and cancel signer mismatch",
13
-2008: "Order has already been soft canceled",
14
-2009: "Price temporarily unavailable",
15
-2010: "Invalid param",
16
-2011: "Order duration is too short",
17
-2012: "Order hash mismatch",
18
-2013: "Invalid order signature",
19
-2014: "Order is not fillable",
20
-2015: "Too many orders",
21
}
Copied!
Last modified 26d ago