useCreateKernelClientEOA
Hook for creating kernel client with EOA
Import
import { useCreateKernelClientEOA } from '@zerodev/waas'Usage
import { useCreateKernelClientEOA } from '@zerodev/waas';
import { injected } from 'wagmi/connectors';
function App() {
const { connect } = useCreateKernelClientEOA({ version: 'v3' });
return (
<button onClick={() => connect({connector: injected()})}>
Connect
</button>
)
}Parameters
import { type UseCreateKernelClientEOAParameters } from '@zerodev/waas';version
v2 | v3
The version of kernel account.
import { useCreateKernelClientEOA } from '@zerodev/waas';
function App() {
const { connect } = useCreateKernelClientEOA({ version: 'v3' });
}Return Types
import { type UseCreateKernelClientEOAReturnType } from '@zerodev/waas'connect
(variables: CreateKernelClientEOAVariables) => void
The mutation function to connect eoa and create the kernel smart account.
-
variables
-
connector
Connector | undefinedThe connectors.
-
connectAsync
(variables: CreateKernelClientEOAVariables) => Promise<CreateKernelClientEOAData>
Similar to connect but returns a promise.
-
variables
-
connector
Connector | undefinedThe connectors.
-
data
CreateKernelClientEOAData | undefined
-
validator
KernelValidator<EntryPoint>The object of kernel validator. -
kernelAccount
KernelSmartAccount<EntryPoint>The object of kernel account. -
entryPoint
EntryPointThe 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
trueif 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).