Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add latest block time and spendable resources with exclusion #833

Merged
merged 52 commits into from
Mar 3, 2023

Conversation

MujkicA
Copy link
Contributor

@MujkicA MujkicA commented Feb 10, 2023

Closes #832

This PR changes provider.get_spendable_resources to accept a filter which let's you define the target asset, amount, owner and also specify excluded resource ids.
It also adds provider.get_inputs_for_filter which works similarly to wallet.get_inputs_for_amount but with the advantage of being able to specify excluded ids.

It also adds a convenience method to the provider to retrieve the latest block time.

let filter = ResourceFilter {
            from: wallet.address().clone(),
            amount: coin_amount_1,
            excluded_utxos: vec![coin_2_utxo_id],
            excluded_message_ids: vec![message_id],
            ..Default::default()
        };
let resources = provider.get_spendable_resources(filter).await.unwrap();

While implementing the above, I made a bug which wasn't caught by our tests.
Because of that, I also added a test for wallet.transfer() for transferring asset ids other than the base asset.

MujkicA and others added 27 commits January 26, 2023 21:48
- Add README FAQ instructions for how to run the docs locally
- Hide blank debugging pages from nav
- Reorganize navigation so the "Getting Started" section is not bloated
- Add a page for testing basics

---------

Co-authored-by: Halil Beglerović <git@hal3e.io>
Co-authored-by: Ahmed Mujkic <32431923+MujkicA@users.noreply.github.com>
Enable the users to add a custom asset to contract calls by providing an asset_id,
amount, and an optional address for the recipient of the generated
outputs.

closes #803
Co-authored-by: Ahmed Sagdati <ahmed.sagdati.ets@gmail.com>
Co-authored-by: Ahmed Mujkic <ahmedmujkic2@gmail.com>
Update `fuels-rs` to the latest `fuel-core 0.16.1` and latest `sway
0.34.0`.

Due to changes in `fuel-asm` for GTF, this is causing yet another
circular upgrade issue.
- Used `{ workspace = true }` syntax to use one version across the
project and simplify integration with new changes in the future.
- Added `ci_checks.sh` script to compile all tests to simplify
integration of changes like this in the future.
- Update contracts to be compatible with `sway 0.34.0`.
- Updated tests to be compatible with `fuel-core 0.16.1`.

related PR: FuelLabs/sway#3961

---------

Co-authored-by: green <xgreenx9999@gmail.com>
This fixes the current CI issue we have.
###### Description of changes

Consolidate common package metadata fields into the workspace root (e.g.
version, license, authors)
###### Description of changes

Adds a step to dry run the publish crates action to help identify
potential issues before publishing
Also removes usage of the deprecated rust-action
Simplifies tag version validation
###### Description of changes

Utilize workspace package to bump most crate versions in a single file
…819)

Abigen moved into a new crate named `fuels-code-gen` so that the indexer team might use it.
add error handling section for the Call response page in the docs
Closes #742

Forwarding CallParameters with an amount > 0 to a method that is not annotated as payable results in a AssetsForwardedToNonPayableMethod error.

BREAKING CHANGE: `.call_params()` now returns a Result
---------

Co-authored-by: Halil Beglerović <git@hal3e.io>
Co-authored-by: Ahmed Sagdati <ahmed.sagdati.ets@gmail.com>
….26. (#827)

This updates all crates for the `fuel-asm` refactor introduced here:
FuelLabs/fuel-vm#283. You can learn more about the change at this PR.
The aim is to propagate this last API-breaking update through fuels-rs
and sway before beta-3.

The associated fuel-core PR can be found here: FuelLabs/fuel-core#973.

Once the refactor lands upstream and the [patch] table is removed in
this PR, this unblocks the associated sway update PR here:
FuelLabs/sway#4004.

---------

Co-authored-by: Brandon Kite <brandonkite92@gmail.com>
###### Description of changes

Release breaking change for new fuel-asm library
Abigen with `no_std` should now be wasm friendly and use the fuels crates directly instead of through `fuels` which causes non-wasm compatible dependencies to be included atm.
@MujkicA MujkicA requested a review from a team February 10, 2023 15:22
Copy link
Contributor

@iqdecay iqdecay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some questions, looking good!

docs/src/providers/querying.md Outdated Show resolved Hide resolved
packages/fuels-signers/src/provider.rs Show resolved Hide resolved
packages/fuels-signers/src/provider.rs Show resolved Hide resolved
packages/fuels-signers/src/provider.rs Show resolved Hide resolved
packages/fuels-signers/src/wallet.rs Outdated Show resolved Hide resolved
packages/fuels/tests/providers.rs Show resolved Hide resolved
@MujkicA MujkicA requested a review from iqdecay February 16, 2023 11:07
Copy link
Contributor

@hal3e hal3e left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review with @segfault-magnet. Looks good. Left some nits

packages/fuels-signers/src/lib.rs Show resolved Hide resolved
packages/fuels-signers/src/lib.rs Outdated Show resolved Hide resolved
packages/fuels-signers/src/provider.rs Outdated Show resolved Hide resolved
packages/fuels-signers/src/wallet.rs Outdated Show resolved Hide resolved
@MujkicA MujkicA requested a review from hal3e February 22, 2023 09:44
@MujkicA MujkicA merged commit 9a66942 into master Mar 3, 2023
@MujkicA MujkicA deleted the add-latest-block-time-and-exclusion branch March 3, 2023 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extend provider API with retrieval for latest block time and spendable resources with exclusion
9 participants