Icon HelpCircleForumIcon Link


Icon HelpCircleForumIcon Link
Nightly /

Icon LinkProvider

The Provider lets you connect to a Fuel node (local or external ) and interact with it, encapsulating common client operations in the SDK. Those operations include querying the blockchain for network, block, and transaction-related info (and more ), as well as sending transactions to the blockchain.

All higher-level abstractions (e.g. Wallet , Contract ) that interact with the blockchain go through the Provider, so it's used for various actions like getting a wallet's balance, deploying contracts, querying their state, etc.

// #import { Provider, FUEL_NETWORK_URL, WalletUnlocked };
// Create the provider
const provider = await Provider.create(FUEL_NETWORK_URL);
// Querying the blockchain
const { consensusParameters } = provider.getChain();
// Create a new wallet
const wallet = WalletUnlocked.generate({ provider });
// Get the balances of the wallet (this will be empty until we have assets)
const { balances } = await wallet.getBalances();
// []

You can find more examples of Provider usage here .