Version
This doc was generated using Fuels v0.29.1
, Fuel Core v0.15.1
, Sway v0.32.2
, and Forc v0.32.2
.
Guide
We recommend starting with the Quickstart to speed-up and build your first DApp using 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
yarn add fuels
NPM
npm install fuels --save
Import
import { Wallet } from "fuels";
// Random Wallet
console.log(Wallet.generate());
// Using privateKey Wallet
console.log(new Wallet("0x0000...0000"));
Calling Contracts
import { Wallet, Contract, BigNumberish, BN } from "fuels";
import abi from "./abi.json";
const wallet = new Wallet("0x..."); // 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
import { Provider, Contract } from "fuels";
// Byte code generated using: forc build
import bytecode from "./bytecode.bin";
const factory = new ContractFactory(bytecode, [], wallet);
const contract = await factory.deployContract(factory);
console.log(contract.id);
License
The primary license for this repo is Apache 2.0
, see LICENSE
.