From acf1e534d6f80d2b48bfd6b8ae4e0c96f3ed8623 Mon Sep 17 00:00:00 2001 From: Christian Montoya Date: Wed, 17 Apr 2024 12:15:33 -0400 Subject: [PATCH] Disconnect before changing address --- packages/site/src/script.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/site/src/script.js b/packages/site/src/script.js index ea65c4e..8e073f8 100644 --- a/packages/site/src/script.js +++ b/packages/site/src/script.js @@ -132,6 +132,18 @@ const snapInstalled = async (provider, skippedStep1 = false) => { btn.onclick = async (event) => { event.preventDefault(); + if (isAccountConnected) { + // need to disconnect first + await window.ethereum.request({ + "method": "wallet_revokePermissions", + "params": [ + { + "eth_accounts": {} + } + ] + }); + isAccountConnected = false; + } const accounts = await provider.request({ method: 'eth_requestAccounts', params: [],