Skip to main content

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.

WalletSwapNamespace

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

Methods

FunctionDescription
getQuote()Get a swap quote with the wallet address as recipient. Ensures calldata is encoded for the real wallet, not a placeholder.
getQuotes()Get quotes from all providers with the wallet address as recipient.
getMarket()Get a specific swap market by ID.
getMarkets()Get available swap markets across all providers
supportedChainIds()Get all supported chain IDs across all providers
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.
ParameterTypeDescription
paramsSwapQuoteParams
Source ↗

getQuotes()

Get quotes from all providers with the wallet address as recipient.
ParameterTypeDescription
paramsSwapQuoteParams
Source ↗

getMarket()

Get a specific swap market by ID.
ParameterTypeDescription
paramsGetSwapMarketParamsMarket identifier (poolId + chainId)
providerSwapProviderNameOptional provider name to query directly instead of searching all
Returns: Market information Source ↗

getMarkets()

Get available swap markets across all providers
ParameterTypeDescription
paramsGetSwapMarketsParamsOptional filtering by chainId or asset
Returns: Promise resolving to array of markets from all providers Source ↗

supportedChainIds()

Get all supported chain IDs across all providers Source ↗

execute()

Execute a token swap. Accepts either raw params (re-quotes internally) or a pre-built SwapQuote (skips re-quoting).
ParameterTypeDescription
params`WalletSwapParamsSwapQuote`Swap parameters or a pre-built SwapQuote from getQuote()
Returns: Swap receipt with transaction details Source ↗