For the complete documentation index, see llms.txt. This page is also available as Markdown.

Quickstart

Install the SDK, wire up a Solana wallet provider, and execute your first cross-network swap from Solana.

This page takes you from zero to a cross-network swap sourced from Solana. No new programs, no token approvals, one signed transaction for your user.

Building with an AI assistant? Add the SODAX Builders MCP (https://builders.sodax.com/mcp) to Claude, Cursor, or any MCP-capable tool and it can pull live token lists, real quotes, and these docs while it writes your integration.

1. Install

npm install @sodax/sdk
# or: pnpm add @sodax/sdk / yarn add @sodax/sdk

2. Create a Solana wallet provider

The SDK talks to Solana through SolanaWalletProvider, built on @solana/web3.js. Use private-key mode for scripts and bots, or browser-extension mode to wrap a connected wallet (Phantom, Backpack, Solflare, or anything exposing publicKey and signTransaction).

import { SolanaWalletProvider } from '@sodax/sdk';

// Private-key mode (scripts / bots)
const walletProvider = new SolanaWalletProvider({
  privateKey: keypairBytes, // Uint8Array, raw keypair bytes
  endpoint: 'https://api.mainnet-beta.solana.com',
});

// Browser-extension mode (dApps)
const walletProvider = new SolanaWalletProvider({
  wallet: walletContextState, // { publicKey, signTransaction }
  endpoint: 'https://api.mainnet-beta.solana.com',
});

Building in React? @sodax/wallet-sdk-react discovers and connects wallets for you and hands back a ready-made provider via useWalletProvider.

3. Look up supported tokens

Token addresses and decimals come from the SDK config, so you never hard-code mints:

4. Quote and swap

swap() runs the full lifecycle: it creates the intent on Solana, verifies the transaction landed, relays it to the hub, and notifies the solver to fill on the destination network. The Solana-specific relay data is handled for you.

A few things you did not have to do:

  • No approval step. Allowances are an EVM and Stellar concept; on Solana isAllowanceValid passes without an on-chain transaction.

  • No relay bookkeeping. Manually orchestrated Solana intents need relay extra data (getIntentSubmitTxExtraData); swap() takes care of it.

  • No error guessing. Every method returns Result<T>. Check result.ok and branch on typed error codes instead of catching throws.

Next steps

Last updated