Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b9805cdc94 | ||
|
|
feb36d43a4 | ||
|
|
92c88d7c13 | ||
|
|
033fc4f480 | ||
|
|
4ca9670e4e | ||
|
|
8fee66c0fa | ||
|
|
9a3b5d7a2c | ||
|
|
f166431b02 | ||
|
|
088fdc6171 | ||
|
|
910c77fd39 | ||
|
|
dacf2875b7 | ||
|
|
cbcc79972a | ||
|
|
0faddf1df6 | ||
|
|
697c8b8e7a | ||
|
|
99403b8246 | ||
|
|
4b7e1003e0 | ||
|
|
5fd6d39aed | ||
|
|
cedb1afe6f | ||
|
|
4bff8e5158 | ||
|
|
474aedde34 | ||
|
|
a8d7566186 | ||
|
|
beb7b54e4a | ||
|
|
d08cc74aad | ||
|
|
27e4279c55 | ||
|
|
6cd2f3b386 | ||
|
|
472c971c5b | ||
|
|
d8756455c2 | ||
|
|
5aae48cc28 | ||
|
|
4ab3b55383 | ||
|
|
6ea6b90e03 | ||
|
|
eb5c888cb8 | ||
|
|
cda07dfa0b | ||
|
|
4abae3200b | ||
|
|
b60895beb4 | ||
|
|
855d70a3b3 | ||
|
|
583d9bfe36 | ||
|
|
d519611a25 | ||
|
|
9a9bace8e8 | ||
|
|
40810f2fdb | ||
|
|
361a77580e | ||
|
|
ea45c7e689 | ||
|
|
cc1d51a6ca | ||
|
|
b8233fb7b8 | ||
|
|
5cbe80066d | ||
|
|
3f6c10256c | ||
|
|
609b2830b0 | ||
|
|
b7bbd2d615 | ||
|
|
41d6429782 | ||
|
|
ae168a00a9 | ||
|
|
79694d8a95 | ||
|
|
95be64cbd7 | ||
|
|
76bf7a0079 | ||
|
|
142390f27d | ||
|
|
d0145ce58c |
@@ -10,7 +10,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: jacogr/action-merge@d2d64b4545acd93b0a9575177d3d215ae3f92029
|
- uses: jacogr/action-merge@d2d64b4545acd93b0a9575177d3d215ae3f92029
|
||||||
with:
|
with:
|
||||||
checks: build,lint,test
|
checks: pr (build),pr (lint),pr (test)
|
||||||
labels: -auto
|
labels: -auto
|
||||||
strategy: squash
|
strategy: squash
|
||||||
token: ${{ secrets.GH_PAT_BOT }}
|
token: ${{ secrets.GH_PAT_BOT }}
|
||||||
|
|||||||
@@ -3,16 +3,19 @@ on: [pull_request]
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
pr:
|
pr:
|
||||||
|
continue-on-error: true
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
step: ['lint', 'test', 'build', 'deno']
|
step: ['lint', 'test', 'build', 'deno']
|
||||||
name: ${{ matrix.step }}
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
YARN_ENABLE_SCRIPTS: false
|
YARN_ENABLE_SCRIPTS: false
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
|
- uses: actions/checkout@v3
|
||||||
- uses: denoland/setup-deno@004814556e37c54a2f6e31384c9e18e983317366
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 'lts/*'
|
||||||
|
- uses: denoland/setup-deno@v1
|
||||||
with:
|
with:
|
||||||
deno-version: vx.x.x
|
deno-version: vx.x.x
|
||||||
- name: ${{ matrix.step }}
|
- name: ${{ matrix.step }}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
step: ['build:release']
|
step: ['build:release']
|
||||||
name: ${{ matrix.step }}
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
YARN_ENABLE_SCRIPTS: false
|
YARN_ENABLE_SCRIPTS: false
|
||||||
@@ -19,10 +18,13 @@ jobs:
|
|||||||
GH_RELEASE_GITHUB_API_TOKEN: ${{ secrets.GH_PAT_BOT }}
|
GH_RELEASE_GITHUB_API_TOKEN: ${{ secrets.GH_PAT_BOT }}
|
||||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
token: ${{ secrets.GH_PAT_BOT }}
|
token: ${{ secrets.GH_PAT_BOT }}
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 'lts/*'
|
||||||
- name: ${{ matrix.step }}
|
- name: ${{ matrix.step }}
|
||||||
run: |
|
run: |
|
||||||
yarn install --immutable | grep -v 'YN0013'
|
yarn install --immutable | grep -v 'YN0013'
|
||||||
|
|||||||
@@ -1,5 +1,38 @@
|
|||||||
# CHANGELOG
|
# CHANGELOG
|
||||||
|
|
||||||
|
## 10.0.1 Mar 4, 2023
|
||||||
|
|
||||||
|
Contributed:
|
||||||
|
|
||||||
|
- Expose per-endpoint stats for providers (Thanks to https://github.com/jeluard)
|
||||||
|
- Adjust ink! primitive extraction for v4 (Thanks to https://github.com/statictype)
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Ensure that provider disconnect clears all subscriptions
|
||||||
|
- Adjust typegen to internally use `import()` (catering for ESM provided types)
|
||||||
|
- Swap TS -> JS compiler to use tsc (from babel)
|
||||||
|
- Adjust all tests to use `node:test` runner (ESM variants)
|
||||||
|
- Update to latest Polkadot, Kusama & Substrate metadata
|
||||||
|
|
||||||
|
|
||||||
|
## 9.14.2 Feb 19, 2023
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Don't allow `WsProvider.connect()` on an open connection (creates resource leaks)
|
||||||
|
- Adjust typegen to use metadata-defined aliases in query return decoration
|
||||||
|
- Update to latest Polkadot, Kusama & Substrate metadata
|
||||||
|
|
||||||
|
|
||||||
|
## 9.14.1 Feb 12, 2023
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Extract aliases for `*_runtime::Runtime{Call, Event}` from metadata
|
||||||
|
- Update to latest Polkadot, Kusama & Substrate metadata
|
||||||
|
|
||||||
|
|
||||||
## 9.13.6 Feb 5, 2023
|
## 9.13.6 Feb 5, 2023
|
||||||
|
|
||||||
Contributed:
|
Contributed:
|
||||||
|
|||||||
+3
-3
@@ -1,4 +1,4 @@
|
|||||||
3360 Jaco 9.13.6 (#5475)
|
3386 Jaco 10.0.1 (#5518)
|
||||||
83 Amaury Martiny StatementKind: Regular and Saft (#2303)
|
83 Amaury Martiny StatementKind: Regular and Saft (#2303)
|
||||||
37 Keith Ingram Update contract types and rpc (#4541)
|
37 Keith Ingram Update contract types and rpc (#4541)
|
||||||
35 Stefanie Doll Updated child storage parameters (#1709)
|
35 Stefanie Doll Updated child storage parameters (#1709)
|
||||||
@@ -10,16 +10,16 @@
|
|||||||
10 Axel Chalon Make Enum/Tuple constructor use value directly if instance (#1954)
|
10 Axel Chalon Make Enum/Tuple constructor use value directly if instance (#1954)
|
||||||
5 Chevdor Fix metadata package link (#3458)
|
5 Chevdor Fix metadata package link (#3458)
|
||||||
5 Jake Naviasky Fixing approvalFlagsToBools. (#1250)
|
5 Jake Naviasky Fixing approvalFlagsToBools. (#1250)
|
||||||
|
5 Julien Eluard General WsProvider extensibility improvements (#5467)
|
||||||
4 Alex D Use derive customAccount and customLocks for balance overrides (#3248)
|
4 Alex D Use derive customAccount and customLocks for balance overrides (#3248)
|
||||||
4 Alex Wang fix issue that creates duplicate providers (#983)
|
4 Alex Wang fix issue that creates duplicate providers (#983)
|
||||||
4 Alexander Popiak Add asset id in signing (#4009)
|
4 Alexander Popiak Add asset id in signing (#4009)
|
||||||
|
4 Andreea Eftene add type overrides (#5506)
|
||||||
4 Joshy Orndorff spelling; efect -> effect (#2295)
|
4 Joshy Orndorff spelling; efect -> effect (#2295)
|
||||||
4 Julien Eluard Clarified WsProvider constructor parameters documentation (#5404)
|
|
||||||
4 Nantian fix bigint type (#3869)
|
4 Nantian fix bigint type (#3869)
|
||||||
4 Scott Twiname Add support for historical BlockNumber rpc methods (#4574)
|
4 Scott Twiname Add support for historical BlockNumber rpc methods (#4574)
|
||||||
4 Thibaut Sardan no subscription for http (#3127)
|
4 Thibaut Sardan no subscription for http (#3127)
|
||||||
3 André Silva add support for ValidationCodeHash (#3640)
|
3 André Silva add support for ValidationCodeHash (#3640)
|
||||||
3 Andreea Eftene Fix code source type (#5236)
|
|
||||||
3 Antoine Estienne Adapted to display moonbeam author (#3108)
|
3 Antoine Estienne Adapted to display moonbeam author (#3108)
|
||||||
3 Arjan Zijderveld Added `Emergency` to `ElectionPhase` (#3707)
|
3 Arjan Zijderveld Added `Emergency` to `ElectionPhase` (#3707)
|
||||||
3 Ewa Kowalska Handle no council for bounties proposals (#3062)
|
3 Ewa Kowalska Handle no council for bounties proposals (#3062)
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
// Copyright 2017-2023 @polkadot/api authors & contributors
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
|
|
||||||
const config = require('@polkadot/dev/config/jest.cjs');
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
...config,
|
|
||||||
moduleNameMapper: {
|
|
||||||
'@polkadot/api-(augment|base|contract|derive)(.*)$': '<rootDir>/packages/api-$1/src/$2',
|
|
||||||
// eslint-disable-next-line sort-keys
|
|
||||||
'@polkadot/api(.*)$': '<rootDir>/packages/api/src/$1',
|
|
||||||
'@polkadot/rpc-(augment|core|provider)(.*)$': '<rootDir>/packages/rpc-$1/src/$2',
|
|
||||||
'@polkadot/typegen(.*)$': '<rootDir>/packages/typegen/src/$1',
|
|
||||||
'@polkadot/types-(augment|codec|create|known|support)(.*)$': '<rootDir>/packages/types-$1/src/$2',
|
|
||||||
// eslint-disable-next-line sort-keys
|
|
||||||
'@polkadot/types(.*)$': '<rootDir>/packages/types/src/$1'
|
|
||||||
},
|
|
||||||
testTimeout: 30000
|
|
||||||
};
|
|
||||||
+15
-15
@@ -11,38 +11,38 @@
|
|||||||
},
|
},
|
||||||
"sideEffects": false,
|
"sideEffects": false,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "9.13.6",
|
"version": "10.0.1",
|
||||||
"versions": {
|
"versions": {
|
||||||
"git": "9.13.6",
|
"git": "10.0.1",
|
||||||
"npm": "9.13.6"
|
"npm": "10.0.1"
|
||||||
},
|
},
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
"packages/*"
|
"packages/*"
|
||||||
],
|
],
|
||||||
"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 && polkadot-dev-copy-dir scripts build/scripts)",
|
||||||
"build:interfaces": "polkadot-types-internal-interfaces",
|
"build:interfaces": "node --loader @polkadot/dev/node/ts packages/typegen/scripts/polkadot-types-internal-interfaces.mjs",
|
||||||
"build:metadata": "yarn build:interfaces && yarn test:one packages/types/src/metadata/v14",
|
"build:metadata": "yarn build:interfaces && polkadot-dev-run-test packages/types/src/metadata/v14",
|
||||||
"build:release": "polkadot-ci-ghact-build",
|
"build:release": "polkadot-ci-ghact-build",
|
||||||
"build:rollup": "polkadot-exec-rollup --config",
|
"build:rollup": "polkadot-exec-rollup --config",
|
||||||
"build:upgrades": "yarn test:one packages/types-known/src/upgrades/e2e",
|
"build:upgrades": "polkadot-dev-run-test upgrades/e2e",
|
||||||
"chain:info": "polkadot-types-chain-info",
|
"chain:info": "polkadot-types-chain-info",
|
||||||
"clean": "polkadot-dev-clean-build",
|
"clean": "polkadot-dev-clean-build",
|
||||||
"deno": "yarn polkadot-dev-deno-map && yarn build && deno check --import-map=import_map.json mod.ts",
|
"deno": "yarn polkadot-dev-deno-map && yarn build && deno check --import-map=import_map.json mod.ts",
|
||||||
"lint": "polkadot-dev-run-lint",
|
"lint": "polkadot-dev-run-lint",
|
||||||
"postinstall": "polkadot-dev-yarn-only",
|
"postinstall": "polkadot-dev-yarn-only",
|
||||||
"test": "NODE_OPTIONS=--experimental-vm-modules polkadot-dev-run-test --coverage --forceExit --runInBand --testPathIgnorePatterns e2e",
|
"test": "polkadot-dev-run-test --env node ^e2e",
|
||||||
"test:one": "NODE_OPTIONS=--experimental-vm-modules polkadot-dev-run-test --detectOpenHandles --forceExit"
|
"test:node": "polkadot-dev-run-test --env node ^e2e",
|
||||||
|
"test:one": "polkadot-dev-run-test --env node"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.20.12",
|
"@babel/core": "^7.21.0",
|
||||||
"@babel/register": "^7.18.9",
|
"@babel/register": "^7.21.0",
|
||||||
"@babel/runtime": "^7.20.13",
|
"@babel/runtime": "^7.21.0",
|
||||||
"@polkadot/dev": "^0.68.5",
|
"@polkadot/dev": "^0.69.27",
|
||||||
"@polkadot/typegen": "workspace:packages/typegen",
|
"@polkadot/typegen": "workspace:packages/typegen",
|
||||||
"@types/jest": "^29.4.0",
|
"@types/node": "^18.14.5"
|
||||||
"copyfiles": "^2.4.1"
|
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"typescript": "^4.9.5"
|
"typescript": "^4.9.5"
|
||||||
|
|||||||
@@ -20,15 +20,15 @@
|
|||||||
"./detectPackage.cjs"
|
"./detectPackage.cjs"
|
||||||
],
|
],
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "9.13.6",
|
"version": "10.0.1",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.20.13",
|
"@polkadot/api-base": "10.0.1",
|
||||||
"@polkadot/api-base": "9.13.6",
|
"@polkadot/rpc-augment": "10.0.1",
|
||||||
"@polkadot/rpc-augment": "9.13.6",
|
"@polkadot/types": "10.0.1",
|
||||||
"@polkadot/types": "9.13.6",
|
"@polkadot/types-augment": "10.0.1",
|
||||||
"@polkadot/types-augment": "9.13.6",
|
"@polkadot/types-codec": "10.0.1",
|
||||||
"@polkadot/types-codec": "9.13.6",
|
"@polkadot/util": "^11.0.1",
|
||||||
"@polkadot/util": "^10.3.1"
|
"tslib": "^2.5.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,18 +33,6 @@ declare module '@polkadot/api-base/types/consts' {
|
|||||||
**/
|
**/
|
||||||
[key: string]: Codec;
|
[key: string]: Codec;
|
||||||
};
|
};
|
||||||
authorship: {
|
|
||||||
/**
|
|
||||||
* The number of blocks back we should accept uncles.
|
|
||||||
* This means that we will deal with uncle-parents that are
|
|
||||||
* `UncleGenerations + 1` before `now`.
|
|
||||||
**/
|
|
||||||
uncleGenerations: u32 & AugmentedConst<ApiType>;
|
|
||||||
/**
|
|
||||||
* Generic const
|
|
||||||
**/
|
|
||||||
[key: string]: Codec;
|
|
||||||
};
|
|
||||||
babe: {
|
babe: {
|
||||||
/**
|
/**
|
||||||
* The amount of time, in slots, that each epoch should last.
|
* The amount of time, in slots, that each epoch should last.
|
||||||
@@ -399,6 +387,15 @@ declare module '@polkadot/api-base/types/consts' {
|
|||||||
* Max Authorities in use
|
* Max Authorities in use
|
||||||
**/
|
**/
|
||||||
maxAuthorities: u32 & AugmentedConst<ApiType>;
|
maxAuthorities: u32 & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* The maximum number of entries to keep in the set id to session index mapping.
|
||||||
|
*
|
||||||
|
* Since the `SetIdSession` map is only used for validating equivocations this
|
||||||
|
* value should relate to the bonding duration of whatever staking system is
|
||||||
|
* being used (if any). If equivocation handling is not enabled then this value
|
||||||
|
* can be zero.
|
||||||
|
**/
|
||||||
|
maxSetIdSessionEntries: u64 & AugmentedConst<ApiType>;
|
||||||
/**
|
/**
|
||||||
* Generic const
|
* Generic const
|
||||||
**/
|
**/
|
||||||
@@ -620,18 +617,28 @@ declare module '@polkadot/api-base/types/consts' {
|
|||||||
/**
|
/**
|
||||||
* The maximum number of candidates in a phragmen election.
|
* The maximum number of candidates in a phragmen election.
|
||||||
*
|
*
|
||||||
* Warning: The election happens onchain, and this value will determine
|
* Warning: This impacts the size of the election which is run onchain. Chose wisely, and
|
||||||
* the size of the election. When this limit is reached no more
|
* consider how it will impact `T::WeightInfo::election_phragmen`.
|
||||||
* candidates are accepted in the election.
|
*
|
||||||
|
* When this limit is reached no more candidates are accepted in the election.
|
||||||
**/
|
**/
|
||||||
maxCandidates: u32 & AugmentedConst<ApiType>;
|
maxCandidates: u32 & AugmentedConst<ApiType>;
|
||||||
/**
|
/**
|
||||||
* The maximum number of voters to allow in a phragmen election.
|
* The maximum number of voters to allow in a phragmen election.
|
||||||
*
|
*
|
||||||
* Warning: This impacts the size of the election which is run onchain.
|
* Warning: This impacts the size of the election which is run onchain. Chose wisely, and
|
||||||
|
* consider how it will impact `T::WeightInfo::election_phragmen`.
|
||||||
|
*
|
||||||
* When the limit is reached the new voters are ignored.
|
* When the limit is reached the new voters are ignored.
|
||||||
**/
|
**/
|
||||||
maxVoters: u32 & AugmentedConst<ApiType>;
|
maxVoters: u32 & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* Maximum numbers of votes per voter.
|
||||||
|
*
|
||||||
|
* Warning: This impacts the size of the election which is run onchain. Chose wisely, and
|
||||||
|
* consider how it will impact `T::WeightInfo::election_phragmen`.
|
||||||
|
**/
|
||||||
|
maxVotesPerVoter: u32 & AugmentedConst<ApiType>;
|
||||||
/**
|
/**
|
||||||
* Identifier for the elections-phragmen pallet's lock
|
* Identifier for the elections-phragmen pallet's lock
|
||||||
**/
|
**/
|
||||||
|
|||||||
@@ -45,40 +45,6 @@ declare module '@polkadot/api-base/types/errors' {
|
|||||||
**/
|
**/
|
||||||
[key: string]: AugmentedError<ApiType>;
|
[key: string]: AugmentedError<ApiType>;
|
||||||
};
|
};
|
||||||
authorship: {
|
|
||||||
/**
|
|
||||||
* The uncle is genesis.
|
|
||||||
**/
|
|
||||||
GenesisUncle: AugmentedError<ApiType>;
|
|
||||||
/**
|
|
||||||
* The uncle parent not in the chain.
|
|
||||||
**/
|
|
||||||
InvalidUncleParent: AugmentedError<ApiType>;
|
|
||||||
/**
|
|
||||||
* The uncle isn't recent enough to be included.
|
|
||||||
**/
|
|
||||||
OldUncle: AugmentedError<ApiType>;
|
|
||||||
/**
|
|
||||||
* The uncle is too high in chain.
|
|
||||||
**/
|
|
||||||
TooHighUncle: AugmentedError<ApiType>;
|
|
||||||
/**
|
|
||||||
* Too many uncles.
|
|
||||||
**/
|
|
||||||
TooManyUncles: AugmentedError<ApiType>;
|
|
||||||
/**
|
|
||||||
* The uncle is already included.
|
|
||||||
**/
|
|
||||||
UncleAlreadyIncluded: AugmentedError<ApiType>;
|
|
||||||
/**
|
|
||||||
* Uncles already set in the block.
|
|
||||||
**/
|
|
||||||
UnclesAlreadySet: AugmentedError<ApiType>;
|
|
||||||
/**
|
|
||||||
* Generic error
|
|
||||||
**/
|
|
||||||
[key: string]: AugmentedError<ApiType>;
|
|
||||||
};
|
|
||||||
babe: {
|
babe: {
|
||||||
/**
|
/**
|
||||||
* A given equivocation report is valid but already previously reported.
|
* A given equivocation report is valid but already previously reported.
|
||||||
@@ -509,6 +475,10 @@ declare module '@polkadot/api-base/types/errors' {
|
|||||||
* The given account did not vote on the referendum.
|
* The given account did not vote on the referendum.
|
||||||
**/
|
**/
|
||||||
NotVoter: AugmentedError<ApiType>;
|
NotVoter: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* The preimage does not exist.
|
||||||
|
**/
|
||||||
|
PreimageNotExist: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* Proposal still blacklisted
|
* Proposal still blacklisted
|
||||||
**/
|
**/
|
||||||
@@ -724,6 +694,10 @@ declare module '@polkadot/api-base/types/errors' {
|
|||||||
* No track exists for the proposal origin.
|
* No track exists for the proposal origin.
|
||||||
**/
|
**/
|
||||||
NoTrack: AugmentedError<ApiType>;
|
NoTrack: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* The preimage does not exist.
|
||||||
|
**/
|
||||||
|
PreimageNotExist: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* The queue of the track is empty.
|
* The queue of the track is empty.
|
||||||
**/
|
**/
|
||||||
@@ -1146,6 +1120,10 @@ declare module '@polkadot/api-base/types/errors' {
|
|||||||
* pool at a time.
|
* pool at a time.
|
||||||
**/
|
**/
|
||||||
AccountBelongsToOtherPool: AugmentedError<ApiType>;
|
AccountBelongsToOtherPool: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Bonding extra is restricted to the exact pending reward amount.
|
||||||
|
**/
|
||||||
|
BondExtraRestricted: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* The pools state cannot be changed.
|
* The pools state cannot be changed.
|
||||||
**/
|
**/
|
||||||
@@ -1478,12 +1456,20 @@ declare module '@polkadot/api-base/types/errors' {
|
|||||||
* Invalid signature on statement.
|
* Invalid signature on statement.
|
||||||
**/
|
**/
|
||||||
InvalidSignature: AugmentedError<ApiType>;
|
InvalidSignature: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* A dispute vote from a malicious backer.
|
||||||
|
**/
|
||||||
|
MaliciousBacker: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* No backing votes were provides along dispute statements.
|
||||||
|
**/
|
||||||
|
MissingBackingVotes: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* A dispute where there are only votes on one side.
|
* A dispute where there are only votes on one side.
|
||||||
**/
|
**/
|
||||||
SingleSidedDispute: AugmentedError<ApiType>;
|
SingleSidedDispute: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* Unconfirmed dispute statement sets provided
|
* Unconfirmed dispute statement sets provided.
|
||||||
**/
|
**/
|
||||||
UnconfirmedDispute: AugmentedError<ApiType>;
|
UnconfirmedDispute: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
@@ -1748,6 +1734,10 @@ declare module '@polkadot/api-base/types/errors' {
|
|||||||
* No track exists for the proposal origin.
|
* No track exists for the proposal origin.
|
||||||
**/
|
**/
|
||||||
NoTrack: AugmentedError<ApiType>;
|
NoTrack: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* The preimage does not exist.
|
||||||
|
**/
|
||||||
|
PreimageNotExist: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* The queue of the track is empty.
|
* The queue of the track is empty.
|
||||||
**/
|
**/
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import type { Bytes, Null, Option, Result, U8aFixed, Vec, bool, u128, u16, u32,
|
|||||||
import type { ITuple } from '@polkadot/types-codec/types';
|
import type { ITuple } from '@polkadot/types-codec/types';
|
||||||
import type { EthereumAddress } from '@polkadot/types/interfaces/eth';
|
import type { EthereumAddress } from '@polkadot/types/interfaces/eth';
|
||||||
import type { AccountId32, H256, Perbill, Perquintill } from '@polkadot/types/interfaces/runtime';
|
import type { AccountId32, H256, Perbill, Perquintill } from '@polkadot/types/interfaces/runtime';
|
||||||
import type { FrameSupportDispatchDispatchInfo, FrameSupportDispatchPostDispatchInfo, FrameSupportPreimagesBounded, FrameSupportTokensMiscBalanceStatus, KusamaRuntimeProxyType, PalletConvictionVotingTally, PalletDemocracyVoteAccountVote, PalletDemocracyVoteThreshold, PalletElectionProviderMultiPhaseElectionCompute, PalletElectionProviderMultiPhasePhase, PalletImOnlineSr25519AppSr25519Public, PalletMultisigTimepoint, PalletNominationPoolsPoolState, PalletRankedCollectiveTally, PalletRankedCollectiveVoteRecord, PalletStakingExposure, PalletStakingForcing, PalletStakingValidatorPrefs, PolkadotParachainPrimitivesHrmpChannelId, PolkadotPrimitivesV2CandidateReceipt, PolkadotRuntimeParachainsDisputesDisputeLocation, PolkadotRuntimeParachainsDisputesDisputeResult, SpFinalityGrandpaAppPublic, SpNposElectionsElectionScore, SpRuntimeDispatchError, SpRuntimeDispatchErrorWithPostInfo, SpWeightsWeightV2Weight, XcmV3MultiLocation, XcmV3MultiassetMultiAssets, XcmV3Response, XcmV3TraitsError, XcmV3TraitsOutcome, XcmV3Xcm, XcmVersionedMultiAssets, XcmVersionedMultiLocation } from '@polkadot/types/lookup';
|
import type { FrameSupportDispatchDispatchInfo, FrameSupportDispatchPostDispatchInfo, FrameSupportPreimagesBounded, FrameSupportTokensMiscBalanceStatus, KusamaRuntimeProxyType, PalletConvictionVotingTally, PalletDemocracyMetadataOwner, PalletDemocracyVoteAccountVote, PalletDemocracyVoteThreshold, PalletElectionProviderMultiPhaseElectionCompute, PalletElectionProviderMultiPhasePhase, PalletImOnlineSr25519AppSr25519Public, PalletMultisigTimepoint, PalletNominationPoolsPoolState, PalletRankedCollectiveTally, PalletRankedCollectiveVoteRecord, PalletStakingExposure, PalletStakingForcing, PalletStakingValidatorPrefs, PolkadotParachainPrimitivesHrmpChannelId, PolkadotPrimitivesV2CandidateReceipt, PolkadotRuntimeParachainsDisputesDisputeLocation, PolkadotRuntimeParachainsDisputesDisputeResult, SpFinalityGrandpaAppPublic, SpNposElectionsElectionScore, SpRuntimeDispatchError, SpRuntimeDispatchErrorWithPostInfo, SpWeightsWeightV2Weight, XcmV3MultiLocation, XcmV3MultiassetMultiAssets, XcmV3Response, XcmV3TraitsError, XcmV3TraitsOutcome, XcmV3Xcm, XcmVersionedMultiAssets, XcmVersionedMultiLocation } from '@polkadot/types/lookup';
|
||||||
|
|
||||||
export type __AugmentedEvent<ApiType extends ApiTypes> = AugmentedEvent<ApiType>;
|
export type __AugmentedEvent<ApiType extends ApiTypes> = AugmentedEvent<ApiType>;
|
||||||
|
|
||||||
@@ -281,6 +281,18 @@ declare module '@polkadot/api-base/types/events' {
|
|||||||
* An external proposal has been tabled.
|
* An external proposal has been tabled.
|
||||||
**/
|
**/
|
||||||
ExternalTabled: AugmentedEvent<ApiType, []>;
|
ExternalTabled: AugmentedEvent<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* Metadata for a proposal or a referendum has been cleared.
|
||||||
|
**/
|
||||||
|
MetadataCleared: AugmentedEvent<ApiType, [owner: PalletDemocracyMetadataOwner, hash_: H256], { owner: PalletDemocracyMetadataOwner, hash_: H256 }>;
|
||||||
|
/**
|
||||||
|
* Metadata for a proposal or a referendum has been set.
|
||||||
|
**/
|
||||||
|
MetadataSet: AugmentedEvent<ApiType, [owner: PalletDemocracyMetadataOwner, hash_: H256], { owner: PalletDemocracyMetadataOwner, hash_: H256 }>;
|
||||||
|
/**
|
||||||
|
* Metadata has been transferred to new owner.
|
||||||
|
**/
|
||||||
|
MetadataTransferred: AugmentedEvent<ApiType, [prevOwner: PalletDemocracyMetadataOwner, owner: PalletDemocracyMetadataOwner, hash_: H256], { prevOwner: PalletDemocracyMetadataOwner, owner: PalletDemocracyMetadataOwner, hash_: H256 }>;
|
||||||
/**
|
/**
|
||||||
* A proposal has been rejected by referendum.
|
* A proposal has been rejected by referendum.
|
||||||
**/
|
**/
|
||||||
@@ -451,6 +463,14 @@ declare module '@polkadot/api-base/types/events' {
|
|||||||
* A referendum has been killed.
|
* A referendum has been killed.
|
||||||
**/
|
**/
|
||||||
Killed: AugmentedEvent<ApiType, [index: u32, tally: PalletRankedCollectiveTally], { index: u32, tally: PalletRankedCollectiveTally }>;
|
Killed: AugmentedEvent<ApiType, [index: u32, tally: PalletRankedCollectiveTally], { index: u32, tally: PalletRankedCollectiveTally }>;
|
||||||
|
/**
|
||||||
|
* Metadata for a referendum has been cleared.
|
||||||
|
**/
|
||||||
|
MetadataCleared: AugmentedEvent<ApiType, [index: u32, hash_: H256], { index: u32, hash_: H256 }>;
|
||||||
|
/**
|
||||||
|
* Metadata for a referendum has been set.
|
||||||
|
**/
|
||||||
|
MetadataSet: AugmentedEvent<ApiType, [index: u32, hash_: H256], { index: u32, hash_: H256 }>;
|
||||||
/**
|
/**
|
||||||
* A proposal has been rejected by referendum.
|
* A proposal has been rejected by referendum.
|
||||||
**/
|
**/
|
||||||
@@ -737,7 +757,7 @@ declare module '@polkadot/api-base/types/events' {
|
|||||||
* The roles of a pool have been updated to the given new roles. Note that the depositor
|
* The roles of a pool have been updated to the given new roles. Note that the depositor
|
||||||
* can never change.
|
* can never change.
|
||||||
**/
|
**/
|
||||||
RolesUpdated: AugmentedEvent<ApiType, [root: Option<AccountId32>, stateToggler: Option<AccountId32>, nominator: Option<AccountId32>], { root: Option<AccountId32>, stateToggler: Option<AccountId32>, nominator: Option<AccountId32> }>;
|
RolesUpdated: AugmentedEvent<ApiType, [root: Option<AccountId32>, bouncer: Option<AccountId32>, nominator: Option<AccountId32>], { root: Option<AccountId32>, bouncer: Option<AccountId32>, nominator: Option<AccountId32> }>;
|
||||||
/**
|
/**
|
||||||
* The state of a pool has changed
|
* The state of a pool has changed
|
||||||
**/
|
**/
|
||||||
@@ -1025,6 +1045,14 @@ declare module '@polkadot/api-base/types/events' {
|
|||||||
* A referendum has been killed.
|
* A referendum has been killed.
|
||||||
**/
|
**/
|
||||||
Killed: AugmentedEvent<ApiType, [index: u32, tally: PalletConvictionVotingTally], { index: u32, tally: PalletConvictionVotingTally }>;
|
Killed: AugmentedEvent<ApiType, [index: u32, tally: PalletConvictionVotingTally], { index: u32, tally: PalletConvictionVotingTally }>;
|
||||||
|
/**
|
||||||
|
* Metadata for a referendum has been cleared.
|
||||||
|
**/
|
||||||
|
MetadataCleared: AugmentedEvent<ApiType, [index: u32, hash_: H256], { index: u32, hash_: H256 }>;
|
||||||
|
/**
|
||||||
|
* Metadata for a referendum has been set.
|
||||||
|
**/
|
||||||
|
MetadataSet: AugmentedEvent<ApiType, [index: u32, hash_: H256], { index: u32, hash_: H256 }>;
|
||||||
/**
|
/**
|
||||||
* A proposal has been rejected by referendum.
|
* A proposal has been rejected by referendum.
|
||||||
**/
|
**/
|
||||||
@@ -1155,6 +1183,10 @@ declare module '@polkadot/api-base/types/events' {
|
|||||||
* A new \[max\] member count has been set
|
* A new \[max\] member count has been set
|
||||||
**/
|
**/
|
||||||
NewMaxMembers: AugmentedEvent<ApiType, [max: u32], { max: u32 }>;
|
NewMaxMembers: AugmentedEvent<ApiType, [max: u32], { max: u32 }>;
|
||||||
|
/**
|
||||||
|
* A group of members has been choosen as Skeptics
|
||||||
|
**/
|
||||||
|
SkepticsChosen: AugmentedEvent<ApiType, [skeptics: Vec<AccountId32>], { skeptics: Vec<AccountId32> }>;
|
||||||
/**
|
/**
|
||||||
* A suspended member has been judged.
|
* A suspended member has been judged.
|
||||||
**/
|
**/
|
||||||
|
|||||||
@@ -7,11 +7,11 @@ import '@polkadot/api-base/types/storage';
|
|||||||
|
|
||||||
import type { ApiTypes, AugmentedQuery, QueryableStorageEntry } from '@polkadot/api-base/types';
|
import type { ApiTypes, AugmentedQuery, QueryableStorageEntry } from '@polkadot/api-base/types';
|
||||||
import type { Data } from '@polkadot/types';
|
import type { Data } from '@polkadot/types';
|
||||||
import type { Bytes, Null, Option, U8aFixed, Vec, WrapperOpaque, bool, u128, u16, u32, u64 } from '@polkadot/types-codec';
|
import type { BTreeSet, Bytes, Null, Option, U8aFixed, Vec, WrapperOpaque, bool, u128, u16, u32, u64 } from '@polkadot/types-codec';
|
||||||
import type { AnyNumber, ITuple } from '@polkadot/types-codec/types';
|
import type { AnyNumber, ITuple } from '@polkadot/types-codec/types';
|
||||||
import type { EthereumAddress } from '@polkadot/types/interfaces/eth';
|
import type { EthereumAddress } from '@polkadot/types/interfaces/eth';
|
||||||
import type { AccountId32, Call, H256, Perbill, Percent } from '@polkadot/types/interfaces/runtime';
|
import type { AccountId32, Call, H256, Perbill, Percent } from '@polkadot/types/interfaces/runtime';
|
||||||
import type { FrameSupportDispatchPerDispatchClassWeight, FrameSupportPreimagesBounded, FrameSystemAccountInfo, FrameSystemEventRecord, FrameSystemLastRuntimeUpgradeInfo, FrameSystemPhase, KusamaRuntimeSessionKeys, PalletAuthorshipUncleEntryItem, PalletBagsListListBag, PalletBagsListListNode, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesReserveData, PalletBountiesBounty, PalletChildBountiesChildBounty, PalletCollectiveVotes, PalletConvictionVotingVoteVoting, PalletDemocracyReferendumInfo, PalletDemocracyVoteThreshold, PalletDemocracyVoteVoting, PalletElectionProviderMultiPhasePhase, PalletElectionProviderMultiPhaseReadySolution, PalletElectionProviderMultiPhaseRoundSnapshot, PalletElectionProviderMultiPhaseSignedSignedSubmission, PalletElectionProviderMultiPhaseSolutionOrSnapshotSize, PalletElectionsPhragmenSeatHolder, PalletElectionsPhragmenVoter, PalletFastUnstakeUnstakeRequest, PalletGrandpaStoredPendingChange, PalletGrandpaStoredState, PalletIdentityRegistrarInfo, PalletIdentityRegistration, PalletImOnlineBoundedOpaqueNetworkState, PalletImOnlineSr25519AppSr25519Public, PalletMultisigMultisig, PalletNisBid, PalletNisReceiptRecord, PalletNisSummaryRecord, PalletNominationPoolsBondedPoolInner, PalletNominationPoolsPoolMember, PalletNominationPoolsRewardPool, PalletNominationPoolsSubPools, PalletPreimageRequestStatus, PalletProxyAnnouncement, PalletProxyProxyDefinition, PalletRankedCollectiveMemberRecord, PalletRankedCollectiveVoteRecord, PalletRecoveryActiveRecovery, PalletRecoveryRecoveryConfig, PalletReferendaReferendumInfoConvictionVotingTally, PalletReferendaReferendumInfoRankedCollectiveTally, PalletSchedulerScheduled, PalletSocietyBid, PalletSocietyBidKind, PalletSocietyVote, PalletSocietyVouchingStatus, PalletStakingActiveEraInfo, PalletStakingEraRewardPoints, PalletStakingExposure, PalletStakingForcing, PalletStakingNominations, PalletStakingRewardDestination, PalletStakingSlashingSlashingSpans, PalletStakingSlashingSpanRecord, PalletStakingStakingLedger, PalletStakingUnappliedSlash, PalletStakingValidatorPrefs, PalletTipsOpenTip, PalletTransactionPaymentReleases, PalletTreasuryProposal, PalletVestingReleases, PalletVestingVestingInfo, PalletXcmQueryStatus, PalletXcmRemoteLockedFungibleRecord, PalletXcmVersionMigrationStage, PolkadotCorePrimitivesInboundDownwardMessage, PolkadotCorePrimitivesInboundHrmpMessage, PolkadotParachainPrimitivesHrmpChannelId, PolkadotPrimitivesV2AssignmentAppPublic, PolkadotPrimitivesV2CandidateCommitments, PolkadotPrimitivesV2CoreOccupied, PolkadotPrimitivesV2DisputeState, PolkadotPrimitivesV2ScrapedOnChainVotes, PolkadotPrimitivesV2SessionInfo, PolkadotPrimitivesV2UpgradeGoAhead, PolkadotPrimitivesV2UpgradeRestriction, PolkadotPrimitivesV2ValidatorAppPublic, PolkadotRuntimeCommonClaimsStatementKind, PolkadotRuntimeCommonCrowdloanFundInfo, PolkadotRuntimeCommonParasRegistrarParaInfo, PolkadotRuntimeParachainsConfigurationHostConfiguration, PolkadotRuntimeParachainsHrmpHrmpChannel, PolkadotRuntimeParachainsHrmpHrmpOpenChannelRequest, PolkadotRuntimeParachainsInclusionAvailabilityBitfieldRecord, PolkadotRuntimeParachainsInclusionCandidatePendingAvailability, PolkadotRuntimeParachainsInitializerBufferedSessionChange, PolkadotRuntimeParachainsParasParaGenesisArgs, PolkadotRuntimeParachainsParasParaLifecycle, PolkadotRuntimeParachainsParasParaPastCodeMeta, PolkadotRuntimeParachainsParasPvfCheckActiveVoteState, PolkadotRuntimeParachainsSchedulerCoreAssignment, PolkadotRuntimeParachainsSchedulerParathreadClaimQueue, SpConsensusBabeAppPublic, SpConsensusBabeBabeEpochConfiguration, SpConsensusBabeDigestsNextConfigDescriptor, SpConsensusBabeDigestsPreDigest, SpCoreCryptoKeyTypeId, SpNposElectionsElectionScore, SpRuntimeDigest, SpStakingOffenceOffenceDetails, SpWeightsWeightV2Weight, XcmVersionedAssetId, XcmVersionedMultiLocation } from '@polkadot/types/lookup';
|
import type { FrameSupportDispatchPerDispatchClassWeight, FrameSupportPreimagesBounded, FrameSystemAccountInfo, FrameSystemEventRecord, FrameSystemLastRuntimeUpgradeInfo, FrameSystemPhase, KusamaRuntimeSessionKeys, PalletBagsListListBag, PalletBagsListListNode, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesReserveData, PalletBountiesBounty, PalletChildBountiesChildBounty, PalletCollectiveVotes, PalletConvictionVotingVoteVoting, PalletDemocracyMetadataOwner, PalletDemocracyReferendumInfo, PalletDemocracyVoteThreshold, PalletDemocracyVoteVoting, PalletElectionProviderMultiPhasePhase, PalletElectionProviderMultiPhaseReadySolution, PalletElectionProviderMultiPhaseRoundSnapshot, PalletElectionProviderMultiPhaseSignedSignedSubmission, PalletElectionProviderMultiPhaseSolutionOrSnapshotSize, PalletElectionsPhragmenSeatHolder, PalletElectionsPhragmenVoter, PalletFastUnstakeUnstakeRequest, PalletGrandpaStoredPendingChange, PalletGrandpaStoredState, PalletIdentityRegistrarInfo, PalletIdentityRegistration, PalletImOnlineBoundedOpaqueNetworkState, PalletImOnlineSr25519AppSr25519Public, PalletMultisigMultisig, PalletNisBid, PalletNisReceiptRecord, PalletNisSummaryRecord, PalletNominationPoolsBondedPoolInner, PalletNominationPoolsClaimPermission, PalletNominationPoolsPoolMember, PalletNominationPoolsRewardPool, PalletNominationPoolsSubPools, PalletPreimageRequestStatus, PalletProxyAnnouncement, PalletProxyProxyDefinition, PalletRankedCollectiveMemberRecord, PalletRankedCollectiveVoteRecord, PalletRecoveryActiveRecovery, PalletRecoveryRecoveryConfig, PalletReferendaReferendumInfoConvictionVotingTally, PalletReferendaReferendumInfoRankedCollectiveTally, PalletSchedulerScheduled, PalletSocietyBid, PalletSocietyBidKind, PalletSocietyVote, PalletSocietyVouchingStatus, PalletStakingActiveEraInfo, PalletStakingEraRewardPoints, PalletStakingExposure, PalletStakingForcing, PalletStakingNominations, PalletStakingRewardDestination, PalletStakingSlashingSlashingSpans, PalletStakingSlashingSpanRecord, PalletStakingStakingLedger, PalletStakingUnappliedSlash, PalletStakingValidatorPrefs, PalletTipsOpenTip, PalletTransactionPaymentReleases, PalletTreasuryProposal, PalletVestingReleases, PalletVestingVestingInfo, PalletXcmQueryStatus, PalletXcmRemoteLockedFungibleRecord, PalletXcmVersionMigrationStage, PolkadotCorePrimitivesInboundDownwardMessage, PolkadotCorePrimitivesInboundHrmpMessage, PolkadotParachainPrimitivesHrmpChannelId, PolkadotPrimitivesV2AssignmentAppPublic, PolkadotPrimitivesV2CandidateCommitments, PolkadotPrimitivesV2CoreOccupied, PolkadotPrimitivesV2DisputeState, PolkadotPrimitivesV2ScrapedOnChainVotes, PolkadotPrimitivesV2SessionInfo, PolkadotPrimitivesV2UpgradeGoAhead, PolkadotPrimitivesV2UpgradeRestriction, PolkadotPrimitivesV2ValidatorAppPublic, PolkadotPrimitivesVstagingExecutorParams, PolkadotRuntimeCommonClaimsStatementKind, PolkadotRuntimeCommonCrowdloanFundInfo, PolkadotRuntimeCommonParasRegistrarParaInfo, PolkadotRuntimeParachainsConfigurationHostConfiguration, PolkadotRuntimeParachainsHrmpHrmpChannel, PolkadotRuntimeParachainsHrmpHrmpOpenChannelRequest, PolkadotRuntimeParachainsInclusionAvailabilityBitfieldRecord, PolkadotRuntimeParachainsInclusionCandidatePendingAvailability, PolkadotRuntimeParachainsInitializerBufferedSessionChange, PolkadotRuntimeParachainsParasParaGenesisArgs, PolkadotRuntimeParachainsParasParaLifecycle, PolkadotRuntimeParachainsParasParaPastCodeMeta, PolkadotRuntimeParachainsParasPvfCheckActiveVoteState, PolkadotRuntimeParachainsSchedulerCoreAssignment, PolkadotRuntimeParachainsSchedulerParathreadClaimQueue, SpConsensusBabeAppPublic, SpConsensusBabeBabeEpochConfiguration, SpConsensusBabeDigestsNextConfigDescriptor, SpConsensusBabeDigestsPreDigest, SpCoreCryptoKeyTypeId, SpNposElectionsElectionScore, SpRuntimeDigest, SpStakingOffenceOffenceDetails, SpWeightsWeightV2Weight, XcmVersionedAssetId, XcmVersionedMultiLocation } from '@polkadot/types/lookup';
|
||||||
import type { Observable } from '@polkadot/types/types';
|
import type { Observable } from '@polkadot/types/types';
|
||||||
|
|
||||||
export type __AugmentedQuery<ApiType extends ApiTypes> = AugmentedQuery<ApiType, () => unknown>;
|
export type __AugmentedQuery<ApiType extends ApiTypes> = AugmentedQuery<ApiType, () => unknown>;
|
||||||
@@ -53,14 +53,6 @@ declare module '@polkadot/api-base/types/storage' {
|
|||||||
* Author of current block.
|
* Author of current block.
|
||||||
**/
|
**/
|
||||||
author: AugmentedQuery<ApiType, () => Observable<Option<AccountId32>>, []> & QueryableStorageEntry<ApiType, []>;
|
author: AugmentedQuery<ApiType, () => Observable<Option<AccountId32>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
/**
|
|
||||||
* Whether uncles were already set in this block.
|
|
||||||
**/
|
|
||||||
didSetUncles: AugmentedQuery<ApiType, () => Observable<bool>, []> & QueryableStorageEntry<ApiType, []>;
|
|
||||||
/**
|
|
||||||
* Uncles
|
|
||||||
**/
|
|
||||||
uncles: AugmentedQuery<ApiType, () => Observable<Vec<PalletAuthorshipUncleEntryItem>>, []> & QueryableStorageEntry<ApiType, []>;
|
|
||||||
/**
|
/**
|
||||||
* Generic query
|
* Generic query
|
||||||
**/
|
**/
|
||||||
@@ -159,6 +151,17 @@ declare module '@polkadot/api-base/types/storage' {
|
|||||||
* epoch.
|
* epoch.
|
||||||
**/
|
**/
|
||||||
segmentIndex: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
|
segmentIndex: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* A list of the last 100 skipped epochs and the corresponding session index
|
||||||
|
* when the epoch was skipped.
|
||||||
|
*
|
||||||
|
* This is only used for validating equivocation proofs. An equivocation proof
|
||||||
|
* must contains a key-ownership proof for a given session, therefore we need a
|
||||||
|
* way to tie together sessions and epoch indices, i.e. we need to validate that
|
||||||
|
* a validator was the owner of a given key on a given session, and what the
|
||||||
|
* active epoch index was during that session.
|
||||||
|
**/
|
||||||
|
skippedEpochs: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[u64, u32]>>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
/**
|
/**
|
||||||
* TWOX-NOTE: `SegmentIndex` is an increasing integer, so this is okay.
|
* TWOX-NOTE: `SegmentIndex` is an increasing integer, so this is okay.
|
||||||
**/
|
**/
|
||||||
@@ -411,6 +414,15 @@ declare module '@polkadot/api-base/types/storage' {
|
|||||||
* `ReferendumCount` if there isn't a unbaked referendum.
|
* `ReferendumCount` if there isn't a unbaked referendum.
|
||||||
**/
|
**/
|
||||||
lowestUnbaked: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
|
lowestUnbaked: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* General information concerning any proposal or referendum.
|
||||||
|
* The `PreimageHash` refers to the preimage of the `Preimages` provider which can be a JSON
|
||||||
|
* dump or IPFS hash of a JSON file.
|
||||||
|
*
|
||||||
|
* Consider a garbage collection for a metadata of finished referendums to `unrequest` (remove)
|
||||||
|
* large preimages.
|
||||||
|
**/
|
||||||
|
metadataOf: AugmentedQuery<ApiType, (arg: PalletDemocracyMetadataOwner | { External: any } | { Proposal: any } | { Referendum: any } | string | Uint8Array) => Observable<Option<H256>>, [PalletDemocracyMetadataOwner]> & QueryableStorageEntry<ApiType, [PalletDemocracyMetadataOwner]>;
|
||||||
/**
|
/**
|
||||||
* The referendum to be tabled whenever it would be valid to table an external proposal.
|
* The referendum to be tabled whenever it would be valid to table an external proposal.
|
||||||
* This happens when a referendum needs to be tabled and one of two conditions are met:
|
* This happens when a referendum needs to be tabled and one of two conditions are met:
|
||||||
@@ -612,6 +624,15 @@ declare module '@polkadot/api-base/types/storage' {
|
|||||||
* The number of referenda being decided currently.
|
* The number of referenda being decided currently.
|
||||||
**/
|
**/
|
||||||
decidingCount: AugmentedQuery<ApiType, (arg: u16 | AnyNumber | Uint8Array) => Observable<u32>, [u16]> & QueryableStorageEntry<ApiType, [u16]>;
|
decidingCount: AugmentedQuery<ApiType, (arg: u16 | AnyNumber | Uint8Array) => Observable<u32>, [u16]> & QueryableStorageEntry<ApiType, [u16]>;
|
||||||
|
/**
|
||||||
|
* The metadata is a general information concerning the referendum.
|
||||||
|
* The `PreimageHash` refers to the preimage of the `Preimages` provider which can be a JSON
|
||||||
|
* dump or IPFS hash of a JSON file.
|
||||||
|
*
|
||||||
|
* Consider a garbage collection for a metadata of finished referendums to `unrequest` (remove)
|
||||||
|
* large preimages.
|
||||||
|
**/
|
||||||
|
metadataOf: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Option<H256>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
|
||||||
/**
|
/**
|
||||||
* The next free referendum index, aka the number of referenda started so far.
|
* The next free referendum index, aka the number of referenda started so far.
|
||||||
**/
|
**/
|
||||||
@@ -650,6 +671,12 @@ declare module '@polkadot/api-base/types/storage' {
|
|||||||
* A mapping from grandpa set ID to the index of the *most recent* session for which its
|
* A mapping from grandpa set ID to the index of the *most recent* session for which its
|
||||||
* members were responsible.
|
* members were responsible.
|
||||||
*
|
*
|
||||||
|
* This is only used for validating equivocation proofs. An equivocation proof must
|
||||||
|
* contains a key-ownership proof for a given session, therefore we need a way to tie
|
||||||
|
* together sessions and GRANDPA set ids, i.e. we need to validate that a validator
|
||||||
|
* was the owner of a given key on a given session, and what the active set ID was
|
||||||
|
* during that session.
|
||||||
|
*
|
||||||
* TWOX-NOTE: `SetId` is not under user control.
|
* TWOX-NOTE: `SetId` is not under user control.
|
||||||
**/
|
**/
|
||||||
setIdSession: AugmentedQuery<ApiType, (arg: u64 | AnyNumber | Uint8Array) => Observable<Option<u32>>, [u64]> & QueryableStorageEntry<ApiType, [u64]>;
|
setIdSession: AugmentedQuery<ApiType, (arg: u64 | AnyNumber | Uint8Array) => Observable<Option<u32>>, [u64]> & QueryableStorageEntry<ApiType, [u64]>;
|
||||||
@@ -942,6 +969,10 @@ declare module '@polkadot/api-base/types/storage' {
|
|||||||
* Storage for bonded pools.
|
* Storage for bonded pools.
|
||||||
**/
|
**/
|
||||||
bondedPools: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Option<PalletNominationPoolsBondedPoolInner>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
|
bondedPools: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Option<PalletNominationPoolsBondedPoolInner>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
|
||||||
|
/**
|
||||||
|
* Map from a pool member account to their opted claim permission.
|
||||||
|
**/
|
||||||
|
claimPermissions: AugmentedQuery<ApiType, (arg: AccountId32 | string | Uint8Array) => Observable<PalletNominationPoolsClaimPermission>, [AccountId32]> & QueryableStorageEntry<ApiType, [AccountId32]>;
|
||||||
/**
|
/**
|
||||||
* Counter for the related counted storage map
|
* Counter for the related counted storage map
|
||||||
**/
|
**/
|
||||||
@@ -1280,6 +1311,11 @@ declare module '@polkadot/api-base/types/storage' {
|
|||||||
[key: string]: QueryableStorageEntry<ApiType>;
|
[key: string]: QueryableStorageEntry<ApiType>;
|
||||||
};
|
};
|
||||||
parasDisputes: {
|
parasDisputes: {
|
||||||
|
/**
|
||||||
|
* Backing votes stored for each dispute.
|
||||||
|
* This storage is used for slashing.
|
||||||
|
**/
|
||||||
|
backersOnDisputes: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: H256 | string | Uint8Array) => Observable<Option<BTreeSet<u32>>>, [u32, H256]> & QueryableStorageEntry<ApiType, [u32, H256]>;
|
||||||
/**
|
/**
|
||||||
* All ongoing or concluded disputes for the last several sessions.
|
* All ongoing or concluded disputes for the last several sessions.
|
||||||
**/
|
**/
|
||||||
@@ -1321,6 +1357,10 @@ declare module '@polkadot/api-base/types/storage' {
|
|||||||
* The earliest session for which previous session info is stored.
|
* The earliest session for which previous session info is stored.
|
||||||
**/
|
**/
|
||||||
earliestStoredSession: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
|
earliestStoredSession: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* Executor parameter set for a given session index
|
||||||
|
**/
|
||||||
|
sessionExecutorParams: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Option<PolkadotPrimitivesVstagingExecutorParams>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
|
||||||
/**
|
/**
|
||||||
* Session information in a rolling window.
|
* Session information in a rolling window.
|
||||||
* Should have an entry in range `EarliestStoredSession..=CurrentSessionIndex`.
|
* Should have an entry in range `EarliestStoredSession..=CurrentSessionIndex`.
|
||||||
@@ -1444,6 +1484,15 @@ declare module '@polkadot/api-base/types/storage' {
|
|||||||
* The number of referenda being decided currently.
|
* The number of referenda being decided currently.
|
||||||
**/
|
**/
|
||||||
decidingCount: AugmentedQuery<ApiType, (arg: u16 | AnyNumber | Uint8Array) => Observable<u32>, [u16]> & QueryableStorageEntry<ApiType, [u16]>;
|
decidingCount: AugmentedQuery<ApiType, (arg: u16 | AnyNumber | Uint8Array) => Observable<u32>, [u16]> & QueryableStorageEntry<ApiType, [u16]>;
|
||||||
|
/**
|
||||||
|
* The metadata is a general information concerning the referendum.
|
||||||
|
* The `PreimageHash` refers to the preimage of the `Preimages` provider which can be a JSON
|
||||||
|
* dump or IPFS hash of a JSON file.
|
||||||
|
*
|
||||||
|
* Consider a garbage collection for a metadata of finished referendums to `unrequest` (remove)
|
||||||
|
* large preimages.
|
||||||
|
**/
|
||||||
|
metadataOf: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Option<H256>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
|
||||||
/**
|
/**
|
||||||
* The next free referendum index, aka the number of referenda started so far.
|
* The next free referendum index, aka the number of referenda started so far.
|
||||||
**/
|
**/
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -3,4 +3,4 @@
|
|||||||
|
|
||||||
// Do not edit, auto-generated by @polkadot/dev
|
// Do not edit, auto-generated by @polkadot/dev
|
||||||
|
|
||||||
export const packageInfo = { name: '@polkadot/api-augment', path: 'auto', type: 'auto', version: '9.13.6' };
|
export const packageInfo = { name: '@polkadot/api-augment', path: 'auto', type: 'auto', version: '10.0.1' };
|
||||||
|
|||||||
@@ -33,18 +33,6 @@ declare module '@polkadot/api-base/types/consts' {
|
|||||||
**/
|
**/
|
||||||
[key: string]: Codec;
|
[key: string]: Codec;
|
||||||
};
|
};
|
||||||
authorship: {
|
|
||||||
/**
|
|
||||||
* The number of blocks back we should accept uncles.
|
|
||||||
* This means that we will deal with uncle-parents that are
|
|
||||||
* `UncleGenerations + 1` before `now`.
|
|
||||||
**/
|
|
||||||
uncleGenerations: u32 & AugmentedConst<ApiType>;
|
|
||||||
/**
|
|
||||||
* Generic const
|
|
||||||
**/
|
|
||||||
[key: string]: Codec;
|
|
||||||
};
|
|
||||||
babe: {
|
babe: {
|
||||||
/**
|
/**
|
||||||
* The amount of time, in slots, that each epoch should last.
|
* The amount of time, in slots, that each epoch should last.
|
||||||
@@ -350,6 +338,15 @@ declare module '@polkadot/api-base/types/consts' {
|
|||||||
* Max Authorities in use
|
* Max Authorities in use
|
||||||
**/
|
**/
|
||||||
maxAuthorities: u32 & AugmentedConst<ApiType>;
|
maxAuthorities: u32 & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* The maximum number of entries to keep in the set id to session index mapping.
|
||||||
|
*
|
||||||
|
* Since the `SetIdSession` map is only used for validating equivocations this
|
||||||
|
* value should relate to the bonding duration of whatever staking system is
|
||||||
|
* being used (if any). If equivocation handling is not enabled then this value
|
||||||
|
* can be zero.
|
||||||
|
**/
|
||||||
|
maxSetIdSessionEntries: u64 & AugmentedConst<ApiType>;
|
||||||
/**
|
/**
|
||||||
* Generic const
|
* Generic const
|
||||||
**/
|
**/
|
||||||
@@ -485,18 +482,28 @@ declare module '@polkadot/api-base/types/consts' {
|
|||||||
/**
|
/**
|
||||||
* The maximum number of candidates in a phragmen election.
|
* The maximum number of candidates in a phragmen election.
|
||||||
*
|
*
|
||||||
* Warning: The election happens onchain, and this value will determine
|
* Warning: This impacts the size of the election which is run onchain. Chose wisely, and
|
||||||
* the size of the election. When this limit is reached no more
|
* consider how it will impact `T::WeightInfo::election_phragmen`.
|
||||||
* candidates are accepted in the election.
|
*
|
||||||
|
* When this limit is reached no more candidates are accepted in the election.
|
||||||
**/
|
**/
|
||||||
maxCandidates: u32 & AugmentedConst<ApiType>;
|
maxCandidates: u32 & AugmentedConst<ApiType>;
|
||||||
/**
|
/**
|
||||||
* The maximum number of voters to allow in a phragmen election.
|
* The maximum number of voters to allow in a phragmen election.
|
||||||
*
|
*
|
||||||
* Warning: This impacts the size of the election which is run onchain.
|
* Warning: This impacts the size of the election which is run onchain. Chose wisely, and
|
||||||
|
* consider how it will impact `T::WeightInfo::election_phragmen`.
|
||||||
|
*
|
||||||
* When the limit is reached the new voters are ignored.
|
* When the limit is reached the new voters are ignored.
|
||||||
**/
|
**/
|
||||||
maxVoters: u32 & AugmentedConst<ApiType>;
|
maxVoters: u32 & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* Maximum numbers of votes per voter.
|
||||||
|
*
|
||||||
|
* Warning: This impacts the size of the election which is run onchain. Chose wisely, and
|
||||||
|
* consider how it will impact `T::WeightInfo::election_phragmen`.
|
||||||
|
**/
|
||||||
|
maxVotesPerVoter: u32 & AugmentedConst<ApiType>;
|
||||||
/**
|
/**
|
||||||
* Identifier for the elections-phragmen pallet's lock
|
* Identifier for the elections-phragmen pallet's lock
|
||||||
**/
|
**/
|
||||||
|
|||||||
@@ -45,40 +45,6 @@ declare module '@polkadot/api-base/types/errors' {
|
|||||||
**/
|
**/
|
||||||
[key: string]: AugmentedError<ApiType>;
|
[key: string]: AugmentedError<ApiType>;
|
||||||
};
|
};
|
||||||
authorship: {
|
|
||||||
/**
|
|
||||||
* The uncle is genesis.
|
|
||||||
**/
|
|
||||||
GenesisUncle: AugmentedError<ApiType>;
|
|
||||||
/**
|
|
||||||
* The uncle parent not in the chain.
|
|
||||||
**/
|
|
||||||
InvalidUncleParent: AugmentedError<ApiType>;
|
|
||||||
/**
|
|
||||||
* The uncle isn't recent enough to be included.
|
|
||||||
**/
|
|
||||||
OldUncle: AugmentedError<ApiType>;
|
|
||||||
/**
|
|
||||||
* The uncle is too high in chain.
|
|
||||||
**/
|
|
||||||
TooHighUncle: AugmentedError<ApiType>;
|
|
||||||
/**
|
|
||||||
* Too many uncles.
|
|
||||||
**/
|
|
||||||
TooManyUncles: AugmentedError<ApiType>;
|
|
||||||
/**
|
|
||||||
* The uncle is already included.
|
|
||||||
**/
|
|
||||||
UncleAlreadyIncluded: AugmentedError<ApiType>;
|
|
||||||
/**
|
|
||||||
* Uncles already set in the block.
|
|
||||||
**/
|
|
||||||
UnclesAlreadySet: AugmentedError<ApiType>;
|
|
||||||
/**
|
|
||||||
* Generic error
|
|
||||||
**/
|
|
||||||
[key: string]: AugmentedError<ApiType>;
|
|
||||||
};
|
|
||||||
babe: {
|
babe: {
|
||||||
/**
|
/**
|
||||||
* A given equivocation report is valid but already previously reported.
|
* A given equivocation report is valid but already previously reported.
|
||||||
@@ -454,6 +420,10 @@ declare module '@polkadot/api-base/types/errors' {
|
|||||||
* The given account did not vote on the referendum.
|
* The given account did not vote on the referendum.
|
||||||
**/
|
**/
|
||||||
NotVoter: AugmentedError<ApiType>;
|
NotVoter: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* The preimage does not exist.
|
||||||
|
**/
|
||||||
|
PreimageNotExist: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* Proposal still blacklisted
|
* Proposal still blacklisted
|
||||||
**/
|
**/
|
||||||
@@ -890,6 +860,10 @@ declare module '@polkadot/api-base/types/errors' {
|
|||||||
* pool at a time.
|
* pool at a time.
|
||||||
**/
|
**/
|
||||||
AccountBelongsToOtherPool: AugmentedError<ApiType>;
|
AccountBelongsToOtherPool: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Bonding extra is restricted to the exact pending reward amount.
|
||||||
|
**/
|
||||||
|
BondExtraRestricted: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* The pools state cannot be changed.
|
* The pools state cannot be changed.
|
||||||
**/
|
**/
|
||||||
@@ -1222,12 +1196,20 @@ declare module '@polkadot/api-base/types/errors' {
|
|||||||
* Invalid signature on statement.
|
* Invalid signature on statement.
|
||||||
**/
|
**/
|
||||||
InvalidSignature: AugmentedError<ApiType>;
|
InvalidSignature: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* A dispute vote from a malicious backer.
|
||||||
|
**/
|
||||||
|
MaliciousBacker: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* No backing votes were provides along dispute statements.
|
||||||
|
**/
|
||||||
|
MissingBackingVotes: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* A dispute where there are only votes on one side.
|
* A dispute where there are only votes on one side.
|
||||||
**/
|
**/
|
||||||
SingleSidedDispute: AugmentedError<ApiType>;
|
SingleSidedDispute: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* Unconfirmed dispute statement sets provided
|
* Unconfirmed dispute statement sets provided.
|
||||||
**/
|
**/
|
||||||
UnconfirmedDispute: AugmentedError<ApiType>;
|
UnconfirmedDispute: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import type { Bytes, Null, Option, Result, U8aFixed, Vec, bool, u128, u16, u32,
|
|||||||
import type { ITuple } from '@polkadot/types-codec/types';
|
import type { ITuple } from '@polkadot/types-codec/types';
|
||||||
import type { EthereumAddress } from '@polkadot/types/interfaces/eth';
|
import type { EthereumAddress } from '@polkadot/types/interfaces/eth';
|
||||||
import type { AccountId32, H256, Perbill } from '@polkadot/types/interfaces/runtime';
|
import type { AccountId32, H256, Perbill } from '@polkadot/types/interfaces/runtime';
|
||||||
import type { FrameSupportDispatchDispatchInfo, FrameSupportTokensMiscBalanceStatus, PalletDemocracyVoteAccountVote, PalletDemocracyVoteThreshold, PalletElectionProviderMultiPhaseElectionCompute, PalletElectionProviderMultiPhasePhase, PalletImOnlineSr25519AppSr25519Public, PalletMultisigTimepoint, PalletNominationPoolsPoolState, PalletStakingExposure, PalletStakingForcing, PalletStakingValidatorPrefs, PolkadotParachainPrimitivesHrmpChannelId, PolkadotPrimitivesV2CandidateReceipt, PolkadotRuntimeParachainsDisputesDisputeLocation, PolkadotRuntimeParachainsDisputesDisputeResult, PolkadotRuntimeProxyType, SpFinalityGrandpaAppPublic, SpNposElectionsElectionScore, SpRuntimeDispatchError, SpWeightsWeightV2Weight, XcmV3MultiLocation, XcmV3MultiassetMultiAssets, XcmV3Response, XcmV3TraitsError, XcmV3TraitsOutcome, XcmV3Xcm, XcmVersionedMultiAssets, XcmVersionedMultiLocation } from '@polkadot/types/lookup';
|
import type { FrameSupportDispatchDispatchInfo, FrameSupportTokensMiscBalanceStatus, PalletDemocracyMetadataOwner, PalletDemocracyVoteAccountVote, PalletDemocracyVoteThreshold, PalletElectionProviderMultiPhaseElectionCompute, PalletElectionProviderMultiPhasePhase, PalletImOnlineSr25519AppSr25519Public, PalletMultisigTimepoint, PalletNominationPoolsPoolState, PalletStakingExposure, PalletStakingForcing, PalletStakingValidatorPrefs, PolkadotParachainPrimitivesHrmpChannelId, PolkadotPrimitivesV2CandidateReceipt, PolkadotRuntimeParachainsDisputesDisputeLocation, PolkadotRuntimeParachainsDisputesDisputeResult, PolkadotRuntimeProxyType, SpFinalityGrandpaAppPublic, SpNposElectionsElectionScore, SpRuntimeDispatchError, SpWeightsWeightV2Weight, XcmV3MultiLocation, XcmV3MultiassetMultiAssets, XcmV3Response, XcmV3TraitsError, XcmV3TraitsOutcome, XcmV3Xcm, XcmVersionedMultiAssets, XcmVersionedMultiLocation } from '@polkadot/types/lookup';
|
||||||
|
|
||||||
export type __AugmentedEvent<ApiType extends ApiTypes> = AugmentedEvent<ApiType>;
|
export type __AugmentedEvent<ApiType extends ApiTypes> = AugmentedEvent<ApiType>;
|
||||||
|
|
||||||
@@ -267,6 +267,18 @@ declare module '@polkadot/api-base/types/events' {
|
|||||||
* An external proposal has been tabled.
|
* An external proposal has been tabled.
|
||||||
**/
|
**/
|
||||||
ExternalTabled: AugmentedEvent<ApiType, []>;
|
ExternalTabled: AugmentedEvent<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* Metadata for a proposal or a referendum has been cleared.
|
||||||
|
**/
|
||||||
|
MetadataCleared: AugmentedEvent<ApiType, [owner: PalletDemocracyMetadataOwner, hash_: H256], { owner: PalletDemocracyMetadataOwner, hash_: H256 }>;
|
||||||
|
/**
|
||||||
|
* Metadata for a proposal or a referendum has been set.
|
||||||
|
**/
|
||||||
|
MetadataSet: AugmentedEvent<ApiType, [owner: PalletDemocracyMetadataOwner, hash_: H256], { owner: PalletDemocracyMetadataOwner, hash_: H256 }>;
|
||||||
|
/**
|
||||||
|
* Metadata has been transferred to new owner.
|
||||||
|
**/
|
||||||
|
MetadataTransferred: AugmentedEvent<ApiType, [prevOwner: PalletDemocracyMetadataOwner, owner: PalletDemocracyMetadataOwner, hash_: H256], { prevOwner: PalletDemocracyMetadataOwner, owner: PalletDemocracyMetadataOwner, hash_: H256 }>;
|
||||||
/**
|
/**
|
||||||
* A proposal has been rejected by referendum.
|
* A proposal has been rejected by referendum.
|
||||||
**/
|
**/
|
||||||
@@ -562,7 +574,7 @@ declare module '@polkadot/api-base/types/events' {
|
|||||||
* The roles of a pool have been updated to the given new roles. Note that the depositor
|
* The roles of a pool have been updated to the given new roles. Note that the depositor
|
||||||
* can never change.
|
* can never change.
|
||||||
**/
|
**/
|
||||||
RolesUpdated: AugmentedEvent<ApiType, [root: Option<AccountId32>, stateToggler: Option<AccountId32>, nominator: Option<AccountId32>], { root: Option<AccountId32>, stateToggler: Option<AccountId32>, nominator: Option<AccountId32> }>;
|
RolesUpdated: AugmentedEvent<ApiType, [root: Option<AccountId32>, bouncer: Option<AccountId32>, nominator: Option<AccountId32>], { root: Option<AccountId32>, bouncer: Option<AccountId32>, nominator: Option<AccountId32> }>;
|
||||||
/**
|
/**
|
||||||
* The state of a pool has changed
|
* The state of a pool has changed
|
||||||
**/
|
**/
|
||||||
|
|||||||
@@ -7,11 +7,11 @@ import '@polkadot/api-base/types/storage';
|
|||||||
|
|
||||||
import type { ApiTypes, AugmentedQuery, QueryableStorageEntry } from '@polkadot/api-base/types';
|
import type { ApiTypes, AugmentedQuery, QueryableStorageEntry } from '@polkadot/api-base/types';
|
||||||
import type { Data } from '@polkadot/types';
|
import type { Data } from '@polkadot/types';
|
||||||
import type { Bytes, Null, Option, U8aFixed, Vec, WrapperOpaque, bool, u128, u32, u64 } from '@polkadot/types-codec';
|
import type { BTreeSet, Bytes, Null, Option, U8aFixed, Vec, WrapperOpaque, bool, u128, u32, u64 } from '@polkadot/types-codec';
|
||||||
import type { AnyNumber, ITuple } from '@polkadot/types-codec/types';
|
import type { AnyNumber, ITuple } from '@polkadot/types-codec/types';
|
||||||
import type { EthereumAddress } from '@polkadot/types/interfaces/eth';
|
import type { EthereumAddress } from '@polkadot/types/interfaces/eth';
|
||||||
import type { AccountId32, Call, H256, Perbill, Percent } from '@polkadot/types/interfaces/runtime';
|
import type { AccountId32, Call, H256, Perbill, Percent } from '@polkadot/types/interfaces/runtime';
|
||||||
import type { FrameSupportDispatchPerDispatchClassWeight, FrameSupportPreimagesBounded, FrameSystemAccountInfo, FrameSystemEventRecord, FrameSystemLastRuntimeUpgradeInfo, FrameSystemPhase, PalletAuthorshipUncleEntryItem, PalletBagsListListBag, PalletBagsListListNode, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesReserveData, PalletBountiesBounty, PalletChildBountiesChildBounty, PalletCollectiveVotes, PalletDemocracyReferendumInfo, PalletDemocracyVoteThreshold, PalletDemocracyVoteVoting, PalletElectionProviderMultiPhasePhase, PalletElectionProviderMultiPhaseReadySolution, PalletElectionProviderMultiPhaseRoundSnapshot, PalletElectionProviderMultiPhaseSignedSignedSubmission, PalletElectionProviderMultiPhaseSolutionOrSnapshotSize, PalletElectionsPhragmenSeatHolder, PalletElectionsPhragmenVoter, PalletFastUnstakeUnstakeRequest, PalletGrandpaStoredPendingChange, PalletGrandpaStoredState, PalletIdentityRegistrarInfo, PalletIdentityRegistration, PalletImOnlineBoundedOpaqueNetworkState, PalletImOnlineSr25519AppSr25519Public, PalletMultisigMultisig, PalletNominationPoolsBondedPoolInner, PalletNominationPoolsPoolMember, PalletNominationPoolsRewardPool, PalletNominationPoolsSubPools, PalletPreimageRequestStatus, PalletProxyAnnouncement, PalletProxyProxyDefinition, PalletSchedulerScheduled, PalletStakingActiveEraInfo, PalletStakingEraRewardPoints, PalletStakingExposure, PalletStakingForcing, PalletStakingNominations, PalletStakingRewardDestination, PalletStakingSlashingSlashingSpans, PalletStakingSlashingSpanRecord, PalletStakingStakingLedger, PalletStakingUnappliedSlash, PalletStakingValidatorPrefs, PalletTipsOpenTip, PalletTransactionPaymentReleases, PalletTreasuryProposal, PalletVestingReleases, PalletVestingVestingInfo, PalletXcmQueryStatus, PalletXcmRemoteLockedFungibleRecord, PalletXcmVersionMigrationStage, PolkadotCorePrimitivesInboundDownwardMessage, PolkadotCorePrimitivesInboundHrmpMessage, PolkadotParachainPrimitivesHrmpChannelId, PolkadotPrimitivesV2AssignmentAppPublic, PolkadotPrimitivesV2CandidateCommitments, PolkadotPrimitivesV2CoreOccupied, PolkadotPrimitivesV2DisputeState, PolkadotPrimitivesV2ScrapedOnChainVotes, PolkadotPrimitivesV2SessionInfo, PolkadotPrimitivesV2UpgradeGoAhead, PolkadotPrimitivesV2UpgradeRestriction, PolkadotPrimitivesV2ValidatorAppPublic, PolkadotRuntimeCommonClaimsStatementKind, PolkadotRuntimeCommonCrowdloanFundInfo, PolkadotRuntimeCommonParasRegistrarParaInfo, PolkadotRuntimeParachainsConfigurationHostConfiguration, PolkadotRuntimeParachainsHrmpHrmpChannel, PolkadotRuntimeParachainsHrmpHrmpOpenChannelRequest, PolkadotRuntimeParachainsInclusionAvailabilityBitfieldRecord, PolkadotRuntimeParachainsInclusionCandidatePendingAvailability, PolkadotRuntimeParachainsInitializerBufferedSessionChange, PolkadotRuntimeParachainsParasParaGenesisArgs, PolkadotRuntimeParachainsParasParaLifecycle, PolkadotRuntimeParachainsParasParaPastCodeMeta, PolkadotRuntimeParachainsParasPvfCheckActiveVoteState, PolkadotRuntimeParachainsSchedulerCoreAssignment, PolkadotRuntimeParachainsSchedulerParathreadClaimQueue, PolkadotRuntimeSessionKeys, SpConsensusBabeAppPublic, SpConsensusBabeBabeEpochConfiguration, SpConsensusBabeDigestsNextConfigDescriptor, SpConsensusBabeDigestsPreDigest, SpCoreCryptoKeyTypeId, SpNposElectionsElectionScore, SpRuntimeDigest, SpStakingOffenceOffenceDetails, SpWeightsWeightV2Weight, XcmVersionedAssetId, XcmVersionedMultiLocation } from '@polkadot/types/lookup';
|
import type { FrameSupportDispatchPerDispatchClassWeight, FrameSupportPreimagesBounded, FrameSystemAccountInfo, FrameSystemEventRecord, FrameSystemLastRuntimeUpgradeInfo, FrameSystemPhase, PalletBagsListListBag, PalletBagsListListNode, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesReserveData, PalletBountiesBounty, PalletChildBountiesChildBounty, PalletCollectiveVotes, PalletDemocracyMetadataOwner, PalletDemocracyReferendumInfo, PalletDemocracyVoteThreshold, PalletDemocracyVoteVoting, PalletElectionProviderMultiPhasePhase, PalletElectionProviderMultiPhaseReadySolution, PalletElectionProviderMultiPhaseRoundSnapshot, PalletElectionProviderMultiPhaseSignedSignedSubmission, PalletElectionProviderMultiPhaseSolutionOrSnapshotSize, PalletElectionsPhragmenSeatHolder, PalletElectionsPhragmenVoter, PalletFastUnstakeUnstakeRequest, PalletGrandpaStoredPendingChange, PalletGrandpaStoredState, PalletIdentityRegistrarInfo, PalletIdentityRegistration, PalletImOnlineBoundedOpaqueNetworkState, PalletImOnlineSr25519AppSr25519Public, PalletMultisigMultisig, PalletNominationPoolsBondedPoolInner, PalletNominationPoolsClaimPermission, PalletNominationPoolsPoolMember, PalletNominationPoolsRewardPool, PalletNominationPoolsSubPools, PalletPreimageRequestStatus, PalletProxyAnnouncement, PalletProxyProxyDefinition, PalletSchedulerScheduled, PalletStakingActiveEraInfo, PalletStakingEraRewardPoints, PalletStakingExposure, PalletStakingForcing, PalletStakingNominations, PalletStakingRewardDestination, PalletStakingSlashingSlashingSpans, PalletStakingSlashingSpanRecord, PalletStakingStakingLedger, PalletStakingUnappliedSlash, PalletStakingValidatorPrefs, PalletTipsOpenTip, PalletTransactionPaymentReleases, PalletTreasuryProposal, PalletVestingReleases, PalletVestingVestingInfo, PalletXcmQueryStatus, PalletXcmRemoteLockedFungibleRecord, PalletXcmVersionMigrationStage, PolkadotCorePrimitivesInboundDownwardMessage, PolkadotCorePrimitivesInboundHrmpMessage, PolkadotParachainPrimitivesHrmpChannelId, PolkadotPrimitivesV2AssignmentAppPublic, PolkadotPrimitivesV2CandidateCommitments, PolkadotPrimitivesV2CoreOccupied, PolkadotPrimitivesV2DisputeState, PolkadotPrimitivesV2ScrapedOnChainVotes, PolkadotPrimitivesV2SessionInfo, PolkadotPrimitivesV2UpgradeGoAhead, PolkadotPrimitivesV2UpgradeRestriction, PolkadotPrimitivesV2ValidatorAppPublic, PolkadotPrimitivesVstagingExecutorParams, PolkadotRuntimeCommonClaimsStatementKind, PolkadotRuntimeCommonCrowdloanFundInfo, PolkadotRuntimeCommonParasRegistrarParaInfo, PolkadotRuntimeParachainsConfigurationHostConfiguration, PolkadotRuntimeParachainsHrmpHrmpChannel, PolkadotRuntimeParachainsHrmpHrmpOpenChannelRequest, PolkadotRuntimeParachainsInclusionAvailabilityBitfieldRecord, PolkadotRuntimeParachainsInclusionCandidatePendingAvailability, PolkadotRuntimeParachainsInitializerBufferedSessionChange, PolkadotRuntimeParachainsParasParaGenesisArgs, PolkadotRuntimeParachainsParasParaLifecycle, PolkadotRuntimeParachainsParasParaPastCodeMeta, PolkadotRuntimeParachainsParasPvfCheckActiveVoteState, PolkadotRuntimeParachainsSchedulerCoreAssignment, PolkadotRuntimeParachainsSchedulerParathreadClaimQueue, PolkadotRuntimeSessionKeys, SpConsensusBabeAppPublic, SpConsensusBabeBabeEpochConfiguration, SpConsensusBabeDigestsNextConfigDescriptor, SpConsensusBabeDigestsPreDigest, SpCoreCryptoKeyTypeId, SpNposElectionsElectionScore, SpRuntimeDigest, SpStakingOffenceOffenceDetails, SpWeightsWeightV2Weight, XcmVersionedAssetId, XcmVersionedMultiLocation } from '@polkadot/types/lookup';
|
||||||
import type { Observable } from '@polkadot/types/types';
|
import type { Observable } from '@polkadot/types/types';
|
||||||
|
|
||||||
export type __AugmentedQuery<ApiType extends ApiTypes> = AugmentedQuery<ApiType, () => unknown>;
|
export type __AugmentedQuery<ApiType extends ApiTypes> = AugmentedQuery<ApiType, () => unknown>;
|
||||||
@@ -53,14 +53,6 @@ declare module '@polkadot/api-base/types/storage' {
|
|||||||
* Author of current block.
|
* Author of current block.
|
||||||
**/
|
**/
|
||||||
author: AugmentedQuery<ApiType, () => Observable<Option<AccountId32>>, []> & QueryableStorageEntry<ApiType, []>;
|
author: AugmentedQuery<ApiType, () => Observable<Option<AccountId32>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
/**
|
|
||||||
* Whether uncles were already set in this block.
|
|
||||||
**/
|
|
||||||
didSetUncles: AugmentedQuery<ApiType, () => Observable<bool>, []> & QueryableStorageEntry<ApiType, []>;
|
|
||||||
/**
|
|
||||||
* Uncles
|
|
||||||
**/
|
|
||||||
uncles: AugmentedQuery<ApiType, () => Observable<Vec<PalletAuthorshipUncleEntryItem>>, []> & QueryableStorageEntry<ApiType, []>;
|
|
||||||
/**
|
/**
|
||||||
* Generic query
|
* Generic query
|
||||||
**/
|
**/
|
||||||
@@ -159,6 +151,17 @@ declare module '@polkadot/api-base/types/storage' {
|
|||||||
* epoch.
|
* epoch.
|
||||||
**/
|
**/
|
||||||
segmentIndex: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
|
segmentIndex: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* A list of the last 100 skipped epochs and the corresponding session index
|
||||||
|
* when the epoch was skipped.
|
||||||
|
*
|
||||||
|
* This is only used for validating equivocation proofs. An equivocation proof
|
||||||
|
* must contains a key-ownership proof for a given session, therefore we need a
|
||||||
|
* way to tie together sessions and epoch indices, i.e. we need to validate that
|
||||||
|
* a validator was the owner of a given key on a given session, and what the
|
||||||
|
* active epoch index was during that session.
|
||||||
|
**/
|
||||||
|
skippedEpochs: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[u64, u32]>>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
/**
|
/**
|
||||||
* TWOX-NOTE: `SegmentIndex` is an increasing integer, so this is okay.
|
* TWOX-NOTE: `SegmentIndex` is an increasing integer, so this is okay.
|
||||||
**/
|
**/
|
||||||
@@ -394,6 +397,15 @@ declare module '@polkadot/api-base/types/storage' {
|
|||||||
* `ReferendumCount` if there isn't a unbaked referendum.
|
* `ReferendumCount` if there isn't a unbaked referendum.
|
||||||
**/
|
**/
|
||||||
lowestUnbaked: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
|
lowestUnbaked: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* General information concerning any proposal or referendum.
|
||||||
|
* The `PreimageHash` refers to the preimage of the `Preimages` provider which can be a JSON
|
||||||
|
* dump or IPFS hash of a JSON file.
|
||||||
|
*
|
||||||
|
* Consider a garbage collection for a metadata of finished referendums to `unrequest` (remove)
|
||||||
|
* large preimages.
|
||||||
|
**/
|
||||||
|
metadataOf: AugmentedQuery<ApiType, (arg: PalletDemocracyMetadataOwner | { External: any } | { Proposal: any } | { Referendum: any } | string | Uint8Array) => Observable<Option<H256>>, [PalletDemocracyMetadataOwner]> & QueryableStorageEntry<ApiType, [PalletDemocracyMetadataOwner]>;
|
||||||
/**
|
/**
|
||||||
* The referendum to be tabled whenever it would be valid to table an external proposal.
|
* The referendum to be tabled whenever it would be valid to table an external proposal.
|
||||||
* This happens when a referendum needs to be tabled and one of two conditions are met:
|
* This happens when a referendum needs to be tabled and one of two conditions are met:
|
||||||
@@ -579,6 +591,12 @@ declare module '@polkadot/api-base/types/storage' {
|
|||||||
* A mapping from grandpa set ID to the index of the *most recent* session for which its
|
* A mapping from grandpa set ID to the index of the *most recent* session for which its
|
||||||
* members were responsible.
|
* members were responsible.
|
||||||
*
|
*
|
||||||
|
* This is only used for validating equivocation proofs. An equivocation proof must
|
||||||
|
* contains a key-ownership proof for a given session, therefore we need a way to tie
|
||||||
|
* together sessions and GRANDPA set ids, i.e. we need to validate that a validator
|
||||||
|
* was the owner of a given key on a given session, and what the active set ID was
|
||||||
|
* during that session.
|
||||||
|
*
|
||||||
* TWOX-NOTE: `SetId` is not under user control.
|
* TWOX-NOTE: `SetId` is not under user control.
|
||||||
**/
|
**/
|
||||||
setIdSession: AugmentedQuery<ApiType, (arg: u64 | AnyNumber | Uint8Array) => Observable<Option<u32>>, [u64]> & QueryableStorageEntry<ApiType, [u64]>;
|
setIdSession: AugmentedQuery<ApiType, (arg: u64 | AnyNumber | Uint8Array) => Observable<Option<u32>>, [u64]> & QueryableStorageEntry<ApiType, [u64]>;
|
||||||
@@ -795,6 +813,10 @@ declare module '@polkadot/api-base/types/storage' {
|
|||||||
* Storage for bonded pools.
|
* Storage for bonded pools.
|
||||||
**/
|
**/
|
||||||
bondedPools: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Option<PalletNominationPoolsBondedPoolInner>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
|
bondedPools: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Option<PalletNominationPoolsBondedPoolInner>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
|
||||||
|
/**
|
||||||
|
* Map from a pool member account to their opted claim permission.
|
||||||
|
**/
|
||||||
|
claimPermissions: AugmentedQuery<ApiType, (arg: AccountId32 | string | Uint8Array) => Observable<PalletNominationPoolsClaimPermission>, [AccountId32]> & QueryableStorageEntry<ApiType, [AccountId32]>;
|
||||||
/**
|
/**
|
||||||
* Counter for the related counted storage map
|
* Counter for the related counted storage map
|
||||||
**/
|
**/
|
||||||
@@ -1133,6 +1155,11 @@ declare module '@polkadot/api-base/types/storage' {
|
|||||||
[key: string]: QueryableStorageEntry<ApiType>;
|
[key: string]: QueryableStorageEntry<ApiType>;
|
||||||
};
|
};
|
||||||
parasDisputes: {
|
parasDisputes: {
|
||||||
|
/**
|
||||||
|
* Backing votes stored for each dispute.
|
||||||
|
* This storage is used for slashing.
|
||||||
|
**/
|
||||||
|
backersOnDisputes: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: H256 | string | Uint8Array) => Observable<Option<BTreeSet<u32>>>, [u32, H256]> & QueryableStorageEntry<ApiType, [u32, H256]>;
|
||||||
/**
|
/**
|
||||||
* All ongoing or concluded disputes for the last several sessions.
|
* All ongoing or concluded disputes for the last several sessions.
|
||||||
**/
|
**/
|
||||||
@@ -1174,6 +1201,10 @@ declare module '@polkadot/api-base/types/storage' {
|
|||||||
* The earliest session for which previous session info is stored.
|
* The earliest session for which previous session info is stored.
|
||||||
**/
|
**/
|
||||||
earliestStoredSession: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
|
earliestStoredSession: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* Executor parameter set for a given session index
|
||||||
|
**/
|
||||||
|
sessionExecutorParams: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Option<PolkadotPrimitivesVstagingExecutorParams>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
|
||||||
/**
|
/**
|
||||||
* Session information in a rolling window.
|
* Session information in a rolling window.
|
||||||
* Should have an entry in range `EarliestStoredSession..=CurrentSessionIndex`.
|
* Should have an entry in range `EarliestStoredSession..=CurrentSessionIndex`.
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -79,18 +79,6 @@ declare module '@polkadot/api-base/types/consts' {
|
|||||||
**/
|
**/
|
||||||
[key: string]: Codec;
|
[key: string]: Codec;
|
||||||
};
|
};
|
||||||
authorship: {
|
|
||||||
/**
|
|
||||||
* The number of blocks back we should accept uncles.
|
|
||||||
* This means that we will deal with uncle-parents that are
|
|
||||||
* `UncleGenerations + 1` before `now`.
|
|
||||||
**/
|
|
||||||
uncleGenerations: u32 & AugmentedConst<ApiType>;
|
|
||||||
/**
|
|
||||||
* Generic const
|
|
||||||
**/
|
|
||||||
[key: string]: Codec;
|
|
||||||
};
|
|
||||||
babe: {
|
babe: {
|
||||||
/**
|
/**
|
||||||
* The amount of time, in slots, that each epoch should last.
|
* The amount of time, in slots, that each epoch should last.
|
||||||
@@ -473,18 +461,28 @@ declare module '@polkadot/api-base/types/consts' {
|
|||||||
/**
|
/**
|
||||||
* The maximum number of candidates in a phragmen election.
|
* The maximum number of candidates in a phragmen election.
|
||||||
*
|
*
|
||||||
* Warning: The election happens onchain, and this value will determine
|
* Warning: This impacts the size of the election which is run onchain. Chose wisely, and
|
||||||
* the size of the election. When this limit is reached no more
|
* consider how it will impact `T::WeightInfo::election_phragmen`.
|
||||||
* candidates are accepted in the election.
|
*
|
||||||
|
* When this limit is reached no more candidates are accepted in the election.
|
||||||
**/
|
**/
|
||||||
maxCandidates: u32 & AugmentedConst<ApiType>;
|
maxCandidates: u32 & AugmentedConst<ApiType>;
|
||||||
/**
|
/**
|
||||||
* The maximum number of voters to allow in a phragmen election.
|
* The maximum number of voters to allow in a phragmen election.
|
||||||
*
|
*
|
||||||
* Warning: This impacts the size of the election which is run onchain.
|
* Warning: This impacts the size of the election which is run onchain. Chose wisely, and
|
||||||
|
* consider how it will impact `T::WeightInfo::election_phragmen`.
|
||||||
|
*
|
||||||
* When the limit is reached the new voters are ignored.
|
* When the limit is reached the new voters are ignored.
|
||||||
**/
|
**/
|
||||||
maxVoters: u32 & AugmentedConst<ApiType>;
|
maxVoters: u32 & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* Maximum numbers of votes per voter.
|
||||||
|
*
|
||||||
|
* Warning: This impacts the size of the election which is run onchain. Chose wisely, and
|
||||||
|
* consider how it will impact `T::WeightInfo::election_phragmen`.
|
||||||
|
**/
|
||||||
|
maxVotesPerVoter: u32 & AugmentedConst<ApiType>;
|
||||||
/**
|
/**
|
||||||
* Identifier for the elections-phragmen pallet's lock
|
* Identifier for the elections-phragmen pallet's lock
|
||||||
**/
|
**/
|
||||||
@@ -527,6 +525,15 @@ declare module '@polkadot/api-base/types/consts' {
|
|||||||
* Max Authorities in use
|
* Max Authorities in use
|
||||||
**/
|
**/
|
||||||
maxAuthorities: u32 & AugmentedConst<ApiType>;
|
maxAuthorities: u32 & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* The maximum number of entries to keep in the set id to session index mapping.
|
||||||
|
*
|
||||||
|
* Since the `SetIdSession` map is only used for validating equivocations this
|
||||||
|
* value should relate to the bonding duration of whatever staking system is
|
||||||
|
* being used (if any). If equivocation handling is not enabled then this value
|
||||||
|
* can be zero.
|
||||||
|
**/
|
||||||
|
maxSetIdSessionEntries: u64 & AugmentedConst<ApiType>;
|
||||||
/**
|
/**
|
||||||
* Generic const
|
* Generic const
|
||||||
**/
|
**/
|
||||||
@@ -696,6 +703,10 @@ declare module '@polkadot/api-base/types/consts' {
|
|||||||
* The maximum length of an attribute key.
|
* The maximum length of an attribute key.
|
||||||
**/
|
**/
|
||||||
keyLimit: u32 & AugmentedConst<ApiType>;
|
keyLimit: u32 & AugmentedConst<ApiType>;
|
||||||
|
/**
|
||||||
|
* The max number of attributes a user could set per call.
|
||||||
|
**/
|
||||||
|
maxAttributesPerCall: u32 & AugmentedConst<ApiType>;
|
||||||
/**
|
/**
|
||||||
* The max duration in blocks for deadlines.
|
* The max duration in blocks for deadlines.
|
||||||
**/
|
**/
|
||||||
|
|||||||
@@ -245,40 +245,6 @@ declare module '@polkadot/api-base/types/errors' {
|
|||||||
**/
|
**/
|
||||||
[key: string]: AugmentedError<ApiType>;
|
[key: string]: AugmentedError<ApiType>;
|
||||||
};
|
};
|
||||||
authorship: {
|
|
||||||
/**
|
|
||||||
* The uncle is genesis.
|
|
||||||
**/
|
|
||||||
GenesisUncle: AugmentedError<ApiType>;
|
|
||||||
/**
|
|
||||||
* The uncle parent not in the chain.
|
|
||||||
**/
|
|
||||||
InvalidUncleParent: AugmentedError<ApiType>;
|
|
||||||
/**
|
|
||||||
* The uncle isn't recent enough to be included.
|
|
||||||
**/
|
|
||||||
OldUncle: AugmentedError<ApiType>;
|
|
||||||
/**
|
|
||||||
* The uncle is too high in chain.
|
|
||||||
**/
|
|
||||||
TooHighUncle: AugmentedError<ApiType>;
|
|
||||||
/**
|
|
||||||
* Too many uncles.
|
|
||||||
**/
|
|
||||||
TooManyUncles: AugmentedError<ApiType>;
|
|
||||||
/**
|
|
||||||
* The uncle is already included.
|
|
||||||
**/
|
|
||||||
UncleAlreadyIncluded: AugmentedError<ApiType>;
|
|
||||||
/**
|
|
||||||
* Uncles already set in the block.
|
|
||||||
**/
|
|
||||||
UnclesAlreadySet: AugmentedError<ApiType>;
|
|
||||||
/**
|
|
||||||
* Generic error
|
|
||||||
**/
|
|
||||||
[key: string]: AugmentedError<ApiType>;
|
|
||||||
};
|
|
||||||
babe: {
|
babe: {
|
||||||
/**
|
/**
|
||||||
* A given equivocation report is valid but already previously reported.
|
* A given equivocation report is valid but already previously reported.
|
||||||
@@ -448,10 +414,6 @@ declare module '@polkadot/api-base/types/errors' {
|
|||||||
* Contract trapped during execution.
|
* Contract trapped during execution.
|
||||||
**/
|
**/
|
||||||
ContractTrapped: AugmentedError<ApiType>;
|
ContractTrapped: AugmentedError<ApiType>;
|
||||||
/**
|
|
||||||
* The debug message specified to `seal_debug_message` does contain invalid UTF-8.
|
|
||||||
**/
|
|
||||||
DebugMessageInvalidUTF8: AugmentedError<ApiType>;
|
|
||||||
/**
|
/**
|
||||||
* Input passed to a contract API function failed to decode as expected type.
|
* Input passed to a contract API function failed to decode as expected type.
|
||||||
**/
|
**/
|
||||||
@@ -714,6 +676,10 @@ declare module '@polkadot/api-base/types/errors' {
|
|||||||
* The given account did not vote on the referendum.
|
* The given account did not vote on the referendum.
|
||||||
**/
|
**/
|
||||||
NotVoter: AugmentedError<ApiType>;
|
NotVoter: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* The preimage does not exist.
|
||||||
|
**/
|
||||||
|
PreimageNotExist: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* Proposal still blacklisted
|
* Proposal still blacklisted
|
||||||
**/
|
**/
|
||||||
@@ -920,6 +886,18 @@ declare module '@polkadot/api-base/types/errors' {
|
|||||||
**/
|
**/
|
||||||
[key: string]: AugmentedError<ApiType>;
|
[key: string]: AugmentedError<ApiType>;
|
||||||
};
|
};
|
||||||
|
glutton: {
|
||||||
|
/**
|
||||||
|
* The pallet was already initialized.
|
||||||
|
*
|
||||||
|
* Set `witness_count` to `Some` to bypass this error.
|
||||||
|
**/
|
||||||
|
AlreadyInitialized: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Generic error
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedError<ApiType>;
|
||||||
|
};
|
||||||
grandpa: {
|
grandpa: {
|
||||||
/**
|
/**
|
||||||
* Attempt to signal GRANDPA change with one already pending.
|
* Attempt to signal GRANDPA change with one already pending.
|
||||||
@@ -1134,6 +1112,13 @@ declare module '@polkadot/api-base/types/errors' {
|
|||||||
* The message is queued for future execution.
|
* The message is queued for future execution.
|
||||||
**/
|
**/
|
||||||
Queued: AugmentedError<ApiType>;
|
Queued: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* This message is temporarily unprocessable.
|
||||||
|
*
|
||||||
|
* Such errors are expected, but not guaranteed, to resolve themselves eventually through
|
||||||
|
* retrying.
|
||||||
|
**/
|
||||||
|
TemporarilyUnprocessable: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* Generic error
|
* Generic error
|
||||||
**/
|
**/
|
||||||
@@ -1242,6 +1227,10 @@ declare module '@polkadot/api-base/types/errors' {
|
|||||||
* The provided data is incorrect.
|
* The provided data is incorrect.
|
||||||
**/
|
**/
|
||||||
IncorrectData: AugmentedError<ApiType>;
|
IncorrectData: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* The provided metadata might be too long.
|
||||||
|
**/
|
||||||
|
IncorrectMetadata: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* The item is locked (non-transferable).
|
* The item is locked (non-transferable).
|
||||||
**/
|
**/
|
||||||
@@ -1266,6 +1255,10 @@ declare module '@polkadot/api-base/types/errors' {
|
|||||||
* Item's metadata is locked.
|
* Item's metadata is locked.
|
||||||
**/
|
**/
|
||||||
LockedItemMetadata: AugmentedError<ApiType>;
|
LockedItemMetadata: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Can't set more attributes per one call.
|
||||||
|
**/
|
||||||
|
MaxAttributesLimitReached: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* The max supply is locked and can't be changed.
|
* The max supply is locked and can't be changed.
|
||||||
**/
|
**/
|
||||||
@@ -1346,6 +1339,14 @@ declare module '@polkadot/api-base/types/errors' {
|
|||||||
* The duration provided should be less than or equal to `MaxDeadlineDuration`.
|
* The duration provided should be less than or equal to `MaxDeadlineDuration`.
|
||||||
**/
|
**/
|
||||||
WrongDuration: AugmentedError<ApiType>;
|
WrongDuration: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* The provided namespace isn't supported in this call.
|
||||||
|
**/
|
||||||
|
WrongNamespace: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* The extrinsic was sent by the wrong origin.
|
||||||
|
**/
|
||||||
|
WrongOrigin: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* The owner turned out to be different to what was expected.
|
* The owner turned out to be different to what was expected.
|
||||||
**/
|
**/
|
||||||
@@ -1354,6 +1355,10 @@ declare module '@polkadot/api-base/types/errors' {
|
|||||||
* The provided setting can't be set.
|
* The provided setting can't be set.
|
||||||
**/
|
**/
|
||||||
WrongSetting: AugmentedError<ApiType>;
|
WrongSetting: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* The provided signature is incorrect.
|
||||||
|
**/
|
||||||
|
WrongSignature: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* Generic error
|
* Generic error
|
||||||
**/
|
**/
|
||||||
@@ -1432,6 +1437,10 @@ declare module '@polkadot/api-base/types/errors' {
|
|||||||
* pool at a time.
|
* pool at a time.
|
||||||
**/
|
**/
|
||||||
AccountBelongsToOtherPool: AugmentedError<ApiType>;
|
AccountBelongsToOtherPool: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* Bonding extra is restricted to the exact pending reward amount.
|
||||||
|
**/
|
||||||
|
BondExtraRestricted: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* The pools state cannot be changed.
|
* The pools state cannot be changed.
|
||||||
**/
|
**/
|
||||||
@@ -1683,6 +1692,10 @@ declare module '@polkadot/api-base/types/errors' {
|
|||||||
* No track exists for the proposal origin.
|
* No track exists for the proposal origin.
|
||||||
**/
|
**/
|
||||||
NoTrack: AugmentedError<ApiType>;
|
NoTrack: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* The preimage does not exist.
|
||||||
|
**/
|
||||||
|
PreimageNotExist: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* The queue of the track is empty.
|
* The queue of the track is empty.
|
||||||
**/
|
**/
|
||||||
@@ -1807,6 +1820,10 @@ declare module '@polkadot/api-base/types/errors' {
|
|||||||
* No track exists for the proposal origin.
|
* No track exists for the proposal origin.
|
||||||
**/
|
**/
|
||||||
NoTrack: AugmentedError<ApiType>;
|
NoTrack: AugmentedError<ApiType>;
|
||||||
|
/**
|
||||||
|
* The preimage does not exist.
|
||||||
|
**/
|
||||||
|
PreimageNotExist: AugmentedError<ApiType>;
|
||||||
/**
|
/**
|
||||||
* The queue of the track is empty.
|
* The queue of the track is empty.
|
||||||
**/
|
**/
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import type { ApiTypes, AugmentedEvent } from '@polkadot/api-base/types';
|
|||||||
import type { Bytes, Null, Option, Result, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';
|
import type { Bytes, Null, Option, Result, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';
|
||||||
import type { ITuple } from '@polkadot/types-codec/types';
|
import type { ITuple } from '@polkadot/types-codec/types';
|
||||||
import type { AccountId32, H256, Perbill, Perquintill } from '@polkadot/types/interfaces/runtime';
|
import type { AccountId32, H256, Perbill, Perquintill } from '@polkadot/types/interfaces/runtime';
|
||||||
import type { FrameSupportDispatchDispatchInfo, FrameSupportDispatchPostDispatchInfo, FrameSupportMessagesProcessMessageError, FrameSupportPreimagesBounded, FrameSupportTokensMiscAttributeNamespace, FrameSupportTokensMiscBalanceStatus, KitchensinkRuntimeProxyType, PalletAllianceCid, PalletAllianceUnscrupulousItem, PalletConvictionVotingTally, PalletDemocracyVoteAccountVote, PalletDemocracyVoteThreshold, PalletElectionProviderMultiPhaseElectionCompute, PalletElectionProviderMultiPhasePhase, PalletImOnlineSr25519AppSr25519Public, PalletMessageQueueMockHelpersMessageOrigin, PalletMultisigTimepoint, PalletNftsPriceWithDirection, PalletNominationPoolsPoolState, PalletRankedCollectiveTally, PalletRankedCollectiveVoteRecord, PalletStakingExposure, PalletStakingForcing, PalletStakingValidatorPrefs, PalletStateTrieMigrationError, PalletStateTrieMigrationMigrationCompute, SpFinalityGrandpaAppPublic, SpNposElectionsElectionScore, SpRuntimeDispatchError, SpRuntimeDispatchErrorWithPostInfo, SpWeightsWeightV2Weight } from '@polkadot/types/lookup';
|
import type { FrameSupportDispatchDispatchInfo, FrameSupportDispatchPostDispatchInfo, FrameSupportMessagesProcessMessageError, FrameSupportPreimagesBounded, FrameSupportTokensMiscAttributeNamespace, FrameSupportTokensMiscBalanceStatus, KitchensinkRuntimeProxyType, PalletAllianceCid, PalletAllianceUnscrupulousItem, PalletConvictionVotingTally, PalletDemocracyMetadataOwner, PalletDemocracyVoteAccountVote, PalletDemocracyVoteThreshold, PalletElectionProviderMultiPhaseElectionCompute, PalletElectionProviderMultiPhasePhase, PalletImOnlineSr25519AppSr25519Public, PalletMultisigTimepoint, PalletNftsPriceWithDirection, PalletNominationPoolsPoolState, PalletRankedCollectiveTally, PalletRankedCollectiveVoteRecord, PalletStakingExposure, PalletStakingForcing, PalletStakingValidatorPrefs, PalletStateTrieMigrationError, PalletStateTrieMigrationMigrationCompute, SpFinalityGrandpaAppPublic, SpNposElectionsElectionScore, SpRuntimeDispatchError, SpRuntimeDispatchErrorWithPostInfo, SpWeightsWeightV2Weight } from '@polkadot/types/lookup';
|
||||||
|
|
||||||
export type __AugmentedEvent<ApiType extends ApiTypes> = AugmentedEvent<ApiType>;
|
export type __AugmentedEvent<ApiType extends ApiTypes> = AugmentedEvent<ApiType>;
|
||||||
|
|
||||||
@@ -437,6 +437,18 @@ declare module '@polkadot/api-base/types/events' {
|
|||||||
* An external proposal has been tabled.
|
* An external proposal has been tabled.
|
||||||
**/
|
**/
|
||||||
ExternalTabled: AugmentedEvent<ApiType, []>;
|
ExternalTabled: AugmentedEvent<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* Metadata for a proposal or a referendum has been cleared.
|
||||||
|
**/
|
||||||
|
MetadataCleared: AugmentedEvent<ApiType, [owner: PalletDemocracyMetadataOwner, hash_: H256], { owner: PalletDemocracyMetadataOwner, hash_: H256 }>;
|
||||||
|
/**
|
||||||
|
* Metadata for a proposal or a referendum has been set.
|
||||||
|
**/
|
||||||
|
MetadataSet: AugmentedEvent<ApiType, [owner: PalletDemocracyMetadataOwner, hash_: H256], { owner: PalletDemocracyMetadataOwner, hash_: H256 }>;
|
||||||
|
/**
|
||||||
|
* Metadata has been transferred to new owner.
|
||||||
|
**/
|
||||||
|
MetadataTransferred: AugmentedEvent<ApiType, [prevOwner: PalletDemocracyMetadataOwner, owner: PalletDemocracyMetadataOwner, hash_: H256], { prevOwner: PalletDemocracyMetadataOwner, owner: PalletDemocracyMetadataOwner, hash_: H256 }>;
|
||||||
/**
|
/**
|
||||||
* A proposal has been rejected by referendum.
|
* A proposal has been rejected by referendum.
|
||||||
**/
|
**/
|
||||||
@@ -592,6 +604,24 @@ declare module '@polkadot/api-base/types/events' {
|
|||||||
**/
|
**/
|
||||||
[key: string]: AugmentedEvent<ApiType>;
|
[key: string]: AugmentedEvent<ApiType>;
|
||||||
};
|
};
|
||||||
|
glutton: {
|
||||||
|
/**
|
||||||
|
* The computation limit has been updated by root.
|
||||||
|
**/
|
||||||
|
ComputationLimitSet: AugmentedEvent<ApiType, [compute: Perbill], { compute: Perbill }>;
|
||||||
|
/**
|
||||||
|
* The pallet has been (re)initialized by root.
|
||||||
|
**/
|
||||||
|
PalletInitialized: AugmentedEvent<ApiType, [reinit: bool], { reinit: bool }>;
|
||||||
|
/**
|
||||||
|
* The storage limit has been updated by root.
|
||||||
|
**/
|
||||||
|
StorageLimitSet: AugmentedEvent<ApiType, [storage: Perbill], { storage: Perbill }>;
|
||||||
|
/**
|
||||||
|
* Generic event
|
||||||
|
**/
|
||||||
|
[key: string]: AugmentedEvent<ApiType>;
|
||||||
|
};
|
||||||
grandpa: {
|
grandpa: {
|
||||||
/**
|
/**
|
||||||
* New authority set has been applied.
|
* New authority set has been applied.
|
||||||
@@ -724,19 +754,19 @@ declare module '@polkadot/api-base/types/events' {
|
|||||||
/**
|
/**
|
||||||
* Message placed in overweight queue.
|
* Message placed in overweight queue.
|
||||||
**/
|
**/
|
||||||
OverweightEnqueued: AugmentedEvent<ApiType, [hash_: H256, origin: PalletMessageQueueMockHelpersMessageOrigin, pageIndex: u32, messageIndex: u32], { hash_: H256, origin: PalletMessageQueueMockHelpersMessageOrigin, pageIndex: u32, messageIndex: u32 }>;
|
OverweightEnqueued: AugmentedEvent<ApiType, [hash_: H256, origin: u32, pageIndex: u32, messageIndex: u32], { hash_: H256, origin: u32, pageIndex: u32, messageIndex: u32 }>;
|
||||||
/**
|
/**
|
||||||
* This page was reaped.
|
* This page was reaped.
|
||||||
**/
|
**/
|
||||||
PageReaped: AugmentedEvent<ApiType, [origin: PalletMessageQueueMockHelpersMessageOrigin, index: u32], { origin: PalletMessageQueueMockHelpersMessageOrigin, index: u32 }>;
|
PageReaped: AugmentedEvent<ApiType, [origin: u32, index: u32], { origin: u32, index: u32 }>;
|
||||||
/**
|
/**
|
||||||
* Message is processed.
|
* Message is processed.
|
||||||
**/
|
**/
|
||||||
Processed: AugmentedEvent<ApiType, [hash_: H256, origin: PalletMessageQueueMockHelpersMessageOrigin, weightUsed: SpWeightsWeightV2Weight, success: bool], { hash_: H256, origin: PalletMessageQueueMockHelpersMessageOrigin, weightUsed: SpWeightsWeightV2Weight, success: bool }>;
|
Processed: AugmentedEvent<ApiType, [hash_: H256, origin: u32, weightUsed: SpWeightsWeightV2Weight, success: bool], { hash_: H256, origin: u32, weightUsed: SpWeightsWeightV2Weight, success: bool }>;
|
||||||
/**
|
/**
|
||||||
* Message discarded due to an error in the `MessageProcessor` (usually a format error).
|
* Message discarded due to an error in the `MessageProcessor` (usually a format error).
|
||||||
**/
|
**/
|
||||||
ProcessingFailed: AugmentedEvent<ApiType, [hash_: H256, origin: PalletMessageQueueMockHelpersMessageOrigin, error: FrameSupportMessagesProcessMessageError], { hash_: H256, origin: PalletMessageQueueMockHelpersMessageOrigin, error: FrameSupportMessagesProcessMessageError }>;
|
ProcessingFailed: AugmentedEvent<ApiType, [hash_: H256, origin: u32, error: FrameSupportMessagesProcessMessageError], { hash_: H256, origin: u32, error: FrameSupportMessagesProcessMessageError }>;
|
||||||
/**
|
/**
|
||||||
* Generic event
|
* Generic event
|
||||||
**/
|
**/
|
||||||
@@ -878,6 +908,10 @@ declare module '@polkadot/api-base/types/events' {
|
|||||||
* Ownership acceptance has changed for an account.
|
* Ownership acceptance has changed for an account.
|
||||||
**/
|
**/
|
||||||
OwnershipAcceptanceChanged: AugmentedEvent<ApiType, [who: AccountId32, maybeCollection: Option<u32>], { who: AccountId32, maybeCollection: Option<u32> }>;
|
OwnershipAcceptanceChanged: AugmentedEvent<ApiType, [who: AccountId32, maybeCollection: Option<u32>], { who: AccountId32, maybeCollection: Option<u32> }>;
|
||||||
|
/**
|
||||||
|
* New attributes have been set for an `item` of the `collection`.
|
||||||
|
**/
|
||||||
|
PreSignedAttributesSet: AugmentedEvent<ApiType, [collection: u32, item: u32, namespace: FrameSupportTokensMiscAttributeNamespace], { collection: u32, item: u32, namespace: FrameSupportTokensMiscAttributeNamespace }>;
|
||||||
/**
|
/**
|
||||||
* The deposit for a set of `item`s within a `collection` has been updated.
|
* The deposit for a set of `item`s within a `collection` has been updated.
|
||||||
**/
|
**/
|
||||||
@@ -981,7 +1015,7 @@ declare module '@polkadot/api-base/types/events' {
|
|||||||
* The roles of a pool have been updated to the given new roles. Note that the depositor
|
* The roles of a pool have been updated to the given new roles. Note that the depositor
|
||||||
* can never change.
|
* can never change.
|
||||||
**/
|
**/
|
||||||
RolesUpdated: AugmentedEvent<ApiType, [root: Option<AccountId32>, stateToggler: Option<AccountId32>, nominator: Option<AccountId32>], { root: Option<AccountId32>, stateToggler: Option<AccountId32>, nominator: Option<AccountId32> }>;
|
RolesUpdated: AugmentedEvent<ApiType, [root: Option<AccountId32>, bouncer: Option<AccountId32>, nominator: Option<AccountId32>], { root: Option<AccountId32>, bouncer: Option<AccountId32>, nominator: Option<AccountId32> }>;
|
||||||
/**
|
/**
|
||||||
* The state of a pool has changed
|
* The state of a pool has changed
|
||||||
**/
|
**/
|
||||||
@@ -1140,6 +1174,14 @@ declare module '@polkadot/api-base/types/events' {
|
|||||||
* A referendum has been killed.
|
* A referendum has been killed.
|
||||||
**/
|
**/
|
||||||
Killed: AugmentedEvent<ApiType, [index: u32, tally: PalletRankedCollectiveTally], { index: u32, tally: PalletRankedCollectiveTally }>;
|
Killed: AugmentedEvent<ApiType, [index: u32, tally: PalletRankedCollectiveTally], { index: u32, tally: PalletRankedCollectiveTally }>;
|
||||||
|
/**
|
||||||
|
* Metadata for a referendum has been cleared.
|
||||||
|
**/
|
||||||
|
MetadataCleared: AugmentedEvent<ApiType, [index: u32, hash_: H256], { index: u32, hash_: H256 }>;
|
||||||
|
/**
|
||||||
|
* Metadata for a referendum has been set.
|
||||||
|
**/
|
||||||
|
MetadataSet: AugmentedEvent<ApiType, [index: u32, hash_: H256], { index: u32, hash_: H256 }>;
|
||||||
/**
|
/**
|
||||||
* A proposal has been rejected by referendum.
|
* A proposal has been rejected by referendum.
|
||||||
**/
|
**/
|
||||||
@@ -1226,6 +1268,14 @@ declare module '@polkadot/api-base/types/events' {
|
|||||||
* A referendum has been killed.
|
* A referendum has been killed.
|
||||||
**/
|
**/
|
||||||
Killed: AugmentedEvent<ApiType, [index: u32, tally: PalletConvictionVotingTally], { index: u32, tally: PalletConvictionVotingTally }>;
|
Killed: AugmentedEvent<ApiType, [index: u32, tally: PalletConvictionVotingTally], { index: u32, tally: PalletConvictionVotingTally }>;
|
||||||
|
/**
|
||||||
|
* Metadata for a referendum has been cleared.
|
||||||
|
**/
|
||||||
|
MetadataCleared: AugmentedEvent<ApiType, [index: u32, hash_: H256], { index: u32, hash_: H256 }>;
|
||||||
|
/**
|
||||||
|
* Metadata for a referendum has been set.
|
||||||
|
**/
|
||||||
|
MetadataSet: AugmentedEvent<ApiType, [index: u32, hash_: H256], { index: u32, hash_: H256 }>;
|
||||||
/**
|
/**
|
||||||
* A proposal has been rejected by referendum.
|
* A proposal has been rejected by referendum.
|
||||||
**/
|
**/
|
||||||
@@ -1341,6 +1391,10 @@ declare module '@polkadot/api-base/types/events' {
|
|||||||
* A new \[max\] member count has been set
|
* A new \[max\] member count has been set
|
||||||
**/
|
**/
|
||||||
NewMaxMembers: AugmentedEvent<ApiType, [max: u32], { max: u32 }>;
|
NewMaxMembers: AugmentedEvent<ApiType, [max: u32], { max: u32 }>;
|
||||||
|
/**
|
||||||
|
* A group of members has been choosen as Skeptics
|
||||||
|
**/
|
||||||
|
SkepticsChosen: AugmentedEvent<ApiType, [skeptics: Vec<AccountId32>], { skeptics: Vec<AccountId32> }>;
|
||||||
/**
|
/**
|
||||||
* A suspended member has been judged.
|
* A suspended member has been judged.
|
||||||
**/
|
**/
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import type { Data } from '@polkadot/types';
|
|||||||
import type { BTreeSet, Bytes, Null, Option, U8aFixed, Vec, WrapperOpaque, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';
|
import type { BTreeSet, Bytes, Null, Option, U8aFixed, Vec, WrapperOpaque, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';
|
||||||
import type { AnyNumber, ITuple } from '@polkadot/types-codec/types';
|
import type { AnyNumber, ITuple } from '@polkadot/types-codec/types';
|
||||||
import type { AccountId32, Call, H256, Perbill, Percent } from '@polkadot/types/interfaces/runtime';
|
import type { AccountId32, Call, H256, Perbill, Percent } from '@polkadot/types/interfaces/runtime';
|
||||||
import type { FrameSupportDispatchPerDispatchClassWeight, FrameSupportPreimagesBounded, FrameSupportTokensMiscAttributeNamespace, FrameSystemAccountInfo, FrameSystemEventRecord, FrameSystemLastRuntimeUpgradeInfo, FrameSystemPhase, KitchensinkRuntimeSessionKeys, PalletAllianceCid, PalletAllianceMemberRole, PalletAssetsApproval, PalletAssetsAssetAccount, PalletAssetsAssetDetails, PalletAssetsAssetMetadata, PalletAuthorshipUncleEntryItem, PalletBagsListListBag, PalletBagsListListNode, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesReserveData, PalletBountiesBounty, PalletChildBountiesChildBounty, PalletCollectiveVotes, PalletContractsStorageContractInfo, PalletContractsStorageDeletedContract, PalletContractsWasmOwnerInfo, PalletContractsWasmPrefabWasmModule, PalletConvictionVotingVoteVoting, PalletDemocracyReferendumInfo, PalletDemocracyVoteThreshold, PalletDemocracyVoteVoting, PalletElectionProviderMultiPhasePhase, PalletElectionProviderMultiPhaseReadySolution, PalletElectionProviderMultiPhaseRoundSnapshot, PalletElectionProviderMultiPhaseSignedSignedSubmission, PalletElectionProviderMultiPhaseSolutionOrSnapshotSize, PalletElectionsPhragmenSeatHolder, PalletElectionsPhragmenVoter, PalletFastUnstakeUnstakeRequest, PalletGrandpaStoredPendingChange, PalletGrandpaStoredState, PalletIdentityRegistrarInfo, PalletIdentityRegistration, PalletImOnlineBoundedOpaqueNetworkState, PalletImOnlineSr25519AppSr25519Public, PalletLotteryLotteryConfig, PalletMessageQueueBookState, PalletMessageQueueMockHelpersMessageOrigin, PalletMessageQueuePage, PalletMultisigMultisig, PalletNftsAttributeDeposit, PalletNftsCollectionConfig, PalletNftsCollectionDetails, PalletNftsCollectionMetadata, PalletNftsItemConfig, PalletNftsItemDetails, PalletNftsItemMetadata, PalletNftsPendingSwap, PalletNisBid, PalletNisReceiptRecord, PalletNisSummaryRecord, PalletNominationPoolsBondedPoolInner, PalletNominationPoolsPoolMember, PalletNominationPoolsRewardPool, PalletNominationPoolsSubPools, PalletPreimageRequestStatus, PalletProxyAnnouncement, PalletProxyProxyDefinition, PalletRankedCollectiveMemberRecord, PalletRankedCollectiveVoteRecord, PalletRecoveryActiveRecovery, PalletRecoveryRecoveryConfig, PalletReferendaReferendumInfoConvictionVotingTally, PalletReferendaReferendumInfoRankedCollectiveTally, PalletSchedulerScheduled, PalletSocietyBid, PalletSocietyBidKind, PalletSocietyVote, PalletSocietyVouchingStatus, PalletStakingActiveEraInfo, PalletStakingEraRewardPoints, PalletStakingExposure, PalletStakingForcing, PalletStakingNominations, PalletStakingRewardDestination, PalletStakingSlashingSlashingSpans, PalletStakingSlashingSpanRecord, PalletStakingStakingLedger, PalletStakingUnappliedSlash, PalletStakingValidatorPrefs, PalletStateTrieMigrationMigrationLimits, PalletStateTrieMigrationMigrationTask, PalletTipsOpenTip, PalletTransactionPaymentReleases, PalletTransactionStorageTransactionInfo, PalletTreasuryProposal, PalletUniquesCollectionDetails, PalletUniquesCollectionMetadata, PalletUniquesItemDetails, PalletUniquesItemMetadata, PalletVestingReleases, PalletVestingVestingInfo, SpAuthorityDiscoveryAppPublic, SpConsensusBabeAppPublic, SpConsensusBabeBabeEpochConfiguration, SpConsensusBabeDigestsNextConfigDescriptor, SpConsensusBabeDigestsPreDigest, SpCoreCryptoKeyTypeId, SpNposElectionsElectionScore, SpRuntimeDigest, SpStakingOffenceOffenceDetails } from '@polkadot/types/lookup';
|
import type { FrameSupportDispatchPerDispatchClassWeight, FrameSupportPreimagesBounded, FrameSupportTokensMiscAttributeNamespace, FrameSystemAccountInfo, FrameSystemEventRecord, FrameSystemLastRuntimeUpgradeInfo, FrameSystemPhase, KitchensinkRuntimeSessionKeys, PalletAllianceCid, PalletAllianceMemberRole, PalletAssetsApproval, PalletAssetsAssetAccount, PalletAssetsAssetDetails, PalletAssetsAssetMetadata, PalletBagsListListBag, PalletBagsListListNode, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesReserveData, PalletBountiesBounty, PalletChildBountiesChildBounty, PalletCollectiveVotes, PalletContractsStorageContractInfo, PalletContractsStorageDeletedContract, PalletContractsWasmOwnerInfo, PalletContractsWasmPrefabWasmModule, PalletConvictionVotingVoteVoting, PalletDemocracyMetadataOwner, PalletDemocracyReferendumInfo, PalletDemocracyVoteThreshold, PalletDemocracyVoteVoting, PalletElectionProviderMultiPhasePhase, PalletElectionProviderMultiPhaseReadySolution, PalletElectionProviderMultiPhaseRoundSnapshot, PalletElectionProviderMultiPhaseSignedSignedSubmission, PalletElectionProviderMultiPhaseSolutionOrSnapshotSize, PalletElectionsPhragmenSeatHolder, PalletElectionsPhragmenVoter, PalletFastUnstakeUnstakeRequest, PalletGrandpaStoredPendingChange, PalletGrandpaStoredState, PalletIdentityRegistrarInfo, PalletIdentityRegistration, PalletImOnlineBoundedOpaqueNetworkState, PalletImOnlineSr25519AppSr25519Public, PalletLotteryLotteryConfig, PalletMessageQueueBookState, PalletMessageQueuePage, PalletMultisigMultisig, PalletNftsAttributeDeposit, PalletNftsCollectionConfig, PalletNftsCollectionDetails, PalletNftsCollectionMetadata, PalletNftsItemConfig, PalletNftsItemDetails, PalletNftsItemMetadata, PalletNftsPendingSwap, PalletNisBid, PalletNisReceiptRecord, PalletNisSummaryRecord, PalletNominationPoolsBondedPoolInner, PalletNominationPoolsClaimPermission, PalletNominationPoolsPoolMember, PalletNominationPoolsRewardPool, PalletNominationPoolsSubPools, PalletPreimageRequestStatus, PalletProxyAnnouncement, PalletProxyProxyDefinition, PalletRankedCollectiveMemberRecord, PalletRankedCollectiveVoteRecord, PalletRecoveryActiveRecovery, PalletRecoveryRecoveryConfig, PalletReferendaReferendumInfoConvictionVotingTally, PalletReferendaReferendumInfoRankedCollectiveTally, PalletSchedulerScheduled, PalletSocietyBid, PalletSocietyBidKind, PalletSocietyVote, PalletSocietyVouchingStatus, PalletStakingActiveEraInfo, PalletStakingEraRewardPoints, PalletStakingExposure, PalletStakingForcing, PalletStakingNominations, PalletStakingRewardDestination, PalletStakingSlashingSlashingSpans, PalletStakingSlashingSpanRecord, PalletStakingStakingLedger, PalletStakingUnappliedSlash, PalletStakingValidatorPrefs, PalletStateTrieMigrationMigrationLimits, PalletStateTrieMigrationMigrationTask, PalletTipsOpenTip, PalletTransactionPaymentReleases, PalletTransactionStorageTransactionInfo, PalletTreasuryProposal, PalletUniquesCollectionDetails, PalletUniquesCollectionMetadata, PalletUniquesItemDetails, PalletUniquesItemMetadata, PalletVestingReleases, PalletVestingVestingInfo, SpAuthorityDiscoveryAppPublic, SpConsensusBabeAppPublic, SpConsensusBabeBabeEpochConfiguration, SpConsensusBabeDigestsNextConfigDescriptor, SpConsensusBabeDigestsPreDigest, SpCoreCryptoKeyTypeId, SpNposElectionsElectionScore, SpRuntimeDigest, SpStakingOffenceOffenceDetails } from '@polkadot/types/lookup';
|
||||||
import type { Observable } from '@polkadot/types/types';
|
import type { Observable } from '@polkadot/types/types';
|
||||||
|
|
||||||
export type __AugmentedQuery<ApiType extends ApiTypes> = AugmentedQuery<ApiType, () => unknown>;
|
export type __AugmentedQuery<ApiType extends ApiTypes> = AugmentedQuery<ApiType, () => unknown>;
|
||||||
@@ -128,14 +128,6 @@ declare module '@polkadot/api-base/types/storage' {
|
|||||||
* Author of current block.
|
* Author of current block.
|
||||||
**/
|
**/
|
||||||
author: AugmentedQuery<ApiType, () => Observable<Option<AccountId32>>, []> & QueryableStorageEntry<ApiType, []>;
|
author: AugmentedQuery<ApiType, () => Observable<Option<AccountId32>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
/**
|
|
||||||
* Whether uncles were already set in this block.
|
|
||||||
**/
|
|
||||||
didSetUncles: AugmentedQuery<ApiType, () => Observable<bool>, []> & QueryableStorageEntry<ApiType, []>;
|
|
||||||
/**
|
|
||||||
* Uncles
|
|
||||||
**/
|
|
||||||
uncles: AugmentedQuery<ApiType, () => Observable<Vec<PalletAuthorshipUncleEntryItem>>, []> & QueryableStorageEntry<ApiType, []>;
|
|
||||||
/**
|
/**
|
||||||
* Generic query
|
* Generic query
|
||||||
**/
|
**/
|
||||||
@@ -234,6 +226,17 @@ declare module '@polkadot/api-base/types/storage' {
|
|||||||
* epoch.
|
* epoch.
|
||||||
**/
|
**/
|
||||||
segmentIndex: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
|
segmentIndex: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* A list of the last 100 skipped epochs and the corresponding session index
|
||||||
|
* when the epoch was skipped.
|
||||||
|
*
|
||||||
|
* This is only used for validating equivocation proofs. An equivocation proof
|
||||||
|
* must contains a key-ownership proof for a given session, therefore we need a
|
||||||
|
* way to tie together sessions and epoch indices, i.e. we need to validate that
|
||||||
|
* a validator was the owner of a given key on a given session, and what the
|
||||||
|
* active epoch index was during that session.
|
||||||
|
**/
|
||||||
|
skippedEpochs: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[u64, u32]>>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
/**
|
/**
|
||||||
* TWOX-NOTE: `SegmentIndex` is an increasing integer, so this is okay.
|
* TWOX-NOTE: `SegmentIndex` is an increasing integer, so this is okay.
|
||||||
**/
|
**/
|
||||||
@@ -471,6 +474,15 @@ declare module '@polkadot/api-base/types/storage' {
|
|||||||
* `ReferendumCount` if there isn't a unbaked referendum.
|
* `ReferendumCount` if there isn't a unbaked referendum.
|
||||||
**/
|
**/
|
||||||
lowestUnbaked: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
|
lowestUnbaked: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* General information concerning any proposal or referendum.
|
||||||
|
* The `PreimageHash` refers to the preimage of the `Preimages` provider which can be a JSON
|
||||||
|
* dump or IPFS hash of a JSON file.
|
||||||
|
*
|
||||||
|
* Consider a garbage collection for a metadata of finished referendums to `unrequest` (remove)
|
||||||
|
* large preimages.
|
||||||
|
**/
|
||||||
|
metadataOf: AugmentedQuery<ApiType, (arg: PalletDemocracyMetadataOwner | { External: any } | { Proposal: any } | { Referendum: any } | string | Uint8Array) => Observable<Option<H256>>, [PalletDemocracyMetadataOwner]> & QueryableStorageEntry<ApiType, [PalletDemocracyMetadataOwner]>;
|
||||||
/**
|
/**
|
||||||
* The referendum to be tabled whenever it would be valid to table an external proposal.
|
* The referendum to be tabled whenever it would be valid to table an external proposal.
|
||||||
* This happens when a referendum needs to be tabled and one of two conditions are met:
|
* This happens when a referendum needs to be tabled and one of two conditions are met:
|
||||||
@@ -656,6 +668,37 @@ declare module '@polkadot/api-base/types/storage' {
|
|||||||
**/
|
**/
|
||||||
[key: string]: QueryableStorageEntry<ApiType>;
|
[key: string]: QueryableStorageEntry<ApiType>;
|
||||||
};
|
};
|
||||||
|
glutton: {
|
||||||
|
/**
|
||||||
|
* Storage value used to specify what percentage of the left over `ref_time`
|
||||||
|
* to consume during `on_idle`.
|
||||||
|
**/
|
||||||
|
compute: AugmentedQuery<ApiType, () => Observable<Perbill>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* Storage value used the specify what percentage of left over `proof_size`
|
||||||
|
* to consume during `on_idle`.
|
||||||
|
**/
|
||||||
|
storage: AugmentedQuery<ApiType, () => Observable<Perbill>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* Storage map used for wasting proof size.
|
||||||
|
*
|
||||||
|
* It contains no meaningful data - hence the name "Trash". The maximal number of entries is
|
||||||
|
* set to 65k, which is just below the next jump at 16^4. This is important to reduce the proof
|
||||||
|
* size benchmarking overestimate. The assumption here is that we won't have more than 65k *
|
||||||
|
* 1KiB = 65MiB of proof size wasting in practice. However, this limit is not enforced, so the
|
||||||
|
* pallet would also work out of the box with more entries, but its benchmarked proof weight
|
||||||
|
* would possibly be underestimated in that case.
|
||||||
|
**/
|
||||||
|
trashData: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Option<U8aFixed>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
|
||||||
|
/**
|
||||||
|
* The current number of entries in `TrashData`.
|
||||||
|
**/
|
||||||
|
trashDataCount: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
|
/**
|
||||||
|
* Generic query
|
||||||
|
**/
|
||||||
|
[key: string]: QueryableStorageEntry<ApiType>;
|
||||||
|
};
|
||||||
grandpa: {
|
grandpa: {
|
||||||
/**
|
/**
|
||||||
* The number of changes (both in terms of keys and underlying economic responsibilities)
|
* The number of changes (both in terms of keys and underlying economic responsibilities)
|
||||||
@@ -674,6 +717,12 @@ declare module '@polkadot/api-base/types/storage' {
|
|||||||
* A mapping from grandpa set ID to the index of the *most recent* session for which its
|
* A mapping from grandpa set ID to the index of the *most recent* session for which its
|
||||||
* members were responsible.
|
* members were responsible.
|
||||||
*
|
*
|
||||||
|
* This is only used for validating equivocation proofs. An equivocation proof must
|
||||||
|
* contains a key-ownership proof for a given session, therefore we need a way to tie
|
||||||
|
* together sessions and GRANDPA set ids, i.e. we need to validate that a validator
|
||||||
|
* was the owner of a given key on a given session, and what the active set ID was
|
||||||
|
* during that session.
|
||||||
|
*
|
||||||
* TWOX-NOTE: `SetId` is not under user control.
|
* TWOX-NOTE: `SetId` is not under user control.
|
||||||
**/
|
**/
|
||||||
setIdSession: AugmentedQuery<ApiType, (arg: u64 | AnyNumber | Uint8Array) => Observable<Option<u32>>, [u64]> & QueryableStorageEntry<ApiType, [u64]>;
|
setIdSession: AugmentedQuery<ApiType, (arg: u64 | AnyNumber | Uint8Array) => Observable<Option<u32>>, [u64]> & QueryableStorageEntry<ApiType, [u64]>;
|
||||||
@@ -801,15 +850,15 @@ declare module '@polkadot/api-base/types/storage' {
|
|||||||
/**
|
/**
|
||||||
* The index of the first and last (non-empty) pages.
|
* The index of the first and last (non-empty) pages.
|
||||||
**/
|
**/
|
||||||
bookStateFor: AugmentedQuery<ApiType, (arg: PalletMessageQueueMockHelpersMessageOrigin | { Here: any } | { There: any } | { Everywhere: any } | string | Uint8Array) => Observable<PalletMessageQueueBookState>, [PalletMessageQueueMockHelpersMessageOrigin]> & QueryableStorageEntry<ApiType, [PalletMessageQueueMockHelpersMessageOrigin]>;
|
bookStateFor: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<PalletMessageQueueBookState>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
|
||||||
/**
|
/**
|
||||||
* The map of page indices to pages.
|
* The map of page indices to pages.
|
||||||
**/
|
**/
|
||||||
pages: AugmentedQuery<ApiType, (arg1: PalletMessageQueueMockHelpersMessageOrigin | { Here: any } | { There: any } | { Everywhere: any } | string | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<Option<PalletMessageQueuePage>>, [PalletMessageQueueMockHelpersMessageOrigin, u32]> & QueryableStorageEntry<ApiType, [PalletMessageQueueMockHelpersMessageOrigin, u32]>;
|
pages: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<Option<PalletMessageQueuePage>>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;
|
||||||
/**
|
/**
|
||||||
* The origin at which we should begin servicing.
|
* The origin at which we should begin servicing.
|
||||||
**/
|
**/
|
||||||
serviceHead: AugmentedQuery<ApiType, () => Observable<Option<PalletMessageQueueMockHelpersMessageOrigin>>, []> & QueryableStorageEntry<ApiType, []>;
|
serviceHead: AugmentedQuery<ApiType, () => Observable<Option<u32>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||||
/**
|
/**
|
||||||
* Generic query
|
* Generic query
|
||||||
**/
|
**/
|
||||||
@@ -947,6 +996,10 @@ declare module '@polkadot/api-base/types/storage' {
|
|||||||
* Storage for bonded pools.
|
* Storage for bonded pools.
|
||||||
**/
|
**/
|
||||||
bondedPools: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Option<PalletNominationPoolsBondedPoolInner>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
|
bondedPools: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Option<PalletNominationPoolsBondedPoolInner>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
|
||||||
|
/**
|
||||||
|
* Map from a pool member account to their opted claim permission.
|
||||||
|
**/
|
||||||
|
claimPermissions: AugmentedQuery<ApiType, (arg: AccountId32 | string | Uint8Array) => Observable<PalletNominationPoolsClaimPermission>, [AccountId32]> & QueryableStorageEntry<ApiType, [AccountId32]>;
|
||||||
/**
|
/**
|
||||||
* Counter for the related counted storage map
|
* Counter for the related counted storage map
|
||||||
**/
|
**/
|
||||||
@@ -1163,6 +1216,15 @@ declare module '@polkadot/api-base/types/storage' {
|
|||||||
* The number of referenda being decided currently.
|
* The number of referenda being decided currently.
|
||||||
**/
|
**/
|
||||||
decidingCount: AugmentedQuery<ApiType, (arg: u16 | AnyNumber | Uint8Array) => Observable<u32>, [u16]> & QueryableStorageEntry<ApiType, [u16]>;
|
decidingCount: AugmentedQuery<ApiType, (arg: u16 | AnyNumber | Uint8Array) => Observable<u32>, [u16]> & QueryableStorageEntry<ApiType, [u16]>;
|
||||||
|
/**
|
||||||
|
* The metadata is a general information concerning the referendum.
|
||||||
|
* The `PreimageHash` refers to the preimage of the `Preimages` provider which can be a JSON
|
||||||
|
* dump or IPFS hash of a JSON file.
|
||||||
|
*
|
||||||
|
* Consider a garbage collection for a metadata of finished referendums to `unrequest` (remove)
|
||||||
|
* large preimages.
|
||||||
|
**/
|
||||||
|
metadataOf: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Option<H256>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
|
||||||
/**
|
/**
|
||||||
* The next free referendum index, aka the number of referenda started so far.
|
* The next free referendum index, aka the number of referenda started so far.
|
||||||
**/
|
**/
|
||||||
@@ -1211,6 +1273,15 @@ declare module '@polkadot/api-base/types/storage' {
|
|||||||
* The number of referenda being decided currently.
|
* The number of referenda being decided currently.
|
||||||
**/
|
**/
|
||||||
decidingCount: AugmentedQuery<ApiType, (arg: u16 | AnyNumber | Uint8Array) => Observable<u32>, [u16]> & QueryableStorageEntry<ApiType, [u16]>;
|
decidingCount: AugmentedQuery<ApiType, (arg: u16 | AnyNumber | Uint8Array) => Observable<u32>, [u16]> & QueryableStorageEntry<ApiType, [u16]>;
|
||||||
|
/**
|
||||||
|
* The metadata is a general information concerning the referendum.
|
||||||
|
* The `PreimageHash` refers to the preimage of the `Preimages` provider which can be a JSON
|
||||||
|
* dump or IPFS hash of a JSON file.
|
||||||
|
*
|
||||||
|
* Consider a garbage collection for a metadata of finished referendums to `unrequest` (remove)
|
||||||
|
* large preimages.
|
||||||
|
**/
|
||||||
|
metadataOf: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Option<H256>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
|
||||||
/**
|
/**
|
||||||
* The next free referendum index, aka the number of referenda started so far.
|
* The next free referendum index, aka the number of referenda started so far.
|
||||||
**/
|
**/
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -20,13 +20,13 @@
|
|||||||
"./detectPackage.cjs"
|
"./detectPackage.cjs"
|
||||||
],
|
],
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "9.13.6",
|
"version": "10.0.1",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.20.13",
|
"@polkadot/rpc-core": "10.0.1",
|
||||||
"@polkadot/rpc-core": "9.13.6",
|
"@polkadot/types": "10.0.1",
|
||||||
"@polkadot/types": "9.13.6",
|
"@polkadot/util": "^11.0.1",
|
||||||
"@polkadot/util": "^10.3.1",
|
"rxjs": "^7.8.0",
|
||||||
"rxjs": "^7.8.0"
|
"tslib": "^2.5.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,4 +3,4 @@
|
|||||||
|
|
||||||
// Do not edit, auto-generated by @polkadot/dev
|
// Do not edit, auto-generated by @polkadot/dev
|
||||||
|
|
||||||
export const packageInfo = { name: '@polkadot/api-base', path: 'auto', type: 'auto', version: '9.13.6' };
|
export const packageInfo = { name: '@polkadot/api-base', path: 'auto', type: 'auto', version: '10.0.1' };
|
||||||
|
|||||||
@@ -20,20 +20,20 @@
|
|||||||
"./detectPackage.cjs"
|
"./detectPackage.cjs"
|
||||||
],
|
],
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "9.13.6",
|
"version": "10.0.1",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.20.13",
|
"@polkadot/api": "10.0.1",
|
||||||
"@polkadot/api": "9.13.6",
|
"@polkadot/types": "10.0.1",
|
||||||
"@polkadot/types": "9.13.6",
|
"@polkadot/types-codec": "10.0.1",
|
||||||
"@polkadot/types-codec": "9.13.6",
|
"@polkadot/types-create": "10.0.1",
|
||||||
"@polkadot/types-create": "9.13.6",
|
"@polkadot/util": "^11.0.1",
|
||||||
"@polkadot/util": "^10.3.1",
|
"@polkadot/util-crypto": "^11.0.1",
|
||||||
"@polkadot/util-crypto": "^10.3.1",
|
"rxjs": "^7.8.0",
|
||||||
"rxjs": "^7.8.0"
|
"tslib": "^2.5.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@polkadot/api-augment": "9.13.6",
|
"@polkadot/api-augment": "10.0.1",
|
||||||
"@polkadot/keyring": "^10.3.1"
|
"@polkadot/keyring": "^11.0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,14 @@
|
|||||||
// Copyright 2017-2023 @polkadot/api-contract authors & contributors
|
// Copyright 2017-2023 @polkadot/api-contract authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// eslint-disable-next-line spaced-comment
|
||||||
|
/// <reference types="@polkadot/dev/node/test/node" />
|
||||||
|
|
||||||
import type { Registry } from '@polkadot/types/types';
|
import type { Registry } from '@polkadot/types/types';
|
||||||
|
|
||||||
import fs from 'fs';
|
import fs from 'node:fs';
|
||||||
import path from 'path';
|
import path from 'node:path';
|
||||||
|
import process from 'node:process';
|
||||||
|
|
||||||
import { TypeDefInfo } from '@polkadot/types/types';
|
import { TypeDefInfo } from '@polkadot/types/types';
|
||||||
import { blake2AsHex } from '@polkadot/util-crypto';
|
import { blake2AsHex } from '@polkadot/util-crypto';
|
||||||
@@ -41,6 +45,9 @@ interface JSONAbi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME When Jest is removed with ESM tests, this should be converted to use import.meta.url
|
||||||
|
const cmpPath = path.join(process.cwd(), 'packages/api-contract/src/test/compare');
|
||||||
|
|
||||||
function stringifyInfo (key: string, value: unknown): unknown {
|
function stringifyInfo (key: string, value: unknown): unknown {
|
||||||
return key === 'info'
|
return key === 'info'
|
||||||
? TypeDefInfo[value as number]
|
? TypeDefInfo[value as number]
|
||||||
@@ -82,26 +89,26 @@ describe('Abi', (): void => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('TypeDef', (): void => {
|
describe('TypeDef', (): void => {
|
||||||
Object.keys(abis).forEach((abiName) => {
|
for (const [abiName, abiJson] of Object.entries(abis)) {
|
||||||
it(`initializes from a contract ABI (${abiName})`, (): void => {
|
it(`initializes from a contract ABI: ${abiName}`, (): void => {
|
||||||
const abi = new Abi(abis[abiName]);
|
const abi = new Abi(abiJson);
|
||||||
const json = stringifyJson(abi.registry);
|
const registryJson = stringifyJson(abi.registry);
|
||||||
const cmpPath = path.join(__dirname, `../test/compare/${abiName}.test.json`);
|
const cmpFile = path.join(cmpPath, `${abiName}.test.json`);
|
||||||
|
const cmpText = fs.readFileSync(cmpFile, 'utf-8');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
expect(JSON.parse(registryJson)).toEqual(JSON.parse(cmpText));
|
||||||
expect(JSON.parse(json)).toEqual(require(cmpPath));
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (process.env.GITHUB_REPOSITORY) {
|
if (process.env.GITHUB_REPOSITORY) {
|
||||||
console.error(json);
|
console.error(registryJson);
|
||||||
|
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
||||||
fs.writeFileSync(cmpPath, json, { flag: 'w' });
|
fs.writeFileSync(cmpFile, registryJson, { flag: 'w' });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('has the correct hash for the source', (): void => {
|
it('has the correct hash for the source', (): void => {
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
// Copyright 2017-2023 @polkadot/api-contract authors & contributors
|
// Copyright 2017-2023 @polkadot/api-contract authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// eslint-disable-next-line spaced-comment
|
||||||
|
/// <reference types="@polkadot/dev/node/test/node" />
|
||||||
|
|
||||||
import { TypeRegistry } from '@polkadot/types';
|
import { TypeRegistry } from '@polkadot/types';
|
||||||
|
|
||||||
import abis from '../test/contracts';
|
import abis from '../test/contracts';
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { v3ToV4 } from './toV4';
|
|||||||
|
|
||||||
// The versions where an enum is used, aka V0 is missing
|
// The versions where an enum is used, aka V0 is missing
|
||||||
// (Order from newest, i.e. we expect more on newest vs oldest)
|
// (Order from newest, i.e. we expect more on newest vs oldest)
|
||||||
export const enumVersions = <const> ['V4', 'V3', 'V2', 'V1'];
|
export const enumVersions = ['V4', 'V3', 'V2', 'V1'] as const;
|
||||||
|
|
||||||
type Versions = typeof enumVersions[number] | 'V0';
|
type Versions = typeof enumVersions[number] | 'V0';
|
||||||
|
|
||||||
|
|||||||
@@ -23,11 +23,11 @@ interface ArgsEntry <T extends WithArgs> extends NamedEntry {
|
|||||||
args: GetArgsType<T>['args'][0][];
|
args: GetArgsType<T>['args'][0][];
|
||||||
}
|
}
|
||||||
|
|
||||||
const ARG_TYPES = <const> {
|
const ARG_TYPES = {
|
||||||
ContractConstructorSpec: 'ContractMessageParamSpecV2',
|
ContractConstructorSpec: 'ContractMessageParamSpecV2',
|
||||||
ContractEventSpec: 'ContractEventParamSpecV2',
|
ContractEventSpec: 'ContractEventParamSpecV2',
|
||||||
ContractMessageSpec: 'ContractMessageParamSpecV2'
|
ContractMessageSpec: 'ContractMessageParamSpecV2'
|
||||||
};
|
} as const;
|
||||||
|
|
||||||
function v1ToV2Label (entry: NamedEntry): { label: Text } {
|
function v1ToV2Label (entry: NamedEntry): { label: Text } {
|
||||||
return objectSpread({}, entry, {
|
return objectSpread({}, entry, {
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
// Copyright 2017-2023 @polkadot/api-contract authors & contributors
|
// Copyright 2017-2023 @polkadot/api-contract authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import fs from 'fs';
|
// eslint-disable-next-line spaced-comment
|
||||||
import path from 'path';
|
/// <reference types="@polkadot/dev/node/test/node" />
|
||||||
|
|
||||||
|
import fs from 'node:fs';
|
||||||
|
import path from 'node:path';
|
||||||
|
import process from 'node:process';
|
||||||
|
|
||||||
import { toPromiseMethod } from '@polkadot/api';
|
import { toPromiseMethod } from '@polkadot/api';
|
||||||
|
|
||||||
@@ -12,7 +16,8 @@ import v1contractFlipper from '../test/contracts/ink/v1/flipper.contract.json' a
|
|||||||
import { Code } from './Code';
|
import { Code } from './Code';
|
||||||
import { mockApi } from './mock';
|
import { mockApi } from './mock';
|
||||||
|
|
||||||
const v0wasmFlipper = fs.readFileSync(path.join(__dirname, '../test/contracts/ink/v0/flipper.wasm'));
|
// FIXME When Jest is removed with ESM tests, this should be converted to use import.meta.url
|
||||||
|
const v0wasmFlipper = fs.readFileSync(path.join(process.cwd(), 'packages/api-contract/src/test/contracts/ink/v0/flipper.wasm'), 'utf-8');
|
||||||
|
|
||||||
describe('Code', (): void => {
|
describe('Code', (): void => {
|
||||||
it('can construct with an individual ABI/WASM combo', (): void => {
|
it('can construct with an individual ABI/WASM combo', (): void => {
|
||||||
|
|||||||
@@ -3,4 +3,4 @@
|
|||||||
|
|
||||||
// Do not edit, auto-generated by @polkadot/dev
|
// Do not edit, auto-generated by @polkadot/dev
|
||||||
|
|
||||||
export const packageInfo = { name: '@polkadot/api-contract', path: 'auto', type: 'auto', version: '9.13.6' };
|
export const packageInfo = { name: '@polkadot/api-contract', path: 'auto', type: 'auto', version: '10.0.1' };
|
||||||
|
|||||||
@@ -20,25 +20,25 @@
|
|||||||
"./detectPackage.cjs"
|
"./detectPackage.cjs"
|
||||||
],
|
],
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "9.13.6",
|
"version": "10.0.1",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.20.13",
|
"@polkadot/api": "10.0.1",
|
||||||
"@polkadot/api": "9.13.6",
|
"@polkadot/api-augment": "10.0.1",
|
||||||
"@polkadot/api-augment": "9.13.6",
|
"@polkadot/api-base": "10.0.1",
|
||||||
"@polkadot/api-base": "9.13.6",
|
"@polkadot/rpc-core": "10.0.1",
|
||||||
"@polkadot/rpc-core": "9.13.6",
|
"@polkadot/types": "10.0.1",
|
||||||
"@polkadot/types": "9.13.6",
|
"@polkadot/types-codec": "10.0.1",
|
||||||
"@polkadot/types-codec": "9.13.6",
|
"@polkadot/util": "^11.0.1",
|
||||||
"@polkadot/util": "^10.3.1",
|
"@polkadot/util-crypto": "^11.0.1",
|
||||||
"@polkadot/util-crypto": "^10.3.1",
|
"rxjs": "^7.8.0",
|
||||||
"rxjs": "^7.8.0"
|
"tslib": "^2.5.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@polkadot/api": "9.13.6",
|
"@polkadot/api": "10.0.1",
|
||||||
"@polkadot/api-augment": "9.13.6",
|
"@polkadot/api-augment": "10.0.1",
|
||||||
"@polkadot/rpc-augment": "9.13.6",
|
"@polkadot/rpc-augment": "10.0.1",
|
||||||
"@polkadot/rpc-provider": "9.13.6",
|
"@polkadot/rpc-provider": "10.0.1",
|
||||||
"@polkadot/types-support": "9.13.6"
|
"@polkadot/types-support": "10.0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
|
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// eslint-disable-next-line spaced-comment
|
||||||
|
/// <reference types="@polkadot/dev/node/test/node" />
|
||||||
|
|
||||||
import type { SubmittableExtrinsic } from '@polkadot/api-base/types';
|
import type { SubmittableExtrinsic } from '@polkadot/api-base/types';
|
||||||
import type { Bytes, Option, StorageKey } from '@polkadot/types';
|
import type { Bytes, Option, StorageKey } from '@polkadot/types';
|
||||||
import type { Bounty, BountyIndex, Proposal, ProposalIndex } from '@polkadot/types/interfaces';
|
import type { Bounty, BountyIndex, Proposal, ProposalIndex } from '@polkadot/types/interfaces';
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
|
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// eslint-disable-next-line spaced-comment
|
||||||
|
/// <reference types="@polkadot/dev/node/test/node" />
|
||||||
|
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||||
@@ -27,19 +30,22 @@ const testFunction = (api: ApiRx): any => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function waitReady (api: ApiRx): Promise<ApiRx> {
|
||||||
|
return new Promise<ApiRx>((resolve) =>
|
||||||
|
api.isReady.subscribe((api) => resolve(api))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
describe('derive', (): void => {
|
describe('derive', (): void => {
|
||||||
const registry = new TypeRegistry();
|
const registry = new TypeRegistry();
|
||||||
|
|
||||||
describe('builtin', (): void => {
|
describe('builtin', (): void => {
|
||||||
const api = new ApiRx({ provider: new MockProvider(registry), registry });
|
const api = new ApiRx({ provider: new MockProvider(registry), registry });
|
||||||
|
|
||||||
beforeAll((done): void => {
|
beforeAll(async () => {
|
||||||
api.isReady.subscribe(() => done());
|
await waitReady(api);
|
||||||
});
|
|
||||||
|
|
||||||
afterAll(async () => {
|
|
||||||
await api.disconnect();
|
|
||||||
});
|
});
|
||||||
|
afterAll(() => api.disconnect());
|
||||||
|
|
||||||
testFunction(api)('accounts', 'idAndIndex', []);
|
testFunction(api)('accounts', 'idAndIndex', []);
|
||||||
testFunction(api)('accounts', 'idToIndex', []);
|
testFunction(api)('accounts', 'idToIndex', []);
|
||||||
@@ -81,13 +87,10 @@ describe('derive', (): void => {
|
|||||||
throwOnConnect: true
|
throwOnConnect: true
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeAll((done): void => {
|
beforeAll(async () => {
|
||||||
api.isReady.subscribe(() => done());
|
await waitReady(api);
|
||||||
});
|
|
||||||
|
|
||||||
afterAll(async () => {
|
|
||||||
await api.disconnect();
|
|
||||||
});
|
});
|
||||||
|
afterAll(() => api.disconnect());
|
||||||
|
|
||||||
// override
|
// override
|
||||||
testFunction(api)('balances', 'fees', ['a', 'b']);
|
testFunction(api)('balances', 'fees', ['a', 'b']);
|
||||||
|
|||||||
@@ -3,4 +3,4 @@
|
|||||||
|
|
||||||
// Do not edit, auto-generated by @polkadot/dev
|
// Do not edit, auto-generated by @polkadot/dev
|
||||||
|
|
||||||
export const packageInfo = { name: '@polkadot/api-derive', path: 'auto', type: 'auto', version: '9.13.6' };
|
export const packageInfo = { name: '@polkadot/api-derive', path: 'auto', type: 'auto', version: '10.0.1' };
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
|
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// eslint-disable-next-line spaced-comment
|
||||||
|
/// <reference types="@polkadot/dev/node/test/node" />
|
||||||
|
|
||||||
import type { ApprovalFlag } from '@polkadot/types/interfaces';
|
import type { ApprovalFlag } from '@polkadot/types/interfaces';
|
||||||
|
|
||||||
import { TypeRegistry } from '@polkadot/types/create';
|
import { TypeRegistry } from '@polkadot/types/create';
|
||||||
|
|||||||
+19
-19
@@ -20,29 +20,29 @@
|
|||||||
"./detectPackage.cjs"
|
"./detectPackage.cjs"
|
||||||
],
|
],
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "9.13.6",
|
"version": "10.0.1",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.20.13",
|
"@polkadot/api-augment": "10.0.1",
|
||||||
"@polkadot/api-augment": "9.13.6",
|
"@polkadot/api-base": "10.0.1",
|
||||||
"@polkadot/api-base": "9.13.6",
|
"@polkadot/api-derive": "10.0.1",
|
||||||
"@polkadot/api-derive": "9.13.6",
|
"@polkadot/keyring": "^11.0.1",
|
||||||
"@polkadot/keyring": "^10.3.1",
|
"@polkadot/rpc-augment": "10.0.1",
|
||||||
"@polkadot/rpc-augment": "9.13.6",
|
"@polkadot/rpc-core": "10.0.1",
|
||||||
"@polkadot/rpc-core": "9.13.6",
|
"@polkadot/rpc-provider": "10.0.1",
|
||||||
"@polkadot/rpc-provider": "9.13.6",
|
"@polkadot/types": "10.0.1",
|
||||||
"@polkadot/types": "9.13.6",
|
"@polkadot/types-augment": "10.0.1",
|
||||||
"@polkadot/types-augment": "9.13.6",
|
"@polkadot/types-codec": "10.0.1",
|
||||||
"@polkadot/types-codec": "9.13.6",
|
"@polkadot/types-create": "10.0.1",
|
||||||
"@polkadot/types-create": "9.13.6",
|
"@polkadot/types-known": "10.0.1",
|
||||||
"@polkadot/types-known": "9.13.6",
|
"@polkadot/util": "^11.0.1",
|
||||||
"@polkadot/util": "^10.3.1",
|
"@polkadot/util-crypto": "^11.0.1",
|
||||||
"@polkadot/util-crypto": "^10.3.1",
|
|
||||||
"eventemitter3": "^5.0.0",
|
"eventemitter3": "^5.0.0",
|
||||||
"rxjs": "^7.8.0"
|
"rxjs": "^7.8.0",
|
||||||
|
"tslib": "^2.5.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@polkadot/api-augment": "9.13.6",
|
"@polkadot/api-augment": "10.0.1",
|
||||||
"@polkadot/types-support": "9.13.6"
|
"@polkadot/types-support": "10.0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -373,6 +373,8 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _subscribeHealth (): void {
|
private _subscribeHealth (): void {
|
||||||
|
this._unsubscribeHealth();
|
||||||
|
|
||||||
// Only enable the health keepalive on WS, not needed on HTTP
|
// Only enable the health keepalive on WS, not needed on HTTP
|
||||||
this.#healthTimer = this.hasSubscriptions
|
this.#healthTimer = this.hasSubscriptions
|
||||||
? setInterval((): void => {
|
? setInterval((): void => {
|
||||||
@@ -428,7 +430,7 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
|
|||||||
|
|
||||||
#onProviderDisconnect (): void {
|
#onProviderDisconnect (): void {
|
||||||
this._isConnected.next(false);
|
this._isConnected.next(false);
|
||||||
this._unsubscribeHealth();
|
this._unsubscribe();
|
||||||
this.emit('disconnected');
|
this.emit('disconnected');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,4 +3,4 @@
|
|||||||
|
|
||||||
// Do not edit, auto-generated by @polkadot/dev
|
// Do not edit, auto-generated by @polkadot/dev
|
||||||
|
|
||||||
export const packageInfo = { name: '@polkadot/api', path: 'auto', type: 'auto', version: '9.13.6' };
|
export const packageInfo = { name: '@polkadot/api', path: 'auto', type: 'auto', version: '10.0.1' };
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
// Copyright 2017-2023 @polkadot/api authors & contributors
|
// Copyright 2017-2023 @polkadot/api authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// eslint-disable-next-line spaced-comment
|
||||||
|
/// <reference types="@polkadot/dev/node/test/node" />
|
||||||
|
|
||||||
import type { UnsubscribePromise } from '../types';
|
import type { UnsubscribePromise } from '../types';
|
||||||
|
|
||||||
import { Combinator } from './Combinator';
|
import { Combinator } from './Combinator';
|
||||||
@@ -19,81 +22,89 @@ describe('Combinator', (): void => {
|
|||||||
fns = [];
|
fns = [];
|
||||||
});
|
});
|
||||||
|
|
||||||
it('it triggers on all values', (done): void => {
|
it('it triggers on all values', async (): Promise<void> => {
|
||||||
let count = 0;
|
await new Promise<boolean>((resolve) => {
|
||||||
const combinator = new Combinator(
|
let count = 0;
|
||||||
[storeFn],
|
const combinator = new Combinator(
|
||||||
(value: any[]): void => {
|
[storeFn],
|
||||||
expect(value[0]).toEqual(`test${count}`);
|
(value: any[]): void => {
|
||||||
|
expect(value[0]).toEqual(`test${count}`);
|
||||||
|
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
if (count === 3) {
|
if (count === 3) {
|
||||||
done();
|
resolve(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
);
|
||||||
);
|
|
||||||
|
|
||||||
fns[0]('test0');
|
fns[0]('test0');
|
||||||
fns[0]('test1');
|
fns[0]('test1');
|
||||||
fns[0]('test2');
|
fns[0]('test2');
|
||||||
|
|
||||||
expect(combinator).toBeDefined();
|
expect(combinator).toBeDefined();
|
||||||
});
|
|
||||||
|
|
||||||
it('combines values from 2 sources, firing when it has all results', (done): void => {
|
|
||||||
const combinator = new Combinator(
|
|
||||||
[storeFn, storeFn],
|
|
||||||
(value: any[]): void => {
|
|
||||||
expect(value).toEqual(['test0', 'test1']);
|
|
||||||
|
|
||||||
done();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
fns[0]('test0');
|
|
||||||
fns[1]('test1');
|
|
||||||
|
|
||||||
expect(combinator).toBeDefined();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('combines values from 2 sources, allowing multiple updates', (done): void => {
|
|
||||||
let count = 0;
|
|
||||||
const combinator = new Combinator(
|
|
||||||
[storeFn, storeFn],
|
|
||||||
(value: any[]): void => {
|
|
||||||
expect(value).toEqual(
|
|
||||||
count === 0
|
|
||||||
? ['test0', 'test1']
|
|
||||||
: ['test2', 'test1']);
|
|
||||||
|
|
||||||
count++;
|
|
||||||
|
|
||||||
if (count === 2) {
|
|
||||||
done();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
fns[0]('test0');
|
|
||||||
fns[1]('test1');
|
|
||||||
fns[0]('test2');
|
|
||||||
|
|
||||||
expect(combinator).toBeDefined();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('unsubscribes as required', (done): void => {
|
|
||||||
// eslint-disable-next-line @typescript-eslint/require-await
|
|
||||||
const mocker = async (): Promise<any> => done;
|
|
||||||
const combinator = new Combinator([
|
|
||||||
mocker,
|
|
||||||
// eslint-disable-next-line @typescript-eslint/require-await
|
|
||||||
async (): UnsubscribePromise => (): void => undefined
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
||||||
], (value: any[]): void => {
|
|
||||||
// ignore
|
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
combinator.unsubscribe();
|
it('combines values from 2 sources, firing when it has all results', async (): Promise<void> => {
|
||||||
|
await new Promise<boolean>((resolve) => {
|
||||||
|
const combinator = new Combinator(
|
||||||
|
[storeFn, storeFn],
|
||||||
|
(value: any[]): void => {
|
||||||
|
expect(value).toEqual(['test0', 'test1']);
|
||||||
|
|
||||||
|
resolve(true);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
fns[0]('test0');
|
||||||
|
fns[1]('test1');
|
||||||
|
|
||||||
|
expect(combinator).toBeDefined();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('combines values from 2 sources, allowing multiple updates', async (): Promise<void> => {
|
||||||
|
await new Promise<boolean>((resolve) => {
|
||||||
|
let count = 0;
|
||||||
|
const combinator = new Combinator(
|
||||||
|
[storeFn, storeFn],
|
||||||
|
(value: any[]): void => {
|
||||||
|
expect(value).toEqual(
|
||||||
|
count === 0
|
||||||
|
? ['test0', 'test1']
|
||||||
|
: ['test2', 'test1']);
|
||||||
|
|
||||||
|
count++;
|
||||||
|
|
||||||
|
if (count === 2) {
|
||||||
|
resolve(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
fns[0]('test0');
|
||||||
|
fns[1]('test1');
|
||||||
|
fns[0]('test2');
|
||||||
|
|
||||||
|
expect(combinator).toBeDefined();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('unsubscribes as required', async (): Promise<void> => {
|
||||||
|
await new Promise<void>((resolve) => {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/require-await
|
||||||
|
const mocker = () => Promise.resolve(resolve);
|
||||||
|
const combinator = new Combinator([
|
||||||
|
mocker,
|
||||||
|
// eslint-disable-next-line @typescript-eslint/require-await
|
||||||
|
async (): UnsubscribePromise => (): void => undefined
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
], (value: any[]): void => {
|
||||||
|
// ignore
|
||||||
|
});
|
||||||
|
|
||||||
|
combinator.unsubscribe();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
// Copyright 2017-2023 @polkadot/api authors & contributors
|
// Copyright 2017-2023 @polkadot/api authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// eslint-disable-next-line spaced-comment
|
||||||
|
/// <reference types="@polkadot/dev/node/test/node" />
|
||||||
|
|
||||||
import type { HexString } from '@polkadot/util/types';
|
import type { HexString } from '@polkadot/util/types';
|
||||||
import type { SubmittableExtrinsic } from '../types';
|
import type { SubmittableExtrinsic } from '../types';
|
||||||
|
|
||||||
import { jest } from '@jest/globals';
|
|
||||||
|
|
||||||
import { createPair } from '@polkadot/keyring/pair';
|
import { createPair } from '@polkadot/keyring/pair';
|
||||||
import { createTestKeyring } from '@polkadot/keyring/testing';
|
import { createTestKeyring } from '@polkadot/keyring/testing';
|
||||||
import { MockProvider } from '@polkadot/rpc-provider/mock';
|
import { MockProvider } from '@polkadot/rpc-provider/mock';
|
||||||
@@ -47,7 +48,6 @@ describe('ApiPromise', (): void => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
beforeEach((): void => {
|
beforeEach((): void => {
|
||||||
jest.setTimeout(10000);
|
|
||||||
provider = new MockProvider(registry);
|
provider = new MockProvider(registry);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ describe('ApiPromise', (): void => {
|
|||||||
|
|
||||||
await api.disconnect();
|
await api.disconnect();
|
||||||
|
|
||||||
fail('Expected an error but none occurred.');
|
throw new Error('Expected an error but none occurred.');
|
||||||
} catch {
|
} catch {
|
||||||
// Pass
|
// Pass
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,20 @@
|
|||||||
// Copyright 2017-2023 @polkadot/api authors & contributors
|
// Copyright 2017-2023 @polkadot/api authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// eslint-disable-next-line spaced-comment
|
||||||
|
/// <reference types="@polkadot/dev/node/test/node" />
|
||||||
|
|
||||||
import { augmentObject } from './augmentObject';
|
import { augmentObject } from './augmentObject';
|
||||||
|
|
||||||
describe('augmentObject', (): void => {
|
describe('augmentObject', (): void => {
|
||||||
let spy: any;
|
let spy: ReturnType<typeof jest.spyOn>;
|
||||||
|
|
||||||
beforeEach((): void => {
|
beforeEach((): void => {
|
||||||
spy = jest.spyOn(console, 'warn');
|
spy = jest.spyOn(console, 'warn');
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach((): void => {
|
afterEach((): void => {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
|
spy.mockRestore();
|
||||||
spy.mockClear();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('logs added/removed sections and methods', (): void => {
|
it('logs added/removed sections and methods', (): void => {
|
||||||
@@ -24,12 +26,12 @@ describe('augmentObject', (): void => {
|
|||||||
|
|
||||||
expect(spy).toHaveBeenCalledWith(
|
expect(spy).toHaveBeenCalledWith(
|
||||||
expect.anything(),
|
expect.anything(),
|
||||||
expect.stringContaining('API/AUGMENT'),
|
expect.stringMatching(/API\/AUGMENT/),
|
||||||
'api.test: Found 1 added and 1 removed modules:\n\t added: new\n\tremoved: baz'
|
'api.test: Found 1 added and 1 removed modules:\n\t added: new\n\tremoved: baz'
|
||||||
);
|
);
|
||||||
expect(spy).toHaveBeenCalledWith(
|
expect(spy).toHaveBeenCalledWith(
|
||||||
expect.anything(),
|
expect.anything(),
|
||||||
expect.stringContaining('API/AUGMENT'),
|
expect.stringMatching(/API\/AUGMENT/),
|
||||||
'api.test: Found 2 added and 3 removed calls:\n\t added: bar.b, foo.d\n\tremoved: bar.a, bar.c, foo.c'
|
'api.test: Found 2 added and 3 removed calls:\n\t added: bar.b, foo.d\n\tremoved: bar.a, bar.c, foo.c'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
// Copyright 2017-2023 @polkadot/api authors & contributors
|
// Copyright 2017-2023 @polkadot/api authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// eslint-disable-next-line spaced-comment
|
||||||
|
/// <reference types="@polkadot/dev/node/test/node" />
|
||||||
|
|
||||||
import { decorateStorage, Metadata, TypeRegistry } from '@polkadot/types';
|
import { decorateStorage, Metadata, TypeRegistry } from '@polkadot/types';
|
||||||
import metaStatic from '@polkadot/types-support/metadata/static-substrate';
|
import metaStatic from '@polkadot/types-support/metadata/static-substrate';
|
||||||
|
|
||||||
|
|||||||
@@ -20,13 +20,13 @@
|
|||||||
"./detectPackage.cjs"
|
"./detectPackage.cjs"
|
||||||
],
|
],
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "9.13.6",
|
"version": "10.0.1",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.20.13",
|
"@polkadot/rpc-core": "10.0.1",
|
||||||
"@polkadot/rpc-core": "9.13.6",
|
"@polkadot/types": "10.0.1",
|
||||||
"@polkadot/types": "9.13.6",
|
"@polkadot/types-codec": "10.0.1",
|
||||||
"@polkadot/types-codec": "9.13.6",
|
"@polkadot/util": "^11.0.1",
|
||||||
"@polkadot/util": "^10.3.1"
|
"tslib": "^2.5.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,4 +3,4 @@
|
|||||||
|
|
||||||
// Do not edit, auto-generated by @polkadot/dev
|
// Do not edit, auto-generated by @polkadot/dev
|
||||||
|
|
||||||
export const packageInfo = { name: '@polkadot/rpc-augment', path: 'auto', type: 'auto', version: '9.13.6' };
|
export const packageInfo = { name: '@polkadot/rpc-augment', path: 'auto', type: 'auto', version: '10.0.1' };
|
||||||
|
|||||||
@@ -20,18 +20,18 @@
|
|||||||
"./detectPackage.cjs"
|
"./detectPackage.cjs"
|
||||||
],
|
],
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "9.13.6",
|
"version": "10.0.1",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.20.13",
|
"@polkadot/rpc-augment": "10.0.1",
|
||||||
"@polkadot/rpc-augment": "9.13.6",
|
"@polkadot/rpc-provider": "10.0.1",
|
||||||
"@polkadot/rpc-provider": "9.13.6",
|
"@polkadot/types": "10.0.1",
|
||||||
"@polkadot/types": "9.13.6",
|
"@polkadot/util": "^11.0.1",
|
||||||
"@polkadot/util": "^10.3.1",
|
"rxjs": "^7.8.0",
|
||||||
"rxjs": "^7.8.0"
|
"tslib": "^2.5.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@polkadot/keyring": "^10.3.1",
|
"@polkadot/keyring": "^11.0.1",
|
||||||
"@polkadot/rpc-augment": "9.13.6"
|
"@polkadot/rpc-augment": "10.0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
// Copyright 2017-2023 @polkadot/rpc-core authors & contributors
|
// Copyright 2017-2023 @polkadot/rpc-core authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// eslint-disable-next-line spaced-comment
|
||||||
|
/// <reference types="@polkadot/dev/node/test/node" />
|
||||||
|
|
||||||
import type { RpcInterface } from './types';
|
import type { RpcInterface } from './types';
|
||||||
|
|
||||||
import { createTestPairs } from '@polkadot/keyring/testingPairs';
|
import { createTestPairs } from '@polkadot/keyring/testingPairs';
|
||||||
@@ -52,24 +55,26 @@ describe('Cached Observables', (): void => {
|
|||||||
expect(observable2).not.toBe(observable1);
|
expect(observable2).not.toBe(observable1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('subscribes to the same one if within the period (unbsub delay)', (done): void => {
|
it('subscribes to the same one if within the period (unbsub delay)', async (): Promise<void> => {
|
||||||
const observable1 = rpc.chain.subscribeNewHeads();
|
const observable1 = rpc.chain.subscribeNewHeads();
|
||||||
const sub1 = observable1.subscribe();
|
const sub1 = observable1.subscribe();
|
||||||
|
|
||||||
sub1.unsubscribe();
|
sub1.unsubscribe();
|
||||||
|
|
||||||
setTimeout((): void => {
|
await new Promise<boolean>((resolve) => {
|
||||||
const observable2 = rpc.chain.subscribeNewHeads();
|
setTimeout((): void => {
|
||||||
const sub2 = observable2.subscribe();
|
const observable2 = rpc.chain.subscribeNewHeads();
|
||||||
|
const sub2 = observable2.subscribe();
|
||||||
|
|
||||||
expect(observable1).toBe(observable2);
|
expect(observable1).toBe(observable2);
|
||||||
|
|
||||||
sub2.unsubscribe();
|
sub2.unsubscribe();
|
||||||
done();
|
resolve(true);
|
||||||
}, 500);
|
}, 500);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('clears cache if there are no more subscribers', (done): void => {
|
it('clears cache if there are no more subscribers', async (): Promise<void> => {
|
||||||
const observable1 = rpc.chain.subscribeNewHeads();
|
const observable1 = rpc.chain.subscribeNewHeads();
|
||||||
const observable2 = rpc.chain.subscribeNewHeads();
|
const observable2 = rpc.chain.subscribeNewHeads();
|
||||||
const sub1 = observable1.subscribe();
|
const sub1 = observable1.subscribe();
|
||||||
@@ -80,13 +85,15 @@ describe('Cached Observables', (): void => {
|
|||||||
sub1.unsubscribe();
|
sub1.unsubscribe();
|
||||||
sub2.unsubscribe();
|
sub2.unsubscribe();
|
||||||
|
|
||||||
setTimeout((): void => {
|
await new Promise<boolean>((resolve) => {
|
||||||
// No more subscribers, now create a new observable
|
setTimeout((): void => {
|
||||||
const observable3 = rpc.chain.subscribeNewHeads();
|
// No more subscribers, now create a new observable
|
||||||
|
const observable3 = rpc.chain.subscribeNewHeads();
|
||||||
|
|
||||||
expect(observable3).not.toBe(observable1);
|
expect(observable3).not.toBe(observable1);
|
||||||
done();
|
resolve(true);
|
||||||
}, 3500);
|
}, 3500);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('creates different observables for different methods but same arguments', (): void => {
|
it('creates different observables for different methods but same arguments', (): void => {
|
||||||
@@ -104,7 +111,7 @@ describe('Cached Observables', (): void => {
|
|||||||
expect(observable2).toBe(observable1);
|
expect(observable2).toBe(observable1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('creates multiple observables for subsequent one-shots delayed', (done): void => {
|
it('creates multiple observables for subsequent one-shots delayed', async (): Promise<void> => {
|
||||||
const observable1 = rpc.chain.getBlockHash(123);
|
const observable1 = rpc.chain.getBlockHash(123);
|
||||||
|
|
||||||
const sub = observable1.subscribe((): void => {
|
const sub = observable1.subscribe((): void => {
|
||||||
@@ -113,9 +120,11 @@ describe('Cached Observables', (): void => {
|
|||||||
|
|
||||||
expect(rpc.chain.getBlockHash(123)).toBe(observable1);
|
expect(rpc.chain.getBlockHash(123)).toBe(observable1);
|
||||||
|
|
||||||
setTimeout((): void => {
|
await new Promise<boolean>((resolve) => {
|
||||||
expect(rpc.chain.getBlockHash(123)).not.toBe(observable1);
|
setTimeout((): void => {
|
||||||
done();
|
expect(rpc.chain.getBlockHash(123)).not.toBe(observable1);
|
||||||
}, 3500);
|
resolve(true);
|
||||||
|
}, 3500);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
// Copyright 2017-2023 @polkadot/rpc-core authors & contributors
|
// Copyright 2017-2023 @polkadot/rpc-core authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// eslint-disable-next-line spaced-comment
|
||||||
|
/// <reference types="@polkadot/dev/node/test/node" />
|
||||||
|
|
||||||
import type { ProviderInterface } from '@polkadot/rpc-provider/types';
|
import type { ProviderInterface } from '@polkadot/rpc-provider/types';
|
||||||
|
|
||||||
import { MockProvider } from '@polkadot/rpc-provider/mock';
|
import { MockProvider } from '@polkadot/rpc-provider/mock';
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
// Copyright 2017-2023 @polkadot/rpc-core authors & contributors
|
// Copyright 2017-2023 @polkadot/rpc-core authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// eslint-disable-next-line spaced-comment
|
||||||
|
/// <reference types="@polkadot/dev/node/test/node" />
|
||||||
|
|
||||||
import type { ProviderInterface } from '@polkadot/rpc-provider/types';
|
import type { ProviderInterface } from '@polkadot/rpc-provider/types';
|
||||||
import type { DefinitionRpc } from '@polkadot/types/types';
|
import type { DefinitionRpc } from '@polkadot/types/types';
|
||||||
|
|
||||||
@@ -39,31 +42,35 @@ describe('methodSend', (): void => {
|
|||||||
rpc = new RpcCore('987', registry, provider);
|
rpc = new RpcCore('987', registry, provider);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('checks for mismatched parameters', (done): void => {
|
it('checks for mismatched parameters', async (): Promise<void> => {
|
||||||
// private method
|
// private method
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
|
||||||
const method = (rpc as any)._createMethodSend('test', 'bleh', methods.bleh);
|
const method = (rpc as any)._createMethodSend('test', 'bleh', methods.bleh);
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
|
await new Promise<boolean>((resolve) => {
|
||||||
method(1).subscribe(
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
|
||||||
(): void => undefined,
|
method(1).subscribe(
|
||||||
(error: Error): void => {
|
(): void => undefined,
|
||||||
expect(error.message).toMatch(/parameters, 1 found instead/);
|
(error: Error): void => {
|
||||||
done();
|
expect(error.message).toMatch(/parameters, 1 found instead/);
|
||||||
});
|
resolve(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('calls the provider with the correct parameters', (done): void => {
|
it('calls the provider with the correct parameters', async (): Promise<void> => {
|
||||||
// private method
|
// private method
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
|
||||||
const method = (rpc as any)._createMethodSend('test', 'blah', methods.blah);
|
const method = (rpc as any)._createMethodSend('test', 'blah', methods.blah);
|
||||||
|
|
||||||
// Args are length-prefixed, because it's a Bytes
|
await new Promise<boolean>((resolve) => {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
|
// Args are length-prefixed, because it's a Bytes
|
||||||
method(new Uint8Array([2 << 2, 0x12, 0x34])).subscribe((): void => {
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
method(new Uint8Array([2 << 2, 0x12, 0x34])).subscribe((): void => {
|
||||||
expect(provider.send).toHaveBeenCalledWith('test_blah', ['0x1234'], false);
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||||
done();
|
expect(provider.send).toHaveBeenCalledWith('test_blah', ['0x1234'], false);
|
||||||
|
resolve(true);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,4 +3,4 @@
|
|||||||
|
|
||||||
// Do not edit, auto-generated by @polkadot/dev
|
// Do not edit, auto-generated by @polkadot/dev
|
||||||
|
|
||||||
export const packageInfo = { name: '@polkadot/rpc-core', path: 'auto', type: 'auto', version: '9.13.6' };
|
export const packageInfo = { name: '@polkadot/rpc-core', path: 'auto', type: 'auto', version: '10.0.1' };
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
// Copyright 2017-2023 @polkadot/rpc-core authors & contributors
|
// Copyright 2017-2023 @polkadot/rpc-core authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// eslint-disable-next-line spaced-comment
|
||||||
|
/// <reference types="@polkadot/dev/node/test/node" />
|
||||||
|
|
||||||
import type { RpcInterface } from './types';
|
import type { RpcInterface } from './types';
|
||||||
|
|
||||||
import { MockProvider } from '@polkadot/rpc-provider/mock';
|
import { MockProvider } from '@polkadot/rpc-provider/mock';
|
||||||
@@ -22,17 +25,19 @@ describe('replay', (): void => {
|
|||||||
await provider.disconnect();
|
await provider.disconnect();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('returns the observable value', (done): void => {
|
it('returns the observable value', async (): Promise<void> => {
|
||||||
rpc.system.chain().subscribe((value: any): void => {
|
await new Promise<boolean>((resolve) => {
|
||||||
if (value) {
|
rpc.system.chain().subscribe((value: any): void => {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
|
if (value) {
|
||||||
expect(value.toString()).toEqual('mockChain'); // Defined in MockProvider
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
|
||||||
done();
|
expect(value.toString()).toEqual('mockChain'); // Defined in MockProvider
|
||||||
}
|
resolve(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('replay(1) works as expected', (done): void => {
|
it('replay(1) works as expected', async (): Promise<void> => {
|
||||||
const observable = rpc.system.chain();
|
const observable = rpc.system.chain();
|
||||||
let a: any | undefined;
|
let a: any | undefined;
|
||||||
|
|
||||||
@@ -40,28 +45,32 @@ describe('replay', (): void => {
|
|||||||
a = value;
|
a = value;
|
||||||
});
|
});
|
||||||
|
|
||||||
setTimeout((): void => {
|
await new Promise<boolean>((resolve) => {
|
||||||
// Subscribe again to the same observable, it should fire value immediately
|
setTimeout((): void => {
|
||||||
observable.subscribe((value: any): void => {
|
// Subscribe again to the same observable, it should fire value immediately
|
||||||
expect(value).toEqual(a);
|
observable.subscribe((value: any): void => {
|
||||||
done();
|
expect(value).toEqual(a);
|
||||||
});
|
resolve(true);
|
||||||
}, 1000);
|
});
|
||||||
|
}, 1000);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('unsubscribes as required', (done): void => {
|
it('unsubscribes as required', async (): Promise<void> => {
|
||||||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||||
rpc.provider.unsubscribe = jest.fn();
|
rpc.provider.unsubscribe = jest.fn();
|
||||||
|
|
||||||
const subscription = rpc.chain.subscribeNewHeads().subscribe((): void => {
|
await new Promise<boolean>((resolve) => {
|
||||||
subscription.unsubscribe();
|
const subscription = rpc.chain.subscribeNewHeads().subscribe((): void => {
|
||||||
|
subscription.unsubscribe();
|
||||||
|
|
||||||
// There's a promise inside .unsubscribe(), wait a bit (> 2s)
|
// There's a promise inside .unsubscribe(), wait a bit (> 2s)
|
||||||
setTimeout((): void => {
|
setTimeout((): void => {
|
||||||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||||
expect(rpc.provider.unsubscribe).toHaveBeenCalled();
|
expect(rpc.provider.unsubscribe).toHaveBeenCalled();
|
||||||
done();
|
resolve(true);
|
||||||
}, 3500);
|
}, 3500);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,47 +1,51 @@
|
|||||||
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
|
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import { jest } from '@jest/globals';
|
// eslint-disable-next-line spaced-comment
|
||||||
|
/// <reference types="@polkadot/dev/node/test/node" />
|
||||||
|
|
||||||
import { of, timer } from 'rxjs';
|
import { of, timer } from 'rxjs';
|
||||||
|
|
||||||
import { drr } from '.';
|
import { drr } from '.';
|
||||||
|
|
||||||
describe('drr', (): void => {
|
describe('drr', (): void => {
|
||||||
beforeEach((): void => {
|
it('should not fire twice the same value', async (): Promise<void> => {
|
||||||
jest.setTimeout(15000);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should not fire twice the same value', (done): void => {
|
|
||||||
let count = 0;
|
let count = 0;
|
||||||
|
|
||||||
const sub = of(1, 1).pipe(drr({ delay: 500 })).subscribe((): void => {
|
const sub = of(1, 1).pipe(drr({ delay: 500 })).subscribe((): void => {
|
||||||
++count;
|
++count;
|
||||||
});
|
});
|
||||||
|
|
||||||
setTimeout((): void => {
|
await new Promise<boolean>((resolve) => {
|
||||||
expect(count).toBe(1);
|
setTimeout((): void => {
|
||||||
sub.unsubscribe();
|
expect(count).toBe(1);
|
||||||
|
sub.unsubscribe();
|
||||||
|
|
||||||
setTimeout(done, 2000);
|
setTimeout(() => {
|
||||||
}, 50);
|
resolve(true);
|
||||||
|
}, 2000);
|
||||||
|
}, 50);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should be a ReplaySubject(1)', (done): void => {
|
it('should be a ReplaySubject(1)', async (): Promise<void> => {
|
||||||
const obs = timer(0, 100).pipe(drr({ delay: 500 })); // Starts at 0, increments every 100ms
|
const obs = timer(0, 100).pipe(drr({ delay: 500 })); // Starts at 0, increments every 100ms
|
||||||
|
|
||||||
const sub = obs.subscribe(); // Fire the observable
|
const sub = obs.subscribe(); // Fire the observable
|
||||||
|
|
||||||
// Subscribe another time after some time, i.e. after the observable has fired
|
await new Promise<boolean>((resolve) => {
|
||||||
setTimeout((): void => {
|
// Subscribe another time after some time, i.e. after the observable has fired
|
||||||
const sub = obs.subscribe((value): void => {
|
setTimeout((): void => {
|
||||||
expect(value > 1).toBe(true);
|
const sub = obs.subscribe((value): void => {
|
||||||
|
expect(value > 1).toBe(true);
|
||||||
|
|
||||||
setTimeout(done, 2000);
|
setTimeout(() => {
|
||||||
});
|
resolve(true);
|
||||||
|
}, 2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
sub.unsubscribe();
|
||||||
|
}, 500);
|
||||||
|
|
||||||
sub.unsubscribe();
|
sub.unsubscribe();
|
||||||
}, 500);
|
});
|
||||||
|
|
||||||
sub.unsubscribe();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -20,26 +20,26 @@
|
|||||||
"./detectPackage.cjs"
|
"./detectPackage.cjs"
|
||||||
],
|
],
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "9.13.6",
|
"version": "10.0.1",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.20.13",
|
"@polkadot/keyring": "^11.0.1",
|
||||||
"@polkadot/keyring": "^10.3.1",
|
"@polkadot/types": "10.0.1",
|
||||||
"@polkadot/types": "9.13.6",
|
"@polkadot/types-support": "10.0.1",
|
||||||
"@polkadot/types-support": "9.13.6",
|
"@polkadot/util": "^11.0.1",
|
||||||
"@polkadot/util": "^10.3.1",
|
"@polkadot/util-crypto": "^11.0.1",
|
||||||
"@polkadot/util-crypto": "^10.3.1",
|
"@polkadot/x-fetch": "^11.0.1",
|
||||||
"@polkadot/x-fetch": "^10.3.1",
|
"@polkadot/x-global": "^11.0.1",
|
||||||
"@polkadot/x-global": "^10.3.1",
|
"@polkadot/x-ws": "^11.0.1",
|
||||||
"@polkadot/x-ws": "^10.3.1",
|
|
||||||
"eventemitter3": "^5.0.0",
|
"eventemitter3": "^5.0.0",
|
||||||
"mock-socket": "^9.1.5",
|
"mock-socket": "^9.2.1",
|
||||||
"nock": "^13.3.0"
|
"nock": "^13.3.0",
|
||||||
|
"tslib": "^2.5.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@substrate/connect": "0.7.19"
|
"@substrate/connect": "0.7.20"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"@substrate/connect": "0.7.19"
|
"@substrate/connect": "0.7.20"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
|
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// eslint-disable-next-line spaced-comment
|
||||||
|
/// <reference types="@polkadot/dev/node/test/node" />
|
||||||
|
|
||||||
import type { JsonRpcResponse } from '../types';
|
import type { JsonRpcResponse } from '../types';
|
||||||
|
|
||||||
import { RpcCoder } from '.';
|
import { RpcCoder } from '.';
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
|
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// eslint-disable-next-line spaced-comment
|
||||||
|
/// <reference types="@polkadot/dev/node/test/node" />
|
||||||
|
|
||||||
import { RpcCoder } from '.';
|
import { RpcCoder } from '.';
|
||||||
|
|
||||||
describe('encodeJson', (): void => {
|
describe('encodeJson', (): void => {
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
|
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// eslint-disable-next-line spaced-comment
|
||||||
|
/// <reference types="@polkadot/dev/node/test/node" />
|
||||||
|
|
||||||
import { RpcCoder } from '.';
|
import { RpcCoder } from '.';
|
||||||
|
|
||||||
describe('encodeObject', (): void => {
|
describe('encodeObject', (): void => {
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
|
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// eslint-disable-next-line spaced-comment
|
||||||
|
/// <reference types="@polkadot/dev/node/test/node" />
|
||||||
|
|
||||||
import { isError } from '@polkadot/util/is/error';
|
import { isError } from '@polkadot/util/is/error';
|
||||||
|
|
||||||
import RpcError from './error';
|
import RpcError from './error';
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
|
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// eslint-disable-next-line spaced-comment
|
||||||
|
/// <reference types="@polkadot/dev/node/test/node" />
|
||||||
|
|
||||||
import { TEST_HTTP_URL } from '../mock/mockHttp';
|
import { TEST_HTTP_URL } from '../mock/mockHttp';
|
||||||
import { HttpProvider } from './';
|
import { HttpProvider } from './';
|
||||||
|
|
||||||
@@ -41,16 +44,16 @@ describe('Http', (): void => {
|
|||||||
expect(http.isConnected).toEqual(true);
|
expect(http.isConnected).toEqual(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('does not (yet) support subscribe', (): Promise<number | void> => {
|
it('does not (yet) support subscribe', async (): Promise<void> => {
|
||||||
return http.subscribe('', '', [], (cb): void => {
|
await http.subscribe('', '', [], (cb): void => {
|
||||||
expect(cb).toEqual(expect.anything());
|
expect(cb).toEqual(expect.anything());
|
||||||
}).catch((error): void => {
|
}).catch((error): void => {
|
||||||
expect((error as Error).message).toMatch(/does not have subscriptions/);
|
expect((error as Error).message).toMatch(/does not have subscriptions/);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('does not (yet) support unsubscribe', (): Promise<boolean | void> => {
|
it('does not (yet) support unsubscribe', async (): Promise<void> => {
|
||||||
return http.unsubscribe('', '', 0).catch((error): void => {
|
await http.unsubscribe('', '', 0).catch((error): void => {
|
||||||
expect((error as Error).message).toMatch(/does not have subscriptions/);
|
expect((error as Error).message).toMatch(/does not have subscriptions/);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
|
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// eslint-disable-next-line spaced-comment
|
||||||
|
/// <reference types="@polkadot/dev/node/test/node" />
|
||||||
|
|
||||||
import type { Mock } from '../mock/types';
|
import type { Mock } from '../mock/types';
|
||||||
|
|
||||||
import { mockHttp, TEST_HTTP_URL } from '../mock/mockHttp';
|
import { mockHttp, TEST_HTTP_URL } from '../mock/mockHttp';
|
||||||
@@ -16,9 +19,9 @@ describe.skip('send', (): void => {
|
|||||||
http = new HttpProvider(TEST_HTTP_URL);
|
http = new HttpProvider(TEST_HTTP_URL);
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach((): void => {
|
afterEach(async () => {
|
||||||
if (mock) {
|
if (mock) {
|
||||||
mock.done();
|
await mock.done();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
|
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// eslint-disable-next-line spaced-comment
|
||||||
|
/// <reference types="@polkadot/dev/node/test/node" />
|
||||||
|
|
||||||
import { LRUCache } from './lru';
|
import { LRUCache } from './lru';
|
||||||
|
|
||||||
describe('LRUCache', (): void => {
|
describe('LRUCache', (): void => {
|
||||||
|
|||||||
@@ -69,11 +69,7 @@ export function mockWs (requests: Request[], wsUrl: string = TEST_WS_URL): Scope
|
|||||||
let requestCount = 0;
|
let requestCount = 0;
|
||||||
const scope: Scope = {
|
const scope: Scope = {
|
||||||
body: {},
|
body: {},
|
||||||
done: (): void => {
|
done: () => new Promise<void>((resolve) => server.stop(resolve)),
|
||||||
server.stop((): void => {
|
|
||||||
// ignore
|
|
||||||
});
|
|
||||||
},
|
|
||||||
requests: 0,
|
requests: 0,
|
||||||
server
|
server
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
|
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// eslint-disable-next-line spaced-comment
|
||||||
|
/// <reference types="@polkadot/dev/node/test/node" />
|
||||||
|
|
||||||
import type { ProviderInterfaceEmitted } from '../types';
|
import type { ProviderInterfaceEmitted } from '../types';
|
||||||
|
|
||||||
import { TypeRegistry } from '@polkadot/types/create';
|
import { TypeRegistry } from '@polkadot/types/create';
|
||||||
@@ -19,20 +22,22 @@ describe('on', (): void => {
|
|||||||
await mock.disconnect();
|
await mock.disconnect();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('it emits both connected and disconnected events', (done): void => {
|
it('it emits both connected and disconnected events', async (): Promise<void> => {
|
||||||
const events: Record<string, boolean> = { connected: false, disconnected: false };
|
const events: Record<string, boolean> = { connected: false, disconnected: false };
|
||||||
|
|
||||||
const handler = (type: ProviderInterfaceEmitted): void => {
|
await new Promise<boolean>((resolve) => {
|
||||||
mock.on(type, (): void => {
|
const handler = (type: ProviderInterfaceEmitted): void => {
|
||||||
events[type] = true;
|
mock.on(type, (): void => {
|
||||||
|
events[type] = true;
|
||||||
|
|
||||||
if (Object.values(events).filter((value): boolean => value).length === 2) {
|
if (Object.values(events).filter((value): boolean => value).length === 2) {
|
||||||
done();
|
resolve(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
handler('connected');
|
handler('connected');
|
||||||
handler('disconnected');
|
handler('disconnected');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
|
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// eslint-disable-next-line spaced-comment
|
||||||
|
/// <reference types="@polkadot/dev/node/test/node" />
|
||||||
|
|
||||||
import { TypeRegistry } from '@polkadot/types/create';
|
import { TypeRegistry } from '@polkadot/types/create';
|
||||||
|
|
||||||
import { MockProvider } from '.';
|
import { MockProvider } from '.';
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
|
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// eslint-disable-next-line spaced-comment
|
||||||
|
/// <reference types="@polkadot/dev/node/test/node" />
|
||||||
|
|
||||||
import { TypeRegistry } from '@polkadot/types/create';
|
import { TypeRegistry } from '@polkadot/types/create';
|
||||||
|
|
||||||
import { MockProvider } from './';
|
import { MockProvider } from './';
|
||||||
@@ -17,53 +20,59 @@ describe('subscribe', (): void => {
|
|||||||
await mock.disconnect();
|
await mock.disconnect();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('fails on unknown methods', (): Promise<number | void> => {
|
it('fails on unknown methods', async (): Promise<void> => {
|
||||||
return mock
|
await mock
|
||||||
.subscribe('test', 'test_notFound')
|
.subscribe('test', 'test_notFound')
|
||||||
.catch((error): void => {
|
.catch((error): void => {
|
||||||
expect((error as Error).message).toMatch(/Invalid method 'test_notFound'/);
|
expect((error as Error).message).toMatch(/Invalid method 'test_notFound'/);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('returns a subscription id', (): Promise<void> => {
|
it('returns a subscription id', async (): Promise<void> => {
|
||||||
return mock
|
await mock
|
||||||
.subscribe('chain_newHead', 'chain_subscribeNewHead', (): void => undefined)
|
.subscribe('chain_newHead', 'chain_subscribeNewHead', (): void => undefined)
|
||||||
.then((id): void => {
|
.then((id): void => {
|
||||||
expect(id).toEqual(1);
|
expect(id).toEqual(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('calls back with the last known value', (done): void => {
|
it('calls back with the last known value', async (): Promise<void> => {
|
||||||
mock.isUpdating = false;
|
mock.isUpdating = false;
|
||||||
mock.subscriptions.chain_subscribeNewHead.lastValue = 'testValue';
|
mock.subscriptions.chain_subscribeNewHead.lastValue = 'testValue';
|
||||||
|
|
||||||
mock.subscribe('chain_newHead', 'chain_subscribeNewHead', (_: any, value: string): void => {
|
await new Promise<boolean>((resolve) => {
|
||||||
expect(value).toEqual('testValue');
|
mock.subscribe('chain_newHead', 'chain_subscribeNewHead', (_: any, value: string): void => {
|
||||||
done();
|
expect(value).toEqual('testValue');
|
||||||
}).catch(console.error);
|
resolve(true);
|
||||||
|
}).catch(console.error);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('calls back with new headers', (done): void => {
|
it('calls back with new headers', async (): Promise<void> => {
|
||||||
mock.subscribe('chain_newHead', 'chain_subscribeNewHead', (_: any, header: { number: number }): void => {
|
await new Promise<boolean>((resolve) => {
|
||||||
if (header.number === 4) {
|
mock.subscribe('chain_newHead', 'chain_subscribeNewHead', (_: any, header: { number: number }): void => {
|
||||||
done();
|
if (header.number === 4) {
|
||||||
}
|
resolve(true);
|
||||||
}).catch(console.error);
|
}
|
||||||
|
}).catch(console.error);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('handles errors withing callbacks gracefully', (done): void => {
|
it('handles errors within callbacks gracefully', async (): Promise<void> => {
|
||||||
let hasThrown = false;
|
let hasThrown = false;
|
||||||
|
|
||||||
mock.subscribe('chain_newHead', 'chain_subscribeNewHead', (_: any, header: { number: number }): void => {
|
await new Promise<boolean>((resolve) => {
|
||||||
if (!hasThrown) {
|
mock.subscribe('chain_newHead', 'chain_subscribeNewHead', (_: any, header: { number: number }): void => {
|
||||||
hasThrown = true;
|
if (!hasThrown) {
|
||||||
|
hasThrown = true;
|
||||||
|
|
||||||
throw new Error('testing');
|
throw new Error('testing');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (header.number === 3) {
|
if (header.number === 3) {
|
||||||
done();
|
resolve(true);
|
||||||
}
|
}
|
||||||
}).catch(console.error);
|
}).catch(console.error);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -2,11 +2,9 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type { Server } from 'mock-socket';
|
import type { Server } from 'mock-socket';
|
||||||
import type { Constructor } from '@polkadot/types/types';
|
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
export type Global = typeof globalThis & {
|
||||||
export interface Global extends NodeJS.Global {
|
WebSocket: typeof WebSocket;
|
||||||
WebSocket: Constructor<WebSocket>;
|
|
||||||
fetch: any;
|
fetch: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -14,7 +12,7 @@ export interface Mock {
|
|||||||
body: Record<string, Record<string, unknown>>;
|
body: Record<string, Record<string, unknown>>;
|
||||||
requests: number;
|
requests: number;
|
||||||
server: Server;
|
server: Server;
|
||||||
done: () => Record<string, unknown>;
|
done: () => Promise<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type MockStateSubscriptionCallback = (error: Error | null, value: any) => void;
|
export type MockStateSubscriptionCallback = (error: Error | null, value: any) => void;
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
|
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// eslint-disable-next-line spaced-comment
|
||||||
|
/// <reference types="@polkadot/dev/node/test/node" />
|
||||||
|
|
||||||
import { TypeRegistry } from '@polkadot/types/create';
|
import { TypeRegistry } from '@polkadot/types/create';
|
||||||
|
|
||||||
import { MockProvider } from '.';
|
import { MockProvider } from '.';
|
||||||
@@ -24,8 +27,8 @@ describe('unsubscribe', (): void => {
|
|||||||
await mock.disconnect();
|
await mock.disconnect();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('fails on unknown ids', (): Promise<boolean> => {
|
it('fails on unknown ids', async (): Promise<void> => {
|
||||||
return mock
|
await mock
|
||||||
.unsubscribe('chain_newHead', 'chain_subscribeNewHead', 5)
|
.unsubscribe('chain_newHead', 'chain_subscribeNewHead', 5)
|
||||||
.catch((error): boolean => {
|
.catch((error): boolean => {
|
||||||
expect((error as Error).message).toMatch(/Unable to find/);
|
expect((error as Error).message).toMatch(/Unable to find/);
|
||||||
@@ -34,12 +37,12 @@ describe('unsubscribe', (): void => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('unsubscribes successfully', (): Promise<boolean> => {
|
it('unsubscribes successfully', async (): Promise<void> => {
|
||||||
return mock.unsubscribe('chain_newHead', 'chain_subscribeNewHead', id);
|
await mock.unsubscribe('chain_newHead', 'chain_subscribeNewHead', id);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('fails on double unsubscribe', (): Promise<boolean> => {
|
it('fails on double unsubscribe', async (): Promise<void> => {
|
||||||
return mock.unsubscribe('chain_newHead', 'chain_subscribeNewHead', id)
|
await mock.unsubscribe('chain_newHead', 'chain_subscribeNewHead', id)
|
||||||
.then((): Promise<boolean> =>
|
.then((): Promise<boolean> =>
|
||||||
mock.unsubscribe('chain_newHead', 'chain_subscribeNewHead', id)
|
mock.unsubscribe('chain_newHead', 'chain_subscribeNewHead', id)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -3,4 +3,4 @@
|
|||||||
|
|
||||||
// Do not edit, auto-generated by @polkadot/dev
|
// Do not edit, auto-generated by @polkadot/dev
|
||||||
|
|
||||||
export const packageInfo = { name: '@polkadot/rpc-provider', path: 'auto', type: 'auto', version: '9.13.6' };
|
export const packageInfo = { name: '@polkadot/rpc-provider', path: 'auto', type: 'auto', version: '10.0.1' };
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
|
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// eslint-disable-next-line spaced-comment
|
||||||
|
/// <reference types="@polkadot/dev/node/test/node" />
|
||||||
|
|
||||||
/* eslint-disable sort-keys */
|
/* eslint-disable sort-keys */
|
||||||
/* eslint-disable promise/param-names */
|
/* eslint-disable promise/param-names */
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||||
@@ -21,18 +24,33 @@
|
|||||||
import type Sc from '@substrate/connect';
|
import type Sc from '@substrate/connect';
|
||||||
import type { HealthChecker, SmoldotHealth } from './types';
|
import type { HealthChecker, SmoldotHealth } from './types';
|
||||||
|
|
||||||
import { jest } from '@jest/globals';
|
|
||||||
|
|
||||||
import { ScProvider } from '.';
|
import { ScProvider } from '.';
|
||||||
|
|
||||||
const wait = (ms: number) => new Promise((res) => setTimeout(res, ms));
|
type MockChain = Sc.Chain & {
|
||||||
|
_spec: () => string
|
||||||
|
_recevedRequests: () => string[]
|
||||||
|
_isTerminated: () => boolean
|
||||||
|
_triggerCallback: (response: string | {}) => void
|
||||||
|
_setTerminateInterceptor: (fn: () => void) => void
|
||||||
|
_setSendJsonRpcInterceptor: (fn: (rpc: string) => void) => void
|
||||||
|
_getLatestRequest: () => string
|
||||||
|
}
|
||||||
|
|
||||||
type MockedHealthChecker = HealthChecker & {
|
type MockedHealthChecker = HealthChecker & {
|
||||||
_isActive: () => boolean
|
_isActive: () => boolean
|
||||||
_triggerHealthUpdate: (update: SmoldotHealth) => void
|
_triggerHealthUpdate: (update: SmoldotHealth) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
const healthCheckerMock = (): MockedHealthChecker => {
|
enum WellKnownChain {
|
||||||
|
polkadot = 'polkadot',
|
||||||
|
ksmcc3 = 'ksmcc3',
|
||||||
|
rococo_v2_2 = 'rococo_v2_2',
|
||||||
|
westend2 = 'westend2'
|
||||||
|
}
|
||||||
|
|
||||||
|
const wait = (ms: number) => new Promise((res) => setTimeout(res, ms));
|
||||||
|
|
||||||
|
function healthCheckerMock (): MockedHealthChecker {
|
||||||
let cb: (health: SmoldotHealth) => void = () => {};
|
let cb: (health: SmoldotHealth) => void = () => {};
|
||||||
|
|
||||||
let sendJsonRpc: (request: string) => void = () => {};
|
let sendJsonRpc: (request: string) => void = () => {};
|
||||||
@@ -57,9 +75,9 @@ const healthCheckerMock = (): MockedHealthChecker => {
|
|||||||
cb(update);
|
cb(update);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
|
||||||
const healthCheckerFactory = () => {
|
function healthCheckerFactory () {
|
||||||
const _healthCheckers: MockedHealthChecker[] = [];
|
const _healthCheckers: MockedHealthChecker[] = [];
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -73,21 +91,9 @@ const healthCheckerFactory = () => {
|
|||||||
_healthCheckers,
|
_healthCheckers,
|
||||||
_latestHealthChecker: () => _healthCheckers.slice(-1)[0]
|
_latestHealthChecker: () => _healthCheckers.slice(-1)[0]
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
jest.mock('./Health', () => healthCheckerFactory());
|
|
||||||
|
|
||||||
type MockChain = Sc.Chain & {
|
|
||||||
_spec: () => string
|
|
||||||
_recevedRequests: () => string[]
|
|
||||||
_isTerminated: () => boolean
|
|
||||||
_triggerCallback: (response: string | {}) => void
|
|
||||||
_setTerminateInterceptor: (fn: () => void) => void
|
|
||||||
_setSendJsonRpcInterceptor: (fn: (rpc: string) => void) => void
|
|
||||||
_getLatestRequest: () => string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const getFakeChain = (spec: string, callback: Sc.JsonRpcCallback): MockChain => {
|
function getFakeChain (spec: string, callback: Sc.JsonRpcCallback): MockChain {
|
||||||
const _receivedRequests: string[] = [];
|
const _receivedRequests: string[] = [];
|
||||||
let _isTerminated = false;
|
let _isTerminated = false;
|
||||||
|
|
||||||
@@ -119,9 +125,9 @@ const getFakeChain = (spec: string, callback: Sc.JsonRpcCallback): MockChain =>
|
|||||||
},
|
},
|
||||||
_getLatestRequest: () => _receivedRequests[_receivedRequests.length - 1]
|
_getLatestRequest: () => _receivedRequests[_receivedRequests.length - 1]
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
|
||||||
const getFakeClient = () => {
|
function getFakeClient () {
|
||||||
const chains: MockChain[] = [];
|
const chains: MockChain[] = [];
|
||||||
let addChainInterceptor: Promise<void> = Promise.resolve();
|
let addChainInterceptor: Promise<void> = Promise.resolve();
|
||||||
let addWellKnownChainInterceptor: Promise<void> = Promise.resolve();
|
let addWellKnownChainInterceptor: Promise<void> = Promise.resolve();
|
||||||
@@ -154,16 +160,9 @@ const getFakeClient = () => {
|
|||||||
return result;
|
return result;
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
enum WellKnownChain {
|
|
||||||
polkadot = 'polkadot',
|
|
||||||
ksmcc3 = 'ksmcc3',
|
|
||||||
rococo_v2_2 = 'rococo_v2_2',
|
|
||||||
westend2 = 'westend2'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const connectorFactory = () => {
|
function connectorFactory () {
|
||||||
const clients: ReturnType<typeof getFakeClient>[] = [];
|
const clients: ReturnType<typeof getFakeClient>[] = [];
|
||||||
const latestClient = () => clients[clients.length - 1];
|
const latestClient = () => clients[clients.length - 1];
|
||||||
|
|
||||||
@@ -181,26 +180,26 @@ const connectorFactory = () => {
|
|||||||
latestChain: () =>
|
latestChain: () =>
|
||||||
latestClient()._chains()[latestClient()._chains().length - 1]
|
latestClient()._chains()[latestClient()._chains().length - 1]
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
|
||||||
let mockSc: typeof Sc & { latestChain: () => MockChain };
|
function setChainSyncyingStatus (isSyncing: boolean) {
|
||||||
let mockedHealthChecker: ReturnType<typeof healthCheckerFactory>;
|
|
||||||
const getCurrentHealthChecker = () => mockedHealthChecker._latestHealthChecker();
|
|
||||||
|
|
||||||
const setChainSyncyingStatus = (isSyncing: boolean) => {
|
|
||||||
getCurrentHealthChecker()._triggerHealthUpdate({
|
getCurrentHealthChecker()._triggerHealthUpdate({
|
||||||
isSyncing,
|
isSyncing,
|
||||||
peers: 1,
|
peers: 1,
|
||||||
shouldHavePeers: true
|
shouldHavePeers: true
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
beforeAll(() => {
|
let mockSc: typeof Sc & { latestChain: () => MockChain };
|
||||||
mockSc = connectorFactory() as unknown as typeof Sc & { latestChain: () => MockChain };
|
let mockedHealthChecker: ReturnType<typeof healthCheckerFactory>;
|
||||||
mockedHealthChecker = healthCheckerFactory();
|
const getCurrentHealthChecker = () => mockedHealthChecker._latestHealthChecker();
|
||||||
});
|
|
||||||
|
|
||||||
describe('ScProvider', () => {
|
describe('ScProvider', () => {
|
||||||
|
beforeAll(() => {
|
||||||
|
mockSc = connectorFactory() as unknown as typeof Sc & { latestChain: () => MockChain };
|
||||||
|
mockedHealthChecker = healthCheckerFactory();
|
||||||
|
});
|
||||||
|
|
||||||
describe('on', () => {
|
describe('on', () => {
|
||||||
it('emits `connected` as soon as the chain is not syncing', async () => {
|
it('emits `connected` as soon as the chain is not syncing', async () => {
|
||||||
const provider = new ScProvider(mockSc, '');
|
const provider = new ScProvider(mockSc, '');
|
||||||
@@ -251,16 +250,15 @@ describe('ScProvider', () => {
|
|||||||
setChainSyncyingStatus(false);
|
setChainSyncyingStatus(false);
|
||||||
|
|
||||||
const onConnected = jest.fn();
|
const onConnected = jest.fn();
|
||||||
|
|
||||||
provider.on('connected', onConnected);
|
|
||||||
const onDisconnected = jest.fn();
|
const onDisconnected = jest.fn();
|
||||||
|
|
||||||
|
provider.on('connected', onConnected);
|
||||||
provider.on('disconnected', onDisconnected);
|
provider.on('disconnected', onDisconnected);
|
||||||
|
|
||||||
expect(onConnected).toHaveBeenCalled();
|
expect(onConnected).toHaveBeenCalled();
|
||||||
expect(onDisconnected).not.toHaveBeenCalled();
|
expect(onDisconnected).not.toHaveBeenCalled();
|
||||||
|
|
||||||
onConnected.mockRestore();
|
onConnected.mockReset();
|
||||||
setChainSyncyingStatus(true);
|
setChainSyncyingStatus(true);
|
||||||
|
|
||||||
expect(onConnected).not.toHaveBeenCalled();
|
expect(onConnected).not.toHaveBeenCalled();
|
||||||
@@ -284,7 +282,7 @@ describe('ScProvider', () => {
|
|||||||
|
|
||||||
await provider.connect(undefined, mockedHealthChecker.healthChecker);
|
await provider.connect(undefined, mockedHealthChecker.healthChecker);
|
||||||
|
|
||||||
expect(() => provider.clone()).toThrowError();
|
expect(() => provider.clone()).toThrow();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -306,9 +304,9 @@ describe('ScProvider', () => {
|
|||||||
|
|
||||||
setChainSyncyingStatus(false);
|
setChainSyncyingStatus(false);
|
||||||
|
|
||||||
await expect(provider.connect(undefined, mockedHealthChecker.healthChecker)).rejects.toThrowError(
|
await expect(
|
||||||
'Already connected!'
|
provider.connect(undefined, mockedHealthChecker.healthChecker)
|
||||||
);
|
).rejects.toThrow(/Already connected/);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -328,9 +326,8 @@ describe('ScProvider', () => {
|
|||||||
const provider = new ScProvider(mockSc, '');
|
const provider = new ScProvider(mockSc, '');
|
||||||
|
|
||||||
await provider.connect(undefined, mockedHealthChecker.healthChecker);
|
await provider.connect(undefined, mockedHealthChecker.healthChecker);
|
||||||
|
|
||||||
await provider.disconnect();
|
await provider.disconnect();
|
||||||
await expect(provider.disconnect()).resolves.not.toThrow();
|
await provider.disconnect();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -402,9 +399,9 @@ describe('ScProvider', () => {
|
|||||||
throw new Error('boom!');
|
throw new Error('boom!');
|
||||||
});
|
});
|
||||||
|
|
||||||
await expect(provider.send('getData', ['foo'])).rejects.toThrowError(
|
await expect(
|
||||||
'Disconnected'
|
provider.send('getData', ['foo'])
|
||||||
);
|
).rejects.toThrow(/Disconnected/);
|
||||||
expect(provider.isConnected).toBe(false);
|
expect(provider.isConnected).toBe(false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -551,8 +548,7 @@ describe('ScProvider', () => {
|
|||||||
|
|
||||||
expect(token).toBe(unsubscribeToken);
|
expect(token).toBe(unsubscribeToken);
|
||||||
expect(cb).toHaveBeenCalledTimes(1);
|
expect(cb).toHaveBeenCalledTimes(1);
|
||||||
expect(cb.mock.lastCall![0]).toBeInstanceOf(Error);
|
expect(cb).toHaveBeenLastCalledWith(expect.any(Error), undefined);
|
||||||
expect(cb.mock.lastCall![1]).toBe(undefined);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('errors when subscribing to an unsupported method', async () => {
|
it('errors when subscribing to an unsupported method', async () => {
|
||||||
@@ -561,11 +557,11 @@ describe('ScProvider', () => {
|
|||||||
await provider.connect(undefined, mockedHealthChecker.healthChecker);
|
await provider.connect(undefined, mockedHealthChecker.healthChecker);
|
||||||
|
|
||||||
setChainSyncyingStatus(false);
|
setChainSyncyingStatus(false);
|
||||||
await wait(0);
|
|
||||||
|
|
||||||
|
await wait(0);
|
||||||
await expect(
|
await expect(
|
||||||
provider.subscribe('foo', 'bar', ['baz'], () => {})
|
provider.subscribe('foo', 'bar', ['baz'], () => {})
|
||||||
).rejects.toThrowError('Unsupported subscribe method: bar');
|
).rejects.toThrow(/Unsupported subscribe method: bar/);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -577,9 +573,9 @@ describe('ScProvider', () => {
|
|||||||
|
|
||||||
setChainSyncyingStatus(false);
|
setChainSyncyingStatus(false);
|
||||||
|
|
||||||
await expect(provider.unsubscribe('', '', '')).rejects.toThrowError(
|
await expect(
|
||||||
'Unable to find active subscription=::'
|
provider.unsubscribe('', '', '')
|
||||||
);
|
).rejects.toThrow(/Unable to find active subscription/);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -67,18 +67,20 @@ export interface ProviderInterface {
|
|||||||
unsubscribe (type: string, method: string, id: number | string): Promise<boolean>;
|
unsubscribe (type: string, method: string, id: number | string): Promise<boolean>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface EndpointStats {
|
||||||
|
bytesRecv: number;
|
||||||
|
bytesSent: number;
|
||||||
|
cached: number;
|
||||||
|
errors: number;
|
||||||
|
requests: number;
|
||||||
|
subscriptions: number;
|
||||||
|
timeout: number;
|
||||||
|
}
|
||||||
|
|
||||||
export interface ProviderStats {
|
export interface ProviderStats {
|
||||||
active: {
|
active: {
|
||||||
requests: number;
|
requests: number;
|
||||||
subscriptions: number;
|
subscriptions: number;
|
||||||
};
|
};
|
||||||
total: {
|
total: EndpointStats;
|
||||||
bytesRecv: number;
|
|
||||||
bytesSent: number;
|
|
||||||
cached: number;
|
|
||||||
errors: number;
|
|
||||||
requests: number;
|
|
||||||
subscriptions: number;
|
|
||||||
timeout: number;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,99 +1,109 @@
|
|||||||
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
|
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type { Mock } from '../mock/types';
|
// eslint-disable-next-line spaced-comment
|
||||||
|
/// <reference types="@polkadot/dev/node/test/node" />
|
||||||
|
|
||||||
import { jest } from '@jest/globals';
|
import type { Mock } from '../mock/types';
|
||||||
|
|
||||||
import { mockWs } from '../mock/mockWs';
|
import { mockWs } from '../mock/mockWs';
|
||||||
import { WsProvider } from './';
|
import { WsProvider } from './';
|
||||||
|
|
||||||
const TEST_WS_URL = 'ws://localhost-connect.spec.ts:9988';
|
const TEST_WS_URL = 'ws://localhost-connect.spec.ts:9988';
|
||||||
|
|
||||||
function sleepMs (ms = 0): Promise<void> {
|
function sleep (ms = 100): Promise<void> {
|
||||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('onConnect', (): void => {
|
describe('onConnect', (): void => {
|
||||||
let mocks: Mock[];
|
let mocks: Mock[];
|
||||||
|
let provider: WsProvider | null;
|
||||||
|
|
||||||
beforeEach((): void => {
|
beforeEach((): void => {
|
||||||
jest.setTimeout(30000);
|
|
||||||
mocks = [mockWs([], TEST_WS_URL)];
|
mocks = [mockWs([], TEST_WS_URL)];
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach((): void => {
|
afterEach(async () => {
|
||||||
jest.setTimeout(5000);
|
if (provider) {
|
||||||
mocks.forEach((m) => {
|
await provider.disconnect();
|
||||||
if (m) {
|
await sleep();
|
||||||
m.done();
|
|
||||||
}
|
provider = null;
|
||||||
});
|
}
|
||||||
|
|
||||||
|
await Promise.all(mocks.map((m) => m.done()));
|
||||||
|
await sleep();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Does not connect when autoConnect is false', async () => {
|
it('Does not connect when autoConnect is false', async () => {
|
||||||
const provider: WsProvider = new WsProvider(TEST_WS_URL, 0);
|
provider = new WsProvider(TEST_WS_URL, 0);
|
||||||
|
|
||||||
|
await sleep();
|
||||||
|
|
||||||
await sleepMs(100); // Hack to give the provider time to connect
|
|
||||||
expect(provider.isConnected).toBe(false);
|
expect(provider.isConnected).toBe(false);
|
||||||
|
|
||||||
await provider.connect();
|
await provider.connect();
|
||||||
await sleepMs(100); // Hack to give the provider time to connect
|
await sleep();
|
||||||
|
|
||||||
expect(provider.isConnected).toBe(true);
|
expect(provider.isConnected).toBe(true);
|
||||||
|
|
||||||
await provider.disconnect();
|
await provider.disconnect();
|
||||||
|
await sleep();
|
||||||
|
|
||||||
await sleepMs(100); // Hack to give the provider time to connect
|
|
||||||
expect(provider.isConnected).toBe(false);
|
expect(provider.isConnected).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Does connect when autoConnect is true', async () => {
|
it('Does connect when autoConnect is true', async () => {
|
||||||
const provider: WsProvider = new WsProvider(TEST_WS_URL, 1);
|
provider = new WsProvider(TEST_WS_URL, 1);
|
||||||
|
|
||||||
|
await sleep();
|
||||||
|
|
||||||
await sleepMs(100); // Hack to give the provider time to connect
|
|
||||||
expect(provider.isConnected).toBe(true);
|
expect(provider.isConnected).toBe(true);
|
||||||
|
|
||||||
await provider.disconnect();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Creates a new WebSocket instance by calling the connect() method', async () => {
|
it('Creates a new WebSocket instance by calling the connect() method', async () => {
|
||||||
const provider: WsProvider = new WsProvider(TEST_WS_URL, false);
|
provider = new WsProvider(TEST_WS_URL, false);
|
||||||
|
|
||||||
expect(provider.isConnected).toBe(false);
|
expect(provider.isConnected).toBe(false);
|
||||||
expect(mocks[0].server.clients().length).toBe(0);
|
expect(mocks[0].server.clients().length).toBe(0);
|
||||||
|
|
||||||
await provider.connect();
|
await provider.connect();
|
||||||
await sleepMs(100); // Hack to give the provider time to connect
|
await sleep();
|
||||||
|
|
||||||
expect(provider.isConnected).toBe(true);
|
expect(provider.isConnected).toBe(true);
|
||||||
expect(mocks[0].server.clients()).toHaveLength(1);
|
expect(mocks[0].server.clients()).toHaveLength(1);
|
||||||
|
|
||||||
await provider.disconnect();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Connects to first endpoint when an array is given', async () => {
|
it('Connects to first endpoint when an array is given', async () => {
|
||||||
const provider: WsProvider = new WsProvider([TEST_WS_URL], 1);
|
provider = new WsProvider([TEST_WS_URL], 1);
|
||||||
|
|
||||||
await provider.connect();
|
await sleep();
|
||||||
await sleepMs(100); // Hack to give the provider time to connect
|
|
||||||
|
expect(provider.isConnected).toBe(true);
|
||||||
|
expect(mocks[0].server.clients()).toHaveLength(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Does not allow connect() on already-connected', async () => {
|
||||||
|
provider = new WsProvider([TEST_WS_URL], 1);
|
||||||
|
|
||||||
|
await sleep();
|
||||||
|
|
||||||
expect(provider.isConnected).toBe(true);
|
expect(provider.isConnected).toBe(true);
|
||||||
|
|
||||||
await provider.disconnect();
|
await expect(
|
||||||
|
provider.connect()
|
||||||
|
).rejects.toThrow(/already connected/);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Connects to the second endpoint when the first is unreachable', async () => {
|
it('Connects to the second endpoint when the first is unreachable', async () => {
|
||||||
/* eslint-disable @typescript-eslint/no-empty-function */
|
const endpoints: string[] = ['ws://localhost-unreachable-connect.spec.ts:9956', TEST_WS_URL];
|
||||||
jest.spyOn(console, 'error').mockImplementation((): void => {});
|
|
||||||
|
|
||||||
const endpoints: string[] = ['ws://localhost-connect.spec.ts:9956', TEST_WS_URL];
|
provider = new WsProvider(endpoints, 1);
|
||||||
const provider: WsProvider = new WsProvider(endpoints, 1);
|
|
||||||
|
|
||||||
await sleepMs(100); // Hack to give the provider time to connect
|
await sleep();
|
||||||
|
|
||||||
|
expect(mocks[0].server.clients()).toHaveLength(1);
|
||||||
expect(provider.isConnected).toBe(true);
|
expect(provider.isConnected).toBe(true);
|
||||||
|
|
||||||
await provider.disconnect();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Connects to the second endpoint when the first is dropped', async () => {
|
it('Connects to the second endpoint when the first is dropped', async () => {
|
||||||
@@ -101,22 +111,22 @@ describe('onConnect', (): void => {
|
|||||||
|
|
||||||
mocks.push(mockWs([], endpoints[1]));
|
mocks.push(mockWs([], endpoints[1]));
|
||||||
|
|
||||||
const provider: WsProvider = new WsProvider(endpoints, 1);
|
provider = new WsProvider(endpoints, 1);
|
||||||
|
|
||||||
|
await sleep();
|
||||||
|
|
||||||
await sleepMs(100); // Hack to give the provider time to connect
|
|
||||||
// Check that first server is connected
|
// Check that first server is connected
|
||||||
expect(mocks[0].server.clients()).toHaveLength(1);
|
expect(mocks[0].server.clients()).toHaveLength(1);
|
||||||
expect(mocks[1].server.clients()).toHaveLength(0);
|
expect(mocks[1].server.clients()).toHaveLength(0);
|
||||||
|
|
||||||
// Close connection from first server
|
// Close connection from first server
|
||||||
mocks[0].server.clients()[0].close();
|
mocks[0].server.clients()[0].close();
|
||||||
await sleepMs(100);
|
|
||||||
|
await sleep();
|
||||||
|
|
||||||
// Check that second server is connected
|
// Check that second server is connected
|
||||||
expect(mocks[1].server.clients()).toHaveLength(1);
|
expect(mocks[1].server.clients()).toHaveLength(1);
|
||||||
expect(provider.isConnected).toBe(true);
|
expect(provider.isConnected).toBe(true);
|
||||||
|
|
||||||
await provider.disconnect();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Round-robin of endpoints on WsProvider', async () => {
|
it('Round-robin of endpoints on WsProvider', async () => {
|
||||||
@@ -138,22 +148,21 @@ describe('onConnect', (): void => {
|
|||||||
mocks[3],
|
mocks[3],
|
||||||
mocks[0]
|
mocks[0]
|
||||||
];
|
];
|
||||||
const provider: WsProvider = new WsProvider(endpoints, 1);
|
|
||||||
|
|
||||||
for (let round = 0; round < 5; round++) {
|
provider = new WsProvider(endpoints, 1);
|
||||||
|
|
||||||
|
for (let round = 0; round < 2; round++) {
|
||||||
for (let mock = 0; mock < mocks.length; mock++) {
|
for (let mock = 0; mock < mocks.length; mock++) {
|
||||||
await sleepMs(100); // Hack to give the provider time to connect
|
await sleep();
|
||||||
|
|
||||||
// Check that first server is connected and the next one isn't
|
// Wwe are connected, the current mock has the connection and the next doesn't
|
||||||
|
expect(provider.isConnected).toBe(true);
|
||||||
expect(mocks[mock].server.clients()).toHaveLength(1);
|
expect(mocks[mock].server.clients()).toHaveLength(1);
|
||||||
expect(mockNext[mock].server.clients()).toHaveLength(0);
|
expect(mockNext[mock].server.clients()).toHaveLength(0);
|
||||||
expect(provider.isConnected).toBe(true);
|
|
||||||
|
|
||||||
// Close connection from first server
|
// Close connection from first server
|
||||||
mocks[mock].server.clients()[0].close();
|
mocks[mock].server.clients()[0].close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await provider.disconnect();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -22,22 +22,20 @@ const known: Record<number, string> = {
|
|||||||
1015: 'TLS Handshake'
|
1015: 'TLS Handshake'
|
||||||
};
|
};
|
||||||
|
|
||||||
function getUnmapped (code: number): string | void {
|
|
||||||
if (code <= 1999) {
|
|
||||||
return '(For WebSocket standard)';
|
|
||||||
} else if (code <= 2999) {
|
|
||||||
return '(For WebSocket extensions)';
|
|
||||||
} else if (code <= 3999) {
|
|
||||||
return '(For libraries and frameworks)';
|
|
||||||
} else if (code <= 4999) {
|
|
||||||
return '(For applications)';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getWSErrorString (code: number): string {
|
export function getWSErrorString (code: number): string {
|
||||||
if (code >= 0 && code <= 999) {
|
if (code >= 0 && code <= 999) {
|
||||||
return '(Unused)';
|
return '(Unused)';
|
||||||
|
} else if (code >= 1016) {
|
||||||
|
if (code <= 1999) {
|
||||||
|
return '(For WebSocket standard)';
|
||||||
|
} else if (code <= 2999) {
|
||||||
|
return '(For WebSocket extensions)';
|
||||||
|
} else if (code <= 3999) {
|
||||||
|
return '(For libraries and frameworks)';
|
||||||
|
} else if (code <= 4999) {
|
||||||
|
return '(For applications)';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return known[code] || getUnmapped(code) || '(Unknown)';
|
return known[code] || '(Unknown)';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
|
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// eslint-disable-next-line spaced-comment
|
||||||
|
/// <reference types="@polkadot/dev/node/test/node" />
|
||||||
|
|
||||||
import type { Request } from '../mock/mockWs';
|
import type { Request } from '../mock/mockWs';
|
||||||
|
|
||||||
import { mockWs } from '../mock/mockWs';
|
import { mockWs } from '../mock/mockWs';
|
||||||
@@ -22,7 +25,7 @@ function createWs (requests: Request[], autoConnect = 1000, headers?: Record<str
|
|||||||
describe('Ws', (): void => {
|
describe('Ws', (): void => {
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
if (mock) {
|
if (mock) {
|
||||||
mock.done();
|
await mock.done();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (provider) {
|
if (provider) {
|
||||||
@@ -58,7 +61,7 @@ describe('Endpoint Parsing', (): void => {
|
|||||||
it('Throws when WsProvider endpoint is an invalid string', () => {
|
it('Throws when WsProvider endpoint is an invalid string', () => {
|
||||||
expect(
|
expect(
|
||||||
() => new WsProvider('http://127.0.0.1:9955', 0)
|
() => new WsProvider('http://127.0.0.1:9955', 0)
|
||||||
).toThrowError(/^Endpoint should start with /);
|
).toThrow(/^Endpoint should start with /);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Succeeds when WsProvider endpoint is a valid array', () => {
|
it('Succeeds when WsProvider endpoint is a valid array', () => {
|
||||||
@@ -73,7 +76,7 @@ describe('Endpoint Parsing', (): void => {
|
|||||||
|
|
||||||
expect(
|
expect(
|
||||||
() => new WsProvider(endpoints, 0)
|
() => new WsProvider(endpoints, 0)
|
||||||
).toThrowError('WsProvider requires at least one Endpoint');
|
).toThrow('WsProvider requires at least one Endpoint');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Throws when WsProvider endpoint is an invalid array', () => {
|
it('Throws when WsProvider endpoint is an invalid array', () => {
|
||||||
@@ -81,6 +84,6 @@ describe('Endpoint Parsing', (): void => {
|
|||||||
|
|
||||||
expect(
|
expect(
|
||||||
() => new WsProvider(endpoints, 0)
|
() => new WsProvider(endpoints, 0)
|
||||||
).toThrowError(/^Endpoint should start with /);
|
).toThrow(/^Endpoint should start with /);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
/* eslint-disable camelcase */
|
/* eslint-disable camelcase */
|
||||||
|
|
||||||
import type { JsonRpcResponse, ProviderInterface, ProviderInterfaceCallback, ProviderInterfaceEmitCb, ProviderInterfaceEmitted, ProviderStats } from '../types';
|
import type { EndpointStats, JsonRpcResponse, ProviderInterface, ProviderInterfaceCallback, ProviderInterfaceEmitCb, ProviderInterfaceEmitted, ProviderStats } from '../types';
|
||||||
|
|
||||||
import EventEmitter from 'eventemitter3';
|
import EventEmitter from 'eventemitter3';
|
||||||
|
|
||||||
@@ -45,8 +45,6 @@ const RETRY_DELAY = 2_500;
|
|||||||
const DEFAULT_TIMEOUT_MS = 60 * 1000;
|
const DEFAULT_TIMEOUT_MS = 60 * 1000;
|
||||||
const TIMEOUT_INTERVAL = 5_000;
|
const TIMEOUT_INTERVAL = 5_000;
|
||||||
|
|
||||||
const MEGABYTE = 1024 * 1024;
|
|
||||||
|
|
||||||
const l = logger('api-ws');
|
const l = logger('api-ws');
|
||||||
|
|
||||||
function eraseRecord<T> (record: Record<string, T>, cb?: (item: T) => void): void {
|
function eraseRecord<T> (record: Record<string, T>, cb?: (item: T) => void): void {
|
||||||
@@ -59,6 +57,10 @@ function eraseRecord<T> (record: Record<string, T>, cb?: (item: T) => void): voi
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function defaultEndpointStats (): EndpointStats {
|
||||||
|
return { bytesRecv: 0, bytesSent: 0, cached: 0, errors: 0, requests: 0, subscriptions: 0, timeout: 0 };
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* # @polkadot/rpc-provider/ws
|
* # @polkadot/rpc-provider/ws
|
||||||
*
|
*
|
||||||
@@ -92,6 +94,7 @@ export class WsProvider implements ProviderInterface {
|
|||||||
|
|
||||||
#autoConnectMs: number;
|
#autoConnectMs: number;
|
||||||
#endpointIndex: number;
|
#endpointIndex: number;
|
||||||
|
#endpointStats: EndpointStats;
|
||||||
#isConnected = false;
|
#isConnected = false;
|
||||||
#subscriptions: Record<string, WsStateSubscription> = {};
|
#subscriptions: Record<string, WsStateSubscription> = {};
|
||||||
#timeoutId?: ReturnType<typeof setInterval> | null = null;
|
#timeoutId?: ReturnType<typeof setInterval> | null = null;
|
||||||
@@ -128,8 +131,9 @@ export class WsProvider implements ProviderInterface {
|
|||||||
this.#websocket = null;
|
this.#websocket = null;
|
||||||
this.#stats = {
|
this.#stats = {
|
||||||
active: { requests: 0, subscriptions: 0 },
|
active: { requests: 0, subscriptions: 0 },
|
||||||
total: { bytesRecv: 0, bytesSent: 0, cached: 0, errors: 0, requests: 0, subscriptions: 0, timeout: 0 }
|
total: defaultEndpointStats()
|
||||||
};
|
};
|
||||||
|
this.#endpointStats = defaultEndpointStats();
|
||||||
this.#timeout = timeout || DEFAULT_TIMEOUT_MS;
|
this.#timeout = timeout || DEFAULT_TIMEOUT_MS;
|
||||||
|
|
||||||
if (autoConnectMs > 0) {
|
if (autoConnectMs > 0) {
|
||||||
@@ -174,6 +178,10 @@ export class WsProvider implements ProviderInterface {
|
|||||||
return this.#isReadyPromise;
|
return this.#isReadyPromise;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get endpoint (): string {
|
||||||
|
return this.#endpoints[this.#endpointIndex];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description Returns a clone of the object
|
* @description Returns a clone of the object
|
||||||
*/
|
*/
|
||||||
@@ -181,6 +189,10 @@ export class WsProvider implements ProviderInterface {
|
|||||||
return new WsProvider(this.#endpoints);
|
return new WsProvider(this.#endpoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected selectEndpointIndex (endpoints: string[]): number {
|
||||||
|
return (this.#endpointIndex + 1) % endpoints.length;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Manually connect
|
* @summary Manually connect
|
||||||
* @description The [[WsProvider]] connects automatically by default, however if you decided otherwise, you may
|
* @description The [[WsProvider]] connects automatically by default, however if you decided otherwise, you may
|
||||||
@@ -188,23 +200,20 @@ export class WsProvider implements ProviderInterface {
|
|||||||
*/
|
*/
|
||||||
// eslint-disable-next-line @typescript-eslint/require-await
|
// eslint-disable-next-line @typescript-eslint/require-await
|
||||||
public async connect (): Promise<void> {
|
public async connect (): Promise<void> {
|
||||||
|
if (this.#websocket) {
|
||||||
|
throw new Error('WebSocket is already connected');
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.#endpointIndex = (this.#endpointIndex + 1) % this.#endpoints.length;
|
this.#endpointIndex = this.selectEndpointIndex(this.#endpoints);
|
||||||
|
|
||||||
// the as typeof WebSocket here is Deno-specific - not available on the globalThis
|
// the as typeof WebSocket here is Deno-specific - not available on the globalThis
|
||||||
this.#websocket = typeof xglobal.WebSocket !== 'undefined' && isChildClass(xglobal.WebSocket as typeof WebSocket, WebSocket)
|
this.#websocket = typeof xglobal.WebSocket !== 'undefined' && isChildClass(xglobal.WebSocket as typeof WebSocket, WebSocket)
|
||||||
? new WebSocket(this.#endpoints[this.#endpointIndex])
|
? new WebSocket(this.endpoint)
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore - WS may be an instance of w3cwebsocket, which supports headers
|
// @ts-ignore - WS may be an instance of ws, which supports options
|
||||||
: new WebSocket(this.#endpoints[this.#endpointIndex], undefined, undefined, this.#headers, undefined, {
|
: new WebSocket(this.endpoint, undefined, {
|
||||||
// default: true
|
headers: this.#headers
|
||||||
fragmentOutgoingMessages: true,
|
|
||||||
// default: 16K (bump, the Node has issues with too many fragments, e.g. on setCode)
|
|
||||||
fragmentationThreshold: 1 * MEGABYTE,
|
|
||||||
// default: 1MiB (also align with maxReceivedMessageSize)
|
|
||||||
maxReceivedFrameSize: 24 * MEGABYTE,
|
|
||||||
// default: 8MB (however Polkadot api.query.staking.erasStakers.entries(356) is over that, 16M is ok there)
|
|
||||||
maxReceivedMessageSize: 24 * MEGABYTE
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.#websocket) {
|
if (this.#websocket) {
|
||||||
@@ -277,6 +286,10 @@ export class WsProvider implements ProviderInterface {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get endpointStats (): EndpointStats {
|
||||||
|
return this.#endpointStats;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Listens on events after having subscribed using the [[subscribe]] function.
|
* @summary Listens on events after having subscribed using the [[subscribe]] function.
|
||||||
* @param {ProviderInterfaceEmitted} type Event
|
* @param {ProviderInterfaceEmitted} type Event
|
||||||
@@ -298,6 +311,7 @@ export class WsProvider implements ProviderInterface {
|
|||||||
* @param subscription Subscription details (internally used)
|
* @param subscription Subscription details (internally used)
|
||||||
*/
|
*/
|
||||||
public send <T = any> (method: string, params: unknown[], isCacheable?: boolean, subscription?: SubscriptionHandler): Promise<T> {
|
public send <T = any> (method: string, params: unknown[], isCacheable?: boolean, subscription?: SubscriptionHandler): Promise<T> {
|
||||||
|
this.#endpointStats.requests++;
|
||||||
this.#stats.total.requests++;
|
this.#stats.total.requests++;
|
||||||
|
|
||||||
const [id, body] = this.#coder.encodeJson(method, params);
|
const [id, body] = this.#coder.encodeJson(method, params);
|
||||||
@@ -312,6 +326,7 @@ export class WsProvider implements ProviderInterface {
|
|||||||
this.#callCache.set(body, resultPromise);
|
this.#callCache.set(body, resultPromise);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
this.#endpointStats.cached++;
|
||||||
this.#stats.total.cached++;
|
this.#stats.total.cached++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -340,9 +355,11 @@ export class WsProvider implements ProviderInterface {
|
|||||||
start: Date.now(),
|
start: Date.now(),
|
||||||
subscription
|
subscription
|
||||||
};
|
};
|
||||||
|
this.#endpointStats.bytesSent += body.length;
|
||||||
this.#stats.total.bytesSent += body.length;
|
this.#stats.total.bytesSent += body.length;
|
||||||
this.#websocket.send(body);
|
this.#websocket.send(body);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
this.#endpointStats.errors++;
|
||||||
this.#stats.total.errors++;
|
this.#stats.total.errors++;
|
||||||
|
|
||||||
reject(error);
|
reject(error);
|
||||||
@@ -369,6 +386,7 @@ export class WsProvider implements ProviderInterface {
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
public subscribe (type: string, method: string, params: unknown[], callback: ProviderInterfaceCallback): Promise<number | string> {
|
public subscribe (type: string, method: string, params: unknown[], callback: ProviderInterfaceCallback): Promise<number | string> {
|
||||||
|
this.#endpointStats.subscriptions++;
|
||||||
this.#stats.total.subscriptions++;
|
this.#stats.total.subscriptions++;
|
||||||
|
|
||||||
// subscriptions are not cached, LRU applies to .at(<blockHash>) only
|
// subscriptions are not cached, LRU applies to .at(<blockHash>) only
|
||||||
@@ -407,7 +425,7 @@ export class WsProvider implements ProviderInterface {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#onSocketClose = (event: CloseEvent): void => {
|
#onSocketClose = (event: CloseEvent): void => {
|
||||||
const error = new Error(`disconnected from ${this.#endpoints[this.#endpointIndex]}: ${event.code}:: ${event.reason || getWSErrorString(event.code)}`);
|
const error = new Error(`disconnected from ${this.endpoint}: ${event.code}:: ${event.reason || getWSErrorString(event.code)}`);
|
||||||
|
|
||||||
if (this.#autoConnectMs > 0) {
|
if (this.#autoConnectMs > 0) {
|
||||||
l.error(error.message);
|
l.error(error.message);
|
||||||
@@ -428,8 +446,6 @@ export class WsProvider implements ProviderInterface {
|
|||||||
this.#timeoutId = null;
|
this.#timeoutId = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.#emit('disconnected');
|
|
||||||
|
|
||||||
// reject all hanging requests
|
// reject all hanging requests
|
||||||
eraseRecord(this.#handlers, (h) => {
|
eraseRecord(this.#handlers, (h) => {
|
||||||
try {
|
try {
|
||||||
@@ -441,6 +457,11 @@ export class WsProvider implements ProviderInterface {
|
|||||||
});
|
});
|
||||||
eraseRecord(this.#waitingForId);
|
eraseRecord(this.#waitingForId);
|
||||||
|
|
||||||
|
// Reset stats for active endpoint
|
||||||
|
this.#endpointStats = defaultEndpointStats();
|
||||||
|
|
||||||
|
this.#emit('disconnected');
|
||||||
|
|
||||||
if (this.#autoConnectMs > 0) {
|
if (this.#autoConnectMs > 0) {
|
||||||
setTimeout((): void => {
|
setTimeout((): void => {
|
||||||
this.connectWithRetry().catch(() => {
|
this.connectWithRetry().catch(() => {
|
||||||
@@ -458,6 +479,7 @@ export class WsProvider implements ProviderInterface {
|
|||||||
#onSocketMessage = (message: MessageEvent<string>): void => {
|
#onSocketMessage = (message: MessageEvent<string>): void => {
|
||||||
l.debug(() => ['received', message.data]);
|
l.debug(() => ['received', message.data]);
|
||||||
|
|
||||||
|
this.#endpointStats.bytesRecv += message.data.length;
|
||||||
this.#stats.total.bytesRecv += message.data.length;
|
this.#stats.total.bytesRecv += message.data.length;
|
||||||
|
|
||||||
const response = JSON.parse(message.data) as JsonRpcResponse;
|
const response = JSON.parse(message.data) as JsonRpcResponse;
|
||||||
@@ -498,6 +520,7 @@ export class WsProvider implements ProviderInterface {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
this.#endpointStats.errors++;
|
||||||
this.#stats.total.errors++;
|
this.#stats.total.errors++;
|
||||||
|
|
||||||
handler.callback(error as Error, undefined);
|
handler.callback(error as Error, undefined);
|
||||||
@@ -528,6 +551,7 @@ export class WsProvider implements ProviderInterface {
|
|||||||
|
|
||||||
handler.callback(null, result);
|
handler.callback(null, result);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
this.#endpointStats.errors++;
|
||||||
this.#stats.total.errors++;
|
this.#stats.total.errors++;
|
||||||
|
|
||||||
handler.callback(error as Error, undefined);
|
handler.callback(error as Error, undefined);
|
||||||
@@ -539,13 +563,14 @@ export class WsProvider implements ProviderInterface {
|
|||||||
throw new Error('WebSocket cannot be null in onOpen');
|
throw new Error('WebSocket cannot be null in onOpen');
|
||||||
}
|
}
|
||||||
|
|
||||||
l.debug(() => ['connected to', this.#endpoints[this.#endpointIndex]]);
|
l.debug(() => ['connected to', this.endpoint]);
|
||||||
|
|
||||||
this.#isConnected = true;
|
this.#isConnected = true;
|
||||||
|
|
||||||
this.#emit('connected');
|
|
||||||
this.#resubscribe();
|
this.#resubscribe();
|
||||||
|
|
||||||
|
this.#emit('connected');
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -586,6 +611,7 @@ export class WsProvider implements ProviderInterface {
|
|||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.#endpointStats.timeout++;
|
||||||
this.#stats.total.timeout++;
|
this.#stats.total.timeout++;
|
||||||
delete this.#handlers[ids[i]];
|
delete this.#handlers[ids[i]];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
|
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type { Constructor } from '@polkadot/types/types';
|
// eslint-disable-next-line spaced-comment
|
||||||
|
/// <reference types="@polkadot/dev/node/test/node" />
|
||||||
|
|
||||||
import type { Request } from '../mock/mockWs';
|
import type { Request } from '../mock/mockWs';
|
||||||
|
|
||||||
import { mockWs } from '../mock/mockWs';
|
import { mockWs } from '../mock/mockWs';
|
||||||
@@ -26,7 +28,7 @@ function createWs (autoConnect = 1000): Promise<WsProvider> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
describe('send', (): void => {
|
describe('send', (): void => {
|
||||||
let globalWs: Constructor<WebSocket>;
|
let globalWs: typeof WebSocket;
|
||||||
|
|
||||||
beforeEach((): void => {
|
beforeEach((): void => {
|
||||||
globalWs = global.WebSocket;
|
globalWs = global.WebSocket;
|
||||||
@@ -36,7 +38,7 @@ describe('send', (): void => {
|
|||||||
global.WebSocket = globalWs;
|
global.WebSocket = globalWs;
|
||||||
|
|
||||||
if (mock) {
|
if (mock) {
|
||||||
mock.done();
|
await mock.done();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (provider) {
|
if (provider) {
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
|
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// eslint-disable-next-line spaced-comment
|
||||||
|
/// <reference types="@polkadot/dev/node/test/node" />
|
||||||
|
|
||||||
import { WsProvider } from './';
|
import { WsProvider } from './';
|
||||||
|
|
||||||
describe('state', (): void => {
|
describe('state', (): void => {
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
|
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type { Constructor } from '@polkadot/types/types';
|
// eslint-disable-next-line spaced-comment
|
||||||
|
/// <reference types="@polkadot/dev/node/test/node" />
|
||||||
|
|
||||||
import type { Request } from '../mock/mockWs';
|
import type { Request } from '../mock/mockWs';
|
||||||
import type { Global, Mock } from './../mock/types';
|
import type { Global, Mock } from './../mock/types';
|
||||||
|
|
||||||
@@ -26,7 +28,7 @@ function createWs (autoConnect = 1000): Promise<WsProvider> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
describe('subscribe', (): void => {
|
describe('subscribe', (): void => {
|
||||||
let globalWs: Constructor<WebSocket>;
|
let globalWs: typeof WebSocket;
|
||||||
|
|
||||||
beforeEach((): void => {
|
beforeEach((): void => {
|
||||||
globalWs = global.WebSocket;
|
globalWs = global.WebSocket;
|
||||||
@@ -36,7 +38,7 @@ describe('subscribe', (): void => {
|
|||||||
global.WebSocket = globalWs;
|
global.WebSocket = globalWs;
|
||||||
|
|
||||||
if (mock) {
|
if (mock) {
|
||||||
mock.done();
|
await mock.done();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (provider) {
|
if (provider) {
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
|
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type { Constructor } from '@polkadot/types/types';
|
// eslint-disable-next-line spaced-comment
|
||||||
|
/// <reference types="@polkadot/dev/node/test/node" />
|
||||||
|
|
||||||
import type { Request } from '../mock/mockWs';
|
import type { Request } from '../mock/mockWs';
|
||||||
import type { Global, Mock } from './../mock/types';
|
import type { Global, Mock } from './../mock/types';
|
||||||
|
|
||||||
@@ -26,7 +28,7 @@ function createWs (autoConnect = 1000): Promise<WsProvider> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
describe('subscribe', (): void => {
|
describe('subscribe', (): void => {
|
||||||
let globalWs: Constructor<WebSocket>;
|
let globalWs: typeof WebSocket;
|
||||||
|
|
||||||
beforeEach((): void => {
|
beforeEach((): void => {
|
||||||
globalWs = global.WebSocket;
|
globalWs = global.WebSocket;
|
||||||
@@ -36,7 +38,7 @@ describe('subscribe', (): void => {
|
|||||||
global.WebSocket = globalWs;
|
global.WebSocket = globalWs;
|
||||||
|
|
||||||
if (mock) {
|
if (mock) {
|
||||||
mock.done();
|
await mock.done();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (provider) {
|
if (provider) {
|
||||||
@@ -45,7 +47,7 @@ describe('subscribe', (): void => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('removes subscriptions', (): Promise<boolean> => {
|
it('removes subscriptions', async (): Promise<void> => {
|
||||||
createMock([
|
createMock([
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
@@ -63,7 +65,7 @@ describe('subscribe', (): void => {
|
|||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return createWs().then((ws) =>
|
await createWs().then((ws) =>
|
||||||
ws
|
ws
|
||||||
.subscribe('test', 'subscribe_test', [], (cb): void => {
|
.subscribe('test', 'subscribe_test', [], (cb): void => {
|
||||||
expect(cb).toEqual(expect.anything());
|
expect(cb).toEqual(expect.anything());
|
||||||
|
|||||||
@@ -20,34 +20,31 @@
|
|||||||
"./detectPackage.cjs"
|
"./detectPackage.cjs"
|
||||||
],
|
],
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "9.13.6",
|
"version": "10.0.1",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
"polkadot-types-chain-info": "./scripts/polkadot-types-chain-info.cjs",
|
"polkadot-types-chain-info": "./scripts/polkadot-types-chain-info.mjs",
|
||||||
"polkadot-types-from-chain": "./scripts/polkadot-types-from-chain.cjs",
|
"polkadot-types-from-chain": "./scripts/polkadot-types-from-chain.mjs",
|
||||||
"polkadot-types-from-defs": "./scripts/polkadot-types-from-defs.cjs",
|
"polkadot-types-from-defs": "./scripts/polkadot-types-from-defs.mjs",
|
||||||
"polkadot-types-internal-interfaces": "./scripts/polkadot-types-internal-interfaces.cjs",
|
"polkadot-types-internal-interfaces": "./scripts/polkadot-types-internal-interfaces.mjs",
|
||||||
"polkadot-types-internal-metadata": "./scripts/polkadot-types-internal-metadata.cjs"
|
"polkadot-types-internal-metadata": "./scripts/polkadot-types-internal-metadata.mjs"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/core": "^7.20.12",
|
"@polkadot/api": "10.0.1",
|
||||||
"@babel/register": "^7.18.9",
|
"@polkadot/api-augment": "10.0.1",
|
||||||
"@babel/runtime": "^7.20.13",
|
"@polkadot/rpc-augment": "10.0.1",
|
||||||
"@polkadot/api": "9.13.6",
|
"@polkadot/rpc-provider": "10.0.1",
|
||||||
"@polkadot/api-augment": "9.13.6",
|
"@polkadot/types": "10.0.1",
|
||||||
"@polkadot/rpc-augment": "9.13.6",
|
"@polkadot/types-augment": "10.0.1",
|
||||||
"@polkadot/rpc-provider": "9.13.6",
|
"@polkadot/types-codec": "10.0.1",
|
||||||
"@polkadot/types": "9.13.6",
|
"@polkadot/types-create": "10.0.1",
|
||||||
"@polkadot/types-augment": "9.13.6",
|
"@polkadot/types-support": "10.0.1",
|
||||||
"@polkadot/types-codec": "9.13.6",
|
"@polkadot/util": "^11.0.1",
|
||||||
"@polkadot/types-create": "9.13.6",
|
"@polkadot/util-crypto": "^11.0.1",
|
||||||
"@polkadot/types-support": "9.13.6",
|
"@polkadot/x-ws": "^11.0.1",
|
||||||
"@polkadot/util": "^10.3.1",
|
|
||||||
"@polkadot/util-crypto": "^10.3.1",
|
|
||||||
"@polkadot/x-ws": "^10.3.1",
|
|
||||||
"handlebars": "^4.7.7",
|
"handlebars": "^4.7.7",
|
||||||
"websocket": "^1.0.34",
|
"tslib": "^2.5.0",
|
||||||
"yargs": "^17.6.2"
|
"yargs": "^17.7.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/websocket": "^1.0.5",
|
"@types/websocket": "^1.0.5",
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
// Copyright 2017-2023 @polkadot/typegen authors & contributors
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
|
|
||||||
module.exports = function (file) {
|
|
||||||
let main;
|
|
||||||
|
|
||||||
try {
|
|
||||||
main = require(`../cjs/${file}.js`).main;
|
|
||||||
} catch (error) {
|
|
||||||
// required for dev-only setups
|
|
||||||
process.env.JEST_WORKER_ID = '123';
|
|
||||||
|
|
||||||
// register aliases
|
|
||||||
require('@babel/register')({
|
|
||||||
extensions: ['.js', '.ts'],
|
|
||||||
plugins: [
|
|
||||||
['module-resolver', {
|
|
||||||
alias: {
|
|
||||||
'^@polkadot/api-(augment|base|derive)(.*)': './packages/api-\\1/src\\2',
|
|
||||||
// eslint-disable-next-line sort-keys
|
|
||||||
'^@polkadot/api(.*)': './packages/api/src/\\1',
|
|
||||||
'^@polkadot/rpc-(augment|core|provider)(.*)': './packages/rpc-\\1/src\\2',
|
|
||||||
'^@polkadot/types-(augment|codec|create|known|metadata|support)(.*)': './packages/types-\\1/src\\2',
|
|
||||||
// eslint-disable-next-line sort-keys
|
|
||||||
'^@polkadot/types(.*)': './packages/types/src\\1'
|
|
||||||
}
|
|
||||||
}]
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
// get ts source
|
|
||||||
main = require(`../src/${file}.ts`).main;
|
|
||||||
}
|
|
||||||
|
|
||||||
main();
|
|
||||||
};
|
|
||||||
+3
-1
@@ -2,4 +2,6 @@
|
|||||||
// Copyright 2017-2023 @polkadot/typegen authors & contributors
|
// Copyright 2017-2023 @polkadot/typegen authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
require('./execWithSrc.cjs')('fromChain');
|
import { main } from '@polkadot/typegen/extractChain';
|
||||||
|
|
||||||
|
main();
|
||||||
+3
-1
@@ -2,4 +2,6 @@
|
|||||||
// Copyright 2017-2023 @polkadot/typegen authors & contributors
|
// Copyright 2017-2023 @polkadot/typegen authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
require('./execWithSrc.cjs')('interfacesTs');
|
import { main } from '@polkadot/typegen/fromChain';
|
||||||
|
|
||||||
|
main();
|
||||||
+3
-1
@@ -2,4 +2,6 @@
|
|||||||
// Copyright 2017-2023 @polkadot/typegen authors & contributors
|
// Copyright 2017-2023 @polkadot/typegen authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
require('./execWithSrc.cjs')('fromDefs');
|
import { main } from '@polkadot/typegen/fromDefs';
|
||||||
|
|
||||||
|
main();
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
// Copyright 2017-2023 @polkadot/typegen authors & contributors
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
import { main } from '@polkadot/typegen/interfacesTs';
|
||||||
|
|
||||||
|
main();
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#!/usr/bin/env node
|
|
||||||
// Copyright 2017-2023 @polkadot/typegen authors & contributors
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
|
|
||||||
require('./execWithSrc.cjs')('metadataMd');
|
|
||||||
+3
-1
@@ -2,4 +2,6 @@
|
|||||||
// Copyright 2017-2023 @polkadot/typegen authors & contributors
|
// Copyright 2017-2023 @polkadot/typegen authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
require('./execWithSrc.cjs')('extractChain');
|
import { main } from '@polkadot/typegen/metadataMd';
|
||||||
|
|
||||||
|
main();
|
||||||
@@ -3,16 +3,17 @@
|
|||||||
|
|
||||||
import type { HexString } from '@polkadot/util/types';
|
import type { HexString } from '@polkadot/util/types';
|
||||||
|
|
||||||
|
import fs from 'fs';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import yargs from 'yargs';
|
import yargs from 'yargs';
|
||||||
|
|
||||||
import { Definitions } from '@polkadot/types/types';
|
import { Definitions, DefinitionsTypes } from '@polkadot/types/types';
|
||||||
import { formatNumber } from '@polkadot/util';
|
import { formatNumber, isHex } from '@polkadot/util';
|
||||||
|
|
||||||
import { generateDefaultConsts, generateDefaultErrors, generateDefaultEvents, generateDefaultQuery, generateDefaultRpc, generateDefaultRuntime, generateDefaultTx } from './generate';
|
import { generateDefaultConsts, generateDefaultErrors, generateDefaultEvents, generateDefaultQuery, generateDefaultRpc, generateDefaultRuntime, generateDefaultTx } from './generate';
|
||||||
import { assertDir, assertFile, getMetadataViaWs, HEADER, writeFile } from './util';
|
import { assertDir, assertFile, getMetadataViaWs, HEADER, writeFile } from './util';
|
||||||
|
|
||||||
function generate (metaHex: HexString, pkg: string | undefined, output: string, isStrict?: boolean): void {
|
async function generate (metaHex: HexString, pkg: string | undefined, output: string, isStrict?: boolean): Promise<void> {
|
||||||
console.log(`Generating from metadata, ${formatNumber((metaHex.length - 2) / 2)} bytes`);
|
console.log(`Generating from metadata, ${formatNumber((metaHex.length - 2) / 2)} bytes`);
|
||||||
|
|
||||||
const outputPath = assertDir(path.join(process.cwd(), output));
|
const outputPath = assertDir(path.join(process.cwd(), output));
|
||||||
@@ -21,9 +22,12 @@ function generate (metaHex: HexString, pkg: string | undefined, output: string,
|
|||||||
|
|
||||||
if (pkg) {
|
if (pkg) {
|
||||||
try {
|
try {
|
||||||
|
const defPath = assertFile(path.join(outputPath, 'definitions.ts'));
|
||||||
|
const defCont = await import(defPath) as { module: any };
|
||||||
|
|
||||||
extraTypes = {
|
extraTypes = {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-argument
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||||
[pkg]: require(assertFile(path.join(outputPath, 'definitions.ts'))) as Record<string, any>
|
[pkg]: defCont.module
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('ERROR: No custom definitions found:', (error as Error).message);
|
console.error('ERROR: No custom definitions found:', (error as Error).message);
|
||||||
@@ -31,10 +35,12 @@ function generate (metaHex: HexString, pkg: string | undefined, output: string,
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const lookPath = assertFile(path.join(outputPath, 'lookup.ts'));
|
||||||
|
const lookCont = await import(lookPath) as { module: { default: DefinitionsTypes } };
|
||||||
|
|
||||||
customLookupDefinitions = {
|
customLookupDefinitions = {
|
||||||
rpc: {},
|
rpc: {},
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-var-requires
|
types: lookCont.module.default
|
||||||
types: require(assertFile(path.join(outputPath, 'lookup.ts'))).default
|
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('ERROR: No lookup definitions found:', (error as Error).message);
|
console.error('ERROR: No lookup definitions found:', (error as Error).message);
|
||||||
@@ -64,7 +70,7 @@ function generate (metaHex: HexString, pkg: string | undefined, output: string,
|
|||||||
|
|
||||||
type ArgV = { endpoint: string; output: string; package?: string; strict?: boolean };
|
type ArgV = { endpoint: string; output: string; package?: string; strict?: boolean };
|
||||||
|
|
||||||
export function main (): void {
|
async function mainPromise (): Promise<void> {
|
||||||
const { endpoint, output, package: pkg, strict: isStrict } = yargs.strict().options({
|
const { endpoint, output, package: pkg, strict: isStrict } = yargs.strict().options({
|
||||||
endpoint: {
|
endpoint: {
|
||||||
description: 'The endpoint to connect to (e.g. wss://kusama-rpc.polkadot.io) or relative path to a file containing the JSON output of an RPC state_getMetadata call',
|
description: 'The endpoint to connect to (e.g. wss://kusama-rpc.polkadot.io) or relative path to a file containing the JSON output of an RPC state_getMetadata call',
|
||||||
@@ -86,14 +92,25 @@ export function main (): void {
|
|||||||
}
|
}
|
||||||
}).argv as ArgV;
|
}).argv as ArgV;
|
||||||
|
|
||||||
if (endpoint.startsWith('wss://') || endpoint.startsWith('ws://')) {
|
let metadata: HexString;
|
||||||
getMetadataViaWs(endpoint)
|
|
||||||
.then((metadata) => generate(metadata, pkg, output, isStrict))
|
|
||||||
.catch(() => process.exit(1));
|
|
||||||
} else {
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
||||||
const metadata = (require(assertFile(path.join(process.cwd(), endpoint))) as Record<string, HexString>).result;
|
|
||||||
|
|
||||||
generate(metadata, pkg, output, isStrict);
|
if (endpoint.startsWith('wss://') || endpoint.startsWith('ws://')) {
|
||||||
|
metadata = await getMetadataViaWs(endpoint);
|
||||||
|
} else {
|
||||||
|
metadata = (
|
||||||
|
JSON.parse(
|
||||||
|
fs.readFileSync(assertFile(path.join(process.cwd(), endpoint)), 'utf-8')
|
||||||
|
) as { result: HexString }
|
||||||
|
).result;
|
||||||
|
|
||||||
|
if (!isHex(metadata)) {
|
||||||
|
throw new Error('Invalid metadata file');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await generate(metadata, pkg, output, isStrict);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function main (): void {
|
||||||
|
mainPromise().catch(() => process.exit(1));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,10 +3,12 @@
|
|||||||
|
|
||||||
import type { HexString } from '@polkadot/util/types';
|
import type { HexString } from '@polkadot/util/types';
|
||||||
|
|
||||||
|
import fs from 'fs';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import yargs from 'yargs';
|
import yargs from 'yargs';
|
||||||
|
|
||||||
import * as substrateDefs from '@polkadot/types/interfaces/definitions';
|
import * as substrateDefs from '@polkadot/types/interfaces/definitions';
|
||||||
|
import { isHex } from '@polkadot/util';
|
||||||
|
|
||||||
import { generateInterfaceTypes } from './generate/interfaceRegistry';
|
import { generateInterfaceTypes } from './generate/interfaceRegistry';
|
||||||
import { generateTsDef } from './generate/tsDef';
|
import { generateTsDef } from './generate/tsDef';
|
||||||
@@ -15,7 +17,7 @@ import { assertDir, assertFile, getMetadataViaWs } from './util';
|
|||||||
|
|
||||||
type ArgV = { input: string; package: string; endpoint?: string; };
|
type ArgV = { input: string; package: string; endpoint?: string; };
|
||||||
|
|
||||||
export function main (): void {
|
async function mainPromise (): Promise<void> {
|
||||||
const { endpoint, input, package: pkg } = yargs.strict().options({
|
const { endpoint, input, package: pkg } = yargs.strict().options({
|
||||||
endpoint: {
|
endpoint: {
|
||||||
description: 'The endpoint to connect to (e.g. wss://kusama-rpc.polkadot.io) or relative path to a file containing the JSON output of an RPC state_getMetadata call',
|
description: 'The endpoint to connect to (e.g. wss://kusama-rpc.polkadot.io) or relative path to a file containing the JSON output of an RPC state_getMetadata call',
|
||||||
@@ -37,8 +39,9 @@ export function main (): void {
|
|||||||
let userDefs: Record<string, any> = {};
|
let userDefs: Record<string, any> = {};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
userDefs = await import(
|
||||||
userDefs = require(assertFile(path.join(inputPath, 'definitions.ts'))) as Record<string, any>;
|
assertFile(path.join(inputPath, 'definitions.ts'))
|
||||||
|
) as Record<string, any>;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('ERROR: Unable to load user definitions:', (error as Error).message);
|
console.error('ERROR: Unable to load user definitions:', (error as Error).message);
|
||||||
}
|
}
|
||||||
@@ -70,15 +73,26 @@ export function main (): void {
|
|||||||
generateInterfaceTypes(allDefs, path.join(inputPath, 'augment-types.ts'));
|
generateInterfaceTypes(allDefs, path.join(inputPath, 'augment-types.ts'));
|
||||||
|
|
||||||
if (endpoint) {
|
if (endpoint) {
|
||||||
if (endpoint.startsWith('wss://') || endpoint.startsWith('ws://')) {
|
let metadata: HexString;
|
||||||
getMetadataViaWs(endpoint)
|
|
||||||
.then((metadata) => generateDefaultLookup(inputPath, metadata))
|
|
||||||
.catch(() => process.exit(1));
|
|
||||||
} else {
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
||||||
const metaHex = (require(assertFile(path.join(process.cwd(), endpoint))) as Record<string, HexString>).result;
|
|
||||||
|
|
||||||
generateDefaultLookup(inputPath, metaHex);
|
if (endpoint.startsWith('wss://') || endpoint.startsWith('ws://')) {
|
||||||
|
metadata = await getMetadataViaWs(endpoint);
|
||||||
|
} else {
|
||||||
|
metadata = (
|
||||||
|
JSON.parse(
|
||||||
|
fs.readFileSync(assertFile(path.join(process.cwd(), endpoint)), 'utf-8')
|
||||||
|
) as { result: HexString }
|
||||||
|
).result;
|
||||||
|
|
||||||
|
if (!isHex(metadata)) {
|
||||||
|
throw new Error('Invalid metadata file');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
generateDefaultLookup(inputPath, metadata);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function main (): void {
|
||||||
|
mainPromise().catch(() => process.exit(1));
|
||||||
|
}
|
||||||
|
|||||||
@@ -50,16 +50,14 @@ function entrySignature (lookup: PortableRegistry, allDefs: Record<string, Modul
|
|||||||
storageEntry.modifier.isOptional
|
storageEntry.modifier.isOptional
|
||||||
? 'Option'
|
? 'Option'
|
||||||
: null,
|
: null,
|
||||||
defValue.lookupName
|
defValue.lookupName || defValue.type
|
||||||
? undefined
|
|
||||||
: defValue.type
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
storageEntry.modifier.isOptional,
|
storageEntry.modifier.isOptional,
|
||||||
keyDefs.map((k) => formatType(registry, allDefs, k.lookupName || k.type, imports)).join(', '),
|
keyDefs.map((k) => formatType(registry, allDefs, k.lookupName || k.type, imports)).join(', '),
|
||||||
keyTypes.map((t, i) => `arg${keyTypes.length === 1 ? '' : (i + 1)}: ${t}`).join(', '),
|
keyTypes.map((t, i) => `arg${keyTypes.length === 1 ? '' : (i + 1)}: ${t}`).join(', '),
|
||||||
formatType(registry, allDefs, outputType, imports)
|
outputType.lookupName || formatType(registry, allDefs, outputType, imports)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import type { MetadataLatest, SiLookupTypeId } from '@polkadot/types/interfaces'
|
|||||||
import type { PortableRegistry } from '@polkadot/types/metadata';
|
import type { PortableRegistry } from '@polkadot/types/metadata';
|
||||||
import type { Codec, DefinitionRpcParam } from '@polkadot/types/types';
|
import type { Codec, DefinitionRpcParam } from '@polkadot/types/types';
|
||||||
|
|
||||||
import fs from 'fs';
|
import fs from 'node:fs';
|
||||||
|
|
||||||
import { Metadata, TypeRegistry, Vec } from '@polkadot/types';
|
import { Metadata, TypeRegistry, Vec } from '@polkadot/types';
|
||||||
import * as definitions from '@polkadot/types/interfaces/definitions';
|
import * as definitions from '@polkadot/types/interfaces/definitions';
|
||||||
|
|||||||
@@ -3,4 +3,4 @@
|
|||||||
|
|
||||||
// Do not edit, auto-generated by @polkadot/dev
|
// Do not edit, auto-generated by @polkadot/dev
|
||||||
|
|
||||||
export const packageInfo = { name: '@polkadot/typegen', path: 'auto', type: 'auto', version: '9.13.6' };
|
export const packageInfo = { name: '@polkadot/typegen', path: 'auto', type: 'auto', version: '10.0.1' };
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2017-2023 @polkadot/typegen authors & contributors
|
// Copyright 2017-2023 @polkadot/typegen authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import fs from 'fs';
|
import fs from 'node:fs';
|
||||||
|
|
||||||
import { assert } from '@polkadot/util';
|
import { assert } from '@polkadot/util';
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
// Copyright 2017-2023 @polkadot/typegen authors & contributors
|
// Copyright 2017-2023 @polkadot/typegen authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// eslint-disable-next-line spaced-comment
|
||||||
|
/// <reference types="@polkadot/dev/node/test/node" />
|
||||||
|
|
||||||
import { TypeRegistry } from '@polkadot/types/create';
|
import { TypeRegistry } from '@polkadot/types/create';
|
||||||
|
|
||||||
import { getSimilarTypes } from './derived';
|
import { getSimilarTypes } from './derived';
|
||||||
|
|
||||||
describe('getSimilarTypes', (): void => {
|
describe('getSimilarTypes', (): void => {
|
||||||
let registry: TypeRegistry;
|
const registry = new TypeRegistry();
|
||||||
|
|
||||||
const mockImports = {
|
const mockImports = {
|
||||||
codecTypes: {},
|
codecTypes: {},
|
||||||
definitions: {},
|
definitions: {},
|
||||||
@@ -22,10 +24,6 @@ describe('getSimilarTypes', (): void => {
|
|||||||
typesTypes: {}
|
typesTypes: {}
|
||||||
};
|
};
|
||||||
|
|
||||||
beforeAll((): void => {
|
|
||||||
registry = new TypeRegistry();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('handles nested Tuples', (): void => {
|
it('handles nested Tuples', (): void => {
|
||||||
expect(getSimilarTypes(registry, {}, '(AccountId, (Balance, u32), u64)', mockImports)).toEqual([
|
expect(getSimilarTypes(registry, {}, '(AccountId, (Balance, u32), u64)', mockImports)).toEqual([
|
||||||
'ITuple<[AccountId, ITuple<[Balance, u32]>, u64]>',
|
'ITuple<[AccountId, ITuple<[Balance, u32]>, u64]>',
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
// Copyright 2017-2023 @polkadot/typegen authors & contributors
|
// Copyright 2017-2023 @polkadot/typegen authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import fs from 'fs';
|
import fs from 'node:fs';
|
||||||
import path from 'path';
|
import path from 'node:path';
|
||||||
|
import process from 'node:process';
|
||||||
|
|
||||||
import { packageInfo } from '../packageInfo';
|
import { packageInfo } from '../packageInfo';
|
||||||
|
|
||||||
@@ -25,7 +26,7 @@ export function writeFile (dest: string, generator: () => string, noLog?: boolea
|
|||||||
export function readTemplate (template: string): string {
|
export function readTemplate (template: string): string {
|
||||||
// Inside the api repo itself, it will be 'auto'
|
// Inside the api repo itself, it will be 'auto'
|
||||||
const rootDir = packageInfo.path === 'auto'
|
const rootDir = packageInfo.path === 'auto'
|
||||||
? path.join(__dirname, '..')
|
? path.join(process.cwd(), 'packages/typegen/src')
|
||||||
: packageInfo.path;
|
: packageInfo.path;
|
||||||
|
|
||||||
// NOTE With cjs in a subdir, search one lower as well
|
// NOTE With cjs in a subdir, search one lower as well
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
// Copyright 2017-2023 @polkadot/typegen authors & contributors
|
// Copyright 2017-2023 @polkadot/typegen authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// eslint-disable-next-line spaced-comment
|
||||||
|
/// <reference types="@polkadot/dev/node/test/node" />
|
||||||
|
|
||||||
import { TypeRegistry } from '@polkadot/types';
|
import { TypeRegistry } from '@polkadot/types';
|
||||||
|
|
||||||
import { formatType } from './formatting';
|
import { formatType } from './formatting';
|
||||||
|
|||||||
@@ -20,12 +20,12 @@
|
|||||||
"./detectPackage.cjs"
|
"./detectPackage.cjs"
|
||||||
],
|
],
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "9.13.6",
|
"version": "10.0.1",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.20.13",
|
"@polkadot/types": "10.0.1",
|
||||||
"@polkadot/types": "9.13.6",
|
"@polkadot/types-codec": "10.0.1",
|
||||||
"@polkadot/types-codec": "9.13.6",
|
"@polkadot/util": "^11.0.1",
|
||||||
"@polkadot/util": "^10.3.1"
|
"tslib": "^2.5.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
/**
|
/**
|
||||||
* Lookup108: kusama_runtime::SessionKeys
|
* Lookup107: kusama_runtime::SessionKeys
|
||||||
**/
|
**/
|
||||||
KusamaRuntimeSessionKeys: {
|
KusamaRuntimeSessionKeys: {
|
||||||
grandpa: 'SpFinalityGrandpaAppPublic',
|
grandpa: 'SpFinalityGrandpaAppPublic',
|
||||||
@@ -164,7 +164,7 @@ export default {
|
|||||||
votes24: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);23],Compact<u16>)>'
|
votes24: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);23],Compact<u16>)>'
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Lookup873: kusama_runtime::Runtime
|
* Lookup880: kusama_runtime::Runtime
|
||||||
**/
|
**/
|
||||||
KusamaRuntimeRuntime: 'Null'
|
KusamaRuntimeRuntime: 'Null'
|
||||||
};
|
};
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user