Skip to content

Commit e0486ca

Browse files
authored
fix: update MegaETH explorer display name to Megaeth Explorer (#27592)
## **Description** Updates the MegaETH block explorer button text from "View on Megaeth" to "View on Megaeth Explorer" in the Receive flow. Adds a `BLOCK_EXPLORER_NAME_OVERRIDES` map in `app/util/networks/index.js` that overrides the auto-derived explorer name for `megaeth.blockscout.com`. Only MegaETH is affected; all other networks continue using the existing hostname-based auto-derivation logic. ## **Changelog** CHANGELOG entry: Fixed MegaETH explorer button to display "View on Megaeth Explorer" instead of "View on Megaeth" ## **Related issues** Fixes: ## **Manual testing steps** ```gherkin Feature: MegaETH explorer button wording Scenario: user views receive address for ETH on MegaETH Given user has MegaETH network added When user selects ETH on MegaETH and taps Receive Then the button at the bottom reads "View on Megaeth Explorer" Scenario: other networks are unaffected Given user has other networks added When user selects a token on another network and taps Receive Then the explorer button text remains unchanged ``` Screenshots/Recordings Before <img width="463" height="763" alt="image" src="https://github.com/user-attachments/assets/776ec304-d1bf-4bf2-b043-769122635d93" /> "View on Megaeth" After <img width="1206" height="2622" alt="image" src="https://github.com/user-attachments/assets/5725e342-b118-4f11-969e-8ddd2b1ce0f6" /> "View on Megaeth Explorer" Pre-merge author checklist - [x] I've followed https://github.com/MetaMask/contributor-docs and https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md. - [x] I've completed the PR template to the best of my ability - [x] I've included tests if applicable - [x] I've documented my code using https://jsdoc.app/ format if applicable - [x] I've applied the right labels on the PR (see https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md). Not equired for external contributors. Pre-merge reviewer checklist - [x] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [x] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Low risk string-only change: adds a hostname-specific override for one block explorer name, leaving existing hostname-derived naming for all other explorers unchanged. > > **Overview** > Updates `getBlockExplorerName` to support hostname-specific display-name overrides via a new `BLOCK_EXPLORER_NAME_OVERRIDES` map. > > This ensures `megaeth.blockscout.com` is shown as **"MegaETH Explorer"** (e.g., in “View on …” buttons) instead of relying on the default subdomain-based capitalization. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit dad1e7e. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent a9111b3 commit e0486ca

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

app/util/networks/index.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,14 @@ export function compareRpcUrls(rpcOne, rpcTwo) {
496496
return false;
497497
}
498498

499+
/**
500+
* Hostname-to-display-name overrides for block explorers whose
501+
* auto-derived name (first subdomain, capitalised) is not ideal.
502+
*/
503+
const BLOCK_EXPLORER_NAME_OVERRIDES = {
504+
'megaeth.blockscout.com': 'MegaETH Explorer',
505+
};
506+
499507
/**
500508
* From block explorer url, get rendereable name or undefined
501509
*
@@ -505,6 +513,14 @@ export function getBlockExplorerName(blockExplorerUrl) {
505513
if (!blockExplorerUrl) return undefined;
506514
const hostname = new URL(blockExplorerUrl).hostname;
507515
if (!hostname) return undefined;
516+
if (
517+
Object.prototype.hasOwnProperty.call(
518+
BLOCK_EXPLORER_NAME_OVERRIDES,
519+
hostname,
520+
)
521+
) {
522+
return BLOCK_EXPLORER_NAME_OVERRIDES[hostname];
523+
}
508524
const tempBlockExplorerName = fastSplit(hostname);
509525
if (!tempBlockExplorerName || !tempBlockExplorerName[0]) return undefined;
510526
return (

0 commit comments

Comments
 (0)