You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

页面重载时Core钱包账户无法检测的问题求助(Vite+web3modal+ethers)

Core钱包页面重载后无法检测账户问题(Vite + Web3Modal + Ethers + Avalanche Fuji测试网)

使用Vite框架,搭配Web3Modal与Ethers,连接Core钱包到Avalanche Fuji测试网时,页面重载后本该自动检测到已连接的账户,但无法实现。

控制台报错截图

控制台报错

账户检测代码

const updateCurrentWalletAddress = async () => {
    const accounts = await window?.ethereum?.request({
        method: "eth_requestAccounts"
    }).catch((err)=>{
        console.log(err)})

    if(accounts){
        setWalletAddress(accounts[0])
    }
}

检测用useEffect钩子代码

useEffect(() => {
    updateCurrentWalletAddress()
    window?.ethereum?.on("accountsChanged", updateCurrentWalletAddress)
}, []);

已尝试的解决方案:

  • 清除浏览器数据、缓存和Cookie
  • 创建新的Core钱包账户
  • 卸载并重装Core钱包

以上操作后问题仍未解决。

内容的提问来源于stack exchange,提问作者Nurbaki Vural

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.13 13:15:18