5
5
Coroutine ,
6
6
Dict ,
7
7
Optional ,
8
- Sequence ,
9
8
Tuple ,
10
9
TypeVar ,
11
10
Union ,
12
- cast ,
11
+ overload ,
13
12
)
14
13
15
14
from eth_abi .codec import (
27
26
)
28
27
from web3 .method import (
29
28
Method ,
29
+ RequestArgs ,
30
+ ResponseFormatters ,
30
31
)
31
32
from web3 .providers .persistent import (
32
33
PersistentConnectionProvider ,
33
34
)
34
35
from web3 .types import (
35
36
FormattedEthSubscriptionResponse ,
36
- RPCEndpoint ,
37
37
RPCResponse ,
38
38
)
39
39
@@ -58,34 +58,50 @@ def apply_result_formatters(
58
58
TReturn = TypeVar ("TReturn" )
59
59
60
60
61
+ @overload
62
+ def retrieve_request_information_for_batching (
63
+ w3 : "AsyncWeb3" ,
64
+ module : "Module" ,
65
+ method : Method [Callable [..., Any ]],
66
+ ) -> Callable [..., Coroutine [Any , Any , Tuple [RequestArgs , ResponseFormatters ]]]:
67
+ ...
68
+
69
+ @overload
70
+ def retrieve_request_information_for_batching (
71
+ w3 : "Web3" ,
72
+ module : "Module" ,
73
+ method : Method [Callable [..., Any ]],
74
+ ) -> Callable [..., Tuple [RequestArgs , ResponseFormatters ]]:
75
+ ...
76
+
61
77
@curry
62
78
def retrieve_request_information_for_batching (
63
79
w3 : Union ["AsyncWeb3" , "Web3" ],
64
80
module : "Module" ,
65
81
method : Method [Callable [..., Any ]],
66
82
) -> Union [
67
- Callable [..., Tuple [Tuple [ RPCEndpoint , Any ], Sequence [ Any ] ]],
68
- Callable [..., Coroutine [Any , Any , Tuple [Tuple [ RPCEndpoint , Any ], Sequence [ Any ] ]]],
83
+ Callable [..., Tuple [RequestArgs , ResponseFormatters ]],
84
+ Callable [..., Coroutine [Any , Any , Tuple [RequestArgs , ResponseFormatters ]]],
69
85
]:
70
86
async def async_inner (
71
87
* args : Any , ** kwargs : Any
72
- ) -> Tuple [Tuple [ RPCEndpoint , Any ], Sequence [ Any ] ]:
88
+ ) -> Tuple [RequestArgs , ResponseFormatters ]:
73
89
(method_str , params ), response_formatters = method .process_params (
74
90
module , * args , ** kwargs
75
91
)
76
92
if isinstance (w3 .provider , PersistentConnectionProvider ):
77
93
w3 .provider ._request_processor .cache_request_information (
78
- None , cast ( RPCEndpoint , method_str ) , params , response_formatters
94
+ None , method_str , params , response_formatters
79
95
)
80
- return (cast ( RPCEndpoint , method_str ) , params ), response_formatters
96
+ return (method_str , params ), response_formatters
81
97
82
98
def inner (
83
99
* args : Any , ** kwargs : Any
84
- ) -> Tuple [Tuple [ RPCEndpoint , Any ], Sequence [ Any ] ]:
100
+ ) -> Tuple [RequestArgs , ResponseFormatters ]:
85
101
(method_str , params ), response_formatters = method .process_params (
86
102
module , * args , ** kwargs
87
103
)
88
- return (cast ( RPCEndpoint , method_str ) , params ), response_formatters
104
+ return (method_str , params ), response_formatters
89
105
90
106
return async_inner if module .is_async else inner
91
107
@@ -142,7 +158,7 @@ async def caller(
142
158
143
159
if isinstance (async_w3 .provider , PersistentConnectionProvider ):
144
160
return await async_w3 .manager .socket_request (
145
- cast ( RPCEndpoint , method_str ) ,
161
+ method_str ,
146
162
params ,
147
163
response_formatters = response_formatters ,
148
164
)
0 commit comments