Additional v14 types in derives (#4067)
This commit is contained in:
@@ -4,7 +4,8 @@
|
||||
import type { Observable } from 'rxjs';
|
||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import type { u32, Vec } from '@polkadot/types';
|
||||
import type { AccountId, Balance, BlockNumber, SeatHolder } from '@polkadot/types/interfaces';
|
||||
import type { AccountId, Balance, BlockNumber } from '@polkadot/types/interfaces';
|
||||
import type { PalletElectionsPhragmenSeatHolder } from '@polkadot/types/lookup';
|
||||
import type { ITuple } from '@polkadot/types/types';
|
||||
import type { DeriveElectionsInfo } from './types';
|
||||
|
||||
@@ -13,11 +14,11 @@ import { combineLatest, map, of } from 'rxjs';
|
||||
import { memo } from '../util';
|
||||
|
||||
// SeatHolder is current tuple is 2.x-era Substrate
|
||||
type Member = SeatHolder | ITuple<[AccountId, Balance]>;
|
||||
type Member = PalletElectionsPhragmenSeatHolder | ITuple<[AccountId, Balance]>;
|
||||
|
||||
type Candidate = AccountId | ITuple<[AccountId, Balance]>;
|
||||
|
||||
function isSeatHolder (value: Member): value is SeatHolder {
|
||||
function isSeatHolder (value: Member): value is PalletElectionsPhragmenSeatHolder {
|
||||
return !Array.isArray(value);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
import type { Observable } from 'rxjs';
|
||||
import type { ApiInterfaceRx } from '@polkadot/api/types';
|
||||
import type { Option } from '@polkadot/types';
|
||||
import type { ProposalIndex, TreasuryProposal } from '@polkadot/types/interfaces';
|
||||
import type { ProposalIndex } from '@polkadot/types/interfaces';
|
||||
import type { PalletTreasuryProposal } from '@polkadot/types/lookup';
|
||||
import type { DeriveCollectiveProposal, DeriveTreasuryProposal, DeriveTreasuryProposals } from '../types';
|
||||
|
||||
import { combineLatest, map, of, switchMap } from 'rxjs';
|
||||
@@ -13,7 +14,7 @@ import { memo } from '../util';
|
||||
|
||||
interface Result {
|
||||
allIds: ProposalIndex[];
|
||||
allProposals: Option<TreasuryProposal>[];
|
||||
allProposals: Option<PalletTreasuryProposal>[];
|
||||
approvalIds: ProposalIndex[];
|
||||
councilProposals: DeriveCollectiveProposal[];
|
||||
proposalCount: ProposalIndex;
|
||||
@@ -64,7 +65,7 @@ function retrieveProposals (api: ApiInterfaceRx, proposalCount: ProposalIndex, a
|
||||
? api.derive.council.proposals()
|
||||
: of([] as DeriveCollectiveProposal[])
|
||||
]).pipe(
|
||||
map(([allProposals, councilProposals]: [Option<TreasuryProposal>[], DeriveCollectiveProposal[]]): DeriveTreasuryProposals =>
|
||||
map(([allProposals, councilProposals]: [Option<PalletTreasuryProposal>[], DeriveCollectiveProposal[]]): DeriveTreasuryProposals =>
|
||||
parseResult(api, { allIds, allProposals, approvalIds, councilProposals, proposalCount })
|
||||
)
|
||||
);
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { u32 } from '@polkadot/types';
|
||||
import type { Balance, BlockNumber, BountyIndex, Hash, Proposal, ProposalIndex, SetIndex, TreasuryProposal, Votes } from '@polkadot/types/interfaces';
|
||||
import type { PalletBountiesBounty } from '@polkadot/types/lookup';
|
||||
import type { Balance, BlockNumber, BountyIndex, Hash, Proposal, ProposalIndex, SetIndex, Votes } from '@polkadot/types/interfaces';
|
||||
import type { PalletBountiesBounty, PalletTreasuryProposal } from '@polkadot/types/lookup';
|
||||
import type { BN } from '@polkadot/util';
|
||||
|
||||
export * from './accounts/types';
|
||||
@@ -63,7 +63,7 @@ export type DeriveRecentlyOffline = Record<string, RecentlyOffline[]>;
|
||||
export interface DeriveTreasuryProposal {
|
||||
council: DeriveCollectiveProposal[];
|
||||
id: ProposalIndex;
|
||||
proposal: TreasuryProposal;
|
||||
proposal: PalletTreasuryProposal;
|
||||
}
|
||||
|
||||
export interface DeriveTreasuryProposals {
|
||||
|
||||
Reference in New Issue
Block a user