@zerodev/sdk 5.3.25 → 5.4.0-beta.0

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 (320) hide show
  1. package/_cjs/accounts/index.js.map +1 -1
  2. package/_cjs/accounts/kernel/createKernelAccount.js +171 -199
  3. package/_cjs/accounts/kernel/createKernelAccount.js.map +1 -1
  4. package/_cjs/accounts/kernel/utils/account/ep0_6/encodeCallData.js +13 -9
  5. package/_cjs/accounts/kernel/utils/account/ep0_6/encodeCallData.js.map +1 -1
  6. package/_cjs/accounts/kernel/utils/account/ep0_6/encodeDeployCallData.js.map +1 -1
  7. package/_cjs/accounts/kernel/utils/account/ep0_6/encodeModuleInstallCallData.js +18 -17
  8. package/_cjs/accounts/kernel/utils/account/ep0_6/encodeModuleInstallCallData.js.map +1 -1
  9. package/_cjs/accounts/kernel/utils/account/ep0_7/encodeCallData.js +12 -8
  10. package/_cjs/accounts/kernel/utils/account/ep0_7/encodeCallData.js.map +1 -1
  11. package/_cjs/accounts/kernel/utils/account/ep0_7/encodeDeployCallData.js.map +1 -1
  12. package/_cjs/accounts/kernel/utils/common/accountMetadata.js.map +1 -1
  13. package/_cjs/accounts/kernel/utils/common/getActionSelector.js +2 -2
  14. package/_cjs/accounts/kernel/utils/common/getActionSelector.js.map +1 -1
  15. package/_cjs/accounts/kernel/utils/ep0_6/encodeExecuteBatchCall.js +2 -2
  16. package/_cjs/accounts/kernel/utils/ep0_6/encodeExecuteBatchCall.js.map +1 -1
  17. package/_cjs/accounts/kernel/utils/ep0_6/encodeExecuteDelegateCall.js +1 -1
  18. package/_cjs/accounts/kernel/utils/ep0_6/encodeExecuteDelegateCall.js.map +1 -1
  19. package/_cjs/accounts/kernel/utils/ep0_6/encodeExecuteSingleCall.js +1 -1
  20. package/_cjs/accounts/kernel/utils/ep0_6/encodeExecuteSingleCall.js.map +1 -1
  21. package/_cjs/accounts/kernel/utils/ep0_7/encodeExecuteBatchCall.js +2 -2
  22. package/_cjs/accounts/kernel/utils/ep0_7/encodeExecuteBatchCall.js.map +1 -1
  23. package/_cjs/accounts/kernel/utils/ep0_7/encodeExecuteCall.js +2 -2
  24. package/_cjs/accounts/kernel/utils/ep0_7/encodeExecuteCall.js.map +1 -1
  25. package/_cjs/accounts/kernel/utils/plugins/ep0_6/getEncodedPluginsData.js.map +1 -1
  26. package/_cjs/accounts/kernel/utils/plugins/ep0_6/getPluginsEnableTypedData.js.map +1 -1
  27. package/_cjs/accounts/kernel/utils/plugins/ep0_7/getPluginsEnableTypedData.js.map +1 -1
  28. package/_cjs/accounts/kernel/v1/createKernelAccountV1.js +81 -94
  29. package/_cjs/accounts/kernel/v1/createKernelAccountV1.js.map +1 -1
  30. package/_cjs/accounts/kernel/v2/createKernelAccountV0_2.js +104 -110
  31. package/_cjs/accounts/kernel/v2/createKernelAccountV0_2.js.map +1 -1
  32. package/_cjs/accounts/utils/getCustomNonceKeyFromString.js +2 -4
  33. package/_cjs/accounts/utils/getCustomNonceKeyFromString.js.map +1 -1
  34. package/_cjs/accounts/utils/index.js +1 -7
  35. package/_cjs/accounts/utils/index.js.map +1 -1
  36. package/_cjs/accounts/utils/multisend.js.map +1 -1
  37. package/_cjs/accounts/utils/toKernelPluginManager.js +14 -16
  38. package/_cjs/accounts/utils/toKernelPluginManager.js.map +1 -1
  39. package/_cjs/actions/account-client/changeSudoValidator.js +27 -21
  40. package/_cjs/actions/account-client/changeSudoValidator.js.map +1 -1
  41. package/_cjs/actions/account-client/getKernelV3ModuleCurrentNonce.js +8 -6
  42. package/_cjs/actions/account-client/getKernelV3ModuleCurrentNonce.js.map +1 -1
  43. package/_cjs/actions/account-client/invalidateNonce.js +20 -15
  44. package/_cjs/actions/account-client/invalidateNonce.js.map +1 -1
  45. package/_cjs/actions/account-client/sendTransaction.js +42 -0
  46. package/_cjs/actions/account-client/sendTransaction.js.map +1 -0
  47. package/_cjs/actions/account-client/signMessage.js +15 -0
  48. package/_cjs/actions/account-client/signMessage.js.map +1 -0
  49. package/_cjs/actions/account-client/signTypedData.js +32 -0
  50. package/_cjs/actions/account-client/signTypedData.js.map +1 -0
  51. package/_cjs/actions/account-client/signUserOperation.js +7 -5
  52. package/_cjs/actions/account-client/signUserOperation.js.map +1 -1
  53. package/_cjs/actions/account-client/uninstallPlugin.js +13 -12
  54. package/_cjs/actions/account-client/uninstallPlugin.js.map +1 -1
  55. package/_cjs/actions/account-client/writeContract.js +21 -0
  56. package/_cjs/actions/account-client/writeContract.js.map +1 -0
  57. package/_cjs/actions/index.js +13 -3
  58. package/_cjs/actions/index.js.map +1 -1
  59. package/_cjs/actions/paymaster/estimateGasInERC20.js +4 -4
  60. package/_cjs/actions/paymaster/estimateGasInERC20.js.map +1 -1
  61. package/_cjs/actions/paymaster/sponsorUserOperation.js +4 -6
  62. package/_cjs/actions/paymaster/sponsorUserOperation.js.map +1 -1
  63. package/_cjs/actions/public/getAccountNonce.js +38 -0
  64. package/_cjs/actions/public/getAccountNonce.js.map +1 -0
  65. package/_cjs/actions/public/getSenderAddress.js +166 -0
  66. package/_cjs/actions/public/getSenderAddress.js.map +1 -0
  67. package/_cjs/actions/public/index.js +8 -0
  68. package/_cjs/actions/public/index.js.map +1 -0
  69. package/_cjs/clients/decorators/kernel.js +17 -27
  70. package/_cjs/clients/decorators/kernel.js.map +1 -1
  71. package/_cjs/clients/fallbackKernelAccountClient.js.map +1 -1
  72. package/_cjs/clients/kernelAccountClient.js +27 -45
  73. package/_cjs/clients/kernelAccountClient.js.map +1 -1
  74. package/_cjs/clients/paymasterClient.js +7 -18
  75. package/_cjs/clients/paymasterClient.js.map +1 -1
  76. package/_cjs/errors/index.js +18 -0
  77. package/_cjs/errors/index.js.map +1 -0
  78. package/_cjs/gasTokenAddresses.js +2 -1
  79. package/_cjs/gasTokenAddresses.js.map +1 -1
  80. package/_cjs/index.js.map +1 -1
  81. package/_cjs/providers/KernelEIP1193Provider.js.map +1 -1
  82. package/_cjs/types/kernel.js.map +1 -1
  83. package/_cjs/utils.js +27 -7
  84. package/_cjs/utils.js.map +1 -1
  85. package/_esm/accounts/index.js.map +1 -1
  86. package/_esm/accounts/kernel/createKernelAccount.js +181 -217
  87. package/_esm/accounts/kernel/createKernelAccount.js.map +1 -1
  88. package/_esm/accounts/kernel/utils/account/ep0_6/encodeCallData.js +13 -9
  89. package/_esm/accounts/kernel/utils/account/ep0_6/encodeCallData.js.map +1 -1
  90. package/_esm/accounts/kernel/utils/account/ep0_6/encodeDeployCallData.js.map +1 -1
  91. package/_esm/accounts/kernel/utils/account/ep0_6/encodeModuleInstallCallData.js +18 -17
  92. package/_esm/accounts/kernel/utils/account/ep0_6/encodeModuleInstallCallData.js.map +1 -1
  93. package/_esm/accounts/kernel/utils/account/ep0_7/encodeCallData.js +12 -8
  94. package/_esm/accounts/kernel/utils/account/ep0_7/encodeCallData.js.map +1 -1
  95. package/_esm/accounts/kernel/utils/account/ep0_7/encodeDeployCallData.js.map +1 -1
  96. package/_esm/accounts/kernel/utils/common/accountMetadata.js.map +1 -1
  97. package/_esm/accounts/kernel/utils/common/getActionSelector.js +2 -2
  98. package/_esm/accounts/kernel/utils/common/getActionSelector.js.map +1 -1
  99. package/_esm/accounts/kernel/utils/ep0_6/encodeExecuteBatchCall.js +2 -2
  100. package/_esm/accounts/kernel/utils/ep0_6/encodeExecuteBatchCall.js.map +1 -1
  101. package/_esm/accounts/kernel/utils/ep0_6/encodeExecuteDelegateCall.js +1 -1
  102. package/_esm/accounts/kernel/utils/ep0_6/encodeExecuteDelegateCall.js.map +1 -1
  103. package/_esm/accounts/kernel/utils/ep0_6/encodeExecuteSingleCall.js +1 -1
  104. package/_esm/accounts/kernel/utils/ep0_6/encodeExecuteSingleCall.js.map +1 -1
  105. package/_esm/accounts/kernel/utils/ep0_7/encodeExecuteBatchCall.js +2 -2
  106. package/_esm/accounts/kernel/utils/ep0_7/encodeExecuteBatchCall.js.map +1 -1
  107. package/_esm/accounts/kernel/utils/ep0_7/encodeExecuteCall.js +2 -2
  108. package/_esm/accounts/kernel/utils/ep0_7/encodeExecuteCall.js.map +1 -1
  109. package/_esm/accounts/kernel/utils/plugins/ep0_6/getEncodedPluginsData.js.map +1 -1
  110. package/_esm/accounts/kernel/utils/plugins/ep0_6/getPluginsEnableTypedData.js.map +1 -1
  111. package/_esm/accounts/kernel/utils/plugins/ep0_7/getPluginsEnableTypedData.js.map +1 -1
  112. package/_esm/accounts/kernel/v1/createKernelAccountV1.js +91 -98
  113. package/_esm/accounts/kernel/v1/createKernelAccountV1.js.map +1 -1
  114. package/_esm/accounts/kernel/v2/createKernelAccountV0_2.js +105 -118
  115. package/_esm/accounts/kernel/v2/createKernelAccountV0_2.js.map +1 -1
  116. package/_esm/accounts/utils/getCustomNonceKeyFromString.js +2 -4
  117. package/_esm/accounts/utils/getCustomNonceKeyFromString.js.map +1 -1
  118. package/_esm/accounts/utils/index.js +0 -5
  119. package/_esm/accounts/utils/index.js.map +1 -1
  120. package/_esm/accounts/utils/multisend.js.map +1 -1
  121. package/_esm/accounts/utils/toKernelPluginManager.js +14 -16
  122. package/_esm/accounts/utils/toKernelPluginManager.js.map +1 -1
  123. package/_esm/actions/account-client/changeSudoValidator.js +23 -17
  124. package/_esm/actions/account-client/changeSudoValidator.js.map +1 -1
  125. package/_esm/actions/account-client/getKernelV3ModuleCurrentNonce.js +8 -6
  126. package/_esm/actions/account-client/getKernelV3ModuleCurrentNonce.js.map +1 -1
  127. package/_esm/actions/account-client/invalidateNonce.js +20 -15
  128. package/_esm/actions/account-client/invalidateNonce.js.map +1 -1
  129. package/_esm/actions/account-client/sendTransaction.js +85 -0
  130. package/_esm/actions/account-client/sendTransaction.js.map +1 -0
  131. package/_esm/actions/account-client/signMessage.js +58 -0
  132. package/_esm/actions/account-client/signMessage.js.map +1 -0
  133. package/_esm/actions/account-client/signTypedData.js +127 -0
  134. package/_esm/actions/account-client/signTypedData.js.map +1 -0
  135. package/_esm/actions/account-client/signUserOperation.js +7 -5
  136. package/_esm/actions/account-client/signUserOperation.js.map +1 -1
  137. package/_esm/actions/account-client/uninstallPlugin.js +10 -9
  138. package/_esm/actions/account-client/uninstallPlugin.js.map +1 -1
  139. package/_esm/actions/account-client/writeContract.js +18 -0
  140. package/_esm/actions/account-client/writeContract.js.map +1 -0
  141. package/_esm/actions/index.js +6 -1
  142. package/_esm/actions/index.js.map +1 -1
  143. package/_esm/actions/paymaster/estimateGasInERC20.js +3 -3
  144. package/_esm/actions/paymaster/estimateGasInERC20.js.map +1 -1
  145. package/_esm/actions/paymaster/sponsorUserOperation.js +3 -5
  146. package/_esm/actions/paymaster/sponsorUserOperation.js.map +1 -1
  147. package/_esm/actions/public/getAccountNonce.js +61 -0
  148. package/_esm/actions/public/getAccountNonce.js.map +1 -0
  149. package/_esm/actions/public/getSenderAddress.js +191 -0
  150. package/_esm/actions/public/getSenderAddress.js.map +1 -0
  151. package/_esm/actions/public/index.js +3 -0
  152. package/_esm/actions/public/index.js.map +1 -0
  153. package/_esm/clients/decorators/kernel.js +19 -28
  154. package/_esm/clients/decorators/kernel.js.map +1 -1
  155. package/_esm/clients/fallbackKernelAccountClient.js.map +1 -1
  156. package/_esm/clients/kernelAccountClient.js +28 -46
  157. package/_esm/clients/kernelAccountClient.js.map +1 -1
  158. package/_esm/clients/paymasterClient.js +8 -19
  159. package/_esm/clients/paymasterClient.js.map +1 -1
  160. package/_esm/errors/index.js +14 -0
  161. package/_esm/errors/index.js.map +1 -0
  162. package/_esm/gasTokenAddresses.js +2 -1
  163. package/_esm/gasTokenAddresses.js.map +1 -1
  164. package/_esm/index.js.map +1 -1
  165. package/_esm/providers/KernelEIP1193Provider.js.map +1 -1
  166. package/_esm/types/kernel.js.map +1 -1
  167. package/_esm/utils.js +29 -7
  168. package/_esm/utils.js.map +1 -1
  169. package/_types/accounts/index.d.ts +2 -2
  170. package/_types/accounts/index.d.ts.map +1 -1
  171. package/_types/accounts/kernel/createKernelAccount.d.ts +21 -18
  172. package/_types/accounts/kernel/createKernelAccount.d.ts.map +1 -1
  173. package/_types/accounts/kernel/utils/account/ep0_6/encodeCallData.d.ts +8 -3
  174. package/_types/accounts/kernel/utils/account/ep0_6/encodeCallData.d.ts.map +1 -1
  175. package/_types/accounts/kernel/utils/account/ep0_6/encodeDeployCallData.d.ts +3 -2
  176. package/_types/accounts/kernel/utils/account/ep0_6/encodeDeployCallData.d.ts.map +1 -1
  177. package/_types/accounts/kernel/utils/account/ep0_6/encodeModuleInstallCallData.d.ts +0 -1
  178. package/_types/accounts/kernel/utils/account/ep0_6/encodeModuleInstallCallData.d.ts.map +1 -1
  179. package/_types/accounts/kernel/utils/account/ep0_7/encodeCallData.d.ts +8 -3
  180. package/_types/accounts/kernel/utils/account/ep0_7/encodeCallData.d.ts.map +1 -1
  181. package/_types/accounts/kernel/utils/account/ep0_7/encodeDeployCallData.d.ts +3 -2
  182. package/_types/accounts/kernel/utils/account/ep0_7/encodeDeployCallData.d.ts.map +1 -1
  183. package/_types/accounts/kernel/utils/common/accountMetadata.d.ts +2 -2
  184. package/_types/accounts/kernel/utils/common/accountMetadata.d.ts.map +1 -1
  185. package/_types/accounts/kernel/utils/common/getActionSelector.d.ts +1 -1
  186. package/_types/accounts/kernel/utils/common/getActionSelector.d.ts.map +1 -1
  187. package/_types/accounts/kernel/utils/ep0_6/encodeExecuteBatchCall.d.ts +1 -1
  188. package/_types/accounts/kernel/utils/ep0_6/encodeExecuteBatchCall.d.ts.map +1 -1
  189. package/_types/accounts/kernel/utils/ep0_7/encodeExecuteBatchCall.d.ts +1 -1
  190. package/_types/accounts/kernel/utils/ep0_7/encodeExecuteBatchCall.d.ts.map +1 -1
  191. package/_types/accounts/kernel/utils/plugins/ep0_6/getEncodedPluginsData.d.ts +2 -3
  192. package/_types/accounts/kernel/utils/plugins/ep0_6/getEncodedPluginsData.d.ts.map +1 -1
  193. package/_types/accounts/kernel/utils/plugins/ep0_6/getPluginsEnableTypedData.d.ts +4 -5
  194. package/_types/accounts/kernel/utils/plugins/ep0_6/getPluginsEnableTypedData.d.ts.map +1 -1
  195. package/_types/accounts/kernel/utils/plugins/ep0_7/getPluginsEnableTypedData.d.ts +2 -3
  196. package/_types/accounts/kernel/utils/plugins/ep0_7/getPluginsEnableTypedData.d.ts.map +1 -1
  197. package/_types/accounts/kernel/utils/types.d.ts +2 -2
  198. package/_types/accounts/kernel/utils/types.d.ts.map +1 -1
  199. package/_types/accounts/kernel/v1/createKernelAccountV1.d.ts +18 -9
  200. package/_types/accounts/kernel/v1/createKernelAccountV1.d.ts.map +1 -1
  201. package/_types/accounts/kernel/v2/createKernelAccountV0_2.d.ts +9 -7
  202. package/_types/accounts/kernel/v2/createKernelAccountV0_2.d.ts.map +1 -1
  203. package/_types/accounts/utils/getCustomNonceKeyFromString.d.ts +2 -2
  204. package/_types/accounts/utils/getCustomNonceKeyFromString.d.ts.map +1 -1
  205. package/_types/accounts/utils/index.d.ts +0 -2
  206. package/_types/accounts/utils/index.d.ts.map +1 -1
  207. package/_types/accounts/utils/multisend.d.ts +2 -2
  208. package/_types/accounts/utils/multisend.d.ts.map +1 -1
  209. package/_types/accounts/utils/toKernelPluginManager.d.ts +4 -4
  210. package/_types/accounts/utils/toKernelPluginManager.d.ts.map +1 -1
  211. package/_types/actions/account-client/changeSudoValidator.d.ts +5 -11
  212. package/_types/actions/account-client/changeSudoValidator.d.ts.map +1 -1
  213. package/_types/actions/account-client/getKernelV3ModuleCurrentNonce.d.ts +2 -5
  214. package/_types/actions/account-client/getKernelV3ModuleCurrentNonce.d.ts.map +1 -1
  215. package/_types/actions/account-client/invalidateNonce.d.ts +4 -6
  216. package/_types/actions/account-client/invalidateNonce.d.ts.map +1 -1
  217. package/_types/actions/account-client/sendTransaction.d.ts +50 -0
  218. package/_types/actions/account-client/sendTransaction.d.ts.map +1 -0
  219. package/_types/actions/account-client/signMessage.d.ts +50 -0
  220. package/_types/actions/account-client/signMessage.d.ts.map +1 -0
  221. package/_types/actions/account-client/signTypedData.d.ts +104 -0
  222. package/_types/actions/account-client/signTypedData.d.ts.map +1 -0
  223. package/_types/actions/account-client/signUserOperation.d.ts +4 -6
  224. package/_types/actions/account-client/signUserOperation.d.ts.map +1 -1
  225. package/_types/actions/account-client/uninstallPlugin.d.ts +5 -7
  226. package/_types/actions/account-client/uninstallPlugin.d.ts.map +1 -1
  227. package/_types/actions/account-client/writeContract.d.ts +4 -0
  228. package/_types/actions/account-client/writeContract.d.ts.map +1 -0
  229. package/_types/actions/index.d.ts +6 -1
  230. package/_types/actions/index.d.ts.map +1 -1
  231. package/_types/actions/paymaster/estimateGasInERC20.d.ts +1305 -4
  232. package/_types/actions/paymaster/estimateGasInERC20.d.ts.map +1 -1
  233. package/_types/actions/paymaster/sponsorUserOperation.d.ts +1314 -10
  234. package/_types/actions/paymaster/sponsorUserOperation.d.ts.map +1 -1
  235. package/_types/actions/public/getAccountNonce.d.ts +34 -0
  236. package/_types/actions/public/getAccountNonce.d.ts.map +1 -0
  237. package/_types/actions/public/getSenderAddress.d.ts +46 -0
  238. package/_types/actions/public/getSenderAddress.d.ts.map +1 -0
  239. package/_types/actions/public/index.d.ts +3 -0
  240. package/_types/actions/public/index.d.ts.map +1 -0
  241. package/_types/clients/decorators/kernel.d.ts +774 -20
  242. package/_types/clients/decorators/kernel.d.ts.map +1 -1
  243. package/_types/clients/fallbackKernelAccountClient.d.ts +255 -4
  244. package/_types/clients/fallbackKernelAccountClient.d.ts.map +1 -1
  245. package/_types/clients/kernelAccountClient.d.ts +34 -36
  246. package/_types/clients/kernelAccountClient.d.ts.map +1 -1
  247. package/_types/clients/paymasterClient.d.ts +10 -24
  248. package/_types/clients/paymasterClient.d.ts.map +1 -1
  249. package/_types/errors/index.d.ts +7 -0
  250. package/_types/errors/index.d.ts.map +1 -0
  251. package/_types/gasTokenAddresses.d.ts +1 -1
  252. package/_types/gasTokenAddresses.d.ts.map +1 -1
  253. package/_types/index.d.ts +1 -1
  254. package/_types/index.d.ts.map +1 -1
  255. package/_types/providers/KernelEIP1193Provider.d.ts +3 -4
  256. package/_types/providers/KernelEIP1193Provider.d.ts.map +1 -1
  257. package/_types/types/index.d.ts +1 -0
  258. package/_types/types/index.d.ts.map +1 -1
  259. package/_types/types/kernel.d.ts +25 -27
  260. package/_types/types/kernel.d.ts.map +1 -1
  261. package/_types/utils.d.ts +1310 -4
  262. package/_types/utils.d.ts.map +1 -1
  263. package/accounts/index.ts +5 -2
  264. package/accounts/kernel/createKernelAccount.ts +312 -357
  265. package/accounts/kernel/utils/account/ep0_6/encodeCallData.ts +22 -12
  266. package/accounts/kernel/utils/account/ep0_6/encodeDeployCallData.ts +6 -3
  267. package/accounts/kernel/utils/account/ep0_6/encodeModuleInstallCallData.ts +22 -19
  268. package/accounts/kernel/utils/account/ep0_7/encodeCallData.ts +21 -11
  269. package/accounts/kernel/utils/account/ep0_7/encodeDeployCallData.ts +6 -3
  270. package/accounts/kernel/utils/common/accountMetadata.ts +2 -7
  271. package/accounts/kernel/utils/common/getActionSelector.ts +3 -3
  272. package/accounts/kernel/utils/ep0_6/encodeExecuteBatchCall.ts +3 -3
  273. package/accounts/kernel/utils/ep0_6/encodeExecuteDelegateCall.ts +1 -1
  274. package/accounts/kernel/utils/ep0_6/encodeExecuteSingleCall.ts +1 -1
  275. package/accounts/kernel/utils/ep0_7/encodeExecuteBatchCall.ts +3 -3
  276. package/accounts/kernel/utils/ep0_7/encodeExecuteCall.ts +2 -2
  277. package/accounts/kernel/utils/plugins/ep0_6/getEncodedPluginsData.ts +2 -8
  278. package/accounts/kernel/utils/plugins/ep0_6/getPluginsEnableTypedData.ts +4 -10
  279. package/accounts/kernel/utils/plugins/ep0_7/getPluginsEnableTypedData.ts +2 -8
  280. package/accounts/kernel/utils/types.ts +2 -2
  281. package/accounts/kernel/v1/createKernelAccountV1.ts +147 -174
  282. package/accounts/kernel/v2/createKernelAccountV0_2.ts +135 -179
  283. package/accounts/utils/getCustomNonceKeyFromString.ts +3 -6
  284. package/accounts/utils/index.ts +0 -9
  285. package/accounts/utils/multisend.ts +5 -2
  286. package/accounts/utils/toKernelPluginManager.ts +23 -27
  287. package/actions/account-client/changeSudoValidator.ts +61 -85
  288. package/actions/account-client/getKernelV3ModuleCurrentNonce.ts +12 -51
  289. package/actions/account-client/invalidateNonce.ts +38 -67
  290. package/actions/account-client/sendTransaction.ts +134 -0
  291. package/actions/account-client/signMessage.ts +75 -0
  292. package/actions/account-client/signTypedData.ts +159 -0
  293. package/actions/account-client/signUserOperation.ts +31 -63
  294. package/actions/account-client/uninstallPlugin.ts +35 -54
  295. package/actions/account-client/writeContract.ts +72 -0
  296. package/actions/index.ts +15 -6
  297. package/actions/paymaster/estimateGasInERC20.ts +12 -8
  298. package/actions/paymaster/sponsorUserOperation.ts +52 -50
  299. package/actions/public/getAccountNonce.ts +77 -0
  300. package/actions/public/getSenderAddress.ts +276 -0
  301. package/actions/public/index.ts +9 -0
  302. package/clients/decorators/kernel.ts +363 -159
  303. package/clients/fallbackKernelAccountClient.ts +9 -11
  304. package/clients/kernelAccountClient.ts +142 -104
  305. package/clients/paymasterClient.ts +69 -43
  306. package/errors/index.ts +17 -0
  307. package/gasTokenAddresses.ts +3 -2
  308. package/index.ts +5 -2
  309. package/package.json +2 -3
  310. package/providers/KernelEIP1193Provider.ts +4 -7
  311. package/types/index.ts +2 -0
  312. package/types/kernel.ts +64 -63
  313. package/utils.ts +41 -13
  314. package/_cjs/actions/paymaster/sponsorUserOperationEip7677.js +0 -59
  315. package/_cjs/actions/paymaster/sponsorUserOperationEip7677.js.map +0 -1
  316. package/_esm/actions/paymaster/sponsorUserOperationEip7677.js +0 -58
  317. package/_esm/actions/paymaster/sponsorUserOperationEip7677.js.map +0 -1
  318. package/_types/actions/paymaster/sponsorUserOperationEip7677.d.ts +0 -16
  319. package/_types/actions/paymaster/sponsorUserOperationEip7677.d.ts.map +0 -1
  320. package/actions/paymaster/sponsorUserOperationEip7677.ts +0 -152
@@ -1,43 +1,40 @@
1
1
  import {
2
2
  getAccountNonce,
3
- getEntryPointVersion,
4
- getSenderAddress,
5
- isSmartAccountDeployed
6
- } from "permissionless"
7
- import { SignTransactionNotSupportedBySmartAccount } from "permissionless/accounts"
8
- import type {
9
- ENTRYPOINT_ADDRESS_V06_TYPE,
10
- EntryPoint
11
- } from "permissionless/types"
3
+ getSenderAddress
4
+ } from "../../../actions/public/index.js"
12
5
  import {
13
6
  type Address,
14
7
  type Chain,
15
8
  type Client,
16
9
  type EncodeDeployDataParameters,
17
- type Hash,
18
10
  type Hex,
19
11
  type PublicActions,
20
12
  type PublicRpcSchema,
21
13
  type Transport,
22
14
  type TypedDataDefinition,
23
15
  concatHex,
16
+ createNonceManager,
24
17
  encodeDeployData,
25
18
  encodeFunctionData,
26
19
  getTypesForEIP712Domain,
27
- hashMessage,
28
20
  hashTypedData,
29
21
  parseAbi,
30
22
  validateTypedData
31
23
  } from "viem"
24
+ import {
25
+ type UserOperation,
26
+ entryPoint06Abi,
27
+ entryPoint06Address,
28
+ toSmartAccount
29
+ } from "viem/account-abstraction"
32
30
  import { toAccount } from "viem/accounts"
31
+ import { getChainId } from "viem/actions"
32
+ import { getAction } from "viem/utils"
33
33
  import type {
34
34
  GetKernelVersion,
35
- KernelEncodeCallDataArgs,
36
35
  KernelPluginManager,
37
36
  KernelPluginManagerParams
38
37
  } from "../../../types/kernel.js"
39
- import { wrapSignatureWith6492 } from "../../utils/6492.js"
40
- import { parseFactoryAddressAndCallDataFromAccountInitCode } from "../../utils/index.js"
41
38
  import {
42
39
  MULTISEND_ADDRESS,
43
40
  encodeMultiSend,
@@ -47,7 +44,10 @@ import {
47
44
  isKernelPluginManager,
48
45
  toKernelPluginManager
49
46
  } from "../../utils/toKernelPluginManager.js"
50
- import type { KernelSmartAccount } from "../createKernelAccount.js"
47
+ import type {
48
+ CreateKernelAccountReturnType,
49
+ KernelSmartAccountImplementation
50
+ } from "../createKernelAccount.js"
51
51
  import { KernelAccountV2Abi } from "./abi/KernelAccountV2Abi.js"
52
52
  import { KernelFactoryV2Abi } from "./abi/KernelFactoryV2Abi.js"
53
53
 
@@ -99,35 +99,6 @@ const getAccountInitCode = async ({
99
99
  ])
100
100
  }
101
101
 
102
- /**
103
- * Check the validity of an existing account address, or fetch the pre-deterministic account address for a kernel smart wallet
104
- * @param client
105
- * @param entryPoint
106
- * @param initCodeProvider
107
- */
108
- const getAccountAddress = async <
109
- entryPoint extends EntryPoint,
110
- TTransport extends Transport = Transport,
111
- TChain extends Chain | undefined = Chain | undefined
112
- >({
113
- client,
114
- entryPoint: entryPointAddress,
115
- initCodeProvider
116
- }: {
117
- client: Client<TTransport, TChain, undefined>
118
- initCodeProvider: () => Promise<Hex>
119
- entryPoint: entryPoint
120
- }): Promise<Address> => {
121
- // Find the init code for this account
122
- const initCode = await initCodeProvider()
123
-
124
- // Get the sender address based on the init code
125
- return getSenderAddress(client, {
126
- initCode,
127
- entryPoint: entryPointAddress as ENTRYPOINT_ADDRESS_V06_TYPE
128
- })
129
- }
130
-
131
102
  /**
132
103
  * Build a kernel smart account from a private key, that use the ECDSA signer behind the scene
133
104
  * @param client
@@ -139,7 +110,6 @@ const getAccountAddress = async <
139
110
  * @param deployedAccountAddress
140
111
  */
141
112
  export async function createKernelAccountV0_2<
142
- entryPoint extends EntryPoint,
143
113
  TTransport extends Transport = Transport,
144
114
  TChain extends Chain | undefined = Chain | undefined
145
115
  >(
@@ -152,29 +122,27 @@ export async function createKernelAccountV0_2<
152
122
  >,
153
123
  {
154
124
  plugins,
155
- entryPoint: entryPointAddress,
125
+ entryPoint,
156
126
  index = 0n,
157
127
  factoryAddress = KERNEL_ADDRESSES.FACTORY_ADDRESS,
158
- deployedAccountAddress
128
+ address
159
129
  }: {
160
130
  plugins:
161
131
  | Omit<
162
- KernelPluginManagerParams<entryPoint>,
132
+ KernelPluginManagerParams<"0.6">,
163
133
  "entryPoint" | "kernelVersion"
164
134
  >
165
- | KernelPluginManager<entryPoint>
166
- entryPoint: entryPoint
135
+ | KernelPluginManager<"0.6">
136
+ entryPoint: {
137
+ address: Address
138
+ version: "0.6"
139
+ }
167
140
  index?: bigint
168
141
  factoryAddress?: Address
169
- deployedAccountAddress?: Address
170
- }
171
- ): Promise<KernelSmartAccount<entryPoint, TTransport, TChain>> {
172
- const entryPointVersion = getEntryPointVersion(entryPointAddress)
173
-
174
- if (entryPointVersion !== "v0.6") {
175
- throw new Error("Only EntryPoint 0.6 is supported")
142
+ address?: Address
176
143
  }
177
- const kernelPluginManager = isKernelPluginManager<entryPoint>(plugins)
144
+ ): Promise<CreateKernelAccountReturnType<"0.6">> {
145
+ const kernelPluginManager = isKernelPluginManager<"0.6">(plugins)
178
146
  ? plugins
179
147
  : await toKernelPluginManager(client, {
180
148
  sudo: plugins.sudo,
@@ -182,7 +150,7 @@ export async function createKernelAccountV0_2<
182
150
  action: plugins.action,
183
151
  pluginEnableSignature: plugins.pluginEnableSignature,
184
152
  kernelVersion: "0.0.2",
185
- entryPoint: entryPointAddress
153
+ entryPoint
186
154
  })
187
155
  // Helper to generate the init code for the smart account
188
156
  const generateInitCode = async () => {
@@ -196,97 +164,86 @@ export async function createKernelAccountV0_2<
196
164
  })
197
165
  }
198
166
 
199
- // Fetch account address and chain id
200
- const accountAddress =
201
- deployedAccountAddress ??
202
- (await getAccountAddress<entryPoint, TTransport, TChain>({
203
- client,
204
- entryPoint: entryPointAddress,
205
- initCodeProvider: generateInitCode
206
- }))
167
+ const getFactoryArgs = async () => {
168
+ return {
169
+ factory: factoryAddress,
170
+ factoryData: await generateInitCode()
171
+ }
172
+ }
207
173
 
208
- if (!accountAddress) throw new Error("Account address not found")
174
+ // Fetch account address
175
+ let accountAddress =
176
+ address ??
177
+ (await (async () => {
178
+ const { factory, factoryData } = await getFactoryArgs()
179
+
180
+ // Get the sender address based on the init code
181
+ return await getSenderAddress(client, {
182
+ factory,
183
+ factoryData,
184
+ entryPointAddress: entryPoint.address
185
+ })
186
+ })())
209
187
 
210
188
  // Build the EOA Signer
211
189
  const account = toAccount({
212
190
  address: accountAddress,
213
191
  async signMessage({ message }) {
214
- const messageHash = hashMessage(message)
215
- const [isDeployed, signature] = await Promise.all([
216
- isSmartAccountDeployed(client, accountAddress),
217
- kernelPluginManager.signMessage({
218
- message: {
219
- raw: messageHash
220
- }
221
- })
222
- ])
223
- return create6492Signature(isDeployed, signature)
192
+ return kernelPluginManager.signMessage({
193
+ message
194
+ })
224
195
  },
225
196
  async signTransaction(_, __) {
226
- throw new SignTransactionNotSupportedBySmartAccount()
197
+ throw new Error(
198
+ "Smart account signer doesn't need to sign transactions"
199
+ )
227
200
  },
228
201
  async signTypedData(typedData) {
202
+ const _typedData = typedData as TypedDataDefinition
229
203
  const types = {
230
204
  EIP712Domain: getTypesForEIP712Domain({
231
- domain: typedData.domain
205
+ domain: _typedData.domain
232
206
  }),
233
- ...typedData.types
207
+ ..._typedData.types
234
208
  }
235
209
 
236
210
  // Need to do a runtime validation check on addresses, byte ranges, integer ranges, etc
237
211
  // as we can't statically check this with TypeScript.
238
212
  validateTypedData({
239
- domain: typedData.domain,
240
- message: typedData.message,
241
- primaryType: typedData.primaryType,
213
+ domain: _typedData.domain,
214
+ message: _typedData.message,
215
+ primaryType: _typedData.primaryType,
242
216
  types: types
243
- } as TypedDataDefinition)
217
+ })
244
218
 
245
219
  const typedHash = hashTypedData(typedData)
246
- const [isDeployed, signature] = await Promise.all([
247
- isSmartAccountDeployed(client, accountAddress),
248
- kernelPluginManager.signMessage({
249
- message: {
250
- raw: typedHash
251
- }
252
- })
253
- ])
254
- return create6492Signature(isDeployed, signature)
220
+ return kernelPluginManager.signMessage({
221
+ message: {
222
+ raw: typedHash
223
+ }
224
+ })
255
225
  }
256
226
  })
257
227
 
258
- let smartAccountDeployed = await isSmartAccountDeployed(
259
- client,
260
- accountAddress
261
- )
262
-
263
- const create6492Signature = async (
264
- isDeployed: boolean,
265
- signature: Hash
266
- ): Promise<Hash> => {
267
- if (isDeployed) {
268
- return signature
269
- }
270
-
271
- const [factoryAddress, factoryCalldata] =
272
- parseFactoryAddressAndCallDataFromAccountInitCode(
273
- await generateInitCode()
274
- )
275
-
276
- return wrapSignatureWith6492({
277
- factoryAddress,
278
- factoryCalldata,
279
- signature
280
- })
228
+ const _entryPoint = {
229
+ address: entryPoint?.address ?? entryPoint06Address,
230
+ abi: entryPoint06Abi,
231
+ version: entryPoint?.version ?? "0.6"
232
+ }
233
+ let chainId: number
234
+
235
+ const getMemoizedChainId = async () => {
236
+ if (chainId) return chainId
237
+ chainId = client.chain
238
+ ? client.chain.id
239
+ : await getAction(client, getChainId, "getChainId")({})
240
+ return chainId
281
241
  }
282
242
 
283
- return {
284
- ...account,
285
- kernelVersion: "0.0.2" as GetKernelVersion<entryPoint>,
243
+ return toSmartAccount<KernelSmartAccountImplementation<"0.6">>({
244
+ kernelVersion: "0.0.2" as GetKernelVersion<"0.6">,
286
245
  client: client,
287
- publicKey: accountAddress,
288
- entryPoint: entryPointAddress,
289
- source: "kernelSmartAccount",
246
+ entryPoint: _entryPoint,
290
247
  kernelPluginManager,
291
248
  generateInitCode,
292
249
  encodeModuleInstallCallData: async () => {
@@ -294,65 +251,54 @@ export async function createKernelAccountV0_2<
294
251
  accountAddress
295
252
  )
296
253
  },
297
- async getFactory() {
298
- if (smartAccountDeployed) return undefined
299
-
300
- smartAccountDeployed = await isSmartAccountDeployed(
301
- client,
302
- accountAddress
303
- )
304
-
305
- if (smartAccountDeployed) return undefined
306
-
307
- return factoryAddress
254
+ nonceKeyManager: createNonceManager({source: {get: () => 0, set: () => {}}}),
255
+ async sign({ hash }) {
256
+ return account.signMessage({ message: hash })
308
257
  },
258
+ async signMessage(message) {
259
+ return account.signMessage(message)
260
+ },
261
+ async signTypedData(typedData) {
262
+ return account.signTypedData(typedData)
263
+ },
264
+ getFactoryArgs,
265
+ async getAddress() {
266
+ if (accountAddress) return accountAddress
309
267
 
310
- async getFactoryData() {
311
- if (smartAccountDeployed) return undefined
312
-
313
- smartAccountDeployed = await isSmartAccountDeployed(
314
- client,
315
- accountAddress
316
- )
268
+ const { factory, factoryData } = await getFactoryArgs()
317
269
 
318
- if (smartAccountDeployed) return undefined
270
+ // Get the sender address based on the init code
271
+ accountAddress = await getSenderAddress(client, {
272
+ factory,
273
+ factoryData,
274
+ entryPointAddress: entryPoint.address
275
+ })
319
276
 
320
- return parseFactoryAddressAndCallDataFromAccountInitCode(
321
- await generateInitCode()
322
- )[1]
277
+ return accountAddress
323
278
  },
324
-
325
279
  // Get the nonce of the smart account
326
- async getNonce(customNonceKey?: bigint) {
280
+ async getNonce(_args) {
327
281
  const key = await kernelPluginManager.getNonceKey(
328
282
  accountAddress,
329
- customNonceKey
283
+ _args?.key
330
284
  )
331
285
  return getAccountNonce(client, {
332
- sender: accountAddress,
333
- entryPoint: entryPointAddress,
286
+ address: accountAddress,
287
+ entryPointAddress: entryPoint.address,
334
288
  key
335
289
  })
336
290
  },
337
291
 
338
292
  // Sign a user operation
339
- async signUserOperation(userOperation) {
340
- return kernelPluginManager.signUserOperation(userOperation)
341
- },
342
-
343
- // Encode the init code
344
- async getInitCode() {
345
- if (smartAccountDeployed) return "0x"
346
-
347
- smartAccountDeployed = await isSmartAccountDeployed(
348
- client,
349
- accountAddress
350
- )
351
-
352
- if (smartAccountDeployed) return "0x"
353
- return generateInitCode()
293
+ async signUserOperation(parameters) {
294
+ const { chainId = await getMemoizedChainId(), ...userOperation } =
295
+ parameters
296
+ return kernelPluginManager.signUserOperation({
297
+ ...userOperation,
298
+ sender: userOperation.sender ?? (await this.getAddress()),
299
+ chainId
300
+ })
354
301
  },
355
-
356
302
  // Encode the deploy call data
357
303
  async encodeDeployCallData(_tx) {
358
304
  return encodeFunctionData({
@@ -379,13 +325,12 @@ export async function createKernelAccountV0_2<
379
325
  },
380
326
 
381
327
  // Encode a call
382
- async encodeCallData(_tx) {
383
- const tx = _tx as KernelEncodeCallDataArgs
384
- if (Array.isArray(tx)) {
328
+ async encodeCalls(calls, callType): Promise<Hex> {
329
+ if (calls.length > 1) {
385
330
  const multiSendCallData = encodeFunctionData({
386
331
  abi: multiSendAbi,
387
332
  functionName: "multiSend",
388
- args: [encodeMultiSend(tx)]
333
+ args: [encodeMultiSend(calls)]
389
334
  })
390
335
  return encodeFunctionData({
391
336
  abi: KernelAccountV2Abi,
@@ -394,23 +339,29 @@ export async function createKernelAccountV0_2<
394
339
  })
395
340
  }
396
341
 
342
+ const call = calls.length === 0 ? undefined : calls[0]
343
+
344
+ if (!call) {
345
+ throw new Error("No calls to encode")
346
+ }
347
+
397
348
  // Default to `call`
398
- if (!tx.callType || tx.callType === "call") {
399
- if (tx.to.toLowerCase() === accountAddress.toLowerCase()) {
400
- return tx.data
349
+ if (!callType || callType === "call") {
350
+ if (call.to.toLowerCase() === accountAddress.toLowerCase()) {
351
+ return call.data || "0x"
401
352
  }
402
353
  return encodeFunctionData({
403
354
  abi: KernelAccountV2Abi,
404
355
  functionName: "execute",
405
- args: [tx.to, tx.value, tx.data, 0]
356
+ args: [call.to, call.value || 0n, call.data || "0x", 0]
406
357
  })
407
358
  }
408
359
 
409
- if (tx.callType === "delegatecall") {
360
+ if (callType === "delegatecall") {
410
361
  return encodeFunctionData({
411
362
  abi: KernelAccountV2Abi,
412
363
  functionName: "execute",
413
- args: [tx.to, 0n, tx.data, 1]
364
+ args: [call.to, 0n, call.data || "0x", 1]
414
365
  })
415
366
  }
416
367
 
@@ -418,8 +369,13 @@ export async function createKernelAccountV0_2<
418
369
  },
419
370
 
420
371
  // Get simple dummy signature
421
- async getDummySignature(userOperation) {
422
- return kernelPluginManager.getDummySignature(userOperation)
372
+ async getStubSignature(userOperation) {
373
+ if (!userOperation) {
374
+ throw new Error("No user operation provided")
375
+ }
376
+ return kernelPluginManager.getStubSignature(
377
+ userOperation as UserOperation
378
+ )
423
379
  }
424
- }
380
+ })
425
381
  }
@@ -1,6 +1,5 @@
1
- import { getEntryPointVersion } from "permissionless"
2
- import type { EntryPoint } from "permissionless/types"
3
1
  import { keccak256, toHex } from "viem"
2
+ import type { EntryPointVersion } from "viem/account-abstraction"
4
3
 
5
4
  const hashAndTruncate = (input: string, byteSize: number): bigint => {
6
5
  const hash = keccak256(toHex(input))
@@ -10,11 +9,9 @@ const hashAndTruncate = (input: string, byteSize: number): bigint => {
10
9
 
11
10
  export const getCustomNonceKeyFromString = (
12
11
  input: string,
13
- entryPoint: EntryPoint
12
+ entryPointVersion: EntryPointVersion
14
13
  ) => {
15
- const entryPointVersion = getEntryPointVersion(entryPoint)
16
-
17
- if (entryPointVersion === "v0.6") {
14
+ if (entryPointVersion === "0.6") {
18
15
  return hashAndTruncate(input, 24) // 24 bytes for v0.6
19
16
  }
20
17
  return hashAndTruncate(input, 2) // 2 bytes for v0.7
@@ -1,14 +1,5 @@
1
1
  export { toKernelPluginManager } from "./toKernelPluginManager.js"
2
2
 
3
- import type { Address, Hex } from "viem"
4
3
  export { verifyEIP6492Signature, universalValidatorByteCode } from "./6492.js"
5
4
 
6
- export const parseFactoryAddressAndCallDataFromAccountInitCode = (
7
- initCode: Hex
8
- ): [Address, Hex] => {
9
- const factoryAddress = `0x${initCode.substring(2, 42)}` as Address
10
- const factoryCalldata = `0x${initCode.substring(42)}` as Hex
11
- return [factoryAddress, factoryCalldata]
12
- }
13
-
14
5
  export { getCustomNonceKeyFromString } from "./getCustomNonceKeyFromString.js"
@@ -1,5 +1,6 @@
1
1
  import { type Address, type Hex, encodePacked, toBytes } from "viem"
2
- import type { CallType, KernelEncodeCallDataArgs } from "../../types/index.js"
2
+ import type { CallType } from "../../types/index.js"
3
+ import type { KernelSmartAccountImplementation } from "../kernel/createKernelAccount.js"
3
4
 
4
5
  export const MULTISEND_ADDRESS = "0x8ae01fcf7c655655ff2c6ef907b8b4718ab4e17c"
5
6
 
@@ -31,7 +32,9 @@ const encodeCall = (call: {
31
32
  return encoded.slice(2)
32
33
  }
33
34
 
34
- export const encodeMultiSend = (calls: KernelEncodeCallDataArgs): Hex => {
35
+ export const encodeMultiSend = (
36
+ calls: Parameters<KernelSmartAccountImplementation<"0.6">["encodeCalls"]>[0]
37
+ ): Hex => {
35
38
  if (!Array.isArray(calls)) {
36
39
  throw new Error("Invalid multiSend calls, should use an array of calls")
37
40
  }