permissionless 0.0.11 → 0.0.13

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 (306) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/_cjs/accounts/index.js +14 -0
  3. package/_cjs/accounts/index.js.map +1 -0
  4. package/_cjs/accounts/privateKeyToSafeSmartAccount.js +24 -0
  5. package/_cjs/accounts/privateKeyToSafeSmartAccount.js.map +1 -0
  6. package/_cjs/accounts/privateKeyToSimpleSmartAccount.js +16 -0
  7. package/_cjs/accounts/privateKeyToSimpleSmartAccount.js.map +1 -0
  8. package/_cjs/accounts/signerToSafeSmartAccount.js +492 -0
  9. package/_cjs/accounts/signerToSafeSmartAccount.js.map +1 -0
  10. package/_cjs/accounts/signerToSimpleSmartAccount.js +190 -0
  11. package/_cjs/accounts/signerToSimpleSmartAccount.js.map +1 -0
  12. package/_cjs/accounts/types.js +23 -0
  13. package/_cjs/accounts/types.js.map +1 -0
  14. package/_cjs/actions/bundler/chainId.js.map +1 -1
  15. package/_cjs/actions/bundler/estimateUserOperationGas.js +4 -1
  16. package/_cjs/actions/bundler/estimateUserOperationGas.js.map +1 -1
  17. package/_cjs/actions/bundler/getUserOperationByHash.js.map +1 -1
  18. package/_cjs/actions/bundler/getUserOperationReceipt.js.map +1 -1
  19. package/_cjs/actions/bundler/sendUserOperation.js +4 -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/bundler/waitForUserOperationReceipt.js +7 -2
  23. package/_cjs/actions/bundler/waitForUserOperationReceipt.js.map +1 -1
  24. package/_cjs/actions/index.js.map +1 -1
  25. package/_cjs/actions/pimlico/getUserOperationGasPrice.js.map +1 -1
  26. package/_cjs/actions/pimlico/getUserOperationStatus.js.map +1 -1
  27. package/_cjs/actions/pimlico/sponsorUserOperation.js +4 -1
  28. package/_cjs/actions/pimlico/sponsorUserOperation.js.map +1 -1
  29. package/_cjs/actions/pimlico.js.map +1 -1
  30. package/_cjs/actions/public/getAccountNonce.js +4 -2
  31. package/_cjs/actions/public/getAccountNonce.js.map +1 -1
  32. package/_cjs/actions/public/getSenderAddress.js +7 -3
  33. package/_cjs/actions/public/getSenderAddress.js.map +1 -1
  34. package/_cjs/actions/smartAccount/deployContract.js +38 -0
  35. package/_cjs/actions/smartAccount/deployContract.js.map +1 -0
  36. package/_cjs/actions/smartAccount/prepareUserOperationRequest.js +73 -0
  37. package/_cjs/actions/smartAccount/prepareUserOperationRequest.js.map +1 -0
  38. package/_cjs/actions/smartAccount/sendTransaction.js +44 -0
  39. package/_cjs/actions/smartAccount/sendTransaction.js.map +1 -0
  40. package/_cjs/actions/smartAccount/sendTransactions.js +46 -0
  41. package/_cjs/actions/smartAccount/sendTransactions.js.map +1 -0
  42. package/_cjs/actions/smartAccount/sendUserOperation.js +22 -0
  43. package/_cjs/actions/smartAccount/sendUserOperation.js.map +1 -0
  44. package/_cjs/actions/smartAccount/signMessage.js +16 -0
  45. package/_cjs/actions/smartAccount/signMessage.js.map +1 -0
  46. package/_cjs/actions/smartAccount/signTypedData.js +34 -0
  47. package/_cjs/actions/smartAccount/signTypedData.js.map +1 -0
  48. package/_cjs/actions/smartAccount/writeContract.js +21 -0
  49. package/_cjs/actions/smartAccount/writeContract.js.map +1 -0
  50. package/_cjs/actions/smartAccount.js +18 -0
  51. package/_cjs/actions/smartAccount.js.map +1 -0
  52. package/_cjs/actions/stackup/sponsorUserOperation.js +5 -1
  53. package/_cjs/actions/stackup/sponsorUserOperation.js.map +1 -1
  54. package/_cjs/clients/{bundler.js → createBundlerClient.js} +1 -1
  55. package/_cjs/clients/createBundlerClient.js.map +1 -0
  56. package/_cjs/clients/createSmartAccountClient.js +20 -0
  57. package/_cjs/clients/createSmartAccountClient.js.map +1 -0
  58. package/_cjs/clients/decorators/bundler.js.map +1 -1
  59. package/_cjs/clients/decorators/pimlico.js.map +1 -1
  60. package/_cjs/clients/decorators/smartAccount.js +33 -0
  61. package/_cjs/clients/decorators/smartAccount.js.map +1 -0
  62. package/_cjs/clients/decorators/stackup.js.map +1 -1
  63. package/_cjs/clients/pimlico.js.map +1 -1
  64. package/_cjs/clients/stackup.js.map +1 -1
  65. package/_cjs/index.js +9 -5
  66. package/_cjs/index.js.map +1 -1
  67. package/_cjs/utils/deepHexlify.js +4 -4
  68. package/_cjs/utils/deepHexlify.js.map +1 -1
  69. package/_cjs/utils/getAction.js +8 -0
  70. package/_cjs/utils/getAction.js.map +1 -0
  71. package/_cjs/utils/getUserOperationHash.js.map +1 -1
  72. package/_cjs/utils/index.js +7 -1
  73. package/_cjs/utils/index.js.map +1 -1
  74. package/_cjs/utils/observe.js +7 -2
  75. package/_cjs/utils/observe.js.map +1 -1
  76. package/_cjs/utils/signUserOperationHashWithECDSA.js +7 -7
  77. package/_cjs/utils/signUserOperationHashWithECDSA.js.map +1 -1
  78. package/_esm/accounts/index.js +7 -0
  79. package/_esm/accounts/index.js.map +1 -0
  80. package/_esm/accounts/privateKeyToSafeSmartAccount.js +26 -0
  81. package/_esm/accounts/privateKeyToSafeSmartAccount.js.map +1 -0
  82. package/_esm/accounts/privateKeyToSimpleSmartAccount.js +18 -0
  83. package/_esm/accounts/privateKeyToSimpleSmartAccount.js.map +1 -0
  84. package/_esm/accounts/signerToSafeSmartAccount.js +499 -0
  85. package/_esm/accounts/signerToSafeSmartAccount.js.map +1 -0
  86. package/_esm/accounts/signerToSimpleSmartAccount.js +191 -0
  87. package/_esm/accounts/signerToSimpleSmartAccount.js.map +1 -0
  88. package/_esm/accounts/types.js +20 -0
  89. package/_esm/accounts/types.js.map +1 -0
  90. package/_esm/actions/bundler/chainId.js.map +1 -1
  91. package/_esm/actions/bundler/estimateUserOperationGas.js +4 -1
  92. package/_esm/actions/bundler/estimateUserOperationGas.js.map +1 -1
  93. package/_esm/actions/bundler/getUserOperationByHash.js.map +1 -1
  94. package/_esm/actions/bundler/getUserOperationReceipt.js.map +1 -1
  95. package/_esm/actions/bundler/sendUserOperation.js +4 -3
  96. package/_esm/actions/bundler/sendUserOperation.js.map +1 -1
  97. package/_esm/actions/bundler/supportedEntryPoints.js.map +1 -1
  98. package/_esm/actions/bundler/waitForUserOperationReceipt.js +7 -2
  99. package/_esm/actions/bundler/waitForUserOperationReceipt.js.map +1 -1
  100. package/_esm/actions/index.js.map +1 -1
  101. package/_esm/actions/pimlico/getUserOperationGasPrice.js +2 -2
  102. package/_esm/actions/pimlico/getUserOperationGasPrice.js.map +1 -1
  103. package/_esm/actions/pimlico/getUserOperationStatus.js +1 -1
  104. package/_esm/actions/pimlico/getUserOperationStatus.js.map +1 -1
  105. package/_esm/actions/pimlico/sponsorUserOperation.js +4 -1
  106. package/_esm/actions/pimlico/sponsorUserOperation.js.map +1 -1
  107. package/_esm/actions/pimlico.js.map +1 -1
  108. package/_esm/actions/public/getAccountNonce.js +7 -5
  109. package/_esm/actions/public/getAccountNonce.js.map +1 -1
  110. package/_esm/actions/public/getSenderAddress.js +8 -5
  111. package/_esm/actions/public/getSenderAddress.js.map +1 -1
  112. package/_esm/actions/smartAccount/deployContract.js +64 -0
  113. package/_esm/actions/smartAccount/deployContract.js.map +1 -0
  114. package/_esm/actions/smartAccount/prepareUserOperationRequest.js +69 -0
  115. package/_esm/actions/smartAccount/prepareUserOperationRequest.js.map +1 -0
  116. package/_esm/actions/smartAccount/sendTransaction.js +88 -0
  117. package/_esm/actions/smartAccount/sendTransaction.js.map +1 -0
  118. package/_esm/actions/smartAccount/sendTransactions.js +90 -0
  119. package/_esm/actions/smartAccount/sendTransactions.js.map +1 -0
  120. package/_esm/actions/smartAccount/sendUserOperation.js +18 -0
  121. package/_esm/actions/smartAccount/sendUserOperation.js.map +1 -0
  122. package/_esm/actions/smartAccount/signMessage.js +59 -0
  123. package/_esm/actions/smartAccount/signMessage.js.map +1 -0
  124. package/_esm/actions/smartAccount/signTypedData.js +129 -0
  125. package/_esm/actions/smartAccount/signTypedData.js.map +1 -0
  126. package/_esm/actions/smartAccount/writeContract.js +19 -0
  127. package/_esm/actions/smartAccount/writeContract.js.map +1 -0
  128. package/_esm/actions/smartAccount.js +9 -0
  129. package/_esm/actions/smartAccount.js.map +1 -0
  130. package/_esm/actions/stackup/accounts.js +1 -1
  131. package/_esm/actions/stackup/sponsorUserOperation.js +6 -2
  132. package/_esm/actions/stackup/sponsorUserOperation.js.map +1 -1
  133. package/_esm/clients/{bundler.js → createBundlerClient.js} +1 -1
  134. package/_esm/clients/createBundlerClient.js.map +1 -0
  135. package/_esm/clients/createSmartAccountClient.js +38 -0
  136. package/_esm/clients/createSmartAccountClient.js.map +1 -0
  137. package/_esm/clients/decorators/bundler.js.map +1 -1
  138. package/_esm/clients/decorators/pimlico.js +1 -1
  139. package/_esm/clients/decorators/pimlico.js.map +1 -1
  140. package/_esm/clients/decorators/smartAccount.js +29 -0
  141. package/_esm/clients/decorators/smartAccount.js.map +1 -0
  142. package/_esm/clients/decorators/stackup.js.map +1 -1
  143. package/_esm/clients/pimlico.js +1 -1
  144. package/_esm/clients/pimlico.js.map +1 -1
  145. package/_esm/clients/stackup.js +1 -1
  146. package/_esm/clients/stackup.js.map +1 -1
  147. package/_esm/index.js +5 -2
  148. package/_esm/index.js.map +1 -1
  149. package/_esm/utils/deepHexlify.js +6 -4
  150. package/_esm/utils/deepHexlify.js.map +1 -1
  151. package/_esm/utils/getAction.js +6 -0
  152. package/_esm/utils/getAction.js.map +1 -0
  153. package/_esm/utils/getUserOperationHash.js.map +1 -1
  154. package/_esm/utils/index.js +5 -0
  155. package/_esm/utils/index.js.map +1 -1
  156. package/_esm/utils/observe.js +7 -2
  157. package/_esm/utils/observe.js.map +1 -1
  158. package/_esm/utils/signUserOperationHashWithECDSA.js +7 -6
  159. package/_esm/utils/signUserOperationHashWithECDSA.js.map +1 -1
  160. package/_types/accounts/index.d.ts +7 -0
  161. package/_types/accounts/index.d.ts.map +1 -0
  162. package/_types/accounts/privateKeyToSafeSmartAccount.d.ts +26 -0
  163. package/_types/accounts/privateKeyToSafeSmartAccount.d.ts.map +1 -0
  164. package/_types/accounts/privateKeyToSimpleSmartAccount.d.ts +14 -0
  165. package/_types/accounts/privateKeyToSimpleSmartAccount.d.ts.map +1 -0
  166. package/_types/accounts/signerToSafeSmartAccount.d.ts +28 -0
  167. package/_types/accounts/signerToSafeSmartAccount.d.ts.map +1 -0
  168. package/_types/accounts/signerToSimpleSmartAccount.d.ts +15 -0
  169. package/_types/accounts/signerToSimpleSmartAccount.d.ts.map +1 -0
  170. package/_types/accounts/types.d.ts +32 -0
  171. package/_types/accounts/types.d.ts.map +1 -0
  172. package/_types/actions/bundler/chainId.d.ts +3 -2
  173. package/_types/actions/bundler/chainId.d.ts.map +1 -1
  174. package/_types/actions/bundler/estimateUserOperationGas.d.ts +3 -3
  175. package/_types/actions/bundler/estimateUserOperationGas.d.ts.map +1 -1
  176. package/_types/actions/bundler/getUserOperationByHash.d.ts +3 -3
  177. package/_types/actions/bundler/getUserOperationByHash.d.ts.map +1 -1
  178. package/_types/actions/bundler/getUserOperationReceipt.d.ts +3 -3
  179. package/_types/actions/bundler/getUserOperationReceipt.d.ts.map +1 -1
  180. package/_types/actions/bundler/sendUserOperation.d.ts +3 -5
  181. package/_types/actions/bundler/sendUserOperation.d.ts.map +1 -1
  182. package/_types/actions/bundler/supportedEntryPoints.d.ts +3 -3
  183. package/_types/actions/bundler/supportedEntryPoints.d.ts.map +1 -1
  184. package/_types/actions/bundler/waitForUserOperationReceipt.d.ts +2 -3
  185. package/_types/actions/bundler/waitForUserOperationReceipt.d.ts.map +1 -1
  186. package/_types/actions/index.d.ts.map +1 -1
  187. package/_types/actions/pimlico/getUserOperationGasPrice.d.ts +5 -4
  188. package/_types/actions/pimlico/getUserOperationGasPrice.d.ts.map +1 -1
  189. package/_types/actions/pimlico/getUserOperationStatus.d.ts +4 -5
  190. package/_types/actions/pimlico/getUserOperationStatus.d.ts.map +1 -1
  191. package/_types/actions/pimlico/sponsorUserOperation.d.ts +3 -3
  192. package/_types/actions/pimlico/sponsorUserOperation.d.ts.map +1 -1
  193. package/_types/actions/pimlico.d.ts.map +1 -1
  194. package/_types/actions/public/getAccountNonce.d.ts +5 -5
  195. package/_types/actions/public/getAccountNonce.d.ts.map +1 -1
  196. package/_types/actions/public/getSenderAddress.d.ts +3 -4
  197. package/_types/actions/public/getSenderAddress.d.ts.map +1 -1
  198. package/_types/actions/smartAccount/deployContract.d.ts +34 -0
  199. package/_types/actions/smartAccount/deployContract.d.ts.map +1 -0
  200. package/_types/actions/smartAccount/prepareUserOperationRequest.d.ts +20 -0
  201. package/_types/actions/smartAccount/prepareUserOperationRequest.d.ts.map +1 -0
  202. package/_types/actions/smartAccount/sendTransaction.d.ts +52 -0
  203. package/_types/actions/smartAccount/sendTransaction.d.ts.map +1 -0
  204. package/_types/actions/smartAccount/sendTransactions.d.ts +63 -0
  205. package/_types/actions/smartAccount/sendTransactions.d.ts.map +1 -0
  206. package/_types/actions/smartAccount/sendUserOperation.d.ts +10 -0
  207. package/_types/actions/smartAccount/sendUserOperation.d.ts.map +1 -0
  208. package/_types/actions/smartAccount/signMessage.d.ts +50 -0
  209. package/_types/actions/smartAccount/signMessage.d.ts.map +1 -0
  210. package/_types/actions/smartAccount/signTypedData.d.ts +104 -0
  211. package/_types/actions/smartAccount/signTypedData.d.ts.map +1 -0
  212. package/_types/actions/smartAccount/writeContract.d.ts +57 -0
  213. package/_types/actions/smartAccount/writeContract.d.ts.map +1 -0
  214. package/_types/actions/smartAccount.d.ts +9 -0
  215. package/_types/actions/smartAccount.d.ts.map +1 -0
  216. package/_types/actions/stackup/accounts.d.ts +1 -1
  217. package/_types/actions/stackup/sponsorUserOperation.d.ts +1 -1
  218. package/_types/actions/stackup/sponsorUserOperation.d.ts.map +1 -1
  219. package/_types/clients/{bundler.d.ts → createBundlerClient.d.ts} +1 -1
  220. package/_types/clients/createBundlerClient.d.ts.map +1 -0
  221. package/_types/clients/createSmartAccountClient.d.ts +282 -0
  222. package/_types/clients/createSmartAccountClient.d.ts.map +1 -0
  223. package/_types/clients/decorators/bundler.d.ts +1 -1
  224. package/_types/clients/decorators/bundler.d.ts.map +1 -1
  225. package/_types/clients/decorators/pimlico.d.ts +3 -3
  226. package/_types/clients/decorators/pimlico.d.ts.map +1 -1
  227. package/_types/clients/decorators/smartAccount.d.ts +327 -0
  228. package/_types/clients/decorators/smartAccount.d.ts.map +1 -0
  229. package/_types/clients/decorators/stackup.d.ts.map +1 -1
  230. package/_types/clients/pimlico.d.ts +1 -1
  231. package/_types/clients/pimlico.d.ts.map +1 -1
  232. package/_types/clients/stackup.d.ts +1 -1
  233. package/_types/clients/stackup.d.ts.map +1 -1
  234. package/_types/index.d.ts +6 -3
  235. package/_types/index.d.ts.map +1 -1
  236. package/_types/types/bundler.d.ts +4 -1
  237. package/_types/types/bundler.d.ts.map +1 -1
  238. package/_types/types/index.d.ts +20 -0
  239. package/_types/types/index.d.ts.map +1 -1
  240. package/_types/types/pimlico.d.ts.map +1 -1
  241. package/_types/types/stackup.d.ts.map +1 -1
  242. package/_types/utils/deepHexlify.d.ts.map +1 -1
  243. package/_types/utils/getAction.d.ts +3 -0
  244. package/_types/utils/getAction.d.ts.map +1 -0
  245. package/_types/utils/getUserOperationHash.d.ts.map +1 -1
  246. package/_types/utils/index.d.ts +2 -0
  247. package/_types/utils/index.d.ts.map +1 -1
  248. package/_types/utils/observe.d.ts.map +1 -1
  249. package/_types/utils/signUserOperationHashWithECDSA.d.ts +3 -11
  250. package/_types/utils/signUserOperationHashWithECDSA.d.ts.map +1 -1
  251. package/accounts/index.ts +33 -0
  252. package/accounts/privateKeyToSafeSmartAccount.ts +73 -0
  253. package/accounts/privateKeyToSimpleSmartAccount.ts +44 -0
  254. package/accounts/signerToSafeSmartAccount.ts +775 -0
  255. package/accounts/signerToSimpleSmartAccount.ts +267 -0
  256. package/accounts/types.ts +64 -0
  257. package/actions/bundler/chainId.ts +10 -2
  258. package/actions/bundler/estimateUserOperationGas.ts +17 -6
  259. package/actions/bundler/getUserOperationByHash.ts +16 -5
  260. package/actions/bundler/getUserOperationReceipt.ts +17 -4
  261. package/actions/bundler/sendUserOperation.ts +19 -7
  262. package/actions/bundler/supportedEntryPoints.ts +10 -3
  263. package/actions/bundler/waitForUserOperationReceipt.ts +64 -26
  264. package/actions/index.ts +4 -1
  265. package/actions/pimlico/getUserOperationGasPrice.ts +13 -6
  266. package/actions/pimlico/getUserOperationStatus.ts +12 -5
  267. package/actions/pimlico/sponsorUserOperation.ts +20 -7
  268. package/actions/pimlico.ts +8 -2
  269. package/actions/public/getAccountNonce.ts +20 -8
  270. package/actions/public/getSenderAddress.ts +25 -8
  271. package/actions/smartAccount/deployContract.ts +110 -0
  272. package/actions/smartAccount/prepareUserOperationRequest.ts +140 -0
  273. package/actions/smartAccount/sendTransaction.ts +138 -0
  274. package/actions/smartAccount/sendTransactions.ts +141 -0
  275. package/actions/smartAccount/sendUserOperation.ts +70 -0
  276. package/actions/smartAccount/signMessage.ts +79 -0
  277. package/actions/smartAccount/signTypedData.ts +161 -0
  278. package/actions/smartAccount/writeContract.ts +126 -0
  279. package/actions/smartAccount.ts +49 -0
  280. package/actions/stackup/accounts.ts +1 -1
  281. package/actions/stackup/sponsorUserOperation.ts +14 -4
  282. package/clients/{bundler.ts → createBundlerClient.ts} +14 -3
  283. package/clients/createSmartAccountClient.ts +95 -0
  284. package/clients/decorators/bundler.ts +20 -10
  285. package/clients/decorators/pimlico.ts +21 -9
  286. package/clients/decorators/smartAccount.ts +451 -0
  287. package/clients/decorators/stackup.ts +12 -4
  288. package/clients/pimlico.ts +20 -5
  289. package/clients/stackup.ts +17 -4
  290. package/index.ts +20 -3
  291. package/package.json +12 -2
  292. package/types/bundler.ts +4 -1
  293. package/types/index.ts +29 -0
  294. package/types/pimlico.ts +12 -2
  295. package/types/stackup.ts +4 -1
  296. package/utils/deepHexlify.test.ts +13 -7
  297. package/utils/deepHexlify.ts +5 -4
  298. package/utils/getAction.ts +15 -0
  299. package/utils/getUserOperationHash.ts +10 -2
  300. package/utils/index.ts +15 -2
  301. package/utils/observe.ts +18 -5
  302. package/utils/signUserOperationHashWithECDSA.ts +17 -20
  303. package/_cjs/clients/bundler.js.map +0 -1
  304. package/_esm/clients/bundler.js.map +0 -1
  305. package/_types/clients/bundler.d.ts.map +0 -1
  306. package/tsconfig.build.tsbuildinfo +0 -1
@@ -0,0 +1,141 @@
1
+ import type {
2
+ Address,
3
+ Chain,
4
+ Client,
5
+ Hex,
6
+ SendTransactionParameters,
7
+ SendTransactionReturnType,
8
+ Transport
9
+ } from "viem"
10
+ import { type SmartAccount } from "../../accounts/types.js"
11
+ import type { GetAccountParameter } from "../../types/index.js"
12
+ import { getAction } from "../../utils/getAction.js"
13
+ import {
14
+ AccountOrClientNotFoundError,
15
+ parseAccount
16
+ } from "../../utils/index.js"
17
+ import { waitForUserOperationReceipt } from "../bundler/waitForUserOperationReceipt.js"
18
+ import { type SponsorUserOperationMiddleware } from "./prepareUserOperationRequest.js"
19
+ import { sendUserOperation } from "./sendUserOperation.js"
20
+
21
+ export type SendTransactionsWithPaymasterParameters<
22
+ TAccount extends SmartAccount | undefined = SmartAccount | undefined
23
+ > = {
24
+ transactions: { to: Address; value: bigint; data: Hex }[]
25
+ } & GetAccountParameter<TAccount> &
26
+ SponsorUserOperationMiddleware & {
27
+ maxFeePerGas?: bigint
28
+ maxPriorityFeePerGas?: bigint
29
+ nonce?: bigint
30
+ }
31
+
32
+ /**
33
+ * Creates, signs, and sends a new transactions to the network.
34
+ * This function also allows you to sponsor this transaction if sender is a smartAccount
35
+ *
36
+ * @param client - Client to use
37
+ * @param parameters - {@link SendTransactionParameters}
38
+ * @returns The [Transaction](https://viem.sh/docs/glossary/terms.html#transaction) hash. {@link SendTransactionReturnType}
39
+ *
40
+ * @example
41
+ * import { createWalletClient, custom } from 'viem'
42
+ * import { mainnet } from 'viem/chains'
43
+ * import { sendTransaction } from 'viem/wallet'
44
+ *
45
+ * const client = createWalletClient({
46
+ * chain: mainnet,
47
+ * transport: custom(window.ethereum),
48
+ * })
49
+ * const hash = await sendTransaction(client, [{
50
+ * account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
51
+ * to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
52
+ * value: 1000000000000000000n,
53
+ * }, {
54
+ * to: '0x61897970c51812dc3a010c7d01b50e0d17dc1234',
55
+ * value: 10000000000000000n,
56
+ * }])
57
+ *
58
+ * @example
59
+ * // Account Hoisting
60
+ * import { createWalletClient, http } from 'viem'
61
+ * import { privateKeyToAccount } from 'viem/accounts'
62
+ * import { mainnet } from 'viem/chains'
63
+ * import { sendTransaction } from 'viem/wallet'
64
+ *
65
+ * const client = createWalletClient({
66
+ * account: privateKeyToAccount('0x…'),
67
+ * chain: mainnet,
68
+ * transport: http(),
69
+ * })
70
+ * const hash = await sendTransactions(client, [{
71
+ * to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
72
+ * value: 1000000000000000000n,
73
+ * }, {
74
+ * to: '0x61897970c51812dc3a010c7d01b50e0d17dc1234',
75
+ * value: 10000000000000000n,
76
+ * }])
77
+ */
78
+ export async function sendTransactions<
79
+ TChain extends Chain | undefined,
80
+ TAccount extends SmartAccount | undefined
81
+ >(
82
+ client: Client<Transport, TChain, TAccount>,
83
+ args: SendTransactionsWithPaymasterParameters<TAccount>
84
+ ): Promise<SendTransactionReturnType> {
85
+ const {
86
+ account: account_ = client.account,
87
+ transactions,
88
+ sponsorUserOperation,
89
+ maxFeePerGas,
90
+ maxPriorityFeePerGas,
91
+ nonce
92
+ } = args
93
+
94
+ if (!account_) {
95
+ throw new AccountOrClientNotFoundError({
96
+ docsPath: "/docs/actions/wallet/sendTransaction"
97
+ })
98
+ }
99
+
100
+ const account = parseAccount(account_) as SmartAccount
101
+
102
+ if (account.type !== "local") {
103
+ throw new Error("RPC account type not supported")
104
+ }
105
+
106
+ const callData = await account.encodeCallData(
107
+ transactions.map(({ to, value, data }) => {
108
+ if (!to) throw new Error("Missing to address")
109
+ return {
110
+ to,
111
+ value: value || 0n,
112
+ data: data || "0x"
113
+ }
114
+ })
115
+ )
116
+
117
+ const userOpHash = await getAction(
118
+ client,
119
+ sendUserOperation
120
+ )({
121
+ userOperation: {
122
+ sender: account.address,
123
+ paymasterAndData: "0x",
124
+ maxFeePerGas: maxFeePerGas || 0n,
125
+ maxPriorityFeePerGas: maxPriorityFeePerGas || 0n,
126
+ callData: callData,
127
+ nonce: nonce
128
+ },
129
+ account: account,
130
+ sponsorUserOperation
131
+ })
132
+
133
+ const userOperationReceipt = await getAction(
134
+ client,
135
+ waitForUserOperationReceipt
136
+ )({
137
+ hash: userOpHash
138
+ })
139
+
140
+ return userOperationReceipt?.receipt.transactionHash
141
+ }
@@ -0,0 +1,70 @@
1
+ import type { Chain, Client, Hex, Transport } from "viem"
2
+ import type { SmartAccount } from "../../accounts/types.js"
3
+ import type {
4
+ GetAccountParameter,
5
+ PartialBy,
6
+ UserOperation
7
+ } from "../../types/index.js"
8
+ import { getAction } from "../../utils/getAction.js"
9
+ import {
10
+ AccountOrClientNotFoundError,
11
+ parseAccount
12
+ } from "../../utils/index.js"
13
+ import { sendUserOperation as sendUserOperationBundler } from "../bundler/sendUserOperation.js"
14
+ import {
15
+ type SponsorUserOperationMiddleware,
16
+ prepareUserOperationRequest
17
+ } from "./prepareUserOperationRequest.js"
18
+
19
+ export type SendUserOperationParameters<
20
+ TAccount extends SmartAccount | undefined = SmartAccount | undefined
21
+ > = {
22
+ userOperation: PartialBy<
23
+ UserOperation,
24
+ | "nonce"
25
+ | "sender"
26
+ | "initCode"
27
+ | "signature"
28
+ | "callGasLimit"
29
+ | "maxFeePerGas"
30
+ | "maxPriorityFeePerGas"
31
+ | "preVerificationGas"
32
+ | "verificationGasLimit"
33
+ | "paymasterAndData"
34
+ >
35
+ } & GetAccountParameter<TAccount> &
36
+ SponsorUserOperationMiddleware
37
+
38
+ export type SendUserOperationReturnType = Hex
39
+
40
+ export async function sendUserOperation<
41
+ TTransport extends Transport = Transport,
42
+ TChain extends Chain | undefined = Chain | undefined,
43
+ TAccount extends SmartAccount | undefined = SmartAccount | undefined
44
+ >(
45
+ client: Client<TTransport, TChain, TAccount>,
46
+ args: SendUserOperationParameters<TAccount>
47
+ ): Promise<SendUserOperationReturnType> {
48
+ const { account: account_ = client.account } = args
49
+ if (!account_) throw new AccountOrClientNotFoundError()
50
+
51
+ const account = parseAccount(account_) as SmartAccount
52
+
53
+ const userOperation = await getAction(
54
+ client,
55
+ prepareUserOperationRequest
56
+ )(args)
57
+
58
+ userOperation.signature = await account.signUserOperation(userOperation)
59
+
60
+ const userOpHash = await getAction(
61
+ client,
62
+ sendUserOperationBundler,
63
+ "sendUserOperation"
64
+ )({
65
+ userOperation: userOperation,
66
+ entryPoint: account.entryPoint
67
+ })
68
+
69
+ return userOpHash
70
+ }
@@ -0,0 +1,79 @@
1
+ import type {
2
+ Chain,
3
+ Client,
4
+ SignMessageParameters,
5
+ SignMessageReturnType,
6
+ Transport
7
+ } from "viem"
8
+ import { type SmartAccount } from "../../accounts/types.js"
9
+ import {
10
+ AccountOrClientNotFoundError,
11
+ parseAccount
12
+ } from "../../utils/index.js"
13
+
14
+ /**
15
+ * Calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191): `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`.
16
+ *
17
+ * - Docs: https://viem.sh/docs/actions/wallet/signMessage.html
18
+ * - JSON-RPC Methods:
19
+ * - JSON-RPC Accounts: [`personal_sign`](https://docs.metamask.io/guide/signing-data.html#personal-sign)
20
+ * - Local Accounts: Signs locally. No JSON-RPC request.
21
+ *
22
+ * With the calculated signature, you can:
23
+ * - use [`verifyMessage`](https://viem.sh/docs/utilities/verifyMessage.html) to verify the signature,
24
+ * - use [`recoverMessageAddress`](https://viem.sh/docs/utilities/recoverMessageAddress.html) to recover the signing address from a signature.
25
+ *
26
+ * @param client - Client to use
27
+ * @param parameters - {@link SignMessageParameters}
28
+ * @returns The signed message. {@link SignMessageReturnType}
29
+ *
30
+ * @example
31
+ * import { createWalletClient, custom } from 'viem'
32
+ * import { mainnet } from 'viem/chains'
33
+ * import { signMessage } from 'viem/wallet'
34
+ *
35
+ * const client = createWalletClient({
36
+ * chain: mainnet,
37
+ * transport: custom(window.ethereum),
38
+ * })
39
+ * const signature = await signMessage(client, {
40
+ * account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
41
+ * message: 'hello world',
42
+ * })
43
+ *
44
+ * @example
45
+ * // Account Hoisting
46
+ * import { createWalletClient, custom } from 'viem'
47
+ * import { privateKeyToAccount } from 'viem/accounts'
48
+ * import { mainnet } from 'viem/chains'
49
+ * import { signMessage } from 'viem/wallet'
50
+ *
51
+ * const client = createWalletClient({
52
+ * account: privateKeyToAccount('0x…'),
53
+ * chain: mainnet,
54
+ * transport: custom(window.ethereum),
55
+ * })
56
+ * const signature = await signMessage(client, {
57
+ * message: 'hello world',
58
+ * })
59
+ */
60
+ export async function signMessage<
61
+ TChain extends Chain | undefined,
62
+ TAccount extends SmartAccount | undefined
63
+ >(
64
+ client: Client<Transport, TChain, TAccount>,
65
+ {
66
+ account: account_ = client.account,
67
+ message
68
+ }: SignMessageParameters<TAccount>
69
+ ): Promise<SignMessageReturnType> {
70
+ if (!account_)
71
+ throw new AccountOrClientNotFoundError({
72
+ docsPath: "/docs/actions/wallet/signMessage"
73
+ })
74
+
75
+ const account = parseAccount(account_)
76
+ if (account.type === "local") return account.signMessage({ message })
77
+
78
+ throw new Error("Sign message is not supported by this account")
79
+ }
@@ -0,0 +1,161 @@
1
+ import {
2
+ type Chain,
3
+ type Client,
4
+ type SignTypedDataParameters,
5
+ type SignTypedDataReturnType,
6
+ type Transport,
7
+ type TypedData,
8
+ type TypedDataDefinition,
9
+ getTypesForEIP712Domain,
10
+ validateTypedData
11
+ } from "viem"
12
+ import { type SmartAccount } from "../../accounts/types.js"
13
+ import {
14
+ AccountOrClientNotFoundError,
15
+ parseAccount
16
+ } from "../../utils/index.js"
17
+
18
+ /**
19
+ * Signs typed data and calculates an Ethereum-specific signature in [https://eips.ethereum.org/EIPS/eip-712](https://eips.ethereum.org/EIPS/eip-712): `sign(keccak256("\x19\x01" ‖ domainSeparator ‖ hashStruct(message)))`
20
+ *
21
+ * - Docs: https://viem.sh/docs/actions/wallet/signTypedData.html
22
+ * - JSON-RPC Methods:
23
+ * - JSON-RPC Accounts: [`eth_signTypedData_v4`](https://docs.metamask.io/guide/signing-data.html#signtypeddata-v4)
24
+ * - Local Accounts: Signs locally. No JSON-RPC request.
25
+ *
26
+ * @param client - Client to use
27
+ * @param parameters - {@link SignTypedDataParameters}
28
+ * @returns The signed data. {@link SignTypedDataReturnType}
29
+ *
30
+ * @example
31
+ * import { createWalletClient, custom } from 'viem'
32
+ * import { mainnet } from 'viem/chains'
33
+ * import { signTypedData } from 'viem/wallet'
34
+ *
35
+ * const client = createWalletClient({
36
+ * chain: mainnet,
37
+ * transport: custom(window.ethereum),
38
+ * })
39
+ * const signature = await signTypedData(client, {
40
+ * account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
41
+ * domain: {
42
+ * name: 'Ether Mail',
43
+ * version: '1',
44
+ * chainId: 1,
45
+ * verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC',
46
+ * },
47
+ * types: {
48
+ * Person: [
49
+ * { name: 'name', type: 'string' },
50
+ * { name: 'wallet', type: 'address' },
51
+ * ],
52
+ * Mail: [
53
+ * { name: 'from', type: 'Person' },
54
+ * { name: 'to', type: 'Person' },
55
+ * { name: 'contents', type: 'string' },
56
+ * ],
57
+ * },
58
+ * primaryType: 'Mail',
59
+ * message: {
60
+ * from: {
61
+ * name: 'Cow',
62
+ * wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826',
63
+ * },
64
+ * to: {
65
+ * name: 'Bob',
66
+ * wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB',
67
+ * },
68
+ * contents: 'Hello, Bob!',
69
+ * },
70
+ * })
71
+ *
72
+ * @example
73
+ * // Account Hoisting
74
+ * import { createWalletClient, http } from 'viem'
75
+ * import { privateKeyToAccount } from 'viem/accounts'
76
+ * import { mainnet } from 'viem/chains'
77
+ * import { signTypedData } from 'viem/wallet'
78
+ *
79
+ * const client = createWalletClient({
80
+ * account: privateKeyToAccount('0x…'),
81
+ * chain: mainnet,
82
+ * transport: http(),
83
+ * })
84
+ * const signature = await signTypedData(client, {
85
+ * domain: {
86
+ * name: 'Ether Mail',
87
+ * version: '1',
88
+ * chainId: 1,
89
+ * verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC',
90
+ * },
91
+ * types: {
92
+ * Person: [
93
+ * { name: 'name', type: 'string' },
94
+ * { name: 'wallet', type: 'address' },
95
+ * ],
96
+ * Mail: [
97
+ * { name: 'from', type: 'Person' },
98
+ * { name: 'to', type: 'Person' },
99
+ * { name: 'contents', type: 'string' },
100
+ * ],
101
+ * },
102
+ * primaryType: 'Mail',
103
+ * message: {
104
+ * from: {
105
+ * name: 'Cow',
106
+ * wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826',
107
+ * },
108
+ * to: {
109
+ * name: 'Bob',
110
+ * wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB',
111
+ * },
112
+ * contents: 'Hello, Bob!',
113
+ * },
114
+ * })
115
+ */
116
+ export async function signTypedData<
117
+ const TTypedData extends TypedData | { [key: string]: unknown },
118
+ TPrimaryType extends string,
119
+ TChain extends Chain | undefined,
120
+ TAccount extends SmartAccount | undefined
121
+ >(
122
+ client: Client<Transport, TChain, TAccount>,
123
+ {
124
+ account: account_ = client.account,
125
+ domain,
126
+ message,
127
+ primaryType,
128
+ types: types_
129
+ }: SignTypedDataParameters<TTypedData, TPrimaryType, TAccount>
130
+ ): Promise<SignTypedDataReturnType> {
131
+ if (!account_) {
132
+ throw new AccountOrClientNotFoundError({
133
+ docsPath: "/docs/actions/wallet/signMessage"
134
+ })
135
+ }
136
+
137
+ const account = parseAccount(account_)
138
+
139
+ const types = {
140
+ EIP712Domain: getTypesForEIP712Domain({ domain }),
141
+ ...(types_ as TTypedData)
142
+ }
143
+
144
+ validateTypedData({
145
+ domain,
146
+ message,
147
+ primaryType,
148
+ types
149
+ } as TypedDataDefinition)
150
+
151
+ if (account.type === "local") {
152
+ return account.signTypedData({
153
+ domain,
154
+ primaryType,
155
+ types,
156
+ message
157
+ } as TypedDataDefinition)
158
+ }
159
+
160
+ throw new Error("Sign type message is not supported by this account")
161
+ }
@@ -0,0 +1,126 @@
1
+ import {
2
+ type Abi,
3
+ type Chain,
4
+ type Client,
5
+ type EncodeFunctionDataParameters,
6
+ type Transport,
7
+ type WriteContractParameters,
8
+ type WriteContractReturnType,
9
+ encodeFunctionData
10
+ } from "viem"
11
+ import { type SmartAccount } from "../../accounts/types.js"
12
+ import { getAction } from "../../utils/getAction.js"
13
+ import { type SponsorUserOperationMiddleware } from "./prepareUserOperationRequest.js"
14
+ import {
15
+ type SendTransactionWithPaymasterParameters,
16
+ sendTransaction
17
+ } from "./sendTransaction.js"
18
+
19
+ /**
20
+ * Executes a write function on a contract.
21
+ * This function also allows you to sponsor this transaction if sender is a smartAccount
22
+ *
23
+ * - Docs: https://viem.sh/docs/contract/writeContract.html
24
+ * - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/contracts/writing-to-contracts
25
+ *
26
+ * A "write" function on a Solidity contract modifies the state of the blockchain. These types of functions require gas to be executed, and hence a [Transaction](https://viem.sh/docs/glossary/terms.html) is needed to be broadcast in order to change the state.
27
+ *
28
+ * Internally, uses a [Wallet Client](https://viem.sh/docs/clients/wallet.html) to call the [`sendTransaction` action](https://viem.sh/docs/actions/wallet/sendTransaction.html) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData.html).
29
+ *
30
+ * __Warning: The `write` internally sends a transaction – it does not validate if the contract write will succeed (the contract may throw an error). It is highly recommended to [simulate the contract write with `contract.simulate`](https://viem.sh/docs/contract/writeContract.html#usage) before you execute it.__
31
+ *
32
+ * @param client - Client to use
33
+ * @param parameters - {@link WriteContractParameters}
34
+ * @returns A [Transaction Hash](https://viem.sh/docs/glossary/terms.html#hash). {@link WriteContractReturnType}
35
+ *
36
+ * @example
37
+ * import { createWalletClient, custom, parseAbi } from 'viem'
38
+ * import { mainnet } from 'viem/chains'
39
+ * import { writeContract } from 'viem/contract'
40
+ *
41
+ * const client = createWalletClient({
42
+ * chain: mainnet,
43
+ * transport: custom(window.ethereum),
44
+ * })
45
+ * const hash = await writeContract(client, {
46
+ * address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
47
+ * abi: parseAbi(['function mint(uint32 tokenId) nonpayable']),
48
+ * functionName: 'mint',
49
+ * args: [69420],
50
+ * })
51
+ *
52
+ * @example
53
+ * // With Validation
54
+ * import { createWalletClient, http, parseAbi } from 'viem'
55
+ * import { mainnet } from 'viem/chains'
56
+ * import { simulateContract, writeContract } from 'viem/contract'
57
+ *
58
+ * const client = createWalletClient({
59
+ * chain: mainnet,
60
+ * transport: http(),
61
+ * })
62
+ * const { request } = await simulateContract(client, {
63
+ * address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
64
+ * abi: parseAbi(['function mint(uint32 tokenId) nonpayable']),
65
+ * functionName: 'mint',
66
+ * args: [69420],
67
+ * }
68
+ * const hash = await writeContract(client, request)
69
+ */
70
+ export type WriteContractWithPaymasterParameters<
71
+ TChain extends Chain | undefined = Chain | undefined,
72
+ TAccount extends SmartAccount | undefined = SmartAccount | undefined,
73
+ TAbi extends Abi | readonly unknown[] = Abi | readonly unknown[],
74
+ TFunctionName extends string = string,
75
+ TChainOverride extends Chain | undefined = undefined
76
+ > = WriteContractParameters<
77
+ TAbi,
78
+ TFunctionName,
79
+ TChain,
80
+ TAccount,
81
+ TChainOverride
82
+ > &
83
+ SponsorUserOperationMiddleware
84
+
85
+ export async function writeContract<
86
+ TChain extends Chain | undefined,
87
+ TAccount extends SmartAccount | undefined,
88
+ const TAbi extends Abi | readonly unknown[],
89
+ TFunctionName extends string,
90
+ TChainOverride extends Chain | undefined = undefined
91
+ >(
92
+ client: Client<Transport, TChain, TAccount>,
93
+ {
94
+ abi,
95
+ address,
96
+ args,
97
+ dataSuffix,
98
+ functionName,
99
+ ...request
100
+ }: WriteContractWithPaymasterParameters<
101
+ TChain,
102
+ TAccount,
103
+ TAbi,
104
+ TFunctionName,
105
+ TChainOverride
106
+ >
107
+ ): Promise<WriteContractReturnType> {
108
+ const data = encodeFunctionData({
109
+ abi,
110
+ args,
111
+ functionName
112
+ } as unknown as EncodeFunctionDataParameters<TAbi, TFunctionName>)
113
+ const hash = await getAction(
114
+ client,
115
+ sendTransaction<TChain, TAccount, TChainOverride>
116
+ )({
117
+ data: `${data}${dataSuffix ? dataSuffix.replace("0x", "") : ""}`,
118
+ to: address,
119
+ ...request
120
+ } as unknown as SendTransactionWithPaymasterParameters<
121
+ TChain,
122
+ TAccount,
123
+ TChainOverride
124
+ >)
125
+ return hash
126
+ }
@@ -0,0 +1,49 @@
1
+ import {
2
+ type DeployContractParametersWithPaymaster,
3
+ deployContract
4
+ } from "./smartAccount/deployContract.js"
5
+
6
+ import {
7
+ type PrepareUserOperationRequestParameters,
8
+ type PrepareUserOperationRequestReturnType,
9
+ type SponsorUserOperationMiddleware,
10
+ prepareUserOperationRequest
11
+ } from "./smartAccount/prepareUserOperationRequest.js"
12
+
13
+ import {
14
+ type SendTransactionWithPaymasterParameters,
15
+ sendTransaction
16
+ } from "./smartAccount/sendTransaction.js"
17
+
18
+ import {
19
+ type SendUserOperationParameters,
20
+ type SendUserOperationReturnType,
21
+ sendUserOperation
22
+ } from "./smartAccount/sendUserOperation.js"
23
+
24
+ import { signMessage } from "./smartAccount/signMessage.js"
25
+
26
+ import { signTypedData } from "./smartAccount/signTypedData.js"
27
+
28
+ import {
29
+ type SendTransactionsWithPaymasterParameters,
30
+ sendTransactions
31
+ } from "./smartAccount/sendTransactions.js"
32
+
33
+ export {
34
+ deployContract,
35
+ type DeployContractParametersWithPaymaster,
36
+ prepareUserOperationRequest,
37
+ type PrepareUserOperationRequestParameters,
38
+ type PrepareUserOperationRequestReturnType,
39
+ sendTransaction,
40
+ sendUserOperation,
41
+ type SendUserOperationParameters,
42
+ type SendUserOperationReturnType,
43
+ signMessage,
44
+ signTypedData,
45
+ type SendTransactionWithPaymasterParameters,
46
+ type SponsorUserOperationMiddleware,
47
+ sendTransactions,
48
+ type SendTransactionsWithPaymasterParameters
49
+ }
@@ -19,7 +19,7 @@ export type AccountsParameters = {
19
19
  *
20
20
  * const bundlerClient = createClient({
21
21
  * chain: goerli,
22
- * transport: http("https://api.stackup.sh/v1/paymaster/YOUR_API_KEY_HERE")
22
+ * transport: http("https://api.stackup.sh/v2/paymaster/YOUR_API_KEY_HERE")
23
23
  * })
24
24
  *
25
25
  * await accounts(bundlerClient, {
@@ -2,13 +2,19 @@ import type { Address, Hex } from "viem"
2
2
  import type { PartialBy } from "viem/types/utils"
3
3
  import { type StackupPaymasterClient } from "../../clients/stackup.js"
4
4
  import type { StackupPaymasterContext } from "../../types/stackup.js"
5
- import type { UserOperation, UserOperationWithBigIntAsHex } from "../../types/userOperation.js"
5
+ import type {
6
+ UserOperation,
7
+ UserOperationWithBigIntAsHex
8
+ } from "../../types/userOperation.js"
6
9
  import { deepHexlify } from "../../utils/deepHexlify.js"
7
10
 
8
11
  export type SponsorUserOperationParameters = {
9
12
  userOperation: PartialBy<
10
13
  UserOperation,
11
- "callGasLimit" | "preVerificationGas" | "verificationGasLimit" | "paymasterAndData"
14
+ | "callGasLimit"
15
+ | "preVerificationGas"
16
+ | "verificationGasLimit"
17
+ | "paymasterAndData"
12
18
  >
13
19
  entryPoint: Address
14
20
  context: StackupPaymasterContext
@@ -37,7 +43,7 @@ export type SponsorUserOperationReturnType = {
37
43
  *
38
44
  * const bundlerClient = createClient({
39
45
  * chain: goerli,
40
- * transport: http("https://api.stackup.sh/v1/paymaster/YOUR_API_KEY_HERE")
46
+ * transport: http("https://api.stackup.sh/v2/paymaster/YOUR_API_KEY_HERE")
41
47
  * })
42
48
  *
43
49
  * await sponsorUserOperation(bundlerClient, {
@@ -52,7 +58,11 @@ export const sponsorUserOperation = async (
52
58
  ): Promise<SponsorUserOperationReturnType> => {
53
59
  const response = await client.request({
54
60
  method: "pm_sponsorUserOperation",
55
- params: [deepHexlify(args.userOperation) as UserOperationWithBigIntAsHex, args.entryPoint, args.context]
61
+ params: [
62
+ deepHexlify(args.userOperation) as UserOperationWithBigIntAsHex,
63
+ args.entryPoint,
64
+ args.context
65
+ ]
56
66
  })
57
67
 
58
68
  return {