Repository navigation
fix(frontend): one network default; fail fast on a mismatched network and deployer - #36
Merged
Merged
Conversation
…ed pair
`npm run dev` reads no env file (only .env.production exists), so NETWORK
fell back to testnet while CONTRACT_DEPLOYER fell back to the mainnet
deployer. Since the curated list was scoped to the active network, that
pair left it empty, DEFAULT_TOKEN was undefined, and the dashboard crashed
in useTokenBalance ("Cannot read properties of undefined (reading
'contractId')"). The server code defaulted to mainnet, so the two halves of
the app could also disagree about the chain.
- The network now defaults to mainnet, matching the deployer default and the
live site, so a bare `npm run dev` reads the production contracts.
- An unknown network name, or a deployer from the other network, now stops
the app at startup with a message naming the variable to fix, instead of
failing later as an empty token list.
- openclaw-server takes the network and deployer from constants, so the API
and the UI cannot read different chains.
- Adds frontend/.env.example documenting the pair.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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.
The bug. Running
npm run devwith no env file crashed the dashboard withCannot read properties of undefined (reading 'contractId')inuseTokenBalance.Why. Only
.env.productionexists, andnext devdoesn't read it. So the network fell back totestnetwhile the contract deployer fell back to the mainnet address. After #33 scoped the token list to the active network, that mismatched pair produced an empty list and an undefinedDEFAULT_TOKEN. The server code also defaulted tomainnet, so the API and the UI could disagree about which chain they were reading.The fix
mainnet, matching the deployer default and the live site.openclaw-serverreads its network and deployer fromconstants, so there is one source.frontend/.env.example.Verified
npm run dev(Turbopack, no env file):/dashboardand/dashboard/createload, and the screenshot shows the dashboard on mainnet at block 9,140,079.