Move primitive/Extrinsic -> extrinsic (#1905)

* Move primitive/Extrinsic -> extrinsic

* mv primitive/Generic -> generic

* Update registry with BitVec

* ove BitVec back to primitive

* Remove unused import

* Rebuild interfaces
This commit is contained in:
Jaco Greeff
2020-02-20 12:51:06 +01:00
committed by GitHub
parent e80bea6680
commit bec6dba14a
77 changed files with 202 additions and 180 deletions
@@ -8,7 +8,7 @@ import { ITuple } from '@polkadot/types/types';
import { Observable, of } from 'rxjs';
import { map, startWith } from 'rxjs/operators';
import { ApiInterfaceRx } from '@polkadot/api/types';
import { ENUMSET_SIZE } from '@polkadot/types/primitive/Generic/AccountIndex';
import { ENUMSET_SIZE } from '@polkadot/types/generic/AccountIndex';
import { ClassOf, Option, Vec, createType } from '@polkadot/types';
import { memo } from '../util';
+1 -1
View File
@@ -8,7 +8,7 @@ import { AccountIndexes } from '../types';
import { Observable, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { ENUMSET_SIZE } from '@polkadot/types/primitive/Generic/AccountIndex';
import { ENUMSET_SIZE } from '@polkadot/types/generic/AccountIndex';
import { Vec, createType } from '@polkadot/types';
import { memo } from '../util';
+1 -1
View File
@@ -20,7 +20,7 @@ import RpcCore from '@polkadot/rpc-core';
import { WsProvider } from '@polkadot/rpc-provider';
import { Metadata, Null, Option, Text, TypeRegistry, u64, Vec } from '@polkadot/types';
import Linkage, { LinkageResult } from '@polkadot/types/codec/Linkage';
import { DEFAULT_VERSION as EXTRINSIC_DEFAULT_VERSION } from '@polkadot/types/primitive/Extrinsic/constants';
import { DEFAULT_VERSION as EXTRINSIC_DEFAULT_VERSION } from '@polkadot/types/extrinsic/constants';
import StorageKey, { StorageEntry } from '@polkadot/types/primitive/StorageKey';
import { assert, compactStripLength, isNull, isUndefined, u8aConcat, u8aToHex } from '@polkadot/util';
+1 -1
View File
@@ -8,8 +8,8 @@ import { ApiBase, ApiOptions, ApiTypes, DecorateMethod } from '../types';
import { Subscription, combineLatest, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { Metadata, Text } from '@polkadot/types';
import { LATEST_EXTRINSIC_VERSION } from '@polkadot/types/extrinsic/Extrinsic';
import { getMetadataTypes, getSpecTypes, getUserTypes } from '@polkadot/types/known';
import { LATEST_EXTRINSIC_VERSION } from '@polkadot/types/primitive/Extrinsic/Extrinsic';
import { logger } from '@polkadot/util';
import { cryptoWaitReady } from '@polkadot/util-crypto';
+1 -1
View File
@@ -8,8 +8,8 @@ import fs from 'fs';
import interfaces from '@polkadot/jsonrpc';
import Decorated from '@polkadot/metadata/Decorated';
import rpcdata from '@polkadot/metadata/Metadata/static';
import Call from '@polkadot/types/generic/Call';
import { unwrapStorageType } from '@polkadot/types/primitive/StorageKey';
import Call from '@polkadot/types/primitive/Generic/Call';
import { TypeRegistry } from '@polkadot/types/create';
import { Vec } from '@polkadot/types/codec';
import { Text } from '@polkadot/types/primitive';
+3 -3
View File
@@ -14,9 +14,9 @@ import Enum from '@polkadot/types/codec/Enum';
import Option from '@polkadot/types/codec/Option';
import Struct from '@polkadot/types/codec/Struct';
import Vec from '@polkadot/types/codec/Vec';
import GenericAccountId from '@polkadot/types/primitive/Generic/AccountId';
import GenericAddress from '@polkadot/types/primitive/Generic/Address';
import Vote, { convictionNames as _voteConvictions } from '@polkadot/types/primitive/Generic/Vote';
import GenericAccountId from '@polkadot/types/generic/AccountId';
import GenericAddress from '@polkadot/types/generic/Address';
import Vote, { convictionNames as _voteConvictions } from '@polkadot/types/generic/Vote';
import Null from '@polkadot/types/primitive/Null';
import * as primitiveClasses from '@polkadot/types/primitive';
+8
View File
@@ -28,6 +28,14 @@ export function createImportCode (header: string, imports: TypeImports, checks:
.keys(imports.codecTypes)
.filter((name): boolean => name !== 'Tuple')
},
{
file: '@polkadot/types/extrinsic',
types: Object.keys(imports.extrinsicTypes)
},
{
file: '@polkadot/types/generic',
types: Object.keys(imports.genericTypes)
},
{
file: '@polkadot/types/primitive',
types: Object
+13 -3
View File
@@ -6,6 +6,8 @@ import { TypeDefInfo } from '@polkadot/types/create/types';
import * as codecClasses from '@polkadot/types/codec';
import { getTypeDef } from '@polkadot/types/create';
import * as extrinsicClasses from '@polkadot/types/extrinsic';
import * as genericClasses from '@polkadot/types/generic';
import * as primitiveClasses from '@polkadot/types/primitive';
// these map all the codec and primitive types for import, see the TypeImports below. If
@@ -18,8 +20,10 @@ type TypeExistMap = Record<string, TypeExist>;
export interface TypeImports {
codecTypes: TypeExist; // `import {} from '@polkadot/types/codec`
localTypes: TypeExistMap; // `import {} from '../something'`
extrinsicTypes: TypeExist; // `import {} from '@polkadot/types/extrinsic`
genericTypes: TypeExist; // `import {} from '@polkadot/types/generic`
ignoredTypes: string[]; // No need to import these types
localTypes: TypeExistMap; // `import {} from '../something'`
primitiveTypes: TypeExist; // `import {} from '@polkadot/types/primitive`
typesTypes: TypeExist; // `import {} from '@polkadot/types/types`
definitions: object; // all definitions
@@ -31,7 +35,7 @@ export interface TypeImports {
// imports in the output file, dep-duped and sorted
/** @internal */
export function setImports (allDefs: object, imports: TypeImports, types: string[]): void {
const { codecTypes, localTypes, ignoredTypes, primitiveTypes, typesTypes } = imports;
const { codecTypes, extrinsicTypes, genericTypes, ignoredTypes, localTypes, primitiveTypes, typesTypes } = imports;
types.forEach((type): void => {
if (ignoredTypes.includes(type)) {
@@ -40,6 +44,10 @@ export function setImports (allDefs: object, imports: TypeImports, types: string
typesTypes[type] = true;
} else if ((codecClasses as any)[type]) {
codecTypes[type] = true;
} else if ((extrinsicClasses as any)[type]) {
extrinsicTypes[type] = true;
} else if ((genericClasses as any)[type]) {
genericTypes[type] = true;
} else if ((primitiveClasses as any)[type] || type === 'Metadata') {
primitiveTypes[type] = true;
} else if (type.includes('<') || type.includes('(') || type.includes('[')) {
@@ -97,12 +105,14 @@ export function createImports (importDefinitions: Record<string, object>, { type
return {
codecTypes: {},
extrinsicTypes: {},
genericTypes: {},
ignoredTypes: Object.keys(types),
localTypes: Object.keys(definitions).reduce((local: Record<string, TypeExist>, mod): Record<string, TypeExist> => {
local[mod] = {};
return local;
}, {}),
ignoredTypes: Object.keys(types),
primitiveTypes: {},
typesTypes: {},
definitions,
+1 -1
View File
@@ -3,7 +3,7 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import { ClassOf, TypeRegistry } from '../create';
import AccountId from '../primitive/Generic/AccountId';
import AccountId from '../generic/AccountId';
import Text from '../primitive/Text';
import U32 from '../primitive/U32';
import { CodecTo } from '../types';
+1 -1
View File
@@ -9,7 +9,7 @@ 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 AccountId from '../generic/AccountId';
import Text from '../primitive/Text';
import Vec from './Vec';
import Tuple from './Tuple';
+2 -2
View File
@@ -10,8 +10,8 @@ import extrinsicsFromMeta from '@polkadot/metadata/Decorated/extrinsics/fromMeta
import { assert, formatBalance, isFunction, isString, isU8a, isUndefined, stringCamelCase, u8aToHex } from '@polkadot/util';
import Raw from '../codec/Raw';
import { EventData } from '../primitive/Generic/Event';
import { defaultExtensions, expandExtensionTypes, findUnknownExtensions } from '../primitive/Extrinsic/signedExtensions';
import { defaultExtensions, expandExtensionTypes, findUnknownExtensions } from '../extrinsic/signedExtensions';
import { EventData } from '../generic/Event';
import Unconstructable from '../primitive/Unconstructable';
import { createClass, getTypeClass } from './createClass';
import { getTypeDef } from './getTypeDef';
@@ -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 '../../create';
import { TypeRegistry } from '../create';
import Extrinsic from './Extrinsic';
const registry = new TypeRegistry();
@@ -2,15 +2,15 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { FunctionMetadataLatest } from '../../interfaces/metadata/types';
import { Address, Balance, Call, EcdsaSignature, Ed25519Signature, ExtrinsicUnknown, ExtrinsicV1, ExtrinsicV2, ExtrinsicV3, ExtrinsicV4, Index, Sr25519Signature } from '../../interfaces/runtime';
import { ArgsDef, AnyJsonObject, AnyU8a, Codec, ExtrinsicPayloadValue, IExtrinsic, IKeyringPair, InterfaceTypes, Registry, SignatureOptions } from '../../types';
import { FunctionMetadataLatest } from '../interfaces/metadata/types';
import { Address, Balance, Call, EcdsaSignature, Ed25519Signature, ExtrinsicUnknown, ExtrinsicV1, ExtrinsicV2, ExtrinsicV3, ExtrinsicV4, Index, Sr25519Signature } from '../interfaces/runtime';
import { ArgsDef, AnyJsonObject, AnyU8a, Codec, ExtrinsicPayloadValue, IExtrinsic, IKeyringPair, InterfaceTypes, Registry, SignatureOptions } from '../types';
import { assert, isHex, isU8a, u8aConcat, u8aToHex, u8aToU8a } from '@polkadot/util';
import { createType, ClassOf } from '../../create';
import Base from '../../codec/Base';
import Compact from '../../codec/Compact';
import { createType, ClassOf } from '../create';
import Base from '../codec/Base';
import Compact from '../codec/Compact';
import { ExtrinsicValueV1 } from './v1/Extrinsic';
import { ExtrinsicValueV2 } from './v2/Extrinsic';
import { ExtrinsicValueV3 } from './v3/Extrinsic';
@@ -89,7 +89,7 @@ export default class Extrinsic extends Base<ExtrinsicVx | ExtrinsicUnknown> impl
const [offset, length] = Compact.decodeU8a(value);
const total = offset + length.toNumber();
assert(total <= value.length, `Extrinsic: required length less than remainder, expected at least ${total}, found ${value.length}`);
assert(total <= value.length, `Extrinsic: length less than remainder, expected at least ${total}, found ${value.length}`);
const data = value.subarray(offset, total);
@@ -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 ExtrinsicEra from './ExtrinsicEra';
describe('ExtrinsicEra', (): void => {
@@ -2,15 +2,15 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { AnyU8a, IExtrinsicEra, Registry } from '../../types';
import { AnyU8a, IExtrinsicEra, Registry } from '../types';
import BN from 'bn.js';
import { assert, bnToBn, formatNumber, hexToU8a, isHex, isU8a, isObject, u8aToBn } from '@polkadot/util';
import Enum from '../../codec/Enum';
import Tuple from '../../codec/Tuple';
import Raw from '../../codec/Raw';
import U64 from '../U64';
import Enum from '../codec/Enum';
import Tuple from '../codec/Tuple';
import Raw from '../codec/Raw';
import U64 from '../primitive/U64';
import { IMMORTAL_ERA } from './constants';
type MortalEraValue = [U64, U64];
@@ -4,7 +4,7 @@
import { u8aToHex } from '@polkadot/util';
import { TypeRegistry } from '../../create';
import { TypeRegistry } from '../create';
import ExtrinsicPayload from './ExtrinsicPayload';
describe('ExtrinsicPayload', (): void => {
@@ -2,16 +2,16 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { Balance, ExtrinsicPayloadV1, ExtrinsicPayloadV2, ExtrinsicPayloadV3, ExtrinsicPayloadV4, Hash, Index } from '../../interfaces/runtime';
import { AnyJsonObject, BareOpts, ExtrinsicPayloadValue, IKeyringPair, InterfaceTypes, Registry } from '../../types';
import { Balance, ExtrinsicPayloadV1, ExtrinsicPayloadV2, ExtrinsicPayloadV3, ExtrinsicPayloadV4, Hash, Index } from '../interfaces/runtime';
import { AnyJsonObject, BareOpts, ExtrinsicPayloadValue, IKeyringPair, InterfaceTypes, Registry } from '../types';
import { u8aToHex } from '@polkadot/util';
import { createType } from '../../create';
import Base from '../../codec/Base';
import Compact from '../../codec/Compact';
import Raw from '../../codec/Raw';
import u32 from '../../primitive/U32';
import { createType } from '../create';
import Base from '../codec/Base';
import Compact from '../codec/Compact';
import Raw from '../codec/Raw';
import u32 from '../primitive/U32';
import ExtrinsicEra from './ExtrinsicEra';
import { DEFAULT_VERSION } from './constants';
@@ -2,10 +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 { Registry } from '../../types';
import { Registry } from '../types';
import { ExtrinsicPayloadOptions } from './types';
import Struct from '../../codec/Struct';
import Struct from '../codec/Struct';
/**
* @name GenericExtrinsicPayloadUnknown
@@ -2,10 +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 { Registry } from '../../types';
import { Registry } from '../types';
import { ExtrinsicOptions } from './types';
import Struct from '../../codec/Struct';
import Struct from '../codec/Struct';
import { UNMASK_VERSION } from './constants';
/**
@@ -5,7 +5,7 @@
import Metadata from '@polkadot/metadata/Metadata';
import rpcMetadata from '@polkadot/metadata/Metadata/static';
import { createType, TypeRegistry } from '../../create';
import { createType, TypeRegistry } from '../create';
import SignerPayload from './SignerPayload';
const registry = new TypeRegistry();
@@ -2,13 +2,15 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { Address, Balance, BlockNumber, Call, ExtrinsicEra, Hash, Index, RuntimeVersion } from '../interfaces';
import { Codec, Constructor, ISignerPayload, SignerPayloadJSON, SignerPayloadRaw } from '../types';
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 '../../create';
import { Codec, Constructor, ISignerPayload, SignerPayloadJSON, SignerPayloadRaw } from '../../types';
import u8 from '../U8';
import { createType } from '../create';
import Compact from '../codec/Compact';
import Struct from '../codec/Struct';
import u8 from '../primitive/U8';
export interface SignerPayloadType extends Codec {
address: Address;
@@ -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 { InterfaceTypes } from '../../../types';
import { InterfaceTypes } from '../../types';
export type ExtTypes = Record<string, InterfaceTypes>;
@@ -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 { AnyNumber } from '../../types';
import { AnyNumber } from '../types';
export interface ExtrinsicOptions {
isSigned: boolean;
@@ -3,7 +3,7 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import { SignOptions } from '@polkadot/keyring/types';
import { IKeyringPair } from '../../types';
import { IKeyringPair } from '../types';
import { blake2AsU8a } from '@polkadot/util-crypto';
@@ -2,14 +2,14 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { Address, Call, ExtrinsicSignatureV1 } from '../../../interfaces/runtime';
import { ExtrinsicPayloadValue, IExtrinsicImpl, IKeyringPair, Registry, SignatureOptions } from '../../../types';
import { Address, Call, ExtrinsicSignatureV1 } from '../../interfaces/runtime';
import { ExtrinsicPayloadValue, IExtrinsicImpl, IKeyringPair, Registry, SignatureOptions } from '../../types';
import { ExtrinsicOptions } from '../types';
import { isU8a } from '@polkadot/util';
import { createType } from '../../../create';
import Struct from '../../../codec/Struct';
import { createType } from '../../create';
import Struct from '../../codec/Struct';
export interface ExtrinsicValueV1 {
method?: Call;
@@ -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 { Hash, ExtrinsicEra, Index } from '../../../interfaces/runtime';
import { ExtrinsicPayloadValue, IKeyringPair, Registry } from '../../../types';
import { Hash, ExtrinsicEra, Index } from '../../interfaces/runtime';
import { ExtrinsicPayloadValue, IKeyringPair, Registry } from '../../types';
import Compact from '../../../codec/Compact';
import Struct from '../../../codec/Struct';
import Bytes from '../../../primitive/Bytes';
import Compact from '../../codec/Compact';
import Struct from '../../codec/Struct';
import Bytes from '../../primitive/Bytes';
import { sign } from '../util';
/**
@@ -2,13 +2,13 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { Address, Balance, Call, ExtrinsicEra, Index, Signature } from '../../../interfaces/runtime';
import { ExtrinsicPayloadValue, IExtrinsicSignature, IKeyringPair, Registry, SignatureOptions } from '../../../types';
import { Address, Balance, Call, ExtrinsicEra, Index, Signature } from '../../interfaces/runtime';
import { ExtrinsicPayloadValue, IExtrinsicSignature, IKeyringPair, Registry, SignatureOptions } from '../../types';
import { ExtrinsicSignatureOptions } from '../types';
import { createType } from '../../../create';
import Compact from '../../../codec/Compact';
import Struct from '../../../codec/Struct';
import { createType } from '../../create';
import Compact from '../../codec/Compact';
import Struct from '../../codec/Struct';
import { EMPTY_U8A, IMMORTAL_ERA } from '../constants';
import ExtrinsicPayloadV1 from './ExtrinsicPayload';
@@ -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 '../../../create';
import { TypeRegistry } from '../../create';
import Extrinsic from './Extrinsic';
const registry = new TypeRegistry();
@@ -2,14 +2,14 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { Address, Call, ExtrinsicSignatureV2 } from '../../../interfaces/runtime';
import { ExtrinsicPayloadValue, IExtrinsicImpl, IKeyringPair, Registry, SignatureOptions } from '../../../types';
import { Address, Call, ExtrinsicSignatureV2 } from '../../interfaces/runtime';
import { ExtrinsicPayloadValue, IExtrinsicImpl, IKeyringPair, Registry, SignatureOptions } from '../../types';
import { ExtrinsicOptions } from '../types';
import { isU8a } from '@polkadot/util';
import { createType, ClassOf } from '../../../create';
import Struct from '../../../codec/Struct';
import { createType, ClassOf } from '../../create';
import Struct from '../../codec/Struct';
const TRANSACTION_VERSION = 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 { Balance, ExtrinsicEra, Hash, Index } from '../../../interfaces/runtime';
import { ExtrinsicPayloadValue, IKeyringPair, Registry } from '../../../types';
import { Balance, ExtrinsicEra, Hash, Index } from '../../interfaces/runtime';
import { ExtrinsicPayloadValue, IKeyringPair, Registry } from '../../types';
import Compact from '../../../codec/Compact';
import Struct from '../../../codec/Struct';
import Bytes from '../../../primitive/Bytes';
import Compact from '../../codec/Compact';
import Struct from '../../codec/Struct';
import Bytes from '../../primitive/Bytes';
import { sign } from '../util';
/**
@@ -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 ExtrinsicSignature from './ExtrinsicSignature';
describe('ExtrinsicSignatureV2', (): void => {
@@ -2,13 +2,13 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { Address, Balance, Call, ExtrinsicEra, Index, Signature } from '../../../interfaces/runtime';
import { ExtrinsicPayloadValue, IExtrinsicSignature, IKeyringPair, Registry, SignatureOptions } from '../../../types';
import { Address, Balance, Call, ExtrinsicEra, Index, Signature } from '../../interfaces/runtime';
import { ExtrinsicPayloadValue, IExtrinsicSignature, IKeyringPair, Registry, SignatureOptions } from '../../types';
import { ExtrinsicSignatureOptions } from '../types';
import { createType } from '../../../create';
import Compact from '../../../codec/Compact';
import Struct from '../../../codec/Struct';
import { createType } from '../../create';
import Compact from '../../codec/Compact';
import Struct from '../../codec/Struct';
import { EMPTY_U8A, IMMORTAL_ERA } from '../constants';
import ExtrinsicPayloadV2 from './ExtrinsicPayload';
@@ -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 '../../../create';
import { TypeRegistry } from '../../create';
import Extrinsic from './Extrinsic';
const registry = new TypeRegistry();
@@ -2,14 +2,14 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { Address, Call, ExtrinsicSignatureV3 } from '../../../interfaces/runtime';
import { ExtrinsicPayloadValue, IExtrinsicImpl, IKeyringPair, Registry, SignatureOptions } from '../../../types';
import { Address, Call, ExtrinsicSignatureV3 } from '../../interfaces/runtime';
import { ExtrinsicPayloadValue, IExtrinsicImpl, IKeyringPair, Registry, SignatureOptions } from '../../types';
import { ExtrinsicOptions } from '../types';
import { isU8a } from '@polkadot/util';
import { createType, ClassOf } from '../../../create';
import Struct from '../../../codec/Struct';
import { createType, ClassOf } from '../../create';
import Struct from '../../codec/Struct';
const TRANSACTION_VERSION = 3;
@@ -2,13 +2,13 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { Balance, ExtrinsicEra, Hash, Index } from '../../../interfaces/runtime';
import { ExtrinsicPayloadValue, IKeyringPair, Registry } from '../../../types';
import { Balance, ExtrinsicEra, Hash, Index } from '../../interfaces/runtime';
import { ExtrinsicPayloadValue, IKeyringPair, Registry } from '../../types';
import Compact from '../../../codec/Compact';
import Struct from '../../../codec/Struct';
import Bytes from '../../../primitive/Bytes';
import u32 from '../../../primitive/U32';
import Compact from '../../codec/Compact';
import Struct from '../../codec/Struct';
import Bytes from '../../primitive/Bytes';
import u32 from '../../primitive/U32';
import { sign } from '../util';
/**
@@ -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 ExtrinsicSignature from './ExtrinsicSignature';
describe('ExtrinsicSignatureV3', (): void => {
@@ -2,10 +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 { Address, Call } from '../../../interfaces/runtime';
import { ExtrinsicPayloadValue, IExtrinsicSignature, IKeyringPair, SignatureOptions } from '../../../types';
import { Address, Call } from '../../interfaces/runtime';
import { ExtrinsicPayloadValue, IExtrinsicSignature, IKeyringPair, SignatureOptions } from '../../types';
import { createType } from '../../../create';
import { createType } from '../../create';
import { IMMORTAL_ERA } from '../constants';
import ExtrinsicSignatureV2 from '../v2/ExtrinsicSignature';
import ExtrinsicPayloadV3 from './ExtrinsicPayload';
@@ -8,7 +8,7 @@ import Decorated from '@polkadot/metadata/Decorated';
import Metadata from '@polkadot/metadata/Metadata';
import metadataStatic from '@polkadot/metadata/Metadata/static';
import { TypeRegistry } from '../../../create';
import { TypeRegistry } from '../../create';
import Extrinsic from './Extrinsic';
const registry = new TypeRegistry();
@@ -2,14 +2,14 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { Address, Call, ExtrinsicSignatureV4 } from '../../../interfaces/runtime';
import { ExtrinsicPayloadValue, IExtrinsicImpl, IKeyringPair, Registry, SignatureOptions } from '../../../types';
import { Address, Call, ExtrinsicSignatureV4 } from '../../interfaces/runtime';
import { ExtrinsicPayloadValue, IExtrinsicImpl, IKeyringPair, Registry, SignatureOptions } from '../../types';
import { ExtrinsicOptions } from '../types';
import { isU8a } from '@polkadot/util';
import { createType, ClassOf } from '../../../create';
import Struct from '../../../codec/Struct';
import { createType, ClassOf } from '../../create';
import Struct from '../../codec/Struct';
export const TRANSACTION_VERSION = 4;
@@ -2,13 +2,13 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { Balance, ExtrinsicEra, Hash, Index } from '../../../interfaces/runtime';
import { ExtrinsicPayloadValue, IKeyringPair, Registry } from '../../../types';
import { Balance, ExtrinsicEra, Hash, Index } from '../../interfaces/runtime';
import { ExtrinsicPayloadValue, IKeyringPair, Registry } from '../../types';
import Compact from '../../../codec/Compact';
import Struct from '../../../codec/Struct';
import Bytes from '../../../primitive/Bytes';
import u32 from '../../../primitive/U32';
import Compact from '../../codec/Compact';
import Struct from '../../codec/Struct';
import Bytes from '../../primitive/Bytes';
import u32 from '../../primitive/U32';
import { sign } from '../util';
/**
@@ -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 ExtrinsicSignature from './ExtrinsicSignature';
describe('ExtrinsicSignatureV4', (): void => {
@@ -2,15 +2,15 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { Address, Balance, Call, EcdsaSignature, Ed25519Signature, ExtrinsicEra, Index, MultiSignature, Sr25519Signature } from '../../../interfaces/runtime';
import { ExtrinsicPayloadValue, IExtrinsicSignature, IKeyringPair, Registry, SignatureOptions } from '../../../types';
import { Address, Balance, Call, EcdsaSignature, Ed25519Signature, ExtrinsicEra, Index, MultiSignature, Sr25519Signature } from '../../interfaces/runtime';
import { ExtrinsicPayloadValue, IExtrinsicSignature, IKeyringPair, Registry, SignatureOptions } from '../../types';
import { ExtrinsicSignatureOptions } from '../types';
import { u8aConcat } from '@polkadot/util';
import { createType } from '../../../create';
import Compact from '../../../codec/Compact';
import Struct from '../../../codec/Struct';
import { createType } from '../../create';
import Compact from '../../codec/Compact';
import Struct from '../../codec/Struct';
import { EMPTY_U8A, IMMORTAL_ERA } from '../constants';
import ExtrinsicPayloadV4 from './ExtrinsicPayload';
@@ -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 { createType, TypeRegistry } from '../../create';
import Raw from '../../codec/Raw';
import jsonVec from '../../json/AccountIdVec.001.json';
import { createType, TypeRegistry } from '../create';
import Raw from '../codec/Raw';
import jsonVec from '../json/AccountIdVec.001.json';
import AccountId from './AccountId';
describe('AccountId', (): void => {
@@ -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 { AnyString, AnyU8a, Registry } from '../../types';
import { AnyString, AnyU8a, Registry } from '../types';
import { hexToU8a, isHex, isString, isU8a, u8aToU8a } from '@polkadot/util';
import { decodeAddress, encodeAddress } from '@polkadot/util-crypto';
import U8aFixed from '../../codec/U8aFixed';
import U8aFixed from '../codec/U8aFixed';
/** @internal */
function decodeAccountId (value: AnyU8a | AnyString): Uint8Array {
@@ -4,7 +4,7 @@
import BN from 'bn.js';
import { createType, TypeRegistry } from '../../create';
import { createType, TypeRegistry } from '../create';
import AccountIndex from './AccountIndex';
describe('AccountIndex', (): void => {
@@ -2,14 +2,14 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { AnyNumber, Registry } from '../../types';
import { AnyNumber, Registry } from '../types';
import BN from 'bn.js';
import { bnToBn, isBn, isNumber, isU8a, isHex } from '@polkadot/util';
import { decodeAddress, encodeAddress } from '@polkadot/util-crypto';
import { createType } from '../../create';
import U32 from '../U32';
import { createType } from '../create';
import U32 from '../primitive/U32';
export const ENUMSET_SIZE = new BN(64);
@@ -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 '../../create';
import { createType, TypeRegistry } from '../create';
import AccountId from './AccountId';
import AccountIndex from './AccountIndex';
import Address from './Address';
@@ -2,14 +2,14 @@
// 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 '../../types';
import { Registry } from '../types';
import BN from 'bn.js';
import { isBn, isHex, isNumber, isU8a, u8aConcat, u8aToHex, u8aToU8a, u8aToBn } from '@polkadot/util';
import { decodeAddress } from '@polkadot/util-crypto';
import { createType } from '../../create';
import Base from '../../codec/Base';
import { createType } from '../create';
import Base from '../codec/Base';
import AccountId from './AccountId';
import AccountIndex from './AccountIndex';
@@ -5,8 +5,8 @@
import Metadata from '@polkadot/metadata/Metadata';
import metadataStatic from '@polkadot/metadata/Metadata/static';
import { TypeRegistry } from '../../create';
import block00300 from '../../json/SignedBlock.003.00.json';
import { TypeRegistry } from '../create';
import block00300 from '../json/SignedBlock.003.00.json';
import Block from './Block';
const registry = new TypeRegistry();
@@ -2,15 +2,15 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { Digest, DigestItem, H256, Header } from '../../interfaces/runtime';
import { AnyNumber, AnyU8a, Registry } from '../../types';
import { Digest, DigestItem, H256, Header } from '../interfaces/runtime';
import { AnyNumber, AnyU8a, Registry } from '../types';
import { blake2AsU8a } from '@polkadot/util-crypto';
import { createType } from '../../create';
import Extrinsic from '../Extrinsic/Extrinsic';
import Struct from '../../codec/Struct';
import Vec from '../../codec/Vec';
import { createType } from '../create';
import Extrinsic from '../extrinsic/Extrinsic';
import Struct from '../codec/Struct';
import Vec from '../codec/Vec';
export interface HeaderValue {
digest?: Digest | { logs: DigestItem[] };
@@ -5,7 +5,7 @@
import Metadata from '@polkadot/metadata/Metadata';
import metadataStatic from '@polkadot/metadata/Metadata/static';
import { TypeRegistry } from '../../create';
import { TypeRegistry } from '../create';
import Call from './Call';
const registry = new TypeRegistry();
@@ -2,14 +2,14 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { FunctionArgumentMetadataLatest, FunctionMetadataLatest } from '../../interfaces/metadata';
import { AnyJsonObject, AnyU8a, ArgsDef, CallFunction, Codec, IMethod, Registry } from '../../types';
import { FunctionArgumentMetadataLatest, FunctionMetadataLatest } from '../interfaces/metadata';
import { AnyJsonObject, AnyU8a, ArgsDef, CallFunction, Codec, IMethod, Registry } from '../types';
import { isHex, isObject, isU8a, u8aToHex, u8aToU8a } from '@polkadot/util';
import { getTypeDef, getTypeClass } from '../../create';
import Struct from '../../codec/Struct';
import U8aFixed from '../../codec/U8aFixed';
import { getTypeDef, getTypeClass } from '../create';
import Struct from '../codec/Struct';
import U8aFixed from '../codec/U8aFixed';
interface DecodeMethodInput {
args: any;
@@ -2,14 +2,14 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { AccountId } from '../../interfaces/runtime';
import { AccountId } from '../interfaces/runtime';
import BN from 'bn.js';
import { bnToBn } from '@polkadot/util';
import { createType } from '../../create';
import Bytes from '../Bytes';
import U32 from '../U32';
import { createType } from '../create';
import Bytes from '../primitive/Bytes';
import U32 from '../primitive/U32';
const CID_AURA = 0x61727561; // 'aura'
const CID_BABE = 0x45424142; // 'BABE'
@@ -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 { TypeRegistry } from '../../create';
import json3 from '../../json/Header.003.json';
import block1 from '../../json/SignedBlock.003.00.json';
import { TypeRegistry } from '../create';
import json3 from '../json/Header.003.json';
import block1 from '../json/SignedBlock.003.00.json';
import Digest from './Digest';
describe('Digest', (): void => {
@@ -2,11 +2,11 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { DigestItem } from '../../interfaces/runtime';
import { Registry, AnyJsonObject } from '../../types';
import { DigestItem } from '../interfaces/runtime';
import { Registry, AnyJsonObject } from '../types';
import Struct from '../../codec/Struct';
import Vec from '../../codec/Vec';
import Struct from '../codec/Struct';
import Vec from '../codec/Vec';
/**
* @name Digest
@@ -2,14 +2,14 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { TypeDef } from '../../create/types';
import { EventMetadataLatest } from '../../interfaces/metadata';
import { EventId } from '../../interfaces/system';
import { AnyJsonObject, Constructor, Registry, RegistryMetadataEvent } from '../../types';
import { TypeDef } from '../create/types';
import { EventMetadataLatest } from '../interfaces/metadata';
import { EventId } from '../interfaces/system';
import { AnyJsonObject, Constructor, Registry, RegistryMetadataEvent } from '../types';
import Struct from '../../codec/Struct';
import Tuple from '../../codec/Tuple';
import Null from '../Null';
import Struct from '../codec/Struct';
import Tuple from '../codec/Tuple';
import Null from '../primitive/Null';
/**
* @name EventData
@@ -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 Origin from './Origin';
describe('Origin', (): void => {
@@ -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 { Registry } from '../../types';
import { Registry } from '../types';
import Null from '../Null';
import Null from '../primitive/Null';
/**
* @name Origin
@@ -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 Vote from './Vote';
describe('Vote', (): void => {
@@ -2,15 +2,15 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { AnyJsonObject, ArrayElementType, Registry } from '../../types';
import democracyDef from '../../interfaces/democracy/definitions';
import { Conviction } from '../../interfaces/democracy';
import { AnyJsonObject, ArrayElementType, Registry } from '../types';
import democracyDef from '../interfaces/democracy/definitions';
import { Conviction } from '../interfaces/democracy';
import { isBoolean, isNumber, isU8a, isUndefined } from '@polkadot/util';
import { createType } from '../../create';
import U8aFixed from '../../codec/U8aFixed';
import Bool from '../Bool';
import { createType } from '../create';
import U8aFixed from '../codec/U8aFixed';
import Bool from '../primitive/Bool';
export const convictionNames = democracyDef.types.Conviction._enum;
+3
View File
@@ -3,4 +3,7 @@
// of the Apache-2.0 license. See the LICENSE file for details.
export { default as Metadata } from '@polkadot/metadata/Metadata';
export * from './extrinsic';
export * from './generic';
export * from './primitive';
+3 -5
View File
@@ -37,12 +37,12 @@ import { CallMetadataV0, DoubleMapTypeLatest, DoubleMapTypeV10, DoubleMapTypeV11
import { ApiId, BlockHash, ChainProperties, ExtrinsicOrHash, ExtrinsicStatus, Health, KeyValueOption, NetworkState, PeerInfo, RpcMethods, RuntimeDispatchInfo, RuntimeVersion, RuntimeVersionApi, StorageChangeSet } from '@polkadot/types/interfaces/rpc';
export interface InterfaceRegistry {
bool: bool;
'Option<bool>': Option<bool>;
'Vec<bool>': Vec<bool>;
BitVec: BitVec;
'Option<BitVec>': Option<BitVec>;
'Vec<BitVec>': Vec<BitVec>;
bool: bool;
'Option<bool>': Option<bool>;
'Vec<bool>': Vec<bool>;
Bytes: Bytes;
'Option<Bytes>': Option<Bytes>;
'Vec<Bytes>': Vec<Bytes>;
@@ -184,7 +184,6 @@ export interface InterfaceRegistry {
'Option<AccountIdOf>': Option<AccountIdOf>;
'Vec<AccountIdOf>': Vec<AccountIdOf>;
AccountIndex: AccountIndex;
'Compact<AccountIndex>': Compact<AccountIndex>;
'Option<AccountIndex>': Option<AccountIndex>;
'Vec<AccountIndex>': Vec<AccountIndex>;
Address: Address;
@@ -215,7 +214,6 @@ export interface InterfaceRegistry {
'Option<ChangesTrieConfiguration>': Option<ChangesTrieConfiguration>;
'Vec<ChangesTrieConfiguration>': Vec<ChangesTrieConfiguration>;
ConsensusEngineId: ConsensusEngineId;
'Compact<ConsensusEngineId>': Compact<ConsensusEngineId>;
'Option<ConsensusEngineId>': Option<ConsensusEngineId>;
'Vec<ConsensusEngineId>': Vec<ConsensusEngineId>;
Digest: Digest;
@@ -2,7 +2,8 @@
/* eslint-disable @typescript-eslint/no-empty-interface */
import { Enum, Struct } from '@polkadot/types/codec';
import { GenericVote, u32 } from '@polkadot/types/primitive';
import { GenericVote } from '@polkadot/types/generic';
import { u32 } from '@polkadot/types/primitive';
import { Balance } from '@polkadot/types/interfaces/runtime';
/** @name ApprovalFlag */
@@ -3,7 +3,9 @@
import { ITuple } from '@polkadot/types/types';
import { Compact, Enum, Struct, U8aFixed, Vec } from '@polkadot/types/codec';
import { Bytes, Fixed64, GenericAccountId, GenericAccountIndex, GenericAddress, GenericBlock, GenericCall, GenericConsensusEngineId, GenericDigest, GenericExtrinsic, GenericExtrinsicEra, GenericExtrinsicPayload, GenericExtrinsicPayloadUnknown, GenericExtrinsicPayloadV1, GenericExtrinsicPayloadV2, GenericExtrinsicPayloadV3, GenericExtrinsicPayloadV4, GenericExtrinsicSignatureV1, GenericExtrinsicSignatureV2, GenericExtrinsicSignatureV3, GenericExtrinsicSignatureV4, GenericExtrinsicUnknown, GenericExtrinsicV1, GenericExtrinsicV2, GenericExtrinsicV3, GenericExtrinsicV4, GenericImmortalEra, GenericMortalEra, GenericOrigin, GenericSignerPayload, Null, StorageData, StorageKey, bool, u128, u32, u64, u8 } from '@polkadot/types/primitive';
import { GenericExtrinsic, GenericExtrinsicEra, GenericExtrinsicPayload, GenericExtrinsicPayloadUnknown, GenericExtrinsicPayloadV1, GenericExtrinsicPayloadV2, GenericExtrinsicPayloadV3, GenericExtrinsicPayloadV4, GenericExtrinsicSignatureV1, GenericExtrinsicSignatureV2, GenericExtrinsicSignatureV3, GenericExtrinsicSignatureV4, GenericExtrinsicUnknown, GenericExtrinsicV1, GenericExtrinsicV2, GenericExtrinsicV3, GenericExtrinsicV4, GenericImmortalEra, GenericMortalEra, GenericSignerPayload } from '@polkadot/types/extrinsic';
import { GenericAccountId, GenericAccountIndex, GenericAddress, GenericBlock, GenericCall, GenericConsensusEngineId, GenericDigest, GenericOrigin } from '@polkadot/types/generic';
import { Bytes, Fixed64, Null, StorageData, StorageKey, bool, u128, u32, u64, u8 } from '@polkadot/types/primitive';
import { AuthorityId } from '@polkadot/types/interfaces/consensus';
/** @name AccountId */
@@ -3,7 +3,8 @@
import { ITuple } from '@polkadot/types/types';
import { Enum, Option, Result, Struct, U8aFixed, Vec } from '@polkadot/types/codec';
import { Bytes, GenericEvent, Text, u32, u8 } from '@polkadot/types/primitive';
import { GenericEvent } from '@polkadot/types/generic';
import { Bytes, Text, u32, u8 } from '@polkadot/types/primitive';
import { Digest, Hash } from '@polkadot/types/interfaces/runtime';
/** @name DigestOf */
+1 -4
View File
@@ -8,8 +8,8 @@
/**
* @summary Type definitions that are used in the system
*/
export { default as bool } from './Bool';
export { default as BitVec } from './BitVec';
export { default as bool } from './Bool';
export { default as Bytes } from './Bytes';
export { default as Data } from './Data';
export { default as IdentityFields } from './IdentityFields';
@@ -33,6 +33,3 @@ export { default as u128 } from './U128';
export { default as u256, default as U256 } from './U256';
export { default as Unconstructable } from './Unconstructable';
export { default as usize } from './USize';
export * from './Generic';
export * from './Extrinsic';