Metadata V11 (#1774)
* Make a start ... V11 definitions * V11 conversion * Fix ErrorMetadataV11 * Extension point for signed extensions * Add V11 to mapped * Expand toLatest comments
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 { MetadataAll, MetadataLatest, MetadataV0, MetadataV1, MetadataV2, MetadataV3, MetadataV4, MetadataV5, MetadataV6, MetadataV7, MetadataV8, MetadataV9, MetadataV10 } from '@polkadot/types/interfaces/metadata';
|
||||
import { MetadataAll, MetadataLatest, MetadataV0, MetadataV1, MetadataV2, MetadataV3, MetadataV4, MetadataV5, MetadataV6, MetadataV7, MetadataV8, MetadataV9, MetadataV10, MetadataV11 } from '@polkadot/types/interfaces/metadata';
|
||||
import { Registry } from '@polkadot/types/types';
|
||||
|
||||
import { createType } from '@polkadot/types/codec/create/createType';
|
||||
@@ -20,12 +20,13 @@ import v6ToV7 from './v6/toV7';
|
||||
import v7ToV8 from './v7/toV8';
|
||||
import v8ToV9 from './v8/toV9';
|
||||
import v9ToV10 from './v9/toV10';
|
||||
import v10ToLatest from './v10/toLatest';
|
||||
import v10ToV11 from './v10/toV11';
|
||||
import v11ToLatest from './v11/toLatest';
|
||||
import { getUniqTypes, toCallsOnly } from './util';
|
||||
|
||||
type MetaMapped = MetadataV0 | MetadataV1 | MetadataV2 | MetadataV3 | MetadataV4 | MetadataV5 | MetadataV6 | MetadataV7 | MetadataV8 | MetadataV9 | MetadataV10;
|
||||
type MetaVersions = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11;
|
||||
type MetaAsX = 'asV0' | 'asV1' | 'asV2' | 'asV3' | 'asV4' | 'asV5' | 'asV6' | 'asV7' | 'asV8' | 'asV9' | 'asV10';
|
||||
type MetaMapped = MetadataV0 | MetadataV1 | MetadataV2 | MetadataV3 | MetadataV4 | MetadataV5 | MetadataV6 | MetadataV7 | MetadataV8 | MetadataV9 | MetadataV10 | MetadataV11;
|
||||
type MetaVersions = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
|
||||
type MetaAsX = 'asV0' | 'asV1' | 'asV2' | 'asV3' | 'asV4' | 'asV5' | 'asV6' | 'asV7' | 'asV8' | 'asV9' | 'asV10' | 'asV11';
|
||||
|
||||
/**
|
||||
* @name MetadataVersioned
|
||||
@@ -154,12 +155,19 @@ export default class MetadataVersioned extends Struct {
|
||||
return this.getVersion(10, v9ToV10);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Returns the wrapped values as a V10 object
|
||||
*/
|
||||
public get asV11 (): MetadataV11 {
|
||||
return this.getVersion(11, v10ToV11);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Returns the wrapped values as a latest version object
|
||||
*/
|
||||
public get asLatest (): MetadataLatest {
|
||||
// 11 is non-existent & latest - applied here to do to the type conversions
|
||||
return this.getVersion(11, v10ToLatest);
|
||||
// This is non-existent & latest - applied here to do the module-specific type conversions
|
||||
return this.getVersion(12, v11ToLatest);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import metadata from './v10/static';
|
||||
import metadata from './v11/static';
|
||||
|
||||
export default metadata;
|
||||
|
||||
@@ -8,12 +8,13 @@ import { AnyJsonObject, Registry } from '@polkadot/types/types';
|
||||
import { createType } from '@polkadot/types';
|
||||
|
||||
/** @internal */
|
||||
export default function toCallsOnly (registry: Registry, { modules }: MetadataLatest): AnyJsonObject | string {
|
||||
export default function toCallsOnly (registry: Registry, { extrinsic, modules }: MetadataLatest): AnyJsonObject | string {
|
||||
return createType(registry, 'MetadataLatest', {
|
||||
// FIXME, this needs typing, not any
|
||||
modules: modules.map(({ calls, name }): any => ({
|
||||
name,
|
||||
calls
|
||||
}))
|
||||
})),
|
||||
extrinsic
|
||||
}).toJSON();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
// Copyright 2017-2020 @polkadot/metadata 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 { MetadataV10, MetadataV11 } from '@polkadot/types/interfaces/metadata';
|
||||
import { Registry } from '@polkadot/types/types';
|
||||
|
||||
import { createType } from '@polkadot/types';
|
||||
|
||||
/** @internal */
|
||||
export default function toV11 (registry: Registry, { modules }: MetadataV10): MetadataV11 {
|
||||
return createType(registry, 'MetadataV11', {
|
||||
modules,
|
||||
// This is new in V11, pass V0 here - something non-existing, telling the API to use
|
||||
// the fallback for this information (on-chain detection)
|
||||
extrinsic: {
|
||||
version: 0,
|
||||
signedExtensions: []
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
// Copyright 2017-2020 @polkadot/metadata 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 { TypeRegistry } from '@polkadot/types';
|
||||
|
||||
import substrateJson from './static-substrate.json';
|
||||
import substrateData from './static';
|
||||
import { decodeLatestSubstrate, defaultValues, toLatest } from '../util/testUtil';
|
||||
|
||||
describe('MetadataV10 (substrate)', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
decodeLatestSubstrate(registry, 11, substrateData, substrateJson);
|
||||
|
||||
toLatest(registry, 11, substrateData);
|
||||
|
||||
defaultValues(registry, substrateData);
|
||||
});
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
+39
-27
@@ -3,13 +3,19 @@
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { OverrideModuleType } from '@polkadot/types/known/types';
|
||||
import { FunctionMetadataV10, FunctionMetadataLatest, MetadataV10, MetadataLatest, ModuleMetadataV10, ModuleMetadataLatest, StorageMetadataV10, StorageMetadataLatest, StorageEntryMetadataLatest } from '@polkadot/types/interfaces/metadata';
|
||||
import { FunctionMetadataV11, FunctionMetadataLatest, MetadataV11, MetadataLatest, ModuleMetadataLatest, StorageMetadataV11, StorageMetadataLatest, StorageEntryMetadataLatest } from '@polkadot/types/interfaces/metadata';
|
||||
import { Registry } from '@polkadot/types/types';
|
||||
|
||||
import { getModuleTypes } from '@polkadot/types/known';
|
||||
import { Type, createType } from '@polkadot/types';
|
||||
import { stringCamelCase } from '@polkadot/util';
|
||||
|
||||
// TODO Handle consts as well
|
||||
|
||||
/**
|
||||
* Find and apply the correct type override
|
||||
* @internal
|
||||
**/
|
||||
function setTypeOverride (sectionTypes: OverrideModuleType, type: Type): void {
|
||||
const override = Object.keys(sectionTypes).find((aliased): boolean => type.eq(aliased));
|
||||
|
||||
@@ -18,9 +24,11 @@ function setTypeOverride (sectionTypes: OverrideModuleType, type: Type): void {
|
||||
}
|
||||
}
|
||||
|
||||
// apply module-specific type overrides (always be done as part of toLatest)
|
||||
/** @internal */
|
||||
function convertCalls (registry: Registry, calls: FunctionMetadataV10[], sectionTypes: OverrideModuleType): FunctionMetadataLatest[] {
|
||||
/**
|
||||
* Apply module-specific type overrides (always be done as part of toLatest)
|
||||
* @internal
|
||||
**/
|
||||
function convertCalls (registry: Registry, calls: FunctionMetadataV11[], sectionTypes: OverrideModuleType): FunctionMetadataLatest[] {
|
||||
return calls.map(({ args, documentation, name }): FunctionMetadataLatest => {
|
||||
args.forEach(({ type }): void => setTypeOverride(sectionTypes, type));
|
||||
|
||||
@@ -28,9 +36,11 @@ function convertCalls (registry: Registry, calls: FunctionMetadataV10[], section
|
||||
});
|
||||
}
|
||||
|
||||
// apply module-specific storage type overrides (always part of toLatest)
|
||||
/** @internal */
|
||||
function convertStorage (registry: Registry, { items, prefix }: StorageMetadataV10, sectionTypes: OverrideModuleType): StorageMetadataLatest {
|
||||
/**
|
||||
* Apply module-specific storage type overrides (always part of toLatest)
|
||||
* @internal
|
||||
**/
|
||||
function convertStorage (registry: Registry, { items, prefix }: StorageMetadataV11, sectionTypes: OverrideModuleType): StorageMetadataLatest {
|
||||
return createType(registry, 'StorageMetadataLatest', {
|
||||
items: items.map(({ documentation, fallback, modifier, name, type }): StorageEntryMetadataLatest => {
|
||||
let resultType: Type;
|
||||
@@ -51,26 +61,28 @@ function convertStorage (registry: Registry, { items, prefix }: StorageMetadataV
|
||||
});
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
function convertModule (registry: Registry, mod: ModuleMetadataV10): ModuleMetadataLatest {
|
||||
const calls = mod.calls.unwrapOr(null);
|
||||
const storage = mod.storage.unwrapOr(null);
|
||||
const sectionTypes = getModuleTypes(stringCamelCase(mod.name.toString()));
|
||||
|
||||
return createType(registry, 'ModuleMetadataLatest', {
|
||||
...mod,
|
||||
calls: calls
|
||||
? convertCalls(registry, calls, sectionTypes)
|
||||
: null,
|
||||
storage: storage
|
||||
? convertStorage(registry, storage, sectionTypes)
|
||||
: null
|
||||
});
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export default function toLatest (registry: Registry, { modules }: MetadataV10): MetadataLatest {
|
||||
/**
|
||||
* Convert the Metadata (which is an alias) to latest - effectively this _always_ get applied to the top-level &
|
||||
* most-recent metadata, since it allows us a chance to actually apply call and storage specific type aliasses
|
||||
* @internal
|
||||
**/
|
||||
export default function toLatest (registry: Registry, { modules, extrinsic }: MetadataV11): MetadataLatest {
|
||||
return createType(registry, 'MetadataLatest', {
|
||||
modules: modules.map((mod): ModuleMetadataLatest => convertModule(registry, mod))
|
||||
modules: modules.map((mod): ModuleMetadataLatest => {
|
||||
const calls = mod.calls.unwrapOr(null);
|
||||
const storage = mod.storage.unwrapOr(null);
|
||||
const sectionTypes = getModuleTypes(stringCamelCase(mod.name.toString()));
|
||||
|
||||
return createType(registry, 'ModuleMetadataLatest', {
|
||||
...mod,
|
||||
calls: calls
|
||||
? convertCalls(registry, calls, sectionTypes)
|
||||
: null,
|
||||
storage: storage
|
||||
? convertStorage(registry, storage, sectionTypes)
|
||||
: null
|
||||
});
|
||||
}),
|
||||
extrinsic
|
||||
});
|
||||
}
|
||||
@@ -31,7 +31,7 @@ import { Multisig, Timepoint } from '@polkadot/types/interfaces/utility';
|
||||
import { BlockAttestations, IncludedBlocks, MoreAttestations } from '@polkadot/types/interfaces/attestations';
|
||||
import { EthereumAddress } from '@polkadot/types/interfaces/claims';
|
||||
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, DoubleMapTypeLatest, DoubleMapTypeV10, DoubleMapTypeV3, DoubleMapTypeV4, DoubleMapTypeV5, DoubleMapTypeV6, DoubleMapTypeV7, DoubleMapTypeV8, DoubleMapTypeV9, ErrorMetadataV10, ErrorMetadataV8, ErrorMetadataV9, EventMetadataLatest, EventMetadataV0, EventMetadataV1, EventMetadataV10, EventMetadataV2, EventMetadataV3, EventMetadataV4, EventMetadataV5, EventMetadataV6, EventMetadataV7, EventMetadataV8, EventMetadataV9, FunctionArgumentMetadataLatest, FunctionArgumentMetadataV0, FunctionArgumentMetadataV1, FunctionArgumentMetadataV10, FunctionArgumentMetadataV2, FunctionArgumentMetadataV3, FunctionArgumentMetadataV4, FunctionArgumentMetadataV5, FunctionArgumentMetadataV6, FunctionArgumentMetadataV7, FunctionArgumentMetadataV8, FunctionArgumentMetadataV9, FunctionMetadataLatest, FunctionMetadataV0, FunctionMetadataV1, FunctionMetadataV10, FunctionMetadataV2, FunctionMetadataV3, FunctionMetadataV4, FunctionMetadataV5, FunctionMetadataV6, FunctionMetadataV7, FunctionMetadataV8, FunctionMetadataV9, MapTypeLatest, MapTypeV0, MapTypeV10, MapTypeV2, MapTypeV3, MapTypeV4, MapTypeV5, MapTypeV6, MapTypeV7, MapTypeV8, MapTypeV9, MetadataAll, MetadataLatest, MetadataV0, MetadataV1, MetadataV10, MetadataV2, MetadataV3, MetadataV4, MetadataV5, MetadataV6, MetadataV7, MetadataV8, MetadataV9, ModuleConstantMetadataLatest, ModuleConstantMetadataV10, ModuleConstantMetadataV6, ModuleConstantMetadataV7, ModuleConstantMetadataV8, ModuleConstantMetadataV9, ModuleMetadataLatest, ModuleMetadataV0, ModuleMetadataV1, ModuleMetadataV10, ModuleMetadataV2, ModuleMetadataV3, ModuleMetadataV4, ModuleMetadataV5, ModuleMetadataV6, ModuleMetadataV7, ModuleMetadataV8, ModuleMetadataV9, OuterDispatchCallV0, OuterDispatchMetadataV0, OuterEventEventMetadataEventsV0, OuterEventEventMetadataV0, OuterEventMetadataV0, PlainTypeLatest, PlainTypeV0, PlainTypeV10, PlainTypeV2, PlainTypeV3, PlainTypeV4, PlainTypeV5, PlainTypeV6, PlainTypeV7, PlainTypeV8, PlainTypeV9, RuntimeModuleMetadataV0, StorageEntryMetadataLatest, StorageEntryMetadataV10, StorageEntryMetadataV6, StorageEntryMetadataV7, StorageEntryMetadataV8, StorageEntryMetadataV9, StorageEntryModifierLatest, StorageEntryModifierV10, StorageEntryModifierV6, StorageEntryModifierV7, StorageEntryModifierV8, StorageEntryModifierV9, StorageEntryTypeLatest, StorageEntryTypeV10, StorageEntryTypeV6, StorageEntryTypeV7, StorageEntryTypeV8, StorageEntryTypeV9, StorageFunctionMetadataV0, StorageFunctionMetadataV1, StorageFunctionMetadataV2, StorageFunctionMetadataV3, StorageFunctionMetadataV4, StorageFunctionMetadataV5, StorageFunctionModifierV0, StorageFunctionModifierV1, StorageFunctionModifierV2, StorageFunctionModifierV3, StorageFunctionModifierV4, StorageFunctionModifierV5, StorageFunctionTypeV0, StorageFunctionTypeV1, StorageFunctionTypeV2, StorageFunctionTypeV3, StorageFunctionTypeV4, StorageFunctionTypeV5, StorageHasher, StorageHasherV10, StorageHasherV4, StorageHasherV5, StorageHasherV6, StorageHasherV7, StorageHasherV8, StorageHasherV9, StorageMetadataLatest, StorageMetadataV0, StorageMetadataV10, StorageMetadataV7, StorageMetadataV8, StorageMetadataV9 } from '@polkadot/types/interfaces/metadata';
|
||||
import { CallMetadataV0, DoubleMapTypeLatest, DoubleMapTypeV10, DoubleMapTypeV11, DoubleMapTypeV3, DoubleMapTypeV4, DoubleMapTypeV5, DoubleMapTypeV6, DoubleMapTypeV7, DoubleMapTypeV8, DoubleMapTypeV9, ErrorMetadataV10, ErrorMetadataV11, ErrorMetadataV8, ErrorMetadataV9, EventMetadataLatest, EventMetadataV0, EventMetadataV1, EventMetadataV10, EventMetadataV11, EventMetadataV2, EventMetadataV3, EventMetadataV4, EventMetadataV5, EventMetadataV6, EventMetadataV7, EventMetadataV8, EventMetadataV9, ExtrinsicMetadataLatest, ExtrinsicMetadataV11, FunctionArgumentMetadataLatest, FunctionArgumentMetadataV0, FunctionArgumentMetadataV1, FunctionArgumentMetadataV10, FunctionArgumentMetadataV11, FunctionArgumentMetadataV2, FunctionArgumentMetadataV3, FunctionArgumentMetadataV4, FunctionArgumentMetadataV5, FunctionArgumentMetadataV6, FunctionArgumentMetadataV7, FunctionArgumentMetadataV8, FunctionArgumentMetadataV9, FunctionMetadataLatest, FunctionMetadataV0, FunctionMetadataV1, FunctionMetadataV10, FunctionMetadataV11, FunctionMetadataV2, FunctionMetadataV3, FunctionMetadataV4, FunctionMetadataV5, FunctionMetadataV6, FunctionMetadataV7, FunctionMetadataV8, FunctionMetadataV9, MapTypeLatest, MapTypeV0, MapTypeV10, MapTypeV11, MapTypeV2, MapTypeV3, MapTypeV4, MapTypeV5, MapTypeV6, MapTypeV7, MapTypeV8, MapTypeV9, MetadataAll, MetadataLatest, MetadataV0, MetadataV1, MetadataV10, MetadataV11, MetadataV2, MetadataV3, MetadataV4, MetadataV5, MetadataV6, MetadataV7, MetadataV8, MetadataV9, ModuleConstantMetadataLatest, ModuleConstantMetadataV10, ModuleConstantMetadataV11, ModuleConstantMetadataV6, ModuleConstantMetadataV7, ModuleConstantMetadataV8, ModuleConstantMetadataV9, ModuleMetadataLatest, ModuleMetadataV0, ModuleMetadataV1, ModuleMetadataV10, ModuleMetadataV11, ModuleMetadataV2, ModuleMetadataV3, ModuleMetadataV4, ModuleMetadataV5, ModuleMetadataV6, ModuleMetadataV7, ModuleMetadataV8, ModuleMetadataV9, OuterDispatchCallV0, OuterDispatchMetadataV0, OuterEventEventMetadataEventsV0, OuterEventEventMetadataV0, OuterEventMetadataV0, PlainTypeLatest, PlainTypeV0, PlainTypeV10, PlainTypeV11, PlainTypeV2, PlainTypeV3, PlainTypeV4, PlainTypeV5, PlainTypeV6, PlainTypeV7, PlainTypeV8, PlainTypeV9, RuntimeModuleMetadataV0, StorageEntryMetadataLatest, StorageEntryMetadataV10, StorageEntryMetadataV11, StorageEntryMetadataV6, StorageEntryMetadataV7, StorageEntryMetadataV8, StorageEntryMetadataV9, StorageEntryModifierLatest, StorageEntryModifierV10, StorageEntryModifierV11, StorageEntryModifierV6, StorageEntryModifierV7, StorageEntryModifierV8, StorageEntryModifierV9, StorageEntryTypeLatest, StorageEntryTypeV10, StorageEntryTypeV11, StorageEntryTypeV6, StorageEntryTypeV7, StorageEntryTypeV8, StorageEntryTypeV9, StorageFunctionMetadataV0, StorageFunctionMetadataV1, StorageFunctionMetadataV2, StorageFunctionMetadataV3, StorageFunctionMetadataV4, StorageFunctionMetadataV5, StorageFunctionModifierV0, StorageFunctionModifierV1, StorageFunctionModifierV2, StorageFunctionModifierV3, StorageFunctionModifierV4, StorageFunctionModifierV5, StorageFunctionTypeV0, StorageFunctionTypeV1, StorageFunctionTypeV2, StorageFunctionTypeV3, StorageFunctionTypeV4, StorageFunctionTypeV5, StorageHasher, StorageHasherV10, StorageHasherV11, StorageHasherV4, StorageHasherV5, StorageHasherV6, StorageHasherV7, StorageHasherV8, StorageHasherV9, StorageMetadataLatest, StorageMetadataV0, StorageMetadataV10, StorageMetadataV11, StorageMetadataV7, StorageMetadataV8, StorageMetadataV9 } from '@polkadot/types/interfaces/metadata';
|
||||
import { ApiId, BlockHash, ChainProperties, ExtrinsicOrHash, ExtrinsicStatus, Health, KeyValueOption, NetworkState, PeerInfo, RpcMethods, RuntimeDispatchInfo, RuntimeVersion, RuntimeVersionApi, StorageChangeSet } from '@polkadot/types/interfaces/rpc';
|
||||
|
||||
export interface InterfaceRegistry {
|
||||
@@ -1344,12 +1344,63 @@ export interface InterfaceRegistry {
|
||||
StorageHasherV10: StorageHasherV10;
|
||||
'Option<StorageHasherV10>': Option<StorageHasherV10>;
|
||||
'Vec<StorageHasherV10>': Vec<StorageHasherV10>;
|
||||
DoubleMapTypeV11: DoubleMapTypeV11;
|
||||
'Option<DoubleMapTypeV11>': Option<DoubleMapTypeV11>;
|
||||
'Vec<DoubleMapTypeV11>': Vec<DoubleMapTypeV11>;
|
||||
ErrorMetadataV11: ErrorMetadataV11;
|
||||
'Option<ErrorMetadataV11>': Option<ErrorMetadataV11>;
|
||||
'Vec<ErrorMetadataV11>': Vec<ErrorMetadataV11>;
|
||||
EventMetadataV11: EventMetadataV11;
|
||||
'Option<EventMetadataV11>': Option<EventMetadataV11>;
|
||||
'Vec<EventMetadataV11>': Vec<EventMetadataV11>;
|
||||
ExtrinsicMetadataV11: ExtrinsicMetadataV11;
|
||||
'Option<ExtrinsicMetadataV11>': Option<ExtrinsicMetadataV11>;
|
||||
'Vec<ExtrinsicMetadataV11>': Vec<ExtrinsicMetadataV11>;
|
||||
FunctionArgumentMetadataV11: FunctionArgumentMetadataV11;
|
||||
'Option<FunctionArgumentMetadataV11>': Option<FunctionArgumentMetadataV11>;
|
||||
'Vec<FunctionArgumentMetadataV11>': Vec<FunctionArgumentMetadataV11>;
|
||||
FunctionMetadataV11: FunctionMetadataV11;
|
||||
'Option<FunctionMetadataV11>': Option<FunctionMetadataV11>;
|
||||
'Vec<FunctionMetadataV11>': Vec<FunctionMetadataV11>;
|
||||
MapTypeV11: MapTypeV11;
|
||||
'Option<MapTypeV11>': Option<MapTypeV11>;
|
||||
'Vec<MapTypeV11>': Vec<MapTypeV11>;
|
||||
MetadataV11: MetadataV11;
|
||||
'Option<MetadataV11>': Option<MetadataV11>;
|
||||
'Vec<MetadataV11>': Vec<MetadataV11>;
|
||||
ModuleConstantMetadataV11: ModuleConstantMetadataV11;
|
||||
'Option<ModuleConstantMetadataV11>': Option<ModuleConstantMetadataV11>;
|
||||
'Vec<ModuleConstantMetadataV11>': Vec<ModuleConstantMetadataV11>;
|
||||
ModuleMetadataV11: ModuleMetadataV11;
|
||||
'Option<ModuleMetadataV11>': Option<ModuleMetadataV11>;
|
||||
'Vec<ModuleMetadataV11>': Vec<ModuleMetadataV11>;
|
||||
PlainTypeV11: PlainTypeV11;
|
||||
'Option<PlainTypeV11>': Option<PlainTypeV11>;
|
||||
'Vec<PlainTypeV11>': Vec<PlainTypeV11>;
|
||||
StorageEntryModifierV11: StorageEntryModifierV11;
|
||||
'Option<StorageEntryModifierV11>': Option<StorageEntryModifierV11>;
|
||||
'Vec<StorageEntryModifierV11>': Vec<StorageEntryModifierV11>;
|
||||
StorageEntryMetadataV11: StorageEntryMetadataV11;
|
||||
'Option<StorageEntryMetadataV11>': Option<StorageEntryMetadataV11>;
|
||||
'Vec<StorageEntryMetadataV11>': Vec<StorageEntryMetadataV11>;
|
||||
StorageEntryTypeV11: StorageEntryTypeV11;
|
||||
'Option<StorageEntryTypeV11>': Option<StorageEntryTypeV11>;
|
||||
'Vec<StorageEntryTypeV11>': Vec<StorageEntryTypeV11>;
|
||||
StorageMetadataV11: StorageMetadataV11;
|
||||
'Option<StorageMetadataV11>': Option<StorageMetadataV11>;
|
||||
'Vec<StorageMetadataV11>': Vec<StorageMetadataV11>;
|
||||
StorageHasherV11: StorageHasherV11;
|
||||
'Option<StorageHasherV11>': Option<StorageHasherV11>;
|
||||
'Vec<StorageHasherV11>': Vec<StorageHasherV11>;
|
||||
DoubleMapTypeLatest: DoubleMapTypeLatest;
|
||||
'Option<DoubleMapTypeLatest>': Option<DoubleMapTypeLatest>;
|
||||
'Vec<DoubleMapTypeLatest>': Vec<DoubleMapTypeLatest>;
|
||||
EventMetadataLatest: EventMetadataLatest;
|
||||
'Option<EventMetadataLatest>': Option<EventMetadataLatest>;
|
||||
'Vec<EventMetadataLatest>': Vec<EventMetadataLatest>;
|
||||
ExtrinsicMetadataLatest: ExtrinsicMetadataLatest;
|
||||
'Option<ExtrinsicMetadataLatest>': Option<ExtrinsicMetadataLatest>;
|
||||
'Vec<ExtrinsicMetadataLatest>': Vec<ExtrinsicMetadataLatest>;
|
||||
FunctionArgumentMetadataLatest: FunctionArgumentMetadataLatest;
|
||||
'Option<FunctionArgumentMetadataLatest>': Option<FunctionArgumentMetadataLatest>;
|
||||
'Vec<FunctionArgumentMetadataLatest>': Vec<FunctionArgumentMetadataLatest>;
|
||||
|
||||
@@ -434,21 +434,46 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
// v11
|
||||
DoubleMapTypeV11: 'DoubleMapTypeV10',
|
||||
ErrorMetadataV11: 'ErrorMetadataV10',
|
||||
EventMetadataV11: 'EventMetadataV10',
|
||||
ExtrinsicMetadataV11: {
|
||||
version: 'u8',
|
||||
signedExtensions: 'Vec<Text>'
|
||||
},
|
||||
FunctionArgumentMetadataV11: 'FunctionArgumentMetadataV10',
|
||||
FunctionMetadataV11: 'FunctionMetadataV10',
|
||||
MapTypeV11: 'MapTypeV10',
|
||||
MetadataV11: {
|
||||
modules: 'Vec<ModuleMetadataV11>',
|
||||
extrinsic: 'ExtrinsicMetadataV11'
|
||||
},
|
||||
ModuleConstantMetadataV11: 'ModuleConstantMetadataV10',
|
||||
ModuleMetadataV11: 'ModuleMetadataV10',
|
||||
PlainTypeV11: 'Type',
|
||||
StorageEntryModifierV11: 'StorageEntryModifierV10',
|
||||
StorageEntryMetadataV11: 'StorageEntryMetadataV10',
|
||||
StorageEntryTypeV11: 'StorageEntryTypeV10',
|
||||
StorageMetadataV11: 'StorageMetadataV10',
|
||||
StorageHasherV11: 'StorageHasherV10',
|
||||
|
||||
// This always maps to the latest
|
||||
DoubleMapTypeLatest: 'DoubleMapTypeV10',
|
||||
EventMetadataLatest: 'EventMetadataV10',
|
||||
FunctionArgumentMetadataLatest: 'FunctionArgumentMetadataV10',
|
||||
FunctionMetadataLatest: 'FunctionMetadataV10',
|
||||
MapTypeLatest: 'MapTypeV10',
|
||||
MetadataLatest: 'MetadataV10',
|
||||
ModuleConstantMetadataLatest: 'ModuleConstantMetadataV10',
|
||||
ModuleMetadataLatest: 'ModuleMetadataV10',
|
||||
PlainTypeLatest: 'PlainTypeV10',
|
||||
StorageEntryMetadataLatest: 'StorageEntryMetadataV10',
|
||||
StorageEntryModifierLatest: 'StorageEntryModifierV10',
|
||||
StorageEntryTypeLatest: 'StorageEntryTypeV10',
|
||||
StorageMetadataLatest: 'StorageMetadataV10',
|
||||
StorageHasher: 'StorageHasherV10',
|
||||
DoubleMapTypeLatest: 'DoubleMapTypeV11',
|
||||
EventMetadataLatest: 'EventMetadataV11',
|
||||
ExtrinsicMetadataLatest: 'ExtrinsicMetadataV11',
|
||||
FunctionArgumentMetadataLatest: 'FunctionArgumentMetadataV11',
|
||||
FunctionMetadataLatest: 'FunctionMetadataV11',
|
||||
MapTypeLatest: 'MapTypeV11',
|
||||
MetadataLatest: 'MetadataV11',
|
||||
ModuleConstantMetadataLatest: 'ModuleConstantMetadataV11',
|
||||
ModuleMetadataLatest: 'ModuleMetadataV11',
|
||||
PlainTypeLatest: 'PlainTypeV11',
|
||||
StorageEntryMetadataLatest: 'StorageEntryMetadataV11',
|
||||
StorageEntryModifierLatest: 'StorageEntryModifierV11',
|
||||
StorageEntryTypeLatest: 'StorageEntryTypeV11',
|
||||
StorageMetadataLatest: 'StorageMetadataV11',
|
||||
StorageHasher: 'StorageHasherV11',
|
||||
|
||||
// the enum containing all the mappings
|
||||
MetadataAll: {
|
||||
@@ -463,7 +488,8 @@ export default {
|
||||
V7: 'MetadataV7',
|
||||
V8: 'MetadataV8',
|
||||
V9: 'MetadataV9',
|
||||
V10: 'MetadataV10'
|
||||
V10: 'MetadataV10',
|
||||
V11: 'MetadataV11'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import { ITuple } from '@polkadot/types/types';
|
||||
import { Enum, Option, Struct, Vec } from '@polkadot/types/codec';
|
||||
import { Bytes, Text, Type, bool, u16 } from '@polkadot/types/primitive';
|
||||
import { Bytes, Text, Type, bool, u16, u8 } from '@polkadot/types/primitive';
|
||||
|
||||
/** @name CallMetadataV0 */
|
||||
export interface CallMetadataV0 extends Struct {
|
||||
@@ -12,7 +12,7 @@ export interface CallMetadataV0 extends Struct {
|
||||
}
|
||||
|
||||
/** @name DoubleMapTypeLatest */
|
||||
export interface DoubleMapTypeLatest extends DoubleMapTypeV10 {}
|
||||
export interface DoubleMapTypeLatest extends DoubleMapTypeV11 {}
|
||||
|
||||
/** @name DoubleMapTypeV10 */
|
||||
export interface DoubleMapTypeV10 extends Struct {
|
||||
@@ -23,6 +23,9 @@ export interface DoubleMapTypeV10 extends Struct {
|
||||
readonly key2Hasher: StorageHasherV10;
|
||||
}
|
||||
|
||||
/** @name DoubleMapTypeV11 */
|
||||
export interface DoubleMapTypeV11 extends DoubleMapTypeV10 {}
|
||||
|
||||
/** @name DoubleMapTypeV3 */
|
||||
export interface DoubleMapTypeV3 extends Struct {
|
||||
readonly key1: Type;
|
||||
@@ -64,6 +67,9 @@ export interface DoubleMapTypeV9 extends DoubleMapTypeV8 {}
|
||||
/** @name ErrorMetadataV10 */
|
||||
export interface ErrorMetadataV10 extends ErrorMetadataV9 {}
|
||||
|
||||
/** @name ErrorMetadataV11 */
|
||||
export interface ErrorMetadataV11 extends ErrorMetadataV10 {}
|
||||
|
||||
/** @name ErrorMetadataV8 */
|
||||
export interface ErrorMetadataV8 extends Struct {
|
||||
readonly name: Text;
|
||||
@@ -74,7 +80,7 @@ export interface ErrorMetadataV8 extends Struct {
|
||||
export interface ErrorMetadataV9 extends ErrorMetadataV8 {}
|
||||
|
||||
/** @name EventMetadataLatest */
|
||||
export interface EventMetadataLatest extends EventMetadataV10 {}
|
||||
export interface EventMetadataLatest extends EventMetadataV11 {}
|
||||
|
||||
/** @name EventMetadataV0 */
|
||||
export interface EventMetadataV0 extends Struct {
|
||||
@@ -89,6 +95,9 @@ export interface EventMetadataV1 extends EventMetadataV0 {}
|
||||
/** @name EventMetadataV10 */
|
||||
export interface EventMetadataV10 extends EventMetadataV9 {}
|
||||
|
||||
/** @name EventMetadataV11 */
|
||||
export interface EventMetadataV11 extends EventMetadataV10 {}
|
||||
|
||||
/** @name EventMetadataV2 */
|
||||
export interface EventMetadataV2 extends EventMetadataV1 {}
|
||||
|
||||
@@ -113,8 +122,17 @@ export interface EventMetadataV8 extends EventMetadataV7 {}
|
||||
/** @name EventMetadataV9 */
|
||||
export interface EventMetadataV9 extends EventMetadataV8 {}
|
||||
|
||||
/** @name ExtrinsicMetadataLatest */
|
||||
export interface ExtrinsicMetadataLatest extends ExtrinsicMetadataV11 {}
|
||||
|
||||
/** @name ExtrinsicMetadataV11 */
|
||||
export interface ExtrinsicMetadataV11 extends Struct {
|
||||
readonly version: u8;
|
||||
readonly signedExtensions: Vec<Text>;
|
||||
}
|
||||
|
||||
/** @name FunctionArgumentMetadataLatest */
|
||||
export interface FunctionArgumentMetadataLatest extends FunctionArgumentMetadataV10 {}
|
||||
export interface FunctionArgumentMetadataLatest extends FunctionArgumentMetadataV11 {}
|
||||
|
||||
/** @name FunctionArgumentMetadataV0 */
|
||||
export interface FunctionArgumentMetadataV0 extends Struct {
|
||||
@@ -128,6 +146,9 @@ export interface FunctionArgumentMetadataV1 extends FunctionArgumentMetadataV0 {
|
||||
/** @name FunctionArgumentMetadataV10 */
|
||||
export interface FunctionArgumentMetadataV10 extends FunctionArgumentMetadataV9 {}
|
||||
|
||||
/** @name FunctionArgumentMetadataV11 */
|
||||
export interface FunctionArgumentMetadataV11 extends FunctionArgumentMetadataV10 {}
|
||||
|
||||
/** @name FunctionArgumentMetadataV2 */
|
||||
export interface FunctionArgumentMetadataV2 extends FunctionArgumentMetadataV1 {}
|
||||
|
||||
@@ -153,7 +174,7 @@ export interface FunctionArgumentMetadataV8 extends FunctionArgumentMetadataV7 {
|
||||
export interface FunctionArgumentMetadataV9 extends FunctionArgumentMetadataV8 {}
|
||||
|
||||
/** @name FunctionMetadataLatest */
|
||||
export interface FunctionMetadataLatest extends FunctionMetadataV10 {}
|
||||
export interface FunctionMetadataLatest extends FunctionMetadataV11 {}
|
||||
|
||||
/** @name FunctionMetadataV0 */
|
||||
export interface FunctionMetadataV0 extends Struct {
|
||||
@@ -173,6 +194,9 @@ export interface FunctionMetadataV1 extends Struct {
|
||||
/** @name FunctionMetadataV10 */
|
||||
export interface FunctionMetadataV10 extends FunctionMetadataV9 {}
|
||||
|
||||
/** @name FunctionMetadataV11 */
|
||||
export interface FunctionMetadataV11 extends FunctionMetadataV10 {}
|
||||
|
||||
/** @name FunctionMetadataV2 */
|
||||
export interface FunctionMetadataV2 extends FunctionMetadataV1 {}
|
||||
|
||||
@@ -198,7 +222,7 @@ export interface FunctionMetadataV8 extends FunctionMetadataV7 {}
|
||||
export interface FunctionMetadataV9 extends FunctionMetadataV8 {}
|
||||
|
||||
/** @name MapTypeLatest */
|
||||
export interface MapTypeLatest extends MapTypeV10 {}
|
||||
export interface MapTypeLatest extends MapTypeV11 {}
|
||||
|
||||
/** @name MapTypeV0 */
|
||||
export interface MapTypeV0 extends Struct {
|
||||
@@ -214,6 +238,9 @@ export interface MapTypeV10 extends Struct {
|
||||
readonly linked: bool;
|
||||
}
|
||||
|
||||
/** @name MapTypeV11 */
|
||||
export interface MapTypeV11 extends MapTypeV10 {}
|
||||
|
||||
/** @name MapTypeV2 */
|
||||
export interface MapTypeV2 extends Struct {
|
||||
readonly key: Type;
|
||||
@@ -271,10 +298,12 @@ export interface MetadataAll extends Enum {
|
||||
readonly asV9: MetadataV9;
|
||||
readonly isV10: boolean;
|
||||
readonly asV10: MetadataV10;
|
||||
readonly isV11: boolean;
|
||||
readonly asV11: MetadataV11;
|
||||
}
|
||||
|
||||
/** @name MetadataLatest */
|
||||
export interface MetadataLatest extends MetadataV10 {}
|
||||
export interface MetadataLatest extends MetadataV11 {}
|
||||
|
||||
/** @name MetadataV0 */
|
||||
export interface MetadataV0 extends Struct {
|
||||
@@ -293,6 +322,12 @@ export interface MetadataV10 extends Struct {
|
||||
readonly modules: Vec<ModuleMetadataV10>;
|
||||
}
|
||||
|
||||
/** @name MetadataV11 */
|
||||
export interface MetadataV11 extends Struct {
|
||||
readonly modules: Vec<ModuleMetadataV11>;
|
||||
readonly extrinsic: ExtrinsicMetadataV11;
|
||||
}
|
||||
|
||||
/** @name MetadataV2 */
|
||||
export interface MetadataV2 extends Struct {
|
||||
readonly modules: Vec<ModuleMetadataV2>;
|
||||
@@ -332,11 +367,14 @@ export interface MetadataV8 extends Struct {
|
||||
export interface MetadataV9 extends MetadataV8 {}
|
||||
|
||||
/** @name ModuleConstantMetadataLatest */
|
||||
export interface ModuleConstantMetadataLatest extends ModuleConstantMetadataV10 {}
|
||||
export interface ModuleConstantMetadataLatest extends ModuleConstantMetadataV11 {}
|
||||
|
||||
/** @name ModuleConstantMetadataV10 */
|
||||
export interface ModuleConstantMetadataV10 extends ModuleConstantMetadataV9 {}
|
||||
|
||||
/** @name ModuleConstantMetadataV11 */
|
||||
export interface ModuleConstantMetadataV11 extends ModuleConstantMetadataV10 {}
|
||||
|
||||
/** @name ModuleConstantMetadataV6 */
|
||||
export interface ModuleConstantMetadataV6 extends Struct {
|
||||
readonly name: Text;
|
||||
@@ -355,7 +393,7 @@ export interface ModuleConstantMetadataV8 extends ModuleConstantMetadataV7 {}
|
||||
export interface ModuleConstantMetadataV9 extends ModuleConstantMetadataV8 {}
|
||||
|
||||
/** @name ModuleMetadataLatest */
|
||||
export interface ModuleMetadataLatest extends ModuleMetadataV10 {}
|
||||
export interface ModuleMetadataLatest extends ModuleMetadataV11 {}
|
||||
|
||||
/** @name ModuleMetadataV0 */
|
||||
export interface ModuleMetadataV0 extends Struct {
|
||||
@@ -382,6 +420,9 @@ export interface ModuleMetadataV10 extends Struct {
|
||||
readonly errors: Vec<ErrorMetadataV10>;
|
||||
}
|
||||
|
||||
/** @name ModuleMetadataV11 */
|
||||
export interface ModuleMetadataV11 extends ModuleMetadataV10 {}
|
||||
|
||||
/** @name ModuleMetadataV2 */
|
||||
export interface ModuleMetadataV2 extends Struct {
|
||||
readonly name: Text;
|
||||
@@ -476,7 +517,7 @@ export interface OuterEventMetadataV0 extends Struct {
|
||||
}
|
||||
|
||||
/** @name PlainTypeLatest */
|
||||
export interface PlainTypeLatest extends PlainTypeV10 {}
|
||||
export interface PlainTypeLatest extends PlainTypeV11 {}
|
||||
|
||||
/** @name PlainTypeV0 */
|
||||
export interface PlainTypeV0 extends Type {}
|
||||
@@ -484,6 +525,9 @@ export interface PlainTypeV0 extends Type {}
|
||||
/** @name PlainTypeV10 */
|
||||
export interface PlainTypeV10 extends Type {}
|
||||
|
||||
/** @name PlainTypeV11 */
|
||||
export interface PlainTypeV11 extends Type {}
|
||||
|
||||
/** @name PlainTypeV2 */
|
||||
export interface PlainTypeV2 extends Type {}
|
||||
|
||||
@@ -516,7 +560,7 @@ export interface RuntimeModuleMetadataV0 extends Struct {
|
||||
}
|
||||
|
||||
/** @name StorageEntryMetadataLatest */
|
||||
export interface StorageEntryMetadataLatest extends StorageEntryMetadataV10 {}
|
||||
export interface StorageEntryMetadataLatest extends StorageEntryMetadataV11 {}
|
||||
|
||||
/** @name StorageEntryMetadataV10 */
|
||||
export interface StorageEntryMetadataV10 extends Struct {
|
||||
@@ -527,6 +571,9 @@ export interface StorageEntryMetadataV10 extends Struct {
|
||||
readonly documentation: Vec<Text>;
|
||||
}
|
||||
|
||||
/** @name StorageEntryMetadataV11 */
|
||||
export interface StorageEntryMetadataV11 extends StorageEntryMetadataV10 {}
|
||||
|
||||
/** @name StorageEntryMetadataV6 */
|
||||
export interface StorageEntryMetadataV6 extends StorageFunctionMetadataV5 {}
|
||||
|
||||
@@ -540,11 +587,14 @@ export interface StorageEntryMetadataV8 extends StorageEntryMetadataV7 {}
|
||||
export interface StorageEntryMetadataV9 extends StorageEntryMetadataV8 {}
|
||||
|
||||
/** @name StorageEntryModifierLatest */
|
||||
export interface StorageEntryModifierLatest extends StorageEntryModifierV10 {}
|
||||
export interface StorageEntryModifierLatest extends StorageEntryModifierV11 {}
|
||||
|
||||
/** @name StorageEntryModifierV10 */
|
||||
export interface StorageEntryModifierV10 extends StorageEntryModifierV9 {}
|
||||
|
||||
/** @name StorageEntryModifierV11 */
|
||||
export interface StorageEntryModifierV11 extends StorageEntryModifierV10 {}
|
||||
|
||||
/** @name StorageEntryModifierV6 */
|
||||
export interface StorageEntryModifierV6 extends StorageFunctionModifierV5 {}
|
||||
|
||||
@@ -558,7 +608,7 @@ export interface StorageEntryModifierV8 extends StorageEntryModifierV7 {}
|
||||
export interface StorageEntryModifierV9 extends StorageEntryModifierV8 {}
|
||||
|
||||
/** @name StorageEntryTypeLatest */
|
||||
export interface StorageEntryTypeLatest extends StorageEntryTypeV10 {}
|
||||
export interface StorageEntryTypeLatest extends StorageEntryTypeV11 {}
|
||||
|
||||
/** @name StorageEntryTypeV10 */
|
||||
export interface StorageEntryTypeV10 extends Enum {
|
||||
@@ -570,6 +620,9 @@ export interface StorageEntryTypeV10 extends Enum {
|
||||
readonly asDoubleMap: DoubleMapTypeV10;
|
||||
}
|
||||
|
||||
/** @name StorageEntryTypeV11 */
|
||||
export interface StorageEntryTypeV11 extends StorageEntryTypeV10 {}
|
||||
|
||||
/** @name StorageEntryTypeV6 */
|
||||
export interface StorageEntryTypeV6 extends StorageFunctionTypeV5 {}
|
||||
|
||||
@@ -702,7 +755,7 @@ export interface StorageFunctionTypeV5 extends Enum {
|
||||
}
|
||||
|
||||
/** @name StorageHasher */
|
||||
export interface StorageHasher extends StorageHasherV10 {}
|
||||
export interface StorageHasher extends StorageHasherV11 {}
|
||||
|
||||
/** @name StorageHasherV10 */
|
||||
export interface StorageHasherV10 extends Enum {
|
||||
@@ -714,6 +767,9 @@ export interface StorageHasherV10 extends Enum {
|
||||
readonly isTwox64Concat: boolean;
|
||||
}
|
||||
|
||||
/** @name StorageHasherV11 */
|
||||
export interface StorageHasherV11 extends StorageHasherV10 {}
|
||||
|
||||
/** @name StorageHasherV4 */
|
||||
export interface StorageHasherV4 extends Enum {
|
||||
readonly isBlake2128: boolean;
|
||||
@@ -740,7 +796,7 @@ export interface StorageHasherV8 extends StorageHasherV7 {}
|
||||
export interface StorageHasherV9 extends StorageHasherV8 {}
|
||||
|
||||
/** @name StorageMetadataLatest */
|
||||
export interface StorageMetadataLatest extends StorageMetadataV10 {}
|
||||
export interface StorageMetadataLatest extends StorageMetadataV11 {}
|
||||
|
||||
/** @name StorageMetadataV0 */
|
||||
export interface StorageMetadataV0 extends Struct {
|
||||
@@ -754,6 +810,9 @@ export interface StorageMetadataV10 extends Struct {
|
||||
readonly items: Vec<StorageEntryMetadataV10>;
|
||||
}
|
||||
|
||||
/** @name StorageMetadataV11 */
|
||||
export interface StorageMetadataV11 extends StorageMetadataV10 {}
|
||||
|
||||
/** @name StorageMetadataV7 */
|
||||
export interface StorageMetadataV7 extends Struct {
|
||||
readonly prefix: Text;
|
||||
|
||||
@@ -10,15 +10,6 @@ import Struct from '../../../codec/Struct';
|
||||
import Bytes from '../../../primitive/Bytes';
|
||||
import { sign } from '../util';
|
||||
|
||||
// SignedExtra adds the following fields to the payload
|
||||
const SignedExtraV2: Record<string, InterfaceTypes> = {
|
||||
// system::CheckEra<Runtime>
|
||||
blockHash: 'Hash'
|
||||
// system::CheckNonce<Runtime>
|
||||
// system::CheckWeight<Runtime>
|
||||
// balances::TakeFees<Runtime>
|
||||
};
|
||||
|
||||
// the base definition (excluding extras)
|
||||
export const SignedPayloadBaseV2: Record<string, InterfaceTypes> = {
|
||||
method: 'Bytes',
|
||||
@@ -27,12 +18,6 @@ export const SignedPayloadBaseV2: Record<string, InterfaceTypes> = {
|
||||
tip: 'Compact<Balance>'
|
||||
};
|
||||
|
||||
// the full definition for the payload
|
||||
const SignedPayloadDefV2: Record<string, InterfaceTypes> = {
|
||||
...SignedPayloadBaseV2,
|
||||
...SignedExtraV2
|
||||
};
|
||||
|
||||
/**
|
||||
* @name ExtrinsicPayloadV2
|
||||
* @description
|
||||
@@ -41,7 +26,10 @@ const SignedPayloadDefV2: Record<string, InterfaceTypes> = {
|
||||
*/
|
||||
export default class ExtrinsicPayloadV2 extends Struct {
|
||||
constructor (registry: Registry, value?: ExtrinsicPayloadValue | Uint8Array | string) {
|
||||
super(registry, SignedPayloadDefV2, value);
|
||||
super(registry, {
|
||||
...SignedPayloadBaseV2,
|
||||
blockHash: 'Hash'
|
||||
}, value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Balance, ExtrinsicEra, Hash, Index } from '../../../interfaces/runtime';
|
||||
import { ExtrinsicPayloadValue, IKeyringPair, InterfaceTypes, Registry } from '../../../types';
|
||||
import { ExtrinsicPayloadValue, IKeyringPair, Registry } from '../../../types';
|
||||
|
||||
import Compact from '../../../codec/Compact';
|
||||
import Struct from '../../../codec/Struct';
|
||||
@@ -12,25 +12,6 @@ import u32 from '../../../primitive/U32';
|
||||
import { sign } from '../util';
|
||||
import { SignedPayloadBaseV2 as SignedPayloadBaseV3 } from '../v2/ExtrinsicPayload';
|
||||
|
||||
// SignedExtra adds the following fields to the payload
|
||||
const SignedExtraV3: Record<string, InterfaceTypes> = {
|
||||
// system::CheckVersion<Runtime>
|
||||
specVersion: 'u32',
|
||||
// system::CheckGenesis<Runtime>
|
||||
genesisHash: 'Hash',
|
||||
// system::CheckEra<Runtime>
|
||||
blockHash: 'Hash'
|
||||
// system::CheckNonce<Runtime>
|
||||
// system::CheckWeight<Runtime>
|
||||
// balances::TakeFees<Runtime>
|
||||
};
|
||||
|
||||
// the full definition for the payload
|
||||
export const SignedPayloadDefV3: Record<string, InterfaceTypes> = {
|
||||
...SignedPayloadBaseV3,
|
||||
...SignedExtraV3
|
||||
};
|
||||
|
||||
/**
|
||||
* @name ExtrinsicPayloadV3
|
||||
* @description
|
||||
@@ -39,7 +20,13 @@ export const SignedPayloadDefV3: Record<string, InterfaceTypes> = {
|
||||
*/
|
||||
export default class ExtrinsicPayloadV3 extends Struct {
|
||||
constructor (registry: Registry, value?: ExtrinsicPayloadValue | Uint8Array | string) {
|
||||
super(registry, SignedPayloadDefV3, value);
|
||||
super(registry, {
|
||||
...SignedPayloadBaseV3,
|
||||
// signed extensions
|
||||
specVersion: 'u32',
|
||||
genesisHash: 'Hash',
|
||||
blockHash: 'Hash'
|
||||
}, value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,7 +10,7 @@ import Struct from '../../../codec/Struct';
|
||||
import Bytes from '../../../primitive/Bytes';
|
||||
import u32 from '../../../primitive/U32';
|
||||
import { sign } from '../util';
|
||||
import { SignedPayloadDefV3 as SignedPayloadDefV4 } from '../v3/ExtrinsicPayload';
|
||||
import { SignedPayloadBaseV2 as SignedPayloadBaseV4 } from '../v2/ExtrinsicPayload';
|
||||
|
||||
/**
|
||||
* @name ExtrinsicPayloadV4
|
||||
@@ -20,7 +20,21 @@ import { SignedPayloadDefV3 as SignedPayloadDefV4 } from '../v3/ExtrinsicPayload
|
||||
*/
|
||||
export default class ExtrinsicPayloadV4 extends Struct {
|
||||
constructor (registry: Registry, value?: ExtrinsicPayloadValue | Uint8Array | string) {
|
||||
super(registry, SignedPayloadDefV4, value);
|
||||
super(registry, {
|
||||
...SignedPayloadBaseV4,
|
||||
// TODO get the signed extensions from the registry and apply
|
||||
...{
|
||||
// system::CheckVersion<Runtime>
|
||||
specVersion: 'u32',
|
||||
// system::CheckGenesis<Runtime>
|
||||
genesisHash: 'Hash',
|
||||
// system::CheckEra<Runtime>
|
||||
blockHash: 'Hash'
|
||||
// system::CheckNonce<Runtime>
|
||||
// system::CheckWeight<Runtime>
|
||||
// balances::TakeFees<Runtime>
|
||||
}
|
||||
}, value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user