-
Notifications
You must be signed in to change notification settings - Fork 28
Simplify the derived function arguments #399
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
…lify-contract-interface
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.
Looks nice, shouldn't it require minor bump instead of patch for cw-orch-fns-derive? I guess missing
- Changelog update
- Docs update where impl_into mentioned
Not sure about the file that I skipped, looked like cargo expand output, lmk if I should check it as well
…om:AbstractSDK/cw-orchestrator into nicolas/orc-73-simplify-contract-interface
CyberHoward
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.
I don't think we should add impl Into for every type of argument.
I suggest we add a match statement that only converts the arguments to impl Into<> for the types:
- Uint (all sizes)
- String
But not for
- Addr
- Custom structures
- booleans
This helps us keep the generated fns readable (as you can only see the generated code in your IDE).
Yes good idea ! |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files
|
Is it possible to check it with typeid? https://doc.rust-lang.org/std/any/struct.TypeId.html |
Undortunately not :/ |
Think that's fine. We could add a field attribute (like Maybe we should start prefixing our macro attributes as well, like serde? #[cw_orch(payable)]
#[cw_orch(into)] |
Pretty sure we should if we use such common phrases as |
Yes there is a PR with that here already : #408 |
This Simplify the cw-orch contract function derives.
The functions do not take their argument types directly but an argument of the form
Into<type>This allows for simpler interactionsDepends on #398
Downside
The types have to be known when specifying the argument.
This is specifically bad when using
collect. They should be changed tocollect::Vec<_>()for instanceBreaking changes
Here are the cases that WILL break when releasing this PR.
Cw-orch-core is not breaking
cw-orch-fns-derive breaks
Depends on #398