Compare commits

..
51 Commits
Author SHA1 Message Date
github-actions[bot] 9217f83870 [CI Skip] release/stable 9.13.6
skip-checks: true
2023-02-05 11:35:16 +00:00
Jaco cf261724c3 9.13.6 (#5475) 2023-02-05 13:26:52 +02:00
github-actions[bot] 375afb5dff [CI Skip] bump/beta 9.13.6-5-x
skip-checks: true
2023-02-05 08:08:53 +00:00
Jaco 9e5779644c Bump dev (#5474) 2023-02-05 09:57:56 +02:00
github-actions[bot] a6a92837e4 [CI Skip] bump/beta 9.13.6-4-x
skip-checks: true
2023-02-04 15:40:31 +00:00
Aleš Ferlan d84f40dd77 fix: use H160 for address in getTransactionCount (#5472) 2023-02-04 17:31:53 +02:00
github-actions[bot] 5183c28d5e [CI Skip] bump/beta 9.13.6-3-x
skip-checks: true
2023-02-03 22:30:29 +00:00
Jaco 5ed3ea51d3 Add script to retrieve local meta/rpc/version (#5471)
* Add script to retrieve local meta/rpc/version

* Filter _unknown_

* Cleanup

* Additional
2023-02-04 00:22:36 +02:00
github-actions[bot] 39d76c969d [CI Skip] bump/beta 9.13.6-2-x
skip-checks: true
2023-02-03 13:08:35 +00:00
Jaco 5cf4c4edbe Overrides for deployed Weight 1.5 chains (#5469) 2023-02-03 15:00:46 +02:00
github-actions[bot] f6c376a3e7 [CI Skip] bump/beta 9.13.6-1-x
skip-checks: true
2023-02-03 08:58:09 +00:00
Jaco d9a2265b0f Bump deps (incl. TS) (#5468) 2023-02-03 10:48:46 +02:00
github-actions[bot] 0c1b1c48f2 [CI Skip] bump/beta 9.13.6-0-x
skip-checks: true
2023-02-02 11:11:44 +00:00
Jaco 7c24998e28 Adjust PortableRegistry aliases (w/o any Weight) (#5466) 2023-02-02 13:03:48 +02:00
github-actions[bot] bf442a4bd4 [CI Skip] release/stable 9.13.5
skip-checks: true
2023-02-02 09:52:22 +00:00
Jaco 40f432badb Adjust for aliasses for Weight 1.5 (#5465)
* Adjust for aliasses for Weight 1.5

* 9.13.5
2023-02-02 11:43:24 +02:00
github-actions[bot] 15a8681ba0 [CI Skip] release/stable 9.13.4
skip-checks: true
2023-02-01 07:48:32 +00:00
Jaco 61ed6e97f4 9.13.4 (#5463) 2023-02-01 09:37:31 +02:00
github-actions[bot] eee4bf51d6 [CI Skip] release/stable 9.13.3
skip-checks: true
2023-02-01 06:28:13 +00:00
Jaco b9cbb9e2e8 Adjust Weight alias for WeightV0 injection (#5462)
* Adjust Weight alias for WeightV0 injection

* 9.13.3
2023-02-01 08:20:06 +02:00
github-actions[bot] ed426108f2 [CI Skip] release/stable 9.13.2
skip-checks: true
2023-01-29 07:25:40 +00:00
Jaco c168615305 Allow null as valid param to Int/UInt (#5458) 2023-01-29 09:17:21 +02:00
Jaco 680ae0222a Bump eventemitter 3 (#5457) 2023-01-29 09:14:57 +02:00
github-actions[bot] dc3d34e4df [CI Skip] release/stable 9.13.1
skip-checks: true
2023-01-29 06:01:16 +00:00
Jaco d356fa4da6 9.13.1 (#5456) 2023-01-29 07:53:24 +02:00
github-actions[bot] 90eafdd820 [CI Skip] bump/beta 9.12.2-12-x
skip-checks: true
2023-01-28 09:58:20 +00:00
Jaco 263fca2510 Bump static metadata (#5455) 2023-01-28 11:50:32 +02:00
github-actions[bot] 04dcb490c3 [CI Skip] bump/beta 9.12.2-11-x
skip-checks: true
2023-01-28 08:00:05 +00:00
Jaco e8a96523b7 Bump util (#5454) 2023-01-28 09:49:10 +02:00
github-actions[bot] 226886acf7 [CI Skip] bump/beta 9.12.2-10-x
skip-checks: true
2023-01-28 07:18:40 +00:00
Jaco b544f24bcf Runtime definition cleanups (& CHANGELOG) (#5450)
* Runtime definition cleanups (& CHANGELOG)

* Adjust to pre-v3 levels

* Full CHANGELOG
2023-01-28 09:07:44 +02:00
github-actions[bot] f7ad6e09ed [CI Skip] bump/beta 9.12.2-9-x
skip-checks: true
2023-01-28 06:54:36 +00:00
Jaco 1d8abf1110 Add (unused) ability to filter rpcs/calls from chain info (#5453)
* Add (unused) ability to filter rpcs/calls from chain info

* Explicitly sort api versions

* Named tuples

* Re-order sorting

* Allow future name configurability

* Pass runtimeName to generators

* Remove unneeded lint overrides

* Allow doc root override

* Use chain name
2023-01-28 08:45:35 +02:00
github-actions[bot] fee281fcb4 [CI Skip] bump/beta 9.12.2-8-x
skip-checks: true
2023-01-27 08:28:57 +00:00
Jaco 1facb7dd71 Bump dev (#5451)
* Bump dev

* Bump dev
2023-01-27 10:21:06 +02:00
github-actions[bot] a96d7c789e [CI Skip] bump/beta 9.12.2-7-x
skip-checks: true
2023-01-27 04:52:46 +00:00
Stephen SheltonandJaco cc4e4b236d Add transaction-payment runtime API V3 (#5430)
* Add transaction-payment runtime API V3

* Apply suggestions from code review

* Update packages/types/src/interfaces/payment/runtime.ts

* Update packages/types/src/interfaces/payment/runtime.ts

* Apply suggestions from code review

* Handle query_info vs query_call_info correctly

Co-authored-by: Jaco <jacogr@gmail.com>
2023-01-27 06:43:02 +02:00
github-actions[bot] 932efb6ef5 [CI Skip] bump/beta 9.12.2-6-x
skip-checks: true
2023-01-26 09:59:38 +00:00
Jaco bf6c23eb86 Add composite base object (#5448)
* Add composite base object

* Missing toRawType
2023-01-26 11:51:40 +02:00
github-actions[bot] df1754eb2a [CI Skip] bump/beta 9.12.2-5-x
skip-checks: true
2023-01-26 07:33:50 +00:00
Jaco 1ce1f0a981 Remove unused BigInt extension (#5447) 2023-01-26 09:25:01 +02:00
github-actions[bot] 29537ea283 [CI Skip] bump/beta 9.12.2-4-x
skip-checks: true
2023-01-26 06:57:42 +00:00
Jaco 0b45618c5f Tighten up TS type with LookupString introduction (#5446)
* Tighten up TS type with LookupString introduction

* Adjust typegen
2023-01-26 08:49:53 +02:00
github-actions[bot] 48079d6f1a [CI Skip] bump/beta 9.12.2-3-x
skip-checks: true
2023-01-26 05:05:58 +00:00
Jaco 1531ac847c Apply JSDoc comments onto PortableRegistry (#5443) 2023-01-26 06:58:07 +02:00
github-actions[bot] 66f569e214 [CI Skip] bump/beta 9.12.2-2-x
skip-checks: true
2023-01-26 04:38:14 +00:00
Jaco db71aeea41 Swap (pre-detect, typegen) Weight alias to latest (#5445) 2023-01-26 06:30:17 +02:00
github-actions[bot] 1c8e0babac [CI Skip] bump/beta 9.12.2-1-x
skip-checks: true
2023-01-25 07:55:20 +00:00
Jaco 416ac1a619 Weight detect from PortableRegistry -> TypeRegistry (#5442)
* Weight detect from PortableRegistry -> TypeRegistry

* Re-use setLookup

* Revert last

* Expand comments

* Cast for type detect

* Get actual classes for construction
2023-01-25 09:45:55 +02:00
github-actions[bot] ab805808c5 [CI Skip] bump/beta 9.12.2-0-x
skip-checks: true
2023-01-25 07:42:50 +00:00
Jaco cf577a29da Bump GH actions (#5444) 2023-01-25 09:34:55 +02:00
106 changed files with 5240 additions and 3023 deletions
+2 -1
View File
@@ -6,7 +6,8 @@ const base = require('@polkadot/dev/config/eslint.cjs');
module.exports = {
...base,
ignorePatterns: [
...base.ignorePatterns
...base.ignorePatterns,
'/scripts'
],
parserOptions: {
...base.parserOptions,
+1 -1
View File
@@ -9,7 +9,7 @@ jobs:
if: "! startsWith(github.event.head_commit.message, '[CI Skip]') && (!github.event.pull_request || github.event.pull_request.head.repo.full_name == github.repository)"
runs-on: ubuntu-latest
steps:
- uses: jacogr/action-approve@9d6ce78d26f23ad29d009d034822cf773f2cb50e
- uses: jacogr/action-approve@795afd1dd096a2071d7ec98740661af4e853b7da
with:
authors: jacogr
labels: -auto
+1 -1
View File
@@ -8,7 +8,7 @@ jobs:
merge:
runs-on: ubuntu-latest
steps:
- uses: jacogr/action-merge@3b4b49af8a8644bf5cbb5409ee236abe04eeb1b0
- uses: jacogr/action-merge@d2d64b4545acd93b0a9575177d3d215ae3f92029
with:
checks: build,lint,test
labels: -auto
+1 -1
View File
@@ -11,7 +11,7 @@ jobs:
env:
YARN_ENABLE_SCRIPTS: false
steps:
- uses: actions/checkout@7884fcad6b5d53d10323aee724dc68d8b9096a2e
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
- uses: denoland/setup-deno@004814556e37c54a2f6e31384c9e18e983317366
with:
deno-version: vx.x.x
+1 -1
View File
@@ -19,7 +19,7 @@ jobs:
GH_RELEASE_GITHUB_API_TOKEN: ${{ secrets.GH_PAT_BOT }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- uses: actions/checkout@7884fcad6b5d53d10323aee724dc68d8b9096a2e
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
with:
fetch-depth: 0
token: ${{ secrets.GH_PAT_BOT }}
+57
View File
@@ -1,5 +1,62 @@
# CHANGELOG
## 9.13.6 Feb 5, 2023
Contributed:
- Align `eth_getTransactionCount` with frontier (Thanks to https://github.com/alko89)
Changes:
- Additional override for `Compact<{ refTime: u64 }>` chains
- Add script to retrieve local rpc, version & metadata for typegen
## 9.13.5 Feb 2, 2023
Changes:
- Adjust `Weight` alias for 1.5 chains
- Ensure correct registry is pass through for runtime TS generation
## 9.13.4 Feb 1, 2023
Changes:
- None from 9.13.3 (The previous version had npm registry publishing issues)
## 9.13.3 Feb 1, 2023
Changes:
- Adjust `Weight` alias detection to cater for `WeightV0/u32` overrides (e.g. early Kusama blocks)
## 9.13.2 Jan 29, 2023
Changes:
- Allow null as valid param to Int/UInt
## 9.13.1 Jan 29, 2023
Contributed:
- Add support for V3 of `TransactionPaymentApi` (Thanks to https://github.com/notlesh)
Changes:
- Adjust `Weight` alias detection (moved from `PortableRegistry` -> `Registry`)
- Move default (typegen) weight alias to `WeightV2` (does not affect runtime detection)
- Prepare metadata docs from chain generation for future cli arguments
- Add base type object for (future) composite types
- Apply additional JSDoc comments into `PortableRegistry`
- Update to latest Polkadot, Kusama & Substrate metadata
## 9.12.1 Jan 22, 2023
Changes:
+3 -1
View File
@@ -1,4 +1,4 @@
3336 Jaco 9.12.1 (#5438)
3360 Jaco 9.13.6 (#5475)
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)
@@ -46,6 +46,7 @@
2 Zannis Kalampoukis fix: Typegen handles structs and vectors of structs without erroring (#4743)
2 扩散性百万甜面包 Typo, deocrateMethod -> decorateMethod (#1594)
1 Alan Sapede Adds Eth feeHistory & maxPriorityFeePerGas rpc (#4956)
1 Aleš Ferlan fix: use H160 for address in getTransactionCount (#5472)
1 Brad Larson [NEW] Support for custom headers with providers (#2423)
1 Btwiuse Arch Add side effect check workaround (#4994) (#5009)
1 chriswmercer little readme tweak (#279)
@@ -105,6 +106,7 @@
1 serge make WS provider timeout configurable (#4758)
1 Sergei Pepyakin INK! -> ink! (#1347)
1 Shunji Zhan small polish (#5276)
1 Stephen Shelton Add transaction-payment runtime API V3 (#5430)
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)
+6 -6
View File
@@ -11,10 +11,10 @@
},
"sideEffects": false,
"type": "module",
"version": "9.12.1",
"version": "9.13.6",
"versions": {
"git": "9.12.1",
"npm": "9.12.1"
"git": "9.13.6",
"npm": "9.13.6"
},
"workspaces": [
"packages/*"
@@ -39,12 +39,12 @@
"@babel/core": "^7.20.12",
"@babel/register": "^7.18.9",
"@babel/runtime": "^7.20.13",
"@polkadot/dev": "^0.67.184",
"@polkadot/dev": "^0.68.5",
"@polkadot/typegen": "workspace:packages/typegen",
"@types/jest": "^29.2.6",
"@types/jest": "^29.4.0",
"copyfiles": "^2.4.1"
},
"resolutions": {
"typescript": "^4.9.4"
"typescript": "^4.9.5"
}
}
+7 -7
View File
@@ -20,15 +20,15 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "9.12.1",
"version": "9.13.6",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.20.13",
"@polkadot/api-base": "9.12.1",
"@polkadot/rpc-augment": "9.12.1",
"@polkadot/types": "9.12.1",
"@polkadot/types-augment": "9.12.1",
"@polkadot/types-codec": "9.12.1",
"@polkadot/util": "^10.2.6"
"@polkadot/api-base": "9.13.6",
"@polkadot/rpc-augment": "9.13.6",
"@polkadot/types": "9.13.6",
"@polkadot/types-augment": "9.13.6",
"@polkadot/types-codec": "9.13.6",
"@polkadot/util": "^10.3.1"
}
}
+2 -2
View File
@@ -370,12 +370,12 @@ declare module '@polkadot/api-base/types/events' {
**/
BatchChecked: AugmentedEvent<ApiType, [eras: Vec<u32>], { eras: Vec<u32> }>;
/**
* A batch was terminated.
* A batch of a given size was terminated.
*
* This is always follows by a number of `Unstaked` or `Slashed` events, marking the end
* of the batch. A new batch will be created upon next block.
**/
BatchFinished: AugmentedEvent<ApiType, []>;
BatchFinished: AugmentedEvent<ApiType, [size_: u32], { size_: u32 }>;
/**
* An internal error happened. Operations will be paused now.
**/
+19 -3
View File
@@ -19,7 +19,7 @@ import type { OpaqueMetadata } from '@polkadot/types/interfaces/metadata';
import type { MmrBatchProof, MmrEncodableOpaqueLeaf, MmrError, MmrLeafIndex, MmrProof } from '@polkadot/types/interfaces/mmr';
import type { CandidateCommitments, CandidateEvent, CommittedCandidateReceipt, CoreState, GroupRotationInfo, InboundDownwardMessage, InboundHrmpMessage, OccupiedCoreAssumption, ParaId, ParaValidatorIndex, PersistedValidationData, PvfCheckStatement, ScrapedOnChainVotes, SessionInfo, ValidationCode, ValidationCodeHash, ValidatorSignature } from '@polkadot/types/interfaces/parachains';
import type { FeeDetails, RuntimeDispatchInfo } from '@polkadot/types/interfaces/payment';
import type { AccountId, Balance, Block, Call, Hash, Header, Index, KeyTypeId, Slot, ValidatorId } from '@polkadot/types/interfaces/runtime';
import type { AccountId, Balance, Block, Call, Hash, Header, Index, KeyTypeId, Slot, ValidatorId, Weight } from '@polkadot/types/interfaces/runtime';
import type { SessionIndex } from '@polkadot/types/interfaces/session';
import type { RuntimeVersion } from '@polkadot/types/interfaces/state';
import type { ApplyExtrinsicResult } from '@polkadot/types/interfaces/system';
@@ -333,7 +333,7 @@ declare module '@polkadot/api-base/types/calls' {
**/
[key: string]: DecoratedCallBase<ApiType>;
};
/** 0x37c8bb1350a9a2a8/2 */
/** 0x37c8bb1350a9a2a8/3 */
transactionPaymentApi: {
/**
* The transaction fee details
@@ -343,12 +343,20 @@ declare module '@polkadot/api-base/types/calls' {
* The transaction info
**/
queryInfo: AugmentedCall<ApiType, (uxt: Extrinsic | IExtrinsic | string | Uint8Array, len: u32 | AnyNumber | Uint8Array) => Observable<RuntimeDispatchInfo>>;
/**
* Query the output of the current LengthToFee given some input
**/
queryLengthToFee: AugmentedCall<ApiType, (length: u32 | AnyNumber | Uint8Array) => Observable<Balance>>;
/**
* Query the output of the current WeightToFee given some input
**/
queryWeightToFee: AugmentedCall<ApiType, (weight: Weight | { refTime?: any; proofSize?: any } | string | Uint8Array) => Observable<Balance>>;
/**
* Generic call
**/
[key: string]: DecoratedCallBase<ApiType>;
};
/** 0xf3ff14d5ab527059/2 */
/** 0xf3ff14d5ab527059/3 */
transactionPaymentCallApi: {
/**
* The call fee details
@@ -358,6 +366,14 @@ declare module '@polkadot/api-base/types/calls' {
* The call info
**/
queryCallInfo: AugmentedCall<ApiType, (call: Call | IMethod | string | Uint8Array, len: u32 | AnyNumber | Uint8Array) => Observable<RuntimeDispatchInfo>>;
/**
* Query the output of the current LengthToFee given some input
**/
queryLengthToFee: AugmentedCall<ApiType, (length: u32 | AnyNumber | Uint8Array) => Observable<Balance>>;
/**
* Query the output of the current WeightToFee given some input
**/
queryWeightToFee: AugmentedCall<ApiType, (weight: Weight | { refTime?: any; proofSize?: any } | string | Uint8Array) => Observable<Balance>>;
/**
* Generic call
**/
+1 -1
View File
@@ -1490,7 +1490,7 @@ declare module '@polkadot/api-base/types/submittable' {
*
* Dispatch origin must be signed by the [`Config::ControlOrigin`].
**/
control: AugmentedSubmittable<(uncheckedErasToCheck: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;
control: AugmentedSubmittable<(erasToCheck: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;
/**
* Deregister oneself from the fast-unstake.
*
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/api-augment', path: 'auto', type: 'auto', version: '9.12.1' };
export const packageInfo = { name: '@polkadot/api-augment', path: 'auto', type: 'auto', version: '9.13.6' };
+2 -2
View File
@@ -356,12 +356,12 @@ declare module '@polkadot/api-base/types/events' {
**/
BatchChecked: AugmentedEvent<ApiType, [eras: Vec<u32>], { eras: Vec<u32> }>;
/**
* A batch was terminated.
* A batch of a given size was terminated.
*
* This is always follows by a number of `Unstaked` or `Slashed` events, marking the end
* of the batch. A new batch will be created upon next block.
**/
BatchFinished: AugmentedEvent<ApiType, []>;
BatchFinished: AugmentedEvent<ApiType, [size_: u32], { size_: u32 }>;
/**
* An internal error happened. Operations will be paused now.
**/
+19 -3
View File
@@ -19,7 +19,7 @@ import type { OpaqueMetadata } from '@polkadot/types/interfaces/metadata';
import type { MmrBatchProof, MmrEncodableOpaqueLeaf, MmrError, MmrLeafIndex, MmrProof } from '@polkadot/types/interfaces/mmr';
import type { CandidateCommitments, CandidateEvent, CommittedCandidateReceipt, CoreState, GroupRotationInfo, InboundDownwardMessage, InboundHrmpMessage, OccupiedCoreAssumption, ParaId, ParaValidatorIndex, PersistedValidationData, PvfCheckStatement, ScrapedOnChainVotes, SessionInfo, ValidationCode, ValidationCodeHash, ValidatorSignature } from '@polkadot/types/interfaces/parachains';
import type { FeeDetails, RuntimeDispatchInfo } from '@polkadot/types/interfaces/payment';
import type { AccountId, Balance, Block, Call, Hash, Header, Index, KeyTypeId, Slot, ValidatorId } from '@polkadot/types/interfaces/runtime';
import type { AccountId, Balance, Block, Call, Hash, Header, Index, KeyTypeId, Slot, ValidatorId, Weight } from '@polkadot/types/interfaces/runtime';
import type { SessionIndex } from '@polkadot/types/interfaces/session';
import type { RuntimeVersion } from '@polkadot/types/interfaces/state';
import type { ApplyExtrinsicResult } from '@polkadot/types/interfaces/system';
@@ -333,7 +333,7 @@ declare module '@polkadot/api-base/types/calls' {
**/
[key: string]: DecoratedCallBase<ApiType>;
};
/** 0x37c8bb1350a9a2a8/2 */
/** 0x37c8bb1350a9a2a8/3 */
transactionPaymentApi: {
/**
* The transaction fee details
@@ -343,12 +343,20 @@ declare module '@polkadot/api-base/types/calls' {
* The transaction info
**/
queryInfo: AugmentedCall<ApiType, (uxt: Extrinsic | IExtrinsic | string | Uint8Array, len: u32 | AnyNumber | Uint8Array) => Observable<RuntimeDispatchInfo>>;
/**
* Query the output of the current LengthToFee given some input
**/
queryLengthToFee: AugmentedCall<ApiType, (length: u32 | AnyNumber | Uint8Array) => Observable<Balance>>;
/**
* Query the output of the current WeightToFee given some input
**/
queryWeightToFee: AugmentedCall<ApiType, (weight: Weight | { refTime?: any; proofSize?: any } | string | Uint8Array) => Observable<Balance>>;
/**
* Generic call
**/
[key: string]: DecoratedCallBase<ApiType>;
};
/** 0xf3ff14d5ab527059/2 */
/** 0xf3ff14d5ab527059/3 */
transactionPaymentCallApi: {
/**
* The call fee details
@@ -358,6 +366,14 @@ declare module '@polkadot/api-base/types/calls' {
* The call info
**/
queryCallInfo: AugmentedCall<ApiType, (call: Call | IMethod | string | Uint8Array, len: u32 | AnyNumber | Uint8Array) => Observable<RuntimeDispatchInfo>>;
/**
* Query the output of the current LengthToFee given some input
**/
queryLengthToFee: AugmentedCall<ApiType, (length: u32 | AnyNumber | Uint8Array) => Observable<Balance>>;
/**
* Query the output of the current WeightToFee given some input
**/
queryWeightToFee: AugmentedCall<ApiType, (weight: Weight | { refTime?: any; proofSize?: any } | string | Uint8Array) => Observable<Balance>>;
/**
* Generic call
**/
+1 -1
View File
@@ -1366,7 +1366,7 @@ declare module '@polkadot/api-base/types/submittable' {
*
* Dispatch origin must be signed by the [`Config::ControlOrigin`].
**/
control: AugmentedSubmittable<(uncheckedErasToCheck: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;
control: AugmentedSubmittable<(erasToCheck: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;
/**
* Deregister oneself from the fast-unstake.
*
+10 -3
View File
@@ -165,7 +165,7 @@ declare module '@polkadot/api-base/types/events' {
/**
* Some assets were issued.
**/
Issued: AugmentedEvent<ApiType, [assetId: u32, owner: AccountId32, totalSupply: u128], { assetId: u32, owner: AccountId32, totalSupply: u128 }>;
Issued: AugmentedEvent<ApiType, [assetId: u32, owner: AccountId32, amount: u128], { assetId: u32, owner: AccountId32, amount: u128 }>;
/**
* Metadata has been cleared for an asset.
**/
@@ -569,12 +569,12 @@ declare module '@polkadot/api-base/types/events' {
**/
BatchChecked: AugmentedEvent<ApiType, [eras: Vec<u32>], { eras: Vec<u32> }>;
/**
* A batch was terminated.
* A batch of a given size was terminated.
*
* This is always follows by a number of `Unstaked` or `Slashed` events, marking the end
* of the batch. A new batch will be created upon next block.
**/
BatchFinished: AugmentedEvent<ApiType, []>;
BatchFinished: AugmentedEvent<ApiType, [size_: u32], { size_: u32 }>;
/**
* An internal error happened. Operations will be paused now.
**/
@@ -1030,6 +1030,13 @@ declare module '@polkadot/api-base/types/events' {
**/
[key: string]: AugmentedEvent<ApiType>;
};
pov: {
TestEvent: AugmentedEvent<ApiType, []>;
/**
* Generic event
**/
[key: string]: AugmentedEvent<ApiType>;
};
preimage: {
/**
* A preimage has ben cleared.
@@ -1059,6 +1059,38 @@ declare module '@polkadot/api-base/types/storage' {
**/
[key: string]: QueryableStorageEntry<ApiType>;
};
pov: {
/**
* A value with a MEL bound of 32 byte.
**/
boundedValue: AugmentedQuery<ApiType, () => Observable<Option<Bytes>>, []> & QueryableStorageEntry<ApiType, []>;
doubleMap1M: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<Option<u32>>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;
/**
* 4MiB value.
**/
largeValue: AugmentedQuery<ApiType, () => Observable<Option<Bytes>>, []> & QueryableStorageEntry<ApiType, []>;
largeValue2: AugmentedQuery<ApiType, () => Observable<Option<Bytes>>, []> & QueryableStorageEntry<ApiType, []>;
/**
* A map with a maximum of 16M entries.
**/
map16M: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Option<u32>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
/**
* A map with a maximum of 1M entries.
**/
map1M: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Option<u32>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
unboundedMap: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Option<Vec<u32>>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
unboundedMap2: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Option<Vec<u32>>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
/**
* A value without a MEL bound.
**/
unboundedValue: AugmentedQuery<ApiType, () => Observable<Option<Bytes>>, []> & QueryableStorageEntry<ApiType, []>;
value: AugmentedQuery<ApiType, () => Observable<Option<u32>>, []> & QueryableStorageEntry<ApiType, []>;
value2: AugmentedQuery<ApiType, () => Observable<Option<u32>>, []> & QueryableStorageEntry<ApiType, []>;
/**
* Generic query
**/
[key: string]: QueryableStorageEntry<ApiType>;
};
preimage: {
preimageFor: AugmentedQuery<ApiType, (arg: ITuple<[H256, u32]> | [H256 | string | Uint8Array, u32 | AnyNumber | Uint8Array]) => Observable<Option<Bytes>>, [ITuple<[H256, u32]>]> & QueryableStorageEntry<ApiType, [ITuple<[H256, u32]>]>;
/**
+19 -3
View File
@@ -18,7 +18,7 @@ import type { AuthorityList, GrandpaEquivocationProof, SetId } from '@polkadot/t
import type { OpaqueMetadata } from '@polkadot/types/interfaces/metadata';
import type { MmrBatchProof, MmrEncodableOpaqueLeaf, MmrError, MmrLeafIndex, MmrProof } from '@polkadot/types/interfaces/mmr';
import type { FeeDetails, RuntimeDispatchInfo } from '@polkadot/types/interfaces/payment';
import type { AccountId, Balance, Block, Call, Hash, Header, Index, KeyTypeId, Slot, WeightV2 } from '@polkadot/types/interfaces/runtime';
import type { AccountId, Balance, Block, Call, Hash, Header, Index, KeyTypeId, Slot, Weight, WeightV2 } from '@polkadot/types/interfaces/runtime';
import type { RuntimeVersion } from '@polkadot/types/interfaces/state';
import type { ApplyExtrinsicResult } from '@polkadot/types/interfaces/system';
import type { TransactionSource, TransactionValidity } from '@polkadot/types/interfaces/txqueue';
@@ -264,7 +264,7 @@ declare module '@polkadot/api-base/types/calls' {
**/
[key: string]: DecoratedCallBase<ApiType>;
};
/** 0x37c8bb1350a9a2a8/2 */
/** 0x37c8bb1350a9a2a8/3 */
transactionPaymentApi: {
/**
* The transaction fee details
@@ -274,12 +274,20 @@ declare module '@polkadot/api-base/types/calls' {
* The transaction info
**/
queryInfo: AugmentedCall<ApiType, (uxt: Extrinsic | IExtrinsic | string | Uint8Array, len: u32 | AnyNumber | Uint8Array) => Observable<RuntimeDispatchInfo>>;
/**
* Query the output of the current LengthToFee given some input
**/
queryLengthToFee: AugmentedCall<ApiType, (length: u32 | AnyNumber | Uint8Array) => Observable<Balance>>;
/**
* Query the output of the current WeightToFee given some input
**/
queryWeightToFee: AugmentedCall<ApiType, (weight: Weight | { refTime?: any; proofSize?: any } | string | Uint8Array) => Observable<Balance>>;
/**
* Generic call
**/
[key: string]: DecoratedCallBase<ApiType>;
};
/** 0xf3ff14d5ab527059/2 */
/** 0xf3ff14d5ab527059/3 */
transactionPaymentCallApi: {
/**
* The call fee details
@@ -289,6 +297,14 @@ declare module '@polkadot/api-base/types/calls' {
* The call info
**/
queryCallInfo: AugmentedCall<ApiType, (call: Call | IMethod | string | Uint8Array, len: u32 | AnyNumber | Uint8Array) => Observable<RuntimeDispatchInfo>>;
/**
* Query the output of the current LengthToFee given some input
**/
queryLengthToFee: AugmentedCall<ApiType, (length: u32 | AnyNumber | Uint8Array) => Observable<Balance>>;
/**
* Query the output of the current WeightToFee given some input
**/
queryWeightToFee: AugmentedCall<ApiType, (weight: Weight | { refTime?: any; proofSize?: any } | string | Uint8Array) => Observable<Balance>>;
/**
* Generic call
**/
+9 -1
View File
@@ -2071,7 +2071,7 @@ declare module '@polkadot/api-base/types/submittable' {
*
* Dispatch origin must be signed by the [`Config::ControlOrigin`].
**/
control: AugmentedSubmittable<(uncheckedErasToCheck: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;
control: AugmentedSubmittable<(erasToCheck: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;
/**
* Deregister oneself from the fast-unstake.
*
@@ -3613,6 +3613,14 @@ declare module '@polkadot/api-base/types/submittable' {
**/
[key: string]: SubmittableExtrinsicFunction<ApiType>;
};
pov: {
emitEvent: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>, []>;
noop: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>, []>;
/**
* Generic tx
**/
[key: string]: SubmittableExtrinsicFunction<ApiType>;
};
preimage: {
/**
* Register a preimage on-chain.
+4 -4
View File
@@ -20,13 +20,13 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "9.12.1",
"version": "9.13.6",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.20.13",
"@polkadot/rpc-core": "9.12.1",
"@polkadot/types": "9.12.1",
"@polkadot/util": "^10.2.6",
"@polkadot/rpc-core": "9.13.6",
"@polkadot/types": "9.13.6",
"@polkadot/util": "^10.3.1",
"rxjs": "^7.8.0"
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/api-base', path: 'auto', type: 'auto', version: '9.12.1' };
export const packageInfo = { name: '@polkadot/api-base', path: 'auto', type: 'auto', version: '9.13.6' };
+9 -9
View File
@@ -20,20 +20,20 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "9.12.1",
"version": "9.13.6",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.20.13",
"@polkadot/api": "9.12.1",
"@polkadot/types": "9.12.1",
"@polkadot/types-codec": "9.12.1",
"@polkadot/types-create": "9.12.1",
"@polkadot/util": "^10.2.6",
"@polkadot/util-crypto": "^10.2.6",
"@polkadot/api": "9.13.6",
"@polkadot/types": "9.13.6",
"@polkadot/types-codec": "9.13.6",
"@polkadot/types-create": "9.13.6",
"@polkadot/util": "^10.3.1",
"@polkadot/util-crypto": "^10.3.1",
"rxjs": "^7.8.0"
},
"devDependencies": {
"@polkadot/api-augment": "9.12.1",
"@polkadot/keyring": "^10.2.6"
"@polkadot/api-augment": "9.13.6",
"@polkadot/keyring": "^10.3.1"
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/api-contract', path: 'auto', type: 'auto', version: '9.12.1' };
export const packageInfo = { name: '@polkadot/api-contract', path: 'auto', type: 'auto', version: '9.13.6' };
+14 -14
View File
@@ -20,25 +20,25 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "9.12.1",
"version": "9.13.6",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.20.13",
"@polkadot/api": "9.12.1",
"@polkadot/api-augment": "9.12.1",
"@polkadot/api-base": "9.12.1",
"@polkadot/rpc-core": "9.12.1",
"@polkadot/types": "9.12.1",
"@polkadot/types-codec": "9.12.1",
"@polkadot/util": "^10.2.6",
"@polkadot/util-crypto": "^10.2.6",
"@polkadot/api": "9.13.6",
"@polkadot/api-augment": "9.13.6",
"@polkadot/api-base": "9.13.6",
"@polkadot/rpc-core": "9.13.6",
"@polkadot/types": "9.13.6",
"@polkadot/types-codec": "9.13.6",
"@polkadot/util": "^10.3.1",
"@polkadot/util-crypto": "^10.3.1",
"rxjs": "^7.8.0"
},
"devDependencies": {
"@polkadot/api": "9.12.1",
"@polkadot/api-augment": "9.12.1",
"@polkadot/rpc-augment": "9.12.1",
"@polkadot/rpc-provider": "9.12.1",
"@polkadot/types-support": "9.12.1"
"@polkadot/api": "9.13.6",
"@polkadot/api-augment": "9.13.6",
"@polkadot/rpc-augment": "9.13.6",
"@polkadot/rpc-provider": "9.13.6",
"@polkadot/types-support": "9.13.6"
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/api-derive', path: 'auto', type: 'auto', version: '9.12.1' };
export const packageInfo = { name: '@polkadot/api-derive', path: 'auto', type: 'auto', version: '9.13.6' };
+18 -18
View File
@@ -20,29 +20,29 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "9.12.1",
"version": "9.13.6",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.20.13",
"@polkadot/api-augment": "9.12.1",
"@polkadot/api-base": "9.12.1",
"@polkadot/api-derive": "9.12.1",
"@polkadot/keyring": "^10.2.6",
"@polkadot/rpc-augment": "9.12.1",
"@polkadot/rpc-core": "9.12.1",
"@polkadot/rpc-provider": "9.12.1",
"@polkadot/types": "9.12.1",
"@polkadot/types-augment": "9.12.1",
"@polkadot/types-codec": "9.12.1",
"@polkadot/types-create": "9.12.1",
"@polkadot/types-known": "9.12.1",
"@polkadot/util": "^10.2.6",
"@polkadot/util-crypto": "^10.2.6",
"eventemitter3": "^4.0.7",
"@polkadot/api-augment": "9.13.6",
"@polkadot/api-base": "9.13.6",
"@polkadot/api-derive": "9.13.6",
"@polkadot/keyring": "^10.3.1",
"@polkadot/rpc-augment": "9.13.6",
"@polkadot/rpc-core": "9.13.6",
"@polkadot/rpc-provider": "9.13.6",
"@polkadot/types": "9.13.6",
"@polkadot/types-augment": "9.13.6",
"@polkadot/types-codec": "9.13.6",
"@polkadot/types-create": "9.13.6",
"@polkadot/types-known": "9.13.6",
"@polkadot/util": "^10.3.1",
"@polkadot/util-crypto": "^10.3.1",
"eventemitter3": "^5.0.0",
"rxjs": "^7.8.0"
},
"devDependencies": {
"@polkadot/api-augment": "9.12.1",
"@polkadot/types-support": "9.12.1"
"@polkadot/api-augment": "9.13.6",
"@polkadot/types-support": "9.13.6"
}
}
+4 -2
View File
@@ -363,8 +363,10 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
}
}
const filterKey = (k: string) => !allKeys.includes(k);
const unknown = exposed.filter(filterKey);
const unknown = exposed.filter((k: string) =>
!allKeys.includes(k) &&
!k.includes('_unstable_')
);
if (unknown.length && !this._options.noInitWarn) {
l.warn(`RPC methods not decorated: ${unknown.join(', ')}`);
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/api', path: 'auto', type: 'auto', version: '9.12.1' };
export const packageInfo = { name: '@polkadot/api', path: 'auto', type: 'auto', version: '9.13.6' };
+5 -5
View File
@@ -20,13 +20,13 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "9.12.1",
"version": "9.13.6",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.20.13",
"@polkadot/rpc-core": "9.12.1",
"@polkadot/types": "9.12.1",
"@polkadot/types-codec": "9.12.1",
"@polkadot/util": "^10.2.6"
"@polkadot/rpc-core": "9.13.6",
"@polkadot/types": "9.13.6",
"@polkadot/types-codec": "9.13.6",
"@polkadot/util": "^10.3.1"
}
}
+1 -1
View File
@@ -275,7 +275,7 @@ declare module '@polkadot/rpc-core/types/jsonrpc' {
/**
* Returns the number of transactions sent from given address at given time (block number).
**/
getTransactionCount: AugmentedRpc<(hash: H256 | string | Uint8Array, number?: BlockNumber | AnyNumber | Uint8Array) => Observable<U256>>;
getTransactionCount: AugmentedRpc<(address: H160 | string | Uint8Array, number?: BlockNumber | AnyNumber | Uint8Array) => Observable<U256>>;
/**
* Returns transaction receipt by transaction hash.
**/
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/rpc-augment', path: 'auto', type: 'auto', version: '9.12.1' };
export const packageInfo = { name: '@polkadot/rpc-augment', path: 'auto', type: 'auto', version: '9.13.6' };
+7 -7
View File
@@ -20,18 +20,18 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "9.12.1",
"version": "9.13.6",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.20.13",
"@polkadot/rpc-augment": "9.12.1",
"@polkadot/rpc-provider": "9.12.1",
"@polkadot/types": "9.12.1",
"@polkadot/util": "^10.2.6",
"@polkadot/rpc-augment": "9.13.6",
"@polkadot/rpc-provider": "9.13.6",
"@polkadot/types": "9.13.6",
"@polkadot/util": "^10.3.1",
"rxjs": "^7.8.0"
},
"devDependencies": {
"@polkadot/keyring": "^10.2.6",
"@polkadot/rpc-augment": "9.12.1"
"@polkadot/keyring": "^10.3.1",
"@polkadot/rpc-augment": "9.13.6"
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/rpc-core', path: 'auto', type: 'auto', version: '9.12.1' };
export const packageInfo = { name: '@polkadot/rpc-core', path: 'auto', type: 'auto', version: '9.13.6' };
+10 -10
View File
@@ -20,19 +20,19 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "9.12.1",
"version": "9.13.6",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.20.13",
"@polkadot/keyring": "^10.2.6",
"@polkadot/types": "9.12.1",
"@polkadot/types-support": "9.12.1",
"@polkadot/util": "^10.2.6",
"@polkadot/util-crypto": "^10.2.6",
"@polkadot/x-fetch": "^10.2.6",
"@polkadot/x-global": "^10.2.6",
"@polkadot/x-ws": "^10.2.6",
"eventemitter3": "^4.0.7",
"@polkadot/keyring": "^10.3.1",
"@polkadot/types": "9.13.6",
"@polkadot/types-support": "9.13.6",
"@polkadot/util": "^10.3.1",
"@polkadot/util-crypto": "^10.3.1",
"@polkadot/x-fetch": "^10.3.1",
"@polkadot/x-global": "^10.3.1",
"@polkadot/x-ws": "^10.3.1",
"eventemitter3": "^5.0.0",
"mock-socket": "^9.1.5",
"nock": "^13.3.0"
},
+3 -1
View File
@@ -6,7 +6,9 @@ import type { Mock } from '../mock/types';
import { mockHttp, TEST_HTTP_URL } from '../mock/mockHttp';
import { HttpProvider } from './';
describe('send', (): void => {
// Does not work with Node 18 (native fetch)
// See https://github.com/nock/nock/issues/2397
describe.skip('send', (): void => {
let http: HttpProvider;
let mock: Mock;
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/rpc-provider', path: 'auto', type: 'auto', version: '9.12.1' };
export const packageInfo = { name: '@polkadot/rpc-provider', path: 'auto', type: 'auto', version: '9.13.6' };
+14 -14
View File
@@ -20,7 +20,7 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "9.12.1",
"version": "9.13.6",
"main": "index.js",
"bin": {
"polkadot-types-chain-info": "./scripts/polkadot-types-chain-info.cjs",
@@ -33,24 +33,24 @@
"@babel/core": "^7.20.12",
"@babel/register": "^7.18.9",
"@babel/runtime": "^7.20.13",
"@polkadot/api": "9.12.1",
"@polkadot/api-augment": "9.12.1",
"@polkadot/rpc-augment": "9.12.1",
"@polkadot/rpc-provider": "9.12.1",
"@polkadot/types": "9.12.1",
"@polkadot/types-augment": "9.12.1",
"@polkadot/types-codec": "9.12.1",
"@polkadot/types-create": "9.12.1",
"@polkadot/types-support": "9.12.1",
"@polkadot/util": "^10.2.6",
"@polkadot/util-crypto": "^10.2.6",
"@polkadot/x-ws": "^10.2.6",
"@polkadot/api": "9.13.6",
"@polkadot/api-augment": "9.13.6",
"@polkadot/rpc-augment": "9.13.6",
"@polkadot/rpc-provider": "9.13.6",
"@polkadot/types": "9.13.6",
"@polkadot/types-augment": "9.13.6",
"@polkadot/types-codec": "9.13.6",
"@polkadot/types-create": "9.13.6",
"@polkadot/types-support": "9.13.6",
"@polkadot/util": "^10.3.1",
"@polkadot/util-crypto": "^10.3.1",
"@polkadot/x-ws": "^10.3.1",
"handlebars": "^4.7.7",
"websocket": "^1.0.34",
"yargs": "^17.6.2"
},
"devDependencies": {
"@types/websocket": "^1.0.5",
"@types/yargs": "^17.0.20"
"@types/yargs": "^17.0.22"
}
}
+2 -2
View File
@@ -9,7 +9,7 @@ import yargs from 'yargs';
import { Definitions } from '@polkadot/types/types';
import { formatNumber } from '@polkadot/util';
import { generateDefaultCalls, generateDefaultConsts, generateDefaultErrors, generateDefaultEvents, generateDefaultQuery, generateDefaultRpc, generateDefaultTx } from './generate';
import { generateDefaultConsts, generateDefaultErrors, generateDefaultEvents, generateDefaultQuery, generateDefaultRpc, generateDefaultRuntime, generateDefaultTx } from './generate';
import { assertDir, assertFile, getMetadataViaWs, HEADER, writeFile } from './util';
function generate (metaHex: HexString, pkg: string | undefined, output: string, isStrict?: boolean): void {
@@ -45,8 +45,8 @@ function generate (metaHex: HexString, pkg: string | undefined, output: string,
generateDefaultEvents(path.join(outputPath, 'augment-api-events.ts'), metaHex, extraTypes, isStrict, customLookupDefinitions);
generateDefaultQuery(path.join(outputPath, 'augment-api-query.ts'), metaHex, extraTypes, isStrict, customLookupDefinitions);
generateDefaultRpc(path.join(outputPath, 'augment-api-rpc.ts'), extraTypes);
generateDefaultRuntime(path.join(outputPath, 'augment-api-runtime.ts'), metaHex, extraTypes, isStrict, customLookupDefinitions);
generateDefaultTx(path.join(outputPath, 'augment-api-tx.ts'), metaHex, extraTypes, isStrict, customLookupDefinitions);
generateDefaultCalls(path.join(outputPath, 'augment-api-runtime.ts'), metaHex, extraTypes, isStrict, customLookupDefinitions);
writeFile(path.join(outputPath, 'augment-api.ts'), (): string =>
[
+1 -1
View File
@@ -8,6 +8,6 @@ export { generateDefaultInterface } from './interfaceRegistry';
export { generateDefaultLookup } from './lookup';
export { generateDefaultQuery } from './query';
export { generateDefaultRpc } from './rpc';
export { generateDefaultCalls } from './runtime';
export { generateDefaultRuntime } from './runtime';
export { generateDefaultTsDef } from './tsDef';
export { generateDefaultTx } from './tx';
+6 -6
View File
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
import type { Metadata } from '@polkadot/types/metadata/Metadata';
import type { DefinitionCallNamed, Definitions } from '@polkadot/types/types';
import type { DefinitionCallNamed, Definitions, Registry } from '@polkadot/types/types';
import type { HexString } from '@polkadot/util/types';
import type { ExtraTypes } from './types';
@@ -67,7 +67,7 @@ function getDefs (apis: Apis | null, defs: Record<string, Definitions>): Record<
}
/** @internal */
export function generateCallTypes (meta: Metadata, dest: string, extraTypes: ExtraTypes, isStrict: boolean, customLookupDefinitions?: Definitions): void {
export function generateCallTypes (registry: Registry, meta: Metadata, dest: string, extraTypes: ExtraTypes, isStrict: boolean, customLookupDefinitions?: Definitions): void {
writeFile(dest, (): string => {
const allTypes: ExtraTypes = {
'@polkadot/types-augment': {
@@ -83,8 +83,7 @@ export function generateCallTypes (meta: Metadata, dest: string, extraTypes: Ext
// find the system.Version in metadata
let apis: Apis | null = null;
const { pallets, registry } = meta.asLatest;
const sysp = pallets.find(({ name }) => name.eq('System'));
const sysp = meta.asLatest.pallets.find(({ name }) => name.eq('System'));
if (sysp) {
const verc = sysp.constants.find(({ name }) => name.eq('Version'));
@@ -163,10 +162,11 @@ export function generateCallTypes (meta: Metadata, dest: string, extraTypes: Ext
});
}
export function generateDefaultCalls (dest: string, data: HexString, extraTypes: ExtraTypes = {}, isStrict = false, customLookupDefinitions?: Definitions): void {
const { metadata } = initMeta(data, extraTypes);
export function generateDefaultRuntime (dest: string, data: HexString, extraTypes: ExtraTypes = {}, isStrict = false, customLookupDefinitions?: Definitions): void {
const { metadata, registry } = initMeta(data, extraTypes);
generateCallTypes(
registry,
metadata,
dest,
extraTypes,
+2 -2
View File
@@ -7,7 +7,7 @@ import kusama from '@polkadot/types-support/metadata/static-kusama';
import polkadot from '@polkadot/types-support/metadata/static-polkadot';
import substrate from '@polkadot/types-support/metadata/static-substrate';
import { generateDefaultCalls, generateDefaultConsts, generateDefaultErrors, generateDefaultEvents, generateDefaultInterface, generateDefaultLookup, generateDefaultQuery, generateDefaultRpc, generateDefaultTsDef, generateDefaultTx } from './generate';
import { generateDefaultConsts, generateDefaultErrors, generateDefaultEvents, generateDefaultInterface, generateDefaultLookup, generateDefaultQuery, generateDefaultRpc, generateDefaultRuntime, generateDefaultTsDef, generateDefaultTx } from './generate';
const BASE = 'packages/api-augment/src';
const METAS = Object.entries<HexString>({ kusama, polkadot, substrate });
@@ -26,7 +26,7 @@ export function main (): void {
generateDefaultErrors(`${BASE}/${name}/errors.ts`, staticMeta);
generateDefaultEvents(`${BASE}/${name}/events.ts`, staticMeta);
generateDefaultQuery(`${BASE}/${name}/query.ts`, staticMeta);
generateDefaultRuntime(`${BASE}/${name}/runtime.ts`, staticMeta);
generateDefaultTx(`${BASE}/${name}/tx.ts`, staticMeta);
generateDefaultCalls(`${BASE}/${name}/runtime.ts`, staticMeta);
}
}
+84 -59
View File
@@ -14,6 +14,7 @@ import { Text } from '@polkadot/types/primitive';
import { unwrapStorageType } from '@polkadot/types/primitive/StorageKey';
import rpcdata from '@polkadot/types-support/metadata/static-substrate';
import { stringCamelCase, stringLowerFirst } from '@polkadot/util';
import { blake2AsHex } from '@polkadot/util-crypto';
interface SectionItem {
link?: string;
@@ -34,15 +35,7 @@ interface Page {
sections: Section[];
}
const STATIC_TEXT = '\n\n(NOTE: These were generated from a static/snapshot view of a recent Substrate master node. Some items may not be available in older nodes, or in any customized implementations.)';
const DESC_CONSTANTS = `The following sections contain the module constants, also known as parameter types. These can only be changed as part of a runtime upgrade. On the api, these are exposed via \`api.consts.<module>.<method>\`. ${STATIC_TEXT}`;
const DESC_EXTRINSICS = `The following sections contain Extrinsics methods are part of the default Substrate runtime. On the api, these are exposed via \`api.tx.<module>.<method>\`. ${STATIC_TEXT}`;
const DESC_ERRORS = `This page lists the errors that can be encountered in the different modules. ${STATIC_TEXT}`;
const DESC_EVENTS = `Events are emitted for certain operations on the runtime. The following sections describe the events that are part of the default Substrate runtime. ${STATIC_TEXT}`;
const DESC_RPC = 'The following sections contain known RPC methods that may be available on specific nodes (depending on configuration and available pallets) and allow you to interact with the actual node, query, and submit.';
const DESC_RUNTIME = 'The following section contains known runtime calls that may be available on specific runtimes (depending on configuration and available pallets). These call directly into the WASM runtime for queries and operations.';
const DESC_STORAGE = `The following sections contain Storage methods are part of the default Substrate runtime. On the api, these are exposed via \`api.query.<module>.<method>\`. ${STATIC_TEXT}`;
const headerFn = (runtimeDesc: string) => `\n\n(NOTE: These were generated from a static/snapshot view of a recent ${runtimeDesc}. Some items may not be available in older nodes, or in any customized implementations.)`;
/** @internal */
function docsVecToMarkdown (docLines: Vec<Text>, indent = 0): string {
@@ -119,7 +112,6 @@ function renderPage (page: Page): string {
function sortByName<T extends { name: Codec | string }> (a: T, b: T): number {
// case insensitive (all-uppercase) sorting
// eslint-disable-next-line @typescript-eslint/no-unsafe-return,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
return a.name.toString().toUpperCase().localeCompare(b.name.toString().toUpperCase());
}
@@ -130,14 +122,12 @@ function getSiName (lookup: PortableRegistry, type: SiLookupTypeId): string {
}
/** @internal */
function addRpc (): string {
const sections = Object
.keys(definitions)
.filter((key) => Object.keys(definitions[key as 'babe'].rpc || {}).length !== 0);
function addRpc (_runtimeDesc: string, rpcMethods?: string[]): string {
return renderPage({
description: DESC_RPC,
sections: sections
description: 'The following sections contain known RPC methods that may be available on specific nodes (depending on configuration and available pallets) and allow you to interact with the actual node, query, and submit.',
sections: Object
.keys(definitions)
.filter((key) => Object.keys(definitions[key as 'babe'].rpc || {}).length !== 0)
.sort()
.reduce((all: Section[], _sectionName): Section[] => {
const section = definitions[_sectionName as 'babe'];
@@ -148,6 +138,15 @@ function addRpc (): string {
.forEach((methodName) => {
const method = (section.rpc || {})[methodName];
const sectionName = method.aliasSection || _sectionName;
const jsonrpc = (method.endpoint || `${sectionName}_${methodName}`);
if (rpcMethods) {
// if we are passing the rpcMethods params and we cannot find this method, skip it
if (jsonrpc !== 'rpc_methods' && !rpcMethods.includes(jsonrpc)) {
return;
}
}
const topName = method.aliasSection ? `${_sectionName}/${method.aliasSection}` : _sectionName;
let container = all.find(({ name }) => name === topName);
@@ -162,7 +161,6 @@ function addRpc (): string {
return name + (isOptional ? '?' : '') + ': `' + type + '`';
}).join(', ');
const type = '`' + method.type + '`';
const jsonrpc = (method.endpoint || `${sectionName}_${methodName}`);
const item: SectionItem = {
interface: '`' + `api.rpc.${sectionName}.${methodName}` + '`',
jsonrpc: '`' + jsonrpc + '`',
@@ -185,38 +183,53 @@ function addRpc (): string {
}
/** @internal */
function addRuntime (): string {
const sections = Object
.keys(definitions)
.filter((key) => Object.keys(definitions[key as 'babe'].runtime || {}).length !== 0);
function addRuntime (_runtimeDesc: string, apis?: [apiHash: string, apiVersion: number][]): string {
return renderPage({
description: DESC_RUNTIME,
sections: sections
description: 'The following section contains known runtime calls that may be available on specific runtimes (depending on configuration and available pallets). These call directly into the WASM runtime for queries and operations.',
sections: Object
.keys(definitions)
.filter((key) => Object.keys(definitions[key as 'babe'].runtime || {}).length !== 0)
.sort()
.reduce((all: Section[], _sectionName): Section[] => {
Object
.entries(definitions[_sectionName as 'babe'].runtime || {})
.forEach(([apiName, [{ methods }]]) => {
const container: Section = { items: [], name: apiName };
.forEach(([apiName, versions]) => {
versions
.sort((a, b) => b.version - a.version)
.forEach(({ methods, version }, index) => {
if (apis) {
// if we are passing the api hashes and we cannot find this one, skip it
const apiHash = blake2AsHex(apiName, 64);
const api = apis.find(([hash]) => hash === apiHash);
all.push(container);
if (!api || api[1] !== version) {
return;
}
} else if (index) {
// we only want the highest version
return;
}
Object
.entries(methods)
.sort(([a], [b]) => a.localeCompare(b))
.forEach(([methodName, { description, params, type }]): void => {
const args = params.map(({ name, type }): string => {
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
return name + ': `' + type + '`';
}).join(', ');
const container: Section = { items: [], name: apiName };
container.items.push({
interface: '`' + `api.call.${stringCamelCase(apiName)}.${stringCamelCase(methodName)}` + '`',
name: `${stringCamelCase(methodName)}(${args}): ${'`' + type + '`'}`,
runtime: '`' + `${apiName}_${methodName}` + '`',
summary: description
});
all.push(container);
Object
.entries(methods)
.sort(([a], [b]) => a.localeCompare(b))
.forEach(([methodName, { description, params, type }]): void => {
const args = params.map(({ name, type }): string => {
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
return name + ': `' + type + '`';
}).join(', ');
container.items.push({
interface: '`' + `api.call.${stringCamelCase(apiName)}.${stringCamelCase(methodName)}` + '`',
name: `${stringCamelCase(methodName)}(${args}): ${'`' + type + '`'}`,
runtime: '`' + `${apiName}_${methodName}` + '`',
summary: description
});
});
});
});
@@ -227,9 +240,9 @@ function addRuntime (): string {
}
/** @internal */
function addConstants ({ lookup, pallets }: MetadataLatest): string {
function addConstants (runtimeDesc: string, { lookup, pallets }: MetadataLatest): string {
return renderPage({
description: DESC_CONSTANTS,
description: `The following sections contain the module constants, also known as parameter types. These can only be changed as part of a runtime upgrade. On the api, these are exposed via \`api.consts.<module>.<method>\`. ${headerFn(runtimeDesc)}`,
sections: pallets
.sort(sortByName)
.filter(({ constants }) => !constants.isEmpty)
@@ -256,7 +269,7 @@ function addConstants ({ lookup, pallets }: MetadataLatest): string {
}
/** @internal */
function addStorage ({ lookup, pallets, registry }: MetadataLatest): string {
function addStorage (runtimeDesc: string, { lookup, pallets, registry }: MetadataLatest): string {
const { substrate } = getSubstrateStorage(registry);
const moduleSections = pallets
.sort(sortByName)
@@ -294,7 +307,7 @@ function addStorage ({ lookup, pallets, registry }: MetadataLatest): string {
});
return renderPage({
description: DESC_STORAGE,
description: `The following sections contain Storage methods are part of the ${runtimeDesc}. On the api, these are exposed via \`api.query.<module>.<method>\`. ${headerFn(runtimeDesc)}`,
sections: moduleSections.concat([{
description: 'These are well-known keys that are always available to the runtime implementation of any Substrate-based network.',
items: Object.entries(substrate).map(([name, { meta }]) => {
@@ -317,9 +330,9 @@ function addStorage ({ lookup, pallets, registry }: MetadataLatest): string {
}
/** @internal */
function addExtrinsics ({ lookup, pallets }: MetadataLatest): string {
function addExtrinsics (runtimeDesc: string, { lookup, pallets }: MetadataLatest): string {
return renderPage({
description: DESC_EXTRINSICS,
description: `The following sections contain Extrinsics methods are part of the ${runtimeDesc}. On the api, these are exposed via \`api.tx.<module>.<method>\`. ${headerFn(runtimeDesc)}`,
sections: pallets
.sort(sortByName)
.filter(({ calls }) => calls.isSome)
@@ -349,9 +362,9 @@ function addExtrinsics ({ lookup, pallets }: MetadataLatest): string {
}
/** @internal */
function addEvents ({ lookup, pallets }: MetadataLatest): string {
function addEvents (runtimeDesc: string, { lookup, pallets }: MetadataLatest): string {
return renderPage({
description: DESC_EVENTS,
description: `Events are emitted for certain operations on the runtime. The following sections describe the events that are part of the ${runtimeDesc}. ${headerFn(runtimeDesc)}`,
sections: pallets
.sort(sortByName)
.filter(({ events }) => events.isSome)
@@ -377,9 +390,9 @@ function addEvents ({ lookup, pallets }: MetadataLatest): string {
}
/** @internal */
function addErrors ({ lookup, pallets }: MetadataLatest): string {
function addErrors (runtimeDesc: string, { lookup, pallets }: MetadataLatest): string {
return renderPage({
description: DESC_ERRORS,
description: `This page lists the errors that can be encountered in the different modules. ${headerFn(runtimeDesc)}`,
sections: pallets
.sort(sortByName)
.filter(({ errors }) => errors.isSome)
@@ -420,11 +433,23 @@ export function main (): void {
const latest = metadata.asLatest;
writeFile('docs/substrate/rpc.md', addRpc());
writeFile('docs/substrate/runtime.md', addRuntime());
writeFile('docs/substrate/constants.md', addConstants(latest));
writeFile('docs/substrate/storage.md', addStorage(latest));
writeFile('docs/substrate/extrinsics.md', addExtrinsics(latest));
writeFile('docs/substrate/events.md', addEvents(latest));
writeFile('docs/substrate/errors.md', addErrors(latest));
// TODO Make can make this a variable passed in via args if we want to generate
// for different chain types
const chainName = 'Substrate';
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
writeFile(`${docRoot}/rpc.md`, addRpc(runtimeDesc));
// TODO Pass the result from `state_getRuntimeVersion` (done via util/wsMeta.ts -> getRuntimeVersionViaWs)
// into here if we want to have a per-chain overview
writeFile(`${docRoot}/runtime.md`, addRuntime(runtimeDesc));
writeFile(`${docRoot}/constants.md`, addConstants(runtimeDesc, latest));
writeFile(`${docRoot}/storage.md`, addStorage(runtimeDesc, latest));
writeFile(`${docRoot}/extrinsics.md`, addExtrinsics(runtimeDesc, latest));
writeFile(`${docRoot}/events.md`, addEvents(runtimeDesc, latest));
writeFile(`${docRoot}/errors.md`, addErrors(runtimeDesc, latest));
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/typegen', path: 'auto', type: 'auto', version: '9.12.1' };
export const packageInfo = { name: '@polkadot/typegen', path: 'auto', type: 'auto', version: '9.13.6' };
+2 -1
View File
@@ -4,6 +4,7 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import type { AnyString, Registry } from '@polkadot/types/types';
import type { LookupString } from '@polkadot/types-codec/types';
import type { TypeDef } from '@polkadot/types-create/types';
import Handlebars from 'handlebars';
@@ -189,7 +190,7 @@ const formatters: Record<TypeDefInfo, (registry: Registry, typeDef: TypeDef, def
},
[TypeDefInfo.Si]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
return formatType(registry, definitions, registry.lookup.getTypeDef(typeDef.type), imports, withShortcut);
return formatType(registry, definitions, registry.lookup.getTypeDef(typeDef.type as LookupString), imports, withShortcut);
},
[TypeDefInfo.Struct]: (registry: Registry, typeDef: TypeDef, definitions: Record<string, ModuleTypes>, imports: TypeImports, withShortcut: boolean) => {
+13 -1
View File
@@ -5,7 +5,7 @@ import type { HexString } from '@polkadot/util/types';
import { WebSocket } from '@polkadot/x-ws';
async function getWsData <T> (endpoint: string, method: 'state_getMetadata' | 'state_getRuntimeVersion'): Promise<T> {
async function getWsData <T> (endpoint: string, method: 'rpc_methods' | 'state_getMetadata' | 'state_getRuntimeVersion'): Promise<T> {
return new Promise((resolve): void => {
try {
const websocket = new WebSocket(endpoint);
@@ -44,3 +44,15 @@ async function getWsData <T> (endpoint: string, method: 'state_getMetadata' | 's
export async function getMetadataViaWs (endpoint: string): Promise<HexString> {
return getWsData<HexString>(endpoint, 'state_getMetadata');
}
export async function getRpcMethodsViaWs (endpoint: string): Promise<string[]> {
const result = await getWsData<{ methods: string[] }>(endpoint, 'rpc_methods');
return result.methods;
}
export async function getRuntimeVersionViaWs (endpoint: string): Promise<[apiHash: string, apiVersion: number][]> {
const result = await getWsData<{ apis: [string, number][] }>(endpoint, 'state_getRuntimeVersion');
return result.apis;
}
+4 -4
View File
@@ -20,12 +20,12 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "9.12.1",
"version": "9.13.6",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.20.13",
"@polkadot/types": "9.12.1",
"@polkadot/types-codec": "9.12.1",
"@polkadot/util": "^10.2.6"
"@polkadot/types": "9.13.6",
"@polkadot/types-codec": "9.13.6",
"@polkadot/util": "^10.3.1"
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/types-augment', path: 'auto', type: 'auto', version: '9.12.1' };
export const packageInfo = { name: '@polkadot/types-augment', path: 'auto', type: 'auto', version: '9.13.6' };
@@ -52,7 +52,7 @@ import type { ProxyAnnouncement, ProxyDefinition, ProxyType } from '@polkadot/ty
import type { AccountStatus, AccountValidity } from '@polkadot/types/interfaces/purchase';
import type { ActiveRecovery, RecoveryConfig } from '@polkadot/types/interfaces/recovery';
import type { RpcMethods } from '@polkadot/types/interfaces/rpc';
import type { AccountId, AccountId20, AccountId32, AccountId33, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, BlockNumberFor, BlockNumberOf, Call, CallHash, CallHashOf, ChangesTrieConfiguration, ChangesTrieSignal, CodecHash, Consensus, ConsensusEngineId, CrateVersion, Digest, DigestItem, EncodedJustification, ExtrinsicsWeight, Fixed128, Fixed64, FixedI128, FixedI64, FixedU128, FixedU64, H1024, H128, H160, H2048, H256, H32, H512, H64, Hash, Header, HeaderPartial, I32F32, Index, IndicesLookupSource, Justification, Justifications, KeyTypeId, KeyValue, LockIdentifier, LookupSource, LookupTarget, ModuleId, Moment, MultiAddress, MultiSigner, OpaqueCall, Origin, OriginCaller, PalletId, PalletVersion, PalletsOrigin, Pays, PerU16, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, Releases, RuntimeDbWeight, Seal, SealV0, SignedBlock, SignedBlockWithJustification, SignedBlockWithJustifications, Slot, SlotDuration, StorageData, StorageInfo, StorageProof, TransactionInfo, TransactionLongevity, TransactionPriority, TransactionStorageProof, TransactionTag, U32F32, ValidatorId, ValidatorIdOf, Weight, WeightMultiplier, WeightV1, WeightV2 } from '@polkadot/types/interfaces/runtime';
import type { AccountId, AccountId20, AccountId32, AccountId33, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, BlockNumberFor, BlockNumberOf, Call, CallHash, CallHashOf, ChangesTrieConfiguration, ChangesTrieSignal, CodecHash, Consensus, ConsensusEngineId, CrateVersion, Digest, DigestItem, EncodedJustification, ExtrinsicsWeight, Fixed128, Fixed64, FixedI128, FixedI64, FixedU128, FixedU64, H1024, H128, H160, H2048, H256, H32, H512, H64, Hash, Header, HeaderPartial, I32F32, Index, IndicesLookupSource, Justification, Justifications, KeyTypeId, KeyValue, LockIdentifier, LookupSource, LookupTarget, ModuleId, Moment, MultiAddress, MultiSigner, OpaqueCall, Origin, OriginCaller, PalletId, PalletVersion, PalletsOrigin, Pays, PerU16, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, Releases, RuntimeDbWeight, Seal, SealV0, SignedBlock, SignedBlockWithJustification, SignedBlockWithJustifications, Slot, SlotDuration, StorageData, StorageInfo, StorageProof, TransactionInfo, TransactionLongevity, TransactionPriority, TransactionStorageProof, TransactionTag, U32F32, ValidatorId, ValidatorIdOf, Weight, WeightMultiplier, WeightV0, WeightV1, WeightV2 } from '@polkadot/types/interfaces/runtime';
import type { Si0Field, Si0LookupTypeId, Si0Path, Si0Type, Si0TypeDef, Si0TypeDefArray, Si0TypeDefBitSequence, Si0TypeDefCompact, Si0TypeDefComposite, Si0TypeDefPhantom, Si0TypeDefPrimitive, Si0TypeDefSequence, Si0TypeDefTuple, Si0TypeDefVariant, Si0TypeParameter, Si0Variant, Si1Field, Si1LookupTypeId, Si1Path, Si1Type, Si1TypeDef, Si1TypeDefArray, Si1TypeDefBitSequence, Si1TypeDefCompact, Si1TypeDefComposite, Si1TypeDefPrimitive, Si1TypeDefSequence, Si1TypeDefTuple, Si1TypeDefVariant, Si1TypeParameter, Si1Variant, SiField, SiLookupTypeId, SiPath, SiType, SiTypeDef, SiTypeDefArray, SiTypeDefBitSequence, SiTypeDefCompact, SiTypeDefComposite, SiTypeDefPrimitive, SiTypeDefSequence, SiTypeDefTuple, SiTypeDefVariant, SiTypeParameter, SiVariant } from '@polkadot/types/interfaces/scaleInfo';
import type { Period, Priority, SchedulePeriod, SchedulePriority, Scheduled, ScheduledTo254, TaskAddress } from '@polkadot/types/interfaces/scheduler';
import type { BeefyKey, FullIdentification, IdentificationTuple, Keys, MembershipProof, SessionIndex, SessionKeys1, SessionKeys10, SessionKeys10B, SessionKeys2, SessionKeys3, SessionKeys4, SessionKeys5, SessionKeys6, SessionKeys6B, SessionKeys7, SessionKeys7B, SessionKeys8, SessionKeys8B, SessionKeys9, SessionKeys9B, ValidatorCount } from '@polkadot/types/interfaces/session';
@@ -1153,6 +1153,7 @@ declare module '@polkadot/types/types/registry' {
WeightMultiplier: WeightMultiplier;
WeightPerClass: WeightPerClass;
WeightToFeeCoefficient: WeightToFeeCoefficient;
WeightV0: WeightV0;
WeightV1: WeightV1;
WeightV2: WeightV2;
WildFungibility: WildFungibility;
File diff suppressed because one or more lines are too long
+7 -7
View File
@@ -20,17 +20,17 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "9.12.1",
"version": "9.13.6",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.20.13",
"@polkadot/util": "^10.2.6",
"@polkadot/x-bigint": "^10.2.6"
"@polkadot/util": "^10.3.1",
"@polkadot/x-bigint": "^10.3.1"
},
"devDependencies": {
"@polkadot/types": "9.12.1",
"@polkadot/types-augment": "9.12.1",
"@polkadot/types-support": "9.12.1",
"@polkadot/util-crypto": "^10.2.6"
"@polkadot/types": "9.13.6",
"@polkadot/types-augment": "9.13.6",
"@polkadot/types-support": "9.13.6",
"@polkadot/util-crypto": "^10.3.1"
}
}
+14 -3
View File
@@ -37,6 +37,9 @@ export abstract class AbstractBase<T extends Codec> implements Codec {
return this.registry.hash(this.toU8a());
}
/**
* @description returns the inner (wrapped value)
*/
public get inner (): T {
return this.#raw;
}
@@ -108,11 +111,19 @@ export abstract class AbstractBase<T extends Codec> implements Codec {
/**
* @description Returns the base runtime type name for this instance
*/
public toRawType (): string {
return 'Base';
}
public abstract toRawType (): string;
/**
* @description Returns the inner wrapped value (equivalent to valueOf)
*/
public unwrap (): T {
return this.#raw;
}
/**
* @description Returns the inner wrapped value
*/
public valueOf (): T {
return this.#raw;
}
}
@@ -1,16 +0,0 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { BigInt } from '@polkadot/x-bigint';
// @ts-expect-error not extensible, we make it extensible here
export abstract class AbstractBigInt extends BigInt {
// @ts-expect-error super() not required, the self magic does that
constructor (value: string | number | bigint | boolean) {
const self = Object(BigInt(value)) as typeof AbstractBigInt;
Object.setPrototypeOf(self, AbstractBigInt.prototype);
return self;
}
}
+18 -14
View File
@@ -2,9 +2,9 @@
// SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
import type { AnyNumber, Inspect, INumber, IU8a, Registry, UIntBitLength } from '../types';
import type { AnyNumber, Inspect, INumber, IU8a, Registry, ToBn, UIntBitLength } from '../types';
import { BN, BN_BILLION, BN_HUNDRED, BN_MILLION, BN_QUINTILL, bnToBn, bnToHex, bnToU8a, formatBalance, formatNumber, hexToBn, isBn, isFunction, isHex, isNumber, isObject, isString, isU8a, u8aToBn, u8aToNumber } from '@polkadot/util';
import { BN, BN_BILLION, BN_HUNDRED, BN_MILLION, BN_QUINTILL, bnToBn, bnToHex, bnToU8a, formatBalance, formatNumber, hexToBn, isBigInt, isBn, isFunction, isHex, isNumber, isObject, isString, isU8a, u8aToBn, u8aToNumber } from '@polkadot/util';
export const DEFAULT_UINT_BITS = 64;
@@ -20,12 +20,16 @@ const FORMATTERS: [string, BN][] = [
['Percent', BN_HUNDRED]
];
function isToBn (value: unknown): value is ToBn {
return isFunction((value as ToBn).toBn);
}
function toPercentage (value: BN, divisor: BN): string {
return `${(value.mul(MUL_P).div(divisor).toNumber() / 100).toFixed(2)}%`;
}
/** @internal */
function decodeAbstractInt (value: Exclude<AnyNumber, Uint8Array> | Record<string, string>, isNegative: boolean): string | number {
function decodeAbstractInt (value: Exclude<AnyNumber, Uint8Array> | Record<string, string> | ToBn | null, isNegative: boolean): string | number {
if (isNumber(value)) {
if (!Number.isInteger(value) || value > Number.MAX_SAFE_INTEGER || value < Number.MIN_SAFE_INTEGER) {
throw new Error('Number needs to be an integer <= Number.MAX_SAFE_INTEGER, i.e. 2 ^ 53 - 1');
@@ -42,9 +46,13 @@ function decodeAbstractInt (value: Exclude<AnyNumber, Uint8Array> | Record<strin
}
return value;
} else if (isBn(value)) {
} else if (isBn(value) || isBigInt(value)) {
return value.toString();
} else if (isObject(value) && !isFunction(value.toBn)) {
} else if (isObject(value)) {
if (isToBn(value)) {
return value.toBn().toString();
}
// Allow the construction from an object with a single top-level key. This means that
// single key objects can be treated equivalently to numbers, assuming they meet the
// specific requirements. (This is useful in Weights 1.5 where Objects are compact)
@@ -54,16 +62,12 @@ function decodeAbstractInt (value: Exclude<AnyNumber, Uint8Array> | Record<strin
throw new Error('Unable to construct number from multi-key object');
}
const inner = value[keys[0]];
if (!isString(inner) && !isNumber(inner)) {
throw new Error('Unable to construct from object with non-string/non-number value');
}
return decodeAbstractInt(inner, isNegative);
return decodeAbstractInt(value[keys[0]], isNegative);
} else if (!value) {
return 0;
}
return bnToBn(value as bigint).toString();
throw new Error(`Unable to create BN from unknown type ${typeof value}`);
}
/**
@@ -82,7 +86,7 @@ export abstract class AbstractInt extends BN implements INumber {
readonly #bitLength: UIntBitLength;
constructor (registry: Registry, value: AnyNumber = 0, bitLength: UIntBitLength = DEFAULT_UINT_BITS, isSigned = false) {
constructor (registry: Registry, value: AnyNumber | null = 0, bitLength: UIntBitLength = DEFAULT_UINT_BITS, isSigned = false) {
// Construct via a string/number, which will be passed in the BN constructor.
// It would be ideal to actually return a BN, but there is an issue:
// https://github.com/indutny/bn.js/issues/206
@@ -0,0 +1,99 @@
// Copyright 2017-2023 @polkadot/types-codec authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
import type { AnyJson, BareOpts, CodecObject, Inspect, IU8a, Registry, ToString } from '../types';
/**
* @name Object
* @description A type extends the Base class, when it holds a value
*/
export abstract class AbstractObject<T extends ToString> implements CodecObject<T> {
readonly registry: Registry;
public createdAtHash?: IU8a;
public initialU8aLength?: number;
public isStorageFallback?: boolean;
readonly $: T;
protected constructor (registry: Registry, value: T, initialU8aLength?: number) {
this.$ = value;
this.initialU8aLength = initialU8aLength;
this.registry = registry;
}
/**
* @description The length of the value when encoded as a Uint8Array
*/
public get encodedLength (): number {
return this.toU8a().length;
}
/**
* @description returns a hash of the contents
*/
public get hash (): IU8a {
return this.registry.hash(this.toU8a());
}
/**
* @description Checks if the value is an empty value
*/
public abstract get isEmpty (): boolean;
/**
* @description Compares the value of the input to see if there is a match
*/
public abstract eq (other?: unknown): boolean;
/**
* @description Returns a breakdown of the hex encoding for this Codec
*/
public abstract inspect (): Inspect;
/**
* @description Returns a hex string representation of the value. isLe returns a LE (number-only) representation
*/
public abstract toHex (isLe?: boolean): HexString;
/**
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
*/
public abstract toHuman (isExtended?: boolean): AnyJson;
/**
* @description Converts the Object to JSON, typically used for RPC transfers
*/
public abstract toJSON (): AnyJson;
/**
* @description Converts the value in a best-fit primitive form
*/
public abstract toPrimitive (): AnyJson;
/**
* @description Returns the string representation of the value
*/
public toString (): string {
return this.$.toString();
}
/**
* @description Encodes the value as a Uint8Array as per the SCALE specifications
* @param isBare true when the value has none of the type-specific prefixes (internal)
*/
public abstract toU8a (isBare?: BareOpts): Uint8Array;
/**
* @description Returns the base runtime type name for this instance
*/
public abstract toRawType (): string;
/**
* @description Return the internal value (JS-aligned, same result as $)
*/
public valueOf (): T {
return this.$;
}
}
@@ -63,6 +63,15 @@ describe('Int', (): void => {
).toEqual(-123);
});
it('allows null/undefined', (): void => {
expect(
new Int(registry).toNumber()
).toEqual(0);
expect(
new Int(registry, null).toNumber()
).toEqual(0);
});
it('has a sane inspect', (): void => {
expect(
new Int(registry, '0x12', 16).inspect()
+2 -2
View File
@@ -16,13 +16,13 @@ import { AbstractInt } from '../abstract/Int';
* @noInheritDoc
*/
export class Int extends AbstractInt {
constructor (registry: Registry, value: AnyNumber = 0, bitLength?: UIntBitLength) {
constructor (registry: Registry, value: AnyNumber | null = 0, bitLength?: UIntBitLength) {
super(registry, value, bitLength, true);
}
public static with (bitLength: UIntBitLength, typeName?: string): CodecClass<Int> {
return class extends Int {
constructor (registry: Registry, value?: AnyNumber) {
constructor (registry: Registry, value?: AnyNumber | null) {
super(registry, value, bitLength);
}
+1 -1
View File
@@ -18,7 +18,7 @@ import { AbstractInt } from '../abstract/Int';
export class UInt extends AbstractInt {
public static with (bitLength: UIntBitLength, typeName?: string): CodecClass<UInt> {
return class extends UInt {
constructor (registry: Registry, value?: AnyNumber) {
constructor (registry: Registry, value?: AnyNumber | null) {
super(registry, value, bitLength);
}
+5 -11
View File
@@ -87,17 +87,11 @@ export class Vec<T extends Codec> extends AbstractArray<T> {
this.#Type = definition || setDefinition(typeToConstructor<T>(registry, Type));
try {
this.initialU8aLength = (
isU8a(decodeFrom)
? decodeU8aVec(registry, this, decodeFrom, startAt, this.#Type)
: decodeVec(registry, this, decodeFrom, startAt, this.#Type)
)[0];
} catch (e) {
console.error(decodeFrom, length, startAt);
throw e;
}
this.initialU8aLength = (
isU8a(decodeFrom)
? decodeU8aVec(registry, this, decodeFrom, startAt, this.#Type)
: decodeVec(registry, this, decodeFrom, startAt, this.#Type)
)[0];
}
public static with<O extends Codec> (Type: CodecClass<O> | string): CodecClass<Vec<O>> {
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/types-codec', path: 'auto', type: 'auto', version: '9.12.1' };
export const packageInfo = { name: '@polkadot/types-codec', path: 'auto', type: 'auto', version: '9.13.6' };
+7 -1
View File
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
import type { HexString } from '@polkadot/util/types';
import type { AnyJson } from './helpers';
import type { AnyJson, ToString } from './helpers';
import type { IU8a } from './interfaces';
import type { Registry } from './registry';
@@ -127,6 +127,12 @@ export interface CodecClass<T = Codec> {
new(registry: Registry, ...args: any[]): T;
}
export interface CodecObject<T extends ToString> extends Codec {
readonly $: T;
valueOf (): T;
}
export type CodecTo = 'toHex' | 'toJSON' | 'toPrimitive' | 'toString' | 'toU8a';
export type ArgsDef = Record<string, CodecClass | string>;
+10
View File
@@ -33,3 +33,13 @@ export type UIntBitLength = 8 | 16 | 32 | 64 | 128 | 256;
export type U8aBitLength = 8 | 16 | 32 | 64 | 128 | 160 | 256 | 264 | 512 | 520 | 1024 | 2048;
export type AnyTupleValue = Exclude<AnyU8a, string> | HexString | (Codec | AnyU8a | AnyNumber | AnyString | undefined | null)[];
export interface ToString {
toString: () => string;
}
export interface ToBn {
toBn: () => BN;
}
export type LookupString = `Lookup${number}`;
+3 -18
View File
@@ -3,7 +3,7 @@
import type { BN } from '@polkadot/util';
import type { Codec, CodecClass } from './codec';
import type { AnyTuple } from './helpers';
import type { AnyTuple, LookupString } from './helpers';
import type { ICompact, IEnum, IMap, IMethod, INumber, IOption, IResult, ISet, IStruct, ITuple, IU8a, IVec } from './interfaces';
export type OnlyCodec<K, T, Types> =
@@ -59,24 +59,14 @@ export interface Registry {
findMetaError (errorIndex: Uint8Array | { error: BN, index: BN } | { error: BN | Uint8Array, index: BN }): RegistryError;
findMetaEvent (eventIndex: Uint8Array): CodecClass<any>;
isLookupType (value: string): boolean;
createLookupType (lookupId: ICompact<INumber> | number): string;
// createClass <T, K extends string = string, Types = Record<K, Codec>> (type: K): CodecClass<OnlyCodec<T, K, Types>>;
isLookupType (value: string): value is LookupString;
createLookupType (lookupId: ICompact<INumber> | number): LookupString;
createClassUnsafe <T extends Codec = Codec, K extends string = string> (type: K): CodecClass<T>;
// createType <T, K extends string = string> (type: K, ...params: unknown[]): OnlyCodec<T, K, Types>;
createTypeUnsafe <T extends Codec = Codec, K extends string = string> (type: K, params: unknown[], options?: CodecCreateOptions): T;
// get <T extends Codec = Codec, K extends string = string, R = T> (name: K, withUnknown?: boolean, knownTypeDef?: TypeDef): CodecClass<R> | undefined;
// getChainProperties (): ChainProperties | undefined;
getClassName (clazz: CodecClass): string | undefined;
// getDefinition (typeName: string): string | undefined;
// getModuleInstances (specName: string, moduleName: string): string[] | undefined;
getOrThrow <T extends Codec = Codec, K extends string = string> (name: K, msg?: string): CodecClass<T>;
getOrUnknown <T extends Codec = Codec, K extends string = string> (name: K): CodecClass<T>;
// setKnownTypes (types: RegisteredTypes): void;
getSignedExtensionExtra (): Record<string, string>;
getSignedExtensionTypes (): Record<string, string>;
@@ -84,13 +74,8 @@ export interface Registry {
hasDef (name: string): boolean;
hasType (name: string): boolean;
hash (data: Uint8Array): IU8a;
// init (): Registry;
register (type: CodecClass | RegistryTypes): void;
register (name: string, type: CodecClass): void;
register (arg1: string | CodecClass | RegistryTypes, arg2?: CodecClass): void;
// setChainProperties (properties?: ChainProperties): void;
// setHasher (hasher?: IU8aer | null): void;
// setLookup (lookup: PortableRegistry): void;
setMetadata (metadata: unknown, signedExtensions?: string[], userExtensions?: unknown): void;
// setSignedExtensions (signedExtensions?: string[], userExtensions?: ExtDef): void;
}
+4 -4
View File
@@ -20,14 +20,14 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "9.12.1",
"version": "9.13.6",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.20.13",
"@polkadot/types-codec": "9.12.1",
"@polkadot/util": "^10.2.6"
"@polkadot/types-codec": "9.13.6",
"@polkadot/util": "^10.3.1"
},
"devDependencies": {
"@polkadot/types": "9.12.1"
"@polkadot/types": "9.13.6"
}
}
+2 -2
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/types-create authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Codec, CodecClass, Registry, U8aBitLength, UIntBitLength } from '@polkadot/types-codec/types';
import type { Codec, CodecClass, LookupString, Registry, U8aBitLength, UIntBitLength } from '@polkadot/types-codec/types';
import type { TypeDef } from '../types';
import { BTreeMap, BTreeSet, Bytes, CodecSet, Compact, DoNotConstruct, Enum, HashMap, Int, Null, Option, Range, RangeInclusive, Result, Struct, Tuple, U8aFixed, UInt, Vec, VecFixed, WrapperKeepOpaque, WrapperOpaque } from '@polkadot/types-codec';
@@ -161,7 +161,7 @@ const infoMapping: Record<TypeDefInfo, (registry: Registry, value: TypeDef) => C
),
[TypeDefInfo.Si]: (registry: Registry, value: TypeDef): CodecClass<Codec> =>
getTypeClass(registry, registry.lookup.getTypeDef(value.type)),
getTypeClass(registry, registry.lookup.getTypeDef(value.type as LookupString)),
[TypeDefInfo.Struct]: (registry: Registry, value: TypeDef): CodecClass<Codec> =>
Struct.with(getTypeClassMap(value), value.alias),
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/types-create', path: 'auto', type: 'auto', version: '9.12.1' };
export const packageInfo = { name: '@polkadot/types-create', path: 'auto', type: 'auto', version: '9.13.6' };
@@ -5,16 +5,15 @@
// this is required to allow for ambient/previous definitions
import '@polkadot/types-codec/types/registry';
import type { Codec, CodecClass, ICompact, INumber } from '@polkadot/types-codec/types';
import type { Codec, CodecClass, ICompact, INumber, LookupString } from '@polkadot/types-codec/types';
import type { ILookup, TypeDef } from '@polkadot/types-create/types';
declare module '@polkadot/types-codec/types/registry' {
interface Registry {
readonly lookup: ILookup;
createLookupType (lookupId: ICompact<INumber> | number): string;
setLookup (lookup: ILookup): void;
createLookupType (lookupId: ICompact<INumber> | number): LookupString;
getUnsafe <T extends Codec = Codec, K extends string = string> (name: K, withUnknown?: boolean, knownTypeDef?: TypeDef): CodecClass<T> | undefined;
setLookup (lookup: ILookup): void;
}
}
+12 -7
View File
@@ -2,15 +2,20 @@
// SPDX-License-Identifier: Apache-2.0
import type { Option, Text } from '@polkadot/types-codec';
import type { ICompact, INumber } from '@polkadot/types-codec/types';
import type { ICompact, INumber, LookupString } from '@polkadot/types-codec/types';
import type { TypeDef } from './types';
// A simplified SiType without the need for an interface import
// (while type interfaces are still in @polkadot/types). This provides
// the minimum interface allowing us to work with it here
interface SiTypeBase {
def: {
asTuple: ICompact<INumber>[]
}
}
export interface ILookup {
getSiType (lookupId: ICompact<INumber> | string | number): {
def: {
asTuple: ICompact<INumber>[]
}
},
getTypeDef (lookupId: ICompact<INumber> | string | number): TypeDef;
getSiType (lookupId: ICompact<INumber> | LookupString | number): SiTypeBase;
getTypeDef (lookupId: ICompact<INumber> | LookupString | number): TypeDef;
sanitizeField (name: Option<Text>): [string | null, string | null];
}
+7 -7
View File
@@ -20,17 +20,17 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "9.12.1",
"version": "9.13.6",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.20.13",
"@polkadot/networks": "^10.2.6",
"@polkadot/types": "9.12.1",
"@polkadot/types-codec": "9.12.1",
"@polkadot/types-create": "9.12.1",
"@polkadot/util": "^10.2.6"
"@polkadot/networks": "^10.3.1",
"@polkadot/types": "9.13.6",
"@polkadot/types-codec": "9.13.6",
"@polkadot/types-create": "9.13.6",
"@polkadot/util": "^10.3.1"
},
"devDependencies": {
"@polkadot/api": "9.12.1"
"@polkadot/api": "9.13.6"
}
}
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/types-known', path: 'auto', type: 'auto', version: '9.12.1' };
export const packageInfo = { name: '@polkadot/types-known', path: 'auto', type: 'auto', version: '9.13.6' };
+2 -2
View File
@@ -20,10 +20,10 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "9.12.1",
"version": "9.13.6",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.20.13",
"@polkadot/util": "^10.2.6"
"@polkadot/util": "^10.3.1"
}
}
@@ -2,5 +2,9 @@
// SPDX-License-Identifier: Apache-2.0
import metadata from './v14/kusama-hex';
import rpc from './v14/kusama-rpc';
import version from './v14/kusama-ver';
export { rpc, version };
export default metadata;
@@ -2,5 +2,9 @@
// SPDX-License-Identifier: Apache-2.0
import metadata from './v14/polkadot-hex';
import rpc from './v14/polkadot-rpc';
import version from './v14/polkadot-ver';
export { rpc, version };
export default metadata;
@@ -2,5 +2,9 @@
// SPDX-License-Identifier: Apache-2.0
import metadata from './v14/substrate-hex';
import rpc from './v14/substrate-rpc';
import version from './v14/substrate-ver';
export { rpc, version };
export default metadata;
File diff suppressed because one or more lines are too long
@@ -236,7 +236,7 @@
{
"name": "BlockWeights",
"type": 505,
"value": "0x07a084c41902000b00204aa9d10113ffffffffffffffff82eeac1600010b60943491580113a3703d0ad7a370bd010b0098f73e5d0113ffffffffffffffbf01000082eeac1600010b601c87fbcc0113a3703d0ad7a370fd010b00204aa9d10113ffffffffffffffff01070088526a7413000000000000004082eeac1600000000",
"value": "0x0700be149902000b00204aa9d10113ffffffffffffffff62f65c1a00010b68924890580113a3703d0ad7a370bd010b0098f73e5d0113ffffffffffffffbf01000062f65c1a00010b681a9bfacc0113a3703d0ad7a370fd010b00204aa9d10113ffffffffffffffff01070088526a7413000000000000004062f65c1a00000000",
"docs": [
" Block & extrinsics weights: base values and limits."
]
@@ -268,7 +268,7 @@
{
"name": "Version",
"type": 511,
"value": "0x186b7573616d61347061726974792d6b7573616d61020000009a2400000000000040df6acb689907609b0400000037e397fc7c91f5e40100000040fe3ad401f8959a06000000d2bc9897eed08f1503000000f78b278be53f454c02000000af2c0297a23e6d3d0200000049eaaf1b548a0cb00100000091d5df18b0d2cf5801000000ed99c5acb25eedf503000000cbca25e39f14238702000000687ad44ad37f03c201000000ab3c0572291feb8b01000000bc9d89904f5b923f0100000037c8bb1350a9a2a802000000f3ff14d5ab5270590200000017a6bc0d0062aeb3010000001300000000",
"value": "0x186b7573616d61347061726974792d6b7573616d61020000009a2400000000000040df6acb689907609b0400000037e397fc7c91f5e40100000040fe3ad401f8959a06000000d2bc9897eed08f1503000000f78b278be53f454c02000000af2c0297a23e6d3d0200000049eaaf1b548a0cb00100000091d5df18b0d2cf5801000000ed99c5acb25eedf503000000cbca25e39f14238702000000687ad44ad37f03c201000000ab3c0572291feb8b01000000bc9d89904f5b923f0100000037c8bb1350a9a2a803000000f3ff14d5ab5270590300000017a6bc0d0062aeb3010000001300000000",
"docs": [
" Get the chain's current version."
]
@@ -5052,7 +5052,7 @@
{
"name": "SignedMaxWeight",
"type": 8,
"value": "0x0bc00f7077560113a3703d0ad7a370bd",
"value": "0x0b68d433f7550113a3703d0ad7a370bd",
"docs": [
" Maximum weight of a signed solution.",
"",
@@ -5139,7 +5139,7 @@
{
"name": "MinerMaxWeight",
"type": 8,
"value": "0x0bc00f7077560113a3703d0ad7a370bd",
"value": "0x0b68d433f7550113a3703d0ad7a370bd",
"docs": []
},
{
@@ -0,0 +1,123 @@
// Copyright 2017-2023 @polkadot/types-support authors & contributors
// SPDX-License-Identifier: Apache-2.0
/* eslint-disable */
// cargo run --release -- purge-chain -y --chain kusama-dev && cargo run --release -- --chain kusama-dev --alice --force-authoring
export default {
"methods": [
"account_nextIndex",
"author_hasKey",
"author_hasSessionKeys",
"author_insertKey",
"author_pendingExtrinsics",
"author_removeExtrinsic",
"author_rotateKeys",
"author_submitAndWatchExtrinsic",
"author_submitExtrinsic",
"author_unwatchExtrinsic",
"babe_epochAuthorship",
"beefy_getFinalizedHead",
"beefy_subscribeJustifications",
"beefy_unsubscribeJustifications",
"chainHead_unstable_body",
"chainHead_unstable_call",
"chainHead_unstable_follow",
"chainHead_unstable_genesisHash",
"chainHead_unstable_header",
"chainHead_unstable_stopBody",
"chainHead_unstable_stopCall",
"chainHead_unstable_stopStorage",
"chainHead_unstable_storage",
"chainHead_unstable_unfollow",
"chainHead_unstable_unpin",
"chain_getBlock",
"chain_getBlockHash",
"chain_getFinalisedHead",
"chain_getFinalizedHead",
"chain_getHead",
"chain_getHeader",
"chain_getRuntimeVersion",
"chain_subscribeAllHeads",
"chain_subscribeFinalisedHeads",
"chain_subscribeFinalizedHeads",
"chain_subscribeNewHead",
"chain_subscribeNewHeads",
"chain_subscribeRuntimeVersion",
"chain_unsubscribeAllHeads",
"chain_unsubscribeFinalisedHeads",
"chain_unsubscribeFinalizedHeads",
"chain_unsubscribeNewHead",
"chain_unsubscribeNewHeads",
"chain_unsubscribeRuntimeVersion",
"childstate_getKeys",
"childstate_getKeysPaged",
"childstate_getKeysPagedAt",
"childstate_getStorage",
"childstate_getStorageEntries",
"childstate_getStorageHash",
"childstate_getStorageSize",
"grandpa_proveFinality",
"grandpa_roundState",
"grandpa_subscribeJustifications",
"grandpa_unsubscribeJustifications",
"mmr_generateProof",
"mmr_root",
"mmr_verifyProof",
"mmr_verifyProofStateless",
"offchain_localStorageGet",
"offchain_localStorageSet",
"payment_queryFeeDetails",
"payment_queryInfo",
"state_call",
"state_callAt",
"state_getChildReadProof",
"state_getKeys",
"state_getKeysPaged",
"state_getKeysPagedAt",
"state_getMetadata",
"state_getPairs",
"state_getReadProof",
"state_getRuntimeVersion",
"state_getStorage",
"state_getStorageAt",
"state_getStorageHash",
"state_getStorageHashAt",
"state_getStorageSize",
"state_getStorageSizeAt",
"state_queryStorage",
"state_queryStorageAt",
"state_subscribeRuntimeVersion",
"state_subscribeStorage",
"state_traceBlock",
"state_trieMigrationStatus",
"state_unsubscribeRuntimeVersion",
"state_unsubscribeStorage",
"subscribe_newHead",
"sync_state_genSyncSpec",
"system_accountNextIndex",
"system_addLogFilter",
"system_addReservedPeer",
"system_chain",
"system_chainType",
"system_dryRun",
"system_dryRunAt",
"system_health",
"system_localListenAddresses",
"system_localPeerId",
"system_name",
"system_nodeRoles",
"system_peers",
"system_properties",
"system_removeReservedPeer",
"system_reservedPeers",
"system_resetLogFilter",
"system_syncState",
"system_unstable_networkState",
"system_version",
"transaction_unstable_submitAndWatch",
"transaction_unstable_unwatch",
"unsubscribe_newHead"
]
};
@@ -21808,7 +21808,7 @@
"name": "control",
"fields": [
{
"name": "unchecked_eras_to_check",
"name": "eras_to_check",
"type": 4,
"typeName": "EraIndex",
"docs": []
@@ -35429,10 +35429,17 @@
},
{
"name": "BatchFinished",
"fields": [],
"fields": [
{
"name": "size",
"type": 4,
"typeName": "u32",
"docs": []
}
],
"index": 4,
"docs": [
"A batch was terminated.",
"A batch of a given size was terminated.",
"",
"This is always follows by a number of `Unstaked` or `Slashed` events, marking the end",
"of the batch. A new batch will be created upon next block."
@@ -0,0 +1,82 @@
// Copyright 2017-2023 @polkadot/types-support authors & contributors
// SPDX-License-Identifier: Apache-2.0
/* eslint-disable */
// cargo run --release -- purge-chain -y --chain kusama-dev && cargo run --release -- --chain kusama-dev --alice --force-authoring
export default {
"specName": "kusama",
"implName": "parity-kusama",
"authoringVersion": 2,
"specVersion": 9370,
"implVersion": 0,
"apis": [
[
"0xdf6acb689907609b",
4
],
[
"0x37e397fc7c91f5e4",
1
],
[
"0x40fe3ad401f8959a",
6
],
[
"0xd2bc9897eed08f15",
3
],
[
"0xf78b278be53f454c",
2
],
[
"0xaf2c0297a23e6d3d",
2
],
[
"0x49eaaf1b548a0cb0",
1
],
[
"0x91d5df18b0d2cf58",
1
],
[
"0xed99c5acb25eedf5",
3
],
[
"0xcbca25e39f142387",
2
],
[
"0x687ad44ad37f03c2",
1
],
[
"0xab3c0572291feb8b",
1
],
[
"0xbc9d89904f5b923f",
1
],
[
"0x37c8bb1350a9a2a8",
3
],
[
"0xf3ff14d5ab527059",
3
],
[
"0x17a6bc0d0062aeb3",
1
]
],
"transactionVersion": 19,
"stateVersion": 0
};
File diff suppressed because one or more lines are too long
@@ -236,7 +236,7 @@
{
"name": "BlockWeights",
"type": 182,
"value": "0x07702e30da01000b00204aa9d10113ffffffffffffffff4217a11600010b308a3791580113a3703d0ad7a370bd010b0098f73e5d0113ffffffffffffffbf0100004217a11600010b30128afbcc0113a3703d0ad7a370fd010b00204aa9d10113ffffffffffffffff01070088526a741300000000000000404217a11600000000",
"value": "0x07c0d1835102000b00204aa9d10113ffffffffffffffff02604e1a00010b00384c90580113a3703d0ad7a370bd010b0098f73e5d0113ffffffffffffffbf01000002604e1a00010b00c09efacc0113a3703d0ad7a370fd010b00204aa9d10113ffffffffffffffff01070088526a7413000000000000004002604e1a00000000",
"docs": [
" Block & extrinsics weights: base values and limits."
]
@@ -268,7 +268,7 @@
{
"name": "Version",
"type": 189,
"value": "0x20706f6c6b61646f743c7061726974792d706f6c6b61646f74000000009a2400000000000040df6acb689907609b0400000037e397fc7c91f5e40100000040fe3ad401f8959a0600000017a6bc0d0062aeb301000000d2bc9897eed08f1503000000f78b278be53f454c02000000af2c0297a23e6d3d0200000049eaaf1b548a0cb00100000091d5df18b0d2cf5801000000ed99c5acb25eedf503000000cbca25e39f14238702000000687ad44ad37f03c201000000ab3c0572291feb8b01000000bc9d89904f5b923f0100000037c8bb1350a9a2a802000000f3ff14d5ab527059020000001400000000",
"value": "0x20706f6c6b61646f743c7061726974792d706f6c6b61646f74000000009a2400000000000040df6acb689907609b0400000037e397fc7c91f5e40100000040fe3ad401f8959a0600000017a6bc0d0062aeb301000000d2bc9897eed08f1503000000f78b278be53f454c02000000af2c0297a23e6d3d0200000049eaaf1b548a0cb00100000091d5df18b0d2cf5801000000ed99c5acb25eedf503000000cbca25e39f14238702000000687ad44ad37f03c201000000ab3c0572291feb8b01000000bc9d89904f5b923f0100000037c8bb1350a9a2a803000000f3ff14d5ab527059030000001400000000",
"docs": [
" Get the chain's current version."
]
@@ -4117,7 +4117,7 @@
{
"name": "SignedMaxWeight",
"type": 8,
"value": "0x0bc05b07b7560113a3703d0ad7a370bd",
"value": "0x0b4066c83e560113a3703d0ad7a370bd",
"docs": [
" Maximum weight of a signed solution.",
"",
@@ -4204,7 +4204,7 @@
{
"name": "MinerMaxWeight",
"type": 8,
"value": "0x0bc05b07b7560113a3703d0ad7a370bd",
"value": "0x0b4066c83e560113a3703d0ad7a370bd",
"docs": []
},
{
@@ -0,0 +1,123 @@
// Copyright 2017-2023 @polkadot/types-support authors & contributors
// SPDX-License-Identifier: Apache-2.0
/* eslint-disable */
// cargo run --release -- purge-chain -y --dev && cargo run --release -- --dev
export default {
"methods": [
"account_nextIndex",
"author_hasKey",
"author_hasSessionKeys",
"author_insertKey",
"author_pendingExtrinsics",
"author_removeExtrinsic",
"author_rotateKeys",
"author_submitAndWatchExtrinsic",
"author_submitExtrinsic",
"author_unwatchExtrinsic",
"babe_epochAuthorship",
"beefy_getFinalizedHead",
"beefy_subscribeJustifications",
"beefy_unsubscribeJustifications",
"chainHead_unstable_body",
"chainHead_unstable_call",
"chainHead_unstable_follow",
"chainHead_unstable_genesisHash",
"chainHead_unstable_header",
"chainHead_unstable_stopBody",
"chainHead_unstable_stopCall",
"chainHead_unstable_stopStorage",
"chainHead_unstable_storage",
"chainHead_unstable_unfollow",
"chainHead_unstable_unpin",
"chain_getBlock",
"chain_getBlockHash",
"chain_getFinalisedHead",
"chain_getFinalizedHead",
"chain_getHead",
"chain_getHeader",
"chain_getRuntimeVersion",
"chain_subscribeAllHeads",
"chain_subscribeFinalisedHeads",
"chain_subscribeFinalizedHeads",
"chain_subscribeNewHead",
"chain_subscribeNewHeads",
"chain_subscribeRuntimeVersion",
"chain_unsubscribeAllHeads",
"chain_unsubscribeFinalisedHeads",
"chain_unsubscribeFinalizedHeads",
"chain_unsubscribeNewHead",
"chain_unsubscribeNewHeads",
"chain_unsubscribeRuntimeVersion",
"childstate_getKeys",
"childstate_getKeysPaged",
"childstate_getKeysPagedAt",
"childstate_getStorage",
"childstate_getStorageEntries",
"childstate_getStorageHash",
"childstate_getStorageSize",
"grandpa_proveFinality",
"grandpa_roundState",
"grandpa_subscribeJustifications",
"grandpa_unsubscribeJustifications",
"mmr_generateProof",
"mmr_root",
"mmr_verifyProof",
"mmr_verifyProofStateless",
"offchain_localStorageGet",
"offchain_localStorageSet",
"payment_queryFeeDetails",
"payment_queryInfo",
"state_call",
"state_callAt",
"state_getChildReadProof",
"state_getKeys",
"state_getKeysPaged",
"state_getKeysPagedAt",
"state_getMetadata",
"state_getPairs",
"state_getReadProof",
"state_getRuntimeVersion",
"state_getStorage",
"state_getStorageAt",
"state_getStorageHash",
"state_getStorageHashAt",
"state_getStorageSize",
"state_getStorageSizeAt",
"state_queryStorage",
"state_queryStorageAt",
"state_subscribeRuntimeVersion",
"state_subscribeStorage",
"state_traceBlock",
"state_trieMigrationStatus",
"state_unsubscribeRuntimeVersion",
"state_unsubscribeStorage",
"subscribe_newHead",
"sync_state_genSyncSpec",
"system_accountNextIndex",
"system_addLogFilter",
"system_addReservedPeer",
"system_chain",
"system_chainType",
"system_dryRun",
"system_dryRunAt",
"system_health",
"system_localListenAddresses",
"system_localPeerId",
"system_name",
"system_nodeRoles",
"system_peers",
"system_properties",
"system_removeReservedPeer",
"system_reservedPeers",
"system_resetLogFilter",
"system_syncState",
"system_unstable_networkState",
"system_version",
"transaction_unstable_submitAndWatch",
"transaction_unstable_unwatch",
"unsubscribe_newHead"
]
};
@@ -6667,10 +6667,17 @@
},
{
"name": "BatchFinished",
"fields": [],
"fields": [
{
"name": "size",
"type": 4,
"typeName": "u32",
"docs": []
}
],
"index": 4,
"docs": [
"A batch was terminated.",
"A batch of a given size was terminated.",
"",
"This is always follows by a number of `Unstaked` or `Slashed` events, marking the end",
"of the batch. A new batch will be created upon next block."
@@ -26517,7 +26524,7 @@
"name": "control",
"fields": [
{
"name": "unchecked_eras_to_check",
"name": "eras_to_check",
"type": 4,
"typeName": "EraIndex",
"docs": []
@@ -0,0 +1,82 @@
// Copyright 2017-2023 @polkadot/types-support authors & contributors
// SPDX-License-Identifier: Apache-2.0
/* eslint-disable */
// cargo run --release -- purge-chain -y --dev && cargo run --release -- --dev
export default {
"specName": "polkadot",
"implName": "parity-polkadot",
"authoringVersion": 0,
"specVersion": 9370,
"implVersion": 0,
"apis": [
[
"0xdf6acb689907609b",
4
],
[
"0x37e397fc7c91f5e4",
1
],
[
"0x40fe3ad401f8959a",
6
],
[
"0x17a6bc0d0062aeb3",
1
],
[
"0xd2bc9897eed08f15",
3
],
[
"0xf78b278be53f454c",
2
],
[
"0xaf2c0297a23e6d3d",
2
],
[
"0x49eaaf1b548a0cb0",
1
],
[
"0x91d5df18b0d2cf58",
1
],
[
"0xed99c5acb25eedf5",
3
],
[
"0xcbca25e39f142387",
2
],
[
"0x687ad44ad37f03c2",
1
],
[
"0xab3c0572291feb8b",
1
],
[
"0xbc9d89904f5b923f",
1
],
[
"0x37c8bb1350a9a2a8",
3
],
[
"0xf3ff14d5ab527059",
3
]
],
"transactionVersion": 20,
"stateVersion": 0
};
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,124 @@
// Copyright 2017-2023 @polkadot/types-support authors & contributors
// SPDX-License-Identifier: Apache-2.0
/* eslint-disable */
// cargo run --release -- purge-chain -y --dev && cargo run --release -- --dev
export default {
"methods": [
"account_nextIndex",
"author_hasKey",
"author_hasSessionKeys",
"author_insertKey",
"author_pendingExtrinsics",
"author_removeExtrinsic",
"author_rotateKeys",
"author_submitAndWatchExtrinsic",
"author_submitExtrinsic",
"author_unwatchExtrinsic",
"babe_epochAuthorship",
"chainHead_unstable_body",
"chainHead_unstable_call",
"chainHead_unstable_follow",
"chainHead_unstable_genesisHash",
"chainHead_unstable_header",
"chainHead_unstable_stopBody",
"chainHead_unstable_stopCall",
"chainHead_unstable_stopStorage",
"chainHead_unstable_storage",
"chainHead_unstable_unfollow",
"chainHead_unstable_unpin",
"chainSpec_unstable_chainName",
"chainSpec_unstable_genesisHash",
"chainSpec_unstable_properties",
"chain_getBlock",
"chain_getBlockHash",
"chain_getFinalisedHead",
"chain_getFinalizedHead",
"chain_getHead",
"chain_getHeader",
"chain_getRuntimeVersion",
"chain_subscribeAllHeads",
"chain_subscribeFinalisedHeads",
"chain_subscribeFinalizedHeads",
"chain_subscribeNewHead",
"chain_subscribeNewHeads",
"chain_subscribeRuntimeVersion",
"chain_unsubscribeAllHeads",
"chain_unsubscribeFinalisedHeads",
"chain_unsubscribeFinalizedHeads",
"chain_unsubscribeNewHead",
"chain_unsubscribeNewHeads",
"chain_unsubscribeRuntimeVersion",
"childstate_getKeys",
"childstate_getKeysPaged",
"childstate_getKeysPagedAt",
"childstate_getStorage",
"childstate_getStorageEntries",
"childstate_getStorageHash",
"childstate_getStorageSize",
"dev_getBlockStats",
"grandpa_proveFinality",
"grandpa_roundState",
"grandpa_subscribeJustifications",
"grandpa_unsubscribeJustifications",
"mmr_generateProof",
"mmr_root",
"mmr_verifyProof",
"mmr_verifyProofStateless",
"offchain_localStorageGet",
"offchain_localStorageSet",
"payment_queryFeeDetails",
"payment_queryInfo",
"state_call",
"state_callAt",
"state_getChildReadProof",
"state_getKeys",
"state_getKeysPaged",
"state_getKeysPagedAt",
"state_getMetadata",
"state_getPairs",
"state_getReadProof",
"state_getRuntimeVersion",
"state_getStorage",
"state_getStorageAt",
"state_getStorageHash",
"state_getStorageHashAt",
"state_getStorageSize",
"state_getStorageSizeAt",
"state_queryStorage",
"state_queryStorageAt",
"state_subscribeRuntimeVersion",
"state_subscribeStorage",
"state_traceBlock",
"state_trieMigrationStatus",
"state_unsubscribeRuntimeVersion",
"state_unsubscribeStorage",
"subscribe_newHead",
"sync_state_genSyncSpec",
"system_accountNextIndex",
"system_addLogFilter",
"system_addReservedPeer",
"system_chain",
"system_chainType",
"system_dryRun",
"system_dryRunAt",
"system_health",
"system_localListenAddresses",
"system_localPeerId",
"system_name",
"system_nodeRoles",
"system_peers",
"system_properties",
"system_removeReservedPeer",
"system_reservedPeers",
"system_resetLogFilter",
"system_syncState",
"system_unstable_networkState",
"system_version",
"transaction_unstable_submitAndWatch",
"transaction_unstable_unwatch",
"unsubscribe_newHead"
]
};
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,78 @@
// Copyright 2017-2023 @polkadot/types-support authors & contributors
// SPDX-License-Identifier: Apache-2.0
/* eslint-disable */
// cargo run --release -- purge-chain -y --dev && cargo run --release -- --dev
export default {
"specName": "node",
"implName": "substrate-node",
"authoringVersion": 10,
"specVersion": 268,
"implVersion": 0,
"apis": [
[
"0xdf6acb689907609b",
4
],
[
"0x37e397fc7c91f5e4",
1
],
[
"0x40fe3ad401f8959a",
6
],
[
"0xd2bc9897eed08f15",
3
],
[
"0xf78b278be53f454c",
2
],
[
"0xed99c5acb25eedf5",
3
],
[
"0x17a6bc0d0062aeb3",
1
],
[
"0xcbca25e39f142387",
2
],
[
"0x687ad44ad37f03c2",
1
],
[
"0xbc9d89904f5b923f",
1
],
[
"0x68b66ba122c93fa7",
2
],
[
"0x37c8bb1350a9a2a8",
3
],
[
"0xf3ff14d5ab527059",
3
],
[
"0x91d5df18b0d2cf58",
1
],
[
"0xab3c0572291feb8b",
1
]
],
"transactionVersion": 2,
"stateVersion": 1
};
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/types-support', path: 'auto', type: 'auto', version: '9.12.1' };
export const packageInfo = { name: '@polkadot/types-support', path: 'auto', type: 'auto', version: '9.13.6' };
+9 -9
View File
@@ -20,20 +20,20 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "9.12.1",
"version": "9.13.6",
"main": "index.js",
"dependencies": {
"@babel/runtime": "^7.20.13",
"@polkadot/keyring": "^10.2.6",
"@polkadot/types-augment": "9.12.1",
"@polkadot/types-codec": "9.12.1",
"@polkadot/types-create": "9.12.1",
"@polkadot/util": "^10.2.6",
"@polkadot/util-crypto": "^10.2.6",
"@polkadot/keyring": "^10.3.1",
"@polkadot/types-augment": "9.13.6",
"@polkadot/types-codec": "9.13.6",
"@polkadot/types-create": "9.13.6",
"@polkadot/util": "^10.3.1",
"@polkadot/util-crypto": "^10.3.1",
"rxjs": "^7.8.0"
},
"devDependencies": {
"@polkadot/keyring": "^10.2.6",
"@polkadot/types-support": "9.12.1"
"@polkadot/keyring": "^10.3.1",
"@polkadot/types-support": "9.13.6"
}
}
+3 -2
View File
@@ -19,8 +19,9 @@ describe('TypeRegistry', (): void => {
});
it('throws on non-existent via getOrThrow', (): void => {
expect((): CodecClass<Codec> => registry.getOrThrow('non-exist')).toThrow('type non-exist not found');
expect((): CodecClass<Codec> => registry.getOrThrow('non-exist', 'foo bar blah')).toThrow('foo bar blah');
expect(
(): CodecClass<Codec> => registry.getOrThrow('non-exist')
).toThrow('type non-exist not found');
});
it('handles non exist type as Unknown (via getOrUnknown)', (): void => {
+47 -14
View File
@@ -1,15 +1,15 @@
// Copyright 2017-2023 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { AnyString, Codec, CodecClass, IU8a } from '@polkadot/types-codec/types';
import type { AnyString, Codec, CodecClass, IU8a, LookupString } from '@polkadot/types-codec/types';
import type { CreateOptions, TypeDef } from '@polkadot/types-create/types';
import type { ExtDef } from '../extrinsic/signedExtensions/types';
import type { ChainProperties, DispatchErrorModule, DispatchErrorModuleU8, DispatchErrorModuleU8a, EventMetadataLatest, Hash, MetadataLatest, SiField, SiLookupTypeId, SiVariant } from '../interfaces/types';
import type { ChainProperties, DispatchErrorModule, DispatchErrorModuleU8, DispatchErrorModuleU8a, EventMetadataLatest, Hash, MetadataLatest, SiField, SiLookupTypeId, SiVariant, WeightV1, WeightV2 } from '../interfaces/types';
import type { CallFunction, CodecHasher, Definitions, DetectCodec, RegisteredTypes, Registry, RegistryError, RegistryTypes } from '../types';
import { DoNotConstruct, Json, Raw } from '@polkadot/types-codec';
import { constructTypeClass, createClassUnsafe, createTypeUnsafe } from '@polkadot/types-create';
import { assertReturn, BN_ZERO, formatBalance, isFunction, isNumber, isString, isU8a, lazyMethod, logger, objectSpread, stringCamelCase, stringify } from '@polkadot/util';
import { assertReturn, BN_ZERO, formatBalance, isBn, isFunction, isNumber, isString, isU8a, lazyMethod, logger, objectSpread, stringCamelCase, stringify } from '@polkadot/util';
import { blake2AsU8a } from '@polkadot/util-crypto';
import { expandExtensionTypes, fallbackExtensions, findUnknownExtensions } from '../extrinsic/signedExtensions';
@@ -240,15 +240,15 @@ export class TypeRegistry implements Registry {
/**
* @description Returns true if the type is in a Compat format
*/
public isLookupType (value: string): boolean {
public isLookupType (value: string): value is LookupString {
return /Lookup\d+$/.test(value);
}
/**
* @description Creates a lookup string from the supplied id
*/
public createLookupType (lookupId: SiLookupTypeId | number): string {
return `Lookup${lookupId.toString()}`;
public createLookupType (lookupId: SiLookupTypeId | number): LookupString {
return `Lookup${typeof lookupId === 'number' ? lookupId : lookupId.toNumber()}`;
}
public get knownTypes (): RegisteredTypes {
@@ -256,7 +256,7 @@ export class TypeRegistry implements Registry {
}
public get lookup (): PortableRegistry {
return assertReturn(this.#lookup, 'Lookup has not been set on this registry');
return assertReturn(this.#lookup, 'PortableRegistry has not been set on this registry');
}
public get metadata (): MetadataLatest {
@@ -421,11 +421,11 @@ export class TypeRegistry implements Registry {
return this.#knownTypes?.typesBundle?.spec?.[specName.toString()]?.instances?.[moduleName] || this.#moduleMap[moduleName];
}
public getOrThrow <T extends Codec = Codec, K extends string = string, R = DetectCodec<T, K>> (name: K, msg?: string): CodecClass<R> {
public getOrThrow <T extends Codec = Codec, K extends string = string, R = DetectCodec<T, K>> (name: K): CodecClass<R> {
const Clazz = this.get<T, K>(name);
if (!Clazz) {
throw new Error(msg || `type ${name} not found`);
throw new Error(`type ${name} not found`);
}
return Clazz as unknown as CodecClass<R>;
@@ -478,11 +478,11 @@ export class TypeRegistry implements Registry {
this.#classes.set(arg1, arg2);
} else {
this._registerObject(arg1);
this.#registerObject(arg1);
}
}
private _registerObject (obj: RegistryTypes): void {
#registerObject = (obj: RegistryTypes): void => {
const entries = Object.entries(obj);
for (let e = 0; e < entries.length; e++) {
@@ -508,7 +508,7 @@ export class TypeRegistry implements Registry {
this.#definitions.set(name, def);
}
}
}
};
// sets the chain properties
public setChainProperties (properties?: ChainProperties): void {
@@ -532,14 +532,47 @@ export class TypeRegistry implements Registry {
lookup.register();
}
// register alias types alongside the portable/lookup setup
// (we don't combine this into setLookup since that would/could
// affect stand-along lookups, such as ABIs which don't have
// actual on-chain metadata)
#registerLookup = (lookup: PortableRegistry): void => {
// attach the lookup before we register any types
this.setLookup(lookup);
// we detect based on runtime configuration
let Weight: string | null = null;
if (this.hasType('SpWeightsWeightV2Weight')) {
// detection for WeightV2 type based on latest naming
const weightv2 = this.createType<WeightV2>('SpWeightsWeightV2Weight');
Weight = weightv2.refTime && weightv2.proofSize
// with both refTime & proofSize we use as-is (WeightV2)
? 'SpWeightsWeightV2Weight'
// fallback to WeightV1 (WeightV1.5 is a struct, single field)
: 'WeightV1';
} else if (!isBn(this.createType<WeightV1>('Weight'))) {
// where we have an already-supplied BN override, we don't clobber
// it with our detected value (This protects against pre-defines
// where Weight may be aliassed to WeightV0, e.g. in early Kusama chains)
Weight = 'WeightV1';
}
if (Weight) {
// we have detected a version, adjust the definition
this.register({ Weight });
}
};
// sets the metadata
public setMetadata (metadata: Metadata, signedExtensions?: string[], userExtensions?: ExtDef): void {
this.#metadata = metadata.asLatest;
this.#metadataVersion = metadata.version;
this.#firstCallIndex = null;
// attach the lookup at this point (before injecting)
this.setLookup(this.#metadata.lookup);
// attach the lookup at this point and register relevant types (before injecting)
this.#registerLookup(this.#metadata.lookup);
injectExtrinsics(this, this.#metadata, this.#metadataVersion, this.#metadataCalls, this.#moduleMap);
injectErrors(this, this.#metadata, this.#metadataVersion, this.#metadataErrors);
@@ -144,6 +144,13 @@ export class GenericExtrinsicPayload extends AbstractBase<ExtrinsicPayloadVx> {
return this.toHex();
}
/**
* @description Returns the base runtime type name for this instance
*/
public toRawType (): string {
return 'ExtrinsicPayload';
}
/**
* @description Returns the string representation of the value
*/
+2 -2
View File
@@ -306,8 +306,8 @@ export const rpc: DefinitionsRpc = objectSpread({}, netRpc, web3Rpc, {
description: 'Returns the number of transactions sent from given address at given time (block number).',
params: [
{
name: 'hash',
type: 'H256'
name: 'address',
type: 'H160'
},
{
isHistoric: true,
@@ -5,7 +5,7 @@ import type { DefinitionCall, DefinitionsCall } from '../../types';
import { objectSpread } from '@polkadot/util';
const V1_V2_SHARED_PAY: Record<string, DefinitionCall> = {
const V1_V2_V3_SHARED_PAY: Record<string, DefinitionCall> = {
query_fee_details: {
description: 'The transaction fee details',
params: [
@@ -22,7 +22,7 @@ const V1_V2_SHARED_PAY: Record<string, DefinitionCall> = {
}
};
const V1_V2_SHARED_CALL: Record<string, DefinitionCall> = {
const V1_V2_V3_SHARED_CALL: Record<string, DefinitionCall> = {
query_call_fee_details: {
description: 'The call fee details',
params: [
@@ -39,25 +39,80 @@ const V1_V2_SHARED_CALL: Record<string, DefinitionCall> = {
}
};
const V2_V3_SHARED_PAY: Record<string, DefinitionCall> = {
query_info: {
description: 'The transaction info',
params: [
{
name: 'uxt',
type: 'Extrinsic'
},
{
name: 'len',
type: 'u32'
}
],
type: 'RuntimeDispatchInfo'
}
};
const V2_V3_SHARED_CALL: Record<string, DefinitionCall> = {
query_call_info: {
description: 'The call info',
params: [
{
name: 'call',
type: 'Call'
},
{
name: 'len',
type: 'u32'
}
],
type: 'RuntimeDispatchInfo'
}
};
const V3_SHARED_PAY_CALL: Record<string, DefinitionCall> = {
query_length_to_fee: {
description: 'Query the output of the current LengthToFee given some input',
params: [
{
name: 'length',
type: 'u32'
}
],
type: 'Balance'
},
query_weight_to_fee: {
description: 'Query the output of the current WeightToFee given some input',
params: [
{
name: 'weight',
type: 'Weight'
}
],
type: 'Balance'
}
};
export const runtime: DefinitionsCall = {
TransactionPaymentApi: [
{
methods: objectSpread({
query_info: {
description: 'The transaction info',
params: [
{
name: 'uxt',
type: 'Extrinsic'
},
{
name: 'len',
type: 'u32'
}
],
type: 'RuntimeDispatchInfo'
}
}, V1_V2_SHARED_PAY),
methods: objectSpread(
{},
V3_SHARED_PAY_CALL,
V2_V3_SHARED_PAY,
V1_V2_V3_SHARED_PAY
),
version: 3
},
{
methods: objectSpread(
{},
V2_V3_SHARED_PAY,
V1_V2_V3_SHARED_PAY
),
version: 2
},
{
@@ -77,36 +132,33 @@ export const runtime: DefinitionsCall = {
// NOTE: _Should_ be V1 (as per current Substrate), however the interface was
// changed mid-flight between versions. So we have some of each depending on
// runtime. (We do detect the weight type, so correct)
// type: 'RuntimeDispatchInfoV1'
type: 'RuntimeDispatchInfo'
}
}, V1_V2_SHARED_PAY),
}, V1_V2_V3_SHARED_PAY),
version: 1
}
],
TransactionPaymentCallApi: [
{
methods: objectSpread({
query_call_info: {
description: 'The call info',
params: [
{
name: 'call',
type: 'Call'
},
{
name: 'len',
type: 'u32'
}
],
type: 'RuntimeDispatchInfo'
}
}, V1_V2_SHARED_CALL),
methods: objectSpread(
{},
V3_SHARED_PAY_CALL,
V2_V3_SHARED_CALL,
V1_V2_V3_SHARED_CALL
),
version: 3
},
{
methods: objectSpread(
{},
V2_V3_SHARED_CALL,
V1_V2_V3_SHARED_CALL
),
version: 2
},
{
methods: objectSpread({
query_call_info: {
CALL: {
description: 'The call info',
params: [
{
@@ -122,7 +174,7 @@ export const runtime: DefinitionsCall = {
// _may_ yield fallback decoding on some versions of the runtime
type: 'RuntimeDispatchInfo'
}
}, V1_V2_SHARED_CALL),
}, V1_V2_V3_SHARED_CALL),
version: 1
}
]
@@ -212,12 +212,13 @@ export default {
},
ValidatorId: 'AccountId',
ValidatorIdOf: 'ValidatorId',
WeightV0: 'u32',
WeightV1: 'u64',
WeightV2: {
refTime: 'Compact<u64>',
proofSize: 'Compact<u64>'
},
Weight: 'WeightV1',
Weight: 'WeightV2',
WeightMultiplier: 'Fixed64',
// digest
@@ -389,11 +389,14 @@ export interface ValidatorId extends AccountId {}
export interface ValidatorIdOf extends ValidatorId {}
/** @name Weight */
export interface Weight extends WeightV1 {}
export interface Weight extends WeightV2 {}
/** @name WeightMultiplier */
export interface WeightMultiplier extends Fixed64 {}
/** @name WeightV0 */
export interface WeightV0 extends u32 {}
/** @name WeightV1 */
export interface WeightV1 extends u64 {}

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