Skip to main content
You can get a pre-swap estimate of the amount you’ll receive before swapping.

Prerequisites

Before you begin, ensure that you’ve: These are required so any example below runs with a valid kit and adapter.

Estimate swap amount

This example estimates how much USDC you’ll receive when swapping 1.00 USDT for USDC:
TypeScript
// Set up the swap
const params = {
  from: { adapter, chain: "Ethereum" },
  tokenIn: "USDT",
  amountIn: "1.00",
  tokenOut: "USDC",
  config: {
    kitKey: process.env.KIT_KEY as string,
  },
};

// Estimate swap amount
const estimate = await kit.estimateSwap(params);
console.log(`Estimated output: ${estimate.estimatedOutput}`);

// Proceed to swap
const result = await kit.swap(params);