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

Wallet provider can change account #124

Open
altai0 opened this issue Aug 24, 2023 · 3 comments
Open

Wallet provider can change account #124

altai0 opened this issue Aug 24, 2023 · 3 comments
Labels

Comments

@altai0
Copy link

altai0 commented Aug 24, 2023

In the current method we use const myProvider = providers[0]; to select an account. We can make this dynamic. Massa Station Wallet sets a master account and providers returns the master account. For account changes it is necessary to change the main account. We can do this by creating a function in wallet-provider. changeAccount() example.

@Ben-Rey
Copy link
Contributor

Ben-Rey commented Aug 24, 2023

Hello @altai0

I'm not sure about what to change.

To contextualise:

Here how I select an massa station wallet account and create a client:

    const wallets = await providers();

    const massaStationWallet = wallets.find(
      (wallet) => wallet.name() === walletName
    );

    const accounts = await massaStationWallet?.accounts();
    // I can store accounts in a state

    const account = accounts?.[0];

    const client = await ClientFactory.fromWalletProvider(
      massaStationWallet!,
      account!
    );

So if I want to change my account I just create a new client with another account, I can display the list so the user can choose.

You said myProvider = providers[0]; is to select an account but it's actually to select a provider which can contain multiple accounts.

Are we on the same page or am I way off the mark.

@Ben-Rey
Copy link
Contributor

Ben-Rey commented Aug 24, 2023

Ok I don't know if it's a related issue but:

  • Massastation return the list of all accounts and we can use all of them because we don't need to approve a dapp like bearby
  • Bearby return only the current account and to switch as a user, we must change it from the extension (like metamask would do I guess)

So there is 2 behaviours which is a problem.

cc @gregLibert

@qdrn
Copy link

qdrn commented Sep 3, 2023

For privacy reason I think it's better to follow Bearby behaviour. Otherwise malicious websites might be able to link different accounts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants