36 releases (breaking)

0.62.0 May 16, 2024
0.60.0 May 6, 2024
0.56.0 Mar 15, 2024
0.54.0 Dec 13, 2023
0.38.1 Mar 17, 2023

#726 in Procedural macros

Download history 1102/week @ 2024-02-01 767/week @ 2024-02-08 1051/week @ 2024-02-15 898/week @ 2024-02-22 1211/week @ 2024-02-29 1370/week @ 2024-03-07 1174/week @ 2024-03-14 861/week @ 2024-03-21 1189/week @ 2024-03-28 1005/week @ 2024-04-04 1325/week @ 2024-04-11 894/week @ 2024-04-18 1457/week @ 2024-04-25 1291/week @ 2024-05-02 1512/week @ 2024-05-09 1082/week @ 2024-05-16

5,467 downloads per month
Used in 32 crates (3 directly)

Apache-2.0

195KB
5K SLoC

fuels-rs

build crates.io docs discord

Rust SDK for Fuel. It can be used for a variety of things, including but not limited to:

  • Compiling, deploying, and testing Sway contracts;
  • Launching a local Fuel network;
  • Crafting and signing transactions with hand-crafted scripts or contract calls;
  • Generating type-safe Rust bindings of contract methods;
  • And more, fuels-rs is still in active development.

Documentation

See the fuels-rs book

Features

  • Launch Fuel nodes
  • Deploy contracts
  • Interact with deployed contracts
  • Type-safe Sway contracts bindings code generation
  • Run Sway scripts
  • CLI for common operations
  • Local test wallets
  • Wallet integration
  • Events querying/monitoring

FAQ

What dependencies do I need?

How can I run the SDK tests?

First, build the test projects using forc:

forc build --release --path packages/fuels

Then you can run the SDK tests with:

cargo test

You can also run specific tests. The following example will run all integration tests in types.rs whose names contain in_vector and show their outputs:

cargo test --test types in_vector -- --show-output

How to run WASM tests?

You need to have wasm32 as a target, if you don't already:

 rustup target add wasm32-unknown-unknown

You also need wasm-pack, if you don't already:

cargo install wasm-pack

Navigate to packages/wasm-tests and run wasm-pack test.

What to do if my tests are failing on master

Before doing anything else, try all these commands:

cargo clean
rm Cargo.lock
forc build --release --path packages/fuels
cargo test

Why is the prefix fuels and not fuel?

In order to make the SDK for Fuel feel familiar with those coming from the ethers.js ecosystem, this project opted for an s at the end. The fuels-* family of SDKs is inspired by The Ethers Project.

How can I run the docs locally?

Install mdbook by running:

cargo install mdbook

Next, navigate to the docs folder and run the command below to start a local server and open a new tab in you browser.

mdbook serve --open

You can build the book by running:

mdbook build

Dependencies

~4–6MB
~111K SLoC