diff --git a/client/src/hooks/useWallet.ts b/client/src/hooks/useWallet.ts
index c52be37..55abbc0 100644
--- a/client/src/hooks/useWallet.ts
+++ b/client/src/hooks/useWallet.ts
@@ -87,6 +87,36 @@ export function useWallet() {
}
}, []);
+ // Auto-detect already-connected wallet on page load (silent, no popup)
+ useEffect(() => {
+ const autoDetect = async () => {
+ if (!window.ethereum) return;
+ try {
+ const provider = new BrowserProvider(window.ethereum as Eip1193Provider);
+ // Use eth_accounts (not eth_requestAccounts) — silent, no popup
+ const accounts = await provider.send("eth_accounts", []);
+ if (accounts && accounts.length > 0) {
+ const network = await provider.getNetwork();
+ const signer = await provider.getSigner();
+ const address = accounts[0] as string;
+ setState({
+ address,
+ shortAddress: shortenAddress(address),
+ isConnected: true,
+ chainId: Number(network.chainId),
+ provider,
+ signer,
+ isConnecting: false,
+ error: null,
+ });
+ }
+ } catch {
+ // Silently ignore — user hasn't connected yet
+ }
+ };
+ autoDetect();
+ }, []);
+
// Listen for account/chain changes
useEffect(() => {
if (!window.ethereum) return;
@@ -99,6 +129,7 @@ export function useWallet() {
...s,
address: accs[0],
shortAddress: shortenAddress(accs[0]),
+ isConnected: true,
}));
}
};
diff --git a/client/src/pages/Home.tsx b/client/src/pages/Home.tsx
index 67996fb..9b9706c 100644
--- a/client/src/pages/Home.tsx
+++ b/client/src/pages/Home.tsx
@@ -104,11 +104,18 @@ function StepBadge({ num, text }: { num: number; text: string }) {
}
// ─── TRC20 Purchase Panel ─────────────────────────────────────────────────────
-function TRC20Panel({ usdtAmount, lang }: { usdtAmount: number; lang: Lang }) {
+function TRC20Panel({ usdtAmount, lang, connectedAddress }: { usdtAmount: number; lang: Lang; connectedAddress?: string }) {
const { t } = useTranslation(lang);
const tokenAmount = usdtAmount / PRESALE_CONFIG.tokenPrice;
const [copied, setCopied] = useState(false);
- const [evmAddress, setEvmAddress] = useState("");
+ const [evmAddress, setEvmAddress] = useState(connectedAddress || "");
+
+ // Auto-fill EVM address when wallet connects
+ useEffect(() => {
+ if (connectedAddress && !evmAddress) {
+ setEvmAddress(connectedAddress);
+ }
+ }, [connectedAddress]);
const [evmAddrError, setEvmAddrError] = useState("");
const [submitted, setSubmitted] = useState(false);
@@ -1017,7 +1024,7 @@ export default function Home() {
))}
-
+
)}
diff --git a/todo.md b/todo.md
index e375566..a32bb9f 100644
--- a/todo.md
+++ b/todo.md
@@ -38,6 +38,16 @@
- [ ] 完整域名浏览器购买测试(pre-sale.newassetchain.io)
- [ ] 部署到备份服务器并同步代码库
+## v5 备份服务器部署
+- [x] 修复TRON面板EVM地址自动识别(已连接钱包地址预填入)
+- [ ] 构建生产版本(移除Manus内联)
+- [ ] 打包并上传到备份服务器 103.96.148.7
+- [ ] 备份服务器环境配置(Node.js 22、PM2、MySQL、Nginx)
+- [ ] 配置环境变量(DATABASE_URL、JWT_SECRET等)
+- [ ] 启动服务并验证运行状态
+- [ ] 同步代码到Gitea库(nacadmin/xic-presale)
+- [ ] 记录部署日志
+
## v5 钱包连接修复
- [x] 将useWallet()提升到Home顶层,通过props传递给NavWalletButton和EVMPurchasePanel
- [x] 验证导航栏和购买面板钱包状态同步
diff --git a/vite.config.ts b/vite.config.ts
index 8d4acaf..c11b2eb 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -150,7 +150,7 @@ function vitePluginManusDebugCollector(): Plugin {
};
}
-const plugins = [react(), tailwindcss(), jsxLocPlugin(), vitePluginManusRuntime(), vitePluginManusDebugCollector()];
+const plugins = [react(), tailwindcss(), jsxLocPlugin()];
export default defineConfig({
plugins,