Complete guide to L1 action signing with phantom agent construction for trading operations on Hyperliquid. Covers order placement, cancellation, modification, and leverage management.
Property | Value |
---|---|
Chain ID | 1337 (NOT Arbitrum’s 42161) |
Domain name | ”Exchange” |
Version | ”1” |
Serialization | Msgpack binary format |
Agent type | Phantom agent from action hash |
Source | ”a” for mainnet, “b” for testnet |
Serialize action
Append metadata
Hash the data
Create agent object
Sign via EIP-712
sign_l1_action()
- only the action payload changes:
order
— Place new orderscancel
— Cancel orders by order IDcancelByCloid
— Cancel orders by client order IDmodify
— Modify existing ordersbatchModify
— Modify multiple ordersupdateLeverage
— Adjust leverage for positionsupdateIsolatedMargin
— Manage isolated marginvaultTransfer
— Transfer between vault accountssubAccountTransfer
— Transfer between sub-accountsscheduleCancel
— Schedule order cancellationnoop
— No operation (for testing)config.json
file:
Start with noop
noop
action first - it validates signing without any side effectsUse testnet
constants.TESTNET_API_URL
Verify signatures
Monitor responses
{"status": "ok"}
or order detailssign_l1_action
handles all complexity internally, making it easy to implement trading operations securely.