fuels-rs

Fuel Network Rust SDK

APACHE-2.0 License

Downloads
1.9M
Stars
44.7K
Committers
30

Bot releases are hidden (Show)

fuels-rs - v0.19.0

Published by digorithm about 2 years ago

What's Changed

Full Changelog: https://github.com/FuelLabs/fuels-rs/compare/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.

fuels-rs - v0.18.0

Published by digorithm over 2 years ago

What's Changed

Full Changelog: https://github.com/FuelLabs/fuels-rs/compare/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/.

fuels-rs - v0.17.0

Published by iqdecay over 2 years ago

What's Changed

New Contributors

Full Changelog: https://github.com/FuelLabs/fuels-rs/compare/v0.16.1...v0.17.0

fuels-rs - v0.16.1

Published by digorithm over 2 years ago

What's Changed

Full Changelog: https://github.com/FuelLabs/fuels-rs/compare/v0.16.0...v0.16.1

fuels-rs - v0.16.0

Published by digorithm over 2 years ago

What's Changed

Breaking Changes

No more functions or arguments without name

Introduced in https://github.com/FuelLabs/fuels-rs/pull/404, we no longer support functions or arguments without explicit name.

fuels-abigen-macro import no longer needed

Introduced in https://github.com/FuelLabs/fuels-rs/pull/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: https://github.com/FuelLabs/fuels-rs/compare/v0.15.3...v0.16.0

fuels-rs - v0.15.3

Published by digorithm over 2 years ago

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: https://github.com/FuelLabs/fuels-rs/compare/v0.15.2...v0.15.3

fuels-rs - v0.15.2

Published by digorithm over 2 years ago

What's Changed

Full Changelog: https://github.com/FuelLabs/fuels-rs/compare/v0.15.1...v0.15.2

fuels-rs - v0.15.1

Published by digorithm over 2 years ago

What's Changed

Full Changelog: https://github.com/FuelLabs/fuels-rs/compare/v0.15.0...v0.15.1

fuels-rs - v0.15.0

Published by digorithm over 2 years ago

What's Changed

New Contributors

Full Changelog: https://github.com/FuelLabs/fuels-rs/compare/v0.14.1...v0.15.0

fuels-rs - v0.14.1

Published by adlerjohn over 2 years ago

What's Changed

Full Changelog: https://github.com/FuelLabs/fuels-rs/compare/v0.14.0...v0.14.1

fuels-rs - v0.14.0

Published by iqdecay over 2 years ago

What's Changed

New Contributors

Full Changelog: https://github.com/FuelLabs/fuels-rs/compare/v0.13.0...v0.14.0

fuels-rs - v0.13.0

Published by iqdecay over 2 years ago

Breaking changes

  • Setting up contract deployment changed a lot in #268

What's Changed

New Contributors

Full Changelog: https://github.com/FuelLabs/fuels-rs/compare/v0.12.0...v0.13.0

fuels-rs - v0.12.0

Published by digorithm over 2 years ago

What's Changed

New Contributors

Full Changelog: https://github.com/FuelLabs/fuels-rs/compare/v0.11.0...v0.12.0

fuels-rs - v0.11.0

Published by digorithm over 2 years ago

What's Changed

New Contributors

Full Changelog: https://github.com/FuelLabs/fuels-rs/compare/v0.10.1...v0.11.0

fuels-rs - v0.10.1

Published by digorithm over 2 years ago

What's Changed

Full Changelog: https://github.com/FuelLabs/fuels-rs/compare/v0.10.0...v0.10.1

fuels-rs - v0.10.0

Published by digorithm over 2 years ago

What's Changed

New Contributors

Full Changelog: https://github.com/FuelLabs/fuels-rs/compare/v0.9.1...v0.10.0

fuels-rs - v0.9.1

Published by digorithm over 2 years ago

What's Changed

Full Changelog: https://github.com/FuelLabs/fuels-rs/compare/v0.9.0...v0.9.1

fuels-rs - v0.9.0

Published by digorithm over 2 years ago

What's Changed

Full Changelog: https://github.com/FuelLabs/fuels-rs/compare/v0.8.1...v0.9.0

fuels-rs - v0.8.1

Published by digorithm over 2 years ago

What's Changed

New Contributors

Full Changelog: https://github.com/FuelLabs/fuels-rs/compare/v0.8.0...v0.8.1

fuels-rs - v0.8.0

Published by adlerjohn over 2 years ago

What's Changed

Full Changelog: https://github.com/FuelLabs/fuels-rs/compare/v0.7.1...v0.8.0