I am trying to find the correct parameters to pass into the query function for the substrate interface module when interacting with the parallel api to interact with their AMM. I attempted to modify the code from the linked post:
Below is my adapted code:
from substrateinterface import SubstrateInterface
paraurl = 'wss://rpc.parallel.fi'
substrate = SubstrateInterface(
url=paraurl,
)
storage_function = substrate.get_metadata_storage_function('AMM','Pools')
typeString = storage_function.get_params_type_string()
print('Storage Function params length:', len(typeString))
# Retrieve a SCALE object of the param type
param_type = substrate.create_scale_object(storage_function.get_params_type_string()[0])
# Possible options of Enum type
print(param_type.type_mapping)
token_param = substrate.create_scale_object(param_type.type_mapping[0][1])
# Show possible options
print(token_param.type_mapping)
However, I am receiving the error:
File "/home/travnado300/Documents/Python Scripts/Substrate Interactions/Parallel.py", line 30, in <module>
token_param = substrate.create_scale_object(param_type.type_mapping[0][1])
TypeError: 'NoneType' object is not subscriptable
I am wondering if this is just an issue with the parallel API not having all of the information available or if there is a way to access the params needed to pass into the function:
substrate.query()
Amm::pools
there and see the signature of(u32, u32) -> Option<PalletTraitsPool>
.