fuels-ts is a library for interacting with Fuel v2.
- Deploy and call contracts
- Generate contract types with TypeChain
- Build and send transactions
- Encode/decode contract ABI
- Transfer coins
- Inspect contract storage
- Manage wallets
- Run scripts
- Query and subscribe to events
yarn add fuels
# or
npm add fuels
import { Provider, Contract } from "fuels";
import abi from "./abi.json";
const provider = new Provider("http://127.0.0.1:4000/graphql");
const contractId = "0x...";
const contract = new Contract(contractId, abi, provider);
const result = await contract.functions.foo("bar");
import { Provider, Contract } from "fuels";
import bytecode from "./bytecode.bin";
const provider = new Provider("http://127.0.0.1:4000/graphql");
const { contractId } = await provider.submitContract(bytecode);
yarn add -D typechain typechain-target-fuels
yarn exec typechain --target=fuels --out-dir=types abi.json
import { Provider } from "fuels";
import { MyContract__factory } from "./types";
const provider = new Provider("http://127.0.0.1:4000/graphql");
const contractId = "0x...";
const contract = MyContract__factory.connect(contractId, provider);
git clone [email protected]:FuelLabs/fuels-ts.git
cd fuels-ts
npm install
# run all tests
npm run test
# run tests and get coverage
npm run test:coverage
# run tests for a specific package
npm -w @fuel-ts/contract run test
The primary license for this repo is Apache 2.0
, see LICENSE
.