Skip to content

Conversation

@GeorgeGkas
Copy link
Contributor

@GeorgeGkas GeorgeGkas commented Nov 25, 2025

Description

Fix an issue where the blockchain explorer urls were not generated successfully when bridging assets.

Changelog

CHANGELOG entry: Generate correct blockchain explorer URLs when bridging assets

Related issues

Fixes: #23171

Manual testing steps

Ensure that the correct blockchain URLs are generated when visiting the transaction
details screen after bridging/swapping assets. 

Also ensure that the correct URLs are also generated for old bridge/swaps transactions (no regressions).

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • 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.

Note

Corrects multichain block explorer URL generation for bridge transactions with proper EVM/non-EVM handling and comprehensive tests.

  • Bridge Hook (useMultichainBlockExplorerTxUrl):
    • Uses useBlockExplorer to resolve EVM explorer base URLs via getEvmBlockExplorerUrl with fallback to getEtherscanBaseUrl.
    • Builds EVM tx links with etherscan-link.createCustomExplorerLink.
    • Keeps non-EVM (e.g., Solana) URLs via getTransactionUrl; derives explorer name from URL or useBlockExplorer.
    • Derives explorerName, chainName, and networkImageSource consistently (EVM via CAIP/hex; non-EVM via config).
  • Hook Tests (useMultichainBlockExplorerTxUrl.test.tsx):
    • Add extensive coverage for parameter validation, EVM/non-EVM paths, fallback logic, explorer name resolution, network image sourcing, and custom network configs.
    • Mocks external utilities (etherscan-link, useBlockExplorer, getEtherscanBaseUrl, network utils).
  • Block Explorer Modal Test (BlockExplorersModal.test.tsx):
    • Adjust expectations to show one Etherscan and one Optimistic button instead of two Etherscan.
  • useBlockExplorer:
    • Exposes getEvmBlockExplorerUrl in the returned API.

Written by Cursor Bugbot for commit fe97a35. This will update automatically on new commits. Configure here.

@GeorgeGkas GeorgeGkas requested a review from a team as a code owner November 25, 2025 18:38
@github-actions
Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbot metamaskbot added the team-swaps-and-bridge Swaps and Bridge team label Nov 25, 2025
bfullam
bfullam previously approved these changes Nov 25, 2025
@github-actions
Copy link
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeTrade, SmokeConfirmationsRedesigned
  • Risk Level: medium
  • AI Confidence: 85%
click to see 🤖 AI reasoning details

These changes refactor how block explorer URLs are generated for multichain transactions, specifically in the Bridge functionality. The changes consolidate block explorer logic from a Swaps-specific utility to a shared hook.

Key impacts:

  1. SmokeTrade: The Bridge functionality (part of trade/swap features) is directly affected. The BlockExplorersModal and TransactionDetails components that show block explorer links for bridge transactions use the modified hook. The test file bridge-action-smoke.spec.ts is tagged with SmokeTrade.

  2. SmokeConfirmationsRedesigned: The transaction-details-summary component in confirmations uses the useMultichainBlockExplorerTxUrl hook, so confirmation flows that display block explorer links could be affected by these changes.

Why medium risk:

  • This is a refactoring with extensive test coverage updates
  • The logic change is primarily moving from one hook implementation to another with similar functionality
  • Block explorer URL generation is user-facing and important for transaction verification
  • The tests show behavioral changes (expecting different explorer names), indicating functional changes beyond simple refactoring

Why not running more tags:

  • The changes are localized to block explorer URL generation, not core wallet, network switching, or accounts
  • The hook usage is primarily in Bridge and confirmations contexts
  • No changes to critical paths like Engine, Controllers, or framework
  • No changes to permission systems, assets display, or other major features

Confidence: 85% - The changes are well-scoped and the affected components are clear from the code analysis. The test coverage is comprehensive. However, there's a slight uncertainty about whether other transaction viewing paths might be indirectly affected.

View GitHub Actions results

@GeorgeGkas GeorgeGkas requested a review from bfullam November 26, 2025 09:49
@sonarqubecloud
Copy link

@GeorgeGkas GeorgeGkas added this pull request to the merge queue Nov 26, 2025
Merged via the queue into main with commit f93f627 Nov 26, 2025
153 of 160 checks passed
@GeorgeGkas GeorgeGkas deleted the swaps-3501-fix-blockexplorer-url branch November 26, 2025 11:01
@github-actions github-actions bot locked and limited conversation to collaborators Nov 26, 2025
@metamaskbot metamaskbot added the release-7.61.0 Issue or pull request that will be included in release 7.61.0 label Nov 26, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.61.0 Issue or pull request that will be included in release 7.61.0 size-L team-swaps-and-bridge Swaps and Bridge team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Bridge tx details from Ethereum Mainnet to BNB displays Etherscan instead of BSCscan and opening it displays error loading page

5 participants