MyGit

v0.47.0

FuelLabs/fuels-rs

版本发布时间: 2023-08-30 22:57:53

FuelLabs/fuels-rs最新发布版本:v0.66.4(2024-09-06 22:25:31)

What's Changed

Full Changelog: https://github.com/FuelLabs/fuels-rs/compare/v0.46.0...v0.47.0

Breaking changes

*_set methods renamed to *_with

Some *_set methods were renamed to *_with to reflect better the ownership model they follow.

For instance, this:

let configuration = LoadConfiguration::default()
    .set_storage_configuration(storage_configuration)
    .set_salt(salt);

// Optional: Configure deployment parameters
let tx_parameters = TxParameters::default()
    .set_gas_price(0)
    .set_gas_limit(1_000_000)
    .set_maturity(0);

Becomes:

let configuration = LoadConfiguration::default()
    .with_storage_configuration(storage_configuration)
    .with_salt(salt);

// Optional: Configure deployment parameters
let tx_parameters = TxParameters::default()
    .with_gas_price(0)
    .with_gas_limit(1_000_000)
    .with_maturity(0);

As well as

  1. set_contract_ids -> with_contract_ids
  2. set_gas_forwarded -> with_gas_forwarded
  3. CallParameters::default().set_amount(deposit_amount).set_asset_id(base_asset_id); -> CallParameters::default().with_amount(deposit_amount).with_asset_id(base_asset_id);
  4. set_consensus_parameters(consensus_parameters); -> with_consensus_parameters(consensus_parameters);

So, when migrating to this version, some things will break, and to fix it is easy: rename these methods with set in them to with, and it should work seamlessly.

String types

Sway's String type is equivalent to the Rust String. This change was impossible before because the String name was already taken for statically-sized strings, now called StringArrays.

This only affects you if you use ParamTypes directly: ParamType::String(len) is now ParamType::StringArray(len) and ParamType::StdString is now ParamType::String.

Sending transactions doesn't return receipts anymore, only the transaction ID

send_transaction(&tx) used to wait for the transaction to be completed and then it would return the receipts. That's not the case anymore; Now, it returns the transactions ID and then you use this ID to query for the receipts:

let receipts = self.try_provider()?.send_transaction(&tx).await?;

Becomes

let tx_id = self.try_provider()?.send_transaction(&tx).await?;
let receipts = provider.get_receipts(&tx_id).await?;

This allows more flexibility to send transactions asynchronously and then grab the receipts if needed.

相关地址:原始地址 下载(tar) 下载(zip)

查看:2023-08-30发行的版本