Skip to content

Fix Heima account API fallback#29

Merged
YoshiyukiSakura merged 1 commit into
crossagentfrom
worktree/task_a089a04782f24049
May 24, 2026
Merged

Fix Heima account API fallback#29
YoshiyukiSakura merged 1 commit into
crossagentfrom
worktree/task_a089a04782f24049

Conversation

@crossagent-production-app
Copy link
Copy Markdown
Contributor

Refs #26

Summary

  • Changed the bundled Heima UI/API fallback from AssetHub Westend to https://explorer-api.heima.network.
  • Reused the shared API_HOST constant for the local proxy route so the proxy fallback cannot drift to a different network.
  • Added a focused Jest regression test for the default API host.

Diagnosis

The reported Heima sub/account pages were querying the wrong API when NEXT_PUBLIC_API_HOST was empty. Live https://explorer.heima.network/__ENV.js currently exposes NEXT_PUBLIC_API_HOST:""; the UI then fell back to https://assethub-westend-lite.webapi.subscan.io, which returns data:null for both Heima addresses. The Heima backend itself returns account data for both addresses, so this is a frontend/API-host configuration fallback issue, not an address format, indexer, network config, or chain data issue.

Verification

  • cd ui-react && npm test -- --runTestsByPath src/__tests__/utils/const.test.ts --runInBand
  • cd ui-react && npm run lint -- --file src/utils/const.ts --file src/pages/api/proxy.ts --file src/__tests__/utils/const.test.ts
  • cd ui-react && node test-results/evidence/heima-account-e2e.playwright.js
  • curl -sS -X POST https://explorer-api.heima.network/api/plugin/balance/account -H 'content-type: application/json' --data '{"address":"49VYuGkjdmZprGpb4jU313RdSffxSVHixojzmafdFYGpVYXb"}'
  • curl -sS -X POST https://explorer-api.heima.network/api/plugin/balance/account -H 'content-type: application/json' --data '{"address":"4BNdLBoSrAgW6kHJ5sxVPbGAyqWxqzPF1KbTnWFKf3DVnWj6"}'

Delivery Evidence Summary

Change:
Heima UI fallback API host now resolves to https://explorer-api.heima.network when runtime/build NEXT_PUBLIC_API_HOST is absent, and the Next API proxy shares the same fallback.

Objective Evidence:

  • Reproduced current failure mode: live __ENV.js has NEXT_PUBLIC_API_HOST:"", causing the old UI fallback to query assethub-westend-lite.webapi.subscan.io; that endpoint returned data:null for both reported Heima addresses.
  • Confirmed Heima backend data exists: explorer-api.heima.network returned balance:"12064779000000000000000000" for 49VYu... and balance:"4477102000000000000000000" for 4BNd....
  • Passed focused Jest regression: npm test -- --runTestsByPath src/__tests__/utils/const.test.ts --runInBand.
  • Passed focused lint: npm run lint -- --file src/utils/const.ts --file src/pages/api/proxy.ts --file src/__tests__/utils/const.test.ts.
  • Passed rendered browser validation: node test-results/evidence/heima-account-e2e.playwright.js; it navigated both account pages, asserted the expected balances rendered, asserted both /api/plugin/balance/account responses used the reported addresses, and asserted zero assethub-westend requests.

Visual Evidence:
heima-account-e2e.png

Reviewer:
@repo Intake Codex Reviewer

Risks / Not Covered:

  • npm run build still fails on existing static prerender errors (NextRouter was not mounted) across many pages; this is outside the narrow API-host fallback change and was not fixed here.
  • Production still should set NEXT_PUBLIC_API_HOST explicitly, but this change makes a missing value fall back to the correct Heima API instead of the wrong network.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
subscan-essentials Ready Ready Preview, Comment May 24, 2026 6:25pm
subscan-essentials-ui-react Ready Ready Preview, Comment May 24, 2026 6:25pm

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants