Skip to main content
Version: 1.11.0

Function: simulateReleaseOrMint()

simulateReleaseOrMint(opts: SimulateReleaseOrMintOpts): Promise<{ destinationAmount: bigint; poolInterface: PoolInterfaceVersion; }>

Defined in: evm/simulate.ts:263

Simulate the destination pool's releaseOrMint via a pool-direct eth_call with from set to a registered OffRamp.

Runs the real release path (pool balance / lockbox / per-chain silo / mint) and the pool's _validateReleaseOrMint (source-chain allowed, source-pool wiring, RMN curse, inbound rate limit) — with zero state overrides. Interface arity (IPoolV2 2-arg vs CCIP_POOL_V1 1-arg) is dispatched off the pool's own ERC165 answer, mirroring OffRamp._releaseOrMintSingleToken.

Not covered (OffRamp-side, unreachable pre-send): NotACompatiblePool and the receiver-side finality check (getCCVsAndFinalityConfig, enforced by the OffRamp for data-carrying messages).

Parameters

ParameterTypeDescription
optsSimulateReleaseOrMintOptsSimulateReleaseOrMintOpts

Returns

Promise<{ destinationAmount: bigint; poolInterface: PoolInterfaceVersion; }>

pool interface used and the pool-computed destinationAmount (local decimals)

Throws

CCIPContractTypeInvalidError if the pool supports neither IPoolV2 nor CCIP_POOL_V1

Throws

The raw eth_call provider error on any revert. A revert means the message would not execute on the destination; decode the reason with EVMChain.parse(getErrorData(err)), or go through EVMChain.checkExecute, which raises a typed error carrying the encoded revert.

Example

TypeScript
import { simulateReleaseOrMint, EVMChain, getErrorData } from '@chainlink/ccip-sdk'

try {
const { destinationAmount } = await simulateReleaseOrMint({
provider, pool, offRamp,
input: {
remoteChainSelector: sourceSelector,
receiver, localToken, sourceDenominatedAmount: amount,
sourcePoolAddress: zeroPadValue(sourcePool, 32),
},
})
} catch (err) {
const parsed = EVMChain.parse(getErrorData(err) ?? '0x')
if (parsed) console.log(`dest cannot release: ${parsed.error}`)
}