Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

ethers-derive-eip712 impossible to use #1484

Closed
the-emerald opened this issue Jul 19, 2022 · 1 comment · Fixed by #1485
Closed

ethers-derive-eip712 impossible to use #1484

the-emerald opened this issue Jul 19, 2022 · 1 comment · Fixed by #1485
Labels
bug Something isn't working

Comments

@the-emerald
Copy link

Version

├── ethers v0.14.0
│   ├── ethers-addressbook v0.14.0
│   │   ├── ethers-core v0.14.0
│   ├── ethers-contract v0.14.0
│   │   ├── ethers-contract-abigen v0.14.0
│   │   │   ├── ethers-core v0.14.0 (*)
│   │   ├── ethers-contract-derive v0.14.0 (proc-macro)
│   │   │   ├── ethers-contract-abigen v0.14.0
│   │   │   │   ├── ethers-core v0.14.0 (*)
│   │   │   ├── ethers-core v0.14.0 (*)
│   │   ├── ethers-core v0.14.0 (*)
│   │   ├── ethers-providers v0.14.0
│   │   │   ├── ethers-core v0.14.0 (*)
│   ├── ethers-core v0.14.0 (*)
│   ├── ethers-etherscan v0.14.0
│   │   ├── ethers-core v0.14.0 (*)
│   ├── ethers-middleware v0.14.0
│   │   ├── ethers-contract v0.14.0 (*)
│   │   ├── ethers-core v0.14.0 (*)
│   │   ├── ethers-etherscan v0.14.0 (*)
│   │   ├── ethers-providers v0.14.0 (*)
│   │   ├── ethers-signers v0.14.0
│   │   │   ├── ethers-core v0.14.0 (*)
│   ├── ethers-providers v0.14.0 (*)
│   └── ethers-signers v0.14.0 (*)
└── ethers-derive-eip712 v0.14.0 (proc-macro)
    ├── ethers-core v0.14.0 (*)

Platform

Linux DESKTOP-GR484G2 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Description
https://github.com/the-emerald/eip712-verifying-contract see this repo for a minimum reproducible example.

It is impossible to get the eip712 proc-macro to work, as it complains about:

error: missing required domain attribute: 'verifying_contract'
 --> src/main.rs:5:3
  |
5 | #[eip712(
  |   ^^^^^^

error: could not compile `eip712` due to previous error

even though clearly in the MRE the field is present.

@the-emerald the-emerald added the bug Something isn't working label Jul 19, 2022
@the-emerald
Copy link
Author

Update: The following fixed the code:

use ethers::prelude::*;
use ethers_derive_eip712::*;
+ use ethers::types::transaction::eip712::Eip712;

#[derive(Debug, Clone, Eip712, EthAbiType)]
#[eip712(
    name = "Postcard",
    version = "1",
    chain_id = 1,
+    verifying_contract = "0x0000000000000000000000000000000000000001",
-    verifying_contract = "0x0000000000000000000000000000000000000000",
    salt = "and-pepper"
)]
pub(crate) struct PostcardClaim {
    pub foo: String,
}

fn main() {
    println!("Hello, world!");
}

and also hex, serde_json need to be added as a dependency.

Perhaps the docs should be updated to reflect this, or the dependencies can be brought alongside ethers-derive-eip712 so the consumer doesn't have to pull them in?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant