【问题标题】:WalletConnect disable infura error messageWalletConnect 禁用 infura 错误消息
【发布时间】:2021-09-18 11:41:45
【问题描述】:

我目前正在开发一个 dapp,我正在集成 walletconnect。

我使用此代码进行连接:

const chainId = ContractService.getPreferredChainId();
const rpc = ContractService.getRpcAddress();
provider = new WalletConnectProvider({
  infuraId: undefined,
  rpc: {
    [chainId]: rpc,
  },
});
await provider.enable();

chainId 是根据应用程序是否处于开发模式而动态选择的。在开发过程中,它在链 id 97 上运行。 RPC 也是如此,它只是获得了币安智能链 RPC JSON 提供者。

连接正常,但出现以下错误:

知道如何在不创建 infura 帐户的情况下解决此问题吗?或者是必须的.​​.

【问题讨论】:

    标签: wallet-connect dapp


    【解决方案1】:

    我发现了问题所在。

    确保向对象添加chainId,如下所示:

    new WalletConnectProvider({
      infuraId: undefined,
      rpc: {
        1: "https://RPC_URL",
      },
      chainId: 1
    });
    

    那么它应该可以正常工作,您甚至可以省略 infuraId 字段

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-10-18
      • 2020-12-21
      • 1970-01-01
      • 1970-01-01
      • 2012-10-06
      • 2018-01-15
      • 1970-01-01
      • 2011-06-15
      相关资源
      最近更新 更多