Swap to registry.createType (#1947)
This commit is contained in:
@@ -7,7 +7,7 @@ import { AnyJson, Constructor, Registry } from '@polkadot/types/types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import democracyTypes from '@polkadot/types/interfaces/democracy/definitions';
|
||||
import { Struct, createType } from '@polkadot/types';
|
||||
import { Struct } from '@polkadot/types';
|
||||
|
||||
// We can ignore the properties, added via Struct.with
|
||||
const _ReferendumInfo: Constructor<ReferendumInfo> = Struct.with(democracyTypes.types.ReferendumInfo as any) as any;
|
||||
@@ -25,7 +25,7 @@ export default class ReferendumInfoExtended extends _ReferendumInfo {
|
||||
|
||||
this.#index = value instanceof ReferendumInfoExtended
|
||||
? value.index
|
||||
: createType(registry, 'ReferendumIndex', index);
|
||||
: registry.createType('ReferendumIndex', index);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import { ApprovalFlag } from '@polkadot/types/interfaces';
|
||||
|
||||
import { createType, TypeRegistry } from '@polkadot/types';
|
||||
import { TypeRegistry } from '@polkadot/types';
|
||||
|
||||
import { approvalFlagsToBools } from './approvalFlagsToBools';
|
||||
|
||||
@@ -20,7 +20,7 @@ describe('approvalFlagsToBools', (): void => {
|
||||
it('translates a single input', (): void => {
|
||||
expect(
|
||||
approvalFlagsToBools([
|
||||
createType(registry, 'ApprovalFlag', 0b1010)
|
||||
registry.createType('ApprovalFlag', 0b1010)
|
||||
])
|
||||
).toEqual([false, true, false, true]);
|
||||
});
|
||||
@@ -28,8 +28,8 @@ describe('approvalFlagsToBools', (): void => {
|
||||
it('translates multiple inputs', (): void => {
|
||||
expect(
|
||||
approvalFlagsToBools([
|
||||
createType(registry, 'ApprovalFlag', 0b0000),
|
||||
createType(registry, 'ApprovalFlag', 0b1100)
|
||||
registry.createType('ApprovalFlag', 0b0000),
|
||||
registry.createType('ApprovalFlag', 0b1100)
|
||||
])
|
||||
).toEqual([false, false, false, true, true]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user