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

iOS端TrustWallet通过DeepLink跳转后未注入Ethereum Provider问题求助

iOS端TrustWallet DeepLink跳转后Provider检测失败问题

问题代码

const connectTrustWallet = () => {
    // alert(`is window.trustwallet.ethereum ${window.trustwallet?.ethereum}`);
    // alert(`is window.ethereum ${window.ethereum}`);
    if (isOnMobile() && linkRef.current && (!window.ethereum || !window.trustwallet.ethereum)) {
      linkRef.current.href = `https://link.trustwallet.com/open_url?url=${document.URL}`;
      linkRef.current.click();
      return;
    }
    connect('trust');
  }

问题详情

  • 通过DeepLink跳转至iOS移动端TrustWallet应用后,window.ethereum与window.trustwallet?.ethereum均为undefined。
  • 未在TrustWallet官方开发者文档中找到关于Provider注入位置或手动开启注入的相关说明。
  • 最初怀疑是ViteJS的Service Worker导致问题,但在纯JS/HTML项目中问题依然存在,可排除Service Worker的影响。
  • 存在可复现该问题的示例应用。

核心疑问

TrustWallet是否在其他位置注入Provider?或者是否需要手动开启注入?


内容的提问来源于stack exchange,提问作者Mila A

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.10 06:41:14