@@ -47,48 +47,11 @@ def default_raise() -> Any: # pragma: no cover
47
47
raise RuntimeError ("This should be impossible to hit and is just for < 3.10 compatibility" )
48
48
49
49
50
- class UserFriendlyMemos :
51
- unfriendly_memos : list [tuple [bytes32 , list [bytes ]]]
52
-
53
- def __init__ (self , unfriendly_memos : list [tuple [bytes32 , list [bytes ]]]) -> None :
54
- self .unfriendly_memos = unfriendly_memos
55
-
56
- def __eq__ (self , other : object ) -> bool :
57
- if isinstance (other , UserFriendlyMemos ) and other .unfriendly_memos == self .unfriendly_memos :
58
- return True
59
- else :
60
- return False
61
-
62
- def __bytes__ (self ) -> bytes :
63
- raise NotImplementedError ("Should not be serializing this object as bytes, it's only for RPC" )
64
-
65
- @classmethod
66
- def parse (cls , f : BinaryIO ) -> UserFriendlyMemos :
67
- raise NotImplementedError ("Should not be deserializing this object from a stream, it's only for RPC" )
68
-
69
- def to_json_dict (self ) -> dict [str , Any ]:
70
- return {
71
- "0x" + coin_id .hex (): "0x" + memo .hex ()
72
- for coin_id , memos in self .unfriendly_memos
73
- for memo in memos
74
- if memo is not None
75
- }
76
-
77
- @classmethod
78
- def from_json_dict (cls , json_dict : dict [str , Any ]) -> UserFriendlyMemos :
79
- return UserFriendlyMemos (
80
- [(bytes32 .from_hexstr (coin_id ), [hexstr_to_bytes (memo )]) for coin_id , memo in json_dict .items ()]
81
- )
82
-
83
-
84
50
@streamable
85
51
@dataclass (frozen = True )
86
52
class UserFriendlyTransactionRecord (TransactionRecord ):
87
53
to_address : str
88
- memos : UserFriendlyMemos # type: ignore[assignment]
89
-
90
- def get_memos (self ) -> dict [bytes32 , list [bytes ]]:
91
- return {coin_id : ms for coin_id , ms in self .memos .unfriendly_memos }
54
+ memos : dict [bytes32 , list [bytes ]] # type: ignore[assignment]
92
55
93
56
def to_transaction_record (self ) -> TransactionRecord :
94
57
return TransactionRecord .from_json_dict_convenience (self .to_json_dict ())
0 commit comments