Closed BulatSaif closed 2 years ago
I checked the storage functions in the metadata of the Rococo runtime (with substrate.get_metadata_storage_functions()
), and indeed no pallet named Substrate
. At this point I have no idea how PolkadotJS retrieves this, I will have to look into it.
Ok mystery solved, apparently there is a list of 'well-known' storage keys in Substrate, that are not exposed in the metadata:
I will have to add those keys manually in the library and for consistency I will use the same convention as in PolkadotJS
Until that is released what you can do is use the encoded storage key as shown in PolkadotJS:
And use that to retrieve the raw result:
block_hash = substrate.get_chain_head()
code_result = substrate.get_storage_by_key(block_hash, "0x3a636f6465")
Thank you for a solution, It works, I was wondering, how to use an encoded storage key
How to run build-in Storage functions? If my understanding is correct substrate has pallet functions (Example
Sudo.Key
) and build-in functions ( ExampleSubstrate.Code
)From https://polkadot.js.org/ I can query both types, but SubstrateInterface fails to query build-in functions:
Steps to reproduce
Start local node:
Run this code
Current output
Expected output
Versions