Compare commits

...
29 Commits
Author SHA1 Message Date
Github Actions 20f18c72e5 [CI Skip] release/stable 5.1.1
skip-checks: true
2021-07-19 13:14:57 +00:00
Jaco 6a31cbe1a2 5.1.1 (#3783)
* 5.1.1

* Bump common
2021-07-19 15:01:07 +02:00
Jaco acba636d16 Latest v14 metadata (#3782) 2021-07-19 14:27:10 +02:00
Github Actions 6356fe0571 [CI Skip] release/beta 5.0.2-12
skip-checks: true
2021-07-19 08:27:44 +00:00
Jaco 3e17824539 Move Lookup check to registry (#3780) 2021-07-19 10:17:26 +02:00
Github Actions db9e580f82 [CI Skip] release/beta 5.0.2-11
skip-checks: true
2021-07-17 09:47:49 +00:00
Jaco 5ffcba6dd5 Adjust with current scale-info outputs (#3779)
* Adjust with current scale-info outputs

* Linting

* Exhaustive check for encoders
2021-07-17 11:36:19 +02:00
Github Actions 731846088c [CI Skip] release/beta 5.0.2-10
skip-checks: true
2021-07-16 14:50:41 +00:00
Jaco 8b87689489 Add PortableRegistry for v14 lookups (#3778) 2021-07-16 16:39:38 +02:00
Github Actions 5a299adddc [CI Skip] release/beta 5.0.2-9
skip-checks: true
2021-07-16 13:42:49 +00:00
Jaco 99bb6cfe71 Additional AccountId{20, 32} mappings (#3777) 2021-07-16 15:31:18 +02:00
Github Actions ad9a8605d7 [CI Skip] release/beta 5.0.2-8
skip-checks: true
2021-07-16 12:07:44 +00:00
Jaco d62bfc55ac Adjust scale-info types (updated v14, contracts rename) (#3776)
* Adjust scale-info types (updated v14, contracts rename)

* Adjust v14 metadata

* PortableRegistry -> lookup

* Rewrite json
2021-07-16 13:57:44 +02:00
Github Actions 311740a1a2 [CI Skip] release/beta 5.0.2-7
skip-checks: true
2021-07-15 08:45:19 +00:00
Jaco 3285f1f122 v14 Type changes (#3774)
* v14 Type changes

* Registry
2021-07-15 10:34:41 +02:00
Github Actions 2a9711a3cb [CI Skip] release/beta 5.0.2-6
skip-checks: true
2021-07-14 05:53:10 +00:00
Jaco 3ea7cb47ce Update v14 types (#3771) 2021-07-14 07:42:30 +02:00
Github Actions 82fc46881a [CI Skip] release/beta 5.0.2-5
skip-checks: true
2021-07-13 20:55:31 +00:00
Denis Tsai e7758ad54c realign AccountKey20Junction to polkadot xcm's Junction enum (#3770) 2021-07-13 22:43:08 +02:00
Github Actions 7d3ab4c5c1 [CI Skip] release/beta 5.0.2-4
skip-checks: true
2021-07-13 10:01:59 +00:00
Jaco 6c87a6f0af Partial latest to v14 mapping (#3767) 2021-07-13 11:52:10 +02:00
Github Actions fc5e4afe44 [CI Skip] release/beta 5.0.2-3
skip-checks: true
2021-07-13 09:38:21 +00:00
Jaco 48ef04b8ca Metadata v14 types (#3765)
* Metadata v14 types

* Linting w/ CHANGELOG

* Previous-gen SiType as SiType0
2021-07-13 11:28:44 +02:00
Github Actions 1b526fe618 [CI Skip] release/beta 5.0.2-2
skip-checks: true
2021-07-13 06:45:10 +00:00
Ian He 8d6bd931f3 add user additional rpcs during api.clone() (#3764) 2021-07-13 08:35:46 +02:00
Github Actions b317a8eb9b [CI Skip] release/beta 5.0.2-1
skip-checks: true
2021-07-12 10:14:40 +00:00
Jaco 8e65545a3c Allow nested struct generation (#3760)
* Allow nested struct generation

* CHANGELOG

* Update packages/typegen/src/util/formatting.ts

* Rebuild
2021-07-12 12:04:41 +02:00
Github Actions 4ded189697 [CI Skip] release/beta 5.0.2-0
skip-checks: true
2021-07-12 09:51:43 +00:00
Jaco b503441341 Update ParaPastCodeMeta with ReplacementTimes (#3758) 2021-07-12 11:39:46 +02:00
74 changed files with 44009 additions and 4603 deletions
+18
View File
@@ -1,5 +1,23 @@
# CHANGELOG
## 5.1.1 Jul 19, 2021
- **Breaking changes** With the support for v14 metadata parsing, the `documentation` fields on metadata was renamed to `docs` for consistency, aligning with the SCALE type generators.
Contributed:
- Don't clear rpc decoration on Api clone (Thanks to https://github.com/ianhe8x)
- Align Xcm Junction type with Substrate (Thanks to https://github.com/dt665m)
Changes:
- Update `ParaPastCodeMeta` with `ReplacementTimes`
- Add mappings for `AccountId20` & `AccountId32` types
- Adjust scale-info types with Substrate (mapping for api-contracts to old)
- Allow nested structs in enum definitions & generation
- Allow for parsing of v14 metadata (not enabled by default, not merged into Substrate as of yet)
## 5.0.1 Jul 11, 2021
Upgrade priority: Low. Recommended for users of current-generation Substrate chains.
+1 -1
View File
@@ -35,5 +35,5 @@
"@types/jest": "^26.0.23",
"copyfiles": "^2.4.1"
},
"version": "5.0.1"
"version": "5.1.1"
}
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api-contract",
"version": "5.0.1",
"version": "5.1.1",
"type": "module",
"description": "Interfaces for interacting with contracts and contract ABIs",
"main": "index.js",
@@ -20,9 +20,9 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
"dependencies": {
"@babel/runtime": "^7.14.6",
"@polkadot/api": "5.0.1",
"@polkadot/types": "5.0.1",
"@polkadot/util": "^7.0.1",
"@polkadot/api": "5.1.1",
"@polkadot/types": "5.1.1",
"@polkadot/util": "^7.0.2",
"rxjs": "^7.2.0"
}
}
+1 -1
View File
@@ -49,7 +49,7 @@ export class Abi {
this.registry.setMetaTypes(this.project.types);
this.project.types.forEach((_, index) =>
this.registry.getMetaTypeDef({ type: this.registry.createType('SiLookupTypeId', index + this.registry.typeOffset) })
this.registry.getMetaTypeDef({ type: this.registry.createType('Si0LookupTypeId', index + this.registry.typeOffset) })
);
this.constructors = this.project.spec.constructors.map((spec: ContractConstructorSpec, index) =>
this.#createMessage(spec, index, {
+16 -16
View File
@@ -1,19 +1,19 @@
// Copyright 2017-2021 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { ChainProperties, ContractDisplayName, SiField, SiLookupTypeId, SiType, SiTypeDefArray, SiTypeDefSequence, SiTypeDefTuple, SiTypeDefVariant, SiVariant } from '@polkadot/types/interfaces';
import type { ChainProperties, ContractDisplayName, Si0Field, Si0LookupTypeId, Si0Type, Si0TypeDefArray, Si0TypeDefSequence, Si0TypeDefTuple, Si0TypeDefVariant, Si0Variant } from '@polkadot/types/interfaces';
import type { InterfaceTypes, TypeDef } from '@polkadot/types/types';
import { TypeDefInfo, TypeRegistry, withTypeString } from '@polkadot/types';
import { assert, isUndefined } from '@polkadot/util';
interface PartialTypeSpec {
readonly type: SiLookupTypeId;
readonly type: Si0LookupTypeId;
readonly displayName?: ContractDisplayName;
}
// convert the offset into project-specific, index-1
export function getRegistryOffset (id: SiLookupTypeId, typeOffset: number): number {
export function getRegistryOffset (id: Si0LookupTypeId, typeOffset: number): number {
return id.toNumber() - typeOffset;
}
@@ -29,7 +29,7 @@ export class MetaRegistry extends TypeRegistry {
public readonly typeOffset;
#siTypes: SiType[] = [];
#siTypes: Si0Type[] = [];
constructor (metadataVersion: string, chainProperties?: ChainProperties) {
super();
@@ -44,7 +44,7 @@ export class MetaRegistry extends TypeRegistry {
}
}
public setMetaTypes (metaTypes: SiType[]): void {
public setMetaTypes (metaTypes: Si0Type[]): void {
this.#siTypes = metaTypes;
}
@@ -83,15 +83,15 @@ export class MetaRegistry extends TypeRegistry {
return typeDef;
}
#getMetaType = (id: SiLookupTypeId): SiType => {
#getMetaType = (id: Si0LookupTypeId): Si0Type => {
const type = this.#siTypes[getRegistryOffset(id, this.typeOffset)];
assert(!isUndefined(type), () => `getMetaType:: Unable to find ${id.toNumber()} in type values`);
return this.createType('SiType', type);
return this.createType('Si0Type', type);
}
#extract = (type: SiType, id: SiLookupTypeId): TypeDef => {
#extract = (type: Si0Type, id: Si0LookupTypeId): TypeDef => {
const path = [...type.path];
const isPrimitivePath = !!path.length && (
(path.length > 2 && path[0].eq('ink_env') && path[1].eq('types')) ||
@@ -136,7 +136,7 @@ export class MetaRegistry extends TypeRegistry {
});
}
#extractArray = ({ len: length, type }: SiTypeDefArray): Omit<TypeDef, 'type'> => {
#extractArray = ({ len: length, type }: Si0TypeDefArray): Omit<TypeDef, 'type'> => {
assert(!length || length.toNumber() <= 256, 'MetaRegistry: Only support for [Type; <length>], where length <= 256');
return {
@@ -146,7 +146,7 @@ export class MetaRegistry extends TypeRegistry {
};
}
#extractFields = (fields: SiField[]): Omit<TypeDef, 'type'> => {
#extractFields = (fields: Si0Field[]): Omit<TypeDef, 'type'> => {
const [isStruct, isTuple] = fields.reduce(([isAllNamed, isAllUnnamed], { name }) => ([
isAllNamed && name.isSome,
isAllUnnamed && name.isNone
@@ -174,7 +174,7 @@ export class MetaRegistry extends TypeRegistry {
};
}
#extractPrimitive = (type: SiType): TypeDef => {
#extractPrimitive = (type: Si0Type): TypeDef => {
const typeStr = type.def.asPrimitive.type.toString();
return {
@@ -183,14 +183,14 @@ export class MetaRegistry extends TypeRegistry {
};
}
#extractPrimitivePath = (type: SiType): TypeDef => {
#extractPrimitivePath = (type: Si0Type): TypeDef => {
return {
info: TypeDefInfo.Plain,
type: type.path[type.path.length - 1].toString()
};
}
#extractSequence = ({ type }: SiTypeDefSequence, id: SiLookupTypeId): Omit<TypeDef, 'type'> => {
#extractSequence = ({ type }: Si0TypeDefSequence, id: Si0LookupTypeId): Omit<TypeDef, 'type'> => {
assert(!!type, () => `ContractRegistry: Invalid sequence type found at id ${id.toString()}`);
return {
@@ -199,7 +199,7 @@ export class MetaRegistry extends TypeRegistry {
};
}
#extractTuple = (ids: SiTypeDefTuple): Omit<TypeDef, 'type'> => {
#extractTuple = (ids: Si0TypeDefTuple): Omit<TypeDef, 'type'> => {
return ids.length === 1
? this.getMetaTypeDef({ type: ids[0] })
: {
@@ -208,7 +208,7 @@ export class MetaRegistry extends TypeRegistry {
};
}
#extractVariant = ({ variants }: SiTypeDefVariant, id: SiLookupTypeId): Omit<TypeDef, 'type'> => {
#extractVariant = ({ variants }: Si0TypeDefVariant, id: Si0LookupTypeId): Omit<TypeDef, 'type'> => {
const { params, path } = this.#getMetaType(id);
const specialVariant = path[0].toString();
@@ -231,7 +231,7 @@ export class MetaRegistry extends TypeRegistry {
};
}
#extractVariantSub = (variants: SiVariant[]): TypeDef[] => {
#extractVariantSub = (variants: Si0Variant[]): TypeDef[] => {
return variants.every(({ fields }) => fields.length === 0)
? variants.map(({ discriminant, name }) => ({
...(
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/api-contract', version: '5.0.1' };
export const packageInfo = { name: '@polkadot/api-contract', version: '5.1.1' };
+8 -8
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api-derive",
"version": "5.0.1",
"version": "5.1.1",
"type": "module",
"description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
"main": "index.js",
@@ -20,15 +20,15 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
"dependencies": {
"@babel/runtime": "^7.14.6",
"@polkadot/api": "5.0.1",
"@polkadot/rpc-core": "5.0.1",
"@polkadot/types": "5.0.1",
"@polkadot/util": "^7.0.1",
"@polkadot/util-crypto": "^7.0.1",
"@polkadot/api": "5.1.1",
"@polkadot/rpc-core": "5.1.1",
"@polkadot/types": "5.1.1",
"@polkadot/util": "^7.0.2",
"@polkadot/util-crypto": "^7.0.2",
"rxjs": "^7.2.0"
},
"devDependencies": {
"@polkadot/keyring": "^7.0.1",
"@polkadot/rpc-provider": "5.0.1"
"@polkadot/keyring": "^7.0.2",
"@polkadot/rpc-provider": "5.1.1"
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/api-derive', version: '5.0.1' };
export const packageInfo = { name: '@polkadot/api-derive', version: '5.1.1' };
+9 -9
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api",
"version": "5.0.1",
"version": "5.1.1",
"type": "module",
"description": "Promise and RxJS wrappers around the Polkadot JS RPC",
"main": "index.js",
@@ -20,14 +20,14 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme",
"dependencies": {
"@babel/runtime": "^7.14.6",
"@polkadot/api-derive": "5.0.1",
"@polkadot/keyring": "^7.0.1",
"@polkadot/rpc-core": "5.0.1",
"@polkadot/rpc-provider": "5.0.1",
"@polkadot/types": "5.0.1",
"@polkadot/types-known": "5.0.1",
"@polkadot/util": "^7.0.1",
"@polkadot/util-crypto": "^7.0.1",
"@polkadot/api-derive": "5.1.1",
"@polkadot/keyring": "^7.0.2",
"@polkadot/rpc-core": "5.1.1",
"@polkadot/rpc-provider": "5.1.1",
"@polkadot/types": "5.1.1",
"@polkadot/types-known": "5.1.1",
"@polkadot/util": "^7.0.2",
"@polkadot/util-crypto": "^7.0.2",
"eventemitter3": "^4.0.7",
"rxjs": "^7.2.0"
}
+2 -4
View File
@@ -4,7 +4,7 @@
import type { Observable } from 'rxjs';
import type { RpcInterface } from '@polkadot/rpc-core/types';
import type { Option, Raw, StorageKey, Text, u64 } from '@polkadot/types';
import type { Call, Hash, RpcMethods, RuntimeVersion } from '@polkadot/types/interfaces';
import type { Call, Hash, RuntimeVersion } from '@polkadot/types/interfaces';
import type { DecoratedMeta } from '@polkadot/types/metadata/decorate/types';
import type { StorageEntry } from '@polkadot/types/primitive/types';
import type { AnyFunction, AnyTuple, CallFunction, Codec, CodecArg as Arg, DefinitionRpc, DefinitionRpcSub, IMethod, InterfaceTypes, IStorageKey, Registry, RegistryTypes } from '@polkadot/types/types';
@@ -265,9 +265,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
// manner to cater for both old and new:
// - when the number of entries are 0, only remove the ones with isOptional (account & contracts)
// - when non-zero, remove anything that is not in the array (we don't do this)
protected _filterRpc (rpcMethods: RpcMethods, additional: Record<string, Record<string, DefinitionRpc | DefinitionRpcSub>>): void {
const methods = rpcMethods.methods.map((t) => t.toString());
protected _filterRpc (methods: string[], additional: Record<string, Record<string, DefinitionRpc | DefinitionRpcSub>>): void {
// add any specific user-base RPCs
if (Object.keys(additional).length !== 0) {
this._rpcCore.addUserInterfaces(additional);
+2 -2
View File
@@ -213,7 +213,7 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
});
});
this._filterRpcMethods(methods);
this._filterRpc(methods, getSpecRpc(this.registry, source.runtimeChain, source.runtimeVersion.specName));
return [source.genesisHash, source.runtimeMetadata];
}
@@ -296,7 +296,7 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
// initializes the registry & RPC
this._initRegistry(this.registry, chain, runtimeVersion, metadata, chainProps);
this._filterRpc(rpcMethods, getSpecRpc(this.registry, chain, runtimeVersion.specName));
this._filterRpc(rpcMethods.methods.map((t) => t.toString()), getSpecRpc(this.registry, chain, runtimeVersion.specName));
this._subscribeUpdates();
// setup the initial registry, when we have none
+1 -1
View File
@@ -21,7 +21,7 @@ function consts (api: ApiPromise): void {
console.log(
api.consts.foo.bar,
api.consts.balances.existentialDeposit.toNumber(),
api.consts.balances.existentialDeposit.meta.documentation.map((s): string => s.toString()).join('')
api.consts.balances.existentialDeposit.meta.docs.map((s): string => s.toString()).join('')
);
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/api', version: '5.0.1' };
export const packageInfo = { name: '@polkadot/api', version: '5.1.1' };
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-core",
"version": "5.0.1",
"version": "5.1.1",
"type": "module",
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"main": "index.js",
@@ -20,12 +20,12 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme",
"dependencies": {
"@babel/runtime": "^7.14.6",
"@polkadot/rpc-provider": "5.0.1",
"@polkadot/types": "5.0.1",
"@polkadot/util": "^7.0.1",
"@polkadot/rpc-provider": "5.1.1",
"@polkadot/types": "5.1.1",
"@polkadot/util": "^7.0.2",
"rxjs": "^7.2.0"
},
"devDependencies": {
"@polkadot/keyring": "^7.0.1"
"@polkadot/keyring": "^7.0.2"
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/rpc-core', version: '5.0.1' };
export const packageInfo = { name: '@polkadot/rpc-core', version: '5.1.1' };
+9 -9
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-provider",
"version": "5.0.1",
"version": "5.1.1",
"type": "module",
"description": "Transport providers for the API",
"main": "index.js",
@@ -20,17 +20,17 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme",
"dependencies": {
"@babel/runtime": "^7.14.6",
"@polkadot/types": "5.0.1",
"@polkadot/util": "^7.0.1",
"@polkadot/util-crypto": "^7.0.1",
"@polkadot/x-fetch": "^7.0.1",
"@polkadot/x-global": "^7.0.1",
"@polkadot/x-ws": "^7.0.1",
"@polkadot/types": "5.1.1",
"@polkadot/util": "^7.0.2",
"@polkadot/util-crypto": "^7.0.2",
"@polkadot/x-fetch": "^7.0.2",
"@polkadot/x-global": "^7.0.2",
"@polkadot/x-ws": "^7.0.2",
"eventemitter3": "^4.0.7"
},
"devDependencies": {
"@polkadot/keyring": "^7.0.1",
"@polkadot/types": "5.0.1",
"@polkadot/keyring": "^7.0.2",
"@polkadot/types": "5.1.1",
"mock-socket": "^9.0.3",
"nock": "^13.1.1"
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/rpc-provider', version: '5.0.1' };
export const packageInfo = { name: '@polkadot/rpc-provider', version: '5.1.1' };
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/typegen",
"version": "5.0.1",
"version": "5.1.1",
"type": "module",
"description": "Type generation scripts",
"main": "index.js",
@@ -29,10 +29,10 @@
"@babel/core": "^7.14.6",
"@babel/register": "^7.14.5",
"@babel/runtime": "^7.14.6",
"@polkadot/api": "5.0.1",
"@polkadot/rpc-provider": "5.0.1",
"@polkadot/types": "5.0.1",
"@polkadot/util": "^7.0.1",
"@polkadot/api": "5.1.1",
"@polkadot/rpc-provider": "5.1.1",
"@polkadot/types": "5.1.1",
"@polkadot/util": "^7.0.2",
"handlebars": "^4.7.7",
"websocket": "^1.0.34",
"yargs": "^17.0.1"
+2 -2
View File
@@ -33,13 +33,13 @@ function generateForMeta (meta: Metadata, dest: string, extraTypes: ExtraTypes,
const items = constants
.sort(compareName)
.map(({ documentation, name, type }) => {
.map(({ docs, name, type }) => {
const returnType = formatType(allDefs, type.toString(), imports);
setImports(allDefs, imports, [returnType]);
return {
docs: documentation,
docs,
name: stringCamelCase(name),
type: returnType
};
+2 -2
View File
@@ -24,8 +24,8 @@ function generateForMeta (meta: Metadata, dest: string, isStrict: boolean): void
.map(({ errors, name }) => ({
items: errors
.sort(compareName)
.map(({ documentation, name }) => ({
docs: documentation,
.map(({ docs, name }) => ({
docs,
name: name.toString()
})),
name: stringCamelCase(name)
+2 -2
View File
@@ -30,13 +30,13 @@ function generateForMeta (meta: Metadata, dest: string, extraTypes: ExtraTypes,
items: events
.unwrap()
.sort(compareName)
.map(({ args, documentation, name }) => {
.map(({ args, docs, name }) => {
const types = args.map((type) => formatType(allDefs, type.toString(), imports));
setImports(allDefs, imports, types);
return {
docs: documentation,
docs,
name: name.toString(),
type: types.join(', ')
};
+1 -1
View File
@@ -107,7 +107,7 @@ function generateForMeta (registry: Registry, meta: Metadata, dest: string, extr
return {
args,
docs: storageEntry.documentation,
docs: storageEntry.docs,
entryType: 'AugmentedQuery',
name: stringCamelCase(storageEntry.name),
params,
+37 -28
View File
@@ -50,12 +50,13 @@ const tsTuple = tsExport;
function tsEnum (definitions: Record<string, ModuleTypes>, { name: enumName, sub }: TypeDef, imports: TypeImports): string {
setImports(definitions, imports, ['Enum']);
const keys = (sub as TypeDef[]).map(({ info, name = '', type }): string => {
const keys = (sub as TypeDef[]).map((def, index): string => {
const { info, name = `unknown${index}`, type } = def;
const getter = stringUpperFirst(stringCamelCase(name.replace(' ', '_')));
const isComplexType = [TypeDefInfo.Tuple, TypeDefInfo.Vec, TypeDefInfo.VecFixed].includes(info);
const isComplex = [TypeDefInfo.Struct, TypeDefInfo.Tuple, TypeDefInfo.Vec, TypeDefInfo.VecFixed].includes(info);
const asGetter = type === 'Null' || info === TypeDefInfo.DoNotConstruct
? ''
: createGetter(definitions, `as${getter}`, isComplexType ? formatType(definitions, type, imports) : type, imports);
: createGetter(definitions, `as${getter}`, isComplex ? formatType(definitions, info === TypeDefInfo.Struct ? def : type, imports) : type, imports);
const isGetter = info === TypeDefInfo.DoNotConstruct
? ''
: createGetter(definitions, `is${getter}`, 'boolean', imports);
@@ -63,6 +64,7 @@ function tsEnum (definitions: Record<string, ModuleTypes>, { name: enumName, sub
switch (info) {
case TypeDefInfo.Compact:
case TypeDefInfo.Plain:
case TypeDefInfo.Struct:
case TypeDefInfo.Tuple:
case TypeDefInfo.Vec:
case TypeDefInfo.Option:
@@ -121,6 +123,12 @@ function tsResult (definitions: Record<string, ModuleTypes>, def: TypeDef, impor
return exportInterface(def.name, formatType(definitions, def, imports), inner);
}
/** @internal */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function tsSi (definitions: Record<string, ModuleTypes>, { type }: TypeDef, imports: TypeImports): string {
throw new Error('Unable to generate string definition from TypeDefInfo.Si');
}
/** @internal */
function tsSet (definitions: Record<string, ModuleTypes>, { name: setName, sub }: TypeDef, imports: TypeImports): string {
setImports(definitions, imports, ['Set']);
@@ -165,36 +173,37 @@ function tsVec (definitions: Record<string, ModuleTypes>, def: TypeDef, imports:
return exportInterface(def.name, formatType(definitions, def, imports));
}
// handlers are defined externally to use - this means that when we do a
// `generators[typedef.info](...)` TS will show any unhandled types. Rather
// we are being explicit in having no handlers where we do not support (yet)
const encoders: Record<TypeDefInfo, (definitions: Record<string, ModuleTypes>, def: TypeDef, imports: TypeImports) => string> = {
[TypeDefInfo.BTreeMap]: tsBTreeMap,
[TypeDefInfo.BTreeSet]: tsBTreeSet,
[TypeDefInfo.Compact]: tsCompact,
[TypeDefInfo.DoNotConstruct]: tsDoNotConstruct,
[TypeDefInfo.Enum]: tsEnum,
[TypeDefInfo.HashMap]: tsHashMap,
[TypeDefInfo.Int]: tsInt,
[TypeDefInfo.Linkage]: errorUnhandled,
[TypeDefInfo.Null]: errorUnhandled,
[TypeDefInfo.Option]: tsOption,
[TypeDefInfo.Plain]: tsPlain,
[TypeDefInfo.Result]: tsResult,
[TypeDefInfo.Set]: tsSet,
[TypeDefInfo.Si]: tsSi,
[TypeDefInfo.Struct]: tsStruct,
[TypeDefInfo.Tuple]: tsTuple,
[TypeDefInfo.UInt]: tsUInt,
[TypeDefInfo.Vec]: tsVec,
[TypeDefInfo.VecFixed]: tsVec
};
/** @internal */
function generateInterfaces (definitions: Record<string, ModuleTypes>, { types }: { types: Record<string, any> }, imports: Imports): [string, string][] {
// handlers are defined externally to use - this means that when we do a
// `generators[typedef.info](...)` TS will show any unhandled types. Rather
// we are being explicit in having no handlers where we do not support (yet)
const generators = {
[TypeDefInfo.BTreeMap]: tsBTreeMap,
[TypeDefInfo.BTreeSet]: tsBTreeSet,
[TypeDefInfo.Compact]: tsCompact,
[TypeDefInfo.DoNotConstruct]: tsDoNotConstruct,
[TypeDefInfo.Enum]: tsEnum,
[TypeDefInfo.HashMap]: tsHashMap,
[TypeDefInfo.Int]: tsInt,
[TypeDefInfo.Linkage]: errorUnhandled,
[TypeDefInfo.Null]: errorUnhandled,
[TypeDefInfo.Option]: tsOption,
[TypeDefInfo.Plain]: tsPlain,
[TypeDefInfo.Result]: tsResult,
[TypeDefInfo.Set]: tsSet,
[TypeDefInfo.Struct]: tsStruct,
[TypeDefInfo.Tuple]: tsTuple,
[TypeDefInfo.UInt]: tsUInt,
[TypeDefInfo.Vec]: tsVec,
[TypeDefInfo.VecFixed]: tsVec
};
return Object.entries(types).map(([name, type]): [string, string] => {
const def = getTypeDef(isString(type) ? type : stringify(type), { name });
return [name, generators[def.info](definitions, def, imports)];
return [name, encoders[def.info](definitions, def, imports)];
});
}
+2 -2
View File
@@ -44,7 +44,7 @@ function generateForMeta (registry: Registry, meta: Metadata, dest: string, extr
const items = calls.unwrap()
.sort(compareName)
.map(({ args, documentation, name }) => {
.map(({ args, docs, name }) => {
const params = args
.map(({ name, type }) => {
const typeStr = type.toString();
@@ -58,7 +58,7 @@ function generateForMeta (registry: Registry, meta: Metadata, dest: string, extr
return {
args: args.map(({ type }) => formatType(allDefs, type.toString(), imports)).join(', '),
docs: documentation,
docs,
name: stringCamelCase(name),
params
};
+8 -8
View File
@@ -43,7 +43,7 @@ const DESC_RPC = 'The following sections contain RPC methods that are Remote Cal
const DESC_STORAGE = `The following sections contain Storage methods are part of the default Substrate runtime. On the api, these are exposed via \`api.query.<module>.<method>\`. ${STATIC_TEXT}`;
/** @internal */
function documentationVecToMarkdown (docLines: Vec<Text>, indent = 0): string {
function docsVecToMarkdown (docLines: Vec<Text>, indent = 0): string {
const md = docLines
.map((docLine) => docLine && docLine.substring(1)) // trim the leading space
.reduce((md, docLine): string => // generate paragraphs
@@ -94,7 +94,7 @@ function renderPage (page: Page): string {
md += `\n- **${bullet}**: ${
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
item[bullet] instanceof Vec
? documentationVecToMarkdown(item[bullet] as Vec<Text>, 2).toString()
? docsVecToMarkdown(item[bullet] as Vec<Text>, 2).toString()
: item[bullet]
}`;
});
@@ -180,7 +180,7 @@ function addConstants (metadata: MetadataLatest): string {
return {
interface: '`' + `api.consts.${sectionName}.${methodName}` + '`',
name: `${methodName}: ` + '`' + func.type.toString() + '`',
...(func.documentation.length && { summary: func.documentation })
...(func.docs.length && { summary: func.docs })
};
}),
name: sectionName
@@ -216,7 +216,7 @@ function addStorage (metadata: MetadataLatest): string {
return {
interface: '`' + `api.query.${sectionName}.${methodName}` + '`',
name: `${methodName}(${arg}): ` + '`' + outputType + '`',
...(func.documentation.length && { summary: func.documentation })
...(func.docs.length && { summary: func.docs })
};
}),
name: sectionName
@@ -239,7 +239,7 @@ function addStorage (metadata: MetadataLatest): string {
return {
interface: '`' + `api.query.substrate.${methodName}` + '`',
name: `${methodName}(${arg}): ` + '`' + outputType + '`',
summary: meta.documentation
summary: meta.docs
};
}),
name: 'substrate'
@@ -268,7 +268,7 @@ function addExtrinsics (metadata: MetadataLatest): string {
return {
interface: '`' + `api.tx.${sectionName}.${methodName}` + '`',
name: `${methodName}(${args})`,
...(func.documentation.length && { summary: func.documentation })
...(func.docs.length && { summary: func.docs })
};
}),
name: sectionName
@@ -295,7 +295,7 @@ function addEvents (metadata: MetadataLatest): string {
return {
interface: '`' + `api.events.${stringCamelCase(meta.name)}.${methodName}.is` + '`',
name: `${methodName}(${args})`,
...(func.documentation.length && { summary: func.documentation })
...(func.docs.length && { summary: func.docs })
};
}),
name: stringCamelCase(meta.name)
@@ -317,7 +317,7 @@ function addErrors (metadata: MetadataLatest): string {
.map((error) => ({
interface: '`' + `api.errors.${stringCamelCase(moduleMetadata.name)}.${error.name.toString()}.is` + '`',
name: error.name.toString(),
...(error.documentation.length && { summary: error.documentation })
...(error.docs.length && { summary: error.docs })
})),
name: stringLowerFirst(moduleMetadata.name)
})),
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/typegen', version: '5.0.1' };
export const packageInfo = { name: '@polkadot/typegen', version: '5.1.1' };
+26 -7
View File
@@ -131,6 +131,14 @@ function formatLinkage (inner: string): string {
return paramsNotation('Linkage', inner);
}
/**
* Given the inner `T`, return a `Option<T>` string
*/
/** @internal */
function formatOption (inner: string): string {
return paramsNotation('Option', inner);
}
/**
* Given the inner `O` & `E`, return a `Result<O, E>` string
*/
@@ -140,11 +148,11 @@ function formatResult (innerOk: string, innerError: string): string {
}
/**
* Given the inner `T`, return a `Option<T>` string
* Given the entries `[string, T][]`, return a `{ name: T; ... }` string
*/
/** @internal */
function formatOption (inner: string): string {
return paramsNotation('Option', inner);
function formatStruct (inners: [string, string][]): string {
return `{ ${inners.map(([k, t]) => `${k}: ${t};`).join(' ')} } & Struct`;
}
/**
@@ -211,10 +219,15 @@ export function formatType (definitions: Record<string, ModuleTypes>, type: stri
return typeDef.type;
}
case TypeDefInfo.Vec: {
setImports(definitions, imports, ['Vec']);
case TypeDefInfo.Struct: {
setImports(definitions, imports, ['Struct']);
return formatVec(formatType(definitions, (typeDef.sub as TypeDef).type, imports));
return formatStruct(
((typeDef.sub as TypeDef[]).map(({ name, type }, index) => [
name || `unknown${index}`,
formatType(definitions, type, imports)
]))
);
}
case TypeDefInfo.Tuple: {
@@ -222,10 +235,16 @@ export function formatType (definitions: Record<string, ModuleTypes>, type: stri
// `(a,b)` gets transformed into `ITuple<[a, b]>`
return formatTuple(
((typeDef.sub as TypeDef[]).map((sub) => formatType(definitions, sub.type, imports)))
((typeDef.sub as TypeDef[]).map(({ type }) => formatType(definitions, type, imports)))
);
}
case TypeDefInfo.Vec: {
setImports(definitions, imports, ['Vec']);
return formatVec(formatType(definitions, (typeDef.sub as TypeDef).type, imports));
}
case TypeDefInfo.VecFixed: {
const type = (typeDef.sub as TypeDef).type;
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/types-known",
"version": "5.0.1",
"version": "5.1.1",
"type": "module",
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"main": "index.js",
@@ -20,8 +20,8 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types-known#readme",
"dependencies": {
"@babel/runtime": "^7.14.6",
"@polkadot/networks": "^7.0.1",
"@polkadot/types": "5.0.1",
"@polkadot/util": "^7.0.1"
"@polkadot/networks": "^7.0.2",
"@polkadot/types": "5.1.1",
"@polkadot/util": "^7.0.2"
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/types-known', version: '5.0.1' };
export const packageInfo = { name: '@polkadot/types-known', version: '5.1.1' };
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/types",
"version": "5.0.1",
"version": "5.1.1",
"type": "module",
"description": "Implementation of the Parity codec",
"main": "index.js",
@@ -20,12 +20,12 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types#readme",
"dependencies": {
"@babel/runtime": "^7.14.6",
"@polkadot/util": "^7.0.1",
"@polkadot/util-crypto": "^7.0.1",
"@polkadot/util": "^7.0.2",
"@polkadot/util-crypto": "^7.0.2",
"rxjs": "^7.2.0"
},
"devDependencies": {
"@polkadot/keyring": "^7.0.1",
"@polkadot/keyring": "^7.0.2",
"@types/bn.js": "^4.11.6",
"bn.js": "^4.11.9"
}
+137 -47
View File
@@ -32,19 +32,19 @@ import type { AuthorityIndex, AuthorityList, AuthoritySet, AuthoritySetChange, A
import type { IdentityFields, IdentityInfo, IdentityInfoAdditional, IdentityJudgement, RegistrarIndex, RegistrarInfo, Registration, RegistrationJudgement } from '@polkadot/types/interfaces/identity';
import type { AuthIndex, AuthoritySignature, Heartbeat, HeartbeatTo244, OpaqueMultiaddr, OpaqueNetworkState, OpaquePeerId } from '@polkadot/types/interfaces/imOnline';
import type { CallIndex, LotteryConfig } from '@polkadot/types/interfaces/lottery';
import type { DoubleMapTypeLatest, DoubleMapTypeV10, DoubleMapTypeV11, DoubleMapTypeV12, DoubleMapTypeV13, DoubleMapTypeV9, ErrorMetadataLatest, ErrorMetadataV10, ErrorMetadataV11, ErrorMetadataV12, ErrorMetadataV13, ErrorMetadataV9, EventMetadataLatest, EventMetadataV10, EventMetadataV11, EventMetadataV12, EventMetadataV13, EventMetadataV9, ExtrinsicMetadataLatest, ExtrinsicMetadataV11, ExtrinsicMetadataV12, ExtrinsicMetadataV13, FunctionArgumentMetadataLatest, FunctionArgumentMetadataV10, FunctionArgumentMetadataV11, FunctionArgumentMetadataV12, FunctionArgumentMetadataV13, FunctionArgumentMetadataV9, FunctionMetadataLatest, FunctionMetadataV10, FunctionMetadataV11, FunctionMetadataV12, FunctionMetadataV13, FunctionMetadataV9, MapTypeLatest, MapTypeV10, MapTypeV11, MapTypeV12, MapTypeV13, MapTypeV9, MetadataAll, MetadataLatest, MetadataV10, MetadataV11, MetadataV12, MetadataV13, MetadataV9, ModuleConstantMetadataLatest, ModuleConstantMetadataV10, ModuleConstantMetadataV11, ModuleConstantMetadataV12, ModuleConstantMetadataV13, ModuleConstantMetadataV9, ModuleMetadataLatest, ModuleMetadataV10, ModuleMetadataV11, ModuleMetadataV12, ModuleMetadataV13, ModuleMetadataV9, NMapTypeLatest, NMapTypeV13, StorageEntryMetadataLatest, StorageEntryMetadataV10, StorageEntryMetadataV11, StorageEntryMetadataV12, StorageEntryMetadataV13, StorageEntryMetadataV9, StorageEntryModifierLatest, StorageEntryModifierV10, StorageEntryModifierV11, StorageEntryModifierV12, StorageEntryModifierV13, StorageEntryModifierV9, StorageEntryTypeLatest, StorageEntryTypeV10, StorageEntryTypeV11, StorageEntryTypeV12, StorageEntryTypeV13, StorageEntryTypeV9, StorageHasher, StorageHasherV10, StorageHasherV11, StorageHasherV12, StorageHasherV13, StorageHasherV9, StorageMetadataLatest, StorageMetadataV10, StorageMetadataV11, StorageMetadataV12, StorageMetadataV13, StorageMetadataV9 } from '@polkadot/types/interfaces/metadata';
import type { ErrorMetadataLatest, ErrorMetadataV10, ErrorMetadataV11, ErrorMetadataV12, ErrorMetadataV13, ErrorMetadataV9, EventMetadataLatest, EventMetadataV10, EventMetadataV11, EventMetadataV12, EventMetadataV13, EventMetadataV9, ExtrinsicMetadataLatest, ExtrinsicMetadataV11, ExtrinsicMetadataV12, ExtrinsicMetadataV13, ExtrinsicMetadataV14, FunctionArgumentMetadataLatest, FunctionArgumentMetadataV10, FunctionArgumentMetadataV11, FunctionArgumentMetadataV12, FunctionArgumentMetadataV13, FunctionArgumentMetadataV9, FunctionMetadataLatest, FunctionMetadataV10, FunctionMetadataV11, FunctionMetadataV12, FunctionMetadataV13, FunctionMetadataV9, MetadataAll, MetadataLatest, MetadataV10, MetadataV11, MetadataV12, MetadataV13, MetadataV14, MetadataV9, ModuleConstantMetadataLatest, ModuleConstantMetadataV10, ModuleConstantMetadataV11, ModuleConstantMetadataV12, ModuleConstantMetadataV13, ModuleConstantMetadataV9, ModuleMetadataLatest, ModuleMetadataV10, ModuleMetadataV11, ModuleMetadataV12, ModuleMetadataV13, ModuleMetadataV9, PalletCallMetadataLatest, PalletCallMetadataV14, PalletConstantMetadataLatest, PalletConstantMetadataV14, PalletErrorMetadataLatest, PalletErrorMetadataV14, PalletEventMetadataLatest, PalletEventMetadataV14, PalletMetadataLatest, PalletMetadataV14, PalletStorageMetadataLatest, PalletStorageMetadataV14, PortableRegistry, PortableType, SignedExtensionMetadataLatest, SignedExtensionMetadataV14, StorageEntryMetadataLatest, StorageEntryMetadataV10, StorageEntryMetadataV11, StorageEntryMetadataV12, StorageEntryMetadataV13, StorageEntryMetadataV14, StorageEntryMetadataV9, StorageEntryModifierLatest, StorageEntryModifierV10, StorageEntryModifierV11, StorageEntryModifierV12, StorageEntryModifierV13, StorageEntryModifierV14, StorageEntryModifierV9, StorageEntryTypeLatest, StorageEntryTypeV10, StorageEntryTypeV11, StorageEntryTypeV12, StorageEntryTypeV13, StorageEntryTypeV14, StorageEntryTypeV9, StorageHasher, StorageHasherV10, StorageHasherV11, StorageHasherV12, StorageHasherV13, StorageHasherV14, StorageHasherV9, StorageMetadataLatest, StorageMetadataV10, StorageMetadataV11, StorageMetadataV12, StorageMetadataV13, StorageMetadataV9 } from '@polkadot/types/interfaces/metadata';
import type { MmrLeafProof } from '@polkadot/types/interfaces/mmr';
import type { StorageKind } from '@polkadot/types/interfaces/offchain';
import type { DeferredOffenceOf, Kind, OffenceDetails, Offender, OpaqueTimeSlot, ReportIdOf, Reporter } from '@polkadot/types/interfaces/offences';
import type { AbridgedCandidateReceipt, AbridgedHostConfiguration, AbridgedHrmpChannel, AssignmentId, AssignmentKind, AttestedCandidate, AuctionIndex, AuthorityDiscoveryId, AvailabilityBitfield, AvailabilityBitfieldRecord, BackedCandidate, Bidder, BufferedSessionChange, CandidateCommitments, CandidateDescriptor, CandidateHash, CandidateInfo, CandidatePendingAvailability, CandidateReceipt, CollatorId, CollatorSignature, CommittedCandidateReceipt, CoreAssignment, CoreIndex, CoreOccupied, DisputeStatement, DisputeStatementSet, DoubleVoteReport, DownwardMessage, ExplicitDisputeStatement, GlobalValidationData, GlobalValidationSchedule, GroupIndex, HeadData, HostConfiguration, HrmpChannel, HrmpChannelId, HrmpOpenChannelRequest, InboundDownwardMessage, InboundHrmpMessage, InboundHrmpMessages, IncomingParachain, IncomingParachainDeploy, IncomingParachainFixed, InvalidDisputeStatementKind, LeasePeriod, LeasePeriodOf, LocalValidationData, MessageIngestionType, MessageQueueChain, MessagingStateSnapshot, MessagingStateSnapshotEgressEntry, MultiDisputeStatementSet, NewBidder, OutboundHrmpMessage, ParaGenesisArgs, ParaId, ParaInfo, ParaLifecycle, ParaPastCodeMeta, ParaScheduling, ParaValidatorIndex, ParachainDispatchOrigin, ParachainInherentData, ParachainProposal, ParachainsInherentData, ParathreadClaim, ParathreadClaimQueue, ParathreadEntry, PersistedValidationData, QueuedParathread, RegisteredParachainInfo, RelayBlockNumber, RelayChainBlockNumber, RelayChainHash, RelayHash, Remark, Retriable, Scheduling, ServiceQuality, SessionInfo, SessionInfoValidatorGroup, SignedAvailabilityBitfield, SignedAvailabilityBitfields, SigningContext, SlotRange, Statement, SubId, SystemInherentData, TransientValidationData, UpwardMessage, ValidDisputeStatementKind, ValidationCode, ValidationCodeHash, ValidationData, ValidationDataType, ValidationFunctionParams, ValidatorSignature, ValidityAttestation, VecInboundHrmpMessage, WinnersData, WinnersDataTuple, WinningData, WinningDataEntry } from '@polkadot/types/interfaces/parachains';
import type { AbridgedCandidateReceipt, AbridgedHostConfiguration, AbridgedHrmpChannel, AssignmentId, AssignmentKind, AttestedCandidate, AuctionIndex, AuthorityDiscoveryId, AvailabilityBitfield, AvailabilityBitfieldRecord, BackedCandidate, Bidder, BufferedSessionChange, CandidateCommitments, CandidateDescriptor, CandidateHash, CandidateInfo, CandidatePendingAvailability, CandidateReceipt, CollatorId, CollatorSignature, CommittedCandidateReceipt, CoreAssignment, CoreIndex, CoreOccupied, DisputeStatement, DisputeStatementSet, DoubleVoteReport, DownwardMessage, ExplicitDisputeStatement, GlobalValidationData, GlobalValidationSchedule, GroupIndex, HeadData, HostConfiguration, HrmpChannel, HrmpChannelId, HrmpOpenChannelRequest, InboundDownwardMessage, InboundHrmpMessage, InboundHrmpMessages, IncomingParachain, IncomingParachainDeploy, IncomingParachainFixed, InvalidDisputeStatementKind, LeasePeriod, LeasePeriodOf, LocalValidationData, MessageIngestionType, MessageQueueChain, MessagingStateSnapshot, MessagingStateSnapshotEgressEntry, MultiDisputeStatementSet, NewBidder, OutboundHrmpMessage, ParaGenesisArgs, ParaId, ParaInfo, ParaLifecycle, ParaPastCodeMeta, ParaScheduling, ParaValidatorIndex, ParachainDispatchOrigin, ParachainInherentData, ParachainProposal, ParachainsInherentData, ParathreadClaim, ParathreadClaimQueue, ParathreadEntry, PersistedValidationData, QueuedParathread, RegisteredParachainInfo, RelayBlockNumber, RelayChainBlockNumber, RelayChainHash, RelayHash, Remark, ReplacementTimes, Retriable, Scheduling, ServiceQuality, SessionInfo, SessionInfoValidatorGroup, SignedAvailabilityBitfield, SignedAvailabilityBitfields, SigningContext, SlotRange, Statement, SubId, SystemInherentData, TransientValidationData, UpwardMessage, ValidDisputeStatementKind, ValidationCode, ValidationCodeHash, ValidationData, ValidationDataType, ValidationFunctionParams, ValidatorSignature, ValidityAttestation, VecInboundHrmpMessage, WinnersData, WinnersDataTuple, WinningData, WinningDataEntry } from '@polkadot/types/interfaces/parachains';
import type { FeeDetails, InclusionFee, RuntimeDispatchInfo } from '@polkadot/types/interfaces/payment';
import type { Approvals } from '@polkadot/types/interfaces/poll';
import type { ProxyAnnouncement, ProxyDefinition, ProxyType } from '@polkadot/types/interfaces/proxy';
import type { AccountStatus, AccountValidity } from '@polkadot/types/interfaces/purchase';
import type { ActiveRecovery, RecoveryConfig } from '@polkadot/types/interfaces/recovery';
import type { RpcMethods } from '@polkadot/types/interfaces/rpc';
import type { AccountId, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, BlockNumberFor, BlockNumberOf, Call, CallHash, CallHashOf, ChangesTrieConfiguration, ChangesTrieSignal, CodecHash, Consensus, ConsensusEngineId, Digest, DigestItem, EncodedJustification, ExtrinsicsWeight, Fixed128, Fixed64, FixedI128, FixedI64, FixedU128, FixedU64, H1024, H128, H160, H2048, H256, H32, H512, H64, Hash, Header, HeaderPartial, I32F32, Index, IndicesLookupSource, Justification, Justifications, KeyTypeId, KeyValue, LockIdentifier, LookupSource, LookupTarget, ModuleId, Moment, MultiAddress, MultiSigner, OpaqueCall, Origin, OriginCaller, PalletId, PalletVersion, PalletsOrigin, Pays, PerU16, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, Releases, RuntimeDbWeight, Seal, SealV0, SignedBlock, SignedBlockWithJustification, SignedBlockWithJustifications, Slot, StorageData, StorageProof, TransactionInfo, TransactionPriority, TransactionStorageProof, U32F32, ValidatorId, ValidatorIdOf, Weight, WeightMultiplier } from '@polkadot/types/interfaces/runtime';
import type { SiField, SiLookupTypeId, SiPath, SiType, SiTypeDef, SiTypeDefArray, SiTypeDefComposite, SiTypeDefPrimitive, SiTypeDefSequence, SiTypeDefTuple, SiTypeDefVariant, SiVariant } from '@polkadot/types/interfaces/scaleInfo';
import type { AccountId, AccountId20, AccountId32, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, BlockNumberFor, BlockNumberOf, Call, CallHash, CallHashOf, ChangesTrieConfiguration, ChangesTrieSignal, CodecHash, Consensus, ConsensusEngineId, Digest, DigestItem, EncodedJustification, ExtrinsicsWeight, Fixed128, Fixed64, FixedI128, FixedI64, FixedU128, FixedU64, H1024, H128, H160, H2048, H256, H32, H512, H64, Hash, Header, HeaderPartial, I32F32, Index, IndicesLookupSource, Justification, Justifications, KeyTypeId, KeyValue, LockIdentifier, LookupSource, LookupTarget, ModuleId, Moment, MultiAddress, MultiSigner, OpaqueCall, Origin, OriginCaller, PalletId, PalletVersion, PalletsOrigin, Pays, PerU16, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, Releases, RuntimeDbWeight, Seal, SealV0, SignedBlock, SignedBlockWithJustification, SignedBlockWithJustifications, Slot, StorageData, StorageProof, TransactionInfo, TransactionPriority, TransactionStorageProof, U32F32, ValidatorId, ValidatorIdOf, Weight, WeightMultiplier } from '@polkadot/types/interfaces/runtime';
import type { Si0Field, Si0LookupTypeId, Si0Path, Si0Type, Si0TypeDef, Si0TypeDefArray, Si0TypeDefBitSequence, Si0TypeDefCompact, Si0TypeDefComposite, Si0TypeDefPhantom, Si0TypeDefPrimitive, Si0TypeDefSequence, Si0TypeDefTuple, Si0TypeDefVariant, Si0TypeParameter, Si0Variant, SiField, SiLookupTypeId, SiPath, SiType, SiTypeDef, SiTypeDefArray, SiTypeDefBitSequence, SiTypeDefCompact, SiTypeDefComposite, SiTypeDefPrimitive, SiTypeDefSequence, SiTypeDefTuple, SiTypeDefVariant, SiTypeParameter, SiVariant } from '@polkadot/types/interfaces/scaleInfo';
import type { Period, Priority, SchedulePeriod, SchedulePriority, Scheduled, ScheduledTo254, TaskAddress } from '@polkadot/types/interfaces/scheduler';
import type { BeefyKey, FullIdentification, IdentificationTuple, Keys, MembershipProof, SessionIndex, SessionKeys1, SessionKeys10, SessionKeys10B, SessionKeys2, SessionKeys3, SessionKeys4, SessionKeys5, SessionKeys6, SessionKeys6B, SessionKeys7, SessionKeys7B, SessionKeys8, SessionKeys8B, SessionKeys9, SessionKeys9B, ValidatorCount } from '@polkadot/types/interfaces/session';
import type { Bid, BidKind, SocietyJudgement, SocietyVote, StrikeCount, VouchingStatus } from '@polkadot/types/interfaces/society';
@@ -126,7 +126,7 @@ declare module '@polkadot/types/types/registry' {
'Compact<SessionIndex>': Compact<SessionIndex>;
'Compact<SetId>': Compact<SetId>;
'Compact<SetIndex>': Compact<SetIndex>;
'Compact<SiLookupTypeId>': Compact<SiLookupTypeId>;
'Compact<Si0LookupTypeId>': Compact<Si0LookupTypeId>;
'Compact<Slot>': Compact<Slot>;
'Compact<SlotNumber>': Compact<SlotNumber>;
'Compact<SpanIndex>': Compact<SpanIndex>;
@@ -162,6 +162,8 @@ declare module '@polkadot/types/types/registry' {
'Option<AbridgedHrmpChannel>': Option<AbridgedHrmpChannel>;
'Option<AccountData>': Option<AccountData>;
'Option<AccountId>': Option<AccountId>;
'Option<AccountId20>': Option<AccountId20>;
'Option<AccountId32>': Option<AccountId32>;
'Option<AccountId32Junction>': Option<AccountId32Junction>;
'Option<AccountIdOf>': Option<AccountIdOf>;
'Option<AccountIndex>': Option<AccountIndex>;
@@ -371,12 +373,6 @@ declare module '@polkadot/types/types/registry' {
'Option<DisputeStatement>': Option<DisputeStatement>;
'Option<DisputeStatementSet>': Option<DisputeStatementSet>;
'Option<DoubleEncodedCall>': Option<DoubleEncodedCall>;
'Option<DoubleMapTypeLatest>': Option<DoubleMapTypeLatest>;
'Option<DoubleMapTypeV10>': Option<DoubleMapTypeV10>;
'Option<DoubleMapTypeV11>': Option<DoubleMapTypeV11>;
'Option<DoubleMapTypeV12>': Option<DoubleMapTypeV12>;
'Option<DoubleMapTypeV13>': Option<DoubleMapTypeV13>;
'Option<DoubleMapTypeV9>': Option<DoubleMapTypeV9>;
'Option<DoubleVoteReport>': Option<DoubleVoteReport>;
'Option<DownwardMessage>': Option<DownwardMessage>;
'Option<EcdsaSignature>': Option<EcdsaSignature>;
@@ -460,6 +456,7 @@ declare module '@polkadot/types/types/registry' {
'Option<ExtrinsicMetadataV11>': Option<ExtrinsicMetadataV11>;
'Option<ExtrinsicMetadataV12>': Option<ExtrinsicMetadataV12>;
'Option<ExtrinsicMetadataV13>': Option<ExtrinsicMetadataV13>;
'Option<ExtrinsicMetadataV14>': Option<ExtrinsicMetadataV14>;
'Option<ExtrinsicOrHash>': Option<ExtrinsicOrHash>;
'Option<ExtrinsicPayload>': Option<ExtrinsicPayload>;
'Option<ExtrinsicPayloadUnknown>': Option<ExtrinsicPayloadUnknown>;
@@ -594,12 +591,6 @@ declare module '@polkadot/types/types/registry' {
'Option<LookupSource>': Option<LookupSource>;
'Option<LookupTarget>': Option<LookupTarget>;
'Option<LotteryConfig>': Option<LotteryConfig>;
'Option<MapTypeLatest>': Option<MapTypeLatest>;
'Option<MapTypeV10>': Option<MapTypeV10>;
'Option<MapTypeV11>': Option<MapTypeV11>;
'Option<MapTypeV12>': Option<MapTypeV12>;
'Option<MapTypeV13>': Option<MapTypeV13>;
'Option<MapTypeV9>': Option<MapTypeV9>;
'Option<MaybeRandomness>': Option<MaybeRandomness>;
'Option<MaybeVrf>': Option<MaybeVrf>;
'Option<MemberCount>': Option<MemberCount>;
@@ -615,6 +606,7 @@ declare module '@polkadot/types/types/registry' {
'Option<MetadataV11>': Option<MetadataV11>;
'Option<MetadataV12>': Option<MetadataV12>;
'Option<MetadataV13>': Option<MetadataV13>;
'Option<MetadataV14>': Option<MetadataV14>;
'Option<MetadataV9>': Option<MetadataV9>;
'Option<MmrLeafProof>': Option<MmrLeafProof>;
'Option<MmrRootHash>': Option<MmrRootHash>;
@@ -655,8 +647,6 @@ declare module '@polkadot/types/types/registry' {
'Option<NextAuthority>': Option<NextAuthority>;
'Option<NextConfigDescriptor>': Option<NextConfigDescriptor>;
'Option<NextConfigDescriptorV1>': Option<NextConfigDescriptorV1>;
'Option<NMapTypeLatest>': Option<NMapTypeLatest>;
'Option<NMapTypeV13>': Option<NMapTypeV13>;
'Option<NodeRole>': Option<NodeRole>;
'Option<Nominations>': Option<Nominations>;
'Option<NominatorIndex>': Option<NominatorIndex>;
@@ -685,8 +675,20 @@ declare module '@polkadot/types/types/registry' {
'Option<Owner>': Option<Owner>;
'Option<PageCounter>': Option<PageCounter>;
'Option<PageIndexData>': Option<PageIndexData>;
'Option<PalletCallMetadataLatest>': Option<PalletCallMetadataLatest>;
'Option<PalletCallMetadataV14>': Option<PalletCallMetadataV14>;
'Option<PalletConstantMetadataLatest>': Option<PalletConstantMetadataLatest>;
'Option<PalletConstantMetadataV14>': Option<PalletConstantMetadataV14>;
'Option<PalletErrorMetadataLatest>': Option<PalletErrorMetadataLatest>;
'Option<PalletErrorMetadataV14>': Option<PalletErrorMetadataV14>;
'Option<PalletEventMetadataLatest>': Option<PalletEventMetadataLatest>;
'Option<PalletEventMetadataV14>': Option<PalletEventMetadataV14>;
'Option<PalletId>': Option<PalletId>;
'Option<PalletMetadataLatest>': Option<PalletMetadataLatest>;
'Option<PalletMetadataV14>': Option<PalletMetadataV14>;
'Option<PalletsOrigin>': Option<PalletsOrigin>;
'Option<PalletStorageMetadataLatest>': Option<PalletStorageMetadataLatest>;
'Option<PalletStorageMetadataV14>': Option<PalletStorageMetadataV14>;
'Option<PalletVersion>': Option<PalletVersion>;
'Option<ParachainDispatchOrigin>': Option<ParachainDispatchOrigin>;
'Option<ParachainInherentData>': Option<ParachainInherentData>;
@@ -730,6 +732,8 @@ declare module '@polkadot/types/types/registry' {
'Option<PhragmenScore>': Option<PhragmenScore>;
'Option<PluralityJunction>': Option<PluralityJunction>;
'Option<Points>': Option<Points>;
'Option<PortableRegistry>': Option<PortableRegistry>;
'Option<PortableType>': Option<PortableType>;
'Option<Precommits>': Option<Precommits>;
'Option<PrefabWasmModule>': Option<PrefabWasmModule>;
'Option<PrefixedStorageKey>': Option<PrefixedStorageKey>;
@@ -789,6 +793,7 @@ declare module '@polkadot/types/types/registry' {
'Option<Remark>': Option<Remark>;
'Option<Renouncing>': Option<Renouncing>;
'Option<RentProjection>': Option<RentProjection>;
'Option<ReplacementTimes>': Option<ReplacementTimes>;
'Option<ReportedRoundStates>': Option<ReportedRoundStates>;
'Option<Reporter>': Option<Reporter>;
'Option<ReportIdOf>': Option<ReportIdOf>;
@@ -839,6 +844,22 @@ declare module '@polkadot/types/types/registry' {
'Option<SessionKeys9B>': Option<SessionKeys9B>;
'Option<SetId>': Option<SetId>;
'Option<SetIndex>': Option<SetIndex>;
'Option<Si0Field>': Option<Si0Field>;
'Option<Si0LookupTypeId>': Option<Si0LookupTypeId>;
'Option<Si0Path>': Option<Si0Path>;
'Option<Si0Type>': Option<Si0Type>;
'Option<Si0TypeDef>': Option<Si0TypeDef>;
'Option<Si0TypeDefArray>': Option<Si0TypeDefArray>;
'Option<Si0TypeDefBitSequence>': Option<Si0TypeDefBitSequence>;
'Option<Si0TypeDefCompact>': Option<Si0TypeDefCompact>;
'Option<Si0TypeDefComposite>': Option<Si0TypeDefComposite>;
'Option<Si0TypeDefPhantom>': Option<Si0TypeDefPhantom>;
'Option<Si0TypeDefPrimitive>': Option<Si0TypeDefPrimitive>;
'Option<Si0TypeDefSequence>': Option<Si0TypeDefSequence>;
'Option<Si0TypeDefTuple>': Option<Si0TypeDefTuple>;
'Option<Si0TypeDefVariant>': Option<Si0TypeDefVariant>;
'Option<Si0TypeParameter>': Option<Si0TypeParameter>;
'Option<Si0Variant>': Option<Si0Variant>;
'Option<SiField>': Option<SiField>;
'Option<Signature>': Option<Signature>;
'Option<SignedAvailabilityBitfield>': Option<SignedAvailabilityBitfield>;
@@ -846,6 +867,8 @@ declare module '@polkadot/types/types/registry' {
'Option<SignedBlock>': Option<SignedBlock>;
'Option<SignedBlockWithJustification>': Option<SignedBlockWithJustification>;
'Option<SignedBlockWithJustifications>': Option<SignedBlockWithJustifications>;
'Option<SignedExtensionMetadataLatest>': Option<SignedExtensionMetadataLatest>;
'Option<SignedExtensionMetadataV14>': Option<SignedExtensionMetadataV14>;
'Option<SignedSubmission>': Option<SignedSubmission>;
'Option<SignedSubmissionOf>': Option<SignedSubmissionOf>;
'Option<SignerPayload>': Option<SignerPayload>;
@@ -855,11 +878,14 @@ declare module '@polkadot/types/types/registry' {
'Option<SiType>': Option<SiType>;
'Option<SiTypeDef>': Option<SiTypeDef>;
'Option<SiTypeDefArray>': Option<SiTypeDefArray>;
'Option<SiTypeDefBitSequence>': Option<SiTypeDefBitSequence>;
'Option<SiTypeDefCompact>': Option<SiTypeDefCompact>;
'Option<SiTypeDefComposite>': Option<SiTypeDefComposite>;
'Option<SiTypeDefPrimitive>': Option<SiTypeDefPrimitive>;
'Option<SiTypeDefSequence>': Option<SiTypeDefSequence>;
'Option<SiTypeDefTuple>': Option<SiTypeDefTuple>;
'Option<SiTypeDefVariant>': Option<SiTypeDefVariant>;
'Option<SiTypeParameter>': Option<SiTypeParameter>;
'Option<SiVariant>': Option<SiVariant>;
'Option<SlashingSpans>': Option<SlashingSpans>;
'Option<SlashingSpansTo204>': Option<SlashingSpansTo204>;
@@ -887,24 +913,28 @@ declare module '@polkadot/types/types/registry' {
'Option<StorageEntryMetadataV11>': Option<StorageEntryMetadataV11>;
'Option<StorageEntryMetadataV12>': Option<StorageEntryMetadataV12>;
'Option<StorageEntryMetadataV13>': Option<StorageEntryMetadataV13>;
'Option<StorageEntryMetadataV14>': Option<StorageEntryMetadataV14>;
'Option<StorageEntryMetadataV9>': Option<StorageEntryMetadataV9>;
'Option<StorageEntryModifierLatest>': Option<StorageEntryModifierLatest>;
'Option<StorageEntryModifierV10>': Option<StorageEntryModifierV10>;
'Option<StorageEntryModifierV11>': Option<StorageEntryModifierV11>;
'Option<StorageEntryModifierV12>': Option<StorageEntryModifierV12>;
'Option<StorageEntryModifierV13>': Option<StorageEntryModifierV13>;
'Option<StorageEntryModifierV14>': Option<StorageEntryModifierV14>;
'Option<StorageEntryModifierV9>': Option<StorageEntryModifierV9>;
'Option<StorageEntryTypeLatest>': Option<StorageEntryTypeLatest>;
'Option<StorageEntryTypeV10>': Option<StorageEntryTypeV10>;
'Option<StorageEntryTypeV11>': Option<StorageEntryTypeV11>;
'Option<StorageEntryTypeV12>': Option<StorageEntryTypeV12>;
'Option<StorageEntryTypeV13>': Option<StorageEntryTypeV13>;
'Option<StorageEntryTypeV14>': Option<StorageEntryTypeV14>;
'Option<StorageEntryTypeV9>': Option<StorageEntryTypeV9>;
'Option<StorageHasher>': Option<StorageHasher>;
'Option<StorageHasherV10>': Option<StorageHasherV10>;
'Option<StorageHasherV11>': Option<StorageHasherV11>;
'Option<StorageHasherV12>': Option<StorageHasherV12>;
'Option<StorageHasherV13>': Option<StorageHasherV13>;
'Option<StorageHasherV14>': Option<StorageHasherV14>;
'Option<StorageHasherV9>': Option<StorageHasherV9>;
'Option<StorageKey>': Option<StorageKey>;
'Option<StorageKind>': Option<StorageKind>;
@@ -1045,6 +1075,8 @@ declare module '@polkadot/types/types/registry' {
'Vec<AbridgedHrmpChannel>': Vec<AbridgedHrmpChannel>;
'Vec<AccountData>': Vec<AccountData>;
'Vec<AccountId>': Vec<AccountId>;
'Vec<AccountId20>': Vec<AccountId20>;
'Vec<AccountId32>': Vec<AccountId32>;
'Vec<AccountId32Junction>': Vec<AccountId32Junction>;
'Vec<AccountIdOf>': Vec<AccountIdOf>;
'Vec<AccountIndex>': Vec<AccountIndex>;
@@ -1254,12 +1286,6 @@ declare module '@polkadot/types/types/registry' {
'Vec<DisputeStatement>': Vec<DisputeStatement>;
'Vec<DisputeStatementSet>': Vec<DisputeStatementSet>;
'Vec<DoubleEncodedCall>': Vec<DoubleEncodedCall>;
'Vec<DoubleMapTypeLatest>': Vec<DoubleMapTypeLatest>;
'Vec<DoubleMapTypeV10>': Vec<DoubleMapTypeV10>;
'Vec<DoubleMapTypeV11>': Vec<DoubleMapTypeV11>;
'Vec<DoubleMapTypeV12>': Vec<DoubleMapTypeV12>;
'Vec<DoubleMapTypeV13>': Vec<DoubleMapTypeV13>;
'Vec<DoubleMapTypeV9>': Vec<DoubleMapTypeV9>;
'Vec<DoubleVoteReport>': Vec<DoubleVoteReport>;
'Vec<DownwardMessage>': Vec<DownwardMessage>;
'Vec<EcdsaSignature>': Vec<EcdsaSignature>;
@@ -1343,6 +1369,7 @@ declare module '@polkadot/types/types/registry' {
'Vec<ExtrinsicMetadataV11>': Vec<ExtrinsicMetadataV11>;
'Vec<ExtrinsicMetadataV12>': Vec<ExtrinsicMetadataV12>;
'Vec<ExtrinsicMetadataV13>': Vec<ExtrinsicMetadataV13>;
'Vec<ExtrinsicMetadataV14>': Vec<ExtrinsicMetadataV14>;
'Vec<ExtrinsicOrHash>': Vec<ExtrinsicOrHash>;
'Vec<ExtrinsicPayload>': Vec<ExtrinsicPayload>;
'Vec<ExtrinsicPayloadUnknown>': Vec<ExtrinsicPayloadUnknown>;
@@ -1477,12 +1504,6 @@ declare module '@polkadot/types/types/registry' {
'Vec<LookupSource>': Vec<LookupSource>;
'Vec<LookupTarget>': Vec<LookupTarget>;
'Vec<LotteryConfig>': Vec<LotteryConfig>;
'Vec<MapTypeLatest>': Vec<MapTypeLatest>;
'Vec<MapTypeV10>': Vec<MapTypeV10>;
'Vec<MapTypeV11>': Vec<MapTypeV11>;
'Vec<MapTypeV12>': Vec<MapTypeV12>;
'Vec<MapTypeV13>': Vec<MapTypeV13>;
'Vec<MapTypeV9>': Vec<MapTypeV9>;
'Vec<MaybeRandomness>': Vec<MaybeRandomness>;
'Vec<MaybeVrf>': Vec<MaybeVrf>;
'Vec<MemberCount>': Vec<MemberCount>;
@@ -1498,6 +1519,7 @@ declare module '@polkadot/types/types/registry' {
'Vec<MetadataV11>': Vec<MetadataV11>;
'Vec<MetadataV12>': Vec<MetadataV12>;
'Vec<MetadataV13>': Vec<MetadataV13>;
'Vec<MetadataV14>': Vec<MetadataV14>;
'Vec<MetadataV9>': Vec<MetadataV9>;
'Vec<MmrLeafProof>': Vec<MmrLeafProof>;
'Vec<MmrRootHash>': Vec<MmrRootHash>;
@@ -1538,8 +1560,6 @@ declare module '@polkadot/types/types/registry' {
'Vec<NextAuthority>': Vec<NextAuthority>;
'Vec<NextConfigDescriptor>': Vec<NextConfigDescriptor>;
'Vec<NextConfigDescriptorV1>': Vec<NextConfigDescriptorV1>;
'Vec<NMapTypeLatest>': Vec<NMapTypeLatest>;
'Vec<NMapTypeV13>': Vec<NMapTypeV13>;
'Vec<NodeRole>': Vec<NodeRole>;
'Vec<Nominations>': Vec<Nominations>;
'Vec<NominatorIndex>': Vec<NominatorIndex>;
@@ -1568,8 +1588,20 @@ declare module '@polkadot/types/types/registry' {
'Vec<Owner>': Vec<Owner>;
'Vec<PageCounter>': Vec<PageCounter>;
'Vec<PageIndexData>': Vec<PageIndexData>;
'Vec<PalletCallMetadataLatest>': Vec<PalletCallMetadataLatest>;
'Vec<PalletCallMetadataV14>': Vec<PalletCallMetadataV14>;
'Vec<PalletConstantMetadataLatest>': Vec<PalletConstantMetadataLatest>;
'Vec<PalletConstantMetadataV14>': Vec<PalletConstantMetadataV14>;
'Vec<PalletErrorMetadataLatest>': Vec<PalletErrorMetadataLatest>;
'Vec<PalletErrorMetadataV14>': Vec<PalletErrorMetadataV14>;
'Vec<PalletEventMetadataLatest>': Vec<PalletEventMetadataLatest>;
'Vec<PalletEventMetadataV14>': Vec<PalletEventMetadataV14>;
'Vec<PalletId>': Vec<PalletId>;
'Vec<PalletMetadataLatest>': Vec<PalletMetadataLatest>;
'Vec<PalletMetadataV14>': Vec<PalletMetadataV14>;
'Vec<PalletsOrigin>': Vec<PalletsOrigin>;
'Vec<PalletStorageMetadataLatest>': Vec<PalletStorageMetadataLatest>;
'Vec<PalletStorageMetadataV14>': Vec<PalletStorageMetadataV14>;
'Vec<PalletVersion>': Vec<PalletVersion>;
'Vec<ParachainDispatchOrigin>': Vec<ParachainDispatchOrigin>;
'Vec<ParachainInherentData>': Vec<ParachainInherentData>;
@@ -1613,6 +1645,8 @@ declare module '@polkadot/types/types/registry' {
'Vec<PhragmenScore>': Vec<PhragmenScore>;
'Vec<PluralityJunction>': Vec<PluralityJunction>;
'Vec<Points>': Vec<Points>;
'Vec<PortableRegistry>': Vec<PortableRegistry>;
'Vec<PortableType>': Vec<PortableType>;
'Vec<Precommits>': Vec<Precommits>;
'Vec<PrefabWasmModule>': Vec<PrefabWasmModule>;
'Vec<PrefixedStorageKey>': Vec<PrefixedStorageKey>;
@@ -1672,6 +1706,7 @@ declare module '@polkadot/types/types/registry' {
'Vec<Remark>': Vec<Remark>;
'Vec<Renouncing>': Vec<Renouncing>;
'Vec<RentProjection>': Vec<RentProjection>;
'Vec<ReplacementTimes>': Vec<ReplacementTimes>;
'Vec<ReportedRoundStates>': Vec<ReportedRoundStates>;
'Vec<Reporter>': Vec<Reporter>;
'Vec<ReportIdOf>': Vec<ReportIdOf>;
@@ -1722,6 +1757,22 @@ declare module '@polkadot/types/types/registry' {
'Vec<SessionKeys9B>': Vec<SessionKeys9B>;
'Vec<SetId>': Vec<SetId>;
'Vec<SetIndex>': Vec<SetIndex>;
'Vec<Si0Field>': Vec<Si0Field>;
'Vec<Si0LookupTypeId>': Vec<Si0LookupTypeId>;
'Vec<Si0Path>': Vec<Si0Path>;
'Vec<Si0Type>': Vec<Si0Type>;
'Vec<Si0TypeDef>': Vec<Si0TypeDef>;
'Vec<Si0TypeDefArray>': Vec<Si0TypeDefArray>;
'Vec<Si0TypeDefBitSequence>': Vec<Si0TypeDefBitSequence>;
'Vec<Si0TypeDefCompact>': Vec<Si0TypeDefCompact>;
'Vec<Si0TypeDefComposite>': Vec<Si0TypeDefComposite>;
'Vec<Si0TypeDefPhantom>': Vec<Si0TypeDefPhantom>;
'Vec<Si0TypeDefPrimitive>': Vec<Si0TypeDefPrimitive>;
'Vec<Si0TypeDefSequence>': Vec<Si0TypeDefSequence>;
'Vec<Si0TypeDefTuple>': Vec<Si0TypeDefTuple>;
'Vec<Si0TypeDefVariant>': Vec<Si0TypeDefVariant>;
'Vec<Si0TypeParameter>': Vec<Si0TypeParameter>;
'Vec<Si0Variant>': Vec<Si0Variant>;
'Vec<SiField>': Vec<SiField>;
'Vec<Signature>': Vec<Signature>;
'Vec<SignedAvailabilityBitfield>': Vec<SignedAvailabilityBitfield>;
@@ -1729,6 +1780,8 @@ declare module '@polkadot/types/types/registry' {
'Vec<SignedBlock>': Vec<SignedBlock>;
'Vec<SignedBlockWithJustification>': Vec<SignedBlockWithJustification>;
'Vec<SignedBlockWithJustifications>': Vec<SignedBlockWithJustifications>;
'Vec<SignedExtensionMetadataLatest>': Vec<SignedExtensionMetadataLatest>;
'Vec<SignedExtensionMetadataV14>': Vec<SignedExtensionMetadataV14>;
'Vec<SignedSubmission>': Vec<SignedSubmission>;
'Vec<SignedSubmissionOf>': Vec<SignedSubmissionOf>;
'Vec<SignerPayload>': Vec<SignerPayload>;
@@ -1738,11 +1791,14 @@ declare module '@polkadot/types/types/registry' {
'Vec<SiType>': Vec<SiType>;
'Vec<SiTypeDef>': Vec<SiTypeDef>;
'Vec<SiTypeDefArray>': Vec<SiTypeDefArray>;
'Vec<SiTypeDefBitSequence>': Vec<SiTypeDefBitSequence>;
'Vec<SiTypeDefCompact>': Vec<SiTypeDefCompact>;
'Vec<SiTypeDefComposite>': Vec<SiTypeDefComposite>;
'Vec<SiTypeDefPrimitive>': Vec<SiTypeDefPrimitive>;
'Vec<SiTypeDefSequence>': Vec<SiTypeDefSequence>;
'Vec<SiTypeDefTuple>': Vec<SiTypeDefTuple>;
'Vec<SiTypeDefVariant>': Vec<SiTypeDefVariant>;
'Vec<SiTypeParameter>': Vec<SiTypeParameter>;
'Vec<SiVariant>': Vec<SiVariant>;
'Vec<SlashingSpans>': Vec<SlashingSpans>;
'Vec<SlashingSpansTo204>': Vec<SlashingSpansTo204>;
@@ -1770,24 +1826,28 @@ declare module '@polkadot/types/types/registry' {
'Vec<StorageEntryMetadataV11>': Vec<StorageEntryMetadataV11>;
'Vec<StorageEntryMetadataV12>': Vec<StorageEntryMetadataV12>;
'Vec<StorageEntryMetadataV13>': Vec<StorageEntryMetadataV13>;
'Vec<StorageEntryMetadataV14>': Vec<StorageEntryMetadataV14>;
'Vec<StorageEntryMetadataV9>': Vec<StorageEntryMetadataV9>;
'Vec<StorageEntryModifierLatest>': Vec<StorageEntryModifierLatest>;
'Vec<StorageEntryModifierV10>': Vec<StorageEntryModifierV10>;
'Vec<StorageEntryModifierV11>': Vec<StorageEntryModifierV11>;
'Vec<StorageEntryModifierV12>': Vec<StorageEntryModifierV12>;
'Vec<StorageEntryModifierV13>': Vec<StorageEntryModifierV13>;
'Vec<StorageEntryModifierV14>': Vec<StorageEntryModifierV14>;
'Vec<StorageEntryModifierV9>': Vec<StorageEntryModifierV9>;
'Vec<StorageEntryTypeLatest>': Vec<StorageEntryTypeLatest>;
'Vec<StorageEntryTypeV10>': Vec<StorageEntryTypeV10>;
'Vec<StorageEntryTypeV11>': Vec<StorageEntryTypeV11>;
'Vec<StorageEntryTypeV12>': Vec<StorageEntryTypeV12>;
'Vec<StorageEntryTypeV13>': Vec<StorageEntryTypeV13>;
'Vec<StorageEntryTypeV14>': Vec<StorageEntryTypeV14>;
'Vec<StorageEntryTypeV9>': Vec<StorageEntryTypeV9>;
'Vec<StorageHasher>': Vec<StorageHasher>;
'Vec<StorageHasherV10>': Vec<StorageHasherV10>;
'Vec<StorageHasherV11>': Vec<StorageHasherV11>;
'Vec<StorageHasherV12>': Vec<StorageHasherV12>;
'Vec<StorageHasherV13>': Vec<StorageHasherV13>;
'Vec<StorageHasherV14>': Vec<StorageHasherV14>;
'Vec<StorageHasherV9>': Vec<StorageHasherV9>;
'Vec<StorageKey>': Vec<StorageKey>;
'Vec<StorageKind>': Vec<StorageKind>;
@@ -1928,6 +1988,8 @@ declare module '@polkadot/types/types/registry' {
AbridgedHrmpChannel: AbridgedHrmpChannel;
AccountData: AccountData;
AccountId: AccountId;
AccountId20: AccountId20;
AccountId32: AccountId32;
AccountId32Junction: AccountId32Junction;
AccountIdOf: AccountIdOf;
AccountIndex: AccountIndex;
@@ -2137,12 +2199,6 @@ declare module '@polkadot/types/types/registry' {
DisputeStatement: DisputeStatement;
DisputeStatementSet: DisputeStatementSet;
DoubleEncodedCall: DoubleEncodedCall;
DoubleMapTypeLatest: DoubleMapTypeLatest;
DoubleMapTypeV10: DoubleMapTypeV10;
DoubleMapTypeV11: DoubleMapTypeV11;
DoubleMapTypeV12: DoubleMapTypeV12;
DoubleMapTypeV13: DoubleMapTypeV13;
DoubleMapTypeV9: DoubleMapTypeV9;
DoubleVoteReport: DoubleVoteReport;
DownwardMessage: DownwardMessage;
EcdsaSignature: EcdsaSignature;
@@ -2226,6 +2282,7 @@ declare module '@polkadot/types/types/registry' {
ExtrinsicMetadataV11: ExtrinsicMetadataV11;
ExtrinsicMetadataV12: ExtrinsicMetadataV12;
ExtrinsicMetadataV13: ExtrinsicMetadataV13;
ExtrinsicMetadataV14: ExtrinsicMetadataV14;
ExtrinsicOrHash: ExtrinsicOrHash;
ExtrinsicPayload: ExtrinsicPayload;
ExtrinsicPayloadUnknown: ExtrinsicPayloadUnknown;
@@ -2360,12 +2417,6 @@ declare module '@polkadot/types/types/registry' {
LookupSource: LookupSource;
LookupTarget: LookupTarget;
LotteryConfig: LotteryConfig;
MapTypeLatest: MapTypeLatest;
MapTypeV10: MapTypeV10;
MapTypeV11: MapTypeV11;
MapTypeV12: MapTypeV12;
MapTypeV13: MapTypeV13;
MapTypeV9: MapTypeV9;
MaybeRandomness: MaybeRandomness;
MaybeVrf: MaybeVrf;
MemberCount: MemberCount;
@@ -2381,6 +2432,7 @@ declare module '@polkadot/types/types/registry' {
MetadataV11: MetadataV11;
MetadataV12: MetadataV12;
MetadataV13: MetadataV13;
MetadataV14: MetadataV14;
MetadataV9: MetadataV9;
MmrLeafProof: MmrLeafProof;
MmrRootHash: MmrRootHash;
@@ -2421,8 +2473,6 @@ declare module '@polkadot/types/types/registry' {
NextAuthority: NextAuthority;
NextConfigDescriptor: NextConfigDescriptor;
NextConfigDescriptorV1: NextConfigDescriptorV1;
NMapTypeLatest: NMapTypeLatest;
NMapTypeV13: NMapTypeV13;
NodeRole: NodeRole;
Nominations: Nominations;
NominatorIndex: NominatorIndex;
@@ -2451,8 +2501,20 @@ declare module '@polkadot/types/types/registry' {
Owner: Owner;
PageCounter: PageCounter;
PageIndexData: PageIndexData;
PalletCallMetadataLatest: PalletCallMetadataLatest;
PalletCallMetadataV14: PalletCallMetadataV14;
PalletConstantMetadataLatest: PalletConstantMetadataLatest;
PalletConstantMetadataV14: PalletConstantMetadataV14;
PalletErrorMetadataLatest: PalletErrorMetadataLatest;
PalletErrorMetadataV14: PalletErrorMetadataV14;
PalletEventMetadataLatest: PalletEventMetadataLatest;
PalletEventMetadataV14: PalletEventMetadataV14;
PalletId: PalletId;
PalletMetadataLatest: PalletMetadataLatest;
PalletMetadataV14: PalletMetadataV14;
PalletsOrigin: PalletsOrigin;
PalletStorageMetadataLatest: PalletStorageMetadataLatest;
PalletStorageMetadataV14: PalletStorageMetadataV14;
PalletVersion: PalletVersion;
ParachainDispatchOrigin: ParachainDispatchOrigin;
ParachainInherentData: ParachainInherentData;
@@ -2496,6 +2558,8 @@ declare module '@polkadot/types/types/registry' {
PhragmenScore: PhragmenScore;
PluralityJunction: PluralityJunction;
Points: Points;
PortableRegistry: PortableRegistry;
PortableType: PortableType;
Precommits: Precommits;
PrefabWasmModule: PrefabWasmModule;
PrefixedStorageKey: PrefixedStorageKey;
@@ -2555,6 +2619,7 @@ declare module '@polkadot/types/types/registry' {
Remark: Remark;
Renouncing: Renouncing;
RentProjection: RentProjection;
ReplacementTimes: ReplacementTimes;
ReportedRoundStates: ReportedRoundStates;
Reporter: Reporter;
ReportIdOf: ReportIdOf;
@@ -2605,6 +2670,22 @@ declare module '@polkadot/types/types/registry' {
SessionKeys9B: SessionKeys9B;
SetId: SetId;
SetIndex: SetIndex;
Si0Field: Si0Field;
Si0LookupTypeId: Si0LookupTypeId;
Si0Path: Si0Path;
Si0Type: Si0Type;
Si0TypeDef: Si0TypeDef;
Si0TypeDefArray: Si0TypeDefArray;
Si0TypeDefBitSequence: Si0TypeDefBitSequence;
Si0TypeDefCompact: Si0TypeDefCompact;
Si0TypeDefComposite: Si0TypeDefComposite;
Si0TypeDefPhantom: Si0TypeDefPhantom;
Si0TypeDefPrimitive: Si0TypeDefPrimitive;
Si0TypeDefSequence: Si0TypeDefSequence;
Si0TypeDefTuple: Si0TypeDefTuple;
Si0TypeDefVariant: Si0TypeDefVariant;
Si0TypeParameter: Si0TypeParameter;
Si0Variant: Si0Variant;
SiField: SiField;
Signature: Signature;
SignedAvailabilityBitfield: SignedAvailabilityBitfield;
@@ -2612,6 +2693,8 @@ declare module '@polkadot/types/types/registry' {
SignedBlock: SignedBlock;
SignedBlockWithJustification: SignedBlockWithJustification;
SignedBlockWithJustifications: SignedBlockWithJustifications;
SignedExtensionMetadataLatest: SignedExtensionMetadataLatest;
SignedExtensionMetadataV14: SignedExtensionMetadataV14;
SignedSubmission: SignedSubmission;
SignedSubmissionOf: SignedSubmissionOf;
SignerPayload: SignerPayload;
@@ -2621,11 +2704,14 @@ declare module '@polkadot/types/types/registry' {
SiType: SiType;
SiTypeDef: SiTypeDef;
SiTypeDefArray: SiTypeDefArray;
SiTypeDefBitSequence: SiTypeDefBitSequence;
SiTypeDefCompact: SiTypeDefCompact;
SiTypeDefComposite: SiTypeDefComposite;
SiTypeDefPrimitive: SiTypeDefPrimitive;
SiTypeDefSequence: SiTypeDefSequence;
SiTypeDefTuple: SiTypeDefTuple;
SiTypeDefVariant: SiTypeDefVariant;
SiTypeParameter: SiTypeParameter;
SiVariant: SiVariant;
SlashingSpans: SlashingSpans;
SlashingSpansTo204: SlashingSpansTo204;
@@ -2653,24 +2739,28 @@ declare module '@polkadot/types/types/registry' {
StorageEntryMetadataV11: StorageEntryMetadataV11;
StorageEntryMetadataV12: StorageEntryMetadataV12;
StorageEntryMetadataV13: StorageEntryMetadataV13;
StorageEntryMetadataV14: StorageEntryMetadataV14;
StorageEntryMetadataV9: StorageEntryMetadataV9;
StorageEntryModifierLatest: StorageEntryModifierLatest;
StorageEntryModifierV10: StorageEntryModifierV10;
StorageEntryModifierV11: StorageEntryModifierV11;
StorageEntryModifierV12: StorageEntryModifierV12;
StorageEntryModifierV13: StorageEntryModifierV13;
StorageEntryModifierV14: StorageEntryModifierV14;
StorageEntryModifierV9: StorageEntryModifierV9;
StorageEntryTypeLatest: StorageEntryTypeLatest;
StorageEntryTypeV10: StorageEntryTypeV10;
StorageEntryTypeV11: StorageEntryTypeV11;
StorageEntryTypeV12: StorageEntryTypeV12;
StorageEntryTypeV13: StorageEntryTypeV13;
StorageEntryTypeV14: StorageEntryTypeV14;
StorageEntryTypeV9: StorageEntryTypeV9;
StorageHasher: StorageHasher;
StorageHasherV10: StorageHasherV10;
StorageHasherV11: StorageHasherV11;
StorageHasherV12: StorageHasherV12;
StorageHasherV13: StorageHasherV13;
StorageHasherV14: StorageHasherV14;
StorageHasherV9: StorageHasherV9;
StorageKey: StorageKey;
StorageKind: StorageKind;
+31 -12
View File
@@ -13,7 +13,12 @@ import { TypeDefInfo } from './types';
export function createClass<T extends Codec = Codec, K extends string = string> (registry: Registry, type: K): Constructor<FromReg<T, K>> {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
return getTypeClass<FromReg<T, K>>(registry, getTypeDef(type));
return getTypeClass<FromReg<T, K>>(
registry,
registry.isLookupType(type)
? registry.lookup.getTypeDef(type)
: getTypeDef(type)
);
}
// An unsafe version of the `createType` below. It's unsafe because the `type`
@@ -76,13 +81,17 @@ function createHashMap (value: TypeDef, Clazz: typeof BTreeMap | typeof HashMap)
}
const infoMapping: Record<TypeDefInfo, (registry: Registry, value: TypeDef) => Constructor> = {
[TypeDefInfo.BTreeMap]: (registry: Registry, value: TypeDef): Constructor => createHashMap(value, BTreeMap),
[TypeDefInfo.BTreeMap]: (registry: Registry, value: TypeDef): Constructor =>
createHashMap(value, BTreeMap),
[TypeDefInfo.BTreeSet]: (registry: Registry, value: TypeDef): Constructor => BTreeSet.with(getSubType(value)),
[TypeDefInfo.BTreeSet]: (registry: Registry, value: TypeDef): Constructor =>
BTreeSet.with(getSubType(value)),
[TypeDefInfo.Compact]: (registry: Registry, value: TypeDef): Constructor => Compact.with(getSubType(value)),
[TypeDefInfo.Compact]: (registry: Registry, value: TypeDef): Constructor =>
Compact.with(getSubType(value)),
[TypeDefInfo.DoNotConstruct]: (registry: Registry, value: TypeDef): Constructor => DoNotConstruct.with(value.displayName),
[TypeDefInfo.DoNotConstruct]: (registry: Registry, value: TypeDef): Constructor =>
DoNotConstruct.with(value.displayName || value.type),
[TypeDefInfo.Enum]: (registry: Registry, value: TypeDef): Constructor => {
const subs = getSubDefArray(value);
@@ -98,9 +107,11 @@ const infoMapping: Record<TypeDefInfo, (registry: Registry, value: TypeDef) => C
);
},
[TypeDefInfo.HashMap]: (registry: Registry, value: TypeDef): Constructor => createHashMap(value, HashMap),
[TypeDefInfo.HashMap]: (registry: Registry, value: TypeDef): Constructor =>
createHashMap(value, HashMap),
[TypeDefInfo.Int]: (registry: Registry, value: TypeDef): Constructor => createInt(value, Int),
[TypeDefInfo.Int]: (registry: Registry, value: TypeDef): Constructor =>
createInt(value, Int),
// We have circular deps between Linkage & Struct
[TypeDefInfo.Linkage]: (registry: Registry, value: TypeDef): Constructor => {
@@ -118,9 +129,11 @@ const infoMapping: Record<TypeDefInfo, (registry: Registry, value: TypeDef) => C
},
// eslint-disable-next-line @typescript-eslint/no-unused-vars
[TypeDefInfo.Null]: (registry: Registry, _: TypeDef): Constructor => createClass(registry, 'Null'),
[TypeDefInfo.Null]: (registry: Registry, _: TypeDef): Constructor =>
createClass(registry, 'Null'),
[TypeDefInfo.Option]: (registry: Registry, value: TypeDef): Constructor => Option.with(getSubType(value)),
[TypeDefInfo.Option]: (registry: Registry, value: TypeDef): Constructor =>
Option.with(getSubType(value)),
[TypeDefInfo.Plain]: (registry: Registry, value: TypeDef): Constructor =>
registry.getOrUnknown(value.type),
@@ -145,11 +158,17 @@ const infoMapping: Record<TypeDefInfo, (registry: Registry, value: TypeDef) => C
);
},
[TypeDefInfo.Struct]: (registry: Registry, value: TypeDef): Constructor => Struct.with(getTypeClassMap(value), value.alias),
[TypeDefInfo.Si]: (registry: Registry, value: TypeDef): Constructor =>
getTypeClass(registry, registry.lookup.getTypeDef(value.index as number)),
[TypeDefInfo.Tuple]: (registry: Registry, value: TypeDef): Constructor => Tuple.with(getTypeClassArray(value)),
[TypeDefInfo.Struct]: (registry: Registry, value: TypeDef): Constructor =>
Struct.with(getTypeClassMap(value), value.alias),
[TypeDefInfo.UInt]: (registry: Registry, value: TypeDef): Constructor => createInt(value, UInt),
[TypeDefInfo.Tuple]: (registry: Registry, value: TypeDef): Constructor =>
Tuple.with(getTypeClassArray(value)),
[TypeDefInfo.UInt]: (registry: Registry, value: TypeDef): Constructor =>
createInt(value, UInt),
[TypeDefInfo.Vec]: (registry: Registry, value: TypeDef): Constructor => {
const subType = getSubType(value);
+3 -2
View File
@@ -111,6 +111,7 @@ const encoders: Record<TypeDefInfo, (typeDef: TypeDef) => string> = {
[TypeDefInfo.Plain]: (typeDef: TypeDef): string => typeDef.displayName || typeDef.type,
[TypeDefInfo.Result]: (typeDef: TypeDef): string => encodeWithParams(typeDef, 'Result'),
[TypeDefInfo.Set]: (typeDef: TypeDef): string => typeDef.type,
[TypeDefInfo.Si]: (typeDef: TypeDef): string => typeDef.type,
[TypeDefInfo.Struct]: (typeDef: TypeDef): string => encodeStruct(typeDef),
[TypeDefInfo.Tuple]: (typeDef: TypeDef): string => encodeTuple(typeDef),
[TypeDefInfo.UInt]: (typeDef: TypeDef): string => encodeUInt(typeDef, 'UInt'),
@@ -121,13 +122,13 @@ const encoders: Record<TypeDefInfo, (typeDef: TypeDef) => string> = {
function encodeType (typeDef: TypeDef): string {
const encoder = encoders[typeDef.info];
assert(encoder, () => `Cannot encode type: ${stringify(typeDef)}`);
assert(encoder, () => `Cannot encode type: info=${typeDef.info}, typeDef=${stringify(typeDef)}`);
return encoder(typeDef);
}
export function encodeTypeDef (typeDef: TypeDef): string {
assert(!isUndefined(typeDef.info), () => `Invalid type definition with no instance info, ${stringify(typeDef)}`);
assert(!isUndefined(typeDef.info), () => `Invalid type definition with no instance info, typeDef=${stringify(typeDef)}`);
// In the case of contracts we do have the unfortunate situation where the displayName would
// refer to "Option" when it is an option. For these, string it out, only using when actually
+33 -3
View File
@@ -4,7 +4,7 @@
/* eslint-disable @typescript-eslint/no-var-requires */
import type { ExtDef } from '../extrinsic/signedExtensions/types';
import type { ChainProperties, CodecHash, DispatchErrorModule, Hash } from '../interfaces/types';
import type { ChainProperties, CodecHash, DispatchErrorModule, Hash, MetadataLatest, PortableRegistry, SiLookupTypeId } from '../interfaces/types';
import type { CallFunction, Codec, CodecHasher, Constructor, InterfaceTypes, RegisteredTypes, Registry, RegistryError, RegistryTypes } from '../types';
import { assert, assertReturn, BN_ZERO, formatBalance, isFunction, isString, isU8a, logger, stringCamelCase, stringify, u8aToHex } from '@polkadot/util';
@@ -34,11 +34,11 @@ function injectErrors (_: Registry, metadata: Metadata, metadataErrors: Record<s
const sectionIndex = metadata.version >= 12 ? section.index.toNumber() : _sectionIndex;
const sectionName = stringCamelCase(section.name);
section.errors.forEach(({ documentation, name }, index): void => {
section.errors.forEach(({ docs, name }, index): void => {
const eventIndex = new Uint8Array([sectionIndex, index]);
metadataErrors[u8aToHex(eventIndex)] = {
documentation: documentation.map((d) => d.toString()),
docs: docs.map((d) => d.toString()),
index,
method: name.toString(),
name: name.toString(),
@@ -114,6 +114,8 @@ export class TypeRegistry implements Registry {
#definitions = new Map<string, string>();
#metadata?: MetadataLatest;
readonly #metadataCalls: Record<string, CallFunction> = {};
readonly #metadataErrors: Record<string, RegistryError> = {};
@@ -195,10 +197,36 @@ export class TypeRegistry implements Registry {
return [formatBalance.getDefaults().unit];
}
/**
* @description Returns tru if the type is in a Compat format
*/
public isLookupType (value: string): boolean {
return /Lookup\d+$/.test(value);
}
/**
* @description Creates a lookup string from the supplied id
*/
public createLookupType (lookupId: SiLookupTypeId | number): string {
return `Lookup${lookupId.toString()}`;
}
public get knownTypes (): RegisteredTypes {
return this.#knownTypes;
}
public get lookup (): PortableRegistry {
throw new Error('Unimplemented');
// return this.metadata.lookup;
}
public get metadata (): MetadataLatest {
assert(this.#metadata, 'Metadata has not been set on this registry');
return this.#metadata;
}
public get unknownTypes (): string[] {
return [...this.#unknownTypes.keys()];
}
@@ -388,6 +416,8 @@ export class TypeRegistry implements Registry {
// sets the metadata
public setMetadata (metadata: Metadata, signedExtensions?: string[], userExtensions?: ExtDef): void {
this.#metadata = metadata.asLatest;
injectExtrinsics(this, metadata, this.#metadataCalls);
injectErrors(this, metadata, this.#metadataErrors);
injectEvents(this, metadata, this.#metadataEvents);
+1
View File
@@ -26,6 +26,7 @@ export enum TypeDefInfo {
Int,
UInt,
DoNotConstruct,
Si,
// anything not fully supported (keep this as the last entry)
Null
}
+1 -1
View File
@@ -235,7 +235,7 @@ export class GenericCall<A extends AnyTuple = AnyTuple> extends Struct implement
method: call?.method,
section: call?.section,
...(isExpanded && call
? { documentation: call.meta.documentation.map((d) => d.toString()) }
? { docs: call.meta.docs.map((d) => d.toString()) }
: {}
)
};
+1 -1
View File
@@ -156,7 +156,7 @@ export class GenericEvent extends Struct implements IEvent<Codec[]> {
method: this.method,
section: this.section,
...(isExpanded
? { documentation: this.meta.documentation.map((d) => d.toString()) }
? { docs: this.meta.docs.map((d) => d.toString()) }
: {}
),
...super.toHuman(isExpanded)
@@ -0,0 +1,275 @@
// Copyright 2017-2021 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Vec } from '../codec/Vec';
import type { PortableType } from '../interfaces/metadata';
import type { SiField, SiLookupTypeId, SiType, SiTypeDefArray, SiTypeDefCompact, SiTypeDefComposite, SiTypeDefSequence, SiTypeDefTuple, SiTypeDefVariant, SiVariant } from '../interfaces/scaleInfo';
import type { Registry, TypeDef } from '../types';
import { assert, isNumber, isString, stringCamelCase, stringify } from '@polkadot/util';
import { Struct } from '../codec/Struct';
import { getTypeDef } from '../create/getTypeDef';
import { TypeDefInfo } from '../types';
const PRIMITIVE_ALIAS: Record<string, string> = {
Char: 'u32', // Rust char is 4-bytes
Str: 'Text'
};
const INK_PRIMITIVE_ALWAYS = ['AccountId', 'AccountIndex', 'Address', 'Balance'];
export class GenericPortableRegistry extends Struct {
#typeDefs: Record<number, TypeDef> = {};
constructor (registry: Registry, value?: Uint8Array) {
super(registry, {
types: 'Vec<PortableType>'
}, value);
}
/**
* @description The types of the registry
*/
public get types (): Vec<PortableType> {
return this.get('types') as Vec<PortableType>;
}
/**
* @description Finds a specific type in the registry
*/
public getSiType (lookupId: SiLookupTypeId | string | number): SiType {
const found = this.types[this.#getLookupId(lookupId)];
assert(found, () => `PortableRegistry: Unable to find type with lookupId ${lookupId.toString()}`);
return found.type;
}
/**
* @description Lookup the type definition for the index
*/
public getTypeDef (lookupId: SiLookupTypeId | string | number): TypeDef {
const index = this.#getLookupId(lookupId);
if (!this.#typeDefs[index]) {
this.#typeDefs[index] = this.#extract(this.getSiType(lookupId), index);
}
return this.#typeDefs[index];
}
#createSiDef (type: SiLookupTypeId): TypeDef {
return {
info: TypeDefInfo.Si,
type: this.registry.createLookupType(type)
};
}
#getLookupId (lookupId: SiLookupTypeId | string | number): number {
if (isString(lookupId)) {
assert(this.registry.isLookupType(lookupId), () => `PortableRegistry: Expected a lookup string type, found ${lookupId}`);
return parseInt(lookupId.replace('Lookup', ''), 10);
} else if (isNumber(lookupId)) {
return lookupId;
}
return lookupId.toNumber();
}
#extract (type: SiType, lookupIndex: number): TypeDef {
const path = [...type.path];
// We handle ink! here as well, although we still have a different registry there
const isPrimitivePath = !!path.length && (
(
path.length > 2 &&
path[0].eq('ink_env') &&
path[1].eq('types')
) ||
INK_PRIMITIVE_ALWAYS.includes(path[path.length - 1].toString())
);
let typeDef: TypeDef;
try {
if (isPrimitivePath) {
typeDef = this.#extractPrimitivePath(lookupIndex, type);
} else if (type.def.isArray) {
typeDef = this.#extractArray(lookupIndex, type.def.asArray);
} else if (type.def.isCompact) {
typeDef = this.#extractCompact(lookupIndex, type.def.asCompact);
} else if (type.def.isComposite) {
typeDef = this.#extractComposite(lookupIndex, type.def.asComposite);
} else if (type.def.isHistoricMetaCompat) {
typeDef = getTypeDef(type.def.asHistoricMetaCompat);
} else if (type.def.isPrimitive) {
typeDef = this.#extractPrimitive(lookupIndex, type);
} else if (type.def.isSequence) {
typeDef = this.#extractSequence(lookupIndex, type.def.asSequence);
} else if (type.def.isTuple) {
typeDef = this.#extractTuple(lookupIndex, type.def.asTuple);
} else if (type.def.isVariant) {
typeDef = this.#extractVariant(lookupIndex, type, type.def.asVariant);
} else {
throw new Error(`Invalid type at index ${lookupIndex}: No handler for ${type.def.toString()}`);
}
} catch (error) {
throw new Error(`PortableRegistry: Error extracting ${stringify(type)}: ${(error as Error).message}`);
}
const displayName = path.pop()?.toString();
return {
...(displayName
? { displayName }
: {}
),
...(path.length > 1
? { namespace: path.map((s) => s.toString()).join('::') }
: {}
),
...typeDef
};
}
#extractArray (lookupIndex: number, { len: length, type }: SiTypeDefArray): TypeDef {
assert(!length || length.toNumber() <= 256, 'PortableRegistry: Only support for [Type; <length>], where length <= 256');
return {
info: TypeDefInfo.VecFixed,
length: length.toNumber(),
sub: this.#createSiDef(type),
type: this.registry.createLookupType(lookupIndex)
};
}
#extractCompact (lookupIndex: number, { type }: SiTypeDefCompact): TypeDef {
return {
info: TypeDefInfo.Compact,
sub: this.#createSiDef(type),
type: this.registry.createLookupType(lookupIndex)
};
}
#extractComposite (lookupIndex: number, { fields }: SiTypeDefComposite): TypeDef {
return this.#extractFields(lookupIndex, fields);
}
#extractFields (lookupIndex: number, fields: SiField[]): TypeDef {
const [isStruct, isTuple] = fields.reduce(([isAllNamed, isAllUnnamed], { name }) => ([
isAllNamed && name.isSome,
isAllUnnamed && name.isNone
]),
[true, true]);
assert(isTuple || isStruct, 'PortableRegistry: Invalid fields type detected, expected either Tuple or Struct');
if (isTuple) {
if (fields.length === 0) {
return {
info: TypeDefInfo.Null,
type: 'Null'
};
} else if (fields.length === 1) {
return {
...this.#createSiDef(fields[0].type),
...(fields[0].name.isSome
? { name: stringCamelCase(fields[0].name.unwrap()) }
: {}
)
};
}
}
const sub = fields.map(({ name, type }) => ({
...this.#createSiDef(type),
...(name.isSome
? { name: stringCamelCase(name.unwrap()) }
: {}
)
}));
return {
info: isTuple // Tuple check first
? TypeDefInfo.Tuple
: TypeDefInfo.Struct,
sub,
type: `(${sub.map(({ type }) => type).join(',')})`
};
}
#extractPrimitive (lookupIndex: number, type: SiType): TypeDef {
const typeStr = type.def.asPrimitive.type.toString();
return {
info: TypeDefInfo.Plain,
type: PRIMITIVE_ALIAS[typeStr] || typeStr.toLowerCase()
};
}
#extractPrimitivePath (lookupIndex: number, type: SiType): TypeDef {
return {
info: TypeDefInfo.Plain,
type: type.path[type.path.length - 1].toString()
};
}
#extractSequence (lookupIndex: number, { type }: SiTypeDefSequence): TypeDef {
return {
info: TypeDefInfo.Vec,
sub: this.#createSiDef(type),
type: this.registry.createLookupType(lookupIndex)
};
}
#extractTuple (lookupIndex: number, ids: SiTypeDefTuple): TypeDef {
return ids.length === 1
? this.getTypeDef(ids[0])
: {
info: TypeDefInfo.Tuple,
sub: ids.map((type) => this.#createSiDef(type)),
type: this.registry.createLookupType(lookupIndex)
};
}
#extractVariant (lookupIndex: number, { params, path }: SiType, { variants }: SiTypeDefVariant): TypeDef {
const specialVariant = path[0].toString();
return specialVariant === 'Option'
? {
info: TypeDefInfo.Option,
sub: this.#createSiDef(params[0].type.unwrap()),
type: this.registry.createLookupType(lookupIndex)
}
: specialVariant === 'Result'
? {
info: TypeDefInfo.Result,
sub: params.map((p, index) => ({
name: ['Ok', 'Error'][index],
...this.#createSiDef(p.type.unwrap())
})),
type: this.registry.createLookupType(lookupIndex)
}
: {
info: TypeDefInfo.Enum,
sub: this.#extractVariantSub(lookupIndex, variants),
type: this.registry.createLookupType(lookupIndex)
};
}
#extractVariantSub (lookupIndex: number, variants: SiVariant[]): TypeDef[] {
return variants.every(({ fields }) => fields.length === 0)
? variants.map(({ index, name }) => ({
index: index.toNumber(),
info: TypeDefInfo.Plain,
name: name.toString(),
type: 'Null'
}))
: variants.map(({ fields, index, name }) => ({
...this.#extractFields(lookupIndex, fields),
index: index.toNumber(),
name: name.toString()
}));
}
}
+1
View File
@@ -12,4 +12,5 @@ export { GenericConsensusEngineId } from './ConsensusEngineId';
export { GenericEvent, GenericEventData } from './Event';
export { GenericLookupSource } from './LookupSource';
export { GenericMultiAddress, GenericMultiAddress as GenericAddress } from './MultiAddress';
export { GenericPortableRegistry } from './PortableRegistry';
export { GenericVote } from './Vote';
@@ -19,7 +19,7 @@ const layout = {
},
ContractLayoutCell: {
key: 'ContractLayoutKey',
ty: 'SiLookupTypeId'
ty: 'Si0LookupTypeId'
},
ContractLayoutEnum: {
dispatchKey: 'ContractLayoutKey',
@@ -67,7 +67,7 @@ const spec = {
events: 'Vec<ContractEventSpec>',
docs: 'Vec<Text>'
},
ContractDisplayName: 'SiPath',
ContractDisplayName: 'Si0Path',
ContractEventParamSpec: {
name: 'Text',
indexed: 'bool',
@@ -94,7 +94,7 @@ const spec = {
},
ContractSelector: '[u8; 4]',
ContractTypeSpec: {
type: 'SiLookupTypeId',
type: 'Si0LookupTypeId',
displayName: 'ContractDisplayName'
}
};
@@ -110,17 +110,21 @@ export default {
source: 'ContractProjectSource',
contract: 'ContractProjectContract',
// expanded scale registry: RegistryReadOnly
types: 'Vec<SiType>',
// NOTE Previous generation of the Si0Type definition
types: 'Vec<Si0Type>',
// renamed from layout (ignored for now, incomplete)
// storage: 'ContractStorageLayout',
spec: 'ContractContractSpec'
},
ContractProjectContract: {
_alias: {
docs: 'documentation'
},
name: 'Text',
version: 'Text',
authors: 'Vec<Text>',
description: 'Option<Text>',
documentation: 'Option<Text>',
docs: 'Option<Text>',
repository: 'Option<Text>',
homepage: 'Option<Text>',
license: 'Option<Text>'
@@ -2,7 +2,7 @@
/* eslint-disable */
import type { BTreeMap, Bytes, Enum, Option, Raw, Struct, Text, U8aFixed, Vec, bool, u32, u64 } from '@polkadot/types';
import type { SiLookupTypeId, SiPath, SiType } from '@polkadot/types/interfaces/scaleInfo';
import type { Si0LookupTypeId, Si0Path, Si0Type } from '@polkadot/types/interfaces/scaleInfo';
/** @name ContractConstructorSpec */
export interface ContractConstructorSpec extends Struct {
@@ -31,7 +31,7 @@ export interface ContractCryptoHasher extends Enum {
export interface ContractDiscriminant extends u32 {}
/** @name ContractDisplayName */
export interface ContractDisplayName extends SiPath {}
export interface ContractDisplayName extends Si0Path {}
/** @name ContractEventParamSpec */
export interface ContractEventParamSpec extends Struct {
@@ -59,7 +59,7 @@ export interface ContractLayoutArray extends Struct {
/** @name ContractLayoutCell */
export interface ContractLayoutCell extends Struct {
readonly key: ContractLayoutKey;
readonly ty: SiLookupTypeId;
readonly ty: Si0LookupTypeId;
}
/** @name ContractLayoutEnum */
@@ -118,7 +118,7 @@ export interface ContractProject extends Struct {
readonly metadataVersion: Text;
readonly source: ContractProjectSource;
readonly contract: ContractProjectContract;
readonly types: Vec<SiType>;
readonly types: Vec<Si0Type>;
readonly spec: ContractContractSpec;
}
@@ -128,7 +128,7 @@ export interface ContractProjectContract extends Struct {
readonly version: Text;
readonly authors: Vec<Text>;
readonly description: Option<Text>;
readonly documentation: Option<Text>;
readonly docs: Option<Text>;
readonly repository: Option<Text>;
readonly homepage: Option<Text>;
readonly license: Option<Text>;
@@ -161,7 +161,7 @@ export interface ContractStorageLayout extends Enum {
/** @name ContractTypeSpec */
export interface ContractTypeSpec extends Struct {
readonly type: SiLookupTypeId;
readonly type: Si0LookupTypeId;
readonly displayName: ContractDisplayName;
}
@@ -6,307 +6,54 @@
import type { Definitions } from '../../types';
export const AllHashers = {
Blake2_128: null, // eslint-disable-line camelcase
Blake2_256: null, // eslint-disable-line camelcase
Blake2_128Concat: null, // eslint-disable-line camelcase
Twox128: null,
Twox256: null,
Twox64Concat: null,
// new in v11
Identity: null
};
import { AllHashers } from './hashers';
import { v9 } from './v9';
import { v10 } from './v10';
import { v11 } from './v11';
import { v12 } from './v12';
import { v13 } from './v13';
import { v14 } from './v14';
export { AllHashers };
export default {
rpc: {},
types: {
// v9
DoubleMapTypeV9: {
hasher: 'StorageHasherV9',
key1: 'Type',
key2: 'Type',
value: 'Type',
key2Hasher: 'StorageHasherV9'
},
ErrorMetadataV9: {
name: 'Text',
documentation: 'Vec<Text>'
},
EventMetadataV9: {
name: 'Text',
args: 'Vec<Type>',
documentation: 'Vec<Text>'
},
FunctionArgumentMetadataV9: {
name: 'Text',
type: 'Type'
},
FunctionMetadataV9: {
name: 'Text',
args: 'Vec<FunctionArgumentMetadataV9>',
documentation: 'Vec<Text>'
},
MapTypeV9: {
hasher: 'StorageHasherV9',
key: 'Type',
value: 'Type',
linked: 'bool'
},
MetadataV9: {
modules: 'Vec<ModuleMetadataV9>'
},
ModuleConstantMetadataV9: {
name: 'Text',
type: 'Type',
value: 'Bytes',
documentation: 'Vec<Text>'
},
ModuleMetadataV9: {
name: 'Text',
storage: 'Option<StorageMetadataV9>',
calls: 'Option<Vec<FunctionMetadataV9>>',
events: 'Option<Vec<EventMetadataV9>>',
constants: 'Vec<ModuleConstantMetadataV9>',
errors: 'Vec<ErrorMetadataV9>'
},
StorageEntryMetadataV9: {
name: 'Text',
modifier: 'StorageEntryModifierV9',
type: 'StorageEntryTypeV9',
fallback: 'Bytes',
documentation: 'Vec<Text>'
},
StorageEntryModifierV9: {
_enum: ['Optional', 'Default', 'Required']
},
StorageEntryTypeV9: {
_enum: {
Plain: 'Type',
Map: 'MapTypeV9',
DoubleMap: 'DoubleMapTypeV9'
}
},
StorageHasherV9: {
_enum: {
Blake2_128: null, // eslint-disable-line camelcase
Blake2_256: null, // eslint-disable-line camelcase
Twox128: null,
Twox256: null,
Twox64Concat: null
}
},
StorageMetadataV9: {
prefix: 'Text',
items: 'Vec<StorageEntryMetadataV9>'
},
...v9,
...v10,
...v11,
...v12,
...v13,
...v14,
// v10
DoubleMapTypeV10: {
hasher: 'StorageHasherV10',
key1: 'Type',
key2: 'Type',
value: 'Type',
key2Hasher: 'StorageHasherV10'
},
ErrorMetadataV10: 'ErrorMetadataV9',
EventMetadataV10: 'EventMetadataV9',
FunctionArgumentMetadataV10: 'FunctionArgumentMetadataV9',
FunctionMetadataV10: 'FunctionMetadataV9',
MapTypeV10: {
hasher: 'StorageHasherV10',
key: 'Type',
value: 'Type',
linked: 'bool'
},
MetadataV10: {
modules: 'Vec<ModuleMetadataV10>'
},
ModuleConstantMetadataV10: 'ModuleConstantMetadataV9',
ModuleMetadataV10: {
name: 'Text',
storage: 'Option<StorageMetadataV10>',
calls: 'Option<Vec<FunctionMetadataV10>>',
events: 'Option<Vec<EventMetadataV10>>',
constants: 'Vec<ModuleConstantMetadataV10>',
errors: 'Vec<ErrorMetadataV10>'
},
StorageEntryModifierV10: 'StorageEntryModifierV9',
StorageEntryMetadataV10: {
name: 'Text',
modifier: 'StorageEntryModifierV10',
type: 'StorageEntryTypeV10',
fallback: 'Bytes',
documentation: 'Vec<Text>'
},
StorageEntryTypeV10: {
_enum: {
Plain: 'Type',
Map: 'MapTypeV10',
DoubleMap: 'DoubleMapTypeV10'
}
},
StorageMetadataV10: {
prefix: 'Text',
items: 'Vec<StorageEntryMetadataV10>'
},
StorageHasherV10: {
_enum: {
Blake2_128: null, // eslint-disable-line camelcase
Blake2_256: null, // eslint-disable-line camelcase
Blake2_128Concat: null, // eslint-disable-line camelcase
Twox128: null,
Twox256: null,
Twox64Concat: null
}
},
// v11
DoubleMapTypeV11: {
hasher: 'StorageHasherV11',
key1: 'Type',
key2: 'Type',
value: 'Type',
key2Hasher: 'StorageHasherV11'
},
ErrorMetadataV11: 'ErrorMetadataV10',
EventMetadataV11: 'EventMetadataV10',
ExtrinsicMetadataV11: {
version: 'u8',
signedExtensions: 'Vec<Text>'
},
FunctionArgumentMetadataV11: 'FunctionArgumentMetadataV10',
FunctionMetadataV11: 'FunctionMetadataV10',
MapTypeV11: {
hasher: 'StorageHasherV11',
key: 'Type',
value: 'Type',
linked: 'bool'
},
MetadataV11: {
modules: 'Vec<ModuleMetadataV11>',
extrinsic: 'ExtrinsicMetadataV11'
},
ModuleConstantMetadataV11: 'ModuleConstantMetadataV10',
ModuleMetadataV11: {
name: 'Text',
storage: 'Option<StorageMetadataV11>',
calls: 'Option<Vec<FunctionMetadataV11>>',
events: 'Option<Vec<EventMetadataV11>>',
constants: 'Vec<ModuleConstantMetadataV11>',
errors: 'Vec<ErrorMetadataV11>'
},
StorageEntryModifierV11: 'StorageEntryModifierV10',
StorageEntryMetadataV11: {
name: 'Text',
modifier: 'StorageEntryModifierV11',
type: 'StorageEntryTypeV11',
fallback: 'Bytes',
documentation: 'Vec<Text>'
},
StorageEntryTypeV11: {
_enum: {
Plain: 'Type',
Map: 'MapTypeV11',
DoubleMap: 'DoubleMapTypeV11'
}
},
StorageMetadataV11: {
prefix: 'Text',
items: 'Vec<StorageEntryMetadataV11>'
},
StorageHasherV11: {
_enum: AllHashers
},
// v12
DoubleMapTypeV12: 'DoubleMapTypeV11',
ErrorMetadataV12: 'ErrorMetadataV11',
EventMetadataV12: 'EventMetadataV11',
ExtrinsicMetadataV12: 'ExtrinsicMetadataV11',
FunctionArgumentMetadataV12: 'FunctionArgumentMetadataV11',
FunctionMetadataV12: 'FunctionMetadataV11',
MapTypeV12: 'MapTypeV11',
MetadataV12: {
modules: 'Vec<ModuleMetadataV12>',
extrinsic: 'ExtrinsicMetadataV12'
},
ModuleConstantMetadataV12: 'ModuleConstantMetadataV11',
ModuleMetadataV12: {
name: 'Text',
storage: 'Option<StorageMetadataV12>',
calls: 'Option<Vec<FunctionMetadataV12>>',
events: 'Option<Vec<EventMetadataV12>>',
constants: 'Vec<ModuleConstantMetadataV12>',
errors: 'Vec<ErrorMetadataV12>',
index: 'u8'
},
StorageEntryModifierV12: 'StorageEntryModifierV11',
StorageEntryMetadataV12: 'StorageEntryMetadataV11',
StorageEntryTypeV12: 'StorageEntryTypeV11',
StorageMetadataV12: 'StorageMetadataV11',
StorageHasherV12: 'StorageHasherV11',
// v13
DoubleMapTypeV13: 'DoubleMapTypeV12',
ErrorMetadataV13: 'ErrorMetadataV12',
EventMetadataV13: 'EventMetadataV12',
ExtrinsicMetadataV13: 'ExtrinsicMetadataV12',
FunctionArgumentMetadataV13: 'FunctionArgumentMetadataV12',
FunctionMetadataV13: 'FunctionMetadataV12',
MapTypeV13: 'MapTypeV12',
MetadataV13: {
modules: 'Vec<ModuleMetadataV13>',
extrinsic: 'ExtrinsicMetadataV13'
},
ModuleConstantMetadataV13: 'ModuleConstantMetadataV12',
ModuleMetadataV13: {
name: 'Text',
storage: 'Option<StorageMetadataV13>',
calls: 'Option<Vec<FunctionMetadataV13>>',
events: 'Option<Vec<EventMetadataV13>>',
constants: 'Vec<ModuleConstantMetadataV13>',
errors: 'Vec<ErrorMetadataV13>',
index: 'u8'
},
NMapTypeV13: {
keyVec: 'Vec<Type>',
hashers: 'Vec<StorageHasherV13>',
value: 'Type'
},
StorageEntryModifierV13: 'StorageEntryModifierV12',
StorageEntryMetadataV13: {
name: 'Text',
modifier: 'StorageEntryModifierV13',
type: 'StorageEntryTypeV13',
fallback: 'Bytes',
documentation: 'Vec<Text>'
},
StorageEntryTypeV13: {
_enum: {
Plain: 'Type',
Map: 'MapTypeV13',
DoubleMap: 'DoubleMapTypeV13',
NMap: 'NMapTypeV13'
}
},
StorageMetadataV13: {
prefix: 'Text',
items: 'Vec<StorageEntryMetadataV13>'
},
StorageHasherV13: 'StorageHasherV12',
//
// will be available once v14 is the default
// TODO: Comment out all commented stuff below and remove block below
//
// ExtrinsicMetadataLatest: 'ExtrinsicMetadataV14',
// FunctionArgumentMetadataLatest: 'FunctionArgumentMetadataV13',
// FunctionMetadataLatest: 'FunctionMetadataV14',
// MetadataLatest: 'MetadataV14',
PalletCallMetadataLatest: 'PalletCallMetadataV14',
PalletConstantMetadataLatest: 'PalletConstantMetadataV14',
PalletErrorMetadataLatest: 'PalletErrorMetadataV14',
PalletEventMetadataLatest: 'PalletEventMetadataV14',
PalletMetadataLatest: 'PalletMetadataV14',
PalletStorageMetadataLatest: 'PalletStorageMetadataV14',
SignedExtensionMetadataLatest: 'SignedExtensionMetadataV14',
// StorageEntryMetadataLatest: 'StorageEntryMetadataV14',
// StorageEntryModifierLatest: 'StorageEntryModifierV14',
// StorageEntryTypeLatest: 'StorageEntryTypeV14',
// This always maps to the latest
DoubleMapTypeLatest: 'DoubleMapTypeV13',
ErrorMetadataLatest: 'ErrorMetadataV13',
EventMetadataLatest: 'EventMetadataV13',
ExtrinsicMetadataLatest: 'ExtrinsicMetadataV13',
FunctionArgumentMetadataLatest: 'FunctionArgumentMetadataV13',
FunctionMetadataLatest: 'FunctionMetadataV13',
MapTypeLatest: 'MapTypeV13',
MetadataLatest: 'MetadataV13',
ModuleConstantMetadataLatest: 'ModuleConstantMetadataV13',
ModuleMetadataLatest: 'ModuleMetadataV13',
NMapTypeLatest: 'NMapTypeV13',
StorageEntryMetadataLatest: 'StorageEntryMetadataV13',
StorageEntryModifierLatest: 'StorageEntryModifierV13',
StorageEntryTypeLatest: 'StorageEntryTypeV13',
@@ -330,7 +77,8 @@ export default {
V10: 'MetadataV10',
V11: 'MetadataV11',
V12: 'MetadataV12',
V13: 'MetadataV13'
V13: 'MetadataV13',
V14: 'MetadataV14'
}
}
}
@@ -0,0 +1,16 @@
// Copyright 2017-2021 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0
// order important in structs... :)
/* eslint-disable sort-keys */
export const AllHashers = {
Blake2_128: null, // eslint-disable-line camelcase
Blake2_256: null, // eslint-disable-line camelcase
Blake2_128Concat: null, // eslint-disable-line camelcase
Twox128: null,
Twox256: null,
Twox64Concat: null,
// new in v11
Identity: null
};
+136 -94
View File
@@ -1,43 +1,8 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable */
import type { Bytes, Enum, Option, Struct, Text, Type, Vec, bool, u8 } from '@polkadot/types';
/** @name DoubleMapTypeLatest */
export interface DoubleMapTypeLatest extends DoubleMapTypeV13 {}
/** @name DoubleMapTypeV10 */
export interface DoubleMapTypeV10 extends Struct {
readonly hasher: StorageHasherV10;
readonly key1: Type;
readonly key2: Type;
readonly value: Type;
readonly key2Hasher: StorageHasherV10;
}
/** @name DoubleMapTypeV11 */
export interface DoubleMapTypeV11 extends Struct {
readonly hasher: StorageHasherV11;
readonly key1: Type;
readonly key2: Type;
readonly value: Type;
readonly key2Hasher: StorageHasherV11;
}
/** @name DoubleMapTypeV12 */
export interface DoubleMapTypeV12 extends DoubleMapTypeV11 {}
/** @name DoubleMapTypeV13 */
export interface DoubleMapTypeV13 extends DoubleMapTypeV12 {}
/** @name DoubleMapTypeV9 */
export interface DoubleMapTypeV9 extends Struct {
readonly hasher: StorageHasherV9;
readonly key1: Type;
readonly key2: Type;
readonly value: Type;
readonly key2Hasher: StorageHasherV9;
}
import type { Bytes, Enum, GenericPortableRegistry, Option, Struct, Text, Type, Vec, bool, u8 } from '@polkadot/types';
import type { SiLookupTypeId, SiType } from '@polkadot/types/interfaces/scaleInfo';
/** @name ErrorMetadataLatest */
export interface ErrorMetadataLatest extends ErrorMetadataV13 {}
@@ -57,7 +22,7 @@ export interface ErrorMetadataV13 extends ErrorMetadataV12 {}
/** @name ErrorMetadataV9 */
export interface ErrorMetadataV9 extends Struct {
readonly name: Text;
readonly documentation: Vec<Text>;
readonly docs: Vec<Text>;
}
/** @name EventMetadataLatest */
@@ -79,7 +44,7 @@ export interface EventMetadataV13 extends EventMetadataV12 {}
export interface EventMetadataV9 extends Struct {
readonly name: Text;
readonly args: Vec<Type>;
readonly documentation: Vec<Text>;
readonly docs: Vec<Text>;
}
/** @name ExtrinsicMetadataLatest */
@@ -97,6 +62,13 @@ export interface ExtrinsicMetadataV12 extends ExtrinsicMetadataV11 {}
/** @name ExtrinsicMetadataV13 */
export interface ExtrinsicMetadataV13 extends ExtrinsicMetadataV12 {}
/** @name ExtrinsicMetadataV14 */
export interface ExtrinsicMetadataV14 extends Struct {
readonly type: SiLookupTypeId;
readonly version: u8;
readonly signedExtensions: Vec<SignedExtensionMetadataV14>;
}
/** @name FunctionArgumentMetadataLatest */
export interface FunctionArgumentMetadataLatest extends FunctionArgumentMetadataV13 {}
@@ -137,40 +109,7 @@ export interface FunctionMetadataV13 extends FunctionMetadataV12 {}
export interface FunctionMetadataV9 extends Struct {
readonly name: Text;
readonly args: Vec<FunctionArgumentMetadataV9>;
readonly documentation: Vec<Text>;
}
/** @name MapTypeLatest */
export interface MapTypeLatest extends MapTypeV13 {}
/** @name MapTypeV10 */
export interface MapTypeV10 extends Struct {
readonly hasher: StorageHasherV10;
readonly key: Type;
readonly value: Type;
readonly linked: bool;
}
/** @name MapTypeV11 */
export interface MapTypeV11 extends Struct {
readonly hasher: StorageHasherV11;
readonly key: Type;
readonly value: Type;
readonly linked: bool;
}
/** @name MapTypeV12 */
export interface MapTypeV12 extends MapTypeV11 {}
/** @name MapTypeV13 */
export interface MapTypeV13 extends MapTypeV12 {}
/** @name MapTypeV9 */
export interface MapTypeV9 extends Struct {
readonly hasher: StorageHasherV9;
readonly key: Type;
readonly value: Type;
readonly linked: bool;
readonly docs: Vec<Text>;
}
/** @name MetadataAll */
@@ -185,6 +124,8 @@ export interface MetadataAll extends Enum {
readonly asV12: MetadataV12;
readonly isV13: boolean;
readonly asV13: MetadataV13;
readonly isV14: boolean;
readonly asV14: MetadataV14;
}
/** @name MetadataLatest */
@@ -213,6 +154,13 @@ export interface MetadataV13 extends Struct {
readonly extrinsic: ExtrinsicMetadataV13;
}
/** @name MetadataV14 */
export interface MetadataV14 extends Struct {
readonly lookup: PortableRegistry;
readonly pallets: Vec<PalletMetadataV14>;
readonly extrinsic: ExtrinsicMetadataV14;
}
/** @name MetadataV9 */
export interface MetadataV9 extends Struct {
readonly modules: Vec<ModuleMetadataV9>;
@@ -238,7 +186,7 @@ export interface ModuleConstantMetadataV9 extends Struct {
readonly name: Text;
readonly type: Type;
readonly value: Bytes;
readonly documentation: Vec<Text>;
readonly docs: Vec<Text>;
}
/** @name ModuleMetadataLatest */
@@ -296,14 +244,81 @@ export interface ModuleMetadataV9 extends Struct {
readonly errors: Vec<ErrorMetadataV9>;
}
/** @name NMapTypeLatest */
export interface NMapTypeLatest extends NMapTypeV13 {}
/** @name PalletCallMetadataLatest */
export interface PalletCallMetadataLatest extends PalletCallMetadataV14 {}
/** @name NMapTypeV13 */
export interface NMapTypeV13 extends Struct {
readonly keyVec: Vec<Type>;
readonly hashers: Vec<StorageHasherV13>;
readonly value: Type;
/** @name PalletCallMetadataV14 */
export interface PalletCallMetadataV14 extends Struct {
readonly type: SiLookupTypeId;
}
/** @name PalletConstantMetadataLatest */
export interface PalletConstantMetadataLatest extends PalletConstantMetadataV14 {}
/** @name PalletConstantMetadataV14 */
export interface PalletConstantMetadataV14 extends Struct {
readonly name: Text;
readonly type: SiLookupTypeId;
readonly value: Bytes;
readonly docs: Vec<Text>;
}
/** @name PalletErrorMetadataLatest */
export interface PalletErrorMetadataLatest extends PalletErrorMetadataV14 {}
/** @name PalletErrorMetadataV14 */
export interface PalletErrorMetadataV14 extends Struct {
readonly type: SiLookupTypeId;
}
/** @name PalletEventMetadataLatest */
export interface PalletEventMetadataLatest extends PalletEventMetadataV14 {}
/** @name PalletEventMetadataV14 */
export interface PalletEventMetadataV14 extends Struct {
readonly type: SiLookupTypeId;
}
/** @name PalletMetadataLatest */
export interface PalletMetadataLatest extends PalletMetadataV14 {}
/** @name PalletMetadataV14 */
export interface PalletMetadataV14 extends Struct {
readonly name: Text;
readonly storage: Option<PalletStorageMetadataV14>;
readonly calls: Option<PalletCallMetadataV14>;
readonly events: Option<PalletEventMetadataV14>;
readonly constants: Vec<PalletConstantMetadataV14>;
readonly errors: Option<PalletErrorMetadataV14>;
readonly index: u8;
}
/** @name PalletStorageMetadataLatest */
export interface PalletStorageMetadataLatest extends PalletStorageMetadataV14 {}
/** @name PalletStorageMetadataV14 */
export interface PalletStorageMetadataV14 extends Struct {
readonly prefix: Text;
readonly items: Vec<StorageEntryMetadataV14>;
}
/** @name PortableRegistry */
export interface PortableRegistry extends GenericPortableRegistry {}
/** @name PortableType */
export interface PortableType extends Struct {
readonly id: SiLookupTypeId;
readonly type: SiType;
}
/** @name SignedExtensionMetadataLatest */
export interface SignedExtensionMetadataLatest extends SignedExtensionMetadataV14 {}
/** @name SignedExtensionMetadataV14 */
export interface SignedExtensionMetadataV14 extends Struct {
readonly identifier: Text;
readonly type: SiLookupTypeId;
readonly additionalSigned: SiLookupTypeId;
}
/** @name StorageEntryMetadataLatest */
@@ -315,7 +330,7 @@ export interface StorageEntryMetadataV10 extends Struct {
readonly modifier: StorageEntryModifierV10;
readonly type: StorageEntryTypeV10;
readonly fallback: Bytes;
readonly documentation: Vec<Text>;
readonly docs: Vec<Text>;
}
/** @name StorageEntryMetadataV11 */
@@ -324,7 +339,7 @@ export interface StorageEntryMetadataV11 extends Struct {
readonly modifier: StorageEntryModifierV11;
readonly type: StorageEntryTypeV11;
readonly fallback: Bytes;
readonly documentation: Vec<Text>;
readonly docs: Vec<Text>;
}
/** @name StorageEntryMetadataV12 */
@@ -336,7 +351,16 @@ export interface StorageEntryMetadataV13 extends Struct {
readonly modifier: StorageEntryModifierV13;
readonly type: StorageEntryTypeV13;
readonly fallback: Bytes;
readonly documentation: Vec<Text>;
readonly docs: Vec<Text>;
}
/** @name StorageEntryMetadataV14 */
export interface StorageEntryMetadataV14 extends Struct {
readonly name: Text;
readonly modifier: StorageEntryModifierV14;
readonly type: StorageEntryTypeV14;
readonly fallback: Bytes;
readonly docs: Vec<Text>;
}
/** @name StorageEntryMetadataV9 */
@@ -345,7 +369,7 @@ export interface StorageEntryMetadataV9 extends Struct {
readonly modifier: StorageEntryModifierV9;
readonly type: StorageEntryTypeV9;
readonly fallback: Bytes;
readonly documentation: Vec<Text>;
readonly docs: Vec<Text>;
}
/** @name StorageEntryModifierLatest */
@@ -363,6 +387,9 @@ export interface StorageEntryModifierV12 extends StorageEntryModifierV11 {}
/** @name StorageEntryModifierV13 */
export interface StorageEntryModifierV13 extends StorageEntryModifierV12 {}
/** @name StorageEntryModifierV14 */
export interface StorageEntryModifierV14 extends StorageEntryModifierV13 {}
/** @name StorageEntryModifierV9 */
export interface StorageEntryModifierV9 extends Enum {
readonly isOptional: boolean;
@@ -378,9 +405,9 @@ export interface StorageEntryTypeV10 extends Enum {
readonly isPlain: boolean;
readonly asPlain: Type;
readonly isMap: boolean;
readonly asMap: MapTypeV10;
readonly asMap: { hasher: StorageHasherV10; key: Type; value: Type; linked: bool; } & Struct;
readonly isDoubleMap: boolean;
readonly asDoubleMap: DoubleMapTypeV10;
readonly asDoubleMap: { hasher: StorageHasherV10; key1: Type; key2: Type; value: Type; key2Hasher: StorageHasherV10; } & Struct;
}
/** @name StorageEntryTypeV11 */
@@ -388,9 +415,9 @@ export interface StorageEntryTypeV11 extends Enum {
readonly isPlain: boolean;
readonly asPlain: Type;
readonly isMap: boolean;
readonly asMap: MapTypeV11;
readonly asMap: { hasher: StorageHasherV11; key: Type; value: Type; linked: bool; } & Struct;
readonly isDoubleMap: boolean;
readonly asDoubleMap: DoubleMapTypeV11;
readonly asDoubleMap: { hasher: StorageHasherV11; key1: Type; key2: Type; value: Type; key2Hasher: StorageHasherV11; } & Struct;
}
/** @name StorageEntryTypeV12 */
@@ -401,11 +428,23 @@ export interface StorageEntryTypeV13 extends Enum {
readonly isPlain: boolean;
readonly asPlain: Type;
readonly isMap: boolean;
readonly asMap: MapTypeV13;
readonly asMap: { hasher: StorageHasherV13; key: Type; value: Type; linked: bool; } & Struct;
readonly isDoubleMap: boolean;
readonly asDoubleMap: DoubleMapTypeV13;
readonly asDoubleMap: { hasher: StorageHasherV13; key1: Type; key2: Type; value: Type; key2Hasher: StorageHasherV13; } & Struct;
readonly isNMap: boolean;
readonly asNMap: NMapTypeV13;
readonly asNMap: { keyVec: Vec<Type>; hashers: Vec<StorageHasherV13>; value: Type; } & Struct;
}
/** @name StorageEntryTypeV14 */
export interface StorageEntryTypeV14 extends Enum {
readonly isPlain: boolean;
readonly asPlain: SiLookupTypeId;
readonly isMap: boolean;
readonly asMap: { hasher: StorageHasherV14; key: SiLookupTypeId; value: SiLookupTypeId; } & Struct;
readonly isDoubleMap: boolean;
readonly asDoubleMap: { hasher: StorageHasherV14; key1: SiLookupTypeId; key2: SiLookupTypeId; value: SiLookupTypeId; key2Hasher: StorageHasherV14; } & Struct;
readonly isNMap: boolean;
readonly asNMap: { key: SiLookupTypeId; hashers: Vec<StorageHasherV14>; value: SiLookupTypeId; } & Struct;
}
/** @name StorageEntryTypeV9 */
@@ -413,9 +452,9 @@ export interface StorageEntryTypeV9 extends Enum {
readonly isPlain: boolean;
readonly asPlain: Type;
readonly isMap: boolean;
readonly asMap: MapTypeV9;
readonly asMap: { hasher: StorageHasherV9; key: Type; value: Type; linked: bool; } & Struct;
readonly isDoubleMap: boolean;
readonly asDoubleMap: DoubleMapTypeV9;
readonly asDoubleMap: { hasher: StorageHasherV9; key1: Type; key2: Type; value: Type; key2Hasher: StorageHasherV9; } & Struct;
}
/** @name StorageHasher */
@@ -448,6 +487,9 @@ export interface StorageHasherV12 extends StorageHasherV11 {}
/** @name StorageHasherV13 */
export interface StorageHasherV13 extends StorageHasherV12 {}
/** @name StorageHasherV14 */
export interface StorageHasherV14 extends StorageHasherV13 {}
/** @name StorageHasherV9 */
export interface StorageHasherV9 extends Enum {
readonly isBlake2128: boolean;
@@ -0,0 +1,67 @@
// Copyright 2017-2021 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0
// order important in structs... :)
/* eslint-disable sort-keys */
import type { DefinitionsTypes } from '../../types';
export const v10: DefinitionsTypes = {
// v10
ErrorMetadataV10: 'ErrorMetadataV9',
EventMetadataV10: 'EventMetadataV9',
FunctionArgumentMetadataV10: 'FunctionArgumentMetadataV9',
FunctionMetadataV10: 'FunctionMetadataV9',
MetadataV10: {
modules: 'Vec<ModuleMetadataV10>'
},
ModuleConstantMetadataV10: 'ModuleConstantMetadataV9',
ModuleMetadataV10: {
name: 'Text',
storage: 'Option<StorageMetadataV10>',
calls: 'Option<Vec<FunctionMetadataV10>>',
events: 'Option<Vec<EventMetadataV10>>',
constants: 'Vec<ModuleConstantMetadataV10>',
errors: 'Vec<ErrorMetadataV10>'
},
StorageEntryModifierV10: 'StorageEntryModifierV9',
StorageEntryMetadataV10: {
name: 'Text',
modifier: 'StorageEntryModifierV10',
type: 'StorageEntryTypeV10',
fallback: 'Bytes',
docs: 'Vec<Text>'
},
StorageEntryTypeV10: {
_enum: {
Plain: 'Type',
Map: {
hasher: 'StorageHasherV10',
key: 'Type',
value: 'Type',
linked: 'bool'
},
DoubleMap: {
hasher: 'StorageHasherV10',
key1: 'Type',
key2: 'Type',
value: 'Type',
key2Hasher: 'StorageHasherV10'
}
}
},
StorageMetadataV10: {
prefix: 'Text',
items: 'Vec<StorageEntryMetadataV10>'
},
StorageHasherV10: {
_enum: {
Blake2_128: null, // eslint-disable-line camelcase
Blake2_256: null, // eslint-disable-line camelcase
Blake2_128Concat: null, // eslint-disable-line camelcase
Twox128: null,
Twox256: null,
Twox64Concat: null
}
}
};
@@ -0,0 +1,67 @@
// Copyright 2017-2021 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0
// order important in structs... :)
/* eslint-disable sort-keys */
import type { DefinitionsTypes } from '../../types';
import { AllHashers } from './hashers';
export const v11: DefinitionsTypes = {
// v11
ErrorMetadataV11: 'ErrorMetadataV10',
EventMetadataV11: 'EventMetadataV10',
ExtrinsicMetadataV11: {
version: 'u8',
signedExtensions: 'Vec<Text>'
},
FunctionArgumentMetadataV11: 'FunctionArgumentMetadataV10',
FunctionMetadataV11: 'FunctionMetadataV10',
MetadataV11: {
modules: 'Vec<ModuleMetadataV11>',
extrinsic: 'ExtrinsicMetadataV11'
},
ModuleConstantMetadataV11: 'ModuleConstantMetadataV10',
ModuleMetadataV11: {
name: 'Text',
storage: 'Option<StorageMetadataV11>',
calls: 'Option<Vec<FunctionMetadataV11>>',
events: 'Option<Vec<EventMetadataV11>>',
constants: 'Vec<ModuleConstantMetadataV11>',
errors: 'Vec<ErrorMetadataV11>'
},
StorageEntryModifierV11: 'StorageEntryModifierV10',
StorageEntryMetadataV11: {
name: 'Text',
modifier: 'StorageEntryModifierV11',
type: 'StorageEntryTypeV11',
fallback: 'Bytes',
docs: 'Vec<Text>'
},
StorageEntryTypeV11: {
_enum: {
Plain: 'Type',
Map: {
hasher: 'StorageHasherV11',
key: 'Type',
value: 'Type',
linked: 'bool'
},
DoubleMap: {
hasher: 'StorageHasherV11',
key1: 'Type',
key2: 'Type',
value: 'Type',
key2Hasher: 'StorageHasherV11'
}
}
},
StorageMetadataV11: {
prefix: 'Text',
items: 'Vec<StorageEntryMetadataV11>'
},
StorageHasherV11: {
_enum: AllHashers
}
};
@@ -0,0 +1,35 @@
// Copyright 2017-2021 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0
// order important in structs... :)
/* eslint-disable sort-keys */
import type { DefinitionsTypes } from '../../types';
export const v12: DefinitionsTypes = {
// v12
ErrorMetadataV12: 'ErrorMetadataV11',
EventMetadataV12: 'EventMetadataV11',
ExtrinsicMetadataV12: 'ExtrinsicMetadataV11',
FunctionArgumentMetadataV12: 'FunctionArgumentMetadataV11',
FunctionMetadataV12: 'FunctionMetadataV11',
MetadataV12: {
modules: 'Vec<ModuleMetadataV12>',
extrinsic: 'ExtrinsicMetadataV12'
},
ModuleConstantMetadataV12: 'ModuleConstantMetadataV11',
ModuleMetadataV12: {
name: 'Text',
storage: 'Option<StorageMetadataV12>',
calls: 'Option<Vec<FunctionMetadataV12>>',
events: 'Option<Vec<EventMetadataV12>>',
constants: 'Vec<ModuleConstantMetadataV12>',
errors: 'Vec<ErrorMetadataV12>',
index: 'u8'
},
StorageEntryModifierV12: 'StorageEntryModifierV11',
StorageEntryMetadataV12: 'StorageEntryMetadataV11',
StorageEntryTypeV12: 'StorageEntryTypeV11',
StorageMetadataV12: 'StorageMetadataV11',
StorageHasherV12: 'StorageHasherV11'
};
@@ -0,0 +1,66 @@
// Copyright 2017-2021 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0
// order important in structs... :)
/* eslint-disable sort-keys */
import type { DefinitionsTypes } from '../../types';
export const v13: DefinitionsTypes = {
// v13
ErrorMetadataV13: 'ErrorMetadataV12',
EventMetadataV13: 'EventMetadataV12',
ExtrinsicMetadataV13: 'ExtrinsicMetadataV12',
FunctionArgumentMetadataV13: 'FunctionArgumentMetadataV12',
FunctionMetadataV13: 'FunctionMetadataV12',
MetadataV13: {
modules: 'Vec<ModuleMetadataV13>',
extrinsic: 'ExtrinsicMetadataV13'
},
ModuleConstantMetadataV13: 'ModuleConstantMetadataV12',
ModuleMetadataV13: {
name: 'Text',
storage: 'Option<StorageMetadataV13>',
calls: 'Option<Vec<FunctionMetadataV13>>',
events: 'Option<Vec<EventMetadataV13>>',
constants: 'Vec<ModuleConstantMetadataV13>',
errors: 'Vec<ErrorMetadataV13>',
index: 'u8'
},
StorageEntryModifierV13: 'StorageEntryModifierV12',
StorageEntryMetadataV13: {
name: 'Text',
modifier: 'StorageEntryModifierV13',
type: 'StorageEntryTypeV13',
fallback: 'Bytes',
docs: 'Vec<Text>'
},
StorageEntryTypeV13: {
_enum: {
Plain: 'Type',
Map: {
hasher: 'StorageHasherV13',
key: 'Type',
value: 'Type',
linked: 'bool'
},
DoubleMap: {
hasher: 'StorageHasherV13',
key1: 'Type',
key2: 'Type',
value: 'Type',
key2Hasher: 'StorageHasherV13'
},
NMap: {
keyVec: 'Vec<Type>',
hashers: 'Vec<StorageHasherV13>',
value: 'Type'
}
}
},
StorageMetadataV13: {
prefix: 'Text',
items: 'Vec<StorageEntryMetadataV13>'
},
StorageHasherV13: 'StorageHasherV12'
};
@@ -0,0 +1,94 @@
// Copyright 2017-2021 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0
// order important in structs... :)
/* eslint-disable sort-keys */
import type { DefinitionsTypes } from '../../types';
export const v14: DefinitionsTypes = {
// registry
PortableRegistry: 'GenericPortableRegistry',
PortableType: {
id: 'SiLookupTypeId',
type: 'SiType'
},
// V14
ExtrinsicMetadataV14: {
type: 'SiLookupTypeId',
version: 'u8',
signedExtensions: 'Vec<SignedExtensionMetadataV14>'
},
MetadataV14: {
lookup: 'PortableRegistry',
pallets: 'Vec<PalletMetadataV14>',
extrinsic: 'ExtrinsicMetadataV14'
},
PalletCallMetadataV14: {
type: 'SiLookupTypeId'
},
PalletConstantMetadataV14: {
name: 'Text',
type: 'SiLookupTypeId',
value: 'Bytes',
docs: 'Vec<Text>'
},
PalletErrorMetadataV14: {
type: 'SiLookupTypeId'
},
PalletEventMetadataV14: {
type: 'SiLookupTypeId'
},
PalletMetadataV14: {
name: 'Text',
storage: 'Option<PalletStorageMetadataV14>',
calls: 'Option<PalletCallMetadataV14>',
events: 'Option<PalletEventMetadataV14>',
constants: 'Vec<PalletConstantMetadataV14>',
errors: 'Option<PalletErrorMetadataV14>',
index: 'u8'
},
PalletStorageMetadataV14: {
prefix: 'Text',
// NOTE: Renamed from entries
items: 'Vec<StorageEntryMetadataV14>'
},
SignedExtensionMetadataV14: {
identifier: 'Text',
type: 'SiLookupTypeId',
additionalSigned: 'SiLookupTypeId'
},
StorageEntryMetadataV14: {
name: 'Text',
modifier: 'StorageEntryModifierV14',
type: 'StorageEntryTypeV14',
fallback: 'Bytes',
docs: 'Vec<Text>'
},
StorageEntryModifierV14: 'StorageEntryModifierV13',
StorageEntryTypeV14: {
_enum: {
Plain: 'SiLookupTypeId',
Map: {
hasher: 'StorageHasherV14',
key: 'SiLookupTypeId',
value: 'SiLookupTypeId'
},
DoubleMap: {
hasher: 'StorageHasherV14',
key1: 'SiLookupTypeId',
key2: 'SiLookupTypeId',
value: 'SiLookupTypeId',
key2Hasher: 'StorageHasherV14'
},
NMap: {
// NOTE: Renamed from "keys"
key: 'SiLookupTypeId',
hashers: 'Vec<StorageHasherV14>',
value: 'SiLookupTypeId'
}
}
},
StorageHasherV14: 'StorageHasherV13'
};
@@ -0,0 +1,87 @@
// Copyright 2017-2021 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0
// order important in structs... :)
/* eslint-disable sort-keys */
import type { DefinitionsTypes } from '../../types';
export const v9: DefinitionsTypes = {
// v9
ErrorMetadataV9: {
name: 'Text',
docs: 'Vec<Text>'
},
EventMetadataV9: {
name: 'Text',
args: 'Vec<Type>',
docs: 'Vec<Text>'
},
FunctionArgumentMetadataV9: {
name: 'Text',
type: 'Type'
},
FunctionMetadataV9: {
name: 'Text',
args: 'Vec<FunctionArgumentMetadataV9>',
docs: 'Vec<Text>'
},
MetadataV9: {
modules: 'Vec<ModuleMetadataV9>'
},
ModuleConstantMetadataV9: {
name: 'Text',
type: 'Type',
value: 'Bytes',
docs: 'Vec<Text>'
},
ModuleMetadataV9: {
name: 'Text',
storage: 'Option<StorageMetadataV9>',
calls: 'Option<Vec<FunctionMetadataV9>>',
events: 'Option<Vec<EventMetadataV9>>',
constants: 'Vec<ModuleConstantMetadataV9>',
errors: 'Vec<ErrorMetadataV9>'
},
StorageEntryMetadataV9: {
name: 'Text',
modifier: 'StorageEntryModifierV9',
type: 'StorageEntryTypeV9',
fallback: 'Bytes',
docs: 'Vec<Text>'
},
StorageEntryModifierV9: {
_enum: ['Optional', 'Default', 'Required']
},
StorageEntryTypeV9: {
_enum: {
Plain: 'Type',
Map: {
hasher: 'StorageHasherV9',
key: 'Type',
value: 'Type',
linked: 'bool'
},
DoubleMap: {
hasher: 'StorageHasherV9',
key1: 'Type',
key2: 'Type',
value: 'Type',
key2Hasher: 'StorageHasherV9'
}
}
},
StorageHasherV9: {
_enum: {
Blake2_128: null, // eslint-disable-line camelcase
Blake2_256: null, // eslint-disable-line camelcase
Twox128: null,
Twox256: null,
Twox64Concat: null
}
},
StorageMetadataV9: {
prefix: 'Text',
items: 'Vec<StorageEntryMetadataV9>'
}
};
@@ -296,7 +296,7 @@ export default {
_enum: ['Onboarding', 'Parathread', 'Parachain', 'UpgradingToParachain', 'DowngradingToParathread', 'OutgoingParathread', 'OutgoingParachain']
},
ParaPastCodeMeta: {
upgradeTimes: 'Vec<BlockNumber>',
upgradeTimes: 'Vec<ReplacementTimes>',
lastPruned: 'Option<BlockNumber>'
},
ParaScheduling: {
@@ -318,15 +318,19 @@ export default {
relayParentStorageRoot: 'Hash',
maxPovSize: 'u32'
},
RelayBlockNumber: 'u32',
RelayChainBlockNumber: 'RelayBlockNumber',
RelayHash: 'Hash',
RelayChainHash: 'RelayHash',
QueuedParathread: {
claim: 'ParathreadEntry',
coreOffset: 'u32'
},
RelayBlockNumber: 'u32',
RelayChainBlockNumber: 'RelayBlockNumber',
RelayHash: 'Hash',
RelayChainHash: 'RelayHash',
Remark: '[u8; 32]',
ReplacementTimes: {
expectedAt: 'BlockNumber',
activatedAt: 'BlockNumber'
},
Retriable: {
_enum: {
Never: 'Null',
@@ -454,7 +454,7 @@ export interface ParaLifecycle extends Enum {
/** @name ParaPastCodeMeta */
export interface ParaPastCodeMeta extends Struct {
readonly upgradeTimes: Vec<BlockNumber>;
readonly upgradeTimes: Vec<ReplacementTimes>;
readonly lastPruned: Option<BlockNumber>;
}
@@ -517,6 +517,12 @@ export interface RelayHash extends Hash {}
/** @name Remark */
export interface Remark extends U8aFixed {}
/** @name ReplacementTimes */
export interface ReplacementTimes extends Struct {
readonly expectedAt: BlockNumber;
readonly activatedAt: BlockNumber;
}
/** @name Retriable */
export interface Retriable extends Enum {
readonly isNever: boolean;
@@ -26,7 +26,9 @@ export default {
rpc: {},
types: {
...numberTypes,
AccountId: 'GenericAccountId',
AccountId: 'AccountId32',
AccountId20: 'GenericEthereumAccountId',
AccountId32: 'GenericAccountId',
AccountIdOf: 'AccountId',
AccountIndex: 'GenericAccountIndex',
Address: 'MultiAddress',
@@ -1,14 +1,20 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable */
import type { Bytes, Compact, DoNotConstruct, Enum, GenericAccountId, GenericAccountIndex, GenericBlock, GenericCall, GenericConsensusEngineId, GenericLookupSource, GenericMultiAddress, Int, Null, Option, StorageKey, Struct, U8aFixed, UInt, Vec, u16, u32, u64, u8 } from '@polkadot/types';
import type { Bytes, Compact, DoNotConstruct, Enum, GenericAccountId, GenericAccountIndex, GenericBlock, GenericCall, GenericConsensusEngineId, GenericEthereumAccountId, GenericLookupSource, GenericMultiAddress, Int, Null, Option, StorageKey, Struct, U8aFixed, UInt, Vec, u16, u32, u64, u8 } from '@polkadot/types';
import type { ITuple } from '@polkadot/types/types';
import type { AuthorityId } from '@polkadot/types/interfaces/consensus';
import type { Signature } from '@polkadot/types/interfaces/extrinsics';
import type { SystemOrigin } from '@polkadot/types/interfaces/system';
/** @name AccountId */
export interface AccountId extends GenericAccountId {}
export interface AccountId extends AccountId32 {}
/** @name AccountId20 */
export interface AccountId20 extends GenericEthereumAccountId {}
/** @name AccountId32 */
export interface AccountId32 extends GenericAccountId {}
/** @name AccountIdOf */
export interface AccountIdOf extends AccountId {}
@@ -3,22 +3,28 @@
import type { Definitions } from '../../types';
import { v0 } from './v0';
// order important in structs... :)
/* eslint-disable sort-keys */
export default {
rpc: {},
types: {
...v0,
SiField: {
name: 'Option<Text>',
type: 'SiLookupTypeId'
type: 'SiLookupTypeId',
typeName: 'Option<Text>',
docs: 'Vec<Text>'
},
SiLookupTypeId: 'u32',
SiLookupTypeId: 'Compact<u32>',
SiPath: 'Vec<Text>',
SiType: {
path: 'SiPath',
params: 'Vec<SiLookupTypeId>',
def: 'SiTypeDef'
params: 'Vec<SiTypeParameter>',
def: 'SiTypeDef',
docs: 'Vec<Text>'
},
SiTypeDef: {
_enum: {
@@ -27,11 +33,23 @@ export default {
Sequence: 'SiTypeDefSequence',
Array: 'SiTypeDefArray',
Tuple: 'SiTypeDefTuple',
Primitive: 'SiTypeDefPrimitive'
Primitive: 'SiTypeDefPrimitive',
Compact: 'SiTypeDefCompact',
BitSequence: 'SiTypeDefBitSequence',
// NOTE: This is specific to the implementation for pre-v14 metadata
// compatibility (always keep this as the last entry in the enum)
HistoricMetaCompat: 'Type'
}
},
SiTypeDefArray: {
len: 'u16',
len: 'u32',
type: 'SiLookupTypeId'
},
SiTypeDefBitSequence: {
bitStoreType: 'SiLookupTypeId',
bitOrderType: 'SiLookupTypeId'
},
SiTypeDefCompact: {
type: 'SiLookupTypeId'
},
SiTypeDefComposite: {
@@ -47,10 +65,15 @@ export default {
type: 'SiLookupTypeId'
},
SiTypeDefTuple: 'Vec<SiLookupTypeId>',
SiTypeParameter: {
name: 'Text',
type: 'Option<SiLookupTypeId>'
},
SiVariant: {
name: 'Text',
fields: 'Vec<SiField>',
discriminant: 'Option<u64>'
index: 'u8',
docs: 'Vec<Text>'
}
}
} as Definitions;
@@ -1,16 +1,133 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable */
import type { Enum, Option, Struct, Text, Vec, u16, u32, u64 } from '@polkadot/types';
import type { Compact, Enum, Null, Option, Struct, Text, Type, Vec, u32, u64, u8 } from '@polkadot/types';
/** @name Si0Field */
export interface Si0Field extends Struct {
readonly name: Option<Text>;
readonly type: Si0LookupTypeId;
readonly typeName: Option<Text>;
readonly docs: Vec<Text>;
}
/** @name Si0LookupTypeId */
export interface Si0LookupTypeId extends u32 {}
/** @name Si0Path */
export interface Si0Path extends Vec<Text> {}
/** @name Si0Type */
export interface Si0Type extends Struct {
readonly path: Si0Path;
readonly params: Vec<Si0LookupTypeId>;
readonly def: Si0TypeDef;
}
/** @name Si0TypeDef */
export interface Si0TypeDef extends Enum {
readonly isComposite: boolean;
readonly asComposite: Si0TypeDefComposite;
readonly isVariant: boolean;
readonly asVariant: Si0TypeDefVariant;
readonly isSequence: boolean;
readonly asSequence: Si0TypeDefSequence;
readonly isArray: boolean;
readonly asArray: Si0TypeDefArray;
readonly isTuple: boolean;
readonly asTuple: Si0TypeDefTuple;
readonly isPrimitive: boolean;
readonly asPrimitive: Si0TypeDefPrimitive;
readonly isCompact: boolean;
readonly asCompact: Si0TypeDefCompact;
readonly isPhantom: boolean;
readonly asPhantom: Si0TypeDefPhantom;
readonly isBitSequence: boolean;
readonly asBitSequence: Si0TypeDefBitSequence;
}
/** @name Si0TypeDefArray */
export interface Si0TypeDefArray extends Struct {
readonly len: u32;
readonly type: Si0LookupTypeId;
}
/** @name Si0TypeDefBitSequence */
export interface Si0TypeDefBitSequence extends Struct {
readonly bitStoreType: Si0LookupTypeId;
readonly bitOrderType: Si0LookupTypeId;
}
/** @name Si0TypeDefCompact */
export interface Si0TypeDefCompact extends Struct {
readonly type: Si0LookupTypeId;
}
/** @name Si0TypeDefComposite */
export interface Si0TypeDefComposite extends Struct {
readonly fields: Vec<Si0Field>;
}
/** @name Si0TypeDefPhantom */
export interface Si0TypeDefPhantom extends Null {}
/** @name Si0TypeDefPrimitive */
export interface Si0TypeDefPrimitive extends Enum {
readonly isBool: boolean;
readonly isChar: boolean;
readonly isStr: boolean;
readonly isU8: boolean;
readonly isU16: boolean;
readonly isU32: boolean;
readonly isU64: boolean;
readonly isU128: boolean;
readonly isU256: boolean;
readonly isI8: boolean;
readonly isI16: boolean;
readonly isI32: boolean;
readonly isI64: boolean;
readonly isI128: boolean;
readonly isI256: boolean;
}
/** @name Si0TypeDefSequence */
export interface Si0TypeDefSequence extends Struct {
readonly type: Si0LookupTypeId;
}
/** @name Si0TypeDefTuple */
export interface Si0TypeDefTuple extends Vec<Si0LookupTypeId> {}
/** @name Si0TypeDefVariant */
export interface Si0TypeDefVariant extends Struct {
readonly variants: Vec<Si0Variant>;
}
/** @name Si0TypeParameter */
export interface Si0TypeParameter extends Struct {
readonly name: Text;
readonly type: Option<Si0LookupTypeId>;
}
/** @name Si0Variant */
export interface Si0Variant extends Struct {
readonly name: Text;
readonly fields: Vec<Si0Field>;
readonly index: Option<u8>;
readonly discriminant: Option<u64>;
readonly docs: Vec<Text>;
}
/** @name SiField */
export interface SiField extends Struct {
readonly name: Option<Text>;
readonly type: SiLookupTypeId;
readonly typeName: Option<Text>;
readonly docs: Vec<Text>;
}
/** @name SiLookupTypeId */
export interface SiLookupTypeId extends u32 {}
export interface SiLookupTypeId extends Compact<u32> {}
/** @name SiPath */
export interface SiPath extends Vec<Text> {}
@@ -18,8 +135,9 @@ export interface SiPath extends Vec<Text> {}
/** @name SiType */
export interface SiType extends Struct {
readonly path: SiPath;
readonly params: Vec<SiLookupTypeId>;
readonly params: Vec<SiTypeParameter>;
readonly def: SiTypeDef;
readonly docs: Vec<Text>;
}
/** @name SiTypeDef */
@@ -36,11 +154,28 @@ export interface SiTypeDef extends Enum {
readonly asTuple: SiTypeDefTuple;
readonly isPrimitive: boolean;
readonly asPrimitive: SiTypeDefPrimitive;
readonly isCompact: boolean;
readonly asCompact: SiTypeDefCompact;
readonly isBitSequence: boolean;
readonly asBitSequence: SiTypeDefBitSequence;
readonly isHistoricMetaCompat: boolean;
readonly asHistoricMetaCompat: Type;
}
/** @name SiTypeDefArray */
export interface SiTypeDefArray extends Struct {
readonly len: u16;
readonly len: u32;
readonly type: SiLookupTypeId;
}
/** @name SiTypeDefBitSequence */
export interface SiTypeDefBitSequence extends Struct {
readonly bitStoreType: SiLookupTypeId;
readonly bitOrderType: SiLookupTypeId;
}
/** @name SiTypeDefCompact */
export interface SiTypeDefCompact extends Struct {
readonly type: SiLookupTypeId;
}
@@ -81,11 +216,18 @@ export interface SiTypeDefVariant extends Struct {
readonly variants: Vec<SiVariant>;
}
/** @name SiTypeParameter */
export interface SiTypeParameter extends Struct {
readonly name: Text;
readonly type: Option<SiLookupTypeId>;
}
/** @name SiVariant */
export interface SiVariant extends Struct {
readonly name: Text;
readonly fields: Vec<SiField>;
readonly discriminant: Option<u64>;
readonly index: u8;
readonly docs: Vec<Text>;
}
export type PHANTOM_SCALEINFO = 'scaleInfo';
@@ -0,0 +1,72 @@
// Copyright 2017-2021 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { DefinitionsTypes } from '../../types';
// order important in structs... :)
/* eslint-disable sort-keys */
export const v0: DefinitionsTypes = {
Si0Field: {
name: 'Option<Text>',
type: 'Si0LookupTypeId',
typeName: 'Option<Text>',
docs: 'Vec<Text>'
},
Si0LookupTypeId: 'u32',
Si0Path: 'Vec<Text>',
Si0Type: {
path: 'Si0Path',
params: 'Vec<Si0LookupTypeId>',
def: 'Si0TypeDef'
},
Si0TypeDef: {
_enum: {
Composite: 'Si0TypeDefComposite',
Variant: 'Si0TypeDefVariant',
Sequence: 'Si0TypeDefSequence',
Array: 'Si0TypeDefArray',
Tuple: 'Si0TypeDefTuple',
Primitive: 'Si0TypeDefPrimitive',
Compact: 'Si0TypeDefCompact',
Phantom: 'Si0TypeDefPhantom',
BitSequence: 'Si0TypeDefBitSequence'
}
},
Si0TypeDefArray: {
len: 'u32',
type: 'Si0LookupTypeId'
},
Si0TypeDefBitSequence: {
bitStoreType: 'Si0LookupTypeId',
bitOrderType: 'Si0LookupTypeId'
},
Si0TypeDefCompact: {
type: 'Si0LookupTypeId'
},
Si0TypeDefComposite: {
fields: 'Vec<Si0Field>'
},
Si0TypeDefPhantom: 'Null',
Si0TypeDefVariant: {
variants: 'Vec<Si0Variant>'
},
Si0TypeDefPrimitive: {
_enum: ['Bool', 'Char', 'Str', 'U8', 'U16', 'U32', 'U64', 'U128', 'U256', 'I8', 'I16', 'I32', 'I64', 'I128', 'I256']
},
Si0TypeDefSequence: {
type: 'Si0LookupTypeId'
},
Si0TypeDefTuple: 'Vec<Si0LookupTypeId>',
Si0TypeParameter: {
name: 'Text',
type: 'Option<Si0LookupTypeId>'
},
Si0Variant: {
name: 'Text',
fields: 'Vec<Si0Field>',
index: 'Option<u8>',
discriminant: 'Option<u64>',
docs: 'Vec<Text>'
}
};
@@ -154,7 +154,7 @@ const junction = {
},
AccountKey20Junction: {
network: 'NetworkId',
index: '[u8; 20]'
key: '[u8; 20]'
},
PluralityJunction: {
id: 'BodyId',
+1 -1
View File
@@ -20,7 +20,7 @@ export interface AccountIndex64Junction extends Struct {
/** @name AccountKey20Junction */
export interface AccountKey20Junction extends Struct {
readonly network: NetworkId;
readonly index: U8aFixed;
readonly key: U8aFixed;
}
/** @name AssetInstance */
@@ -78,7 +78,7 @@ function expandWithMeta ({ meta, method, prefix, section }: CreateItemFn, _stora
}
/** @internal */
function extendHeadMeta (registry: Registry, { meta: { documentation, name, type }, section }: CreateItemFn, { method }: StorageEntry, iterFn: (...args: unknown[]) => Raw): (...args: unknown[]) => StorageKey {
function extendHeadMeta (registry: Registry, { meta: { docs, name, type }, section }: CreateItemFn, { method }: StorageEntry, iterFn: (...args: unknown[]) => Raw): (...args: unknown[]) => StorageKey {
const outputType = type.isMap
? type.asMap.key
: type.isDoubleMap
@@ -88,7 +88,7 @@ function extendHeadMeta (registry: Registry, { meta: { documentation, name, type
// 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
(iterFn as IterFn).meta = registry.createType('StorageEntryMetadataLatest', {
documentation,
docs,
fallback: registry.createType('Bytes'),
modifier: registry.createType('StorageEntryModifierLatest', 1), // required
name,
@@ -8,7 +8,7 @@ import type { Registry } from '../../../types';
import { createFunction } from './createFunction';
interface SubstrateMetadata {
documentation: string;
docs: string;
type: string;
}
@@ -16,11 +16,11 @@ type Creator = (registry: Registry) => StorageEntry;
// Small helper function to factorize code on this page.
/** @internal */
function createRuntimeFunction (method: string, key: string, { documentation, type }: SubstrateMetadata): (registry: Registry) => StorageEntry {
function createRuntimeFunction (method: string, key: string, { docs, type }: SubstrateMetadata): (registry: Registry) => StorageEntry {
return (registry: Registry): StorageEntry =>
createFunction(registry, {
meta: {
documentation: registry.createType('Vec<Text>', [documentation]),
docs: registry.createType('Vec<Text>', [docs]),
modifier: registry.createType('StorageEntryModifierLatest', 1), // required
name: registry.createType('Text', method),
toJSON: (): any => key,
@@ -34,23 +34,23 @@ function createRuntimeFunction (method: string, key: string, { documentation, ty
export const substrate: Record<string, Creator> = {
changesTrieConfig: createRuntimeFunction('changesTrieConfig', ':changes_trie', {
documentation: ' Changes trie configuration is stored under this key.',
docs: ' Changes trie configuration is stored under this key.',
type: 'u32'
}),
childStorageKeyPrefix: createRuntimeFunction('childStorageKeyPrefix', ':child_storage:', {
documentation: ' Prefix of child storage keys.',
docs: ' Prefix of child storage keys.',
type: 'u32'
}),
code: createRuntimeFunction('code', ':code', {
documentation: ' Wasm code of the runtime.',
docs: ' Wasm code of the runtime.',
type: 'Bytes'
}),
extrinsicIndex: createRuntimeFunction('extrinsicIndex', ':extrinsic_index', {
documentation: ' Current extrinsic index (u32) is stored under this key.',
docs: ' Current extrinsic index (u32) is stored under this key.',
type: 'u32'
}),
heapPages: createRuntimeFunction('heapPages', ':heappages', {
documentation: ' Number of wasm linear memory pages required for execution of the runtime.',
docs: ' Number of wasm linear memory pages required for execution of the runtime.',
type: 'u64'
})
};
@@ -13,8 +13,8 @@ interface ModuleMetadataTrimmed {
name: Text;
}
function trimDocs (documentation: Vec<Text>): string[] {
const strings = documentation.map((doc) => doc.toString().trim());
function trimDocs (docs: Vec<Text>): string[] {
const strings = docs.map((doc) => doc.toString().trim());
const firstEmpty = strings.findIndex((doc) => !doc.length);
return firstEmpty === -1
@@ -28,10 +28,10 @@ function mapCalls (registry: Registry, _calls: Option<Vec<FunctionMetadataLatest
return registry.createType(
'Option<Vec<FunctionMetadataLatest>>' as any,
calls
? calls.map(({ args, documentation, name }) =>
? calls.map(({ args, docs, name }) =>
registry.createType('FunctionMetadataLatest', {
args,
documentation: trimDocs(documentation),
docs: trimDocs(docs),
name
})
)
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,47 @@
// Copyright 2017-2021 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { MetadataAll } from '../../interfaces/metadata';
import { TypeRegistry } from '../../create';
import { Metadata } from '../Metadata';
import substrateData from './static';
import substrateJson from './static-substrate.json';
import substrateTypes from './static-types.json';
describe('MetadataV14 (substrate)', (): void => {
// FIXME This is to be replaced with the proper version (here as a stop-gap)
it('parses', (): void => {
const registry = new TypeRegistry();
const metadata = new Metadata(registry, substrateData);
const all = metadata.get('metadata') as MetadataAll;
const v14 = all.asV14;
const jsonStruct = v14.toJSON();
const jsonTypes = v14.lookup.types.toJSON();
delete (jsonStruct as Record<string, unknown>).lookup;
const allJson = {
magicNumber: 1635018093,
metadata: {
v14: jsonStruct
}
};
try {
expect(allJson).toEqual(substrateJson);
} catch (error) {
console.error(JSON.stringify(allJson));
throw error;
}
try {
expect(jsonTypes).toEqual(substrateTypes);
} catch (error) {
console.error(JSON.stringify(jsonTypes));
throw error;
}
});
});
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -3,4 +3,4 @@
// Auto-generated by @polkadot/dev, do not edit
export const packageInfo = { name: '@polkadot/types', version: '5.0.1' };
export const packageInfo = { name: '@polkadot/types', version: '5.1.1' };
+8 -1
View File
@@ -4,7 +4,9 @@
import type { Observable } from 'rxjs';
import type { BN } from '@polkadot/util';
import type { ExtDef } from '../extrinsic/signedExtensions/types';
import type { MetadataLatest, PortableRegistry } from '../interfaces/metadata';
import type { CodecHash, Hash } from '../interfaces/runtime';
import type { SiLookupTypeId } from '../interfaces/scaleInfo';
import type { ChainProperties } from '../interfaces/system';
import type { Metadata } from '../metadata';
import type { CallFunction } from './calls';
@@ -33,7 +35,7 @@ export type RegistryTypes =
{ _set: Record<string, number> }>;
export interface RegistryError {
documentation: string[];
docs: string[];
index: number;
// compat
method: string;
@@ -100,6 +102,8 @@ export interface Registry {
readonly chainSS58: number | undefined;
readonly chainTokens: string[];
readonly knownTypes: RegisteredTypes;
readonly lookup: PortableRegistry;
readonly metadata: MetadataLatest;
readonly unknownTypes: string[];
readonly signedExtensions: string[];
@@ -111,6 +115,9 @@ export interface Registry {
// keep this as a generic Codec, however the actual impl. returns the correct
findMetaEvent (eventIndex: Uint8Array): Constructor<any>;
isLookupType (value: string): boolean;
createLookupType (lookupId: SiLookupTypeId | number): string;
createClass <K extends keyof InterfaceTypes> (type: K): Constructor<InterfaceTypes[K]>;
createType <K extends keyof InterfaceTypes> (type: K, ...params: unknown[]): InterfaceTypes[K];
get <T extends Codec = Codec> (name: string, withUnknown?: boolean): Constructor<T> | undefined;
+100 -100
View File
@@ -1867,42 +1867,42 @@ __metadata:
resolution: "@polkadot/api-contract@workspace:packages/api-contract"
dependencies:
"@babel/runtime": ^7.14.6
"@polkadot/api": 5.0.1
"@polkadot/types": 5.0.1
"@polkadot/util": ^7.0.1
"@polkadot/api": 5.1.1
"@polkadot/types": 5.1.1
"@polkadot/util": ^7.0.2
rxjs: ^7.2.0
languageName: unknown
linkType: soft
"@polkadot/api-derive@5.0.1, @polkadot/api-derive@workspace:packages/api-derive":
"@polkadot/api-derive@5.1.1, @polkadot/api-derive@workspace:packages/api-derive":
version: 0.0.0-use.local
resolution: "@polkadot/api-derive@workspace:packages/api-derive"
dependencies:
"@babel/runtime": ^7.14.6
"@polkadot/api": 5.0.1
"@polkadot/keyring": ^7.0.1
"@polkadot/rpc-core": 5.0.1
"@polkadot/rpc-provider": 5.0.1
"@polkadot/types": 5.0.1
"@polkadot/util": ^7.0.1
"@polkadot/util-crypto": ^7.0.1
"@polkadot/api": 5.1.1
"@polkadot/keyring": ^7.0.2
"@polkadot/rpc-core": 5.1.1
"@polkadot/rpc-provider": 5.1.1
"@polkadot/types": 5.1.1
"@polkadot/util": ^7.0.2
"@polkadot/util-crypto": ^7.0.2
rxjs: ^7.2.0
languageName: unknown
linkType: soft
"@polkadot/api@5.0.1, @polkadot/api@workspace:packages/api":
"@polkadot/api@5.1.1, @polkadot/api@workspace:packages/api":
version: 0.0.0-use.local
resolution: "@polkadot/api@workspace:packages/api"
dependencies:
"@babel/runtime": ^7.14.6
"@polkadot/api-derive": 5.0.1
"@polkadot/keyring": ^7.0.1
"@polkadot/rpc-core": 5.0.1
"@polkadot/rpc-provider": 5.0.1
"@polkadot/types": 5.0.1
"@polkadot/types-known": 5.0.1
"@polkadot/util": ^7.0.1
"@polkadot/util-crypto": ^7.0.1
"@polkadot/api-derive": 5.1.1
"@polkadot/keyring": ^7.0.2
"@polkadot/rpc-core": 5.1.1
"@polkadot/rpc-provider": 5.1.1
"@polkadot/types": 5.1.1
"@polkadot/types-known": 5.1.1
"@polkadot/util": ^7.0.2
"@polkadot/util-crypto": ^7.0.2
eventemitter3: ^4.0.7
rxjs: ^7.2.0
languageName: unknown
@@ -2001,54 +2001,54 @@ __metadata:
languageName: node
linkType: hard
"@polkadot/keyring@npm:^7.0.1":
version: 7.0.1
resolution: "@polkadot/keyring@npm:7.0.1"
"@polkadot/keyring@npm:^7.0.2":
version: 7.0.2
resolution: "@polkadot/keyring@npm:7.0.2"
dependencies:
"@babel/runtime": ^7.14.6
"@polkadot/util": 7.0.1
"@polkadot/util-crypto": 7.0.1
"@polkadot/util": 7.0.2
"@polkadot/util-crypto": 7.0.2
peerDependencies:
"@polkadot/util": 7.0.1
"@polkadot/util-crypto": 7.0.1
checksum: 84e18c48823087df1347edae92080fb19dc83ef53f2559c9529faaa5e89f9af6cd7df7e762826b23f88e0a39f34f47dbd9cd0ac43c8299c59201313608bf8a4c
"@polkadot/util": 7.0.2
"@polkadot/util-crypto": 7.0.2
checksum: f963ca2f474f95f9abacf255b22f95bd188f30e4b288d0703b484e6abc54d76b3244f9a9170af763be04a04fc8198ad1481c22a00e14a1dea449847a8360bd43
languageName: node
linkType: hard
"@polkadot/networks@npm:7.0.1, @polkadot/networks@npm:^7.0.1":
version: 7.0.1
resolution: "@polkadot/networks@npm:7.0.1"
"@polkadot/networks@npm:7.0.2, @polkadot/networks@npm:^7.0.2":
version: 7.0.2
resolution: "@polkadot/networks@npm:7.0.2"
dependencies:
"@babel/runtime": ^7.14.6
checksum: 85af50564e31ba181c4f1851c938fad148627df99651c966352359a95e85b8e0d7f41d9775ad4f056c81e7a455f011fb70b2e2130f45836851d5018b85bb8bd4
checksum: c12b99d537523ac57fdfedaf1ecd759d74cd74b4bde121efb6917079b8ad33138799f8f083af602b523ef6473170667c40a80fc035499d9704e9ea8b495d9935
languageName: node
linkType: hard
"@polkadot/rpc-core@5.0.1, @polkadot/rpc-core@workspace:packages/rpc-core":
"@polkadot/rpc-core@5.1.1, @polkadot/rpc-core@workspace:packages/rpc-core":
version: 0.0.0-use.local
resolution: "@polkadot/rpc-core@workspace:packages/rpc-core"
dependencies:
"@babel/runtime": ^7.14.6
"@polkadot/keyring": ^7.0.1
"@polkadot/rpc-provider": 5.0.1
"@polkadot/types": 5.0.1
"@polkadot/util": ^7.0.1
"@polkadot/keyring": ^7.0.2
"@polkadot/rpc-provider": 5.1.1
"@polkadot/types": 5.1.1
"@polkadot/util": ^7.0.2
rxjs: ^7.2.0
languageName: unknown
linkType: soft
"@polkadot/rpc-provider@5.0.1, @polkadot/rpc-provider@workspace:packages/rpc-provider":
"@polkadot/rpc-provider@5.1.1, @polkadot/rpc-provider@workspace:packages/rpc-provider":
version: 0.0.0-use.local
resolution: "@polkadot/rpc-provider@workspace:packages/rpc-provider"
dependencies:
"@babel/runtime": ^7.14.6
"@polkadot/keyring": ^7.0.1
"@polkadot/types": 5.0.1
"@polkadot/util": ^7.0.1
"@polkadot/util-crypto": ^7.0.1
"@polkadot/x-fetch": ^7.0.1
"@polkadot/x-global": ^7.0.1
"@polkadot/x-ws": ^7.0.1
"@polkadot/keyring": ^7.0.2
"@polkadot/types": 5.1.1
"@polkadot/util": ^7.0.2
"@polkadot/util-crypto": ^7.0.2
"@polkadot/x-fetch": ^7.0.2
"@polkadot/x-global": ^7.0.2
"@polkadot/x-ws": ^7.0.2
eventemitter3: ^4.0.7
mock-socket: ^9.0.3
nock: ^13.1.1
@@ -2071,10 +2071,10 @@ __metadata:
"@babel/core": ^7.14.6
"@babel/register": ^7.14.5
"@babel/runtime": ^7.14.6
"@polkadot/api": 5.0.1
"@polkadot/rpc-provider": 5.0.1
"@polkadot/types": 5.0.1
"@polkadot/util": ^7.0.1
"@polkadot/api": 5.1.1
"@polkadot/rpc-provider": 5.1.1
"@polkadot/types": 5.1.1
"@polkadot/util": ^7.0.2
"@types/websocket": ^1.0.3
"@types/yargs": ^17.0.2
handlebars: ^4.7.7
@@ -2089,40 +2089,40 @@ __metadata:
languageName: unknown
linkType: soft
"@polkadot/types-known@5.0.1, @polkadot/types-known@workspace:packages/types-known":
"@polkadot/types-known@5.1.1, @polkadot/types-known@workspace:packages/types-known":
version: 0.0.0-use.local
resolution: "@polkadot/types-known@workspace:packages/types-known"
dependencies:
"@babel/runtime": ^7.14.6
"@polkadot/networks": ^7.0.1
"@polkadot/types": 5.0.1
"@polkadot/util": ^7.0.1
"@polkadot/networks": ^7.0.2
"@polkadot/types": 5.1.1
"@polkadot/util": ^7.0.2
languageName: unknown
linkType: soft
"@polkadot/types@5.0.1, @polkadot/types@workspace:packages/types":
"@polkadot/types@5.1.1, @polkadot/types@workspace:packages/types":
version: 0.0.0-use.local
resolution: "@polkadot/types@workspace:packages/types"
dependencies:
"@babel/runtime": ^7.14.6
"@polkadot/keyring": ^7.0.1
"@polkadot/util": ^7.0.1
"@polkadot/util-crypto": ^7.0.1
"@polkadot/keyring": ^7.0.2
"@polkadot/util": ^7.0.2
"@polkadot/util-crypto": ^7.0.2
"@types/bn.js": ^4.11.6
bn.js: ^4.11.9
rxjs: ^7.2.0
languageName: unknown
linkType: soft
"@polkadot/util-crypto@npm:7.0.1, @polkadot/util-crypto@npm:^7.0.1":
version: 7.0.1
resolution: "@polkadot/util-crypto@npm:7.0.1"
"@polkadot/util-crypto@npm:7.0.2, @polkadot/util-crypto@npm:^7.0.2":
version: 7.0.2
resolution: "@polkadot/util-crypto@npm:7.0.2"
dependencies:
"@babel/runtime": ^7.14.6
"@polkadot/networks": 7.0.1
"@polkadot/util": 7.0.1
"@polkadot/networks": 7.0.2
"@polkadot/util": 7.0.2
"@polkadot/wasm-crypto": ^4.1.2
"@polkadot/x-randomvalues": 7.0.1
"@polkadot/x-randomvalues": 7.0.2
base-x: ^3.0.8
base64-js: ^1.5.1
blakejs: ^1.1.1
@@ -2135,23 +2135,23 @@ __metadata:
tweetnacl: ^1.0.3
xxhashjs: ^0.2.2
peerDependencies:
"@polkadot/util": 7.0.1
checksum: 177308a3a7a23880e83516eb8e099259fa35b9700d1a8ba2008a6e426d4fe78b0c4f63462e4c158e8e1c0f7969eb00159b4db5acb7cb3bb1a5a9c8740ca55796
"@polkadot/util": 7.0.2
checksum: a5f500f510f9fd5fe5a6b2566453b44ea94f63bb2fd608c7495a54112fea71abf342730b4c6758947f65835d6a3e6731b5975d775108855a48d3a5637129400b
languageName: node
linkType: hard
"@polkadot/util@npm:7.0.1, @polkadot/util@npm:^7.0.1":
version: 7.0.1
resolution: "@polkadot/util@npm:7.0.1"
"@polkadot/util@npm:7.0.2, @polkadot/util@npm:^7.0.2":
version: 7.0.2
resolution: "@polkadot/util@npm:7.0.2"
dependencies:
"@babel/runtime": ^7.14.6
"@polkadot/x-textdecoder": 7.0.1
"@polkadot/x-textencoder": 7.0.1
"@polkadot/x-textdecoder": 7.0.2
"@polkadot/x-textencoder": 7.0.2
"@types/bn.js": ^4.11.6
bn.js: ^4.11.9
camelcase: ^5.3.1
ip-regex: ^4.3.0
checksum: 85dcdf27f492652aa6a720c9925ba5e72b616f3b92260cba61d27b4aecc221207548c47a60b6bc715ce89dfb4ec4a0f30410cb556752326f529ed823ec8cfccb
checksum: 5fea37104aa5712a288cdb10b65f8d1dd4e743c7d9b4b09ce1e17aeea5a4400817f187cf8c9fd7c9b2161ede8c99d5b4dc22418b7f7426527cb12592dad91432
languageName: node
linkType: hard
@@ -2187,66 +2187,66 @@ __metadata:
languageName: node
linkType: hard
"@polkadot/x-fetch@npm:^7.0.1":
version: 7.0.1
resolution: "@polkadot/x-fetch@npm:7.0.1"
"@polkadot/x-fetch@npm:^7.0.2":
version: 7.0.2
resolution: "@polkadot/x-fetch@npm:7.0.2"
dependencies:
"@babel/runtime": ^7.14.6
"@polkadot/x-global": 7.0.1
"@polkadot/x-global": 7.0.2
"@types/node-fetch": ^2.5.11
node-fetch: ^2.6.1
checksum: cd1a53243da5063a1b0fd428e7bb11b9c2a9168079455f64b90189c6ef4738a8150305c2d244cfff8d2b2f7c15cf961d32f2521cf37523013a94dc778743b7a6
checksum: aaef78745959210ffdeae25d0845781c3c7afe12e3bc094a50334051817446ff4397d34b2daac3cefa7f75b60216d8588491fc7418daa9ab9b5e6cd1a99b447d
languageName: node
linkType: hard
"@polkadot/x-global@npm:7.0.1, @polkadot/x-global@npm:^7.0.1":
version: 7.0.1
resolution: "@polkadot/x-global@npm:7.0.1"
"@polkadot/x-global@npm:7.0.2, @polkadot/x-global@npm:^7.0.2":
version: 7.0.2
resolution: "@polkadot/x-global@npm:7.0.2"
dependencies:
"@babel/runtime": ^7.14.6
checksum: 6ea6f2068d0a01535e762fdd9a4202b2eb5d3ab3225ef4ecfe51d3d3728198a66bff6cf64776a6a2a06620379b13761b86b31a23fc68332946c0a991b8cb5f43
checksum: 35705f8d33e746ab872288ae61fd31ead5b2fbefd0ef942f0cf8be76ac3e54a304b3ff9ced960232cb3bca0d71c5515a0abe8e534cc5f2fbcdf543c8df01f1f6
languageName: node
linkType: hard
"@polkadot/x-randomvalues@npm:7.0.1":
version: 7.0.1
resolution: "@polkadot/x-randomvalues@npm:7.0.1"
"@polkadot/x-randomvalues@npm:7.0.2":
version: 7.0.2
resolution: "@polkadot/x-randomvalues@npm:7.0.2"
dependencies:
"@babel/runtime": ^7.14.6
"@polkadot/x-global": 7.0.1
checksum: cc3a5041e40b56c948727643cbf7d05b483272c1740ffad6db773044d55d1ed2ae60f0b996ff6ecd356df3ca2ba6755a23ffa0b66fda582742add33d713c4076
"@polkadot/x-global": 7.0.2
checksum: e6f2fd9f7386ceb6124366580ef639f664b9b3624644e4749ac19e2a17456f84078febb953e293fe5cc8cbed287f1ab84e8d1acfe7d075c5a3fb779253ede082
languageName: node
linkType: hard
"@polkadot/x-textdecoder@npm:7.0.1":
version: 7.0.1
resolution: "@polkadot/x-textdecoder@npm:7.0.1"
"@polkadot/x-textdecoder@npm:7.0.2":
version: 7.0.2
resolution: "@polkadot/x-textdecoder@npm:7.0.2"
dependencies:
"@babel/runtime": ^7.14.6
"@polkadot/x-global": 7.0.1
checksum: b051eea9c1918e175578da30d022074c6890d71d9e45cffcc1d1af99b887a4fc42f7053770f34b7ff5989cd05c4867f50d7a734728cf4bfca05d1c9d31f24ff5
"@polkadot/x-global": 7.0.2
checksum: ad31a9ed430d1886168f42d6b8fc5528c22b783b7c4d086a2c77ac66017af4800c64a80a8466f85e93ea73e5892cebbd1f4612bdd4c7a5ed87227ee9a3f98f5e
languageName: node
linkType: hard
"@polkadot/x-textencoder@npm:7.0.1":
version: 7.0.1
resolution: "@polkadot/x-textencoder@npm:7.0.1"
"@polkadot/x-textencoder@npm:7.0.2":
version: 7.0.2
resolution: "@polkadot/x-textencoder@npm:7.0.2"
dependencies:
"@babel/runtime": ^7.14.6
"@polkadot/x-global": 7.0.1
checksum: 10384f54969bd0690ccbbf0a56dfd93e80dc5126a01bc0fa9ffafca3c64dec17178ec8596b053992ced5465fb6e074a8694fe5d58fd5f50e0ea693b2ed6cd183
"@polkadot/x-global": 7.0.2
checksum: 990ed08a001112a33d7ecbe1c6b442afacb3e09a04b10c62574876e2a2d26d0ee0da31f41a3731ffa91b19799c3828a8f09e0ee883768f608fd499b724774d6e
languageName: node
linkType: hard
"@polkadot/x-ws@npm:^7.0.1":
version: 7.0.1
resolution: "@polkadot/x-ws@npm:7.0.1"
"@polkadot/x-ws@npm:^7.0.2":
version: 7.0.2
resolution: "@polkadot/x-ws@npm:7.0.2"
dependencies:
"@babel/runtime": ^7.14.6
"@polkadot/x-global": 7.0.1
"@polkadot/x-global": 7.0.2
"@types/websocket": ^1.0.3
websocket: ^1.0.34
checksum: de25547a83c9ff212b3254ea4b9a44efda6bc5b2f091c2567b9388d9a7d1d6f0906ce9e335880aa676752dde0dfef22a7c3c4b079c5fa25ddd54e55cbff51ce1
checksum: 7b62fbd7254596aa60d541eb40d973e0ba7d962906596864742698b7bf9c8ad57153db61e213d647b9fad40f59ed01ceb0dbee7bef41970989b16990f0541ea2
languageName: node
linkType: hard