feat: explorer API, wallet, CCIP scripts, and config refresh
- Backend REST/gateway/track routes, analytics, Blockscout proxy paths. - Frontend wallet and liquidity surfaces; MetaMask token list alignment. - Deployment docs, verification scripts, address inventory updates. Check: go build ./... under backend/ (pass). Made-with: Cursor
This commit is contained in:
41
frontend/src/utils/search.ts
Normal file
41
frontend/src/utils/search.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
export type DirectSearchTarget =
|
||||
| { kind: 'address'; href: string; label: string }
|
||||
| { kind: 'transaction'; href: string; label: string }
|
||||
| { kind: 'block'; href: string; label: string }
|
||||
|
||||
const addressPattern = /^0x[a-f0-9]{40}$/i
|
||||
const transactionHashPattern = /^0x[a-f0-9]{64}$/i
|
||||
const blockNumberPattern = /^\d+$/
|
||||
|
||||
export function inferDirectSearchTarget(query: string): DirectSearchTarget | null {
|
||||
const trimmed = query.trim()
|
||||
if (!trimmed) {
|
||||
return null
|
||||
}
|
||||
|
||||
if (addressPattern.test(trimmed)) {
|
||||
return {
|
||||
kind: 'address',
|
||||
href: `/addresses/0x${trimmed.slice(2)}`,
|
||||
label: 'Open address',
|
||||
}
|
||||
}
|
||||
|
||||
if (transactionHashPattern.test(trimmed)) {
|
||||
return {
|
||||
kind: 'transaction',
|
||||
href: `/transactions/0x${trimmed.slice(2)}`,
|
||||
label: 'Open transaction',
|
||||
}
|
||||
}
|
||||
|
||||
if (blockNumberPattern.test(trimmed)) {
|
||||
return {
|
||||
kind: 'block',
|
||||
href: `/blocks/${trimmed}`,
|
||||
label: 'Open block',
|
||||
}
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
Reference in New Issue
Block a user