> For the complete documentation index, see [llms.txt](https://docs.sodax.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sodax.com/solana/quickstart.md).

# Quickstart

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.

{% hint style="info" %}
Building with an AI assistant? Add the [SODAX Builders MCP](https://builders.sodax.com/) (`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.
{% endhint %}

## 1. Install

```bash
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`).

```typescript
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`](/solana/wallets.md) 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
import { Sodax, ChainKeys } from '@sodax/sdk';

const sodax = new Sodax();
await sodax.initialize(); // optional: pulls the latest token config

const solanaTokens = sodax.swaps.getSupportedSwapTokensByChainId(ChainKeys.SOLANA_MAINNET);
const sol = solanaTokens.find(t => t.symbol === 'SOL');

const arbTokens = sodax.swaps.getSupportedSwapTokensByChainId(ChainKeys.ARBITRUM_MAINNET);
const usdcArb = arbTokens.find(t => t.symbol === '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
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;

// 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: 300n, // or use sodax.swaps.getSwapDeadline()
    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('Filled. Hub tx:', swapResult.value.intentDeliveryInfo.dstTxHash);
} else {
  console.error('Swap failed:', swapResult.error);
}
```

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

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