Move additional types to primitive & rpc (#916)
This commit is contained in:
@@ -2,14 +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 { Codec, CodecTo } from '../types';
|
||||
|
||||
import extrinsics from '@plugnet/extrinsics/static';
|
||||
|
||||
import AccountId from '../primitive/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 Vector from './Vector';
|
||||
import Tuple from './Tuple';
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ import U8a from '../codec/U8a';
|
||||
import Vector from '../codec/Vector';
|
||||
import jsonVec from '../json/AccountIdVec.001.json';
|
||||
import AccountId from './AccountId';
|
||||
import StorageData from '../primitive/StorageData';
|
||||
import StorageData from './StorageData';
|
||||
|
||||
describe('AccountId', () => {
|
||||
describe('defaults', () => {
|
||||
+3
-2
@@ -2,12 +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 { AnyNumber } from '../types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
import { decodeAddress, encodeAddress } from '@plugnet/keyring';
|
||||
import { bnToBn, isBn, isNumber, isU8a, isHex } from '@plugnet/util';
|
||||
|
||||
import U32 from '../primitive/U32';
|
||||
import { AnyNumber } from '../types';
|
||||
import U32 from './U32';
|
||||
|
||||
export const ENUMSET_SIZE = new BN(64);
|
||||
|
||||
+2
-2
@@ -3,8 +3,8 @@
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import Struct from '../codec/Struct';
|
||||
import Bytes from '../primitive/Bytes';
|
||||
import U64 from '../primitive/U64';
|
||||
import Bytes from './Bytes';
|
||||
import U64 from './U64';
|
||||
|
||||
/**
|
||||
* @name AccountInfo
|
||||
@@ -10,11 +10,11 @@ import Struct from '../codec/Struct';
|
||||
import Tuple from '../codec/Tuple';
|
||||
import U8aFixed from '../codec/U8aFixed';
|
||||
import { TypeDef, getTypeClass, getTypeDef } from '../codec/createType';
|
||||
import Null from '../primitive/Null';
|
||||
import U32 from '../primitive/U32';
|
||||
import Metadata from '../Metadata';
|
||||
import { EventMetadata as EventMetadataV0 } from '../Metadata/v0/Events';
|
||||
import { MetadataEvent as EventMetadataV4 } from '../Metadata/v1/Events';
|
||||
import Null from './Null';
|
||||
import U32 from './U32';
|
||||
|
||||
const EventTypes: { [index: string]: Constructor<EventData> } = {};
|
||||
|
||||
+3
-3
@@ -7,12 +7,12 @@ import Vector from '../codec/Vector';
|
||||
import json1 from '../json/EventRecord.001.json';
|
||||
import json2 from '../json/EventRecord.002.json';
|
||||
import json3 from '../json/EventRecord.003.json';
|
||||
import AccountId from './AccountId';
|
||||
import Event from './Event';
|
||||
import EventRecord from './EventRecord';
|
||||
import Metadata from '../Metadata';
|
||||
import metadataV0 from '../Metadata/v0/static';
|
||||
import metadataV1 from '../Metadata/static';
|
||||
import AccountId from './AccountId';
|
||||
import Event from './Event';
|
||||
import EventRecord from './EventRecord';
|
||||
|
||||
describe('EventRecord', () => {
|
||||
describe('v0', () => {
|
||||
+2
-2
@@ -7,10 +7,10 @@ import { assert } from '@plugnet/util';
|
||||
import EnumType from '../codec/EnumType';
|
||||
import Struct from '../codec/Struct';
|
||||
import Vector from '../codec/Vector';
|
||||
import Null from '../primitive/Null';
|
||||
import U32 from '../primitive/U32';
|
||||
import Hash from './Hash';
|
||||
import Event from './Event';
|
||||
import Null from './Null';
|
||||
import U32 from './U32';
|
||||
|
||||
/**
|
||||
* @name ApplyExtrinsic
|
||||
@@ -3,7 +3,8 @@
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { IHash } from '../types';
|
||||
import H256 from '../primitive/H256';
|
||||
|
||||
import H256 from './H256';
|
||||
|
||||
/**
|
||||
* @name Hash
|
||||
@@ -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 Null from '../primitive/Null';
|
||||
import Null from './Null';
|
||||
|
||||
/**
|
||||
* @name Origin
|
||||
@@ -10,12 +10,19 @@
|
||||
*/
|
||||
// NOTE We are exporting Bool as bool to match with Rust (however also using Bool internally),
|
||||
// so with the renamed versions, epose both cases, allowing createType to work
|
||||
export { default as AccountId, AccountIdOf } from './AccountId';
|
||||
export { default as AccountIndex } from './AccountIndex';
|
||||
export { default as AccountInfo } from './AccountInfo';
|
||||
export { default as Address } from './Address';
|
||||
export { default as Event, EventIndex } from './Event';
|
||||
export { default as EventRecord, EventRecord77 } from './EventRecord';
|
||||
export { default as Bool, 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 Hash } from './Hash';
|
||||
export { default as I8, default as i8 } from './I8';
|
||||
export { default as I16, default as i16 } from './I16';
|
||||
export { default as I32, default as i32 } from './I32';
|
||||
@@ -25,6 +32,7 @@ export { default as I256, 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 Origin } from './Origin';
|
||||
export { default as StorageData } from './StorageData';
|
||||
export { default as StorageHasher } from './StorageHasher';
|
||||
export { default as StorageKey } from './StorageKey';
|
||||
|
||||
@@ -7,8 +7,8 @@ import { AnyU8a } from '../types';
|
||||
import { blake2AsU8a } from '@plugnet/util-crypto';
|
||||
|
||||
import Struct from '../codec/Struct';
|
||||
import Extrinsics from './Extrinsics';
|
||||
import Hash from './Hash';
|
||||
import Hash from '../primitive/Hash';
|
||||
import Extrinsics from '../type/Extrinsics';
|
||||
import Header, { HeaderValue } from './Header';
|
||||
|
||||
export type BlockValue = {
|
||||
@@ -9,11 +9,11 @@ import Struct from '../codec/Struct';
|
||||
import Tuple from '../codec/Tuple';
|
||||
import Vector from '../codec/Vector';
|
||||
import Bytes from '../primitive/Bytes';
|
||||
import Hash from '../primitive/Hash';
|
||||
import U32 from '../primitive/U32';
|
||||
import U64 from '../primitive/U64';
|
||||
import AuthorityId from './AuthorityId';
|
||||
import Hash from './Hash';
|
||||
import Signature from './Signature';
|
||||
import AuthorityId from '../type/AuthorityId';
|
||||
import Signature from '../type/Signature';
|
||||
|
||||
/**
|
||||
* @name AuthoritiesChange
|
||||
@@ -6,9 +6,9 @@ import { assert } from '@plugnet/util';
|
||||
|
||||
import EnumType from '../codec/EnumType';
|
||||
import Vector from '../codec/Vector';
|
||||
import Hash from '../primitive/Hash';
|
||||
import Null from '../primitive/Null';
|
||||
import Text from '../primitive/Text';
|
||||
import Hash from '../type/Hash';
|
||||
|
||||
/**
|
||||
* @name Broadcast
|
||||
|
||||
@@ -9,11 +9,10 @@ import { blake2AsU8a } from '@plugnet/util-crypto';
|
||||
import Compact from '../codec/Compact';
|
||||
import Struct from '../codec/Struct';
|
||||
import U64 from '../primitive/U64';
|
||||
|
||||
import AccountId from './AccountId';
|
||||
import BlockNumber from './BlockNumber';
|
||||
import AccountId from '../primitive/AccountId';
|
||||
import Hash from '../primitive/Hash';
|
||||
import BlockNumber from '../type/BlockNumber';
|
||||
import Digest, { DigestItem } from './Digest';
|
||||
import Hash from './Hash';
|
||||
|
||||
export type HeaderValue = {
|
||||
digest?: Digest | { logs: DigestItem[] },
|
||||
@@ -5,8 +5,8 @@
|
||||
import Struct from '../codec/Struct';
|
||||
import Text from '../primitive/Text';
|
||||
import U32 from '../primitive/U32';
|
||||
import Hash from '../primitive/Hash';
|
||||
import BlockNumber from '../type/BlockNumber';
|
||||
import Hash from '../type/Hash';
|
||||
|
||||
const JSON_MAP = new Map([
|
||||
['bestHash', 'best_hash'],
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
import { AnyU8a } from '../types';
|
||||
|
||||
import Struct from '../codec/Struct';
|
||||
import Block, { BlockValue } from '../type/Block';
|
||||
import Hash from '../type/Hash';
|
||||
import Hash from '../primitive/Hash';
|
||||
import Justification from '../type/Justification';
|
||||
import Block, { BlockValue } from './Block';
|
||||
|
||||
type SignedBlockValue = {
|
||||
block?: BlockValue,
|
||||
|
||||
@@ -6,7 +6,7 @@ import { AnyU8a } from '../types';
|
||||
|
||||
import Struct from '../codec/Struct';
|
||||
import Vector from '../codec/Vector';
|
||||
import Hash from '../type/Hash';
|
||||
import Hash from '../primitive/Hash';
|
||||
import { KeyValueOption, KeyValueOptionValue } from '../type/KeyValue';
|
||||
|
||||
type StorageChangeSetValue = {
|
||||
|
||||
@@ -8,8 +8,11 @@
|
||||
/**
|
||||
* @summary Type definitions that are used in the rpc
|
||||
*/
|
||||
export { default as Block } from './Block';
|
||||
export { default as ChainProperties } from './ChainProperties';
|
||||
export { default as Digest, DigestItem } from './Digest';
|
||||
export { default as ExtrinsicStatus } from './ExtrinsicStatus';
|
||||
export { default as Header, HeaderExtended } from './Header';
|
||||
export { default as Health } from './Health';
|
||||
export { default as Json } from './Json';
|
||||
export { default as NetworkState } from './NetworkState';
|
||||
|
||||
@@ -8,11 +8,11 @@ import EnumType from '../codec/EnumType';
|
||||
import Struct from '../codec/Struct';
|
||||
import Tuple from '../codec/Tuple';
|
||||
import Vector from '../codec/Vector';
|
||||
import AccountId from '../primitive/AccountId';
|
||||
import Bytes from '../primitive/Bytes';
|
||||
import Hash from '../primitive/Hash';
|
||||
import Null from '../primitive/Null';
|
||||
import U64 from '../primitive/U64';
|
||||
import AccountId from './AccountId';
|
||||
import Hash from './Hash';
|
||||
import ParaId from './ParaId';
|
||||
import Signature from './Signature';
|
||||
import SessionKey from './SessionKey';
|
||||
|
||||
@@ -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 AccountId from './AccountId';
|
||||
import AccountId from '../primitive/AccountId';
|
||||
|
||||
// Wrapper for a AuthorityId. Same as an normal AccountId, i.e. a wrapper
|
||||
// around publicKey, however specialized since it specifically points to
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
import { AnyU8a } from '../types';
|
||||
|
||||
import Tuple from '../codec/Tuple';
|
||||
import Hash from '../primitive/Hash';
|
||||
import AuthorityId from './AuthorityId';
|
||||
import Hash from './Hash';
|
||||
import Signature from './Signature';
|
||||
|
||||
export type BftAuthoritySignatureValue = [AnyU8a, AnyU8a];
|
||||
|
||||
@@ -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 Hash from './Hash';
|
||||
import Hash from '../primitive/Hash';
|
||||
|
||||
/**
|
||||
* @name CodeHash
|
||||
|
||||
@@ -7,11 +7,11 @@ import { assert } from '@plugnet/util';
|
||||
import Bytes from '../primitive/Bytes';
|
||||
import EnumType from '../codec/EnumType';
|
||||
import Struct from '../codec/Struct';
|
||||
import Hash from '../primitive/Hash';
|
||||
import U64 from '../primitive/U64';
|
||||
import Balance from './Balance';
|
||||
import BlockNumber from './BlockNumber';
|
||||
import CodeHash from './CodeHash';
|
||||
import Hash from './Hash';
|
||||
|
||||
export class TrieId extends Bytes {
|
||||
}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
// 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 U32 from '../primitive/U32';
|
||||
|
||||
/**
|
||||
* @name EventIndex
|
||||
* @description
|
||||
* The Substrate EventIndex representation as a [[U32]].
|
||||
*/
|
||||
export default class EventIndex extends U32 {
|
||||
}
|
||||
@@ -12,9 +12,9 @@ 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 Address from '../primitive/Address';
|
||||
import Hash from '../primitive/Hash';
|
||||
import ExtrinsicSignature from './ExtrinsicSignature';
|
||||
import Hash from './Hash';
|
||||
|
||||
type ExtrinsicValue = {
|
||||
method?: Method
|
||||
|
||||
@@ -6,12 +6,12 @@ import { KeyringPair } from '@plugnet/keyring/types';
|
||||
import { AnyNumber, IExtrinsicSignature, SignatureOptions } from '../types';
|
||||
|
||||
import Struct from '../codec/Struct';
|
||||
import Address from './Address';
|
||||
import Address from '../primitive/Address';
|
||||
import Method from '../primitive/Method';
|
||||
import U8 from '../primitive/U8';
|
||||
import RuntimeVersion from '../rpc/RuntimeVersion';
|
||||
import ExtrinsicEra from './ExtrinsicEra';
|
||||
import Nonce from './NonceCompact';
|
||||
import RuntimeVersion from '../rpc/RuntimeVersion';
|
||||
import Signature from './Signature';
|
||||
import SignaturePayload from './SignaturePayload';
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import Compact from '../codec/Compact';
|
||||
import Struct from '../codec/Struct';
|
||||
import AccountId from './AccountId';
|
||||
import AccountId from '../primitive/AccountId';
|
||||
import Balance from './Balance';
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,8 +7,8 @@ import { AnyNumber, AnyU8a } from '../types';
|
||||
import Struct from '../codec/Struct';
|
||||
import Vector from '../codec/Vector';
|
||||
import Bytes from '../primitive/Bytes';
|
||||
import Hash from '../primitive/Hash';
|
||||
import U32 from '../primitive/U32';
|
||||
import Hash from './Hash';
|
||||
import { BftAuthoritySignature, BftAuthoritySignatureValue } from './Bft';
|
||||
|
||||
export type RhdJustificationValue = {
|
||||
|
||||
@@ -8,11 +8,11 @@ import { assert } from '@plugnet/util';
|
||||
|
||||
import EnumType from '../codec/EnumType';
|
||||
import Struct from '../codec/Struct';
|
||||
import Hash from '../primitive/Hash';
|
||||
import U32 from '../primitive/U32';
|
||||
import AuthorityId from './AuthorityId';
|
||||
import { BftHashSignature, BftHashSignatureValue } from './Bft';
|
||||
import BlockNumber from './BlockNumber';
|
||||
import Hash from './Hash';
|
||||
|
||||
type BftAtReportValueSingle = {
|
||||
round?: AnyNumber,
|
||||
|
||||
@@ -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 Hash from './Hash';
|
||||
import Hash from '../primitive/Hash';
|
||||
|
||||
/**
|
||||
* @name SeedOf
|
||||
|
||||
@@ -8,11 +8,11 @@ import { AnyNumber, AnyU8a } from '../types';
|
||||
import { blake2AsU8a } from '@plugnet/util-crypto';
|
||||
|
||||
import Struct from '../codec/Struct';
|
||||
import ExtrinsicEra from './ExtrinsicEra';
|
||||
import Hash from './Hash';
|
||||
import Hash from '../primitive/Hash';
|
||||
import Method from '../primitive/Method';
|
||||
import Nonce from './NonceCompact';
|
||||
import RuntimeVersion from '../rpc/RuntimeVersion';
|
||||
import ExtrinsicEra from './ExtrinsicEra';
|
||||
import Nonce from './NonceCompact';
|
||||
|
||||
type SignaturePayloadValue = {
|
||||
nonce?: AnyNumber,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import Compact from '../codec/Compact';
|
||||
import Struct from '../codec/Struct';
|
||||
import Vector from '../codec/Vector';
|
||||
import AccountId from './AccountId';
|
||||
import AccountId from '../primitive/AccountId';
|
||||
import Balance from './Balance';
|
||||
import BlockNumber from './BlockNumber';
|
||||
import UnlockChunk from './UnlockChunk';
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import Struct from '../codec/Struct';
|
||||
import AccountId from './AccountId';
|
||||
import AccountId from '../primitive/AccountId';
|
||||
import Balance from './Balance';
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,10 +8,6 @@
|
||||
/**
|
||||
* @summary Type definitions that are used in the system
|
||||
*/
|
||||
export { default as AccountId, AccountIdOf } from './AccountId';
|
||||
export { default as AccountIndex } from './AccountIndex';
|
||||
export { default as AccountInfo } from './AccountInfo';
|
||||
export { default as Address } from './Address';
|
||||
export { default as Amount } from './Amount';
|
||||
export { default as AssetOf } from './AssetOf';
|
||||
export { default as AttestedCandidate } from './AttestedCandidate';
|
||||
@@ -20,13 +16,9 @@ export { default as Balance, BalanceOf } from './Balance';
|
||||
export { default as BalanceLock } from './BalanceLock';
|
||||
// NOTE Bft items are only used in internal structures
|
||||
// export * from './Bft;
|
||||
export { default as Block } from './Block';
|
||||
export { default as BlockNumber } from './BlockNumber';
|
||||
export { default as CodeHash } from './CodeHash';
|
||||
export { default as ContractInfo } from './ContractInfo';
|
||||
export { default as Digest, DigestItem } from './Digest';
|
||||
export { default as Event, EventIndex } from './Event';
|
||||
export { default as EventRecord, EventRecord77 } from './EventRecord';
|
||||
export { default as Exposure } from './Exposure';
|
||||
export { default as Extrinsic } from './Extrinsic';
|
||||
export { default as ExtrinsicEra } from './ExtrinsicEra';
|
||||
@@ -34,8 +26,6 @@ export { default as ExtrinsicSignature } from './ExtrinsicSignature';
|
||||
// NOTE Only used internally, exported as PendingExtrinsics
|
||||
// export { default as Extrinsics } from './Extrinsics';
|
||||
export { default as Gas } from './Gas';
|
||||
export { default as Hash } from './Hash';
|
||||
export { default as Header, HeaderExtended } from './Header';
|
||||
export { default as IndividualExposure } from './IndividualExposure';
|
||||
export { default as InherentOfflineReport } from './InherentOfflineReport';
|
||||
export { default as Key } from './Key';
|
||||
@@ -48,7 +38,6 @@ export { default as NewAccountOutcome } from './NewAccountOutcome';
|
||||
export { default as Index } from './Nonce';
|
||||
export { default as IndexCompact } from './NonceCompact';
|
||||
export { default as Justification } from './Justification';
|
||||
export { default as Origin } from './Origin';
|
||||
export { default as ParaId } from './ParaId';
|
||||
export { default as Permill } from './Permill';
|
||||
export { default as Perbill } from './Perbill';
|
||||
|
||||
@@ -3,10 +3,12 @@
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { KeyringPair } from '@plugnet/keyring/types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
|
||||
import U8a from './codec/U8a';
|
||||
import Method from './primitive/Method';
|
||||
import Address from './type/Address';
|
||||
import Address from './primitive/Address';
|
||||
import { FunctionMetadata } from './Metadata/v0/Modules';
|
||||
|
||||
export type CodecArg = Codec | BN | Boolean | String | Uint8Array | boolean | number | string | undefined | CodecArgArray | CodecArgObject;
|
||||
|
||||
Reference in New Issue
Block a user