Configuring connectors
To connect external wallets on EVM networks, there is no additional configuration required for your app. Simply continue with the instructions below to prompt connections to external EVM wallets, like MetaMask or Coinbase Wallet.
Connecting the wallet
To prompt a user to connect an external wallet (on EVM networks or Solana) to your app, use Privy’sconnectWallet
method:
config.appearance.walletChainType
configured in your app’s PrivyProvider
. You can prompt users to connect as many wallets as you’d like to your app.
For example, you might have a “Connect” button in your app that prompts users to connect their wallet, like so:
connectWallet
, you may pass an object with the following optional fields:
Field | Type | Description |
---|---|---|
suggestedAddress | string | An suggested address for the user to connect, which will be displayed in Privy’s UI. |
walletList | WalletListEntry[] | A list of wallet optionsthat you would like Privy to display in the connection prompt. |
useWallets
arrays, which you can then use to request signatures and transactions from the connected wallet.
Connecting or creating a wallet
You can also use Privy to connect a user’s external wallet if they have one, or to create an embedded wallet for them if they do not. To do so, use theconnectOrCreateWallet
method of the usePrivy
hook:
loginMethods
, to create an embedded wallet.
Privy’s
connectOrCreate
interface currently only supports external and embedded wallets on EVM
networks.This method functions exactly the same as Privy’s
login
method, except when users connect their
external wallet, they will not automatically be prompted to authenticate that wallet by signing a
messageAuthenticating a connected wallet
Once a user has connected their wallet to your app, and the wallet is available in either of theuseWallets
arrays, you can also prompt them to login with that wallet or link that wallet to their existing account, instead of prompting the entire login
or linkWallet
flow.
To do so, find the ConnectedWallet
or ConnectedStandardSolanaWallet
object from Privy, and call the object’s loginOrLink
method for EVM wallets and use the useLoginWithSiws
or useLinkWithSiws
hooks for the Solana wallets:
loginOrLink
will directly request a SIWE signature from the user’s connected wallet to authenticate the wallet.
If the user was not authenticated
when the method was called, the user will become authenticated
after signing the message.
If the user was already authenticated
when the method was called, the user will remain authenticated
after signing the message, and the connected wallet will become one of the user’s linkedAccounts
in their user
object.
You might use the methods above to “split up” the connect and sign steps of external wallet login, like so: