Compare commits

...
42 Commits
Author SHA1 Message Date
github-actions[bot] e23d44d3f5 [CI Skip] release/stable 8.8.1
skip-checks: true
2022-06-12 09:03:06 +00:00
Jaco 0a444be04c 8.8.1 (#4929) 2022-06-12 11:53:39 +03:00
github-actions[bot] 1abb7085d6 [CI Skip] release/beta 8.7.2-19
skip-checks: true
2022-06-12 08:23:17 +00:00
Jaco bda5cda4bf Update issue template (#4928) 2022-06-12 11:13:50 +03:00
github-actions[bot] fe7e313f21 [CI Skip] release/beta 8.7.2-18
skip-checks: true
2022-06-12 07:44:29 +00:00
Jaco 31971b5d2c Correct handling for storage Option<Option<Type>> (#4927)
* Correct handling for storage Option<Option<Type>>

* Adjust
2022-06-12 10:36:41 +03:00
github-actions[bot] 54efaa665d [CI Skip] release/beta 8.7.2-17
skip-checks: true
2022-06-11 05:53:00 +00:00
Jaco ddb435219d Bump deps (& issue template) (#4924) 2022-06-11 08:44:02 +03:00
github-actions[bot] 6ceb381ed0 [CI Skip] release/beta 8.7.2-16
skip-checks: true
2022-06-10 09:57:20 +00:00
Jaco 6a82ab1efd Add Polkadot & Westend upgrade blocks (#4922)
* Add Polkadot & Westend upgrade blocks

* Correct versions

* Adjust CHANGELOG
2022-06-10 12:49:20 +03:00
github-actions[bot] 8e3cef8dbc [CI Skip] release/beta 8.7.2-15
skip-checks: true
2022-06-10 08:30:59 +00:00
Jaco 5fcfb1277d Align IEventData interfaces (#4921) 2022-06-10 11:22:13 +03:00
github-actions[bot] 61ca15c143 [CI Skip] release/beta 8.7.2-14
skip-checks: true
2022-06-10 06:49:23 +00:00
Jaco 0930a5e0dc Expose partial runtimeVersion on api.at (#4920) 2022-06-10 09:41:22 +03:00
github-actions[bot] 03824f4600 [CI Skip] release/beta 8.7.2-13
skip-checks: true
2022-06-10 06:05:39 +00:00
Jaco 1e785b50da Adjust named enum fields augmentation (#4919)
* Adjust named enum fields augmentation

* Named tuples

* Adjust sanitize for symbol

* Explicit check

* Remove unused code

* Adjust expansion

* Adjust (only keep to named tuples this round)

* Pass struct
2022-06-10 08:57:16 +03:00
github-actions[bot] daeb86a7af [CI Skip] release/beta 8.7.2-12
skip-checks: true
2022-06-09 10:52:26 +00:00
Jaco 7461527448 Cater for named event fields (#4915)
* Cater for named event fields

* Adjust name extraction

* Rebuild with named events

* Empty object

* Adjust

* Additional

* Adjust
2022-06-09 13:44:31 +03:00
github-actions[bot] 322ac0861d [CI Skip] release/beta 8.7.2-11
skip-checks: true
2022-06-08 17:14:09 +00:00
Jaco 52cd06917d Pass Range/WrapperOpaque names via options (#4911) 2022-06-08 20:04:01 +03:00
github-actions[bot] 767eb1fa15 [CI Skip] release/beta 8.7.2-10
skip-checks: true
2022-06-08 13:54:48 +00:00
Jaco 60640b4c6c Update derive.bagsList to detect voterList pallet (#4910)
* Update `derive.bagsList` to detect `voterList` pallet

* Adjust

* Adjust
2022-06-08 16:45:48 +03:00
github-actions[bot] dfd45e866b [CI Skip] release/beta 8.7.2-9
skip-checks: true
2022-06-08 11:40:15 +00:00
Jaco dafa9ccc2c assert for blockHash alongside era override (#4909)
* assert for blockHash alongside era override

* typo
2022-06-08 14:31:08 +03:00
github-actions[bot] aeb76aea9a [CI Skip] release/beta 8.7.2-8
skip-checks: true
2022-06-08 10:48:06 +00:00
Jaco 436e48aab2 Align DispatchError (#4907) 2022-06-08 13:38:38 +03:00
github-actions[bot] 0871458312 [CI Skip] release/beta 8.7.2-7
skip-checks: true
2022-06-08 09:36:14 +00:00
Jaco 7edff67240 Split rpc.system.* definitions (#4906) 2022-06-08 12:28:03 +03:00
github-actions[bot] 89a2ff2cda [CI Skip] release/beta 8.7.2-6
skip-checks: true
2022-06-08 08:41:03 +00:00
Jaco d0fbecb0c4 Bump dev (#4905) 2022-06-08 11:31:40 +03:00
github-actions[bot] ed8802e605 [CI Skip] release/beta 8.7.2-5
skip-checks: true
2022-06-08 07:23:43 +00:00
Jaco 791e76546a Workaround for default calls on chains with non-standard indexes (#4904) 2022-06-08 10:15:48 +03:00
github-actions[bot] 804b58139a [CI Skip] release/beta 8.7.2-4
skip-checks: true
2022-06-07 19:39:26 +00:00
Raphael Flechtner ec746648c7 fix: typegen disconnect ws on success (#4901)
* fix: typegen disconnect ws on success

* fix: check for error onclose
2022-06-07 22:30:23 +03:00
github-actions[bot] 4cd8d5c60b [CI Skip] release/beta 8.7.2-3
skip-checks: true
2022-06-07 11:52:23 +00:00
Jaco df74330b67 Adjust AbstractInt asserts (#4898)
* Adjust AbstractInt asserts

* Adjust

* Number.isInteger
2022-06-07 14:43:39 +03:00
github-actions[bot] ea36b6d486 [CI Skip] release/beta 8.7.2-2
skip-checks: true
2022-06-06 07:37:12 +00:00
Jaco a210a7314d Use Result<.., ...> instead of specific enum (#4895) 2022-06-06 10:28:50 +03:00
github-actions[bot] 2d5d8e6713 [CI Skip] release/beta 8.7.2-1
skip-checks: true
2022-06-06 05:48:31 +00:00
Jaco 56a3d4ece8 DispatchError{U8, U8a} aliasing (w/ contracts RPC) (#4894)
* DispatchError{U8, U8a} aliasing (w/ contracts RPC)

* Rename
2022-06-06 08:40:35 +03:00
github-actions[bot] 3336f5530c [CI Skip] release/beta 8.7.2-0
skip-checks: true
2022-06-06 04:06:56 +00:00
Jaco f96b9c6d19 Optimization for value returns on merged queries (#4893)
* Optimization for value returns on merged queries

* Adjust

* Flatten
2022-06-06 06:58:00 +03:00
80 changed files with 1778 additions and 1585 deletions
+50
View File
@@ -0,0 +1,50 @@
<!--
For general support, howto, coding and bundling questions, please use the Substrate & Polkadot StackExchange at https://substrate.stackexchange.com/ and get other ecosystem developers involved. This issues in this repository are meant for the tracking of feature requests and bug reports.
While all issues are looked at non-bug and non-features would take quite a bit longer to get to and may yield less than satisfactory responses in this format.
Additionally, please ensure you have done a search on the existing and closed issues before logging a new request. This saves time on all sides.
-->
* **I'm submitting a ...**
<!--- Try and classify your actual report -->
- [ ] Bug report
- [ ] Feature request
- [ ] Support request (please bear the comments above in mind)
- [ ] Other
* **What is the current behavior and expected behavior?**
<!--- If you're describing a bug, tell us what should happen -->
<!--- If you're suggesting a change/improvement, tell us how it should work -->
* **What is the motivation for changing the behavior?**
<!--- Not obligatory, but suggest a motivation for the request -->
<!--- or ideas how to implement the addition or change -->
* **Please tell us about your environment:**
<!--- Include as many relevant details about the environment you experienced the issue in -->
<!--- Also snsure that you have tested against the latest stable releases if a bug -->
- Version:
- Environment:
- [ ] Node.js
- [ ] Browser
- [ ] Other (limited support for other environments available)
- Language:
- [ ] JavaScript
- [ ] TypeScript
- [ ] Other
+21
View File
@@ -1,5 +1,26 @@
# CHANGELOG # CHANGELOG
## 8.8.1 Jun 12, 2022
Contributed:
- Ensure typegen disconnects from WS endpoint (Thanks to https://github.com/rflechtner)
Changes:
- Ensure storage `Option<Option<Type>>` are correctly handled
- Cater for named event fields (expose on event data as available)
- Expose (partial) `runtimeVersion` on `api.at` interfaces
- Add aliases for `DispatchError{U8, U8a}` (default to new `U8a` variant)
- Align `DispatchError` definition with latest Substrate
- Adjust contracts RPC definitions with `DispatchError` return
- Ensure `blockHash` is passed through with `era` sign options
- Workaround for default calls on chains with non-standard indexes
- Optimization for value returns on merged queries
- Update `derive.bagsList` to detect `voterList` pallet
- Add Polkadot 9200/9220 & Westend 9230 upgrade blocks
## 8.7.1 Jun 4, 2022 ## 8.7.1 Jun 4, 2022
Changes: Changes:
+2 -1
View File
@@ -1,4 +1,4 @@
2999 Jaco 8.7.1 (#4892) 3019 Jaco 8.8.1 (#4929)
83 Amaury Martiny StatementKind: Regular and Saft (#2303) 83 Amaury Martiny StatementKind: Regular and Saft (#2303)
37 Keith Ingram Update contract types and rpc (#4541) 37 Keith Ingram Update contract types and rpc (#4541)
35 Stefanie Doll Updated child storage parameters (#1709) 35 Stefanie Doll Updated child storage parameters (#1709)
@@ -88,6 +88,7 @@
1 philipstanislaus Update types for centrifuge chain v1.2.0 (#2424) 1 philipstanislaus Update types for centrifuge chain v1.2.0 (#2424)
1 qiuhao update DeriveCustom type (#2581) 1 qiuhao update DeriveCustom type (#2581)
1 r0t0r-r0t0r Fix memory leak on raw rpc call (#4505) 1 r0t0r-r0t0r Fix memory leak on raw rpc call (#4505)
1 Raphael Flechtner fix: typegen disconnect ws on success (#4901)
1 Rocco Musolino remove broken link (#2671) 1 Rocco Musolino remove broken link (#2671)
1 satellitex Add BTreeSet<V> Codec (#1639) 1 satellitex Add BTreeSet<V> Codec (#1639)
1 satellitex Add traits replace rules. for invalid cases `::<type>` and `<type>::`. (#885) 1 satellitex Add traits replace rules. for invalid cases `::<type>` and `<type>::`. (#885)
+3 -3
View File
@@ -11,7 +11,7 @@
}, },
"sideEffects": false, "sideEffects": false,
"type": "commonjs", "type": "commonjs",
"version": "8.7.1", "version": "8.8.1",
"workspaces": [ "workspaces": [
"packages/*" "packages/*"
], ],
@@ -34,9 +34,9 @@
"@babel/core": "^7.18.2", "@babel/core": "^7.18.2",
"@babel/register": "^7.17.7", "@babel/register": "^7.17.7",
"@babel/runtime": "^7.18.3", "@babel/runtime": "^7.18.3",
"@polkadot/dev": "^0.66.34", "@polkadot/dev": "^0.66.37",
"@polkadot/typegen": "workspace:packages/typegen", "@polkadot/typegen": "workspace:packages/typegen",
"@types/jest": "^28.1.0", "@types/jest": "^28.1.1",
"copyfiles": "^2.4.1" "copyfiles": "^2.4.1"
}, },
"resolutions": { "resolutions": {
+7 -7
View File
@@ -20,18 +20,18 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "8.7.1", "version": "8.8.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.18.3", "@babel/runtime": "^7.18.3",
"@polkadot/api-base": "8.7.1", "@polkadot/api-base": "8.8.1",
"@polkadot/rpc-augment": "8.7.1", "@polkadot/rpc-augment": "8.8.1",
"@polkadot/types": "8.7.1", "@polkadot/types": "8.8.1",
"@polkadot/types-augment": "8.7.1", "@polkadot/types-augment": "8.8.1",
"@polkadot/types-codec": "8.7.1", "@polkadot/types-codec": "8.8.1",
"@polkadot/util": "^9.4.1" "@polkadot/util": "^9.4.1"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/types-support": "8.7.1" "@polkadot/types-support": "8.8.1"
} }
} }
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev // Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/api-augment', path: 'auto', type: 'auto', version: '8.7.1' }; export const packageInfo = { name: '@polkadot/api-augment', path: 'auto', type: 'auto', version: '8.8.1' };
+145 -145
View File
@@ -14,34 +14,34 @@ declare module '@polkadot/api-base/types/events' {
/** /**
* An auction ended. All funds become unreserved. * An auction ended. All funds become unreserved.
**/ **/
AuctionClosed: AugmentedEvent<ApiType, [u32]>; AuctionClosed: AugmentedEvent<ApiType, [auctionIndex: u32], { auctionIndex: u32 }>;
/** /**
* An auction started. Provides its index and the block number where it will begin to * An auction started. Provides its index and the block number where it will begin to
* close and the first lease period of the quadruplet that is auctioned. * close and the first lease period of the quadruplet that is auctioned.
**/ **/
AuctionStarted: AugmentedEvent<ApiType, [u32, u32, u32]>; AuctionStarted: AugmentedEvent<ApiType, [auctionIndex: u32, leasePeriod: u32, ending: u32], { auctionIndex: u32, leasePeriod: u32, ending: u32 }>;
/** /**
* A new bid has been accepted as the current winner. * A new bid has been accepted as the current winner.
**/ **/
BidAccepted: AugmentedEvent<ApiType, [AccountId32, u32, u128, u32, u32]>; BidAccepted: AugmentedEvent<ApiType, [bidder: AccountId32, paraId: u32, amount: u128, firstSlot: u32, lastSlot: u32], { bidder: AccountId32, paraId: u32, amount: u128, firstSlot: u32, lastSlot: u32 }>;
/** /**
* Someone attempted to lease the same slot twice for a parachain. The amount is held in reserve * Someone attempted to lease the same slot twice for a parachain. The amount is held in reserve
* but no parachain slot has been leased. * but no parachain slot has been leased.
**/ **/
ReserveConfiscated: AugmentedEvent<ApiType, [u32, AccountId32, u128]>; ReserveConfiscated: AugmentedEvent<ApiType, [paraId: u32, leaser: AccountId32, amount: u128], { paraId: u32, leaser: AccountId32, amount: u128 }>;
/** /**
* Funds were reserved for a winning bid. First balance is the extra amount reserved. * Funds were reserved for a winning bid. First balance is the extra amount reserved.
* Second is the total. * Second is the total.
**/ **/
Reserved: AugmentedEvent<ApiType, [AccountId32, u128, u128]>; Reserved: AugmentedEvent<ApiType, [bidder: AccountId32, extraReserved: u128, totalAmount: u128], { bidder: AccountId32, extraReserved: u128, totalAmount: u128 }>;
/** /**
* Funds were unreserved since bidder is no longer active. `[bidder, amount]` * Funds were unreserved since bidder is no longer active. `[bidder, amount]`
**/ **/
Unreserved: AugmentedEvent<ApiType, [AccountId32, u128]>; Unreserved: AugmentedEvent<ApiType, [bidder: AccountId32, amount: u128], { bidder: AccountId32, amount: u128 }>;
/** /**
* The winning offset was chosen for an auction. This will map into the `Winning` storage map. * The winning offset was chosen for an auction. This will map into the `Winning` storage map.
**/ **/
WinningOffset: AugmentedEvent<ApiType, [u32, u32]>; WinningOffset: AugmentedEvent<ApiType, [auctionIndex: u32, blockNumber: u32], { auctionIndex: u32, blockNumber: u32 }>;
/** /**
* Generic event * Generic event
**/ **/
@@ -51,45 +51,45 @@ declare module '@polkadot/api-base/types/events' {
/** /**
* A balance was set by root. * A balance was set by root.
**/ **/
BalanceSet: AugmentedEvent<ApiType, [AccountId32, u128, u128]>; BalanceSet: AugmentedEvent<ApiType, [who: AccountId32, free: u128, reserved: u128], { who: AccountId32, free: u128, reserved: u128 }>;
/** /**
* Some amount was deposited (e.g. for transaction fees). * Some amount was deposited (e.g. for transaction fees).
**/ **/
Deposit: AugmentedEvent<ApiType, [AccountId32, u128]>; Deposit: AugmentedEvent<ApiType, [who: AccountId32, amount: u128], { who: AccountId32, amount: u128 }>;
/** /**
* An account was removed whose balance was non-zero but below ExistentialDeposit, * An account was removed whose balance was non-zero but below ExistentialDeposit,
* resulting in an outright loss. * resulting in an outright loss.
**/ **/
DustLost: AugmentedEvent<ApiType, [AccountId32, u128]>; DustLost: AugmentedEvent<ApiType, [account: AccountId32, amount: u128], { account: AccountId32, amount: u128 }>;
/** /**
* An account was created with some free balance. * An account was created with some free balance.
**/ **/
Endowed: AugmentedEvent<ApiType, [AccountId32, u128]>; Endowed: AugmentedEvent<ApiType, [account: AccountId32, freeBalance: u128], { account: AccountId32, freeBalance: u128 }>;
/** /**
* Some balance was reserved (moved from free to reserved). * Some balance was reserved (moved from free to reserved).
**/ **/
Reserved: AugmentedEvent<ApiType, [AccountId32, u128]>; Reserved: AugmentedEvent<ApiType, [who: AccountId32, amount: u128], { who: AccountId32, amount: u128 }>;
/** /**
* Some balance was moved from the reserve of the first account to the second account. * Some balance was moved from the reserve of the first account to the second account.
* Final argument indicates the destination balance type. * Final argument indicates the destination balance type.
**/ **/
ReserveRepatriated: AugmentedEvent<ApiType, [AccountId32, AccountId32, u128, FrameSupportTokensMiscBalanceStatus]>; ReserveRepatriated: AugmentedEvent<ApiType, [from: AccountId32, to: AccountId32, amount: u128, destinationStatus: FrameSupportTokensMiscBalanceStatus], { from: AccountId32, to: AccountId32, amount: u128, destinationStatus: FrameSupportTokensMiscBalanceStatus }>;
/** /**
* Some amount was removed from the account (e.g. for misbehavior). * Some amount was removed from the account (e.g. for misbehavior).
**/ **/
Slashed: AugmentedEvent<ApiType, [AccountId32, u128]>; Slashed: AugmentedEvent<ApiType, [who: AccountId32, amount: u128], { who: AccountId32, amount: u128 }>;
/** /**
* Transfer succeeded. * Transfer succeeded.
**/ **/
Transfer: AugmentedEvent<ApiType, [AccountId32, AccountId32, u128]>; Transfer: AugmentedEvent<ApiType, [from: AccountId32, to: AccountId32, amount: u128], { from: AccountId32, to: AccountId32, amount: u128 }>;
/** /**
* Some balance was unreserved (moved from reserved to free). * Some balance was unreserved (moved from reserved to free).
**/ **/
Unreserved: AugmentedEvent<ApiType, [AccountId32, u128]>; Unreserved: AugmentedEvent<ApiType, [who: AccountId32, amount: u128], { who: AccountId32, amount: u128 }>;
/** /**
* Some amount was withdrawn from the account (e.g. for transaction fees). * Some amount was withdrawn from the account (e.g. for transaction fees).
**/ **/
Withdraw: AugmentedEvent<ApiType, [AccountId32, u128]>; Withdraw: AugmentedEvent<ApiType, [who: AccountId32, amount: u128], { who: AccountId32, amount: u128 }>;
/** /**
* Generic event * Generic event
**/ **/
@@ -99,31 +99,31 @@ declare module '@polkadot/api-base/types/events' {
/** /**
* A bounty is awarded to a beneficiary. * A bounty is awarded to a beneficiary.
**/ **/
BountyAwarded: AugmentedEvent<ApiType, [u32, AccountId32]>; BountyAwarded: AugmentedEvent<ApiType, [index: u32, beneficiary: AccountId32], { index: u32, beneficiary: AccountId32 }>;
/** /**
* A bounty proposal is funded and became active. * A bounty proposal is funded and became active.
**/ **/
BountyBecameActive: AugmentedEvent<ApiType, [u32]>; BountyBecameActive: AugmentedEvent<ApiType, [index: u32], { index: u32 }>;
/** /**
* A bounty is cancelled. * A bounty is cancelled.
**/ **/
BountyCanceled: AugmentedEvent<ApiType, [u32]>; BountyCanceled: AugmentedEvent<ApiType, [index: u32], { index: u32 }>;
/** /**
* A bounty is claimed by beneficiary. * A bounty is claimed by beneficiary.
**/ **/
BountyClaimed: AugmentedEvent<ApiType, [u32, u128, AccountId32]>; BountyClaimed: AugmentedEvent<ApiType, [index: u32, payout: u128, beneficiary: AccountId32], { index: u32, payout: u128, beneficiary: AccountId32 }>;
/** /**
* A bounty expiry is extended. * A bounty expiry is extended.
**/ **/
BountyExtended: AugmentedEvent<ApiType, [u32]>; BountyExtended: AugmentedEvent<ApiType, [index: u32], { index: u32 }>;
/** /**
* New bounty proposal. * New bounty proposal.
**/ **/
BountyProposed: AugmentedEvent<ApiType, [u32]>; BountyProposed: AugmentedEvent<ApiType, [index: u32], { index: u32 }>;
/** /**
* A bounty proposal was rejected; funds were slashed. * A bounty proposal was rejected; funds were slashed.
**/ **/
BountyRejected: AugmentedEvent<ApiType, [u32, u128]>; BountyRejected: AugmentedEvent<ApiType, [index: u32, bond: u128], { index: u32, bond: u128 }>;
/** /**
* Generic event * Generic event
**/ **/
@@ -133,19 +133,19 @@ declare module '@polkadot/api-base/types/events' {
/** /**
* A child-bounty is added. * A child-bounty is added.
**/ **/
Added: AugmentedEvent<ApiType, [u32, u32]>; Added: AugmentedEvent<ApiType, [index: u32, childIndex: u32], { index: u32, childIndex: u32 }>;
/** /**
* A child-bounty is awarded to a beneficiary. * A child-bounty is awarded to a beneficiary.
**/ **/
Awarded: AugmentedEvent<ApiType, [u32, u32, AccountId32]>; Awarded: AugmentedEvent<ApiType, [index: u32, childIndex: u32, beneficiary: AccountId32], { index: u32, childIndex: u32, beneficiary: AccountId32 }>;
/** /**
* A child-bounty is cancelled. * A child-bounty is cancelled.
**/ **/
Canceled: AugmentedEvent<ApiType, [u32, u32]>; Canceled: AugmentedEvent<ApiType, [index: u32, childIndex: u32], { index: u32, childIndex: u32 }>;
/** /**
* A child-bounty is claimed by beneficiary. * A child-bounty is claimed by beneficiary.
**/ **/
Claimed: AugmentedEvent<ApiType, [u32, u32, u128, AccountId32]>; Claimed: AugmentedEvent<ApiType, [index: u32, childIndex: u32, payout: u128, beneficiary: AccountId32], { index: u32, childIndex: u32, payout: u128, beneficiary: AccountId32 }>;
/** /**
* Generic event * Generic event
**/ **/
@@ -155,7 +155,7 @@ declare module '@polkadot/api-base/types/events' {
/** /**
* Someone claimed some DOTs. * Someone claimed some DOTs.
**/ **/
Claimed: AugmentedEvent<ApiType, [AccountId32, EthereumAddress, u128]>; Claimed: AugmentedEvent<ApiType, [who: AccountId32, ethereumAddress: EthereumAddress, amount: u128], { who: AccountId32, ethereumAddress: EthereumAddress, amount: u128 }>;
/** /**
* Generic event * Generic event
**/ **/
@@ -165,33 +165,33 @@ declare module '@polkadot/api-base/types/events' {
/** /**
* A motion was approved by the required threshold. * A motion was approved by the required threshold.
**/ **/
Approved: AugmentedEvent<ApiType, [H256]>; Approved: AugmentedEvent<ApiType, [proposalHash: H256], { proposalHash: H256 }>;
/** /**
* A proposal was closed because its threshold was reached or after its duration was up. * A proposal was closed because its threshold was reached or after its duration was up.
**/ **/
Closed: AugmentedEvent<ApiType, [H256, u32, u32]>; Closed: AugmentedEvent<ApiType, [proposalHash: H256, yes: u32, no: u32], { proposalHash: H256, yes: u32, no: u32 }>;
/** /**
* A motion was not approved by the required threshold. * A motion was not approved by the required threshold.
**/ **/
Disapproved: AugmentedEvent<ApiType, [H256]>; Disapproved: AugmentedEvent<ApiType, [proposalHash: H256], { proposalHash: H256 }>;
/** /**
* A motion was executed; result will be `Ok` if it returned without error. * A motion was executed; result will be `Ok` if it returned without error.
**/ **/
Executed: AugmentedEvent<ApiType, [H256, Result<Null, SpRuntimeDispatchError>]>; Executed: AugmentedEvent<ApiType, [proposalHash: H256, result: Result<Null, SpRuntimeDispatchError>], { proposalHash: H256, result: Result<Null, SpRuntimeDispatchError> }>;
/** /**
* A single member did some action; result will be `Ok` if it returned without error. * A single member did some action; result will be `Ok` if it returned without error.
**/ **/
MemberExecuted: AugmentedEvent<ApiType, [H256, Result<Null, SpRuntimeDispatchError>]>; MemberExecuted: AugmentedEvent<ApiType, [proposalHash: H256, result: Result<Null, SpRuntimeDispatchError>], { proposalHash: H256, result: Result<Null, SpRuntimeDispatchError> }>;
/** /**
* A motion (given hash) has been proposed (by given account) with a threshold (given * A motion (given hash) has been proposed (by given account) with a threshold (given
* `MemberCount`). * `MemberCount`).
**/ **/
Proposed: AugmentedEvent<ApiType, [AccountId32, u32, H256, u32]>; Proposed: AugmentedEvent<ApiType, [account: AccountId32, proposalIndex: u32, proposalHash: H256, threshold: u32], { account: AccountId32, proposalIndex: u32, proposalHash: H256, threshold: u32 }>;
/** /**
* A motion (given hash) has been voted on by given account, leaving * A motion (given hash) has been voted on by given account, leaving
* a tally (yes votes and no votes given respectively as `MemberCount`). * a tally (yes votes and no votes given respectively as `MemberCount`).
**/ **/
Voted: AugmentedEvent<ApiType, [AccountId32, H256, bool, u32, u32]>; Voted: AugmentedEvent<ApiType, [account: AccountId32, proposalHash: H256, voted: bool, yes: u32, no: u32], { account: AccountId32, proposalHash: H256, voted: bool, yes: u32, no: u32 }>;
/** /**
* Generic event * Generic event
**/ **/
@@ -201,44 +201,44 @@ declare module '@polkadot/api-base/types/events' {
/** /**
* A parachain has been moved to `NewRaise` * A parachain has been moved to `NewRaise`
**/ **/
AddedToNewRaise: AugmentedEvent<ApiType, [u32]>; AddedToNewRaise: AugmentedEvent<ApiType, [paraId: u32], { paraId: u32 }>;
/** /**
* All loans in a fund have been refunded. * All loans in a fund have been refunded.
**/ **/
AllRefunded: AugmentedEvent<ApiType, [u32]>; AllRefunded: AugmentedEvent<ApiType, [paraId: u32], { paraId: u32 }>;
/** /**
* Contributed to a crowd sale. * Contributed to a crowd sale.
**/ **/
Contributed: AugmentedEvent<ApiType, [AccountId32, u32, u128]>; Contributed: AugmentedEvent<ApiType, [who: AccountId32, fundIndex: u32, amount: u128], { who: AccountId32, fundIndex: u32, amount: u128 }>;
/** /**
* Create a new crowdloaning campaign. * Create a new crowdloaning campaign.
**/ **/
Created: AugmentedEvent<ApiType, [u32]>; Created: AugmentedEvent<ApiType, [paraId: u32], { paraId: u32 }>;
/** /**
* Fund is dissolved. * Fund is dissolved.
**/ **/
Dissolved: AugmentedEvent<ApiType, [u32]>; Dissolved: AugmentedEvent<ApiType, [paraId: u32], { paraId: u32 }>;
/** /**
* The configuration to a crowdloan has been edited. * The configuration to a crowdloan has been edited.
**/ **/
Edited: AugmentedEvent<ApiType, [u32]>; Edited: AugmentedEvent<ApiType, [paraId: u32], { paraId: u32 }>;
/** /**
* The result of trying to submit a new bid to the Slots pallet. * The result of trying to submit a new bid to the Slots pallet.
**/ **/
HandleBidResult: AugmentedEvent<ApiType, [u32, Result<Null, SpRuntimeDispatchError>]>; HandleBidResult: AugmentedEvent<ApiType, [paraId: u32, result: Result<Null, SpRuntimeDispatchError>], { paraId: u32, result: Result<Null, SpRuntimeDispatchError> }>;
/** /**
* A memo has been updated. * A memo has been updated.
**/ **/
MemoUpdated: AugmentedEvent<ApiType, [AccountId32, u32, Bytes]>; MemoUpdated: AugmentedEvent<ApiType, [who: AccountId32, paraId: u32, memo: Bytes], { who: AccountId32, paraId: u32, memo: Bytes }>;
/** /**
* The loans in a fund have been partially dissolved, i.e. there are some left * The loans in a fund have been partially dissolved, i.e. there are some left
* over child keys that still need to be killed. * over child keys that still need to be killed.
**/ **/
PartiallyRefunded: AugmentedEvent<ApiType, [u32]>; PartiallyRefunded: AugmentedEvent<ApiType, [paraId: u32], { paraId: u32 }>;
/** /**
* Withdrew full balance of a contributor. * Withdrew full balance of a contributor.
**/ **/
Withdrew: AugmentedEvent<ApiType, [AccountId32, u32, u128]>; Withdrew: AugmentedEvent<ApiType, [who: AccountId32, fundIndex: u32, amount: u128], { who: AccountId32, fundIndex: u32, amount: u128 }>;
/** /**
* Generic event * Generic event
**/ **/
@@ -248,19 +248,19 @@ declare module '@polkadot/api-base/types/events' {
/** /**
* A proposal_hash has been blacklisted permanently. * A proposal_hash has been blacklisted permanently.
**/ **/
Blacklisted: AugmentedEvent<ApiType, [H256]>; Blacklisted: AugmentedEvent<ApiType, [proposalHash: H256], { proposalHash: H256 }>;
/** /**
* A referendum has been cancelled. * A referendum has been cancelled.
**/ **/
Cancelled: AugmentedEvent<ApiType, [u32]>; Cancelled: AugmentedEvent<ApiType, [refIndex: u32], { refIndex: u32 }>;
/** /**
* An account has delegated their vote to another account. * An account has delegated their vote to another account.
**/ **/
Delegated: AugmentedEvent<ApiType, [AccountId32, AccountId32]>; Delegated: AugmentedEvent<ApiType, [who: AccountId32, target: AccountId32], { who: AccountId32, target: AccountId32 }>;
/** /**
* A proposal has been enacted. * A proposal has been enacted.
**/ **/
Executed: AugmentedEvent<ApiType, [u32, Result<Null, SpRuntimeDispatchError>]>; Executed: AugmentedEvent<ApiType, [refIndex: u32, result: Result<Null, SpRuntimeDispatchError>], { refIndex: u32, result: Result<Null, SpRuntimeDispatchError> }>;
/** /**
* An external proposal has been tabled. * An external proposal has been tabled.
**/ **/
@@ -268,59 +268,59 @@ declare module '@polkadot/api-base/types/events' {
/** /**
* A proposal has been rejected by referendum. * A proposal has been rejected by referendum.
**/ **/
NotPassed: AugmentedEvent<ApiType, [u32]>; NotPassed: AugmentedEvent<ApiType, [refIndex: u32], { refIndex: u32 }>;
/** /**
* A proposal has been approved by referendum. * A proposal has been approved by referendum.
**/ **/
Passed: AugmentedEvent<ApiType, [u32]>; Passed: AugmentedEvent<ApiType, [refIndex: u32], { refIndex: u32 }>;
/** /**
* A proposal could not be executed because its preimage was invalid. * A proposal could not be executed because its preimage was invalid.
**/ **/
PreimageInvalid: AugmentedEvent<ApiType, [H256, u32]>; PreimageInvalid: AugmentedEvent<ApiType, [proposalHash: H256, refIndex: u32], { proposalHash: H256, refIndex: u32 }>;
/** /**
* A proposal could not be executed because its preimage was missing. * A proposal could not be executed because its preimage was missing.
**/ **/
PreimageMissing: AugmentedEvent<ApiType, [H256, u32]>; PreimageMissing: AugmentedEvent<ApiType, [proposalHash: H256, refIndex: u32], { proposalHash: H256, refIndex: u32 }>;
/** /**
* A proposal's preimage was noted, and the deposit taken. * A proposal's preimage was noted, and the deposit taken.
**/ **/
PreimageNoted: AugmentedEvent<ApiType, [H256, AccountId32, u128]>; PreimageNoted: AugmentedEvent<ApiType, [proposalHash: H256, who: AccountId32, deposit: u128], { proposalHash: H256, who: AccountId32, deposit: u128 }>;
/** /**
* A registered preimage was removed and the deposit collected by the reaper. * A registered preimage was removed and the deposit collected by the reaper.
**/ **/
PreimageReaped: AugmentedEvent<ApiType, [H256, AccountId32, u128, AccountId32]>; PreimageReaped: AugmentedEvent<ApiType, [proposalHash: H256, provider: AccountId32, deposit: u128, reaper: AccountId32], { proposalHash: H256, provider: AccountId32, deposit: u128, reaper: AccountId32 }>;
/** /**
* A proposal preimage was removed and used (the deposit was returned). * A proposal preimage was removed and used (the deposit was returned).
**/ **/
PreimageUsed: AugmentedEvent<ApiType, [H256, AccountId32, u128]>; PreimageUsed: AugmentedEvent<ApiType, [proposalHash: H256, provider: AccountId32, deposit: u128], { proposalHash: H256, provider: AccountId32, deposit: u128 }>;
/** /**
* A motion has been proposed by a public account. * A motion has been proposed by a public account.
**/ **/
Proposed: AugmentedEvent<ApiType, [u32, u128]>; Proposed: AugmentedEvent<ApiType, [proposalIndex: u32, deposit: u128], { proposalIndex: u32, deposit: u128 }>;
/** /**
* An account has secconded a proposal * An account has secconded a proposal
**/ **/
Seconded: AugmentedEvent<ApiType, [AccountId32, u32]>; Seconded: AugmentedEvent<ApiType, [seconder: AccountId32, propIndex: u32], { seconder: AccountId32, propIndex: u32 }>;
/** /**
* A referendum has begun. * A referendum has begun.
**/ **/
Started: AugmentedEvent<ApiType, [u32, PalletDemocracyVoteThreshold]>; Started: AugmentedEvent<ApiType, [refIndex: u32, threshold: PalletDemocracyVoteThreshold], { refIndex: u32, threshold: PalletDemocracyVoteThreshold }>;
/** /**
* A public proposal has been tabled for referendum vote. * A public proposal has been tabled for referendum vote.
**/ **/
Tabled: AugmentedEvent<ApiType, [u32, u128, Vec<AccountId32>]>; Tabled: AugmentedEvent<ApiType, [proposalIndex: u32, deposit: u128, depositors: Vec<AccountId32>], { proposalIndex: u32, deposit: u128, depositors: Vec<AccountId32> }>;
/** /**
* An account has cancelled a previous delegation operation. * An account has cancelled a previous delegation operation.
**/ **/
Undelegated: AugmentedEvent<ApiType, [AccountId32]>; Undelegated: AugmentedEvent<ApiType, [account: AccountId32], { account: AccountId32 }>;
/** /**
* An external proposal has been vetoed. * An external proposal has been vetoed.
**/ **/
Vetoed: AugmentedEvent<ApiType, [AccountId32, H256, u32]>; Vetoed: AugmentedEvent<ApiType, [who: AccountId32, proposalHash: H256, until: u32], { who: AccountId32, proposalHash: H256, until: u32 }>;
/** /**
* An account has voted in a referendum * An account has voted in a referendum
**/ **/
Voted: AugmentedEvent<ApiType, [AccountId32, u32, PalletDemocracyVoteAccountVote]>; Voted: AugmentedEvent<ApiType, [voter: AccountId32, refIndex: u32, vote: PalletDemocracyVoteAccountVote], { voter: AccountId32, refIndex: u32, vote: PalletDemocracyVoteAccountVote }>;
/** /**
* Generic event * Generic event
**/ **/
@@ -331,19 +331,19 @@ declare module '@polkadot/api-base/types/events' {
* The election has been finalized, with `Some` of the given computation, or else if the * The election has been finalized, with `Some` of the given computation, or else if the
* election failed, `None`. * election failed, `None`.
**/ **/
ElectionFinalized: AugmentedEvent<ApiType, [Option<PalletElectionProviderMultiPhaseElectionCompute>]>; ElectionFinalized: AugmentedEvent<ApiType, [electionCompute: Option<PalletElectionProviderMultiPhaseElectionCompute>], { electionCompute: Option<PalletElectionProviderMultiPhaseElectionCompute> }>;
/** /**
* An account has been rewarded for their signed submission being finalized. * An account has been rewarded for their signed submission being finalized.
**/ **/
Rewarded: AugmentedEvent<ApiType, [AccountId32, u128]>; Rewarded: AugmentedEvent<ApiType, [account: AccountId32, value: u128], { account: AccountId32, value: u128 }>;
/** /**
* The signed phase of the given round has started. * The signed phase of the given round has started.
**/ **/
SignedPhaseStarted: AugmentedEvent<ApiType, [u32]>; SignedPhaseStarted: AugmentedEvent<ApiType, [round: u32], { round: u32 }>;
/** /**
* An account has been slashed for submitting an invalid signed submission. * An account has been slashed for submitting an invalid signed submission.
**/ **/
Slashed: AugmentedEvent<ApiType, [AccountId32, u128]>; Slashed: AugmentedEvent<ApiType, [account: AccountId32, value: u128], { account: AccountId32, value: u128 }>;
/** /**
* A solution was stored with the given compute. * A solution was stored with the given compute.
* *
@@ -352,11 +352,11 @@ declare module '@polkadot/api-base/types/events' {
* *
* The `bool` is `true` when a previous solution was ejected to make room for this one. * The `bool` is `true` when a previous solution was ejected to make room for this one.
**/ **/
SolutionStored: AugmentedEvent<ApiType, [PalletElectionProviderMultiPhaseElectionCompute, bool]>; SolutionStored: AugmentedEvent<ApiType, [electionCompute: PalletElectionProviderMultiPhaseElectionCompute, prevEjected: bool], { electionCompute: PalletElectionProviderMultiPhaseElectionCompute, prevEjected: bool }>;
/** /**
* The unsigned phase of the given round has started. * The unsigned phase of the given round has started.
**/ **/
UnsignedPhaseStarted: AugmentedEvent<ApiType, [u32]>; UnsignedPhaseStarted: AugmentedEvent<ApiType, [round: u32], { round: u32 }>;
/** /**
* Generic event * Generic event
**/ **/
@@ -366,7 +366,7 @@ declare module '@polkadot/api-base/types/events' {
/** /**
* New authority set has been applied. * New authority set has been applied.
**/ **/
NewAuthorities: AugmentedEvent<ApiType, [Vec<ITuple<[SpFinalityGrandpaAppPublic, u64]>>]>; NewAuthorities: AugmentedEvent<ApiType, [authoritySet: Vec<ITuple<[SpFinalityGrandpaAppPublic, u64]>>], { authoritySet: Vec<ITuple<[SpFinalityGrandpaAppPublic, u64]>> }>;
/** /**
* Current authority set has been paused. * Current authority set has been paused.
**/ **/
@@ -408,44 +408,44 @@ declare module '@polkadot/api-base/types/events' {
/** /**
* A name was cleared, and the given balance returned. * A name was cleared, and the given balance returned.
**/ **/
IdentityCleared: AugmentedEvent<ApiType, [AccountId32, u128]>; IdentityCleared: AugmentedEvent<ApiType, [who: AccountId32, deposit: u128], { who: AccountId32, deposit: u128 }>;
/** /**
* A name was removed and the given balance slashed. * A name was removed and the given balance slashed.
**/ **/
IdentityKilled: AugmentedEvent<ApiType, [AccountId32, u128]>; IdentityKilled: AugmentedEvent<ApiType, [who: AccountId32, deposit: u128], { who: AccountId32, deposit: u128 }>;
/** /**
* A name was set or reset (which will remove all judgements). * A name was set or reset (which will remove all judgements).
**/ **/
IdentitySet: AugmentedEvent<ApiType, [AccountId32]>; IdentitySet: AugmentedEvent<ApiType, [who: AccountId32], { who: AccountId32 }>;
/** /**
* A judgement was given by a registrar. * A judgement was given by a registrar.
**/ **/
JudgementGiven: AugmentedEvent<ApiType, [AccountId32, u32]>; JudgementGiven: AugmentedEvent<ApiType, [target: AccountId32, registrarIndex: u32], { target: AccountId32, registrarIndex: u32 }>;
/** /**
* A judgement was asked from a registrar. * A judgement was asked from a registrar.
**/ **/
JudgementRequested: AugmentedEvent<ApiType, [AccountId32, u32]>; JudgementRequested: AugmentedEvent<ApiType, [who: AccountId32, registrarIndex: u32], { who: AccountId32, registrarIndex: u32 }>;
/** /**
* A judgement request was retracted. * A judgement request was retracted.
**/ **/
JudgementUnrequested: AugmentedEvent<ApiType, [AccountId32, u32]>; JudgementUnrequested: AugmentedEvent<ApiType, [who: AccountId32, registrarIndex: u32], { who: AccountId32, registrarIndex: u32 }>;
/** /**
* A registrar was added. * A registrar was added.
**/ **/
RegistrarAdded: AugmentedEvent<ApiType, [u32]>; RegistrarAdded: AugmentedEvent<ApiType, [registrarIndex: u32], { registrarIndex: u32 }>;
/** /**
* A sub-identity was added to an identity and the deposit paid. * A sub-identity was added to an identity and the deposit paid.
**/ **/
SubIdentityAdded: AugmentedEvent<ApiType, [AccountId32, AccountId32, u128]>; SubIdentityAdded: AugmentedEvent<ApiType, [sub: AccountId32, main: AccountId32, deposit: u128], { sub: AccountId32, main: AccountId32, deposit: u128 }>;
/** /**
* A sub-identity was removed from an identity and the deposit freed. * A sub-identity was removed from an identity and the deposit freed.
**/ **/
SubIdentityRemoved: AugmentedEvent<ApiType, [AccountId32, AccountId32, u128]>; SubIdentityRemoved: AugmentedEvent<ApiType, [sub: AccountId32, main: AccountId32, deposit: u128], { sub: AccountId32, main: AccountId32, deposit: u128 }>;
/** /**
* A sub-identity was cleared, and the given deposit repatriated from the * A sub-identity was cleared, and the given deposit repatriated from the
* main identity account to the sub-identity account. * main identity account to the sub-identity account.
**/ **/
SubIdentityRevoked: AugmentedEvent<ApiType, [AccountId32, AccountId32, u128]>; SubIdentityRevoked: AugmentedEvent<ApiType, [sub: AccountId32, main: AccountId32, deposit: u128], { sub: AccountId32, main: AccountId32, deposit: u128 }>;
/** /**
* Generic event * Generic event
**/ **/
@@ -459,11 +459,11 @@ declare module '@polkadot/api-base/types/events' {
/** /**
* A new heartbeat was received from `AuthorityId`. * A new heartbeat was received from `AuthorityId`.
**/ **/
HeartbeatReceived: AugmentedEvent<ApiType, [PalletImOnlineSr25519AppSr25519Public]>; HeartbeatReceived: AugmentedEvent<ApiType, [authorityId: PalletImOnlineSr25519AppSr25519Public], { authorityId: PalletImOnlineSr25519AppSr25519Public }>;
/** /**
* At the end of the session, at least one validator was found to be offline. * At the end of the session, at least one validator was found to be offline.
**/ **/
SomeOffline: AugmentedEvent<ApiType, [Vec<ITuple<[AccountId32, PalletStakingExposure]>>]>; SomeOffline: AugmentedEvent<ApiType, [offline: Vec<ITuple<[AccountId32, PalletStakingExposure]>>], { offline: Vec<ITuple<[AccountId32, PalletStakingExposure]>> }>;
/** /**
* Generic event * Generic event
**/ **/
@@ -473,15 +473,15 @@ declare module '@polkadot/api-base/types/events' {
/** /**
* A account index was assigned. * A account index was assigned.
**/ **/
IndexAssigned: AugmentedEvent<ApiType, [AccountId32, u32]>; IndexAssigned: AugmentedEvent<ApiType, [who: AccountId32, index: u32], { who: AccountId32, index: u32 }>;
/** /**
* A account index has been freed up (unassigned). * A account index has been freed up (unassigned).
**/ **/
IndexFreed: AugmentedEvent<ApiType, [u32]>; IndexFreed: AugmentedEvent<ApiType, [index: u32], { index: u32 }>;
/** /**
* A account index has been frozen to its current account ID. * A account index has been frozen to its current account ID.
**/ **/
IndexFrozen: AugmentedEvent<ApiType, [u32, AccountId32]>; IndexFrozen: AugmentedEvent<ApiType, [index: u32, who: AccountId32], { index: u32, who: AccountId32 }>;
/** /**
* Generic event * Generic event
**/ **/
@@ -491,19 +491,19 @@ declare module '@polkadot/api-base/types/events' {
/** /**
* A multisig operation has been approved by someone. * A multisig operation has been approved by someone.
**/ **/
MultisigApproval: AugmentedEvent<ApiType, [AccountId32, PalletMultisigTimepoint, AccountId32, U8aFixed]>; MultisigApproval: AugmentedEvent<ApiType, [approving: AccountId32, timepoint: PalletMultisigTimepoint, multisig: AccountId32, callHash: U8aFixed], { approving: AccountId32, timepoint: PalletMultisigTimepoint, multisig: AccountId32, callHash: U8aFixed }>;
/** /**
* A multisig operation has been cancelled. * A multisig operation has been cancelled.
**/ **/
MultisigCancelled: AugmentedEvent<ApiType, [AccountId32, PalletMultisigTimepoint, AccountId32, U8aFixed]>; MultisigCancelled: AugmentedEvent<ApiType, [cancelling: AccountId32, timepoint: PalletMultisigTimepoint, multisig: AccountId32, callHash: U8aFixed], { cancelling: AccountId32, timepoint: PalletMultisigTimepoint, multisig: AccountId32, callHash: U8aFixed }>;
/** /**
* A multisig operation has been executed. * A multisig operation has been executed.
**/ **/
MultisigExecuted: AugmentedEvent<ApiType, [AccountId32, PalletMultisigTimepoint, AccountId32, U8aFixed, Result<Null, SpRuntimeDispatchError>]>; MultisigExecuted: AugmentedEvent<ApiType, [approving: AccountId32, timepoint: PalletMultisigTimepoint, multisig: AccountId32, callHash: U8aFixed, result: Result<Null, SpRuntimeDispatchError>], { approving: AccountId32, timepoint: PalletMultisigTimepoint, multisig: AccountId32, callHash: U8aFixed, result: Result<Null, SpRuntimeDispatchError> }>;
/** /**
* A new multisig operation has begun. * A new multisig operation has begun.
**/ **/
NewMultisig: AugmentedEvent<ApiType, [AccountId32, AccountId32, U8aFixed]>; NewMultisig: AugmentedEvent<ApiType, [approving: AccountId32, multisig: AccountId32, callHash: U8aFixed], { approving: AccountId32, multisig: AccountId32, callHash: U8aFixed }>;
/** /**
* Generic event * Generic event
**/ **/
@@ -515,7 +515,7 @@ declare module '@polkadot/api-base/types/events' {
* (kind-specific) time slot. This event is not deposited for duplicate slashes. * (kind-specific) time slot. This event is not deposited for duplicate slashes.
* \[kind, timeslot\]. * \[kind, timeslot\].
**/ **/
Offence: AugmentedEvent<ApiType, [U8aFixed, Bytes]>; Offence: AugmentedEvent<ApiType, [kind: U8aFixed, timeslot: Bytes], { kind: U8aFixed, timeslot: Bytes }>;
/** /**
* Generic event * Generic event
**/ **/
@@ -614,7 +614,7 @@ declare module '@polkadot/api-base/types/events' {
* *
* Note that old members and runners-up are also candidates. * Note that old members and runners-up are also candidates.
**/ **/
CandidateSlashed: AugmentedEvent<ApiType, [AccountId32, u128]>; CandidateSlashed: AugmentedEvent<ApiType, [candidate: AccountId32, amount: u128], { candidate: AccountId32, amount: u128 }>;
/** /**
* Internal error happened while trying to perform election. * Internal error happened while trying to perform election.
**/ **/
@@ -628,7 +628,7 @@ declare module '@polkadot/api-base/types/events' {
* A member has been removed. This should always be followed by either `NewTerm` or * A member has been removed. This should always be followed by either `NewTerm` or
* `EmptyTerm`. * `EmptyTerm`.
**/ **/
MemberKicked: AugmentedEvent<ApiType, [AccountId32]>; MemberKicked: AugmentedEvent<ApiType, [member: AccountId32], { member: AccountId32 }>;
/** /**
* A new term with new_members. This indicates that enough candidates existed to run * A new term with new_members. This indicates that enough candidates existed to run
* the election, not that enough have has been elected. The inner value must be examined * the election, not that enough have has been elected. The inner value must be examined
@@ -636,15 +636,15 @@ declare module '@polkadot/api-base/types/events' {
* slashed and none were elected, whilst `EmptyTerm` means that no candidates existed to * slashed and none were elected, whilst `EmptyTerm` means that no candidates existed to
* begin with. * begin with.
**/ **/
NewTerm: AugmentedEvent<ApiType, [Vec<ITuple<[AccountId32, u128]>>]>; NewTerm: AugmentedEvent<ApiType, [newMembers: Vec<ITuple<[AccountId32, u128]>>], { newMembers: Vec<ITuple<[AccountId32, u128]>> }>;
/** /**
* Someone has renounced their candidacy. * Someone has renounced their candidacy.
**/ **/
Renounced: AugmentedEvent<ApiType, [AccountId32]>; Renounced: AugmentedEvent<ApiType, [candidate: AccountId32], { candidate: AccountId32 }>;
/** /**
* A seat holder was slashed by amount by being forcefully removed from the set. * A seat holder was slashed by amount by being forcefully removed from the set.
**/ **/
SeatHolderSlashed: AugmentedEvent<ApiType, [AccountId32, u128]>; SeatHolderSlashed: AugmentedEvent<ApiType, [seatHolder: AccountId32, amount: u128], { seatHolder: AccountId32, amount: u128 }>;
/** /**
* Generic event * Generic event
**/ **/
@@ -654,15 +654,15 @@ declare module '@polkadot/api-base/types/events' {
/** /**
* A preimage has ben cleared. * A preimage has ben cleared.
**/ **/
Cleared: AugmentedEvent<ApiType, [H256]>; Cleared: AugmentedEvent<ApiType, [hash_: H256], { hash_: H256 }>;
/** /**
* A preimage has been noted. * A preimage has been noted.
**/ **/
Noted: AugmentedEvent<ApiType, [H256]>; Noted: AugmentedEvent<ApiType, [hash_: H256], { hash_: H256 }>;
/** /**
* A preimage has been requested. * A preimage has been requested.
**/ **/
Requested: AugmentedEvent<ApiType, [H256]>; Requested: AugmentedEvent<ApiType, [hash_: H256], { hash_: H256 }>;
/** /**
* Generic event * Generic event
**/ **/
@@ -672,33 +672,33 @@ declare module '@polkadot/api-base/types/events' {
/** /**
* An announcement was placed to make a call in the future. * An announcement was placed to make a call in the future.
**/ **/
Announced: AugmentedEvent<ApiType, [AccountId32, AccountId32, H256]>; Announced: AugmentedEvent<ApiType, [real: AccountId32, proxy: AccountId32, callHash: H256], { real: AccountId32, proxy: AccountId32, callHash: H256 }>;
/** /**
* Anonymous account has been created by new proxy with given * Anonymous account has been created by new proxy with given
* disambiguation index and proxy type. * disambiguation index and proxy type.
**/ **/
AnonymousCreated: AugmentedEvent<ApiType, [AccountId32, AccountId32, PolkadotRuntimeProxyType, u16]>; AnonymousCreated: AugmentedEvent<ApiType, [anonymous: AccountId32, who: AccountId32, proxyType: PolkadotRuntimeProxyType, disambiguationIndex: u16], { anonymous: AccountId32, who: AccountId32, proxyType: PolkadotRuntimeProxyType, disambiguationIndex: u16 }>;
/** /**
* A proxy was added. * A proxy was added.
**/ **/
ProxyAdded: AugmentedEvent<ApiType, [AccountId32, AccountId32, PolkadotRuntimeProxyType, u32]>; ProxyAdded: AugmentedEvent<ApiType, [delegator: AccountId32, delegatee: AccountId32, proxyType: PolkadotRuntimeProxyType, delay: u32], { delegator: AccountId32, delegatee: AccountId32, proxyType: PolkadotRuntimeProxyType, delay: u32 }>;
/** /**
* A proxy was executed correctly, with the given. * A proxy was executed correctly, with the given.
**/ **/
ProxyExecuted: AugmentedEvent<ApiType, [Result<Null, SpRuntimeDispatchError>]>; ProxyExecuted: AugmentedEvent<ApiType, [result: Result<Null, SpRuntimeDispatchError>], { result: Result<Null, SpRuntimeDispatchError> }>;
/** /**
* A proxy was removed. * A proxy was removed.
**/ **/
ProxyRemoved: AugmentedEvent<ApiType, [AccountId32, AccountId32, PolkadotRuntimeProxyType, u32]>; ProxyRemoved: AugmentedEvent<ApiType, [delegator: AccountId32, delegatee: AccountId32, proxyType: PolkadotRuntimeProxyType, delay: u32], { delegator: AccountId32, delegatee: AccountId32, proxyType: PolkadotRuntimeProxyType, delay: u32 }>;
/** /**
* Generic event * Generic event
**/ **/
[key: string]: AugmentedEvent<ApiType>; [key: string]: AugmentedEvent<ApiType>;
}; };
registrar: { registrar: {
Deregistered: AugmentedEvent<ApiType, [u32]>; Deregistered: AugmentedEvent<ApiType, [paraId: u32], { paraId: u32 }>;
Registered: AugmentedEvent<ApiType, [u32, AccountId32]>; Registered: AugmentedEvent<ApiType, [paraId: u32, manager: AccountId32], { paraId: u32, manager: AccountId32 }>;
Reserved: AugmentedEvent<ApiType, [u32, AccountId32]>; Reserved: AugmentedEvent<ApiType, [paraId: u32, who: AccountId32], { paraId: u32, who: AccountId32 }>;
/** /**
* Generic event * Generic event
**/ **/
@@ -708,19 +708,19 @@ declare module '@polkadot/api-base/types/events' {
/** /**
* The call for the provided hash was not found so the task has been aborted. * The call for the provided hash was not found so the task has been aborted.
**/ **/
CallLookupFailed: AugmentedEvent<ApiType, [ITuple<[u32, u32]>, Option<Bytes>, FrameSupportScheduleLookupError]>; CallLookupFailed: AugmentedEvent<ApiType, [task: ITuple<[u32, u32]>, id: Option<Bytes>, error: FrameSupportScheduleLookupError], { task: ITuple<[u32, u32]>, id: Option<Bytes>, error: FrameSupportScheduleLookupError }>;
/** /**
* Canceled some task. * Canceled some task.
**/ **/
Canceled: AugmentedEvent<ApiType, [u32, u32]>; Canceled: AugmentedEvent<ApiType, [when: u32, index: u32], { when: u32, index: u32 }>;
/** /**
* Dispatched some task. * Dispatched some task.
**/ **/
Dispatched: AugmentedEvent<ApiType, [ITuple<[u32, u32]>, Option<Bytes>, Result<Null, SpRuntimeDispatchError>]>; Dispatched: AugmentedEvent<ApiType, [task: ITuple<[u32, u32]>, id: Option<Bytes>, result: Result<Null, SpRuntimeDispatchError>], { task: ITuple<[u32, u32]>, id: Option<Bytes>, result: Result<Null, SpRuntimeDispatchError> }>;
/** /**
* Scheduled some task. * Scheduled some task.
**/ **/
Scheduled: AugmentedEvent<ApiType, [u32, u32]>; Scheduled: AugmentedEvent<ApiType, [when: u32, index: u32], { when: u32, index: u32 }>;
/** /**
* Generic event * Generic event
**/ **/
@@ -731,7 +731,7 @@ declare module '@polkadot/api-base/types/events' {
* New session has happened. Note that the argument is the session index, not the * New session has happened. Note that the argument is the session index, not the
* block number as the type might suggest. * block number as the type might suggest.
**/ **/
NewSession: AugmentedEvent<ApiType, [u32]>; NewSession: AugmentedEvent<ApiType, [sessionIndex: u32], { sessionIndex: u32 }>;
/** /**
* Generic event * Generic event
**/ **/
@@ -743,11 +743,11 @@ declare module '@polkadot/api-base/types/events' {
* First balance is any extra amount reserved on top of the para's existing deposit. * First balance is any extra amount reserved on top of the para's existing deposit.
* Second balance is the total amount reserved. * Second balance is the total amount reserved.
**/ **/
Leased: AugmentedEvent<ApiType, [u32, AccountId32, u32, u32, u128, u128]>; Leased: AugmentedEvent<ApiType, [paraId: u32, leaser: AccountId32, periodBegin: u32, periodCount: u32, extraReserved: u128, totalAmount: u128], { paraId: u32, leaser: AccountId32, periodBegin: u32, periodCount: u32, extraReserved: u128, totalAmount: u128 }>;
/** /**
* A new `[lease_period]` is beginning. * A new `[lease_period]` is beginning.
**/ **/
NewLeasePeriod: AugmentedEvent<ApiType, [u32]>; NewLeasePeriod: AugmentedEvent<ApiType, [leasePeriod: u32], { leasePeriod: u32 }>;
/** /**
* Generic event * Generic event
**/ **/
@@ -828,23 +828,23 @@ declare module '@polkadot/api-base/types/events' {
/** /**
* An extrinsic failed. * An extrinsic failed.
**/ **/
ExtrinsicFailed: AugmentedEvent<ApiType, [SpRuntimeDispatchError, FrameSupportWeightsDispatchInfo]>; ExtrinsicFailed: AugmentedEvent<ApiType, [dispatchError: SpRuntimeDispatchError, dispatchInfo: FrameSupportWeightsDispatchInfo], { dispatchError: SpRuntimeDispatchError, dispatchInfo: FrameSupportWeightsDispatchInfo }>;
/** /**
* An extrinsic completed successfully. * An extrinsic completed successfully.
**/ **/
ExtrinsicSuccess: AugmentedEvent<ApiType, [FrameSupportWeightsDispatchInfo]>; ExtrinsicSuccess: AugmentedEvent<ApiType, [dispatchInfo: FrameSupportWeightsDispatchInfo], { dispatchInfo: FrameSupportWeightsDispatchInfo }>;
/** /**
* An account was reaped. * An account was reaped.
**/ **/
KilledAccount: AugmentedEvent<ApiType, [AccountId32]>; KilledAccount: AugmentedEvent<ApiType, [account: AccountId32], { account: AccountId32 }>;
/** /**
* A new account was created. * A new account was created.
**/ **/
NewAccount: AugmentedEvent<ApiType, [AccountId32]>; NewAccount: AugmentedEvent<ApiType, [account: AccountId32], { account: AccountId32 }>;
/** /**
* On on-chain remark happened. * On on-chain remark happened.
**/ **/
Remarked: AugmentedEvent<ApiType, [AccountId32, H256]>; Remarked: AugmentedEvent<ApiType, [sender: AccountId32, hash_: H256], { sender: AccountId32, hash_: H256 }>;
/** /**
* Generic event * Generic event
**/ **/
@@ -854,33 +854,33 @@ declare module '@polkadot/api-base/types/events' {
/** /**
* A motion was approved by the required threshold. * A motion was approved by the required threshold.
**/ **/
Approved: AugmentedEvent<ApiType, [H256]>; Approved: AugmentedEvent<ApiType, [proposalHash: H256], { proposalHash: H256 }>;
/** /**
* A proposal was closed because its threshold was reached or after its duration was up. * A proposal was closed because its threshold was reached or after its duration was up.
**/ **/
Closed: AugmentedEvent<ApiType, [H256, u32, u32]>; Closed: AugmentedEvent<ApiType, [proposalHash: H256, yes: u32, no: u32], { proposalHash: H256, yes: u32, no: u32 }>;
/** /**
* A motion was not approved by the required threshold. * A motion was not approved by the required threshold.
**/ **/
Disapproved: AugmentedEvent<ApiType, [H256]>; Disapproved: AugmentedEvent<ApiType, [proposalHash: H256], { proposalHash: H256 }>;
/** /**
* A motion was executed; result will be `Ok` if it returned without error. * A motion was executed; result will be `Ok` if it returned without error.
**/ **/
Executed: AugmentedEvent<ApiType, [H256, Result<Null, SpRuntimeDispatchError>]>; Executed: AugmentedEvent<ApiType, [proposalHash: H256, result: Result<Null, SpRuntimeDispatchError>], { proposalHash: H256, result: Result<Null, SpRuntimeDispatchError> }>;
/** /**
* A single member did some action; result will be `Ok` if it returned without error. * A single member did some action; result will be `Ok` if it returned without error.
**/ **/
MemberExecuted: AugmentedEvent<ApiType, [H256, Result<Null, SpRuntimeDispatchError>]>; MemberExecuted: AugmentedEvent<ApiType, [proposalHash: H256, result: Result<Null, SpRuntimeDispatchError>], { proposalHash: H256, result: Result<Null, SpRuntimeDispatchError> }>;
/** /**
* A motion (given hash) has been proposed (by given account) with a threshold (given * A motion (given hash) has been proposed (by given account) with a threshold (given
* `MemberCount`). * `MemberCount`).
**/ **/
Proposed: AugmentedEvent<ApiType, [AccountId32, u32, H256, u32]>; Proposed: AugmentedEvent<ApiType, [account: AccountId32, proposalIndex: u32, proposalHash: H256, threshold: u32], { account: AccountId32, proposalIndex: u32, proposalHash: H256, threshold: u32 }>;
/** /**
* A motion (given hash) has been voted on by given account, leaving * A motion (given hash) has been voted on by given account, leaving
* a tally (yes votes and no votes given respectively as `MemberCount`). * a tally (yes votes and no votes given respectively as `MemberCount`).
**/ **/
Voted: AugmentedEvent<ApiType, [AccountId32, H256, bool, u32, u32]>; Voted: AugmentedEvent<ApiType, [account: AccountId32, proposalHash: H256, voted: bool, yes: u32, no: u32], { account: AccountId32, proposalHash: H256, voted: bool, yes: u32, no: u32 }>;
/** /**
* Generic event * Generic event
**/ **/
@@ -920,23 +920,23 @@ declare module '@polkadot/api-base/types/events' {
/** /**
* A new tip suggestion has been opened. * A new tip suggestion has been opened.
**/ **/
NewTip: AugmentedEvent<ApiType, [H256]>; NewTip: AugmentedEvent<ApiType, [tipHash: H256], { tipHash: H256 }>;
/** /**
* A tip suggestion has been closed. * A tip suggestion has been closed.
**/ **/
TipClosed: AugmentedEvent<ApiType, [H256, AccountId32, u128]>; TipClosed: AugmentedEvent<ApiType, [tipHash: H256, who: AccountId32, payout: u128], { tipHash: H256, who: AccountId32, payout: u128 }>;
/** /**
* A tip suggestion has reached threshold and is closing. * A tip suggestion has reached threshold and is closing.
**/ **/
TipClosing: AugmentedEvent<ApiType, [H256]>; TipClosing: AugmentedEvent<ApiType, [tipHash: H256], { tipHash: H256 }>;
/** /**
* A tip suggestion has been retracted. * A tip suggestion has been retracted.
**/ **/
TipRetracted: AugmentedEvent<ApiType, [H256]>; TipRetracted: AugmentedEvent<ApiType, [tipHash: H256], { tipHash: H256 }>;
/** /**
* A tip suggestion has been slashed. * A tip suggestion has been slashed.
**/ **/
TipSlashed: AugmentedEvent<ApiType, [H256, AccountId32, u128]>; TipSlashed: AugmentedEvent<ApiType, [tipHash: H256, finder: AccountId32, deposit: u128], { tipHash: H256, finder: AccountId32, deposit: u128 }>;
/** /**
* Generic event * Generic event
**/ **/
@@ -946,31 +946,31 @@ declare module '@polkadot/api-base/types/events' {
/** /**
* Some funds have been allocated. * Some funds have been allocated.
**/ **/
Awarded: AugmentedEvent<ApiType, [u32, u128, AccountId32]>; Awarded: AugmentedEvent<ApiType, [proposalIndex: u32, award: u128, account: AccountId32], { proposalIndex: u32, award: u128, account: AccountId32 }>;
/** /**
* Some of our funds have been burnt. * Some of our funds have been burnt.
**/ **/
Burnt: AugmentedEvent<ApiType, [u128]>; Burnt: AugmentedEvent<ApiType, [burntFunds: u128], { burntFunds: u128 }>;
/** /**
* Some funds have been deposited. * Some funds have been deposited.
**/ **/
Deposit: AugmentedEvent<ApiType, [u128]>; Deposit: AugmentedEvent<ApiType, [value: u128], { value: u128 }>;
/** /**
* New proposal. * New proposal.
**/ **/
Proposed: AugmentedEvent<ApiType, [u32]>; Proposed: AugmentedEvent<ApiType, [proposalIndex: u32], { proposalIndex: u32 }>;
/** /**
* A proposal was rejected; funds were slashed. * A proposal was rejected; funds were slashed.
**/ **/
Rejected: AugmentedEvent<ApiType, [u32, u128]>; Rejected: AugmentedEvent<ApiType, [proposalIndex: u32, slashed: u128], { proposalIndex: u32, slashed: u128 }>;
/** /**
* Spending has finished; this is the amount that rolls over until next spend. * Spending has finished; this is the amount that rolls over until next spend.
**/ **/
Rollover: AugmentedEvent<ApiType, [u128]>; Rollover: AugmentedEvent<ApiType, [rolloverBalance: u128], { rolloverBalance: u128 }>;
/** /**
* We have ended a spend period and will now allocate funds. * We have ended a spend period and will now allocate funds.
**/ **/
Spending: AugmentedEvent<ApiType, [u128]>; Spending: AugmentedEvent<ApiType, [budgetRemaining: u128], { budgetRemaining: u128 }>;
/** /**
* Generic event * Generic event
**/ **/
@@ -1036,11 +1036,11 @@ declare module '@polkadot/api-base/types/events' {
* Batch of dispatches did not complete fully. Index of first failing dispatch given, as * Batch of dispatches did not complete fully. Index of first failing dispatch given, as
* well as the error. * well as the error.
**/ **/
BatchInterrupted: AugmentedEvent<ApiType, [u32, SpRuntimeDispatchError]>; BatchInterrupted: AugmentedEvent<ApiType, [index: u32, error: SpRuntimeDispatchError], { index: u32, error: SpRuntimeDispatchError }>;
/** /**
* A call was dispatched. * A call was dispatched.
**/ **/
DispatchedAs: AugmentedEvent<ApiType, [Result<Null, SpRuntimeDispatchError>]>; DispatchedAs: AugmentedEvent<ApiType, [result: Result<Null, SpRuntimeDispatchError>], { result: Result<Null, SpRuntimeDispatchError> }>;
/** /**
* A single item within a Batch of dispatches has completed with no error. * A single item within a Batch of dispatches has completed with no error.
**/ **/
@@ -1048,7 +1048,7 @@ declare module '@polkadot/api-base/types/events' {
/** /**
* A single item within a Batch of dispatches has completed with error. * A single item within a Batch of dispatches has completed with error.
**/ **/
ItemFailed: AugmentedEvent<ApiType, [SpRuntimeDispatchError]>; ItemFailed: AugmentedEvent<ApiType, [error: SpRuntimeDispatchError], { error: SpRuntimeDispatchError }>;
/** /**
* Generic event * Generic event
**/ **/
@@ -1058,12 +1058,12 @@ declare module '@polkadot/api-base/types/events' {
/** /**
* An \[account\] has become fully vested. * An \[account\] has become fully vested.
**/ **/
VestingCompleted: AugmentedEvent<ApiType, [AccountId32]>; VestingCompleted: AugmentedEvent<ApiType, [account: AccountId32], { account: AccountId32 }>;
/** /**
* The amount vested has been updated. This could indicate a change in funds available. * The amount vested has been updated. This could indicate a change in funds available.
* The balance given is the amount which is left unvested (and thus locked). * The balance given is the amount which is left unvested (and thus locked).
**/ **/
VestingUpdated: AugmentedEvent<ApiType, [AccountId32, u128]>; VestingUpdated: AugmentedEvent<ApiType, [account: AccountId32, unvested: u128], { account: AccountId32, unvested: u128 }>;
/** /**
* Generic event * Generic event
**/ **/
@@ -1073,11 +1073,11 @@ declare module '@polkadot/api-base/types/events' {
/** /**
* Moved an account from one bag to another. * Moved an account from one bag to another.
**/ **/
Rebagged: AugmentedEvent<ApiType, [AccountId32, u64, u64]>; Rebagged: AugmentedEvent<ApiType, [who: AccountId32, from: u64, to: u64], { who: AccountId32, from: u64, to: u64 }>;
/** /**
* Updated the score of some account to the given amount. * Updated the score of some account to the given amount.
**/ **/
ScoreUpdated: AugmentedEvent<ApiType, [AccountId32, u64]>; ScoreUpdated: AugmentedEvent<ApiType, [who: AccountId32, newScore: u64], { who: AccountId32, newScore: u64 }>;
/** /**
* Generic event * Generic event
**/ **/
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -20,12 +20,12 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "8.7.1", "version": "8.8.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.18.3", "@babel/runtime": "^7.18.3",
"@polkadot/rpc-core": "8.7.1", "@polkadot/rpc-core": "8.8.1",
"@polkadot/types": "8.7.1", "@polkadot/types": "8.8.1",
"@polkadot/util": "^9.4.1", "@polkadot/util": "^9.4.1",
"rxjs": "^7.5.5" "rxjs": "^7.5.5"
} }
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev // Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/api-base', path: 'auto', type: 'auto', version: '8.7.1' }; export const packageInfo = { name: '@polkadot/api-base', path: 'auto', type: 'auto', version: '8.8.1' };
+2 -2
View File
@@ -16,8 +16,8 @@ export interface DecoratedEvents<ApiType extends ApiTypes> extends AugmentedEven
} }
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
export type AugmentedEvent<ApiType extends ApiTypes, T extends AnyTuple = AnyTuple> = IsEvent<T>; export type AugmentedEvent<ApiType extends ApiTypes, T extends AnyTuple = AnyTuple, N = unknown> = IsEvent<T, N>;
export interface ModuleEvents<ApiType extends ApiTypes> { export interface ModuleEvents<ApiType extends ApiTypes> {
[key: string]: AugmentedEvent<ApiType, AnyTuple>; [key: string]: AugmentedEvent<ApiType>;
} }
+6 -6
View File
@@ -20,20 +20,20 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "8.7.1", "version": "8.8.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.18.3", "@babel/runtime": "^7.18.3",
"@polkadot/api": "8.7.1", "@polkadot/api": "8.8.1",
"@polkadot/types": "8.7.1", "@polkadot/types": "8.8.1",
"@polkadot/types-codec": "8.7.1", "@polkadot/types-codec": "8.8.1",
"@polkadot/types-create": "8.7.1", "@polkadot/types-create": "8.8.1",
"@polkadot/util": "^9.4.1", "@polkadot/util": "^9.4.1",
"@polkadot/util-crypto": "^9.4.1", "@polkadot/util-crypto": "^9.4.1",
"rxjs": "^7.5.5" "rxjs": "^7.5.5"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/api-augment": "8.7.1", "@polkadot/api-augment": "8.8.1",
"@polkadot/keyring": "^9.4.1" "@polkadot/keyring": "^9.4.1"
} }
} }
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev // Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/api-contract', path: 'auto', type: 'auto', version: '8.7.1' }; export const packageInfo = { name: '@polkadot/api-contract', path: 'auto', type: 'auto', version: '8.8.1' };
+12 -12
View File
@@ -20,25 +20,25 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "8.7.1", "version": "8.8.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.18.3", "@babel/runtime": "^7.18.3",
"@polkadot/api": "8.7.1", "@polkadot/api": "8.8.1",
"@polkadot/api-augment": "8.7.1", "@polkadot/api-augment": "8.8.1",
"@polkadot/api-base": "8.7.1", "@polkadot/api-base": "8.8.1",
"@polkadot/rpc-core": "8.7.1", "@polkadot/rpc-core": "8.8.1",
"@polkadot/types": "8.7.1", "@polkadot/types": "8.8.1",
"@polkadot/types-codec": "8.7.1", "@polkadot/types-codec": "8.8.1",
"@polkadot/util": "^9.4.1", "@polkadot/util": "^9.4.1",
"@polkadot/util-crypto": "^9.4.1", "@polkadot/util-crypto": "^9.4.1",
"rxjs": "^7.5.5" "rxjs": "^7.5.5"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/api": "8.7.1", "@polkadot/api": "8.8.1",
"@polkadot/api-augment": "8.7.1", "@polkadot/api-augment": "8.8.1",
"@polkadot/rpc-augment": "8.7.1", "@polkadot/rpc-augment": "8.8.1",
"@polkadot/rpc-provider": "8.7.1", "@polkadot/rpc-provider": "8.8.1",
"@polkadot/types-support": "8.7.1" "@polkadot/types-support": "8.8.1"
} }
} }
+3 -3
View File
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs'; import type { Observable } from 'rxjs';
import type { Option } from '@polkadot/types'; import type { Option, u64 } from '@polkadot/types';
import type { PalletBagsListListBag } from '@polkadot/types/lookup'; import type { PalletBagsListListBag } from '@polkadot/types/lookup';
import type { BN } from '@polkadot/util'; import type { BN } from '@polkadot/util';
import type { DeriveApi } from '../types'; import type { DeriveApi } from '../types';
@@ -43,7 +43,7 @@ export function _getIds (instanceId: string, api: DeriveApi): (ids: (BN | number
const ids = _ids.map((id) => bnToBn(id)); const ids = _ids.map((id) => bnToBn(id));
return ids.length return ids.length
? api.query.listBags.multi<Option<PalletBagsListListBag>[]>(ids).pipe( ? (api.query.voterList || api.query.bagsList).listBags.multi<Option<PalletBagsListListBag>>(ids).pipe(
map((bags) => orderBags(ids, bags)) map((bags) => orderBags(ids, bags))
) )
: of([]); : of([]);
@@ -52,7 +52,7 @@ export function _getIds (instanceId: string, api: DeriveApi): (ids: (BN | number
export function all (instanceId: string, api: DeriveApi): () => Observable<Bag[]> { export function all (instanceId: string, api: DeriveApi): () => Observable<Bag[]> {
return memo(instanceId, (): Observable<Bag[]> => return memo(instanceId, (): Observable<Bag[]> =>
api.query.bagsList.listBags.keys().pipe( (api.query.voterList || api.query.bagsList).listBags.keys<[u64]>().pipe(
switchMap((keys) => switchMap((keys) =>
api.derive.bagsList._getIds(keys.map(({ args: [id] }) => id)) api.derive.bagsList._getIds(keys.map(({ args: [id] }) => id))
), ),
@@ -18,7 +18,7 @@ function traverseLinks (api: DeriveApi, head: AccountId32 | string): Observable<
return subject.pipe( return subject.pipe(
switchMap((account) => switchMap((account) =>
api.query.bagsList.listNodes(account) (api.query.voterList || api.query.bagsList).listNodes<Option<PalletBagsListListNode>>(account)
), ),
tap((node: Option<PalletBagsListListNode>): void => { tap((node: Option<PalletBagsListListNode>): void => {
nextTick((): void => { nextTick((): void => {
+3 -2
View File
@@ -23,8 +23,9 @@ export { lazyDeriveSection };
// Enable derive only if some of these modules are available // Enable derive only if some of these modules are available
const checks: Record<string, Avail> = { const checks: Record<string, Avail> = {
bagsList: { bagsList: {
instances: ['bagsList'], instances: ['voterList', 'bagsList'],
methods: [] methods: [],
withDetect: true
}, },
contracts: { contracts: {
instances: ['contracts'], instances: ['contracts'],
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev // Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/api-derive', path: 'auto', type: 'auto', version: '8.7.1' }; export const packageInfo = { name: '@polkadot/api-derive', path: 'auto', type: 'auto', version: '8.8.1' };
+14 -14
View File
@@ -20,29 +20,29 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "8.7.1", "version": "8.8.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.18.3", "@babel/runtime": "^7.18.3",
"@polkadot/api-augment": "8.7.1", "@polkadot/api-augment": "8.8.1",
"@polkadot/api-base": "8.7.1", "@polkadot/api-base": "8.8.1",
"@polkadot/api-derive": "8.7.1", "@polkadot/api-derive": "8.8.1",
"@polkadot/keyring": "^9.4.1", "@polkadot/keyring": "^9.4.1",
"@polkadot/rpc-augment": "8.7.1", "@polkadot/rpc-augment": "8.8.1",
"@polkadot/rpc-core": "8.7.1", "@polkadot/rpc-core": "8.8.1",
"@polkadot/rpc-provider": "8.7.1", "@polkadot/rpc-provider": "8.8.1",
"@polkadot/types": "8.7.1", "@polkadot/types": "8.8.1",
"@polkadot/types-augment": "8.7.1", "@polkadot/types-augment": "8.8.1",
"@polkadot/types-codec": "8.7.1", "@polkadot/types-codec": "8.8.1",
"@polkadot/types-create": "8.7.1", "@polkadot/types-create": "8.8.1",
"@polkadot/types-known": "8.7.1", "@polkadot/types-known": "8.8.1",
"@polkadot/util": "^9.4.1", "@polkadot/util": "^9.4.1",
"@polkadot/util-crypto": "^9.4.1", "@polkadot/util-crypto": "^9.4.1",
"eventemitter3": "^4.0.7", "eventemitter3": "^4.0.7",
"rxjs": "^7.5.5" "rxjs": "^7.5.5"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/api-augment": "8.7.1", "@polkadot/api-augment": "8.8.1",
"@polkadot/types-support": "8.7.1" "@polkadot/types-support": "8.8.1"
} }
} }
+58 -95
View File
@@ -19,7 +19,7 @@ import { getAvailableDerives } from '@polkadot/api-derive';
import { memo, RpcCore } from '@polkadot/rpc-core'; import { memo, RpcCore } from '@polkadot/rpc-core';
import { WsProvider } from '@polkadot/rpc-provider'; import { WsProvider } from '@polkadot/rpc-provider';
import { expandMetadata, Metadata, TypeRegistry, unwrapStorageType } from '@polkadot/types'; import { expandMetadata, Metadata, TypeRegistry, unwrapStorageType } from '@polkadot/types';
import { arrayChunk, arrayFlatten, assert, assertReturn, BN, BN_ZERO, compactStripLength, lazyMethod, lazyMethods, logger, nextTick, objectSpread, u8aToHex } from '@polkadot/util'; import { arrayChunk, arrayFlatten, assert, assertReturn, BN, compactStripLength, lazyMethod, lazyMethods, logger, nextTick, objectSpread, u8aToHex } from '@polkadot/util';
import { createSubmittable } from '../submittable'; import { createSubmittable } from '../submittable';
import { augmentObject } from '../util/augmentObject'; import { augmentObject } from '../util/augmentObject';
@@ -59,9 +59,9 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
#registry: Registry; #registry: Registry;
#storageGetQ: [[StorageEntry, ...unknown[]][], Observable<Codec[]>][] = []; #storageGetQ: [Observable<Codec[]>, [StorageEntry, unknown[]][]][] = [];
#storageSubQ: [[StorageEntry, ...unknown[]][], Observable<Codec[]>][] = []; #storageSubQ: [Observable<Codec[]>, [StorageEntry, unknown[]][]][] = [];
// HACK Use BN import so decorateDerive works... yes, wtf. // HACK Use BN import so decorateDerive works... yes, wtf.
protected __phantom = new BN(0); protected __phantom = new BN(0);
@@ -243,6 +243,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
decoratedApi.queryMulti = blockHash decoratedApi.queryMulti = blockHash
? this._decorateMultiAt(decoratedApi, this._decorateMethod, blockHash) ? this._decorateMultiAt(decoratedApi, this._decorateMethod, blockHash)
: this._decorateMulti(this._decorateMethod); : this._decorateMulti(this._decorateMethod);
decoratedApi.runtimeVersion = registry.runtimeVersion;
return { return {
decoratedApi, decoratedApi,
@@ -285,7 +286,7 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
* backwards compatible endpoint for metadata injection, may be removed in the future (However, it is still useful for testing injection) * backwards compatible endpoint for metadata injection, may be removed in the future (However, it is still useful for testing injection)
*/ */
public injectMetadata (metadata: Metadata, fromEmpty?: boolean, registry?: Registry): void { public injectMetadata (metadata: Metadata, fromEmpty?: boolean, registry?: Registry): void {
this._injectMetadata({ metadata, registry: registry || this.#registry, specName: this.#registry.createType('Text'), specVersion: BN_ZERO }, fromEmpty); this._injectMetadata({ metadata, registry: registry || this.#registry, runtimeVersion: this.#registry.createType('RuntimeVersionPartial') }, fromEmpty);
} }
private _decorateFunctionMeta (input: MetaDecoration, output: MetaDecoration): MetaDecoration { private _decorateFunctionMeta (input: MetaDecoration, output: MetaDecoration): MetaDecoration {
@@ -406,12 +407,11 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
// only be called if supportMulti is true // only be called if supportMulti is true
protected _decorateMulti<ApiType extends ApiTypes> (decorateMethod: DecorateMethod<ApiType>): QueryableStorageMulti<ApiType> { protected _decorateMulti<ApiType extends ApiTypes> (decorateMethod: DecorateMethod<ApiType>): QueryableStorageMulti<ApiType> {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return // eslint-disable-next-line @typescript-eslint/no-unsafe-return
return decorateMethod((keys: QueryableStorageMultiArg<ApiType>[]): Observable<Codec[]> => { return decorateMethod((keys: QueryableStorageMultiArg<ApiType>[]): Observable<Codec[]> =>
const query = this.hasSubscriptions (this.hasSubscriptions
? this._rpcCore.state.subscribeStorage ? this._rpcCore.state.subscribeStorage
: this._rpcCore.state.queryStorageAt; : this._rpcCore.state.queryStorageAt
)(keys.map((args: QueryableStorageMultiArg<ApiType>): [StorageEntry, ...unknown[]] =>
const calls = keys.map((args: QueryableStorageMultiArg<ApiType>): [StorageEntry, ...unknown[]] =>
Array.isArray(args) Array.isArray(args)
? args[0].creator.meta.type.isPlain ? args[0].creator.meta.type.isPlain
? [args[0].creator] ? [args[0].creator]
@@ -419,22 +419,8 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
? [args[0].creator, args.slice(1)] ? [args[0].creator, args.slice(1)]
: [args[0].creator, ...args.slice(1)] : [args[0].creator, ...args.slice(1)]
: [args.creator] : [args.creator]
); ))
);
// NOTE Skipping
//
// // with a smaller number of keys we combine this into a queue
// // along with other ongoing queries
// if (calls.length <= PAGE_SIZE_Q) {
// const queue = this.hasSubscriptions
// ? this.#storageSubQ
// : this.#storageGetQ;
// return this._queuedStorage(calls, queue, query);
// }
return query(calls);
});
} }
protected _decorateMultiAt<ApiType extends ApiTypes> (atApi: ApiDecoration<ApiType>, decorateMethod: DecorateMethod<ApiType>, blockHash: Uint8Array | string): QueryableStorageMulti<ApiType> { protected _decorateMultiAt<ApiType extends ApiTypes> (atApi: ApiDecoration<ApiType>, decorateMethod: DecorateMethod<ApiType>, blockHash: Uint8Array | string): QueryableStorageMulti<ApiType> {
@@ -655,62 +641,43 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
return this._decorateFunctionMeta(creator as unknown as MetaDecoration, decorated) as unknown as QueryableStorageEntry<ApiType>; return this._decorateFunctionMeta(creator as unknown as MetaDecoration, decorated) as unknown as QueryableStorageEntry<ApiType>;
} }
private _queuedStorage (calls: [StorageEntry, ...unknown[]][], queue: [[StorageEntry, ...unknown[]][], Observable<Codec[]>][], query: (calls: unknown[]) => Observable<Codec[]>): Observable<Codec[]> { private _queueStorage (call: [StorageEntry, unknown[]], queue: [Observable<Codec[]>, [StorageEntry, unknown[]][]][]): Observable<Codec> {
const count = calls.length; const query = queue === this.#storageSubQ
? this._rpcCore.state.subscribeStorage
: this._rpcCore.state.queryStorageAt;
let queueIdx = queue.length - 1; let queueIdx = queue.length - 1;
let valueIdx = 0;
let valueObs: Observable<Codec[]>;
if (queueIdx === -1 || !queue[queueIdx] || queue[queueIdx][0].length === PAGE_SIZE_Q || count >= PAGE_SIZE_Q) { if (queueIdx === -1 || !queue[queueIdx] || queue[queueIdx][1].length === PAGE_SIZE_Q) {
queueIdx++; queueIdx++;
queue.push([[], from( valueObs = from(
// Defer to the next tick - this aligns with nextTick in @polkadot/util, // Defer to the next tick - this aligns with nextTick in @polkadot/util,
// however since we return a value here, we don't re-use what is there // however since we return a value here, we don't re-use what is there
Promise Promise
.resolve() .resolve()
.then((): [StorageEntry, ...unknown[]][] => { .then((): [StorageEntry, unknown[]][] => {
const [calls] = queue[queueIdx]; const calls = queue[queueIdx][1];
delete queue[queueIdx]; delete queue[queueIdx];
return calls; return calls;
}) })
.catch(() => [])
).pipe( ).pipe(
switchMap((calls) => switchMap((calls) => query(calls))
query(calls) );
)
)]);
}
const valueIdx = queue[queueIdx][0].length; queue.push([valueObs, [call]]);
const valueObs = queue[queueIdx][1]; } else {
valueObs = queue[queueIdx][0];
valueIdx = queue[queueIdx][1].length;
for (let i = 0; i < count; i++) { queue[queueIdx][1].push(call);
queue[queueIdx][0].push(calls[i]);
} }
return valueObs.pipe( return valueObs.pipe(
map((values): Codec[] => { map((values) => values[valueIdx])
if (valueIdx === 0 && values.length === count) {
return values;
} else if (count === 1) {
return [values[valueIdx]];
}
const result = new Array<Codec>(count);
for (let i = 0; i < count; i++) {
result[i] = values[valueIdx + i];
}
return result;
})
);
}
private _queuedStorageSingle (call: [StorageEntry, ...unknown[]], queue: [[StorageEntry, ...unknown[]][], Observable<Codec[]>][], query: (calls: unknown[]) => Observable<Codec[]>): Observable<Codec> {
return this._queuedStorage([call], queue, query).pipe(
map(([first]) => first)
); );
} }
@@ -724,11 +691,11 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
return this._rpcCore.state.getStorage(call); return this._rpcCore.state.getStorage(call);
} }
return this._queuedStorageSingle(call, this.#storageSubQ, this._rpcCore.state.subscribeStorage); return this._queueStorage(call, this.#storageSubQ);
}, { }, {
methodName: creator.method, methodName: creator.method,
overrideNoSub: (...args: unknown[]) => overrideNoSub: (...args: unknown[]) =>
this._queuedStorageSingle(extractStorageArgs(this.#registry, creator, args), this.#storageGetQ, this._rpcCore.state.queryStorageAt) this._queueStorage(extractStorageArgs(this.#registry, creator, args), this.#storageGetQ)
}); });
} }
@@ -755,18 +722,6 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
? this._rpcCore.state.subscribeStorage ? this._rpcCore.state.subscribeStorage
: this._rpcCore.state.queryStorageAt; : this._rpcCore.state.queryStorageAt;
// NOTE Skipping
//
// // Where we have a limited number of multi keys, we combine
// // this query with others that precedes it (same tick)
// if (!blockHash && keys.length <= PAGE_SIZE_Q) {
// const queue = this.hasSubscriptions
// ? this.#storageSubQ
// : this.#storageGetQ;
// return this._queuedStorage(keys, queue, query);
// }
if (keys.length <= PAGE_SIZE_V) { if (keys.length <= PAGE_SIZE_V) {
return blockHash return blockHash
? query(keys, blockHash) ? query(keys, blockHash)
@@ -789,21 +744,23 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
const headKey = iterKey(...args).toHex(); const headKey = iterKey(...args).toHex();
const startSubject = new BehaviorSubject<string>(headKey); const startSubject = new BehaviorSubject<string>(headKey);
const getKeysPaged = at const query = at
? (startKey: string) => this._rpcCore.state.getKeysPaged(headKey, PAGE_SIZE_K, startKey, at) ? (startKey: string) =>
: (startKey: string) => this._rpcCore.state.getKeysPaged(headKey, PAGE_SIZE_K, startKey); this._rpcCore.state.getKeysPaged(headKey, PAGE_SIZE_K, startKey, at)
: (startKey: string) =>
this._rpcCore.state.getKeysPaged(headKey, PAGE_SIZE_K, startKey);
const setMeta = (key: StorageKey) => key.setMeta(meta, section, method); const setMeta = (key: StorageKey) => key.setMeta(meta, section, method);
return startSubject.pipe( return startSubject.pipe(
switchMap(getKeysPaged), switchMap(query),
map((keys) => keys.map(setMeta)), map((keys) => keys.map(setMeta)),
tap((keys): void => { tap((keys) =>
nextTick((): void => { nextTick((): void => {
keys.length === PAGE_SIZE_K keys.length === PAGE_SIZE_K
? startSubject.next(keys[PAGE_SIZE_K - 1].toHex()) ? startSubject.next(keys[PAGE_SIZE_K - 1].toHex())
: startSubject.complete(); : startSubject.complete();
}); })
}), ),
toArray(), // toArray since we want to startSubject to be completed toArray(), // toArray since we want to startSubject to be completed
map(arrayFlatten) map(arrayFlatten)
); );
@@ -813,24 +770,28 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
assert(iterKey && meta.type.isMap, 'keys can only be retrieved on maps'); assert(iterKey && meta.type.isMap, 'keys can only be retrieved on maps');
const setMeta = (key: StorageKey) => key.setMeta(meta, section, method); const setMeta = (key: StorageKey) => key.setMeta(meta, section, method);
const getKeysPaged = at const query = at
? (headKey: string) => this._rpcCore.state.getKeysPaged(headKey, opts.pageSize, opts.startKey || headKey, at) ? (headKey: string) =>
: (headKey: string) => this._rpcCore.state.getKeysPaged(headKey, opts.pageSize, opts.startKey || headKey); this._rpcCore.state.getKeysPaged(headKey, opts.pageSize, opts.startKey || headKey, at)
: (headKey: string) =>
this._rpcCore.state.getKeysPaged(headKey, opts.pageSize, opts.startKey || headKey);
return getKeysPaged(iterKey(...opts.args).toHex()).pipe( return query(iterKey(...opts.args).toHex()).pipe(
map((keys) => keys.map(setMeta)) map((keys) => keys.map(setMeta))
); );
} }
private _retrieveMapEntries (entry: StorageEntry, at: Hash | Uint8Array | string | null, args: unknown[]): Observable<[StorageKey, Codec][]> { private _retrieveMapEntries (entry: StorageEntry, at: Hash | Uint8Array | string | null, args: unknown[]): Observable<[StorageKey, Codec][]> {
const queryStorageAt = at const query = at
? (keys: StorageKey[]) => this._rpcCore.state.queryStorageAt(keys, at) ? (keys: StorageKey[]) =>
: (keys: StorageKey[]) => this._rpcCore.state.queryStorageAt(keys); this._rpcCore.state.queryStorageAt(keys, at)
: (keys: StorageKey[]) =>
this._rpcCore.state.queryStorageAt(keys);
return this._retrieveMapKeys(entry, at, args).pipe( return this._retrieveMapKeys(entry, at, args).pipe(
switchMap((keys) => switchMap((keys) =>
keys.length keys.length
? combineLatest(arrayChunk(keys, PAGE_SIZE_V).map(queryStorageAt)).pipe( ? combineLatest(arrayChunk(keys, PAGE_SIZE_V).map(query)).pipe(
map((valsArr) => map((valsArr) =>
arrayFlatten(valsArr).map((value, index): [StorageKey, Codec] => [keys[index], value]) arrayFlatten(valsArr).map((value, index): [StorageKey, Codec] => [keys[index], value])
) )
@@ -841,14 +802,16 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
} }
private _retrieveMapEntriesPaged (entry: StorageEntry, at: Hash | Uint8Array | string | undefined, opts: PaginationOptions): Observable<[StorageKey, Codec][]> { private _retrieveMapEntriesPaged (entry: StorageEntry, at: Hash | Uint8Array | string | undefined, opts: PaginationOptions): Observable<[StorageKey, Codec][]> {
const queryStorageAt = at const query = at
? (keys: StorageKey[]) => this._rpcCore.state.queryStorageAt(keys, at) ? (keys: StorageKey[]) =>
: (keys: StorageKey[]) => this._rpcCore.state.queryStorageAt(keys); this._rpcCore.state.queryStorageAt(keys, at)
: (keys: StorageKey[]) =>
this._rpcCore.state.queryStorageAt(keys);
return this._retrieveMapKeysPaged(entry, at, opts).pipe( return this._retrieveMapKeysPaged(entry, at, opts).pipe(
switchMap((keys) => switchMap((keys) =>
keys.length keys.length
? queryStorageAt(keys).pipe( ? query(keys).pipe(
map((valsArr) => map((valsArr) =>
valsArr.map((value, index): [StorageKey, Codec] => [keys[index], value]) valsArr.map((value, index): [StorageKey, Codec] => [keys[index], value])
) )
+5 -5
View File
@@ -129,7 +129,7 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
this._initRegistry(registry, this._runtimeChain as Text, version, metadata); this._initRegistry(registry, this._runtimeChain as Text, version, metadata);
// add our new registry // add our new registry
const result = { lastBlockHash: blockHash, metadata, registry, specName: version.specName, specVersion: version.specVersion }; const result = { lastBlockHash: blockHash, metadata, registry, runtimeVersion: version };
this.#registries.push(result); this.#registries.push(result);
@@ -162,7 +162,7 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
if (version) { if (version) {
// check for pre-existing registries. We also check specName, e.g. it // check for pre-existing registries. We also check specName, e.g. it
// could be changed like in Westmint with upgrade from shell -> westmint // could be changed like in Westmint with upgrade from shell -> westmint
const existingViaVersion = this.#registries.find(({ specName, specVersion }) => const existingViaVersion = this.#registries.find(({ runtimeVersion: { specName, specVersion } }) =>
specName.eq(version.specName) && specName.eq(version.specName) &&
specVersion.eq(version.specVersion) specVersion.eq(version.specVersion)
); );
@@ -289,7 +289,7 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
// setup the data as per the current versions // setup the data as per the current versions
thisRegistry.metadata = metadata; thisRegistry.metadata = metadata;
thisRegistry.specVersion = version.specVersion; thisRegistry.runtimeVersion = version;
this._initRegistry(this.registry, this._runtimeChain as Text, version, metadata); this._initRegistry(this.registry, this._runtimeChain as Text, version, metadata);
this._injectMetadata(thisRegistry, true); this._injectMetadata(thisRegistry, true);
@@ -333,7 +333,7 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
// setup the initial registry, when we have none // setup the initial registry, when we have none
if (!this.#registries.length) { if (!this.#registries.length) {
this.#registries.push({ isDefault: true, metadata, registry: this.registry, specName: runtimeVersion.specName, specVersion: runtimeVersion.specVersion }); this.#registries.push({ isDefault: true, metadata, registry: this.registry, runtimeVersion });
} }
// get unique types & validate // get unique types & validate
@@ -362,7 +362,7 @@ export abstract class Init<ApiType extends ApiTypes> extends Decorate<ApiType> {
// Only enable the health keepalive on WS, not needed on HTTP // Only enable the health keepalive on WS, not needed on HTTP
this.#healthTimer = this.hasSubscriptions this.#healthTimer = this.hasSubscriptions
? setInterval((): void => { ? setInterval((): void => {
firstValueFrom(this._rpcCore.system.health()).catch(() => undefined); firstValueFrom(this._rpcCore.system.health.raw()).catch(() => undefined);
}, KEEPALIVE_INTERVAL) }, KEEPALIVE_INTERVAL)
: null; : null;
} }
+3 -5
View File
@@ -1,11 +1,10 @@
// Copyright 2017-2022 @polkadot/api authors & contributors // Copyright 2017-2022 @polkadot/api authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import type { Metadata } from '@polkadot/types/metadata'; import type { Metadata } from '@polkadot/types';
import type { RuntimeVersionPartial } from '@polkadot/types/interfaces';
import type { DecoratedMeta } from '@polkadot/types/metadata/decorate/types'; import type { DecoratedMeta } from '@polkadot/types/metadata/decorate/types';
import type { Text } from '@polkadot/types/primitive';
import type { Registry } from '@polkadot/types/types'; import type { Registry } from '@polkadot/types/types';
import type { BN } from '@polkadot/util';
import type { ApiDecoration, ApiTypes } from '../types'; import type { ApiDecoration, ApiTypes } from '../types';
export interface VersionedRegistry<ApiType extends ApiTypes> { export interface VersionedRegistry<ApiType extends ApiTypes> {
@@ -15,6 +14,5 @@ export interface VersionedRegistry<ApiType extends ApiTypes> {
lastBlockHash?: Uint8Array | null; lastBlockHash?: Uint8Array | null;
metadata: Metadata; metadata: Metadata;
registry: Registry; registry: Registry;
specName: Text; runtimeVersion: RuntimeVersionPartial;
specVersion: BN;
} }
+23 -4
View File
@@ -57,14 +57,33 @@ function events (api: ApiPromise): void {
// existing // existing
if (api.events.balances.Transfer.is(event)) { if (api.events.balances.Transfer.is(event)) {
// the types are correctly expanded // the types are correctly expanded
const [from, to, amount] = event.data; const [afrom, ato, aamount] = event.data;
console.log(from.toHuman(), to.toHuman(), amount.toBn()); console.log(
afrom.toHuman(),
ato.toHuman(),
aamount.toBn()
);
// the types have getters
const { amount, from, to } = event.data;
console.log(
from.toHuman(),
to.toHuman(),
amount.toBn()
);
} }
// something random // something with only tuple data
if (api.events.staking.Bonded.is(event)) {
const [account, amount] = event.data;
console.log(account.toHuman(), amount.toBn());
}
// something random, just codec[]
if (api.events.something.Random.is(event)) { if (api.events.something.Random.is(event)) {
// the types are just codec
const [a, b] = event.data; const [a, b] = event.data;
console.log(a.toHuman(), b.toHuman()); console.log(a.toHuman(), b.toHuman());
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev // Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/api', path: 'auto', type: 'auto', version: '8.7.1' }; export const packageInfo = { name: '@polkadot/api', path: 'auto', type: 'auto', version: '8.8.1' };
+3 -1
View File
@@ -12,7 +12,7 @@ import type { AddressOrPair, SignerOptions, SubmittableDryRunResult, Submittable
import { catchError, first, map, mapTo, mergeMap, of, switchMap, tap } from 'rxjs'; import { catchError, first, map, mapTo, mergeMap, of, switchMap, tap } from 'rxjs';
import { assert, isBn, isFunction, isNumber, isString, isU8a, objectSpread } from '@polkadot/util'; import { assert, isBn, isFunction, isNumber, isString, isU8a, isUndefined, objectSpread } from '@polkadot/util';
import { ApiBase } from '../base'; import { ApiBase } from '../base';
import { filterEvents, isKeyringPair } from '../util'; import { filterEvents, isKeyringPair } from '../util';
@@ -34,6 +34,8 @@ const identity = <T> (input: T): T => input;
function makeEraOptions (api: ApiInterfaceRx, registry: Registry, partialOptions: Partial<SignerOptions>, { header, mortalLength, nonce }: { header: Header | null; mortalLength: number; nonce: Index }): SignatureOptions { function makeEraOptions (api: ApiInterfaceRx, registry: Registry, partialOptions: Partial<SignerOptions>, { header, mortalLength, nonce }: { header: Header | null; mortalLength: number; nonce: Index }): SignatureOptions {
if (!header) { if (!header) {
assert(partialOptions.era === 0 || !isUndefined(partialOptions.blockHash), 'Expected blockHash to be passed alongside non-immortal era options');
if (isNumber(partialOptions.era)) { if (isNumber(partialOptions.era)) {
// since we have no header, it is immortal, remove any option overrides // since we have no header, it is immortal, remove any option overrides
// so we only supply the genesisHash and no era to the construction // so we only supply the genesisHash and no era to the construction
+2 -1
View File
@@ -9,7 +9,7 @@ import type { DecoratedEvents } from '@polkadot/api-base/types/events';
import type { QueryableStorage } from '@polkadot/api-base/types/storage'; import type { QueryableStorage } from '@polkadot/api-base/types/storage';
import type { ProviderInterface, ProviderInterfaceEmitted } from '@polkadot/rpc-provider/types'; import type { ProviderInterface, ProviderInterfaceEmitted } from '@polkadot/rpc-provider/types';
import type { ExtDef } from '@polkadot/types/extrinsic/signedExtensions/types'; import type { ExtDef } from '@polkadot/types/extrinsic/signedExtensions/types';
import type { Call, Extrinsic, Hash } from '@polkadot/types/interfaces'; import type { Call, Extrinsic, Hash, RuntimeVersionPartial } from '@polkadot/types/interfaces';
import type { CallFunction, DefinitionRpc, DefinitionRpcSub, RegisteredTypes, Registry, RegistryError, SignatureOptions, Signer } from '@polkadot/types/types'; import type { CallFunction, DefinitionRpc, DefinitionRpcSub, RegisteredTypes, Registry, RegistryError, SignatureOptions, Signer } from '@polkadot/types/types';
import type { BN } from '@polkadot/util'; import type { BN } from '@polkadot/util';
import type { HexString } from '@polkadot/util/types'; import type { HexString } from '@polkadot/util/types';
@@ -95,6 +95,7 @@ export interface ApiDecoration<ApiType extends ApiTypes> {
events: DecoratedEvents<ApiType>; events: DecoratedEvents<ApiType>;
query: QueryableStorage<ApiType>; query: QueryableStorage<ApiType>;
registry: Registry; registry: Registry;
runtimeVersion: RuntimeVersionPartial;
rx: { rx: {
query: QueryableStorage<'rxjs'>; query: QueryableStorage<'rxjs'>;
}; };
+4 -4
View File
@@ -20,13 +20,13 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "8.7.1", "version": "8.8.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.18.3", "@babel/runtime": "^7.18.3",
"@polkadot/rpc-core": "8.7.1", "@polkadot/rpc-core": "8.8.1",
"@polkadot/types": "8.7.1", "@polkadot/types": "8.8.1",
"@polkadot/types-codec": "8.7.1", "@polkadot/types-codec": "8.8.1",
"@polkadot/util": "^9.4.1" "@polkadot/util": "^9.4.1"
} }
} }
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev // Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/rpc-augment', path: 'auto', type: 'auto', version: '8.7.1' }; export const packageInfo = { name: '@polkadot/rpc-augment', path: 'auto', type: 'auto', version: '8.8.1' };
+5 -5
View File
@@ -20,18 +20,18 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "8.7.1", "version": "8.8.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.18.3", "@babel/runtime": "^7.18.3",
"@polkadot/rpc-augment": "8.7.1", "@polkadot/rpc-augment": "8.8.1",
"@polkadot/rpc-provider": "8.7.1", "@polkadot/rpc-provider": "8.8.1",
"@polkadot/types": "8.7.1", "@polkadot/types": "8.8.1",
"@polkadot/util": "^9.4.1", "@polkadot/util": "^9.4.1",
"rxjs": "^7.5.5" "rxjs": "^7.5.5"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/keyring": "^9.4.1", "@polkadot/keyring": "^9.4.1",
"@polkadot/rpc-augment": "8.7.1" "@polkadot/rpc-augment": "8.8.1"
} }
} }
+5 -1
View File
@@ -42,7 +42,11 @@ const EMPTY_META = {
// utility method to create a nicely-formatted error // utility method to create a nicely-formatted error
/** @internal */ /** @internal */
function logErrorMessage (method: string, { params, type }: DefinitionRpc, error: Error): void { function logErrorMessage (method: string, { noErrorLog, params, type }: DefinitionRpc, error: Error): void {
if (noErrorLog) {
return;
}
const inputs = params.map(({ isOptional, name, type }): string => const inputs = params.map(({ isOptional, name, type }): string =>
`${name}${isOptional ? '?' : ''}: ${type}` `${name}${isOptional ? '?' : ''}: ${type}`
).join(', '); ).join(', ');
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev // Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/rpc-core', path: 'auto', type: 'auto', version: '8.7.1' }; export const packageInfo = { name: '@polkadot/rpc-core', path: 'auto', type: 'auto', version: '8.8.1' };
+4 -4
View File
@@ -20,13 +20,13 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "8.7.1", "version": "8.8.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.18.3", "@babel/runtime": "^7.18.3",
"@polkadot/keyring": "^9.4.1", "@polkadot/keyring": "^9.4.1",
"@polkadot/types": "8.7.1", "@polkadot/types": "8.8.1",
"@polkadot/types-support": "8.7.1", "@polkadot/types-support": "8.8.1",
"@polkadot/util": "^9.4.1", "@polkadot/util": "^9.4.1",
"@polkadot/util-crypto": "^9.4.1", "@polkadot/util-crypto": "^9.4.1",
"@polkadot/x-fetch": "^9.4.1", "@polkadot/x-fetch": "^9.4.1",
@@ -34,7 +34,7 @@
"@polkadot/x-ws": "^9.4.1", "@polkadot/x-ws": "^9.4.1",
"@substrate/connect": "0.7.5", "@substrate/connect": "0.7.5",
"eventemitter3": "^4.0.7", "eventemitter3": "^4.0.7",
"mock-socket": "^9.1.4", "mock-socket": "^9.1.5",
"nock": "^13.2.6" "nock": "^13.2.6"
} }
} }
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev // Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/rpc-provider', path: 'auto', type: 'auto', version: '8.7.1' }; export const packageInfo = { name: '@polkadot/rpc-provider', path: 'auto', type: 'auto', version: '8.8.1' };
+10 -10
View File
@@ -20,7 +20,7 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "8.7.1", "version": "8.8.1",
"main": "index.js", "main": "index.js",
"bin": { "bin": {
"polkadot-types-chain-info": "./scripts/polkadot-types-chain-info.cjs", "polkadot-types-chain-info": "./scripts/polkadot-types-chain-info.cjs",
@@ -33,15 +33,15 @@
"@babel/core": "^7.18.2", "@babel/core": "^7.18.2",
"@babel/register": "^7.17.7", "@babel/register": "^7.17.7",
"@babel/runtime": "^7.18.3", "@babel/runtime": "^7.18.3",
"@polkadot/api": "8.7.1", "@polkadot/api": "8.8.1",
"@polkadot/api-augment": "8.7.1", "@polkadot/api-augment": "8.8.1",
"@polkadot/rpc-augment": "8.7.1", "@polkadot/rpc-augment": "8.8.1",
"@polkadot/rpc-provider": "8.7.1", "@polkadot/rpc-provider": "8.8.1",
"@polkadot/types": "8.7.1", "@polkadot/types": "8.8.1",
"@polkadot/types-augment": "8.7.1", "@polkadot/types-augment": "8.8.1",
"@polkadot/types-codec": "8.7.1", "@polkadot/types-codec": "8.8.1",
"@polkadot/types-create": "8.7.1", "@polkadot/types-create": "8.8.1",
"@polkadot/types-support": "8.7.1", "@polkadot/types-support": "8.8.1",
"@polkadot/util": "^9.4.1", "@polkadot/util": "^9.4.1",
"@polkadot/x-ws": "^9.4.1", "@polkadot/x-ws": "^9.4.1",
"handlebars": "^4.7.7", "handlebars": "^4.7.7",
+9 -1
View File
@@ -16,6 +16,9 @@ import { compareName, createImports, formatType, initMeta, readTemplate, setImpo
const generateForMetaTemplate = Handlebars.compile(readTemplate('events')); const generateForMetaTemplate = Handlebars.compile(readTemplate('events'));
// For babel itself we need some extra aliasing
const ALIAS = ['symbol'];
/** @internal */ /** @internal */
function generateForMeta (meta: Metadata, dest: string, extraTypes: ExtraTypes, isStrict: boolean, customLookupDefinitions?: Definitions): void { function generateForMeta (meta: Metadata, dest: string, extraTypes: ExtraTypes, isStrict: boolean, customLookupDefinitions?: Definitions): void {
writeFile(dest, (): string => { writeFile(dest, (): string => {
@@ -42,13 +45,18 @@ function generateForMeta (meta: Metadata, dest: string, extraTypes: ExtraTypes,
const args = fields const args = fields
.map(({ type }) => lookup.getTypeDef(type)) .map(({ type }) => lookup.getTypeDef(type))
.map((typeDef) => typeDef.lookupName || formatType(registry, allDefs, typeDef, imports)); .map((typeDef) => typeDef.lookupName || formatType(registry, allDefs, typeDef, imports));
const names = fields
.map(({ name }) => registry.lookup.sanitizeField(name)[0])
.filter((n): n is string => !!n);
setImports(allDefs, imports, args); setImports(allDefs, imports, args);
return { return {
docs, docs,
name: name.toString(), name: name.toString(),
type: args.join(', ') type: names.length !== 0 && names.length === args.length
? `[${names.map((n, i) => `${ALIAS.includes(n) ? `${n}_` : n}: ${args[i]}`).join(', ')}], { ${names.map((n, i) => `${n}: ${args[i]}`).join(', ')} }`
: `[${args.join(', ')}]`
}; };
}) })
.sort(compareName), .sort(compareName),
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev // Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/typegen', path: 'auto', type: 'auto', version: '8.7.1' }; export const packageInfo = { name: '@polkadot/typegen', path: 'auto', type: 'auto', version: '8.8.1' };
+1 -1
View File
@@ -8,7 +8,7 @@ declare module '@polkadot/api-base/types/events' {
{{{name}}}: { {{{name}}}: {
{{#each items}} {{#each items}}
{{> docs}} {{> docs}}
{{{name}}}: AugmentedEvent<ApiType, [{{{type}}}]>; {{{name}}}: AugmentedEvent<ApiType, {{{type}}}>;
{{/each}} {{/each}}
{{#unless @root.isStrict}} {{#unless @root.isStrict}}
/** /**
+9 -2
View File
@@ -11,8 +11,14 @@ export async function getMetadataViaWs (endpoint: string): Promise<HexString> {
const websocket = new WebSocket(endpoint); const websocket = new WebSocket(endpoint);
websocket.onclose = (event: { code: number; reason: string }): void => { websocket.onclose = (event: { code: number; reason: string }): void => {
console.error(`disconnected, code: '${event.code}' reason: '${event.reason}'`); const msg = `disconnected, code: '${event.code}' reason: '${event.reason}'`;
process.exit(1);
if (event.code === 1000) {
console.log(msg);
} else {
console.error(msg);
process.exit(1);
}
}; };
websocket.onerror = (event: unknown): void => { websocket.onerror = (event: unknown): void => {
@@ -27,6 +33,7 @@ export async function getMetadataViaWs (endpoint: string): Promise<HexString> {
websocket.onmessage = (message: { data: string }): void => { websocket.onmessage = (message: { data: string }): void => {
resolve((JSON.parse(message.data) as { result: HexString }).result); resolve((JSON.parse(message.data) as { result: HexString }).result);
websocket.close();
}; };
} catch (error) { } catch (error) {
process.exit(1); process.exit(1);
+3 -3
View File
@@ -20,12 +20,12 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "8.7.1", "version": "8.8.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.18.3", "@babel/runtime": "^7.18.3",
"@polkadot/types": "8.7.1", "@polkadot/types": "8.8.1",
"@polkadot/types-codec": "8.7.1", "@polkadot/types-codec": "8.8.1",
"@polkadot/util": "^9.4.1" "@polkadot/util": "^9.4.1"
} }
} }
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev // Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/types-augment', path: 'auto', type: 'auto', version: '8.7.1' }; export const packageInfo = { name: '@polkadot/types-augment', path: 'auto', type: 'auto', version: '8.8.1' };
@@ -17,7 +17,7 @@ import type { PrefixedStorageKey } from '@polkadot/types/interfaces/childstate';
import type { StatementKind } from '@polkadot/types/interfaces/claims'; import type { StatementKind } from '@polkadot/types/interfaces/claims';
import type { CollectiveOrigin, MemberCount, ProposalIndex, Votes, VotesTo230 } from '@polkadot/types/interfaces/collective'; import type { CollectiveOrigin, MemberCount, ProposalIndex, Votes, VotesTo230 } from '@polkadot/types/interfaces/collective';
import type { AuthorityId, RawVRFOutput } from '@polkadot/types/interfaces/consensus'; import type { AuthorityId, RawVRFOutput } from '@polkadot/types/interfaces/consensus';
import type { AliveContractInfo, CodeHash, CodeSource, CodeUploadRequest, CodeUploadResult, CodeUploadResultValue, ContractCallFlags, ContractCallRequest, ContractExecResult, ContractExecResultErr, ContractExecResultErrModule, ContractExecResultOk, ContractExecResultResult, ContractExecResultSuccessTo255, ContractExecResultSuccessTo260, ContractExecResultTo255, ContractExecResultTo260, ContractExecResultTo267, ContractInfo, ContractInstantiateResult, ContractInstantiateResultTo267, ContractInstantiateResultTo299, ContractReturnFlags, ContractStorageKey, DeletedContract, ExecReturnValue, Gas, HostFnWeights, HostFnWeightsTo264, InstantiateRequest, InstantiateRequestV1, InstantiateRequestV2, InstantiateReturnValue, InstantiateReturnValueOk, InstantiateReturnValueTo267, InstructionWeights, Limits, LimitsTo264, PrefabWasmModule, RentProjection, Schedule, ScheduleTo212, ScheduleTo258, ScheduleTo264, SeedOf, StorageDeposit, TombstoneContractInfo, TrieId } from '@polkadot/types/interfaces/contracts'; import type { AliveContractInfo, CodeHash, CodeSource, CodeUploadRequest, CodeUploadResult, CodeUploadResultValue, ContractCallFlags, ContractCallRequest, ContractExecResult, ContractExecResultOk, ContractExecResultResult, ContractExecResultSuccessTo255, ContractExecResultSuccessTo260, ContractExecResultTo255, ContractExecResultTo260, ContractExecResultTo267, ContractInfo, ContractInstantiateResult, ContractInstantiateResultTo267, ContractInstantiateResultTo299, ContractReturnFlags, ContractStorageKey, DeletedContract, ExecReturnValue, Gas, HostFnWeights, HostFnWeightsTo264, InstantiateRequest, InstantiateRequestV1, InstantiateRequestV2, InstantiateReturnValue, InstantiateReturnValueOk, InstantiateReturnValueTo267, InstructionWeights, Limits, LimitsTo264, PrefabWasmModule, RentProjection, Schedule, ScheduleTo212, ScheduleTo258, ScheduleTo264, SeedOf, StorageDeposit, TombstoneContractInfo, TrieId } from '@polkadot/types/interfaces/contracts';
import type { ContractConstructorSpecLatest, ContractConstructorSpecV0, ContractConstructorSpecV1, ContractConstructorSpecV2, ContractConstructorSpecV3, ContractContractSpecV0, ContractContractSpecV1, ContractContractSpecV2, ContractContractSpecV3, ContractCryptoHasher, ContractDiscriminant, ContractDisplayName, ContractEventParamSpecLatest, ContractEventParamSpecV0, ContractEventParamSpecV2, ContractEventSpecLatest, ContractEventSpecV0, ContractEventSpecV1, ContractEventSpecV2, ContractLayoutArray, ContractLayoutCell, ContractLayoutEnum, ContractLayoutHash, ContractLayoutHashingStrategy, ContractLayoutKey, ContractLayoutStruct, ContractLayoutStructField, ContractMessageParamSpecLatest, ContractMessageParamSpecV0, ContractMessageParamSpecV2, ContractMessageSpecLatest, ContractMessageSpecV0, ContractMessageSpecV1, ContractMessageSpecV2, ContractMetadata, ContractMetadataLatest, ContractMetadataV0, ContractMetadataV1, ContractMetadataV2, ContractMetadataV3, ContractProject, ContractProjectContract, ContractProjectInfo, ContractProjectSource, ContractProjectV0, ContractSelector, ContractStorageLayout, ContractTypeSpec } from '@polkadot/types/interfaces/contractsAbi'; import type { ContractConstructorSpecLatest, ContractConstructorSpecV0, ContractConstructorSpecV1, ContractConstructorSpecV2, ContractConstructorSpecV3, ContractContractSpecV0, ContractContractSpecV1, ContractContractSpecV2, ContractContractSpecV3, ContractCryptoHasher, ContractDiscriminant, ContractDisplayName, ContractEventParamSpecLatest, ContractEventParamSpecV0, ContractEventParamSpecV2, ContractEventSpecLatest, ContractEventSpecV0, ContractEventSpecV1, ContractEventSpecV2, ContractLayoutArray, ContractLayoutCell, ContractLayoutEnum, ContractLayoutHash, ContractLayoutHashingStrategy, ContractLayoutKey, ContractLayoutStruct, ContractLayoutStructField, ContractMessageParamSpecLatest, ContractMessageParamSpecV0, ContractMessageParamSpecV2, ContractMessageSpecLatest, ContractMessageSpecV0, ContractMessageSpecV1, ContractMessageSpecV2, ContractMetadata, ContractMetadataLatest, ContractMetadataV0, ContractMetadataV1, ContractMetadataV2, ContractMetadataV3, ContractProject, ContractProjectContract, ContractProjectInfo, ContractProjectSource, ContractProjectV0, ContractSelector, ContractStorageLayout, ContractTypeSpec } from '@polkadot/types/interfaces/contractsAbi';
import type { FundIndex, FundInfo, LastContribution, TrieIndex } from '@polkadot/types/interfaces/crowdloan'; import type { FundIndex, FundInfo, LastContribution, TrieIndex } from '@polkadot/types/interfaces/crowdloan';
import type { ConfigData, MessageId, OverweightIndex, PageCounter, PageIndexData } from '@polkadot/types/interfaces/cumulus'; import type { ConfigData, MessageId, OverweightIndex, PageCounter, PageIndexData } from '@polkadot/types/interfaces/cumulus';
@@ -53,7 +53,7 @@ import type { Bid, BidKind, SocietyJudgement, SocietyVote, StrikeCount, Vouching
import type { ActiveEraInfo, CompactAssignments, CompactAssignmentsTo257, CompactAssignmentsTo265, CompactAssignmentsWith16, CompactAssignmentsWith24, CompactScore, CompactScoreCompact, ElectionCompute, ElectionPhase, ElectionResult, ElectionScore, ElectionSize, ElectionStatus, EraIndex, EraPoints, EraRewardPoints, EraRewards, Exposure, ExtendedBalance, Forcing, IndividualExposure, KeyType, MomentOf, Nominations, NominatorIndex, NominatorIndexCompact, OffchainAccuracy, OffchainAccuracyCompact, PhragmenScore, Points, RawSolution, RawSolutionTo265, RawSolutionWith16, RawSolutionWith24, ReadySolution, RewardDestination, RewardPoint, RoundSnapshot, SeatHolder, SignedSubmission, SignedSubmissionOf, SignedSubmissionTo276, SlashJournalEntry, SlashingSpans, SlashingSpansTo204, SolutionOrSnapshotSize, SolutionSupport, SolutionSupports, SpanIndex, SpanRecord, StakingLedger, StakingLedgerTo223, StakingLedgerTo240, SubmissionIndicesOf, Supports, UnappliedSlash, UnappliedSlashOther, UnlockChunk, ValidatorIndex, ValidatorIndexCompact, ValidatorPrefs, ValidatorPrefsTo145, ValidatorPrefsTo196, ValidatorPrefsWithBlocked, ValidatorPrefsWithCommission, VoteWeight, Voter } from '@polkadot/types/interfaces/staking'; import type { ActiveEraInfo, CompactAssignments, CompactAssignmentsTo257, CompactAssignmentsTo265, CompactAssignmentsWith16, CompactAssignmentsWith24, CompactScore, CompactScoreCompact, ElectionCompute, ElectionPhase, ElectionResult, ElectionScore, ElectionSize, ElectionStatus, EraIndex, EraPoints, EraRewardPoints, EraRewards, Exposure, ExtendedBalance, Forcing, IndividualExposure, KeyType, MomentOf, Nominations, NominatorIndex, NominatorIndexCompact, OffchainAccuracy, OffchainAccuracyCompact, PhragmenScore, Points, RawSolution, RawSolutionTo265, RawSolutionWith16, RawSolutionWith24, ReadySolution, RewardDestination, RewardPoint, RoundSnapshot, SeatHolder, SignedSubmission, SignedSubmissionOf, SignedSubmissionTo276, SlashJournalEntry, SlashingSpans, SlashingSpansTo204, SolutionOrSnapshotSize, SolutionSupport, SolutionSupports, SpanIndex, SpanRecord, StakingLedger, StakingLedgerTo223, StakingLedgerTo240, SubmissionIndicesOf, Supports, UnappliedSlash, UnappliedSlashOther, UnlockChunk, ValidatorIndex, ValidatorIndexCompact, ValidatorPrefs, ValidatorPrefsTo145, ValidatorPrefsTo196, ValidatorPrefsWithBlocked, ValidatorPrefsWithCommission, VoteWeight, Voter } from '@polkadot/types/interfaces/staking';
import type { ApiId, BlockTrace, BlockTraceEvent, BlockTraceEventData, BlockTraceSpan, KeyValueOption, MigrationStatusResult, ReadProof, RuntimeVersion, RuntimeVersionApi, RuntimeVersionPartial, SpecVersion, StorageChangeSet, TraceBlockResponse, TraceError } from '@polkadot/types/interfaces/state'; import type { ApiId, BlockTrace, BlockTraceEvent, BlockTraceEventData, BlockTraceSpan, KeyValueOption, MigrationStatusResult, ReadProof, RuntimeVersion, RuntimeVersionApi, RuntimeVersionPartial, SpecVersion, StorageChangeSet, TraceBlockResponse, TraceError } from '@polkadot/types/interfaces/state';
import type { WeightToFeeCoefficient } from '@polkadot/types/interfaces/support'; import type { WeightToFeeCoefficient } from '@polkadot/types/interfaces/support';
import type { AccountInfo, AccountInfoWithDualRefCount, AccountInfoWithProviders, AccountInfoWithRefCount, AccountInfoWithRefCountU8, AccountInfoWithTripleRefCount, ApplyExtrinsicResult, ArithmeticError, BlockLength, BlockWeights, ChainProperties, ChainType, ConsumedWeight, DigestOf, DispatchClass, DispatchError, DispatchErrorModule, DispatchErrorModuleU8a, DispatchErrorTo198, DispatchInfo, DispatchInfoTo190, DispatchInfoTo244, DispatchOutcome, DispatchResult, DispatchResultOf, DispatchResultTo198, Event, EventId, EventIndex, EventRecord, Health, InvalidTransaction, Key, LastRuntimeUpgradeInfo, NetworkState, NetworkStatePeerset, NetworkStatePeersetInfo, NodeRole, NotConnectedPeer, Peer, PeerEndpoint, PeerEndpointAddr, PeerInfo, PeerPing, PerDispatchClassU32, PerDispatchClassWeight, PerDispatchClassWeightsPerClass, Phase, RawOrigin, RefCount, RefCountTo259, SyncState, SystemOrigin, TokenError, TransactionValidityError, UnknownTransaction, WeightPerClass } from '@polkadot/types/interfaces/system'; import type { AccountInfo, AccountInfoWithDualRefCount, AccountInfoWithProviders, AccountInfoWithRefCount, AccountInfoWithRefCountU8, AccountInfoWithTripleRefCount, ApplyExtrinsicResult, ArithmeticError, BlockLength, BlockWeights, ChainProperties, ChainType, ConsumedWeight, DigestOf, DispatchClass, DispatchError, DispatchErrorModule, DispatchErrorModuleU8, DispatchErrorModuleU8a, DispatchErrorTo198, DispatchInfo, DispatchInfoTo190, DispatchInfoTo244, DispatchOutcome, DispatchResult, DispatchResultOf, DispatchResultTo198, Event, EventId, EventIndex, EventRecord, Health, InvalidTransaction, Key, LastRuntimeUpgradeInfo, NetworkState, NetworkStatePeerset, NetworkStatePeersetInfo, NodeRole, NotConnectedPeer, Peer, PeerEndpoint, PeerEndpointAddr, PeerInfo, PeerPing, PerDispatchClassU32, PerDispatchClassWeight, PerDispatchClassWeightsPerClass, Phase, RawOrigin, RefCount, RefCountTo259, SyncState, SystemOrigin, TokenError, TransactionValidityError, TransactionalError, UnknownTransaction, WeightPerClass } from '@polkadot/types/interfaces/system';
import type { Bounty, BountyIndex, BountyStatus, BountyStatusActive, BountyStatusCuratorProposed, BountyStatusPendingPayout, OpenTip, OpenTipFinderTo225, OpenTipTip, OpenTipTo225, TreasuryProposal } from '@polkadot/types/interfaces/treasury'; import type { Bounty, BountyIndex, BountyStatus, BountyStatusActive, BountyStatusCuratorProposed, BountyStatusPendingPayout, OpenTip, OpenTipFinderTo225, OpenTipTip, OpenTipTo225, TreasuryProposal } from '@polkadot/types/interfaces/treasury';
import type { Multiplier } from '@polkadot/types/interfaces/txpayment'; import type { Multiplier } from '@polkadot/types/interfaces/txpayment';
import type { ClassDetails, ClassId, ClassMetadata, DepositBalance, DepositBalanceOf, DestroyWitness, InstanceDetails, InstanceId, InstanceMetadata } from '@polkadot/types/interfaces/uniques'; import type { ClassDetails, ClassId, ClassMetadata, DepositBalance, DepositBalanceOf, DestroyWitness, InstanceDetails, InstanceId, InstanceMetadata } from '@polkadot/types/interfaces/uniques';
@@ -240,8 +240,6 @@ declare module '@polkadot/types/types/registry' {
ContractEventSpecV1: ContractEventSpecV1; ContractEventSpecV1: ContractEventSpecV1;
ContractEventSpecV2: ContractEventSpecV2; ContractEventSpecV2: ContractEventSpecV2;
ContractExecResult: ContractExecResult; ContractExecResult: ContractExecResult;
ContractExecResultErr: ContractExecResultErr;
ContractExecResultErrModule: ContractExecResultErrModule;
ContractExecResultOk: ContractExecResultOk; ContractExecResultOk: ContractExecResultOk;
ContractExecResultResult: ContractExecResultResult; ContractExecResultResult: ContractExecResultResult;
ContractExecResultSuccessTo255: ContractExecResultSuccessTo255; ContractExecResultSuccessTo255: ContractExecResultSuccessTo255;
@@ -307,6 +305,7 @@ declare module '@polkadot/types/types/registry' {
DispatchClass: DispatchClass; DispatchClass: DispatchClass;
DispatchError: DispatchError; DispatchError: DispatchError;
DispatchErrorModule: DispatchErrorModule; DispatchErrorModule: DispatchErrorModule;
DispatchErrorModuleU8: DispatchErrorModuleU8;
DispatchErrorModuleU8a: DispatchErrorModuleU8a; DispatchErrorModuleU8a: DispatchErrorModuleU8a;
DispatchErrorTo198: DispatchErrorTo198; DispatchErrorTo198: DispatchErrorTo198;
DispatchFeePayment: DispatchFeePayment; DispatchFeePayment: DispatchFeePayment;
@@ -994,6 +993,7 @@ declare module '@polkadot/types/types/registry' {
TombstoneContractInfo: TombstoneContractInfo; TombstoneContractInfo: TombstoneContractInfo;
TraceBlockResponse: TraceBlockResponse; TraceBlockResponse: TraceBlockResponse;
TraceError: TraceError; TraceError: TraceError;
TransactionalError: TransactionalError;
TransactionInfo: TransactionInfo; TransactionInfo: TransactionInfo;
TransactionPriority: TransactionPriority; TransactionPriority: TransactionPriority;
TransactionStorageProof: TransactionStorageProof; TransactionStorageProof: TransactionStorageProof;
+4 -4
View File
@@ -20,16 +20,16 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "8.7.1", "version": "8.8.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.18.3", "@babel/runtime": "^7.18.3",
"@polkadot/util": "^9.4.1" "@polkadot/util": "^9.4.1"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/types": "8.7.1", "@polkadot/types": "8.8.1",
"@polkadot/types-augment": "8.7.1", "@polkadot/types-augment": "8.8.1",
"@polkadot/types-support": "8.7.1", "@polkadot/types-support": "8.8.1",
"@polkadot/util-crypto": "^9.4.1" "@polkadot/util-crypto": "^9.4.1"
} }
} }
@@ -31,7 +31,7 @@ function decodeAbstractInt (value: Exclude<AnyNumber, Uint8Array>, isNegative: b
} else if (isHex(value, -1, true)) { } else if (isHex(value, -1, true)) {
return hexToBn(value, { isLe: false, isNegative }).toString(); return hexToBn(value, { isLe: false, isNegative }).toString();
} else if (isNumber(value)) { } else if (isNumber(value)) {
assert(value <= Number.MAX_SAFE_INTEGER && value >= Number.MIN_SAFE_INTEGER && Math.floor(value) === value, 'Number needs to be an integer <= Number.MAX_SAFE_INTEGER, i.e. 2 ^ 53 - 1'); assert(value <= Number.MAX_SAFE_INTEGER && value >= Number.MIN_SAFE_INTEGER && Number.isInteger(value), 'Number needs to be an integer <= Number.MAX_SAFE_INTEGER, i.e. 2 ^ 53 - 1');
} else if (isString(value)) { } else if (isString(value)) {
assert(!(value.includes('.') || value.includes(',') || value.includes('e')), 'String should not contain decimal points or scientific notation'); assert(!(value.includes('.') || value.includes(',') || value.includes('e')), 'String should not contain decimal points or scientific notation');
} }
@@ -43,6 +43,24 @@ describe('Option', (): void => {
}); });
}); });
it('can decode a nested Option', (): void => {
expect(
new Option(
registry,
Option.with(Option.with(Text)),
new Option(
registry,
Option.with(Text),
new Option(
registry,
Text,
new Uint8Array([1, 3 << 2, 66, 67, 68])
)
)
).toU8a()
).toEqual(new Uint8Array([1, 1, 1, 3 << 2, 66, 67, 68]));
});
it('can convert between different Some/None', (): void => { it('can convert between different Some/None', (): void => {
const def = '{ "foo":"Text", "zar":"Text" }'; const def = '{ "foo":"Text", "zar":"Text" }';
const none = new Option(registry, def, null); const none = new Option(registry, def, null);
+15 -8
View File
@@ -29,16 +29,23 @@ class None extends Null {
/** @internal */ /** @internal */
function decodeOption (registry: Registry, Type: CodecClass, value?: unknown): Codec { function decodeOption (registry: Registry, Type: CodecClass, value?: unknown): Codec {
// In the case of an option, unwrap the inner if (value instanceof Type) {
if (value instanceof Option) {
value = value.value;
}
if (isNull(value) || isUndefined(value) || value === '0x' || value instanceof None) {
return new None(registry);
} else if (value instanceof Type) {
// don't re-create, use as it (which also caters for derived types) // don't re-create, use as it (which also caters for derived types)
return value; return value;
} else if (value instanceof Option) {
if (value.value instanceof Type) {
// same instance, return it
return value.value;
} else if (value.isNone) {
// internal is None, we are also none
return new None(registry);
}
// convert the actual value into known
return new Type(registry, value.value);
} else if (isNull(value) || isUndefined(value) || value === '0x' || value instanceof None) {
// anyhting empty we pass as-is
return new None(registry);
} else if (isU8a(value)) { } else if (isU8a(value)) {
// the isU8a check happens last in the if-tree - since the wrapped value // the isU8a check happens last in the if-tree - since the wrapped value
// may be an instance of it, so Type and Option checks go in first // may be an instance of it, so Type and Option checks go in first
@@ -9,12 +9,7 @@ describe('Range', (): void => {
let range: Range<U32>; let range: Range<U32>;
beforeEach((): void => { beforeEach((): void => {
const Clazz = Range.with(U32); range = new (Range.with(U32))(registry, [1, 2]);
range = new Clazz(
registry,
[new U32(registry, 1), new U32(registry, 2)]
);
}); });
it('decodes', (): void => { it('decodes', (): void => {
+8 -7
View File
@@ -7,6 +7,10 @@ import { Tuple } from '../base/Tuple';
type RangeType = 'Range' | 'RangeInclusive'; type RangeType = 'Range' | 'RangeInclusive';
interface Options {
rangeName?: RangeType;
}
/** /**
* @name Range * @name Range
* @description * @description
@@ -15,19 +19,16 @@ type RangeType = 'Range' | 'RangeInclusive';
export class Range<T extends INumber> extends Tuple { export class Range<T extends INumber> extends Tuple {
#rangeName: RangeType; #rangeName: RangeType;
constructor (registry: Registry, Type: CodecClass<T> | string, value?: AnyTuple, rangeName: RangeType = 'Range') { constructor (registry: Registry, Type: CodecClass<T> | string, value?: AnyTuple, { rangeName = 'Range' }: Options = {}) {
super(registry, { super(registry, [Type, Type], value);
end: Type,
start: Type
}, value);
this.#rangeName = rangeName; this.#rangeName = rangeName;
} }
public static override with <T extends INumber> (Types: CodecClass<T> | string): CodecClass<Range<T>> { public static override with <T extends INumber> (Type: CodecClass<T> | string): CodecClass<Range<T>> {
return class extends Range<T> { return class extends Range<T> {
constructor (registry: Registry, value?: AnyTuple) { constructor (registry: Registry, value?: AnyTuple) {
super(registry, Types, value); super(registry, Type, value);
} }
}; };
} }
@@ -7,7 +7,7 @@ import { Range } from './Range';
export class RangeInclusive<T extends INumber = INumber> extends Range<T> { export class RangeInclusive<T extends INumber = INumber> extends Range<T> {
constructor (registry: Registry, Type: CodecClass<T> | string, value?: AnyTuple) { constructor (registry: Registry, Type: CodecClass<T> | string, value?: AnyTuple) {
super(registry, Type, value, 'RangeInclusive'); super(registry, Type, value, { rangeName: 'RangeInclusive' });
} }
public static override with <T extends INumber> (Type: CodecClass<T> | string): CodecClass<RangeInclusive<T>> { public static override with <T extends INumber> (Type: CodecClass<T> | string): CodecClass<RangeInclusive<T>> {
@@ -11,6 +11,10 @@ import { Bytes } from './Bytes';
type OpaqueName = 'WrapperKeepOpaque' | 'WrapperOpaque'; type OpaqueName = 'WrapperKeepOpaque' | 'WrapperOpaque';
interface Options {
opaqueName?: OpaqueName;
}
function decodeRaw<T extends Codec> (registry: Registry, typeName: CodecClass<T> | string, value?: unknown): [CodecClass<T>, T | null, AnyU8a] { function decodeRaw<T extends Codec> (registry: Registry, typeName: CodecClass<T> | string, value?: unknown): [CodecClass<T>, T | null, AnyU8a] {
const Type = typeToConstructor(registry, typeName); const Type = typeToConstructor(registry, typeName);
@@ -38,7 +42,7 @@ export class WrapperKeepOpaque<T extends Codec> extends Bytes {
readonly #opaqueName: OpaqueName; readonly #opaqueName: OpaqueName;
constructor (registry: Registry, typeName: CodecClass<T> | string, value?: unknown, opaqueName: OpaqueName = 'WrapperKeepOpaque') { constructor (registry: Registry, typeName: CodecClass<T> | string, value?: unknown, { opaqueName = 'WrapperKeepOpaque' }: Options = {}) {
const [Type, decoded, u8a] = decodeRaw(registry, typeName, value); const [Type, decoded, u8a] = decodeRaw(registry, typeName, value);
super(registry, u8a); super(registry, u8a);
@@ -7,7 +7,7 @@ import { WrapperKeepOpaque } from './WrapperKeepOpaque';
export class WrapperOpaque<T extends Codec> extends WrapperKeepOpaque<T> { export class WrapperOpaque<T extends Codec> extends WrapperKeepOpaque<T> {
constructor (registry: Registry, typeName: CodecClass<T> | string, value?: unknown) { constructor (registry: Registry, typeName: CodecClass<T> | string, value?: unknown) {
super(registry, typeName, value, 'WrapperOpaque'); super(registry, typeName, value, { opaqueName: 'WrapperOpaque' });
} }
public static override with<T extends Codec> (Type: CodecClass<T> | string): CodecClass<WrapperKeepOpaque<T>> { public static override with<T extends Codec> (Type: CodecClass<T> | string): CodecClass<WrapperKeepOpaque<T>> {
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev // Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/types-codec', path: 'auto', type: 'auto', version: '8.7.1' }; export const packageInfo = { name: '@polkadot/types-codec', path: 'auto', type: 'auto', version: '8.8.1' };
+3 -3
View File
@@ -20,14 +20,14 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "8.7.1", "version": "8.8.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.18.3", "@babel/runtime": "^7.18.3",
"@polkadot/types-codec": "8.7.1", "@polkadot/types-codec": "8.8.1",
"@polkadot/util": "^9.4.1" "@polkadot/util": "^9.4.1"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/types": "8.7.1" "@polkadot/types": "8.8.1"
} }
} }
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev // Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/types-create', path: 'auto', type: 'auto', version: '8.7.1' }; export const packageInfo = { name: '@polkadot/types-create', path: 'auto', type: 'auto', version: '8.8.1' };
@@ -1,6 +1,7 @@
// Copyright 2017-2022 @polkadot/types-create authors & contributors // Copyright 2017-2022 @polkadot/types-create authors & contributors
// SPDX-License-Identifier: Apache-2.0 // 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 } from '@polkadot/types-codec/types';
import type { TypeDef } from './types'; import type { TypeDef } from './types';
@@ -11,4 +12,5 @@ export interface ILookup {
} }
}, },
getTypeDef (lookupId: ICompact<INumber> | string | number): TypeDef; getTypeDef (lookupId: ICompact<INumber> | string | number): TypeDef;
sanitizeField (name: Option<Text>): [string | null, string | null];
} }
+4 -4
View File
@@ -20,14 +20,14 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "8.7.1", "version": "8.8.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.18.3", "@babel/runtime": "^7.18.3",
"@polkadot/networks": "^9.4.1", "@polkadot/networks": "^9.4.1",
"@polkadot/types": "8.7.1", "@polkadot/types": "8.8.1",
"@polkadot/types-codec": "8.7.1", "@polkadot/types-codec": "8.8.1",
"@polkadot/types-create": "8.7.1", "@polkadot/types-create": "8.8.1",
"@polkadot/util": "^9.4.1" "@polkadot/util": "^9.4.1"
} }
} }
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev // Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/types-known', path: 'auto', type: 'auto', version: '8.7.1' }; export const packageInfo = { name: '@polkadot/types-known', path: 'auto', type: 'auto', version: '8.8.1' };
@@ -10,7 +10,8 @@ const upgrades: ChainUpgradesRaw = [
[1205128, 18], [1603423, 23], [1733218, 24], [2005673, 25], [2436698, 26], [1205128, 18], [1603423, 23], [1733218, 24], [2005673, 25], [2436698, 26],
[3613564, 27], [3899547, 28], [4345767, 29], [4876134, 30], [5661442, 9050], [3613564, 27], [3899547, 28], [4345767, 29], [4876134, 30], [5661442, 9050],
[6321619, 9080], [6713249, 9090], [7217907, 9100], [7229126, 9110], [7560558, 9122], [6321619, 9080], [6713249, 9090], [7217907, 9100], [7229126, 9110], [7560558, 9122],
[8115869, 9140], [8638103, 9151], [9280179, 9170], [9738717, 9180], [10156856, 9190] [8115869, 9140], [8638103, 9151], [9280179, 9170], [9738717, 9180], [10156856, 9190],
[10458576, 9200], [10655116, 9220]
]; ];
export default upgrades; export default upgrades;
+1 -1
View File
@@ -14,7 +14,7 @@ const upgrades: ChainUpgradesRaw = [
[6379314, 9080], [6979141, 9090], [7568453, 9100], [7766394, 9111], [7911691, 9120], [6379314, 9080], [6979141, 9090], [7568453, 9100], [7766394, 9111], [7911691, 9120],
[7968866, 9121], [7982889, 9122], [8514322, 9130], [9091726, 9140], [9091774, 9150], [7968866, 9121], [7982889, 9122], [8514322, 9130], [9091726, 9140], [9091774, 9150],
[9406726, 9160], [9921066, 9170], [10007115, 9180], [10480973, 9190], [10578091, 9200], [9406726, 9160], [9921066, 9170], [10007115, 9180], [10480973, 9190], [10578091, 9200],
[10678509, 9210], [10811001, 9220] [10678509, 9210], [10811001, 9220], [11096116, 9230]
]; ];
export default upgrades; export default upgrades;
+1 -1
View File
@@ -20,7 +20,7 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "8.7.1", "version": "8.8.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.18.3", "@babel/runtime": "^7.18.3",
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev // Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/types-support', path: 'auto', type: 'auto', version: '8.7.1' }; export const packageInfo = { name: '@polkadot/types-support', path: 'auto', type: 'auto', version: '8.8.1' };
+5 -5
View File
@@ -20,20 +20,20 @@
"./detectPackage.cjs" "./detectPackage.cjs"
], ],
"type": "module", "type": "module",
"version": "8.7.1", "version": "8.8.1",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.18.3", "@babel/runtime": "^7.18.3",
"@polkadot/keyring": "^9.4.1", "@polkadot/keyring": "^9.4.1",
"@polkadot/types-augment": "8.7.1", "@polkadot/types-augment": "8.8.1",
"@polkadot/types-codec": "8.7.1", "@polkadot/types-codec": "8.8.1",
"@polkadot/types-create": "8.7.1", "@polkadot/types-create": "8.8.1",
"@polkadot/util": "^9.4.1", "@polkadot/util": "^9.4.1",
"@polkadot/util-crypto": "^9.4.1", "@polkadot/util-crypto": "^9.4.1",
"rxjs": "^7.5.5" "rxjs": "^7.5.5"
}, },
"devDependencies": { "devDependencies": {
"@polkadot/keyring": "^9.4.1", "@polkadot/keyring": "^9.4.1",
"@polkadot/types-support": "8.7.1" "@polkadot/types-support": "8.8.1"
} }
} }
+31 -2
View File
@@ -4,7 +4,7 @@
import type { Codec, CodecClass, IU8a } from '@polkadot/types-codec/types'; import type { Codec, CodecClass, IU8a } from '@polkadot/types-codec/types';
import type { CreateOptions, TypeDef } from '@polkadot/types-create/types'; import type { CreateOptions, TypeDef } from '@polkadot/types-create/types';
import type { ExtDef } from '../extrinsic/signedExtensions/types'; import type { ExtDef } from '../extrinsic/signedExtensions/types';
import type { ChainProperties, DispatchErrorModule, DispatchErrorModuleU8a, EventMetadataLatest, Hash, MetadataLatest, SiField, SiLookupTypeId, SiVariant } from '../interfaces/types'; import type { ChainProperties, DispatchErrorModule, DispatchErrorModuleU8, DispatchErrorModuleU8a, EventMetadataLatest, Hash, MetadataLatest, SiField, SiLookupTypeId, SiVariant } from '../interfaces/types';
import type { CallFunction, CodecHasher, Definitions, DetectCodec, RegisteredTypes, Registry, RegistryError, RegistryTypes } from '../types'; import type { CallFunction, CodecHasher, Definitions, DetectCodec, RegisteredTypes, Registry, RegistryError, RegistryTypes } from '../types';
import { DoNotConstruct, Json, Raw } from '@polkadot/types-codec'; import { DoNotConstruct, Json, Raw } from '@polkadot/types-codec';
@@ -22,8 +22,14 @@ import { Metadata } from '../metadata/Metadata';
import { PortableRegistry } from '../metadata/PortableRegistry'; import { PortableRegistry } from '../metadata/PortableRegistry';
import { lazyVariants } from './lazy'; import { lazyVariants } from './lazy';
const DEFAULT_FIRST_CALL_IDX = new Uint8Array(2);
const l = logger('registry'); const l = logger('registry');
function sortDecimalStrings (a: string, b: string): number {
return parseInt(a, 10) - parseInt(b, 10);
}
function valueToString (v: { toString: () => string }): string { function valueToString (v: { toString: () => string }): string {
return v.toString(); return v.toString();
} }
@@ -136,6 +142,8 @@ export class TypeRegistry implements Registry {
#definitions = new Map<string, string>(); #definitions = new Map<string, string>();
#firstCallIndex: Uint8Array | null = null;
#lookup?: PortableRegistry; #lookup?: PortableRegistry;
#metadata?: MetadataLatest; #metadata?: MetadataLatest;
@@ -211,6 +219,10 @@ export class TypeRegistry implements Registry {
return [formatBalance.getDefaults().unit]; return [formatBalance.getDefaults().unit];
} }
public get firstCallIndex (): Uint8Array {
return this.#firstCallIndex || DEFAULT_FIRST_CALL_IDX;
}
/** /**
* @description Returns true if the type is in a Compat format * @description Returns true if the type is in a Compat format
*/ */
@@ -288,7 +300,7 @@ export class TypeRegistry implements Registry {
} }
// finds an error // finds an error
public findMetaError (errorIndex: Uint8Array | DispatchErrorModule | DispatchErrorModuleU8a): RegistryError { public findMetaError (errorIndex: Uint8Array | DispatchErrorModule | DispatchErrorModuleU8 | DispatchErrorModuleU8a): RegistryError {
const [section, method] = isU8a(errorIndex) const [section, method] = isU8a(errorIndex)
? [errorIndex[0], errorIndex[1]] ? [errorIndex[0], errorIndex[1]]
: [ : [
@@ -503,6 +515,7 @@ export class TypeRegistry implements Registry {
public setMetadata (metadata: Metadata, signedExtensions?: string[], userExtensions?: ExtDef): void { public setMetadata (metadata: Metadata, signedExtensions?: string[], userExtensions?: ExtDef): void {
this.#metadata = metadata.asLatest; this.#metadata = metadata.asLatest;
this.#metadataVersion = metadata.version; this.#metadataVersion = metadata.version;
this.#firstCallIndex = null;
// attach the lookup at this point (before injecting) // attach the lookup at this point (before injecting)
this.setLookup(this.#metadata.lookup); this.setLookup(this.#metadata.lookup);
@@ -511,6 +524,22 @@ export class TypeRegistry implements Registry {
injectErrors(this, this.#metadata, this.#metadataVersion, this.#metadataErrors); injectErrors(this, this.#metadata, this.#metadataVersion, this.#metadataErrors);
injectEvents(this, this.#metadata, this.#metadataVersion, this.#metadataEvents); injectEvents(this, this.#metadata, this.#metadataVersion, this.#metadataEvents);
// set the default call index (the lowest section, the lowest method)
// in most chains this should be 0,0
const [defSection] = Object
.keys(this.#metadataCalls)
.sort(sortDecimalStrings);
if (defSection) {
const [defMethod] = Object
.keys(this.#metadataCalls[defSection])
.sort(sortDecimalStrings);
if (defMethod) {
this.#firstCallIndex = new Uint8Array([parseInt(defSection, 10), parseInt(defMethod, 10)]);
}
}
// setup the available extensions // setup the available extensions
this.setSignedExtensions( this.setSignedExtensions(
signedExtensions || ( signedExtensions || (
+22 -12
View File
@@ -188,26 +188,36 @@ export class MortalEra extends Tuple {
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
public override toU8a (isBare?: boolean): Uint8Array { public override toU8a (isBare?: boolean): Uint8Array {
const period = this.period.toNumber(); const period = this.period.toNumber();
const phase = this.phase.toNumber(); const encoded = Math.min(
const quantizeFactor = Math.max(period >> 12, 1); 15,
const trailingZeros = getTrailingZeros(period); Math.max(1, getTrailingZeros(period) - 1)
const encoded = Math.min(15, Math.max(1, trailingZeros - 1)) + (((phase / quantizeFactor) << 4)); ) + (
const first = encoded >> 8; (
const second = encoded & 0xff; this.phase.toNumber() / Math.max(period >> 12, 1)
) << 4
);
return new Uint8Array([second, first]); return new Uint8Array([
encoded & 0xff,
encoded >> 8
]);
} }
/** /**
* @description Get the block number of the start of the era whose properties this object describes that `current` belongs to. * @description Get the block number of the start of the era whose properties this object describes that `current` belongs to.
*/ */
public birth (current: BN | bigint | number | string): number { public birth (current: BN | bigint | number | string): number {
const phase = this.phase.toNumber();
const period = this.period.toNumber();
// FIXME No toNumber() here // FIXME No toNumber() here
return Math.floor( return (
( ~~(
Math.max(bnToBn(current).toNumber(), this.phase.toNumber()) - this.phase.toNumber() (
) / this.period.toNumber() Math.max(bnToBn(current).toNumber(), phase) - phase
) * this.period.toNumber() + this.phase.toNumber(); ) / period
) * period
) + phase;
} }
/** /**
+1 -1
View File
@@ -59,7 +59,7 @@ function decodeCallViaObject (registry: Registry, value: DecodedMethod, _meta?:
/** @internal */ /** @internal */
function decodeCallViaU8a (registry: Registry, value: Uint8Array, _meta?: FunctionMetadataLatest): DecodedMethod { function decodeCallViaU8a (registry: Registry, value: Uint8Array, _meta?: FunctionMetadataLatest): DecodedMethod {
// We need 2 bytes for the callIndex // We need 2 bytes for the callIndex
const callIndex = new Uint8Array(2); const callIndex = registry.firstCallIndex.slice();
callIndex.set(value.subarray(0, 2), 0); callIndex.set(value.subarray(0, 2), 0);
+38 -2
View File
@@ -8,7 +8,7 @@ import type { EventId } from '../interfaces/system';
import type { IEvent, IEventData, InterfaceTypes, Registry } from '../types'; import type { IEvent, IEventData, InterfaceTypes, Registry } from '../types';
import { Null, Struct, Tuple } from '@polkadot/types-codec'; import { Null, Struct, Tuple } from '@polkadot/types-codec';
import { objectSpread } from '@polkadot/util'; import { objectProperties, objectSpread } from '@polkadot/util';
interface Decoded { interface Decoded {
DataType: CodecClass<Null> | CodecClass<GenericEventData>; DataType: CodecClass<Null> | CodecClass<GenericEventData>;
@@ -45,6 +45,8 @@ export class GenericEventData extends Tuple implements IEventData {
readonly #method: string; readonly #method: string;
readonly #names: string[] | null = null;
readonly #section: string; readonly #section: string;
readonly #typeDef: TypeDef[]; readonly #typeDef: TypeDef[];
@@ -58,6 +60,16 @@ export class GenericEventData extends Tuple implements IEventData {
this.#method = method; this.#method = method;
this.#section = section; this.#section = section;
this.#typeDef = fields.map(({ type }) => registry.lookup.getTypeDef(type)); this.#typeDef = fields.map(({ type }) => registry.lookup.getTypeDef(type));
const names = fields
.map(({ name }) => registry.lookup.sanitizeField(name)[0])
.filter((n): n is string => !!n);
if (names.length === fields.length) {
this.#names = names;
objectProperties(this, names, (_, i) => this[i]);
}
} }
/** /**
@@ -74,6 +86,13 @@ export class GenericEventData extends Tuple implements IEventData {
return this.#method; return this.#method;
} }
/**
* @description The field names (as available)
*/
public get names (): string[] | null {
return this.#names;
}
/** /**
* @description The section as a string * @description The section as a string
*/ */
@@ -87,6 +106,23 @@ export class GenericEventData extends Tuple implements IEventData {
public get typeDef (): TypeDef[] { public get typeDef (): TypeDef[] {
return this.#typeDef; return this.#typeDef;
} }
/**
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
*/
public override toHuman (isExtended?: boolean): AnyJson {
if (this.#names !== null) {
const json: Record<string, AnyJson> = {};
for (let i = 0; i < this.#names.length; i++) {
json[this.#names[i]] = this[i].toHuman(isExtended);
}
return json;
}
return super.toHuman(isExtended);
}
} }
/** /**
@@ -111,7 +147,7 @@ export class GenericEvent extends Struct implements IEvent<Codec[]> {
/** /**
* @description The wrapped [[EventData]] * @description The wrapped [[EventData]]
*/ */
public get data (): GenericEventData { public get data (): IEvent<Codec[]>['data'] {
return this.getT('data'); return this.getT('data');
} }
@@ -34,12 +34,7 @@ export default {
code: 'Bytes', code: 'Bytes',
storageDepositLimit: 'Option<Balance>' storageDepositLimit: 'Option<Balance>'
}, },
CodeUploadResult: { CodeUploadResult: 'Result<CodeUploadResultValue, DispatchError>',
_enum: {
Ok: 'CodeUploadResultValue',
Err: 'Null'
}
},
CodeUploadResultValue: { CodeUploadResultValue: {
codeHash: 'CodeHash', codeHash: 'CodeHash',
deposit: 'Balance' deposit: 'Balance'
@@ -73,29 +68,11 @@ export default {
Error: 'Null' Error: 'Null'
} }
}, },
ContractExecResultErrModule: {
index: 'u8',
error: 'u8',
message: 'Option<Text>'
},
ContractExecResultErr: {
_enum: {
Other: 'Text',
CannotLookup: 'Null',
BadOrigin: 'Null',
Module: 'ContractExecResultErrModule'
}
},
ContractExecResultOk: { ContractExecResultOk: {
flags: 'ContractReturnFlags', flags: 'ContractReturnFlags',
data: 'Bytes' data: 'Bytes'
}, },
ContractExecResultResult: { ContractExecResultResult: 'Result<ContractExecResultOk, DispatchError>',
_enum: {
Ok: 'ContractExecResultOk',
Err: 'ContractExecResultErr'
}
},
ContractExecResultTo267: { ContractExecResultTo267: {
gasConsumed: 'u64', gasConsumed: 'u64',
debugMessage: 'Text', debugMessage: 'Text',
@@ -268,19 +245,8 @@ export default {
data: 'Bytes', data: 'Bytes',
salt: 'Bytes' salt: 'Bytes'
}, },
ContractInstantiateResultTo267: { ContractInstantiateResultTo267: 'Result<InstantiateReturnValueTo267, Null>',
_enum: { ContractInstantiateResultTo299: 'Result<InstantiateReturnValueOk, Null>',
Ok: 'InstantiateReturnValueTo267',
Err: 'Null'
}
},
ContractInstantiateResultTo299: {
_enum: {
Ok: 'InstantiateReturnValue',
Err: 'Null'
},
_fallback: 'ContractInstantiateResultTo267'
},
ContractInstantiateResult: { ContractInstantiateResult: {
_fallback: 'ContractInstantiateResultTo299', _fallback: 'ContractInstantiateResultTo299',
gasConsumed: 'u64', gasConsumed: 'u64',
@@ -298,12 +264,7 @@ export default {
result: 'ExecReturnValue', result: 'ExecReturnValue',
accountId: 'AccountId' accountId: 'AccountId'
}, },
InstantiateReturnValue: { InstantiateReturnValue: 'Result<InstantiateReturnValueOk, DispatchError>',
_enum: {
Ok: 'InstantiateReturnValueOk',
Err: 'DispatchError'
}
},
InstructionWeights: { InstructionWeights: {
i64const: 'u32', i64const: 'u32',
i64load: 'u32', i64load: 'u32',
@@ -1,7 +1,7 @@
// Auto-generated via `yarn polkadot-types-from-defs`, do not edit // Auto-generated via `yarn polkadot-types-from-defs`, do not edit
/* eslint-disable */ /* eslint-disable */
import type { Bytes, Compact, Enum, Null, Option, Raw, Set, Struct, Text, U8aFixed, bool, u32, u64, u8 } from '@polkadot/types-codec'; import type { Bytes, Compact, Enum, Null, Option, Raw, Result, Set, Struct, Text, U8aFixed, bool, u32, u64, u8 } from '@polkadot/types-codec';
import type { AccountId, Balance, BlockNumber, Hash, Weight } from '@polkadot/types/interfaces/runtime'; import type { AccountId, Balance, BlockNumber, Hash, Weight } from '@polkadot/types/interfaces/runtime';
import type { DispatchError } from '@polkadot/types/interfaces/system'; import type { DispatchError } from '@polkadot/types/interfaces/system';
@@ -38,11 +38,15 @@ export interface CodeUploadRequest extends Struct {
} }
/** @name CodeUploadResult */ /** @name CodeUploadResult */
export interface CodeUploadResult extends Enum { export interface CodeUploadResult extends Result<CodeUploadResultValue, DispatchError> {
readonly isErr: boolean;
readonly asErr: DispatchError;
/** @deprecated Use isErr */
readonly isError: boolean;
/** @deprecated Use asErr */
readonly asError: DispatchError;
readonly isOk: boolean; readonly isOk: boolean;
readonly asOk: CodeUploadResultValue; readonly asOk: CodeUploadResultValue;
readonly isErr: boolean;
readonly type: 'Ok' | 'Err';
} }
/** @name CodeUploadResultValue */ /** @name CodeUploadResultValue */
@@ -78,24 +82,6 @@ export interface ContractExecResult extends Struct {
readonly result: ContractExecResultResult; readonly result: ContractExecResultResult;
} }
/** @name ContractExecResultErr */
export interface ContractExecResultErr extends Enum {
readonly isOther: boolean;
readonly asOther: Text;
readonly isCannotLookup: boolean;
readonly isBadOrigin: boolean;
readonly isModule: boolean;
readonly asModule: ContractExecResultErrModule;
readonly type: 'Other' | 'CannotLookup' | 'BadOrigin' | 'Module';
}
/** @name ContractExecResultErrModule */
export interface ContractExecResultErrModule extends Struct {
readonly index: u8;
readonly error: u8;
readonly message: Option<Text>;
}
/** @name ContractExecResultOk */ /** @name ContractExecResultOk */
export interface ContractExecResultOk extends Struct { export interface ContractExecResultOk extends Struct {
readonly flags: ContractReturnFlags; readonly flags: ContractReturnFlags;
@@ -103,12 +89,15 @@ export interface ContractExecResultOk extends Struct {
} }
/** @name ContractExecResultResult */ /** @name ContractExecResultResult */
export interface ContractExecResultResult extends Enum { export interface ContractExecResultResult extends Result<ContractExecResultOk, DispatchError> {
readonly isErr: boolean;
readonly asErr: DispatchError;
/** @deprecated Use isErr */
readonly isError: boolean;
/** @deprecated Use asErr */
readonly asError: DispatchError;
readonly isOk: boolean; readonly isOk: boolean;
readonly asOk: ContractExecResultOk; readonly asOk: ContractExecResultOk;
readonly isErr: boolean;
readonly asErr: ContractExecResultErr;
readonly type: 'Ok' | 'Err';
} }
/** @name ContractExecResultSuccessTo255 */ /** @name ContractExecResultSuccessTo255 */
@@ -166,19 +155,21 @@ export interface ContractInstantiateResult extends Struct {
} }
/** @name ContractInstantiateResultTo267 */ /** @name ContractInstantiateResultTo267 */
export interface ContractInstantiateResultTo267 extends Enum { export interface ContractInstantiateResultTo267 extends Result<InstantiateReturnValueTo267, Null> {
readonly isErr: boolean;
/** @deprecated Use isErr */
readonly isError: boolean;
readonly isOk: boolean; readonly isOk: boolean;
readonly asOk: InstantiateReturnValueTo267; readonly asOk: InstantiateReturnValueTo267;
readonly isErr: boolean;
readonly type: 'Ok' | 'Err';
} }
/** @name ContractInstantiateResultTo299 */ /** @name ContractInstantiateResultTo299 */
export interface ContractInstantiateResultTo299 extends Enum { export interface ContractInstantiateResultTo299 extends Result<InstantiateReturnValueOk, Null> {
readonly isOk: boolean;
readonly asOk: InstantiateReturnValue;
readonly isErr: boolean; readonly isErr: boolean;
readonly type: 'Ok' | 'Err'; /** @deprecated Use isErr */
readonly isError: boolean;
readonly isOk: boolean;
readonly asOk: InstantiateReturnValueOk;
} }
/** @name ContractReturnFlags */ /** @name ContractReturnFlags */
@@ -342,12 +333,15 @@ export interface InstantiateRequestV2 extends Struct {
} }
/** @name InstantiateReturnValue */ /** @name InstantiateReturnValue */
export interface InstantiateReturnValue extends Enum { export interface InstantiateReturnValue extends Result<InstantiateReturnValueOk, DispatchError> {
readonly isOk: boolean;
readonly asOk: InstantiateReturnValueOk;
readonly isErr: boolean; readonly isErr: boolean;
readonly asErr: DispatchError; readonly asErr: DispatchError;
readonly type: 'Ok' | 'Err'; /** @deprecated Use isErr */
readonly isError: boolean;
/** @deprecated Use asErr */
readonly asError: DispatchError;
readonly isOk: boolean;
readonly asOk: InstantiateReturnValueOk;
} }
/** @name InstantiateReturnValueOk */ /** @name InstantiateReturnValueOk */
@@ -6,138 +6,10 @@
import type { Definitions } from '../../types'; import type { Definitions } from '../../types';
import { rpc } from './rpc';
export default { export default {
rpc: { rpc,
accountNextIndex: {
alias: ['account_nextIndex'],
description: 'Retrieves the next accountIndex as available on the node',
params: [
{
name: 'accountId',
type: 'AccountId'
}
],
type: 'Index'
},
dryRun: {
alias: ['system_dryRunAt'],
description: 'Dry run an extrinsic at a given block',
params: [
{
name: 'extrinsic',
type: 'Bytes'
},
{
name: 'at',
type: 'BlockHash',
isHistoric: true,
isOptional: true
}
],
type: 'ApplyExtrinsicResult'
},
name: {
description: 'Retrieves the node name',
params: [],
type: 'Text'
},
version: {
description: 'Retrieves the version of the node',
params: [],
type: 'Text'
},
chain: {
description: 'Retrieves the chain',
params: [],
type: 'Text'
},
chainType: {
description: 'Retrieves the chain type',
params: [],
type: 'ChainType'
},
properties: {
description: 'Get a custom set of properties as a JSON object, defined in the chain spec',
params: [],
type: 'ChainProperties'
},
health: {
description: 'Return health status of the node',
params: [],
type: 'Health'
},
localPeerId: {
description: 'Returns the base58-encoded PeerId of the node',
params: [],
type: 'Text'
},
localListenAddresses: {
description: 'The addresses include a trailing /p2p/ with the local PeerId, and are thus suitable to be passed to addReservedPeer or as a bootnode address for example',
params: [],
type: 'Vec<Text>'
},
peers: {
description: 'Returns the currently connected peers',
params: [],
type: 'Vec<PeerInfo>'
},
networkState: {
alias: ['system_unstable_networkState'],
description: 'Returns current state of the network',
params: [],
type: 'NetworkState'
},
addReservedPeer: {
description: 'Adds a reserved peer',
params: [
{
name: 'peer',
type: 'Text'
}
],
type: 'Text'
},
removeReservedPeer: {
description: 'Remove a reserved peer',
params: [
{
name: 'peerId',
type: 'Text'
}
],
type: 'Text'
},
reservedPeers: {
description: 'Returns the list of reserved peers',
params: [],
type: 'Vec<Text>'
},
nodeRoles: {
description: 'Returns the roles the node is running as',
params: [],
type: 'Vec<NodeRole>'
},
syncState: {
description: 'Returns the state of the syncing of the node',
params: [],
type: 'SyncState'
},
addLogFilter: {
description: 'Adds the supplied directives to the current log filter',
params: [
{
name: 'directives',
type: 'Text'
}
],
type: 'Null'
},
resetLogFilter: {
description: 'Resets the log filter to Substrate defaults',
params: [],
type: 'Null'
}
},
types: { types: {
AccountInfo: 'AccountInfoWithTripleRefCount', AccountInfo: 'AccountInfoWithTripleRefCount',
AccountInfoWithRefCountU8: { AccountInfoWithRefCountU8: {
@@ -206,11 +78,13 @@ export default {
Module: 'DispatchErrorModule', Module: 'DispatchErrorModule',
ConsumerRemaining: 'Null', ConsumerRemaining: 'Null',
NoProviders: 'Null', NoProviders: 'Null',
TooManyConsumers: 'Null',
Token: 'TokenError', Token: 'TokenError',
Arithmetic: 'ArithmeticError' Arithmetic: 'ArithmeticError',
Transactional: 'TransactionalError'
} }
}, },
DispatchErrorModule: { DispatchErrorModuleU8: {
index: 'u8', index: 'u8',
error: 'u8' error: 'u8'
}, },
@@ -218,6 +92,7 @@ export default {
index: 'u8', index: 'u8',
error: '[u8; 4]' error: '[u8; 4]'
}, },
DispatchErrorModule: 'DispatchErrorModuleU8a',
DispatchErrorTo198: { DispatchErrorTo198: {
module: 'Option<u8>', module: 'Option<u8>',
error: 'u8' error: 'u8'
@@ -378,6 +253,7 @@ export default {
'CannotCreate', 'CannotCreate',
'UnknownAsset', 'UnknownAsset',
'Frozen', 'Frozen',
'Unsupported',
// these are dropped, but still in older versions // these are dropped, but still in older versions
// (if this adjusts, will need to take a re-look) // (if this adjusts, will need to take a re-look)
'Underflow', 'Underflow',
@@ -390,6 +266,12 @@ export default {
Unknown: 'UnknownTransaction' Unknown: 'UnknownTransaction'
} }
}, },
TransactionalError: {
_enum: [
'LimitReached',
'NoLayer'
]
},
UnknownTransaction: { UnknownTransaction: {
_enum: { _enum: {
CannotLookup: 'Null', CannotLookup: 'Null',
+139
View File
@@ -0,0 +1,139 @@
// Copyright 2017-2022 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0
// As per frontier
import type { DefinitionsRpc } from '../../types';
export const rpc: DefinitionsRpc = {
accountNextIndex: {
alias: ['account_nextIndex'],
description: 'Retrieves the next accountIndex as available on the node',
params: [
{
name: 'accountId',
type: 'AccountId'
}
],
type: 'Index'
},
addLogFilter: {
description: 'Adds the supplied directives to the current log filter',
params: [
{
name: 'directives',
type: 'Text'
}
],
type: 'Null'
},
addReservedPeer: {
description: 'Adds a reserved peer',
params: [
{
name: 'peer',
type: 'Text'
}
],
type: 'Text'
},
chain: {
description: 'Retrieves the chain',
params: [],
type: 'Text'
},
chainType: {
description: 'Retrieves the chain type',
params: [],
type: 'ChainType'
},
dryRun: {
alias: ['system_dryRunAt'],
description: 'Dry run an extrinsic at a given block',
params: [
{
name: 'extrinsic',
type: 'Bytes'
},
{
isHistoric: true,
isOptional: true,
name: 'at',
type: 'BlockHash'
}
],
type: 'ApplyExtrinsicResult'
},
health: {
description: 'Return health status of the node',
noErrorLog: true,
params: [],
type: 'Health'
},
localListenAddresses: {
description: 'The addresses include a trailing /p2p/ with the local PeerId, and are thus suitable to be passed to addReservedPeer or as a bootnode address for example',
params: [],
type: 'Vec<Text>'
},
localPeerId: {
description: 'Returns the base58-encoded PeerId of the node',
params: [],
type: 'Text'
},
name: {
description: 'Retrieves the node name',
params: [],
type: 'Text'
},
networkState: {
alias: ['system_unstable_networkState'],
description: 'Returns current state of the network',
params: [],
type: 'NetworkState'
},
nodeRoles: {
description: 'Returns the roles the node is running as',
params: [],
type: 'Vec<NodeRole>'
},
peers: {
description: 'Returns the currently connected peers',
params: [],
type: 'Vec<PeerInfo>'
},
properties: {
description: 'Get a custom set of properties as a JSON object, defined in the chain spec',
params: [],
type: 'ChainProperties'
},
removeReservedPeer: {
description: 'Remove a reserved peer',
params: [
{
name: 'peerId',
type: 'Text'
}
],
type: 'Text'
},
reservedPeers: {
description: 'Returns the list of reserved peers',
params: [],
type: 'Vec<Text>'
},
resetLogFilter: {
description: 'Resets the log filter to Substrate defaults',
params: [],
type: 'Null'
},
syncState: {
description: 'Returns the state of the syncing of the node',
params: [],
type: 'SyncState'
},
version: {
description: 'Retrieves the version of the node',
params: [],
type: 'Text'
}
};
+17 -3
View File
@@ -112,15 +112,21 @@ export interface DispatchError extends Enum {
readonly asModule: DispatchErrorModule; readonly asModule: DispatchErrorModule;
readonly isConsumerRemaining: boolean; readonly isConsumerRemaining: boolean;
readonly isNoProviders: boolean; readonly isNoProviders: boolean;
readonly isTooManyConsumers: boolean;
readonly isToken: boolean; readonly isToken: boolean;
readonly asToken: TokenError; readonly asToken: TokenError;
readonly isArithmetic: boolean; readonly isArithmetic: boolean;
readonly asArithmetic: ArithmeticError; readonly asArithmetic: ArithmeticError;
readonly type: 'Other' | 'CannotLookup' | 'BadOrigin' | 'Module' | 'ConsumerRemaining' | 'NoProviders' | 'Token' | 'Arithmetic'; readonly isTransactional: boolean;
readonly asTransactional: TransactionalError;
readonly type: 'Other' | 'CannotLookup' | 'BadOrigin' | 'Module' | 'ConsumerRemaining' | 'NoProviders' | 'TooManyConsumers' | 'Token' | 'Arithmetic' | 'Transactional';
} }
/** @name DispatchErrorModule */ /** @name DispatchErrorModule */
export interface DispatchErrorModule extends Struct { export interface DispatchErrorModule extends DispatchErrorModuleU8a {}
/** @name DispatchErrorModuleU8 */
export interface DispatchErrorModuleU8 extends Struct {
readonly index: u8; readonly index: u8;
readonly error: u8; readonly error: u8;
} }
@@ -384,9 +390,17 @@ export interface TokenError extends Enum {
readonly isCannotCreate: boolean; readonly isCannotCreate: boolean;
readonly isUnknownAsset: boolean; readonly isUnknownAsset: boolean;
readonly isFrozen: boolean; readonly isFrozen: boolean;
readonly isUnsupported: boolean;
readonly isUnderflow: boolean; readonly isUnderflow: boolean;
readonly isOverflow: boolean; readonly isOverflow: boolean;
readonly type: 'NoFunds' | 'WouldDie' | 'BelowMinimum' | 'CannotCreate' | 'UnknownAsset' | 'Frozen' | 'Underflow' | 'Overflow'; readonly type: 'NoFunds' | 'WouldDie' | 'BelowMinimum' | 'CannotCreate' | 'UnknownAsset' | 'Frozen' | 'Unsupported' | 'Underflow' | 'Overflow';
}
/** @name TransactionalError */
export interface TransactionalError extends Enum {
readonly isLimitReached: boolean;
readonly isNoLayer: boolean;
readonly type: 'LimitReached' | 'NoLayer';
} }
/** @name TransactionValidityError */ /** @name TransactionValidityError */
@@ -1,7 +1,7 @@
// Copyright 2017-2022 @polkadot/types authors & contributors // Copyright 2017-2022 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import type { Text, Type, Vec } from '@polkadot/types-codec'; import type { Option, Text, Type, Vec } from '@polkadot/types-codec';
import type { Registry } from '@polkadot/types-codec/types'; import type { Registry } from '@polkadot/types-codec/types';
import type { ILookup, TypeDef } from '@polkadot/types-create/types'; import type { ILookup, TypeDef } from '@polkadot/types-create/types';
import type { PortableType } from '../../interfaces/metadata'; import type { PortableType } from '../../interfaces/metadata';
@@ -464,6 +464,25 @@ export class PortableRegistry extends Struct implements ILookup {
return this.#typeDefs[lookupIndex]; return this.#typeDefs[lookupIndex];
} }
public sanitizeField (name: Option<Text>): [string | null, string | null] {
let nameField: string | null = null;
let nameOrig: string | null = null;
if (name.isSome) {
nameField = stringCamelCase(name.unwrap());
if (nameField.includes('#')) {
nameOrig = nameField;
nameField = nameOrig.replace(/#/g, '_');
} else if (RESERVED.includes(nameField)) {
nameOrig = nameField;
nameField = `${nameField}_`;
}
}
return [nameField, nameOrig];
}
#createSiDef (lookupId: SiLookupTypeId): TypeDef { #createSiDef (lookupId: SiLookupTypeId): TypeDef {
const typeDef = this.getTypeDef(lookupId); const typeDef = this.getTypeDef(lookupId);
const lookupIndex = lookupId.toNumber(); const lookupIndex = lookupId.toNumber();
@@ -681,18 +700,9 @@ export class PortableRegistry extends Struct implements ILookup {
if (name.isNone) { if (name.isNone) {
sub[i] = typeDef; sub[i] = typeDef;
} else { } else {
let nameField = stringCamelCase(name.unwrap()); const [nameField, nameOrig] = this.sanitizeField(name);
let nameOrig: string | null = null;
if (nameField.includes('#')) { if (nameField && nameOrig) {
nameOrig = nameField;
nameField = nameOrig.replace(/#/g, '_');
} else if (RESERVED.includes(nameField)) {
nameOrig = nameField;
nameField = `${nameField}_`;
}
if (nameOrig) {
alias.set(nameField, nameOrig); alias.set(nameField, nameOrig);
} }
@@ -3,7 +3,7 @@
import type { Text, u8 } from '@polkadot/types-codec'; import type { Text, u8 } from '@polkadot/types-codec';
import type { Registry } from '@polkadot/types-codec/types'; import type { Registry } from '@polkadot/types-codec/types';
import type { DispatchErrorModule, DispatchErrorModuleU8a, MetadataLatest, SiField, SiVariant } from '../../../interfaces'; import type { DispatchErrorModule, DispatchErrorModuleU8, DispatchErrorModuleU8a, MetadataLatest, SiField, SiVariant } from '../../../interfaces';
import type { PortableRegistry } from '../../../metadata'; import type { PortableRegistry } from '../../../metadata';
import type { Errors, IsError } from '../types'; import type { Errors, IsError } from '../types';
@@ -40,7 +40,7 @@ export function decorateErrors (registry: Registry, { lookup, pallets }: Metadat
lazyMethod(result, stringCamelCase(name), () => lazyMethod(result, stringCamelCase(name), () =>
lazyVariants(lookup, errors.unwrap(), objectNameToString, (variant: SiVariant): IsError => ({ lazyVariants(lookup, errors.unwrap(), objectNameToString, (variant: SiVariant): IsError => ({
// We sprinkle in isCodec & isU8a to ensure we are dealing with the correct objects // We sprinkle in isCodec & isU8a to ensure we are dealing with the correct objects
is: (errorMod: DispatchErrorModule | DispatchErrorModuleU8a) => is: (errorMod: DispatchErrorModule | DispatchErrorModuleU8 | DispatchErrorModuleU8a) =>
isCodec(errorMod) && isCodec(errorMod) &&
isCodec(errorMod.index) && isCodec(errorMod.index) &&
errorMod.index.eq(sectionIndex) && ( errorMod.index.eq(sectionIndex) && (
@@ -3,7 +3,7 @@
import type { AnyTuple, Registry } from '@polkadot/types-codec/types'; import type { AnyTuple, Registry } from '@polkadot/types-codec/types';
import type { MetadataLatest, PalletMetadataLatest, SiVariant } from '../../../interfaces'; import type { MetadataLatest, PalletMetadataLatest, SiVariant } from '../../../interfaces';
import type { IEvent } from '../../../types'; import type { IEvent, IEventLike } from '../../../types';
import type { Events, IsEvent } from '../types'; import type { Events, IsEvent } from '../types';
import { isCodec, isU8a, lazyMethod, stringCamelCase } from '@polkadot/util'; import { isCodec, isU8a, lazyMethod, stringCamelCase } from '@polkadot/util';
@@ -28,7 +28,7 @@ export function decorateEvents (registry: Registry, { lookup, pallets }: Metadat
lazyMethod(result, stringCamelCase(name), () => lazyMethod(result, stringCamelCase(name), () =>
lazyVariants(lookup, events.unwrap(), objectNameToString, (variant: SiVariant): IsEvent<AnyTuple> => ({ lazyVariants(lookup, events.unwrap(), objectNameToString, (variant: SiVariant): IsEvent<AnyTuple> => ({
// We sprinkle in isCodec & isU8a to ensure we are dealing with the correct objects // We sprinkle in isCodec & isU8a to ensure we are dealing with the correct objects
is: <T extends AnyTuple> (eventRecord: IEvent<AnyTuple>): eventRecord is IEvent<T> => is: <T extends AnyTuple> (eventRecord: IEventLike): eventRecord is IEvent<T> =>
isCodec(eventRecord) && isCodec(eventRecord) &&
isU8a(eventRecord.index) && isU8a(eventRecord.index) &&
sectionIndex === eventRecord.index[0] && sectionIndex === eventRecord.index[0] &&
@@ -2,9 +2,9 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import type { AnyTuple, Codec, Registry } from '@polkadot/types-codec/types'; import type { AnyTuple, Codec, Registry } from '@polkadot/types-codec/types';
import type { DispatchErrorModule, DispatchErrorModuleU8a, ErrorMetadataLatest, EventMetadataLatest, PalletConstantMetadataLatest } from '../../interfaces'; import type { DispatchErrorModule, DispatchErrorModuleU8, DispatchErrorModuleU8a, ErrorMetadataLatest, EventMetadataLatest, PalletConstantMetadataLatest } from '../../interfaces';
import type { StorageEntry } from '../../primitive/types'; import type { StorageEntry } from '../../primitive/types';
import type { CallFunction, IEvent } from '../../types'; import type { CallFunction, IEvent, IEventLike } from '../../types';
export interface ConstantCodec extends Codec { export interface ConstantCodec extends Codec {
readonly meta: PalletConstantMetadataLatest; readonly meta: PalletConstantMetadataLatest;
@@ -13,13 +13,13 @@ export interface ConstantCodec extends Codec {
export interface IsError { export interface IsError {
readonly meta: ErrorMetadataLatest; readonly meta: ErrorMetadataLatest;
is: (moduleError: DispatchErrorModule | DispatchErrorModuleU8a) => boolean; is: (moduleError: DispatchErrorModule | DispatchErrorModuleU8 | DispatchErrorModuleU8a) => boolean;
} }
export interface IsEvent <T extends AnyTuple> { export interface IsEvent <T extends AnyTuple, N = unknown> {
readonly meta: EventMetadataLatest; readonly meta: EventMetadataLatest;
is: (event: IEvent<AnyTuple>) => event is IEvent<T>; is: (event: IEventLike) => event is IEvent<T, N>;
} }
export type ModuleConstants = Record<string, ConstantCodec>; export type ModuleConstants = Record<string, ConstantCodec>;
+1 -1
View File
@@ -3,4 +3,4 @@
// Do not edit, auto-generated by @polkadot/dev // Do not edit, auto-generated by @polkadot/dev
export const packageInfo = { name: '@polkadot/types', path: 'auto', type: 'auto', version: '8.7.1' }; export const packageInfo = { name: '@polkadot/types', path: 'auto', type: 'auto', version: '8.8.1' };
@@ -20,6 +20,7 @@ declare module '@polkadot/types-codec/types/registry' {
} }
export interface Registry { export interface Registry {
readonly firstCallIndex: Uint8Array;
readonly knownTypes: RegisteredTypes; readonly knownTypes: RegisteredTypes;
readonly metadata: MetadataLatest; readonly metadata: MetadataLatest;
readonly unknownTypes: string[]; readonly unknownTypes: string[];
+1
View File
@@ -29,6 +29,7 @@ export interface DefinitionRpc {
description: string; description: string;
endpoint?: string; endpoint?: string;
isSigned?: boolean; isSigned?: boolean;
noErrorLog?: boolean;
params: DefinitionRpcParam[]; params: DefinitionRpcParam[];
type: DefinitionTypeType; type: DefinitionTypeType;
} }
+16 -5
View File
@@ -1,25 +1,36 @@
// Copyright 2017-2022 @polkadot/types authors & contributors // Copyright 2017-2022 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
import type { Codec, ITuple } from '@polkadot/types-codec/types'; import type { Codec } from '@polkadot/types-codec/types';
import type { TypeDef } from '@polkadot/types-create/types';
import type { EventMetadataLatest } from '../interfaces/metadata'; import type { EventMetadataLatest } from '../interfaces/metadata';
import type { Hash } from '../interfaces/runtime'; import type { Hash } from '../interfaces/runtime';
import type { EventId, Phase } from '../interfaces/system'; import type { EventId, Phase } from '../interfaces/system';
export interface IEventRecord<T extends Codec[]> { export interface IEventRecord<T extends Codec[]> extends Codec {
readonly phase: Phase; readonly phase: Phase;
readonly event: IEvent<T>; readonly event: IEvent<T>;
readonly topics: Hash[]; readonly topics: Hash[];
} }
export interface IEventData { export interface IEventData extends Codec {
readonly meta: EventMetadataLatest; readonly meta: EventMetadataLatest;
readonly method: string; readonly method: string;
readonly names: string[] | null;
readonly section: string; readonly section: string;
readonly typeDef: TypeDef[];
} }
export interface IEvent<T extends Codec[]> { export interface IEventLike {
readonly data: ITuple<T> & IEventData; readonly index: unknown;
readonly method: unknown;
readonly section: unknown;
}
export interface IEvent<T extends Codec[], N = unknown> extends IEventLike, Codec {
readonly data: N extends Record<string, Codec>
? N & T & IEventData
: T & IEventData;
readonly index: EventId; readonly index: EventId;
readonly method: string; readonly method: string;
readonly section: string; readonly section: string;
+512 -510
View File
File diff suppressed because it is too large Load Diff