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

{/*
⚠️ WARNING: DO NOT EDIT THIS FILE DIRECTLY ⚠️

This file is auto-generated from the Actions SDK source code.

To update this documentation:
1. Bump the SDK version in package.json: pnpm add @eth-optimism/actions-sdk@latest
2. Run the generation script: pnpm prebuild

Any manual edits will be overwritten on the next generation.
*/}

## WalletSwapNamespace

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

### Methods

| Function                                      | Description                                                                                                                |
| --------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| **[getQuote()](#getquote)**                   | Get a swap quote with the wallet address as recipient. Ensures calldata is encoded for the real wallet, not a placeholder. |
| **[getQuotes()](#getquotes)**                 | Get quotes from all providers with the wallet address as recipient.                                                        |
| **[getMarket()](#getmarket)**                 | Get a specific swap market by ID.                                                                                          |
| **[getMarkets()](#getmarkets)**               | Get available swap markets across all providers                                                                            |
| **[supportedChainIds()](#supportedchainids)** | Get all supported chain IDs across all providers                                                                           |
| **[execute()](#execute)**                     | Execute a token swap. Accepts either raw params (re-quotes internally) or a pre-built SwapQuote (skips re-quoting).        |

#### `getQuote()`

Get a swap quote with the wallet address as recipient.
Ensures calldata is encoded for the real wallet, not a placeholder.

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

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

***

#### `getQuotes()`

Get quotes from all providers with the wallet address as recipient.

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

<sub>[<Icon icon="github" /> Source ↗](https://github.com/ethereum-optimism/actions/blob/@eth-optimism/actions-sdk@0.4.0/packages/sdk/src/swap/namespaces/WalletSwapNamespace.ts#L42)</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.4.0/packages/sdk/src/swap/namespaces/BaseSwapNamespace.ts#L145)</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.4.0/packages/sdk/src/swap/namespaces/BaseSwapNamespace.ts#L174)</sub>

***

#### `supportedChainIds()`

Get all supported chain IDs across all providers

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

***

#### `execute()`

Execute a token swap.
Accepts either raw params (re-quotes internally) or a pre-built SwapQuote (skips re-quoting).

| 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.4.0/packages/sdk/src/swap/namespaces/WalletSwapNamespace.ts#L55)</sub>

***
