Skip to content
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

Add example showcasing json and dyn ABI encoding + sol_types static encoding #71

Closed
Tracked by #87
zerosnacks opened this issue May 2, 2024 · 8 comments · Fixed by #123
Closed
Tracked by #87

Add example showcasing json and dyn ABI encoding + sol_types static encoding #71

zerosnacks opened this issue May 2, 2024 · 8 comments · Fixed by #123
Assignees
Labels
advanced enhancement New feature or request

Comments

@zerosnacks zerosnacks added the enhancement New feature or request label May 2, 2024
@zerosnacks zerosnacks changed the title Add example showcasing json and dyn ABI encoding Add example showcasing json and dyn ABI encoding + sol_types static encoding May 2, 2024
@yash-atreya yash-atreya added this to the 0.1-rc.0 milestone Jun 5, 2024
@zerosnacks zerosnacks removed this from the 0.1-rc.0 milestone Jun 14, 2024
@PraneshASP
Copy link
Contributor

@zerosnacks I'd like to take this on. Do you have any suggestions for an optimal example for each type?

@zerosnacks
Copy link
Member Author

@zerosnacks I'd like to take this on. Do you have any suggestions for an optimal example for each type?

Thanks! The goal of the example is to clarify to users when you should use each type and how they are different from each other. For the vast majority of cases users should always use the sol! macro so this is an advanced use case. For inspiration have a look through the codebase of each crate. The result can be three different examples or just one example. A reference could be how we should different parts of working with big numbers: https://github.com/alloy-rs/examples/tree/main/examples/big-numbers/examples

@zerosnacks
Copy link
Member Author

zerosnacks commented Jul 23, 2024

Hi @PraneshASP let me know if you are running into any issues or need any pointers, happy to help!

@PraneshASP
Copy link
Contributor

Hi @zerosnacks sorry caught up with other things, I'm looking into adding examples now!

@zerosnacks
Copy link
Member Author

No problem! Thanks

@PraneshASP
Copy link
Contributor

Added example for dyn_abi encoding. Initial feedback would be appreciated :)) @zerosnacks TIA!

@PraneshASP
Copy link
Contributor

Added example for sol!() macro as well.

Example for json ABI encoding is left. It looks like there's no encode/decode method implemented in the json-abi crate? ethabi implements it tho. Am I missing something?

cc: @zerosnacks

@zerosnacks
Copy link
Member Author

I think ABI decoding should be sufficient here for the json-abi crate as shown here: https://github.com/alloy-rs/core/blob/main/crates/json-abi/tests/it/abis.rs

It would be nice to combine the various test cases into a single one covering the constructor, a function, an event and an error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
advanced enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants