0

我在元掩码中获取钱包地址,但我需要从用户钱包中获取签名签名。

这是我的服务文件 帐户:任何
async connectWalletConnect() {

    this.walletconnectProvider = new WalletConnectProvider({
      infuraId: "27e484dcd9e3efcfd25a83a78777cdf1",
  

      rpc:{
        1:'https://cloudflare-eth.com/',
        137:'https://polygon-rpc.com'
      }
    });

    this.walletconnectProvider.enable();

  this.web3 = new Web3(this.walletconnectProvider)
  window.w3 = this.web3

   this.accounts = await this.web3.eth.getAccounts(); // get all connected accounts
  this.accounts 

   console.log(this.accounts[0])
    this.sign()
    
  }
   
   async sign(){
     try {
      
       await this.web3.eth.personal.sign('hello world', this.accounts)

     } catch (error) {
       console.log('faild', error)
     }
   }
4

0 回答 0