0

When querying storage functions using Polkascan's py-substrate-interface how do you figure out which parameters are required?

For example, I am trying to discern how much KSM is on Karura via storage functions in the tokens (ORML) pallet.

See below code for example. I tried to substrate.query() Tokens.TotalIssuance storage_function but it requires 6 parameters:

from substrateinterface import SubstrateInterface

substrate = SubstrateInterface(url="wss://karura-rpc-0.aca-api.network/") 

result = substrate.query(module='Tokens',storage_function='TotalIssuance')
        
**ValueError**: Storage function requires 6 parameters, 0 given

Note, I also tried to to use substrate.query_map() for Token.Accounts storage function but that requires 1 parameter which I can't discern.

result = substrate.query_map(
module='Tokens',
storage_function='Accounts',
page_size=10,
max_results = 100)

**ValueError**: Storage function map requires 1 parameters, 0 given

Does anyone have any advice on how to find out which parameters are required for substrate.query() & substrate.query_map()? I have been digging around in the library docs along with substrate storage documentation but I can't figure it out.

Other Note: Through trial and error I managed to figure out that substrate.query() Tokens.Accounts for a KSM balance of a single Karura account requires two paramaters: params = ['karura_address',{'Token':'KSM'}].

Thanks in advance!

  • Hi Ollie! I suggest you take your question to the very new and very cool dedicated [Substrate StackExchange](https://substrate.stackexchange.com/). You will get fast an dedicated support there! – Shawn Tabrizi Feb 09 '22 at 22:53
  • Great idea! doing so now. – olliecorbs Feb 09 '22 at 23:54
  • Substrate stack exchange post on this [here](https://substrate.stackexchange.com/questions/107/how-to-determine-which-parameters-are-required-when-using-substrate-query-to-q) – olliecorbs Feb 10 '22 at 00:09

0 Answers0