From f9c58203a0467aeea4eabdc25bac6720937f26e7 Mon Sep 17 00:00:00 2001 From: Tarik Gul <47201679+TarikGul@users.noreply.github.com> Date: Fri, 17 May 2024 13:22:07 -0700 Subject: [PATCH] Fix api.derive.accounts.{info && identity} (#5885) * Fix api.derive.accounts.identity and all residual derives * reorder types --- packages/api-derive/src/accounts/identity.ts | 26 +++++++++++++++++--- packages/api-derive/src/accounts/types.ts | 3 +++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/packages/api-derive/src/accounts/identity.ts b/packages/api-derive/src/accounts/identity.ts index dc9f6f9895..bc6eb94715 100644 --- a/packages/api-derive/src/accounts/identity.ts +++ b/packages/api-derive/src/accounts/identity.ts @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 import type { Observable } from 'rxjs'; -import type { Bytes, Data } from '@polkadot/types'; -import type { AccountId } from '@polkadot/types/interfaces'; +import type { Bytes, Data, Struct } from '@polkadot/types'; +import type { AccountId, H160 } from '@polkadot/types/interfaces'; import type { PalletIdentityLegacyIdentityInfo, PalletIdentityRegistration } from '@polkadot/types/lookup'; import type { Option } from '@polkadot/types-codec'; import type { ITuple } from '@polkadot/types-codec/types'; @@ -17,9 +17,26 @@ import { firstMemo, memo } from '../util/index.js'; type IdentityInfoAdditional = PalletIdentityLegacyIdentityInfo['additional'][0]; +interface PeopleIdentityInfo extends Struct { + display: Data; + legal: Data; + web: Data; + matrix: Data; + email: Data; + pgpFingerprint: Option; + image: Data; + twitter: Data; + github: Data; + discord: Data; +} + const UNDEF_HEX = { toHex: () => undefined }; function dataAsString (data: Data): string | undefined { + if (!data) { + return data; + } + return data.isRaw ? u8aToString(data.asRaw.toU8a(true)) : data.isNone @@ -58,13 +75,16 @@ function extractIdentity (identityOfOpt?: Option; export interface DeriveAccountRegistration { + discord?: string | undefined; display?: string | undefined; displayParent?: string | undefined; email?: string | undefined; + github?: string | undefined; image?: string | undefined; legal?: string | undefined; + matrix?: string | undefined; other?: Record | undefined; parent?: AccountId | undefined; pgp?: string | undefined;