@zerodev/sdk 5.2.1-alpha-4 → 5.2.1-alpha-6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/_cjs/accounts/kernel/abi/kernel_v_3_0_0/KernelFactoryAbi.js +39 -0
  2. package/_cjs/accounts/kernel/abi/kernel_v_3_0_0/KernelFactoryAbi.js.map +1 -0
  3. package/_cjs/accounts/kernel/abi/kernel_v_3_0_0/KernelFactoryStakerAbi.js +203 -0
  4. package/_cjs/accounts/kernel/abi/kernel_v_3_0_0/KernelFactoryStakerAbi.js.map +1 -0
  5. package/_cjs/accounts/kernel/createKernelAccount.js +35 -10
  6. package/_cjs/accounts/kernel/createKernelAccount.js.map +1 -1
  7. package/_cjs/actions/account-client/getUserOperationGasPrice.js +15 -0
  8. package/_cjs/actions/account-client/getUserOperationGasPrice.js.map +1 -0
  9. package/_cjs/actions/index.js +3 -1
  10. package/_cjs/actions/index.js.map +1 -1
  11. package/_cjs/actions/paymaster/estimateGasInERC20.js +2 -2
  12. package/_cjs/actions/paymaster/estimateGasInERC20.js.map +1 -1
  13. package/_cjs/clients/decorators/kernel.js +3 -1
  14. package/_cjs/clients/decorators/kernel.js.map +1 -1
  15. package/_cjs/clients/kernelAccountClient.js +13 -1
  16. package/_cjs/clients/kernelAccountClient.js.map +1 -1
  17. package/_cjs/constants.js +1 -1
  18. package/_cjs/index.js +5 -1
  19. package/_cjs/index.js.map +1 -1
  20. package/_cjs/types/index.js.map +1 -1
  21. package/_cjs/types/kernel.js.map +1 -1
  22. package/_cjs/utils.js +1 -2
  23. package/_cjs/utils.js.map +1 -1
  24. package/_esm/accounts/kernel/abi/kernel_v_3_0_0/KernelFactoryAbi.js +36 -0
  25. package/_esm/accounts/kernel/abi/kernel_v_3_0_0/KernelFactoryAbi.js.map +1 -0
  26. package/_esm/accounts/kernel/abi/kernel_v_3_0_0/KernelFactoryStakerAbi.js +200 -0
  27. package/_esm/accounts/kernel/abi/kernel_v_3_0_0/KernelFactoryStakerAbi.js.map +1 -0
  28. package/_esm/accounts/kernel/createKernelAccount.js +36 -11
  29. package/_esm/accounts/kernel/createKernelAccount.js.map +1 -1
  30. package/_esm/actions/account-client/getUserOperationGasPrice.js +11 -0
  31. package/_esm/actions/account-client/getUserOperationGasPrice.js.map +1 -0
  32. package/_esm/actions/index.js +1 -0
  33. package/_esm/actions/index.js.map +1 -1
  34. package/_esm/actions/paymaster/estimateGasInERC20.js +2 -2
  35. package/_esm/actions/paymaster/estimateGasInERC20.js.map +1 -1
  36. package/_esm/clients/decorators/kernel.js +3 -1
  37. package/_esm/clients/decorators/kernel.js.map +1 -1
  38. package/_esm/clients/kernelAccountClient.js +13 -1
  39. package/_esm/clients/kernelAccountClient.js.map +1 -1
  40. package/_esm/constants.js +1 -1
  41. package/_esm/index.js +2 -0
  42. package/_esm/index.js.map +1 -1
  43. package/_esm/types/index.js.map +1 -1
  44. package/_esm/types/kernel.js.map +1 -1
  45. package/_esm/utils.js +2 -3
  46. package/_esm/utils.js.map +1 -1
  47. package/_types/accounts/kernel/abi/kernel_v_3_0_0/KernelFactoryAbi.d.ts +60 -0
  48. package/_types/accounts/kernel/abi/kernel_v_3_0_0/KernelFactoryAbi.d.ts.map +1 -0
  49. package/_types/accounts/kernel/abi/kernel_v_3_0_0/KernelFactoryStakerAbi.d.ts +215 -0
  50. package/_types/accounts/kernel/abi/kernel_v_3_0_0/KernelFactoryStakerAbi.d.ts.map +1 -0
  51. package/_types/accounts/kernel/createKernelAccount.d.ts +5 -3
  52. package/_types/accounts/kernel/createKernelAccount.d.ts.map +1 -1
  53. package/_types/actions/account-client/getUserOperationGasPrice.d.ts +9 -0
  54. package/_types/actions/account-client/getUserOperationGasPrice.d.ts.map +1 -0
  55. package/_types/actions/index.d.ts +1 -0
  56. package/_types/actions/index.d.ts.map +1 -1
  57. package/_types/actions/paymaster/estimateGasInERC20.d.ts.map +1 -1
  58. package/_types/clients/decorators/kernel.d.ts +8 -1
  59. package/_types/clients/decorators/kernel.d.ts.map +1 -1
  60. package/_types/clients/kernelAccountClient.d.ts +12 -4
  61. package/_types/clients/kernelAccountClient.d.ts.map +1 -1
  62. package/_types/index.d.ts +2 -0
  63. package/_types/index.d.ts.map +1 -1
  64. package/_types/types/index.d.ts +1 -1
  65. package/_types/types/index.d.ts.map +1 -1
  66. package/_types/types/kernel.d.ts +21 -0
  67. package/_types/types/kernel.d.ts.map +1 -1
  68. package/_types/utils.d.ts.map +1 -1
  69. package/accounts/kernel/abi/kernel_v_3_0_0/KernelFactoryAbi.ts +35 -0
  70. package/accounts/kernel/abi/kernel_v_3_0_0/KernelFactoryStakerAbi.ts +199 -0
  71. package/accounts/kernel/createKernelAccount.ts +45 -12
  72. package/actions/account-client/getUserOperationGasPrice.ts +26 -0
  73. package/actions/index.ts +5 -0
  74. package/actions/paymaster/estimateGasInERC20.ts +2 -3
  75. package/clients/decorators/kernel.ts +15 -2
  76. package/clients/kernelAccountClient.ts +16 -1
  77. package/constants.ts +1 -1
  78. package/index.ts +2 -0
  79. package/package.json +1 -1
  80. package/types/index.ts +3 -1
  81. package/types/kernel.ts +23 -0
  82. package/utils.ts +2 -3
@@ -0,0 +1,199 @@
1
+ export const KernelFactoryStakerAbi = [
2
+ {
3
+ type: "constructor",
4
+ inputs: [{ name: "_owner", type: "address", internalType: "address" }],
5
+ stateMutability: "nonpayable"
6
+ },
7
+ {
8
+ type: "function",
9
+ name: "approveFactory",
10
+ inputs: [
11
+ {
12
+ name: "factory",
13
+ type: "address",
14
+ internalType: "contract KernelFactory"
15
+ },
16
+ { name: "approval", type: "bool", internalType: "bool" }
17
+ ],
18
+ outputs: [],
19
+ stateMutability: "payable"
20
+ },
21
+ {
22
+ type: "function",
23
+ name: "approved",
24
+ inputs: [
25
+ {
26
+ name: "",
27
+ type: "address",
28
+ internalType: "contract KernelFactory"
29
+ }
30
+ ],
31
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
32
+ stateMutability: "view"
33
+ },
34
+ {
35
+ type: "function",
36
+ name: "cancelOwnershipHandover",
37
+ inputs: [],
38
+ outputs: [],
39
+ stateMutability: "payable"
40
+ },
41
+ {
42
+ type: "function",
43
+ name: "completeOwnershipHandover",
44
+ inputs: [
45
+ { name: "pendingOwner", type: "address", internalType: "address" }
46
+ ],
47
+ outputs: [],
48
+ stateMutability: "payable"
49
+ },
50
+ {
51
+ type: "function",
52
+ name: "deployWithFactory",
53
+ inputs: [
54
+ {
55
+ name: "factory",
56
+ type: "address",
57
+ internalType: "contract KernelFactory"
58
+ },
59
+ { name: "createData", type: "bytes", internalType: "bytes" },
60
+ { name: "salt", type: "bytes32", internalType: "bytes32" }
61
+ ],
62
+ outputs: [{ name: "", type: "address", internalType: "address" }],
63
+ stateMutability: "payable"
64
+ },
65
+ {
66
+ type: "function",
67
+ name: "owner",
68
+ inputs: [],
69
+ outputs: [{ name: "result", type: "address", internalType: "address" }],
70
+ stateMutability: "view"
71
+ },
72
+ {
73
+ type: "function",
74
+ name: "ownershipHandoverExpiresAt",
75
+ inputs: [
76
+ { name: "pendingOwner", type: "address", internalType: "address" }
77
+ ],
78
+ outputs: [{ name: "result", type: "uint256", internalType: "uint256" }],
79
+ stateMutability: "view"
80
+ },
81
+ {
82
+ type: "function",
83
+ name: "renounceOwnership",
84
+ inputs: [],
85
+ outputs: [],
86
+ stateMutability: "payable"
87
+ },
88
+ {
89
+ type: "function",
90
+ name: "requestOwnershipHandover",
91
+ inputs: [],
92
+ outputs: [],
93
+ stateMutability: "payable"
94
+ },
95
+ {
96
+ type: "function",
97
+ name: "stake",
98
+ inputs: [
99
+ {
100
+ name: "entryPoint",
101
+ type: "address",
102
+ internalType: "contract IEntryPoint"
103
+ },
104
+ { name: "unstakeDelay", type: "uint32", internalType: "uint32" }
105
+ ],
106
+ outputs: [],
107
+ stateMutability: "payable"
108
+ },
109
+ {
110
+ type: "function",
111
+ name: "transferOwnership",
112
+ inputs: [
113
+ { name: "newOwner", type: "address", internalType: "address" }
114
+ ],
115
+ outputs: [],
116
+ stateMutability: "payable"
117
+ },
118
+ {
119
+ type: "function",
120
+ name: "unlockStake",
121
+ inputs: [
122
+ {
123
+ name: "entryPoint",
124
+ type: "address",
125
+ internalType: "contract IEntryPoint"
126
+ }
127
+ ],
128
+ outputs: [],
129
+ stateMutability: "payable"
130
+ },
131
+ {
132
+ type: "function",
133
+ name: "withdrawStake",
134
+ inputs: [
135
+ {
136
+ name: "entryPoint",
137
+ type: "address",
138
+ internalType: "contract IEntryPoint"
139
+ },
140
+ {
141
+ name: "recipient",
142
+ type: "address",
143
+ internalType: "address payable"
144
+ }
145
+ ],
146
+ outputs: [],
147
+ stateMutability: "payable"
148
+ },
149
+ {
150
+ type: "event",
151
+ name: "OwnershipHandoverCanceled",
152
+ inputs: [
153
+ {
154
+ name: "pendingOwner",
155
+ type: "address",
156
+ indexed: true,
157
+ internalType: "address"
158
+ }
159
+ ],
160
+ anonymous: false
161
+ },
162
+ {
163
+ type: "event",
164
+ name: "OwnershipHandoverRequested",
165
+ inputs: [
166
+ {
167
+ name: "pendingOwner",
168
+ type: "address",
169
+ indexed: true,
170
+ internalType: "address"
171
+ }
172
+ ],
173
+ anonymous: false
174
+ },
175
+ {
176
+ type: "event",
177
+ name: "OwnershipTransferred",
178
+ inputs: [
179
+ {
180
+ name: "oldOwner",
181
+ type: "address",
182
+ indexed: true,
183
+ internalType: "address"
184
+ },
185
+ {
186
+ name: "newOwner",
187
+ type: "address",
188
+ indexed: true,
189
+ internalType: "address"
190
+ }
191
+ ],
192
+ anonymous: false
193
+ },
194
+ { type: "error", name: "AlreadyInitialized", inputs: [] },
195
+ { type: "error", name: "NewOwnerIsZeroAddress", inputs: [] },
196
+ { type: "error", name: "NoHandoverRequest", inputs: [] },
197
+ { type: "error", name: "NotApprovedFactory", inputs: [] },
198
+ { type: "error", name: "Unauthorized", inputs: [] }
199
+ ] as const
@@ -26,6 +26,7 @@ import {
26
26
  getTypesForEIP712Domain,
27
27
  hashMessage,
28
28
  hashTypedData,
29
+ toHex,
29
30
  validateTypedData,
30
31
  zeroAddress
31
32
  } from "viem"
@@ -42,6 +43,7 @@ import {
42
43
  } from "../utils/toKernelPluginManager.js"
43
44
  import { KernelInitAbi } from "./abi/KernelAccountAbi.js"
44
45
  import { KernelV3InitAbi } from "./abi/kernel_v_3_0_0/KernelAccountAbi.js"
46
+ import { KernelFactoryStakerAbi } from "./abi/kernel_v_3_0_0/KernelFactoryStakerAbi.js"
45
47
  import { encodeCallData as encodeCallDataEpV06 } from "./utils/account/ep0_6/encodeCallData.js"
46
48
  import { encodeDeployCallData as encodeDeployCallDataV06 } from "./utils/account/ep0_6/encodeDeployCallData.js"
47
49
  import { encodeCallData as encodeCallDataEpV07 } from "./utils/account/ep0_7/encodeCallData.js"
@@ -68,6 +70,7 @@ export type CreateKernelAccountParameters<entryPoint extends EntryPoint> = {
68
70
  index?: bigint
69
71
  factoryAddress?: Address
70
72
  accountLogicAddress?: Address
73
+ factoryStakerAddress?: Address
71
74
  deployedAccountAddress?: Address
72
75
  }
73
76
 
@@ -112,13 +115,15 @@ const createAccountAbi = [
112
115
  export const KERNEL_ADDRESSES: {
113
116
  ACCOUNT_LOGIC_V0_6: Address
114
117
  ACCOUNT_LOGIC_V0_7: Address
115
- FACTORY_ADDRESS: Address
116
- ENTRYPOINT_V0_6: Address
118
+ FACTORY_ADDRESS_V0_6: Address
119
+ FACTORY_ADDRESS_V0_7: Address
120
+ FACTORY_STAKER: Address
117
121
  } = {
118
122
  ACCOUNT_LOGIC_V0_6: "0xd3082872F8B06073A021b4602e022d5A070d7cfC",
119
- ACCOUNT_LOGIC_V0_7: "0x541E811D24A54745619a5B9f0c1d4B08D5740144",
120
- FACTORY_ADDRESS: "0x5de4839a76cf55d0c90e2061ef4386d962E15ae3",
121
- ENTRYPOINT_V0_6: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"
123
+ ACCOUNT_LOGIC_V0_7: "0xe59cffb45AFFB215e3823F7D1a207a71C1aa09c3",
124
+ FACTORY_ADDRESS_V0_6: "0x5de4839a76cf55d0c90e2061ef4386d962E15ae3",
125
+ FACTORY_ADDRESS_V0_7: "0x17B6697d81844518365484323e810Be08EaA3A6a",
126
+ FACTORY_STAKER: "0xd703aaE79538628d27099B8c4f621bE4CCd142d5"
122
127
  }
123
128
 
124
129
  const getKernelInitData = async <entryPoint extends EntryPoint>({
@@ -158,12 +163,14 @@ const getAccountInitCode = async <entryPoint extends EntryPoint>({
158
163
  index,
159
164
  factoryAddress,
160
165
  accountLogicAddress,
166
+ factoryStakerAddress,
161
167
  entryPoint: entryPointAddress,
162
168
  kernelPluginManager
163
169
  }: {
164
170
  index: bigint
165
171
  factoryAddress: Address
166
172
  accountLogicAddress: Address
173
+ factoryStakerAddress: Address
167
174
  entryPoint: entryPoint
168
175
  kernelPluginManager: KernelPluginManager<entryPoint>
169
176
  }): Promise<Hex> => {
@@ -172,15 +179,31 @@ const getAccountInitCode = async <entryPoint extends EntryPoint>({
172
179
  entryPoint: entryPointAddress,
173
180
  kernelPluginManager
174
181
  })
182
+ const entryPointVersion = getEntryPointVersion(entryPointAddress)
175
183
 
176
184
  // Build the account init code
185
+ if (entryPointVersion === "v0.6") {
186
+ return concatHex([
187
+ factoryAddress,
188
+ encodeFunctionData({
189
+ abi: createAccountAbi,
190
+ functionName: "createAccount",
191
+ args: [accountLogicAddress, initialisationData, index]
192
+ }) as Hex
193
+ ])
194
+ }
195
+
177
196
  return concatHex([
178
- factoryAddress,
197
+ factoryStakerAddress,
179
198
  encodeFunctionData({
180
- abi: createAccountAbi,
181
- functionName: "createAccount",
182
- args: [accountLogicAddress, initialisationData, index]
183
- }) as Hex
199
+ abi: KernelFactoryStakerAbi,
200
+ functionName: "deployWithFactory",
201
+ args: [
202
+ factoryAddress,
203
+ initialisationData,
204
+ toHex(index, { size: 32 })
205
+ ]
206
+ })
184
207
  ])
185
208
  }
186
209
 
@@ -244,8 +267,9 @@ export async function createKernelAccount<
244
267
  plugins,
245
268
  entryPoint: entryPointAddress,
246
269
  index = 0n,
247
- factoryAddress = KERNEL_ADDRESSES.FACTORY_ADDRESS,
270
+ factoryAddress = KERNEL_ADDRESSES.FACTORY_ADDRESS_V0_6,
248
271
  accountLogicAddress = KERNEL_ADDRESSES.ACCOUNT_LOGIC_V0_6,
272
+ factoryStakerAddress = KERNEL_ADDRESSES.FACTORY_STAKER,
249
273
  deployedAccountAddress
250
274
  }: CreateKernelAccountParameters<entryPoint>
251
275
  ): Promise<KernelSmartAccount<entryPoint, TTransport, TChain>> {
@@ -254,6 +278,10 @@ export async function createKernelAccount<
254
278
  entryPointVersion === "v0.6"
255
279
  ? KERNEL_ADDRESSES.ACCOUNT_LOGIC_V0_6
256
280
  : KERNEL_ADDRESSES.ACCOUNT_LOGIC_V0_7
281
+ factoryAddress =
282
+ entryPointVersion === "v0.6"
283
+ ? KERNEL_ADDRESSES.FACTORY_ADDRESS_V0_6
284
+ : KERNEL_ADDRESSES.FACTORY_ADDRESS_V0_7
257
285
 
258
286
  const kernelPluginManager = isKernelPluginManager<entryPoint>(plugins)
259
287
  ? plugins
@@ -270,6 +298,7 @@ export async function createKernelAccount<
270
298
  index,
271
299
  factoryAddress,
272
300
  accountLogicAddress,
301
+ factoryStakerAddress,
273
302
  entryPoint: entryPointAddress,
274
303
  kernelPluginManager
275
304
  })
@@ -331,7 +360,11 @@ export async function createKernelAccount<
331
360
 
332
361
  if (smartAccountDeployed) return undefined
333
362
 
334
- return factoryAddress
363
+ const entryPointVersion =
364
+ getEntryPointVersion(entryPointAddress)
365
+ return entryPointVersion === "v0.6"
366
+ ? factoryAddress
367
+ : factoryStakerAddress
335
368
  },
336
369
 
337
370
  async getFactoryData() {
@@ -0,0 +1,26 @@
1
+ import type { Account, Chain, Client, Transport } from "viem"
2
+ import type { Prettify } from "viem/chains"
3
+ import type { ZeroDevAccountClientRpcSchema } from "../../types/kernel.js"
4
+
5
+ export type GetUserOperationGasPriceReturnType = {
6
+ maxFeePerGas: bigint
7
+ maxPriorityFeePerGas: bigint
8
+ }
9
+
10
+ export const getUserOperationGasPrice = async <
11
+ TTransport extends Transport = Transport,
12
+ TChain extends Chain | undefined = Chain | undefined,
13
+ TAccount extends Account | undefined = Account | undefined
14
+ >(
15
+ client: Client<TTransport, TChain, TAccount, ZeroDevAccountClientRpcSchema>
16
+ ): Promise<Prettify<GetUserOperationGasPriceReturnType>> => {
17
+ const gasPrice = await client.request({
18
+ method: "zd_getUserOperationGasPrice",
19
+ params: []
20
+ })
21
+
22
+ return {
23
+ maxFeePerGas: BigInt(gasPrice.standard.maxFeePerGas),
24
+ maxPriorityFeePerGas: BigInt(gasPrice.standard.maxPriorityFeePerGas)
25
+ }
26
+ }
package/actions/index.ts CHANGED
@@ -10,6 +10,11 @@ export {
10
10
  type SignUserOperationReturnType
11
11
  } from "./account-client/signUserOperation.js"
12
12
 
13
+ export {
14
+ getUserOperationGasPrice,
15
+ type GetUserOperationGasPriceReturnType
16
+ } from "./account-client/getUserOperationGasPrice.js"
17
+
13
18
  export {
14
19
  estimateGasInERC20,
15
20
  type EstimateGasInERC20Parameters,
@@ -1,3 +1,4 @@
1
+ import { ENTRYPOINT_ADDRESS_V06 } from "permissionless"
1
2
  import type { EntryPoint } from "permissionless/types"
2
3
  import type {
3
4
  UserOperation,
@@ -5,7 +6,6 @@ import type {
5
6
  } from "permissionless/types/userOperation.js"
6
7
  import { deepHexlify } from "permissionless/utils"
7
8
  import type { Address, Hex } from "viem"
8
- import { KERNEL_ADDRESSES } from "../../accounts/index.js"
9
9
  import type { ZeroDevPaymasterClient } from "../../clients/paymasterClient.js"
10
10
 
11
11
  export type EstimateGasInERC20Parameters = {
@@ -40,8 +40,7 @@ export const estimateGasInERC20 = async <entryPoint extends EntryPoint>(
40
40
  args.userOperation
41
41
  ) as UserOperationWithBigIntAsHex<"v0.6">,
42
42
  tokenAddress: args.gasTokenAddress,
43
- entryPointAddress:
44
- args.entryPoint ?? KERNEL_ADDRESSES.ENTRYPOINT_V0_6
43
+ entryPointAddress: args.entryPoint ?? ENTRYPOINT_ADDRESS_V06
45
44
  }
46
45
  ]
47
46
  })
@@ -1,8 +1,12 @@
1
1
  import { type SmartAccountActions, smartAccountActions } from "permissionless"
2
2
  import type { SmartAccount } from "permissionless/accounts/types"
3
3
  import { type Middleware } from "permissionless/actions/smartAccount"
4
- import type { EntryPoint } from "permissionless/types"
4
+ import type { EntryPoint, Prettify } from "permissionless/types"
5
5
  import type { Chain, Client, Transport } from "viem"
6
+ import {
7
+ type GetUserOperationGasPriceReturnType,
8
+ getUserOperationGasPrice
9
+ } from "../../actions/account-client/getUserOperationGasPrice.js"
6
10
  import type {
7
11
  SignUserOperationParameters,
8
12
  SignUserOperationReturnType
@@ -72,6 +76,14 @@ export type KernelAccountClientActions<
72
76
  >
73
77
  >[1]
74
78
  ) => Promise<SignUserOperationReturnType>
79
+ /**
80
+ * Returns the live gas prices that you can use to send a user operation.
81
+ *
82
+ * @returns maxFeePerGas & maxPriorityFeePerGas {@link GetUserOperationGasPriceReturnType}
83
+ */
84
+ getUserOperationGasPrice: () => Promise<
85
+ Prettify<GetUserOperationGasPriceReturnType>
86
+ >
75
87
  }
76
88
 
77
89
  export const kernelAccountClientActions =
@@ -93,5 +105,6 @@ export const kernelAccountClientActions =
93
105
  ...args,
94
106
  middleware
95
107
  } as SignUserOperationParameters<entryPoint, TSmartAccount>
96
- )
108
+ ),
109
+ getUserOperationGasPrice: async () => getUserOperationGasPrice(client)
97
110
  })
@@ -1,3 +1,4 @@
1
+ import { ENTRYPOINT_ADDRESS_V07 } from "permissionless"
1
2
  import type { SmartAccount } from "permissionless/accounts/types"
2
3
  import type { Middleware } from "permissionless/actions/smartAccount"
3
4
  import type { EntryPoint, Prettify } from "permissionless/types"
@@ -10,6 +11,7 @@ import {
10
11
  createClient
11
12
  } from "viem"
12
13
  import { type KernelSmartAccount } from "../accounts/index.js"
14
+ import { getUserOperationGasPrice } from "../actions/account-client/getUserOperationGasPrice.js"
13
15
  import {
14
16
  type KernelAccountClientActions,
15
17
  kernelAccountClientActions
@@ -79,9 +81,22 @@ export const createKernelAccountClient = <
79
81
  type: "kernelAccountClient"
80
82
  })
81
83
 
84
+ let middleware = parameters.middleware
85
+
86
+ if (
87
+ (!middleware ||
88
+ (typeof middleware !== "function" && !middleware.gasPrice)) &&
89
+ parameters.entryPoint === ENTRYPOINT_ADDRESS_V07
90
+ ) {
91
+ const gasPrice = () => getUserOperationGasPrice(client)
92
+ middleware = {
93
+ ...middleware,
94
+ gasPrice
95
+ }
96
+ }
82
97
  return client.extend(
83
98
  kernelAccountClientActions({
84
- middleware: parameters.middleware
99
+ middleware
85
100
  })
86
101
  ) as KernelAccountClient<entryPoint, TTransport, TChain, TSmartAccount>
87
102
  }
package/constants.ts CHANGED
@@ -10,7 +10,7 @@ export const KernelImplToVersionMap: { [key: Address]: string } = {
10
10
  "0xD3F582F6B4814E989Ee8E96bc3175320B5A540ab": "0.2.3",
11
11
  "0x5FC0236D6c88a65beD32EECDC5D60a5CAb377717": "0.2.3",
12
12
  "0xd3082872F8B06073A021b4602e022d5A070d7cfC": "0.2.4",
13
- "0x541E811D24A54745619a5B9f0c1d4B08D5740144": "0.3.0-beta"
13
+ "0xe59cffb45AFFB215e3823F7D1a207a71C1aa09c3": "0.3.0-beta"
14
14
  }
15
15
  export const TOKEN_ACTION = "0x2087C7FfD0d0DAE80a00EE74325aBF3449e0eaf1"
16
16
  export const KERNEL_NAME = "Kernel"
package/index.ts CHANGED
@@ -38,6 +38,8 @@ export {
38
38
  KernelV3ExecuteAbi,
39
39
  KernelV3InitAbi
40
40
  } from "./accounts/kernel/abi/kernel_v_3_0_0/KernelAccountAbi.js"
41
+ export { KernelV3FactoryAbi } from "./accounts/kernel/abi/kernel_v_3_0_0/KernelFactoryAbi.js"
42
+ export { KernelFactoryStakerAbi } from "./accounts/kernel/abi/kernel_v_3_0_0/KernelFactoryStakerAbi.js"
41
43
  export { TokenActionsAbi } from "./accounts/kernel/abi/TokenActionsAbi.js"
42
44
  export * as constants from "./constants.js"
43
45
  export * from "./utils.js"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zerodev/sdk",
3
- "version": "5.2.1-alpha-4",
3
+ "version": "5.2.1-alpha-6",
4
4
  "author": "ZeroDev",
5
5
  "main": "./_cjs/index.js",
6
6
  "module": "./_esm/index.js",
package/types/index.ts CHANGED
@@ -6,7 +6,9 @@ export type {
6
6
  ValidatorInitData,
7
7
  CallType,
8
8
  KernelEncodeCallDataArgs,
9
- PluginValidityData
9
+ PluginValidityData,
10
+ ZeroDevAccountClientRpcSchema,
11
+ ZeroDevUserOperationGasPriceWithBigIntAsHex
10
12
  } from "./kernel.js"
11
13
 
12
14
  export { ValidatorMode } from "./kernel.js"
package/types/kernel.ts CHANGED
@@ -88,6 +88,29 @@ export type ZeroDevPaymasterRpcSchema<entryPoint extends EntryPoint> = [
88
88
  }
89
89
  ]
90
90
 
91
+ export type ZeroDevUserOperationGasPriceWithBigIntAsHex = {
92
+ slow: {
93
+ maxFeePerGas: Hex
94
+ maxPriorityFeePerGas: Hex
95
+ }
96
+ standard: {
97
+ maxFeePerGas: Hex
98
+ maxPriorityFeePerGas: Hex
99
+ }
100
+ fast: {
101
+ maxFeePerGas: Hex
102
+ maxPriorityFeePerGas: Hex
103
+ }
104
+ }
105
+
106
+ export type ZeroDevAccountClientRpcSchema = [
107
+ {
108
+ Method: "zd_getUserOperationGasPrice"
109
+ Parameters: []
110
+ ReturnType: ZeroDevUserOperationGasPriceWithBigIntAsHex
111
+ }
112
+ ]
113
+
91
114
  export type ValidatorType = Extract<
92
115
  keyof typeof VALIDATOR_TYPE,
93
116
  "PERMISSION" | "SECONDARY"
package/utils.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { getEntryPointVersion } from "permissionless"
1
+ import { ENTRYPOINT_ADDRESS_V06, getEntryPointVersion } from "permissionless"
2
2
  import type { EntryPoint } from "permissionless/types/entrypoint"
3
3
  import { satisfies } from "semver"
4
4
  import {
@@ -13,7 +13,6 @@ import {
13
13
  signatureToHex,
14
14
  zeroAddress
15
15
  } from "viem"
16
- import { KERNEL_ADDRESSES } from "./accounts/index.js"
17
16
  import type { ZeroDevPaymasterClient } from "./clients/paymasterClient.js"
18
17
  import {
19
18
  CALL_TYPE,
@@ -73,7 +72,7 @@ export const getERC20PaymasterApproveCall = async (
73
72
  params: [
74
73
  {
75
74
  chainId: client.chain?.id as number,
76
- entryPointAddress: KERNEL_ADDRESSES.ENTRYPOINT_V0_6
75
+ entryPointAddress: ENTRYPOINT_ADDRESS_V06
77
76
  }
78
77
  ]
79
78
  })