-
Notifications
You must be signed in to change notification settings - Fork 171
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
[Feature] Simple API to resolve json-abi
item types
#210
Comments
I'm experimenting with this now to get a better understanding of alloy's APIs. What's the intended replacement for |
DynSolType is roughly equivalent to ParamKind The way i would to this is extending the Resolve trait in dyn-abi to have a method that both resolves + encodes |
Here's one approach as a method on Function pub fn encode_input(&self, args: DynSolValue) -> Result<Vec<u8>> {
let input_types = self
.inputs
.iter()
.map(|i| i.resolve().expect("valid type"))
.collect::<Vec<DynSolType>>();
if !input_types.matches(&args) {
Err(...)
}
let encoded_args = args.encode_params();
// prepend selector... etc...
} I'm actually working on a pull request for this. However, this approach requires |
yeah, the circular dep is why we need to put this logic in the |
@prestwich Ok, I think I understand what you're after now. A trait is needed in order to implement this logic for |
@DaniPopes Following on to this, is there interest in taking a similar approach to provide support for something like |
@DaniPopes should we come up with a struct that represents Events?
|
@DaniPopes @prestwich I'm happy to work on this once you decide on the direction. I've already roughed out an initial solution |
Component
dyn-abi, json-abi
Describe the feature you would like
Example: in
ethabi
you can just callFunction::encode_input
to ABI-encode data with the function's selector and inputs. cc @prestwichAdditional context
No response
The text was updated successfully, but these errors were encountered: