Icon LinkVersion

This doc was generated using Fuels 0.57.0, Fuel Core 0.20.4, Sway 0.44.0, and Forc 0.44.0.

Icon LinkDeveloper Quickstart Guide

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

Icon LinkThe Fuel Ecosystem

Learn more about the Fuel Ecosystem.

Icon LinkInstall

Icon LinkYARN

yarn add fuels

Icon LinkNPM

npm install fuels --save

Icon LinkImport

import { Wallet } from "fuels";
// Random Wallet
// Using privateKey Wallet

Icon LinkCalling Contracts

import { Wallet, Contract, BigNumberish, BN } from "fuels";
import abi from "./abi.json";
const wallet = Wallet.fromPrivateKey(PRIVATE_KEY); // 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")
console.log(transactionId, value);


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();

Icon LinkLicense

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

Was this page helpful?