useSetKernelClient
Hook for setting kernel account client
Import
import { useSetKernelClient } from '@zerodev/waas'
Usage
import { useSetKernelClient } from '@zerodev/waas';
import { createKernelAccountClient } from '@zerodev/sdk';
function App() {
const { setKernelClient } = useSetKernelClient();
const kernelClient = createKernelAccountClient({
// create kernel client...
})
return (
<button onClick={() => setKernelClient(kernelClient)}>
Set Kernel Client
</button>
)
}
Parameters
No parameter needed.
Return Types
import { type UseSetKernelClientReturnType } from '@zerodev/waas'
setKernelClient
(kernelClient: KernelAccountClient<EntryPoint>) => void
The mutation function to set kernel client.
setKernelClientAsync
(kernelClient: KernelAccountClient<EntryPoint>) => Promise<boolean>
Similar to setKernelClient but returns a promise.
data
boolean | undefined
- Defaults to
undefined
- The last successfully resolved data for the mutation.
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).