diff --git a/ui/components/app/menu-bar/account-options-menu.js b/ui/components/app/menu-bar/account-options-menu.js index 3ae13c385..fa2d1b377 100644 --- a/ui/components/app/menu-bar/account-options-menu.js +++ b/ui/components/app/menu-bar/account-options-menu.js @@ -32,6 +32,15 @@ export default function AccountOptionsMenu({ anchorElement, onClose }) { const selectedIdentity = useSelector(getSelectedIdentity); const { address } = selectedIdentity; const addressLink = getAccountLink(address, chainId, rpcPrefs); + const { blockExplorerUrl } = rpcPrefs; + + const getBlockExplorerUrlHost = () => { + try { + return new URL(blockExplorerUrl)?.hostname; + } catch (err) { + return ''; + } + }; const openFullscreenEvent = useMetricEvent({ eventOpts: { @@ -67,6 +76,7 @@ export default function AccountOptionsMenu({ anchorElement, onClose }) { }); const isRemovable = keyring.type !== 'HD Key Tree'; + const blockExplorerUrlSubTitle = getBlockExplorerUrlHost(); return ( - {rpcPrefs.blockExplorerUrl.match(/^https?:\/\/(.+)/u)[1]} + {blockExplorerUrlSubTitle} ) : null }