useSessionKernelClient
Hook for getting kernel account client with session plugin
Import
import { useSessionKernelClient } from '@zerodev/waas'Usage
import { useSessionKernelClient } from '@zerodev/waas';
function App() {
const { kernelClient } = useSessionKernelClient();
}Parameters
import { type UseSessionKernelClientParameters } from '@zerodev/waas';sessionId
0x${string}
The sessionId of session used to send user operation.
paymaster
{type: "SPONSOR"} | {type: "ERC20", gasToken: string} | undefined
The paymaster type and gas token address.
-
type
SPONSOR | ERC20The type of paymaster. -
gasToken
string | undefinedThe symbol of erc20 token used for erc20 paymaster.
Return Types
import { type UseKernelClientReturnType } from '@zerodev/waas'Return Types
import { type UseSessionKernelClientReturnType } from '@zerodev/waas'kernelAccount
KernelSmartAccount<EntryPoint> | null
The current kernel account with session plugin.
kernelClient
KernelAccountClient<EntryPoint>
The current kernel account client with session plugin.
error
Error | null
- The error object for the query, if an error was thrown.
- Defaults to
null
isError / isPending / isSuccess
boolean
Boolean variables derived from status.
isFetched
boolean
Will be true if the query has been fetched.
isLoading
boolean
- Is
truewhenever the first fetch for a query is in-flight - Is the same as
isFetching && isPending
status
'error' | 'pending' | 'success'
pendingif there's no cached data and no query attempt was finished yet.errorif the query attempt resulted in an error. The correspondingerrorproperty has the error received from the attempted fetchsuccessif the query has received a response with no errors and is ready to display its data. The correspondingdataproperty on the query is the data received from the successful fetch or if the query'senabledproperty is set tofalseand has not been fetched yetdatais the firstinitialDatasupplied to the query on initialization.
refetch
(options: { cancelRefetch?: boolean | undefined; throwOnError?: boolean | undefined }) => Promise<UseQueryResult>
- A function to manually refetch the query.
throwOnError- When set to
true, an error will be thrown if the query fails. - When set to
false, an error will be logged if the query fails.
- When set to
cancelRefetch- When set to
true, a currently running request will be cancelled before a new request is made. - When set to
false, no refetch will be made if there is already a request running. - Defaults to
true
- When set to