Gets a quote for swapping an exact amount of one token for another token
The client instance to use for the operation.
Parameters for the operation
An object containing the amount of output token and the gas estimate for the operation.
Calculating a quote for a swap of 1 USDC to WETH on Ethereum Sepolia
const quote = await client.getSwapExactInQuote({ tokenIn: ETH_SEPOLIA.contracts.USDC, tokenInAmount: '1', tokenOut: '0xfff9976782d46cc05630d1f6ebab18b2324d6b14', chain: ETH_SEPOLIA,}) Copy
const quote = await client.getSwapExactInQuote({ tokenIn: ETH_SEPOLIA.contracts.USDC, tokenInAmount: '1', tokenOut: '0xfff9976782d46cc05630d1f6ebab18b2324d6b14', chain: ETH_SEPOLIA,})
Use quote to swap
const quote = await client.getSwapExactInQuote({ tokenIn: ETH_SEPOLIA.contracts.USDC, tokenInAmount: '1', tokenOut: '0xfff9976782d46cc05630d1f6ebab18b2324d6b14', chain: ETH_SEPOLIA,})await client.swap({ ...quote, account }) Copy
const quote = await client.getSwapExactInQuote({ tokenIn: ETH_SEPOLIA.contracts.USDC, tokenInAmount: '1', tokenOut: '0xfff9976782d46cc05630d1f6ebab18b2324d6b14', chain: ETH_SEPOLIA,})await client.swap({ ...quote, account })
Gets a quote for swapping an exact amount of one token for another token