feat: parse solscan and orb markets URLs in search bar#891
feat: parse solscan and orb markets URLs in search bar#891arihantbansal wants to merge 4 commits intosolana-foundation:masterfrom
Conversation
|
@arihantbansal is attempting to deploy a commit to the Solana Foundation Team on Vercel. A member of the Team first needs to authorize it. |
Greptile SummaryThis PR adds support for pasting Solscan and Orb Markets URLs directly into the search bar, automatically resolving them to the corresponding local explorer pages for accounts, transactions, blocks, and epochs. The implementation is well-structured: a new Key findings:
Confidence Score: 3/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant SearchBar
participant parseExternalExplorerUrl
participant pickClusterParams
participant Router
User->>SearchBar: paste external URL (e.g. solscan.io/account/xxx?cluster=devnet)
SearchBar->>parseExternalExplorerUrl: buildOptions(search)
parseExternalExplorerUrl-->>SearchBar: SearchElement { pathname: "/address/xxx?cluster=devnet", preserveSearchParams: true }
User->>SearchBar: select option
SearchBar->>SearchBar: pathname.includes("?") → true
SearchBar->>pickClusterParams: (path, currentClusterParams, pathnameParams) [preserveSearchParams swaps arg order]
Note over pickClusterParams: pathnameParams (cluster=devnet) overrides<br/>currentClusterParams (user's current cluster)
pickClusterParams-->>SearchBar: "/address/xxx?cluster=devnet"
SearchBar->>Router: router.push("/address/xxx?cluster=devnet")
Note over SearchBar,Router: If source URL has no cluster param (mainnet-beta default),<br/>preserveSearchParams is NOT set and user's current cluster is preserved
Last reviewed commit: "chore: update build ..." |
|
|
||
| // When preserveSearchParams is set (external explorer URLs), the pathname's | ||
| // params take priority over the current cluster context. | ||
| const nextPath = preserveSearchParams |
There was a problem hiding this comment.
issue: There is a bug. Reproduce:
- Go http://localhost:3000/?cluster=devnet
- Paste https://solscan.io/account/AU971DrPyhhrpRnmEBp5pDTWL2ny7nofb5vYBjDJkR2E?cluster=mainnet-beta OR https://solscan.io/account/AU971DrPyhhrpRnmEBp5pDTWL2ny7nofb5vYBjDJkR2E
- It will preserve devnet cluster (but should redirect to the main cluster) for each case
|
Hey, @arihantbansal! Thank you for your contribution, this is a valuable feature to have! A few general notes in addition to the review comments:
|
Description
Type of change
Screenshots
Testing
Related Issues
Checklist
build:infoscript to update build informationAdditional Notes