@pezkuwi/api-derive 16.5.5

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 (304) hide show
  1. package/README.md +30 -0
  2. package/build/accounts/accountId.d.ts +17 -0
  3. package/build/accounts/flags.d.ts +29 -0
  4. package/build/accounts/idAndIndex.d.ts +15 -0
  5. package/build/accounts/idToIndex.d.ts +16 -0
  6. package/build/accounts/identity.d.ts +48 -0
  7. package/build/accounts/index.d.ts +8 -0
  8. package/build/accounts/indexToId.d.ts +15 -0
  9. package/build/accounts/indexes.d.ts +16 -0
  10. package/build/accounts/info.d.ts +18 -0
  11. package/build/accounts/types.d.ts +39 -0
  12. package/build/alliance/index.d.ts +70 -0
  13. package/build/augment.d.ts +1 -0
  14. package/build/bagsList/get.d.ts +12 -0
  15. package/build/bagsList/getExpanded.d.ts +16 -0
  16. package/build/bagsList/index.d.ts +3 -0
  17. package/build/bagsList/listNodes.d.ts +9 -0
  18. package/build/bagsList/types.d.ts +13 -0
  19. package/build/bagsList/util.d.ts +2 -0
  20. package/build/balances/account.d.ts +17 -0
  21. package/build/balances/all.d.ts +20 -0
  22. package/build/balances/index.d.ts +20 -0
  23. package/build/balances/types.d.ts +69 -0
  24. package/build/balances/votingBalances.d.ts +15 -0
  25. package/build/bounties/bounties.d.ts +12 -0
  26. package/build/bounties/helpers/filterBountyProposals.d.ts +2 -0
  27. package/build/bounties/index.d.ts +1 -0
  28. package/build/bundle.d.ts +9 -0
  29. package/build/chain/bestNumber.d.ts +11 -0
  30. package/build/chain/bestNumberFinalized.d.ts +12 -0
  31. package/build/chain/bestNumberLag.d.ts +15 -0
  32. package/build/chain/getBlock.d.ts +15 -0
  33. package/build/chain/getBlockByNumber.d.ts +16 -0
  34. package/build/chain/getHeader.d.ts +16 -0
  35. package/build/chain/index.d.ts +10 -0
  36. package/build/chain/subscribeFinalizedBlocks.d.ts +14 -0
  37. package/build/chain/subscribeFinalizedHeads.d.ts +22 -0
  38. package/build/chain/subscribeNewBlocks.d.ts +14 -0
  39. package/build/chain/subscribeNewHeads.d.ts +15 -0
  40. package/build/chain/util.d.ts +9 -0
  41. package/build/collective/helpers.d.ts +6 -0
  42. package/build/collective/index.d.ts +3 -0
  43. package/build/collective/members.d.ts +2 -0
  44. package/build/collective/prime.d.ts +2 -0
  45. package/build/collective/proposals.d.ts +6 -0
  46. package/build/collective/types.d.ts +19 -0
  47. package/build/contracts/fees.d.ts +14 -0
  48. package/build/contracts/index.d.ts +1 -0
  49. package/build/council/index.d.ts +72 -0
  50. package/build/council/types.d.ts +6 -0
  51. package/build/council/votes.d.ts +11 -0
  52. package/build/council/votesOf.d.ts +16 -0
  53. package/build/crowdloan/childKey.d.ts +15 -0
  54. package/build/crowdloan/contributions.d.ts +14 -0
  55. package/build/crowdloan/index.d.ts +3 -0
  56. package/build/crowdloan/ownContributions.d.ts +15 -0
  57. package/build/crowdloan/types.d.ts +6 -0
  58. package/build/crowdloan/util.d.ts +10 -0
  59. package/build/democracy/dispatchQueue.d.ts +12 -0
  60. package/build/democracy/index.d.ts +11 -0
  61. package/build/democracy/locks.d.ts +14 -0
  62. package/build/democracy/nextExternal.d.ts +12 -0
  63. package/build/democracy/preimages.d.ts +24 -0
  64. package/build/democracy/proposals.d.ts +12 -0
  65. package/build/democracy/referendumIds.d.ts +12 -0
  66. package/build/democracy/referendums.d.ts +11 -0
  67. package/build/democracy/referendumsActive.d.ts +12 -0
  68. package/build/democracy/referendumsFinished.d.ts +15 -0
  69. package/build/democracy/referendumsInfo.d.ts +23 -0
  70. package/build/democracy/sqrtElectorate.d.ts +13 -0
  71. package/build/democracy/types.d.ts +70 -0
  72. package/build/democracy/util.d.ts +18 -0
  73. package/build/derive.d.ts +52 -0
  74. package/build/elections/index.d.ts +1 -0
  75. package/build/elections/info.d.ts +14 -0
  76. package/build/elections/types.d.ts +18 -0
  77. package/build/imOnline/index.d.ts +1 -0
  78. package/build/imOnline/receivedHeartbeats.d.ts +13 -0
  79. package/build/index.d.ts +2 -0
  80. package/build/membership/index.d.ts +70 -0
  81. package/build/packageDetect.d.ts +1 -0
  82. package/build/packageInfo.d.ts +6 -0
  83. package/build/parachains/index.d.ts +2 -0
  84. package/build/parachains/info.d.ts +19 -0
  85. package/build/parachains/overview.d.ts +15 -0
  86. package/build/parachains/types.d.ts +38 -0
  87. package/build/parachains/util.d.ts +3 -0
  88. package/build/session/index.d.ts +3 -0
  89. package/build/session/indexes.d.ts +15 -0
  90. package/build/session/info.d.ts +13 -0
  91. package/build/session/progress.d.ts +47 -0
  92. package/build/session/types.d.ts +19 -0
  93. package/build/society/candidates.d.ts +12 -0
  94. package/build/society/index.d.ts +4 -0
  95. package/build/society/info.d.ts +12 -0
  96. package/build/society/member.d.ts +14 -0
  97. package/build/society/members.d.ts +14 -0
  98. package/build/society/types.d.ts +27 -0
  99. package/build/staking/account.d.ts +31 -0
  100. package/build/staking/cache.d.ts +12 -0
  101. package/build/staking/currentPoints.d.ts +13 -0
  102. package/build/staking/electedInfo.d.ts +23 -0
  103. package/build/staking/erasExposure.d.ts +30 -0
  104. package/build/staking/erasHistoric.d.ts +8 -0
  105. package/build/staking/erasPoints.d.ts +18 -0
  106. package/build/staking/erasPrefs.d.ts +27 -0
  107. package/build/staking/erasRewards.d.ts +14 -0
  108. package/build/staking/erasSlashes.d.ts +26 -0
  109. package/build/staking/index.d.ts +22 -0
  110. package/build/staking/keys.d.ts +35 -0
  111. package/build/staking/overview.d.ts +19 -0
  112. package/build/staking/ownExposure.d.ts +37 -0
  113. package/build/staking/ownSlashes.d.ts +35 -0
  114. package/build/staking/query.d.ts +31 -0
  115. package/build/staking/stakerExposure.d.ts +33 -0
  116. package/build/staking/stakerPoints.d.ts +22 -0
  117. package/build/staking/stakerPrefs.d.ts +24 -0
  118. package/build/staking/stakerRewards.d.ts +49 -0
  119. package/build/staking/stakerSlashes.d.ts +22 -0
  120. package/build/staking/stashes.d.ts +16 -0
  121. package/build/staking/types.d.ts +139 -0
  122. package/build/staking/util.d.ts +14 -0
  123. package/build/staking/validators.d.ts +33 -0
  124. package/build/staking/waitingInfo.d.ts +16 -0
  125. package/build/technicalCommittee/index.d.ts +70 -0
  126. package/build/treasury/index.d.ts +1 -0
  127. package/build/treasury/proposals.d.ts +12 -0
  128. package/build/tx/constants.d.ts +5 -0
  129. package/build/tx/events.d.ts +22 -0
  130. package/build/tx/extrinsicInfo.d.ts +61 -0
  131. package/build/tx/index.d.ts +3 -0
  132. package/build/tx/signingInfo.d.ts +25 -0
  133. package/build/type/HeaderExtended.d.ts +4 -0
  134. package/build/type/SignedBlockExtended.d.ts +4 -0
  135. package/build/type/index.d.ts +2 -0
  136. package/build/type/types.d.ts +15 -0
  137. package/build/type/util.d.ts +2 -0
  138. package/build/types.d.ts +79 -0
  139. package/build/util/approvalFlagsToBools.d.ts +4 -0
  140. package/build/util/blockNumber.d.ts +7 -0
  141. package/build/util/cache.d.ts +4 -0
  142. package/build/util/cacheImpl.d.ts +3 -0
  143. package/build/util/first.d.ts +4 -0
  144. package/build/util/index.d.ts +7 -0
  145. package/build/util/lazy.d.ts +4 -0
  146. package/build/util/types.d.ts +6 -0
  147. package/package.json +42 -0
  148. package/src/accounts/accountId.ts +44 -0
  149. package/src/accounts/flags.ts +90 -0
  150. package/src/accounts/idAndIndex.ts +51 -0
  151. package/src/accounts/idToIndex.ts +31 -0
  152. package/src/accounts/identity.ts +235 -0
  153. package/src/accounts/index.ts +11 -0
  154. package/src/accounts/indexToId.ts +33 -0
  155. package/src/accounts/indexes.ts +56 -0
  156. package/src/accounts/info.ts +58 -0
  157. package/src/accounts/types.ts +48 -0
  158. package/src/alliance/index.ts +76 -0
  159. package/src/augment.ts +4 -0
  160. package/src/bagsList/get.ts +79 -0
  161. package/src/bagsList/getExpanded.ts +41 -0
  162. package/src/bagsList/index.ts +6 -0
  163. package/src/bagsList/listNodes.ts +50 -0
  164. package/src/bagsList/types.ts +18 -0
  165. package/src/bagsList/util.ts +14 -0
  166. package/src/balances/account.ts +210 -0
  167. package/src/balances/all.ts +246 -0
  168. package/src/balances/index.ts +26 -0
  169. package/src/balances/types.ts +79 -0
  170. package/src/balances/votingBalances.ts +33 -0
  171. package/src/bounties/bounties.spec.ts +162 -0
  172. package/src/bounties/bounties.ts +76 -0
  173. package/src/bounties/helpers/filterBountyProposals.ts +13 -0
  174. package/src/bounties/index.ts +4 -0
  175. package/src/bundle.ts +140 -0
  176. package/src/chain/bestNumber.ts +21 -0
  177. package/src/chain/bestNumberFinalized.ts +22 -0
  178. package/src/chain/bestNumberLag.ts +33 -0
  179. package/src/chain/getBlock.ts +43 -0
  180. package/src/chain/getBlockByNumber.ts +30 -0
  181. package/src/chain/getHeader.ts +37 -0
  182. package/src/chain/index.ts +13 -0
  183. package/src/chain/subscribeFinalizedBlocks.ts +30 -0
  184. package/src/chain/subscribeFinalizedHeads.ts +62 -0
  185. package/src/chain/subscribeNewBlocks.ts +30 -0
  186. package/src/chain/subscribeNewHeads.ts +38 -0
  187. package/src/chain/util.ts +112 -0
  188. package/src/checkTypes.manual.ts +8 -0
  189. package/src/collective/helpers.ts +36 -0
  190. package/src/collective/index.ts +6 -0
  191. package/src/collective/members.ts +8 -0
  192. package/src/collective/prime.ts +25 -0
  193. package/src/collective/proposals.ts +73 -0
  194. package/src/collective/types.ts +30 -0
  195. package/src/contracts/fees.ts +61 -0
  196. package/src/contracts/index.ts +4 -0
  197. package/src/council/index.ts +79 -0
  198. package/src/council/types.ts +11 -0
  199. package/src/council/votes.ts +97 -0
  200. package/src/council/votesOf.ts +35 -0
  201. package/src/crowdloan/childKey.ts +57 -0
  202. package/src/crowdloan/contributions.ts +142 -0
  203. package/src/crowdloan/index.ts +6 -0
  204. package/src/crowdloan/ownContributions.ts +81 -0
  205. package/src/crowdloan/types.ts +11 -0
  206. package/src/crowdloan/util.ts +33 -0
  207. package/src/democracy/dispatchQueue.ts +158 -0
  208. package/src/democracy/index.ts +14 -0
  209. package/src/democracy/locks.ts +114 -0
  210. package/src/democracy/nextExternal.ts +49 -0
  211. package/src/democracy/preimages.ts +171 -0
  212. package/src/democracy/proposals.ts +81 -0
  213. package/src/democracy/referendumIds.ts +37 -0
  214. package/src/democracy/referendums.ts +39 -0
  215. package/src/democracy/referendumsActive.ts +30 -0
  216. package/src/democracy/referendumsFinished.ts +37 -0
  217. package/src/democracy/referendumsInfo.ts +181 -0
  218. package/src/democracy/sqrtElectorate.ts +29 -0
  219. package/src/democracy/types.ts +84 -0
  220. package/src/democracy/util.ts +166 -0
  221. package/src/derive.ts +41 -0
  222. package/src/elections/index.ts +4 -0
  223. package/src/elections/info.ts +126 -0
  224. package/src/elections/types.ts +22 -0
  225. package/src/imOnline/index.ts +4 -0
  226. package/src/imOnline/receivedHeartbeats.ts +65 -0
  227. package/src/index.spec.ts +103 -0
  228. package/src/index.ts +6 -0
  229. package/src/membership/index.ts +76 -0
  230. package/src/mod.ts +4 -0
  231. package/src/packageDetect.ts +11 -0
  232. package/src/packageInfo.ts +6 -0
  233. package/src/parachains/index.ts +5 -0
  234. package/src/parachains/info.ts +111 -0
  235. package/src/parachains/overview.ts +63 -0
  236. package/src/parachains/types.ts +46 -0
  237. package/src/parachains/util.ts +11 -0
  238. package/src/session/index.ts +6 -0
  239. package/src/session/indexes.ts +90 -0
  240. package/src/session/info.ts +39 -0
  241. package/src/session/progress.ts +130 -0
  242. package/src/session/types.ts +25 -0
  243. package/src/society/candidates.ts +71 -0
  244. package/src/society/index.ts +7 -0
  245. package/src/society/info.ts +50 -0
  246. package/src/society/member.ts +28 -0
  247. package/src/society/members.ts +107 -0
  248. package/src/society/types.ts +33 -0
  249. package/src/staking/account.ts +112 -0
  250. package/src/staking/cache.ts +48 -0
  251. package/src/staking/currentPoints.ts +28 -0
  252. package/src/staking/electedInfo.ts +54 -0
  253. package/src/staking/erasExposure.ts +105 -0
  254. package/src/staking/erasHistoric.ts +47 -0
  255. package/src/staking/erasPoints.ts +67 -0
  256. package/src/staking/erasPrefs.ts +63 -0
  257. package/src/staking/erasRewards.ts +52 -0
  258. package/src/staking/erasSlashes.ts +69 -0
  259. package/src/staking/index.ts +25 -0
  260. package/src/staking/keys.ts +86 -0
  261. package/src/staking/overview.ts +42 -0
  262. package/src/staking/ownExposure.ts +83 -0
  263. package/src/staking/ownSlashes.ts +68 -0
  264. package/src/staking/query.ts +230 -0
  265. package/src/staking/stakerExposure.ts +78 -0
  266. package/src/staking/stakerPoints.ts +46 -0
  267. package/src/staking/stakerPrefs.ts +45 -0
  268. package/src/staking/stakerRewards.ts +298 -0
  269. package/src/staking/stakerSlashes.ts +45 -0
  270. package/src/staking/stashes.ts +55 -0
  271. package/src/staking/types.ts +174 -0
  272. package/src/staking/util.ts +94 -0
  273. package/src/staking/validators.ts +82 -0
  274. package/src/staking/waitingInfo.ts +45 -0
  275. package/src/technicalCommittee/index.ts +76 -0
  276. package/src/test/bountyFactory.ts +39 -0
  277. package/src/test/bytesFactory.ts +15 -0
  278. package/src/test/helpers.ts +23 -0
  279. package/src/test/proposalFactory.ts +25 -0
  280. package/src/treasury/index.ts +4 -0
  281. package/src/treasury/proposals.ts +109 -0
  282. package/src/tx/constants.ts +13 -0
  283. package/src/tx/events.ts +43 -0
  284. package/src/tx/extrinsicInfo.ts +123 -0
  285. package/src/tx/index.ts +6 -0
  286. package/src/tx/signingInfo.ts +129 -0
  287. package/src/type/HeaderExtended.ts +33 -0
  288. package/src/type/SignedBlockExtended.ts +75 -0
  289. package/src/type/index.ts +5 -0
  290. package/src/type/types.ts +21 -0
  291. package/src/type/util.ts +45 -0
  292. package/src/types.ts +97 -0
  293. package/src/util/approvalFlagToBools.spec.ts +37 -0
  294. package/src/util/approvalFlagsToBools.ts +26 -0
  295. package/src/util/blockNumber.ts +15 -0
  296. package/src/util/cache.ts +65 -0
  297. package/src/util/cacheImpl.ts +30 -0
  298. package/src/util/first.ts +20 -0
  299. package/src/util/index.ts +13 -0
  300. package/src/util/lazy.ts +16 -0
  301. package/src/util/types.ts +9 -0
  302. package/tsconfig.build.json +21 -0
  303. package/tsconfig.build.tsbuildinfo +1 -0
  304. package/tsconfig.spec.json +27 -0
@@ -0,0 +1,18 @@
1
+ import type { Hash, ReferendumInfoTo239 } from '@pezkuwi/types/interfaces';
2
+ import type { FrameSupportPreimagesBounded, PalletDemocracyReferendumInfo, PalletDemocracyReferendumStatus, PalletDemocracyVoteThreshold } from '@pezkuwi/types/lookup';
3
+ import type { Option } from '@pezkuwi/types-codec';
4
+ import type { HexString } from '@pezkuwi/util/types';
5
+ import type { DeriveReferendum, DeriveReferendumVote, DeriveReferendumVotes } from '../types.js';
6
+ import { BN } from '@pezkuwi/util';
7
+ interface ApproxState {
8
+ votedAye: BN;
9
+ votedNay: BN;
10
+ votedTotal: BN;
11
+ }
12
+ export declare function compareRationals(n1: BN, d1: BN, n2: BN, d2: BN): boolean;
13
+ export declare function calcPassing(threshold: PalletDemocracyVoteThreshold, sqrtElectorate: BN, state: ApproxState): boolean;
14
+ export declare function calcVotes(sqrtElectorate: BN, referendum: DeriveReferendum, votes: DeriveReferendumVote[]): DeriveReferendumVotes;
15
+ export declare function getStatus(info: Option<PalletDemocracyReferendumInfo | ReferendumInfoTo239>): PalletDemocracyReferendumStatus | ReferendumInfoTo239 | null;
16
+ export declare function getImageHashBounded(hash: Uint8Array | string | Hash | FrameSupportPreimagesBounded): HexString;
17
+ export declare function getImageHash(status: PalletDemocracyReferendumStatus | ReferendumInfoTo239): HexString;
18
+ export {};
@@ -0,0 +1,52 @@
1
+ import type { AnyFunction } from '@pezkuwi/types/types';
2
+ import * as accounts from './accounts/index.js';
3
+ import * as alliance from './alliance/index.js';
4
+ import * as bagsList from './bagsList/index.js';
5
+ import * as balances from './balances/index.js';
6
+ import * as bounties from './bounties/index.js';
7
+ import * as chain from './chain/index.js';
8
+ import * as contracts from './contracts/index.js';
9
+ import * as council from './council/index.js';
10
+ import * as crowdloan from './crowdloan/index.js';
11
+ import * as democracy from './democracy/index.js';
12
+ import * as elections from './elections/index.js';
13
+ import * as imOnline from './imOnline/index.js';
14
+ import * as membership from './membership/index.js';
15
+ import * as parachains from './parachains/index.js';
16
+ import * as session from './session/index.js';
17
+ import * as society from './society/index.js';
18
+ import * as staking from './staking/index.js';
19
+ import * as technicalCommittee from './technicalCommittee/index.js';
20
+ import * as treasury from './treasury/index.js';
21
+ import * as tx from './tx/index.js';
22
+ export declare const derive: {
23
+ accounts: typeof accounts;
24
+ alliance: typeof alliance;
25
+ bagsList: typeof bagsList;
26
+ balances: typeof balances;
27
+ bounties: typeof bounties;
28
+ chain: typeof chain;
29
+ contracts: typeof contracts;
30
+ council: typeof council;
31
+ crowdloan: typeof crowdloan;
32
+ democracy: typeof democracy;
33
+ elections: typeof elections;
34
+ imOnline: typeof imOnline;
35
+ membership: typeof membership;
36
+ parachains: typeof parachains;
37
+ session: typeof session;
38
+ society: typeof society;
39
+ staking: typeof staking;
40
+ technicalCommittee: typeof technicalCommittee;
41
+ treasury: typeof treasury;
42
+ tx: typeof tx;
43
+ };
44
+ type DeriveSection<Section> = {
45
+ [M in keyof Section]: Section[M] extends AnyFunction ? ReturnType<Section[M]> : never;
46
+ };
47
+ type DeriveAllSections<AllSections> = {
48
+ [S in keyof AllSections]: DeriveSection<AllSections[S]>;
49
+ };
50
+ export interface ExactDerive extends DeriveAllSections<typeof derive> {
51
+ }
52
+ export {};
@@ -0,0 +1 @@
1
+ export * from './info.js';
@@ -0,0 +1,14 @@
1
+ import type { Observable } from 'rxjs';
2
+ import type { DeriveApi } from '../types.js';
3
+ import type { DeriveElectionsInfo } from './types.js';
4
+ /**
5
+ * @name info
6
+ * @description An object containing the combined results of the storage queries for all relevant election module properties.
7
+ * @example
8
+ * ```javascript
9
+ * api.derive.elections.info(({ members, candidates }) => {
10
+ * console.log(`There are currently ${members.length} council members and ${candidates.length} prospective council candidates.`);
11
+ * });
12
+ * ```
13
+ */
14
+ export declare function info(instanceId: string, api: DeriveApi): () => Observable<DeriveElectionsInfo>;
@@ -0,0 +1,18 @@
1
+ import type { u32 } from '@pezkuwi/types';
2
+ import type { AccountId, Balance, BlockNumber, SetIndex, VoteIndex } from '@pezkuwi/types/interfaces';
3
+ export interface DeriveElectionsInfo {
4
+ candidates: AccountId[];
5
+ candidateCount: u32;
6
+ candidacyBond?: Balance;
7
+ desiredRunnersUp?: u32;
8
+ desiredSeats?: u32;
9
+ members: [AccountId, Balance][];
10
+ nextVoterSet?: SetIndex;
11
+ runnersUp: [AccountId, Balance][];
12
+ termDuration?: BlockNumber;
13
+ voteCount?: VoteIndex;
14
+ voterCount?: SetIndex;
15
+ votingBond?: Balance;
16
+ votingBondBase?: Balance;
17
+ votingBondFactor?: Balance;
18
+ }
@@ -0,0 +1 @@
1
+ export * from './receivedHeartbeats.js';
@@ -0,0 +1,13 @@
1
+ import type { Observable } from 'rxjs';
2
+ import type { DeriveApi, DeriveHeartbeats } from '../types.js';
3
+ /**
4
+ * @name receivedHeartbeats
5
+ * @description Return a boolean array indicating whether the passed accounts had received heartbeats in the current session.
6
+ * @example
7
+ * ```javascript
8
+ * let unsub = await api.derive.imOnline.receivedHeartbeats((heartbeat) => {
9
+ * console.log(heartbeat);
10
+ * });
11
+ * ```
12
+ */
13
+ export declare function receivedHeartbeats(instanceId: string, api: DeriveApi): () => Observable<DeriveHeartbeats>;
@@ -0,0 +1,2 @@
1
+ import './packageDetect.js';
2
+ export * from './bundle.js';
@@ -0,0 +1,70 @@
1
+ /**
2
+ * @name members
3
+ * @description Retrieves the list of members in the "membership" collective.
4
+ * @example
5
+ * ```javascript
6
+ * const members = await api.derive.membership.members();
7
+ * console.log(`Members: ${JSON.stringify(members)});
8
+ * ```
9
+ */
10
+ export declare const members: import("../collective/types.js").MembersFnRet;
11
+ /**
12
+ * @name hasProposals
13
+ * @description Checks if there are any active proposals in the "membership" collective.
14
+ * @example
15
+ * ```javascript
16
+ * const exists = await api.derive.membership.hasProposals();
17
+ * console.log(exists);
18
+ * ```
19
+ */
20
+ export declare const hasProposals: import("../collective/types.js").HasProposalsFnRet;
21
+ /**
22
+ * @name proposal
23
+ * @description Retrieves details of a specific proposal in the "membership" collective by its hash.
24
+ * @example
25
+ * ```javascript
26
+ * const proposalDetails = await api.derive.membership.proposal(PROPOSAL_HASH);
27
+ * console.log(proposalDetails);
28
+ * ```
29
+ */
30
+ export declare const proposal: import("../collective/types.js").ProposalFnRet;
31
+ /**
32
+ * @name proposalCount
33
+ * @description Retrieves the total number of proposals in the "membership" collective.
34
+ * @example
35
+ * ```javascript
36
+ * const count = await api.derive.membership.proposalCount();
37
+ * console.log(`Amount of proposals: ${count}`);
38
+ * ```
39
+ */
40
+ export declare const proposalCount: import("../collective/types.js").ProposalCountFnRet;
41
+ /**
42
+ * @name proposalHashes
43
+ * @description Retrieves an array of hashes for all active proposals in the "membership" collective.
44
+ * @example
45
+ * ```javascript
46
+ * const hashes = await api.derive.membership.proposalHashes();
47
+ * console.log(`Proposals ${JSON.stringify(hashes)}`);
48
+ * ```
49
+ */
50
+ export declare const proposalHashes: import("../collective/types.js").ProposalHashesFnRet;
51
+ /**
52
+ * @name proposals
53
+ * @description Retrieves a list of all active proposals in the "membership" collective.
54
+ * @example
55
+ * ```javascript
56
+ * const proposals = await api.derive.membership.proposals();
57
+ * console.log(proposals);
58
+ * ```
59
+ */
60
+ export declare const proposals: import("../collective/types.js").ProposalsFnRet;
61
+ /**
62
+ * @name prime
63
+ * @description Retrieves the prime member of the "membership" collective, if one exists.
64
+ * @example
65
+ * ```javascript
66
+ * const primeMember = await api.derive.membership.prime();
67
+ * console.log(primeMember);
68
+ * ```
69
+ */
70
+ export declare const prime: import("../collective/types.js").PrimeFnRet;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ export declare const packageInfo: {
2
+ name: string;
3
+ path: string;
4
+ type: string;
5
+ version: string;
6
+ };
@@ -0,0 +1,2 @@
1
+ export * from './info.js';
2
+ export * from './overview.js';
@@ -0,0 +1,19 @@
1
+ import type { Observable } from 'rxjs';
2
+ import type { ParaId } from '@pezkuwi/types/interfaces';
3
+ import type { DeriveApi, DeriveParachainFull } from '../types.js';
4
+ /**
5
+ * @name info
6
+ * @param {ParaId | number} id A unique numeric (non-negative integer) identifier for a parachain.
7
+ * @description Retrieves detailed information about a specific parachain.
8
+ * @example
9
+ * ```javascript
10
+ * await api.derive.parachains.info(1000, (info) => {
11
+ * if (info) {
12
+ * console.log(`Parachain ${info.id.toString()} is active: ${info.active}`);
13
+ * } else {
14
+ * console.log("Parachain information not available.");
15
+ * }
16
+ * });
17
+ * ```
18
+ */
19
+ export declare function info(instanceId: string, api: DeriveApi): (id: ParaId | number) => Observable<DeriveParachainFull | null>;
@@ -0,0 +1,15 @@
1
+ import type { Observable } from 'rxjs';
2
+ import type { DeriveApi, DeriveParachain } from '../types.js';
3
+ /**
4
+ * @name overview
5
+ * @description Retrieves an overview of all registered parachains.
6
+ * @example
7
+ * ```javascript
8
+ * await api.derive.parachains.overview((overview) => {
9
+ * parachains.forEach(parachain => {
10
+ * console.log(`Parachain ${parachain.id.toString()} is registered.`);
11
+ * });
12
+ * });
13
+ * ```
14
+ */
15
+ export declare function overview(instanceId: string, api: DeriveApi): () => Observable<DeriveParachain[]>;
@@ -0,0 +1,38 @@
1
+ import type { Bytes, Option, u32, Vec } from '@pezkuwi/types';
2
+ import type { CollatorId, ParaId, ParaInfo, Retriable, UpwardMessage } from '@pezkuwi/types/interfaces';
3
+ import type { ITuple } from '@pezkuwi/types/types';
4
+ export type ParaInfoResult = Option<ParaInfo>;
5
+ export type PendingSwap = Option<ParaId>;
6
+ export type Active = Vec<ITuple<[ParaId, Option<ITuple<[CollatorId, Retriable]>>]>>;
7
+ export type RetryQueue = Vec<Vec<ITuple<[ParaId, CollatorId]>>>;
8
+ export type SelectedThreads = Vec<Vec<ITuple<[ParaId, CollatorId]>>>;
9
+ export type Code = Bytes;
10
+ export type Heads = Bytes;
11
+ export type RelayDispatchQueue = Vec<UpwardMessage>;
12
+ export type RelayDispatchQueueSize = ITuple<[u32, u32]>;
13
+ export type DidUpdate = Option<Vec<ParaId>>;
14
+ export interface DeriveParachainActive {
15
+ collatorId: CollatorId;
16
+ isRetriable: boolean;
17
+ retries: number;
18
+ }
19
+ export interface DeriveParachainInfo extends ParaInfo {
20
+ id: ParaId;
21
+ icon?: string;
22
+ name?: string;
23
+ owner?: string;
24
+ }
25
+ export interface DeriveParachain {
26
+ didUpdate: boolean;
27
+ pendingSwapId: ParaId | null;
28
+ id: ParaId;
29
+ info: DeriveParachainInfo | null;
30
+ relayDispatchQueueSize?: number;
31
+ }
32
+ export interface DeriveParachainFull extends DeriveParachain {
33
+ active: DeriveParachainActive | null;
34
+ heads: Bytes | null;
35
+ relayDispatchQueue: UpwardMessage[];
36
+ retryCollators: (CollatorId | null)[];
37
+ selectedCollators: (CollatorId | null)[];
38
+ }
@@ -0,0 +1,3 @@
1
+ import type { ParaId } from '@pezkuwi/types/interfaces';
2
+ import type { DidUpdate } from './types.js';
3
+ export declare function didUpdateToBool(didUpdate: DidUpdate, id: ParaId): boolean;
@@ -0,0 +1,3 @@
1
+ export * from './indexes.js';
2
+ export * from './info.js';
3
+ export * from './progress.js';
@@ -0,0 +1,15 @@
1
+ import type { Observable } from 'rxjs';
2
+ import type { DeriveApi, DeriveSessionIndexes } from '../types.js';
3
+ /**
4
+ * @name indexes
5
+ * @description Retrieves session-related index data, adapting to whether
6
+ * the chain has staking enabled.
7
+ * @example
8
+ * ```javascript
9
+ * api.derive.session.indexes((indexes) => {
10
+ * console.log(`Current session index: ${indexes.currentIndex}`);
11
+ * console.log(`Validator count: ${indexes.validatorCount}`);
12
+ * });
13
+ * ```
14
+ */
15
+ export declare function indexes(instanceId: string, api: DeriveApi): () => Observable<DeriveSessionIndexes>;
@@ -0,0 +1,13 @@
1
+ import type { Observable } from 'rxjs';
2
+ import type { DeriveApi, DeriveSessionInfo } from '../types.js';
3
+ /**
4
+ * @name info
5
+ * @description Retrieves all the session and era query and calculates specific values on it as the length of the session and eras.
6
+ * @example
7
+ * ```javascript
8
+ * api.derive.session.info((info) => {
9
+ * console.log(`Session info ${JSON.stringify(info)}`);
10
+ * });
11
+ * ```
12
+ */
13
+ export declare function info(instanceId: string, api: DeriveApi): () => Observable<DeriveSessionInfo>;
@@ -0,0 +1,47 @@
1
+ import type { Observable } from 'rxjs';
2
+ import type { BlockNumber } from '@pezkuwi/types/interfaces';
3
+ import type { DeriveApi, DeriveSessionProgress } from '../types.js';
4
+ /**
5
+ * @name progress
6
+ * @description Retrieves session information and progress.
7
+ * @example
8
+ * ```javascript
9
+ * api.derive.session.progress((progress) => {
10
+ * console.log(`Session progress ${JSON.stringify(progress)}`);
11
+ * });
12
+ * ```
13
+ */
14
+ export declare function progress(instanceId: string, api: DeriveApi): () => Observable<DeriveSessionProgress>;
15
+ /**
16
+ * @name eraLenght
17
+ * @description Retrieves the total length of the current era.
18
+ * @example
19
+ * ```javascript
20
+ * api.derive.session.eraLength((length) => {
21
+ * console.log(`Current era length: ${length} sessions`);
22
+ * });
23
+ * ```
24
+ */
25
+ export declare const eraLength: (instanceId: string, api: DeriveApi) => () => Observable<BlockNumber>;
26
+ /**
27
+ * @name eraProgress
28
+ * @description Retrieves the progress of the current era.
29
+ * @example
30
+ * ```javascript
31
+ * api.derive.session.eraProgress((progress) => {
32
+ * console.log(`Current era progress: ${progress} sessions`);
33
+ * });
34
+ * ```
35
+ */
36
+ export declare const eraProgress: (instanceId: string, api: DeriveApi) => () => Observable<BlockNumber>;
37
+ /**
38
+ * @name sessionProgress
39
+ * @description Retrieves the progress of the current session.
40
+ * @example
41
+ * ```javascript
42
+ * api.derive.session.sessionProgress((progress) => {
43
+ * console.log(`Current session progress: ${progress} slots`);
44
+ * });
45
+ * ```
46
+ */
47
+ export declare const sessionProgress: (instanceId: string, api: DeriveApi) => () => Observable<BlockNumber>;
@@ -0,0 +1,19 @@
1
+ import type { Option, u32, u64 } from '@pezkuwi/types';
2
+ import type { BlockNumber, EraIndex, Moment, SessionIndex } from '@pezkuwi/types/interfaces';
3
+ export interface DeriveSessionIndexes {
4
+ activeEra: EraIndex;
5
+ activeEraStart: Option<Moment>;
6
+ currentEra: EraIndex;
7
+ currentIndex: SessionIndex;
8
+ validatorCount: u32;
9
+ }
10
+ export interface DeriveSessionInfo extends DeriveSessionIndexes {
11
+ eraLength: BlockNumber;
12
+ isEpoch: boolean;
13
+ sessionLength: u64;
14
+ sessionsPerEra: SessionIndex;
15
+ }
16
+ export interface DeriveSessionProgress extends DeriveSessionInfo {
17
+ eraProgress: BlockNumber;
18
+ sessionProgress: BlockNumber;
19
+ }
@@ -0,0 +1,12 @@
1
+ import type { Observable } from 'rxjs';
2
+ import type { DeriveApi, DeriveSocietyCandidate } from '../types.js';
3
+ /**
4
+ * @name candidate
5
+ * @description Retrieves the list of candidates for the society module.
6
+ * @example
7
+ * ```javascript
8
+ * const societyCandidates = await api.derive.society.candidates();
9
+ * console.log(societyCandidates);
10
+ * ```
11
+ */
12
+ export declare function candidates(instanceId: string, api: DeriveApi): () => Observable<DeriveSocietyCandidate[]>;
@@ -0,0 +1,4 @@
1
+ export * from './candidates.js';
2
+ export * from './info.js';
3
+ export * from './member.js';
4
+ export * from './members.js';
@@ -0,0 +1,12 @@
1
+ import type { Observable } from 'rxjs';
2
+ import type { DeriveApi, DeriveSociety } from '../types.js';
3
+ /**
4
+ * @name info
5
+ * @description Get the overall info for a society.
6
+ * @example
7
+ * ```javascript
8
+ * const societyInfo = await api.derive.society.candidates();
9
+ * console.log(societyInfo);
10
+ * ```
11
+ */
12
+ export declare function info(instanceId: string, api: DeriveApi): () => Observable<DeriveSociety>;
@@ -0,0 +1,14 @@
1
+ import type { Observable } from 'rxjs';
2
+ import type { AccountId } from '@pezkuwi/types/interfaces';
3
+ import type { DeriveApi, DeriveSocietyMember } from '../types.js';
4
+ /**
5
+ * @name member
6
+ * @description Get the member info for a society.
7
+ * @param { AccountId } accountId
8
+ * @example
9
+ * ```javascript
10
+ * const member = await api.derive.society.member(ALICE);
11
+ * console.log(member);
12
+ * ```
13
+ */
14
+ export declare function member(instanceId: string, api: DeriveApi): (accountId: AccountId) => Observable<DeriveSocietyMember>;
@@ -0,0 +1,14 @@
1
+ import type { Observable } from 'rxjs';
2
+ import type { AccountId } from '@pezkuwi/types/interfaces';
3
+ import type { DeriveApi, DeriveSocietyMember } from '../types.js';
4
+ export declare function _members(instanceId: string, api: DeriveApi): (accountIds: AccountId[]) => Observable<DeriveSocietyMember[]>;
5
+ /**
6
+ * @name members
7
+ * @description Get the society members.
8
+ * @example
9
+ * ```javascript
10
+ * const members = await api.derive.society.members();
11
+ * console.log(members);
12
+ * ```
13
+ */
14
+ export declare function members(instanceId: string, api: DeriveApi): () => Observable<DeriveSocietyMember[]>;
@@ -0,0 +1,27 @@
1
+ import type { u32 } from '@pezkuwi/types';
2
+ import type { AccountId, Balance, BalanceOf, BlockNumber, StrikeCount } from '@pezkuwi/types/interfaces';
3
+ import type { PalletSocietyBid, PalletSocietyBidKind, PalletSocietyVote, PalletSocietyVouchingStatus } from '@pezkuwi/types/lookup';
4
+ export interface DeriveSociety {
5
+ bids: PalletSocietyBid[];
6
+ defender?: AccountId | undefined;
7
+ hasDefender: boolean;
8
+ head?: AccountId | undefined;
9
+ founder?: AccountId | undefined;
10
+ maxMembers?: u32 | undefined;
11
+ pot: BalanceOf;
12
+ }
13
+ export interface DeriveSocietyCandidate {
14
+ accountId: AccountId;
15
+ kind: PalletSocietyBidKind;
16
+ value: Balance;
17
+ isSuspended: boolean;
18
+ }
19
+ export interface DeriveSocietyMember {
20
+ accountId: AccountId;
21
+ isDefenderVoter: boolean;
22
+ isSuspended: boolean;
23
+ payouts: [BlockNumber, Balance][];
24
+ strikes: StrikeCount;
25
+ vote?: PalletSocietyVote | undefined;
26
+ vouching?: PalletSocietyVouchingStatus | undefined;
27
+ }
@@ -0,0 +1,31 @@
1
+ import type { Observable } from 'rxjs';
2
+ import type { DeriveApi, DeriveStakingAccount } from '../types.js';
3
+ import type { StakingQueryFlags } from './types.js';
4
+ /**
5
+ * @name accounts
6
+ * @param {(Uint8Array | string)[]} accountIds List of account stashes
7
+ * @param {StakingQueryFlags} opts optional filtering flag
8
+ * @description From a list of stashes, fill in all the relevant staking details
9
+ * @example
10
+ * ```javascript
11
+ * const accounts = await api.derive.staking.accounts([
12
+ * "149B17nn7zVL4SkLSNmANupEkGexUBAxVrdk4bbWFZYibkFc",
13
+ * ]);
14
+ * console.log("First account staking info:", accounts[0]);
15
+ * ```
16
+ */
17
+ export declare function accounts(instanceId: string, api: DeriveApi): (accountIds: (Uint8Array | string)[], opts?: StakingQueryFlags) => Observable<DeriveStakingAccount[]>;
18
+ /**
19
+ * @name account
20
+ * @param {(Uint8Array | string)} accountId AccountId of the stash.
21
+ * @param {StakingQueryFlags} opts (Optional) filtering flag.
22
+ * @description From a stash, retrieve the controllerId and fill in all the relevant staking details.
23
+ * @example
24
+ * ```javascript
25
+ * const accountStakingData = await api.derive.staking.account(
26
+ * "149B17nn7zVL4SkLSNmANupEkGexUBAxVrdk4bbWFZYibkFc"
27
+ * );
28
+ * console.log(accountStakingData);
29
+ * ```
30
+ */
31
+ export declare const account: (instanceId: string, api: DeriveApi) => (accountId: string | Uint8Array<ArrayBufferLike>, opts?: StakingQueryFlags) => Observable<DeriveStakingAccount>;
@@ -0,0 +1,12 @@
1
+ import type { EraIndex } from '@pezkuwi/types/interfaces';
2
+ export declare function getEraCache<T>(CACHE_KEY: string, era: EraIndex, withActive?: boolean): [string, T | undefined];
3
+ export declare function getEraMultiCache<T>(CACHE_KEY: string, eras: EraIndex[], withActive?: boolean): T[];
4
+ export declare function setEraCache<T extends {
5
+ era: EraIndex;
6
+ }>(cacheKey: string, withActive: boolean, value: T): T;
7
+ export declare function setEraMultiCache<T extends {
8
+ era: EraIndex;
9
+ }>(CACHE_KEY: string, withActive: boolean, values: T[]): T[];
10
+ export declare function filterCachedEras<T extends {
11
+ era: EraIndex;
12
+ }>(eras: EraIndex[], cached: T[], query: T[]): T[];
@@ -0,0 +1,13 @@
1
+ import type { Observable } from 'rxjs';
2
+ import type { PalletStakingEraRewardPoints } from '@pezkuwi/types/lookup';
3
+ import type { DeriveApi } from '../types.js';
4
+ /**
5
+ * @name currentPoints
6
+ * @description Retrieve the staking overview, including elected and points earned.
7
+ * @example
8
+ * ```javascript
9
+ * const currentPoints = await api.derive.staking.currentPoints();
10
+ * console.log(currentPoints.toHuman());
11
+ * ```
12
+ */
13
+ export declare function currentPoints(instanceId: string, api: DeriveApi): () => Observable<PalletStakingEraRewardPoints>;
@@ -0,0 +1,23 @@
1
+ import type { Observable } from 'rxjs';
2
+ import type { DeriveApi, DeriveStakingElected, StakingQueryFlags } from '../types.js';
3
+ /**
4
+ * @name electedInfo
5
+ * @param {StakingQueryFlags} flags? (Optional) Query flags to filter the staking data.
6
+ * @param {number} page? (Optional) The page index for paginated results.
7
+ * @description Retrieves detailed staking information about the next elected validators and their associated staking data.
8
+ * @example
9
+ * ```javascript
10
+ * const { nextElected, validators, info } =
11
+ * await api.derive.staking.electedInfo();
12
+ * console.log(
13
+ * "Next Elected Validators:",
14
+ * nextElected.map((acc) => acc.toString())
15
+ * );
16
+ * console.log(
17
+ * "Current Validators:",
18
+ * validators.map((acc) => acc.toString())
19
+ * );
20
+ * console.log("Validator Staking Info:", info);
21
+ * ```
22
+ */
23
+ export declare function electedInfo(instanceId: string, api: DeriveApi): (flags?: StakingQueryFlags, page?: number) => Observable<DeriveStakingElected>;
@@ -0,0 +1,30 @@
1
+ import type { Observable } from 'rxjs';
2
+ import type { EraIndex } from '@pezkuwi/types/interfaces';
3
+ import type { DeriveApi, DeriveEraExposurePaged } from '../types.js';
4
+ /**
5
+ * erasStakersClipped will be deprecated and replaced with erasStakersPaged. Therefore support is given for both
6
+ * storage queries until erasStakersClipped has been completely out of use.
7
+ */
8
+ export declare function _eraExposure(instanceId: string, api: DeriveApi): (era: EraIndex, withActive?: boolean) => Observable<DeriveEraExposurePaged>;
9
+ /**
10
+ * @name eraExposure
11
+ * @description Retrieves the staking exposure (nominators and total stake) for a specific era.
12
+ * @param {EraIndex} eras The staking era to query.
13
+ * @example
14
+ * ```javascript
15
+ * const era = api.createType("EraIndex", 1000);
16
+ * const exposure = await api.derive.staking.eraExposure(era);
17
+ * ```
18
+ */
19
+ export declare const eraExposure: (instanceId: string, api: DeriveApi) => (era: EraIndex) => Observable<DeriveEraExposurePaged>;
20
+ export declare const _erasExposure: (instanceId: string, api: DeriveApi) => (eras: EraIndex[], withActive: boolean) => Observable<DeriveEraExposurePaged[]>;
21
+ /**
22
+ * @name erasExposure
23
+ * @description Retrieves staking exposure details for multiple past eras.
24
+ * @param {boolean} withActive? (Optional) Whether to include the active era in the result.
25
+ * @example
26
+ * ```javascript
27
+ * const exposure = await api.derive.staking.erasExposure(true);
28
+ * ```
29
+ */
30
+ export declare const erasExposure: (instanceId: string, api: DeriveApi) => (withActive?: boolean) => Observable<DeriveEraExposurePaged[]>;
@@ -0,0 +1,8 @@
1
+ import type { Observable } from 'rxjs';
2
+ import type { EraIndex } from '@pezkuwi/types/interfaces';
3
+ import type { DeriveApi } from '../types.js';
4
+ /**
5
+ * @name erasHistoric
6
+ * @param {boolean} withActive? (Optional) Whether to include the active era in the result.
7
+ */
8
+ export declare function erasHistoric(instanceId: string, api: DeriveApi): (withActive?: boolean) => Observable<EraIndex[]>;
@@ -0,0 +1,18 @@
1
+ import type { Observable } from 'rxjs';
2
+ import type { EraIndex } from '@pezkuwi/types/interfaces';
3
+ import type { DeriveApi, DeriveEraPoints } from '../types.js';
4
+ export declare function _erasPoints(instanceId: string, api: DeriveApi): (eras: EraIndex[], withActive: boolean) => Observable<DeriveEraPoints[]>;
5
+ /**
6
+ * @name erasPoints
7
+ * @description Retrieves historical era points with its validators.
8
+ * @param {boolean} withActive? (Optional) Whether to include the active era in the result.
9
+ * @example
10
+ * ```javascript
11
+ * const points = await api.derive.staking.erasPoints(true);
12
+ * console.log(
13
+ * "Validator points:",
14
+ * points.map(({ era, eraPoints }) => `Era: ${era}, points ${eraPoints}`)
15
+ * );
16
+ * ```
17
+ */
18
+ export declare const erasPoints: (instanceId: string, api: DeriveApi) => (withActive?: boolean) => Observable<DeriveEraPoints[]>;