diff --git a/packages/api-derive/src/accounts/flags.ts b/packages/api-derive/src/accounts/flags.ts index e0b7798db3..fd023ac234 100644 --- a/packages/api-derive/src/accounts/flags.ts +++ b/packages/api-derive/src/accounts/flags.ts @@ -41,7 +41,11 @@ function parseFlags (address: AccountId | Address | string | null | undefined, [ */ export function flags (instanceId: string, api: ApiInterfaceRx): (address?: AccountId | Address | string | null) => Observable { return memo(instanceId, (address?: AccountId | Address | string | null): Observable => { - const councilSection = api.query.electionsPhragmen ? 'electionsPhragmen' : 'elections'; + const councilSection = api.query.phragmenElection + ? 'phragmenElection' + : api.query.electionsPhragmen + ? 'electionsPhragmen' + : 'elections'; return combineLatest([ address && api.query[councilSection]?.members diff --git a/packages/api-derive/src/council/votes.ts b/packages/api-derive/src/council/votes.ts index 89bb15e94c..563308c7a4 100644 --- a/packages/api-derive/src/council/votes.ts +++ b/packages/api-derive/src/council/votes.ts @@ -21,7 +21,7 @@ function isVoter (value: VoteEntry): value is Voter { } function retrieveStakeOf (api: ApiInterfaceRx): Observable<[AccountId, Balance][]> { - return (api.query.electionsPhragmen || api.query.elections).stakeOf.entries().pipe( + return (api.query.phragmenElection || api.query.electionsPhragmen || api.query.elections).stakeOf.entries().pipe( map((entries) => entries.map(([{ args: [accountId] }, stake]) => [accountId, stake]) ) @@ -29,7 +29,7 @@ function retrieveStakeOf (api: ApiInterfaceRx): Observable<[AccountId, Balance][ } function retrieveVoteOf (api: ApiInterfaceRx): Observable<[AccountId, AccountId[]][]> { - return (api.query.electionsPhragmen || api.query.elections).votesOf.entries, [AccountId]>().pipe( + return (api.query.phragmenElection || api.query.electionsPhragmen || api.query.elections).votesOf.entries, [AccountId]>().pipe( map((entries) => entries.map(([{ args: [accountId] }, votes]) => [accountId, votes]) ) @@ -61,7 +61,7 @@ function retrievePrev (api: ApiInterfaceRx): Observable { } function retrieveCurrent (api: ApiInterfaceRx): Observable { - const elections = (api.query.electionsPhragmen || api.query.elections); + const elections = (api.query.phragmenElection || api.query.electionsPhragmen || api.query.elections); return elections.voting.entries().pipe( map((entries): DeriveCouncilVotes => diff --git a/packages/api-derive/src/elections/info.ts b/packages/api-derive/src/elections/info.ts index b5aed059da..b79c1b4bca 100644 --- a/packages/api-derive/src/elections/info.ts +++ b/packages/api-derive/src/elections/info.ts @@ -42,7 +42,11 @@ function sortAccounts ([, balanceA]: [AccountId, Balance], [, balanceB]: [Accoun } function queryElections (api: ApiInterfaceRx): Observable { - const section = api.query.electionsPhragmen ? 'electionsPhragmen' : 'elections'; + const section = api.query.phragmenElection + ? 'phragmenElection' + : api.query.electionsPhragmen + ? 'electionsPhragmen' + : 'elections'; return api.queryMulti<[Vec, Vec, Vec, Vec]>([ api.query.council.members, diff --git a/packages/api-derive/src/index.ts b/packages/api-derive/src/index.ts index f4933363c0..a3622904d3 100644 --- a/packages/api-derive/src/index.ts +++ b/packages/api-derive/src/index.ts @@ -48,7 +48,7 @@ const deriveAvail: Record = { contracts: ['contracts'], council: ['council'], democracy: ['democracy'], - elections: ['electionsPhragmen', 'elections'], + elections: ['phragmenElection', 'electionsPhragmen', 'elections'], imOnline: ['imOnline'], membership: ['membership'], parachains: ['parachains', 'registrar'],