Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b51988193a | ||
|
|
fd31e5a6e5 | ||
|
|
074663cdb7 | ||
|
|
5f5be13c08 | ||
|
|
d60b1818d0 | ||
|
|
9c611e9414 | ||
|
|
da14679b65 | ||
|
|
c88bb99b19 | ||
|
|
fc174738ec | ||
|
|
b43f1a747d | ||
|
|
555b2fb5fe | ||
|
|
1e1ee6eb49 | ||
|
|
7c4c346389 | ||
|
|
beff353b4e | ||
|
|
3172cb55f8 | ||
|
|
ba74ad0be9 | ||
|
|
6ec7687f33 | ||
|
|
bd70b1e6ce | ||
|
|
8744b95c83 | ||
|
|
94e6d8455d | ||
|
|
70d19fcebb | ||
|
|
174ba867d7 | ||
|
|
36b217463a | ||
|
|
412c7525c0 | ||
|
|
172c6f655f | ||
|
|
1e3240c669 | ||
|
|
43e1bf2d4a | ||
|
|
839b2bc342 | ||
|
|
a281e0dc2d | ||
|
|
9a4893130d | ||
|
|
77c45cf4c0 | ||
|
|
ca0969b1eb | ||
|
|
1df8cf9857 | ||
|
|
b7f095bcbd | ||
|
|
6cc7242bdf | ||
|
|
48f91ae0da | ||
|
|
4a63026b14 | ||
|
|
a40ce72298 | ||
|
|
f302d8de69 | ||
|
|
fcaebbdbb2 | ||
|
|
9e7037af04 | ||
|
|
68efac60df | ||
|
|
d763f49e8b | ||
|
|
77ffd7c153 | ||
|
|
d1506154bd | ||
|
|
b1254685da | ||
|
|
81a2a2c688 | ||
|
|
1fed997080 | ||
|
|
6e620e3bb3 | ||
|
|
6e4c62ea99 | ||
|
|
8972d2ffe9 | ||
|
|
091d2d30e0 | ||
|
|
ae7ded1767 | ||
|
|
8aa3550354 | ||
|
|
196d3c5995 | ||
|
|
592407d691 | ||
|
|
1e3a1bb51c | ||
|
|
2ca23a85d0 | ||
|
|
1a04b4a72e | ||
|
|
6dfe7c4f56 | ||
|
|
3f9f7bd649 | ||
|
|
e02e1302b2 | ||
|
|
a64dec3487 | ||
|
|
3415fbd121 | ||
|
|
0be1d46be9 | ||
|
|
9309e9f3a1 | ||
|
|
6dd019343d | ||
|
|
20f18c72e5 | ||
|
|
6a31cbe1a2 | ||
|
|
acba636d16 | ||
|
|
6356fe0571 | ||
|
|
3e17824539 | ||
|
|
db9e580f82 | ||
|
|
5ffcba6dd5 | ||
|
|
731846088c | ||
|
|
8b87689489 | ||
|
|
5a299adddc | ||
|
|
99bb6cfe71 | ||
|
|
ad9a8605d7 | ||
|
|
d62bfc55ac | ||
|
|
311740a1a2 | ||
|
|
3285f1f122 | ||
|
|
2a9711a3cb | ||
|
|
3ea7cb47ce | ||
|
|
82fc46881a | ||
|
|
e7758ad54c | ||
|
|
7d3ab4c5c1 | ||
|
|
6c87a6f0af | ||
|
|
fc5e4afe44 | ||
|
|
48ef04b8ca | ||
|
|
1b526fe618 | ||
|
|
8d6bd931f3 | ||
|
|
b317a8eb9b | ||
|
|
8e65545a3c | ||
|
|
4ded189697 | ||
|
|
b503441341 |
@@ -24,3 +24,5 @@
|
||||
4.9.2
|
||||
4.11.2
|
||||
4.16.2
|
||||
|
||||
5.3.2
|
||||
@@ -1,5 +1,69 @@
|
||||
# CHANGELOG
|
||||
|
||||
## 5.3.2 Aug 3, 2021
|
||||
|
||||
Upgrade priority: Low. Recommended for users of bridges.
|
||||
|
||||
Contributed:
|
||||
|
||||
- Add missing bridges types (Thanks to https://github.com/tomusdrw)
|
||||
|
||||
Changes:
|
||||
|
||||
- Align static metadata with latest Substrate
|
||||
|
||||
|
||||
## 5.3.1 Aug 2, 2021
|
||||
|
||||
Upgrade priority: Low. Recommended for users of `api.at(...)` interfaces
|
||||
|
||||
Changes:
|
||||
|
||||
- Check specName & specVersion for historic registries (caters for runtime renames)
|
||||
- Fix circular dependencies in codec utils
|
||||
- Fix `api.at(<blockHash>)` to decorate with the correct storage hash
|
||||
- Adjustments for upcoming metadata v14 in type creation & `PortableRegistry`
|
||||
- Add Kusama 9080 upgrade block
|
||||
- Add v13/v14 static metadata for Polkadot
|
||||
- Align static metadata with latest Substrate
|
||||
|
||||
|
||||
## 5.2.1 Jul 26, 2021
|
||||
|
||||
Upgrade priority: Low. Recommended for users of `BTreeMap` and `BTreeSet`
|
||||
|
||||
Contributed:
|
||||
|
||||
- Perform sorting on `BTree{Map, Set}`, aligning with Substrate (Thanks to https://github.com/Lezek123)
|
||||
|
||||
Changes:
|
||||
|
||||
- Adjust RPC to use `registry.createType` with optionality (required for metadata v14)
|
||||
- Adjust alphabetical sorting for TS type generation
|
||||
- Adjustments for upcoming metadata v14 in type creation & `PortableRegistry`
|
||||
- Provide the capability to convert v13 Metadata to upcoming v14
|
||||
|
||||
|
||||
## 5.1.1 Jul 19, 2021
|
||||
|
||||
Upgrade priority: Low. Recommended for users of XCM with type fixes.
|
||||
|
||||
- **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.
|
||||
|
||||
+4
-4
@@ -26,14 +26,14 @@
|
||||
"test:watch": "polkadot-dev-run-test --watch"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.14.6",
|
||||
"@babel/core": "^7.14.8",
|
||||
"@babel/register": "^7.14.5",
|
||||
"@babel/runtime": "^7.14.6",
|
||||
"@babel/runtime": "^7.14.8",
|
||||
"@polkadot/dev": "^0.62.57",
|
||||
"@polkadot/ts": "^0.4.4",
|
||||
"@polkadot/typegen": "workspace:packages/typegen",
|
||||
"@types/jest": "^26.0.23",
|
||||
"@types/jest": "^26.0.24",
|
||||
"copyfiles": "^2.4.1"
|
||||
},
|
||||
"version": "5.0.1"
|
||||
"version": "5.3.2"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/api-contract",
|
||||
"version": "5.0.1",
|
||||
"version": "5.3.2",
|
||||
"type": "module",
|
||||
"description": "Interfaces for interacting with contracts and contract ABIs",
|
||||
"main": "index.js",
|
||||
@@ -19,10 +19,10 @@
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"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",
|
||||
"@babel/runtime": "^7.14.8",
|
||||
"@polkadot/api": "5.3.2",
|
||||
"@polkadot/types": "5.3.2",
|
||||
"@polkadot/util": "^7.1.1",
|
||||
"rxjs": "^7.2.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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, {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -24,12 +24,13 @@ const PRIMITIVE_ALIAS: Record<string, keyof InterfaceTypes> = {
|
||||
|
||||
const PRIMITIVE_ALWAYS = ['AccountId', 'AccountIndex', 'Address', 'Balance'];
|
||||
|
||||
// TODO Replace usages with PortableRegistry
|
||||
export class MetaRegistry extends TypeRegistry {
|
||||
public readonly metaTypeDefs: TypeDef[] = [];
|
||||
|
||||
public readonly typeOffset;
|
||||
|
||||
#siTypes: SiType[] = [];
|
||||
#siTypes: Si0Type[] = [];
|
||||
|
||||
constructor (metadataVersion: string, chainProperties?: ChainProperties) {
|
||||
super();
|
||||
@@ -44,7 +45,7 @@ export class MetaRegistry extends TypeRegistry {
|
||||
}
|
||||
}
|
||||
|
||||
public setMetaTypes (metaTypes: SiType[]): void {
|
||||
public setMetaTypes (metaTypes: Si0Type[]): void {
|
||||
this.#siTypes = metaTypes;
|
||||
}
|
||||
|
||||
@@ -83,15 +84,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')) ||
|
||||
@@ -119,7 +120,7 @@ export class MetaRegistry extends TypeRegistry {
|
||||
|
||||
const displayName = path.pop()?.toString();
|
||||
|
||||
return withTypeString({
|
||||
return withTypeString(this, {
|
||||
...(displayName
|
||||
? { displayName }
|
||||
: {}
|
||||
@@ -136,7 +137,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 +147,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 +175,7 @@ export class MetaRegistry extends TypeRegistry {
|
||||
};
|
||||
}
|
||||
|
||||
#extractPrimitive = (type: SiType): TypeDef => {
|
||||
#extractPrimitive = (type: Si0Type): TypeDef => {
|
||||
const typeStr = type.def.asPrimitive.type.toString();
|
||||
|
||||
return {
|
||||
@@ -183,14 +184,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 +200,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 +209,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 +232,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 }) => ({
|
||||
...(
|
||||
@@ -243,7 +244,7 @@ export class MetaRegistry extends TypeRegistry {
|
||||
name: name.toString(),
|
||||
type: 'Null'
|
||||
}))
|
||||
: variants.map(({ fields, name }) => withTypeString({
|
||||
: variants.map(({ fields, name }) => withTypeString(this, {
|
||||
...this.#extractFields(fields),
|
||||
name: name.toString()
|
||||
}));
|
||||
|
||||
@@ -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.3.2' };
|
||||
|
||||
@@ -158,12 +158,12 @@
|
||||
"type": "AccountId"
|
||||
}
|
||||
],
|
||||
"type": "(AccountId, AccountId)",
|
||||
"type": "(AccountId,AccountId)",
|
||||
"name": "Occupied"
|
||||
}
|
||||
],
|
||||
"info": 3,
|
||||
"type": "{\"_enum\":{\"Vacant\":\"VacantEntry\",\"Occupied\":\"(AccountId, AccountId)\"}}"
|
||||
"type": "{\"_enum\":{\"Vacant\":\"VacantEntry\",\"Occupied\":\"(AccountId,AccountId)\"}}"
|
||||
},
|
||||
{
|
||||
"info": 10,
|
||||
@@ -181,7 +181,7 @@
|
||||
"type": "AccountId"
|
||||
}
|
||||
],
|
||||
"type": "(AccountId, AccountId)"
|
||||
"type": "(AccountId,AccountId)"
|
||||
},
|
||||
{
|
||||
"info": 6,
|
||||
@@ -198,4 +198,4 @@
|
||||
"info": 5,
|
||||
"type": "Option<AccountId>"
|
||||
}
|
||||
]
|
||||
]
|
||||
|
||||
@@ -206,12 +206,12 @@
|
||||
"type": "AccountId"
|
||||
}
|
||||
],
|
||||
"type": "(AccountId, AccountId)",
|
||||
"type": "(AccountId,AccountId)",
|
||||
"name": "Occupied"
|
||||
}
|
||||
],
|
||||
"info": 3,
|
||||
"type": "{\"_enum\":{\"Vacant\":\"VacantEntry\",\"Occupied\":\"(AccountId, AccountId)\"}}"
|
||||
"type": "{\"_enum\":{\"Vacant\":\"VacantEntry\",\"Occupied\":\"(AccountId,AccountId)\"}}"
|
||||
},
|
||||
{
|
||||
"info": 10,
|
||||
@@ -229,7 +229,7 @@
|
||||
"type": "AccountId"
|
||||
}
|
||||
],
|
||||
"type": "(AccountId, AccountId)"
|
||||
"type": "(AccountId,AccountId)"
|
||||
},
|
||||
{
|
||||
"displayName": "ValueEntry",
|
||||
@@ -427,4 +427,4 @@
|
||||
],
|
||||
"type": "{\"_enum\":[\"NotOwner\",\"NotApproved\",\"TokenExists\",\"TokenNotFound\",\"CannotInsert\",\"CannotRemove\",\"CannotFetchValue\",\"NotAllowed\"]}"
|
||||
}
|
||||
]
|
||||
]
|
||||
|
||||
@@ -63,12 +63,12 @@
|
||||
"type": "AccountId"
|
||||
}
|
||||
],
|
||||
"type": "(u32, AccountId)",
|
||||
"type": "(u32,AccountId)",
|
||||
"name": "Occupied"
|
||||
}
|
||||
],
|
||||
"info": 3,
|
||||
"type": "{\"_enum\":{\"Vacant\":\"VacantEntry\",\"Occupied\":\"(u32, AccountId)\"}}"
|
||||
"type": "{\"_enum\":{\"Vacant\":\"VacantEntry\",\"Occupied\":\"(u32,AccountId)\"}}"
|
||||
},
|
||||
{
|
||||
"info": 10,
|
||||
@@ -84,7 +84,7 @@
|
||||
"type": "AccountId"
|
||||
}
|
||||
],
|
||||
"type": "(u32, AccountId)"
|
||||
"type": "(u32,AccountId)"
|
||||
},
|
||||
{
|
||||
"displayName": "AccountId",
|
||||
@@ -409,7 +409,7 @@
|
||||
"type": "{\"_enum\":{\"Confirmed\":\"()\",\"ConfirmationsNeeded\":\"u32\"}}"
|
||||
}
|
||||
],
|
||||
"type": "(u32, ConfirmationStatus)"
|
||||
"type": "(u32,ConfirmationStatus)"
|
||||
},
|
||||
{
|
||||
"displayName": "ConfirmationStatus",
|
||||
@@ -511,4 +511,4 @@
|
||||
"info": 5,
|
||||
"type": "Option<Vec<u8>>"
|
||||
}
|
||||
]
|
||||
]
|
||||
|
||||
@@ -158,12 +158,12 @@
|
||||
"type": "AccountId"
|
||||
}
|
||||
],
|
||||
"type": "(AccountId, AccountId)",
|
||||
"type": "(AccountId,AccountId)",
|
||||
"name": "Occupied"
|
||||
}
|
||||
],
|
||||
"info": 3,
|
||||
"type": "{\"_enum\":{\"Vacant\":\"VacantEntry\",\"Occupied\":\"(AccountId, AccountId)\"}}"
|
||||
"type": "{\"_enum\":{\"Vacant\":\"VacantEntry\",\"Occupied\":\"(AccountId,AccountId)\"}}"
|
||||
},
|
||||
{
|
||||
"info": 10,
|
||||
@@ -181,7 +181,7 @@
|
||||
"type": "AccountId"
|
||||
}
|
||||
],
|
||||
"type": "(AccountId, AccountId)"
|
||||
"type": "(AccountId,AccountId)"
|
||||
},
|
||||
{
|
||||
"info": 6,
|
||||
@@ -202,4 +202,4 @@
|
||||
"info": 5,
|
||||
"type": "Option<AccountId>"
|
||||
}
|
||||
]
|
||||
]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/api-derive",
|
||||
"version": "5.0.1",
|
||||
"version": "5.3.2",
|
||||
"type": "module",
|
||||
"description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
|
||||
"main": "index.js",
|
||||
@@ -19,16 +19,16 @@
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"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",
|
||||
"@babel/runtime": "^7.14.8",
|
||||
"@polkadot/api": "5.3.2",
|
||||
"@polkadot/rpc-core": "5.3.2",
|
||||
"@polkadot/types": "5.3.2",
|
||||
"@polkadot/util": "^7.1.1",
|
||||
"@polkadot/util-crypto": "^7.1.1",
|
||||
"rxjs": "^7.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^7.0.1",
|
||||
"@polkadot/rpc-provider": "5.0.1"
|
||||
"@polkadot/keyring": "^7.1.1",
|
||||
"@polkadot/rpc-provider": "5.3.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.3.2' };
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import { ApiPromise, WsProvider } from '@polkadot/api';
|
||||
import { Metadata, TypeRegistry } from '@polkadot/types';
|
||||
import metaStatic from '@polkadot/types/metadata/static';
|
||||
import metaStatic from '@polkadot/types/metadata/static-substrate';
|
||||
|
||||
export function createApiWithAugmentations (): ApiPromise {
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
+10
-10
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/api",
|
||||
"version": "5.0.1",
|
||||
"version": "5.3.2",
|
||||
"type": "module",
|
||||
"description": "Promise and RxJS wrappers around the Polkadot JS RPC",
|
||||
"main": "index.js",
|
||||
@@ -19,15 +19,15 @@
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"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",
|
||||
"@babel/runtime": "^7.14.8",
|
||||
"@polkadot/api-derive": "5.3.2",
|
||||
"@polkadot/keyring": "^7.1.1",
|
||||
"@polkadot/rpc-core": "5.3.2",
|
||||
"@polkadot/rpc-provider": "5.3.2",
|
||||
"@polkadot/types": "5.3.2",
|
||||
"@polkadot/types-known": "5.3.2",
|
||||
"@polkadot/util": "^7.1.1",
|
||||
"@polkadot/util-crypto": "^7.1.1",
|
||||
"eventemitter3": "^4.0.7",
|
||||
"rxjs": "^7.2.0"
|
||||
}
|
||||
|
||||
@@ -1,19 +1,59 @@
|
||||
// Auto-generated via `yarn polkadot-types-from-chain`, do not edit
|
||||
/* eslint-disable */
|
||||
|
||||
import type { Vec, u16, u32, u64 } from '@polkadot/types';
|
||||
import type { Vec, bool, u16, u32, u64 } from '@polkadot/types';
|
||||
import type { Codec } from '@polkadot/types/types';
|
||||
import type { Schedule } from '@polkadot/types/interfaces/contracts';
|
||||
import type { Balance, BalanceOf, BlockNumber, LockIdentifier, Moment, PalletId, Perbill, Percent, Permill, RuntimeDbWeight, Weight } from '@polkadot/types/interfaces/runtime';
|
||||
import type { Balance, BalanceOf, BlockNumber, LockIdentifier, Moment, PalletId, Perbill, Percent, Permill, RuntimeDbWeight, TransactionPriority, Weight } from '@polkadot/types/interfaces/runtime';
|
||||
import type { SessionIndex } from '@polkadot/types/interfaces/session';
|
||||
import type { EraIndex } from '@polkadot/types/interfaces/staking';
|
||||
import type { RuntimeVersion } from '@polkadot/types/interfaces/state';
|
||||
import type { WeightToFeeCoefficient } from '@polkadot/types/interfaces/support';
|
||||
import type { BlockLength, BlockWeights } from '@polkadot/types/interfaces/system';
|
||||
import type { DepositBalanceOf } from '@polkadot/types/interfaces/uniques';
|
||||
import type { ApiTypes } from '@polkadot/api/types';
|
||||
|
||||
declare module '@polkadot/api/types/consts' {
|
||||
export interface AugmentedConsts<ApiType> {
|
||||
assets: {
|
||||
/**
|
||||
* The amount of funds that must be reserved when creating a new approval.
|
||||
**/
|
||||
approvalDeposit: DepositBalanceOf & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The basic amount of funds that must be reserved for an asset.
|
||||
**/
|
||||
assetDeposit: DepositBalanceOf & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The basic amount of funds that must be reserved when adding metadata to your asset.
|
||||
**/
|
||||
metadataDepositBase: DepositBalanceOf & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The additional funds that must be reserved for the number of bytes you store in your
|
||||
* metadata.
|
||||
**/
|
||||
metadataDepositPerByte: DepositBalanceOf & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The maximum length of a name or symbol stored on-chain.
|
||||
**/
|
||||
stringLimit: u32 & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* Generic const
|
||||
**/
|
||||
[key: string]: Codec;
|
||||
};
|
||||
authorship: {
|
||||
/**
|
||||
* The number of blocks back we should accept uncles.
|
||||
* This means that we will deal with uncle-parents that are
|
||||
* `UncleGenerations + 1` before `now`.
|
||||
**/
|
||||
uncleGenerations: BlockNumber & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* Generic const
|
||||
**/
|
||||
[key: string]: Codec;
|
||||
};
|
||||
babe: {
|
||||
/**
|
||||
* The amount of time, in slots, that each epoch should last.
|
||||
@@ -39,6 +79,15 @@ declare module '@polkadot/api/types/consts' {
|
||||
* The minimum amount required to keep an account open.
|
||||
**/
|
||||
existentialDeposit: Balance & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The maximum number of locks that should exist on an account.
|
||||
* Not strictly enforced, but used for weight estimation.
|
||||
**/
|
||||
maxLocks: u32 & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The maximum number of named reserves that can exist on an account.
|
||||
**/
|
||||
maxReserves: u32 & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* Generic const
|
||||
**/
|
||||
@@ -163,10 +212,20 @@ declare module '@polkadot/api/types/consts' {
|
||||
* Minimum voting period allowed for a fast-track referendum.
|
||||
**/
|
||||
fastTrackVotingPeriod: BlockNumber & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* Indicator for whether an emergency origin is even allowed to happen. Some chains may want
|
||||
* to set this permanently to `false`, others may want to condition it on things such as
|
||||
* an upgrade having happened recently.
|
||||
**/
|
||||
instantAllowed: bool & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* How often (in blocks) new public referenda are launched.
|
||||
**/
|
||||
launchPeriod: BlockNumber & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The maximum number of public proposals that can exist at any time.
|
||||
**/
|
||||
maxProposals: u32 & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The maximum number of votes for an account.
|
||||
*
|
||||
@@ -192,6 +251,29 @@ declare module '@polkadot/api/types/consts' {
|
||||
[key: string]: Codec;
|
||||
};
|
||||
electionProviderMultiPhase: {
|
||||
/**
|
||||
* Maximum number of iteration of balancing that will be executed in the embedded miner of
|
||||
* the pallet.
|
||||
**/
|
||||
minerMaxIterations: u32 & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* Maximum length (bytes) that the mined solution should consume.
|
||||
*
|
||||
* The miner will ensure that the total length of the unsigned solution will not exceed
|
||||
* this value.
|
||||
**/
|
||||
minerMaxLength: u32 & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* Maximum weight that the miner should consume.
|
||||
*
|
||||
* The miner will ensure that the total weight of the unsigned solution will not exceed
|
||||
* this value, based on [`WeightInfo::submit_unsigned`].
|
||||
**/
|
||||
minerMaxWeight: Weight & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The priority of the unsigned transaction submitted in the unsigned-phase
|
||||
**/
|
||||
minerTxPriority: TransactionPriority & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The repeat threshold of the offchain worker.
|
||||
*
|
||||
@@ -295,6 +377,11 @@ declare module '@polkadot/api/types/consts' {
|
||||
* Must be no greater than `MaxQueueLen`.
|
||||
**/
|
||||
fifoQueueLen: u32 & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The issuance to ignore. This is subtracted from the `Currency`'s `total_issuance` to get
|
||||
* the issuance by which we inflate or deflate the gilt.
|
||||
**/
|
||||
ignoredIssuance: BalanceOf & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The number of blocks between consecutive attempts to issue more gilts in an effort to
|
||||
* get to the target amount to be frozen.
|
||||
@@ -371,6 +458,19 @@ declare module '@polkadot/api/types/consts' {
|
||||
**/
|
||||
[key: string]: Codec;
|
||||
};
|
||||
imOnline: {
|
||||
/**
|
||||
* A configuration for base priority of unsigned transactions.
|
||||
*
|
||||
* This is exposed so that it can be tuned for particular runtime, when
|
||||
* multiple pallets send unsigned transactions.
|
||||
**/
|
||||
unsignedPriority: TransactionPriority & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* Generic const
|
||||
**/
|
||||
[key: string]: Codec;
|
||||
};
|
||||
indices: {
|
||||
/**
|
||||
* The deposit needed for reserving an index.
|
||||
@@ -386,6 +486,12 @@ declare module '@polkadot/api/types/consts' {
|
||||
* The max number of calls available in a single lottery.
|
||||
**/
|
||||
maxCalls: u32 & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* Number of time we should try to generate a random number that has no modulo bias.
|
||||
* The larger this number, the more potential computation is used for picking the winner,
|
||||
* but also the more likely that the chosen winner is done fairly.
|
||||
**/
|
||||
maxGenerateRandom: u32 & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The Lottery's pallet id
|
||||
**/
|
||||
@@ -495,6 +601,22 @@ declare module '@polkadot/api/types/consts' {
|
||||
**/
|
||||
[key: string]: Codec;
|
||||
};
|
||||
scheduler: {
|
||||
/**
|
||||
* The maximum weight that may be scheduled per block for any dispatchables of less priority
|
||||
* than `schedule::HARD_DEADLINE`.
|
||||
**/
|
||||
maximumWeight: Weight & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The maximum number of scheduled calls in the queue for a single block.
|
||||
* Not strictly enforced, but used for weight estimation.
|
||||
**/
|
||||
maxScheduledPerBlock: u32 & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* Generic const
|
||||
**/
|
||||
[key: string]: Codec;
|
||||
};
|
||||
society: {
|
||||
/**
|
||||
* The minimum amount of a deposit required for a bid to be made.
|
||||
@@ -657,7 +779,11 @@ declare module '@polkadot/api/types/consts' {
|
||||
**/
|
||||
burn: Permill & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The treasury's module id, used for deriving its sovereign account ID.
|
||||
* The maximum number of approvals that can wait in the spending queue.
|
||||
**/
|
||||
maxApprovals: u32 & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The treasury's pallet id, used for deriving its sovereign account ID.
|
||||
**/
|
||||
palletId: PalletId & AugmentedConst<ApiType>;
|
||||
/**
|
||||
@@ -678,6 +804,45 @@ declare module '@polkadot/api/types/consts' {
|
||||
**/
|
||||
[key: string]: Codec;
|
||||
};
|
||||
uniques: {
|
||||
/**
|
||||
* The basic amount of funds that must be reserved when adding an attribute to an asset.
|
||||
**/
|
||||
attributeDepositBase: DepositBalanceOf & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The basic amount of funds that must be reserved for an asset class.
|
||||
**/
|
||||
classDeposit: DepositBalanceOf & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The additional funds that must be reserved for the number of bytes store in metadata,
|
||||
* either "normal" metadata or attribute metadata.
|
||||
**/
|
||||
depositPerByte: DepositBalanceOf & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The basic amount of funds that must be reserved for an asset instance.
|
||||
**/
|
||||
instanceDeposit: DepositBalanceOf & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The maximum length of an attribute key.
|
||||
**/
|
||||
keyLimit: u32 & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The basic amount of funds that must be reserved when adding metadata to your asset.
|
||||
**/
|
||||
metadataDepositBase: DepositBalanceOf & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The maximum length of data stored on-chain.
|
||||
**/
|
||||
stringLimit: u32 & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The maximum length of an attribute value.
|
||||
**/
|
||||
valueLimit: u32 & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* Generic const
|
||||
**/
|
||||
[key: string]: Codec;
|
||||
};
|
||||
vesting: {
|
||||
/**
|
||||
* The minimum amount transferred to call `vested_transfer`.
|
||||
|
||||
@@ -314,9 +314,9 @@ declare module '@polkadot/api/types/events' {
|
||||
**/
|
||||
Delegated: AugmentedEvent<ApiType, [AccountId, AccountId]>;
|
||||
/**
|
||||
* A proposal has been enacted. \[ref_index, is_ok\]
|
||||
* A proposal has been enacted. \[ref_index, result\]
|
||||
**/
|
||||
Executed: AugmentedEvent<ApiType, [ReferendumIndex, bool]>;
|
||||
Executed: AugmentedEvent<ApiType, [ReferendumIndex, DispatchResult]>;
|
||||
/**
|
||||
* An external proposal has been tabled.
|
||||
**/
|
||||
@@ -819,7 +819,7 @@ declare module '@polkadot/api/types/events' {
|
||||
* the remainder from the maximum amount of reward.
|
||||
* \[era_index, validator_payout, remainder\]
|
||||
**/
|
||||
EraPayout: AugmentedEvent<ApiType, [EraIndex, Balance, Balance]>;
|
||||
EraPaid: AugmentedEvent<ApiType, [EraIndex, Balance, Balance]>;
|
||||
/**
|
||||
* A nominator has been kicked from a validator. \[nominator, stash\]
|
||||
**/
|
||||
@@ -830,18 +830,22 @@ declare module '@polkadot/api/types/events' {
|
||||
**/
|
||||
OldSlashingReportDiscarded: AugmentedEvent<ApiType, [SessionIndex]>;
|
||||
/**
|
||||
* The staker has been rewarded by this amount. \[stash, amount\]
|
||||
* The stakers' rewards are getting paid. \[era_index, validator_stash\]
|
||||
**/
|
||||
Reward: AugmentedEvent<ApiType, [AccountId, Balance]>;
|
||||
PayoutStarted: AugmentedEvent<ApiType, [EraIndex, AccountId]>;
|
||||
/**
|
||||
* The nominator has been rewarded by this amount. \[stash, amount\]
|
||||
**/
|
||||
Rewarded: AugmentedEvent<ApiType, [AccountId, Balance]>;
|
||||
/**
|
||||
* One validator (and its nominators) has been slashed by the given amount.
|
||||
* \[validator, amount\]
|
||||
**/
|
||||
Slash: AugmentedEvent<ApiType, [AccountId, Balance]>;
|
||||
Slashed: AugmentedEvent<ApiType, [AccountId, Balance]>;
|
||||
/**
|
||||
* A new set of stakers was elected.
|
||||
**/
|
||||
StakingElection: AugmentedEvent<ApiType, []>;
|
||||
StakersElected: AugmentedEvent<ApiType, []>;
|
||||
/**
|
||||
* The election failed. No new era is planned.
|
||||
**/
|
||||
@@ -1172,6 +1176,10 @@ declare module '@polkadot/api/types/events' {
|
||||
* well as the error. \[index, error\]
|
||||
**/
|
||||
BatchInterrupted: AugmentedEvent<ApiType, [u32, DispatchError]>;
|
||||
/**
|
||||
* A single item within a Batch of dispatches has completed with no error.
|
||||
**/
|
||||
ItemCompleted: AugmentedEvent<ApiType, []>;
|
||||
/**
|
||||
* Generic event
|
||||
**/
|
||||
|
||||
@@ -939,7 +939,7 @@ declare module '@polkadot/api/types/storage' {
|
||||
/**
|
||||
* The last planned session scheduled by the session pallet.
|
||||
*
|
||||
* This is basically in sync with the call to [`SessionManager::new_session`].
|
||||
* This is basically in sync with the call to [`pallet_session::SessionManager::new_session`].
|
||||
**/
|
||||
currentPlannedSession: AugmentedQuery<ApiType, () => Observable<SessionIndex>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
/**
|
||||
|
||||
@@ -1352,8 +1352,9 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* origin is removed as a runner-up.
|
||||
* - `origin` is a current member. In this case, the deposit is unreserved and origin is
|
||||
* removed as a member, consequently not being a candidate for the next round anymore.
|
||||
* Similar to [`remove_members`], if replacement runners exists, they are immediately
|
||||
* used. If the prime is renouncing, then no prime will exist until the next round.
|
||||
* Similar to [`remove_member`](Self::remove_member), if replacement runners exists,
|
||||
* they are immediately used. If the prime is renouncing, then no prime will exist until
|
||||
* the next round.
|
||||
*
|
||||
* The dispatch origin of this call must be signed, and have one of the above roles.
|
||||
*
|
||||
@@ -2556,7 +2557,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* Schedule a named task after a delay.
|
||||
*
|
||||
* # <weight>
|
||||
* Same as [`schedule_named`].
|
||||
* Same as [`schedule_named`](Self::schedule_named).
|
||||
* # </weight>
|
||||
**/
|
||||
scheduleNamedAfter: AugmentedSubmittable<(id: Bytes | string | Uint8Array, after: BlockNumber | AnyNumber | Uint8Array, maybePeriodic: Option<Period> | null | object | string | Uint8Array, priority: Priority | AnyNumber | Uint8Array, call: Call | { callIndex?: any; args?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes, BlockNumber, Option<Period>, Priority, Call]>;
|
||||
@@ -2954,8 +2955,8 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* The dispatch origin for this call must be _Signed_ by the stash, not the controller.
|
||||
*
|
||||
* Use this if there are additional funds in your stash account that you wish to bond.
|
||||
* Unlike [`bond`] or [`unbond`] this function does not impose any limitation on the amount
|
||||
* that can be added.
|
||||
* Unlike [`bond`](Self::bond) or [`unbond`](Self::unbond) this function does not impose any limitation
|
||||
* on the amount that can be added.
|
||||
*
|
||||
* Emits `Bonded`.
|
||||
*
|
||||
@@ -3017,7 +3018,6 @@ declare module '@polkadot/api/types/submittable' {
|
||||
*
|
||||
* This can be helpful if bond requirements are updated, and we need to remove old users
|
||||
* who do not satisfy these requirements.
|
||||
*
|
||||
**/
|
||||
chillOther: AugmentedSubmittable<(controller: AccountId | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [AccountId]>;
|
||||
/**
|
||||
@@ -3093,7 +3093,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* The dispatch origin must be Root.
|
||||
*
|
||||
* # <weight>
|
||||
* Same as [`set_validator_count`].
|
||||
* Same as [`Self::set_validator_count`].
|
||||
* # </weight>
|
||||
**/
|
||||
increaseValidatorCount: AugmentedSubmittable<(additional: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>]>;
|
||||
@@ -3185,7 +3185,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* The dispatch origin must be Root.
|
||||
*
|
||||
* # <weight>
|
||||
* Same as [`set_validator_count`].
|
||||
* Same as [`Self::set_validator_count`].
|
||||
* # </weight>
|
||||
**/
|
||||
scaleValidatorCount: AugmentedSubmittable<(factor: Percent | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Percent]>;
|
||||
@@ -4413,24 +4413,6 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* # </weight>
|
||||
**/
|
||||
vest: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>, []>;
|
||||
/**
|
||||
* Unlock any vested funds of a `target` account.
|
||||
*
|
||||
* The dispatch origin for this call must be _Signed_.
|
||||
*
|
||||
* - `target`: The account whose vested funds should be unlocked. Must have funds still
|
||||
* locked under this pallet.
|
||||
*
|
||||
* Emits either `VestingCompleted` or `VestingUpdated`.
|
||||
*
|
||||
* # <weight>
|
||||
* - `O(1)`.
|
||||
* - DbWeight: 3 Reads, 3 Writes
|
||||
* - Reads: Vesting Storage, Balances Locks, Target Account
|
||||
* - Writes: Vesting Storage, Balances Locks, Target Account
|
||||
* # </weight>
|
||||
**/
|
||||
vestOther: AugmentedSubmittable<(target: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource]>;
|
||||
/**
|
||||
* Create a vested transfer.
|
||||
*
|
||||
@@ -4450,6 +4432,24 @@ declare module '@polkadot/api/types/submittable' {
|
||||
* # </weight>
|
||||
**/
|
||||
vestedTransfer: AugmentedSubmittable<(target: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, schedule: VestingInfo | { locked?: any; perBlock?: any; startingBlock?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource, VestingInfo]>;
|
||||
/**
|
||||
* Unlock any vested funds of a `target` account.
|
||||
*
|
||||
* The dispatch origin for this call must be _Signed_.
|
||||
*
|
||||
* - `target`: The account whose vested funds should be unlocked. Must have funds still
|
||||
* locked under this pallet.
|
||||
*
|
||||
* Emits either `VestingCompleted` or `VestingUpdated`.
|
||||
*
|
||||
* # <weight>
|
||||
* - `O(1)`.
|
||||
* - DbWeight: 3 Reads, 3 Writes
|
||||
* - Reads: Vesting Storage, Balances Locks, Target Account
|
||||
* - Writes: Vesting Storage, Balances Locks, Target Account
|
||||
* # </weight>
|
||||
**/
|
||||
vestOther: AugmentedSubmittable<(target: LookupSource | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [LookupSource]>;
|
||||
/**
|
||||
* Generic tx
|
||||
**/
|
||||
|
||||
@@ -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';
|
||||
@@ -189,12 +189,9 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
||||
return this._rpcCore.provider.hasSubscriptions || !!this._rpcCore.state.queryStorageAt;
|
||||
}
|
||||
|
||||
protected _injectDecorated (registry: VersionedRegistry<ApiType>, fromEmpty?: boolean, blockHash?: Uint8Array): FullDecoration<ApiType> {
|
||||
const decoratedMeta = expandMetadata(registry.registry, registry.metadata);
|
||||
|
||||
// clear the decoration, we are redoing it here
|
||||
if (fromEmpty || !registry.decoration) {
|
||||
registry.decoration = {
|
||||
protected _createDecorated (registry: VersionedRegistry<ApiType>, fromEmpty?: boolean, blockHash?: Uint8Array | null, decoratedApi?: ApiDecoration<ApiType>): FullDecoration<ApiType> {
|
||||
if (!decoratedApi) {
|
||||
decoratedApi = {
|
||||
consts: {},
|
||||
errors: {},
|
||||
events: {},
|
||||
@@ -202,25 +199,39 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
||||
} as ApiDecoration<ApiType>;
|
||||
}
|
||||
|
||||
if (!registry.decoratedMeta) {
|
||||
registry.decoratedMeta = expandMetadata(registry.registry, registry.metadata);
|
||||
}
|
||||
|
||||
// adjust the versioned registry
|
||||
augmentObject('consts', decoratedMeta.consts, registry.decoration.consts, fromEmpty);
|
||||
augmentObject('errors', decoratedMeta.errors, registry.decoration.errors, fromEmpty);
|
||||
augmentObject('events', decoratedMeta.events, registry.decoration.events, fromEmpty);
|
||||
augmentObject('consts', registry.decoratedMeta.consts, decoratedApi.consts, fromEmpty);
|
||||
augmentObject('errors', registry.decoratedMeta.errors, decoratedApi.errors, fromEmpty);
|
||||
augmentObject('events', registry.decoratedMeta.events, decoratedApi.events, fromEmpty);
|
||||
|
||||
const storage = blockHash
|
||||
? this._decorateStorageAt(decoratedMeta, this._decorateMethod, blockHash)
|
||||
: this._decorateStorage(decoratedMeta, this._decorateMethod);
|
||||
? this._decorateStorageAt(registry.decoratedMeta, this._decorateMethod, blockHash)
|
||||
: this._decorateStorage(registry.decoratedMeta, this._decorateMethod);
|
||||
|
||||
augmentObject('query', storage, registry.decoration.query, fromEmpty);
|
||||
augmentObject('query', storage, decoratedApi.query, fromEmpty);
|
||||
|
||||
return {
|
||||
decoratedApi: registry.decoration,
|
||||
decoratedMeta
|
||||
decoratedApi,
|
||||
decoratedMeta: registry.decoratedMeta
|
||||
};
|
||||
}
|
||||
|
||||
protected _injectMetadata (registry: VersionedRegistry<ApiType>, fromEmpty?: boolean): void {
|
||||
const { decoratedApi, decoratedMeta } = this._injectDecorated(registry, fromEmpty);
|
||||
// clear the decoration, we are redoing it here
|
||||
if (fromEmpty || !registry.decoratedApi) {
|
||||
registry.decoratedApi = {
|
||||
consts: {},
|
||||
errors: {},
|
||||
events: {},
|
||||
query: {}
|
||||
} as ApiDecoration<ApiType>;
|
||||
}
|
||||
|
||||
const { decoratedApi, decoratedMeta } = this._createDecorated(registry, fromEmpty, null, registry.decoratedApi);
|
||||
|
||||
this._consts = decoratedApi.consts;
|
||||
this._errors = decoratedApi.errors;
|
||||
@@ -245,7 +256,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
||||
* backwards compatible endpoint for metadata injection, may be removed in the future (However, it is still useful for testing injection)
|
||||
*/
|
||||
public injectMetadata (metadata: Metadata, fromEmpty?: boolean, registry?: Registry): void {
|
||||
this._injectMetadata({ metadata, registry: registry || this.#registry, specVersion: BN_ZERO }, fromEmpty);
|
||||
this._injectMetadata({ metadata, registry: registry || this.#registry, specName: this.#registry.createType('Text'), specVersion: BN_ZERO }, fromEmpty);
|
||||
}
|
||||
|
||||
private _decorateFunctionMeta (input: MetaDecoration, output: MetaDecoration): MetaDecoration {
|
||||
@@ -265,9 +276,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);
|
||||
@@ -407,7 +416,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
||||
|
||||
private _decorateStorageEntry<ApiType extends ApiTypes> (creator: StorageEntry, decorateMethod: DecorateMethod<ApiType>): QueryableStorageEntry<ApiType> {
|
||||
// get the storage arguments, with DoubleMap as an array entry, otherwise spread
|
||||
const getArgs = (args: unknown[]): unknown[] => extractStorageArgs(creator, args);
|
||||
const getArgs = (args: unknown[]): unknown[] => extractStorageArgs(this.#registry, creator, args);
|
||||
|
||||
// Disable this where it occurs for each field we are decorating
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment */
|
||||
@@ -490,7 +499,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
||||
|
||||
private _decorateStorageEntryAt<ApiType extends ApiTypes> (creator: StorageEntry, decorateMethod: DecorateMethod<ApiType>, blockHash: Uint8Array): QueryableStorageEntryAt<ApiType> {
|
||||
// get the storage arguments, with DoubleMap as an array entry, otherwise spread
|
||||
const getArgs = (args: unknown[]): unknown[] => extractStorageArgs(creator, args);
|
||||
const getArgs = (args: unknown[]): unknown[] => extractStorageArgs(this.#registry, creator, args);
|
||||
|
||||
// Disable this where it occurs for each field we are decorating
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment */
|
||||
@@ -547,18 +556,18 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
return decorateMethod((...args: unknown[]): Observable<Codec> => {
|
||||
return this.hasSubscriptions
|
||||
? this._rpcCore.state.subscribeStorage<[Codec]>([extractStorageArgs(creator, args)]).pipe(
|
||||
? this._rpcCore.state.subscribeStorage<[Codec]>([extractStorageArgs(this.#registry, creator, args)]).pipe(
|
||||
map(([data]) => data) // extract first/only result from list
|
||||
)
|
||||
: this._rpcCore.state.getStorage(extractStorageArgs(creator, args));
|
||||
: this._rpcCore.state.getStorage(extractStorageArgs(this.#registry, creator, args));
|
||||
}, {
|
||||
methodName: creator.method,
|
||||
overrideNoSub: (...args: unknown[]) => this._rpcCore.state.getStorage(extractStorageArgs(creator, args))
|
||||
overrideNoSub: (...args: unknown[]) => this._rpcCore.state.getStorage(extractStorageArgs(this.#registry, creator, args))
|
||||
});
|
||||
}
|
||||
|
||||
private _decorateStorageRange<ApiType extends ApiTypes> (decorated: QueryableStorageEntry<ApiType>, args: Arg[], range: [Hash, Hash?]): Observable<[Hash, Codec][]> {
|
||||
const outputType = unwrapStorageType(decorated.creator.meta.type, decorated.creator.meta.modifier.isOptional);
|
||||
const outputType = unwrapStorageType(this.#registry, decorated.creator.meta.type, decorated.creator.meta.modifier.isOptional);
|
||||
|
||||
return this._rpcCore.state
|
||||
.queryStorage<[Option<Raw>]>([decorated.key(...args)], ...range)
|
||||
|
||||
@@ -114,9 +114,8 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
|
||||
const u8aHash = u8aToU8a(blockHash);
|
||||
const registry = await this.getBlockRegistry(u8aHash);
|
||||
|
||||
return registry.decoration
|
||||
? registry.decoration
|
||||
: this._injectDecorated(registry, true, u8aHash).decoratedApi;
|
||||
// always create a new decoration for this specific hash
|
||||
return this._createDecorated(registry, true, u8aHash).decoratedApi;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -152,8 +151,12 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
|
||||
: await firstValueFrom((this._rpcCore.state.getRuntimeVersion as RpcInterfaceMethod).json(header.parentHash))
|
||||
);
|
||||
|
||||
// check for pre-existing registries
|
||||
const existingViaVersion = this.#registries.find(({ specVersion }) => specVersion.eq(version.specVersion));
|
||||
// check for pre-existing registries. We also check specName, e.g. it
|
||||
// could be changed like in Westmint with upgrade from shell -> westmint
|
||||
const existingViaVersion = this.#registries.find(({ specName, specVersion }) =>
|
||||
specName.eq(version.specName) &&
|
||||
specVersion.eq(version.specVersion)
|
||||
);
|
||||
|
||||
if (existingViaVersion) {
|
||||
existingViaVersion.lastBlockHash = blockHash;
|
||||
@@ -170,7 +173,7 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
|
||||
this._initRegistry(registry, this._runtimeChain as Text, version, metadata);
|
||||
|
||||
// add our new registry
|
||||
const result = { lastBlockHash: blockHash, metadata, registry, specVersion: version.specVersion };
|
||||
const result = { lastBlockHash: blockHash, metadata, registry, specName: version.specName, specVersion: version.specVersion };
|
||||
|
||||
this.#registries.push(result);
|
||||
|
||||
@@ -213,7 +216,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,12 +299,12 @@ 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
|
||||
if (!this.#registries.length) {
|
||||
this.#registries.push({ isDefault: true, metadata, registry: this.registry, specVersion: runtimeVersion.specVersion });
|
||||
this.#registries.push({ isDefault: true, metadata, registry: this.registry, specName: runtimeVersion.specName, specVersion: runtimeVersion.specVersion });
|
||||
}
|
||||
|
||||
// get unique types & validate
|
||||
|
||||
@@ -2,15 +2,19 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Metadata } from '@polkadot/types/metadata';
|
||||
import type { DecoratedMeta } from '@polkadot/types/metadata/decorate/types';
|
||||
import type { Text } from '@polkadot/types/primitive';
|
||||
import type { Registry } from '@polkadot/types/types';
|
||||
import type { BN } from '@polkadot/util';
|
||||
import type { ApiDecoration, ApiTypes } from '../types';
|
||||
|
||||
export interface VersionedRegistry<ApiType extends ApiTypes> {
|
||||
decoration?: ApiDecoration<ApiType> | null;
|
||||
decoratedApi?: ApiDecoration<ApiType>;
|
||||
decoratedMeta?: DecoratedMeta;
|
||||
isDefault?: boolean;
|
||||
lastBlockHash?: Uint8Array | null;
|
||||
metadata: Metadata;
|
||||
registry: Registry;
|
||||
specName: Text;
|
||||
specVersion: BN;
|
||||
}
|
||||
|
||||
@@ -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('')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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.3.2' };
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import type { Storage } from '@polkadot/types/metadata/decorate/types';
|
||||
|
||||
import { decorateStorage, Metadata, TypeRegistry } from '@polkadot/types';
|
||||
import metaStatic from '@polkadot/types/metadata/static';
|
||||
import metaStatic from '@polkadot/types/metadata/static-substrate';
|
||||
|
||||
import { extractStorageArgs } from './validate';
|
||||
|
||||
@@ -20,79 +20,79 @@ describe('extractStorageArgs', (): void => {
|
||||
|
||||
it('validates no-arg plain', (): void => {
|
||||
expect(
|
||||
extractStorageArgs(storage.timestamp.now, [])
|
||||
extractStorageArgs(registry, storage.timestamp.now, [])
|
||||
).toEqual([storage.timestamp.now]);
|
||||
});
|
||||
|
||||
it('validates no-arg plain (with undefined, undefined)', (): void => {
|
||||
expect(
|
||||
extractStorageArgs(storage.timestamp.now, [undefined, undefined])
|
||||
extractStorageArgs(registry, storage.timestamp.now, [undefined, undefined])
|
||||
).toEqual([storage.timestamp.now]);
|
||||
});
|
||||
|
||||
it('validates no-arg plain (failing when there are args)', (): void => {
|
||||
expect(
|
||||
(): unknown => extractStorageArgs(storage.timestamp.now, [123, 456])
|
||||
(): unknown => extractStorageArgs(registry, storage.timestamp.now, [123, 456])
|
||||
).toThrow('timestamp.now() does not take any arguments, 2 found');
|
||||
});
|
||||
|
||||
it('validates map, 1 arg', (): void => {
|
||||
expect(
|
||||
extractStorageArgs(storage.staking.payee, ['abc'])
|
||||
extractStorageArgs(registry, storage.staking.payee, ['abc'])
|
||||
).toEqual([storage.staking.payee, 'abc']);
|
||||
});
|
||||
|
||||
it('validates map, 1 arg (failing with no args)', (): void => {
|
||||
expect(
|
||||
(): any =>
|
||||
extractStorageArgs(storage.staking.payee, [])
|
||||
extractStorageArgs(registry, storage.staking.payee, [])
|
||||
).toThrow('staking.payee(AccountId) is a map, requiring 1 argument, 0 found');
|
||||
});
|
||||
|
||||
it('validates map, 1 arg (failing with no args)', (): void => {
|
||||
expect(
|
||||
(): any =>
|
||||
extractStorageArgs(storage.staking.payee, ['abc', 'def'])
|
||||
extractStorageArgs(registry, storage.staking.payee, ['abc', 'def'])
|
||||
).toThrow('staking.payee(AccountId) is a map, requiring 1 argument, 2 found');
|
||||
});
|
||||
|
||||
it('validates doublemap, 2 args', (): void => {
|
||||
expect(
|
||||
extractStorageArgs(storage.staking.erasStakers, [1, '0x1234'])
|
||||
extractStorageArgs(registry, storage.staking.erasStakers, [1, '0x1234'])
|
||||
).toEqual([storage.staking.erasStakers, [1, '0x1234']]);
|
||||
});
|
||||
|
||||
it('validates doublemap, 2 args (failing with no args)', (): void => {
|
||||
expect(
|
||||
(): any =>
|
||||
extractStorageArgs(storage.staking.erasStakers, [])
|
||||
extractStorageArgs(registry, storage.staking.erasStakers, [])
|
||||
).toThrow('staking.erasStakers(EraIndex, AccountId) is a double map, requiring 2 arguments, 0 found');
|
||||
});
|
||||
|
||||
it('validates doublemap, 2 args (failing with 1 arg)', (): void => {
|
||||
expect(
|
||||
(): any =>
|
||||
extractStorageArgs(storage.staking.erasStakers, [123])
|
||||
extractStorageArgs(registry, storage.staking.erasStakers, [123])
|
||||
).toThrow('staking.erasStakers(EraIndex, AccountId) is a double map, requiring 2 arguments, 1 found');
|
||||
});
|
||||
|
||||
// Linked maps have been removed
|
||||
it.skip('validates linked map, no args', (): void => {
|
||||
expect(
|
||||
extractStorageArgs(storage.staking.validators, [])
|
||||
extractStorageArgs(registry, storage.staking.validators, [])
|
||||
).toEqual([storage.staking.validators]);
|
||||
});
|
||||
|
||||
it.skip('validates linked map, single arg', (): void => {
|
||||
expect(
|
||||
extractStorageArgs(storage.staking.validators, [123])
|
||||
extractStorageArgs(registry, storage.staking.validators, [123])
|
||||
).toEqual([storage.staking.validators, 123]);
|
||||
});
|
||||
|
||||
it.skip('validates linked map (failing with extra args)', (): void => {
|
||||
expect(
|
||||
(): any[] =>
|
||||
extractStorageArgs(storage.staking.validators, [123, 456])
|
||||
extractStorageArgs(registry, storage.staking.validators, [123, 456])
|
||||
).toThrow('staking.validators(AccountId) is a linked map, requiring either 0 arguments (retrieving all) or 1 argument, 2 found');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -3,26 +3,27 @@
|
||||
|
||||
import type { Type } from '@polkadot/types';
|
||||
import type { StorageEntry } from '@polkadot/types/primitive/types';
|
||||
import type { Registry } from '@polkadot/types/types';
|
||||
|
||||
import { assert, isUndefined } from '@polkadot/util';
|
||||
|
||||
function sig ({ method, section }: StorageEntry, args: Type[]): string {
|
||||
function sig (_: Registry, { method, section }: StorageEntry, args: Type[]): string {
|
||||
return `${section}.${method}(${args.join(', ')})`;
|
||||
}
|
||||
|
||||
function doDoubleMap (creator: StorageEntry, args: unknown[]): [StorageEntry, [any, any]] {
|
||||
function doDoubleMap (registry: Registry, creator: StorageEntry, args: unknown[]): [StorageEntry, [any, any]] {
|
||||
const { key1, key2 } = creator.meta.type.asDoubleMap;
|
||||
|
||||
assert(args.length === 2, () => `${sig(creator, [key1, key2])} is a double map, requiring 2 arguments, ${args.length} found`);
|
||||
assert(args.length === 2, () => `${sig(registry, creator, [key1, key2])} is a double map, requiring 2 arguments, ${args.length} found`);
|
||||
|
||||
// pass as tuple
|
||||
return [creator, args as [any, any]];
|
||||
}
|
||||
|
||||
function doMap (creator: StorageEntry, args: unknown[]): [StorageEntry] | [StorageEntry, any] {
|
||||
function doMap (registry: Registry, creator: StorageEntry, args: unknown[]): [StorageEntry] | [StorageEntry, any] {
|
||||
const { key } = creator.meta.type.asMap;
|
||||
|
||||
assert(args.length === 1, () => `${sig(creator, [key])} is a map, requiring 1 argument, ${args.length} found`);
|
||||
assert(args.length === 1, () => `${sig(registry, creator, [key])} is a map, requiring 1 argument, ${args.length} found`);
|
||||
|
||||
// expand
|
||||
return args.length
|
||||
@@ -30,10 +31,10 @@ function doMap (creator: StorageEntry, args: unknown[]): [StorageEntry] | [Stora
|
||||
: [creator];
|
||||
}
|
||||
|
||||
function doNMap (creator: StorageEntry, args: unknown[]): [StorageEntry, any[]] {
|
||||
function doNMap (registry: Registry, creator: StorageEntry, args: unknown[]): [StorageEntry, any[]] {
|
||||
const { keyVec } = creator.meta.type.asNMap;
|
||||
|
||||
assert(args.length === keyVec.length, () => `${sig(creator, keyVec)} is a multi map, requiring ${keyVec.length} arguments, ${args.length} found`);
|
||||
assert(args.length === keyVec.length, () => `${sig(registry, creator, keyVec)} is a multi map, requiring ${keyVec.length} arguments, ${args.length} found`);
|
||||
|
||||
// pass as tuple
|
||||
return [creator, args];
|
||||
@@ -41,18 +42,18 @@ function doNMap (creator: StorageEntry, args: unknown[]): [StorageEntry, any[]]
|
||||
|
||||
// sets up the arguments in the form of [creator, args] ready to be used in a storage
|
||||
// call. Additionally, it verifies that the correct number of arguments have been passed
|
||||
export function extractStorageArgs (creator: StorageEntry, _args: unknown[]): [StorageEntry, any[]] | [StorageEntry] | [StorageEntry, any] {
|
||||
export function extractStorageArgs (registry: Registry, creator: StorageEntry, _args: unknown[]): [StorageEntry, any[]] | [StorageEntry] | [StorageEntry, any] {
|
||||
const args = _args.filter((arg) => !isUndefined(arg));
|
||||
|
||||
if (creator.meta.type.isDoubleMap) {
|
||||
return doDoubleMap(creator, args);
|
||||
return doDoubleMap(registry, creator, args);
|
||||
} else if (creator.meta.type.isMap) {
|
||||
return doMap(creator, args);
|
||||
return doMap(registry, creator, args);
|
||||
} else if (creator.meta.type.isNMap) {
|
||||
return doNMap(creator, args);
|
||||
return doNMap(registry, creator, args);
|
||||
}
|
||||
|
||||
assert(args.length === 0, () => `${sig(creator, [])} does not take any arguments, ${args.length} found`);
|
||||
assert(args.length === 0, () => `${sig(registry, creator, [])} does not take any arguments, ${args.length} found`);
|
||||
|
||||
// no args
|
||||
return [creator];
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/rpc-core",
|
||||
"version": "5.0.1",
|
||||
"version": "5.3.2",
|
||||
"type": "module",
|
||||
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
|
||||
"main": "index.js",
|
||||
@@ -19,13 +19,13 @@
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"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",
|
||||
"@babel/runtime": "^7.14.8",
|
||||
"@polkadot/rpc-provider": "5.3.2",
|
||||
"@polkadot/types": "5.3.2",
|
||||
"@polkadot/util": "^7.1.1",
|
||||
"rxjs": "^7.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^7.0.1"
|
||||
"@polkadot/keyring": "^7.1.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import type { RpcInterface, RpcInterfaceMethod } from './types';
|
||||
|
||||
import { Observable, publishReplay, refCount } from 'rxjs';
|
||||
|
||||
import { createClass, createTypeUnsafe, Option, rpcDefinitions } from '@polkadot/types';
|
||||
import { rpcDefinitions } from '@polkadot/types';
|
||||
import { assert, hexToU8a, isFunction, isNull, isUndefined, logger, memoize, u8aToU8a } from '@polkadot/util';
|
||||
|
||||
import { drr, refCountDelay } from './util';
|
||||
@@ -339,7 +339,7 @@ export class RpcCore {
|
||||
assert(inputs.length >= reqArgCount && inputs.length <= def.params.length, () => `Expected ${def.params.length} parameters${optText}, ${inputs.length} found instead`);
|
||||
|
||||
return inputs.map((input, index): Codec =>
|
||||
createTypeUnsafe(registry, def.params[index].type, [input], { blockHash })
|
||||
registry.createTypeUnsafe(def.params[index].type, [input], { blockHash })
|
||||
);
|
||||
}
|
||||
|
||||
@@ -366,7 +366,7 @@ export class RpcCore {
|
||||
: mapped as unknown as Codec[];
|
||||
}
|
||||
|
||||
return createTypeUnsafe(registry, rpc.type, [result], { blockHash });
|
||||
return registry.createTypeUnsafe(rpc.type, [result], { blockHash });
|
||||
}
|
||||
|
||||
private _formatStorageData (registry: Registry, blockHash: Uint8Array | string | null | undefined, key: StorageKey, value: string | null): Codec {
|
||||
@@ -432,29 +432,15 @@ export class RpcCore {
|
||||
: ` entry ${entryIndex}:`;
|
||||
|
||||
try {
|
||||
if (meta.modifier.isOptional) {
|
||||
let inner = null;
|
||||
|
||||
if (!isEmpty) {
|
||||
inner = createTypeUnsafe(registry, type, [input], { blockHash, isPedantic: true });
|
||||
}
|
||||
|
||||
const option = new Option(registry, createClass(registry, type), inner);
|
||||
|
||||
if (blockHash) {
|
||||
option.createdAtHash = registry.createType('Hash', blockHash);
|
||||
}
|
||||
|
||||
return option;
|
||||
}
|
||||
|
||||
return createTypeUnsafe(registry, type, [
|
||||
return registry.createTypeUnsafe(type, [
|
||||
isEmpty
|
||||
? meta.fallback
|
||||
? hexToU8a(meta.fallback.toHex())
|
||||
: undefined
|
||||
: input
|
||||
], { blockHash, isPedantic: true });
|
||||
: meta.modifier.isOptional
|
||||
? registry.createTypeUnsafe(type, [input], { blockHash, isPedantic: true })
|
||||
: input
|
||||
], { blockHash, isOptional: meta.modifier.isOptional, isPedantic: !meta.modifier.isOptional });
|
||||
} catch (error) {
|
||||
throw new Error(`Unable to decode storage ${key.section || 'unknown'}.${key.method || 'unknown'}:${entryNum}: ${(error as Error).message}`);
|
||||
}
|
||||
|
||||
@@ -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.3.2' };
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/rpc-provider",
|
||||
"version": "5.0.1",
|
||||
"version": "5.3.2",
|
||||
"type": "module",
|
||||
"description": "Transport providers for the API",
|
||||
"main": "index.js",
|
||||
@@ -19,18 +19,18 @@
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"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",
|
||||
"@babel/runtime": "^7.14.8",
|
||||
"@polkadot/types": "5.3.2",
|
||||
"@polkadot/util": "^7.1.1",
|
||||
"@polkadot/util-crypto": "^7.1.1",
|
||||
"@polkadot/x-fetch": "^7.1.1",
|
||||
"@polkadot/x-global": "^7.1.1",
|
||||
"@polkadot/x-ws": "^7.1.1",
|
||||
"eventemitter3": "^4.0.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^7.0.1",
|
||||
"@polkadot/types": "5.0.1",
|
||||
"@polkadot/keyring": "^7.1.1",
|
||||
"@polkadot/types": "5.3.2",
|
||||
"mock-socket": "^9.0.3",
|
||||
"nock": "^13.1.1"
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import { decorateStorage, Metadata } from '@polkadot/types';
|
||||
import jsonrpc from '@polkadot/types/interfaces/jsonrpc';
|
||||
import rpcHeader from '@polkadot/types/json/Header.004.json';
|
||||
import rpcSignedBlock from '@polkadot/types/json/SignedBlock.004.immortal.json';
|
||||
import rpcMetadata from '@polkadot/types/metadata/static';
|
||||
import rpcMetadata from '@polkadot/types/metadata/static-substrate';
|
||||
import { assert, BN, bnToU8a, logger, u8aToHex } from '@polkadot/util';
|
||||
import { randomAsU8a } from '@polkadot/util-crypto';
|
||||
|
||||
|
||||
@@ -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.3.2' };
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/typegen",
|
||||
"version": "5.0.1",
|
||||
"version": "5.3.2",
|
||||
"type": "module",
|
||||
"description": "Type generation scripts",
|
||||
"main": "index.js",
|
||||
@@ -26,19 +26,19 @@
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/typegen#readme",
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.14.6",
|
||||
"@babel/core": "^7.14.8",
|
||||
"@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",
|
||||
"@babel/runtime": "^7.14.8",
|
||||
"@polkadot/api": "5.3.2",
|
||||
"@polkadot/rpc-provider": "5.3.2",
|
||||
"@polkadot/types": "5.3.2",
|
||||
"@polkadot/util": "^7.1.1",
|
||||
"handlebars": "^4.7.7",
|
||||
"websocket": "^1.0.34",
|
||||
"yargs": "^17.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/websocket": "^1.0.3",
|
||||
"@types/websocket": "^1.0.4",
|
||||
"@types/yargs": "^17.0.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ function generateForMeta (meta: Metadata, dest: string, extraTypes: ExtraTypes,
|
||||
}, {});
|
||||
|
||||
const modules = meta.asLatest.modules
|
||||
.sort(compareName)
|
||||
.filter((mod) => mod.constants.length > 0)
|
||||
.map(({ constants, name }) => {
|
||||
if (!isStrict) {
|
||||
@@ -32,42 +31,41 @@ function generateForMeta (meta: Metadata, dest: string, extraTypes: ExtraTypes,
|
||||
}
|
||||
|
||||
const items = constants
|
||||
.sort(compareName)
|
||||
.map(({ documentation, name, type }) => {
|
||||
const returnType = formatType(allDefs, type.toString(), imports);
|
||||
.map(({ docs, name, type }) => {
|
||||
const returnType = formatType(meta.registry, allDefs, type.toString(), imports);
|
||||
|
||||
setImports(allDefs, imports, [returnType]);
|
||||
|
||||
return {
|
||||
docs: documentation,
|
||||
docs,
|
||||
name: stringCamelCase(name),
|
||||
type: returnType
|
||||
};
|
||||
});
|
||||
})
|
||||
.sort(compareName);
|
||||
|
||||
return {
|
||||
items,
|
||||
name: stringCamelCase(name)
|
||||
};
|
||||
});
|
||||
|
||||
const types = [
|
||||
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
|
||||
file: packagePath,
|
||||
types: Object.keys(imports.localTypes[packagePath])
|
||||
})),
|
||||
{
|
||||
file: '@polkadot/api/types',
|
||||
types: ['ApiTypes']
|
||||
}
|
||||
];
|
||||
})
|
||||
.sort(compareName);
|
||||
|
||||
return generateForMetaTemplate({
|
||||
headerType: 'chain',
|
||||
imports,
|
||||
isStrict,
|
||||
modules,
|
||||
types
|
||||
types: [
|
||||
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
|
||||
file: packagePath,
|
||||
types: Object.keys(imports.localTypes[packagePath])
|
||||
})),
|
||||
{
|
||||
file: '@polkadot/api/types',
|
||||
types: ['ApiTypes']
|
||||
}
|
||||
]
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -19,31 +19,29 @@ function generateForMeta (meta: Metadata, dest: string, isStrict: boolean): void
|
||||
const imports = createImports({});
|
||||
|
||||
const modules = meta.asLatest.modules
|
||||
.sort(compareName)
|
||||
.filter((mod) => mod.errors.length > 0)
|
||||
.map(({ errors, name }) => ({
|
||||
items: errors
|
||||
.sort(compareName)
|
||||
.map(({ documentation, name }) => ({
|
||||
docs: documentation,
|
||||
.map(({ docs, name }) => ({
|
||||
docs,
|
||||
name: name.toString()
|
||||
})),
|
||||
}))
|
||||
.sort(compareName),
|
||||
name: stringCamelCase(name)
|
||||
}));
|
||||
|
||||
const types = [
|
||||
{
|
||||
file: '@polkadot/api/types',
|
||||
types: ['ApiTypes']
|
||||
}
|
||||
];
|
||||
}))
|
||||
.sort(compareName);
|
||||
|
||||
return generateForMetaTemplate({
|
||||
headerType: 'chain',
|
||||
imports,
|
||||
isStrict,
|
||||
modules,
|
||||
types
|
||||
types: [
|
||||
{
|
||||
file: '@polkadot/api/types',
|
||||
types: ['ApiTypes']
|
||||
}
|
||||
]
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -24,43 +24,41 @@ function generateForMeta (meta: Metadata, dest: string, extraTypes: ExtraTypes,
|
||||
}, {});
|
||||
|
||||
const modules = meta.asLatest.modules
|
||||
.sort(compareName)
|
||||
.filter((mod) => mod.events.isSome)
|
||||
.map(({ events, name }) => ({
|
||||
items: events
|
||||
.unwrap()
|
||||
.sort(compareName)
|
||||
.map(({ args, documentation, name }) => {
|
||||
const types = args.map((type) => formatType(allDefs, type.toString(), imports));
|
||||
.map(({ args, docs, name }) => {
|
||||
const types = args.map((type) => formatType(meta.registry, allDefs, type.toString(), imports));
|
||||
|
||||
setImports(allDefs, imports, types);
|
||||
|
||||
return {
|
||||
docs: documentation,
|
||||
docs,
|
||||
name: name.toString(),
|
||||
type: types.join(', ')
|
||||
};
|
||||
}),
|
||||
}).sort(compareName),
|
||||
name: stringCamelCase(name)
|
||||
}));
|
||||
|
||||
const types = [
|
||||
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
|
||||
file: packagePath,
|
||||
types: Object.keys(imports.localTypes[packagePath])
|
||||
})),
|
||||
{
|
||||
file: '@polkadot/api/types',
|
||||
types: ['ApiTypes']
|
||||
}
|
||||
];
|
||||
}))
|
||||
.sort(compareName);
|
||||
|
||||
return generateForMetaTemplate({
|
||||
headerType: 'chain',
|
||||
imports,
|
||||
isStrict,
|
||||
modules,
|
||||
types
|
||||
types: [
|
||||
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
|
||||
file: packagePath,
|
||||
types: Object.keys(imports.localTypes[packagePath])
|
||||
})),
|
||||
{
|
||||
file: '@polkadot/api/types',
|
||||
types: ['ApiTypes']
|
||||
}
|
||||
]
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -62,18 +62,16 @@ export function generateInterfaceTypes (importDefinitions: { [importPath: string
|
||||
});
|
||||
});
|
||||
|
||||
const types = [
|
||||
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
|
||||
file: packagePath,
|
||||
types: Object.keys(imports.localTypes[packagePath])
|
||||
}))
|
||||
];
|
||||
|
||||
return generateInterfaceTypesTemplate({
|
||||
headerType: 'defs',
|
||||
imports,
|
||||
items: items.sort((a, b) => a.localeCompare(b)),
|
||||
types
|
||||
types: [
|
||||
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
|
||||
file: packagePath,
|
||||
types: Object.keys(imports.localTypes[packagePath])
|
||||
}))
|
||||
]
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -18,12 +18,12 @@ import { ModuleTypes } from '../util/imports';
|
||||
// From a storage entry metadata, we return [args, returnType]
|
||||
/** @internal */
|
||||
function entrySignature (allDefs: Record<string, ModuleTypes>, registry: Registry, storageEntry: StorageEntryMetadataLatest, imports: TypeImports): [string, string, string] {
|
||||
const outputType = unwrapStorageType(storageEntry.type, storageEntry.modifier.isOptional);
|
||||
const outputType = unwrapStorageType(registry, storageEntry.type, storageEntry.modifier.isOptional);
|
||||
|
||||
if (storageEntry.type.isPlain) {
|
||||
setImports(allDefs, imports, [storageEntry.type.asPlain.toString()]);
|
||||
|
||||
return ['', '', formatType(allDefs, outputType, imports)];
|
||||
return ['', '', formatType(registry, allDefs, outputType, imports)];
|
||||
} else if (storageEntry.type.isMap) {
|
||||
const map = storageEntry.type.asMap;
|
||||
|
||||
@@ -36,9 +36,9 @@ function entrySignature (allDefs: Record<string, ModuleTypes>, registry: Registr
|
||||
]);
|
||||
|
||||
return [
|
||||
formatType(allDefs, map.key.toString(), imports),
|
||||
formatType(registry, allDefs, map.key.toString(), imports),
|
||||
`arg: ${similarTypes.join(' | ')}`,
|
||||
formatType(allDefs, outputType, imports)
|
||||
formatType(registry, allDefs, outputType, imports)
|
||||
];
|
||||
} else if (storageEntry.type.isDoubleMap) {
|
||||
const dm = storageEntry.type.asDoubleMap;
|
||||
@@ -57,9 +57,12 @@ function entrySignature (allDefs: Record<string, ModuleTypes>, registry: Registr
|
||||
const key2Types = similarTypes2.join(' | ');
|
||||
|
||||
return [
|
||||
[formatType(allDefs, dm.key1.toString(), imports), formatType(allDefs, dm.key2.toString(), imports)].join(', '),
|
||||
[
|
||||
formatType(registry, allDefs, dm.key1.toString(), imports),
|
||||
formatType(registry, allDefs, dm.key2.toString(), imports)
|
||||
].join(', '),
|
||||
`arg1: ${key1Types}, arg2: ${key2Types}`,
|
||||
formatType(allDefs, outputType, imports)
|
||||
formatType(registry, allDefs, outputType, imports)
|
||||
];
|
||||
} else if (storageEntry.type.isNMap) {
|
||||
const nmap = storageEntry.type.asNMap;
|
||||
@@ -75,9 +78,9 @@ function entrySignature (allDefs: Record<string, ModuleTypes>, registry: Registr
|
||||
const keyTypes = similarTypes.map((t) => t.join(' | '));
|
||||
|
||||
return [
|
||||
nmap.keyVec.map((k) => formatType(allDefs, k.toString(), imports)).join(', '),
|
||||
nmap.keyVec.map((k) => formatType(registry, allDefs, k.toString(), imports)).join(', '),
|
||||
keyTypes.map((t, i) => `arg${i + 1}: ${t}`).join(', '),
|
||||
formatType(allDefs, outputType, imports)
|
||||
formatType(registry, allDefs, outputType, imports)
|
||||
];
|
||||
}
|
||||
|
||||
@@ -101,45 +104,44 @@ function generateForMeta (registry: Registry, meta: Metadata, dest: string, extr
|
||||
.filter((mod) => !mod.storage.isNone)
|
||||
.map(({ name, storage }) => {
|
||||
const items = storage.unwrap().items
|
||||
.sort(compareName)
|
||||
.map((storageEntry) => {
|
||||
const [args, params, returnType] = entrySignature(allDefs, registry, storageEntry, imports);
|
||||
|
||||
return {
|
||||
args,
|
||||
docs: storageEntry.documentation,
|
||||
docs: storageEntry.docs,
|
||||
entryType: 'AugmentedQuery',
|
||||
name: stringCamelCase(storageEntry.name),
|
||||
params,
|
||||
returnType
|
||||
};
|
||||
});
|
||||
})
|
||||
.sort(compareName);
|
||||
|
||||
return {
|
||||
items,
|
||||
name: stringCamelCase(name)
|
||||
};
|
||||
});
|
||||
})
|
||||
.sort(compareName);
|
||||
|
||||
imports.typesTypes.Observable = true;
|
||||
|
||||
const types = [
|
||||
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
|
||||
file: packagePath,
|
||||
types: Object.keys(imports.localTypes[packagePath])
|
||||
})),
|
||||
{
|
||||
file: '@polkadot/api/types',
|
||||
types: ['ApiTypes']
|
||||
}
|
||||
];
|
||||
|
||||
return generateForMetaTemplate({
|
||||
headerType: 'chain',
|
||||
imports,
|
||||
isStrict,
|
||||
modules,
|
||||
types
|
||||
types: [
|
||||
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
|
||||
file: packagePath,
|
||||
types: Object.keys(imports.localTypes[packagePath])
|
||||
})),
|
||||
{
|
||||
file: '@polkadot/api/types',
|
||||
types: ['ApiTypes']
|
||||
}
|
||||
]
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ export function generateRpcTypes (registry: TypeRegistry, importDefinitions: Rec
|
||||
return `${param.name}${param.isOptional ? '?' : ''}: ${similarTypes.join(' | ')}`;
|
||||
});
|
||||
|
||||
type = formatType(allDefs, def.type, imports);
|
||||
type = formatType(registry, allDefs, def.type, imports);
|
||||
generic = '';
|
||||
}
|
||||
|
||||
@@ -126,18 +126,16 @@ export function generateRpcTypes (registry: TypeRegistry, importDefinitions: Rec
|
||||
|
||||
imports.typesTypes.Observable = true;
|
||||
|
||||
const types = [
|
||||
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
|
||||
file: packagePath,
|
||||
types: Object.keys(imports.localTypes[packagePath])
|
||||
}))
|
||||
];
|
||||
|
||||
return generateRpcTypesTemplate({
|
||||
headerType: 'chain',
|
||||
imports,
|
||||
modules,
|
||||
types
|
||||
types: [
|
||||
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
|
||||
file: packagePath,
|
||||
types: Object.keys(imports.localTypes[packagePath])
|
||||
}))
|
||||
]
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2,12 +2,13 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { TypeDef } from '@polkadot/types/create/types';
|
||||
import type { Registry } from '@polkadot/types/types';
|
||||
import type { ModuleTypes } from '../util/imports';
|
||||
|
||||
import Handlebars from 'handlebars';
|
||||
import path from 'path';
|
||||
|
||||
import { getTypeDef } from '@polkadot/types/create';
|
||||
import { getTypeDef, TypeRegistry } from '@polkadot/types/create';
|
||||
import { TypeDefInfo } from '@polkadot/types/create/types';
|
||||
import * as defaultDefinitions from '@polkadot/types/interfaces/definitions';
|
||||
import { assert, isString, stringCamelCase, stringify, stringUpperFirst } from '@polkadot/util';
|
||||
@@ -28,13 +29,13 @@ export function createGetter (definitions: Record<string, ModuleTypes>, name = '
|
||||
|
||||
/** @internal */
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
function errorUnhandled (definitions: Record<string, ModuleTypes>, def: TypeDef, imports: TypeImports): string {
|
||||
function errorUnhandled (_: Registry, definitions: Record<string, ModuleTypes>, def: TypeDef, imports: TypeImports): string {
|
||||
throw new Error(`Generate: ${def.name || ''}: Unhandled type ${TypeDefInfo[def.info]}`);
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
function tsExport (definitions: Record<string, ModuleTypes>, def: TypeDef, imports: TypeImports): string {
|
||||
return exportInterface(def.name, formatType(definitions, def, imports));
|
||||
function tsExport (registry: Registry, definitions: Record<string, ModuleTypes>, def: TypeDef, imports: TypeImports): string {
|
||||
return exportInterface(def.name, formatType(registry, definitions, def, imports));
|
||||
}
|
||||
|
||||
const tsBTreeMap = tsExport;
|
||||
@@ -47,15 +48,16 @@ const tsPlain = tsExport;
|
||||
const tsTuple = tsExport;
|
||||
|
||||
/** @internal */
|
||||
function tsEnum (definitions: Record<string, ModuleTypes>, { name: enumName, sub }: TypeDef, imports: TypeImports): string {
|
||||
function tsEnum (registry: Registry, 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(registry, definitions, info === TypeDefInfo.Struct ? def : type, imports) : type, imports);
|
||||
const isGetter = info === TypeDefInfo.DoNotConstruct
|
||||
? ''
|
||||
: createGetter(definitions, `is${getter}`, 'boolean', imports);
|
||||
@@ -63,6 +65,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:
|
||||
@@ -80,18 +83,18 @@ function tsEnum (definitions: Record<string, ModuleTypes>, { name: enumName, sub
|
||||
return exportInterface(enumName, 'Enum', keys.join(''));
|
||||
}
|
||||
|
||||
function tsInt (definitions: Record<string, ModuleTypes>, def: TypeDef, imports: TypeImports, type: 'Int' | 'UInt' = 'Int'): string {
|
||||
function tsInt (_: Registry, definitions: Record<string, ModuleTypes>, def: TypeDef, imports: TypeImports, type: 'Int' | 'UInt' = 'Int'): string {
|
||||
setImports(definitions, imports, [type]);
|
||||
|
||||
return exportInterface(def.name, type);
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
function tsResultGetter (definitions: Record<string, ModuleTypes>, resultName = '', getter: 'Ok' | 'Err' | 'Error', def: TypeDef, imports: TypeImports): string {
|
||||
function tsResultGetter (registry: Registry, definitions: Record<string, ModuleTypes>, resultName = '', getter: 'Ok' | 'Err' | 'Error', def: TypeDef, imports: TypeImports): string {
|
||||
const { info, type } = def;
|
||||
const asGetter = type === 'Null'
|
||||
? ''
|
||||
: (getter === 'Error' ? ' /** @deprecated Use asErr */\n' : '') + createGetter(definitions, `as${getter}`, info === TypeDefInfo.Tuple ? formatType(definitions, def, imports) : type, imports);
|
||||
: (getter === 'Error' ? ' /** @deprecated Use asErr */\n' : '') + createGetter(definitions, `as${getter}`, info === TypeDefInfo.Tuple ? formatType(registry, definitions, def, imports) : type, imports);
|
||||
const isGetter = (getter === 'Error' ? ' /** @deprecated Use isErr */\n' : '') + createGetter(definitions, `is${getter}`, 'boolean', imports);
|
||||
|
||||
switch (info) {
|
||||
@@ -107,22 +110,28 @@ function tsResultGetter (definitions: Record<string, ModuleTypes>, resultName =
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
function tsResult (definitions: Record<string, ModuleTypes>, def: TypeDef, imports: TypeImports): string {
|
||||
function tsResult (registry: Registry, definitions: Record<string, ModuleTypes>, def: TypeDef, imports: TypeImports): string {
|
||||
const [okDef, errorDef] = (def.sub as TypeDef[]);
|
||||
const inner = [
|
||||
tsResultGetter(definitions, def.name, 'Err', errorDef, imports),
|
||||
tsResultGetter(registry, definitions, def.name, 'Err', errorDef, imports),
|
||||
// @deprecated, use Err
|
||||
tsResultGetter(definitions, def.name, 'Error', errorDef, imports),
|
||||
tsResultGetter(definitions, def.name, 'Ok', okDef, imports)
|
||||
tsResultGetter(registry, definitions, def.name, 'Error', errorDef, imports),
|
||||
tsResultGetter(registry, definitions, def.name, 'Ok', okDef, imports)
|
||||
].join('');
|
||||
|
||||
setImports(definitions, imports, [def.type]);
|
||||
|
||||
return exportInterface(def.name, formatType(definitions, def, imports), inner);
|
||||
return exportInterface(def.name, formatType(registry, definitions, def, imports), inner);
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
function tsSet (definitions: Record<string, ModuleTypes>, { name: setName, sub }: TypeDef, imports: TypeImports): string {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
function tsSi (registry: Registry, definitions: Record<string, ModuleTypes>, { type }: TypeDef, imports: TypeImports): string {
|
||||
throw new Error('Unable to generate string definition from TypeDefInfo.Si');
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
function tsSet (_: Registry, definitions: Record<string, ModuleTypes>, { name: setName, sub }: TypeDef, imports: TypeImports): string {
|
||||
setImports(definitions, imports, ['Set']);
|
||||
|
||||
const types = (sub as TypeDef[]).map(({ name }): string => {
|
||||
@@ -135,11 +144,11 @@ function tsSet (definitions: Record<string, ModuleTypes>, { name: setName, sub }
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
function tsStruct (definitions: Record<string, ModuleTypes>, { name: structName, sub }: TypeDef, imports: TypeImports): string {
|
||||
function tsStruct (registry: Registry, definitions: Record<string, ModuleTypes>, { name: structName, sub }: TypeDef, imports: TypeImports): string {
|
||||
setImports(definitions, imports, ['Struct']);
|
||||
|
||||
const keys = (sub as TypeDef[]).map((typedef): string => {
|
||||
const returnType = formatType(definitions, typedef, imports);
|
||||
const returnType = formatType(registry, definitions, typedef, imports);
|
||||
|
||||
return createGetter(definitions, typedef.name, returnType, imports);
|
||||
});
|
||||
@@ -148,12 +157,12 @@ function tsStruct (definitions: Record<string, ModuleTypes>, { name: structName,
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
function tsUInt (definitions: Record<string, ModuleTypes>, def: TypeDef, imports: TypeImports): string {
|
||||
return tsInt(definitions, def, imports, 'UInt');
|
||||
function tsUInt (registry: Registry, definitions: Record<string, ModuleTypes>, def: TypeDef, imports: TypeImports): string {
|
||||
return tsInt(registry, definitions, def, imports, 'UInt');
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
function tsVec (definitions: Record<string, ModuleTypes>, def: TypeDef, imports: TypeImports): string {
|
||||
function tsVec (registry: Registry, definitions: Record<string, ModuleTypes>, def: TypeDef, imports: TypeImports): string {
|
||||
const type = (def.sub as TypeDef).type;
|
||||
|
||||
if (def.info === TypeDefInfo.VecFixed && type === 'u8') {
|
||||
@@ -162,39 +171,40 @@ function tsVec (definitions: Record<string, ModuleTypes>, def: TypeDef, imports:
|
||||
return exportType(def.name, 'U8aFixed');
|
||||
}
|
||||
|
||||
return exportInterface(def.name, formatType(definitions, def, imports));
|
||||
return exportInterface(def.name, formatType(registry, definitions, def, imports));
|
||||
}
|
||||
|
||||
/** @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
|
||||
};
|
||||
// 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, (registry: Registry, 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 (registry: Registry, definitions: Record<string, ModuleTypes>, { types }: { types: Record<string, any> }, imports: Imports): [string, string][] {
|
||||
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](registry, definitions, def, imports)];
|
||||
});
|
||||
}
|
||||
|
||||
@@ -208,10 +218,10 @@ const templateTypes = readTemplate('tsDef/types');
|
||||
const generateTsDefTypesTemplate = Handlebars.compile(templateTypes);
|
||||
|
||||
/** @internal */
|
||||
function generateTsDefFor (importDefinitions: { [importPath: string]: Record<string, ModuleTypes> }, defName: string, { types }: { types: Record<string, any> }, outputDir: string): void {
|
||||
function generateTsDefFor (registry: Registry, importDefinitions: { [importPath: string]: Record<string, ModuleTypes> }, defName: string, { types }: { types: Record<string, any> }, outputDir: string): void {
|
||||
const imports = { ...createImports(importDefinitions, { types }), interfaces: [] } as Imports;
|
||||
const definitions = imports.definitions;
|
||||
const interfaces = generateInterfaces(definitions, { types }, imports);
|
||||
const interfaces = generateInterfaces(registry, definitions, { types }, imports);
|
||||
const items = interfaces.sort((a, b): number => a[0].localeCompare(b[0])).map(([, definition]): string => definition);
|
||||
|
||||
const importTypes = [
|
||||
@@ -233,13 +243,15 @@ function generateTsDefFor (importDefinitions: { [importPath: string]: Record<str
|
||||
|
||||
/** @internal */
|
||||
export function generateTsDef (importDefinitions: { [importPath: string]: Record<string, ModuleTypes> }, outputDir: string, generatingPackage: string): void {
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
writeFile(path.join(outputDir, 'types.ts'), (): string => {
|
||||
const definitions = importDefinitions[generatingPackage];
|
||||
|
||||
Object.entries(definitions).forEach(([defName, obj]): void => {
|
||||
console.log(`\tExtracting interfaces for ${defName}`);
|
||||
|
||||
generateTsDefFor(importDefinitions, defName, obj, outputDir);
|
||||
generateTsDefFor(registry, importDefinitions, defName, obj, outputDir);
|
||||
});
|
||||
|
||||
return generateTsDefTypesTemplate({
|
||||
|
||||
@@ -37,14 +37,12 @@ function generateForMeta (registry: Registry, meta: Metadata, dest: string, extr
|
||||
}, {});
|
||||
|
||||
const modules = meta.asLatest.modules
|
||||
.sort(compareName)
|
||||
.filter(({ calls }) => calls.unwrapOr([]).length !== 0)
|
||||
.map(({ calls, name }) => {
|
||||
setImports(allDefs, imports, ['Call', 'Extrinsic', 'SubmittableExtrinsic']);
|
||||
|
||||
const items = calls.unwrap()
|
||||
.sort(compareName)
|
||||
.map(({ args, documentation, name }) => {
|
||||
.map(({ args, docs, name }) => {
|
||||
const params = args
|
||||
.map(({ name, type }) => {
|
||||
const typeStr = type.toString();
|
||||
@@ -57,36 +55,36 @@ function generateForMeta (registry: Registry, meta: Metadata, dest: string, extr
|
||||
.join(', ');
|
||||
|
||||
return {
|
||||
args: args.map(({ type }) => formatType(allDefs, type.toString(), imports)).join(', '),
|
||||
docs: documentation,
|
||||
args: args.map(({ type }) => formatType(registry, allDefs, type.toString(), imports)).join(', '),
|
||||
docs,
|
||||
name: stringCamelCase(name),
|
||||
params
|
||||
};
|
||||
});
|
||||
})
|
||||
.sort(compareName);
|
||||
|
||||
return {
|
||||
items,
|
||||
name: stringCamelCase(name)
|
||||
};
|
||||
});
|
||||
|
||||
const types = [
|
||||
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
|
||||
file: packagePath,
|
||||
types: Object.keys(imports.localTypes[packagePath])
|
||||
})),
|
||||
{
|
||||
file: '@polkadot/api/types',
|
||||
types: ['ApiTypes', 'SubmittableExtrinsic']
|
||||
}
|
||||
];
|
||||
})
|
||||
.sort(compareName);
|
||||
|
||||
return generateForMetaTemplate({
|
||||
headerType: 'chain',
|
||||
imports,
|
||||
isStrict,
|
||||
modules,
|
||||
types
|
||||
types: [
|
||||
...Object.keys(imports.localTypes).sort().map((packagePath): { file: string; types: string[] } => ({
|
||||
file: packagePath,
|
||||
types: Object.keys(imports.localTypes[packagePath])
|
||||
})),
|
||||
{
|
||||
file: '@polkadot/api/types',
|
||||
types: ['ApiTypes', 'SubmittableExtrinsic']
|
||||
}
|
||||
]
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import fs from 'fs';
|
||||
import { GenericCall as Call, Metadata, TypeRegistry, Vec } from '@polkadot/types';
|
||||
import * as definitions from '@polkadot/types/interfaces/definitions';
|
||||
import { getStorage as getSubstrateStorage } from '@polkadot/types/metadata/decorate/storage/getStorage';
|
||||
import rpcdata from '@polkadot/types/metadata/static';
|
||||
import rpcdata from '@polkadot/types/metadata/static-substrate';
|
||||
import { Text } from '@polkadot/types/primitive';
|
||||
import { unwrapStorageType } from '@polkadot/types/primitive/StorageKey';
|
||||
import { stringCamelCase, stringLowerFirst } from '@polkadot/util';
|
||||
@@ -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
|
||||
@@ -211,12 +211,12 @@ function addStorage (metadata: MetadataLatest): string {
|
||||
? ('`' + func.type.asNMap.keyVec.map((k) => k.toString()).join(', ') + '`')
|
||||
: '';
|
||||
const methodName = stringLowerFirst(func.name);
|
||||
const outputType = unwrapStorageType(func.type, func.modifier.isOptional);
|
||||
const outputType = unwrapStorageType(metadata.registry, func.type, func.modifier.isOptional);
|
||||
|
||||
return {
|
||||
interface: '`' + `api.query.${sectionName}.${methodName}` + '`',
|
||||
name: `${methodName}(${arg}): ` + '`' + outputType + '`',
|
||||
...(func.documentation.length && { summary: func.documentation })
|
||||
...(func.docs.length && { summary: func.docs })
|
||||
};
|
||||
}),
|
||||
name: sectionName
|
||||
@@ -234,12 +234,12 @@ function addStorage (metadata: MetadataLatest): string {
|
||||
? ('`' + meta.type.asDoubleMap.key1.toString() + ', ' + meta.type.asDoubleMap.key2.toString() + '`')
|
||||
: '';
|
||||
const methodName = stringLowerFirst(name);
|
||||
const outputType = unwrapStorageType(meta.type, meta.modifier.isOptional);
|
||||
const outputType = unwrapStorageType(metadata.registry, meta.type, meta.modifier.isOptional);
|
||||
|
||||
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)
|
||||
})),
|
||||
|
||||
@@ -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.3.2' };
|
||||
|
||||
@@ -10,7 +10,7 @@ import { ClassOfUnsafe, getTypeDef } from '@polkadot/types/create';
|
||||
import { TypeDefInfo } from '@polkadot/types/create/types';
|
||||
import { GenericAccountId, GenericLookupSource, GenericVote } from '@polkadot/types/generic';
|
||||
import { AllConvictions } from '@polkadot/types/interfaces/democracy/definitions';
|
||||
import { Null } from '@polkadot/types/primitive';
|
||||
import { bool, Null } from '@polkadot/types/primitive';
|
||||
import * as primitiveClasses from '@polkadot/types/primitive';
|
||||
import { isChildClass, stringify } from '@polkadot/util';
|
||||
|
||||
@@ -28,7 +28,10 @@ const voteConvictions = arrayToStrType(AllConvictions);
|
||||
/** @internal */
|
||||
export function getDerivedTypes (registry: Registry, definitions: Record<string, ModuleTypes>, type: string, primitiveName: string, imports: TypeImports): string[] {
|
||||
// `primitiveName` represents the actual primitive type our type is mapped to
|
||||
const isCompact = isCompactEncodable((primitiveClasses as Record<string, any>)[primitiveName] || ClassOfUnsafe(registry, type));
|
||||
const isCompact = isCompactEncodable(
|
||||
(primitiveClasses as Record<string, any>)[primitiveName] ||
|
||||
ClassOfUnsafe(registry, type)
|
||||
);
|
||||
const def = getTypeDef(type);
|
||||
|
||||
setImports(definitions, imports, ['Option', 'Vec', isCompact ? 'Compact' : '']);
|
||||
@@ -54,7 +57,7 @@ export function getDerivedTypes (registry: Registry, definitions: Record<string,
|
||||
});
|
||||
}
|
||||
|
||||
const result = types.map((t) => formatType(definitions, t, imports)).map((t) => `'${t}': ${t};`);
|
||||
const result = types.map((t) => formatType(registry, definitions, t, imports)).map((t) => `'${t}': ${t};`);
|
||||
|
||||
result.unshift(`${type}: ${type};`);
|
||||
|
||||
@@ -68,7 +71,7 @@ export function getDerivedTypes (registry: Registry, definitions: Record<string,
|
||||
export function getSimilarTypes (registry: Registry, definitions: Record<string, ModuleTypes>, _type: string, imports: TypeImports): string[] {
|
||||
const typeParts = _type.split('::');
|
||||
const type = typeParts[typeParts.length - 1];
|
||||
const possibleTypes = [formatType(definitions, type, imports)];
|
||||
const possibleTypes = [formatType(registry, definitions, type, imports)];
|
||||
|
||||
if (type === 'Extrinsic') {
|
||||
setImports(definitions, imports, ['IExtrinsic']);
|
||||
@@ -121,7 +124,7 @@ export function getSimilarTypes (registry: Registry, definitions: Record<string,
|
||||
possibleTypes.push('Address', 'AccountId', 'AccountIndex', 'LookupSource', 'string', 'Uint8Array');
|
||||
} else if (isChildClass(GenericAccountId, Clazz)) {
|
||||
possibleTypes.push('string', 'Uint8Array');
|
||||
} else if (isChildClass(registry.createClass('bool'), Clazz)) {
|
||||
} else if (isChildClass(bool, Clazz)) {
|
||||
possibleTypes.push('boolean', 'Uint8Array');
|
||||
} else if (isChildClass(Null, Clazz)) {
|
||||
possibleTypes.push('null');
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
// Copyright 2017-2021 @polkadot/typegen authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { TypeRegistry } from '@polkadot/types';
|
||||
|
||||
import { formatType } from './formatting';
|
||||
|
||||
describe('formatType', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
it('handles nested Tuples', (): void => {
|
||||
expect(
|
||||
formatType({}, '(AccountId, (Balance, u32), u64)', {
|
||||
formatType(registry, {}, '(AccountId, (Balance, u32), u64)', {
|
||||
codecTypes: {},
|
||||
definitions: {},
|
||||
extrinsicTypes: {},
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
// Copyright 2017-2021 @polkadot/typegen authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
|
||||
import type { TypeDef } from '@polkadot/types/create/types';
|
||||
import type { Registry } from '@polkadot/types/types';
|
||||
|
||||
import Handlebars from 'handlebars';
|
||||
|
||||
@@ -83,92 +86,138 @@ export function exportType (name = '', base: string): string {
|
||||
return exportInterface(name, base);
|
||||
}
|
||||
|
||||
/**
|
||||
* Given the inner `K` & `V`, return a `BTreeMap<K, V>` string
|
||||
*/
|
||||
/** @internal */
|
||||
function formatBTreeMap (key: string, val: string): string {
|
||||
return `BTreeMap<${key}, ${val}>`;
|
||||
}
|
||||
const formatters: Record<TypeDefInfo, (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => string> = {
|
||||
[TypeDefInfo.Compact]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
setImports(definitions, imports, ['Compact']);
|
||||
|
||||
/**
|
||||
* Given the inner `V`, return a `BTreeSet<V>` string
|
||||
*/
|
||||
/** @internal */
|
||||
function formatBTreeSet (val: string): string {
|
||||
return `BTreeSet<${val}>`;
|
||||
}
|
||||
const sub = typeDef.sub as TypeDef;
|
||||
|
||||
/**
|
||||
* Given the inner `T`, return a `Compact<T>` string
|
||||
*/
|
||||
/** @internal */
|
||||
function formatCompact (inner: string): string {
|
||||
return paramsNotation('Compact', inner);
|
||||
}
|
||||
return paramsNotation('Compact', formatType(registry, definitions, sub.lookupName || sub.type, imports, withShortcut));
|
||||
},
|
||||
[TypeDefInfo.DoNotConstruct]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
setImports(definitions, imports, ['DoNotConstruct']);
|
||||
|
||||
/**
|
||||
* Simple return
|
||||
*/
|
||||
/** @internal */
|
||||
function formatDoNoConstruct (): string {
|
||||
return 'DoNotConstruct';
|
||||
}
|
||||
return 'DoNotConstruct';
|
||||
},
|
||||
[TypeDefInfo.Enum]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
if (typeDef.lookupName) {
|
||||
return typeDef.lookupName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given the inner `K` & `V`, return a `BTreeMap<K, V>` string
|
||||
*/
|
||||
/** @internal */
|
||||
function formatHashMap (key: string, val: string): string {
|
||||
return `HashMap<${key}, ${val}>`;
|
||||
}
|
||||
throw new Error(`TypeDefInfo.Enum: Not implemented on ${stringify(typeDef)}`);
|
||||
},
|
||||
[TypeDefInfo.Int]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
throw new Error(`TypeDefInfo.Int: Not implemented on ${stringify(typeDef)}`);
|
||||
},
|
||||
[TypeDefInfo.UInt]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
throw new Error(`TypeDefInfo.UInt: Not implemented on ${stringify(typeDef)}`);
|
||||
},
|
||||
[TypeDefInfo.Null]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
setImports(definitions, imports, ['Null']);
|
||||
|
||||
/**
|
||||
* Given the inner `T`, return a `Vec<T>` string
|
||||
*/
|
||||
/** @internal */
|
||||
function formatLinkage (inner: string): string {
|
||||
return paramsNotation('Linkage', inner);
|
||||
}
|
||||
return 'Null';
|
||||
},
|
||||
[TypeDefInfo.Option]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
setImports(definitions, imports, ['Option']);
|
||||
|
||||
/**
|
||||
* Given the inner `O` & `E`, return a `Result<O, E>` string
|
||||
*/
|
||||
/** @internal */
|
||||
function formatResult (innerOk: string, innerError: string): string {
|
||||
return `Result<${innerOk}, ${innerError}>`;
|
||||
}
|
||||
const sub = (typeDef.sub as TypeDef);
|
||||
|
||||
/**
|
||||
* Given the inner `T`, return a `Option<T>` string
|
||||
*/
|
||||
/** @internal */
|
||||
function formatOption (inner: string): string {
|
||||
return paramsNotation('Option', inner);
|
||||
}
|
||||
return paramsNotation('Option', formatType(registry, definitions, sub.lookupName || sub.type, imports, withShortcut));
|
||||
},
|
||||
[TypeDefInfo.Plain]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
setImports(definitions, imports, [typeDef.type]);
|
||||
|
||||
/**
|
||||
* Given the inners `T[]`, return a `ITuple<...T>` string
|
||||
*/
|
||||
/** @internal */
|
||||
function formatTuple (inners: string[]): string {
|
||||
return paramsNotation('ITuple', `[${inners.join(', ')}]`);
|
||||
}
|
||||
return typeDef.type;
|
||||
},
|
||||
[TypeDefInfo.Set]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
throw new Error(`TypeDefInfo.Set: Not implemented on ${stringify(typeDef)}`);
|
||||
},
|
||||
[TypeDefInfo.Si]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
return formatType(registry, definitions, registry.lookup.getTypeDef(typeDef.type), imports, withShortcut);
|
||||
},
|
||||
[TypeDefInfo.Struct]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
setImports(definitions, imports, ['Struct']);
|
||||
|
||||
/**
|
||||
* Given the inner `T`, return a `Vec<T>` string
|
||||
*/
|
||||
/** @internal */
|
||||
function formatVec (inner: string): string {
|
||||
return paramsNotation('Vec', inner);
|
||||
}
|
||||
return `{${withShortcut ? ' ' : '\n'}${
|
||||
((typeDef.sub as TypeDef[]).map(({ lookupName, name, type }, index) => [
|
||||
name || `unknown${index}`,
|
||||
formatType(registry, definitions, lookupName || type, imports, withShortcut)
|
||||
])).map(([k, t]) => `${withShortcut ? '' : ' readonly '}${k}: ${t};`).join(withShortcut ? ' ' : '\n')
|
||||
}${withShortcut ? ' ' : '\n '}} & Struct`;
|
||||
},
|
||||
[TypeDefInfo.Tuple]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
setImports(definitions, imports, ['ITuple']);
|
||||
|
||||
// `(a,b)` gets transformed into `ITuple<[a, b]>`
|
||||
return paramsNotation('ITuple', `[${
|
||||
((typeDef.sub as TypeDef[]).map(({ lookupName, type }) =>
|
||||
formatType(registry, definitions, lookupName || type, imports, withShortcut)
|
||||
)).join(', ')
|
||||
}]`);
|
||||
},
|
||||
[TypeDefInfo.Vec]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
setImports(definitions, imports, ['Vec']);
|
||||
|
||||
const sub = (typeDef.sub as TypeDef);
|
||||
|
||||
return paramsNotation('Vec', formatType(registry, definitions, sub.lookupName || sub.type, imports, withShortcut));
|
||||
},
|
||||
[TypeDefInfo.VecFixed]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
const sub = (typeDef.sub as TypeDef);
|
||||
|
||||
if (sub.type === 'u8') {
|
||||
setImports(definitions, imports, ['U8aFixed']);
|
||||
|
||||
return 'U8aFixed';
|
||||
}
|
||||
|
||||
setImports(definitions, imports, ['Vec']);
|
||||
|
||||
return paramsNotation('Vec', formatType(registry, definitions, sub.lookupName || sub.type, imports, withShortcut));
|
||||
},
|
||||
[TypeDefInfo.BTreeMap]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
setImports(definitions, imports, ['BTreeMap']);
|
||||
|
||||
const [keyDef, valDef] = (typeDef.sub as TypeDef[]);
|
||||
|
||||
return `BTreeMap<${formatType(registry, definitions, keyDef.lookupName || keyDef.type, imports, withShortcut)}, ${formatType(registry, definitions, valDef.lookupName || valDef.type, imports, withShortcut)}>`;
|
||||
},
|
||||
[TypeDefInfo.BTreeSet]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
setImports(definitions, imports, ['BTreeSet']);
|
||||
|
||||
const valDef = typeDef.sub as TypeDef;
|
||||
|
||||
return `BTreeSet<${formatType(registry, definitions, valDef.lookupName || valDef.type, imports, withShortcut)}>`;
|
||||
},
|
||||
[TypeDefInfo.HashMap]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
setImports(definitions, imports, ['HashMap']);
|
||||
|
||||
const [keyDef, valDef] = (typeDef.sub as TypeDef[]);
|
||||
|
||||
return `HashMap<${formatType(registry, definitions, keyDef.lookupName || keyDef.type, imports, withShortcut)}, ${formatType(registry, definitions, valDef.lookupName || valDef.type, imports, withShortcut)}>`;
|
||||
},
|
||||
[TypeDefInfo.Linkage]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
setImports(definitions, imports, ['Linkage']);
|
||||
|
||||
const sub = (typeDef.sub as TypeDef);
|
||||
|
||||
return paramsNotation('Linkage', formatType(registry, definitions, sub.lookupName || sub.type, imports, withShortcut));
|
||||
},
|
||||
[TypeDefInfo.Result]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
|
||||
setImports(definitions, imports, ['Result']);
|
||||
|
||||
const [okDef, errDef] = (typeDef.sub as TypeDef[]);
|
||||
|
||||
return `Result<${formatType(registry, definitions, okDef.lookupName || okDef.type, imports, withShortcut)}, ${formatType(registry, definitions, errDef.lookupName || errDef.type, imports, withShortcut)}>`;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Correctly format a given type
|
||||
*/
|
||||
/** @internal */
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
export function formatType (definitions: Record<string, ModuleTypes>, type: string | String | TypeDef, imports: TypeImports): string {
|
||||
export function formatType (registry: Registry, definitions: Record<string, ModuleTypes>, type: string | String | TypeDef, imports: TypeImports, withShortcut = false): string {
|
||||
let typeDef: TypeDef;
|
||||
|
||||
if (isString(type)) {
|
||||
@@ -176,7 +225,7 @@ export function formatType (definitions: Record<string, ModuleTypes>, type: stri
|
||||
|
||||
// If type is "unorthodox" (i.e. `{ something: any }` for an Enum input or `[a | b | c, d | e | f]` for a Tuple's similar types),
|
||||
// we return it as-is
|
||||
if (/(^{.+:.+})|^\([^,]+\)|^\(.+\)\[\]|^\[.+\]/.exec(_type) && !/\[\w+;\w+\]/.exec(_type)) {
|
||||
if (withShortcut && /(^{.+:.+})|^\([^,]+\)|^\(.+\)\[\]|^\[.+\]/.exec(_type) && !/\[\w+;\w+\]/.exec(_type)) {
|
||||
return _type;
|
||||
}
|
||||
|
||||
@@ -187,101 +236,5 @@ export function formatType (definitions: Record<string, ModuleTypes>, type: stri
|
||||
|
||||
setImports(definitions, imports, [typeDef.type]);
|
||||
|
||||
// FIXME Swap to Record<TypeDefInfo, fn> to check all types
|
||||
switch (typeDef.info) {
|
||||
case TypeDefInfo.Compact: {
|
||||
setImports(definitions, imports, ['Compact']);
|
||||
|
||||
return formatCompact(formatType(definitions, (typeDef.sub as TypeDef).type, imports));
|
||||
}
|
||||
|
||||
case TypeDefInfo.DoNotConstruct: {
|
||||
setImports(definitions, imports, ['DoNotConstruct']);
|
||||
|
||||
return formatDoNoConstruct();
|
||||
}
|
||||
|
||||
case TypeDefInfo.Option: {
|
||||
setImports(definitions, imports, ['Option']);
|
||||
|
||||
return formatOption(formatType(definitions, (typeDef.sub as TypeDef).type, imports));
|
||||
}
|
||||
|
||||
case TypeDefInfo.Plain: {
|
||||
return typeDef.type;
|
||||
}
|
||||
|
||||
case TypeDefInfo.Vec: {
|
||||
setImports(definitions, imports, ['Vec']);
|
||||
|
||||
return formatVec(formatType(definitions, (typeDef.sub as TypeDef).type, imports));
|
||||
}
|
||||
|
||||
case TypeDefInfo.Tuple: {
|
||||
setImports(definitions, imports, ['ITuple']);
|
||||
|
||||
// `(a,b)` gets transformed into `ITuple<[a, b]>`
|
||||
return formatTuple(
|
||||
((typeDef.sub as TypeDef[]).map((sub) => formatType(definitions, sub.type, imports)))
|
||||
);
|
||||
}
|
||||
|
||||
case TypeDefInfo.VecFixed: {
|
||||
const type = (typeDef.sub as TypeDef).type;
|
||||
|
||||
if (type === 'u8') {
|
||||
setImports(definitions, imports, ['U8aFixed']);
|
||||
|
||||
return 'U8aFixed';
|
||||
}
|
||||
|
||||
setImports(definitions, imports, ['Vec']);
|
||||
|
||||
return formatVec(formatType(definitions, type, imports));
|
||||
}
|
||||
|
||||
case TypeDefInfo.BTreeMap: {
|
||||
setImports(definitions, imports, ['BTreeMap']);
|
||||
|
||||
const [keyDef, valDef] = (typeDef.sub as TypeDef[]);
|
||||
|
||||
return formatBTreeMap(formatType(definitions, keyDef.type, imports), formatType(definitions, valDef.type, imports));
|
||||
}
|
||||
|
||||
case TypeDefInfo.BTreeSet: {
|
||||
setImports(definitions, imports, ['BTreeSet']);
|
||||
|
||||
const valDef = typeDef.sub as TypeDef;
|
||||
|
||||
return formatBTreeSet(formatType(definitions, valDef.type, imports));
|
||||
}
|
||||
|
||||
case TypeDefInfo.HashMap: {
|
||||
setImports(definitions, imports, ['HashMap']);
|
||||
|
||||
const [keyDef, valDef] = (typeDef.sub as TypeDef[]);
|
||||
|
||||
return formatHashMap(formatType(definitions, keyDef.type, imports), formatType(definitions, valDef.type, imports));
|
||||
}
|
||||
|
||||
case TypeDefInfo.Linkage: {
|
||||
const type = (typeDef.sub as TypeDef).type;
|
||||
|
||||
setImports(definitions, imports, ['Linkage']);
|
||||
|
||||
return formatLinkage(formatType(definitions, type, imports));
|
||||
}
|
||||
|
||||
case TypeDefInfo.Result: {
|
||||
setImports(definitions, imports, ['Result']);
|
||||
|
||||
const [okDef, errorDef] = (typeDef.sub as TypeDef[]);
|
||||
|
||||
return formatResult(formatType(definitions, okDef.type, imports), formatType(definitions, errorDef.type, imports));
|
||||
}
|
||||
|
||||
default: {
|
||||
throw new Error(`Cannot format ${stringify(type)}`);
|
||||
}
|
||||
}
|
||||
return formatters[typeDef.info](registry, typeDef, definitions, imports, withShortcut);
|
||||
}
|
||||
|
||||
@@ -64,10 +64,10 @@ export function setImports (allDefs: Record<string, ModuleTypes>, imports: TypeI
|
||||
|
||||
// TypeDef.sub is a `TypeDef | TypeDef[]`
|
||||
if (Array.isArray(typeDef.sub)) {
|
||||
typeDef.sub.forEach((subType) => setImports(allDefs, imports, [subType.type]));
|
||||
typeDef.sub.forEach((subType) => setImports(allDefs, imports, [subType.lookupName || subType.type]));
|
||||
} else if (typeDef.sub && (typeDef.info !== TypeDefInfo.VecFixed || typeDef.sub.type !== 'u8')) {
|
||||
// typeDef.sub is a TypeDef in this case
|
||||
setImports(allDefs, imports, [typeDef.sub.type]);
|
||||
setImports(allDefs, imports, [typeDef.sub.lookupName || typeDef.sub.type]);
|
||||
}
|
||||
} else if (type.includes('[') && type.includes('|')) {
|
||||
// We split the types (we already dod the check above, so safe-path should not be caught)
|
||||
|
||||
@@ -9,5 +9,8 @@ export * from './imports';
|
||||
export * from './initMeta';
|
||||
export * from './register';
|
||||
|
||||
export const compareName = (a: { name: { toString(): string } }, b: { name: { toString(): string } }): number =>
|
||||
a.name.toString().localeCompare(b.name.toString());
|
||||
type Cmp = { name: { toString(): string } };
|
||||
|
||||
export function compareName (a: Cmp, b: Cmp): number {
|
||||
return a.name.toString().localeCompare(b.name.toString());
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import type { ExtraTypes } from '../generate/types';
|
||||
|
||||
import { Metadata, TypeRegistry } from '@polkadot/types';
|
||||
import staticData from '@polkadot/types/metadata/static';
|
||||
import staticData from '@polkadot/types/metadata/static-substrate';
|
||||
|
||||
import { registerDefinitions } from './register';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/types-known",
|
||||
"version": "5.0.1",
|
||||
"version": "5.3.2",
|
||||
"type": "module",
|
||||
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
|
||||
"main": "index.js",
|
||||
@@ -19,9 +19,9 @@
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"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"
|
||||
"@babel/runtime": "^7.14.8",
|
||||
"@polkadot/networks": "^7.1.1",
|
||||
"@polkadot/types": "5.3.2",
|
||||
"@polkadot/util": "^7.1.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import typesModules from './modules';
|
||||
import typesSpec from './spec';
|
||||
import upgrades from './upgrades';
|
||||
|
||||
export { knownOrigins } from './knownOrigins';
|
||||
export { packageInfo } from './packageInfo';
|
||||
|
||||
// flatten a VersionedType[] into a Record<string, string>
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// We want predictive ordering (manually managed)
|
||||
/* eslint-disable sort-keys */
|
||||
|
||||
// FIXME: Need some sort of solution for specifying these
|
||||
// Since we don't have insight into the origin specification, we can only define what we know about
|
||||
// in a pure Substrate/Polkadot implementation, any other custom origins won't be handled at all
|
||||
export const knownOrigins: Record<string, string> = {
|
||||
//
|
||||
// (1) Defaults from Substrate
|
||||
//
|
||||
Council: 'CollectiveOrigin',
|
||||
System: 'SystemOrigin',
|
||||
TechnicalCommittee: 'CollectiveOrigin',
|
||||
//
|
||||
// (2) Defaults from Polkadot
|
||||
//
|
||||
Xcm: 'XcmOrigin',
|
||||
XcmPallet: 'XcmOrigin',
|
||||
//
|
||||
// (3) Defaults from Acala
|
||||
//
|
||||
Authority: 'AuthorityOrigin',
|
||||
GeneralCouncil: 'CollectiveOrigin'
|
||||
};
|
||||
@@ -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.3.2' };
|
||||
|
||||
@@ -13,7 +13,7 @@ const upgrades: ChainUpgradesRaw = [
|
||||
[2962294, 2012], [3240000, 2013], [3274408, 2015], [3323565, 2019], [3534175, 2022],
|
||||
[3860281, 2023], [4143129, 2024], [4401242, 2025], [4841367, 2026], [5961600, 2027],
|
||||
[6137912, 2028], [6561855, 2029], [7100891, 2030], [7468792, 9010], [7668600, 9030],
|
||||
[7812476, 9040], [8010981, 9050], [8073833, 9070]
|
||||
[7812476, 9040], [8010981, 9050], [8073833, 9070], [8555825, 9080]
|
||||
];
|
||||
|
||||
export default upgrades;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@polkadot/types",
|
||||
"version": "5.0.1",
|
||||
"version": "5.3.2",
|
||||
"type": "module",
|
||||
"description": "Implementation of the Parity codec",
|
||||
"main": "index.js",
|
||||
@@ -19,13 +19,13 @@
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"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",
|
||||
"@babel/runtime": "^7.14.8",
|
||||
"@polkadot/util": "^7.1.1",
|
||||
"@polkadot/util-crypto": "^7.1.1",
|
||||
"rxjs": "^7.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^7.0.1",
|
||||
"@polkadot/keyring": "^7.1.1",
|
||||
"@types/bn.js": "^4.11.6",
|
||||
"bn.js": "^4.11.9"
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import type { UncleEntryItem } from '@polkadot/types/interfaces/authorship';
|
||||
import type { AllowedSlots, BabeAuthorityWeight, BabeBlockWeight, BabeEpochConfiguration, BabeEquivocationProof, BabeWeight, EpochAuthorship, MaybeRandomness, MaybeVrf, NextConfigDescriptor, NextConfigDescriptorV1, Randomness, RawBabePreDigest, RawBabePreDigestCompat, RawBabePreDigestPrimary, RawBabePreDigestPrimaryTo159, RawBabePreDigestSecondaryPlain, RawBabePreDigestSecondaryTo159, RawBabePreDigestSecondaryVRF, RawBabePreDigestTo159, SlotNumber, VrfData, VrfOutput, VrfProof } from '@polkadot/types/interfaces/babe';
|
||||
import type { AccountData, BalanceLock, BalanceLockTo212, BalanceStatus, Reasons, ReserveData, ReserveIdentifier, VestingSchedule, WithdrawReasons } from '@polkadot/types/interfaces/balances';
|
||||
import type { BeefyCommitment, BeefyId, BeefyNextAuthoritySet, BeefyPayload, BeefySignedCommitment, MmrRootHash, ValidatorSetId } from '@polkadot/types/interfaces/beefy';
|
||||
import type { BridgedBlockHash, BridgedBlockNumber, BridgedHeader, InitializationData } from '@polkadot/types/interfaces/bridges';
|
||||
import type { BridgedBlockHash, BridgedBlockNumber, BridgedHeader, CallOrigin, ChainId, DeliveredMessages, DispatchFeePayment, InboundLaneData, InboundRelayer, InitializationData, LaneId, MessageData, MessageKey, MessageNonce, MessagesDeliveryProofOf, MessagesProofOf, OperatingMode, OutboundLaneData, OutboundMessageFee, OutboundPayload, Parameter, RelayerId, UnrewardedRelayer, UnrewardedRelayersState } from '@polkadot/types/interfaces/bridges';
|
||||
import type { BlockHash } from '@polkadot/types/interfaces/chain';
|
||||
import type { PrefixedStorageKey } from '@polkadot/types/interfaces/childstate';
|
||||
import type { EthereumAddress, StatementKind } from '@polkadot/types/interfaces/claims';
|
||||
@@ -25,30 +25,30 @@ import type { ApprovalFlag, DefunctVoter, Renouncing, SetIndex, Vote, VoteIndex,
|
||||
import type { CreatedBlock, ImportedAux } from '@polkadot/types/interfaces/engine';
|
||||
import type { EthAccount, EthBlock, EthBloom, EthCallRequest, EthFilter, EthFilterAddress, EthFilterChanges, EthFilterTopic, EthFilterTopicEntry, EthFilterTopicInner, EthHeader, EthLog, EthReceipt, EthRichBlock, EthRichHeader, EthStorageProof, EthSubKind, EthSubParams, EthSubResult, EthSyncInfo, EthSyncStatus, EthTransaction, EthTransactionAction, EthTransactionCondition, EthTransactionRequest, EthTransactionSignature, EthTransactionStatus, EthWork, EthereumAccountId, EthereumLookupSource, EthereumSignature } from '@polkadot/types/interfaces/eth';
|
||||
import type { EvmAccount, EvmLog, EvmVicinity, ExitError, ExitFatal, ExitReason, ExitRevert, ExitSucceed } from '@polkadot/types/interfaces/evm';
|
||||
import type { AnySignature, EcdsaSignature, Ed25519Signature, Extrinsic, ExtrinsicEra, ExtrinsicPayload, ExtrinsicPayloadUnknown, ExtrinsicPayloadV4, ExtrinsicSignature, ExtrinsicSignatureV4, ExtrinsicUnknown, ExtrinsicV4, ImmortalEra, MortalEra, MultiSignature, Signature, SignerPayload, Sr25519Signature } from '@polkadot/types/interfaces/extrinsics';
|
||||
import type { AnySignature, EcdsaSignature, Ed25519Signature, Era, Extrinsic, ExtrinsicEra, ExtrinsicPayload, ExtrinsicPayloadUnknown, ExtrinsicPayloadV4, ExtrinsicSignature, ExtrinsicSignatureV4, ExtrinsicUnknown, ExtrinsicV4, ImmortalEra, MortalEra, MultiSignature, Signature, SignerPayload, Sr25519Signature } from '@polkadot/types/interfaces/extrinsics';
|
||||
import type { AssetOptions, Owner, PermissionLatest, PermissionVersions, PermissionsV1 } from '@polkadot/types/interfaces/genericAsset';
|
||||
import type { ActiveGilt, ActiveGiltsTotal, ActiveIndex, GiltBid } from '@polkadot/types/interfaces/gilt';
|
||||
import type { AuthorityIndex, AuthorityList, AuthoritySet, AuthoritySetChange, AuthoritySetChanges, AuthorityWeight, DelayKind, DelayKindBest, EncodedFinalityProofs, ForkTreePendingChange, ForkTreePendingChangeNode, GrandpaCommit, GrandpaEquivocation, GrandpaEquivocationProof, GrandpaEquivocationValue, GrandpaJustification, GrandpaPrecommit, GrandpaPrevote, GrandpaSignedPrecommit, JustificationNotification, KeyOwnerProof, NextAuthority, PendingChange, PendingPause, PendingResume, Precommits, Prevotes, ReportedRoundStates, RoundState, SetId, StoredPendingChange, StoredState } from '@polkadot/types/interfaces/grandpa';
|
||||
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, ErrorMetadataV14, ErrorMetadataV9, EventMetadataLatest, EventMetadataV10, EventMetadataV11, EventMetadataV12, EventMetadataV13, EventMetadataV14, EventMetadataV9, ExtrinsicMetadataLatest, ExtrinsicMetadataV11, ExtrinsicMetadataV12, ExtrinsicMetadataV13, ExtrinsicMetadataV14, FunctionArgumentMetadataLatest, FunctionArgumentMetadataV10, FunctionArgumentMetadataV11, FunctionArgumentMetadataV12, FunctionArgumentMetadataV13, FunctionArgumentMetadataV14, FunctionArgumentMetadataV9, FunctionMetadataLatest, FunctionMetadataV10, FunctionMetadataV11, FunctionMetadataV12, FunctionMetadataV13, FunctionMetadataV14, 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';
|
||||
import type { ActiveEraInfo, CompactAssignments, CompactAssignmentsTo257, CompactAssignmentsTo265, CompactAssignmentsWith16, CompactAssignmentsWith24, CompactScore, CompactScoreCompact, ElectionCompute, ElectionPhase, ElectionResult, ElectionScore, ElectionSize, ElectionStatus, EraIndex, EraPoints, EraRewardPoints, EraRewards, Exposure, ExtendedBalance, Forcing, IndividualExposure, KeyType, MomentOf, Nominations, NominatorIndex, NominatorIndexCompact, OffchainAccuracy, OffchainAccuracyCompact, PhragmenScore, Points, RawSolution, RawSolutionTo265, RawSolutionWith16, RawSolutionWith24, ReadySolution, RewardDestination, RewardPoint, RoundSnapshot, SeatHolder, SignedSubmission, SignedSubmissionOf, SlashJournalEntry, SlashingSpans, SlashingSpansTo204, SolutionOrSnapshotSize, SolutionSupport, SolutionSupports, SpanIndex, SpanRecord, StakingLedger, StakingLedgerTo223, StakingLedgerTo240, SubmissionIndicesOf, Supports, UnappliedSlash, UnappliedSlashOther, UnlockChunk, ValidatorIndex, ValidatorIndexCompact, ValidatorPrefs, ValidatorPrefsTo145, ValidatorPrefsTo196, ValidatorPrefsWithBlocked, ValidatorPrefsWithCommission, VoteWeight, Voter } from '@polkadot/types/interfaces/staking';
|
||||
import type { ActiveEraInfo, CompactAssignments, CompactAssignmentsTo257, CompactAssignmentsTo265, CompactAssignmentsWith16, CompactAssignmentsWith24, CompactScore, CompactScoreCompact, ElectionCompute, ElectionPhase, ElectionResult, ElectionScore, ElectionSize, ElectionStatus, EraIndex, EraPoints, EraRewardPoints, EraRewards, Exposure, ExtendedBalance, Forcing, IndividualExposure, KeyType, MomentOf, Nominations, NominatorIndex, NominatorIndexCompact, OffchainAccuracy, OffchainAccuracyCompact, PhragmenScore, Points, RawSolution, RawSolutionTo265, RawSolutionWith16, RawSolutionWith24, ReadySolution, RewardDestination, RewardPoint, RoundSnapshot, SeatHolder, SignedSubmission, SignedSubmissionOf, SignedSubmissionTo276, SlashJournalEntry, SlashingSpans, SlashingSpansTo204, SolutionOrSnapshotSize, SolutionSupport, SolutionSupports, SpanIndex, SpanRecord, StakingLedger, StakingLedgerTo223, StakingLedgerTo240, SubmissionIndicesOf, Supports, UnappliedSlash, UnappliedSlashOther, UnlockChunk, ValidatorIndex, ValidatorIndexCompact, ValidatorPrefs, ValidatorPrefsTo145, ValidatorPrefsTo196, ValidatorPrefsWithBlocked, ValidatorPrefsWithCommission, VoteWeight, Voter } from '@polkadot/types/interfaces/staking';
|
||||
import type { ApiId, BlockTrace, BlockTraceEvent, BlockTraceEventData, BlockTraceSpan, KeyValueOption, ReadProof, RuntimeVersion, RuntimeVersionApi, RuntimeVersionPartial, StorageChangeSet, TraceBlockResponse, TraceError } from '@polkadot/types/interfaces/state';
|
||||
import type { WeightToFeeCoefficient } from '@polkadot/types/interfaces/support';
|
||||
import type { AccountInfo, AccountInfoWithDualRefCount, AccountInfoWithProviders, AccountInfoWithRefCount, AccountInfoWithRefCountU8, AccountInfoWithTripleRefCount, ApplyExtrinsicResult, ArithmeticError, BlockLength, BlockWeights, ChainProperties, ChainType, ConsumedWeight, DigestOf, DispatchClass, DispatchError, DispatchErrorModule, DispatchErrorTo198, DispatchInfo, DispatchInfoTo190, DispatchInfoTo244, DispatchOutcome, DispatchResult, DispatchResultOf, DispatchResultTo198, Event, EventId, EventIndex, EventRecord, Health, InvalidTransaction, Key, LastRuntimeUpgradeInfo, NetworkState, NetworkStatePeerset, NetworkStatePeersetInfo, NodeRole, NotConnectedPeer, Peer, PeerEndpoint, PeerEndpointAddr, PeerInfo, PeerPing, PerDispatchClassU32, PerDispatchClassWeight, PerDispatchClassWeightsPerClass, Phase, RawOrigin, RefCount, RefCountTo259, SyncState, SystemOrigin, TokenError, TransactionValidityError, UnknownTransaction, WeightPerClass } from '@polkadot/types/interfaces/system';
|
||||
@@ -98,10 +98,12 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Compact<LeasePeriod>': Compact<LeasePeriod>;
|
||||
'Compact<LeasePeriodOf>': Compact<LeasePeriodOf>;
|
||||
'Compact<MemberCount>': Compact<MemberCount>;
|
||||
'Compact<MessageNonce>': Compact<MessageNonce>;
|
||||
'Compact<Moment>': Compact<Moment>;
|
||||
'Compact<MomentOf>': Compact<MomentOf>;
|
||||
'Compact<NominatorIndex>': Compact<NominatorIndex>;
|
||||
'Compact<OffchainAccuracy>': Compact<OffchainAccuracy>;
|
||||
'Compact<OutboundMessageFee>': Compact<OutboundMessageFee>;
|
||||
'Compact<OverweightIndex>': Compact<OverweightIndex>;
|
||||
'Compact<PageCounter>': Compact<PageCounter>;
|
||||
'Compact<ParaId>': Compact<ParaId>;
|
||||
@@ -126,7 +128,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 +164,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>;
|
||||
@@ -272,12 +276,14 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Option<CallHash>': Option<CallHash>;
|
||||
'Option<CallHashOf>': Option<CallHashOf>;
|
||||
'Option<CallIndex>': Option<CallIndex>;
|
||||
'Option<CallOrigin>': Option<CallOrigin>;
|
||||
'Option<CandidateCommitments>': Option<CandidateCommitments>;
|
||||
'Option<CandidateDescriptor>': Option<CandidateDescriptor>;
|
||||
'Option<CandidateHash>': Option<CandidateHash>;
|
||||
'Option<CandidateInfo>': Option<CandidateInfo>;
|
||||
'Option<CandidatePendingAvailability>': Option<CandidatePendingAvailability>;
|
||||
'Option<CandidateReceipt>': Option<CandidateReceipt>;
|
||||
'Option<ChainId>': Option<ChainId>;
|
||||
'Option<ChainProperties>': Option<ChainProperties>;
|
||||
'Option<ChainType>': Option<ChainType>;
|
||||
'Option<ChangesTrieConfiguration>': Option<ChangesTrieConfiguration>;
|
||||
@@ -351,6 +357,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Option<DelayKindBest>': Option<DelayKindBest>;
|
||||
'Option<Delegations>': Option<Delegations>;
|
||||
'Option<DeletedContract>': Option<DeletedContract>;
|
||||
'Option<DeliveredMessages>': Option<DeliveredMessages>;
|
||||
'Option<DepositBalance>': Option<DepositBalance>;
|
||||
'Option<DepositBalanceOf>': Option<DepositBalanceOf>;
|
||||
'Option<DestroyWitness>': Option<DestroyWitness>;
|
||||
@@ -361,6 +368,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Option<DispatchError>': Option<DispatchError>;
|
||||
'Option<DispatchErrorModule>': Option<DispatchErrorModule>;
|
||||
'Option<DispatchErrorTo198>': Option<DispatchErrorTo198>;
|
||||
'Option<DispatchFeePayment>': Option<DispatchFeePayment>;
|
||||
'Option<DispatchInfo>': Option<DispatchInfo>;
|
||||
'Option<DispatchInfoTo190>': Option<DispatchInfoTo190>;
|
||||
'Option<DispatchInfoTo244>': Option<DispatchInfoTo244>;
|
||||
@@ -371,12 +379,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>;
|
||||
@@ -390,6 +392,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Option<EncodedFinalityProofs>': Option<EncodedFinalityProofs>;
|
||||
'Option<EncodedJustification>': Option<EncodedJustification>;
|
||||
'Option<EpochAuthorship>': Option<EpochAuthorship>;
|
||||
'Option<Era>': Option<Era>;
|
||||
'Option<EraIndex>': Option<EraIndex>;
|
||||
'Option<EraPoints>': Option<EraPoints>;
|
||||
'Option<EraRewardPoints>': Option<EraRewardPoints>;
|
||||
@@ -399,6 +402,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Option<ErrorMetadataV11>': Option<ErrorMetadataV11>;
|
||||
'Option<ErrorMetadataV12>': Option<ErrorMetadataV12>;
|
||||
'Option<ErrorMetadataV13>': Option<ErrorMetadataV13>;
|
||||
'Option<ErrorMetadataV14>': Option<ErrorMetadataV14>;
|
||||
'Option<ErrorMetadataV9>': Option<ErrorMetadataV9>;
|
||||
'Option<EthAccount>': Option<EthAccount>;
|
||||
'Option<EthBlock>': Option<EthBlock>;
|
||||
@@ -440,6 +444,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Option<EventMetadataV11>': Option<EventMetadataV11>;
|
||||
'Option<EventMetadataV12>': Option<EventMetadataV12>;
|
||||
'Option<EventMetadataV13>': Option<EventMetadataV13>;
|
||||
'Option<EventMetadataV14>': Option<EventMetadataV14>;
|
||||
'Option<EventMetadataV9>': Option<EventMetadataV9>;
|
||||
'Option<EventRecord>': Option<EventRecord>;
|
||||
'Option<EvmAccount>': Option<EvmAccount>;
|
||||
@@ -460,6 +465,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>;
|
||||
@@ -486,12 +492,14 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Option<FunctionArgumentMetadataV11>': Option<FunctionArgumentMetadataV11>;
|
||||
'Option<FunctionArgumentMetadataV12>': Option<FunctionArgumentMetadataV12>;
|
||||
'Option<FunctionArgumentMetadataV13>': Option<FunctionArgumentMetadataV13>;
|
||||
'Option<FunctionArgumentMetadataV14>': Option<FunctionArgumentMetadataV14>;
|
||||
'Option<FunctionArgumentMetadataV9>': Option<FunctionArgumentMetadataV9>;
|
||||
'Option<FunctionMetadataLatest>': Option<FunctionMetadataLatest>;
|
||||
'Option<FunctionMetadataV10>': Option<FunctionMetadataV10>;
|
||||
'Option<FunctionMetadataV11>': Option<FunctionMetadataV11>;
|
||||
'Option<FunctionMetadataV12>': Option<FunctionMetadataV12>;
|
||||
'Option<FunctionMetadataV13>': Option<FunctionMetadataV13>;
|
||||
'Option<FunctionMetadataV14>': Option<FunctionMetadataV14>;
|
||||
'Option<FunctionMetadataV9>': Option<FunctionMetadataV9>;
|
||||
'Option<FundIndex>': Option<FundIndex>;
|
||||
'Option<FundInfo>': Option<FundInfo>;
|
||||
@@ -552,6 +560,8 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Option<InboundDownwardMessage>': Option<InboundDownwardMessage>;
|
||||
'Option<InboundHrmpMessage>': Option<InboundHrmpMessage>;
|
||||
'Option<InboundHrmpMessages>': Option<InboundHrmpMessages>;
|
||||
'Option<InboundLaneData>': Option<InboundLaneData>;
|
||||
'Option<InboundRelayer>': Option<InboundRelayer>;
|
||||
'Option<InboundStatus>': Option<InboundStatus>;
|
||||
'Option<IncludedBlocks>': Option<IncludedBlocks>;
|
||||
'Option<InclusionFee>': Option<InclusionFee>;
|
||||
@@ -583,6 +593,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Option<KeyValue>': Option<KeyValue>;
|
||||
'Option<KeyValueOption>': Option<KeyValueOption>;
|
||||
'Option<Kind>': Option<Kind>;
|
||||
'Option<LaneId>': Option<LaneId>;
|
||||
'Option<LastContribution>': Option<LastContribution>;
|
||||
'Option<LastRuntimeUpgradeInfo>': Option<LastRuntimeUpgradeInfo>;
|
||||
'Option<LeasePeriod>': Option<LeasePeriod>;
|
||||
@@ -594,19 +605,18 @@ 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>;
|
||||
'Option<MembershipProof>': Option<MembershipProof>;
|
||||
'Option<MessageData>': Option<MessageData>;
|
||||
'Option<MessageId>': Option<MessageId>;
|
||||
'Option<MessageIngestionType>': Option<MessageIngestionType>;
|
||||
'Option<MessageKey>': Option<MessageKey>;
|
||||
'Option<MessageNonce>': Option<MessageNonce>;
|
||||
'Option<MessageQueueChain>': Option<MessageQueueChain>;
|
||||
'Option<MessagesDeliveryProofOf>': Option<MessagesDeliveryProofOf>;
|
||||
'Option<MessagesProofOf>': Option<MessagesProofOf>;
|
||||
'Option<MessagingStateSnapshot>': Option<MessagingStateSnapshot>;
|
||||
'Option<MessagingStateSnapshotEgressEntry>': Option<MessagingStateSnapshotEgressEntry>;
|
||||
'Option<MetadataAll>': Option<MetadataAll>;
|
||||
@@ -615,6 +625,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 +666,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>;
|
||||
@@ -676,17 +685,33 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Option<OpenTipFinderTo225>': Option<OpenTipFinderTo225>;
|
||||
'Option<OpenTipTip>': Option<OpenTipTip>;
|
||||
'Option<OpenTipTo225>': Option<OpenTipTo225>;
|
||||
'Option<OperatingMode>': Option<OperatingMode>;
|
||||
'Option<Origin>': Option<Origin>;
|
||||
'Option<OriginCaller>': Option<OriginCaller>;
|
||||
'Option<OutboundHrmpMessage>': Option<OutboundHrmpMessage>;
|
||||
'Option<OutboundLaneData>': Option<OutboundLaneData>;
|
||||
'Option<OutboundMessageFee>': Option<OutboundMessageFee>;
|
||||
'Option<OutboundPayload>': Option<OutboundPayload>;
|
||||
'Option<OutboundStatus>': Option<OutboundStatus>;
|
||||
'Option<Outcome>': Option<Outcome>;
|
||||
'Option<OverweightIndex>': Option<OverweightIndex>;
|
||||
'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>;
|
||||
@@ -696,6 +721,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Option<ParaId>': Option<ParaId>;
|
||||
'Option<ParaInfo>': Option<ParaInfo>;
|
||||
'Option<ParaLifecycle>': Option<ParaLifecycle>;
|
||||
'Option<Parameter>': Option<Parameter>;
|
||||
'Option<ParaPastCodeMeta>': Option<ParaPastCodeMeta>;
|
||||
'Option<ParaScheduling>': Option<ParaScheduling>;
|
||||
'Option<ParathreadClaim>': Option<ParathreadClaim>;
|
||||
@@ -730,6 +756,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>;
|
||||
@@ -784,11 +812,13 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Option<RelayBlockNumber>': Option<RelayBlockNumber>;
|
||||
'Option<RelayChainBlockNumber>': Option<RelayChainBlockNumber>;
|
||||
'Option<RelayChainHash>': Option<RelayChainHash>;
|
||||
'Option<RelayerId>': Option<RelayerId>;
|
||||
'Option<RelayHash>': Option<RelayHash>;
|
||||
'Option<Releases>': Option<Releases>;
|
||||
'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 +869,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,8 +892,11 @@ 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<SignedSubmissionTo276>': Option<SignedSubmissionTo276>;
|
||||
'Option<SignerPayload>': Option<SignerPayload>;
|
||||
'Option<SigningContext>': Option<SigningContext>;
|
||||
'Option<SiLookupTypeId>': Option<SiLookupTypeId>;
|
||||
@@ -855,11 +904,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 +939,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>;
|
||||
@@ -961,6 +1017,8 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Option<UncleEntryItem>': Option<UncleEntryItem>;
|
||||
'Option<UnknownTransaction>': Option<UnknownTransaction>;
|
||||
'Option<UnlockChunk>': Option<UnlockChunk>;
|
||||
'Option<UnrewardedRelayer>': Option<UnrewardedRelayer>;
|
||||
'Option<UnrewardedRelayersState>': Option<UnrewardedRelayersState>;
|
||||
'Option<UpwardMessage>': Option<UpwardMessage>;
|
||||
'Option<usize>': Option<usize>;
|
||||
'Option<USize>': Option<USize>;
|
||||
@@ -1045,6 +1103,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>;
|
||||
@@ -1155,12 +1215,14 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Vec<CallHash>': Vec<CallHash>;
|
||||
'Vec<CallHashOf>': Vec<CallHashOf>;
|
||||
'Vec<CallIndex>': Vec<CallIndex>;
|
||||
'Vec<CallOrigin>': Vec<CallOrigin>;
|
||||
'Vec<CandidateCommitments>': Vec<CandidateCommitments>;
|
||||
'Vec<CandidateDescriptor>': Vec<CandidateDescriptor>;
|
||||
'Vec<CandidateHash>': Vec<CandidateHash>;
|
||||
'Vec<CandidateInfo>': Vec<CandidateInfo>;
|
||||
'Vec<CandidatePendingAvailability>': Vec<CandidatePendingAvailability>;
|
||||
'Vec<CandidateReceipt>': Vec<CandidateReceipt>;
|
||||
'Vec<ChainId>': Vec<ChainId>;
|
||||
'Vec<ChainProperties>': Vec<ChainProperties>;
|
||||
'Vec<ChainType>': Vec<ChainType>;
|
||||
'Vec<ChangesTrieConfiguration>': Vec<ChangesTrieConfiguration>;
|
||||
@@ -1234,6 +1296,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Vec<DelayKindBest>': Vec<DelayKindBest>;
|
||||
'Vec<Delegations>': Vec<Delegations>;
|
||||
'Vec<DeletedContract>': Vec<DeletedContract>;
|
||||
'Vec<DeliveredMessages>': Vec<DeliveredMessages>;
|
||||
'Vec<DepositBalance>': Vec<DepositBalance>;
|
||||
'Vec<DepositBalanceOf>': Vec<DepositBalanceOf>;
|
||||
'Vec<DestroyWitness>': Vec<DestroyWitness>;
|
||||
@@ -1244,6 +1307,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Vec<DispatchError>': Vec<DispatchError>;
|
||||
'Vec<DispatchErrorModule>': Vec<DispatchErrorModule>;
|
||||
'Vec<DispatchErrorTo198>': Vec<DispatchErrorTo198>;
|
||||
'Vec<DispatchFeePayment>': Vec<DispatchFeePayment>;
|
||||
'Vec<DispatchInfo>': Vec<DispatchInfo>;
|
||||
'Vec<DispatchInfoTo190>': Vec<DispatchInfoTo190>;
|
||||
'Vec<DispatchInfoTo244>': Vec<DispatchInfoTo244>;
|
||||
@@ -1254,12 +1318,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>;
|
||||
@@ -1273,6 +1331,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Vec<EncodedFinalityProofs>': Vec<EncodedFinalityProofs>;
|
||||
'Vec<EncodedJustification>': Vec<EncodedJustification>;
|
||||
'Vec<EpochAuthorship>': Vec<EpochAuthorship>;
|
||||
'Vec<Era>': Vec<Era>;
|
||||
'Vec<EraIndex>': Vec<EraIndex>;
|
||||
'Vec<EraPoints>': Vec<EraPoints>;
|
||||
'Vec<EraRewardPoints>': Vec<EraRewardPoints>;
|
||||
@@ -1282,6 +1341,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Vec<ErrorMetadataV11>': Vec<ErrorMetadataV11>;
|
||||
'Vec<ErrorMetadataV12>': Vec<ErrorMetadataV12>;
|
||||
'Vec<ErrorMetadataV13>': Vec<ErrorMetadataV13>;
|
||||
'Vec<ErrorMetadataV14>': Vec<ErrorMetadataV14>;
|
||||
'Vec<ErrorMetadataV9>': Vec<ErrorMetadataV9>;
|
||||
'Vec<EthAccount>': Vec<EthAccount>;
|
||||
'Vec<EthBlock>': Vec<EthBlock>;
|
||||
@@ -1323,6 +1383,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Vec<EventMetadataV11>': Vec<EventMetadataV11>;
|
||||
'Vec<EventMetadataV12>': Vec<EventMetadataV12>;
|
||||
'Vec<EventMetadataV13>': Vec<EventMetadataV13>;
|
||||
'Vec<EventMetadataV14>': Vec<EventMetadataV14>;
|
||||
'Vec<EventMetadataV9>': Vec<EventMetadataV9>;
|
||||
'Vec<EventRecord>': Vec<EventRecord>;
|
||||
'Vec<EvmAccount>': Vec<EvmAccount>;
|
||||
@@ -1343,6 +1404,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>;
|
||||
@@ -1369,12 +1431,14 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Vec<FunctionArgumentMetadataV11>': Vec<FunctionArgumentMetadataV11>;
|
||||
'Vec<FunctionArgumentMetadataV12>': Vec<FunctionArgumentMetadataV12>;
|
||||
'Vec<FunctionArgumentMetadataV13>': Vec<FunctionArgumentMetadataV13>;
|
||||
'Vec<FunctionArgumentMetadataV14>': Vec<FunctionArgumentMetadataV14>;
|
||||
'Vec<FunctionArgumentMetadataV9>': Vec<FunctionArgumentMetadataV9>;
|
||||
'Vec<FunctionMetadataLatest>': Vec<FunctionMetadataLatest>;
|
||||
'Vec<FunctionMetadataV10>': Vec<FunctionMetadataV10>;
|
||||
'Vec<FunctionMetadataV11>': Vec<FunctionMetadataV11>;
|
||||
'Vec<FunctionMetadataV12>': Vec<FunctionMetadataV12>;
|
||||
'Vec<FunctionMetadataV13>': Vec<FunctionMetadataV13>;
|
||||
'Vec<FunctionMetadataV14>': Vec<FunctionMetadataV14>;
|
||||
'Vec<FunctionMetadataV9>': Vec<FunctionMetadataV9>;
|
||||
'Vec<FundIndex>': Vec<FundIndex>;
|
||||
'Vec<FundInfo>': Vec<FundInfo>;
|
||||
@@ -1435,6 +1499,8 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Vec<InboundDownwardMessage>': Vec<InboundDownwardMessage>;
|
||||
'Vec<InboundHrmpMessage>': Vec<InboundHrmpMessage>;
|
||||
'Vec<InboundHrmpMessages>': Vec<InboundHrmpMessages>;
|
||||
'Vec<InboundLaneData>': Vec<InboundLaneData>;
|
||||
'Vec<InboundRelayer>': Vec<InboundRelayer>;
|
||||
'Vec<InboundStatus>': Vec<InboundStatus>;
|
||||
'Vec<IncludedBlocks>': Vec<IncludedBlocks>;
|
||||
'Vec<InclusionFee>': Vec<InclusionFee>;
|
||||
@@ -1466,6 +1532,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Vec<KeyValue>': Vec<KeyValue>;
|
||||
'Vec<KeyValueOption>': Vec<KeyValueOption>;
|
||||
'Vec<Kind>': Vec<Kind>;
|
||||
'Vec<LaneId>': Vec<LaneId>;
|
||||
'Vec<LastContribution>': Vec<LastContribution>;
|
||||
'Vec<LastRuntimeUpgradeInfo>': Vec<LastRuntimeUpgradeInfo>;
|
||||
'Vec<LeasePeriod>': Vec<LeasePeriod>;
|
||||
@@ -1477,19 +1544,18 @@ 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>;
|
||||
'Vec<MembershipProof>': Vec<MembershipProof>;
|
||||
'Vec<MessageData>': Vec<MessageData>;
|
||||
'Vec<MessageId>': Vec<MessageId>;
|
||||
'Vec<MessageIngestionType>': Vec<MessageIngestionType>;
|
||||
'Vec<MessageKey>': Vec<MessageKey>;
|
||||
'Vec<MessageNonce>': Vec<MessageNonce>;
|
||||
'Vec<MessageQueueChain>': Vec<MessageQueueChain>;
|
||||
'Vec<MessagesDeliveryProofOf>': Vec<MessagesDeliveryProofOf>;
|
||||
'Vec<MessagesProofOf>': Vec<MessagesProofOf>;
|
||||
'Vec<MessagingStateSnapshot>': Vec<MessagingStateSnapshot>;
|
||||
'Vec<MessagingStateSnapshotEgressEntry>': Vec<MessagingStateSnapshotEgressEntry>;
|
||||
'Vec<MetadataAll>': Vec<MetadataAll>;
|
||||
@@ -1498,6 +1564,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 +1605,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>;
|
||||
@@ -1559,17 +1624,33 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Vec<OpenTipFinderTo225>': Vec<OpenTipFinderTo225>;
|
||||
'Vec<OpenTipTip>': Vec<OpenTipTip>;
|
||||
'Vec<OpenTipTo225>': Vec<OpenTipTo225>;
|
||||
'Vec<OperatingMode>': Vec<OperatingMode>;
|
||||
'Vec<Origin>': Vec<Origin>;
|
||||
'Vec<OriginCaller>': Vec<OriginCaller>;
|
||||
'Vec<OutboundHrmpMessage>': Vec<OutboundHrmpMessage>;
|
||||
'Vec<OutboundLaneData>': Vec<OutboundLaneData>;
|
||||
'Vec<OutboundMessageFee>': Vec<OutboundMessageFee>;
|
||||
'Vec<OutboundPayload>': Vec<OutboundPayload>;
|
||||
'Vec<OutboundStatus>': Vec<OutboundStatus>;
|
||||
'Vec<Outcome>': Vec<Outcome>;
|
||||
'Vec<OverweightIndex>': Vec<OverweightIndex>;
|
||||
'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>;
|
||||
@@ -1579,6 +1660,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Vec<ParaId>': Vec<ParaId>;
|
||||
'Vec<ParaInfo>': Vec<ParaInfo>;
|
||||
'Vec<ParaLifecycle>': Vec<ParaLifecycle>;
|
||||
'Vec<Parameter>': Vec<Parameter>;
|
||||
'Vec<ParaPastCodeMeta>': Vec<ParaPastCodeMeta>;
|
||||
'Vec<ParaScheduling>': Vec<ParaScheduling>;
|
||||
'Vec<ParathreadClaim>': Vec<ParathreadClaim>;
|
||||
@@ -1613,6 +1695,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>;
|
||||
@@ -1667,11 +1751,13 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Vec<RelayBlockNumber>': Vec<RelayBlockNumber>;
|
||||
'Vec<RelayChainBlockNumber>': Vec<RelayChainBlockNumber>;
|
||||
'Vec<RelayChainHash>': Vec<RelayChainHash>;
|
||||
'Vec<RelayerId>': Vec<RelayerId>;
|
||||
'Vec<RelayHash>': Vec<RelayHash>;
|
||||
'Vec<Releases>': Vec<Releases>;
|
||||
'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 +1808,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,8 +1831,11 @@ 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<SignedSubmissionTo276>': Vec<SignedSubmissionTo276>;
|
||||
'Vec<SignerPayload>': Vec<SignerPayload>;
|
||||
'Vec<SigningContext>': Vec<SigningContext>;
|
||||
'Vec<SiLookupTypeId>': Vec<SiLookupTypeId>;
|
||||
@@ -1738,11 +1843,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 +1878,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>;
|
||||
@@ -1844,6 +1956,8 @@ declare module '@polkadot/types/types/registry' {
|
||||
'Vec<UncleEntryItem>': Vec<UncleEntryItem>;
|
||||
'Vec<UnknownTransaction>': Vec<UnknownTransaction>;
|
||||
'Vec<UnlockChunk>': Vec<UnlockChunk>;
|
||||
'Vec<UnrewardedRelayer>': Vec<UnrewardedRelayer>;
|
||||
'Vec<UnrewardedRelayersState>': Vec<UnrewardedRelayersState>;
|
||||
'Vec<UpwardMessage>': Vec<UpwardMessage>;
|
||||
'Vec<usize>': Vec<usize>;
|
||||
'Vec<USize>': Vec<USize>;
|
||||
@@ -1928,6 +2042,8 @@ declare module '@polkadot/types/types/registry' {
|
||||
AbridgedHrmpChannel: AbridgedHrmpChannel;
|
||||
AccountData: AccountData;
|
||||
AccountId: AccountId;
|
||||
AccountId20: AccountId20;
|
||||
AccountId32: AccountId32;
|
||||
AccountId32Junction: AccountId32Junction;
|
||||
AccountIdOf: AccountIdOf;
|
||||
AccountIndex: AccountIndex;
|
||||
@@ -2038,12 +2154,14 @@ declare module '@polkadot/types/types/registry' {
|
||||
CallHash: CallHash;
|
||||
CallHashOf: CallHashOf;
|
||||
CallIndex: CallIndex;
|
||||
CallOrigin: CallOrigin;
|
||||
CandidateCommitments: CandidateCommitments;
|
||||
CandidateDescriptor: CandidateDescriptor;
|
||||
CandidateHash: CandidateHash;
|
||||
CandidateInfo: CandidateInfo;
|
||||
CandidatePendingAvailability: CandidatePendingAvailability;
|
||||
CandidateReceipt: CandidateReceipt;
|
||||
ChainId: ChainId;
|
||||
ChainProperties: ChainProperties;
|
||||
ChainType: ChainType;
|
||||
ChangesTrieConfiguration: ChangesTrieConfiguration;
|
||||
@@ -2117,6 +2235,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
DelayKindBest: DelayKindBest;
|
||||
Delegations: Delegations;
|
||||
DeletedContract: DeletedContract;
|
||||
DeliveredMessages: DeliveredMessages;
|
||||
DepositBalance: DepositBalance;
|
||||
DepositBalanceOf: DepositBalanceOf;
|
||||
DestroyWitness: DestroyWitness;
|
||||
@@ -2127,6 +2246,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
DispatchError: DispatchError;
|
||||
DispatchErrorModule: DispatchErrorModule;
|
||||
DispatchErrorTo198: DispatchErrorTo198;
|
||||
DispatchFeePayment: DispatchFeePayment;
|
||||
DispatchInfo: DispatchInfo;
|
||||
DispatchInfoTo190: DispatchInfoTo190;
|
||||
DispatchInfoTo244: DispatchInfoTo244;
|
||||
@@ -2137,12 +2257,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;
|
||||
@@ -2156,6 +2270,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
EncodedFinalityProofs: EncodedFinalityProofs;
|
||||
EncodedJustification: EncodedJustification;
|
||||
EpochAuthorship: EpochAuthorship;
|
||||
Era: Era;
|
||||
EraIndex: EraIndex;
|
||||
EraPoints: EraPoints;
|
||||
EraRewardPoints: EraRewardPoints;
|
||||
@@ -2165,6 +2280,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
ErrorMetadataV11: ErrorMetadataV11;
|
||||
ErrorMetadataV12: ErrorMetadataV12;
|
||||
ErrorMetadataV13: ErrorMetadataV13;
|
||||
ErrorMetadataV14: ErrorMetadataV14;
|
||||
ErrorMetadataV9: ErrorMetadataV9;
|
||||
EthAccount: EthAccount;
|
||||
EthBlock: EthBlock;
|
||||
@@ -2206,6 +2322,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
EventMetadataV11: EventMetadataV11;
|
||||
EventMetadataV12: EventMetadataV12;
|
||||
EventMetadataV13: EventMetadataV13;
|
||||
EventMetadataV14: EventMetadataV14;
|
||||
EventMetadataV9: EventMetadataV9;
|
||||
EventRecord: EventRecord;
|
||||
EvmAccount: EvmAccount;
|
||||
@@ -2226,6 +2343,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
ExtrinsicMetadataV11: ExtrinsicMetadataV11;
|
||||
ExtrinsicMetadataV12: ExtrinsicMetadataV12;
|
||||
ExtrinsicMetadataV13: ExtrinsicMetadataV13;
|
||||
ExtrinsicMetadataV14: ExtrinsicMetadataV14;
|
||||
ExtrinsicOrHash: ExtrinsicOrHash;
|
||||
ExtrinsicPayload: ExtrinsicPayload;
|
||||
ExtrinsicPayloadUnknown: ExtrinsicPayloadUnknown;
|
||||
@@ -2252,12 +2370,14 @@ declare module '@polkadot/types/types/registry' {
|
||||
FunctionArgumentMetadataV11: FunctionArgumentMetadataV11;
|
||||
FunctionArgumentMetadataV12: FunctionArgumentMetadataV12;
|
||||
FunctionArgumentMetadataV13: FunctionArgumentMetadataV13;
|
||||
FunctionArgumentMetadataV14: FunctionArgumentMetadataV14;
|
||||
FunctionArgumentMetadataV9: FunctionArgumentMetadataV9;
|
||||
FunctionMetadataLatest: FunctionMetadataLatest;
|
||||
FunctionMetadataV10: FunctionMetadataV10;
|
||||
FunctionMetadataV11: FunctionMetadataV11;
|
||||
FunctionMetadataV12: FunctionMetadataV12;
|
||||
FunctionMetadataV13: FunctionMetadataV13;
|
||||
FunctionMetadataV14: FunctionMetadataV14;
|
||||
FunctionMetadataV9: FunctionMetadataV9;
|
||||
FundIndex: FundIndex;
|
||||
FundInfo: FundInfo;
|
||||
@@ -2318,6 +2438,8 @@ declare module '@polkadot/types/types/registry' {
|
||||
InboundDownwardMessage: InboundDownwardMessage;
|
||||
InboundHrmpMessage: InboundHrmpMessage;
|
||||
InboundHrmpMessages: InboundHrmpMessages;
|
||||
InboundLaneData: InboundLaneData;
|
||||
InboundRelayer: InboundRelayer;
|
||||
InboundStatus: InboundStatus;
|
||||
IncludedBlocks: IncludedBlocks;
|
||||
InclusionFee: InclusionFee;
|
||||
@@ -2349,6 +2471,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
KeyValue: KeyValue;
|
||||
KeyValueOption: KeyValueOption;
|
||||
Kind: Kind;
|
||||
LaneId: LaneId;
|
||||
LastContribution: LastContribution;
|
||||
LastRuntimeUpgradeInfo: LastRuntimeUpgradeInfo;
|
||||
LeasePeriod: LeasePeriod;
|
||||
@@ -2360,19 +2483,18 @@ 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;
|
||||
MembershipProof: MembershipProof;
|
||||
MessageData: MessageData;
|
||||
MessageId: MessageId;
|
||||
MessageIngestionType: MessageIngestionType;
|
||||
MessageKey: MessageKey;
|
||||
MessageNonce: MessageNonce;
|
||||
MessageQueueChain: MessageQueueChain;
|
||||
MessagesDeliveryProofOf: MessagesDeliveryProofOf;
|
||||
MessagesProofOf: MessagesProofOf;
|
||||
MessagingStateSnapshot: MessagingStateSnapshot;
|
||||
MessagingStateSnapshotEgressEntry: MessagingStateSnapshotEgressEntry;
|
||||
MetadataAll: MetadataAll;
|
||||
@@ -2381,6 +2503,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
MetadataV11: MetadataV11;
|
||||
MetadataV12: MetadataV12;
|
||||
MetadataV13: MetadataV13;
|
||||
MetadataV14: MetadataV14;
|
||||
MetadataV9: MetadataV9;
|
||||
MmrLeafProof: MmrLeafProof;
|
||||
MmrRootHash: MmrRootHash;
|
||||
@@ -2421,8 +2544,6 @@ declare module '@polkadot/types/types/registry' {
|
||||
NextAuthority: NextAuthority;
|
||||
NextConfigDescriptor: NextConfigDescriptor;
|
||||
NextConfigDescriptorV1: NextConfigDescriptorV1;
|
||||
NMapTypeLatest: NMapTypeLatest;
|
||||
NMapTypeV13: NMapTypeV13;
|
||||
NodeRole: NodeRole;
|
||||
Nominations: Nominations;
|
||||
NominatorIndex: NominatorIndex;
|
||||
@@ -2442,17 +2563,33 @@ declare module '@polkadot/types/types/registry' {
|
||||
OpenTipFinderTo225: OpenTipFinderTo225;
|
||||
OpenTipTip: OpenTipTip;
|
||||
OpenTipTo225: OpenTipTo225;
|
||||
OperatingMode: OperatingMode;
|
||||
Origin: Origin;
|
||||
OriginCaller: OriginCaller;
|
||||
OutboundHrmpMessage: OutboundHrmpMessage;
|
||||
OutboundLaneData: OutboundLaneData;
|
||||
OutboundMessageFee: OutboundMessageFee;
|
||||
OutboundPayload: OutboundPayload;
|
||||
OutboundStatus: OutboundStatus;
|
||||
Outcome: Outcome;
|
||||
OverweightIndex: OverweightIndex;
|
||||
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;
|
||||
@@ -2462,6 +2599,7 @@ declare module '@polkadot/types/types/registry' {
|
||||
ParaId: ParaId;
|
||||
ParaInfo: ParaInfo;
|
||||
ParaLifecycle: ParaLifecycle;
|
||||
Parameter: Parameter;
|
||||
ParaPastCodeMeta: ParaPastCodeMeta;
|
||||
ParaScheduling: ParaScheduling;
|
||||
ParathreadClaim: ParathreadClaim;
|
||||
@@ -2496,6 +2634,8 @@ declare module '@polkadot/types/types/registry' {
|
||||
PhragmenScore: PhragmenScore;
|
||||
PluralityJunction: PluralityJunction;
|
||||
Points: Points;
|
||||
PortableRegistry: PortableRegistry;
|
||||
PortableType: PortableType;
|
||||
Precommits: Precommits;
|
||||
PrefabWasmModule: PrefabWasmModule;
|
||||
PrefixedStorageKey: PrefixedStorageKey;
|
||||
@@ -2550,11 +2690,13 @@ declare module '@polkadot/types/types/registry' {
|
||||
RelayBlockNumber: RelayBlockNumber;
|
||||
RelayChainBlockNumber: RelayChainBlockNumber;
|
||||
RelayChainHash: RelayChainHash;
|
||||
RelayerId: RelayerId;
|
||||
RelayHash: RelayHash;
|
||||
Releases: Releases;
|
||||
Remark: Remark;
|
||||
Renouncing: Renouncing;
|
||||
RentProjection: RentProjection;
|
||||
ReplacementTimes: ReplacementTimes;
|
||||
ReportedRoundStates: ReportedRoundStates;
|
||||
Reporter: Reporter;
|
||||
ReportIdOf: ReportIdOf;
|
||||
@@ -2605,6 +2747,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,8 +2770,11 @@ declare module '@polkadot/types/types/registry' {
|
||||
SignedBlock: SignedBlock;
|
||||
SignedBlockWithJustification: SignedBlockWithJustification;
|
||||
SignedBlockWithJustifications: SignedBlockWithJustifications;
|
||||
SignedExtensionMetadataLatest: SignedExtensionMetadataLatest;
|
||||
SignedExtensionMetadataV14: SignedExtensionMetadataV14;
|
||||
SignedSubmission: SignedSubmission;
|
||||
SignedSubmissionOf: SignedSubmissionOf;
|
||||
SignedSubmissionTo276: SignedSubmissionTo276;
|
||||
SignerPayload: SignerPayload;
|
||||
SigningContext: SigningContext;
|
||||
SiLookupTypeId: SiLookupTypeId;
|
||||
@@ -2621,11 +2782,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 +2817,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;
|
||||
@@ -2727,6 +2895,8 @@ declare module '@polkadot/types/types/registry' {
|
||||
UncleEntryItem: UncleEntryItem;
|
||||
UnknownTransaction: UnknownTransaction;
|
||||
UnlockChunk: UnlockChunk;
|
||||
UnrewardedRelayer: UnrewardedRelayer;
|
||||
UnrewardedRelayersState: UnrewardedRelayersState;
|
||||
UpwardMessage: UpwardMessage;
|
||||
usize: usize;
|
||||
USize: USize;
|
||||
|
||||
@@ -6,7 +6,7 @@ import type { AnyJson, Codec, Registry } from '../types';
|
||||
|
||||
import { compactToU8a, u8aConcat, u8aToHex } from '@polkadot/util';
|
||||
|
||||
import { compareArray } from './utils';
|
||||
import { compareArray } from './utils/compareArray';
|
||||
|
||||
/**
|
||||
* @name AbstractArray
|
||||
|
||||
@@ -2,15 +2,52 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { TypeRegistry } from '../create';
|
||||
import { Text, U32 } from '../primitive';
|
||||
import { BTreeMap, Struct } from '.';
|
||||
import { I32, Text, U32 } from '../primitive';
|
||||
import { Constructor } from '../types';
|
||||
import { ITuple } from '../types/interfaces';
|
||||
import { BTreeMap, Enum, Struct, Tuple } from '.';
|
||||
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
class U32TextTuple extends (Tuple.with([U32, Text]) as unknown as Constructor<ITuple<[U32, Text]>>) {}
|
||||
// Reason: We purposefully want `text` to be the first key of the struct and take priority during sorting
|
||||
// eslint-disable-next-line sort-keys
|
||||
class MockStruct extends Struct.with({ text: Text, int: I32 }) {}
|
||||
class MockEnum extends Enum.with({
|
||||
Key1: MockStruct,
|
||||
Key2: MockStruct,
|
||||
Key3: U32TextTuple
|
||||
}) {}
|
||||
|
||||
const mockU32TextMap = new Map<Text, U32>();
|
||||
const mockU32TupleMap = new Map<ITuple<[U32, Text]>, U32>();
|
||||
const mockU32I32Map = new Map<I32, U32>();
|
||||
const mockU32StructMap = new Map<MockStruct, U32>();
|
||||
const mockU32EnumMap = new Map<MockEnum, U32>();
|
||||
|
||||
mockU32TextMap.set(new Text(registry, 'bazzing'), new U32(registry, 69));
|
||||
|
||||
mockU32TupleMap.set((new U32TextTuple(registry, [2, 'ba'])), new U32(registry, 42));
|
||||
mockU32TupleMap.set((new U32TextTuple(registry, [2, 'b'])), new U32(registry, 7));
|
||||
mockU32TupleMap.set((new U32TextTuple(registry, [1, 'baz'])), new U32(registry, 13));
|
||||
|
||||
mockU32I32Map.set(new I32(registry, 255), new U32(registry, 69));
|
||||
mockU32I32Map.set(new I32(registry, -255), new U32(registry, 42));
|
||||
mockU32I32Map.set(new I32(registry, 1000), new U32(registry, 7));
|
||||
mockU32I32Map.set(new I32(registry, -1000), new U32(registry, 25));
|
||||
mockU32I32Map.set(new I32(registry, 0), new U32(registry, 13));
|
||||
|
||||
mockU32StructMap.set(new MockStruct(registry, { int: 1, text: 'b' }), new U32(registry, 42));
|
||||
mockU32StructMap.set(new MockStruct(registry, { int: -1, text: 'b' }), new U32(registry, 7));
|
||||
mockU32StructMap.set(new MockStruct(registry, { int: -1, text: 'ba' }), new U32(registry, 25));
|
||||
mockU32StructMap.set(new MockStruct(registry, { int: -2, text: 'baz' }), new U32(registry, 13));
|
||||
|
||||
mockU32EnumMap.set(new MockEnum(registry, { Key3: new U32TextTuple(registry, [2, 'ba']) }), new U32(registry, 13));
|
||||
mockU32EnumMap.set(new MockEnum(registry, { Key3: new U32TextTuple(registry, [2, 'b']) }), new U32(registry, 42));
|
||||
mockU32EnumMap.set(new MockEnum(registry, { Key2: new MockStruct(registry, { int: -1, text: 'b' }) }), new U32(registry, 7));
|
||||
mockU32EnumMap.set(new MockEnum(registry, { Key1: new MockStruct(registry, { int: 1, text: 'b' }) }), new U32(registry, 25));
|
||||
mockU32EnumMap.set(new MockEnum(registry, { Key1: new MockStruct(registry, { int: -1, text: 'b' }) }), new U32(registry, 69));
|
||||
|
||||
describe('BTreeMap', (): void => {
|
||||
it('decodes null', (): void => {
|
||||
expect(
|
||||
@@ -54,6 +91,97 @@ describe('BTreeMap', (): void => {
|
||||
).toEqual(13);
|
||||
});
|
||||
|
||||
it('correctly sorts simple keys', (): void => {
|
||||
expect(
|
||||
Array.from(new (BTreeMap.with(I32, U32))(registry, mockU32I32Map).keys()).map((k) => k.toNumber())
|
||||
).toEqual([-1000, -255, 0, 255, 1000]);
|
||||
});
|
||||
|
||||
it('correctly sorts tuple keys', (): void => {
|
||||
expect(
|
||||
Array.from(new (BTreeMap.with(U32TextTuple, U32))(registry, mockU32TupleMap).keys()).map((k) => k.toJSON())
|
||||
).toEqual([[1, 'baz'], [2, 'b'], [2, 'ba']]);
|
||||
});
|
||||
|
||||
it('correctly sorts struct keys', (): void => {
|
||||
expect(
|
||||
Array.from(new (BTreeMap.with(MockStruct, U32))(registry, mockU32StructMap).keys()).map((k) => k.toJSON())
|
||||
).toEqual([
|
||||
{ int: -1, text: 'b' },
|
||||
{ int: 1, text: 'b' },
|
||||
{ int: -1, text: 'ba' },
|
||||
{ int: -2, text: 'baz' }
|
||||
]);
|
||||
});
|
||||
|
||||
it('correctly sorts enum keys', (): void => {
|
||||
expect(
|
||||
Array.from(new (BTreeMap.with(MockEnum, U32))(registry, mockU32EnumMap).keys()).map((k) => k.toJSON())
|
||||
).toEqual([
|
||||
{ key1: { int: -1, text: 'b' } },
|
||||
{ key1: { int: 1, text: 'b' } },
|
||||
{ key2: { int: -1, text: 'b' } },
|
||||
{ key3: [2, 'b'] },
|
||||
{ key3: [2, 'ba'] }
|
||||
]);
|
||||
});
|
||||
|
||||
it('correctly serializes/deserializes to/from json with numeric keys', (): void => {
|
||||
expect(
|
||||
new (BTreeMap.with(I32, U32))(
|
||||
registry,
|
||||
new (BTreeMap.with(I32, U32))(registry, mockU32I32Map).toJSON()
|
||||
).toJSON()
|
||||
).toEqual({ '-1000': 25, '-255': 42, 0: 13, 1000: 7, 255: 69 });
|
||||
});
|
||||
|
||||
it('correctly serializes/deserializes to/from json with text keys', (): void => {
|
||||
expect(
|
||||
new (BTreeMap.with(Text, U32))(
|
||||
registry,
|
||||
new (BTreeMap.with(Text, U32))(registry, mockU32TextMap).toJSON()
|
||||
).toJSON()
|
||||
).toEqual({ bazzing: 69 });
|
||||
});
|
||||
|
||||
it('correctly serializes/deserializes to/from json with tuple keys', (): void => {
|
||||
expect(
|
||||
new (BTreeMap.with(U32TextTuple, U32))(
|
||||
registry,
|
||||
new (BTreeMap.with(U32TextTuple, U32))(registry, mockU32TupleMap).toJSON()
|
||||
).toJSON()
|
||||
).toEqual({ '[1,"baz"]': 13, '[2,"b"]': 7, '[2,"ba"]': 42 });
|
||||
});
|
||||
|
||||
it('correctly serializes/deserializes to/from json with struct keys', (): void => {
|
||||
expect(
|
||||
new (BTreeMap.with(MockStruct, U32))(
|
||||
registry,
|
||||
new (BTreeMap.with(MockStruct, U32))(registry, mockU32StructMap).toJSON()
|
||||
).toJSON()
|
||||
).toEqual({
|
||||
'{"text":"b","int":-1}': 7,
|
||||
'{"text":"b","int":1}': 42,
|
||||
'{"text":"ba","int":-1}': 25,
|
||||
'{"text":"baz","int":-2}': 13
|
||||
});
|
||||
});
|
||||
|
||||
it('correctly serializes/deserializes to/from json with enum keys', (): void => {
|
||||
expect(
|
||||
new (BTreeMap.with(MockEnum, U32))(
|
||||
registry,
|
||||
new (BTreeMap.with(MockEnum, U32))(registry, mockU32EnumMap).toJSON()
|
||||
).toJSON()
|
||||
).toEqual({
|
||||
'{"key1":{"text":"b","int":-1}}': 69,
|
||||
'{"key1":{"text":"b","int":1}}': 25,
|
||||
'{"key2":{"text":"b","int":-1}}': 7,
|
||||
'{"key3":[2,"b"]}': 42,
|
||||
'{"key3":[2,"ba"]}': 13
|
||||
});
|
||||
});
|
||||
|
||||
it('generates sane toRawTypes', (): void => {
|
||||
expect(new (BTreeMap.with(Text, U32))(registry).toRawType()).toBe('BTreeMap<Text,u32>');
|
||||
expect(new (BTreeMap.with(Text, Text))(registry).toRawType()).toBe('BTreeMap<Text,Text>');
|
||||
|
||||
@@ -4,11 +4,24 @@
|
||||
import type { CodecTo } from '../types';
|
||||
|
||||
import { TypeRegistry } from '../create';
|
||||
import { Text, U32 } from '../primitive';
|
||||
import { BTreeSet, Struct } from '.';
|
||||
import { I32, Text, U32 } from '../primitive';
|
||||
import { Constructor } from '../types';
|
||||
import { ITuple } from '../types/interfaces';
|
||||
import { Enum } from './Enum';
|
||||
import { BTreeSet, Struct, Tuple } from '.';
|
||||
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
class U32TextTuple extends (Tuple.with([U32, Text]) as unknown as Constructor<ITuple<[U32, Text]>>) {}
|
||||
// Reason: We purposefully want `text` to be the first key of the struct and take priority during sorting
|
||||
// eslint-disable-next-line sort-keys
|
||||
class MockStruct extends Struct.with({ text: Text, int: I32 }) {}
|
||||
class MockEnum extends Enum.with({
|
||||
Key1: MockStruct,
|
||||
Key2: MockStruct,
|
||||
Key3: U32TextTuple
|
||||
}) {}
|
||||
|
||||
const mockU32Set = new Set<U32>();
|
||||
|
||||
mockU32Set.add(new U32(registry, 2));
|
||||
@@ -21,6 +34,34 @@ const mockU32SetObject = [2, 24, 30, 80];
|
||||
const mockU32SetHexString = '0x1002000000180000001e00000050000000';
|
||||
const mockU32SetUint8Array = Uint8Array.from([16, 2, 0, 0, 0, 24, 0, 0, 0, 30, 0, 0, 0, 80, 0, 0, 0]);
|
||||
|
||||
const mockI32SetObj = [1000, 0, 255, -255, -1000];
|
||||
const mockTextSetObj = [
|
||||
new Text(registry, 'baz'),
|
||||
new Text(registry, 'b'),
|
||||
new Text(registry, 'bb'),
|
||||
new Text(registry, 'ba'),
|
||||
new Text(registry, 'c')
|
||||
];
|
||||
const mockTupleSetObj = [
|
||||
new U32TextTuple(registry, [2, 'ba']),
|
||||
new U32TextTuple(registry, [2, 'bb']),
|
||||
new U32TextTuple(registry, [2, 'b']),
|
||||
new U32TextTuple(registry, [1, 'baz'])
|
||||
];
|
||||
const mockStructSetObj = [
|
||||
new MockStruct(registry, { int: 1, text: 'b' }),
|
||||
new MockStruct(registry, { int: -1, text: 'b' }),
|
||||
new MockStruct(registry, { int: -1, text: 'ba' }),
|
||||
new MockStruct(registry, { int: -2, text: 'baz' })
|
||||
];
|
||||
const mockEnumSetObj = [
|
||||
new MockEnum(registry, { Key3: new U32TextTuple(registry, [2, 'ba']) }),
|
||||
new MockEnum(registry, { Key3: new U32TextTuple(registry, [2, 'b']) }),
|
||||
new MockEnum(registry, { Key2: new MockStruct(registry, { int: -1, text: 'b' }) }),
|
||||
new MockEnum(registry, { Key1: new MockStruct(registry, { int: 1, text: 'b' }) }),
|
||||
new MockEnum(registry, { Key1: new MockStruct(registry, { int: -1, text: 'b' }) })
|
||||
];
|
||||
|
||||
describe('BTreeSet', (): void => {
|
||||
describe('decoding', (): void => {
|
||||
const testDecode = (type: string, input: any, output: string): void =>
|
||||
@@ -94,6 +135,47 @@ describe('BTreeSet', (): void => {
|
||||
).toEqual(17);
|
||||
});
|
||||
|
||||
it('correctly sorts numeric values', (): void => {
|
||||
expect(
|
||||
Array.from(new (BTreeSet.with(I32))(registry, mockI32SetObj)).map((k) => k.toNumber())
|
||||
).toEqual([-1000, -255, 0, 255, 1000]);
|
||||
});
|
||||
|
||||
it('correctly sorts text values', (): void => {
|
||||
expect(
|
||||
Array.from(new (BTreeSet.with(Text))(registry, mockTextSetObj)).map((k) => k.toString())
|
||||
).toEqual(['b', 'ba', 'baz', 'bb', 'c']);
|
||||
});
|
||||
|
||||
it('correctly sorts complex tuple values', (): void => {
|
||||
expect(
|
||||
Array.from(new (BTreeSet.with(U32TextTuple))(registry, mockTupleSetObj)).map((k) => k.toJSON())
|
||||
).toEqual([[1, 'baz'], [2, 'b'], [2, 'ba'], [2, 'bb']]);
|
||||
});
|
||||
|
||||
it('correctly sorts complex struct values', (): void => {
|
||||
expect(
|
||||
Array.from(new (BTreeSet.with(MockStruct))(registry, mockStructSetObj)).map((k) => k.toJSON())
|
||||
).toEqual([
|
||||
{ int: -1, text: 'b' },
|
||||
{ int: 1, text: 'b' },
|
||||
{ int: -1, text: 'ba' },
|
||||
{ int: -2, text: 'baz' }
|
||||
]);
|
||||
});
|
||||
|
||||
it('correctly sorts complex enum values', (): void => {
|
||||
expect(
|
||||
Array.from(new (BTreeSet.with(MockEnum))(registry, mockEnumSetObj)).map((k) => k.toJSON())
|
||||
).toEqual([
|
||||
{ key1: { int: -1, text: 'b' } },
|
||||
{ key1: { int: 1, text: 'b' } },
|
||||
{ key2: { int: -1, text: 'b' } },
|
||||
{ key3: [2, 'b'] },
|
||||
{ key3: [2, 'ba'] }
|
||||
]);
|
||||
});
|
||||
|
||||
it('generates sane toRawTypes', (): void => {
|
||||
expect(new (BTreeSet.with(U32))(registry).toRawType()).toBe('BTreeSet<u32>');
|
||||
expect(new (BTreeSet.with(Text))(registry).toRawType()).toBe('BTreeSet<Text>');
|
||||
|
||||
@@ -6,7 +6,7 @@ import type { AnyJson, Codec, Constructor, InterfaceTypes, Registry } from '../t
|
||||
|
||||
import { compactFromU8a, compactToU8a, isHex, isU8a, logger, stringify, u8aConcat, u8aToHex, u8aToU8a } from '@polkadot/util';
|
||||
|
||||
import { compareSet, decodeU8a, typeToConstructor } from './utils';
|
||||
import { compareSet, decodeU8a, sortSet, typeToConstructor } from './utils';
|
||||
|
||||
const l = logger('BTreeSet');
|
||||
|
||||
@@ -84,7 +84,7 @@ export class BTreeSet<V extends Codec = Codec> extends Set<V> implements Codec {
|
||||
readonly #ValClass: Constructor<V>;
|
||||
|
||||
constructor (registry: Registry, valType: Constructor<V> | keyof InterfaceTypes, rawValue?: Uint8Array | string | string[] | Set<any>) {
|
||||
super(decodeSet(registry, valType, rawValue));
|
||||
super(sortSet(decodeSet(registry, valType, rawValue)));
|
||||
|
||||
this.registry = registry;
|
||||
this.#ValClass = typeToConstructor(registry, valType);
|
||||
|
||||
@@ -18,7 +18,7 @@ export class DoNotConstruct implements Codec {
|
||||
|
||||
constructor (registry: Registry, typeName = 'DoNotConstruct') {
|
||||
this.registry = registry;
|
||||
this.#neverError = new Error(`Cannot construct unknown type ${typeName}`);
|
||||
this.#neverError = new Error(`DoNotConstruct: Cannot construct unknown type ${typeName}`);
|
||||
|
||||
throw this.#neverError;
|
||||
}
|
||||
|
||||
@@ -310,7 +310,7 @@ export class Enum implements Codec {
|
||||
} else if (this.#isBasic && isString(other)) {
|
||||
return this.type === other;
|
||||
} else if (isU8a(other)) {
|
||||
return !this.toU8a().some((entry, index): boolean => entry !== other[index]);
|
||||
return !this.toU8a().some((entry, index) => entry !== other[index]);
|
||||
} else if (isHex(other)) {
|
||||
return this.toHex() === other;
|
||||
} else if (other instanceof Enum) {
|
||||
|
||||
@@ -6,7 +6,10 @@ import type { AnyJson, Codec, Constructor, InterfaceTypes, Registry } from '../t
|
||||
|
||||
import { compactFromU8a, compactToU8a, isHex, isObject, isU8a, logger, stringify, u8aConcat, u8aToHex, u8aToU8a } from '@polkadot/util';
|
||||
|
||||
import { compareMap, decodeU8a, typeToConstructor } from './utils';
|
||||
import { AbstractArray } from './AbstractArray';
|
||||
import { Enum } from './Enum';
|
||||
import { Struct } from './Struct';
|
||||
import { compareMap, decodeU8a, sortMap, typeToConstructor } from './utils';
|
||||
|
||||
const l = logger('Map');
|
||||
|
||||
@@ -34,11 +37,15 @@ function decodeMapFromMap<K extends Codec = Codec, V extends Codec = Codec> (reg
|
||||
const output = new Map<K, V>();
|
||||
|
||||
value.forEach((val: any, key: any) => {
|
||||
const isComplex = KeyClass.prototype instanceof AbstractArray ||
|
||||
KeyClass.prototype instanceof Struct ||
|
||||
KeyClass.prototype instanceof Enum;
|
||||
|
||||
try {
|
||||
output.set(
|
||||
key instanceof KeyClass
|
||||
? key
|
||||
: new KeyClass(registry, key),
|
||||
: new KeyClass(registry, isComplex ? JSON.parse(key) : key),
|
||||
val instanceof ValClass
|
||||
? val
|
||||
: new ValClass(registry, val)
|
||||
@@ -97,7 +104,9 @@ export class CodecMap<K extends Codec = Codec, V extends Codec = Codec> extends
|
||||
readonly #type: string;
|
||||
|
||||
constructor (registry: Registry, keyType: Constructor<K> | keyof InterfaceTypes, valType: Constructor<V> | keyof InterfaceTypes, rawValue: Uint8Array | string | Map<any, any> | undefined, type: 'BTreeMap' | 'HashMap' = 'HashMap') {
|
||||
super(decodeMap(registry, keyType, valType, rawValue));
|
||||
const decoded = decodeMap(registry, keyType, valType, rawValue);
|
||||
|
||||
super(type === 'BTreeMap' ? sortMap(decoded) : decoded);
|
||||
|
||||
this.registry = registry;
|
||||
this.#KeyClass = typeToConstructor(registry, keyType);
|
||||
|
||||
@@ -7,7 +7,7 @@ import type { CodecTo } from '../types';
|
||||
|
||||
import { TypeRegistry } from '../create';
|
||||
import { Metadata } from '../metadata';
|
||||
import rpcMetadata from '../metadata/static';
|
||||
import rpcMetadata from '../metadata/static-substrate';
|
||||
import { Text, U32, u128 as U128 } from '../primitive';
|
||||
import { Tuple } from '.';
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import { randomAsU8a } from '@polkadot/util-crypto';
|
||||
import { createTypeUnsafe, TypeRegistry } from '../create';
|
||||
import { GenericAccountId as AccountId } from '../generic';
|
||||
import { Metadata } from '../metadata';
|
||||
import rpcMetadata from '../metadata/static';
|
||||
import rpcMetadata from '../metadata/static-substrate';
|
||||
import { Text } from '../primitive';
|
||||
import { Tuple, Vec } from '.';
|
||||
|
||||
|
||||
@@ -7,3 +7,4 @@ export { compareSet } from './compareSet';
|
||||
export { decodeU8a } from './decodeU8a';
|
||||
export { mapToTypeMap } from './mapToTypeMap';
|
||||
export { typeToConstructor } from './typeToConstructor';
|
||||
export { sortAsc, sortSet, sortMap } from './sortValues';
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { BN } from '@polkadot/util';
|
||||
import type { Codec } from '../../types';
|
||||
import type { Enum } from '../Enum';
|
||||
|
||||
import { bnToBn, isBigInt, isBn, isFunction, isNumber, stringify } from '@polkadot/util';
|
||||
|
||||
type SortArg = Codec | Codec[] | number[] | BN | bigint | number | Uint8Array;
|
||||
|
||||
/** @internal **/
|
||||
function isArrayLike (arg: SortArg): arg is Uint8Array | Codec[] | number[] {
|
||||
return arg instanceof Uint8Array || Array.isArray(arg);
|
||||
}
|
||||
|
||||
/** @internal **/
|
||||
function isCodec (arg: SortArg): arg is Codec {
|
||||
return isFunction(arg && (arg as Codec).toU8a);
|
||||
}
|
||||
|
||||
/** @internal **/
|
||||
function isEnum (arg: SortArg): arg is Enum {
|
||||
return isCodec(arg) && isNumber((arg as Enum).index) && isCodec((arg as Enum).value);
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
function isNumberLike (arg: SortArg): arg is BN | bigint | number {
|
||||
return isNumber(arg) || isBn(arg) || isBigInt(arg);
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
function sortArray (a: Uint8Array | Codec[] | number[], b: Uint8Array | Codec[] | number[]): number {
|
||||
// Vec, Tuple, Bytes etc.
|
||||
let sortRes = 0;
|
||||
const minLen = Math.min(a.length, b.length);
|
||||
|
||||
for (let i = 0; i < minLen; ++i) {
|
||||
sortRes = sortAsc(a[i], b[i]);
|
||||
|
||||
if (sortRes !== 0) {
|
||||
return sortRes;
|
||||
}
|
||||
}
|
||||
|
||||
return a.length - b.length;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort keys/values of BTreeSet/BTreeMap in ascending order for encoding compatibility with Rust's BTreeSet/BTreeMap
|
||||
* (https://doc.rust-lang.org/stable/std/collections/struct.BTreeSet.html)
|
||||
* (https://doc.rust-lang.org/stable/std/collections/struct.BTreeMap.html)
|
||||
*/
|
||||
export function sortAsc<V extends SortArg = Codec> (a: V, b: V): number {
|
||||
if (isNumberLike(a) && isNumberLike(b)) {
|
||||
return bnToBn(a).cmp(bnToBn(b));
|
||||
} else if (a instanceof Map && b instanceof Map) {
|
||||
return sortAsc(Array.from(a.values()), Array.from(b.values()));
|
||||
} else if (isEnum(a) && isEnum(b)) {
|
||||
return sortAsc(a.index, b.index) || sortAsc(a.value, b.value);
|
||||
} else if (isArrayLike(a) && isArrayLike(b)) {
|
||||
return sortArray(a, b);
|
||||
} else if (isCodec(a) && isCodec(b)) {
|
||||
// Text, Bool etc.
|
||||
return sortAsc(a.toU8a(true), b.toU8a(true));
|
||||
}
|
||||
|
||||
throw new Error(`Attempting to sort unrecognized values: ${stringify(a)} (typeof ${typeof a}) <-> ${stringify(b)} (typeof ${typeof b})`);
|
||||
}
|
||||
|
||||
export function sortSet<V extends Codec = Codec> (set: Set<V>): Set<V> {
|
||||
return new Set(Array.from(set).sort(sortAsc));
|
||||
}
|
||||
|
||||
export function sortMap<K extends Codec = Codec, V extends Codec = Codec> (map: Map<K, V>): Map<K, V> {
|
||||
return new Map(Array.from(map.entries()).sort(([keyA], [keyB]) => sortAsc(keyA, keyB)));
|
||||
}
|
||||
@@ -8,12 +8,18 @@ import type { FromReg, TypeDef } from './types';
|
||||
import { assert, isNumber, isUndefined, stringify } from '@polkadot/util';
|
||||
|
||||
import { BTreeMap, BTreeSet, CodecSet, Compact, DoNotConstruct, Enum, HashMap, Int, Option, Result, Struct, Tuple, U8aFixed, UInt, Vec, VecFixed } from '../codec';
|
||||
import { Bytes, Null } from '../primitive';
|
||||
import { getTypeDef } from './getTypeDef';
|
||||
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 +82,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 +108,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 +130,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 =>
|
||||
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,18 +159,24 @@ 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.type)),
|
||||
|
||||
[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);
|
||||
|
||||
return (
|
||||
subType === 'u8'
|
||||
? createClass(registry, 'Bytes')
|
||||
? Bytes
|
||||
: Vec.with(subType)
|
||||
);
|
||||
},
|
||||
@@ -164,34 +184,38 @@ const infoMapping: Record<TypeDefInfo, (registry: Registry, value: TypeDef) => C
|
||||
[TypeDefInfo.VecFixed]: (registry: Registry, { displayName, length, sub }: TypeDef): Constructor => {
|
||||
assert(isNumber(length) && !isUndefined(sub), 'Expected length & type information for fixed vector');
|
||||
|
||||
const subType = (sub as TypeDef).type as keyof InterfaceTypes;
|
||||
|
||||
return (
|
||||
(sub as TypeDef).type === 'u8'
|
||||
subType === 'u8'
|
||||
? U8aFixed.with((length * 8) as U8aBitLength, displayName)
|
||||
: VecFixed.with((sub as TypeDef).type as keyof InterfaceTypes, length)
|
||||
: VecFixed.with(subType, length)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
// Returns the type Class for construction
|
||||
export function getTypeClass<T extends Codec = Codec> (registry: Registry, value: TypeDef): Constructor<T> {
|
||||
let Type = registry.get<T>(value.type);
|
||||
export function getTypeClass<T extends Codec = Codec> (registry: Registry, typeDef: TypeDef): Constructor<T> {
|
||||
let Type = registry.get<T>(typeDef.type);
|
||||
|
||||
if (Type) {
|
||||
return Type;
|
||||
}
|
||||
|
||||
const getFn = infoMapping[value.info];
|
||||
try {
|
||||
Type = infoMapping[typeDef.info](registry, typeDef) as Constructor<T>;
|
||||
|
||||
assert(getFn, () => `Unable to construct class from ${stringify(value)}`);
|
||||
assert(Type, 'No class created');
|
||||
|
||||
Type = getFn(registry, value) as Constructor<T>;
|
||||
// don't clobber any existing
|
||||
if (!Type.__fallbackType && typeDef.fallbackType) {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore ...this is the only place we we actually assign this...
|
||||
Type.__fallbackType = typeDef.fallbackType;
|
||||
}
|
||||
|
||||
// don't clobber any existing
|
||||
if (!Type.__fallbackType && value.fallbackType) {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore ...this is the only place we we actually assign this...
|
||||
Type.__fallbackType = value.fallbackType;
|
||||
return Type;
|
||||
} catch (error) {
|
||||
throw new Error(`Unable to construct class from ${stringify(typeDef)}: ${(error as Error).message}`);
|
||||
}
|
||||
|
||||
return Type;
|
||||
}
|
||||
|
||||
@@ -3,20 +3,16 @@
|
||||
|
||||
import type { Bytes } from '../primitive/Bytes';
|
||||
import type { Codec, Constructor, InterfaceTypes, Registry } from '../types';
|
||||
import type { FromReg } from './types';
|
||||
import type { CreateOptions, FromReg } from './types';
|
||||
|
||||
import { assert, isHex, isU8a, u8aEq, u8aToHex, u8aToU8a } from '@polkadot/util';
|
||||
|
||||
import { Option } from '../codec/Option';
|
||||
import { createClass } from './createClass';
|
||||
|
||||
interface CreateOptions {
|
||||
blockHash?: Uint8Array | string | null;
|
||||
isPedantic?: boolean;
|
||||
}
|
||||
|
||||
// With isPedantic, actually check that the encoding matches that supplied. This
|
||||
// is much slower, but verifies that we have the correct types defined
|
||||
function checkInstance<T extends Codec = Codec, K extends string = string> (value: Uint8Array, created: FromReg<T, K>): void {
|
||||
function checkInstance (created: FromReg<Codec, string>, value: Uint8Array): void {
|
||||
const u8a = created.toU8a();
|
||||
const rawType = created.toRawType();
|
||||
|
||||
@@ -30,25 +26,29 @@ function checkInstance<T extends Codec = Codec, K extends string = string> (valu
|
||||
);
|
||||
}
|
||||
|
||||
// Initializes a type with a value. This also checks for fallbacks and in the cases
|
||||
// where isPedantic is specified (storage decoding), also check the format/structure
|
||||
function initType<T extends Codec = Codec, K extends string = string> (registry: Registry, Type: Constructor<FromReg<T, K>>, params: unknown[] = [], { blockHash, isPedantic }: CreateOptions = {}): FromReg<T, K> {
|
||||
const created = new Type(registry, ...params);
|
||||
const value = params[0];
|
||||
|
||||
function checkPedantic (created: FromReg<Codec, string>, [value]: unknown[], isPedantic = false): void {
|
||||
if (isPedantic) {
|
||||
if (isU8a(value)) {
|
||||
checkInstance(value, created);
|
||||
checkInstance(created, value);
|
||||
} else if (isHex(value)) {
|
||||
checkInstance(u8aToU8a(value), created);
|
||||
checkInstance(created, u8aToU8a(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Initializes a type with a value. This also checks for fallbacks and in the cases
|
||||
// where isPedantic is specified (storage decoding), also check the format/structure
|
||||
function initType<T extends Codec = Codec, K extends string = string> (registry: Registry, Type: Constructor<FromReg<T, K>>, params: unknown[] = [], { blockHash, isOptional, isPedantic }: CreateOptions = {}): FromReg<T, K> {
|
||||
const created = new (isOptional ? Option.with(Type) : Type)(registry, ...params);
|
||||
|
||||
checkPedantic(created, params, isPedantic);
|
||||
|
||||
if (blockHash) {
|
||||
created.createdAtHash = createType(registry, 'Hash', blockHash);
|
||||
}
|
||||
|
||||
return created;
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
return created as any;
|
||||
}
|
||||
|
||||
// An unsafe version of the `createType` below. It's unsafe because the `type`
|
||||
|
||||
@@ -2,12 +2,15 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { encodeTypeDef } from './encodeTypes';
|
||||
import { TypeRegistry } from './registry';
|
||||
import { TypeDefInfo } from './types';
|
||||
|
||||
describe('encodeTypeDef', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
it('correctly encodes a complex struct', (): void => {
|
||||
expect(
|
||||
JSON.parse(encodeTypeDef({
|
||||
JSON.parse(encodeTypeDef(registry, {
|
||||
info: TypeDefInfo.Struct,
|
||||
sub: [
|
||||
{
|
||||
@@ -47,7 +50,7 @@ describe('encodeTypeDef', (): void => {
|
||||
|
||||
it('correctly encodes a complex struct (named)', (): void => {
|
||||
expect(
|
||||
JSON.parse(encodeTypeDef({
|
||||
JSON.parse(encodeTypeDef(registry, {
|
||||
info: TypeDefInfo.Struct,
|
||||
sub: [
|
||||
{
|
||||
@@ -88,7 +91,7 @@ describe('encodeTypeDef', (): void => {
|
||||
|
||||
it('correctly encodes a complex enum', (): void => {
|
||||
expect(
|
||||
JSON.parse(encodeTypeDef({
|
||||
JSON.parse(encodeTypeDef(registry, {
|
||||
info: TypeDefInfo.Enum,
|
||||
sub: [
|
||||
{
|
||||
@@ -148,7 +151,7 @@ describe('encodeTypeDef', (): void => {
|
||||
|
||||
it('correctly encodes a complex enum (named)', (): void => {
|
||||
expect(
|
||||
JSON.parse(encodeTypeDef({
|
||||
JSON.parse(encodeTypeDef(registry, {
|
||||
info: TypeDefInfo.Enum,
|
||||
sub: [
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Registry } from '../types/registry';
|
||||
import type { TypeDef } from './types';
|
||||
|
||||
import { assert, isNumber, isUndefined, stringify } from '@polkadot/util';
|
||||
@@ -19,7 +20,7 @@ export function paramsNotation <T> (outer: string, inner?: T | T[], transform: (
|
||||
}`;
|
||||
}
|
||||
|
||||
function encodeWithParams (typeDef: TypeDef, outer: string): string {
|
||||
function encodeWithParams (registry: Registry, typeDef: TypeDef, outer: string): string {
|
||||
const { info, sub } = typeDef;
|
||||
|
||||
switch (info) {
|
||||
@@ -31,25 +32,26 @@ function encodeWithParams (typeDef: TypeDef, outer: string): string {
|
||||
case TypeDefInfo.Option:
|
||||
case TypeDefInfo.Result:
|
||||
case TypeDefInfo.Vec:
|
||||
return paramsNotation(outer, sub, (param) => encodeTypeDef(param));
|
||||
return paramsNotation(outer, sub, (param) => encodeTypeDef(registry, param));
|
||||
}
|
||||
|
||||
throw new Error(`Unable to encode ${stringify(typeDef)} with params`);
|
||||
}
|
||||
|
||||
function encodeDoNotConstruct ({ displayName }: TypeDef): string {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
function encodeDoNotConstruct (registry: Registry, { displayName }: TypeDef): string {
|
||||
return `DoNotConstruct<${displayName || 'Unknown'}>`;
|
||||
}
|
||||
|
||||
function encodeSubTypes (sub: TypeDef[], asEnum?: boolean): string {
|
||||
function encodeSubTypes (registry: Registry, sub: TypeDef[], asEnum?: boolean, extra?: Record<string, unknown>): string {
|
||||
const names = sub.map(({ name }) => name);
|
||||
|
||||
assert(names.every((n) => !!n), () => `Subtypes does not have consistent names, ${names.join(', ')}`);
|
||||
|
||||
const inner = sub.reduce< Record<string, string>>((result, type) => ({
|
||||
...result,
|
||||
[type.name as string]: encodeTypeDef(type)
|
||||
}), {});
|
||||
[type.name as string]: encodeTypeDef(registry, type)
|
||||
}), { ...(extra as Record<string, string>) });
|
||||
|
||||
return stringify(
|
||||
asEnum
|
||||
@@ -58,7 +60,7 @@ function encodeSubTypes (sub: TypeDef[], asEnum?: boolean): string {
|
||||
);
|
||||
}
|
||||
|
||||
function encodeEnum (typeDef: TypeDef): string {
|
||||
function encodeEnum (registry: Registry, typeDef: TypeDef): string {
|
||||
assert(typeDef.sub && Array.isArray(typeDef.sub), 'Unable to encode Enum type');
|
||||
|
||||
const sub = typeDef.sub;
|
||||
@@ -67,28 +69,38 @@ function encodeEnum (typeDef: TypeDef): string {
|
||||
// TODO We need to take the disciminant into account and auto-add empty entries
|
||||
return sub.every(({ type }) => type === 'Null')
|
||||
? stringify({ _enum: sub.map(({ name }, index) => `${name || `Empty${index}`}`) })
|
||||
: encodeSubTypes(sub, true);
|
||||
: encodeSubTypes(registry, sub, true);
|
||||
}
|
||||
|
||||
function encodeStruct (typeDef: TypeDef): string {
|
||||
function encodeStruct (registry: Registry, typeDef: TypeDef): string {
|
||||
assert(typeDef.sub && Array.isArray(typeDef.sub), 'Unable to encode Struct type');
|
||||
|
||||
return encodeSubTypes(typeDef.sub);
|
||||
return encodeSubTypes(registry, typeDef.sub, false, {
|
||||
...(
|
||||
typeDef.alias
|
||||
? { _alias: [...typeDef.alias.entries()].reduce<Record<string, string>>((all, [k, v]) => ({
|
||||
...all,
|
||||
[k]: v
|
||||
}), {}) }
|
||||
: {}
|
||||
)
|
||||
});
|
||||
}
|
||||
|
||||
function encodeTuple (typeDef: TypeDef): string {
|
||||
function encodeTuple (registry: Registry, typeDef: TypeDef): string {
|
||||
assert(typeDef.sub && Array.isArray(typeDef.sub), 'Unable to encode Tuple type');
|
||||
|
||||
return `(${typeDef.sub.map((type) => encodeTypeDef(type)).join(', ')})`;
|
||||
return `(${typeDef.sub.map((type) => encodeTypeDef(registry, type)).join(',')})`;
|
||||
}
|
||||
|
||||
function encodeUInt ({ length }: TypeDef, type: 'Int' | 'UInt'): string {
|
||||
function encodeUInt (registry: Registry, { length }: TypeDef, type: 'Int' | 'UInt'): string {
|
||||
assert(isNumber(length), 'Unable to encode VecFixed type');
|
||||
|
||||
return `${type}<${length}>`;
|
||||
}
|
||||
|
||||
function encodeVecFixed ({ length, sub }: TypeDef): string {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
function encodeVecFixed (registry: Registry, { length, sub }: TypeDef): string {
|
||||
assert(isNumber(length) && !isUndefined(sub) && !Array.isArray(sub), 'Unable to encode VecFixed type');
|
||||
|
||||
return `[${sub.type};${length}]`;
|
||||
@@ -96,38 +108,63 @@ function encodeVecFixed ({ length, sub }: TypeDef): string {
|
||||
|
||||
// We setup a record here to ensure we have comprehensive coverage (any item not covered will result
|
||||
// in a compile-time error with the missing index)
|
||||
const encoders: Record<TypeDefInfo, (typeDef: TypeDef) => string> = {
|
||||
[TypeDefInfo.BTreeMap]: (typeDef: TypeDef): string => encodeWithParams(typeDef, 'BTreeMap'),
|
||||
[TypeDefInfo.BTreeSet]: (typeDef: TypeDef): string => encodeWithParams(typeDef, 'BTreeSet'),
|
||||
[TypeDefInfo.Compact]: (typeDef: TypeDef): string => encodeWithParams(typeDef, 'Compact'),
|
||||
[TypeDefInfo.DoNotConstruct]: (typeDef: TypeDef): string => encodeDoNotConstruct(typeDef),
|
||||
[TypeDefInfo.Enum]: (typeDef: TypeDef): string => encodeEnum(typeDef),
|
||||
[TypeDefInfo.HashMap]: (typeDef: TypeDef): string => encodeWithParams(typeDef, 'HashMap'),
|
||||
[TypeDefInfo.Int]: (typeDef: TypeDef): string => encodeUInt(typeDef, 'Int'),
|
||||
[TypeDefInfo.Linkage]: (typeDef: TypeDef): string => encodeWithParams(typeDef, 'Linkage'),
|
||||
const encoders: Record<TypeDefInfo, (registry: Registry, typeDef: TypeDef) => string> = {
|
||||
[TypeDefInfo.BTreeMap]: (registry: Registry, typeDef: TypeDef) =>
|
||||
encodeWithParams(registry, typeDef, 'BTreeMap'),
|
||||
[TypeDefInfo.BTreeSet]: (registry: Registry, typeDef: TypeDef) =>
|
||||
encodeWithParams(registry, typeDef, 'BTreeSet'),
|
||||
[TypeDefInfo.Compact]: (registry: Registry, typeDef: TypeDef) =>
|
||||
encodeWithParams(registry, typeDef, 'Compact'),
|
||||
[TypeDefInfo.DoNotConstruct]: (registry: Registry, typeDef: TypeDef) =>
|
||||
encodeDoNotConstruct(registry, typeDef),
|
||||
[TypeDefInfo.Enum]: (registry: Registry, typeDef: TypeDef) =>
|
||||
encodeEnum(registry, typeDef),
|
||||
[TypeDefInfo.HashMap]: (registry: Registry, typeDef: TypeDef) =>
|
||||
encodeWithParams(registry, typeDef, 'HashMap'),
|
||||
[TypeDefInfo.Int]: (registry: Registry, typeDef: TypeDef) =>
|
||||
encodeUInt(registry, typeDef, 'Int'),
|
||||
[TypeDefInfo.Linkage]: (registry: Registry, typeDef: TypeDef) =>
|
||||
encodeWithParams(registry, typeDef, 'Linkage'),
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
[TypeDefInfo.Null]: (typeDef: TypeDef): string => 'Null',
|
||||
[TypeDefInfo.Option]: (typeDef: TypeDef): string => encodeWithParams(typeDef, 'Option'),
|
||||
[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.Struct]: (typeDef: TypeDef): string => encodeStruct(typeDef),
|
||||
[TypeDefInfo.Tuple]: (typeDef: TypeDef): string => encodeTuple(typeDef),
|
||||
[TypeDefInfo.UInt]: (typeDef: TypeDef): string => encodeUInt(typeDef, 'UInt'),
|
||||
[TypeDefInfo.Vec]: (typeDef: TypeDef): string => encodeWithParams(typeDef, 'Vec'),
|
||||
[TypeDefInfo.VecFixed]: (typeDef: TypeDef): string => encodeVecFixed(typeDef)
|
||||
[TypeDefInfo.Null]: (registry: Registry, typeDef: TypeDef) =>
|
||||
'Null',
|
||||
[TypeDefInfo.Option]: (registry: Registry, typeDef: TypeDef) =>
|
||||
encodeWithParams(registry, typeDef, 'Option'),
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
[TypeDefInfo.Plain]: (registry: Registry, typeDef: TypeDef) =>
|
||||
typeDef.displayName || typeDef.type,
|
||||
[TypeDefInfo.Result]: (registry: Registry, typeDef: TypeDef) =>
|
||||
encodeWithParams(registry, typeDef, 'Result'),
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
[TypeDefInfo.Set]: (registry: Registry, typeDef: TypeDef) =>
|
||||
typeDef.type,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
[TypeDefInfo.Si]: (registry: Registry, typeDef: TypeDef) =>
|
||||
typeDef.lookupName || typeDef.type,
|
||||
[TypeDefInfo.Struct]: (registry: Registry, typeDef: TypeDef) =>
|
||||
encodeStruct(registry, typeDef),
|
||||
[TypeDefInfo.Tuple]: (registry: Registry, typeDef: TypeDef) =>
|
||||
encodeTuple(registry, typeDef),
|
||||
[TypeDefInfo.UInt]: (registry: Registry, typeDef: TypeDef) =>
|
||||
encodeUInt(registry, typeDef, 'UInt'),
|
||||
[TypeDefInfo.Vec]: (registry: Registry, typeDef: TypeDef) =>
|
||||
encodeWithParams(registry, typeDef, 'Vec'),
|
||||
[TypeDefInfo.VecFixed]: (registry: Registry, typeDef: TypeDef) =>
|
||||
encodeVecFixed(registry, typeDef)
|
||||
};
|
||||
|
||||
function encodeType (typeDef: TypeDef): string {
|
||||
function encodeType (registry: Registry, typeDef: TypeDef, withLookup = true): string {
|
||||
const encoder = encoders[typeDef.info];
|
||||
|
||||
assert(encoder, () => `Cannot encode type: ${stringify(typeDef)}`);
|
||||
assert(encoder, () => `Cannot encode type ${stringify(typeDef)}`);
|
||||
|
||||
return encoder(typeDef);
|
||||
return withLookup && typeDef.lookupName
|
||||
? typeDef.lookupName
|
||||
: encoder(registry, typeDef);
|
||||
}
|
||||
|
||||
export function encodeTypeDef (typeDef: TypeDef): string {
|
||||
assert(!isUndefined(typeDef.info), () => `Invalid type definition with no instance info, ${stringify(typeDef)}`);
|
||||
export function encodeTypeDef (registry: Registry, typeDef: TypeDef): string {
|
||||
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
|
||||
@@ -136,12 +173,12 @@ export function encodeTypeDef (typeDef: TypeDef): string {
|
||||
return typeDef.displayName;
|
||||
}
|
||||
|
||||
return encodeType(typeDef);
|
||||
return encodeType(registry, typeDef);
|
||||
}
|
||||
|
||||
export function withTypeString (typeDef: Omit<TypeDef, 'type'>): TypeDef {
|
||||
export function withTypeString (registry: Registry, typeDef: Omit<TypeDef, 'type'>): TypeDef {
|
||||
return {
|
||||
...typeDef,
|
||||
type: encodeType(typeDef as TypeDef)
|
||||
type: encodeType(registry, typeDef as TypeDef, false)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,8 +4,9 @@
|
||||
/* 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 type { CreateOptions } from './types';
|
||||
|
||||
import { assert, assertReturn, BN_ZERO, formatBalance, isFunction, isString, isU8a, logger, stringCamelCase, stringify, u8aToHex } from '@polkadot/util';
|
||||
import { blake2AsU8a } from '@polkadot/util-crypto';
|
||||
@@ -20,7 +21,7 @@ import * as definitions from '../interfaces/definitions';
|
||||
import { decorateConstants, decorateExtrinsics } from '../metadata/decorate';
|
||||
import { Metadata } from '../metadata/Metadata';
|
||||
import { createClass, getTypeClass } from './createClass';
|
||||
import { createType } from './createType';
|
||||
import { createTypeUnsafe } from './createType';
|
||||
import { getTypeDef } from './getTypeDef';
|
||||
|
||||
const l = logger('registry');
|
||||
@@ -30,15 +31,17 @@ function injectErrors (_: Registry, metadata: Metadata, metadataErrors: Record<s
|
||||
const modules = metadata.asLatest.modules;
|
||||
|
||||
// decorate the errors
|
||||
modules.forEach((section, _sectionIndex): void => {
|
||||
const sectionIndex = metadata.version >= 12 ? section.index.toNumber() : _sectionIndex;
|
||||
const sectionName = stringCamelCase(section.name);
|
||||
modules.forEach(({ errors, index, name }, _sectionIndex): void => {
|
||||
const sectionIndex = metadata.version >= 12
|
||||
? index.toNumber()
|
||||
: _sectionIndex;
|
||||
const sectionName = stringCamelCase(name);
|
||||
|
||||
section.errors.forEach(({ documentation, name }, index): void => {
|
||||
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(),
|
||||
@@ -53,13 +56,13 @@ function injectEvents (registry: Registry, metadata: Metadata, metadataEvents: R
|
||||
// decorate the events
|
||||
metadata.asLatest.modules
|
||||
.filter(({ events }) => events.isSome)
|
||||
.forEach((section, _sectionIndex): void => {
|
||||
.forEach(({ events, index, name }, _sectionIndex): void => {
|
||||
const sectionIndex = metadata.version >= 12
|
||||
? section.index.toNumber()
|
||||
? index.toNumber()
|
||||
: _sectionIndex;
|
||||
const sectionName = stringCamelCase(section.name);
|
||||
const sectionName = stringCamelCase(name);
|
||||
|
||||
section.events.unwrap().forEach((meta, methodIndex): void => {
|
||||
events.unwrap().forEach((meta, methodIndex): void => {
|
||||
const methodName = meta.name.toString();
|
||||
const typeDef = meta.args.map((arg) => getTypeDef(arg));
|
||||
let Types: Constructor<Codec>[] | null = null;
|
||||
@@ -114,6 +117,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 +200,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()];
|
||||
}
|
||||
@@ -219,7 +250,14 @@ export class TypeRegistry implements Registry {
|
||||
* @description Creates an instance of a type as registered
|
||||
*/
|
||||
public createType <K extends keyof InterfaceTypes> (type: K, ...params: unknown[]): InterfaceTypes[K] {
|
||||
return createType(this, type, ...params);
|
||||
return createTypeUnsafe(this, type, params);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Creates an instance of a type as registered
|
||||
*/
|
||||
public createTypeUnsafe <T extends Codec = Codec, K extends string = string> (type: K, params: unknown[], options?: CreateOptions): T {
|
||||
return createTypeUnsafe(this, type, params, options);
|
||||
}
|
||||
|
||||
// find a specific call
|
||||
@@ -388,6 +426,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);
|
||||
|
||||
@@ -26,6 +26,7 @@ export enum TypeDefInfo {
|
||||
Int,
|
||||
UInt,
|
||||
DoNotConstruct,
|
||||
Si,
|
||||
// anything not fully supported (keep this as the last entry)
|
||||
Null
|
||||
}
|
||||
@@ -33,12 +34,23 @@ export enum TypeDefInfo {
|
||||
export interface TypeDef {
|
||||
alias?: Map<string, string>;
|
||||
displayName?: string;
|
||||
docs?: string[];
|
||||
fallbackType?: string;
|
||||
info: TypeDefInfo;
|
||||
index?: number;
|
||||
isFromSi?: boolean;
|
||||
length?: number;
|
||||
lookupIndex?: number;
|
||||
lookupName?: string;
|
||||
lookupNameRoot?: string;
|
||||
name?: string;
|
||||
namespace?: string;
|
||||
sub?: TypeDef | TypeDef[];
|
||||
type: string;
|
||||
}
|
||||
|
||||
export interface CreateOptions {
|
||||
blockHash?: Uint8Array | string | null;
|
||||
isOptional?: boolean;
|
||||
isPedantic?: boolean;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import { TypeRegistry } from '../create';
|
||||
import { Metadata } from '../metadata';
|
||||
import rpcMetadata from '../metadata/static';
|
||||
import rpcMetadata from '../metadata/static-substrate';
|
||||
import { GenericExtrinsic as Extrinsic } from '.';
|
||||
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import { TypeRegistry } from '../create';
|
||||
import { Metadata } from '../metadata';
|
||||
import rpcMetadata from '../metadata/static';
|
||||
import rpcMetadata from '../metadata/static-substrate';
|
||||
import { GenericSignerPayload as SignerPayload } from '.';
|
||||
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
@@ -6,7 +6,7 @@ import { BN } from '@polkadot/util';
|
||||
|
||||
import { TypeRegistry } from '../../create';
|
||||
import { decorateExtrinsics, Metadata } from '../../metadata';
|
||||
import rpcMetadata from '../../metadata/static';
|
||||
import rpcMetadata from '../../metadata/static-substrate';
|
||||
import { GenericExtrinsicV4 as Extrinsic } from '.';
|
||||
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
@@ -6,7 +6,7 @@ import { BN_ZERO } from '@polkadot/util';
|
||||
|
||||
import { TypeRegistry } from '../../create';
|
||||
import { Metadata } from '../../metadata';
|
||||
import metadataStatic from '../../metadata/static';
|
||||
import metadataStatic from '../../metadata/static-substrate';
|
||||
import { GenericExtrinsicSignatureV4 as ExtrinsicSignature } from '.';
|
||||
|
||||
const signOptions = {
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
import { TypeRegistry } from '../create';
|
||||
import block00300 from '../json/SignedBlock.003.00.json';
|
||||
import { Metadata } from '../metadata';
|
||||
import metadataStatic from '../metadata/static';
|
||||
import metadataStatic from '../metadata/static-substrate';
|
||||
import { GenericBlock as Block } from './Block';
|
||||
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import { TypeRegistry } from '../create';
|
||||
import { Metadata } from '../metadata';
|
||||
import metadataStatic from '../metadata/static';
|
||||
import metadataStatic from '../metadata/static-substrate';
|
||||
import { GenericCall as Call } from '.';
|
||||
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
@@ -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()) }
|
||||
: {}
|
||||
)
|
||||
};
|
||||
|
||||
@@ -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,534 @@
|
||||
// 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, SiPath, SiType, SiTypeDefArray, SiTypeDefCompact, SiTypeDefComposite, SiTypeDefSequence, SiTypeDefTuple, SiTypeDefVariant, SiTypeParameter, SiVariant } from '../interfaces/scaleInfo';
|
||||
import type { Text } from '../primitive/Text';
|
||||
import type { Type } from '../primitive/Type';
|
||||
import type { Registry, TypeDef } from '../types';
|
||||
|
||||
import { assert, isNumber, isString, stringCamelCase, stringify, stringUpperFirst } from '@polkadot/util';
|
||||
|
||||
import { Struct } from '../codec/Struct';
|
||||
import { withTypeString } from '../create/encodeTypes';
|
||||
import { getTypeDef } from '../create/getTypeDef';
|
||||
import { TypeDefInfo } from '../types';
|
||||
|
||||
// Alias the primitive enum with out known values
|
||||
const PRIMITIVE_ALIAS: Record<string, string> = {
|
||||
Char: 'u32', // Rust char is 4-bytes
|
||||
Str: 'Text'
|
||||
};
|
||||
|
||||
// These are types where we have a specific decoding/encoding override + helpers
|
||||
const PRIMITIVE_PATHS = [
|
||||
// match {node, polkadot, ...}_runtime
|
||||
'*_runtime::Call',
|
||||
'*_runtime::Event',
|
||||
// these have a specific encoding or logic (for pallets)
|
||||
'pallet_democracy::vote::Vote',
|
||||
'pallet_identity::types::Data',
|
||||
// these are well-known types with additional encoding
|
||||
'sp_core::crypto::AccountId32',
|
||||
'sp_runtime::generic::era::Era',
|
||||
'sp_runtime::multiaddress::MultiAddress',
|
||||
// shorten some well-known types
|
||||
'primitive_types::*',
|
||||
'sp_arithmetic::per_things::*',
|
||||
// ink!
|
||||
'ink_env::types::*'
|
||||
].map((p) => p.split('::'));
|
||||
|
||||
// Mappings for types that should be converted to set via BitVec
|
||||
const SETS = [
|
||||
'pallet_identity::types::BitFlags'
|
||||
].map((p) => p.split('::'));
|
||||
|
||||
// These we never use these as top-level names, they are wrappers
|
||||
const WRAPPERS = ['BoundedBTreeMap', 'BoundedVec', 'Box', 'BTreeMap', 'Cow', 'Result', 'Option', 'WeakBoundedVec'];
|
||||
|
||||
// These are reserved and/or conflicts with built-in Codec definitions
|
||||
const RESERVED = ['call', 'entries', 'hash', 'keys', 'new', 'size'];
|
||||
|
||||
function matchParts (first: string[], second: (string | Text)[]): boolean {
|
||||
return first.length === second.length && first.every((a, index) => {
|
||||
const b = second[index].toString();
|
||||
|
||||
return (a === '*') || (a === b) || (
|
||||
a.includes('*') &&
|
||||
a.includes('_') &&
|
||||
b.includes('_') &&
|
||||
matchParts(a.split('_'), b.split('_'))
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
// check if the path matches the PRIMITIVE_SP (with wildcards)
|
||||
function getPrimitivePath (path: SiPath): string | null {
|
||||
// TODO We need to handle ink! Balance in some way
|
||||
return path.length && PRIMITIVE_PATHS.some((p) => matchParts(p, path))
|
||||
? path[path.length - 1].toString()
|
||||
: null;
|
||||
}
|
||||
|
||||
function removeDuplicateNames (names: [number, (string | null)][]): [number, (string | null)][] {
|
||||
return names.map(([lookupIndex, name]): [number, string | null] => [
|
||||
lookupIndex,
|
||||
(
|
||||
!name ||
|
||||
names.some(([oIndex, oName]) =>
|
||||
name === oName &&
|
||||
lookupIndex !== oIndex
|
||||
)
|
||||
)
|
||||
? null
|
||||
: name
|
||||
]);
|
||||
}
|
||||
|
||||
function extractName (types: PortableType[], id: SiLookupTypeId, { params, path }: SiType): [number, string | null] {
|
||||
const lookupIndex = id.toNumber();
|
||||
|
||||
if (!path.length || WRAPPERS.includes(path[path.length - 1].toString())) {
|
||||
return [lookupIndex, null];
|
||||
}
|
||||
|
||||
const parts = path
|
||||
.map((p) => stringUpperFirst(stringCamelCase(p)))
|
||||
.filter((p, index) =>
|
||||
(
|
||||
// Remove ::{pallet, traits, types}::
|
||||
index !== 1 ||
|
||||
!['Pallet', 'Traits', 'Types'].includes(p.toString())
|
||||
) &&
|
||||
(
|
||||
// sp_runtime::generic::digest::Digest -> sp_runtime::generic::Digest
|
||||
// sp_runtime::multiaddress::MultiAddress -> sp_runtime::MultiAddress
|
||||
index === path.length - 1 ||
|
||||
p.toLowerCase() !== path[index + 1].toLowerCase()
|
||||
)
|
||||
);
|
||||
let typeName = parts.join('');
|
||||
|
||||
if (parts.length === 2 && parts[parts.length - 1] === 'RawOrigin' && params.length === 2 && params[1].type.isSome) {
|
||||
// Do magic for RawOrigin lookup
|
||||
const instanceType = types[params[1].type.unwrap().toNumber()];
|
||||
|
||||
if (instanceType.type.path.length === 2) {
|
||||
typeName = `${typeName}${instanceType.type.path[1].toString()}`;
|
||||
}
|
||||
}
|
||||
|
||||
return [lookupIndex, typeName];
|
||||
}
|
||||
|
||||
function extractNames (registry: Registry, types: PortableType[]): Record<number, string> {
|
||||
const dedup = removeDuplicateNames(
|
||||
types.map(({ id, type }) =>
|
||||
extractName(types, id, type)
|
||||
)
|
||||
);
|
||||
const [names, typesNew] = dedup.reduce<[Record<number, string>, Record<string, string>]>(([names, types], [lookupIndex, name], index) => {
|
||||
if (name) {
|
||||
// We set the name for this specific type
|
||||
names[index] = name;
|
||||
|
||||
// we map to the actual lookupIndex
|
||||
types[name] = registry.createLookupType(lookupIndex);
|
||||
}
|
||||
|
||||
return [names, types];
|
||||
}, [{}, {}]);
|
||||
|
||||
registry.register(typesNew);
|
||||
|
||||
return names;
|
||||
}
|
||||
|
||||
export class GenericPortableRegistry extends Struct {
|
||||
#names: Record<number, string>;
|
||||
#typeDefs: Record<number, TypeDef> = {};
|
||||
|
||||
constructor (registry: Registry, value?: Uint8Array) {
|
||||
super(registry, {
|
||||
types: 'Vec<PortableType>'
|
||||
}, value);
|
||||
|
||||
this.#names = extractNames(registry, this.types);
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 lookupIndex = this.#getLookupId(lookupId);
|
||||
|
||||
if (!this.#typeDefs[lookupIndex]) {
|
||||
// we set first since we will get into circular lookups along the way
|
||||
this.#typeDefs[lookupIndex] = {
|
||||
info: TypeDefInfo.DoNotConstruct,
|
||||
lookupIndex,
|
||||
lookupName: this.#names[lookupIndex],
|
||||
type: this.registry.createLookupType(lookupIndex)
|
||||
};
|
||||
|
||||
const extracted = this.#extract(this.getSiType(lookupId), lookupIndex);
|
||||
|
||||
Object.keys(extracted).forEach((k): void => {
|
||||
if (k !== 'lookupName' || extracted[k]) {
|
||||
// these are safe since we are looking through the keys as set
|
||||
this.#typeDefs[lookupIndex][k as 'info'] = extracted[k as 'info'];
|
||||
}
|
||||
});
|
||||
|
||||
// don't set lookupName on lower-level, we want to always direct to the type
|
||||
if (extracted.info === TypeDefInfo.Plain) {
|
||||
this.#typeDefs[lookupIndex].lookupNameRoot = this.#typeDefs[lookupIndex].lookupName;
|
||||
delete this.#typeDefs[lookupIndex].lookupName;
|
||||
}
|
||||
}
|
||||
|
||||
return this.#typeDefs[lookupIndex];
|
||||
}
|
||||
|
||||
#createSiDef (lookupId: SiLookupTypeId): TypeDef {
|
||||
const typeDef = this.getTypeDef(lookupId);
|
||||
const lookupIndex = lookupId.toNumber();
|
||||
|
||||
// Setup for a lookup on complex types
|
||||
return [TypeDefInfo.Enum, TypeDefInfo.Struct].includes(typeDef.info) && typeDef.lookupName
|
||||
? {
|
||||
docs: typeDef.docs,
|
||||
info: TypeDefInfo.Si,
|
||||
lookupIndex,
|
||||
lookupName: this.#names[lookupIndex],
|
||||
type: this.registry.createLookupType(lookupId)
|
||||
}
|
||||
: typeDef;
|
||||
}
|
||||
|
||||
#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];
|
||||
let typeDef: TypeDef;
|
||||
const primType = getPrimitivePath(type.path);
|
||||
|
||||
try {
|
||||
if (primType) {
|
||||
typeDef = this.#extractPrimitivePath(lookupIndex, primType);
|
||||
} 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, type.def.asComposite);
|
||||
} else if (type.def.isHistoricMetaCompat) {
|
||||
typeDef = this.#extractHistoric(lookupIndex, 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: ${lookupIndex}: Error extracting ${stringify(type)}: ${(error as Error).message}`);
|
||||
}
|
||||
|
||||
return {
|
||||
docs: type.docs.map((d) => d.toString()),
|
||||
namespace: path.join('::'),
|
||||
...typeDef
|
||||
};
|
||||
}
|
||||
|
||||
#extractArray (lookupIndex: number, { len: length, type }: SiTypeDefArray): TypeDef {
|
||||
assert(!length || length.toNumber() <= 256, () => `PortableRegistry: ${lookupIndex}: Only support for [Type; <length>], where length <= 256`);
|
||||
|
||||
return withTypeString(this.registry, {
|
||||
info: TypeDefInfo.VecFixed,
|
||||
length: length.toNumber(),
|
||||
sub: this.#createSiDef(type)
|
||||
});
|
||||
}
|
||||
|
||||
#extractCompact (_: number, { type }: SiTypeDefCompact): TypeDef {
|
||||
return withTypeString(this.registry, {
|
||||
info: TypeDefInfo.Compact,
|
||||
sub: this.#createSiDef(type)
|
||||
});
|
||||
}
|
||||
|
||||
#extractComposite (lookupIndex: number, { params, path }: SiType, { fields }: SiTypeDefComposite): TypeDef {
|
||||
if (path.length === 1 && path[0].eq('BTreeMap')) {
|
||||
return withTypeString(this.registry, {
|
||||
info: TypeDefInfo.BTreeMap,
|
||||
sub: params.map(({ type }) => this.#createSiDef(type.unwrap()))
|
||||
});
|
||||
}
|
||||
|
||||
return SETS.some((p) => matchParts(p, path))
|
||||
? this.#extractCompositeSet(lookupIndex, params, fields)
|
||||
: this.#extractFields(lookupIndex, fields);
|
||||
}
|
||||
|
||||
#extractCompositeSet (lookupIndex: number, params: SiTypeParameter[], fields: SiField[]): TypeDef {
|
||||
assert(params.length === 1 && fields.length === 1, () => `PortableRegistry: ${lookupIndex}: Set handling expects since param and single field`);
|
||||
|
||||
return withTypeString(this.registry, {
|
||||
info: TypeDefInfo.Set,
|
||||
length: this.registry.createType(this.registry.createLookupType(fields[0].type) as 'u32').bitLength(),
|
||||
sub: this.getSiType(params[0].type.unwrap()).def.asVariant.variants.map(({ index, name }): TypeDef => ({
|
||||
// This will be an issue > 2^53 - 1 ... don't have those (yet)
|
||||
index: index.toNumber(),
|
||||
info: TypeDefInfo.Plain,
|
||||
name: name.toString(),
|
||||
type: 'Null'
|
||||
}))
|
||||
});
|
||||
}
|
||||
|
||||
#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: ${lookupIndex}: Invalid fields type detected, expected either Tuple (all unnamed) or Struct (all named)`);
|
||||
|
||||
if (fields.length === 0) {
|
||||
return {
|
||||
info: TypeDefInfo.Null,
|
||||
type: 'Null'
|
||||
};
|
||||
} else if (isTuple && fields.length === 1) {
|
||||
const typeDef = this.#createSiDef(fields[0].type);
|
||||
|
||||
return {
|
||||
...typeDef,
|
||||
...(
|
||||
lookupIndex === -1
|
||||
? {}
|
||||
: {
|
||||
lookupIndex,
|
||||
lookupName: this.#names[lookupIndex],
|
||||
lookupNameRoot: typeDef.lookupName
|
||||
}
|
||||
)
|
||||
};
|
||||
}
|
||||
|
||||
const [sub, alias] = this.#extractFieldsAlias(fields);
|
||||
|
||||
return withTypeString(this.registry, {
|
||||
info: isTuple // Tuple check first
|
||||
? TypeDefInfo.Tuple
|
||||
: TypeDefInfo.Struct,
|
||||
...(
|
||||
alias.size
|
||||
? { alias }
|
||||
: {}
|
||||
),
|
||||
...(
|
||||
lookupIndex === -1
|
||||
? {}
|
||||
: {
|
||||
lookupIndex,
|
||||
lookupName: this.#names[lookupIndex]
|
||||
}
|
||||
),
|
||||
sub
|
||||
});
|
||||
}
|
||||
|
||||
#extractFieldsAlias (fields: SiField[]): [TypeDef[], Map<string, string>] {
|
||||
const alias = new Map<string, string>();
|
||||
const sub = fields.map(({ docs, name, type }) => {
|
||||
const typeDef = this.#createSiDef(type);
|
||||
|
||||
if (name.isNone) {
|
||||
return typeDef;
|
||||
}
|
||||
|
||||
let nameField = stringCamelCase(name.unwrap());
|
||||
let nameOrig: string | null = null;
|
||||
|
||||
if (nameField.includes('#')) {
|
||||
nameOrig = nameField;
|
||||
nameField = nameOrig.replace(/#/g, '_');
|
||||
} else if (RESERVED.includes(nameField)) {
|
||||
nameOrig = nameField;
|
||||
nameField = `${nameField}_`;
|
||||
}
|
||||
|
||||
if (nameOrig) {
|
||||
alias.set(nameField, nameOrig);
|
||||
}
|
||||
|
||||
return {
|
||||
...typeDef,
|
||||
docs: docs.map((d) => d.toString()),
|
||||
name: nameField
|
||||
};
|
||||
});
|
||||
|
||||
return [sub, alias];
|
||||
}
|
||||
|
||||
#extractHistoric (_: number, type: Type): TypeDef {
|
||||
return {
|
||||
...getTypeDef(type),
|
||||
displayName: type.toString(),
|
||||
isFromSi: true
|
||||
};
|
||||
}
|
||||
|
||||
#extractPrimitive (_: number, type: SiType): TypeDef {
|
||||
const typeStr = type.def.asPrimitive.type.toString();
|
||||
|
||||
return {
|
||||
info: TypeDefInfo.Plain,
|
||||
type: PRIMITIVE_ALIAS[typeStr] || typeStr.toLowerCase()
|
||||
};
|
||||
}
|
||||
|
||||
#extractPrimitivePath (_: number, type: string): TypeDef {
|
||||
return {
|
||||
info: TypeDefInfo.Plain,
|
||||
type
|
||||
};
|
||||
}
|
||||
|
||||
#extractSequence (lookupIndex: number, { type }: SiTypeDefSequence): TypeDef {
|
||||
const sub = this.#createSiDef(type);
|
||||
|
||||
if (sub.type === 'u8') {
|
||||
return {
|
||||
info: TypeDefInfo.Plain,
|
||||
type: 'Bytes'
|
||||
};
|
||||
}
|
||||
|
||||
return withTypeString(this.registry, {
|
||||
info: TypeDefInfo.Vec,
|
||||
lookupIndex,
|
||||
lookupName: this.#names[lookupIndex],
|
||||
sub
|
||||
});
|
||||
}
|
||||
|
||||
#extractTuple (lookupIndex: number, ids: SiTypeDefTuple): TypeDef {
|
||||
if (ids.length === 0) {
|
||||
return {
|
||||
info: TypeDefInfo.Null,
|
||||
type: 'Null'
|
||||
};
|
||||
} else if (ids.length === 1) {
|
||||
return this.getTypeDef(ids[0]);
|
||||
}
|
||||
|
||||
const sub = ids.map((type) => this.#createSiDef(type));
|
||||
|
||||
return withTypeString(this.registry, {
|
||||
info: TypeDefInfo.Tuple,
|
||||
lookupIndex,
|
||||
lookupName: this.#names[lookupIndex],
|
||||
sub
|
||||
});
|
||||
}
|
||||
|
||||
#extractVariant (lookupIndex: number, { params, path }: SiType, { variants }: SiTypeDefVariant): TypeDef {
|
||||
const specialVariant = path[0].toString();
|
||||
|
||||
if (specialVariant === 'Option') {
|
||||
return withTypeString(this.registry, {
|
||||
info: TypeDefInfo.Option,
|
||||
sub: this.#createSiDef(params[0].type.unwrap())
|
||||
});
|
||||
} else if (specialVariant === 'Result') {
|
||||
return withTypeString(this.registry, {
|
||||
info: TypeDefInfo.Result,
|
||||
sub: params.map(({ type }) => this.#createSiDef(type.unwrap())).map((def, index) => ({
|
||||
name: ['Ok', 'Error'][index],
|
||||
...def
|
||||
}))
|
||||
});
|
||||
} else if (variants.length === 0) {
|
||||
return {
|
||||
info: TypeDefInfo.Null,
|
||||
type: 'Null'
|
||||
};
|
||||
}
|
||||
|
||||
return this.#extractVariantEnum(lookupIndex, variants);
|
||||
}
|
||||
|
||||
#extractVariantEnum (lookupIndex: number, variants: SiVariant[]): TypeDef {
|
||||
const sub: (TypeDef & { name: string })[] = [];
|
||||
|
||||
// we may get entries out of order, arrange them first before creating with gaps filled
|
||||
// NOTE: Since we mutate, use a copy of the array as an input
|
||||
[...variants]
|
||||
.sort((a, b) => a.index.cmp(b.index))
|
||||
.forEach(({ fields, index, name }) => {
|
||||
const desired = index.toNumber();
|
||||
|
||||
while (sub.length !== desired) {
|
||||
sub.push({
|
||||
index: sub.length,
|
||||
info: TypeDefInfo.Null,
|
||||
name: `Unused${sub.length}`,
|
||||
type: 'Null'
|
||||
});
|
||||
}
|
||||
|
||||
sub.push({
|
||||
...this.#extractFields(-1, fields),
|
||||
index: index.toNumber(),
|
||||
name: name.toString()
|
||||
});
|
||||
});
|
||||
|
||||
return withTypeString(this.registry, {
|
||||
info: TypeDefInfo.Enum,
|
||||
lookupIndex,
|
||||
lookupName: this.#names[lookupIndex],
|
||||
sub
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -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';
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import type { Codec } from './types';
|
||||
|
||||
import * as definitions from './interfaces/definitions';
|
||||
import metadataStatic from './metadata/static';
|
||||
import metadataStatic from './metadata/static-substrate';
|
||||
import { createTypeUnsafe, TypeRegistry } from './create';
|
||||
import * as exported from './index.types';
|
||||
import { Metadata } from './metadata';
|
||||
|
||||
@@ -12,11 +12,82 @@ export default {
|
||||
BridgedBlockHash: 'H256',
|
||||
BridgedBlockNumber: 'BlockNumber',
|
||||
BridgedHeader: 'Header',
|
||||
CallOrigin: {
|
||||
_enum: {
|
||||
SourceRoot: 'Null',
|
||||
TargetAccount: '(AccountId, MultiSigner, MultiSignature)',
|
||||
SourceAccount: 'AccountId'
|
||||
}
|
||||
},
|
||||
ChainId: '[u8; 4]',
|
||||
DeliveredMessages: {
|
||||
begin: 'MessageNonce',
|
||||
end: 'MessageNonce',
|
||||
// pub type DispatchResultsBitVec = BitVec<Msb0, u8>;
|
||||
dispatchResults: 'BitVec'
|
||||
},
|
||||
DispatchFeePayment: {
|
||||
_enum: ['AtSourceChain', 'AtTargetChain']
|
||||
},
|
||||
InboundLaneData: {
|
||||
relayers: 'Vec<UnrewardedRelayer>',
|
||||
lastConfirmedNonce: 'MessageNonce'
|
||||
},
|
||||
InboundRelayer: 'AccountId',
|
||||
InitializationData: {
|
||||
header: 'Header',
|
||||
authorityList: 'AuthorityList',
|
||||
setId: 'SetId',
|
||||
isHalted: 'bool'
|
||||
},
|
||||
LaneId: '[u8; 4]',
|
||||
MessageData: {
|
||||
payload: 'Bytes',
|
||||
fee: 'Balance'
|
||||
},
|
||||
MessagesDeliveryProofOf: {
|
||||
bridgedHeaderHash: 'BlockHash',
|
||||
storageProof: 'Vec<Bytes>',
|
||||
lane: 'LaneId'
|
||||
},
|
||||
MessageKey: {
|
||||
laneId: 'LaneId',
|
||||
nonce: 'MessageNonce'
|
||||
},
|
||||
MessageNonce: 'u64',
|
||||
MessagesProofOf: {
|
||||
bridgedHeaderHash: 'BridgedBlockHash',
|
||||
storageProof: 'Vec<Bytes>',
|
||||
lane: 'LaneId',
|
||||
noncesStart: 'MessageNonce',
|
||||
noncesEnd: 'MessageNonce'
|
||||
},
|
||||
OperatingMode: {
|
||||
_enum: ['Normal', 'RejectingOutboundMessages', 'Halted']
|
||||
},
|
||||
OutboundLaneData: {
|
||||
latestGeneratedNonce: 'MessageNonce',
|
||||
latestReceivedNonce: 'MessageNonce',
|
||||
oldestUnprunedNonce: 'MessageNonce'
|
||||
},
|
||||
OutboundMessageFee: 'Balance',
|
||||
OutboundPayload: {
|
||||
specVersion: 'u32',
|
||||
weight: 'Weight',
|
||||
origin: 'CallOrigin',
|
||||
dispatchFeePayment: 'DispatchFeePayment',
|
||||
call: 'Bytes'
|
||||
},
|
||||
Parameter: 'Null',
|
||||
RelayerId: 'AccountId',
|
||||
UnrewardedRelayer: {
|
||||
relayer: 'RelayerId',
|
||||
messages: 'DeliveredMessages'
|
||||
},
|
||||
UnrewardedRelayersState: {
|
||||
unrewardedRelayer_Entries: 'MessageNonce',
|
||||
messagesInOldestEntry: 'MessageNonce',
|
||||
totalMessages: 'MessageNonce'
|
||||
}
|
||||
}
|
||||
} as Definitions;
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
|
||||
/* eslint-disable */
|
||||
|
||||
import type { Struct, bool } from '@polkadot/types';
|
||||
import type { BitVec, Bytes, Enum, Null, Struct, U8aFixed, Vec, bool, u32, u64 } from '@polkadot/types';
|
||||
import type { ITuple } from '@polkadot/types/types';
|
||||
import type { BlockHash } from '@polkadot/types/interfaces/chain';
|
||||
import type { MultiSignature } from '@polkadot/types/interfaces/extrinsics';
|
||||
import type { AuthorityList, SetId } from '@polkadot/types/interfaces/grandpa';
|
||||
import type { BlockNumber, H256, Header } from '@polkadot/types/interfaces/runtime';
|
||||
import type { AccountId, Balance, BlockNumber, H256, Header, MultiSigner, Weight } from '@polkadot/types/interfaces/runtime';
|
||||
|
||||
/** @name BridgedBlockHash */
|
||||
export interface BridgedBlockHash extends H256 {}
|
||||
@@ -14,6 +17,40 @@ export interface BridgedBlockNumber extends BlockNumber {}
|
||||
/** @name BridgedHeader */
|
||||
export interface BridgedHeader extends Header {}
|
||||
|
||||
/** @name CallOrigin */
|
||||
export interface CallOrigin extends Enum {
|
||||
readonly isSourceRoot: boolean;
|
||||
readonly isTargetAccount: boolean;
|
||||
readonly asTargetAccount: ITuple<[AccountId, MultiSigner, MultiSignature]>;
|
||||
readonly isSourceAccount: boolean;
|
||||
readonly asSourceAccount: AccountId;
|
||||
}
|
||||
|
||||
/** @name ChainId */
|
||||
export interface ChainId extends U8aFixed {}
|
||||
|
||||
/** @name DeliveredMessages */
|
||||
export interface DeliveredMessages extends Struct {
|
||||
readonly begin: MessageNonce;
|
||||
readonly end: MessageNonce;
|
||||
readonly dispatchResults: BitVec;
|
||||
}
|
||||
|
||||
/** @name DispatchFeePayment */
|
||||
export interface DispatchFeePayment extends Enum {
|
||||
readonly isAtSourceChain: boolean;
|
||||
readonly isAtTargetChain: boolean;
|
||||
}
|
||||
|
||||
/** @name InboundLaneData */
|
||||
export interface InboundLaneData extends Struct {
|
||||
readonly relayers: Vec<UnrewardedRelayer>;
|
||||
readonly lastConfirmedNonce: MessageNonce;
|
||||
}
|
||||
|
||||
/** @name InboundRelayer */
|
||||
export interface InboundRelayer extends AccountId {}
|
||||
|
||||
/** @name InitializationData */
|
||||
export interface InitializationData extends Struct {
|
||||
readonly header: Header;
|
||||
@@ -22,4 +59,83 @@ export interface InitializationData extends Struct {
|
||||
readonly isHalted: bool;
|
||||
}
|
||||
|
||||
/** @name LaneId */
|
||||
export interface LaneId extends U8aFixed {}
|
||||
|
||||
/** @name MessageData */
|
||||
export interface MessageData extends Struct {
|
||||
readonly payload: Bytes;
|
||||
readonly fee: Balance;
|
||||
}
|
||||
|
||||
/** @name MessageKey */
|
||||
export interface MessageKey extends Struct {
|
||||
readonly laneId: LaneId;
|
||||
readonly nonce: MessageNonce;
|
||||
}
|
||||
|
||||
/** @name MessageNonce */
|
||||
export interface MessageNonce extends u64 {}
|
||||
|
||||
/** @name MessagesDeliveryProofOf */
|
||||
export interface MessagesDeliveryProofOf extends Struct {
|
||||
readonly bridgedHeaderHash: BlockHash;
|
||||
readonly storageProof: Vec<Bytes>;
|
||||
readonly lane: LaneId;
|
||||
}
|
||||
|
||||
/** @name MessagesProofOf */
|
||||
export interface MessagesProofOf extends Struct {
|
||||
readonly bridgedHeaderHash: BridgedBlockHash;
|
||||
readonly storageProof: Vec<Bytes>;
|
||||
readonly lane: LaneId;
|
||||
readonly noncesStart: MessageNonce;
|
||||
readonly noncesEnd: MessageNonce;
|
||||
}
|
||||
|
||||
/** @name OperatingMode */
|
||||
export interface OperatingMode extends Enum {
|
||||
readonly isNormal: boolean;
|
||||
readonly isRejectingOutboundMessages: boolean;
|
||||
readonly isHalted: boolean;
|
||||
}
|
||||
|
||||
/** @name OutboundLaneData */
|
||||
export interface OutboundLaneData extends Struct {
|
||||
readonly latestGeneratedNonce: MessageNonce;
|
||||
readonly latestReceivedNonce: MessageNonce;
|
||||
readonly oldestUnprunedNonce: MessageNonce;
|
||||
}
|
||||
|
||||
/** @name OutboundMessageFee */
|
||||
export interface OutboundMessageFee extends Balance {}
|
||||
|
||||
/** @name OutboundPayload */
|
||||
export interface OutboundPayload extends Struct {
|
||||
readonly specVersion: u32;
|
||||
readonly weight: Weight;
|
||||
readonly origin: CallOrigin;
|
||||
readonly dispatchFeePayment: DispatchFeePayment;
|
||||
readonly call: Bytes;
|
||||
}
|
||||
|
||||
/** @name Parameter */
|
||||
export interface Parameter extends Null {}
|
||||
|
||||
/** @name RelayerId */
|
||||
export interface RelayerId extends AccountId {}
|
||||
|
||||
/** @name UnrewardedRelayer */
|
||||
export interface UnrewardedRelayer extends Struct {
|
||||
readonly relayer: RelayerId;
|
||||
readonly messages: DeliveredMessages;
|
||||
}
|
||||
|
||||
/** @name UnrewardedRelayersState */
|
||||
export interface UnrewardedRelayersState extends Struct {
|
||||
readonly unrewardedRelayer_Entries: MessageNonce;
|
||||
readonly messagesInOldestEntry: MessageNonce;
|
||||
readonly totalMessages: MessageNonce;
|
||||
}
|
||||
|
||||
export type PHANTOM_BRIDGES = 'bridges';
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ export default {
|
||||
ExtrinsicPayloadUnknown: 'GenericExtrinsicPayloadUnknown',
|
||||
|
||||
// eras
|
||||
Era: 'ExtrinsicEra',
|
||||
ImmortalEra: 'GenericImmortalEra',
|
||||
MortalEra: 'GenericMortalEra',
|
||||
|
||||
|
||||
@@ -13,6 +13,9 @@ export interface EcdsaSignature extends U8aFixed {}
|
||||
/** @name Ed25519Signature */
|
||||
export interface Ed25519Signature extends H512 {}
|
||||
|
||||
/** @name Era */
|
||||
export interface Era extends ExtrinsicEra {}
|
||||
|
||||
/** @name Extrinsic */
|
||||
export interface Extrinsic extends GenericExtrinsic {}
|
||||
|
||||
|
||||
@@ -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
|
||||
};
|
||||
@@ -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 { SiField, SiLookupTypeId, SiType } from '@polkadot/types/interfaces/scaleInfo';
|
||||
|
||||
/** @name ErrorMetadataLatest */
|
||||
export interface ErrorMetadataLatest extends ErrorMetadataV13 {}
|
||||
@@ -54,10 +19,19 @@ export interface ErrorMetadataV12 extends ErrorMetadataV11 {}
|
||||
/** @name ErrorMetadataV13 */
|
||||
export interface ErrorMetadataV13 extends ErrorMetadataV12 {}
|
||||
|
||||
/** @name ErrorMetadataV14 */
|
||||
export interface ErrorMetadataV14 extends Struct {
|
||||
readonly name: Text;
|
||||
readonly fields: Vec<SiField>;
|
||||
readonly index: u8;
|
||||
readonly docs: Vec<Text>;
|
||||
readonly args: Vec<Type>;
|
||||
}
|
||||
|
||||
/** @name ErrorMetadataV9 */
|
||||
export interface ErrorMetadataV9 extends Struct {
|
||||
readonly name: Text;
|
||||
readonly documentation: Vec<Text>;
|
||||
readonly docs: Vec<Text>;
|
||||
}
|
||||
|
||||
/** @name EventMetadataLatest */
|
||||
@@ -75,11 +49,20 @@ export interface EventMetadataV12 extends EventMetadataV11 {}
|
||||
/** @name EventMetadataV13 */
|
||||
export interface EventMetadataV13 extends EventMetadataV12 {}
|
||||
|
||||
/** @name EventMetadataV14 */
|
||||
export interface EventMetadataV14 extends Struct {
|
||||
readonly name: Text;
|
||||
readonly fields: Vec<SiField>;
|
||||
readonly index: u8;
|
||||
readonly docs: Vec<Text>;
|
||||
readonly args: Vec<Type>;
|
||||
}
|
||||
|
||||
/** @name EventMetadataV9 */
|
||||
export interface EventMetadataV9 extends Struct {
|
||||
readonly name: Text;
|
||||
readonly args: Vec<Type>;
|
||||
readonly documentation: Vec<Text>;
|
||||
readonly docs: Vec<Text>;
|
||||
}
|
||||
|
||||
/** @name ExtrinsicMetadataLatest */
|
||||
@@ -97,6 +80,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 {}
|
||||
|
||||
@@ -112,6 +102,9 @@ export interface FunctionArgumentMetadataV12 extends FunctionArgumentMetadataV11
|
||||
/** @name FunctionArgumentMetadataV13 */
|
||||
export interface FunctionArgumentMetadataV13 extends FunctionArgumentMetadataV12 {}
|
||||
|
||||
/** @name FunctionArgumentMetadataV14 */
|
||||
export interface FunctionArgumentMetadataV14 extends FunctionArgumentMetadataV13 {}
|
||||
|
||||
/** @name FunctionArgumentMetadataV9 */
|
||||
export interface FunctionArgumentMetadataV9 extends Struct {
|
||||
readonly name: Text;
|
||||
@@ -133,44 +126,20 @@ export interface FunctionMetadataV12 extends FunctionMetadataV11 {}
|
||||
/** @name FunctionMetadataV13 */
|
||||
export interface FunctionMetadataV13 extends FunctionMetadataV12 {}
|
||||
|
||||
/** @name FunctionMetadataV14 */
|
||||
export interface FunctionMetadataV14 extends Struct {
|
||||
readonly name: Text;
|
||||
readonly fields: Vec<SiField>;
|
||||
readonly index: u8;
|
||||
readonly docs: Vec<Text>;
|
||||
readonly args: Vec<FunctionArgumentMetadataLatest>;
|
||||
}
|
||||
|
||||
/** @name FunctionMetadataV9 */
|
||||
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 +154,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 +184,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 +216,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 +274,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 +360,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 +369,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 +381,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 +399,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 +417,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 +435,20 @@ export interface StorageEntryTypeV10 extends Enum {
|
||||
readonly isPlain: boolean;
|
||||
readonly asPlain: Type;
|
||||
readonly isMap: boolean;
|
||||
readonly asMap: MapTypeV10;
|
||||
readonly asMap: {
|
||||
readonly hasher: StorageHasherV10;
|
||||
readonly key: Type;
|
||||
readonly value: Type;
|
||||
readonly linked: bool;
|
||||
} & Struct;
|
||||
readonly isDoubleMap: boolean;
|
||||
readonly asDoubleMap: DoubleMapTypeV10;
|
||||
readonly asDoubleMap: {
|
||||
readonly hasher: StorageHasherV10;
|
||||
readonly key1: Type;
|
||||
readonly key2: Type;
|
||||
readonly value: Type;
|
||||
readonly key2Hasher: StorageHasherV10;
|
||||
} & Struct;
|
||||
}
|
||||
|
||||
/** @name StorageEntryTypeV11 */
|
||||
@@ -388,9 +456,20 @@ export interface StorageEntryTypeV11 extends Enum {
|
||||
readonly isPlain: boolean;
|
||||
readonly asPlain: Type;
|
||||
readonly isMap: boolean;
|
||||
readonly asMap: MapTypeV11;
|
||||
readonly asMap: {
|
||||
readonly hasher: StorageHasherV11;
|
||||
readonly key: Type;
|
||||
readonly value: Type;
|
||||
readonly linked: bool;
|
||||
} & Struct;
|
||||
readonly isDoubleMap: boolean;
|
||||
readonly asDoubleMap: DoubleMapTypeV11;
|
||||
readonly asDoubleMap: {
|
||||
readonly hasher: StorageHasherV11;
|
||||
readonly key1: Type;
|
||||
readonly key2: Type;
|
||||
readonly value: Type;
|
||||
readonly key2Hasher: StorageHasherV11;
|
||||
} & Struct;
|
||||
}
|
||||
|
||||
/** @name StorageEntryTypeV12 */
|
||||
@@ -401,11 +480,52 @@ export interface StorageEntryTypeV13 extends Enum {
|
||||
readonly isPlain: boolean;
|
||||
readonly asPlain: Type;
|
||||
readonly isMap: boolean;
|
||||
readonly asMap: MapTypeV13;
|
||||
readonly asMap: {
|
||||
readonly hasher: StorageHasherV13;
|
||||
readonly key: Type;
|
||||
readonly value: Type;
|
||||
readonly linked: bool;
|
||||
} & Struct;
|
||||
readonly isDoubleMap: boolean;
|
||||
readonly asDoubleMap: DoubleMapTypeV13;
|
||||
readonly asDoubleMap: {
|
||||
readonly hasher: StorageHasherV13;
|
||||
readonly key1: Type;
|
||||
readonly key2: Type;
|
||||
readonly value: Type;
|
||||
readonly key2Hasher: StorageHasherV13;
|
||||
} & Struct;
|
||||
readonly isNMap: boolean;
|
||||
readonly asNMap: NMapTypeV13;
|
||||
readonly asNMap: {
|
||||
readonly keyVec: Vec<Type>;
|
||||
readonly hashers: Vec<StorageHasherV13>;
|
||||
readonly value: Type;
|
||||
} & Struct;
|
||||
}
|
||||
|
||||
/** @name StorageEntryTypeV14 */
|
||||
export interface StorageEntryTypeV14 extends Enum {
|
||||
readonly isPlain: boolean;
|
||||
readonly asPlain: SiLookupTypeId;
|
||||
readonly isMap: boolean;
|
||||
readonly asMap: {
|
||||
readonly hasher: StorageHasherV14;
|
||||
readonly key: SiLookupTypeId;
|
||||
readonly value: SiLookupTypeId;
|
||||
} & Struct;
|
||||
readonly isDoubleMap: boolean;
|
||||
readonly asDoubleMap: {
|
||||
readonly hasher: StorageHasherV14;
|
||||
readonly key1: SiLookupTypeId;
|
||||
readonly key2: SiLookupTypeId;
|
||||
readonly value: SiLookupTypeId;
|
||||
readonly key2Hasher: StorageHasherV14;
|
||||
} & Struct;
|
||||
readonly isNMap: boolean;
|
||||
readonly asNMap: {
|
||||
readonly key: SiLookupTypeId;
|
||||
readonly hashers: Vec<StorageHasherV14>;
|
||||
readonly value: SiLookupTypeId;
|
||||
} & Struct;
|
||||
}
|
||||
|
||||
/** @name StorageEntryTypeV9 */
|
||||
@@ -413,9 +533,20 @@ export interface StorageEntryTypeV9 extends Enum {
|
||||
readonly isPlain: boolean;
|
||||
readonly asPlain: Type;
|
||||
readonly isMap: boolean;
|
||||
readonly asMap: MapTypeV9;
|
||||
readonly asMap: {
|
||||
readonly hasher: StorageHasherV9;
|
||||
readonly key: Type;
|
||||
readonly value: Type;
|
||||
readonly linked: bool;
|
||||
} & Struct;
|
||||
readonly isDoubleMap: boolean;
|
||||
readonly asDoubleMap: DoubleMapTypeV9;
|
||||
readonly asDoubleMap: {
|
||||
readonly hasher: StorageHasherV9;
|
||||
readonly key1: Type;
|
||||
readonly key2: Type;
|
||||
readonly value: Type;
|
||||
readonly key2Hasher: StorageHasherV9;
|
||||
} & Struct;
|
||||
}
|
||||
|
||||
/** @name StorageHasher */
|
||||
@@ -448,6 +579,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,111 @@
|
||||
// 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 { SiVariant } from '../scaleInfo/definitions';
|
||||
|
||||
export const v14: DefinitionsTypes = {
|
||||
// registry
|
||||
PortableRegistry: 'GenericPortableRegistry',
|
||||
PortableType: {
|
||||
id: 'SiLookupTypeId',
|
||||
type: 'SiType'
|
||||
},
|
||||
|
||||
// compatibility with earlier layouts, i.e. don't break previous users
|
||||
ErrorMetadataV14: {
|
||||
...SiVariant,
|
||||
args: 'Vec<Type>'
|
||||
},
|
||||
EventMetadataV14: {
|
||||
...SiVariant,
|
||||
args: 'Vec<Type>'
|
||||
},
|
||||
FunctionArgumentMetadataV14: 'FunctionArgumentMetadataV13',
|
||||
FunctionMetadataV14: {
|
||||
...SiVariant,
|
||||
args: 'Vec<FunctionArgumentMetadataLatest>'
|
||||
},
|
||||
|
||||
// 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',
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user