Docs Icon ChevronRight For Developers Icon ChevronRight Networks

Networks

Add custom networks

You can add new networks to the user's wallet by calling the addNetwork() method.

AddNetwork.tsx Icon Link
1console.log("Add Network", network);
2const isAdded = await fuel.addNetwork(network);
3console.log("Add Network result", isAdded);

Get current network

To retrieve the current network of the user, you can use the currentNetwork() method.

CurrentNetwork.tsx Icon Link
1const networkInfo = await fuel.currentNetwork();
2console.log("Network ", networkInfo);

With React

Add custom networks

You can add new networks to the user's wallet by calling the addNetwork() method.

AddNetworkHook.tsx Icon Link
1const { addNetwork, isPending, error } = useAddNetwork();
2
3async function handleAddNetwork(networkUrl: string) {
4  console.log("Add network", networkUrl);
5  const networkAdded = await addNetwork(networkUrl);
6  console.log("Network added", networkAdded);
7}

Current network

You can track the current network of the user by using the currentNetwork() method.

CurrentNetworkHook.tsx Icon Link
1const { network } = useNetwork();