go-substrate-rpc-client icon indicating copy to clipboard operation
go-substrate-rpc-client copied to clipboard

How to getKeys in a Map Storage query?

Open johnuopini opened this issue 3 years ago • 4 comments

In polkadot JS i can disable an optional Map query option and get all the results, how do i do the same with this client? How can i get all the Keys and loop through them in a Map type of storage query?

johnuopini avatar Sep 29 '22 13:09 johnuopini

In the polkadot JS api there are 2 methods on a storagemap: keys() and entries(), how do we achieve the same using this client?

DylanVerstraete avatar Feb 07 '23 10:02 DylanVerstraete

@johnuopini check https://github.com/threefoldtech/substrate-client/blob/rename_bridge_burn_to_withdraw/bridge_withdraw.go#L104-L125

DylanVerstraete avatar Feb 07 '23 12:02 DylanVerstraete

@johnuopini Does the answer from Dylan help? Alternatively, you could look into adjusting CreateStorageKey to support partial arguments since at this point, we error our if the number of hashes for a specific key does not match the number of provided arguments.

cdamian avatar Dec 05 '23 12:12 cdamian

@johnuopini Does the answer from Dylan help? Alternatively, you could look into adjusting CreateStorageKey to support partial arguments since at this point, we error our if the number of hashes for a specific key does not match the number of provided arguments.

support for partial / leaving out optional arguments would be great 🙏🏽

bb4L avatar Dec 14 '23 11:12 bb4L