Add new parathreads types (#1477)

* Add new parathreads types

* Fix dangling comma
This commit is contained in:
Jaco Greeff
2019-10-11 16:25:44 +02:00
committed by GitHub
parent 910fa20b78
commit 7143f5e643
5 changed files with 61 additions and 8 deletions
@@ -24,5 +24,7 @@ export function ClassOfUnsafe<T extends Codec = Codec, K extends string = string
// alias for createClass
export function ClassOf<K extends InterfaceTypes> (name: K): Constructor<InterfaceRegistry[K]> {
return ClassOfUnsafe<Codec, K>(name) as Constructor<InterfaceRegistry[K]>;
// TS2589: Type instantiation is excessively deep and possibly infinite.
// The above happens with as Constructor<InterfaceRegistry[K]>;
return ClassOfUnsafe<Codec, K>(name) as any;
}
@@ -58,5 +58,7 @@ export function createTypeUnsafe<T extends Codec = Codec, K extends string = str
* @param params - The value to instantiate the type with
*/
export function createType<K extends InterfaceTypes> (type: K, ...params: any[]): InterfaceRegistry[K] {
return createTypeUnsafe<Codec, K>(type, params) as InterfaceRegistry[K];
// error TS2589: Type instantiation is excessively deep and possibly infinite.
// The above happens with as Constructor<InterfaceRegistry[K]>;
return createTypeUnsafe<Codec, K>(type, params) as any;
}
+13 -1
View File
@@ -25,7 +25,7 @@ import { TreasuryProposal } from '@polkadot/types/interfaces/treasury';
import { DispatchResult, DispatchResultOf } from '@polkadot/types/interfaces/utility';
import { BlockAttestations, IncludedBlocks, MoreAttestations } from '@polkadot/types/interfaces/attestations';
import { EcdsaSignature, EthereumAddress } from '@polkadot/types/interfaces/claims';
import { AttestedCandidate, AuctionIndex, BalanceUpload, Bidder, CandidateReceipt, CollatorSignature, EgressQueueRoot, HeadData, IncomingParachain, IncomingParachainDeploy, IncomingParachainFixed, LeasePeriod, LeasePeriodOf, NewBidder, ParaId, ParaIdOf, ParachainDispatchOrigin, SlotRange, SubId, UpwardMessage, ValidatorIndex, ValidityAttestation, ValidityVote, WinningData, WinningDataEntry } from '@polkadot/types/interfaces/parachains';
import { AttestedCandidate, AuctionIndex, BalanceUpload, Bidder, CandidateReceipt, CollatorId, CollatorSignature, EgressQueueRoot, HeadData, IncomingParachain, IncomingParachainDeploy, IncomingParachainFixed, LeasePeriod, LeasePeriodOf, NewBidder, ParaId, ParaIdOf, ParaInfo, ParaScheduling, ParachainDispatchOrigin, Retriable, SlotRange, SubId, UpwardMessage, ValidatorIndex, ValidityAttestation, ValidityVote, WinningData, WinningDataEntry } from '@polkadot/types/interfaces/parachains';
import { CallMetadataV0, DoubleMapTypeV3, DoubleMapTypeV4, DoubleMapTypeV5, DoubleMapTypeV6, DoubleMapTypeV7, DoubleMapTypeV8, ErrorMetadataV8, EventMetadataLatest, EventMetadataV0, EventMetadataV1, EventMetadataV2, EventMetadataV3, EventMetadataV4, EventMetadataV5, EventMetadataV6, EventMetadataV7, EventMetadataV8, FunctionArgumentMetadataLatest, FunctionArgumentMetadataV0, FunctionArgumentMetadataV1, FunctionArgumentMetadataV2, FunctionArgumentMetadataV3, FunctionArgumentMetadataV4, FunctionArgumentMetadataV5, FunctionArgumentMetadataV6, FunctionArgumentMetadataV7, FunctionArgumentMetadataV8, FunctionMetadataLatest, FunctionMetadataV0, FunctionMetadataV1, FunctionMetadataV2, FunctionMetadataV3, FunctionMetadataV4, FunctionMetadataV5, FunctionMetadataV6, FunctionMetadataV7, FunctionMetadataV8, MapTypeV0, MapTypeV2, MapTypeV3, MapTypeV4, MapTypeV5, MapTypeV6, MapTypeV7, MapTypeV8, MetadataV0, MetadataV1, ModuleConstantMetadataLatest, ModuleConstantMetadataV6, ModuleConstantMetadataV7, ModuleConstantMetadataV8, ModuleMetadataV0, ModuleMetadataV1, OuterDispatchCallV0, OuterDispatchMetadataV0, OuterEventEventMetadataEventsV0, OuterEventEventMetadataV0, OuterEventMetadataV0, PlainTypeLatest, PlainTypeV0, PlainTypeV2, PlainTypeV3, PlainTypeV4, PlainTypeV5, PlainTypeV6, PlainTypeV7, PlainTypeV8, RuntimeModuleMetadataV0, StorageEntryModifierLatest, StorageEntryModifierV6, StorageEntryModifierV7, StorageEntryModifierV8, StorageFunctionMetadataV0, StorageFunctionMetadataV1, StorageFunctionModifierV0, StorageFunctionModifierV1, StorageFunctionModifierV2, StorageFunctionModifierV3, StorageFunctionModifierV4, StorageFunctionModifierV5, StorageFunctionTypeV0, StorageFunctionTypeV1, StorageMetadataV0 } from '@polkadot/types/interfaces/metadata';
import { ApiId, ChainProperties, ExtrinsicOrHash, ExtrinsicStatus, Health, KeyValueOption, NetworkState, PeerInfo, RpcMethods, RuntimeVersion, RuntimeVersionApi, StorageChangeSet } from '@polkadot/types/interfaces/rpc';
@@ -676,6 +676,9 @@ export interface InterfaceRegistry {
CandidateReceipt: CandidateReceipt;
'Option<CandidateReceipt>': Option<CandidateReceipt>;
'Vec<CandidateReceipt>': Vec<CandidateReceipt>;
CollatorId: CollatorId;
'Option<CollatorId>': Option<CollatorId>;
'Vec<CollatorId>': Vec<CollatorId>;
CollatorSignature: CollatorSignature;
'Option<CollatorSignature>': Option<CollatorSignature>;
'Vec<CollatorSignature>': Vec<CollatorSignature>;
@@ -710,9 +713,18 @@ export interface InterfaceRegistry {
ParaIdOf: ParaIdOf;
'Option<ParaIdOf>': Option<ParaIdOf>;
'Vec<ParaIdOf>': Vec<ParaIdOf>;
ParaInfo: ParaInfo;
'Option<ParaInfo>': Option<ParaInfo>;
'Vec<ParaInfo>': Vec<ParaInfo>;
ParachainDispatchOrigin: ParachainDispatchOrigin;
'Option<ParachainDispatchOrigin>': Option<ParachainDispatchOrigin>;
'Vec<ParachainDispatchOrigin>': Vec<ParachainDispatchOrigin>;
ParaScheduling: ParaScheduling;
'Option<ParaScheduling>': Option<ParaScheduling>;
'Vec<ParaScheduling>': Vec<ParaScheduling>;
Retriable: Retriable;
'Option<Retriable>': Option<Retriable>;
'Vec<Retriable>': Vec<Retriable>;
SlotRange: SlotRange;
'Option<SlotRange>': Option<SlotRange>;
'Vec<SlotRange>': Vec<SlotRange>;
@@ -26,6 +26,7 @@ export default {
fees: 'u64',
blockDataHash: 'Hash'
},
CollatorId: 'H256',
CollatorSignature: 'Signature',
EgressQueueRoot: '(ParaId, Hash)',
HeadData: 'Bytes',
@@ -52,11 +53,20 @@ export default {
},
ParaId: 'u32',
ParaIdOf: 'ParaId',
ParaInfo: {
scheduling: 'ParaScheduling'
},
ParachainDispatchOrigin: {
_enum: [
'Signed',
'Parachain'
]
_enum: ['Signed', 'Parachain']
},
ParaScheduling: {
_enum: ['Always', 'Dynamic']
},
Retriable: {
_enum: {
Never: 'Null',
WithRetries: 'u32'
}
},
SlotRange: {
_enum: [
@@ -3,7 +3,7 @@
import { ITuple } from '@polkadot/types/types';
import { Enum, Struct, Vec } from '@polkadot/types/codec';
import { Bytes, u32, u64 } from '@polkadot/types/primitive';
import { Bytes, H256, u32, u64 } from '@polkadot/types/primitive';
import { AccountId, BalanceOf, BlockNumber, Hash, Signature } from '@polkadot/types/interfaces/runtime';
/** Struct */
@@ -52,6 +52,9 @@ export interface CandidateReceipt extends Struct {
readonly blockDataHash: Hash;
}
/** H256 */
export interface CollatorId extends H256 {}
/** Signature */
export interface CollatorSignature extends Signature {}
@@ -121,6 +124,30 @@ export interface ParaId extends u32 {}
/** ParaId */
export interface ParaIdOf extends ParaId {}
/** Struct */
export interface ParaInfo extends Struct {
/** ParaScheduling */
readonly scheduling: ParaScheduling;
}
/** Enum */
export interface ParaScheduling extends Enum {
/** 0:: Always */
readonly isAlways: boolean;
/** 1:: Dynamic */
readonly isDynamic: boolean;
}
/** Enum */
export interface Retriable extends Enum {
/** 0:: Never */
readonly isNever: boolean;
/** 1:: WithRetries(u32) */
readonly isWithRetries: boolean;
/** u32 */
readonly asWithRetries: u32;
}
/** Enum */
export interface SlotRange extends Enum {
/** 0:: ZeroZero */