Skip to content

Commit 5483a82

Browse files
authored
test: fix eip712 usage
1 parent eabb9db commit 5483a82

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

tests/test_accounts.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
from ape import networks
66
from ape.utils import create_tempdir
77
from ape_ethereum.ecosystem import DynamicFeeTransaction, StaticFeeTransaction
8-
from eip712.messages import EIP712Message, EIP712Type
8+
from eip712.messages import EIP712Message, EIP712Domain
99
from eth_account.messages import SignableMessage
10-
from eth_pydantic_types import HexBytes
10+
from eth_pydantic_types import HexBytes, abi
11+
from pydantic import BaseModel
1112

1213
from ape_ledger.accounts import AccountContainer, LedgerAccount
1314
from ape_ledger.exceptions import LedgerSigningError
@@ -22,16 +23,18 @@ def patch_device(device_factory):
2223
return device_factory("accounts")
2324

2425

25-
class Person(EIP712Type):
26-
name: "string" # type: ignore # noqa: F821
27-
wallet: "address" # type: ignore # noqa: F821
26+
class Person(BaseModel):
27+
name: abi.string
28+
wallet: abi.address
2829

2930

3031
class Mail(EIP712Message):
31-
_chainId_: "uint256" = 1 # type: ignore # noqa: F821
32-
_name_: "string" = "Ether Mail" # type: ignore # noqa: F821
33-
_verifyingContract_: "address" = "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC" # type: ignore # noqa: F821 E501
34-
_version_: "string" = "1" # type: ignore # noqa: F821
32+
eip712_domain = EIP712Domain(
33+
chainId=1,
34+
name="Ether Mail",
35+
verifyingContract="0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC",
36+
version="1",
37+
)
3538

3639
sender: Person
3740
receiver: Person

0 commit comments

Comments
 (0)