This doc was generated using Fuels v0.79.0
, Fuel Core v0.22.1
, Sway v0.49.3
, and Forc v0.49.3
.
Please visit the Fuel's installation guide to install The Fuel toolchain binaries and pre requisites.
We recommend starting with the Developer Quickstart for a walk through on building your first DApp on Fuel.
Learn more about the Fuel Ecosystem.
pnpm add fuels
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.
import { Wallet } from "fuels";
// Random Wallet
console.log(Wallet.generate());
// Using privateKey Wallet
console.log(Wallet.fromPrivateKey(PRIVATE_KEY));
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);
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);
The primary license for this repo is Apache 2.0
, see LICENSE
.