Order (signed message)
EIP-712 type Order: fields, type hash and how each field is built from the request JSON.
On this page
Agent prompt
Write a function that signs a Grvt `Order` message {using} and checks it against the signing test cases.
Target environment: Testnet (chain ID 326). Recorded signing cases keep their original environment.
Validate new flows on testnet with test funds before using production.
Read this first: {origin}/bundle/reference/signing/Order.md (~30 KB, plain Markdown: this page plus the AGENTS.md rules, Signing, Environments).
Fetch other pages from the index at {origin}/llms.txt only as you need them. {origin}/downloads/contract.json is a machine-readable contract for tools, not for reading.
Rules: follow AGENTS.md; do not send requests without the user asking you to; read credentials from environment variables; never retry writes automatically; show me the code and how to run it. 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 field | Type | From request | Transform |
|---|---|---|---|
subAccountID | uint64 | order. | copy |
isMarket | bool | order.is_market | copy; absent = false |
timeInForce | uint8 | order.time_in_force | enumCode: integer value of TimeInForce |
postOnly | bool | order.post_only | copy; absent = false |
reduceOnly | bool | order.reduce_only | copy; absent = false |
legs | OrderLeg[] | order.legs | each: map every element as OrderLeg |
nonce | uint32 | order. | sig.nonce |
expiration | int64 | order. | sig.expiration |
domain chainId | uint256 | order. | sig.chainId |
Nested OrderLeg (paths relative to each list element):
| EIP-712 field | Type | From element | Transform |
|---|---|---|---|
assetID | uint256 | instrument | assetKey: the instrument's instrument_hash as uint256 |
contractSize | uint64 | size | scaled: decimal × 10^base_decimals of the instrument |
limitPrice | uint64 | limit_price | scaled: decimal × 10^9; absent = 0 |
isBuyingContract | bool | is_buying_asset | copy; 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. Digest0x7f8fecb8997024f85a5a9a44730f79d2cef290688d6a022d8e98e95ccc1f98c9.market_order— IOC market sell without limit_price (signed as 0). Digest0xad740bcaef463a9de8c758bd333046188a986979fd9e05594d97d3c699ea28ce.multi_leg_order— Two legs on different instruments; legs keep their order. Digest0xb0ae02ef544b7dbccedb1cbb177f99a3803c4d496cde5c29357027e5b8970999.order_max_precision— size uses all 9 base decimals of BTC and limit_price all 9 price decimals. Digest0x2cb9842d6774c5a0a8bb183670b06f7fec2ce1376071f6f3d3128f303dc151c4.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. Digest0x25418b3c70ba5f56b8756c1fad4d58be1bc1e09f2f57d7c97170b5320a6b9c06.