solana-mobile / mobile-wallet-adapter

Other
231 stars 94 forks source link

Multi Account Support #438

Open Funkatronics opened 1 year ago

Funkatronics commented 1 year ago

Summary

Currently Mobile Wallet Adapter allows wallets to return a list of accounts to an authorized dApp. The intention of this functionality is to allow multiple accounts to be simultaneously authorized and used within the session. This functionality is not fully fleshed out throughout the API and should be further developed to allow dApps and wallets to perform more complex tasks that involve multiple users wallets/accounts.

Tasks

d-reader-josip commented 1 year ago

Is there any wallet out there which actually allows users to authorize multiple addresses?

Did I understand this right: it's up to wallets to allow users to select multiple addresses to authorize (include within the auth tokens scope), but it's up to dApps to implement the addressSelector. So far no mobile wallet implemented the addresses-to-authorize selector so there is no point for dApps to implement the addressSelector (since it will always be a single wallet address authorized per auth token).

Somewhat related comment from my previous feature request: https://github.com/solana-mobile/mobile-wallet-adapter/issues/328#issuecomment-1500234382 Steven Luschers answere on SM discord: https://discord.com/channels/988649555283308564/1092846107542950038/1094140237506166885

He also says that multi-account feature is gtg for the most part? Why did you add this task then: " Implement Multiple Accounts feature in Mobile Wallet Adapter"

Funkatronics commented 1 year ago

Hey @d-reader-josip,

The mobile wallet adapter spec allows wallets to return a list of accounts that have been authorized for the scope (see here). But currently this functionality is not fleshed out through the rest of the protocol, and is not used in our example apps (see issue #44 for more background and info about this). So we want to, at the very least, update the rest of the privileged methods in the spec to add an accounts field to specify which account(s) the dapp would like the wallet to use for that request. Additionally, if we add some kind of account feature flag or profiling, dapps and wallets could use this multi account api to handle more complex interactions like accounting for multi sig wallets, using burners or payer accounts, issue read only accounts alongside a writable account, etc. This is an evolution of the spec that will allow for more interesting use cases and interactions, while still supporting todays common use case of 1 account per session.

Is there any wallet out there which actually allows users to authorize multiple addresses? it's up to wallets to allow users to select multiple addresses to authorize (include within the auth tokens scope), but it's up to dApps to implement the addressSelector. there is no point for dApps to implement the addressSelector

How these features are used in practice remains up to the dapps and wallets. Dapps and Wallets can choose how they want to adopt and handle these new features. As long as they are compatible with the underlying spec, the UI is up to them. I can see possible use cases that require some kind of address selector ui in the dapp, and others that allow the dapp to select the correct account based on its features without user input.