Skip to content

fix(frontend): one network default; fail fast on a mismatched network and deployer - #36

Merged
jayteemoney merged 1 commit into
mainfrom
fix/dev-network-defaults
Oct 7, 2026
Merged

jayteemoney merged 1 commit into
mainfrom
fix/dev-network-defaults

Conversation

@jayteemoney

Copy link
Copy Markdown
Owner

The bug. Running npm run dev with no env file crashed the dashboard with Cannot read properties of undefined (reading 'contractId') in useTokenBalance.

Why. Only .env.production exists, and next dev doesn't read it. So the network fell back to testnet while 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 undefined DEFAULT_TOKEN. The server code also defaulted to mainnet, so the API and the UI could disagree about which chain they were reading.

The fix

  • The network now defaults to mainnet, matching the deployer default and the live site.
  • An unknown network name, or a deployer address from the other network, now stops the app at startup with a message naming the variable to fix.
  • openclaw-server reads its network and deployer from constants, so there is one source.
  • Adds frontend/.env.example.

Verified

  • A bare npm run dev (Turbopack, no env file): /dashboard and /dashboard/create load, and the screenshot shows the dashboard on mainnet at block 9,140,079.
  • 211 tests pass, including 5 new configuration tests (default, valid testnet pair, both mismatches, unknown network name).
  • tsc and lint are clean.

…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.
@vercel

vercel Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
stackstream Ready Ready Preview Oct 7, 2026 1:20pm UTC

@jayteemoney
jayteemoney merged commit 9d17c6a into main Oct 7, 2026
2 of 5 checks passed

This branch was successfully deployed

1 active deployment
Preview — f426a820 Deployed Oct 7, 2026 by vercel[bot]
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.

1 participant