FuelLabs / fuels-rs

Fuel Network Rust SDK
https://fuellabs.github.io/fuels-rs
Apache License 2.0
44.04k stars 1.34k forks source link

chore!: Move `get_asset_outputs_for_amount`, `get_asset_inputs_for_amount` and `adjust_for_fee` from `Account` to `ViewOnlyAccount` #1498

Closed AurelienFT closed 2 months ago

AurelienFT commented 2 months ago

Release notes

In this release, we:

Summary

This PR moves get_asset_outputs_for_amount, get_asset_inputs_for_amount and adjust_for_fee from Account to ViewOnlyAccount trait. It seem that these two methods doesn't require a full Account and so it give more flexibility in order to implement them in other structures such as Wallet.

Now Wallet also implement these two methods. Before you were forced to build a WalletUnlocked even if you don't use the secret_key.

Breaking changes

This contains an API breaking change as some public trait as been edited:

Breaking Changes

The provider option flag cacheUtxo was renamed to resourceCacheTTL

// before
use fuels::acounts::Account;

wallet.get_asset_outputs_for_amount(...);
// after
use fuels::acounts::ViewOnlyAccount;

wallet.get_asset_outputs_for_amount(...);

Checklist

calldelegation commented 2 months ago

@AurelienFT could you add the proper tag to the title, either chore, feat, or fix please? So the migration script can pick it upon the next release :)

Context: https://github.com/FuelLabs/fuels-rs/pull/1495

AurelienFT commented 2 months ago

@AurelienFT could you add the proper tag to the title, either chore, feat, or fix please? So the migration script can pick it upon the next release :)

Done :)

AurelienFT commented 2 months ago

This PR is based on https://github.com/FuelLabs/fuels-rs/pull/1496

This PR can't be merged for now as it contains breaking changes and master do not accept new breaking changes for now.

digorithm commented 2 months ago

@AurelienFT Is this still a draft, or are we good to review it?

AurelienFT commented 2 months ago

@AurelienFT Is this still a draft, or are we good to review it?

Yes sorry I placed it to draft to avoid merging before :p