permissionless 0.0.6 → 0.0.7

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 (211) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/_cjs/actions/bundler/chainId.js +11 -0
  3. package/_cjs/actions/bundler/chainId.js.map +1 -0
  4. package/_cjs/actions/bundler/estimateUserOperationGas.js +18 -0
  5. package/_cjs/actions/bundler/estimateUserOperationGas.js.map +1 -0
  6. package/_cjs/actions/bundler/getUserOperationByHash.js +30 -0
  7. package/_cjs/actions/bundler/getUserOperationByHash.js.map +1 -0
  8. package/_cjs/actions/bundler/getUserOperationReceipt.js +48 -0
  9. package/_cjs/actions/bundler/getUserOperationReceipt.js.map +1 -0
  10. package/_cjs/actions/bundler/sendUserOperation.js +13 -0
  11. package/_cjs/actions/bundler/sendUserOperation.js.map +1 -0
  12. package/_cjs/actions/bundler/supportedEntryPoints.js +11 -0
  13. package/_cjs/actions/bundler/supportedEntryPoints.js.map +1 -0
  14. package/_cjs/actions/index.js +18 -12
  15. package/_cjs/actions/index.js.map +1 -1
  16. package/_cjs/actions/pimlico/getUserOperationGasPrice.js +25 -0
  17. package/_cjs/actions/pimlico/getUserOperationGasPrice.js.map +1 -0
  18. package/_cjs/actions/pimlico/getUserOperationStatus.js +11 -0
  19. package/_cjs/actions/pimlico/getUserOperationStatus.js.map +1 -0
  20. package/_cjs/actions/pimlico/sponsorUserOperation.js +18 -0
  21. package/_cjs/actions/pimlico/sponsorUserOperation.js.map +1 -0
  22. package/_cjs/actions/pimlico.js +10 -52
  23. package/_cjs/actions/pimlico.js.map +1 -1
  24. package/_cjs/actions/public/getAccountNonce.js +35 -0
  25. package/_cjs/actions/public/getAccountNonce.js.map +1 -0
  26. package/_cjs/actions/{public.js → public/getSenderAddress.js} +2 -33
  27. package/_cjs/actions/public/getSenderAddress.js.map +1 -0
  28. package/_cjs/actions/stackup/accounts.js +12 -0
  29. package/_cjs/actions/stackup/accounts.js.map +1 -0
  30. package/_cjs/actions/stackup/sponsorUserOperation.js +18 -0
  31. package/_cjs/actions/stackup/sponsorUserOperation.js.map +1 -0
  32. package/_cjs/actions/stackup.js +10 -0
  33. package/_cjs/actions/stackup.js.map +1 -0
  34. package/_cjs/clients/bundler.js +2 -2
  35. package/_cjs/clients/bundler.js.map +1 -1
  36. package/_cjs/clients/decorators/bundler.js +19 -0
  37. package/_cjs/clients/decorators/bundler.js.map +1 -0
  38. package/_cjs/clients/decorators/pimlico.js +16 -0
  39. package/_cjs/clients/decorators/pimlico.js.map +1 -0
  40. package/_cjs/clients/decorators/stackup.js +11 -0
  41. package/_cjs/clients/decorators/stackup.js.map +1 -0
  42. package/_cjs/clients/pimlico.js +4 -4
  43. package/_cjs/clients/pimlico.js.map +1 -1
  44. package/_cjs/clients/stackup.js +18 -0
  45. package/_cjs/clients/stackup.js.map +1 -0
  46. package/_cjs/index.js +24 -4
  47. package/_cjs/index.js.map +1 -1
  48. package/_cjs/types/stackup.js +3 -0
  49. package/_cjs/types/stackup.js.map +1 -0
  50. package/_cjs/utils/getUserOperationHash.js +38 -0
  51. package/_cjs/utils/getUserOperationHash.js.map +1 -0
  52. package/_cjs/utils/index.js +2 -34
  53. package/_cjs/utils/index.js.map +1 -1
  54. package/_esm/actions/bundler/chainId.js +29 -0
  55. package/_esm/actions/bundler/chainId.js.map +1 -0
  56. package/_esm/actions/bundler/estimateUserOperationGas.js +41 -0
  57. package/_esm/actions/bundler/estimateUserOperationGas.js.map +1 -0
  58. package/_esm/actions/bundler/getUserOperationByHash.js +48 -0
  59. package/_esm/actions/bundler/getUserOperationByHash.js.map +1 -0
  60. package/_esm/actions/bundler/getUserOperationReceipt.js +66 -0
  61. package/_esm/actions/bundler/getUserOperationReceipt.js.map +1 -0
  62. package/_esm/actions/bundler/sendUserOperation.js +36 -0
  63. package/_esm/actions/bundler/sendUserOperation.js.map +1 -0
  64. package/_esm/actions/bundler/supportedEntryPoints.js +29 -0
  65. package/_esm/actions/bundler/supportedEntryPoints.js.map +1 -0
  66. package/_esm/actions/index.js +9 -3
  67. package/_esm/actions/index.js.map +1 -1
  68. package/_esm/actions/pimlico/getUserOperationGasPrice.js +42 -0
  69. package/_esm/actions/pimlico/getUserOperationGasPrice.js.map +1 -0
  70. package/_esm/actions/pimlico/getUserOperationStatus.js +29 -0
  71. package/_esm/actions/pimlico/getUserOperationStatus.js.map +1 -0
  72. package/_esm/actions/pimlico/sponsorUserOperation.js +39 -0
  73. package/_esm/actions/pimlico/sponsorUserOperation.js.map +1 -0
  74. package/_esm/actions/pimlico.js +5 -123
  75. package/_esm/actions/pimlico.js.map +1 -1
  76. package/_esm/actions/public/getAccountNonce.js +57 -0
  77. package/_esm/actions/public/getAccountNonce.js.map +1 -0
  78. package/_esm/actions/{public.js → public/getSenderAddress.js} +1 -57
  79. package/_esm/actions/public/getSenderAddress.js.map +1 -0
  80. package/_esm/actions/stackup/accounts.js +30 -0
  81. package/_esm/actions/stackup/accounts.js.map +1 -0
  82. package/_esm/actions/stackup/sponsorUserOperation.js +40 -0
  83. package/_esm/actions/stackup/sponsorUserOperation.js.map +1 -0
  84. package/_esm/actions/stackup.js +5 -0
  85. package/_esm/actions/stackup.js.map +1 -0
  86. package/_esm/clients/bundler.js +1 -1
  87. package/_esm/clients/bundler.js.map +1 -1
  88. package/_esm/clients/decorators/bundler.js +16 -0
  89. package/_esm/clients/decorators/bundler.js.map +1 -0
  90. package/_esm/clients/decorators/pimlico.js +20 -0
  91. package/_esm/clients/decorators/pimlico.js.map +1 -0
  92. package/_esm/clients/decorators/stackup.js +8 -0
  93. package/_esm/clients/decorators/stackup.js.map +1 -0
  94. package/_esm/clients/pimlico.js +2 -2
  95. package/_esm/clients/pimlico.js.map +1 -1
  96. package/_esm/clients/stackup.js +33 -0
  97. package/_esm/clients/stackup.js.map +1 -0
  98. package/_esm/index.js +15 -4
  99. package/_esm/index.js.map +1 -1
  100. package/_esm/types/stackup.js +2 -0
  101. package/_esm/types/stackup.js.map +1 -0
  102. package/_esm/utils/getUserOperationHash.js +55 -0
  103. package/_esm/utils/getUserOperationHash.js.map +1 -0
  104. package/_esm/utils/index.js +1 -54
  105. package/_esm/utils/index.js.map +1 -1
  106. package/_types/actions/bundler/chainId.d.ts +25 -0
  107. package/_types/actions/bundler/chainId.d.ts.map +1 -0
  108. package/_types/actions/bundler/estimateUserOperationGas.d.ts +42 -0
  109. package/_types/actions/bundler/estimateUserOperationGas.d.ts.map +1 -0
  110. package/_types/actions/bundler/getUserOperationByHash.d.ts +37 -0
  111. package/_types/actions/bundler/getUserOperationByHash.d.ts.map +1 -0
  112. package/_types/actions/bundler/getUserOperationReceipt.d.ts +93 -0
  113. package/_types/actions/bundler/getUserOperationReceipt.d.ts.map +1 -0
  114. package/_types/actions/bundler/sendUserOperation.d.ts +36 -0
  115. package/_types/actions/bundler/sendUserOperation.d.ts.map +1 -0
  116. package/_types/actions/bundler/supportedEntryPoints.d.ts +26 -0
  117. package/_types/actions/bundler/supportedEntryPoints.d.ts.map +1 -0
  118. package/_types/actions/index.d.ts +17 -6
  119. package/_types/actions/index.d.ts.map +1 -1
  120. package/_types/actions/pimlico/getUserOperationGasPrice.d.ts +38 -0
  121. package/_types/actions/pimlico/getUserOperationGasPrice.d.ts.map +1 -0
  122. package/_types/actions/pimlico/getUserOperationStatus.d.ts +31 -0
  123. package/_types/actions/pimlico/getUserOperationStatus.d.ts.map +1 -0
  124. package/_types/actions/pimlico/sponsorUserOperation.d.ts +41 -0
  125. package/_types/actions/pimlico/sponsorUserOperation.d.ts.map +1 -0
  126. package/_types/actions/pimlico.d.ts +7 -177
  127. package/_types/actions/pimlico.d.ts.map +1 -1
  128. package/_types/actions/public/getAccountNonce.d.ts +34 -0
  129. package/_types/actions/public/getAccountNonce.d.ts.map +1 -0
  130. package/_types/actions/{public.d.ts → public/getSenderAddress.d.ts} +2 -35
  131. package/_types/actions/public/getSenderAddress.d.ts.map +1 -0
  132. package/_types/actions/stackup/accounts.d.ts +29 -0
  133. package/_types/actions/stackup/accounts.d.ts.map +1 -0
  134. package/_types/actions/stackup/sponsorUserOperation.d.ts +43 -0
  135. package/_types/actions/stackup/sponsorUserOperation.d.ts.map +1 -0
  136. package/_types/actions/stackup.d.ts +7 -0
  137. package/_types/actions/stackup.d.ts.map +1 -0
  138. package/_types/clients/bundler.d.ts +2 -2
  139. package/_types/clients/bundler.d.ts.map +1 -1
  140. package/_types/clients/decorators/bundler.d.ts +150 -0
  141. package/_types/clients/decorators/bundler.d.ts.map +1 -0
  142. package/_types/clients/decorators/pimlico.d.ts +78 -0
  143. package/_types/clients/decorators/pimlico.d.ts.map +1 -0
  144. package/_types/clients/decorators/stackup.d.ts +54 -0
  145. package/_types/clients/decorators/stackup.d.ts.map +1 -0
  146. package/_types/clients/pimlico.d.ts +3 -3
  147. package/_types/clients/pimlico.d.ts.map +1 -1
  148. package/_types/clients/stackup.d.ts +39 -0
  149. package/_types/clients/stackup.d.ts.map +1 -0
  150. package/_types/index.d.ts +26 -4
  151. package/_types/index.d.ts.map +1 -1
  152. package/_types/types/bundler.d.ts +1 -1
  153. package/_types/types/bundler.d.ts.map +1 -1
  154. package/_types/types/index.d.ts +1 -1
  155. package/_types/types/index.d.ts.map +1 -1
  156. package/_types/types/pimlico.d.ts +1 -1
  157. package/_types/types/pimlico.d.ts.map +1 -1
  158. package/_types/types/stackup.d.ts +35 -0
  159. package/_types/types/stackup.d.ts.map +1 -0
  160. package/_types/utils/getUserOperationHash.d.ts +30 -0
  161. package/_types/utils/getUserOperationHash.d.ts.map +1 -0
  162. package/_types/utils/index.d.ts +2 -30
  163. package/_types/utils/index.d.ts.map +1 -1
  164. package/actions/bundler/chainId.ts +32 -0
  165. package/actions/bundler/estimateUserOperationGas.ts +62 -0
  166. package/actions/bundler/getUserOperationByHash.ts +69 -0
  167. package/actions/bundler/getUserOperationReceipt.ts +109 -0
  168. package/actions/bundler/sendUserOperation.ts +45 -0
  169. package/actions/bundler/supportedEntryPoints.ts +31 -0
  170. package/actions/index.ts +22 -21
  171. package/actions/pimlico/getUserOperationGasPrice.ts +61 -0
  172. package/actions/pimlico/getUserOperationStatus.ts +41 -0
  173. package/actions/pimlico/sponsorUserOperation.ts +62 -0
  174. package/actions/pimlico.ts +34 -251
  175. package/actions/public/getAccountNonce.ts +63 -0
  176. package/actions/{public.ts → public/getSenderAddress.ts} +7 -68
  177. package/actions/stackup/accounts.ts +40 -0
  178. package/actions/stackup/sponsorUserOperation.ts +64 -0
  179. package/actions/stackup.ts +17 -0
  180. package/clients/bundler.ts +2 -3
  181. package/clients/decorators/bundler.ts +178 -0
  182. package/clients/decorators/pimlico.ts +107 -0
  183. package/clients/decorators/stackup.ts +65 -0
  184. package/clients/pimlico.ts +3 -4
  185. package/clients/stackup.ts +44 -0
  186. package/index.ts +62 -4
  187. package/package.json +11 -1
  188. package/tsconfig.build.tsbuildinfo +1 -1
  189. package/types/bundler.ts +1 -1
  190. package/types/index.ts +1 -1
  191. package/types/pimlico.ts +1 -1
  192. package/types/stackup.ts +36 -0
  193. package/utils/getUserOperationHash.ts +68 -0
  194. package/utils/index.ts +2 -69
  195. package/_cjs/actions/bundler.js +0 -118
  196. package/_cjs/actions/bundler.js.map +0 -1
  197. package/_cjs/actions/public.js.map +0 -1
  198. package/_cjs/clients/index.js +0 -6
  199. package/_cjs/clients/index.js.map +0 -1
  200. package/_esm/actions/bundler.js +0 -251
  201. package/_esm/actions/bundler.js.map +0 -1
  202. package/_esm/actions/public.js.map +0 -1
  203. package/_esm/clients/index.js +0 -3
  204. package/_esm/clients/index.js.map +0 -1
  205. package/_types/actions/bundler.d.ts +0 -393
  206. package/_types/actions/bundler.d.ts.map +0 -1
  207. package/_types/actions/public.d.ts.map +0 -1
  208. package/_types/clients/index.d.ts +0 -3
  209. package/_types/clients/index.d.ts.map +0 -1
  210. package/actions/bundler.ts +0 -498
  211. package/clients/index.ts +0 -3
@@ -1,124 +1,6 @@
1
- import { deepHexlify } from "./utils";
2
- /**
3
- * Returns the live gas prices that you can use to send a user operation.
4
- *
5
- * - Docs: https://docs.pimlico.io/permissionless/reference/pimlico-bundler-actions/getUserOperationGasPrice
6
- *
7
- * @param client {@link PimlicoBundlerClient} that you created using viem's createClient whose transport url is pointing to the Pimlico's bundler.
8
- * @returns slow, standard & fast values for maxFeePerGas & maxPriorityFeePerGas
9
- *
10
- *
11
- * @example
12
- * import { createClient } from "viem"
13
- * import { getUserOperationGasPrice } from "permissionless/actions"
14
- *
15
- * const bundlerClient = createClient({
16
- * chain: goerli,
17
- * transport: http("https://api.pimlico.io/v1/goerli/rpc?apikey=YOUR_API_KEY_HERE")
18
- * })
19
- *
20
- * await getUserOperationGasPrice(bundlerClient)
21
- *
22
- */
23
- export const getUserOperationGasPrice = async (client) => {
24
- const gasPrices = await client.request({
25
- method: "pimlico_getUserOperationGasPrice",
26
- params: []
27
- });
28
- return {
29
- slow: {
30
- maxFeePerGas: BigInt(gasPrices.slow.maxFeePerGas),
31
- maxPriorityFeePerGas: BigInt(gasPrices.slow.maxPriorityFeePerGas)
32
- },
33
- standard: {
34
- maxFeePerGas: BigInt(gasPrices.standard.maxFeePerGas),
35
- maxPriorityFeePerGas: BigInt(gasPrices.standard.maxPriorityFeePerGas)
36
- },
37
- fast: {
38
- maxFeePerGas: BigInt(gasPrices.fast.maxFeePerGas),
39
- maxPriorityFeePerGas: BigInt(gasPrices.fast.maxPriorityFeePerGas)
40
- }
41
- };
42
- };
43
- /**
44
- * Returns the status of the userOperation that is pending in the mempool.
45
- *
46
- * - Docs: https://docs.pimlico.io/permissionless/reference/pimlico-bundler-actions/getUserOperationStatus
47
- *
48
- * @param client {@link PimlicoBundlerClient} that you created using viem's createClient whose transport url is pointing to the Pimlico's bundler.
49
- * @param hash {@link Hash} UserOpHash that you must have received from sendUserOperation.
50
- * @returns status & transaction hash if included {@link GetUserOperationStatusReturnType}
51
- *
52
- *
53
- * @example
54
- * import { createClient } from "viem"
55
- * import { getUserOperationStatus } from "permissionless/actions"
56
- *
57
- * const bundlerClient = createClient({
58
- * chain: goerli,
59
- * transport: http("https://api.pimlico.io/v1/goerli/rpc?apikey=YOUR_API_KEY_HERE")
60
- * })
61
- *
62
- * await getUserOperationStatus(bundlerClient, { hash: userOpHash })
63
- *
64
- */
65
- export const getUserOperationStatus = async (client, { hash }) => {
66
- return client.request({
67
- method: "pimlico_getUserOperationStatus",
68
- params: [hash]
69
- });
70
- };
71
- export const pimlicoBundlerActions = (client) => ({
72
- getUserOperationGasPrice: async () => getUserOperationGasPrice(client),
73
- getUserOperationStatus: async (args) => getUserOperationStatus(client, args)
74
- });
75
- /**
76
- * Returns paymasterAndData & updated gas parameters required to sponsor a userOperation.
77
- *
78
- * - Docs: https://docs.pimlico.io/permissionless/reference/pimlico-paymaster-actions/sponsorUserOperation
79
- *
80
- * @param client {@link PimlicoBundlerClient} that you created using viem's createClient whose transport url is pointing to the Pimlico's bundler.
81
- * @param args {@link sponsorUserOperationParameters} UserOperation you want to sponsor & entryPoint.
82
- * @returns paymasterAndData & updated gas parameters, see {@link SponsorUserOperationReturnType}
83
- *
84
- *
85
- * @example
86
- * import { createClient } from "viem"
87
- * import { sponsorUserOperation } from "permissionless/actions"
88
- *
89
- * const bundlerClient = createClient({
90
- * chain: goerli,
91
- * transport: http("https://api.pimlico.io/v2/goerli/rpc?apikey=YOUR_API_KEY_HERE")
92
- * })
93
- *
94
- * await sponsorUserOperation(bundlerClient, {
95
- * userOperation: userOperationWithDummySignature,
96
- * entryPoint: entryPoint
97
- * }})
98
- *
99
- */
100
- export const sponsorUserOperation = async (client, args) => {
101
- const response = await client.request({
102
- method: "pm_sponsorUserOperation",
103
- params: [deepHexlify(args.userOperation), args.entryPoint]
104
- });
105
- return {
106
- paymasterAndData: response.paymasterAndData,
107
- preVerificationGas: BigInt(response.preVerificationGas),
108
- verificationGasLimit: BigInt(response.verificationGasLimit),
109
- callGasLimit: BigInt(response.callGasLimit)
110
- };
111
- };
112
- export const pimlicoPaymasterActions = (client) => ({
113
- sponsorUserOperation: async (args) => sponsorUserOperation(client, args)
114
- });
115
- /**
116
- * TODO: Add support for pimlicoActions after we support all the actions of v1 in v2 of the Pimlico API.
117
- */
118
- // export const pimlicoActions = (client: Client) => {
119
- // return {
120
- // ...pimlicoBundlerActions(client),
121
- // ...pimlicoPaymasterActions(client)
122
- // }
123
- // }
1
+ import { getUserOperationGasPrice } from "./pimlico/getUserOperationGasPrice.js";
2
+ import { getUserOperationStatus } from "./pimlico/getUserOperationStatus.js";
3
+ import { sponsorUserOperation } from "./pimlico/sponsorUserOperation.js";
4
+ import { pimlicoBundlerActions, pimlicoPaymasterActions } from "../clients/decorators/pimlico.js";
5
+ export { getUserOperationGasPrice, getUserOperationStatus, sponsorUserOperation, pimlicoBundlerActions, pimlicoPaymasterActions };
124
6
  //# sourceMappingURL=pimlico.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pimlico.js","sourceRoot":"","sources":["../../actions/pimlico.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAsCrC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,KAAK,EACzC,MAA4B,EACe,EAAE;IAC7C,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC;QACnC,MAAM,EAAE,kCAAkC;QAC1C,MAAM,EAAE,EAAE;KACb,CAAC,CAAA;IAEF,OAAO;QACH,IAAI,EAAE;YACF,YAAY,EAAE,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC;YACjD,oBAAoB,EAAE,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,oBAAoB,CAAC;SACpE;QACD,QAAQ,EAAE;YACN,YAAY,EAAE,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,YAAY,CAAC;YACrD,oBAAoB,EAAE,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,oBAAoB,CAAC;SACxE;QACD,IAAI,EAAE;YACF,YAAY,EAAE,MAAM,CA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AAA;AACL,CAAC,CAAA;AA6BD,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,MAAc,EAAiC,EAAE,CAAC,CAAC;IACvF,oBAAoB,EAAE,KAAK,EAAE,IAAoC,EAAE,EAAE,CACjE,oBAAoB,CAAC,MAAgC,EAAE,IAAI,CAAC;CACnE,CAAC,CAAA;AAEF;;GAEG;AACH,sDAAsD;AACtD,eAAe;AACf,4CAA4C;AAC5C,6CAA6C;AAC7C,QAAQ;AACR,IAAI"}
1
+ {"version":3,"file":"pimlico.js","sourceRoot":"","sources":["../../actions/pimlico.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,wBAAwB,EAC3B,MAAM,uCAAuC,CAAA;AAC9C,OAAO,EAGH,sBAAsB,EACzB,MAAM,qCAAqC,CAAA;AAC5C,OAAO,EAGH,oBAAoB,EACvB,MAAM,mCAAmC,CAAA;AAG1C,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAA;AAYjG,OAAO,EACH,wBAAwB,EACxB,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,EAC1B,CAAA"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Returns the nonce of the account with the entry point.
3
+ *
4
+ * - Docs: https://docs.pimlico.io/permissionless/reference/public-actions/getAccountNonce
5
+ *
6
+ * @param publicClient {@link PublicClient} that you created using viem's createPublicClient.
7
+ * @param args {@link GetAccountNonceParams} address, entryPoint & key
8
+ * @returns bigint nonce
9
+ *
10
+ * @example
11
+ * import { createPublicClient } from "viem"
12
+ * import { getAccountNonce } from "permissionless/actions"
13
+ *
14
+ * const publicClient = createPublicClient({
15
+ * chain: goerli,
16
+ * transport: http("https://goerli.infura.io/v3/your-infura-key")
17
+ * })
18
+ *
19
+ * const nonce = await getAccountNonce(publicClient, {
20
+ * address,
21
+ * entryPoint,
22
+ * key
23
+ * })
24
+ *
25
+ * // Return 0n
26
+ */
27
+ export const getAccountNonce = async (publicClient, { sender, entryPoint, key = BigInt(0) }) => {
28
+ return await publicClient.readContract({
29
+ address: entryPoint,
30
+ abi: [
31
+ {
32
+ inputs: [
33
+ {
34
+ name: "sender",
35
+ type: "address"
36
+ },
37
+ {
38
+ name: "key",
39
+ type: "uint192"
40
+ }
41
+ ],
42
+ name: "getNonce",
43
+ outputs: [
44
+ {
45
+ name: "nonce",
46
+ type: "uint256"
47
+ }
48
+ ],
49
+ stateMutability: "view",
50
+ type: "function"
51
+ }
52
+ ],
53
+ functionName: "getNonce",
54
+ args: [sender, key]
55
+ });
56
+ };
57
+ //# sourceMappingURL=getAccountNonce.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAccountNonce.js","sourceRoot":"","sources":["../../../actions/public/getAccountNonce.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,EAChC,YAA0B,EAC1B,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,EAAyB,EAC/C,EAAE;IACjB,OAAO,MAAM,YAAY,CAAC,YAAY,CAAC;QACnC,OAAO,EAAE,UAAU;QACnB,GAAG,EAAE;YACD;gBACI,MAAM,EAAE;oBACJ;wBACI,IAAI,EAAE,QAAQ;wBACd,IAAI,EAAE,SAAS;qBAClB;oBACD;wBACI,IAAI,EAAE,KAAK;wBACX,IAAI,EAAE,SAAS;qBAClB;iBACJ;gBACD,IAAI,EAAE,UAAU;gBAChB,OAAO,EAAE;oBACL;wBACI,IAAI,EAAE,OAAO;wBACb,IAAI,EAAE,SAAS;qBAClB;iBACJ;gBACD,eAAe,EAAE,MAAM;gBACvB,IAAI,EAAE,UAAU;aACnB;SACJ;QACD,YAAY,EAAE,UAAU;QACxB,IAAI,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC;KACtB,CAAC,CAAA;AACN,CAAC,CAAA"}
@@ -85,60 +85,4 @@ export const getSenderAddress = async (publicClient, { initCode, entryPoint }) =
85
85
  }
86
86
  throw new InvalidEntryPointError({ entryPoint });
87
87
  };
88
- /**
89
- * Returns the nonce of the account with the entry point.
90
- *
91
- * - Docs: https://docs.pimlico.io/permissionless/reference/public-actions/getAccountNonce
92
- *
93
- * @param publicClient {@link PublicClient} that you created using viem's createPublicClient.
94
- * @param args {@link GetAccountNonceParams} address, entryPoint & key
95
- * @returns bigint nonce
96
- *
97
- * @example
98
- * import { createPublicClient } from "viem"
99
- * import { getAccountNonce } from "permissionless/actions"
100
- *
101
- * const publicClient = createPublicClient({
102
- * chain: goerli,
103
- * transport: http("https://goerli.infura.io/v3/your-infura-key")
104
- * })
105
- *
106
- * const nonce = await getAccountNonce(publicClient, {
107
- * address,
108
- * entryPoint,
109
- * key
110
- * })
111
- *
112
- * // Return 0n
113
- */
114
- export const getAccountNonce = async (publicClient, { address, entryPoint, key = 0n }) => {
115
- return await publicClient.readContract({
116
- address: entryPoint,
117
- abi: [
118
- {
119
- inputs: [
120
- {
121
- name: "sender",
122
- type: "address"
123
- },
124
- {
125
- name: "key",
126
- type: "uint192"
127
- }
128
- ],
129
- name: "getNonce",
130
- outputs: [
131
- {
132
- name: "nonce",
133
- type: "uint256"
134
- }
135
- ],
136
- stateMutability: "view",
137
- type: "function"
138
- }
139
- ],
140
- functionName: "getNonce",
141
- args: [address, key]
142
- });
143
- };
144
- //# sourceMappingURL=public.js.map
88
+ //# sourceMappingURL=getSenderAddress.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getSenderAddress.js","sourceRoot":"","sources":["../../../actions/public/getSenderAddress.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,SAAS,EAKZ,MAAM,MAAM,CAAA;AAIb,MAAM,OAAO,sBAAuB,SAAQ,SAAS;IAGjD,YAAY,EAAE,KAAK,EAAE,UAAU,KAAkD,EAAE;QAC/E,KAAK,CACD,0CACI,UAAU,CAAC,CAAC,CAAC,MAAM,UAAU,EAAE,CAAC,CAAC,CAAC,EACtC,i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C,IAAI,EAAE,IAAI,CAAC,CAAC,CAAY,CAAA;aAC9C;SACJ;QAED,MAAM,CAAC,CAAA;KACV;IAED,MAAM,IAAI,sBAAsB,CAAC,EAAE,UAAU,EAAE,CAAC,CAAA;AACpD,CAAC,CAAA"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Returns all the Paymaster addresses associated with an EntryPoint that’s owned by this service.
3
+ *
4
+ * https://docs.stackup.sh/docs/paymaster-api-rpc-methods#pm_accounts
5
+ *
6
+ * @param args {@link AccountsParameters} entryPoint for which you want to get list of supported paymasters.
7
+ * @returns paymaster addresses
8
+ *
9
+ * @example
10
+ * import { createClient } from "viem"
11
+ * import { accounts } from "permissionless/actions/stackup"
12
+ *
13
+ * const bundlerClient = createClient({
14
+ * chain: goerli,
15
+ * transport: http("https://api.stackup.sh/v1/paymaster/YOUR_API_KEY_HERE")
16
+ * })
17
+ *
18
+ * await accounts(bundlerClient, {
19
+ * entryPoint: entryPoint
20
+ * }})
21
+ *
22
+ */
23
+ export const accounts = async (client, { entryPoint }) => {
24
+ const response = await client.request({
25
+ method: "pm_accounts",
26
+ params: [entryPoint]
27
+ });
28
+ return response;
29
+ };
30
+ //# sourceMappingURL=accounts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accounts.js","sourceRoot":"","sources":["../../../actions/stackup/accounts.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,EACzB,MAA8B,EAC9B,EAAE,UAAU,EAAsB,EAChB,EAAE;IACpB,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC;QAClC,MAAM,EAAE,aAAa;QACrB,MAAM,EAAE,CAAC,UAAU,CAAC;KACvB,CAAC,CAAA;IAEF,OAAO,QAAQ,CAAA;AACnB,CAAC,CAAA"}
@@ -0,0 +1,40 @@
1
+ import {} from "../../clients/stackup.js";
2
+ import { deepHexlify } from "../utils.js";
3
+ /**
4
+ * Returns paymasterAndData & updated gas parameters required to sponsor a userOperation.
5
+ *
6
+ * - Docs: https://docs.pimlico.io/permissionless/reference/stackup-paymaster-actions/sponsorUserOperation
7
+ *
8
+ * @param client {@link PimlicoBundlerClient} that you created using viem's createClient whose transport url is pointing to the Pimlico's bundler.
9
+ * @param args {@link sponsorUserOperationParameters} UserOperation you want to sponsor & entryPoint.
10
+ * @returns paymasterAndData & updated gas parameters, see {@link SponsorUserOperationReturnType}
11
+ *
12
+ *
13
+ * @example
14
+ * import { createClient } from "viem"
15
+ * import { sponsorUserOperation } from "permissionless/actions/stackup"
16
+ *
17
+ * const bundlerClient = createClient({
18
+ * chain: goerli,
19
+ * transport: http("https://api.stackup.sh/v1/paymaster/YOUR_API_KEY_HERE")
20
+ * })
21
+ *
22
+ * await sponsorUserOperation(bundlerClient, {
23
+ * userOperation: userOperationWithDummySignature,
24
+ * entryPoint: entryPoint
25
+ * }})
26
+ *
27
+ */
28
+ export const sponsorUserOperation = async (client, args) => {
29
+ const response = await client.request({
30
+ method: "pm_sponsorUserOperation",
31
+ params: [deepHexlify(args.userOperation), args.entryPoint, args.context]
32
+ });
33
+ return {
34
+ paymasterAndData: response.paymasterAndData,
35
+ preVerificationGas: BigInt(response.preVerificationGas),
36
+ verificationGasLimit: BigInt(response.verificationGasLimit),
37
+ callGasLimit: BigInt(response.callGasLimit)
38
+ };
39
+ };
40
+ //# sourceMappingURL=sponsorUserOperation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sponsorUserOperation.js","sourceRoot":"","sources":["../../../actions/stackup/sponsorUserOperation.ts"],"names":[],"mappings":"AAEA,OAAO,EAA+B,MAAM,0BAA0B,CAAA;AAGtE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAkBzC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,EACrC,MAA8B,EAC9B,IAAoC,EACG,EAAE;IACzC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC;QAClC,MAAM,EAAE,yBAAyB;QACjC,MAAM,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,aAAa,CAAiC,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC;KAC3G,CAAC,CAAA;IAEF,OAAO;QACH,gBAAgB,EAAE,QAAQ,CAAC,gBAAgB;QAC3C,kBAAkB,EAAE,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAC;QACvD,oBAAoB,EAAE,MAAM,CAAC,QAAQ,CAAC,oBAAoB,CAAC;QAC3D,YAAY,EAAE,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC;KAC9C,CAAA;AACL,CAAC,CAAA"}
@@ -0,0 +1,5 @@
1
+ import { stackupPaymasterActions } from "../clients/decorators/stackup.js";
2
+ import { accounts } from "./stackup/accounts.js";
3
+ import { sponsorUserOperation } from "./stackup/sponsorUserOperation.js";
4
+ export { sponsorUserOperation, accounts, stackupPaymasterActions };
5
+ //# sourceMappingURL=stackup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stackup.js","sourceRoot":"","sources":["../../actions/stackup.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAA;AAC1E,OAAO,EAA2B,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AACzE,OAAO,EAGH,oBAAoB,EACvB,MAAM,mCAAmC,CAAA;AAS1C,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,uBAAuB,EAAE,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { createClient } from "viem";
2
- import { bundlerActions } from "../actions";
2
+ import { bundlerActions } from "./decorators/bundler.js";
3
3
  /**
4
4
  * Creates a EIP-4337 compliant Bundler Client with a given [Transport](https://viem.sh/docs/clients/intro.html) configured for a [Chain](https://viem.sh/docs/clients/chains.html).
5
5
  *
@@ -1 +1 @@
1
- {"version":3,"file":"bundler.js","sourceRoot":"","sources":["../../clients/bundler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAK3C;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAC/B,UAAgD,EACnC,EAAE;IACf,MAAM,EAAE,GAAG,GAAG,QAAQ,EAAE,IAAI,GAAG,gBAAgB,EAAE,GAAG,UAAU,CAAA;IAC9D,MAAM,MAAM,GAAG,YAAY,CAAC;QACxB,GAAG,UAAU;QACb,GAAG;QACH,IAAI;QACJ,IAAI,EAAE,eAAe;KACxB,CAAC,CAAA;IACF,OAAO,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAA;AACxC,CAAC,CAAA"}
1
+ {"version":3,"file":"bundler.js","sourceRoot":"","sources":["../../clients/bundler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAEnC,OAAO,EAAuB,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAG7E;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAC/B,UAAgD,EACnC,EAAE;IACf,MAAM,EAAE,GAAG,GAAG,QAAQ,EAAE,IAAI,GAAG,gBAAgB,EAAE,GAAG,UAAU,CAAA;IAC9D,MAAM,MAAM,GAAG,YAAY,CAAC;QACxB,GAAG,UAAU;QACb,GAAG;QACH,IAAI;QACJ,IAAI,EAAE,eAAe;KACxB,CAAC,CAAA;IACF,OAAO,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAA;AACxC,CAAC,CAAA"}
@@ -0,0 +1,16 @@
1
+ import { chainId } from "../../actions/bundler/chainId.js";
2
+ import { estimateUserOperationGas } from "../../actions/bundler/estimateUserOperationGas.js";
3
+ import { getUserOperationByHash } from "../../actions/bundler/getUserOperationByHash.js";
4
+ import { getUserOperationReceipt } from "../../actions/bundler/getUserOperationReceipt.js";
5
+ import { sendUserOperation } from "../../actions/bundler/sendUserOperation.js";
6
+ import { supportedEntryPoints } from "../../actions/bundler/supportedEntryPoints.js";
7
+ const bundlerActions = (client) => ({
8
+ sendUserOperation: async (args) => sendUserOperation(client, args),
9
+ estimateUserOperationGas: (args) => estimateUserOperationGas(client, args),
10
+ supportedEntryPoints: () => supportedEntryPoints(client),
11
+ chainId: () => chainId(client),
12
+ getUserOperationByHash: (args) => getUserOperationByHash(client, args),
13
+ getUserOperationReceipt: (args) => getUserOperationReceipt(client, args)
14
+ });
15
+ export { bundlerActions };
16
+ //# sourceMappingURL=bundler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundler.js","sourceRoot":"","sources":["../../../clients/decorators/bundler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAA;AAC1D,OAAO,EAGH,wBAAwB,EAC3B,MAAM,mDAAmD,CAAA;AAC1D,OAAO,EAGH,sBAAsB,EACzB,MAAM,iDAAiD,CAAA;AACxD,OAAO,EAGH,uBAAuB,EAC1B,MAAM,kDAAkD,CAAA;AACzD,OAAO,EAAoC,iBAAiB,EAAE,MAAM,4CAA4C,CAAA;AAChH,OAAO,EAAE,oBAAoB,EAAE,MAAM,+CAA+C,CAAA;AAiJpF,MAAM,cAAc,GAAG,CAAC,MAAc,EAAkB,EAAE,CAAC,CAAC;IACxD,iBAAiB,EAAE,KAAK,EAAE,IAAiC,EAAiB,EAAE,CAC1E,iBAAiB,CAAC,MAAuB,EAAE,IAAI,CAAC;IACpD,wBAAwB,EAAE,CAAC,IAAwC,EAAE,EAAE,CACnE,wBAAwB,CAAC,MAAuB,EAAE,IAAI,CAAC;IAC3D,oBAAoB,EAAE,GAAuB,EAAE,CAAC,oBAAoB,CAAC,MAAuB,CAAC;IAC7F,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,MAAuB,CAAC;IAC/C,sBAAsB,EAAE,CAAC,IAAsC,EAAE,EAAE,CAC/D,sBAAsB,CAAC,MAAuB,EAAE,IAAI,CAAC;IACzD,uBAAuB,EAAE,CAAC,IAAuC,EAAE,EAAE,CACjE,uBAAuB,CAAC,MAAuB,EAAE,IAAI,CAAC;CAC7D,CAAC,CAAA;AAEF,OAAO,EAAE,cAAc,EAAE,CAAA"}
@@ -0,0 +1,20 @@
1
+ import { getUserOperationGasPrice } from "../../actions/pimlico/getUserOperationGasPrice.js";
2
+ import { getUserOperationStatus } from "../../actions/pimlico/getUserOperationStatus.js";
3
+ import { sponsorUserOperation } from "../../actions/pimlico/sponsorUserOperation.js";
4
+ export const pimlicoBundlerActions = (client) => ({
5
+ getUserOperationGasPrice: async () => getUserOperationGasPrice(client),
6
+ getUserOperationStatus: async (args) => getUserOperationStatus(client, args)
7
+ });
8
+ export const pimlicoPaymasterActions = (client) => ({
9
+ sponsorUserOperation: async (args) => sponsorUserOperation(client, args)
10
+ });
11
+ /**
12
+ * TODO: Add support for pimlicoActions after we support all the actions of v1 in v2 of the Pimlico API.
13
+ */
14
+ // export const pimlicoActions = (client: Client) => {
15
+ // return {
16
+ // ...pimlicoBundlerActions(client),
17
+ // ...pimlicoPaymasterActions(client)
18
+ // }
19
+ // }
20
+ //# sourceMappingURL=pimlico.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pimlico.js","sourceRoot":"","sources":["../../../clients/decorators/pimlico.ts"],"names":[],"mappings":"AACA,OAAO,EAEH,wBAAwB,EAC3B,MAAM,mDAAmD,CAAA;AAC1D,OAAO,EAGH,sBAAsB,EACzB,MAAM,iDAAiD,CAAA;AACxD,OAAO,EAGH,oBAAoB,EACvB,MAAM,+CAA+C,CAAA;AA8CtD,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,MAAc,EAAyB,EAAE,CAAC,CAAC;IAC7E,wBAAwB,EAAE,KAAK,IAAI,EAAE,CAAC,wBAAwB,CAAC,MAA8B,CAAC;IAC9F,sBAAsB,EAAE,KAAK,EAAE,IAAsC,EAAE,EAAE,CACrE,sBAAsB,CAAC,MAA8B,EAAE,IAAI,CAAC;CACnE,CAAC,CAAA;AA6BF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,MAAc,EAAiC,EAAE,CAAC,CAAC;IACvF,oBAAoB,EAAE,KAAK,EAAE,IAAoC,EAAE,EAAE,CACjE,oBAAoB,CAAC,MAAgC,EAAE,IAAI,CAAC;CACnE,CAAC,CAAA;AAEF;;GAEG;AACH,sDAAsD;AACtD,eAAe;AACf,4CAA4C;AAC5C,6CAA6C;AAC7C,QAAQ;AACR,IAAI"}
@@ -0,0 +1,8 @@
1
+ import { accounts } from "../../actions/stackup/accounts.js";
2
+ import { sponsorUserOperation } from "../../actions/stackup/sponsorUserOperation.js";
3
+ import {} from "../stackup.js";
4
+ export const stackupPaymasterActions = (client) => ({
5
+ sponsorUserOperation: async (args) => sponsorUserOperation(client, args),
6
+ accounts: async (args) => accounts(client, args)
7
+ });
8
+ //# sourceMappingURL=stackup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stackup.js","sourceRoot":"","sources":["../../../clients/decorators/stackup.ts"],"names":[],"mappings":"AACA,OAAO,EAA2B,QAAQ,EAAE,MAAM,mCAAmC,CAAA;AACrF,OAAO,EAGH,oBAAoB,EACvB,MAAM,+CAA+C,CAAA;AACtD,OAAO,EAA+B,MAAM,eAAe,CAAA;AAqD3D,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,MAAc,EAAiC,EAAE,CAAC,CAAC;IACvF,oBAAoB,EAAE,KAAK,EAAE,IAAoC,EAAE,EAAE,CACjE,oBAAoB,CAAC,MAAgC,EAAE,IAAI,CAAC;IAChE,QAAQ,EAAE,KAAK,EAAE,IAAwB,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAgC,EAAE,IAAI,CAAC;CACjG,CAAC,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import { createClient } from "viem";
2
- import { bundlerActions } from "../actions";
3
- import { pimlicoBundlerActions, pimlicoPaymasterActions } from "../actions/pimlico";
2
+ import { bundlerActions } from "./decorators/bundler.js";
3
+ import { pimlicoBundlerActions, pimlicoPaymasterActions } from "./decorators/pimlico.js";
4
4
  /**
5
5
  * Creates a pimlico specific Bundler Client with a given [Transport](https://viem.sh/docs/clients/intro.html) configured for a [Chain](https://viem.sh/docs/clients/chains.html).
6
6
  *
@@ -1 +1 @@
1
- {"version":3,"file":"pimlico.js","sourceRoot":"","sources":["../../clients/pimlico.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAE3C,OAAO,EAGH,qBAAqB,EACrB,uBAAuB,EAC1B,MAAM,oBAAoB,CAAA;AAmB3B;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CACtC,UAAgD,EAC5B,EAAE;IACtB,MAAM,EAAE,GAAG,GAAG,QAAQ,EAAE,IAAI,GAAG,wBAAwB,EAAE,GAAG,UAAU,CAAA;IACtE,MAAM,MAAM,GAAG,YAAY,CAAC;QACxB,GAAG,UAAU;QACb,GAAG;QACH,IAAI;QACJ,IAAI,EAAE,sBAAsB;KAC/B,CAAC,CAAA;IACF,OAAO,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAA;AACtE,CAAC,CAAA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CACxC,UAAgD,EAC1B,EAAE;IACxB,MAAM,EAAE,GAAG,GAAG,QAAQ,EAAE,IAAI,GAAG,0BAA0B,EAAE,GAAG,UAAU,CAAA;IACxE,MAAM,MAAM,GAAG,YAAY,CAAC;QACxB,GAAG,UAAU;QACb,GAAG;QACH,IAAI;QACJ,IAAI,EAAE,wBAAwB;KACjC,CAAC,CAAA;IACF,OAAO,MAAM,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAA;AACjD,CAAC,CAAA"}
1
+ {"version":3,"file":"pimlico.js","sourceRoot":"","sources":["../../clients/pimlico.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAEnC,OAAO,EAAuB,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAC7E,OAAO,EAGH,qBAAqB,EACrB,uBAAuB,EAC1B,MAAM,yBAAyB,CAAA;AAkBhC;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CACtC,UAAgD,EAC5B,EAAE;IACtB,MAAM,EAAE,GAAG,GAAG,QAAQ,EAAE,IAAI,GAAG,wBAAwB,EAAE,GAAG,UAAU,CAAA;IACtE,MAAM,MAAM,GAAG,YAAY,CAAC;QACxB,GAAG,UAAU;QACb,GAAG;QACH,IAAI;QACJ,IAAI,EAAE,sBAAsB;KAC/B,CAAC,CAAA;IACF,OAAO,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAA;AACtE,CAAC,CAAA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CACxC,UAAgD,EAC1B,EAAE;IACxB,MAAM,EAAE,GAAG,GAAG,QAAQ,EAAE,IAAI,GAAG,0BAA0B,EAAE,GAAG,UAAU,CAAA;IACxE,MAAM,MAAM,GAAG,YAAY,CAAC;QACxB,GAAG,UAAU;QACb,GAAG;QACH,IAAI;QACJ,IAAI,EAAE,wBAAwB;KACjC,CAAC,CAAA;IACF,OAAO,MAAM,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAA;AACjD,CAAC,CAAA"}
@@ -0,0 +1,33 @@
1
+ import { createClient } from "viem";
2
+ import { bundlerActions } from "./decorators/bundler.js";
3
+ import { stackupPaymasterActions } from "./decorators/stackup.js";
4
+ /**
5
+ * Creates a Stackup specific Paymaster Client with a given [Transport](https://viem.sh/docs/clients/intro.html) configured for a [Chain](https://viem.sh/docs/clients/chains.html).
6
+ *
7
+ * - Docs: https://docs.pimlico.io/permissionless/reference/clients/stackupPaymasterClient
8
+ *
9
+ * A Stackup Paymaster Client is an interface to "stackup paymaster endpoints" [JSON-RPC API](https://docs.stackup.sh/docs/paymaster-api-rpc-methods) methods such as sponsoring user operation, etc through Stackup Paymaster Actions.
10
+ *
11
+ * @param config - {@link PublicClientConfig}
12
+ * @returns A Stackup Paymaster Client. {@link StackupPaymasterClient}
13
+ *
14
+ * @example
15
+ * import { createPublicClient, http } from 'viem'
16
+ * import { mainnet } from 'viem/chains'
17
+ *
18
+ * const stackupPaymasterClient = createStackupPaymasterClient({
19
+ * chain: mainnet,
20
+ * transport: http("https://api.stackup.sh/v1/paymaster/YOUR_API_KEY_HERE"),
21
+ * })
22
+ */
23
+ export const createStackupPaymasterClient = (parameters) => {
24
+ const { key = "public", name = "Stackup Paymaster Client" } = parameters;
25
+ const client = createClient({
26
+ ...parameters,
27
+ key,
28
+ name,
29
+ type: "stackupPaymasterClient"
30
+ });
31
+ return client.extend(bundlerActions).extend(stackupPaymasterActions);
32
+ };
33
+ //# sourceMappingURL=stackup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stackup.js","sourceRoot":"","sources":["../../clients/stackup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkF,YAAY,EAAE,MAAM,MAAM,CAAA;AAEnH,OAAO,EAAuB,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAC7E,OAAO,EAAsC,uBAAuB,EAAE,MAAM,yBAAyB,CAAA;AAUrG;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CACxC,UAAgD,EAC1B,EAAE;IACxB,MAAM,EAAE,GAAG,GAAG,QAAQ,EAAE,IAAI,GAAG,0BAA0B,EAAE,GAAG,UAAU,CAAA;IACxE,MAAM,MAAM,GAAG,YAAY,CAAC;QACxB,GAAG,UAAU;QACb,GAAG;QACH,IAAI;QACJ,IAAI,EAAE,wBAAwB;KACjC,CAAC,CAAA;IACF,OAAO,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAA;AACxE,CAAC,CAAA"}
package/_esm/index.js CHANGED
@@ -1,5 +1,16 @@
1
- export * from "./actions";
2
- export * from "./clients";
3
- export * from "./types";
4
- export * from "./utils";
1
+ import { getSenderAddress } from "./actions/public/getSenderAddress.js";
2
+ import { chainId } from "./actions/bundler/chainId.js";
3
+ import { estimateUserOperationGas } from "./actions/bundler/estimateUserOperationGas.js";
4
+ import { getUserOperationByHash } from "./actions/bundler/getUserOperationByHash.js";
5
+ import { getUserOperationReceipt } from "./actions/bundler/getUserOperationReceipt.js";
6
+ import { sendUserOperation } from "./actions/bundler/sendUserOperation.js";
7
+ import { supportedEntryPoints } from "./actions/bundler/supportedEntryPoints.js";
8
+ import { getAccountNonce } from "./actions/public/getAccountNonce.js";
9
+ import { createBundlerClient } from "./clients/bundler.js";
10
+ import { bundlerActions } from "./clients/decorators/bundler.js";
11
+ export { sendUserOperation, estimateUserOperationGas, supportedEntryPoints, chainId, getUserOperationByHash, getUserOperationReceipt, getSenderAddress, getAccountNonce, createBundlerClient, bundlerActions };
12
+ export {};
13
+ import { getUserOperationHash } from "./utils/getUserOperationHash.js";
14
+ export { getUserOperationHash };
15
+ export * from "./utils/index.js";
5
16
  //# sourceMappingURL=index.js.map
package/_esm/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAA;AAEvE,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AACtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+CAA+C,CAAA;AACxF,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAA;AACpF,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAA;AACtF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAA;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAA;AAEhF,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAA;AACrE,OAAO,EAAsB,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAE9E,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAgBhE,OAAO,EACH,iBAAiB,EACjB,wBAAwB,EACxB,oBAAoB,EACpB,OAAO,EACP,sBAAsB,EACtB,uBAAuB,EACvB,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,cAAc,EACjB,CAAA;AAGD,OAAO,EAAsB,CAAA;AAG7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAA;AAEtE,OAAO,EAAE,oBAAoB,EAAmC,CAAA;AAChE,cAAc,kBAAkB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=stackup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stackup.js","sourceRoot":"","sources":["../../types/stackup.ts"],"names":[],"mappings":""}
@@ -0,0 +1,55 @@
1
+ import { encodeAbiParameters, keccak256 } from "viem";
2
+ function packUserOp({ userOperation }) {
3
+ const hashedInitCode = keccak256(userOperation.initCode);
4
+ const hashedCallData = keccak256(userOperation.callData);
5
+ const hashedPaymasterAndData = keccak256(userOperation.paymasterAndData);
6
+ return encodeAbiParameters([
7
+ { type: "address" },
8
+ { type: "uint256" },
9
+ { type: "bytes32" },
10
+ { type: "bytes32" },
11
+ { type: "uint256" },
12
+ { type: "uint256" },
13
+ { type: "uint256" },
14
+ { type: "uint256" },
15
+ { type: "uint256" },
16
+ { type: "bytes32" }
17
+ ], [
18
+ userOperation.sender,
19
+ userOperation.nonce,
20
+ hashedInitCode,
21
+ hashedCallData,
22
+ userOperation.callGasLimit,
23
+ userOperation.verificationGasLimit,
24
+ userOperation.preVerificationGas,
25
+ userOperation.maxFeePerGas,
26
+ userOperation.maxPriorityFeePerGas,
27
+ hashedPaymasterAndData
28
+ ]);
29
+ }
30
+ /**
31
+ *
32
+ * Returns user operation hash that is a unique identifier of the user operation.
33
+ *
34
+ * - Docs: https://docs.pimlico.io/permissionless/reference/utils/getUserOperationHash
35
+ *
36
+ * @param args: userOperation, entryPoint, chainId as {@link GetUserOperationHashParams}
37
+ * @returns userOperationHash as {@link Hash}
38
+ *
39
+ * @example
40
+ * import { getUserOperationHash } from "permissionless/utils"
41
+ *
42
+ * const userOperationHash = getUserOperationHash({
43
+ * userOperation,
44
+ * entryPoint,
45
+ * chainId
46
+ * })
47
+ *
48
+ * // Returns "0xe9fad2cd67f9ca1d0b7a6513b2a42066784c8df938518da2b51bb8cc9a89ea34"
49
+ *
50
+ */
51
+ export const getUserOperationHash = ({ userOperation, entryPoint, chainId }) => {
52
+ const encoded = encodeAbiParameters([{ type: "bytes32" }, { type: "address" }, { type: "uint256" }], [keccak256(packUserOp({ userOperation })), entryPoint, BigInt(chainId)]);
53
+ return keccak256(encoded);
54
+ };
55
+ //# sourceMappingURL=getUserOperationHash.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getUserOperationHash.js","sourceRoot":"","sources":["../../utils/getUserOperationHash.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,MAAM,CAAA;AAGrD,SAAS,UAAU,CAAC,EAAE,aAAa,EAAoC;IACnE,MAAM,cAAc,GAAG,SAAS,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAA;IACxD,MAAM,cAAc,GAAG,SAAS,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAA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