Documentation Index
Fetch the complete documentation index at: https://optimism-373f39ad-feat-swap-documentation.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
WalletSwapNamespace
Wallet swap namespace (full operations with signing)
Methods
| Function | Description |
|---|
| price() | Get a price quote for a swap |
| getMarket() | Get a specific swap market |
| getMarkets() | Get available swap markets across all providers |
| supportedChainIds() | Get all supported chain IDs across all providers |
| execute() | Execute a token swap |
price()
Get a price quote for a swap
| Parameter | Type | Description |
|---|
params | SwapPriceParams | Price quote parameters |
params.assetIn | Asset | Token to get price for (required) |
params.assetOut | Asset | Token to price against. Defaults to USDC if not provided. |
params.amountIn | number | Amount of input token (human-readable). Defaults to 1 unit. For exact-in quotes. |
params.amountOut | number | Amount of output token (human-readable). For exact-out quotes. |
params.chainId | SupportedChainId | Chain to get price on |
Returns: Promise resolving to SwapPrice with exchange rate, amounts, price impact, route, and gas estimate
Source ↗
getMarket()
Get a specific swap market
| Parameter | Type | Description |
|---|
params | GetSwapMarketParams | Market identifier |
params.poolId | string | Pool identifier (keccak256 hash of PoolKey) |
params.chainId | SupportedChainId | Chain ID where this market exists |
Returns: Promise resolving to SwapMarket information
Source ↗
getMarkets()
Get available swap markets across all providers
| Parameter | Type | Description |
|---|
params | GetSwapMarketsParams | Optional filtering parameters |
params.chainId | SupportedChainId | Filter by chain ID |
params.asset | Asset | Filter by asset (returns markets containing this asset) |
Returns: Promise resolving to array of SwapMarket from all providers
Source ↗
supportedChainIds()
Get all supported chain IDs across all providers
Returns: Array of unique SupportedChainId values supported by any configured provider
Source ↗
execute()
Execute a token swap
| Parameter | Type | Description |
|---|
params | WalletSwapParams | Swap parameters |
params.assetIn | Asset | Token to sell |
params.assetOut | Asset | Token to buy |
params.chainId | SupportedChainId | Chain to execute swap on |
params.amountIn | number | Amount of input token (human-readable). For exact-in swaps. Mutually exclusive with amountOut. |
params.amountOut | number | Amount of output token (human-readable). For exact-out swaps. Mutually exclusive with amountIn. |
params.slippage | number | Slippage tolerance override (e.g., 0.01 for 1%). Overrides provider and config defaults. |
params.deadline | number | Transaction deadline as Unix timestamp. Defaults to now + 1 minute. |
params.recipient | Address | Recipient address. Defaults to wallet address. |
Returns: Promise resolving to SwapReceipt with transaction receipt, amounts, assets, price, and price impact
Source ↗