CCIPLocalSimulatorFork JS v0.3.1 API Reference
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
export const CCIP_V2_ROUTERS = Object. freeze ( {
11155111 : "0x784d49a71BB4C48eB7dA4cD7e6Ecb424f9b5EAB1" ,
43113 : "0x7C9B8B4e8024e5Ee8A630F6FCe9015e470dA5763" ,
} )
Represents a CCIP message sent in a transaction, for any supported protocol version.
Property Type Description era "PRE_V1_6" | "V1_6" | "V2"CCIP protocol version of the lane the message was sent on onRamp stringSource OnRamp that emitted the message messageId stringThe message ID sourceChainSelector bigintThe source chain selector destChainSelector bigintThe destination chain selector (undefined for pre-1.6) message objectEra-specific payload: the pre-1.6 EVM2EVMMessage, the 1.6 EVM2AnyRampMessage, or for CCIP 2.0 { encodedMessage, receipts }
Extracts every CCIP message sent in a transaction, for all supported protocol versions.
function getCCIPMessages ( connection, receipt ) => CCIPSentMessage[ ]
Parameter Type Description connection objectNetwork connection of the source chain receipt objectTransaction receipt of the ccipSend call
Type Description CCIPSentMessage[]The sent messages, in log order (empty if none)
Requests LINK tokens from the testnet faucet by impersonating it.
async function requestLinkFromTheFaucet ( connection, linkAddress, to, amount ) => Promise< string>
Parameter Type Description connection objectNetwork connection from network.connect() linkAddress stringThe address of the LINK contract on the connected 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 sent message on the destination (connected) network, as the destination OffRamp would execute it.
async function routeMessage ( connection, routerAddresses, sent, options = { } ) => Promise< Object>
note
pre-1.6 and 1.6: impersonates the lane's OffRamp and calls executeSingleMessage. - CCIP 2.0: the OffRamp selects
the CCVs (getCCVsForMessage), CCVs that are owner-configurable verifier resolvers are pointed at a synthetic no-op
verifier, and the raw encoded message is executed through the permissionless execute. A message is only delivered if
the OffRamp reports SUCCESS.
Parameter Type Description connection objectNetwork connection of the destination chain routerAddresses string | string[]Destination router address(es) whose OffRamps are searched, e.g. the default router and CCIP_V2_ROUTERS[chainId] sent CCIPSentMessageA message returned by getCCIPMessages options ObjectOptional: forceExecution (default false) executes CCIP 2.0 messages whose executor is NO_EXECUTION_ADDRESS (manual execution)
Type Description 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")
caution
Possible Errors
Throws if no OffRamp serves the lane (no OffRamp found for the message's source chain and OnRamp on the given routers)
Throws if execution fails (receiver revert, finality or CCV rejection)