2

I've created a website on WIX (a web editor) and thought that I could add my code to engage with metamask and the smart contract that I've created, turnes out that wix doesn't support web3 so I searched and found a solution, I've created another website and a domain (using vercel) with only the section of the web3 integration and then embedded the new domain into the wix website using iframe.

everything is working just fine but the main problem is that you can't disconnect through the main website, you have to go to the embedded domain and disconnect your wallet there, if I try to see the status of my wallet in the main website (Image 1) it says that I'm not conncted while in the embedded domain (Image 2) I am conncted.

Is there any way for me to disconnect the user from thier wallet? or perhaps ask them to change thier connected wallet to another wallet?

I've created the integration with metamask and the smart contract using ethers.js

Image 1 Image 1

Image 2 Image 2

Thanks in advance!

2 Answers 2

0

It can not be done programmatically, because it is up to the user to disconnect/connect, you have no control(from code level) over metamask wallet. You just simulate flow of logging in and logging out by checking if you can get access to user's wallet accounts.

0

It's not possible to disconnect due to security reasons.

You can read more about it here: https://github.com/MetaMask/metamask-extension/issues/8990

You can ask the user to change the account:

const accounts = await window.ethereum.request({
    method: "wallet_requestPermissions",
    params: [{
        eth_accounts: {}
    }]
}).then(() => ethereum.request({
    method: 'eth_requestAccounts'
}))

const account = accounts[0]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.