Move Metadata to interfaces (#1598)
* Move Metadata to interfaces * Align imports * Suppress errors * Remove TS overrides, createTypeUnsafe returns Codec * Add type unwrap * Fixup doc generation * Remove V8 references
This commit is contained in:
@@ -2,6 +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 { StorageEntryMetadataLatest } from '@polkadot/types/interfaces/metadata';
|
||||
import { Codec, Registry } from '@polkadot/types/types';
|
||||
|
||||
import BN from 'bn.js';
|
||||
@@ -9,7 +10,6 @@ import { Compact, U8a, createType, createTypeUnsafe } from '@polkadot/types/code
|
||||
import { StorageEntry } from '@polkadot/types/primitive/StorageKey';
|
||||
import { assert, isNull, isUndefined, stringLowerFirst, stringToU8a, u8aConcat } from '@polkadot/util';
|
||||
|
||||
import { StorageEntryMetadata, StorageEntryType } from '../../../Metadata/v8/Storage';
|
||||
import getHasher, { HasherFunction } from './getHasher';
|
||||
|
||||
export interface CreateItemOptions {
|
||||
@@ -18,7 +18,7 @@ export interface CreateItemOptions {
|
||||
}
|
||||
|
||||
export interface CreateItemFn {
|
||||
meta: StorageEntryMetadata;
|
||||
meta: StorageEntryMetadataLatest;
|
||||
method: string;
|
||||
prefix: string;
|
||||
section: string;
|
||||
@@ -118,10 +118,10 @@ function extendLinkedMap (registry: Registry, { meta: { documentation, name, typ
|
||||
|
||||
// metadata with a fallback value using the type of the key, the normal
|
||||
// meta fallback only applies to actual entry values, create one for head
|
||||
headFn.meta = new StorageEntryMetadata(registry, {
|
||||
headFn.meta = createType(registry, 'StorageEntryMetadataLatest', {
|
||||
name,
|
||||
modifier: createType(registry, 'StorageEntryModifierLatest', 1), // required
|
||||
type: new StorageEntryType(registry, createType(registry, 'PlainTypeLatest', type.asMap.key), 0),
|
||||
type: createType(registry, 'StorageEntryTypeLatest', createType(registry, 'PlainTypeLatest', type.asMap.key), 0),
|
||||
fallback: createType(registry, 'Bytes', createTypeUnsafe(registry, type.asMap.key.toString()).toHex()),
|
||||
documentation
|
||||
});
|
||||
|
||||
@@ -31,7 +31,7 @@ export default function fromMetadata (registry: Registry, metadata: Metadata): S
|
||||
result[section] = unwrapped.items.reduce((newModule, meta): ModuleStorage => {
|
||||
const method = meta.name.toString();
|
||||
|
||||
newModule[stringLowerFirst(method)] = createFunction(metadata.registry, {
|
||||
newModule[stringLowerFirst(method)] = createFunction(registry, {
|
||||
meta,
|
||||
method,
|
||||
prefix,
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { StorageEntryMetadataLatest } from '@polkadot/types/interfaces/metadata';
|
||||
import { Registry } from '@polkadot/types/types';
|
||||
|
||||
import { StorageEntry } from '@polkadot/types/primitive/StorageKey';
|
||||
import { createType } from '@polkadot/types/codec';
|
||||
import { StorageEntryMetadata, StorageEntryType } from '../../../Metadata/v8/Storage';
|
||||
|
||||
import createFunction from './createFunction';
|
||||
|
||||
@@ -22,9 +22,9 @@ function createRuntimeFunction (method: string, key: string, { documentation, ty
|
||||
meta: {
|
||||
documentation: createType(registry, 'Vec<Text>', [documentation]),
|
||||
modifier: createType(registry, 'StorageEntryModifierLatest', 1), // required
|
||||
type: new StorageEntryType(registry, type, 0),
|
||||
type: createType(registry, 'StorageEntryTypeLatest', type, 0),
|
||||
toJSON: (): any => key
|
||||
} as unknown as StorageEntryMetadata,
|
||||
} as unknown as StorageEntryMetadataLatest,
|
||||
method,
|
||||
prefix: 'Substrate',
|
||||
section: 'substrate'
|
||||
|
||||
@@ -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 { MetadataV0, MetadataV1 } from '@polkadot/types/interfaces/metadata';
|
||||
import { MetadataLatest, MetadataV0, MetadataV1, MetadataV2, MetadataV3, MetadataV4, MetadataV5, MetadataV6, MetadataV7, MetadataV8 } from '@polkadot/types/interfaces/metadata';
|
||||
import { Registry } from '@polkadot/types/types';
|
||||
|
||||
import { assert } from '@polkadot/util';
|
||||
@@ -11,13 +11,6 @@ import Enum from '@polkadot/types/codec/Enum';
|
||||
import Struct from '@polkadot/types/codec/Struct';
|
||||
|
||||
import MagicNumber from './MagicNumber';
|
||||
import MetadataV2 from './v2';
|
||||
import MetadataV3 from './v3';
|
||||
import MetadataV4 from './v4';
|
||||
import MetadataV5 from './v5';
|
||||
import MetadataV6 from './v6';
|
||||
import MetadataV7 from './v7';
|
||||
import MetadataV8 from './v8';
|
||||
import v0ToV1 from './v0/toV1';
|
||||
import v1ToV2 from './v1/toV2';
|
||||
import v2ToV3 from './v2/toV3';
|
||||
@@ -37,13 +30,13 @@ class MetadataEnum extends Enum {
|
||||
super(registry, {
|
||||
V0: 'MetadataV0', // once rolled-out, can replace this with MetadataDeprecated
|
||||
V1: 'MetadataV1', // once rolled-out, can replace this with MetadataDeprecated
|
||||
V2: MetadataV2, // once rolled-out, can replace this with MetadataDeprecated
|
||||
V3: MetadataV3, // once rolled-out, can replace this with MetadataDeprecated
|
||||
V4: MetadataV4, // once rolled-out, can replace this with MetadataDeprecated
|
||||
V5: MetadataV5, // once rolled-out, can replace this with MetadataDeprecated
|
||||
V6: MetadataV6, // once rolled-out, can replace this with MetadataDeprecated
|
||||
V7: MetadataV7, // once rolled-out, can replace this with MetadataDeprecated
|
||||
V8: MetadataV8
|
||||
V2: 'MetadataV2', // once rolled-out, can replace this with MetadataDeprecated
|
||||
V3: 'MetadataV3', // once rolled-out, can replace this with MetadataDeprecated
|
||||
V4: 'MetadataV4', // once rolled-out, can replace this with MetadataDeprecated
|
||||
V5: 'MetadataV5', // once rolled-out, can replace this with MetadataDeprecated
|
||||
V6: 'MetadataV6', // once rolled-out, can replace this with MetadataDeprecated
|
||||
V7: 'MetadataV7', // once rolled-out, can replace this with MetadataDeprecated
|
||||
V8: 'MetadataV8'
|
||||
}, value, index);
|
||||
}
|
||||
|
||||
@@ -315,7 +308,7 @@ export default class MetadataVersioned extends Struct {
|
||||
/**
|
||||
* @description Returns the wrapped values as a latest version object
|
||||
*/
|
||||
public get asLatest (): MetadataV8 {
|
||||
public get asLatest (): MetadataLatest {
|
||||
return this.asV8;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,12 +38,12 @@ export function decodeLatestSubstrate<Modules extends Codec> (registry: Registry
|
||||
export function toLatest<Modules extends Codec> (registry: Registry, version: number, rpcData: string): void {
|
||||
it(`converts v${version} to v8`, (): void => {
|
||||
const metadata = new Metadata(registry, rpcData)[`asV${version}` as keyof Metadata];
|
||||
const metadataV8 = new Metadata(registry, rpcData).asLatest;
|
||||
const metadataLatest = new Metadata(registry, rpcData).asLatest;
|
||||
|
||||
expect(
|
||||
getUniqTypes(registry, metadata as unknown as MetadataInterface<Modules>, true)
|
||||
).toEqual(
|
||||
getUniqTypes(registry, metadataV8, true)
|
||||
getUniqTypes(registry, metadataLatest, true)
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2,15 +2,16 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { MetadataLatest } from '@polkadot/types/interfaces/metadata';
|
||||
import { AnyJsonObject, Registry } from '@polkadot/types/types';
|
||||
|
||||
import MetadataV8 from '../v8';
|
||||
import { createType } from '@polkadot/types';
|
||||
|
||||
/**
|
||||
* @description Convert from MetadataV8 to a stripped representation of MetadataV8
|
||||
* @description Convert from MetadataLatest to a stripped representation of MetadataLatest
|
||||
*/
|
||||
export default function toCallsOnly (registry: Registry, { modules }: MetadataV8): AnyJsonObject | string {
|
||||
return new MetadataV8(registry, {
|
||||
export default function toCallsOnly (registry: Registry, { modules }: MetadataLatest): AnyJsonObject | string {
|
||||
return createType(registry, 'MetadataLatest', {
|
||||
// FIXME, this needs typing, not any
|
||||
modules: modules.map(({ calls, name }): any => ({
|
||||
name,
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { MetadataV1 } from '@polkadot/types/interfaces/metadata';
|
||||
import { MetadataV1, MetadataV2 } from '@polkadot/types/interfaces/metadata';
|
||||
import { Registry } from '@polkadot/types/types';
|
||||
|
||||
import MetadataV2 from '../v2';
|
||||
import { createType } from '@polkadot/types';
|
||||
|
||||
export default function toV2 (registry: Registry, metadataV1: MetadataV1): MetadataV2 {
|
||||
return new MetadataV2(registry, metadataV1);
|
||||
return createType(registry, 'MetadataV2', metadataV1);
|
||||
}
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
// Copyright 2017-2019 @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 { EventMetadataV2, FunctionMetadataV2 } from '@polkadot/types/interfaces/metadata';
|
||||
import { Registry } from '@polkadot/types/types';
|
||||
import { MetadataInterface } from '../types';
|
||||
|
||||
import Option from '@polkadot/types/codec/Option';
|
||||
import Struct from '@polkadot/types/codec/Struct';
|
||||
import Vec from '@polkadot/types/codec/Vec';
|
||||
import Text from '@polkadot/types/primitive/Text';
|
||||
|
||||
import { StorageFunctionMetadata } from './Storage';
|
||||
|
||||
/**
|
||||
* @name ModuleMetadataV2
|
||||
* @description
|
||||
* The definition of a module in the system
|
||||
*/
|
||||
export class ModuleMetadataV2 extends Struct {
|
||||
constructor (registry: Registry, value?: any) {
|
||||
super(registry, {
|
||||
name: 'Text',
|
||||
prefix: 'Text',
|
||||
storage: Option.with(Vec.with(StorageFunctionMetadata)),
|
||||
calls: Option.with('Vec<FunctionMetadataV2>'),
|
||||
events: Option.with('Vec<EventMetadataV2>')
|
||||
}, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description the module calls
|
||||
*/
|
||||
public get calls (): Option<Vec<FunctionMetadataV2>> {
|
||||
return this.get('calls') as Option<Vec<FunctionMetadataV2>>;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description the module events
|
||||
*/
|
||||
public get events (): Option<Vec<EventMetadataV2>> {
|
||||
return this.get('events') as Option<Vec<EventMetadataV2>>;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description the module name
|
||||
*/
|
||||
public get name (): Text {
|
||||
return this.get('name') as Text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description the module prefix
|
||||
*/
|
||||
public get prefix (): Text {
|
||||
return this.get('prefix') as Text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description the associated module storage
|
||||
*/
|
||||
public get storage (): Option<Vec<StorageFunctionMetadata>> {
|
||||
return this.get('storage') as Option<Vec<StorageFunctionMetadata>>;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @name MetadataV2
|
||||
* @description
|
||||
* The runtime metadata as a decoded structure
|
||||
*/
|
||||
export default class MetadataV2 extends Struct implements MetadataInterface<ModuleMetadataV2> {
|
||||
constructor (registry: Registry, value?: any) {
|
||||
super(registry, {
|
||||
modules: Vec.with(ModuleMetadataV2)
|
||||
}, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The associated modules for this structure
|
||||
*/
|
||||
public get modules (): Vec<ModuleMetadataV2> {
|
||||
return this.get('modules') as Vec<ModuleMetadataV2>;
|
||||
}
|
||||
}
|
||||
@@ -1,115 +0,0 @@
|
||||
// Copyright 2017-2019 @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 { MapTypeV2, PlainTypeV2, StorageFunctionModifierV2 } from '@polkadot/types/interfaces/metadata';
|
||||
import { AnyNumber, Registry } from '@polkadot/types/types';
|
||||
|
||||
import { assert } from '@polkadot/util';
|
||||
|
||||
import Enum from '@polkadot/types/codec/Enum';
|
||||
import Struct from '@polkadot/types/codec/Struct';
|
||||
import Vec from '@polkadot/types/codec/Vec';
|
||||
import Bytes from '@polkadot/types/primitive/Bytes';
|
||||
import Text from '@polkadot/types/primitive/Text';
|
||||
|
||||
export class StorageFunctionType extends Enum {
|
||||
constructor (registry: Registry, value?: any, index?: number) {
|
||||
super(registry, {
|
||||
Plain: 'PlainTypeV2',
|
||||
Map: 'MapTypeV2'
|
||||
}, value, index);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The value as a mapped value
|
||||
*/
|
||||
public get asMap (): MapTypeV2 {
|
||||
assert(this.isMap, `Cannot convert '${this.type}' via asMap`);
|
||||
|
||||
return this.value as MapTypeV2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The value as a [[Type]] value
|
||||
*/
|
||||
public get asPlain (): PlainTypeV2 {
|
||||
assert(this.isPlain, `Cannot convert '${this.type}' via asPlain`);
|
||||
|
||||
return this.value as PlainTypeV2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description `true` if the storage entry is a map
|
||||
*/
|
||||
public get isMap (): boolean {
|
||||
return this.toNumber() === 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description `true` if the storage entry is a plain type
|
||||
*/
|
||||
public get isPlain (): boolean {
|
||||
return this.toNumber() === 0;
|
||||
}
|
||||
}
|
||||
|
||||
export interface StorageFunctionMetadataValue {
|
||||
name: string | Text;
|
||||
modifier: StorageFunctionModifierV2 | AnyNumber;
|
||||
type: StorageFunctionType;
|
||||
fallback: Bytes;
|
||||
documentation: Vec<Text> | string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* @name ModuleMetadata
|
||||
* @description
|
||||
* The definition of a storage function
|
||||
*/
|
||||
export class StorageFunctionMetadata extends Struct {
|
||||
constructor (registry: Registry, value?: StorageFunctionMetadataValue | Uint8Array) {
|
||||
super(registry, {
|
||||
name: 'Text',
|
||||
modifier: 'StorageFunctionModifierV2',
|
||||
type: StorageFunctionType,
|
||||
fallback: 'Bytes',
|
||||
documentation: 'Vec<Text>'
|
||||
}, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The [[Text]] documentation
|
||||
*/
|
||||
public get documentation (): Vec<Text> {
|
||||
return this.get('documentation') as Vec<Text>;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The [[Bytes]] fallback default
|
||||
*/
|
||||
public get fallback (): Bytes {
|
||||
return this.get('fallback') as Bytes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The [[StorageFunctionModifierV2]] for arguments
|
||||
*/
|
||||
public get modifier (): StorageFunctionModifierV2 {
|
||||
return this.get('modifier') as StorageFunctionModifierV2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The call name
|
||||
*/
|
||||
public get name (): Text {
|
||||
return this.get('name') as Text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The [[StorageFunctionType]]
|
||||
*/
|
||||
public get type (): StorageFunctionType {
|
||||
return this.get('type') as StorageFunctionType;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
// Copyright 2017-2019 @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 MetadataV2, { ModuleMetadataV2 } from './Metadata';
|
||||
|
||||
export default MetadataV2;
|
||||
|
||||
export {
|
||||
ModuleMetadataV2
|
||||
};
|
||||
@@ -2,11 +2,11 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { MetadataV2, MetadataV3 } from '@polkadot/types/interfaces/metadata';
|
||||
import { Registry } from '@polkadot/types/types';
|
||||
|
||||
import MetadataV2 from './Metadata';
|
||||
import MetadataV3 from '../v3';
|
||||
import { createType } from '@polkadot/types';
|
||||
|
||||
export default function toV3 (registry: Registry, metadataV2: MetadataV2): MetadataV3 {
|
||||
return new MetadataV3(registry, metadataV2);
|
||||
return createType(registry, 'MetadataV3', metadataV2);
|
||||
}
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
// Copyright 2017-2019 @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 { EventMetadataV3, FunctionMetadataV3 } from '@polkadot/types/interfaces/metadata';
|
||||
import { Registry } from '@polkadot/types/types';
|
||||
import { MetadataInterface } from '../types';
|
||||
|
||||
import Option from '@polkadot/types/codec/Option';
|
||||
import Struct from '@polkadot/types/codec/Struct';
|
||||
import Vec from '@polkadot/types/codec/Vec';
|
||||
import Text from '@polkadot/types/primitive/Text';
|
||||
|
||||
import { StorageFunctionMetadata } from './Storage';
|
||||
|
||||
/**
|
||||
* @name ModuleMetadataV3
|
||||
* @description
|
||||
* The definition of a module in the system
|
||||
*/
|
||||
export class ModuleMetadataV3 extends Struct {
|
||||
constructor (registry: Registry, value?: any) {
|
||||
super(registry, {
|
||||
name: 'Text',
|
||||
prefix: 'Text',
|
||||
storage: Option.with(Vec.with(StorageFunctionMetadata)),
|
||||
calls: Option.with('Vec<FunctionMetadataV3>'),
|
||||
events: Option.with('Vec<EventMetadataV3>')
|
||||
}, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description the module calls
|
||||
*/
|
||||
public get calls (): Option<Vec<FunctionMetadataV3>> {
|
||||
return this.get('calls') as Option<Vec<FunctionMetadataV3>>;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description the module events
|
||||
*/
|
||||
public get events (): Option<Vec<EventMetadataV3>> {
|
||||
return this.get('events') as Option<Vec<EventMetadataV3>>;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description the module name
|
||||
*/
|
||||
public get name (): Text {
|
||||
return this.get('name') as Text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description the module prefix
|
||||
*/
|
||||
public get prefix (): Text {
|
||||
return this.get('prefix') as Text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description the associated module storage
|
||||
*/
|
||||
public get storage (): Option<Vec<StorageFunctionMetadata>> {
|
||||
return this.get('storage') as Option<Vec<StorageFunctionMetadata>>;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @name MetadataV3
|
||||
* @description
|
||||
* The runtime metadata as a decoded structure
|
||||
*/
|
||||
export default class MetadataV3 extends Struct implements MetadataInterface<ModuleMetadataV3> {
|
||||
constructor (registry: Registry, value?: any) {
|
||||
super(registry, {
|
||||
modules: Vec.with(ModuleMetadataV3)
|
||||
}, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The associated modules for this structure
|
||||
*/
|
||||
public get modules (): Vec<ModuleMetadataV3> {
|
||||
return this.get('modules') as Vec<ModuleMetadataV3>;
|
||||
}
|
||||
}
|
||||
@@ -1,132 +0,0 @@
|
||||
// Copyright 2017-2019 @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 { DoubleMapTypeV3, MapTypeV3, PlainTypeV3, StorageFunctionModifierV3 } from '@polkadot/types/interfaces/metadata';
|
||||
import { AnyNumber, Registry } from '@polkadot/types/types';
|
||||
|
||||
import { assert } from '@polkadot/util';
|
||||
|
||||
import Enum from '@polkadot/types/codec/Enum';
|
||||
import Struct from '@polkadot/types/codec/Struct';
|
||||
import Vec from '@polkadot/types/codec/Vec';
|
||||
import Bytes from '@polkadot/types/primitive/Bytes';
|
||||
import Text from '@polkadot/types/primitive/Text';
|
||||
|
||||
export class StorageFunctionType extends Enum {
|
||||
constructor (registry: Registry, value?: any, index?: number) {
|
||||
super(registry, {
|
||||
Plain: 'PlainTypeV3',
|
||||
Map: 'MapTypeV3',
|
||||
DoubleMap: 'DoubleMapTypeV3'
|
||||
}, value, index);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The value as a mapped value
|
||||
*/
|
||||
public get asDoubleMap (): DoubleMapTypeV3 {
|
||||
assert(this.isDoubleMap, `Cannot convert '${this.type}' via asDoubleMap`);
|
||||
|
||||
return this.value as DoubleMapTypeV3;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The value as a mapped value
|
||||
*/
|
||||
public get asMap (): MapTypeV3 {
|
||||
assert(this.isMap, `Cannot convert '${this.type}' via asMap`);
|
||||
|
||||
return this.value as MapTypeV3;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The value as a [[Type]] value
|
||||
*/
|
||||
public get asPlain (): PlainTypeV3 {
|
||||
assert(this.isPlain, `Cannot convert '${this.type}' via asPlain`);
|
||||
|
||||
return this.value as PlainTypeV3;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description `true` if the storage entry is a doublemap
|
||||
*/
|
||||
public get isDoubleMap (): boolean {
|
||||
return this.toNumber() === 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description `true` if the storage entry is a map
|
||||
*/
|
||||
public get isMap (): boolean {
|
||||
return this.toNumber() === 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description `true` if the storage entry is a plain type
|
||||
*/
|
||||
public get isPlain (): boolean {
|
||||
return this.toNumber() === 0;
|
||||
}
|
||||
}
|
||||
|
||||
export interface StorageFunctionMetadataValue {
|
||||
name: string | Text;
|
||||
modifier: StorageFunctionModifierV3 | AnyNumber;
|
||||
type: StorageFunctionType;
|
||||
fallback: Bytes;
|
||||
documentation: Vec<Text> | string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* @name StorageFunctionMetadata
|
||||
* @description
|
||||
* The definition of a storage function
|
||||
*/
|
||||
export class StorageFunctionMetadata extends Struct {
|
||||
constructor (registry: Registry, value?: StorageFunctionMetadataValue | Uint8Array) {
|
||||
super(registry, {
|
||||
name: 'Text',
|
||||
modifier: 'StorageFunctionModifierV3',
|
||||
type: StorageFunctionType,
|
||||
fallback: 'Bytes',
|
||||
documentation: 'Vec<Text>'
|
||||
}, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The [[Text]] documentation
|
||||
*/
|
||||
public get documentation (): Vec<Text> {
|
||||
return this.get('documentation') as Vec<Text>;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The [[Bytes]] fallback default
|
||||
*/
|
||||
public get fallback (): Bytes {
|
||||
return this.get('fallback') as Bytes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The [[StorageFunctionModifierV3]] for arguments
|
||||
*/
|
||||
public get modifier (): StorageFunctionModifierV3 {
|
||||
return this.get('modifier') as StorageFunctionModifierV3;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The call name
|
||||
*/
|
||||
public get name (): Text {
|
||||
return this.get('name') as Text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The [[StorageFunctionType]]
|
||||
*/
|
||||
public get type (): StorageFunctionType {
|
||||
return this.get('type') as StorageFunctionType;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
// Copyright 2017-2019 @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 MetadataV3, { ModuleMetadataV3 } from './Metadata';
|
||||
|
||||
export default MetadataV3;
|
||||
|
||||
export {
|
||||
ModuleMetadataV3
|
||||
};
|
||||
@@ -2,21 +2,16 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { MetadataV3, MetadataV4, ModuleMetadataV4, StorageFunctionMetadataV3, StorageFunctionMetadataV4 } from '@polkadot/types/interfaces/metadata';
|
||||
import { Registry } from '@polkadot/types/types';
|
||||
|
||||
import StorageHasher from '@polkadot/types/primitive/StorageHasher';
|
||||
import { createType, Option, Vec } from '@polkadot/types/codec';
|
||||
|
||||
import MetadataV3 from './Metadata';
|
||||
import MetadataV4 from '../v4';
|
||||
import { ModuleMetadataV4 } from '../v4/Metadata';
|
||||
import { StorageFunctionMetadata, StorageFunctionType } from '../v4/Storage';
|
||||
import { StorageFunctionMetadata as StorageFunctionMetadataV3 } from './Storage';
|
||||
import { createType, Option } from '@polkadot/types/codec';
|
||||
|
||||
/**
|
||||
* Convert V3 StorageFunction to V4 StorageFunction
|
||||
*/
|
||||
function toV4StorageFunction (registry: Registry, storageFn: StorageFunctionMetadataV3): StorageFunctionMetadata {
|
||||
function toV4StorageFunction (registry: Registry, storageFn: StorageFunctionMetadataV3): StorageFunctionMetadataV4 {
|
||||
const { documentation, fallback, modifier, name, type } = storageFn;
|
||||
|
||||
// Convert the old type to the new type: there is one new field
|
||||
@@ -39,12 +34,12 @@ function toV4StorageFunction (registry: Registry, storageFn: StorageFunctionMeta
|
||||
key2Hasher: type.asDoubleMap.key2Hasher
|
||||
}), 2];
|
||||
|
||||
return new StorageFunctionMetadata(registry, {
|
||||
return createType(registry, 'StorageFunctionMetadataV4', {
|
||||
documentation,
|
||||
fallback,
|
||||
name,
|
||||
modifier,
|
||||
type: new StorageFunctionType(registry, newType, index)
|
||||
type: createType(registry, 'StorageFunctionTypeV4', newType, index)
|
||||
});
|
||||
}
|
||||
|
||||
@@ -53,9 +48,9 @@ function toV4StorageFunction (registry: Registry, storageFn: StorageFunctionMeta
|
||||
* See https://github.com/paritytech/substrate/pull/2268 for details
|
||||
*/
|
||||
export default function toV4 (registry: Registry, { modules }: MetadataV3): MetadataV4 {
|
||||
return new MetadataV4(registry, {
|
||||
return createType(registry, 'MetadataV4', {
|
||||
modules: modules.map(({ calls, events, name, prefix, storage }): ModuleMetadataV4 =>
|
||||
new ModuleMetadataV4(registry, {
|
||||
createType(registry, 'ModuleMetadataV4', {
|
||||
calls,
|
||||
events,
|
||||
name,
|
||||
@@ -63,8 +58,8 @@ export default function toV4 (registry: Registry, { modules }: MetadataV3): Meta
|
||||
storage: storage.isSome
|
||||
? new Option(
|
||||
registry,
|
||||
Vec.with(StorageFunctionMetadata),
|
||||
storage.unwrap().map((v): StorageFunctionMetadata => toV4StorageFunction(registry, v))
|
||||
'Vec<StorageFunctionMetadataV4>',
|
||||
storage.unwrap().map((v): StorageFunctionMetadataV4 => toV4StorageFunction(registry, v))
|
||||
)
|
||||
: undefined
|
||||
})
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
// Copyright 2017-2019 @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 { EventMetadataV4, FunctionMetadataV4 } from '@polkadot/types/interfaces/metadata';
|
||||
import { Registry } from '@polkadot/types/types';
|
||||
import { MetadataInterface } from '../types';
|
||||
|
||||
import Option from '@polkadot/types/codec/Option';
|
||||
import Struct from '@polkadot/types/codec/Struct';
|
||||
import Vec from '@polkadot/types/codec/Vec';
|
||||
import Text from '@polkadot/types/primitive/Text';
|
||||
import { StorageFunctionMetadata } from './Storage';
|
||||
|
||||
/**
|
||||
* @name ModuleMetadataV4
|
||||
* @description
|
||||
* The definition of a module in the system
|
||||
*/
|
||||
export class ModuleMetadataV4 extends Struct {
|
||||
constructor (registry: Registry, value?: any) {
|
||||
super(registry, {
|
||||
name: 'Text',
|
||||
prefix: 'Text',
|
||||
storage: Option.with(Vec.with(StorageFunctionMetadata)),
|
||||
calls: Option.with('Vec<FunctionMetadataV4>'),
|
||||
events: Option.with('Vec<EventMetadataV4>')
|
||||
}, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description the module calls
|
||||
*/
|
||||
public get calls (): Option<Vec<FunctionMetadataV4>> {
|
||||
return this.get('calls') as Option<Vec<FunctionMetadataV4>>;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description the module events
|
||||
*/
|
||||
public get events (): Option<Vec<EventMetadataV4>> {
|
||||
return this.get('events') as Option<Vec<EventMetadataV4>>;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description the module name
|
||||
*/
|
||||
public get name (): Text {
|
||||
return this.get('name') as Text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description the module prefix
|
||||
*/
|
||||
public get prefix (): Text {
|
||||
return this.get('prefix') as Text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description the associated module storage
|
||||
*/
|
||||
public get storage (): Option<Vec<StorageFunctionMetadata>> {
|
||||
return this.get('storage') as Option<Vec<StorageFunctionMetadata>>;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @name MetadataV4
|
||||
* @description
|
||||
* The runtime metadata as a decoded structure
|
||||
*/
|
||||
export default class MetadataV4 extends Struct implements MetadataInterface<ModuleMetadataV4> {
|
||||
constructor (registry: Registry, value?: any) {
|
||||
super(registry, {
|
||||
modules: Vec.with(ModuleMetadataV4)
|
||||
}, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The associated modules for this structure
|
||||
*/
|
||||
public get modules (): Vec<ModuleMetadataV4> {
|
||||
return this.get('modules') as Vec<ModuleMetadataV4>;
|
||||
}
|
||||
}
|
||||
@@ -1,132 +0,0 @@
|
||||
// Copyright 2017-2019 @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 { DoubleMapTypeV4, MapTypeV4, PlainTypeV4, StorageFunctionModifierV4 } from '@polkadot/types/interfaces/metadata';
|
||||
import { AnyNumber, Registry } from '@polkadot/types/types';
|
||||
|
||||
import { assert } from '@polkadot/util';
|
||||
|
||||
import Enum from '@polkadot/types/codec/Enum';
|
||||
import Struct from '@polkadot/types/codec/Struct';
|
||||
import Vec from '@polkadot/types/codec/Vec';
|
||||
import Bytes from '@polkadot/types/primitive/Bytes';
|
||||
import Text from '@polkadot/types/primitive/Text';
|
||||
|
||||
export class StorageFunctionType extends Enum {
|
||||
constructor (registry: Registry, value?: any, index?: number) {
|
||||
super(registry, {
|
||||
Plain: 'PlainTypeV4',
|
||||
Map: 'MapTypeV4',
|
||||
DoubleMap: 'DoubleMapTypeV4'
|
||||
}, value, index);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The value as a mapped value
|
||||
*/
|
||||
public get asDoubleMap (): DoubleMapTypeV4 {
|
||||
assert(this.isDoubleMap, `Cannot convert '${this.type}' via asDoubleMap`);
|
||||
|
||||
return this.value as DoubleMapTypeV4;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The value as a mapped value
|
||||
*/
|
||||
public get asMap (): MapTypeV4 {
|
||||
assert(this.isMap, `Cannot convert '${this.type}' via asMap`);
|
||||
|
||||
return this.value as MapTypeV4;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The value as a [[Type]] value
|
||||
*/
|
||||
public get asPlain (): PlainTypeV4 {
|
||||
assert(this.isPlain, `Cannot convert '${this.type}' via asPlain`);
|
||||
|
||||
return this.value as PlainTypeV4;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description `true` if the storage entry is a doublemap
|
||||
*/
|
||||
public get isDoubleMap (): boolean {
|
||||
return this.toNumber() === 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description `true` if the storage entry is a map
|
||||
*/
|
||||
public get isMap (): boolean {
|
||||
return this.toNumber() === 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description `true` if the storage entry is a plain type
|
||||
*/
|
||||
public get isPlain (): boolean {
|
||||
return this.toNumber() === 0;
|
||||
}
|
||||
}
|
||||
|
||||
export interface StorageFunctionMetadataValue {
|
||||
name: string | Text;
|
||||
modifier: StorageFunctionModifierV4 | AnyNumber;
|
||||
type: StorageFunctionType;
|
||||
fallback: Bytes;
|
||||
documentation: Vec<Text> | string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* @name StorageFunctionMetadata
|
||||
* @description
|
||||
* The definition of a storage function
|
||||
*/
|
||||
export class StorageFunctionMetadata extends Struct {
|
||||
constructor (registry: Registry, value?: StorageFunctionMetadataValue | Uint8Array) {
|
||||
super(registry, {
|
||||
name: 'Text',
|
||||
modifier: 'StorageFunctionModifierV4',
|
||||
type: StorageFunctionType,
|
||||
fallback: 'Bytes',
|
||||
documentation: 'Vec<Text>'
|
||||
}, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The default value of the storage function
|
||||
*/
|
||||
public get fallback (): Bytes {
|
||||
return this.get('fallback') as Bytes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The [[Text]] documentation
|
||||
*/
|
||||
public get documentation (): Vec<Text> {
|
||||
return this.get('documentation') as Vec<Text>;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The key name
|
||||
*/
|
||||
public get name (): Text {
|
||||
return this.get('name') as Text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The modifier
|
||||
*/
|
||||
public get modifier (): StorageFunctionModifierV4 {
|
||||
return this.get('modifier') as StorageFunctionModifierV4;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The [[StorageFunctionType]]
|
||||
*/
|
||||
public get type (): StorageFunctionType {
|
||||
return this.get('type') as StorageFunctionType;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
// Copyright 2017-2019 @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 MetadataV4, { ModuleMetadataV4 } from './Metadata';
|
||||
|
||||
export default MetadataV4;
|
||||
|
||||
export {
|
||||
ModuleMetadataV4
|
||||
};
|
||||
@@ -2,18 +2,14 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { MetadataV4, MetadataV5, ModuleMetadataV5, StorageFunctionMetadataV4, StorageFunctionMetadataV5 } from '@polkadot/types/interfaces/metadata';
|
||||
import { Registry } from '@polkadot/types/types';
|
||||
|
||||
import { assert } from '@polkadot/util';
|
||||
|
||||
import { createType, Option, Vec } from '@polkadot/types/codec';
|
||||
import { createType, Option } from '@polkadot/types/codec';
|
||||
import StorageHasher from '@polkadot/types/primitive/StorageHasher';
|
||||
import Text from '@polkadot/types/primitive/Text';
|
||||
import MetadataV4 from './Metadata';
|
||||
import MetadataV5 from '../v5';
|
||||
import { ModuleMetadataV5 } from '../v5/Metadata';
|
||||
import { StorageFunctionMetadata, StorageFunctionType } from '../v5/Storage';
|
||||
import { StorageFunctionMetadata as StorageFunctionMetadataV4 } from './Storage';
|
||||
|
||||
const hasherMap: Map<string, string> = new Map([
|
||||
['blake2_128', 'Blake2_128'],
|
||||
@@ -34,7 +30,7 @@ function toStorageHasher (registry: Registry, text: Text): StorageHasher {
|
||||
/**
|
||||
* Convert V4 StorageFunction to V5 StorageFunction
|
||||
*/
|
||||
function toV5StorageFunction (registry: Registry, storageFn: StorageFunctionMetadataV4): StorageFunctionMetadata {
|
||||
function toV5StorageFunction (registry: Registry, storageFn: StorageFunctionMetadataV4): StorageFunctionMetadataV5 {
|
||||
const { documentation, fallback, modifier, name, type } = storageFn;
|
||||
const [newType, index] = type.isPlain
|
||||
? [type.asPlain, 0]
|
||||
@@ -48,12 +44,12 @@ function toV5StorageFunction (registry: Registry, storageFn: StorageFunctionMeta
|
||||
key2Hasher: toStorageHasher(registry, type.asDoubleMap.key2Hasher)
|
||||
}), 2];
|
||||
|
||||
return new StorageFunctionMetadata(registry, {
|
||||
return createType(registry, 'StorageFunctionMetadataV5', {
|
||||
documentation,
|
||||
fallback,
|
||||
name,
|
||||
modifier,
|
||||
type: new StorageFunctionType(registry, newType, index)
|
||||
type: createType(registry, 'StorageFunctionTypeV5', newType, index)
|
||||
});
|
||||
}
|
||||
|
||||
@@ -62,16 +58,16 @@ function toV5StorageFunction (registry: Registry, storageFn: StorageFunctionMeta
|
||||
* See https://github.com/paritytech/substrate/pull/2836/files for details
|
||||
*/
|
||||
export default function toV5 (registry: Registry, { modules }: MetadataV4): MetadataV5 {
|
||||
return new MetadataV5(registry, {
|
||||
return createType(registry, 'MetadataV5', {
|
||||
modules: modules.map(({ calls, events, name, prefix, storage }): ModuleMetadataV5 =>
|
||||
new ModuleMetadataV5(registry, {
|
||||
createType(registry, 'ModuleMetadataV5', {
|
||||
name,
|
||||
prefix,
|
||||
storage: storage.isSome
|
||||
? new Option(
|
||||
registry,
|
||||
Vec.with(StorageFunctionMetadata),
|
||||
storage.unwrap().map((v): StorageFunctionMetadata => toV5StorageFunction(registry, v))
|
||||
'Vec<StorageFunctionMetadataV5>',
|
||||
storage.unwrap().map((v): StorageFunctionMetadataV5 => toV5StorageFunction(registry, v))
|
||||
)
|
||||
: undefined,
|
||||
calls,
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
// Copyright 2017-2019 @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 { EventMetadataV5, FunctionMetadataV5 } from '@polkadot/types/interfaces/metadata';
|
||||
import { Registry } from '@polkadot/types/types';
|
||||
import { MetadataInterface } from '../types';
|
||||
|
||||
import Option from '@polkadot/types/codec/Option';
|
||||
import Struct from '@polkadot/types/codec/Struct';
|
||||
import Vec from '@polkadot/types/codec/Vec';
|
||||
import Text from '@polkadot/types/primitive/Text';
|
||||
import { StorageFunctionMetadata } from './Storage';
|
||||
|
||||
/**
|
||||
* @name ModuleMetadataV5
|
||||
* @description
|
||||
* The definition of a module in the system
|
||||
*/
|
||||
export class ModuleMetadataV5 extends Struct {
|
||||
constructor (registry: Registry, value?: any) {
|
||||
super(registry, {
|
||||
name: 'Text',
|
||||
prefix: 'Text',
|
||||
storage: Option.with(Vec.with(StorageFunctionMetadata)),
|
||||
calls: Option.with('Vec<FunctionMetadataV5>'),
|
||||
events: Option.with('Vec<EventMetadataV5>')
|
||||
}, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description the module calls
|
||||
*/
|
||||
public get calls (): Option<Vec<FunctionMetadataV5>> {
|
||||
return this.get('calls') as Option<Vec<FunctionMetadataV5>>;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description the module events
|
||||
*/
|
||||
public get events (): Option<Vec<EventMetadataV5>> {
|
||||
return this.get('events') as Option<Vec<EventMetadataV5>>;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description the module name
|
||||
*/
|
||||
public get name (): Text {
|
||||
return this.get('name') as Text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description the module prefix
|
||||
*/
|
||||
public get prefix (): Text {
|
||||
return this.get('prefix') as Text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description the associated module storage
|
||||
*/
|
||||
public get storage (): Option<Vec<StorageFunctionMetadata>> {
|
||||
return this.get('storage') as Option<Vec<StorageFunctionMetadata>>;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @name MetadataV5
|
||||
* @description
|
||||
* The runtime metadata as a decoded structure
|
||||
*/
|
||||
export default class MetadataV5 extends Struct implements MetadataInterface<ModuleMetadataV5> {
|
||||
constructor (registry: Registry, value?: any) {
|
||||
super(registry, {
|
||||
modules: Vec.with(ModuleMetadataV5)
|
||||
}, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The associated modules for this structure
|
||||
*/
|
||||
public get modules (): Vec<ModuleMetadataV5> {
|
||||
return this.get('modules') as Vec<ModuleMetadataV5>;
|
||||
}
|
||||
}
|
||||
@@ -1,132 +0,0 @@
|
||||
// Copyright 2017-2019 @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 { DoubleMapTypeV5, MapTypeV5, PlainTypeV5, StorageFunctionModifierV5 } from '@polkadot/types/interfaces/metadata';
|
||||
import { AnyNumber, Registry } from '@polkadot/types/types';
|
||||
|
||||
import { assert } from '@polkadot/util';
|
||||
|
||||
import Enum from '@polkadot/types/codec/Enum';
|
||||
import Struct from '@polkadot/types/codec/Struct';
|
||||
import Vec from '@polkadot/types/codec/Vec';
|
||||
import Bytes from '@polkadot/types/primitive/Bytes';
|
||||
import Text from '@polkadot/types/primitive/Text';
|
||||
|
||||
export class StorageFunctionType extends Enum {
|
||||
constructor (registry: Registry, value?: any, index?: number) {
|
||||
super(registry, {
|
||||
Plain: 'PlainTypeV5',
|
||||
Map: 'MapTypeV5',
|
||||
DoubleMap: 'DoubleMapTypeV5'
|
||||
}, value, index);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The value as a mapped value
|
||||
*/
|
||||
public get asDoubleMap (): DoubleMapTypeV5 {
|
||||
assert(this.isDoubleMap, `Cannot convert '${this.type}' via asDoubleMap`);
|
||||
|
||||
return this.value as DoubleMapTypeV5;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The value as a mapped value
|
||||
*/
|
||||
public get asMap (): MapTypeV5 {
|
||||
assert(this.isMap, `Cannot convert '${this.type}' via asMap`);
|
||||
|
||||
return this.value as MapTypeV5;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The value as a [[Type]] value
|
||||
*/
|
||||
public get asPlain (): PlainTypeV5 {
|
||||
assert(this.isPlain, `Cannot convert '${this.type}' via asPlain`);
|
||||
|
||||
return this.value as PlainTypeV5;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description `true` if the storage entry is a doublemap
|
||||
*/
|
||||
public get isDoubleMap (): boolean {
|
||||
return this.toNumber() === 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description `true` if the storage entry is a map
|
||||
*/
|
||||
public get isMap (): boolean {
|
||||
return this.toNumber() === 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description `true` if the storage entry is a plain type
|
||||
*/
|
||||
public get isPlain (): boolean {
|
||||
return this.toNumber() === 0;
|
||||
}
|
||||
}
|
||||
|
||||
export interface StorageFunctionMetadataValue {
|
||||
name: string | Text;
|
||||
modifier: StorageFunctionModifierV5 | AnyNumber;
|
||||
type: StorageFunctionType;
|
||||
fallback: Bytes;
|
||||
documentation: Vec<Text> | string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* @name StorageFunctionMetadata
|
||||
* @description
|
||||
* The definition of a storage function
|
||||
*/
|
||||
export class StorageFunctionMetadata extends Struct {
|
||||
constructor (registry: Registry, value?: StorageFunctionMetadataValue | Uint8Array) {
|
||||
super(registry, {
|
||||
name: 'Text',
|
||||
modifier: 'StorageFunctionModifierV5',
|
||||
type: StorageFunctionType,
|
||||
fallback: 'Bytes',
|
||||
documentation: 'Vec<Text>'
|
||||
}, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The default value of the storage function
|
||||
*/
|
||||
public get fallback (): Bytes {
|
||||
return this.get('fallback') as Bytes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The [[Text]] documentation
|
||||
*/
|
||||
public get documentation (): Vec<Text> {
|
||||
return this.get('documentation') as Vec<Text>;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The key name
|
||||
*/
|
||||
public get name (): Text {
|
||||
return this.get('name') as Text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The modifier
|
||||
*/
|
||||
public get modifier (): StorageFunctionModifierV5 {
|
||||
return this.get('modifier') as StorageFunctionModifierV5;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The [[StorageFunctionType]]
|
||||
*/
|
||||
public get type (): StorageFunctionType {
|
||||
return this.get('type') as StorageFunctionType;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
// Copyright 2017-2019 @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 MetadataV5, { ModuleMetadataV5 } from './Metadata';
|
||||
|
||||
export default MetadataV5;
|
||||
|
||||
export {
|
||||
ModuleMetadataV5
|
||||
};
|
||||
@@ -2,20 +2,19 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { MetadataV5, MetadataV6, ModuleMetadataV6 } from '@polkadot/types/interfaces/metadata';
|
||||
import { Registry } from '@polkadot/types/types';
|
||||
|
||||
import MetadataV5 from './Metadata';
|
||||
import MetadataV6 from '../v6';
|
||||
import { ModuleMetadataV6 } from '../v6/Metadata';
|
||||
import { createType } from '@polkadot/types';
|
||||
|
||||
/**
|
||||
* Convert from MetadataV5 to MetadataV6
|
||||
* See https://github.com/polkadot-js/api/issues/1043 for details
|
||||
*/
|
||||
export default function toV6 (registry: Registry, { modules }: MetadataV5): MetadataV6 {
|
||||
return new MetadataV6(registry, {
|
||||
return createType(registry, 'MetadataV6', {
|
||||
modules: modules.map(({ calls, events, name, prefix, storage }): ModuleMetadataV6 =>
|
||||
new ModuleMetadataV6(registry, {
|
||||
createType(registry, 'ModuleMetadataV6', {
|
||||
calls,
|
||||
constants: [],
|
||||
events,
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
// Copyright 2017-2019 @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 { EventMetadataV6, FunctionMetadataV6, ModuleConstantMetadataV6 } from '@polkadot/types/interfaces/metadata';
|
||||
import { Registry } from '@polkadot/types/types';
|
||||
import { MetadataInterface } from '../types';
|
||||
|
||||
import Option from '@polkadot/types/codec/Option';
|
||||
import Struct from '@polkadot/types/codec/Struct';
|
||||
import Vec from '@polkadot/types/codec/Vec';
|
||||
import Text from '@polkadot/types/primitive/Text';
|
||||
import { StorageEntryMetadata } from './Storage';
|
||||
|
||||
/**
|
||||
* @name ModuleMetadataV6
|
||||
* @description
|
||||
* The definition of a module in the system
|
||||
*/
|
||||
export class ModuleMetadataV6 extends Struct {
|
||||
constructor (registry: Registry, value?: any) {
|
||||
super(registry, {
|
||||
name: 'Text',
|
||||
prefix: 'Text',
|
||||
storage: Option.with(Vec.with(StorageEntryMetadata)),
|
||||
calls: Option.with('Vec<FunctionMetadataV6>'),
|
||||
events: Option.with('Vec<EventMetadataV6>'),
|
||||
constants: 'Vec<ModuleConstantMetadataV6>'
|
||||
}, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description the module calls
|
||||
*/
|
||||
public get calls (): Option<Vec<FunctionMetadataV6>> {
|
||||
return this.get('calls') as Option<Vec<FunctionMetadataV6>>;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description the module constants
|
||||
*/
|
||||
public get constants (): Vec<ModuleConstantMetadataV6> {
|
||||
return this.get('constants') as Vec<ModuleConstantMetadataV6>;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description the module events
|
||||
*/
|
||||
public get events (): Option<Vec<EventMetadataV6>> {
|
||||
return this.get('events') as Option<Vec<EventMetadataV6>>;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description the module name
|
||||
*/
|
||||
public get name (): Text {
|
||||
return this.get('name') as Text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description the module prefix
|
||||
*/
|
||||
public get prefix (): Text {
|
||||
return this.get('prefix') as Text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description the associated module storage
|
||||
*/
|
||||
public get storage (): Option<Vec<StorageEntryMetadata>> {
|
||||
return this.get('storage') as Option<Vec<StorageEntryMetadata>>;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @name MetadataV6
|
||||
* @description
|
||||
* The runtime metadata as a decoded structure
|
||||
*/
|
||||
export default class MetadataV6 extends Struct implements MetadataInterface<ModuleMetadataV6> {
|
||||
constructor (registry: Registry, value?: any) {
|
||||
super(registry, {
|
||||
modules: Vec.with(ModuleMetadataV6)
|
||||
}, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The associated modules for this structure
|
||||
*/
|
||||
public get modules (): Vec<ModuleMetadataV6> {
|
||||
return this.get('modules') as Vec<ModuleMetadataV6>;
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
// Copyright 2017-2019 @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 { StorageFunctionMetadata, StorageFunctionMetadataValue, StorageFunctionType } from '../v5/Storage';
|
||||
|
||||
// Re-export classes that haven't changed between V5 and V6
|
||||
export {
|
||||
StorageFunctionMetadata as StorageEntryMetadata,
|
||||
StorageFunctionMetadataValue as StorageEntryMetadataValue,
|
||||
StorageFunctionType as StorageEntryType
|
||||
};
|
||||
@@ -1,11 +0,0 @@
|
||||
// Copyright 2017-2019 @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 MetadataV6, { ModuleMetadataV6 } from './Metadata';
|
||||
|
||||
export default MetadataV6;
|
||||
|
||||
export {
|
||||
ModuleMetadataV6
|
||||
};
|
||||
@@ -2,26 +2,24 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { MetadataV6, MetadataV7, ModuleMetadataV7 } from '@polkadot/types/interfaces/metadata';
|
||||
import { Registry } from '@polkadot/types/types';
|
||||
|
||||
import MetadataV6 from './Metadata';
|
||||
import MetadataV7 from '../v7';
|
||||
import { ModuleMetadataV7 } from '../v7/Metadata';
|
||||
import { StorageMetadata as StorageV7 } from '../v7/Storage';
|
||||
import { createType } from '@polkadot/types';
|
||||
|
||||
/**
|
||||
* Convert from MetadataV6 to MetadataV7
|
||||
*/
|
||||
export default function toV7 (registry: Registry, { modules }: MetadataV6): MetadataV7 {
|
||||
return new MetadataV7(registry, {
|
||||
return createType(registry, 'MetadataV7', {
|
||||
modules: modules.map(({ calls, constants, events, name, prefix, storage }): ModuleMetadataV7 =>
|
||||
new ModuleMetadataV7(registry, {
|
||||
createType(registry, 'ModuleMetadataV7', {
|
||||
calls,
|
||||
constants,
|
||||
events,
|
||||
name,
|
||||
storage: storage.isSome
|
||||
? new StorageV7(registry, { prefix, items: storage.unwrap() })
|
||||
? createType(registry, 'StorageMetadataV7', { prefix, items: storage.unwrap() })
|
||||
: null
|
||||
})
|
||||
)
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
// Copyright 2017-2019 @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 { EventMetadataV7, FunctionMetadataV7, ModuleConstantMetadataV7 } from '@polkadot/types/interfaces/metadata';
|
||||
import { Registry } from '@polkadot/types/types';
|
||||
import { MetadataInterface } from '../types';
|
||||
|
||||
import Option from '@polkadot/types/codec/Option';
|
||||
import Struct from '@polkadot/types/codec/Struct';
|
||||
import Vec from '@polkadot/types/codec/Vec';
|
||||
import Text from '@polkadot/types/primitive/Text';
|
||||
import { StorageMetadata } from './Storage';
|
||||
|
||||
/**
|
||||
* @name ModuleMetadataV7
|
||||
* @description
|
||||
* The definition of a module in the system
|
||||
*/
|
||||
export class ModuleMetadataV7 extends Struct {
|
||||
constructor (registry: Registry, value?: any) {
|
||||
super(registry, {
|
||||
name: 'Text',
|
||||
storage: Option.with(StorageMetadata),
|
||||
calls: Option.with('Vec<FunctionMetadataV7>'),
|
||||
events: Option.with('Vec<EventMetadataV7>'),
|
||||
constants: 'Vec<ModuleConstantMetadataV7>'
|
||||
}, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description the module calls
|
||||
*/
|
||||
public get calls (): Option<Vec<FunctionMetadataV7>> {
|
||||
return this.get('calls') as Option<Vec<FunctionMetadataV7>>;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description the module constants
|
||||
*/
|
||||
public get constants (): Vec<ModuleConstantMetadataV7> {
|
||||
return this.get('constants') as Vec<ModuleConstantMetadataV7>;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description the module events
|
||||
*/
|
||||
public get events (): Option<Vec<EventMetadataV7>> {
|
||||
return this.get('events') as Option<Vec<EventMetadataV7>>;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description the module name
|
||||
*/
|
||||
public get name (): Text {
|
||||
return this.get('name') as Text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description the associated module storage
|
||||
*/
|
||||
public get storage (): Option<StorageMetadata> {
|
||||
return this.get('storage') as Option<StorageMetadata>;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @name MetadataV7
|
||||
* @description
|
||||
* The runtime metadata as a decoded structure
|
||||
*/
|
||||
export default class MetadataV7 extends Struct implements MetadataInterface<ModuleMetadataV7> {
|
||||
constructor (registry: Registry, value?: any) {
|
||||
super(registry, {
|
||||
modules: Vec.with(ModuleMetadataV7)
|
||||
}, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The associated modules for this structure
|
||||
*/
|
||||
public get modules (): Vec<ModuleMetadataV7> {
|
||||
return this.get('modules') as Vec<ModuleMetadataV7>;
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
// Copyright 2017-2019 @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 { Registry } from '@polkadot/types/types';
|
||||
|
||||
import Struct from '@polkadot/types/codec/Struct';
|
||||
import Vec from '@polkadot/types/codec/Vec';
|
||||
import Text from '@polkadot/types/primitive/Text';
|
||||
import { StorageEntryMetadata, StorageEntryMetadataValue, StorageEntryType } from '../v6/Storage';
|
||||
|
||||
// Re-export classes that haven't changed between V6 and V7
|
||||
export {
|
||||
StorageEntryMetadata,
|
||||
StorageEntryMetadataValue,
|
||||
StorageEntryType
|
||||
};
|
||||
|
||||
export class StorageMetadata extends Struct {
|
||||
constructor (registry: Registry, value?: any) {
|
||||
super(registry, {
|
||||
prefix: 'Text',
|
||||
// NOTE renamed to items from entries (since Struct already has entries from Map)
|
||||
items: Vec.with(StorageEntryMetadata)
|
||||
}, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description the storage entries
|
||||
*/
|
||||
public get items (): Vec<StorageEntryMetadata> {
|
||||
return this.get('items') as Vec<StorageEntryMetadata>;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description the prefix for this module
|
||||
*/
|
||||
public get prefix (): Text {
|
||||
return this.get('prefix') as Text;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
// Copyright 2017-2019 @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 MetadataV7, { ModuleMetadataV7 } from './Metadata';
|
||||
|
||||
export default MetadataV7;
|
||||
|
||||
export {
|
||||
ModuleMetadataV7
|
||||
};
|
||||
@@ -2,19 +2,18 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { MetadataV7, MetadataV8, ModuleMetadataV8 } from '@polkadot/types/interfaces/metadata';
|
||||
import { Registry } from '@polkadot/types/types';
|
||||
|
||||
import MetadataV7 from './Metadata';
|
||||
import MetadataV8 from '../v8';
|
||||
import { ModuleMetadataV8 } from '../v8/Metadata';
|
||||
import { createType } from '@polkadot/types';
|
||||
|
||||
/**
|
||||
* Convert from MetadataV7 to MetadataV8
|
||||
*/
|
||||
export default function toV8 (registry: Registry, { modules }: MetadataV7): MetadataV8 {
|
||||
return new MetadataV8(registry, {
|
||||
return createType(registry, 'MetadataV8', {
|
||||
modules: modules.map(({ calls, constants, events, name, storage }): ModuleMetadataV8 =>
|
||||
new ModuleMetadataV8(registry, {
|
||||
createType(registry, 'ModuleMetadataV8', {
|
||||
calls,
|
||||
constants,
|
||||
errors: [],
|
||||
|
||||
@@ -1,109 +0,0 @@
|
||||
// Copyright 2017-2019 @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 { ErrorMetadataV8, EventMetadataV8, FunctionMetadataV8, ModuleConstantMetadataV8 } from '@polkadot/types/interfaces/metadata';
|
||||
import { Registry } from '@polkadot/types/types';
|
||||
import { MetadataInterface } from '../types';
|
||||
|
||||
import Option from '@polkadot/types/codec/Option';
|
||||
import Struct from '@polkadot/types/codec/Struct';
|
||||
import Vec from '@polkadot/types/codec/Vec';
|
||||
import Text from '@polkadot/types/primitive/Text';
|
||||
import { StorageMetadata } from './Storage';
|
||||
|
||||
// Note the following errors are non-duplicated and fill the first 2 slots for
|
||||
// each of the modules - this means that other errors start at index 2
|
||||
//
|
||||
// {
|
||||
// "name": "Other",
|
||||
// "documentation": [
|
||||
// "Other unspecified error"
|
||||
// ]
|
||||
// },
|
||||
// {
|
||||
// "name": "CannotLookup",
|
||||
// "documentation": [
|
||||
// "Can not lookup"
|
||||
// ]
|
||||
// }
|
||||
|
||||
/**
|
||||
* @name ModuleMetadataV8
|
||||
* @description
|
||||
* The definition of a module in the system
|
||||
*/
|
||||
export class ModuleMetadataV8 extends Struct {
|
||||
constructor (registry: Registry, value?: any) {
|
||||
super(registry, {
|
||||
name: 'Text',
|
||||
storage: Option.with(StorageMetadata),
|
||||
calls: Option.with('Vec<FunctionMetadataV8>'),
|
||||
events: Option.with('Vec<EventMetadataV8>'),
|
||||
constants: 'Vec<ModuleConstantMetadataV8>',
|
||||
errors: 'Vec<ErrorMetadataV8>'
|
||||
}, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description the module calls
|
||||
*/
|
||||
public get calls (): Option<Vec<FunctionMetadataV8>> {
|
||||
return this.get('calls') as Option<Vec<FunctionMetadataV8>>;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description the module constants
|
||||
*/
|
||||
public get constants (): Vec<ModuleConstantMetadataV8> {
|
||||
return this.get('constants') as Vec<ModuleConstantMetadataV8>;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description the module errors
|
||||
*/
|
||||
public get errors (): Vec<ErrorMetadataV8> {
|
||||
return this.get('errors') as Vec<ErrorMetadataV8>;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description the module events
|
||||
*/
|
||||
public get events (): Option<Vec<EventMetadataV8>> {
|
||||
return this.get('events') as Option<Vec<EventMetadataV8>>;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description the module name
|
||||
*/
|
||||
public get name (): Text {
|
||||
return this.get('name') as Text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description the associated module storage
|
||||
*/
|
||||
public get storage (): Option<StorageMetadata> {
|
||||
return this.get('storage') as Option<StorageMetadata>;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @name MetadataV8
|
||||
* @description
|
||||
* The runtime metadata as a decoded structure
|
||||
*/
|
||||
export default class MetadataV8 extends Struct implements MetadataInterface<ModuleMetadataV8> {
|
||||
constructor (registry: Registry, value?: any) {
|
||||
super(registry, {
|
||||
modules: Vec.with(ModuleMetadataV8)
|
||||
}, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The associated modules for this structure
|
||||
*/
|
||||
public get modules (): Vec<ModuleMetadataV8> {
|
||||
return this.get('modules') as Vec<ModuleMetadataV8>;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
// Copyright 2017-2019 @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.
|
||||
|
||||
export { StorageEntryMetadata, StorageEntryMetadataValue, StorageEntryType, StorageMetadata } from '../v7/Storage';
|
||||
@@ -1,11 +0,0 @@
|
||||
// Copyright 2017-2019 @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 MetadataV8, { ModuleMetadataV8 } from './Metadata';
|
||||
|
||||
export default MetadataV8;
|
||||
|
||||
export {
|
||||
ModuleMetadataV8
|
||||
};
|
||||
@@ -57,7 +57,7 @@ function initType<T extends Codec = Codec, K extends string = string> (registry:
|
||||
// An unsafe version of the `createType` below. It's unsafe because the `type`
|
||||
// argument here can be any string, which, if not parseable, will yield a
|
||||
// runtime error.
|
||||
export function createTypeUnsafe<T extends Codec = Codec, K extends string = string> (registry: Registry, type: K, params: any[] = [], isPedantic?: boolean): FromReg<T, K> {
|
||||
export function createTypeUnsafe<T extends Codec = Codec, K extends string = string> (registry: Registry, type: K, params: any[] = [], isPedantic?: boolean): T {
|
||||
try {
|
||||
return initType(registry, createClass<T, K>(registry, type), params, isPedantic);
|
||||
} catch (error) {
|
||||
@@ -72,7 +72,5 @@ export function createTypeUnsafe<T extends Codec = Codec, K extends string = str
|
||||
* @param params - The value to instantiate the type with
|
||||
*/
|
||||
export function createType<K extends InterfaceTypes> (registry: Registry, type: K, ...params: any[]): InterfaceRegistry[K] {
|
||||
// error TS2589: Type instantiation is excessively deep and possibly infinite.
|
||||
// The above happens with as Constructor<InterfaceRegistry[K]>;
|
||||
return createTypeUnsafe<Codec, K>(registry, type, params) as any;
|
||||
return createTypeUnsafe<InterfaceRegistry[K], K>(registry, type, params);
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ import { DispatchResult, DispatchResultOf } from '@polkadot/types/interfaces/uti
|
||||
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, DoubleMapTypeV3, DoubleMapTypeV4, DoubleMapTypeV5, DoubleMapTypeV6, DoubleMapTypeV7, DoubleMapTypeV8, ErrorMetadataV8, EventMetadataLatest, EventMetadataV0, EventMetadataV1, EventMetadataV2, EventMetadataV3, EventMetadataV4, EventMetadataV5, EventMetadataV6, EventMetadataV7, EventMetadataV8, FunctionArgumentMetadataLatest, FunctionArgumentMetadataV0, FunctionArgumentMetadataV1, FunctionArgumentMetadataV2, FunctionArgumentMetadataV3, FunctionArgumentMetadataV4, FunctionArgumentMetadataV5, FunctionArgumentMetadataV6, FunctionArgumentMetadataV7, FunctionArgumentMetadataV8, FunctionMetadataLatest, FunctionMetadataV0, FunctionMetadataV1, FunctionMetadataV2, FunctionMetadataV3, FunctionMetadataV4, FunctionMetadataV5, FunctionMetadataV6, FunctionMetadataV7, FunctionMetadataV8, MapTypeV0, MapTypeV2, MapTypeV3, MapTypeV4, MapTypeV5, MapTypeV6, MapTypeV7, MapTypeV8, MetadataV0, MetadataV1, ModuleConstantMetadataLatest, ModuleConstantMetadataV6, ModuleConstantMetadataV7, ModuleConstantMetadataV8, ModuleMetadataV0, ModuleMetadataV1, OuterDispatchCallV0, OuterDispatchMetadataV0, OuterEventEventMetadataEventsV0, OuterEventEventMetadataV0, OuterEventMetadataV0, PlainTypeLatest, PlainTypeV0, PlainTypeV2, PlainTypeV3, PlainTypeV4, PlainTypeV5, PlainTypeV6, PlainTypeV7, PlainTypeV8, RuntimeModuleMetadataV0, StorageEntryModifierLatest, StorageEntryModifierV6, StorageEntryModifierV7, StorageEntryModifierV8, StorageFunctionMetadataV0, StorageFunctionMetadataV1, StorageFunctionModifierV0, StorageFunctionModifierV1, StorageFunctionModifierV2, StorageFunctionModifierV3, StorageFunctionModifierV4, StorageFunctionModifierV5, StorageFunctionTypeV0, StorageFunctionTypeV1, StorageMetadataV0 } from '@polkadot/types/interfaces/metadata';
|
||||
import { CallMetadataV0, DoubleMapTypeV3, DoubleMapTypeV4, DoubleMapTypeV5, DoubleMapTypeV6, DoubleMapTypeV7, DoubleMapTypeV8, ErrorMetadataV8, EventMetadataLatest, EventMetadataV0, EventMetadataV1, EventMetadataV2, EventMetadataV3, EventMetadataV4, EventMetadataV5, EventMetadataV6, EventMetadataV7, EventMetadataV8, FunctionArgumentMetadataLatest, FunctionArgumentMetadataV0, FunctionArgumentMetadataV1, FunctionArgumentMetadataV2, FunctionArgumentMetadataV3, FunctionArgumentMetadataV4, FunctionArgumentMetadataV5, FunctionArgumentMetadataV6, FunctionArgumentMetadataV7, FunctionArgumentMetadataV8, FunctionMetadataLatest, FunctionMetadataV0, FunctionMetadataV1, FunctionMetadataV2, FunctionMetadataV3, FunctionMetadataV4, FunctionMetadataV5, FunctionMetadataV6, FunctionMetadataV7, FunctionMetadataV8, MapTypeV0, MapTypeV2, MapTypeV3, MapTypeV4, MapTypeV5, MapTypeV6, MapTypeV7, MapTypeV8, MetadataLatest, MetadataV0, MetadataV1, MetadataV2, MetadataV3, MetadataV4, MetadataV5, MetadataV6, MetadataV7, MetadataV8, ModuleConstantMetadataLatest, ModuleConstantMetadataV6, ModuleConstantMetadataV7, ModuleConstantMetadataV8, ModuleMetadataLatest, ModuleMetadataV0, ModuleMetadataV1, ModuleMetadataV2, ModuleMetadataV3, ModuleMetadataV4, ModuleMetadataV5, ModuleMetadataV6, ModuleMetadataV7, ModuleMetadataV8, OuterDispatchCallV0, OuterDispatchMetadataV0, OuterEventEventMetadataEventsV0, OuterEventEventMetadataV0, OuterEventMetadataV0, PlainTypeLatest, PlainTypeV0, PlainTypeV2, PlainTypeV3, PlainTypeV4, PlainTypeV5, PlainTypeV6, PlainTypeV7, PlainTypeV8, RuntimeModuleMetadataV0, StorageEntryMetadataLatest, StorageEntryMetadataV6, StorageEntryMetadataV7, StorageEntryMetadataV8, StorageEntryModifierLatest, StorageEntryModifierV6, StorageEntryModifierV7, StorageEntryModifierV8, StorageEntryTypeLatest, StorageEntryTypeV6, StorageEntryTypeV7, StorageEntryTypeV8, StorageFunctionMetadataV0, StorageFunctionMetadataV1, StorageFunctionMetadataV2, StorageFunctionMetadataV3, StorageFunctionMetadataV4, StorageFunctionMetadataV5, StorageFunctionModifierV0, StorageFunctionModifierV1, StorageFunctionModifierV2, StorageFunctionModifierV3, StorageFunctionModifierV4, StorageFunctionModifierV5, StorageFunctionTypeV0, StorageFunctionTypeV1, StorageFunctionTypeV2, StorageFunctionTypeV3, StorageFunctionTypeV4, StorageFunctionTypeV5, StorageMetadataV0, StorageMetadataV7, StorageMetadataV8 } from '@polkadot/types/interfaces/metadata';
|
||||
import { ApiId, ChainProperties, ExtrinsicOrHash, ExtrinsicStatus, Health, KeyValueOption, NetworkState, PeerInfo, RpcMethods, RuntimeDispatchInfo, RuntimeVersion, RuntimeVersionApi, StorageChangeSet } from '@polkadot/types/interfaces/rpc';
|
||||
|
||||
export interface InterfaceRegistry {
|
||||
@@ -892,12 +892,24 @@ export interface InterfaceRegistry {
|
||||
MapTypeV2: MapTypeV2;
|
||||
'Option<MapTypeV2>': Option<MapTypeV2>;
|
||||
'Vec<MapTypeV2>': Vec<MapTypeV2>;
|
||||
MetadataV2: MetadataV2;
|
||||
'Option<MetadataV2>': Option<MetadataV2>;
|
||||
'Vec<MetadataV2>': Vec<MetadataV2>;
|
||||
ModuleMetadataV2: ModuleMetadataV2;
|
||||
'Option<ModuleMetadataV2>': Option<ModuleMetadataV2>;
|
||||
'Vec<ModuleMetadataV2>': Vec<ModuleMetadataV2>;
|
||||
PlainTypeV2: PlainTypeV2;
|
||||
'Option<PlainTypeV2>': Option<PlainTypeV2>;
|
||||
'Vec<PlainTypeV2>': Vec<PlainTypeV2>;
|
||||
StorageFunctionMetadataV2: StorageFunctionMetadataV2;
|
||||
'Option<StorageFunctionMetadataV2>': Option<StorageFunctionMetadataV2>;
|
||||
'Vec<StorageFunctionMetadataV2>': Vec<StorageFunctionMetadataV2>;
|
||||
StorageFunctionModifierV2: StorageFunctionModifierV2;
|
||||
'Option<StorageFunctionModifierV2>': Option<StorageFunctionModifierV2>;
|
||||
'Vec<StorageFunctionModifierV2>': Vec<StorageFunctionModifierV2>;
|
||||
StorageFunctionTypeV2: StorageFunctionTypeV2;
|
||||
'Option<StorageFunctionTypeV2>': Option<StorageFunctionTypeV2>;
|
||||
'Vec<StorageFunctionTypeV2>': Vec<StorageFunctionTypeV2>;
|
||||
DoubleMapTypeV3: DoubleMapTypeV3;
|
||||
'Option<DoubleMapTypeV3>': Option<DoubleMapTypeV3>;
|
||||
'Vec<DoubleMapTypeV3>': Vec<DoubleMapTypeV3>;
|
||||
@@ -913,12 +925,24 @@ export interface InterfaceRegistry {
|
||||
MapTypeV3: MapTypeV3;
|
||||
'Option<MapTypeV3>': Option<MapTypeV3>;
|
||||
'Vec<MapTypeV3>': Vec<MapTypeV3>;
|
||||
MetadataV3: MetadataV3;
|
||||
'Option<MetadataV3>': Option<MetadataV3>;
|
||||
'Vec<MetadataV3>': Vec<MetadataV3>;
|
||||
ModuleMetadataV3: ModuleMetadataV3;
|
||||
'Option<ModuleMetadataV3>': Option<ModuleMetadataV3>;
|
||||
'Vec<ModuleMetadataV3>': Vec<ModuleMetadataV3>;
|
||||
PlainTypeV3: PlainTypeV3;
|
||||
'Option<PlainTypeV3>': Option<PlainTypeV3>;
|
||||
'Vec<PlainTypeV3>': Vec<PlainTypeV3>;
|
||||
StorageFunctionMetadataV3: StorageFunctionMetadataV3;
|
||||
'Option<StorageFunctionMetadataV3>': Option<StorageFunctionMetadataV3>;
|
||||
'Vec<StorageFunctionMetadataV3>': Vec<StorageFunctionMetadataV3>;
|
||||
StorageFunctionModifierV3: StorageFunctionModifierV3;
|
||||
'Option<StorageFunctionModifierV3>': Option<StorageFunctionModifierV3>;
|
||||
'Vec<StorageFunctionModifierV3>': Vec<StorageFunctionModifierV3>;
|
||||
StorageFunctionTypeV3: StorageFunctionTypeV3;
|
||||
'Option<StorageFunctionTypeV3>': Option<StorageFunctionTypeV3>;
|
||||
'Vec<StorageFunctionTypeV3>': Vec<StorageFunctionTypeV3>;
|
||||
DoubleMapTypeV4: DoubleMapTypeV4;
|
||||
'Option<DoubleMapTypeV4>': Option<DoubleMapTypeV4>;
|
||||
'Vec<DoubleMapTypeV4>': Vec<DoubleMapTypeV4>;
|
||||
@@ -934,12 +958,24 @@ export interface InterfaceRegistry {
|
||||
MapTypeV4: MapTypeV4;
|
||||
'Option<MapTypeV4>': Option<MapTypeV4>;
|
||||
'Vec<MapTypeV4>': Vec<MapTypeV4>;
|
||||
MetadataV4: MetadataV4;
|
||||
'Option<MetadataV4>': Option<MetadataV4>;
|
||||
'Vec<MetadataV4>': Vec<MetadataV4>;
|
||||
ModuleMetadataV4: ModuleMetadataV4;
|
||||
'Option<ModuleMetadataV4>': Option<ModuleMetadataV4>;
|
||||
'Vec<ModuleMetadataV4>': Vec<ModuleMetadataV4>;
|
||||
PlainTypeV4: PlainTypeV4;
|
||||
'Option<PlainTypeV4>': Option<PlainTypeV4>;
|
||||
'Vec<PlainTypeV4>': Vec<PlainTypeV4>;
|
||||
StorageFunctionMetadataV4: StorageFunctionMetadataV4;
|
||||
'Option<StorageFunctionMetadataV4>': Option<StorageFunctionMetadataV4>;
|
||||
'Vec<StorageFunctionMetadataV4>': Vec<StorageFunctionMetadataV4>;
|
||||
StorageFunctionModifierV4: StorageFunctionModifierV4;
|
||||
'Option<StorageFunctionModifierV4>': Option<StorageFunctionModifierV4>;
|
||||
'Vec<StorageFunctionModifierV4>': Vec<StorageFunctionModifierV4>;
|
||||
StorageFunctionTypeV4: StorageFunctionTypeV4;
|
||||
'Option<StorageFunctionTypeV4>': Option<StorageFunctionTypeV4>;
|
||||
'Vec<StorageFunctionTypeV4>': Vec<StorageFunctionTypeV4>;
|
||||
DoubleMapTypeV5: DoubleMapTypeV5;
|
||||
'Option<DoubleMapTypeV5>': Option<DoubleMapTypeV5>;
|
||||
'Vec<DoubleMapTypeV5>': Vec<DoubleMapTypeV5>;
|
||||
@@ -955,12 +991,24 @@ export interface InterfaceRegistry {
|
||||
MapTypeV5: MapTypeV5;
|
||||
'Option<MapTypeV5>': Option<MapTypeV5>;
|
||||
'Vec<MapTypeV5>': Vec<MapTypeV5>;
|
||||
MetadataV5: MetadataV5;
|
||||
'Option<MetadataV5>': Option<MetadataV5>;
|
||||
'Vec<MetadataV5>': Vec<MetadataV5>;
|
||||
ModuleMetadataV5: ModuleMetadataV5;
|
||||
'Option<ModuleMetadataV5>': Option<ModuleMetadataV5>;
|
||||
'Vec<ModuleMetadataV5>': Vec<ModuleMetadataV5>;
|
||||
PlainTypeV5: PlainTypeV5;
|
||||
'Option<PlainTypeV5>': Option<PlainTypeV5>;
|
||||
'Vec<PlainTypeV5>': Vec<PlainTypeV5>;
|
||||
StorageFunctionMetadataV5: StorageFunctionMetadataV5;
|
||||
'Option<StorageFunctionMetadataV5>': Option<StorageFunctionMetadataV5>;
|
||||
'Vec<StorageFunctionMetadataV5>': Vec<StorageFunctionMetadataV5>;
|
||||
StorageFunctionModifierV5: StorageFunctionModifierV5;
|
||||
'Option<StorageFunctionModifierV5>': Option<StorageFunctionModifierV5>;
|
||||
'Vec<StorageFunctionModifierV5>': Vec<StorageFunctionModifierV5>;
|
||||
StorageFunctionTypeV5: StorageFunctionTypeV5;
|
||||
'Option<StorageFunctionTypeV5>': Option<StorageFunctionTypeV5>;
|
||||
'Vec<StorageFunctionTypeV5>': Vec<StorageFunctionTypeV5>;
|
||||
DoubleMapTypeV6: DoubleMapTypeV6;
|
||||
'Option<DoubleMapTypeV6>': Option<DoubleMapTypeV6>;
|
||||
'Vec<DoubleMapTypeV6>': Vec<DoubleMapTypeV6>;
|
||||
@@ -976,15 +1024,27 @@ export interface InterfaceRegistry {
|
||||
MapTypeV6: MapTypeV6;
|
||||
'Option<MapTypeV6>': Option<MapTypeV6>;
|
||||
'Vec<MapTypeV6>': Vec<MapTypeV6>;
|
||||
MetadataV6: MetadataV6;
|
||||
'Option<MetadataV6>': Option<MetadataV6>;
|
||||
'Vec<MetadataV6>': Vec<MetadataV6>;
|
||||
ModuleConstantMetadataV6: ModuleConstantMetadataV6;
|
||||
'Option<ModuleConstantMetadataV6>': Option<ModuleConstantMetadataV6>;
|
||||
'Vec<ModuleConstantMetadataV6>': Vec<ModuleConstantMetadataV6>;
|
||||
ModuleMetadataV6: ModuleMetadataV6;
|
||||
'Option<ModuleMetadataV6>': Option<ModuleMetadataV6>;
|
||||
'Vec<ModuleMetadataV6>': Vec<ModuleMetadataV6>;
|
||||
PlainTypeV6: PlainTypeV6;
|
||||
'Option<PlainTypeV6>': Option<PlainTypeV6>;
|
||||
'Vec<PlainTypeV6>': Vec<PlainTypeV6>;
|
||||
StorageEntryModifierV6: StorageEntryModifierV6;
|
||||
'Option<StorageEntryModifierV6>': Option<StorageEntryModifierV6>;
|
||||
'Vec<StorageEntryModifierV6>': Vec<StorageEntryModifierV6>;
|
||||
StorageEntryMetadataV6: StorageEntryMetadataV6;
|
||||
'Option<StorageEntryMetadataV6>': Option<StorageEntryMetadataV6>;
|
||||
'Vec<StorageEntryMetadataV6>': Vec<StorageEntryMetadataV6>;
|
||||
StorageEntryTypeV6: StorageEntryTypeV6;
|
||||
'Option<StorageEntryTypeV6>': Option<StorageEntryTypeV6>;
|
||||
'Vec<StorageEntryTypeV6>': Vec<StorageEntryTypeV6>;
|
||||
DoubleMapTypeV7: DoubleMapTypeV7;
|
||||
'Option<DoubleMapTypeV7>': Option<DoubleMapTypeV7>;
|
||||
'Vec<DoubleMapTypeV7>': Vec<DoubleMapTypeV7>;
|
||||
@@ -1000,15 +1060,30 @@ export interface InterfaceRegistry {
|
||||
MapTypeV7: MapTypeV7;
|
||||
'Option<MapTypeV7>': Option<MapTypeV7>;
|
||||
'Vec<MapTypeV7>': Vec<MapTypeV7>;
|
||||
MetadataV7: MetadataV7;
|
||||
'Option<MetadataV7>': Option<MetadataV7>;
|
||||
'Vec<MetadataV7>': Vec<MetadataV7>;
|
||||
ModuleConstantMetadataV7: ModuleConstantMetadataV7;
|
||||
'Option<ModuleConstantMetadataV7>': Option<ModuleConstantMetadataV7>;
|
||||
'Vec<ModuleConstantMetadataV7>': Vec<ModuleConstantMetadataV7>;
|
||||
ModuleMetadataV7: ModuleMetadataV7;
|
||||
'Option<ModuleMetadataV7>': Option<ModuleMetadataV7>;
|
||||
'Vec<ModuleMetadataV7>': Vec<ModuleMetadataV7>;
|
||||
PlainTypeV7: PlainTypeV7;
|
||||
'Option<PlainTypeV7>': Option<PlainTypeV7>;
|
||||
'Vec<PlainTypeV7>': Vec<PlainTypeV7>;
|
||||
StorageEntryModifierV7: StorageEntryModifierV7;
|
||||
'Option<StorageEntryModifierV7>': Option<StorageEntryModifierV7>;
|
||||
'Vec<StorageEntryModifierV7>': Vec<StorageEntryModifierV7>;
|
||||
StorageEntryMetadataV7: StorageEntryMetadataV7;
|
||||
'Option<StorageEntryMetadataV7>': Option<StorageEntryMetadataV7>;
|
||||
'Vec<StorageEntryMetadataV7>': Vec<StorageEntryMetadataV7>;
|
||||
StorageEntryTypeV7: StorageEntryTypeV7;
|
||||
'Option<StorageEntryTypeV7>': Option<StorageEntryTypeV7>;
|
||||
'Vec<StorageEntryTypeV7>': Vec<StorageEntryTypeV7>;
|
||||
StorageMetadataV7: StorageMetadataV7;
|
||||
'Option<StorageMetadataV7>': Option<StorageMetadataV7>;
|
||||
'Vec<StorageMetadataV7>': Vec<StorageMetadataV7>;
|
||||
DoubleMapTypeV8: DoubleMapTypeV8;
|
||||
'Option<DoubleMapTypeV8>': Option<DoubleMapTypeV8>;
|
||||
'Vec<DoubleMapTypeV8>': Vec<DoubleMapTypeV8>;
|
||||
@@ -1027,15 +1102,30 @@ export interface InterfaceRegistry {
|
||||
MapTypeV8: MapTypeV8;
|
||||
'Option<MapTypeV8>': Option<MapTypeV8>;
|
||||
'Vec<MapTypeV8>': Vec<MapTypeV8>;
|
||||
MetadataV8: MetadataV8;
|
||||
'Option<MetadataV8>': Option<MetadataV8>;
|
||||
'Vec<MetadataV8>': Vec<MetadataV8>;
|
||||
ModuleConstantMetadataV8: ModuleConstantMetadataV8;
|
||||
'Option<ModuleConstantMetadataV8>': Option<ModuleConstantMetadataV8>;
|
||||
'Vec<ModuleConstantMetadataV8>': Vec<ModuleConstantMetadataV8>;
|
||||
ModuleMetadataV8: ModuleMetadataV8;
|
||||
'Option<ModuleMetadataV8>': Option<ModuleMetadataV8>;
|
||||
'Vec<ModuleMetadataV8>': Vec<ModuleMetadataV8>;
|
||||
PlainTypeV8: PlainTypeV8;
|
||||
'Option<PlainTypeV8>': Option<PlainTypeV8>;
|
||||
'Vec<PlainTypeV8>': Vec<PlainTypeV8>;
|
||||
StorageEntryModifierV8: StorageEntryModifierV8;
|
||||
'Option<StorageEntryModifierV8>': Option<StorageEntryModifierV8>;
|
||||
'Vec<StorageEntryModifierV8>': Vec<StorageEntryModifierV8>;
|
||||
StorageEntryMetadataV8: StorageEntryMetadataV8;
|
||||
'Option<StorageEntryMetadataV8>': Option<StorageEntryMetadataV8>;
|
||||
'Vec<StorageEntryMetadataV8>': Vec<StorageEntryMetadataV8>;
|
||||
StorageEntryTypeV8: StorageEntryTypeV8;
|
||||
'Option<StorageEntryTypeV8>': Option<StorageEntryTypeV8>;
|
||||
'Vec<StorageEntryTypeV8>': Vec<StorageEntryTypeV8>;
|
||||
StorageMetadataV8: StorageMetadataV8;
|
||||
'Option<StorageMetadataV8>': Option<StorageMetadataV8>;
|
||||
'Vec<StorageMetadataV8>': Vec<StorageMetadataV8>;
|
||||
EventMetadataLatest: EventMetadataLatest;
|
||||
'Option<EventMetadataLatest>': Option<EventMetadataLatest>;
|
||||
'Vec<EventMetadataLatest>': Vec<EventMetadataLatest>;
|
||||
@@ -1045,15 +1135,27 @@ export interface InterfaceRegistry {
|
||||
FunctionMetadataLatest: FunctionMetadataLatest;
|
||||
'Option<FunctionMetadataLatest>': Option<FunctionMetadataLatest>;
|
||||
'Vec<FunctionMetadataLatest>': Vec<FunctionMetadataLatest>;
|
||||
MetadataLatest: MetadataLatest;
|
||||
'Option<MetadataLatest>': Option<MetadataLatest>;
|
||||
'Vec<MetadataLatest>': Vec<MetadataLatest>;
|
||||
ModuleConstantMetadataLatest: ModuleConstantMetadataLatest;
|
||||
'Option<ModuleConstantMetadataLatest>': Option<ModuleConstantMetadataLatest>;
|
||||
'Vec<ModuleConstantMetadataLatest>': Vec<ModuleConstantMetadataLatest>;
|
||||
ModuleMetadataLatest: ModuleMetadataLatest;
|
||||
'Option<ModuleMetadataLatest>': Option<ModuleMetadataLatest>;
|
||||
'Vec<ModuleMetadataLatest>': Vec<ModuleMetadataLatest>;
|
||||
PlainTypeLatest: PlainTypeLatest;
|
||||
'Option<PlainTypeLatest>': Option<PlainTypeLatest>;
|
||||
'Vec<PlainTypeLatest>': Vec<PlainTypeLatest>;
|
||||
StorageEntryMetadataLatest: StorageEntryMetadataLatest;
|
||||
'Option<StorageEntryMetadataLatest>': Option<StorageEntryMetadataLatest>;
|
||||
'Vec<StorageEntryMetadataLatest>': Vec<StorageEntryMetadataLatest>;
|
||||
StorageEntryModifierLatest: StorageEntryModifierLatest;
|
||||
'Option<StorageEntryModifierLatest>': Option<StorageEntryModifierLatest>;
|
||||
'Vec<StorageEntryModifierLatest>': Vec<StorageEntryModifierLatest>;
|
||||
StorageEntryTypeLatest: StorageEntryTypeLatest;
|
||||
'Option<StorageEntryTypeLatest>': Option<StorageEntryTypeLatest>;
|
||||
'Vec<StorageEntryTypeLatest>': Vec<StorageEntryTypeLatest>;
|
||||
ApiId: ApiId;
|
||||
'Option<ApiId>': Option<ApiId>;
|
||||
'Vec<ApiId>': Vec<ApiId>;
|
||||
|
||||
@@ -110,8 +110,31 @@ export default {
|
||||
value: 'Type',
|
||||
linked: 'bool'
|
||||
},
|
||||
MetadataV2: {
|
||||
modules: 'Vec<ModuleMetadataV2>'
|
||||
},
|
||||
ModuleMetadataV2: {
|
||||
name: 'Text',
|
||||
prefix: 'Text',
|
||||
storage: 'Option<Vec<StorageFunctionMetadataV2>>',
|
||||
calls: 'Option<Vec<FunctionMetadataV2>>',
|
||||
events: 'Option<Vec<EventMetadataV2>>'
|
||||
},
|
||||
PlainTypeV2: 'Type',
|
||||
StorageFunctionMetadataV2: {
|
||||
name: 'Text',
|
||||
modifier: 'StorageFunctionModifierV2',
|
||||
type: 'StorageFunctionTypeV2',
|
||||
fallback: 'Bytes',
|
||||
documentation: 'Vec<Text>'
|
||||
},
|
||||
StorageFunctionModifierV2: 'StorageFunctionModifierV1',
|
||||
StorageFunctionTypeV2: {
|
||||
_enum: {
|
||||
Plain: 'PlainTypeV2',
|
||||
Map: 'MapTypeV2'
|
||||
}
|
||||
},
|
||||
|
||||
// v3
|
||||
DoubleMapTypeV3: {
|
||||
@@ -124,8 +147,32 @@ export default {
|
||||
FunctionArgumentMetadataV3: 'FunctionArgumentMetadataV2',
|
||||
FunctionMetadataV3: 'FunctionMetadataV2',
|
||||
MapTypeV3: 'MapTypeV2',
|
||||
MetadataV3: {
|
||||
modules: 'Vec<ModuleMetadataV3>'
|
||||
},
|
||||
ModuleMetadataV3: {
|
||||
name: 'Text',
|
||||
prefix: 'Text',
|
||||
storage: 'Option<Vec<StorageFunctionMetadataV3>>',
|
||||
calls: 'Option<Vec<FunctionMetadataV3>>',
|
||||
events: 'Option<Vec<EventMetadataV3>>'
|
||||
},
|
||||
PlainTypeV3: 'Type',
|
||||
StorageFunctionMetadataV3: {
|
||||
name: 'Text',
|
||||
modifier: 'StorageFunctionModifierV3',
|
||||
type: 'StorageFunctionTypeV3',
|
||||
fallback: 'Bytes',
|
||||
documentation: 'Vec<Text>'
|
||||
},
|
||||
StorageFunctionModifierV3: 'StorageFunctionModifierV2',
|
||||
StorageFunctionTypeV3: {
|
||||
_enum: {
|
||||
Plain: 'PlainTypeV3',
|
||||
Map: 'MapTypeV3',
|
||||
DoubleMap: 'DoubleMapTypeV3'
|
||||
}
|
||||
},
|
||||
|
||||
// v4
|
||||
DoubleMapTypeV4: {
|
||||
@@ -144,8 +191,32 @@ export default {
|
||||
value: 'Type',
|
||||
linked: 'bool'
|
||||
},
|
||||
MetadataV4: {
|
||||
modules: 'Vec<ModuleMetadataV4>'
|
||||
},
|
||||
ModuleMetadataV4: {
|
||||
name: 'Text',
|
||||
prefix: 'Text',
|
||||
storage: 'Option<Vec<StorageFunctionMetadataV4>>',
|
||||
calls: 'Option<Vec<FunctionMetadataV4>>',
|
||||
events: 'Option<Vec<EventMetadataV4>>'
|
||||
},
|
||||
PlainTypeV4: 'Type',
|
||||
StorageFunctionMetadataV4: {
|
||||
name: 'Text',
|
||||
modifier: 'StorageFunctionModifierV4',
|
||||
type: 'StorageFunctionTypeV4',
|
||||
fallback: 'Bytes',
|
||||
documentation: 'Vec<Text>'
|
||||
},
|
||||
StorageFunctionModifierV4: 'StorageFunctionModifierV3',
|
||||
StorageFunctionTypeV4: {
|
||||
_enum: {
|
||||
Plain: 'PlainTypeV4',
|
||||
Map: 'MapTypeV4',
|
||||
DoubleMap: 'DoubleMapTypeV4'
|
||||
}
|
||||
},
|
||||
|
||||
// v5
|
||||
DoubleMapTypeV5: {
|
||||
@@ -159,8 +230,32 @@ export default {
|
||||
FunctionArgumentMetadataV5: 'FunctionArgumentMetadataV4',
|
||||
FunctionMetadataV5: 'FunctionMetadataV4',
|
||||
MapTypeV5: 'MapTypeV4',
|
||||
MetadataV5: {
|
||||
modules: 'Vec<ModuleMetadataV5>'
|
||||
},
|
||||
ModuleMetadataV5: {
|
||||
name: 'Text',
|
||||
prefix: 'Text',
|
||||
storage: 'Option<Vec<StorageFunctionMetadataV5>>',
|
||||
calls: 'Option<Vec<FunctionMetadataV5>>',
|
||||
events: 'Option<Vec<EventMetadataV5>>'
|
||||
},
|
||||
PlainTypeV5: 'Type',
|
||||
StorageFunctionMetadataV5: {
|
||||
name: 'Text',
|
||||
modifier: 'StorageFunctionModifierV5',
|
||||
type: 'StorageFunctionTypeV5',
|
||||
fallback: 'Bytes',
|
||||
documentation: 'Vec<Text>'
|
||||
},
|
||||
StorageFunctionModifierV5: 'StorageFunctionModifierV4',
|
||||
StorageFunctionTypeV5: {
|
||||
_enum: {
|
||||
Plain: 'PlainTypeV5',
|
||||
Map: 'MapTypeV5',
|
||||
DoubleMap: 'DoubleMapTypeV5'
|
||||
}
|
||||
},
|
||||
|
||||
// v6
|
||||
DoubleMapTypeV6: 'DoubleMapTypeV5',
|
||||
@@ -168,14 +263,27 @@ export default {
|
||||
FunctionArgumentMetadataV6: 'FunctionArgumentMetadataV5',
|
||||
FunctionMetadataV6: 'FunctionMetadataV5',
|
||||
MapTypeV6: 'MapTypeV5',
|
||||
MetadataV6: {
|
||||
modules: 'Vec<ModuleMetadataV6>'
|
||||
},
|
||||
ModuleConstantMetadataV6: {
|
||||
name: 'Text',
|
||||
type: 'Type',
|
||||
value: 'Bytes',
|
||||
documentation: 'Vec<Text>'
|
||||
},
|
||||
ModuleMetadataV6: {
|
||||
name: 'Text',
|
||||
prefix: 'Text',
|
||||
storage: 'Option<Vec<StorageEntryMetadataV6>>',
|
||||
calls: 'Option<Vec<FunctionMetadataV6>>',
|
||||
events: 'Option<Vec<EventMetadataV6>>',
|
||||
constants: 'Vec<ModuleConstantMetadataV6>'
|
||||
},
|
||||
PlainTypeV6: 'Type',
|
||||
StorageEntryModifierV6: 'StorageFunctionModifierV5',
|
||||
StorageEntryMetadataV6: 'StorageFunctionMetadataV5',
|
||||
StorageEntryTypeV6: 'StorageFunctionTypeV5',
|
||||
|
||||
// v7
|
||||
DoubleMapTypeV7: 'DoubleMapTypeV6',
|
||||
@@ -183,9 +291,25 @@ export default {
|
||||
FunctionArgumentMetadataV7: 'FunctionArgumentMetadataV6',
|
||||
FunctionMetadataV7: 'FunctionMetadataV6',
|
||||
MapTypeV7: 'MapTypeV6',
|
||||
MetadataV7: {
|
||||
modules: 'Vec<ModuleMetadataV7>'
|
||||
},
|
||||
ModuleConstantMetadataV7: 'ModuleConstantMetadataV6',
|
||||
ModuleMetadataV7: {
|
||||
name: 'Text',
|
||||
storage: 'Option<StorageMetadataV7>',
|
||||
calls: 'Option<Vec<FunctionMetadataV7>>',
|
||||
events: 'Option<Vec<EventMetadataV7>>',
|
||||
constants: 'Vec<ModuleConstantMetadataV7>'
|
||||
},
|
||||
PlainTypeV7: 'Type',
|
||||
StorageEntryModifierV7: 'StorageEntryModifierV6',
|
||||
StorageEntryMetadataV7: 'StorageEntryMetadataV6',
|
||||
StorageEntryTypeV7: 'StorageEntryTypeV6',
|
||||
StorageMetadataV7: {
|
||||
prefix: 'Text',
|
||||
items: 'Vec<StorageEntryMetadataV7>'
|
||||
},
|
||||
|
||||
// v8
|
||||
DoubleMapTypeV8: 'DoubleMapTypeV7',
|
||||
@@ -197,16 +321,34 @@ export default {
|
||||
FunctionArgumentMetadataV8: 'FunctionArgumentMetadataV7',
|
||||
FunctionMetadataV8: 'FunctionMetadataV7',
|
||||
MapTypeV8: 'MapTypeV7',
|
||||
MetadataV8: {
|
||||
modules: 'Vec<ModuleMetadataV8>'
|
||||
},
|
||||
ModuleConstantMetadataV8: 'ModuleConstantMetadataV7',
|
||||
ModuleMetadataV8: {
|
||||
name: 'Text',
|
||||
storage: 'Option<StorageMetadataV8>',
|
||||
calls: 'Option<Vec<FunctionMetadataV8>>',
|
||||
events: 'Option<Vec<EventMetadataV8>>',
|
||||
constants: 'Vec<ModuleConstantMetadataV8>',
|
||||
errors: 'Vec<ErrorMetadataV8>'
|
||||
},
|
||||
PlainTypeV8: 'Type',
|
||||
StorageEntryModifierV8: 'StorageEntryModifierV7',
|
||||
StorageEntryMetadataV8: 'StorageEntryMetadataV7',
|
||||
StorageEntryTypeV8: 'StorageEntryTypeV7',
|
||||
StorageMetadataV8: 'StorageMetadataV7',
|
||||
|
||||
// This always maps to the latest
|
||||
EventMetadataLatest: 'EventMetadataV8',
|
||||
FunctionArgumentMetadataLatest: 'FunctionArgumentMetadataV8',
|
||||
FunctionMetadataLatest: 'FunctionMetadataV8',
|
||||
MetadataLatest: 'MetadataV8',
|
||||
ModuleConstantMetadataLatest: 'ModuleConstantMetadataV8',
|
||||
ModuleMetadataLatest: 'ModuleMetadataV8',
|
||||
PlainTypeLatest: 'PlainTypeV8',
|
||||
StorageEntryModifierLatest: 'StorageEntryModifierV8'
|
||||
StorageEntryMetadataLatest: 'StorageEntryMetadataV8',
|
||||
StorageEntryModifierLatest: 'StorageEntryModifierV8',
|
||||
StorageEntryTypeLatest: 'StorageEntryTypeV8'
|
||||
}
|
||||
};
|
||||
|
||||
@@ -233,6 +233,9 @@ export interface MapTypeV7 extends MapTypeV6 {}
|
||||
/** MapTypeV7 */
|
||||
export interface MapTypeV8 extends MapTypeV7 {}
|
||||
|
||||
/** MetadataV8 */
|
||||
export interface MetadataLatest extends MetadataV8 {}
|
||||
|
||||
/** Struct */
|
||||
export interface MetadataV0 extends Struct {
|
||||
/** OuterEventMetadataV0 */
|
||||
@@ -249,6 +252,48 @@ export interface MetadataV1 extends Struct {
|
||||
readonly modules: Vec<ModuleMetadataV1>;
|
||||
}
|
||||
|
||||
/** Struct */
|
||||
export interface MetadataV2 extends Struct {
|
||||
/** Vec<ModuleMetadataV2> */
|
||||
readonly modules: Vec<ModuleMetadataV2>;
|
||||
}
|
||||
|
||||
/** Struct */
|
||||
export interface MetadataV3 extends Struct {
|
||||
/** Vec<ModuleMetadataV3> */
|
||||
readonly modules: Vec<ModuleMetadataV3>;
|
||||
}
|
||||
|
||||
/** Struct */
|
||||
export interface MetadataV4 extends Struct {
|
||||
/** Vec<ModuleMetadataV4> */
|
||||
readonly modules: Vec<ModuleMetadataV4>;
|
||||
}
|
||||
|
||||
/** Struct */
|
||||
export interface MetadataV5 extends Struct {
|
||||
/** Vec<ModuleMetadataV5> */
|
||||
readonly modules: Vec<ModuleMetadataV5>;
|
||||
}
|
||||
|
||||
/** Struct */
|
||||
export interface MetadataV6 extends Struct {
|
||||
/** Vec<ModuleMetadataV6> */
|
||||
readonly modules: Vec<ModuleMetadataV6>;
|
||||
}
|
||||
|
||||
/** Struct */
|
||||
export interface MetadataV7 extends Struct {
|
||||
/** Vec<ModuleMetadataV7> */
|
||||
readonly modules: Vec<ModuleMetadataV7>;
|
||||
}
|
||||
|
||||
/** Struct */
|
||||
export interface MetadataV8 extends Struct {
|
||||
/** Vec<ModuleMetadataV8> */
|
||||
readonly modules: Vec<ModuleMetadataV8>;
|
||||
}
|
||||
|
||||
/** ModuleConstantMetadataV8 */
|
||||
export interface ModuleConstantMetadataLatest extends ModuleConstantMetadataV8 {}
|
||||
|
||||
@@ -270,6 +315,9 @@ export interface ModuleConstantMetadataV7 extends ModuleConstantMetadataV6 {}
|
||||
/** ModuleConstantMetadataV7 */
|
||||
export interface ModuleConstantMetadataV8 extends ModuleConstantMetadataV7 {}
|
||||
|
||||
/** ModuleMetadataV8 */
|
||||
export interface ModuleMetadataLatest extends ModuleMetadataV8 {}
|
||||
|
||||
/** Struct */
|
||||
export interface ModuleMetadataV0 extends Struct {
|
||||
/** Text */
|
||||
@@ -292,6 +340,108 @@ export interface ModuleMetadataV1 extends Struct {
|
||||
readonly events: Option<Vec<EventMetadataV1>>;
|
||||
}
|
||||
|
||||
/** Struct */
|
||||
export interface ModuleMetadataV2 extends Struct {
|
||||
/** Text */
|
||||
readonly name: Text;
|
||||
/** Text */
|
||||
readonly prefix: Text;
|
||||
/** Option<Vec<StorageFunctionMetadataV2>> */
|
||||
readonly storage: Option<Vec<StorageFunctionMetadataV2>>;
|
||||
/** Option<Vec<FunctionMetadataV2>> */
|
||||
readonly calls: Option<Vec<FunctionMetadataV2>>;
|
||||
/** Option<Vec<EventMetadataV2>> */
|
||||
readonly events: Option<Vec<EventMetadataV2>>;
|
||||
}
|
||||
|
||||
/** Struct */
|
||||
export interface ModuleMetadataV3 extends Struct {
|
||||
/** Text */
|
||||
readonly name: Text;
|
||||
/** Text */
|
||||
readonly prefix: Text;
|
||||
/** Option<Vec<StorageFunctionMetadataV3>> */
|
||||
readonly storage: Option<Vec<StorageFunctionMetadataV3>>;
|
||||
/** Option<Vec<FunctionMetadataV3>> */
|
||||
readonly calls: Option<Vec<FunctionMetadataV3>>;
|
||||
/** Option<Vec<EventMetadataV3>> */
|
||||
readonly events: Option<Vec<EventMetadataV3>>;
|
||||
}
|
||||
|
||||
/** Struct */
|
||||
export interface ModuleMetadataV4 extends Struct {
|
||||
/** Text */
|
||||
readonly name: Text;
|
||||
/** Text */
|
||||
readonly prefix: Text;
|
||||
/** Option<Vec<StorageFunctionMetadataV4>> */
|
||||
readonly storage: Option<Vec<StorageFunctionMetadataV4>>;
|
||||
/** Option<Vec<FunctionMetadataV4>> */
|
||||
readonly calls: Option<Vec<FunctionMetadataV4>>;
|
||||
/** Option<Vec<EventMetadataV4>> */
|
||||
readonly events: Option<Vec<EventMetadataV4>>;
|
||||
}
|
||||
|
||||
/** Struct */
|
||||
export interface ModuleMetadataV5 extends Struct {
|
||||
/** Text */
|
||||
readonly name: Text;
|
||||
/** Text */
|
||||
readonly prefix: Text;
|
||||
/** Option<Vec<StorageFunctionMetadataV5>> */
|
||||
readonly storage: Option<Vec<StorageFunctionMetadataV5>>;
|
||||
/** Option<Vec<FunctionMetadataV5>> */
|
||||
readonly calls: Option<Vec<FunctionMetadataV5>>;
|
||||
/** Option<Vec<EventMetadataV5>> */
|
||||
readonly events: Option<Vec<EventMetadataV5>>;
|
||||
}
|
||||
|
||||
/** Struct */
|
||||
export interface ModuleMetadataV6 extends Struct {
|
||||
/** Text */
|
||||
readonly name: Text;
|
||||
/** Text */
|
||||
readonly prefix: Text;
|
||||
/** Option<Vec<StorageEntryMetadataV6>> */
|
||||
readonly storage: Option<Vec<StorageEntryMetadataV6>>;
|
||||
/** Option<Vec<FunctionMetadataV6>> */
|
||||
readonly calls: Option<Vec<FunctionMetadataV6>>;
|
||||
/** Option<Vec<EventMetadataV6>> */
|
||||
readonly events: Option<Vec<EventMetadataV6>>;
|
||||
/** Vec<ModuleConstantMetadataV6> */
|
||||
readonly constants: Vec<ModuleConstantMetadataV6>;
|
||||
}
|
||||
|
||||
/** Struct */
|
||||
export interface ModuleMetadataV7 extends Struct {
|
||||
/** Text */
|
||||
readonly name: Text;
|
||||
/** Option<StorageMetadataV7> */
|
||||
readonly storage: Option<StorageMetadataV7>;
|
||||
/** Option<Vec<FunctionMetadataV7>> */
|
||||
readonly calls: Option<Vec<FunctionMetadataV7>>;
|
||||
/** Option<Vec<EventMetadataV7>> */
|
||||
readonly events: Option<Vec<EventMetadataV7>>;
|
||||
/** Vec<ModuleConstantMetadataV7> */
|
||||
readonly constants: Vec<ModuleConstantMetadataV7>;
|
||||
}
|
||||
|
||||
/** Struct */
|
||||
export interface ModuleMetadataV8 extends Struct {
|
||||
/** Text */
|
||||
readonly name: Text;
|
||||
/** Option<StorageMetadataV8> */
|
||||
readonly storage: Option<StorageMetadataV8>;
|
||||
/** Option<Vec<FunctionMetadataV8>> */
|
||||
readonly calls: Option<Vec<FunctionMetadataV8>>;
|
||||
/** Option<Vec<EventMetadataV8>> */
|
||||
readonly events: Option<Vec<EventMetadataV8>>;
|
||||
/** Vec<ModuleConstantMetadataV8> */
|
||||
readonly constants: Vec<ModuleConstantMetadataV8>;
|
||||
/** Vec<ErrorMetadataV8> */
|
||||
readonly errors: Vec<ErrorMetadataV8>;
|
||||
}
|
||||
|
||||
/** Struct */
|
||||
export interface OuterDispatchCallV0 extends Struct {
|
||||
/** Text */
|
||||
@@ -361,6 +511,18 @@ export interface RuntimeModuleMetadataV0 extends Struct {
|
||||
readonly storage: Option<StorageMetadataV0>;
|
||||
}
|
||||
|
||||
/** StorageEntryMetadataV8 */
|
||||
export interface StorageEntryMetadataLatest extends StorageEntryMetadataV8 {}
|
||||
|
||||
/** StorageFunctionMetadataV5 */
|
||||
export interface StorageEntryMetadataV6 extends StorageFunctionMetadataV5 {}
|
||||
|
||||
/** StorageEntryMetadataV6 */
|
||||
export interface StorageEntryMetadataV7 extends StorageEntryMetadataV6 {}
|
||||
|
||||
/** StorageEntryMetadataV7 */
|
||||
export interface StorageEntryMetadataV8 extends StorageEntryMetadataV7 {}
|
||||
|
||||
/** StorageEntryModifierV8 */
|
||||
export interface StorageEntryModifierLatest extends StorageEntryModifierV8 {}
|
||||
|
||||
@@ -373,6 +535,18 @@ export interface StorageEntryModifierV7 extends StorageEntryModifierV6 {}
|
||||
/** StorageEntryModifierV7 */
|
||||
export interface StorageEntryModifierV8 extends StorageEntryModifierV7 {}
|
||||
|
||||
/** StorageEntryTypeV8 */
|
||||
export interface StorageEntryTypeLatest extends StorageEntryTypeV8 {}
|
||||
|
||||
/** StorageFunctionTypeV5 */
|
||||
export interface StorageEntryTypeV6 extends StorageFunctionTypeV5 {}
|
||||
|
||||
/** StorageEntryTypeV6 */
|
||||
export interface StorageEntryTypeV7 extends StorageEntryTypeV6 {}
|
||||
|
||||
/** StorageEntryTypeV7 */
|
||||
export interface StorageEntryTypeV8 extends StorageEntryTypeV7 {}
|
||||
|
||||
/** Struct */
|
||||
export interface StorageFunctionMetadataV0 extends Struct {
|
||||
/** Text */
|
||||
@@ -390,6 +564,62 @@ export interface StorageFunctionMetadataV0 extends Struct {
|
||||
/** StorageFunctionMetadataV0 */
|
||||
export interface StorageFunctionMetadataV1 extends StorageFunctionMetadataV0 {}
|
||||
|
||||
/** Struct */
|
||||
export interface StorageFunctionMetadataV2 extends Struct {
|
||||
/** Text */
|
||||
readonly name: Text;
|
||||
/** StorageFunctionModifierV2 */
|
||||
readonly modifier: StorageFunctionModifierV2;
|
||||
/** StorageFunctionTypeV2 */
|
||||
readonly type: StorageFunctionTypeV2;
|
||||
/** Bytes */
|
||||
readonly fallback: Bytes;
|
||||
/** Vec<Text> */
|
||||
readonly documentation: Vec<Text>;
|
||||
}
|
||||
|
||||
/** Struct */
|
||||
export interface StorageFunctionMetadataV3 extends Struct {
|
||||
/** Text */
|
||||
readonly name: Text;
|
||||
/** StorageFunctionModifierV3 */
|
||||
readonly modifier: StorageFunctionModifierV3;
|
||||
/** StorageFunctionTypeV3 */
|
||||
readonly type: StorageFunctionTypeV3;
|
||||
/** Bytes */
|
||||
readonly fallback: Bytes;
|
||||
/** Vec<Text> */
|
||||
readonly documentation: Vec<Text>;
|
||||
}
|
||||
|
||||
/** Struct */
|
||||
export interface StorageFunctionMetadataV4 extends Struct {
|
||||
/** Text */
|
||||
readonly name: Text;
|
||||
/** StorageFunctionModifierV4 */
|
||||
readonly modifier: StorageFunctionModifierV4;
|
||||
/** StorageFunctionTypeV4 */
|
||||
readonly type: StorageFunctionTypeV4;
|
||||
/** Bytes */
|
||||
readonly fallback: Bytes;
|
||||
/** Vec<Text> */
|
||||
readonly documentation: Vec<Text>;
|
||||
}
|
||||
|
||||
/** Struct */
|
||||
export interface StorageFunctionMetadataV5 extends Struct {
|
||||
/** Text */
|
||||
readonly name: Text;
|
||||
/** StorageFunctionModifierV5 */
|
||||
readonly modifier: StorageFunctionModifierV5;
|
||||
/** StorageFunctionTypeV5 */
|
||||
readonly type: StorageFunctionTypeV5;
|
||||
/** Bytes */
|
||||
readonly fallback: Bytes;
|
||||
/** Vec<Text> */
|
||||
readonly documentation: Vec<Text>;
|
||||
}
|
||||
|
||||
/** Enum */
|
||||
export interface StorageFunctionModifierV0 extends Enum {
|
||||
/** 0:: Optional */
|
||||
@@ -430,6 +660,66 @@ export interface StorageFunctionTypeV0 extends Enum {
|
||||
/** StorageFunctionTypeV0 */
|
||||
export interface StorageFunctionTypeV1 extends StorageFunctionTypeV0 {}
|
||||
|
||||
/** Enum */
|
||||
export interface StorageFunctionTypeV2 extends Enum {
|
||||
/** 0:: Plain(PlainTypeV2) */
|
||||
readonly isPlain: boolean;
|
||||
/** PlainTypeV2 */
|
||||
readonly asPlain: PlainTypeV2;
|
||||
/** 1:: Map(MapTypeV2) */
|
||||
readonly isMap: boolean;
|
||||
/** MapTypeV2 */
|
||||
readonly asMap: MapTypeV2;
|
||||
}
|
||||
|
||||
/** Enum */
|
||||
export interface StorageFunctionTypeV3 extends Enum {
|
||||
/** 0:: Plain(PlainTypeV3) */
|
||||
readonly isPlain: boolean;
|
||||
/** PlainTypeV3 */
|
||||
readonly asPlain: PlainTypeV3;
|
||||
/** 1:: Map(MapTypeV3) */
|
||||
readonly isMap: boolean;
|
||||
/** MapTypeV3 */
|
||||
readonly asMap: MapTypeV3;
|
||||
/** 2:: DoubleMap(DoubleMapTypeV3) */
|
||||
readonly isDoubleMap: boolean;
|
||||
/** DoubleMapTypeV3 */
|
||||
readonly asDoubleMap: DoubleMapTypeV3;
|
||||
}
|
||||
|
||||
/** Enum */
|
||||
export interface StorageFunctionTypeV4 extends Enum {
|
||||
/** 0:: Plain(PlainTypeV4) */
|
||||
readonly isPlain: boolean;
|
||||
/** PlainTypeV4 */
|
||||
readonly asPlain: PlainTypeV4;
|
||||
/** 1:: Map(MapTypeV4) */
|
||||
readonly isMap: boolean;
|
||||
/** MapTypeV4 */
|
||||
readonly asMap: MapTypeV4;
|
||||
/** 2:: DoubleMap(DoubleMapTypeV4) */
|
||||
readonly isDoubleMap: boolean;
|
||||
/** DoubleMapTypeV4 */
|
||||
readonly asDoubleMap: DoubleMapTypeV4;
|
||||
}
|
||||
|
||||
/** Enum */
|
||||
export interface StorageFunctionTypeV5 extends Enum {
|
||||
/** 0:: Plain(PlainTypeV5) */
|
||||
readonly isPlain: boolean;
|
||||
/** PlainTypeV5 */
|
||||
readonly asPlain: PlainTypeV5;
|
||||
/** 1:: Map(MapTypeV5) */
|
||||
readonly isMap: boolean;
|
||||
/** MapTypeV5 */
|
||||
readonly asMap: MapTypeV5;
|
||||
/** 2:: DoubleMap(DoubleMapTypeV5) */
|
||||
readonly isDoubleMap: boolean;
|
||||
/** DoubleMapTypeV5 */
|
||||
readonly asDoubleMap: DoubleMapTypeV5;
|
||||
}
|
||||
|
||||
/** Struct */
|
||||
export interface StorageMetadataV0 extends Struct {
|
||||
/** Text */
|
||||
@@ -437,3 +727,14 @@ export interface StorageMetadataV0 extends Struct {
|
||||
/** Vec<StorageFunctionMetadataV0> */
|
||||
readonly functions: Vec<StorageFunctionMetadataV0>;
|
||||
}
|
||||
|
||||
/** Struct */
|
||||
export interface StorageMetadataV7 extends Struct {
|
||||
/** Text */
|
||||
readonly prefix: Text;
|
||||
/** Vec<StorageEntryMetadataV7> */
|
||||
readonly items: Vec<StorageEntryMetadataV7>;
|
||||
}
|
||||
|
||||
/** StorageMetadataV7 */
|
||||
export interface StorageMetadataV8 extends StorageMetadataV7 {}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { StorageEntryMetadataLatest } from '../interfaces/metadata';
|
||||
import { AnyU8a, Codec, Registry } from '../types';
|
||||
|
||||
import { StorageEntryMetadata as MetaV8 } from '@polkadot/metadata/Metadata/v8/Storage';
|
||||
import { assert, isFunction, isString, isU8a } from '@polkadot/util';
|
||||
|
||||
import Bytes from './Bytes';
|
||||
@@ -12,7 +12,7 @@ import Bytes from './Bytes';
|
||||
export interface StorageEntry {
|
||||
(arg?: any): Uint8Array;
|
||||
headKey?: Uint8Array;
|
||||
meta: MetaV8;
|
||||
meta: StorageEntryMetadataLatest;
|
||||
method: string;
|
||||
prefix: string;
|
||||
section: string;
|
||||
@@ -72,7 +72,7 @@ export function unwrapStorageType (type: StorageType): string {
|
||||
* constructed by passing in a raw key or a StorageEntry with (optional) arguments.
|
||||
*/
|
||||
export default class StorageKey extends Bytes {
|
||||
private _meta?: MetaV8;
|
||||
private _meta?: StorageEntryMetadataLatest;
|
||||
|
||||
private _method?: string;
|
||||
|
||||
@@ -122,7 +122,7 @@ export default class StorageKey extends Bytes {
|
||||
throw new Error(`Unable to convert input ${value} to StorageKey`);
|
||||
}
|
||||
|
||||
public static getMeta (value: StorageKey | StorageEntry | [StorageEntry, any]): MetaV8 | undefined {
|
||||
public static getMeta (value: StorageKey | StorageEntry | [StorageEntry, any]): StorageEntryMetadataLatest | undefined {
|
||||
if (value instanceof StorageKey) {
|
||||
return value.meta;
|
||||
} else if (isFunction(value)) {
|
||||
@@ -153,7 +153,7 @@ export default class StorageKey extends Bytes {
|
||||
/**
|
||||
* @description The metadata or `undefined` when not available
|
||||
*/
|
||||
public get meta (): MetaV8 | undefined {
|
||||
public get meta (): StorageEntryMetadataLatest | undefined {
|
||||
return this._meta;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,13 +2,15 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { MetadataLatest, ModuleMetadataLatest } from '../interfaces/metadata';
|
||||
|
||||
import fs from 'fs';
|
||||
import Metadata from '@polkadot/metadata';
|
||||
import Decorated from '@polkadot/metadata';
|
||||
import rpcdata from '@polkadot/metadata/Metadata/static';
|
||||
import MetadataV8, { ModuleMetadataV8 } from '@polkadot/metadata/Metadata/v8';
|
||||
import { stringCamelCase, stringLowerFirst } from '@polkadot/util';
|
||||
|
||||
import interfaces from '../../../type-jsonrpc/src';
|
||||
import { unwrapStorageType } from '../primitive/StorageKey';
|
||||
import Call from '../primitive/Generic/Call';
|
||||
import { TypeRegistry } from '../codec';
|
||||
|
||||
@@ -66,7 +68,7 @@ function sortByName<T extends { name: any }> (a: T, b: T): number {
|
||||
return nameA.localeCompare(nameB);
|
||||
}
|
||||
|
||||
function addConstants (metadata: MetadataV8): string {
|
||||
function addConstants (metadata: MetadataLatest): string {
|
||||
const renderHeading = `## ${ANCHOR_TOP}Constants${DESC_CONSTANTS}`;
|
||||
const orderedSections = metadata.modules.sort(sortByName);
|
||||
let renderAnchors = '';
|
||||
@@ -94,7 +96,7 @@ function addConstants (metadata: MetadataV8): string {
|
||||
return renderHeading + renderAnchors + sections;
|
||||
}
|
||||
|
||||
function addEvents (metadata: MetadataV8): string {
|
||||
function addEvents (metadata: MetadataLatest): string {
|
||||
const renderHeading = `## ${ANCHOR_TOP}Events${DESC_EVENTS}`;
|
||||
const orderedSections = metadata.modules.sort(sortByName);
|
||||
let renderAnchors = '';
|
||||
@@ -124,9 +126,9 @@ function addEvents (metadata: MetadataV8): string {
|
||||
return renderHeading + renderAnchors + sections;
|
||||
}
|
||||
|
||||
function addExtrinsics (metadata: MetadataV8): string {
|
||||
function addExtrinsics (metadata: MetadataLatest): string {
|
||||
const renderHeading = `## ${ANCHOR_TOP}Extrinsics${DESC_EXTRINSICS}`;
|
||||
const orderedSections = metadata.modules.map((i): ModuleMetadataV8 => i).sort(sortByName);
|
||||
const orderedSections = metadata.modules.map((i): ModuleMetadataLatest => i).sort(sortByName);
|
||||
let renderAnchors = '';
|
||||
const sections = orderedSections.reduce((md, meta): string => {
|
||||
if (meta.calls.isNone || !meta.calls.unwrap().length) {
|
||||
@@ -154,7 +156,7 @@ function addExtrinsics (metadata: MetadataV8): string {
|
||||
return renderHeading + renderAnchors + sections;
|
||||
}
|
||||
|
||||
function addStorage (metadata: MetadataV8): string {
|
||||
function addStorage (metadata: MetadataLatest): string {
|
||||
const renderHeading = `## ${ANCHOR_TOP}Storage${DESC_STORAGE}`;
|
||||
const orderedSections = metadata.modules.sort(sortByName);
|
||||
let renderAnchors = '';
|
||||
@@ -179,11 +181,7 @@ function addStorage (metadata: MetadataV8): string {
|
||||
: '';
|
||||
const doc = func.documentation.reduce((md, doc): string =>
|
||||
`${md.length ? `${md} ` : ''}${doc.trim()}`, '');
|
||||
let result = (
|
||||
func.type.isDoubleMap
|
||||
? func.type.asDoubleMap.value
|
||||
: func.type
|
||||
).toString();
|
||||
let result = unwrapStorageType(func.type);
|
||||
|
||||
if (func.modifier.isOptional) {
|
||||
result = `Option<${result}>`;
|
||||
@@ -217,30 +215,31 @@ function writeToRpcMd (): void {
|
||||
writeFile('docs/substrate/rpc.md', addRpc());
|
||||
}
|
||||
|
||||
function writeToConstantsMd (metadata: MetadataV8): void {
|
||||
function writeToConstantsMd (metadata: MetadataLatest): void {
|
||||
writeFile('docs/substrate/constants.md', addConstants(metadata));
|
||||
}
|
||||
|
||||
function writeToStorageMd (metadata: MetadataV8): void {
|
||||
function writeToStorageMd (metadata: MetadataLatest): void {
|
||||
const options = { flags: 'r', encoding: 'utf8' };
|
||||
const data = fs.readFileSync('docs/substrate/storage-known.md', options);
|
||||
|
||||
writeFile('docs/substrate/storage.md', addStorage(metadata), data);
|
||||
}
|
||||
|
||||
function writeToExtrinsicsMd (metadata: MetadataV8): void {
|
||||
function writeToExtrinsicsMd (metadata: MetadataLatest): void {
|
||||
writeFile('docs/substrate/extrinsics.md', addExtrinsics(metadata));
|
||||
}
|
||||
|
||||
function writeToEventsMd (metadata: MetadataV8): void {
|
||||
function writeToEventsMd (metadata: MetadataLatest): void {
|
||||
writeFile('docs/substrate/events.md', addEvents(metadata));
|
||||
}
|
||||
|
||||
const registry = new TypeRegistry();
|
||||
const metadata = new Metadata(registry, rpcdata).metadata.asLatest;
|
||||
const decorated = new Decorated(registry, rpcdata);
|
||||
const latest = decorated.metadata.asLatest;
|
||||
|
||||
writeToRpcMd();
|
||||
writeToConstantsMd(metadata);
|
||||
writeToStorageMd(metadata);
|
||||
writeToExtrinsicsMd(metadata);
|
||||
writeToEventsMd(metadata);
|
||||
writeToConstantsMd(latest);
|
||||
writeToStorageMd(latest);
|
||||
writeToExtrinsicsMd(latest);
|
||||
writeToEventsMd(latest);
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { ModuleMetadataLatest } from '../../interfaces/metadata';
|
||||
|
||||
import fs from 'fs';
|
||||
import { ModuleMetadataV8 } from '@polkadot/metadata/Metadata/v8/Metadata';
|
||||
import staticData from '@polkadot/metadata/Metadata/static';
|
||||
import { stringCamelCase } from '@polkadot/util';
|
||||
|
||||
@@ -11,7 +12,7 @@ import { Metadata, TypeRegistry } from '../..';
|
||||
import { createImportCode, createImports, FOOTER, HEADER, indent, setImports, TypeImports } from '../util';
|
||||
|
||||
// Generate types for one module
|
||||
function generateModule (modul: ModuleMetadataV8, imports: TypeImports): string[] {
|
||||
function generateModule (modul: ModuleMetadataLatest, imports: TypeImports): string[] {
|
||||
if (!modul.constants.length) {
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -2,20 +2,19 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Registry } from '@polkadot/types/types';
|
||||
import { ModuleMetadataLatest, StorageEntryMetadataLatest } from '../../interfaces/metadata';
|
||||
import { Registry } from '../../types';
|
||||
|
||||
import fs from 'fs';
|
||||
import { ModuleMetadataV8 } from '@polkadot/metadata/Metadata/v8/Metadata';
|
||||
import { StorageEntryMetadata } from '@polkadot/metadata/Metadata/v8/Storage';
|
||||
import staticData from '@polkadot/metadata/Metadata/static';
|
||||
import { stringLowerFirst } from '@polkadot/util';
|
||||
|
||||
import { Metadata } from '../..';
|
||||
import { TypeRegistry } from '../../codec';
|
||||
import { createImportCode, createImports, FOOTER, formatType, getSimilarTypes, HEADER, indent, setImports, TypeImports } from '../util';
|
||||
import { TypeRegistry } from '@polkadot/types/codec';
|
||||
|
||||
// From a storage entry metadata, we return [args, returnType]
|
||||
function entrySignature (registry: Registry, storageEntry: StorageEntryMetadata, imports: TypeImports): [string, string] {
|
||||
function entrySignature (registry: Registry, storageEntry: StorageEntryMetadataLatest, imports: TypeImports): [string, string] {
|
||||
if (storageEntry.type.isPlain) {
|
||||
setImports(imports, [storageEntry.type.asPlain.toString()]);
|
||||
|
||||
@@ -57,7 +56,7 @@ function entrySignature (registry: Registry, storageEntry: StorageEntryMetadata,
|
||||
}
|
||||
|
||||
// Generate types for one storage entry in a module
|
||||
function generateEntry (registry: Registry, storageEntry: StorageEntryMetadata, imports: TypeImports): string[] {
|
||||
function generateEntry (registry: Registry, storageEntry: StorageEntryMetadataLatest, imports: TypeImports): string[] {
|
||||
const [args, returnType] = entrySignature(registry, storageEntry, imports);
|
||||
|
||||
return [
|
||||
@@ -66,7 +65,7 @@ function generateEntry (registry: Registry, storageEntry: StorageEntryMetadata,
|
||||
}
|
||||
|
||||
// Generate types for one module
|
||||
function generateModule (registry: Registry, modul: ModuleMetadataV8, imports: TypeImports): string[] {
|
||||
function generateModule (registry: Registry, modul: ModuleMetadataLatest, imports: TypeImports): string[] {
|
||||
if (modul.storage.isNone) {
|
||||
return [];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user