Getting this code running and having a submitted swap settle are two different things — see the
last step, Poll until settled.
1
Install
@sodax/sdk builds and tracks the intent, @sodax/wallet-sdk-core signs it. Both
are needed — the SDK never holds a key.Every snippet below is one ESM module, top to bottom.2
Initialize
walletClient / publicClient pair instead of a key. See
@sodax/wallet-sdk-core.3
Quote
4
Execute
result.ok / error.code — never try/catch on the message string.This example swaps native gas tokens, which need no allowance.
swap() does not approve for
you — with an ERC-20 input, call sodax.swaps.isAllowanceValid and then
sodax.swaps.approve first, or the swap fails. Full sequence:
Make a swap (SDK).5
Poll until settled
SOLVED as the only success
signal and don’t design around a fixed duration.Watch destination fills via fill_tx_hash, or track cross-network message delivery on
SODAX Scan.Next
Full swap walkthrough
Wallet setup, errors, limit orders, and status codes.
HTTP Swap API
Quote, build intent, submit-tx, status — any language.
AI coding agents
Install
@sodax/skills so agents write v2-correct code.Builders MCP
Live chains, tokens, quotes, and SDK docs for agents.