WalletConnect & web3js - 如何忘记之前设置的钱包?

WalletConnect & web3js - how to forget previously set wallet?

我正在使用 web3Modal 和 web3js 库编写一个 dApp。 我有关于 WalletConnect 提供商的问题。

选择使用 WalletConnect 连接后,QR 码没有显示,我立即连接到以前的(旧的本地测试网络..)钱包。

我尝试在 WalletConnectProvider api 和 web3js 库中寻找一个选项,但没有成功。

以隐身模式打开网站确实有效,但在不使用缓存的情况下加载页面无效(chrome 上的 ctrl+shift+f5),使用 html 禁用缓存也无效 headers.

我不确定我错过了什么,因为它显然保存在某个地方但不在缓存中。

解决方案:使用 localStorage.clear() 清除本地存储。 如果需要的话,应该可以有更多的粒度。

首先需要使用connector.killSession(),然后清除本地存储。