@coinbase/cdp-core
, it offers a React-friendly interface for end user authentication
and embedded wallet operations.
http://localhost:3000
createAccountOnLogin
is set to "evm-smart"
, new users will automatically get both an EOA and a Smart Account.flowId
flowId
, after which the user will be authenticated, returning a User object.viem
to broadcast the transaction.
status
, data
, and error
properties to read the result of the user operation:
useWaitForUserOperation
hook to poll for user operation status and provide real-time updates. This hook immediately fires off a query to get the result of the user operation:
useWaitForUserOperation
hook should start polling using the enabled
parameter:
object
object
object
Parameter | Type |
---|---|
options | SignInWithEmailOptions |
Promise
<SignInWithEmailResult
>
object
Parameter | Type |
---|---|
options | SignInWithSmsOptions |
Promise
<SignInWithSmsResult
>
object
Parameter | Type |
---|---|
options | VerifyEmailOTPOptions |
Promise
<VerifyEmailOTPResult
>
object
Parameter | Type |
---|---|
options | VerifySmsOTPOptions |
Promise
<VerifySmsOTPResult
>
object
object
object
Promise
<void
>
object
Function to get the access token for the current user
Promise
<null
| string
>
object
object
Parameter | Type |
---|---|
options | SignEvmHashOptions |
Promise
<SignEvmHashResult
>
object
Parameter | Type |
---|---|
options | SignEvmTransactionOptions |
Promise
<SignEvmTransactionResult
>
data
discriminated union object.
Note: The data
returned from the hook only represents the last sent transaction. If you wish to
call one instance of the hook multiple times in quick succession it is recommended to save the
txHash returned from sendEvmTransaction
yourself and handle waiting for the receipt.
object
Parameter | Type |
---|---|
options | SendEvmTransactionOptions |
Promise
<SendEvmTransactionResult
>
object
Parameter | Type |
---|---|
options | SignEvmMessageOptions |
Promise
<SignEvmMessageResult
>
object
Parameter | Type |
---|---|
options | SignEvmTypedDataOptions |
Promise
<SignEvmTypedDataResult
>
object
Parameter | Type |
---|---|
options | ExportEvmAccountOptions |
Promise
<ExportEvmAccountResult
>
Type Parameter | Description |
---|---|
TArgs extends unknown [] | Array type representing the arguments of the callback |
TReturn | Type representing the return value of the callback |
Parameter | Type | Description |
---|---|---|
callback | (…args ) => Promise <TReturn > | The async function to wrap with authentication check |
Parameter | Type |
---|---|
…args | TArgs |
Promise
<TReturn
>
Type Parameter | Description |
---|---|
TArgs extends unknown [] | Array type representing the arguments of the callback |
TReturn | Type representing the return value of the callback |
Parameter | Type | Description |
---|---|---|
callback | (…args ) => Promise <TReturn > | The async function to wrap with authentication check |
Parameter | Type |
---|---|
…args | TArgs |
Promise
<TReturn
>
data
discriminated union object.
Note: The data
returned from the hook only represents the last sent user operation. If you wish to
call one instance of the hook multiple times in quick succession it is recommended to save the
userOperationHash returned from sendUserOperation
yourself and handle waiting for the result.
UseSendUserOperationReturnType
data
returned from the hook only represents the last sent user operation. If you wish to
call one instance of the hook multiple times in quick succession it is recommended to save the
userOpHash returned from waitForUserOperation
yourself and handle waiting for the result.
Parameter | Type | Description |
---|---|---|
parameters | UseWaitForUserOperationParameters | Configuration object for waiting for user operation |
UseWaitForUserOperationReturnType
Query result with data, loading state, and error information
Parameter | Type | Description |
---|---|---|
props | CDPHooksProviderProps | The component props |
Element
A React context provider wrapping the children with CDP functionality
Error
Parameter | Type |
---|---|
statusCode | number |
errorType | APIErrorType |
errorMessage | string |
correlationId? | string |
errorLink? | string |
cause? | Error |
APIError
object
Property | Type |
---|---|
statusCode | number |
errorType | APIErrorType |
errorMessage | string |
correlationId? | string |
errorLink? | string |
Property | Type | Description |
---|---|---|
children | ReactNode | React children to be rendered within the provider |
config | Config | Configuration object for initializing the CDP SDK |
Property | Type | Description |
---|---|---|
isInitialized | boolean | Whether the CDP SDK has completed initialization |
currentUser | null | User | The currently authenticated user, or null if not signed in |
isSignedIn | boolean | Convenience boolean indicating if there is an authenticated user |
config | Config | The CDP config |
Property | Type |
---|---|
domain | EIP712Domain |
types | EIP712Types |
primaryType | string |
message | EIP712Message |
http()
transport is used.
useSendUserOperation
hook.
Property | Type |
---|---|
sendUserOperation | (options ) => Promise <SendUserOperationResult > |
data | | GetUserOperationResult | undefined |
error | Error | undefined |
status | Status |
useWaitForUserOperation
hook.
Property | Type |
---|---|
userOperationHash? | Hex |
evmSmartAccount? | EvmAddress |
network? | SendEvmTransactionWithEndUserAccountBodyNetwork |
enabled? | boolean |
useWaitForUserOperation
hook.
Property | Type |
---|---|
status | Status |
data | | GetUserOperationResult | undefined |
error | Error | undefined |
Property | Type |
---|---|
evmAccount | EvmAddress |
Property | Type |
---|---|
privateKey | string |
Property | Type |
---|---|
evmAccount | EvmAddress |
network | SendEvmTransactionWithEndUserAccountBodyNetwork |
transaction | AllowedEvmTransactionType |
Property | Type |
---|---|
transactionHash | Hex |
Property | Type |
---|---|
evmAccount | EvmAddress |
hash | Hex |
Property | Type |
---|---|
signature | Hex |
Property | Type |
---|---|
evmAccount | EvmAddress |
message | string |
Property | Type |
---|---|
signature | Hex |
Property | Type |
---|---|
evmAccount | EvmAddress |
transaction | AllowedEvmTransactionType |
Property | Type |
---|---|
signedTransaction | Hex |
Property | Type |
---|---|
evmAccount | EvmAddress |
typedData | EIP712TypedData |
Property | Type |
---|---|
signature | Hex |
Property | Type |
---|---|
email | string |
Property | Type |
---|---|
message | string |
flowId | string |
Property | Type |
---|---|
userId | string |
authenticationMethods | AuthenticationMethods |
evmAccounts? | EvmAddress [] |
evmSmartAccounts? | EvmAddress [] |
Property | Type |
---|---|
flowId | string |
otp | string |
Property | Type |
---|---|
user | User |
message | string |
isNewUser | boolean |