Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.getpara.com/llms.txt

Use this file to discover all available pages before exploring further.

The useWalletState hook provides methods to get and set the currently selected wallet, which is used as the default for signing operations.

Import

import { useWalletState } from "@getpara/react-sdk";

Usage

function WalletSelector() {
  const { selectedWallet, setSelectedWallet, updateSelectedWallet } = useWalletState();
  const { data: account } = useAccount();

  const handleWalletChange = (walletId: string, walletType: TWalletType) => {
    setSelectedWallet({ id: walletId, type: walletType });
  };

  return (
    <div>
      <p>Current Wallet ID: {selectedWallet.id || "None"}</p>
      <p>Current Wallet Type: {selectedWallet.type || "None"}</p>

      {account?.wallets.map((wallet) => (
        <button
          key={wallet.id}
          onClick={() => handleWalletChange(wallet.id, wallet.type)}
          style={{
            fontWeight: selectedWallet.id === wallet.id ? "bold" : "normal"
          }}
        >
          Select {wallet.type} Wallet
        </button>
      ))}
    </div>
  );
}