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: (options?) => Promise<Wallet>

Creates a Solana embedded wallet for the current user.

This method will error if the user already has an embedded wallet or if they exit in the middle of the flow.

Parameters

options?: MouseEvent<any, any> | CreateWalletOptions

Returns

Promise<Wallet>

Promise for the Wallet object for the newly created Solana embedded wallet


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


ready

ready: boolean

Whether the wallets are ready to be used.


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.