permissionless 0.0.35 → 0.1.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 (325) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/_cjs/accounts/biconomy/privateKeyToBiconomySmartAccount.js.map +1 -1
  3. package/_cjs/accounts/biconomy/signerToBiconomySmartAccount.js +32 -15
  4. package/_cjs/accounts/biconomy/signerToBiconomySmartAccount.js.map +1 -1
  5. package/_cjs/accounts/kernel/signerToEcdsaKernelSmartAccount.js +38 -20
  6. package/_cjs/accounts/kernel/signerToEcdsaKernelSmartAccount.js.map +1 -1
  7. package/_cjs/accounts/safe/privateKeyToSafeSmartAccount.js.map +1 -1
  8. package/_cjs/accounts/safe/signerToSafeSmartAccount.js +42 -11
  9. package/_cjs/accounts/safe/signerToSafeSmartAccount.js.map +1 -1
  10. package/_cjs/accounts/simple/privateKeyToSimpleSmartAccount.js.map +1 -1
  11. package/_cjs/accounts/simple/signerToSimpleSmartAccount.js +104 -44
  12. package/_cjs/accounts/simple/signerToSimpleSmartAccount.js.map +1 -1
  13. package/_cjs/accounts/types.js.map +1 -1
  14. package/_cjs/actions/bundler/chainId.js.map +1 -1
  15. package/_cjs/actions/bundler/estimateUserOperationGas.js +20 -3
  16. package/_cjs/actions/bundler/estimateUserOperationGas.js.map +1 -1
  17. package/_cjs/actions/bundler/getUserOperationByHash.js +28 -11
  18. package/_cjs/actions/bundler/getUserOperationByHash.js.map +1 -1
  19. package/_cjs/actions/bundler/getUserOperationReceipt.js.map +1 -1
  20. package/_cjs/actions/bundler/sendUserOperation.js.map +1 -1
  21. package/_cjs/actions/bundler/supportedEntryPoints.js.map +1 -1
  22. package/_cjs/actions/pimlico/getUserOperationGasPrice.js +7 -7
  23. package/_cjs/actions/pimlico/getUserOperationGasPrice.js.map +1 -1
  24. package/_cjs/actions/pimlico/sponsorUserOperation.js +19 -7
  25. package/_cjs/actions/pimlico/sponsorUserOperation.js.map +1 -1
  26. package/_cjs/actions/pimlico/validateSponsorshipPolicies.js.map +1 -1
  27. package/_cjs/actions/public/getAccountNonce.js.map +1 -1
  28. package/_cjs/actions/public/getSenderAddress.js +5 -2
  29. package/_cjs/actions/public/getSenderAddress.js.map +1 -1
  30. package/_cjs/actions/smartAccount/deployContract.js +3 -4
  31. package/_cjs/actions/smartAccount/deployContract.js.map +1 -1
  32. package/_cjs/actions/smartAccount/prepareUserOperationRequest.js +142 -19
  33. package/_cjs/actions/smartAccount/prepareUserOperationRequest.js.map +1 -1
  34. package/_cjs/actions/smartAccount/sendTransaction.js +3 -4
  35. package/_cjs/actions/smartAccount/sendTransaction.js.map +1 -1
  36. package/_cjs/actions/smartAccount/sendTransactions.js +3 -4
  37. package/_cjs/actions/smartAccount/sendTransactions.js.map +1 -1
  38. package/_cjs/actions/smartAccount/sendUserOperation.js +1 -1
  39. package/_cjs/actions/smartAccount/sendUserOperation.js.map +1 -1
  40. package/_cjs/actions/smartAccount/signMessage.js.map +1 -1
  41. package/_cjs/actions/smartAccount/signTypedData.js.map +1 -1
  42. package/_cjs/actions/smartAccount/writeContract.js.map +1 -1
  43. package/_cjs/actions/stackup/accounts.js +2 -2
  44. package/_cjs/actions/stackup/accounts.js.map +1 -1
  45. package/_cjs/actions/stackup/sponsorUserOperation.js +20 -12
  46. package/_cjs/actions/stackup/sponsorUserOperation.js.map +1 -1
  47. package/_cjs/clients/createBundlerClient.js +1 -1
  48. package/_cjs/clients/createBundlerClient.js.map +1 -1
  49. package/_cjs/clients/createSmartAccountClient.js +3 -3
  50. package/_cjs/clients/createSmartAccountClient.js.map +1 -1
  51. package/_cjs/clients/decorators/bundler.js +6 -3
  52. package/_cjs/clients/decorators/bundler.js.map +1 -1
  53. package/_cjs/clients/decorators/pimlico.js +6 -3
  54. package/_cjs/clients/decorators/pimlico.js.map +1 -1
  55. package/_cjs/clients/decorators/smartAccount.js +7 -7
  56. package/_cjs/clients/decorators/smartAccount.js.map +1 -1
  57. package/_cjs/clients/decorators/stackup.js.map +1 -1
  58. package/_cjs/clients/pimlico.js +4 -2
  59. package/_cjs/clients/pimlico.js.map +1 -1
  60. package/_cjs/clients/stackup.js +3 -1
  61. package/_cjs/clients/stackup.js.map +1 -1
  62. package/_cjs/errors/estimateUserOperationGas.js.map +1 -1
  63. package/_cjs/errors/sendUserOperation.js.map +1 -1
  64. package/_cjs/types/entrypoint.js +3 -0
  65. package/_cjs/types/entrypoint.js.map +1 -0
  66. package/_cjs/utils/errors/getBundlerError.js.map +1 -1
  67. package/_cjs/utils/errors/getEstimateUserOperationGasError.js.map +1 -1
  68. package/_cjs/utils/errors/getSendUserOperationError.js.map +1 -1
  69. package/_cjs/utils/getEntryPointVersion.js +8 -0
  70. package/_cjs/utils/getEntryPointVersion.js.map +1 -0
  71. package/_cjs/utils/getRequiredPrefund.js +19 -6
  72. package/_cjs/utils/getRequiredPrefund.js.map +1 -1
  73. package/_cjs/utils/getUserOperationHash.js +81 -17
  74. package/_cjs/utils/getUserOperationHash.js.map +1 -1
  75. package/_cjs/utils/index.js +5 -1
  76. package/_cjs/utils/index.js.map +1 -1
  77. package/_cjs/utils/providerToSmartAccountSigner.js +1 -1
  78. package/_cjs/utils/providerToSmartAccountSigner.js.map +1 -1
  79. package/_cjs/utils/signUserOperationHashWithECDSA.js +2 -2
  80. package/_cjs/utils/signUserOperationHashWithECDSA.js.map +1 -1
  81. package/_esm/accounts/biconomy/privateKeyToBiconomySmartAccount.js.map +1 -1
  82. package/_esm/accounts/biconomy/signerToBiconomySmartAccount.js +32 -15
  83. package/_esm/accounts/biconomy/signerToBiconomySmartAccount.js.map +1 -1
  84. package/_esm/accounts/kernel/signerToEcdsaKernelSmartAccount.js +38 -21
  85. package/_esm/accounts/kernel/signerToEcdsaKernelSmartAccount.js.map +1 -1
  86. package/_esm/accounts/safe/privateKeyToSafeSmartAccount.js.map +1 -1
  87. package/_esm/accounts/safe/signerToSafeSmartAccount.js +42 -11
  88. package/_esm/accounts/safe/signerToSafeSmartAccount.js.map +1 -1
  89. package/_esm/accounts/simple/privateKeyToSimpleSmartAccount.js.map +1 -1
  90. package/_esm/accounts/simple/signerToSimpleSmartAccount.js +105 -44
  91. package/_esm/accounts/simple/signerToSimpleSmartAccount.js.map +1 -1
  92. package/_esm/accounts/types.js +0 -1
  93. package/_esm/accounts/types.js.map +1 -1
  94. package/_esm/actions/bundler/chainId.js.map +1 -1
  95. package/_esm/actions/bundler/estimateUserOperationGas.js +20 -3
  96. package/_esm/actions/bundler/estimateUserOperationGas.js.map +1 -1
  97. package/_esm/actions/bundler/getUserOperationByHash.js +28 -11
  98. package/_esm/actions/bundler/getUserOperationByHash.js.map +1 -1
  99. package/_esm/actions/bundler/getUserOperationReceipt.js.map +1 -1
  100. package/_esm/actions/bundler/sendUserOperation.js.map +1 -1
  101. package/_esm/actions/bundler/supportedEntryPoints.js.map +1 -1
  102. package/_esm/actions/pimlico/getUserOperationGasPrice.js +7 -7
  103. package/_esm/actions/pimlico/getUserOperationGasPrice.js.map +1 -1
  104. package/_esm/actions/pimlico/sponsorUserOperation.js +19 -7
  105. package/_esm/actions/pimlico/sponsorUserOperation.js.map +1 -1
  106. package/_esm/actions/pimlico/validateSponsorshipPolicies.js.map +1 -1
  107. package/_esm/actions/public/getAccountNonce.js.map +1 -1
  108. package/_esm/actions/public/getSenderAddress.js +6 -3
  109. package/_esm/actions/public/getSenderAddress.js.map +1 -1
  110. package/_esm/actions/smartAccount/deployContract.js +3 -4
  111. package/_esm/actions/smartAccount/deployContract.js.map +1 -1
  112. package/_esm/actions/smartAccount/prepareUserOperationRequest.js +142 -19
  113. package/_esm/actions/smartAccount/prepareUserOperationRequest.js.map +1 -1
  114. package/_esm/actions/smartAccount/sendTransaction.js +3 -4
  115. package/_esm/actions/smartAccount/sendTransaction.js.map +1 -1
  116. package/_esm/actions/smartAccount/sendTransactions.js +3 -4
  117. package/_esm/actions/smartAccount/sendTransactions.js.map +1 -1
  118. package/_esm/actions/smartAccount/sendUserOperation.js +1 -1
  119. package/_esm/actions/smartAccount/sendUserOperation.js.map +1 -1
  120. package/_esm/actions/smartAccount/signMessage.js.map +1 -1
  121. package/_esm/actions/smartAccount/signTypedData.js.map +1 -1
  122. package/_esm/actions/smartAccount/writeContract.js.map +1 -1
  123. package/_esm/actions/stackup/accounts.js +2 -2
  124. package/_esm/actions/stackup/accounts.js.map +1 -1
  125. package/_esm/actions/stackup/sponsorUserOperation.js +20 -12
  126. package/_esm/actions/stackup/sponsorUserOperation.js.map +1 -1
  127. package/_esm/clients/createBundlerClient.js +1 -1
  128. package/_esm/clients/createBundlerClient.js.map +1 -1
  129. package/_esm/clients/createSmartAccountClient.js +22 -3
  130. package/_esm/clients/createSmartAccountClient.js.map +1 -1
  131. package/_esm/clients/decorators/bundler.js +6 -3
  132. package/_esm/clients/decorators/bundler.js.map +1 -1
  133. package/_esm/clients/decorators/pimlico.js +6 -3
  134. package/_esm/clients/decorators/pimlico.js.map +1 -1
  135. package/_esm/clients/decorators/smartAccount.js +7 -7
  136. package/_esm/clients/decorators/smartAccount.js.map +1 -1
  137. package/_esm/clients/decorators/stackup.js.map +1 -1
  138. package/_esm/clients/pimlico.js +4 -2
  139. package/_esm/clients/pimlico.js.map +1 -1
  140. package/_esm/clients/stackup.js +3 -1
  141. package/_esm/clients/stackup.js.map +1 -1
  142. package/_esm/errors/estimateUserOperationGas.js.map +1 -1
  143. package/_esm/errors/sendUserOperation.js.map +1 -1
  144. package/_esm/types/entrypoint.js +2 -0
  145. package/_esm/types/entrypoint.js.map +1 -0
  146. package/_esm/utils/errors/getBundlerError.js.map +1 -1
  147. package/_esm/utils/errors/getEstimateUserOperationGasError.js.map +1 -1
  148. package/_esm/utils/errors/getSendUserOperationError.js.map +1 -1
  149. package/_esm/utils/getEntryPointVersion.js +4 -0
  150. package/_esm/utils/getEntryPointVersion.js.map +1 -0
  151. package/_esm/utils/getRequiredPrefund.js +19 -6
  152. package/_esm/utils/getRequiredPrefund.js.map +1 -1
  153. package/_esm/utils/getUserOperationHash.js +82 -18
  154. package/_esm/utils/getUserOperationHash.js.map +1 -1
  155. package/_esm/utils/index.js +2 -1
  156. package/_esm/utils/index.js.map +1 -1
  157. package/_esm/utils/providerToSmartAccountSigner.js +1 -1
  158. package/_esm/utils/providerToSmartAccountSigner.js.map +1 -1
  159. package/_esm/utils/signUserOperationHashWithECDSA.js +2 -3
  160. package/_esm/utils/signUserOperationHashWithECDSA.js.map +1 -1
  161. package/_types/accounts/biconomy/privateKeyToBiconomySmartAccount.d.ts +4 -4
  162. package/_types/accounts/biconomy/privateKeyToBiconomySmartAccount.d.ts.map +1 -1
  163. package/_types/accounts/biconomy/signerToBiconomySmartAccount.d.ts +5 -4
  164. package/_types/accounts/biconomy/signerToBiconomySmartAccount.d.ts.map +1 -1
  165. package/_types/accounts/kernel/signerToEcdsaKernelSmartAccount.d.ts +5 -4
  166. package/_types/accounts/kernel/signerToEcdsaKernelSmartAccount.d.ts.map +1 -1
  167. package/_types/accounts/safe/privateKeyToSafeSmartAccount.d.ts +4 -4
  168. package/_types/accounts/safe/privateKeyToSafeSmartAccount.d.ts.map +1 -1
  169. package/_types/accounts/safe/signerToSafeSmartAccount.d.ts +6 -5
  170. package/_types/accounts/safe/signerToSafeSmartAccount.d.ts.map +1 -1
  171. package/_types/accounts/simple/privateKeyToSimpleSmartAccount.d.ts +4 -4
  172. package/_types/accounts/simple/privateKeyToSimpleSmartAccount.d.ts.map +1 -1
  173. package/_types/accounts/simple/signerToSimpleSmartAccount.d.ts +5 -4
  174. package/_types/accounts/simple/signerToSimpleSmartAccount.d.ts.map +1 -1
  175. package/_types/accounts/types.d.ts +8 -5
  176. package/_types/accounts/types.d.ts.map +1 -1
  177. package/_types/actions/bundler/chainId.d.ts +2 -1
  178. package/_types/actions/bundler/chainId.d.ts.map +1 -1
  179. package/_types/actions/bundler/estimateUserOperationGas.d.ts +14 -7
  180. package/_types/actions/bundler/estimateUserOperationGas.d.ts.map +1 -1
  181. package/_types/actions/bundler/getUserOperationByHash.d.ts +10 -3
  182. package/_types/actions/bundler/getUserOperationByHash.d.ts.map +1 -1
  183. package/_types/actions/bundler/getUserOperationReceipt.d.ts +2 -1
  184. package/_types/actions/bundler/getUserOperationReceipt.d.ts.map +1 -1
  185. package/_types/actions/bundler/sendUserOperation.d.ts +6 -5
  186. package/_types/actions/bundler/sendUserOperation.d.ts.map +1 -1
  187. package/_types/actions/bundler/supportedEntryPoints.d.ts +3 -2
  188. package/_types/actions/bundler/supportedEntryPoints.d.ts.map +1 -1
  189. package/_types/actions/pimlico/getUserOperationGasPrice.d.ts.map +1 -1
  190. package/_types/actions/pimlico/sponsorUserOperation.d.ts +47 -6
  191. package/_types/actions/pimlico/sponsorUserOperation.d.ts.map +1 -1
  192. package/_types/actions/pimlico/validateSponsorshipPolicies.d.ts +10 -5
  193. package/_types/actions/pimlico/validateSponsorshipPolicies.d.ts.map +1 -1
  194. package/_types/actions/public/getAccountNonce.d.ts +2 -1
  195. package/_types/actions/public/getAccountNonce.d.ts.map +1 -1
  196. package/_types/actions/public/getSenderAddress.d.ts +11 -3
  197. package/_types/actions/public/getSenderAddress.d.ts.map +1 -1
  198. package/_types/actions/smartAccount/deployContract.d.ts +4 -3
  199. package/_types/actions/smartAccount/deployContract.d.ts.map +1 -1
  200. package/_types/actions/smartAccount/prepareUserOperationRequest.d.ts +21 -11
  201. package/_types/actions/smartAccount/prepareUserOperationRequest.d.ts.map +1 -1
  202. package/_types/actions/smartAccount/sendTransaction.d.ts +4 -3
  203. package/_types/actions/smartAccount/sendTransaction.d.ts.map +1 -1
  204. package/_types/actions/smartAccount/sendTransactions.d.ts +5 -4
  205. package/_types/actions/smartAccount/sendTransactions.d.ts.map +1 -1
  206. package/_types/actions/smartAccount/sendUserOperation.d.ts +6 -5
  207. package/_types/actions/smartAccount/sendUserOperation.d.ts.map +1 -1
  208. package/_types/actions/smartAccount/signMessage.d.ts +2 -1
  209. package/_types/actions/smartAccount/signMessage.d.ts.map +1 -1
  210. package/_types/actions/smartAccount/signTypedData.d.ts +3 -2
  211. package/_types/actions/smartAccount/signTypedData.d.ts.map +1 -1
  212. package/_types/actions/smartAccount/writeContract.d.ts +4 -3
  213. package/_types/actions/smartAccount/writeContract.d.ts.map +1 -1
  214. package/_types/actions/smartAccount.d.ts +2 -2
  215. package/_types/actions/smartAccount.d.ts.map +1 -1
  216. package/_types/actions/stackup/accounts.d.ts +4 -3
  217. package/_types/actions/stackup/accounts.d.ts.map +1 -1
  218. package/_types/actions/stackup/sponsorUserOperation.d.ts +6 -6
  219. package/_types/actions/stackup/sponsorUserOperation.d.ts.map +1 -1
  220. package/_types/clients/createBundlerClient.d.ts +6 -3
  221. package/_types/clients/createBundlerClient.d.ts.map +1 -1
  222. package/_types/clients/createSmartAccountClient.d.ts +9 -5
  223. package/_types/clients/createSmartAccountClient.d.ts.map +1 -1
  224. package/_types/clients/decorators/bundler.d.ts +7 -7
  225. package/_types/clients/decorators/bundler.d.ts.map +1 -1
  226. package/_types/clients/decorators/pimlico.d.ts +6 -5
  227. package/_types/clients/decorators/pimlico.d.ts.map +1 -1
  228. package/_types/clients/decorators/smartAccount.d.ts +12 -12
  229. package/_types/clients/decorators/smartAccount.d.ts.map +1 -1
  230. package/_types/clients/decorators/stackup.d.ts +5 -4
  231. package/_types/clients/decorators/stackup.d.ts.map +1 -1
  232. package/_types/clients/pimlico.d.ts +11 -6
  233. package/_types/clients/pimlico.d.ts.map +1 -1
  234. package/_types/clients/stackup.d.ts +6 -3
  235. package/_types/clients/stackup.d.ts.map +1 -1
  236. package/_types/errors/estimateUserOperationGas.d.ts +4 -3
  237. package/_types/errors/estimateUserOperationGas.d.ts.map +1 -1
  238. package/_types/errors/sendUserOperation.d.ts +4 -3
  239. package/_types/errors/sendUserOperation.d.ts.map +1 -1
  240. package/_types/types/bundler.d.ts +16 -21
  241. package/_types/types/bundler.d.ts.map +1 -1
  242. package/_types/types/entrypoint.d.ts +6 -0
  243. package/_types/types/entrypoint.d.ts.map +1 -0
  244. package/_types/types/index.d.ts +6 -4
  245. package/_types/types/index.d.ts.map +1 -1
  246. package/_types/types/pimlico.d.ts +20 -6
  247. package/_types/types/pimlico.d.ts.map +1 -1
  248. package/_types/types/stackup.d.ts +18 -4
  249. package/_types/types/stackup.d.ts.map +1 -1
  250. package/_types/types/userOperation.d.ts +51 -2
  251. package/_types/types/userOperation.d.ts.map +1 -1
  252. package/_types/utils/errors/getBundlerError.d.ts +4 -4
  253. package/_types/utils/errors/getBundlerError.d.ts.map +1 -1
  254. package/_types/utils/errors/getEstimateUserOperationGasError.d.ts +3 -2
  255. package/_types/utils/errors/getEstimateUserOperationGasError.d.ts.map +1 -1
  256. package/_types/utils/errors/getSendUserOperationError.d.ts +2 -1
  257. package/_types/utils/errors/getSendUserOperationError.d.ts.map +1 -1
  258. package/_types/utils/getEntryPointVersion.d.ts +6 -0
  259. package/_types/utils/getEntryPointVersion.d.ts.map +1 -0
  260. package/_types/utils/getRequiredPrefund.d.ts +5 -4
  261. package/_types/utils/getRequiredPrefund.d.ts.map +1 -1
  262. package/_types/utils/getUserOperationHash.d.ts +6 -5
  263. package/_types/utils/getUserOperationHash.d.ts.map +1 -1
  264. package/_types/utils/index.d.ts +2 -1
  265. package/_types/utils/index.d.ts.map +1 -1
  266. package/_types/utils/providerToSmartAccountSigner.d.ts +4 -1
  267. package/_types/utils/providerToSmartAccountSigner.d.ts.map +1 -1
  268. package/_types/utils/signUserOperationHashWithECDSA.d.ts +6 -6
  269. package/_types/utils/signUserOperationHashWithECDSA.d.ts.map +1 -1
  270. package/accounts/biconomy/privateKeyToBiconomySmartAccount.ts +17 -6
  271. package/accounts/biconomy/signerToBiconomySmartAccount.ts +50 -21
  272. package/accounts/kernel/signerToEcdsaKernelSmartAccount.ts +64 -30
  273. package/accounts/safe/privateKeyToSafeSmartAccount.ts +8 -5
  274. package/accounts/safe/signerToSafeSmartAccount.ts +57 -17
  275. package/accounts/simple/privateKeyToSimpleSmartAccount.ts +25 -7
  276. package/accounts/simple/signerToSimpleSmartAccount.ts +127 -56
  277. package/accounts/types.ts +12 -4
  278. package/actions/bundler/chainId.ts +3 -1
  279. package/actions/bundler/estimateUserOperationGas.ts +77 -22
  280. package/actions/bundler/getUserOperationByHash.ts +44 -15
  281. package/actions/bundler/getUserOperationReceipt.ts +3 -1
  282. package/actions/bundler/sendUserOperation.ts +13 -17
  283. package/actions/bundler/supportedEntryPoints.ts +5 -3
  284. package/actions/pimlico/getUserOperationGasPrice.ts +7 -9
  285. package/actions/pimlico/sponsorUserOperation.ts +97 -23
  286. package/actions/pimlico/validateSponsorshipPolicies.ts +18 -7
  287. package/actions/public/getAccountNonce.ts +2 -1
  288. package/actions/public/getSenderAddress.ts +30 -5
  289. package/actions/smartAccount/deployContract.ts +14 -10
  290. package/actions/smartAccount/prepareUserOperationRequest.ts +339 -49
  291. package/actions/smartAccount/sendTransaction.ts +20 -11
  292. package/actions/smartAccount/sendTransactions.ts +17 -11
  293. package/actions/smartAccount/sendUserOperation.ts +56 -23
  294. package/actions/smartAccount/signMessage.ts +3 -1
  295. package/actions/smartAccount/signTypedData.ts +3 -1
  296. package/actions/smartAccount/writeContract.ts +12 -5
  297. package/actions/smartAccount.ts +2 -2
  298. package/actions/stackup/accounts.ts +7 -6
  299. package/actions/stackup/sponsorUserOperation.ts +85 -31
  300. package/clients/createBundlerClient.ts +11 -6
  301. package/clients/createSmartAccountClient.ts +34 -20
  302. package/clients/decorators/bundler.ts +51 -27
  303. package/clients/decorators/pimlico.ts +43 -17
  304. package/clients/decorators/smartAccount.ts +115 -37
  305. package/clients/decorators/stackup.ts +14 -10
  306. package/clients/pimlico.ts +22 -13
  307. package/clients/stackup.ts +13 -7
  308. package/errors/estimateUserOperationGas.ts +7 -4
  309. package/errors/sendUserOperation.ts +9 -5
  310. package/package.json +1 -1
  311. package/types/bundler.ts +40 -28
  312. package/types/entrypoint.ts +13 -0
  313. package/types/index.ts +15 -5
  314. package/types/pimlico.ts +43 -17
  315. package/types/stackup.ts +39 -15
  316. package/types/userOperation.ts +82 -26
  317. package/utils/errors/getBundlerError.ts +10 -6
  318. package/utils/errors/getEstimateUserOperationGasError.ts +13 -10
  319. package/utils/errors/getSendUserOperationError.ts +4 -3
  320. package/utils/getEntryPointVersion.ts +15 -0
  321. package/utils/getRequiredPrefund.ts +35 -11
  322. package/utils/getUserOperationHash.ts +113 -23
  323. package/utils/index.ts +9 -1
  324. package/utils/providerToSmartAccountSigner.ts +6 -3
  325. package/utils/signUserOperationHashWithECDSA.ts +13 -7
@@ -1,4 +1,3 @@
1
- import type { Address } from "viem"
2
1
  import type { Client, Hash } from "viem"
3
2
  import { chainId } from "../../actions/bundler/chainId"
4
3
  import {
@@ -27,9 +26,10 @@ import {
27
26
  } from "../../actions/bundler/waitForUserOperationReceipt"
28
27
  import type { Prettify } from "../../types/"
29
28
  import type { StateOverrides } from "../../types/bundler"
29
+ import type { EntryPoint } from "../../types/entrypoint"
30
30
  import type { BundlerClient } from "../createBundlerClient"
31
31
 
32
- export type BundlerActions = {
32
+ export type BundlerActions<entryPoint extends EntryPoint> = {
33
33
  /**
34
34
  *
35
35
  * Sends user operation to the bundler
@@ -56,7 +56,9 @@ export type BundlerActions = {
56
56
  * // Return '0xe9fad2cd67f9ca1d0b7a6513b2a42066784c8df938518da2b51bb8cc9a89ea34'
57
57
  */
58
58
  sendUserOperation: (
59
- args: Prettify<SendUserOperationParameters>
59
+ args: Prettify<
60
+ Omit<SendUserOperationParameters<entryPoint>, "entryPoint">
61
+ >
60
62
  ) => Promise<Hash>
61
63
  /**
62
64
  *
@@ -84,9 +86,11 @@ export type BundlerActions = {
84
86
  * // Return {preVerificationGas: 43492n, verificationGasLimit: 59436n, callGasLimit: 9000n}
85
87
  */
86
88
  estimateUserOperationGas: (
87
- args: Prettify<EstimateUserOperationGasParameters>,
89
+ args: Prettify<
90
+ Omit<EstimateUserOperationGasParameters<entryPoint>, "entryPoint">
91
+ >,
88
92
  stateOverrides?: StateOverrides
89
- ) => Promise<Prettify<EstimateUserOperationGasReturnType>>
93
+ ) => Promise<Prettify<EstimateUserOperationGasReturnType<entryPoint>>>
90
94
  /**
91
95
  *
92
96
  * Returns the supported entrypoints by the bundler service
@@ -108,7 +112,7 @@ export type BundlerActions = {
108
112
  *
109
113
  * // Return ['0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789']
110
114
  */
111
- supportedEntryPoints: () => Promise<Address[]>
115
+ supportedEntryPoints: () => Promise<EntryPoint[]>
112
116
  /**
113
117
  *
114
118
  * Returns the supported chain id by the bundler service
@@ -153,7 +157,7 @@ export type BundlerActions = {
153
157
  */
154
158
  getUserOperationByHash: (
155
159
  args: Prettify<GetUserOperationByHashParameters>
156
- ) => Promise<Prettify<GetUserOperationByHashReturnType> | null>
160
+ ) => Promise<Prettify<GetUserOperationByHashReturnType<entryPoint>> | null>
157
161
  /**
158
162
  *
159
163
  * Returns the user operation receipt from userOpHash
@@ -205,25 +209,45 @@ export type BundlerActions = {
205
209
  ) => Promise<Prettify<GetUserOperationReceiptReturnType>>
206
210
  }
207
211
 
208
- const bundlerActions = (client: Client): BundlerActions => ({
209
- sendUserOperation: async (
210
- args: SendUserOperationParameters
211
- ): Promise<Hash> => sendUserOperation(client as BundlerClient, args),
212
- estimateUserOperationGas: (
213
- args: EstimateUserOperationGasParameters,
214
- stateOverrides
215
- ) =>
216
- estimateUserOperationGas(client as BundlerClient, args, stateOverrides),
217
- supportedEntryPoints: (): Promise<Address[]> =>
218
- supportedEntryPoints(client as BundlerClient),
219
- chainId: () => chainId(client as BundlerClient),
220
- getUserOperationByHash: (args: GetUserOperationByHashParameters) =>
221
- getUserOperationByHash(client as BundlerClient, args),
222
- getUserOperationReceipt: (args: GetUserOperationReceiptParameters) =>
223
- getUserOperationReceipt(client as BundlerClient, args),
224
- waitForUserOperationReceipt: (
225
- args: WaitForUserOperationReceiptParameters
226
- ) => waitForUserOperationReceipt(client as BundlerClient, args)
227
- })
212
+ const bundlerActions =
213
+ <entryPoint extends EntryPoint>(entryPointAddress: entryPoint) =>
214
+ (client: Client): BundlerActions<entryPoint> => ({
215
+ sendUserOperation: async (
216
+ args: Omit<SendUserOperationParameters<entryPoint>, "entryPoint">
217
+ ): Promise<Hash> =>
218
+ sendUserOperation<entryPoint>(client as BundlerClient<entryPoint>, {
219
+ ...args,
220
+ entryPoint: entryPointAddress
221
+ }),
222
+ estimateUserOperationGas: (
223
+ args: Omit<
224
+ EstimateUserOperationGasParameters<entryPoint>,
225
+ "entryPoint"
226
+ >,
227
+ stateOverrides?: StateOverrides
228
+ ) =>
229
+ estimateUserOperationGas<entryPoint>(
230
+ client as BundlerClient<entryPoint>,
231
+ { ...args, entryPoint: entryPointAddress },
232
+ stateOverrides
233
+ ),
234
+ supportedEntryPoints: (): Promise<EntryPoint[]> =>
235
+ supportedEntryPoints(client as BundlerClient<entryPoint>),
236
+ chainId: () => chainId(client as BundlerClient<entryPoint>),
237
+ getUserOperationByHash: (args: GetUserOperationByHashParameters) =>
238
+ getUserOperationByHash<entryPoint>(
239
+ client as BundlerClient<entryPoint>,
240
+ args
241
+ ),
242
+ getUserOperationReceipt: (args: GetUserOperationReceiptParameters) =>
243
+ getUserOperationReceipt(client as BundlerClient<entryPoint>, args),
244
+ waitForUserOperationReceipt: (
245
+ args: WaitForUserOperationReceiptParameters
246
+ ) =>
247
+ waitForUserOperationReceipt(
248
+ client as BundlerClient<entryPoint>,
249
+ args
250
+ )
251
+ })
228
252
 
229
253
  export { bundlerActions }
@@ -21,6 +21,7 @@ import {
21
21
  sponsorUserOperation
22
22
  } from "../../actions/pimlico/sponsorUserOperation"
23
23
  import type { Prettify } from "../../types/"
24
+ import type { EntryPoint } from "../../types/entrypoint"
24
25
  import type { PimlicoBundlerClient, PimlicoPaymasterClient } from "../pimlico"
25
26
 
26
27
  export type PimlicoBundlerActions = {
@@ -97,19 +98,26 @@ export type PimlicoBundlerActions = {
97
98
  ) => Promise<Hash>
98
99
  }
99
100
 
100
- export const pimlicoBundlerActions = (
101
+ export const pimlicoBundlerActions = <entryPoint extends EntryPoint>(
101
102
  client: Client
102
103
  ): PimlicoBundlerActions => ({
103
104
  getUserOperationGasPrice: async () =>
104
- getUserOperationGasPrice(client as PimlicoBundlerClient),
105
+ getUserOperationGasPrice(client as PimlicoBundlerClient<entryPoint>),
105
106
  getUserOperationStatus: async (args: GetUserOperationStatusParameters) =>
106
- getUserOperationStatus(client as PimlicoBundlerClient, args),
107
+ getUserOperationStatus(
108
+ client as PimlicoBundlerClient<entryPoint>,
109
+ args
110
+ ),
107
111
  sendCompressedUserOperation: async (
108
112
  args: SendCompressedUserOperationParameters
109
- ) => sendCompressedUserOperation(client as PimlicoBundlerClient, args)
113
+ ) =>
114
+ sendCompressedUserOperation(
115
+ client as PimlicoBundlerClient<entryPoint>,
116
+ args
117
+ )
110
118
  })
111
119
 
112
- export type PimlicoPaymasterClientActions = {
120
+ export type PimlicoPaymasterClientActions<entryPoint extends EntryPoint> = {
113
121
  /**
114
122
  * Returns paymasterAndData & updated gas parameters required to sponsor a userOperation.
115
123
  *
@@ -134,11 +142,11 @@ export type PimlicoPaymasterClientActions = {
134
142
  *
135
143
  */
136
144
  sponsorUserOperation: (
137
- args: Prettify<PimlicoSponsorUserOperationParameters>
138
- ) => Promise<Prettify<SponsorUserOperationReturnType>>
145
+ args: Prettify<PimlicoSponsorUserOperationParameters<entryPoint>>
146
+ ) => Promise<Prettify<SponsorUserOperationReturnType<entryPoint>>>
139
147
 
140
148
  validateSponsorshipPolicies: (
141
- args: Prettify<ValidateSponsorshipPoliciesParameters>
149
+ args: Prettify<ValidateSponsorshipPoliciesParameters<entryPoint>>
142
150
  ) => Promise<Prettify<ValidateSponsorshipPolicies>[]>
143
151
  }
144
152
 
@@ -177,15 +185,33 @@ export type PimlicoPaymasterClientActions = {
177
185
  * }
178
186
  * ]
179
187
  */
180
- export const pimlicoPaymasterActions = (
181
- client: Client
182
- ): PimlicoPaymasterClientActions => ({
183
- sponsorUserOperation: async (args: PimlicoSponsorUserOperationParameters) =>
184
- sponsorUserOperation(client as PimlicoPaymasterClient, args),
185
- validateSponsorshipPolicies: async (
186
- args: ValidateSponsorshipPoliciesParameters
187
- ) => validateSponsorshipPolicies(client as PimlicoPaymasterClient, args)
188
- })
188
+ export const pimlicoPaymasterActions =
189
+ <entryPoint extends EntryPoint>(entryPointAddress: entryPoint) =>
190
+ (client: Client): PimlicoPaymasterClientActions<entryPoint> => ({
191
+ sponsorUserOperation: async (
192
+ args: Omit<
193
+ PimlicoSponsorUserOperationParameters<entryPoint>,
194
+ "entryPoint"
195
+ >
196
+ ) =>
197
+ sponsorUserOperation<entryPoint>(
198
+ client as PimlicoPaymasterClient<entryPoint>,
199
+ {
200
+ ...args,
201
+ entryPoint: entryPointAddress
202
+ }
203
+ ),
204
+ validateSponsorshipPolicies: async (
205
+ args: Omit<
206
+ ValidateSponsorshipPoliciesParameters<entryPoint>,
207
+ "entryPoint"
208
+ >
209
+ ) =>
210
+ validateSponsorshipPolicies<entryPoint>(
211
+ client as PimlicoPaymasterClient<entryPoint>,
212
+ { ...args, entryPoint: entryPointAddress }
213
+ )
214
+ })
189
215
 
190
216
  /**
191
217
  * TODO: Add support for pimlicoActions after we support all the actions of v2 of the Pimlico API.
@@ -21,8 +21,8 @@ import {
21
21
  deployContract
22
22
  } from "../../actions/smartAccount/deployContract"
23
23
  import {
24
+ type Middleware,
24
25
  type PrepareUserOperationRequestReturnType,
25
- type SponsorUserOperationMiddleware,
26
26
  prepareUserOperationRequest
27
27
  } from "../../actions/smartAccount/prepareUserOperationRequest"
28
28
  import {
@@ -41,10 +41,14 @@ import {
41
41
  } from "../../actions/smartAccount/writeContract"
42
42
  import type { Prettify } from "../../types/"
43
43
  import type { StateOverrides } from "../../types/bundler"
44
+ import type { EntryPoint } from "../../types/entrypoint"
44
45
 
45
46
  export type SmartAccountActions<
47
+ entryPoint extends EntryPoint,
46
48
  TChain extends Chain | undefined = Chain | undefined,
47
- TSmartAccount extends SmartAccount | undefined = SmartAccount | undefined
49
+ TSmartAccount extends SmartAccount<entryPoint> | undefined =
50
+ | SmartAccount<entryPoint>
51
+ | undefined
48
52
  > = {
49
53
  /**
50
54
  * Creates, signs, and sends a new transaction to the network.
@@ -91,9 +95,7 @@ export type SmartAccountActions<
91
95
  */
92
96
  sendTransaction: <TChainOverride extends Chain | undefined>(
93
97
  args: SendTransactionParameters<TChain, TSmartAccount, TChainOverride>
94
- ) => ReturnType<
95
- typeof sendTransaction<TChain, TSmartAccount, TChainOverride>
96
- >
98
+ ) => Promise<Hash>
97
99
  /**
98
100
  * Calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191): `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`.
99
101
  *
@@ -138,8 +140,10 @@ export type SmartAccountActions<
138
140
  * })
139
141
  */
140
142
  signMessage: (
141
- args: Parameters<typeof signMessage<TChain, TSmartAccount>>[1]
142
- ) => ReturnType<typeof signMessage<TChain, TSmartAccount>>
143
+ args: Parameters<
144
+ typeof signMessage<entryPoint, TChain, TSmartAccount>
145
+ >[1]
146
+ ) => ReturnType<typeof signMessage<entryPoint, TChain, TSmartAccount>>
143
147
  /**
144
148
  * 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))`.
145
149
  *
@@ -242,6 +246,7 @@ export type SmartAccountActions<
242
246
  >(
243
247
  args: Parameters<
244
248
  typeof signTypedData<
249
+ entryPoint,
245
250
  TTypedData,
246
251
  TPrimaryType,
247
252
  TChain,
@@ -249,7 +254,13 @@ export type SmartAccountActions<
249
254
  >
250
255
  >[1]
251
256
  ) => ReturnType<
252
- typeof signTypedData<TTypedData, TPrimaryType, TChain, TSmartAccount>
257
+ typeof signTypedData<
258
+ entryPoint,
259
+ TTypedData,
260
+ TPrimaryType,
261
+ TChain,
262
+ TSmartAccount
263
+ >
253
264
  >
254
265
  /**
255
266
  * Deploys a contract to the network, given bytecode and constructor arguments.
@@ -289,7 +300,7 @@ export type SmartAccountActions<
289
300
  TChainOverride
290
301
  >
291
302
  >
292
- ) => ReturnType<typeof deployContract<TChain, TSmartAccount>>
303
+ ) => ReturnType<typeof deployContract<entryPoint, TChain, TSmartAccount>>
293
304
  /**
294
305
  * Executes a write function on a contract.
295
306
  * This function also allows you to sponsor this transaction if sender is a smartAccount
@@ -361,6 +372,7 @@ export type SmartAccountActions<
361
372
  >
362
373
  ) => ReturnType<
363
374
  typeof writeContract<
375
+ entryPoint,
364
376
  TChain,
365
377
  TSmartAccount,
366
378
  TAbi,
@@ -373,6 +385,7 @@ export type SmartAccountActions<
373
385
  args: Prettify<
374
386
  Parameters<
375
387
  typeof prepareUserOperationRequest<
388
+ entryPoint,
376
389
  TTransport,
377
390
  TChain,
378
391
  TSmartAccount
@@ -380,11 +393,16 @@ export type SmartAccountActions<
380
393
  >[1]
381
394
  >,
382
395
  stateOverrides?: StateOverrides
383
- ) => Promise<Prettify<PrepareUserOperationRequestReturnType>>
396
+ ) => Promise<Prettify<PrepareUserOperationRequestReturnType<entryPoint>>>
384
397
  sendUserOperation: <TTransport extends Transport>(
385
398
  args: Prettify<
386
399
  Parameters<
387
- typeof sendUserOperation<TTransport, TChain, TSmartAccount>
400
+ typeof sendUserOperation<
401
+ entryPoint,
402
+ TTransport,
403
+ TChain,
404
+ TSmartAccount
405
+ >
388
406
  >[1]
389
407
  >
390
408
  ) => Promise<Hash>
@@ -438,57 +456,117 @@ export type SmartAccountActions<
438
456
  * }])
439
457
  */
440
458
  sendTransactions: (
441
- args: Prettify<SendTransactionsWithPaymasterParameters<TSmartAccount>>
442
- ) => ReturnType<typeof sendTransactions<TChain, TSmartAccount>>
459
+ args: Prettify<
460
+ SendTransactionsWithPaymasterParameters<entryPoint, TSmartAccount>
461
+ >
462
+ ) => ReturnType<typeof sendTransactions<TChain, TSmartAccount, entryPoint>>
443
463
  }
444
464
 
445
- export function smartAccountActions({
446
- sponsorUserOperation
447
- }: SponsorUserOperationMiddleware) {
465
+ export function smartAccountActions<entryPoint extends EntryPoint>({
466
+ middleware
467
+ }: Middleware<entryPoint>) {
448
468
  return <
449
469
  TTransport extends Transport,
450
470
  TChain extends Chain | undefined = Chain | undefined,
451
- TSmartAccount extends SmartAccount | undefined =
452
- | SmartAccount
471
+ TSmartAccount extends SmartAccount<entryPoint> | undefined =
472
+ | SmartAccount<entryPoint>
453
473
  | undefined
454
474
  >(
455
475
  client: Client<TTransport, TChain, TSmartAccount>
456
- ): SmartAccountActions<TChain, TSmartAccount> => ({
476
+ ): SmartAccountActions<entryPoint, TChain, TSmartAccount> => ({
457
477
  prepareUserOperationRequest: (args, stateOverrides) =>
458
478
  prepareUserOperationRequest(
459
479
  client,
460
480
  {
461
481
  ...args,
462
- sponsorUserOperation
482
+ middleware
463
483
  },
464
484
  stateOverrides
465
485
  ),
466
486
  deployContract: (args) =>
467
487
  deployContract(client, {
468
488
  ...args,
469
- sponsorUserOperation
470
- } as DeployContractParametersWithPaymaster),
489
+ middleware
490
+ } as DeployContractParametersWithPaymaster<entryPoint>),
471
491
  sendTransaction: (args) =>
472
- sendTransaction(client, {
492
+ sendTransaction<TChain, TSmartAccount, entryPoint>(client, {
473
493
  ...args,
474
- sponsorUserOperation
475
- } as SendTransactionWithPaymasterParameters<TChain, TSmartAccount>),
494
+ middleware
495
+ } as SendTransactionWithPaymasterParameters<
496
+ entryPoint,
497
+ TChain,
498
+ TSmartAccount
499
+ >),
476
500
  sendTransactions: (args) =>
477
- sendTransactions(client, {
501
+ sendTransactions<TChain, TSmartAccount, entryPoint>(client, {
478
502
  ...args,
479
- sponsorUserOperation
480
- } as SendTransactionsWithPaymasterParameters<TSmartAccount>),
503
+ middleware
504
+ }),
481
505
  sendUserOperation: (args) =>
482
- sendUserOperation(client, {
483
- ...args,
484
- sponsorUserOperation
485
- } as SendUserOperationParameters<TSmartAccount>),
486
- signMessage: (args) => signMessage(client, args),
487
- signTypedData: (args) => signTypedData(client, args),
488
- writeContract: (args) =>
506
+ sendUserOperation<entryPoint, TTransport, TChain, TSmartAccount>(
507
+ client,
508
+ {
509
+ ...args,
510
+ middleware
511
+ } as SendUserOperationParameters<entryPoint, TSmartAccount>
512
+ ),
513
+ signMessage: (args) =>
514
+ signMessage<entryPoint, TChain, TSmartAccount>(client, args),
515
+ signTypedData: <
516
+ const TTypedData extends TypedData | { [key: string]: unknown },
517
+ TPrimaryType extends string
518
+ >(
519
+ args: Parameters<
520
+ typeof signTypedData<
521
+ entryPoint,
522
+ TTypedData,
523
+ TPrimaryType,
524
+ TChain,
525
+ TSmartAccount
526
+ >
527
+ >[1]
528
+ ) =>
529
+ signTypedData<
530
+ entryPoint,
531
+ TTypedData,
532
+ TPrimaryType,
533
+ TChain,
534
+ TSmartAccount
535
+ >(client, args),
536
+ writeContract: <
537
+ const TAbi extends Abi | readonly unknown[],
538
+ TFunctionName extends ContractFunctionName<
539
+ TAbi,
540
+ "nonpayable" | "payable"
541
+ > = ContractFunctionName<TAbi, "nonpayable" | "payable">,
542
+ TArgs extends ContractFunctionArgs<
543
+ TAbi,
544
+ "nonpayable" | "payable",
545
+ TFunctionName
546
+ > = ContractFunctionArgs<
547
+ TAbi,
548
+ "nonpayable" | "payable",
549
+ TFunctionName
550
+ >,
551
+ TChainOverride extends Chain | undefined = undefined
552
+ >(
553
+ args: WriteContractParameters<
554
+ TAbi,
555
+ TFunctionName,
556
+ TArgs,
557
+ TChain,
558
+ TSmartAccount,
559
+ TChainOverride
560
+ >
561
+ ) =>
489
562
  writeContract(client, {
490
563
  ...args,
491
- sponsorUserOperation
492
- } as WriteContractWithPaymasterParameters<TChain, TSmartAccount>)
564
+ middleware
565
+ } as WriteContractWithPaymasterParameters<
566
+ entryPoint,
567
+ TChain,
568
+ TSmartAccount,
569
+ TAbi
570
+ >)
493
571
  })
494
572
  }
@@ -8,9 +8,10 @@ import {
8
8
  type SponsorUserOperationReturnType,
9
9
  sponsorUserOperation
10
10
  } from "../../actions/stackup/sponsorUserOperation"
11
+ import type { EntryPoint } from "../../types/entrypoint"
11
12
  import { type StackupPaymasterClient } from "../stackup"
12
13
 
13
- export type StackupPaymasterClientActions = {
14
+ export type StackupPaymasterClientActions<entryPoint extends EntryPoint> = {
14
15
  /**
15
16
  * Returns paymasterAndData & updated gas parameters required to sponsor a userOperation.
16
17
  *
@@ -35,8 +36,8 @@ export type StackupPaymasterClientActions = {
35
36
  *
36
37
  */
37
38
  sponsorUserOperation: (
38
- args: SponsorUserOperationParameters
39
- ) => Promise<SponsorUserOperationReturnType>
39
+ args: SponsorUserOperationParameters<entryPoint>
40
+ ) => Promise<SponsorUserOperationReturnType<entryPoint>>
40
41
 
41
42
  /**
42
43
  * Returns all the Paymaster addresses associated with an EntryPoint that’s owned by this service.
@@ -60,14 +61,17 @@ export type StackupPaymasterClientActions = {
60
61
  * }})
61
62
  *
62
63
  */
63
- accounts: (args: AccountsParameters) => Promise<Address[]>
64
+ accounts: (args: AccountsParameters<entryPoint>) => Promise<Address[]>
64
65
  }
65
66
 
66
- export const stackupPaymasterActions = (
67
+ export const stackupPaymasterActions = <entryPoint extends EntryPoint>(
67
68
  client: Client
68
- ): StackupPaymasterClientActions => ({
69
- sponsorUserOperation: async (args: SponsorUserOperationParameters) =>
70
- sponsorUserOperation(client as StackupPaymasterClient, args),
71
- accounts: async (args: AccountsParameters) =>
72
- accounts(client as StackupPaymasterClient, args)
69
+ ): StackupPaymasterClientActions<entryPoint> => ({
70
+ sponsorUserOperation: async (args) =>
71
+ sponsorUserOperation<entryPoint>(
72
+ client as StackupPaymasterClient<entryPoint>,
73
+ args
74
+ ),
75
+ accounts: async (args) =>
76
+ accounts(client as StackupPaymasterClient<entryPoint>, args)
73
77
  })
@@ -6,6 +6,7 @@ import type {
6
6
  Transport
7
7
  } from "viem"
8
8
  import { createClient } from "viem"
9
+ import type { EntryPoint } from "../types/entrypoint"
9
10
  import type {
10
11
  PimlicoBundlerRpcSchema,
11
12
  PimlicoPaymasterRpcSchema
@@ -18,20 +19,20 @@ import {
18
19
  pimlicoPaymasterActions
19
20
  } from "./decorators/pimlico"
20
21
 
21
- export type PimlicoBundlerClient = Client<
22
+ export type PimlicoBundlerClient<entryPoint extends EntryPoint> = Client<
22
23
  Transport,
23
24
  Chain | undefined,
24
25
  Account | undefined,
25
26
  PimlicoBundlerRpcSchema,
26
- PimlicoBundlerActions & BundlerActions
27
+ PimlicoBundlerActions & BundlerActions<entryPoint>
27
28
  >
28
29
 
29
- export type PimlicoPaymasterClient = Client<
30
+ export type PimlicoPaymasterClient<entryPoint extends EntryPoint> = Client<
30
31
  Transport,
31
32
  Chain | undefined,
32
33
  Account | undefined,
33
- PimlicoPaymasterRpcSchema,
34
- PimlicoPaymasterClientActions
34
+ PimlicoPaymasterRpcSchema<entryPoint>,
35
+ PimlicoPaymasterClientActions<entryPoint>
35
36
  >
36
37
 
37
38
  /**
@@ -54,11 +55,14 @@ export type PimlicoPaymasterClient = Client<
54
55
  * })
55
56
  */
56
57
  export const createPimlicoBundlerClient = <
57
- transport extends Transport,
58
+ entryPoint extends EntryPoint,
59
+ transport extends Transport = Transport,
58
60
  chain extends Chain | undefined = undefined
59
61
  >(
60
- parameters: PublicClientConfig<transport, chain>
61
- ): PimlicoBundlerClient => {
62
+ parameters: PublicClientConfig<transport, chain> & {
63
+ entryPoint: entryPoint
64
+ }
65
+ ): PimlicoBundlerClient<entryPoint> => {
62
66
  const { key = "public", name = "Pimlico Bundler Client" } = parameters
63
67
  const client = createClient({
64
68
  ...parameters,
@@ -66,7 +70,9 @@ export const createPimlicoBundlerClient = <
66
70
  name,
67
71
  type: "pimlicoBundlerClient"
68
72
  })
69
- return client.extend(bundlerActions).extend(pimlicoBundlerActions)
73
+ return client
74
+ .extend(bundlerActions(parameters.entryPoint))
75
+ .extend(pimlicoBundlerActions)
70
76
  }
71
77
 
72
78
  /**
@@ -89,11 +95,14 @@ export const createPimlicoBundlerClient = <
89
95
  * })
90
96
  */
91
97
  export const createPimlicoPaymasterClient = <
92
- transport extends Transport,
98
+ entryPoint extends EntryPoint,
99
+ transport extends Transport = Transport,
93
100
  chain extends Chain | undefined = undefined
94
101
  >(
95
- parameters: PublicClientConfig<transport, chain>
96
- ): PimlicoPaymasterClient => {
102
+ parameters: PublicClientConfig<transport, chain> & {
103
+ entryPoint: entryPoint
104
+ }
105
+ ): PimlicoPaymasterClient<entryPoint> => {
97
106
  const { key = "public", name = "Pimlico Paymaster Client" } = parameters
98
107
  const client = createClient({
99
108
  ...parameters,
@@ -101,5 +110,5 @@ export const createPimlicoPaymasterClient = <
101
110
  name,
102
111
  type: "pimlicoPaymasterClient"
103
112
  })
104
- return client.extend(pimlicoPaymasterActions)
113
+ return client.extend(pimlicoPaymasterActions(parameters.entryPoint))
105
114
  }
@@ -6,6 +6,7 @@ import {
6
6
  type Transport,
7
7
  createClient
8
8
  } from "viem"
9
+ import type { EntryPoint } from "../types/entrypoint"
9
10
  import type { StackupPaymasterRpcSchema } from "../types/stackup"
10
11
  import { type BundlerActions, bundlerActions } from "./decorators/bundler"
11
12
  import {
@@ -13,12 +14,12 @@ import {
13
14
  stackupPaymasterActions
14
15
  } from "./decorators/stackup"
15
16
 
16
- export type StackupPaymasterClient = Client<
17
+ export type StackupPaymasterClient<entryPoint extends EntryPoint> = Client<
17
18
  Transport,
18
19
  Chain | undefined,
19
20
  Account | undefined,
20
- StackupPaymasterRpcSchema,
21
- StackupPaymasterClientActions & BundlerActions
21
+ StackupPaymasterRpcSchema<entryPoint>,
22
+ StackupPaymasterClientActions<entryPoint> & BundlerActions<entryPoint>
22
23
  >
23
24
 
24
25
  /**
@@ -41,11 +42,14 @@ export type StackupPaymasterClient = Client<
41
42
  * })
42
43
  */
43
44
  export const createStackupPaymasterClient = <
44
- transport extends Transport,
45
+ entryPoint extends EntryPoint,
46
+ transport extends Transport = Transport,
45
47
  chain extends Chain | undefined = undefined
46
48
  >(
47
- parameters: PublicClientConfig<transport, chain>
48
- ): StackupPaymasterClient => {
49
+ parameters: PublicClientConfig<transport, chain> & {
50
+ entryPoint: entryPoint
51
+ }
52
+ ): StackupPaymasterClient<entryPoint> => {
49
53
  const { key = "public", name = "Stackup Paymaster Client" } = parameters
50
54
  const client = createClient({
51
55
  ...parameters,
@@ -53,5 +57,7 @@ export const createStackupPaymasterClient = <
53
57
  name,
54
58
  type: "stackupPaymasterClient"
55
59
  })
56
- return client.extend(bundlerActions).extend(stackupPaymasterActions)
60
+ return client
61
+ .extend(bundlerActions(parameters.entryPoint))
62
+ .extend(stackupPaymasterActions<entryPoint>)
57
63
  }