44from dataclasses import dataclass
55from typing import (
66 Any ,
7+ Generic ,
78 NewType ,
8- override ,
9+ TypeVar ,
910)
1011
1112from eth_typing import ChecksumAddress , HexStr
@@ -27,8 +28,9 @@ def as_address(self) -> ChecksumAddress:
2728 """Convert this instance to a `eth_typing.ChecksumAddress`."""
2829 return AsyncWeb3 .to_checksum_address (self .as_hex_string ())
2930
30- @override
31+ # @override
3132 def __repr__ (self ) -> str :
33+ """Encode bytes as a string."""
3234 return f"{ type (self ).__name__ } ({ self .as_hex_string ()} )"
3335
3436 @staticmethod
@@ -44,15 +46,20 @@ def from_hex_string(hexstr: str) -> "GenericBytes":
4446Address = NewType ("Address" , GenericBytes )
4547
4648
49+ # TODO: use new generic syntax once we can bump to python 3.12 or higher
50+ V = TypeVar ("V" )
51+
52+
4753@dataclass (frozen = True )
48- class Annotation [V ]:
54+ class Annotation ( Generic [V ]) :
4955 """Class to represent generic annotations."""
5056
5157 key : str
5258 value : V
5359
54- @override
60+ # @override
5561 def __repr__ (self ) -> str :
62+ """Encode annotation as a string."""
5663 return f"{ type (self ).__name__ } ({ self .key } -> { self .value } )"
5764
5865
@@ -61,7 +68,7 @@ class GolemBaseCreate:
6168 """Class to represent a create operation in Golem Base."""
6269
6370 data : bytes
64- ttl : int
71+ btl : int
6572 string_annotations : Sequence [Annotation [str ]]
6673 numeric_annotations : Sequence [Annotation [int ]]
6774
@@ -72,7 +79,7 @@ class GolemBaseUpdate:
7279
7380 entity_key : EntityKey
7481 data : bytes
75- ttl : int
82+ btl : int
7683 string_annotations : Sequence [Annotation [str ]]
7784 numeric_annotations : Sequence [Annotation [int ]]
7885
0 commit comments