Ensure that BrowserWallet.getConnections only returns a connection if the user has asked for it to be "connected".
Changes
Add a field to BrowserWallet to indicate whether the connection is "established". Using the presence of an account like before is not enough as the account could be available on a fresh page load. But as the delegate's onConnected method isn't called until connect is called. This means that the account would be missing in any state maintained by the delegate.
This solution also allows the connection to be marked as disconnected later on.
As no implementations of getConnections are really asynchronous anymore, we also change the interface method to non-async. This makes sense as connectors really should be able to know about their connections directly.
Purpose
Ensure that
BrowserWallet.getConnections
only returns a connection if the user has asked for it to be "connected".Changes
Add a field to
BrowserWallet
to indicate whether the connection is "established". Using the presence of an account like before is not enough as the account could be available on a fresh page load. But as the delegate'sonConnected
method isn't called untilconnect
is called. This means that the account would be missing in any state maintained by the delegate.This solution also allows the connection to be marked as disconnected later on.
As no implementations of
getConnections
are really asynchronous anymore, we also change the interface method to non-async. This makes sense as connectors really should be able to know about their connections directly.