File tree Expand file tree Collapse file tree 1 file changed +17
-5
lines changed
async_substrate_interface Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -814,11 +814,23 @@ async def load_registry(self):
814814 async def _load_registry_at_block (self , block_hash : str ) -> MetadataV15 :
815815 # Should be called for any block that fails decoding.
816816 # Possibly the metadata was different.
817- metadata_rpc_result = await self .rpc_request (
818- "state_call" ,
819- ["Metadata_metadata_at_version" , self .metadata_version_hex ],
820- block_hash = block_hash ,
821- )
817+ try :
818+ metadata_rpc_result = await self .rpc_request (
819+ "state_call" ,
820+ ["Metadata_metadata_at_version" , self .metadata_version_hex ],
821+ block_hash = block_hash ,
822+ )
823+ except SubstrateRequestException as e :
824+ if (
825+ "Client error: Execution failed: Other: Exported method Metadata_metadata_at_version is not found"
826+ in e .args
827+ ):
828+ raise SubstrateRequestException (
829+ "You are attempting to call a block too old for this version of async-substrate-interface. Please"
830+ " instead use legacy py-substrate-interface for these very old blocks."
831+ )
832+ else :
833+ raise e
822834 metadata_option_hex_str = metadata_rpc_result ["result" ]
823835 metadata_option_bytes = bytes .fromhex (metadata_option_hex_str [2 :])
824836 old_metadata = MetadataV15 .decode_from_metadata_option (metadata_option_bytes )
You can’t perform that action at this time.
0 commit comments