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

# Swap Documentation

> API reference for Actions SDK swap operations, functions, and parameters.

## WalletSwapNamespace

Wallet swap namespace with full operations including signing.
Provides getQuote() for pricing and execute() for swapping tokens.

### Methods

| Function                                      | Description                                                                                                                                                                                                                                                                                                                                                   |
| --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **[supportedChainIds()](#supportedchainids)** | Union of chain IDs supported by any configured provider.                                                                                                                                                                                                                                                                                                      |
| **[getQuote()](#getquote)**                   | Get a swap quote bound to the wallet as executor. Defaults the output recipient to the wallet address when omitted.                                                                                                                                                                                                                                           |
| **[getQuotes()](#getquotes)**                 | Get quotes from all providers bound to the wallet as executor.                                                                                                                                                                                                                                                                                                |
| **[getMarket()](#getmarket)**                 | Get a specific swap market by ID.                                                                                                                                                                                                                                                                                                                             |
| **[getMarkets()](#getmarkets)**               | Get available swap markets across all providers                                                                                                                                                                                                                                                                                                               |
| **[execute()](#execute)**                     | Execute a token swap. Accepts either raw params (re-quotes internally) or a pre-built SwapQuote (skips re-quoting). When a pre-built quote is passed, its wallet address must equal this wallet's address so approvals are checked against the account that will execute the swap. Re-quote via `wallet.swap.getQuote(...)` to bind the quote to this wallet. |

#### `supportedChainIds()`

Union of chain IDs supported by any configured provider.

<sub>[<Icon icon="github" /> Source ↗](https://github.com/ethereum-optimism/actions/blob/@eth-optimism/actions-sdk@0.8.1/packages/sdk/src/actions/shared/BaseNamespace.ts#L29)</sub>

***

#### `getQuote()`

Get a swap quote bound to the wallet as executor.
Defaults the output recipient to the wallet address when omitted.

| Parameter | Type              | Description |
| --------- | ----------------- | ----------- |
| `params`  | `SwapQuoteParams` |             |

<sub>[<Icon icon="github" /> Source ↗](https://github.com/ethereum-optimism/actions/blob/@eth-optimism/actions-sdk@0.8.1/packages/sdk/src/actions/swap/namespaces/WalletSwapNamespace.ts#L44)</sub>

***

#### `getQuotes()`

Get quotes from all providers bound to the wallet as executor.

| Parameter | Type              | Description |
| --------- | ----------------- | ----------- |
| `params`  | `SwapQuoteParams` |             |

<sub>[<Icon icon="github" /> Source ↗](https://github.com/ethereum-optimism/actions/blob/@eth-optimism/actions-sdk@0.8.1/packages/sdk/src/actions/swap/namespaces/WalletSwapNamespace.ts#L59)</sub>

***

#### `getMarket()`

Get a specific swap market by ID.

| Parameter  | Type                  | Description                                                       |
| ---------- | --------------------- | ----------------------------------------------------------------- |
| `params`   | `GetSwapMarketParams` | Market identifier (poolId + chainId)                              |
| `provider` | `SwapProviderName`    | Optional provider name to query directly instead of searching all |

**Returns:** Market information

<sub>[<Icon icon="github" /> Source ↗](https://github.com/ethereum-optimism/actions/blob/@eth-optimism/actions-sdk@0.8.1/packages/sdk/src/actions/swap/namespaces/BaseSwapNamespace.ts#L119)</sub>

***

#### `getMarkets()`

Get available swap markets across all providers

| Parameter | Type                   | Description                            |
| --------- | ---------------------- | -------------------------------------- |
| `params`  | `GetSwapMarketsParams` | Optional filtering by chainId or asset |

**Returns:** Promise resolving to array of markets from all providers

<sub>[<Icon icon="github" /> Source ↗](https://github.com/ethereum-optimism/actions/blob/@eth-optimism/actions-sdk@0.8.1/packages/sdk/src/actions/swap/namespaces/BaseSwapNamespace.ts#L149)</sub>

***

#### `execute()`

Execute a token swap.
Accepts either raw params (re-quotes internally) or a pre-built SwapQuote
(skips re-quoting). When a pre-built quote is passed, its wallet address
must equal this wallet's address so approvals are checked against the
account that will execute the swap. Re-quote via
`wallet.swap.getQuote(...)` to bind the quote to this wallet.

| Parameter | Type               | Description |                                                          |
| --------- | ------------------ | ----------- | -------------------------------------------------------- |
| `params`  | \`WalletSwapParams | SwapQuote\` | Swap parameters or a pre-built SwapQuote from getQuote() |

**Returns:** Swap receipt with transaction details

<sub>[<Icon icon="github" /> Source ↗](https://github.com/ethereum-optimism/actions/blob/@eth-optimism/actions-sdk@0.8.1/packages/sdk/src/actions/swap/namespaces/WalletSwapNamespace.ts#L85)</sub>

***
