Correct hasIdentity parentId extraction (#2884)
This commit is contained in:
@@ -107,12 +107,11 @@ export function hasIdentity (instanceId: string, api: ApiInterfaceRx): (accountI
|
||||
api.derive.accounts._identityBase(accountId).pipe(
|
||||
map(([identityOfOpt, superOfOpt]: [Option<Registration> | undefined, Option<ITuple<[AccountId, Data]>> | undefined]): DeriveHasIdentity => {
|
||||
const parentId = superOfOpt && superOfOpt.isSome
|
||||
? superOfOpt.unwrap().toString()
|
||||
? superOfOpt.unwrap()[0].toString()
|
||||
: null;
|
||||
const hasParent = !!parentId;
|
||||
const hasIdentity = hasParent || !!(identityOfOpt && identityOfOpt.isSome);
|
||||
const hasIdentity = !!parentId || !!(identityOfOpt && identityOfOpt.isSome);
|
||||
|
||||
return { hasIdentity, hasParent, parentId };
|
||||
return { hasIdentity, parentId };
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
@@ -38,6 +38,5 @@ export interface DeriveAccountInfo {
|
||||
|
||||
export interface DeriveHasIdentity {
|
||||
hasIdentity: boolean;
|
||||
hasParent: boolean;
|
||||
parentId: string | null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user