Fix Heima account API fallback#29
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #26
Summary
https://explorer-api.heima.network.API_HOSTconstant for the local proxy route so the proxy fallback cannot drift to a different network.Diagnosis
The reported Heima
sub/accountpages were querying the wrong API whenNEXT_PUBLIC_API_HOSTwas empty. Livehttps://explorer.heima.network/__ENV.jscurrently exposesNEXT_PUBLIC_API_HOST:""; the UI then fell back tohttps://assethub-westend-lite.webapi.subscan.io, which returnsdata:nullfor 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 --runInBandcd ui-react && npm run lint -- --file src/utils/const.ts --file src/pages/api/proxy.ts --file src/__tests__/utils/const.test.tscd ui-react && node test-results/evidence/heima-account-e2e.playwright.jscurl -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.networkwhen runtime/buildNEXT_PUBLIC_API_HOSTis absent, and the Next API proxy shares the same fallback.Objective Evidence:
__ENV.jshasNEXT_PUBLIC_API_HOST:"", causing the old UI fallback to queryassethub-westend-lite.webapi.subscan.io; that endpoint returneddata:nullfor both reported Heima addresses.explorer-api.heima.networkreturnedbalance:"12064779000000000000000000"for49VYu...andbalance:"4477102000000000000000000"for4BNd....npm test -- --runTestsByPath src/__tests__/utils/const.test.ts --runInBand.npm run lint -- --file src/utils/const.ts --file src/pages/api/proxy.ts --file src/__tests__/utils/const.test.ts.node test-results/evidence/heima-account-e2e.playwright.js; it navigated both account pages, asserted the expected balances rendered, asserted both/api/plugin/balance/accountresponses used the reported addresses, and asserted zeroassethub-westendrequests.Visual Evidence:

Reviewer:
@repo Intake Codex Reviewer
Risks / Not Covered:
npm run buildstill 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.NEXT_PUBLIC_API_HOSTexplicitly, but this change makes a missing value fall back to the correct Heima API instead of the wrong network.