@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,16 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { AnyNumber } from '@pezkuwi/types/types';
|
|
3
|
+
import type { SignedBlockExtended } from '../type/types.js';
|
|
4
|
+
import type { DeriveApi } from '../types.js';
|
|
5
|
+
/**
|
|
6
|
+
* @name getBlockByNumber
|
|
7
|
+
* @param {( BN | bigint | Uint8Array | number | string )} blockNumber
|
|
8
|
+
* @description Get a specific block (e.g. rpc.chain.getBlock) and extend it with the author by block number
|
|
9
|
+
* @example
|
|
10
|
+
* ```javascript
|
|
11
|
+
* const { author, block } = await api.derive.chain.getBlockByNumber(123);
|
|
12
|
+
*
|
|
13
|
+
* console.log(`block #${block.header.number} was authored by ${author}`);
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare function getBlockByNumber(instanceId: string, api: DeriveApi): (blockNumber: AnyNumber) => Observable<SignedBlockExtended>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { HeaderExtended } from '../type/types.js';
|
|
3
|
+
import type { DeriveApi } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* @name getHeader
|
|
6
|
+
* @param {( Uint8Array | string )} hash - A block hash as U8 array or string.
|
|
7
|
+
* @returns An array containing the block header and the block author
|
|
8
|
+
* @description Get a specific block header and extend it with the author
|
|
9
|
+
* @example
|
|
10
|
+
* ```javascript
|
|
11
|
+
* const { author, number } = await api.derive.chain.getHeader('0x123...456');
|
|
12
|
+
*
|
|
13
|
+
* console.log(`block #${number} was authored by ${author}`);
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare function getHeader(instanceId: string, api: DeriveApi): (blockHash: Uint8Array | string) => Observable<HeaderExtended>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './bestNumber.js';
|
|
2
|
+
export * from './bestNumberFinalized.js';
|
|
3
|
+
export * from './bestNumberLag.js';
|
|
4
|
+
export * from './getBlock.js';
|
|
5
|
+
export * from './getBlockByNumber.js';
|
|
6
|
+
export * from './getHeader.js';
|
|
7
|
+
export * from './subscribeFinalizedBlocks.js';
|
|
8
|
+
export * from './subscribeFinalizedHeads.js';
|
|
9
|
+
export * from './subscribeNewBlocks.js';
|
|
10
|
+
export * from './subscribeNewHeads.js';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { SignedBlockExtended } from '../type/types.js';
|
|
3
|
+
import type { DeriveApi } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* @name subscribeFinalizedBlocks
|
|
6
|
+
* @description Retrieves the finalized block & events for that block
|
|
7
|
+
* @example
|
|
8
|
+
* ```javascript
|
|
9
|
+
* const unsub = await api.derive.chain.subscribeFinalizedBlocks((finalizedBlock) => {
|
|
10
|
+
* console.log(`# Finalized block ${finalizedBlock.block.hash}`);
|
|
11
|
+
* });
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare function subscribeFinalizedBlocks(instanceId: string, api: DeriveApi): () => Observable<SignedBlockExtended>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { Hash, Header } from '@pezkuwi/types/interfaces';
|
|
3
|
+
import type { DeriveApi } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Returns a header range from startHash to to (not including) endHash, i.e. lastBlock.parentHash === endHash
|
|
6
|
+
*/
|
|
7
|
+
export declare function _getHeaderRange(instanceId: string, api: DeriveApi): (startHash: Hash, endHash: Hash, prev?: Header[]) => Observable<Header[]>;
|
|
8
|
+
/**
|
|
9
|
+
* @name subscribeFinalizedHeads
|
|
10
|
+
* @description An observable of the finalized block headers. Unlike the base
|
|
11
|
+
* chain.subscribeFinalizedHeads this does not skip any headers. Since finalization
|
|
12
|
+
* may skip specific blocks (finalization happens in terms of chains), this version
|
|
13
|
+
* of the derive tracks missing headers (since last retrieved) and provides them
|
|
14
|
+
* to the caller.
|
|
15
|
+
* @example
|
|
16
|
+
* ```javascript
|
|
17
|
+
* const unsub = await api.derive.chain.subscribeFinalizedHeads((finalizedHead) => {
|
|
18
|
+
* console.log(`${finalizedHead.hash}`);
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare function subscribeFinalizedHeads(instanceId: string, api: DeriveApi): () => Observable<Header>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { SignedBlockExtended } from '../type/types.js';
|
|
3
|
+
import type { DeriveApi } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* @name subscribeNewBlocks
|
|
6
|
+
* @returns The latest block & events for that block
|
|
7
|
+
* @example
|
|
8
|
+
* ```javascript
|
|
9
|
+
* const unsub = await api.derive.chain.subscribeNewBlocks((newBlock) => {
|
|
10
|
+
* console.log(`Block Hash: ${newBlock.hash}`);
|
|
11
|
+
* });
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare function subscribeNewBlocks(instanceId: string, api: DeriveApi): () => Observable<SignedBlockExtended>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { HeaderExtended } from '../type/types.js';
|
|
3
|
+
import type { DeriveApi } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* @name subscribeNewHeads
|
|
6
|
+
* @returns A header with the current header (including extracted author).
|
|
7
|
+
* @description An observable of the current block header and it's author.
|
|
8
|
+
* @example
|
|
9
|
+
* ```javascript
|
|
10
|
+
* api.derive.chain.subscribeNewHeads((header) => {
|
|
11
|
+
* console.log(`block #${header.number} was authored by ${header.author}`);
|
|
12
|
+
* });
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare function subscribeNewHeads(instanceId: string, api: DeriveApi): () => Observable<HeaderExtended>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { Compact, Vec } from '@pezkuwi/types';
|
|
3
|
+
import type { AccountId, BlockNumber, Header } from '@pezkuwi/types/interfaces';
|
|
4
|
+
import type { DeriveApi } from '../types.js';
|
|
5
|
+
export type BlockNumberDerive = (instanceId: string, api: DeriveApi) => () => Observable<BlockNumber>;
|
|
6
|
+
export declare function createBlockNumberDerive<T extends {
|
|
7
|
+
number: Compact<BlockNumber> | BlockNumber;
|
|
8
|
+
}>(fn: (api: DeriveApi) => Observable<T>): BlockNumberDerive;
|
|
9
|
+
export declare function getAuthorDetails(api: DeriveApi, header: Header, blockHash?: Uint8Array | string): Observable<[Header, Vec<AccountId> | null, AccountId | null]>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { DeriveApi } from '../types.js';
|
|
3
|
+
import type { Collective } from './types.js';
|
|
4
|
+
export declare function getInstance(api: DeriveApi, section: string): DeriveApi['query']['council'];
|
|
5
|
+
export declare 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;
|
|
6
|
+
export declare function callMethod<T>(method: 'members' | 'proposals' | 'proposalCount', empty: T): (section: Collective) => (instanceId: string, api: DeriveApi) => () => Observable<T>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Collective, HasProposalsFnRet, ProposalCountFn, ProposalFnRet, ProposalHashesFn, ProposalsFnRet } from './types.js';
|
|
2
|
+
export declare function hasProposals(section: Collective): HasProposalsFnRet;
|
|
3
|
+
export declare function proposals(section: Collective): ProposalsFnRet;
|
|
4
|
+
export declare function proposal(section: Collective): ProposalFnRet;
|
|
5
|
+
export declare const proposalCount: ProposalCountFn;
|
|
6
|
+
export declare const proposalHashes: ProposalHashesFn;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { u32 } from '@pezkuwi/types';
|
|
3
|
+
import type { AccountId, Hash } from '@pezkuwi/types/interfaces';
|
|
4
|
+
import type { DeriveApi, DeriveCollectiveProposal } from '../types.js';
|
|
5
|
+
export type Collective = 'allianceMotion' | 'council' | 'membership' | 'technicalCommittee';
|
|
6
|
+
export type HasProposalsFnRet = (instanceId: string, api: DeriveApi) => () => Observable<boolean>;
|
|
7
|
+
export type HasProposalsFn = (section: Collective) => HasProposalsFnRet;
|
|
8
|
+
export type MembersFnRet = (instanceId: string, api: DeriveApi) => () => Observable<AccountId[]>;
|
|
9
|
+
export type MembersFn = (section: Collective) => MembersFnRet;
|
|
10
|
+
export type PrimeFnRet = (instanceId: string, api: DeriveApi) => () => Observable<AccountId | null>;
|
|
11
|
+
export type PrimeFn = (section: Collective) => PrimeFnRet;
|
|
12
|
+
export type ProposalFnRet = (instanceId: string, api: DeriveApi) => (hash: Hash | Uint8Array | string) => Observable<DeriveCollectiveProposal | null>;
|
|
13
|
+
export type ProposalFn = (section: Collective) => ProposalFnRet;
|
|
14
|
+
export type ProposalsFnRet = (instanceId: string, api: DeriveApi) => () => Observable<DeriveCollectiveProposal[]>;
|
|
15
|
+
export type ProposalsFn = (section: Collective) => ProposalsFnRet;
|
|
16
|
+
export type ProposalCountFnRet = (instanceId: string, api: DeriveApi) => () => Observable<u32 | null>;
|
|
17
|
+
export type ProposalCountFn = (section: Collective) => ProposalCountFnRet;
|
|
18
|
+
export type ProposalHashesFnRet = (instanceId: string, api: DeriveApi) => () => Observable<Hash[]>;
|
|
19
|
+
export type ProposalHashesFn = (section: Collective) => ProposalHashesFnRet;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { DeriveApi, DeriveContractFees } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* @name fees
|
|
5
|
+
* @returns An object containing the combined results of the queries for
|
|
6
|
+
* all relevant contract fees as declared in the substrate chain spec.
|
|
7
|
+
* @example
|
|
8
|
+
* ```javascript
|
|
9
|
+
* api.derive.contracts.fees(([creationFee, transferFee]) => {
|
|
10
|
+
* 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.`);
|
|
11
|
+
* });
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare function fees(instanceId: string, api: DeriveApi): () => Observable<DeriveContractFees>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './fees.js';
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export * from './votes.js';
|
|
2
|
+
export * from './votesOf.js';
|
|
3
|
+
/**
|
|
4
|
+
* @name members
|
|
5
|
+
* @description Retrieves the list of members in the "council" collective.
|
|
6
|
+
* @example
|
|
7
|
+
* ```javascript
|
|
8
|
+
* const members = await api.derive.council.members();
|
|
9
|
+
* console.log(`Members: ${JSON.stringify(members)});
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export declare const members: import("../collective/types.js").MembersFnRet;
|
|
13
|
+
/**
|
|
14
|
+
* @name hasProposals
|
|
15
|
+
* @description Checks if there are any active proposals in the "council" collective.
|
|
16
|
+
* @example
|
|
17
|
+
* ```javascript
|
|
18
|
+
* const exists = await api.derive.council.hasProposals();
|
|
19
|
+
* console.log(exists);
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare const hasProposals: import("../collective/types.js").HasProposalsFnRet;
|
|
23
|
+
/**
|
|
24
|
+
* @name proposal
|
|
25
|
+
* @description Retrieves details of a specific proposal in the "councilMotion" collective by its hash.
|
|
26
|
+
* @example
|
|
27
|
+
* ```javascript
|
|
28
|
+
* const proposalDetails = await api.derive.council.proposal(PROPOSAL_HASH);
|
|
29
|
+
* console.log(proposalDetails);
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare const proposal: import("../collective/types.js").ProposalFnRet;
|
|
33
|
+
/**
|
|
34
|
+
* @name proposalCount
|
|
35
|
+
* @description Retrieves the total number of proposals in the "council" collective.
|
|
36
|
+
* @example
|
|
37
|
+
* ```javascript
|
|
38
|
+
* const count = await api.derive.council.proposalCount();
|
|
39
|
+
* console.log(`Amount of proposals: ${count}`);
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare const proposalCount: import("../collective/types.js").ProposalCountFnRet;
|
|
43
|
+
/**
|
|
44
|
+
* @name proposalHashes
|
|
45
|
+
* @description Retrieves an array of hashes for all active proposals in the "council" collective.
|
|
46
|
+
* @example
|
|
47
|
+
* ```javascript
|
|
48
|
+
* const hashes = await api.derive.council.proposalHashes();
|
|
49
|
+
* console.log(`Proposals ${JSON.stringify(hashes)}`);
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export declare const proposalHashes: import("../collective/types.js").ProposalHashesFnRet;
|
|
53
|
+
/**
|
|
54
|
+
* @name proposals
|
|
55
|
+
* @description Retrieves a list of all active proposals in the "council" collective.
|
|
56
|
+
* @example
|
|
57
|
+
* ```javascript
|
|
58
|
+
* const proposals = await api.derive.council.proposals();
|
|
59
|
+
* console.log(proposals);
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
export declare const proposals: import("../collective/types.js").ProposalsFnRet;
|
|
63
|
+
/**
|
|
64
|
+
* @name prime
|
|
65
|
+
* @description Retrieves the prime member of the "council" collective, if one exists.
|
|
66
|
+
* @example
|
|
67
|
+
* ```javascript
|
|
68
|
+
* const primeMember = await api.derive.council.prime();
|
|
69
|
+
* console.log(primeMember);
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
export declare const prime: import("../collective/types.js").PrimeFnRet;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { DeriveApi, DeriveCouncilVotes } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* @name votes
|
|
5
|
+
* @description Retrieves the council election votes for all participants.
|
|
6
|
+
* @example
|
|
7
|
+
* ```javascript
|
|
8
|
+
* const votes = await api.derive.council.votes();
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
export declare function votes(instanceId: string, api: DeriveApi): () => Observable<DeriveCouncilVotes>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { AccountId } from '@pezkuwi/types/interfaces';
|
|
3
|
+
import type { DeriveApi, DeriveCouncilVote } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* @name votesOf
|
|
6
|
+
* @description Retrieves the council votes associated with a given account.
|
|
7
|
+
* @returns The stake and the list of candidates the account has voted for.
|
|
8
|
+
* @param {string | Uint8Array | AccountId} accountId The accountId to retrieve votes for.
|
|
9
|
+
* @example
|
|
10
|
+
* ```javascript
|
|
11
|
+
* const accountId = "5Gw3s7qQ9Z..."; // Replace with a valid account ID
|
|
12
|
+
* const votes = await api.derive.council.votesOf(accountId);
|
|
13
|
+
* console.log("Account votes:", votes);
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare function votesOf(instanceId: string, api: DeriveApi): (accountId: string | Uint8Array | AccountId) => Observable<DeriveCouncilVote>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { BN } from '@pezkuwi/util';
|
|
3
|
+
import type { DeriveApi } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* @name childKey
|
|
6
|
+
* @description Retrieves the child storage key for a given parachain’s crowdloan contributions.
|
|
7
|
+
* This key is used to access contribution data stored in a separate child trie of the blockchain’s state.
|
|
8
|
+
* @param {string | number | BN} paraId The parachain ID for which contributions are being queried.
|
|
9
|
+
* @example
|
|
10
|
+
* ```javascript
|
|
11
|
+
* const childKey = await api.derive.crowdloan.childKey(3369);
|
|
12
|
+
* console.log("Child Key:", childKey);
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare function childKey(instanceId: string, api: DeriveApi): (paraId: string | number | BN) => Observable<string | null>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { BN } from '@pezkuwi/util';
|
|
3
|
+
import type { DeriveApi, DeriveContributions } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* @name contributions
|
|
6
|
+
* @description Retrieves all contributions for a given parachain crowdloan.
|
|
7
|
+
* @param {string | number | BN} paraId The parachain ID for which contributions are being queried.
|
|
8
|
+
* @example
|
|
9
|
+
* ```javascript
|
|
10
|
+
* const contributions = await api.derive.crowdloan.contributions(3369);
|
|
11
|
+
* console.log("Contributions:", contributions);
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare function contributions(instanceId: string, api: DeriveApi): (paraId: string | number | BN) => Observable<DeriveContributions>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { BN } from '@pezkuwi/util';
|
|
3
|
+
import type { DeriveApi, DeriveOwnContributions } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* @name ownContributions
|
|
6
|
+
* @description Retrieves the contribution amounts made by specific accounts (`keys`) to a given parachain crowdloan (`paraId`).
|
|
7
|
+
* @param {string | number | BN} paraId The parachain ID for which contributions are being queried.
|
|
8
|
+
* @param {string[]} keys An array of account addresses whose contributions are to be fetched.
|
|
9
|
+
* @example
|
|
10
|
+
* ```javascript
|
|
11
|
+
* const contributions = await api.derive.crowdloan.ownContributions(2000, ['5Ff...PqV', '5Gg...XyZ']);
|
|
12
|
+
* console.log("Own Contributions:", contributions);
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare function ownContributions(instanceId: string, api: DeriveApi): (paraId: string | number | BN, keys: string[]) => Observable<DeriveOwnContributions>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { FrameSystemEventRecord } from '@pezkuwi/types/lookup';
|
|
2
|
+
import type { Vec } from '@pezkuwi/types-codec';
|
|
3
|
+
import type { BN } from '@pezkuwi/util';
|
|
4
|
+
interface Changes {
|
|
5
|
+
added: string[];
|
|
6
|
+
blockHash: string;
|
|
7
|
+
removed: string[];
|
|
8
|
+
}
|
|
9
|
+
export declare function extractContributed(paraId: string | number | BN, events: Vec<FrameSystemEventRecord>): Changes;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { DeriveApi, DeriveDispatch } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* @name dispatchQueue
|
|
5
|
+
* @description Retrieves the list of scheduled or pending dispatches in the governance system.
|
|
6
|
+
* @example
|
|
7
|
+
* ```javascript
|
|
8
|
+
* const queue = await api.derive.democracy.dispatchQueue();
|
|
9
|
+
* console.log("Dispatch Queue:", queue);
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export declare function dispatchQueue(instanceId: string, api: DeriveApi): () => Observable<DeriveDispatch[]>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './dispatchQueue.js';
|
|
2
|
+
export * from './locks.js';
|
|
3
|
+
export * from './nextExternal.js';
|
|
4
|
+
export * from './preimages.js';
|
|
5
|
+
export * from './proposals.js';
|
|
6
|
+
export * from './referendumIds.js';
|
|
7
|
+
export * from './referendums.js';
|
|
8
|
+
export * from './referendumsActive.js';
|
|
9
|
+
export * from './referendumsFinished.js';
|
|
10
|
+
export * from './referendumsInfo.js';
|
|
11
|
+
export * from './sqrtElectorate.js';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { AccountId } from '@pezkuwi/types/interfaces';
|
|
3
|
+
import type { DeriveApi, DeriveDemocracyLock } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* @name locks
|
|
6
|
+
* @description Retrieves the democracy voting locks for a given account.
|
|
7
|
+
* @param { string | AccountId } accountId The accountId for which to retrieve democracy voting locks.
|
|
8
|
+
* @example
|
|
9
|
+
* ```javascript
|
|
10
|
+
* const locks = await api.derive.democracy.locks('5FfFjX...'); // Replace with an actual accountId
|
|
11
|
+
* console.log("Democracy Locks:", locks);
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare function locks(instanceId: string, api: DeriveApi): (accountId: string | AccountId) => Observable<DeriveDemocracyLock[]>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { DeriveApi, DeriveProposalExternal } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* @name nextExternal
|
|
5
|
+
* @description Retrieves the next external proposal that is scheduled for a referendum.
|
|
6
|
+
* @example
|
|
7
|
+
* ```javascript
|
|
8
|
+
* const nextExternal = await api.derive.democracy.nextExternal();
|
|
9
|
+
* console.log("Next external proposal:", nextExternal);
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export declare function nextExternal(instanceId: string, api: DeriveApi): () => Observable<DeriveProposalExternal | null>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { Hash } from '@pezkuwi/types/interfaces';
|
|
3
|
+
import type { FrameSupportPreimagesBounded } from '@pezkuwi/types/lookup';
|
|
4
|
+
import type { DeriveApi, DeriveProposalImage } from '../types.js';
|
|
5
|
+
/**
|
|
6
|
+
* @name preimages
|
|
7
|
+
* @description Retrieves the full details (preimages) of governance proposals using their on-chain hashes.
|
|
8
|
+
* @param { (Hash | Uint8Array | string | FrameSupportPreimagesBounded)[] } hashes An array of hashes representing governance proposals.
|
|
9
|
+
* @example
|
|
10
|
+
* ```javascript
|
|
11
|
+
* const preimages = await api.derive.democracy.preimages([HASH1, HASH2]);
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare function preimages(instanceId: string, api: DeriveApi): (hashes: (Hash | Uint8Array | string | FrameSupportPreimagesBounded)[]) => Observable<(DeriveProposalImage | undefined)[]>;
|
|
15
|
+
/**
|
|
16
|
+
* @name preimage
|
|
17
|
+
* @description Retrieves the full details (preimage) of a governance proposal using its on-chain hash.
|
|
18
|
+
* @param { Hash | Uint8Array | string | FrameSupportPreimagesBounded } hash Hash that represents governance proposals.
|
|
19
|
+
* * @example
|
|
20
|
+
* ```javascript
|
|
21
|
+
* const preimage = await api.derive.democracy.preimage(HASH);
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare const preimage: (instanceId: string, api: DeriveApi) => (hash: any) => Observable<DeriveProposalImage>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { DeriveApi, DeriveProposal } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* @name proposals
|
|
5
|
+
* @description Retrieves the list of active public proposals in the democracy module, along with their associated preimage data and deposit information.
|
|
6
|
+
* @example
|
|
7
|
+
* ```javascript
|
|
8
|
+
* const proposals = await api.derive.democracy.proposals();
|
|
9
|
+
* console.log("proposals:", proposals);
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export declare function proposals(instanceId: string, api: DeriveApi): () => Observable<DeriveProposal[]>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { BN } from '@pezkuwi/util';
|
|
3
|
+
import type { DeriveApi } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* @name referendumIds
|
|
6
|
+
* @description Retrieves an array of active referendum IDs.
|
|
7
|
+
* @example
|
|
8
|
+
* ```javascript
|
|
9
|
+
* const referendums = await api.derive.democracy.referendumIds();
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export declare function referendumIds(instanceId: string, api: DeriveApi): () => Observable<BN[]>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { DeriveApi, DeriveReferendumExt } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* @name referendums
|
|
5
|
+
* @description Retrieves information about all active referendums, including their details and associated votes.
|
|
6
|
+
* @example
|
|
7
|
+
* ```javascript
|
|
8
|
+
* const referendums = await api.derive.democracy.referendums();
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
export declare function referendums(instanceId: string, api: DeriveApi): () => Observable<DeriveReferendumExt[]>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { DeriveApi, DeriveReferendum } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* @name referendumsActive
|
|
5
|
+
* @description Retrieves information about active referendums.
|
|
6
|
+
* @example
|
|
7
|
+
* ```javascript
|
|
8
|
+
* const referendums = await api.derive.democracy.referendumsActive();
|
|
9
|
+
* console.log("Active Referendums:", referendums);
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export declare function referendumsActive(instanceId: string, api: DeriveApi): () => Observable<DeriveReferendum[]>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { PalletDemocracyReferendumInfo } from '@pezkuwi/types/lookup';
|
|
3
|
+
import type { DeriveApi } from '../types.js';
|
|
4
|
+
type ReferendumInfoFinished = PalletDemocracyReferendumInfo['asFinished'];
|
|
5
|
+
/**
|
|
6
|
+
* @name referendumsFinished
|
|
7
|
+
* @description Retrieves information about finished referendums.
|
|
8
|
+
* @example
|
|
9
|
+
* ```javascript
|
|
10
|
+
* const referendums = await api.derive.democracy.referendumsFinished();
|
|
11
|
+
* console.log("Finished Referendums:", referendums);
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare function referendumsFinished(instanceId: string, api: DeriveApi): () => Observable<ReferendumInfoFinished[]>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { Option } from '@pezkuwi/types';
|
|
3
|
+
import type { ReferendumInfoTo239 } from '@pezkuwi/types/interfaces';
|
|
4
|
+
import type { PalletDemocracyReferendumInfo } from '@pezkuwi/types/lookup';
|
|
5
|
+
import type { BN } from '@pezkuwi/util';
|
|
6
|
+
import type { DeriveApi, DeriveReferendum, DeriveReferendumVotes } from '../types.js';
|
|
7
|
+
export declare function _referendumVotes(instanceId: string, api: DeriveApi): (referendum: DeriveReferendum) => Observable<DeriveReferendumVotes>;
|
|
8
|
+
export declare function _referendumsVotes(instanceId: string, api: DeriveApi): (referendums: DeriveReferendum[]) => Observable<DeriveReferendumVotes[]>;
|
|
9
|
+
export declare function _referendumInfo(instanceId: string, api: DeriveApi): (index: BN, info: Option<PalletDemocracyReferendumInfo | ReferendumInfoTo239>) => Observable<DeriveReferendum | null>;
|
|
10
|
+
/**
|
|
11
|
+
* @name referendumsInfo
|
|
12
|
+
* @description Retrieves information about multiple referendums by their IDs.
|
|
13
|
+
* @param {BN[]} ids An array of referendum IDs to query.
|
|
14
|
+
* @example
|
|
15
|
+
* ```javascript
|
|
16
|
+
* import { BN } from "@pezkuwi/util";
|
|
17
|
+
*
|
|
18
|
+
* const referendumIds = [new BN(1)];
|
|
19
|
+
* const referendums = await api.derive.democracy.referendumsInfo(referendumIds);
|
|
20
|
+
* console.log("Referendums Info:", referendums);
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare function referendumsInfo(instanceId: string, api: DeriveApi): (ids: BN[]) => Observable<DeriveReferendum[]>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { BN } from '@pezkuwi/util';
|
|
3
|
+
import type { DeriveApi } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* @name sqrtElectorate
|
|
6
|
+
* @description Computes the square root of the total token issuance in the network.
|
|
7
|
+
* @example
|
|
8
|
+
* ```javascript
|
|
9
|
+
* let sqrtElectorate = await api.derive.democracy.sqrtElectorate();
|
|
10
|
+
* console.log("Square root of token issuance:", sqrtElectorate);
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export declare function sqrtElectorate(instanceId: string, api: DeriveApi): () => Observable<BN>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { Vec } from '@pezkuwi/types';
|
|
2
|
+
import type { AccountId, Balance, Call, Hash, PropIndex, ReferendumIndex, ReferendumInfoTo239, Vote } from '@pezkuwi/types/interfaces';
|
|
3
|
+
import type { PalletDemocracyReferendumStatus, PalletDemocracyVoteThreshold } from '@pezkuwi/types/lookup';
|
|
4
|
+
import type { BN } from '@pezkuwi/util';
|
|
5
|
+
import type { HexString } from '@pezkuwi/util/types';
|
|
6
|
+
export interface AtBlock {
|
|
7
|
+
at: BN;
|
|
8
|
+
}
|
|
9
|
+
export interface DeriveDemocracyLock {
|
|
10
|
+
balance: Balance;
|
|
11
|
+
isDelegated: boolean;
|
|
12
|
+
isFinished: boolean;
|
|
13
|
+
referendumEnd: BN;
|
|
14
|
+
referendumId: ReferendumIndex;
|
|
15
|
+
unlockAt: BN;
|
|
16
|
+
vote: Vote;
|
|
17
|
+
}
|
|
18
|
+
export interface DeriveProposalImage extends AtBlock {
|
|
19
|
+
balance: Balance;
|
|
20
|
+
proposal?: Call | undefined;
|
|
21
|
+
proposalHash?: HexString;
|
|
22
|
+
proposalLen?: number;
|
|
23
|
+
proposer: AccountId;
|
|
24
|
+
}
|
|
25
|
+
export interface DeriveDispatch extends AtBlock {
|
|
26
|
+
index: ReferendumIndex;
|
|
27
|
+
imageHash: HexString;
|
|
28
|
+
image?: DeriveProposalImage | undefined;
|
|
29
|
+
}
|
|
30
|
+
export interface DeriveProposal {
|
|
31
|
+
balance?: Balance;
|
|
32
|
+
index: PropIndex;
|
|
33
|
+
image?: DeriveProposalImage | undefined;
|
|
34
|
+
imageHash: Hash;
|
|
35
|
+
proposer: AccountId;
|
|
36
|
+
seconds: Vec<AccountId>;
|
|
37
|
+
}
|
|
38
|
+
export interface DeriveProposalExternal {
|
|
39
|
+
image?: DeriveProposalImage | undefined;
|
|
40
|
+
imageHash: HexString;
|
|
41
|
+
threshold: PalletDemocracyVoteThreshold;
|
|
42
|
+
}
|
|
43
|
+
export interface DeriveReferendum {
|
|
44
|
+
index: ReferendumIndex;
|
|
45
|
+
image?: DeriveProposalImage | undefined;
|
|
46
|
+
imageHash: HexString;
|
|
47
|
+
status: PalletDemocracyReferendumStatus | ReferendumInfoTo239;
|
|
48
|
+
}
|
|
49
|
+
export interface DeriveReferendumVote {
|
|
50
|
+
accountId: AccountId;
|
|
51
|
+
balance: Balance;
|
|
52
|
+
isDelegating: boolean;
|
|
53
|
+
vote: Vote;
|
|
54
|
+
}
|
|
55
|
+
export interface DeriveReferendumVoteState {
|
|
56
|
+
allAye: DeriveReferendumVote[];
|
|
57
|
+
allNay: DeriveReferendumVote[];
|
|
58
|
+
voteCount: number;
|
|
59
|
+
voteCountAye: number;
|
|
60
|
+
voteCountNay: number;
|
|
61
|
+
votedAye: BN;
|
|
62
|
+
votedNay: BN;
|
|
63
|
+
votedTotal: BN;
|
|
64
|
+
}
|
|
65
|
+
export interface DeriveReferendumVotes extends DeriveReferendumVoteState {
|
|
66
|
+
isPassing: boolean;
|
|
67
|
+
votes: DeriveReferendumVote[];
|
|
68
|
+
}
|
|
69
|
+
export interface DeriveReferendumExt extends DeriveReferendum, DeriveReferendumVotes {
|
|
70
|
+
}
|