py-substrate-interface
py-substrate-interface copied to clipboard
KILT runtime calls are not included in the metadata
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
Same issue with Hydration currenciesApi.account not found in registry or showing using get_metadata_runtime_call_functions()
shows in explorer
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.