4
4
from datetime import datetime
5
5
from typing import Annotated , Any
6
6
7
- from ape .types import AddressType
7
+ from ape .types import AddressType , HexBytes
8
8
from cryptography .exceptions import InvalidSignature
9
9
from cryptography .hazmat .primitives .hmac import HMAC , hashes
10
- from eth_pydantic_types import Address , HexBytes
11
10
from eth_utils import to_bytes , to_int
12
11
from pydantic import BaseModel , Field , computed_field , field_validator
13
12
@@ -171,7 +170,7 @@ def encode(self) -> int:
171
170
+ self ._encode_byte (self .duration , 7 )
172
171
)
173
172
174
- def get_product_code (self , owner : Address , cluster_id : uuid .UUID ) -> HexBytes :
173
+ def get_product_code (self , owner : AddressType , cluster_id : uuid .UUID ) -> HexBytes :
175
174
# returns bytes32 product code `(sig || config)`
176
175
config = normalize_bytes (to_bytes (self .encode ()))
177
176
@@ -189,7 +188,7 @@ def get_product_code(self, owner: Address, cluster_id: uuid.UUID) -> HexBytes:
189
188
return HexBytes (config + sig )
190
189
191
190
def validate_product_code (
192
- self , owner : Address , signature : bytes , cluster_id : uuid .UUID
191
+ self , owner : AddressType , signature : bytes , cluster_id : uuid .UUID
193
192
) -> bool :
194
193
# NOTE: Put `cluster_id` last so it's easy to use with `functools.partial`
195
194
config = normalize_bytes (to_bytes (self .encode ()))
0 commit comments