99from scalecodec import GenericExtrinsic , GenericCall , GenericRuntimeCallDefinition
1010from scalecodec .base import RuntimeConfigurationObject , ScaleBytes , ScaleType
1111import ujson
12- from websockets .sync .client import connect , ClientConnection
12+ from websockets .sync .client import connect
1313
1414from async_substrate_interface .errors import (
1515 ExtrinsicNotFound ,
@@ -502,7 +502,8 @@ def __init__(
502502 self ._metadata_cache = {}
503503 self .metadata_version_hex = "0x0f000000" # v15
504504 self .reload_type_registry ()
505- self .initialize ()
505+ if not _mock :
506+ self .initialize ()
506507
507508 def __enter__ (self ):
508509 self .initialize ()
@@ -1090,7 +1091,7 @@ def decode_block(block_data, block_data_hash=None) -> dict[str, Any]:
10901091 ]
10911092
10921093 block_author = validator_set [rank_validator ]
1093- block_data ["author" ] = block_author . value
1094+ block_data ["author" ] = block_author
10941095
10951096 elif engine == b"aura" :
10961097 aura_predigest = (
@@ -1109,7 +1110,7 @@ def decode_block(block_data, block_data_hash=None) -> dict[str, Any]:
11091110 ] % len (validator_set )
11101111
11111112 block_author = validator_set [rank_validator ]
1112- block_data ["author" ] = block_author . value
1113+ block_data ["author" ] = block_author
11131114 else :
11141115 raise NotImplementedError (
11151116 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]:
11311132 block_author = validator_set .elements [
11321133 rank_validator
11331134 ]
1134- block_data ["author" ] = block_author . value
1135+ block_data ["author" ] = block_author
11351136 else :
11361137 raise NotImplementedError (
11371138 f"Cannot extract author for engine"
@@ -1775,6 +1776,7 @@ def get_chain_head(self) -> str:
17751776 )
17761777 ]
17771778 )
1779+ print (1779 , result )
17781780 self .last_block_hash = result ["rpc_request" ][0 ]["result" ]
17791781 return result ["rpc_request" ][0 ]["result" ]
17801782
@@ -2548,7 +2550,9 @@ def query(
25482550 result_handler = subscription_handler ,
25492551 )
25502552 result = responses [preprocessed .queryable ][0 ]
2553+ print (2552 , type (result ))
25512554 if isinstance (result , (list , tuple , int , float )):
2555+ print ("returning ScaleObj" )
25522556 return ScaleObj (result )
25532557 return result
25542558
0 commit comments