Skip to content

User wallet

The UserWallet object represents the embedded wallet associated with a user.
It provides the essential information and methods needed to interact with the wallet:

  • Wallet address and optional owner address
  • Implementation type (e.g., Upgradeable contract versions)
  • Chain type for the wallet (e.g., EVM chains)
  • Tracks wallet status: active, connecting
  • A method to obtain the provider for direct interactions
Properties:
  • address: The wallet address. (Hex)
  • ownerAddress?: The owner's address associated with the wallet (optional).
  • implementationType?: The implementation type of the wallet (e.g., Upgradeable_v05).
  • chainType: The chain type enum specifying the wallet's blockchain.
  • isActive?: Indicates if the wallet is currently active.
  • isConnecting?: Indicates if the wallet is currently connecting.
  • getProvider: Function returning a Promise<OpenfortEmbeddedEthereumWalletProvider> to interact with the embedded wallet.

Example usage

The useWallets hook provides access to the user wallet object:

import React from "react";
import { useWallets } from "@openfort/react-native";
 
const MyComponent = () => {
  const { activeWallet, wallets } = useWallets();
 
  return (
    <div>
      <h1>User Wallet</h1>
      <p>Address: {activeWallet?.address}</p>
      <h2>All Wallets</h2>
      <ul>
        {wallets.map((wallet) => (
          <li key={wallet.address}>
            {wallet.address} - {wallet.isActive ? "Active" : "Inactive"}
          </li>
        ))}
      </ul>
    </div>
  );
};