Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d0e0008399 | ||
|
|
a6eeba83c1 | ||
|
|
541eceae82 | ||
|
|
3d0a1701fa | ||
|
|
0e46592f4d | ||
|
|
a561253de9 | ||
|
|
0c6a4754f0 | ||
|
|
60dd4e9699 | ||
|
|
f10f79c0ac | ||
|
|
8394c71cfa | ||
|
|
dd0bd21d88 | ||
|
|
58875b8125 | ||
|
|
7e0586794a | ||
|
|
d800886ee0 | ||
|
|
0bdfc37096 | ||
|
|
db3b3f606b | ||
|
|
717043c557 | ||
|
|
8cee4c462a | ||
|
|
f6f1646147 | ||
|
|
dd533f9831 | ||
|
|
5ba13358a5 | ||
|
|
3a3680194d | ||
|
|
d436e42bb0 | ||
|
|
d6d1575ba9 | ||
|
|
15e5f4d401 | ||
|
|
f4c2b150d3 | ||
|
|
c1d727fbe8 | ||
|
|
475891575b | ||
|
|
02b7807ba5 | ||
|
|
d15f0b3ac5 | ||
|
|
e8f782e1f2 | ||
|
|
0f627bed2d | ||
|
|
427cf3e105 | ||
|
|
9e98f81dc0 | ||
|
|
f98422c42b | ||
|
|
267c6242a3 | ||
|
|
94cbbf5356 | ||
|
|
c1b1ad7843 | ||
|
|
ce5769471f | ||
|
|
09222d9055 | ||
|
|
9c4554ddb3 | ||
|
|
1ba4c0c277 | ||
|
|
ac46305d15 | ||
|
|
ad59abfc37 | ||
|
|
5a48ca3a0a | ||
|
|
d3dabadf95 | ||
|
|
212d0e33ae | ||
|
|
a6adeb739f | ||
|
|
cd440ea3c4 | ||
|
|
eb480d7ce9 | ||
|
|
298397f499 | ||
|
|
6b17bf5a7a | ||
|
|
3b3da09f33 | ||
|
|
976d708fae |
@@ -1,25 +0,0 @@
|
||||
// Copyright 2017-2023 @polkadot/api authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
const base = require('@polkadot/dev/config/eslint.cjs');
|
||||
|
||||
module.exports = {
|
||||
...base,
|
||||
ignorePatterns: [
|
||||
...base.ignorePatterns,
|
||||
'/scripts'
|
||||
],
|
||||
parserOptions: {
|
||||
...base.parserOptions,
|
||||
project: [
|
||||
'./tsconfig.eslint.json'
|
||||
]
|
||||
},
|
||||
rules: {
|
||||
...base.rules,
|
||||
// add override for any (a metric ton of them, initial conversion)
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
// this seems very broken atm, false positives
|
||||
'@typescript-eslint/unbound-method': 'off'
|
||||
}
|
||||
};
|
||||
@@ -21,5 +21,5 @@ jobs:
|
||||
- name: ${{ matrix.step }}
|
||||
if: always()
|
||||
run: |
|
||||
yarn install --immutable | grep -v 'YN0013'
|
||||
yarn install --immutable
|
||||
yarn ${{ matrix.step }}
|
||||
|
||||
@@ -27,5 +27,5 @@ jobs:
|
||||
node-version: 'lts/*'
|
||||
- name: ${{ matrix.step }}
|
||||
run: |
|
||||
yarn install --immutable | grep -v 'YN0013'
|
||||
yarn install --immutable
|
||||
yarn ${{ matrix.step }}
|
||||
|
||||
@@ -2,6 +2,11 @@ enableImmutableInstalls: false
|
||||
|
||||
enableProgressBars: false
|
||||
|
||||
logFilters:
|
||||
# Discard any "cannot be found in cache" messages
|
||||
- code: YN0013
|
||||
level: discard
|
||||
|
||||
nodeLinker: node-modules
|
||||
|
||||
plugins:
|
||||
|
||||
@@ -1,5 +1,49 @@
|
||||
# CHANGELOG
|
||||
|
||||
## 10.7.2 May 21, 2023
|
||||
|
||||
Contributed:
|
||||
|
||||
- Allow `api.setSigner(...)` to clear existing (Thanks to https://github.com/polymath-eric)
|
||||
|
||||
Changes:
|
||||
|
||||
- Adjust `@polkadot/types-create` exports with no duplicates
|
||||
|
||||
|
||||
## 10.7.1 May 13, 2023
|
||||
|
||||
Changes:
|
||||
|
||||
- Update to latest Polkadot, Kusama & Substrate metadata
|
||||
- Add `module` to `package.json` export map (ESM-only)
|
||||
|
||||
|
||||
## 10.6.1 May 7, 2023
|
||||
|
||||
Contributed:
|
||||
|
||||
- Extract runtime details for custom documentation (Thanks to https://github.com/FlorianFranzen)
|
||||
|
||||
Changes:
|
||||
|
||||
- Apply historic `Scheduled` types for Kusama (as reported, non-comprehensive)
|
||||
- Adjust Deno types inside `WsProvider`
|
||||
- Allow parsing of (experimental) metadata v15
|
||||
- Update to latest Polkadot, Kusama & Substrate metadata
|
||||
|
||||
|
||||
## 10.5.1 Apr 29, 2023
|
||||
|
||||
Changes:
|
||||
|
||||
- Default to hex-only in `Int/UInt.toJSON` for > 128-bit values
|
||||
- Allow for disabling of `isPedantic` storage checks in API options
|
||||
- Adjust usage of `objectSpread`, default to runtime as required
|
||||
- Adjust compilation output for `__internal__` class fields
|
||||
- Update to latest Polkadot, Kusama & Substrate metadata
|
||||
|
||||
|
||||
## 10.4.1 Apr 22, 2023
|
||||
|
||||
Contributed:
|
||||
|
||||
+4
-1
@@ -1,4 +1,4 @@
|
||||
3440 Jaco 10.4.1 (#5607)
|
||||
3464 Jaco 10.7.2 (#5652)
|
||||
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)
|
||||
@@ -64,6 +64,7 @@
|
||||
1 Drew Stone Update evm definitions to include vicinity (#2279)
|
||||
1 Dylan Galea Updated users of the polkadot-js/api (#2027)
|
||||
1 flex Change BeefySignedCommitment signatures type to EcdsaSignature (#4204)
|
||||
1 Florian Franzen metadataMd: use endpoint for rpc and runtime details too (#5628)
|
||||
1 Furqan A fix: fixed 404 to the docs from the api readme (#3985)
|
||||
1 Gérard Dethier Fix LRUCache memory leak. (#4520)
|
||||
1 Gerben van de Wiel Adding some extra notes on changes in the specname (#2329)
|
||||
@@ -97,6 +98,7 @@
|
||||
1 Paul M Fox Basic BTreeMaps codec support (#1474)
|
||||
1 philipstanislaus Update types for centrifuge chain v1.2.0 (#2424)
|
||||
1 Pierre Krieger Update substrate/connect to 0.7.6 (#4940)
|
||||
1 polymath-eric Allow unset external signer (#5649)
|
||||
1 Qinxuan Chen Add fp_account::AccountId20 mapping (#5551)
|
||||
1 qiuhao update DeriveCustom type (#2581)
|
||||
1 r0t0r-r0t0r Fix memory leak on raw rpc call (#4505)
|
||||
@@ -112,6 +114,7 @@
|
||||
1 Sergei Pepyakin INK! -> ink! (#1347)
|
||||
1 Shunji Zhan small polish (#5276)
|
||||
1 Stephen Shelton Add transaction-payment runtime API V3 (#5430)
|
||||
1 Tarik Gul Update .nvmrc (#5624)
|
||||
1 WoeOm adapt Darwinia, Crab Network types (#3498)
|
||||
1 Xat_MassacrE Fix packages/types/src/codec/utils/encodeTypes.ts encodeSubTypes bug (#1544)
|
||||
1 yjh fix MetadataVersioned.asV12 (#2983)
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
// Copyright 2017-2023 @polkadot/dev authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import baseConfig from '@polkadot/dev/config/eslint';
|
||||
|
||||
export default [
|
||||
...baseConfig,
|
||||
{
|
||||
rules: {
|
||||
// add override for any (a metric ton of them, initial conversion)
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
// we generally use this in isFunction, not via calling
|
||||
'@typescript-eslint/unbound-method': 'off'
|
||||
}
|
||||
}
|
||||
];
|
||||
+5
-5
@@ -14,10 +14,10 @@
|
||||
},
|
||||
"sideEffects": false,
|
||||
"type": "module",
|
||||
"version": "10.4.1",
|
||||
"version": "10.7.2",
|
||||
"versions": {
|
||||
"git": "10.4.1",
|
||||
"npm": "10.4.1"
|
||||
"git": "10.7.2",
|
||||
"npm": "10.7.2"
|
||||
},
|
||||
"workspaces": [
|
||||
"packages/*"
|
||||
@@ -40,9 +40,9 @@
|
||||
"test:one": "polkadot-dev-run-test --env node"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/dev": "^0.73.2",
|
||||
"@polkadot/dev": "^0.75.4",
|
||||
"@polkadot/typegen": "workspace:packages/typegen",
|
||||
"@types/node": "^18.15.13"
|
||||
"@types/node": "^20.2.1"
|
||||
},
|
||||
"resolutions": {
|
||||
"typescript": "^5.0.4"
|
||||
|
||||
@@ -18,15 +18,15 @@
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "10.4.1",
|
||||
"version": "10.7.2",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@polkadot/api-base": "10.4.1",
|
||||
"@polkadot/rpc-augment": "10.4.1",
|
||||
"@polkadot/types": "10.4.1",
|
||||
"@polkadot/types-augment": "10.4.1",
|
||||
"@polkadot/types-codec": "10.4.1",
|
||||
"@polkadot/util": "^12.0.1",
|
||||
"tslib": "^2.5.0"
|
||||
"@polkadot/api-base": "10.7.2",
|
||||
"@polkadot/rpc-augment": "10.7.2",
|
||||
"@polkadot/types": "10.7.2",
|
||||
"@polkadot/types-augment": "10.7.2",
|
||||
"@polkadot/types-codec": "10.7.2",
|
||||
"@polkadot/util": "^12.2.1",
|
||||
"tslib": "^2.5.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1296,11 +1296,6 @@ declare module '@polkadot/api-base/types/errors' {
|
||||
* Para is not registered in our system.
|
||||
**/
|
||||
NotRegistered: AugmentedError<ApiType>;
|
||||
/**
|
||||
* The PVF pre-checking statement cannot be included since the PVF pre-checking mechanism
|
||||
* is disabled.
|
||||
**/
|
||||
PvfCheckDisabled: AugmentedError<ApiType>;
|
||||
/**
|
||||
* The given validator already has cast a vote.
|
||||
**/
|
||||
@@ -2103,7 +2098,7 @@ declare module '@polkadot/api-base/types/errors' {
|
||||
**/
|
||||
Filtered: AugmentedError<ApiType>;
|
||||
/**
|
||||
* The unlock operation cannot succeed because there are still users of the lock.
|
||||
* The unlock operation cannot succeed because there are still consumers of the lock.
|
||||
**/
|
||||
InUse: AugmentedError<ApiType>;
|
||||
/**
|
||||
|
||||
@@ -1024,6 +1024,7 @@ declare module '@polkadot/api-base/types/events' {
|
||||
Deregistered: AugmentedEvent<ApiType, [paraId: u32], { paraId: u32 }>;
|
||||
Registered: AugmentedEvent<ApiType, [paraId: u32, manager: AccountId32], { paraId: u32, manager: AccountId32 }>;
|
||||
Reserved: AugmentedEvent<ApiType, [paraId: u32, who: AccountId32], { paraId: u32, who: AccountId32 }>;
|
||||
Swapped: AugmentedEvent<ApiType, [paraId: u32, otherId: u32], { paraId: u32, otherId: u32 }>;
|
||||
/**
|
||||
* Generic event
|
||||
**/
|
||||
|
||||
@@ -413,6 +413,8 @@ declare module '@polkadot/api-base/types/storage' {
|
||||
minimumUntrustedScore: AugmentedQuery<ApiType, () => Observable<Option<SpNposElectionsElectionScore>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
/**
|
||||
* Current best solution, signed or unsigned, queued to be returned upon `elect`.
|
||||
*
|
||||
* Always sorted by score.
|
||||
**/
|
||||
queuedSolution: AugmentedQuery<ApiType, () => Observable<Option<PalletElectionProviderMultiPhaseReadySolution>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
/**
|
||||
@@ -998,15 +1000,6 @@ declare module '@polkadot/api-base/types/storage' {
|
||||
* The primary structure that holds all offence records keyed by report identifiers.
|
||||
**/
|
||||
reports: AugmentedQuery<ApiType, (arg: H256 | string | Uint8Array) => Observable<Option<SpStakingOffenceOffenceDetails>>, [H256]> & QueryableStorageEntry<ApiType, [H256]>;
|
||||
/**
|
||||
* Enumerates all reports of a kind along with the time they happened.
|
||||
*
|
||||
* All reports are sorted by the time of offence.
|
||||
*
|
||||
* Note that the actual type of this mapping is `Vec<u8>`, this is because values of
|
||||
* different types are not supported at the moment so we are doing the manual serialization.
|
||||
**/
|
||||
reportsByKindIndex: AugmentedQuery<ApiType, (arg: U8aFixed | string | Uint8Array) => Observable<Bytes>, [U8aFixed]> & QueryableStorageEntry<ApiType, [U8aFixed]>;
|
||||
/**
|
||||
* Generic query
|
||||
**/
|
||||
@@ -2115,6 +2108,10 @@ declare module '@polkadot/api-base/types/storage' {
|
||||
* of our versions we informed them of.
|
||||
**/
|
||||
versionNotifyTargets: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: XcmVersionedMultiLocation | { V2: any } | { V3: any } | string | Uint8Array) => Observable<Option<ITuple<[u64, SpWeightsWeightV2Weight, u32]>>>, [u32, XcmVersionedMultiLocation]> & QueryableStorageEntry<ApiType, [u32, XcmVersionedMultiLocation]>;
|
||||
/**
|
||||
* Global suspension state of the XCM executor.
|
||||
**/
|
||||
xcmExecutionSuspended: AugmentedQuery<ApiType, () => Observable<bool>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
/**
|
||||
* Generic query
|
||||
**/
|
||||
|
||||
@@ -3493,7 +3493,6 @@ declare module '@polkadot/api-base/types/submittable' {
|
||||
/**
|
||||
* Make some on-chain remark.
|
||||
*
|
||||
* ## Complexity
|
||||
* - `O(1)`
|
||||
**/
|
||||
remark: AugmentedSubmittable<(remark: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes]>;
|
||||
@@ -3503,16 +3502,10 @@ declare module '@polkadot/api-base/types/submittable' {
|
||||
remarkWithEvent: AugmentedSubmittable<(remark: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes]>;
|
||||
/**
|
||||
* Set the new runtime code.
|
||||
*
|
||||
* ## Complexity
|
||||
* - `O(C + S)` where `C` length of `code` and `S` complexity of `can_set_code`
|
||||
**/
|
||||
setCode: AugmentedSubmittable<(code: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes]>;
|
||||
/**
|
||||
* Set the new runtime code without doing any checks of the given `code`.
|
||||
*
|
||||
* ## Complexity
|
||||
* - `O(C)` where `C` length of `code`
|
||||
**/
|
||||
setCodeWithoutChecks: AugmentedSubmittable<(code: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes]>;
|
||||
/**
|
||||
@@ -3875,22 +3868,29 @@ declare module '@polkadot/api-base/types/submittable' {
|
||||
* Set a safe XCM version (the version that XCM should be encoded with if the most recent
|
||||
* version a destination can accept is unknown).
|
||||
*
|
||||
* - `origin`: Must be Root.
|
||||
* - `origin`: Must be an origin specified by AdminOrigin.
|
||||
* - `maybe_xcm_version`: The default XCM encoding version, or `None` to disable.
|
||||
**/
|
||||
forceDefaultXcmVersion: AugmentedSubmittable<(maybeXcmVersion: Option<u32> | null | Uint8Array | u32 | AnyNumber) => SubmittableExtrinsic<ApiType>, [Option<u32>]>;
|
||||
/**
|
||||
* Ask a location to notify us regarding their XCM version and any changes to it.
|
||||
*
|
||||
* - `origin`: Must be Root.
|
||||
* - `origin`: Must be an origin specified by AdminOrigin.
|
||||
* - `location`: The location to which we should subscribe for XCM version notifications.
|
||||
**/
|
||||
forceSubscribeVersionNotify: AugmentedSubmittable<(location: XcmVersionedMultiLocation | { V2: any } | { V3: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [XcmVersionedMultiLocation]>;
|
||||
/**
|
||||
* Set or unset the global suspension state of the XCM executor.
|
||||
*
|
||||
* - `origin`: Must be an origin specified by AdminOrigin.
|
||||
* - `suspended`: `true` to suspend, `false` to resume.
|
||||
**/
|
||||
forceSuspension: AugmentedSubmittable<(suspended: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [bool]>;
|
||||
/**
|
||||
* Require that a particular destination should no longer notify us regarding any XCM
|
||||
* version changes.
|
||||
*
|
||||
* - `origin`: Must be Root.
|
||||
* - `origin`: Must be an origin specified by AdminOrigin.
|
||||
* - `location`: The location to which we are currently subscribed for XCM version
|
||||
* notifications which we no longer desire.
|
||||
**/
|
||||
@@ -3899,7 +3899,7 @@ declare module '@polkadot/api-base/types/submittable' {
|
||||
* Extoll that a particular destination can be communicated with through a particular
|
||||
* version of XCM.
|
||||
*
|
||||
* - `origin`: Must be Root.
|
||||
* - `origin`: Must be an origin specified by AdminOrigin.
|
||||
* - `location`: The destination that is being described.
|
||||
* - `xcm_version`: The latest version of XCM that `location` supports.
|
||||
**/
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
|
||||
export const packageInfo = { name: '@polkadot/api-augment', path: 'auto', type: 'auto', version: '10.4.1' };
|
||||
export const packageInfo = { name: '@polkadot/api-augment', path: 'auto', type: 'auto', version: '10.7.2' };
|
||||
|
||||
@@ -1232,11 +1232,6 @@ declare module '@polkadot/api-base/types/errors' {
|
||||
* Para is not registered in our system.
|
||||
**/
|
||||
NotRegistered: AugmentedError<ApiType>;
|
||||
/**
|
||||
* The PVF pre-checking statement cannot be included since the PVF pre-checking mechanism
|
||||
* is disabled.
|
||||
**/
|
||||
PvfCheckDisabled: AugmentedError<ApiType>;
|
||||
/**
|
||||
* The given validator already has cast a vote.
|
||||
**/
|
||||
@@ -1308,6 +1303,37 @@ declare module '@polkadot/api-base/types/errors' {
|
||||
**/
|
||||
[key: string]: AugmentedError<ApiType>;
|
||||
};
|
||||
parasSlashing: {
|
||||
/**
|
||||
* The given slashing report is valid but already previously reported.
|
||||
**/
|
||||
DuplicateSlashingReport: AugmentedError<ApiType>;
|
||||
/**
|
||||
* The candidate hash is invalid.
|
||||
**/
|
||||
InvalidCandidateHash: AugmentedError<ApiType>;
|
||||
/**
|
||||
* The key ownership proof is invalid.
|
||||
**/
|
||||
InvalidKeyOwnershipProof: AugmentedError<ApiType>;
|
||||
/**
|
||||
* The session index is too old or invalid.
|
||||
**/
|
||||
InvalidSessionIndex: AugmentedError<ApiType>;
|
||||
/**
|
||||
* There is no pending slash for the given validator index and time
|
||||
* slot.
|
||||
**/
|
||||
InvalidValidatorIndex: AugmentedError<ApiType>;
|
||||
/**
|
||||
* The validator index does not match the validator id.
|
||||
**/
|
||||
ValidatorIndexIdMismatch: AugmentedError<ApiType>;
|
||||
/**
|
||||
* Generic error
|
||||
**/
|
||||
[key: string]: AugmentedError<ApiType>;
|
||||
};
|
||||
phragmenElection: {
|
||||
/**
|
||||
* Duplicated candidate submission.
|
||||
@@ -2028,7 +2054,7 @@ declare module '@polkadot/api-base/types/errors' {
|
||||
**/
|
||||
Filtered: AugmentedError<ApiType>;
|
||||
/**
|
||||
* The unlock operation cannot succeed because there are still users of the lock.
|
||||
* The unlock operation cannot succeed because there are still consumers of the lock.
|
||||
**/
|
||||
InUse: AugmentedError<ApiType>;
|
||||
/**
|
||||
|
||||
@@ -934,6 +934,7 @@ declare module '@polkadot/api-base/types/events' {
|
||||
Deregistered: AugmentedEvent<ApiType, [paraId: u32], { paraId: u32 }>;
|
||||
Registered: AugmentedEvent<ApiType, [paraId: u32, manager: AccountId32], { paraId: u32, manager: AccountId32 }>;
|
||||
Reserved: AugmentedEvent<ApiType, [paraId: u32, who: AccountId32], { paraId: u32, who: AccountId32 }>;
|
||||
Swapped: AugmentedEvent<ApiType, [paraId: u32, otherId: u32], { paraId: u32, otherId: u32 }>;
|
||||
/**
|
||||
* Generic event
|
||||
**/
|
||||
|
||||
@@ -11,7 +11,7 @@ import type { BTreeSet, Bytes, Null, Option, U8aFixed, Vec, WrapperOpaque, bool,
|
||||
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, PalletBagsListListBag, PalletBagsListListNode, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesIdAmount, PalletBalancesReserveData, PalletBountiesBounty, PalletChildBountiesChildBounty, PalletCollectiveVotes, PalletConvictionVotingVoteVoting, 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, PalletReferendaReferendumInfo, PalletSchedulerScheduled, PalletStakingActiveEraInfo, PalletStakingEraRewardPoints, PalletStakingExposure, PalletStakingForcing, PalletStakingNominations, PalletStakingRewardDestination, PalletStakingSlashingSlashingSpans, PalletStakingSlashingSpanRecord, PalletStakingStakingLedger, PalletStakingUnappliedSlash, PalletStakingValidatorPrefs, PalletTipsOpenTip, PalletTransactionPaymentReleases, PalletTreasuryProposal, PalletVestingReleases, PalletVestingVestingInfo, PalletXcmQueryStatus, PalletXcmRemoteLockedFungibleRecord, PalletXcmVersionMigrationStage, PolkadotCorePrimitivesInboundDownwardMessage, PolkadotCorePrimitivesInboundHrmpMessage, PolkadotParachainPrimitivesHrmpChannelId, PolkadotPrimitivesV4AssignmentAppPublic, PolkadotPrimitivesV4CandidateCommitments, PolkadotPrimitivesV4CoreOccupied, PolkadotPrimitivesV4DisputeState, PolkadotPrimitivesV4ExecutorParams, PolkadotPrimitivesV4ScrapedOnChainVotes, PolkadotPrimitivesV4SessionInfo, PolkadotPrimitivesV4UpgradeGoAhead, PolkadotPrimitivesV4UpgradeRestriction, PolkadotPrimitivesV4ValidatorAppPublic, 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, PalletBalancesIdAmount, PalletBalancesReserveData, PalletBountiesBounty, PalletChildBountiesChildBounty, PalletCollectiveVotes, PalletConvictionVotingVoteVoting, 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, PalletReferendaReferendumInfo, PalletSchedulerScheduled, PalletStakingActiveEraInfo, PalletStakingEraRewardPoints, PalletStakingExposure, PalletStakingForcing, PalletStakingNominations, PalletStakingRewardDestination, PalletStakingSlashingSlashingSpans, PalletStakingSlashingSpanRecord, PalletStakingStakingLedger, PalletStakingUnappliedSlash, PalletStakingValidatorPrefs, PalletTipsOpenTip, PalletTransactionPaymentReleases, PalletTreasuryProposal, PalletVestingReleases, PalletVestingVestingInfo, PalletXcmQueryStatus, PalletXcmRemoteLockedFungibleRecord, PalletXcmVersionMigrationStage, PolkadotCorePrimitivesInboundDownwardMessage, PolkadotCorePrimitivesInboundHrmpMessage, PolkadotParachainPrimitivesHrmpChannelId, PolkadotPrimitivesV4AssignmentAppPublic, PolkadotPrimitivesV4CandidateCommitments, PolkadotPrimitivesV4CoreOccupied, PolkadotPrimitivesV4DisputeState, PolkadotPrimitivesV4ExecutorParams, PolkadotPrimitivesV4ScrapedOnChainVotes, PolkadotPrimitivesV4SessionInfo, PolkadotPrimitivesV4UpgradeGoAhead, PolkadotPrimitivesV4UpgradeRestriction, PolkadotPrimitivesV4ValidatorAppPublic, PolkadotRuntimeCommonClaimsStatementKind, PolkadotRuntimeCommonCrowdloanFundInfo, PolkadotRuntimeCommonParasRegistrarParaInfo, PolkadotRuntimeParachainsConfigurationHostConfiguration, PolkadotRuntimeParachainsDisputesSlashingPendingSlashes, 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>;
|
||||
@@ -512,6 +512,8 @@ declare module '@polkadot/api-base/types/storage' {
|
||||
minimumUntrustedScore: AugmentedQuery<ApiType, () => Observable<Option<SpNposElectionsElectionScore>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
/**
|
||||
* Current best solution, signed or unsigned, queued to be returned upon `elect`.
|
||||
*
|
||||
* Always sorted by score.
|
||||
**/
|
||||
queuedSolution: AugmentedQuery<ApiType, () => Observable<Option<PalletElectionProviderMultiPhaseReadySolution>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
/**
|
||||
@@ -950,15 +952,6 @@ declare module '@polkadot/api-base/types/storage' {
|
||||
* The primary structure that holds all offence records keyed by report identifiers.
|
||||
**/
|
||||
reports: AugmentedQuery<ApiType, (arg: H256 | string | Uint8Array) => Observable<Option<SpStakingOffenceOffenceDetails>>, [H256]> & QueryableStorageEntry<ApiType, [H256]>;
|
||||
/**
|
||||
* Enumerates all reports of a kind along with the time they happened.
|
||||
*
|
||||
* All reports are sorted by the time of offence.
|
||||
*
|
||||
* Note that the actual type of this mapping is `Vec<u8>`, this is because values of
|
||||
* different types are not supported at the moment so we are doing the manual serialization.
|
||||
**/
|
||||
reportsByKindIndex: AugmentedQuery<ApiType, (arg: U8aFixed | string | Uint8Array) => Observable<Bytes>, [U8aFixed]> & QueryableStorageEntry<ApiType, [U8aFixed]>;
|
||||
/**
|
||||
* Generic query
|
||||
**/
|
||||
@@ -1271,6 +1264,20 @@ declare module '@polkadot/api-base/types/storage' {
|
||||
**/
|
||||
[key: string]: QueryableStorageEntry<ApiType>;
|
||||
};
|
||||
parasSlashing: {
|
||||
/**
|
||||
* Validators pending dispute slashes.
|
||||
**/
|
||||
unappliedSlashes: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: H256 | string | Uint8Array) => Observable<Option<PolkadotRuntimeParachainsDisputesSlashingPendingSlashes>>, [u32, H256]> & QueryableStorageEntry<ApiType, [u32, H256]>;
|
||||
/**
|
||||
* `ValidatorSetCount` per session.
|
||||
**/
|
||||
validatorSetCounts: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Option<u32>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
|
||||
/**
|
||||
* Generic query
|
||||
**/
|
||||
[key: string]: QueryableStorageEntry<ApiType>;
|
||||
};
|
||||
phragmenElection: {
|
||||
/**
|
||||
* The present candidate list. A current member or runner-up can never enter this vector
|
||||
@@ -2058,6 +2065,10 @@ declare module '@polkadot/api-base/types/storage' {
|
||||
* of our versions we informed them of.
|
||||
**/
|
||||
versionNotifyTargets: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: XcmVersionedMultiLocation | { V2: any } | { V3: any } | string | Uint8Array) => Observable<Option<ITuple<[u64, SpWeightsWeightV2Weight, u32]>>>, [u32, XcmVersionedMultiLocation]> & QueryableStorageEntry<ApiType, [u32, XcmVersionedMultiLocation]>;
|
||||
/**
|
||||
* Global suspension state of the XCM executor.
|
||||
**/
|
||||
xcmExecutionSuspended: AugmentedQuery<ApiType, () => Observable<bool>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
/**
|
||||
* Generic query
|
||||
**/
|
||||
|
||||
@@ -11,7 +11,7 @@ import type { Bytes, Compact, Option, U8aFixed, Vec, bool, u128, u16, u32, u64,
|
||||
import type { AnyNumber, IMethod, ITuple } from '@polkadot/types-codec/types';
|
||||
import type { EthereumAddress } from '@polkadot/types/interfaces/eth';
|
||||
import type { AccountId32, Call, H256, MultiAddress, Perbill, Percent } from '@polkadot/types/interfaces/runtime';
|
||||
import type { FrameSupportPreimagesBounded, FrameSupportScheduleDispatchTime, PalletConvictionVotingConviction, PalletConvictionVotingVoteAccountVote, PalletDemocracyConviction, PalletDemocracyMetadataOwner, PalletDemocracyVoteAccountVote, PalletElectionProviderMultiPhaseRawSolution, PalletElectionProviderMultiPhaseSolutionOrSnapshotSize, PalletElectionsPhragmenRenouncing, PalletIdentityBitFlags, PalletIdentityIdentityInfo, PalletIdentityJudgement, PalletImOnlineHeartbeat, PalletImOnlineSr25519AppSr25519Signature, PalletMultisigTimepoint, PalletNominationPoolsBondExtra, PalletNominationPoolsClaimPermission, PalletNominationPoolsCommissionChangeRate, PalletNominationPoolsConfigOpAccountId32, PalletNominationPoolsConfigOpPerbill, PalletNominationPoolsConfigOpU128, PalletNominationPoolsConfigOpU32, PalletNominationPoolsPoolState, PalletStakingPalletConfigOpPerbill, PalletStakingPalletConfigOpPercent, PalletStakingPalletConfigOpU128, PalletStakingPalletConfigOpU32, PalletStakingRewardDestination, PalletStakingValidatorPrefs, PalletVestingVestingInfo, PolkadotParachainPrimitivesHrmpChannelId, PolkadotPrimitivesV4ExecutorParams, PolkadotPrimitivesV4InherentData, PolkadotPrimitivesV4PvfCheckStatement, PolkadotPrimitivesV4ValidatorAppSignature, PolkadotPrimitivesVstagingAsyncBackingParams, PolkadotRuntimeCommonClaimsEcdsaSignature, PolkadotRuntimeCommonClaimsStatementKind, PolkadotRuntimeOriginCaller, PolkadotRuntimeProxyType, PolkadotRuntimeSessionKeys, SpConsensusBabeDigestsNextConfigDescriptor, SpConsensusGrandpaEquivocationProof, SpConsensusSlotsEquivocationProof, SpNposElectionsElectionScore, SpNposElectionsSupport, SpRuntimeMultiSignature, SpRuntimeMultiSigner, SpSessionMembershipProof, SpWeightsWeightV2Weight, XcmV3MultiLocation, XcmV3WeightLimit, XcmVersionedMultiAssets, XcmVersionedMultiLocation, XcmVersionedXcm } from '@polkadot/types/lookup';
|
||||
import type { FrameSupportPreimagesBounded, FrameSupportScheduleDispatchTime, PalletConvictionVotingConviction, PalletConvictionVotingVoteAccountVote, PalletDemocracyConviction, PalletDemocracyMetadataOwner, PalletDemocracyVoteAccountVote, PalletElectionProviderMultiPhaseRawSolution, PalletElectionProviderMultiPhaseSolutionOrSnapshotSize, PalletElectionsPhragmenRenouncing, PalletIdentityBitFlags, PalletIdentityIdentityInfo, PalletIdentityJudgement, PalletImOnlineHeartbeat, PalletImOnlineSr25519AppSr25519Signature, PalletMultisigTimepoint, PalletNominationPoolsBondExtra, PalletNominationPoolsClaimPermission, PalletNominationPoolsCommissionChangeRate, PalletNominationPoolsConfigOpAccountId32, PalletNominationPoolsConfigOpPerbill, PalletNominationPoolsConfigOpU128, PalletNominationPoolsConfigOpU32, PalletNominationPoolsPoolState, PalletStakingPalletConfigOpPerbill, PalletStakingPalletConfigOpPercent, PalletStakingPalletConfigOpU128, PalletStakingPalletConfigOpU32, PalletStakingRewardDestination, PalletStakingValidatorPrefs, PalletVestingVestingInfo, PolkadotParachainPrimitivesHrmpChannelId, PolkadotPrimitivesV4ExecutorParams, PolkadotPrimitivesV4InherentData, PolkadotPrimitivesV4PvfCheckStatement, PolkadotPrimitivesV4ValidatorAppSignature, PolkadotPrimitivesVstagingAsyncBackingParams, PolkadotRuntimeCommonClaimsEcdsaSignature, PolkadotRuntimeCommonClaimsStatementKind, PolkadotRuntimeOriginCaller, PolkadotRuntimeParachainsDisputesSlashingDisputeProof, PolkadotRuntimeProxyType, PolkadotRuntimeSessionKeys, SpConsensusBabeDigestsNextConfigDescriptor, SpConsensusGrandpaEquivocationProof, SpConsensusSlotsEquivocationProof, SpNposElectionsElectionScore, SpNposElectionsSupport, SpRuntimeMultiSignature, SpRuntimeMultiSigner, SpSessionMembershipProof, SpWeightsWeightV2Weight, XcmV3MultiLocation, XcmV3WeightLimit, XcmVersionedMultiAssets, XcmVersionedMultiLocation, XcmVersionedXcm } from '@polkadot/types/lookup';
|
||||
|
||||
export type __AugmentedSubmittable = AugmentedSubmittable<() => unknown>;
|
||||
export type __SubmittableExtrinsic<ApiType extends ApiTypes> = SubmittableExtrinsic<ApiType>;
|
||||
@@ -2379,6 +2379,13 @@ declare module '@polkadot/api-base/types/submittable' {
|
||||
**/
|
||||
[key: string]: SubmittableExtrinsicFunction<ApiType>;
|
||||
};
|
||||
parasSlashing: {
|
||||
reportDisputeLostUnsigned: AugmentedSubmittable<(disputeProof: PolkadotRuntimeParachainsDisputesSlashingDisputeProof | { timeSlot?: any; kind?: any; validatorIndex?: any; validatorId?: any } | string | Uint8Array, keyOwnerProof: SpSessionMembershipProof | { session?: any; trieNodes?: any; validatorCount?: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [PolkadotRuntimeParachainsDisputesSlashingDisputeProof, SpSessionMembershipProof]>;
|
||||
/**
|
||||
* Generic tx
|
||||
**/
|
||||
[key: string]: SubmittableExtrinsicFunction<ApiType>;
|
||||
};
|
||||
phragmenElection: {
|
||||
/**
|
||||
* Clean all voters who are defunct (i.e. they do not serve any purpose at all). The
|
||||
@@ -3319,7 +3326,6 @@ declare module '@polkadot/api-base/types/submittable' {
|
||||
/**
|
||||
* Make some on-chain remark.
|
||||
*
|
||||
* ## Complexity
|
||||
* - `O(1)`
|
||||
**/
|
||||
remark: AugmentedSubmittable<(remark: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes]>;
|
||||
@@ -3329,16 +3335,10 @@ declare module '@polkadot/api-base/types/submittable' {
|
||||
remarkWithEvent: AugmentedSubmittable<(remark: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes]>;
|
||||
/**
|
||||
* Set the new runtime code.
|
||||
*
|
||||
* ## Complexity
|
||||
* - `O(C + S)` where `C` length of `code` and `S` complexity of `can_set_code`
|
||||
**/
|
||||
setCode: AugmentedSubmittable<(code: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes]>;
|
||||
/**
|
||||
* Set the new runtime code without doing any checks of the given `code`.
|
||||
*
|
||||
* ## Complexity
|
||||
* - `O(C)` where `C` length of `code`
|
||||
**/
|
||||
setCodeWithoutChecks: AugmentedSubmittable<(code: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes]>;
|
||||
/**
|
||||
@@ -3987,22 +3987,29 @@ declare module '@polkadot/api-base/types/submittable' {
|
||||
* Set a safe XCM version (the version that XCM should be encoded with if the most recent
|
||||
* version a destination can accept is unknown).
|
||||
*
|
||||
* - `origin`: Must be Root.
|
||||
* - `origin`: Must be an origin specified by AdminOrigin.
|
||||
* - `maybe_xcm_version`: The default XCM encoding version, or `None` to disable.
|
||||
**/
|
||||
forceDefaultXcmVersion: AugmentedSubmittable<(maybeXcmVersion: Option<u32> | null | Uint8Array | u32 | AnyNumber) => SubmittableExtrinsic<ApiType>, [Option<u32>]>;
|
||||
/**
|
||||
* Ask a location to notify us regarding their XCM version and any changes to it.
|
||||
*
|
||||
* - `origin`: Must be Root.
|
||||
* - `origin`: Must be an origin specified by AdminOrigin.
|
||||
* - `location`: The location to which we should subscribe for XCM version notifications.
|
||||
**/
|
||||
forceSubscribeVersionNotify: AugmentedSubmittable<(location: XcmVersionedMultiLocation | { V2: any } | { V3: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [XcmVersionedMultiLocation]>;
|
||||
/**
|
||||
* Set or unset the global suspension state of the XCM executor.
|
||||
*
|
||||
* - `origin`: Must be an origin specified by AdminOrigin.
|
||||
* - `suspended`: `true` to suspend, `false` to resume.
|
||||
**/
|
||||
forceSuspension: AugmentedSubmittable<(suspended: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [bool]>;
|
||||
/**
|
||||
* Require that a particular destination should no longer notify us regarding any XCM
|
||||
* version changes.
|
||||
*
|
||||
* - `origin`: Must be Root.
|
||||
* - `origin`: Must be an origin specified by AdminOrigin.
|
||||
* - `location`: The location to which we are currently subscribed for XCM version
|
||||
* notifications which we no longer desire.
|
||||
**/
|
||||
@@ -4011,7 +4018,7 @@ declare module '@polkadot/api-base/types/submittable' {
|
||||
* Extoll that a particular destination can be communicated with through a particular
|
||||
* version of XCM.
|
||||
*
|
||||
* - `origin`: Must be Root.
|
||||
* - `origin`: Must be an origin specified by AdminOrigin.
|
||||
* - `location`: The destination that is being described.
|
||||
* - `xcm_version`: The latest version of XCM that `location` supports.
|
||||
**/
|
||||
|
||||
@@ -209,6 +209,10 @@ declare module '@polkadot/api-base/types/consts' {
|
||||
[key: string]: Codec;
|
||||
};
|
||||
contracts: {
|
||||
/**
|
||||
* Fallback value to limit the storage deposit if it's not being set by the caller.
|
||||
**/
|
||||
defaultDepositLimit: u128 & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* The amount of balance a caller has to pay for each byte of storage.
|
||||
*
|
||||
@@ -1141,6 +1145,36 @@ declare module '@polkadot/api-base/types/consts' {
|
||||
**/
|
||||
[key: string]: Codec;
|
||||
};
|
||||
statement: {
|
||||
/**
|
||||
* Cost of data byte used for priority calculation.
|
||||
**/
|
||||
byteCost: u128 & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* Maximum data bytes allowed per account.
|
||||
**/
|
||||
maxAllowedBytes: u32 & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* Maximum number of statements allowed per account.
|
||||
**/
|
||||
maxAllowedStatements: u32 & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* Minimum data bytes allowed per account.
|
||||
**/
|
||||
minAllowedBytes: u32 & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* Minimum number of statements allowed per account.
|
||||
**/
|
||||
minAllowedStatements: u32 & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* Min balance for priority statements.
|
||||
**/
|
||||
statementCost: u128 & AugmentedConst<ApiType>;
|
||||
/**
|
||||
* Generic const
|
||||
**/
|
||||
[key: string]: Codec;
|
||||
};
|
||||
stateTrieMigration: {
|
||||
/**
|
||||
* Maximal number of bytes that a key can have.
|
||||
|
||||
@@ -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, FrameSupportTokensMiscBalanceStatus, KitchensinkRuntimeProxyType, PalletAllianceCid, PalletAllianceUnscrupulousItem, PalletConvictionVotingTally, PalletCoreFellowshipParamsType, PalletCoreFellowshipWish, PalletDemocracyMetadataOwner, PalletDemocracyVoteAccountVote, PalletDemocracyVoteThreshold, PalletElectionProviderMultiPhaseElectionCompute, PalletElectionProviderMultiPhasePhase, PalletImOnlineSr25519AppSr25519Public, PalletMultisigTimepoint, PalletNftsAttributeNamespace, PalletNftsPalletAttributes, PalletNftsPriceWithDirection, PalletNominationPoolsCommissionChangeRate, PalletNominationPoolsPoolState, PalletRankedCollectiveTally, PalletRankedCollectiveVoteRecord, PalletStakingExposure, PalletStakingForcing, PalletStakingValidatorPrefs, PalletStateTrieMigrationError, PalletStateTrieMigrationMigrationCompute, SpConsensusGrandpaAppPublic, SpNposElectionsElectionScore, SpRuntimeDispatchError, SpRuntimeDispatchErrorWithPostInfo, SpWeightsWeightV2Weight } from '@polkadot/types/lookup';
|
||||
import type { FrameSupportDispatchDispatchInfo, FrameSupportDispatchPostDispatchInfo, FrameSupportMessagesProcessMessageError, FrameSupportPreimagesBounded, FrameSupportTokensMiscBalanceStatus, KitchensinkRuntimeProxyType, PalletAllianceCid, PalletAllianceUnscrupulousItem, PalletContractsOrigin, PalletConvictionVotingTally, PalletCoreFellowshipParamsType, PalletCoreFellowshipWish, PalletDemocracyMetadataOwner, PalletDemocracyVoteAccountVote, PalletDemocracyVoteThreshold, PalletElectionProviderMultiPhaseElectionCompute, PalletElectionProviderMultiPhasePhase, PalletImOnlineSr25519AppSr25519Public, PalletMultisigTimepoint, PalletNftsAttributeNamespace, PalletNftsPalletAttributes, PalletNftsPriceWithDirection, PalletNominationPoolsCommissionChangeRate, PalletNominationPoolsPoolState, PalletRankedCollectiveTally, PalletRankedCollectiveVoteRecord, PalletStakingExposure, PalletStakingForcing, PalletStakingValidatorPrefs, PalletStateTrieMigrationError, PalletStateTrieMigrationMigrationCompute, SpConsensusGrandpaAppPublic, SpNposElectionsElectionScore, SpRuntimeDispatchError, SpRuntimeDispatchErrorWithPostInfo, SpStatementStoreStatement, SpWeightsWeightV2Weight } from '@polkadot/types/lookup';
|
||||
|
||||
export type __AugmentedEvent<ApiType extends ApiTypes> = AugmentedEvent<ApiType>;
|
||||
|
||||
@@ -151,6 +151,10 @@ declare module '@polkadot/api-base/types/events' {
|
||||
* Some asset `asset_id` was thawed.
|
||||
**/
|
||||
AssetThawed: AugmentedEvent<ApiType, [assetId: u32], { assetId: u32 }>;
|
||||
/**
|
||||
* Some account `who` was blocked.
|
||||
**/
|
||||
Blocked: AugmentedEvent<ApiType, [assetId: u32, who: AccountId32], { assetId: u32, who: AccountId32 }>;
|
||||
/**
|
||||
* Some assets were destroyed.
|
||||
**/
|
||||
@@ -199,6 +203,10 @@ declare module '@polkadot/api-base/types/events' {
|
||||
* Some account `who` was thawed.
|
||||
**/
|
||||
Thawed: AugmentedEvent<ApiType, [assetId: u32, who: AccountId32], { assetId: u32, who: AccountId32 }>;
|
||||
/**
|
||||
* Some account `who` was created with a deposit from `depositor`.
|
||||
**/
|
||||
Touched: AugmentedEvent<ApiType, [assetId: u32, who: AccountId32, depositor: AccountId32], { assetId: u32, who: AccountId32, depositor: AccountId32 }>;
|
||||
/**
|
||||
* Some assets were transferred.
|
||||
**/
|
||||
@@ -382,7 +390,7 @@ declare module '@polkadot/api-base/types/events' {
|
||||
* calls. This is because on failure all storage changes including events are
|
||||
* rolled back.
|
||||
**/
|
||||
Called: AugmentedEvent<ApiType, [caller: AccountId32, contract: AccountId32], { caller: AccountId32, contract: AccountId32 }>;
|
||||
Called: AugmentedEvent<ApiType, [caller: PalletContractsOrigin, contract: AccountId32], { caller: PalletContractsOrigin, contract: AccountId32 }>;
|
||||
/**
|
||||
* A code with the specified hash was removed.
|
||||
**/
|
||||
@@ -1646,6 +1654,16 @@ declare module '@polkadot/api-base/types/events' {
|
||||
**/
|
||||
[key: string]: AugmentedEvent<ApiType>;
|
||||
};
|
||||
statement: {
|
||||
/**
|
||||
* A new statement is submitted
|
||||
**/
|
||||
NewStatement: AugmentedEvent<ApiType, [account: AccountId32, statement: SpStatementStoreStatement], { account: AccountId32, statement: SpStatementStoreStatement }>;
|
||||
/**
|
||||
* Generic event
|
||||
**/
|
||||
[key: string]: AugmentedEvent<ApiType>;
|
||||
};
|
||||
stateTrieMigration: {
|
||||
/**
|
||||
* The auto migration task finished.
|
||||
|
||||
@@ -586,6 +586,8 @@ declare module '@polkadot/api-base/types/storage' {
|
||||
minimumUntrustedScore: AugmentedQuery<ApiType, () => Observable<Option<SpNposElectionsElectionScore>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
/**
|
||||
* Current best solution, signed or unsigned, queued to be returned upon `elect`.
|
||||
*
|
||||
* Always sorted by score.
|
||||
**/
|
||||
queuedSolution: AugmentedQuery<ApiType, () => Observable<Option<PalletElectionProviderMultiPhaseReadySolution>>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
/**
|
||||
@@ -1150,15 +1152,6 @@ declare module '@polkadot/api-base/types/storage' {
|
||||
* The primary structure that holds all offence records keyed by report identifiers.
|
||||
**/
|
||||
reports: AugmentedQuery<ApiType, (arg: H256 | string | Uint8Array) => Observable<Option<SpStakingOffenceOffenceDetails>>, [H256]> & QueryableStorageEntry<ApiType, [H256]>;
|
||||
/**
|
||||
* Enumerates all reports of a kind along with the time they happened.
|
||||
*
|
||||
* All reports are sorted by the time of offence.
|
||||
*
|
||||
* Note that the actual type of this mapping is `Vec<u8>`, this is because values of
|
||||
* different types are not supported at the moment so we are doing the manual serialization.
|
||||
**/
|
||||
reportsByKindIndex: AugmentedQuery<ApiType, (arg: U8aFixed | string | Uint8Array) => Observable<Bytes>, [U8aFixed]> & QueryableStorageEntry<ApiType, [U8aFixed]>;
|
||||
/**
|
||||
* Generic query
|
||||
**/
|
||||
|
||||
@@ -276,6 +276,19 @@ declare module '@polkadot/api-base/types/submittable' {
|
||||
* Weight: `O(1)`
|
||||
**/
|
||||
approveTransfer: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, delegate: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<u128> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress, Compact<u128>]>;
|
||||
/**
|
||||
* Disallow further unprivileged transfers of an asset `id` to and from an account `who`.
|
||||
*
|
||||
* Origin must be Signed and the sender should be the Freezer of the asset `id`.
|
||||
*
|
||||
* - `id`: The identifier of the account's asset.
|
||||
* - `who`: The account to be unblocked.
|
||||
*
|
||||
* Emits `Blocked`.
|
||||
*
|
||||
* Weight: `O(1)`
|
||||
**/
|
||||
block: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, who: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress]>;
|
||||
/**
|
||||
* Reduce the balance of `who` by as much as possible up to `amount` assets of `id`.
|
||||
*
|
||||
@@ -506,7 +519,9 @@ declare module '@polkadot/api-base/types/submittable' {
|
||||
**/
|
||||
forceTransfer: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, source: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, dest: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<u128> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress, MultiAddress, Compact<u128>]>;
|
||||
/**
|
||||
* Disallow further unprivileged transfers from an account.
|
||||
* Disallow further unprivileged transfers of an asset `id` from an account `who`. `who`
|
||||
* must already exist as an entry in `Account`s of the asset. If you want to freeze an
|
||||
* account that does not have an entry, use `touch_other` first.
|
||||
*
|
||||
* Origin must be Signed and the sender should be the Freezer of the asset `id`.
|
||||
*
|
||||
@@ -546,16 +561,31 @@ declare module '@polkadot/api-base/types/submittable' {
|
||||
**/
|
||||
mint: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, beneficiary: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, amount: Compact<u128> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress, Compact<u128>]>;
|
||||
/**
|
||||
* Return the deposit (if any) of an asset account.
|
||||
* Return the deposit (if any) of an asset account or a consumer reference (if any) of an
|
||||
* account.
|
||||
*
|
||||
* The origin must be Signed.
|
||||
*
|
||||
* - `id`: The identifier of the asset for the account to be created.
|
||||
* - `id`: The identifier of the asset for which the caller would like the deposit
|
||||
* refunded.
|
||||
* - `allow_burn`: If `true` then assets may be destroyed in order to complete the refund.
|
||||
*
|
||||
* Emits `Refunded` event when successful.
|
||||
**/
|
||||
refund: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, allowBurn: bool | boolean | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, bool]>;
|
||||
/**
|
||||
* Return the deposit (if any) of a target asset account. Useful if you are the depositor.
|
||||
*
|
||||
* The origin must be Signed and either the account owner, depositor, or asset `Admin`. In
|
||||
* order to burn a non-zero balance of the asset, the caller must be the account and should
|
||||
* use `refund`.
|
||||
*
|
||||
* - `id`: The identifier of the asset for the account holding a deposit.
|
||||
* - `who`: The account to refund.
|
||||
*
|
||||
* Emits `Refunded` event when successful.
|
||||
**/
|
||||
refundOther: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, who: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress]>;
|
||||
/**
|
||||
* Set the metadata for an asset.
|
||||
*
|
||||
@@ -620,7 +650,7 @@ declare module '@polkadot/api-base/types/submittable' {
|
||||
**/
|
||||
startDestroy: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>]>;
|
||||
/**
|
||||
* Allow unprivileged transfers from an account again.
|
||||
* Allow unprivileged transfers to and from an account again.
|
||||
*
|
||||
* Origin must be Signed and the sender should be the Admin of the asset `id`.
|
||||
*
|
||||
@@ -656,6 +686,19 @@ declare module '@polkadot/api-base/types/submittable' {
|
||||
* Emits `Touched` event when successful.
|
||||
**/
|
||||
touch: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>]>;
|
||||
/**
|
||||
* Create an asset account for `who`.
|
||||
*
|
||||
* A deposit will be taken from the signer account.
|
||||
*
|
||||
* - `origin`: Must be Signed by `Freezer` or `Admin` of the asset `id`; the signer account
|
||||
* must have sufficient funds for a deposit to be taken.
|
||||
* - `id`: The identifier of the asset for the account to be created.
|
||||
* - `who`: The account to be created.
|
||||
*
|
||||
* Emits `Touched` event when successful.
|
||||
**/
|
||||
touchOther: AugmentedSubmittable<(id: Compact<u32> | AnyNumber | Uint8Array, who: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u32>, MultiAddress]>;
|
||||
/**
|
||||
* Move some assets from the sender account to another.
|
||||
*
|
||||
@@ -4580,7 +4623,7 @@ declare module '@polkadot/api-base/types/submittable' {
|
||||
* NOTE: Two of the storage writes (`Self::bonded`, `Self::payee`) are _never_ cleaned
|
||||
* unless the `origin` falls below _existential deposit_ and gets removed as dust.
|
||||
**/
|
||||
bond: AugmentedSubmittable<(controller: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, value: Compact<u128> | AnyNumber | Uint8Array, payee: PalletStakingRewardDestination | { Staked: any } | { Stash: any } | { Controller: any } | { Account: any } | { None: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress, Compact<u128>, PalletStakingRewardDestination]>;
|
||||
bond: AugmentedSubmittable<(value: Compact<u128> | AnyNumber | Uint8Array, payee: PalletStakingRewardDestination | { Staked: any } | { Stash: any } | { Controller: any } | { Account: any } | { None: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Compact<u128>, PalletStakingRewardDestination]>;
|
||||
/**
|
||||
* Add some extra amount that have appeared in the stash `free_balance` into the balance up
|
||||
* for staking.
|
||||
@@ -4792,7 +4835,10 @@ declare module '@polkadot/api-base/types/submittable' {
|
||||
**/
|
||||
scaleValidatorCount: AugmentedSubmittable<(factor: Percent | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Percent]>;
|
||||
/**
|
||||
* (Re-)set the controller of a stash.
|
||||
* (Re-)sets the controller of a stash to the stash itself. This function previously
|
||||
* accepted a `controller` argument to set the controller to an account other than the
|
||||
* stash itself. This functionality has now been removed, now only setting the controller
|
||||
* to the stash, if it is not already.
|
||||
*
|
||||
* Effects will be felt instantly (as soon as this function is completed successfully).
|
||||
*
|
||||
@@ -4804,7 +4850,7 @@ declare module '@polkadot/api-base/types/submittable' {
|
||||
* - Contains a limited number of reads.
|
||||
* - Writes are limited to the `origin` account key.
|
||||
**/
|
||||
setController: AugmentedSubmittable<(controller: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress]>;
|
||||
setController: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>, []>;
|
||||
/**
|
||||
* Set the validators who cannot be slashed (if any).
|
||||
*
|
||||
@@ -5043,7 +5089,6 @@ declare module '@polkadot/api-base/types/submittable' {
|
||||
/**
|
||||
* Make some on-chain remark.
|
||||
*
|
||||
* ## Complexity
|
||||
* - `O(1)`
|
||||
**/
|
||||
remark: AugmentedSubmittable<(remark: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes]>;
|
||||
@@ -5053,16 +5098,10 @@ declare module '@polkadot/api-base/types/submittable' {
|
||||
remarkWithEvent: AugmentedSubmittable<(remark: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes]>;
|
||||
/**
|
||||
* Set the new runtime code.
|
||||
*
|
||||
* ## Complexity
|
||||
* - `O(C + S)` where `C` length of `code` and `S` complexity of `can_set_code`
|
||||
**/
|
||||
setCode: AugmentedSubmittable<(code: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes]>;
|
||||
/**
|
||||
* Set the new runtime code without doing any checks of the given `code`.
|
||||
*
|
||||
* ## Complexity
|
||||
* - `O(C)` where `C` length of `code`
|
||||
**/
|
||||
setCodeWithoutChecks: AugmentedSubmittable<(code: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Bytes]>;
|
||||
/**
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
},
|
||||
"exclude": [
|
||||
"**/*.spec.ts",
|
||||
"**/mod.ts",
|
||||
"**/kusama/*.ts",
|
||||
"**/polkadot/*.ts"
|
||||
],
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": "..",
|
||||
"outDir": "./build",
|
||||
"rootDir": "./src",
|
||||
"emitDeclarationOnly": false,
|
||||
"noEmit": true
|
||||
},
|
||||
"include": [
|
||||
"**/kusama/*.spec.ts"
|
||||
],
|
||||
"references": [
|
||||
{ "path": "../api-augment/tsconfig.build.json" },
|
||||
{ "path": "../api-augment/tsconfig.kusama.json" },
|
||||
{ "path": "../api-base/tsconfig.build.json" },
|
||||
{ "path": "../rpc-augment/tsconfig.build.json" },
|
||||
{ "path": "../types/tsconfig.build.json" },
|
||||
{ "path": "../types-augment/tsconfig.build.json" },
|
||||
{ "path": "../types-support/tsconfig.build.json" }
|
||||
]
|
||||
}
|
||||
@@ -18,13 +18,13 @@
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "10.4.1",
|
||||
"version": "10.7.2",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@polkadot/rpc-core": "10.4.1",
|
||||
"@polkadot/types": "10.4.1",
|
||||
"@polkadot/util": "^12.0.1",
|
||||
"rxjs": "^7.8.0",
|
||||
"tslib": "^2.5.0"
|
||||
"@polkadot/rpc-core": "10.7.2",
|
||||
"@polkadot/types": "10.7.2",
|
||||
"@polkadot/util": "^12.2.1",
|
||||
"rxjs": "^7.8.1",
|
||||
"tslib": "^2.5.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
|
||||
export const packageInfo = { name: '@polkadot/api-base', path: 'auto', type: 'auto', version: '10.4.1' };
|
||||
export const packageInfo = { name: '@polkadot/api-base', path: 'auto', type: 'auto', version: '10.7.2' };
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
"outDir": "./build",
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"exclude": [
|
||||
"**/mod.ts"
|
||||
],
|
||||
"references": [
|
||||
{ "path": "../rpc-core/tsconfig.build.json" },
|
||||
{ "path": "../types/tsconfig.build.json" }
|
||||
|
||||
@@ -18,20 +18,20 @@
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "10.4.1",
|
||||
"version": "10.7.2",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@polkadot/api": "10.4.1",
|
||||
"@polkadot/types": "10.4.1",
|
||||
"@polkadot/types-codec": "10.4.1",
|
||||
"@polkadot/types-create": "10.4.1",
|
||||
"@polkadot/util": "^12.0.1",
|
||||
"@polkadot/util-crypto": "^12.0.1",
|
||||
"rxjs": "^7.8.0",
|
||||
"tslib": "^2.5.0"
|
||||
"@polkadot/api": "10.7.2",
|
||||
"@polkadot/types": "10.7.2",
|
||||
"@polkadot/types-codec": "10.7.2",
|
||||
"@polkadot/types-create": "10.7.2",
|
||||
"@polkadot/util": "^12.2.1",
|
||||
"@polkadot/util-crypto": "^12.2.1",
|
||||
"rxjs": "^7.8.1",
|
||||
"tslib": "^2.5.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/api-augment": "10.4.1",
|
||||
"@polkadot/keyring": "^12.0.1"
|
||||
"@polkadot/api-augment": "10.7.2",
|
||||
"@polkadot/keyring": "^12.2.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
// Copyright 2017-2023 @polkadot/api-contract authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// all named
|
||||
export { Abi } from './Abi/index.js';
|
||||
export { packageInfo } from './packageInfo.js';
|
||||
|
||||
// all starred
|
||||
export * from './promise/index.js';
|
||||
export * from './rx/index.js';
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
|
||||
export const packageInfo = { name: '@polkadot/api-contract', path: 'auto', type: 'auto', version: '10.4.1' };
|
||||
export const packageInfo = { name: '@polkadot/api-contract', path: 'auto', type: 'auto', version: '10.7.2' };
|
||||
|
||||
@@ -5,7 +5,7 @@ export { default as delegator } from './delegator.json' assert { type: 'json' };
|
||||
export { default as dns } from './dns.json' assert { type: 'json' };
|
||||
export { default as erc20 } from './erc20.json' assert { type: 'json' };
|
||||
export { default as erc721 } from './erc721.json' assert { type: 'json' };
|
||||
export { default as flipper } from './flipper.json' assert { type: 'json' };
|
||||
export { default as flipperBundle } from './flipper.contract.json' assert { type: 'json' };
|
||||
export { default as flipper } from './flipper.json' assert { type: 'json' };
|
||||
export { default as incrementer } from './incrementer.json' assert { type: 'json' };
|
||||
export { default as multisigPlain } from './multisig_plain.json' assert { type: 'json' };
|
||||
|
||||
@@ -6,11 +6,10 @@
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"exclude": [
|
||||
"**/test/**/*.json",
|
||||
"**/test/**/*.ts",
|
||||
"**/test/**/*.wasm",
|
||||
"**/checkTypes.manual.ts",
|
||||
"**/test/**/*",
|
||||
"**/*.spec.ts",
|
||||
"**/checkTypes.manual.ts",
|
||||
"**/mod.ts",
|
||||
"mock.ts"
|
||||
],
|
||||
"references": [
|
||||
|
||||
@@ -18,25 +18,25 @@
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "10.4.1",
|
||||
"version": "10.7.2",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@polkadot/api": "10.4.1",
|
||||
"@polkadot/api-augment": "10.4.1",
|
||||
"@polkadot/api-base": "10.4.1",
|
||||
"@polkadot/rpc-core": "10.4.1",
|
||||
"@polkadot/types": "10.4.1",
|
||||
"@polkadot/types-codec": "10.4.1",
|
||||
"@polkadot/util": "^12.0.1",
|
||||
"@polkadot/util-crypto": "^12.0.1",
|
||||
"rxjs": "^7.8.0",
|
||||
"tslib": "^2.5.0"
|
||||
"@polkadot/api": "10.7.2",
|
||||
"@polkadot/api-augment": "10.7.2",
|
||||
"@polkadot/api-base": "10.7.2",
|
||||
"@polkadot/rpc-core": "10.7.2",
|
||||
"@polkadot/types": "10.7.2",
|
||||
"@polkadot/types-codec": "10.7.2",
|
||||
"@polkadot/util": "^12.2.1",
|
||||
"@polkadot/util-crypto": "^12.2.1",
|
||||
"rxjs": "^7.8.1",
|
||||
"tslib": "^2.5.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/api": "10.4.1",
|
||||
"@polkadot/api-augment": "10.4.1",
|
||||
"@polkadot/rpc-augment": "10.4.1",
|
||||
"@polkadot/rpc-provider": "10.4.1",
|
||||
"@polkadot/types-support": "10.4.1"
|
||||
"@polkadot/api": "10.7.2",
|
||||
"@polkadot/api-augment": "10.7.2",
|
||||
"@polkadot/rpc-augment": "10.7.2",
|
||||
"@polkadot/rpc-provider": "10.7.2",
|
||||
"@polkadot/types-support": "10.7.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ export function _flags (instanceId: string, api: DeriveApi): () => Observable<Fl
|
||||
map((values: Codec[]): FlagsIntermediate => {
|
||||
let resultIndex = -1;
|
||||
|
||||
for (let i = 0; i < calls.length; i++) {
|
||||
for (let i = 0, count = calls.length; i < count; i++) {
|
||||
if (isFunction(calls[i])) {
|
||||
results[i] = values[++resultIndex];
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
export * from './accountId.js';
|
||||
export * from './flags.js';
|
||||
export * from './idAndIndex.js';
|
||||
export * from './idToIndex.js';
|
||||
export * from './identity.js';
|
||||
export * from './indexToId.js';
|
||||
export * from './idToIndex.js';
|
||||
export * from './indexes.js';
|
||||
export * from './indexToId.js';
|
||||
export * from './info.js';
|
||||
|
||||
@@ -119,7 +119,7 @@ function injectFunctions (instanceId: string, api: DeriveApi, derives: DeriveCus
|
||||
)
|
||||
));
|
||||
|
||||
for (let i = 0; i < names.length; i++) {
|
||||
for (let i = 0, count = names.length; i < count; i++) {
|
||||
const name = names[i];
|
||||
|
||||
isIncluded(name) &&
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
export * from './bestNumber.js';
|
||||
export * from './bestNumberFinalized.js';
|
||||
export * from './bestNumberLag.js';
|
||||
export * from './getHeader.js';
|
||||
export * from './getBlock.js';
|
||||
export * from './getBlockByNumber.js';
|
||||
export * from './getHeader.js';
|
||||
export * from './subscribeFinalizedHeads.js';
|
||||
export * from './subscribeNewBlocks.js';
|
||||
export * from './subscribeNewHeads.js';
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
|
||||
export const packageInfo = { name: '@polkadot/api-derive', path: 'auto', type: 'auto', version: '10.4.1' };
|
||||
export const packageInfo = { name: '@polkadot/api-derive', path: 'auto', type: 'auto', version: '10.7.2' };
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
|
||||
export * from './account.js';
|
||||
export * from './currentPoints.js';
|
||||
export * from './electedInfo.js';
|
||||
export * from './erasExposure.js';
|
||||
export * from './erasHistoric.js';
|
||||
export * from './erasPoints.js';
|
||||
export * from './erasPrefs.js';
|
||||
export * from './erasRewards.js';
|
||||
export * from './erasSlashes.js';
|
||||
export * from './electedInfo.js';
|
||||
export * from './keys.js';
|
||||
export * from './overview.js';
|
||||
export * from './ownExposure.js';
|
||||
|
||||
@@ -9,8 +9,8 @@ import type { BN } from '@polkadot/util';
|
||||
import type { ExactDerive } from './derive.js';
|
||||
|
||||
export * from './accounts/types.js';
|
||||
export * from './balances/types.js';
|
||||
export * from './bagsList/types.js';
|
||||
export * from './balances/types.js';
|
||||
export * from './council/types.js';
|
||||
export * from './crowdloan/types.js';
|
||||
export * from './democracy/types.js';
|
||||
|
||||
@@ -8,7 +8,7 @@ import type { ApprovalFlag } from '@polkadot/types/interfaces/elections';
|
||||
export function approvalFlagsToBools (flags: Vec<ApprovalFlag> | ApprovalFlag[]): boolean[] {
|
||||
const bools: boolean[] = [];
|
||||
|
||||
for (let i = 0; i < flags.length; i++) {
|
||||
for (let i = 0, count = flags.length; i < count; i++) {
|
||||
const str = flags[i].toString(2);
|
||||
|
||||
// read from lowest bit to highest
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// all named
|
||||
export { drr, memo } from '@polkadot/rpc-core';
|
||||
|
||||
// all starred
|
||||
export * from './approvalFlagsToBools.js';
|
||||
export * from './blockNumber.js';
|
||||
export * from './cache.js';
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"exclude": [
|
||||
"**/test/*",
|
||||
"**/checkTypes.manual.ts",
|
||||
"**/mod.ts",
|
||||
"**/*.spec.ts"
|
||||
],
|
||||
"references": [
|
||||
|
||||
+20
-20
@@ -18,29 +18,29 @@
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "10.4.1",
|
||||
"version": "10.7.2",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@polkadot/api-augment": "10.4.1",
|
||||
"@polkadot/api-base": "10.4.1",
|
||||
"@polkadot/api-derive": "10.4.1",
|
||||
"@polkadot/keyring": "^12.0.1",
|
||||
"@polkadot/rpc-augment": "10.4.1",
|
||||
"@polkadot/rpc-core": "10.4.1",
|
||||
"@polkadot/rpc-provider": "10.4.1",
|
||||
"@polkadot/types": "10.4.1",
|
||||
"@polkadot/types-augment": "10.4.1",
|
||||
"@polkadot/types-codec": "10.4.1",
|
||||
"@polkadot/types-create": "10.4.1",
|
||||
"@polkadot/types-known": "10.4.1",
|
||||
"@polkadot/util": "^12.0.1",
|
||||
"@polkadot/util-crypto": "^12.0.1",
|
||||
"eventemitter3": "^5.0.0",
|
||||
"rxjs": "^7.8.0",
|
||||
"tslib": "^2.5.0"
|
||||
"@polkadot/api-augment": "10.7.2",
|
||||
"@polkadot/api-base": "10.7.2",
|
||||
"@polkadot/api-derive": "10.7.2",
|
||||
"@polkadot/keyring": "^12.2.1",
|
||||
"@polkadot/rpc-augment": "10.7.2",
|
||||
"@polkadot/rpc-core": "10.7.2",
|
||||
"@polkadot/rpc-provider": "10.7.2",
|
||||
"@polkadot/types": "10.7.2",
|
||||
"@polkadot/types-augment": "10.7.2",
|
||||
"@polkadot/types-codec": "10.7.2",
|
||||
"@polkadot/types-create": "10.7.2",
|
||||
"@polkadot/types-known": "10.7.2",
|
||||
"@polkadot/util": "^12.2.1",
|
||||
"@polkadot/util-crypto": "^12.2.1",
|
||||
"eventemitter3": "^5.0.1",
|
||||
"rxjs": "^7.8.1",
|
||||
"tslib": "^2.5.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/api-augment": "10.4.1",
|
||||
"@polkadot/types-support": "10.4.1"
|
||||
"@polkadot/api-augment": "10.7.2",
|
||||
"@polkadot/types-support": "10.7.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,19 +139,22 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
||||
this._rx.queryAt = (blockHash: Uint8Array | string, knownVersion?: RuntimeVersion) =>
|
||||
from(this.at(blockHash, knownVersion)).pipe(map((a) => a.rx.query));
|
||||
this._rx.registry = this.#registry;
|
||||
this._decorateMethod = decorateMethod;
|
||||
this._options = options;
|
||||
this._type = type;
|
||||
|
||||
const thisProvider = options.source
|
||||
const provider = options.source
|
||||
? options.source._rpcCore.provider.isClonable
|
||||
? options.source._rpcCore.provider.clone()
|
||||
: options.source._rpcCore.provider
|
||||
: (options.provider || new WsProvider());
|
||||
|
||||
this._decorateMethod = decorateMethod;
|
||||
this._options = options;
|
||||
this._type = type;
|
||||
|
||||
// The RPC interface decorates the known interfaces on init
|
||||
this._rpcCore = new RpcCore(this.#instanceId, this.#registry, thisProvider, this._options.rpc) as (RpcCore & RpcInterface);
|
||||
this._rpcCore = new RpcCore(this.#instanceId, this.#registry, {
|
||||
isPedantic: this._options.isPedantic,
|
||||
provider,
|
||||
userRpc: this._options.rpc
|
||||
}) as (RpcCore & RpcInterface);
|
||||
this._isConnected = new BehaviorSubject(this._rpcCore.provider.isConnected);
|
||||
this._rx.hasSubscriptions = this._rpcCore.provider.hasSubscriptions;
|
||||
}
|
||||
@@ -319,7 +322,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
||||
// we try and create mappings to runtime names via a hash mapping)
|
||||
const sectionMap: Record<string, boolean> = {};
|
||||
|
||||
for (let i = 0; i < methods.length; i++) {
|
||||
for (let i = 0, count = methods.length; i < count; i++) {
|
||||
const [section] = methods[i].split('_');
|
||||
|
||||
sectionMap[section] = true;
|
||||
@@ -328,7 +331,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
||||
// convert the actual section names into an easy name lookup
|
||||
const sections = Object.keys(sectionMap);
|
||||
|
||||
for (let i = 0; i < sections.length; i++) {
|
||||
for (let i = 0, count = sections.length; i < count; i++) {
|
||||
const nameA = stringUpperFirst(sections[i]);
|
||||
const nameB = `${nameA}Api`;
|
||||
|
||||
@@ -344,8 +347,9 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
||||
const hasResults = exposed.length !== 0;
|
||||
const allKnown = [...this._rpcCore.mapping.entries()];
|
||||
const allKeys: string[] = [];
|
||||
const count = allKnown.length;
|
||||
|
||||
for (let i = 0; i < allKnown.length; i++) {
|
||||
for (let i = 0; i < count; i++) {
|
||||
const [, { alias, endpoint, method, pubsub, section }] = allKnown[i];
|
||||
|
||||
allKeys.push(`${section}_${method}`);
|
||||
@@ -375,7 +379,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
||||
|
||||
// loop through all entries we have (populated in decorate) and filter as required
|
||||
// only remove when we have results and method missing, or with no results if optional
|
||||
for (let i = 0; i < allKnown.length; i++) {
|
||||
for (let i = 0; i < count; i++) {
|
||||
const [k, { method, section }] = allKnown[i];
|
||||
|
||||
if (hasResults && !exposed.includes(k) && k !== 'rpc_methods') {
|
||||
@@ -408,7 +412,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
||||
return fn;
|
||||
};
|
||||
|
||||
for (let s = 0; s < rpc.sections.length; s++) {
|
||||
for (let s = 0, scount = rpc.sections.length; s < scount; s++) {
|
||||
const section = rpc.sections[s];
|
||||
|
||||
if (!Object.prototype.hasOwnProperty.call(out, section)) {
|
||||
@@ -417,7 +421,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
||||
const decorateInternal = (method: string) =>
|
||||
decorateFn(section, method);
|
||||
|
||||
for (let m = 0; m < methods.length; m++) {
|
||||
for (let m = 0, mcount = methods.length; m < mcount; m++) {
|
||||
const method = methods[m];
|
||||
|
||||
// skip subscriptions where we have a non-subscribe interface
|
||||
@@ -443,13 +447,13 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
||||
|
||||
const entries = Object.entries(additional);
|
||||
|
||||
for (let j = 0; j < entries.length; j++) {
|
||||
for (let j = 0, ecount = entries.length; j < ecount; j++) {
|
||||
const [key, defs] = entries[j];
|
||||
|
||||
if (result[key]) {
|
||||
// we have this one already, step through for new versions or
|
||||
// new methods and add those as applicable
|
||||
for (let k = 0; k < defs.length; k++) {
|
||||
for (let k = 0, dcount = defs.length; k < dcount; k++) {
|
||||
const def = defs[k];
|
||||
const prev = result[key].find(({ version }) => def.version === version);
|
||||
|
||||
@@ -475,7 +479,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
||||
|
||||
// options > chain/spec > built-in, apply in reverse order with
|
||||
// methods overriding previous definitions (or interleave missing)
|
||||
for (let i = 0; i < defValues.length; i++) {
|
||||
for (let i = 0, count = defValues.length; i < count; i++) {
|
||||
this._addRuntimeDef(result, defValues[i].runtime);
|
||||
}
|
||||
|
||||
@@ -497,7 +501,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
||||
|
||||
this.#runtimeLog[implName] = true;
|
||||
|
||||
for (let i = 0; i < sections.length; i++) {
|
||||
for (let i = 0, scount = sections.length; i < scount; i++) {
|
||||
const [_section, secs] = sections[i];
|
||||
const sectionHash = blake2AsHex(_section, 64);
|
||||
const rtApi = apis.find(([a]) => a.eq(sectionHash));
|
||||
@@ -517,7 +521,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
||||
named[section] = {};
|
||||
}
|
||||
|
||||
for (let m = 0; m < methods.length; m++) {
|
||||
for (let m = 0, mcount = methods.length; m < mcount; m++) {
|
||||
const [_method, def] = methods[m];
|
||||
const method = stringCamelCase(_method);
|
||||
|
||||
@@ -557,7 +561,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
||||
|
||||
const modules = Object.keys(named);
|
||||
|
||||
for (let i = 0; i < modules.length; i++) {
|
||||
for (let i = 0, count = modules.length; i < count; i++) {
|
||||
lazyMethod(result, modules[i], lazySection);
|
||||
}
|
||||
|
||||
@@ -642,7 +646,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
||||
|
||||
const sections = Object.keys(tx);
|
||||
|
||||
for (let i = 0; i < sections.length; i++) {
|
||||
for (let i = 0, count = sections.length; i < count; i++) {
|
||||
lazyMethod(result, sections[i], lazySection);
|
||||
}
|
||||
|
||||
@@ -673,7 +677,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
||||
|
||||
const sections = Object.keys(query);
|
||||
|
||||
for (let i = 0; i < sections.length; i++) {
|
||||
for (let i = 0, count = sections.length; i < count; i++) {
|
||||
lazyMethod(result, sections[i], lazySection);
|
||||
}
|
||||
|
||||
|
||||
@@ -265,11 +265,11 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
|
||||
const sections = Object.keys(source.rpc);
|
||||
const rpcs: string[] = [];
|
||||
|
||||
for (let s = 0; s < sections.length; s++) {
|
||||
for (let s = 0, scount = sections.length; s < scount; s++) {
|
||||
const section = sections[s];
|
||||
const methods = Object.keys((source.rpc as unknown as Record<string, Record<string, unknown>>)[section]);
|
||||
|
||||
for (let m = 0; m < methods.length; m++) {
|
||||
for (let m = 0, mcount = methods.length; m < mcount; m++) {
|
||||
rpcs.push(`${section}_${methods[m]}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ export abstract class ApiBase<ApiType extends ApiTypes> extends Getters<ApiType>
|
||||
/**
|
||||
* @description Set an external signer which will be used to sign extrinsic when account passed in is not KeyringPair
|
||||
*/
|
||||
public setSigner (signer: Signer): void {
|
||||
public setSigner (signer: Signer | undefined): void {
|
||||
this._rx.signer = signer;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,11 +3,14 @@
|
||||
|
||||
import '@polkadot/rpc-augment';
|
||||
|
||||
// all external
|
||||
export { Keyring } from '@polkadot/keyring';
|
||||
export { HttpProvider, ScProvider, WsProvider } from '@polkadot/rpc-provider';
|
||||
|
||||
// all named
|
||||
export { packageInfo } from './packageInfo.js';
|
||||
export { SubmittableResult } from './submittable/index.js';
|
||||
|
||||
// all starred
|
||||
export * from './promise/index.js';
|
||||
export * from './rx/index.js';
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
|
||||
export const packageInfo = { name: '@polkadot/api', path: 'auto', type: 'auto', version: '10.4.1' };
|
||||
export const packageInfo = { name: '@polkadot/api', path: 'auto', type: 'auto', version: '10.7.2' };
|
||||
|
||||
@@ -21,7 +21,7 @@ describe('Combinator', (): void => {
|
||||
fns = [];
|
||||
});
|
||||
|
||||
it('it triggers on all values', async (): Promise<void> => {
|
||||
it('triggers on all values', async (): Promise<void> => {
|
||||
await new Promise<boolean>((resolve) => {
|
||||
let count = 0;
|
||||
const combinator = new Combinator(
|
||||
@@ -90,6 +90,7 @@ describe('Combinator', (): void => {
|
||||
});
|
||||
});
|
||||
|
||||
// eslint-disable-next-line jest/expect-expect
|
||||
it('unsubscribes as required', async (): Promise<void> => {
|
||||
await new Promise<void>((resolve) => {
|
||||
// eslint-disable-next-line @typescript-eslint/require-await
|
||||
|
||||
@@ -87,6 +87,7 @@ describe('ApiPromise', (): void => {
|
||||
await api.disconnect();
|
||||
});
|
||||
|
||||
// eslint-disable-next-line jest/expect-expect
|
||||
it('Create API instance will error on failure to await ready', async (): Promise<void> => {
|
||||
class ErrorApiPromise extends ApiPromise {
|
||||
constructor () {
|
||||
|
||||
@@ -14,7 +14,7 @@ import { toRxMethod } from './decorateMethod.js';
|
||||
/**
|
||||
* # @polkadot/api/rx
|
||||
*
|
||||
* ## Overview
|
||||
* ## Overview
|
||||
*
|
||||
* @name ApiRx
|
||||
*
|
||||
|
||||
@@ -13,7 +13,7 @@ import type { AddressOrPair, SignerOptions, SubmittableDryRunResult, Submittable
|
||||
|
||||
import { catchError, first, map, mergeMap, of, switchMap, tap } from 'rxjs';
|
||||
|
||||
import { isBn, isFunction, isNumber, isString, isU8a, objectSpread } from '@polkadot/util';
|
||||
import { identity, isBn, isFunction, isNumber, isString, isU8a, objectSpread } from '@polkadot/util';
|
||||
|
||||
import { filterEvents, isKeyringPair } from '../util/index.js';
|
||||
import { SubmittableResult } from './Result.js';
|
||||
@@ -30,8 +30,6 @@ interface UpdateInfo {
|
||||
updateId: number;
|
||||
}
|
||||
|
||||
const identity = <T> (input: T): T => input;
|
||||
|
||||
function makeEraOptions (api: ApiInterfaceRx, registry: Registry, partialOptions: Partial<SignerOptions>, { header, mortalLength, nonce }: { header: Header | null; mortalLength: number; nonce: Index }): SignatureOptions {
|
||||
if (!header) {
|
||||
if (partialOptions.era && !partialOptions.blockHash) {
|
||||
@@ -92,7 +90,7 @@ export function createClass <ApiType extends ApiTypes> ({ api, apiType, blockHas
|
||||
class Submittable extends ExtrinsicBase implements SubmittableExtrinsic<ApiType> {
|
||||
readonly #ignoreStatusCb: boolean;
|
||||
|
||||
#transformResult: (input: ISubmittableResult) => ISubmittableResult = identity;
|
||||
#transformResult = identity<ISubmittableResult>;
|
||||
|
||||
constructor (registry: Registry, extrinsic: Call | Extrinsic | Uint8Array | string) {
|
||||
super(registry, extrinsic, { version: api.extrinsicType });
|
||||
|
||||
@@ -18,18 +18,28 @@ import type { ApiBase } from '../base/index.js';
|
||||
import type { SubmittableExtrinsic } from '../types/submittable.js';
|
||||
import type { AllDerives } from '../util/decorate.js';
|
||||
|
||||
export * from '@polkadot/api-base/types';
|
||||
export * from '@polkadot/api/types/calls';
|
||||
export * from '@polkadot/api/types/consts';
|
||||
export * from '@polkadot/api/types/errors';
|
||||
export * from '@polkadot/api/types/events';
|
||||
export * from '@polkadot/api/types/storage';
|
||||
export * from '@polkadot/api/types/submittable';
|
||||
|
||||
// types
|
||||
export type { Signer, SignerResult } from '@polkadot/types/types';
|
||||
|
||||
// all named
|
||||
export { ApiBase } from '../base/index.js';
|
||||
|
||||
// all starred
|
||||
// eslint-disable-next-line import/export
|
||||
export * from '@polkadot/api/types/calls';
|
||||
// eslint-disable-next-line import/export
|
||||
export * from '@polkadot/api/types/consts';
|
||||
// eslint-disable-next-line import/export
|
||||
export * from '@polkadot/api/types/errors';
|
||||
// eslint-disable-next-line import/export
|
||||
export * from '@polkadot/api/types/events';
|
||||
// eslint-disable-next-line import/export
|
||||
export * from '@polkadot/api/types/storage';
|
||||
// eslint-disable-next-line import/export
|
||||
export * from '@polkadot/api/types/submittable';
|
||||
// eslint-disable-next-line import/export
|
||||
export * from '@polkadot/api-base/types';
|
||||
|
||||
// A smaller interface of ApiRx, used in derive and in SubmittableExtrinsic
|
||||
export interface ApiInterfaceRx extends ApiInterfaceBase {
|
||||
derive: AllDerives<'rxjs'>;
|
||||
@@ -44,6 +54,10 @@ export interface ApiOptions extends RegisteredTypes {
|
||||
* @description Control the initialization of the wasm libraries. When not specified, it defaults to `true`, initializing the wasm libraries, set to `false` to not initialize wasm. (No sr25519 support)
|
||||
*/
|
||||
initWasm?: boolean;
|
||||
/**
|
||||
* @description Controls the checking of storage values once they have been contructed. When not specified this defaults to `true`. Set to `false` to forgo any checking on storage results.
|
||||
*/
|
||||
isPedantic?: boolean;
|
||||
/**
|
||||
* @description pre-bundles is a map of 'genesis hash and runtime spec version' as key to a metadata hex string
|
||||
* if genesis hash and runtime spec version matches, then use metadata, else fetch it from chain
|
||||
|
||||
@@ -53,12 +53,12 @@ function findMethodExcludes <T> (src: Sections<T>, dst: Sections<T>): string[] {
|
||||
const dstSections = findSectionIncludes(Object.keys(dst), srcSections);
|
||||
const excludes: string[] = [];
|
||||
|
||||
for (let s = 0; s < dstSections.length; s++) {
|
||||
for (let s = 0, scount = dstSections.length; s < scount; s++) {
|
||||
const section = dstSections[s];
|
||||
const srcMethods = Object.keys(src[section]);
|
||||
const dstMethods = Object.keys(dst[section]);
|
||||
|
||||
for (let d = 0; d < dstMethods.length; d++) {
|
||||
for (let d = 0, mcount = dstMethods.length; d < mcount; d++) {
|
||||
const method = dstMethods[d];
|
||||
|
||||
if (!srcMethods.includes(method)) {
|
||||
@@ -95,7 +95,7 @@ export function augmentObject <T> (prefix: string | null, src: Sections<T>, dst:
|
||||
|
||||
const sections = Object.keys(src);
|
||||
|
||||
for (let i = 0; i < sections.length; i++) {
|
||||
for (let i = 0, count = sections.length; i < count; i++) {
|
||||
const section = sections[i];
|
||||
const methods = src[section];
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ export function decorateDeriveSections<ApiType extends ApiTypes> (decorateMethod
|
||||
const result: AnyDerive = {};
|
||||
const names = Object.keys(derives);
|
||||
|
||||
for (let i = 0; i < names.length; i++) {
|
||||
for (let i = 0, count = names.length; i < count; i++) {
|
||||
lazyDeriveSection(result, names[i], getKeys, creator);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
// Copyright 2017-2023 @polkadot/api authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export * from './decorate.js';
|
||||
|
||||
// all named
|
||||
export { filterEvents } from './filterEvents.js';
|
||||
export { isKeyringPair } from './isKeyringPair.js';
|
||||
export { l } from './logging.js';
|
||||
|
||||
// all starred
|
||||
export * from './decorate.js';
|
||||
|
||||
@@ -46,7 +46,7 @@ describe('extractStorageArgs', (): void => {
|
||||
).toThrow('staking.payee(AccountId32) is a map, requiring 1 arguments, 0 found');
|
||||
});
|
||||
|
||||
it('validates map, 1 arg (failing with no args)', (): void => {
|
||||
it('validates map, 1 arg (failing with more args)', (): void => {
|
||||
expect(
|
||||
() => extractStorageArgs(registry, storage.staking.payee, ['abc', 'def'])
|
||||
).toThrow('staking.payee(AccountId32) is a map, requiring 1 arguments, 2 found');
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
},
|
||||
"exclude": [
|
||||
"**/checkTypes.manual.ts",
|
||||
"**/mod.ts",
|
||||
"**/*.spec.ts",
|
||||
"**/test/**/*"
|
||||
],
|
||||
|
||||
@@ -18,13 +18,13 @@
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "10.4.1",
|
||||
"version": "10.7.2",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@polkadot/rpc-core": "10.4.1",
|
||||
"@polkadot/types": "10.4.1",
|
||||
"@polkadot/types-codec": "10.4.1",
|
||||
"@polkadot/util": "^12.0.1",
|
||||
"tslib": "^2.5.0"
|
||||
"@polkadot/rpc-core": "10.7.2",
|
||||
"@polkadot/types": "10.7.2",
|
||||
"@polkadot/types-codec": "10.7.2",
|
||||
"@polkadot/util": "^12.2.1",
|
||||
"tslib": "^2.5.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
|
||||
export const packageInfo = { name: '@polkadot/rpc-augment', path: 'auto', type: 'auto', version: '10.4.1' };
|
||||
export const packageInfo = { name: '@polkadot/rpc-augment', path: 'auto', type: 'auto', version: '10.7.2' };
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
"outDir": "./build",
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"exclude": [
|
||||
"**/mod.ts"
|
||||
],
|
||||
"references": [
|
||||
{ "path": "../rpc-core/tsconfig.build.json" },
|
||||
{ "path": "../types/tsconfig.build.json" },
|
||||
|
||||
@@ -18,18 +18,18 @@
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "10.4.1",
|
||||
"version": "10.7.2",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@polkadot/rpc-augment": "10.4.1",
|
||||
"@polkadot/rpc-provider": "10.4.1",
|
||||
"@polkadot/types": "10.4.1",
|
||||
"@polkadot/util": "^12.0.1",
|
||||
"rxjs": "^7.8.0",
|
||||
"tslib": "^2.5.0"
|
||||
"@polkadot/rpc-augment": "10.7.2",
|
||||
"@polkadot/rpc-provider": "10.7.2",
|
||||
"@polkadot/types": "10.7.2",
|
||||
"@polkadot/util": "^12.2.1",
|
||||
"rxjs": "^7.8.1",
|
||||
"tslib": "^2.5.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^12.0.1",
|
||||
"@polkadot/rpc-augment": "10.4.1"
|
||||
"@polkadot/keyring": "^12.2.1",
|
||||
"@polkadot/rpc-augment": "10.7.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,12 @@ type MemoizedRpcInterfaceMethod = Memoized<RpcInterfaceMethod> & {
|
||||
meta: DefinitionRpc;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
isPedantic?: boolean;
|
||||
provider: ProviderInterface;
|
||||
userRpc?: Record<string, Record<string, DefinitionRpc | DefinitionRpcSub>>;
|
||||
}
|
||||
|
||||
const l = logger('rpc-core');
|
||||
|
||||
const EMPTY_META = {
|
||||
@@ -47,11 +53,11 @@ function logErrorMessage (method: string, { noErrorLog, params, type }: Definiti
|
||||
return;
|
||||
}
|
||||
|
||||
const inputs = params.map(({ isOptional, name, type }): string =>
|
||||
`${name}${isOptional ? '?' : ''}: ${type}`
|
||||
).join(', ');
|
||||
|
||||
l.error(`${method}(${inputs}): ${type}:: ${error.message}`);
|
||||
l.error(`${method}(${
|
||||
params.map(({ isOptional, name, type }): string =>
|
||||
`${name}${isOptional ? '?' : ''}: ${type}`
|
||||
).join(', ')
|
||||
}): ${type}:: ${error.message}`);
|
||||
}
|
||||
|
||||
function isTreatAsHex (key: StorageKey): boolean {
|
||||
@@ -84,30 +90,31 @@ function isTreatAsHex (key: StorageKey): boolean {
|
||||
* ```
|
||||
*/
|
||||
export class RpcCore {
|
||||
#instanceId: string;
|
||||
#registryDefault: Registry;
|
||||
readonly #instanceId: string;
|
||||
readonly #isPedantic: boolean;
|
||||
readonly #registryDefault: Registry;
|
||||
readonly #storageCache = new Map<string, Codec>();
|
||||
|
||||
#getBlockRegistry?: (blockHash: Uint8Array) => Promise<{ registry: Registry }>;
|
||||
#getBlockHash?: (blockNumber: AnyNumber) => Promise<Uint8Array>;
|
||||
|
||||
readonly #storageCache = new Map<string, Codec>();
|
||||
|
||||
readonly mapping = new Map<string, DefinitionRpcExt>();
|
||||
readonly provider: ProviderInterface;
|
||||
readonly sections: string[] = [];
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* Default constructor for the Api Object
|
||||
* @param {ProviderInterface} provider An API provider using HTTP or WebSocket
|
||||
* Default constructor for the core RPC handler
|
||||
* @param {ProviderInterface} provider An API provider using any of the supported providers (HTTP, SC or WebSocket)
|
||||
*/
|
||||
constructor (instanceId: string, registry: Registry, provider: ProviderInterface, userRpc: Record<string, Record<string, DefinitionRpc | DefinitionRpcSub>> = {}) {
|
||||
constructor (instanceId: string, registry: Registry, { isPedantic = true, provider, userRpc = {} }: Options) {
|
||||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||
if (!provider || !isFunction(provider.send)) {
|
||||
throw new Error('Expected Provider to API create');
|
||||
}
|
||||
|
||||
this.#instanceId = instanceId;
|
||||
this.#isPedantic = isPedantic;
|
||||
this.#registryDefault = registry;
|
||||
this.provider = provider;
|
||||
|
||||
@@ -163,12 +170,12 @@ export class RpcCore {
|
||||
// add any extra user-defined sections
|
||||
this.sections.push(...Object.keys(userRpc).filter((k) => !this.sections.includes(k)));
|
||||
|
||||
for (let s = 0; s < this.sections.length; s++) {
|
||||
for (let s = 0, scount = this.sections.length; s < scount; s++) {
|
||||
const section = this.sections[s];
|
||||
const defs = objectSpread<Record<string, DefinitionRpc | DefinitionRpcSub>>({}, rpcDefinitions[section as 'babe'], userRpc[section]);
|
||||
const methods = Object.keys(defs);
|
||||
|
||||
for (let m = 0; m < methods.length; m++) {
|
||||
for (let m = 0, mcount = methods.length; m < mcount; m++) {
|
||||
const method = methods[m];
|
||||
const def = defs[method];
|
||||
const jsonrpc = def.endpoint || `${section}_${method}`;
|
||||
@@ -227,7 +234,7 @@ export class RpcCore {
|
||||
? await this.#getBlockRegistry(u8aToU8a(blockHash))
|
||||
: { registry: this.#registryDefault };
|
||||
|
||||
const params = this._formatInputs(registry, null, def, values);
|
||||
const params = this._formatParams(registry, null, def, values);
|
||||
|
||||
// only cache .at(<blockHash>) queries, e.g. where valid blockHash was supplied
|
||||
const result = await this.provider.send<AnyJson>(rpcName, params.map((p) => p.toJSON()), !!blockHash);
|
||||
@@ -307,8 +314,7 @@ export class RpcCore {
|
||||
};
|
||||
|
||||
try {
|
||||
const params = this._formatInputs(registry, null, def, values);
|
||||
const paramsJson = params.map((p) => p.toJSON());
|
||||
const params = this._formatParams(registry, null, def, values);
|
||||
|
||||
const update = (error?: Error | null, result?: unknown): void => {
|
||||
if (error) {
|
||||
@@ -324,7 +330,7 @@ export class RpcCore {
|
||||
}
|
||||
};
|
||||
|
||||
subscriptionPromise = this._createSubscriber({ paramsJson, subName, subType, update }, errorHandler);
|
||||
subscriptionPromise = this._createSubscriber({ paramsJson: params.map((p) => p.toJSON()), subName, subType, update }, errorHandler);
|
||||
} catch (error) {
|
||||
errorHandler(error as Error);
|
||||
}
|
||||
@@ -355,19 +361,21 @@ export class RpcCore {
|
||||
return memoized;
|
||||
}
|
||||
|
||||
private _formatInputs (registry: Registry, blockHash: Uint8Array | string | null | undefined, def: DefinitionRpc, inputs: unknown[]): Codec[] {
|
||||
const reqArgCount = def.params.filter(({ isOptional }) => !isOptional).length;
|
||||
const optText = reqArgCount === def.params.length
|
||||
? ''
|
||||
: ` (${def.params.length - reqArgCount} optional)`;
|
||||
private _formatParams (registry: Registry, blockHash: Uint8Array | string | null | undefined, def: DefinitionRpc, inputs: unknown[]): Codec[] {
|
||||
const count = inputs.length;
|
||||
const reqCount = def.params.filter(({ isOptional }) => !isOptional).length;
|
||||
|
||||
if (inputs.length < reqArgCount || inputs.length > def.params.length) {
|
||||
throw new Error(`Expected ${def.params.length} parameters${optText}, ${inputs.length} found instead`);
|
||||
if (count < reqCount || count > def.params.length) {
|
||||
throw new Error(`Expected ${def.params.length} parameters${reqCount === def.params.length ? '' : ` (${def.params.length - reqCount} optional)`}, ${count} found instead`);
|
||||
}
|
||||
|
||||
return inputs.map((input, index): Codec =>
|
||||
registry.createTypeUnsafe(def.params[index].type, [input], { blockHash })
|
||||
);
|
||||
const params = new Array<Codec>(count);
|
||||
|
||||
for (let i = 0; i < count; i++) {
|
||||
params[i] = registry.createTypeUnsafe(def.params[i].type, [inputs[i]], { blockHash });
|
||||
}
|
||||
|
||||
return params;
|
||||
}
|
||||
|
||||
private _formatOutput (registry: Registry, blockHash: Uint8Array | string | null | undefined, method: string, rpc: DefinitionRpc, params: Codec[], result?: unknown): Codec | Codec[] {
|
||||
@@ -382,10 +390,18 @@ export class RpcCore {
|
||||
? this._formatStorageSet(registry, (result as StorageChangeSetJSON).block, keys, (result as StorageChangeSetJSON).changes)
|
||||
: registry.createType('StorageChangeSet', result);
|
||||
} else if (rpc.type === 'Vec<StorageChangeSet>') {
|
||||
const mapped = (result as StorageChangeSetJSON[]).map(({ block, changes }): [Hash, Codec[]] => [
|
||||
registry.createType('Hash', block),
|
||||
this._formatStorageSet(registry, block, params[0] as Vec<StorageKey>, changes)
|
||||
]);
|
||||
const jsonSet = (result as StorageChangeSetJSON[]);
|
||||
const count = jsonSet.length;
|
||||
const mapped = new Array<[Hash, Codec[]]>(count);
|
||||
|
||||
for (let i = 0; i < count; i++) {
|
||||
const { block, changes } = jsonSet[i];
|
||||
|
||||
mapped[i] = [
|
||||
registry.createType('BlockHash', block),
|
||||
this._formatStorageSet(registry, block, params[0] as Vec<StorageKey>, changes)
|
||||
];
|
||||
}
|
||||
|
||||
// we only query at a specific block, not a range - flatten
|
||||
return method === 'queryStorageAt'
|
||||
@@ -412,17 +428,17 @@ export class RpcCore {
|
||||
|
||||
private _formatStorageSet (registry: Registry, blockHash: string, keys: Vec<StorageKey>, changes: [string, string | null][]): Codec[] {
|
||||
// For StorageChangeSet, the changes has the [key, value] mappings
|
||||
const withCache = keys.length !== 1;
|
||||
const count = keys.length;
|
||||
const withCache = count !== 1;
|
||||
const values = new Array<Codec>(count);
|
||||
|
||||
// multiple return values (via state.storage subscription), decode the values
|
||||
// one at a time, all based on the query types. Three values can be returned -
|
||||
// - Codec - There is a valid value, non-empty
|
||||
// - null - The storage key is empty
|
||||
return keys.reduce((results: Codec[], key: StorageKey, index): Codec[] => {
|
||||
results.push(this._formatStorageSetEntry(registry, blockHash, key, changes, withCache, index));
|
||||
// multiple return values (via state.storage subscription), decode the
|
||||
// values one at a time, all based on the supplied query types
|
||||
for (let i = 0; i < count; i++) {
|
||||
values[i] = this._formatStorageSetEntry(registry, blockHash, keys[i], changes, withCache, i);
|
||||
}
|
||||
|
||||
return results;
|
||||
}, []);
|
||||
return values;
|
||||
}
|
||||
|
||||
private _formatStorageSetEntry (registry: Registry, blockHash: string, key: StorageKey, changes: [string, string | null][], withCache: boolean, entryIndex: number): Codec {
|
||||
@@ -478,9 +494,9 @@ export class RpcCore {
|
||||
: hexToU8a(meta.fallback.toHex())
|
||||
: undefined
|
||||
: meta.modifier.isOptional
|
||||
? registry.createTypeUnsafe(type, [input], { blockHash, isPedantic: true })
|
||||
? registry.createTypeUnsafe(type, [input], { blockHash, isPedantic: this.#isPedantic })
|
||||
: input
|
||||
], { blockHash, isFallback: isEmpty && !!meta.fallback, isOptional: meta.modifier.isOptional, isPedantic: !meta.modifier.isOptional });
|
||||
], { blockHash, isFallback: isEmpty && !!meta.fallback, isOptional: meta.modifier.isOptional, isPedantic: this.#isPedantic && !meta.modifier.isOptional });
|
||||
} catch (error) {
|
||||
throw new Error(`Unable to decode storage ${key.section || 'unknown'}.${key.method || 'unknown'}:${entryNum}: ${(error as Error).message}`);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ describe('Cached Observables', (): void => {
|
||||
|
||||
beforeEach((): void => {
|
||||
provider = new MockProvider(registry);
|
||||
rpc = new RpcCore('123', registry, provider) as (RpcCore & RpcInterface);
|
||||
rpc = new RpcCore('123', registry, { provider }) as (RpcCore & RpcInterface);
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
|
||||
@@ -16,18 +16,21 @@ describe('Api', (): void => {
|
||||
|
||||
it('requires a provider with a send method', (): void => {
|
||||
expect(
|
||||
() => new RpcCore('234', registry, {} as unknown as ProviderInterface)
|
||||
() => new RpcCore('234', registry, { provider: {} as unknown as ProviderInterface })
|
||||
).toThrow(/Expected Provider/);
|
||||
});
|
||||
|
||||
it('allows for the definition of user RPCs', async () => {
|
||||
const provider = new MockProvider(registry);
|
||||
const rpc = new RpcCore('567', registry, provider, {
|
||||
testing: {
|
||||
foo: {
|
||||
description: 'foo',
|
||||
params: [{ name: 'bar', type: 'u32' }],
|
||||
type: 'Balance'
|
||||
const rpc = new RpcCore('567', registry, {
|
||||
provider,
|
||||
userRpc: {
|
||||
testing: {
|
||||
foo: {
|
||||
description: 'foo',
|
||||
params: [{ name: 'bar', type: 'u32' }],
|
||||
type: 'Balance'
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -38,7 +38,7 @@ describe('methodSend', (): void => {
|
||||
)
|
||||
} as unknown as ProviderInterface;
|
||||
|
||||
rpc = new RpcCore('987', registry, provider);
|
||||
rpc = new RpcCore('987', registry, { provider });
|
||||
});
|
||||
|
||||
it('checks for mismatched parameters', async (): Promise<void> => {
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
|
||||
export const packageInfo = { name: '@polkadot/rpc-core', path: 'auto', type: 'auto', version: '10.4.1' };
|
||||
export const packageInfo = { name: '@polkadot/rpc-core', path: 'auto', type: 'auto', version: '10.7.2' };
|
||||
|
||||
@@ -17,7 +17,7 @@ describe('replay', (): void => {
|
||||
|
||||
beforeEach((): void => {
|
||||
provider = new MockProvider(registry);
|
||||
rpc = new RpcCore('653', registry, provider) as (RpcCore & RpcInterface);
|
||||
rpc = new RpcCore('653', registry, { provider }) as (RpcCore & RpcInterface);
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
@@ -28,7 +28,7 @@ describe('replay', (): 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
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access, jest/no-conditional-expect
|
||||
expect(value.toString()).toEqual('mockChain'); // Defined in MockProvider
|
||||
resolve(true);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
},
|
||||
"exclude": [
|
||||
"**/checkTypes.manual.ts",
|
||||
"**/mod.ts",
|
||||
"**/*.spec.ts"
|
||||
],
|
||||
"references": [
|
||||
|
||||
@@ -18,26 +18,26 @@
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "10.4.1",
|
||||
"version": "10.7.2",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@polkadot/keyring": "^12.0.1",
|
||||
"@polkadot/types": "10.4.1",
|
||||
"@polkadot/types-support": "10.4.1",
|
||||
"@polkadot/util": "^12.0.1",
|
||||
"@polkadot/util-crypto": "^12.0.1",
|
||||
"@polkadot/x-fetch": "^12.0.1",
|
||||
"@polkadot/x-global": "^12.0.1",
|
||||
"@polkadot/x-ws": "^12.0.1",
|
||||
"eventemitter3": "^5.0.0",
|
||||
"@polkadot/keyring": "^12.2.1",
|
||||
"@polkadot/types": "10.7.2",
|
||||
"@polkadot/types-support": "10.7.2",
|
||||
"@polkadot/util": "^12.2.1",
|
||||
"@polkadot/util-crypto": "^12.2.1",
|
||||
"@polkadot/x-fetch": "^12.2.1",
|
||||
"@polkadot/x-global": "^12.2.1",
|
||||
"@polkadot/x-ws": "^12.2.1",
|
||||
"eventemitter3": "^5.0.1",
|
||||
"mock-socket": "^9.2.1",
|
||||
"nock": "^13.3.0",
|
||||
"tslib": "^2.5.0"
|
||||
"nock": "^13.3.1",
|
||||
"tslib": "^2.5.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@substrate/connect": "0.7.24"
|
||||
"@substrate/connect": "0.7.26"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@substrate/connect": "0.7.24"
|
||||
"@substrate/connect": "0.7.26"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export { packageInfo } from './packageInfo.js';
|
||||
|
||||
export { HttpProvider } from './http/index.js';
|
||||
export { packageInfo } from './packageInfo.js';
|
||||
export { ScProvider } from './substrate-connect/index.js';
|
||||
export { WsProvider } from './ws/index.js';
|
||||
|
||||
@@ -16,55 +16,55 @@ describe('decodeResponse', (): void => {
|
||||
|
||||
it('expects a non-empty input object', (): void => {
|
||||
expect(
|
||||
() => coder.decodeResponse(undefined as unknown as JsonRpcResponse)
|
||||
() => coder.decodeResponse(undefined as unknown as JsonRpcResponse<unknown>)
|
||||
).toThrow(/Invalid jsonrpc/);
|
||||
});
|
||||
|
||||
it('expects a valid jsonrpc field', (): void => {
|
||||
expect(
|
||||
() => coder.decodeResponse({} as JsonRpcResponse)
|
||||
() => coder.decodeResponse({} as JsonRpcResponse<unknown>)
|
||||
).toThrow(/Invalid jsonrpc/);
|
||||
});
|
||||
|
||||
it('expects a valid id field', (): void => {
|
||||
expect(
|
||||
() => coder.decodeResponse({ jsonrpc: '2.0' } as JsonRpcResponse)
|
||||
() => coder.decodeResponse({ jsonrpc: '2.0' } as JsonRpcResponse<unknown>)
|
||||
).toThrow(/Invalid id/);
|
||||
});
|
||||
|
||||
it('expects a valid result field', (): void => {
|
||||
expect(
|
||||
() => coder.decodeResponse({ id: 1, jsonrpc: '2.0' } as JsonRpcResponse)
|
||||
() => coder.decodeResponse({ id: 1, jsonrpc: '2.0' } as JsonRpcResponse<unknown>)
|
||||
).toThrow(/No result/);
|
||||
});
|
||||
|
||||
it('throws any error found', (): void => {
|
||||
expect(
|
||||
() => coder.decodeResponse({ error: { code: 123, message: 'test error' }, id: 1, jsonrpc: '2.0' } as JsonRpcResponse)
|
||||
() => coder.decodeResponse({ error: { code: 123, message: 'test error' }, id: 1, jsonrpc: '2.0' } as JsonRpcResponse<unknown>)
|
||||
).toThrow(/123: test error/);
|
||||
});
|
||||
|
||||
it('throws any error found, with data', (): void => {
|
||||
expect(
|
||||
() => coder.decodeResponse({ error: { code: 123, data: 'Error("Some random error description")', message: 'test error' }, id: 1, jsonrpc: '2.0' } as JsonRpcResponse)
|
||||
() => coder.decodeResponse({ error: { code: 123, data: 'Error("Some random error description")', message: 'test error' }, id: 1, jsonrpc: '2.0' } as JsonRpcResponse<unknown>)
|
||||
).toThrow(/123: test error: Some random error description/);
|
||||
});
|
||||
|
||||
it('allows for number subscription ids', (): void => {
|
||||
expect(
|
||||
coder.decodeResponse({ id: 1, jsonrpc: '2.0', method: 'test', params: { result: 'test result', subscription: 1 } } as JsonRpcResponse)
|
||||
coder.decodeResponse({ id: 1, jsonrpc: '2.0', method: 'test', params: { result: 'test result', subscription: 1 } } as JsonRpcResponse<unknown>)
|
||||
).toEqual('test result');
|
||||
});
|
||||
|
||||
it('allows for string subscription ids', (): void => {
|
||||
expect(
|
||||
coder.decodeResponse({ id: 1, jsonrpc: '2.0', method: 'test', params: { result: 'test result', subscription: 'abc' } } as JsonRpcResponse)
|
||||
coder.decodeResponse({ id: 1, jsonrpc: '2.0', method: 'test', params: { result: 'test result', subscription: 'abc' } } as JsonRpcResponse<unknown>)
|
||||
).toEqual('test result');
|
||||
});
|
||||
|
||||
it('returns the result', (): void => {
|
||||
expect(
|
||||
coder.decodeResponse({ id: 1, jsonrpc: '2.0', result: 'some result' } as JsonRpcResponse)
|
||||
coder.decodeResponse({ id: 1, jsonrpc: '2.0', result: 'some result' } as JsonRpcResponse<unknown>)
|
||||
).toEqual('some result');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -29,10 +29,10 @@ function extend<Data, K extends keyof RpcError<Data>> (that: RpcError<Data>, nam
|
||||
* throw new RpcError('some message', RpcError.CODES.METHOD_NOT_FOUND); // => error.code = -32601
|
||||
* ```
|
||||
*/
|
||||
export default class RpcError<Data = never> extends Error implements RpcErrorInterface<Data> {
|
||||
export default class RpcError<T = never> extends Error implements RpcErrorInterface<T> {
|
||||
public code!: number;
|
||||
|
||||
public data?: Data;
|
||||
public data?: T;
|
||||
|
||||
public override message!: string;
|
||||
|
||||
@@ -40,7 +40,7 @@ export default class RpcError<Data = never> extends Error implements RpcErrorInt
|
||||
|
||||
public override stack!: string;
|
||||
|
||||
public constructor (message = '', code: number = UNKNOWN, data?: Data) {
|
||||
public constructor (message = '', code: number = UNKNOWN, data?: T) {
|
||||
super();
|
||||
|
||||
extend(this, 'message', String(message));
|
||||
|
||||
@@ -35,7 +35,7 @@ function checkError (error?: JsonRpcResponseBaseError): void {
|
||||
export class RpcCoder {
|
||||
#id = 0;
|
||||
|
||||
public decodeResponse (response?: JsonRpcResponse): unknown {
|
||||
public decodeResponse <T> (response?: JsonRpcResponse<T>): T {
|
||||
if (!response || response.jsonrpc !== '2.0') {
|
||||
throw new Error('Invalid jsonrpc field in decoded object');
|
||||
}
|
||||
|
||||
@@ -45,14 +45,17 @@ describe('Http', (): void => {
|
||||
|
||||
it('does not (yet) support subscribe', async (): Promise<void> => {
|
||||
await http.subscribe('', '', [], (cb): void => {
|
||||
// eslint-disable-next-line jest/no-conditional-expect
|
||||
expect(cb).toEqual(expect.anything());
|
||||
}).catch((error): void => {
|
||||
// eslint-disable-next-line jest/no-conditional-expect
|
||||
expect((error as Error).message).toMatch(/does not have subscriptions/);
|
||||
});
|
||||
});
|
||||
|
||||
it('does not (yet) support unsubscribe', async (): Promise<void> => {
|
||||
await http.unsubscribe('', '', 0).catch((error): void => {
|
||||
// eslint-disable-next-line jest/no-conditional-expect
|
||||
expect((error as Error).message).toMatch(/does not have subscriptions/);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import type { JsonRpcResponse, ProviderInterface, ProviderInterfaceCallback, ProviderInterfaceEmitCb, ProviderInterfaceEmitted, ProviderStats } from '../types.js';
|
||||
|
||||
import { logger } from '@polkadot/util';
|
||||
import { logger, noop } from '@polkadot/util';
|
||||
import { fetch } from '@polkadot/x-fetch';
|
||||
|
||||
import { RpcCoder } from '../coder/index.js';
|
||||
@@ -115,9 +115,7 @@ export class HttpProvider implements ProviderInterface {
|
||||
public on (_type: ProviderInterfaceEmitted, _sub: ProviderInterfaceEmitCb): () => void {
|
||||
l.error('HTTP Provider does not have \'on\' emitters, use WebSockets instead');
|
||||
|
||||
return (): void => {
|
||||
// noop
|
||||
};
|
||||
return noop;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -168,7 +166,7 @@ export class HttpProvider implements ProviderInterface {
|
||||
|
||||
this.#stats.total.bytesRecv += result.length;
|
||||
|
||||
const decoded = this.#coder.decodeResponse(JSON.parse(result) as JsonRpcResponse) as T;
|
||||
const decoded = this.#coder.decodeResponse(JSON.parse(result) as JsonRpcResponse<T>);
|
||||
|
||||
this.#stats.active.requests--;
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import { HttpProvider } from './index.js';
|
||||
|
||||
// Does not work with Node 18 (native fetch)
|
||||
// See https://github.com/nock/nock/issues/2397
|
||||
// eslint-disable-next-line jest/no-disabled-tests
|
||||
describe.skip('send', (): void => {
|
||||
let http: HttpProvider;
|
||||
let mock: Mock;
|
||||
@@ -53,6 +54,7 @@ describe.skip('send', (): void => {
|
||||
return http
|
||||
.send('test_error', [])
|
||||
.catch((error): void => {
|
||||
// eslint-disable-next-line jest/no-conditional-expect
|
||||
expect((error as Error).message).toMatch(/\[500\]/);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -48,9 +48,10 @@ export class LRUCache {
|
||||
|
||||
entries (): [string, unknown][] {
|
||||
const keys = this.keys();
|
||||
const entries = new Array<[string, unknown]>(keys.length);
|
||||
const count = keys.length;
|
||||
const entries = new Array<[string, unknown]>(count);
|
||||
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
for (let i = 0; i < count; i++) {
|
||||
const key = keys[i];
|
||||
|
||||
entries[i] = [key, this.#data.get(key)];
|
||||
|
||||
@@ -21,7 +21,8 @@ describe('on', (): void => {
|
||||
await mock.disconnect();
|
||||
});
|
||||
|
||||
it('it emits both connected and disconnected events', async (): Promise<void> => {
|
||||
// eslint-disable-next-line jest/expect-expect
|
||||
it('emits both connected and disconnected events', async (): Promise<void> => {
|
||||
const events: Record<string, boolean> = { connected: false, disconnected: false };
|
||||
|
||||
await new Promise<boolean>((resolve) => {
|
||||
|
||||
@@ -23,6 +23,7 @@ describe('send', (): void => {
|
||||
return mock
|
||||
.send('something_invalid', [])
|
||||
.catch((error): void => {
|
||||
// eslint-disable-next-line jest/no-conditional-expect
|
||||
expect((error as Error).message).toMatch(/Invalid method/);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -23,6 +23,7 @@ describe('subscribe', (): void => {
|
||||
await mock
|
||||
.subscribe('test', 'test_notFound')
|
||||
.catch((error): void => {
|
||||
// eslint-disable-next-line jest/no-conditional-expect
|
||||
expect((error as Error).message).toMatch(/Invalid method 'test_notFound'/);
|
||||
});
|
||||
});
|
||||
@@ -41,12 +42,14 @@ describe('subscribe', (): void => {
|
||||
|
||||
await new Promise<boolean>((resolve) => {
|
||||
mock.subscribe('chain_newHead', 'chain_subscribeNewHead', (_: any, value: string): void => {
|
||||
// eslint-disable-next-line jest/no-conditional-expect
|
||||
expect(value).toEqual('testValue');
|
||||
resolve(true);
|
||||
}).catch(console.error);
|
||||
});
|
||||
});
|
||||
|
||||
// eslint-disable-next-line jest/expect-expect
|
||||
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 => {
|
||||
@@ -57,6 +60,7 @@ describe('subscribe', (): void => {
|
||||
});
|
||||
});
|
||||
|
||||
// eslint-disable-next-line jest/expect-expect
|
||||
it('handles errors within callbacks gracefully', async (): Promise<void> => {
|
||||
let hasThrown = false;
|
||||
|
||||
|
||||
@@ -30,12 +30,14 @@ describe('unsubscribe', (): void => {
|
||||
await mock
|
||||
.unsubscribe('chain_newHead', 'chain_subscribeNewHead', 5)
|
||||
.catch((error): boolean => {
|
||||
// eslint-disable-next-line jest/no-conditional-expect
|
||||
expect((error as Error).message).toMatch(/Unable to find/);
|
||||
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
// eslint-disable-next-line jest/expect-expect
|
||||
it('unsubscribes successfully', async (): Promise<void> => {
|
||||
await mock.unsubscribe('chain_newHead', 'chain_subscribeNewHead', id);
|
||||
});
|
||||
@@ -46,6 +48,7 @@ describe('unsubscribe', (): void => {
|
||||
mock.unsubscribe('chain_newHead', 'chain_subscribeNewHead', id)
|
||||
)
|
||||
.catch((error): boolean => {
|
||||
// eslint-disable-next-line jest/no-conditional-expect
|
||||
expect((error as Error).message).toMatch(/Unable to find/);
|
||||
|
||||
return false;
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
|
||||
export const packageInfo = { name: '@polkadot/rpc-provider', path: 'auto', type: 'auto', version: '10.4.1' };
|
||||
export const packageInfo = { name: '@polkadot/rpc-provider', path: 'auto', type: 'auto', version: '10.7.2' };
|
||||
|
||||
@@ -321,6 +321,7 @@ describe('ScProvider', () => {
|
||||
expect(chain._isTerminated()).toBe(true);
|
||||
});
|
||||
|
||||
// eslint-disable-next-line jest/expect-expect
|
||||
it('does not throw when disconnecting on an already disconnected Provider', async () => {
|
||||
const provider = new ScProvider(mockSc, '');
|
||||
|
||||
|
||||
@@ -132,11 +132,11 @@ export class ScProvider implements ProviderInterface {
|
||||
return;
|
||||
}
|
||||
|
||||
const response = JSON.parse(hcRes) as JsonRpcResponse;
|
||||
const response = JSON.parse(hcRes) as JsonRpcResponse<string>;
|
||||
let decodedResponse: string | Error;
|
||||
|
||||
try {
|
||||
decodedResponse = this.#coder.decodeResponse(response) as string;
|
||||
decodedResponse = this.#coder.decodeResponse(response);
|
||||
} catch (e) {
|
||||
decodedResponse = e as Error;
|
||||
}
|
||||
|
||||
@@ -17,30 +17,30 @@ export interface JsonRpcResponseBaseError {
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface RpcErrorInterface<Data> {
|
||||
export interface RpcErrorInterface<T> {
|
||||
code: number;
|
||||
data?: Data;
|
||||
data?: T;
|
||||
message: string;
|
||||
stack: string;
|
||||
}
|
||||
|
||||
interface JsonRpcResponseSingle {
|
||||
interface JsonRpcResponseSingle<T> {
|
||||
error?: JsonRpcResponseBaseError;
|
||||
result?: unknown;
|
||||
result: T;
|
||||
}
|
||||
|
||||
interface JsonRpcResponseSubscription {
|
||||
interface JsonRpcResponseSubscription<T> {
|
||||
method?: string;
|
||||
params: {
|
||||
error?: JsonRpcResponseBaseError;
|
||||
result: unknown;
|
||||
result: T;
|
||||
subscription: number | string;
|
||||
};
|
||||
}
|
||||
|
||||
export type JsonRpcResponseBase = JsonRpcResponseSingle & JsonRpcResponseSubscription;
|
||||
export type JsonRpcResponseBase<T> = JsonRpcResponseSingle<T> & JsonRpcResponseSubscription<T>;
|
||||
|
||||
export type JsonRpcResponse = JsonRpcObject & JsonRpcResponseBase;
|
||||
export type JsonRpcResponse<T> = JsonRpcObject & JsonRpcResponseBase<T>;
|
||||
|
||||
export type ProviderInterfaceCallback = (error: Error | null, result: any) => void;
|
||||
|
||||
|
||||
@@ -39,10 +39,12 @@ describe('Ws', (): void => {
|
||||
).toEqual(false);
|
||||
});
|
||||
|
||||
// eslint-disable-next-line jest/expect-expect
|
||||
it('allows you to initialize the provider with custom headers', () => {
|
||||
createWs([], 100, { foo: 'bar' });
|
||||
});
|
||||
|
||||
// eslint-disable-next-line jest/expect-expect
|
||||
it('allows you to set custom timeout value for handlers', () => {
|
||||
const CUSTOM_TIMEOUT_S = 90;
|
||||
const CUSTOM_TIMEOUT_MS = CUSTOM_TIMEOUT_S * 1000;
|
||||
@@ -52,6 +54,7 @@ describe('Ws', (): void => {
|
||||
});
|
||||
|
||||
describe('Endpoint Parsing', (): void => {
|
||||
// eslint-disable-next-line jest/expect-expect
|
||||
it('Succeeds when WsProvider endpoint is a valid string', () => {
|
||||
/* eslint-disable no-new */
|
||||
new WsProvider(TEST_WS_URL, 0);
|
||||
@@ -63,6 +66,7 @@ describe('Endpoint Parsing', (): void => {
|
||||
).toThrow(/^Endpoint should start with /);
|
||||
});
|
||||
|
||||
// eslint-disable-next-line jest/expect-expect
|
||||
it('Succeeds when WsProvider endpoint is a valid array', () => {
|
||||
const endpoints: string[] = ['ws://127.0.0.1:9955', 'wss://testnet.io:9944', 'ws://mychain.com:9933'];
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
// Copyright 2017-2023 @polkadot/rpc-provider authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/* eslint-disable camelcase */
|
||||
|
||||
import type { Constructor } from '@polkadot/util/types';
|
||||
import type { EndpointStats, JsonRpcResponse, ProviderInterface, ProviderInterfaceCallback, ProviderInterfaceEmitCb, ProviderInterfaceEmitted, ProviderStats } from '../types.js';
|
||||
|
||||
import { EventEmitter } from 'eventemitter3';
|
||||
@@ -92,7 +91,7 @@ export class WsProvider implements ProviderInterface {
|
||||
readonly #handlers: Record<string, WsStateAwaiting> = {};
|
||||
readonly #isReadyPromise: Promise<WsProvider>;
|
||||
readonly #stats: ProviderStats;
|
||||
readonly #waitingForId: Record<string, JsonRpcResponse> = {};
|
||||
readonly #waitingForId: Record<string, JsonRpcResponse<unknown>> = {};
|
||||
|
||||
#autoConnectMs: number;
|
||||
#endpointIndex: number;
|
||||
@@ -209,8 +208,8 @@ export class WsProvider implements ProviderInterface {
|
||||
try {
|
||||
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)
|
||||
// the as here is Deno-specific - not available on the globalThis
|
||||
this.#websocket = typeof xglobal.WebSocket !== 'undefined' && isChildClass(xglobal.WebSocket as unknown as Constructor<WebSocket>, WebSocket)
|
||||
? new WebSocket(this.endpoint)
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore - WS may be an instance of ws, which supports options
|
||||
@@ -357,8 +356,12 @@ export class WsProvider implements ProviderInterface {
|
||||
start: Date.now(),
|
||||
subscription
|
||||
};
|
||||
this.#endpointStats.bytesSent += body.length;
|
||||
this.#stats.total.bytesSent += body.length;
|
||||
|
||||
const bytesSent = body.length;
|
||||
|
||||
this.#endpointStats.bytesSent += bytesSent;
|
||||
this.#stats.total.bytesSent += bytesSent;
|
||||
|
||||
this.#websocket.send(body);
|
||||
} catch (error) {
|
||||
this.#endpointStats.errors++;
|
||||
@@ -481,17 +484,19 @@ 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 bytesRecv = message.data.length;
|
||||
|
||||
const response = JSON.parse(message.data) as JsonRpcResponse;
|
||||
this.#endpointStats.bytesRecv += bytesRecv;
|
||||
this.#stats.total.bytesRecv += bytesRecv;
|
||||
|
||||
const response = JSON.parse(message.data) as JsonRpcResponse<string>;
|
||||
|
||||
return isUndefined(response.method)
|
||||
? this.#onSocketMessageResult(response)
|
||||
: this.#onSocketMessageSubscribe(response);
|
||||
};
|
||||
|
||||
#onSocketMessageResult = (response: JsonRpcResponse): void => {
|
||||
#onSocketMessageResult = (response: JsonRpcResponse<string>): void => {
|
||||
const handler = this.#handlers[response.id];
|
||||
|
||||
if (!handler) {
|
||||
@@ -502,7 +507,7 @@ export class WsProvider implements ProviderInterface {
|
||||
|
||||
try {
|
||||
const { method, params, subscription } = handler;
|
||||
const result = this.#coder.decodeResponse(response) as string;
|
||||
const result = this.#coder.decodeResponse<string>(response);
|
||||
|
||||
// first send the result - in case of subs, we may have an update
|
||||
// immediately if we have some queued results already
|
||||
@@ -531,7 +536,7 @@ export class WsProvider implements ProviderInterface {
|
||||
delete this.#handlers[response.id];
|
||||
};
|
||||
|
||||
#onSocketMessageSubscribe = (response: JsonRpcResponse): void => {
|
||||
#onSocketMessageSubscribe = (response: JsonRpcResponse<unknown>): void => {
|
||||
const method = ALIASES[response.method as string] || response.method || 'invalid';
|
||||
const subId = `${method}::${response.params.subscription}`;
|
||||
const handler = this.#subscriptions[subId];
|
||||
@@ -603,7 +608,7 @@ export class WsProvider implements ProviderInterface {
|
||||
const now = Date.now();
|
||||
const ids = Object.keys(this.#handlers);
|
||||
|
||||
for (let i = 0; i < ids.length; i++) {
|
||||
for (let i = 0, count = ids.length; i < count; i++) {
|
||||
const handler = this.#handlers[ids[i]];
|
||||
|
||||
if ((now - handler.start) > this.#timeout) {
|
||||
|
||||
@@ -59,6 +59,7 @@ describe('send', (): void => {
|
||||
ws
|
||||
.send('test_encoding', [{ error: 'send error' }])
|
||||
.catch((error): void => {
|
||||
// eslint-disable-next-line jest/no-conditional-expect
|
||||
expect((error as Error).message).toEqual('send error');
|
||||
})
|
||||
);
|
||||
@@ -99,6 +100,7 @@ describe('send', (): void => {
|
||||
ws
|
||||
.send('test_error', [])
|
||||
.catch((error): void => {
|
||||
// eslint-disable-next-line jest/no-conditional-expect
|
||||
expect((error as Error).message).toMatch(/666: error/);
|
||||
})
|
||||
);
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
"resolveJsonModule": true
|
||||
},
|
||||
"exclude": [
|
||||
"**/*.spec.ts"
|
||||
"**/*.spec.ts",
|
||||
"**/mod.ts"
|
||||
],
|
||||
"references": [
|
||||
{ "path": "../types/tsconfig.build.json" },
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
"baseUrl": "..",
|
||||
"outDir": "./build",
|
||||
"rootDir": "./src",
|
||||
"resolveJsonModule": true,
|
||||
"emitDeclarationOnly": false,
|
||||
"resolveJsonModule": true,
|
||||
"noEmit": true
|
||||
},
|
||||
"include": [
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "10.4.1",
|
||||
"version": "10.7.2",
|
||||
"main": "index.js",
|
||||
"bin": {
|
||||
"polkadot-types-chain-info": "./scripts/polkadot-types-chain-info.mjs",
|
||||
@@ -28,21 +28,21 @@
|
||||
"polkadot-types-internal-metadata": "./scripts/polkadot-types-internal-metadata.mjs"
|
||||
},
|
||||
"dependencies": {
|
||||
"@polkadot/api": "10.4.1",
|
||||
"@polkadot/api-augment": "10.4.1",
|
||||
"@polkadot/rpc-augment": "10.4.1",
|
||||
"@polkadot/rpc-provider": "10.4.1",
|
||||
"@polkadot/types": "10.4.1",
|
||||
"@polkadot/types-augment": "10.4.1",
|
||||
"@polkadot/types-codec": "10.4.1",
|
||||
"@polkadot/types-create": "10.4.1",
|
||||
"@polkadot/types-support": "10.4.1",
|
||||
"@polkadot/util": "^12.0.1",
|
||||
"@polkadot/util-crypto": "^12.0.1",
|
||||
"@polkadot/x-ws": "^12.0.1",
|
||||
"@polkadot/api": "10.7.2",
|
||||
"@polkadot/api-augment": "10.7.2",
|
||||
"@polkadot/rpc-augment": "10.7.2",
|
||||
"@polkadot/rpc-provider": "10.7.2",
|
||||
"@polkadot/types": "10.7.2",
|
||||
"@polkadot/types-augment": "10.7.2",
|
||||
"@polkadot/types-codec": "10.7.2",
|
||||
"@polkadot/types-create": "10.7.2",
|
||||
"@polkadot/types-support": "10.7.2",
|
||||
"@polkadot/util": "^12.2.1",
|
||||
"@polkadot/util-crypto": "^12.2.1",
|
||||
"@polkadot/x-ws": "^12.2.1",
|
||||
"handlebars": "^4.7.7",
|
||||
"tslib": "^2.5.0",
|
||||
"yargs": "^17.7.1"
|
||||
"tslib": "^2.5.2",
|
||||
"yargs": "^17.7.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/websocket": "^1.0.5",
|
||||
|
||||
@@ -24,13 +24,13 @@ function getDefs (apis: Apis | null, defs: Record<string, Definitions>): Record<
|
||||
const named: Record<string, Record<string, DefinitionCallNamed>> = {};
|
||||
const all = Object.values(defs);
|
||||
|
||||
for (let j = 0; j < all.length; j++) {
|
||||
for (let j = 0, jcount = all.length; j < jcount; j++) {
|
||||
const set = all[j].runtime;
|
||||
|
||||
if (set) {
|
||||
const sections = Object.entries(set);
|
||||
|
||||
for (let i = 0; i < sections.length; i++) {
|
||||
for (let i = 0, scount = sections.length; i < scount; i++) {
|
||||
const [_section, sec] = sections[i];
|
||||
const sectionHash = blake2AsHex(_section, 64);
|
||||
const api = apis && apis.find(([h]) => h === sectionHash);
|
||||
@@ -40,15 +40,16 @@ function getDefs (apis: Apis | null, defs: Record<string, Definitions>): Record<
|
||||
|
||||
if (ver) {
|
||||
const methods = Object.entries(ver.methods);
|
||||
const mcount = methods.length;
|
||||
|
||||
if (methods.length) {
|
||||
if (mcount) {
|
||||
const section = stringCamelCase(_section);
|
||||
|
||||
if (!named[section]) {
|
||||
named[section] = {};
|
||||
}
|
||||
|
||||
for (let m = 0; m < methods.length; m++) {
|
||||
for (let m = 0; m < mcount; m++) {
|
||||
const [_method, def] = methods[m];
|
||||
const method = stringCamelCase(_method);
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ import substrateMeta from '@polkadot/types-support/metadata/static-substrate';
|
||||
import { isHex, stringCamelCase, stringLowerFirst } from '@polkadot/util';
|
||||
import { blake2AsHex } from '@polkadot/util-crypto';
|
||||
|
||||
import { assertFile, getMetadataViaWs } from './util/index.js';
|
||||
import { assertFile, getMetadataViaWs, getRpcMethodsViaWs, getRuntimeVersionViaWs } from './util/index.js';
|
||||
|
||||
interface SectionItem {
|
||||
link?: string;
|
||||
@@ -477,6 +477,8 @@ async function mainPromise (): Promise<void> {
|
||||
if (endpoint) {
|
||||
if (endpoint.startsWith('wss://') || endpoint.startsWith('ws://')) {
|
||||
metaHex = await getMetadataViaWs(endpoint);
|
||||
rpcMethods = await getRpcMethodsViaWs(endpoint);
|
||||
runtimeApis = await getRuntimeVersionViaWs(endpoint);
|
||||
} else {
|
||||
metaHex = (
|
||||
JSON.parse(
|
||||
@@ -505,12 +507,8 @@ async function mainPromise (): Promise<void> {
|
||||
const runtimeDesc = `default ${chainName} runtime`;
|
||||
const docRoot = `docs/${chainName.toLowerCase()}`;
|
||||
|
||||
// TODO Pass the result from `rpc_methods` (done via util/wsMeta.ts -> getRpcMethodsViaWs)
|
||||
// into here if we want to have a per-chain overview (via args)
|
||||
writeFile(`${docRoot}/rpc.md`, addRpc(runtimeDesc, rpcMethods));
|
||||
|
||||
// TODO Pass the result from `state_getRuntimeVersion` (done via util/wsMeta.ts -> getRuntimeVersionViaWs)
|
||||
// into here if we want to have a per-chain overview (via args)
|
||||
writeFile(`${docRoot}/runtime.md`, addRuntime(runtimeDesc, runtimeApis));
|
||||
|
||||
writeFile(`${docRoot}/constants.md`, addConstants(runtimeDesc, latest));
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
|
||||
export const packageInfo = { name: '@polkadot/typegen', path: 'auto', type: 'auto', version: '10.4.1' };
|
||||
export const packageInfo = { name: '@polkadot/typegen', path: 'auto', type: 'auto', version: '10.7.2' };
|
||||
|
||||
@@ -8,3 +8,6 @@ import { readTemplate } from './file.js';
|
||||
Handlebars.registerPartial({
|
||||
docs: Handlebars.compile(readTemplate('docs'))
|
||||
});
|
||||
|
||||
// empty export
|
||||
export const __TYPEGEN_DUMMY_DOCS = 'DUMMY_DOCS';
|
||||
|
||||
@@ -41,7 +41,7 @@ function splitAlternatives (type: string): string[] {
|
||||
let level = 0;
|
||||
|
||||
// we assume that the string starts with '['
|
||||
for (let i = 1; i < type.length; i++) {
|
||||
for (let i = 1, count = type.length; i < count; i++) {
|
||||
if (level === 0) {
|
||||
switch (type[i]) {
|
||||
case ']':
|
||||
|
||||
@@ -5,6 +5,14 @@
|
||||
"outDir": "./build",
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"include": [
|
||||
"src/**/*"
|
||||
],
|
||||
"exclude": [
|
||||
"scripts/**/*",
|
||||
"**/*.spec.ts",
|
||||
"**/mod.ts"
|
||||
],
|
||||
"references": [
|
||||
{ "path": "../api/tsconfig.build.json" },
|
||||
{ "path": "../api-augment/tsconfig.build.json" },
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user