@coinbase/cdp-core
and @coinbase/cdp-hooks
installedCDPHooksProvider
to create a smart account for new users on sign in.
createAccountOnLogin
is set to "evm-smart"
, new users receive both an EOA and a smart account.basePath
(API base URL override)useMock
(local mock mode)debugging
(verbose logging)useCurrentUser
to access the authenticated user’s accounts. The first smart account is available as currentUser.evmSmartAccounts?.[0]
.
useEvmAddress()
to get the primary EVM address; it returns the smart account if one exists, otherwise the EOA.
useSendUserOperation
to submit one or more calls. This hook returns status
, data
, and error
values which you can use to track the status of the user operation.
useCdpPaymaster: true
(uses the CDP Paymaster on Base) or provide a custom paymasterUrl
.calls
to batch actions in a single user operation. Calls execute in order and revert atomically on failure.
data
using an ABI-encoded payload. This example encodes an ERC-20 transfer
using viem
:
paymasterUrl
to sendUserOperation
useCdpPaymaster: true
to use the CDP PaymasterResource | Description |
---|---|
useCurrentUser | Get the current authenticated user |
useEvmAddress | Primary EVM address (Smart Account if present, else EOA) |
useSendUserOperation | Send a user operation; hook returns status/data |
sendUserOperationOptions | Options for sending a user operation |
sendUserOperationResult | Result fields for sendUserOperation |
createAccountOnLogin | Config: “evm-eoa” or “evm-smart” |
User type | user.evmAccounts[] , user.evmSmartAccounts[] |
Hooks README | Package overview and usage |