@coinbase/cdp-core
, these hooks offer a React-friendly interface for authentication and embedded wallet operations.
Available hooks
useSignInWithEmail
- Initiate email authentication flowuseVerifyEmailOTP
- Verify OTP code sent to emailuseSignInWithSms
- Initiate SMS authentication flowuseVerifySmsOTP
- Verify OTP code sent via SMSuseCurrentUser
- Get the current authenticated useruseIsSignedIn
- Check if user is signed inuseSignOut
- Sign out the current useruseGetAccessToken
- Retrieve the access token of the current useruseEvmAddress
- Get the primary EVM wallet addressuseSendEvmTransaction
- Send transactions on many EVM networks via CDPuseSignEvmTransaction
- Sign transactions for any EVM networkuseSignEvmMessage
- Sign plain text messagesuseSignEvmTypedData
- Sign EIP-712 typed datauseSignEvmHash
- Sign message hashesuseExportEvmAccount
- Export wallet private keyuseCurrentUser()
and read currentUser?.evmAccounts
.useSendUserOperation
- Submit ERC-4337 user operations (batch calls) with optional Paymaster gas sponsorshipuseEvmAddress()
returns the Smart Account if one exists; otherwise it returns the owner’s EOA.useIsInitialized
- Check if SDK is readyuseConfig
- Access CDP configurationcdp-hooks
installed:CDPHooksProvider
in your application:
"use client"
requirements and common gotchas.projectId
(required)createAccountOnLogin
= "evm-eoa" | "evm-smart"
(optional)basePath
(optional API base URL)useMock
(optional mock mode for local testing)debugging
(optional verbose API logging)flowId
flowId
, after which the user will be authenticated, returning a User objectdata
state with statuses idle | pending | success | error
that reflects the most recent transaction.
viem
to broadcast the transaction:
status
, data
, and error
from its internal tracking.
sendUserOperation
method, which you call with the transaction parameters that you want to send. The hook also returns status
, data
, and error
values which you can use to track the status of the user operation. For more information, see the Smart Accounts guide.