Swapping
Integrations
Javascript SDK
Get swap limits

Get swap limits

getSwapLimits

Fetches the lower and upper bounds for swap amounts.

export type ChainAssetMap<T> = {
  Bitcoin: {
    BTC: T;
  };
  Ethereum: {
    ETH: T;
    USDC: T;
    USDT: T;
    FLIP: T;
  };
  Polkadot: {
    DOT: T;
  };
  Arbitrum: {
    ETH: T,
    USDC: T
  }
};
 
class SwapSDK {
  getSwapLimits(): Promise<{
    minimumSwapAmounts: ChainAssetMap<bigint>;
    maximumSwapAmounts: ChainAssetMap<bigint | null>;
  }>;
}

In order to determine if a swap amount is within the bounds, you can check to see if the amount is greater than or equal to the minimum swap amount for the given source asset and chain and less than or equal to the maximum swap amount for the asset and chain.

These values are in the base unit of the asset, i.e. satoshis for Bitcoin, wei for Ethereum, and Planck for Polkadot, etc.

Funds sent in excess of the maximum swap amount are absorbed by the protocol and cannot be recovered.

Funds that fail to meet the minimum swap amount are also absorbed by the protocol and cannot be recovered.

Example

console.log(await swapSDK.getSwapLimits());

Sample Response

{
  minimumSwapAmounts: {
    Bitcoin: { BTC: 70000n },
    Ethereum: {
      ETH: 10000000000000000n,
      USDC: 20000000n,
      USDT: 20000000n,
      FLIP: 4000000000000000000n
    },
    Polkadot: { DOT: 40000000000n },
    Arbitrum: {
      ETH: 10000000000000000n,
      USDC: 20000000n,
    },
  },
  maximumSwapAmounts: {
    Bitcoin: { BTC: 4000000n },
    Ethereum: {
      ETH: 500000000000000000n,
      USDC: 1000000000n,
      USDT: 1000000000n,
      FLIP: 200000000000000000000n
    },
    Polkadot: { DOT: 2000000000000n },
    Arbitrum: {
      ETH: 500000000000000000n,
      USDC: 1000000000n,
    },
  }
}