@zerodev/sdk 5.3.26 → 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 -56
  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 +11 -34
  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,17 +1,18 @@
1
- import {
2
- type BundlerClient,
3
- type SmartAccountActions,
4
- smartAccountActions
5
- } from "permissionless"
6
- import type { Middleware } from "permissionless/actions/smartAccount"
7
- import type { EntryPoint, Prettify } from "permissionless/types"
8
- import type { StateOverrides } from "permissionless/types/bundler"
9
- import type { Chain, Client, Hash, Transport } from "viem"
10
- import type { KernelSmartAccount } from "../../accounts/index.js"
11
- import {
12
- type GetKernelV3ModuleCurrentNonceParameters,
13
- getKernelV3ModuleCurrentNonce
14
- } from "../../actions/account-client/getKernelV3ModuleCurrentNonce.js"
1
+ import type {
2
+ Abi,
3
+ Address,
4
+ Chain,
5
+ Client,
6
+ ContractFunctionArgs,
7
+ ContractFunctionName,
8
+ Hash,
9
+ Prettify,
10
+ Transport,
11
+ TypedData,
12
+ WriteContractParameters
13
+ } from "viem"
14
+ import type { EntryPointVersion, SmartAccount } from "viem/account-abstraction"
15
+ import { getKernelV3ModuleCurrentNonce } from "../../actions/account-client/getKernelV3ModuleCurrentNonce.js"
15
16
  import {
16
17
  type GetUserOperationGasPriceReturnType,
17
18
  getUserOperationGasPrice
@@ -20,18 +21,18 @@ import {
20
21
  type InvalidateNonceParameters,
21
22
  invalidateNonce
22
23
  } from "../../actions/account-client/invalidateNonce.js"
24
+ import { sendTransaction } from "../../actions/account-client/sendTransaction.js"
25
+ import { signMessage } from "../../actions/account-client/signMessage.js"
26
+ import { signTypedData } from "../../actions/account-client/signTypedData.js"
27
+ import { writeContract } from "../../actions/account-client/writeContract.js"
23
28
  import type {
24
29
  ChangeSudoValidatorParameters,
25
- SignUserOperationParameters,
26
30
  SignUserOperationReturnType,
27
- SponsorUserOperationEip7677Parameters,
28
- SponsorUserOperationEip7677ReturnType,
29
31
  UninstallPluginParameters
30
32
  } from "../../actions/index.js"
31
33
  import {
32
34
  changeSudoValidator,
33
35
  signUserOperation,
34
- sponsorUserOperationEip7677,
35
36
  uninstallPlugin
36
37
  } from "../../actions/index.js"
37
38
  import {
@@ -46,80 +47,69 @@ import {
46
47
  } from "../../actions/paymaster/sponsorUserOperation.js"
47
48
  import type { ZeroDevPaymasterClient } from "../paymasterClient.js"
48
49
 
49
- export type ZeroDevPaymasterClientActions<entryPoint extends EntryPoint> = {
50
+ export type ZeroDevPaymasterClientActions<
51
+ entryPointVersion extends EntryPointVersion
52
+ > = {
50
53
  /**
51
54
  * Returns paymasterAndData & updated gas parameters required to sponsor a userOperation.
52
55
  */
53
56
  sponsorUserOperation: (
54
- args: SponsorUserOperationParameters<entryPoint>
55
- ) => Promise<SponsorUserOperationReturnType<entryPoint>>
57
+ args: SponsorUserOperationParameters<entryPointVersion>
58
+ ) => Promise<SponsorUserOperationReturnType<entryPointVersion>>
56
59
  estimateGasInERC20: (
57
60
  args: EstimateGasInERC20Parameters
58
61
  ) => Promise<EstimateGasInERC20ReturnType>
59
- sponsorUserOperationEip7677: (
60
- args: SponsorUserOperationEip7677Parameters<entryPoint>,
61
- bundlerClient: BundlerClient<entryPoint>,
62
- stateOverrides?: StateOverrides
63
- ) => Promise<SponsorUserOperationEip7677ReturnType<entryPoint>>
64
62
  }
65
63
 
66
64
  export const zerodevPaymasterActions =
67
- <entryPoint extends EntryPoint>(entryPointAddress: entryPoint) =>
68
- (client: Client): ZeroDevPaymasterClientActions<entryPoint> => ({
65
+ <entryPointVersion extends EntryPointVersion>(entryPoint: {
66
+ address: Address
67
+ version: entryPointVersion
68
+ }) =>
69
+ (client: Client): ZeroDevPaymasterClientActions<entryPointVersion> => ({
69
70
  sponsorUserOperation: async (
70
- args: Omit<SponsorUserOperationParameters<entryPoint>, "entryPoint">
71
+ args: Omit<
72
+ SponsorUserOperationParameters<entryPointVersion>,
73
+ "entryPoint"
74
+ >
71
75
  ) =>
72
- sponsorUserOperation<entryPoint>(
73
- client as ZeroDevPaymasterClient<entryPoint>,
76
+ sponsorUserOperation(
77
+ client as ZeroDevPaymasterClient<entryPointVersion>,
74
78
  {
75
79
  ...args,
76
- entryPoint: entryPointAddress
80
+ entryPoint
77
81
  }
78
82
  ),
79
83
  estimateGasInERC20: async (args: EstimateGasInERC20Parameters) =>
80
84
  estimateGasInERC20(
81
- client as ZeroDevPaymasterClient<entryPoint>,
85
+ client as ZeroDevPaymasterClient<entryPointVersion>,
82
86
  args
83
- ),
84
- sponsorUserOperationEip7677: async (
85
- args: SponsorUserOperationEip7677Parameters<entryPoint>,
86
- bundlerClient: BundlerClient<entryPoint>,
87
- stateOverrides?: StateOverrides
88
- ) =>
89
- sponsorUserOperationEip7677(
90
- client as ZeroDevPaymasterClient<entryPoint>,
91
- args,
92
- bundlerClient,
93
- stateOverrides
94
87
  )
95
88
  })
96
89
 
97
90
  export type KernelAccountClientActions<
98
- entryPoint extends EntryPoint,
99
- TTransport extends Transport = Transport,
100
91
  TChain extends Chain | undefined = Chain | undefined,
101
- TSmartAccount extends
102
- | KernelSmartAccount<entryPoint, TTransport, TChain>
103
- | undefined =
104
- | KernelSmartAccount<entryPoint, TTransport, TChain>
105
- | undefined
106
- > = SmartAccountActions<entryPoint, TTransport, TChain, TSmartAccount> & {
92
+ TSmartAccount extends SmartAccount | undefined = SmartAccount | undefined
93
+ > = {
107
94
  /**
108
95
  * Signs a user operation with the given transport, chain, and smart account.
109
96
  *
110
97
  * @param args - Parameters for the signUserOperation function
111
98
  * @returns A promise that resolves to the result of the signUserOperation function
112
99
  */
113
- signUserOperation: <TTransport extends Transport>(
100
+ signUserOperation: <
101
+ accountOverride extends SmartAccount | undefined = undefined,
102
+ calls extends readonly unknown[] = readonly unknown[]
103
+ >(
114
104
  args: Parameters<
115
105
  typeof signUserOperation<
116
- entryPoint,
117
- TTransport,
106
+ TSmartAccount,
118
107
  TChain,
119
- TSmartAccount
108
+ accountOverride,
109
+ calls
120
110
  >
121
111
  >[1]
122
- ) => Promise<SignUserOperationReturnType<entryPoint>>
112
+ ) => Promise<SignUserOperationReturnType>
123
113
  /**
124
114
  * Returns the live gas prices that you can use to send a user operation.
125
115
  *
@@ -136,24 +126,24 @@ export type KernelAccountClientActions<
136
126
  * @param args - {@link UninstallPermissionParameters}
137
127
  * @returns The [Transaction](https://viem.sh/docs/glossary/terms.html#transaction) hash. {@link SendTransactionReturnType}
138
128
  */
139
- uninstallPlugin: (
140
- args: UninstallPluginParameters<
141
- entryPoint,
142
- TTransport,
143
- TChain,
144
- TSmartAccount
145
- >
129
+ uninstallPlugin: <
130
+ accountOverride extends SmartAccount | undefined = undefined,
131
+ calls extends readonly unknown[] = readonly unknown[]
132
+ >(
133
+ args: UninstallPluginParameters<TSmartAccount, accountOverride, calls>
146
134
  ) => Promise<Hash>
147
135
  /**
148
136
  * Creates, signs, and sends a user operation to change sudo validator to the network.
149
137
  * This function also allows you to sponsor this transaction if sender is a smartAccount
150
138
  */
151
- changeSudoValidator: (
139
+ changeSudoValidator: <
140
+ accountOverride extends SmartAccount | undefined = undefined,
141
+ calls extends readonly unknown[] = readonly unknown[]
142
+ >(
152
143
  args: ChangeSudoValidatorParameters<
153
- entryPoint,
154
- TTransport,
155
- TChain,
156
- TSmartAccount
144
+ TSmartAccount,
145
+ accountOverride,
146
+ calls
157
147
  >
158
148
  ) => Promise<Hash>
159
149
 
@@ -166,116 +156,330 @@ export type KernelAccountClientActions<
166
156
  * @returns The [Transaction](https://viem.sh/docs/glossary/terms.html#transaction) hash. {@link SendTransactionReturnType}
167
157
  */
168
158
  invalidateNonce: <
169
- TChainOverride extends Chain | undefined = Chain | undefined
159
+ accountOverride extends SmartAccount | undefined = undefined,
160
+ calls extends readonly unknown[] = readonly unknown[]
170
161
  >(
171
- args: InvalidateNonceParameters<
172
- entryPoint,
173
- TTransport,
174
- TChain,
175
- TSmartAccount,
176
- TChainOverride
177
- >
162
+ args: InvalidateNonceParameters<TSmartAccount, accountOverride, calls>
178
163
  ) => Promise<Hash>
179
164
  /**
180
165
  * Creates, signs, and sends a transaction to fetch KernelV3 module nonce to the network.
181
166
  * This function also allows you to sponsor this transaction if sender is a smartAccount
182
167
  *
183
168
  *
184
- * @param args - {@link GetKernelV3ModuleCurrentNonceParameters}
185
169
  * @returns nonce
186
170
  */
187
- getKernelV3ModuleCurrentNonce: <
188
- TChainOverride extends Chain | undefined = Chain | undefined
171
+ getKernelV3ModuleCurrentNonce: () => Promise<number>
172
+ /**
173
+ * Creates, signs, and sends a new transaction to the network.
174
+ * This function also allows you to sponsor this transaction if sender is a smartAccount
175
+ *
176
+ * - Docs: https://viem.sh/docs/actions/wallet/sendTransaction.html
177
+ * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/sending-transactions
178
+ * - JSON-RPC Methods:
179
+ * - JSON-RPC Accounts: [`eth_sendTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendtransaction)
180
+ * - Local Accounts: [`eth_sendRawTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendrawtransaction)
181
+ *
182
+ * @param args - {@link SendTransactionParameters}
183
+ * @returns The [Transaction](https://viem.sh/docs/glossary/terms.html#transaction) hash. {@link SendTransactionReturnType}
184
+ *
185
+ * @example
186
+ * import { createWalletClient, custom } from 'viem'
187
+ * import { mainnet } from 'viem/chains'
188
+ *
189
+ * const client = createWalletClient({
190
+ * chain: mainnet,
191
+ * transport: custom(window.ethereum),
192
+ * })
193
+ * const hash = await client.sendTransaction({
194
+ * account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
195
+ * to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
196
+ * value: 1000000000000000000n,
197
+ * })
198
+ *
199
+ * @example
200
+ * // Account Hoisting
201
+ * import { createWalletClient, http } from 'viem'
202
+ * import { privateKeyToAccount } from 'viem/accounts'
203
+ * import { mainnet } from 'viem/chains'
204
+ *
205
+ * const client = createWalletClient({
206
+ * account: privateKeyToAccount('0x…'),
207
+ * chain: mainnet,
208
+ * transport: http(),
209
+ * })
210
+ * const hash = await client.sendTransaction({
211
+ * to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
212
+ * value: 1000000000000000000n,
213
+ * })
214
+ */
215
+ sendTransaction: <
216
+ TChainOverride extends Chain | undefined = undefined,
217
+ accountOverride extends SmartAccount | undefined = undefined,
218
+ calls extends readonly unknown[] = readonly unknown[]
219
+ >(
220
+ args: Parameters<
221
+ typeof sendTransaction<
222
+ TSmartAccount,
223
+ TChain,
224
+ accountOverride,
225
+ TChainOverride,
226
+ calls
227
+ >
228
+ >[1]
229
+ ) => Promise<Hash>
230
+ /**
231
+ * Calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191): `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`.
232
+ *
233
+ * - Docs: https://viem.sh/docs/actions/wallet/signMessage.html
234
+ * - JSON-RPC Methods:
235
+ * - JSON-RPC Accounts: [`personal_sign`](https://docs.metamask.io/guide/signing-data.html#personal-sign)
236
+ * - Local Accounts: Signs locally. No JSON-RPC request.
237
+ *
238
+ * With the calculated signature, you can:
239
+ * - use [`verifyMessage`](https://viem.sh/docs/utilities/verifyMessage.html) to verify the signature,
240
+ * - use [`recoverMessageAddress`](https://viem.sh/docs/utilities/recoverMessageAddress.html) to recover the signing address from a signature.
241
+ *
242
+ * @param args - {@link SignMessageParameters}
243
+ * @returns The signed message. {@link SignMessageReturnType}
244
+ *
245
+ * @example
246
+ * import { createWalletClient, custom } from 'viem'
247
+ * import { mainnet } from 'viem/chains'
248
+ *
249
+ * const client = createWalletClient({
250
+ * chain: mainnet,
251
+ * transport: custom(window.ethereum),
252
+ * })
253
+ * const signature = await client.signMessage({
254
+ * account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
255
+ * message: 'hello world',
256
+ * })
257
+ *
258
+ * @example
259
+ * // Account Hoisting
260
+ * import { createWalletClient, http } from 'viem'
261
+ * import { privateKeyToAccount } from 'viem/accounts'
262
+ * import { mainnet } from 'viem/chains'
263
+ *
264
+ * const client = createWalletClient({
265
+ * account: privateKeyToAccount('0x…'),
266
+ * chain: mainnet,
267
+ * transport: http(),
268
+ * })
269
+ * const signature = await client.signMessage({
270
+ * message: 'hello world',
271
+ * })
272
+ */
273
+ signMessage: (
274
+ args: Parameters<typeof signMessage<TSmartAccount>>[1]
275
+ ) => ReturnType<typeof signMessage<TSmartAccount>>
276
+ /**
277
+ * Signs typed data and calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191): `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`.
278
+ *
279
+ * - Docs: https://viem.sh/docs/actions/wallet/signTypedData.html
280
+ * - JSON-RPC Methods:
281
+ * - JSON-RPC Accounts: [`eth_signTypedData_v4`](https://docs.metamask.io/guide/signing-data.html#signtypeddata-v4)
282
+ * - Local Accounts: Signs locally. No JSON-RPC request.
283
+ *
284
+ * @param client - Client to use
285
+ * @param args - {@link SignTypedDataParameters}
286
+ * @returns The signed data. {@link SignTypedDataReturnType}
287
+ *
288
+ * @example
289
+ * import { createWalletClient, custom } from 'viem'
290
+ * import { mainnet } from 'viem/chains'
291
+ *
292
+ * const client = createWalletClient({
293
+ * chain: mainnet,
294
+ * transport: custom(window.ethereum),
295
+ * })
296
+ * const signature = await client.signTypedData({
297
+ * account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
298
+ * domain: {
299
+ * name: 'Ether Mail',
300
+ * version: '1',
301
+ * chainId: 1,
302
+ * verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC',
303
+ * },
304
+ * types: {
305
+ * Person: [
306
+ * { name: 'name', type: 'string' },
307
+ * { name: 'wallet', type: 'address' },
308
+ * ],
309
+ * Mail: [
310
+ * { name: 'from', type: 'Person' },
311
+ * { name: 'to', type: 'Person' },
312
+ * { name: 'contents', type: 'string' },
313
+ * ],
314
+ * },
315
+ * primaryType: 'Mail',
316
+ * message: {
317
+ * from: {
318
+ * name: 'Cow',
319
+ * wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826',
320
+ * },
321
+ * to: {
322
+ * name: 'Bob',
323
+ * wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB',
324
+ * },
325
+ * contents: 'Hello, Bob!',
326
+ * },
327
+ * })
328
+ *
329
+ * @example
330
+ * // Account Hoisting
331
+ * import { createWalletClient, http } from 'viem'
332
+ * import { privateKeyToAccount } from 'viem/accounts'
333
+ * import { mainnet } from 'viem/chains'
334
+ *
335
+ * const client = createWalletClient({
336
+ * account: privateKeyToAccount('0x…'),
337
+ * chain: mainnet,
338
+ * transport: http(),
339
+ * })
340
+ * const signature = await client.signTypedData({
341
+ * domain: {
342
+ * name: 'Ether Mail',
343
+ * version: '1',
344
+ * chainId: 1,
345
+ * verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC',
346
+ * },
347
+ * types: {
348
+ * Person: [
349
+ * { name: 'name', type: 'string' },
350
+ * { name: 'wallet', type: 'address' },
351
+ * ],
352
+ * Mail: [
353
+ * { name: 'from', type: 'Person' },
354
+ * { name: 'to', type: 'Person' },
355
+ * { name: 'contents', type: 'string' },
356
+ * ],
357
+ * },
358
+ * primaryType: 'Mail',
359
+ * message: {
360
+ * from: {
361
+ * name: 'Cow',
362
+ * wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826',
363
+ * },
364
+ * to: {
365
+ * name: 'Bob',
366
+ * wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB',
367
+ * },
368
+ * contents: 'Hello, Bob!',
369
+ * },
370
+ * })
371
+ */
372
+ signTypedData: <
373
+ const TTypedData extends TypedData | { [key: string]: unknown },
374
+ TPrimaryType extends string
189
375
  >(
190
- args: GetKernelV3ModuleCurrentNonceParameters<
191
- entryPoint,
192
- TTransport,
376
+ args: Parameters<
377
+ typeof signTypedData<TTypedData, TPrimaryType, TSmartAccount>
378
+ >[1]
379
+ ) => ReturnType<
380
+ typeof signTypedData<TTypedData, TPrimaryType, TSmartAccount>
381
+ >
382
+ /**
383
+ * Executes a write function on a contract.
384
+ * This function also allows you to sponsor this transaction if sender is a smartAccount
385
+ *
386
+ * - Docs: https://viem.sh/docs/contract/writeContract.html
387
+ * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/contracts/writing-to-contracts
388
+ *
389
+ * A "write" function on a Solidity contract modifies the state of the blockchain. These types of functions require gas to be executed, and hence a [Transaction](https://viem.sh/docs/glossary/terms.html) is needed to be broadcast in order to change the state.
390
+ *
391
+ * Internally, uses a [Wallet Client](https://viem.sh/docs/clients/wallet.html) to call the [`sendTransaction` action](https://viem.sh/docs/actions/wallet/sendTransaction.html) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData.html).
392
+ *
393
+ * __Warning: The `write` internally sends a transaction – it does not validate if the contract write will succeed (the contract may throw an error). It is highly recommended to [simulate the contract write with `contract.simulate`](https://viem.sh/docs/contract/writeContract.html#usage) before you execute it.__
394
+ *
395
+ * @param args - {@link WriteContractParameters}
396
+ * @returns A [Transaction Hash](https://viem.sh/docs/glossary/terms.html#hash). {@link WriteContractReturnType}
397
+ *
398
+ * @example
399
+ * import { createWalletClient, custom, parseAbi } from 'viem'
400
+ * import { mainnet } from 'viem/chains'
401
+ *
402
+ * const client = createWalletClient({
403
+ * chain: mainnet,
404
+ * transport: custom(window.ethereum),
405
+ * })
406
+ * const hash = await client.writeContract({
407
+ * address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
408
+ * abi: parseAbi(['function mint(uint32 tokenId) nonpayable']),
409
+ * functionName: 'mint',
410
+ * args: [69420],
411
+ * })
412
+ *
413
+ * @example
414
+ * // With Validation
415
+ * import { createWalletClient, custom, parseAbi } from 'viem'
416
+ * import { mainnet } from 'viem/chains'
417
+ *
418
+ * const client = createWalletClient({
419
+ * chain: mainnet,
420
+ * transport: custom(window.ethereum),
421
+ * })
422
+ * const { request } = await client.simulateContract({
423
+ * address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
424
+ * abi: parseAbi(['function mint(uint32 tokenId) nonpayable']),
425
+ * functionName: 'mint',
426
+ * args: [69420],
427
+ * }
428
+ * const hash = await client.writeContract(request)
429
+ */
430
+ writeContract: <
431
+ const TAbi extends Abi | readonly unknown[],
432
+ TFunctionName extends ContractFunctionName<
433
+ TAbi,
434
+ "nonpayable" | "payable"
435
+ > = ContractFunctionName<TAbi, "nonpayable" | "payable">,
436
+ TArgs extends ContractFunctionArgs<
437
+ TAbi,
438
+ "nonpayable" | "payable",
439
+ TFunctionName
440
+ > = ContractFunctionArgs<TAbi, "nonpayable" | "payable", TFunctionName>,
441
+ TChainOverride extends Chain | undefined = undefined
442
+ >(
443
+ args: WriteContractParameters<
444
+ TAbi,
445
+ TFunctionName,
446
+ TArgs,
447
+ TChain,
448
+ TSmartAccount,
449
+ TChainOverride
450
+ >
451
+ ) => ReturnType<
452
+ typeof writeContract<
193
453
  TChain,
194
454
  TSmartAccount,
455
+ TAbi,
456
+ TFunctionName,
457
+ TArgs,
195
458
  TChainOverride
196
459
  >
197
- ) => Promise<number>
460
+ >
198
461
  }
199
462
 
200
- export function kernelAccountClientActions<entryPoint extends EntryPoint>({
201
- middleware
202
- }: Middleware<entryPoint>) {
463
+ export function kernelAccountClientActions() {
203
464
  return <
204
- TTransport extends Transport,
205
465
  TChain extends Chain | undefined = Chain | undefined,
206
- TSmartAccount extends
207
- | KernelSmartAccount<entryPoint, TTransport, TChain>
208
- | undefined =
209
- | KernelSmartAccount<entryPoint, TTransport, TChain>
466
+ TSmartAccount extends SmartAccount | undefined =
467
+ | SmartAccount
210
468
  | undefined
211
469
  >(
212
- client: Client<TTransport, TChain, TSmartAccount>
213
- ): KernelAccountClientActions<
214
- entryPoint,
215
- TTransport,
216
- TChain,
217
- TSmartAccount
218
- > => ({
219
- ...smartAccountActions({ middleware })(client),
220
- signUserOperation: (args) =>
221
- signUserOperation<entryPoint, TTransport, TChain, TSmartAccount>(
222
- client,
223
- {
224
- ...args,
225
- middleware
226
- } as SignUserOperationParameters<
227
- entryPoint,
228
- TTransport,
229
- TChain,
230
- TSmartAccount
231
- >
232
- ),
470
+ client: Client<Transport, TChain, TSmartAccount>
471
+ ): KernelAccountClientActions<TChain, TSmartAccount> => ({
472
+ signUserOperation: (args) => signUserOperation(client, args),
233
473
  getUserOperationGasPrice: async () => getUserOperationGasPrice(client),
234
- uninstallPlugin: async (args) =>
235
- uninstallPlugin<entryPoint, TTransport, TChain, TSmartAccount>(
236
- client,
237
- {
238
- ...args,
239
- middleware
240
- } as UninstallPluginParameters<
241
- entryPoint,
242
- TTransport,
243
- TChain,
244
- TSmartAccount
245
- >
246
- ),
247
- changeSudoValidator: async (args) =>
248
- changeSudoValidator<entryPoint, TTransport, TChain, TSmartAccount>(
249
- client,
250
- {
251
- ...args,
252
- middleware
253
- } as ChangeSudoValidatorParameters<
254
- entryPoint,
255
- TTransport,
256
- TChain,
257
- TSmartAccount
258
- >
259
- ),
260
- invalidateNonce: async (args) =>
261
- invalidateNonce(client, {
262
- ...args,
263
- middleware
264
- } as InvalidateNonceParameters<
265
- entryPoint,
266
- TTransport,
267
- TChain,
268
- TSmartAccount
269
- >),
270
- getKernelV3ModuleCurrentNonce: async (args) =>
271
- getKernelV3ModuleCurrentNonce(client, {
272
- ...args,
273
- middleware
274
- } as GetKernelV3ModuleCurrentNonceParameters<
275
- entryPoint,
276
- TTransport,
277
- TChain,
278
- TSmartAccount
279
- >)
474
+ uninstallPlugin: async (args) => uninstallPlugin(client, args),
475
+ changeSudoValidator: async (args) => changeSudoValidator(client, args),
476
+ invalidateNonce: async (args) => invalidateNonce(client, args),
477
+ getKernelV3ModuleCurrentNonce: async () =>
478
+ getKernelV3ModuleCurrentNonce(client),
479
+ // biome-ignore lint/suspicious/noExplicitAny: <explanation>
480
+ sendTransaction: (args) => sendTransaction(client, args as any),
481
+ signMessage: (args) => signMessage(client, args),
482
+ signTypedData: (args) => signTypedData(client, args),
483
+ writeContract: (args) => writeContract(client, args)
280
484
  })
281
485
  }
@@ -1,21 +1,19 @@
1
- import type { EntryPoint } from "permissionless/types"
2
- import type { Chain, Transport } from "viem"
3
- import type { KernelSmartAccount } from "../accounts/index.js"
1
+ import type { Chain, Client, RpcSchema, Transport } from "viem"
2
+ import type { SmartAccount } from "viem/account-abstraction"
4
3
  import type { KernelAccountClient } from "./kernelAccountClient.js"
5
4
 
6
5
  export const createFallbackKernelAccountClient = <
7
- TEntryPoint extends EntryPoint,
8
- TTransport extends Transport,
9
- TChain extends Chain | undefined,
10
- TSmartAccount extends
11
- | KernelSmartAccount<TEntryPoint, TTransport, TChain>
12
- | undefined
6
+ transport extends Transport,
7
+ chain extends Chain | undefined = undefined,
8
+ account extends SmartAccount | undefined = undefined,
9
+ client extends Client | undefined = undefined,
10
+ rpcSchema extends RpcSchema | undefined = undefined
13
11
  >(
14
12
  clients: Array<
15
- KernelAccountClient<TEntryPoint, TTransport, TChain, TSmartAccount>
13
+ KernelAccountClient<transport, chain, account, client, rpcSchema>
16
14
  >,
17
15
  onError?: (error: Error, clientUrl: string) => Promise<void>
18
- ): KernelAccountClient<TEntryPoint, TTransport, TChain, TSmartAccount> => {
16
+ ): KernelAccountClient<transport, chain, account, client, rpcSchema> => {
19
17
  // Function to create a fallback method for a given property.
20
18
  // This method will try each client in sequence until one succeeds or all fail.
21
19
  function createFallbackMethod(prop: PropertyKey) {