unisat-wallet / extension

The first open-source browser extension wallet for Bitcoin NFTs
Other
874 stars 336 forks source link

Allow to disconnect programatically #204

Closed gndelia closed 3 months ago

gndelia commented 5 months ago

I'm building a dAPP and integrating unisat into it. I'm able to prompt the user to connect unisat by calling window.unisat.requestAccounts(), but there's no method to disconnect. I can remove my app's internal state and show "Disconnected", but once I try to reconnect, it does so automatically, instead of prompting the user as Metamask, for example, does everytime someone connects. So actually, the dApp is still connected, at least from the wallet POV.

The closes to disconnect is removing the connected site from the Wallet extension itself by clicking on "Dapp Connected"

image

and removing the site, but there's no option to do so in the window.unisat object. It seems the option that needs to be exposed (whether directly through window.unisat or indirectly somehow) is the removeConnectedSite method.