Open mgravitt opened 3 years ago
Hi @jacogr - I am back to working on this. Any update on this? If you can provide a little direction, I can put a PR together.
I am starting to work with a slightly different Map though, the StorageNMap
:
type DocumentID = u32;
type ContentGroupID = Vec<u8>;
type ContentLabel = Vec<u8>;
type ContentValue = Vec<u8>;
#[pallet::storage]
#[pallet::getter(fn values)]
pub(super) type Documents<T> = StorageNMap<
_, // Prefix
(
NMapKey<Blake2_128Concat, DocumentID>,
NMapKey<Blake2_128Concat, ContentGroupID>,
NMapKey<Twox64Concat, ContentLabel>,
),
ContentValue, // value
ValueQuery,
>;
thanks
The problem seems here - https://github.com/polkadot-js/tools/blob/master/packages/api-cli/src/api.ts#L185
it uses query.palletDid.attributeNonce
and never .entries
(i.e. by default doesn't seem to support .keys
or .entries
.
So for quick and dirty -
keys
or entries
do api[type][section][method][extra]
here https://github.com/polkadot-js/tools/blob/master/packages/api-cli/src/api.ts#L191(For bonus on query we could also cater for .size
and .hash
and .at
to make it more rounded)
@jacogr Hey, I'm struggling with the same issue, any updates? Could you repost the links from above? I think they were moved.
This is where the parts are split - https://github.com/polkadot-js/tools/blob/ed3c79339aac4a9469a8474bc8484ddd4055647b/packages/api-cli/src/runcli.ts#L187
It only does type
, section
, method
, so basically when you pass api.query.a.b.entries
you end up with query
(as type), a
(as section) and b
(as method) and lose the "extra" specifier that is entries
.
When querying the DID pallet attributeNonce storage map/function using the UI, the entries are printed (see screenshot). However, when doing the same with the CLI, I receive the below error. Using v3 of substrate.
The storage definition from pallet DID this:
Here is Element chat on the matter: https://matrix.to/#/!HzySYSaIhtyWrwiwEV:matrix.org/$16161900411781ctEUT:matrix.parity.io?via=matrix.parity.io&via=matrix.org&via=corepaper.org
Screenshot of UI showing the entries being printed:
Error message when attempting the same thing from the CLI: