sol-wallet-adapter icon indicating copy to clipboard operation
sol-wallet-adapter copied to clipboard

`connect` resolves immediately in case of injected provider

Open PaulBernier opened this issue 3 years ago • 1 comments

https://github.com/project-serum/sol-wallet-adapter/blob/master/src/index.js#L69

When using an injected provider the Promise resolve immediately, while for the pop up version it will resolve once the 'connected' even has been received from the pop up. Why this discrepancy of behavior? I believe the later approach is better (i.e the connect method returns only once the user has clicked connect in the UI)

PaulBernier avatar Apr 03 '21 16:04 PaulBernier

Replacing resolve by this.once('connect', resolve); seems to work fine, so I am wondering if that should be changed.

PaulBernier avatar Apr 04 '21 18:04 PaulBernier