-
Notifications
You must be signed in to change notification settings - Fork 179
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
refactor(sozo): make event parsing logic modular and reusable #882
Comments
https://github.com/glihm/starknet-abigen-rs this has ability to parse |
are you still actioning this @lambda-0x ? |
@glihm mentioned that the repo is not meant to be consumed directly, waiting for xJonathanLEI/starknet-rs#475 to be merged. |
I've updated the README in the PR + changed the linked in the repo. If you need to test out something, you can try with this new syntax: https://github.com/glihm/starknet-rs/tree/abigen/starknet-macros. But yes... until it's merged, it's still on the fork and not the official repo. And may be broken based on the feedback of Jonathan during the review. |
Putting this on 0.5.0 release |
Now |
I've checked how cainome abigen works, can I try this one? |
Nice to see you around @Matth26, do not hesitate if you have questions on this. 👍 |
Hi @glihm ! Thanks to the I might be missing something. How do you envision resolving this? |
The idea is to avoid parsing string of types, which is already handled by the parser crate. You actually don't need to use Take the lines here: dojo/bin/sozo/src/ops/events.rs Lines 92 to 146 in ca3b018
Instead of parsing each possible type, we will prefer using the token parsing from Cainome, which already does that for us: And instead, we use the cainome token to decide how print the values. Hope it clarifies, if not don't hesitate to ask other questions. 👍 |
Yes, that makes sense! I thought we needed to use the |
Currently event parsing logic using in
sozo events
is very declarative and not reusable, it should be refactored in such a way that it could be re-used by other components of dojo.It can be done in few ways currently like implementing a method on
Manifest
or creating a newstruct
which contains manifest (and hence the abi) and events.related: xJonathanLEI/starknet-rs#286
EDIT
Now cainome has the parser library which can be used to parse cairo types from string.
In
sozo
, the event parsing may then be enhanced using cainome.The text was updated successfully, but these errors were encountered: