Releases: FuelLabs/fuels-rs
v0.20.0
What's Changed
- refactor!: add an
asset_id
argument toget_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
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
What's Changed
- The big Fuel SDK Book re-org by @digorithm in #453
- add check for invalid path by @Salka1988 in #459
- refactor: remove duplicate functions by @Salka1988 in #462
- ci: use forc v0.18 by @vnepveu in #460
- refactor!: move
ParamType
type insidefuels-types
by @vnepveu in #457 - docs: follow-ups from the book re-org by @digorithm in #468
- b256 in a tuple with other custom types breaks
abigen!
by @segfault-magnet in #471 - docs: add section for custom types by @digorithm in #472
- refactor: move tests to
fuels
by @Salka1988 in #455 - Collision with rust bindings if Sway fn is called
new
by @segfault-magnet in #458 - release: 0.18.0 by @digorithm in #476
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
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 withConfig::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 ofError
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 insidefuels-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
What's Changed
- fix: custom types containing reserved keyword by @digorithm in #416
- fix: broken crate publishing CI due to abigen feature flag by @digorithm in #417
- Bump versions to 0.16.1 by @digorithm in #418
Full Changelog: v0.16.0...v0.16.1
v0.16.0
What's Changed
- feat!: actually forward gas on contract call by @MujkicA in #386
- feat: introduce the option of using
fuel-core
binary instead offuel-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 toresponse
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
- @thdaraujo made their first contribution in #400
Full Changelog: v0.15.3...v0.16.0
v0.15.3
What's Changed
- fix: excess newline in test builder by @hal3e in #380
- refactor: rename native -> base asset. by @adlerjohn in #384
- refactor: refactor to enable easier support of multi call by @MujkicA in #364
- feat: extend abi json cli tests to cover expected errors by @hal3e in #373
- fix: enum encoding by @segfault-magnet in #361
- fix: check file type by @matt-user in #385
- fix: fn selector for unwrapped arrays by @Salka1988 in #391
- feat: add support for nested enums by @hal3e in #389
- fix: do not modify custom type names by @digorithm in #392
- fix: do not modify inner enum name in a nested enum by @digorithm in #394
- release: v0.15.3 by @digorithm in #396
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
- @segfault-magnet made their first contribution in #361
- @matt-user made their first contribution in #385
Full Changelog: v0.15.2...v0.15.3
v0.15.2
What's Changed
- refactor: remove redundant
fuels_contract::errors
mod by @vnepveu in #370 - Wasm support by @tjsharp1 in #351
- Add parameterize trait by @tjsharp1 in #372
- feat: implement tuple tokenization in json abi cli by @hal3e in #360
- ci: update forc to 0.15.1 by @digorithm in #374
- Use SLIP-44 coin type in derivation path. by @adlerjohn in #378
- fix: improve fn signature generation for tuples by @digorithm in #379
- Bump versions to 0.15.2 by @digorithm in #381
Full Changelog: v0.15.1...v0.15.2
v0.15.1
What's Changed
- Fix examples cargo TOML by @digorithm in #368
- Bump versions to v0.15.1 by @digorithm in #369
Full Changelog: v0.15.0...v0.15.1
v0.15.0
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