9
9
from scalecodec import GenericExtrinsic , GenericCall , GenericRuntimeCallDefinition
10
10
from scalecodec .base import RuntimeConfigurationObject , ScaleBytes , ScaleType
11
11
import ujson
12
- from websockets .sync .client import connect , ClientConnection
12
+ from websockets .sync .client import connect
13
13
14
14
from async_substrate_interface .errors import (
15
15
ExtrinsicNotFound ,
@@ -502,7 +502,8 @@ def __init__(
502
502
self ._metadata_cache = {}
503
503
self .metadata_version_hex = "0x0f000000" # v15
504
504
self .reload_type_registry ()
505
- self .initialize ()
505
+ if not _mock :
506
+ self .initialize ()
506
507
507
508
def __enter__ (self ):
508
509
self .initialize ()
@@ -1090,7 +1091,7 @@ def decode_block(block_data, block_data_hash=None) -> dict[str, Any]:
1090
1091
]
1091
1092
1092
1093
block_author = validator_set [rank_validator ]
1093
- block_data ["author" ] = block_author . value
1094
+ block_data ["author" ] = block_author
1094
1095
1095
1096
elif engine == b"aura" :
1096
1097
aura_predigest = (
@@ -1109,7 +1110,7 @@ def decode_block(block_data, block_data_hash=None) -> dict[str, Any]:
1109
1110
] % len (validator_set )
1110
1111
1111
1112
block_author = validator_set [rank_validator ]
1112
- block_data ["author" ] = block_author . value
1113
+ block_data ["author" ] = block_author
1113
1114
else :
1114
1115
raise NotImplementedError (
1115
1116
f"Cannot extract author for engine { log_digest .value ['PreRuntime' ][0 ]} "
@@ -1131,7 +1132,7 @@ def decode_block(block_data, block_data_hash=None) -> dict[str, Any]:
1131
1132
block_author = validator_set .elements [
1132
1133
rank_validator
1133
1134
]
1134
- block_data ["author" ] = block_author . value
1135
+ block_data ["author" ] = block_author
1135
1136
else :
1136
1137
raise NotImplementedError (
1137
1138
f"Cannot extract author for engine"
@@ -1775,6 +1776,7 @@ def get_chain_head(self) -> str:
1775
1776
)
1776
1777
]
1777
1778
)
1779
+ print (1779 , result )
1778
1780
self .last_block_hash = result ["rpc_request" ][0 ]["result" ]
1779
1781
return result ["rpc_request" ][0 ]["result" ]
1780
1782
@@ -2548,7 +2550,9 @@ def query(
2548
2550
result_handler = subscription_handler ,
2549
2551
)
2550
2552
result = responses [preprocessed .queryable ][0 ]
2553
+ print (2552 , type (result ))
2551
2554
if isinstance (result , (list , tuple , int , float )):
2555
+ print ("returning ScaleObj" )
2552
2556
return ScaleObj (result )
2553
2557
return result
2554
2558
0 commit comments