-
Notifications
You must be signed in to change notification settings - Fork 40
feat: call parachain events #372
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
Conversation
Merged set_up_call_config and guide_user_to_call_contract into a single function. Also adds short symbols for arguments.
447e714 to
ea32660
Compare
* fix: add missing short arg option * refactor: note that extrinsic wait includes finalization * refactor: remove clones * style: formatting * refactor: make file prompt more generic * refactor: add missing license headers * style: formatting * docs: comments * docs: comments * docs: comments * refactor: reuse existing metadata * refactor: minimise clones * docs: comments * refactor: naming * docs: fix parameter doc comments * refactor: address clippy warnings
ea32660 to
751053a
Compare
Codecov ReportAttention: Patch coverage is
@@ Coverage Diff @@
## main #372 +/- ##
=======================================
Coverage 75.62% 75.63%
=======================================
Files 62 62
Lines 12720 12728 +8
Branches 12720 12728 +8
=======================================
+ Hits 9620 9627 +7
+ Misses 1806 1804 -2
- Partials 1294 1297 +3
|
…in parachain as an alias (#373) * refactor: rename parachain with chain in visible messages * refactor: rename parachain with chain internal code * chore: solve fmt after rebase * refactor: small fix, use alias instead aliases * refactor: rename CallParachain struct into Call
fbc00b0 to
3a7062e
Compare
|
[sc-1508] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work, only two improvements before merge it.
We should improve the parsing to make it more readable for addresses.
Event(s):
Balances::Withdraw: { who: ((212, 53, 147, 199, 21, 253, 211, 28, 97, 20, 26, 189, 4, 169, 159, 214, 130, 44, 133, 88, 133, 76, 205, 227, 154, 86, 132, 231, 165, 109, 162, 125)), amount: 14323809 }
Balances::Transfer: { from: ((212, 53, 147, 199, 21, 253, 211, 28, 97, 20, 26, 189, 4, 169, 159, 214, 130, 44, 133, 88, 133, 76, 205, 227, 154, 86, 132, 231, 165, 109, 162, 125)), to: ((142, 175, 4, 21, 22, 135, 115, 99, 38, 201, 254, 161, 126, 37, 252, 82, 135, 97, 54, 147, 201, 18, 144, 156, 178, 38, 170, 71, 148, 242, 106, 72)), amount: 1000 }
Balances::Deposit: { who: ((212, 53, 147, 199, 21, 253, 211, 28, 97, 20, 26, 189, 4, 169, 159, 214, 130, 44, 133, 88, 133, 76, 205, 227, 154, 86, 132, 231, 165, 109, 162, 125)), amount: 0 }
A great reference to check out is how cargo-contract handles it: https://github.com/use-ink/cargo-contract/blob/master/crates/extrinsics/src/events.rs#L277
Additionally, it’s challenging to test a successful case for the sign_and_submit_extrinsic function. However, if we split the event handling part into its own function, it would make it possible to test this logic separately.
AlexD10S
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! The events output looks amazing and is consistent with the pop call contract.
I really like the refactor you did for sign_and_submit_extrinsic_with_call_data. Just one small fix: adjust the output formatting in that specific scenario.
al3mart
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is looking much better now. Great refactor!
This PR introduces to output the events from calling a parachain next to the already outputted transaction hash. It is currently using cargo contract code which is not the cleanest way but it meant I didn't have to write new functions and tests. In the future when we want more say in how to parse and output the events this can be relooked at. My suggestion would be to move all the cargo contract code to the pop cli and make it suitable for calling chains and contracts.
Outputting events is also added to submitting extrinsics from call data. I have refactored the
sign_and_submit_extrinsicinpop-parachainsto be generic on thePayload. I think the code in thepop-cliregarding extrinsics with & without payload can be refactored in the future and make it more streamlined and prevent repetitive code.