Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
db2e97bf66 | ||
|
|
057f6b6041 | ||
|
|
ca82336087 | ||
|
|
761ceaeaa3 | ||
|
|
0cbca0adb8 | ||
|
|
d24db4fd6a | ||
|
|
4a893b9feb | ||
|
|
71a0a84f26 | ||
|
|
44d241f489 | ||
|
|
a4cb5f558d | ||
|
|
aef4d07c48 | ||
|
|
6a5f1bbbf4 | ||
|
|
e60ef2d677 | ||
|
|
f4622d05db | ||
|
|
47d7900809 | ||
|
|
2c86e9347b | ||
|
|
5827d298ad | ||
|
|
60e0f69920 | ||
|
|
97f1ee17b0 | ||
|
|
85215a308d | ||
|
|
89fa4edcf7 | ||
|
|
ec42fb9bff | ||
|
|
96d696dbf3 | ||
|
|
b7992ecc0b | ||
|
|
0acae6e158 | ||
|
|
6afea5043e | ||
|
|
c9ee8d9942 | ||
|
|
55f4e150c0 | ||
|
|
3e3e9c5f5a | ||
|
|
66215890dd | ||
|
|
bf6c7ee0c3 | ||
|
|
f726edf725 | ||
|
|
d917861a77 | ||
|
|
12a54efde5 | ||
|
|
9ae87bed78 | ||
|
|
7f5a52258c | ||
|
|
2c212e6b4d | ||
|
|
3d75744a20 | ||
|
|
d2ff259989 | ||
|
|
cac2ef30a1 | ||
|
|
ea38dedcc1 | ||
|
|
0bd632e612 |
+2
-1
@@ -40,4 +40,5 @@
|
||||
6.0.5
|
||||
6.1.2
|
||||
|
||||
6.4.2
|
||||
6.4.2
|
||||
6.5.2
|
||||
+32
-2
@@ -1,10 +1,40 @@
|
||||
# CHANGELOG
|
||||
|
||||
## 6.6.1 Nov 1, 2021
|
||||
|
||||
Upgrade priority: Low. Internal maintennce updates.
|
||||
|
||||
Changes:
|
||||
|
||||
- Fix construction for `palletVersion` keys with correct prefix
|
||||
- Add Polkadot `EthereumAddress` as a known `PortableRegistry` override
|
||||
- De-dupe `PortableRegistry` namespace splitting operations
|
||||
- Optimize internal `AbstractArray` & `Struct` u8a decoding
|
||||
- Shortcut `Struct` construction from `Struct` instance
|
||||
- Use internal `lookupName` in `createClass` (allows deeply recursive lookups)
|
||||
- Codec `toHex()` will now correctly return the TS `HexString` type
|
||||
- Update known upgrade blocks for Westend & Kusama
|
||||
- Bump static metadata for latest Substrate, Polkadot & Kusama
|
||||
|
||||
|
||||
## 6.5.2 Oct 26, 2021
|
||||
|
||||
Upgrade priority: Low. Recommended for users with `.at` queries on unknown blocks.
|
||||
|
||||
Changes:
|
||||
|
||||
- Adjust `toHuman` on `Call` to return names & (not only) values
|
||||
- Allow for optional known `RuntimeVersion` to short-circuit `api.at`
|
||||
- Ensure `Struct` decodes fully on `null` input (equivalent to `undefined` & `{}`)
|
||||
|
||||
|
||||
## 6.5.1 Oct 24, 2021
|
||||
|
||||
Upgrade priority: Low. Internal maintenance upgrades.
|
||||
|
||||
Contributed:
|
||||
|
||||
- Add `Auction` to Polkadot pre-0.9.11 `ProxyType` (Thnaks to https://github.com/wirednkod)
|
||||
- Add `Auction` to Polkadot pre-0.9.11 `ProxyType` (Thanks to https://github.com/wirednkod)
|
||||
|
||||
Changes:
|
||||
|
||||
@@ -13,7 +43,7 @@ Changes:
|
||||
- `TypeDef` structures now contain the `typeName` from metadata v14 on fields
|
||||
- Fix browser bundle imports for xcm-mapping (move to `types-known`)
|
||||
- Expose all extracted type names in `PortableRegistry`
|
||||
- Adjust `toJSON` (Asicc) output detection on `Raw`
|
||||
- Adjust `toJSON` (Ascii) output detection on `Raw`
|
||||
- Adjust `api.rpc.*.*.raw(..args)` return to the actual over-the-wire JSON result
|
||||
- Remove `api.rpc.*.*.json(..args)` since it now overlaps with new `.raw`
|
||||
- Bump static metadata for latest Substrate, Polkadot & Kusama
|
||||
|
||||
+16
-10
@@ -1,25 +1,30 @@
|
||||
{
|
||||
"repository": "https://github.com/polkadot-js/api",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"homepage": "https://github.com/polkadot-js/api#readme",
|
||||
"license": "Apache-2",
|
||||
"packageManager": "yarn@3.0.1",
|
||||
"private": true,
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/polkadot-js/api.git"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"type": "commonjs",
|
||||
"version": "6.6.1",
|
||||
"workspaces": [
|
||||
"packages/*"
|
||||
],
|
||||
"resolutions": {
|
||||
"typescript": "^4.4.4"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "yarn build:interfaces && polkadot-dev-build-ts",
|
||||
"build:extra": "(cd packages/typegen && copyfiles scripts/* build)",
|
||||
"build:interfaces": "polkadot-types-internal-interfaces",
|
||||
"build:release": "polkadot-ci-ghact-build",
|
||||
"build:rollup": "polkadot-exec-rollup --config",
|
||||
"docs:metadata": "polkadot-types-internal-metadata",
|
||||
"chain:info": "polkadot-types-chain-info",
|
||||
"lint": "polkadot-dev-run-lint",
|
||||
"clean": "polkadot-dev-clean-build",
|
||||
"docs:metadata": "polkadot-types-internal-metadata",
|
||||
"lint": "polkadot-dev-run-lint",
|
||||
"postinstall": "polkadot-dev-yarn-only",
|
||||
"test": "polkadot-dev-run-test --coverage --forceExit --runInBand --testPathIgnorePatterns e2e",
|
||||
"test:one": "polkadot-dev-run-test --detectOpenHandles --forceExit",
|
||||
@@ -29,12 +34,13 @@
|
||||
"@babel/core": "^7.15.8",
|
||||
"@babel/register": "^7.15.3",
|
||||
"@babel/runtime": "^7.15.4",
|
||||
"@polkadot/dev": "^0.63.6",
|
||||
"@polkadot/ts": "^0.4.10",
|
||||
"@polkadot/dev": "^0.63.18",
|
||||
"@polkadot/ts": "^0.4.12",
|
||||
"@polkadot/typegen": "workspace:packages/typegen",
|
||||
"@types/jest": "^27.0.2",
|
||||
"copyfiles": "^2.4.1"
|
||||
},
|
||||
"version": "6.5.1",
|
||||
"packageManager": "yarn@3.0.1"
|
||||
"resolutions": {
|
||||
"typescript": "^4.4.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,28 +1,32 @@
|
||||
{
|
||||
"name": "@polkadot/api-contract",
|
||||
"version": "6.5.1",
|
||||
"type": "module",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"contributors": [],
|
||||
"description": "Interfaces for interacting with contracts and contract ABIs",
|
||||
"main": "index.js",
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
|
||||
"license": "Apache-2.0",
|
||||
"maintainers": [],
|
||||
"name": "@polkadot/api-contract",
|
||||
"repository": {
|
||||
"directory": "packages/api-contract",
|
||||
"type": "git",
|
||||
"url": "https://github.com/polkadot-js/api.git"
|
||||
},
|
||||
"sideEffects": [
|
||||
"./detectPackage.js",
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
},
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [],
|
||||
"contributors": [],
|
||||
"license": "Apache-2.0",
|
||||
"repository": "github:polkadot-js/api",
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
|
||||
"type": "module",
|
||||
"version": "6.6.1",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.15.4",
|
||||
"@polkadot/api": "6.5.1",
|
||||
"@polkadot/types": "6.5.1",
|
||||
"@polkadot/util": "^7.6.1",
|
||||
"@polkadot/api": "6.6.1",
|
||||
"@polkadot/types": "6.6.1",
|
||||
"@polkadot/util": "^7.7.1",
|
||||
"rxjs": "^7.4.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/api-contract', version: '6.5.1' };
|
||||
export const packageInfo = { name: '@polkadot/api-contract', version: '6.6.1' };
|
||||
|
||||
@@ -1,34 +1,38 @@
|
||||
{
|
||||
"name": "@polkadot/api-derive",
|
||||
"version": "6.5.1",
|
||||
"type": "module",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"contributors": [],
|
||||
"description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
|
||||
"main": "index.js",
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
|
||||
"license": "Apache-2.0",
|
||||
"maintainers": [],
|
||||
"name": "@polkadot/api-derive",
|
||||
"repository": {
|
||||
"directory": "packages/api-derive",
|
||||
"type": "git",
|
||||
"url": "https://github.com/polkadot-js/api.git"
|
||||
},
|
||||
"sideEffects": [
|
||||
"./detectPackage.js",
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
},
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [],
|
||||
"contributors": [],
|
||||
"license": "Apache-2.0",
|
||||
"repository": "github:polkadot-js/api",
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
|
||||
"type": "module",
|
||||
"version": "6.6.1",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.15.4",
|
||||
"@polkadot/api": "6.5.1",
|
||||
"@polkadot/rpc-core": "6.5.1",
|
||||
"@polkadot/types": "6.5.1",
|
||||
"@polkadot/util": "^7.6.1",
|
||||
"@polkadot/util-crypto": "^7.6.1",
|
||||
"@polkadot/api": "6.6.1",
|
||||
"@polkadot/rpc-core": "6.6.1",
|
||||
"@polkadot/types": "6.6.1",
|
||||
"@polkadot/util": "^7.7.1",
|
||||
"@polkadot/util-crypto": "^7.7.1",
|
||||
"rxjs": "^7.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^7.6.1",
|
||||
"@polkadot/rpc-provider": "6.5.1"
|
||||
"@polkadot/keyring": "^7.7.1",
|
||||
"@polkadot/rpc-provider": "6.6.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/api-derive', version: '6.5.1' };
|
||||
export const packageInfo = { name: '@polkadot/api-derive', version: '6.6.1' };
|
||||
|
||||
+26
-22
@@ -1,33 +1,37 @@
|
||||
{
|
||||
"name": "@polkadot/api",
|
||||
"version": "6.5.1",
|
||||
"type": "module",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"contributors": [],
|
||||
"description": "Promise and RxJS wrappers around the Polkadot JS RPC",
|
||||
"main": "index.js",
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme",
|
||||
"license": "Apache-2.0",
|
||||
"maintainers": [],
|
||||
"name": "@polkadot/api",
|
||||
"repository": {
|
||||
"directory": "packages/api",
|
||||
"type": "git",
|
||||
"url": "https://github.com/polkadot-js/api.git"
|
||||
},
|
||||
"sideEffects": [
|
||||
"./detectPackage.js",
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
},
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [],
|
||||
"contributors": [],
|
||||
"license": "Apache-2.0",
|
||||
"repository": "github:polkadot-js/api",
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme",
|
||||
"type": "module",
|
||||
"version": "6.6.1",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.15.4",
|
||||
"@polkadot/api-derive": "6.5.1",
|
||||
"@polkadot/keyring": "^7.6.1",
|
||||
"@polkadot/rpc-core": "6.5.1",
|
||||
"@polkadot/rpc-provider": "6.5.1",
|
||||
"@polkadot/types": "6.5.1",
|
||||
"@polkadot/types-known": "6.5.1",
|
||||
"@polkadot/util": "^7.6.1",
|
||||
"@polkadot/util-crypto": "^7.6.1",
|
||||
"@polkadot/api-derive": "6.6.1",
|
||||
"@polkadot/keyring": "^7.7.1",
|
||||
"@polkadot/rpc-core": "6.6.1",
|
||||
"@polkadot/rpc-provider": "6.6.1",
|
||||
"@polkadot/types": "6.6.1",
|
||||
"@polkadot/types-known": "6.6.1",
|
||||
"@polkadot/util": "^7.7.1",
|
||||
"@polkadot/util-crypto": "^7.7.1",
|
||||
"eventemitter3": "^4.0.7",
|
||||
"rxjs": "^7.4.0"
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
||||
this._rx.hasSubscriptions = this._rpcCore.provider.hasSubscriptions;
|
||||
}
|
||||
|
||||
public abstract at (blockHash: Uint8Array | string): Promise<ApiDecoration<ApiType>>;
|
||||
public abstract at (blockHash: Uint8Array | string, knownVersion?: RuntimeVersion): Promise<ApiDecoration<ApiType>>;
|
||||
|
||||
/**
|
||||
* @description Return the current used registry
|
||||
@@ -322,7 +322,11 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
||||
protected _filterRpcMethods (exposed: string[]): void {
|
||||
const hasResults = exposed.length !== 0;
|
||||
const allKnown = [...this._rpcCore.mapping.entries()];
|
||||
const allKeys = allKnown.reduce((allKeys: string[], [, { alias, endpoint, method, pubsub, section }]): string[] => {
|
||||
const allKeys: string[] = [];
|
||||
|
||||
for (let i = 0; i < allKnown.length; i++) {
|
||||
const [, { alias, endpoint, method, pubsub, section }] = allKnown[i];
|
||||
|
||||
allKeys.push(`${section}_${method}`);
|
||||
|
||||
if (pubsub) {
|
||||
@@ -337,11 +341,10 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
||||
if (endpoint) {
|
||||
allKeys.push(endpoint);
|
||||
}
|
||||
}
|
||||
|
||||
return allKeys;
|
||||
}, []);
|
||||
const unknown = exposed.filter((k) => !allKeys.includes(k));
|
||||
const deletion = allKnown.filter(([k]) => hasResults && !exposed.includes(k) && k !== 'rpc_methods');
|
||||
const filterKey = (k: string) => !allKeys.includes(k);
|
||||
const unknown = exposed.filter(filterKey);
|
||||
|
||||
if (unknown.length) {
|
||||
l.warn(`RPC methods not decorated: ${unknown.join(', ')}`);
|
||||
@@ -349,19 +352,26 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
||||
|
||||
// loop through all entries we have (populated in decorate) and filter as required
|
||||
// only remove when we have results and method missing, or with no results if optional
|
||||
deletion.forEach(([, { method, section }]): void => {
|
||||
delete (this._rpc as Record<string, Record<string, unknown>>)[section][method];
|
||||
delete (this._rx.rpc as Record<string, Record<string, unknown>>)[section][method];
|
||||
});
|
||||
for (let i = 0; i < allKnown.length; i++) {
|
||||
const [k, { method, section }] = allKnown[i];
|
||||
|
||||
if (hasResults && !exposed.includes(k) && k !== 'rpc_methods') {
|
||||
delete (this._rpc as Record<string, Record<string, unknown>>)[section][method];
|
||||
delete (this._rx.rpc as Record<string, Record<string, unknown>>)[section][method];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected _decorateRpc<ApiType extends ApiTypes> (rpc: RpcCore & RpcInterface, decorateMethod: DecorateMethod<ApiType>, input: Partial<DecoratedRpc<ApiType, RpcInterface>> = {}): DecoratedRpc<ApiType, RpcInterface> {
|
||||
return rpc.sections.reduce((out, _sectionName): DecoratedRpc<ApiType, RpcInterface> => {
|
||||
const sectionName = _sectionName as keyof DecoratedRpc<ApiType, RpcInterface>;
|
||||
const out = input as DecoratedRpc<ApiType, RpcInterface>;
|
||||
|
||||
for (let s = 0; s < rpc.sections.length; s++) {
|
||||
const sectionName = rpc.sections[s] as keyof DecoratedRpc<ApiType, RpcInterface>;
|
||||
|
||||
if (!(out as Record<string, unknown>)[sectionName]) {
|
||||
// out and section here are horrors to get right from a typing perspective :(
|
||||
(out as Record<string, unknown>)[sectionName] = Object.entries(rpc[sectionName]).reduce((section, [methodName, method]): DecoratedRpcSection<ApiType, RpcInterface[typeof sectionName]> => {
|
||||
const section = {} as DecoratedRpcSection<ApiType, RpcInterface[typeof sectionName]>;
|
||||
|
||||
for (const [methodName, method] of Object.entries(rpc[sectionName])) {
|
||||
// skip subscriptions where we have a non-subscribe interface
|
||||
if (this.hasSubscriptions || !(methodName.startsWith('subscribe') || methodName.startsWith('unsubscribe'))) {
|
||||
(section as Record<string, unknown>)[methodName] = decorateMethod(method, { methodName }) as unknown;
|
||||
@@ -370,13 +380,13 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
(section as Record<string, { meta: unknown }>)[methodName].meta = method.meta;
|
||||
}
|
||||
}
|
||||
|
||||
return section;
|
||||
}, {} as DecoratedRpcSection<ApiType, RpcInterface[typeof sectionName]>);
|
||||
(out as Record<string, unknown>)[sectionName] = section;
|
||||
}
|
||||
}
|
||||
|
||||
return out;
|
||||
}, input as DecoratedRpc<ApiType, RpcInterface>);
|
||||
return out;
|
||||
}
|
||||
|
||||
// only be called if supportMulti is true
|
||||
@@ -417,17 +427,19 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
||||
}
|
||||
|
||||
protected _decorateExtrinsics<ApiType extends ApiTypes> ({ tx }: DecoratedMeta, decorateMethod: DecorateMethod<ApiType>): SubmittableExtrinsics<ApiType> {
|
||||
const creator = createSubmittable(this._type, this._rx, decorateMethod);
|
||||
const creator = createSubmittable(this._type, this._rx, decorateMethod) as SubmittableExtrinsics<ApiType>;
|
||||
|
||||
return Object.entries(tx).reduce((out, [name, section]): SubmittableExtrinsics<ApiType> => {
|
||||
out[name] = Object.entries(section).reduce((out, [name, method]): SubmittableModuleExtrinsics<ApiType> => {
|
||||
out[name] = this._decorateExtrinsicEntry(method, creator);
|
||||
for (const [name, section] of Object.entries(tx)) {
|
||||
const methods: SubmittableModuleExtrinsics<ApiType> = {};
|
||||
|
||||
return out;
|
||||
}, {} as SubmittableModuleExtrinsics<ApiType>);
|
||||
for (const [name, method] of Object.entries(section)) {
|
||||
methods[name] = this._decorateExtrinsicEntry(method, creator);
|
||||
}
|
||||
|
||||
return out;
|
||||
}, creator as SubmittableExtrinsics<ApiType>);
|
||||
creator[name] = methods;
|
||||
}
|
||||
|
||||
return creator;
|
||||
}
|
||||
|
||||
private _decorateExtrinsicEntry<ApiType extends ApiTypes> (method: CallFunction, creator: (value: Call | Uint8Array | string) => SubmittableExtrinsic<ApiType>): SubmittableExtrinsicFunction<ApiType> {
|
||||
@@ -443,27 +455,35 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
||||
}
|
||||
|
||||
protected _decorateStorage<ApiType extends ApiTypes> ({ query }: DecoratedMeta, decorateMethod: DecorateMethod<ApiType>): QueryableStorage<ApiType> {
|
||||
return Object.entries(query).reduce((out, [name, section]): QueryableStorage<ApiType> => {
|
||||
out[name] = Object.entries(section).reduce((out, [name, method]): QueryableModuleStorage<ApiType> => {
|
||||
out[name] = this._decorateStorageEntry(method, decorateMethod);
|
||||
const result = {} as QueryableStorage<ApiType>;
|
||||
|
||||
return out;
|
||||
}, {} as QueryableModuleStorage<ApiType>);
|
||||
for (const [name, section] of Object.entries(query)) {
|
||||
const methods: QueryableModuleStorage<ApiType> = {};
|
||||
|
||||
return out;
|
||||
}, {} as QueryableStorage<ApiType>);
|
||||
for (const [name, method] of Object.entries(section)) {
|
||||
methods[name] = this._decorateStorageEntry(method, decorateMethod);
|
||||
}
|
||||
|
||||
result[name] = methods;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
protected _decorateStorageAt<ApiType extends ApiTypes> ({ query, registry }: DecoratedMeta, decorateMethod: DecorateMethod<ApiType>, blockHash: Uint8Array): QueryableStorageAt<ApiType> {
|
||||
return Object.entries(query).reduce((out, [name, section]): QueryableStorageAt<ApiType> => {
|
||||
out[name] = Object.entries(section).reduce((out, [name, method]): QueryableModuleStorageAt<ApiType> => {
|
||||
out[name] = this._decorateStorageEntryAt(registry, method, decorateMethod, blockHash);
|
||||
const result = {} as QueryableStorageAt<ApiType>;
|
||||
|
||||
return out;
|
||||
}, {} as QueryableModuleStorageAt<ApiType>);
|
||||
for (const [name, section] of Object.entries(query)) {
|
||||
const methods: QueryableModuleStorageAt<ApiType> = {};
|
||||
|
||||
return out;
|
||||
}, {} as QueryableStorageAt<ApiType>);
|
||||
for (const [name, method] of Object.entries(section)) {
|
||||
methods[name] = this._decorateStorageEntryAt(registry, method, decorateMethod, blockHash);
|
||||
}
|
||||
|
||||
result[name] = methods;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private _decorateStorageEntry<ApiType extends ApiTypes> (creator: StorageEntry, decorateMethod: DecorateMethod<ApiType>): QueryableStorageEntry<ApiType> {
|
||||
@@ -652,10 +672,11 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
||||
const queryCall = at
|
||||
? (startKey: string) => this._rpcCore.state.getKeysPaged(headKey, PAGE_SIZE_K, startKey, at)
|
||||
: (startKey: string) => this._rpcCore.state.getKeysPaged(headKey, PAGE_SIZE_K, startKey);
|
||||
const setMeta = (key: StorageKey) => key.setMeta(meta, section, method);
|
||||
|
||||
return startSubject.pipe(
|
||||
switchMap(queryCall),
|
||||
map((keys) => keys.map((key) => key.setMeta(meta, section, method))),
|
||||
map((keys) => keys.map(setMeta)),
|
||||
tap((keys): void => {
|
||||
setTimeout((): void => {
|
||||
keys.length === PAGE_SIZE_K
|
||||
@@ -672,9 +693,10 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
||||
assert(iterKey && meta.type.isMap, 'keys can only be retrieved on maps');
|
||||
|
||||
const headKey = iterKey(...opts.args).toHex();
|
||||
const setMeta = (key: StorageKey) => key.setMeta(meta, section, method);
|
||||
|
||||
return this._rpcCore.state.getKeysPaged(headKey, opts.pageSize, opts.startKey || headKey).pipe(
|
||||
map((keys) => keys.map((key) => key.setMeta(meta, section, method)))
|
||||
map((keys) => keys.map(setMeta))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import type { Observable, Subscription } from 'rxjs';
|
||||
import type { Text } from '@polkadot/types';
|
||||
import type { ChainProperties, Hash, RuntimeVersion } from '@polkadot/types/interfaces';
|
||||
import type { ChainProperties, Hash, RuntimeVersion, RuntimeVersionPartial } from '@polkadot/types/interfaces';
|
||||
import type { Registry } from '@polkadot/types/types';
|
||||
import type { BN } from '@polkadot/util';
|
||||
import type { ApiBase, ApiDecoration, ApiOptions, ApiTypes, DecorateMethod } from '../types';
|
||||
@@ -23,6 +23,10 @@ const KEEPALIVE_INTERVAL = 10000;
|
||||
|
||||
const l = logger('api/init');
|
||||
|
||||
function textToString (t: Text): string {
|
||||
return t.toString();
|
||||
}
|
||||
|
||||
export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
|
||||
#healthTimer: NodeJS.Timeout | null = null;
|
||||
|
||||
@@ -111,15 +115,34 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
|
||||
/**
|
||||
* @description Returns a decorated API instance at a specific point in time
|
||||
*/
|
||||
public async at (blockHash: Uint8Array | string): Promise<ApiDecoration<ApiType>> {
|
||||
public async at (blockHash: Uint8Array | string, knownVersion?: RuntimeVersion): Promise<ApiDecoration<ApiType>> {
|
||||
const u8aHash = u8aToU8a(blockHash);
|
||||
const registry = await this.getBlockRegistry(u8aHash);
|
||||
const registry = await this.getBlockRegistry(u8aHash, knownVersion);
|
||||
|
||||
// always create a new decoration - since we are pointing to a specific hash, this
|
||||
// means that all queries needs to use that hash (not a previous one already existing)
|
||||
return this._createDecorated(registry, true, u8aHash).decoratedApi;
|
||||
}
|
||||
|
||||
private _getBlockRegistryViaVersion (blockHash: Uint8Array, version?: RuntimeVersionPartial): VersionedRegistry<ApiType> | null {
|
||||
if (version) {
|
||||
// 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;
|
||||
|
||||
return existingViaVersion;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private async _getBlockRegistry (blockHash: Uint8Array): Promise<VersionedRegistry<ApiType>> {
|
||||
// ensure we have everything required
|
||||
assert(this._genesisHash && this._runtimeVersion, 'Cannot retrieve data on an uninitialized chain');
|
||||
@@ -142,16 +165,9 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
|
||||
: await firstValueFrom(this._rpcCore.state.getRuntimeVersion.raw(header.parentHash))
|
||||
);
|
||||
|
||||
// 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)
|
||||
);
|
||||
const existingViaVersion = this._getBlockRegistryViaVersion(blockHash, version);
|
||||
|
||||
if (existingViaVersion) {
|
||||
existingViaVersion.lastBlockHash = blockHash;
|
||||
|
||||
return existingViaVersion;
|
||||
}
|
||||
|
||||
@@ -174,7 +190,7 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
|
||||
/**
|
||||
* @description Sets up a registry based on the block hash defined
|
||||
*/
|
||||
public async getBlockRegistry (blockHash: Uint8Array): Promise<VersionedRegistry<ApiType>> {
|
||||
public async getBlockRegistry (blockHash: Uint8Array, knownVersion?: RuntimeVersion): Promise<VersionedRegistry<ApiType>> {
|
||||
const existingViaHash = this.#registries.find(({ lastBlockHash }) =>
|
||||
lastBlockHash && u8aEq(lastBlockHash, blockHash)
|
||||
);
|
||||
@@ -183,6 +199,12 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
|
||||
return existingViaHash;
|
||||
}
|
||||
|
||||
const existingViaVersion = this._getBlockRegistryViaVersion(blockHash, knownVersion);
|
||||
|
||||
if (existingViaVersion) {
|
||||
return existingViaVersion;
|
||||
}
|
||||
|
||||
const blockHashHex = u8aToHex(blockHash);
|
||||
let waiting = this.#waitingRegistries[blockHashHex];
|
||||
|
||||
@@ -224,17 +246,21 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
|
||||
this._runtimeChain = source.runtimeChain;
|
||||
this._runtimeVersion = source.runtimeVersion;
|
||||
|
||||
const methods: string[] = [];
|
||||
|
||||
// manually build a list of all available methods in this RPC, we are
|
||||
// going to filter on it to align the cloned RPC without making a call
|
||||
Object.keys(source.rpc).forEach((section): void => {
|
||||
Object.keys((source.rpc as Record<string, Record<string, unknown>>)[section]).forEach((method): void => {
|
||||
methods.push(`${section}_${method}`);
|
||||
});
|
||||
});
|
||||
const sections = Object.keys(source.rpc);
|
||||
const rpcs: string[] = [];
|
||||
|
||||
this._filterRpc(methods, getSpecRpc(this.registry, source.runtimeChain, source.runtimeVersion.specName));
|
||||
for (let s = 0; s < sections.length; s++) {
|
||||
const section = sections[s];
|
||||
const methods = Object.keys((source.rpc as Record<string, Record<string, unknown>>)[section]);
|
||||
|
||||
for (let m = 0; m < methods.length; m++) {
|
||||
rpcs.push(`${section}_${methods[m]}`);
|
||||
}
|
||||
}
|
||||
|
||||
this._filterRpc(rpcs, getSpecRpc(this.registry, source.runtimeChain, source.runtimeVersion.specName));
|
||||
|
||||
return [source.genesisHash, source.runtimeMetadata];
|
||||
}
|
||||
@@ -317,7 +343,7 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
|
||||
|
||||
// initializes the registry & RPC
|
||||
this._initRegistry(this.registry, chain, runtimeVersion, metadata, chainProps);
|
||||
this._filterRpc(rpcMethods.methods.map((t) => t.toString()), getSpecRpc(this.registry, chain, runtimeVersion.specName));
|
||||
this._filterRpc(rpcMethods.methods.map(textToString), getSpecRpc(this.registry, chain, runtimeVersion.specName));
|
||||
this._subscribeUpdates();
|
||||
|
||||
// setup the initial registry, when we have none
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/api', version: '6.5.1' };
|
||||
export const packageInfo = { name: '@polkadot/api', version: '6.6.1' };
|
||||
|
||||
@@ -26,16 +26,17 @@ function warn (prefix: string, type: 'calls' | 'modules', [added, removed]: Stri
|
||||
}
|
||||
}
|
||||
|
||||
function extractKeys (src: Record<string, Record<string, any>>, dst: Record<string, Record<string, any>>): StringsStrings {
|
||||
return [Object.keys(src), Object.keys(dst)];
|
||||
function findSectionExcludes (a: string[], b: string[]): string[] {
|
||||
return a.filter((s) => !b.includes(s));
|
||||
}
|
||||
|
||||
function findSectionExcludes (a: string[], b: string[]): string[] {
|
||||
return a.filter((section) => !b.includes(section));
|
||||
function findSectionIncludes (a: string[], b: string[]): string[] {
|
||||
return a.filter((s) => b.includes(s));
|
||||
}
|
||||
|
||||
function extractSections (src: Record<string, Record<string, any>>, dst: Record<string, Record<string, any>>): StringsStrings {
|
||||
const [srcSections, dstSections] = extractKeys(src, dst);
|
||||
const srcSections = Object.keys(src);
|
||||
const dstSections = Object.keys(dst);
|
||||
|
||||
return [
|
||||
findSectionExcludes(srcSections, dstSections),
|
||||
@@ -45,20 +46,22 @@ function extractSections (src: Record<string, Record<string, any>>, dst: Record<
|
||||
|
||||
function findMethodExcludes (src: Record<string, Record<string, any>>, dst: Record<string, Record<string, any>>): string[] {
|
||||
const srcSections = Object.keys(src);
|
||||
const dstSections = Object.keys(dst);
|
||||
const dstSections = findSectionIncludes(Object.keys(dst), srcSections);
|
||||
const excludes: string[] = [];
|
||||
|
||||
return dstSections
|
||||
.filter((section) => srcSections.includes(section))
|
||||
.reduce((rmMethods: string[], section): string[] => {
|
||||
const srcMethods = Object.keys(src[section]);
|
||||
for (let s = 0; s < dstSections.length; s++) {
|
||||
const section = dstSections[s];
|
||||
const srcMethods = Object.keys(src[section]);
|
||||
const dstMethods = Object.keys(dst[section]);
|
||||
|
||||
return rmMethods.concat(
|
||||
...Object
|
||||
.keys(dst[section])
|
||||
.filter((method) => !srcMethods.includes(method))
|
||||
.map((method) => `${section}.${method}`)
|
||||
);
|
||||
}, []);
|
||||
excludes.push(
|
||||
...dstMethods
|
||||
.filter((m) => !srcMethods.includes(m))
|
||||
.map((m) => `${section}.${m}`)
|
||||
);
|
||||
}
|
||||
|
||||
return excludes;
|
||||
}
|
||||
|
||||
function extractMethods (src: Record<string, Record<string, any>>, dst: Record<string, Record<string, any>>): StringsStrings {
|
||||
@@ -75,9 +78,11 @@ function extractMethods (src: Record<string, Record<string, any>>, dst: Record<s
|
||||
*/
|
||||
export function augmentObject (prefix: string | null, src: Record<string, Record<string, unknown>>, dst: Record<string, Record<string, unknown>>, fromEmpty = false): Record<string, Record<string, any>> {
|
||||
if (fromEmpty) {
|
||||
Object.keys(dst).forEach((key): void => {
|
||||
delete dst[key];
|
||||
});
|
||||
const dstKeys = Object.keys(dst);
|
||||
|
||||
for (let k = 0; k < dstKeys.length; k++) {
|
||||
delete dst[dstKeys[k]];
|
||||
}
|
||||
}
|
||||
|
||||
if (prefix && Object.keys(dst).length) {
|
||||
@@ -85,22 +90,26 @@ export function augmentObject (prefix: string | null, src: Record<string, Record
|
||||
warn(prefix, 'calls', extractMethods(src, dst));
|
||||
}
|
||||
|
||||
return Object
|
||||
.keys(src)
|
||||
.reduce((newSection, sectionName): Record<string, Record<string, unknown>> => {
|
||||
const section = src[sectionName];
|
||||
const srcKeys = Object.keys(src);
|
||||
|
||||
newSection[sectionName] = Object
|
||||
.keys(section)
|
||||
.reduce((result, methodName): Record<string, unknown> => {
|
||||
// TODO When it does match, check the actual details and warn when there are differences
|
||||
if (!result[methodName]) {
|
||||
result[methodName] = section[methodName];
|
||||
}
|
||||
for (let s = 0; s < srcKeys.length; s++) {
|
||||
const section = srcKeys[s];
|
||||
|
||||
return result;
|
||||
}, dst[sectionName] || {});
|
||||
if (!dst[section]) {
|
||||
dst[section] = {};
|
||||
}
|
||||
|
||||
return newSection;
|
||||
}, dst);
|
||||
const methods = Object.keys(src[section]);
|
||||
|
||||
for (let m = 0; m < methods.length; m++) {
|
||||
const method = methods[m];
|
||||
|
||||
// TODO When it does match, check the actual details and warn when there are differences
|
||||
if (!dst[section][method]) {
|
||||
dst[section][method] = src[section][method];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
@@ -6,10 +6,16 @@ import type { ApiTypes, DecorateMethod, MethodResult } from '../types';
|
||||
|
||||
// Most generic typings for `api.derive.*.*`
|
||||
type AnyDerive = Record<string, Record<string, AnyFunction>>;
|
||||
|
||||
// Exact typings for a particular section `api.derive.section.*`
|
||||
type DeriveSection<ApiType extends ApiTypes, Section extends Record<string, AnyFunction>> = { [MethodName in keyof Section]: MethodResult<ApiType, Section[MethodName]> };
|
||||
type DeriveSection<ApiType extends ApiTypes, Section extends Record<string, AnyFunction>> = {
|
||||
[MethodName in keyof Section]: MethodResult<ApiType, Section[MethodName]>
|
||||
};
|
||||
|
||||
// Exact typings for all sections `api.derive.*.*`
|
||||
export type DeriveAllSections<ApiType extends ApiTypes, AllSections extends AnyDerive> = { [SectionName in keyof AllSections]: DeriveSection<ApiType, AllSections[SectionName]> };
|
||||
export type DeriveAllSections<ApiType extends ApiTypes, AllSections extends AnyDerive> = {
|
||||
[SectionName in keyof AllSections]: DeriveSection<ApiType, AllSections[SectionName]>
|
||||
};
|
||||
|
||||
// A technically unsafe version of Object.keys(obj) that assumes that
|
||||
// obj only has known properties of T
|
||||
@@ -21,38 +27,27 @@ function keys<T extends Record<string, unknown>> (obj: T): (keyof T)[] {
|
||||
* This is a methods decorator which keeps all type information.
|
||||
*/
|
||||
function decorateMethods<ApiType extends ApiTypes, Section extends Record<string, AnyFunction>> (section: Section, decorateMethod: DecorateMethod<ApiType>): DeriveSection<ApiType, Section> {
|
||||
return keys(section).reduce(
|
||||
<MethodName extends keyof Section>(
|
||||
acc: DeriveSection<ApiType, Section>,
|
||||
methodName: MethodName
|
||||
): DeriveSection<ApiType, Section> => {
|
||||
const method = section[methodName];
|
||||
const result = {} as DeriveSection<ApiType, Section>;
|
||||
const names = keys(section);
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
acc[methodName] = decorateMethod(method) as MethodResult<ApiType, Section[MethodName]>;
|
||||
for (let k = 0; k < names.length; k++) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
result[names[k]] = decorateMethod(section[names[k]]);
|
||||
}
|
||||
|
||||
return acc;
|
||||
},
|
||||
{} as DeriveSection<ApiType, Section>
|
||||
);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a section decorator which keeps all type information.
|
||||
*/
|
||||
export function decorateSections<ApiType extends ApiTypes, AllSections extends AnyDerive> (
|
||||
allSections: AllSections,
|
||||
decorateMethod: DecorateMethod<ApiType>
|
||||
): DeriveAllSections<ApiType, AllSections> {
|
||||
return keys(allSections).reduce(
|
||||
<MethodName extends keyof AllSections>(
|
||||
acc: DeriveAllSections<ApiType, AllSections>,
|
||||
sectionName: MethodName
|
||||
): DeriveAllSections<ApiType, AllSections> => {
|
||||
acc[sectionName] = decorateMethods(allSections[sectionName], decorateMethod);
|
||||
export function decorateSections<ApiType extends ApiTypes, AllSections extends AnyDerive> (allSections: AllSections, decorateMethod: DecorateMethod<ApiType>): DeriveAllSections<ApiType, AllSections> {
|
||||
const result = {} as DeriveAllSections<ApiType, AllSections>;
|
||||
const names = keys(allSections);
|
||||
|
||||
return acc;
|
||||
},
|
||||
{} as DeriveAllSections<ApiType, AllSections>
|
||||
);
|
||||
for (let k = 0; k < names.length; k++) {
|
||||
result[names[k]] = decorateMethods(allSections[names[k]], decorateMethod);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1,31 +1,35 @@
|
||||
{
|
||||
"name": "@polkadot/rpc-core",
|
||||
"version": "6.5.1",
|
||||
"type": "module",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"contributors": [],
|
||||
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
|
||||
"main": "index.js",
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme",
|
||||
"license": "Apache-2.0",
|
||||
"maintainers": [],
|
||||
"name": "@polkadot/rpc-core",
|
||||
"repository": {
|
||||
"directory": "packages/rpc-core",
|
||||
"type": "git",
|
||||
"url": "https://github.com/polkadot-js/api.git"
|
||||
},
|
||||
"sideEffects": [
|
||||
"./detectPackage.js",
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
},
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [],
|
||||
"contributors": [],
|
||||
"license": "Apache-2.0",
|
||||
"repository": "github:polkadot-js/api",
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme",
|
||||
"type": "module",
|
||||
"version": "6.6.1",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.15.4",
|
||||
"@polkadot/rpc-provider": "6.5.1",
|
||||
"@polkadot/types": "6.5.1",
|
||||
"@polkadot/util": "^7.6.1",
|
||||
"@polkadot/rpc-provider": "6.6.1",
|
||||
"@polkadot/types": "6.6.1",
|
||||
"@polkadot/util": "^7.7.1",
|
||||
"rxjs": "^7.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^7.6.1"
|
||||
"@polkadot/keyring": "^7.7.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/rpc-core', version: '6.5.1' };
|
||||
export const packageInfo = { name: '@polkadot/rpc-core', version: '6.6.1' };
|
||||
|
||||
@@ -1,36 +1,40 @@
|
||||
{
|
||||
"name": "@polkadot/rpc-provider",
|
||||
"version": "6.5.1",
|
||||
"type": "module",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"contributors": [],
|
||||
"description": "Transport providers for the API",
|
||||
"main": "index.js",
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme",
|
||||
"license": "Apache-2.0",
|
||||
"maintainers": [],
|
||||
"name": "@polkadot/rpc-provider",
|
||||
"repository": {
|
||||
"directory": "packages/rpc-provider",
|
||||
"type": "git",
|
||||
"url": "https://github.com/polkadot-js/api.git"
|
||||
},
|
||||
"sideEffects": [
|
||||
"./detectPackage.js",
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
},
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [],
|
||||
"contributors": [],
|
||||
"license": "Apache-2.0",
|
||||
"repository": "github:polkadot-js/api",
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme",
|
||||
"type": "module",
|
||||
"version": "6.6.1",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.15.4",
|
||||
"@polkadot/types": "6.5.1",
|
||||
"@polkadot/util": "^7.6.1",
|
||||
"@polkadot/util-crypto": "^7.6.1",
|
||||
"@polkadot/x-fetch": "^7.6.1",
|
||||
"@polkadot/x-global": "^7.6.1",
|
||||
"@polkadot/x-ws": "^7.6.1",
|
||||
"@polkadot/types": "6.6.1",
|
||||
"@polkadot/util": "^7.7.1",
|
||||
"@polkadot/util-crypto": "^7.7.1",
|
||||
"@polkadot/x-fetch": "^7.7.1",
|
||||
"@polkadot/x-global": "^7.7.1",
|
||||
"@polkadot/x-ws": "^7.7.1",
|
||||
"eventemitter3": "^4.0.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^7.6.1",
|
||||
"@polkadot/types": "6.5.1",
|
||||
"@polkadot/keyring": "^7.7.1",
|
||||
"@polkadot/types": "6.6.1",
|
||||
"mock-socket": "^9.0.6",
|
||||
"nock": "^13.1.4"
|
||||
}
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/rpc-provider', version: '6.5.1' };
|
||||
export const packageInfo = { name: '@polkadot/rpc-provider', version: '6.6.1' };
|
||||
|
||||
@@ -1,16 +1,27 @@
|
||||
{
|
||||
"name": "@polkadot/typegen",
|
||||
"version": "6.5.1",
|
||||
"type": "module",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"contributors": [],
|
||||
"description": "Type generation scripts",
|
||||
"main": "index.js",
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/typegen#readme",
|
||||
"license": "Apache-2.0",
|
||||
"maintainers": [],
|
||||
"name": "@polkadot/typegen",
|
||||
"repository": {
|
||||
"directory": "packages/typegen",
|
||||
"type": "git",
|
||||
"url": "https://github.com/polkadot-js/api.git"
|
||||
},
|
||||
"sideEffects": [
|
||||
"./detectPackage.js",
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
},
|
||||
"type": "module",
|
||||
"version": "6.6.1",
|
||||
"main": "index.js",
|
||||
"bin": {
|
||||
"polkadot-types-chain-info": "./scripts/polkadot-types-chain-info.cjs",
|
||||
"polkadot-types-from-chain": "./scripts/polkadot-types-from-chain.cjs",
|
||||
@@ -18,22 +29,15 @@
|
||||
"polkadot-types-internal-interfaces": "./scripts/polkadot-types-internal-interfaces.cjs",
|
||||
"polkadot-types-internal-metadata": "./scripts/polkadot-types-internal-metadata.cjs"
|
||||
},
|
||||
"repository": "github:polkadot-js/api",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [],
|
||||
"contributors": [],
|
||||
"license": "Apache-2.0",
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/typegen#readme",
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.15.8",
|
||||
"@babel/register": "^7.15.3",
|
||||
"@babel/runtime": "^7.15.4",
|
||||
"@polkadot/api": "6.5.1",
|
||||
"@polkadot/rpc-provider": "6.5.1",
|
||||
"@polkadot/types": "6.5.1",
|
||||
"@polkadot/types-support": "6.5.1",
|
||||
"@polkadot/util": "^7.6.1",
|
||||
"@polkadot/api": "6.6.1",
|
||||
"@polkadot/rpc-provider": "6.6.1",
|
||||
"@polkadot/types": "6.6.1",
|
||||
"@polkadot/types-support": "6.6.1",
|
||||
"@polkadot/util": "^7.7.1",
|
||||
"handlebars": "^4.7.7",
|
||||
"websocket": "^1.0.34",
|
||||
"yargs": "^17.2.1"
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/typegen', version: '6.5.1' };
|
||||
export const packageInfo = { name: '@polkadot/typegen', version: '6.6.1' };
|
||||
|
||||
@@ -1,27 +1,31 @@
|
||||
{
|
||||
"name": "@polkadot/types-known",
|
||||
"version": "6.5.1",
|
||||
"type": "module",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"contributors": [],
|
||||
"description": "Known type definitions",
|
||||
"main": "index.js",
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types-known#readme",
|
||||
"license": "Apache-2.0",
|
||||
"maintainers": [],
|
||||
"name": "@polkadot/types-known",
|
||||
"repository": {
|
||||
"directory": "packages/types-known",
|
||||
"type": "git",
|
||||
"url": "https://github.com/polkadot-js/api.git"
|
||||
},
|
||||
"sideEffects": [
|
||||
"./detectPackage.js",
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
},
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [],
|
||||
"contributors": [],
|
||||
"license": "Apache-2.0",
|
||||
"repository": "github:polkadot-js/api",
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types-known#readme",
|
||||
"type": "module",
|
||||
"version": "6.6.1",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.15.4",
|
||||
"@polkadot/networks": "^7.6.1",
|
||||
"@polkadot/types": "6.5.1",
|
||||
"@polkadot/util": "^7.6.1"
|
||||
"@polkadot/networks": "^7.7.1",
|
||||
"@polkadot/types": "6.6.1",
|
||||
"@polkadot/util": "^7.7.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/types-known', version: '6.5.1' };
|
||||
export const packageInfo = { name: '@polkadot/types-known', version: '6.6.1' };
|
||||
|
||||
@@ -14,7 +14,7 @@ const upgrades: ChainUpgradesRaw = [
|
||||
[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], [8555825, 9080], [8945245, 9090],
|
||||
[9611377, 9100], [9625129, 9111]
|
||||
[9611377, 9100], [9625129, 9111], [9866422, 9122]
|
||||
];
|
||||
|
||||
export default upgrades;
|
||||
|
||||
@@ -11,7 +11,8 @@ const upgrades: ChainUpgradesRaw = [
|
||||
[2549864, 45], [3925782, 46], [3925843, 47], [4207800, 48], [4627944, 49],
|
||||
[5124076, 50], [5478664, 900], [5482450, 9000], [5584305, 9010], [5784566, 9030],
|
||||
[5879822, 9031], [5896856, 9032], [5897316, 9033], [6117927, 9050], [6210274, 9070],
|
||||
[6379314, 9080], [6979141, 9090], [7568453, 9100], [7766392, 9111]
|
||||
[6379314, 9080], [6979141, 9090], [7568453, 9100], [7766394, 9111], [7911691, 9120],
|
||||
[7968866, 9121], [7982889, 9122]
|
||||
];
|
||||
|
||||
export default upgrades;
|
||||
|
||||
@@ -1,25 +1,29 @@
|
||||
{
|
||||
"name": "@polkadot/types-support",
|
||||
"version": "6.5.1",
|
||||
"type": "module",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"contributors": [],
|
||||
"description": "Supporting files for types, mostly for testing",
|
||||
"main": "index.js",
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types-support#readme",
|
||||
"license": "Apache-2.0",
|
||||
"maintainers": [],
|
||||
"name": "@polkadot/types-support",
|
||||
"repository": {
|
||||
"directory": "packages/types-support",
|
||||
"type": "git",
|
||||
"url": "https://github.com/polkadot-js/api.git"
|
||||
},
|
||||
"sideEffects": [
|
||||
"./detectPackage.js",
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
},
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [],
|
||||
"contributors": [],
|
||||
"license": "Apache-2.0",
|
||||
"repository": "github:polkadot-js/api",
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types-support#readme",
|
||||
"type": "module",
|
||||
"version": "6.6.1",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.15.4",
|
||||
"@polkadot/util": "^7.6.1"
|
||||
"@polkadot/util": "^7.7.1"
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -265,7 +265,7 @@
|
||||
{
|
||||
"name": "Version",
|
||||
"type": 159,
|
||||
"value": "0x186b7573616d61347061726974792d6b7573616d6102000000a02300000000000038df6acb689907609b0300000037e397fc7c91f5e40100000040fe3ad401f8959a05000000d2bc9897eed08f1503000000f78b278be53f454c02000000af2c0297a23e6d3d0100000049eaaf1b548a0cb00100000091d5df18b0d2cf5801000000ed99c5acb25eedf503000000cbca25e39f14238702000000687ad44ad37f03c201000000ab3c0572291feb8b01000000bc9d89904f5b923f0100000037c8bb1350a9a2a80100000007000000",
|
||||
"value": "0x186b7573616d61347061726974792d6b7573616d6102000000aa2300000000000038df6acb689907609b0300000037e397fc7c91f5e40100000040fe3ad401f8959a05000000d2bc9897eed08f1503000000f78b278be53f454c02000000af2c0297a23e6d3d0100000049eaaf1b548a0cb00100000091d5df18b0d2cf5801000000ed99c5acb25eedf503000000cbca25e39f14238702000000687ad44ad37f03c201000000ab3c0572291feb8b01000000bc9d89904f5b923f0100000037c8bb1350a9a2a80100000007000000",
|
||||
"docs": [
|
||||
" Get the chain's current version."
|
||||
]
|
||||
|
||||
@@ -8132,7 +8132,7 @@
|
||||
"index": 9,
|
||||
"docs": [
|
||||
"Expected query response has been received but the expected origin location placed in",
|
||||
"storate by this runtime previously cannot be decoded. The query remains registered.",
|
||||
"storage by this runtime previously cannot be decoded. The query remains registered.",
|
||||
"",
|
||||
"This is unexpected (since a location placed in storage in a previously executing",
|
||||
"runtime should be readable prior to query timeout) and dangerous since the possibly",
|
||||
@@ -30135,7 +30135,9 @@
|
||||
"docs": [
|
||||
"Teleport some assets from the local chain to some destination chain.",
|
||||
"",
|
||||
"Fee payment on the destination side is made from the first asset listed in the `assets` vector.",
|
||||
"Fee payment on the destination side is made from the first asset listed in the `assets` vector and",
|
||||
"fee-weight is calculated locally and thus remote weights are assumed to be equal to",
|
||||
"local weights.",
|
||||
"",
|
||||
"- `origin`: Must be capable of withdrawing the `assets` and executing XCM.",
|
||||
"- `dest`: Destination context for the assets. Will typically be `X2(Parent, Parachain(..))` to send",
|
||||
@@ -30181,7 +30183,9 @@
|
||||
"Transfer some assets from the local chain to the sovereign account of a destination chain and forward",
|
||||
"a notification XCM.",
|
||||
"",
|
||||
"Fee payment on the destination side is made from the first asset listed in the `assets` vector.",
|
||||
"Fee payment on the destination side is made from the first asset listed in the `assets` vector and",
|
||||
"fee-weight is calculated locally and thus remote weights are assumed to be equal to",
|
||||
"local weights.",
|
||||
"",
|
||||
"- `origin`: Must be capable of withdrawing the `assets` and executing XCM.",
|
||||
"- `dest`: Destination context for the assets. Will typically be `X2(Parent, Parachain(..))` to send",
|
||||
@@ -30307,6 +30311,111 @@
|
||||
"- `location`: The location to which we are currently subscribed for XCM version",
|
||||
" notifications which we no longer desire."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "limited_reserve_transfer_assets",
|
||||
"fields": [
|
||||
{
|
||||
"name": "dest",
|
||||
"type": 141,
|
||||
"typeName": "Box<VersionedMultiLocation>",
|
||||
"docs": []
|
||||
},
|
||||
{
|
||||
"name": "beneficiary",
|
||||
"type": 141,
|
||||
"typeName": "Box<VersionedMultiLocation>",
|
||||
"docs": []
|
||||
},
|
||||
{
|
||||
"name": "assets",
|
||||
"type": 136,
|
||||
"typeName": "Box<VersionedMultiAssets>",
|
||||
"docs": []
|
||||
},
|
||||
{
|
||||
"name": "fee_asset_item",
|
||||
"type": 4,
|
||||
"typeName": "u32",
|
||||
"docs": []
|
||||
},
|
||||
{
|
||||
"name": "weight_limit",
|
||||
"type": 134,
|
||||
"typeName": "WeightLimit",
|
||||
"docs": []
|
||||
}
|
||||
],
|
||||
"index": 8,
|
||||
"docs": [
|
||||
"Transfer some assets from the local chain to the sovereign account of a destination chain and forward",
|
||||
"a notification XCM.",
|
||||
"",
|
||||
"Fee payment on the destination side is made from the first asset listed in the `assets` vector.",
|
||||
"",
|
||||
"- `origin`: Must be capable of withdrawing the `assets` and executing XCM.",
|
||||
"- `dest`: Destination context for the assets. Will typically be `X2(Parent, Parachain(..))` to send",
|
||||
" from parachain to parachain, or `X1(Parachain(..))` to send from relay to parachain.",
|
||||
"- `beneficiary`: A beneficiary location for the assets in the context of `dest`. Will generally be",
|
||||
" an `AccountId32` value.",
|
||||
"- `assets`: The assets to be withdrawn. This should include the assets used to pay the fee on the",
|
||||
" `dest` side.",
|
||||
"- `fee_asset_item`: The index into `assets` of the item which should be used to pay",
|
||||
" fees.",
|
||||
"- `weight_limit`: The remote-side weight limit, if any, for the XCM fee purchase."
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "limited_teleport_assets",
|
||||
"fields": [
|
||||
{
|
||||
"name": "dest",
|
||||
"type": 141,
|
||||
"typeName": "Box<VersionedMultiLocation>",
|
||||
"docs": []
|
||||
},
|
||||
{
|
||||
"name": "beneficiary",
|
||||
"type": 141,
|
||||
"typeName": "Box<VersionedMultiLocation>",
|
||||
"docs": []
|
||||
},
|
||||
{
|
||||
"name": "assets",
|
||||
"type": 136,
|
||||
"typeName": "Box<VersionedMultiAssets>",
|
||||
"docs": []
|
||||
},
|
||||
{
|
||||
"name": "fee_asset_item",
|
||||
"type": 4,
|
||||
"typeName": "u32",
|
||||
"docs": []
|
||||
},
|
||||
{
|
||||
"name": "weight_limit",
|
||||
"type": 134,
|
||||
"typeName": "WeightLimit",
|
||||
"docs": []
|
||||
}
|
||||
],
|
||||
"index": 9,
|
||||
"docs": [
|
||||
"Teleport some assets from the local chain to some destination chain.",
|
||||
"",
|
||||
"Fee payment on the destination side is made from the first asset listed in the `assets` vector.",
|
||||
"",
|
||||
"- `origin`: Must be capable of withdrawing the `assets` and executing XCM.",
|
||||
"- `dest`: Destination context for the assets. Will typically be `X2(Parent, Parachain(..))` to send",
|
||||
" from parachain to parachain, or `X1(Parachain(..))` to send from relay to parachain.",
|
||||
"- `beneficiary`: A beneficiary location for the assets in the context of `dest`. Will generally be",
|
||||
" an `AccountId32` value.",
|
||||
"- `assets`: The assets to be withdrawn. The first item should be the currency used to to pay the fee on the",
|
||||
" `dest` side. May not be empty.",
|
||||
"- `dest_weight`: Equal to the total weight on `dest` of the XCM message",
|
||||
" `Teleport { assets, effects: [ BuyExecution{..}, DepositAsset{..} ] }`.",
|
||||
"- `weight_limit`: The remote-side weight limit, if any, for the XCM fee purchase."
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -3,4 +3,4 @@
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/types-support', version: '6.5.1' };
|
||||
export const packageInfo = { name: '@polkadot/types-support', version: '6.6.1' };
|
||||
|
||||
+22
-18
@@ -1,32 +1,36 @@
|
||||
{
|
||||
"name": "@polkadot/types",
|
||||
"version": "6.5.1",
|
||||
"type": "module",
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"contributors": [],
|
||||
"description": "Implementation of the Parity codec",
|
||||
"main": "index.js",
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
},
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types#readme",
|
||||
"license": "Apache-2.0",
|
||||
"maintainers": [],
|
||||
"name": "@polkadot/types",
|
||||
"repository": {
|
||||
"directory": "packages/types",
|
||||
"type": "git",
|
||||
"url": "https://github.com/polkadot-js/api.git"
|
||||
},
|
||||
"sideEffects": [
|
||||
"./detectPackage.js",
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
},
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"maintainers": [],
|
||||
"contributors": [],
|
||||
"license": "Apache-2.0",
|
||||
"repository": "github:polkadot-js/api",
|
||||
"bugs": "https://github.com/polkadot-js/api/issues",
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types#readme",
|
||||
"type": "module",
|
||||
"version": "6.6.1",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.15.4",
|
||||
"@polkadot/util": "^7.6.1",
|
||||
"@polkadot/util-crypto": "^7.6.1",
|
||||
"@polkadot/util": "^7.7.1",
|
||||
"@polkadot/util-crypto": "^7.7.1",
|
||||
"rxjs": "^7.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^7.6.1",
|
||||
"@polkadot/types-support": "6.5.1",
|
||||
"@polkadot/keyring": "^7.7.1",
|
||||
"@polkadot/types-support": "6.6.1",
|
||||
"@types/bn.js": "^4.11.6",
|
||||
"bn.js": "^4.12.0"
|
||||
}
|
||||
|
||||
@@ -6,10 +6,6 @@
|
||||
import type { DefinitionsTypes } from '../../types';
|
||||
|
||||
export default {
|
||||
/**
|
||||
* Lookup66: polkadot_runtime_common::claims::EthereumAddress
|
||||
**/
|
||||
PolkadotRuntimeCommonClaimsEthereumAddress: '[u8;20]',
|
||||
/**
|
||||
* Lookup72: polkadot_runtime::ProxyType
|
||||
**/
|
||||
@@ -17,14 +13,14 @@ export default {
|
||||
_enum: ['Any', 'NonTransfer', 'Governance', 'Staking', '__Unused4', 'IdentityJudgement', 'CancelProxy', 'Auction']
|
||||
},
|
||||
/**
|
||||
* Lookup82: polkadot_primitives::v1::CandidateReceipt<primitive_types::H256>
|
||||
* Lookup83: polkadot_primitives::v1::CandidateReceipt<primitive_types::H256>
|
||||
**/
|
||||
PolkadotPrimitivesV1CandidateReceipt: {
|
||||
descriptor: 'PolkadotPrimitivesV1CandidateDescriptor',
|
||||
commitmentsHash: 'H256'
|
||||
},
|
||||
/**
|
||||
* Lookup83: polkadot_primitives::v1::CandidateDescriptor<primitive_types::H256>
|
||||
* Lookup84: polkadot_primitives::v1::CandidateDescriptor<primitive_types::H256>
|
||||
**/
|
||||
PolkadotPrimitivesV1CandidateDescriptor: {
|
||||
paraId: 'u32',
|
||||
@@ -38,15 +34,15 @@ export default {
|
||||
validationCodeHash: 'H256'
|
||||
},
|
||||
/**
|
||||
* Lookup85: polkadot_primitives::v0::collator_app::Public
|
||||
* Lookup86: polkadot_primitives::v0::collator_app::Public
|
||||
**/
|
||||
PolkadotPrimitivesV0CollatorAppPublic: 'SpCoreSr25519Public',
|
||||
/**
|
||||
* Lookup86: polkadot_primitives::v0::collator_app::Signature
|
||||
* Lookup87: polkadot_primitives::v0::collator_app::Signature
|
||||
**/
|
||||
PolkadotPrimitivesV0CollatorAppSignature: 'SpCoreSr25519Signature',
|
||||
/**
|
||||
* Lookup95: xcm::v2::traits::Outcome
|
||||
* Lookup96: xcm::v2::traits::Outcome
|
||||
**/
|
||||
XcmV2TraitsOutcome: {
|
||||
_enum: {
|
||||
@@ -56,7 +52,7 @@ export default {
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Lookup96: xcm::v2::traits::Error
|
||||
* Lookup97: xcm::v2::traits::Error
|
||||
**/
|
||||
XcmV2TraitsError: {
|
||||
_enum: {
|
||||
@@ -89,14 +85,14 @@ export default {
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Lookup98: polkadot_parachain::primitives::HrmpChannelId
|
||||
* Lookup99: polkadot_parachain::primitives::HrmpChannelId
|
||||
**/
|
||||
PolkadotParachainPrimitivesHrmpChannelId: {
|
||||
sender: 'u32',
|
||||
recipient: 'u32'
|
||||
},
|
||||
/**
|
||||
* Lookup161: polkadot_runtime::SessionKeys
|
||||
* Lookup162: polkadot_runtime::SessionKeys
|
||||
**/
|
||||
PolkadotRuntimeSessionKeys: {
|
||||
grandpa: 'SpFinalityGrandpaAppPublic',
|
||||
@@ -107,25 +103,25 @@ export default {
|
||||
authorityDiscovery: 'SpAuthorityDiscoveryAppPublic'
|
||||
},
|
||||
/**
|
||||
* Lookup162: polkadot_primitives::v0::validator_app::Public
|
||||
* Lookup163: polkadot_primitives::v0::validator_app::Public
|
||||
**/
|
||||
PolkadotPrimitivesV0ValidatorAppPublic: 'SpCoreSr25519Public',
|
||||
/**
|
||||
* Lookup163: polkadot_primitives::v1::assignment_app::Public
|
||||
* Lookup164: polkadot_primitives::v1::assignment_app::Public
|
||||
**/
|
||||
PolkadotPrimitivesV1AssignmentAppPublic: 'SpCoreSr25519Public',
|
||||
/**
|
||||
* Lookup195: polkadot_runtime_common::claims::EcdsaSignature
|
||||
* Lookup196: polkadot_runtime_common::claims::EcdsaSignature
|
||||
**/
|
||||
PolkadotRuntimeCommonClaimsEcdsaSignature: '[u8;65]',
|
||||
/**
|
||||
* Lookup200: polkadot_runtime_common::claims::StatementKind
|
||||
* Lookup201: polkadot_runtime_common::claims::StatementKind
|
||||
**/
|
||||
PolkadotRuntimeCommonClaimsStatementKind: {
|
||||
_enum: ['Regular', 'Saft']
|
||||
},
|
||||
/**
|
||||
* Lookup253: polkadot_runtime::NposCompactSolution16
|
||||
* Lookup254: polkadot_runtime::NposCompactSolution16
|
||||
**/
|
||||
PolkadotRuntimeNposCompactSolution16: {
|
||||
votes1: 'Vec<(Compact<u32>,Compact<u16>)>',
|
||||
@@ -146,7 +142,7 @@ export default {
|
||||
votes16: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);15],Compact<u16>)>'
|
||||
},
|
||||
/**
|
||||
* Lookup314: polkadot_primitives::v1::InherentData<sp_runtime::generic::header::Header<Number, sp_runtime::traits::BlakeTwo256>>
|
||||
* Lookup316: polkadot_primitives::v1::InherentData<sp_runtime::generic::header::Header<Number, sp_runtime::traits::BlakeTwo256>>
|
||||
**/
|
||||
PolkadotPrimitivesV1InherentData: {
|
||||
bitfields: 'Vec<PolkadotPrimitivesV1SignedUncheckedSigned>',
|
||||
@@ -155,7 +151,7 @@ export default {
|
||||
parentHeader: 'SpRuntimeGenericHeader'
|
||||
},
|
||||
/**
|
||||
* Lookup316: polkadot_primitives::v1::signed::UncheckedSigned<polkadot_primitives::v1::AvailabilityBitfield, polkadot_primitives::v1::AvailabilityBitfield>
|
||||
* Lookup318: polkadot_primitives::v1::signed::UncheckedSigned<polkadot_primitives::v1::AvailabilityBitfield, polkadot_primitives::v1::AvailabilityBitfield>
|
||||
**/
|
||||
PolkadotPrimitivesV1SignedUncheckedSigned: {
|
||||
payload: 'BitVec',
|
||||
@@ -163,15 +159,15 @@ export default {
|
||||
signature: 'PolkadotPrimitivesV0ValidatorAppSignature'
|
||||
},
|
||||
/**
|
||||
* Lookup319: bitvec::order::Lsb0
|
||||
* Lookup321: bitvec::order::Lsb0
|
||||
**/
|
||||
BitvecOrderLsb0: 'Null',
|
||||
/**
|
||||
* Lookup321: polkadot_primitives::v0::validator_app::Signature
|
||||
* Lookup323: polkadot_primitives::v0::validator_app::Signature
|
||||
**/
|
||||
PolkadotPrimitivesV0ValidatorAppSignature: 'SpCoreSr25519Signature',
|
||||
/**
|
||||
* Lookup323: polkadot_primitives::v1::BackedCandidate<primitive_types::H256>
|
||||
* Lookup325: polkadot_primitives::v1::BackedCandidate<primitive_types::H256>
|
||||
**/
|
||||
PolkadotPrimitivesV1BackedCandidate: {
|
||||
candidate: 'PolkadotPrimitivesV1CommittedCandidateReceipt',
|
||||
@@ -179,14 +175,14 @@ export default {
|
||||
validatorIndices: 'BitVec'
|
||||
},
|
||||
/**
|
||||
* Lookup324: polkadot_primitives::v1::CommittedCandidateReceipt<primitive_types::H256>
|
||||
* Lookup326: polkadot_primitives::v1::CommittedCandidateReceipt<primitive_types::H256>
|
||||
**/
|
||||
PolkadotPrimitivesV1CommittedCandidateReceipt: {
|
||||
descriptor: 'PolkadotPrimitivesV1CandidateDescriptor',
|
||||
commitments: 'PolkadotPrimitivesV1CandidateCommitments'
|
||||
},
|
||||
/**
|
||||
* Lookup325: polkadot_primitives::v1::CandidateCommitments<N>
|
||||
* Lookup327: polkadot_primitives::v1::CandidateCommitments<N>
|
||||
**/
|
||||
PolkadotPrimitivesV1CandidateCommitments: {
|
||||
upwardMessages: 'Vec<Bytes>',
|
||||
@@ -197,14 +193,14 @@ export default {
|
||||
hrmpWatermark: 'u32'
|
||||
},
|
||||
/**
|
||||
* Lookup327: polkadot_core_primitives::OutboundHrmpMessage<polkadot_parachain::primitives::Id>
|
||||
* Lookup329: polkadot_core_primitives::OutboundHrmpMessage<polkadot_parachain::primitives::Id>
|
||||
**/
|
||||
PolkadotCorePrimitivesOutboundHrmpMessage: {
|
||||
recipient: 'u32',
|
||||
data: 'Bytes'
|
||||
},
|
||||
/**
|
||||
* Lookup331: polkadot_primitives::v0::ValidityAttestation
|
||||
* Lookup333: polkadot_primitives::v0::ValidityAttestation
|
||||
**/
|
||||
PolkadotPrimitivesV0ValidityAttestation: {
|
||||
_enum: {
|
||||
@@ -214,7 +210,7 @@ export default {
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Lookup333: polkadot_primitives::v1::DisputeStatementSet
|
||||
* Lookup335: polkadot_primitives::v1::DisputeStatementSet
|
||||
**/
|
||||
PolkadotPrimitivesV1DisputeStatementSet: {
|
||||
candidateHash: 'H256',
|
||||
@@ -222,7 +218,7 @@ export default {
|
||||
statements: 'Vec<(PolkadotPrimitivesV1DisputeStatement,u32,PolkadotPrimitivesV0ValidatorAppSignature)>'
|
||||
},
|
||||
/**
|
||||
* Lookup337: polkadot_primitives::v1::DisputeStatement
|
||||
* Lookup339: polkadot_primitives::v1::DisputeStatement
|
||||
**/
|
||||
PolkadotPrimitivesV1DisputeStatement: {
|
||||
_enum: {
|
||||
@@ -231,7 +227,7 @@ export default {
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Lookup338: polkadot_primitives::v1::ValidDisputeStatementKind
|
||||
* Lookup340: polkadot_primitives::v1::ValidDisputeStatementKind
|
||||
**/
|
||||
PolkadotPrimitivesV1ValidDisputeStatementKind: {
|
||||
_enum: {
|
||||
@@ -242,13 +238,13 @@ export default {
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Lookup339: polkadot_primitives::v1::InvalidDisputeStatementKind
|
||||
* Lookup341: polkadot_primitives::v1::InvalidDisputeStatementKind
|
||||
**/
|
||||
PolkadotPrimitivesV1InvalidDisputeStatementKind: {
|
||||
_enum: ['Explicit']
|
||||
},
|
||||
/**
|
||||
* Lookup351: sp_runtime::MultiSigner
|
||||
* Lookup353: sp_runtime::MultiSigner
|
||||
**/
|
||||
SpRuntimeMultiSigner: {
|
||||
_enum: {
|
||||
@@ -258,11 +254,11 @@ export default {
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Lookup352: sp_core::ecdsa::Public
|
||||
* Lookup354: sp_core::ecdsa::Public
|
||||
**/
|
||||
SpCoreEcdsaPublic: '[u8;33]',
|
||||
/**
|
||||
* Lookup357: polkadot_runtime::OriginCaller
|
||||
* Lookup359: polkadot_runtime::OriginCaller
|
||||
**/
|
||||
PolkadotRuntimeOriginCaller: {
|
||||
_enum: {
|
||||
@@ -320,7 +316,7 @@ export default {
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Lookup361: polkadot_runtime_parachains::origin::pallet::Origin
|
||||
* Lookup363: polkadot_runtime_parachains::origin::pallet::Origin
|
||||
**/
|
||||
PolkadotRuntimeParachainsOriginPalletOrigin: {
|
||||
_enum: {
|
||||
@@ -328,7 +324,7 @@ export default {
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Lookup508: polkadot_runtime_parachains::configuration::HostConfiguration<BlockNumber>
|
||||
* Lookup513: polkadot_runtime_parachains::configuration::HostConfiguration<BlockNumber>
|
||||
**/
|
||||
PolkadotRuntimeParachainsConfigurationHostConfiguration: {
|
||||
maxCodeSize: 'u32',
|
||||
@@ -373,14 +369,14 @@ export default {
|
||||
umpMaxIndividualWeight: 'u64'
|
||||
},
|
||||
/**
|
||||
* Lookup512: polkadot_runtime_parachains::inclusion::AvailabilityBitfieldRecord<N>
|
||||
* Lookup517: polkadot_runtime_parachains::inclusion::AvailabilityBitfieldRecord<N>
|
||||
**/
|
||||
PolkadotRuntimeParachainsInclusionAvailabilityBitfieldRecord: {
|
||||
bitfield: 'BitVec',
|
||||
submittedAt: 'u32'
|
||||
},
|
||||
/**
|
||||
* Lookup513: polkadot_runtime_parachains::inclusion::CandidatePendingAvailability<primitive_types::H256, N>
|
||||
* Lookup518: polkadot_runtime_parachains::inclusion::CandidatePendingAvailability<primitive_types::H256, N>
|
||||
**/
|
||||
PolkadotRuntimeParachainsInclusionCandidatePendingAvailability: {
|
||||
_alias: {
|
||||
@@ -396,7 +392,7 @@ export default {
|
||||
backingGroup: 'u32'
|
||||
},
|
||||
/**
|
||||
* Lookup515: polkadot_primitives::v1::ScrapedOnChainVotes<primitive_types::H256>
|
||||
* Lookup520: polkadot_primitives::v1::ScrapedOnChainVotes<primitive_types::H256>
|
||||
**/
|
||||
PolkadotPrimitivesV1ScrapedOnChainVotes: {
|
||||
session: 'u32',
|
||||
@@ -404,32 +400,32 @@ export default {
|
||||
disputes: 'Vec<PolkadotPrimitivesV1DisputeStatementSet>'
|
||||
},
|
||||
/**
|
||||
* Lookup522: polkadot_runtime_parachains::scheduler::ParathreadClaimQueue
|
||||
* Lookup527: polkadot_runtime_parachains::scheduler::ParathreadClaimQueue
|
||||
**/
|
||||
PolkadotRuntimeParachainsSchedulerParathreadClaimQueue: {
|
||||
queue: 'Vec<PolkadotRuntimeParachainsSchedulerQueuedParathread>',
|
||||
nextCoreOffset: 'u32'
|
||||
},
|
||||
/**
|
||||
* Lookup524: polkadot_runtime_parachains::scheduler::QueuedParathread
|
||||
* Lookup529: polkadot_runtime_parachains::scheduler::QueuedParathread
|
||||
**/
|
||||
PolkadotRuntimeParachainsSchedulerQueuedParathread: {
|
||||
claim: 'PolkadotPrimitivesV1ParathreadEntry',
|
||||
coreOffset: 'u32'
|
||||
},
|
||||
/**
|
||||
* Lookup525: polkadot_primitives::v1::ParathreadEntry
|
||||
* Lookup530: polkadot_primitives::v1::ParathreadEntry
|
||||
**/
|
||||
PolkadotPrimitivesV1ParathreadEntry: {
|
||||
claim: 'PolkadotPrimitivesV1ParathreadClaim',
|
||||
retries: 'u32'
|
||||
},
|
||||
/**
|
||||
* Lookup526: polkadot_primitives::v1::ParathreadClaim
|
||||
* Lookup531: polkadot_primitives::v1::ParathreadClaim
|
||||
**/
|
||||
PolkadotPrimitivesV1ParathreadClaim: '(u32,PolkadotPrimitivesV0CollatorAppPublic)',
|
||||
/**
|
||||
* Lookup529: polkadot_primitives::v1::CoreOccupied
|
||||
* Lookup534: polkadot_primitives::v1::CoreOccupied
|
||||
**/
|
||||
PolkadotPrimitivesV1CoreOccupied: {
|
||||
_enum: {
|
||||
@@ -438,7 +434,7 @@ export default {
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Lookup532: polkadot_runtime_parachains::scheduler::CoreAssignment
|
||||
* Lookup537: polkadot_runtime_parachains::scheduler::CoreAssignment
|
||||
**/
|
||||
PolkadotRuntimeParachainsSchedulerCoreAssignment: {
|
||||
core: 'u32',
|
||||
@@ -447,7 +443,7 @@ export default {
|
||||
groupIdx: 'u32'
|
||||
},
|
||||
/**
|
||||
* Lookup533: polkadot_runtime_parachains::scheduler::AssignmentKind
|
||||
* Lookup538: polkadot_runtime_parachains::scheduler::AssignmentKind
|
||||
**/
|
||||
PolkadotRuntimeParachainsSchedulerAssignmentKind: {
|
||||
_enum: {
|
||||
@@ -456,39 +452,39 @@ export default {
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Lookup534: polkadot_runtime_parachains::paras::ParaLifecycle
|
||||
* Lookup539: polkadot_runtime_parachains::paras::ParaLifecycle
|
||||
**/
|
||||
PolkadotRuntimeParachainsParasParaLifecycle: {
|
||||
_enum: ['Onboarding', 'Parathread', 'Parachain', 'UpgradingParathread', 'DowngradingParachain', 'OffboardingParathread', 'OffboardingParachain']
|
||||
},
|
||||
/**
|
||||
* Lookup536: polkadot_runtime_parachains::paras::ParaPastCodeMeta<N>
|
||||
* Lookup541: polkadot_runtime_parachains::paras::ParaPastCodeMeta<N>
|
||||
**/
|
||||
PolkadotRuntimeParachainsParasParaPastCodeMeta: {
|
||||
upgradeTimes: 'Vec<PolkadotRuntimeParachainsParasReplacementTimes>',
|
||||
lastPruned: 'Option<u32>'
|
||||
},
|
||||
/**
|
||||
* Lookup538: polkadot_runtime_parachains::paras::ReplacementTimes<N>
|
||||
* Lookup543: polkadot_runtime_parachains::paras::ReplacementTimes<N>
|
||||
**/
|
||||
PolkadotRuntimeParachainsParasReplacementTimes: {
|
||||
expectedAt: 'u32',
|
||||
activatedAt: 'u32'
|
||||
},
|
||||
/**
|
||||
* Lookup540: polkadot_primitives::v1::UpgradeGoAhead
|
||||
* Lookup545: polkadot_primitives::v1::UpgradeGoAhead
|
||||
**/
|
||||
PolkadotPrimitivesV1UpgradeGoAhead: {
|
||||
_enum: ['Abort', 'GoAhead']
|
||||
},
|
||||
/**
|
||||
* Lookup541: polkadot_primitives::v1::UpgradeRestriction
|
||||
* Lookup546: polkadot_primitives::v1::UpgradeRestriction
|
||||
**/
|
||||
PolkadotPrimitivesV1UpgradeRestriction: {
|
||||
_enum: ['Present']
|
||||
},
|
||||
/**
|
||||
* Lookup542: polkadot_runtime_parachains::paras::ParaGenesisArgs
|
||||
* Lookup547: polkadot_runtime_parachains::paras::ParaGenesisArgs
|
||||
**/
|
||||
PolkadotRuntimeParachainsParasParaGenesisArgs: {
|
||||
genesisHead: 'Bytes',
|
||||
@@ -496,7 +492,7 @@ export default {
|
||||
parachain: 'bool'
|
||||
},
|
||||
/**
|
||||
* Lookup545: polkadot_runtime_parachains::initializer::BufferedSessionChange
|
||||
* Lookup550: polkadot_runtime_parachains::initializer::BufferedSessionChange
|
||||
**/
|
||||
PolkadotRuntimeParachainsInitializerBufferedSessionChange: {
|
||||
validators: 'Vec<PolkadotPrimitivesV0ValidatorAppPublic>',
|
||||
@@ -504,14 +500,14 @@ export default {
|
||||
sessionIndex: 'u32'
|
||||
},
|
||||
/**
|
||||
* Lookup547: polkadot_core_primitives::InboundDownwardMessage<BlockNumber>
|
||||
* Lookup552: polkadot_core_primitives::InboundDownwardMessage<BlockNumber>
|
||||
**/
|
||||
PolkadotCorePrimitivesInboundDownwardMessage: {
|
||||
sentAt: 'u32',
|
||||
msg: 'Bytes'
|
||||
},
|
||||
/**
|
||||
* Lookup550: polkadot_runtime_parachains::hrmp::HrmpOpenChannelRequest
|
||||
* Lookup555: polkadot_runtime_parachains::hrmp::HrmpOpenChannelRequest
|
||||
**/
|
||||
PolkadotRuntimeParachainsHrmpHrmpOpenChannelRequest: {
|
||||
confirmed: 'bool',
|
||||
@@ -522,7 +518,7 @@ export default {
|
||||
maxTotalSize: 'u32'
|
||||
},
|
||||
/**
|
||||
* Lookup552: polkadot_runtime_parachains::hrmp::HrmpChannel
|
||||
* Lookup557: polkadot_runtime_parachains::hrmp::HrmpChannel
|
||||
**/
|
||||
PolkadotRuntimeParachainsHrmpHrmpChannel: {
|
||||
maxCapacity: 'u32',
|
||||
@@ -535,14 +531,14 @@ export default {
|
||||
recipientDeposit: 'u128'
|
||||
},
|
||||
/**
|
||||
* Lookup555: polkadot_core_primitives::InboundHrmpMessage<BlockNumber>
|
||||
* Lookup560: polkadot_core_primitives::InboundHrmpMessage<BlockNumber>
|
||||
**/
|
||||
PolkadotCorePrimitivesInboundHrmpMessage: {
|
||||
sentAt: 'u32',
|
||||
data: 'Bytes'
|
||||
},
|
||||
/**
|
||||
* Lookup560: polkadot_primitives::v1::SessionInfo
|
||||
* Lookup565: polkadot_primitives::v1::SessionInfo
|
||||
**/
|
||||
PolkadotPrimitivesV1SessionInfo: {
|
||||
validators: 'Vec<PolkadotPrimitivesV0ValidatorAppPublic>',
|
||||
@@ -557,7 +553,7 @@ export default {
|
||||
neededApprovals: 'u32'
|
||||
},
|
||||
/**
|
||||
* Lookup562: polkadot_runtime_common::paras_registrar::ParaInfo<sp_core::crypto::AccountId32, Balance>
|
||||
* Lookup567: polkadot_runtime_common::paras_registrar::ParaInfo<sp_core::crypto::AccountId32, Balance>
|
||||
**/
|
||||
PolkadotRuntimeCommonParasRegistrarParaInfo: {
|
||||
manager: 'AccountId32',
|
||||
@@ -565,7 +561,7 @@ export default {
|
||||
locked: 'bool'
|
||||
},
|
||||
/**
|
||||
* Lookup572: polkadot_runtime_common::crowdloan::FundInfo<sp_core::crypto::AccountId32, Balance, BlockNumber, LeasePeriod>
|
||||
* Lookup577: polkadot_runtime_common::crowdloan::FundInfo<sp_core::crypto::AccountId32, Balance, BlockNumber, LeasePeriod>
|
||||
**/
|
||||
PolkadotRuntimeCommonCrowdloanFundInfo: {
|
||||
depositor: 'AccountId32',
|
||||
@@ -580,7 +576,7 @@ export default {
|
||||
trieIndex: 'u32'
|
||||
},
|
||||
/**
|
||||
* Lookup573: polkadot_runtime_common::crowdloan::LastContribution<BlockNumber>
|
||||
* Lookup578: polkadot_runtime_common::crowdloan::LastContribution<BlockNumber>
|
||||
**/
|
||||
PolkadotRuntimeCommonCrowdloanLastContribution: {
|
||||
_enum: {
|
||||
@@ -590,11 +586,11 @@ export default {
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Lookup585: polkadot_runtime_common::claims::PrevalidateAttests<T>
|
||||
* Lookup590: polkadot_runtime_common::claims::PrevalidateAttests<T>
|
||||
**/
|
||||
PolkadotRuntimeCommonClaimsPrevalidateAttests: 'Null',
|
||||
/**
|
||||
* Lookup586: polkadot_runtime::Runtime
|
||||
* Lookup591: polkadot_runtime::Runtime
|
||||
**/
|
||||
PolkadotRuntimeRuntime: 'Null'
|
||||
} as DefinitionsTypes;
|
||||
|
||||
@@ -568,7 +568,7 @@ export default {
|
||||
startingBlock: 'u32'
|
||||
},
|
||||
/**
|
||||
* Lookup295: pallet_assets::types::DestroyWitness
|
||||
* Lookup296: pallet_assets::types::DestroyWitness
|
||||
**/
|
||||
PalletAssetsDestroyWitness: {
|
||||
accounts: 'Compact<u32>',
|
||||
@@ -576,7 +576,7 @@ export default {
|
||||
approvals: 'Compact<u32>'
|
||||
},
|
||||
/**
|
||||
* Lookup301: pallet_uniques::types::DestroyWitness
|
||||
* Lookup302: pallet_uniques::types::DestroyWitness
|
||||
**/
|
||||
PalletUniquesDestroyWitness: {
|
||||
instances: 'Compact<u32>',
|
||||
@@ -584,21 +584,21 @@ export default {
|
||||
attributes: 'Compact<u32>'
|
||||
},
|
||||
/**
|
||||
* Lookup304: sp_transaction_storage_proof::TransactionStorageProof
|
||||
* Lookup305: sp_transaction_storage_proof::TransactionStorageProof
|
||||
**/
|
||||
SpTransactionStorageProofTransactionStorageProof: {
|
||||
chunk: 'Bytes',
|
||||
proof: 'Vec<Bytes>'
|
||||
},
|
||||
/**
|
||||
* Lookup313: sp_consensus_babe::BabeEpochConfiguration
|
||||
* Lookup314: sp_consensus_babe::BabeEpochConfiguration
|
||||
**/
|
||||
SpConsensusBabeBabeEpochConfiguration: {
|
||||
c: '(u64,u64)',
|
||||
allowedSlots: 'SpConsensusBabeAllowedSlots'
|
||||
},
|
||||
/**
|
||||
* Lookup316: pallet_authorship::UncleEntryItem<BlockNumber, primitive_types::H256, sp_core::crypto::AccountId32>
|
||||
* Lookup317: pallet_authorship::UncleEntryItem<BlockNumber, primitive_types::H256, sp_core::crypto::AccountId32>
|
||||
**/
|
||||
PalletAuthorshipUncleEntryItem: {
|
||||
_enum: {
|
||||
@@ -607,7 +607,7 @@ export default {
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Lookup321: pallet_balances::BalanceLock<Balance>
|
||||
* Lookup322: pallet_balances::BalanceLock<Balance>
|
||||
**/
|
||||
PalletBalancesBalanceLock: {
|
||||
id: '[u8;8]',
|
||||
@@ -615,32 +615,32 @@ export default {
|
||||
reasons: 'PalletBalancesReasons'
|
||||
},
|
||||
/**
|
||||
* Lookup322: pallet_balances::Reasons
|
||||
* Lookup323: pallet_balances::Reasons
|
||||
**/
|
||||
PalletBalancesReasons: {
|
||||
_enum: ['Fee', 'Misc', 'All']
|
||||
},
|
||||
/**
|
||||
* Lookup325: pallet_balances::ReserveData<ReserveIdentifier, Balance>
|
||||
* Lookup326: pallet_balances::ReserveData<ReserveIdentifier, Balance>
|
||||
**/
|
||||
PalletBalancesReserveData: {
|
||||
id: '[u8;8]',
|
||||
amount: 'u128'
|
||||
},
|
||||
/**
|
||||
* Lookup327: pallet_balances::Releases
|
||||
* Lookup328: pallet_balances::Releases
|
||||
**/
|
||||
PalletBalancesReleases: {
|
||||
_enum: ['V1_0_0', 'V2_0_0']
|
||||
},
|
||||
/**
|
||||
* Lookup330: pallet_transaction_payment::Releases
|
||||
* Lookup331: pallet_transaction_payment::Releases
|
||||
**/
|
||||
PalletTransactionPaymentReleases: {
|
||||
_enum: ['V1Ancient', 'V2']
|
||||
},
|
||||
/**
|
||||
* Lookup332: frame_support::weights::WeightToFeeCoefficient<Balance>
|
||||
* Lookup333: frame_support::weights::WeightToFeeCoefficient<Balance>
|
||||
**/
|
||||
FrameSupportWeightsWeightToFeeCoefficient: {
|
||||
coeffInteger: 'u128',
|
||||
@@ -649,7 +649,7 @@ export default {
|
||||
degree: 'u8'
|
||||
},
|
||||
/**
|
||||
* Lookup333: pallet_election_provider_multi_phase::Phase<Bn>
|
||||
* Lookup334: pallet_election_provider_multi_phase::Phase<Bn>
|
||||
**/
|
||||
PalletElectionProviderMultiPhasePhase: {
|
||||
_enum: {
|
||||
@@ -660,7 +660,7 @@ export default {
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Lookup335: pallet_election_provider_multi_phase::ReadySolution<sp_core::crypto::AccountId32>
|
||||
* Lookup336: pallet_election_provider_multi_phase::ReadySolution<sp_core::crypto::AccountId32>
|
||||
**/
|
||||
PalletElectionProviderMultiPhaseReadySolution: {
|
||||
supports: 'Vec<(AccountId32,SpNposElectionsSupport)>',
|
||||
@@ -668,14 +668,14 @@ export default {
|
||||
compute: 'PalletElectionProviderMultiPhaseElectionCompute'
|
||||
},
|
||||
/**
|
||||
* Lookup336: pallet_election_provider_multi_phase::RoundSnapshot<sp_core::crypto::AccountId32>
|
||||
* Lookup337: pallet_election_provider_multi_phase::RoundSnapshot<sp_core::crypto::AccountId32>
|
||||
**/
|
||||
PalletElectionProviderMultiPhaseRoundSnapshot: {
|
||||
voters: 'Vec<(AccountId32,u64,Vec<AccountId32>)>',
|
||||
targets: 'Vec<AccountId32>'
|
||||
},
|
||||
/**
|
||||
* Lookup343: pallet_election_provider_multi_phase::signed::SignedSubmission<sp_core::crypto::AccountId32, Balance, node_runtime::NposSolution16>
|
||||
* Lookup344: pallet_election_provider_multi_phase::signed::SignedSubmission<sp_core::crypto::AccountId32, Balance, node_runtime::NposSolution16>
|
||||
**/
|
||||
PalletElectionProviderMultiPhaseSignedSignedSubmission: {
|
||||
who: 'AccountId32',
|
||||
@@ -684,7 +684,7 @@ export default {
|
||||
reward: 'u128'
|
||||
},
|
||||
/**
|
||||
* Lookup345: pallet_staking::StakingLedger<sp_core::crypto::AccountId32, Balance>
|
||||
* Lookup346: pallet_staking::StakingLedger<sp_core::crypto::AccountId32, Balance>
|
||||
**/
|
||||
PalletStakingStakingLedger: {
|
||||
stash: 'AccountId32',
|
||||
@@ -694,14 +694,14 @@ export default {
|
||||
claimedRewards: 'Vec<u32>'
|
||||
},
|
||||
/**
|
||||
* Lookup347: pallet_staking::UnlockChunk<Balance>
|
||||
* Lookup348: pallet_staking::UnlockChunk<Balance>
|
||||
**/
|
||||
PalletStakingUnlockChunk: {
|
||||
value: 'Compact<u128>',
|
||||
era: 'Compact<u32>'
|
||||
},
|
||||
/**
|
||||
* Lookup348: pallet_staking::Nominations<sp_core::crypto::AccountId32>
|
||||
* Lookup349: pallet_staking::Nominations<sp_core::crypto::AccountId32>
|
||||
**/
|
||||
PalletStakingNominations: {
|
||||
targets: 'Vec<AccountId32>',
|
||||
@@ -709,27 +709,27 @@ export default {
|
||||
suppressed: 'bool'
|
||||
},
|
||||
/**
|
||||
* Lookup349: pallet_staking::ActiveEraInfo
|
||||
* Lookup350: pallet_staking::ActiveEraInfo
|
||||
**/
|
||||
PalletStakingActiveEraInfo: {
|
||||
index: 'u32',
|
||||
start: 'Option<u64>'
|
||||
},
|
||||
/**
|
||||
* Lookup351: pallet_staking::EraRewardPoints<sp_core::crypto::AccountId32>
|
||||
* Lookup352: pallet_staking::EraRewardPoints<sp_core::crypto::AccountId32>
|
||||
**/
|
||||
PalletStakingEraRewardPoints: {
|
||||
total: 'u32',
|
||||
individual: 'BTreeMap<AccountId32, u32>'
|
||||
},
|
||||
/**
|
||||
* Lookup355: pallet_staking::Forcing
|
||||
* Lookup356: pallet_staking::Forcing
|
||||
**/
|
||||
PalletStakingForcing: {
|
||||
_enum: ['NotForcing', 'ForceNew', 'ForceNone', 'ForceAlways']
|
||||
},
|
||||
/**
|
||||
* Lookup357: pallet_staking::UnappliedSlash<sp_core::crypto::AccountId32, Balance>
|
||||
* Lookup358: pallet_staking::UnappliedSlash<sp_core::crypto::AccountId32, Balance>
|
||||
**/
|
||||
PalletStakingUnappliedSlash: {
|
||||
validator: 'AccountId32',
|
||||
@@ -739,7 +739,7 @@ export default {
|
||||
payout: 'u128'
|
||||
},
|
||||
/**
|
||||
* Lookup359: pallet_staking::slashing::SlashingSpans
|
||||
* Lookup360: pallet_staking::slashing::SlashingSpans
|
||||
**/
|
||||
PalletStakingSlashingSlashingSpans: {
|
||||
spanIndex: 'u32',
|
||||
@@ -748,24 +748,24 @@ export default {
|
||||
prior: 'Vec<u32>'
|
||||
},
|
||||
/**
|
||||
* Lookup360: pallet_staking::slashing::SpanRecord<Balance>
|
||||
* Lookup361: pallet_staking::slashing::SpanRecord<Balance>
|
||||
**/
|
||||
PalletStakingSlashingSpanRecord: {
|
||||
slashed: 'u128',
|
||||
paidOut: 'u128'
|
||||
},
|
||||
/**
|
||||
* Lookup363: pallet_staking::Releases
|
||||
* Lookup364: pallet_staking::Releases
|
||||
**/
|
||||
PalletStakingReleases: {
|
||||
_enum: ['V1_0_0Ancient', 'V2_0_0', 'V3_0_0', 'V4_0_0', 'V5_0_0', 'V6_0_0', 'V7_0_0', 'V8_0_0']
|
||||
},
|
||||
/**
|
||||
* Lookup368: sp_core::crypto::KeyTypeId
|
||||
* Lookup369: sp_core::crypto::KeyTypeId
|
||||
**/
|
||||
SpCoreCryptoKeyTypeId: '[u8;4]',
|
||||
/**
|
||||
* Lookup373: pallet_democracy::PreimageStatus<sp_core::crypto::AccountId32, Balance, BlockNumber>
|
||||
* Lookup374: pallet_democracy::PreimageStatus<sp_core::crypto::AccountId32, Balance, BlockNumber>
|
||||
**/
|
||||
PalletDemocracyPreimageStatus: {
|
||||
_enum: {
|
||||
@@ -780,7 +780,7 @@ export default {
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Lookup374: pallet_democracy::types::ReferendumInfo<BlockNumber, primitive_types::H256, Balance>
|
||||
* Lookup375: pallet_democracy::types::ReferendumInfo<BlockNumber, primitive_types::H256, Balance>
|
||||
**/
|
||||
PalletDemocracyReferendumInfo: {
|
||||
_enum: {
|
||||
@@ -792,7 +792,7 @@ export default {
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Lookup375: pallet_democracy::types::ReferendumStatus<BlockNumber, primitive_types::H256, Balance>
|
||||
* Lookup376: pallet_democracy::types::ReferendumStatus<BlockNumber, primitive_types::H256, Balance>
|
||||
**/
|
||||
PalletDemocracyReferendumStatus: {
|
||||
end: 'u32',
|
||||
@@ -802,7 +802,7 @@ export default {
|
||||
tally: 'PalletDemocracyTally'
|
||||
},
|
||||
/**
|
||||
* Lookup376: pallet_democracy::types::Tally<Balance>
|
||||
* Lookup377: pallet_democracy::types::Tally<Balance>
|
||||
**/
|
||||
PalletDemocracyTally: {
|
||||
ayes: 'u128',
|
||||
@@ -810,7 +810,7 @@ export default {
|
||||
turnout: 'u128'
|
||||
},
|
||||
/**
|
||||
* Lookup377: pallet_democracy::vote::Voting<Balance, sp_core::crypto::AccountId32, BlockNumber>
|
||||
* Lookup378: pallet_democracy::vote::Voting<Balance, sp_core::crypto::AccountId32, BlockNumber>
|
||||
**/
|
||||
PalletDemocracyVoteVoting: {
|
||||
_enum: {
|
||||
@@ -829,24 +829,24 @@ export default {
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Lookup380: pallet_democracy::types::Delegations<Balance>
|
||||
* Lookup381: pallet_democracy::types::Delegations<Balance>
|
||||
**/
|
||||
PalletDemocracyDelegations: {
|
||||
votes: 'u128',
|
||||
capital: 'u128'
|
||||
},
|
||||
/**
|
||||
* Lookup381: pallet_democracy::vote::PriorLock<BlockNumber, Balance>
|
||||
* Lookup382: pallet_democracy::vote::PriorLock<BlockNumber, Balance>
|
||||
**/
|
||||
PalletDemocracyVotePriorLock: '(u32,u128)',
|
||||
/**
|
||||
* Lookup384: pallet_democracy::Releases
|
||||
* Lookup385: pallet_democracy::Releases
|
||||
**/
|
||||
PalletDemocracyReleases: {
|
||||
_enum: ['V1']
|
||||
},
|
||||
/**
|
||||
* Lookup387: pallet_collective::Votes<sp_core::crypto::AccountId32, BlockNumber>
|
||||
* Lookup388: pallet_collective::Votes<sp_core::crypto::AccountId32, BlockNumber>
|
||||
**/
|
||||
PalletCollectiveVotes: {
|
||||
index: 'u32',
|
||||
@@ -856,7 +856,7 @@ export default {
|
||||
end: 'u32'
|
||||
},
|
||||
/**
|
||||
* Lookup392: pallet_elections_phragmen::SeatHolder<sp_core::crypto::AccountId32, Balance>
|
||||
* Lookup393: pallet_elections_phragmen::SeatHolder<sp_core::crypto::AccountId32, Balance>
|
||||
**/
|
||||
PalletElectionsPhragmenSeatHolder: {
|
||||
who: 'AccountId32',
|
||||
@@ -864,7 +864,7 @@ export default {
|
||||
deposit: 'u128'
|
||||
},
|
||||
/**
|
||||
* Lookup393: pallet_elections_phragmen::Voter<sp_core::crypto::AccountId32, Balance>
|
||||
* Lookup394: pallet_elections_phragmen::Voter<sp_core::crypto::AccountId32, Balance>
|
||||
**/
|
||||
PalletElectionsPhragmenVoter: {
|
||||
votes: 'Vec<AccountId32>',
|
||||
@@ -872,7 +872,7 @@ export default {
|
||||
deposit: 'u128'
|
||||
},
|
||||
/**
|
||||
* Lookup396: pallet_grandpa::StoredState<N>
|
||||
* Lookup397: pallet_grandpa::StoredState<N>
|
||||
**/
|
||||
PalletGrandpaStoredState: {
|
||||
_enum: {
|
||||
@@ -889,7 +889,7 @@ export default {
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Lookup397: pallet_grandpa::StoredPendingChange<N, Limit>
|
||||
* Lookup398: pallet_grandpa::StoredPendingChange<N, Limit>
|
||||
**/
|
||||
PalletGrandpaStoredPendingChange: {
|
||||
scheduledAt: 'u32',
|
||||
@@ -898,7 +898,7 @@ export default {
|
||||
forced: 'Option<u32>'
|
||||
},
|
||||
/**
|
||||
* Lookup400: pallet_treasury::Proposal<sp_core::crypto::AccountId32, Balance>
|
||||
* Lookup401: pallet_treasury::Proposal<sp_core::crypto::AccountId32, Balance>
|
||||
**/
|
||||
PalletTreasuryProposal: {
|
||||
proposer: 'AccountId32',
|
||||
@@ -907,11 +907,11 @@ export default {
|
||||
bond: 'u128'
|
||||
},
|
||||
/**
|
||||
* Lookup403: frame_support::PalletId
|
||||
* Lookup404: frame_support::PalletId
|
||||
**/
|
||||
FrameSupportPalletId: '[u8;8]',
|
||||
/**
|
||||
* Lookup405: pallet_contracts::wasm::PrefabWasmModule<T>
|
||||
* Lookup406: pallet_contracts::wasm::PrefabWasmModule<T>
|
||||
**/
|
||||
PalletContractsWasmPrefabWasmModule: {
|
||||
instructionWeightsVersion: 'Compact<u32>',
|
||||
@@ -923,7 +923,7 @@ export default {
|
||||
originalCodeLen: 'u32'
|
||||
},
|
||||
/**
|
||||
* Lookup407: pallet_contracts::storage::RawContractInfo<primitive_types::H256>
|
||||
* Lookup408: pallet_contracts::storage::RawContractInfo<primitive_types::H256>
|
||||
**/
|
||||
PalletContractsStorageRawContractInfo: {
|
||||
trieId: 'Bytes',
|
||||
@@ -931,13 +931,13 @@ export default {
|
||||
reserved: 'Option<Null>'
|
||||
},
|
||||
/**
|
||||
* Lookup409: pallet_contracts::storage::DeletedContract
|
||||
* Lookup410: pallet_contracts::storage::DeletedContract
|
||||
**/
|
||||
PalletContractsStorageDeletedContract: {
|
||||
trieId: 'Bytes'
|
||||
},
|
||||
/**
|
||||
* Lookup410: pallet_contracts::schedule::Schedule<T>
|
||||
* Lookup411: pallet_contracts::schedule::Schedule<T>
|
||||
**/
|
||||
PalletContractsSchedule: {
|
||||
limits: 'PalletContractsScheduleLimits',
|
||||
@@ -945,7 +945,7 @@ export default {
|
||||
hostFnWeights: 'PalletContractsScheduleHostFnWeights'
|
||||
},
|
||||
/**
|
||||
* Lookup411: pallet_contracts::schedule::Limits
|
||||
* Lookup412: pallet_contracts::schedule::Limits
|
||||
**/
|
||||
PalletContractsScheduleLimits: {
|
||||
eventTopics: 'u32',
|
||||
@@ -961,7 +961,7 @@ export default {
|
||||
codeLen: 'u32'
|
||||
},
|
||||
/**
|
||||
* Lookup412: pallet_contracts::schedule::InstructionWeights<T>
|
||||
* Lookup413: pallet_contracts::schedule::InstructionWeights<T>
|
||||
**/
|
||||
PalletContractsScheduleInstructionWeights: {
|
||||
_alias: {
|
||||
@@ -1021,7 +1021,7 @@ export default {
|
||||
i64Rotr: 'u32'
|
||||
},
|
||||
/**
|
||||
* Lookup413: pallet_contracts::schedule::HostFnWeights<T>
|
||||
* Lookup414: pallet_contracts::schedule::HostFnWeights<T>
|
||||
**/
|
||||
PalletContractsScheduleHostFnWeights: {
|
||||
_alias: {
|
||||
@@ -1073,21 +1073,21 @@ export default {
|
||||
ecdsaRecover: 'u64'
|
||||
},
|
||||
/**
|
||||
* Lookup419: pallet_im_online::BoundedOpaqueNetworkState<PeerIdEncodingLimit, MultiAddrEncodingLimit, AddressesLimit>
|
||||
* Lookup420: pallet_im_online::BoundedOpaqueNetworkState<PeerIdEncodingLimit, MultiAddrEncodingLimit, AddressesLimit>
|
||||
**/
|
||||
PalletImOnlineBoundedOpaqueNetworkState: {
|
||||
peerId: 'Bytes',
|
||||
externalAddresses: 'Vec<Bytes>'
|
||||
},
|
||||
/**
|
||||
* Lookup424: sp_staking::offence::OffenceDetails<sp_core::crypto::AccountId32, Offender>
|
||||
* Lookup425: sp_staking::offence::OffenceDetails<sp_core::crypto::AccountId32, Offender>
|
||||
**/
|
||||
SpStakingOffenceOffenceDetails: {
|
||||
offender: '(AccountId32,PalletStakingExposure)',
|
||||
reporters: 'Vec<AccountId32>'
|
||||
},
|
||||
/**
|
||||
* Lookup426: pallet_identity::types::Registration<Balance, MaxJudgements, MaxAdditionalFields>
|
||||
* Lookup427: pallet_identity::types::Registration<Balance, MaxJudgements, MaxAdditionalFields>
|
||||
**/
|
||||
PalletIdentityRegistration: {
|
||||
judgements: 'Vec<(u32,PalletIdentityJudgement)>',
|
||||
@@ -1095,7 +1095,7 @@ export default {
|
||||
info: 'PalletIdentityIdentityInfo'
|
||||
},
|
||||
/**
|
||||
* Lookup434: pallet_identity::types::RegistrarInfo<Balance, sp_core::crypto::AccountId32>
|
||||
* Lookup435: pallet_identity::types::RegistrarInfo<Balance, sp_core::crypto::AccountId32>
|
||||
**/
|
||||
PalletIdentityRegistrarInfo: {
|
||||
account: 'AccountId32',
|
||||
@@ -1103,7 +1103,7 @@ export default {
|
||||
fields: 'PalletIdentityBitFlags'
|
||||
},
|
||||
/**
|
||||
* Lookup438: pallet_society::Bid<sp_core::crypto::AccountId32, Balance>
|
||||
* Lookup439: pallet_society::Bid<sp_core::crypto::AccountId32, Balance>
|
||||
**/
|
||||
PalletSocietyBid: {
|
||||
who: 'AccountId32',
|
||||
@@ -1111,7 +1111,7 @@ export default {
|
||||
value: 'u128'
|
||||
},
|
||||
/**
|
||||
* Lookup439: pallet_society::BidKind<sp_core::crypto::AccountId32, Balance>
|
||||
* Lookup440: pallet_society::BidKind<sp_core::crypto::AccountId32, Balance>
|
||||
**/
|
||||
PalletSocietyBidKind: {
|
||||
_enum: {
|
||||
@@ -1120,19 +1120,19 @@ export default {
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Lookup441: pallet_society::VouchingStatus
|
||||
* Lookup442: pallet_society::VouchingStatus
|
||||
**/
|
||||
PalletSocietyVouchingStatus: {
|
||||
_enum: ['Vouching', 'Banned']
|
||||
},
|
||||
/**
|
||||
* Lookup445: pallet_society::Vote
|
||||
* Lookup446: pallet_society::Vote
|
||||
**/
|
||||
PalletSocietyVote: {
|
||||
_enum: ['Skeptic', 'Reject', 'Approve']
|
||||
},
|
||||
/**
|
||||
* Lookup447: pallet_recovery::RecoveryConfig<BlockNumber, Balance, sp_core::crypto::AccountId32>
|
||||
* Lookup448: pallet_recovery::RecoveryConfig<BlockNumber, Balance, sp_core::crypto::AccountId32>
|
||||
**/
|
||||
PalletRecoveryRecoveryConfig: {
|
||||
delayPeriod: 'u32',
|
||||
@@ -1141,7 +1141,7 @@ export default {
|
||||
threshold: 'u16'
|
||||
},
|
||||
/**
|
||||
* Lookup448: pallet_recovery::ActiveRecovery<BlockNumber, Balance, sp_core::crypto::AccountId32>
|
||||
* Lookup449: pallet_recovery::ActiveRecovery<BlockNumber, Balance, sp_core::crypto::AccountId32>
|
||||
**/
|
||||
PalletRecoveryActiveRecovery: {
|
||||
created: 'u32',
|
||||
@@ -1149,13 +1149,13 @@ export default {
|
||||
friends: 'Vec<AccountId32>'
|
||||
},
|
||||
/**
|
||||
* Lookup452: pallet_vesting::Releases
|
||||
* Lookup453: pallet_vesting::Releases
|
||||
**/
|
||||
PalletVestingReleases: {
|
||||
_enum: ['V0', 'V1']
|
||||
},
|
||||
/**
|
||||
* Lookup456: pallet_scheduler::ScheduledV2<node_runtime::Call, BlockNumber, node_runtime::OriginCaller, sp_core::crypto::AccountId32>
|
||||
* Lookup457: pallet_scheduler::ScheduledV2<node_runtime::Call, BlockNumber, node_runtime::OriginCaller, sp_core::crypto::AccountId32>
|
||||
**/
|
||||
PalletSchedulerScheduledV2: {
|
||||
maybeId: 'Option<Bytes>',
|
||||
@@ -1165,7 +1165,7 @@ export default {
|
||||
origin: 'NodeRuntimeOriginCaller'
|
||||
},
|
||||
/**
|
||||
* Lookup457: node_runtime::OriginCaller
|
||||
* Lookup458: node_runtime::OriginCaller
|
||||
**/
|
||||
NodeRuntimeOriginCaller: {
|
||||
_enum: {
|
||||
@@ -1186,7 +1186,7 @@ export default {
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Lookup458: frame_system::RawOrigin<sp_core::crypto::AccountId32>
|
||||
* Lookup459: frame_system::RawOrigin<sp_core::crypto::AccountId32>
|
||||
**/
|
||||
FrameSystemRawOrigin: {
|
||||
_enum: {
|
||||
@@ -1196,7 +1196,7 @@ export default {
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Lookup459: pallet_collective::RawOrigin<sp_core::crypto::AccountId32, I>
|
||||
* Lookup460: pallet_collective::RawOrigin<sp_core::crypto::AccountId32, I>
|
||||
**/
|
||||
PalletCollectiveRawOrigin: {
|
||||
_enum: {
|
||||
@@ -1206,17 +1206,17 @@ export default {
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Lookup461: sp_core::Void
|
||||
* Lookup462: sp_core::Void
|
||||
**/
|
||||
SpCoreVoid: 'Null',
|
||||
/**
|
||||
* Lookup462: pallet_scheduler::Releases
|
||||
* Lookup463: pallet_scheduler::Releases
|
||||
**/
|
||||
PalletSchedulerReleases: {
|
||||
_enum: ['V1', 'V2']
|
||||
},
|
||||
/**
|
||||
* Lookup466: pallet_proxy::ProxyDefinition<sp_core::crypto::AccountId32, node_runtime::ProxyType, BlockNumber>
|
||||
* Lookup467: pallet_proxy::ProxyDefinition<sp_core::crypto::AccountId32, node_runtime::ProxyType, BlockNumber>
|
||||
**/
|
||||
PalletProxyProxyDefinition: {
|
||||
delegate: 'AccountId32',
|
||||
@@ -1224,7 +1224,7 @@ export default {
|
||||
delay: 'u32'
|
||||
},
|
||||
/**
|
||||
* Lookup470: pallet_proxy::Announcement<sp_core::crypto::AccountId32, primitive_types::H256, BlockNumber>
|
||||
* Lookup471: pallet_proxy::Announcement<sp_core::crypto::AccountId32, primitive_types::H256, BlockNumber>
|
||||
**/
|
||||
PalletProxyAnnouncement: {
|
||||
real: 'AccountId32',
|
||||
@@ -1232,7 +1232,7 @@ export default {
|
||||
height: 'u32'
|
||||
},
|
||||
/**
|
||||
* Lookup474: pallet_multisig::Multisig<BlockNumber, Balance, sp_core::crypto::AccountId32>
|
||||
* Lookup475: pallet_multisig::Multisig<BlockNumber, Balance, sp_core::crypto::AccountId32>
|
||||
**/
|
||||
PalletMultisigMultisig: {
|
||||
when: 'PalletMultisigTimepoint',
|
||||
@@ -1241,7 +1241,7 @@ export default {
|
||||
approvals: 'Vec<AccountId32>'
|
||||
},
|
||||
/**
|
||||
* Lookup477: pallet_bounties::Bounty<sp_core::crypto::AccountId32, Balance, BlockNumber>
|
||||
* Lookup478: pallet_bounties::Bounty<sp_core::crypto::AccountId32, Balance, BlockNumber>
|
||||
**/
|
||||
PalletBountiesBounty: {
|
||||
proposer: 'AccountId32',
|
||||
@@ -1252,7 +1252,7 @@ export default {
|
||||
status: 'PalletBountiesBountyStatus'
|
||||
},
|
||||
/**
|
||||
* Lookup478: pallet_bounties::BountyStatus<sp_core::crypto::AccountId32, BlockNumber>
|
||||
* Lookup479: pallet_bounties::BountyStatus<sp_core::crypto::AccountId32, BlockNumber>
|
||||
**/
|
||||
PalletBountiesBountyStatus: {
|
||||
_enum: {
|
||||
@@ -1274,7 +1274,7 @@ export default {
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Lookup480: pallet_tips::OpenTip<sp_core::crypto::AccountId32, Balance, BlockNumber, primitive_types::H256>
|
||||
* Lookup481: pallet_tips::OpenTip<sp_core::crypto::AccountId32, Balance, BlockNumber, primitive_types::H256>
|
||||
**/
|
||||
PalletTipsOpenTip: {
|
||||
reason: 'H256',
|
||||
@@ -1286,7 +1286,7 @@ export default {
|
||||
findersFee: 'bool'
|
||||
},
|
||||
/**
|
||||
* Lookup482: pallet_assets::types::AssetDetails<Balance, sp_core::crypto::AccountId32, DepositBalance>
|
||||
* Lookup483: pallet_assets::types::AssetDetails<Balance, sp_core::crypto::AccountId32, DepositBalance>
|
||||
**/
|
||||
PalletAssetsAssetDetails: {
|
||||
owner: 'AccountId32',
|
||||
@@ -1303,7 +1303,7 @@ export default {
|
||||
isFrozen: 'bool'
|
||||
},
|
||||
/**
|
||||
* Lookup483: pallet_assets::types::AssetBalance<Balance, Extra>
|
||||
* Lookup484: pallet_assets::types::AssetBalance<Balance, Extra>
|
||||
**/
|
||||
PalletAssetsAssetBalance: {
|
||||
balance: 'u64',
|
||||
@@ -1312,14 +1312,14 @@ export default {
|
||||
extra: 'Null'
|
||||
},
|
||||
/**
|
||||
* Lookup485: pallet_assets::types::Approval<Balance, DepositBalance>
|
||||
* Lookup486: pallet_assets::types::Approval<Balance, DepositBalance>
|
||||
**/
|
||||
PalletAssetsApproval: {
|
||||
amount: 'u64',
|
||||
deposit: 'u128'
|
||||
},
|
||||
/**
|
||||
* Lookup486: pallet_assets::types::AssetMetadata<DepositBalance, frame_support::storage::bounded_vec::BoundedVec<T, S>>
|
||||
* Lookup487: pallet_assets::types::AssetMetadata<DepositBalance, frame_support::storage::bounded_vec::BoundedVec<T, S>>
|
||||
**/
|
||||
PalletAssetsAssetMetadata: {
|
||||
deposit: 'u128',
|
||||
@@ -1329,7 +1329,7 @@ export default {
|
||||
isFrozen: 'bool'
|
||||
},
|
||||
/**
|
||||
* Lookup488: pallet_lottery::LotteryConfig<BlockNumber, Balance>
|
||||
* Lookup489: pallet_lottery::LotteryConfig<BlockNumber, Balance>
|
||||
**/
|
||||
PalletLotteryLotteryConfig: {
|
||||
price: 'u128',
|
||||
@@ -1339,14 +1339,14 @@ export default {
|
||||
repeat: 'bool'
|
||||
},
|
||||
/**
|
||||
* Lookup493: pallet_gilt::pallet::GiltBid<Balance, sp_core::crypto::AccountId32>
|
||||
* Lookup494: pallet_gilt::pallet::GiltBid<Balance, sp_core::crypto::AccountId32>
|
||||
**/
|
||||
PalletGiltGiltBid: {
|
||||
amount: 'u128',
|
||||
who: 'AccountId32'
|
||||
},
|
||||
/**
|
||||
* Lookup494: pallet_gilt::pallet::ActiveGiltsTotal<Balance>
|
||||
* Lookup495: pallet_gilt::pallet::ActiveGiltsTotal<Balance>
|
||||
**/
|
||||
PalletGiltActiveGiltsTotal: {
|
||||
frozen: 'u128',
|
||||
@@ -1355,7 +1355,7 @@ export default {
|
||||
target: 'Perquintill'
|
||||
},
|
||||
/**
|
||||
* Lookup495: pallet_gilt::pallet::ActiveGilt<Balance, sp_core::crypto::AccountId32, BlockNumber>
|
||||
* Lookup496: pallet_gilt::pallet::ActiveGilt<Balance, sp_core::crypto::AccountId32, BlockNumber>
|
||||
**/
|
||||
PalletGiltActiveGilt: {
|
||||
proportion: 'Perquintill',
|
||||
@@ -1364,7 +1364,7 @@ export default {
|
||||
expiry: 'u32'
|
||||
},
|
||||
/**
|
||||
* Lookup497: pallet_uniques::types::ClassDetails<sp_core::crypto::AccountId32, DepositBalance>
|
||||
* Lookup498: pallet_uniques::types::ClassDetails<sp_core::crypto::AccountId32, DepositBalance>
|
||||
**/
|
||||
PalletUniquesClassDetails: {
|
||||
owner: 'AccountId32',
|
||||
@@ -1379,7 +1379,7 @@ export default {
|
||||
isFrozen: 'bool'
|
||||
},
|
||||
/**
|
||||
* Lookup499: pallet_uniques::types::InstanceDetails<sp_core::crypto::AccountId32, DepositBalance>
|
||||
* Lookup500: pallet_uniques::types::InstanceDetails<sp_core::crypto::AccountId32, DepositBalance>
|
||||
**/
|
||||
PalletUniquesInstanceDetails: {
|
||||
owner: 'AccountId32',
|
||||
@@ -1388,7 +1388,7 @@ export default {
|
||||
deposit: 'u128'
|
||||
},
|
||||
/**
|
||||
* Lookup500: pallet_uniques::types::ClassMetadata<DepositBalance, StringLimit>
|
||||
* Lookup501: pallet_uniques::types::ClassMetadata<DepositBalance, StringLimit>
|
||||
**/
|
||||
PalletUniquesClassMetadata: {
|
||||
deposit: 'u128',
|
||||
@@ -1396,7 +1396,7 @@ export default {
|
||||
isFrozen: 'bool'
|
||||
},
|
||||
/**
|
||||
* Lookup501: pallet_uniques::types::InstanceMetadata<DepositBalance, StringLimit>
|
||||
* Lookup502: pallet_uniques::types::InstanceMetadata<DepositBalance, StringLimit>
|
||||
**/
|
||||
PalletUniquesInstanceMetadata: {
|
||||
deposit: 'u128',
|
||||
@@ -1404,7 +1404,7 @@ export default {
|
||||
isFrozen: 'bool'
|
||||
},
|
||||
/**
|
||||
* Lookup506: pallet_transaction_storage::TransactionInfo
|
||||
* Lookup507: pallet_transaction_storage::TransactionInfo
|
||||
**/
|
||||
PalletTransactionStorageTransactionInfo: {
|
||||
_alias: {
|
||||
@@ -1416,7 +1416,7 @@ export default {
|
||||
blockChunks: 'u32'
|
||||
},
|
||||
/**
|
||||
* Lookup508: pallet_bags_list::list::Node<T>
|
||||
* Lookup509: pallet_bags_list::list::Node<T>
|
||||
**/
|
||||
PalletBagsListListNode: {
|
||||
id: 'AccountId32',
|
||||
@@ -1425,14 +1425,14 @@ export default {
|
||||
bagUpper: 'u64'
|
||||
},
|
||||
/**
|
||||
* Lookup509: pallet_bags_list::list::Bag<T>
|
||||
* Lookup510: pallet_bags_list::list::Bag<T>
|
||||
**/
|
||||
PalletBagsListListBag: {
|
||||
head: 'Option<AccountId32>',
|
||||
tail: 'Option<AccountId32>'
|
||||
},
|
||||
/**
|
||||
* Lookup512: sp_runtime::MultiSignature
|
||||
* Lookup513: sp_runtime::MultiSignature
|
||||
**/
|
||||
SpRuntimeMultiSignature: {
|
||||
_enum: {
|
||||
@@ -1442,35 +1442,35 @@ export default {
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Lookup513: sp_core::ecdsa::Signature
|
||||
* Lookup514: sp_core::ecdsa::Signature
|
||||
**/
|
||||
SpCoreEcdsaSignature: '[u8;65]',
|
||||
/**
|
||||
* Lookup516: frame_system::extensions::check_spec_version::CheckSpecVersion<T>
|
||||
* Lookup517: frame_system::extensions::check_spec_version::CheckSpecVersion<T>
|
||||
**/
|
||||
FrameSystemExtensionsCheckSpecVersion: 'Null',
|
||||
/**
|
||||
* Lookup517: frame_system::extensions::check_tx_version::CheckTxVersion<T>
|
||||
* Lookup518: frame_system::extensions::check_tx_version::CheckTxVersion<T>
|
||||
**/
|
||||
FrameSystemExtensionsCheckTxVersion: 'Null',
|
||||
/**
|
||||
* Lookup518: frame_system::extensions::check_genesis::CheckGenesis<T>
|
||||
* Lookup519: frame_system::extensions::check_genesis::CheckGenesis<T>
|
||||
**/
|
||||
FrameSystemExtensionsCheckGenesis: 'Null',
|
||||
/**
|
||||
* Lookup521: frame_system::extensions::check_nonce::CheckNonce<T>
|
||||
* Lookup522: frame_system::extensions::check_nonce::CheckNonce<T>
|
||||
**/
|
||||
FrameSystemExtensionsCheckNonce: 'Compact<u32>',
|
||||
/**
|
||||
* Lookup522: frame_system::extensions::check_weight::CheckWeight<T>
|
||||
* Lookup523: frame_system::extensions::check_weight::CheckWeight<T>
|
||||
**/
|
||||
FrameSystemExtensionsCheckWeight: 'Null',
|
||||
/**
|
||||
* Lookup523: pallet_transaction_payment::ChargeTransactionPayment<T>
|
||||
* Lookup524: pallet_transaction_payment::ChargeTransactionPayment<T>
|
||||
**/
|
||||
PalletTransactionPaymentChargeTransactionPayment: 'Compact<u128>',
|
||||
/**
|
||||
* Lookup524: node_runtime::Runtime
|
||||
* Lookup525: node_runtime::Runtime
|
||||
**/
|
||||
NodeRuntimeRuntime: 'Null'
|
||||
} as DefinitionsTypes;
|
||||
|
||||
@@ -7,9 +7,6 @@ import type { ITuple } from '@polkadot/types/types';
|
||||
|
||||
declare module '@polkadot/types/lookup' {
|
||||
|
||||
/** @name PolkadotRuntimeCommonClaimsEthereumAddress (66) */
|
||||
export interface PolkadotRuntimeCommonClaimsEthereumAddress extends U8aFixed {}
|
||||
|
||||
/** @name PolkadotRuntimeProxyType (72) */
|
||||
export interface PolkadotRuntimeProxyType extends Enum {
|
||||
readonly isAny: boolean;
|
||||
@@ -21,13 +18,13 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly isAuction: boolean;
|
||||
}
|
||||
|
||||
/** @name PolkadotPrimitivesV1CandidateReceipt (82) */
|
||||
/** @name PolkadotPrimitivesV1CandidateReceipt (83) */
|
||||
export interface PolkadotPrimitivesV1CandidateReceipt extends Struct {
|
||||
readonly descriptor: PolkadotPrimitivesV1CandidateDescriptor;
|
||||
readonly commitmentsHash: H256;
|
||||
}
|
||||
|
||||
/** @name PolkadotPrimitivesV1CandidateDescriptor (83) */
|
||||
/** @name PolkadotPrimitivesV1CandidateDescriptor (84) */
|
||||
export interface PolkadotPrimitivesV1CandidateDescriptor extends Struct {
|
||||
readonly paraId: u32;
|
||||
readonly relayParent: H256;
|
||||
@@ -40,13 +37,13 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly validationCodeHash: H256;
|
||||
}
|
||||
|
||||
/** @name PolkadotPrimitivesV0CollatorAppPublic (85) */
|
||||
/** @name PolkadotPrimitivesV0CollatorAppPublic (86) */
|
||||
export interface PolkadotPrimitivesV0CollatorAppPublic extends SpCoreSr25519Public {}
|
||||
|
||||
/** @name PolkadotPrimitivesV0CollatorAppSignature (86) */
|
||||
/** @name PolkadotPrimitivesV0CollatorAppSignature (87) */
|
||||
export interface PolkadotPrimitivesV0CollatorAppSignature extends SpCoreSr25519Signature {}
|
||||
|
||||
/** @name XcmV2TraitsOutcome (95) */
|
||||
/** @name XcmV2TraitsOutcome (96) */
|
||||
export interface XcmV2TraitsOutcome extends Enum {
|
||||
readonly isComplete: boolean;
|
||||
readonly asComplete: u64;
|
||||
@@ -56,7 +53,7 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly asError: XcmV2TraitsError;
|
||||
}
|
||||
|
||||
/** @name XcmV2TraitsError (96) */
|
||||
/** @name XcmV2TraitsError (97) */
|
||||
export interface XcmV2TraitsError extends Enum {
|
||||
readonly isOverflow: boolean;
|
||||
readonly isUnimplemented: boolean;
|
||||
@@ -88,13 +85,13 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly isWeightNotComputable: boolean;
|
||||
}
|
||||
|
||||
/** @name PolkadotParachainPrimitivesHrmpChannelId (98) */
|
||||
/** @name PolkadotParachainPrimitivesHrmpChannelId (99) */
|
||||
export interface PolkadotParachainPrimitivesHrmpChannelId extends Struct {
|
||||
readonly sender: u32;
|
||||
readonly recipient: u32;
|
||||
}
|
||||
|
||||
/** @name PolkadotRuntimeSessionKeys (161) */
|
||||
/** @name PolkadotRuntimeSessionKeys (162) */
|
||||
export interface PolkadotRuntimeSessionKeys extends Struct {
|
||||
readonly grandpa: SpFinalityGrandpaAppPublic;
|
||||
readonly babe: SpConsensusBabeAppPublic;
|
||||
@@ -104,22 +101,22 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly authorityDiscovery: SpAuthorityDiscoveryAppPublic;
|
||||
}
|
||||
|
||||
/** @name PolkadotPrimitivesV0ValidatorAppPublic (162) */
|
||||
/** @name PolkadotPrimitivesV0ValidatorAppPublic (163) */
|
||||
export interface PolkadotPrimitivesV0ValidatorAppPublic extends SpCoreSr25519Public {}
|
||||
|
||||
/** @name PolkadotPrimitivesV1AssignmentAppPublic (163) */
|
||||
/** @name PolkadotPrimitivesV1AssignmentAppPublic (164) */
|
||||
export interface PolkadotPrimitivesV1AssignmentAppPublic extends SpCoreSr25519Public {}
|
||||
|
||||
/** @name PolkadotRuntimeCommonClaimsEcdsaSignature (195) */
|
||||
/** @name PolkadotRuntimeCommonClaimsEcdsaSignature (196) */
|
||||
export interface PolkadotRuntimeCommonClaimsEcdsaSignature extends U8aFixed {}
|
||||
|
||||
/** @name PolkadotRuntimeCommonClaimsStatementKind (200) */
|
||||
/** @name PolkadotRuntimeCommonClaimsStatementKind (201) */
|
||||
export interface PolkadotRuntimeCommonClaimsStatementKind extends Enum {
|
||||
readonly isRegular: boolean;
|
||||
readonly isSaft: boolean;
|
||||
}
|
||||
|
||||
/** @name PolkadotRuntimeNposCompactSolution16 (253) */
|
||||
/** @name PolkadotRuntimeNposCompactSolution16 (254) */
|
||||
export interface PolkadotRuntimeNposCompactSolution16 extends Struct {
|
||||
readonly votes1: Vec<ITuple<[Compact<u32>, Compact<u16>]>>;
|
||||
readonly votes2: Vec<ITuple<[Compact<u32>, ITuple<[Compact<u16>, Compact<PerU16>]>, Compact<u16>]>>;
|
||||
@@ -139,7 +136,7 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly votes16: Vec<ITuple<[Compact<u32>, Vec<ITuple<[Compact<u16>, Compact<PerU16>]>>, Compact<u16>]>>;
|
||||
}
|
||||
|
||||
/** @name PolkadotPrimitivesV1InherentData (314) */
|
||||
/** @name PolkadotPrimitivesV1InherentData (316) */
|
||||
export interface PolkadotPrimitivesV1InherentData extends Struct {
|
||||
readonly bitfields: Vec<PolkadotPrimitivesV1SignedUncheckedSigned>;
|
||||
readonly backedCandidates: Vec<PolkadotPrimitivesV1BackedCandidate>;
|
||||
@@ -147,33 +144,33 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly parentHeader: SpRuntimeGenericHeader;
|
||||
}
|
||||
|
||||
/** @name PolkadotPrimitivesV1SignedUncheckedSigned (316) */
|
||||
/** @name PolkadotPrimitivesV1SignedUncheckedSigned (318) */
|
||||
export interface PolkadotPrimitivesV1SignedUncheckedSigned extends Struct {
|
||||
readonly payload: BitVec;
|
||||
readonly validatorIndex: u32;
|
||||
readonly signature: PolkadotPrimitivesV0ValidatorAppSignature;
|
||||
}
|
||||
|
||||
/** @name BitvecOrderLsb0 (319) */
|
||||
/** @name BitvecOrderLsb0 (321) */
|
||||
export type BitvecOrderLsb0 = Null;
|
||||
|
||||
/** @name PolkadotPrimitivesV0ValidatorAppSignature (321) */
|
||||
/** @name PolkadotPrimitivesV0ValidatorAppSignature (323) */
|
||||
export interface PolkadotPrimitivesV0ValidatorAppSignature extends SpCoreSr25519Signature {}
|
||||
|
||||
/** @name PolkadotPrimitivesV1BackedCandidate (323) */
|
||||
/** @name PolkadotPrimitivesV1BackedCandidate (325) */
|
||||
export interface PolkadotPrimitivesV1BackedCandidate extends Struct {
|
||||
readonly candidate: PolkadotPrimitivesV1CommittedCandidateReceipt;
|
||||
readonly validityVotes: Vec<PolkadotPrimitivesV0ValidityAttestation>;
|
||||
readonly validatorIndices: BitVec;
|
||||
}
|
||||
|
||||
/** @name PolkadotPrimitivesV1CommittedCandidateReceipt (324) */
|
||||
/** @name PolkadotPrimitivesV1CommittedCandidateReceipt (326) */
|
||||
export interface PolkadotPrimitivesV1CommittedCandidateReceipt extends Struct {
|
||||
readonly descriptor: PolkadotPrimitivesV1CandidateDescriptor;
|
||||
readonly commitments: PolkadotPrimitivesV1CandidateCommitments;
|
||||
}
|
||||
|
||||
/** @name PolkadotPrimitivesV1CandidateCommitments (325) */
|
||||
/** @name PolkadotPrimitivesV1CandidateCommitments (327) */
|
||||
export interface PolkadotPrimitivesV1CandidateCommitments extends Struct {
|
||||
readonly upwardMessages: Vec<Bytes>;
|
||||
readonly horizontalMessages: Vec<PolkadotCorePrimitivesOutboundHrmpMessage>;
|
||||
@@ -183,13 +180,13 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly hrmpWatermark: u32;
|
||||
}
|
||||
|
||||
/** @name PolkadotCorePrimitivesOutboundHrmpMessage (327) */
|
||||
/** @name PolkadotCorePrimitivesOutboundHrmpMessage (329) */
|
||||
export interface PolkadotCorePrimitivesOutboundHrmpMessage extends Struct {
|
||||
readonly recipient: u32;
|
||||
readonly data: Bytes;
|
||||
}
|
||||
|
||||
/** @name PolkadotPrimitivesV0ValidityAttestation (331) */
|
||||
/** @name PolkadotPrimitivesV0ValidityAttestation (333) */
|
||||
export interface PolkadotPrimitivesV0ValidityAttestation extends Enum {
|
||||
readonly isImplicit: boolean;
|
||||
readonly asImplicit: PolkadotPrimitivesV0ValidatorAppSignature;
|
||||
@@ -197,14 +194,14 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly asExplicit: PolkadotPrimitivesV0ValidatorAppSignature;
|
||||
}
|
||||
|
||||
/** @name PolkadotPrimitivesV1DisputeStatementSet (333) */
|
||||
/** @name PolkadotPrimitivesV1DisputeStatementSet (335) */
|
||||
export interface PolkadotPrimitivesV1DisputeStatementSet extends Struct {
|
||||
readonly candidateHash: H256;
|
||||
readonly session: u32;
|
||||
readonly statements: Vec<ITuple<[PolkadotPrimitivesV1DisputeStatement, u32, PolkadotPrimitivesV0ValidatorAppSignature]>>;
|
||||
}
|
||||
|
||||
/** @name PolkadotPrimitivesV1DisputeStatement (337) */
|
||||
/** @name PolkadotPrimitivesV1DisputeStatement (339) */
|
||||
export interface PolkadotPrimitivesV1DisputeStatement extends Enum {
|
||||
readonly isValid: boolean;
|
||||
readonly asValid: PolkadotPrimitivesV1ValidDisputeStatementKind;
|
||||
@@ -212,7 +209,7 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly asInvalid: PolkadotPrimitivesV1InvalidDisputeStatementKind;
|
||||
}
|
||||
|
||||
/** @name PolkadotPrimitivesV1ValidDisputeStatementKind (338) */
|
||||
/** @name PolkadotPrimitivesV1ValidDisputeStatementKind (340) */
|
||||
export interface PolkadotPrimitivesV1ValidDisputeStatementKind extends Enum {
|
||||
readonly isExplicit: boolean;
|
||||
readonly isBackingSeconded: boolean;
|
||||
@@ -222,12 +219,12 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly isApprovalChecking: boolean;
|
||||
}
|
||||
|
||||
/** @name PolkadotPrimitivesV1InvalidDisputeStatementKind (339) */
|
||||
/** @name PolkadotPrimitivesV1InvalidDisputeStatementKind (341) */
|
||||
export interface PolkadotPrimitivesV1InvalidDisputeStatementKind extends Enum {
|
||||
readonly isExplicit: boolean;
|
||||
}
|
||||
|
||||
/** @name SpRuntimeMultiSigner (351) */
|
||||
/** @name SpRuntimeMultiSigner (353) */
|
||||
export interface SpRuntimeMultiSigner extends Enum {
|
||||
readonly isEd25519: boolean;
|
||||
readonly asEd25519: SpCoreEd25519Public;
|
||||
@@ -237,10 +234,10 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly asEcdsa: SpCoreEcdsaPublic;
|
||||
}
|
||||
|
||||
/** @name SpCoreEcdsaPublic (352) */
|
||||
/** @name SpCoreEcdsaPublic (354) */
|
||||
export interface SpCoreEcdsaPublic extends U8aFixed {}
|
||||
|
||||
/** @name PolkadotRuntimeOriginCaller (357) */
|
||||
/** @name PolkadotRuntimeOriginCaller (359) */
|
||||
export interface PolkadotRuntimeOriginCaller extends Enum {
|
||||
readonly isSystem: boolean;
|
||||
readonly asSystem: FrameSystemRawOrigin;
|
||||
@@ -253,13 +250,13 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly asParachainsOrigin: PolkadotRuntimeParachainsOriginPalletOrigin;
|
||||
}
|
||||
|
||||
/** @name PolkadotRuntimeParachainsOriginPalletOrigin (361) */
|
||||
/** @name PolkadotRuntimeParachainsOriginPalletOrigin (363) */
|
||||
export interface PolkadotRuntimeParachainsOriginPalletOrigin extends Enum {
|
||||
readonly isParachain: boolean;
|
||||
readonly asParachain: u32;
|
||||
}
|
||||
|
||||
/** @name PolkadotRuntimeParachainsConfigurationHostConfiguration (508) */
|
||||
/** @name PolkadotRuntimeParachainsConfigurationHostConfiguration (513) */
|
||||
export interface PolkadotRuntimeParachainsConfigurationHostConfiguration extends Struct {
|
||||
readonly maxCodeSize: u32;
|
||||
readonly maxHeadDataSize: u32;
|
||||
@@ -303,13 +300,13 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly umpMaxIndividualWeight: u64;
|
||||
}
|
||||
|
||||
/** @name PolkadotRuntimeParachainsInclusionAvailabilityBitfieldRecord (512) */
|
||||
/** @name PolkadotRuntimeParachainsInclusionAvailabilityBitfieldRecord (517) */
|
||||
export interface PolkadotRuntimeParachainsInclusionAvailabilityBitfieldRecord extends Struct {
|
||||
readonly bitfield: BitVec;
|
||||
readonly submittedAt: u32;
|
||||
}
|
||||
|
||||
/** @name PolkadotRuntimeParachainsInclusionCandidatePendingAvailability (513) */
|
||||
/** @name PolkadotRuntimeParachainsInclusionCandidatePendingAvailability (518) */
|
||||
export interface PolkadotRuntimeParachainsInclusionCandidatePendingAvailability extends Struct {
|
||||
readonly core: u32;
|
||||
readonly hash_: H256;
|
||||
@@ -321,42 +318,42 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly backingGroup: u32;
|
||||
}
|
||||
|
||||
/** @name PolkadotPrimitivesV1ScrapedOnChainVotes (515) */
|
||||
/** @name PolkadotPrimitivesV1ScrapedOnChainVotes (520) */
|
||||
export interface PolkadotPrimitivesV1ScrapedOnChainVotes extends Struct {
|
||||
readonly session: u32;
|
||||
readonly backingValidatorsPerCandidate: Vec<ITuple<[PolkadotPrimitivesV1CandidateReceipt, Vec<ITuple<[u32, PolkadotPrimitivesV0ValidityAttestation]>>]>>;
|
||||
readonly disputes: Vec<PolkadotPrimitivesV1DisputeStatementSet>;
|
||||
}
|
||||
|
||||
/** @name PolkadotRuntimeParachainsSchedulerParathreadClaimQueue (522) */
|
||||
/** @name PolkadotRuntimeParachainsSchedulerParathreadClaimQueue (527) */
|
||||
export interface PolkadotRuntimeParachainsSchedulerParathreadClaimQueue extends Struct {
|
||||
readonly queue: Vec<PolkadotRuntimeParachainsSchedulerQueuedParathread>;
|
||||
readonly nextCoreOffset: u32;
|
||||
}
|
||||
|
||||
/** @name PolkadotRuntimeParachainsSchedulerQueuedParathread (524) */
|
||||
/** @name PolkadotRuntimeParachainsSchedulerQueuedParathread (529) */
|
||||
export interface PolkadotRuntimeParachainsSchedulerQueuedParathread extends Struct {
|
||||
readonly claim: PolkadotPrimitivesV1ParathreadEntry;
|
||||
readonly coreOffset: u32;
|
||||
}
|
||||
|
||||
/** @name PolkadotPrimitivesV1ParathreadEntry (525) */
|
||||
/** @name PolkadotPrimitivesV1ParathreadEntry (530) */
|
||||
export interface PolkadotPrimitivesV1ParathreadEntry extends Struct {
|
||||
readonly claim: PolkadotPrimitivesV1ParathreadClaim;
|
||||
readonly retries: u32;
|
||||
}
|
||||
|
||||
/** @name PolkadotPrimitivesV1ParathreadClaim (526) */
|
||||
/** @name PolkadotPrimitivesV1ParathreadClaim (531) */
|
||||
export interface PolkadotPrimitivesV1ParathreadClaim extends ITuple<[u32, PolkadotPrimitivesV0CollatorAppPublic]> {}
|
||||
|
||||
/** @name PolkadotPrimitivesV1CoreOccupied (529) */
|
||||
/** @name PolkadotPrimitivesV1CoreOccupied (534) */
|
||||
export interface PolkadotPrimitivesV1CoreOccupied extends Enum {
|
||||
readonly isParathread: boolean;
|
||||
readonly asParathread: PolkadotPrimitivesV1ParathreadEntry;
|
||||
readonly isParachain: boolean;
|
||||
}
|
||||
|
||||
/** @name PolkadotRuntimeParachainsSchedulerCoreAssignment (532) */
|
||||
/** @name PolkadotRuntimeParachainsSchedulerCoreAssignment (537) */
|
||||
export interface PolkadotRuntimeParachainsSchedulerCoreAssignment extends Struct {
|
||||
readonly core: u32;
|
||||
readonly paraId: u32;
|
||||
@@ -364,14 +361,14 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly groupIdx: u32;
|
||||
}
|
||||
|
||||
/** @name PolkadotRuntimeParachainsSchedulerAssignmentKind (533) */
|
||||
/** @name PolkadotRuntimeParachainsSchedulerAssignmentKind (538) */
|
||||
export interface PolkadotRuntimeParachainsSchedulerAssignmentKind extends Enum {
|
||||
readonly isParachain: boolean;
|
||||
readonly isParathread: boolean;
|
||||
readonly asParathread: ITuple<[PolkadotPrimitivesV0CollatorAppPublic, u32]>;
|
||||
}
|
||||
|
||||
/** @name PolkadotRuntimeParachainsParasParaLifecycle (534) */
|
||||
/** @name PolkadotRuntimeParachainsParasParaLifecycle (539) */
|
||||
export interface PolkadotRuntimeParachainsParasParaLifecycle extends Enum {
|
||||
readonly isOnboarding: boolean;
|
||||
readonly isParathread: boolean;
|
||||
@@ -382,50 +379,50 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly isOffboardingParachain: boolean;
|
||||
}
|
||||
|
||||
/** @name PolkadotRuntimeParachainsParasParaPastCodeMeta (536) */
|
||||
/** @name PolkadotRuntimeParachainsParasParaPastCodeMeta (541) */
|
||||
export interface PolkadotRuntimeParachainsParasParaPastCodeMeta extends Struct {
|
||||
readonly upgradeTimes: Vec<PolkadotRuntimeParachainsParasReplacementTimes>;
|
||||
readonly lastPruned: Option<u32>;
|
||||
}
|
||||
|
||||
/** @name PolkadotRuntimeParachainsParasReplacementTimes (538) */
|
||||
/** @name PolkadotRuntimeParachainsParasReplacementTimes (543) */
|
||||
export interface PolkadotRuntimeParachainsParasReplacementTimes extends Struct {
|
||||
readonly expectedAt: u32;
|
||||
readonly activatedAt: u32;
|
||||
}
|
||||
|
||||
/** @name PolkadotPrimitivesV1UpgradeGoAhead (540) */
|
||||
/** @name PolkadotPrimitivesV1UpgradeGoAhead (545) */
|
||||
export interface PolkadotPrimitivesV1UpgradeGoAhead extends Enum {
|
||||
readonly isAbort: boolean;
|
||||
readonly isGoAhead: boolean;
|
||||
}
|
||||
|
||||
/** @name PolkadotPrimitivesV1UpgradeRestriction (541) */
|
||||
/** @name PolkadotPrimitivesV1UpgradeRestriction (546) */
|
||||
export interface PolkadotPrimitivesV1UpgradeRestriction extends Enum {
|
||||
readonly isPresent: boolean;
|
||||
}
|
||||
|
||||
/** @name PolkadotRuntimeParachainsParasParaGenesisArgs (542) */
|
||||
/** @name PolkadotRuntimeParachainsParasParaGenesisArgs (547) */
|
||||
export interface PolkadotRuntimeParachainsParasParaGenesisArgs extends Struct {
|
||||
readonly genesisHead: Bytes;
|
||||
readonly validationCode: Bytes;
|
||||
readonly parachain: bool;
|
||||
}
|
||||
|
||||
/** @name PolkadotRuntimeParachainsInitializerBufferedSessionChange (545) */
|
||||
/** @name PolkadotRuntimeParachainsInitializerBufferedSessionChange (550) */
|
||||
export interface PolkadotRuntimeParachainsInitializerBufferedSessionChange extends Struct {
|
||||
readonly validators: Vec<PolkadotPrimitivesV0ValidatorAppPublic>;
|
||||
readonly queued: Vec<PolkadotPrimitivesV0ValidatorAppPublic>;
|
||||
readonly sessionIndex: u32;
|
||||
}
|
||||
|
||||
/** @name PolkadotCorePrimitivesInboundDownwardMessage (547) */
|
||||
/** @name PolkadotCorePrimitivesInboundDownwardMessage (552) */
|
||||
export interface PolkadotCorePrimitivesInboundDownwardMessage extends Struct {
|
||||
readonly sentAt: u32;
|
||||
readonly msg: Bytes;
|
||||
}
|
||||
|
||||
/** @name PolkadotRuntimeParachainsHrmpHrmpOpenChannelRequest (550) */
|
||||
/** @name PolkadotRuntimeParachainsHrmpHrmpOpenChannelRequest (555) */
|
||||
export interface PolkadotRuntimeParachainsHrmpHrmpOpenChannelRequest extends Struct {
|
||||
readonly confirmed: bool;
|
||||
readonly age: u32;
|
||||
@@ -435,7 +432,7 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly maxTotalSize: u32;
|
||||
}
|
||||
|
||||
/** @name PolkadotRuntimeParachainsHrmpHrmpChannel (552) */
|
||||
/** @name PolkadotRuntimeParachainsHrmpHrmpChannel (557) */
|
||||
export interface PolkadotRuntimeParachainsHrmpHrmpChannel extends Struct {
|
||||
readonly maxCapacity: u32;
|
||||
readonly maxTotalSize: u32;
|
||||
@@ -447,13 +444,13 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly recipientDeposit: u128;
|
||||
}
|
||||
|
||||
/** @name PolkadotCorePrimitivesInboundHrmpMessage (555) */
|
||||
/** @name PolkadotCorePrimitivesInboundHrmpMessage (560) */
|
||||
export interface PolkadotCorePrimitivesInboundHrmpMessage extends Struct {
|
||||
readonly sentAt: u32;
|
||||
readonly data: Bytes;
|
||||
}
|
||||
|
||||
/** @name PolkadotPrimitivesV1SessionInfo (560) */
|
||||
/** @name PolkadotPrimitivesV1SessionInfo (565) */
|
||||
export interface PolkadotPrimitivesV1SessionInfo extends Struct {
|
||||
readonly validators: Vec<PolkadotPrimitivesV0ValidatorAppPublic>;
|
||||
readonly discoveryKeys: Vec<SpAuthorityDiscoveryAppPublic>;
|
||||
@@ -467,14 +464,14 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly neededApprovals: u32;
|
||||
}
|
||||
|
||||
/** @name PolkadotRuntimeCommonParasRegistrarParaInfo (562) */
|
||||
/** @name PolkadotRuntimeCommonParasRegistrarParaInfo (567) */
|
||||
export interface PolkadotRuntimeCommonParasRegistrarParaInfo extends Struct {
|
||||
readonly manager: AccountId32;
|
||||
readonly deposit: u128;
|
||||
readonly locked: bool;
|
||||
}
|
||||
|
||||
/** @name PolkadotRuntimeCommonCrowdloanFundInfo (572) */
|
||||
/** @name PolkadotRuntimeCommonCrowdloanFundInfo (577) */
|
||||
export interface PolkadotRuntimeCommonCrowdloanFundInfo extends Struct {
|
||||
readonly depositor: AccountId32;
|
||||
readonly verifier: Option<SpRuntimeMultiSigner>;
|
||||
@@ -488,7 +485,7 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly trieIndex: u32;
|
||||
}
|
||||
|
||||
/** @name PolkadotRuntimeCommonCrowdloanLastContribution (573) */
|
||||
/** @name PolkadotRuntimeCommonCrowdloanLastContribution (578) */
|
||||
export interface PolkadotRuntimeCommonCrowdloanLastContribution extends Enum {
|
||||
readonly isNever: boolean;
|
||||
readonly isPreEnding: boolean;
|
||||
@@ -497,10 +494,10 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly asEnding: u32;
|
||||
}
|
||||
|
||||
/** @name PolkadotRuntimeCommonClaimsPrevalidateAttests (585) */
|
||||
/** @name PolkadotRuntimeCommonClaimsPrevalidateAttests (590) */
|
||||
export type PolkadotRuntimeCommonClaimsPrevalidateAttests = Null;
|
||||
|
||||
/** @name PolkadotRuntimeRuntime (586) */
|
||||
/** @name PolkadotRuntimeRuntime (591) */
|
||||
export type PolkadotRuntimeRuntime = Null;
|
||||
|
||||
}
|
||||
|
||||
@@ -533,33 +533,33 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly startingBlock: u32;
|
||||
}
|
||||
|
||||
/** @name PalletAssetsDestroyWitness (295) */
|
||||
/** @name PalletAssetsDestroyWitness (296) */
|
||||
export interface PalletAssetsDestroyWitness extends Struct {
|
||||
readonly accounts: Compact<u32>;
|
||||
readonly sufficients: Compact<u32>;
|
||||
readonly approvals: Compact<u32>;
|
||||
}
|
||||
|
||||
/** @name PalletUniquesDestroyWitness (301) */
|
||||
/** @name PalletUniquesDestroyWitness (302) */
|
||||
export interface PalletUniquesDestroyWitness extends Struct {
|
||||
readonly instances: Compact<u32>;
|
||||
readonly instanceMetadatas: Compact<u32>;
|
||||
readonly attributes: Compact<u32>;
|
||||
}
|
||||
|
||||
/** @name SpTransactionStorageProofTransactionStorageProof (304) */
|
||||
/** @name SpTransactionStorageProofTransactionStorageProof (305) */
|
||||
export interface SpTransactionStorageProofTransactionStorageProof extends Struct {
|
||||
readonly chunk: Bytes;
|
||||
readonly proof: Vec<Bytes>;
|
||||
}
|
||||
|
||||
/** @name SpConsensusBabeBabeEpochConfiguration (313) */
|
||||
/** @name SpConsensusBabeBabeEpochConfiguration (314) */
|
||||
export interface SpConsensusBabeBabeEpochConfiguration extends Struct {
|
||||
readonly c: ITuple<[u64, u64]>;
|
||||
readonly allowedSlots: SpConsensusBabeAllowedSlots;
|
||||
}
|
||||
|
||||
/** @name PalletAuthorshipUncleEntryItem (316) */
|
||||
/** @name PalletAuthorshipUncleEntryItem (317) */
|
||||
export interface PalletAuthorshipUncleEntryItem extends Enum {
|
||||
readonly isInclusionHeight: boolean;
|
||||
readonly asInclusionHeight: u32;
|
||||
@@ -567,39 +567,39 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly asUncle: ITuple<[H256, Option<AccountId32>]>;
|
||||
}
|
||||
|
||||
/** @name PalletBalancesBalanceLock (321) */
|
||||
/** @name PalletBalancesBalanceLock (322) */
|
||||
export interface PalletBalancesBalanceLock extends Struct {
|
||||
readonly id: U8aFixed;
|
||||
readonly amount: u128;
|
||||
readonly reasons: PalletBalancesReasons;
|
||||
}
|
||||
|
||||
/** @name PalletBalancesReasons (322) */
|
||||
/** @name PalletBalancesReasons (323) */
|
||||
export interface PalletBalancesReasons extends Enum {
|
||||
readonly isFee: boolean;
|
||||
readonly isMisc: boolean;
|
||||
readonly isAll: boolean;
|
||||
}
|
||||
|
||||
/** @name PalletBalancesReserveData (325) */
|
||||
/** @name PalletBalancesReserveData (326) */
|
||||
export interface PalletBalancesReserveData extends Struct {
|
||||
readonly id: U8aFixed;
|
||||
readonly amount: u128;
|
||||
}
|
||||
|
||||
/** @name PalletBalancesReleases (327) */
|
||||
/** @name PalletBalancesReleases (328) */
|
||||
export interface PalletBalancesReleases extends Enum {
|
||||
readonly isV100: boolean;
|
||||
readonly isV200: boolean;
|
||||
}
|
||||
|
||||
/** @name PalletTransactionPaymentReleases (330) */
|
||||
/** @name PalletTransactionPaymentReleases (331) */
|
||||
export interface PalletTransactionPaymentReleases extends Enum {
|
||||
readonly isV1Ancient: boolean;
|
||||
readonly isV2: boolean;
|
||||
}
|
||||
|
||||
/** @name FrameSupportWeightsWeightToFeeCoefficient (332) */
|
||||
/** @name FrameSupportWeightsWeightToFeeCoefficient (333) */
|
||||
export interface FrameSupportWeightsWeightToFeeCoefficient extends Struct {
|
||||
readonly coeffInteger: u128;
|
||||
readonly coeffFrac: Perbill;
|
||||
@@ -607,7 +607,7 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly degree: u8;
|
||||
}
|
||||
|
||||
/** @name PalletElectionProviderMultiPhasePhase (333) */
|
||||
/** @name PalletElectionProviderMultiPhasePhase (334) */
|
||||
export interface PalletElectionProviderMultiPhasePhase extends Enum {
|
||||
readonly isOff: boolean;
|
||||
readonly isSigned: boolean;
|
||||
@@ -616,20 +616,20 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly isEmergency: boolean;
|
||||
}
|
||||
|
||||
/** @name PalletElectionProviderMultiPhaseReadySolution (335) */
|
||||
/** @name PalletElectionProviderMultiPhaseReadySolution (336) */
|
||||
export interface PalletElectionProviderMultiPhaseReadySolution extends Struct {
|
||||
readonly supports: Vec<ITuple<[AccountId32, SpNposElectionsSupport]>>;
|
||||
readonly score: Vec<u128>;
|
||||
readonly compute: PalletElectionProviderMultiPhaseElectionCompute;
|
||||
}
|
||||
|
||||
/** @name PalletElectionProviderMultiPhaseRoundSnapshot (336) */
|
||||
/** @name PalletElectionProviderMultiPhaseRoundSnapshot (337) */
|
||||
export interface PalletElectionProviderMultiPhaseRoundSnapshot extends Struct {
|
||||
readonly voters: Vec<ITuple<[AccountId32, u64, Vec<AccountId32>]>>;
|
||||
readonly targets: Vec<AccountId32>;
|
||||
}
|
||||
|
||||
/** @name PalletElectionProviderMultiPhaseSignedSignedSubmission (343) */
|
||||
/** @name PalletElectionProviderMultiPhaseSignedSignedSubmission (344) */
|
||||
export interface PalletElectionProviderMultiPhaseSignedSignedSubmission extends Struct {
|
||||
readonly who: AccountId32;
|
||||
readonly deposit: u128;
|
||||
@@ -637,7 +637,7 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly reward: u128;
|
||||
}
|
||||
|
||||
/** @name PalletStakingStakingLedger (345) */
|
||||
/** @name PalletStakingStakingLedger (346) */
|
||||
export interface PalletStakingStakingLedger extends Struct {
|
||||
readonly stash: AccountId32;
|
||||
readonly total: Compact<u128>;
|
||||
@@ -646,32 +646,32 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly claimedRewards: Vec<u32>;
|
||||
}
|
||||
|
||||
/** @name PalletStakingUnlockChunk (347) */
|
||||
/** @name PalletStakingUnlockChunk (348) */
|
||||
export interface PalletStakingUnlockChunk extends Struct {
|
||||
readonly value: Compact<u128>;
|
||||
readonly era: Compact<u32>;
|
||||
}
|
||||
|
||||
/** @name PalletStakingNominations (348) */
|
||||
/** @name PalletStakingNominations (349) */
|
||||
export interface PalletStakingNominations extends Struct {
|
||||
readonly targets: Vec<AccountId32>;
|
||||
readonly submittedIn: u32;
|
||||
readonly suppressed: bool;
|
||||
}
|
||||
|
||||
/** @name PalletStakingActiveEraInfo (349) */
|
||||
/** @name PalletStakingActiveEraInfo (350) */
|
||||
export interface PalletStakingActiveEraInfo extends Struct {
|
||||
readonly index: u32;
|
||||
readonly start: Option<u64>;
|
||||
}
|
||||
|
||||
/** @name PalletStakingEraRewardPoints (351) */
|
||||
/** @name PalletStakingEraRewardPoints (352) */
|
||||
export interface PalletStakingEraRewardPoints extends Struct {
|
||||
readonly total: u32;
|
||||
readonly individual: BTreeMap<AccountId32, u32>;
|
||||
}
|
||||
|
||||
/** @name PalletStakingForcing (355) */
|
||||
/** @name PalletStakingForcing (356) */
|
||||
export interface PalletStakingForcing extends Enum {
|
||||
readonly isNotForcing: boolean;
|
||||
readonly isForceNew: boolean;
|
||||
@@ -679,7 +679,7 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly isForceAlways: boolean;
|
||||
}
|
||||
|
||||
/** @name PalletStakingUnappliedSlash (357) */
|
||||
/** @name PalletStakingUnappliedSlash (358) */
|
||||
export interface PalletStakingUnappliedSlash extends Struct {
|
||||
readonly validator: AccountId32;
|
||||
readonly own: u128;
|
||||
@@ -688,7 +688,7 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly payout: u128;
|
||||
}
|
||||
|
||||
/** @name PalletStakingSlashingSlashingSpans (359) */
|
||||
/** @name PalletStakingSlashingSlashingSpans (360) */
|
||||
export interface PalletStakingSlashingSlashingSpans extends Struct {
|
||||
readonly spanIndex: u32;
|
||||
readonly lastStart: u32;
|
||||
@@ -696,13 +696,13 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly prior: Vec<u32>;
|
||||
}
|
||||
|
||||
/** @name PalletStakingSlashingSpanRecord (360) */
|
||||
/** @name PalletStakingSlashingSpanRecord (361) */
|
||||
export interface PalletStakingSlashingSpanRecord extends Struct {
|
||||
readonly slashed: u128;
|
||||
readonly paidOut: u128;
|
||||
}
|
||||
|
||||
/** @name PalletStakingReleases (363) */
|
||||
/** @name PalletStakingReleases (364) */
|
||||
export interface PalletStakingReleases extends Enum {
|
||||
readonly isV100Ancient: boolean;
|
||||
readonly isV200: boolean;
|
||||
@@ -714,10 +714,10 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly isV800: boolean;
|
||||
}
|
||||
|
||||
/** @name SpCoreCryptoKeyTypeId (368) */
|
||||
/** @name SpCoreCryptoKeyTypeId (369) */
|
||||
export interface SpCoreCryptoKeyTypeId extends U8aFixed {}
|
||||
|
||||
/** @name PalletDemocracyPreimageStatus (373) */
|
||||
/** @name PalletDemocracyPreimageStatus (374) */
|
||||
export interface PalletDemocracyPreimageStatus extends Enum {
|
||||
readonly isMissing: boolean;
|
||||
readonly asMissing: u32;
|
||||
@@ -731,7 +731,7 @@ declare module '@polkadot/types/lookup' {
|
||||
} & Struct;
|
||||
}
|
||||
|
||||
/** @name PalletDemocracyReferendumInfo (374) */
|
||||
/** @name PalletDemocracyReferendumInfo (375) */
|
||||
export interface PalletDemocracyReferendumInfo extends Enum {
|
||||
readonly isOngoing: boolean;
|
||||
readonly asOngoing: PalletDemocracyReferendumStatus;
|
||||
@@ -742,7 +742,7 @@ declare module '@polkadot/types/lookup' {
|
||||
} & Struct;
|
||||
}
|
||||
|
||||
/** @name PalletDemocracyReferendumStatus (375) */
|
||||
/** @name PalletDemocracyReferendumStatus (376) */
|
||||
export interface PalletDemocracyReferendumStatus extends Struct {
|
||||
readonly end: u32;
|
||||
readonly proposalHash: H256;
|
||||
@@ -751,14 +751,14 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly tally: PalletDemocracyTally;
|
||||
}
|
||||
|
||||
/** @name PalletDemocracyTally (376) */
|
||||
/** @name PalletDemocracyTally (377) */
|
||||
export interface PalletDemocracyTally extends Struct {
|
||||
readonly ayes: u128;
|
||||
readonly nays: u128;
|
||||
readonly turnout: u128;
|
||||
}
|
||||
|
||||
/** @name PalletDemocracyVoteVoting (377) */
|
||||
/** @name PalletDemocracyVoteVoting (378) */
|
||||
export interface PalletDemocracyVoteVoting extends Enum {
|
||||
readonly isDirect: boolean;
|
||||
readonly asDirect: {
|
||||
@@ -776,21 +776,21 @@ declare module '@polkadot/types/lookup' {
|
||||
} & Struct;
|
||||
}
|
||||
|
||||
/** @name PalletDemocracyDelegations (380) */
|
||||
/** @name PalletDemocracyDelegations (381) */
|
||||
export interface PalletDemocracyDelegations extends Struct {
|
||||
readonly votes: u128;
|
||||
readonly capital: u128;
|
||||
}
|
||||
|
||||
/** @name PalletDemocracyVotePriorLock (381) */
|
||||
/** @name PalletDemocracyVotePriorLock (382) */
|
||||
export interface PalletDemocracyVotePriorLock extends ITuple<[u32, u128]> {}
|
||||
|
||||
/** @name PalletDemocracyReleases (384) */
|
||||
/** @name PalletDemocracyReleases (385) */
|
||||
export interface PalletDemocracyReleases extends Enum {
|
||||
readonly isV1: boolean;
|
||||
}
|
||||
|
||||
/** @name PalletCollectiveVotes (387) */
|
||||
/** @name PalletCollectiveVotes (388) */
|
||||
export interface PalletCollectiveVotes extends Struct {
|
||||
readonly index: u32;
|
||||
readonly threshold: u32;
|
||||
@@ -799,21 +799,21 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly end: u32;
|
||||
}
|
||||
|
||||
/** @name PalletElectionsPhragmenSeatHolder (392) */
|
||||
/** @name PalletElectionsPhragmenSeatHolder (393) */
|
||||
export interface PalletElectionsPhragmenSeatHolder extends Struct {
|
||||
readonly who: AccountId32;
|
||||
readonly stake: u128;
|
||||
readonly deposit: u128;
|
||||
}
|
||||
|
||||
/** @name PalletElectionsPhragmenVoter (393) */
|
||||
/** @name PalletElectionsPhragmenVoter (394) */
|
||||
export interface PalletElectionsPhragmenVoter extends Struct {
|
||||
readonly votes: Vec<AccountId32>;
|
||||
readonly stake: u128;
|
||||
readonly deposit: u128;
|
||||
}
|
||||
|
||||
/** @name PalletGrandpaStoredState (396) */
|
||||
/** @name PalletGrandpaStoredState (397) */
|
||||
export interface PalletGrandpaStoredState extends Enum {
|
||||
readonly isLive: boolean;
|
||||
readonly isPendingPause: boolean;
|
||||
@@ -829,7 +829,7 @@ declare module '@polkadot/types/lookup' {
|
||||
} & Struct;
|
||||
}
|
||||
|
||||
/** @name PalletGrandpaStoredPendingChange (397) */
|
||||
/** @name PalletGrandpaStoredPendingChange (398) */
|
||||
export interface PalletGrandpaStoredPendingChange extends Struct {
|
||||
readonly scheduledAt: u32;
|
||||
readonly delay: u32;
|
||||
@@ -837,7 +837,7 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly forced: Option<u32>;
|
||||
}
|
||||
|
||||
/** @name PalletTreasuryProposal (400) */
|
||||
/** @name PalletTreasuryProposal (401) */
|
||||
export interface PalletTreasuryProposal extends Struct {
|
||||
readonly proposer: AccountId32;
|
||||
readonly value: u128;
|
||||
@@ -845,10 +845,10 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly bond: u128;
|
||||
}
|
||||
|
||||
/** @name FrameSupportPalletId (403) */
|
||||
/** @name FrameSupportPalletId (404) */
|
||||
export interface FrameSupportPalletId extends U8aFixed {}
|
||||
|
||||
/** @name PalletContractsWasmPrefabWasmModule (405) */
|
||||
/** @name PalletContractsWasmPrefabWasmModule (406) */
|
||||
export interface PalletContractsWasmPrefabWasmModule extends Struct {
|
||||
readonly instructionWeightsVersion: Compact<u32>;
|
||||
readonly initial: Compact<u32>;
|
||||
@@ -859,26 +859,26 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly originalCodeLen: u32;
|
||||
}
|
||||
|
||||
/** @name PalletContractsStorageRawContractInfo (407) */
|
||||
/** @name PalletContractsStorageRawContractInfo (408) */
|
||||
export interface PalletContractsStorageRawContractInfo extends Struct {
|
||||
readonly trieId: Bytes;
|
||||
readonly codeHash: H256;
|
||||
readonly reserved: Option<Null>;
|
||||
}
|
||||
|
||||
/** @name PalletContractsStorageDeletedContract (409) */
|
||||
/** @name PalletContractsStorageDeletedContract (410) */
|
||||
export interface PalletContractsStorageDeletedContract extends Struct {
|
||||
readonly trieId: Bytes;
|
||||
}
|
||||
|
||||
/** @name PalletContractsSchedule (410) */
|
||||
/** @name PalletContractsSchedule (411) */
|
||||
export interface PalletContractsSchedule extends Struct {
|
||||
readonly limits: PalletContractsScheduleLimits;
|
||||
readonly instructionWeights: PalletContractsScheduleInstructionWeights;
|
||||
readonly hostFnWeights: PalletContractsScheduleHostFnWeights;
|
||||
}
|
||||
|
||||
/** @name PalletContractsScheduleLimits (411) */
|
||||
/** @name PalletContractsScheduleLimits (412) */
|
||||
export interface PalletContractsScheduleLimits extends Struct {
|
||||
readonly eventTopics: u32;
|
||||
readonly stackHeight: u32;
|
||||
@@ -893,7 +893,7 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly codeLen: u32;
|
||||
}
|
||||
|
||||
/** @name PalletContractsScheduleInstructionWeights (412) */
|
||||
/** @name PalletContractsScheduleInstructionWeights (413) */
|
||||
export interface PalletContractsScheduleInstructionWeights extends Struct {
|
||||
readonly version: u32;
|
||||
readonly i64Const: u32;
|
||||
@@ -949,7 +949,7 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly i64Rotr: u32;
|
||||
}
|
||||
|
||||
/** @name PalletContractsScheduleHostFnWeights (413) */
|
||||
/** @name PalletContractsScheduleHostFnWeights (414) */
|
||||
export interface PalletContractsScheduleHostFnWeights extends Struct {
|
||||
readonly caller: u64;
|
||||
readonly address: u64;
|
||||
@@ -997,40 +997,40 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly ecdsaRecover: u64;
|
||||
}
|
||||
|
||||
/** @name PalletImOnlineBoundedOpaqueNetworkState (419) */
|
||||
/** @name PalletImOnlineBoundedOpaqueNetworkState (420) */
|
||||
export interface PalletImOnlineBoundedOpaqueNetworkState extends Struct {
|
||||
readonly peerId: Bytes;
|
||||
readonly externalAddresses: Vec<Bytes>;
|
||||
}
|
||||
|
||||
/** @name SpStakingOffenceOffenceDetails (424) */
|
||||
/** @name SpStakingOffenceOffenceDetails (425) */
|
||||
export interface SpStakingOffenceOffenceDetails extends Struct {
|
||||
readonly offender: ITuple<[AccountId32, PalletStakingExposure]>;
|
||||
readonly reporters: Vec<AccountId32>;
|
||||
}
|
||||
|
||||
/** @name PalletIdentityRegistration (426) */
|
||||
/** @name PalletIdentityRegistration (427) */
|
||||
export interface PalletIdentityRegistration extends Struct {
|
||||
readonly judgements: Vec<ITuple<[u32, PalletIdentityJudgement]>>;
|
||||
readonly deposit: u128;
|
||||
readonly info: PalletIdentityIdentityInfo;
|
||||
}
|
||||
|
||||
/** @name PalletIdentityRegistrarInfo (434) */
|
||||
/** @name PalletIdentityRegistrarInfo (435) */
|
||||
export interface PalletIdentityRegistrarInfo extends Struct {
|
||||
readonly account: AccountId32;
|
||||
readonly fee: u128;
|
||||
readonly fields: PalletIdentityBitFlags;
|
||||
}
|
||||
|
||||
/** @name PalletSocietyBid (438) */
|
||||
/** @name PalletSocietyBid (439) */
|
||||
export interface PalletSocietyBid extends Struct {
|
||||
readonly who: AccountId32;
|
||||
readonly kind: PalletSocietyBidKind;
|
||||
readonly value: u128;
|
||||
}
|
||||
|
||||
/** @name PalletSocietyBidKind (439) */
|
||||
/** @name PalletSocietyBidKind (440) */
|
||||
export interface PalletSocietyBidKind extends Enum {
|
||||
readonly isDeposit: boolean;
|
||||
readonly asDeposit: u128;
|
||||
@@ -1038,20 +1038,20 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly asVouch: ITuple<[AccountId32, u128]>;
|
||||
}
|
||||
|
||||
/** @name PalletSocietyVouchingStatus (441) */
|
||||
/** @name PalletSocietyVouchingStatus (442) */
|
||||
export interface PalletSocietyVouchingStatus extends Enum {
|
||||
readonly isVouching: boolean;
|
||||
readonly isBanned: boolean;
|
||||
}
|
||||
|
||||
/** @name PalletSocietyVote (445) */
|
||||
/** @name PalletSocietyVote (446) */
|
||||
export interface PalletSocietyVote extends Enum {
|
||||
readonly isSkeptic: boolean;
|
||||
readonly isReject: boolean;
|
||||
readonly isApprove: boolean;
|
||||
}
|
||||
|
||||
/** @name PalletRecoveryRecoveryConfig (447) */
|
||||
/** @name PalletRecoveryRecoveryConfig (448) */
|
||||
export interface PalletRecoveryRecoveryConfig extends Struct {
|
||||
readonly delayPeriod: u32;
|
||||
readonly deposit: u128;
|
||||
@@ -1059,20 +1059,20 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly threshold: u16;
|
||||
}
|
||||
|
||||
/** @name PalletRecoveryActiveRecovery (448) */
|
||||
/** @name PalletRecoveryActiveRecovery (449) */
|
||||
export interface PalletRecoveryActiveRecovery extends Struct {
|
||||
readonly created: u32;
|
||||
readonly deposit: u128;
|
||||
readonly friends: Vec<AccountId32>;
|
||||
}
|
||||
|
||||
/** @name PalletVestingReleases (452) */
|
||||
/** @name PalletVestingReleases (453) */
|
||||
export interface PalletVestingReleases extends Enum {
|
||||
readonly isV0: boolean;
|
||||
readonly isV1: boolean;
|
||||
}
|
||||
|
||||
/** @name PalletSchedulerScheduledV2 (456) */
|
||||
/** @name PalletSchedulerScheduledV2 (457) */
|
||||
export interface PalletSchedulerScheduledV2 extends Struct {
|
||||
readonly maybeId: Option<Bytes>;
|
||||
readonly priority: u8;
|
||||
@@ -1081,7 +1081,7 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly origin: NodeRuntimeOriginCaller;
|
||||
}
|
||||
|
||||
/** @name NodeRuntimeOriginCaller (457) */
|
||||
/** @name NodeRuntimeOriginCaller (458) */
|
||||
export interface NodeRuntimeOriginCaller extends Enum {
|
||||
readonly isSystem: boolean;
|
||||
readonly asSystem: FrameSystemRawOrigin;
|
||||
@@ -1092,7 +1092,7 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly asTechnicalCommittee: PalletCollectiveRawOrigin;
|
||||
}
|
||||
|
||||
/** @name FrameSystemRawOrigin (458) */
|
||||
/** @name FrameSystemRawOrigin (459) */
|
||||
export interface FrameSystemRawOrigin extends Enum {
|
||||
readonly isRoot: boolean;
|
||||
readonly isSigned: boolean;
|
||||
@@ -1100,7 +1100,7 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly isNone: boolean;
|
||||
}
|
||||
|
||||
/** @name PalletCollectiveRawOrigin (459) */
|
||||
/** @name PalletCollectiveRawOrigin (460) */
|
||||
export interface PalletCollectiveRawOrigin extends Enum {
|
||||
readonly isMembers: boolean;
|
||||
readonly asMembers: ITuple<[u32, u32]>;
|
||||
@@ -1109,30 +1109,30 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly isPhantom: boolean;
|
||||
}
|
||||
|
||||
/** @name SpCoreVoid (461) */
|
||||
/** @name SpCoreVoid (462) */
|
||||
export type SpCoreVoid = Null;
|
||||
|
||||
/** @name PalletSchedulerReleases (462) */
|
||||
/** @name PalletSchedulerReleases (463) */
|
||||
export interface PalletSchedulerReleases extends Enum {
|
||||
readonly isV1: boolean;
|
||||
readonly isV2: boolean;
|
||||
}
|
||||
|
||||
/** @name PalletProxyProxyDefinition (466) */
|
||||
/** @name PalletProxyProxyDefinition (467) */
|
||||
export interface PalletProxyProxyDefinition extends Struct {
|
||||
readonly delegate: AccountId32;
|
||||
readonly proxyType: NodeRuntimeProxyType;
|
||||
readonly delay: u32;
|
||||
}
|
||||
|
||||
/** @name PalletProxyAnnouncement (470) */
|
||||
/** @name PalletProxyAnnouncement (471) */
|
||||
export interface PalletProxyAnnouncement extends Struct {
|
||||
readonly real: AccountId32;
|
||||
readonly callHash: H256;
|
||||
readonly height: u32;
|
||||
}
|
||||
|
||||
/** @name PalletMultisigMultisig (474) */
|
||||
/** @name PalletMultisigMultisig (475) */
|
||||
export interface PalletMultisigMultisig extends Struct {
|
||||
readonly when: PalletMultisigTimepoint;
|
||||
readonly deposit: u128;
|
||||
@@ -1140,7 +1140,7 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly approvals: Vec<AccountId32>;
|
||||
}
|
||||
|
||||
/** @name PalletBountiesBounty (477) */
|
||||
/** @name PalletBountiesBounty (478) */
|
||||
export interface PalletBountiesBounty extends Struct {
|
||||
readonly proposer: AccountId32;
|
||||
readonly value: u128;
|
||||
@@ -1150,7 +1150,7 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly status: PalletBountiesBountyStatus;
|
||||
}
|
||||
|
||||
/** @name PalletBountiesBountyStatus (478) */
|
||||
/** @name PalletBountiesBountyStatus (479) */
|
||||
export interface PalletBountiesBountyStatus extends Enum {
|
||||
readonly isProposed: boolean;
|
||||
readonly isApproved: boolean;
|
||||
@@ -1172,7 +1172,7 @@ declare module '@polkadot/types/lookup' {
|
||||
} & Struct;
|
||||
}
|
||||
|
||||
/** @name PalletTipsOpenTip (480) */
|
||||
/** @name PalletTipsOpenTip (481) */
|
||||
export interface PalletTipsOpenTip extends Struct {
|
||||
readonly reason: H256;
|
||||
readonly who: AccountId32;
|
||||
@@ -1183,7 +1183,7 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly findersFee: bool;
|
||||
}
|
||||
|
||||
/** @name PalletAssetsAssetDetails (482) */
|
||||
/** @name PalletAssetsAssetDetails (483) */
|
||||
export interface PalletAssetsAssetDetails extends Struct {
|
||||
readonly owner: AccountId32;
|
||||
readonly issuer: AccountId32;
|
||||
@@ -1199,7 +1199,7 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly isFrozen: bool;
|
||||
}
|
||||
|
||||
/** @name PalletAssetsAssetBalance (483) */
|
||||
/** @name PalletAssetsAssetBalance (484) */
|
||||
export interface PalletAssetsAssetBalance extends Struct {
|
||||
readonly balance: u64;
|
||||
readonly isFrozen: bool;
|
||||
@@ -1207,13 +1207,13 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly extra: Null;
|
||||
}
|
||||
|
||||
/** @name PalletAssetsApproval (485) */
|
||||
/** @name PalletAssetsApproval (486) */
|
||||
export interface PalletAssetsApproval extends Struct {
|
||||
readonly amount: u64;
|
||||
readonly deposit: u128;
|
||||
}
|
||||
|
||||
/** @name PalletAssetsAssetMetadata (486) */
|
||||
/** @name PalletAssetsAssetMetadata (487) */
|
||||
export interface PalletAssetsAssetMetadata extends Struct {
|
||||
readonly deposit: u128;
|
||||
readonly name: Bytes;
|
||||
@@ -1222,7 +1222,7 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly isFrozen: bool;
|
||||
}
|
||||
|
||||
/** @name PalletLotteryLotteryConfig (488) */
|
||||
/** @name PalletLotteryLotteryConfig (489) */
|
||||
export interface PalletLotteryLotteryConfig extends Struct {
|
||||
readonly price: u128;
|
||||
readonly start: u32;
|
||||
@@ -1231,13 +1231,13 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly repeat: bool;
|
||||
}
|
||||
|
||||
/** @name PalletGiltGiltBid (493) */
|
||||
/** @name PalletGiltGiltBid (494) */
|
||||
export interface PalletGiltGiltBid extends Struct {
|
||||
readonly amount: u128;
|
||||
readonly who: AccountId32;
|
||||
}
|
||||
|
||||
/** @name PalletGiltActiveGiltsTotal (494) */
|
||||
/** @name PalletGiltActiveGiltsTotal (495) */
|
||||
export interface PalletGiltActiveGiltsTotal extends Struct {
|
||||
readonly frozen: u128;
|
||||
readonly proportion: Perquintill;
|
||||
@@ -1245,7 +1245,7 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly target: Perquintill;
|
||||
}
|
||||
|
||||
/** @name PalletGiltActiveGilt (495) */
|
||||
/** @name PalletGiltActiveGilt (496) */
|
||||
export interface PalletGiltActiveGilt extends Struct {
|
||||
readonly proportion: Perquintill;
|
||||
readonly amount: u128;
|
||||
@@ -1253,7 +1253,7 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly expiry: u32;
|
||||
}
|
||||
|
||||
/** @name PalletUniquesClassDetails (497) */
|
||||
/** @name PalletUniquesClassDetails (498) */
|
||||
export interface PalletUniquesClassDetails extends Struct {
|
||||
readonly owner: AccountId32;
|
||||
readonly issuer: AccountId32;
|
||||
@@ -1267,7 +1267,7 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly isFrozen: bool;
|
||||
}
|
||||
|
||||
/** @name PalletUniquesInstanceDetails (499) */
|
||||
/** @name PalletUniquesInstanceDetails (500) */
|
||||
export interface PalletUniquesInstanceDetails extends Struct {
|
||||
readonly owner: AccountId32;
|
||||
readonly approved: Option<AccountId32>;
|
||||
@@ -1275,21 +1275,21 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly deposit: u128;
|
||||
}
|
||||
|
||||
/** @name PalletUniquesClassMetadata (500) */
|
||||
/** @name PalletUniquesClassMetadata (501) */
|
||||
export interface PalletUniquesClassMetadata extends Struct {
|
||||
readonly deposit: u128;
|
||||
readonly data: Bytes;
|
||||
readonly isFrozen: bool;
|
||||
}
|
||||
|
||||
/** @name PalletUniquesInstanceMetadata (501) */
|
||||
/** @name PalletUniquesInstanceMetadata (502) */
|
||||
export interface PalletUniquesInstanceMetadata extends Struct {
|
||||
readonly deposit: u128;
|
||||
readonly data: Bytes;
|
||||
readonly isFrozen: bool;
|
||||
}
|
||||
|
||||
/** @name PalletTransactionStorageTransactionInfo (506) */
|
||||
/** @name PalletTransactionStorageTransactionInfo (507) */
|
||||
export interface PalletTransactionStorageTransactionInfo extends Struct {
|
||||
readonly chunkRoot: H256;
|
||||
readonly contentHash: H256;
|
||||
@@ -1297,7 +1297,7 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly blockChunks: u32;
|
||||
}
|
||||
|
||||
/** @name PalletBagsListListNode (508) */
|
||||
/** @name PalletBagsListListNode (509) */
|
||||
export interface PalletBagsListListNode extends Struct {
|
||||
readonly id: AccountId32;
|
||||
readonly prev: Option<AccountId32>;
|
||||
@@ -1305,13 +1305,13 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly bagUpper: u64;
|
||||
}
|
||||
|
||||
/** @name PalletBagsListListBag (509) */
|
||||
/** @name PalletBagsListListBag (510) */
|
||||
export interface PalletBagsListListBag extends Struct {
|
||||
readonly head: Option<AccountId32>;
|
||||
readonly tail: Option<AccountId32>;
|
||||
}
|
||||
|
||||
/** @name SpRuntimeMultiSignature (512) */
|
||||
/** @name SpRuntimeMultiSignature (513) */
|
||||
export interface SpRuntimeMultiSignature extends Enum {
|
||||
readonly isEd25519: boolean;
|
||||
readonly asEd25519: SpCoreEd25519Signature;
|
||||
@@ -1321,28 +1321,28 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly asEcdsa: SpCoreEcdsaSignature;
|
||||
}
|
||||
|
||||
/** @name SpCoreEcdsaSignature (513) */
|
||||
/** @name SpCoreEcdsaSignature (514) */
|
||||
export interface SpCoreEcdsaSignature extends U8aFixed {}
|
||||
|
||||
/** @name FrameSystemExtensionsCheckSpecVersion (516) */
|
||||
/** @name FrameSystemExtensionsCheckSpecVersion (517) */
|
||||
export type FrameSystemExtensionsCheckSpecVersion = Null;
|
||||
|
||||
/** @name FrameSystemExtensionsCheckTxVersion (517) */
|
||||
/** @name FrameSystemExtensionsCheckTxVersion (518) */
|
||||
export type FrameSystemExtensionsCheckTxVersion = Null;
|
||||
|
||||
/** @name FrameSystemExtensionsCheckGenesis (518) */
|
||||
/** @name FrameSystemExtensionsCheckGenesis (519) */
|
||||
export type FrameSystemExtensionsCheckGenesis = Null;
|
||||
|
||||
/** @name FrameSystemExtensionsCheckNonce (521) */
|
||||
/** @name FrameSystemExtensionsCheckNonce (522) */
|
||||
export interface FrameSystemExtensionsCheckNonce extends Compact<u32> {}
|
||||
|
||||
/** @name FrameSystemExtensionsCheckWeight (522) */
|
||||
/** @name FrameSystemExtensionsCheckWeight (523) */
|
||||
export type FrameSystemExtensionsCheckWeight = Null;
|
||||
|
||||
/** @name PalletTransactionPaymentChargeTransactionPayment (523) */
|
||||
/** @name PalletTransactionPaymentChargeTransactionPayment (524) */
|
||||
export interface PalletTransactionPaymentChargeTransactionPayment extends Compact<u128> {}
|
||||
|
||||
/** @name NodeRuntimeRuntime (524) */
|
||||
/** @name NodeRuntimeRuntime (525) */
|
||||
export type NodeRuntimeRuntime = Null;
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import type { BeefyCommitment, BeefyId, BeefyNextAuthoritySet, BeefyPayload, Bee
|
||||
import type { BridgeMessageId, 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';
|
||||
import type { StatementKind } from '@polkadot/types/interfaces/claims';
|
||||
import type { CollectiveOrigin, MemberCount, ProposalIndex, Votes, VotesTo230 } from '@polkadot/types/interfaces/collective';
|
||||
import type { AuthorityId, RawVRFOutput } from '@polkadot/types/interfaces/consensus';
|
||||
import type { AliveContractInfo, CodeHash, ContractCallRequest, ContractExecResult, ContractExecResultErr, ContractExecResultErrModule, ContractExecResultOk, ContractExecResultResult, ContractExecResultSuccessTo255, ContractExecResultSuccessTo260, ContractExecResultTo255, ContractExecResultTo260, ContractExecResultTo267, ContractInfo, ContractInstantiateResult, ContractInstantiateResultTo267, ContractStorageKey, DeletedContract, ExecReturnValue, Gas, HostFnWeights, HostFnWeightsTo264, InstantiateRequest, InstantiateReturnValue, InstantiateReturnValueTo267, InstructionWeights, Limits, LimitsTo264, PrefabWasmModule, RentProjection, Schedule, ScheduleTo212, ScheduleTo258, ScheduleTo264, SeedOf, TombstoneContractInfo, TrieId } from '@polkadot/types/interfaces/contracts';
|
||||
@@ -23,7 +23,7 @@ import type { ConfigData, MessageId, OverweightIndex, PageCounter, PageIndexData
|
||||
import type { AccountVote, AccountVoteSplit, AccountVoteStandard, Conviction, Delegations, PreimageStatus, PreimageStatusAvailable, PriorLock, PropIndex, Proposal, ProxyState, ReferendumIndex, ReferendumInfo, ReferendumInfoFinished, ReferendumInfoTo239, ReferendumStatus, Tally, Voting, VotingDelegating, VotingDirect, VotingDirectVote } from '@polkadot/types/interfaces/democracy';
|
||||
import type { ApprovalFlag, DefunctVoter, Renouncing, SetIndex, Vote, VoteIndex, VoteThreshold, VoterInfo } from '@polkadot/types/interfaces/elections';
|
||||
import type { CreatedBlock, ImportedAux } from '@polkadot/types/interfaces/engine';
|
||||
import type { BlockV0, BlockV1, BlockV2, EIP1559Transaction, EIP2930Transaction, EthAccessList, EthAccessListItem, EthAccount, EthAddress, 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, LegacyTransaction, TransactionV0, TransactionV1, TransactionV2 } from '@polkadot/types/interfaces/eth';
|
||||
import type { BlockV0, BlockV1, BlockV2, EIP1559Transaction, EIP2930Transaction, EthAccessList, EthAccessListItem, EthAccount, EthAddress, 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, EthereumAddress, EthereumLookupSource, EthereumSignature, LegacyTransaction, TransactionV0, TransactionV1, TransactionV2 } 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, 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';
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { CodecHash, Hash } from '../interfaces/runtime';
|
||||
import type { AnyJson, Codec, IVec, Registry } from '../types';
|
||||
|
||||
@@ -20,21 +21,40 @@ export abstract class AbstractArray<T extends Codec> extends Array<T> implements
|
||||
|
||||
public createdAtHash?: Hash;
|
||||
|
||||
protected constructor (registry: Registry, values: T[]) {
|
||||
readonly #initialU8aLength?: number;
|
||||
|
||||
protected constructor (registry: Registry, values: T[], initialU8aLength?: number) {
|
||||
super(values.length);
|
||||
|
||||
// explicitly set the values here - this removes the need for any extra allocations
|
||||
for (let i = 0; i < values.length; i++) {
|
||||
this[i] = values[i];
|
||||
}
|
||||
|
||||
this.registry = registry;
|
||||
this.#initialU8aLength = initialU8aLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The length of the value when encoded as a Uint8Array
|
||||
*/
|
||||
public get encodedLength (): number {
|
||||
return this.reduce((total, entry) => total + entry.encodedLength, compactToU8a(this.length).length);
|
||||
// We need to loop through all entries since they may have a variable length themselves,
|
||||
// e.g. when a Vec or Compact is contained withing, it has a variable length based on data
|
||||
let total = compactToU8a(this.length).length;
|
||||
|
||||
for (let i = 0; i < this.length; i++) {
|
||||
total += this[i].encodedLength;
|
||||
}
|
||||
|
||||
return total;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The length of the initial encoded value (Only available when constructed from a Uint8Array)
|
||||
*/
|
||||
public get initialU8aLength (): number | undefined {
|
||||
return this.#initialU8aLength;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -76,7 +96,7 @@ export abstract class AbstractArray<T extends Codec> extends Array<T> implements
|
||||
/**
|
||||
* @description Returns a hex string representation of the value
|
||||
*/
|
||||
public toHex (): string {
|
||||
public toHex (): HexString {
|
||||
return u8aToHex(this.toU8a());
|
||||
}
|
||||
|
||||
@@ -84,18 +104,26 @@ export abstract class AbstractArray<T extends Codec> extends Array<T> implements
|
||||
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
|
||||
*/
|
||||
public toHuman (isExtended?: boolean): AnyJson {
|
||||
return this.map((entry): AnyJson =>
|
||||
entry.toHuman(isExtended)
|
||||
);
|
||||
const result = new Array<AnyJson>(this.length);
|
||||
|
||||
for (let i = 0; i < this.length; i++) {
|
||||
result[i] = this[i].toHuman(isExtended);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Converts the Object to JSON, typically used for RPC transfers
|
||||
*/
|
||||
public toJSON (): AnyJson {
|
||||
return this.map((entry): AnyJson =>
|
||||
entry.toJSON()
|
||||
);
|
||||
const result = new Array<AnyJson>(this.length);
|
||||
|
||||
for (let i = 0; i < this.length; i++) {
|
||||
result[i] = this[i].toJSON();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -107,12 +135,13 @@ export abstract class AbstractArray<T extends Codec> extends Array<T> implements
|
||||
* @description Returns the string representation of the value
|
||||
*/
|
||||
public override toString (): string {
|
||||
// Overwrite the default toString representation of Array.
|
||||
const data = this.map((entry): string =>
|
||||
entry.toString()
|
||||
);
|
||||
const result = new Array<string>(this.length);
|
||||
|
||||
return `[${data.join(', ')}]`;
|
||||
for (let i = 0; i < this.length; i++) {
|
||||
result[i] = this[i].toString();
|
||||
}
|
||||
|
||||
return `[${result.join(', ')}]`;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -120,9 +149,11 @@ export abstract class AbstractArray<T extends Codec> extends Array<T> implements
|
||||
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
||||
*/
|
||||
public toU8a (isBare?: boolean): Uint8Array {
|
||||
const encoded = this.map((entry): Uint8Array =>
|
||||
entry.toU8a(isBare)
|
||||
);
|
||||
const encoded = new Array<Uint8Array>(this.length);
|
||||
|
||||
for (let i = 0; i < this.length; i++) {
|
||||
encoded[i] = this[i].toU8a(isBare);
|
||||
}
|
||||
|
||||
return isBare
|
||||
? u8aConcat(...encoded)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { CodecHash, Hash } from '../interfaces/runtime';
|
||||
import type { AnyNumber, INumber, Registry } from '../types';
|
||||
import type { UIntBitLength } from './types';
|
||||
@@ -67,6 +68,8 @@ export abstract class AbstractInt extends BN implements INumber {
|
||||
|
||||
readonly #bitLength: UIntBitLength;
|
||||
|
||||
readonly #byteLength: number;
|
||||
|
||||
readonly #isSigned: boolean;
|
||||
|
||||
constructor (registry: Registry, value: AnyNumber = 0, bitLength: UIntBitLength = DEFAULT_UINT_BITS, isSigned = false) {
|
||||
@@ -74,6 +77,7 @@ export abstract class AbstractInt extends BN implements INumber {
|
||||
|
||||
this.registry = registry;
|
||||
this.#bitLength = bitLength;
|
||||
this.#byteLength = this.#bitLength / 8;
|
||||
this.#isSigned = isSigned;
|
||||
|
||||
const isPositive = this.gte(BN_ZERO);
|
||||
@@ -87,7 +91,7 @@ export abstract class AbstractInt extends BN implements INumber {
|
||||
* @description The length of the value when encoded as a Uint8Array
|
||||
*/
|
||||
public get encodedLength (): number {
|
||||
return this.#bitLength / 8;
|
||||
return this.#byteLength;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -158,7 +162,7 @@ export abstract class AbstractInt extends BN implements INumber {
|
||||
/**
|
||||
* @description Returns a hex string representation of the value
|
||||
*/
|
||||
public toHex (isLe = false): string {
|
||||
public toHex (isLe = false): HexString {
|
||||
// For display/JSON, this is BE, for compare, use isLe
|
||||
return bnToHex(this, {
|
||||
bitLength: this.bitLength(),
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { CodecHash, Hash } from '../interfaces/runtime';
|
||||
import type { AnyJson, Codec, Constructor, ISet, Registry } from '../types';
|
||||
|
||||
@@ -11,26 +12,20 @@ import { compareSet, decodeU8a, sortSet, typeToConstructor } from './utils';
|
||||
const l = logger('BTreeSet');
|
||||
|
||||
/** @internal */
|
||||
function decodeSetFromU8a<V extends Codec> (registry: Registry, ValClass: Constructor<V>, u8a: Uint8Array): Set<V> {
|
||||
function decodeSetFromU8a<V extends Codec> (registry: Registry, ValClass: Constructor<V>, u8a: Uint8Array): [Set<V>, number] {
|
||||
const output = new Set<V>();
|
||||
const [offset, length] = compactFromU8a(u8a);
|
||||
const types = [];
|
||||
|
||||
for (let i = 0; i < length.toNumber(); i++) {
|
||||
types.push(ValClass);
|
||||
}
|
||||
|
||||
const values = decodeU8a<V>(registry, u8a.subarray(offset), types);
|
||||
const [values, decodedLength] = decodeU8a<V>(registry, u8a.subarray(offset), new Array(length.toNumber()).fill(ValClass));
|
||||
|
||||
for (let i = 0; i < values.length; i++) {
|
||||
output.add(values[i]);
|
||||
}
|
||||
|
||||
return output;
|
||||
return [output, decodedLength + offset];
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
function decodeSetFromSet<V extends Codec> (registry: Registry, ValClass: Constructor<V>, value: Set<any> | string[]): Set<V> {
|
||||
function decodeSetFromSet<V extends Codec> (registry: Registry, ValClass: Constructor<V>, value: Set<any> | string[]): [Set<V>, number] {
|
||||
const output = new Set<V>();
|
||||
|
||||
value.forEach((val: any) => {
|
||||
@@ -43,7 +38,7 @@ function decodeSetFromSet<V extends Codec> (registry: Registry, ValClass: Constr
|
||||
}
|
||||
});
|
||||
|
||||
return output;
|
||||
return [output, 0];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,9 +55,9 @@ function decodeSetFromSet<V extends Codec> (registry: Registry, ValClass: Constr
|
||||
* @param jsonSet
|
||||
* @internal
|
||||
*/
|
||||
function decodeSet<V extends Codec> (registry: Registry, valType: Constructor<V> | string, value?: Uint8Array | string | string[] | Set<any>): Set<V> {
|
||||
function decodeSet<V extends Codec> (registry: Registry, valType: Constructor<V> | string, value?: Uint8Array | string | string[] | Set<any>): [Set<V>, number] {
|
||||
if (!value) {
|
||||
return new Set<V>();
|
||||
return [new Set<V>(), 0];
|
||||
}
|
||||
|
||||
const ValClass = typeToConstructor(registry, valType);
|
||||
@@ -81,12 +76,17 @@ export class BTreeSet<V extends Codec = Codec> extends Set<V> implements ISet<V>
|
||||
|
||||
public createdAtHash?: Hash;
|
||||
|
||||
readonly #initialU8aLength?: number;
|
||||
|
||||
readonly #ValClass: Constructor<V>;
|
||||
|
||||
constructor (registry: Registry, valType: Constructor<V> | string, rawValue?: Uint8Array | string | string[] | Set<any>) {
|
||||
super(sortSet(decodeSet(registry, valType, rawValue)));
|
||||
const [values, decodedLength] = decodeSet(registry, valType, rawValue);
|
||||
|
||||
super(sortSet(values));
|
||||
|
||||
this.registry = registry;
|
||||
this.#initialU8aLength = decodedLength;
|
||||
this.#ValClass = typeToConstructor(registry, valType);
|
||||
}
|
||||
|
||||
@@ -111,6 +111,13 @@ export class BTreeSet<V extends Codec = Codec> extends Set<V> implements ISet<V>
|
||||
return len;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The length of the initial encoded value (Only available when constructed from a Uint8Array)
|
||||
*/
|
||||
public get initialU8aLength (): number | undefined {
|
||||
return this.#initialU8aLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Returns a hash of the value
|
||||
*/
|
||||
@@ -142,7 +149,7 @@ export class BTreeSet<V extends Codec = Codec> extends Set<V> implements ISet<V>
|
||||
/**
|
||||
* @description Returns a hex string representation of the value. isLe returns a LE (number-only) representation
|
||||
*/
|
||||
public toHex (): string {
|
||||
public toHex (): HexString {
|
||||
return u8aToHex(this.toU8a());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { CodecHash, Hash } from '../interfaces/runtime';
|
||||
import type { AnyJson, BareOpts, Codec, Registry } from '../types';
|
||||
|
||||
@@ -13,11 +14,14 @@ export abstract class Base<T extends Codec> implements Codec {
|
||||
|
||||
public createdAtHash?: Hash;
|
||||
|
||||
readonly #initialU8aLength?: number;
|
||||
|
||||
protected readonly _raw: T;
|
||||
|
||||
protected constructor (registry: Registry, value: T) {
|
||||
protected constructor (registry: Registry, value: T, initialU8aLength?: number) {
|
||||
this.registry = registry;
|
||||
this._raw = value;
|
||||
this.#initialU8aLength = initialU8aLength;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -27,6 +31,13 @@ export abstract class Base<T extends Codec> implements Codec {
|
||||
return this.toU8a().length;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The length of the initial encoded value (Only available when constructed from a Uint8Array)
|
||||
*/
|
||||
public get initialU8aLength (): number | undefined {
|
||||
return this.#initialU8aLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description returns a hash of the contents
|
||||
*/
|
||||
@@ -51,7 +62,7 @@ export abstract class Base<T extends Codec> implements Codec {
|
||||
/**
|
||||
* @description Returns a hex string representation of the value. isLe returns a LE (number-only) representation
|
||||
*/
|
||||
public toHex (isLe?: boolean): string {
|
||||
public toHex (isLe?: boolean): HexString {
|
||||
return this._raw.toHex(isLe);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { BN } from '@polkadot/util';
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { CodecHash, Hash } from '../interfaces';
|
||||
import type { AnyJson, AnyNumber, Constructor, ICompact, INumber, Registry } from '../types';
|
||||
|
||||
@@ -24,12 +25,18 @@ export class Compact<T extends INumber> implements ICompact<T> {
|
||||
|
||||
readonly #Type: Constructor<T>;
|
||||
|
||||
readonly #initialU8aLength?: number;
|
||||
|
||||
readonly #raw: T;
|
||||
|
||||
constructor (registry: Registry, Type: Constructor<T> | string, value: Compact<T> | AnyNumber = 0) {
|
||||
this.registry = registry;
|
||||
this.#Type = typeToConstructor(registry, Type);
|
||||
this.#raw = Compact.decodeCompact<T>(registry, this.#Type, value) as T;
|
||||
|
||||
const [raw, decodedLength] = Compact.decodeCompact<T>(registry, this.#Type, value);
|
||||
|
||||
this.#initialU8aLength = decodedLength;
|
||||
this.#raw = raw;
|
||||
}
|
||||
|
||||
public static with<T extends INumber> (Type: Constructor<T> | string): Constructor<Compact<T>> {
|
||||
@@ -41,14 +48,16 @@ export class Compact<T extends INumber> implements ICompact<T> {
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
public static decodeCompact<T extends INumber> (registry: Registry, Type: Constructor<T>, value: Compact<T> | AnyNumber): INumber {
|
||||
public static decodeCompact<T extends INumber> (registry: Registry, Type: Constructor<T>, value: Compact<T> | AnyNumber): [T, number] {
|
||||
if (value instanceof Compact) {
|
||||
return new Type(registry, value.#raw);
|
||||
return [new Type(registry, value.#raw), 0];
|
||||
} else if (isString(value) || isNumber(value) || isBn(value) || isBigInt(value)) {
|
||||
return new Type(registry, value);
|
||||
return [new Type(registry, value), 0];
|
||||
}
|
||||
|
||||
return new Type(registry, compactFromU8a(value)[1]);
|
||||
const [decodedLength, bn] = compactFromU8a(value);
|
||||
|
||||
return [new Type(registry, bn), decodedLength];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -58,6 +67,13 @@ export class Compact<T extends INumber> implements ICompact<T> {
|
||||
return this.toU8a().length;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The length of the initial encoded value (Only available when constructed from a Uint8Array)
|
||||
*/
|
||||
public get initialU8aLength (): number | undefined {
|
||||
return this.#initialU8aLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description returns a hash of the contents
|
||||
*/
|
||||
@@ -107,7 +123,7 @@ export class Compact<T extends INumber> implements ICompact<T> {
|
||||
/**
|
||||
* @description Returns a hex string representation of the value. isLe returns a LE (number-only) representation
|
||||
*/
|
||||
public toHex (isLe?: boolean): string {
|
||||
public toHex (isLe?: boolean): HexString {
|
||||
return this.#raw.toHex(isLe);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { CodecHash, Hash } from '../interfaces/runtime';
|
||||
import type { AnyNumber, INumber, Registry } from '../types';
|
||||
import type { UIntBitLength } from './types';
|
||||
@@ -96,7 +97,7 @@ export class CodecDate extends Date implements INumber {
|
||||
/**
|
||||
* @description Returns a hex string representation of the value
|
||||
*/
|
||||
public toHex (isLe = false): string {
|
||||
public toHex (isLe = false): HexString {
|
||||
return bnToHex(this.toBn(), {
|
||||
bitLength: BITLENGTH,
|
||||
isLe,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { CodecHash, Hash } from '../interfaces/runtime';
|
||||
import type { AnyJson, Codec, Constructor, Registry } from '../types';
|
||||
|
||||
@@ -56,7 +57,7 @@ export class DoNotConstruct implements Codec {
|
||||
throw this.#neverError;
|
||||
}
|
||||
|
||||
toHex (): string {
|
||||
toHex (): HexString {
|
||||
throw this.#neverError;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { CodecHash, Hash } from '../interfaces';
|
||||
import type { AnyJson, Codec, Constructor, IEnum, Registry } from '../types';
|
||||
|
||||
@@ -169,6 +170,8 @@ export class Enum implements IEnum {
|
||||
|
||||
readonly #entryIndex: number;
|
||||
|
||||
readonly #initialU8aLength?: number;
|
||||
|
||||
readonly #indexes: number[];
|
||||
|
||||
readonly #isBasic: boolean;
|
||||
@@ -188,6 +191,10 @@ export class Enum implements IEnum {
|
||||
this.#indexes = Object.values(defInfo.def).map(({ index }) => index);
|
||||
this.#entryIndex = this.#indexes.indexOf(decoded.index) || 0;
|
||||
this.#raw = decoded.value;
|
||||
|
||||
if (this.#raw.initialU8aLength) {
|
||||
this.#initialU8aLength = 1 + this.#raw.initialU8aLength;
|
||||
}
|
||||
}
|
||||
|
||||
public static with (Types: Record<string, string | Constructor> | Record<string, number> | string[]): EnumConstructor<Enum> {
|
||||
@@ -227,6 +234,13 @@ export class Enum implements IEnum {
|
||||
return 1 + this.#raw.encodedLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The length of the initial encoded value (Only available when constructed from a Uint8Array)
|
||||
*/
|
||||
public get initialU8aLength (): number | undefined {
|
||||
return this.#initialU8aLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description returns a hash of the contents
|
||||
*/
|
||||
@@ -324,7 +338,7 @@ export class Enum implements IEnum {
|
||||
/**
|
||||
* @description Returns a hex string representation of the value
|
||||
*/
|
||||
public toHex (): string {
|
||||
public toHex (): HexString {
|
||||
return u8aToHex(this.toU8a());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { CodecHash, Hash } from '../interfaces/runtime';
|
||||
import type { AnyJson, Codec, Registry } from '../types';
|
||||
|
||||
@@ -73,7 +74,7 @@ export class Json extends Map<string, any> implements Codec {
|
||||
/**
|
||||
* @description Unimplemented, will throw
|
||||
*/
|
||||
public toHex (): string {
|
||||
public toHex (): HexString {
|
||||
throw new Error('Unimplemented');
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { Codec, Constructor, Registry } from '../types';
|
||||
|
||||
import { Option } from './Option';
|
||||
@@ -22,7 +23,7 @@ export class Linkage<T extends Codec> extends Struct {
|
||||
previous: Option.with(Type),
|
||||
// eslint-disable-next-line sort-keys
|
||||
next: Option.with(Type)
|
||||
}, value as string);
|
||||
}, value as HexString);
|
||||
}
|
||||
|
||||
public static withKey<O extends Codec> (Type: Constructor | string): Constructor<Linkage<O>> {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { CodecHash, Hash } from '../interfaces/runtime';
|
||||
import type { AnyJson, Codec, Constructor, IMap, Registry } from '../types';
|
||||
|
||||
@@ -14,26 +15,27 @@ import { compareMap, decodeU8a, sortMap, typeToConstructor } from './utils';
|
||||
const l = logger('Map');
|
||||
|
||||
/** @internal */
|
||||
function decodeMapFromU8a<K extends Codec, V extends Codec> (registry: Registry, KeyClass: Constructor<K>, ValClass: Constructor<V>, u8a: Uint8Array): Map<K, V> {
|
||||
function decodeMapFromU8a<K extends Codec, V extends Codec> (registry: Registry, KeyClass: Constructor<K>, ValClass: Constructor<V>, u8a: Uint8Array): [Map<K, V>, number] {
|
||||
const output = new Map<K, V>();
|
||||
const [offset, length] = compactFromU8a(u8a);
|
||||
const count = length.toNumber();
|
||||
const types = [];
|
||||
|
||||
for (let i = 0; i < length.toNumber(); i++) {
|
||||
for (let i = 0; i < count; i++) {
|
||||
types.push(KeyClass, ValClass);
|
||||
}
|
||||
|
||||
const values = decodeU8a(registry, u8a.subarray(offset), types);
|
||||
const [values, decodedLength] = decodeU8a(registry, u8a.subarray(offset), types);
|
||||
|
||||
for (let i = 0; i < values.length; i += 2) {
|
||||
output.set(values[i] as K, values[i + 1] as V);
|
||||
}
|
||||
|
||||
return output;
|
||||
return [output, offset + decodedLength];
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
function decodeMapFromMap<K extends Codec, V extends Codec> (registry: Registry, KeyClass: Constructor<K>, ValClass: Constructor<V>, value: Map<any, any>): Map<K, V> {
|
||||
function decodeMapFromMap<K extends Codec, V extends Codec> (registry: Registry, KeyClass: Constructor<K>, ValClass: Constructor<V>, value: Map<any, any>): [Map<K, V>, number] {
|
||||
const output = new Map<K, V>();
|
||||
|
||||
value.forEach((val: unknown, key: unknown) => {
|
||||
@@ -57,7 +59,7 @@ function decodeMapFromMap<K extends Codec, V extends Codec> (registry: Registry,
|
||||
}
|
||||
});
|
||||
|
||||
return output;
|
||||
return [output, 0];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -75,12 +77,12 @@ function decodeMapFromMap<K extends Codec, V extends Codec> (registry: Registry,
|
||||
* @param jsonMap
|
||||
* @internal
|
||||
*/
|
||||
function decodeMap<K extends Codec, V extends Codec> (registry: Registry, keyType: Constructor<K> | string, valType: Constructor<V> | string, value?: Uint8Array | string | Map<any, any>): Map<K, V> {
|
||||
function decodeMap<K extends Codec, V extends Codec> (registry: Registry, keyType: Constructor<K> | string, valType: Constructor<V> | string, value?: Uint8Array | string | Map<any, any>): [Map<K, V>, number] {
|
||||
const KeyClass = typeToConstructor(registry, keyType);
|
||||
const ValClass = typeToConstructor(registry, valType);
|
||||
|
||||
if (!value) {
|
||||
return new Map<K, V>();
|
||||
return [new Map<K, V>(), 0];
|
||||
} else if (isU8a(value) || isHex(value)) {
|
||||
return decodeMapFromU8a<K, V>(registry, KeyClass, ValClass, u8aToU8a(value));
|
||||
} else if (value instanceof Map) {
|
||||
@@ -101,16 +103,19 @@ export class CodecMap<K extends Codec = Codec, V extends Codec = Codec> extends
|
||||
|
||||
readonly #ValClass: Constructor<V>;
|
||||
|
||||
readonly #initialU8aLength?: number;
|
||||
|
||||
readonly #type: string;
|
||||
|
||||
constructor (registry: Registry, keyType: Constructor<K> | string, valType: Constructor<V> | string, rawValue: Uint8Array | string | Map<any, any> | undefined, type: 'BTreeMap' | 'HashMap' = 'HashMap') {
|
||||
const decoded = decodeMap(registry, keyType, valType, rawValue);
|
||||
const [decoded, decodedLength] = decodeMap(registry, keyType, valType, rawValue);
|
||||
|
||||
super(type === 'BTreeMap' ? sortMap(decoded) : decoded);
|
||||
|
||||
this.registry = registry;
|
||||
this.#KeyClass = typeToConstructor(registry, keyType);
|
||||
this.#ValClass = typeToConstructor(registry, valType);
|
||||
this.#initialU8aLength = decodedLength;
|
||||
this.#type = type;
|
||||
}
|
||||
|
||||
@@ -127,6 +132,13 @@ export class CodecMap<K extends Codec = Codec, V extends Codec = Codec> extends
|
||||
return len;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The length of the initial encoded value (Only available when constructed from a Uint8Array)
|
||||
*/
|
||||
public get initialU8aLength (): number | undefined {
|
||||
return this.#initialU8aLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Returns a hash of the value
|
||||
*/
|
||||
@@ -151,7 +163,7 @@ export class CodecMap<K extends Codec = Codec, V extends Codec = Codec> extends
|
||||
/**
|
||||
* @description Returns a hex string representation of the value. isLe returns a LE (number-only) representation
|
||||
*/
|
||||
public toHex (): string {
|
||||
public toHex (): HexString {
|
||||
return u8aToHex(this.toU8a());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { CodecHash, Hash } from '../interfaces';
|
||||
import type { AnyJson, Codec, Constructor, IOption, Registry } from '../types';
|
||||
|
||||
@@ -54,12 +55,18 @@ export class Option<T extends Codec> implements IOption<T> {
|
||||
|
||||
readonly #Type: Constructor<T>;
|
||||
|
||||
readonly #initialU8aLength?: number;
|
||||
|
||||
readonly #raw: T;
|
||||
|
||||
constructor (registry: Registry, typeName: Constructor<T> | string, value?: unknown) {
|
||||
this.registry = registry;
|
||||
this.#Type = typeToConstructor(registry, typeName);
|
||||
this.#raw = decodeOption(registry, typeName, value) as T;
|
||||
|
||||
if (this.#raw.initialU8aLength) {
|
||||
this.#initialU8aLength = 1 + this.#raw.initialU8aLength;
|
||||
}
|
||||
}
|
||||
|
||||
public static with<O extends Codec> (Type: Constructor<O> | string): Constructor<Option<O>> {
|
||||
@@ -78,6 +85,13 @@ export class Option<T extends Codec> implements IOption<T> {
|
||||
return 1 + this.#raw.encodedLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The length of the initial encoded value (Only available when constructed from a Uint8Array)
|
||||
*/
|
||||
public get initialU8aLength (): number | undefined {
|
||||
return this.#initialU8aLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description returns a hash of the contents
|
||||
*/
|
||||
@@ -127,7 +141,7 @@ export class Option<T extends Codec> implements IOption<T> {
|
||||
/**
|
||||
* @description Returns a hex string representation of the value
|
||||
*/
|
||||
public toHex (): string {
|
||||
public toHex (): HexString {
|
||||
// This attempts to align with the JSON encoding - actually in this case
|
||||
// the isSome value is correct, however the `isNone` may be problematic
|
||||
return this.isNone
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { CodecHash, Hash } from '../interfaces/runtime';
|
||||
import type { AnyJson, AnyU8a, IU8a, Registry } from '../types';
|
||||
|
||||
@@ -20,10 +21,13 @@ export class Raw extends Uint8Array implements IU8a {
|
||||
|
||||
public createdAtHash?: Hash;
|
||||
|
||||
constructor (registry: Registry, value?: AnyU8a) {
|
||||
readonly #initialU8aLength?: number;
|
||||
|
||||
constructor (registry: Registry, value?: AnyU8a, initialU8aLength?: number) {
|
||||
super(u8aToU8a(value));
|
||||
|
||||
this.registry = registry;
|
||||
this.#initialU8aLength = initialU8aLength;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -33,6 +37,13 @@ export class Raw extends Uint8Array implements IU8a {
|
||||
return this.length;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The length of the initial encoded value (Only available when constructed from a Uint8Array)
|
||||
*/
|
||||
public get initialU8aLength (): number | undefined {
|
||||
return this.#initialU8aLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description returns a hash of the contents
|
||||
*/
|
||||
@@ -111,7 +122,7 @@ export class Raw extends Uint8Array implements IU8a {
|
||||
/**
|
||||
* @description Returns a hex string representation of the value
|
||||
*/
|
||||
public toHex (): string {
|
||||
public toHex (): HexString {
|
||||
return u8aToHex(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { CodecHash, Hash } from '../interfaces/runtime';
|
||||
import type { Constructor, ISet, Registry } from '../types';
|
||||
|
||||
@@ -10,33 +11,44 @@ import { compareArray } from './utils';
|
||||
|
||||
type SetValues = Record<string, number | BN>;
|
||||
|
||||
function encodeSet (setValues: SetValues, value: string[]): BN {
|
||||
return value.reduce((result, value): BN => {
|
||||
return result.or(bnToBn(setValues[value] || 0));
|
||||
}, new BN(0));
|
||||
function encodeSet (setValues: SetValues, values: string[]): BN {
|
||||
const encoded = new BN(0);
|
||||
|
||||
for (let i = 0; i < values.length; i++) {
|
||||
encoded.ior(bnToBn(setValues[values[i]] || 0));
|
||||
}
|
||||
|
||||
return encoded;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
function decodeSetArray (setValues: SetValues, value: string[]): string[] {
|
||||
return value.reduce<string[]>((result, key): string[] => {
|
||||
function decodeSetArray (setValues: SetValues, values: string[]): string[] {
|
||||
const result = new Array<string>(values.length);
|
||||
|
||||
for (let i = 0; i < values.length; i++) {
|
||||
const key = values[i];
|
||||
|
||||
assert(!isUndefined(setValues[key]), () => `Set: Invalid key '${key}' passed to Set, allowed ${Object.keys(setValues).join(', ')}`);
|
||||
|
||||
result.push(key);
|
||||
result[i] = key;
|
||||
}
|
||||
|
||||
return result;
|
||||
}, []);
|
||||
return result;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
function decodeSetNumber (setValues: SetValues, _value: BN | number): string[] {
|
||||
const bn = bnToBn(_value);
|
||||
const result = Object.keys(setValues).reduce<string[]>((result, key): string[] => {
|
||||
const keys = Object.keys(setValues);
|
||||
const result: string[] = [];
|
||||
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
const key = keys[i];
|
||||
|
||||
if (bn.and(bnToBn(setValues[key])).eq(bnToBn(setValues[key]))) {
|
||||
result.push(key);
|
||||
}
|
||||
|
||||
return result;
|
||||
}, []);
|
||||
}
|
||||
|
||||
const computed = encodeSet(setValues, result);
|
||||
|
||||
@@ -177,7 +189,7 @@ export class CodecSet extends Set<string> implements ISet<string> {
|
||||
/**
|
||||
* @description Returns a hex string representation of the value
|
||||
*/
|
||||
public toHex (): string {
|
||||
public toHex (): HexString {
|
||||
return u8aToHex(this.toU8a());
|
||||
}
|
||||
|
||||
|
||||
@@ -52,15 +52,16 @@ describe('Struct', (): void => {
|
||||
testEncode('toString', '{"foo":"bazzing","bar":69}');
|
||||
});
|
||||
|
||||
it('decodes null', (): void => {
|
||||
expect(
|
||||
new (
|
||||
Struct.with({
|
||||
txt: Text,
|
||||
u32: U32
|
||||
})
|
||||
)(registry, null).toString()
|
||||
).toEqual('{}');
|
||||
it('decodes null/undefined/empty correctly (& equivalently)', (): void => {
|
||||
const Clazz = Struct.with({
|
||||
txt: Text,
|
||||
u32: U32
|
||||
});
|
||||
const expected = { txt: '', u32: '0' };
|
||||
|
||||
expect(new Clazz(registry, {}).toHuman()).toEqual(expected);
|
||||
expect(new Clazz(registry, null).toHuman()).toEqual(expected);
|
||||
expect(new Clazz(registry, undefined).toHuman()).toEqual(expected);
|
||||
});
|
||||
|
||||
it('decodes reusing instantiated inputs', (): void => {
|
||||
@@ -110,15 +111,11 @@ describe('Struct', (): void => {
|
||||
});
|
||||
|
||||
it('decodes from a Map input', (): void => {
|
||||
const input = new Struct(registry, {
|
||||
a: U32,
|
||||
txt: Text
|
||||
}, { a: 42, txt: 'fubar' });
|
||||
const s = new Struct(registry, {
|
||||
txt: Text,
|
||||
foo: U32,
|
||||
bar: U32
|
||||
}, input);
|
||||
}, new Map<string, unknown>([['a', 42], ['txt', 'fubar']]));
|
||||
|
||||
expect(s.toString()).toEqual('{"txt":"fubar","foo":0,"bar":0}');
|
||||
});
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { CodecHash, Hash } from '../interfaces/runtime';
|
||||
import type { AnyJson, BareOpts, Codec, Constructor, ConstructorDef, IStruct, Registry } from '../types';
|
||||
|
||||
@@ -11,61 +12,52 @@ import { compareMap, decodeU8a, mapToTypeMap } from './utils';
|
||||
type TypesDef<T = Codec> = Record<string, string | Constructor<T>>;
|
||||
|
||||
/** @internal */
|
||||
function decodeStructFromObject <T> (registry: Registry, Types: ConstructorDef, value: any, jsonMap: Map<any, string>): T {
|
||||
let jsonObj: Record<string, any> | undefined;
|
||||
function decodeStructFromObject (registry: Registry, Types: ConstructorDef, value: any, jsonMap: Map<string, string>): Iterable<[string, Codec]> {
|
||||
let jsonObj: Record<string, unknown> | undefined;
|
||||
const inputKeys = Object.keys(Types);
|
||||
const typeofArray = Array.isArray(value);
|
||||
const typeofMap = value instanceof Map;
|
||||
|
||||
assert(!Array.isArray(value) || value.length === inputKeys.length, () => `Struct: Unable to map ${stringify(value)} array to object with known keys ${inputKeys.join(', ')}`);
|
||||
assert(typeofArray || typeofMap || isObject(value), () => `Struct: Cannot decode value ${stringify(value)} (typeof ${typeof value}), expected an input object, map or array`);
|
||||
assert(!typeofArray || value.length === inputKeys.length, () => `Struct: Unable to map ${stringify(value)} array to object with known keys ${inputKeys.join(', ')}`);
|
||||
|
||||
return inputKeys.reduce((raw, key, index): T => {
|
||||
// The key in the JSON can be snake_case (or other cases), but in our
|
||||
// Types, result or any other maps, it's camelCase
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
const jsonKey = (jsonMap.get(key as any) && !value[key])
|
||||
? jsonMap.get(key as any)
|
||||
: key;
|
||||
const raw = new Array<[string, Codec]>(inputKeys.length);
|
||||
|
||||
for (let i = 0; i < inputKeys.length; i++) {
|
||||
const key = inputKeys[i];
|
||||
const jsonKey = jsonMap.get(key) || key;
|
||||
const Type = Types[key];
|
||||
let assign: unknown;
|
||||
|
||||
try {
|
||||
if (Array.isArray(value)) {
|
||||
// TS2322: Type 'Codec' is not assignable to type 'T[keyof S]'.
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access
|
||||
(raw as any)[key] = value[index] instanceof Type
|
||||
? value[index]
|
||||
: new Type(registry, value[index]);
|
||||
} else if (value instanceof Map) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
const mapped = value.get(jsonKey);
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
(raw as any)[key] = mapped instanceof Type
|
||||
? mapped
|
||||
: new Type(registry, mapped);
|
||||
} else if (isObject(value)) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
let assign = value[jsonKey as string];
|
||||
if (typeofArray) {
|
||||
assign = value[i] as unknown;
|
||||
} else if (typeofMap) {
|
||||
assign = jsonKey && value.get(jsonKey);
|
||||
} else {
|
||||
assign = jsonKey && value[jsonKey] as unknown;
|
||||
|
||||
if (isUndefined(assign)) {
|
||||
if (isUndefined(jsonObj)) {
|
||||
jsonObj = Object.entries(value).reduce((all: Record<string, any>, [key, value]): Record<string, any> => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
all[stringCamelCase(key)] = value;
|
||||
const entries = Object.entries(value);
|
||||
|
||||
return all;
|
||||
}, {});
|
||||
jsonObj = {};
|
||||
|
||||
for (let e = 0; e < entries.length; e++) {
|
||||
jsonObj[stringCamelCase(entries[e][0])] = entries[e][1];
|
||||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
assign = jsonObj[jsonKey as string];
|
||||
assign = jsonKey && jsonObj[jsonKey];
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access
|
||||
(raw as any)[key] = assign instanceof Type
|
||||
? assign
|
||||
: new Type(registry, assign);
|
||||
} else {
|
||||
throw new Error(`Cannot decode value ${stringify(value)} (typeof ${typeof value}), expected an input object with known keys`);
|
||||
}
|
||||
|
||||
raw[i] = [
|
||||
key,
|
||||
assign instanceof Type
|
||||
? assign
|
||||
: new Type(registry, assign)
|
||||
];
|
||||
} catch (error) {
|
||||
let type = Type.name;
|
||||
|
||||
@@ -75,11 +67,11 @@ function decodeStructFromObject <T> (registry: Registry, Types: ConstructorDef,
|
||||
// ignore
|
||||
}
|
||||
|
||||
throw new Error(`Struct: failed on ${jsonKey as string}: ${type}:: ${(error as Error).message}`);
|
||||
throw new Error(`Struct: failed on ${jsonKey}: ${type}:: ${(error as Error).message}`);
|
||||
}
|
||||
}
|
||||
|
||||
return raw;
|
||||
}, {} as T);
|
||||
return raw;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -98,27 +90,17 @@ function decodeStructFromObject <T> (registry: Registry, Types: ConstructorDef,
|
||||
* @param jsonMap
|
||||
* @internal
|
||||
*/
|
||||
function decodeStruct <T> (registry: Registry, Types: ConstructorDef, value: unknown, jsonMap: Map<any, string>): T {
|
||||
function decodeStruct (registry: Registry, Types: ConstructorDef, value: unknown, jsonMap: Map<string, string>): [Iterable<[string, Codec]>, number] {
|
||||
if (isHex(value)) {
|
||||
return decodeStruct(registry, Types, hexToU8a(value), jsonMap);
|
||||
} else if (isU8a(value)) {
|
||||
const keys = Object.keys(Types);
|
||||
const values = decodeU8a(registry, value, Object.values(Types), keys);
|
||||
|
||||
// Transform array of values to {key: value} mapping
|
||||
return keys.reduce((raw, key, index): T => {
|
||||
// TS2322: Type 'Codec' is not assignable to type 'T[keyof S]'.
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
(raw as any)[key] = values[index];
|
||||
|
||||
return raw;
|
||||
}, {} as T);
|
||||
} else if (!value) {
|
||||
return {} as T;
|
||||
return decodeU8a<Codec, [string, Codec]>(registry, value, Types, 0, (k, v) => [k, v]);
|
||||
} else if (value instanceof Struct) {
|
||||
return [value as Iterable<[string, Codec]>, 0];
|
||||
}
|
||||
|
||||
// We assume from here that value is a JS object (Array, Map, Object)
|
||||
return decodeStructFromObject(registry, Types, value, jsonMap);
|
||||
return [decodeStructFromObject(registry, Types, value || {}, jsonMap), 0];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -142,23 +124,28 @@ export class Struct<
|
||||
|
||||
public createdAtHash?: Hash;
|
||||
|
||||
readonly #initialU8aLength?: number;
|
||||
|
||||
readonly #jsonMap: Map<keyof S, string>;
|
||||
|
||||
readonly #Types: ConstructorDef;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
constructor (registry: Registry, Types: S, value: V | Map<unknown, unknown> | unknown[] | string = {} as V, jsonMap: Map<keyof S, string> = new Map()) {
|
||||
super(Object.entries(decodeStruct(registry, mapToTypeMap(registry, Types), value, jsonMap)));
|
||||
constructor (registry: Registry, Types: S, value?: V | Map<unknown, unknown> | unknown[] | HexString | null, jsonMap = new Map<string, string>()) {
|
||||
const [decoded, decodedLength] = decodeStruct(registry, mapToTypeMap(registry, Types), value, jsonMap);
|
||||
|
||||
super(decoded);
|
||||
|
||||
this.registry = registry;
|
||||
this.#initialU8aLength = decodedLength;
|
||||
this.#jsonMap = jsonMap;
|
||||
this.#Types = mapToTypeMap(registry, Types);
|
||||
}
|
||||
|
||||
public static with<S extends TypesDef> (Types: S, jsonMap?: Map<keyof S, string>): Constructor<Struct<S>> {
|
||||
public static with<S extends TypesDef> (Types: S, jsonMap?: Map<string, string>): Constructor<Struct<S>> {
|
||||
return class extends Struct<S> {
|
||||
constructor (registry: Registry, value?: unknown) {
|
||||
super(registry, Types, value as string, jsonMap);
|
||||
super(registry, Types, value as HexString, jsonMap);
|
||||
|
||||
Object.keys(Types).forEach((key): void => {
|
||||
isUndefined(this[key as keyof this]) &&
|
||||
@@ -172,11 +159,16 @@ export class Struct<
|
||||
}
|
||||
|
||||
public static typesToMap (registry: Registry, Types: Record<string, Constructor>): Record<string, string> {
|
||||
return Object.entries(Types).reduce((result: Record<string, string>, [key, Type]): Record<string, string> => {
|
||||
result[key] = registry.getClassName(Type) || new Type(registry).toRawType();
|
||||
const entries = Object.entries(Types);
|
||||
const result: Record<string, string> = {};
|
||||
|
||||
return result;
|
||||
}, {});
|
||||
for (let i = 0; i < entries.length; i++) {
|
||||
const [key, Type] = entries[i];
|
||||
|
||||
result[key] = registry.getClassName(Type) || new Type(registry).toRawType();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -192,6 +184,7 @@ export class Struct<
|
||||
public get isEmpty (): boolean {
|
||||
const items = this.toArray();
|
||||
|
||||
// More code, but it _should_ be more performand that this.toArray().every((e) => e.isEmpty)
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
if (!items[i].isEmpty) {
|
||||
return false;
|
||||
@@ -209,7 +202,7 @@ export class Struct<
|
||||
.entries(this.#Types))
|
||||
.reduce((result: E, [key, Type]): E => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
(result as any)[key] = new Type(this.registry).toRawType();
|
||||
(result as any)[key as keyof E] = new Type(this.registry).toRawType();
|
||||
|
||||
return result;
|
||||
}, {} as E);
|
||||
@@ -219,11 +212,21 @@ export class Struct<
|
||||
* @description The length of the value when encoded as a Uint8Array
|
||||
*/
|
||||
public get encodedLength (): number {
|
||||
return this.toArray().reduce((length, entry): number => {
|
||||
length += entry.encodedLength;
|
||||
const arr = this.toArray();
|
||||
let total = 0;
|
||||
|
||||
return length;
|
||||
}, 0);
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
total += arr[i].encodedLength;
|
||||
}
|
||||
|
||||
return total;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The length of the initial encoded value (Only available when constructed from a Uint8Array)
|
||||
*/
|
||||
public get initialU8aLength (): number | undefined {
|
||||
return this.#initialU8aLength;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -265,7 +268,7 @@ export class Struct<
|
||||
/**
|
||||
* @description Returns a hex string representation of the value
|
||||
*/
|
||||
public toHex (): string {
|
||||
public toHex (): HexString {
|
||||
return u8aToHex(this.toU8a());
|
||||
}
|
||||
|
||||
@@ -273,27 +276,35 @@ export class Struct<
|
||||
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
|
||||
*/
|
||||
public toHuman (isExtended?: boolean): Record<string, AnyJson> {
|
||||
return [...this.keys()].reduce((json: Record<string, AnyJson>, key): Record<string, AnyJson> => {
|
||||
const json: Record<string, AnyJson> = {};
|
||||
const keys = [...this.keys()];
|
||||
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
const key = keys[i];
|
||||
const value = this.get(key);
|
||||
|
||||
json[key as string] = value && value.toHuman(isExtended);
|
||||
}
|
||||
|
||||
return json;
|
||||
}, {});
|
||||
return json;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Converts the Object to JSON, typically used for RPC transfers
|
||||
*/
|
||||
public toJSON (): Record<string, AnyJson> {
|
||||
return [...this.keys()].reduce((json: Record<string, AnyJson>, key): Record<string, AnyJson> => {
|
||||
const json: Record<string, AnyJson> = {};
|
||||
const keys = [...this.keys()];
|
||||
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
const key = keys[i];
|
||||
const jsonKey = this.#jsonMap.get(key) || key;
|
||||
const value = this.get(key);
|
||||
|
||||
json[jsonKey as string] = value && value.toJSON();
|
||||
}
|
||||
|
||||
return json;
|
||||
}, {});
|
||||
return json;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -317,18 +328,22 @@ export class Struct<
|
||||
public toU8a (isBare?: BareOpts): Uint8Array {
|
||||
// we have keyof S here, cast to string to make it compatible with isBare
|
||||
const entries = [...this.entries()] as [string, Codec][];
|
||||
const encoded: Uint8Array[] = [];
|
||||
|
||||
return u8aConcat(
|
||||
...entries
|
||||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||
.filter(([, value]) => isFunction(value?.toU8a))
|
||||
.map(([key, value]): Uint8Array =>
|
||||
value.toU8a(
|
||||
for (let i = 0; i < entries.length; i++) {
|
||||
const [k, v] = entries[i];
|
||||
|
||||
if (v && isFunction(v.toU8a)) {
|
||||
encoded.push(
|
||||
v.toU8a(
|
||||
!isBare || isBoolean(isBare)
|
||||
? isBare
|
||||
: isBare[key]
|
||||
: isBare[k]
|
||||
)
|
||||
)
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return u8aConcat(...encoded);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ type TupleTypes = TupleType[] | {
|
||||
};
|
||||
|
||||
/** @internal */
|
||||
function decodeTuple (registry: Registry, _Types: TupleConstructors, value?: AnyTupleValue): Codec[] {
|
||||
function decodeTuple (registry: Registry, _Types: TupleConstructors, value?: AnyTupleValue): [Codec[], number] {
|
||||
if (isU8a(value) || isHex(value)) {
|
||||
return decodeU8a(registry, u8aToU8a(value), _Types);
|
||||
}
|
||||
@@ -30,19 +30,22 @@ function decodeTuple (registry: Registry, _Types: TupleConstructors, value?: Any
|
||||
? _Types
|
||||
: Object.values(_Types);
|
||||
|
||||
return Types.map((Type, index): Codec => {
|
||||
try {
|
||||
const entry = value?.[index];
|
||||
return [
|
||||
Types.map((Type, index): Codec => {
|
||||
try {
|
||||
const entry = value?.[index];
|
||||
|
||||
if (entry instanceof Type) {
|
||||
return entry;
|
||||
if (entry instanceof Type) {
|
||||
return entry;
|
||||
}
|
||||
|
||||
return new Type(registry, entry);
|
||||
} catch (error) {
|
||||
throw new Error(`Tuple: failed on ${index}:: ${(error as Error).message}`);
|
||||
}
|
||||
|
||||
return new Type(registry, entry);
|
||||
} catch (error) {
|
||||
throw new Error(`Tuple: failed on ${index}:: ${(error as Error).message}`);
|
||||
}
|
||||
});
|
||||
}),
|
||||
0
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -52,7 +55,7 @@ function decodeTuple (registry: Registry, _Types: TupleConstructors, value?: Any
|
||||
* own type. It extends the base JS `Array` object.
|
||||
*/
|
||||
export class Tuple extends AbstractArray<Codec> implements ITuple<Codec[]> {
|
||||
private _Types: TupleConstructors;
|
||||
#Types: TupleConstructors;
|
||||
|
||||
constructor (registry: Registry, Types: TupleTypes | TupleType, value?: AnyTupleValue) {
|
||||
const Clazzes = Array.isArray(Types)
|
||||
@@ -60,10 +63,11 @@ export class Tuple extends AbstractArray<Codec> implements ITuple<Codec[]> {
|
||||
: isFunction(Types) || isString(Types)
|
||||
? [typeToConstructor(registry, Types)]
|
||||
: mapToTypeMap(registry, Types);
|
||||
const [values, decodedLength] = decodeTuple(registry, Clazzes, value);
|
||||
|
||||
super(registry, decodeTuple(registry, Clazzes, value));
|
||||
super(registry, values, decodedLength);
|
||||
|
||||
this._Types = Clazzes;
|
||||
this.#Types = Clazzes;
|
||||
}
|
||||
|
||||
public static with (Types: TupleTypes | TupleType): Constructor<Tuple> {
|
||||
@@ -78,16 +82,22 @@ export class Tuple extends AbstractArray<Codec> implements ITuple<Codec[]> {
|
||||
* @description The length of the value when encoded as a Uint8Array
|
||||
*/
|
||||
public override get encodedLength (): number {
|
||||
return this.reduce((total, entry) => total + entry.encodedLength, 0);
|
||||
let total = 0;
|
||||
|
||||
for (let i = 0; i < this.length; i++) {
|
||||
total += this[i].encodedLength;
|
||||
}
|
||||
|
||||
return total;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The types definition of the tuple
|
||||
*/
|
||||
public get Types (): string[] {
|
||||
return Array.isArray(this._Types)
|
||||
? this._Types.map((Type) => new Type(this.registry).toRawType())
|
||||
: Object.keys(this._Types);
|
||||
return Array.isArray(this.#Types)
|
||||
? this.#Types.map((T) => new T(this.registry).toRawType())
|
||||
: Object.keys(this.#Types);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -95,11 +105,11 @@ export class Tuple extends AbstractArray<Codec> implements ITuple<Codec[]> {
|
||||
*/
|
||||
public toRawType (): string {
|
||||
const types = (
|
||||
Array.isArray(this._Types)
|
||||
? this._Types
|
||||
: Object.values(this._Types)
|
||||
).map((Type) =>
|
||||
this.registry.getClassName(Type) || new Type(this.registry).toRawType()
|
||||
Array.isArray(this.#Types)
|
||||
? this.#Types
|
||||
: Object.values(this.#Types)
|
||||
).map((T) =>
|
||||
this.registry.getClassName(T) || new T(this.registry).toRawType()
|
||||
);
|
||||
|
||||
return `(${types.join(',')})`;
|
||||
@@ -118,10 +128,12 @@ export class Tuple extends AbstractArray<Codec> implements ITuple<Codec[]> {
|
||||
* @param isBare true when the value has none of the type-specific prefixes (internal)
|
||||
*/
|
||||
public override toU8a (isBare?: boolean): Uint8Array {
|
||||
return u8aConcat(
|
||||
...this.map((entry): Uint8Array =>
|
||||
entry.toU8a(isBare)
|
||||
)
|
||||
);
|
||||
const encoded = new Array<Uint8Array>(this.length);
|
||||
|
||||
for (let i = 0; i < this.length; i++) {
|
||||
encoded[i] = this[i].toU8a(isBare);
|
||||
}
|
||||
|
||||
return u8aConcat(...encoded);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import { assert, isString, u8aToU8a } from '@polkadot/util';
|
||||
import { Raw } from './Raw';
|
||||
|
||||
/** @internal */
|
||||
function decodeU8aFixed (value: AnyU8a, bitLength: U8aBitLength): AnyU8a {
|
||||
function decodeU8aFixed (value: AnyU8a, bitLength: U8aBitLength): [AnyU8a, number] {
|
||||
if (Array.isArray(value) || isString(value)) {
|
||||
return decodeU8aFixed(u8aToU8a(value), bitLength);
|
||||
}
|
||||
@@ -18,12 +18,12 @@ function decodeU8aFixed (value: AnyU8a, bitLength: U8aBitLength): AnyU8a {
|
||||
const u8a = new Uint8Array(byteLength);
|
||||
|
||||
if (!value || !value.length) {
|
||||
return u8a;
|
||||
return [u8a, 0];
|
||||
}
|
||||
|
||||
assert(value.length >= byteLength, () => `Expected at least ${byteLength} bytes (${bitLength} bits), found ${value.length} bytes`);
|
||||
|
||||
return value.subarray(0, byteLength);
|
||||
return [value.subarray(0, byteLength), byteLength];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -34,7 +34,9 @@ function decodeU8aFixed (value: AnyU8a, bitLength: U8aBitLength): AnyU8a {
|
||||
*/
|
||||
export class U8aFixed extends Raw {
|
||||
constructor (registry: Registry, value: AnyU8a = new Uint8Array(), bitLength: U8aBitLength = 256) {
|
||||
super(registry, decodeU8aFixed(value, bitLength));
|
||||
const [u8a, decodedLength] = decodeU8aFixed(value, bitLength);
|
||||
|
||||
super(registry, u8a, decodedLength);
|
||||
}
|
||||
|
||||
public static with (bitLength: U8aBitLength, typeName?: string): Constructor<U8aFixed> {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { Codec, Constructor, Registry } from '../types';
|
||||
|
||||
import { assert, compactFromU8a, logger, u8aToU8a } from '@polkadot/util';
|
||||
@@ -20,39 +21,51 @@ const l = logger('Vec');
|
||||
* specific encoding/decoding on top of the base type.
|
||||
*/
|
||||
export class Vec<T extends Codec> extends AbstractArray<T> {
|
||||
private _Type: Constructor<T>;
|
||||
#Type: Constructor<T>;
|
||||
|
||||
constructor (registry: Registry, Type: Constructor<T> | string, value: Vec<Codec> | Uint8Array | string | unknown[] = []) {
|
||||
constructor (registry: Registry, Type: Constructor<T> | string, value: Uint8Array | HexString | unknown[] = []) {
|
||||
const Clazz = typeToConstructor<T>(registry, Type);
|
||||
const [values, decodedLength] = Vec.decodeVec(registry, Clazz, value);
|
||||
|
||||
super(registry, Vec.decodeVec(registry, Clazz, value));
|
||||
super(registry, values, decodedLength);
|
||||
|
||||
this._Type = Clazz;
|
||||
this.#Type = Clazz;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
public static decodeVec<T extends Codec> (registry: Registry, Type: Constructor<T>, value: Vec<Codec> | Uint8Array | string | unknown[]): T[] {
|
||||
public static decodeVec<T extends Codec> (registry: Registry, Type: Constructor<T>, value: Uint8Array | HexString | unknown[], length = -1): [T[], number, number] {
|
||||
if (Array.isArray(value)) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
return (value as unknown[]).map((entry: unknown, index: number): T => {
|
||||
try {
|
||||
return entry instanceof Type
|
||||
? entry
|
||||
: new Type(registry, entry);
|
||||
} catch (error) {
|
||||
l.error(`Unable to decode on index ${index}`, (error as Error).message);
|
||||
return [
|
||||
value.map((entry: unknown, index: number): T => {
|
||||
try {
|
||||
return entry instanceof Type
|
||||
? entry
|
||||
: new Type(registry, entry);
|
||||
} catch (error) {
|
||||
l.error(`Unable to decode on index ${index}`, (error as Error).message);
|
||||
|
||||
throw error;
|
||||
}
|
||||
});
|
||||
throw error;
|
||||
}
|
||||
}),
|
||||
0, 0
|
||||
];
|
||||
}
|
||||
|
||||
const u8a = u8aToU8a(value);
|
||||
const [offset, length] = compactFromU8a(u8a);
|
||||
let offset = 0;
|
||||
|
||||
assert(length.lten(MAX_LENGTH), () => `Vec length ${length.toString()} exceeds ${MAX_LENGTH}`);
|
||||
if (length === -1) {
|
||||
const [_offset, _length] = compactFromU8a(u8a);
|
||||
|
||||
return decodeU8a(registry, u8a.subarray(offset), new Array(length.toNumber()).fill(Type));
|
||||
assert(_length.lten(MAX_LENGTH), () => `Vec length ${_length.toString()} exceeds ${MAX_LENGTH}`);
|
||||
|
||||
length = _length.toNumber();
|
||||
offset = _offset;
|
||||
}
|
||||
|
||||
const [decoded, decodedLength] = decodeU8a(registry, u8a.subarray(offset), Type, length);
|
||||
|
||||
return [decoded as T[], decodedLength + offset, decodedLength];
|
||||
}
|
||||
|
||||
public static with<O extends Codec> (Type: Constructor<O> | string): Constructor<Vec<O>> {
|
||||
@@ -67,7 +80,7 @@ export class Vec<T extends Codec> extends AbstractArray<T> {
|
||||
* @description The type for the items
|
||||
*/
|
||||
public get Type (): string {
|
||||
return this._Type.name;
|
||||
return this.#Type.name;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -75,9 +88,9 @@ export class Vec<T extends Codec> extends AbstractArray<T> {
|
||||
*/
|
||||
public override indexOf (_other?: unknown): number {
|
||||
// convert type first, this removes overhead from the eq
|
||||
const other = _other instanceof this._Type
|
||||
const other = _other instanceof this.#Type
|
||||
? _other
|
||||
: new this._Type(this.registry, _other);
|
||||
: new this.#Type(this.registry, _other);
|
||||
|
||||
for (let i = 0; i < this.length; i++) {
|
||||
if (other.eq(this[i])) {
|
||||
@@ -92,6 +105,6 @@ export class Vec<T extends Codec> extends AbstractArray<T> {
|
||||
* @description Returns the base runtime type name for this instance
|
||||
*/
|
||||
public toRawType (): string {
|
||||
return `Vec<${this.registry.getClassName(this._Type) || new this._Type(this.registry).toRawType()}>`;
|
||||
return `Vec<${this.registry.getClassName(this.#Type) || new this.#Type(this.registry).toRawType()}>`;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,31 +1,26 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { Codec, Constructor, Registry } from '../types';
|
||||
|
||||
import { assert, compactToU8a, isHex, isU8a, u8aConcat } from '@polkadot/util';
|
||||
import { assert, u8aConcat } from '@polkadot/util';
|
||||
|
||||
import { AbstractArray } from './AbstractArray';
|
||||
import { typeToConstructor } from './utils';
|
||||
import { Vec } from './Vec';
|
||||
|
||||
/** @internal */
|
||||
function decodeVecFixed<T extends Codec> (registry: Registry, Type: Constructor<T>, allocLength: number, value: VecFixed<any> | Uint8Array | string | any[]): T[] {
|
||||
const values = Vec.decodeVec(
|
||||
registry,
|
||||
Type,
|
||||
isU8a(value) || isHex(value)
|
||||
? u8aConcat(compactToU8a(allocLength), value)
|
||||
: value
|
||||
);
|
||||
function decodeVecFixed<T extends Codec> (registry: Registry, Type: Constructor<T>, length: number, value: Uint8Array | HexString | unknown[]): [T[], number] {
|
||||
const [values,, decodedLengthNoOffset] = Vec.decodeVec(registry, Type, value, length);
|
||||
|
||||
while (values.length < allocLength) {
|
||||
while (values.length < length) {
|
||||
values.push(new Type(registry));
|
||||
}
|
||||
|
||||
assert(values.length === allocLength, () => `Expected a length of exactly ${allocLength} entries`);
|
||||
assert(values.length === length, () => `Expected a length of exactly ${length} entries`);
|
||||
|
||||
return values;
|
||||
return [values, decodedLengthNoOffset];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -34,14 +29,15 @@ function decodeVecFixed<T extends Codec> (registry: Registry, Type: Constructor<
|
||||
* This manages codec arrays of a fixed length
|
||||
*/
|
||||
export class VecFixed<T extends Codec> extends AbstractArray<T> {
|
||||
private _Type: Constructor<T>;
|
||||
#Type: Constructor<T>;
|
||||
|
||||
constructor (registry: Registry, Type: Constructor<T> | string, length: number, value: VecFixed<any> | Uint8Array | string | any[] = [] as any[]) {
|
||||
constructor (registry: Registry, Type: Constructor<T> | string, length: number, value: Uint8Array | HexString | unknown[] = [] as unknown[]) {
|
||||
const Clazz = typeToConstructor<T>(registry, Type);
|
||||
const [values, decodedLength] = decodeVecFixed(registry, Clazz, length, value);
|
||||
|
||||
super(registry, decodeVecFixed(registry, Clazz, length, value));
|
||||
super(registry, values, decodedLength);
|
||||
|
||||
this._Type = Clazz;
|
||||
this.#Type = Clazz;
|
||||
}
|
||||
|
||||
public static with<O extends Codec> (Type: Constructor<O> | string, length: number): Constructor<VecFixed<O>> {
|
||||
@@ -56,20 +52,30 @@ export class VecFixed<T extends Codec> extends AbstractArray<T> {
|
||||
* @description The type for the items
|
||||
*/
|
||||
public get Type (): string {
|
||||
return new this._Type(this.registry).toRawType();
|
||||
return new this.#Type(this.registry).toRawType();
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The length of the value when encoded as a Uint8Array
|
||||
*/
|
||||
public override get encodedLength (): number {
|
||||
return this.reduce((total, entry) => total + entry.encodedLength, 0);
|
||||
let total = 0;
|
||||
|
||||
for (let i = 0; i < this.length; i++) {
|
||||
total += this[i].encodedLength;
|
||||
}
|
||||
|
||||
return total;
|
||||
}
|
||||
|
||||
public override toU8a (): Uint8Array {
|
||||
// we override, we don't add the length prefix for ourselves, and at the same time we
|
||||
// ignore isBare on entries, since they should be properly encoded at all times
|
||||
const encoded = this.map((entry) => entry.toU8a());
|
||||
const encoded = new Array<Uint8Array>(this.length);
|
||||
|
||||
for (let i = 0; i < this.length; i++) {
|
||||
encoded[i] = this[i].toU8a();
|
||||
}
|
||||
|
||||
return encoded.length
|
||||
? u8aConcat(...encoded)
|
||||
|
||||
@@ -10,10 +10,10 @@ import { hasEq } from './util';
|
||||
export function compareArray (a: unknown[], b?: unknown): boolean {
|
||||
if (Array.isArray(b)) {
|
||||
return (a.length === b.length) && isUndefined(
|
||||
a.find((value, index): boolean =>
|
||||
hasEq(value)
|
||||
? !value.eq(b[index])
|
||||
: value !== b[index]
|
||||
a.find((v, index): boolean =>
|
||||
hasEq(v)
|
||||
? !v.eq(b[index])
|
||||
: v !== b[index]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -19,9 +19,9 @@ function notEntry (value: unknown): boolean {
|
||||
|
||||
function compareMapArray (a: Map<unknown, unknown>, b: [unknown, unknown][]): boolean {
|
||||
// equal number of entries and each entry in the array should match
|
||||
return (a.size === b.length) && !b.some((entry) =>
|
||||
notEntry(entry) ||
|
||||
hasMismatch(a.get(entry[0]), entry[1])
|
||||
return (a.size === b.length) && !b.some((e) =>
|
||||
notEntry(e) ||
|
||||
hasMismatch(a.get(e[0]), e[1])
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import { isObject } from '@polkadot/util';
|
||||
|
||||
function compareSetArray (a: Set<unknown>, b: any[]): boolean {
|
||||
// equal number of entries and each entry in the array should match
|
||||
return (a.size === b.length) && !b.some((entry): boolean => !a.has(entry));
|
||||
return (a.size === b.length) && !b.some((e) => !a.has(e));
|
||||
}
|
||||
|
||||
// NOTE These are used internally and when comparing objects, expects that
|
||||
|
||||
@@ -3,7 +3,19 @@
|
||||
|
||||
import type { Codec, Constructor, Registry } from '../../types';
|
||||
|
||||
import { u8aToHex } from '@polkadot/util';
|
||||
import { isFunction, u8aToHex } from '@polkadot/util';
|
||||
|
||||
function formatFailure (error: Error, key: string, type: string, u8a: Uint8Array): string {
|
||||
return `decodeU8a: failed at ${u8aToHex(u8a)}…${key ? ` on ${key}` : ''}${type ? `: ${type}` : ''}:: ${error.message}`;
|
||||
}
|
||||
|
||||
function getRawType (registry: Registry, Type: Constructor): string {
|
||||
try {
|
||||
return new Type(registry).toRawType();
|
||||
} catch {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an u8a, and an array of Type constructors, decode the u8a against the
|
||||
@@ -13,33 +25,35 @@ import { u8aToHex } from '@polkadot/util';
|
||||
* @param result - The result array (will be returned with values pushed)
|
||||
* @param types - The array of Constructor to decode the U8a against.
|
||||
*/
|
||||
export function decodeU8a <T extends Codec = Codec> (registry: Registry, u8a: Uint8Array, _types: Constructor[] | { [index: string]: Constructor }, _keys?: string[]): T[] {
|
||||
const result: T[] = [];
|
||||
const [types, keys]: [Constructor[], string[]] = Array.isArray(_types)
|
||||
? [_types, _keys || []]
|
||||
: [Object.values(_types), Object.keys(_types)];
|
||||
export function decodeU8a <T extends Codec = Codec, E = T> (registry: Registry, u8a: Uint8Array, types: Constructor | Constructor[] | { [index: string]: Constructor }, count?: number, zip?: (key: string, value: T) => E): [E[], number] {
|
||||
const [Type, Types, keys]: [Constructor | null, Constructor[], string[]] = isFunction(types)
|
||||
? [types, [], []]
|
||||
: Array.isArray(types)
|
||||
? [null, types, []]
|
||||
: [null, Object.values(types), Object.keys(types)];
|
||||
|
||||
count = count || Types.length;
|
||||
|
||||
const result = new Array<E>(count);
|
||||
let offset = 0;
|
||||
|
||||
for (let i = 0; i < types.length; i++) {
|
||||
const Type = types[i];
|
||||
|
||||
for (let i = 0; i < count; i++) {
|
||||
try {
|
||||
const value = new Type(registry, u8a.subarray(offset));
|
||||
const value = new (Type || Types[i])(registry, u8a.subarray(offset));
|
||||
|
||||
result.push(value as T);
|
||||
offset += value.encodedLength;
|
||||
offset += value.initialU8aLength || value.encodedLength;
|
||||
result[i] = zip
|
||||
? zip(keys[i], value as T)
|
||||
: value as unknown as E;
|
||||
} catch (error) {
|
||||
let rawType: string;
|
||||
|
||||
try {
|
||||
rawType = new Type(registry).toRawType();
|
||||
} catch {
|
||||
rawType = '';
|
||||
}
|
||||
|
||||
throw new Error(`decodeU8a: failed at ${u8aToHex(u8a.subarray(offset).slice(0, 8))}… on ${keys[i] ? `${keys[i]}` : ''}${rawType ? `: ${rawType}` : ''}:: ${(error as Error).message}`);
|
||||
throw new Error(formatFailure(
|
||||
error as Error,
|
||||
keys[i],
|
||||
getRawType(registry, Type || Types[i]),
|
||||
u8a.subarray(offset, offset + 8)
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
return [result, offset];
|
||||
}
|
||||
|
||||
@@ -9,11 +9,12 @@ import { typeToConstructor } from './typeToConstructor';
|
||||
* @description takes an input map of the form `{ [string]: string | Constructor }` and returns a map of `{ [string]: Constructor }`
|
||||
*/
|
||||
export function mapToTypeMap (registry: Registry, input: Record<string, string | Constructor>): Record<string, Constructor> {
|
||||
return Object
|
||||
.entries(input)
|
||||
.reduce((output: Record<string, Constructor>, [key, type]): Record<string, Constructor> => {
|
||||
output[key] = typeToConstructor(registry, type);
|
||||
const entries = Object.entries(input);
|
||||
const output: Record<string, Constructor> = {};
|
||||
|
||||
return output;
|
||||
}, {});
|
||||
for (let i = 0; i < entries.length; i++) {
|
||||
output[entries[i][0]] = typeToConstructor(registry, entries[i][1]);
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
@@ -5,13 +5,17 @@ import type { U8aBitLength, UIntBitLength } from '../codec/types';
|
||||
import type { Codec, Constructor, DetectConstructor, Registry } from '../types';
|
||||
import type { TypeDef } from './types';
|
||||
|
||||
import { assert, isNumber, isUndefined, stringify } from '@polkadot/util';
|
||||
import { assert, isNumber, stringify } from '@polkadot/util';
|
||||
|
||||
import { BTreeMap, BTreeSet, CodecSet, Compact, DoNotConstruct, Enum, HashMap, Int, Option, Range, RangeInclusive, Result, Struct, Tuple, U8aFixed, UInt, Vec, VecFixed, WrapperOpaque } from '../codec';
|
||||
import { Bytes, Null } from '../primitive';
|
||||
import { getTypeDef } from './getTypeDef';
|
||||
import { TypeDefInfo } from './types';
|
||||
|
||||
function getTypeDefType ({ lookupName, type }: TypeDef): string {
|
||||
return lookupName || type;
|
||||
}
|
||||
|
||||
function getSubDefArray (value: TypeDef): TypeDef[] {
|
||||
assert(value.sub && Array.isArray(value.sub), () => `Expected subtype as TypeDef[] in ${stringify(value)}`);
|
||||
|
||||
@@ -25,23 +29,24 @@ function getSubDef (value: TypeDef): TypeDef {
|
||||
}
|
||||
|
||||
function getSubType (value: TypeDef): string {
|
||||
return getSubDef(value).type;
|
||||
return getTypeDefType(getSubDef(value));
|
||||
}
|
||||
|
||||
// create a maps of type string constructors from the input
|
||||
function getTypeClassMap (value: TypeDef): Record<string, string> {
|
||||
const result: Record<string, string> = {};
|
||||
const subs = getSubDefArray(value);
|
||||
const map: Record<string, string> = {};
|
||||
|
||||
return getSubDefArray(value).reduce<Record<string, string>>((result, sub) => {
|
||||
result[sub.name as string] = sub.type;
|
||||
for (let i = 0; i < subs.length; i++) {
|
||||
map[subs[i].name as string] = getTypeDefType(subs[i]);
|
||||
}
|
||||
|
||||
return result;
|
||||
}, result);
|
||||
return map;
|
||||
}
|
||||
|
||||
// create an array of type string constructors from the input
|
||||
function getTypeClassArray (value: TypeDef): string[] {
|
||||
return getSubDefArray(value).map(({ type }) => type);
|
||||
return getSubDefArray(value).map(getTypeDefType);
|
||||
}
|
||||
|
||||
function createInt ({ displayName, length }: TypeDef, Clazz: typeof Int | typeof UInt): Constructor<Codec> {
|
||||
@@ -124,18 +129,15 @@ const infoMapping: Record<TypeDefInfo, (registry: Registry, value: TypeDef) => C
|
||||
return Result.with({ Err, Ok });
|
||||
},
|
||||
|
||||
[TypeDefInfo.Set]: (registry: Registry, value: TypeDef): Constructor<Codec> => {
|
||||
const result: Record<string, number> = {};
|
||||
|
||||
return CodecSet.with(
|
||||
[TypeDefInfo.Set]: (registry: Registry, value: TypeDef): Constructor<Codec> =>
|
||||
CodecSet.with(
|
||||
getSubDefArray(value).reduce<Record<string, number>>((result, { index, name }) => {
|
||||
result[name as string] = index as number;
|
||||
|
||||
return result;
|
||||
}, result),
|
||||
}, {}),
|
||||
value.length
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
[TypeDefInfo.Si]: (registry: Registry, value: TypeDef): Constructor<Codec> =>
|
||||
getTypeClass(registry, registry.lookup.getTypeDef(value.type)),
|
||||
@@ -149,25 +151,23 @@ const infoMapping: Record<TypeDefInfo, (registry: Registry, value: TypeDef) => C
|
||||
[TypeDefInfo.UInt]: (registry: Registry, value: TypeDef): Constructor<Codec> =>
|
||||
createInt(value, UInt),
|
||||
|
||||
[TypeDefInfo.Vec]: (registry: Registry, value: TypeDef): Constructor<Codec> => {
|
||||
const subType = getSubType(value);
|
||||
[TypeDefInfo.Vec]: (registry: Registry, { sub }: TypeDef): Constructor<Codec> => {
|
||||
assert(sub && !Array.isArray(sub), 'Expected type information for vector');
|
||||
|
||||
return (
|
||||
subType === 'u8'
|
||||
sub.type === 'u8'
|
||||
? Bytes
|
||||
: Vec.with(subType)
|
||||
: Vec.with(getTypeDefType(sub))
|
||||
);
|
||||
},
|
||||
|
||||
[TypeDefInfo.VecFixed]: (registry: Registry, { displayName, length, sub }: TypeDef): Constructor<Codec> => {
|
||||
assert(isNumber(length) && !isUndefined(sub), 'Expected length & type information for fixed vector');
|
||||
|
||||
const subType = (sub as TypeDef).type;
|
||||
assert(sub && isNumber(length) && !Array.isArray(sub), 'Expected length & type information for fixed vector');
|
||||
|
||||
return (
|
||||
subType === 'u8'
|
||||
sub.type === 'u8'
|
||||
? U8aFixed.with((length * 8) as U8aBitLength, displayName)
|
||||
: VecFixed.with(subType, length)
|
||||
: VecFixed.with(getTypeDefType(sub), length)
|
||||
);
|
||||
},
|
||||
|
||||
|
||||
@@ -44,10 +44,13 @@ function encodeSubTypes (registry: Registry, sub: TypeDef[], asEnum?: boolean, e
|
||||
|
||||
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(registry, type)
|
||||
}), { ...(extra as Record<string, string>) });
|
||||
const inner: Record<string, string> = { ...(extra as Record<string, string>) };
|
||||
|
||||
for (let i = 0; i < sub.length; i++) {
|
||||
const def = sub[i];
|
||||
|
||||
inner[def.name as string] = encodeTypeDef(registry, def);
|
||||
}
|
||||
|
||||
return stringify(
|
||||
asEnum
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { ExtDef } from '../extrinsic/signedExtensions/types';
|
||||
import type { ChainProperties, CodecHash, DispatchErrorModule, Hash, MetadataLatest, PortableRegistry, SiLookupTypeId } from '../interfaces/types';
|
||||
import type { ChainProperties, CodecHash, DispatchErrorModule, Hash, MetadataLatest, PortableRegistry, SiLookupTypeId, SiVariant } from '../interfaces/types';
|
||||
import type { Text } from '../primitive/Text';
|
||||
import type { CallFunction, Codec, CodecHasher, Constructor, DetectCodec, DetectConstructor, RegisteredTypes, Registry, RegistryError, RegistryTypes } from '../types';
|
||||
import type { CreateOptions } from './types';
|
||||
|
||||
@@ -16,89 +17,104 @@ import { expandExtensionTypes, fallbackExtensions, findUnknownExtensions } from
|
||||
import { GenericEventData } from '../generic/Event';
|
||||
import * as baseTypes from '../index.types';
|
||||
import * as definitions from '../interfaces/definitions';
|
||||
import { decorateConstants, decorateExtrinsics } from '../metadata/decorate';
|
||||
import { decorateConstants, decorateExtrinsics, filterEventsSome } from '../metadata/decorate';
|
||||
import { Metadata } from '../metadata/Metadata';
|
||||
import { createClass } from './createClass';
|
||||
import { createTypeUnsafe } from './createType';
|
||||
|
||||
const l = logger('registry');
|
||||
|
||||
function getVariantArgs (lookup: PortableRegistry, { fields }: SiVariant): string[] {
|
||||
const args = new Array<string>(fields.length);
|
||||
|
||||
for (let i = 0; i < fields.length; i++) {
|
||||
args[i] = lookup.getTypeDef(fields[i].type).type;
|
||||
}
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
function valueToString (v: Text): string {
|
||||
return v.toString();
|
||||
}
|
||||
|
||||
// create error mapping from metadata
|
||||
function injectErrors (_: Registry, metadata: Metadata, metadataErrors: Record<string, RegistryError>): void {
|
||||
const { lookup, pallets } = metadata.asLatest;
|
||||
|
||||
// decorate the errors
|
||||
pallets.forEach(({ errors, index, name }, _sectionIndex): void => {
|
||||
if (errors.isNone) {
|
||||
return;
|
||||
for (let i = 0; i < pallets.length; i++) {
|
||||
const { errors, index, name } = pallets[i];
|
||||
|
||||
if (errors.isSome) {
|
||||
const sectionIndex = metadata.version >= 12
|
||||
? index.toNumber()
|
||||
: i;
|
||||
const sectionName = stringCamelCase(name);
|
||||
const { variants } = lookup.getSiType(errors.unwrap().type).def.asVariant;
|
||||
|
||||
for (let i = 0; i < variants.length; i++) {
|
||||
const { docs, fields, index, name } = variants[i];
|
||||
const variantIndex = index.toNumber();
|
||||
|
||||
metadataErrors[u8aToHex(new Uint8Array([sectionIndex, variantIndex]))] = {
|
||||
args: getVariantArgs(lookup, variants[i]),
|
||||
docs: docs.map(valueToString),
|
||||
fields,
|
||||
index: variantIndex,
|
||||
method: name.toString(),
|
||||
name: name.toString(),
|
||||
section: sectionName
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
const sectionIndex = metadata.version >= 12
|
||||
? index.toNumber()
|
||||
: _sectionIndex;
|
||||
const sectionName = stringCamelCase(name);
|
||||
|
||||
lookup.getSiType(errors.unwrap().type).def.asVariant.variants.forEach(({ docs, fields, index, name }): void => {
|
||||
const variantIndex = index.toNumber();
|
||||
const eventIndex = new Uint8Array([sectionIndex, variantIndex]);
|
||||
|
||||
metadataErrors[u8aToHex(eventIndex)] = {
|
||||
args: fields.map(({ type }) =>
|
||||
lookup.getTypeDef(type).type
|
||||
),
|
||||
docs: docs.map((d) => d.toString()),
|
||||
fields,
|
||||
index: variantIndex,
|
||||
method: name.toString(),
|
||||
name: name.toString(),
|
||||
section: sectionName
|
||||
};
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// create event classes from metadata
|
||||
function injectEvents (registry: Registry, metadata: Metadata, metadataEvents: Record<string, Constructor<GenericEventData>>): void {
|
||||
const { lookup, pallets } = metadata.asLatest;
|
||||
const filtered = pallets.filter(filterEventsSome);
|
||||
|
||||
// decorate the events
|
||||
pallets
|
||||
.filter(({ events }) => events.isSome)
|
||||
.forEach(({ events, index, name }, _sectionIndex): void => {
|
||||
const sectionIndex = metadata.version >= 12
|
||||
? index.toNumber()
|
||||
: _sectionIndex;
|
||||
const sectionName = stringCamelCase(name);
|
||||
for (let i = 0; i < filtered.length; i++) {
|
||||
const { events, index, name } = filtered[i];
|
||||
|
||||
lookup.getSiType(events.unwrap().type).def.asVariant.variants.forEach((variant): void => {
|
||||
const variantIndex = variant.index.toNumber();
|
||||
const eventIndex = new Uint8Array([sectionIndex, variantIndex]);
|
||||
const meta = registry.createType('EventMetadataLatest', {
|
||||
...variant,
|
||||
args: variant.fields.map(({ type }) =>
|
||||
lookup.getTypeDef(type).type
|
||||
)
|
||||
});
|
||||
const sectionIndex = metadata.version >= 12
|
||||
? index.toNumber()
|
||||
: i;
|
||||
const sectionName = stringCamelCase(name);
|
||||
const { variants } = lookup.getSiType(events.unwrap().type).def.asVariant;
|
||||
|
||||
metadataEvents[u8aToHex(eventIndex)] = class extends GenericEventData {
|
||||
constructor (registry: Registry, value: Uint8Array) {
|
||||
super(registry, value, meta, sectionName, variant.name.toString());
|
||||
}
|
||||
};
|
||||
for (let i = 0; i < variants.length; i++) {
|
||||
const { index, name } = variants[i];
|
||||
const meta = registry.createType('EventMetadataLatest', {
|
||||
...variants[i],
|
||||
args: getVariantArgs(lookup, variants[i])
|
||||
});
|
||||
});
|
||||
|
||||
metadataEvents[u8aToHex(new Uint8Array([sectionIndex, index.toNumber()]))] = class extends GenericEventData {
|
||||
constructor (registry: Registry, value: Uint8Array) {
|
||||
super(registry, value, meta, sectionName, name.toString());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// create extrinsic mapping from metadata
|
||||
function injectExtrinsics (registry: Registry, metadata: Metadata, metadataCalls: Record<string, CallFunction>): void {
|
||||
const extrinsics = decorateExtrinsics(registry, metadata.asLatest, metadata.version);
|
||||
const sections = Object.values(extrinsics);
|
||||
|
||||
// decorate the extrinsics
|
||||
Object.values(extrinsics).forEach((methods): void =>
|
||||
Object.values(methods).forEach((method): void => {
|
||||
for (let i = 0; i < sections.length; i++) {
|
||||
const methods = Object.values(sections[i]);
|
||||
|
||||
for (let j = 0; j < methods.length; j++) {
|
||||
const method = methods[j];
|
||||
|
||||
metadataCalls[u8aToHex(method.callIndex)] = method;
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// extract additional properties from the metadata
|
||||
@@ -169,9 +185,12 @@ export class TypeRegistry implements Registry {
|
||||
|
||||
// register know, first classes then on-demand-created definitions
|
||||
this.register(this.#knownDefaults);
|
||||
Object.values(this.#knownDefinitions).forEach(({ types }): void =>
|
||||
this.register(types)
|
||||
);
|
||||
|
||||
const allKnown = Object.values(this.#knownDefinitions);
|
||||
|
||||
for (let i = 0; i < allKnown.length; i++) {
|
||||
this.register(allKnown[i].types);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
@@ -199,7 +218,7 @@ export class TypeRegistry implements Registry {
|
||||
const allTokens = this.#chainProperties.tokenSymbol.unwrap();
|
||||
|
||||
if (allTokens.length) {
|
||||
return allTokens.map((s) => s.toString());
|
||||
return allTokens.map(valueToString);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -332,11 +351,16 @@ export class TypeRegistry implements Registry {
|
||||
// we cannot rely on export order (anymore, since babel/core 7.15.8), so in the case of
|
||||
// items such as u32 & U32, we get the lowercase versions here... not quite as optimal
|
||||
// (previously this used to be a simple find & return)
|
||||
const names = [...this.#classes.entries()]
|
||||
.filter(([, Clazz]) => Type === Clazz)
|
||||
.map(([name]) => name)
|
||||
.sort()
|
||||
.reverse();
|
||||
const names: string[] = [];
|
||||
|
||||
for (const [name, Clazz] of this.#classes.entries()) {
|
||||
if (Type === Clazz) {
|
||||
names.push(name);
|
||||
}
|
||||
}
|
||||
|
||||
// both sort and reverse are done in-place
|
||||
names.sort().reverse();
|
||||
|
||||
return names.length
|
||||
? names[0]
|
||||
@@ -408,7 +432,11 @@ export class TypeRegistry implements Registry {
|
||||
}
|
||||
|
||||
private _registerObject (obj: RegistryTypes): void {
|
||||
Object.entries(obj).forEach(([name, type]): void => {
|
||||
const entries = Object.entries(obj);
|
||||
|
||||
for (let e = 0; e < entries.length; e++) {
|
||||
const [name, type] = entries[e];
|
||||
|
||||
if (isFunction(type)) {
|
||||
// This _looks_ a bit funny, but `typeof Clazz === 'function'
|
||||
this.#classes.set(name, type);
|
||||
@@ -426,7 +454,7 @@ export class TypeRegistry implements Registry {
|
||||
|
||||
this.#definitions.set(name, def);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// sets the chain properties
|
||||
|
||||
@@ -230,7 +230,11 @@ export function removeWrap (check: string): Mapper {
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
export function sanitize (value: String | string, options?: SanitizeOptions): string {
|
||||
return mappings.reduce<string>((result, fn) =>
|
||||
fn(result, options), value.toString()
|
||||
).trim();
|
||||
let result = value.toString();
|
||||
|
||||
for (let i = 0; i < mappings.length; i++) {
|
||||
result = mappings[i](result, options);
|
||||
}
|
||||
|
||||
return result.trim();
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { BN } from '@polkadot/util';
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { Registry } from '../types';
|
||||
|
||||
import { isBigInt, isBn, isHex, isNumber, isU8a, u8aConcat, u8aToBn, u8aToHex, u8aToU8a } from '@polkadot/util';
|
||||
@@ -92,7 +93,7 @@ export class GenericEthereumLookupSource extends Base<GenericEthereumAccountId |
|
||||
/**
|
||||
* @description Returns a hex string representation of the value
|
||||
*/
|
||||
public override toHex (): string {
|
||||
public override toHex (): HexString {
|
||||
return u8aToHex(this.toU8a());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { EcdsaSignature, Ed25519Signature, ExtrinsicUnknown, ExtrinsicV4, Sr25519Signature } from '../interfaces/extrinsics';
|
||||
import type { FunctionMetadataLatest } from '../interfaces/metadata';
|
||||
import type { Address, Balance, Call, Index } from '../interfaces/runtime';
|
||||
@@ -216,7 +217,7 @@ export class GenericExtrinsic<A extends AnyTuple = AnyTuple> extends ExtrinsicBa
|
||||
/**
|
||||
* @description Injects an already-generated signature into the extrinsic
|
||||
*/
|
||||
public addSignature (signer: Address | Uint8Array | string, signature: Uint8Array | string, payload: ExtrinsicPayloadValue | Uint8Array | string): GenericExtrinsic<A> {
|
||||
public addSignature (signer: Address | Uint8Array | string, signature: Uint8Array | HexString, payload: ExtrinsicPayloadValue | Uint8Array | HexString): GenericExtrinsic<A> {
|
||||
(this._raw as ExtrinsicVx).addSignature(signer, signature, payload);
|
||||
|
||||
return this;
|
||||
@@ -243,7 +244,7 @@ export class GenericExtrinsic<A extends AnyTuple = AnyTuple> extends ExtrinsicBa
|
||||
/**
|
||||
* @description Returns a hex string representation of the value
|
||||
*/
|
||||
public override toHex (isBare?: boolean): string {
|
||||
public override toHex (isBare?: boolean): HexString {
|
||||
return u8aToHex(this.toU8a(isBare));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { ExtrinsicPayloadV4 } from '../interfaces/extrinsics';
|
||||
import type { Balance, Hash, Index } from '../interfaces/runtime';
|
||||
import type { AnyJson, BareOpts, ExtrinsicPayloadValue, IKeyringPair, Registry } from '../types';
|
||||
@@ -119,7 +120,7 @@ export class GenericExtrinsicPayload extends Base<ExtrinsicPayloadVx> {
|
||||
/**
|
||||
* @description Sign the payload with the keypair
|
||||
*/
|
||||
public sign (signerPair: IKeyringPair): { signature: string } {
|
||||
public sign (signerPair: IKeyringPair): { signature: HexString } {
|
||||
const signature = this._raw.sign(signerPair);
|
||||
|
||||
// This is extensible, so we could quite readily extend to send back extra
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { Address, Balance, BlockNumber, Call, ExtrinsicEra, Hash, Index, RuntimeVersion } from '../interfaces';
|
||||
import type { Codec, ISignerPayload, Registry, SignerPayloadJSON, SignerPayloadRaw } from '../types';
|
||||
|
||||
@@ -49,7 +50,7 @@ const knownTypes: Record<string, string> = {
|
||||
export class GenericSignerPayload extends Struct implements ISignerPayload, SignerPayloadType {
|
||||
private readonly _extraTypes: Record<string, string>;
|
||||
|
||||
constructor (registry: Registry, value?: string | { [x: string]: any; } | Map<unknown, unknown> | unknown[]) {
|
||||
constructor (registry: Registry, value?: HexString | { [x: string]: unknown; } | Map<unknown, unknown> | unknown[]) {
|
||||
const extensionTypes = {
|
||||
...registry.getSignedExtensionTypes(),
|
||||
...registry.getSignedExtensionExtra()
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { ExtrinsicSignatureV4 } from '../../interfaces/extrinsics';
|
||||
import type { Address, Call } from '../../interfaces/runtime';
|
||||
import type { ExtrinsicPayloadValue, IExtrinsicImpl, IKeyringPair, Registry, SignatureOptions } from '../../types';
|
||||
@@ -82,7 +83,7 @@ export class GenericExtrinsicV4 extends Struct implements IExtrinsicImpl {
|
||||
/**
|
||||
* @description Add an [[ExtrinsicSignatureV4]] to the extrinsic (already generated)
|
||||
*/
|
||||
public addSignature (signer: Address | Uint8Array | string, signature: Uint8Array | string, payload: ExtrinsicPayloadValue | Uint8Array | string): GenericExtrinsicV4 {
|
||||
public addSignature (signer: Address | Uint8Array | string, signature: Uint8Array | HexString, payload: ExtrinsicPayloadValue | Uint8Array | HexString): GenericExtrinsicV4 {
|
||||
this.signature.addSignature(signer, signature, payload);
|
||||
|
||||
return this;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { SignOptions } from '@polkadot/keyring/types';
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { ExtrinsicEra } from '../../interfaces/extrinsics';
|
||||
import type { AssetId, Balance, Hash, Index } from '../../interfaces/runtime';
|
||||
import type { ExtrinsicPayloadValue, IKeyringPair, Registry } from '../../types';
|
||||
@@ -23,7 +24,7 @@ import { sign } from '../util';
|
||||
export class GenericExtrinsicPayloadV4 extends Struct {
|
||||
#signOptions: SignOptions;
|
||||
|
||||
constructor (registry: Registry, value?: ExtrinsicPayloadValue | Uint8Array | string) {
|
||||
constructor (registry: Registry, value?: ExtrinsicPayloadValue | Uint8Array | HexString) {
|
||||
super(registry, {
|
||||
method: 'Bytes',
|
||||
...registry.getSignedExtensionTypes(),
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { EcdsaSignature, Ed25519Signature, ExtrinsicEra, ExtrinsicSignature, Sr25519Signature } from '../../interfaces/extrinsics';
|
||||
import type { Address, AssetId, Balance, Call, Index } from '../../interfaces/runtime';
|
||||
import type { ExtrinsicPayloadValue, IExtrinsicSignature, IKeyringPair, Registry, SignatureOptions } from '../../types';
|
||||
@@ -137,7 +138,7 @@ export class GenericExtrinsicSignatureV4 extends Struct implements IExtrinsicSig
|
||||
/**
|
||||
* @description Adds a raw signature
|
||||
*/
|
||||
public addSignature (signer: Address | Uint8Array | string, signature: Uint8Array | string, payload: ExtrinsicPayloadValue | Uint8Array | string): IExtrinsicSignature {
|
||||
public addSignature (signer: Address | Uint8Array | string, signature: Uint8Array | HexString, payload: ExtrinsicPayloadValue | Uint8Array | HexString): IExtrinsicSignature {
|
||||
return this._injectSignature(
|
||||
toAddress(this.registry, signer),
|
||||
this.registry.createType('ExtrinsicSignature', signature),
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { FunctionMetadataLatest } from '../interfaces/metadata';
|
||||
import type { AnyJson, AnyTuple, AnyU8a, ArgsDef, CallBase, CallFunction, IMethod, InterfaceTypes, Registry } from '../types';
|
||||
import type { AnyJson, AnyTuple, AnyU8a, ArgsDef, CallBase, CallFunction, Codec, IMethod, InterfaceTypes, Registry } from '../types';
|
||||
|
||||
import { isHex, isObject, isU8a, u8aToU8a } from '@polkadot/util';
|
||||
|
||||
@@ -145,7 +145,6 @@ export class GenericCall<A extends AnyTuple = AnyTuple> extends Struct implement
|
||||
* @description The arguments for the function call
|
||||
*/
|
||||
public get args (): A {
|
||||
// FIXME This should return a Struct instead of an Array
|
||||
return [...(this.get('args') as Struct).values()] as A;
|
||||
}
|
||||
|
||||
@@ -156,6 +155,13 @@ export class GenericCall<A extends AnyTuple = AnyTuple> extends Struct implement
|
||||
return getArgsDef(this.registry, this.meta);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The argument entries
|
||||
*/
|
||||
public get argsEntries (): [string, Codec][] {
|
||||
return [...(this.get('args') as Struct).entries()];
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The encoded `[sectionIndex, methodIndex]` identifier
|
||||
*/
|
||||
@@ -211,12 +217,10 @@ export class GenericCall<A extends AnyTuple = AnyTuple> extends Struct implement
|
||||
}
|
||||
|
||||
return {
|
||||
args: this.args.map((arg) => arg.toHuman(isExpanded)),
|
||||
// args: this.args.map((arg, index) => call
|
||||
// ? { [call.meta.args[index].name.toString()]: arg.toHuman(isExpanded) }
|
||||
// : arg.toHuman(isExpanded)
|
||||
// ),
|
||||
// callIndex: u8aToHex(this.callIndex),
|
||||
args: this.argsEntries.reduce<Record<string, AnyJson>>((args, [n, a]) => ({
|
||||
...args,
|
||||
[n]: a.toHuman(isExpanded)
|
||||
}), {}),
|
||||
method: call?.method,
|
||||
section: call?.section,
|
||||
...(isExpanded && call
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { BN } from '@polkadot/util';
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { Registry } from '../types';
|
||||
|
||||
import { isBigInt, isBn, isHex, isNumber, isU8a, u8aConcat, u8aToBn, u8aToHex, u8aToU8a } from '@polkadot/util';
|
||||
@@ -92,7 +93,7 @@ export class GenericLookupSource extends Base<GenericAccountId | GenericAccountI
|
||||
/**
|
||||
* @description Returns a hex string representation of the value
|
||||
*/
|
||||
public override toHex (): string {
|
||||
public override toHex (): HexString {
|
||||
return u8aToHex(this.toU8a());
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ const PRIMITIVE_ALIAS: Record<string, string> = {
|
||||
};
|
||||
|
||||
// These are types where we have a specific decoding/encoding override + helpers
|
||||
const PRIMITIVE_PATHS = [
|
||||
const PATHS_PRIMITIVE = splitNamespace([
|
||||
// match {node, polkadot, ...}_runtime
|
||||
'*_runtime::Call',
|
||||
'*_runtime::Event',
|
||||
@@ -36,17 +36,19 @@ const PRIMITIVE_PATHS = [
|
||||
'sp_core::crypto::AccountId32',
|
||||
'sp_runtime::generic::era::Era',
|
||||
'sp_runtime::multiaddress::MultiAddress',
|
||||
// ethereum overrides
|
||||
'polkadot_runtime_common::claims::EthereumAddress',
|
||||
// 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 = [
|
||||
const PATHS_SET = splitNamespace([
|
||||
'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', 'WrapperOpaque'];
|
||||
@@ -54,6 +56,14 @@ const WRAPPERS = ['BoundedBTreeMap', 'BoundedVec', 'Box', 'BTreeMap', 'Cow', 'Re
|
||||
// These are reserved and/or conflicts with built-in Codec or JS definitions
|
||||
const RESERVED = ['entries', 'hash', 'keys', 'new', 'size'];
|
||||
|
||||
function splitNamespace (values: string[]): string[][] {
|
||||
return values.map((v) => v.split('::'));
|
||||
}
|
||||
|
||||
function sanitizeDocs (docs: Text[]): string[] {
|
||||
return docs.map((d) => d.toString());
|
||||
}
|
||||
|
||||
function matchParts (first: string[], second: (string | Text)[]): boolean {
|
||||
return first.length === second.length && first.every((a, index) => {
|
||||
const b = second[index].toString();
|
||||
@@ -83,7 +93,7 @@ function matchParts (first: string[], second: (string | Text)[]): boolean {
|
||||
// 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))
|
||||
return path.length && PATHS_PRIMITIVE.some((p) => matchParts(p, path))
|
||||
? path[path.length - 1].toString()
|
||||
: null;
|
||||
}
|
||||
@@ -184,9 +194,9 @@ function extractName (types: PortableType[], { id, type: { params, path } }: Por
|
||||
.map((p) => stringUpperFirst(stringCamelCase(p)))
|
||||
.filter((p, index) =>
|
||||
(
|
||||
// Remove ::{pallet, traits, types}::
|
||||
// Remove ::{misc, pallet, traits, types}::
|
||||
index !== 1 ||
|
||||
!['Pallet', 'Traits', 'Types'].includes(p.toString())
|
||||
!['Misc', 'Pallet', 'Traits', 'Types'].includes(p.toString())
|
||||
) &&
|
||||
(
|
||||
// sp_runtime::generic::digest::Digest -> sp_runtime::generic::Digest
|
||||
@@ -214,17 +224,17 @@ function extractNames (lookup: GenericPortableRegistry, types: PortableType[]):
|
||||
extractName(types, t)
|
||||
));
|
||||
|
||||
const [names, typesNew] = dedup.reduce<[Record<number, string>, Record<string, string>]>(([names, types], [lookupIndex, name]) => {
|
||||
// We set the name for this specific type
|
||||
const names: Record<number, string> = {};
|
||||
const lookups: Record<string, string> = {};
|
||||
|
||||
for (let i = 0; i < dedup.length; i++) {
|
||||
const [lookupIndex, name] = dedup[i];
|
||||
|
||||
names[lookupIndex] = name;
|
||||
lookups[name] = lookup.registry.createLookupType(lookupIndex);
|
||||
}
|
||||
|
||||
// we map to the actual lookupIndex
|
||||
types[name] = lookup.registry.createLookupType(lookupIndex);
|
||||
|
||||
return [names, types];
|
||||
}, [{}, {}]);
|
||||
|
||||
lookup.registry.register(typesNew);
|
||||
lookup.registry.register(lookups);
|
||||
|
||||
return names;
|
||||
}
|
||||
@@ -232,11 +242,15 @@ function extractNames (lookup: GenericPortableRegistry, types: PortableType[]):
|
||||
// types have an id, which means they are to be named by
|
||||
// the specified id - ensure we have a mapping lookup for these
|
||||
function extractTypeMap (types: PortableType[]): Record<number, PortableType> {
|
||||
return types.reduce<Record<number, PortableType>>((types, pt) => {
|
||||
types[pt.id.toNumber()] = pt;
|
||||
const result: Record<number, PortableType> = {};
|
||||
|
||||
return types;
|
||||
}, {});
|
||||
for (let i = 0; i < types.length; i++) {
|
||||
const p = types[i];
|
||||
|
||||
result[p.id.toNumber()] = p;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
export class GenericPortableRegistry extends Struct {
|
||||
@@ -390,7 +404,7 @@ export class GenericPortableRegistry extends Struct {
|
||||
}
|
||||
|
||||
return {
|
||||
docs: type.docs.map((d) => d.toString()),
|
||||
docs: sanitizeDocs(type.docs),
|
||||
namespace,
|
||||
...typeDef
|
||||
};
|
||||
@@ -451,14 +465,21 @@ export class GenericPortableRegistry extends Struct {
|
||||
)
|
||||
}))
|
||||
});
|
||||
} else if (path.length && path[path.length - 1].toString() === 'WrapperOpaque') {
|
||||
return withTypeString(this.registry, {
|
||||
info: TypeDefInfo.WrapperOpaque,
|
||||
sub: this.#createSiDef(params[0].type.unwrap())
|
||||
});
|
||||
} else if (path.length) {
|
||||
if (path[path.length - 1].toString() === 'WrapperOpaque') {
|
||||
return withTypeString(this.registry, {
|
||||
info: TypeDefInfo.WrapperOpaque,
|
||||
sub: this.#createSiDef(params[0].type.unwrap())
|
||||
});
|
||||
} else if (path[path.length - 1].toString() === 'WrapperKeepOpaque') {
|
||||
return {
|
||||
info: TypeDefInfo.Plain,
|
||||
type: 'Bytes'
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return SETS.some((p) => matchParts(p, path))
|
||||
return PATHS_SET.some((p) => matchParts(p, path))
|
||||
? this.#extractCompositeSet(lookupIndex, params, fields)
|
||||
: this.#extractFields(lookupIndex, fields);
|
||||
}
|
||||
@@ -480,11 +501,15 @@ export class GenericPortableRegistry extends Struct {
|
||||
}
|
||||
|
||||
#extractFields (lookupIndex: number, fields: SiField[]): TypeDef {
|
||||
const [isStruct, isTuple] = fields.reduce(([isAllNamed, isAllUnnamed], { name }) => ([
|
||||
isAllNamed && name.isSome,
|
||||
isAllUnnamed && name.isNone
|
||||
]),
|
||||
[true, true]);
|
||||
let isStruct = true;
|
||||
let isTuple = true;
|
||||
|
||||
for (let f = 0; f < fields.length; f++) {
|
||||
const { name } = fields[f];
|
||||
|
||||
isStruct = isStruct && name.isSome;
|
||||
isTuple = isTuple && name.isNone;
|
||||
}
|
||||
|
||||
assert(isTuple || isStruct, 'Invalid fields type detected, expected either Tuple (all unnamed) or Struct (all named)');
|
||||
|
||||
@@ -538,38 +563,41 @@ export class GenericPortableRegistry extends Struct {
|
||||
|
||||
#extractFieldsAlias (fields: SiField[]): [TypeDef[], Map<string, string>] {
|
||||
const alias = new Map<string, string>();
|
||||
const sub = fields.map(({ docs, name, type, typeName }) => {
|
||||
const sub = new Array<TypeDef>(fields.length);
|
||||
|
||||
for (let i = 0; i < fields.length; i++) {
|
||||
const { docs, name, type, typeName } = fields[i];
|
||||
const typeDef = this.#createSiDef(type);
|
||||
|
||||
if (name.isNone) {
|
||||
return typeDef;
|
||||
sub[i] = typeDef;
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
|
||||
sub[i] = {
|
||||
...typeDef,
|
||||
docs: sanitizeDocs(docs),
|
||||
name: nameField,
|
||||
...(typeName.isSome
|
||||
? { typeName: sanitize(typeName.unwrap()) }
|
||||
: {}
|
||||
)
|
||||
};
|
||||
}
|
||||
|
||||
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,
|
||||
...(typeName.isSome
|
||||
? { typeName: sanitize(typeName.unwrap()) }
|
||||
: {}
|
||||
)
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
return [sub, alias];
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import type { Definitions } from '../../types';
|
||||
export default {
|
||||
rpc: {},
|
||||
types: {
|
||||
EthereumAddress: 'H160',
|
||||
StatementKind: {
|
||||
_enum: ['Regular', 'Saft']
|
||||
}
|
||||
|
||||
@@ -2,10 +2,6 @@
|
||||
/* eslint-disable */
|
||||
|
||||
import type { Enum } from '@polkadot/types';
|
||||
import type { H160 } from '@polkadot/types/interfaces/runtime';
|
||||
|
||||
/** @name EthereumAddress */
|
||||
export interface EthereumAddress extends H160 {}
|
||||
|
||||
/** @name StatementKind */
|
||||
export interface StatementKind extends Enum {
|
||||
|
||||
@@ -89,6 +89,7 @@ const types: DefinitionsTypes = {
|
||||
...V1,
|
||||
...V2,
|
||||
EthereumAccountId: 'GenericEthereumAccountId',
|
||||
EthereumAddress: 'GenericEthereumAccountId',
|
||||
EthereumLookupSource: 'GenericEthereumLookupSource',
|
||||
EthereumSignature: '[u8; 65]',
|
||||
EthAccessListItem: {
|
||||
|
||||
@@ -103,6 +103,9 @@ export interface EthCallRequest extends Struct {
|
||||
/** @name EthereumAccountId */
|
||||
export interface EthereumAccountId extends GenericEthereumAccountId {}
|
||||
|
||||
/** @name EthereumAddress */
|
||||
export interface EthereumAddress extends GenericEthereumAccountId {}
|
||||
|
||||
/** @name EthereumLookupSource */
|
||||
export interface EthereumLookupSource extends GenericEthereumLookupSource {}
|
||||
|
||||
|
||||
@@ -31,10 +31,14 @@ export class MetadataVersioned extends Struct {
|
||||
readonly #converted = new Map<MetaVersions, MetaMapped>();
|
||||
|
||||
constructor (registry: Registry, value?: unknown) {
|
||||
// console.time('MetadataVersioned')
|
||||
|
||||
super(registry, {
|
||||
magicNumber: MagicNumber,
|
||||
metadata: 'MetadataAll'
|
||||
}, value as Map<unknown, unknown>);
|
||||
|
||||
// console.timeEnd('MetadataVersioned')
|
||||
}
|
||||
|
||||
#assertVersion = (version: number): boolean => {
|
||||
|
||||
@@ -10,21 +10,26 @@ import { hexToU8a, stringCamelCase } from '@polkadot/util';
|
||||
/** @internal */
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
export function decorateConstants (registry: Registry, { pallets }: MetadataLatest, _metaVersion: number): Constants {
|
||||
return pallets.reduce((result: Constants, { constants, name }): Constants => {
|
||||
if (constants.isEmpty) {
|
||||
return result;
|
||||
const result: Constants = {};
|
||||
|
||||
for (let p = 0; p < pallets.length; p++) {
|
||||
const { constants, name } = pallets[p];
|
||||
|
||||
if (!constants.isEmpty) {
|
||||
const newModule: ModuleConstants = {};
|
||||
|
||||
for (let c = 0; c < constants.length; c++) {
|
||||
const meta = constants[c];
|
||||
const codec = registry.createTypeUnsafe(registry.createLookupType(meta.type), [hexToU8a(meta.value.toHex())]) as unknown;
|
||||
|
||||
(codec as Record<string, unknown>).meta = meta;
|
||||
newModule[stringCamelCase(meta.name)] = codec as ConstantCodec;
|
||||
}
|
||||
|
||||
// For access, we change the index names, i.e. Democracy.EnactmentPeriod -> democracy.enactmentPeriod
|
||||
result[stringCamelCase(name)] = newModule;
|
||||
}
|
||||
}
|
||||
|
||||
// For access, we change the index names, i.e. Democracy.EnactmentPeriod -> democracy.enactmentPeriod
|
||||
result[stringCamelCase(name)] = constants.reduce((newModule: ModuleConstants, meta): ModuleConstants => {
|
||||
const codec = registry.createTypeUnsafe(registry.createLookupType(meta.type), [hexToU8a(meta.value.toHex())]) as unknown;
|
||||
|
||||
(codec as Record<string, unknown>).meta = meta;
|
||||
newModule[stringCamelCase(meta.name)] = codec as ConstantCodec;
|
||||
|
||||
return newModule;
|
||||
}, {} as ModuleConstants);
|
||||
|
||||
return result;
|
||||
}, {} as Constants);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -27,27 +27,33 @@ export function variantToMeta (lookup: PortableRegistry, variant: SiVariant): It
|
||||
|
||||
/** @internal */
|
||||
export function decorateErrors (registry: Registry, { lookup, pallets }: MetadataLatest, metaVersion: number): Errors {
|
||||
return pallets.reduce((result: Errors, { errors, index, name }, _sectionIndex): Errors => {
|
||||
if (!errors.isSome) {
|
||||
return result;
|
||||
const result: Errors = {};
|
||||
|
||||
for (let p = 0; p < pallets.length; p++) {
|
||||
const { errors, index, name } = pallets[p];
|
||||
|
||||
if (errors.isSome) {
|
||||
const sectionIndex = metaVersion >= 12
|
||||
? index.toNumber()
|
||||
: p;
|
||||
const newModule: ModuleErrors = {};
|
||||
const { variants } = lookup.getSiType(errors.unwrap().type).def.asVariant;
|
||||
|
||||
for (let v = 0; v < variants.length; v++) {
|
||||
const variant = variants[v];
|
||||
|
||||
// we don't camelCase the error name
|
||||
newModule[variant.name.toString()] = {
|
||||
is: ({ error, index }: DispatchErrorModule) =>
|
||||
index.eq(sectionIndex) &&
|
||||
error.eq(variant.index),
|
||||
meta: registry.createType('ErrorMetadataLatest', variantToMeta(lookup, variant))
|
||||
};
|
||||
}
|
||||
|
||||
result[stringCamelCase(name)] = newModule;
|
||||
}
|
||||
}
|
||||
|
||||
const sectionIndex = metaVersion >= 12
|
||||
? index.toNumber()
|
||||
: _sectionIndex;
|
||||
|
||||
result[stringCamelCase(name)] = lookup.getSiType(errors.unwrap().type).def.asVariant.variants.reduce((newModule: ModuleErrors, variant): ModuleErrors => {
|
||||
// we don't camelCase the error name
|
||||
newModule[variant.name.toString()] = {
|
||||
is: ({ error, index }: DispatchErrorModule) =>
|
||||
index.eq(sectionIndex) &&
|
||||
error.eq(variant.index),
|
||||
meta: registry.createType('ErrorMetadataLatest', variantToMeta(lookup, variant))
|
||||
};
|
||||
|
||||
return newModule;
|
||||
}, {} as ModuleErrors);
|
||||
|
||||
return result;
|
||||
}, {} as Errors);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { MetadataLatest } from '../../../interfaces';
|
||||
import type { MetadataLatest, PalletMetadataV14 } from '../../../interfaces';
|
||||
import type { AnyTuple, IEvent, Registry } from '../../../types';
|
||||
import type { Events, ModuleEvents } from '../types';
|
||||
|
||||
@@ -9,27 +9,37 @@ import { stringCamelCase } from '@polkadot/util';
|
||||
|
||||
import { variantToMeta } from '../errors';
|
||||
|
||||
export function filterEventsSome ({ events }: PalletMetadataV14): boolean {
|
||||
return events.isSome;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export function decorateEvents (registry: Registry, { lookup, pallets }: MetadataLatest, metaVersion: number): Events {
|
||||
return pallets
|
||||
.filter(({ events }) => events.isSome)
|
||||
.reduce((result: Events, { events, index, name }, _sectionIndex): Events => {
|
||||
const sectionIndex = metaVersion >= 12
|
||||
? index.toNumber()
|
||||
: _sectionIndex;
|
||||
const filtered = pallets.filter(filterEventsSome);
|
||||
const result: Events = {};
|
||||
|
||||
result[stringCamelCase(name)] = lookup.getSiType(events.unwrap().type).def.asVariant.variants.reduce((newModule: ModuleEvents, variant): ModuleEvents => {
|
||||
// we don't camelCase the event name
|
||||
newModule[variant.name.toString()] = {
|
||||
is: <T extends AnyTuple> (eventRecord: IEvent<AnyTuple>): eventRecord is IEvent<T> =>
|
||||
eventRecord.index[0] === sectionIndex &&
|
||||
variant.index.eq(eventRecord.index[1]),
|
||||
meta: registry.createType('EventMetadataLatest', variantToMeta(lookup, variant))
|
||||
};
|
||||
for (let p = 0; p < filtered.length; p++) {
|
||||
const { events, index, name } = filtered[p];
|
||||
const sectionIndex = metaVersion >= 12
|
||||
? index.toNumber()
|
||||
: p;
|
||||
const newModule: ModuleEvents = {};
|
||||
const { variants } = lookup.getSiType(events.unwrap().type).def.asVariant;
|
||||
|
||||
return newModule;
|
||||
}, {} as ModuleEvents);
|
||||
for (let v = 0; v < variants.length; v++) {
|
||||
const variant = variants[v];
|
||||
|
||||
return result;
|
||||
}, {} as Events);
|
||||
// we don't camelCase the event name
|
||||
newModule[variant.name.toString()] = {
|
||||
is: <T extends AnyTuple> (eventRecord: IEvent<AnyTuple>): eventRecord is IEvent<T> =>
|
||||
eventRecord.index[0] === sectionIndex &&
|
||||
variant.index.eq(eventRecord.index[1]),
|
||||
meta: registry.createType('EventMetadataLatest', variantToMeta(lookup, variant))
|
||||
};
|
||||
}
|
||||
|
||||
result[stringCamelCase(name)] = newModule;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { MetadataLatest } from '../../../interfaces';
|
||||
import type { MetadataLatest, PalletMetadataV14 } from '../../../interfaces';
|
||||
import type { Registry } from '../../../types';
|
||||
import type { Extrinsics, ModuleExtrinsics } from '../types';
|
||||
|
||||
@@ -10,35 +10,48 @@ import { stringCamelCase } from '@polkadot/util';
|
||||
import { getSiName } from '../../util';
|
||||
import { createUnchecked } from './createUnchecked';
|
||||
|
||||
export function filterCallsSome ({ calls }: PalletMetadataV14): boolean {
|
||||
return calls.isSome;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export function decorateExtrinsics (registry: Registry, { lookup, pallets }: MetadataLatest, metaVersion: number): Extrinsics {
|
||||
return pallets
|
||||
.filter(({ calls }) => calls.isSome)
|
||||
.reduce((result: Extrinsics, { calls, index, name }, _sectionIndex): Extrinsics => {
|
||||
const sectionName = stringCamelCase(name);
|
||||
const sectionIndex = metaVersion >= 12
|
||||
? index.toNumber()
|
||||
: _sectionIndex;
|
||||
const filtered = pallets.filter(filterCallsSome);
|
||||
const result: Extrinsics = {};
|
||||
|
||||
result[sectionName] = lookup.getSiType(calls.unwrap().type).def.asVariant.variants
|
||||
.reduce((newModule: ModuleExtrinsics, variant): ModuleExtrinsics => {
|
||||
const callMetadata = registry.createType('FunctionMetadataLatest', {
|
||||
...variant,
|
||||
args: variant.fields.map(({ name, type, typeName }, index) => ({
|
||||
name: stringCamelCase(name.unwrapOr(`param${index}`)),
|
||||
type: getSiName(lookup, type),
|
||||
...(typeName.isSome
|
||||
? { typeName: typeName.unwrap() }
|
||||
: {}
|
||||
)
|
||||
}))
|
||||
});
|
||||
for (let p = 0; p < filtered.length; p++) {
|
||||
const { calls, index, name } = filtered[p];
|
||||
const sectionName = stringCamelCase(name);
|
||||
const sectionIndex = metaVersion >= 12
|
||||
? index.toNumber()
|
||||
: p;
|
||||
const newModule: ModuleExtrinsics = {};
|
||||
const { variants } = lookup.getSiType(calls.unwrap().type).def.asVariant;
|
||||
|
||||
newModule[stringCamelCase(callMetadata.name)] = createUnchecked(registry, sectionName, new Uint8Array([sectionIndex, callMetadata.index.toNumber()]), callMetadata);
|
||||
for (let v = 0; v < variants.length; v++) {
|
||||
const variant = variants[v];
|
||||
const args = new Array<Record<string, unknown>>(variant.fields.length);
|
||||
|
||||
return newModule;
|
||||
}, {});
|
||||
for (let a = 0; a < variant.fields.length; a++) {
|
||||
const { name, type, typeName } = variant.fields[a];
|
||||
|
||||
return result;
|
||||
}, {});
|
||||
args[a] = {
|
||||
name: stringCamelCase(name.unwrapOr(`param${a}`)),
|
||||
type: getSiName(lookup, type),
|
||||
...(typeName.isSome
|
||||
? { typeName: typeName.unwrap() }
|
||||
: {}
|
||||
)
|
||||
};
|
||||
}
|
||||
|
||||
const callMetadata = registry.createType('FunctionMetadataLatest', { ...variant, args });
|
||||
|
||||
newModule[stringCamelCase(callMetadata.name)] = createUnchecked(registry, sectionName, new Uint8Array([sectionIndex, callMetadata.index.toNumber()]), callMetadata);
|
||||
}
|
||||
|
||||
result[sectionName] = newModule;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ import { assert } from '@polkadot/util';
|
||||
import { Metadata } from '../Metadata';
|
||||
import { decorateConstants } from './constants';
|
||||
import { decorateErrors } from './errors';
|
||||
import { decorateEvents } from './events';
|
||||
import { decorateExtrinsics } from './extrinsics';
|
||||
import { decorateEvents, filterEventsSome } from './events';
|
||||
import { decorateExtrinsics, filterCallsSome } from './extrinsics';
|
||||
import { decorateStorage } from './storage';
|
||||
|
||||
/**
|
||||
@@ -32,4 +32,4 @@ export function expandMetadata (registry: Registry, metadata: Metadata): Decorat
|
||||
};
|
||||
}
|
||||
|
||||
export { decorateConstants, decorateErrors, decorateEvents, decorateExtrinsics, decorateStorage };
|
||||
export { decorateConstants, decorateErrors, decorateEvents, decorateExtrinsics, decorateStorage, filterCallsSome, filterEventsSome };
|
||||
|
||||
@@ -46,12 +46,17 @@ export function createKeyRaw (registry: Registry, itemFn: CreateItemBase, keys:
|
||||
);
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
function filterDefined (a: unknown): boolean {
|
||||
return !isUndefined(a);
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
function createKey (registry: Registry, itemFn: CreateItemFn, keys: SiLookupTypeId[], hashers: StorageHasher[], args: unknown[]): Uint8Array {
|
||||
const { method, section } = itemFn;
|
||||
|
||||
assert(Array.isArray(args), () => `Call to ${stringCamelCase(section || 'unknown')}.${stringCamelCase(method || 'unknown')} needs ${keys.length} arguments`);
|
||||
assert(args.filter((a) => !isUndefined(a)).length === keys.length, () => `Call to ${stringCamelCase(section || 'unknown')}.${stringCamelCase(method || 'unknown')} needs ${keys.length} arguments, found [${args.join(', ')}]`);
|
||||
assert(args.filter(filterDefined).length === keys.length, () => `Call to ${stringCamelCase(section || 'unknown')}.${stringCamelCase(method || 'unknown')} needs ${keys.length} arguments, found [${args.join(', ')}]`);
|
||||
|
||||
// as per createKey, always add the length prefix (underlying it is Bytes)
|
||||
return compactAddLength(
|
||||
|
||||
@@ -14,19 +14,19 @@ export type HasherFunction = (data: HasherInput) => Uint8Array;
|
||||
const DEFAULT_FN = (data: HasherInput): Uint8Array => xxhashAsU8a(data, 128);
|
||||
|
||||
const HASHERS: Record<keyof typeof AllHashers, HasherFunction> = {
|
||||
Blake2_128: (data: HasherInput): Uint8Array => // eslint-disable-line camelcase
|
||||
Blake2_128: (data: HasherInput) => // eslint-disable-line camelcase
|
||||
blake2AsU8a(data, 128),
|
||||
Blake2_128Concat: (data: HasherInput): Uint8Array => // eslint-disable-line camelcase
|
||||
Blake2_128Concat: (data: HasherInput) => // eslint-disable-line camelcase
|
||||
u8aConcat(blake2AsU8a(data, 128), u8aToU8a(data)),
|
||||
Blake2_256: (data: HasherInput): Uint8Array => // eslint-disable-line camelcase
|
||||
Blake2_256: (data: HasherInput) => // eslint-disable-line camelcase
|
||||
blake2AsU8a(data, 256),
|
||||
Identity: (data: HasherInput): Uint8Array =>
|
||||
Identity: (data: HasherInput) =>
|
||||
u8aToU8a(data),
|
||||
Twox128: (data: HasherInput): Uint8Array =>
|
||||
Twox128: (data: HasherInput) =>
|
||||
xxhashAsU8a(data, 128),
|
||||
Twox256: (data: HasherInput): Uint8Array =>
|
||||
Twox256: (data: HasherInput) =>
|
||||
xxhashAsU8a(data, 256),
|
||||
Twox64Concat: (data: HasherInput): Uint8Array =>
|
||||
Twox64Concat: (data: HasherInput) =>
|
||||
u8aConcat(xxhashAsU8a(data, 64), u8aToU8a(data))
|
||||
};
|
||||
|
||||
|
||||
@@ -9,13 +9,12 @@ import { substrate } from './substrate';
|
||||
|
||||
/** @internal */
|
||||
export function getStorage (registry: Registry): Storage {
|
||||
return {
|
||||
substrate: Object
|
||||
.entries(substrate)
|
||||
.reduce((storage: Record<string, StorageEntry>, [key, fn]): Record<string, StorageEntry> => {
|
||||
(storage as Record<string, unknown>)[key] = fn(registry);
|
||||
const storage: Record<string, StorageEntry> = {};
|
||||
const entries = Object.entries(substrate);
|
||||
|
||||
return storage;
|
||||
}, {})
|
||||
};
|
||||
for (let e = 0; e < entries.length; e++) {
|
||||
storage[entries[e][0]] = entries[e][1](registry);
|
||||
}
|
||||
|
||||
return { substrate: storage };
|
||||
}
|
||||
|
||||
@@ -14,40 +14,39 @@ import { createRuntimeFunction } from './util';
|
||||
/** @internal */
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
export function decorateStorage (registry: Registry, { pallets }: MetadataLatest, _metaVersion: number): Storage {
|
||||
return pallets.reduce((result: Storage, moduleMetadata): Storage => {
|
||||
if (moduleMetadata.storage.isNone) {
|
||||
return result;
|
||||
const result: Storage = getStorage(registry);
|
||||
|
||||
for (let p = 0; p < pallets.length; p++) {
|
||||
const { name, storage } = pallets[p];
|
||||
|
||||
if (storage.isSome) {
|
||||
const section = stringCamelCase(name);
|
||||
const { items, prefix: _prefix } = storage.unwrap();
|
||||
const prefix = _prefix.toString();
|
||||
const newModule: ModuleStorage = {
|
||||
palletVersion: createRuntimeFunction(
|
||||
{ method: 'palletVersion', prefix, section },
|
||||
createKeyRaw(registry, { method: ':__STORAGE_VERSION__:', prefix: name.toString() }, [], [], []),
|
||||
{ docs: 'Returns the current pallet version from storage', type: 'u16' }
|
||||
)(registry)
|
||||
};
|
||||
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
const meta = items[i];
|
||||
const method = meta.name.toString();
|
||||
|
||||
// For access, we change the index names, i.e. System.Account -> system.account
|
||||
newModule[stringLowerFirst(method)] = createFunction(registry, {
|
||||
meta,
|
||||
method,
|
||||
prefix,
|
||||
section
|
||||
}, {});
|
||||
}
|
||||
|
||||
result[section] = newModule;
|
||||
}
|
||||
}
|
||||
|
||||
const { name } = moduleMetadata;
|
||||
const section = stringCamelCase(name);
|
||||
const unwrapped = moduleMetadata.storage.unwrap();
|
||||
const prefix = unwrapped.prefix.toString();
|
||||
|
||||
// For access, we change the index names, i.e. System.Account -> system.account
|
||||
result[section] = unwrapped.items.reduce((newModule, meta): ModuleStorage => {
|
||||
const method = meta.name.toString();
|
||||
|
||||
newModule[stringLowerFirst(method)] = createFunction(registry, {
|
||||
meta,
|
||||
method,
|
||||
prefix,
|
||||
section
|
||||
}, {});
|
||||
|
||||
return newModule;
|
||||
}, {
|
||||
palletVersion: createRuntimeFunction(
|
||||
name.toString(),
|
||||
'palletVersion',
|
||||
createKeyRaw(registry, { method: ':__STORAGE_VERSION__:', prefix: name.toString() }, [], [], []),
|
||||
{
|
||||
docs: 'Returns the current pallet version from storage',
|
||||
type: 'u16'
|
||||
}
|
||||
)(registry)
|
||||
} as ModuleStorage);
|
||||
|
||||
return result;
|
||||
}, { ...getStorage(registry) });
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -3,29 +3,34 @@
|
||||
|
||||
import type { StorageEntry } from '../../../primitive/types';
|
||||
import type { Registry } from '../../../types';
|
||||
import type { ManualMetadata } from './util';
|
||||
|
||||
import { createRuntimeFunction } from './util';
|
||||
|
||||
type Creator = (registry: Registry) => StorageEntry;
|
||||
|
||||
function createSubstrateFn (method: string, key: string, meta: ManualMetadata): Creator {
|
||||
return createRuntimeFunction({ method, prefix: 'Substrate', section: 'substrate' }, key, meta);
|
||||
}
|
||||
|
||||
export const substrate: Record<string, Creator> = {
|
||||
changesTrieConfig: createRuntimeFunction('Substrate', 'changesTrieConfig', ':changes_trie', {
|
||||
changesTrieConfig: createSubstrateFn('changesTrieConfig', ':changes_trie', {
|
||||
docs: ' Changes trie configuration is stored under this key.',
|
||||
type: 'u32'
|
||||
}),
|
||||
childStorageKeyPrefix: createRuntimeFunction('Substrate', 'childStorageKeyPrefix', ':child_storage:', {
|
||||
childStorageKeyPrefix: createSubstrateFn('childStorageKeyPrefix', ':child_storage:', {
|
||||
docs: ' Prefix of child storage keys.',
|
||||
type: 'u32'
|
||||
}),
|
||||
code: createRuntimeFunction('Substrate', 'code', ':code', {
|
||||
code: createSubstrateFn('code', ':code', {
|
||||
docs: ' Wasm code of the runtime.',
|
||||
type: 'Bytes'
|
||||
}),
|
||||
extrinsicIndex: createRuntimeFunction('Substrate', 'extrinsicIndex', ':extrinsic_index', {
|
||||
extrinsicIndex: createSubstrateFn('extrinsicIndex', ':extrinsic_index', {
|
||||
docs: ' Current extrinsic index (u32) is stored under this key.',
|
||||
type: 'u32'
|
||||
}),
|
||||
heapPages: createRuntimeFunction('Substrate', 'heapPages', ':heappages', {
|
||||
heapPages: createSubstrateFn('heapPages', ':heappages', {
|
||||
docs: ' Number of wasm linear memory pages required for execution of the runtime.',
|
||||
type: 'u64'
|
||||
})
|
||||
|
||||
@@ -7,11 +7,17 @@ import type { Registry } from '../../../types';
|
||||
|
||||
import { createFunction } from './createFunction';
|
||||
|
||||
interface ManualMetadata {
|
||||
export interface ManualMetadata {
|
||||
docs: string;
|
||||
type: string;
|
||||
}
|
||||
|
||||
interface ManualDefinition {
|
||||
method: string;
|
||||
prefix: string;
|
||||
section: string;
|
||||
}
|
||||
|
||||
function findSiPrimitive (registry: Registry, _prim: string): PortableType | undefined {
|
||||
const prim = _prim.toLowerCase();
|
||||
|
||||
@@ -56,7 +62,7 @@ function findSiType (registry: Registry, orig: string): PortableType | undefined
|
||||
|
||||
// Small helper function to factorize code on this page.
|
||||
/** @internal */
|
||||
export function createRuntimeFunction (prefix: string, method: string, key: Uint8Array | string, { docs, type }: ManualMetadata): (registry: Registry) => StorageEntry {
|
||||
export function createRuntimeFunction ({ method, prefix, section }: ManualDefinition, key: Uint8Array | string, { docs, type }: ManualMetadata): (registry: Registry) => StorageEntry {
|
||||
return (registry: Registry): StorageEntry =>
|
||||
createFunction(registry, {
|
||||
meta: registry.createType('StorageEntryMetadataLatest', {
|
||||
@@ -68,6 +74,6 @@ export function createRuntimeFunction (prefix: string, method: string, key: Uint
|
||||
}),
|
||||
method,
|
||||
prefix,
|
||||
section: prefix.toLowerCase()
|
||||
section
|
||||
}, { key, skipHashing: true });
|
||||
}
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Auto-generated by @polkadot/dev, do not edit
|
||||
|
||||
export const packageInfo = { name: '@polkadot/types', version: '6.5.1' };
|
||||
export const packageInfo = { name: '@polkadot/types', version: '6.6.1' };
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { CodecHash, Hash } from '../interfaces/runtime';
|
||||
import type { Codec, Registry } from '../types';
|
||||
|
||||
@@ -84,7 +85,7 @@ export class bool extends Boolean implements Codec {
|
||||
/**
|
||||
* @description Returns a hex string representation of the value
|
||||
*/
|
||||
public toHex (): string {
|
||||
public toHex (): HexString {
|
||||
return u8aToHex(this.toU8a());
|
||||
}
|
||||
|
||||
|
||||
@@ -11,9 +11,9 @@ import { Raw } from '../codec/Raw';
|
||||
const MAX_LENGTH = 10 * 1024 * 1024;
|
||||
|
||||
/** @internal */
|
||||
function decodeBytesU8a (value: Uint8Array): Uint8Array {
|
||||
function decodeBytesU8a (value: Uint8Array): [Uint8Array, number] {
|
||||
if (!value.length) {
|
||||
return new Uint8Array();
|
||||
return [new Uint8Array(), 0];
|
||||
}
|
||||
|
||||
// handle all other Uint8Array inputs, these do have a length prefix
|
||||
@@ -23,20 +23,20 @@ function decodeBytesU8a (value: Uint8Array): Uint8Array {
|
||||
assert(length.lten(MAX_LENGTH), () => `Bytes length ${length.toString()} exceeds ${MAX_LENGTH}`);
|
||||
assert(total <= value.length, () => `Bytes: required length less than remainder, expected at least ${total}, found ${value.length}`);
|
||||
|
||||
return value.subarray(offset, total);
|
||||
return [value.subarray(offset, total), total];
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
function decodeBytes (value?: AnyU8a): Uint8Array | undefined {
|
||||
function decodeBytes (value?: AnyU8a): [Uint8Array | undefined, number] {
|
||||
if (Array.isArray(value) || isString(value)) {
|
||||
return u8aToU8a(value);
|
||||
return [u8aToU8a(value), 0];
|
||||
} else if (!(value instanceof Raw) && isU8a(value)) {
|
||||
// We are ensuring we are not a Raw instance. In the case of a Raw we already have gotten
|
||||
// rid of the length, i.e. new Bytes(new Bytes(...)) will work as expected
|
||||
return decodeBytesU8a(value);
|
||||
}
|
||||
|
||||
return value;
|
||||
return [value, 0];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -48,7 +48,9 @@ function decodeBytes (value?: AnyU8a): Uint8Array | undefined {
|
||||
*/
|
||||
export class Bytes extends Raw {
|
||||
constructor (registry: Registry, value?: AnyU8a) {
|
||||
super(registry, decodeBytes(value));
|
||||
const [u8a, decodedLength] = decodeBytes(value);
|
||||
|
||||
super(registry, u8a, decodedLength);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { CodecHash, Hash } from '../interfaces/runtime';
|
||||
import type { Codec, Registry } from '../types';
|
||||
|
||||
@@ -51,7 +52,7 @@ export class Null implements Codec {
|
||||
/**
|
||||
* @description Returns a hex string representation of the value
|
||||
*/
|
||||
public toHex (): string {
|
||||
public toHex (): HexString {
|
||||
return '0x';
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/types authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { HexString } from '@polkadot/util/types';
|
||||
import type { CodecHash, Hash } from '../interfaces/runtime';
|
||||
import type { AnyU8a, Codec, Registry } from '../types';
|
||||
|
||||
@@ -11,18 +12,18 @@ import { Raw } from '../codec/Raw';
|
||||
const MAX_LENGTH = 128 * 1024;
|
||||
|
||||
/** @internal */
|
||||
function decodeText (value?: null | Text | string | AnyU8a | { toString: () => string }): string {
|
||||
function decodeText (value?: null | Text | string | AnyU8a | { toString: () => string }): [string, number] {
|
||||
if (isHex(value)) {
|
||||
return u8aToString(hexToU8a(value));
|
||||
return [u8aToString(hexToU8a(value)), 0];
|
||||
} else if (value instanceof Uint8Array) {
|
||||
if (!value.length) {
|
||||
return '';
|
||||
return ['', 0];
|
||||
}
|
||||
|
||||
// for Raw, the internal buffer does not have an internal length
|
||||
// (the same applies in e.g. Bytes, where length is added at encoding-time)
|
||||
if (value instanceof Raw) {
|
||||
return u8aToString(value);
|
||||
return [u8aToString(value), 0];
|
||||
}
|
||||
|
||||
const [offset, length] = compactFromU8a(value);
|
||||
@@ -31,10 +32,10 @@ function decodeText (value?: null | Text | string | AnyU8a | { toString: () => s
|
||||
assert(length.lten(MAX_LENGTH), () => `Text: length ${length.toString()} exceeds ${MAX_LENGTH}`);
|
||||
assert(total <= value.length, () => `Text: required length less than remainder, expected at least ${total}, found ${value.length}`);
|
||||
|
||||
return u8aToString(value.subarray(offset, total));
|
||||
return [u8aToString(value.subarray(offset, total)), total];
|
||||
}
|
||||
|
||||
return value ? value.toString() : '';
|
||||
return [value ? value.toString() : '', 0];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -52,12 +53,17 @@ export class Text extends String implements Codec {
|
||||
|
||||
public createdAtHash?: Hash;
|
||||
|
||||
readonly #initialU8aLength?: number;
|
||||
|
||||
#override: string | null = null;
|
||||
|
||||
constructor (registry: Registry, value?: null | Text | string | AnyU8a | { toString: () => string }) {
|
||||
super(decodeText(value));
|
||||
const [str, decodedLength] = decodeText(value);
|
||||
|
||||
super(str);
|
||||
|
||||
this.registry = registry;
|
||||
this.#initialU8aLength = decodedLength;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -67,6 +73,13 @@ export class Text extends String implements Codec {
|
||||
return this.toU8a().length;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description The length of the initial encoded value (Only available when constructed from a Uint8Array)
|
||||
*/
|
||||
public get initialU8aLength (): number | undefined {
|
||||
return this.#initialU8aLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description returns a hash of the contents
|
||||
*/
|
||||
@@ -108,7 +121,7 @@ export class Text extends String implements Codec {
|
||||
/**
|
||||
* @description Returns a hex string representation of the value
|
||||
*/
|
||||
public toHex (): string {
|
||||
public toHex (): HexString {
|
||||
// like with Vec<u8>, when we are encoding to hex, we don't actually add
|
||||
// the length prefix (it is already implied by the actual string length)
|
||||
return u8aToHex(this.toU8a(true));
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user