-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve ChainLogo icons for PI chains
Fix bug with MultiProvider init
- Loading branch information
Showing
12 changed files
with
48 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { ComponentProps } from 'react'; | ||
|
||
import { ChainLogo as ChainLogoInner } from '@hyperlane-xyz/widgets'; | ||
|
||
import { getChainName } from '../../features/chains/utils'; | ||
|
||
export function ChainLogo(props: ComponentProps<typeof ChainLogoInner>) { | ||
const { chainName, ...rest } = props; | ||
const name = chainName || getChainName(props.chainId); | ||
return <ChainLogoInner {...rest} chainName={name} />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,18 @@ | ||
import { Environment } from '../../consts/environments'; | ||
import { getMultiProvider } from '../../multiProvider'; | ||
|
||
export function getChainName(chainId?: number) { | ||
return getMultiProvider().tryGetChainName(chainId || 0) || undefined; | ||
} | ||
|
||
export function getChainDisplayName(chainId?: number, shortName = false) { | ||
if (!chainId) return 'Unknown'; | ||
const metadata = getMultiProvider().getChainMetadata(chainId); | ||
const metadata = getMultiProvider().tryGetChainMetadata(chainId || 0); | ||
if (!metadata) return 'Unknown'; | ||
const displayName = shortName ? metadata.displayNameShort : metadata.displayName; | ||
return displayName || metadata.name; | ||
} | ||
|
||
export function getChainEnvironment(chainIdOrName: number | string) { | ||
const isTestnet = getMultiProvider().getChainMetadata(chainIdOrName).isTestnet; | ||
const isTestnet = getMultiProvider().tryGetChainMetadata(chainIdOrName)?.isTestnet; | ||
return isTestnet ? Environment.Testnet : Environment.Mainnet; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters