Skip to Content
API referencePulsar EvmSrcComponentscheckChainForTx()

@tuwaio/pulsar-core-monorepo


checkChainForTx()

checkChainForTx(chainId, config): Promise<void>

Defined in: packages/pulsar-evm/src/utils/checkChainForTx.ts:18 

Checks if the user’s wallet is connected to the specified chain. If not, it prompts the user to switch to the correct chain and waits for the operation to complete.

Parameters

chainId

number

The ID of the desired blockchain network.

config

Config

The wagmi configuration object.

Returns

Promise<void>

A promise that resolves when the wallet is on the correct chain, or rejects if the user cancels the switch or an error occurs.

Throws

Throws an error if the user rejects the chain switch or if the switch fails.

Last updated on