Swapping
Integrations
Javascript SDK
Get required block confirmations

Get required block confirmations

getRequiredBlockConfirmations

Fetches the number of confirmations required by the protocol for each chain.

export type ChainMap<T> = {
  Bitcoin: T;
  Ethereum: T;
  Polkadot: T;
  Arbitrum: T;
  Solana: T;
};
 
class SwapSDK {
  getRequiredBlockConfirmations(): Promise<ChainMap<number | null>>;
}

Before a transaction to a deposit address or via smart contract call can be considered confirmed, it must be included in a certain number of blocks to limit the risk of a "reorg" event to the protocol. The number of blocks varies by chain. Some chains, like Polkadot, have deterministic finality and do not require any confirmations other than being included in a block. These chains will return null for the number of confirmations required, while others will return a number.

Example

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

Sample Response

{
  Bitcoin: 3,
  Ethereum: 7,
  Polkadot: null,
  Arbitrum: 2,
  Solana: null
}