From 5b3f18e6fd313ef83127480e54e50d37edc6f094 Mon Sep 17 00:00:00 2001 From: Tarik Gul <47201679+TarikGul@users.noreply.github.com> Date: Mon, 15 Apr 2024 13:41:40 -0700 Subject: [PATCH] Resolve correct module for council derive (#5851) * Resolve correct module for council derive * remove console --- packages/api-derive/src/elections/info.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/api-derive/src/elections/info.ts b/packages/api-derive/src/elections/info.ts index 4a1600fc30..50cd635cf7 100644 --- a/packages/api-derive/src/elections/info.ts +++ b/packages/api-derive/src/elections/info.ts @@ -67,8 +67,11 @@ function getModules (api: DeriveApi): [string, string | null] { : api.query.elections ? 'elections' : null; + // In some cases council here can refer to `generalCouncil` depending on what the chain specific override is. + // Therefore, we check to see if it exists in the query field. If it does not we default to `council`. + const resolvedCouncil = api.query[council] ? council : 'council'; - return [council, elections]; + return [resolvedCouncil, elections]; } function queryAll (api: DeriveApi, council: string, elections: string): Observable<[AccountId32[], Candidate[], Member[], Member[]]> {