Version
This doc was generated using Fuels v0.69.1
, Fuel Core v0.20.8
, Sway v0.46.1
, and Forc v0.46.1
.
Installation Guide
Please visit the Fuel's installation guide to install The Fuel toolchain binaries and pre requisites.
Developer Quickstart Guide
We recommend starting with the Developer Quickstart for a walk through on building your first DApp on Fuel.
The Fuel Ecosystem
Learn more about the Fuel Ecosystem.
- 🌴 Sway the new language. Empowering everyone to build reliable and efficient smart contracts.
- 🧰 Forc the Fuel toolbox. Build, deploy and manage your sway projects.
- ⚙️ Fuel Core the new FuelVM, a blazingly fast blockchain VM.
- 🔗 Fuel Specs the Fuel protocol specifications.
- 🦀 RUST SDK a robust SDK in rust.
- ⚡ Fuel Network the project.
Install
YARN
sh
yarn add fuels
NPM
sh
npm install fuels --save
Import
ts
import { Wallet } from "fuels";
// Random Wallet
console.log(Wallet.generate());
// Using privateKey Wallet
console.log(Wallet.fromPrivateKey(PRIVATE_KEY));
Calling Contracts
ts
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);
Deploying Contracts
ts
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);
License
The primary license for this repo is Apache 2.0
, see LICENSE
.