CCIPLocalSimulatorFork v0.2.2 API Reference
A JavaScript module that provides utilities for simulating CCIP (Cross-Chain Interoperability Protocol) message routing in a local or forked environment.
CCIPLocalSimulatorFork
Represents a cross-chain message in the EVM-to-EVM communication protocol. Contains all necessary information for message routing and token transfers across chains.
Property Type Description sourceChainSelector bigintThe identifier of the source chain sender stringThe address that sent the message receiver stringThe address that will receive the message sequenceNumber bigintThe sequence number of the message gasLimit bigintThe gas limit for executing the message strict booleanWhether the message requires strict execution nonce bigintThe nonce of the message feeToken stringThe token used to pay fees feeTokenAmount bigintThe amount of fee token to be paid data stringThe message payload data tokenAmounts Array<{token: string, amount: bigint}>Array of tokens and amounts being transferred sourceTokenData Array<string>Array of token-specific data from source chain messageId stringThe unique identifier of the message
Extracts and parses a CCIP message from a transaction receipt by looking for the CCIPSendRequested event.
function getEvm2EvmMessage ( receipt ) => Evm2EvmMessage | null
Parameter Type Description receipt objectThe transaction receipt from the ccipSend call
Type Description Evm2EvmMessage|nullThe parsed EVM-to-EVM message if found in the receipt logs, or null if no relevant event found
Requests LINK tokens from a faucet contract for testing purposes.
async function requestLinkFromTheFaucet ( linkAddress, to, amount ) => Promise< string>
Parameter Type Description linkAddress stringThe address of the LINK contract on the current network to stringThe address to send LINK to amount bigintThe amount of LINK to request
Type Description Promise<string>Promise resolving to the transaction hash of the fund transfer
Routes a cross-chain message on the destination network by finding the appropriate off-ramp and executing the message.
async function routeMessage ( routerAddress, evm2EvmMessage ) => Promise< void >
Parameter Type Description routerAddress stringAddress of the destination Router evm2EvmMessage Evm2EvmMessageSent cross-chain message
Type Description Promise<void>Resolves with no value if the message is successfully routed
caution
Possible Errors
Throws if no off-ramp matches the message's source chain selector
Throws if calling router.getOffRamps() fails
Throws if no matching off-ramp contract is found for routing