After installing the fuels
package, it's easy to connect to the Network:
import { Provider } from 'fuels';
const NETWORK_URL = 'https://mainnet.fuel.network/v1/graphql';
const provider = new Provider(NETWORK_URL);
const baseAssetId = await provider.getBaseAssetId();
const chainId = await provider.getChainId();
const gasConfig = await provider.getGasConfig();
console.log('chainId', chainId);
console.log('baseAssetId', baseAssetId);
console.log('gasConfig', gasConfig);
These are our official RPC URLs:
Network | URL |
---|---|
Mainnet | https://testnet.fuel.network/v1/graphql |
Testnet | https://mainnet.fuel.network/v1/graphql |
Localhost | Running a local Fuel node |
Access all our apps directly: