MCPcopy
hub / github.com/FuelLabs/fuels-ts / launchTestNode

Function launchTestNode

packages/contract/src/test-utils/launch-test-node.ts:139–179  ·  view source on GitHub ↗
({
  providerOptions = {},
  walletsConfig = {},
  nodeOptions = {},
  contractsConfigs,
}: Partial<LaunchTestNodeOptions<TFactories>> = {})

Source from the content-addressed store, hash-verified

137}
138
139export async function launchTestNode<const TFactories extends DeployContractConfig[]>({
140 providerOptions = {},
141 walletsConfig = {},
142 nodeOptions = {},
143 contractsConfigs,
144}: Partial<LaunchTestNodeOptions<TFactories>> = {}): Promise<LaunchTestNodeReturn<TFactories>> {
145 const snapshotConfig = getChainSnapshot(nodeOptions);
146 const args = getFuelCoreArgs(nodeOptions);
147 const { provider, wallets, cleanup } = await setupTestProviderAndWallets({
148 walletsConfig,
149 providerOptions,
150 nodeOptions: {
151 ...nodeOptions,
152 snapshotConfig,
153 args,
154 },
155 });
156
157 const contracts: TContracts<TFactories> = [] as TContracts<TFactories>;
158 const configs = contractsConfigs ?? [];
159 try {
160 for (let i = 0; i < configs.length; i++) {
161 const config = configs[i];
162 const deploy = 'factory' in config ? config.factory.deploy : config.deploy;
163 const options = 'factory' in config ? (config.options ?? {}) : {};
164 const { waitForResult } = await deploy(getWalletForDeployment(config, wallets), options);
165 const { contract } = await waitForResult();
166 contracts.push(contract);
167 }
168 } catch (err) {
169 cleanup();
170 throw err;
171 }
172 return {
173 provider,
174 wallets,
175 contracts,
176 cleanup,
177 [Symbol.dispose]: cleanup,
178 };
179}

Calls 8

getChainSnapshotFunction · 0.85
getFuelCoreArgsFunction · 0.85
deployFunction · 0.85
getWalletForDeploymentFunction · 0.85
waitForResultFunction · 0.85
pushMethod · 0.80
cleanupFunction · 0.50

Tested by 4

setupTestNodeFunction · 0.72
setupTestFunction · 0.72
setupContractFunction · 0.72
mockAllFunction · 0.72