Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e23d44d3f5 | ||
|
|
0a444be04c | ||
|
|
1abb7085d6 | ||
|
|
bda5cda4bf | ||
|
|
fe7e313f21 | ||
|
|
31971b5d2c | ||
|
|
54efaa665d | ||
|
|
ddb435219d | ||
|
|
6ceb381ed0 | ||
|
|
6a82ab1efd | ||
|
|
8e3cef8dbc | ||
|
|
5fcfb1277d | ||
|
|
61ca15c143 | ||
|
|
0930a5e0dc | ||
|
|
03824f4600 | ||
|
|
1e785b50da | ||
|
|
daeb86a7af | ||
|
|
7461527448 | ||
|
|
322ac0861d | ||
|
|
52cd06917d | ||
|
|
767eb1fa15 | ||
|
|
60640b4c6c | ||
|
|
dfd45e866b | ||
|
|
dafa9ccc2c | ||
|
|
aeb76aea9a | ||
|
|
436e48aab2 | ||
|
|
0871458312 | ||
|
|
7edff67240 | ||
|
|
89a2ff2cda | ||
|
|
d0fbecb0c4 | ||
|
|
ed8802e605 | ||
|
|
791e76546a | ||
|
|
804b58139a | ||
|
|
ec746648c7 | ||
|
|
4cd8d5c60b | ||
|
|
df74330b67 | ||
|
|
ea36b6d486 | ||
|
|
a210a7314d | ||
|
|
2d5d8e6713 | ||
|
|
56a3d4ece8 | ||
|
|
3336f5530c | ||
|
|
f96b9c6d19 | ||
|
|
e7996e478a | ||
|
|
a695a486dd | ||
|
|
2a1ff7bb1e | ||
|
|
59b4e41cb6 | ||
|
|
194d65d31b | ||
|
|
10995b5696 | ||
|
|
73e717e665 | ||
|
|
f770f29422 | ||
|
|
a7ad18bd0c | ||
|
|
45d6c00816 | ||
|
|
4d02c78fe2 | ||
|
|
e73a347700 | ||
|
|
ea25189d2f | ||
|
|
99be561a88 | ||
|
|
871429b726 | ||
|
|
b041e7985c | ||
|
|
93ad99c5e9 | ||
|
|
3e41751130 | ||
|
|
697c25a541 | ||
|
|
05cf0cba8a | ||
|
|
d245bc69c9 | ||
|
|
c385ec2047 | ||
|
|
374e69f2fc | ||
|
|
12f2fbdaf5 | ||
|
|
e7e81c62c5 | ||
|
|
7e8f5f6bae | ||
|
|
90f7f375e6 | ||
|
|
e7beb2d46f | ||
|
|
a7a5a409d8 | ||
|
|
bd0b6426a7 | ||
|
|
06cb4aadfa | ||
|
|
f76efa5f8a | ||
|
|
cdc8d68e8b | ||
|
|
a208cc9bb5 |
+2
-1
@@ -53,4 +53,5 @@
|
|||||||
7.14.3
|
7.14.3
|
||||||
8.0.2
|
8.0.2
|
||||||
8.3.2
|
8.3.2
|
||||||
8.4.2
|
8.4.2
|
||||||
|
8.6.2
|
||||||
@@ -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
|
||||||
@@ -1,5 +1,46 @@
|
|||||||
# 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
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Add internal merge of single storage queries
|
||||||
|
- Expose provider stats on API intrerface via `.stats`
|
||||||
|
- Adjust flag extraction for latest phragmen types
|
||||||
|
- Support for `Range` in typegen for `Enum`
|
||||||
|
- Add Kusama 9220 upgrade block
|
||||||
|
|
||||||
|
|
||||||
|
## 8.6.2 May 30, 2022
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Don't apply default to `Option<bool>` opt-in
|
||||||
|
- Lower default historic LRU cache size (128 entries, 192MB est)
|
||||||
|
- Cater for updates required by TS 4.7.2
|
||||||
|
|
||||||
|
|
||||||
## 8.6.1 May 29, 2022
|
## 8.6.1 May 29, 2022
|
||||||
|
|
||||||
Changes:
|
Changes:
|
||||||
|
|||||||
+2
-1
@@ -1,4 +1,4 @@
|
|||||||
2982 Jaco 8.6.1 (#4870)
|
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)
|
||||||
|
|||||||
+4
-4
@@ -11,7 +11,7 @@
|
|||||||
},
|
},
|
||||||
"sideEffects": false,
|
"sideEffects": false,
|
||||||
"type": "commonjs",
|
"type": "commonjs",
|
||||||
"version": "8.6.1",
|
"version": "8.8.1",
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
"packages/*"
|
"packages/*"
|
||||||
],
|
],
|
||||||
@@ -34,12 +34,12 @@
|
|||||||
"@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.30",
|
"@polkadot/dev": "^0.66.37",
|
||||||
"@polkadot/typegen": "workspace:packages/typegen",
|
"@polkadot/typegen": "workspace:packages/typegen",
|
||||||
"@types/jest": "^27.5.1",
|
"@types/jest": "^28.1.1",
|
||||||
"copyfiles": "^2.4.1"
|
"copyfiles": "^2.4.1"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"typescript": "^4.6.4"
|
"typescript": "^4.7.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,18 +20,18 @@
|
|||||||
"./detectPackage.cjs"
|
"./detectPackage.cjs"
|
||||||
],
|
],
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "8.6.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.6.1",
|
"@polkadot/api-base": "8.8.1",
|
||||||
"@polkadot/rpc-augment": "8.6.1",
|
"@polkadot/rpc-augment": "8.8.1",
|
||||||
"@polkadot/types": "8.6.1",
|
"@polkadot/types": "8.8.1",
|
||||||
"@polkadot/types-augment": "8.6.1",
|
"@polkadot/types-augment": "8.8.1",
|
||||||
"@polkadot/types-codec": "8.6.1",
|
"@polkadot/types-codec": "8.8.1",
|
||||||
"@polkadot/util": "^9.3.1"
|
"@polkadot/util": "^9.4.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@polkadot/types-support": "8.6.1"
|
"@polkadot/types-support": "8.8.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -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.6.1' };
|
export const packageInfo = { name: '@polkadot/api-augment', path: 'auto', type: 'auto', version: '8.8.1' };
|
||||||
|
|||||||
@@ -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
@@ -20,13 +20,13 @@
|
|||||||
"./detectPackage.cjs"
|
"./detectPackage.cjs"
|
||||||
],
|
],
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "8.6.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.6.1",
|
"@polkadot/rpc-core": "8.8.1",
|
||||||
"@polkadot/types": "8.6.1",
|
"@polkadot/types": "8.8.1",
|
||||||
"@polkadot/util": "^9.3.1",
|
"@polkadot/util": "^9.4.1",
|
||||||
"rxjs": "^7.5.5"
|
"rxjs": "^7.5.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.6.1' };
|
export const packageInfo = { name: '@polkadot/api-base', path: 'auto', type: 'auto', version: '8.8.1' };
|
||||||
|
|||||||
@@ -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>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,20 +20,20 @@
|
|||||||
"./detectPackage.cjs"
|
"./detectPackage.cjs"
|
||||||
],
|
],
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "8.6.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.6.1",
|
"@polkadot/api": "8.8.1",
|
||||||
"@polkadot/types": "8.6.1",
|
"@polkadot/types": "8.8.1",
|
||||||
"@polkadot/types-codec": "8.6.1",
|
"@polkadot/types-codec": "8.8.1",
|
||||||
"@polkadot/types-create": "8.6.1",
|
"@polkadot/types-create": "8.8.1",
|
||||||
"@polkadot/util": "^9.3.1",
|
"@polkadot/util": "^9.4.1",
|
||||||
"@polkadot/util-crypto": "^9.3.1",
|
"@polkadot/util-crypto": "^9.4.1",
|
||||||
"rxjs": "^7.5.5"
|
"rxjs": "^7.5.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@polkadot/api-augment": "8.6.1",
|
"@polkadot/api-augment": "8.8.1",
|
||||||
"@polkadot/keyring": "^9.3.1"
|
"@polkadot/keyring": "^9.4.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.6.1' };
|
export const packageInfo = { name: '@polkadot/api-contract', path: 'auto', type: 'auto', version: '8.8.1' };
|
||||||
|
|||||||
@@ -20,25 +20,25 @@
|
|||||||
"./detectPackage.cjs"
|
"./detectPackage.cjs"
|
||||||
],
|
],
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "8.6.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.6.1",
|
"@polkadot/api": "8.8.1",
|
||||||
"@polkadot/api-augment": "8.6.1",
|
"@polkadot/api-augment": "8.8.1",
|
||||||
"@polkadot/api-base": "8.6.1",
|
"@polkadot/api-base": "8.8.1",
|
||||||
"@polkadot/rpc-core": "8.6.1",
|
"@polkadot/rpc-core": "8.8.1",
|
||||||
"@polkadot/types": "8.6.1",
|
"@polkadot/types": "8.8.1",
|
||||||
"@polkadot/types-codec": "8.6.1",
|
"@polkadot/types-codec": "8.8.1",
|
||||||
"@polkadot/util": "^9.3.1",
|
"@polkadot/util": "^9.4.1",
|
||||||
"@polkadot/util-crypto": "^9.3.1",
|
"@polkadot/util-crypto": "^9.4.1",
|
||||||
"rxjs": "^7.5.5"
|
"rxjs": "^7.5.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@polkadot/api": "8.6.1",
|
"@polkadot/api": "8.8.1",
|
||||||
"@polkadot/api-augment": "8.6.1",
|
"@polkadot/api-augment": "8.8.1",
|
||||||
"@polkadot/rpc-augment": "8.6.1",
|
"@polkadot/rpc-augment": "8.8.1",
|
||||||
"@polkadot/rpc-provider": "8.6.1",
|
"@polkadot/rpc-provider": "8.8.1",
|
||||||
"@polkadot/types-support": "8.6.1"
|
"@polkadot/types-support": "8.8.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,15 +3,19 @@
|
|||||||
|
|
||||||
import type { Observable } from 'rxjs';
|
import type { Observable } from 'rxjs';
|
||||||
import type { AccountId, Address, Balance } from '@polkadot/types/interfaces';
|
import type { AccountId, Address, Balance } from '@polkadot/types/interfaces';
|
||||||
|
import type{ PalletElectionsPhragmenSeatHolder } from '@polkadot/types/lookup';
|
||||||
|
import type { Codec } from '@polkadot/types/types';
|
||||||
import type { Option } from '@polkadot/types-codec';
|
import type { Option } from '@polkadot/types-codec';
|
||||||
import type { DeriveAccountFlags, DeriveApi } from '../types';
|
import type { DeriveAccountFlags, DeriveApi } from '../types';
|
||||||
|
|
||||||
import { combineLatest, map, of } from 'rxjs';
|
import { map, of } from 'rxjs';
|
||||||
|
|
||||||
|
import { isFunction } from '@polkadot/util';
|
||||||
|
|
||||||
import { memo } from '../util';
|
import { memo } from '../util';
|
||||||
|
|
||||||
type FlagsIntermediate = [
|
type FlagsIntermediate = [
|
||||||
[AccountId, Balance][] | undefined,
|
PalletElectionsPhragmenSeatHolder[] | [AccountId, Balance][] | undefined,
|
||||||
AccountId[],
|
AccountId[],
|
||||||
AccountId[],
|
AccountId[],
|
||||||
AccountId[],
|
AccountId[],
|
||||||
@@ -24,39 +28,53 @@ function parseFlags (address: AccountId | Address | string | null | undefined, [
|
|||||||
id.toString() === addrStr;
|
id.toString() === addrStr;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
isCouncil: (electionsMembers?.map(([id]) => id) || councilMembers || []).some(isIncluded),
|
isCouncil: (electionsMembers?.map((r) => Array.isArray(r) ? r[0] : r.who) || councilMembers || []).some(isIncluded),
|
||||||
isSociety: (societyMembers || []).some(isIncluded),
|
isSociety: (societyMembers || []).some(isIncluded),
|
||||||
isSudo: sudoKey?.toString() === addrStr,
|
isSudo: sudoKey?.toString() === addrStr,
|
||||||
isTechCommittee: (technicalCommitteeMembers || []).some(isIncluded)
|
isTechCommittee: (technicalCommitteeMembers || []).some(isIncluded)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function _flags (instanceId: string, api: DeriveApi): () => Observable<FlagsIntermediate> {
|
||||||
|
return memo(instanceId, (): Observable<FlagsIntermediate> => {
|
||||||
|
const results: unknown[] = [undefined, [], [], [], undefined];
|
||||||
|
const calls = [
|
||||||
|
(api.query.phragmenElection || api.query.electionsPhragmen || api.query.elections)?.members,
|
||||||
|
api.query.council?.members,
|
||||||
|
api.query.technicalCommittee?.members,
|
||||||
|
api.query.society?.members,
|
||||||
|
api.query.sudo?.key
|
||||||
|
];
|
||||||
|
const filtered = calls.filter((c) => c);
|
||||||
|
|
||||||
|
if (!filtered.length) {
|
||||||
|
return of(results as FlagsIntermediate);
|
||||||
|
}
|
||||||
|
|
||||||
|
return api.queryMulti(filtered).pipe(
|
||||||
|
map((values: Codec[]): FlagsIntermediate => {
|
||||||
|
let resultIndex = -1;
|
||||||
|
|
||||||
|
for (let i = 0; i < calls.length; i++) {
|
||||||
|
if (isFunction(calls[i])) {
|
||||||
|
results[i] = values[++resultIndex];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return results as FlagsIntermediate;
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name info
|
* @name info
|
||||||
* @description Returns account membership flags
|
* @description Returns account membership flags
|
||||||
*/
|
*/
|
||||||
export function flags (instanceId: string, api: DeriveApi): (address?: AccountId | Address | string | null) => Observable<DeriveAccountFlags> {
|
export function flags (instanceId: string, api: DeriveApi): (address?: AccountId | Address | string | null) => Observable<DeriveAccountFlags> {
|
||||||
return memo(instanceId, (address?: AccountId | Address | string | null): Observable<DeriveAccountFlags> => {
|
return memo(instanceId, (address?: AccountId | Address | string | null): Observable<DeriveAccountFlags> =>
|
||||||
const elections = api.query.phragmenElection || api.query.electionsPhragmen || api.query.elections;
|
api.derive.accounts._flags().pipe(
|
||||||
|
|
||||||
return combineLatest([
|
|
||||||
address && elections?.members
|
|
||||||
? elections.members<[AccountId, Balance][]>()
|
|
||||||
: of(undefined),
|
|
||||||
address && api.query.council?.members
|
|
||||||
? api.query.council.members()
|
|
||||||
: of([]),
|
|
||||||
address && api.query.technicalCommittee?.members
|
|
||||||
? api.query.technicalCommittee.members()
|
|
||||||
: of([]),
|
|
||||||
address && api.query.society?.members
|
|
||||||
? api.query.society.members()
|
|
||||||
: of([]),
|
|
||||||
address && api.query.sudo?.key
|
|
||||||
? api.query.sudo.key()
|
|
||||||
: of(undefined)
|
|
||||||
]).pipe(
|
|
||||||
map((r) => parseFlags(address, r))
|
map((r) => parseFlags(address, r))
|
||||||
);
|
)
|
||||||
});
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,9 +71,10 @@ function getParent (api: DeriveApi, identityOfOpt: Option<PalletIdentityRegistra
|
|||||||
} else if (superOfOpt?.isSome) {
|
} else if (superOfOpt?.isSome) {
|
||||||
const superOf = superOfOpt.unwrap();
|
const superOf = superOfOpt.unwrap();
|
||||||
|
|
||||||
// we have a super
|
|
||||||
return combineLatest([
|
return combineLatest([
|
||||||
api.query.identity.identityOf(superOf[0]),
|
api.derive.accounts._identity(superOf[0]).pipe(
|
||||||
|
map(([info]) => info)
|
||||||
|
),
|
||||||
of(superOf)
|
of(superOf)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@@ -82,13 +83,15 @@ function getParent (api: DeriveApi, identityOfOpt: Option<PalletIdentityRegistra
|
|||||||
return of([undefined, undefined]);
|
return of([undefined, undefined]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getBase (api: DeriveApi, accountId?: AccountId | Uint8Array | string): Observable<[Option<PalletIdentityRegistration> | undefined, Option<ITuple<[AccountId, Data]>> | undefined]> {
|
export function _identity (instanceId: string, api: DeriveApi): (accountId?: AccountId | Uint8Array | string) => Observable<[Option<PalletIdentityRegistration> | undefined, Option<ITuple<[AccountId, Data]>> | undefined]> {
|
||||||
return accountId && api.query.identity?.identityOf
|
return memo(instanceId, (accountId?: AccountId | Uint8Array | string): Observable<[Option<PalletIdentityRegistration> | undefined, Option<ITuple<[AccountId, Data]>> | undefined]> =>
|
||||||
? api.queryMulti<[Option<PalletIdentityRegistration>, Option<ITuple<[AccountId, Data]>>]>([
|
accountId && api.query.identity?.identityOf
|
||||||
[api.query.identity.identityOf, accountId],
|
? combineLatest([
|
||||||
[api.query.identity.superOf, accountId]
|
api.query.identity.identityOf(accountId),
|
||||||
])
|
api.query.identity.superOf(accountId)
|
||||||
: of([undefined, undefined]);
|
])
|
||||||
|
: of([undefined, undefined])
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -97,9 +100,13 @@ function getBase (api: DeriveApi, accountId?: AccountId | Uint8Array | string):
|
|||||||
*/
|
*/
|
||||||
export function identity (instanceId: string, api: DeriveApi): (accountId?: AccountId | Uint8Array | string) => Observable<DeriveAccountRegistration> {
|
export function identity (instanceId: string, api: DeriveApi): (accountId?: AccountId | Uint8Array | string) => Observable<DeriveAccountRegistration> {
|
||||||
return memo(instanceId, (accountId?: AccountId | Uint8Array | string): Observable<DeriveAccountRegistration> =>
|
return memo(instanceId, (accountId?: AccountId | Uint8Array | string): Observable<DeriveAccountRegistration> =>
|
||||||
getBase(api, accountId).pipe(
|
api.derive.accounts._identity(accountId).pipe(
|
||||||
switchMap(([identityOfOpt, superOfOpt]) => getParent(api, identityOfOpt, superOfOpt)),
|
switchMap(([identityOfOpt, superOfOpt]) =>
|
||||||
map(([identityOfOpt, superOf]) => extractIdentity(identityOfOpt, superOf))
|
getParent(api, identityOfOpt, superOfOpt)
|
||||||
|
),
|
||||||
|
map(([identityOfOpt, superOf]) =>
|
||||||
|
extractIdentity(identityOfOpt, superOf)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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))
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import type { DeriveApi } from '../types';
|
|||||||
|
|
||||||
import { BehaviorSubject, map, of, switchMap, tap, toArray } from 'rxjs';
|
import { BehaviorSubject, map, of, switchMap, tap, toArray } from 'rxjs';
|
||||||
|
|
||||||
|
import { nextTick } from '@polkadot/util';
|
||||||
|
|
||||||
import { memo } from '../util';
|
import { memo } from '../util';
|
||||||
|
|
||||||
function traverseLinks (api: DeriveApi, head: AccountId32 | string): Observable<PalletBagsListListNode[]> {
|
function traverseLinks (api: DeriveApi, head: AccountId32 | string): Observable<PalletBagsListListNode[]> {
|
||||||
@@ -16,14 +18,14 @@ 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 => {
|
||||||
setTimeout((): void => {
|
nextTick((): void => {
|
||||||
node.isSome && node.value.next.isSome
|
node.isSome && node.value.next.isSome
|
||||||
? subject.next(node.unwrap().next.unwrap())
|
? subject.next(node.unwrap().next.unwrap())
|
||||||
: subject.complete();
|
: subject.complete();
|
||||||
}, 0);
|
});
|
||||||
}),
|
}),
|
||||||
toArray(), // toArray since we want to startSubject to be completed
|
toArray(), // toArray since we want to startSubject to be completed
|
||||||
map((all: Option<PalletBagsListListNode>[]) =>
|
map((all: Option<PalletBagsListListNode>[]) =>
|
||||||
|
|||||||
@@ -50,10 +50,10 @@ function calcBalances (api: DeriveApi, [accountId, [accountNonce, [primary, ...a
|
|||||||
|
|
||||||
// old
|
// old
|
||||||
function queryBalancesFree (api: DeriveApi, accountId: AccountId): Observable<Result> {
|
function queryBalancesFree (api: DeriveApi, accountId: AccountId): Observable<Result> {
|
||||||
return api.queryMulti<[Balance, Balance, Index]>([
|
return combineLatest([
|
||||||
[api.query.balances.freeBalance, accountId],
|
api.query.balances.freeBalance<Balance>(accountId),
|
||||||
[api.query.balances.reservedBalance, accountId],
|
api.query.balances.reservedBalance<Balance>(accountId),
|
||||||
[api.query.system.accountNonce, accountId]
|
api.query.system.accountNonce<Index>(accountId)
|
||||||
]).pipe(
|
]).pipe(
|
||||||
map(([freeBalance, reservedBalance, accountNonce]): Result => [
|
map(([freeBalance, reservedBalance, accountNonce]): Result => [
|
||||||
accountNonce,
|
accountNonce,
|
||||||
@@ -82,8 +82,7 @@ function queryNonceOnly (api: DeriveApi, accountId: AccountId): Observable<Resul
|
|||||||
function queryBalancesAccount (api: DeriveApi, accountId: AccountId, modules: string[] = ['balances']): Observable<Result> {
|
function queryBalancesAccount (api: DeriveApi, accountId: AccountId, modules: string[] = ['balances']): Observable<Result> {
|
||||||
const balances = modules
|
const balances = modules
|
||||||
.map((m): QueryableStorageEntry<'rxjs'> => (api.derive as DeriveCustomAccount)[m]?.customAccount || api.query[m]?.account)
|
.map((m): QueryableStorageEntry<'rxjs'> => (api.derive as DeriveCustomAccount)[m]?.customAccount || api.query[m]?.account)
|
||||||
.filter((q) => isFunction(q))
|
.filter((q) => isFunction(q));
|
||||||
.map((q): [QueryableStorageEntry<'rxjs'>, AccountId] => [q, accountId]);
|
|
||||||
|
|
||||||
const extract = (nonce: Index, data: AccountData[]): Result => [
|
const extract = (nonce: Index, data: AccountData[]): Result => [
|
||||||
nonce,
|
nonce,
|
||||||
@@ -93,11 +92,17 @@ function queryBalancesAccount (api: DeriveApi, accountId: AccountId, modules: st
|
|||||||
// NOTE this is for the first case where we do have instances specified
|
// NOTE this is for the first case where we do have instances specified
|
||||||
return balances.length
|
return balances.length
|
||||||
? isFunction(api.query.system.account)
|
? isFunction(api.query.system.account)
|
||||||
? api.queryMulti<[AccountInfo, ...(AccountData[])]>([[api.query.system.account, accountId], ...balances]).pipe(
|
? combineLatest([
|
||||||
map(([{ nonce }, ...balances]) => extract(nonce, balances))
|
api.query.system.account(accountId),
|
||||||
|
...balances.map((c) => c(accountId))
|
||||||
|
]).pipe(
|
||||||
|
map(([{ nonce }, ...balances]) => extract(nonce, balances as unknown as AccountData[]))
|
||||||
)
|
)
|
||||||
: api.queryMulti<[Index, ...(AccountData[])]>([[api.query.system.accountNonce, accountId], ...balances]).pipe(
|
: combineLatest([
|
||||||
map(([nonce, ...balances]) => extract(nonce, balances))
|
api.query.system.accountNonce<Index>(accountId),
|
||||||
|
...balances.map((c) => c(accountId))
|
||||||
|
]).pipe(
|
||||||
|
map(([nonce, ...balances]) => extract(nonce, balances as unknown as AccountData[]))
|
||||||
)
|
)
|
||||||
: queryNonceOnly(api, accountId);
|
: queryNonceOnly(api, accountId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,8 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type { Observable } from 'rxjs';
|
import type { Observable } from 'rxjs';
|
||||||
import type { QueryableStorageMultiArg } from '@polkadot/api-base/types';
|
|
||||||
import type { Option, Vec } from '@polkadot/types';
|
import type { Option, Vec } from '@polkadot/types';
|
||||||
import type { AccountId, AccountIndex, Address, Balance, BalanceLockTo212, BlockNumber, VestingSchedule } from '@polkadot/types/interfaces';
|
import type { AccountId, Balance, BalanceLockTo212, BlockNumber, VestingSchedule } from '@polkadot/types/interfaces';
|
||||||
import type { PalletBalancesBalanceLock, PalletBalancesReserveData, PalletVestingVestingInfo } from '@polkadot/types/lookup';
|
import type { PalletBalancesBalanceLock, PalletBalancesReserveData, PalletVestingVestingInfo } from '@polkadot/types/lookup';
|
||||||
import type { DeriveApi, DeriveBalancesAccount, DeriveBalancesAccountData, DeriveBalancesAll, DeriveBalancesAllAccountData, DeriveBalancesAllVesting } from '../types';
|
import type { DeriveApi, DeriveBalancesAccount, DeriveBalancesAccountData, DeriveBalancesAll, DeriveBalancesAllAccountData, DeriveBalancesAllVesting } from '../types';
|
||||||
|
|
||||||
@@ -15,7 +14,7 @@ import { BN, BN_ZERO, bnMax, bnMin, isFunction } from '@polkadot/util';
|
|||||||
import { memo } from '../util';
|
import { memo } from '../util';
|
||||||
|
|
||||||
type ResultBalance = [PalletVestingVestingInfo[] | null, ((PalletBalancesBalanceLock | BalanceLockTo212)[])[], PalletBalancesReserveData[][]];
|
type ResultBalance = [PalletVestingVestingInfo[] | null, ((PalletBalancesBalanceLock | BalanceLockTo212)[])[], PalletBalancesReserveData[][]];
|
||||||
type Result = [DeriveBalancesAccount, BlockNumber, ResultBalance];
|
type Result = [DeriveBalancesAccount, ResultBalance, BlockNumber];
|
||||||
|
|
||||||
interface AllLocked {
|
interface AllLocked {
|
||||||
allLocked: boolean,
|
allLocked: boolean,
|
||||||
@@ -100,7 +99,7 @@ function calcVesting (bestNumber: BlockNumber, shared: DeriveBalancesAllAccountD
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function calcBalances (api: DeriveApi, [data, bestNumber, [vesting, allLocks, namedReserves]]: Result): DeriveBalancesAll {
|
function calcBalances (api: DeriveApi, [data, [vesting, allLocks, namedReserves], bestNumber]: Result): DeriveBalancesAll {
|
||||||
const shared = calcShared(api, bestNumber, data, allLocks[0]);
|
const shared = calcShared(api, bestNumber, data, allLocks[0]);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -116,10 +115,10 @@ function calcBalances (api: DeriveApi, [data, bestNumber, [vesting, allLocks, na
|
|||||||
}
|
}
|
||||||
|
|
||||||
// old
|
// old
|
||||||
function queryOld (api: DeriveApi, accountId: AccountId): Observable<ResultBalance> {
|
function queryOld (api: DeriveApi, accountId: AccountId | string): Observable<ResultBalance> {
|
||||||
return api.queryMulti<[Vec<PalletBalancesBalanceLock>, Option<VestingSchedule>]>([
|
return combineLatest([
|
||||||
[api.query.balances.locks, accountId],
|
api.query.balances.locks(accountId),
|
||||||
[api.query.balances.vesting, accountId]
|
api.query.balances.vesting<Option<VestingSchedule>>(accountId)
|
||||||
]).pipe(
|
]).pipe(
|
||||||
map(([locks, optVesting]): ResultBalance => {
|
map(([locks, optVesting]): ResultBalance => {
|
||||||
let vestingNew = null;
|
let vestingNew = null;
|
||||||
@@ -143,26 +142,22 @@ function queryOld (api: DeriveApi, accountId: AccountId): Observable<ResultBalan
|
|||||||
|
|
||||||
const isNonNullable = <T>(nullable: T): nullable is NonNullable<T> => !!nullable;
|
const isNonNullable = <T>(nullable: T): nullable is NonNullable<T> => !!nullable;
|
||||||
|
|
||||||
function createCalls (accountId: AccountId, calls: unknown[]): [boolean[], QueryableStorageMultiArg<'rxjs'>[]] {
|
function createCalls <T> (calls: (((a: unknown) => Observable<T>) | null | undefined)[]): [boolean[], ((a: unknown) => Observable<T>)[]] {
|
||||||
return [
|
return [
|
||||||
calls.map((c) => !c),
|
calls.map((c) => !c),
|
||||||
calls
|
calls.filter(isNonNullable)
|
||||||
.filter(isNonNullable)
|
|
||||||
.map((c) => [c, accountId] as unknown as QueryableStorageMultiArg<'rxjs'>)
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
// current (balances, vesting)
|
// current (balances, vesting)
|
||||||
function queryCurrent (api: DeriveApi, accountId: AccountId, balanceInstances: string[] = ['balances']): Observable<ResultBalance> {
|
function queryCurrent (api: DeriveApi, accountId: AccountId | string, balanceInstances: string[] = ['balances']): Observable<ResultBalance> {
|
||||||
const [lockEmpty, lockQueries] = createCalls(
|
const [lockEmpty, lockQueries] = createCalls<Vec<PalletBalancesBalanceLock>>(
|
||||||
accountId,
|
balanceInstances.map((m) =>
|
||||||
balanceInstances.map((m): DeriveApi['query']['balances']['locks'] | undefined =>
|
|
||||||
(api.derive as DeriveCustomLocks)[m]?.customLocks || api.query[m as 'balances']?.locks
|
(api.derive as DeriveCustomLocks)[m]?.customLocks || api.query[m as 'balances']?.locks
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
const [reserveEmpty, reserveQueries] = createCalls(
|
const [reserveEmpty, reserveQueries] = createCalls<Vec<PalletBalancesReserveData>>(
|
||||||
accountId,
|
balanceInstances.map((m) =>
|
||||||
balanceInstances.map((m): DeriveApi['query']['balances']['reserves'] | undefined =>
|
|
||||||
api.query[m as 'balances']?.reserves
|
api.query[m as 'balances']?.reserves
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@@ -172,10 +167,10 @@ function queryCurrent (api: DeriveApi, accountId: AccountId, balanceInstances: s
|
|||||||
? api.query.vesting.vesting(accountId)
|
? api.query.vesting.vesting(accountId)
|
||||||
: of(api.registry.createType('Option<VestingInfo>')),
|
: of(api.registry.createType('Option<VestingInfo>')),
|
||||||
lockQueries.length
|
lockQueries.length
|
||||||
? api.queryMulti<[...(Vec<PalletBalancesBalanceLock>)[]]>(lockQueries)
|
? combineLatest(lockQueries.map((c) => c(accountId)))
|
||||||
: of([] as Vec<PalletBalancesBalanceLock>[]),
|
: of([] as Vec<PalletBalancesBalanceLock>[]),
|
||||||
reserveQueries.length
|
reserveQueries.length
|
||||||
? api.queryMulti<[...(Vec<PalletBalancesReserveData>)[]]>(reserveQueries)
|
? combineLatest(reserveQueries.map((c) => c(accountId)))
|
||||||
: of([] as Vec<PalletBalancesReserveData>[])
|
: of([] as Vec<PalletBalancesReserveData>[])
|
||||||
]).pipe(
|
]).pipe(
|
||||||
map(([opt, locks, reserves]): ResultBalance => {
|
map(([opt, locks, reserves]): ResultBalance => {
|
||||||
@@ -215,23 +210,23 @@ function queryCurrent (api: DeriveApi, accountId: AccountId, balanceInstances: s
|
|||||||
* });
|
* });
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
export function all (instanceId: string, api: DeriveApi): (address: AccountIndex | AccountId | Address | string) => Observable<DeriveBalancesAll> {
|
export function all (instanceId: string, api: DeriveApi): (address: AccountId | string) => Observable<DeriveBalancesAll> {
|
||||||
const balanceInstances = api.registry.getModuleInstances(api.runtimeVersion.specName.toString(), 'balances');
|
const balanceInstances = api.registry.getModuleInstances(api.runtimeVersion.specName.toString(), 'balances');
|
||||||
|
|
||||||
return memo(instanceId, (address: AccountIndex | AccountId | Address | string): Observable<DeriveBalancesAll> =>
|
return memo(instanceId, (address: AccountId | string): Observable<DeriveBalancesAll> =>
|
||||||
api.derive.balances.account(address).pipe(
|
combineLatest([
|
||||||
switchMap((account): Observable<Result> =>
|
api.derive.balances.account(address),
|
||||||
(!account.accountId.isEmpty
|
isFunction(api.query.system?.account) || isFunction(api.query.balances?.account)
|
||||||
? combineLatest([
|
? queryCurrent(api, address, balanceInstances)
|
||||||
of(account),
|
: queryOld(api, address)
|
||||||
api.derive.chain.bestNumber(),
|
]).pipe(
|
||||||
isFunction(api.query.system?.account) || isFunction(api.query.balances?.account)
|
switchMap(([account, locks]) =>
|
||||||
? queryCurrent(api, account.accountId, balanceInstances)
|
combineLatest([
|
||||||
: queryOld(api, account.accountId)
|
of(account),
|
||||||
])
|
of(locks),
|
||||||
: of([account, api.registry.createType('BlockNumber'), [null, [], []]])
|
api.derive.chain.bestNumber()
|
||||||
)
|
])
|
||||||
),
|
),
|
||||||
map((result): DeriveBalancesAll => calcBalances(api, result))
|
map((result) => calcBalances(api, result))
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -156,6 +156,6 @@ describe('bounties derive', () => {
|
|||||||
expect(result).toHaveLength(2);
|
expect(result).toHaveLength(2);
|
||||||
expect(result[0].proposals).toHaveLength(0);
|
expect(result[0].proposals).toHaveLength(0);
|
||||||
expect(result[1].proposals).toHaveLength(1);
|
expect(result[1].proposals).toHaveLength(1);
|
||||||
expect(result[1].proposals[0].proposal.method).toEqual('approveBounty');
|
expect(result[1].proposals[0].proposal && result[1].proposals[0].proposal.method).toEqual('approveBounty');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -23,7 +23,9 @@ function parseResult ([maybeBounties, maybeDescriptions, ids, bountyProposals]:
|
|||||||
bounty: bounty.unwrap(),
|
bounty: bounty.unwrap(),
|
||||||
description: maybeDescriptions[index].unwrapOrDefault().toUtf8(),
|
description: maybeDescriptions[index].unwrapOrDefault().toUtf8(),
|
||||||
index: ids[index],
|
index: ids[index],
|
||||||
proposals: bountyProposals.filter((bountyProposal) => ids[index].eq(bountyProposal.proposal.args[0]))
|
proposals: bountyProposals.filter((bountyProposal) =>
|
||||||
|
bountyProposal.proposal && ids[index].eq(bountyProposal.proposal.args[0])
|
||||||
|
)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -7,5 +7,7 @@ export function filterBountiesProposals (api: DeriveApi, allProposals: DeriveCol
|
|||||||
const bountyTxBase = api.tx.bounties ? api.tx.bounties : api.tx.treasury;
|
const bountyTxBase = api.tx.bounties ? api.tx.bounties : api.tx.treasury;
|
||||||
const bountyProposalCalls = [bountyTxBase.approveBounty, bountyTxBase.closeBounty, bountyTxBase.proposeCurator, bountyTxBase.unassignCurator];
|
const bountyProposalCalls = [bountyTxBase.approveBounty, bountyTxBase.closeBounty, bountyTxBase.proposeCurator, bountyTxBase.unassignCurator];
|
||||||
|
|
||||||
return allProposals.filter((proposal) => bountyProposalCalls.find((bountyCall) => bountyCall.is(proposal.proposal)));
|
return allProposals.filter((proposal) => bountyProposalCalls.find((bountyCall) =>
|
||||||
|
proposal.proposal && bountyCall.is(proposal.proposal))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import type { AnyFunction } from '@polkadot/types/types';
|
|||||||
import type { ExactDerive } from './derive';
|
import type { ExactDerive } from './derive';
|
||||||
import type { DeriveApi } from './types';
|
import type { DeriveApi } from './types';
|
||||||
|
|
||||||
import { lazyDeriveSection } from './util/lazy';
|
|
||||||
import { derive } from './derive';
|
import { derive } from './derive';
|
||||||
|
import { lazyDeriveSection } from './util';
|
||||||
|
|
||||||
export * from './derive';
|
export * from './derive';
|
||||||
export * from './type';
|
export * from './type';
|
||||||
@@ -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'],
|
||||||
|
|||||||
@@ -21,17 +21,13 @@ export type { Hash, Proposal, Votes } from '@polkadot/types/interfaces';
|
|||||||
type Result = [(Hash | Uint8Array | string)[], (Option<Proposal> | null)[], Option<Votes>[]];
|
type Result = [(Hash | Uint8Array | string)[], (Option<Proposal> | null)[], Option<Votes>[]];
|
||||||
|
|
||||||
function parse (api: DeriveApi, [hashes, proposals, votes]: Result): DeriveCollectiveProposal[] {
|
function parse (api: DeriveApi, [hashes, proposals, votes]: Result): DeriveCollectiveProposal[] {
|
||||||
return proposals
|
return proposals.map((o, index): DeriveCollectiveProposal => ({
|
||||||
.map((o, index): DeriveCollectiveProposal | null =>
|
hash: api.registry.createType('Hash', hashes[index]),
|
||||||
o && o.isSome
|
proposal: o && o.isSome
|
||||||
? {
|
? o.unwrap()
|
||||||
hash: api.registry.createType('Hash', hashes[index]),
|
: null,
|
||||||
proposal: o.unwrap(),
|
votes: votes[index].unwrapOr(null)
|
||||||
votes: votes[index].unwrapOr(null)
|
}));
|
||||||
}
|
|
||||||
: null
|
|
||||||
)
|
|
||||||
.filter((proposal): proposal is DeriveCollectiveProposal => !!proposal);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function _proposalsFrom (api: DeriveApi, query: DeriveApi['query']['council'], hashes: (Hash | Uint8Array | string)[]): Observable<DeriveCollectiveProposal[]> {
|
function _proposalsFrom (api: DeriveApi, query: DeriveApi['query']['council'], hashes: (Hash | Uint8Array | string)[]): Observable<DeriveCollectiveProposal[]> {
|
||||||
@@ -41,11 +37,9 @@ function _proposalsFrom (api: DeriveApi, query: DeriveApi['query']['council'], h
|
|||||||
// this should simply be api.query[section].proposalOf.multi<Option<Proposal>>(hashes),
|
// this should simply be api.query[section].proposalOf.multi<Option<Proposal>>(hashes),
|
||||||
// however we have had cases on Edgeware where the indices have moved around after an
|
// however we have had cases on Edgeware where the indices have moved around after an
|
||||||
// upgrade, which results in invalid on-chain data
|
// upgrade, which results in invalid on-chain data
|
||||||
combineLatest(hashes.map((h) =>
|
query.proposalOf.multi<Option<Proposal>>(hashes).pipe(
|
||||||
query.proposalOf<Option<Proposal>>(h).pipe(
|
catchError(() => of(hashes.map(() => null)))
|
||||||
catchError(() => of(null))
|
),
|
||||||
)
|
|
||||||
)),
|
|
||||||
query.voting.multi<Option<Votes>>(hashes)
|
query.voting.multi<Option<Votes>>(hashes)
|
||||||
])
|
])
|
||||||
: of<Result>([[], [], []])
|
: of<Result>([[], [], []])
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import type { DeriveApi, DeriveContributions } from '../types';
|
|||||||
|
|
||||||
import { BehaviorSubject, combineLatest, EMPTY, map, of, startWith, switchMap, tap, toArray } from 'rxjs';
|
import { BehaviorSubject, combineLatest, EMPTY, map, of, startWith, switchMap, tap, toArray } from 'rxjs';
|
||||||
|
|
||||||
import { arrayFlatten, isFunction } from '@polkadot/util';
|
import { arrayFlatten, isFunction, nextTick } from '@polkadot/util';
|
||||||
|
|
||||||
import { memo } from '../util';
|
import { memo } from '../util';
|
||||||
import { extractContributed } from './util';
|
import { extractContributed } from './util';
|
||||||
@@ -67,11 +67,11 @@ function _getKeysPaged (api: DeriveApi, childKey: string): Observable<StorageKey
|
|||||||
api.rpc.childstate.getKeysPaged(childKey, '0x', PAGE_SIZE_K, startKey)
|
api.rpc.childstate.getKeysPaged(childKey, '0x', PAGE_SIZE_K, startKey)
|
||||||
),
|
),
|
||||||
tap((keys): void => {
|
tap((keys): void => {
|
||||||
setTimeout((): void => {
|
nextTick((): void => {
|
||||||
keys.length === PAGE_SIZE_K
|
keys.length === PAGE_SIZE_K
|
||||||
? subject.next(keys[PAGE_SIZE_K - 1].toHex())
|
? subject.next(keys[PAGE_SIZE_K - 1].toHex())
|
||||||
: subject.complete();
|
: subject.complete();
|
||||||
}, 0);
|
});
|
||||||
}),
|
}),
|
||||||
toArray(), // toArray since we want to startSubject to be completed
|
toArray(), // toArray since we want to startSubject to be completed
|
||||||
map((keyArr: StorageKey[][]) => arrayFlatten(keyArr))
|
map((keyArr: StorageKey[][]) => arrayFlatten(keyArr))
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ function queryQueue (api: DeriveApi): Observable<DeriveDispatch[]> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function schedulerEntries (api: DeriveApi): Observable<[BlockNumber[], (Option<PalletSchedulerScheduledV3 | Scheduled>[] | null)[]]> {
|
function schedulerEntries (api: DeriveApi): Observable<[BlockNumber[], Option<PalletSchedulerScheduledV3 | Scheduled>[][]]> {
|
||||||
// We don't get entries, but rather we get the keys (triggered via finished referendums) and
|
// We don't get entries, but rather we get the keys (triggered via finished referendums) and
|
||||||
// the subscribe to those keys - this means we pickup when the schedulers actually executes
|
// the subscribe to those keys - this means we pickup when the schedulers actually executes
|
||||||
// at a block, the entry for that block will become empty
|
// at a block, the entry for that block will become empty
|
||||||
@@ -64,12 +64,11 @@ function schedulerEntries (api: DeriveApi): Observable<[BlockNumber[], (Option<P
|
|||||||
// this should simply be api.query.scheduler.agenda.multi,
|
// this should simply be api.query.scheduler.agenda.multi,
|
||||||
// however we have had cases on Darwinia where the indices have moved around after an
|
// however we have had cases on Darwinia where the indices have moved around after an
|
||||||
// upgrade, which results in invalid on-chain data
|
// upgrade, which results in invalid on-chain data
|
||||||
combineLatest(blockNumbers.map((blockNumber) =>
|
api.query.scheduler.agenda.multi(blockNumbers).pipe(
|
||||||
// this does create an issue since it discards all at that block
|
catchError(() => of(blockNumbers.map(() => [])))
|
||||||
api.query.scheduler.agenda(blockNumber).pipe(catchError(() => of(null)))
|
)
|
||||||
))
|
|
||||||
])
|
])
|
||||||
: of<[BlockNumber[], null[]]>([[], []]);
|
: of<[BlockNumber[], Option<PalletSchedulerScheduledV3 | Scheduled>[][]]>([[], []]);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
import type { Observable } from 'rxjs';
|
import type { Observable } from 'rxjs';
|
||||||
import type { u32, Vec } from '@polkadot/types';
|
import type { u32, Vec } from '@polkadot/types';
|
||||||
import type { AccountId, Balance, BlockNumber } from '@polkadot/types/interfaces';
|
import type { AccountId32, Balance, BlockNumber } from '@polkadot/types/interfaces';
|
||||||
import type { PalletElectionsPhragmenSeatHolder } from '@polkadot/types/lookup';
|
import type { PalletElectionsPhragmenSeatHolder } from '@polkadot/types/lookup';
|
||||||
import type { ITuple } from '@polkadot/types/types';
|
import type { ITuple } from '@polkadot/types/types';
|
||||||
import type { DeriveApi } from '../types';
|
import type { DeriveApi } from '../types';
|
||||||
@@ -14,31 +14,31 @@ import { combineLatest, map, of } from 'rxjs';
|
|||||||
import { memo } from '../util';
|
import { memo } from '../util';
|
||||||
|
|
||||||
// SeatHolder is current tuple is 2.x-era Substrate
|
// SeatHolder is current tuple is 2.x-era Substrate
|
||||||
type Member = PalletElectionsPhragmenSeatHolder | ITuple<[AccountId, Balance]>;
|
type Member = PalletElectionsPhragmenSeatHolder | ITuple<[AccountId32, Balance]>;
|
||||||
|
|
||||||
type Candidate = AccountId | ITuple<[AccountId, Balance]>;
|
type Candidate = AccountId32 | ITuple<[AccountId32, Balance]>;
|
||||||
|
|
||||||
function isSeatHolder (value: Member): value is PalletElectionsPhragmenSeatHolder {
|
function isSeatHolder (value: Member): value is PalletElectionsPhragmenSeatHolder {
|
||||||
return !Array.isArray(value);
|
return !Array.isArray(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
function isCandidateTuple (value: Candidate): value is ITuple<[AccountId, Balance]> {
|
function isCandidateTuple (value: Candidate): value is ITuple<[AccountId32, Balance]> {
|
||||||
return Array.isArray(value);
|
return Array.isArray(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAccountTuple (value: Member): [AccountId, Balance] {
|
function getAccountTuple (value: Member): [AccountId32, Balance] {
|
||||||
return isSeatHolder(value)
|
return isSeatHolder(value)
|
||||||
? [value.who, value.stake]
|
? [value.who, value.stake]
|
||||||
: value;
|
: value;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCandidate (value: Candidate): AccountId {
|
function getCandidate (value: Candidate): AccountId32 {
|
||||||
return isCandidateTuple(value)
|
return isCandidateTuple(value)
|
||||||
? value[0]
|
? value[0]
|
||||||
: value;
|
: value;
|
||||||
}
|
}
|
||||||
|
|
||||||
function sortAccounts ([, balanceA]: [AccountId, Balance], [, balanceB]: [AccountId, Balance]): number {
|
function sortAccounts ([, balanceA]: [AccountId32, Balance], [, balanceB]: [AccountId32, Balance]): number {
|
||||||
return balanceB.cmp(balanceA);
|
return balanceB.cmp(balanceA);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,6 +67,24 @@ function getModules (api: DeriveApi): [string, string | null] {
|
|||||||
return [council, elections];
|
return [council, elections];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function queryAll (api: DeriveApi, council: string, elections: string): Observable<[AccountId32[], Candidate[], Member[], Member[]]> {
|
||||||
|
return api.queryMulti<[Vec<AccountId32>, Vec<Candidate>, Vec<Member>, Vec<Member>]>([
|
||||||
|
api.query[council as 'council'].members,
|
||||||
|
api.query[elections as 'phragmenElection'].candidates,
|
||||||
|
api.query[elections as 'phragmenElection'].members,
|
||||||
|
api.query[elections as 'phragmenElection'].runnersUp
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function queryCouncil (api: DeriveApi, council: string): Observable<[AccountId32[], Candidate[], Member[], Member[]]> {
|
||||||
|
return combineLatest([
|
||||||
|
api.query[council as 'council'].members(),
|
||||||
|
of<Candidate[]>([]),
|
||||||
|
of<Member[]>([]),
|
||||||
|
of<Member[]>([])
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name info
|
* @name info
|
||||||
* @returns An object containing the combined results of the storage queries for
|
* @returns An object containing the combined results of the storage queries for
|
||||||
@@ -86,18 +104,8 @@ export function info (instanceId: string, api: DeriveApi): () => Observable<Deri
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
elections
|
elections
|
||||||
? api.queryMulti<[Vec<AccountId>, Vec<Candidate>, Vec<Member>, Vec<Member>]>([
|
? queryAll(api, council, elections)
|
||||||
api.query[council].members,
|
: queryCouncil(api, council)
|
||||||
api.query[elections].candidates,
|
|
||||||
api.query[elections].members,
|
|
||||||
api.query[elections].runnersUp
|
|
||||||
])
|
|
||||||
: combineLatest([
|
|
||||||
api.query[council].members<Vec<AccountId>>(),
|
|
||||||
of<Candidate[]>([]),
|
|
||||||
of<Member[]>([]),
|
|
||||||
of<Member[]>([])
|
|
||||||
])
|
|
||||||
).pipe(
|
).pipe(
|
||||||
map(([councilMembers, candidates, members, runnersUp]): DeriveElectionsInfo => ({
|
map(([councilMembers, candidates, members, runnersUp]): DeriveElectionsInfo => ({
|
||||||
...getConstants(api, elections),
|
...getConstants(api, elections),
|
||||||
@@ -105,7 +113,7 @@ export function info (instanceId: string, api: DeriveApi): () => Observable<Deri
|
|||||||
candidates: candidates.map(getCandidate),
|
candidates: candidates.map(getCandidate),
|
||||||
members: members.length
|
members: members.length
|
||||||
? members.map(getAccountTuple).sort(sortAccounts)
|
? members.map(getAccountTuple).sort(sortAccounts)
|
||||||
: councilMembers.map((a): [AccountId, Balance] => [a, api.registry.createType('Balance')]),
|
: councilMembers.map((a): [AccountId32, Balance] => [a, api.registry.createType('Balance')]),
|
||||||
runnersUp: runnersUp.map(getAccountTuple).sort(sortAccounts)
|
runnersUp: runnersUp.map(getAccountTuple).sort(sortAccounts)
|
||||||
}))
|
}))
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import { ExactDerive } from '.';
|
|||||||
|
|
||||||
const testFunction = (api: ApiRx): any => {
|
const testFunction = (api: ApiRx): any => {
|
||||||
return <S extends keyof ExactDerive, M extends keyof (typeof api.derive[S])>(section: S, method: M, inputs: any[]): void => {
|
return <S extends keyof ExactDerive, M extends keyof (typeof api.derive[S])>(section: S, method: M, inputs: any[]): void => {
|
||||||
describe(`derive.${section}.${method}`, (): void => {
|
describe(`derive.${section}.${method as string}`, (): void => {
|
||||||
it('should be a function', (): void => {
|
it('should be a function', (): void => {
|
||||||
expect(typeof api.derive[section][method]).toBe('function');
|
expect(typeof api.derive[section][method]).toBe('function');
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -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.6.1' };
|
export const packageInfo = { name: '@polkadot/api-derive', path: 'auto', type: 'auto', version: '8.8.1' };
|
||||||
|
|||||||
@@ -39,12 +39,14 @@ export function keysMulti (instanceId: string, api: DeriveApi): (stashIds: (Uint
|
|||||||
combineLatest([
|
combineLatest([
|
||||||
of(queuedKeys),
|
of(queuedKeys),
|
||||||
api.consts.session?.dedupKeyPrefix
|
api.consts.session?.dedupKeyPrefix
|
||||||
? api.query.session.nextKeys.multi(stashIds.map((stashId) => [api.consts.session.dedupKeyPrefix, stashId]))
|
? api.query.session.nextKeys.multi(stashIds.map((s) => [api.consts.session.dedupKeyPrefix, s]))
|
||||||
: api.query.session.nextKeys.multi(stashIds)
|
: combineLatest(stashIds.map((s) => api.query.session.nextKeys(s)))
|
||||||
])
|
])
|
||||||
),
|
),
|
||||||
map(([queuedKeys, nextKeys]) =>
|
map(([queuedKeys, nextKeys]) =>
|
||||||
stashIds.map((stashId, index) => extractsIds(stashId, queuedKeys, nextKeys[index]))
|
stashIds.map((stashId, index) =>
|
||||||
|
extractsIds(stashId, queuedKeys, nextKeys[index])
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
: of([])
|
: of([])
|
||||||
|
|||||||
@@ -2,12 +2,10 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type { Observable } from 'rxjs';
|
import type { Observable } from 'rxjs';
|
||||||
import type { QueryableStorageMultiArg } from '@polkadot/api-base/types';
|
|
||||||
import type { EraIndex } from '@polkadot/types/interfaces';
|
import type { EraIndex } from '@polkadot/types/interfaces';
|
||||||
import type { PalletStakingExposure } from '@polkadot/types/lookup';
|
|
||||||
import type { DeriveApi, DeriveOwnExposure } from '../types';
|
import type { DeriveApi, DeriveOwnExposure } from '../types';
|
||||||
|
|
||||||
import { map, of } from 'rxjs';
|
import { combineLatest, map, of } from 'rxjs';
|
||||||
|
|
||||||
import { firstMemo, memo } from '../util';
|
import { firstMemo, memo } from '../util';
|
||||||
import { erasHistoricApplyAccount } from './util';
|
import { erasHistoricApplyAccount } from './util';
|
||||||
@@ -16,12 +14,12 @@ export function _ownExposures (instanceId: string, api: DeriveApi): (accountId:
|
|||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
return memo(instanceId, (accountId: Uint8Array | string, eras: EraIndex[], _withActive: boolean): Observable<DeriveOwnExposure[]> =>
|
return memo(instanceId, (accountId: Uint8Array | string, eras: EraIndex[], _withActive: boolean): Observable<DeriveOwnExposure[]> =>
|
||||||
eras.length
|
eras.length
|
||||||
? api.queryMulti<PalletStakingExposure[]>([
|
? combineLatest([
|
||||||
...eras.map((e): QueryableStorageMultiArg<'rxjs'> => [api.query.staking.erasStakersClipped, [e, accountId]]),
|
combineLatest(eras.map((e) => api.query.staking.erasStakersClipped(e, accountId))),
|
||||||
...eras.map((e): QueryableStorageMultiArg<'rxjs'> => [api.query.staking.erasStakers, [e, accountId]])
|
combineLatest(eras.map((e) => api.query.staking.erasStakers(e, accountId)))
|
||||||
]).pipe(
|
]).pipe(
|
||||||
map((all): DeriveOwnExposure[] =>
|
map(([clp, exp]): DeriveOwnExposure[] =>
|
||||||
eras.map((era, index) => ({ clipped: all[index], era, exposure: all[eras.length + index] }))
|
eras.map((era, index) => ({ clipped: clp[index], era, exposure: exp[index] }))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
: of([])
|
: of([])
|
||||||
|
|||||||
@@ -2,13 +2,11 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type { Observable } from 'rxjs';
|
import type { Observable } from 'rxjs';
|
||||||
import type { QueryableStorageMultiArg } from '@polkadot/api-base/types';
|
|
||||||
import type { Option } from '@polkadot/types';
|
|
||||||
import type { BalanceOf, EraIndex, Perbill } from '@polkadot/types/interfaces';
|
import type { BalanceOf, EraIndex, Perbill } from '@polkadot/types/interfaces';
|
||||||
import type { ITuple } from '@polkadot/types/types';
|
import type { ITuple } from '@polkadot/types/types';
|
||||||
import type { DeriveApi, DeriveStakerSlashes } from '../types';
|
import type { DeriveApi, DeriveStakerSlashes } from '../types';
|
||||||
|
|
||||||
import { map, of } from 'rxjs';
|
import { combineLatest, map, of } from 'rxjs';
|
||||||
|
|
||||||
import { firstMemo, memo } from '../util';
|
import { firstMemo, memo } from '../util';
|
||||||
import { erasHistoricApplyAccount } from './util';
|
import { erasHistoricApplyAccount } from './util';
|
||||||
@@ -17,16 +15,16 @@ export function _ownSlashes (instanceId: string, api: DeriveApi): (accountId: Ui
|
|||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
return memo(instanceId, (accountId: Uint8Array | string, eras: EraIndex[], _withActive: boolean): Observable<DeriveStakerSlashes[]> =>
|
return memo(instanceId, (accountId: Uint8Array | string, eras: EraIndex[], _withActive: boolean): Observable<DeriveStakerSlashes[]> =>
|
||||||
eras.length
|
eras.length
|
||||||
? api.queryMulti<(Option<ITuple<[Perbill, BalanceOf]>> | Option<BalanceOf>)[]>([
|
? combineLatest([
|
||||||
...eras.map((e): QueryableStorageMultiArg<'rxjs'> => [api.query.staking.validatorSlashInEra, [e, accountId]]),
|
combineLatest(eras.map((e) => api.query.staking.validatorSlashInEra(e, accountId))),
|
||||||
...eras.map((e): QueryableStorageMultiArg<'rxjs'> => [api.query.staking.nominatorSlashInEra, [e, accountId]])
|
combineLatest(eras.map((e) => api.query.staking.nominatorSlashInEra(e, accountId)))
|
||||||
]).pipe(
|
]).pipe(
|
||||||
map((values): DeriveStakerSlashes[] =>
|
map(([vals, noms]): DeriveStakerSlashes[] =>
|
||||||
eras.map((era, index) => ({
|
eras.map((era, index) => ({
|
||||||
era,
|
era,
|
||||||
total: values[index].isSome
|
total: vals[index].isSome
|
||||||
? (values[index].unwrap() as ITuple<[Perbill, BalanceOf]>)[1]
|
? (vals[index].unwrap() as ITuple<[Perbill, BalanceOf]>)[1]
|
||||||
: (values[index + eras.length].unwrapOrDefault() as BalanceOf)
|
: (noms[index].unwrapOrDefault() as BalanceOf)
|
||||||
}))
|
}))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ function getLedgers (api: DeriveApi, optIds: (Option<AccountId> | null)[], { wit
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
ids.length
|
ids.length
|
||||||
? api.query.staking.ledger.multi(ids)
|
? combineLatest(ids.map((s) => api.query.staking.ledger(s)))
|
||||||
: of([])
|
: of([])
|
||||||
).pipe(
|
).pipe(
|
||||||
map((optLedgers): Option<PalletStakingStakingLedger>[] => {
|
map((optLedgers): Option<PalletStakingStakingLedger>[] => {
|
||||||
@@ -57,19 +57,19 @@ function getStashInfo (api: DeriveApi, stashIds: AccountId[], activeEra: EraInde
|
|||||||
|
|
||||||
return combineLatest([
|
return combineLatest([
|
||||||
withController || withLedger
|
withController || withLedger
|
||||||
? api.query.staking.bonded.multi(stashIds)
|
? combineLatest(stashIds.map((s) => api.query.staking.bonded(s)))
|
||||||
: of(stashIds.map(() => null)),
|
: of(stashIds.map(() => null)),
|
||||||
withNominations
|
withNominations
|
||||||
? api.query.staking.nominators.multi(stashIds)
|
? combineLatest(stashIds.map((s) => api.query.staking.nominators(s)))
|
||||||
: of(stashIds.map(() => emptyNoms)),
|
: of(stashIds.map(() => emptyNoms)),
|
||||||
withDestination
|
withDestination
|
||||||
? api.query.staking.payee.multi(stashIds)
|
? combineLatest(stashIds.map((s) => api.query.staking.payee(s)))
|
||||||
: of(stashIds.map(() => emptyRewa)),
|
: of(stashIds.map(() => emptyRewa)),
|
||||||
withPrefs
|
withPrefs
|
||||||
? api.query.staking.validators.multi(stashIds)
|
? combineLatest(stashIds.map((s) => api.query.staking.validators(s)))
|
||||||
: of(stashIds.map(() => emptyPrefs)),
|
: of(stashIds.map(() => emptyPrefs)),
|
||||||
withExposure
|
withExposure
|
||||||
? api.query.staking.erasStakers.multi(stashIds.map((stashId) => [activeEra, stashId]))
|
? combineLatest(stashIds.map((s) => api.query.staking.erasStakers(activeEra, s)))
|
||||||
: of(stashIds.map(() => emptyExpo))
|
: of(stashIds.map(() => emptyExpo))
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import type { DeriveApi } from '../types';
|
|||||||
|
|
||||||
import { BehaviorSubject, combineLatest, map, of, switchMap, tap, toArray } from 'rxjs';
|
import { BehaviorSubject, combineLatest, map, of, switchMap, tap, toArray } from 'rxjs';
|
||||||
|
|
||||||
import { arrayChunk, arrayFlatten } from '@polkadot/util';
|
import { arrayChunk, arrayFlatten, nextTick } from '@polkadot/util';
|
||||||
|
|
||||||
import { memo } from '../util';
|
import { memo } from '../util';
|
||||||
|
|
||||||
@@ -28,13 +28,13 @@ function chunkEras <T> (eras: EraIndex[], fn: (eras: EraIndex[]) => Observable<T
|
|||||||
return subject.pipe(
|
return subject.pipe(
|
||||||
switchMap(fn),
|
switchMap(fn),
|
||||||
tap((): void => {
|
tap((): void => {
|
||||||
setTimeout((): void => {
|
nextTick((): void => {
|
||||||
index++;
|
index++;
|
||||||
|
|
||||||
index === chunked.length
|
index === chunked.length
|
||||||
? subject.complete()
|
? subject.complete()
|
||||||
: subject.next(chunked[index]);
|
: subject.next(chunked[index]);
|
||||||
}, 0);
|
});
|
||||||
}),
|
}),
|
||||||
toArray(),
|
toArray(),
|
||||||
map(arrayFlatten)
|
map(arrayFlatten)
|
||||||
|
|||||||
@@ -23,15 +23,23 @@ function parseResult (api: DeriveApi, { allIds, allProposals, approvalIds, counc
|
|||||||
const approvals: DeriveTreasuryProposal[] = [];
|
const approvals: DeriveTreasuryProposal[] = [];
|
||||||
const proposals: DeriveTreasuryProposal[] = [];
|
const proposals: DeriveTreasuryProposal[] = [];
|
||||||
const councilTreasury = councilProposals.filter(({ proposal }) =>
|
const councilTreasury = councilProposals.filter(({ proposal }) =>
|
||||||
api.tx.treasury.approveProposal.is(proposal) ||
|
proposal && (
|
||||||
api.tx.treasury.rejectProposal.is(proposal)
|
api.tx.treasury.approveProposal.is(proposal) ||
|
||||||
|
api.tx.treasury.rejectProposal.is(proposal)
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
allIds.forEach((id, index): void => {
|
allIds.forEach((id, index): void => {
|
||||||
if (allProposals[index].isSome) {
|
if (allProposals[index].isSome) {
|
||||||
const council = councilTreasury
|
const council = councilTreasury
|
||||||
.filter(({ proposal }) => id.eq(proposal.args[0]))
|
.filter(({ proposal }) => proposal && id.eq(proposal.args[0]))
|
||||||
.sort((a, b) => a.proposal.method.localeCompare(b.proposal.method));
|
.sort((a, b) =>
|
||||||
|
a.proposal && b.proposal
|
||||||
|
? a.proposal.method.localeCompare(b.proposal.method)
|
||||||
|
: a.proposal
|
||||||
|
? -1
|
||||||
|
: 1
|
||||||
|
);
|
||||||
const isApproval = approvalIds.some((approvalId) => approvalId.eq(id));
|
const isApproval = approvalIds.some((approvalId) => approvalId.eq(id));
|
||||||
const derived = { council, id, proposal: allProposals[index].unwrap() };
|
const derived = { council, id, proposal: allProposals[index].unwrap() };
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export interface DeriveContractFees {
|
|||||||
|
|
||||||
export interface DeriveCollectiveProposal {
|
export interface DeriveCollectiveProposal {
|
||||||
hash: Hash;
|
hash: Hash;
|
||||||
proposal: Proposal;
|
proposal: Proposal | null;
|
||||||
votes: Votes | null;
|
votes: Votes | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,3 +7,4 @@ export * from './approvalFlagsToBools';
|
|||||||
export * from './cache';
|
export * from './cache';
|
||||||
export * from './cacheImpl';
|
export * from './cacheImpl';
|
||||||
export * from './first';
|
export * from './first';
|
||||||
|
export * from './lazy';
|
||||||
|
|||||||
+17
-17
@@ -20,29 +20,29 @@
|
|||||||
"./detectPackage.cjs"
|
"./detectPackage.cjs"
|
||||||
],
|
],
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "8.6.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.6.1",
|
"@polkadot/api-augment": "8.8.1",
|
||||||
"@polkadot/api-base": "8.6.1",
|
"@polkadot/api-base": "8.8.1",
|
||||||
"@polkadot/api-derive": "8.6.1",
|
"@polkadot/api-derive": "8.8.1",
|
||||||
"@polkadot/keyring": "^9.3.1",
|
"@polkadot/keyring": "^9.4.1",
|
||||||
"@polkadot/rpc-augment": "8.6.1",
|
"@polkadot/rpc-augment": "8.8.1",
|
||||||
"@polkadot/rpc-core": "8.6.1",
|
"@polkadot/rpc-core": "8.8.1",
|
||||||
"@polkadot/rpc-provider": "8.6.1",
|
"@polkadot/rpc-provider": "8.8.1",
|
||||||
"@polkadot/types": "8.6.1",
|
"@polkadot/types": "8.8.1",
|
||||||
"@polkadot/types-augment": "8.6.1",
|
"@polkadot/types-augment": "8.8.1",
|
||||||
"@polkadot/types-codec": "8.6.1",
|
"@polkadot/types-codec": "8.8.1",
|
||||||
"@polkadot/types-create": "8.6.1",
|
"@polkadot/types-create": "8.8.1",
|
||||||
"@polkadot/types-known": "8.6.1",
|
"@polkadot/types-known": "8.8.1",
|
||||||
"@polkadot/util": "^9.3.1",
|
"@polkadot/util": "^9.4.1",
|
||||||
"@polkadot/util-crypto": "^9.3.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.6.1",
|
"@polkadot/api-augment": "8.8.1",
|
||||||
"@polkadot/types-support": "8.6.1"
|
"@polkadot/types-support": "8.8.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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, 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';
|
||||||
@@ -43,7 +43,8 @@ interface FullDecoration<ApiType extends ApiTypes> {
|
|||||||
|
|
||||||
// the max amount of keys/values that we will retrieve at once
|
// the max amount of keys/values that we will retrieve at once
|
||||||
const PAGE_SIZE_K = 1000; // limit aligned with the 1k on the node (trie lookups are heavy)
|
const PAGE_SIZE_K = 1000; // limit aligned with the 1k on the node (trie lookups are heavy)
|
||||||
const PAGE_SIZE_V = 250; // limited since the data may be very large (e.g. misfiring elections)
|
const PAGE_SIZE_V = 250; // limited since the data may be > 16MB (e.g. misfiring elections)
|
||||||
|
const PAGE_SIZE_Q = 50; // queue of pending storage queries (mapped together, next tick)
|
||||||
|
|
||||||
const l = logger('api/init');
|
const l = logger('api/init');
|
||||||
|
|
||||||
@@ -58,6 +59,10 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
|||||||
|
|
||||||
#registry: Registry;
|
#registry: Registry;
|
||||||
|
|
||||||
|
#storageGetQ: [Observable<Codec[]>, [StorageEntry, unknown[]][]][] = [];
|
||||||
|
|
||||||
|
#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);
|
||||||
|
|
||||||
@@ -238,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,
|
||||||
@@ -280,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 {
|
||||||
@@ -401,18 +407,20 @@ 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((calls: QueryableStorageMultiArg<ApiType>[]): Observable<Codec[]> =>
|
return decorateMethod((keys: QueryableStorageMultiArg<ApiType>[]): Observable<Codec[]> =>
|
||||||
(this.hasSubscriptions
|
(this.hasSubscriptions
|
||||||
? this._rpcCore.state.subscribeStorage
|
? this._rpcCore.state.subscribeStorage
|
||||||
: this._rpcCore.state.queryStorageAt)(
|
: this._rpcCore.state.queryStorageAt
|
||||||
calls.map((args: QueryableStorageMultiArg<ApiType>) =>
|
)(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]
|
||||||
: args[0].creator.meta.type.asMap.hashers.length === 1
|
: args[0].creator.meta.type.asMap.hashers.length === 1
|
||||||
? [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]
|
||||||
|
))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
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> {
|
||||||
@@ -633,18 +641,61 @@ 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 _queueStorage (call: [StorageEntry, unknown[]], queue: [Observable<Codec[]>, [StorageEntry, unknown[]][]][]): Observable<Codec> {
|
||||||
|
const query = queue === this.#storageSubQ
|
||||||
|
? this._rpcCore.state.subscribeStorage
|
||||||
|
: this._rpcCore.state.queryStorageAt;
|
||||||
|
let queueIdx = queue.length - 1;
|
||||||
|
let valueIdx = 0;
|
||||||
|
let valueObs: Observable<Codec[]>;
|
||||||
|
|
||||||
|
if (queueIdx === -1 || !queue[queueIdx] || queue[queueIdx][1].length === PAGE_SIZE_Q) {
|
||||||
|
queueIdx++;
|
||||||
|
|
||||||
|
valueObs = from(
|
||||||
|
// 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
|
||||||
|
Promise
|
||||||
|
.resolve()
|
||||||
|
.then((): [StorageEntry, unknown[]][] => {
|
||||||
|
const calls = queue[queueIdx][1];
|
||||||
|
|
||||||
|
delete queue[queueIdx];
|
||||||
|
|
||||||
|
return calls;
|
||||||
|
})
|
||||||
|
).pipe(
|
||||||
|
switchMap((calls) => query(calls))
|
||||||
|
);
|
||||||
|
|
||||||
|
queue.push([valueObs, [call]]);
|
||||||
|
} else {
|
||||||
|
valueObs = queue[queueIdx][0];
|
||||||
|
valueIdx = queue[queueIdx][1].length;
|
||||||
|
|
||||||
|
queue[queueIdx][1].push(call);
|
||||||
|
}
|
||||||
|
|
||||||
|
return valueObs.pipe(
|
||||||
|
map((values) => values[valueIdx])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Decorate the base storage call. In the case or rxjs or promise-without-callback (await)
|
// Decorate the base storage call. In the case or rxjs or promise-without-callback (await)
|
||||||
// we make a subscription, alternatively we push this through a single-shot query
|
// we make a subscription, alternatively we push this through a single-shot query
|
||||||
private _decorateStorageCall<ApiType extends ApiTypes> (creator: StorageEntry, decorateMethod: DecorateMethod<ApiType>): ReturnType<DecorateMethod<ApiType>> {
|
private _decorateStorageCall<ApiType extends ApiTypes> (creator: StorageEntry, decorateMethod: DecorateMethod<ApiType>): ReturnType<DecorateMethod<ApiType>> {
|
||||||
return decorateMethod((...args: unknown[]): Observable<Codec> => {
|
return decorateMethod((...args: unknown[]): Observable<Codec> => {
|
||||||
return this.hasSubscriptions
|
const call = extractStorageArgs(this.#registry, creator, args);
|
||||||
? this._rpcCore.state.subscribeStorage<[Codec]>([extractStorageArgs(this.#registry, creator, args)]).pipe(
|
|
||||||
map(([data]) => data) // extract first/only result from list
|
if (!this.hasSubscriptions) {
|
||||||
)
|
return this._rpcCore.state.getStorage(call);
|
||||||
: this._rpcCore.state.getStorage(extractStorageArgs(this.#registry, creator, args));
|
}
|
||||||
|
|
||||||
|
return this._queueStorage(call, this.#storageSubQ);
|
||||||
}, {
|
}, {
|
||||||
methodName: creator.method,
|
methodName: creator.method,
|
||||||
overrideNoSub: (...args: unknown[]) => this._rpcCore.state.getStorage(extractStorageArgs(this.#registry, creator, args))
|
overrideNoSub: (...args: unknown[]) =>
|
||||||
|
this._queueStorage(extractStorageArgs(this.#registry, creator, args), this.#storageGetQ)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -667,15 +718,21 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
|
|||||||
return of([]);
|
return of([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const queryCall = this.hasSubscriptions && !blockHash
|
const query = this.hasSubscriptions && !blockHash
|
||||||
? this._rpcCore.state.subscribeStorage
|
? this._rpcCore.state.subscribeStorage
|
||||||
: this._rpcCore.state.queryStorageAt;
|
: this._rpcCore.state.queryStorageAt;
|
||||||
|
|
||||||
|
if (keys.length <= PAGE_SIZE_V) {
|
||||||
|
return blockHash
|
||||||
|
? query(keys, blockHash)
|
||||||
|
: query(keys);
|
||||||
|
}
|
||||||
|
|
||||||
return combineLatest(
|
return combineLatest(
|
||||||
arrayChunk(keys, PAGE_SIZE_V).map((k) =>
|
arrayChunk(keys, PAGE_SIZE_V).map((k) =>
|
||||||
blockHash
|
blockHash
|
||||||
? queryCall(k, blockHash)
|
? query(k, blockHash)
|
||||||
: queryCall(k)
|
: query(k)
|
||||||
)
|
)
|
||||||
).pipe(
|
).pipe(
|
||||||
map(arrayFlatten)
|
map(arrayFlatten)
|
||||||
@@ -687,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) =>
|
||||||
setTimeout((): 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();
|
||||||
}, 0);
|
})
|
||||||
}),
|
),
|
||||||
toArray(), // toArray since we want to startSubject to be completed
|
toArray(), // toArray since we want to startSubject to be completed
|
||||||
map(arrayFlatten)
|
map(arrayFlatten)
|
||||||
);
|
);
|
||||||
@@ -711,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])
|
||||||
)
|
)
|
||||||
@@ -739,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])
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import type { RpcInterface } from '@polkadot/rpc-core/types';
|
import type { RpcInterface } from '@polkadot/rpc-core/types';
|
||||||
|
import type { ProviderInterface } from '@polkadot/rpc-provider/types';
|
||||||
import type { Text } from '@polkadot/types';
|
import type { Text } from '@polkadot/types';
|
||||||
import type { Hash, RuntimeVersion } from '@polkadot/types/interfaces';
|
import type { Hash, RuntimeVersion } from '@polkadot/types/interfaces';
|
||||||
import type { Metadata } from '@polkadot/types/metadata';
|
import type { Metadata } from '@polkadot/types/metadata';
|
||||||
@@ -188,6 +189,13 @@ export abstract class Getters<ApiType extends ApiTypes> extends Init<ApiType> im
|
|||||||
return assertResult(this._rx as Pick<ApiInterfaceRx, 'tx' | 'rpc' | 'query'>);
|
return assertResult(this._rx as Pick<ApiInterfaceRx, 'tx' | 'rpc' | 'query'>);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description Returns the underlying provider stats
|
||||||
|
*/
|
||||||
|
public get stats (): ProviderInterface['stats'] | undefined {
|
||||||
|
return this._rpcCore.provider.stats;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description The type of this API instance, either 'rxjs' or 'promise'
|
* @description The type of this API instance, either 'rxjs' or 'promise'
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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());
|
||||||
|
|||||||
@@ -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.6.1' };
|
export const packageInfo = { name: '@polkadot/api', path: 'auto', type: 'auto', version: '8.8.1' };
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import type { DecorateFn, DecorateMethodOptions, ObsInnerType, StorageEntryPromi
|
|||||||
|
|
||||||
import { catchError, EMPTY, Subscription, tap } from 'rxjs';
|
import { catchError, EMPTY, Subscription, tap } from 'rxjs';
|
||||||
|
|
||||||
import { assert, isFunction } from '@polkadot/util';
|
import { assert, isFunction, nextTick } from '@polkadot/util';
|
||||||
|
|
||||||
interface Tracker<T> {
|
interface Tracker<T> {
|
||||||
reject: (value: Error) => Observable<never>;
|
reject: (value: Error) => Observable<never>;
|
||||||
@@ -75,7 +75,8 @@ function decorateCall<M extends DecorateFn<CodecReturnType<M>>> (method: M, args
|
|||||||
)
|
)
|
||||||
.subscribe((result): void => {
|
.subscribe((result): void => {
|
||||||
tracker.resolve(result);
|
tracker.resolve(result);
|
||||||
setTimeout(() => subscription.unsubscribe(), 0);
|
|
||||||
|
nextTick(() => subscription.unsubscribe());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -94,7 +95,7 @@ function decorateSubscribe<M extends DecorateFn<CodecReturnType<M>>> (method: M,
|
|||||||
)
|
)
|
||||||
.subscribe((result): void => {
|
.subscribe((result): void => {
|
||||||
// queue result (back of queue to clear current)
|
// queue result (back of queue to clear current)
|
||||||
setTimeout(() => resultCb(result) as void, 0);
|
nextTick(() => resultCb(result));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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'>;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -20,13 +20,13 @@
|
|||||||
"./detectPackage.cjs"
|
"./detectPackage.cjs"
|
||||||
],
|
],
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "8.6.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.6.1",
|
"@polkadot/rpc-core": "8.8.1",
|
||||||
"@polkadot/types": "8.6.1",
|
"@polkadot/types": "8.8.1",
|
||||||
"@polkadot/types-codec": "8.6.1",
|
"@polkadot/types-codec": "8.8.1",
|
||||||
"@polkadot/util": "^9.3.1"
|
"@polkadot/util": "^9.4.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.6.1' };
|
export const packageInfo = { name: '@polkadot/rpc-augment', path: 'auto', type: 'auto', version: '8.8.1' };
|
||||||
|
|||||||
@@ -20,18 +20,18 @@
|
|||||||
"./detectPackage.cjs"
|
"./detectPackage.cjs"
|
||||||
],
|
],
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "8.6.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.6.1",
|
"@polkadot/rpc-augment": "8.8.1",
|
||||||
"@polkadot/rpc-provider": "8.6.1",
|
"@polkadot/rpc-provider": "8.8.1",
|
||||||
"@polkadot/types": "8.6.1",
|
"@polkadot/types": "8.8.1",
|
||||||
"@polkadot/util": "^9.3.1",
|
"@polkadot/util": "^9.4.1",
|
||||||
"rxjs": "^7.5.5"
|
"rxjs": "^7.5.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@polkadot/keyring": "^9.3.1",
|
"@polkadot/keyring": "^9.4.1",
|
||||||
"@polkadot/rpc-augment": "8.6.1"
|
"@polkadot/rpc-augment": "8.8.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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(', ');
|
||||||
@@ -87,7 +91,7 @@ export class RpcCore {
|
|||||||
#getBlockRegistry?: (blockHash: Uint8Array) => Promise<{ registry: Registry }>;
|
#getBlockRegistry?: (blockHash: Uint8Array) => Promise<{ registry: Registry }>;
|
||||||
#getBlockHash?: (blockNumber: AnyNumber) => Promise<Uint8Array>;
|
#getBlockHash?: (blockNumber: AnyNumber) => Promise<Uint8Array>;
|
||||||
|
|
||||||
readonly #storageCache = new Map<string, string | null>();
|
readonly #storageCache = new Map<string, Codec>();
|
||||||
|
|
||||||
public readonly mapping = new Map<string, DefinitionRpcExt>();
|
public readonly mapping = new Map<string, DefinitionRpcExt>();
|
||||||
|
|
||||||
@@ -418,28 +422,38 @@ export class RpcCore {
|
|||||||
}, []);
|
}, []);
|
||||||
}
|
}
|
||||||
|
|
||||||
private _formatStorageSetEntry (registry: Registry, blockHash: string, key: StorageKey, changes: [string, string | null][], witCache: boolean, entryIndex: number): Codec {
|
private _formatStorageSetEntry (registry: Registry, blockHash: string, key: StorageKey, changes: [string, string | null][], withCache: boolean, entryIndex: number): Codec {
|
||||||
const hexKey = key.toHex();
|
const hexKey = key.toHex();
|
||||||
const found = changes.find(([key]) => key === hexKey);
|
const found = changes.find(([key]) => key === hexKey);
|
||||||
|
const isNotFound = isUndefined(found);
|
||||||
|
|
||||||
// if we don't find the value, this is our fallback
|
// if we don't find the value, this is our fallback
|
||||||
// - in the case of an array of values, fill the hole from the cache
|
// - in the case of an array of values, fill the hole from the cache
|
||||||
// - if a single result value, don't fill - it is not an update hole
|
// - if a single result value, don't fill - it is not an update hole
|
||||||
// - fallback to an empty option in all cases
|
// - fallback to an empty option in all cases
|
||||||
const value = isUndefined(found)
|
if (isNotFound && withCache) {
|
||||||
? (witCache && this.#storageCache.get(hexKey)) || null
|
const cached = this.#storageCache.get(hexKey);
|
||||||
|
|
||||||
|
if (cached) {
|
||||||
|
return cached;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const value = isNotFound
|
||||||
|
? null
|
||||||
: found[1];
|
: found[1];
|
||||||
const isEmpty = isNull(value);
|
const isEmpty = isNull(value);
|
||||||
const input = isEmpty || isTreatAsHex(key)
|
const input = isEmpty || isTreatAsHex(key)
|
||||||
? value
|
? value
|
||||||
: u8aToU8a(value);
|
: u8aToU8a(value);
|
||||||
|
const codec = this._newType(registry, blockHash, key, input, isEmpty, entryIndex);
|
||||||
|
|
||||||
// store the retrieved result - the only issue with this cache is that there is no
|
// store the retrieved result - the only issue with this cache is that there is no
|
||||||
// clearing of it, so very long running processes (not just a couple of hours, longer)
|
// clearing of it, so very long running processes (not just a couple of hours, longer)
|
||||||
// will increase memory beyond what is allowed.
|
// will increase memory beyond what is allowed.
|
||||||
this.#storageCache.set(hexKey, value);
|
this.#storageCache.set(hexKey, codec);
|
||||||
|
|
||||||
return this._newType(registry, blockHash, key, input, isEmpty, entryIndex);
|
return codec;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _newType (registry: Registry, blockHash: Uint8Array | string | null | undefined, key: StorageKey, input: string | Uint8Array | null, isEmpty: boolean, entryIndex = -1): Codec {
|
private _newType (registry: Registry, blockHash: Uint8Array | string | null | undefined, key: StorageKey, input: string | Uint8Array | null, isEmpty: boolean, entryIndex = -1): Codec {
|
||||||
|
|||||||
@@ -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.6.1' };
|
export const packageInfo = { name: '@polkadot/rpc-core', path: 'auto', type: 'auto', version: '8.8.1' };
|
||||||
|
|||||||
@@ -20,21 +20,21 @@
|
|||||||
"./detectPackage.cjs"
|
"./detectPackage.cjs"
|
||||||
],
|
],
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "8.6.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.3.1",
|
"@polkadot/keyring": "^9.4.1",
|
||||||
"@polkadot/types": "8.6.1",
|
"@polkadot/types": "8.8.1",
|
||||||
"@polkadot/types-support": "8.6.1",
|
"@polkadot/types-support": "8.8.1",
|
||||||
"@polkadot/util": "^9.3.1",
|
"@polkadot/util": "^9.4.1",
|
||||||
"@polkadot/util-crypto": "^9.3.1",
|
"@polkadot/util-crypto": "^9.4.1",
|
||||||
"@polkadot/x-fetch": "^9.3.1",
|
"@polkadot/x-fetch": "^9.4.1",
|
||||||
"@polkadot/x-global": "^9.3.1",
|
"@polkadot/x-global": "^9.4.1",
|
||||||
"@polkadot/x-ws": "^9.3.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.4"
|
"nock": "^13.2.6"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ export class HttpProvider implements ProviderInterface {
|
|||||||
this.#headers = headers;
|
this.#headers = headers;
|
||||||
this.#stats = {
|
this.#stats = {
|
||||||
active: { requests: 0, subscriptions: 0 },
|
active: { requests: 0, subscriptions: 0 },
|
||||||
total: { bytesRecv: 0, bytesSent: 0, cached: 0, requests: 0, subscriptions: 0, timeout: 0 }
|
total: { bytesRecv: 0, bytesSent: 0, cached: 0, errors: 0, requests: 0, subscriptions: 0, timeout: 0 }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,6 +169,7 @@ export class HttpProvider implements ProviderInterface {
|
|||||||
return decoded;
|
return decoded;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.#stats.active.requests--;
|
this.#stats.active.requests--;
|
||||||
|
this.#stats.total.errors++;
|
||||||
|
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
// Copyright 2017-2022 @polkadot/rpc-provider authors & contributors
|
// Copyright 2017-2022 @polkadot/rpc-provider authors & contributors
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
// Assuming all 1.5MB responses, we apply a default allowing for 576MB
|
// Assuming all 1.5MB responses, we apply a default allowing for 192MB
|
||||||
// cache space (depending on the historic queries this would vary, metadata
|
// cache space (depending on the historic queries this would vary, metadata
|
||||||
// for Kusama/Polkadot/Substrate falls between 600-750K, 2x for estimate)
|
// for Kusama/Polkadot/Substrate falls between 600-750K, 2x for estimate)
|
||||||
const DEFAULT_CAPACITY = 384;
|
const DEFAULT_CAPACITY = 128;
|
||||||
|
|
||||||
class LRUNode {
|
class LRUNode {
|
||||||
public readonly key: string;
|
public readonly key: string;
|
||||||
|
|||||||
@@ -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.6.1' };
|
export const packageInfo = { name: '@polkadot/rpc-provider', path: 'auto', type: 'auto', version: '8.8.1' };
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ export interface ProviderStats {
|
|||||||
bytesRecv: number;
|
bytesRecv: number;
|
||||||
bytesSent: number;
|
bytesSent: number;
|
||||||
cached: number;
|
cached: number;
|
||||||
|
errors: number;
|
||||||
requests: number;
|
requests: number;
|
||||||
subscriptions: number;
|
subscriptions: number;
|
||||||
timeout: number;
|
timeout: number;
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ export class WsProvider implements ProviderInterface {
|
|||||||
this.#websocket = null;
|
this.#websocket = null;
|
||||||
this.#stats = {
|
this.#stats = {
|
||||||
active: { requests: 0, subscriptions: 0 },
|
active: { requests: 0, subscriptions: 0 },
|
||||||
total: { bytesRecv: 0, bytesSent: 0, cached: 0, requests: 0, subscriptions: 0, timeout: 0 }
|
total: { bytesRecv: 0, bytesSent: 0, cached: 0, errors: 0, requests: 0, subscriptions: 0, timeout: 0 }
|
||||||
};
|
};
|
||||||
this.#timeout = timeout || DEFAULT_TIMEOUT_MS;
|
this.#timeout = timeout || DEFAULT_TIMEOUT_MS;
|
||||||
|
|
||||||
@@ -300,7 +300,7 @@ export class WsProvider implements ProviderInterface {
|
|||||||
|
|
||||||
const [id, body] = this.#coder.encodeJson(method, params);
|
const [id, body] = this.#coder.encodeJson(method, params);
|
||||||
let resultPromise: Promise<T> | null = isCacheable
|
let resultPromise: Promise<T> | null = isCacheable
|
||||||
? this.#callCache.get(body) as Promise<T>
|
? this.#callCache.get(body)
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
if (!resultPromise) {
|
if (!resultPromise) {
|
||||||
@@ -339,6 +339,8 @@ export class WsProvider implements ProviderInterface {
|
|||||||
this.#stats.total.bytesSent += body.length;
|
this.#stats.total.bytesSent += body.length;
|
||||||
this.#websocket.send(body);
|
this.#websocket.send(body);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
this.#stats.total.errors++;
|
||||||
|
|
||||||
reject(error);
|
reject(error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -492,6 +494,8 @@ export class WsProvider implements ProviderInterface {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
this.#stats.total.errors++;
|
||||||
|
|
||||||
handler.callback(error as Error, undefined);
|
handler.callback(error as Error, undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -520,6 +524,8 @@ export class WsProvider implements ProviderInterface {
|
|||||||
|
|
||||||
handler.callback(null, result);
|
handler.callback(null, result);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
this.#stats.total.errors++;
|
||||||
|
|
||||||
handler.callback(error as Error, undefined);
|
handler.callback(error as Error, undefined);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
"./detectPackage.cjs"
|
"./detectPackage.cjs"
|
||||||
],
|
],
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "8.6.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,17 +33,17 @@
|
|||||||
"@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.6.1",
|
"@polkadot/api": "8.8.1",
|
||||||
"@polkadot/api-augment": "8.6.1",
|
"@polkadot/api-augment": "8.8.1",
|
||||||
"@polkadot/rpc-augment": "8.6.1",
|
"@polkadot/rpc-augment": "8.8.1",
|
||||||
"@polkadot/rpc-provider": "8.6.1",
|
"@polkadot/rpc-provider": "8.8.1",
|
||||||
"@polkadot/types": "8.6.1",
|
"@polkadot/types": "8.8.1",
|
||||||
"@polkadot/types-augment": "8.6.1",
|
"@polkadot/types-augment": "8.8.1",
|
||||||
"@polkadot/types-codec": "8.6.1",
|
"@polkadot/types-codec": "8.8.1",
|
||||||
"@polkadot/types-create": "8.6.1",
|
"@polkadot/types-create": "8.8.1",
|
||||||
"@polkadot/types-support": "8.6.1",
|
"@polkadot/types-support": "8.8.1",
|
||||||
"@polkadot/util": "^9.3.1",
|
"@polkadot/util": "^9.4.1",
|
||||||
"@polkadot/x-ws": "^9.3.1",
|
"@polkadot/x-ws": "^9.4.1",
|
||||||
"handlebars": "^4.7.7",
|
"handlebars": "^4.7.7",
|
||||||
"websocket": "^1.0.34",
|
"websocket": "^1.0.34",
|
||||||
"yargs": "^17.5.1"
|
"yargs": "^17.5.1"
|
||||||
|
|||||||
@@ -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),
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ function tsEnum (registry: Registry, definitions: Record<string, ModuleTypes>, {
|
|||||||
const keys = named.map((def): string => {
|
const keys = named.map((def): string => {
|
||||||
const { info, lookupName, name = '', type } = def;
|
const { info, lookupName, name = '', type } = def;
|
||||||
const getter = stringPascalCase(name.replace(' ', '_'));
|
const getter = stringPascalCase(name.replace(' ', '_'));
|
||||||
const isComplex = [TypeDefInfo.Option, TypeDefInfo.Result, TypeDefInfo.Struct, TypeDefInfo.Tuple, TypeDefInfo.Vec, TypeDefInfo.VecFixed].includes(info);
|
const isComplex = [TypeDefInfo.Option, TypeDefInfo.Range, TypeDefInfo.RangeInclusive, TypeDefInfo.Result, TypeDefInfo.Struct, TypeDefInfo.Tuple, TypeDefInfo.Vec, TypeDefInfo.VecFixed].includes(info);
|
||||||
const asGetter = type === 'Null' || info === TypeDefInfo.DoNotConstruct
|
const asGetter = type === 'Null' || info === TypeDefInfo.DoNotConstruct
|
||||||
? ''
|
? ''
|
||||||
: createGetter(definitions, `as${getter}`, lookupName || (isComplex ? formatType(registry, definitions, info === TypeDefInfo.Struct ? def : type, imports, false) : type), imports);
|
: createGetter(definitions, `as${getter}`, lookupName || (isComplex ? formatType(registry, definitions, info === TypeDefInfo.Struct ? def : type, imports, false) : type), imports);
|
||||||
@@ -61,6 +61,8 @@ function tsEnum (registry: Registry, definitions: Record<string, ModuleTypes>, {
|
|||||||
switch (info) {
|
switch (info) {
|
||||||
case TypeDefInfo.Compact:
|
case TypeDefInfo.Compact:
|
||||||
case TypeDefInfo.Plain:
|
case TypeDefInfo.Plain:
|
||||||
|
case TypeDefInfo.Range:
|
||||||
|
case TypeDefInfo.RangeInclusive:
|
||||||
case TypeDefInfo.Result:
|
case TypeDefInfo.Result:
|
||||||
case TypeDefInfo.Si:
|
case TypeDefInfo.Si:
|
||||||
case TypeDefInfo.Struct:
|
case TypeDefInfo.Struct:
|
||||||
|
|||||||
@@ -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.6.1' };
|
export const packageInfo = { name: '@polkadot/typegen', path: 'auto', type: 'auto', version: '8.8.1' };
|
||||||
|
|||||||
@@ -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}}
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -20,12 +20,12 @@
|
|||||||
"./detectPackage.cjs"
|
"./detectPackage.cjs"
|
||||||
],
|
],
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "8.6.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.6.1",
|
"@polkadot/types": "8.8.1",
|
||||||
"@polkadot/types-codec": "8.6.1",
|
"@polkadot/types-codec": "8.8.1",
|
||||||
"@polkadot/util": "^9.3.1"
|
"@polkadot/util": "^9.4.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.6.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;
|
||||||
|
|||||||
@@ -20,16 +20,16 @@
|
|||||||
"./detectPackage.cjs"
|
"./detectPackage.cjs"
|
||||||
],
|
],
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "8.6.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.3.1"
|
"@polkadot/util": "^9.4.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@polkadot/types": "8.6.1",
|
"@polkadot/types": "8.8.1",
|
||||||
"@polkadot/types-augment": "8.6.1",
|
"@polkadot/types-augment": "8.8.1",
|
||||||
"@polkadot/types-support": "8.6.1",
|
"@polkadot/types-support": "8.8.1",
|
||||||
"@polkadot/util-crypto": "^9.3.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);
|
||||||
|
|||||||
@@ -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 => {
|
||||||
|
|||||||
@@ -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>> {
|
||||||
|
|||||||
@@ -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.6.1' };
|
export const packageInfo = { name: '@polkadot/types-codec', path: 'auto', type: 'auto', version: '8.8.1' };
|
||||||
|
|||||||
@@ -20,14 +20,14 @@
|
|||||||
"./detectPackage.cjs"
|
"./detectPackage.cjs"
|
||||||
],
|
],
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "8.6.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.6.1",
|
"@polkadot/types-codec": "8.8.1",
|
||||||
"@polkadot/util": "^9.3.1"
|
"@polkadot/util": "^9.4.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@polkadot/types": "8.6.1"
|
"@polkadot/types": "8.8.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
import type { Codec, CodecClass, Registry, U8aBitLength, UIntBitLength } from '@polkadot/types-codec/types';
|
import type { Codec, CodecClass, Registry, U8aBitLength, UIntBitLength } from '@polkadot/types-codec/types';
|
||||||
import type { TypeDef } from '../types';
|
import type { TypeDef } from '../types';
|
||||||
|
|
||||||
import { BTreeMap, BTreeSet, Bytes, CodecSet, Compact, DoNotConstruct, Enum, HashMap, Int, Null, Option, OptionBool, Range, RangeInclusive, Result, Struct, Tuple, U8aFixed, UInt, Vec, VecFixed, WrapperKeepOpaque, WrapperOpaque } from '@polkadot/types-codec';
|
import { BTreeMap, BTreeSet, Bytes, CodecSet, Compact, DoNotConstruct, Enum, HashMap, Int, Null, Option, Range, RangeInclusive, Result, Struct, Tuple, U8aFixed, UInt, Vec, VecFixed, WrapperKeepOpaque, WrapperOpaque } from '@polkadot/types-codec';
|
||||||
import { assert, isNumber, stringify } from '@polkadot/util';
|
import { assert, isNumber, stringify } from '@polkadot/util';
|
||||||
|
|
||||||
import { TypeDefInfo } from '../types';
|
import { TypeDefInfo } from '../types';
|
||||||
@@ -118,11 +118,12 @@ const infoMapping: Record<TypeDefInfo, (registry: Registry, value: TypeDef) => C
|
|||||||
[TypeDefInfo.Option]: (registry: Registry, value: TypeDef): CodecClass<Codec> => {
|
[TypeDefInfo.Option]: (registry: Registry, value: TypeDef): CodecClass<Codec> => {
|
||||||
assert(value.sub && !Array.isArray(value.sub), 'Expected type information for Option');
|
assert(value.sub && !Array.isArray(value.sub), 'Expected type information for Option');
|
||||||
|
|
||||||
return (
|
// NOTE This is opt-in (unhandled), not by default
|
||||||
value.sub.type === 'bool'
|
// if (value.sub.type === 'bool') {
|
||||||
? OptionBool
|
// return OptionBool;
|
||||||
: createWithSub(Option, value)
|
// }
|
||||||
);
|
|
||||||
|
return createWithSub(Option, value);
|
||||||
},
|
},
|
||||||
|
|
||||||
[TypeDefInfo.Plain]: (registry: Registry, value: TypeDef): CodecClass<Codec> =>
|
[TypeDefInfo.Plain]: (registry: Registry, value: TypeDef): CodecClass<Codec> =>
|
||||||
|
|||||||
@@ -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.6.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];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,14 +20,14 @@
|
|||||||
"./detectPackage.cjs"
|
"./detectPackage.cjs"
|
||||||
],
|
],
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "8.6.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.3.1",
|
"@polkadot/networks": "^9.4.1",
|
||||||
"@polkadot/types": "8.6.1",
|
"@polkadot/types": "8.8.1",
|
||||||
"@polkadot/types-codec": "8.6.1",
|
"@polkadot/types-codec": "8.8.1",
|
||||||
"@polkadot/types-create": "8.6.1",
|
"@polkadot/types-create": "8.8.1",
|
||||||
"@polkadot/util": "^9.3.1"
|
"@polkadot/util": "^9.4.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.6.1' };
|
export const packageInfo = { name: '@polkadot/types-known', path: 'auto', type: 'auto', version: '8.8.1' };
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ const upgrades: ChainUpgradesRaw = [
|
|||||||
[7812476, 9040], [8010981, 9050], [8073833, 9070], [8555825, 9080], [8945245, 9090],
|
[7812476, 9040], [8010981, 9050], [8073833, 9070], [8555825, 9080], [8945245, 9090],
|
||||||
[9611377, 9100], [9625129, 9111], [9866422, 9122], [10403784, 9130], [10960765, 9150],
|
[9611377, 9100], [9625129, 9111], [9866422, 9122], [10403784, 9130], [10960765, 9150],
|
||||||
[11006614, 9151], [11404482, 9160], [11601803, 9170], [12008022, 9180], [12405451, 9190],
|
[11006614, 9151], [11404482, 9160], [11601803, 9170], [12008022, 9180], [12405451, 9190],
|
||||||
[12665416, 9200]
|
[12665416, 9200], [12909508, 9220]
|
||||||
];
|
];
|
||||||
|
|
||||||
export default upgrades;
|
export default upgrades;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -20,10 +20,10 @@
|
|||||||
"./detectPackage.cjs"
|
"./detectPackage.cjs"
|
||||||
],
|
],
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "8.6.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.3.1"
|
"@polkadot/util": "^9.4.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.6.1' };
|
export const packageInfo = { name: '@polkadot/types-support', path: 'auto', type: 'auto', version: '8.8.1' };
|
||||||
|
|||||||
@@ -20,20 +20,20 @@
|
|||||||
"./detectPackage.cjs"
|
"./detectPackage.cjs"
|
||||||
],
|
],
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "8.6.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.3.1",
|
"@polkadot/keyring": "^9.4.1",
|
||||||
"@polkadot/types-augment": "8.6.1",
|
"@polkadot/types-augment": "8.8.1",
|
||||||
"@polkadot/types-codec": "8.6.1",
|
"@polkadot/types-codec": "8.8.1",
|
||||||
"@polkadot/types-create": "8.6.1",
|
"@polkadot/types-create": "8.8.1",
|
||||||
"@polkadot/util": "^9.3.1",
|
"@polkadot/util": "^9.4.1",
|
||||||
"@polkadot/util-crypto": "^9.3.1",
|
"@polkadot/util-crypto": "^9.4.1",
|
||||||
"rxjs": "^7.5.5"
|
"rxjs": "^7.5.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@polkadot/keyring": "^9.3.1",
|
"@polkadot/keyring": "^9.4.1",
|
||||||
"@polkadot/types-support": "8.6.1"
|
"@polkadot/types-support": "8.8.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ const nf = registry.createType('[[[u8;32];5];3]');
|
|||||||
// with linkage
|
// with linkage
|
||||||
const tl = registry.createType('(ValidatorPrefsWithCommission, Linkage<AccountId>)');
|
const tl = registry.createType('(ValidatorPrefsWithCommission, Linkage<AccountId>)');
|
||||||
|
|
||||||
assert(ee[0].unwrap().unwrap().divn(123) && vb.unwrap().bitLength() && vv.toHuman() && vn[0][3][0].bitLength && vt.toHuman() && nf.toHuman() && tl[1].next, 'All ok');
|
assert(ee[0].unwrap().unwrap().divn(123) && vb.unwrap().bitLength() && vv.toHuman() && vn[0][3][0].bitLength() && vt.toHuman() && nf.toHuman() && tl[1].next, 'All ok');
|
||||||
|
|
||||||
// tuple & struct
|
// tuple & struct
|
||||||
const vs = registry.createType('(u8, {"a":"u32","b":"(u32,u64)"},(u8,u16),{"foo":"Bar"},u16)');
|
const vs = registry.createType('(u8, {"a":"u32","b":"(u32,u64)"},(u8,u16),{"foo":"Bar"},u16)');
|
||||||
@@ -76,7 +76,7 @@ const hh = registry.createType('[u128; 32]');
|
|||||||
// maps and sets
|
// maps and sets
|
||||||
const ms = registry.createType('(BTreeSet<u8>, BTreeMap<u16, u32>, HashMap<u64, u128>)');
|
const ms = registry.createType('(BTreeSet<u8>, BTreeMap<u16, u32>, HashMap<u64, u128>)');
|
||||||
|
|
||||||
assert(hh[0].bitLength() && ms[0].strings && ms[1].values && ms[2].keys, 'All ok');
|
assert(hh[0].bitLength() && ms[0].strings && ms[1].values() && ms[2].keys, 'All ok');
|
||||||
|
|
||||||
// tuple! ITuple<[u32, Compact<u64>, u128, Codec]>
|
// tuple! ITuple<[u32, Compact<u64>, u128, Codec]>
|
||||||
const tt1 = registry.createType('(u32, Compact<u64>, u128 , Something)');
|
const tt1 = registry.createType('(u32, Compact<u64>, u128 , Something)');
|
||||||
|
|||||||
@@ -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 || (
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|
||||||
|
|||||||
@@ -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',
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user