polkadot-js / docs

This is the documentation portal for all Polkadot and Substrate related tools and libraries in the polkadot-js family of repos.
https://polkadot.js.org/docs/
Creative Commons Zero v1.0 Universal
165 stars 203 forks source link

TypeError: Cannot read property 'keys' of undefined when calling api.query.authorityDiscovery.keys() #424

Open ltfschoen opened 1 year ago

ltfschoen commented 1 year ago

If you follow the API docs here https://polkadot.js.org/docs/substrate/storage#authoritydiscovery and call api.query.authorityDiscovery.keys() after connecting to WS provider wss://rpc.polkadot.io, it returns TypeError: Cannot read property 'keys' of undefined. This was reported here https://substrate.stackexchange.com/questions/7761/how-to-query-api-query-authoritydiscovery-keys/7789#7789

Is it the case that it has been replaced with https://polkadot.js.org/docs/substrate/runtime#authoritydiscoveryapi ?

jacogr commented 1 year ago

The docs are generated from the substrate runtime, it will be different between versions and actual runtimes you connect to. (All docs, including the newly-added Kusama/Polkadot sections) are based on the master branches and updated weekly. What is actually on-chain could be lagging.

In all cases however - the docs are not done manually, they are extracted from the chain metadata and would reflect what is in that (master branch version) runtime.

If you compare Polkadot & Substrate - the kitchensink substrate runtime contains authorityDiscovery, Polkadot does not. Substrate basically exposes all available pallets (mostly), Polkadot/Kusama/others would have a selection based on the chain requirements.

TL;DR Entirely expected that runtimes would differ - the Substrate section lists all Substrate pallets, it is not chain-specific.