Hooks
React hooks for interacting with smart wallets, reading state, and submitting transactions.
All hooks must be called inside a Provider component. They access shared wallet state and return reactive values that update automatically.
Hooks by Category
Session & Authentication
| Hook | Description |
|---|---|
useSession | Raw store selector for session state. |
useAccountSession | Returns the current session object or null. Recommended for most use cases. |
useLoadingStatus | Returns { isSessionLoading, sessionStatus } for loading indicators. |
useAddress | Returns the connected wallet address. |
useLogout | Returns { logout } function to end the session. |
useHydrated | Returns true once the session has been restored from storage. |
useRecoveryUserId | Returns the user ID used for key recovery. |
useHasServerVault | Returns whether the user has a server-side key vault. |
useLinkedProfiles | Returns linked social/email profiles for the account. |
Balance & Assets
| Hook | Description |
|---|---|
useBalance | Native wallet balance, fiat conversion, and rate info. |
useAssets | Full list of tracked token assets. |
useTokenInfo | Token metadata (name, symbol, decimals) for a given address. |
useTokenBalance | Balance of a specific ERC-20 token. |
Transactions
| Hook | Description |
|---|---|
useSendTransaction | Build and send a UserOperation (native, ERC-20, NFT). |
useUserOpStatus | Poll a UserOperation hash for confirmation state. |
useTransactions | Recent transaction history for the account. |
useSmartAccountTransactions | Transaction history scoped to the smart account. |
useErc3643Compliance | Check ERC-3643 compliance status for regulated tokens. |
External Wallet
| Hook | Description |
|---|---|
useWalletMode | Current wallet mode ('linked' or 'direct'). |
useDirectWallet | Access the direct (non-AA) external wallet. |
useSendDirectTransaction | Send a transaction directly from the external wallet. |
useTransferToLinkedWallet | Transfer assets from external wallet to the linked smart account. |
UI & Utilities
| Hook | Description |
|---|---|
useColorMode | Get and set the current color mode ('light' / 'dark'). |
useIsMobileView | Returns true when the viewport is mobile-sized. |
useActiveChainId | Returns the currently active chain ID. |
useOpenPage | Programmatically open internal UI pages (e.g., send, receive). |
useIFrameReady | Returns true when the secure MPC iframe is loaded. |
useError | Returns the latest error from the SDK. |
useNicknameResolve | Resolve a nickname to a wallet address. |
useProviderConfig | Read and update the Provider configuration at runtime. |
Quick Example
import {
useAccountSession,
useAddress,
useBalance,
useLoadingStatus,
} from '@embarkai/ui-kit'
function WalletInfo() {
const session = useAccountSession()
const address = useAddress()
const { walletBalance, fiatBalance, fiatSymbol } = useBalance()
const { isSessionLoading } = useLoadingStatus()
if (isSessionLoading) return <p>Loading...</p>
if (!session) return <p>Not connected</p>
return (
<div>
<p>Address: {address}</p>
<p>Balance: {walletBalance}</p>
<p>Value: {fiatSymbol}{fiatBalance}</p>
</div>
)
}Next Steps
- Session & Auth — session state, authentication, address, logout, key recovery
- Balance & Assets — native balances, fiat conversion, ERC-20 tokens
- Transactions — sending UserOperations, tracking status, history
- External Wallet — MetaMask/WalletConnect integration, direct transactions
- UI & Utilities — color mode, viewport, chain selection, error handling
- Components — pre-built UI components that use these hooks internally
Last updated on