Use .js imports in src (#5526)

* Use .js imports in src

* Adjust

* Fix imports

* Bump dev

* Adjust with .js imports for typegen

* Adjust

* Adjust

* Remove target override
This commit is contained in:
Jaco
2023-03-09 12:19:12 +02:00
committed by GitHub
parent f233671c27
commit 9fe2798b70
754 changed files with 1873 additions and 1871 deletions
@@ -3,14 +3,14 @@
import type { Observable } from 'rxjs';
import type { AccountId, AccountIndex, Address } from '@polkadot/types/interfaces';
import type { DeriveApi } from '../types';
import type { DeriveApi } from '../types.js';
import { map, of } from 'rxjs';
import { assertReturn, isU8a } from '@polkadot/util';
import { decodeAddress } from '@polkadot/util-crypto';
import { memo } from '../util';
import { memo } from '../util/index.js';
/**
* @name accountId
+2 -2
View File
@@ -6,13 +6,13 @@ import type { AccountId, Address, Balance } from '@polkadot/types/interfaces';
import type{ PalletElectionsPhragmenSeatHolder } from '@polkadot/types/lookup';
import type { Codec } from '@polkadot/types/types';
import type { Option } from '@polkadot/types-codec';
import type { DeriveAccountFlags, DeriveApi } from '../types';
import type { DeriveAccountFlags, DeriveApi } from '../types.js';
import { map, of } from 'rxjs';
import { isFunction } from '@polkadot/util';
import { memo } from '../util';
import { memo } from '../util/index.js';
type FlagsIntermediate = [
PalletElectionsPhragmenSeatHolder[] | [AccountId, Balance][] | undefined,
@@ -3,14 +3,14 @@
import type { Observable } from 'rxjs';
import type { AccountId, AccountIndex, Address } from '@polkadot/types/interfaces';
import type { AccountIdAndIndex, DeriveApi } from '../types';
import type { AccountIdAndIndex, DeriveApi } from '../types.js';
import { map, of } from 'rxjs';
import { isU8a } from '@polkadot/util';
import { decodeAddress } from '@polkadot/util-crypto';
import { memo } from '../util';
import { memo } from '../util/index.js';
/**
* @name idAndIndex
@@ -3,11 +3,11 @@
import type { Observable } from 'rxjs';
import type { AccountId, AccountIndex } from '@polkadot/types/interfaces';
import type { AccountIndexes, DeriveApi } from '../types';
import type { AccountIndexes, DeriveApi } from '../types.js';
import { map } from 'rxjs';
import { memo } from '../util';
import { memo } from '../util/index.js';
/**
* @name idToIndex
+2 -2
View File
@@ -7,13 +7,13 @@ import type { AccountId } from '@polkadot/types/interfaces';
import type { PalletIdentityIdentityInfo, PalletIdentityRegistration } from '@polkadot/types/lookup';
import type { Option } from '@polkadot/types-codec';
import type { ITuple } from '@polkadot/types-codec/types';
import type { DeriveAccountRegistration, DeriveApi, DeriveHasIdentity } from '../types';
import type { DeriveAccountRegistration, DeriveApi, DeriveHasIdentity } from '../types.js';
import { combineLatest, map, of, switchMap } from 'rxjs';
import { isHex, u8aToString } from '@polkadot/util';
import { firstMemo, memo } from '../util';
import { firstMemo, memo } from '../util/index.js';
type IdentityInfoAdditional = PalletIdentityIdentityInfo['additional'][0];
+8 -8
View File
@@ -1,11 +1,11 @@
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './accountId';
export * from './flags';
export * from './idAndIndex';
export * from './idToIndex';
export * from './identity';
export * from './indexToId';
export * from './indexes';
export * from './info';
export * from './accountId.js';
export * from './flags.js';
export * from './idAndIndex.js';
export * from './idToIndex.js';
export * from './identity.js';
export * from './indexToId.js';
export * from './indexes.js';
export * from './info.js';
@@ -3,11 +3,11 @@
import type { Observable } from 'rxjs';
import type { AccountId, AccountIndex } from '@polkadot/types/interfaces';
import type { DeriveApi } from '../types';
import type { DeriveApi } from '../types.js';
import { map, of } from 'rxjs';
import { memo } from '../util';
import { memo } from '../util/index.js';
/**
* @name indexToId
+2 -2
View File
@@ -2,11 +2,11 @@
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { AccountIndexes, DeriveApi } from '../types';
import type { AccountIndexes, DeriveApi } from '../types.js';
import { map, of, startWith } from 'rxjs';
import { memo } from '../util';
import { memo } from '../util/index.js';
let indicesCache: AccountIndexes | null = null;
+2 -2
View File
@@ -5,13 +5,13 @@ import type { Observable } from 'rxjs';
import type { Bytes, Option, u32 } from '@polkadot/types';
import type { AccountId, AccountIndex, Address, Balance } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { DeriveAccountInfo, DeriveAccountRegistration, DeriveApi } from '../types';
import type { DeriveAccountInfo, DeriveAccountRegistration, DeriveApi } from '../types.js';
import { combineLatest, map, of, switchMap } from 'rxjs';
import { u8aToString } from '@polkadot/util';
import { memo } from '../util';
import { memo } from '../util/index.js';
function retrieveNick (api: DeriveApi, accountId?: AccountId): Observable<string | undefined> {
return ((
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { hasProposals as collectiveHasProposals, members as collectiveMembers, prime as collectivePrime, proposal as collectiveProposal, proposalCount as collectiveProposalCount, proposalHashes as collectiveProposalHashes, proposals as collectiveProposals } from '../collective';
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';
export const members = collectiveMembers('allianceMotion');
+4 -4
View File
@@ -5,15 +5,15 @@ import type { Observable } from 'rxjs';
import type { Option, u64 } from '@polkadot/types';
import type { PalletBagsListListBag } from '@polkadot/types/lookup';
import type { BN } from '@polkadot/util';
import type { DeriveApi } from '../types';
import type { Bag } from './types';
import type { DeriveApi } from '../types.js';
import type { Bag } from './types.js';
import { map, of, switchMap } from 'rxjs';
import { BN_ZERO, bnToBn, objectSpread } from '@polkadot/util';
import { memo } from '../util';
import { getQueryInterface } from './util';
import { memo } from '../util/index.js';
import { getQueryInterface } from './util.js';
function orderBags (ids: BN[], bags: Option<PalletBagsListListBag>[]): Bag[] {
const sorted = ids
@@ -3,14 +3,14 @@
import type { Observable } from 'rxjs';
import type { BN } from '@polkadot/util';
import type { DeriveApi } from '../types';
import type { Bag, BagExpanded } from './types';
import type { DeriveApi } from '../types.js';
import type { Bag, BagExpanded } from './types.js';
import { map, switchMap } from 'rxjs';
import { objectSpread } from '@polkadot/util';
import { memo } from '../util';
import { memo } from '../util/index.js';
export function expand (instanceId: string, api: DeriveApi): (bag: Bag) => Observable<BagExpanded> {
return memo(instanceId, (bag: Bag): Observable<BagExpanded> =>
+3 -3
View File
@@ -1,6 +1,6 @@
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './get';
export * from './getExpanded';
export * from './listNodes';
export * from './get.js';
export * from './getExpanded.js';
export * from './listNodes.js';
@@ -5,14 +5,14 @@ import type { Observable } from 'rxjs';
import type { Option } from '@polkadot/types';
import type { AccountId32 } from '@polkadot/types/interfaces';
import type { PalletBagsListListBag, PalletBagsListListNode } from '@polkadot/types/lookup';
import type { DeriveApi } from '../types';
import type { DeriveApi } from '../types.js';
import { BehaviorSubject, map, of, switchMap, tap, toArray } from 'rxjs';
import { nextTick } from '@polkadot/util';
import { memo } from '../util';
import { getQueryInterface } from './util';
import { memo } from '../util/index.js';
import { getQueryInterface } from './util.js';
function traverseLinks (api: DeriveApi, head: AccountId32 | string): Observable<PalletBagsListListNode[]> {
const subject = new BehaviorSubject<AccountId32 | string>(head);
+1 -1
View File
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
import type { QueryableStorage } from '@polkadot/api-base/types';
import type { DeriveApi } from '../types';
import type { DeriveApi } from '../types.js';
export function getQueryInterface (api: DeriveApi): QueryableStorage<'rxjs'>['voterBagsList'] {
return (
+2 -2
View File
@@ -5,13 +5,13 @@ import type { Observable } from 'rxjs';
import type { QueryableStorageEntry } from '@polkadot/api-base/types';
import type { AccountData, AccountId, AccountIndex, AccountInfo, Address, Balance, Index } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { DeriveApi, DeriveBalancesAccount, DeriveBalancesAccountData } from '../types';
import type { DeriveApi, DeriveBalancesAccount, DeriveBalancesAccountData } from '../types.js';
import { combineLatest, map, of, switchMap } from 'rxjs';
import { isFunction, objectSpread } from '@polkadot/util';
import { memo } from '../util';
import { memo } from '../util/index.js';
type BalanceResult = [Balance, Balance, Balance, Balance];
+2 -2
View File
@@ -5,13 +5,13 @@ import type { Observable } from 'rxjs';
import type { Option, Vec } from '@polkadot/types';
import type { AccountId, Balance, BalanceLockTo212, BlockNumber, VestingSchedule } from '@polkadot/types/interfaces';
import type { PalletBalancesBalanceLock, PalletBalancesReserveData, PalletVestingVestingInfo } from '@polkadot/types/lookup';
import type { DeriveApi, DeriveBalancesAccount, DeriveBalancesAccountData, DeriveBalancesAll, DeriveBalancesAllAccountData, DeriveBalancesAllVesting } from '../types';
import type { DeriveApi, DeriveBalancesAccount, DeriveBalancesAccountData, DeriveBalancesAll, DeriveBalancesAllAccountData, DeriveBalancesAllVesting } from '../types.js';
import { combineLatest, map, of, switchMap } from 'rxjs';
import { BN, BN_ZERO, bnMax, bnMin, isFunction, objectSpread } from '@polkadot/util';
import { memo } from '../util';
import { memo } from '../util/index.js';
type ResultBalance = [PalletVestingVestingInfo[] | null, ((PalletBalancesBalanceLock | BalanceLockTo212)[])[], PalletBalancesReserveData[][]];
type Result = [DeriveBalancesAccount, ResultBalance, BlockNumber];
+3 -3
View File
@@ -1,10 +1,10 @@
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { all } from './all';
import { all } from './all.js';
export * from './account';
export * from './votingBalances';
export * from './account.js';
export * from './votingBalances.js';
const votingBalance = all;
@@ -3,11 +3,11 @@
import type { Observable } from 'rxjs';
import type { AccountId, AccountIndex, Address } from '@polkadot/types/interfaces';
import type { DeriveApi, DeriveBalancesAccount } from '../types';
import type { DeriveApi, DeriveBalancesAccount } from '../types.js';
import { combineLatest, of } from 'rxjs';
import { memo } from '../util';
import { memo } from '../util/index.js';
export function votingBalances (instanceId: string, api: DeriveApi): (addresses?: (AccountId | AccountIndex | Address | string)[]) => Observable<DeriveBalancesAccount[]> {
return memo(instanceId, (addresses?: (AccountId | AccountIndex | Address | string)[]): Observable<DeriveBalancesAccount[]> =>
@@ -7,17 +7,17 @@ import type { SubmittableExtrinsic } from '@polkadot/api-base/types';
import type { Bytes, Option, StorageKey } from '@polkadot/types';
import type { Bounty, BountyIndex, Proposal, ProposalIndex } from '@polkadot/types/interfaces';
import type { Codec, InterfaceTypes } from '@polkadot/types/types';
import type { DeriveApi, DeriveCollectiveProposal } from '../types';
import type { DeriveApi, DeriveCollectiveProposal } from '../types.js';
import { firstValueFrom, of } from 'rxjs';
import { ApiPromise } from '@polkadot/api';
import { BountyFactory } from '../test/bountyFactory';
import { BytesFactory } from '../test/bytesFactory';
import { createApiWithAugmentations } from '../test/helpers';
import { ProposalFactory } from '../test/proposalFactory';
import { bounties } from '.';
import { BountyFactory } from '../test/bountyFactory.js';
import { BytesFactory } from '../test/bytesFactory.js';
import { createApiWithAugmentations } from '../test/helpers.js';
import { ProposalFactory } from '../test/proposalFactory.js';
import { bounties } from './index.js';
const DEFAULT_PROPOSER = '5C4hrfjw9DjXZTzV3MwzrrAr9P1MJhSrvWGWqi1eSuyUpnhM';
+3 -3
View File
@@ -5,12 +5,12 @@ import type { Observable } from 'rxjs';
import type { Bytes, Option } from '@polkadot/types';
import type { BountyIndex } from '@polkadot/types/interfaces';
import type { PalletBountiesBounty } from '@polkadot/types/lookup';
import type { DeriveApi, DeriveBounties, DeriveCollectiveProposal } from '../types';
import type { DeriveApi, DeriveBounties, DeriveCollectiveProposal } from '../types.js';
import { combineLatest, map, of, switchMap } from 'rxjs';
import { memo } from '../util';
import { filterBountiesProposals } from './helpers/filterBountyProposals';
import { memo } from '../util/index.js';
import { filterBountiesProposals } from './helpers/filterBountyProposals.js';
type Result = [Option<PalletBountiesBounty>[], Option<Bytes>[], BountyIndex[], DeriveCollectiveProposal[]];
@@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { DeriveApi, DeriveCollectiveProposal } from '../../types';
import type { DeriveApi, DeriveCollectiveProposal } from '../../types.js';
export function filterBountiesProposals (api: DeriveApi, allProposals: DeriveCollectiveProposal[]): DeriveCollectiveProposal[] {
const bountyTxBase = api.tx.bounties ? api.tx.bounties : api.tx.treasury;
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './bounties';
export * from './bounties.js';
+5 -5
View File
@@ -4,13 +4,13 @@
import type { DeriveCustom } from '@polkadot/api-base/types';
import type { AnyFunction, AnyString } from '@polkadot/types/types';
import type { ExactDerive } from './derive';
import type { DeriveApi } from './types';
import type { DeriveApi } from './types.js';
import { derive } from './derive';
import { lazyDeriveSection } from './util';
import { lazyDeriveSection } from './util/index.js';
import { derive } from './derive.js';
export * from './derive';
export * from './type';
export * from './derive.js';
export * from './type/index.js';
interface Avail {
instances: string[];
+2 -2
View File
@@ -1,9 +1,9 @@
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { DeriveApi } from '../types';
import type { DeriveApi } from '../types.js';
import { createBlockNumberDerive } from './util';
import { createBlockNumberDerive } from './util.js';
/**
* @name bestNumber
@@ -1,9 +1,9 @@
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { DeriveApi } from '../types';
import type { DeriveApi } from '../types.js';
import { createBlockNumberDerive } from './util';
import { createBlockNumberDerive } from './util.js';
/**
* @name bestNumberFinalized
@@ -3,11 +3,11 @@
import type { Observable } from 'rxjs';
import type { BlockNumber } from '@polkadot/types/interfaces';
import type { DeriveApi } from '../types';
import type { DeriveApi } from '../types.js';
import { combineLatest, map } from 'rxjs';
import { memo } from '../util';
import { memo } from '../util/index.js';
/**
* @name bestNumberLag
+4 -4
View File
@@ -3,13 +3,13 @@
import type { Observable } from 'rxjs';
import type { SignedBlockExtended } from '../type/types';
import type { DeriveApi } from '../types';
import type { DeriveApi } from '../types.js';
import { combineLatest, map, of, switchMap } from 'rxjs';
import { createSignedBlockExtended } from '../type';
import { memo } from '../util';
import { getAuthorDetails } from './util';
import { createSignedBlockExtended } from '../type/index.js';
import { memo } from '../util/index.js';
import { getAuthorDetails } from './util.js';
/**
* @name getBlock
@@ -4,11 +4,11 @@
import type { Observable } from 'rxjs';
import type { AnyNumber } from '@polkadot/types/types';
import type { SignedBlockExtended } from '../type/types';
import type { DeriveApi } from '../types';
import type { DeriveApi } from '../types.js';
import { switchMap } from 'rxjs';
import { memo } from '../util';
import { memo } from '../util/index.js';
export function getBlockByNumber (instanceId: string, api: DeriveApi): (blockNumber: AnyNumber) => Observable<SignedBlockExtended> {
return memo(instanceId, (blockNumber: AnyNumber): Observable<SignedBlockExtended> =>
+4 -4
View File
@@ -3,13 +3,13 @@
import type { Observable } from 'rxjs';
import type { HeaderExtended } from '../type/types';
import type { DeriveApi } from '../types';
import type { DeriveApi } from '../types.js';
import { combineLatest, map, switchMap } from 'rxjs';
import { createHeaderExtended } from '../type';
import { memo } from '../util';
import { getAuthorDetails } from './util';
import { createHeaderExtended } from '../type/index.js';
import { memo } from '../util/index.js';
import { getAuthorDetails } from './util.js';
/**
* @name getHeader
+9 -9
View File
@@ -1,12 +1,12 @@
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './bestNumber';
export * from './bestNumberFinalized';
export * from './bestNumberLag';
export * from './getHeader';
export * from './getBlock';
export * from './getBlockByNumber';
export * from './subscribeFinalizedHeads';
export * from './subscribeNewBlocks';
export * from './subscribeNewHeads';
export * from './bestNumber.js';
export * from './bestNumberFinalized.js';
export * from './bestNumberLag.js';
export * from './getHeader.js';
export * from './getBlock.js';
export * from './getBlockByNumber.js';
export * from './subscribeFinalizedHeads.js';
export * from './subscribeNewBlocks.js';
export * from './subscribeNewHeads.js';
@@ -3,11 +3,11 @@
import type { Observable } from 'rxjs';
import type { SignedBlockExtended } from '../type/types';
import type { DeriveApi } from '../types';
import type { DeriveApi } from '../types.js';
import { switchMap } from 'rxjs';
import { memo } from '../util';
import { memo } from '../util/index.js';
/**
* @name subscribeFinalizedBlocks
@@ -3,11 +3,11 @@
import type { Observable } from 'rxjs';
import type { Hash, Header } from '@polkadot/types/interfaces';
import type { DeriveApi } from '../types';
import type { DeriveApi } from '../types.js';
import { from, of, switchMap } from 'rxjs';
import { memo } from '../util';
import { memo } from '../util/index.js';
/**
* Returns a header range from startHash to to (not including) endHash, i.e. lastBlock.parentHash === endHash
@@ -3,11 +3,11 @@
import type { Observable } from 'rxjs';
import type { SignedBlockExtended } from '../type/types';
import type { DeriveApi } from '../types';
import type { DeriveApi } from '../types.js';
import { switchMap } from 'rxjs';
import { memo } from '../util';
import { memo } from '../util/index.js';
/**
* @name subscribeNewBlocks
@@ -3,13 +3,13 @@
import type { Observable } from 'rxjs';
import type { HeaderExtended } from '../type/types';
import type { DeriveApi } from '../types';
import type { DeriveApi } from '../types.js';
import { combineLatest, map, of, switchMap } from 'rxjs';
import { createHeaderExtended } from '../type';
import { memo } from '../util';
import { getAuthorDetails } from './util';
import { createHeaderExtended } from '../type/index.js';
import { memo } from '../util/index.js';
import { getAuthorDetails } from './util.js';
/**
* @name subscribeNewHeads
+2 -2
View File
@@ -6,11 +6,11 @@ import type { QueryableStorage } from '@polkadot/api-base/types';
import type { Compact, Vec } from '@polkadot/types';
import type { AccountId, BlockNumber, Header } from '@polkadot/types/interfaces';
import type { Codec, IOption } from '@polkadot/types/types';
import type { DeriveApi } from '../types';
import type { DeriveApi } from '../types.js';
import { combineLatest, map, of } from 'rxjs';
import { memo, unwrapBlockNumber } from '../util';
import { memo, unwrapBlockNumber } from '../util/index.js';
// re-export these - since these needs to be resolvable from api-derive, i.e. without this
// we would emit code with ../<somewhere>/src embedded in the *.d.ts files
+1 -1
View File
@@ -3,6 +3,6 @@
import '@polkadot/api-augment';
import { derive } from '.';
import { derive } from './index.js';
console.log(derive.chain.bestNumber);
@@ -2,14 +2,14 @@
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { DeriveApi } from '../types';
import type { Collective } from './types';
import type { DeriveApi } from '../types.js';
import type { Collective } from './types.js';
import { of } from 'rxjs';
import { isFunction } from '@polkadot/util';
import { memo } from '../util';
import { memo } from '../util/index.js';
export function getInstance (api: DeriveApi, section: string): DeriveApi['query']['council'] {
const instances = api.registry.getModuleInstances(api.runtimeVersion.specName, section);
+3 -3
View File
@@ -1,6 +1,6 @@
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './members';
export * from './prime';
export * from './proposals';
export * from './members.js';
export * from './prime.js';
export * from './proposals.js';
@@ -3,7 +3,7 @@
import type { AccountId } from '@polkadot/types/interfaces';
import { callMethod } from './helpers';
import { callMethod } from './helpers.js';
// We are re-exporting these from here to ensure that *.d.ts generation is correct
export type { AccountId } from '@polkadot/types/interfaces';
+3 -3
View File
@@ -3,14 +3,14 @@
import type { Observable } from 'rxjs';
import type { AccountId } from '@polkadot/types/interfaces';
import type { DeriveApi } from '../types';
import type { Collective } from './types';
import type { DeriveApi } from '../types.js';
import type { Collective } from './types.js';
import { map, of } from 'rxjs';
import { isFunction } from '@polkadot/util';
import { withSection } from './helpers';
import { withSection } from './helpers.js';
// We are re-exporting these from here to ensure that *.d.ts generation is correct
export type { AccountId } from '@polkadot/types/interfaces';
@@ -4,15 +4,15 @@
import type { Observable } from 'rxjs';
import type { Option, u32 } from '@polkadot/types';
import type { Hash, Proposal, Votes } from '@polkadot/types/interfaces';
import type { DeriveApi, DeriveCollectiveProposal } from '../types';
import type { Collective } from './types';
import type { DeriveApi, DeriveCollectiveProposal } from '../types.js';
import type { Collective } from './types.js';
import { catchError, combineLatest, map, of, switchMap } from 'rxjs';
import { isFunction } from '@polkadot/util';
import { firstObservable } from '../util';
import { callMethod, withSection } from './helpers';
import { firstObservable } from '../util/index.js';
import { callMethod, withSection } from './helpers.js';
// We are re-exporting these from here to ensure that *.d.ts generation is correct
export type { Option, u32 } from '@polkadot/types';
+2 -2
View File
@@ -3,11 +3,11 @@
import type { Observable } from 'rxjs';
import type { BN } from '@polkadot/util';
import type { DeriveApi, DeriveContractFees } from '../types';
import type { DeriveApi, DeriveContractFees } from '../types.js';
import { map, of } from 'rxjs';
import { memo } from '../util';
import { memo } from '../util/index.js';
type ResultV2 = [BN, BN, BN, BN, BN, BN, BN, BN, BN, BN];
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './fees';
export * from './fees.js';
+3 -3
View File
@@ -1,10 +1,10 @@
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { hasProposals as collectiveHasProposals, members as collectiveMembers, prime as collectivePrime, proposal as collectiveProposal, proposalCount as collectiveProposalCount, proposalHashes as collectiveProposalHashes, proposals as collectiveProposals } from '../collective';
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';
export * from './votes';
export * from './votesOf';
export * from './votes.js';
export * from './votesOf.js';
export const members = collectiveMembers('council');
+2 -2
View File
@@ -7,11 +7,11 @@ import type { Vec } from '@polkadot/types';
import type { AccountId, Balance } from '@polkadot/types/interfaces';
import type { PalletElectionsPhragmenVoter } from '@polkadot/types/lookup';
import type { ITuple } from '@polkadot/types/types';
import type { DeriveApi, DeriveCouncilVote, DeriveCouncilVotes } from '../types';
import type { DeriveApi, DeriveCouncilVote, DeriveCouncilVotes } from '../types.js';
import { combineLatest, map, of } from 'rxjs';
import { memo } from '../util';
import { memo } from '../util/index.js';
// Voter is current tuple is 2.x-era
type VoteEntry = PalletElectionsPhragmenVoter | ITuple<[Balance, Vec<AccountId>]>;
+2 -2
View File
@@ -3,11 +3,11 @@
import type { Observable } from 'rxjs';
import type { AccountId } from '@polkadot/types/interfaces';
import type { DeriveApi, DeriveCouncilVote } from '../types';
import type { DeriveApi, DeriveCouncilVote } from '../types.js';
import { map } from 'rxjs';
import { memo } from '../util';
import { memo } from '../util/index.js';
export function votesOf (instanceId: string, api: DeriveApi): (accountId: string | Uint8Array | AccountId) => Observable<DeriveCouncilVote> {
return memo(instanceId, (accountId: string | Uint8Array | AccountId): Observable<DeriveCouncilVote> =>
@@ -5,14 +5,14 @@ import type { Observable } from 'rxjs';
import type { Option, u32 } from '@polkadot/types';
import type { PolkadotRuntimeCommonCrowdloanFundInfo } from '@polkadot/types/lookup';
import type { BN } from '@polkadot/util';
import type { DeriveApi } from '../types';
import type { DeriveApi } from '../types.js';
import { map } from 'rxjs';
import { u8aConcat, u8aToHex } from '@polkadot/util';
import { blake2AsU8a } from '@polkadot/util-crypto';
import { memo } from '../util';
import { memo } from '../util/index.js';
interface AllInfo extends PolkadotRuntimeCommonCrowdloanFundInfo {
// previously it was named trieIndex
@@ -4,14 +4,14 @@
import type { Observable } from 'rxjs';
import type { StorageKey } from '@polkadot/types';
import type { BN } from '@polkadot/util';
import type { DeriveApi, DeriveContributions } from '../types';
import type { DeriveApi, DeriveContributions } from '../types.js';
import { BehaviorSubject, combineLatest, EMPTY, map, of, startWith, switchMap, tap, toArray } from 'rxjs';
import { arrayFlatten, isFunction, nextTick } from '@polkadot/util';
import { memo } from '../util';
import { extractContributed } from './util';
import { memo } from '../util/index.js';
import { extractContributed } from './util.js';
interface Changes {
added: string[];
+3 -3
View File
@@ -1,6 +1,6 @@
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './childKey';
export * from './contributions';
export * from './ownContributions';
export * from './childKey.js';
export * from './contributions.js';
export * from './ownContributions.js';
@@ -3,14 +3,14 @@
import type { Observable } from 'rxjs';
import type { BN } from '@polkadot/util';
import type { DeriveApi, DeriveOwnContributions } from '../types';
import type { DeriveApi, DeriveOwnContributions } from '../types.js';
import { combineLatest, EMPTY, map, of, startWith, switchMap } from 'rxjs';
import { objectSpread } from '@polkadot/util';
import { memo } from '../util';
import { extractContributed } from './util';
import { memo } from '../util/index.js';
import { extractContributed } from './util.js';
function _getValues (api: DeriveApi, childKey: string, keys: string[]): Observable<DeriveOwnContributions> {
// We actually would love to use multi-keys https://github.com/paritytech/substrate/issues/9203
@@ -7,15 +7,15 @@ import type { BlockNumber, Call, Hash, ReferendumIndex, Scheduled } from '@polka
import type { FrameSupportPreimagesBounded, PalletSchedulerScheduled } from '@polkadot/types/lookup';
import type { Codec, ITuple } from '@polkadot/types/types';
import type { HexString } from '@polkadot/util/types';
import type { DeriveApi, DeriveDispatch, DeriveProposalImage } from '../types';
import type { DeriveApi, DeriveDispatch, DeriveProposalImage } from '../types.js';
import { catchError, combineLatest, map, of, switchMap } from 'rxjs';
import { Enum } from '@polkadot/types';
import { isFunction, objectSpread, stringToHex } from '@polkadot/util';
import { memo } from '../util';
import { getImageHashBounded } from './util';
import { memo } from '../util/index.js';
import { getImageHashBounded } from './util.js';
const DEMOCRACY_ID = stringToHex('democrac');
+11 -11
View File
@@ -1,14 +1,14 @@
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './dispatchQueue';
export * from './locks';
export * from './nextExternal';
export * from './preimages';
export * from './proposals';
export * from './referendumIds';
export * from './referendums';
export * from './referendumsActive';
export * from './referendumsFinished';
export * from './referendumsInfo';
export * from './sqrtElectorate';
export * from './dispatchQueue.js';
export * from './locks.js';
export * from './nextExternal.js';
export * from './preimages.js';
export * from './proposals.js';
export * from './referendumIds.js';
export * from './referendums.js';
export * from './referendumsActive.js';
export * from './referendumsFinished.js';
export * from './referendumsInfo.js';
export * from './sqrtElectorate.js';
+2 -2
View File
@@ -5,13 +5,13 @@ import type { Observable } from 'rxjs';
import type { AccountId, ReferendumInfoTo239, Vote } from '@polkadot/types/interfaces';
import type { PalletDemocracyReferendumInfo, PalletDemocracyVoteVoting } from '@polkadot/types/lookup';
import type { BN } from '@polkadot/util';
import type { DeriveApi, DeriveDemocracyLock } from '../types';
import type { DeriveApi, DeriveDemocracyLock } from '../types.js';
import { map, of, switchMap } from 'rxjs';
import { BN_ZERO, isUndefined } from '@polkadot/util';
import { memo } from '../util';
import { memo } from '../util/index.js';
type ReferendumInfoFinished = PalletDemocracyReferendumInfo['asFinished'];
type VotingDelegating = PalletDemocracyVoteVoting['asDelegating'];
@@ -6,12 +6,12 @@ import type { Option } from '@polkadot/types';
import type { H256 } from '@polkadot/types/interfaces';
import type { FrameSupportPreimagesBounded, PalletDemocracyVoteThreshold } from '@polkadot/types/lookup';
import type { ITuple } from '@polkadot/types/types';
import type { DeriveApi, DeriveProposalExternal } from '../types';
import type { DeriveApi, DeriveProposalExternal } from '../types.js';
import { map, of, switchMap } from 'rxjs';
import { memo } from '../util';
import { getImageHashBounded } from './util';
import { memo } from '../util/index.js';
import { getImageHashBounded } from './util.js';
function withImage (api: DeriveApi, nextOpt: Option<ITuple<[H256 | FrameSupportPreimagesBounded, PalletDemocracyVoteThreshold]>>): Observable<DeriveProposalExternal | null> {
if (nextOpt.isNone) {
@@ -7,14 +7,14 @@ import type { FrameSupportPreimagesBounded, PalletPreimageRequestStatus } from '
import type { Bytes, Option } from '@polkadot/types-codec';
import type { ITuple } from '@polkadot/types-codec/types';
import type { HexString } from '@polkadot/util/types';
import type { DeriveApi, DeriveProposalImage } from '../types';
import type { DeriveApi, DeriveProposalImage } from '../types.js';
import { map, of, switchMap } from 'rxjs';
import { BN_ZERO, isFunction } from '@polkadot/util';
import { firstMemo, memo } from '../util';
import { getImageHashBounded } from './util';
import { firstMemo, memo } from '../util/index.js';
import { getImageHashBounded } from './util.js';
type PreimageInfo = [Bytes, AccountId, Balance, BlockNumber];
type OldPreimage = ITuple<PreimageInfo>;
@@ -6,14 +6,14 @@ import type { Option, Vec } from '@polkadot/types';
import type { AccountId, Balance, Hash, PropIndex } from '@polkadot/types/interfaces';
import type { FrameSupportPreimagesBounded } from '@polkadot/types/lookup';
import type { ITuple } from '@polkadot/types/types';
import type { DeriveApi, DeriveProposal, DeriveProposalImage } from '../types';
import type { DeriveApi, DeriveProposal, DeriveProposalImage } from '../types.js';
import { combineLatest, map, of, switchMap } from 'rxjs';
import { isFunction, objectSpread } from '@polkadot/util';
import { memo } from '../util';
import { getImageHashBounded } from './util';
import { memo } from '../util/index.js';
import { getImageHashBounded } from './util.js';
type DepositorsNew = Option<ITuple<[Vec<AccountId>, Balance]>>;
type DepositorsOld = Option<ITuple<[Balance, Vec<AccountId>]>>;
@@ -4,11 +4,11 @@
import type { Observable } from 'rxjs';
import type { ReferendumIndex } from '@polkadot/types/interfaces';
import type { BN } from '@polkadot/util';
import type { DeriveApi } from '../types';
import type { DeriveApi } from '../types.js';
import { map, of } from 'rxjs';
import { memo } from '../util';
import { memo } from '../util/index.js';
export function referendumIds (instanceId: string, api: DeriveApi): () => Observable<BN[]> {
return memo(instanceId, (): Observable<BN[]> =>
@@ -2,13 +2,13 @@
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { DeriveApi, DeriveReferendumExt } from '../types';
import type { DeriveApi, DeriveReferendumExt } from '../types.js';
import { combineLatest, map, of, switchMap } from 'rxjs';
import { objectSpread } from '@polkadot/util';
import { memo } from '../util';
import { memo } from '../util/index.js';
export function referendums (instanceId: string, api: DeriveApi): () => Observable<DeriveReferendumExt[]> {
return memo(instanceId, (): Observable<DeriveReferendumExt[]> =>
@@ -2,11 +2,11 @@
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { DeriveApi, DeriveReferendum } from '../types';
import type { DeriveApi, DeriveReferendum } from '../types.js';
import { of, switchMap } from 'rxjs';
import { memo } from '../util';
import { memo } from '../util/index.js';
export function referendumsActive (instanceId: string, api: DeriveApi): () => Observable<DeriveReferendum[]> {
return memo(instanceId, (): Observable<DeriveReferendum[]> =>
@@ -3,11 +3,11 @@
import type { Observable } from 'rxjs';
import type { PalletDemocracyReferendumInfo } from '@polkadot/types/lookup';
import type { DeriveApi } from '../types';
import type { DeriveApi } from '../types.js';
import { map, switchMap } from 'rxjs';
import { memo } from '../util';
import { memo } from '../util/index.js';
type ReferendumInfoFinished = PalletDemocracyReferendumInfo['asFinished'];
@@ -6,14 +6,14 @@ import type { Option, Vec } from '@polkadot/types';
import type { AccountId, Hash, ReferendumInfoTo239, Vote } from '@polkadot/types/interfaces';
import type { PalletDemocracyReferendumInfo, PalletDemocracyReferendumStatus, PalletDemocracyVoteVoting } from '@polkadot/types/lookup';
import type { BN } from '@polkadot/util';
import type { DeriveApi, DeriveBalancesAccount, DeriveReferendum, DeriveReferendumVote, DeriveReferendumVotes } from '../types';
import type { DeriveApi, DeriveBalancesAccount, DeriveReferendum, DeriveReferendumVote, DeriveReferendumVotes } from '../types.js';
import { combineLatest, map, of, switchMap } from 'rxjs';
import { isFunction, objectSpread } from '@polkadot/util';
import { memo } from '../util';
import { calcVotes, getImageHash, getStatus } from './util';
import { memo } from '../util/index.js';
import { calcVotes, getImageHash, getStatus } from './util.js';
type VotingDelegating = PalletDemocracyVoteVoting['asDelegating'];
type VotingDirect = PalletDemocracyVoteVoting['asDirect'];
@@ -3,13 +3,13 @@
import type { Observable } from 'rxjs';
import type { BN } from '@polkadot/util';
import type { DeriveApi } from '../types';
import type { DeriveApi } from '../types.js';
import { map } from 'rxjs';
import { bnSqrt } from '@polkadot/util';
import { memo } from '../util';
import { memo } from '../util/index.js';
export function sqrtElectorate (instanceId: string, api: DeriveApi): () => Observable<BN> {
return memo(instanceId, (): Observable<BN> =>
+1 -1
View File
@@ -5,7 +5,7 @@ import type { Hash, ReferendumInfoTo239, Tally } from '@polkadot/types/interface
import type { FrameSupportPreimagesBounded, PalletDemocracyReferendumInfo, PalletDemocracyReferendumStatus, PalletDemocracyVoteThreshold } from '@polkadot/types/lookup';
import type { Option } from '@polkadot/types-codec';
import type { HexString } from '@polkadot/util/types';
import type { DeriveReferendum, DeriveReferendumVote, DeriveReferendumVotes, DeriveReferendumVoteState } from '../types';
import type { DeriveReferendum, DeriveReferendumVote, DeriveReferendumVotes, DeriveReferendumVoteState } from '../types.js';
import { BN, bnSqrt, isHex, isString, isU8a, objectSpread, stringToHex, u8aToHex } from '@polkadot/util';
+20 -20
View File
@@ -3,26 +3,26 @@
import type { AnyFunction } from '@polkadot/types/types';
import * as accounts from './accounts';
import * as alliance from './alliance';
import * as bagsList from './bagsList';
import * as balances from './balances';
import * as bounties from './bounties';
import * as chain from './chain';
import * as contracts from './contracts';
import * as council from './council';
import * as crowdloan from './crowdloan';
import * as democracy from './democracy';
import * as elections from './elections';
import * as imOnline from './imOnline';
import * as membership from './membership';
import * as parachains from './parachains';
import * as session from './session';
import * as society from './society';
import * as staking from './staking';
import * as technicalCommittee from './technicalCommittee';
import * as treasury from './treasury';
import * as tx from './tx';
import * as accounts from './accounts/index.js';
import * as alliance from './alliance/index.js';
import * as bagsList from './bagsList/index.js';
import * as balances from './balances/index.js';
import * as bounties from './bounties/index.js';
import * as chain from './chain/index.js';
import * as contracts from './contracts/index.js';
import * as council from './council/index.js';
import * as crowdloan from './crowdloan/index.js';
import * as democracy from './democracy/index.js';
import * as elections from './elections/index.js';
import * as imOnline from './imOnline/index.js';
import * as membership from './membership/index.js';
import * as parachains from './parachains/index.js';
import * as session from './session/index.js';
import * as society from './society/index.js';
import * as staking from './staking/index.js';
import * as technicalCommittee from './technicalCommittee/index.js';
import * as treasury from './treasury/index.js';
import * as tx from './tx/index.js';
export const derive = { accounts, alliance, bagsList, balances, bounties, chain, contracts, council, crowdloan, democracy, elections, imOnline, membership, parachains, session, society, staking, technicalCommittee, treasury, tx };
+2 -2
View File
@@ -5,7 +5,7 @@
import { detectPackage } from '@polkadot/util';
import others from './detectOther';
import { packageInfo } from './packageInfo';
import others from './detectOther.js';
import { packageInfo } from './packageInfo.js';
detectPackage(packageInfo, null, others);
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './info';
export * from './info.js';
+3 -3
View File
@@ -6,14 +6,14 @@ import type { u32, Vec } from '@polkadot/types';
import type { AccountId32, Balance, BlockNumber } from '@polkadot/types/interfaces';
import type { PalletElectionsPhragmenSeatHolder } from '@polkadot/types/lookup';
import type { ITuple } from '@polkadot/types/types';
import type { DeriveApi } from '../types';
import type { DeriveElectionsInfo } from './types';
import type { DeriveApi } from '../types.js';
import type { DeriveElectionsInfo } from './types.js';
import { combineLatest, map, of } from 'rxjs';
import { objectSpread } from '@polkadot/util';
import { memo } from '../util';
import { memo } from '../util/index.js';
// SeatHolder is current tuple is 2.x-era Substrate
type Member = PalletElectionsPhragmenSeatHolder | ITuple<[AccountId32, Balance]>;
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './receivedHeartbeats';
export * from './receivedHeartbeats.js';
@@ -5,13 +5,13 @@ import type { Observable } from 'rxjs';
import type { Option, u32, WrapperOpaque } from '@polkadot/types';
import type { AccountId } from '@polkadot/types/interfaces';
import type { PalletImOnlineBoundedOpaqueNetworkState } from '@polkadot/types/lookup';
import type { DeriveApi, DeriveHeartbeats } from '../types';
import type { DeriveApi, DeriveHeartbeats } from '../types.js';
import { combineLatest, map, of, switchMap } from 'rxjs';
import { BN_ZERO } from '@polkadot/util';
import { memo } from '../util';
import { memo } from '../util/index.js';
type HeartbeatsOpt = Option<WrapperOpaque<PalletImOnlineBoundedOpaqueNetworkState>>;
+1 -1
View File
@@ -13,7 +13,7 @@ import { ApiRx } from '@polkadot/api';
import { MockProvider } from '@polkadot/rpc-provider/mock';
import { TypeRegistry } from '@polkadot/types/create';
import { ExactDerive } from '.';
import { ExactDerive } from './index.js';
const testFunction = (api: ApiRx): any => {
return <S extends keyof ExactDerive, M extends keyof (typeof api.derive[S])>(section: S, method: M, inputs: any[]): void => {
+2 -2
View File
@@ -1,6 +1,6 @@
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import './detectPackage';
import './detectPackage.js';
export * from './bundle';
export * from './bundle.js';
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { hasProposals as collectiveHasProposals, members as collectiveMembers, prime as collectivePrime, proposal as collectiveProposal, proposalCount as collectiveProposalCount, proposalHashes as collectiveProposalHashes, proposals as collectiveProposals } from '../collective';
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';
export const members = collectiveMembers('membership');
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './index';
export * from './index.js';
+2 -2
View File
@@ -1,5 +1,5 @@
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './info';
export * from './overview';
export * from './info.js';
export * from './overview.js';
+4 -4
View File
@@ -3,15 +3,15 @@
import type { Observable } from 'rxjs';
import type { CollatorId, ParaId } from '@polkadot/types/interfaces';
import type { DeriveApi, DeriveParachainActive, DeriveParachainFull, DeriveParachainInfo } from '../types';
import type { Active, DidUpdate, Heads, ParaInfoResult, PendingSwap, RelayDispatchQueue, RetryQueue, SelectedThreads } from './types';
import type { DeriveApi, DeriveParachainActive, DeriveParachainFull, DeriveParachainInfo } from '../types.js';
import type { Active, DidUpdate, Heads, ParaInfoResult, PendingSwap, RelayDispatchQueue, RetryQueue, SelectedThreads } from './types.js';
import { map, of } from 'rxjs';
import { objectSpread } from '@polkadot/util';
import { memo } from '../util';
import { didUpdateToBool } from './util';
import { memo } from '../util/index.js';
import { didUpdateToBool } from './util.js';
type Result = [
Active,
@@ -3,15 +3,15 @@
import type { Observable } from 'rxjs';
import type { ParaId } from '@polkadot/types/interfaces';
import type { DeriveApi, DeriveParachain, DeriveParachainInfo } from '../types';
import type { DidUpdate, ParaInfoResult, PendingSwap, RelayDispatchQueueSize } from './types';
import type { DeriveApi, DeriveParachain, DeriveParachainInfo } from '../types.js';
import type { DidUpdate, ParaInfoResult, PendingSwap, RelayDispatchQueueSize } from './types.js';
import { combineLatest, map, of, switchMap } from 'rxjs';
import { objectSpread } from '@polkadot/util';
import { memo } from '../util';
import { didUpdateToBool } from './util';
import { memo } from '../util/index.js';
import { didUpdateToBool } from './util.js';
type Result = [
ParaId[],
+1 -1
View File
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
import type { ParaId } from '@polkadot/types/interfaces';
import type { DidUpdate } from './types';
import type { DidUpdate } from './types.js';
export function didUpdateToBool (didUpdate: DidUpdate, id: ParaId): boolean {
return didUpdate.isSome
+3 -3
View File
@@ -1,6 +1,6 @@
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './indexes';
export * from './info';
export * from './progress';
export * from './indexes.js';
export * from './info.js';
export * from './progress.js';
+2 -2
View File
@@ -4,11 +4,11 @@
import type { Observable } from 'rxjs';
import type { Option, u32 } from '@polkadot/types';
import type { ActiveEraInfo, EraIndex, Moment, SessionIndex } from '@polkadot/types/interfaces';
import type { DeriveApi, DeriveSessionIndexes } from '../types';
import type { DeriveApi, DeriveSessionIndexes } from '../types.js';
import { map, of } from 'rxjs';
import { memo } from '../util';
import { memo } from '../util/index.js';
// parse into Indexes
function parse ([currentIndex, activeEra, activeEraStart, currentEra, validatorCount]: [SessionIndex, EraIndex, Option<Moment>, EraIndex, u32]): DeriveSessionIndexes {
+2 -2
View File
@@ -2,13 +2,13 @@
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { DeriveApi, DeriveSessionInfo } from '../types';
import type { DeriveApi, DeriveSessionInfo } from '../types.js';
import { map } from 'rxjs';
import { objectSpread } from '@polkadot/util';
import { memo } from '../util';
import { memo } from '../util/index.js';
/**
* @description Retrieves all the session and era query and calculates specific values on it as the length of the session and eras
+2 -2
View File
@@ -4,13 +4,13 @@
import type { Observable } from 'rxjs';
import type { Option, u64 } from '@polkadot/types';
import type { BlockNumber, SessionIndex } from '@polkadot/types/interfaces';
import type { DeriveApi, DeriveSessionInfo, DeriveSessionProgress } from '../types';
import type { DeriveApi, DeriveSessionInfo, DeriveSessionProgress } from '../types.js';
import { combineLatest, map, of, switchMap } from 'rxjs';
import { objectSpread } from '@polkadot/util';
import { memo } from '../util';
import { memo } from '../util/index.js';
type ResultSlotsNoSession = [u64, u64, u64];
type ResultSlots = [u64, u64, u64, Option<SessionIndex>];
@@ -6,11 +6,11 @@ import type { BalanceOf } from '@polkadot/types/interfaces';
import type { PalletSocietyBid, PalletSocietyBidKind } from '@polkadot/types/lookup';
import type { ITuple } from '@polkadot/types/types';
import type { Option } from '@polkadot/types-codec';
import type { DeriveApi, DeriveSocietyCandidate } from '../types';
import type { DeriveApi, DeriveSocietyCandidate } from '../types.js';
import { combineLatest, map, of, switchMap } from 'rxjs';
import { memo } from '../util';
import { memo } from '../util/index.js';
type ResultSuspend = Option<ITuple<[BalanceOf, PalletSocietyBidKind]>>;
type Result = [PalletSocietyBid[], ResultSuspend[]]
+4 -4
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './candidates';
export * from './info';
export * from './member';
export * from './members';
export * from './candidates.js';
export * from './info.js';
export * from './member.js';
export * from './members.js';
+2 -2
View File
@@ -5,11 +5,11 @@ import type { Observable } from 'rxjs';
import type { Option, u32, Vec } from '@polkadot/types';
import type { AccountId, BalanceOf } from '@polkadot/types/interfaces';
import type { PalletSocietyBid } from '@polkadot/types/lookup';
import type { DeriveApi, DeriveSociety } from '../types';
import type { DeriveApi, DeriveSociety } from '../types.js';
import { map } from 'rxjs';
import { memo } from '../util';
import { memo } from '../util/index.js';
type Result = [Vec<PalletSocietyBid>, Option<AccountId>, Option<AccountId>, Option<AccountId>, u32, BalanceOf]
+2 -2
View File
@@ -3,11 +3,11 @@
import type { Observable } from 'rxjs';
import type { AccountId } from '@polkadot/types/interfaces';
import type { DeriveApi, DeriveSocietyMember } from '../types';
import type { DeriveApi, DeriveSocietyMember } from '../types.js';
import { map } from 'rxjs';
import { memo } from '../util';
import { memo } from '../util/index.js';
/**
* @description Get the member info for a society
+2 -2
View File
@@ -3,11 +3,11 @@
import type { Observable } from 'rxjs';
import type { AccountId } from '@polkadot/types/interfaces';
import type { DeriveApi, DeriveSocietyMember } from '../types';
import type { DeriveApi, DeriveSocietyMember } from '../types.js';
import { combineLatest, map, of, switchMap } from 'rxjs';
import { memo } from '../util';
import { memo } from '../util/index.js';
export function _members (instanceId: string, api: DeriveApi): (accountIds: AccountId[]) => Observable<DeriveSocietyMember[]> {
return memo(instanceId, (accountIds: AccountId[]): Observable<DeriveSocietyMember[]> =>
+3 -3
View File
@@ -4,14 +4,14 @@
import type { Observable } from 'rxjs';
import type { Balance } from '@polkadot/types/interfaces';
import type { PalletStakingStakingLedger, PalletStakingUnlockChunk } from '@polkadot/types/lookup';
import type { DeriveApi, DeriveSessionInfo, DeriveStakingAccount, DeriveStakingKeys, DeriveStakingQuery, DeriveUnlocking } from '../types';
import type { StakingQueryFlags } from './types';
import type { DeriveApi, DeriveSessionInfo, DeriveStakingAccount, DeriveStakingKeys, DeriveStakingQuery, DeriveUnlocking } from '../types.js';
import type { StakingQueryFlags } from './types.js';
import { combineLatest, map, switchMap } from 'rxjs';
import { BN, BN_ZERO, objectSpread } from '@polkadot/util';
import { firstMemo, memo } from '../util';
import { firstMemo, memo } from '../util/index.js';
const QUERY_OPTS = {
withDestination: true,
+1 -1
View File
@@ -3,7 +3,7 @@
import type { EraIndex } from '@polkadot/types/interfaces';
import { deriveCache } from '../util';
import { deriveCache } from '../util/index.js';
export function getEraCache <T> (CACHE_KEY: string, era: EraIndex, withActive?: boolean): [string, T | undefined] {
const cacheKey = `${CACHE_KEY}-${era.toString()}`;
@@ -3,11 +3,11 @@
import type { Observable } from 'rxjs';
import type { PalletStakingEraRewardPoints } from '@polkadot/types/lookup';
import type { DeriveApi } from '../types';
import type { DeriveApi } from '../types.js';
import { switchMap } from 'rxjs';
import { memo } from '../util';
import { memo } from '../util/index.js';
/**
* @description Retrieve the staking overview, including elected and points earned
@@ -3,13 +3,13 @@
import type { Observable } from 'rxjs';
import type { AccountId } from '@polkadot/types/interfaces';
import type { DeriveApi, DeriveStakingElected, StakingQueryFlags } from '../types';
import type { DeriveApi, DeriveStakingElected, StakingQueryFlags } from '../types.js';
import { map, switchMap } from 'rxjs';
import { arrayFlatten } from '@polkadot/util';
import { memo } from '../util';
import { memo } from '../util/index.js';
const DEFAULT_FLAGS = { withController: true, withExposure: true, withPrefs: true };
@@ -5,13 +5,13 @@ import type { Observable } from 'rxjs';
import type { StorageKey } from '@polkadot/types';
import type { AccountId, EraIndex } from '@polkadot/types/interfaces';
import type { PalletStakingExposure } from '@polkadot/types/lookup';
import type { DeriveApi, DeriveEraExposure, DeriveEraNominatorExposure, DeriveEraValidatorExposure } from '../types';
import type { DeriveApi, DeriveEraExposure, DeriveEraNominatorExposure, DeriveEraValidatorExposure } from '../types.js';
import { map, of } from 'rxjs';
import { memo } from '../util';
import { getEraCache, setEraCache } from './cache';
import { combineEras, erasHistoricApply, singleEra } from './util';
import { memo } from '../util/index.js';
import { getEraCache, setEraCache } from './cache.js';
import { combineEras, erasHistoricApply, singleEra } from './util.js';
type KeysAndExposures = [StorageKey<[EraIndex, AccountId]>, PalletStakingExposure][];
@@ -5,13 +5,13 @@ import type { Observable } from 'rxjs';
import type { u32 } from '@polkadot/types';
import type { EraIndex } from '@polkadot/types/interfaces';
import type { BN } from '@polkadot/util';
import type { DeriveApi } from '../types';
import type { DeriveApi } from '../types.js';
import { combineLatest, map, of } from 'rxjs';
import { BN_ONE, BN_ZERO } from '@polkadot/util';
import { memo } from '../util';
import { memo } from '../util/index.js';
export function erasHistoric (instanceId: string, api: DeriveApi): (withActive?: boolean) => Observable<EraIndex[]> {
return memo(instanceId, (withActive?: boolean): Observable<EraIndex[]> =>
@@ -4,15 +4,15 @@
import type { Observable } from 'rxjs';
import type { EraIndex } from '@polkadot/types/interfaces';
import type { PalletStakingEraRewardPoints } from '@polkadot/types/lookup';
import type { DeriveApi, DeriveEraPoints, DeriveEraValPoints } from '../types';
import type { DeriveApi, DeriveEraPoints, DeriveEraValPoints } from '../types.js';
import { map, of } from 'rxjs';
import { BN_ZERO } from '@polkadot/util';
import { memo } from '../util';
import { filterCachedEras, getEraMultiCache, setEraMultiCache } from './cache';
import { erasHistoricApply, filterEras } from './util';
import { memo } from '../util/index.js';
import { filterCachedEras, getEraMultiCache, setEraMultiCache } from './cache.js';
import { erasHistoricApply, filterEras } from './util.js';
const CACHE_KEY = 'eraPoints';
+4 -4
View File
@@ -5,13 +5,13 @@ import type { Observable } from 'rxjs';
import type { StorageKey } from '@polkadot/types';
import type { EraIndex } from '@polkadot/types/interfaces';
import type { PalletStakingValidatorPrefs } from '@polkadot/types/lookup';
import type { DeriveApi, DeriveEraPrefs, DeriveEraValPrefs } from '../types';
import type { DeriveApi, DeriveEraPrefs, DeriveEraValPrefs } from '../types.js';
import { map, of } from 'rxjs';
import { memo } from '../util';
import { getEraCache, setEraCache } from './cache';
import { combineEras, erasHistoricApply, singleEra } from './util';
import { memo } from '../util/index.js';
import { getEraCache, setEraCache } from './cache.js';
import { combineEras, erasHistoricApply, singleEra } from './util.js';
const CACHE_KEY = 'eraPrefs';
@@ -4,13 +4,13 @@
import type { Observable } from 'rxjs';
import type { Option } from '@polkadot/types';
import type { Balance, EraIndex } from '@polkadot/types/interfaces';
import type { DeriveApi, DeriveEraRewards } from '../types';
import type { DeriveApi, DeriveEraRewards } from '../types.js';
import { map, of } from 'rxjs';
import { memo } from '../util';
import { filterCachedEras, getEraMultiCache, setEraMultiCache } from './cache';
import { erasHistoricApply, filterEras } from './util';
import { memo } from '../util/index.js';
import { filterCachedEras, getEraMultiCache, setEraMultiCache } from './cache.js';
import { erasHistoricApply, filterEras } from './util.js';
const CACHE_KEY = 'eraRewards';
@@ -5,13 +5,13 @@ import type { Observable } from 'rxjs';
import type { Option, StorageKey } from '@polkadot/types';
import type { BalanceOf, EraIndex, Perbill } from '@polkadot/types/interfaces';
import type { ITuple } from '@polkadot/types/types';
import type { DeriveApi, DeriveEraSlashes, DeriveEraValSlash } from '../types';
import type { DeriveApi, DeriveEraSlashes, DeriveEraValSlash } from '../types.js';
import { combineLatest, map, of } from 'rxjs';
import { memo } from '../util';
import { getEraCache, setEraCache } from './cache';
import { combineEras, erasHistoricApply, singleEra } from './util';
import { memo } from '../util/index.js';
import { getEraCache, setEraCache } from './cache.js';
import { combineEras, erasHistoricApply, singleEra } from './util.js';
const CACHE_KEY = 'eraSlashes';
+22 -22
View File
@@ -1,25 +1,25 @@
// Copyright 2017-2023 @polkadot/api-derive authors & contributors
// SPDX-License-Identifier: Apache-2.0
export * from './account';
export * from './currentPoints';
export * from './erasExposure';
export * from './erasHistoric';
export * from './erasPoints';
export * from './erasPrefs';
export * from './erasRewards';
export * from './erasSlashes';
export * from './electedInfo';
export * from './keys';
export * from './overview';
export * from './ownExposure';
export * from './ownSlashes';
export * from './query';
export * from './stakerExposure';
export * from './stakerPoints';
export * from './stakerPrefs';
export * from './stakerRewards';
export * from './stakerSlashes';
export * from './stashes';
export * from './validators';
export * from './waitingInfo';
export * from './account.js';
export * from './currentPoints.js';
export * from './erasExposure.js';
export * from './erasHistoric.js';
export * from './erasPoints.js';
export * from './erasPrefs.js';
export * from './erasRewards.js';
export * from './erasSlashes.js';
export * from './electedInfo.js';
export * from './keys.js';
export * from './overview.js';
export * from './ownExposure.js';
export * from './ownSlashes.js';
export * from './query.js';
export * from './stakerExposure.js';
export * from './stakerPoints.js';
export * from './stakerPrefs.js';
export * from './stakerRewards.js';
export * from './stakerSlashes.js';
export * from './stashes.js';
export * from './validators.js';
export * from './waitingInfo.js';
+3 -3
View File
@@ -5,12 +5,12 @@ import type { Observable } from 'rxjs';
import type { Option } from '@polkadot/types';
import type { AccountId } from '@polkadot/types/interfaces';
import type { KitchensinkRuntimeSessionKeys } from '@polkadot/types/lookup';
import type { DeriveApi } from '../types';
import type { DeriveStakingKeys } from './types';
import type { DeriveApi } from '../types.js';
import type { DeriveStakingKeys } from './types.js';
import { combineLatest, map, of, switchMap } from 'rxjs';
import { firstMemo, memo } from '../util';
import { firstMemo, memo } from '../util/index.js';
function extractsIds (stashId: Uint8Array | string, queuedKeys: [AccountId, KitchensinkRuntimeSessionKeys | AccountId[]][], nextKeys: Option<KitchensinkRuntimeSessionKeys>): DeriveStakingKeys {
const sessionIds = (queuedKeys.find(([currentId]) => currentId.eq(stashId)) || [undefined, [] as AccountId[]])[1];
+2 -2
View File
@@ -2,13 +2,13 @@
// SPDX-License-Identifier: Apache-2.0
import type { Observable } from 'rxjs';
import type { DeriveApi, DeriveStakingOverview } from '../types';
import type { DeriveApi, DeriveStakingOverview } from '../types.js';
import { combineLatest, map } from 'rxjs';
import { objectSpread } from '@polkadot/util';
import { memo } from '../util';
import { memo } from '../util/index.js';
/**
* @description Retrieve the staking overview, including elected and points earned

Some files were not shown because too many files have changed in this diff Show More