Adjust Registry createType return detection (#3844)

* Adjust Registry createType return detection

* type as 'OtherType' cast removal

* Use createClass via registry
This commit is contained in:
Jaco
2021-08-05 09:15:06 +02:00
committed by GitHub
parent fd7c80bd8a
commit e0ecaccb09
33 changed files with 152 additions and 138 deletions
+3 -3
View File
@@ -6,7 +6,7 @@ import type { Constructor, Registry } from '@polkadot/types/types';
import { Compact, Enum, Option, Struct, Tuple, UInt, Vec } from '@polkadot/types/codec';
import { AbstractInt } from '@polkadot/types/codec/AbstractInt';
import { ClassOfUnsafe, getTypeDef } from '@polkadot/types/create';
import { getTypeDef } from '@polkadot/types/create';
import { TypeDefInfo } from '@polkadot/types/create/types';
import { GenericAccountId, GenericLookupSource, GenericVote } from '@polkadot/types/generic';
import { AllConvictions } from '@polkadot/types/interfaces/democracy/definitions';
@@ -30,7 +30,7 @@ export function getDerivedTypes (registry: Registry, definitions: Record<string,
// `primitiveName` represents the actual primitive type our type is mapped to
const isCompact = isCompactEncodable(
(primitiveClasses as Record<string, any>)[primitiveName] ||
ClassOfUnsafe(registry, type)
registry.createClass(type)
);
const def = getTypeDef(type);
@@ -87,7 +87,7 @@ export function getSimilarTypes (registry: Registry, definitions: Record<string,
return ['null'];
}
const Clazz = ClassOfUnsafe(registry, type);
const Clazz = registry.createClass(type);
if (isChildClass(Vec, Clazz)) {
const vecDef = getTypeDef(type);