> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sodax.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> SODAX is mainnet-only (no testnet chains or RPC endpoints exist) with a hub-and-spoke architecture; Sonic is the hub. SODAX is non-custodial protocol/software: it routes and settles; independent solvers on the marketplace fill — never say 'our solver', 'the SODAX solver', that SODAX trades, takes custody, or fills orders. For frontend/React integrations, prefer @sodax/dapp-kit hooks over calling @sodax/sdk directly. SDK operations — the methods that build, submit or await a transaction, and the API/quote calls — return Result<T, E> ({ ok: true, value } or { ok: false, error }): check result.ok, never wrap them in try/catch or branch on error.message; discriminate on the narrow error.code union instead. Synchronous config getters (getPartnerFee, getSupportedSwapTokens, getVault, ...) return their value directly, not a Result.

# Quickstart on Solana

> 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.

> [!NOTE]
>
> Building with an AI assistant? Add the [SODAX Builders MCP](https://docs.sodax.com/builders-mcp.md) (`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.

> [!NOTE]
>
> Using the HTTP API instead? The [SODAX Swaps API](https://docs.sodax.com/developers/http-api/swaps.md) works from any language — no SDK required. [Get an API key →](https://docs.sodax.com/developers/how-to/api-keys.md)

## 1. Install

```bash theme={null}
npm install @sodax/sdk @sodax/wallet-sdk-core
# or: pnpm add / yarn add
```

## 2. Create a Solana wallet provider

The SDK talks to Solana through `SolanaWalletProvider` from `@sodax/wallet-sdk-core`, 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`).

```typescript Private key (scripts / bots) theme={null}
import { SolanaWalletProvider } from '@sodax/wallet-sdk-core';

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

```typescript Browser extension (dApps) theme={null}
import { SolanaWalletProvider } from '@sodax/wallet-sdk-core';

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

Building in React? [`@sodax/wallet-sdk-react`](https://docs.sodax.com/developers/packages/connection/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:

```typescript theme={null}
import { Sodax, ChainKeys, type XToken } from '@sodax/sdk';

const sodax = new Sodax();
await sodax.initialize(); // optional; adds no tokens

// find() returns XToken | undefined, so narrow before using the address
const bySymbol = (tokens: readonly XToken[], symbol: string) => {
  const token = tokens.find(t => t.symbol === symbol);
  if (!token) throw new Error(`${symbol} is not a supported swap token`);
  return token;
};

const sol = bySymbol(sodax.swaps.getSupportedSwapTokensByChainId(ChainKeys.SOLANA_MAINNET), 'SOL');
const usdcArb = bySymbol(sodax.swaps.getSupportedSwapTokensByChainId(ChainKeys.ARBITRUM_MAINNET), 'USDC');
```

## 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.

```typescript theme={null}
import type { SolverIntentQuoteRequest } from '@sodax/sdk';

// Quote: 0.1 SOL -> USDC on Arbitrum
const quoteResult = await sodax.swaps.getQuote({
  token_src: sol.address,
  token_dst: usdcArb.address,
  token_src_blockchain_id: ChainKeys.SOLANA_MAINNET,
  token_dst_blockchain_id: ChainKeys.ARBITRUM_MAINNET,
  amount: 100_000_000n, // 0.1 SOL (9 decimals)
  quote_type: 'exact_input',
} satisfies SolverIntentQuoteRequest);

if (!quoteResult.ok) throw new Error('Quote failed');
const { quoted_amount } = quoteResult.value;

// `deadline` is an absolute Unix timestamp; getSwapDeadline turns an offset into one
const deadlineResult = await sodax.swaps.getSwapDeadline(300n); // 5 minutes from now
if (!deadlineResult.ok) throw new Error('Deadline lookup failed');

// Execute
const swapResult = await sodax.swaps.swap({
  params: {
    inputToken: sol.address,
    outputToken: usdcArb.address,
    inputAmount: 100_000_000n,
    minOutputAmount: (quoted_amount * 99n) / 100n, // your slippage policy
    deadline: deadlineResult.value,
    allowPartialFill: false,
    srcChainKey: ChainKeys.SOLANA_MAINNET,
    dstChainKey: ChainKeys.ARBITRUM_MAINNET,
    srcAddress: await walletProvider.getWalletAddress(),
    dstAddress: '0x...', // recipient on the destination network
    solver: '0x0000000000000000000000000000000000000000',
    data: '0x',
  },
  walletProvider,
  timeout: 120_000,
});

if (swapResult.ok) {
  console.log('Submitted. Hub tx:', swapResult.value.intentDeliveryInfo.dstTxHash);
} else {
  console.error('Swap failed:', swapResult.error);
}
```

`ok` means the intent was created, relayed to the hub, and the solver notified — **not** that it was
filled. Poll `sodax.swaps.getStatus({ intent_tx_hash: intentDeliveryInfo.dstTxHash })` until the
status is `SolverIntentStatusCode.SOLVED`, which is the only success signal. The
[main quickstart](https://docs.sodax.com/quickstart.md) has the full polling loop, including why `NOT_FOUND` is not terminal.

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.** Operations return `Result<T>`. Check `result.ok` and branch on typed error codes instead of catching throws.

## Next steps

* [Swaps on Solana](https://docs.sodax.com/solana/swaps.md): quoting modes, fees, limit orders, manual orchestration.
* [Money Market on Solana](https://docs.sodax.com/solana/money-market.md): supply and borrow with cross-network collateral.
* Full API reference: [Swaps](https://docs.sodax.com/developers/packages/foundation/sdk/functional-modules/swaps.md) in the SDK docs.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.