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.
74 lines
2.9 KiB
TypeScript
74 lines
2.9 KiB
TypeScript
import type { Metadata } from "next";
|
|
import { Geist, Geist_Mono } from "next/font/google";
|
|
import Link from "next/link";
|
|
import "./globals.css";
|
|
import { DropletIcon, ShieldIcon, SwapIcon } from "@/components/icons";
|
|
import { WalletProvider } from "@/components/WalletProvider";
|
|
import { WalletConnectButton } from "@/components/WalletConnectButton";
|
|
import { getNetworkConfig } from "@/lib/config";
|
|
|
|
const geistSans = Geist({
|
|
variable: "--font-geist-sans",
|
|
subsets: ["latin"],
|
|
});
|
|
|
|
const geistMono = Geist_Mono({
|
|
variable: "--font-geist-mono",
|
|
subsets: ["latin"],
|
|
});
|
|
|
|
export const metadata: Metadata = {
|
|
title: "QIE Forge",
|
|
description: "A clean-room AMM and lending vault for the QIE blockchain.",
|
|
};
|
|
|
|
export default function RootLayout({ children }: LayoutProps<"/">) {
|
|
const network = getNetworkConfig();
|
|
return (
|
|
<html lang="en" className={`${geistSans.variable} ${geistMono.variable} h-full antialiased`}>
|
|
<body className="min-h-full flex flex-col">
|
|
<WalletProvider>
|
|
<header className="border-b border-border">
|
|
<nav className="mx-auto max-w-5xl flex items-center justify-between px-6 py-4">
|
|
<div className="flex items-center gap-8">
|
|
<Link href="/" className="font-semibold tracking-tight text-foreground">
|
|
QIE Forge
|
|
</Link>
|
|
<div className="flex items-center gap-6 text-sm text-muted">
|
|
<Link href="/swap" className="inline-flex items-center gap-1.5 hover:text-foreground">
|
|
<SwapIcon className="w-4 h-4" /> Swap
|
|
</Link>
|
|
<Link href="/pool" className="inline-flex items-center gap-1.5 hover:text-foreground">
|
|
<DropletIcon className="w-4 h-4" /> Pool
|
|
</Link>
|
|
<Link href="/vault" className="inline-flex items-center gap-1.5 hover:text-foreground">
|
|
<ShieldIcon className="w-4 h-4" /> Vault
|
|
</Link>
|
|
</div>
|
|
</div>
|
|
<div className="flex items-center gap-3">
|
|
<span className="hidden sm:inline text-xs text-muted uppercase tracking-wide">{network.name}</span>
|
|
<WalletConnectButton />
|
|
</div>
|
|
</nav>
|
|
</header>
|
|
<main className="flex-1">{children}</main>
|
|
<footer className="border-t border-border py-6">
|
|
<div className="mx-auto max-w-5xl px-6 text-xs text-muted flex items-center justify-between">
|
|
<span>QIE Forge — MIT licensed, built for QIE Mainnet Hackathon 3.0</span>
|
|
<a
|
|
href="https://github.com/caelum0x/qie-forge"
|
|
className="hover:text-foreground"
|
|
target="_blank"
|
|
rel="noreferrer"
|
|
>
|
|
Source
|
|
</a>
|
|
</div>
|
|
</footer>
|
|
</WalletProvider>
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|