From e89c7a378bba6587e3f525982785c59a33c14d9b Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Sun, 18 Sep 2022 17:51:03 +0200 Subject: [PATCH] chore: trim eip712 deps (#1714) * chore: trim eip712 deps * chore: fmt Co-authored-by: Georgios Konstantopoulos --- Cargo.lock | 2 -- ethers-core/ethers-derive-eip712/Cargo.toml | 2 -- ethers-core/ethers-derive-eip712/src/lib.rs | 8 +++----- .../ethers-derive-eip712/tests/derive_eip712.rs | 12 ++++++------ 4 files changed, 9 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ea0d1e9c..33a1a38a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1325,10 +1325,8 @@ dependencies = [ name = "ethers-derive-eip712" version = "0.17.0" dependencies = [ - "ethers-contract", "ethers-contract-derive", "ethers-core", - "ethers-signers", "hex", "quote", "serde_json", diff --git a/ethers-core/ethers-derive-eip712/Cargo.toml b/ethers-core/ethers-derive-eip712/Cargo.toml index 0dd170f6..b5247d3b 100644 --- a/ethers-core/ethers-derive-eip712/Cargo.toml +++ b/ethers-core/ethers-derive-eip712/Cargo.toml @@ -16,6 +16,4 @@ hex = "0.4.3" serde_json = "1.0.68" [dev-dependencies] -ethers-contract = { version = "^0.17.0", path = "../../ethers-contract", features = ["abigen"]} ethers-contract-derive = { version = "^0.17.0", path = "../../ethers-contract/ethers-contract-derive" } -ethers-signers = { version = "^0.17.0", path = "../../ethers-signers" } diff --git a/ethers-core/ethers-derive-eip712/src/lib.rs b/ethers-core/ethers-derive-eip712/src/lib.rs index a64bb351..2670c3f7 100644 --- a/ethers-core/ethers-derive-eip712/src/lib.rs +++ b/ethers-core/ethers-derive-eip712/src/lib.rs @@ -60,16 +60,14 @@ //! There is an Inner helper attribute `#[eip712]` for fields that will eventually be used to //! determine if there is a nested eip712 struct. However, this work is not yet complete. -#![deny(rustdoc::broken_intra_doc_links)] - -use std::convert::TryFrom; - +#![deny(missing_docs, unsafe_code, rustdoc::broken_intra_doc_links)] use ethers_core::{macros::ethers_core_crate, types::transaction::eip712}; - use proc_macro::TokenStream; use quote::quote; +use std::convert::TryFrom; use syn::parse_macro_input; +/// Derive macro for `Eip712` #[proc_macro_derive(Eip712, attributes(eip712))] pub fn eip_712_derive(input: TokenStream) -> TokenStream { let ast = parse_macro_input!(input); diff --git a/ethers-core/ethers-derive-eip712/tests/derive_eip712.rs b/ethers-core/ethers-derive-eip712/tests/derive_eip712.rs index 2779e50f..1f821e9f 100644 --- a/ethers-core/ethers-derive-eip712/tests/derive_eip712.rs +++ b/ethers-core/ethers-derive-eip712/tests/derive_eip712.rs @@ -1,4 +1,4 @@ -use ethers_contract::EthAbiType; +use ethers_contract_derive::EthAbiType; use ethers_core::{ types::{ transaction::eip712::{ @@ -61,10 +61,10 @@ fn test_struct_hash() { } let domain = Domain { - name: "Radicle".to_string(), - version: "1".to_string(), - chain_id: U256::from(1), - verifying_contract: H160::from(&[0; 20]), + name: Some("Radicle".to_string()), + version: Some("1".to_string()), + chain_id: Some(U256::from(1)), + verifying_contract: Some(Address::zero()), salt: None, }; @@ -151,7 +151,7 @@ fn test_uniswap_v2_permit_hash() { spender: "0x2819c144D5946404C0516B6f817a960dB37D4929".parse().unwrap(), value: parse_ether(10).unwrap(), nonce: U256::from(1), - deadline: U256::from(3133728498 as u32), + deadline: U256::from(3133728498_u32), }; let permit_hash = permit.encode_eip712().unwrap();