Developers

Order (signed message)

EIP-712 type Order: fields, type hash and how each field is built from the request JSON.

On this page

Signed by create_order, bulk_orders. Step-by-step walkthrough: Signing.

Order(uint64 subAccountID,bool isMarket,uint8 timeInForce,bool postOnly,bool reduceOnly,OrderLeg[] legs,uint32 nonce,int64 expiration)OrderLeg(uint256 assetID,uint64 contractSize,uint64 limitPrice,bool isBuyingContract)

Type hash 0xb4b857ba9641f20a7c4007c73e548a2ee5afb7207744cc41fa7849451419bbb2. Domain {name: "GRVT Exchange", version: "0", chainId}.

Fields and where they come from

EIP-712 fieldTypeFrom requestTransform
subAccountIDuint64order.sub_account_idcopy
isMarketboolorder.is_marketcopy; absent = false
timeInForceuint8order.time_in_forceenumCode: integer value of TimeInForce
postOnlyboolorder.post_onlycopy; absent = false
reduceOnlyboolorder.reduce_onlycopy; absent = false
legsOrderLeg[]order.legseach: map every element as OrderLeg
nonceuint32order.signature.noncesig.nonce
expirationint64order.signature.expirationsig.expiration
domain chainIduint256order.signature.chain_idsig.chainId

Nested OrderLeg (paths relative to each list element):

EIP-712 fieldTypeFrom elementTransform
assetIDuint256instrumentassetKey: the instrument's instrument_hash as uint256
contractSizeuint64sizescaled: decimal × 10^base_decimals of the instrument
limitPriceuint64limit_pricescaled: decimal × 10^9; absent = 0
isBuyingContractboolis_buying_assetcopy; absent = false

Signing test cases

In signing.json, signed by the public test key:

  • limit_order — The standard first order: post-only GTT limit buy of 0.01 BTC_USDT_Perp at 60000 (600 USDT notional), Order type. Digest 0x7f8fecb8997024f85a5a9a44730f79d2cef290688d6a022d8e98e95ccc1f98c9.
  • market_order — IOC market sell without limit_price (signed as 0). Digest 0xad740bcaef463a9de8c758bd333046188a986979fd9e05594d97d3c699ea28ce.
  • multi_leg_order — Two legs on different instruments; legs keep their order. Digest 0xb0ae02ef544b7dbccedb1cbb177f99a3803c4d496cde5c29357027e5b8970999.
  • order_max_precision — size uses all 9 base decimals of BTC and limit_price all 9 price decimals. Digest 0x2cb9842d6774c5a0a8bb183670b06f7fec2ce1376071f6f3d3128f303dc151c4.
  • bulk_orders, orders[0] — Two orders in one bulk call, each signed on its own with its own nonce: a plain Order and an OrderWithBuilderFee, both on BTC_USDT_Perp (the server requires one asset per bulk call). The cancel list and time_to_live_ms are not signed. Digest 0x25418b3c70ba5f56b8756c1fad4d58be1bc1e09f2f57d7c97170b5320a6b9c06.
Sign the example in your browser
esc

↑ ↓ move↵ open⇧↵ open .mdTry an error code like 2002

Keyboard shortcuts

⌘ K
Search the docs
/
Search
l
Next code language (Python → TypeScript → Go → Rust → curl → WebSocket)
j / k
Next / previous page
t
Light / dark theme
?
This help
Esc
Close dialogs and drawers