You’re viewing the 2.0 (LTS) docs. View the current 3.0 version of this page.
useWalletState hook provides methods to get and set the currently selected wallet, which is used as the default for signing operations.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Hook for managing the currently selected wallet
useWalletState hook provides methods to get and set the currently selected wallet, which is used as the default for signing operations.
import { useWalletState } from "@getpara/react-sdk";
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>
);
}