Closed dcolley closed 4 months ago
@TarikGul sounds like some PJS issue to me?
@bkchr Yea this is polkadot-js/api related.
@dcolley This is totally expected as the return type of api.query.identity.identityOf
is a Tuple: Option<ITuple<[PalletIdentityRegistration, Option<Bytes>]>>
. This is mirrored from the chain as PJS decorates all its calls directly from the metadata.
When looking at the docs for identityOf
:
/// Information that is pertinent to identify the entity behind an account. First item is the
/// registration, second is the account's primary username.
///
/// TWOX-NOTE: OK ― `AccountId` is a secure hash.
#[pallet::storage]
#[pallet::getter(fn identity)]
pub(super) type IdentityOf<T: Config> = StorageMap<
_,
Twox64Concat,
T::AccountId,
(Registration<BalanceOf<T>, T::MaxRegistrars, T::IdentityInformation>, Option<Username<T>>),
OptionQuery,
>;
Apps also shows what the return types is going to be via here.
TL:DR The source of truth will always be the chain you are connected to, PJS just mirrors what the chain gives it. IMO i think we can close this as its totally expected, and documented on the storage calls in the sdk but also in PJS api augmented calls.
The spec of the call changed between 10.12.2 and 10.12.3 - no mention of this in the release notes.
10.12.2
identityOf: AugmentedQuery<ApiType, (arg: AccountId32 | string | Uint8Array) => Observable<Option<PalletIdentityRegistration>>, [AccountId32]> & QueryableStorageEntry<ApiType, [AccountId32]>;
10.12.3
identityOf: AugmentedQuery<ApiType, (arg: AccountId32 | string | Uint8Array) => Observable<Option<ITuple<[PalletIdentityRegistration, Option<Bytes>]>>>, [AccountId32]> & QueryableStorageEntry<ApiType, [AccountId32]>;
I have updated my code, thanks.
Is there an existing issue?
Experiencing problems? Have you tried our Stack Exchange first?
Description of bug
Source:
https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fksm-rpc.stakeworld.io%2Fpeople#/chainstate
Accounts: Main: HyLisujX7Cr6D7xzb6qadFdedLt8hmArB6ZVGJ6xsCUHqmx Sub: JKhBBSWkr8BJKh5eFBtRux4hsDq4sAxvvmMU426qUA9aqEQ
api.query.identity.identityOf returns an array. I would expect only 1 ID per account OR please document this behaviour going forward.
identityOf for subId is empty
Steps to reproduce
Make a connection to People-kusama chain Trigger the storage call for api.query.identity.identityOf via PJS, or js