繁体   English   中英

如何断开 Angular 中的 Metamask 钱包

[英]How to disconnect Metamask Wallet in Angular

我想在 Angular 中使用 web3 断开 Metamask 钱包。

//here is my wallet connect code
async connectWallet() {
 const accounts = await this.ethereum.request({
  method: 'eth_requestAccounts',
 });
 this.selectedAddress = accounts[0];
}

请帮助我断开钱包功能注意:我正在使用 Angular 12.2.14

你能试试这个github 问题修复吗

常量

async logout() {
     walletAddress = await window.ethereum.request({
          method: "eth_requestAccounts",
          params: [
            {
              eth_accounts: {}
            }
          ]
        });
    
          await window.ethereum.request({
            method: "wallet_requestPermissions",
            params: [
              {
                eth_accounts: {}
              }
            ]
          });
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM