-
Notifications
You must be signed in to change notification settings - Fork 794
feat: derive Serialize
and Deserialize
for Event
, {}Filter
, Call
, and Errors
in contract bindings
#2599
Comments
Serialize
and Deserialize
for Event
, [_]Filter
, Call
, and Errors
in contract bindingsSerialize
and Deserialize
for Event
, {}Filter
, Call
, and Errors
in contract bindings
I think this is reasonable, perhaps this should reuse the attributes supplies to |
Does this mean the #[derive(Clone, ::serde::Serialize, ::serde::Deserialize, ..)] |
see ethers-rs/ethers-contract/ethers-contract-abigen/src/contract.rs Lines 347 to 352 in c702e6c
and structs for example: ethers-rs/ethers-contract/ethers-contract-abigen/src/contract/structs.rs Lines 118 to 127 in c702e6c
|
Let me give this a shot. Do you have a suggestion for testing this? Coming from |
like this ethers-rs/ethers-contract/tests/it/abigen.rs Lines 123 to 133 in c702e6c
and assert |
Okay fair enough! |
Is your feature request related to a problem? Please describe.
When working with contract bindings, it would be nice to be able to use
serde
to manage these structs/enums. For instance, if I was doing something like this:it would be great to be able to do this serialization so I can, for example, output this all to a CSV nicely.
Describe the solution you'd like
For instance, we can just add
Serialize
in the output for the bindings such as here:we can just replace
#[derive(Clone, #ethers_contract::EthAbiType, #derives)]
with#[derive(Clone, Serialize, Deserialize, #ethers_contract::EthAbiType, #derives)]
. Note that this is located here.Additional context
Though I just showed the potential solution for
Event
s, this could be applied toCall
s,Error
s, and{}Filter
objects as well.The text was updated successfully, but these errors were encountered: