Skip to content

Commit

Permalink
fix no genesisHash issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick-1979 committed Dec 5, 2023
1 parent ef29ed2 commit f2c088f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/dapp/src/util/getLogo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright 2019-2023 @polkadot/extension-polkagate authors & contributors
// SPDX-License-Identifier: Apache-2.0

import { createWsEndpoints } from '@polkadot/apps-config';

const endpoints = createWsEndpoints(() => '');

export const sanitizeChainName = (chainName: string | undefined) => (chainName?.replace(' Relay Chain', '')?.replace(' Network', '')?.replace(' chain', '')?.replace(' Chain', '')?.replace(' Finance', '')?.replace(/\s/g, ''));

export default function getLogo(info: string): string {
const iconName = sanitizeChainName(info)?.toLowerCase();

const endpoint = endpoints.find((o) => o.info?.toLowerCase() === iconName);

return endpoint?.ui?.logo as string;
}

0 comments on commit f2c088f

Please sign in to comment.