Icon HelpCircleForumIcon Link

⌘K

Icon HelpCircleForumIcon Link
Fuels Ts

Icon LinkVersion

This doc was generated using Fuels v0.79.0, Fuel Core v0.22.1, Sway v0.49.3, and Forc v0.49.3.

Icon LinkInstallation Guide

Please visit the Fuel's installation guide Icon Link to install The Fuel toolchain binaries and pre requisites.

Icon LinkDeveloper Quickstart Guide

We recommend starting with the Developer Quickstart Icon Link for a walk through on building your first DApp on Fuel.

Icon LinkThe Fuel Ecosystem

Learn more about the Fuel Ecosystem.

Icon LinkInstall

pnpm add fuels
Icon InfoCircle

If you are a Windows user, you will need to be running Windows Subsystem for Linux (WSL) to install and use the Fuel toolchain, including the TypeScript SDK. We don't support Windows natively at this time.

Icon LinkImport

import { Wallet } from "fuels";
 
// Random Wallet
console.log(Wallet.generate());
 
// Using privateKey Wallet
console.log(Wallet.fromPrivateKey(PRIVATE_KEY));

Icon LinkCalling Contracts

import { Provider, Wallet, Contract, BigNumberish, BN } from "fuels";
import abi from "./abi.json";
 
const provider = await Provider.create('https://beta-5.fuel.network/graphql');
const wallet = Wallet.fromPrivateKey(PRIVATE_KEY, provider); // private key with coins
const contractId = "0x...";
const contract = new Contract(contractId, abi, wallet);
 
// All contract methods are available under functions
const { transactionId, value } = await contract.functions
  .foo<[BigNumberish], BN>("bar")
  .call();
 
console.log(transactionId, value);

READ MORE

Icon LinkDeploying Contracts

import { Provider, ContractFactory } from "fuels";
// Byte code generated using: forc build
import bytecode from "./bytecode.bin";
 
const factory = new ContractFactory(bytecode, [], wallet);
const contract = await factory.deployContract();
 
console.log(contract.id);

Icon LinkLicense

The primary license for this repo is Apache 2.0, see LICENSE Icon Link.