mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-06-21 22:31:07 +00:00
60a800b33e
- Clone Polkadot.js Apps repository - Update package.json with Pezkuwi branding - Add Pezkuwi endpoint to production chains (wss://pezkuwichain.app:9944) - Create comprehensive README for SDK UI - Set up project structure with all packages Next steps: - Apply Kurdistan colors (Kesk, Sor, Zer, Spi + Black) to UI theme - Replace logos with Pezkuwi branding - Test build and deployment
40 lines
1.3 KiB
TypeScript
40 lines
1.3 KiB
TypeScript
// Copyright 2017-2025 @polkadot/app-parachains authors & contributors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
import type { Option, StorageKey } from '@polkadot/types';
|
|
import type { ParaId } from '@polkadot/types/interfaces';
|
|
import type { PolkadotRuntimeParachainsParasParaLifecycle } from '@polkadot/types/lookup';
|
|
|
|
import { createNamedHook, useApi, useEventTrigger, useMapEntries } from '@polkadot/react-hooks';
|
|
|
|
const OPT_ENTRIES = {
|
|
transform: (entries: [StorageKey<[ParaId]>, Option<PolkadotRuntimeParachainsParasParaLifecycle>][]): ParaId[] =>
|
|
entries
|
|
.map(([{ args: [paraId] }, optValue]): ParaId | null => {
|
|
const value = optValue.unwrapOr(null);
|
|
|
|
return value && (
|
|
value.isParathread ||
|
|
value.isUpgradingParathread ||
|
|
value.isOffboardingParathread ||
|
|
value.isOnboarding
|
|
)
|
|
? paraId
|
|
: null;
|
|
})
|
|
.filter((paraId): paraId is ParaId => !!paraId)
|
|
.sort((a, b) => a.cmp(b))
|
|
};
|
|
|
|
function useUpomingIdsImpl (): ParaId[] | undefined {
|
|
const { api } = useApi();
|
|
const trigger = useEventTrigger([
|
|
api.events.session.NewSession,
|
|
api.events.registrar.Registered
|
|
]);
|
|
|
|
return useMapEntries(api.query.paras.paraLifecycles, [], OPT_ENTRIES, trigger.blockHash);
|
|
}
|
|
|
|
export default createNamedHook('useUpomingIds', useUpomingIdsImpl);
|