-
Notifications
You must be signed in to change notification settings - Fork 450
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
The call_builder
macro to provide a more developer-friendly way to work with CallBuilder
#1858
Conversation
Co-authored-by: Michael Müller <[email protected]>
a1aa597
to
2af6bf9
Compare
I am not fun of the macro's interface. Wrapping every single call into the macro just to get the syntax highlighting for the Perhaps, if we could do something like: self.incrementer.get().invoke() It would be much clearer to the developer. I am open to other proposals too. |
It is a syntax for a rare case when the developers need to work with a result of the cross-contract call. Primarily, you work with methods directly like The idea of this change is to remove the |
I'm closing the PR for now, but we might revisit this approach. later. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1858 +/- ##
==========================================
- Coverage 53.00% 52.92% -0.09%
==========================================
Files 212 213 +1
Lines 6724 6744 +20
==========================================
+ Hits 3564 3569 +5
- Misses 3160 3175 +15 ☔ View full report in Codecov by Sentry. |
Overview
Implemented the
call_builder!
macro from the proposal.The macro return the
CallBuilder
type that supports hinting and highlighting in the IDE.The usage is the same as for standard cross-contract calls, where the call is wrapped into the
call_builder
macro:How it looks in the IDE:


Follow-up
create_builder!
macro for constructors in the follow-up PR. It would simplify instantiation because all functions will be highlighted. The macro would be much simpler because it always requires an explicit type name.mesage_descriptor!
macro that returns theMessageDescription
. Everyone would be able to get the method's selector(and other properties of the message) like in the soliditymessage_descriptor!(self.balanec_of).selector()
.TraitCallBuilder
and replace its functionality with a new macro. Remove the{method_ident}Output
associated type from the trait definition.