Remove v11 metadata (#1748)

* Remove v11 metadata

* Linting
This commit is contained in:
Jaco Greeff
2020-01-27 12:37:01 +01:00
committed by GitHub
parent 693cf855f0
commit 7adad82786
13 changed files with 96 additions and 4964 deletions
+2 -2
View File
@@ -257,8 +257,8 @@ export default abstract class Decorate<ApiType extends ApiTypes> extends Events
: [creator, ...args];
// FIXME We probably want to be able to query the full list with non-subs as well
const decorated = this.hasSubscriptions && creator.iterKey && (creator.meta.type.asMap.kind.isLinkedMap || creator.meta.type.asMap.kind.isPrefixedMap)
? creator.meta.type.asMap.kind.isLinkedMap
const decorated = this.hasSubscriptions && creator.iterKey
? creator.meta.type.asMap.linked.isTrue
? this.decorateStorageLinked(creator, decorateMethod)
: this.decorateStoragePrefixed(creator, decorateMethod)
: decorateMethod((...args: any[]): Observable<Codec> => (
@@ -104,7 +104,6 @@ function createKeyDoubleMap (registry: Registry, itemFn: CreateItemFn, stringKey
/** @internal */
function createKey (registry: Registry, itemFn: CreateItemFn, stringKey: string, arg: CreateArgType, hasher: (value: Uint8Array) => Uint8Array, metaVersion: number): Uint8Array {
const { meta: { name, type } } = itemFn;
let key: Uint8Array | undefined;
let param: Uint8Array = EMPTY_U8A;
if (type.isMap) {
@@ -113,21 +112,14 @@ function createKey (registry: Registry, itemFn: CreateItemFn, stringKey: string,
assert(!isUndefined(arg) && !isNull(arg), `${name} is a Map and requires one argument`);
param = createTypeUnsafe(registry, map.key.toString(), [arg]).toU8a();
// prefix maps are using prefixes to optimize the trie, so the key generation are
// done differently where the prefix/method are hashed separately with only the
// parameter for the key being attached via the hasher
if (map.kind.isPrefixedMap) {
key = u8aConcat(createPrefixedKey(itemFn), hasher(param));
}
}
// StorageKey is a Bytes, so is length-prefixed
return Compact.addLengthPrefix(key || (
return Compact.addLengthPrefix(
metaVersion <= 8
? hasher(u8aConcat(stringToU8a(stringKey), param))
: u8aConcat(createPrefixedKey(itemFn), param.length ? hasher(param) : EMPTY_U8A)
));
);
}
// attach the metadata to expand to a StorageFunction
@@ -210,7 +202,7 @@ export default function createFunction (registry: Registry, itemFn: CreateItemFn
if (type.isMap) {
const map = type.asMap;
if (map.kind.isLinkedMap) {
if (map.linked.isTrue) {
extendLinkedMap(registry, itemFn, storageFn, stringKey, hasher, options.metaVersion);
} else {
extendPrefixedMap(registry, itemFn, storageFn);
@@ -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, MetadataV11 } from '@polkadot/types/interfaces/metadata';
import { MetadataAll, MetadataLatest, MetadataV0, MetadataV1, MetadataV2, MetadataV3, MetadataV4, MetadataV5, MetadataV6, MetadataV7, MetadataV8, MetadataV9, MetadataV10 } from '@polkadot/types/interfaces/metadata';
import { Registry } from '@polkadot/types/types';
import { createType } from '@polkadot/types/codec/create/createType';
@@ -20,12 +20,12 @@ import v6ToV7 from './v6/toV7';
import v7ToV8 from './v7/toV8';
import v8ToV9 from './v8/toV9';
import v9ToV10 from './v9/toV10';
import v10ToV11 from './v10/toV11';
import v10ToLatest from './v10/toLatest';
import { getUniqTypes, toCallsOnly } from './util';
type MetaMapped = MetadataV0 | MetadataV1 | MetadataV2 | MetadataV3 | MetadataV4 | MetadataV5 | MetadataV6 | MetadataV7 | MetadataV8 | MetadataV9 | MetadataV10 | MetadataV11;
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' | 'asV11';
type MetaAsX = 'asV0' | 'asV1' | 'asV2' | 'asV3' | 'asV4' | 'asV5' | 'asV6' | 'asV7' | 'asV8' | 'asV9' | 'asV10';
/**
* @name MetadataVersioned
@@ -154,18 +154,12 @@ 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 {
return this.asV11;
// 11 is non-existent & latest - applied here to do to the type conversions
return this.getVersion(11, v10ToLatest);
}
/**
+1 -1
View File
@@ -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 './v9/static';
import metadata from './v10/static';
export default metadata;
@@ -0,0 +1,47 @@
// 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 { OverrideModuleType } from '@polkadot/types/known/types';
import { FunctionMetadataV10, FunctionMetadataLatest, MetadataV10, MetadataLatest, ModuleMetadataV10, ModuleMetadataLatest } from '@polkadot/types/interfaces/metadata';
import { Registry } from '@polkadot/types/types';
import { getModuleTypes } from '@polkadot/types/known';
import { createType } from '@polkadot/types';
import { stringCamelCase } from '@polkadot/util';
// apply module-specific type overrides - this should always be done as part of toLatest
/** @internal */
function convertCalls (registry: Registry, calls: FunctionMetadataV10[], sectionTypes: OverrideModuleType[]): FunctionMetadataLatest[] {
return calls.map(({ args, documentation, name }): FunctionMetadataLatest => {
args.forEach(({ type }): void => {
const queued = sectionTypes.find(({ name }): boolean => type.eq(name));
if (queued) {
type.setOverride(queued.override);
}
});
return createType(registry, 'FunctionMetadataLatest', { args, name, documentation });
});
}
/** @internal */
function convertModule (registry: Registry, mod: ModuleMetadataV10): ModuleMetadataLatest {
const calls = mod.calls.unwrapOr(null);
const sectionTypes = getModuleTypes(stringCamelCase(mod.name.toString())) || [];
return createType(registry, 'ModuleMetadataLatest', {
...mod,
calls: calls
? convertCalls(registry, calls, sectionTypes)
: null
});
}
/** @internal */
export default function toLatest (registry: Registry, { modules }: MetadataV10): MetadataLatest {
return createType(registry, 'MetadataLatest', {
modules: modules.map((mod): ModuleMetadataLatest => convertModule(registry, mod))
});
}
@@ -1,76 +0,0 @@
// 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 { OverrideModuleType } from '@polkadot/types/known/types';
import { FunctionMetadataV10, FunctionMetadataV11, MetadataV10, MetadataV11, ModuleMetadataV10, ModuleMetadataV11, StorageEntryTypeV10 } from '@polkadot/types/interfaces/metadata';
import { Registry } from '@polkadot/types/types';
import { getModuleTypes } from '@polkadot/types/known';
import { createType } from '@polkadot/types';
import { stringCamelCase } from '@polkadot/util';
// migrate a storage entry type - only map types are different (with a kind enum)
// all return the actual value for the enum, followed by the numeric index
/** @internal */
function createStorageType (registry: Registry, entryType: StorageEntryTypeV10): [any, number] {
if (entryType.isPlain) {
return [entryType.asPlain, 0];
} else if (entryType.isDoubleMap) {
return [entryType.asDoubleMap, 2];
}
const map = entryType.asMap;
// map needs a migration, removing linked and adding an explicit kind
return [{
...map,
kind: createType(registry, 'MapKindV11', null, map.linked.isTrue ? 1 : 0)
}, 1];
}
// apply module-specific type overrides
/** @internal */
function convertCalls (registry: Registry, calls: FunctionMetadataV10[], sectionTypes: OverrideModuleType[]): FunctionMetadataV11[] {
return calls.map(({ args, documentation, name }): FunctionMetadataV11 => {
args.forEach(({ type }): void => {
const queued = sectionTypes.find(({ name }): boolean => type.eq(name));
if (queued) {
type.setOverride(queued.override);
}
});
return createType(registry, 'FunctionMetadataV11', { args, name, documentation });
});
}
/** @internal */
function convertModule (registry: Registry, mod: ModuleMetadataV10): ModuleMetadataV11 {
const calls = mod.calls.unwrapOr(null);
const storage = mod.storage.unwrapOr(null);
const sectionTypes = getModuleTypes(stringCamelCase(mod.name.toString())) || [];
return createType(registry, 'ModuleMetadataV11', {
...mod,
calls: calls
? convertCalls(registry, calls, sectionTypes)
: null,
storage: storage
? {
...storage,
items: storage.items.map((item): any => ({
...item,
type: createType(registry, 'StorageEntryTypeV11', ...createStorageType(registry, item.type))
}))
}
: null
});
}
/** @internal */
export default function toV11 (registry: Registry, { modules }: MetadataV10): MetadataV11 {
return createType(registry, 'MetadataV11', {
modules: modules.map((mod): ModuleMetadataV11 => convertModule(registry, mod))
});
}
@@ -1,19 +0,0 @@
// 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('MetadataV11 (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
+1 -49
View File
@@ -30,7 +30,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, 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, 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, MapKindV11, 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, StorageMetadataV0, StorageMetadataV10, StorageMetadataV11, StorageMetadataV7, StorageMetadataV8, StorageMetadataV9 } from '@polkadot/types/interfaces/metadata';
import { CallMetadataV0, 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, 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, StorageMetadataV0, StorageMetadataV10, 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 {
@@ -1334,54 +1334,6 @@ 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>;
FunctionArgumentMetadataV11: FunctionArgumentMetadataV11;
'Option<FunctionArgumentMetadataV11>': Option<FunctionArgumentMetadataV11>;
'Vec<FunctionArgumentMetadataV11>': Vec<FunctionArgumentMetadataV11>;
FunctionMetadataV11: FunctionMetadataV11;
'Option<FunctionMetadataV11>': Option<FunctionMetadataV11>;
'Vec<FunctionMetadataV11>': Vec<FunctionMetadataV11>;
MapKindV11: MapKindV11;
'Option<MapKindV11>': Option<MapKindV11>;
'Vec<MapKindV11>': Vec<MapKindV11>;
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>;
StorageHasherV11: StorageHasherV11;
'Option<StorageHasherV11>': Option<StorageHasherV11>;
'Vec<StorageHasherV11>': Vec<StorageHasherV11>;
StorageMetadataV11: StorageMetadataV11;
'Option<StorageMetadataV11>': Option<StorageMetadataV11>;
'Vec<StorageMetadataV11>': Vec<StorageMetadataV11>;
EventMetadataLatest: EventMetadataLatest;
'Option<EventMetadataLatest>': Option<EventMetadataLatest>;
'Vec<EventMetadataLatest>': Vec<EventMetadataLatest>;
@@ -434,67 +434,18 @@ export default {
}
},
// v11
DoubleMapTypeV11: 'DoubleMapTypeV10',
ErrorMetadataV11: 'ErrorMetadataV10',
EventMetadataV11: 'EventMetadataV10',
FunctionArgumentMetadataV11: 'FunctionArgumentMetadataV10',
FunctionMetadataV11: 'FunctionMetadataV10',
MapKindV11: {
_enum: ['Map', 'LinkedMap', 'PrefixedMap']
},
MapTypeV11: {
hasher: 'StorageHasherV11',
key: 'Type',
value: 'Type',
kind: 'MapKindV11'
},
MetadataV11: {
modules: 'Vec<ModuleMetadataV11>'
},
ModuleConstantMetadataV11: 'ModuleConstantMetadataV10',
ModuleMetadataV11: {
name: 'Text',
storage: 'Option<StorageMetadataV11>',
calls: 'Option<Vec<FunctionMetadataV11>>',
events: 'Option<Vec<EventMetadataV11>>',
constants: 'Vec<ModuleConstantMetadataV11>',
errors: 'Vec<ErrorMetadataV11>'
},
PlainTypeV11: 'Type',
StorageEntryModifierV11: 'StorageEntryModifierV10',
StorageEntryMetadataV11: {
name: 'Text',
modifier: 'StorageEntryModifierV11',
type: 'StorageEntryTypeV11',
fallback: 'Bytes',
documentation: 'Vec<Text>'
},
StorageEntryTypeV11: {
_enum: {
Plain: 'PlainTypeV11',
Map: 'MapTypeV11',
DoubleMap: 'DoubleMapTypeV11'
}
},
StorageHasherV11: 'StorageHasherV10',
StorageMetadataV11: {
prefix: 'Text',
items: 'Vec<StorageEntryMetadataV11>'
},
// This always maps to the latest
EventMetadataLatest: 'EventMetadataV11',
FunctionArgumentMetadataLatest: 'FunctionArgumentMetadataV11',
FunctionMetadataLatest: 'FunctionMetadataV11',
MetadataLatest: 'MetadataV11',
ModuleConstantMetadataLatest: 'ModuleConstantMetadataV11',
ModuleMetadataLatest: 'ModuleMetadataV11',
PlainTypeLatest: 'PlainTypeV11',
StorageEntryMetadataLatest: 'StorageEntryMetadataV11',
StorageEntryModifierLatest: 'StorageEntryModifierV11',
StorageEntryTypeLatest: 'StorageEntryTypeV11',
StorageHasher: 'StorageHasherV11',
EventMetadataLatest: 'EventMetadataV10',
FunctionArgumentMetadataLatest: 'FunctionArgumentMetadataV10',
FunctionMetadataLatest: 'FunctionMetadataV10',
MetadataLatest: 'MetadataV10',
ModuleConstantMetadataLatest: 'ModuleConstantMetadataV10',
ModuleMetadataLatest: 'ModuleMetadataV10',
PlainTypeLatest: 'PlainTypeV10',
StorageEntryMetadataLatest: 'StorageEntryMetadataV10',
StorageEntryModifierLatest: 'StorageEntryModifierV10',
StorageEntryTypeLatest: 'StorageEntryTypeV10',
StorageHasher: 'StorageHasherV10',
// the enum containing all the mappings
MetadataAll: {
@@ -509,8 +460,7 @@ export default {
V7: 'MetadataV7',
V8: 'MetadataV8',
V9: 'MetadataV9',
V10: 'MetadataV10',
V11: 'MetadataV11'
V10: 'MetadataV10'
}
}
}
+22 -135
View File
@@ -27,9 +27,6 @@ export interface DoubleMapTypeV10 extends Struct {
readonly key2Hasher: StorageHasherV10;
}
/** DoubleMapTypeV10 */
export interface DoubleMapTypeV11 extends DoubleMapTypeV10 {}
/** Struct */
export interface DoubleMapTypeV3 extends Struct {
/** Type */
@@ -85,9 +82,6 @@ export interface DoubleMapTypeV9 extends DoubleMapTypeV8 {}
/** ErrorMetadataV9 */
export interface ErrorMetadataV10 extends ErrorMetadataV9 {}
/** ErrorMetadataV10 */
export interface ErrorMetadataV11 extends ErrorMetadataV10 {}
/** Struct */
export interface ErrorMetadataV8 extends Struct {
/** Text */
@@ -99,8 +93,8 @@ export interface ErrorMetadataV8 extends Struct {
/** ErrorMetadataV8 */
export interface ErrorMetadataV9 extends ErrorMetadataV8 {}
/** EventMetadataV11 */
export interface EventMetadataLatest extends EventMetadataV11 {}
/** EventMetadataV10 */
export interface EventMetadataLatest extends EventMetadataV10 {}
/** Struct */
export interface EventMetadataV0 extends Struct {
@@ -118,9 +112,6 @@ export interface EventMetadataV1 extends EventMetadataV0 {}
/** EventMetadataV9 */
export interface EventMetadataV10 extends EventMetadataV9 {}
/** EventMetadataV10 */
export interface EventMetadataV11 extends EventMetadataV10 {}
/** EventMetadataV1 */
export interface EventMetadataV2 extends EventMetadataV1 {}
@@ -145,8 +136,8 @@ export interface EventMetadataV8 extends EventMetadataV7 {}
/** EventMetadataV8 */
export interface EventMetadataV9 extends EventMetadataV8 {}
/** FunctionArgumentMetadataV11 */
export interface FunctionArgumentMetadataLatest extends FunctionArgumentMetadataV11 {}
/** FunctionArgumentMetadataV10 */
export interface FunctionArgumentMetadataLatest extends FunctionArgumentMetadataV10 {}
/** Struct */
export interface FunctionArgumentMetadataV0 extends Struct {
@@ -162,9 +153,6 @@ export interface FunctionArgumentMetadataV1 extends FunctionArgumentMetadataV0 {
/** FunctionArgumentMetadataV9 */
export interface FunctionArgumentMetadataV10 extends FunctionArgumentMetadataV9 {}
/** FunctionArgumentMetadataV10 */
export interface FunctionArgumentMetadataV11 extends FunctionArgumentMetadataV10 {}
/** FunctionArgumentMetadataV1 */
export interface FunctionArgumentMetadataV2 extends FunctionArgumentMetadataV1 {}
@@ -189,8 +177,8 @@ export interface FunctionArgumentMetadataV8 extends FunctionArgumentMetadataV7 {
/** FunctionArgumentMetadataV8 */
export interface FunctionArgumentMetadataV9 extends FunctionArgumentMetadataV8 {}
/** FunctionMetadataV11 */
export interface FunctionMetadataLatest extends FunctionMetadataV11 {}
/** FunctionMetadataV10 */
export interface FunctionMetadataLatest extends FunctionMetadataV10 {}
/** Struct */
export interface FunctionMetadataV0 extends Struct {
@@ -217,9 +205,6 @@ export interface FunctionMetadataV1 extends Struct {
/** FunctionMetadataV9 */
export interface FunctionMetadataV10 extends FunctionMetadataV9 {}
/** FunctionMetadataV10 */
export interface FunctionMetadataV11 extends FunctionMetadataV10 {}
/** FunctionMetadataV1 */
export interface FunctionMetadataV2 extends FunctionMetadataV1 {}
@@ -244,16 +229,6 @@ export interface FunctionMetadataV8 extends FunctionMetadataV7 {}
/** FunctionMetadataV8 */
export interface FunctionMetadataV9 extends FunctionMetadataV8 {}
/** Enum */
export interface MapKindV11 extends Enum {
/** 0:: Map */
readonly isMap: boolean;
/** 1:: LinkedMap */
readonly isLinkedMap: boolean;
/** 2:: PrefixedMap */
readonly isPrefixedMap: boolean;
}
/** Struct */
export interface MapTypeV0 extends Struct {
/** Type */
@@ -274,18 +249,6 @@ export interface MapTypeV10 extends Struct {
readonly linked: bool;
}
/** Struct */
export interface MapTypeV11 extends Struct {
/** StorageHasherV11 */
readonly hasher: StorageHasherV11;
/** Type */
readonly key: Type;
/** Type */
readonly value: Type;
/** MapKindV11 */
readonly kind: MapKindV11;
}
/** Struct */
export interface MapTypeV2 extends Struct {
/** Type */
@@ -372,14 +335,10 @@ export interface MetadataAll extends Enum {
readonly isV10: boolean;
/** MetadataV10 */
readonly asV10: MetadataV10;
/** 11:: V11(MetadataV11) */
readonly isV11: boolean;
/** MetadataV11 */
readonly asV11: MetadataV11;
}
/** MetadataV11 */
export interface MetadataLatest extends MetadataV11 {}
/** MetadataV10 */
export interface MetadataLatest extends MetadataV10 {}
/** Struct */
export interface MetadataV0 extends Struct {
@@ -403,12 +362,6 @@ export interface MetadataV10 extends Struct {
readonly modules: Vec<ModuleMetadataV10>;
}
/** Struct */
export interface MetadataV11 extends Struct {
/** Vec<ModuleMetadataV11> */
readonly modules: Vec<ModuleMetadataV11>;
}
/** Struct */
export interface MetadataV2 extends Struct {
/** Vec<ModuleMetadataV2> */
@@ -454,15 +407,12 @@ export interface MetadataV8 extends Struct {
/** MetadataV8 */
export interface MetadataV9 extends MetadataV8 {}
/** ModuleConstantMetadataV11 */
export interface ModuleConstantMetadataLatest extends ModuleConstantMetadataV11 {}
/** ModuleConstantMetadataV10 */
export interface ModuleConstantMetadataLatest extends ModuleConstantMetadataV10 {}
/** ModuleConstantMetadataV9 */
export interface ModuleConstantMetadataV10 extends ModuleConstantMetadataV9 {}
/** ModuleConstantMetadataV10 */
export interface ModuleConstantMetadataV11 extends ModuleConstantMetadataV10 {}
/** Struct */
export interface ModuleConstantMetadataV6 extends Struct {
/** Text */
@@ -484,8 +434,8 @@ export interface ModuleConstantMetadataV8 extends ModuleConstantMetadataV7 {}
/** ModuleConstantMetadataV8 */
export interface ModuleConstantMetadataV9 extends ModuleConstantMetadataV8 {}
/** ModuleMetadataV11 */
export interface ModuleMetadataLatest extends ModuleMetadataV11 {}
/** ModuleMetadataV10 */
export interface ModuleMetadataLatest extends ModuleMetadataV10 {}
/** Struct */
export interface ModuleMetadataV0 extends Struct {
@@ -525,22 +475,6 @@ export interface ModuleMetadataV10 extends Struct {
readonly errors: Vec<ErrorMetadataV10>;
}
/** Struct */
export interface ModuleMetadataV11 extends Struct {
/** Text */
readonly name: Text;
/** Option<StorageMetadataV11> */
readonly storage: Option<StorageMetadataV11>;
/** Option<Vec<FunctionMetadataV11>> */
readonly calls: Option<Vec<FunctionMetadataV11>>;
/** Option<Vec<EventMetadataV11>> */
readonly events: Option<Vec<EventMetadataV11>>;
/** Vec<ModuleConstantMetadataV11> */
readonly constants: Vec<ModuleConstantMetadataV11>;
/** Vec<ErrorMetadataV11> */
readonly errors: Vec<ErrorMetadataV11>;
}
/** Struct */
export interface ModuleMetadataV2 extends Struct {
/** Text */
@@ -678,8 +612,8 @@ export interface OuterEventMetadataV0 extends Struct {
readonly events: Vec<OuterEventEventMetadataV0>;
}
/** PlainTypeV11 */
export interface PlainTypeLatest extends PlainTypeV11 {}
/** PlainTypeV10 */
export interface PlainTypeLatest extends PlainTypeV10 {}
/** Type */
export interface PlainTypeV0 extends Type {}
@@ -687,9 +621,6 @@ export interface PlainTypeV0 extends Type {}
/** Type */
export interface PlainTypeV10 extends Type {}
/** Type */
export interface PlainTypeV11 extends Type {}
/** Type */
export interface PlainTypeV2 extends Type {}
@@ -724,8 +655,8 @@ export interface RuntimeModuleMetadataV0 extends Struct {
readonly storage: Option<StorageMetadataV0>;
}
/** StorageEntryMetadataV11 */
export interface StorageEntryMetadataLatest extends StorageEntryMetadataV11 {}
/** StorageEntryMetadataV10 */
export interface StorageEntryMetadataLatest extends StorageEntryMetadataV10 {}
/** Struct */
export interface StorageEntryMetadataV10 extends Struct {
@@ -741,20 +672,6 @@ export interface StorageEntryMetadataV10 extends Struct {
readonly documentation: Vec<Text>;
}
/** Struct */
export interface StorageEntryMetadataV11 extends Struct {
/** Text */
readonly name: Text;
/** StorageEntryModifierV11 */
readonly modifier: StorageEntryModifierV11;
/** StorageEntryTypeV11 */
readonly type: StorageEntryTypeV11;
/** Bytes */
readonly fallback: Bytes;
/** Vec<Text> */
readonly documentation: Vec<Text>;
}
/** StorageFunctionMetadataV5 */
export interface StorageEntryMetadataV6 extends StorageFunctionMetadataV5 {}
@@ -767,15 +684,12 @@ export interface StorageEntryMetadataV8 extends StorageEntryMetadataV7 {}
/** StorageEntryMetadataV8 */
export interface StorageEntryMetadataV9 extends StorageEntryMetadataV8 {}
/** StorageEntryModifierV11 */
export interface StorageEntryModifierLatest extends StorageEntryModifierV11 {}
/** StorageEntryModifierV10 */
export interface StorageEntryModifierLatest extends StorageEntryModifierV10 {}
/** StorageEntryModifierV9 */
export interface StorageEntryModifierV10 extends StorageEntryModifierV9 {}
/** StorageEntryModifierV10 */
export interface StorageEntryModifierV11 extends StorageEntryModifierV10 {}
/** StorageFunctionModifierV5 */
export interface StorageEntryModifierV6 extends StorageFunctionModifierV5 {}
@@ -788,8 +702,8 @@ export interface StorageEntryModifierV8 extends StorageEntryModifierV7 {}
/** StorageEntryModifierV8 */
export interface StorageEntryModifierV9 extends StorageEntryModifierV8 {}
/** StorageEntryTypeV11 */
export interface StorageEntryTypeLatest extends StorageEntryTypeV11 {}
/** StorageEntryTypeV10 */
export interface StorageEntryTypeLatest extends StorageEntryTypeV10 {}
/** Enum */
export interface StorageEntryTypeV10 extends Enum {
@@ -807,22 +721,6 @@ export interface StorageEntryTypeV10 extends Enum {
readonly asDoubleMap: DoubleMapTypeV10;
}
/** Enum */
export interface StorageEntryTypeV11 extends Enum {
/** 0:: Plain(PlainTypeV11) */
readonly isPlain: boolean;
/** PlainTypeV11 */
readonly asPlain: PlainTypeV11;
/** 1:: Map(MapTypeV11) */
readonly isMap: boolean;
/** MapTypeV11 */
readonly asMap: MapTypeV11;
/** 2:: DoubleMap(DoubleMapTypeV11) */
readonly isDoubleMap: boolean;
/** DoubleMapTypeV11 */
readonly asDoubleMap: DoubleMapTypeV11;
}
/** StorageFunctionTypeV5 */
export interface StorageEntryTypeV6 extends StorageFunctionTypeV5 {}
@@ -1008,8 +906,8 @@ export interface StorageFunctionTypeV5 extends Enum {
readonly asDoubleMap: DoubleMapTypeV5;
}
/** StorageHasherV11 */
export interface StorageHasher extends StorageHasherV11 {}
/** StorageHasherV10 */
export interface StorageHasher extends StorageHasherV10 {}
/** Enum */
export interface StorageHasherV10 extends Enum {
@@ -1027,9 +925,6 @@ export interface StorageHasherV10 extends Enum {
readonly isTwox64Concat: boolean;
}
/** StorageHasherV10 */
export interface StorageHasherV11 extends StorageHasherV10 {}
/** Enum */
export interface StorageHasherV4 extends Enum {
/** 0:: Blake2_128 */
@@ -1077,14 +972,6 @@ export interface StorageMetadataV10 extends Struct {
readonly items: Vec<StorageEntryMetadataV10>;
}
/** Struct */
export interface StorageMetadataV11 extends Struct {
/** Text */
readonly prefix: Text;
/** Vec<StorageEntryMetadataV11> */
readonly items: Vec<StorageEntryMetadataV11>;
}
/** Struct */
export interface StorageMetadataV7 extends Struct {
/** Text */
+2 -3
View File
@@ -31,6 +31,7 @@ interface StorageKeyExtra {
}
// we unwrap the type here, turning into an output usable for createType
/** @internal */
export function unwrapStorageType (type: StorageEntryTypeLatest): string {
if (type.isPlain) {
return type.asPlain.toString();
@@ -40,10 +41,8 @@ export function unwrapStorageType (type: StorageEntryTypeLatest): string {
const map = type.asMap;
if (map.kind.isLinkedMap) {
if (map.linked.isTrue) {
return `(${map.value.toString()}, Linkage<${map.key.toString()}>)`;
} else if (map.kind.isPrefixedMap) {
// We are not 100% sure here yet if we are doing something specific or not
}
return map.value.toString();