From e9e000c2962dadc6b8105ad1631e8350f3a5ff75 Mon Sep 17 00:00:00 2001 From: tarikgul Date: Mon, 15 Apr 2024 18:18:06 -0400 Subject: [PATCH 1/2] Council fix in endpoint for modules --- 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 8a4e09df4d9a..12bec9a50493 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; } From 59508a4019dab237269b1512be77399ec44be016 Mon Sep 17 00:00:00 2001 From: tarikgul Date: Thu, 18 Apr 2024 11:42:57 -0400 Subject: [PATCH 2/2] lint --- packages/apps/src/endpoint.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/apps/src/endpoint.ts b/packages/apps/src/endpoint.ts index 12bec9a50493..8f49009f4c86 100644 --- a/packages/apps/src/endpoint.ts +++ b/packages/apps/src/endpoint.ts @@ -12,7 +12,7 @@ function hasEndpoint (api: ApiPromise, endpoint: string, needsApiInstances: bool const [section] = (needsApiInstances && api.registry.getModuleInstances(api.runtimeVersion.specName.toString(), _section)) || [_section]; const resolvedSection = (api as unknown as ApiMapper)[area][section] ? section - : _section + : _section; try { return area === 'consts'