Skip to Content
🌐 Frontend SDKHooksOverview

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

HookDescription
useSessionRaw store selector for session state.
useAccountSessionReturns the current session object or null. Recommended for most use cases.
useLoadingStatusReturns { isSessionLoading, sessionStatus } for loading indicators.
useAddressReturns the connected wallet address.
useLogoutReturns { logout } function to end the session.
useHydratedReturns true once the session has been restored from storage.
useRecoveryUserIdReturns the user ID used for key recovery.
useHasServerVaultReturns whether the user has a server-side key vault.
useLinkedProfilesReturns linked social/email profiles for the account.

Balance & Assets

HookDescription
useBalanceNative wallet balance, fiat conversion, and rate info.
useAssetsFull list of tracked token assets.
useTokenInfoToken metadata (name, symbol, decimals) for a given address.
useTokenBalanceBalance of a specific ERC-20 token.

Transactions

HookDescription
useSendTransactionBuild and send a UserOperation (native, ERC-20, NFT).
useUserOpStatusPoll a UserOperation hash for confirmation state.
useTransactionsRecent transaction history for the account.
useSmartAccountTransactionsTransaction history scoped to the smart account.
useErc3643ComplianceCheck ERC-3643 compliance status for regulated tokens.

External Wallet

HookDescription
useWalletModeCurrent wallet mode ('linked' or 'direct').
useDirectWalletAccess the direct (non-AA) external wallet.
useSendDirectTransactionSend a transaction directly from the external wallet.
useTransferToLinkedWalletTransfer assets from external wallet to the linked smart account.

UI & Utilities

HookDescription
useColorModeGet and set the current color mode ('light' / 'dark').
useIsMobileViewReturns true when the viewport is mobile-sized.
useActiveChainIdReturns the currently active chain ID.
useOpenPageProgrammatically open internal UI pages (e.g., send, receive).
useIFrameReadyReturns true when the secure MPC iframe is loaded.
useErrorReturns the latest error from the SDK.
useNicknameResolveResolve a nickname to a wallet address.
useProviderConfigRead 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