@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.
- package/README.md +30 -0
- package/build/accounts/accountId.d.ts +17 -0
- package/build/accounts/flags.d.ts +29 -0
- package/build/accounts/idAndIndex.d.ts +15 -0
- package/build/accounts/idToIndex.d.ts +16 -0
- package/build/accounts/identity.d.ts +48 -0
- package/build/accounts/index.d.ts +8 -0
- package/build/accounts/indexToId.d.ts +15 -0
- package/build/accounts/indexes.d.ts +16 -0
- package/build/accounts/info.d.ts +18 -0
- package/build/accounts/types.d.ts +39 -0
- package/build/alliance/index.d.ts +70 -0
- package/build/augment.d.ts +1 -0
- package/build/bagsList/get.d.ts +12 -0
- package/build/bagsList/getExpanded.d.ts +16 -0
- package/build/bagsList/index.d.ts +3 -0
- package/build/bagsList/listNodes.d.ts +9 -0
- package/build/bagsList/types.d.ts +13 -0
- package/build/bagsList/util.d.ts +2 -0
- package/build/balances/account.d.ts +17 -0
- package/build/balances/all.d.ts +20 -0
- package/build/balances/index.d.ts +20 -0
- package/build/balances/types.d.ts +69 -0
- package/build/balances/votingBalances.d.ts +15 -0
- package/build/bounties/bounties.d.ts +12 -0
- package/build/bounties/helpers/filterBountyProposals.d.ts +2 -0
- package/build/bounties/index.d.ts +1 -0
- package/build/bundle.d.ts +9 -0
- package/build/chain/bestNumber.d.ts +11 -0
- package/build/chain/bestNumberFinalized.d.ts +12 -0
- package/build/chain/bestNumberLag.d.ts +15 -0
- package/build/chain/getBlock.d.ts +15 -0
- package/build/chain/getBlockByNumber.d.ts +16 -0
- package/build/chain/getHeader.d.ts +16 -0
- package/build/chain/index.d.ts +10 -0
- package/build/chain/subscribeFinalizedBlocks.d.ts +14 -0
- package/build/chain/subscribeFinalizedHeads.d.ts +22 -0
- package/build/chain/subscribeNewBlocks.d.ts +14 -0
- package/build/chain/subscribeNewHeads.d.ts +15 -0
- package/build/chain/util.d.ts +9 -0
- package/build/collective/helpers.d.ts +6 -0
- package/build/collective/index.d.ts +3 -0
- package/build/collective/members.d.ts +2 -0
- package/build/collective/prime.d.ts +2 -0
- package/build/collective/proposals.d.ts +6 -0
- package/build/collective/types.d.ts +19 -0
- package/build/contracts/fees.d.ts +14 -0
- package/build/contracts/index.d.ts +1 -0
- package/build/council/index.d.ts +72 -0
- package/build/council/types.d.ts +6 -0
- package/build/council/votes.d.ts +11 -0
- package/build/council/votesOf.d.ts +16 -0
- package/build/crowdloan/childKey.d.ts +15 -0
- package/build/crowdloan/contributions.d.ts +14 -0
- package/build/crowdloan/index.d.ts +3 -0
- package/build/crowdloan/ownContributions.d.ts +15 -0
- package/build/crowdloan/types.d.ts +6 -0
- package/build/crowdloan/util.d.ts +10 -0
- package/build/democracy/dispatchQueue.d.ts +12 -0
- package/build/democracy/index.d.ts +11 -0
- package/build/democracy/locks.d.ts +14 -0
- package/build/democracy/nextExternal.d.ts +12 -0
- package/build/democracy/preimages.d.ts +24 -0
- package/build/democracy/proposals.d.ts +12 -0
- package/build/democracy/referendumIds.d.ts +12 -0
- package/build/democracy/referendums.d.ts +11 -0
- package/build/democracy/referendumsActive.d.ts +12 -0
- package/build/democracy/referendumsFinished.d.ts +15 -0
- package/build/democracy/referendumsInfo.d.ts +23 -0
- package/build/democracy/sqrtElectorate.d.ts +13 -0
- package/build/democracy/types.d.ts +70 -0
- package/build/democracy/util.d.ts +18 -0
- package/build/derive.d.ts +52 -0
- package/build/elections/index.d.ts +1 -0
- package/build/elections/info.d.ts +14 -0
- package/build/elections/types.d.ts +18 -0
- package/build/imOnline/index.d.ts +1 -0
- package/build/imOnline/receivedHeartbeats.d.ts +13 -0
- package/build/index.d.ts +2 -0
- package/build/membership/index.d.ts +70 -0
- package/build/packageDetect.d.ts +1 -0
- package/build/packageInfo.d.ts +6 -0
- package/build/parachains/index.d.ts +2 -0
- package/build/parachains/info.d.ts +19 -0
- package/build/parachains/overview.d.ts +15 -0
- package/build/parachains/types.d.ts +38 -0
- package/build/parachains/util.d.ts +3 -0
- package/build/session/index.d.ts +3 -0
- package/build/session/indexes.d.ts +15 -0
- package/build/session/info.d.ts +13 -0
- package/build/session/progress.d.ts +47 -0
- package/build/session/types.d.ts +19 -0
- package/build/society/candidates.d.ts +12 -0
- package/build/society/index.d.ts +4 -0
- package/build/society/info.d.ts +12 -0
- package/build/society/member.d.ts +14 -0
- package/build/society/members.d.ts +14 -0
- package/build/society/types.d.ts +27 -0
- package/build/staking/account.d.ts +31 -0
- package/build/staking/cache.d.ts +12 -0
- package/build/staking/currentPoints.d.ts +13 -0
- package/build/staking/electedInfo.d.ts +23 -0
- package/build/staking/erasExposure.d.ts +30 -0
- package/build/staking/erasHistoric.d.ts +8 -0
- package/build/staking/erasPoints.d.ts +18 -0
- package/build/staking/erasPrefs.d.ts +27 -0
- package/build/staking/erasRewards.d.ts +14 -0
- package/build/staking/erasSlashes.d.ts +26 -0
- package/build/staking/index.d.ts +22 -0
- package/build/staking/keys.d.ts +35 -0
- package/build/staking/overview.d.ts +19 -0
- package/build/staking/ownExposure.d.ts +37 -0
- package/build/staking/ownSlashes.d.ts +35 -0
- package/build/staking/query.d.ts +31 -0
- package/build/staking/stakerExposure.d.ts +33 -0
- package/build/staking/stakerPoints.d.ts +22 -0
- package/build/staking/stakerPrefs.d.ts +24 -0
- package/build/staking/stakerRewards.d.ts +49 -0
- package/build/staking/stakerSlashes.d.ts +22 -0
- package/build/staking/stashes.d.ts +16 -0
- package/build/staking/types.d.ts +139 -0
- package/build/staking/util.d.ts +14 -0
- package/build/staking/validators.d.ts +33 -0
- package/build/staking/waitingInfo.d.ts +16 -0
- package/build/technicalCommittee/index.d.ts +70 -0
- package/build/treasury/index.d.ts +1 -0
- package/build/treasury/proposals.d.ts +12 -0
- package/build/tx/constants.d.ts +5 -0
- package/build/tx/events.d.ts +22 -0
- package/build/tx/extrinsicInfo.d.ts +61 -0
- package/build/tx/index.d.ts +3 -0
- package/build/tx/signingInfo.d.ts +25 -0
- package/build/type/HeaderExtended.d.ts +4 -0
- package/build/type/SignedBlockExtended.d.ts +4 -0
- package/build/type/index.d.ts +2 -0
- package/build/type/types.d.ts +15 -0
- package/build/type/util.d.ts +2 -0
- package/build/types.d.ts +79 -0
- package/build/util/approvalFlagsToBools.d.ts +4 -0
- package/build/util/blockNumber.d.ts +7 -0
- package/build/util/cache.d.ts +4 -0
- package/build/util/cacheImpl.d.ts +3 -0
- package/build/util/first.d.ts +4 -0
- package/build/util/index.d.ts +7 -0
- package/build/util/lazy.d.ts +4 -0
- package/build/util/types.d.ts +6 -0
- package/package.json +42 -0
- package/src/accounts/accountId.ts +44 -0
- package/src/accounts/flags.ts +90 -0
- package/src/accounts/idAndIndex.ts +51 -0
- package/src/accounts/idToIndex.ts +31 -0
- package/src/accounts/identity.ts +235 -0
- package/src/accounts/index.ts +11 -0
- package/src/accounts/indexToId.ts +33 -0
- package/src/accounts/indexes.ts +56 -0
- package/src/accounts/info.ts +58 -0
- package/src/accounts/types.ts +48 -0
- package/src/alliance/index.ts +76 -0
- package/src/augment.ts +4 -0
- package/src/bagsList/get.ts +79 -0
- package/src/bagsList/getExpanded.ts +41 -0
- package/src/bagsList/index.ts +6 -0
- package/src/bagsList/listNodes.ts +50 -0
- package/src/bagsList/types.ts +18 -0
- package/src/bagsList/util.ts +14 -0
- package/src/balances/account.ts +210 -0
- package/src/balances/all.ts +246 -0
- package/src/balances/index.ts +26 -0
- package/src/balances/types.ts +79 -0
- package/src/balances/votingBalances.ts +33 -0
- package/src/bounties/bounties.spec.ts +162 -0
- package/src/bounties/bounties.ts +76 -0
- package/src/bounties/helpers/filterBountyProposals.ts +13 -0
- package/src/bounties/index.ts +4 -0
- package/src/bundle.ts +140 -0
- package/src/chain/bestNumber.ts +21 -0
- package/src/chain/bestNumberFinalized.ts +22 -0
- package/src/chain/bestNumberLag.ts +33 -0
- package/src/chain/getBlock.ts +43 -0
- package/src/chain/getBlockByNumber.ts +30 -0
- package/src/chain/getHeader.ts +37 -0
- package/src/chain/index.ts +13 -0
- package/src/chain/subscribeFinalizedBlocks.ts +30 -0
- package/src/chain/subscribeFinalizedHeads.ts +62 -0
- package/src/chain/subscribeNewBlocks.ts +30 -0
- package/src/chain/subscribeNewHeads.ts +38 -0
- package/src/chain/util.ts +112 -0
- package/src/checkTypes.manual.ts +8 -0
- package/src/collective/helpers.ts +36 -0
- package/src/collective/index.ts +6 -0
- package/src/collective/members.ts +8 -0
- package/src/collective/prime.ts +25 -0
- package/src/collective/proposals.ts +73 -0
- package/src/collective/types.ts +30 -0
- package/src/contracts/fees.ts +61 -0
- package/src/contracts/index.ts +4 -0
- package/src/council/index.ts +79 -0
- package/src/council/types.ts +11 -0
- package/src/council/votes.ts +97 -0
- package/src/council/votesOf.ts +35 -0
- package/src/crowdloan/childKey.ts +57 -0
- package/src/crowdloan/contributions.ts +142 -0
- package/src/crowdloan/index.ts +6 -0
- package/src/crowdloan/ownContributions.ts +81 -0
- package/src/crowdloan/types.ts +11 -0
- package/src/crowdloan/util.ts +33 -0
- package/src/democracy/dispatchQueue.ts +158 -0
- package/src/democracy/index.ts +14 -0
- package/src/democracy/locks.ts +114 -0
- package/src/democracy/nextExternal.ts +49 -0
- package/src/democracy/preimages.ts +171 -0
- package/src/democracy/proposals.ts +81 -0
- package/src/democracy/referendumIds.ts +37 -0
- package/src/democracy/referendums.ts +39 -0
- package/src/democracy/referendumsActive.ts +30 -0
- package/src/democracy/referendumsFinished.ts +37 -0
- package/src/democracy/referendumsInfo.ts +181 -0
- package/src/democracy/sqrtElectorate.ts +29 -0
- package/src/democracy/types.ts +84 -0
- package/src/democracy/util.ts +166 -0
- package/src/derive.ts +41 -0
- package/src/elections/index.ts +4 -0
- package/src/elections/info.ts +126 -0
- package/src/elections/types.ts +22 -0
- package/src/imOnline/index.ts +4 -0
- package/src/imOnline/receivedHeartbeats.ts +65 -0
- package/src/index.spec.ts +103 -0
- package/src/index.ts +6 -0
- package/src/membership/index.ts +76 -0
- package/src/mod.ts +4 -0
- package/src/packageDetect.ts +11 -0
- package/src/packageInfo.ts +6 -0
- package/src/parachains/index.ts +5 -0
- package/src/parachains/info.ts +111 -0
- package/src/parachains/overview.ts +63 -0
- package/src/parachains/types.ts +46 -0
- package/src/parachains/util.ts +11 -0
- package/src/session/index.ts +6 -0
- package/src/session/indexes.ts +90 -0
- package/src/session/info.ts +39 -0
- package/src/session/progress.ts +130 -0
- package/src/session/types.ts +25 -0
- package/src/society/candidates.ts +71 -0
- package/src/society/index.ts +7 -0
- package/src/society/info.ts +50 -0
- package/src/society/member.ts +28 -0
- package/src/society/members.ts +107 -0
- package/src/society/types.ts +33 -0
- package/src/staking/account.ts +112 -0
- package/src/staking/cache.ts +48 -0
- package/src/staking/currentPoints.ts +28 -0
- package/src/staking/electedInfo.ts +54 -0
- package/src/staking/erasExposure.ts +105 -0
- package/src/staking/erasHistoric.ts +47 -0
- package/src/staking/erasPoints.ts +67 -0
- package/src/staking/erasPrefs.ts +63 -0
- package/src/staking/erasRewards.ts +52 -0
- package/src/staking/erasSlashes.ts +69 -0
- package/src/staking/index.ts +25 -0
- package/src/staking/keys.ts +86 -0
- package/src/staking/overview.ts +42 -0
- package/src/staking/ownExposure.ts +83 -0
- package/src/staking/ownSlashes.ts +68 -0
- package/src/staking/query.ts +230 -0
- package/src/staking/stakerExposure.ts +78 -0
- package/src/staking/stakerPoints.ts +46 -0
- package/src/staking/stakerPrefs.ts +45 -0
- package/src/staking/stakerRewards.ts +298 -0
- package/src/staking/stakerSlashes.ts +45 -0
- package/src/staking/stashes.ts +55 -0
- package/src/staking/types.ts +174 -0
- package/src/staking/util.ts +94 -0
- package/src/staking/validators.ts +82 -0
- package/src/staking/waitingInfo.ts +45 -0
- package/src/technicalCommittee/index.ts +76 -0
- package/src/test/bountyFactory.ts +39 -0
- package/src/test/bytesFactory.ts +15 -0
- package/src/test/helpers.ts +23 -0
- package/src/test/proposalFactory.ts +25 -0
- package/src/treasury/index.ts +4 -0
- package/src/treasury/proposals.ts +109 -0
- package/src/tx/constants.ts +13 -0
- package/src/tx/events.ts +43 -0
- package/src/tx/extrinsicInfo.ts +123 -0
- package/src/tx/index.ts +6 -0
- package/src/tx/signingInfo.ts +129 -0
- package/src/type/HeaderExtended.ts +33 -0
- package/src/type/SignedBlockExtended.ts +75 -0
- package/src/type/index.ts +5 -0
- package/src/type/types.ts +21 -0
- package/src/type/util.ts +45 -0
- package/src/types.ts +97 -0
- package/src/util/approvalFlagToBools.spec.ts +37 -0
- package/src/util/approvalFlagsToBools.ts +26 -0
- package/src/util/blockNumber.ts +15 -0
- package/src/util/cache.ts +65 -0
- package/src/util/cacheImpl.ts +30 -0
- package/src/util/first.ts +20 -0
- package/src/util/index.ts +13 -0
- package/src/util/lazy.ts +16 -0
- package/src/util/types.ts +9 -0
- package/tsconfig.build.json +21 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.spec.json +27 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { EraIndex } from '@pezkuwi/types/interfaces';
|
|
3
|
+
import type { DeriveApi, DeriveEraPrefs } from '../types.js';
|
|
4
|
+
export declare function _eraPrefs(instanceId: string, api: DeriveApi): (era: EraIndex, withActive: boolean) => Observable<DeriveEraPrefs>;
|
|
5
|
+
/**
|
|
6
|
+
* @name eraPrefs
|
|
7
|
+
* @description Retrieves the validators commission preferences for a given staking era.
|
|
8
|
+
* @param {EraIndex} era The staking era to query.
|
|
9
|
+
* @example
|
|
10
|
+
* ```javascript
|
|
11
|
+
* const era = api.createType("EraIndex", 1000);
|
|
12
|
+
* const prefs = await api.derive.staking.eraPrefs(era);
|
|
13
|
+
* console.log(JSON.stringify(prefs));
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare const eraPrefs: (instanceId: string, api: DeriveApi) => (era: EraIndex) => Observable<DeriveEraPrefs>;
|
|
17
|
+
export declare const _erasPrefs: (instanceId: string, api: DeriveApi) => (eras: EraIndex[], withActive: boolean) => Observable<DeriveEraPrefs[]>;
|
|
18
|
+
/**
|
|
19
|
+
* @name erasPrefs
|
|
20
|
+
* @description Retrieves validators commission preferences for multiple past staking eras
|
|
21
|
+
* @param {boolean} withActive? (Optional) Whether to include the active era in the result.
|
|
22
|
+
* @example
|
|
23
|
+
* ```javascript
|
|
24
|
+
* const prefs = await api.derive.staking.erasPrefs(true);
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare const erasPrefs: (instanceId: string, api: DeriveApi) => (withActive?: boolean) => Observable<DeriveEraPrefs[]>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { EraIndex } from '@pezkuwi/types/interfaces';
|
|
3
|
+
import type { DeriveApi, DeriveEraRewards } from '../types.js';
|
|
4
|
+
export declare function _erasRewards(instanceId: string, api: DeriveApi): (eras: EraIndex[], withActive: boolean) => Observable<DeriveEraRewards[]>;
|
|
5
|
+
/**
|
|
6
|
+
* @name erasRewards
|
|
7
|
+
* @description Retrieves rewards for historical eras.
|
|
8
|
+
* @param {boolean} withActive? (Optional) Whether to include the active era in the result.
|
|
9
|
+
* @example
|
|
10
|
+
* ```javascript
|
|
11
|
+
* const rewards = await api.derive.staking.erasRewards(true);
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare const erasRewards: (instanceId: string, api: DeriveApi) => (withActive?: boolean) => Observable<DeriveEraRewards[]>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { EraIndex } from '@pezkuwi/types/interfaces';
|
|
3
|
+
import type { DeriveApi, DeriveEraSlashes } from '../types.js';
|
|
4
|
+
export declare function _eraSlashes(instanceId: string, api: DeriveApi): (era: EraIndex, withActive: boolean) => Observable<DeriveEraSlashes>;
|
|
5
|
+
/**
|
|
6
|
+
* @name eraSlashes
|
|
7
|
+
* @description Retrieves the slashes for a specific staking era.
|
|
8
|
+
* @param {EraIndex} eras The staking era to query.
|
|
9
|
+
* @example
|
|
10
|
+
* ```javascript
|
|
11
|
+
* const era = api.createType("EraIndex", 1000);
|
|
12
|
+
* const slashes = await api.derive.staking.eraSlashes(era);
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare const eraSlashes: (instanceId: string, api: DeriveApi) => (era: EraIndex) => Observable<DeriveEraSlashes>;
|
|
16
|
+
export declare const _erasSlashes: (instanceId: string, api: DeriveApi) => (eras: EraIndex[], withActive: boolean) => Observable<DeriveEraSlashes[]>;
|
|
17
|
+
/**
|
|
18
|
+
* @name erasSlashes
|
|
19
|
+
* @description Retrieves slashes for historical eras.
|
|
20
|
+
* @param {boolean} withActive? (Optional) Whether to include the active era in the result.
|
|
21
|
+
* @example
|
|
22
|
+
* ```javascript
|
|
23
|
+
* const slashes = await api.derive.staking.erasSlashes(true);
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare const erasSlashes: (instanceId: string, api: DeriveApi) => (withActive?: boolean) => Observable<DeriveEraSlashes[]>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export * from './account.js';
|
|
2
|
+
export * from './currentPoints.js';
|
|
3
|
+
export * from './electedInfo.js';
|
|
4
|
+
export * from './erasExposure.js';
|
|
5
|
+
export * from './erasHistoric.js';
|
|
6
|
+
export * from './erasPoints.js';
|
|
7
|
+
export * from './erasPrefs.js';
|
|
8
|
+
export * from './erasRewards.js';
|
|
9
|
+
export * from './erasSlashes.js';
|
|
10
|
+
export * from './keys.js';
|
|
11
|
+
export * from './overview.js';
|
|
12
|
+
export * from './ownExposure.js';
|
|
13
|
+
export * from './ownSlashes.js';
|
|
14
|
+
export * from './query.js';
|
|
15
|
+
export * from './stakerExposure.js';
|
|
16
|
+
export * from './stakerPoints.js';
|
|
17
|
+
export * from './stakerPrefs.js';
|
|
18
|
+
export * from './stakerRewards.js';
|
|
19
|
+
export * from './stakerSlashes.js';
|
|
20
|
+
export * from './stashes.js';
|
|
21
|
+
export * from './validators.js';
|
|
22
|
+
export * from './waitingInfo.js';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { DeriveApi } from '../types.js';
|
|
3
|
+
import type { DeriveStakingKeys } from './types.js';
|
|
4
|
+
/**
|
|
5
|
+
* @name keys
|
|
6
|
+
* @param { Uint8Array | string } stashId The stash account ID whose session keys are to be retrieved.
|
|
7
|
+
* @description Retrieves the session keys associated with a given stash account.
|
|
8
|
+
* @example
|
|
9
|
+
* ```javascript
|
|
10
|
+
* const keys = await api.derive.staking.keys(
|
|
11
|
+
* ALICE
|
|
12
|
+
* );
|
|
13
|
+
* console.log(
|
|
14
|
+
* "Session keys:",
|
|
15
|
+
* keys.sessionIds.map((key) => `Key: ${key}`)
|
|
16
|
+
* );
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare const keys: (instanceId: string, api: DeriveApi) => (stashId: string | Uint8Array<ArrayBufferLike>) => Observable<DeriveStakingKeys>;
|
|
20
|
+
/**
|
|
21
|
+
* @name keysMulti
|
|
22
|
+
* @description Retrieves session keys for multiple stash accounts.
|
|
23
|
+
* @param { (Uint8Array | string)[] } stashIds Array of stash account IDs.
|
|
24
|
+
* @example
|
|
25
|
+
* ```javascript
|
|
26
|
+
* const keysMulti = await api.derive.staking.keysMulti([ ALICE, BOB ]);
|
|
27
|
+
* keysMulti.forEach((keys) => {
|
|
28
|
+
* console.log(
|
|
29
|
+
* "Session keys:",
|
|
30
|
+
* keys.sessionIds.map((key) => `Key: ${key}`)
|
|
31
|
+
* );
|
|
32
|
+
* });
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare function keysMulti(instanceId: string, api: DeriveApi): (stashIds: (Uint8Array | string)[]) => Observable<DeriveStakingKeys[]>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { DeriveApi, DeriveStakingOverview } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* @name overview
|
|
5
|
+
* @description Retrieve the staking overview, including elected validators and points earned.
|
|
6
|
+
* @example
|
|
7
|
+
* ```javascript
|
|
8
|
+
* const {
|
|
9
|
+
* activeEra,
|
|
10
|
+
* activeEraStart,
|
|
11
|
+
* currentEra,
|
|
12
|
+
* currentIndex,
|
|
13
|
+
* nextElected,
|
|
14
|
+
* validatorCount,
|
|
15
|
+
* validators,
|
|
16
|
+
* } = await api.derive.staking.overview();
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare function overview(instanceId: string, api: DeriveApi): () => Observable<DeriveStakingOverview>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { u32 } from '@pezkuwi/types';
|
|
3
|
+
import type { EraIndex } from '@pezkuwi/types/interfaces';
|
|
4
|
+
import type { AnyNumber } from '@pezkuwi/types-codec/types';
|
|
5
|
+
import type { DeriveApi, DeriveOwnExposure } from '../types.js';
|
|
6
|
+
export declare function _ownExposures(instanceId: string, api: DeriveApi): (accountId: Uint8Array | string, eras: EraIndex[], withActive: boolean, page: u32 | AnyNumber) => Observable<DeriveOwnExposure[]>;
|
|
7
|
+
/**
|
|
8
|
+
* @name ownExposure
|
|
9
|
+
* @description Retrieves the staking exposure of a validator for a specific era, including their own stake.
|
|
10
|
+
* @param { Uint8Array | string } accountId The validator stash account.
|
|
11
|
+
* @param {EraIndex} era The staking era to query.
|
|
12
|
+
* @param { u32 | AnyNumber } page? (Optional) The pagination index.
|
|
13
|
+
* @example
|
|
14
|
+
* ```javascript
|
|
15
|
+
* const era = api.createType("EraIndex", 1000);
|
|
16
|
+
* const exposure = await api.derive.staking.ownExposure(
|
|
17
|
+
* "11VR4pF6c7kfBhfmuwwjWY3FodeYBKWx7ix2rsRCU2q6hqJ",
|
|
18
|
+
* era
|
|
19
|
+
* );
|
|
20
|
+
* console.log(JSON.stringify(exposure));
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare const ownExposure: (instanceId: string, api: DeriveApi) => (accountId: string | Uint8Array<ArrayBufferLike>, era: EraIndex, page?: u32 | AnyNumber) => Observable<DeriveOwnExposure>;
|
|
24
|
+
/**
|
|
25
|
+
* @name ownExposures
|
|
26
|
+
* @description Retrieves staking exposures for a validator across multiple historical eras.
|
|
27
|
+
* @param { Uint8Array | string } accountId The validator stash account.
|
|
28
|
+
* @param { boolean } withActive Whether to include the active era.
|
|
29
|
+
* @example
|
|
30
|
+
* ```javascript
|
|
31
|
+
* const exposures = await api.derive.staking.ownExposures(
|
|
32
|
+
* ALICE,
|
|
33
|
+
* true
|
|
34
|
+
* );
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare const ownExposures: (instanceId: string, api: DeriveApi) => (accountId: string | Uint8Array, withActive?: boolean) => Observable<DeriveOwnExposure[]>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { EraIndex } from '@pezkuwi/types/interfaces';
|
|
3
|
+
import type { DeriveApi, DeriveStakerSlashes } from '../types.js';
|
|
4
|
+
export declare function _ownSlashes(instanceId: string, api: DeriveApi): (accountId: Uint8Array | string, eras: EraIndex[], withActive: boolean) => Observable<DeriveStakerSlashes[]>;
|
|
5
|
+
/**
|
|
6
|
+
* @name ownSlash
|
|
7
|
+
* @description Retrieves the slashes applied to a specific account in a given era.
|
|
8
|
+
* @param { Uint8Array | string } accountId The validator stash account.
|
|
9
|
+
* @param {EraIndex} era The staking era to query.
|
|
10
|
+
* @example
|
|
11
|
+
* ```javascript
|
|
12
|
+
* const era = api.createType("EraIndex", 1000);
|
|
13
|
+
* const slashedAmount = await api.derive.staking.ownSlash(
|
|
14
|
+
* ALICE,
|
|
15
|
+
* era
|
|
16
|
+
* );
|
|
17
|
+
* console.log(`Era: ${slashedAmount.era}, total ${slashedAmount.total}`);
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare const ownSlash: (instanceId: string, api: DeriveApi) => (accountId: string | Uint8Array<ArrayBufferLike>, era: EraIndex) => Observable<DeriveStakerSlashes>;
|
|
21
|
+
/**
|
|
22
|
+
* @name ownSlashes
|
|
23
|
+
* @description Retrieves the slashes for a specific account across all historic eras.
|
|
24
|
+
* @param { Uint8Array | string } accountId The validator stash account.
|
|
25
|
+
* @param { boolean } withActive Whether to include the active era.
|
|
26
|
+
* @example
|
|
27
|
+
* ```javascript
|
|
28
|
+
* const slashes = await api.derive.staking.ownSlashes(
|
|
29
|
+
* ALICE,
|
|
30
|
+
* true
|
|
31
|
+
* );
|
|
32
|
+
* console.log(slashes);
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare const ownSlashes: (instanceId: string, api: DeriveApi) => (accountId: string | Uint8Array, withActive?: boolean) => Observable<DeriveStakerSlashes[]>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { u32 } from '@pezkuwi/types';
|
|
3
|
+
import type { AnyNumber } from '@pezkuwi/types-codec/types';
|
|
4
|
+
import type { DeriveApi, DeriveStakingQuery, StakingQueryFlags } from '../types.js';
|
|
5
|
+
/**
|
|
6
|
+
* @name query
|
|
7
|
+
* @param { Uint8Array | string } accountId The stash account to query.
|
|
8
|
+
* @param { StakingQueryFlags } flags Flags to customize the query.
|
|
9
|
+
* @param { u32 } page (Optional) pagination parameter.
|
|
10
|
+
* @description Retrieves staking details for a given stash account.
|
|
11
|
+
* @example
|
|
12
|
+
* ```javascript
|
|
13
|
+
* const stakingInfo = await api.derive.staking.query(
|
|
14
|
+
* ALICE,
|
|
15
|
+
* {}
|
|
16
|
+
* );
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare const query: (instanceId: string, api: DeriveApi) => (accountId: string | Uint8Array<ArrayBufferLike>, flags: StakingQueryFlags, page?: u32) => Observable<DeriveStakingQuery>;
|
|
20
|
+
/**
|
|
21
|
+
* @name queryMulti
|
|
22
|
+
* @param { (Uint8Array | string)[] } accountIds List of stash accounts to query.
|
|
23
|
+
* @param { StakingQueryFlags } flags Flags to customize the query.
|
|
24
|
+
* @param { u32 } page (Optional) pagination parameter.
|
|
25
|
+
* @description Retrieves staking details for multiple stash accounts.
|
|
26
|
+
* @example
|
|
27
|
+
* ```javascript
|
|
28
|
+
* const stakingInfos = await api.derive.staking.queryMulti([stashId1, stashId2], {});
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare function queryMulti(instanceId: string, api: DeriveApi): (accountIds: (Uint8Array | string)[], flags: StakingQueryFlags, page?: u32 | AnyNumber) => Observable<DeriveStakingQuery[]>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { EraIndex } from '@pezkuwi/types/interfaces';
|
|
3
|
+
import type { DeriveApi } from '../types.js';
|
|
4
|
+
import type { DeriveStakerExposure } from './types.js';
|
|
5
|
+
export declare function _stakerExposures(instanceId: string, api: DeriveApi): (accountIds: (Uint8Array | string)[], eras: EraIndex[], withActive?: boolean) => Observable<DeriveStakerExposure[][]>;
|
|
6
|
+
/**
|
|
7
|
+
* @name stakerExposures
|
|
8
|
+
* @param { (Uint8Array | string)[] } accountIds List of validator stash accounts.
|
|
9
|
+
* @param { boolean } withActive Whether to include the active era.
|
|
10
|
+
* @description Retrieves staking exposure for multiple accounts across historical eras.
|
|
11
|
+
* @example
|
|
12
|
+
* ```javascript
|
|
13
|
+
* const exposure = await api.derive.staking.stakerExposures(
|
|
14
|
+
* [ALICE, BOB],
|
|
15
|
+
* true
|
|
16
|
+
* );
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare function stakerExposures(instanceId: string, api: DeriveApi): (accountIds: (Uint8Array | string)[], withActive?: boolean) => Observable<DeriveStakerExposure[][]>;
|
|
20
|
+
/**
|
|
21
|
+
* @name stakerExposure
|
|
22
|
+
* @param { Uint8Array | string } accountId The validator stash account.
|
|
23
|
+
* @param { boolean } withActive Whether to include the active era.
|
|
24
|
+
* @description Retrieves staking exposure for a single account across historical eras. Exposure refers to the total stake associated with a validator.
|
|
25
|
+
* @example
|
|
26
|
+
* ```javascript
|
|
27
|
+
* const exposure = await api.derive.staking.stakerExposure(
|
|
28
|
+
* ALICE,
|
|
29
|
+
* true
|
|
30
|
+
* );
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare const stakerExposure: (instanceId: string, api: DeriveApi) => (accountId: string | Uint8Array<ArrayBufferLike>, withActive?: boolean) => Observable<DeriveStakerExposure[]>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { EraIndex } from '@pezkuwi/types/interfaces';
|
|
3
|
+
import type { DeriveApi, DeriveStakerPoints } from '../types.js';
|
|
4
|
+
export declare function _stakerPoints(instanceId: string, api: DeriveApi): (accountId: Uint8Array | string, eras: EraIndex[], withActive: boolean) => Observable<DeriveStakerPoints[]>;
|
|
5
|
+
/**
|
|
6
|
+
* @name stakerPoints
|
|
7
|
+
* @param { Uint8Array | string } accountId The stakers AccountId.
|
|
8
|
+
* @param { boolean } withActive Whether to include the active era.
|
|
9
|
+
* @description Retrieves the era reward points earned by a given staker across all eras.
|
|
10
|
+
* @example
|
|
11
|
+
* ```javascript
|
|
12
|
+
* const points = await api.derive.staking.stakerPoints(
|
|
13
|
+
* ALICE, //Alice accountId
|
|
14
|
+
* false
|
|
15
|
+
* );
|
|
16
|
+
* console.log(
|
|
17
|
+
* 'Validator Era Points:',
|
|
18
|
+
* points.map(({ era, points }) => `Era ${era}: ${points.toString()} points`)
|
|
19
|
+
* );
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare const stakerPoints: (instanceId: string, api: DeriveApi) => (accountId: string | Uint8Array, withActive?: boolean) => Observable<DeriveStakerPoints[]>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { EraIndex } from '@pezkuwi/types/interfaces';
|
|
3
|
+
import type { DeriveApi, DeriveStakerPrefs } from '../types.js';
|
|
4
|
+
export declare function _stakerPrefs(instanceId: string, api: DeriveApi): (accountId: Uint8Array | string, eras: EraIndex[], withActive: boolean) => Observable<DeriveStakerPrefs[]>;
|
|
5
|
+
/**
|
|
6
|
+
* @name stakerPrefs
|
|
7
|
+
* @param { Uint8Array | string } accountId The stakers AccountId.
|
|
8
|
+
* @param { boolean } withActive Whether to include the active era.
|
|
9
|
+
* @description Retrieves the validator preferences for a given staker across historical eras.
|
|
10
|
+
* @example
|
|
11
|
+
* ```javascript
|
|
12
|
+
* const prefs = await api.derive.staking.stakerPrefs(
|
|
13
|
+
* ALICE, //Alice accountId
|
|
14
|
+
* false
|
|
15
|
+
* );
|
|
16
|
+
* console.log(
|
|
17
|
+
* 'Validator Preferences:',
|
|
18
|
+
* prefs.map(
|
|
19
|
+
* ({ era, validatorPrefs }) => `Era ${era}: Commission ${validatorPrefs.commission.toString()}`
|
|
20
|
+
* )
|
|
21
|
+
* );
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare const stakerPrefs: (instanceId: string, api: DeriveApi) => (accountId: string | Uint8Array, withActive?: boolean) => Observable<DeriveStakerPrefs[]>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { EraIndex } from '@pezkuwi/types/interfaces';
|
|
3
|
+
import type { DeriveApi, DeriveEraPoints, DeriveEraPrefs, DeriveEraRewards, DeriveStakerReward } from '../types.js';
|
|
4
|
+
type ErasResult = [DeriveEraPoints[], DeriveEraPrefs[], DeriveEraRewards[]];
|
|
5
|
+
export declare function _stakerRewardsEras(instanceId: string, api: DeriveApi): (eras: EraIndex[], withActive?: boolean) => Observable<ErasResult>;
|
|
6
|
+
export declare function _stakerRewards(instanceId: string, api: DeriveApi): (accountIds: (Uint8Array | string)[], eras: EraIndex[], withActive?: boolean) => Observable<DeriveStakerReward[][]>;
|
|
7
|
+
/**
|
|
8
|
+
* @name stakerRewards
|
|
9
|
+
* @description Staking rewards history for a given staker.
|
|
10
|
+
* @param { Uint8Array | string } accountId The stakers AccountId.
|
|
11
|
+
* @param { boolean } withActive Whether to include the active era.
|
|
12
|
+
* @example
|
|
13
|
+
* ```javascript
|
|
14
|
+
* const rewards = await api.derive.staking.stakerRewards(
|
|
15
|
+
* ALICE, //Alice accountId
|
|
16
|
+
* false
|
|
17
|
+
* );
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare const stakerRewards: (instanceId: string, api: DeriveApi) => (accountId: string | Uint8Array<ArrayBufferLike>, withActive?: boolean) => Observable<DeriveStakerReward[]>;
|
|
21
|
+
/**
|
|
22
|
+
* @name stakerRewardsMultiEras
|
|
23
|
+
* @description Staking rewards for multiple stakers over specific eras.
|
|
24
|
+
* @param { Uint8Array | string } accountIds List of stakers identified by their AccountId.
|
|
25
|
+
* @param { EraIndex[] } eras Eras for which to retrieve the data.
|
|
26
|
+
* @example
|
|
27
|
+
* ```javascript
|
|
28
|
+
* const rewards = await api.derive.staking.stakerRewardsMultiEras(
|
|
29
|
+
* [ALICE, BOB, CHARLIER], //accountIds
|
|
30
|
+
* [100,101] //eras
|
|
31
|
+
* );
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare function stakerRewardsMultiEras(instanceId: string, api: DeriveApi): (accountIds: (Uint8Array | string)[], eras: EraIndex[]) => Observable<DeriveStakerReward[][]>;
|
|
35
|
+
/**
|
|
36
|
+
* @name stakerRewardsMulti
|
|
37
|
+
* @description Staking rewards for multiple stakers.
|
|
38
|
+
* @param { Uint8Array | string } accountIds List of stakers identified by their AccountId.
|
|
39
|
+
* @param { boolean } withActive Whether to include the active era.
|
|
40
|
+
* @example
|
|
41
|
+
* ```javascript
|
|
42
|
+
* const rewards = await api.derive.staking.stakerRewardsMulti(
|
|
43
|
+
* [ALICE, BOB, CHARLIER], //accountIds
|
|
44
|
+
* true
|
|
45
|
+
* );
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare function stakerRewardsMulti(instanceId: string, api: DeriveApi): (accountIds: (Uint8Array | string)[], withActive?: boolean) => Observable<DeriveStakerReward[][]>;
|
|
49
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { EraIndex } from '@pezkuwi/types/interfaces';
|
|
3
|
+
import type { DeriveApi, DeriveStakerSlashes } from '../types.js';
|
|
4
|
+
export declare function _stakerSlashes(instanceId: string, api: DeriveApi): (accountId: Uint8Array | string, eras: EraIndex[], withActive: boolean) => Observable<DeriveStakerSlashes[]>;
|
|
5
|
+
/**
|
|
6
|
+
* @name stakerSlashes
|
|
7
|
+
* @param { Uint8Array | string } accountId The stakers AccountId.
|
|
8
|
+
* @param { boolean } withActive Whether to include the active era.
|
|
9
|
+
* @description Retrieve the historical slashes (penalties) for a given staker.
|
|
10
|
+
* @example
|
|
11
|
+
* ```javascript
|
|
12
|
+
* const stakerSlashes = await api.derive.staking.stakerSlashes(
|
|
13
|
+
* ALICE, //Alice accountId
|
|
14
|
+
* true
|
|
15
|
+
* );
|
|
16
|
+
* console.log(
|
|
17
|
+
* 'Staker Slashes:',
|
|
18
|
+
* stakerSlashes.map(({ era, total }) => `Era ${era}: Slashed ${total.toString()}`)
|
|
19
|
+
* );
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare const stakerSlashes: (instanceId: string, api: DeriveApi) => (accountId: string | Uint8Array, withActive?: boolean) => Observable<DeriveStakerSlashes[]>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { AccountId } from '@pezkuwi/types/interfaces';
|
|
3
|
+
import type { DeriveApi } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* @name stashes
|
|
6
|
+
* @description Retrieve the list of all validator stashes.
|
|
7
|
+
* @example
|
|
8
|
+
* ```javascript
|
|
9
|
+
* const stashes = await api.derive.staking.stashes();
|
|
10
|
+
* console.log(
|
|
11
|
+
* "Validator Stashes:",
|
|
12
|
+
* stashes.map((s) => s.toString())
|
|
13
|
+
* );
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare function stashes(instanceId: string, api: DeriveApi): () => Observable<AccountId[]>;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import type { Option, u32, Vec } from '@pezkuwi/types';
|
|
2
|
+
import type { AccountId, Balance, EraIndex, RewardPoint } from '@pezkuwi/types/interfaces';
|
|
3
|
+
import type { PalletStakingRewardDestination, PalletStakingStakingLedger, PalletStakingValidatorPrefs, SpStakingExposure, SpStakingExposurePage, SpStakingPagedExposureMetadata } from '@pezkuwi/types/lookup';
|
|
4
|
+
import type { BN } from '@pezkuwi/util';
|
|
5
|
+
import type { DeriveSessionIndexes } from '../session/types.js';
|
|
6
|
+
export type DeriveEraValPoints = Record<string, RewardPoint>;
|
|
7
|
+
export type DeriveEraValPrefs = Record<string, PalletStakingValidatorPrefs>;
|
|
8
|
+
export type DeriveEraValSlash = Record<string, Balance>;
|
|
9
|
+
export interface DeriveEraPoints {
|
|
10
|
+
era: EraIndex;
|
|
11
|
+
eraPoints: RewardPoint;
|
|
12
|
+
validators: DeriveEraValPoints;
|
|
13
|
+
}
|
|
14
|
+
export interface DeriveEraPrefs {
|
|
15
|
+
era: EraIndex;
|
|
16
|
+
validators: DeriveEraValPrefs;
|
|
17
|
+
}
|
|
18
|
+
export interface DeriveEraRewards {
|
|
19
|
+
era: EraIndex;
|
|
20
|
+
eraReward: Balance;
|
|
21
|
+
}
|
|
22
|
+
export interface DeriveEraSlashes {
|
|
23
|
+
era: EraIndex;
|
|
24
|
+
nominators: DeriveEraValSlash;
|
|
25
|
+
validators: DeriveEraValSlash;
|
|
26
|
+
}
|
|
27
|
+
export interface DeriveStakerPoints {
|
|
28
|
+
era: EraIndex;
|
|
29
|
+
eraPoints: RewardPoint;
|
|
30
|
+
points: RewardPoint;
|
|
31
|
+
}
|
|
32
|
+
export interface DeriveOwnExposure {
|
|
33
|
+
clipped: SpStakingExposure;
|
|
34
|
+
exposurePaged: Option<SpStakingExposurePage>;
|
|
35
|
+
era: EraIndex;
|
|
36
|
+
exposure: SpStakingExposure;
|
|
37
|
+
exposureMeta: Option<SpStakingPagedExposureMetadata>;
|
|
38
|
+
}
|
|
39
|
+
export interface DeriveEraExposureNominating {
|
|
40
|
+
validatorId: string;
|
|
41
|
+
validatorIndex: number;
|
|
42
|
+
}
|
|
43
|
+
export type DeriveEraNominatorExposure = Record<string, DeriveEraExposureNominating[]>;
|
|
44
|
+
export type DeriveEraValidatorExposure = Record<string, SpStakingExposure>;
|
|
45
|
+
export type DeriveEraValidatorExposurePaged = Record<string, SpStakingExposurePage | SpStakingExposure>;
|
|
46
|
+
export interface DeriveEraExposure {
|
|
47
|
+
era: EraIndex;
|
|
48
|
+
nominators: DeriveEraNominatorExposure;
|
|
49
|
+
validators: DeriveEraValidatorExposure;
|
|
50
|
+
}
|
|
51
|
+
export interface DeriveEraExposurePaged {
|
|
52
|
+
era: EraIndex;
|
|
53
|
+
nominators: DeriveEraNominatorExposure;
|
|
54
|
+
validators: DeriveEraValidatorExposurePaged;
|
|
55
|
+
}
|
|
56
|
+
export interface DeriveStakerExposure {
|
|
57
|
+
era: EraIndex;
|
|
58
|
+
isEmpty: boolean;
|
|
59
|
+
isValidator: boolean;
|
|
60
|
+
nominating: DeriveEraExposureNominating[];
|
|
61
|
+
validators: DeriveEraValidatorExposurePaged;
|
|
62
|
+
}
|
|
63
|
+
export interface DeriveStakerPrefs {
|
|
64
|
+
era: EraIndex;
|
|
65
|
+
validatorPrefs: PalletStakingValidatorPrefs;
|
|
66
|
+
}
|
|
67
|
+
export interface DeriveStakerRewardValidator {
|
|
68
|
+
total: Balance;
|
|
69
|
+
value: Balance;
|
|
70
|
+
}
|
|
71
|
+
export interface DeriveStakerReward {
|
|
72
|
+
era: EraIndex;
|
|
73
|
+
eraReward: Balance;
|
|
74
|
+
isClaimed: boolean;
|
|
75
|
+
isEmpty: boolean;
|
|
76
|
+
isValidator: boolean;
|
|
77
|
+
nominating: DeriveEraExposureNominating[];
|
|
78
|
+
validators: Record<string, DeriveStakerRewardValidator>;
|
|
79
|
+
}
|
|
80
|
+
export interface DeriveStakerSlashes {
|
|
81
|
+
era: EraIndex;
|
|
82
|
+
total: Balance;
|
|
83
|
+
}
|
|
84
|
+
export type DeriveOwnSlashes = DeriveStakerSlashes;
|
|
85
|
+
export interface DeriveStakingKeys {
|
|
86
|
+
nextSessionIds: AccountId[];
|
|
87
|
+
sessionIds: AccountId[];
|
|
88
|
+
}
|
|
89
|
+
export interface DeriveStakingValidators {
|
|
90
|
+
nextElected: AccountId[];
|
|
91
|
+
validators: AccountId[];
|
|
92
|
+
}
|
|
93
|
+
export interface DeriveStakingStash {
|
|
94
|
+
controllerId: AccountId | null;
|
|
95
|
+
exposureEraStakers: SpStakingExposure;
|
|
96
|
+
exposurePaged: Option<SpStakingExposurePage>;
|
|
97
|
+
exposureMeta: Option<SpStakingPagedExposureMetadata>;
|
|
98
|
+
nominators: AccountId[];
|
|
99
|
+
rewardDestination: PalletStakingRewardDestination | null;
|
|
100
|
+
stashId: AccountId;
|
|
101
|
+
validatorPrefs: PalletStakingValidatorPrefs;
|
|
102
|
+
claimedRewardsEras: Vec<u32>;
|
|
103
|
+
}
|
|
104
|
+
export interface DeriveStakingQuery extends DeriveStakingStash {
|
|
105
|
+
accountId: AccountId;
|
|
106
|
+
stakingLedger: PalletStakingStakingLedger;
|
|
107
|
+
}
|
|
108
|
+
export interface DeriveStakingElected {
|
|
109
|
+
info: DeriveStakingQuery[];
|
|
110
|
+
nextElected: AccountId[];
|
|
111
|
+
validators: AccountId[];
|
|
112
|
+
}
|
|
113
|
+
export interface DeriveStakingWaiting {
|
|
114
|
+
info: DeriveStakingQuery[];
|
|
115
|
+
waiting: AccountId[];
|
|
116
|
+
}
|
|
117
|
+
export interface DeriveUnlocking {
|
|
118
|
+
remainingEras: BN;
|
|
119
|
+
value: Balance;
|
|
120
|
+
}
|
|
121
|
+
export interface DeriveStakingAccount extends DeriveStakingQuery, DeriveStakingKeys {
|
|
122
|
+
redeemable?: Balance;
|
|
123
|
+
unlocking?: DeriveUnlocking[];
|
|
124
|
+
}
|
|
125
|
+
export interface DeriveStakingOverview extends DeriveSessionIndexes {
|
|
126
|
+
nextElected: AccountId[];
|
|
127
|
+
validators: AccountId[];
|
|
128
|
+
}
|
|
129
|
+
export interface StakingQueryFlags {
|
|
130
|
+
withController?: boolean;
|
|
131
|
+
withDestination?: boolean;
|
|
132
|
+
withExposure?: boolean;
|
|
133
|
+
withExposureErasStakersLegacy?: boolean;
|
|
134
|
+
withLedger?: boolean;
|
|
135
|
+
withNominations?: boolean;
|
|
136
|
+
withPrefs?: boolean;
|
|
137
|
+
withExposureMeta?: boolean;
|
|
138
|
+
withClaimedRewardsEras?: boolean;
|
|
139
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { ObsInnerType } from '@pezkuwi/api-base/types';
|
|
3
|
+
import type { EraIndex } from '@pezkuwi/types/interfaces';
|
|
4
|
+
import type { ExactDerive } from '../derive.js';
|
|
5
|
+
import type { DeriveApi } from '../types.js';
|
|
6
|
+
type ApplyReturn<T extends keyof ExactDerive['staking']> = ReturnType<ExactDerive['staking'][T]>;
|
|
7
|
+
export declare function filterEras<T extends {
|
|
8
|
+
era: EraIndex;
|
|
9
|
+
}>(eras: EraIndex[], list: T[]): EraIndex[];
|
|
10
|
+
export declare function erasHistoricApply<F extends '_erasExposure' | '_erasPoints' | '_erasPrefs' | '_erasRewards' | '_erasSlashes'>(fn: F): (instanceId: string, api: DeriveApi) => (withActive?: boolean) => ApplyReturn<F>;
|
|
11
|
+
export declare function erasHistoricApplyAccount<F extends '_ownExposures' | '_ownSlashes' | '_stakerPoints' | '_stakerPrefs' | '_stakerSlashes'>(fn: F): (instanceId: string, api: DeriveApi) => (accountId: string | Uint8Array, withActive?: boolean) => ApplyReturn<F>;
|
|
12
|
+
export declare function singleEra<F extends '_eraExposure' | '_eraPrefs' | '_eraSlashes'>(fn: F): (instanceId: string, api: DeriveApi) => (era: EraIndex) => ApplyReturn<F>;
|
|
13
|
+
export declare function combineEras<F extends '_eraExposure' | '_eraPrefs' | '_eraSlashes'>(fn: F): (instanceId: string, api: DeriveApi) => (eras: EraIndex[], withActive: boolean) => Observable<ObsInnerType<ApplyReturn<F>>[]>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { AccountId } from '@pezkuwi/types/interfaces';
|
|
3
|
+
import type { DeriveApi, DeriveStakingValidators } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* @name nextElected
|
|
6
|
+
* @description Retrieves the list of accounts that are set to be the next elected validators in the staking system. It provides a preview of who will be validators in the next staking era.
|
|
7
|
+
* @example
|
|
8
|
+
* ```javascript
|
|
9
|
+
* const nextElected = await api.derive.staking.nextElected();
|
|
10
|
+
* console.log(
|
|
11
|
+
* "Next Elected Validators:",
|
|
12
|
+
* nextElected.map((acc) => acc.toString())
|
|
13
|
+
* );
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare function nextElected(instanceId: string, api: DeriveApi): () => Observable<AccountId[]>;
|
|
17
|
+
/**
|
|
18
|
+
* @name validators
|
|
19
|
+
* @description Retrieve latest list of validators.
|
|
20
|
+
* @example
|
|
21
|
+
* ```javascript
|
|
22
|
+
* const { validators, nextElected } = await api.derive.staking.validators();
|
|
23
|
+
* console.log(
|
|
24
|
+
* "Current Validators:",
|
|
25
|
+
* validators.map((v) => v.toString())
|
|
26
|
+
* );
|
|
27
|
+
* console.log(
|
|
28
|
+
* "Next Elected Validators:",
|
|
29
|
+
* nextElected.map((v) => v.toString())
|
|
30
|
+
* );
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare function validators(instanceId: string, api: DeriveApi): () => Observable<DeriveStakingValidators>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { DeriveApi, DeriveStakingWaiting, StakingQueryFlags } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* @name waitingInfo
|
|
5
|
+
* @param {StakingQueryFlags} flags? (Optional) Query flags to filter the staking data.
|
|
6
|
+
* @description Staking candidates who are waiting to become validators.
|
|
7
|
+
* @example
|
|
8
|
+
* ```javascript
|
|
9
|
+
* const { waiting, info } = await api.derive.staking.waitingInfo();
|
|
10
|
+
* console.log(
|
|
11
|
+
* "Waiting Candidates:",
|
|
12
|
+
* waiting.map((acc) => acc.toString())
|
|
13
|
+
* );
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare function waitingInfo(instanceId: string, api: DeriveApi): (flags?: StakingQueryFlags) => Observable<DeriveStakingWaiting>;
|