diff --git a/packages/types-augment/src/registry/interfaces.ts b/packages/types-augment/src/registry/interfaces.ts index 51a6cf6127..0cccd8f1c6 100644 --- a/packages/types-augment/src/registry/interfaces.ts +++ b/packages/types-augment/src/registry/interfaces.ts @@ -53,9 +53,9 @@ import type { Period, Priority, SchedulePeriod, SchedulePriority, Scheduled, Sch import type { BeefyKey, FullIdentification, IdentificationTuple, Keys, MembershipProof, SessionIndex, SessionKeys1, SessionKeys10, SessionKeys10B, SessionKeys2, SessionKeys3, SessionKeys4, SessionKeys5, SessionKeys6, SessionKeys6B, SessionKeys7, SessionKeys7B, SessionKeys8, SessionKeys8B, SessionKeys9, SessionKeys9B, ValidatorCount } from '@polkadot/types/interfaces/session'; import type { Bid, BidKind, SocietyJudgement, SocietyVote, StrikeCount, VouchingStatus } from '@polkadot/types/interfaces/society'; import type { ActiveEraInfo, CompactAssignments, CompactAssignmentsTo257, CompactAssignmentsTo265, CompactAssignmentsWith16, CompactAssignmentsWith24, CompactScore, CompactScoreCompact, ElectionCompute, ElectionPhase, ElectionResult, ElectionScore, ElectionSize, ElectionStatus, EraIndex, EraPoints, EraRewardPoints, EraRewards, Exposure, ExtendedBalance, Forcing, IndividualExposure, KeyType, MomentOf, Nominations, NominatorIndex, NominatorIndexCompact, OffchainAccuracy, OffchainAccuracyCompact, PhragmenScore, Points, RawSolution, RawSolutionTo265, RawSolutionWith16, RawSolutionWith24, ReadySolution, RewardDestination, RewardPoint, RoundSnapshot, SeatHolder, SignedSubmission, SignedSubmissionOf, SignedSubmissionTo276, SlashJournalEntry, SlashingSpans, SlashingSpansTo204, SolutionOrSnapshotSize, SolutionSupport, SolutionSupports, SpanIndex, SpanRecord, StakingLedger, StakingLedgerTo223, StakingLedgerTo240, SubmissionIndicesOf, Supports, UnappliedSlash, UnappliedSlashOther, UnlockChunk, ValidatorIndex, ValidatorIndexCompact, ValidatorPrefs, ValidatorPrefsTo145, ValidatorPrefsTo196, ValidatorPrefsWithBlocked, ValidatorPrefsWithCommission, VoteWeight, Voter } from '@polkadot/types/interfaces/staking'; -import type { ApiId, BlockTrace, BlockTraceEvent, BlockTraceEventData, BlockTraceSpan, KeyValueOption, MigrationStatusResult, ReadProof, RuntimeVersion, RuntimeVersionApi, RuntimeVersionPartial, SpecVersion, StorageChangeSet, TraceBlockResponse, TraceError } from '@polkadot/types/interfaces/state'; +import type { ApiId, BlockTrace, BlockTraceEvent, BlockTraceEventData, BlockTraceSpan, KeyValueOption, MigrationStatusResult, ReadProof, RuntimeVersion, RuntimeVersionApi, RuntimeVersionPartial, RuntimeVersionPre3, RuntimeVersionPre4, SpecVersion, StorageChangeSet, TraceBlockResponse, TraceError } from '@polkadot/types/interfaces/state'; import type { WeightToFeeCoefficient } from '@polkadot/types/interfaces/support'; -import type { AccountInfo, AccountInfoWithDualRefCount, AccountInfoWithProviders, AccountInfoWithRefCount, AccountInfoWithRefCountU8, AccountInfoWithTripleRefCount, ApplyExtrinsicResult, ArithmeticError, BlockLength, BlockWeights, ChainProperties, ChainType, ConsumedWeight, DigestOf, DispatchClass, DispatchError, DispatchErrorModule, DispatchErrorModuleU8, DispatchErrorModuleU8a, DispatchErrorTo198, DispatchInfo, DispatchInfoTo190, DispatchInfoTo244, DispatchOutcome, DispatchResult, DispatchResultOf, DispatchResultTo198, Event, EventId, EventIndex, EventRecord, Health, InvalidTransaction, Key, LastRuntimeUpgradeInfo, NetworkState, NetworkStatePeerset, NetworkStatePeersetInfo, NodeRole, NotConnectedPeer, Peer, PeerEndpoint, PeerEndpointAddr, PeerInfo, PeerPing, PerDispatchClassU32, PerDispatchClassWeight, PerDispatchClassWeightsPerClass, Phase, RawOrigin, RefCount, RefCountTo259, SyncState, SystemOrigin, TokenError, TransactionValidityError, TransactionalError, UnknownTransaction, WeightPerClass } from '@polkadot/types/interfaces/system'; +import type { AccountInfo, AccountInfoWithDualRefCount, AccountInfoWithProviders, AccountInfoWithRefCount, AccountInfoWithRefCountU8, AccountInfoWithTripleRefCount, ApplyExtrinsicResult, ApplyExtrinsicResultPre6, ArithmeticError, BlockLength, BlockWeights, ChainProperties, ChainType, ConsumedWeight, DigestOf, DispatchClass, DispatchError, DispatchErrorModule, DispatchErrorModulePre6, DispatchErrorModuleU8, DispatchErrorModuleU8a, DispatchErrorPre6, DispatchErrorTo198, DispatchInfo, DispatchInfoTo190, DispatchInfoTo244, DispatchOutcome, DispatchOutcomePre6, DispatchResult, DispatchResultOf, DispatchResultTo198, Event, EventId, EventIndex, EventRecord, Health, InvalidTransaction, Key, LastRuntimeUpgradeInfo, NetworkState, NetworkStatePeerset, NetworkStatePeersetInfo, NodeRole, NotConnectedPeer, Peer, PeerEndpoint, PeerEndpointAddr, PeerInfo, PeerPing, PerDispatchClassU32, PerDispatchClassWeight, PerDispatchClassWeightsPerClass, Phase, RawOrigin, RefCount, RefCountTo259, SyncState, SystemOrigin, TokenError, TransactionValidityError, TransactionalError, UnknownTransaction, WeightPerClass } from '@polkadot/types/interfaces/system'; import type { Bounty, BountyIndex, BountyStatus, BountyStatusActive, BountyStatusCuratorProposed, BountyStatusPendingPayout, OpenTip, OpenTipFinderTo225, OpenTipTip, OpenTipTo225, TreasuryProposal } from '@polkadot/types/interfaces/treasury'; import type { Multiplier } from '@polkadot/types/interfaces/txpayment'; import type { TransactionSource, TransactionValidity, ValidTransaction } from '@polkadot/types/interfaces/txqueue'; @@ -97,6 +97,7 @@ declare module '@polkadot/types/types/registry' { AnySignature: AnySignature; ApiId: ApiId; ApplyExtrinsicResult: ApplyExtrinsicResult; + ApplyExtrinsicResultPre6: ApplyExtrinsicResultPre6; ApprovalFlag: ApprovalFlag; Approvals: Approvals; ArithmeticError: ArithmeticError; @@ -321,14 +322,17 @@ declare module '@polkadot/types/types/registry' { DispatchClass: DispatchClass; DispatchError: DispatchError; DispatchErrorModule: DispatchErrorModule; + DispatchErrorModulePre6: DispatchErrorModulePre6; DispatchErrorModuleU8: DispatchErrorModuleU8; DispatchErrorModuleU8a: DispatchErrorModuleU8a; + DispatchErrorPre6: DispatchErrorPre6; DispatchErrorTo198: DispatchErrorTo198; DispatchFeePayment: DispatchFeePayment; DispatchInfo: DispatchInfo; DispatchInfoTo190: DispatchInfoTo190; DispatchInfoTo244: DispatchInfoTo244; DispatchOutcome: DispatchOutcome; + DispatchOutcomePre6: DispatchOutcomePre6; DispatchResult: DispatchResult; DispatchResultOf: DispatchResultOf; DispatchResultTo198: DispatchResultTo198; @@ -861,6 +865,8 @@ declare module '@polkadot/types/types/registry' { RuntimeVersion: RuntimeVersion; RuntimeVersionApi: RuntimeVersionApi; RuntimeVersionPartial: RuntimeVersionPartial; + RuntimeVersionPre3: RuntimeVersionPre3; + RuntimeVersionPre4: RuntimeVersionPre4; Schedule: Schedule; Scheduled: Scheduled; ScheduledCore: ScheduledCore; diff --git a/packages/types/src/interfaces/blockbuilder/runtime.ts b/packages/types/src/interfaces/blockbuilder/runtime.ts index 74a8134def..72341c6e11 100644 --- a/packages/types/src/interfaces/blockbuilder/runtime.ts +++ b/packages/types/src/interfaces/blockbuilder/runtime.ts @@ -1,12 +1,46 @@ // Copyright 2017-2022 @polkadot/types authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { DefinitionsCall } from '../../types'; +import type { DefinitionsCall, DefinitionsCallEntry } from '../../types'; + +import { objectSpread } from '@polkadot/util'; + +const BB_V5_TO_V6: DefinitionsCallEntry['methods'] = { + check_inherents: { + description: 'Check that the inherents are valid.', + params: [ + { + name: 'block', + type: 'Block' + }, + { + name: 'data', + type: 'InherentData' + } + ], + type: 'CheckInherentsResult' + }, + finalize_block: { + description: 'Finish the current block.', + params: [], + type: 'Header' + }, + inherent_extrinsics: { + description: 'Generate inherent extrinsics.', + params: [ + { + name: 'inherent', + type: 'InherentData' + } + ], + type: 'Vec' + } +}; export const runtime: DefinitionsCall = { BlockBuilder: [ { - methods: { + methods: objectSpread({ apply_extrinsic: { description: 'Apply the given extrinsic.', params: [ @@ -16,38 +50,24 @@ export const runtime: DefinitionsCall = { } ], type: 'ApplyExtrinsicResult' - }, - check_inherents: { - description: 'Check that the inherents are valid.', - params: [ - { - name: 'block', - type: 'Block' - }, - { - name: 'data', - type: 'InherentData' - } - ], - type: 'CheckInherentsResult' - }, - finalize_block: { - description: 'Finish the current block.', - params: [], - type: 'Header' - }, - inherent_extrinsics: { - description: 'Generate inherent extrinsics.', - params: [ - { - name: 'inherent', - type: 'InherentData' - } - ], - type: 'Vec' } - }, + }, BB_V5_TO_V6), version: 6 + }, + { + methods: objectSpread({ + apply_extrinsic: { + description: 'Apply the given extrinsic.', + params: [ + { + name: 'extrinsic', + type: 'Extrinsic' + } + ], + type: 'ApplyExtrinsicResultPre6' + } + }, BB_V5_TO_V6), + version: 5 } ] }; diff --git a/packages/types/src/interfaces/runtime/runtime.ts b/packages/types/src/interfaces/runtime/runtime.ts index aac58a5c9d..74677f921b 100644 --- a/packages/types/src/interfaces/runtime/runtime.ts +++ b/packages/types/src/interfaces/runtime/runtime.ts @@ -1,23 +1,73 @@ // Copyright 2017-2022 @polkadot/types authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { DefinitionsCall } from '../../types'; +import type { DefinitionsCall, DefinitionsCallEntry } from '../../types'; + +import { objectSpread } from '@polkadot/util'; + +const CORE_V1_TO_V4: DefinitionsCallEntry['methods'] = { + execute_block: { + description: 'Execute the given block.', + params: [ + { + name: 'block', + type: 'Block' + } + ], + type: 'Null' + } +}; + +const CORE_V1_TO_V2: DefinitionsCallEntry['methods'] = { + version: { + description: 'Returns the version of the runtime.', + params: [], + type: 'RuntimeVersionPre3' + } +}; + +const CORE_V2_TO_V4: DefinitionsCallEntry['methods'] = { + initialize_block: { + description: 'Initialize a block with the given header.', + params: [ + { + name: 'header', + type: 'Header' + } + ], + type: 'Null' + } +}; export const runtime: DefinitionsCall = { Core: [ { - methods: { - execute_block: { - description: 'Execute the given block.', - params: [ - { - name: 'block', - type: 'Block' - } - ], - type: 'Null' - }, - initialize_block: { + methods: objectSpread({ + version: { + description: 'Returns the version of the runtime.', + params: [], + type: 'RuntimeVersion' + } + }, CORE_V1_TO_V4, CORE_V2_TO_V4), + version: 4 + }, + { + methods: objectSpread({ + version: { + description: 'Returns the version of the runtime.', + params: [], + type: 'RuntimeVersionPre4' + } + }, CORE_V1_TO_V4, CORE_V2_TO_V4), + version: 3 + }, + { + methods: objectSpread({}, CORE_V1_TO_V2, CORE_V1_TO_V4, CORE_V2_TO_V4), + version: 2 + }, + { + methods: objectSpread({ + initialise_block: { description: 'Initialize a block with the given header.', params: [ { @@ -26,14 +76,9 @@ export const runtime: DefinitionsCall = { } ], type: 'Null' - }, - version: { - description: 'Returns the version of the runtime.', - params: [], - type: 'RuntimeVersion' } - }, - version: 4 + }, CORE_V1_TO_V2, CORE_V1_TO_V4), + version: 1 } ], TryRuntime: [ diff --git a/packages/types/src/interfaces/state/definitions.ts b/packages/types/src/interfaces/state/definitions.ts index e11048644d..8801062f21 100644 --- a/packages/types/src/interfaces/state/definitions.ts +++ b/packages/types/src/interfaces/state/definitions.ts @@ -46,6 +46,16 @@ export default { }, RuntimeVersionApi: '(ApiId, u32)', RuntimeVersion: { + specName: 'Text', + implName: 'Text', + authoringVersion: 'u32', + specVersion: 'u32', + implVersion: 'u32', + apis: 'Vec', + transactionVersion: 'u32', + stateVersion: 'u8' + }, + RuntimeVersionPre4: { specName: 'Text', implName: 'Text', authoringVersion: 'u32', @@ -54,6 +64,14 @@ export default { apis: 'Vec', transactionVersion: 'u32' }, + RuntimeVersionPre3: { + specName: 'Text', + implName: 'Text', + authoringVersion: 'u32', + specVersion: 'u32', + implVersion: 'u32', + apis: 'Vec' + }, RuntimeVersionPartial: { specName: 'Text', specVersion: 'u32', diff --git a/packages/types/src/interfaces/state/types.ts b/packages/types/src/interfaces/state/types.ts index 3f0b8c2e04..2b7d8c690b 100644 --- a/packages/types/src/interfaces/state/types.ts +++ b/packages/types/src/interfaces/state/types.ts @@ -2,7 +2,7 @@ /* eslint-disable */ import type { StorageKey } from '@polkadot/types'; -import type { Bytes, Enum, HashMap, Option, Struct, Text, U8aFixed, Vec, bool, u32, u64 } from '@polkadot/types-codec'; +import type { Bytes, Enum, HashMap, Option, Struct, Text, U8aFixed, Vec, bool, u32, u64, u8 } from '@polkadot/types-codec'; import type { ITuple } from '@polkadot/types-codec/types'; import type { Hash, StorageData } from '@polkadot/types/interfaces/runtime'; @@ -64,6 +64,7 @@ export interface RuntimeVersion extends Struct { readonly implVersion: u32; readonly apis: Vec; readonly transactionVersion: u32; + readonly stateVersion: u8; } /** @name RuntimeVersionApi */ @@ -76,6 +77,27 @@ export interface RuntimeVersionPartial extends Struct { readonly apis: Vec; } +/** @name RuntimeVersionPre3 */ +export interface RuntimeVersionPre3 extends Struct { + readonly specName: Text; + readonly implName: Text; + readonly authoringVersion: u32; + readonly specVersion: u32; + readonly implVersion: u32; + readonly apis: Vec; +} + +/** @name RuntimeVersionPre4 */ +export interface RuntimeVersionPre4 extends Struct { + readonly specName: Text; + readonly implName: Text; + readonly authoringVersion: u32; + readonly specVersion: u32; + readonly implVersion: u32; + readonly apis: Vec; + readonly transactionVersion: u32; +} + /** @name SpecVersion */ export interface SpecVersion extends u32 {} diff --git a/packages/types/src/interfaces/system/definitions.ts b/packages/types/src/interfaces/system/definitions.ts index 505235ff9b..6afce6fc8a 100644 --- a/packages/types/src/interfaces/system/definitions.ts +++ b/packages/types/src/interfaces/system/definitions.ts @@ -43,6 +43,7 @@ export default { data: 'AccountData' }, ApplyExtrinsicResult: 'Result', + ApplyExtrinsicResultPre6: 'Result', ArithmeticError: { _enum: [ 'Underflow', @@ -86,6 +87,20 @@ export default { Transactional: 'TransactionalError' } }, + DispatchErrorPre6: { + _enum: { + Other: 'Null', + CannotLookup: 'Null', + BadOrigin: 'Null', + Module: 'DispatchErrorModulePre6', + ConsumerRemaining: 'Null', + NoProviders: 'Null', + TooManyConsumers: 'Null', + Token: 'TokenError', + Arithmetic: 'ArithmeticError', + Transactional: 'TransactionalError' + } + }, DispatchErrorModuleU8: { index: 'u8', error: 'u8' @@ -95,6 +110,7 @@ export default { error: '[u8; 4]' }, DispatchErrorModule: 'DispatchErrorModuleU8a', + DispatchErrorModulePre6: 'DispatchErrorModuleU8', DispatchErrorTo198: { module: 'Option', error: 'u8' @@ -114,6 +130,7 @@ export default { paysFee: 'bool' }, DispatchOutcome: 'Result<(), DispatchError>', + DispatchOutcomePre6: 'Result<(), DispatchErrorPre6>', DispatchResult: 'Result<(), DispatchError>', DispatchResultOf: 'DispatchResult', DispatchResultTo198: 'Result<(), Text>', diff --git a/packages/types/src/interfaces/system/types.ts b/packages/types/src/interfaces/system/types.ts index e4ca77492f..88c7447f42 100644 --- a/packages/types/src/interfaces/system/types.ts +++ b/packages/types/src/interfaces/system/types.ts @@ -56,6 +56,18 @@ export interface ApplyExtrinsicResult extends Result { + readonly isErr: boolean; + readonly asErr: TransactionValidityError; + /** @deprecated Use isErr */ + readonly isError: boolean; + /** @deprecated Use asErr */ + readonly asError: TransactionValidityError; + readonly isOk: boolean; + readonly asOk: DispatchOutcomePre6; +} + /** @name ArithmeticError */ export interface ArithmeticError extends Enum { readonly isUnderflow: boolean; @@ -125,6 +137,9 @@ export interface DispatchError extends Enum { /** @name DispatchErrorModule */ export interface DispatchErrorModule extends DispatchErrorModuleU8a {} +/** @name DispatchErrorModulePre6 */ +export interface DispatchErrorModulePre6 extends DispatchErrorModuleU8 {} + /** @name DispatchErrorModuleU8 */ export interface DispatchErrorModuleU8 extends Struct { readonly index: u8; @@ -137,6 +152,25 @@ export interface DispatchErrorModuleU8a extends Struct { readonly error: U8aFixed; } +/** @name DispatchErrorPre6 */ +export interface DispatchErrorPre6 extends Enum { + readonly isOther: boolean; + readonly isCannotLookup: boolean; + readonly isBadOrigin: boolean; + readonly isModule: boolean; + readonly asModule: DispatchErrorModulePre6; + readonly isConsumerRemaining: boolean; + readonly isNoProviders: boolean; + readonly isTooManyConsumers: boolean; + readonly isToken: boolean; + readonly asToken: TokenError; + readonly isArithmetic: boolean; + readonly asArithmetic: ArithmeticError; + readonly isTransactional: boolean; + readonly asTransactional: TransactionalError; + readonly type: 'Other' | 'CannotLookup' | 'BadOrigin' | 'Module' | 'ConsumerRemaining' | 'NoProviders' | 'TooManyConsumers' | 'Token' | 'Arithmetic' | 'Transactional'; +} + /** @name DispatchErrorTo198 */ export interface DispatchErrorTo198 extends Struct { readonly module: Option; @@ -175,6 +209,18 @@ export interface DispatchOutcome extends Result, DispatchError> { readonly asOk: ITuple<[]>; } +/** @name DispatchOutcomePre6 */ +export interface DispatchOutcomePre6 extends Result, DispatchErrorPre6> { + readonly isErr: boolean; + readonly asErr: DispatchErrorPre6; + /** @deprecated Use isErr */ + readonly isError: boolean; + /** @deprecated Use asErr */ + readonly asError: DispatchErrorPre6; + readonly isOk: boolean; + readonly asOk: ITuple<[]>; +} + /** @name DispatchResult */ export interface DispatchResult extends Result, DispatchError> { readonly isErr: boolean;