Skip to content

Documentation / react-auth / UseSolanaWalletsInterface

Interface: UseSolanaWalletsInterface

Hook to create and interact with Solana wallets. This currently only supports an embedded Solana wallet and no external wallets.

Properties

createWallet

createWallet: () => Promise<Wallet>

Method to create an embedded Solana wallet for a user. This method will throw an error if the user already has an embedded Solana or Ethereum wallet. Currently, only embedded Solana wallets with automatic recovery are supported.

Returns

Promise<Wallet>

wallet {Wallet} the Solana linked account for the user.


exportWallet

exportWallet: (options?) => Promise<void>

Shows the user a Privy modal, from which they can copy their embedded solana wallet's private key for easy export to another wallet client (e.g. Phantom, Backpack). The private key is loaded on an iframe running on a separate domain from your app, meaning your app cannot access it.

This method will error if the user is not authenticated or does not have an embedded solana wallet.

Parameters

options?: Object

{address: string} (optional) wallet address to export the private key for

options.address?: string

Returns

Promise<void>

Promise that resolves once the user exits the modal


wallets

wallets: ConnectedSolanaWallet[]

An array of the connected Solana wallets for the user. Currently, this will only contain the embedded Solana wallet if the user has created one.