Icon SunFilledIcon MoonStars

Icon LinkVersion

This doc was generated using Fuels 0.60.0, Fuel Core 0.20.5, 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
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-4.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.

Was this page helpful?