Create the credential
With the master session,POST /v1/credentials:
quote_signeris the address of a separate EOA key (quotes).expires_atis Unix seconds, at most 90 days ahead.- The answer’s
token(mk_…) is returned once: it goes to the quoting host. Itsidis the quote identity ID.
Fund a pool
Escrow venues (Hyperliquid, Polymarket, GMX), with the master session; the linked account signs.- Persist a new
client_request_id. POST /v1/maker/{venue}/prepare:- Check
fundingand everyto_signitem (maker capital, signing). Sign each with itssigner. - Before
expires_at, send one signature per item toPOST /v1/maker/preparations/{id}/signatures:{"signatures":[{"kind":"fund","signature":"0x…"}]}. - Poll
GET /v1/maker/preparations/{id}untilstateiscomplete(the pool islive) orfailed(the order’serrorsays why).
funding_source is wallet: move GMX Account funds to the linked address first with your own transferOut (margin transfers). Deliveries and releases land in GMX Accounts.
Quote
With the credential as$MAKER_TOKEN and its id as $IDENTITY_ID.
- Read the identity’s quote lines and their
revisionwithGET /v1/quote-lines, and its pools withGET /v1/orders(capital_pool: true, withavailable_to_quote). - Renew the lease, 5 to 120 seconds:
- Prepare every line, one per venue.
valid_untilis Unix seconds within the next five minutes;expected_revisionis the lines’revision. - Rebuild each draft from your lines before signing (quote lines, signing). Sign each draft’s single
quote_setitem with the quote key. - Publish
{"preparation_id":"…","signatures":[{"draft_id":"…","signature":"0x…"}]}withPOST /v1/quote-lines, within five minutes of preparation, beforevalid_untiland while the lease is live. Every pool switches at once, or none. - Repeat: renew the lease before it expires and publish again before
valid_until. After a funding, publish again once the pool islive.
Follow pools and fills with a snapshot and replay. Stop with cancellation.
Deliver on Lighter
Deadlines and refusals: active market making.-
Accept each new fill with
POST /v1/fills/{id}/acceptbeforemaker_accept_by. Accept only a fill you can deliver. -
Once the fill is
PAIDwithpayment_verified_atset, read your transfer fee:GET https://mainnet.zklighter.elliot.ai/api/v1/transferFeeInfo?account_index=<yours>&to_account_index=<delivery_to>, authenticated by your API key. Lighter charges it on top of the amount and refuses a transfer signed with another fee. -
Sign one transfer:
- Persist the signed transfer and its hash, then send it.
-
Once Lighter shows it executed, report it with
POST /v1/fills/{id}/delivery{"tx_hash":"…"}beforereport_by. Report again after425or502;400and409are final, exceptnot_duebefore the payment locks.
deliver_by, at the nonce Lighter’s nextNonce returns. After a restart, resend or report what you persisted before signing anything new.
Deliver on Aster
-
Accept each new fill with
POST /v1/fills/{id}/acceptbeforemaker_accept_by. -
Keep the inventory in the Spot wallet, or move it there from margin:
POST https://fapi.asterdex.com/fapi/v3/asset/wallet/transfer,kindTypeFUTURE_SPOT, by an agent withcanPerpTrade. Keep the account public: Aster refuses a private account’s transfers. -
Once the fill is
PAIDwithpayment_verified_atset, sendPOST https://chainapi.asterdex.com/aster-chain/v3/transfer?asset=USDT&amount=…&toAddress=…&clientTranId=…&nonce=…&user=…&signature=…: -
Report the reply’s
transferIdwithPOST /v1/fills/{id}/delivery{"tx_hash":"…"}until accepted, beforereport_by.425means the Spot histories do not show it yet.
- A lost answer is resent with the same
clientTranIdwithin a minute of its nonce: Aster returns the first transfer and moves nothing more. 032209 Daily transfer limit exceededmeans the Spot wallet holds too little.- Never send one fill’s transfer under another fill’s ID.