@zerodev/sdk
Advanced tools
Comparing version 5.4.0-beta.1 to 5.4.0-beta.2
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.KernelFactoryToInitCodeHashMap = exports.safeCreateCallAddress = exports.EXEC_TYPE = exports.CALL_TYPE = exports.VALIDATOR_MODE = exports.VALIDATOR_TYPE = exports.KERNEL_NAME = exports.ONLY_ENTRYPOINT_HOOK_ADDRESS = exports.TOKEN_ACTION = exports.KERNEL_V3_1 = exports.KERNEL_V3_0 = exports.KERNEL_V2_4 = exports.KERNEL_V2_3 = exports.KERNEL_V2_2 = exports.KERNEL_V0_2 = exports.KernelVersionToAddressesMap = exports.FACTORY_ADDRESS_V0_6_INIT_CODE_HASH = exports.FACTORY_ADDRESS_V0_6 = exports.DUMMY_ECDSA_SIG = void 0; | ||
exports.getEntryPoint = exports.KernelFactoryToInitCodeHashMap = exports.safeCreateCallAddress = exports.EXEC_TYPE = exports.CALL_TYPE = exports.VALIDATOR_MODE = exports.VALIDATOR_TYPE = exports.KERNEL_NAME = exports.ONLY_ENTRYPOINT_HOOK_ADDRESS = exports.TOKEN_ACTION = exports.KERNEL_V3_1 = exports.KERNEL_V3_0 = exports.KERNEL_V2_4 = exports.KERNEL_V2_3 = exports.KERNEL_V2_2 = exports.KERNEL_V0_2 = exports.KernelVersionToAddressesMap = exports.FACTORY_ADDRESS_V0_6_INIT_CODE_HASH = exports.FACTORY_ADDRESS_V0_6 = exports.DUMMY_ECDSA_SIG = void 0; | ||
const viem_1 = require("viem"); | ||
const account_abstraction_1 = require("viem/account-abstraction"); | ||
exports.DUMMY_ECDSA_SIG = "0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c"; | ||
@@ -76,2 +77,14 @@ exports.FACTORY_ADDRESS_V0_6 = "0x5de4839a76cf55d0c90e2061ef4386d962E15ae3"; | ||
}; | ||
const getEntryPoint = (entryPointVersion) => { | ||
if (entryPointVersion === "0.6") | ||
return { | ||
address: account_abstraction_1.entryPoint06Address, | ||
version: entryPointVersion | ||
}; | ||
return { | ||
address: account_abstraction_1.entryPoint07Address, | ||
version: entryPointVersion | ||
}; | ||
}; | ||
exports.getEntryPoint = getEntryPoint; | ||
//# sourceMappingURL=constants.js.map |
@@ -62,2 +62,3 @@ "use strict"; | ||
tslib_1.__exportStar(require("./errors/index.js"), exports); | ||
tslib_1.__exportStar(require("./utils/index.js"), exports); | ||
//# sourceMappingURL=index.js.map |
import { zeroAddress } from "viem"; | ||
import { entryPoint06Address, entryPoint07Address } from "viem/account-abstraction"; | ||
export const DUMMY_ECDSA_SIG = "0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c"; | ||
@@ -83,2 +84,13 @@ // export const KernelImplToVersionMap: { [key: Address]: string } = { | ||
}; | ||
export const getEntryPoint = (entryPointVersion) => { | ||
if (entryPointVersion === "0.6") | ||
return { | ||
address: entryPoint06Address, | ||
version: entryPointVersion | ||
}; | ||
return { | ||
address: entryPoint07Address, | ||
version: entryPointVersion | ||
}; | ||
}; | ||
//# sourceMappingURL=constants.js.map |
@@ -27,2 +27,3 @@ export { createKernelAccount, createKernelAccountV0_2, createKernelAccountV1, KERNEL_ADDRESSES, addressToEmptyAccount, EIP1271Abi, getKernelV3Nonce, accountMetadata, getActionSelector, getPluginsEnableTypedData } from "./accounts/index.js"; | ||
export * from "./errors/index.js"; | ||
export * from "./utils/index.js"; | ||
//# sourceMappingURL=index.js.map |
import { type Address, type Assign, type Client, type EncodeDeployDataParameters, type Hex } from "viem"; | ||
import { type EntryPointVersion, type SmartAccount, type SmartAccountImplementation } from "viem/account-abstraction"; | ||
import type { CallType, GetEntryPointAbi, GetKernelVersion, KernelPluginManager, KernelPluginManagerParams } from "../../types/kernel.js"; | ||
import type { CallType, EntryPointType, GetEntryPointAbi, GetKernelVersion, KernelPluginManager, KernelPluginManagerParams } from "../../types/kernel.js"; | ||
export type KernelSmartAccountImplementation<entryPointVersion extends EntryPointVersion = "0.7"> = Assign<SmartAccountImplementation<GetEntryPointAbi<entryPointVersion>, entryPointVersion>, { | ||
@@ -16,6 +16,3 @@ sign: NonNullable<SmartAccountImplementation["sign"]>; | ||
plugins: Omit<KernelPluginManagerParams<entryPointVersion>, "entryPoint" | "kernelVersion"> | KernelPluginManager<entryPointVersion>; | ||
entryPoint: { | ||
address: Address; | ||
version: entryPointVersion; | ||
}; | ||
entryPoint: EntryPointType<entryPointVersion>; | ||
index?: bigint; | ||
@@ -22,0 +19,0 @@ factoryAddress?: Address; |
@@ -1,12 +0,9 @@ | ||
import type { Address, Hex } from "viem"; | ||
import type { Hex } from "viem"; | ||
import type { PartialBy } from "viem"; | ||
import type { EntryPointVersion, UserOperation } from "viem/account-abstraction"; | ||
import type { ZeroDevPaymasterClient } from "../../clients/paymasterClient.js"; | ||
import type { PartialPick } from "../../types/index.js"; | ||
import type { EntryPointType, PartialPick } from "../../types/index.js"; | ||
export type SponsorUserOperationParameters<entryPointVersion extends EntryPointVersion> = { | ||
userOperation: entryPointVersion extends "0.6" ? PartialBy<UserOperation<"0.6">, "callGasLimit" | "preVerificationGas" | "verificationGasLimit"> : PartialBy<UserOperation<"0.7">, "callGasLimit" | "preVerificationGas" | "verificationGasLimit" | "paymasterVerificationGasLimit" | "paymasterPostOpGasLimit">; | ||
entryPoint: { | ||
address: Address; | ||
version: entryPointVersion; | ||
}; | ||
entryPoint: EntryPointType<entryPointVersion>; | ||
gasToken?: Hex; | ||
@@ -13,0 +10,0 @@ shouldOverrideFee?: boolean; |
@@ -1,2 +0,2 @@ | ||
import type { Abi, Address, Chain, Client, ContractFunctionArgs, ContractFunctionName, Hash, Prettify, Transport, TypedData, WriteContractParameters } from "viem"; | ||
import type { Abi, Chain, Client, ContractFunctionArgs, ContractFunctionName, Hash, Prettify, Transport, TypedData, WriteContractParameters } from "viem"; | ||
import type { EntryPointVersion, SmartAccount } from "viem/account-abstraction"; | ||
@@ -13,2 +13,3 @@ import { type GetUserOperationGasPriceReturnType } from "../../actions/account-client/getUserOperationGasPrice.js"; | ||
import { type SponsorUserOperationParameters, type SponsorUserOperationReturnType } from "../../actions/paymaster/sponsorUserOperation.js"; | ||
import type { EntryPointType } from "../../types/kernel.js"; | ||
export type ZeroDevPaymasterClientActions<entryPointVersion extends EntryPointVersion> = { | ||
@@ -21,6 +22,3 @@ /** | ||
}; | ||
export declare const zerodevPaymasterActions: <entryPointVersion extends EntryPointVersion>(entryPoint: { | ||
address: Address; | ||
version: entryPointVersion; | ||
}) => (client: Client) => ZeroDevPaymasterClientActions<entryPointVersion>; | ||
export declare const zerodevPaymasterActions: <entryPointVersion extends EntryPointVersion>(entryPoint: EntryPointType<entryPointVersion>) => (client: Client) => ZeroDevPaymasterClientActions<entryPointVersion>; | ||
export type KernelAccountClientActions<TChain extends Chain | undefined = Chain | undefined, TSmartAccount extends SmartAccount | undefined = SmartAccount | undefined> = { | ||
@@ -558,9 +556,3 @@ /** | ||
key?: bigint | undefined; | ||
} | undefined) => Promise<bigint>; /** | ||
* Creates, signs, and sends a transaction to fetch KernelV3 module nonce to the network. | ||
* This function also allows you to sponsor this transaction if sender is a smartAccount | ||
* | ||
* | ||
* @returns nonce | ||
*/ | ||
} | undefined) => Promise<bigint>; | ||
isDeployed: () => Promise<boolean>; | ||
@@ -818,9 +810,3 @@ type: "smart"; | ||
key?: bigint | undefined; | ||
} | undefined) => Promise<bigint>; /** | ||
* Creates, signs, and sends a transaction to fetch KernelV3 module nonce to the network. | ||
* This function also allows you to sponsor this transaction if sender is a smartAccount | ||
* | ||
* | ||
* @returns nonce | ||
*/ | ||
} | undefined) => Promise<bigint>; | ||
isDeployed: () => Promise<boolean>; | ||
@@ -827,0 +813,0 @@ type: "smart"; |
@@ -1,10 +0,7 @@ | ||
import { type Address, type Chain, type Client, type ClientConfig, type Prettify, type RpcSchema, type Transport } from "viem"; | ||
import { type Chain, type Client, type ClientConfig, type Prettify, type RpcSchema, type Transport } from "viem"; | ||
import { type PaymasterActions, type SmartAccount } from "viem/account-abstraction"; | ||
import type { ZeroDevPaymasterRpcSchema } from "../types/kernel.js"; | ||
import type { EntryPointType, ZeroDevPaymasterRpcSchema } from "../types/kernel.js"; | ||
export type ZeroDevPaymasterClient<entryPointVersion extends "0.6" | "0.7" = "0.7", transport extends Transport = Transport, chain extends Chain | undefined = Chain | undefined, account extends SmartAccount | undefined = SmartAccount | undefined, client extends Client | undefined = Client | undefined, rpcSchema extends RpcSchema | undefined = undefined> = Prettify<Client<transport, chain extends Chain ? chain : client extends Client<any, infer chain> ? chain : undefined, account, rpcSchema extends RpcSchema ? [...ZeroDevPaymasterRpcSchema<entryPointVersion>, ...rpcSchema] : ZeroDevPaymasterRpcSchema<entryPointVersion>, PaymasterActions>>; | ||
export type ZeroDevPaymasterClientConfig<entryPointVersion extends "0.6" | "0.7" = "0.7" | "0.6", transport extends Transport = Transport, chain extends Chain | undefined = Chain | undefined, account extends SmartAccount | undefined = SmartAccount | undefined, rpcSchema extends RpcSchema | undefined = undefined> = Prettify<Pick<ClientConfig<transport, chain, account, rpcSchema>, "account" | "cacheTime" | "chain" | "key" | "name" | "pollingInterval" | "rpcSchema" | "transport">> & { | ||
entryPoint?: { | ||
address: Address; | ||
version: entryPointVersion; | ||
}; | ||
entryPoint?: EntryPointType<entryPointVersion>; | ||
}; | ||
@@ -11,0 +8,0 @@ /** |
import { type Address, type Hex } from "viem"; | ||
import type { KERNEL_V2_VERSION_TYPE, KERNEL_V3_VERSION_TYPE, KERNEL_VERSION_TYPE } from "./types/kernel.js"; | ||
import { type EntryPointVersion } from "viem/account-abstraction"; | ||
import type { EntryPointType, KERNEL_V2_VERSION_TYPE, KERNEL_V3_VERSION_TYPE, KERNEL_VERSION_TYPE } from "./types/kernel.js"; | ||
export declare const DUMMY_ECDSA_SIG = "0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c"; | ||
@@ -45,2 +46,3 @@ export declare const FACTORY_ADDRESS_V0_6 = "0x5de4839a76cf55d0c90e2061ef4386d962E15ae3"; | ||
}; | ||
export declare const getEntryPoint: <TEntryPointVersion extends EntryPointVersion>(entryPointVersion: TEntryPointVersion) => EntryPointType<TEntryPointVersion>; | ||
//# sourceMappingURL=constants.d.ts.map |
@@ -26,2 +26,3 @@ export { createKernelAccount, createKernelAccountV0_2, createKernelAccountV1, type CreateKernelAccountParameters, type CreateKernelAccountReturnType, type CreateKernelAccountV1ReturnType, type KernelSmartAccountImplementation, type KernelSmartAccountV1Implementation, KERNEL_ADDRESSES, addressToEmptyAccount, EIP1271Abi, getKernelV3Nonce, accountMetadata, getActionSelector, getPluginsEnableTypedData } from "./accounts/index.js"; | ||
export * from "./errors/index.js"; | ||
export * from "./utils/index.js"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,5 +0,6 @@ | ||
export type { KernelValidator, ZeroDevPaymasterRpcSchema, Action, KernelPluginManager, ValidatorInitData, CallType, KernelEncodeCallDataArgs, PluginValidityData, ZeroDevAccountClientRpcSchema, ZeroDevUserOperationGasPriceWithBigIntAsHex, KERNEL_V2_VERSION_TYPE, KERNEL_V3_VERSION_TYPE, KERNEL_VERSION_TYPE, GetKernelVersion, GetEntryPointAbi } from "./kernel.js"; | ||
export type { KernelValidator, ZeroDevPaymasterRpcSchema, Action, KernelPluginManager, ValidatorInitData, CallType, KernelEncodeCallDataArgs, PluginValidityData, ZeroDevAccountClientRpcSchema, ZeroDevUserOperationGasPriceWithBigIntAsHex, KERNEL_V2_VERSION_TYPE, KERNEL_V3_VERSION_TYPE, KERNEL_VERSION_TYPE, GetKernelVersion, GetEntryPointAbi, EntryPointType } from "./kernel.js"; | ||
export { ValidatorMode } from "./kernel.js"; | ||
export type { Signer } from "./utils.js"; | ||
export type WithRequired<T, K extends keyof T> = Required<Pick<T, K>>; | ||
export type PartialPick<T, K extends keyof T> = Partial<Pick<T, K>>; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -142,6 +142,3 @@ import type { Address, CustomSource, Hex, LocalAccount, PartialBy } from "viem"; | ||
action?: Action; | ||
entryPoint: { | ||
address: Address; | ||
version: entryPointVersion; | ||
}; | ||
entryPoint: EntryPointType<entryPointVersion>; | ||
kernelVersion: KERNEL_VERSION_TYPE; | ||
@@ -184,2 +181,6 @@ chainId?: number; | ||
export type GetKernelVersion<entryPointVersion extends EntryPointVersion> = entryPointVersion extends "0.6" ? KERNEL_V2_VERSION_TYPE : KERNEL_V3_VERSION_TYPE; | ||
export type EntryPointType<entryPointVersion extends EntryPointVersion> = { | ||
address: Address; | ||
version: entryPointVersion; | ||
}; | ||
//# sourceMappingURL=kernel.d.ts.map |
@@ -5,3 +5,3 @@ import { type Address, type Hex } from "viem"; | ||
import type { CALL_TYPE, EXEC_TYPE } from "./constants.js"; | ||
import type { GetKernelVersion } from "./types/kernel.js"; | ||
import type { EntryPointType, GetKernelVersion } from "./types/kernel.js"; | ||
export declare enum KERNEL_FEATURES { | ||
@@ -1319,6 +1319,3 @@ ERC1271_SIG_WRAPPER = "ERC1271_SIG_WRAPPER", | ||
approveAmount: bigint; | ||
entryPoint: { | ||
address: Address; | ||
version: entryPointVersion; | ||
}; | ||
entryPoint: EntryPointType<entryPointVersion>; | ||
}) => Promise<{ | ||
@@ -1325,0 +1322,0 @@ to: Address; |
@@ -37,2 +37,3 @@ import { | ||
CallType, | ||
EntryPointType, | ||
GetEntryPointAbi, | ||
@@ -100,6 +101,3 @@ GetKernelVersion, | ||
| KernelPluginManager<entryPointVersion> | ||
entryPoint: { | ||
address: Address | ||
version: entryPointVersion | ||
} | ||
entryPoint: EntryPointType<entryPointVersion> | ||
index?: bigint | ||
@@ -106,0 +104,0 @@ factoryAddress?: Address |
@@ -5,3 +5,3 @@ import type { Address, Hex } from "viem" | ||
import type { ZeroDevPaymasterClient } from "../../clients/paymasterClient.js" | ||
import type { PartialPick } from "../../types/index.js" | ||
import type { EntryPointType, PartialPick } from "../../types/index.js" | ||
import { deepHexlify } from "../../utils.js" | ||
@@ -25,6 +25,3 @@ | ||
> | ||
entryPoint: { | ||
address: Address | ||
version: entryPointVersion | ||
} | ||
entryPoint: EntryPointType<entryPointVersion> | ||
gasToken?: Hex | ||
@@ -31,0 +28,0 @@ shouldOverrideFee?: boolean |
import type { | ||
Abi, | ||
Address, | ||
Chain, | ||
@@ -48,2 +47,3 @@ Client, | ||
} from "../../actions/paymaster/sponsorUserOperation.js" | ||
import type { EntryPointType } from "../../types/kernel.js" | ||
import type { ZeroDevPaymasterClient } from "../paymasterClient.js" | ||
@@ -66,6 +66,5 @@ | ||
export const zerodevPaymasterActions = | ||
<entryPointVersion extends EntryPointVersion>(entryPoint: { | ||
address: Address | ||
version: entryPointVersion | ||
}) => | ||
<entryPointVersion extends EntryPointVersion>( | ||
entryPoint: EntryPointType<entryPointVersion> | ||
) => | ||
(client: Client): ZeroDevPaymasterClientActions<entryPointVersion> => ({ | ||
@@ -72,0 +71,0 @@ sponsorUserOperation: async ( |
import { | ||
type Address, | ||
type Chain, | ||
@@ -18,3 +17,6 @@ type Client, | ||
} from "viem/account-abstraction" | ||
import type { ZeroDevPaymasterRpcSchema } from "../types/kernel.js" | ||
import type { | ||
EntryPointType, | ||
ZeroDevPaymasterRpcSchema | ||
} from "../types/kernel.js" | ||
import { zerodevPaymasterActions } from "./decorators/kernel.js" | ||
@@ -65,6 +67,3 @@ | ||
> & { | ||
entryPoint?: { | ||
address: Address | ||
version: entryPointVersion | ||
} | ||
entryPoint?: EntryPointType<entryPointVersion> | ||
} | ||
@@ -71,0 +70,0 @@ /** |
import { type Address, type Hex, zeroAddress } from "viem" | ||
import { | ||
type EntryPointVersion, | ||
entryPoint06Address, | ||
entryPoint07Address | ||
} from "viem/account-abstraction" | ||
import type { | ||
EntryPointType, | ||
KERNEL_V2_VERSION_TYPE, | ||
@@ -115,1 +121,15 @@ KERNEL_V3_VERSION_TYPE, | ||
} | ||
export const getEntryPoint = <TEntryPointVersion extends EntryPointVersion>( | ||
entryPointVersion: TEntryPointVersion | ||
): EntryPointType<TEntryPointVersion> => { | ||
if (entryPointVersion === "0.6") | ||
return { | ||
address: entryPoint06Address, | ||
version: entryPointVersion | ||
} | ||
return { | ||
address: entryPoint07Address, | ||
version: entryPointVersion | ||
} | ||
} |
@@ -70,1 +70,2 @@ export { | ||
export * from "./errors/index.js" | ||
export * from "./utils/index.js" |
{ | ||
"name": "@zerodev/sdk", | ||
"version": "5.4.0-beta.1", | ||
"version": "5.4.0-beta.2", | ||
"author": "ZeroDev", | ||
@@ -5,0 +5,0 @@ "main": "./_cjs/index.js", |
@@ -16,3 +16,4 @@ export type { | ||
GetKernelVersion, | ||
GetEntryPointAbi | ||
GetEntryPointAbi, | ||
EntryPointType | ||
} from "./kernel.js" | ||
@@ -22,4 +23,6 @@ | ||
export type { Signer } from "./utils.js" | ||
export type WithRequired<T, K extends keyof T> = Required<Pick<T, K>> | ||
export type PartialPick<T, K extends keyof T> = Partial<Pick<T, K>> |
@@ -198,6 +198,3 @@ import type { Address, CustomSource, Hex, LocalAccount, PartialBy } from "viem" | ||
action?: Action | ||
entryPoint: { | ||
address: Address | ||
version: entryPointVersion | ||
} | ||
entryPoint: EntryPointType<entryPointVersion> | ||
kernelVersion: KERNEL_VERSION_TYPE | ||
@@ -260,1 +257,6 @@ chainId?: number | ||
: KERNEL_V3_VERSION_TYPE | ||
export type EntryPointType<entryPointVersion extends EntryPointVersion> = { | ||
address: Address | ||
version: entryPointVersion | ||
} |
@@ -17,3 +17,3 @@ import { satisfies } from "semver" | ||
import type { CALL_TYPE, EXEC_TYPE } from "./constants.js" | ||
import type { GetKernelVersion } from "./types/kernel.js" | ||
import type { EntryPointType, GetKernelVersion } from "./types/kernel.js" | ||
@@ -54,3 +54,3 @@ export enum KERNEL_FEATURES { | ||
approveAmount: bigint | ||
entryPoint: { address: Address; version: entryPointVersion } | ||
entryPoint: EntryPointType<entryPointVersion> | ||
} | ||
@@ -57,0 +57,0 @@ ): Promise<{ to: Address; value: bigint; data: Hex }> => { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1673169
578
34121