11from typing import (
2+ Callable ,
23 List ,
34 Optional ,
5+ < << << << HEAD
6+ == == == =
7+ Tuple ,
8+ > >> >> >> Add typing to parity module
49 Union ,
510)
611
4853 default_root_munger ,
4954)
5055from web3 .module import (
51- Module ,
5256 ModuleV2 ,
5357)
5458from web3 .types import (
@@ -129,63 +133,73 @@ class Parity(ModuleV2):
129133 shh : ParityShh
130134 personal : ParityPersonal
131135
132- enode = Method (
136+ enode : Method [ Callable [[], str ]] = Method (
133137 RPC .parity_enode ,
134138 mungers = None ,
135139 )
136140
137141 def list_storage_keys_munger (
138142 self ,
139- address : Union [Address , ChecksumAddress , ENS ],
143+ address : Union [Address , ChecksumAddress , ENS , Hash32 ],
140144 quantity : int ,
141145 hash_ : Hash32 ,
146+ << << << < HEAD
142147 block_identifier : Optional [BlockIdentifier ] = None ,
143148 ) -> List [Hash32 ]:
149+ == == == =
150+ block_identifier : Optional [BlockIdentifier ]= None ,
151+ ) -> Tuple [Union [Address , ChecksumAddress , ENS , Hash32 ], int , Hash32 , BlockIdentifier ]:
152+ >> >> >> > Add typing to parity module
144153 if block_identifier is None :
145154 block_identifier = self .defaultBlock
146- return [ address , quantity , hash_ , block_identifier ]
155+ return ( address , quantity , hash_ , block_identifier )
147156
148- listStorageKeys = Method (
157+ listStorageKeys : Method [ Callable [..., List [ Hash32 ]]] = Method (
149158 RPC .parity_listStorageKeys ,
150159 mungers = [list_storage_keys_munger ],
151160 )
152161
153- netPeers = Method (
162+ netPeers : Method [ Callable [[], ParityNetPeers ]] = Method (
154163 RPC .parity_netPeers ,
155164 mungers = None
156165 )
157166
158- addReservedPeer = Method (
167+ addReservedPeer : Method [ Callable [[ EnodeURI ], bool ]] = Method (
159168 RPC .parity_addReservedPeer ,
160169 mungers = [default_root_munger ],
161170 )
162171
163- def trace_transactions_munger (
164- self , block_identifier : BlockIdentifier , mode : ParityTraceMode = ['trace' ]
165- ) -> List [ ParityBlockTrace ]:
166- return [ block_identifier , mode ]
172+ def trace_replay_transaction_munger (
173+ self , block_identifier : _Hash32 , mode : ParityTraceMode = ['trace' ]
174+ ) -> Tuple [ Union [ BlockIdentifier , _Hash32 ], ParityTraceMode ]:
175+ return ( block_identifier , mode )
167176
168- traceReplayTransaction = Method (
177+ traceReplayTransaction : Method [ Callable [..., ParityBlockTrace ]] = Method (
169178 RPC .trace_replayTransaction ,
170- mungers = [trace_transactions_munger ],
179+ mungers = [trace_replay_transaction_munger ],
171180 )
172181
173- traceReplayBlockTransactions = Method (
182+ def trace_replay_block_transactions_munger (
183+ self , block_identifier : BlockIdentifier , mode : ParityTraceMode = ['trace' ]
184+ ) -> Tuple [BlockIdentifier , ParityTraceMode ]:
185+ return (block_identifier , mode )
186+
187+ traceReplayBlockTransactions : Method [Callable [..., List [ParityBlockTrace ]]] = Method (
174188 RPC .trace_replayBlockTransactions ,
175- mungers = [trace_transactions_munger ]
189+ mungers = [trace_replay_block_transactions_munger ]
176190 )
177191
178- traceBlock = Method (
192+ traceBlock : Method [ Callable [[ BlockIdentifier ], List [ ParityBlockTrace ]]] = Method (
179193 RPC .trace_block ,
180194 mungers = [default_root_munger ],
181195 )
182196
183- traceFilter = Method (
197+ traceFilter : Method [ Callable [[ ParityFilterParams ], List [ ParityFilterTrace ]]] = Method (
184198 RPC .trace_filter ,
185199 mungers = [default_root_munger ],
186200 )
187201
188- traceTransaction = Method (
202+ traceTransaction : Method [ Callable [[ _Hash32 ], List [ ParityFilterTrace ]]] = Method (
189203 RPC .trace_transaction ,
190204 mungers = [default_root_munger ],
191205 )
@@ -194,33 +208,39 @@ def trace_call_munger(
194208 self ,
195209 transaction : TxParams ,
196210 mode : ParityTraceMode = ['trace' ],
197- block_identifier : BlockIdentifier = None
198- ) -> ParityBlockTrace :
211+ block_identifier : Optional [BlockIdentifier ]= None
212+ ) -> Tuple [TxParams , ParityTraceMode , BlockIdentifier ]:
213+ # TODO: move to middleware
199214 if 'from' not in transaction and is_checksum_address (self .web3 .eth .defaultAccount ):
200215 transaction = assoc (transaction , 'from' , self .web3 .eth .defaultAccount )
201216
202217 # TODO: move to middleware
203218 if block_identifier is None :
204219 block_identifier = self .defaultBlock
205220
206- return [ transaction , mode , block_identifier ]
221+ return ( transaction , mode , block_identifier )
207222
208- traceCall = Method (
223+ traceCall : Method [ Callable [..., ParityBlockTrace ]] = Method (
209224 RPC .trace_call ,
210225 mungers = [trace_call_munger ],
211226 )
212227
213- traceRawTransaction = Method (
228+ def trace_transactions_munger (
229+ self , raw_transaction : HexStr , mode : ParityTraceMode = ['trace' ]
230+ ) -> Tuple [HexStr , ParityTraceMode ]:
231+ return (raw_transaction , mode )
232+
233+ traceRawTransaction : Method [Callable [..., ParityBlockTrace ]] = Method (
214234 RPC .trace_rawTransaction ,
215235 mungers = [trace_transactions_munger ],
216236 )
217237
218- setMode = Method (
238+ setMode : Method [ Callable [[ ParityMode ], bool ]] = Method (
219239 RPC .parity_setMode ,
220240 mungers = [default_root_munger ],
221241 )
222242
223- mode = Method (
243+ mode : Method [ Callable [[], ParityMode ]] = Method (
224244 RPC .parity_mode ,
225245 mungers = None
226246 )
0 commit comments