Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bf442a4bd4 | ||
|
|
40f432badb | ||
|
|
15a8681ba0 | ||
|
|
61ed6e97f4 | ||
|
|
eee4bf51d6 | ||
|
|
b9cbb9e2e8 | ||
|
|
ed426108f2 | ||
|
|
c168615305 | ||
|
|
680ae0222a | ||
|
|
dc3d34e4df | ||
|
|
d356fa4da6 | ||
|
|
90eafdd820 | ||
|
|
263fca2510 | ||
|
|
04dcb490c3 | ||
|
|
e8a96523b7 | ||
|
|
226886acf7 | ||
|
|
b544f24bcf | ||
|
|
f7ad6e09ed | ||
|
|
1d8abf1110 | ||
|
|
fee281fcb4 | ||
|
|
1facb7dd71 | ||
|
|
a96d7c789e | ||
|
|
cc4e4b236d | ||
|
|
932efb6ef5 | ||
|
|
bf6c23eb86 | ||
|
|
df1754eb2a | ||
|
|
1ce1f0a981 | ||
|
|
29537ea283 | ||
|
|
0b45618c5f | ||
|
|
48079d6f1a | ||
|
|
1531ac847c | ||
|
|
66f569e214 | ||
|
|
db71aeea41 | ||
|
|
1c8e0babac | ||
|
|
416ac1a619 | ||
|
|
ab805808c5 | ||
|
|
cf577a29da |
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 }}
|
||||
|
||||
@@ -1,5 +1,50 @@
|
||||
# CHANGELOG
|
||||
|
||||
## 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:
|
||||
|
||||
+2
-1
@@ -1,4 +1,4 @@
|
||||
3336 Jaco 9.12.1 (#5438)
|
||||
3354 Jaco Adjust for aliasses for Weight 1.5 (#5465)
|
||||
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)
|
||||
@@ -105,6 +105,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)
|
||||
|
||||
+5
-5
@@ -11,10 +11,10 @@
|
||||
},
|
||||
"sideEffects": false,
|
||||
"type": "module",
|
||||
"version": "9.12.1",
|
||||
"version": "9.13.5",
|
||||
"versions": {
|
||||
"git": "9.12.1",
|
||||
"npm": "9.12.1"
|
||||
"git": "9.13.5",
|
||||
"npm": "9.13.5"
|
||||
},
|
||||
"workspaces": [
|
||||
"packages/*"
|
||||
@@ -39,9 +39,9 @@
|
||||
"@babel/core": "^7.20.12",
|
||||
"@babel/register": "^7.18.9",
|
||||
"@babel/runtime": "^7.20.13",
|
||||
"@polkadot/dev": "^0.67.184",
|
||||
"@polkadot/dev": "^0.68.3",
|
||||
"@polkadot/typegen": "workspace:packages/typegen",
|
||||
"@types/jest": "^29.2.6",
|
||||
"@types/jest": "^29.4.0",
|
||||
"copyfiles": "^2.4.1"
|
||||
},
|
||||
"resolutions": {
|
||||
|
||||
@@ -20,15 +20,15 @@
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "9.12.1",
|
||||
"version": "9.13.5",
|
||||
"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.5",
|
||||
"@polkadot/rpc-augment": "9.13.5",
|
||||
"@polkadot/types": "9.13.5",
|
||||
"@polkadot/types-augment": "9.13.5",
|
||||
"@polkadot/types-codec": "9.13.5",
|
||||
"@polkadot/util": "^10.3.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,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
|
||||
**/
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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.5' };
|
||||
|
||||
@@ -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,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
|
||||
**/
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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]>]>;
|
||||
/**
|
||||
|
||||
@@ -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
|
||||
**/
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -20,13 +20,13 @@
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "9.12.1",
|
||||
"version": "9.13.5",
|
||||
"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.5",
|
||||
"@polkadot/types": "9.13.5",
|
||||
"@polkadot/util": "^10.3.1",
|
||||
"rxjs": "^7.8.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.5' };
|
||||
|
||||
@@ -20,20 +20,20 @@
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "9.12.1",
|
||||
"version": "9.13.5",
|
||||
"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.5",
|
||||
"@polkadot/types": "9.13.5",
|
||||
"@polkadot/types-codec": "9.13.5",
|
||||
"@polkadot/types-create": "9.13.5",
|
||||
"@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.5",
|
||||
"@polkadot/keyring": "^10.3.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.5' };
|
||||
|
||||
@@ -20,25 +20,25 @@
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "9.12.1",
|
||||
"version": "9.13.5",
|
||||
"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.5",
|
||||
"@polkadot/api-augment": "9.13.5",
|
||||
"@polkadot/api-base": "9.13.5",
|
||||
"@polkadot/rpc-core": "9.13.5",
|
||||
"@polkadot/types": "9.13.5",
|
||||
"@polkadot/types-codec": "9.13.5",
|
||||
"@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.5",
|
||||
"@polkadot/api-augment": "9.13.5",
|
||||
"@polkadot/rpc-augment": "9.13.5",
|
||||
"@polkadot/rpc-provider": "9.13.5",
|
||||
"@polkadot/types-support": "9.13.5"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.5' };
|
||||
|
||||
+18
-18
@@ -20,29 +20,29 @@
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "9.12.1",
|
||||
"version": "9.13.5",
|
||||
"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.5",
|
||||
"@polkadot/api-base": "9.13.5",
|
||||
"@polkadot/api-derive": "9.13.5",
|
||||
"@polkadot/keyring": "^10.3.1",
|
||||
"@polkadot/rpc-augment": "9.13.5",
|
||||
"@polkadot/rpc-core": "9.13.5",
|
||||
"@polkadot/rpc-provider": "9.13.5",
|
||||
"@polkadot/types": "9.13.5",
|
||||
"@polkadot/types-augment": "9.13.5",
|
||||
"@polkadot/types-codec": "9.13.5",
|
||||
"@polkadot/types-create": "9.13.5",
|
||||
"@polkadot/types-known": "9.13.5",
|
||||
"@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.5",
|
||||
"@polkadot/types-support": "9.13.5"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.5' };
|
||||
|
||||
@@ -20,13 +20,13 @@
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "9.12.1",
|
||||
"version": "9.13.5",
|
||||
"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.5",
|
||||
"@polkadot/types": "9.13.5",
|
||||
"@polkadot/types-codec": "9.13.5",
|
||||
"@polkadot/util": "^10.3.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.5' };
|
||||
|
||||
@@ -20,18 +20,18 @@
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "9.12.1",
|
||||
"version": "9.13.5",
|
||||
"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.5",
|
||||
"@polkadot/rpc-provider": "9.13.5",
|
||||
"@polkadot/types": "9.13.5",
|
||||
"@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.5"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.5' };
|
||||
|
||||
@@ -20,19 +20,19 @@
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "9.12.1",
|
||||
"version": "9.13.5",
|
||||
"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.5",
|
||||
"@polkadot/types-support": "9.13.5",
|
||||
"@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,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.5' };
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "9.12.1",
|
||||
"version": "9.13.5",
|
||||
"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.5",
|
||||
"@polkadot/api-augment": "9.13.5",
|
||||
"@polkadot/rpc-augment": "9.13.5",
|
||||
"@polkadot/rpc-provider": "9.13.5",
|
||||
"@polkadot/types": "9.13.5",
|
||||
"@polkadot/types-augment": "9.13.5",
|
||||
"@polkadot/types-codec": "9.13.5",
|
||||
"@polkadot/types-create": "9.13.5",
|
||||
"@polkadot/types-support": "9.13.5",
|
||||
"@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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 =>
|
||||
[
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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.5' };
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -20,12 +20,12 @@
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "9.12.1",
|
||||
"version": "9.13.5",
|
||||
"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.5",
|
||||
"@polkadot/types-codec": "9.13.5",
|
||||
"@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
@@ -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.5' };
|
||||
|
||||
@@ -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
@@ -20,17 +20,17 @@
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "9.12.1",
|
||||
"version": "9.13.5",
|
||||
"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.5",
|
||||
"@polkadot/types-augment": "9.13.5",
|
||||
"@polkadot/types-support": "9.13.5",
|
||||
"@polkadot/util-crypto": "^10.3.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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()
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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>> {
|
||||
|
||||
@@ -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.5' };
|
||||
|
||||
@@ -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>;
|
||||
|
||||
@@ -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,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;
|
||||
}
|
||||
|
||||
@@ -20,14 +20,14 @@
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "9.12.1",
|
||||
"version": "9.13.5",
|
||||
"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.5",
|
||||
"@polkadot/util": "^10.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/types": "9.12.1"
|
||||
"@polkadot/types": "9.13.5"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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.5' };
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
|
||||
@@ -20,17 +20,17 @@
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "9.12.1",
|
||||
"version": "9.13.5",
|
||||
"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.5",
|
||||
"@polkadot/types-codec": "9.13.5",
|
||||
"@polkadot/types-create": "9.13.5",
|
||||
"@polkadot/util": "^10.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/api": "9.12.1"
|
||||
"@polkadot/api": "9.13.5"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.5' };
|
||||
|
||||
@@ -20,10 +20,10 @@
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "9.12.1",
|
||||
"version": "9.13.5",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.20.13",
|
||||
"@polkadot/util": "^10.2.6"
|
||||
"@polkadot/util": "^10.3.1"
|
||||
}
|
||||
}
|
||||
|
||||
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": []
|
||||
},
|
||||
{
|
||||
|
||||
@@ -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."
|
||||
|
||||
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": []
|
||||
},
|
||||
{
|
||||
|
||||
@@ -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": []
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -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.5' };
|
||||
|
||||
@@ -20,20 +20,20 @@
|
||||
"./detectPackage.cjs"
|
||||
],
|
||||
"type": "module",
|
||||
"version": "9.12.1",
|
||||
"version": "9.13.5",
|
||||
"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.5",
|
||||
"@polkadot/types-codec": "9.13.5",
|
||||
"@polkadot/types-create": "9.13.5",
|
||||
"@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.5"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 => {
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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 {}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Option, Text, Type, Vec } from '@polkadot/types-codec';
|
||||
import type { AnyString, Registry } from '@polkadot/types-codec/types';
|
||||
import type { AnyString, LookupString, Registry } from '@polkadot/types-codec/types';
|
||||
import type { ILookup, TypeDef } from '@polkadot/types-create/types';
|
||||
import type { PortableType } from '../../interfaces/metadata';
|
||||
import type { SiField, SiLookupTypeId, SiType, SiTypeDefArray, SiTypeDefBitSequence, SiTypeDefCompact, SiTypeDefComposite, SiTypeDefSequence, SiTypeDefTuple, SiTypeDefVariant, SiTypeParameter, SiVariant } from '../../interfaces/scaleInfo';
|
||||
@@ -25,7 +25,7 @@ interface Extract extends ExtractBase {
|
||||
}
|
||||
|
||||
interface TypeInfo {
|
||||
lookups: Record<string, string>;
|
||||
lookups: Record<string, LookupString>;
|
||||
names: Record<number, string>;
|
||||
params: Record<string, SiTypeParameter[]>;
|
||||
types: Record<number, PortableType>;
|
||||
@@ -47,9 +47,8 @@ const PATHS_ALIAS = splitNamespace([
|
||||
'sp_core::crypto::AccountId32',
|
||||
'sp_runtime::generic::era::Era',
|
||||
'sp_runtime::multiaddress::MultiAddress',
|
||||
// weights 2 (1.5+) is a structure, potentially can be flatenned
|
||||
// weights 1.5+ is a structure can be flatenned
|
||||
'frame_support::weights::weight_v2::Weight',
|
||||
'sp_weights::weight_v2::Weight',
|
||||
// ethereum overrides (Frontier, Moonbeam, Polkadot claims)
|
||||
'account::AccountId20',
|
||||
'polkadot_runtime_common::claims::EthereumAddress',
|
||||
@@ -94,7 +93,7 @@ const RESERVED = [
|
||||
// Remove these from all paths at index 1
|
||||
const PATH_RM_INDEX_1 = ['generic', 'misc', 'pallet', 'traits', 'types'];
|
||||
|
||||
/** @internal */
|
||||
/** @internal Converts a Text[] into string[] (used as part of definitions) */
|
||||
function sanitizeDocs (docs: Text[]): string[] {
|
||||
const result = new Array<string>(docs.length);
|
||||
|
||||
@@ -105,7 +104,7 @@ function sanitizeDocs (docs: Text[]): string[] {
|
||||
return result;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
/** @internal Split a namespace with :: into individual parts */
|
||||
function splitNamespace (values: string[]): string[][] {
|
||||
const result = new Array<string[]>(values.length);
|
||||
|
||||
@@ -116,7 +115,7 @@ function splitNamespace (values: string[]): string[][] {
|
||||
return result;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
/** @internal Match a namespace based on parts (alongside wildcards) */
|
||||
function matchParts (first: string[], second: (string | Text)[]): boolean {
|
||||
return first.length === second.length && first.every((a, index) => {
|
||||
const b = second[index].toString();
|
||||
@@ -151,21 +150,15 @@ function matchParts (first: string[], second: (string | Text)[]): boolean {
|
||||
});
|
||||
}
|
||||
|
||||
// check if the path matches the PATHS_ALIAS (with wildcards)
|
||||
/** @internal */
|
||||
function getAliasPath ({ def, path }: SiType): string | null {
|
||||
// specific logic for weights - we only override when non-complex struct
|
||||
if (path.join('::') === 'sp_weights::weight_v2::Weight' && def.isComposite && def.asComposite.fields.length !== 1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @internal check if the path matches the PATHS_ALIAS (with wildcards) */
|
||||
function getAliasPath ({ path }: SiType): string | null {
|
||||
// TODO We need to handle ink! Balance in some way
|
||||
return path.length && PATHS_ALIAS.some((a) => matchParts(a, path))
|
||||
? path[path.length - 1].toString()
|
||||
: null;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
/** @internal Converts a type name into a JS-API compatible name */
|
||||
function extractNameFlat (portable: PortableType[], lookupIndex: number, params: SiTypeParameter[], path: AnyString[], isInternal = false): Extract | null {
|
||||
const count = path.length;
|
||||
|
||||
@@ -219,12 +212,12 @@ function extractNameFlat (portable: PortableType[], lookupIndex: number, params:
|
||||
return { lookupIndex, name, params };
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
/** @internal Alias for extractNameFlat with PortableType as a last parameter */
|
||||
function extractName (portable: PortableType[], lookupIndex: number, { type: { params, path } }: PortableType): Extract | null {
|
||||
return extractNameFlat(portable, lookupIndex, params, path);
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
/** @internal Check for dupes from a specific index onwards */
|
||||
function nextDupeMatches (name: string, startAt: number, names: Extract[]): Extract[] {
|
||||
const result = [names[startAt]];
|
||||
|
||||
@@ -239,7 +232,7 @@ function nextDupeMatches (name: string, startAt: number, names: Extract[]): Extr
|
||||
return result;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
/** @internal Checks to see if a type is a full duplicate (with all params matching) */
|
||||
function rewriteDupes (input: ExtractBase[], rewrite: Record<number, string>): boolean {
|
||||
const count = input.length;
|
||||
|
||||
@@ -266,7 +259,7 @@ function rewriteDupes (input: ExtractBase[], rewrite: Record<number, string>): b
|
||||
return true;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
/** @internal Find duplicates and adjust the names based on parameters */
|
||||
function removeDupeNames (lookup: PortableRegistry, portable: PortableType[], names: Extract[]): Extract[] {
|
||||
const rewrite: Record<number, string> = {};
|
||||
|
||||
@@ -385,7 +378,7 @@ function removeDupeNames (lookup: PortableRegistry, portable: PortableType[], na
|
||||
}));
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
/** @internal Detect on-chain types (AccountId/Signature) as set as the default */
|
||||
function registerTypes (lookup: PortableRegistry, lookups: Record<string, string>, names: Record<number, string>, params: Record<string, SiTypeParameter[]>): void {
|
||||
// Register the types we extracted
|
||||
lookup.registry.register(lookups);
|
||||
@@ -422,32 +415,12 @@ function registerTypes (lookup: PortableRegistry, lookups: Record<string, string
|
||||
: names[sigParam.type.unwrap().toNumber()] || 'MultiSignature'
|
||||
});
|
||||
}
|
||||
|
||||
// handle weight overrides
|
||||
if (params.SpWeightsWeightV2Weight) {
|
||||
const weight = Object
|
||||
.entries(names)
|
||||
.find(([, n]) => n === 'SpWeightsWeightV2Weight');
|
||||
|
||||
if (!weight) {
|
||||
throw new Error('Unable to extract weight type from SpWeightsWeightV2Weight');
|
||||
}
|
||||
|
||||
const weightDef = lookup.getTypeDef(`Lookup${weight[0]}`);
|
||||
|
||||
lookup.registry.register({
|
||||
Weight: Array.isArray(weightDef.sub) && weightDef.sub.length !== 1
|
||||
// we have a complex structure
|
||||
? 'SpWeightsWeightV2Weight'
|
||||
// single entry, fallback to weight V1
|
||||
: 'WeightV1'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// this extracts aliases based on what we know the runtime config looks like in a
|
||||
// Substrate chain. Specifically we want to have access to the Call and Event params
|
||||
/** @internal */
|
||||
/**
|
||||
* @internal Extracts aliases based on what we know the runtime config looks like in a
|
||||
* Substrate chain. Specifically we want to have access to the Call and Event params
|
||||
**/
|
||||
function extractAliases (params: Record<string, SiTypeParameter[]>, isContract?: boolean): Record<number, string> {
|
||||
const hasParams = Object.keys(params).some((k) => !k.startsWith('Pallet'));
|
||||
const alias: Record<number, string> = {};
|
||||
@@ -473,7 +446,7 @@ function extractAliases (params: Record<string, SiTypeParameter[]>, isContract?:
|
||||
return alias;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
/** @internal Extracts all the intreresting type information for this registry */
|
||||
function extractTypeInfo (lookup: PortableRegistry, portable: PortableType[]): TypeInfo {
|
||||
const nameInfo: Extract[] = [];
|
||||
const types: Record<number, PortableType> = {};
|
||||
@@ -491,7 +464,7 @@ function extractTypeInfo (lookup: PortableRegistry, portable: PortableType[]): T
|
||||
types[lookupIndex] = type;
|
||||
}
|
||||
|
||||
const lookups: Record<string, string> = {};
|
||||
const lookups: Record<string, LookupString> = {};
|
||||
const names: Record<number, string> = {};
|
||||
const params: Record<string, SiTypeParameter[]> = {};
|
||||
const dedup = removeDupeNames(lookup, portable, nameInfo);
|
||||
@@ -510,7 +483,7 @@ function extractTypeInfo (lookup: PortableRegistry, portable: PortableType[]): T
|
||||
|
||||
export class PortableRegistry extends Struct implements ILookup {
|
||||
#alias: Record<number, string>;
|
||||
#lookups: Record<string, string>;
|
||||
#lookups: Record<string, LookupString>;
|
||||
#names: Record<number, string>;
|
||||
#params: Record<string, SiTypeParameter[]>;
|
||||
#typeDefs: Record<number, TypeDef> = {};
|
||||
@@ -534,6 +507,9 @@ export class PortableRegistry extends Struct implements ILookup {
|
||||
// console.log('PortableRegistry', `${(performance.now() - timeStart).toFixed(2)}ms`)
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Returns all the available type names for this chain
|
||||
**/
|
||||
public get names (): string[] {
|
||||
return Object.values(this.#names).sort();
|
||||
}
|
||||
@@ -545,6 +521,9 @@ export class PortableRegistry extends Struct implements ILookup {
|
||||
return this.getT('types');
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Register all available types into the registry (generally for internal usage)
|
||||
*/
|
||||
public register (): void {
|
||||
registerTypes(this, this.#lookups, this.#names, this.#params);
|
||||
}
|
||||
@@ -552,14 +531,14 @@ export class PortableRegistry extends Struct implements ILookup {
|
||||
/**
|
||||
* @description Returns the name for a specific lookup
|
||||
*/
|
||||
public getName (lookupId: SiLookupTypeId | string | number): string | undefined {
|
||||
public getName (lookupId: SiLookupTypeId | LookupString | number): string | undefined {
|
||||
return this.#names[this.#getLookupId(lookupId)];
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Finds a specific type in the registry
|
||||
*/
|
||||
public getSiType (lookupId: SiLookupTypeId | string | number): SiType {
|
||||
public getSiType (lookupId: SiLookupTypeId | LookupString | number): SiType {
|
||||
// NOTE catch-22 - this may already be used as part of the constructor, so
|
||||
// ensure that we have actually initialized it correctly
|
||||
const found = (this.#types || this.types)[this.#getLookupId(lookupId)];
|
||||
@@ -574,7 +553,7 @@ export class PortableRegistry extends Struct implements ILookup {
|
||||
/**
|
||||
* @description Lookup the type definition for the index
|
||||
*/
|
||||
public getTypeDef (lookupId: SiLookupTypeId | string | number): TypeDef {
|
||||
public getTypeDef (lookupId: SiLookupTypeId | LookupString | number): TypeDef {
|
||||
const lookupIndex = this.#getLookupId(lookupId);
|
||||
|
||||
if (!this.#typeDefs[lookupIndex]) {
|
||||
@@ -615,6 +594,9 @@ export class PortableRegistry extends Struct implements ILookup {
|
||||
return this.#typeDefs[lookupIndex];
|
||||
}
|
||||
|
||||
/**
|
||||
* @description For a specific field, perform adjustments to not have built-in conflicts
|
||||
*/
|
||||
public sanitizeField (name: Option<Text>): [string | null, string | null] {
|
||||
let nameField: string | null = null;
|
||||
let nameOrig: string | null = null;
|
||||
@@ -634,6 +616,7 @@ export class PortableRegistry extends Struct implements ILookup {
|
||||
return [nameField, nameOrig];
|
||||
}
|
||||
|
||||
/** @internal Creates a TypeDef based on an internal lookupId */
|
||||
#createSiDef (lookupId: SiLookupTypeId): TypeDef {
|
||||
const typeDef = this.getTypeDef(lookupId);
|
||||
const lookupIndex = lookupId.toNumber();
|
||||
@@ -650,10 +633,11 @@ export class PortableRegistry extends Struct implements ILookup {
|
||||
: typeDef;
|
||||
}
|
||||
|
||||
#getLookupId (lookupId: SiLookupTypeId | string | number): number {
|
||||
/** @internal Converts a lookupId input to the actual lookup index */
|
||||
#getLookupId (lookupId: SiLookupTypeId | LookupString | number): number {
|
||||
if (isString(lookupId)) {
|
||||
if (!this.registry.isLookupType(lookupId)) {
|
||||
throw new Error(`PortableRegistry: Expected a lookup string type, found ${lookupId}`);
|
||||
throw new Error(`PortableRegistry: Expected a lookup string type, found ${lookupId as string}`);
|
||||
}
|
||||
|
||||
return parseInt(lookupId.replace('Lookup', ''), 10);
|
||||
@@ -664,6 +648,7 @@ export class PortableRegistry extends Struct implements ILookup {
|
||||
return lookupId.toNumber();
|
||||
}
|
||||
|
||||
/** @internal Converts a type into a TypeDef for Codec usage */
|
||||
#extract (type: SiType, lookupIndex: number): TypeDef {
|
||||
const namespace = type.path.join('::');
|
||||
let typeDef: TypeDef;
|
||||
@@ -696,6 +681,7 @@ export class PortableRegistry extends Struct implements ILookup {
|
||||
}, typeDef);
|
||||
}
|
||||
|
||||
/** @internal Extracts a ScaleInfo Array into TypeDef.VecFixed */
|
||||
#extractArray (_: number, { len, type }: SiTypeDefArray): TypeDef {
|
||||
const length = len.toNumber();
|
||||
|
||||
@@ -710,6 +696,7 @@ export class PortableRegistry extends Struct implements ILookup {
|
||||
});
|
||||
}
|
||||
|
||||
/** @internal Extracts a ScaleInfo BitSequence into TypeDef.Plain */
|
||||
#extractBitSequence (_: number, { bitOrderType, bitStoreType }: SiTypeDefBitSequence): TypeDef {
|
||||
// With the v3 of scale-info this swapped around, but obviously the decoder cannot determine
|
||||
// the order. With that in-mind, we apply a detection for LSb0/Msb and set accordingly
|
||||
@@ -734,6 +721,7 @@ export class PortableRegistry extends Struct implements ILookup {
|
||||
};
|
||||
}
|
||||
|
||||
/** @internal Extracts a ScaleInfo Compact into TypeDef.Compact */
|
||||
#extractCompact (_: number, { type }: SiTypeDefCompact): TypeDef {
|
||||
return withTypeString(this.registry, {
|
||||
info: TypeDefInfo.Compact,
|
||||
@@ -741,6 +729,7 @@ export class PortableRegistry extends Struct implements ILookup {
|
||||
});
|
||||
}
|
||||
|
||||
/** @internal Extracts a ScaleInfo Composite into TypeDef.{BTree*, Range*, Wrapper*} */
|
||||
#extractComposite (lookupIndex: number, { params, path }: SiType, { fields }: SiTypeDefComposite): TypeDef {
|
||||
if (path.length) {
|
||||
const pathFirst = path[0].toString();
|
||||
@@ -796,6 +785,7 @@ export class PortableRegistry extends Struct implements ILookup {
|
||||
: this.#extractFields(lookupIndex, fields);
|
||||
}
|
||||
|
||||
/** @internal Extracts a ScaleInfo CompositeSet into TypeDef.Set */
|
||||
#extractCompositeSet (_: number, params: SiTypeParameter[], fields: SiField[]): TypeDef {
|
||||
if (params.length !== 1 || fields.length !== 1) {
|
||||
throw new Error('Set handling expects param/field as single entries');
|
||||
@@ -814,6 +804,7 @@ export class PortableRegistry extends Struct implements ILookup {
|
||||
});
|
||||
}
|
||||
|
||||
/** @internal Extracts ScaleInfo enum/struct fields into TypeDef.{Struct, Tuple} */
|
||||
#extractFields (lookupIndex: number, fields: SiField[]): TypeDef {
|
||||
let isStruct = true;
|
||||
let isTuple = true;
|
||||
@@ -874,6 +865,7 @@ export class PortableRegistry extends Struct implements ILookup {
|
||||
));
|
||||
}
|
||||
|
||||
/** @internal Apply field aliassed (with no JS conflicts) */
|
||||
#extractFieldsAlias (fields: SiField[]): [TypeDef[], Map<string, string>] {
|
||||
const alias = new Map<string, string>();
|
||||
const sub = new Array<TypeDef>(fields.length);
|
||||
@@ -907,6 +899,7 @@ export class PortableRegistry extends Struct implements ILookup {
|
||||
return [sub, alias];
|
||||
}
|
||||
|
||||
/** @internal Extracts an internal Historic (pre V14) type */
|
||||
#extractHistoric (_: number, type: Type): TypeDef {
|
||||
return objectSpread({
|
||||
displayName: type.toString(),
|
||||
@@ -914,6 +907,7 @@ export class PortableRegistry extends Struct implements ILookup {
|
||||
}, getTypeDef(type));
|
||||
}
|
||||
|
||||
/** @internal Extracts a ScaleInfo Primitive into TypeDef.Plain */
|
||||
#extractPrimitive (_: number, type: SiType): TypeDef {
|
||||
const typeStr = type.def.asPrimitive.type.toString();
|
||||
|
||||
@@ -923,6 +917,7 @@ export class PortableRegistry extends Struct implements ILookup {
|
||||
};
|
||||
}
|
||||
|
||||
/** @internal Applies an alias path onto the TypeDef */
|
||||
#extractAliasPath (_: number, type: string): TypeDef {
|
||||
return {
|
||||
info: TypeDefInfo.Plain,
|
||||
@@ -930,6 +925,7 @@ export class PortableRegistry extends Struct implements ILookup {
|
||||
};
|
||||
}
|
||||
|
||||
/** @internal Extracts a ScaleInfo Sequence into TypeDef.Vec (with Bytes shortcut) */
|
||||
#extractSequence (lookupIndex: number, { type }: SiTypeDefSequence): TypeDef {
|
||||
const sub = this.#createSiDef(type);
|
||||
|
||||
@@ -948,6 +944,7 @@ export class PortableRegistry extends Struct implements ILookup {
|
||||
});
|
||||
}
|
||||
|
||||
/** @internal Extracts a ScaleInfo Tuple into TypeDef.Tuple */
|
||||
#extractTuple (lookupIndex: number, ids: SiTypeDefTuple): TypeDef {
|
||||
if (ids.length === 0) {
|
||||
return {
|
||||
@@ -968,6 +965,7 @@ export class PortableRegistry extends Struct implements ILookup {
|
||||
});
|
||||
}
|
||||
|
||||
/** @internal Extracts a ScaleInfo Variant into TypeDef.{Option, Result, Enum} */
|
||||
#extractVariant (lookupIndex: number, { params, path }: SiType, { variants }: SiTypeDefVariant): TypeDef {
|
||||
if (path.length) {
|
||||
const specialVariant = path[0].toString();
|
||||
@@ -1015,6 +1013,7 @@ export class PortableRegistry extends Struct implements ILookup {
|
||||
return this.#extractVariantEnum(lookupIndex, variants);
|
||||
}
|
||||
|
||||
/** @internal Extracts a ScaleInfo Variant into TypeDef.Enum */
|
||||
#extractVariantEnum (lookupIndex: number, variants: SiVariant[]): TypeDef {
|
||||
const sub: (TypeDef & { name: string })[] = [];
|
||||
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
|
||||
// Do not edit, auto-generated by @polkadot/dev
|
||||
|
||||
export const packageInfo = { name: '@polkadot/types', path: 'auto', type: 'auto', version: '9.12.1' };
|
||||
export const packageInfo = { name: '@polkadot/types', path: 'auto', type: 'auto', version: '9.13.5' };
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
import '@polkadot/types-create/types/lookup';
|
||||
|
||||
import type { Vec } from '@polkadot/types-codec';
|
||||
import type { LookupString } from '@polkadot/types-codec/types';
|
||||
import type { TypeDef } from '@polkadot/types-create/types';
|
||||
import type { PortableType } from '../interfaces/metadata';
|
||||
import type { SiLookupTypeId, SiType } from '../interfaces/scaleInfo';
|
||||
@@ -15,8 +16,8 @@ declare module '@polkadot/types-create/types/lookup' {
|
||||
readonly names: string[];
|
||||
readonly types: Vec<PortableType>;
|
||||
|
||||
getName (lookupId: SiLookupTypeId | string | number): string | undefined;
|
||||
getSiType (lookupId: SiLookupTypeId | string | number): SiType;
|
||||
getTypeDef (lookupId: SiLookupTypeId | string | number): TypeDef;
|
||||
getName (lookupId: SiLookupTypeId | LookupString | number): string | undefined;
|
||||
getSiType (lookupId: SiLookupTypeId | LookupString | number): SiType;
|
||||
getTypeDef (lookupId: SiLookupTypeId | LookupString | number): TypeDef;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import '@polkadot/types-codec/types/registry';
|
||||
import '@polkadot/types-create/types/augmentRegistry';
|
||||
|
||||
import type { AnyString, Codec, CodecClass } from '@polkadot/types-codec/types';
|
||||
import type { AnyString, Codec, CodecClass, LookupString } from '@polkadot/types-codec/types';
|
||||
import type { TypeDef } from '@polkadot/types-create/types';
|
||||
import type { ExtDef } from '../extrinsic/signedExtensions/types';
|
||||
import type { MetadataLatest } from '../interfaces/metadata';
|
||||
@@ -33,7 +33,7 @@ declare module '@polkadot/types-codec/types/registry' {
|
||||
|
||||
clearCache (): void
|
||||
|
||||
createLookupType (lookupId: SiLookupTypeId | number): string;
|
||||
createLookupType (lookupId: SiLookupTypeId | number): LookupString;
|
||||
|
||||
createClass <T extends Codec = Codec, K extends string = string> (type: K): CodecClass<DetectCodec<T, K>>;
|
||||
createType <T extends Codec = Codec, K extends string = string> (type: K, ...params: unknown[]): DetectCodec<T, K>;
|
||||
|
||||
Reference in New Issue
Block a user