File tree Expand file tree Collapse file tree 2 files changed +14
-12
lines changed
async_substrate_interface Expand file tree Collapse file tree 2 files changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -281,16 +281,17 @@ async def process_events(self):
281
281
self .__weight = dispatch_info ["weight" ]
282
282
283
283
if "Module" in dispatch_error :
284
- module_index = dispatch_error ["Module" ][ "index" ]
285
- error_index = int . from_bytes (
286
- bytes ( dispatch_error ["Module" ]["error" ]),
287
- byteorder = "little" ,
288
- signed = False ,
289
- )
284
+ if isinstance ( dispatch_error ["Module" ], tuple ):
285
+ module_index = dispatch_error [ "Module" ][ 0 ]
286
+ error_index = dispatch_error ["Module" ][1 ]
287
+ else :
288
+ module_index = dispatch_error [ "Module" ][ "index" ]
289
+ error_index = dispatch_error [ "Module" ][ "error" ]
290
290
291
291
if isinstance (error_index , str ):
292
292
# Actual error index is first u8 in new [u8; 4] format
293
293
error_index = int (error_index [2 :4 ], 16 )
294
+
294
295
if self .block_hash :
295
296
runtime = await self .substrate .init_runtime (
296
297
block_hash = self .block_hash
Original file line number Diff line number Diff line change @@ -256,16 +256,17 @@ def process_events(self):
256
256
self .__weight = dispatch_info ["weight" ]
257
257
258
258
if "Module" in dispatch_error :
259
- module_index = dispatch_error ["Module" ][ "index" ]
260
- error_index = int . from_bytes (
261
- bytes ( dispatch_error ["Module" ]["error" ]),
262
- byteorder = "little" ,
263
- signed = False ,
264
- )
259
+ if isinstance ( dispatch_error ["Module" ], tuple ):
260
+ module_index = dispatch_error [ "Module" ][ 0 ]
261
+ error_index = dispatch_error ["Module" ][1 ]
262
+ else :
263
+ module_index = dispatch_error [ "Module" ][ "index" ]
264
+ error_index = dispatch_error [ "Module" ][ "error" ]
265
265
266
266
if isinstance (error_index , str ):
267
267
# Actual error index is first u8 in new [u8; 4] format
268
268
error_index = int (error_index [2 :4 ], 16 )
269
+
269
270
module_error = self .substrate .metadata .get_module_error (
270
271
module_index = module_index , error_index = error_index
271
272
)
You can’t perform that action at this time.
0 commit comments