# Execute Solana Swap

Execute a LI.FI quote whose source chain is Solana. This path is an alias of Execute Swap.

## Overview

`POST /v1/swap/execute-solana` uses the same request schema and the same handler as [Execute Swap](https://docs.aureahub.com/docs/swap-execute.md). The handler takes the Solana path when the target chain is `solana` — the target chain is `chain`, or the wallet's chain if omitted. With any other chain it runs the EVM path described on Execute Swap.

For a quote with `sourceChainType: "solana"`, LI.FI supplies the swap as a base64-encoded Solana `VersionedTransaction` in `transactionData.data`. Pass `transactionData` unchanged. Aurea signs that transaction with the wallet's server-held keypair, sends it, and waits for confirmation before responding.

- The response has `status: "confirmed"` and the Solana transaction signature in `txHash`; `fromToken`, `toToken`, `fromAmount` and `expectedToAmount` are empty strings. There is no broadcast step.
- There is no approval step on Solana: Check Allowance and Approve Token return `not_applicable` values.
- **Non-custodial Solana wallets are not supported.** Wallets with key management scheme `client_side`, `client_side_pending` or `mpc_tss` get `400` `Non-custodial Solana swaps are not yet supported`.
- `quoteExpiry` and `gasless` have no effect on this path.

## Endpoint

### `POST /v1/swap/execute-solana`

Authentication: bearer token required.

Alias of POST /v1/swap/execute. For custodial Solana wallets, signs and sends the quote's VersionedTransaction.

**Request body**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `walletId` | string (uuid) | yes | Solana wallet that executes the swap. Must belong to the authenticated user. |
| `quoteId` | string | yes | `quoteId` from Get Quote; stored with the transaction. |
| `transactionData` | object | yes | `transactionData` from the quote. `data` (required) holds the base64 `VersionedTransaction`; `to` may be `null`; `value` and `gasLimit` are not needed on Solana. |
| `chain` | string | no | `solana` selects the Solana path. Defaults to the wallet's chain. |
| `isTestnet` | boolean | no | Use Solana devnet. Defaults to `false`. |
| `fromAmount` | string | no | Stored in transaction metadata and used as the record's amount. |
| `toAmount` | string | no | Stored in transaction metadata. |
| `fromTokenSymbol` | string | no | Stored in transaction metadata. |
| `toTokenSymbol` | string | no | Stored in transaction metadata. |
| `fromTokenDecimals` | integer | no | Stored in transaction metadata. |
| `toTokenDecimals` | integer | no | Stored in transaction metadata. |
| `fromTokenAddress` | string | no | Stored in transaction metadata. |
| `toTokenAddress` | string | no | Stored in transaction metadata. |
| `quoteExpiry` | string | no | Accepted (shared schema); not used on the Solana path. |
| `gasless` | boolean | no | Accepted (shared schema); not used. |

**Responses**

`200` OK

```json
{
  "transactionId": "…",
  "txHash": "5Uf…",
  "status": "confirmed",
  "fromToken": "",
  "toToken": "",
  "fromAmount": "",
  "expectedToAmount": ""
}
```

`400` Bad Request

```json
{
  "statusCode": 400,
  "error": "BadRequestError",
  "message": "Non-custodial Solana swaps are not yet supported"
}
```

`404` Not Found

```json
{
  "statusCode": 404,
  "error": "NotFoundError",
  "message": "Wallet not found"
}
```

Other `400` responses: `Request validation failed`, `Cannot execute swap from watch-only wallet`, and `Failed to execute Solana swap: …` when signing or sending fails.

## Implementation

```javascript
// quote = response of POST /v1/swap/quote with sourceChainType 'solana'
async function executeSolanaSwap(token, walletId, quote) {
  if (quote.sourceChainType !== 'solana') throw new Error('Not a Solana-source quote');

  const res = await fetch('https://api.aureahub.com/v1/swap/execute-solana', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': `Bearer ${token}`
    },
    body: JSON.stringify({
      walletId,
      chain: 'solana',
      quoteId: quote.quoteId,
      transactionData: quote.transactionData, // data = base64 VersionedTransaction
      fromAmount: quote.fromAmount,
      toAmount: quote.toAmount,
      fromTokenSymbol: quote.fromToken.symbol,
      toTokenSymbol: quote.toToken.symbol
    })
  });

  const body = await res.json();
  if (!res.ok) throw new Error(`${res.status}: ${body.message}`);

  // { transactionId, txHash: '<Solana signature>', status: 'confirmed', ... }
  return body;
}
```

---

Web version: https://docs.aureahub.com/#swap-execute-solana
