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

Add API for checking connected account's network #300

Open
sohkai opened this issue May 11, 2019 · 5 comments

Comments

Projects
None yet
3 participants
@sohkai
Copy link
Member

commented May 11, 2019

It would be a breaking change, but app.accounts() may be the best place to put this information.

Alternatively, there could be another method, e.g. app.connectedAccountNetwork().

@emaG3m

This comment has been minimized.

Copy link

commented May 11, 2019

Thanks!!! 💯 💯 💯

@2color

This comment has been minimized.

Copy link
Contributor

commented May 13, 2019

I also think it belongs to app.accounts.

Accounts' abstraction is leaky. Part of it is implemented in @aragon/wrapper and part of it in argon/aragon.

@sohkai Can you explain the logic there?

@sohkai

This comment has been minimized.

Copy link
Member Author

commented May 13, 2019

@2color The main thing is that we initialize @aragon/wrapper with the "read-only" web3 provider, but we need the account from the user's "write" (wallet) web3 provider. And because web3 doesn't expose an event when the account or network change, we're forced to poll for them (account, network).

The rationale behind this originally was that the wallet web3 provider (e.g. metamask) can be very very slow (to the order of >20min to reduce the initial ACL).

@2color

This comment has been minimized.

Copy link
Contributor

commented May 14, 2019

The main thing is that we initialize @aragon/wrapper with the "read-only" web3 provider, but we need the account from the user's "write" (wallet) web3 provider.

That's clear. Thanks for clarifying again.

because web3 doesn't expose an event when the account or network change, we're forced to poll for them (account, network).

I understand.

The rationale behind this originally was that the wallet web3 provider (e.g. metamask) can be very very slow (to the order of >20min to reduce the initial ACL).

Interesting. Is that because of the Web3.js version that metamask uses? Or the actual node that it connects to?

@sohkai

This comment has been minimized.

Copy link
Member Author

commented May 14, 2019

Is that because of the Web3.js version that metamask uses? Or the actual node that it connects to?

Metamask uses infura by default, but they likely do some throttling themselves (since everyone using metamask is piggying backing off of metamask's infura key). Haven't tried doing this recently in the last six months, but I would still assume it's still not very reliable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.