unisat-wallet / extension

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

Allow disconnecting in programming #212

Open web3batman opened 4 months ago

web3batman commented 4 months ago

I'm developing a decentralized application (dApp) and integrating UniSat into it. I can prompt the user to connect to UniSat by calling window.unisat.requestAccounts(). However, there is no method available to disconnect. While I can clear my application's internal state and display a "Disconnected" status, attempting to reconnect results in an automatic connection, rather than prompting the user as MetaMask does each time a connection is made. This indicates that the dApp remains connected from the wallet's perspective.

The closest approach to disconnecting is manually removing the connected site from the wallet extension by clicking on "Dapp Connected" and then removing the site. Unfortunately, there is no option to do this programmatically through the window.unisat object. It appears that the method required to achieve this, removeConnectedSite, needs to be exposed either directly through window.unisat or indirectly in some manner.

gndelia commented 3 months ago

Duplicated/Related https://github.com/unisat-wallet/extension/issues/204 (it's actually a word-by-word copy!)