mirror of
https://github.com/pezkuwichain/pezkuwi-apps.git
synced 2026-06-12 10:01:18 +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:
@@ -0,0 +1,42 @@
|
||||
// Copyright 2017-2025 @pezkuwi/app-settings authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { ChainInfo } from './types.js';
|
||||
|
||||
import { useMemo } from 'react';
|
||||
|
||||
import { getSystemIcon } from '@pezkuwi/apps-config';
|
||||
import { DEFAULT_DECIMALS, DEFAULT_SS58 } from '@pezkuwi/react-api';
|
||||
import { createNamedHook, useApi } from '@pezkuwi/react-hooks';
|
||||
import { getSpecTypes } from '@pezkuwi/types-known';
|
||||
import { formatBalance, isNumber } from '@pezkuwi/util';
|
||||
import { base64Encode } from '@pezkuwi/util-crypto';
|
||||
|
||||
function useChainInfoImpl (): ChainInfo | null {
|
||||
const { api, apiEndpoint, isApiReady, isEthereum, specName, systemChain, systemName } = useApi();
|
||||
|
||||
return useMemo(
|
||||
() => isApiReady
|
||||
? {
|
||||
chain: systemChain,
|
||||
chainType: isEthereum
|
||||
? 'ethereum'
|
||||
: 'bizinikiwi',
|
||||
color: apiEndpoint?.ui.color,
|
||||
genesisHash: api.genesisHash.toHex(),
|
||||
icon: getSystemIcon(systemName, specName),
|
||||
metaCalls: base64Encode(api.runtimeMetadata.asCallsOnly.toU8a()),
|
||||
specVersion: api.runtimeVersion.specVersion.toNumber(),
|
||||
ss58Format: isNumber(api.registry.chainSS58)
|
||||
? api.registry.chainSS58
|
||||
: DEFAULT_SS58.toNumber(),
|
||||
tokenDecimals: (api.registry.chainDecimals || [DEFAULT_DECIMALS.toNumber()])[0],
|
||||
tokenSymbol: (api.registry.chainTokens || formatBalance.getDefaults().unit)[0],
|
||||
types: getSpecTypes(api.registry, systemChain, api.runtimeVersion.specName, api.runtimeVersion.specVersion) as unknown as Record<string, string>
|
||||
}
|
||||
: null,
|
||||
[api, apiEndpoint, isApiReady, specName, systemChain, systemName, isEthereum]
|
||||
);
|
||||
}
|
||||
|
||||
export default createNamedHook('useChainInfo', useChainInfoImpl);
|
||||
Reference in New Issue
Block a user