diff --git a/packages/api-derive/src/elections/info.ts b/packages/api-derive/src/elections/info.ts index 1b99eee198..281343198a 100644 --- a/packages/api-derive/src/elections/info.ts +++ b/packages/api-derive/src/elections/info.ts @@ -4,13 +4,13 @@ import { AccountId, Balance, BlockNumber } from '@polkadot/types/interfaces'; import { ITuple } from '@polkadot/types/types'; +import { DeriveElectionsInfo } from './types'; import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; import { ApiInterfaceRx } from '@polkadot/api/types'; import { Vec, u32 } from '@polkadot/types'; -import { DeriveElectionsInfo } from '../types'; import { memo } from '../util'; function sortAccounts ([, balanceA]: ITuple<[AccountId, Balance]>, [, balanceB]: ITuple<[AccountId, Balance]>): number { @@ -30,6 +30,7 @@ function queryElections (api: ApiInterfaceRx): Observable { candidacyBond: api.consts[section].candidacyBond as Balance, candidateCount: api.registry.createType('u32', candidates.length), candidates, + desiredRunnersUp: api.consts[section].desiredRunnersUp as u32, desiredSeats: api.consts[section].desiredMembers as u32, members: members.length ? members.sort(sortAccounts) diff --git a/packages/api-derive/src/elections/types.ts b/packages/api-derive/src/elections/types.ts new file mode 100644 index 0000000000..edf9cc5276 --- /dev/null +++ b/packages/api-derive/src/elections/types.ts @@ -0,0 +1,22 @@ +// Copyright 2017-2020 @polkadot/api-derive authors & contributors +// This software may be modified and distributed under the terms +// of the Apache-2.0 license. See the LICENSE file for details. + +import { AccountId, Balance, BlockNumber, SetIndex, VoteIndex } from '@polkadot/types/interfaces'; + +import { u32 } from '@polkadot/types'; + +export interface DeriveElectionsInfo { + candidates: AccountId[]; + candidateCount: u32; + candidacyBond?: Balance; + desiredRunnersUp: u32; + desiredSeats: u32; + members: [AccountId, Balance][]; + nextVoterSet?: SetIndex; + runnersUp: [AccountId, Balance][]; + termDuration: BlockNumber; + voteCount?: VoteIndex; + voterCount?: SetIndex; + votingBond?: Balance; +} diff --git a/packages/api-derive/src/types.ts b/packages/api-derive/src/types.ts index 7551d995b1..3de1354ef6 100644 --- a/packages/api-derive/src/types.ts +++ b/packages/api-derive/src/types.ts @@ -3,13 +3,14 @@ // of the Apache-2.0 license. See the LICENSE file for details. import type BN from 'bn.js'; -import { AccountId, Balance, BalanceLock, BalanceLockTo212, BalanceOf, Bid, BidKind, BlockNumber, Hash, Index, Proposal, ProposalIndex, SetIndex, SocietyVote, StrikeCount, TreasuryProposal, Votes, VoteIndex, VouchingStatus } from '@polkadot/types/interfaces'; +import { AccountId, Balance, BalanceLock, BalanceLockTo212, BalanceOf, Bid, BidKind, BlockNumber, Hash, Index, Proposal, ProposalIndex, SetIndex, SocietyVote, StrikeCount, TreasuryProposal, Votes, VouchingStatus } from '@polkadot/types/interfaces'; import { u32 } from '@polkadot/types'; export * from './accounts/types'; export * from './council/types'; export * from './democracy/types'; +export * from './elections/types'; export * from './parachains/types'; export * from './session/types'; export * from './staking/types'; @@ -59,20 +60,6 @@ export interface DeriveCollectiveProposal { export type DeriveCollectiveProposals = DeriveCollectiveProposal[]; -export interface DeriveElectionsInfo { - candidates: AccountId[]; - candidateCount: u32; - candidacyBond?: Balance; - desiredSeats: u32; - members: [AccountId, Balance][]; - nextVoterSet?: SetIndex; - runnersUp: [AccountId, Balance][]; - termDuration: BlockNumber; - voteCount?: VoteIndex; - voterCount?: SetIndex; - votingBond?: Balance; -} - export interface DeriveFees { creationFee: Balance; existentialDeposit: Balance;