fix(wallet): MetaMask Open Snap allowlist messaging + resolveExplorerApiBase

- Clarify stable MetaMask install allowlist vs open Snap permissions on /wallet
- Surface Flask / allowlist-application hint when install errors mention allowlist
- Add shared resolveExplorerApiBase helper for catalog URLs

Made-with: Cursor
This commit is contained in:
defiQUG
2026-04-05 01:23:25 -07:00
parent f6e842ea83
commit d931be8e19
2 changed files with 152 additions and 20 deletions

View File

@@ -0,0 +1,25 @@
const LOCAL_EXPLORER_API_FALLBACK = 'http://localhost:8080'
function normalizeApiBase(value: string | null | undefined): string {
return (value || '').trim().replace(/\/$/, '')
}
export function resolveExplorerApiBase(options: {
envValue?: string | null
browserOrigin?: string | null
serverFallback?: string
} = {}): string {
const explicitBase = normalizeApiBase(options.envValue ?? process.env.NEXT_PUBLIC_API_URL ?? '')
if (explicitBase) {
return explicitBase
}
const browserOrigin = normalizeApiBase(
options.browserOrigin ?? (typeof window !== 'undefined' ? window.location.origin : '')
)
if (browserOrigin) {
return browserOrigin
}
return normalizeApiBase(options.serverFallback ?? LOCAL_EXPLORER_API_FALLBACK)
}