diff --git a/packages/api-derive/src/elections/info.ts b/packages/api-derive/src/elections/info.ts index 1b22cf4710..7abb5f1876 100644 --- a/packages/api-derive/src/elections/info.ts +++ b/packages/api-derive/src/elections/info.ts @@ -47,11 +47,13 @@ function queryElections (api: ApiInterfaceRx): Observable { ? 'phragmenElection' : api.query.electionsPhragmen ? 'electionsPhragmen' - : 'elections'; + : api.query.elections + ? 'elections' + : null; const [council] = api.registry.getModuleInstances(api.runtimeVersion.specName.toString(), 'council') || ['council']; return ( - api.query[elections] + elections ? api.queryMulti<[Vec, Vec, Vec, Vec]>([ api.query[council].members, api.query[elections].candidates, @@ -59,7 +61,7 @@ function queryElections (api: ApiInterfaceRx): Observable { api.query[elections].runnersUp ]) : combineLatest<[Vec, Candidate[], Member[], Member[]]>([ - api.query[council].members, + api.query[council].members(), of([]), of([]), of([]) @@ -67,7 +69,7 @@ function queryElections (api: ApiInterfaceRx): Observable { ).pipe( map(([councilMembers, candidates, members, runnersUp]): DeriveElectionsInfo => ({ ...( - api.consts[elections] + elections ? { candidacyBond: api.consts[elections].candidacyBond as Balance, desiredRunnersUp: api.consts[elections].desiredRunnersUp as u32, diff --git a/packages/api-derive/src/index.ts b/packages/api-derive/src/index.ts index cd491ffbbd..267281818f 100644 --- a/packages/api-derive/src/index.ts +++ b/packages/api-derive/src/index.ts @@ -53,7 +53,7 @@ const deriveAvail: Record = { contracts: { instances: ['contracts'] }, council: { instances: ['council'], withDetect: true }, democracy: { instances: ['democracy'] }, - elections: { instances: ['phragmenElection', 'electionsPhragmen', 'elections'] }, + elections: { instances: ['phragmenElection', 'electionsPhragmen', 'elections', 'council'], withDetect: true }, imOnline: { instances: ['imOnline'] }, membership: { instances: ['membership'] }, parachains: { instances: ['parachains', 'registrar'] }, diff --git a/packages/types/src/augment/registry.ts b/packages/types/src/augment/registry.ts index 840cb3bf96..7da5474d06 100644 --- a/packages/types/src/augment/registry.ts +++ b/packages/types/src/augment/registry.ts @@ -51,7 +51,7 @@ import type { Bid, BidKind, SocietyJudgement, SocietyVote, StrikeCount, Vouching import type { ActiveEraInfo, CompactAssignments, CompactAssignmentsTo257, CompactAssignmentsTo265, CompactAssignmentsWith16, CompactAssignmentsWith24, CompactScore, CompactScoreCompact, ElectionCompute, ElectionPhase, ElectionResult, ElectionScore, ElectionSize, ElectionStatus, EraIndex, EraPoints, EraRewardPoints, EraRewards, Exposure, ExtendedBalance, Forcing, IndividualExposure, KeyType, MomentOf, Nominations, NominatorIndex, NominatorIndexCompact, OffchainAccuracy, OffchainAccuracyCompact, PhragmenScore, Points, RawSolution, RawSolutionTo265, RawSolutionWith16, RawSolutionWith24, ReadySolution, RewardDestination, RewardPoint, RoundSnapshot, SeatHolder, SlashJournalEntry, SlashingSpans, SlashingSpansTo204, SolutionOrSnapshotSize, SolutionSupport, SolutionSupports, SpanIndex, SpanRecord, StakingLedger, StakingLedgerTo223, StakingLedgerTo240, UnappliedSlash, UnappliedSlashOther, UnlockChunk, ValidatorIndex, ValidatorIndexCompact, ValidatorPrefs, ValidatorPrefsTo145, ValidatorPrefsTo196, ValidatorPrefsWithBlocked, ValidatorPrefsWithCommission, VoteWeight, Voter } from '@polkadot/types/interfaces/staking'; import type { ApiId, BlockTrace, BlockTraceEvent, BlockTraceEventData, BlockTraceSpan, KeyValueOption, ReadProof, RuntimeVersion, RuntimeVersionApi, RuntimeVersionPartial, StorageChangeSet, TraceBlockResponse, TraceError } from '@polkadot/types/interfaces/state'; import type { WeightToFeeCoefficient } from '@polkadot/types/interfaces/support'; -import type { AccountInfo, AccountInfoWithDualRefCount, AccountInfoWithProviders, AccountInfoWithRefCount, AccountInfoWithTripleRefCount, ApplyExtrinsicResult, ArithmeticError, BlockLength, BlockWeights, ChainProperties, ChainType, ConsumedWeight, DigestOf, DispatchClass, DispatchError, DispatchErrorModule, DispatchErrorTo198, DispatchInfo, DispatchInfoTo190, DispatchInfoTo244, DispatchOutcome, DispatchResult, DispatchResultOf, DispatchResultTo198, Event, EventId, EventIndex, EventRecord, Health, InvalidTransaction, Key, LastRuntimeUpgradeInfo, NetworkState, NetworkStatePeerset, NetworkStatePeersetInfo, NodeRole, NotConnectedPeer, Peer, PeerEndpoint, PeerEndpointAddr, PeerInfo, PeerPing, PerDispatchClassU32, PerDispatchClassWeight, PerDispatchClassWeightsPerClass, Phase, RawOrigin, RefCount, RefCountTo259, SyncState, SystemOrigin, TokenError, TransactionValidityError, UnknownTransaction, WeightPerClass } from '@polkadot/types/interfaces/system'; +import type { AccountInfo, AccountInfoWithDualRefCount, AccountInfoWithProviders, AccountInfoWithRefCount, AccountInfoWithRefCountU8, AccountInfoWithTripleRefCount, ApplyExtrinsicResult, ArithmeticError, BlockLength, BlockWeights, ChainProperties, ChainType, ConsumedWeight, DigestOf, DispatchClass, DispatchError, DispatchErrorModule, DispatchErrorTo198, DispatchInfo, DispatchInfoTo190, DispatchInfoTo244, DispatchOutcome, DispatchResult, DispatchResultOf, DispatchResultTo198, Event, EventId, EventIndex, EventRecord, Health, InvalidTransaction, Key, LastRuntimeUpgradeInfo, NetworkState, NetworkStatePeerset, NetworkStatePeersetInfo, NodeRole, NotConnectedPeer, Peer, PeerEndpoint, PeerEndpointAddr, PeerInfo, PeerPing, PerDispatchClassU32, PerDispatchClassWeight, PerDispatchClassWeightsPerClass, Phase, RawOrigin, RefCount, RefCountTo259, SyncState, SystemOrigin, TokenError, TransactionValidityError, UnknownTransaction, WeightPerClass } from '@polkadot/types/interfaces/system'; import type { Bounty, BountyIndex, BountyStatus, BountyStatusActive, BountyStatusCuratorProposed, BountyStatusPendingPayout, OpenTip, OpenTipFinderTo225, OpenTipTip, OpenTipTo225, TreasuryProposal } from '@polkadot/types/interfaces/treasury'; import type { Multiplier } from '@polkadot/types/interfaces/txpayment'; import type { ClassDetails, ClassId, ClassMetadata, DepositBalance, DepositBalanceOf, DestroyWitness, InstanceDetails, InstanceId, InstanceMetadata } from '@polkadot/types/interfaces/uniques'; @@ -168,6 +168,7 @@ declare module '@polkadot/types/types/registry' { 'Option': Option; 'Option': Option; 'Option': Option; + 'Option': Option; 'Option': Option; 'Option': Option; 'Option': Option; @@ -1044,6 +1045,7 @@ declare module '@polkadot/types/types/registry' { 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; + 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; @@ -1920,6 +1922,7 @@ declare module '@polkadot/types/types/registry' { AccountInfoWithDualRefCount: AccountInfoWithDualRefCount; AccountInfoWithProviders: AccountInfoWithProviders; AccountInfoWithRefCount: AccountInfoWithRefCount; + AccountInfoWithRefCountU8: AccountInfoWithRefCountU8; AccountInfoWithTripleRefCount: AccountInfoWithTripleRefCount; AccountKey20Junction: AccountKey20Junction; AccountStatus: AccountStatus; diff --git a/packages/types/src/interfaces/system/types.ts b/packages/types/src/interfaces/system/types.ts index 81b2ac12f4..32f7faca9a 100644 --- a/packages/types/src/interfaces/system/types.ts +++ b/packages/types/src/interfaces/system/types.ts @@ -27,6 +27,13 @@ export interface AccountInfoWithRefCount extends Struct { readonly data: AccountData; } +/** @name AccountInfoWithRefCountU8 */ +export interface AccountInfoWithRefCountU8 extends Struct { + readonly nonce: Index; + readonly refcount: u8; + readonly data: AccountData; +} + /** @name AccountInfoWithTripleRefCount */ export interface AccountInfoWithTripleRefCount extends Struct { readonly nonce: Index;