coinbase / coinbase/onchainkit

Feature Request: Add `useExplorerLink()` + consistent explorer link rendering across components

Open
#2,564 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1k
Forks
520
Avg merge
32m
Merged PRs (30d)
2

Description

### Describe the solution you'd like

### Common developer pain points:
- Manually constructing explorer URLs for `txHash`, `address`, `blockNumber`, `token`, etc.
- Needing different explorers depending on chain (Base vs Ethereum) and network (mainnet vs testnet).
- Inconsistent link text, target behavior, and formatting across different OnchainKit components.
- Duplicated logic across apps for something that should be standardized.

### Expected Behavior
- Developers can reliably generate explorer links from chainId + identifier.
- Links are correct for Base Mainnet and Base Sepolia (and any supported chain).
- UI components that show tx hashes or addresses can optionally render a consistent “View on Explorer” link.

### Describe alternatives you've considered.

### Proposed Solution

- Add a small utility + hook:
- getExplorerUrl({ chainId, type, value })
- useExplorerLink({ chainId, txHash?, address?, blockNumber?, tokenAddress? })
- Maintain a centralized mapping of supported chainId -> explorerBaseUrl (BaseScan for Base networks).
- Provide a tiny UI helper component (optional):
- Update relevant components/examples that currently print raw hashes to optionally include a consistent explorer link.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.