mirror of
https://github.com/pezkuwichain/pezkuwi-apps.git
synced 2026-10-28 05:19:49 +00:00
feat: initial Pezkuwi Apps rebrand from polkadot-apps
Rebranded terminology: - Polkadot → Pezkuwi - Kusama → Dicle - Westend → Zagros - Rococo → PezkuwiChain - Substrate → Bizinikiwi - parachain → teyrchain Custom logos with Kurdistan brand colors (#e6007a → #86e62a): - bizinikiwi-hexagon.svg - sora-bizinikiwi.svg - hezscanner.svg - heztreasury.svg - pezkuwiscan.svg - pezkuwistats.svg - pezkuwiassembly.svg - pezkuwiholic.svg
This commit is contained in:
commit
d21bfb1320
5867 files changed
+329019
No files matched your search
@@ -0,0 +1,44 @@
|
||||
// Copyright 2017-2025 @pezkuwi/apps authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { ApiPromise } from '@pezkuwi/api';
|
||||
|
||||
import { isFunction, isObject } from '@pezkuwi/util';
|
||||
|
||||
type ApiMapper = Record<string, Record<string, Record<string, unknown>>>;
|
||||
|
||||
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][resolvedSection][method])
|
||||
: isFunction((api as unknown as ApiMapper)[area][resolvedSection][method]);
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export function findMissingApis (api: ApiPromise, needsApi?: (string | string[])[], needsApiInstances = false, needsApiCheck?: (api: ApiPromise) => boolean): (string | string[])[] {
|
||||
if (!needsApi) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const missing = needsApi.filter((endpoint: string | string[]): boolean => {
|
||||
const hasApi = Array.isArray(endpoint)
|
||||
? endpoint.reduce((hasApi, endpoint) => hasApi || hasEndpoint(api, endpoint, needsApiInstances), false)
|
||||
: hasEndpoint(api, endpoint, needsApiInstances);
|
||||
|
||||
return !hasApi;
|
||||
});
|
||||
|
||||
if (!missing.length && needsApiCheck && !needsApiCheck(api)) {
|
||||
return ['needsApiCheck'];
|
||||
}
|
||||
|
||||
return missing;
|
||||
}
|
||||
Reference in new issue
Block a user