caelum0x c10c50b9ba fix: connect wallet always offered QIE Testnet instead of the real configured network
WalletProvider.connect() picked wallet_addEthereumChain params via
`chainId === 1990 ? MAINNET : TESTNET` -- a ternary that only
distinguishes QIE Mainnet from everything else. The live production
site runs on the "demo" network (chainId 31337, the self-hosted anvil
devnet backing https://qie-forge.vercel.app -- the only network
actually deployed today). Any real visitor whose wallet didn't already
have chain 31337 added would hit the wallet_addEthereumChain fallback
and get offered QIE Testnet (1983, https://testnet.qie.digital/api/eth-rpc)
instead -- the wrong chain, where none of this app's deployed contracts
exist. The UI would report "connected" while every subsequent
swap/deposit/borrow transaction silently targeted the wrong network.

Fixed by building the add-chain params from whichever network is
actually configured (getNetworkConfig()) instead of a hardcoded
two-network guess, and dropped the now-redundant chainId parameter
every one of the 5 call sites (SwapCard/VaultCard/LendCard/
LiquidityCard/WalletConnectButton) was separately re-deriving just to
pass through to connect().

Verified: `tsc --noEmit` and `eslint` clean on every changed file;
`next build` clean (no type errors); full workspace `npm test`
(core 23/23 + cli 28/28, unchanged); a Node script against the built
core package reproduces the pre-fix bug (chainId 31337 -> old logic
picks TESTNET/1983) and confirms the fix (same input -> real demo
chain 0x7a69 with the real self-hosted RPC URL); redeployed to
https://qie-forge.vercel.app (vercel --prod + alias) and re-verified
live: /, /swap, /pool, /vault all 200, /api/quote still returns
139579 for 1 WQIE, /vault's server-rendered stats bar still shows the
documented 500000/480000/20000/4.00%/0/20000-100000 TUSD figures
unchanged -- zero regressions from the refactor.
2026-10-29 13:24:35 +03:00
..