Connecting to a Local Node
Firstly, you will need a local node running on your machine. We recommend one of the following methods:
- Testing utilities can assist in programmatically launching a short-lived node.
- Running fuel-core directly.
In the following example, we create a provider to connect to the local node and sign a message.
ts
See code in contextimport { Provider, Wallet } from 'fuels';
import { LOCAL_NETWORK_URL } from '../env';
const ADDRESS = '0x767caf5b08eba21c561078a4d5be09bbd7f16b9eca22699a61f1edd9e456126f';
const provider = await Provider.create(LOCAL_NETWORK_URL);
const wallet = Wallet.fromAddress(ADDRESS, provider);
const { balances } = await wallet.getBalances();
console.log('Balances', balances);