Manage wallets
Guide users through wallet management with Openfort’s React hooks and UI. Options include:
- Embedded wallet creation during onboarding
- Connecting existing wallets using password or automatic recovery
- Handling wallet activation and switching
Creating a new embedded wallet
To create a new embedded wallet, you can use the useWallets
hook. This hook provides methods to create and manage wallets securely.
import { useWallets } from "@openfort/react"
function SampleComponent() {
const {
createWallet,
} = useWallets()
// ...
}
Using an embedded wallet
To use an embedded wallet, you can access it through the useWallet
hook. This hook provides the current active wallet and methods to manage it.
First we need to list what wallets are linked to the user, then we can use setActiveWallet to set the active wallet.
import { useWallets } from "@openfort/react"
function SampleComponent() {
const {
wallets,
setActiveWallet,
} = useWallets()
// ...
}