Split types into primitive (base) & type (derived) (#715)
* Split types into primitves & structs * Bump version (breaking change)
This commit is contained in:
@@ -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 U32 from '../U32';
|
||||
import U32 from '../primitive/U32';
|
||||
import { assert } from '@polkadot/util';
|
||||
|
||||
export const MAGIC_NUMBER = new U32(0x6174656d); // `meta`, reversed for LE encoding
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import extrinsicsFromMeta from '@polkadot/extrinsics/fromMetadata';
|
||||
|
||||
import createType from '../codec/createType';
|
||||
import Method from '../Method';
|
||||
import Method from '../primitive/Method';
|
||||
|
||||
import Metadata from './index';
|
||||
import latestParsed from './v1/latest.substrate.v1.json';
|
||||
|
||||
@@ -8,7 +8,7 @@ import { assert, isUndefined } from '@polkadot/util';
|
||||
|
||||
import EnumType from '../codec/EnumType';
|
||||
import Struct from '../codec/Struct';
|
||||
import Null from '../Null';
|
||||
import Null from '../primitive/Null';
|
||||
import MetadataV0 from './v0';
|
||||
import MetadataV1 from './v1';
|
||||
import v1ToV0 from './v1/toV0';
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
import Struct from '../../codec/Struct';
|
||||
import Vector from '../../codec/Vector';
|
||||
import Text from '../../Text';
|
||||
import U16 from '../../U16';
|
||||
import Text from '../../primitive/Text';
|
||||
import U16 from '../../primitive/U16';
|
||||
|
||||
export class OuterDispatchCall extends Struct {
|
||||
constructor (value?: any) {
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
import Struct from '../../codec/Struct';
|
||||
import Tuple from '../../codec/Tuple';
|
||||
import Vector from '../../codec/Vector';
|
||||
import Text from '../../Text';
|
||||
import Type from '../../Type';
|
||||
import Text from '../../primitive/Text';
|
||||
import Type from '../../primitive/Type';
|
||||
|
||||
export class EventMetadata extends Struct {
|
||||
constructor (value?: any) {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import extrinsicsFromMeta from '@polkadot/extrinsics/fromMetadata';
|
||||
|
||||
import createType from '../../codec/createType';
|
||||
import Method from '../../Method';
|
||||
import Method from '../../primitive/Method';
|
||||
|
||||
import Metadata from './index';
|
||||
import latestParsed from './latest.substrate.json';
|
||||
|
||||
@@ -4,15 +4,15 @@
|
||||
|
||||
import { AnyNumber } from '../../types';
|
||||
|
||||
import Bytes from '../../Bytes';
|
||||
import Enum from '../../codec/Enum';
|
||||
import EnumType from '../../codec/EnumType';
|
||||
import Option from '../../codec/Option';
|
||||
import Struct from '../../codec/Struct';
|
||||
import Vector from '../../codec/Vector';
|
||||
import Text from '../../Text';
|
||||
import Type from '../../Type';
|
||||
import U16 from '../../U16';
|
||||
import Bytes from '../../primitive/Bytes';
|
||||
import Text from '../../primitive/Text';
|
||||
import Type from '../../primitive/Type';
|
||||
import U16 from '../../primitive/U16';
|
||||
|
||||
export class FunctionArgumentMetadata extends Struct {
|
||||
constructor (value?: any) {
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
import Struct from '../../codec/Struct';
|
||||
import Vector from '../../codec/Vector';
|
||||
import Text from '../../Text';
|
||||
import Type from '../../Type';
|
||||
import Text from '../../primitive/Text';
|
||||
import Type from '../../primitive/Type';
|
||||
|
||||
export class MetadataCallArg extends Struct {
|
||||
constructor (value?: any) {
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
import Struct from '../../codec/Struct';
|
||||
import Vector from '../../codec/Vector';
|
||||
import Text from '../../Text';
|
||||
import Type from '../../Type';
|
||||
import Text from '../../primitive/Text';
|
||||
import Type from '../../primitive/Type';
|
||||
|
||||
/**
|
||||
* @name MetadataEvent
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
import EnumType from '../../codec/EnumType';
|
||||
import Struct from '../../codec/Struct';
|
||||
import Vector from '../../codec/Vector';
|
||||
import Bytes from '../../Bytes';
|
||||
import Null from '../../Null';
|
||||
import Text from '../../Text';
|
||||
import Type from '../../Type';
|
||||
import Bytes from '../../primitive/Bytes';
|
||||
import Null from '../../primitive/Null';
|
||||
import Text from '../../primitive/Text';
|
||||
import Type from '../../primitive/Type';
|
||||
|
||||
export class Default extends Null {}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import { MetadataInterface } from '../types';
|
||||
import Option from '../../codec/Option';
|
||||
import Struct from '../../codec/Struct';
|
||||
import Vector from '../../codec/Vector';
|
||||
import Text from '../../Text';
|
||||
import Text from '../../primitive/Text';
|
||||
import { flattenUniq, validateTypes } from '../util';
|
||||
|
||||
import { MetadataCall } from './Calls';
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
|
||||
import BN from 'bn.js';
|
||||
|
||||
import Balance from '../Balance';
|
||||
import BlockNumber from '../BlockNumber';
|
||||
import Moment from '../Moment';
|
||||
import U32 from '../U32';
|
||||
import Moment from '../primitive/Moment';
|
||||
import U32 from '../primitive/U32';
|
||||
import Balance from '../type/Balance';
|
||||
import BlockNumber from '../type/BlockNumber';
|
||||
import Compact from './Compact';
|
||||
import UInt from './UInt';
|
||||
|
||||
|
||||
@@ -6,11 +6,11 @@ import BN from 'bn.js';
|
||||
import { bnToBn, compactAddLength, compactFromU8a, compactStripLength, compactToU8a, hexToBn, isBn, isHex, isNumber, isString } from '@polkadot/util';
|
||||
import { DEFAULT_BITLENGTH } from '@polkadot/util/compact/defaults';
|
||||
|
||||
import Moment from '../primitive/Moment';
|
||||
import { AnyNumber, Codec, Constructor } from '../types';
|
||||
import { UIntBitLength } from './AbstractInt';
|
||||
import Base from './Base';
|
||||
import UInt from './UInt';
|
||||
import Moment from '../Moment';
|
||||
|
||||
/**
|
||||
* @name Compact
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import EnumType from './EnumType';
|
||||
import Null from '../Null';
|
||||
import Text from '../Text';
|
||||
import U32 from '../U32';
|
||||
import Null from '../primitive/Null';
|
||||
import Text from '../primitive/Text';
|
||||
import U32 from '../primitive/U32';
|
||||
|
||||
describe('Struct', () => {
|
||||
it('provides a clean toString() (value)', () => {
|
||||
|
||||
@@ -6,8 +6,8 @@ import { Codec, Constructor, ConstructorDef } from '../types';
|
||||
|
||||
import { assert, hexToU8a, isHex, isNumber, isObject, isString, isU8a, u8aConcat, u8aToHex } from '@polkadot/util';
|
||||
|
||||
import Null from '../primitive/Null';
|
||||
import Base from './Base';
|
||||
import Null from '../Null';
|
||||
|
||||
type EnumConstructor<T = Codec> = { new(value?: any, index?: number): T };
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import Option from './Option';
|
||||
import Text from '../Text';
|
||||
import Text from '../primitive/Text';
|
||||
|
||||
const testDecode = (type: string, input: any, expected: any) =>
|
||||
it(`can decode from ${type}`, () => {
|
||||
|
||||
@@ -6,7 +6,7 @@ import { isNull, isU8a, isUndefined, u8aToHex } from '@polkadot/util';
|
||||
|
||||
import Base from './Base';
|
||||
import { Codec, Constructor } from '../types';
|
||||
import Null from '../Null';
|
||||
import Null from '../primitive/Null';
|
||||
|
||||
/**
|
||||
* @name Option
|
||||
|
||||
@@ -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 Text from '../primitive/Text';
|
||||
import U32 from '../primitive/U32';
|
||||
import BlockNumber from '../type/BlockNumber';
|
||||
import { CodecTo } from '../types';
|
||||
import Option from './Option';
|
||||
import Struct from './Struct';
|
||||
import BlockNumber from '../BlockNumber';
|
||||
import Text from '../Text';
|
||||
import U32 from '../U32';
|
||||
import Vector from './Vector';
|
||||
|
||||
describe('Struct', () => {
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
import extrinsics from '@polkadot/extrinsics/static';
|
||||
|
||||
import { CodecTo } from '../types';
|
||||
import Text from '../Text';
|
||||
import U32 from '../U32';
|
||||
import Method from '../primitive/Method';
|
||||
import Text from '../primitive/Text';
|
||||
import U32 from '../primitive/U32';
|
||||
import BlockNumber from '../type/BlockNumber';
|
||||
import Proposal from '../type/Proposal';
|
||||
import VoteThreshold from '../type/VoteThreshold';
|
||||
import Tuple from './Tuple';
|
||||
import BlockNumber from '../BlockNumber';
|
||||
import Method from '../Method';
|
||||
import Proposal from '../Proposal';
|
||||
import VoteThreshold from '../VoteThreshold';
|
||||
|
||||
describe('Tuple', () => {
|
||||
let tuple: Tuple;
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { TypeRegistry } from './typeRegistry';
|
||||
import Text from '../Text';
|
||||
import U32 from '../U32';
|
||||
import Text from '../primitive/Text';
|
||||
import U32 from '../primitive/U32';
|
||||
|
||||
describe('TypeRegistry', () => {
|
||||
let registry: TypeRegistry;
|
||||
|
||||
@@ -8,7 +8,7 @@ import { AnyU8a } from '../types';
|
||||
|
||||
import U8a from './U8a';
|
||||
|
||||
type BitLength = 8 | 16 | 32 | 64 | 128 | 256 | 512;
|
||||
type BitLength = 8 | 16 | 32 | 64 | 128 | 160 | 256 | 512;
|
||||
|
||||
/**
|
||||
* @name U8aFixed
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
|
||||
import extrinsics from '@polkadot/extrinsics/static';
|
||||
|
||||
import AccountId from '../AccountId';
|
||||
import Method from '../primitive/Method';
|
||||
import Text from '../primitive/Text';
|
||||
import PropIndex from '../type/PropIndex';
|
||||
import Proposal from '../type/Proposal';
|
||||
import AccountId from '../type/AccountId';
|
||||
import { Codec, CodecTo } from '../types';
|
||||
import createType from './createType';
|
||||
import Method from '../Method';
|
||||
import PropIndex from '../PropIndex';
|
||||
import Proposal from '../Proposal';
|
||||
import Text from '../Text';
|
||||
import Vector from './Vector';
|
||||
import Tuple from './Tuple';
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import { assert } from '@polkadot/util';
|
||||
|
||||
import { Codec, Constructor } from '../types';
|
||||
import Text from '../Text';
|
||||
import Text from '../primitive/Text';
|
||||
import EnumType from './EnumType';
|
||||
import Compact from './Compact';
|
||||
import Option from './Option';
|
||||
@@ -184,7 +184,7 @@ export function getTypeClass (value: TypeDef): Constructor {
|
||||
}
|
||||
|
||||
// NOTE We only load types via require - we have to avoid circular deps between type usage and creation
|
||||
const Types = require('../index.classes');
|
||||
const Types = require('../index.types');
|
||||
const Type = registry.get(value.type) || Types[value.type];
|
||||
|
||||
assert(Type, `Unable to determine type from '${value.type}'`);
|
||||
|
||||
@@ -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 U32 from '../../U32';
|
||||
import U32 from '../../primitive/U32';
|
||||
import compareArray from './compareArray';
|
||||
|
||||
describe('compareArray', () => {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Codec } from '../../types';
|
||||
import U32 from '../../U32';
|
||||
import U32 from '../../primitive/U32';
|
||||
import compareMap from './compareMap';
|
||||
|
||||
describe('compareMap', () => {
|
||||
|
||||
@@ -6,7 +6,7 @@ import { Constructor } from './types';
|
||||
|
||||
import extrinsics from '@polkadot/extrinsics/static';
|
||||
|
||||
import * as Classes from './index.classes';
|
||||
import * as Classes from './index.types';
|
||||
|
||||
const Types = Classes as { [index: string]: Constructor };
|
||||
|
||||
|
||||
@@ -6,4 +6,4 @@
|
||||
// well - <root>/docs/SUMMARY.md as well as ../README.md
|
||||
|
||||
export * from './codec';
|
||||
export * from './index.classes';
|
||||
export * from './index.types';
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
// Copyright 2017-2019 @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.
|
||||
|
||||
// NOTE When adding any types here, we need to update the coumentation links as
|
||||
// well - <root>/docs/SUMMARY.md as well as ../README.md
|
||||
|
||||
/**
|
||||
* @summary Type definitions that are used in the system
|
||||
*/
|
||||
export { default as Metadata } from './Metadata';
|
||||
export * from './primitive';
|
||||
export * from './type';
|
||||
@@ -3,7 +3,7 @@
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import Bool from './Bool';
|
||||
import { CodecTo } from './types';
|
||||
import { CodecTo } from '../types';
|
||||
|
||||
describe('Bool', () => {
|
||||
describe('decode', () => {
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import { isU8a, u8aToHex } from '@polkadot/util';
|
||||
|
||||
import { Codec } from './types';
|
||||
import { Codec } from '../types';
|
||||
|
||||
/**
|
||||
* @name Bool
|
||||
@@ -4,9 +4,9 @@
|
||||
|
||||
import { isString, isU8a, u8aToU8a } from '@polkadot/util';
|
||||
|
||||
import { AnyU8a } from './types';
|
||||
import Compact from './codec/Compact';
|
||||
import U8a from './codec/U8a';
|
||||
import { AnyU8a } from '../types';
|
||||
import Compact from '../codec/Compact';
|
||||
import U8a from '../codec/U8a';
|
||||
|
||||
/**
|
||||
* @name Bytes
|
||||
@@ -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 U8a from './codec/U8a';
|
||||
import U8a from '../codec/U8a';
|
||||
|
||||
/**
|
||||
* @name Data
|
||||
@@ -0,0 +1,19 @@
|
||||
// Copyright 2017-2019 @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 { AnyU8a } from '../types';
|
||||
|
||||
import U8aFixed from '../codec/U8aFixed';
|
||||
|
||||
/**
|
||||
* @name H160
|
||||
* @description
|
||||
* Hash containing 160 bits (20 bytes), typically used in blocks, extrinsics and
|
||||
* as a sane default for fixed-length hash representations.
|
||||
*/
|
||||
export default class H160 extends U8aFixed {
|
||||
constructor (value?: AnyU8a) {
|
||||
super(value, 160);
|
||||
}
|
||||
}
|
||||
@@ -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 { AnyU8a } from './types';
|
||||
import { AnyU8a } from '../types';
|
||||
|
||||
import U8aFixed from './codec/U8aFixed';
|
||||
import U8aFixed from '../codec/U8aFixed';
|
||||
|
||||
/**
|
||||
* @name H256
|
||||
@@ -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 { AnyU8a } from './types';
|
||||
import { AnyU8a } from '../types';
|
||||
|
||||
import U8aFixed from './codec/U8aFixed';
|
||||
import U8aFixed from '../codec/U8aFixed';
|
||||
|
||||
/**
|
||||
* @name H512
|
||||
@@ -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 { AnyNumber } from './types';
|
||||
import { AnyNumber } from '../types';
|
||||
|
||||
import Int from './codec/Int';
|
||||
import Int from '../codec/Int';
|
||||
|
||||
/**
|
||||
* @name I128
|
||||
@@ -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 { AnyNumber } from './types';
|
||||
import { AnyNumber } from '../types';
|
||||
|
||||
import Int from './codec/Int';
|
||||
import Int from '../codec/Int';
|
||||
|
||||
/**
|
||||
* @name I16
|
||||
@@ -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 { AnyNumber } from './types';
|
||||
import { AnyNumber } from '../types';
|
||||
|
||||
import Int from './codec/Int';
|
||||
import Int from '../codec/Int';
|
||||
|
||||
/**
|
||||
* @name I256
|
||||
@@ -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 { AnyNumber } from './types';
|
||||
import { AnyNumber } from '../types';
|
||||
|
||||
import Int from './codec/Int';
|
||||
import Int from '../codec/Int';
|
||||
|
||||
/**
|
||||
* @name I32
|
||||
@@ -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 { AnyNumber } from './types';
|
||||
import { AnyNumber } from '../types';
|
||||
|
||||
import Int from './codec/Int';
|
||||
import Int from '../codec/Int';
|
||||
|
||||
/**
|
||||
* @name I64
|
||||
@@ -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 { AnyNumber } from './types';
|
||||
import { AnyNumber } from '../types';
|
||||
|
||||
import Int from './codec/Int';
|
||||
import Int from '../codec/Int';
|
||||
|
||||
/**
|
||||
* @name I8
|
||||
@@ -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 { AnyU8a, Codec, Constructor } from './types';
|
||||
import { AnyU8a, Codec, Constructor } from '../types';
|
||||
|
||||
import { assert, isHex, isObject, isU8a, hexToU8a } from '@polkadot/util';
|
||||
|
||||
import { getTypeDef, getTypeClass } from './codec/createType';
|
||||
import Struct from './codec/Struct';
|
||||
import U8aFixed from './codec/U8aFixed';
|
||||
import { FunctionMetadata, FunctionArgumentMetadata } from './Metadata/v0/Modules';
|
||||
import { getTypeDef, getTypeClass } from '../codec/createType';
|
||||
import Struct from '../codec/Struct';
|
||||
import U8aFixed from '../codec/U8aFixed';
|
||||
import { FunctionMetadata, FunctionArgumentMetadata } from '../Metadata/v0/Modules';
|
||||
|
||||
interface ArgsDef {
|
||||
[index: string]: Constructor;
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import BN from 'bn.js';
|
||||
|
||||
import { CodecTo } from './types';
|
||||
import { CodecTo } from '../types';
|
||||
import Moment from './Moment';
|
||||
import U64 from './U64';
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
import BN from 'bn.js';
|
||||
import { bnToBn, bnToHex, bnToU8a, isString, isU8a, u8aToBn } from '@polkadot/util';
|
||||
|
||||
import { UIntBitLength } from './codec/AbstractInt';
|
||||
import { AnyNumber, Codec } from './types';
|
||||
import { UIntBitLength } from '../codec/AbstractInt';
|
||||
import { AnyNumber, Codec } from '../types';
|
||||
|
||||
const BITLENGTH: UIntBitLength = 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 { Codec } from './types';
|
||||
import { Codec } from '../types';
|
||||
import { isNull } from '@polkadot/util';
|
||||
|
||||
/**
|
||||
@@ -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 { AnyU8a } from './types';
|
||||
import { AnyU8a } from '../types';
|
||||
|
||||
import { isFunction } from '@polkadot/util';
|
||||
|
||||
import Bytes from './Bytes';
|
||||
import { StorageFunctionMetadata } from './Metadata/v0/Modules';
|
||||
import { StorageFunctionMetadata } from '../Metadata/v0/Modules';
|
||||
|
||||
export interface StorageFunction {
|
||||
(arg?: any): Uint8Array;
|
||||
@@ -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 { CodecTo } from './types';
|
||||
import { CodecTo } from '../types';
|
||||
import U8a from '../codec/U8a';
|
||||
import Text from './Text';
|
||||
import U8a from './codec/U8a';
|
||||
|
||||
describe('Text', () => {
|
||||
describe('decode', () => {
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
import { isString, stringToU8a, u8aToString, u8aToHex } from '@polkadot/util';
|
||||
|
||||
import { AnyU8a, Codec } from './types';
|
||||
import Compact from './codec/Compact';
|
||||
import { AnyU8a, Codec } from '../types';
|
||||
import Compact from '../codec/Compact';
|
||||
|
||||
/**
|
||||
* @name Text
|
||||
@@ -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 { AnyNumber } from './types';
|
||||
import { AnyNumber } from '../types';
|
||||
|
||||
import UInt from './codec/UInt';
|
||||
import UInt from '../codec/UInt';
|
||||
|
||||
/**
|
||||
* @name U128
|
||||
@@ -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 { AnyNumber } from './types';
|
||||
import { AnyNumber } from '../types';
|
||||
|
||||
import UInt from './codec/UInt';
|
||||
import UInt from '../codec/UInt';
|
||||
|
||||
/**
|
||||
* @name U16
|
||||
@@ -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 { AnyNumber } from './types';
|
||||
import { AnyNumber } from '../types';
|
||||
|
||||
import UInt from './codec/UInt';
|
||||
import UInt from '../codec/UInt';
|
||||
|
||||
/**
|
||||
* @name U256
|
||||
@@ -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 { AnyNumber } from './types';
|
||||
import { AnyNumber } from '../types';
|
||||
|
||||
import UInt from './codec/UInt';
|
||||
import UInt from '../codec/UInt';
|
||||
|
||||
/**
|
||||
* @name U32
|
||||
@@ -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 { AnyNumber } from './types';
|
||||
import { AnyNumber } from '../types';
|
||||
|
||||
import UInt from './codec/UInt';
|
||||
import UInt from '../codec/UInt';
|
||||
|
||||
/**
|
||||
* @name U64
|
||||
@@ -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 { AnyNumber } from './types';
|
||||
import { AnyNumber } from '../types';
|
||||
|
||||
import UInt from './codec/UInt';
|
||||
import UInt from '../codec/UInt';
|
||||
|
||||
/**
|
||||
* @name U8
|
||||
@@ -0,0 +1,38 @@
|
||||
// Copyright 2017-2019 @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.
|
||||
|
||||
// NOTE When adding any types here, we need to update the coumentation links as
|
||||
// well - <root>/docs/SUMMARY.md as well as ../README.md
|
||||
|
||||
/**
|
||||
* @summary Type definitions that are used in the system
|
||||
*/
|
||||
// NOTE Bft items are only used in internal structures
|
||||
// NOTE We are exporting Bool as bool to match with Rust
|
||||
export { default as bool } from './Bool';
|
||||
export { default as Bytes } from './Bytes';
|
||||
export { default as Data } from './Data';
|
||||
export { default as H160 } from './H160';
|
||||
export { default as H256 } from './H256';
|
||||
export { default as H512 } from './H512';
|
||||
export { default as i8 } from './I8';
|
||||
export { default as i16 } from './I16';
|
||||
export { default as i32 } from './I32';
|
||||
export { default as i64 } from './I64';
|
||||
export { default as i128 } from './I128';
|
||||
export { default as i256 } from './I256';
|
||||
export { default as Method } from './Method';
|
||||
export { default as Moment, MomentOf } from './Moment';
|
||||
export { default as Null } from './Null';
|
||||
export { default as StorageData } from './StorageData';
|
||||
export { default as StorageKey } from './StorageKey';
|
||||
export { default as Text } from './Text';
|
||||
export { default as Type } from './Type';
|
||||
export { default as u8 } from './U8';
|
||||
export { default as u16 } from './U16';
|
||||
export { default as u32 } from './U32';
|
||||
export { default as u64 } from './U64';
|
||||
export { default as u128 } from './U128';
|
||||
export { default as u256 } from './U256';
|
||||
export { default as usize } from './USize';
|
||||
@@ -6,10 +6,10 @@ import fs from 'fs';
|
||||
import { stringCamelCase, stringLowerFirst } from '@polkadot/util';
|
||||
|
||||
import interfaces from '../../../type-jsonrpc/src';
|
||||
import Method from '../primitive/Method';
|
||||
import Metadata from '../Metadata';
|
||||
import MetadataV0 from '../Metadata/v0';
|
||||
import rpcdata from '../Metadata/static';
|
||||
import Method from '../Method';
|
||||
import MetadataV0 from '../Metadata/v0';
|
||||
|
||||
const ANCHOR_TOP = `<a id='top' style='text-decoration: none;'>`;
|
||||
const LINK_BACK_TO_TOP = `<a href='#top' style='float: right; font-size: 1.6rem; font-weight: bold;'>Back To Top</a>`;
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { setAddressPrefix } from '@polkadot/keyring';
|
||||
import U8a from './codec/U8a';
|
||||
import Vector from './codec/Vector';
|
||||
import jsonVec from './json/AccountIdVec.001.json';
|
||||
import U8a from '../codec/U8a';
|
||||
import Vector from '../codec/Vector';
|
||||
import jsonVec from '../json/AccountIdVec.001.json';
|
||||
import AccountId from './AccountId';
|
||||
import StorageData from './StorageData';
|
||||
import StorageData from '../primitive/StorageData';
|
||||
|
||||
describe('AccountId', () => {
|
||||
describe('defaults', () => {
|
||||
@@ -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 } from './types';
|
||||
import { AnyString, AnyU8a } from '../types';
|
||||
|
||||
import { decodeAddress, encodeAddress } from '@polkadot/keyring';
|
||||
import { hexToU8a, isHex, isString, isU8a, u8aToU8a } from '@polkadot/util';
|
||||
|
||||
import U8aFixed from './codec/U8aFixed';
|
||||
import U8aFixed from '../codec/U8aFixed';
|
||||
|
||||
/**
|
||||
* @name AccountId
|
||||
@@ -6,8 +6,8 @@ import BN from 'bn.js';
|
||||
import { decodeAddress, encodeAddress } from '@polkadot/keyring';
|
||||
import { bnToBn, isBn, isNumber, isU8a, isHex } from '@polkadot/util';
|
||||
|
||||
import { AnyNumber } from './types';
|
||||
import U32 from './U32';
|
||||
import U32 from '../primitive/U32';
|
||||
import { AnyNumber } from '../types';
|
||||
|
||||
export const ENUMSET_SIZE = new BN(64);
|
||||
|
||||
@@ -6,7 +6,7 @@ import BN from 'bn.js';
|
||||
import { decodeAddress } from '@polkadot/keyring';
|
||||
import { hexToU8a, isBn, isHex, isNumber, isU8a, u8aConcat, u8aToHex, u8aToU8a, u8aToBn } from '@polkadot/util';
|
||||
|
||||
import Base from './codec/Base';
|
||||
import Base from '../codec/Base';
|
||||
import AccountId from './AccountId';
|
||||
import AccountIndex from './AccountIndex';
|
||||
|
||||
+7
-7
@@ -2,18 +2,18 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import EnumType from './codec/EnumType';
|
||||
import Struct from './codec/Struct';
|
||||
import Tuple from './codec/Tuple';
|
||||
import Vector from './codec/Vector';
|
||||
import EnumType from '../codec/EnumType';
|
||||
import Struct from '../codec/Struct';
|
||||
import Tuple from '../codec/Tuple';
|
||||
import Vector from '../codec/Vector';
|
||||
import Bytes from '../primitive/Bytes';
|
||||
import Null from '../primitive/Null';
|
||||
import U64 from '../primitive/U64';
|
||||
import AccountId from './AccountId';
|
||||
import Bytes from './Bytes';
|
||||
import Hash from './Hash';
|
||||
import Null from './Null';
|
||||
import ParaId from './ParaId';
|
||||
import Signature from './Signature';
|
||||
import SessionKey from './SessionKey';
|
||||
import U64 from './U64';
|
||||
|
||||
export class CandidateSignature extends Signature {
|
||||
}
|
||||
@@ -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 U128 from './U128';
|
||||
import U128 from '../primitive/U128';
|
||||
|
||||
/**
|
||||
* @name Balance
|
||||
@@ -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 { AnyU8a } from './types';
|
||||
import { AnyU8a } from '../types';
|
||||
|
||||
import Tuple from './codec/Tuple';
|
||||
import Tuple from '../codec/Tuple';
|
||||
import AuthorityId from './AuthorityId';
|
||||
import Hash from './Hash';
|
||||
import Signature from './Signature';
|
||||
@@ -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 { AnyU8a } from './types';
|
||||
import { AnyU8a } from '../types';
|
||||
|
||||
import { blake2AsU8a } from '@polkadot/util-crypto';
|
||||
|
||||
import Struct from './codec/Struct';
|
||||
import Struct from '../codec/Struct';
|
||||
import Extrinsics from './Extrinsics';
|
||||
import Hash from './Hash';
|
||||
import Header, { HeaderValue } from './Header';
|
||||
@@ -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 U64 from './U64';
|
||||
import U64 from '../primitive/U64';
|
||||
|
||||
/**
|
||||
* @name BlockNumber
|
||||
@@ -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 { Codec } from './types';
|
||||
import { compareMap } from './codec/utils';
|
||||
import { Codec } from '../types';
|
||||
import { compareMap } from '../codec/utils';
|
||||
|
||||
/**
|
||||
* @name ChainProperties
|
||||
@@ -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 json from './json/Header.002.json';
|
||||
import json from '../json/Header.002.json';
|
||||
import Digest from './Digest';
|
||||
|
||||
describe('Digest', () => {
|
||||
@@ -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 EnumType from './codec/EnumType';
|
||||
import Struct from './codec/Struct';
|
||||
import Tuple from './codec/Tuple';
|
||||
import Vector from './codec/Vector';
|
||||
import EnumType from '../codec/EnumType';
|
||||
import Struct from '../codec/Struct';
|
||||
import Tuple from '../codec/Tuple';
|
||||
import Vector from '../codec/Vector';
|
||||
import Bytes from '../primitive/Bytes';
|
||||
import U64 from '../primitive/U64';
|
||||
import AuthorityId from './AuthorityId';
|
||||
import Bytes from './Bytes';
|
||||
import Hash from './Hash';
|
||||
import Signature from './Signature';
|
||||
import U64 from './U64';
|
||||
|
||||
/**
|
||||
* @name AuthoritiesChange
|
||||
@@ -2,17 +2,17 @@
|
||||
// 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 { isUndefined, stringCamelCase, u8aToHex } from '@polkadot/util';
|
||||
|
||||
import Struct from './codec/Struct';
|
||||
import Tuple from './codec/Tuple';
|
||||
import U8aFixed from './codec/U8aFixed';
|
||||
import { TypeDef, getTypeClass, getTypeDef } from './codec/createType';
|
||||
import MetadataV0 from './Metadata/v0';
|
||||
import { EventMetadata } from './Metadata/v0/Events';
|
||||
import Null from './Null';
|
||||
import Struct from '../codec/Struct';
|
||||
import Tuple from '../codec/Tuple';
|
||||
import U8aFixed from '../codec/U8aFixed';
|
||||
import Null from '../primitive/Null';
|
||||
import { TypeDef, getTypeClass, getTypeDef } from '../codec/createType';
|
||||
import MetadataV0 from '../Metadata/v0';
|
||||
import { EventMetadata } from '../Metadata/v0/Events';
|
||||
|
||||
const EventTypes: { [index: string]: Constructor<EventData> } = {};
|
||||
|
||||
+6
-6
@@ -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 createType from './codec/createType';
|
||||
import Vector from './codec/Vector';
|
||||
import json1 from './json/EventRecord.001.json';
|
||||
import json2 from './json/EventRecord.002.json';
|
||||
import createType from '../codec/createType';
|
||||
import Vector from '../codec/Vector';
|
||||
import json1 from '../json/EventRecord.001.json';
|
||||
import json2 from '../json/EventRecord.002.json';
|
||||
import AccountId from './AccountId';
|
||||
import Event from './Event';
|
||||
import EventRecord from './EventRecord';
|
||||
import Metadata from './Metadata';
|
||||
import metadataRpc from './Metadata/v0/static';
|
||||
import Metadata from '../Metadata';
|
||||
import metadataRpc from '../Metadata/v0/static';
|
||||
|
||||
describe('EventRecord', () => {
|
||||
beforeEach(() => {
|
||||
@@ -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 EnumType from './codec/EnumType';
|
||||
import Struct from './codec/Struct';
|
||||
import EnumType from '../codec/EnumType';
|
||||
import Struct from '../codec/Struct';
|
||||
import Null from '../primitive/Null';
|
||||
import U32 from '../primitive/U32';
|
||||
import Event from './Event';
|
||||
import Null from './Null';
|
||||
import U32 from './U32';
|
||||
|
||||
/**
|
||||
* @name ApplyExtrinsic
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
import extrinsics from '@polkadot/extrinsics/static';
|
||||
|
||||
import Method from '../primitive/Method';
|
||||
import Extrinsic from './Extrinsic';
|
||||
import Method from './Method';
|
||||
|
||||
describe('Extrinsic', () => {
|
||||
beforeAll(() => {
|
||||
@@ -3,18 +3,18 @@
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { KeyringPair } from '@polkadot/keyring/types';
|
||||
import { AnyNumber, AnyU8a, Codec, SignatureOptions } from './types';
|
||||
import { AnyNumber, AnyU8a, Codec, SignatureOptions } from '../types';
|
||||
|
||||
import { isHex, isU8a, u8aToHex, u8aToU8a } from '@polkadot/util';
|
||||
import { blake2AsU8a } from '@polkadot/util-crypto';
|
||||
|
||||
import Compact from './codec/Compact';
|
||||
import Struct from './codec/Struct';
|
||||
import Compact from '../codec/Compact';
|
||||
import Struct from '../codec/Struct';
|
||||
import { FunctionMetadata } from '../Metadata/v0/Modules';
|
||||
import Method from '../primitive/Method';
|
||||
import Address from './Address';
|
||||
import ExtrinsicSignature from './ExtrinsicSignature';
|
||||
import Hash from './Hash';
|
||||
import { FunctionMetadata } from './Metadata/v0/Modules';
|
||||
import Method from './Method';
|
||||
|
||||
type ExtrinsicValue = {
|
||||
method?: Method
|
||||
@@ -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 { AnyU8a } from './types';
|
||||
import { AnyU8a } from '../types';
|
||||
|
||||
import { u8aToU8a } from '@polkadot/util';
|
||||
|
||||
import U8a from './codec/U8a';
|
||||
import U8a from '../codec/U8a';
|
||||
|
||||
/**
|
||||
* @name ExtrinsicEra
|
||||
+4
-4
@@ -3,17 +3,17 @@
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { KeyringPair } from '@polkadot/keyring/types';
|
||||
import { AnyNumber, SignatureOptions } from './types';
|
||||
import { AnyNumber, SignatureOptions } from '../types';
|
||||
|
||||
import Struct from './codec/Struct';
|
||||
import Struct from '../codec/Struct';
|
||||
import Address from './Address';
|
||||
import Method from '../primitive/Method';
|
||||
import U8 from '../primitive/U8';
|
||||
import ExtrinsicEra from './ExtrinsicEra';
|
||||
import Method from './Method';
|
||||
import Nonce from './NonceCompact';
|
||||
import RuntimeVersion from './RuntimeVersion';
|
||||
import Signature from './Signature';
|
||||
import SignaturePayload from './SignaturePayload';
|
||||
import U8 from './U8';
|
||||
|
||||
export const IMMORTAL_ERA = new Uint8Array([0]);
|
||||
|
||||
+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 rpc from './json/ExtrinsicStatus.001.json';
|
||||
import rpc from '../json/ExtrinsicStatus.001.json';
|
||||
import ExtrinsicStatus from './ExtrinsicStatus';
|
||||
|
||||
describe('ExtrinsicStatus', () => {
|
||||
@@ -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 EnumType from './codec/EnumType';
|
||||
import Vector from './codec/Vector';
|
||||
import EnumType from '../codec/EnumType';
|
||||
import Vector from '../codec/Vector';
|
||||
import Null from '../primitive/Null';
|
||||
import Text from '../primitive/Text';
|
||||
import Hash from './Hash';
|
||||
import Null from './Null';
|
||||
import Text from './Text';
|
||||
|
||||
/**
|
||||
* @name Broadcast
|
||||
@@ -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 Vector from './codec/Vector';
|
||||
import Vector from '../codec/Vector';
|
||||
import Extrinsic from './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 U64 from './U64';
|
||||
import U64 from '../primitive/U64';
|
||||
|
||||
/**
|
||||
* @name Gas
|
||||
@@ -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 H256 from './H256';
|
||||
import H256 from '../primitive/H256';
|
||||
|
||||
/**
|
||||
* @name Hash
|
||||
@@ -5,8 +5,8 @@
|
||||
import BN from 'bn.js';
|
||||
|
||||
import Header from './Header';
|
||||
import json1 from './json/Header.001.json';
|
||||
import json2 from './json/Header.002.json';
|
||||
import json1 from '../json/Header.001.json';
|
||||
import json2 from '../json/Header.002.json';
|
||||
|
||||
describe('Header', () => {
|
||||
it('decodes an actual JSON response', () => {
|
||||
@@ -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 { AnyNumber, AnyU8a } from './types';
|
||||
import { AnyNumber, AnyU8a } from '../types';
|
||||
|
||||
import { blake2AsU8a } from '@polkadot/util-crypto';
|
||||
|
||||
import Compact from './codec/Compact';
|
||||
import Struct from './codec/Struct';
|
||||
import Compact from '../codec/Compact';
|
||||
import Struct from '../codec/Struct';
|
||||
|
||||
import AccountId from './AccountId';
|
||||
import BlockNumber from './BlockNumber';
|
||||
@@ -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 Struct from './codec/Struct';
|
||||
import Bool from './Bool';
|
||||
import USize from './USize';
|
||||
import Struct from '../codec/Struct';
|
||||
import Bool from '../primitive/Bool';
|
||||
import USize from '../primitive/USize';
|
||||
|
||||
const JSON_MAP = new Map([
|
||||
['isSyncing', 'is_syncing'],
|
||||
+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 Tuple from './codec/Tuple';
|
||||
import Tuple from '../codec/Tuple';
|
||||
|
||||
/**
|
||||
* @name InherentOfflineReport
|
||||
+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 rpc from './json/SignedBlock.001.json';
|
||||
import rpc from '../json/SignedBlock.001.json';
|
||||
import { RhdJustification } from './Justification';
|
||||
|
||||
describe('RhdJustification', () => {
|
||||
@@ -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, AnyU8a } from './types';
|
||||
import { AnyNumber, AnyU8a } from '../types';
|
||||
|
||||
import Struct from './codec/Struct';
|
||||
import Vector from './codec/Vector';
|
||||
import { BftAuthoritySignature, BftAuthoritySignatureValue } from './Bft';
|
||||
import Bytes from './Bytes';
|
||||
import Struct from '../codec/Struct';
|
||||
import Vector from '../codec/Vector';
|
||||
import Bytes from '../primitive/Bytes';
|
||||
import U32 from '../primitive/U32';
|
||||
import Hash from './Hash';
|
||||
import U32 from './U32';
|
||||
import { BftAuthoritySignature, BftAuthoritySignatureValue } from './Bft';
|
||||
|
||||
export type RhdJustificationValue = {
|
||||
roundNumber?: AnyNumber,
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user