From 5f6cb557b5ff4147dbcb736f16b1d34444c20a82 Mon Sep 17 00:00:00 2001 From: Tarik Gul <47201679+TarikGul@users.noreply.github.com> Date: Thu, 18 Apr 2024 09:36:57 -0700 Subject: [PATCH] Resolve module location for endpoints if it exists (#10483) * Council fix in endpoint for modules * lint --- packages/apps/src/endpoint.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/apps/src/endpoint.ts b/packages/apps/src/endpoint.ts index 8a4e09df4d..8f49009f4c 100644 --- a/packages/apps/src/endpoint.ts +++ b/packages/apps/src/endpoint.ts @@ -10,11 +10,14 @@ type ApiMapper = Record>>; function hasEndpoint (api: ApiPromise, endpoint: string, needsApiInstances: boolean): boolean { const [area, _section, method] = endpoint.split('.'); const [section] = (needsApiInstances && api.registry.getModuleInstances(api.runtimeVersion.specName.toString(), _section)) || [_section]; + const resolvedSection = (api as unknown as ApiMapper)[area][section] + ? section + : _section; try { return area === 'consts' - ? isObject((api as unknown as ApiMapper)[area][section][method]) - : isFunction((api as unknown as ApiMapper)[area][section][method]); + ? isObject((api as unknown as ApiMapper)[area][resolvedSection][method]) + : isFunction((api as unknown as ApiMapper)[area][resolvedSection][method]); } catch { return false; }