project-serum / sol-wallet-adapter

Other
185 stars 93 forks source link

`connect` resolves immediately in case of injected provider #24

Open PaulBernier opened 3 years ago

PaulBernier commented 3 years ago

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 commented 3 years ago

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