Rook
Search…
HidingBook HTTP API
The HidingBook HTTP API is used by market makers, users, and partners to access the Rook ecosystem.

Introduction

HTTP endpoint

The base endpoint URL for the Hiding Book API is:
1
https://hidingbook.keeperdao.com/api/v1/
Copied!
Here is an example API call: https://hidingbook.keeperdao.com/api/v1/info​

Headers

1
{
2
'content-type': 'application/json',
3
}
Copied!

Response format

All endpoints return JSON. Examples of response format is given below.
  • Success
    • {"result": [{.......}, {......}], "message": "Ok"}
  • Failure
    • {"error": "......", "code": "......"}

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!

HTTP Methods

GET /info

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

GET /tokenList

Returns list of supported tokens.
  • 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.
This is how you will place new orders on the Hiding Book. The order format is identical to the 0x v4 RFQ
  • 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 with Multiple Valid Orders:
    1
    {
    2
    'result': [{
    3
    'orderHash': '0x40efabc8916b25e6584c5b3bc06f15035abc91c7c1fd405bc3beaa6e248ea734',
    4
    'code': 201,
    5
    'message': 'Order creation succeeded'
    6
    }, {
    7
    'orderHash': '0xf4a1ea59b3b79a64bc5d7a0050d94a9f09b33607e4b21b5a41dccf9ef13ef095',
    8
    'code': 201,
    9
    'message': 'Order creation succeeded'
    10
    }],
    11
    'message': 'Ok'
    12
    }
    Copied!
  • Success Response with Valid and Invalid Orders:
    1
    {
    2
    'result': [{
    3
    'orderHash': '0x32cc742dea5cee1f3703379c51bca9da68d2b2e0fd8587944fde59ad2c9bf2d9',
    4
    'code': 201,
    5
    'message': 'Order creation succeeded'
    6
    }, {
    7
    'orderHash': '0xfe136dfc8c9437a2b2d3eba60a9ca5b900b8b48a552a85fa6c4d547447217372',
    8
    'error': 'Insufficient maker balance',
    9
    'code': -2001
    10
    }],
    11
    'message': 'Ok'
    12
    }
    Copied!
  • Success Response with Multiple Invalid Orders:
    1
    {
    2
    'result': [{
    3
    'orderHash': '0x1ba51662eaa7fdb89417c57caa23976ed93ad200fbe68801aab910dc342f600f',
    4
    'error': 'Insufficient maker balance',
    5
    'code': -2001
    6
    }, {
    7
    'orderHash': '0x7f2ae02dbef6e465abc5c37947ecc112c039d75b4f6b932320616f645536d41b',
    8
    'error': 'Insufficient maker balance',
    9
    'code': -2001
    10
    }],
    11
    'message': 'Ok'
    12
    }
    Copied!
  • Failure Response:
    1
    {
    2
    'error': 'PostOrder API call failed due to internal error. Payload: Unknown Exception: ',
    3
    'code': -1000
    4
    }
    Copied!
    ​

GET /orders

Get orders from the order book.
  • 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

Cancel an array of 0x orders without paying gas.
This API informs all keepers of your wish for this order to not be filled. Keepers will be disincentivized to fill a soft canceled order via the Reputation system. It will be technically possible for the order to be filled even after being soft canceled, but the Keeper will be punished.
We recommend use of the soft cancel API for low to medium priority cancels.
For emergency high-priority cancels, or if you suspect that a keeper is already attempting to fill your soft-cancelled order, you must make a hard cancel: an on-chain cancel, to guarantee that the order cannot be filled.
Calling this API sets the softCancel property in the order's metaData property. The order is considered soft canceled when the softCancel property is less than the current Unix epoch time in seconds.
The caller must sign a message hash with the private key whose address is the maker of the order to be cancelled.
  1. 1.
    Build the message text
1
message_text = 'soft cancel order: ' + str(orderHash.lower())
2
message_text = 'soft cancel order: 0xf98099dbfb5e9c9b3e79c9f66ae0a97f8a6bdb264780bd4480e0616a00d626bf''
Copied!
2. Hash the message text
3. Sign the hashed message with your private key
4. Call this API with the signature and orderHash
  • 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 with Multiple Valid Orders:
    1
    {
    2
    'result': [{
    3
    'orderHash': '0x40efabc8916b25e6584c5b3bc06f15035abc91c7c1fd405bc3beaa6e248ea734',
    4
    'message': 'Soft order cancel succeeded',
    5
    'code': 201
    6
    }, {
    7
    'orderHash': '0xf4a1ea59b3b79a64bc5d7a0050d94a9f09b33607e4b21b5a41dccf9ef13ef095',
    8
    'message': 'Soft order cancel succeeded',
    9
    'code': 201
    10
    }],
    11
    'message': 'Ok'
    12
    }
    Copied!
  • Success Response with Valid and Invalid Orders:
    1
    {
    2
    'result': [{
    3
    'orderHash': '0x32cc742dea5cee1f3703379c51bca9da68d2b2e0fd8587944fde59ad2c9bf2d9',
    4
    'message': 'Soft order cancel succeeded',
    5
    'code': 201
    6
    }, {
    7
    'orderHash': '0xfe136dfc8c9437a2b2d3eba60a9ca5b900b8b48a552a85fa6c4d547447217372',
    8
    'error': 'Failed to cancel order',
    9
    'code': -2006,
    10
    'message': 'Either the signature is incorrect, the order does not exist, or you are trying to cancel an order you did not sign.'
    11
    }],
    12
    'message': 'Ok'
    13
    }
    Copied!
  • Success Response with Multiple Invalid Orders:
    1
    {
    2
    'result': [{
    3
    'orderHash': '0x1ba51662eaa7fdb89417c57caa23976ed93ad200fbe68801aab910dc342f600f',
    4
    'error': 'Failed to cancel order',
    5
    'code': -2006,
    6
    'message': 'Either the signature is incorrect, the order does not exist, or you are trying to cancel an order you did not sign.'
    7
    }, {
    8
    'orderHash': '0x7f2ae02dbef6e465abc5c37947ecc112c039d75b4f6b932320616f645536d41b',
    9
    'error': 'Failed to cancel order',
    10
    'code': -2006,
    11
    'message': 'Either the signature is incorrect, the order does not exist, or you are trying to cancel an order you did not sign.'
    12
    }],
    13
    'message': 'Ok'
    14
    }
    Copied!
  • Failure Response:
    1
    {
    2
    'error': 'PostOrder API call failed due to internal error. Payload: Unknown Exception: ',
    3
    'code': -1000
    4
    }
    Copied!

GET /suggestedReturn

Get suggested trade return based on current DEX prices.
  • 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.
  • 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!

​