GetQuote prices a trade and persists it. The quote_hash it returns is what the deposit carries, so call it once the user is ready to act. For prices that update as the user types, use PreviewQuote, which is identical minus the persistence and the addresses.
Request
- TypeScript SDK
- Wire
Response
QuoteResponse is a oneof: cross_chain or same_chain_swap. Both carry the fields below — cross_chain adds the gasless fields, see GetQuote — so read the case and branch on execution, not on shape.
Preview while typing
PreviewQuote takes the same economic inputs and omits recipient and refund_address. It returns amount_out, min_amount_out, slippage_bps, fee_breakdown, and a same_chain_swap flag, without writing anything.
GetQuote when the user commits.
Refresh before signing
A quote’s price is fixed when it is issued and does not track the market. Re-quote if the user has been sitting on a confirmation screen: refreshing costs one request, while a stale quote either prices badly or, if the market moved past a floor, fails to fill and refunds. A common pattern is to re-quote on an interval while a confirmation screen is open, and to block the deposit button during the refresh so the hash being signed is always the one displayed.Source swaps
Whensrc_token differs from bridge_token_src in the returned params, the deposit has to route through an aggregator on the source chain. That routing is not in the quote; fetch it with GetSwapInstructions at deposit time so it is fresh. See Deposit on EVM.
Failures
Quote failures split cleanly.INVALID_ARGUMENT means the request itself is wrong — unsupported pair, size outside the accepted band, gas drop over the cap — and retrying it unchanged will fail again. UNAVAILABLE means the operator cannot price right now — insufficient inventory, a stale price feed, an aggregator that did not respond — and the same request may succeed shortly after. See Error handling.