Before you start
1
Get an API key
Keyless requests work, but they are rate limited per IP and priced with extra spread. See API keys.
2
Choose a transport
Install the SDK, or generate stubs from
api.proto. See Transports.- TypeScript SDK
- Wire
1. Connect
- TypeScript SDK
- Wire
2. Find the tokens
Token addresses come from the catalog, never hardcoded.ListTokens returns everything quotable with decimals and chain id attached.
- TypeScript SDK
- Wire
3. Quote
Amounts are decimal strings in the token’s base units.25000000 is 25 USDC at six decimals.
- TypeScript SDK
- Wire
quote_hash now. It identifies the order for the rest of its life.
4. Deposit
The user approves the deposit contract —router_address from the quote — if the source token is an ERC-20, then calls depositToken with the quote hash. The SDK resolves which steps are needed and returns them in order.
- TypeScript SDK
- Wire
depositNative with the amount as transaction value and no approval. Deposits that swap on the source chain call depositWithSwap; see Deposit on EVM.
5. Track
PollGetOrder with the quote hash until the state is terminal.
- TypeScript SDK
- Wire
GetOrder returns the quote with no order attached. That is expected for the first few seconds.
The same order is viewable at <EXPLORER_URL>/<quote_hash>, which is a useful link to hand users while they wait.
Next
Get a quote
Referrers, gas drop, slippage, and the same-chain case.
Track an order
Polling, states, and what to render for each.
Deposit on EVM
Approvals, permit, native, and source swaps.
Error handling
Which failures are retryable and which are not.