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

# SVM Transactions

> Build and inspect Solana swap transactions through the Chainworks API.

Build unsigned transactions for token swaps.

## Get Buy Transaction

Build an unsigned transaction for buying tokens.

**Endpoint:** `/svm/buy/transaction`

| Parameter | Type | Required | Description |
| - | - | - | - |
| `chain` | string | Yes | Always `sol` |
| `token` | string | Yes | Token mint address |
| `swapMode` | string | Yes | `ExactIn` or `ExactOut` |
| `amountIn` | string | Yes | Amount of SOL in lamports |
| `wallet` | string | Yes | Wallet public key |
| `slippageBps` | number | No | Slippage tolerance (default: 100 = 1%) |
| `feeBps` | number | No | Fee in basis points (0-175) |
| `feeRecipient` | string | No | Wallet to receive fees |
| `sendRoute` | string | No | `Public`, `PublicWithNonce`, `Antimev`, or `AntimevWithNonce` |
| `prioFees` | string | No | Priority fees (see below) |
| `bribeFees` | string | Based on sendRoute | bribe fees (see below) |
| `nonceAccount` | string | Based on sendRoute | Nonce account for transaction exclusivity |
| `pool` | string | No | When supplied, this parameter restricts quoting to the specified pool, subject to liquidity and compatibility requirements. |

**Example:**

> [tab] Socket.IO
>
> ```typescript theme={null}
> socket.emit("/svm/buy/transaction", {
>   chain: "sol",
>   token: "DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",
>   swapMode: "ExactIn",
>   amountIn: "1000000000",
>   wallet: "YourSolanaWalletPublicKey",
>   slippageBps: 100,
>   prioFees: "100000",
>   pool: "PoolAddress", // Optional: specific pool address
> });
> ```

> [tab] HTTP
>
> ```typescript theme={null}
> await fetch("https://api.chainworks.co/svm/buy/transaction", {
>   method: "POST",
>   headers: {
>     "Content-Type": "application/json",
>     Authorization: CHAINWORKS_API_AUTH_TOKEN,
>   },
>   body: JSON.stringify({
>     chain: "sol",
>     token: "DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",
>     swapMode: "ExactIn",
>     amountIn: "1000000000",
>     wallet: "YourSolanaWalletPublicKey",
>     slippageBps: 100,
>     prioFees: "100000",
>     pool: "PoolAddress", // Optional: specific pool address
>   }),
> });
> ```

## Get Sell Transaction

**Endpoint:** `/svm/sell/transaction`

Same parameters as buy transaction.

## Create Nonce Account Transaction

Build an unsigned transaction that creates a durable nonce account. A nonce account is required by the `PublicWithNonce` and `AntimevWithNonce` send routes (see [Fees & Routes](https://docs.chainworks.org/svm/fees-and-routes.md)). Sign the returned transaction and submit it with [Send Transaction](https://docs.chainworks.org/svm/send-transaction.md), then pass the new account address as the `nonceAccount` on future requests.

**Endpoint:** `/svm/nonce-account/create/transaction`

| Parameter | Type | Required | Description |
| - | - | - | - |
| `chain` | string | Yes | Always `sol` |
| `wallet` | string | Yes | Public key that will own and fund the nonce account |
| `sendRoute` | string | No | `Public`, `PublicWithNonce`, `Antimev`, or `AntimevWithNonce` (see [Fees & Routes](https://docs.chainworks.org/svm/fees-and-routes.md)) |
| `prioFees` | string | No | Priority fees in lamports |
| `bribeFees` | string | Based on sendRoute | Bribe fees in lamports |
| `nonceAccount` | string | Based on sendRoute | Existing nonce account, when the chosen route requires one |

**Example:**

> [tab] Socket.IO
>
> ```typescript theme={null}
> socket.emit("/svm/nonce-account/create/transaction", {
>   chain: "sol",
>   wallet: "YourSolanaWalletPublicKey",
> });
> ```

> [tab] HTTP
>
> ```typescript theme={null}
> await fetch("https://api.chainworks.co/svm/nonce-account/create/transaction", {
>   method: "POST",
>   headers: {
>     "Content-Type": "application/json",
>     Authorization: CHAINWORKS_API_AUTH_TOKEN,
>   },
>   body: JSON.stringify({
>     chain: "sol",
>     wallet: "YourSolanaWalletPublicKey",
>   }),
> });
> ```


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