User wallet
The user wallet object represents the embedded wallet associated with the user. It contains essential information about the wallet:
- Account ID and wallet address uniquely identify the user's wallet
- Account type (e.g., Smart Account) specifies the wallet's capabilities
- Wagmi's
Connector
object details connection method and implementation - Tracks wallet status: active, available, connecting
- CreatedAt timestamp for wallet creation
- Recovery method used for wallet restoration
address
: The wallet address.connectorType
: The type of connector used (e.g., io.metamask, walletconnect).walletClientType
: The type of wallet client (e.g., injected, walletconnect).connector
: The connector object from wagmi.id
: Connector ID.recoveryMethod
: The recovery method used for wallet restoration. (e.g., RecoveryMethod.AUTOMATIC)isAvailable
: Indicates if the wallet is available. (if device has the wallet installed)isActive
: Indicates if the wallet is currently active.isConnecting
: Indicates if the wallet is currently connecting.accountId
: The account ID associated with the wallet. (e.g., acc_d597d55d-...), only for openfort embedded wallets.accountType
: The account type (e.g., Smart Account).ownerAddress
: The owner's address associated with the wallet.implementationType
: The implementation type of the wallet (e.g., Upgradeable_v05).createdAt
: The timestamp for wallet creation.salt
: The salt used for wallet encryption.
Example usage
The hook useWallets
provides access to the user wallet object.
import React from "react";
import { useWallets } from "@openfort/react";
const MyComponent = () => {
const { activeWallet, wallets } = useWallets();
return (
<div>
<h1>User Wallet</h1>
<p>Address: {activeWallet?.address}</p>
<p>Account ID: {activeWallet?.accountId}</p>
<p>Created At: {activeWallet?.createdAt}</p>
<h2>All Wallets</h2>
<ul>
{wallets.map((wallet) => (
<li key={wallet.address}>
{wallet.address} - {wallet.isActive ? "Active" : "Inactive"}
</li>
))}
</ul>
</div>
);
};