Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.arc.network/llms.txt

Use this file to discover all available pages before exploring further.

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 EURC you’ll receive when swapping 1.00 USDC for EURC:
TypeScript
// Set up the swap
import { AppKit } from "@circle-fin/app-kit";
import { createViemAdapterFromPrivateKey } from "@circle-fin/adapter-viem-v2";

const kit = new AppKit();

const adapter = createViemAdapterFromPrivateKey({
  privateKey: process.env.EVM_PRIVATE_KEY as string,
});

const params = {
  from: { adapter, chain: "Arc_Testnet" },
  tokenIn: "USDC",
  amountIn: "1.00",
  tokenOut: "EURC",
  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);