Retrieves the current fuel account and returns the account address <string | null>
.
const { account } = useAccount ();
console. log (account);
// fuel1r20zhd...
Icon ClipboardText
Retrieves the fuel accounts and returns the addresses of the accounts <string[]>
const { accounts } = useAccounts ();
console. log (accounts);
// [fuel1r20zhd..., fuel1qqluc9..., ...]
Icon ClipboardText
Fetches the balance <BN | null>
of a specified address and asset ID. Additionally, it includes a listener that triggers a balance refresh when the window gains focus.
const { balance } = useBalance ({
address : ' fuel1r20zhd... ' ,
assetId : ' 0x000000000... ' ,
});
console. log (balance);
// 1000 (example balance)
Icon ClipboardText
Fetches information about the current Fuel network <ChainInfo | null>
.
const { chain } = useChain ();
console. log (chain.name);
Icon ClipboardText
Facilitates the connection to the Fuel wallet. Allows selecting a connector by name. It also provides a function <UseMutateAsyncFunction<boolean | undefined>>
to initiate the connection and relevant mutation properties for managing the connection state.
const { connect, connectAsync } = useConnect ();
const handleConnect = async () => {
connect ( ' Fuel Wallet ' );
// Async way
await connectAsync ( ' exampleConnectorName ' );
};
handleConnect ();
Icon ClipboardText
Retrieves a list of available connectors <Array<FuelConnector>>
for connecting to Fuel.
const { connectors } = useConnectors ();
console. log (connectors);
Icon ClipboardText
Facilitates disconnection from the Fuel Wallet. It provides a function <UseMutateAsyncFunction<boolean | undefined>>
to initiate disconnection.
const { disconnect } = useDisconnect ();
const handleDisconnect = async () => {
disconnect ();
// Async way
await disconnectAsync ();
};
handleDisconnect ();
Icon ClipboardText
Checks whether the user is connected to the Fuel protocol. It provides a boolean
indicating the connection.
const { isConnected } = useIsConnected ();
console. log (isConnected);
// true
Icon ClipboardText
Asynchronously retrieves information about the connected node, checks compatibility with a specified version. The function returns isCompatible
(a <boolean>
), and node information.
const { isCompatible } = useNodeInfo ();
Icon ClipboardText
Returns the provider from the Fuel object instance.
const { provider } = useProvider ();
Icon ClipboardText
Retrieves transaction information associated with a specific transaction ID by using the provider.getTransaction
method.
const { transaction } = useTransaction ({ txId : ' fuel1r20zhd... ' });
Icon ClipboardText
Retrieves transaction receipts <Array<TransactionResultReceipt>>
associated with a specific transaction ID using the useFuel
hook.
const { transactionReceipts } = useTransactionReceipts ({
txId : ' fuel1r20zhd... ' ,
});
Icon ClipboardText
Retrieves wallet instance <Account | null | undefined>
and ensures the presence of a valid address and fuel instance.
const { wallet } = useWallet ({ address : ' fuel1r20zhd... ' });
Icon ClipboardText