feat(abigen): add provided derives for call and event enums (#721)
* feat(abigen): add provided derives for call and event enums * chore: update CHANGELOG
This commit is contained in:
parent
c5ee58d13d
commit
1f4ecc6e75
|
@ -23,6 +23,8 @@
|
|||
|
||||
## ethers-contract-abigen
|
||||
|
||||
- Add provided `event_derives` to call and event enums as well
|
||||
[#721](https://github.com/gakonst/ethers-rs/pull/721).
|
||||
- Implement snowtrace and polygonscan on par with the etherscan integration
|
||||
[#666](https://github.com/gakonst/ethers-rs/pull/666).
|
||||
|
||||
|
|
|
@ -61,13 +61,15 @@ impl Context {
|
|||
.map(|e| expand_struct_name(e, self.event_aliases.get(&e.abi_signature()).cloned()))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let enum_name = self.expand_event_enum_name();
|
||||
|
||||
let ethers_core = ethers_core_crate();
|
||||
let ethers_contract = ethers_contract_crate();
|
||||
|
||||
// use the same derives as for events
|
||||
let derives = util::expand_derives(&self.event_derives);
|
||||
let enum_name = self.expand_event_enum_name();
|
||||
|
||||
quote! {
|
||||
#[derive(Debug, Clone, PartialEq, Eq, #ethers_contract::EthAbiType)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, #ethers_contract::EthAbiType, #derives)]
|
||||
pub enum #enum_name {
|
||||
#(#variants(#variants)),*
|
||||
}
|
||||
|
|
|
@ -105,11 +105,14 @@ impl Context {
|
|||
let ethers_core = ethers_core_crate();
|
||||
let ethers_contract = ethers_contract_crate();
|
||||
|
||||
// use the same derives as for events
|
||||
let derives = util::expand_derives(&self.event_derives);
|
||||
let enum_name = self.expand_calls_enum_name();
|
||||
|
||||
Ok(quote! {
|
||||
#struct_def_tokens
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, #ethers_contract::EthAbiType)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, #ethers_contract::EthAbiType, #derives)]
|
||||
pub enum #enum_name {
|
||||
#(#variant_names(#struct_names)),*
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue