105
105
BlockIdentifier ,
106
106
Formatters ,
107
107
RPCEndpoint ,
108
+ RPCResponse ,
108
109
SimulateV1Payload ,
109
110
StateOverrideParams ,
110
111
TReturn ,
@@ -650,19 +651,15 @@ def storage_key_to_hexstr(value: Union[bytes, int, str]) -> HexStr:
650
651
)
651
652
652
653
block_result_formatters_copy = BLOCK_RESULT_FORMATTERS .copy ()
653
- block_result_formatters_copy .update (
654
- {
655
- "calls" : apply_list_to_array_formatter (
656
- type_aware_apply_formatters_to_dict (
657
- {
658
- "returnData" : HexBytes ,
659
- "logs" : apply_list_to_array_formatter (log_entry_formatter ),
660
- "gasUsed" : to_integer_if_hex ,
661
- "status" : to_integer_if_hex ,
662
- }
663
- )
664
- )
665
- }
654
+ block_result_formatters_copy ["calls" ] = apply_list_to_array_formatter (
655
+ type_aware_apply_formatters_to_dict (
656
+ {
657
+ "returnData" : HexBytes ,
658
+ "logs" : apply_list_to_array_formatter (log_entry_formatter ),
659
+ "gasUsed" : to_integer_if_hex ,
660
+ "status" : to_integer_if_hex ,
661
+ }
662
+ )
666
663
)
667
664
simulate_v1_result_formatter = apply_formatter_if (
668
665
is_not_null ,
@@ -1107,9 +1104,7 @@ def combine_formatters(
1107
1104
yield formatter_map [method_name ]
1108
1105
1109
1106
1110
- def get_request_formatters (
1111
- method_name : Union [RPCEndpoint , Callable [..., RPCEndpoint ]],
1112
- ) -> Dict [str , Callable [..., Any ]]:
1107
+ def get_request_formatters (method_name : RPCEndpoint ) -> Callable [[RPCResponse ], Any ]:
1113
1108
request_formatter_maps = (
1114
1109
ABI_REQUEST_FORMATTERS ,
1115
1110
# METHOD_NORMALIZERS needs to be after ABI_REQUEST_FORMATTERS
@@ -1241,7 +1236,7 @@ def filter_wrapper(
1241
1236
1242
1237
@to_tuple
1243
1238
def apply_module_to_formatters (
1244
- formatters : Tuple [Callable [..., TReturn ]],
1239
+ formatters : Iterable [Callable [..., TReturn ]],
1245
1240
module : "Module" ,
1246
1241
method_name : Union [RPCEndpoint , Callable [..., RPCEndpoint ]],
1247
1242
) -> Iterable [Callable [..., TReturn ]]:
@@ -1250,9 +1245,9 @@ def apply_module_to_formatters(
1250
1245
1251
1246
1252
1247
def get_result_formatters (
1253
- method_name : Union [ RPCEndpoint , Callable [..., RPCEndpoint ]] ,
1248
+ method_name : RPCEndpoint ,
1254
1249
module : "Module" ,
1255
- ) -> Dict [ str , Callable [... , Any ] ]:
1250
+ ) -> Callable [[ RPCResponse ] , Any ]:
1256
1251
formatters = combine_formatters ((PYTHONIC_RESULT_FORMATTERS ,), method_name )
1257
1252
formatters_requiring_module = combine_formatters (
1258
1253
(FILTER_RESULT_FORMATTERS ,), method_name
@@ -1263,9 +1258,7 @@ def get_result_formatters(
1263
1258
return compose (* partial_formatters , * formatters )
1264
1259
1265
1260
1266
- def get_error_formatters (
1267
- method_name : Union [RPCEndpoint , Callable [..., RPCEndpoint ]],
1268
- ) -> Callable [..., Any ]:
1261
+ def get_error_formatters (method_name : RPCEndpoint ) -> Callable [[RPCResponse ], Any ]:
1269
1262
# Note error formatters work on the full response dict
1270
1263
error_formatter_maps = (ERROR_FORMATTERS ,)
1271
1264
formatters = combine_formatters (error_formatter_maps , method_name )
@@ -1274,8 +1267,8 @@ def get_error_formatters(
1274
1267
1275
1268
1276
1269
def get_null_result_formatters (
1277
- method_name : Union [ RPCEndpoint , Callable [..., RPCEndpoint ]] ,
1278
- ) -> Callable [... , Any ]:
1270
+ method_name : RPCEndpoint ,
1271
+ ) -> Callable [[ RPCResponse ] , Any ]:
1279
1272
formatters = combine_formatters ((NULL_RESULT_FORMATTERS ,), method_name )
1280
1273
1281
1274
return compose (* formatters )
0 commit comments