Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broadcast onDisconnect() & onNetworkChange() injected API events #17

Open
DEADPXLZ opened this issue Jul 17, 2021 · 9 comments
Open

Broadcast onDisconnect() & onNetworkChange() injected API events #17

DEADPXLZ opened this issue Jul 17, 2021 · 9 comments

Comments

@DEADPXLZ
Copy link
Contributor

DEADPXLZ commented Jul 17, 2021

Callbacks on Disconnect (aka remove from Whitelist) and on switching between Testnet & Mainnet would be very helpful, consider adding these?
Functionality should be similar to the onAccountChange() injected API call.

@DEADPXLZ DEADPXLZ changed the title Broadcast onDisconnect() & onNetworkChange() events Broadcast onDisconnect() & onNetworkChange() injected API events Jul 17, 2021
@alessandrokonrad
Copy link
Contributor

onNetworkChange is a good idea. Gonna add that one.
With onDisconnect I'm not sure, because as soon as you remove the page from the whitelist, in going and outgoing connections to the webpage are blocked. Also I don't think this would be a typical event or where do you see this as useful?

@DEADPXLZ
Copy link
Contributor Author

100% on the onNetworkChange(), thank you very much!

Regarding the onDisconnect() event, it's useful for updating the UI on apps that use the wallet during runtime.
Metamask also does this and they actually go the extra mile where you can actually trigger a disconnection from within the 3rd party website. LMKWYT

@alessandrokonrad
Copy link
Contributor

So onDisconnect would probably work best then if an endpoint cardano.disable() exists as well right?
I'll think about the onDisconnect event.

@DEADPXLZ
Copy link
Contributor Author

Agreed! Listening for disconnections is important as well as it enables more interaction via 3rd party apps and gets users closer to the classic 'account' user journey.

@cjkoepke
Copy link

cjkoepke commented Aug 4, 2021

closer to the classic 'account' user journey.

This is the main point, user's should be able to interface with the wallet without necessarily opening the extension.

@alessandrokonrad
Copy link
Contributor

I get the idea, but the reason why you connect the wallet in first place is because you trust the website you visit. Why would you want to disconnect it again?

@cjkoepke
Copy link

cjkoepke commented Aug 4, 2021

@alessandrokonrad For instance, I am building an interface that uses NFTs within your wallet to "login" to the website. If the user wants to log out (privacy or other), disconnecting your wallet could theoretically act as a catalyst or action to do so.

Also, what if you change your mind about trusting a website?

@rooooooooob
Copy link

Perhaps your view changed of the website, or you only wanted to check it out but would prefer it not have automatic access from now on, depending on how you're implementing your whitelist. It is probably something good to have. Could we start the discussion in the cardano-foundation/CIPs#88 over which events we need to put in the standard? It was an oversight I think as I had included a disconnect event in the Ergo EIP-0012 standard we based the CIP on.

@rooooooooob
Copy link

As the initial CIP-30 PR cardano-foundation/CIPs#88 was merged without an events API (since it wasn't finalized), we have put up a new PR cardano-foundation/CIPs#151 to amend it for events. Events-related discussion should take place in that PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants