@dynamic-labs-sdk/react-hooks is listed here, grouped by category. All hooks require a QueryClientProvider and a DynamicProvider ancestor. Mount QueryClientProvider outside DynamicProvider.
The JavaScript SDK is headless: there is no built-in modal, wallet picker, or
login form. You build all UI yourself. See
Building UI for details.
New to the hooks? Read How React Hooks Work first. It covers the naming rule, which functions get a hook, and the three shapes (query, mutation, state).
- Hook: the import name from
@dynamic-labs-sdk/react-hooks - Wraps: the client function from
@dynamic-labs-sdk/client - Shape:
query(async read, returns{ data, isLoading, error, refetch }),mutation(async action, returns{ mutate, isPending, error, data }), orstate(reactive value, returns{ data, isLoading, error, refetch })
State hooks
State hooks subscribe to reactive client state and re-render when it changes. They take no arguments and return the TanStack Query result; destructuredata to get the value.
| Hook | Value on data | Re-renders when |
|---|---|---|
useUser | Current authenticated user, or null | Sign-in, sign-out, profile update |
useGetWalletAccounts | All wallet accounts (verified + unverified) | Connect, disconnect, verify |
useGetUserSocialAccounts | Linked social accounts (SocialAccount[]) | User changes |
useGetAvailableWalletProvidersData | Connectable wallet providers (WalletProviderData[]) | Network switch, provider changes |
useInitStatus | 'uninitialized' | 'in-progress' | 'finished' | 'failed' | Initialization progress |
useSessionExpiresAt | Session expiration Date, or null | Session updates |
useIsDeviceRegistrationRequired | Whether this device still needs MFA device registration. | User, MFA, device changes |
useIsPendingRecoveryCodesAcknowledgment | Whether the user must acknowledge their MFA recovery codes. | User, MFA changes |
useIsUserMissingMfaAuth | Whether the user still needs to complete an MFA challenge. | User, MFA changes |
useIsUserOnboardingComplete | Whether the user has completed all onboarding requirements. | User, onboarding changes |
import { useUser, useGetWalletAccounts } from '@dynamic-labs-sdk/react-hooks';
const { data: user } = useUser();
const { data: walletAccounts = [] } = useGetWalletAccounts();
Event hooks
Event hooks subscribe to client events for a component’s lifetime. They auto-unsubscribe on unmount, no manualoffEvent cleanup needed.
| Hook | Description |
|---|---|
useOnEvent | Subscribe to any client event. Re-subscribes when event changes; listener identity changes do not re-subscribe (ref-wrapped). |
useOnceEvent | Like useOnEvent, but fires at most once per mount. |
useOnWalletProviderEvent | Subscribe to events on a specific wallet provider (e.g. accountsChanged, networkChanged). |
import { useOnEvent } from '@dynamic-labs-sdk/react-hooks';
useOnEvent({
event: 'walletAccountsChanged',
listener: ({ walletAccounts }) => console.log(walletAccounts),
});
import { useOnceEvent } from '@dynamic-labs-sdk/react-hooks';
useOnceEvent({
event: 'logout',
listener: () => console.log('user logged out'),
});
import { useOnWalletProviderEvent } from '@dynamic-labs-sdk/react-hooks';
useOnWalletProviderEvent({
event: 'networkChanged',
walletProviderKey: 'metamask',
callback: ({ networkId }) => console.log('network:', networkId),
});
Context
| Hook / Component | Description |
|---|---|
DynamicProvider | React context provider. Wraps your app and supplies the client instance to all hooks. Requires an outer QueryClientProvider. |
useDynamicClient | Returns the DynamicClient from context. Use for one-shot direct client calls inside handlers. |
Query hooks
Query hooks wrap async read functions. They fetch on mount and return{ data, isLoading, isFetching, error, refetch }. Arguments that accept undefined are pseudo-required: the hook stays disabled until a real value is passed.
Pass queryParams to override TanStack Query options (staleTime, refetchInterval, enabled, etc.).
Wallets & balances
| Hook | Wraps | Description |
|---|---|---|
useGetNativeBalance | getNativeBalance | Native token balance for a wallet account. |
useGetBalanceForAddress | getBalanceForAddress | Balance for a specific address string. |
useGetTokenBalances | getTokenBalances | ERC-20 / SPL token balances for a wallet. |
useGetMultichainTokenBalances | getMultichainTokenBalances | Token balances across all connected chains. |
useGetActiveNetworkData | getActiveNetworkData | Active network metadata (chain ID, name, RPC URL). |
useGetActiveNetworkId | getActiveNetworkId | Active network chain ID. |
useGetNetworksData | getNetworksData | Metadata for every network available to the wallet. |
useGetConnectedAddresses | getConnectedAddresses | All addresses the user has connected. |
useGetWalletOptionsCatalogue | getWalletOptionsCatalogue | Full wallet picker catalog (grouped by category). |
useGetWalletConnectCatalog | getWalletConnectCatalog | WalletConnect-compatible wallets from the registry. |
useGetWalletConnectCatalogWalletByWalletProviderKey | getWalletConnectCatalogWalletByWalletProviderKey | Single WalletConnect wallet entry by provider key. |
useGetWalletProviderDataByKey | getWalletProviderDataByKey | Wallet provider data for a single provider key. |
import { useGetNativeBalance } from '@dynamic-labs-sdk/react-hooks';
function Balance({ walletAccount }) {
const { data, isLoading } = useGetNativeBalance({ walletAccount });
if (isLoading) return <p>Loading...</p>;
return <p>{data?.balance ?? '0'}</p>;
}
Authentication & security
| Hook | Wraps | Description |
|---|---|---|
useCheckStepUpAuth | checkStepUpAuth | Whether a step-up auth token is valid for a given scope. |
useIsMfaRequiredForAction | isMfaRequiredForAction | Whether MFA is required before performing a specific action. |
useGetMfaDevices | getMfaDevices | User’s registered MFA devices. |
useGetMfaMethods | getMfaMethods | Available MFA method types for the current user. |
useGetMfaRecoveryCodes | getMfaRecoveryCodes | User’s active recovery codes. |
useGetPasskeys | getPasskeys | User’s registered passkeys. |
useGetRegisteredDevices | getRegisteredDevices | User’s registered (trusted) devices. |
useGetGoogleDriveBackupReadiness | getGoogleDriveBackupReadiness | Whether the user’s Google OAuth scopes allow Drive key backup. |
useDetectSocialRedirectUrl | detectSocialRedirectUrl | Detect whether the current URL is a social OAuth redirect. |
Fireblocks Flow & swaps
| Hook | Wraps | Description |
|---|---|---|
useGetFlow | getFlow | Fetch a Flow by ID. Pass queryParams.refetchInterval for polling. |
useGetFlowQuote | getFlowQuote | Get a price quote for a Flow. |
useGetSwapQuote | getSwapQuote | Get a quote for a token swap. |
useGetSwapStatus | getSwapStatus | Poll the status of an in-flight swap. |
useGetTransactionHistory | getTransactionHistory | Transaction history for a wallet account. |
import { useGetFlow } from '@dynamic-labs-sdk/react-hooks';
function FlowStatus({ flowId }) {
const { data: flow, isLoading } = useGetFlow({
flowId,
queryParams: { refetchInterval: 3000 },
});
if (isLoading) return <p>Loading flow...</p>;
return <p>Execution state: {flow?.executionState}</p>;
}
Earn
Vault actions (below, under Mutation hooks) are EVM-only today; these reads are not chain-restricted.| Hook | Wraps | Description |
|---|---|---|
useListYieldVaults | listYieldVaults | List the Earn vaults available to the current environment. |
useGetYieldDetails | getYieldDetails | Full details for one Earn vault, including assetDecimals. |
useGetYieldPosition | getYieldPosition | A wallet account’s share balance and asset value in an Earn vault. |
useGetYieldPerformance | getYieldPerformance | A wallet account’s earnings and return on capital in an Earn vault. |
useGetYieldEarnings | getYieldEarnings | A wallet account’s earnings across all Earn vaults on a chain. |
useGetYieldRewards | getYieldRewards | A wallet account’s accrued rewards in an Earn vault. |
useGetYieldPosition, useGetYieldPerformance, useGetYieldEarnings, and useGetYieldRewards are pseudo-required on walletAccount: they stay disabled until it’s defined. useGetYieldEarnings also requires a chainId, since earnings are aggregated per chain.
import { useGetYieldDetails } from '@dynamic-labs-sdk/react-hooks';
function VaultCard({ vaultId }: { vaultId: string }) {
const { data: details } = useGetYieldDetails({ vaultId });
return <p>{details?.assetSymbol} — APY: {details?.netApy ?? 'n/a'}</p>;
}
Funding
| Hook | Wraps | Description |
|---|---|---|
useGetCoinbaseAccounts | getCoinbaseAccounts | User’s linked Coinbase exchange accounts. |
useGetCoinbaseBuyUrl | getCoinbaseBuyUrl | Generate a Coinbase onramp buy URL. |
useGetKrakenAccounts | getKrakenAccounts | User’s linked Kraken exchange accounts. |
useGetKrakenWhitelistedAddresses | getKrakenWhitelistedAddresses | Kraken whitelisted withdrawal addresses. |
useGetMoonPayCurrencies | getMoonPayCurrencies | Currencies supported by MoonPay. |
useGetMoonPayUrl | getMoonPayUrl | Generate a MoonPay purchase URL. |
Business accounts
| Hook | Wraps | Description |
|---|---|---|
useGetBusinessAccount | getBusinessAccount | Fetch one business account. |
useListBusinessAccounts | listBusinessAccounts | List business accounts for the current user. |
useGetBusinessAccountGovernance | getBusinessAccountGovernance | Fetch a business account’s governance settings. |
useListBusinessAccountRoles | listBusinessAccountRoles | List a business account’s custom roles. |
useListBusinessAccountProposals | listBusinessAccountProposals | List a business account’s proposals. |
useListBusinessAccountProposalsAwaitingMyApproval | listBusinessAccountProposalsAwaitingMyApproval | List proposals awaiting the current signer’s approval. |
useGetPolicy | getPolicy | Fetch a policy by id. |
useGetWalletPolicyLayer | getWalletPolicyLayer | Fetch the policy layer for a wallet. |
useGetSignerPolicyLayer | getSignerPolicyLayer | Fetch the policy layer for a signer. |
useGetAccountPolicyLayer | getAccountPolicyLayer | Fetch the policy layer for a business account. |
WaaS
| Hook | Wraps | Description |
|---|---|---|
useGetWalletRecoveryState | getWalletRecoveryState | Recovery state of an embedded wallet account. |
Mutation hooks
Mutation hooks wrap async write functions. They do not run on mount. Callmutate(args) to trigger. Returns { mutate, isPending, data, error, reset }.
Pass mutateParams to set TanStack Query mutation options (onSuccess, onError, retry, etc.).
Authentication
| Hook | Wraps | Description |
|---|---|---|
useSendEmailOTP | sendEmailOTP | Send a one-time password to an email address. |
useSendSmsOTP | sendSmsOTP | Send a one-time password via SMS. |
useVerifyOTP | verifyOTP | Verify a one-time password (email or SMS). |
useSignInWithPasskey | signInWithPasskey | Sign in using a passkey. |
useSignInWithExternalJwt | signInWithExternalJwt | Sign in with an external JWT from a custom auth provider. |
useSignInWithSocialPopUp | signInWithSocialPopUp | Sign in via a social provider in a popup window. |
useSignInWithSocialRedirect | signInWithSocialRedirect | Sign in via a social provider using a full-page redirect. |
useCompleteSocialRedirect | completeSocialRedirect | Complete a social redirect after the provider callback. |
useCompleteDeviceRegistration | completeDeviceRegistration | Complete a device registration flow. |
useLogout | logout | Log the current user out. |
useRefreshAuth | refreshAuth | Refresh the authentication token. |
useRequestExternalAuthElevatedToken | requestExternalAuthElevatedToken | Request a step-up auth token for sensitive operations. |
import { useSendEmailOTP, useVerifyOTP } from '@dynamic-labs-sdk/react-hooks';
function EmailLogin() {
const { mutate: sendOtp, data: otpVerification } = useSendEmailOTP();
const { mutate: verifyOtp } = useVerifyOTP();
return (
<>
<button onClick={() => sendOtp({ email: 'user@example.com' })}>
Send code
</button>
{otpVerification && (
<button
onClick={() =>
verifyOtp({ otpVerification, verificationToken: '123456' })
}
>
Verify
</button>
)}
</>
);
}
MFA
| Hook | Wraps | Description |
|---|---|---|
useRegisterTotpMfaDevice | registerTotpMfaDevice | Register a new TOTP MFA device. Returns the QR code URI in data. |
useAuthenticateTotpMfaDevice | authenticateTotpMfaDevice | Authenticate with a TOTP code. |
useDeleteMfaDevice | deleteMfaDevice | Delete an MFA device. |
useSetDefaultMfaDevice | setDefaultMfaDevice | Set a device as the default MFA method. |
useAuthenticateMfaRecoveryCode | authenticateMfaRecoveryCode | Authenticate using a recovery code. |
useCreateNewMfaRecoveryCodes | createNewMfaRecoveryCodes | Generate a new set of recovery codes. |
useAcknowledgeRecoveryCodes | acknowledgeRecoveryCodes | Acknowledge that recovery codes have been saved. |
useAuthenticatePasskeyMFA | authenticatePasskeyMFA | Authenticate with a passkey as MFA. |
useRegisterPasskey | registerPasskey | Register a new passkey. |
useDeletePasskey | deletePasskey | Delete a passkey. |
Wallets
| Hook | Wraps | Description |
|---|---|---|
useConnectWalletOption | connectWalletOption | Connect a wallet by its catalogue key. |
useConnectWithWalletProvider | connectWithWalletProvider | Connect a wallet using a specific provider. |
useConnectAndVerifyWithWalletProvider | connectAndVerifyWithWalletProvider | Connect and verify (SIWE) a wallet in one step. |
useVerifyWalletAccount | verifyWalletAccount | Verify ownership of a connected wallet account. |
useRemoveWalletAccount | removeWalletAccount | Remove a wallet account from the session. |
useTransferWalletAccount | transferWalletAccount | Transfer a wallet account to another user. |
useProveWalletAccountOwnership | proveWalletAccountOwnership | Prove wallet ownership via signature without full verification. |
useAssertWalletAccountSigningAvailability | assertWalletAccountSigningAvailability | Assert that a wallet account can sign (throws if not). |
useSignMessage | signMessage | Sign an arbitrary message with a wallet. |
useAddNetwork | addNetwork | Add a network to the wallet provider. |
useSwitchActiveNetwork | switchActiveNetwork | Switch the wallet’s active network. |
useRevokeRegisteredDevice | revokeRegisteredDevice | Revoke a single registered device. |
useRevokeAllRegisteredDevices | revokeAllRegisteredDevices | Revoke all registered devices. |
useScreenTransaction | screenTransaction | Screen a transaction’s destination before signing. |
useRedirectToInAppBrowser | redirectToInAppBrowser | Open your app inside a wallet’s in-app browser. |
import { useSignMessage } from '@dynamic-labs-sdk/react-hooks';
function SignButton({ walletAccount }) {
const { mutate: sign, data, isPending } = useSignMessage();
return (
<button
onClick={() => sign({ walletAccount, message: 'gm' })}
disabled={isPending}
>
{isPending ? 'Signing...' : 'Sign'}
</button>
);
}
User management
| Hook | Wraps | Description |
|---|---|---|
useUpdateUser | updateUser | Update the current user’s profile. |
useDeleteUser | deleteUser | Delete the current user’s account. |
useUnlinkSocialAccount | unlinkSocialAccount | Unlink a social account from the user. |
useMergeUserAccounts | mergeUserAccounts | Merge two user accounts. |
Fireblocks Flow
| Hook | Wraps | Description |
|---|---|---|
useAttachFlowSource | attachFlowSource | Attach a funding source to a Flow. |
useBroadcastFlow | broadcastFlow | Broadcast a signed Flow transaction on-chain. |
useCancelFlow | cancelFlow | Cancel an in-progress Flow. |
usePrepareFlowSigning | prepareFlowSigning | Prepare a Flow for signing (returns the transaction to sign). |
useSubmitFlowTransaction | submitFlowTransaction | Submit a signed transaction back to the Flow. |
useConfirmTransaction | confirmTransaction | Confirm a pending transaction. |
useTransferAmount | transferAmount | Transfer an amount of a token to an address. |
useExecuteSwapTransaction | executeSwapTransaction | Execute a swap transaction. |
import { useAttachFlowSource, useGetFlowQuote } from '@dynamic-labs-sdk/react-hooks';
function FlowSetup({ flowId, walletAccount }) {
const { mutate: attachSource } = useAttachFlowSource();
const { mutate: getFlowQuote } = useGetFlowQuote();
const payWithWallet = () => {
attachSource(
{
flowId,
fromAddress: walletAccount.address,
fromChainName: walletAccount.chain,
sourceType: 'wallet',
},
{ onSuccess: () => getFlowQuote({ flowId }) }
);
};
return <button onClick={payWithWallet}>Pay with wallet</button>;
}
Earn
EVM-only today: calling these with a non-EVMwalletAccount throws WalletProviderMethodUnavailableError.
| Hook | Wraps | Description |
|---|---|---|
useDepositToYieldVault | depositToYieldVault | Deposit into an Earn vault. Signs an approval first when needed. |
useWithdrawFromYieldVault | withdrawFromYieldVault | Withdraw from an Earn vault. Never needs an approval. |
useClaimYieldRewards | claimYieldRewards | Claim a wallet account’s accrued rewards in an Earn vault. |
useDepositToYieldVault and useWithdrawFromYieldVault invalidate useGetYieldPosition on success; useClaimYieldRewards invalidates useGetYieldRewards. Treat these as nudges; the transaction is broadcast, not necessarily mined, when the mutation resolves.
import { useDepositToYieldVault } from '@dynamic-labs-sdk/react-hooks';
function DepositButton({ vaultId, walletAccount, amount }) {
const { mutate: deposit, isPending } = useDepositToYieldVault();
return (
<button
onClick={() => deposit({ vaultId, walletAccount, amount })}
disabled={isPending}
>
Deposit
</button>
);
}
Funding
| Hook | Wraps | Description |
|---|---|---|
useCreateCoinbaseOnrampOrder | createCoinbaseOnrampOrder | Create a Coinbase onramp purchase order. |
useAddCoinbaseOnrampOrderEventListener | addCoinbaseOnrampOrderEventListener | Listen for Coinbase onramp order status updates. |
useCreateCoinbaseExchangeTransfer | createCoinbaseExchangeTransfer | Initiate a transfer from a Coinbase account. |
useCreateCryptoDotComPayment | createCryptoDotComPayment | Create a Crypto.com payment session. |
useCreateKrakenExchangeTransfer | createKrakenExchangeTransfer | Initiate a transfer from a Kraken account. |
Business accounts
| Hook | Wraps | Description |
|---|---|---|
useCreateBusinessAccount | createBusinessAccount | Create a new business account. |
useUpdateBusinessAccount | updateBusinessAccount | Update a business account. |
useTransferBusinessAccountOwnership | transferBusinessAccountOwnership | Transfer ownership of a business account. |
useAddBusinessAccountMember | addBusinessAccountMember | Add a member to a business account. |
useRemoveBusinessAccountMember | removeBusinessAccountMember | Remove a member from a business account. |
useUpdateBusinessAccountMemberRole | updateBusinessAccountMemberRole | Update a member’s role in a business account. |
useAddBusinessAccountSigner | addBusinessAccountSigner | Add a signer to a business account. |
useRemoveBusinessAccountSigner | removeBusinessAccountSigner | Remove a signer from a business account. |
useAddWalletToBusinessAccount | addWalletToBusinessAccount | Add an existing wallet to a business account. |
useRemoveBusinessAccountWallet | removeBusinessAccountWallet | Remove a wallet from a business account. |
useCreateWalletForBusinessAccount | createWalletForBusinessAccount | Create a wallet inside a business account. |
useApproveBusinessAccountProposal | approveBusinessAccountProposal | Approve a business account proposal. |
useVetoBusinessAccountProposal | vetoBusinessAccountProposal | Veto a business account proposal. |
useWithdrawBusinessAccountProposalApproval | withdrawBusinessAccountProposalApproval | Withdraw your approval from a proposal. |
useExecuteBusinessAccountProposal | executeBusinessAccountProposal | Execute an approved business account proposal. |
useSignAddBusinessAccountMemberIntent | signAddBusinessAccountMemberIntent | Sign the intent for adding a member. |
useSignRemoveBusinessAccountMemberIntent | signRemoveBusinessAccountMemberIntent | Sign the intent for removing a member. |
useSignUpdateBusinessAccountMemberRoleIntent | signUpdateBusinessAccountMemberRoleIntent | Sign the intent for changing a member’s role. |
useSignRemoveBusinessAccountWalletIntent | signRemoveBusinessAccountWalletIntent | Sign the intent for removing a wallet. |
useSignDefineBusinessAccountRoleIntent | signDefineBusinessAccountRoleIntent | Sign the intent for defining a custom role. |
useSignDeleteBusinessAccountRoleIntent | signDeleteBusinessAccountRoleIntent | Sign the intent for deleting a custom role. |
useSignSetBusinessAccountGovernanceIntent | signSetBusinessAccountGovernanceIntent | Sign the intent for updating governance settings. |
useSignTransferBusinessAccountOwnershipIntent | signTransferBusinessAccountOwnershipIntent | Sign the intent for transferring ownership. |
useSetBusinessAccountGovernance | setBusinessAccountGovernance | Update a business account’s governance settings. |
useDefineBusinessAccountRole | defineBusinessAccountRole | Define a custom role on a business account. |
useDeleteBusinessAccountRole | deleteBusinessAccountRole | Delete a custom role from a business account. |
useCreatePolicy | createPolicy | Create a policy. |
useUpsertWalletPolicyRule | upsertWalletPolicyRule | Add or update a rule on a wallet policy layer. |
useUpsertSignerPolicyRule | upsertSignerPolicyRule | Add or update a rule on a signer policy layer. |
useUpsertAccountPolicyRule | upsertAccountPolicyRule | Add or update a rule on a business account policy layer. |
useRemoveWalletPolicyRule | removeWalletPolicyRule | Remove a rule from a wallet policy layer. |
useRemoveSignerPolicyRule | removeSignerPolicyRule | Remove a rule from a signer policy layer. |
useRemoveAccountPolicyRule | removeAccountPolicyRule | Remove a rule from a business account policy layer. |
useRemovePolicyRules | removePolicyRules | Remove rules from a policy. |
WaaS
| Hook | Wraps | Description |
|---|---|---|
useCreateWaasWalletAccounts | createWaasWalletAccounts | Create embedded wallet accounts. |
useUnlockWallet | unlockWallet | Unlock an embedded wallet. |
useSetWaasWalletAccountPassword | setWaasWalletAccountPassword | Set the password for an embedded wallet account. |
useUpdateWaasPassword | updateWaasPassword | Update the password for an embedded wallet. |
useBackupWaasKeySharesToGoogleDrive | backupWaasKeySharesToGoogleDrive | Back up embedded wallet key shares to Google Drive. |
useExportWaasClientKeyshares | exportWaasClientKeyshares | Export embedded wallet client key shares. |
useExportWaasPrivateKey | exportWaasPrivateKey | Export an embedded wallet private key. |
useImportWaasPrivateKey | importWaasPrivateKey | Import a private key into an embedded wallet. |
useCreateWaasOfflineRecoveryShares | createWaasOfflineRecoveryShares | Create offline recovery shares for an embedded wallet. |
useRefreshWaasWalletAccountShares | refreshWaasWalletAccountShares | Refresh embedded wallet account shares. |
useDelegateWaasKeyShares | delegateWaasKeyShares | Delegate embedded wallet key shares. |
useRevokeWaasDelegation | revokeWaasDelegation | Revoke a key share delegation. |
useMigrateFromFireblocks | migrateFromFireblocks | Migrate a Fireblocks wallet into an embedded wallet. |
useSignSerializedTransaction | signSerializedTransaction | Sign a raw serialized transaction with an embedded wallet. |
TypeScript
Every hook with parameters exports aUseXParams type alongside the hook:
import {
useSignMessage,
type UseSignMessageParams,
} from '@dynamic-labs-sdk/react-hooks';
const config: UseSignMessageParams = {
mutateParams: {
onSuccess: ({ signature }) => console.log(signature),
},
};
const { mutate } = useSignMessage(config);
Related
- How React Hooks Work: naming rule, shapes, when to use a hook vs. a direct call
- React Hooks reference: setup (
QueryClientProvider+DynamicProvider), state hooks,useOnEvent - React Quickstart (JS SDK)
- Events Catalog