Coinbase Server Wallet icon

Coinbase Server Wallet

Interact with Coinbase Server Wallet API v2 (EVM & Solana)

Actions61

EVM Swaps → Get Evm Swap Price

AI-generated

Summary

Retrieve the price for executing an EVM token swap.

Inputs

  • network (required) — The network on which to perform the swap (e.g., Base, Ethereum, Arbitrum, Optimism).
  • toToken (required) — The 0x-prefixed contract address of the token to receive.
  • fromToken (required) — The 0x-prefixed contract address of the token to send.
  • fromAmount (required) — The amount of the fromToken to send, specified in atomic units.
  • taker (required) — The 0x-prefixed address holding the fromToken balance, with the Permit2 allowance set.
  • signerAddress — The 0x-prefixed EOA address for signing the Permit2 message, needed if taker is a contract.
  • gasPrice — The target gas price for the swap in Wei; an estimate will be used if not provided.
  • slippageBps — Maximum acceptable slippage of the toToken in basis points (0 for no slippage; defaults to 100 bps if not set).
  • requestOptions — Additional options for the request such as batching settings and timeout.

Output shape

a single record containing the swap price details

Response includes the estimated price for the swap based on the provided parameters.

Examples

Example 1: Get the swap price for exchanging ETH to USDC on the Ethereum network with a specified amount.

Network: Ethereum, From Token: 0x6B175474E89094C44Da98b954EedeAC495271d0F (ETH), To Token: 0x7F5c764cBc14f9669B88837ca1490cCa17c31607 (USDC), From Amount: 1000000000000000000 (1 ETH), Taker: 0xAc0974bec39a17e36ba4a6b4d238ff944bacb478, Slippage Bps: 100.

Example 2: Fetch swap price for a swap from DAI to USDT with tolerance for slippage on Optimism.

Network: Optimism, From Token: 0x6B175474E89094C44Da98b954EedeAC495271d0F (DAI), To Token: 0xdac17f958d2ee523a2206206994597c13d831ec7 (USDT), From Amount: 2000000000000000000 (2 DAI), Taker: 0xAc0974bec39a17e36ba4a6b4d238ff944bacb478, Slippage Bps: 200.

Discussion