Compare commits

...
42 Commits
Author SHA1 Message Date
Github Actions db2e97bf66 [CI Skip] release/stable 6.6.1
skip-checks: true
2021-11-01 16:17:29 +00:00
Jaco 057f6b6041 6.6.1 (#4140)
* 6.6.1

* 6.6.1
2021-11-01 17:59:50 +02:00
Github Actions ca82336087 [CI Skip] release/beta 6.5.3-13
skip-checks: true
2021-11-01 09:50:27 +00:00
Jaco 761ceaeaa3 Internal adjustments (part 6) (#4138)
* Internal adjustments (part 6)

* Additional
2021-11-01 11:35:17 +02:00
Github Actions 0cbca0adb8 [CI Skip] release/beta 6.5.3-12
skip-checks: true
2021-11-01 09:21:33 +00:00
Jaco d24db4fd6a Internal adjustments (part 4) (#4136)
* Internal adjustments (part 3)

* Internal adjustments (part 4)

* Additional

* Additional

* Fix set encoding
2021-11-01 11:01:31 +02:00
Jaco 4a893b9feb Internal adjustments (part 5) (#4137) 2021-11-01 10:56:16 +02:00
Github Actions 71a0a84f26 [CI Skip] release/beta 6.5.3-11
skip-checks: true
2021-11-01 08:25:14 +00:00
Jaco 44d241f489 Internal adjustments (part 3) (#4135) 2021-11-01 10:03:13 +02:00
Github Actions a4cb5f558d [CI Skip] release/beta 6.5.3-10
skip-checks: true
2021-11-01 07:46:07 +00:00
Jaco aef4d07c48 Internal adjustments (part 2) (#4134) 2021-11-01 09:27:04 +02:00
Github Actions 6a5f1bbbf4 [CI Skip] release/beta 6.5.3-9
skip-checks: true
2021-10-31 05:15:37 +00:00
Jaco e60ef2d677 Optimize internal u8a decoding (#4131)
* Optimize internal u8a decoding

* linting

* tsc fixes & HexString usage

* yet more... it passes now (well... tsc & lint)
2021-10-31 06:58:14 +02:00
Github Actions f4622d05db [CI Skip] release/beta 6.5.3-8
skip-checks: true
2021-10-30 15:33:20 +00:00
Jaco 47d7900809 Adjust struct iterable creation (#4130) 2021-10-30 18:12:12 +03:00
Jaco 2c86e9347b Optimize Struct from Struct construction (#4128)
* Optimize Struct from Map constrcution

* Update packages/types/src/metadata/MetadataVersioned.ts

* CHANGELOG

* Only shortcut Struct

* tests
2021-10-30 17:50:37 +03:00
Github Actions 5827d298ad [CI Skip] release/beta 6.5.3-7
skip-checks: true
2021-10-29 15:25:42 +00:00
Jaco 60e0f69920 Adjust AbstractArray & Struct decoders (#4127)
* Adjust AbstractArray & Struct decoders

* Fixes, add Text & Bytes/Raw to shortcuts

* Additional

* Additional

* Remove debug log

* Revert extra arg, make CC happy

* BTreeSet
2021-10-29 18:06:57 +03:00
Github Actions 97f1ee17b0 [CI Skip] release/beta 6.5.3-6
skip-checks: true
2021-10-28 12:13:17 +00:00
Jaco 85215a308d Bump metadata (#4123) 2021-10-28 14:48:42 +03:00
Github Actions 89fa4edcf7 [CI Skip] release/beta 6.5.3-5
skip-checks: true
2021-10-28 11:05:51 +00:00
Jaco ec42fb9bff Update known Westend upgrade blocks (#4122) 2021-10-28 13:48:10 +03:00
Github Actions 96d696dbf3 [CI Skip] release/beta 6.5.3-4
skip-checks: true
2021-10-28 08:43:46 +00:00
Jaco b7992ecc0b Use lookupName in createClass (as available) (#4121)
* User lookupName in createClass (as available)

* CHANGELOG

* cleanups

* Adjust for Vecs

* Small check cleanups
2021-10-28 11:19:30 +03:00
Github Actions 0acae6e158 [CI Skip] release/beta 6.5.3-3
skip-checks: true
2021-10-26 12:58:10 +00:00
Jaco 6afea5043e Add and dedupe EthereumAddress (#4118)
* Add and dedupe EthereumAddress

* Override for Polkadot claims
2021-10-26 15:40:58 +03:00
Github Actions c9ee8d9942 [CI Skip] release/beta 6.5.3-2
skip-checks: true
2021-10-26 11:58:39 +00:00
Jaco 55f4e150c0 Split namespaces (#4116) 2021-10-26 14:42:18 +03:00
Github Actions 3e3e9c5f5a [CI Skip] release/beta 6.5.3-1
skip-checks: true
2021-10-26 10:40:54 +00:00
Jaco 66215890dd Correct construction of palletVersion keys (#4115) 2021-10-26 13:20:54 +03:00
Github Actions bf6c7ee0c3 [CI Skip] release/beta 6.5.3-0
skip-checks: true
2021-10-26 07:58:18 +00:00
Jaco f726edf725 Bump dev (#4113) 2021-10-26 10:42:23 +03:00
Github Actions d917861a77 [CI Skip] release/stable 6.5.2
skip-checks: true
2021-10-26 06:02:42 +00:00
Jaco 12a54efde5 Fix Struct decoding for null (#4112)
* Fix Struct decoding for null

* CHANGELOG

* 6.5.2
2021-10-26 08:46:03 +03:00
Github Actions 9ae87bed78 [CI Skip] release/beta 6.5.2-3
skip-checks: true
2021-10-25 14:27:40 +00:00
Jaco 7f5a52258c Adjust toHuman on Call (#4109) 2021-10-25 17:10:26 +03:00
Github Actions 2c212e6b4d [CI Skip] release/beta 6.5.2-2
skip-checks: true
2021-10-25 14:07:57 +00:00
Jaco 3d75744a20 Bump dev deps (#4108) 2021-10-25 16:51:05 +03:00
Github Actions d2ff259989 [CI Skip] release/beta 6.5.2-1
skip-checks: true
2021-10-25 12:08:53 +00:00
Jaco cac2ef30a1 Bump dev (#4106) 2021-10-25 14:44:47 +03:00
Github Actions ea38dedcc1 [CI Skip] release/beta 6.5.2-0
skip-checks: true
2021-10-25 06:15:30 +00:00
Jaco 0bd632e612 Allow for optional known RuntimeVersion on api.at (#4103)
* Allow for optional known RuntimeVersion on api.at

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

Some files were not shown because too many files have changed in this diff Show More