aurowallet / mina-provider

Mina Provider for zkApp
https://www.npmjs.com/package/@aurowallet/mina-provider
Apache License 2.0
5 stars 4 forks source link

"connect" and "disconect" events #5

Open MakarPustovalov opened 1 year ago

MakarPustovalov commented 1 year ago

Hey, guys. In the process of developing my application I had a problem. It seems that the events "connect" and "disconect" described in the code are never called by provider, so there is no direct way to track connection and disconnection of wallet (only if you use event accountsChanged, which doesn't help the situation much). image

The private method onConnect() is never called, so the connectFlag is left undefined, which breaks isConnected() method. For this reason the method isConnected() does not work, always returning undefined value (although according to the type description, a Boolean variable is expected in the output). image image

Also, because of this problem, it is impossible to track whether a wallet is initially connected to app without calling the "mina.requestAccounts()" method, which is undesirable in many cases.

lvshaoping007 commented 1 year ago

Why not determine the connection status directly through window.mina.requestAccounts?