To determine if Privy has fully processed all external and embedded EVM wallet connections, use the ready boolean returned by the useWallets hook, or the ready boolean returned by the useSolanaWallets hook for Solana wallets.

To prompt a user to connect an external wallet (on EVM networks or Solana) to your app, use the connectWallet method from the useConnectWallet hook.

connectWallet: async ({ suggestedAddress?: string, walletList?: WalletListEntry[], walletChainType?: 'ethereum' | 'solana' }) => void

Usage

To connect external wallets on Solana, your application must first explicitly configure Solana connectors for Privy. Learn more

import {useConnectWallet} from '@privy-io/react-auth';
const {connectWallet} = useConnectWallet();

connectWallet();

Parameters

suggestedAddress
string

An suggested address for the user to connect, which will be displayed in Privy’s UI.

walletList
WalletListEntry[]

A list of [wallet option] that you would like Privy to display in the connection prompt.

walletChainType
'solana-only' | 'ethereum-only' | 'ethereum-and-solana'

Filter the login wallet options to only show wallets that support the specified chain type.

Callbacks

You can optionally register an onSuccess or onError callback on the useConnectWallet hook.

const {connectWallet} = useConnectWallet({
    onSuccess: ({wallet}) => {
        console.log(wallet);
    },
    onError: (error) => {
        console.log(error);
    },
});
onSuccess
({wallet: Wallet}) => void

An optional callback function that is called when a user successfully connects their wallet.

onError
({error: string}) => void

An optional callback function that is called when a user exits the connection flow or there is an error.