py-substrate-interface icon indicating copy to clipboard operation
py-substrate-interface copied to clipboard

KILT runtime calls are not included in the metadata

Open hardiksharma11 opened this issue 1 year ago • 2 comments

runtime_call should be having didApi and query method. Also it showing in the explorer but Error shows ValueError: Runtime API Call 'didApi.query' not found in registry.

If in metadataV14 runtime calls are not included in the metadata is there any way I can access the above call

hardiksharma11 avatar Jul 20 '24 05:07 hardiksharma11

Same issue with Hydration currenciesApi.account not found in registry or showing using get_metadata_runtime_call_functions() shows in explorer

PickledRobot avatar Dec 06 '24 22:12 PickledRobot

Yes unfortunately Runtime API calls are still manually administered in the library atm for MetadataV14 and they haven't been recently updated for all runtimes.

Until there is a more structural solution, you can manually add the desired runtime api calls as follows (example is the AccountNonceApi) :

substrate = SubstrateInterface(url=url)
substrate.runtime_config.update_type_registry({
    "runtime_api": {
        "AccountNonceApi": {
          "methods": {
            "account_nonce": {
              "description": "The API to query account nonce (aka transaction index)",
              "params": [
                {
                  "name": "account_id",
                  "type": "AccountId"
                }
              ],
              "type": "Index"
            }
          }
        },
    }
})

More runtime API examples can be found at: https://github.com/JAMdotTech/py-scale-codec/blob/master/scalecodec/type_registry/core.json#L1779-L3107

A good resource for constructing the registry could be: https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fkilt-rpc.dwellir.com#/runtime

Since MetadataV15 runtime API calls will be included in the metadata, but haven't checked progress of this for a while.

arjanz avatar Apr 07 '25 13:04 arjanz