suiet / wallet-kit

The first choice to connect all wallets on Sui blockchain
https://kit.suiet.app
MIT License
166 stars 60 forks source link

How to switch between accounts #309

Open yasserzubair opened 3 months ago

yasserzubair commented 3 months ago

when connecting the sui wallet, I can select multiple accounts. I can also get the list of all connected accounts like this

const suiWallet = useWallet();
let accountsWalletsList = (suiWallet.connected && suiWallet.getAccounts())

But how do I switch between these accounts? Is the any method that can change my default wallet? something like this

const suiWallet = useWallet();
suiWallet.account.address //old address

let accountsWalletsList = (suiWallet.connected && suiWallet.getAccounts())
setDefaultAccount(accountsWalletsList[1]);
suiWallet.account.address //new address
bruceeewong commented 1 month ago

Hi, technically as a Dapp you are not supposed to select account, it would be the selection of what the user chooses on the connected wallet

yasserzubair commented 1 month ago

@bruceeewong but user gets to select multiple wallets while connecting and I can get all the connected accounts via the getAccounts method. What I want to do is show users a list of all the wallets he has connected and he can select any of those wallets.

yasserzubair commented 1 month ago

If we already have the wallet addresses it makes sense to make any of these a default address.

bruceeewong commented 1 month ago

I see your point here. We would think of a way for you guys to specify one of the multiple accounts advertised by a wallet.