UNPKG

@zerodev/sdk

Version:

A utility library for working with ERC-4337

73 lines 5.21 kB
import { type Address, type Hex } from "viem"; import type { EntryPointVersion } from "viem/account-abstraction"; import type { ZeroDevPaymasterClient } from "./clients/paymasterClient.js"; import type { CALL_TYPE, EXEC_TYPE } from "./constants.js"; import type { EntryPointType, GetKernelVersion } from "./types/kernel.js"; export declare enum KERNEL_FEATURES { ERC1271_SIG_WRAPPER = "ERC1271_SIG_WRAPPER", ERC1271_WITH_VALIDATOR = "ERC1271_WITH_VALIDATOR", ERC1271_SIG_WRAPPER_WITH_WRAPPED_HASH = "ERC1271_SIG_WRAPPER_WITH_WRAPPED_HASH", ERC1271_REPLAYABLE = "ERC1271_REPLAYABLE" } export declare const KERNEL_FEATURES_BY_VERSION: Record<KERNEL_FEATURES, string>; export declare const hasKernelFeature: (feature: KERNEL_FEATURES, version: string) => boolean; export declare const getERC20PaymasterApproveCall: <entryPointVersion extends EntryPointVersion>(client: { account: import("viem/account-abstraction").SmartAccount | undefined; batch?: { multicall?: boolean | { batchSize?: number | undefined; deployless?: boolean | undefined; wait?: number | undefined; } | undefined; } | undefined; cacheTime: number; ccipRead?: false | { request?: ((parameters: import("viem").CcipRequestParameters) => Promise<`0x${string}`>) | undefined; } | undefined; chain: import("viem").Chain | undefined; experimental_blockTag?: import("viem").BlockTag | undefined; key: string; name: string; pollingInterval: number; request: import("viem").EIP1193RequestFn<import("./types/kernel.js").ZeroDevPaymasterRpcSchema<entryPointVersion>>; transport: import("viem").TransportConfig<string, import("viem").EIP1193RequestFn> & Record<string, any>; type: string; uid: string; getPaymasterData: (parameters: import("viem/account-abstraction").GetPaymasterDataParameters) => Promise<import("viem/account-abstraction").GetPaymasterDataReturnType>; getPaymasterStubData: (parameters: import("viem/account-abstraction").GetPaymasterStubDataParameters) => Promise<import("viem/account-abstraction").GetPaymasterStubDataReturnType>; sponsorUserOperation: (args: import("./index.js").SponsorUserOperationParameters) => Promise<import("./index.js").SponsorUserOperationReturnType>; estimateGasInERC20: (args: import("./actions/index.js").EstimateGasInERC20Parameters) => Promise<import("./actions/index.js").EstimateGasInERC20ReturnType>; extend: <const client extends { [x: string]: unknown; account?: undefined; batch?: undefined; cacheTime?: undefined; ccipRead?: undefined; chain?: undefined; experimental_blockTag?: undefined; key?: undefined; name?: undefined; pollingInterval?: undefined; request?: undefined; transport?: undefined; type?: undefined; uid?: undefined; } & import("viem").ExactPartial<Pick<import("viem").PublicActions<import("viem").Transport, import("viem").Chain | undefined, import("viem/account-abstraction").SmartAccount | undefined>, "call" | "createContractEventFilter" | "createEventFilter" | "estimateContractGas" | "estimateGas" | "getBlock" | "getBlockNumber" | "getChainId" | "getContractEvents" | "getEnsText" | "getFilterChanges" | "getGasPrice" | "getLogs" | "getTransaction" | "getTransactionCount" | "getTransactionReceipt" | "prepareTransactionRequest" | "readContract" | "sendRawTransaction" | "simulateContract" | "uninstallFilter" | "watchBlockNumber" | "watchContractEvent"> & Pick<import("viem").WalletActions<import("viem").Chain | undefined, import("viem/account-abstraction").SmartAccount | undefined>, "sendTransaction" | "writeContract">>>(fn: (client: import("viem").Client<import("viem").Transport, import("viem").Chain | undefined, import("viem/account-abstraction").SmartAccount | undefined, import("./types/kernel.js").ZeroDevPaymasterRpcSchema<entryPointVersion>, import("viem/account-abstraction").PaymasterActions & import("./index.js").ZeroDevPaymasterClientActions>) => client) => import("viem").Client<import("viem").Transport, import("viem").Chain | undefined, import("viem/account-abstraction").SmartAccount | undefined, import("./types/kernel.js").ZeroDevPaymasterRpcSchema<entryPointVersion>, { [K in keyof client]: client[K]; } & import("viem/account-abstraction").PaymasterActions & import("./index.js").ZeroDevPaymasterClientActions>; }, { gasToken, approveAmount, entryPoint }: { gasToken: Address; approveAmount: bigint; entryPoint: EntryPointType<entryPointVersion>; }) => Promise<{ to: Address; value: bigint; data: Hex; }>; export declare const fixSignedData: (sig: Hex) => Hex; export declare const getExecMode: ({ callType, execType }: { callType: CALL_TYPE; execType: EXEC_TYPE; }) => Hex; export declare const validateKernelVersionWithEntryPoint: <entryPointVersion extends EntryPointVersion>(entryPointVersion: EntryPointVersion, kernelVersion: GetKernelVersion<entryPointVersion>) => void; export declare const satisfiesRange: (version: string, range: string) => boolean; export declare function deepHexlify(obj: any): any; //# sourceMappingURL=utils.d.ts.map