If you have multi-wallet enabled, your users might have multiple wallets connected at once. Read here to learn more about multi-wallet.

You can use our wallets module to get access to all your user’s wallets and perform actions with them:

const UserWallets: FC = () => {
  const { wallets } = useReactiveClient(client)

  return (
    <View>
      {wallets.userWallets.map((wallet) => (
        <Text key={wallet.id}>{wallet.address}</Text>
      ))}
    </View>
  )
}

Working your Primary Wallet

You can access the primary wallet via client.wallets.primary as well as set it with client.wallets.setPrimary.

This example sets the first user wallet as the primary wallet on click:

const SetFirstWallet: FC = () => {
  const { wallets } = useReactiveClient(client)

  return (
    <View>
      <Text>Current primary wallet address: {wallets.primary.address}</Text>

      <TouchableOpacity
        onPress={() =>
          wallets.setPrimary({ walletId: wallets.userWallets[0].id })
        }
      >
        Set wallet
      </TouchableOpacity>
    </View>
  )
}

The wallets module also provides a collection of useful methods to perform actions with your users’ wallets. You can read more about the module here.