Skip to content

Releases: FuelLabs/fuels-rs

v0.20.0

05 Aug 15:09
1a7d712
Compare
Choose a tag to compare

What's Changed

  • refactor!: add an asset_id argument to get_coins API by @iqdecay in #511
  • feat: launch node with manual_blocks_enabled without features by @iqdecay in #501
  • fix: enable skipped test for strings in arrays by @hal3e in #512
  • contract connect function by @Salka1988 in #497
  • Use fuel-crypto for secret key generation from mnemonic by @digorithm in #520
  • Bump versions to 0.20.0 by @digorithm in #521

Full Changelog: v0.19.0...v0.20.0

Breaking changes

wallet.get_coins now takes an AssetId

wallet.get_coins() used to take no arguments; now, it takes an AssetId.

New features

Change the underlying wallet of a contract instance

Now, changing the wallet being used in a contract instance is possible. This is useful for testing when you want to deploy with a given wallet and run multiple tests with different wallets:

contract_instance._with_wallet(wallet_2)?

All you need to do is attach _with_wallet(my_other_wallet) to your contract instance.

v0.19.0

01 Aug 15:55
8a4ac22
Compare
Choose a tag to compare

What's Changed

  • Set fuel-core stdin/stdout stream to null by @rakita in #479
  • refactor: improve naming and documentation in json_abi by @iqdecay in #466
  • feat: add gas used to call response by @MujkicA in #482
  • add features.md and fuel-core lib doc. by @Salka1988 in #480
  • feat!: add transaction_parameters to config json by @Salka1988 in #419
  • ci: remove the --no-default-features flag for running tests by @iqdecay in #483
  • refactor: implement TryFrom trait for Property->ParamType conversion by @iqdecay in #469
  • feat: add contract_id and wallet getters by @hal3e in #487
  • refactor: move function selector methods out of ABIParser struct by @iqdecay in #492
  • docs: fix abigen macro incorrect explanation by @iqdecay in #490
  • feat!: add multiple custom assets by @hal3e in #484
  • instantiating a fuel client bug by @Salka1988 in #488
  • feat: add bech32 support by @MujkicA in #467
  • refactor: move tokenization methods inside a Tokenizer struct type by @iqdecay in #494
  • Add transfer to contract by @MujkicA in #491
  • ci: use forc version 0.19.0 by @iqdecay in #502
  • feat: refactor produce_blocks API by @iqdecay in #478
  • Improved error-handling by @MujkicA in #498
  • fix: string in array parsing by @hal3e in #506
  • feat: validate string length and characters by @hal3e in #496
  • release: 0.19.0 by @digorithm in #510

Full Changelog: v0.18.0...v0.19.0

Breaking changes

Configurable consensus parameters

You can now configure the consensus parameters for a test node. For example:

// configure the gas limit
let consensus_parameters_config = ConsensusParameters::DEFAULT.with_max_gas_per_tx(1000000000);

let (client, addr) = setup_test_client(coins, None, Some(consensus_parameters_config)).await;

Note that, now, setup_test_client will take an additional parameter: an option of the consensus parameters. If you want the default values, pass a None to it.

Multiple custom assets

Now you can create test wallets with multiple custom assets. You can do so through WalletsConfig:

WalletsConfig::new_multiple_assets([(asset_id_1, 100, 23), (asset_id_2, 100, 42), ...])

Bech32 support

We now support Bech32 addresses! This means some of your functions now might return a Bech32-type of address instead of the expected ContractId or Address. Here's how to convert them:

use fuels::prelude::Bech32Address;
use fuels::tx::{Address, Bytes32};

// New from HRP string and a hash
let hrp = "fuel";
let my_slice = [1u8; 32];
let _bech32_address = Bech32Address::new(hrp, my_slice);

// Note that you can also pass a hash stored as Bytes32 to new:
let my_hash = Bytes32::new([1u8; 32]);
let _bech32_address = Bech32Address::new(hrp, my_hash);

// From a string.
let string = "fuel1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqsx2mt2";
let bech32_address =
    Bech32Address::from_str(string).expect("failed to create Bech32 address from string");
assert_eq!([0u8; 32], *bech32_address.hash());

// From Address
let plain_address = Address::new([0u8; 32]);
let bech32_address = Bech32Address::from(plain_address);
assert_eq!([0u8; 32], *bech32_address.hash());

// Convert to Address
let _plain_address: Address = bech32_address.into();

New features

Gas used in CallResponse

The amount of gas used can now be found in your CallResponse object:

pub struct CallResponse<D> {
    pub value: D,
    pub receipts: Vec<Receipt>,
    pub gas_used: u64,
    pub logs: Vec<String>,
}

Contract ID and wallet getters

Contract instances now have a contract ID and wallet getter. I.e., you can easily retrieve which wallet was used to create a contract instance and its ID.

v0.18.0

15 Jul 18:33
4c6b94d
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.17.0...v0.18.0

Breaking changes

ParamType moved to fuels-type

No changes in the API or the behavior related to ParamType, but if you were importing ParamType from fuels-core, now you have to import it from fuels-types.

Main test suite moved to fuels

The main test suite (a.k.a harness.rs) was moved from fuels-abigen-macro to fuels, the root crate.

New features

New SDK book out

The SDK book underwent a major re-organization and re-write; check it out at https://fuellabs.github.io/fuels-rs/latest/.

v0.17.0

07 Jul 17:30
b585976
Compare
Choose a tag to compare

What's Changed

  • refactor: change the launch functions and wallet setup by @hal3e in #422
  • doc: update launch functions reference after refactor by @hal3e in #424
  • docs: typos and small improvements by @thdaraujo in #423
  • ci: gh checkout v2 -> v3 by @thdaraujo in #426
  • fix setup_test_provider not working with Config::local_node by @Salka1988 in #425
  • refactor: tests return Result<> when applicable by @hal3e in #427
  • fix: make generated module public by @digorithm in #433
  • Multi-call by @MujkicA in #399
  • Improve devx by providing shortcuts to decode bytes into contract types. by @segfault-magnet in #431
  • refactor: use InstantiationError as a variant of Error by @vnepveu in #443
  • fix: cargo build with --no-default-features flag by @Salka1988 in #440
  • chore: use concurrency to cancel previous CI runs by @AlicanC in #445
  • refactor!: move the Error type inside fuels-types workspace by @vnepveu in #444
  • feat: add manual initial storage slots by @MujkicA in #441
  • feat: transaction target block height by @segfault-magnet in #428
  • feat: add initial storage automatically by @Salka1988 in #442
  • fix: abigen enum with string or array by @MujkicA in #447

New Contributors

Full Changelog: v0.16.1...v0.17.0

v0.16.1

21 Jun 16:58
4d9cdaf
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.16.0...v0.16.1

v0.16.0

20 Jun 19:45
2a5be52
Compare
Choose a tag to compare

What's Changed

  • feat!: actually forward gas on contract call by @MujkicA in #386
  • feat: introduce the option of using fuel-core binary instead of fuel-core library by @Salka1988 in #355
  • Enum tokenization fix by @segfault-magnet in #397
  • docs: split book into latest and master by @vnepveu in #403
  • add abigen to fuels Cargo.Toml by @Salka1988 in #393
  • docs: migrate all examples by @vnepveu in #398
  • refactor: rename result variables to response by @thdaraujo in #400
  • Encoding of an enum with all unit variants (#390) by @segfault-magnet in #409
  • add upgrade fuel-core and fuel-gql-client to 0.9 by @Salka1988 in #412
  • feat: return error on empty function or argument name by @hal3e in #404
  • release: bump versions to 0.16.0 by @digorithm in #413

Breaking Changes

No more functions or arguments without name

Introduced in #404, we no longer support functions or arguments without explicit name.

fuels-abigen-macro import no longer needed

Introduced in #393, you no longer need to import fuels-abigen-macro, it all comes bundled in fuels. This means that all you need in your Cargo.toml is fuels:

[dependencies]
fuels = "0.16"

And, in your Rust code:

use fuels::prelude::{
    abigen, ...
};

// or

use fuels::prelude::*;

New features

fuel-core binary by default

Instead of using the fuel-core library by default when you use the SDK, your SDK code now will run against an instance of fuel-core, the binary. All you have to do is set up your environment:

export FUEL_CORE_BIN = " fuel-core"
export FUEL_CORE_CONFIG = " /config.json"

However, you can still test against the fuel-core library by passing the flag:--features=fuel-core-lib.

New Contributors

Full Changelog: v0.15.3...v0.16.0

v0.15.3

15 Jun 19:25
1e2223d
Compare
Choose a tag to compare

What's Changed

Breaking Changes

No breaking changes in this release.

New features

Nested enums and Sway's Option<T> support

You can now make use of Sway's Option<T> in the SDK since an Option<T> is a nested enum itself. So, now, something like this, in Sway, is possible and supported by the SDK:

contract;

use std::{
    address::Address,
    constants::NATIVE_ASSET_ID,
    identity::Identity,
    option::Option,
};

abi MyContract {
    fn test_ouput() -> Option<Identity>;
}

impl MyContract for Contract {
    fn test_ouput() -> Option<Identity> {
        Option::Some(Identity::Address(~Address::from(NATIVE_ASSET_ID)))
    }
}

The new ContractCallHandler

It is possible now to interact with a contract method call's built transaction before running it. Instead of:

// ...
let response = contract_instance.initialize_counter(42).call().await.unwrap();

You can:

// ...
let call_handler = contract_instance.initialize_counter(42);

let script = Script::from_call(&call_handler.contract_call).await;

// interact with script.tx ...

let receipts = script.call(client).await.unwrap();

let response = call_handler.build_response(receipts).unwrap();

Note that the first option stills works; we're just giving you a more granular option. This is useful when you want to inspect the Transaction or modify it before sending it.

New Contributors

Full Changelog: v0.15.2...v0.15.3

v0.15.2

09 Jun 21:57
e334724
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.15.1...v0.15.2

v0.15.1

07 Jun 20:05
940554f
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.15.0...v0.15.1

v0.15.0

07 Jun 18:58
e830786
Compare
Choose a tag to compare

What's Changed

  • Improve setup instructions. by @adlerjohn in #336
  • Add ,ignore to rust blocks. by @adlerjohn in #339
  • Add link to harness test in docs. by @adlerjohn in #340
  • Create examples/ directory and include examples in docs by @Br1ght0ne in #202
  • feat: log receipts when contract call panics or reverts by @vnepveu in #324
  • Disable feature unification in CI builds by @Voxelot in #335
  • docs: document get_spendable_coins functions by @vnepveu in #349
  • feat: setup multiple assets by @vnepveu in #347
  • docs(examples): add instantiate_client example by @Br1ght0ne in #291
  • feat: add context to InvalidData error by @hal3e in #357
  • Add support for custom types in arrays and tuples by @digorithm in #356
  • fix(examples): add Config from fuel-core to prelude by @Br1ght0ne in #363
  • add script_runner method in fuels-test-helpers by @Salka1988 in #325
  • Add support for Sway-native types wrapped in custom types by @digorithm in #366
  • v0.15.0 release by @digorithm in #367

New Contributors

Full Changelog: v0.14.1...v0.15.0