@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
package/types/kernel.ts CHANGED
@@ -1,30 +1,28 @@
1
+ import type { Address, CustomSource, Hex, LocalAccount, PartialBy } from "viem"
1
2
  import type {
2
- ENTRYPOINT_ADDRESS_V06_TYPE,
3
- EntryPoint
4
- } from "permissionless/types"
5
- import type { GetEntryPointVersion } from "permissionless/types/entrypoint"
6
- import type {
3
+ EntryPointVersion,
7
4
  UserOperation,
8
- UserOperationWithBigIntAsHex
9
- } from "permissionless/types/userOperation"
10
- import type { Address, CustomSource, Hex, LocalAccount } from "viem"
11
- import type { PartialBy } from "viem/types/utils"
5
+ entryPoint06Abi,
6
+ entryPoint07Abi
7
+ } from "viem/account-abstraction"
12
8
  import type { VALIDATOR_TYPE } from "../constants.js"
13
- export type ZeroDevPaymasterRpcSchema<entryPoint extends EntryPoint> = [
9
+ export type ZeroDevPaymasterRpcSchema<
10
+ entryPointVersion extends EntryPointVersion
11
+ > = [
14
12
  {
15
13
  Method: "zd_sponsorUserOperation"
16
14
  Parameters: [
17
15
  {
18
16
  chainId: number
19
- userOp: GetEntryPointVersion<entryPoint> extends "v0.6"
17
+ userOp: entryPointVersion extends "0.6"
20
18
  ? PartialBy<
21
- UserOperationWithBigIntAsHex<"v0.6">,
19
+ UserOperation<"0.6">,
22
20
  | "callGasLimit"
23
21
  | "preVerificationGas"
24
22
  | "verificationGasLimit"
25
23
  >
26
24
  : PartialBy<
27
- UserOperationWithBigIntAsHex<"v0.7">,
25
+ UserOperation<"0.7">,
28
26
  | "callGasLimit"
29
27
  | "preVerificationGas"
30
28
  | "verificationGasLimit"
@@ -40,7 +38,7 @@ export type ZeroDevPaymasterRpcSchema<entryPoint extends EntryPoint> = [
40
38
  shouldConsume?: boolean
41
39
  }
42
40
  ]
43
- ReturnType: GetEntryPointVersion<entryPoint> extends "v0.6"
41
+ ReturnType: entryPointVersion extends "0.6"
44
42
  ? {
45
43
  paymasterAndData: Hex
46
44
  preVerificationGas: Hex
@@ -81,7 +79,7 @@ export type ZeroDevPaymasterRpcSchema<entryPoint extends EntryPoint> = [
81
79
  Parameters: [
82
80
  {
83
81
  chainId: number
84
- userOp: UserOperationWithBigIntAsHex<"v0.6">
82
+ userOp: UserOperation<"0.6">
85
83
  entryPointAddress: Address
86
84
  tokenAddress: Address
87
85
  }
@@ -121,28 +119,28 @@ export type ValidatorType = Extract<
121
119
  "PERMISSION" | "SECONDARY"
122
120
  >
123
121
 
124
- export type KernelValidator<
125
- entryPoint extends EntryPoint,
126
- Name extends string = string
127
- > = LocalAccount<Name> & {
128
- validatorType: ValidatorType
129
- supportedKernelVersions: string
130
- getNonceKey: (
131
- accountAddress?: Address,
132
- customNonceKey?: bigint
133
- ) => Promise<bigint>
134
- getDummySignature(
135
- userOperation: UserOperation<GetEntryPointVersion<entryPoint>>,
136
- pluginEnableSignature?: Hex
137
- ): Promise<Hex>
138
- signUserOperation: (
139
- userOperation: UserOperation<GetEntryPointVersion<entryPoint>>,
140
- pluginEnableSignature?: Hex
141
- ) => Promise<Hex>
142
- getEnableData(accountAddress?: Address): Promise<Hex>
143
- isEnabled(accountAddress: Address, selector: Hex): Promise<boolean>
144
- getIdentifier: () => Hex
145
- }
122
+ export type KernelValidator<Name extends string = string> =
123
+ LocalAccount<Name> & {
124
+ validatorType: ValidatorType
125
+ supportedKernelVersions: string
126
+ getNonceKey: (
127
+ accountAddress?: Address,
128
+ customNonceKey?: bigint
129
+ ) => Promise<bigint>
130
+ getStubSignature(
131
+ userOperation: UserOperation,
132
+ pluginEnableSignature?: Hex
133
+ ): Promise<Hex>
134
+ signUserOperation: (
135
+ userOperation: UserOperation & {
136
+ chainId?: number | undefined
137
+ },
138
+ pluginEnableSignature?: Hex
139
+ ) => Promise<Hex>
140
+ getEnableData(accountAddress?: Address): Promise<Hex>
141
+ isEnabled(accountAddress: Address, selector: Hex): Promise<boolean>
142
+ getIdentifier: () => Hex
143
+ }
146
144
 
147
145
  export type KernelValidatorHook = {
148
146
  getEnableData(accountAddress?: Address): Promise<Hex>
@@ -156,10 +154,10 @@ export type ValidatorInitData = {
156
154
  initConfig?: Hex[]
157
155
  }
158
156
 
159
- export type KernelPluginManager<entryPoint extends EntryPoint> =
160
- KernelValidator<entryPoint> & {
161
- sudoValidator?: KernelValidator<entryPoint>
162
- regularValidator?: KernelValidator<entryPoint>
157
+ export type KernelPluginManager<entryPointVersion extends EntryPointVersion> =
158
+ KernelValidator & {
159
+ sudoValidator?: KernelValidator
160
+ regularValidator?: KernelValidator
163
161
  hook?: KernelValidatorHook
164
162
  getPluginEnableSignature(accountAddress: Address): Promise<Hex>
165
163
  getValidatorInitData(): Promise<ValidatorInitData>
@@ -171,12 +169,12 @@ export type KernelPluginManager<entryPoint extends EntryPoint> =
171
169
  accountAddress: Address
172
170
  ) => Promise<Parameters<CustomSource["signTypedData"]>[0]>
173
171
  signUserOperationWithActiveValidator: (
174
- userOperation: UserOperation<GetEntryPointVersion<entryPoint>>
172
+ userOperation: UserOperation<entryPointVersion>
175
173
  ) => Promise<Hex>
176
174
  }
177
175
 
178
- export type PluginInstallData<entryPoint extends EntryPoint> =
179
- entryPoint extends ENTRYPOINT_ADDRESS_V06_TYPE
176
+ export type PluginInstallData<entryPointVersion extends EntryPointVersion> =
177
+ entryPointVersion extends "0.6"
180
178
  ? {
181
179
  selector: Hex
182
180
  executor: Address
@@ -188,14 +186,19 @@ export type PluginInstallData<entryPoint extends EntryPoint> =
188
186
  : // TODO: Add support for EP v0.7
189
187
  never
190
188
 
191
- export type KernelPluginManagerParams<entryPoint extends EntryPoint> = {
192
- sudo?: KernelValidator<entryPoint>
193
- regular?: KernelValidator<entryPoint>
189
+ export type KernelPluginManagerParams<
190
+ entryPointVersion extends EntryPointVersion
191
+ > = {
192
+ sudo?: KernelValidator
193
+ regular?: KernelValidator
194
194
  hook?: KernelValidatorHook
195
195
  pluginEnableSignature?: Hex
196
196
  validatorInitData?: ValidatorInitData
197
197
  action?: Action
198
- entryPoint: entryPoint
198
+ entryPoint: {
199
+ address: Address
200
+ version: entryPointVersion
201
+ }
199
202
  kernelVersion: KERNEL_VERSION_TYPE
200
203
  chainId?: number
201
204
  } & Partial<PluginValidityData>
@@ -223,19 +226,17 @@ export enum ValidatorMode {
223
226
 
224
227
  export type CallType = "call" | "delegatecall"
225
228
 
226
- export type KernelEncodeCallDataArgs =
227
- | {
228
- to: Address
229
- value: bigint
230
- data: Hex
231
- callType: CallType | undefined
232
- }
233
- | {
234
- to: Address
235
- value: bigint
236
- data: Hex
237
- callType: CallType | undefined
238
- }[]
229
+ export type KernelEncodeCallDataArgs = {
230
+ to: Address
231
+ value: bigint
232
+ data: Hex
233
+ callType: CallType | undefined
234
+ }[]
235
+
236
+ export type GetEntryPointAbi<entryPointVersion extends EntryPointVersion> =
237
+ entryPointVersion extends "0.6"
238
+ ? typeof entryPoint06Abi
239
+ : typeof entryPoint07Abi
239
240
 
240
241
  export type Execution = {
241
242
  target: Address
@@ -251,7 +252,7 @@ export type KERNEL_VERSION_TYPE =
251
252
  | KERNEL_V2_VERSION_TYPE
252
253
  | KERNEL_V3_VERSION_TYPE
253
254
 
254
- export type GetKernelVersion<entryPoint extends EntryPoint> =
255
- entryPoint extends ENTRYPOINT_ADDRESS_V06_TYPE
255
+ export type GetKernelVersion<entryPointVersion extends EntryPointVersion> =
256
+ entryPointVersion extends "0.6"
256
257
  ? KERNEL_V2_VERSION_TYPE
257
258
  : KERNEL_V3_VERSION_TYPE
package/utils.ts CHANGED
@@ -1,5 +1,3 @@
1
- import { ENTRYPOINT_ADDRESS_V06, ENTRYPOINT_ADDRESS_V07 } from "permissionless"
2
- import type { EntryPoint } from "permissionless/types/entrypoint"
3
1
  import { satisfies } from "semver"
4
2
  import {
5
3
  type Address,
@@ -10,8 +8,10 @@ import {
10
8
  hexToSignature,
11
9
  isHex,
12
10
  pad,
13
- signatureToHex
11
+ signatureToHex,
12
+ toHex
14
13
  } from "viem"
14
+ import type { EntryPointVersion } from "viem/account-abstraction"
15
15
  import type { ZeroDevPaymasterClient } from "./clients/paymasterClient.js"
16
16
  import type { CALL_TYPE, EXEC_TYPE } from "./constants.js"
17
17
  import type { GetKernelVersion } from "./types/kernel.js"
@@ -40,9 +40,9 @@ export const hasKernelFeature = (
40
40
  }
41
41
 
42
42
  export const getERC20PaymasterApproveCall = async <
43
- entryPoint extends EntryPoint
43
+ entryPointVersion extends EntryPointVersion
44
44
  >(
45
- client: ZeroDevPaymasterClient<entryPoint>,
45
+ client: ZeroDevPaymasterClient<entryPointVersion>,
46
46
  {
47
47
  gasToken,
48
48
  approveAmount,
@@ -50,7 +50,7 @@ export const getERC20PaymasterApproveCall = async <
50
50
  }: {
51
51
  gasToken: Address
52
52
  approveAmount: bigint
53
- entryPoint: Address
53
+ entryPoint: { address: Address; version: entryPointVersion }
54
54
  }
55
55
  ): Promise<{ to: Address; value: bigint; data: Hex }> => {
56
56
  const response = await client.request({
@@ -58,7 +58,7 @@ export const getERC20PaymasterApproveCall = async <
58
58
  params: [
59
59
  {
60
60
  chainId: client.chain?.id as number,
61
- entryPointAddress: entryPoint
61
+ entryPointAddress: entryPoint.address
62
62
  }
63
63
  ]
64
64
  })
@@ -106,16 +106,15 @@ export const getExecMode = ({
106
106
  }
107
107
 
108
108
  export const validateKernelVersionWithEntryPoint = <
109
- entryPoint extends EntryPoint
109
+ entryPointVersion extends EntryPointVersion
110
110
  >(
111
- entryPointAddress: entryPoint,
112
- kernelVersion: GetKernelVersion<entryPoint>
111
+ entryPointVersion: EntryPointVersion,
112
+ kernelVersion: GetKernelVersion<entryPointVersion>
113
113
  ) => {
114
114
  if (
115
- (entryPointAddress === ENTRYPOINT_ADDRESS_V06 &&
115
+ (entryPointVersion === "0.6" &&
116
116
  !satisfies(kernelVersion, ">=0.2.2 || <=0.2.4")) ||
117
- (entryPointAddress === ENTRYPOINT_ADDRESS_V07 &&
118
- !satisfies(kernelVersion, ">=0.3.0"))
117
+ (entryPointVersion === "0.7" && !satisfies(kernelVersion, ">=0.3.0"))
119
118
  ) {
120
119
  throw new Error(
121
120
  "KernelVersion should be >= 0.2.2 and <= 0.2.4 for EntryPointV0.6 and >= 0.3.0 for EntryPointV0.7"
@@ -126,3 +125,32 @@ export const validateKernelVersionWithEntryPoint = <
126
125
  export const satisfiesRange = (version: string, range: string): boolean => {
127
126
  return satisfies(version, range)
128
127
  }
128
+
129
+ // biome-ignore lint/suspicious/noExplicitAny: it's a recursive function, so it's hard to type
130
+ export function deepHexlify(obj: any): any {
131
+ if (typeof obj === "function") {
132
+ return undefined
133
+ }
134
+ if (obj == null || typeof obj === "string" || typeof obj === "boolean") {
135
+ return obj
136
+ }
137
+
138
+ if (typeof obj === "bigint") {
139
+ return toHex(obj)
140
+ }
141
+
142
+ if (obj._isBigNumber != null || typeof obj !== "object") {
143
+ return toHex(obj).replace(/^0x0/, "0x")
144
+ }
145
+ if (Array.isArray(obj)) {
146
+ return obj.map((member) => deepHexlify(member))
147
+ }
148
+ return Object.keys(obj).reduce(
149
+ // biome-ignore lint/suspicious/noExplicitAny: it's a recursive function, so it's hard to type
150
+ (set: any, key: string) => {
151
+ set[key] = deepHexlify(obj[key])
152
+ return set
153
+ },
154
+ {}
155
+ )
156
+ }
@@ -1,59 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sponsorUserOperationEip7677 = void 0;
4
- const permissionless_1 = require("permissionless");
5
- const experimental_1 = require("permissionless/experimental");
6
- const sponsorUserOperationEip7677 = async (client, args, bundlerClient, stateOverrides) => {
7
- const { entryPoint: entryPointAddress, userOperation } = args;
8
- const chain = client.chain;
9
- const paymasterClient = client.extend((0, experimental_1.paymasterActionsEip7677)(entryPointAddress));
10
- const stubData = await paymasterClient.getPaymasterStubData({
11
- userOperation: userOperation,
12
- chain
13
- });
14
- const stubUserOperation = {
15
- ...userOperation,
16
- ...stubData
17
- };
18
- const gas = (await bundlerClient.estimateUserOperationGas({
19
- userOperation: stubUserOperation
20
- }, stateOverrides));
21
- const userOperationWithGas = {
22
- ...stubUserOperation,
23
- callGasLimit: gas.callGasLimit,
24
- verificationGasLimit: gas.verificationGasLimit,
25
- preVerificationGas: gas.preVerificationGas
26
- };
27
- const paymasterData = await paymasterClient.getPaymasterData({
28
- userOperation: userOperationWithGas,
29
- chain
30
- });
31
- if (entryPointAddress === permissionless_1.ENTRYPOINT_ADDRESS_V06) {
32
- const paymasterDataV06 = paymasterData;
33
- return {
34
- callGasLimit: BigInt(gas.callGasLimit),
35
- verificationGasLimit: BigInt(gas.verificationGasLimit),
36
- preVerificationGas: BigInt(gas.preVerificationGas),
37
- paymasterAndData: paymasterDataV06?.paymasterAndData,
38
- maxFeePerGas: BigInt(userOperation.maxFeePerGas),
39
- maxPriorityFeePerGas: BigInt(userOperation.maxPriorityFeePerGas)
40
- };
41
- }
42
- const stubDataV07 = stubData;
43
- const paymasterDataV07 = paymasterData;
44
- return {
45
- callGasLimit: BigInt(gas.callGasLimit),
46
- verificationGasLimit: BigInt(gas.verificationGasLimit),
47
- preVerificationGas: BigInt(gas.preVerificationGas),
48
- paymaster: paymasterDataV07.paymaster,
49
- paymasterData: paymasterDataV07.paymasterData,
50
- paymasterVerificationGasLimit: stubDataV07.paymasterVerificationGasLimit &&
51
- BigInt(stubDataV07.paymasterVerificationGasLimit),
52
- paymasterPostOpGasLimit: stubDataV07?.paymasterPostOpGasLimit &&
53
- BigInt(stubDataV07.paymasterPostOpGasLimit),
54
- maxFeePerGas: BigInt(userOperation.maxFeePerGas),
55
- maxPriorityFeePerGas: BigInt(userOperation.maxPriorityFeePerGas)
56
- };
57
- };
58
- exports.sponsorUserOperationEip7677 = sponsorUserOperationEip7677;
59
- //# sourceMappingURL=sponsorUserOperationEip7677.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sponsorUserOperationEip7677.js","sourceRoot":"","sources":["../../../actions/paymaster/sponsorUserOperationEip7677.ts"],"names":[],"mappings":";;;AAAA,mDAKuB;AACvB,8DAMoC;AA+D7B,MAAM,2BAA2B,GAAG,KAAK,EAG5C,MAA0C,EAC1C,IAAuD,EACvD,aAAwC,EACxC,cAA+B,EAC2B,EAAE;IAC5D,MAAM,EAAE,UAAU,EAAE,iBAAiB,EAAE,aAAa,EAAE,GAAG,IAAI,CAAA;IAC7D,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAA;IAC1B,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CACjC,IAAA,sCAAuB,EAAC,iBAAiB,CAAC,CAC7C,CAAA;IACD,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,oBAAoB,CAAC;QACxD,aAAa,EAAE,aAGG;QAClB,KAAK;KACR,CAAC,CAAA;IACF,MAAM,iBAAiB,GAAG;QACtB,GAAG,aAAa;QAChB,GAAG,QAAQ;KACd,CAAA;IAED,MAAM,GAAG,GAAG,CAAC,MAAM,aAAa,CAAC,wBAAwB,CACrD;QACI,aAAa,EACT,iBAAoF;KAC3F,EACD,cAAc,CACjB,CAAmD,CAAA;IACpD,MAAM,oBAAoB,GAAG;QACzB,GAAG,iBAAiB;QACpB,YAAY,EAAE,GAAG,CAAC,YAAY;QAC9B,oBAAoB,EAAE,GAAG,CAAC,oBAAoB;QAC9C,kBAAkB,EAAE,GAAG,CAAC,kBAAkB;KACc,CAAA;IAE5D,MAAM,aAAa,GAAG,MAAM,eAAe,CAAC,gBAAgB,CAAC;QACzD,aAAa,EAAE,oBAAoB;QACnC,KAAK;KACR,CAAC,CAAA;IAEF,IAAI,iBAAiB,KAAK,uCAAsB,EAAE,CAAC;QAC/C,MAAM,gBAAgB,GAClB,aAAwE,CAAA;QAC5E,OAAO;YACH,YAAY,EAAE,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC;YACtC,oBAAoB,EAAE,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC;YACtD,kBAAkB,EAAE,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC;YAClD,gBAAgB,EAAE,gBAAgB,EAAE,gBAAgB;YACpD,YAAY,EAAE,MAAM,CAAC,aAAa,CAAC,YAAY,CAAC;YAChD,oBAAoB,EAAE,MAAM,CAAC,aAAa,CAAC,oBAAoB,CAAC;SACd,CAAA;IAC1D,CAAC;IACD,MAAM,WAAW,GACb,QAAuE,CAAA;IAC3E,MAAM,gBAAgB,GAClB,aAAwE,CAAA;IAE5E,OAAO;QACH,YAAY,EAAE,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC;QACtC,oBAAoB,EAAE,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC;QACtD,kBAAkB,EAAE,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC;QAClD,SAAS,EAAE,gBAAgB,CAAC,SAAS;QACrC,aAAa,EAAE,gBAAgB,CAAC,aAAa;QAC7C,6BAA6B,EACzB,WAAW,CAAC,6BAA6B;YACzC,MAAM,CAAC,WAAW,CAAC,6BAA6B,CAAC;QACrD,uBAAuB,EACnB,WAAW,EAAE,uBAAuB;YACpC,MAAM,CAAC,WAAW,CAAC,uBAAuB,CAAC;QAC/C,YAAY,EAAE,MAAM,CAAC,aAAa,CAAC,YAAY,CAAC;QAChD,oBAAoB,EAAE,MAAM,CAAC,aAAa,CAAC,oBAAoB,CAAC;KACd,CAAA;AAC1D,CAAC,CAAA;AA5EY,QAAA,2BAA2B,+BA4EvC"}
@@ -1,58 +0,0 @@
1
- import { ENTRYPOINT_ADDRESS_V06 } from "permissionless";
2
- import { paymasterActionsEip7677 } from "permissionless/experimental";
3
- /**
4
- * Returns paymasterAndData & updated gas parameters required to sponsor a userOperation.
5
- */
6
- export const sponsorUserOperationEip7677 = async (client, args, bundlerClient, stateOverrides) => {
7
- const { entryPoint: entryPointAddress, userOperation } = args;
8
- const chain = client.chain;
9
- const paymasterClient = client.extend(paymasterActionsEip7677(entryPointAddress));
10
- const stubData = await paymasterClient.getPaymasterStubData({
11
- userOperation: userOperation,
12
- chain
13
- });
14
- const stubUserOperation = {
15
- ...userOperation,
16
- ...stubData
17
- };
18
- const gas = (await bundlerClient.estimateUserOperationGas({
19
- userOperation: stubUserOperation
20
- }, stateOverrides));
21
- const userOperationWithGas = {
22
- ...stubUserOperation,
23
- callGasLimit: gas.callGasLimit,
24
- verificationGasLimit: gas.verificationGasLimit,
25
- preVerificationGas: gas.preVerificationGas
26
- };
27
- const paymasterData = await paymasterClient.getPaymasterData({
28
- userOperation: userOperationWithGas,
29
- chain
30
- });
31
- if (entryPointAddress === ENTRYPOINT_ADDRESS_V06) {
32
- const paymasterDataV06 = paymasterData;
33
- return {
34
- callGasLimit: BigInt(gas.callGasLimit),
35
- verificationGasLimit: BigInt(gas.verificationGasLimit),
36
- preVerificationGas: BigInt(gas.preVerificationGas),
37
- paymasterAndData: paymasterDataV06?.paymasterAndData,
38
- maxFeePerGas: BigInt(userOperation.maxFeePerGas),
39
- maxPriorityFeePerGas: BigInt(userOperation.maxPriorityFeePerGas)
40
- };
41
- }
42
- const stubDataV07 = stubData;
43
- const paymasterDataV07 = paymasterData;
44
- return {
45
- callGasLimit: BigInt(gas.callGasLimit),
46
- verificationGasLimit: BigInt(gas.verificationGasLimit),
47
- preVerificationGas: BigInt(gas.preVerificationGas),
48
- paymaster: paymasterDataV07.paymaster,
49
- paymasterData: paymasterDataV07.paymasterData,
50
- paymasterVerificationGasLimit: stubDataV07.paymasterVerificationGasLimit &&
51
- BigInt(stubDataV07.paymasterVerificationGasLimit),
52
- paymasterPostOpGasLimit: stubDataV07?.paymasterPostOpGasLimit &&
53
- BigInt(stubDataV07.paymasterPostOpGasLimit),
54
- maxFeePerGas: BigInt(userOperation.maxFeePerGas),
55
- maxPriorityFeePerGas: BigInt(userOperation.maxPriorityFeePerGas)
56
- };
57
- };
58
- //# sourceMappingURL=sponsorUserOperationEip7677.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sponsorUserOperationEip7677.js","sourceRoot":"","sources":["../../../actions/paymaster/sponsorUserOperationEip7677.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,sBAAsB,EAGzB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAKH,uBAAuB,EAC1B,MAAM,6BAA6B,CAAA;AA4DpC;;GAEG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,KAAK,EAG5C,MAA0C,EAC1C,IAAuD,EACvD,aAAwC,EACxC,cAA+B,EAC2B,EAAE;IAC5D,MAAM,EAAE,UAAU,EAAE,iBAAiB,EAAE,aAAa,EAAE,GAAG,IAAI,CAAA;IAC7D,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAA;IAC1B,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CACjC,uBAAuB,CAAC,iBAAiB,CAAC,CAC7C,CAAA;IACD,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,oBAAoB,CAAC;QACxD,aAAa,EAAE,aAGG;QAClB,KAAK;KACR,CAAC,CAAA;IACF,MAAM,iBAAiB,GAAG;QACtB,GAAG,aAAa;QAChB,GAAG,QAAQ;KACd,CAAA;IAED,MAAM,GAAG,GAAG,CAAC,MAAM,aAAa,CAAC,wBAAwB,CACrD;QACI,aAAa,EACT,iBAAoF;KAC3F,EACD,cAAc,CACjB,CAAmD,CAAA;IACpD,MAAM,oBAAoB,GAAG;QACzB,GAAG,iBAAiB;QACpB,YAAY,EAAE,GAAG,CAAC,YAAY;QAC9B,oBAAoB,EAAE,GAAG,CAAC,oBAAoB;QAC9C,kBAAkB,EAAE,GAAG,CAAC,kBAAkB;KACc,CAAA;IAE5D,MAAM,aAAa,GAAG,MAAM,eAAe,CAAC,gBAAgB,CAAC;QACzD,aAAa,EAAE,oBAAoB;QACnC,KAAK;KACR,CAAC,CAAA;IAEF,IAAI,iBAAiB,KAAK,sBAAsB,EAAE,CAAC;QAC/C,MAAM,gBAAgB,GAClB,aAAwE,CAAA;QAC5E,OAAO;YACH,YAAY,EAAE,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC;YACtC,oBAAoB,EAAE,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC;YACtD,kBAAkB,EAAE,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC;YAClD,gBAAgB,EAAE,gBAAgB,EAAE,gBAAgB;YACpD,YAAY,EAAE,MAAM,CAAC,aAAa,CAAC,YAAY,CAAC;YAChD,oBAAoB,EAAE,MAAM,CAAC,aAAa,CAAC,oBAAoB,CAAC;SACd,CAAA;IAC1D,CAAC;IACD,MAAM,WAAW,GACb,QAAuE,CAAA;IAC3E,MAAM,gBAAgB,GAClB,aAAwE,CAAA;IAE5E,OAAO;QACH,YAAY,EAAE,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC;QACtC,oBAAoB,EAAE,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC;QACtD,kBAAkB,EAAE,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC;QAClD,SAAS,EAAE,gBAAgB,CAAC,SAAS;QACrC,aAAa,EAAE,gBAAgB,CAAC,aAAa;QAC7C,6BAA6B,EACzB,WAAW,CAAC,6BAA6B;YACzC,MAAM,CAAC,WAAW,CAAC,6BAA6B,CAAC;QACrD,uBAAuB,EACnB,WAAW,EAAE,uBAAuB;YACpC,MAAM,CAAC,WAAW,CAAC,uBAAuB,CAAC;QAC/C,YAAY,EAAE,MAAM,CAAC,aAAa,CAAC,YAAY,CAAC;QAChD,oBAAoB,EAAE,MAAM,CAAC,aAAa,CAAC,oBAAoB,CAAC;KACd,CAAA;AAC1D,CAAC,CAAA"}
@@ -1,16 +0,0 @@
1
- import { type BundlerClient } from "permissionless";
2
- import type { ENTRYPOINT_ADDRESS_V06_TYPE, EntryPoint, PartialPick } from "permissionless/types";
3
- import type { StateOverrides } from "permissionless/types/bundler";
4
- import type { UserOperation } from "permissionless/types/userOperation.js";
5
- import type { PartialBy } from "viem/types/utils";
6
- import type { ZeroDevPaymasterClient } from "../../clients/paymasterClient.js";
7
- export type SponsorUserOperationEip7677Parameters<entryPoint extends EntryPoint> = {
8
- userOperation: entryPoint extends ENTRYPOINT_ADDRESS_V06_TYPE ? PartialBy<UserOperation<"v0.6">, "callGasLimit" | "preVerificationGas" | "verificationGasLimit"> : PartialBy<UserOperation<"v0.7">, "callGasLimit" | "preVerificationGas" | "verificationGasLimit" | "paymasterVerificationGasLimit" | "paymasterPostOpGasLimit">;
9
- entryPoint: entryPoint;
10
- };
11
- export type SponsorUserOperationEip7677ReturnType<entryPoint extends EntryPoint> = entryPoint extends ENTRYPOINT_ADDRESS_V06_TYPE ? Pick<UserOperation<"v0.6">, "callGasLimit" | "verificationGasLimit" | "preVerificationGas" | "paymasterAndData"> & PartialPick<UserOperation<"v0.6">, "maxFeePerGas" | "maxPriorityFeePerGas"> : Pick<UserOperation<"v0.7">, "callGasLimit" | "verificationGasLimit" | "preVerificationGas" | "paymaster" | "paymasterVerificationGasLimit" | "paymasterPostOpGasLimit" | "paymasterData"> & PartialPick<UserOperation<"v0.7">, "maxFeePerGas" | "maxPriorityFeePerGas">;
12
- /**
13
- * Returns paymasterAndData & updated gas parameters required to sponsor a userOperation.
14
- */
15
- export declare const sponsorUserOperationEip7677: <entryPoint extends EntryPoint>(client: ZeroDevPaymasterClient<entryPoint>, args: SponsorUserOperationEip7677Parameters<entryPoint>, bundlerClient: BundlerClient<entryPoint>, stateOverrides?: StateOverrides) => Promise<SponsorUserOperationEip7677ReturnType<entryPoint>>;
16
- //# sourceMappingURL=sponsorUserOperationEip7677.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sponsorUserOperationEip7677.d.ts","sourceRoot":"","sources":["../../../actions/paymaster/sponsorUserOperationEip7677.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,aAAa,EAIrB,MAAM,gBAAgB,CAAA;AAQvB,OAAO,KAAK,EACR,2BAA2B,EAE3B,UAAU,EACV,WAAW,EACd,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAA;AAC1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAA;AAE9E,MAAM,MAAM,qCAAqC,CAC7C,UAAU,SAAS,UAAU,IAC7B;IACA,aAAa,EAAE,UAAU,SAAS,2BAA2B,GACvD,SAAS,CACL,aAAa,CAAC,MAAM,CAAC,EACrB,cAAc,GAAG,oBAAoB,GAAG,sBAAsB,CACjE,GACD,SAAS,CACL,aAAa,CAAC,MAAM,CAAC,EACnB,cAAc,GACd,oBAAoB,GACpB,sBAAsB,GACtB,+BAA+B,GAC/B,yBAAyB,CAC9B,CAAA;IACP,UAAU,EAAE,UAAU,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,qCAAqC,CAC7C,UAAU,SAAS,UAAU,IAC7B,UAAU,SAAS,2BAA2B,GAC5C,IAAI,CACA,aAAa,CAAC,MAAM,CAAC,EACnB,cAAc,GACd,sBAAsB,GACtB,oBAAoB,GACpB,kBAAkB,CACvB,GACG,WAAW,CACP,aAAa,CAAC,MAAM,CAAC,EACrB,cAAc,GAAG,sBAAsB,CAC1C,GACL,IAAI,CACA,aAAa,CAAC,MAAM,CAAC,EACnB,cAAc,GACd,sBAAsB,GACtB,oBAAoB,GACpB,WAAW,GACX,+BAA+B,GAC/B,yBAAyB,GACzB,eAAe,CACpB,GACG,WAAW,CACP,aAAa,CAAC,MAAM,CAAC,EACrB,cAAc,GAAG,sBAAsB,CAC1C,CAAA;AAEX;;GAEG;AACH,eAAO,MAAM,2BAA2B,kMAMnB,cAAc,+DAsElC,CAAA"}
@@ -1,152 +0,0 @@
1
- import {
2
- type BundlerClient,
3
- ENTRYPOINT_ADDRESS_V06,
4
- type EstimateUserOperationGasParameters,
5
- type EstimateUserOperationGasReturnType
6
- } from "permissionless"
7
- import {
8
- type GetPaymasterDataParameters,
9
- type GetPaymasterDataReturnType,
10
- type GetPaymasterStubDataParameters,
11
- type GetPaymasterStubDataReturnType,
12
- paymasterActionsEip7677
13
- } from "permissionless/experimental"
14
- import type {
15
- ENTRYPOINT_ADDRESS_V06_TYPE,
16
- ENTRYPOINT_ADDRESS_V07_TYPE,
17
- EntryPoint,
18
- PartialPick
19
- } from "permissionless/types"
20
- import type { StateOverrides } from "permissionless/types/bundler"
21
- import type { UserOperation } from "permissionless/types/userOperation.js"
22
- import type { PartialBy } from "viem/types/utils"
23
- import type { ZeroDevPaymasterClient } from "../../clients/paymasterClient.js"
24
-
25
- export type SponsorUserOperationEip7677Parameters<
26
- entryPoint extends EntryPoint
27
- > = {
28
- userOperation: entryPoint extends ENTRYPOINT_ADDRESS_V06_TYPE
29
- ? PartialBy<
30
- UserOperation<"v0.6">,
31
- "callGasLimit" | "preVerificationGas" | "verificationGasLimit"
32
- >
33
- : PartialBy<
34
- UserOperation<"v0.7">,
35
- | "callGasLimit"
36
- | "preVerificationGas"
37
- | "verificationGasLimit"
38
- | "paymasterVerificationGasLimit"
39
- | "paymasterPostOpGasLimit"
40
- >
41
- entryPoint: entryPoint
42
- }
43
-
44
- export type SponsorUserOperationEip7677ReturnType<
45
- entryPoint extends EntryPoint
46
- > = entryPoint extends ENTRYPOINT_ADDRESS_V06_TYPE
47
- ? Pick<
48
- UserOperation<"v0.6">,
49
- | "callGasLimit"
50
- | "verificationGasLimit"
51
- | "preVerificationGas"
52
- | "paymasterAndData"
53
- > &
54
- PartialPick<
55
- UserOperation<"v0.6">,
56
- "maxFeePerGas" | "maxPriorityFeePerGas"
57
- >
58
- : Pick<
59
- UserOperation<"v0.7">,
60
- | "callGasLimit"
61
- | "verificationGasLimit"
62
- | "preVerificationGas"
63
- | "paymaster"
64
- | "paymasterVerificationGasLimit"
65
- | "paymasterPostOpGasLimit"
66
- | "paymasterData"
67
- > &
68
- PartialPick<
69
- UserOperation<"v0.7">,
70
- "maxFeePerGas" | "maxPriorityFeePerGas"
71
- >
72
-
73
- /**
74
- * Returns paymasterAndData & updated gas parameters required to sponsor a userOperation.
75
- */
76
- export const sponsorUserOperationEip7677 = async <
77
- entryPoint extends EntryPoint
78
- >(
79
- client: ZeroDevPaymasterClient<entryPoint>,
80
- args: SponsorUserOperationEip7677Parameters<entryPoint>,
81
- bundlerClient: BundlerClient<entryPoint>,
82
- stateOverrides?: StateOverrides
83
- ): Promise<SponsorUserOperationEip7677ReturnType<entryPoint>> => {
84
- const { entryPoint: entryPointAddress, userOperation } = args
85
- const chain = client.chain
86
- const paymasterClient = client.extend(
87
- paymasterActionsEip7677(entryPointAddress)
88
- )
89
- const stubData = await paymasterClient.getPaymasterStubData({
90
- userOperation: userOperation as GetPaymasterStubDataParameters<
91
- entryPoint,
92
- typeof chain
93
- >["userOperation"],
94
- chain
95
- })
96
- const stubUserOperation = {
97
- ...userOperation,
98
- ...stubData
99
- }
100
-
101
- const gas = (await bundlerClient.estimateUserOperationGas(
102
- {
103
- userOperation:
104
- stubUserOperation as EstimateUserOperationGasParameters<entryPoint>["userOperation"]
105
- },
106
- stateOverrides
107
- )) as EstimateUserOperationGasReturnType<entryPoint>
108
- const userOperationWithGas = {
109
- ...stubUserOperation,
110
- callGasLimit: gas.callGasLimit,
111
- verificationGasLimit: gas.verificationGasLimit,
112
- preVerificationGas: gas.preVerificationGas
113
- } as GetPaymasterDataParameters<entryPoint>["userOperation"]
114
-
115
- const paymasterData = await paymasterClient.getPaymasterData({
116
- userOperation: userOperationWithGas,
117
- chain
118
- })
119
-
120
- if (entryPointAddress === ENTRYPOINT_ADDRESS_V06) {
121
- const paymasterDataV06 =
122
- paymasterData as GetPaymasterDataReturnType<ENTRYPOINT_ADDRESS_V06_TYPE>
123
- return {
124
- callGasLimit: BigInt(gas.callGasLimit),
125
- verificationGasLimit: BigInt(gas.verificationGasLimit),
126
- preVerificationGas: BigInt(gas.preVerificationGas),
127
- paymasterAndData: paymasterDataV06?.paymasterAndData,
128
- maxFeePerGas: BigInt(userOperation.maxFeePerGas),
129
- maxPriorityFeePerGas: BigInt(userOperation.maxPriorityFeePerGas)
130
- } as SponsorUserOperationEip7677ReturnType<entryPoint>
131
- }
132
- const stubDataV07 =
133
- stubData as GetPaymasterStubDataReturnType<ENTRYPOINT_ADDRESS_V07_TYPE>
134
- const paymasterDataV07 =
135
- paymasterData as GetPaymasterDataReturnType<ENTRYPOINT_ADDRESS_V07_TYPE>
136
-
137
- return {
138
- callGasLimit: BigInt(gas.callGasLimit),
139
- verificationGasLimit: BigInt(gas.verificationGasLimit),
140
- preVerificationGas: BigInt(gas.preVerificationGas),
141
- paymaster: paymasterDataV07.paymaster,
142
- paymasterData: paymasterDataV07.paymasterData,
143
- paymasterVerificationGasLimit:
144
- stubDataV07.paymasterVerificationGasLimit &&
145
- BigInt(stubDataV07.paymasterVerificationGasLimit),
146
- paymasterPostOpGasLimit:
147
- stubDataV07?.paymasterPostOpGasLimit &&
148
- BigInt(stubDataV07.paymasterPostOpGasLimit),
149
- maxFeePerGas: BigInt(userOperation.maxFeePerGas),
150
- maxPriorityFeePerGas: BigInt(userOperation.maxPriorityFeePerGas)
151
- } as SponsorUserOperationEip7677ReturnType<entryPoint>
152
- }