Move types/codec/create -> types/create (#1871)
* Move types/codec/create -> types/create * Update imports after move * Cleanups * Cleanup code circular deps * Re-add dropped interfaces * Drop duplicated code * Fix imports * Remove whacky comment
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
# 1.3.0-beta.x
|
||||
|
||||
- The `@polkadot/types/codec/create` has been moved to `@polkadot/types/create`, imports from `@polkadot/types` are unaffected
|
||||
- Expose chain properies on registry (and use for API type formatting)
|
||||
|
||||
# 1.2.1 Feb 16, 2020
|
||||
|
||||
+1
-2
@@ -13,7 +13,6 @@
|
||||
"scripts": {
|
||||
"build": "yarn build:interfaces && polkadot-dev-build-ts",
|
||||
"build:interfaces": "node packages/types/src/scripts/interfacesTsWrapper.js",
|
||||
"circular": "madge --circular --extensions ts ./",
|
||||
"docs": "node packages/types/src/scripts/MetadataMdWrapper.js && polkadot-dev-build-docs",
|
||||
"chain:info": "node packages/types/src/scripts/extractChainWrapper.js",
|
||||
"lint": "polkadot-dev-run-lint",
|
||||
@@ -27,7 +26,7 @@
|
||||
"@babel/core": "^7.8.4",
|
||||
"@babel/register": "^7.8.3",
|
||||
"@babel/runtime": "^7.8.4",
|
||||
"@polkadot/dev": "^0.40.16",
|
||||
"@polkadot/dev": "^0.40.17",
|
||||
"@polkadot/ts": "^0.2.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import { ApiTypes, DecorateMethod } from '@polkadot/api/types';
|
||||
import { AccountId, Address, ContractExecResult } from '@polkadot/types/interfaces';
|
||||
import { Codec, CodecArg } from '@polkadot/types/types';
|
||||
import { MetaRegistryJson, StringIndex, TypeIndex, TypeDef } from '@polkadot/types/codec/create/types';
|
||||
import { MetaRegistryJson, StringIndex, TypeIndex, TypeDef } from '@polkadot/types/create/types';
|
||||
|
||||
// import { Observable } from 'rxjs';
|
||||
import { ApiPromise, ApiRx } from '@polkadot/api';
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
|
||||
import { Codec, Registry, TypeDefInfo, TypeDef } from '@polkadot/types/types';
|
||||
|
||||
import { Option, Raw, createClass } from '@polkadot/types';
|
||||
import { createTypeUnsafe } from '@polkadot/types/codec';
|
||||
import { Option, Raw, createClass, createTypeUnsafe } from '@polkadot/types';
|
||||
|
||||
export function formatData (registry: Registry, data: Raw, { info, type }: TypeDef): Codec {
|
||||
if (info === TypeDefInfo.Option) {
|
||||
|
||||
@@ -10,7 +10,7 @@ import { IExtrinsic, IMethod } from '@polkadot/types/types';
|
||||
import { ApiPromise } from '@polkadot/api';
|
||||
import { HeaderExtended } from '@polkadot/api-derive';
|
||||
import testKeyring, { TestKeyringMap } from '@polkadot/keyring/testingPairs';
|
||||
import { createType, createTypeUnsafe, TypeRegistry } from '@polkadot/types/codec';
|
||||
import { createType, createTypeUnsafe, TypeRegistry } from '@polkadot/types';
|
||||
|
||||
import { SubmittableResult } from './';
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { ClassOf, createType, TypeRegistry } from '@polkadot/types/codec/create';
|
||||
import { ClassOf, createType, TypeRegistry } from '@polkadot/types/create';
|
||||
import { u8aToHex } from '@polkadot/util';
|
||||
|
||||
import Decorated from './Decorated';
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import { Registry } from '@polkadot/types/types';
|
||||
import { Constants, ConstantCodec, ModuleConstants } from '../../types';
|
||||
|
||||
import { createTypeUnsafe } from '@polkadot/types/codec';
|
||||
import { createTypeUnsafe } from '@polkadot/types/create';
|
||||
import { stringCamelCase } from '@polkadot/util';
|
||||
|
||||
import Metadata from '../../../Metadata';
|
||||
|
||||
@@ -6,8 +6,8 @@ import { Call } from '@polkadot/types/interfaces';
|
||||
import { AnyJsonObject, CallFunction, Registry, RegistryMetadataCall } from '@polkadot/types/types';
|
||||
|
||||
// we do a direct import here to remove all circular dependencies (importing from
|
||||
// /types, /types/codec or /types/codec/create makes all hell break loose)
|
||||
import { createType } from '@polkadot/types/codec/create/createType';
|
||||
// /types, /types/codec or /types/create makes all hell break loose)
|
||||
import { createType } from '@polkadot/types/create/createType';
|
||||
import { assert, stringCamelCase } from '@polkadot/util';
|
||||
|
||||
/** @internal */
|
||||
|
||||
@@ -6,7 +6,8 @@ import { StorageEntryMetadataLatest } from '@polkadot/types/interfaces/metadata'
|
||||
import { Codec, Registry } from '@polkadot/types/types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import { Compact, Raw, createType, createTypeUnsafe } from '@polkadot/types/codec';
|
||||
import { Compact, Raw } from '@polkadot/types/codec';
|
||||
import { createType, createTypeUnsafe } from '@polkadot/types/create';
|
||||
import StorageKey, { StorageEntry } from '@polkadot/types/primitive/StorageKey';
|
||||
import { assert, compactStripLength, isNull, isUndefined, stringLowerFirst, stringToU8a, u8aConcat } from '@polkadot/util';
|
||||
import { xxhashAsU8a } from '@polkadot/util-crypto';
|
||||
|
||||
@@ -6,7 +6,7 @@ import { StorageEntryMetadataLatest } from '@polkadot/types/interfaces/metadata'
|
||||
import { Registry } from '@polkadot/types/types';
|
||||
|
||||
import { StorageEntry } from '@polkadot/types/primitive/StorageKey';
|
||||
import { createType } from '@polkadot/types/codec';
|
||||
import { createType } from '@polkadot/types/create';
|
||||
|
||||
import createFunction from './createFunction';
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import { MetadataAll, MetadataLatest, MetadataV0, MetadataV1, MetadataV2, MetadataV3, MetadataV4, MetadataV5, MetadataV6, MetadataV7, MetadataV8, MetadataV9, MetadataV10, MetadataV11 } from '@polkadot/types/interfaces/metadata';
|
||||
import { Registry } from '@polkadot/types/types';
|
||||
|
||||
import { createType } from '@polkadot/types/codec/create/createType';
|
||||
import { createType } from '@polkadot/types/create/createType';
|
||||
import Struct from '@polkadot/types/codec/Struct';
|
||||
import { assert } from '@polkadot/util';
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import { Codec, Registry } from '@polkadot/types/types';
|
||||
import { MetadataInterface } from '../types';
|
||||
|
||||
import { createTypeUnsafe } from '@polkadot/types/codec/create';
|
||||
import { createTypeUnsafe } from '@polkadot/types/create';
|
||||
import { unwrapStorageType } from '@polkadot/types/primitive/StorageKey';
|
||||
|
||||
import getUniqTypes from './getUniqTypes';
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import { MetadataLatest } from '@polkadot/types/interfaces/metadata';
|
||||
import { AnyJsonObject, Registry } from '@polkadot/types/types';
|
||||
|
||||
import { createType } from '@polkadot/types/codec';
|
||||
import { createType } from '@polkadot/types/create';
|
||||
|
||||
/** @internal */
|
||||
export default function toCallsOnly (registry: Registry, { extrinsic, modules }: MetadataLatest): AnyJsonObject | string {
|
||||
|
||||
@@ -2,10 +2,9 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Registry } from '@polkadot/types/types';
|
||||
import { TypeDef, TypeDefInfo, TypeDefExtVecFixed } from '@polkadot/types/codec/types';
|
||||
import { Registry, TypeDef, TypeDefInfo, TypeDefExtVecFixed } from '@polkadot/types/types';
|
||||
|
||||
import { getTypeDef } from '@polkadot/types/codec/create';
|
||||
import { getTypeDef } from '@polkadot/types/create';
|
||||
|
||||
import flattenUniq from './flattenUniq';
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { TypeRegistry } from '@polkadot/types/codec';
|
||||
import { TypeRegistry } from '@polkadot/types/create';
|
||||
|
||||
import Metadata from '../';
|
||||
import latestSubstrateV0 from './static-substrate.json';
|
||||
|
||||
@@ -8,7 +8,8 @@ import { Registry } from '@polkadot/types/types';
|
||||
|
||||
import { stringUpperFirst } from '@polkadot/util';
|
||||
|
||||
import { createType, Option, Vec } from '@polkadot/types/codec';
|
||||
import { createType } from '@polkadot/types/create';
|
||||
import { Option, Vec } from '@polkadot/types/codec';
|
||||
import { Text } from '@polkadot/types/primitive';
|
||||
|
||||
/** @internal */
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import { MetadataV1, MetadataV2 } from '@polkadot/types/interfaces/metadata';
|
||||
import { Registry } from '@polkadot/types/types';
|
||||
|
||||
import { createType } from '@polkadot/types/codec';
|
||||
import { createType } from '@polkadot/types/create';
|
||||
|
||||
/** @internal */
|
||||
export default function toV2 (registry: Registry, metadataV1: MetadataV1): MetadataV2 {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import { MetadataV10, MetadataV11 } from '@polkadot/types/interfaces/metadata';
|
||||
import { Registry } from '@polkadot/types/types';
|
||||
|
||||
import { createType } from '@polkadot/types/codec';
|
||||
import { createType } from '@polkadot/types/create';
|
||||
|
||||
/** @internal */
|
||||
export default function toV11 (registry: Registry, { modules }: MetadataV10): MetadataV11 {
|
||||
|
||||
@@ -7,7 +7,7 @@ import { FunctionMetadataV11, FunctionMetadataLatest, MetadataV11, MetadataLates
|
||||
import { Registry } from '@polkadot/types/types';
|
||||
|
||||
import { getModuleTypes } from '@polkadot/types/known';
|
||||
import { createType } from '@polkadot/types/codec';
|
||||
import { createType } from '@polkadot/types/create';
|
||||
import { Type } from '@polkadot/types/primitive';
|
||||
import { stringCamelCase } from '@polkadot/util';
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import { MetadataV2, MetadataV3 } from '@polkadot/types/interfaces/metadata';
|
||||
import { Registry } from '@polkadot/types/types';
|
||||
|
||||
import { createType } from '@polkadot/types/codec';
|
||||
import { createType } from '@polkadot/types/create';
|
||||
|
||||
/** @internal */
|
||||
export default function toV3 (registry: Registry, metadataV2: MetadataV2): MetadataV3 {
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
import { MetadataV3, MetadataV4, ModuleMetadataV4, StorageFunctionMetadataV3, StorageFunctionMetadataV4 } from '@polkadot/types/interfaces/metadata';
|
||||
import { Registry } from '@polkadot/types/types';
|
||||
|
||||
import { createType, Option } from '@polkadot/types/codec';
|
||||
import { createType } from '@polkadot/types/create';
|
||||
import { Option } from '@polkadot/types/codec';
|
||||
|
||||
/** @internal */
|
||||
function toV4StorageFunction (registry: Registry, storageFn: StorageFunctionMetadataV3): StorageFunctionMetadataV4 {
|
||||
|
||||
@@ -7,7 +7,8 @@ import { Registry } from '@polkadot/types/types';
|
||||
|
||||
import { assert } from '@polkadot/util';
|
||||
|
||||
import { createType, Option } from '@polkadot/types/codec';
|
||||
import { Option } from '@polkadot/types/codec';
|
||||
import { createType } from '@polkadot/types/create';
|
||||
import Text from '@polkadot/types/primitive/Text';
|
||||
|
||||
const hasherMap: Map<string, string> = new Map([
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import { MetadataV5, MetadataV6, ModuleMetadataV6 } from '@polkadot/types/interfaces/metadata';
|
||||
import { Registry } from '@polkadot/types/types';
|
||||
|
||||
import { createType } from '@polkadot/types/codec';
|
||||
import { createType } from '@polkadot/types/create';
|
||||
|
||||
/** @internal */
|
||||
export default function toV6 (registry: Registry, { modules }: MetadataV5): MetadataV6 {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import { MetadataV6, MetadataV7, ModuleMetadataV7 } from '@polkadot/types/interfaces/metadata';
|
||||
import { Registry } from '@polkadot/types/types';
|
||||
|
||||
import { createType } from '@polkadot/types/codec';
|
||||
import { createType } from '@polkadot/types/create';
|
||||
|
||||
/** @internal */
|
||||
export default function toV7 (registry: Registry, { modules }: MetadataV6): MetadataV7 {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import { MetadataV7, MetadataV8, ModuleMetadataV8 } from '@polkadot/types/interfaces/metadata';
|
||||
import { Registry } from '@polkadot/types/types';
|
||||
|
||||
import { createType } from '@polkadot/types/codec';
|
||||
import { createType } from '@polkadot/types/create';
|
||||
|
||||
/** @internal */
|
||||
export default function toV8 (registry: Registry, { modules }: MetadataV7): MetadataV8 {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import { MetadataV8, MetadataV9 } from '@polkadot/types/interfaces/metadata';
|
||||
import { Registry } from '@polkadot/types/types';
|
||||
|
||||
import { createType } from '@polkadot/types/codec';
|
||||
import { createType } from '@polkadot/types/create';
|
||||
|
||||
/** @internal */
|
||||
export default function toV9 (registry: Registry, { modules }: MetadataV8): MetadataV9 {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import { MetadataV9, MetadataV10, ModuleMetadataV9, ModuleMetadataV10, StorageEntryMetadataV9, StorageEntryTypeV9, StorageHasherV9, StorageHasherV10 } from '@polkadot/types/interfaces/metadata';
|
||||
import { Registry } from '@polkadot/types/types';
|
||||
|
||||
import { createType } from '@polkadot/types/codec';
|
||||
import { createType } from '@polkadot/types/create';
|
||||
|
||||
// migrate a storage hasher type
|
||||
// see https://github.com/paritytech/substrate/pull/4462
|
||||
|
||||
@@ -13,8 +13,7 @@ import { catchError, map, publishReplay, refCount, switchMap } from 'rxjs/operat
|
||||
import jsonrpc from '@polkadot/jsonrpc';
|
||||
import jsonrpcMethod from '@polkadot/jsonrpc/create/method';
|
||||
import jsonrpcParam from '@polkadot/jsonrpc/create/param';
|
||||
import { Option, StorageKey, Vec, createClass } from '@polkadot/types';
|
||||
import { createTypeUnsafe } from '@polkadot/types/codec';
|
||||
import { Option, StorageKey, Vec, createClass, createTypeUnsafe } from '@polkadot/types';
|
||||
import { assert, isFunction, isNull, isNumber, isUndefined, logger, u8aToU8a } from '@polkadot/util';
|
||||
|
||||
import { drr } from './rxjs';
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { TypeRegistry } from '../codec';
|
||||
import { TypeRegistry } from '../create';
|
||||
import Text from '../primitive/Text';
|
||||
import U32 from '../primitive/U32';
|
||||
import Struct from './Struct';
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { TypeRegistry } from '../codec';
|
||||
import { TypeRegistry } from '../create';
|
||||
import Text from '../primitive/Text';
|
||||
import U32 from '../primitive/U32';
|
||||
import Struct from './Struct';
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import BN from 'bn.js';
|
||||
|
||||
import { createType, ClassOf, TypeRegistry } from './create';
|
||||
import { createType, ClassOf, TypeRegistry } from '../create';
|
||||
import Moment from './Date';
|
||||
import U32 from '../primitive/U32';
|
||||
import Compact from './Compact';
|
||||
|
||||
@@ -6,7 +6,7 @@ import { CodecTo } from '../types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
|
||||
import { TypeRegistry } from './create';
|
||||
import { TypeRegistry } from '../create';
|
||||
import U64 from '../primitive/U64';
|
||||
import CodecDate from './Date';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import BN from 'bn.js';
|
||||
import { bnToBn, bnToHex, bnToU8a, isString, isU8a, u8aToBn } from '@polkadot/util';
|
||||
import { blake2AsU8a } from '@polkadot/util-crypto';
|
||||
|
||||
import { createType } from './create';
|
||||
import { createType } from '../create';
|
||||
import { UIntBitLength } from './AbstractInt';
|
||||
|
||||
const BITLENGTH: UIntBitLength = 64;
|
||||
|
||||
@@ -6,7 +6,7 @@ import { Registry } from '../types';
|
||||
|
||||
import { u8aToHex } from '@polkadot/util';
|
||||
|
||||
import { TypeRegistry, createType } from './create';
|
||||
import { TypeRegistry, createType } from '../create';
|
||||
import Null from '../primitive/Null';
|
||||
import Text from '../primitive/Text';
|
||||
import U32 from '../primitive/U32';
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { TypeRegistry } from './create';
|
||||
import { TypeRegistry } from '../create';
|
||||
import Int from './Int';
|
||||
|
||||
describe('Int', (): void => {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { TypeRegistry } from './create';
|
||||
import { TypeRegistry } from '../create';
|
||||
import Bytes from '../primitive/Bytes';
|
||||
import U32 from '../primitive/U32';
|
||||
import Text from '../primitive/Text';
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import { CodecTo } from '../types';
|
||||
|
||||
import { TypeRegistry } from './create';
|
||||
import { TypeRegistry } from '../create';
|
||||
import Raw from './Raw';
|
||||
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import { hexToString } from '@polkadot/util';
|
||||
|
||||
import { u32, Text } from '../primitive';
|
||||
import { createType, TypeRegistry } from './create';
|
||||
import { createType, TypeRegistry } from '../create';
|
||||
import Result from './Result';
|
||||
|
||||
describe('Result', (): void => {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { TypeRegistry } from './create';
|
||||
import { TypeRegistry } from '../create';
|
||||
import Set from './Set';
|
||||
|
||||
const SET_FIELDS = {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { ClassOf, TypeRegistry } from './create';
|
||||
import { ClassOf, TypeRegistry } from '../create';
|
||||
import AccountId from '../primitive/Generic/AccountId';
|
||||
import Text from '../primitive/Text';
|
||||
import U32 from '../primitive/U32';
|
||||
|
||||
@@ -9,7 +9,7 @@ import { CodecTo } from '../types';
|
||||
import Metadata from '@polkadot/metadata/Metadata';
|
||||
import rpcMetadata from '@polkadot/metadata/Metadata/static';
|
||||
|
||||
import { ClassOf, TypeRegistry } from './create';
|
||||
import { ClassOf, TypeRegistry } from '../create';
|
||||
import Text from '../primitive/Text';
|
||||
import U32 from '../primitive/U32';
|
||||
import U128 from '../primitive/U128';
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { TypeRegistry } from './create';
|
||||
import { TypeRegistry } from '../create';
|
||||
import U8aFixed from './U8aFixed';
|
||||
|
||||
describe('U8aFixed', (): void => {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import BN from 'bn.js';
|
||||
|
||||
import { TypeRegistry } from './create';
|
||||
import { TypeRegistry } from '../create';
|
||||
import UInt from './UInt';
|
||||
|
||||
describe('UInt', (): void => {
|
||||
|
||||
@@ -6,7 +6,7 @@ import { AnyNumber, Constructor, Registry } from '../types';
|
||||
|
||||
import { bnToHex, bnToU8a } from '@polkadot/util';
|
||||
|
||||
import { ClassOf } from './create/createClass';
|
||||
import { ClassOf } from '../create/createClass';
|
||||
import AbstractInt, { DEFAULT_UINT_BITS, UIntBitLength } from './AbstractInt';
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,9 +8,9 @@ import { Codec, CodecTo } from '../types';
|
||||
import Metadata from '@polkadot/metadata/Metadata';
|
||||
import rpcMetadata from '@polkadot/metadata/Metadata/static';
|
||||
|
||||
import { createTypeUnsafe, TypeRegistry } from '../create';
|
||||
import AccountId from '../primitive/Generic/AccountId';
|
||||
import Text from '../primitive/Text';
|
||||
import { createTypeUnsafe, TypeRegistry } from './create';
|
||||
import Vec from './Vec';
|
||||
import Tuple from './Tuple';
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { TypeRegistry } from '../codec';
|
||||
import { TypeRegistry } from '../create';
|
||||
import Text from '../primitive/Text';
|
||||
import VecFixed from './VecFixed';
|
||||
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
// Copyright 2017-2020 @polkadot/types authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Codec, Constructor, InterfaceTypes, Registry } from '../../types';
|
||||
import { FromReg } from './types';
|
||||
|
||||
import { InterfaceRegistry } from '../../interfaceRegistry';
|
||||
import { getTypeClass } from './getTypeClass';
|
||||
import { getTypeDef } from './getTypeDef';
|
||||
|
||||
export function createClass<T extends Codec = Codec, K extends string = string> (registry: Registry, type: K): Constructor<FromReg<T, K>> {
|
||||
return getTypeClass<FromReg<T, K>>(registry, getTypeDef(type));
|
||||
}
|
||||
|
||||
// An unsafe version of the `createType` below. It's unsafe because the `type`
|
||||
// argument here can be any string, which, if it cannot be parsed, it will yield
|
||||
// a runtime error.
|
||||
export function ClassOfUnsafe<T extends Codec = Codec, K extends string = string> (registry: Registry, name: K): Constructor<FromReg<T, K>> {
|
||||
return createClass<T, K>(registry, name);
|
||||
}
|
||||
|
||||
// alias for createClass
|
||||
export function ClassOf<K extends InterfaceTypes> (registry: Registry, name: K): Constructor<InterfaceRegistry[K]> {
|
||||
// TS2589: Type instantiation is excessively deep and possibly infinite.
|
||||
// The above happens with as Constructor<InterfaceRegistry[K]>;
|
||||
return ClassOfUnsafe<Codec, K>(registry, name) as any;
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
// Copyright 2017-2020 @polkadot/types authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Codec, Constructor } from '../../types';
|
||||
|
||||
import { getTypeClass, TypeRegistry } from '.';
|
||||
|
||||
describe('getTypeClass', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
it('does not allow invalid types', (): void => {
|
||||
expect(
|
||||
(): Constructor<Codec> => getTypeClass(registry, 'SomethingInvalid' as any)
|
||||
).toThrow(/determine type/);
|
||||
});
|
||||
});
|
||||
@@ -26,5 +26,4 @@ export { default as Raw } from './Raw';
|
||||
export { default as UInt } from './UInt';
|
||||
|
||||
// Type management helper functions
|
||||
export * from './create';
|
||||
export * from './utils/encodeTypes';
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
// Copyright 2017-2020 @polkadot/types authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
export * from './create/types';
|
||||
@@ -2,7 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { TypeRegistry } from '../create';
|
||||
import { TypeRegistry } from '../../create';
|
||||
import U32 from '../../primitive/U32';
|
||||
import compareArray from './compareArray';
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Codec } from '../../types';
|
||||
import { TypeRegistry } from '../create';
|
||||
import { TypeRegistry } from '../../create';
|
||||
import U32 from '../../primitive/U32';
|
||||
import compareMap from './compareMap';
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { TypeDef, TypeDefInfo, TypeDefExtVecFixed } from '../types';
|
||||
import { TypeDef, TypeDefInfo, TypeDefExtVecFixed } from '../../create/types';
|
||||
|
||||
import { assert } from '@polkadot/util';
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import { Codec, Constructor, InterfaceTypes, Registry } from '../../types';
|
||||
|
||||
import { isString } from '@polkadot/util';
|
||||
|
||||
import { ClassOf } from '../create/createClass';
|
||||
import { ClassOf } from '../../create/createClass';
|
||||
|
||||
export function typeToConstructor <T = Codec> (registry: Registry, type: InterfaceTypes | Constructor<T>): Constructor<T> {
|
||||
return (
|
||||
|
||||
+13
-1
@@ -2,7 +2,9 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { createClass, TypeRegistry } from '.';
|
||||
import { Codec, Constructor } from '../types';
|
||||
|
||||
import { createClass, getTypeClass, TypeRegistry } from '.';
|
||||
|
||||
describe('createClass', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
@@ -21,3 +23,13 @@ describe('createClass', (): void => {
|
||||
expect(new A(registry) instanceof B).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getTypeClass', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
it('does not allow invalid types', (): void => {
|
||||
expect(
|
||||
(): Constructor<Codec> => getTypeClass(registry, 'SomethingInvalid' as any)
|
||||
).toThrow(/determine type/);
|
||||
});
|
||||
});
|
||||
+35
-15
@@ -2,24 +2,44 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Codec, Constructor, InterfaceTypes, Registry } from '../../types';
|
||||
import { TypeDef, TypeDefExtVecFixed, TypeDefInfo } from './types';
|
||||
import { Codec, Constructor, InterfaceTypes, Registry } from '../types';
|
||||
import { FromReg, TypeDef, TypeDefExtVecFixed, TypeDefInfo } from './types';
|
||||
|
||||
import { assert } from '@polkadot/util';
|
||||
|
||||
import BTreeMap from '../BTreeMap';
|
||||
import BTreeSet from '../BTreeSet';
|
||||
import Compact from '../Compact';
|
||||
import Enum from '../Enum';
|
||||
import Option from '../Option';
|
||||
import Result from '../Result';
|
||||
import CodecSet from '../Set';
|
||||
import Struct from '../Struct';
|
||||
import Tuple from '../Tuple';
|
||||
import U8aFixed, { BitLength as U8aFixedBitLength } from '../U8aFixed';
|
||||
import Vec from '../Vec';
|
||||
import VecFixed from '../VecFixed';
|
||||
import { ClassOf } from './createClass';
|
||||
import BTreeMap from '../codec/BTreeMap';
|
||||
import BTreeSet from '../codec/BTreeSet';
|
||||
import Compact from '../codec/Compact';
|
||||
import Enum from '../codec/Enum';
|
||||
import Option from '../codec/Option';
|
||||
import Result from '../codec/Result';
|
||||
import CodecSet from '../codec/Set';
|
||||
import Struct from '../codec/Struct';
|
||||
import Tuple from '../codec/Tuple';
|
||||
import U8aFixed, { BitLength as U8aFixedBitLength } from '../codec/U8aFixed';
|
||||
import Vec from '../codec/Vec';
|
||||
import VecFixed from '../codec/VecFixed';
|
||||
import { InterfaceRegistry } from '../interfaceRegistry';
|
||||
import { getTypeDef } from './getTypeDef';
|
||||
|
||||
export function createClass<T extends Codec = Codec, K extends string = string> (registry: Registry, type: K): Constructor<FromReg<T, K>> {
|
||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
return getTypeClass<FromReg<T, K>>(registry, getTypeDef(type));
|
||||
}
|
||||
|
||||
// An unsafe version of the `createType` below. It's unsafe because the `type`
|
||||
// argument here can be any string, which, if it cannot be parsed, it will yield
|
||||
// a runtime error.
|
||||
export function ClassOfUnsafe<T extends Codec = Codec, K extends string = string> (registry: Registry, name: K): Constructor<FromReg<T, K>> {
|
||||
return createClass<T, K>(registry, name);
|
||||
}
|
||||
|
||||
// alias for createClass
|
||||
export function ClassOf<K extends InterfaceTypes> (registry: Registry, name: K): Constructor<InterfaceRegistry[K]> {
|
||||
// TS2589: Type instantiation is excessively deep and possibly infinite.
|
||||
// The above happens with as Constructor<InterfaceRegistry[K]>;
|
||||
return ClassOfUnsafe<Codec, K>(registry, name) as any;
|
||||
}
|
||||
|
||||
function getSubDefArray (value: TypeDef): TypeDef[] {
|
||||
assert(value.sub && Array.isArray(value.sub), `Expected subtype as TypeDef[] in ${JSON.stringify(value)}`);
|
||||
+1
-1
@@ -2,8 +2,8 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import CodecSet from '../codec/Set';
|
||||
import { createClass, createType, createTypeUnsafe, ClassOf, TypeRegistry } from '.';
|
||||
import CodecSet from '../Set';
|
||||
|
||||
describe('createType', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
+2
-2
@@ -2,12 +2,12 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Codec, Constructor, InterfaceTypes, Registry } from '../../types';
|
||||
import { Codec, Constructor, InterfaceTypes, Registry } from '../types';
|
||||
import { FromReg } from './types';
|
||||
|
||||
import { isU8a, u8aToHex } from '@polkadot/util';
|
||||
|
||||
import { InterfaceRegistry } from '../../interfaceRegistry';
|
||||
import { InterfaceRegistry } from '../interfaceRegistry';
|
||||
import { createClass } from './createClass';
|
||||
|
||||
function u8aHasValue (value: Uint8Array): boolean {
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { TypeDef, TypeDefInfo } from '../types';
|
||||
import { TypeDef, TypeDefInfo } from './types';
|
||||
|
||||
import { getTypeDef } from '.';
|
||||
|
||||
@@ -6,7 +6,6 @@ import { createType } from './createType';
|
||||
|
||||
export * from './createClass';
|
||||
export * from './createType';
|
||||
export * from './getTypeClass';
|
||||
export * from './getTypeDef';
|
||||
export * from './registry';
|
||||
export * from './typeSplit';
|
||||
+4
-4
@@ -2,12 +2,12 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Constructor } from '../../types';
|
||||
import { Constructor } from '../types';
|
||||
|
||||
import Struct from '../codec/Struct';
|
||||
import Text from '../primitive/Text';
|
||||
import U32 from '../primitive/U32';
|
||||
import { TypeRegistry } from './registry';
|
||||
import Struct from '../Struct';
|
||||
import Text from '../../primitive/Text';
|
||||
import U32 from '../../primitive/U32';
|
||||
|
||||
// Copied from interfacesTs
|
||||
function isChildClass (Parent: Constructor<any>, Child?: Constructor<any>): boolean {
|
||||
@@ -3,17 +3,16 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { ChainProperties, DispatchErrorModule } from '../../interfaces/types';
|
||||
import { CallFunction, Codec, Constructor, InterfaceTypes, RegistryError, RegistryTypes, Registry, RegistryMetadata, TypeDef } from '../../types';
|
||||
import { ChainProperties, DispatchErrorModule } from '../interfaces/types';
|
||||
import { CallFunction, Codec, Constructor, InterfaceTypes, RegistryError, RegistryTypes, Registry, RegistryMetadata, TypeDef } from '../types';
|
||||
|
||||
import extrinsicsFromMeta from '@polkadot/metadata/Decorated/extrinsics/fromMetadata';
|
||||
import { assert, isFunction, isString, isU8a, isUndefined, stringCamelCase, u8aToHex } from '@polkadot/util';
|
||||
|
||||
import Raw from '../Raw';
|
||||
import { EventData } from '../../primitive/Generic/Event';
|
||||
import { defaultExtensions, expandExtensionTypes, findUnknownExtensions } from '../../primitive/Extrinsic/signedExtensions';
|
||||
import { createClass } from './createClass';
|
||||
import { getTypeClass } from './getTypeClass';
|
||||
import Raw from '../codec/Raw';
|
||||
import { EventData } from '../primitive/Generic/Event';
|
||||
import { defaultExtensions, expandExtensionTypes, findUnknownExtensions } from '../primitive/Extrinsic/signedExtensions';
|
||||
import { createClass, getTypeClass } from './createClass';
|
||||
import { getTypeDef } from './getTypeDef';
|
||||
|
||||
// create error mapping from metadata
|
||||
@@ -95,8 +94,8 @@ export class TypeRegistry implements Registry {
|
||||
// we only want to import these on creation, i.e. we want to avoid types
|
||||
// weird side-effects from circular references. (Since registry is injected
|
||||
// into types, this can be a real concern now)
|
||||
const baseTypes: RegistryTypes = require('../../index.types');
|
||||
const definitions: Record<string, { types: RegistryTypes }> = require('../../interfaces/definitions');
|
||||
const baseTypes: RegistryTypes = require('../index.types');
|
||||
const definitions: Record<string, { types: RegistryTypes }> = require('../interfaces/definitions');
|
||||
|
||||
// since these are classes, they are injected first
|
||||
this.register({ Raw, ...baseTypes });
|
||||
@@ -2,9 +2,9 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Codec, InterfaceTypes } from '../../types';
|
||||
import { Codec, InterfaceTypes } from '../types';
|
||||
|
||||
import { InterfaceRegistry } from '../../interfaceRegistry';
|
||||
import { InterfaceRegistry } from '../interfaceRegistry';
|
||||
|
||||
// Type which says: if `K` is in the InterfaceRegistry, then return InterfaceRegistry[K], else fallback to T
|
||||
export type FromReg<T extends Codec, K extends string> = K extends InterfaceTypes
|
||||
@@ -5,7 +5,7 @@
|
||||
import Metadata from '@polkadot/metadata/Metadata';
|
||||
import metadataStatic from '@polkadot/metadata/Metadata/static';
|
||||
|
||||
import { createTypeUnsafe, TypeRegistry } from './codec/create';
|
||||
import { createTypeUnsafe, TypeRegistry } from './create';
|
||||
import { Codec } from './types';
|
||||
import * as exported from './index.types';
|
||||
import * as definitions from './interfaces/definitions';
|
||||
|
||||
@@ -13,6 +13,7 @@ try {
|
||||
}
|
||||
|
||||
export * from './codec';
|
||||
export * from './create';
|
||||
export * from './index.types';
|
||||
|
||||
// FIXME We actually don't want to do this (if needed, it certainly is not in the right place)
|
||||
|
||||
@@ -2,8 +2,5 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
/**
|
||||
* @summary Type definitions that are used in the system
|
||||
*/
|
||||
export { default as Metadata } from '@polkadot/metadata/Metadata';
|
||||
export * from './primitive';
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { TypeRegistry, createType } from '../../codec/create';
|
||||
import { TypeRegistry, createType } from '../../create';
|
||||
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { createType, TypeRegistry } from '../../codec/create';
|
||||
import { createType, TypeRegistry } from '../../create';
|
||||
|
||||
describe('ChainProperties', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import { ExtrinsicStatus } from './types';
|
||||
|
||||
import { createType, TypeRegistry } from '../../codec/create';
|
||||
import { createType, TypeRegistry } from '../../create';
|
||||
import rpc from '../../json/ExtrinsicStatus.001.json';
|
||||
|
||||
describe('ExtrinsicStatus', (): void => {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { createType, TypeRegistry } from '../../codec/create';
|
||||
import { createType, TypeRegistry } from '../../create';
|
||||
|
||||
describe('KeyValueOption', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import { RuntimeVersion } from './types';
|
||||
|
||||
import { createType, TypeRegistry } from '../../codec/create';
|
||||
import { createType, TypeRegistry } from '../../create';
|
||||
import rpc from '../../json/RuntimeVersion.002.json';
|
||||
|
||||
describe('RuntimeVersion', (): void => {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import { hexToU8a } from '@polkadot/util';
|
||||
|
||||
import { createType, TypeRegistry } from '../../codec/create';
|
||||
import { createType, TypeRegistry } from '../../create';
|
||||
|
||||
const TESTS = [
|
||||
'0x55bd020bdbbdc02de34e915effc9b18a99002f4c29f64e22e8dcbb69e722ea6c28e1bb53b9484063fbbfd205e49dcc1f620929f520c9c4c3695150f05a28f52a01',
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import BN from 'bn.js';
|
||||
|
||||
import { createType, TypeRegistry } from '../../codec/create';
|
||||
import { createType, TypeRegistry } from '../../create';
|
||||
import json1 from '../../json/Header.001.json';
|
||||
import json2 from '../../json/Header.002.json';
|
||||
import json3 from '../../json/Header.003.json';
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { createType, TypeRegistry } from '../../codec/create';
|
||||
import { createType, TypeRegistry } from '../../create';
|
||||
|
||||
describe('KeyValue', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import Metadata from '@polkadot/metadata/Metadata';
|
||||
import metadataStatic from '@polkadot/metadata/Metadata/static';
|
||||
|
||||
import { createType, TypeRegistry } from '../../codec/create';
|
||||
import { createType, TypeRegistry } from '../../create';
|
||||
import events from '../../json/SignedBlock.002.json';
|
||||
import immortalTxs from '../../json/SignedBlock.004.immortal.json';
|
||||
import mortalTxs from '../../json/SignedBlock.004.mortal.json';
|
||||
|
||||
@@ -6,7 +6,7 @@ import Metadata from '@polkadot/metadata/Metadata';
|
||||
import rpcMetadataV0 from '@polkadot/metadata/Metadata/v0/static';
|
||||
import rpcMetadata from '@polkadot/metadata/Metadata/static';
|
||||
|
||||
import { createType, TypeRegistry } from '../../codec/create';
|
||||
import { createType, TypeRegistry } from '../../create';
|
||||
import json1 from '../../json/EventRecord.001.json';
|
||||
import json3 from '../../json/EventRecord.003.json';
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import { CodecTo } from '../types';
|
||||
|
||||
import { TypeRegistry } from '../codec';
|
||||
import { TypeRegistry } from '../create';
|
||||
import Bool from './Bool';
|
||||
|
||||
describe('Bool', (): void => {
|
||||
|
||||
@@ -7,7 +7,7 @@ import { Codec, IHash, Registry } from '../types';
|
||||
import { isU8a, u8aToHex } from '@polkadot/util';
|
||||
import { blake2AsU8a } from '@polkadot/util-crypto';
|
||||
|
||||
import { createType } from '../codec/create';
|
||||
import { createType } from '../create';
|
||||
|
||||
/** @internal */
|
||||
function decodeBool (value: any): boolean {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { createType, TypeRegistry } from '../codec/create';
|
||||
import { createType, TypeRegistry } from '../create';
|
||||
import Bytes from './Bytes';
|
||||
|
||||
describe('Bytes', (): void => {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { TypeRegistry } from '../codec/create';
|
||||
import { TypeRegistry } from '../create';
|
||||
import Data from './Data';
|
||||
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
@@ -7,7 +7,7 @@ import { Registry } from '../types';
|
||||
import { isString, isU8a, u8aToU8a } from '@polkadot/util';
|
||||
|
||||
import Enum from '../codec/Enum';
|
||||
import { createType } from '../codec/create/createType';
|
||||
import { createType } from '../create/createType';
|
||||
import Bytes from './Bytes';
|
||||
import H256 from './H256';
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import Metadata from '@polkadot/metadata/Metadata';
|
||||
import rpcMetadata from '@polkadot/metadata/Metadata/static';
|
||||
import { hexToU8a } from '@polkadot/util';
|
||||
|
||||
import { TypeRegistry } from '../../codec';
|
||||
import { TypeRegistry } from '../../create';
|
||||
import Extrinsic from './Extrinsic';
|
||||
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
@@ -8,7 +8,7 @@ import { AnyU8a, ArgsDef, Codec, ExtrinsicPayloadValue, IExtrinsic, IKeyringPair
|
||||
|
||||
import { assert, isHex, isU8a, u8aConcat, u8aToHex, u8aToU8a } from '@polkadot/util';
|
||||
|
||||
import { createType, ClassOf } from '../../codec/create';
|
||||
import { createType, ClassOf } from '../../create';
|
||||
import Base from '../../codec/Base';
|
||||
import Compact from '../../codec/Compact';
|
||||
import { ExtrinsicValueV1 } from './v1/Extrinsic';
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { TypeRegistry } from '../../codec';
|
||||
import { TypeRegistry } from '../../create';
|
||||
import ExtrinsicEra from './ExtrinsicEra';
|
||||
|
||||
describe('ExtrinsicEra', (): void => {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import { u8aToHex } from '@polkadot/util';
|
||||
|
||||
import { TypeRegistry } from '../../codec';
|
||||
import { TypeRegistry } from '../../create';
|
||||
import ExtrinsicPayload from './ExtrinsicPayload';
|
||||
|
||||
describe('ExtrinsicPayload', (): void => {
|
||||
|
||||
@@ -7,7 +7,7 @@ import { BareOpts, ExtrinsicPayloadValue, IKeyringPair, InterfaceTypes, Registry
|
||||
|
||||
import { u8aToHex } from '@polkadot/util';
|
||||
|
||||
import { createType } from '../../codec/create';
|
||||
import { createType } from '../../create';
|
||||
import Base from '../../codec/Base';
|
||||
import Compact from '../../codec/Compact';
|
||||
import Raw from '../../codec/Raw';
|
||||
|
||||
@@ -2,12 +2,10 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { createType } from '@polkadot/types';
|
||||
|
||||
import Metadata from '@polkadot/metadata/Metadata';
|
||||
import rpcMetadata from '@polkadot/metadata/Metadata/static';
|
||||
|
||||
import { TypeRegistry } from '../../codec';
|
||||
import { createType, TypeRegistry } from '../../create';
|
||||
import SignerPayload from './SignerPayload';
|
||||
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
@@ -6,7 +6,7 @@ import { u8aToHex } from '@polkadot/util';
|
||||
import { Address, Balance, BlockNumber, Call, ExtrinsicEra, Hash, Index, RuntimeVersion } from '../../interfaces';
|
||||
import Compact from '../../codec/Compact';
|
||||
import Struct from '../../codec/Struct';
|
||||
import { createType } from '../../codec';
|
||||
import { createType } from '../../create';
|
||||
import { Codec, Constructor, ISignerPayload, SignerPayloadJSON, SignerPayloadRaw } from '../../types';
|
||||
import u8 from '../U8';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import { ExtrinsicOptions } from '../types';
|
||||
|
||||
import { isU8a } from '@polkadot/util';
|
||||
|
||||
import { createType } from '../../../codec/create';
|
||||
import { createType } from '../../../create';
|
||||
import Struct from '../../../codec/Struct';
|
||||
|
||||
export interface ExtrinsicValueV1 {
|
||||
|
||||
@@ -6,7 +6,7 @@ import { Address, Balance, Call, ExtrinsicEra, Index, Signature } from '../../..
|
||||
import { ExtrinsicPayloadValue, IExtrinsicSignature, IKeyringPair, Registry, SignatureOptions } from '../../../types';
|
||||
import { ExtrinsicSignatureOptions } from '../types';
|
||||
|
||||
import { createType } from '../../../codec/create';
|
||||
import { createType } from '../../../create';
|
||||
import Compact from '../../../codec/Compact';
|
||||
import Struct from '../../../codec/Struct';
|
||||
import { EMPTY_U8A, IMMORTAL_ERA } from '../constants';
|
||||
|
||||
@@ -8,7 +8,7 @@ import Metadata from '@polkadot/metadata/Metadata';
|
||||
import rpcMetadata from '@polkadot/metadata/Metadata/static';
|
||||
import testingPairs from '@polkadot/keyring/testingPairs';
|
||||
|
||||
import { TypeRegistry } from '../../../codec';
|
||||
import { TypeRegistry } from '../../../create';
|
||||
import Extrinsic from './Extrinsic';
|
||||
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
@@ -8,7 +8,7 @@ import { ExtrinsicOptions } from '../types';
|
||||
|
||||
import { isU8a } from '@polkadot/util';
|
||||
|
||||
import { createType, ClassOf } from '../../../codec/create';
|
||||
import { createType, ClassOf } from '../../../create';
|
||||
import Struct from '../../../codec/Struct';
|
||||
|
||||
const TRANSACTION_VERSION = 2;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { TypeRegistry } from '../../../codec';
|
||||
import { TypeRegistry } from '../../../create';
|
||||
import ExtrinsicSignature from './ExtrinsicSignature';
|
||||
|
||||
describe('ExtrinsicSignatureV2', (): void => {
|
||||
|
||||
@@ -6,7 +6,7 @@ import { Address, Balance, Call, ExtrinsicEra, Index, Signature } from '../../..
|
||||
import { ExtrinsicPayloadValue, IExtrinsicSignature, IKeyringPair, Registry, SignatureOptions } from '../../../types';
|
||||
import { ExtrinsicSignatureOptions } from '../types';
|
||||
|
||||
import { createType } from '../../../codec/create';
|
||||
import { createType } from '../../../create';
|
||||
import Compact from '../../../codec/Compact';
|
||||
import Struct from '../../../codec/Struct';
|
||||
import { EMPTY_U8A, IMMORTAL_ERA } from '../constants';
|
||||
|
||||
@@ -8,7 +8,7 @@ import Metadata from '@polkadot/metadata/Metadata';
|
||||
import rpcMetadata from '@polkadot/metadata/Metadata/static';
|
||||
import testingPairs from '@polkadot/keyring/testingPairs';
|
||||
|
||||
import { TypeRegistry } from '../../../codec';
|
||||
import { TypeRegistry } from '../../../create';
|
||||
import Extrinsic from './Extrinsic';
|
||||
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
@@ -8,7 +8,7 @@ import { ExtrinsicOptions } from '../types';
|
||||
|
||||
import { isU8a } from '@polkadot/util';
|
||||
|
||||
import { createType, ClassOf } from '../../../codec/create';
|
||||
import { createType, ClassOf } from '../../../create';
|
||||
import Struct from '../../../codec/Struct';
|
||||
|
||||
const TRANSACTION_VERSION = 3;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user