From 321184348a3e059cbceec89eff19e878e46a2c80 Mon Sep 17 00:00:00 2001 From: KarishmaBothara Date: Thu, 9 Dec 2021 11:53:35 +0530 Subject: [PATCH] with this change the tokenId will appear has 3 rows for collectionId,SeriesId and SerialNo --- packages/react-api/src/typeRegistry.ts | 2 ++ packages/react-params/src/Param/findComponent.ts | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/react-api/src/typeRegistry.ts b/packages/react-api/src/typeRegistry.ts index 166778a45ab9..621238821b03 100644 --- a/packages/react-api/src/typeRegistry.ts +++ b/packages/react-api/src/typeRegistry.ts @@ -3,7 +3,9 @@ // of the Apache-2.0 license. See the LICENSE file for details. import { TypeRegistry } from '@polkadot/types'; +import types from '@cennznet/types/interfaces/injects'; const registry = new TypeRegistry(); +registry.register(types); export default registry; diff --git a/packages/react-params/src/Param/findComponent.ts b/packages/react-params/src/Param/findComponent.ts index 0720689fd180..f6a5f9f8899a 100644 --- a/packages/react-params/src/Param/findComponent.ts +++ b/packages/react-params/src/Param/findComponent.ts @@ -7,7 +7,7 @@ import { Props, ComponentMap } from '../types'; import BN from 'bn.js'; import { registry } from '@polkadot/react-api'; -import { createType, getTypeDef } from '@polkadot/types'; +import { getTypeDef } from '@polkadot/types'; import Account from './Account'; import Amount from './Amount'; @@ -125,7 +125,7 @@ export default function findComponent (def: TypeDef, overrides: ComponentMap = { if (!Component) { try { - const instance = createType(registry, type as any); + const instance = registry.createType(type as any); const raw = getTypeDef(instance.toRawType()); Component = findOne(raw.type); @@ -134,7 +134,9 @@ export default function findComponent (def: TypeDef, overrides: ComponentMap = { return Component; } else if (instance instanceof BN) { return Amount; - } else if ([TypeDefInfo.Enum, TypeDefInfo.Struct].includes(raw.info)) { + } else if ([TypeDefInfo.Enum, TypeDefInfo.Struct, TypeDefInfo.Tuple, TypeDefInfo.Vec].includes(raw.info)) { + return findComponent(raw, overrides); + } else if (raw.info === TypeDefInfo.VecFixed && (raw.sub as TypeDef).type !== 'u8') { return findComponent(raw, overrides); } } catch (error) {