# CCIPLocalSimulatorFork JS v0.2.5 API Reference
Source: https://docs.chain.link/chainlink-local/api-reference/v0.2.5/ccip-local-simulator-fork-js

> For the complete documentation index, see [llms.txt](/llms.txt).

> **NOTE: Integrate Chainlink Local into your project**
>
> ### npm
>
> If you use [NPM](https://www.npmjs.com/), install the [@chainlink/local NPM
> package](https://www.npmjs.com/package/@chainlink/local):
>
> ```shell
> npm install @chainlink/local@0.2.5
> ```
>
> ### yarn
>
> If you use [Yarn](https://yarnpkg.com/), install the [@chainlink/local NPM
> package](https://www.npmjs.com/package/@chainlink/local):
>
> ```shell
> yarn add @chainlink/local@0.2.5
> ```
>
> ### foundry
>
> If you use [Foundry](https://book.getfoundry.sh/):
>
> ```shell
> forge install smartcontractkit/chainlink-local@v0.2.5
> ```
>
> and then set remappings to: `@chainlink/local/=lib/chainlink-local/` in either `remappings.txt` or `foundry.toml` file
>
> ### RemixIDE
>
> Import the `CCIPLocalSimulator` contract from the `@chainlink/local` package:
>
> ```solidity
> import {CCIPLocalSimulator} from "@chainlink/local@0.2.5/src/ccip/CCIPLocalSimulator.sol";
> ```

## CCIPLocalSimulatorFork JS

Hardhat 2 JavaScript helpers for fork routing.

[CCIPLocalSimulatorFork JS](https://github.com/smartcontractkit/chainlink-local/blob/v0.2.5/scripts/CCIPLocalSimulatorFork.js)

## Types

### Evm2EvmMessage : `Object`

**Properties**

| Name                | Type                                       |
| ------------------- | ------------------------------------------ |
| sourceChainSelector | `bigint`                                   |
| sender              | `string`                                   |
| receiver            | `string`                                   |
| sequenceNumber      | `bigint`                                   |
| gasLimit            | `bigint`                                   |
| strict              | `boolean`                                  |
| nonce               | `bigint`                                   |
| feeToken            | `string`                                   |
| feeTokenAmount      | `bigint`                                   |
| data                | `string`                                   |
| tokenAmounts        | `Array.<\{token: string, amount: bigint}>` |
| sourceTokenData     | `Array.<string>`                           |
| messageId           | `string`                                   |

## Functions

### requestLinkFromTheFaucet(linkAddress, to, amount) ⇒ `Promise.<string>`

Requests LINK tokens from the faucet and returns the transaction hash

**Returns**: `Promise.<string>` - Promise resolving to the
transaction hash of the fund transfer

| Param       | Type     | Description                                             |
| ----------- | -------- | ------------------------------------------------------- |
| linkAddress | `string` | The address of the LINK contract on the current network |
| to          | `string` | The address to send LINK to                             |
| amount      | `bigint` | The amount of LINK to request                           |

### getEvm2EvmMessage(receipt) ⇒ `Evm2EvmMessage` | `null`

Parses a transaction receipt to extract the sent message Scans through
transaction logs to find a `CCIPSendRequested` event and then decodes it to an
object

**Returns**: `Evm2EvmMessage` |
`null` - Returns either the sent message or null if provided receipt
does not contain `CCIPSendRequested` log

| Param   | Type     | Description                                      |
| ------- | -------- | ------------------------------------------------ |
| receipt | `object` | The transaction receipt from the `ccipSend` call |

### routeMessage(routerAddress, evm2EvmMessage) ⇒ `Promise.<void>`

Routes the sent message from the source network on the destination (current)
network

**Returns**: `Promise.<void>` - Either resolves with no value
if the message is successfully routed, or reverts\
**Throws**:

- `Error` Fails if no off-ramp matches the message's source chain
  selector or if calling `router.getOffRamps()`

| Param          | Type             | Description                       |
| -------------- | ---------------- | --------------------------------- |
| routerAddress  | `string`         | Address of the destination Router |
| evm2EvmMessage | `Evm2EvmMessage` | Sent cross-chain message          |