API Version: v0.3.1

CCIPLocalSimulatorFork JS v0.3.1 API Reference

CCIPLocalSimulatorFork JS

Hardhat 3 helpers for routing CCIP messages between forked networks: the JavaScript counterpart of the Solidity CCIPLocalSimulatorFork. Supports pre-1.6 (EVM2EVMOnRamp), 1.6 and CCIP 2.0 (CCV-based) lanes.

CCIPLocalSimulatorFork.js

Constants

CCIP_V2_ROUTERS

export const CCIP_V2_ROUTERS = Object.freeze({
  11155111: "0x784d49a71BB4C48eB7dA4cD7e6Ecb424f9b5EAB1", // Ethereum Sepolia
  43113: "0x7C9B8B4e8024e5Ee8A630F6FCe9015e470dA5763", // Avalanche Fuji
})

Types

CCIPSentMessage

Represents a CCIP message sent in a transaction, for any supported protocol version.

PropertyTypeDescription
era"PRE_V1_6" | "V1_6" | "V2"CCIP protocol version of the lane the message was sent on
onRampstringSource OnRamp that emitted the message
messageIdstringThe message ID
sourceChainSelectorbigintThe source chain selector
destChainSelectorbigintThe destination chain selector (undefined for pre-1.6)
messageobjectEra-specific payload: the pre-1.6 EVM2EVMMessage, the 1.6 EVM2AnyRampMessage, or for CCIP 2.0 { encodedMessage, receipts }

Functions

getCCIPMessages

Extracts every CCIP message sent in a transaction, for all supported protocol versions.

function getCCIPMessages(connection, receipt) => CCIPSentMessage[]

Parameters

ParameterTypeDescription
connectionobjectNetwork connection of the source chain
receiptobjectTransaction receipt of the ccipSend call

Returns

TypeDescription
CCIPSentMessage[]The sent messages, in log order (empty if none)

requestLinkFromTheFaucet

Requests LINK tokens from the testnet faucet by impersonating it.

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

Parameters

ParameterTypeDescription
connectionobjectNetwork connection from network.connect()
linkAddressstringThe address of the LINK contract on the connected 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 sent message on the destination (connected) network, as the destination OffRamp would execute it.

async function routeMessage(connection, routerAddresses, sent, options = {}) => Promise<Object>

Parameters

ParameterTypeDescription
connectionobjectNetwork connection of the destination chain
routerAddressesstring | string[]Destination router address(es) whose OffRamps are searched, e.g. the default router and CCIP_V2_ROUTERS[chainId]
sentCCIPSentMessageA message returned by getCCIPMessages
optionsObjectOptional: forceExecution (default false) executes CCIP 2.0 messages whose executor is NO_EXECUTION_ADDRESS (manual execution)

Returns

TypeDescription
Object{ offRamp, executed, reason }: executed is false only for a CCIP 2.0 NO_EXECUTION message routed without forceExecution (reason is then "NO_EXECUTION_ADDRESS")

Get the latest Chainlink content straight to your inbox.