@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
package/README.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# @pezkuwi/api-derive
|
|
2
|
+
|
|
3
|
+
Collection of high-level utility functions built on top of the @pezkuwi/api library. Designed to simplify the process of querying complex on-chain data by combining multiple RPC calls, storage queries, and runtime logic into a single, callable function.
|
|
4
|
+
|
|
5
|
+
Instead of manually fetching and processing blockchain data, developers can use `api.derive` methods to retrieve information.
|
|
6
|
+
|
|
7
|
+
## Available Derive Namespaces
|
|
8
|
+
|
|
9
|
+
The derive functions are categorized into namespaces based on different common Substrate modules. Accesible by calling `api.derive.NAMESPACE` (e.g. `api.derive.balances`). The available modules are as follows:
|
|
10
|
+
|
|
11
|
+
- [accounts](https://github.com/pezkuwichain/pezkuwi-api/tree/master/packages/api-derive/src/accounts)
|
|
12
|
+
- [alliance](https://github.com/pezkuwichain/pezkuwi-api/tree/master/packages/api-derive/src/alliance)
|
|
13
|
+
- [bagsList](https://github.com/pezkuwichain/pezkuwi-api/tree/master/packages/api-derive/src/bagsList)
|
|
14
|
+
- [balances](https://github.com/pezkuwichain/pezkuwi-api/tree/master/packages/api-derive/src/balances)
|
|
15
|
+
- [bounties](https://github.com/pezkuwichain/pezkuwi-api/tree/master/packages/api-derive/src/bounties)
|
|
16
|
+
- [chain](https://github.com/pezkuwichain/pezkuwi-api/tree/master/packages/api-derive/src/chain)
|
|
17
|
+
- [contracts](https://github.com/pezkuwichain/pezkuwi-api/tree/master/packages/api-derive/src/contracts)
|
|
18
|
+
- [council](https://github.com/pezkuwichain/pezkuwi-api/tree/master/packages/api-derive/src/council)
|
|
19
|
+
- [crowdloan](https://github.com/pezkuwichain/pezkuwi-api/tree/master/packages/api-derive/src/crowdloan)
|
|
20
|
+
- [democracy](https://github.com/pezkuwichain/pezkuwi-api/tree/master/packages/api-derive/src/democracy)
|
|
21
|
+
- [elections](https://github.com/pezkuwichain/pezkuwi-api/tree/master/packages/api-derive/src/elections)
|
|
22
|
+
- [imOnline](https://github.com/pezkuwichain/pezkuwi-api/tree/master/packages/api-derive/src/imOnline)
|
|
23
|
+
- [membership](https://github.com/pezkuwichain/pezkuwi-api/tree/master/packages/api-derive/src/membership)
|
|
24
|
+
- [parachains](https://github.com/pezkuwichain/pezkuwi-api/tree/master/packages/api-derive/src/parachains)
|
|
25
|
+
- [session](https://github.com/pezkuwichain/pezkuwi-api/tree/master/packages/api-derive/src/session)
|
|
26
|
+
- [society](https://github.com/pezkuwichain/pezkuwi-api/tree/master/packages/api-derive/src/society)
|
|
27
|
+
- [staking](https://github.com/pezkuwichain/pezkuwi-api/tree/master/packages/api-derive/src/staking)
|
|
28
|
+
- [technicalCommittee](https://github.com/pezkuwichain/pezkuwi-api/tree/master/packages/api-derive/src/technicalCommittee)
|
|
29
|
+
- [treasury](https://github.com/pezkuwichain/pezkuwi-api/tree/master/packages/api-derive/src/treasury)
|
|
30
|
+
- [tx](https://github.com/pezkuwichain/pezkuwi-api/tree/master/packages/api-derive/src/tx)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { AccountId, AccountIndex, Address } from '@pezkuwi/types/interfaces';
|
|
3
|
+
import type { DeriveApi } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* @name accountId
|
|
6
|
+
* @param {(Address | AccountId | AccountIndex | string | null)} address An accounts address in various formats.
|
|
7
|
+
* @description Resolves an address (in different formats) to its corresponding `AccountId`.
|
|
8
|
+
* @example
|
|
9
|
+
* ```javascript
|
|
10
|
+
* const ALICE = "F7Hs";
|
|
11
|
+
*
|
|
12
|
+
* api.derive.accounts.accountId(ALICE, (accountId) => {
|
|
13
|
+
* console.log(`Resolved AccountId: ${accountId}`);
|
|
14
|
+
* });
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare function accountId(instanceId: string, api: DeriveApi): (address?: Address | AccountId | AccountIndex | string | null) => Observable<AccountId>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { AccountId, Address, Balance } from '@pezkuwi/types/interfaces';
|
|
3
|
+
import type { PalletElectionsPhragmenSeatHolder } from '@pezkuwi/types/lookup';
|
|
4
|
+
import type { Option } from '@pezkuwi/types-codec';
|
|
5
|
+
import type { DeriveAccountFlags, DeriveApi } from '../types.js';
|
|
6
|
+
type FlagsIntermediate = [
|
|
7
|
+
PalletElectionsPhragmenSeatHolder[] | [AccountId, Balance][] | undefined,
|
|
8
|
+
AccountId[],
|
|
9
|
+
AccountId[],
|
|
10
|
+
AccountId[],
|
|
11
|
+
Option<AccountId> | AccountId | undefined
|
|
12
|
+
];
|
|
13
|
+
export declare function _flags(instanceId: string, api: DeriveApi): () => Observable<FlagsIntermediate>;
|
|
14
|
+
/**
|
|
15
|
+
* @name flags
|
|
16
|
+
* @param {(AccountId | Address | string | null)} address The account identifier.
|
|
17
|
+
* @description Retrieves the membership flags for a given account.
|
|
18
|
+
* @example
|
|
19
|
+
* const ALICE = "F7Hs";
|
|
20
|
+
*
|
|
21
|
+
* api.derive.accounts.flags(ALICE, (flags) => {
|
|
22
|
+
* console.log(
|
|
23
|
+
* `Account Flags:`,
|
|
24
|
+
* Object.keys(flags).map((flag) => `${flag}: ${flags[flag]}`)
|
|
25
|
+
* );
|
|
26
|
+
* });
|
|
27
|
+
*/
|
|
28
|
+
export declare function flags(instanceId: string, api: DeriveApi): (address?: AccountId | Address | string | null) => Observable<DeriveAccountFlags>;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { AccountId, AccountIndex, Address } from '@pezkuwi/types/interfaces';
|
|
3
|
+
import type { AccountIdAndIndex, DeriveApi } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* @name idAndIndex
|
|
6
|
+
* @param {(Address | AccountId | AccountIndex | Uint8Array | string | null)} address An accounts address in various formats.
|
|
7
|
+
* @description An array containing the [[AccountId]] and [[AccountIndex]] as optional values.
|
|
8
|
+
* @example
|
|
9
|
+
* ```javascript
|
|
10
|
+
* api.derive.accounts.idAndIndex('F7Hs', ([id, ix]) => {
|
|
11
|
+
* console.log(`AccountId #${id} with corresponding AccountIndex ${ix}`);
|
|
12
|
+
* });
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare function idAndIndex(instanceId: string, api: DeriveApi): (address?: Address | AccountId | AccountIndex | Uint8Array | string | null) => Observable<AccountIdAndIndex>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { AccountId, AccountIndex } from '@pezkuwi/types/interfaces';
|
|
3
|
+
import type { DeriveApi } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* @name idToIndex
|
|
6
|
+
* @description Retrieves the corresponding AccountIndex.
|
|
7
|
+
* @param {( AccountId | string )} accountId An accounts Id in different formats.
|
|
8
|
+
* @example
|
|
9
|
+
* ```javascript
|
|
10
|
+
* const ALICE = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';
|
|
11
|
+
* api.derive.accounts.idToIndex(ALICE, (accountIndex) => {
|
|
12
|
+
* console.log(`The AccountIndex of ${ALICE} is ${accountIndex}`);
|
|
13
|
+
* });
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare function idToIndex(instanceId: string, api: DeriveApi): (accountId: AccountId | string) => Observable<AccountIndex | undefined>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { Bytes, Data } from '@pezkuwi/types';
|
|
3
|
+
import type { AccountId } from '@pezkuwi/types/interfaces';
|
|
4
|
+
import type { PalletIdentityRegistration } from '@pezkuwi/types/lookup';
|
|
5
|
+
import type { Option } from '@pezkuwi/types-codec';
|
|
6
|
+
import type { ITuple } from '@pezkuwi/types-codec/types';
|
|
7
|
+
import type { DeriveAccountRegistration, DeriveApi, DeriveHasIdentity } from '../types.js';
|
|
8
|
+
export declare function _identity(instanceId: string, api: DeriveApi): (accountId?: AccountId | Uint8Array | string) => Observable<[Option<ITuple<[PalletIdentityRegistration, Option<Bytes>]>> | Option<PalletIdentityRegistration> | undefined, Option<ITuple<[AccountId, Data]>> | undefined]>;
|
|
9
|
+
/**
|
|
10
|
+
* @name identity
|
|
11
|
+
* @description Retrieves the on chain identity information for a given account.
|
|
12
|
+
* @param {(AccountId | Uint8Array | string)} accoutId The account identifier to query the identity for.
|
|
13
|
+
* @example
|
|
14
|
+
* ```javascript
|
|
15
|
+
* const ALICE = "13xAUH";
|
|
16
|
+
*
|
|
17
|
+
* api.derive.accounts.identity(ALICE, (identity) => {
|
|
18
|
+
* console.log(
|
|
19
|
+
* "Account Identity:",
|
|
20
|
+
* Object.keys(identity).map((key) => `${key}: ${identity[key]}`)
|
|
21
|
+
* );
|
|
22
|
+
* });
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function identity(instanceId: string, api: DeriveApi): (accountId?: AccountId | Uint8Array | string) => Observable<DeriveAccountRegistration>;
|
|
26
|
+
/**
|
|
27
|
+
* @name hasIdentity
|
|
28
|
+
* @description Checks if a specific account has an identity registered on chain.
|
|
29
|
+
* @param {(AccountId | Uint8Array | string)} accoutId The account identifier to query.
|
|
30
|
+
* @example
|
|
31
|
+
* ```javascript
|
|
32
|
+
* const ALICE = "13AU";
|
|
33
|
+
* console.log(await api.derive.accounts.hasIdentity(ALICE));
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare const hasIdentity: (instanceId: string, api: DeriveApi) => (accountId: string | AccountId | Uint8Array<ArrayBufferLike>) => Observable<DeriveHasIdentity>;
|
|
37
|
+
/**
|
|
38
|
+
* @name hasIdentityMulti
|
|
39
|
+
* @description Checks whether multiple accounts have on chain identities registered.
|
|
40
|
+
* @param {(AccountId | Uint8Array | string)[]} accountIds Array of account identifiers to query.
|
|
41
|
+
* @example
|
|
42
|
+
* ```javascript
|
|
43
|
+
* const ALICE = "13AU";
|
|
44
|
+
* const BOB = "16WW";
|
|
45
|
+
* console.log(await api.derive.accounts.hasIdentityMulti([ALICE, BOB]));
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare function hasIdentityMulti(instanceId: string, api: DeriveApi): (accountIds: (AccountId | Uint8Array | string)[]) => Observable<DeriveHasIdentity[]>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { AccountId, AccountIndex } from '@pezkuwi/types/interfaces';
|
|
3
|
+
import type { DeriveApi } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* @name indexToId
|
|
6
|
+
* @description Resolves an AccountIndex (short address) to the full AccountId.
|
|
7
|
+
* @param {( AccountIndex | string )} accountIndex An accounts index in different formats.
|
|
8
|
+
* @example
|
|
9
|
+
* ```javascript
|
|
10
|
+
* const ALICE = "13AU";
|
|
11
|
+
* const id = await api.derive.accounts.indexToId(ALICE);
|
|
12
|
+
* console.log(id);
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare function indexToId(instanceId: string, api: DeriveApi): (accountIndex: AccountIndex | string) => Observable<AccountId | undefined>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { AccountIndexes, DeriveApi } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* @name indexes
|
|
5
|
+
* @returns Returns all the indexes on the system.
|
|
6
|
+
* @description This is an unwieldly query since it loops through
|
|
7
|
+
* all of the enumsets and returns all of the values found. This could be up to 32k depending
|
|
8
|
+
* on the number of active accounts in the system.
|
|
9
|
+
* @example
|
|
10
|
+
* ```javascript
|
|
11
|
+
* api.derive.accounts.indexes((indexes) => {
|
|
12
|
+
* console.log('All existing AccountIndexes', indexes);
|
|
13
|
+
* });
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare function indexes(instanceId: string, api: DeriveApi): () => Observable<AccountIndexes>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { AccountId, AccountIndex, Address } from '@pezkuwi/types/interfaces';
|
|
3
|
+
import type { DeriveAccountInfo, DeriveApi } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* @name info
|
|
6
|
+
* @description Returns aux. info with regards to an account, current that includes the accountId, accountIndex, identity and nickname
|
|
7
|
+
* @param {(AccountIndex | AccountId | Address | Uint8Array | string | null)} address An accounts in different formats.
|
|
8
|
+
* @example
|
|
9
|
+
* ```javascript
|
|
10
|
+
* const ALICE = "13AU";
|
|
11
|
+
* const info = await api.derive.accounts.info(ALICE);
|
|
12
|
+
* console.log(
|
|
13
|
+
* "Account Info: ",
|
|
14
|
+
* Object.keys(info).map((key) => `${key}: ${info[key]}`)
|
|
15
|
+
* );
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare function info(instanceId: string, api: DeriveApi): (address?: AccountIndex | AccountId | Address | Uint8Array | string | null) => Observable<DeriveAccountInfo>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { AccountId, AccountIndex, RegistrationJudgement } from '@pezkuwi/types/interfaces';
|
|
2
|
+
import type { Vec } from '@pezkuwi/types-codec';
|
|
3
|
+
export type AccountIdAndIndex = [AccountId | undefined, AccountIndex | undefined];
|
|
4
|
+
export type AccountIndexes = Record<string, AccountIndex>;
|
|
5
|
+
export interface DeriveAccountRegistration {
|
|
6
|
+
discord?: string | undefined;
|
|
7
|
+
display?: string | undefined;
|
|
8
|
+
displayParent?: string | undefined;
|
|
9
|
+
email?: string | undefined;
|
|
10
|
+
github?: string | undefined;
|
|
11
|
+
image?: string | undefined;
|
|
12
|
+
legal?: string | undefined;
|
|
13
|
+
matrix?: string | undefined;
|
|
14
|
+
other?: Record<string, string> | undefined;
|
|
15
|
+
parent?: AccountId | undefined;
|
|
16
|
+
pgp?: string | undefined;
|
|
17
|
+
riot?: string | undefined;
|
|
18
|
+
subs?: Vec<AccountId> | undefined;
|
|
19
|
+
twitter?: string | undefined;
|
|
20
|
+
web?: string | undefined;
|
|
21
|
+
judgements: RegistrationJudgement[];
|
|
22
|
+
}
|
|
23
|
+
export interface DeriveAccountFlags {
|
|
24
|
+
isCouncil: boolean;
|
|
25
|
+
isSociety: boolean;
|
|
26
|
+
isSudo: boolean;
|
|
27
|
+
isTechCommittee: boolean;
|
|
28
|
+
}
|
|
29
|
+
export interface DeriveAccountInfo {
|
|
30
|
+
accountId?: AccountId | undefined;
|
|
31
|
+
accountIndex?: AccountIndex | undefined;
|
|
32
|
+
identity: DeriveAccountRegistration;
|
|
33
|
+
nickname?: string | undefined;
|
|
34
|
+
}
|
|
35
|
+
export interface DeriveHasIdentity {
|
|
36
|
+
display?: string | undefined;
|
|
37
|
+
hasIdentity: boolean;
|
|
38
|
+
parentId?: string | undefined;
|
|
39
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name members
|
|
3
|
+
* @description Retrieves the list of members in the "allianceMotion" collective.
|
|
4
|
+
* @example
|
|
5
|
+
* ```javascript
|
|
6
|
+
* const members = await api.derive.alliance.members();
|
|
7
|
+
* console.log(`Members: ${JSON.stringify(members)});
|
|
8
|
+
* ```
|
|
9
|
+
*/
|
|
10
|
+
export declare const members: import("../collective/types.js").MembersFnRet;
|
|
11
|
+
/**
|
|
12
|
+
* @name hasProposals
|
|
13
|
+
* @description Checks if there are any active proposals in the "allianceMotion" collective.
|
|
14
|
+
* @example
|
|
15
|
+
* ```javascript
|
|
16
|
+
* const exists = await api.derive.alliance.hasProposals();
|
|
17
|
+
* console.log(exists);
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare const hasProposals: import("../collective/types.js").HasProposalsFnRet;
|
|
21
|
+
/**
|
|
22
|
+
* @name proposal
|
|
23
|
+
* @description Retrieves details of a specific proposal in the "allianceMotion" collective by its hash.
|
|
24
|
+
* @example
|
|
25
|
+
* ```javascript
|
|
26
|
+
* const proposalDetails = await api.derive.alliance.proposal(PROPOSAL_HASH);
|
|
27
|
+
* console.log(proposalDetails);
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare const proposal: import("../collective/types.js").ProposalFnRet;
|
|
31
|
+
/**
|
|
32
|
+
* @name proposalCount
|
|
33
|
+
* @description Retrieves the total number of proposals in the "allianceMotion" collective.
|
|
34
|
+
* @example
|
|
35
|
+
* ```javascript
|
|
36
|
+
* const count = await api.derive.alliance.proposalCount();
|
|
37
|
+
* console.log(`Amount of proposals: ${count}`);
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare const proposalCount: import("../collective/types.js").ProposalCountFnRet;
|
|
41
|
+
/**
|
|
42
|
+
* @name proposalHashes
|
|
43
|
+
* @description Retrieves an array of hashes for all active proposals in the "allianceMotion" collective.
|
|
44
|
+
* @example
|
|
45
|
+
* ```javascript
|
|
46
|
+
* const hashes = await api.derive.alliance.proposalHashes();
|
|
47
|
+
* console.log(`Proposals ${JSON.stringify(hashes)}`);
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export declare const proposalHashes: import("../collective/types.js").ProposalHashesFnRet;
|
|
51
|
+
/**
|
|
52
|
+
* @name proposals
|
|
53
|
+
* @description Retrieves a list of all active proposals in the "allianceMotion" collective.
|
|
54
|
+
* @example
|
|
55
|
+
* ```javascript
|
|
56
|
+
* const proposals = await api.derive.alliance.proposals();
|
|
57
|
+
* console.log(proposals);
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export declare const proposals: import("../collective/types.js").ProposalsFnRet;
|
|
61
|
+
/**
|
|
62
|
+
* @name prime
|
|
63
|
+
* @description Retrieves the prime member of the "allianceMotion" collective, if one exists.
|
|
64
|
+
* @example
|
|
65
|
+
* ```javascript
|
|
66
|
+
* const primeMember = await api.derive.alliance.prime();
|
|
67
|
+
* console.log(primeMember);
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export declare const prime: import("../collective/types.js").PrimeFnRet;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@pezkuwi/api-augment';
|
|
@@ -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
|
+
import type { Bag } from './types.js';
|
|
5
|
+
export declare function _getIds(instanceId: string, api: DeriveApi): (ids: (BN | number)[]) => Observable<Bag[]>;
|
|
6
|
+
export declare function all(instanceId: string, api: DeriveApi): () => Observable<Bag[]>;
|
|
7
|
+
/**
|
|
8
|
+
* @name get
|
|
9
|
+
* @param {(BN | number)} id The id of the bag to retrieve.
|
|
10
|
+
* @description Retrieves a specific bag from the BagsList pallet by its id.
|
|
11
|
+
*/
|
|
12
|
+
export declare function get(instanceId: string, api: DeriveApi): (id: BN | number) => Observable<Bag>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { BN } from '@pezkuwi/util';
|
|
3
|
+
import type { DeriveApi } from '../types.js';
|
|
4
|
+
import type { Bag, BagExpanded } from './types.js';
|
|
5
|
+
/**
|
|
6
|
+
* @name expand
|
|
7
|
+
* @description Expands a given bag by retrieving all its nodes (accounts contained within the bag).
|
|
8
|
+
* @param {Bag} bag The bag to be expanded.
|
|
9
|
+
*/
|
|
10
|
+
export declare function expand(instanceId: string, api: DeriveApi): (bag: Bag) => Observable<BagExpanded>;
|
|
11
|
+
/**
|
|
12
|
+
* @name getExpanded
|
|
13
|
+
* @description Retrieves and expands a specific bag from the BagsList pallet.
|
|
14
|
+
* @param {BN | number} id The id of the bag to expand.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getExpanded(instanceId: string, api: DeriveApi): (id: BN | number) => Observable<BagExpanded>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { PalletBagsListListBag, PalletBagsListListNode } from '@pezkuwi/types/lookup';
|
|
3
|
+
import type { DeriveApi } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* @name listNodes
|
|
6
|
+
* @param {(PalletBagsListListBag | null)} bag A reference to a specific bag in the BagsList pallet.
|
|
7
|
+
* @description Retrieves the list of nodes (accounts) contained in a specific bag within the BagsList pallet.
|
|
8
|
+
*/
|
|
9
|
+
export declare function listNodes(instanceId: string, api: DeriveApi): (bag: PalletBagsListListBag | null) => Observable<PalletBagsListListNode[]>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PalletBagsListListBag, PalletBagsListListNode } from '@pezkuwi/types/lookup';
|
|
2
|
+
import type { BN } from '@pezkuwi/util';
|
|
3
|
+
export interface Bag {
|
|
4
|
+
bag: PalletBagsListListBag | null;
|
|
5
|
+
bagUpper: BN;
|
|
6
|
+
bagLower: BN;
|
|
7
|
+
id: BN;
|
|
8
|
+
index: number;
|
|
9
|
+
key: string;
|
|
10
|
+
}
|
|
11
|
+
export interface BagExpanded extends Bag {
|
|
12
|
+
nodes: PalletBagsListListNode[];
|
|
13
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { AccountId, AccountIndex, Address } from '@pezkuwi/types/interfaces';
|
|
3
|
+
import type { DeriveApi, DeriveBalancesAccount } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* @name account
|
|
6
|
+
* @description Retrieves the essential balance details for an account, such as free balance and account nonce.
|
|
7
|
+
* @param {( AccountIndex | AccountId | Address | string )} address An accountsId in different formats.
|
|
8
|
+
* @example
|
|
9
|
+
* ```javascript
|
|
10
|
+
* const ALICE = 'F7Hs';
|
|
11
|
+
*
|
|
12
|
+
* api.derive.balances.all(ALICE, ({ accountId, lockedBalance }) => {
|
|
13
|
+
* console.log(`The account ${accountId} has a locked balance ${lockedBalance} units.`);
|
|
14
|
+
* });
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare function account(instanceId: string, api: DeriveApi): (address: AccountIndex | AccountId | Address | string) => Observable<DeriveBalancesAccount>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { AccountId } from '@pezkuwi/types/interfaces';
|
|
3
|
+
import type { DeriveApi, DeriveBalancesAll } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* @name all
|
|
6
|
+
* @description Retrieves the complete balance information for an account, including free balance, locked balance, reserved balance, and more.
|
|
7
|
+
* @param {( AccountId | string )} address An accountsId in different formats.
|
|
8
|
+
* @example
|
|
9
|
+
* ```javascript
|
|
10
|
+
* const ALICE = 'F7Hs';
|
|
11
|
+
*
|
|
12
|
+
* api.derive.balances.account(ALICE, (accountInfo) => {
|
|
13
|
+
* console.log(
|
|
14
|
+
* `${accountInfo.accountId} info:`,
|
|
15
|
+
* Object.keys(accountInfo).map((key) => `${key}: ${accountInfo[key]}`)
|
|
16
|
+
* );
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare function all(instanceId: string, api: DeriveApi): (address: AccountId | string) => Observable<DeriveBalancesAll>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { all } from './all.js';
|
|
2
|
+
export * from './account.js';
|
|
3
|
+
export * from './votingBalances.js';
|
|
4
|
+
/**
|
|
5
|
+
* @name votingBalance
|
|
6
|
+
* @param {( AccountId | string )} address An accounts Id in different formats.
|
|
7
|
+
* @returns An object containing the results of various balance queries
|
|
8
|
+
* @example
|
|
9
|
+
* <BR>
|
|
10
|
+
*
|
|
11
|
+
* ```javascript
|
|
12
|
+
* const ALICE = 'F7Hs';
|
|
13
|
+
*
|
|
14
|
+
* api.derive.balances.votingBalance(ALICE, ({ accountId, lockedBalance }) => {
|
|
15
|
+
* console.log(`The account ${accountId} has a locked balance ${lockedBalance} units.`);
|
|
16
|
+
* });
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
declare const votingBalance: typeof all;
|
|
20
|
+
export { all, votingBalance };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { AccountId, Balance, BalanceLockTo212, Index } from '@pezkuwi/types/interfaces';
|
|
2
|
+
import type { PalletBalancesBalanceLock, PalletBalancesReserveData } from '@pezkuwi/types/lookup';
|
|
3
|
+
import type { BN } from '@pezkuwi/util';
|
|
4
|
+
export interface DeriveBalancesAccountData {
|
|
5
|
+
frameSystemAccountInfo?: {
|
|
6
|
+
frozen: Balance;
|
|
7
|
+
flags: Balance;
|
|
8
|
+
};
|
|
9
|
+
freeBalance: Balance;
|
|
10
|
+
frozenFee: Balance;
|
|
11
|
+
frozenMisc: Balance;
|
|
12
|
+
reservedBalance: Balance;
|
|
13
|
+
votingBalance: Balance;
|
|
14
|
+
}
|
|
15
|
+
export interface DeriveBalancesAccount extends DeriveBalancesAccountData {
|
|
16
|
+
accountId: AccountId;
|
|
17
|
+
accountNonce: Index;
|
|
18
|
+
additional: DeriveBalancesAccountData[];
|
|
19
|
+
}
|
|
20
|
+
export interface DeriveBalancesAllAccountData extends DeriveBalancesAccountData {
|
|
21
|
+
/**
|
|
22
|
+
* Calculated available balance. This uses the formula: max(0, free - locked)
|
|
23
|
+
* This is only correct when the return type of `api.query.system.account` is `AccountInfo` which was replaced by `FrameSystemAccountInfo`.
|
|
24
|
+
* See `transferable` for the correct balance calculation.
|
|
25
|
+
*
|
|
26
|
+
* ref: https://github.com/paritytech/substrate/pull/12951
|
|
27
|
+
*/
|
|
28
|
+
availableBalance: Balance;
|
|
29
|
+
/**
|
|
30
|
+
* The amount of balance locked away.
|
|
31
|
+
*/
|
|
32
|
+
lockedBalance: Balance;
|
|
33
|
+
/**
|
|
34
|
+
* The breakdown of locked balances.
|
|
35
|
+
*/
|
|
36
|
+
lockedBreakdown: (PalletBalancesBalanceLock | BalanceLockTo212)[];
|
|
37
|
+
/**
|
|
38
|
+
* Calculated transferable balance. This uses the formula: free - max(maybeEd, frozen - reserve)
|
|
39
|
+
* Where `maybeEd` means if there is no frozen and reserves it will be zero, else it will be the existential deposit.
|
|
40
|
+
* This is only correct when the return type of `api.query.system.account` is `FrameSystemAccountInfo`.
|
|
41
|
+
* Which is the most up to date calulcation for transferrable balances.
|
|
42
|
+
*
|
|
43
|
+
* ref: https://github.com/paritytech/polkadot-sdk/issues/1833
|
|
44
|
+
*/
|
|
45
|
+
transferable: Balance | null;
|
|
46
|
+
/**
|
|
47
|
+
* Amount locked in vesting.
|
|
48
|
+
*/
|
|
49
|
+
vestingLocked: Balance;
|
|
50
|
+
}
|
|
51
|
+
export interface DeriveBalancesVesting {
|
|
52
|
+
startingBlock: BN;
|
|
53
|
+
endBlock: BN;
|
|
54
|
+
perBlock: BN;
|
|
55
|
+
locked: BN;
|
|
56
|
+
vested: BN;
|
|
57
|
+
}
|
|
58
|
+
export interface DeriveBalancesAllVesting {
|
|
59
|
+
isVesting: boolean;
|
|
60
|
+
vestedBalance: BN;
|
|
61
|
+
vestedClaimable: BN;
|
|
62
|
+
vesting: DeriveBalancesVesting[];
|
|
63
|
+
vestingTotal: BN;
|
|
64
|
+
}
|
|
65
|
+
export interface DeriveBalancesAll extends DeriveBalancesAccount, DeriveBalancesAllAccountData, DeriveBalancesAllVesting {
|
|
66
|
+
additional: DeriveBalancesAllAccountData[];
|
|
67
|
+
namedReserves: PalletBalancesReserveData[][];
|
|
68
|
+
}
|
|
69
|
+
export type DeriveBalancesMap = Record<string, DeriveBalancesAll>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { AccountId, AccountIndex, Address } from '@pezkuwi/types/interfaces';
|
|
3
|
+
import type { DeriveApi, DeriveBalancesAccount } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* @name votingBalances
|
|
6
|
+
* @description Retrieves the balance information for multiple accounts, typically used in governance-related contexts to check voting power.
|
|
7
|
+
* @param {(AccountId | AccountIndex | Address | string)[]} addresses An array of account identifiers.
|
|
8
|
+
* @example
|
|
9
|
+
* ```javascript
|
|
10
|
+
* const addresses = ["5D4b...Zf1", "5HGj...yrV"];
|
|
11
|
+
* const balances = await api.derive.balances.votingBalances(addresses);
|
|
12
|
+
* console.log("Voting Balances:", balances);
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare function votingBalances(instanceId: string, api: DeriveApi): (addresses?: (AccountId | AccountIndex | Address | string)[]) => Observable<DeriveBalancesAccount[]>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { DeriveApi, DeriveBounties } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* @name bounties
|
|
5
|
+
* @descrive Retrieves all active bounties, their descriptions, and associated proposals.
|
|
6
|
+
* @example
|
|
7
|
+
* ```javascript
|
|
8
|
+
* const bounties = await api.derive.bounties();
|
|
9
|
+
* console.log("Active bounties:", bounties);
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export declare function bounties(instanceId: string, api: DeriveApi): () => Observable<DeriveBounties>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './bounties.js';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DeriveCustom } from '@pezkuwi/api-base/types';
|
|
2
|
+
import type { ExactDerive } from './derive.js';
|
|
3
|
+
import type { DeriveApi } from './types.js';
|
|
4
|
+
import { lazyDeriveSection } from './util/index.js';
|
|
5
|
+
export * from './derive.js';
|
|
6
|
+
export * from './type/index.js';
|
|
7
|
+
export { lazyDeriveSection };
|
|
8
|
+
/** @internal */
|
|
9
|
+
export declare function getAvailableDerives(instanceId: string, api: DeriveApi, custom?: DeriveCustom): ExactDerive;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name bestNumber
|
|
3
|
+
* @descrive Retrieves the latest block number.
|
|
4
|
+
* @example
|
|
5
|
+
* ```javascript
|
|
6
|
+
* api.derive.chain.bestNumber((blockNumber) => {
|
|
7
|
+
* console.log(`the current best block is #${blockNumber}`);
|
|
8
|
+
* });
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
export declare const bestNumber: import("./util.js").BlockNumberDerive;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name bestNumberFinalized
|
|
3
|
+
* @returns A BlockNumber
|
|
4
|
+
* @description Get the latest finalized block number.
|
|
5
|
+
* @example
|
|
6
|
+
* ```javascript
|
|
7
|
+
* api.derive.chain.bestNumberFinalized((blockNumber) => {
|
|
8
|
+
* console.log(`the current finalized block is #${blockNumber}`);
|
|
9
|
+
* });
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export declare const bestNumberFinalized: import("./util.js").BlockNumberDerive;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { BlockNumber } from '@pezkuwi/types/interfaces';
|
|
3
|
+
import type { DeriveApi } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* @name bestNumberLag
|
|
6
|
+
* @returns A number of blocks
|
|
7
|
+
* @description Calculates the lag between finalized head and best head
|
|
8
|
+
* @examplew
|
|
9
|
+
* ```javascript
|
|
10
|
+
* api.derive.chain.bestNumberLag((lag) => {
|
|
11
|
+
* console.log(`finalized is ${lag} blocks behind head`);
|
|
12
|
+
* });
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare function bestNumberLag(instanceId: string, api: DeriveApi): () => Observable<BlockNumber>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { SignedBlockExtended } from '../type/types.js';
|
|
3
|
+
import type { DeriveApi } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* @name getBlock
|
|
6
|
+
* @param {( Uint8Array | string )} hash A block hash as U8 array or string.
|
|
7
|
+
* @description Get a specific block (e.g. rpc.chain.getBlock) and extend it with the author
|
|
8
|
+
* @example
|
|
9
|
+
* ```javascript
|
|
10
|
+
* const { author, block } = await api.derive.chain.getBlock('0x123...456');
|
|
11
|
+
*
|
|
12
|
+
* console.log(`block #${block.header.number} was authored by ${author}`);
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare function getBlock(instanceId: string, api: DeriveApi): (hash: Uint8Array | string) => Observable<SignedBlockExtended>;
|