CCIPLocalSimulatorFork v0.2.1 API Reference
CCIPLocalSimulatorFork
CCIPLocalSimulatorFork provides utilities for simulating Cross-Chain Interoperability Protocol (CCIP) operations in a forked environment. It enables testing of cross-chain messaging and token transfers within a Hardhat project.
Types
EVM2EVMMessage
An object representing a cross-chain message with the following structure:
| Property | Type | Description |
|---|---|---|
| sourceChainSelector | bigint | The chain selector of the source chain |
| sender | string | The address of the message sender |
| receiver | string | The address of the message receiver |
| sequenceNumber | bigint | Message sequence number |
| gasLimit | bigint | Gas limit for message execution |
| strict | boolean | Whether strict mode is enabled |
| nonce | bigint | Message nonce |
| feeToken | string | Address of the token used for fees |
| feeTokenAmount | bigint | Amount of fee token |
| data | string | Message payload data |
| tokenAmounts | Array<{token: string, amount: bigint}> | Array of token transfers |
| sourceTokenData | Array<string> | Source token metadata |
| messageId | string | Unique message identifier |
Functions
requestLinkFromTheFaucet
Requests LINK tokens from a faucet contract for testing purposes.
| Parameter | Type | Description |
|---|---|---|
| linkAddress | string | The address of the LINK contract on the current network |
| to | string | The address to receive the LINK tokens |
| amount | bigint | The amount of LINK tokens to request |
Returns: Promise<string> - The transaction hash of the fund transfer
getEvm2EvmMessage
Parses a transaction receipt to extract CCIP message details from the CCIPSendRequested event.
| Parameter | Type | Description |
|---|---|---|
| receipt | object | The transaction receipt from the ccipSend call |
Returns: object | null - The parsed EVM2EVMMessage object or null if no valid message is found
routeMessage
Routes a sent message from the source network to the destination network in the forked environment.
| Parameter | Type | Description |
|---|---|---|
| routerAddress | string | Address of the destination Router contract |
| evm2EvmMessage | object | The cross-chain message to be routed |
Returns: Promise<void> - Resolves when the message is successfully routed