Detect on elections (#3716)
This commit is contained in:
@@ -47,11 +47,13 @@ function queryElections (api: ApiInterfaceRx): Observable<DeriveElectionsInfo> {
|
||||
? '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<AccountId>, Vec<Candidate>, Vec<Member>, Vec<Member>]>([
|
||||
api.query[council].members,
|
||||
api.query[elections].candidates,
|
||||
@@ -59,7 +61,7 @@ function queryElections (api: ApiInterfaceRx): Observable<DeriveElectionsInfo> {
|
||||
api.query[elections].runnersUp
|
||||
])
|
||||
: combineLatest<[Vec<AccountId>, Candidate[], Member[], Member[]]>([
|
||||
api.query[council].members,
|
||||
api.query[council].members(),
|
||||
of([]),
|
||||
of([]),
|
||||
of([])
|
||||
@@ -67,7 +69,7 @@ function queryElections (api: ApiInterfaceRx): Observable<DeriveElectionsInfo> {
|
||||
).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,
|
||||
|
||||
@@ -53,7 +53,7 @@ const deriveAvail: Record<string, Avail> = {
|
||||
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'] },
|
||||
|
||||
Reference in New Issue
Block a user