Skip to main content
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.
  • built is { to, data, value, requestKey, kind }, ready for any signer. The request key is known before sending.
  • referencePrice is 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.marketOpen when a swap is needed.
  • Each build advances the predicted request index, and a failed send gives it back. If you build a request and never send it, or send out of order, call warm() again; track asks for it by itself when a receipt shows another key.
  • track follows a request sent with send, or any request when you pass { submitTx }.
build.marketClose works the same way for closes.