> For the complete documentation index, see [llms.txt](https://cll-devrel.gitbook.io/chainlink-local-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cll-devrel.gitbook.io/chainlink-local-documentation/api-reference/cciplocalsimulatorfork.sol-api.md).

# CCIPLocalSimulatorFork.sol API

## **API methods**

* [`switchChainAndRouteMessage()`](#cciplocalsimulatorfork-.switchchainandroutemessage)
* [`requestLinkFromFaucet()`](#cciplocalsimulatorfork-.requestlinkfromfaucet)
* [`getNetworkDetails()`](#cciplocalsimulatorfork-.getnetworkdetails)
* [`setNetworkDetails()`](#cciplocalsimulatorfork-.setnetworkdetails)

## **\[CCIPLocalSimulatorFork].`switchChainAndRouteMessage()`**

```solidity
function switchChainAndRouteMessage(uint256 forkId) external;
```

To be called after the sending of the cross-chain message (`ccipSend`). Goes through the list of past logs and looks for the `CCIPSendRequested` event. Switches to a destination network fork. Routes the sent cross-chain message on the destination network.

**Parameters:**

* `forkId` (uint256) - The ID of the destination network fork. This is the returned value of `createFork()` or `createSelectFork()`

***

## **\[CCIPLocalSimulatorFork].`requestLinkFromFaucet()`**

```solidity
function requestLinkFromFaucet(address to, uint256 amount) external returns (bool success);
```

Requests LINK tokens from the faucet. The provided amount of tokens are transferred to provided destination address.

**Parameters:**

* `to` (address): The address to which LINK tokens are to be sent.
* `amount` (uint256): The amount of LINK tokens to send.

**Return values:**

* `success` (bool): Returns `true` if the transfer of tokens was successful, otherwise `false`.

***

## **\[CCIPLocalSimulatorFork].`getNetworkDetails()`**

```solidity
function getNetworkDetails(uint256 chainId) external view returns (Register.NetworkDetails memory);
```

Returns the default values for currently CCIP supported networks. If network is not present or some of the values are changed, user can manually add new network details using the `setNetworkDetails` function.

**Parameters:**

* `chainId` (uint256) - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. Not CCIP chain selector.

**Return values:**

* Tuple containing:
  * `chainSelector` (uint64) - The unique CCIP Chain Selector.
  * `routerAddress` (address) - The address of the CCIP Router contract.
  * `linkAddress` (address) - The address of the LINK token.
  * `wrappedNativeAddress` (address) - The address of the wrapped native token that can be used for CCIP fees.
  * `ccipBnMAddress` (address) - The address of the CCIP BnM token.
  * `ccipLnMAddress` (address) - The address of the CCIP LnM token.

***

## **\[CCIPLocalSimulatorFork].`setNetworkDetails()`**

```solidity
unction setNetworkDetails(uint256 chainId, Register.NetworkDetails memory networkDetails) external;
```

If network details are not present or some of the values are changed, user can manually add new network details using the `setNetworkDetails` function.

**Parameters:**

* `chainId` (uint256) - The blockchain network chain ID. For example 11155111 for Ethereum Sepolia. Not CCIP chain selector.
* Tuple containing:
  * `chainSelector` (uint64) - The unique CCIP Chain Selector.
  * `routerAddress` (address) - The address of the CCIP Router contract.
  * `linkAddress` (address) - The address of the LINK token.
  * `wrappedNativeAddress` (address) - The address of the wrapped native token that can be used for CCIP fees.
  * `ccipBnMAddress` (address) - The address of the CCIP BnM token.
  * `ccipLnMAddress` (address) - The address of the CCIP LnM token.
