trade.marketOpen reads prices, capacity and approvals before it sends. A quoting loop already knows those, so the fast path skips them.
warm()caches the market list, the execution fee and the wallet’s next request indexes. After it,build.*makes no network call at all.builtis{ to, data, value, requestKey, kind }, ready for any signer. The request key is known before sending.referencePriceis the price the slippage limit is taken from, usually your own feed.- The fast path pays in the collateral token: the market’s token or ETH for a Long, USDC for a Short. Use
trade.marketOpenwhen a swap is needed. - Each build advances the predicted request index, and a failed
sendgives it back. If you build a request and never send it, or send out of order, callwarm()again;trackasks for it by itself when a receipt shows another key. trackfollows a request sent withsend, or any request when you pass{ submitTx }.
build.marketClose works the same way for closes.