当我尝试从信任钱包浏览器连接到我的钱包时,它会将我重定向到谷歌
[1]:https://i.stack.imgur.com/V4PPx.jpg[2]:https://i.stack.imgur.com/soFxv.jpg
代码是这样的,和 trustWallet doc 一样
1.我怎样才能正确连接到钱包连接?
2. 有没有办法通过钱包连接连接到像 ropsten 这样的测试网?
// set chain id and rpc mapping in provider options
const providerOptions = {
walletconnect: {
package: WalletConnectProvider,
options: {
rpc: {
56: 'https://bsc-dataseed1.binance.org'
},
chainId: 56
}
}
}
const web3Modal = new Web3Modal({
network: "mainnet", // optional
cacheProvider: true, // optional
providerOptions // required
});
const provider = await web3Modal.connect();
await web3Modal.toggleModal();
// regular web3 provider methods
const newWeb3 = new Web3(provider);
const accounts = await newWeb3.eth.getAccounts();
console.log(accounts);