-
Notifications
You must be signed in to change notification settings - Fork 50
[1/x] Pass an account as a parameter to note and tx script #798
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
base: next
Are you sure you want to change the base?
Conversation
a40ac11 to
aac79db
Compare
fa9d6dc to
3b6c164
Compare
|
@bobbinth I'm wrapping up. Everything that we planned came out nicely. See the PR description and P2ID note at https://github.com/0xMiden/compiler/blob/50d6dce591144d0d0dc012344ee848eee8163e9b/examples/p2id-note/src/lib.rs?plain=1 I changed only two things:
|
|
Looks great! Thank you! A couple of questions:
|
generated `struct` to be the second parameter.
extract struct name, add comments
50d6dce to
35ccba4
Compare
It's implemented in the next PR #801. See the new p2id code at compiler/examples/p2id-note/src/lib.rs Line 21 in adfb610
I decided to forgo asking users about the account components. My line of thinking was that the note script can have only account components as dependencies. So, whatever account components generated bindings (free functions in modules) are, we will gather them all as methods in the |
Makes sense! I think this approach works - though, we should document this somewhere very clearly (otherwise it might feel like there is too much magic happening). |
Sure. Besides the comments in macro code I explained the reason in the doc comments of the |
Close #787
This PR refactors the
generate!macro to callwit-bindgendirectly instead of using itsgenerate!macro, and introduces anAccountwrapper struct that aggregates methods from imported interfaces.Changes
generate!macro refactoringwit_bindgen::generate!macro invocation with direct calls towit-bindgen-coreandwit-bindgen-rustlibrariesAccountwrapper structgenerate!macro now automatically generates anAccountstruct in thebindingsmoduleScript macros (
#[note_script],#[tx_script])AccountDefault::default()and passed to the user'srunfunctionfn run(arg: Word, account: Account) { ... }Misc
manifest_pathsmoduleExample
Before:
After: