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.
requireActiveChainIdNon-hook helper: reads the active chainId from the session store synchronously or throws. Useful in event handlers.
waitForStoreHydrationNon-hook helper: returns a Promise<void> that resolves once the session store has rehydrated from storage. Useful before calling imperative APIs on page load.

Balance & Assets

HookDescription
useBalanceNative wallet balance, fiat conversion, and rate info.
useAssetsNative balance plus tracked ERC-20 assets, with refresh.
useTokenInfo{ isLoading, tokenInfo } for a token address.
useTokenBalance{ balance, formattedBalance, refetch } for one ERC-20 token.
useBlockscoutAssetsFull token + NFT portfolio from Blockscout indexer (richer than useAssets).

Transactions

HookDescription
useSendTransactionBuild and send a UserOperation (native, ERC-20, NFT).
useUserOpStatusPoll a UserOperation hash for confirmation state.
useTransactionsHelper functions for reading transactions and history via viem.
useSmartAccountTransactionsHelper functions for reading a smart account’s UserOperations.
useErc3643ComplianceCheck ERC-3643 compliance status for regulated tokens.

External Wallet

HookDescription
useWalletMode{ configMode, activeMode, switchMode, isDirect }.
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.
useOpenPage{ open, close, isOpen } for the built-in UI pages (PageKey).
useIFrameReadyReturns true when the secure MPC iframe is loaded.
useErrorLatest SDK error message as a string.
useNicknameResolveResolve a nickname to a wallet on a chain.
useProviderConfigRead and update the Provider configuration at runtime.
looksLikeNicknameNon-hook helper: returns true if a string looks like a nickname (vs. an address). Handy for input validation before calling useNicknameResolve.
wagmiConfigPre-built wagmi config used internally by Provider. Exported for apps that need to share the same wagmi instance.
getExplorerUrlNon-hook helper: returns the block explorer URL for the active chain.

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.formatted} {walletBalance.symbol}</p> <p>Value: {fiatSymbol}{fiatBalance.toFixed(2)}</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