API Version: v0.2.2 Not using latest version (v0.2.3)

CCIPLocalSimulatorFork v0.2.2 API Reference

CCIPLocalSimulatorFork

A JavaScript module that provides utilities for simulating CCIP (Cross-Chain Interoperability Protocol) message routing in a local or forked environment.

CCIPLocalSimulatorFork

Types

Evm2EvmMessage

Represents a cross-chain message in the EVM-to-EVM communication protocol. Contains all necessary information for message routing and token transfers across chains.

PropertyTypeDescription
sourceChainSelectorbigintThe identifier of the source chain
senderstringThe address that sent the message
receiverstringThe address that will receive the message
sequenceNumberbigintThe sequence number of the message
gasLimitbigintThe gas limit for executing the message
strictbooleanWhether the message requires strict execution
noncebigintThe nonce of the message
feeTokenstringThe token used to pay fees
feeTokenAmountbigintThe amount of fee token to be paid
datastringThe message payload data
tokenAmountsArray<{token: string, amount: bigint}>Array of tokens and amounts being transferred
sourceTokenDataArray<string>Array of token-specific data from source chain
messageIdstringThe unique identifier of the message

Functions

getEvm2EvmMessage

Extracts and parses a CCIP message from a transaction receipt by looking for the CCIPSendRequested event.

function getEvm2EvmMessage(receipt) => Evm2EvmMessage | null

Parameters

ParameterTypeDescription
receiptobjectThe transaction receipt from the ccipSend call

Returns

TypeDescription
Evm2EvmMessage|nullThe parsed EVM-to-EVM message if found in the receipt logs, or null if no relevant event found

requestLinkFromTheFaucet

Requests LINK tokens from a faucet contract for testing purposes.

async function requestLinkFromTheFaucet(linkAddress, to, amount) => Promise<string>

Parameters

ParameterTypeDescription
linkAddressstringThe address of the LINK contract on the current network
tostringThe address to send LINK to
amountbigintThe amount of LINK to request

Returns

TypeDescription
Promise<string>Promise resolving to the transaction hash of the fund transfer

routeMessage

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>

Parameters

ParameterTypeDescription
routerAddressstringAddress of the destination Router
evm2EvmMessageEvm2EvmMessageSent cross-chain message

Returns

TypeDescription
Promise<void>Resolves with no value if the message is successfully routed

Get the latest Chainlink content straight to your inbox.