feat(explorer): dual-chain wallet metadata, native coin pricing, and UI refresh.
Deploy Explorer Live / deploy (push) Failing after 20s
Validate Explorer / frontend (push) Failing after 24s
Validate Explorer / smoke-e2e (push) Has been skipped

Add Chain 138 wallet network metadata and stats coin-price enrichment; sync frontend explorer SPA, command center, and address/token pages with backend config.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
defiQUG
2026-06-19 16:16:17 -07:00
co-authored by Cursor
parent 0f02e6e54f
commit b87ebee6a1
94 changed files with 7648 additions and 1124 deletions
+103
View File
@@ -0,0 +1,103 @@
#!/usr/bin/env bash
# Runs INSIDE VMID 5000. Idempotent nginx guard for Next.js /addresses/* and catch-all /.
# Installed to /usr/local/bin by explorer-monorepo/scripts/cron/install-explorer-cron.sh
# and proxmox/scripts/deployment/patch-explorer-nginx-next-routes.sh.
set -euo pipefail
SITE="${EXPLORER_NGINX_SITE:-/etc/nginx/sites-enabled/blockscout}"
AVAILABLE="${EXPLORER_NGINX_AVAILABLE:-/etc/nginx/sites-available/blockscout}"
BACKUP_DIR="${EXPLORER_NGINX_BACKUP_DIR:-/etc/nginx/sites-available/backups}"
PROBE_PATH="${EXPLORER_NGINX_PROBE_PATH:-/addresses/0x582b82fbf721348ee490487dc8d99846a687806d}"
MODE="${1:-repair}"
mkdir -p "$BACKUP_DIR"
for stray in /etc/nginx/sites-enabled/blockscout.bak.*; do
[ -e "$stray" ] || continue
mv "$stray" "$BACKUP_DIR/$(basename "$stray")"
done
verify_nginx_routes() {
local code
code="$(curl -sS -o /dev/null -w '%{http_code}' --connect-timeout 5 \
-H 'Host: explorer.d-bis.org' \
-H 'X-Forwarded-Proto: https' \
"http://127.0.0.1${PROBE_PATH}" 2>/dev/null || echo '000')"
[ "$code" = "200" ]
}
apply_nginx_routes() {
if [ ! -f "$SITE" ]; then
echo "ensure-explorer-nginx-next-routes: missing $SITE" >&2
return 1
fi
cp "$SITE" "${BACKUP_DIR}/blockscout.bak.next-routes-$(date +%Y%m%d%H%M%S)"
python3 - <<'PY'
from pathlib import Path
site = Path("/etc/nginx/sites-enabled/blockscout")
text = site.read_text()
needle = "location ~ ^/(address|tx|"
replacement = "location ~ ^/(address|addresses|tx|"
if "address|addresses|" not in text:
if needle not in text:
raise SystemExit("nginx app-route regex anchor not found")
text = text.replace(needle, replacement, 1)
catch_all = '''
# Catch-all goes to the Next frontend after API/static exclusions.
location / {
if ($redirect_http_to_https = 1) { return 301 https://$host$request_uri; }
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Connection "";
proxy_buffering off;
proxy_hide_header Cache-Control;
add_header Cache-Control "no-store, no-cache, must-revalidate" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
}
'''
if "Catch-all goes to the Next frontend" not in text:
marker = "\n}\n\n\nmap $http_upgrade $connection_upgrade {"
if marker not in text:
marker = "\n}\n\nmap $http_upgrade $connection_upgrade {"
if marker not in text:
raise SystemExit("server block closing anchor not found")
text = text.replace(marker, catch_all + marker, 1)
site.write_text(text)
Path("/etc/nginx/sites-available/blockscout").write_text(text)
print("nginx: ensured /addresses route and Next.js catch-all")
PY
nginx -t
systemctl reload nginx
}
case "$MODE" in
check)
verify_nginx_routes
;;
repair)
if verify_nginx_routes; then
exit 0
fi
apply_nginx_routes
verify_nginx_routes
;;
force)
apply_nginx_routes
verify_nginx_routes
;;
*)
echo "Usage: $0 [check|repair|force]" >&2
exit 2
;;
esac
+17
View File
@@ -13,6 +13,15 @@ log() { echo "$(date -Iseconds) $*" >> "$LOG" 2>/dev/null || true; }
# 1) Ensure PostgreSQL is running
docker start blockscout-postgres 2>/dev/null || true
# 1b) Keep explorer-config-api DATABASE_URL aligned with blockscout-postgres bridge IP
if [ -x /usr/local/bin/sync-explorer-config-api-database-url.sh ]; then
if /usr/local/bin/sync-explorer-config-api-database-url.sh >>"$LOG" 2>&1; then
:
else
log "sync-explorer-config-api-database-url failed"
fi
fi
# 2) Blockscout API health: if not 200, restart or start container
CODE=$(curl -sS -o /dev/null -w "%{http_code}" --connect-timeout 5 http://127.0.0.1:4000/api/v2/stats 2>/dev/null || echo "000")
if [ "$CODE" != "200" ]; then
@@ -35,6 +44,14 @@ if [ "$NGINX" != "active" ]; then
systemctl start nginx 2>>"$LOG" || true
fi
# 3b) Next.js route guard: /addresses/* must proxy to port 3000 (not nginx 404)
if [ -x /usr/local/bin/ensure-explorer-nginx-next-routes.sh ]; then
if ! /usr/local/bin/ensure-explorer-nginx-next-routes.sh check >>"$LOG" 2>&1; then
log "Explorer nginx /addresses route broken; repairing"
/usr/local/bin/ensure-explorer-nginx-next-routes.sh repair >>"$LOG" 2>&1 || log "ensure-explorer-nginx-next-routes repair failed"
fi
fi
# 4) Safe disk prune (only if env RUN_PRUNE=1 or first run on Sunday 3am - use cron for daily)
# Do NOT prune containers (would remove stopped Blockscout). Prune only unused images and build cache.
if [ "${RUN_PRUNE:-0}" = "1" ]; then
+17 -1
View File
@@ -31,16 +31,32 @@ fi
EXEC_PREFIX="pct exec $VMID --"
MAINTAIN_SCRIPT="/usr/local/bin/explorer-maintain.sh"
SYNC_DB_SCRIPT="/usr/local/bin/sync-explorer-config-api-database-url.sh"
SYNC_SRC="$REPO_ROOT/scripts/sync-explorer-config-api-database-url.sh"
NGINX_ENSURE_SRC="$SCRIPT_DIR/ensure-explorer-nginx-next-routes.sh"
NGINX_ENSURE_SCRIPT="/usr/local/bin/ensure-explorer-nginx-next-routes.sh"
echo "=============================================="
echo "Install explorer maintenance cron (VMID $VMID)"
echo "=============================================="
# Copy script into VM
# Copy scripts into VM
pct push $VMID "$SCRIPT_DIR/explorer-maintain.sh" "$MAINTAIN_SCRIPT"
$EXEC_PREFIX chmod +x "$MAINTAIN_SCRIPT"
echo "✅ Installed $MAINTAIN_SCRIPT"
if [ -f "$SYNC_SRC" ]; then
pct push $VMID "$SYNC_SRC" "$SYNC_DB_SCRIPT"
$EXEC_PREFIX chmod +x "$SYNC_DB_SCRIPT"
echo "✅ Installed $SYNC_DB_SCRIPT"
fi
if [ -f "$NGINX_ENSURE_SRC" ]; then
pct push $VMID "$NGINX_ENSURE_SRC" "$NGINX_ENSURE_SCRIPT"
$EXEC_PREFIX chmod +x "$NGINX_ENSURE_SCRIPT"
echo "✅ Installed $NGINX_ENSURE_SCRIPT"
fi
# Install crontab (append to existing)
$EXEC_PREFIX bash -c '(crontab -l 2>/dev/null | grep -v explorer-maintain | grep -v /usr/local/bin/explorer-maintain.sh || true; echo "# explorer-maintain"; echo "*/5 * * * * /usr/local/bin/explorer-maintain.sh >> /var/log/explorer-maintain.log 2>&1"; echo "15 3 * * * RUN_PRUNE=1 /usr/local/bin/explorer-maintain.sh >> /var/log/explorer-maintain.log 2>&1") | crontab -'
echo "✅ Cron installed:"