Swaps (Solver)
import { Sodax } from '@sodax/sdk';
const sodax = new Sodax();
// All swap methods are available through sodax.swaps
const quote = await sodax.swaps.getQuote(quoteRequest);Using SDK Config and Constants
import { Sodax, ChainKeys } from '@sodax/sdk';
import type { SpokeChainKey, XToken } from '@sodax/sdk';
const sodax = new Sodax();
// If you want dynamic (backend API-based) configuration, initialize the instance before use.
// By default the configuration bundled in the SDK version you are using is applied.
await sodax.initialize();
// All supported spoke chain keys
const spokeChains: SpokeChainKey[] = sodax.config.getSupportedSpokeChains();
// Supported swap tokens for a specific spoke chain key
const supportedTokens: readonly XToken[] = sodax.swaps.getSupportedSwapTokensByChainId(ChainKeys.BSC_MAINNET);
// All supported swap tokens across every spoke chain
const allTokens: Record<SpokeChainKey, readonly XToken[]> = sodax.swaps.getSupportedSwapTokens();Available Methods
Quote & Fee Methods
Intent Creation & Execution
Backend 2-step submit (opt-in)
Intent Management
Token Approval
Utility Methods
Core Concepts
srcChainKey / dstChainKey
srcChainKey / dstChainKeySigned vs Raw Mode (raw: true / false)
raw: true / false)ChainKeys.* Constants
ChainKeys.* ConstantsResult<T> — No Throws Across Service Boundaries
Result<T> — No Throws Across Service BoundariesError Handling
The canonical error: SodaxError<C>
SodaxError<C>Per-method error code unions
Method
Error type
Codes
Standard context fields
context fieldsDiscrimination example
Relay-layer contract
Migration from pre-SodaxError (breaking)
SodaxError (breaking)Before
After
Request a Quote
Intent Parameters
CreateIntentParams<K>
CreateIntentParams<K>CreateLimitOrderParams<K>
CreateLimitOrderParams<K>Get Fees
Partner Fee
Solver Fee
Get Swap Deadline
Token Approval Flow
Raw Approval Transaction
Stellar Trustline
Estimate Gas for Raw Transactions
Swap (Recommended)
Create Intent Only
Signed execution
Raw transaction
Limit Orders
Create Limit Order (full lifecycle)
Create Limit Order Intent (intent tx only — no relay/solver notify)
Cancel Limit Order / Cancel Intent
Build Cancel Intent (raw or signed — no relay wait)
Submit Intent to Relay API
Get Intent Submit Tx Extra Data
Post Execution to Solver API
Get Intent
Get Filled Intent
Get Intent Status
Get Solved Intent Packet
Get Intent Hash
Error Handling Examples
Handling swap / createLimitOrder Errors
swap / createLimitOrder ErrorsHandling createIntent Errors
createIntent ErrorsSolver API Errors
Last updated