Skip to content

Commit

Permalink
fix: use relay?.name instead of relay?.chainName in network info …
Browse files Browse the repository at this point in the history
…rows
  • Loading branch information
alecdwm committed Dec 9, 2024
1 parent b77975e commit 6b5bbd7
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions apps/extension/src/ui/hooks/useNetworkInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,23 @@ export type NetworkInfoProps = {
}

export const getNetworkInfo = (t: TFunction, { chain, evmNetwork, relay }: NetworkInfoProps) => {
if (evmNetwork)
return {
label: evmNetwork.name,
type: evmNetwork.isTestnet ? t("EVM Testnet") : t("EVM Blockchain"),
}
if (evmNetwork) {
const label = evmNetwork.name
return { label, type: evmNetwork.isTestnet ? t("EVM Testnet") : t("EVM Blockchain") }
}

if (chain) {
if (chain.isTestnet) return { label: chain.name, type: t("Testnet") }
if (chain.paraId)
return {
label: chain.name,
type: relay?.chainName
? t("{{name}} Parachain", { name: relay?.chainName })
: t("Parachain"),
const label = chain.name
const type = (() => {
if (chain.isTestnet) return t("Testnet")
if (chain.paraId) {
if (relay?.name) return t("{{name}} Parachain", { name: relay?.name })
return t("Parachain")
}
return {
label: chain.name,
type: (chain.parathreads || []).length > 0 ? t("Relay Chain") : t("Blockchain"),
}
return (chain.parathreads || []).length > 0 ? t("Relay Chain") : t("Blockchain")
})()

return { label, type }
}

return { label: "", type: "" }
Expand Down

0 comments on commit 6b5bbd7

Please sign in to comment.