Let's use launchTestNode
with the counter contract from the Fuel dApp tutorial .
Note: you will have to change the import paths of the contract factory and bytecode to match your folder structure.
import { CounterFactory } from '../typegend/contracts/CounterFactory';
using launchedContractNode = await launchTestNode({
contractsConfigs: [{ factory: CounterFactory }],
});
const {
contracts: [contract],
provider,
wallets,
} = launchedContractNode;
const { waitForResult } = await contract.functions.get_count().call();
const response = await waitForResult();
launched
variable was instantiated with the using
keyword. launchTestNode
spun up a short-lived fuel-core
node, deployed a contract to it and returned it for testing. launchTestNode
's type-level integration with typegen
outputs.