Open minhnd-dev opened 2 years ago
I'm trying to read data from a substrate chain (Jupiter A1 testnet), I got this error:
Traceback (most recent call last): File "shibuya_interface.py", line 31, in <module> result = contract.read(keypair, 'get') File "/home/minhnd/anaconda3/lib/python3.8/site-packages/substrateinterface/contracts.py", line 796, in read contract_exec_result.gas_required = response['result']['gasRequired'] KeyError: 'gasRequired'
This is my code:
from substrateinterface import Keypair substrate = SubstrateInterface( url="wss://ws.jupiter-poa.patract.cn/", ss58_format=42 ) contract = ContractInstance.create_from_address( contract_address="3g2kZxvk8XT8XLoDgJHYuNnEPN1t6yfP8vFj4jgxSWrUxGqJ", metadata_file="./flipper_metadata.json", substrate=substrate ) keypair = Keypair.create_from_mnemonic("my secret phrase") result = contract.read(keypair, 'get') print('Current value of "get":', result.contract_result_data) print(result)
This file runs perfectly on a substrate node template on my computer.
I hardcoded a value for the gas_required in the contracts.py and it did temporarily fix the problem.
gas_required
contracts.py
I'm trying to read data from a substrate chain (Jupiter A1 testnet), I got this error:
This is my code:
This file runs perfectly on a substrate node template on my computer.