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

[ink_e2e] improve call API, remove build_message + callback #1782

Merged
merged 30 commits into from
May 19, 2023

Conversation

ascjones
Copy link
Collaborator

Resurrecting the idea from #1669.

I believe it closes #1644, since the main thing is removing that ugly callback. This may not be the fina or most sophisticatedl API, but an increment in the right direction for better quality of life for e2e test devs.

Replaces build_message and callback with a simpler:

            let erc20 = client
                .instantiate("erc20", &ink_e2e::alice(), constructor, 0, None)
                .await
                .expect("instantiate failed");
            let mut call = erc20.call::<Erc20>();

            // dry run
            let total_supply_msg = call.total_supply();
            let total_supply_res = client
                .call_dry_run(&ink_e2e::bob(), &total_supply_msg, 0, None)
                .await;

            // tx
            let transfer_from =
                call.transfer_from(bob_account.clone(), charlie_account.clone(), amount);
            let transfer_from_result = client
                .call(&ink_e2e::charlie(), &transfer_from, 0, None)
                .await;

Copy link
Collaborator

@cmichi cmichi left a comment

Choose a reason for hiding this comment

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

Thanks for doing this!

We should reflect the change in a CHANGELOG.md. Since we so far always released in lockstep with the rest of ink!, I would just add it there for now.

@codecov-commenter
Copy link

codecov-commenter commented May 19, 2023

Codecov Report

Merging #1782 (5087d30) into master (49bd8d3) will decrease coverage by 0.05%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #1782      +/-   ##
==========================================
- Coverage   52.09%   52.05%   -0.05%     
==========================================
  Files         207      207              
  Lines        6653     6653              
==========================================
- Hits         3466     3463       -3     
- Misses       3187     3190       +3     
Impacted Files Coverage Δ
crates/e2e/src/client.rs 0.00% <ø> (ø)
crates/e2e/src/lib.rs 0.00% <ø> (ø)
crates/e2e/src/xts.rs 0.00% <ø> (ø)
crates/env/src/call/call_builder.rs 0.00% <ø> (ø)
crates/env/src/call/execution_input.rs 76.31% <ø> (ø)

... and 2 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@ascjones ascjones merged commit 425d453 into master May 19, 2023
@ascjones ascjones deleted the aj/e2e-improve-call branch May 19, 2023 10:10
@SkymanOne SkymanOne mentioned this pull request Mar 4, 2024
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.

Improve E2E interface
3 participants