Compare commits

..
54 Commits
Author SHA1 Message Date
github-actions[bot] b9805cdc94 [CI Skip] release/stable 10.0.1
skip-checks: true
2023-03-05 08:50:27 +00:00
Jaco feb36d43a4 10.0.1 (#5518)
* 10.0.1

* Drop extra websocket dep

* Drop extra babel deps
2023-03-05 10:30:54 +02:00
github-actions[bot] 92c88d7c13 [CI Skip] bump/beta 9.14.3-11-x
skip-checks: true
2023-03-04 15:33:05 +00:00
Jaco 033fc4f480 Adjust x-ws usage (#5511) 2023-03-04 17:13:41 +02:00
Jaco 4ca9670e4e Bump deps (#5517)
* Bump deps

* Bump dev
2023-03-04 16:52:54 +02:00
github-actions[bot] 8fee66c0fa [CI Skip] bump/beta 9.14.3-10-x
skip-checks: true
2023-03-03 11:01:16 +00:00
Jaco 9a3b5d7a2c Ensure that provider disconnect clears all subscriptions (#5516)
* Ensure that provider disconnect clears all subscriptions

* Update CHANGELOG
2023-03-03 12:53:08 +02:00
github-actions[bot] f166431b02 [CI Skip] bump/beta 9.14.3-9-x
skip-checks: true
2023-03-03 09:32:25 +00:00
Jaco 088fdc6171 Bump dev & update gh workflows (#5515) 2023-03-03 11:24:27 +02:00
github-actions[bot] 910c77fd39 [CI Skip] bump/beta 9.14.3-8-x
skip-checks: true
2023-03-03 06:32:46 +00:00
Julien dacf2875b7 General WsProvider extensibility improvements (#5467)
* Make endpoints index selection extensible

* Expose endpoint

* Ensure events happen last

* Added endpoint stats
2023-03-03 08:23:25 +02:00
github-actions[bot] cbcc79972a [CI Skip] bump/beta 9.14.3-7-x
skip-checks: true
2023-03-01 11:24:48 +00:00
Jaco 0faddf1df6 Remove done callback usage from it(...) (#5514)
* Remove done callback usage from it(...)

* Bump deps

* continue-on-error: true
2023-03-01 13:13:38 +02:00
github-actions[bot] 697c8b8e7a [CI Skip] bump/beta 9.14.3-6-x
skip-checks: true
2023-02-28 09:01:36 +00:00
Jaco 99403b8246 Adjust loading of user-specified metadata (#5513) 2023-02-28 10:53:37 +02:00
github-actions[bot] 4b7e1003e0 [CI Skip] bump/beta 9.14.3-5-x
skip-checks: true
2023-02-27 15:02:40 +00:00
Jaco 5fd6d39aed Replace require(...) with import(...) in typegen (#5495)
* Replace require(...) with import(...) in typegen

* Update metadata

* Adjust & actual run

* Bump API

* Rebuild

* Bump build
2023-02-27 16:54:06 +02:00
github-actions[bot] cedb1afe6f [CI Skip] bump/beta 9.14.3-4-x
skip-checks: true
2023-02-27 09:48:05 +00:00
Jaco 4bff8e5158 Bump dev deps (#5510)
* Bump dev deps

* Bump dev
2023-02-27 11:39:47 +02:00
github-actions[bot] 474aedde34 [CI Skip] bump/beta 9.14.3-3-x
skip-checks: true
2023-02-25 09:56:39 +00:00
Jaco a8d7566186 Adjust tests for node:test env (#5509) 2023-02-25 11:48:26 +02:00
github-actions[bot] beb7b54e4a [CI Skip] bump/beta 9.14.3-2-x
skip-checks: true
2023-02-24 15:56:28 +00:00
Andreea Eftene d08cc74aad add type overrides (#5506) 2023-02-24 17:46:07 +02:00
github-actions[bot] 27e4279c55 [CI Skip] bump/beta 9.14.3-1-x
skip-checks: true
2023-02-22 07:26:08 +00:00
Jaco 6cd2f3b386 Bump deps (#5505)
* Bump deps

* Bump dev
2023-02-22 09:14:43 +02:00
github-actions[bot] 472c971c5b [CI Skip] bump/beta 9.14.3-0-x
skip-checks: true
2023-02-20 15:45:24 +00:00
Jaco d8756455c2 Bump dev deps (#5502) 2023-02-20 17:37:11 +02:00
github-actions[bot] 5aae48cc28 [CI Skip] release/stable 9.14.2
skip-checks: true
2023-02-19 11:19:41 +00:00
Jaco 4ab3b55383 9.14.2 (#5500) 2023-02-19 13:10:43 +02:00
github-actions[bot] 6ea6b90e03 [CI Skip] bump/beta 9.14.2-8-x
skip-checks: true
2023-02-19 10:45:23 +00:00
Jaco eb5c888cb8 Update metadata (#5499)
* Updata metadata

* Rebuild

* Adjust generation
2023-02-19 12:36:41 +02:00
github-actions[bot] cda07dfa0b [CI Skip] bump/beta 9.14.2-7-x
skip-checks: true
2023-02-18 10:50:26 +00:00
Jaco 4abae3200b Remove extraneous jest.mock usage (unused, no impact) (#5498) 2023-02-18 12:42:11 +02:00
github-actions[bot] b60895beb4 [CI Skip] bump/beta 9.14.2-6-x
skip-checks: true
2023-02-18 07:58:29 +00:00
Jaco 855d70a3b3 Remove __dirname usage in typegen (#5496) 2023-02-18 09:48:07 +02:00
github-actions[bot] 583d9bfe36 [CI Skip] bump/beta 9.14.2-5-x
skip-checks: true
2023-02-17 18:30:43 +00:00
Jaco d519611a25 Adjust test expectations (#5494) 2023-02-17 20:22:12 +02:00
github-actions[bot] 9a9bace8e8 [CI Skip] bump/beta 9.14.2-4-x
skip-checks: true
2023-02-17 10:08:40 +00:00
Jaco 40810f2fdb Cleanup tests (& fix ws.connect()) (#5493)
* Cleanup tests (& fix ws.connect())

* Await mock

* Adjust sc connect ordering
2023-02-17 11:57:34 +02:00
github-actions[bot] 361a77580e [CI Skip] bump/beta 9.14.2-3-x
skip-checks: true
2023-02-17 06:29:52 +00:00
Jaco ea45c7e689 Remove __dirname usages in tests (#5492) 2023-02-17 08:20:29 +02:00
github-actions[bot] cc1d51a6ca [CI Skip] bump/beta 9.14.2-2-x
skip-checks: true
2023-02-16 19:18:36 +00:00
Jaco b8233fb7b8 Adjust test expectations (#5490) 2023-02-16 21:10:17 +02:00
github-actions[bot] 5cbe80066d [CI Skip] bump/beta 9.14.2-1-x
skip-checks: true
2023-02-15 10:07:50 +00:00
Jaco 3f6c10256c Bump deps (#5486) 2023-02-15 11:56:46 +02:00
github-actions[bot] 609b2830b0 [CI Skip] bump/beta 9.14.2-0-x
skip-checks: true
2023-02-15 07:26:32 +00:00
Jaco b7bbd2d615 Fix CI release workflow (#5485) 2023-02-15 09:16:35 +02:00
Jaco 41d6429782 Use latest LTS for CI scripts (#5482) 2023-02-14 10:49:33 +02:00
github-actions[bot] ae168a00a9 [CI Skip] release/stable 9.14.1
skip-checks: true
2023-02-12 13:31:21 +00:00
Jaco 79694d8a95 9.14.1 (#5481)
* 9.14.1

* Rebuild metadata
2023-02-12 15:22:48 +02:00
github-actions[bot] 95be64cbd7 [CI Skip] bump/beta 9.13.7-1-x
skip-checks: true
2023-02-07 12:26:53 +00:00
Jaco 76bf7a0079 Alias for Runtime{Call, Event} types (#5477)
* Alias for Runtime{Call, Event} types

* CHANGELOG
2023-02-07 14:17:29 +02:00
github-actions[bot] 142390f27d [CI Skip] bump/beta 9.13.7-0-x
skip-checks: true
2023-02-05 12:18:54 +00:00
Jaco d0145ce58c Bump dev (#5476) 2023-02-05 14:10:25 +02:00
232 changed files with 18258 additions and 19471 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ jobs:
steps:
- uses: jacogr/action-merge@d2d64b4545acd93b0a9575177d3d215ae3f92029
with:
checks: build,lint,test
checks: pr (build),pr (lint),pr (test)
labels: -auto
strategy: squash
token: ${{ secrets.GH_PAT_BOT }}
+6 -3
View File
@@ -3,16 +3,19 @@ on: [pull_request]
jobs:
pr:
continue-on-error: true
strategy:
matrix:
step: ['lint', 'test', 'build', 'deno']
name: ${{ matrix.step }}
runs-on: ubuntu-latest
env:
YARN_ENABLE_SCRIPTS: false
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
- uses: denoland/setup-deno@004814556e37c54a2f6e31384c9e18e983317366
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 'lts/*'
- uses: denoland/setup-deno@v1
with:
deno-version: vx.x.x
- name: ${{ matrix.step }}
+4 -2
View File
@@ -10,7 +10,6 @@ jobs:
strategy:
matrix:
step: ['build:release']
name: ${{ matrix.step }}
runs-on: ubuntu-latest
env:
YARN_ENABLE_SCRIPTS: false
@@ -19,10 +18,13 @@ jobs:
GH_RELEASE_GITHUB_API_TOKEN: ${{ secrets.GH_PAT_BOT }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
- uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GH_PAT_BOT }}
- uses: actions/setup-node@v3
with:
node-version: 'lts/*'
- name: ${{ matrix.step }}
run: |
yarn install --immutable | grep -v 'YN0013'
+33
View File
@@ -1,5 +1,38 @@
# 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
Contributed:
+3 -3
View File
@@ -1,4 +1,4 @@
3360 Jaco 9.13.6 (#5475)
3386 Jaco 10.0.1 (#5518)
83 Amaury Martiny StatementKind: Regular and Saft (#2303)
37 Keith Ingram Update contract types and rpc (#4541)
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)
5 Chevdor Fix metadata package link (#3458)
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 Wang fix issue that creates duplicate providers (#983)
4 Alexander Popiak Add asset id in signing (#4009)
4 Andreea Eftene add type overrides (#5506)
4 Joshy Orndorff spelling; efect -> effect (#2295)
4 Julien Eluard Clarified WsProvider constructor parameters documentation (#5404)
4 Nantian fix bigint type (#3869)
4 Scott Twiname Add support for historical BlockNumber rpc methods (#4574)
4 Thibaut Sardan no subscription for http (#3127)
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 Arjan Zijderveld Added `Emergency` to `ElectionPhase` (#3707)
3 Ewa Kowalska Handle no council for bounties proposals (#3062)
-19
View File
@@ -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
View File
@@ -11,38 +11,38 @@
},
"sideEffects": false,
"type": "module",
"version": "9.13.6",
"version": "10.0.1",
"versions": {
"git": "9.13.6",
"npm": "9.13.6"
"git": "10.0.1",
"npm": "10.0.1"
},
"workspaces": [
"packages/*"
],
"scripts": {
"build": "yarn build:interfaces && polkadot-dev-build-ts",
"build:extra": "(cd packages/typegen && copyfiles scripts/* build)",
"build:interfaces": "polkadot-types-internal-interfaces",
"build:metadata": "yarn build:interfaces && yarn test:one packages/types/src/metadata/v14",
"build:extra": "(cd packages/typegen && polkadot-dev-copy-dir scripts build/scripts)",
"build:interfaces": "node --loader @polkadot/dev/node/ts packages/typegen/scripts/polkadot-types-internal-interfaces.mjs",
"build:metadata": "yarn build:interfaces && polkadot-dev-run-test packages/types/src/metadata/v14",
"build:release": "polkadot-ci-ghact-build",
"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",
"clean": "polkadot-dev-clean-build",
"deno": "yarn polkadot-dev-deno-map && yarn build && deno check --import-map=import_map.json mod.ts",
"lint": "polkadot-dev-run-lint",
"postinstall": "polkadot-dev-yarn-only",
"test": "NODE_OPTIONS=--experimental-vm-modules polkadot-dev-run-test --coverage --forceExit --runInBand --testPathIgnorePatterns e2e",
"test:one": "NODE_OPTIONS=--experimental-vm-modules polkadot-dev-run-test --detectOpenHandles --forceExit"
"test": "polkadot-dev-run-test --env node ^e2e",
"test:node": "polkadot-dev-run-test --env node ^e2e",
"test:one": "polkadot-dev-run-test --env node"
},
"devDependencies": {
"@babel/core": "^7.20.12",
"@babel/register": "^7.18.9",
"@babel/runtime": "^7.20.13",
"@polkadot/dev": "^0.68.5",
"@babel/core": "^7.21.0",
"@babel/register": "^7.21.0",
"@babel/runtime": "^7.21.0",
"@polkadot/dev": "^0.69.27",
"@polkadot/typegen": "workspace:packages/typegen",
"@types/jest": "^29.4.0",
"copyfiles": "^2.4.1"
"@types/node": "^18.14.5"
},
"resolutions": {
"typescript": "^4.9.5"
+8 -8
View File
@@ -20,15 +20,15 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "9.13.6",
"version": "10.0.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.20.13",
"@polkadot/api-base": "9.13.6",
"@polkadot/rpc-augment": "9.13.6",
"@polkadot/types": "9.13.6",
"@polkadot/types-augment": "9.13.6",
"@polkadot/types-codec": "9.13.6",
"@polkadot/util": "^10.3.1"
"@polkadot/api-base": "10.0.1",
"@polkadot/rpc-augment": "10.0.1",
"@polkadot/types": "10.0.1",
"@polkadot/types-augment": "10.0.1",
"@polkadot/types-codec": "10.0.1",
"@polkadot/util": "^11.0.1",
"tslib": "^2.5.0"
}
}
+23 -16
View File
@@ -33,18 +33,6 @@ declare module '@polkadot/api-base/types/consts' {
**/
[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: {
/**
* 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
**/
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
**/
@@ -620,18 +617,28 @@ declare module '@polkadot/api-base/types/consts' {
/**
* The maximum number of candidates in a phragmen election.
*
* Warning: The election happens onchain, and this value will determine
* the size of the election. When this limit is reached no more
* candidates are accepted in the election.
* 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 this limit is reached no more candidates are accepted in the election.
**/
maxCandidates: u32 & AugmentedConst<ApiType>;
/**
* 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.
**/
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
**/
+25 -35
View File
@@ -45,40 +45,6 @@ declare module '@polkadot/api-base/types/errors' {
**/
[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: {
/**
* 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.
**/
NotVoter: AugmentedError<ApiType>;
/**
* The preimage does not exist.
**/
PreimageNotExist: AugmentedError<ApiType>;
/**
* Proposal still blacklisted
**/
@@ -724,6 +694,10 @@ declare module '@polkadot/api-base/types/errors' {
* No track exists for the proposal origin.
**/
NoTrack: AugmentedError<ApiType>;
/**
* The preimage does not exist.
**/
PreimageNotExist: AugmentedError<ApiType>;
/**
* The queue of the track is empty.
**/
@@ -1146,6 +1120,10 @@ declare module '@polkadot/api-base/types/errors' {
* pool at a time.
**/
AccountBelongsToOtherPool: AugmentedError<ApiType>;
/**
* Bonding extra is restricted to the exact pending reward amount.
**/
BondExtraRestricted: AugmentedError<ApiType>;
/**
* The pools state cannot be changed.
**/
@@ -1478,12 +1456,20 @@ declare module '@polkadot/api-base/types/errors' {
* Invalid signature on statement.
**/
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.
**/
SingleSidedDispute: AugmentedError<ApiType>;
/**
* Unconfirmed dispute statement sets provided
* Unconfirmed dispute statement sets provided.
**/
UnconfirmedDispute: AugmentedError<ApiType>;
/**
@@ -1748,6 +1734,10 @@ declare module '@polkadot/api-base/types/errors' {
* No track exists for the proposal origin.
**/
NoTrack: AugmentedError<ApiType>;
/**
* The preimage does not exist.
**/
PreimageNotExist: AugmentedError<ApiType>;
/**
* The queue of the track is empty.
**/
+34 -2
View File
@@ -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 { EthereumAddress } from '@polkadot/types/interfaces/eth';
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>;
@@ -281,6 +281,18 @@ declare module '@polkadot/api-base/types/events' {
* An external proposal has been tabled.
**/
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.
**/
@@ -451,6 +463,14 @@ declare module '@polkadot/api-base/types/events' {
* A referendum has been killed.
**/
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.
**/
@@ -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
* 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
**/
@@ -1025,6 +1045,14 @@ declare module '@polkadot/api-base/types/events' {
* A referendum has been killed.
**/
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.
**/
@@ -1155,6 +1183,10 @@ declare module '@polkadot/api-base/types/events' {
* A new \[max\] member count has been set
**/
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.
**/
+59 -10
View File
@@ -7,11 +7,11 @@ import '@polkadot/api-base/types/storage';
import type { ApiTypes, AugmentedQuery, QueryableStorageEntry } from '@polkadot/api-base/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 { EthereumAddress } from '@polkadot/types/interfaces/eth';
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';
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: 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
**/
@@ -159,6 +151,17 @@ declare module '@polkadot/api-base/types/storage' {
* epoch.
**/
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.
**/
@@ -411,6 +414,15 @@ declare module '@polkadot/api-base/types/storage' {
* `ReferendumCount` if there isn't a unbaked referendum.
**/
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.
* 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.
**/
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.
**/
@@ -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
* 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.
**/
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.
**/
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
**/
@@ -1280,6 +1311,11 @@ declare module '@polkadot/api-base/types/storage' {
[key: string]: QueryableStorageEntry<ApiType>;
};
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.
**/
@@ -1321,6 +1357,10 @@ declare module '@polkadot/api-base/types/storage' {
* The earliest session for which previous session info is stored.
**/
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.
* 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.
**/
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.
**/
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -3,4 +3,4 @@
// 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' };
+23 -16
View File
@@ -33,18 +33,6 @@ declare module '@polkadot/api-base/types/consts' {
**/
[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: {
/**
* 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
**/
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
**/
@@ -485,18 +482,28 @@ declare module '@polkadot/api-base/types/consts' {
/**
* The maximum number of candidates in a phragmen election.
*
* Warning: The election happens onchain, and this value will determine
* the size of the election. When this limit is reached no more
* candidates are accepted in the election.
* 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 this limit is reached no more candidates are accepted in the election.
**/
maxCandidates: u32 & AugmentedConst<ApiType>;
/**
* 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.
**/
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
**/
+17 -35
View File
@@ -45,40 +45,6 @@ declare module '@polkadot/api-base/types/errors' {
**/
[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: {
/**
* 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.
**/
NotVoter: AugmentedError<ApiType>;
/**
* The preimage does not exist.
**/
PreimageNotExist: AugmentedError<ApiType>;
/**
* Proposal still blacklisted
**/
@@ -890,6 +860,10 @@ declare module '@polkadot/api-base/types/errors' {
* pool at a time.
**/
AccountBelongsToOtherPool: AugmentedError<ApiType>;
/**
* Bonding extra is restricted to the exact pending reward amount.
**/
BondExtraRestricted: AugmentedError<ApiType>;
/**
* The pools state cannot be changed.
**/
@@ -1222,12 +1196,20 @@ declare module '@polkadot/api-base/types/errors' {
* Invalid signature on statement.
**/
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.
**/
SingleSidedDispute: AugmentedError<ApiType>;
/**
* Unconfirmed dispute statement sets provided
* Unconfirmed dispute statement sets provided.
**/
UnconfirmedDispute: AugmentedError<ApiType>;
/**
+14 -2
View File
@@ -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 { EthereumAddress } from '@polkadot/types/interfaces/eth';
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>;
@@ -267,6 +267,18 @@ declare module '@polkadot/api-base/types/events' {
* An external proposal has been tabled.
**/
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.
**/
@@ -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
* 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
**/
+41 -10
View File
@@ -7,11 +7,11 @@ import '@polkadot/api-base/types/storage';
import type { ApiTypes, AugmentedQuery, QueryableStorageEntry } from '@polkadot/api-base/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 { EthereumAddress } from '@polkadot/types/interfaces/eth';
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';
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: 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
**/
@@ -159,6 +151,17 @@ declare module '@polkadot/api-base/types/storage' {
* epoch.
**/
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.
**/
@@ -394,6 +397,15 @@ declare module '@polkadot/api-base/types/storage' {
* `ReferendumCount` if there isn't a unbaked referendum.
**/
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.
* 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
* 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.
**/
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.
**/
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
**/
@@ -1133,6 +1155,11 @@ declare module '@polkadot/api-base/types/storage' {
[key: string]: QueryableStorageEntry<ApiType>;
};
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.
**/
@@ -1174,6 +1201,10 @@ declare module '@polkadot/api-base/types/storage' {
* The earliest session for which previous session info is stored.
**/
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.
* Should have an entry in range `EarliestStoredSession..=CurrentSessionIndex`.
File diff suppressed because it is too large Load Diff
+27 -16
View File
@@ -79,18 +79,6 @@ declare module '@polkadot/api-base/types/consts' {
**/
[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: {
/**
* 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.
*
* Warning: The election happens onchain, and this value will determine
* the size of the election. When this limit is reached no more
* candidates are accepted in the election.
* 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 this limit is reached no more candidates are accepted in the election.
**/
maxCandidates: u32 & AugmentedConst<ApiType>;
/**
* 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.
**/
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
**/
@@ -527,6 +525,15 @@ declare module '@polkadot/api-base/types/consts' {
* Max Authorities in use
**/
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
**/
@@ -696,6 +703,10 @@ declare module '@polkadot/api-base/types/consts' {
* The maximum length of an attribute key.
**/
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.
**/
+55 -38
View File
@@ -245,40 +245,6 @@ declare module '@polkadot/api-base/types/errors' {
**/
[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: {
/**
* 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.
**/
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.
**/
@@ -714,6 +676,10 @@ declare module '@polkadot/api-base/types/errors' {
* The given account did not vote on the referendum.
**/
NotVoter: AugmentedError<ApiType>;
/**
* The preimage does not exist.
**/
PreimageNotExist: AugmentedError<ApiType>;
/**
* Proposal still blacklisted
**/
@@ -920,6 +886,18 @@ declare module '@polkadot/api-base/types/errors' {
**/
[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: {
/**
* 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.
**/
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
**/
@@ -1242,6 +1227,10 @@ declare module '@polkadot/api-base/types/errors' {
* The provided data is incorrect.
**/
IncorrectData: AugmentedError<ApiType>;
/**
* The provided metadata might be too long.
**/
IncorrectMetadata: AugmentedError<ApiType>;
/**
* The item is locked (non-transferable).
**/
@@ -1266,6 +1255,10 @@ declare module '@polkadot/api-base/types/errors' {
* Item's metadata is locked.
**/
LockedItemMetadata: AugmentedError<ApiType>;
/**
* Can't set more attributes per one call.
**/
MaxAttributesLimitReached: AugmentedError<ApiType>;
/**
* 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`.
**/
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.
**/
@@ -1354,6 +1355,10 @@ declare module '@polkadot/api-base/types/errors' {
* The provided setting can't be set.
**/
WrongSetting: AugmentedError<ApiType>;
/**
* The provided signature is incorrect.
**/
WrongSignature: AugmentedError<ApiType>;
/**
* Generic error
**/
@@ -1432,6 +1437,10 @@ declare module '@polkadot/api-base/types/errors' {
* pool at a time.
**/
AccountBelongsToOtherPool: AugmentedError<ApiType>;
/**
* Bonding extra is restricted to the exact pending reward amount.
**/
BondExtraRestricted: AugmentedError<ApiType>;
/**
* The pools state cannot be changed.
**/
@@ -1683,6 +1692,10 @@ declare module '@polkadot/api-base/types/errors' {
* No track exists for the proposal origin.
**/
NoTrack: AugmentedError<ApiType>;
/**
* The preimage does not exist.
**/
PreimageNotExist: AugmentedError<ApiType>;
/**
* 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.
**/
NoTrack: AugmentedError<ApiType>;
/**
* The preimage does not exist.
**/
PreimageNotExist: AugmentedError<ApiType>;
/**
* The queue of the track is empty.
**/
+60 -6
View File
@@ -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 { ITuple } from '@polkadot/types-codec/types';
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>;
@@ -437,6 +437,18 @@ declare module '@polkadot/api-base/types/events' {
* An external proposal has been tabled.
**/
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.
**/
@@ -592,6 +604,24 @@ declare module '@polkadot/api-base/types/events' {
**/
[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: {
/**
* New authority set has been applied.
@@ -724,19 +754,19 @@ declare module '@polkadot/api-base/types/events' {
/**
* 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.
**/
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.
**/
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).
**/
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
**/
@@ -878,6 +908,10 @@ declare module '@polkadot/api-base/types/events' {
* Ownership acceptance has changed for an account.
**/
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.
**/
@@ -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
* 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
**/
@@ -1140,6 +1174,14 @@ declare module '@polkadot/api-base/types/events' {
* A referendum has been killed.
**/
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.
**/
@@ -1226,6 +1268,14 @@ declare module '@polkadot/api-base/types/events' {
* A referendum has been killed.
**/
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.
**/
@@ -1341,6 +1391,10 @@ declare module '@polkadot/api-base/types/events' {
* A new \[max\] member count has been set
**/
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.
**/
+83 -12
View File
@@ -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 { AnyNumber, ITuple } from '@polkadot/types-codec/types';
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';
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: 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
**/
@@ -234,6 +226,17 @@ declare module '@polkadot/api-base/types/storage' {
* epoch.
**/
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.
**/
@@ -471,6 +474,15 @@ declare module '@polkadot/api-base/types/storage' {
* `ReferendumCount` if there isn't a unbaked referendum.
**/
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.
* 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>;
};
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: {
/**
* 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
* 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.
**/
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.
**/
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.
**/
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.
**/
serviceHead: AugmentedQuery<ApiType, () => Observable<Option<PalletMessageQueueMockHelpersMessageOrigin>>, []> & QueryableStorageEntry<ApiType, []>;
serviceHead: AugmentedQuery<ApiType, () => Observable<Option<u32>>, []> & QueryableStorageEntry<ApiType, []>;
/**
* Generic query
**/
@@ -947,6 +996,10 @@ declare module '@polkadot/api-base/types/storage' {
* Storage for bonded pools.
**/
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
**/
@@ -1163,6 +1216,15 @@ declare module '@polkadot/api-base/types/storage' {
* The number of referenda being decided currently.
**/
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.
**/
@@ -1211,6 +1273,15 @@ declare module '@polkadot/api-base/types/storage' {
* The number of referenda being decided currently.
**/
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.
**/
File diff suppressed because it is too large Load Diff
+6 -6
View File
@@ -20,13 +20,13 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "9.13.6",
"version": "10.0.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.20.13",
"@polkadot/rpc-core": "9.13.6",
"@polkadot/types": "9.13.6",
"@polkadot/util": "^10.3.1",
"rxjs": "^7.8.0"
"@polkadot/rpc-core": "10.0.1",
"@polkadot/types": "10.0.1",
"@polkadot/util": "^11.0.1",
"rxjs": "^7.8.0",
"tslib": "^2.5.0"
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
// 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' };
+11 -11
View File
@@ -20,20 +20,20 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "9.13.6",
"version": "10.0.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.20.13",
"@polkadot/api": "9.13.6",
"@polkadot/types": "9.13.6",
"@polkadot/types-codec": "9.13.6",
"@polkadot/types-create": "9.13.6",
"@polkadot/util": "^10.3.1",
"@polkadot/util-crypto": "^10.3.1",
"rxjs": "^7.8.0"
"@polkadot/api": "10.0.1",
"@polkadot/types": "10.0.1",
"@polkadot/types-codec": "10.0.1",
"@polkadot/types-create": "10.0.1",
"@polkadot/util": "^11.0.1",
"@polkadot/util-crypto": "^11.0.1",
"rxjs": "^7.8.0",
"tslib": "^2.5.0"
},
"devDependencies": {
"@polkadot/api-augment": "9.13.6",
"@polkadot/keyring": "^10.3.1"
"@polkadot/api-augment": "10.0.1",
"@polkadot/keyring": "^11.0.1"
}
}
+19 -12
View File
@@ -1,10 +1,14 @@
// Copyright 2017-2023 @polkadot/api-contract authors & contributors
// 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 fs from 'fs';
import path from 'path';
import fs from 'node:fs';
import path from 'node:path';
import process from 'node:process';
import { TypeDefInfo } from '@polkadot/types/types';
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 {
return key === 'info'
? TypeDefInfo[value as number]
@@ -82,26 +89,26 @@ describe('Abi', (): void => {
});
describe('TypeDef', (): void => {
Object.keys(abis).forEach((abiName) => {
it(`initializes from a contract ABI (${abiName})`, (): void => {
const abi = new Abi(abis[abiName]);
const json = stringifyJson(abi.registry);
const cmpPath = path.join(__dirname, `../test/compare/${abiName}.test.json`);
for (const [abiName, abiJson] of Object.entries(abis)) {
it(`initializes from a contract ABI: ${abiName}`, (): void => {
const abi = new Abi(abiJson);
const registryJson = stringifyJson(abi.registry);
const cmpFile = path.join(cmpPath, `${abiName}.test.json`);
const cmpText = fs.readFileSync(cmpFile, 'utf-8');
try {
// eslint-disable-next-line @typescript-eslint/no-var-requires
expect(JSON.parse(json)).toEqual(require(cmpPath));
expect(JSON.parse(registryJson)).toEqual(JSON.parse(cmpText));
} catch (error) {
if (process.env.GITHUB_REPOSITORY) {
console.error(json);
console.error(registryJson);
throw error;
}
fs.writeFileSync(cmpPath, json, { flag: 'w' });
fs.writeFileSync(cmpFile, registryJson, { flag: 'w' });
}
});
});
}
});
it('has the correct hash for the source', (): void => {
@@ -1,6 +1,9 @@
// Copyright 2017-2023 @polkadot/api-contract authors & contributors
// 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 abis from '../test/contracts';
+1 -1
View File
@@ -11,7 +11,7 @@ import { v3ToV4 } from './toV4';
// The versions where an enum is used, aka V0 is missing
// (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';
+2 -2
View File
@@ -23,11 +23,11 @@ interface ArgsEntry <T extends WithArgs> extends NamedEntry {
args: GetArgsType<T>['args'][0][];
}
const ARG_TYPES = <const> {
const ARG_TYPES = {
ContractConstructorSpec: 'ContractMessageParamSpecV2',
ContractEventSpec: 'ContractEventParamSpecV2',
ContractMessageSpec: 'ContractMessageParamSpecV2'
};
} as const;
function v1ToV2Label (entry: NamedEntry): { label: Text } {
return objectSpread({}, entry, {
+8 -3
View File
@@ -1,8 +1,12 @@
// Copyright 2017-2023 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import fs from 'fs';
import path from 'path';
// eslint-disable-next-line spaced-comment
/// <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';
@@ -12,7 +16,8 @@ import v1contractFlipper from '../test/contracts/ink/v1/flipper.contract.json' a
import { Code } from './Code';
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 => {
it('can construct with an individual ABI/WASM combo', (): void => {
+1 -1
View File
@@ -3,4 +3,4 @@
// 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' };
+16 -16
View File
@@ -20,25 +20,25 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "9.13.6",
"version": "10.0.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.20.13",
"@polkadot/api": "9.13.6",
"@polkadot/api-augment": "9.13.6",
"@polkadot/api-base": "9.13.6",
"@polkadot/rpc-core": "9.13.6",
"@polkadot/types": "9.13.6",
"@polkadot/types-codec": "9.13.6",
"@polkadot/util": "^10.3.1",
"@polkadot/util-crypto": "^10.3.1",
"rxjs": "^7.8.0"
"@polkadot/api": "10.0.1",
"@polkadot/api-augment": "10.0.1",
"@polkadot/api-base": "10.0.1",
"@polkadot/rpc-core": "10.0.1",
"@polkadot/types": "10.0.1",
"@polkadot/types-codec": "10.0.1",
"@polkadot/util": "^11.0.1",
"@polkadot/util-crypto": "^11.0.1",
"rxjs": "^7.8.0",
"tslib": "^2.5.0"
},
"devDependencies": {
"@polkadot/api": "9.13.6",
"@polkadot/api-augment": "9.13.6",
"@polkadot/rpc-augment": "9.13.6",
"@polkadot/rpc-provider": "9.13.6",
"@polkadot/types-support": "9.13.6"
"@polkadot/api": "10.0.1",
"@polkadot/api-augment": "10.0.1",
"@polkadot/rpc-augment": "10.0.1",
"@polkadot/rpc-provider": "10.0.1",
"@polkadot/types-support": "10.0.1"
}
}
@@ -1,6 +1,9 @@
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
// 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 { Bytes, Option, StorageKey } from '@polkadot/types';
import type { Bounty, BountyIndex, Proposal, ProposalIndex } from '@polkadot/types/interfaces';
+15 -12
View File
@@ -1,6 +1,9 @@
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
// 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-call */
/* 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 => {
const registry = new TypeRegistry();
describe('builtin', (): void => {
const api = new ApiRx({ provider: new MockProvider(registry), registry });
beforeAll((done): void => {
api.isReady.subscribe(() => done());
});
afterAll(async () => {
await api.disconnect();
beforeAll(async () => {
await waitReady(api);
});
afterAll(() => api.disconnect());
testFunction(api)('accounts', 'idAndIndex', []);
testFunction(api)('accounts', 'idToIndex', []);
@@ -81,13 +87,10 @@ describe('derive', (): void => {
throwOnConnect: true
});
beforeAll((done): void => {
api.isReady.subscribe(() => done());
});
afterAll(async () => {
await api.disconnect();
beforeAll(async () => {
await waitReady(api);
});
afterAll(() => api.disconnect());
// override
testFunction(api)('balances', 'fees', ['a', 'b']);
+1 -1
View File
@@ -3,4 +3,4 @@
// 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
// 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 { TypeRegistry } from '@polkadot/types/create';
+19 -19
View File
@@ -20,29 +20,29 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "9.13.6",
"version": "10.0.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.20.13",
"@polkadot/api-augment": "9.13.6",
"@polkadot/api-base": "9.13.6",
"@polkadot/api-derive": "9.13.6",
"@polkadot/keyring": "^10.3.1",
"@polkadot/rpc-augment": "9.13.6",
"@polkadot/rpc-core": "9.13.6",
"@polkadot/rpc-provider": "9.13.6",
"@polkadot/types": "9.13.6",
"@polkadot/types-augment": "9.13.6",
"@polkadot/types-codec": "9.13.6",
"@polkadot/types-create": "9.13.6",
"@polkadot/types-known": "9.13.6",
"@polkadot/util": "^10.3.1",
"@polkadot/util-crypto": "^10.3.1",
"@polkadot/api-augment": "10.0.1",
"@polkadot/api-base": "10.0.1",
"@polkadot/api-derive": "10.0.1",
"@polkadot/keyring": "^11.0.1",
"@polkadot/rpc-augment": "10.0.1",
"@polkadot/rpc-core": "10.0.1",
"@polkadot/rpc-provider": "10.0.1",
"@polkadot/types": "10.0.1",
"@polkadot/types-augment": "10.0.1",
"@polkadot/types-codec": "10.0.1",
"@polkadot/types-create": "10.0.1",
"@polkadot/types-known": "10.0.1",
"@polkadot/util": "^11.0.1",
"@polkadot/util-crypto": "^11.0.1",
"eventemitter3": "^5.0.0",
"rxjs": "^7.8.0"
"rxjs": "^7.8.0",
"tslib": "^2.5.0"
},
"devDependencies": {
"@polkadot/api-augment": "9.13.6",
"@polkadot/types-support": "9.13.6"
"@polkadot/api-augment": "10.0.1",
"@polkadot/types-support": "10.0.1"
}
}
+3 -1
View File
@@ -373,6 +373,8 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
}
private _subscribeHealth (): void {
this._unsubscribeHealth();
// Only enable the health keepalive on WS, not needed on HTTP
this.#healthTimer = this.hasSubscriptions
? setInterval((): void => {
@@ -428,7 +430,7 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
#onProviderDisconnect (): void {
this._isConnected.next(false);
this._unsubscribeHealth();
this._unsubscribe();
this.emit('disconnected');
}
+1 -1
View File
@@ -3,4 +3,4 @@
// 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' };
+80 -69
View File
@@ -1,6 +1,9 @@
// Copyright 2017-2023 @polkadot/api authors & contributors
// 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 { Combinator } from './Combinator';
@@ -19,81 +22,89 @@ describe('Combinator', (): void => {
fns = [];
});
it('it triggers on all values', (done): void => {
let count = 0;
const combinator = new Combinator(
[storeFn],
(value: any[]): void => {
expect(value[0]).toEqual(`test${count}`);
it('it triggers on all values', async (): Promise<void> => {
await new Promise<boolean>((resolve) => {
let count = 0;
const combinator = new Combinator(
[storeFn],
(value: any[]): void => {
expect(value[0]).toEqual(`test${count}`);
count++;
count++;
if (count === 3) {
done();
if (count === 3) {
resolve(true);
}
}
}
);
);
fns[0]('test0');
fns[0]('test1');
fns[0]('test2');
fns[0]('test0');
fns[0]('test1');
fns[0]('test2');
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
expect(combinator).toBeDefined();
});
});
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();
});
});
});
+4 -4
View File
@@ -1,11 +1,12 @@
// Copyright 2017-2023 @polkadot/api authors & contributors
// 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 { SubmittableExtrinsic } from '../types';
import { jest } from '@jest/globals';
import { createPair } from '@polkadot/keyring/pair';
import { createTestKeyring } from '@polkadot/keyring/testing';
import { MockProvider } from '@polkadot/rpc-provider/mock';
@@ -47,7 +48,6 @@ describe('ApiPromise', (): void => {
}
beforeEach((): void => {
jest.setTimeout(10000);
provider = new MockProvider(registry);
});
@@ -104,7 +104,7 @@ describe('ApiPromise', (): void => {
await api.disconnect();
fail('Expected an error but none occurred.');
throw new Error('Expected an error but none occurred.');
} catch {
// Pass
}
+7 -5
View File
@@ -1,18 +1,20 @@
// Copyright 2017-2023 @polkadot/api authors & contributors
// SPDX-License-Identifier: Apache-2.0
// eslint-disable-next-line spaced-comment
/// <reference types="@polkadot/dev/node/test/node" />
import { augmentObject } from './augmentObject';
describe('augmentObject', (): void => {
let spy: any;
let spy: ReturnType<typeof jest.spyOn>;
beforeEach((): void => {
spy = jest.spyOn(console, 'warn');
});
afterEach((): void => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
spy.mockClear();
spy.mockRestore();
});
it('logs added/removed sections and methods', (): void => {
@@ -24,12 +26,12 @@ describe('augmentObject', (): void => {
expect(spy).toHaveBeenCalledWith(
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'
);
expect(spy).toHaveBeenCalledWith(
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'
);
});
+3
View File
@@ -1,6 +1,9 @@
// Copyright 2017-2023 @polkadot/api authors & contributors
// 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 metaStatic from '@polkadot/types-support/metadata/static-substrate';
+6 -6
View File
@@ -20,13 +20,13 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "9.13.6",
"version": "10.0.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.20.13",
"@polkadot/rpc-core": "9.13.6",
"@polkadot/types": "9.13.6",
"@polkadot/types-codec": "9.13.6",
"@polkadot/util": "^10.3.1"
"@polkadot/rpc-core": "10.0.1",
"@polkadot/types": "10.0.1",
"@polkadot/types-codec": "10.0.1",
"@polkadot/util": "^11.0.1",
"tslib": "^2.5.0"
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
// 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' };
+9 -9
View File
@@ -20,18 +20,18 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "9.13.6",
"version": "10.0.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.20.13",
"@polkadot/rpc-augment": "9.13.6",
"@polkadot/rpc-provider": "9.13.6",
"@polkadot/types": "9.13.6",
"@polkadot/util": "^10.3.1",
"rxjs": "^7.8.0"
"@polkadot/rpc-augment": "10.0.1",
"@polkadot/rpc-provider": "10.0.1",
"@polkadot/types": "10.0.1",
"@polkadot/util": "^11.0.1",
"rxjs": "^7.8.0",
"tslib": "^2.5.0"
},
"devDependencies": {
"@polkadot/keyring": "^10.3.1",
"@polkadot/rpc-augment": "9.13.6"
"@polkadot/keyring": "^11.0.1",
"@polkadot/rpc-augment": "10.0.1"
}
}
+29 -20
View File
@@ -1,6 +1,9 @@
// Copyright 2017-2023 @polkadot/rpc-core authors & contributors
// 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 { createTestPairs } from '@polkadot/keyring/testingPairs';
@@ -52,24 +55,26 @@ describe('Cached Observables', (): void => {
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 sub1 = observable1.subscribe();
sub1.unsubscribe();
setTimeout((): void => {
const observable2 = rpc.chain.subscribeNewHeads();
const sub2 = observable2.subscribe();
await new Promise<boolean>((resolve) => {
setTimeout((): void => {
const observable2 = rpc.chain.subscribeNewHeads();
const sub2 = observable2.subscribe();
expect(observable1).toBe(observable2);
expect(observable1).toBe(observable2);
sub2.unsubscribe();
done();
}, 500);
sub2.unsubscribe();
resolve(true);
}, 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 observable2 = rpc.chain.subscribeNewHeads();
const sub1 = observable1.subscribe();
@@ -80,13 +85,15 @@ describe('Cached Observables', (): void => {
sub1.unsubscribe();
sub2.unsubscribe();
setTimeout((): void => {
// No more subscribers, now create a new observable
const observable3 = rpc.chain.subscribeNewHeads();
await new Promise<boolean>((resolve) => {
setTimeout((): void => {
// No more subscribers, now create a new observable
const observable3 = rpc.chain.subscribeNewHeads();
expect(observable3).not.toBe(observable1);
done();
}, 3500);
expect(observable3).not.toBe(observable1);
resolve(true);
}, 3500);
});
});
it('creates different observables for different methods but same arguments', (): void => {
@@ -104,7 +111,7 @@ describe('Cached Observables', (): void => {
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 sub = observable1.subscribe((): void => {
@@ -113,9 +120,11 @@ describe('Cached Observables', (): void => {
expect(rpc.chain.getBlockHash(123)).toBe(observable1);
setTimeout((): void => {
expect(rpc.chain.getBlockHash(123)).not.toBe(observable1);
done();
}, 3500);
await new Promise<boolean>((resolve) => {
setTimeout((): void => {
expect(rpc.chain.getBlockHash(123)).not.toBe(observable1);
resolve(true);
}, 3500);
});
});
});
+3
View File
@@ -1,6 +1,9 @@
// Copyright 2017-2023 @polkadot/rpc-core authors & contributors
// 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 { MockProvider } from '@polkadot/rpc-provider/mock';
+22 -15
View File
@@ -1,6 +1,9 @@
// Copyright 2017-2023 @polkadot/rpc-core authors & contributors
// 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 { DefinitionRpc } from '@polkadot/types/types';
@@ -39,31 +42,35 @@ describe('methodSend', (): void => {
rpc = new RpcCore('987', registry, provider);
});
it('checks for mismatched parameters', (done): void => {
it('checks for mismatched parameters', async (): Promise<void> => {
// private method
// 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);
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
method(1).subscribe(
(): void => undefined,
(error: Error): void => {
expect(error.message).toMatch(/parameters, 1 found instead/);
done();
});
await new Promise<boolean>((resolve) => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
method(1).subscribe(
(): void => undefined,
(error: Error): void => {
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
// 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);
// Args are length-prefixed, because it's a Bytes
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
method(new Uint8Array([2 << 2, 0x12, 0x34])).subscribe((): void => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
expect(provider.send).toHaveBeenCalledWith('test_blah', ['0x1234'], false);
done();
await new Promise<boolean>((resolve) => {
// Args are length-prefixed, because it's a Bytes
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
method(new Uint8Array([2 << 2, 0x12, 0x34])).subscribe((): void => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
expect(provider.send).toHaveBeenCalledWith('test_blah', ['0x1234'], false);
resolve(true);
});
});
});
});
+1 -1
View File
@@ -3,4 +3,4 @@
// 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' };
+33 -24
View File
@@ -1,6 +1,9 @@
// Copyright 2017-2023 @polkadot/rpc-core authors & contributors
// 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 { MockProvider } from '@polkadot/rpc-provider/mock';
@@ -22,17 +25,19 @@ describe('replay', (): void => {
await provider.disconnect();
});
it('returns the observable value', (done): void => {
rpc.system.chain().subscribe((value: any): void => {
if (value) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
expect(value.toString()).toEqual('mockChain'); // Defined in MockProvider
done();
}
it('returns the observable value', async (): Promise<void> => {
await new Promise<boolean>((resolve) => {
rpc.system.chain().subscribe((value: any): void => {
if (value) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
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();
let a: any | undefined;
@@ -40,28 +45,32 @@ describe('replay', (): void => {
a = value;
});
setTimeout((): void => {
// Subscribe again to the same observable, it should fire value immediately
observable.subscribe((value: any): void => {
expect(value).toEqual(a);
done();
});
}, 1000);
await new Promise<boolean>((resolve) => {
setTimeout((): void => {
// Subscribe again to the same observable, it should fire value immediately
observable.subscribe((value: any): void => {
expect(value).toEqual(a);
resolve(true);
});
}, 1000);
});
});
it('unsubscribes as required', (done): void => {
it('unsubscribes as required', async (): Promise<void> => {
// eslint-disable-next-line @typescript-eslint/unbound-method
rpc.provider.unsubscribe = jest.fn();
const subscription = rpc.chain.subscribeNewHeads().subscribe((): void => {
subscription.unsubscribe();
await new Promise<boolean>((resolve) => {
const subscription = rpc.chain.subscribeNewHeads().subscribe((): void => {
subscription.unsubscribe();
// There's a promise inside .unsubscribe(), wait a bit (> 2s)
setTimeout((): void => {
// eslint-disable-next-line @typescript-eslint/unbound-method
expect(rpc.provider.unsubscribe).toHaveBeenCalled();
done();
}, 3500);
// There's a promise inside .unsubscribe(), wait a bit (> 2s)
setTimeout((): void => {
// eslint-disable-next-line @typescript-eslint/unbound-method
expect(rpc.provider.unsubscribe).toHaveBeenCalled();
resolve(true);
}, 3500);
});
});
});
});
+27 -23
View File
@@ -1,47 +1,51 @@
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
// 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 { drr } from '.';
describe('drr', (): void => {
beforeEach((): void => {
jest.setTimeout(15000);
});
it('should not fire twice the same value', (done): void => {
it('should not fire twice the same value', async (): Promise<void> => {
let count = 0;
const sub = of(1, 1).pipe(drr({ delay: 500 })).subscribe((): void => {
++count;
});
setTimeout((): void => {
expect(count).toBe(1);
sub.unsubscribe();
await new Promise<boolean>((resolve) => {
setTimeout((): void => {
expect(count).toBe(1);
sub.unsubscribe();
setTimeout(done, 2000);
}, 50);
setTimeout(() => {
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 sub = obs.subscribe(); // Fire the observable
// Subscribe another time after some time, i.e. after the observable has fired
setTimeout((): void => {
const sub = obs.subscribe((value): void => {
expect(value > 1).toBe(true);
await new Promise<boolean>((resolve) => {
// Subscribe another time after some time, i.e. after the observable has fired
setTimeout((): void => {
const sub = obs.subscribe((value): void => {
expect(value > 1).toBe(true);
setTimeout(done, 2000);
});
setTimeout(() => {
resolve(true);
}, 2000);
});
sub.unsubscribe();
}, 500);
sub.unsubscribe();
}, 500);
sub.unsubscribe();
});
});
});
+14 -14
View File
@@ -20,26 +20,26 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "9.13.6",
"version": "10.0.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.20.13",
"@polkadot/keyring": "^10.3.1",
"@polkadot/types": "9.13.6",
"@polkadot/types-support": "9.13.6",
"@polkadot/util": "^10.3.1",
"@polkadot/util-crypto": "^10.3.1",
"@polkadot/x-fetch": "^10.3.1",
"@polkadot/x-global": "^10.3.1",
"@polkadot/x-ws": "^10.3.1",
"@polkadot/keyring": "^11.0.1",
"@polkadot/types": "10.0.1",
"@polkadot/types-support": "10.0.1",
"@polkadot/util": "^11.0.1",
"@polkadot/util-crypto": "^11.0.1",
"@polkadot/x-fetch": "^11.0.1",
"@polkadot/x-global": "^11.0.1",
"@polkadot/x-ws": "^11.0.1",
"eventemitter3": "^5.0.0",
"mock-socket": "^9.1.5",
"nock": "^13.3.0"
"mock-socket": "^9.2.1",
"nock": "^13.3.0",
"tslib": "^2.5.0"
},
"devDependencies": {
"@substrate/connect": "0.7.19"
"@substrate/connect": "0.7.20"
},
"optionalDependencies": {
"@substrate/connect": "0.7.19"
"@substrate/connect": "0.7.20"
}
}
@@ -1,6 +1,9 @@
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
// 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 { RpcCoder } from '.';
@@ -1,6 +1,9 @@
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
// SPDX-License-Identifier: Apache-2.0
// eslint-disable-next-line spaced-comment
/// <reference types="@polkadot/dev/node/test/node" />
import { RpcCoder } from '.';
describe('encodeJson', (): void => {
@@ -1,6 +1,9 @@
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
// SPDX-License-Identifier: Apache-2.0
// eslint-disable-next-line spaced-comment
/// <reference types="@polkadot/dev/node/test/node" />
import { RpcCoder } from '.';
describe('encodeObject', (): void => {
@@ -1,6 +1,9 @@
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
// 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 RpcError from './error';
+7 -4
View File
@@ -1,6 +1,9 @@
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
// 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 { HttpProvider } from './';
@@ -41,16 +44,16 @@ describe('Http', (): void => {
expect(http.isConnected).toEqual(true);
});
it('does not (yet) support subscribe', (): Promise<number | void> => {
return http.subscribe('', '', [], (cb): void => {
it('does not (yet) support subscribe', async (): Promise<void> => {
await http.subscribe('', '', [], (cb): void => {
expect(cb).toEqual(expect.anything());
}).catch((error): void => {
expect((error as Error).message).toMatch(/does not have subscriptions/);
});
});
it('does not (yet) support unsubscribe', (): Promise<boolean | void> => {
return http.unsubscribe('', '', 0).catch((error): void => {
it('does not (yet) support unsubscribe', async (): Promise<void> => {
await http.unsubscribe('', '', 0).catch((error): void => {
expect((error as Error).message).toMatch(/does not have subscriptions/);
});
});
+5 -2
View File
@@ -1,6 +1,9 @@
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
// 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 { mockHttp, TEST_HTTP_URL } from '../mock/mockHttp';
@@ -16,9 +19,9 @@ describe.skip('send', (): void => {
http = new HttpProvider(TEST_HTTP_URL);
});
afterEach((): void => {
afterEach(async () => {
if (mock) {
mock.done();
await mock.done();
}
});
+3
View File
@@ -1,6 +1,9 @@
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
// SPDX-License-Identifier: Apache-2.0
// eslint-disable-next-line spaced-comment
/// <reference types="@polkadot/dev/node/test/node" />
import { LRUCache } from './lru';
describe('LRUCache', (): void => {
+1 -5
View File
@@ -69,11 +69,7 @@ export function mockWs (requests: Request[], wsUrl: string = TEST_WS_URL): Scope
let requestCount = 0;
const scope: Scope = {
body: {},
done: (): void => {
server.stop((): void => {
// ignore
});
},
done: () => new Promise<void>((resolve) => server.stop(resolve)),
requests: 0,
server
};
+16 -11
View File
@@ -1,6 +1,9 @@
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
// 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 { TypeRegistry } from '@polkadot/types/create';
@@ -19,20 +22,22 @@ describe('on', (): void => {
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 handler = (type: ProviderInterfaceEmitted): void => {
mock.on(type, (): void => {
events[type] = true;
await new Promise<boolean>((resolve) => {
const handler = (type: ProviderInterfaceEmitted): void => {
mock.on(type, (): void => {
events[type] = true;
if (Object.values(events).filter((value): boolean => value).length === 2) {
done();
}
});
};
if (Object.values(events).filter((value): boolean => value).length === 2) {
resolve(true);
}
});
};
handler('connected');
handler('disconnected');
handler('connected');
handler('disconnected');
});
});
});
@@ -1,6 +1,9 @@
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
// 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 { MockProvider } from '.';
@@ -1,6 +1,9 @@
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
// 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 { MockProvider } from './';
@@ -17,53 +20,59 @@ describe('subscribe', (): void => {
await mock.disconnect();
});
it('fails on unknown methods', (): Promise<number | void> => {
return mock
it('fails on unknown methods', async (): Promise<void> => {
await mock
.subscribe('test', 'test_notFound')
.catch((error): void => {
expect((error as Error).message).toMatch(/Invalid method 'test_notFound'/);
});
});
it('returns a subscription id', (): Promise<void> => {
return mock
it('returns a subscription id', async (): Promise<void> => {
await mock
.subscribe('chain_newHead', 'chain_subscribeNewHead', (): void => undefined)
.then((id): void => {
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.subscriptions.chain_subscribeNewHead.lastValue = 'testValue';
mock.subscribe('chain_newHead', 'chain_subscribeNewHead', (_: any, value: string): void => {
expect(value).toEqual('testValue');
done();
}).catch(console.error);
await new Promise<boolean>((resolve) => {
mock.subscribe('chain_newHead', 'chain_subscribeNewHead', (_: any, value: string): void => {
expect(value).toEqual('testValue');
resolve(true);
}).catch(console.error);
});
});
it('calls back with new headers', (done): void => {
mock.subscribe('chain_newHead', 'chain_subscribeNewHead', (_: any, header: { number: number }): void => {
if (header.number === 4) {
done();
}
}).catch(console.error);
it('calls back with new headers', async (): Promise<void> => {
await new Promise<boolean>((resolve) => {
mock.subscribe('chain_newHead', 'chain_subscribeNewHead', (_: any, header: { number: number }): void => {
if (header.number === 4) {
resolve(true);
}
}).catch(console.error);
});
});
it('handles errors withing callbacks gracefully', (done): void => {
it('handles errors within callbacks gracefully', async (): Promise<void> => {
let hasThrown = false;
mock.subscribe('chain_newHead', 'chain_subscribeNewHead', (_: any, header: { number: number }): void => {
if (!hasThrown) {
hasThrown = true;
await new Promise<boolean>((resolve) => {
mock.subscribe('chain_newHead', 'chain_subscribeNewHead', (_: any, header: { number: number }): void => {
if (!hasThrown) {
hasThrown = true;
throw new Error('testing');
}
throw new Error('testing');
}
if (header.number === 3) {
done();
}
}).catch(console.error);
if (header.number === 3) {
resolve(true);
}
}).catch(console.error);
});
});
});
+3 -5
View File
@@ -2,11 +2,9 @@
// SPDX-License-Identifier: Apache-2.0
import type { Server } from 'mock-socket';
import type { Constructor } from '@polkadot/types/types';
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
export interface Global extends NodeJS.Global {
WebSocket: Constructor<WebSocket>;
export type Global = typeof globalThis & {
WebSocket: typeof WebSocket;
fetch: any;
}
@@ -14,7 +12,7 @@ export interface Mock {
body: Record<string, Record<string, unknown>>;
requests: number;
server: Server;
done: () => Record<string, unknown>;
done: () => Promise<void>;
}
export type MockStateSubscriptionCallback = (error: Error | null, value: any) => void;
@@ -1,6 +1,9 @@
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
// 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 { MockProvider } from '.';
@@ -24,8 +27,8 @@ describe('unsubscribe', (): void => {
await mock.disconnect();
});
it('fails on unknown ids', (): Promise<boolean> => {
return mock
it('fails on unknown ids', async (): Promise<void> => {
await mock
.unsubscribe('chain_newHead', 'chain_subscribeNewHead', 5)
.catch((error): boolean => {
expect((error as Error).message).toMatch(/Unable to find/);
@@ -34,12 +37,12 @@ describe('unsubscribe', (): void => {
});
});
it('unsubscribes successfully', (): Promise<boolean> => {
return mock.unsubscribe('chain_newHead', 'chain_subscribeNewHead', id);
it('unsubscribes successfully', async (): Promise<void> => {
await mock.unsubscribe('chain_newHead', 'chain_subscribeNewHead', id);
});
it('fails on double unsubscribe', (): Promise<boolean> => {
return mock.unsubscribe('chain_newHead', 'chain_subscribeNewHead', id)
it('fails on double unsubscribe', async (): Promise<void> => {
await mock.unsubscribe('chain_newHead', 'chain_subscribeNewHead', id)
.then((): Promise<boolean> =>
mock.unsubscribe('chain_newHead', 'chain_subscribeNewHead', id)
)
+1 -1
View File
@@ -3,4 +3,4 @@
// 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
// 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 promise/param-names */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
@@ -21,18 +24,33 @@
import type Sc from '@substrate/connect';
import type { HealthChecker, SmoldotHealth } from './types';
import { jest } from '@jest/globals';
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 & {
_isActive: () => boolean
_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 sendJsonRpc: (request: string) => void = () => {};
@@ -57,9 +75,9 @@ const healthCheckerMock = (): MockedHealthChecker => {
cb(update);
}
};
};
}
const healthCheckerFactory = () => {
function healthCheckerFactory () {
const _healthCheckers: MockedHealthChecker[] = [];
return {
@@ -73,21 +91,9 @@ const healthCheckerFactory = () => {
_healthCheckers,
_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[] = [];
let _isTerminated = false;
@@ -119,9 +125,9 @@ const getFakeChain = (spec: string, callback: Sc.JsonRpcCallback): MockChain =>
},
_getLatestRequest: () => _receivedRequests[_receivedRequests.length - 1]
};
};
}
const getFakeClient = () => {
function getFakeClient () {
const chains: MockChain[] = [];
let addChainInterceptor: Promise<void> = Promise.resolve();
let addWellKnownChainInterceptor: Promise<void> = Promise.resolve();
@@ -154,16 +160,9 @@ const getFakeClient = () => {
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 latestClient = () => clients[clients.length - 1];
@@ -181,26 +180,26 @@ const connectorFactory = () => {
latestChain: () =>
latestClient()._chains()[latestClient()._chains().length - 1]
};
};
}
let mockSc: typeof Sc & { latestChain: () => MockChain };
let mockedHealthChecker: ReturnType<typeof healthCheckerFactory>;
const getCurrentHealthChecker = () => mockedHealthChecker._latestHealthChecker();
const setChainSyncyingStatus = (isSyncing: boolean) => {
function setChainSyncyingStatus (isSyncing: boolean) {
getCurrentHealthChecker()._triggerHealthUpdate({
isSyncing,
peers: 1,
shouldHavePeers: true
});
};
}
beforeAll(() => {
mockSc = connectorFactory() as unknown as typeof Sc & { latestChain: () => MockChain };
mockedHealthChecker = healthCheckerFactory();
});
let mockSc: typeof Sc & { latestChain: () => MockChain };
let mockedHealthChecker: ReturnType<typeof healthCheckerFactory>;
const getCurrentHealthChecker = () => mockedHealthChecker._latestHealthChecker();
describe('ScProvider', () => {
beforeAll(() => {
mockSc = connectorFactory() as unknown as typeof Sc & { latestChain: () => MockChain };
mockedHealthChecker = healthCheckerFactory();
});
describe('on', () => {
it('emits `connected` as soon as the chain is not syncing', async () => {
const provider = new ScProvider(mockSc, '');
@@ -251,16 +250,15 @@ describe('ScProvider', () => {
setChainSyncyingStatus(false);
const onConnected = jest.fn();
provider.on('connected', onConnected);
const onDisconnected = jest.fn();
provider.on('connected', onConnected);
provider.on('disconnected', onDisconnected);
expect(onConnected).toHaveBeenCalled();
expect(onDisconnected).not.toHaveBeenCalled();
onConnected.mockRestore();
onConnected.mockReset();
setChainSyncyingStatus(true);
expect(onConnected).not.toHaveBeenCalled();
@@ -284,7 +282,7 @@ describe('ScProvider', () => {
await provider.connect(undefined, mockedHealthChecker.healthChecker);
expect(() => provider.clone()).toThrowError();
expect(() => provider.clone()).toThrow();
});
});
@@ -306,9 +304,9 @@ describe('ScProvider', () => {
setChainSyncyingStatus(false);
await expect(provider.connect(undefined, mockedHealthChecker.healthChecker)).rejects.toThrowError(
'Already connected!'
);
await expect(
provider.connect(undefined, mockedHealthChecker.healthChecker)
).rejects.toThrow(/Already connected/);
});
});
@@ -328,9 +326,8 @@ describe('ScProvider', () => {
const provider = new ScProvider(mockSc, '');
await provider.connect(undefined, mockedHealthChecker.healthChecker);
await provider.disconnect();
await expect(provider.disconnect()).resolves.not.toThrow();
await provider.disconnect();
});
});
@@ -402,9 +399,9 @@ describe('ScProvider', () => {
throw new Error('boom!');
});
await expect(provider.send('getData', ['foo'])).rejects.toThrowError(
'Disconnected'
);
await expect(
provider.send('getData', ['foo'])
).rejects.toThrow(/Disconnected/);
expect(provider.isConnected).toBe(false);
});
});
@@ -551,8 +548,7 @@ describe('ScProvider', () => {
expect(token).toBe(unsubscribeToken);
expect(cb).toHaveBeenCalledTimes(1);
expect(cb.mock.lastCall![0]).toBeInstanceOf(Error);
expect(cb.mock.lastCall![1]).toBe(undefined);
expect(cb).toHaveBeenLastCalledWith(expect.any(Error), undefined);
});
it('errors when subscribing to an unsupported method', async () => {
@@ -561,11 +557,11 @@ describe('ScProvider', () => {
await provider.connect(undefined, mockedHealthChecker.healthChecker);
setChainSyncyingStatus(false);
await wait(0);
await wait(0);
await expect(
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);
await expect(provider.unsubscribe('', '', '')).rejects.toThrowError(
'Unable to find active subscription=::'
);
await expect(
provider.unsubscribe('', '', '')
).rejects.toThrow(/Unable to find active subscription/);
});
});
+11 -9
View File
@@ -67,18 +67,20 @@ export interface ProviderInterface {
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 {
active: {
requests: number;
subscriptions: number;
};
total: {
bytesRecv: number;
bytesSent: number;
cached: number;
errors: number;
requests: number;
subscriptions: number;
timeout: number;
};
total: EndpointStats;
}
+55 -46
View File
@@ -1,99 +1,109 @@
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
// 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 { WsProvider } from './';
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));
}
describe('onConnect', (): void => {
let mocks: Mock[];
let provider: WsProvider | null;
beforeEach((): void => {
jest.setTimeout(30000);
mocks = [mockWs([], TEST_WS_URL)];
});
afterEach((): void => {
jest.setTimeout(5000);
mocks.forEach((m) => {
if (m) {
m.done();
}
});
afterEach(async () => {
if (provider) {
await provider.disconnect();
await sleep();
provider = null;
}
await Promise.all(mocks.map((m) => m.done()));
await sleep();
});
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);
await provider.connect();
await sleepMs(100); // Hack to give the provider time to connect
await sleep();
expect(provider.isConnected).toBe(true);
await provider.disconnect();
await sleep();
await sleepMs(100); // Hack to give the provider time to connect
expect(provider.isConnected).toBe(false);
});
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);
await provider.disconnect();
});
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(mocks[0].server.clients().length).toBe(0);
await provider.connect();
await sleepMs(100); // Hack to give the provider time to connect
await sleep();
expect(provider.isConnected).toBe(true);
expect(mocks[0].server.clients()).toHaveLength(1);
await provider.disconnect();
});
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 sleepMs(100); // Hack to give the provider time to connect
await sleep();
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);
await provider.disconnect();
await expect(
provider.connect()
).rejects.toThrow(/already connected/);
});
it('Connects to the second endpoint when the first is unreachable', async () => {
/* eslint-disable @typescript-eslint/no-empty-function */
jest.spyOn(console, 'error').mockImplementation((): void => {});
const endpoints: string[] = ['ws://localhost-unreachable-connect.spec.ts:9956', TEST_WS_URL];
const endpoints: string[] = ['ws://localhost-connect.spec.ts:9956', TEST_WS_URL];
const provider: WsProvider = new WsProvider(endpoints, 1);
provider = 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);
await provider.disconnect();
});
it('Connects to the second endpoint when the first is dropped', async () => {
@@ -101,22 +111,22 @@ describe('onConnect', (): void => {
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
expect(mocks[0].server.clients()).toHaveLength(1);
expect(mocks[1].server.clients()).toHaveLength(0);
// Close connection from first server
mocks[0].server.clients()[0].close();
await sleepMs(100);
await sleep();
// Check that second server is connected
expect(mocks[1].server.clients()).toHaveLength(1);
expect(provider.isConnected).toBe(true);
await provider.disconnect();
});
it('Round-robin of endpoints on WsProvider', async () => {
@@ -138,22 +148,21 @@ describe('onConnect', (): void => {
mocks[3],
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++) {
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(mockNext[mock].server.clients()).toHaveLength(0);
expect(provider.isConnected).toBe(true);
// Close connection from first server
mocks[mock].server.clients()[0].close();
}
}
await provider.disconnect();
});
});
+11 -13
View File
@@ -22,22 +22,20 @@ const known: Record<number, string> = {
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 {
if (code >= 0 && code <= 999) {
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)';
}
+7 -4
View File
@@ -1,6 +1,9 @@
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
// 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 { mockWs } from '../mock/mockWs';
@@ -22,7 +25,7 @@ function createWs (requests: Request[], autoConnect = 1000, headers?: Record<str
describe('Ws', (): void => {
afterEach(async () => {
if (mock) {
mock.done();
await mock.done();
}
if (provider) {
@@ -58,7 +61,7 @@ describe('Endpoint Parsing', (): void => {
it('Throws when WsProvider endpoint is an invalid string', () => {
expect(
() => 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', () => {
@@ -73,7 +76,7 @@ describe('Endpoint Parsing', (): void => {
expect(
() => 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', () => {
@@ -81,6 +84,6 @@ describe('Endpoint Parsing', (): void => {
expect(
() => new WsProvider(endpoints, 0)
).toThrowError(/^Endpoint should start with /);
).toThrow(/^Endpoint should start with /);
});
});
+47 -21
View File
@@ -3,7 +3,7 @@
/* 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';
@@ -45,8 +45,6 @@ const RETRY_DELAY = 2_500;
const DEFAULT_TIMEOUT_MS = 60 * 1000;
const TIMEOUT_INTERVAL = 5_000;
const MEGABYTE = 1024 * 1024;
const l = logger('api-ws');
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
*
@@ -92,6 +94,7 @@ export class WsProvider implements ProviderInterface {
#autoConnectMs: number;
#endpointIndex: number;
#endpointStats: EndpointStats;
#isConnected = false;
#subscriptions: Record<string, WsStateSubscription> = {};
#timeoutId?: ReturnType<typeof setInterval> | null = null;
@@ -128,8 +131,9 @@ export class WsProvider implements ProviderInterface {
this.#websocket = null;
this.#stats = {
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;
if (autoConnectMs > 0) {
@@ -174,6 +178,10 @@ export class WsProvider implements ProviderInterface {
return this.#isReadyPromise;
}
public get endpoint (): string {
return this.#endpoints[this.#endpointIndex];
}
/**
* @description Returns a clone of the object
*/
@@ -181,6 +189,10 @@ export class WsProvider implements ProviderInterface {
return new WsProvider(this.#endpoints);
}
protected selectEndpointIndex (endpoints: string[]): number {
return (this.#endpointIndex + 1) % endpoints.length;
}
/**
* @summary Manually connect
* @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
public async connect (): Promise<void> {
if (this.#websocket) {
throw new Error('WebSocket is already connected');
}
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
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
// @ts-ignore - WS may be an instance of w3cwebsocket, which supports headers
: new WebSocket(this.#endpoints[this.#endpointIndex], undefined, undefined, this.#headers, undefined, {
// default: true
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
// @ts-ignore - WS may be an instance of ws, which supports options
: new WebSocket(this.endpoint, undefined, {
headers: this.#headers
});
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.
* @param {ProviderInterfaceEmitted} type Event
@@ -298,6 +311,7 @@ export class WsProvider implements ProviderInterface {
* @param subscription Subscription details (internally used)
*/
public send <T = any> (method: string, params: unknown[], isCacheable?: boolean, subscription?: SubscriptionHandler): Promise<T> {
this.#endpointStats.requests++;
this.#stats.total.requests++;
const [id, body] = this.#coder.encodeJson(method, params);
@@ -312,6 +326,7 @@ export class WsProvider implements ProviderInterface {
this.#callCache.set(body, resultPromise);
}
} else {
this.#endpointStats.cached++;
this.#stats.total.cached++;
}
@@ -340,9 +355,11 @@ export class WsProvider implements ProviderInterface {
start: Date.now(),
subscription
};
this.#endpointStats.bytesSent += body.length;
this.#stats.total.bytesSent += body.length;
this.#websocket.send(body);
} catch (error) {
this.#endpointStats.errors++;
this.#stats.total.errors++;
reject(error);
@@ -369,6 +386,7 @@ export class WsProvider implements ProviderInterface {
* ```
*/
public subscribe (type: string, method: string, params: unknown[], callback: ProviderInterfaceCallback): Promise<number | string> {
this.#endpointStats.subscriptions++;
this.#stats.total.subscriptions++;
// subscriptions are not cached, LRU applies to .at(<blockHash>) only
@@ -407,7 +425,7 @@ export class WsProvider implements ProviderInterface {
};
#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) {
l.error(error.message);
@@ -428,8 +446,6 @@ export class WsProvider implements ProviderInterface {
this.#timeoutId = null;
}
this.#emit('disconnected');
// reject all hanging requests
eraseRecord(this.#handlers, (h) => {
try {
@@ -441,6 +457,11 @@ export class WsProvider implements ProviderInterface {
});
eraseRecord(this.#waitingForId);
// Reset stats for active endpoint
this.#endpointStats = defaultEndpointStats();
this.#emit('disconnected');
if (this.#autoConnectMs > 0) {
setTimeout((): void => {
this.connectWithRetry().catch(() => {
@@ -458,6 +479,7 @@ export class WsProvider implements ProviderInterface {
#onSocketMessage = (message: MessageEvent<string>): void => {
l.debug(() => ['received', message.data]);
this.#endpointStats.bytesRecv += message.data.length;
this.#stats.total.bytesRecv += message.data.length;
const response = JSON.parse(message.data) as JsonRpcResponse;
@@ -498,6 +520,7 @@ export class WsProvider implements ProviderInterface {
}
}
} catch (error) {
this.#endpointStats.errors++;
this.#stats.total.errors++;
handler.callback(error as Error, undefined);
@@ -528,6 +551,7 @@ export class WsProvider implements ProviderInterface {
handler.callback(null, result);
} catch (error) {
this.#endpointStats.errors++;
this.#stats.total.errors++;
handler.callback(error as Error, undefined);
@@ -539,13 +563,14 @@ export class WsProvider implements ProviderInterface {
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.#emit('connected');
this.#resubscribe();
this.#emit('connected');
return true;
};
@@ -586,6 +611,7 @@ export class WsProvider implements ProviderInterface {
// ignore
}
this.#endpointStats.timeout++;
this.#stats.total.timeout++;
delete this.#handlers[ids[i]];
}
+5 -3
View File
@@ -1,7 +1,9 @@
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
// 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 { mockWs } from '../mock/mockWs';
@@ -26,7 +28,7 @@ function createWs (autoConnect = 1000): Promise<WsProvider> {
}
describe('send', (): void => {
let globalWs: Constructor<WebSocket>;
let globalWs: typeof WebSocket;
beforeEach((): void => {
globalWs = global.WebSocket;
@@ -36,7 +38,7 @@ describe('send', (): void => {
global.WebSocket = globalWs;
if (mock) {
mock.done();
await mock.done();
}
if (provider) {
@@ -1,6 +1,9 @@
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
// SPDX-License-Identifier: Apache-2.0
// eslint-disable-next-line spaced-comment
/// <reference types="@polkadot/dev/node/test/node" />
import { WsProvider } from './';
describe('state', (): void => {
@@ -1,7 +1,9 @@
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
// 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 { Global, Mock } from './../mock/types';
@@ -26,7 +28,7 @@ function createWs (autoConnect = 1000): Promise<WsProvider> {
}
describe('subscribe', (): void => {
let globalWs: Constructor<WebSocket>;
let globalWs: typeof WebSocket;
beforeEach((): void => {
globalWs = global.WebSocket;
@@ -36,7 +38,7 @@ describe('subscribe', (): void => {
global.WebSocket = globalWs;
if (mock) {
mock.done();
await mock.done();
}
if (provider) {
@@ -1,7 +1,9 @@
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
// 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 { Global, Mock } from './../mock/types';
@@ -26,7 +28,7 @@ function createWs (autoConnect = 1000): Promise<WsProvider> {
}
describe('subscribe', (): void => {
let globalWs: Constructor<WebSocket>;
let globalWs: typeof WebSocket;
beforeEach((): void => {
globalWs = global.WebSocket;
@@ -36,7 +38,7 @@ describe('subscribe', (): void => {
global.WebSocket = globalWs;
if (mock) {
mock.done();
await mock.done();
}
if (provider) {
@@ -45,7 +47,7 @@ describe('subscribe', (): void => {
}
});
it('removes subscriptions', (): Promise<boolean> => {
it('removes subscriptions', async (): Promise<void> => {
createMock([
{
id: 1,
@@ -63,7 +65,7 @@ describe('subscribe', (): void => {
}
]);
return createWs().then((ws) =>
await createWs().then((ws) =>
ws
.subscribe('test', 'subscribe_test', [], (cb): void => {
expect(cb).toEqual(expect.anything());
+20 -23
View File
@@ -20,34 +20,31 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "9.13.6",
"version": "10.0.1",
"main": "index.js",
"bin": {
"polkadot-types-chain-info": "./scripts/polkadot-types-chain-info.cjs",
"polkadot-types-from-chain": "./scripts/polkadot-types-from-chain.cjs",
"polkadot-types-from-defs": "./scripts/polkadot-types-from-defs.cjs",
"polkadot-types-internal-interfaces": "./scripts/polkadot-types-internal-interfaces.cjs",
"polkadot-types-internal-metadata": "./scripts/polkadot-types-internal-metadata.cjs"
"polkadot-types-chain-info": "./scripts/polkadot-types-chain-info.mjs",
"polkadot-types-from-chain": "./scripts/polkadot-types-from-chain.mjs",
"polkadot-types-from-defs": "./scripts/polkadot-types-from-defs.mjs",
"polkadot-types-internal-interfaces": "./scripts/polkadot-types-internal-interfaces.mjs",
"polkadot-types-internal-metadata": "./scripts/polkadot-types-internal-metadata.mjs"
},
"dependencies": {
"@babel/core": "^7.20.12",
"@babel/register": "^7.18.9",
"@babel/runtime": "^7.20.13",
"@polkadot/api": "9.13.6",
"@polkadot/api-augment": "9.13.6",
"@polkadot/rpc-augment": "9.13.6",
"@polkadot/rpc-provider": "9.13.6",
"@polkadot/types": "9.13.6",
"@polkadot/types-augment": "9.13.6",
"@polkadot/types-codec": "9.13.6",
"@polkadot/types-create": "9.13.6",
"@polkadot/types-support": "9.13.6",
"@polkadot/util": "^10.3.1",
"@polkadot/util-crypto": "^10.3.1",
"@polkadot/x-ws": "^10.3.1",
"@polkadot/api": "10.0.1",
"@polkadot/api-augment": "10.0.1",
"@polkadot/rpc-augment": "10.0.1",
"@polkadot/rpc-provider": "10.0.1",
"@polkadot/types": "10.0.1",
"@polkadot/types-augment": "10.0.1",
"@polkadot/types-codec": "10.0.1",
"@polkadot/types-create": "10.0.1",
"@polkadot/types-support": "10.0.1",
"@polkadot/util": "^11.0.1",
"@polkadot/util-crypto": "^11.0.1",
"@polkadot/x-ws": "^11.0.1",
"handlebars": "^4.7.7",
"websocket": "^1.0.34",
"yargs": "^17.6.2"
"tslib": "^2.5.0",
"yargs": "^17.7.1"
},
"devDependencies": {
"@types/websocket": "^1.0.5",
-36
View File
@@ -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();
};
@@ -2,4 +2,6 @@
// Copyright 2017-2023 @polkadot/typegen authors & contributors
// SPDX-License-Identifier: Apache-2.0
require('./execWithSrc.cjs')('fromChain');
import { main } from '@polkadot/typegen/extractChain';
main();
@@ -2,4 +2,6 @@
// Copyright 2017-2023 @polkadot/typegen authors & contributors
// SPDX-License-Identifier: Apache-2.0
require('./execWithSrc.cjs')('interfacesTs');
import { main } from '@polkadot/typegen/fromChain';
main();
@@ -2,4 +2,6 @@
// Copyright 2017-2023 @polkadot/typegen authors & contributors
// 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');
@@ -2,4 +2,6 @@
// Copyright 2017-2023 @polkadot/typegen authors & contributors
// SPDX-License-Identifier: Apache-2.0
require('./execWithSrc.cjs')('extractChain');
import { main } from '@polkadot/typegen/metadataMd';
main();
+33 -16
View File
@@ -3,16 +3,17 @@
import type { HexString } from '@polkadot/util/types';
import fs from 'fs';
import path from 'path';
import yargs from 'yargs';
import { Definitions } from '@polkadot/types/types';
import { formatNumber } from '@polkadot/util';
import { Definitions, DefinitionsTypes } from '@polkadot/types/types';
import { formatNumber, isHex } from '@polkadot/util';
import { generateDefaultConsts, generateDefaultErrors, generateDefaultEvents, generateDefaultQuery, generateDefaultRpc, generateDefaultRuntime, generateDefaultTx } from './generate';
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`);
const outputPath = assertDir(path.join(process.cwd(), output));
@@ -21,9 +22,12 @@ function generate (metaHex: HexString, pkg: string | undefined, output: string,
if (pkg) {
try {
const defPath = assertFile(path.join(outputPath, 'definitions.ts'));
const defCont = await import(defPath) as { module: any };
extraTypes = {
// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-argument
[pkg]: require(assertFile(path.join(outputPath, 'definitions.ts'))) as Record<string, any>
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
[pkg]: defCont.module
};
} catch (error) {
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 {
const lookPath = assertFile(path.join(outputPath, 'lookup.ts'));
const lookCont = await import(lookPath) as { module: { default: DefinitionsTypes } };
customLookupDefinitions = {
rpc: {},
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-var-requires
types: require(assertFile(path.join(outputPath, 'lookup.ts'))).default
types: lookCont.module.default
};
} catch (error) {
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 };
export function main (): void {
async function mainPromise (): Promise<void> {
const { endpoint, output, package: pkg, strict: isStrict } = yargs.strict().options({
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',
@@ -86,14 +92,25 @@ export function main (): void {
}
}).argv as ArgV;
if (endpoint.startsWith('wss://') || endpoint.startsWith('ws://')) {
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;
let metadata: HexString;
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));
}
+25 -11
View File
@@ -3,10 +3,12 @@
import type { HexString } from '@polkadot/util/types';
import fs from 'fs';
import path from 'path';
import yargs from 'yargs';
import * as substrateDefs from '@polkadot/types/interfaces/definitions';
import { isHex } from '@polkadot/util';
import { generateInterfaceTypes } from './generate/interfaceRegistry';
import { generateTsDef } from './generate/tsDef';
@@ -15,7 +17,7 @@ import { assertDir, assertFile, getMetadataViaWs } from './util';
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({
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',
@@ -37,8 +39,9 @@ export function main (): void {
let userDefs: Record<string, any> = {};
try {
// eslint-disable-next-line @typescript-eslint/no-var-requires
userDefs = require(assertFile(path.join(inputPath, 'definitions.ts'))) as Record<string, any>;
userDefs = await import(
assertFile(path.join(inputPath, 'definitions.ts'))
) as Record<string, any>;
} catch (error) {
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'));
if (endpoint) {
if (endpoint.startsWith('wss://') || endpoint.startsWith('ws://')) {
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;
let metadata: HexString;
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));
}
+2 -4
View File
@@ -50,16 +50,14 @@ function entrySignature (lookup: PortableRegistry, allDefs: Record<string, Modul
storageEntry.modifier.isOptional
? 'Option'
: null,
defValue.lookupName
? undefined
: defValue.type
defValue.lookupName || defValue.type
]);
return [
storageEntry.modifier.isOptional,
keyDefs.map((k) => formatType(registry, allDefs, k.lookupName || k.type, imports)).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)
];
}
+1 -1
View File
@@ -5,7 +5,7 @@ import type { MetadataLatest, SiLookupTypeId } from '@polkadot/types/interfaces'
import type { PortableRegistry } from '@polkadot/types/metadata';
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 * as definitions from '@polkadot/types/interfaces/definitions';
+1 -1
View File
@@ -3,4 +3,4 @@
// 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 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/typegen authors & contributors
// SPDX-License-Identifier: Apache-2.0
import fs from 'fs';
import fs from 'node:fs';
import { assert } from '@polkadot/util';
+4 -6
View File
@@ -1,13 +1,15 @@
// Copyright 2017-2023 @polkadot/typegen authors & contributors
// 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 { getSimilarTypes } from './derived';
describe('getSimilarTypes', (): void => {
let registry: TypeRegistry;
const registry = new TypeRegistry();
const mockImports = {
codecTypes: {},
definitions: {},
@@ -22,10 +24,6 @@ describe('getSimilarTypes', (): void => {
typesTypes: {}
};
beforeAll((): void => {
registry = new TypeRegistry();
});
it('handles nested Tuples', (): void => {
expect(getSimilarTypes(registry, {}, '(AccountId, (Balance, u32), u64)', mockImports)).toEqual([
'ITuple<[AccountId, ITuple<[Balance, u32]>, u64]>',
+4 -3
View File
@@ -1,8 +1,9 @@
// Copyright 2017-2023 @polkadot/typegen authors & contributors
// SPDX-License-Identifier: Apache-2.0
import fs from 'fs';
import path from 'path';
import fs from 'node:fs';
import path from 'node:path';
import process from 'node:process';
import { packageInfo } from '../packageInfo';
@@ -25,7 +26,7 @@ export function writeFile (dest: string, generator: () => string, noLog?: boolea
export function readTemplate (template: string): string {
// Inside the api repo itself, it will be 'auto'
const rootDir = packageInfo.path === 'auto'
? path.join(__dirname, '..')
? path.join(process.cwd(), 'packages/typegen/src')
: packageInfo.path;
// NOTE With cjs in a subdir, search one lower as well
@@ -1,6 +1,9 @@
// Copyright 2017-2023 @polkadot/typegen authors & contributors
// 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 { formatType } from './formatting';
+5 -5
View File
@@ -20,12 +20,12 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "9.13.6",
"version": "10.0.1",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.20.13",
"@polkadot/types": "9.13.6",
"@polkadot/types-codec": "9.13.6",
"@polkadot/util": "^10.3.1"
"@polkadot/types": "10.0.1",
"@polkadot/types-codec": "10.0.1",
"@polkadot/util": "^11.0.1",
"tslib": "^2.5.0"
}
}
+2 -2
View File
@@ -5,7 +5,7 @@
export default {
/**
* Lookup108: kusama_runtime::SessionKeys
* Lookup107: kusama_runtime::SessionKeys
**/
KusamaRuntimeSessionKeys: {
grandpa: 'SpFinalityGrandpaAppPublic',
@@ -164,7 +164,7 @@ export default {
votes24: 'Vec<(Compact<u32>,[(Compact<u16>,Compact<PerU16>);23],Compact<u16>)>'
},
/**
* Lookup873: kusama_runtime::Runtime
* Lookup880: kusama_runtime::Runtime
**/
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