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.

Set a slippage tolerance or stop limit to avoid receiving less than expected on a swap due to market fluctuations:
  • A slippage tolerance lets you set the maximum percentage difference you’re willing to accept between the estimated and actual swap amount, expressed in bps (for example, 100 bps = 1%).
  • A stop limit lets you set the exact minimum amount you want to receive.
If both are configured, the stop limit takes precedence.

Prerequisites

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

Set slippage tolerance

This example sets a slippage tolerance of 100 bps (1%):
TypeScript
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 output = await kit.swap({
  from: { adapter, chain: "Arc_Testnet" },
  tokenIn: "USDC",
  amountIn: "1.00",
  tokenOut: "EURC",
  config: {
    // Set the slippage tolerance to 100 bps
    kitKey: process.env.KIT_KEY as string,
    slippageBps: 100,
  },
});
With slippageBps as 100 as in the example, you’ll receive at least 99% of the estimated amount. Meaning if the swap rate is 1 USDC to 1 EURC, you’ll receive at least 0.99 EURC.
The slippageBps default is 300 bps. 0 represents no tolerance, which increases transaction failure rates.

Set stop limit

stopLimit defines the minimum amount of the token type specified in tokenOut that you’ll receive on a swap. This example sets a stop limit of 0.95 EURC, meaning you won’t receive any less than that on a swap:
TypeScript
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 output = await kit.swap({
  from: { adapter, chain: "Arc_Testnet" },
  tokenIn: "USDC",
  amountIn: "1.00",
  tokenOut: "EURC",
  config: {
    kitKey: process.env.KIT_KEY as string,
    // Set stop limit to 0.95 EURC
    stopLimit: "0.95",
  },
});