@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,62 @@
|
|
|
1
|
+
// Copyright 2017-2025 @polkadot/api-derive authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import type { Observable } from 'rxjs';
|
|
5
|
+
import type { Hash, Header } from '@pezkuwi/types/interfaces';
|
|
6
|
+
import type { DeriveApi } from '../types.js';
|
|
7
|
+
|
|
8
|
+
import { from, mergeMap, of, switchMap } from 'rxjs';
|
|
9
|
+
|
|
10
|
+
import { memo } from '../util/index.js';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Returns a header range from startHash to to (not including) endHash, i.e. lastBlock.parentHash === endHash
|
|
14
|
+
*/
|
|
15
|
+
export function _getHeaderRange (instanceId: string, api: DeriveApi): (startHash: Hash, endHash: Hash, prev?: Header[]) => Observable<Header[]> {
|
|
16
|
+
return memo(instanceId, (startHash: Hash, endHash: Hash, prev: Header[] = []): Observable<Header[]> =>
|
|
17
|
+
api.rpc.chain.getHeader(startHash).pipe(
|
|
18
|
+
switchMap((header) =>
|
|
19
|
+
header.parentHash.eq(endHash)
|
|
20
|
+
? of([header, ...prev])
|
|
21
|
+
: api.derive.chain._getHeaderRange(header.parentHash, endHash, [header, ...prev])
|
|
22
|
+
)
|
|
23
|
+
)
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @name subscribeFinalizedHeads
|
|
29
|
+
* @description An observable of the finalized block headers. Unlike the base
|
|
30
|
+
* chain.subscribeFinalizedHeads this does not skip any headers. Since finalization
|
|
31
|
+
* may skip specific blocks (finalization happens in terms of chains), this version
|
|
32
|
+
* of the derive tracks missing headers (since last retrieved) and provides them
|
|
33
|
+
* to the caller.
|
|
34
|
+
* @example
|
|
35
|
+
* ```javascript
|
|
36
|
+
* const unsub = await api.derive.chain.subscribeFinalizedHeads((finalizedHead) => {
|
|
37
|
+
* console.log(`${finalizedHead.hash}`);
|
|
38
|
+
* });
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export function subscribeFinalizedHeads (instanceId: string, api: DeriveApi): () => Observable<Header> {
|
|
42
|
+
return memo(instanceId, (): Observable<Header> => {
|
|
43
|
+
let prevHash: Hash | null = null;
|
|
44
|
+
|
|
45
|
+
return api.rpc.chain.subscribeFinalizedHeads().pipe(
|
|
46
|
+
mergeMap((header) => {
|
|
47
|
+
const endHash = prevHash;
|
|
48
|
+
const startHash = header.parentHash;
|
|
49
|
+
|
|
50
|
+
prevHash = header.createdAtHash = header.hash;
|
|
51
|
+
|
|
52
|
+
return endHash === null || startHash.eq(endHash)
|
|
53
|
+
? of(header)
|
|
54
|
+
: api.derive.chain._getHeaderRange(startHash, endHash, [header]).pipe(
|
|
55
|
+
switchMap((headers) =>
|
|
56
|
+
from(headers)
|
|
57
|
+
)
|
|
58
|
+
);
|
|
59
|
+
})
|
|
60
|
+
);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Copyright 2017-2025 @polkadot/api-derive authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import type { Observable } from 'rxjs';
|
|
5
|
+
import type { SignedBlockExtended } from '../type/types.js';
|
|
6
|
+
import type { DeriveApi } from '../types.js';
|
|
7
|
+
|
|
8
|
+
import { mergeMap } from 'rxjs';
|
|
9
|
+
|
|
10
|
+
import { memo } from '../util/index.js';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @name subscribeNewBlocks
|
|
14
|
+
* @returns The latest block & events for that block
|
|
15
|
+
* @example
|
|
16
|
+
* ```javascript
|
|
17
|
+
* const unsub = await api.derive.chain.subscribeNewBlocks((newBlock) => {
|
|
18
|
+
* console.log(`Block Hash: ${newBlock.hash}`);
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export function subscribeNewBlocks (instanceId: string, api: DeriveApi): () => Observable<SignedBlockExtended> {
|
|
23
|
+
return memo(instanceId, (): Observable<SignedBlockExtended> =>
|
|
24
|
+
api.derive.chain.subscribeNewHeads().pipe(
|
|
25
|
+
mergeMap((header) =>
|
|
26
|
+
api.derive.chain.getBlock(header.createdAtHash || header.hash)
|
|
27
|
+
)
|
|
28
|
+
)
|
|
29
|
+
);
|
|
30
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Copyright 2017-2025 @polkadot/api-derive authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import type { Observable } from 'rxjs';
|
|
5
|
+
import type { HeaderExtended } from '../type/types.js';
|
|
6
|
+
import type { DeriveApi } from '../types.js';
|
|
7
|
+
|
|
8
|
+
import { map, mergeMap } from 'rxjs';
|
|
9
|
+
|
|
10
|
+
import { createHeaderExtended } from '../type/index.js';
|
|
11
|
+
import { memo } from '../util/index.js';
|
|
12
|
+
import { getAuthorDetails } from './util.js';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @name subscribeNewHeads
|
|
16
|
+
* @returns A header with the current header (including extracted author).
|
|
17
|
+
* @description An observable of the current block header and it's author.
|
|
18
|
+
* @example
|
|
19
|
+
* ```javascript
|
|
20
|
+
* api.derive.chain.subscribeNewHeads((header) => {
|
|
21
|
+
* console.log(`block #${header.number} was authored by ${header.author}`);
|
|
22
|
+
* });
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export function subscribeNewHeads (instanceId: string, api: DeriveApi): () => Observable<HeaderExtended> {
|
|
26
|
+
return memo(instanceId, (): Observable<HeaderExtended> =>
|
|
27
|
+
api.rpc.chain.subscribeNewHeads().pipe(
|
|
28
|
+
mergeMap((header) =>
|
|
29
|
+
getAuthorDetails(api, header)
|
|
30
|
+
),
|
|
31
|
+
map(([header, validators, author]): HeaderExtended => {
|
|
32
|
+
header.createdAtHash = header.hash;
|
|
33
|
+
|
|
34
|
+
return createHeaderExtended(header.registry, header, validators, author);
|
|
35
|
+
})
|
|
36
|
+
)
|
|
37
|
+
);
|
|
38
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
// Copyright 2017-2025 @polkadot/api-derive authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import type { Observable } from 'rxjs';
|
|
5
|
+
import type { QueryableStorage } from '@pezkuwi/api-base/types';
|
|
6
|
+
import type { Compact, Vec } from '@pezkuwi/types';
|
|
7
|
+
import type { AccountId, BlockNumber, Header } from '@pezkuwi/types/interfaces';
|
|
8
|
+
import type { PalletImOnlineSr25519AppSr25519Public } from '@pezkuwi/types/lookup';
|
|
9
|
+
import type { Codec, IOption } from '@pezkuwi/types/types';
|
|
10
|
+
import type { DeriveApi } from '../types.js';
|
|
11
|
+
|
|
12
|
+
import { combineLatest, map, mergeMap, of, switchMap } from 'rxjs';
|
|
13
|
+
|
|
14
|
+
import { memo, unwrapBlockNumber } from '../util/index.js';
|
|
15
|
+
|
|
16
|
+
export type BlockNumberDerive = (instanceId: string, api: DeriveApi) => () => Observable<BlockNumber>;
|
|
17
|
+
|
|
18
|
+
type OptionMapping = IOption<{ account: AccountId } & Codec>;
|
|
19
|
+
type OptionNimbus = IOption<{ nimbus: PalletImOnlineSr25519AppSr25519Public } & Codec>;
|
|
20
|
+
|
|
21
|
+
export function createBlockNumberDerive <T extends { number: Compact<BlockNumber> | BlockNumber }> (fn: (api: DeriveApi) => Observable<T>): BlockNumberDerive {
|
|
22
|
+
return (instanceId: string, api: DeriveApi) =>
|
|
23
|
+
memo(instanceId, () =>
|
|
24
|
+
fn(api).pipe(
|
|
25
|
+
map(unwrapBlockNumber)
|
|
26
|
+
)
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** @internal */
|
|
31
|
+
function getAuthorDetailsWithAt (header: Header, queryAt: QueryableStorage<'rxjs'>): Observable<[Header, Vec<AccountId> | null, AccountId | null]> {
|
|
32
|
+
const validators = queryAt.session?.validators
|
|
33
|
+
? queryAt.session.validators()
|
|
34
|
+
: of(null);
|
|
35
|
+
|
|
36
|
+
// nimbus consensus stores the session key of the block author in header logs
|
|
37
|
+
const { logs: [log] } = header.digest;
|
|
38
|
+
const loggedAuthor = (log && (
|
|
39
|
+
(log.isConsensus && log.asConsensus[0].isNimbus && log.asConsensus[1]) ||
|
|
40
|
+
(log.isPreRuntime && log.asPreRuntime[0].isNimbus && log.asPreRuntime[1])
|
|
41
|
+
));
|
|
42
|
+
|
|
43
|
+
if (loggedAuthor) {
|
|
44
|
+
// use the author mapping pallet, if available (ie: moonbeam, moonriver), to map session (nimbus) key to author (collator/validator) key
|
|
45
|
+
if (queryAt['authorMapping']?.['mappingWithDeposit']) {
|
|
46
|
+
return combineLatest([
|
|
47
|
+
of(header),
|
|
48
|
+
validators,
|
|
49
|
+
queryAt['authorMapping']['mappingWithDeposit']<OptionMapping>(loggedAuthor).pipe(
|
|
50
|
+
map((o) =>
|
|
51
|
+
o.unwrapOr({ account: null }).account
|
|
52
|
+
)
|
|
53
|
+
)
|
|
54
|
+
]);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// fall back to session and parachain staking pallets, if available (ie: manta, calamari), to map session (nimbus) key to author (collator) key
|
|
58
|
+
if (queryAt['parachainStaking']?.['selectedCandidates'] && queryAt.session?.nextKeys) {
|
|
59
|
+
const loggedHex = loggedAuthor.toHex();
|
|
60
|
+
|
|
61
|
+
return combineLatest([
|
|
62
|
+
of(header),
|
|
63
|
+
validators,
|
|
64
|
+
queryAt['parachainStaking']['selectedCandidates']<Vec<AccountId>>().pipe(
|
|
65
|
+
mergeMap((selectedCandidates) =>
|
|
66
|
+
combineLatest([
|
|
67
|
+
of(selectedCandidates),
|
|
68
|
+
queryAt.session.nextKeys.multi<OptionNimbus>(selectedCandidates).pipe(
|
|
69
|
+
map((nextKeys) =>
|
|
70
|
+
nextKeys.findIndex((o) =>
|
|
71
|
+
o.unwrapOrDefault().nimbus.toHex() === loggedHex
|
|
72
|
+
)
|
|
73
|
+
)
|
|
74
|
+
)
|
|
75
|
+
])
|
|
76
|
+
),
|
|
77
|
+
map(([selectedCandidates, index]) =>
|
|
78
|
+
index === -1
|
|
79
|
+
? null
|
|
80
|
+
: selectedCandidates[index]
|
|
81
|
+
)
|
|
82
|
+
)
|
|
83
|
+
]);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// normal operation, non-mapping
|
|
88
|
+
return combineLatest([
|
|
89
|
+
of(header),
|
|
90
|
+
validators,
|
|
91
|
+
of(null)
|
|
92
|
+
]);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export function getAuthorDetails (api: DeriveApi, header: Header, blockHash?: Uint8Array | string): Observable<[Header, Vec<AccountId> | null, AccountId | null]> {
|
|
96
|
+
// For on-chain state, we need to retrieve it as per the start
|
|
97
|
+
// of the block being constructed, i.e. session validators would
|
|
98
|
+
// be at the point of the block construction, not when all operations
|
|
99
|
+
// has been supplied.
|
|
100
|
+
//
|
|
101
|
+
// However for the first block (no parentHash available), we would
|
|
102
|
+
// just use the as-is
|
|
103
|
+
return api.queryAt(
|
|
104
|
+
header.parentHash.isEmpty
|
|
105
|
+
? blockHash || header.hash
|
|
106
|
+
: header.parentHash
|
|
107
|
+
).pipe(
|
|
108
|
+
switchMap((queryAt) =>
|
|
109
|
+
getAuthorDetailsWithAt(header, queryAt)
|
|
110
|
+
)
|
|
111
|
+
);
|
|
112
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Copyright 2017-2025 @polkadot/api-derive authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import type { Observable } from 'rxjs';
|
|
5
|
+
import type { DeriveApi } from '../types.js';
|
|
6
|
+
import type { Collective } from './types.js';
|
|
7
|
+
|
|
8
|
+
import { of } from 'rxjs';
|
|
9
|
+
|
|
10
|
+
import { isFunction } from '@pezkuwi/util';
|
|
11
|
+
|
|
12
|
+
import { memo } from '../util/index.js';
|
|
13
|
+
|
|
14
|
+
export function getInstance (api: DeriveApi, section: string): DeriveApi['query']['council'] {
|
|
15
|
+
const instances = api.registry.getModuleInstances(api.runtimeVersion.specName, section);
|
|
16
|
+
const name = instances?.length
|
|
17
|
+
? instances[0]
|
|
18
|
+
: section;
|
|
19
|
+
|
|
20
|
+
return api.query[name as 'council'];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function withSection <T, F extends (...args: any[]) => Observable<T>> (section: Collective, fn: (query: DeriveApi['query']['council'], api: DeriveApi, instanceId: string) => F): (instanceId: string, api: DeriveApi) => F {
|
|
24
|
+
return (instanceId: string, api: DeriveApi) =>
|
|
25
|
+
memo(instanceId, fn(getInstance(api, section), api, instanceId)) as unknown as F;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function callMethod <T> (method: 'members' | 'proposals' | 'proposalCount', empty: T): (section: Collective) => (instanceId: string, api: DeriveApi) => () => Observable<T> {
|
|
29
|
+
return (section: Collective) =>
|
|
30
|
+
withSection(section, (query) =>
|
|
31
|
+
(): Observable<T> =>
|
|
32
|
+
isFunction(query?.[method])
|
|
33
|
+
? query[method]() as unknown as Observable<T>
|
|
34
|
+
: of(empty)
|
|
35
|
+
);
|
|
36
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Copyright 2017-2025 @polkadot/api-derive authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import type { MembersFn } from './types.js';
|
|
5
|
+
|
|
6
|
+
import { callMethod } from './helpers.js';
|
|
7
|
+
|
|
8
|
+
export const members: MembersFn = /*#__PURE__*/ callMethod('members', []);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Copyright 2017-2025 @polkadot/api-derive authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import type { Observable } from 'rxjs';
|
|
5
|
+
import type { AccountId } from '@pezkuwi/types/interfaces';
|
|
6
|
+
import type { Collective, PrimeFnRet } from './types.js';
|
|
7
|
+
|
|
8
|
+
import { map, of } from 'rxjs';
|
|
9
|
+
|
|
10
|
+
import { isFunction } from '@pezkuwi/util';
|
|
11
|
+
|
|
12
|
+
import { withSection } from './helpers.js';
|
|
13
|
+
|
|
14
|
+
export function prime (section: Collective): PrimeFnRet {
|
|
15
|
+
return withSection(section, (query) =>
|
|
16
|
+
(): Observable<AccountId | null> =>
|
|
17
|
+
isFunction(query?.prime)
|
|
18
|
+
? query.prime().pipe(
|
|
19
|
+
map((o): AccountId | null =>
|
|
20
|
+
o.unwrapOr(null)
|
|
21
|
+
)
|
|
22
|
+
)
|
|
23
|
+
: of(null)
|
|
24
|
+
);
|
|
25
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// Copyright 2017-2025 @polkadot/api-derive authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import type { Observable } from 'rxjs';
|
|
5
|
+
import type { Option } from '@pezkuwi/types';
|
|
6
|
+
import type { Hash, Proposal, Votes } from '@pezkuwi/types/interfaces';
|
|
7
|
+
import type { DeriveApi, DeriveCollectiveProposal } from '../types.js';
|
|
8
|
+
import type { Collective, HasProposalsFnRet, ProposalCountFn, ProposalFnRet, ProposalHashesFn, ProposalsFnRet } from './types.js';
|
|
9
|
+
|
|
10
|
+
import { catchError, combineLatest, map, of, switchMap } from 'rxjs';
|
|
11
|
+
|
|
12
|
+
import { isFunction } from '@pezkuwi/util';
|
|
13
|
+
|
|
14
|
+
import { firstObservable } from '../util/index.js';
|
|
15
|
+
import { callMethod, withSection } from './helpers.js';
|
|
16
|
+
|
|
17
|
+
type Result = [(Hash | Uint8Array | string)[], (Option<Proposal> | null)[], Option<Votes>[]];
|
|
18
|
+
|
|
19
|
+
function parse (api: DeriveApi, [hashes, proposals, votes]: Result): DeriveCollectiveProposal[] {
|
|
20
|
+
return proposals.map((o, index): DeriveCollectiveProposal => ({
|
|
21
|
+
hash: api.registry.createType('Hash', hashes[index]),
|
|
22
|
+
proposal: o && o.isSome
|
|
23
|
+
? o.unwrap()
|
|
24
|
+
: null,
|
|
25
|
+
votes: votes[index].unwrapOr(null)
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function _proposalsFrom (api: DeriveApi, query: DeriveApi['query']['council'], hashes: (Hash | Uint8Array | string)[]): Observable<DeriveCollectiveProposal[]> {
|
|
30
|
+
return (isFunction(query?.proposals) && hashes.length
|
|
31
|
+
? combineLatest([
|
|
32
|
+
of(hashes),
|
|
33
|
+
// this should simply be api.query[section].proposalOf.multi<Option<Proposal>>(hashes),
|
|
34
|
+
// however we have had cases on Edgeware where the indices have moved around after an
|
|
35
|
+
// upgrade, which results in invalid on-chain data
|
|
36
|
+
query.proposalOf.multi<Option<Proposal>>(hashes).pipe(
|
|
37
|
+
catchError(() => of(hashes.map(() => null)))
|
|
38
|
+
),
|
|
39
|
+
query.voting.multi<Option<Votes>>(hashes)
|
|
40
|
+
])
|
|
41
|
+
: of<Result>([[], [], []])
|
|
42
|
+
).pipe(
|
|
43
|
+
map((r) => parse(api, r))
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function hasProposals (section: Collective): HasProposalsFnRet {
|
|
48
|
+
return withSection(section, (query) =>
|
|
49
|
+
(): Observable<boolean> =>
|
|
50
|
+
of(isFunction(query?.proposals))
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function proposals (section: Collective): ProposalsFnRet {
|
|
55
|
+
return withSection(section, (query, api) =>
|
|
56
|
+
(): Observable<DeriveCollectiveProposal[]> =>
|
|
57
|
+
api.derive[section as 'council'].proposalHashes().pipe(
|
|
58
|
+
switchMap((all) => _proposalsFrom(api, query, all))
|
|
59
|
+
)
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function proposal (section: Collective): ProposalFnRet {
|
|
64
|
+
return withSection(section, (query, api) =>
|
|
65
|
+
(hash: Hash | Uint8Array | string): Observable<DeriveCollectiveProposal | null> =>
|
|
66
|
+
isFunction(query?.proposals)
|
|
67
|
+
? firstObservable(_proposalsFrom(api, query, [hash]))
|
|
68
|
+
: of(null)
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export const proposalCount: ProposalCountFn = /*#__PURE__*/ callMethod('proposalCount', null);
|
|
73
|
+
export const proposalHashes: ProposalHashesFn = /*#__PURE__*/ callMethod('proposals', []);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Copyright 2017-2025 @polkadot/api-derive authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import type { Observable } from 'rxjs';
|
|
5
|
+
import type { u32 } from '@pezkuwi/types';
|
|
6
|
+
import type { AccountId, Hash } from '@pezkuwi/types/interfaces';
|
|
7
|
+
import type { DeriveApi, DeriveCollectiveProposal } from '../types.js';
|
|
8
|
+
|
|
9
|
+
export type Collective = 'allianceMotion' | 'council' | 'membership' | 'technicalCommittee';
|
|
10
|
+
|
|
11
|
+
export type HasProposalsFnRet = (instanceId: string, api: DeriveApi) => () => Observable<boolean>;
|
|
12
|
+
export type HasProposalsFn = (section: Collective) => HasProposalsFnRet;
|
|
13
|
+
|
|
14
|
+
export type MembersFnRet = (instanceId: string, api: DeriveApi) => () => Observable<AccountId[]>;
|
|
15
|
+
export type MembersFn = (section: Collective) => MembersFnRet;
|
|
16
|
+
|
|
17
|
+
export type PrimeFnRet = (instanceId: string, api: DeriveApi) => () => Observable<AccountId | null>;
|
|
18
|
+
export type PrimeFn = (section: Collective) => PrimeFnRet;
|
|
19
|
+
|
|
20
|
+
export type ProposalFnRet = (instanceId: string, api: DeriveApi) => (hash: Hash | Uint8Array | string) => Observable<DeriveCollectiveProposal | null>;
|
|
21
|
+
export type ProposalFn = (section: Collective) => ProposalFnRet;
|
|
22
|
+
|
|
23
|
+
export type ProposalsFnRet = (instanceId: string, api: DeriveApi) => () => Observable<DeriveCollectiveProposal[]>;
|
|
24
|
+
export type ProposalsFn = (section: Collective) => ProposalsFnRet;
|
|
25
|
+
|
|
26
|
+
export type ProposalCountFnRet = (instanceId: string, api: DeriveApi) => () => Observable<u32 | null>;
|
|
27
|
+
export type ProposalCountFn = (section: Collective) => ProposalCountFnRet;
|
|
28
|
+
|
|
29
|
+
export type ProposalHashesFnRet = (instanceId: string, api: DeriveApi) => () => Observable<Hash[]>;
|
|
30
|
+
export type ProposalHashesFn = (section: Collective) => ProposalHashesFnRet;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Copyright 2017-2025 @polkadot/api-derive authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import type { Observable } from 'rxjs';
|
|
5
|
+
import type { BN } from '@pezkuwi/util';
|
|
6
|
+
import type { DeriveApi, DeriveContractFees } from '../types.js';
|
|
7
|
+
|
|
8
|
+
import { map, of } from 'rxjs';
|
|
9
|
+
|
|
10
|
+
import { memo } from '../util/index.js';
|
|
11
|
+
|
|
12
|
+
type ResultV2 = [BN, BN, BN, BN, BN, BN, BN, BN, BN, BN];
|
|
13
|
+
|
|
14
|
+
// query via constants (current applicable path)
|
|
15
|
+
function queryConstants (api: DeriveApi): Observable<ResultV2> {
|
|
16
|
+
return of([
|
|
17
|
+
// deprecated
|
|
18
|
+
api.consts.contracts['callBaseFee'] || api.registry.createType('Balance'),
|
|
19
|
+
api.consts.contracts['contractFee'] || api.registry.createType('Balance'),
|
|
20
|
+
api.consts.contracts['creationFee'] || api.registry.createType('Balance'),
|
|
21
|
+
api.consts.contracts['transactionBaseFee'] || api.registry.createType('Balance'),
|
|
22
|
+
api.consts.contracts['transactionByteFee'] || api.registry.createType('Balance'),
|
|
23
|
+
api.consts.contracts['transferFee'] || api.registry.createType('Balance'),
|
|
24
|
+
|
|
25
|
+
// current
|
|
26
|
+
api.consts.contracts['rentByteFee'] || api.registry.createType('Balance'),
|
|
27
|
+
api.consts.contracts['rentDepositOffset'] || api.registry.createType('Balance'),
|
|
28
|
+
api.consts.contracts['surchargeReward'] || api.registry.createType('Balance'),
|
|
29
|
+
api.consts.contracts['tombstoneDeposit'] || api.registry.createType('Balance')
|
|
30
|
+
]) as unknown as Observable<ResultV2>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @name fees
|
|
35
|
+
* @returns An object containing the combined results of the queries for
|
|
36
|
+
* all relevant contract fees as declared in the substrate chain spec.
|
|
37
|
+
* @example
|
|
38
|
+
* ```javascript
|
|
39
|
+
* api.derive.contracts.fees(([creationFee, transferFee]) => {
|
|
40
|
+
* console.log(`The fee for creating a new contract on this chain is ${creationFee} units. The fee required to call this contract is ${transferFee} units.`);
|
|
41
|
+
* });
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export function fees (instanceId: string, api: DeriveApi): () => Observable<DeriveContractFees> {
|
|
45
|
+
return memo(instanceId, (): Observable<DeriveContractFees> => {
|
|
46
|
+
return queryConstants(api).pipe(
|
|
47
|
+
map(([callBaseFee, contractFee, creationFee, transactionBaseFee, transactionByteFee, transferFee, rentByteFee, rentDepositOffset, surchargeReward, tombstoneDeposit]): DeriveContractFees => ({
|
|
48
|
+
callBaseFee,
|
|
49
|
+
contractFee,
|
|
50
|
+
creationFee,
|
|
51
|
+
rentByteFee,
|
|
52
|
+
rentDepositOffset,
|
|
53
|
+
surchargeReward,
|
|
54
|
+
tombstoneDeposit,
|
|
55
|
+
transactionBaseFee,
|
|
56
|
+
transactionByteFee,
|
|
57
|
+
transferFee
|
|
58
|
+
}))
|
|
59
|
+
);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// Copyright 2017-2025 @polkadot/api-derive authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { hasProposals as collectiveHasProposals, members as collectiveMembers, prime as collectivePrime, proposal as collectiveProposal, proposalCount as collectiveProposalCount, proposalHashes as collectiveProposalHashes, proposals as collectiveProposals } from '../collective/index.js';
|
|
5
|
+
|
|
6
|
+
export * from './votes.js';
|
|
7
|
+
export * from './votesOf.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @name members
|
|
11
|
+
* @description Retrieves the list of members in the "council" collective.
|
|
12
|
+
* @example
|
|
13
|
+
* ```javascript
|
|
14
|
+
* const members = await api.derive.council.members();
|
|
15
|
+
* console.log(`Members: ${JSON.stringify(members)});
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export const members = /*#__PURE__*/ collectiveMembers('council');
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @name hasProposals
|
|
22
|
+
* @description Checks if there are any active proposals in the "council" collective.
|
|
23
|
+
* @example
|
|
24
|
+
* ```javascript
|
|
25
|
+
* const exists = await api.derive.council.hasProposals();
|
|
26
|
+
* console.log(exists);
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export const hasProposals = /*#__PURE__*/ collectiveHasProposals('council');
|
|
30
|
+
/**
|
|
31
|
+
* @name proposal
|
|
32
|
+
* @description Retrieves details of a specific proposal in the "councilMotion" collective by its hash.
|
|
33
|
+
* @example
|
|
34
|
+
* ```javascript
|
|
35
|
+
* const proposalDetails = await api.derive.council.proposal(PROPOSAL_HASH);
|
|
36
|
+
* console.log(proposalDetails);
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export const proposal = /*#__PURE__*/ collectiveProposal('council');
|
|
40
|
+
/**
|
|
41
|
+
* @name proposalCount
|
|
42
|
+
* @description Retrieves the total number of proposals in the "council" collective.
|
|
43
|
+
* @example
|
|
44
|
+
* ```javascript
|
|
45
|
+
* const count = await api.derive.council.proposalCount();
|
|
46
|
+
* console.log(`Amount of proposals: ${count}`);
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export const proposalCount = /*#__PURE__*/ collectiveProposalCount('council');
|
|
50
|
+
/**
|
|
51
|
+
* @name proposalHashes
|
|
52
|
+
* @description Retrieves an array of hashes for all active proposals in the "council" collective.
|
|
53
|
+
* @example
|
|
54
|
+
* ```javascript
|
|
55
|
+
* const hashes = await api.derive.council.proposalHashes();
|
|
56
|
+
* console.log(`Proposals ${JSON.stringify(hashes)}`);
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export const proposalHashes = /*#__PURE__*/ collectiveProposalHashes('council');
|
|
60
|
+
/**
|
|
61
|
+
* @name proposals
|
|
62
|
+
* @description Retrieves a list of all active proposals in the "council" collective.
|
|
63
|
+
* @example
|
|
64
|
+
* ```javascript
|
|
65
|
+
* const proposals = await api.derive.council.proposals();
|
|
66
|
+
* console.log(proposals);
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
export const proposals = /*#__PURE__*/ collectiveProposals('council');
|
|
70
|
+
/**
|
|
71
|
+
* @name prime
|
|
72
|
+
* @description Retrieves the prime member of the "council" collective, if one exists.
|
|
73
|
+
* @example
|
|
74
|
+
* ```javascript
|
|
75
|
+
* const primeMember = await api.derive.council.prime();
|
|
76
|
+
* console.log(primeMember);
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
export const prime = /*#__PURE__*/ collectivePrime('council');
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Copyright 2017-2025 @polkadot/api-derive authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import type { AccountId, Balance } from '@pezkuwi/types/interfaces';
|
|
5
|
+
|
|
6
|
+
export interface DeriveCouncilVote {
|
|
7
|
+
stake: Balance;
|
|
8
|
+
votes: AccountId[];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type DeriveCouncilVotes = [AccountId, DeriveCouncilVote][];
|