Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

with this change the tokenId will appear has 3 rows for collectionId,… #166

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/react-api/src/typeRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
8 changes: 5 additions & 3 deletions packages/react-params/src/Param/findComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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);
Expand All @@ -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) {
Expand Down