# DataStreamsLocalSimulator v0.3.1 API Reference
Source: https://docs.chain.link/chainlink-local/api-reference/v0.3.1/data-streams-local-simulator

> 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.3.1
> ```
>
> ### 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.3.1
> ```
>
> ### foundry
>
> If you use [Foundry](https://book.getfoundry.sh/):
>
> ```shell
> forge install smartcontractkit/chainlink-local@v0.3.1
> ```
>
> 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.3.1/src/ccip/CCIPLocalSimulator.sol";
> ```

## DataStreamsLocalSimulator

A contract that simulates local Data Streams operations for testing and development purposes.

[`DataStreamsLocalSimulator`](https://github.com/smartcontractkit/chainlink-local/blob/v0.3.1/src/data-streams/DataStreamsLocalSimulator.sol)

> **NOTE**
>
> This contract deploys the mock verifier, verifier proxy, fee manager and reward manager, plus the LINK and wrapped
> native tokens, and lets you switch between on-chain and off-chain billing mechanisms. Reports are generated with
> [`MockReportGenerator`](/chainlink-local/api-reference/v0.3.1/mock-report-generator) and verified through the
> [`MockVerifierProxy`](/chainlink-local/api-reference/v0.3.1/mock-verifier-proxy).

## Variables

### feeManagerEnabled

```solidity
bool public feeManagerEnabled
```

> **NOTE**
>
> Whether the on-chain billing mechanism (fee manager) is enabled. On-chain billing is enabled by default.

## Functions

### configuration

Returns the configuration details for pre-deployed contracts and services needed for local Data Streams simulations.

```solidity
function configuration() public view returns (WETH9 wrappedNative_, LinkToken linkToken_, MockVerifier mockVerifier_, MockVerifierProxy mockVerifierProxy_, MockFeeManager mockFeeManager_, MockRewardManager mockRewardManager_)
```

> **NOTE**
>
> The returned fee manager reflects the current billing state: it is the fee manager currently set on the verifier
> proxy, and the reward manager is `address(0)` when off-chain billing is enabled.

#### Returns

| Parameter           | Type                | Description                                                                 |
| ------------------- | ------------------- | --------------------------------------------------------------------------- |
| wrappedNative\_     | `WETH9`             | The wrapped native token                                                    |
| linkToken\_         | `LinkToken`         | The LINK token                                                              |
| mockVerifier\_      | `MockVerifier`      | The mock verifier contract                                                  |
| mockVerifierProxy\_ | `MockVerifierProxy` | The mock verifier proxy contract                                            |
| mockFeeManager\_    | `MockFeeManager`    | The mock fee manager contract (what is currently set on the verifier proxy) |
| mockRewardManager\_ | `MockRewardManager` | The mock reward manager contract (`address(0)` if fee manager is disabled)  |

### constructor

Initializes the contract with pre-deployed instances.

```solidity
constructor()
```

> **NOTE**
>
> Deploys WETH9, LinkToken, the mock verifier proxy and mock verifier, and (by default) the fee manager and reward
> manager for on-chain billing.

### enableOffChainBilling

Enables the off-chain billing mechanism by removing the fee manager.

```solidity
function enableOffChainBilling() external
```

> **NOTE**
>
> Simulates chains that don't have FeeManager contracts deployed. After this call, `verify` and `verifyBulk` expect an
> empty `parameterPayload`.

### enableOnChainBilling

Enables the on-chain billing mechanism by deploying/setting the fee manager.

```solidity
function enableOnChainBilling() external
```

> **NOTE**
>
> Simulates chains that have FeeManager contracts deployed. After this call, `verify` and `verifyBulk` expect a fee
> token address in `parameterPayload`.

### getBillingMechanism

Returns the current billing mechanism type.

```solidity
function getBillingMechanism() external view returns (string memory billingType)
```

> **NOTE**
>
> Returns `"on-chain"` if the fee manager is enabled, `"off-chain"` if disabled.

### requestLinkFromFaucet

Requests LINK tokens from the faucet.

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

> **NOTE**
>
> The provided amount of tokens is transferred to the provided destination address.

#### Parameters

| Parameter | Type      | Description                                     |
| --------- | --------- | ----------------------------------------------- |
| to        | `address` | The address to which LINK tokens are to be sent |
| amount    | `uint256` | The amount of LINK tokens to send               |

#### Returns

| Parameter | Type   | Description                                             |
| --------- | ------ | ------------------------------------------------------- |
| success   | `bool` | Returns `true` if the transfer of tokens was successful |