@polymeshassociation/polymesh-sdk 31.0.0 → 31.1.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (271) hide show
  1. package/.yarn/install-state.gz +0 -0
  2. package/CHANGELOG.md +6 -132
  3. package/api/client/AccountManagement.d.ts +48 -0
  4. package/api/client/AccountManagement.d.ts.map +1 -1
  5. package/api/client/AccountManagement.js +38 -0
  6. package/api/client/AccountManagement.js.map +1 -1
  7. package/api/client/Assets.d.ts.map +1 -1
  8. package/api/client/Assets.js +4 -5
  9. package/api/client/Assets.js.map +1 -1
  10. package/api/client/Claims.d.ts +5 -0
  11. package/api/client/Claims.d.ts.map +1 -1
  12. package/api/client/Claims.js +5 -2
  13. package/api/client/Claims.js.map +1 -1
  14. package/api/client/Network.d.ts +104 -3
  15. package/api/client/Network.d.ts.map +1 -1
  16. package/api/client/Network.js +162 -14
  17. package/api/client/Network.js.map +1 -1
  18. package/api/client/Polymesh.d.ts.map +1 -1
  19. package/api/client/Polymesh.js +5 -6
  20. package/api/client/Polymesh.js.map +1 -1
  21. package/api/client/Staking.d.ts +206 -5
  22. package/api/client/Staking.d.ts.map +1 -1
  23. package/api/client/Staking.js +443 -1
  24. package/api/client/Staking.js.map +1 -1
  25. package/api/client/types.d.ts +281 -5
  26. package/api/client/types.d.ts.map +1 -1
  27. package/api/client/types.js +29 -1
  28. package/api/client/types.js.map +1 -1
  29. package/api/entities/Account/MultiSig/index.d.ts +6 -0
  30. package/api/entities/Account/MultiSig/index.d.ts.map +1 -1
  31. package/api/entities/Account/MultiSig/index.js +6 -2
  32. package/api/entities/Account/MultiSig/index.js.map +1 -1
  33. package/api/entities/Account/Staking/index.d.ts +26 -2
  34. package/api/entities/Account/Staking/index.d.ts.map +1 -1
  35. package/api/entities/Account/Staking/index.js +36 -3
  36. package/api/entities/Account/Staking/index.js.map +1 -1
  37. package/api/entities/Account/index.d.ts +42 -3
  38. package/api/entities/Account/index.d.ts.map +1 -1
  39. package/api/entities/Account/index.js +94 -1
  40. package/api/entities/Account/index.js.map +1 -1
  41. package/api/entities/Account/types.d.ts +61 -2
  42. package/api/entities/Account/types.d.ts.map +1 -1
  43. package/api/entities/Account/types.js +25 -1
  44. package/api/entities/Account/types.js.map +1 -1
  45. package/api/entities/Asset/Base/BaseAsset.js +1 -1
  46. package/api/entities/Asset/Base/BaseAsset.js.map +1 -1
  47. package/api/entities/Asset/Fungible/index.d.ts +6 -0
  48. package/api/entities/Asset/Fungible/index.d.ts.map +1 -1
  49. package/api/entities/Asset/Fungible/index.js +6 -2
  50. package/api/entities/Asset/Fungible/index.js.map +1 -1
  51. package/api/entities/Asset/NonFungible/Nft.js +1 -1
  52. package/api/entities/Asset/NonFungible/Nft.js.map +1 -1
  53. package/api/entities/Asset/NonFungible/NftCollection.d.ts +6 -0
  54. package/api/entities/Asset/NonFungible/NftCollection.d.ts.map +1 -1
  55. package/api/entities/Asset/NonFungible/NftCollection.js +8 -4
  56. package/api/entities/Asset/NonFungible/NftCollection.js.map +1 -1
  57. package/api/entities/Asset/types.d.ts +11 -0
  58. package/api/entities/Asset/types.d.ts.map +1 -1
  59. package/api/entities/Asset/types.js.map +1 -1
  60. package/api/entities/AuthorizationRequest.js +1 -1
  61. package/api/entities/AuthorizationRequest.js.map +1 -1
  62. package/api/entities/Checkpoint.js +1 -1
  63. package/api/entities/Checkpoint.js.map +1 -1
  64. package/api/entities/CheckpointSchedule/index.js +1 -1
  65. package/api/entities/CheckpointSchedule/index.js.map +1 -1
  66. package/api/entities/CorporateActionBase/index.js +1 -1
  67. package/api/entities/CorporateActionBase/index.js.map +1 -1
  68. package/api/entities/CustomPermissionGroup.js +1 -1
  69. package/api/entities/CustomPermissionGroup.js.map +1 -1
  70. package/api/entities/DividendDistribution/index.d.ts +6 -0
  71. package/api/entities/DividendDistribution/index.d.ts.map +1 -1
  72. package/api/entities/DividendDistribution/index.js +6 -2
  73. package/api/entities/DividendDistribution/index.js.map +1 -1
  74. package/api/entities/Identity/AssetPermissions.d.ts +5 -1
  75. package/api/entities/Identity/AssetPermissions.d.ts.map +1 -1
  76. package/api/entities/Identity/AssetPermissions.js +5 -2
  77. package/api/entities/Identity/AssetPermissions.js.map +1 -1
  78. package/api/entities/Identity/IdentityAuthorizations.d.ts +5 -0
  79. package/api/entities/Identity/IdentityAuthorizations.d.ts.map +1 -1
  80. package/api/entities/Identity/IdentityAuthorizations.js +5 -0
  81. package/api/entities/Identity/IdentityAuthorizations.js.map +1 -1
  82. package/api/entities/Identity/Portfolios.js +1 -1
  83. package/api/entities/Identity/Portfolios.js.map +1 -1
  84. package/api/entities/Identity/index.d.ts +50 -1
  85. package/api/entities/Identity/index.d.ts.map +1 -1
  86. package/api/entities/Identity/index.js +76 -9
  87. package/api/entities/Identity/index.js.map +1 -1
  88. package/api/entities/Instruction/index.js +1 -1
  89. package/api/entities/Instruction/index.js.map +1 -1
  90. package/api/entities/MetadataEntry/index.js +1 -1
  91. package/api/entities/MetadataEntry/index.js.map +1 -1
  92. package/api/entities/NumberedPortfolio.d.ts +4 -0
  93. package/api/entities/NumberedPortfolio.d.ts.map +1 -1
  94. package/api/entities/NumberedPortfolio.js +1 -1
  95. package/api/entities/NumberedPortfolio.js.map +1 -1
  96. package/api/entities/Offering/index.d.ts +5 -0
  97. package/api/entities/Offering/index.d.ts.map +1 -1
  98. package/api/entities/Offering/index.js +6 -3
  99. package/api/entities/Offering/index.js.map +1 -1
  100. package/api/entities/Portfolio/index.d.ts +22 -0
  101. package/api/entities/Portfolio/index.d.ts.map +1 -1
  102. package/api/entities/Portfolio/index.js +99 -21
  103. package/api/entities/Portfolio/index.js.map +1 -1
  104. package/api/entities/Venue/index.d.ts +3 -0
  105. package/api/entities/Venue/index.d.ts.map +1 -1
  106. package/api/entities/Venue/index.js +4 -1
  107. package/api/entities/Venue/index.js.map +1 -1
  108. package/api/entities/common/namespaces/Authorizations.d.ts +16 -2
  109. package/api/entities/common/namespaces/Authorizations.d.ts.map +1 -1
  110. package/api/entities/common/namespaces/Authorizations.js +16 -4
  111. package/api/entities/common/namespaces/Authorizations.js.map +1 -1
  112. package/api/procedures/acceptPrimaryKeyRotation.js +1 -1
  113. package/api/procedures/acceptPrimaryKeyRotation.js.map +1 -1
  114. package/api/procedures/bondPolyx.d.ts +14 -2
  115. package/api/procedures/bondPolyx.d.ts.map +1 -1
  116. package/api/procedures/bondPolyx.js +39 -8
  117. package/api/procedures/bondPolyx.js.map +1 -1
  118. package/api/procedures/chillStaking.d.ts +36 -0
  119. package/api/procedures/chillStaking.d.ts.map +1 -0
  120. package/api/procedures/chillStaking.js +72 -0
  121. package/api/procedures/chillStaking.js.map +1 -0
  122. package/api/procedures/claimDividends.d.ts.map +1 -1
  123. package/api/procedures/claimDividends.js +11 -1
  124. package/api/procedures/claimDividends.js.map +1 -1
  125. package/api/procedures/configureDividendDistribution.js +2 -2
  126. package/api/procedures/configureDividendDistribution.js.map +1 -1
  127. package/api/procedures/issueNft.d.ts +1 -0
  128. package/api/procedures/issueNft.d.ts.map +1 -1
  129. package/api/procedures/issueNft.js +24 -6
  130. package/api/procedures/issueNft.js.map +1 -1
  131. package/api/procedures/modifyAsset.js +1 -1
  132. package/api/procedures/modifyAsset.js.map +1 -1
  133. package/api/procedures/moveFunds.js +2 -2
  134. package/api/procedures/moveFunds.js.map +1 -1
  135. package/api/procedures/nominateValidators.d.ts +6 -1
  136. package/api/procedures/nominateValidators.d.ts.map +1 -1
  137. package/api/procedures/nominateValidators.js +45 -6
  138. package/api/procedures/nominateValidators.js.map +1 -1
  139. package/api/procedures/redeemNft.js +1 -1
  140. package/api/procedures/redeemNft.js.map +1 -1
  141. package/api/procedures/redeemTokens.js +1 -1
  142. package/api/procedures/redeemTokens.js.map +1 -1
  143. package/api/procedures/removeAssetRequirement.js +1 -1
  144. package/api/procedures/removeAssetRequirement.js.map +1 -1
  145. package/api/procedures/removeCheckpointSchedule.js +1 -1
  146. package/api/procedures/removeCheckpointSchedule.js.map +1 -1
  147. package/api/procedures/removeCorporateAction.js +3 -3
  148. package/api/procedures/removeCorporateAction.js.map +1 -1
  149. package/api/procedures/setCustodian.d.ts +5 -1
  150. package/api/procedures/setCustodian.d.ts.map +1 -1
  151. package/api/procedures/setCustodian.js +2 -6
  152. package/api/procedures/setCustodian.js.map +1 -1
  153. package/api/procedures/setStakingController.d.ts +9 -1
  154. package/api/procedures/setStakingController.d.ts.map +1 -1
  155. package/api/procedures/setStakingController.js +10 -6
  156. package/api/procedures/setStakingController.js.map +1 -1
  157. package/api/procedures/setStakingPayee.d.ts +9 -1
  158. package/api/procedures/setStakingPayee.d.ts.map +1 -1
  159. package/api/procedures/setStakingPayee.js +10 -6
  160. package/api/procedures/setStakingPayee.js.map +1 -1
  161. package/api/procedures/toggleEvmAccountMapping.d.ts +18 -0
  162. package/api/procedures/toggleEvmAccountMapping.d.ts.map +1 -0
  163. package/api/procedures/toggleEvmAccountMapping.js +80 -0
  164. package/api/procedures/toggleEvmAccountMapping.js.map +1 -0
  165. package/api/procedures/types.d.ts +52 -1
  166. package/api/procedures/types.d.ts.map +1 -1
  167. package/api/procedures/types.js.map +1 -1
  168. package/api/procedures/updateBondedPolyx.d.ts +13 -2
  169. package/api/procedures/updateBondedPolyx.d.ts.map +1 -1
  170. package/api/procedures/updateBondedPolyx.js +109 -46
  171. package/api/procedures/updateBondedPolyx.js.map +1 -1
  172. package/api/procedures/withdrawUnbondedPolyx.d.ts +11 -2
  173. package/api/procedures/withdrawUnbondedPolyx.d.ts.map +1 -1
  174. package/api/procedures/withdrawUnbondedPolyx.js +19 -15
  175. package/api/procedures/withdrawUnbondedPolyx.js.map +1 -1
  176. package/base/Context.d.ts +37 -1
  177. package/base/Context.d.ts.map +1 -1
  178. package/base/Context.js +68 -3
  179. package/base/Context.js.map +1 -1
  180. package/base/PolymeshTransactionBase.d.ts +199 -3
  181. package/base/PolymeshTransactionBase.d.ts.map +1 -1
  182. package/base/PolymeshTransactionBase.js +595 -137
  183. package/base/PolymeshTransactionBase.js.map +1 -1
  184. package/base/Procedure.d.ts.map +1 -1
  185. package/base/Procedure.js +2 -0
  186. package/base/Procedure.js.map +1 -1
  187. package/base/ethTransaction.d.ts +222 -0
  188. package/base/ethTransaction.d.ts.map +1 -0
  189. package/base/ethTransaction.js +317 -0
  190. package/base/ethTransaction.js.map +1 -0
  191. package/base/types.d.ts +66 -1
  192. package/base/types.d.ts.map +1 -1
  193. package/base/types.js.map +1 -1
  194. package/base/utils.d.ts +60 -11
  195. package/base/utils.d.ts.map +1 -1
  196. package/base/utils.js +328 -45
  197. package/base/utils.js.map +1 -1
  198. package/internal.d.ts +2 -0
  199. package/internal.d.ts.map +1 -1
  200. package/internal.js +6 -2
  201. package/internal.js.map +1 -1
  202. package/middleware/queries/assets.d.ts +13 -5
  203. package/middleware/queries/assets.d.ts.map +1 -1
  204. package/middleware/queries/assets.js +60 -27
  205. package/middleware/queries/assets.js.map +1 -1
  206. package/middleware/queries/authorizations.d.ts +2 -2
  207. package/middleware/queries/authorizations.d.ts.map +1 -1
  208. package/middleware/queries/authorizations.js +4 -3
  209. package/middleware/queries/authorizations.js.map +1 -1
  210. package/middleware/queries/claims.d.ts +4 -4
  211. package/middleware/queries/claims.d.ts.map +1 -1
  212. package/middleware/queries/claims.js +18 -6
  213. package/middleware/queries/claims.js.map +1 -1
  214. package/middleware/queries/common.d.ts +41 -1
  215. package/middleware/queries/common.d.ts.map +1 -1
  216. package/middleware/queries/common.js +51 -9
  217. package/middleware/queries/common.js.map +1 -1
  218. package/middleware/queries/distributions.d.ts +2 -2
  219. package/middleware/queries/distributions.d.ts.map +1 -1
  220. package/middleware/queries/distributions.js +10 -3
  221. package/middleware/queries/distributions.js.map +1 -1
  222. package/middleware/queries/events.d.ts +2 -2
  223. package/middleware/queries/events.d.ts.map +1 -1
  224. package/middleware/queries/events.js +4 -3
  225. package/middleware/queries/events.js.map +1 -1
  226. package/middleware/queries/externalAgents.d.ts +2 -2
  227. package/middleware/queries/externalAgents.d.ts.map +1 -1
  228. package/middleware/queries/externalAgents.js +4 -3
  229. package/middleware/queries/externalAgents.js.map +1 -1
  230. package/middleware/queries/extrinsics.d.ts +1 -1
  231. package/middleware/queries/extrinsics.d.ts.map +1 -1
  232. package/middleware/queries/extrinsics.js +14 -8
  233. package/middleware/queries/extrinsics.js.map +1 -1
  234. package/middleware/queries/multisigs.d.ts +2 -6
  235. package/middleware/queries/multisigs.d.ts.map +1 -1
  236. package/middleware/queries/multisigs.js +10 -4
  237. package/middleware/queries/multisigs.js.map +1 -1
  238. package/middleware/queries/polyxTransactions.d.ts +2 -1
  239. package/middleware/queries/polyxTransactions.d.ts.map +1 -1
  240. package/middleware/queries/polyxTransactions.js +5 -3
  241. package/middleware/queries/polyxTransactions.js.map +1 -1
  242. package/middleware/queries/settlements.d.ts +7 -7
  243. package/middleware/queries/settlements.d.ts.map +1 -1
  244. package/middleware/queries/settlements.js +23 -14
  245. package/middleware/queries/settlements.js.map +1 -1
  246. package/middleware/queries/stos.d.ts +2 -2
  247. package/middleware/queries/stos.d.ts.map +1 -1
  248. package/middleware/queries/stos.js +9 -5
  249. package/middleware/queries/stos.js.map +1 -1
  250. package/npm-package/polymeshassociation-polymesh-sdk-31.1.0-beta.10.tgz +0 -0
  251. package/package.json +2 -3
  252. package/types/internal.d.ts +38 -1
  253. package/types/internal.d.ts.map +1 -1
  254. package/types/internal.js.map +1 -1
  255. package/utils/constants.d.ts +23 -0
  256. package/utils/constants.d.ts.map +1 -1
  257. package/utils/constants.js +24 -1
  258. package/utils/constants.js.map +1 -1
  259. package/utils/eth.d.ts +63 -0
  260. package/utils/eth.d.ts.map +1 -0
  261. package/utils/eth.js +209 -0
  262. package/utils/eth.js.map +1 -0
  263. package/utils/internal.d.ts +30 -2
  264. package/utils/internal.d.ts.map +1 -1
  265. package/utils/internal.js +86 -6
  266. package/utils/internal.js.map +1 -1
  267. package/utils/typeguards.d.ts +10 -0
  268. package/utils/typeguards.d.ts.map +1 -1
  269. package/utils/typeguards.js +11 -0
  270. package/utils/typeguards.js.map +1 -1
  271. package/npm-package/polymeshassociation-polymesh-sdk-31.0.0.tgz +0 -0
@@ -1,5 +1,6 @@
1
- import { Context } from '../../internal';
2
- import { BondPolyxParams, NoArgsProcedureMethod, NominateValidatorsParams, PaginationOptions, ProcedureMethod, ResultSet, SetStakingPayeeParams, StakingCommission, StakingEraInfo, SubCallback, UnsubCallback, UpdatePolyxBondParams } from '../../types';
1
+ import BigNumber from 'bignumber.js';
2
+ import { Account, Context } from '../../internal';
3
+ import { BondPolyxParams, ElectionPhase, ElectionSchedule, EraExposure, EraNominators, EraProgress, EraRewardPoints, NoArgsProcedureMethod, NominateValidatorsParams, PaginationOptions, ProcedureMethod, ResultSet, SetStakingPayeeParams, StakingCommission, StakingConstants, StakingEraInfo, SubCallback, UnsubCallback, UpdatePolyxBondParams } from '../../types';
3
4
  /**
4
5
  * Handles Staking related functionality
5
6
  */
@@ -12,7 +13,9 @@ export declare class Staking {
12
13
  /**
13
14
  * Bond POLYX for staking
14
15
  *
15
- * @note the signing account cannot be a stash
16
+ * @note the signing Account cannot already be a stash — use
17
+ * {@link api/client/Staking!Staking.bondExtra | bondExtra} to add to a bond it already has —
18
+ * nor a controller for another stash, since one Account cannot be both
16
19
  */
17
20
  bond: ProcedureMethod<BondPolyxParams, void>;
18
21
  /**
@@ -23,8 +26,28 @@ export declare class Staking {
23
26
  bondExtra: ProcedureMethod<UpdatePolyxBondParams, void>;
24
27
  /**
25
28
  * Unbond POLYX for staking. The unbonded amount can be withdrawn after the lockup period
29
+ *
30
+ * @note the chain chills a stash that unbonds its whole ledger. Since this refuses an amount
31
+ * larger than the active bond, that is the case where nothing is already unlocking and the
32
+ * whole of it is unbonded — the stash stops nominating or validating as well
26
33
  */
27
34
  unbond: ProcedureMethod<UpdatePolyxBondParams, void>;
35
+ /**
36
+ * Rebond POLYX that is currently unbonding, without waiting for the lockup period to elapse
37
+ *
38
+ * @note this transaction must be signed by a controller
39
+ *
40
+ * @note the chain takes the amount from the most recently unbonded POLYX first, so a partial
41
+ * rebond leaves the lots closest to maturing where they are
42
+ */
43
+ rebond: ProcedureMethod<UpdatePolyxBondParams, void>;
44
+ /**
45
+ * Stop nominating validators, without unbonding any POLYX
46
+ *
47
+ * @note the bonded POLYX stays bonded. Use `unbond` to begin withdrawing it
48
+ * @note this transaction must be signed by a controller
49
+ */
50
+ chill: NoArgsProcedureMethod<void>;
28
51
  /**
29
52
  * Withdraw unbonded POLYX to free it for the stash account
30
53
  *
@@ -56,9 +79,37 @@ export declare class Staking {
56
79
  */
57
80
  getValidators(paginationOpts?: PaginationOptions): Promise<ResultSet<StakingCommission>>;
58
81
  /**
59
- * Retrieve the current staking era information
82
+ * Retrieve the validators whose set is actually in force for the active era
83
+ *
84
+ * @returns the elected validators, in the chain's own order
60
85
  *
61
- * @returns Promise that resolves to the current era information
86
+ * @note this is a different question from
87
+ * {@link api/client/Staking!Staking.getValidators | getValidators}, which lists every Account
88
+ * *declaring intent* to validate. Those declaring intent but not elected are the waiting set —
89
+ * subtract this result from `getValidators` to get it
90
+ * @note bounded by {@link api/client/Staking!Staking.getValidatorCount | getValidatorCount}, so
91
+ * unlike the intent list this needs no pagination
92
+ */
93
+ getActiveValidators(): Promise<Account[]>;
94
+ /**
95
+ * Retrieve how many validators the chain aims to elect each era
96
+ *
97
+ * @note this is the target the election is run against, not how many are currently in force —
98
+ * read {@link api/client/Staking!Staking.getActiveValidators | getActiveValidators} for that.
99
+ * The two differ when fewer Accounts declare intent than there are slots
100
+ */
101
+ getValidatorCount(): Promise<BigNumber>;
102
+ /**
103
+ * Retrieve information about the staking eras the chain is tracking
104
+ *
105
+ * @returns Promise that resolves to the era information
106
+ *
107
+ * @note the chain tracks **two** era numbers and they are not interchangeable. `currentEra` is
108
+ * the latest era the chain has *planned* — a validator set has been elected for it, but the
109
+ * Session pallet may not have brought it into force. `activeEra` is the era whose validator set
110
+ * is in force and whose rewards and slashes are being processed. `currentEra` runs ahead of
111
+ * `activeEra` between an election and the session rotation that follows it, and the two are
112
+ * equal the rest of the time. Anything describing what the chain is doing now wants `activeEra`
62
113
  */
63
114
  eraInfo(): Promise<StakingEraInfo>;
64
115
  /**
@@ -71,5 +122,155 @@ export declare class Staking {
71
122
  * @note can be subscribed to, if connected to node using a web socket
72
123
  */
73
124
  eraInfo(callback: SubCallback<StakingEraInfo>): Promise<UnsubCallback>;
125
+ /**
126
+ * Retrieve the chain constants that govern staking
127
+ *
128
+ * @note these come from the chain's metadata, so this makes no query
129
+ */
130
+ getConstants(): StakingConstants;
131
+ /**
132
+ * Retrieve how far through the staking cycle the chain is — which era and session are in force,
133
+ * and how far through each of them the chain has got
134
+ *
135
+ * @throws if there is no active era
136
+ *
137
+ * @note progress is counted in **slots**, which is how the chain measures a period, so
138
+ * `progress` is exact. The `remaining` and `end` projections come from `expectedBlockTime` and
139
+ * move as block production drifts
140
+ */
141
+ eraProgress(): Promise<EraProgress>;
142
+ /**
143
+ * Retrieve how far through the staking cycle the chain is, and subscribe to its advance
144
+ *
145
+ * @param callback - called on every block, since the slot the progress is counted in advances
146
+ * with each one. This is what drives a progress bar without polling
147
+ *
148
+ * @returns Promise that resolves to an unsubscribe function
149
+ *
150
+ * @note can be subscribed to, if connected to node using a web socket
151
+ */
152
+ eraProgress(callback: SubCallback<EraProgress>): Promise<UnsubCallback>;
153
+ /**
154
+ * Retrieve the reward points earned by each validator in an era
155
+ *
156
+ * @param era - defaults to the active era
157
+ *
158
+ * @note points are how the era's reward is split between validators. A validator that authored no
159
+ * blocks in the era is absent rather than present with zero
160
+ */
161
+ getEraRewardPoints(era?: BigNumber): Promise<EraRewardPoints>;
162
+ /**
163
+ * Retrieve the reward points earned by each validator in an era, and subscribe to them
164
+ *
165
+ * @param callback - called as points are credited. Points accrue block by block as validators
166
+ * author, so for the active era this is a live leaderboard
167
+ *
168
+ * @returns Promise that resolves to an unsubscribe function
169
+ *
170
+ * @note only the active era changes. Subscribing to a past era is allowed and simply calls back
171
+ * once, since the chain has finished writing it
172
+ * @note can be subscribed to, if connected to node using a web socket
173
+ */
174
+ getEraRewardPoints(callback: SubCallback<EraRewardPoints>): Promise<UnsubCallback>;
175
+ /**
176
+ * Retrieve the reward points earned by each validator in a specific era, and subscribe to them
177
+ *
178
+ * @returns Promise that resolves to an unsubscribe function
179
+ *
180
+ * @note can be subscribed to, if connected to node using a web socket
181
+ */
182
+ getEraRewardPoints(era: BigNumber, callback: SubCallback<EraRewardPoints>): Promise<UnsubCallback>;
183
+ /**
184
+ * Retrieve the total POLYX paid out to validators and their nominators for an era
185
+ *
186
+ * @param era - defaults to the active era
187
+ *
188
+ * @returns `null` for an era the chain has not paid out, i.e. one still running or older than the
189
+ * history depth
190
+ */
191
+ getEraValidatorReward(era?: BigNumber): Promise<BigNumber | null>;
192
+ /**
193
+ * Retrieve the session an era started at
194
+ *
195
+ * @param era - defaults to the active era
196
+ *
197
+ * @returns `null` for an era outside the chain's history depth
198
+ */
199
+ getEraStartSession(era?: BigNumber): Promise<BigNumber | null>;
200
+ /**
201
+ * Retrieve how much POLYX was backing a validator in an era, and how it was split
202
+ *
203
+ * @param args.validator - the validator's Account or address
204
+ * @param args.era - defaults to the active era
205
+ *
206
+ * @returns `null` if the Account was not in the era's validator set
207
+ */
208
+ getEraExposure(args: {
209
+ validator: Account | string;
210
+ era?: BigNumber;
211
+ }): Promise<EraExposure | null>;
212
+ /**
213
+ * Retrieve one page of the nominators backing a validator in an era
214
+ *
215
+ * @param args.validator - the validator's Account or address
216
+ * @param args.page - defaults to the first page. Read `pageCount` from
217
+ * {@link api/client/Staking!Staking.getEraExposure | getEraExposure} for how many there are
218
+ * @param args.era - defaults to the active era
219
+ *
220
+ * @returns `null` if the page does not exist
221
+ *
222
+ * @note nominators are paged by the chain so that a payout fits in a block, which is why this is
223
+ * not returned as part of the exposure
224
+ */
225
+ getEraNominators(args: {
226
+ validator: Account | string;
227
+ page?: BigNumber;
228
+ era?: BigNumber;
229
+ }): Promise<EraNominators | null>;
230
+ /**
231
+ * Retrieve when the next validator election opens and closes
232
+ *
233
+ * @throws if there is no active era
234
+ *
235
+ * @note this is the figure that says whether a nomination made now takes effect this era or the
236
+ * next. It is not the era's own countdown: the election closes a session before the era ends,
237
+ * so it can be minutes away while the era still has hours left
238
+ */
239
+ getElectionSchedule(): Promise<ElectionSchedule>;
240
+ /**
241
+ * Retrieve when the next validator election opens and closes, and subscribe to it
242
+ *
243
+ * @param callback - called on every block, since the projections advance with each one
244
+ *
245
+ * @returns Promise that resolves to an unsubscribe function
246
+ *
247
+ * @note can be subscribed to, if connected to node using a web socket
248
+ */
249
+ getElectionSchedule(callback: SubCallback<ElectionSchedule>): Promise<UnsubCallback>;
250
+ /**
251
+ * Retrieve the current phase of the validator election
252
+ *
253
+ * @note staking transactions behave differently while an election is open, so a UI should say
254
+ * when the phase is anything other than `Off`
255
+ */
256
+ getElectionPhase(): Promise<ElectionPhase>;
257
+ /**
258
+ * Retrieve the current phase of the validator election, and subscribe to it
259
+ *
260
+ * @param callback - called whenever the phase changes, which happens several times an era
261
+ *
262
+ * @returns Promise that resolves to an unsubscribe function
263
+ *
264
+ * @note this is the read that most benefits from a subscription — a warning that only appears on
265
+ * the next poll appears after the user has already acted
266
+ * @note can be subscribed to, if connected to node using a web socket
267
+ */
268
+ getElectionPhase(callback: SubCallback<ElectionPhase>): Promise<UnsubCallback>;
269
+ /**
270
+ * @hidden
271
+ *
272
+ * Resolve an optional era argument to the era to query, defaulting to the active one
273
+ */
274
+ private asRawEra;
74
275
  }
75
276
  //# sourceMappingURL=Staking.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Staking.d.ts","sourceRoot":"","sources":["../../../src/api/client/Staking.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,OAAO,EAMR,MAAM,YAAY,CAAC;AACpB,OAAO,EAEL,eAAe,EACf,qBAAqB,EACrB,wBAAwB,EACxB,iBAAiB,EACjB,eAAe,EACf,SAAS,EACT,qBAAqB,EACrB,iBAAiB,EACjB,cAAc,EACd,W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