useCreateKernelClientPasskey
Import
import { useCreateKernelClientPasskey } from '@zerodev/waas'
Usage
import { useCreateKernelClientPasskey } from '@zerodev/waas';
function App() {
const { connectRegister, connectLogin } =
useCreateKernelClientPasskey({ version: 'v3' });
return (
<div>
<button onClick={() => {
connectRegister({ username: 'USER_NAME' })
}}>
Register
</button>
<button onClick={() => {
connectLogin()
}}>
Login
</button>
</div>
)
}
Parameters
import { type UseCreateKernelClientPasskeyParameters } from '@zerodev/waas';
version
v2 | v3
The version of kernel account.
import { useCreateKernelClientPasskey } from '@zerodev/waas';
function App() {
const { connectRegister, connectLogin } =
useCreateKernelClientPasskey({ version: 'v3' });
}
Return Types
import { type UseCreateKernelClientPasskeyReturnType } from '@zerodev/waas'
connectRegister
(variables: CreateKernelClientPasskeyVariables) => void
The mutation function to register passkey and create the kernel smart account.
-
variables
-
username
string
The username of the registered passkey.
-
connectRegisterAsync
(variables: CreateKernelClientPasskeyVariables) => Promise<CreateKernelClientPasskeyData>
Similar to connectRegister but returns a promise.
-
variables
-
username
string
The username of the registered passkey.
-
connectLogin
() => void
The mutation function to login created passkey and create the kernel smart account.
connectLoginAsync
() => Promise<CreateKernelClientPasskeyData>
Similar to connectLogin but returns a promise.
data
CreateKernelClientPasskeyData | undefined
-
validator
KernelValidator<EntryPoint>
The object of kernel validator. -
kernelAccount
KernelSmartAccount<EntryPoint>
The object of kernel account. -
entryPoint
EntryPoint
The entrypoint address of kernel account.
error
Error | null
The error object for the mutation, if an error was encountered.
isError / isIdle / isPending / isSuccess
boolean
Boolean variables derived from status
.
isPaused
boolean
- will be
true
if the mutation has beenpaused
. - see Network Mode for more information.
status
'idle' | 'pending' | 'error' | 'success'
'idle'
initial status prior to the mutation function executing.'pending'
if the mutation is currently executing.'error'
if the last mutation attempt resulted in an error.'success'
if the last mutation attempt was successful.
reset
() => void
A function to clean the mutation internal state (e.g. it resets the mutation to its initial state).