This doc was generated using Fuels 0.57.0
, Fuel Core 0.20.4
, Sway 0.44.0
, and Forc 0.44.0
.
We recommend starting with the Developer Quickstart for a walk through on building your first DApp on Fuel.
Learn more about the Fuel Ecosystem.
yarn add fuels
npm install fuels --save
import { Wallet } from "fuels";
// Random Wallet
console.log(Wallet.generate());
// Using privateKey Wallet
console.log(Wallet.fromPrivateKey(PRIVATE_KEY));
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")
.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
.
Was this page helpful?