Back to Fuels Ts

Test Node Options

apps/docs/src/guide/testing/test-node-options.md

0.103.03.1 KB
Original Source

Test Node Options

This reference describes all the options of the launchTestNode utility:

<<< @./snippets/launching-a-test-node.ts#options{ts:line-numbers}

Check out the API reference for usage information on the Test Node Options.

walletsConfig

Used to set the node's genesis block state (coins and messages).

  • count: number of wallets/addresses to generate on the genesis block.
  • assets: configure how many unique assets each wallet will own with the base asset included. Can be number or TestAssetId[].
    • The TestAssetId utility simplifies testing when different assets are necessary.
  • coinsPerAsset: number of coins (UTXOs) per asset id.
  • amountPerCoin: for each coin, the amount it'll contain.
  • messages: messages to assign to the wallets.

walletsConfig.assets

The TestAssetId utility integrates with walletsConfig and gives you an easy way to generate multiple random asset ids via the TestAssetId.random static method.

<<< @./snippets/launching-a-test-node.ts#asset-ids{ts:line-numbers}

walletsConfig.messages

The TestMessage helper class is used to create messages for testing purposes. When passed via walletsConfig.messages, the recipient field of the message is overriden to be the wallet's address.

<<< @./snippets/launching-a-test-node.ts#test-messages{ts:line-numbers}

It can also be used standalone and passed into the initial state of the chain via the TestMessage.toChainMessage instance method.

<<< @./snippets/launching-a-test-node.ts#test-messages-chain{ts:line-numbers}

contractsConfigs

Used to deploy contracts on the node the launchTestNode utility launches. It's an array of objects with the following properties:

nodeOptions

<!-- TODO: will cross-reference work done in [#1915](https://github.com/FuelLabs/fuels-ts/issues/1915) -->

Options to modify the behavior of the node.

For example, you can specify your own base asset id of the chain like below:

<<< @./snippets/launching-a-test-node.ts#custom-node-options{ts:line-numbers}

Note: The API for these options is still not fully complete and better documentation will come in the future.

providerOptions

Provider options passed on Provider instantiation. More on them here.