permissionless 0.0.6 → 0.0.8

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 (235) hide show
  1. package/CHANGELOG.md +13 -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/bundler/waitForUserOperationReceipt.js +46 -0
  15. package/_cjs/actions/bundler/waitForUserOperationReceipt.js.map +1 -0
  16. package/_cjs/actions/index.js +22 -12
  17. package/_cjs/actions/index.js.map +1 -1
  18. package/_cjs/actions/pimlico/getUserOperationGasPrice.js +25 -0
  19. package/_cjs/actions/pimlico/getUserOperationGasPrice.js.map +1 -0
  20. package/_cjs/actions/pimlico/getUserOperationStatus.js +11 -0
  21. package/_cjs/actions/pimlico/getUserOperationStatus.js.map +1 -0
  22. package/_cjs/actions/pimlico/sponsorUserOperation.js +18 -0
  23. package/_cjs/actions/pimlico/sponsorUserOperation.js.map +1 -0
  24. package/_cjs/actions/pimlico.js +10 -52
  25. package/_cjs/actions/pimlico.js.map +1 -1
  26. package/_cjs/actions/public/getAccountNonce.js +35 -0
  27. package/_cjs/actions/public/getAccountNonce.js.map +1 -0
  28. package/_cjs/actions/{public.js → public/getSenderAddress.js} +2 -33
  29. package/_cjs/actions/public/getSenderAddress.js.map +1 -0
  30. package/_cjs/actions/stackup/accounts.js +12 -0
  31. package/_cjs/actions/stackup/accounts.js.map +1 -0
  32. package/_cjs/actions/stackup/sponsorUserOperation.js +18 -0
  33. package/_cjs/actions/stackup/sponsorUserOperation.js.map +1 -0
  34. package/_cjs/actions/stackup.js +10 -0
  35. package/_cjs/actions/stackup.js.map +1 -0
  36. package/_cjs/clients/bundler.js +2 -2
  37. package/_cjs/clients/bundler.js.map +1 -1
  38. package/_cjs/clients/decorators/bundler.js +21 -0
  39. package/_cjs/clients/decorators/bundler.js.map +1 -0
  40. package/_cjs/clients/decorators/pimlico.js +16 -0
  41. package/_cjs/clients/decorators/pimlico.js.map +1 -0
  42. package/_cjs/clients/decorators/stackup.js +11 -0
  43. package/_cjs/clients/decorators/stackup.js.map +1 -0
  44. package/_cjs/clients/pimlico.js +4 -4
  45. package/_cjs/clients/pimlico.js.map +1 -1
  46. package/_cjs/clients/stackup.js +18 -0
  47. package/_cjs/clients/stackup.js.map +1 -0
  48. package/_cjs/index.js +28 -4
  49. package/_cjs/index.js.map +1 -1
  50. package/_cjs/types/stackup.js +3 -0
  51. package/_cjs/types/stackup.js.map +1 -0
  52. package/_cjs/{actions/utils.js → utils/deepHexlify.js} +1 -1
  53. package/_cjs/utils/deepHexlify.js.map +1 -0
  54. package/_cjs/utils/getUserOperationHash.js +38 -0
  55. package/_cjs/utils/getUserOperationHash.js.map +1 -0
  56. package/_cjs/utils/index.js +2 -34
  57. package/_cjs/utils/index.js.map +1 -1
  58. package/_cjs/utils/observe.js +39 -0
  59. package/_cjs/utils/observe.js.map +1 -0
  60. package/_esm/actions/bundler/chainId.js +29 -0
  61. package/_esm/actions/bundler/chainId.js.map +1 -0
  62. package/_esm/actions/bundler/estimateUserOperationGas.js +41 -0
  63. package/_esm/actions/bundler/estimateUserOperationGas.js.map +1 -0
  64. package/_esm/actions/bundler/getUserOperationByHash.js +48 -0
  65. package/_esm/actions/bundler/getUserOperationByHash.js.map +1 -0
  66. package/_esm/actions/bundler/getUserOperationReceipt.js +66 -0
  67. package/_esm/actions/bundler/getUserOperationReceipt.js.map +1 -0
  68. package/_esm/actions/bundler/sendUserOperation.js +36 -0
  69. package/_esm/actions/bundler/sendUserOperation.js.map +1 -0
  70. package/_esm/actions/bundler/supportedEntryPoints.js +29 -0
  71. package/_esm/actions/bundler/supportedEntryPoints.js.map +1 -0
  72. package/_esm/actions/bundler/waitForUserOperationReceipt.js +63 -0
  73. package/_esm/actions/bundler/waitForUserOperationReceipt.js.map +1 -0
  74. package/_esm/actions/index.js +11 -3
  75. package/_esm/actions/index.js.map +1 -1
  76. package/_esm/actions/pimlico/getUserOperationGasPrice.js +42 -0
  77. package/_esm/actions/pimlico/getUserOperationGasPrice.js.map +1 -0
  78. package/_esm/actions/pimlico/getUserOperationStatus.js +29 -0
  79. package/_esm/actions/pimlico/getUserOperationStatus.js.map +1 -0
  80. package/_esm/actions/pimlico/sponsorUserOperation.js +39 -0
  81. package/_esm/actions/pimlico/sponsorUserOperation.js.map +1 -0
  82. package/_esm/actions/pimlico.js +5 -123
  83. package/_esm/actions/pimlico.js.map +1 -1
  84. package/_esm/actions/public/getAccountNonce.js +57 -0
  85. package/_esm/actions/public/getAccountNonce.js.map +1 -0
  86. package/_esm/actions/{public.js → public/getSenderAddress.js} +1 -57
  87. package/_esm/actions/public/getSenderAddress.js.map +1 -0
  88. package/_esm/actions/stackup/accounts.js +30 -0
  89. package/_esm/actions/stackup/accounts.js.map +1 -0
  90. package/_esm/actions/stackup/sponsorUserOperation.js +40 -0
  91. package/_esm/actions/stackup/sponsorUserOperation.js.map +1 -0
  92. package/_esm/actions/stackup.js +5 -0
  93. package/_esm/actions/stackup.js.map +1 -0
  94. package/_esm/clients/bundler.js +1 -1
  95. package/_esm/clients/bundler.js.map +1 -1
  96. package/_esm/clients/decorators/bundler.js +18 -0
  97. package/_esm/clients/decorators/bundler.js.map +1 -0
  98. package/_esm/clients/decorators/pimlico.js +20 -0
  99. package/_esm/clients/decorators/pimlico.js.map +1 -0
  100. package/_esm/clients/decorators/stackup.js +8 -0
  101. package/_esm/clients/decorators/stackup.js.map +1 -0
  102. package/_esm/clients/pimlico.js +2 -2
  103. package/_esm/clients/pimlico.js.map +1 -1
  104. package/_esm/clients/stackup.js +33 -0
  105. package/_esm/clients/stackup.js.map +1 -0
  106. package/_esm/index.js +17 -4
  107. package/_esm/index.js.map +1 -1
  108. package/_esm/types/stackup.js +2 -0
  109. package/_esm/types/stackup.js.map +1 -0
  110. package/_esm/{actions/utils.js → utils/deepHexlify.js} +1 -1
  111. package/_esm/utils/deepHexlify.js.map +1 -0
  112. package/_esm/utils/getUserOperationHash.js +55 -0
  113. package/_esm/utils/getUserOperationHash.js.map +1 -0
  114. package/_esm/utils/index.js +1 -54
  115. package/_esm/utils/index.js.map +1 -1
  116. package/_esm/utils/observe.js +42 -0
  117. package/_esm/utils/observe.js.map +1 -0
  118. package/_types/actions/bundler/chainId.d.ts +25 -0
  119. package/_types/actions/bundler/chainId.d.ts.map +1 -0
  120. package/_types/actions/bundler/estimateUserOperationGas.d.ts +42 -0
  121. package/_types/actions/bundler/estimateUserOperationGas.d.ts.map +1 -0
  122. package/_types/actions/bundler/getUserOperationByHash.d.ts +37 -0
  123. package/_types/actions/bundler/getUserOperationByHash.d.ts.map +1 -0
  124. package/_types/actions/bundler/getUserOperationReceipt.d.ts +62 -0
  125. package/_types/actions/bundler/getUserOperationReceipt.d.ts.map +1 -0
  126. package/_types/actions/bundler/sendUserOperation.d.ts +36 -0
  127. package/_types/actions/bundler/sendUserOperation.d.ts.map +1 -0
  128. package/_types/actions/bundler/supportedEntryPoints.d.ts +26 -0
  129. package/_types/actions/bundler/supportedEntryPoints.d.ts.map +1 -0
  130. package/_types/actions/bundler/waitForUserOperationReceipt.d.ts +43 -0
  131. package/_types/actions/bundler/waitForUserOperationReceipt.d.ts.map +1 -0
  132. package/_types/actions/index.d.ts +19 -6
  133. package/_types/actions/index.d.ts.map +1 -1
  134. package/_types/actions/pimlico/getUserOperationGasPrice.d.ts +38 -0
  135. package/_types/actions/pimlico/getUserOperationGasPrice.d.ts.map +1 -0
  136. package/_types/actions/pimlico/getUserOperationStatus.d.ts +31 -0
  137. package/_types/actions/pimlico/getUserOperationStatus.d.ts.map +1 -0
  138. package/_types/actions/pimlico/sponsorUserOperation.d.ts +41 -0
  139. package/_types/actions/pimlico/sponsorUserOperation.d.ts.map +1 -0
  140. package/_types/actions/pimlico.d.ts +7 -177
  141. package/_types/actions/pimlico.d.ts.map +1 -1
  142. package/_types/actions/public/getAccountNonce.d.ts +34 -0
  143. package/_types/actions/public/getAccountNonce.d.ts.map +1 -0
  144. package/_types/actions/{public.d.ts → public/getSenderAddress.d.ts} +2 -35
  145. package/_types/actions/public/getSenderAddress.d.ts.map +1 -0
  146. package/_types/actions/stackup/accounts.d.ts +29 -0
  147. package/_types/actions/stackup/accounts.d.ts.map +1 -0
  148. package/_types/actions/stackup/sponsorUserOperation.d.ts +43 -0
  149. package/_types/actions/stackup/sponsorUserOperation.d.ts.map +1 -0
  150. package/_types/actions/stackup.d.ts +7 -0
  151. package/_types/actions/stackup.d.ts.map +1 -0
  152. package/_types/clients/bundler.d.ts +3 -3
  153. package/_types/clients/bundler.d.ts.map +1 -1
  154. package/_types/clients/decorators/bundler.d.ts +173 -0
  155. package/_types/clients/decorators/bundler.d.ts.map +1 -0
  156. package/_types/clients/decorators/pimlico.d.ts +78 -0
  157. package/_types/clients/decorators/pimlico.d.ts.map +1 -0
  158. package/_types/clients/decorators/stackup.d.ts +54 -0
  159. package/_types/clients/decorators/stackup.d.ts.map +1 -0
  160. package/_types/clients/pimlico.d.ts +3 -3
  161. package/_types/clients/pimlico.d.ts.map +1 -1
  162. package/_types/clients/stackup.d.ts +39 -0
  163. package/_types/clients/stackup.d.ts.map +1 -0
  164. package/_types/index.d.ts +28 -4
  165. package/_types/index.d.ts.map +1 -1
  166. package/_types/types/bundler.d.ts +1 -1
  167. package/_types/types/bundler.d.ts.map +1 -1
  168. package/_types/types/index.d.ts +1 -1
  169. package/_types/types/index.d.ts.map +1 -1
  170. package/_types/types/pimlico.d.ts +1 -1
  171. package/_types/types/pimlico.d.ts.map +1 -1
  172. package/_types/types/stackup.d.ts +35 -0
  173. package/_types/types/stackup.d.ts.map +1 -0
  174. package/_types/{actions/utils.d.ts → utils/deepHexlify.d.ts} +1 -1
  175. package/_types/utils/deepHexlify.d.ts.map +1 -0
  176. package/_types/utils/getUserOperationHash.d.ts +30 -0
  177. package/_types/utils/getUserOperationHash.d.ts.map +1 -0
  178. package/_types/utils/index.d.ts +2 -30
  179. package/_types/utils/index.d.ts.map +1 -1
  180. package/_types/utils/observe.d.ts +17 -0
  181. package/_types/utils/observe.d.ts.map +1 -0
  182. package/actions/bundler/chainId.ts +32 -0
  183. package/actions/bundler/estimateUserOperationGas.ts +62 -0
  184. package/actions/bundler/getUserOperationByHash.ts +69 -0
  185. package/actions/bundler/getUserOperationReceipt.ts +112 -0
  186. package/actions/bundler/sendUserOperation.ts +45 -0
  187. package/actions/bundler/supportedEntryPoints.ts +31 -0
  188. package/actions/bundler/waitForUserOperationReceipt.ts +80 -0
  189. package/actions/index.ts +30 -21
  190. package/actions/pimlico/getUserOperationGasPrice.ts +61 -0
  191. package/actions/pimlico/getUserOperationStatus.ts +41 -0
  192. package/actions/pimlico/sponsorUserOperation.ts +62 -0
  193. package/actions/pimlico.ts +34 -251
  194. package/actions/public/getAccountNonce.ts +63 -0
  195. package/actions/{public.ts → public/getSenderAddress.ts} +7 -68
  196. package/actions/stackup/accounts.ts +40 -0
  197. package/actions/stackup/sponsorUserOperation.ts +64 -0
  198. package/actions/stackup.ts +17 -0
  199. package/clients/bundler.ts +9 -4
  200. package/clients/decorators/bundler.ts +211 -0
  201. package/clients/decorators/pimlico.ts +107 -0
  202. package/clients/decorators/stackup.ts +65 -0
  203. package/clients/pimlico.ts +3 -4
  204. package/clients/stackup.ts +44 -0
  205. package/index.ts +70 -4
  206. package/package.json +11 -1
  207. package/tsconfig.build.tsbuildinfo +1 -1
  208. package/types/bundler.ts +1 -1
  209. package/types/index.ts +1 -1
  210. package/types/pimlico.ts +1 -1
  211. package/types/stackup.ts +36 -0
  212. package/utils/getUserOperationHash.ts +68 -0
  213. package/utils/index.ts +2 -69
  214. package/utils/observe.ts +61 -0
  215. package/_cjs/actions/bundler.js +0 -118
  216. package/_cjs/actions/bundler.js.map +0 -1
  217. package/_cjs/actions/public.js.map +0 -1
  218. package/_cjs/actions/utils.js.map +0 -1
  219. package/_cjs/clients/index.js +0 -6
  220. package/_cjs/clients/index.js.map +0 -1
  221. package/_esm/actions/bundler.js +0 -251
  222. package/_esm/actions/bundler.js.map +0 -1
  223. package/_esm/actions/public.js.map +0 -1
  224. package/_esm/actions/utils.js.map +0 -1
  225. package/_esm/clients/index.js +0 -3
  226. package/_esm/clients/index.js.map +0 -1
  227. package/_types/actions/bundler.d.ts +0 -393
  228. package/_types/actions/bundler.d.ts.map +0 -1
  229. package/_types/actions/public.d.ts.map +0 -1
  230. package/_types/actions/utils.d.ts.map +0 -1
  231. package/_types/clients/index.d.ts +0 -3
  232. package/_types/clients/index.d.ts.map +0 -1
  233. package/actions/bundler.ts +0 -498
  234. package/clients/index.ts +0 -3
  235. /package/{actions/utils.ts → utils/deepHexlify.ts} +0 -0
@@ -0,0 +1,63 @@
1
+ import { BaseError, stringify } from "viem";
2
+ import {} from "../../clients/bundler";
3
+ import { observe } from "../../utils/observe";
4
+ import { getUserOperationReceipt } from "./getUserOperationReceipt";
5
+ export class WaitForUserOperationReceiptTimeoutError extends BaseError {
6
+ constructor({ hash }) {
7
+ super(`Timed out while waiting for transaction with hash "${hash}" to be confirmed.`);
8
+ Object.defineProperty(this, "name", {
9
+ enumerable: true,
10
+ configurable: true,
11
+ writable: true,
12
+ value: "WaitForUserOperationReceiptTimeoutError"
13
+ });
14
+ }
15
+ }
16
+ /**
17
+ * Waits for the User Operation to be included on a [Block](https://viem.sh/docs/glossary/terms.html#block) (one confirmation), and then returns the [User Operation Receipt](https://docs.pimlico.io/permissionless/reference/bundler-actions/getUserOperationReceipt).
18
+ *
19
+ * - Docs: https://docs.pimlico.io/permissionless/reference/bundler-actions/waitForUserOperationReceipt
20
+ *
21
+ * @param client - Bundler Client to use
22
+ * @param parameters - {@link WaitForUserOperationReceiptParameters}
23
+ * @returns The transaction receipt. {@link GetUserOperationReceiptReturnType}
24
+ *
25
+ * @example
26
+ * import { createBundlerClient, waitForUserOperationReceipt, http } from 'viem'
27
+ * import { mainnet } from 'viem/chains'
28
+ *
29
+ * const client = createBundlerClient({
30
+ * chain: mainnet,
31
+ * transport: http(),
32
+ * })
33
+ * const userOperationReceipt = await waitForUserOperationReceipt(client, {
34
+ * hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d',
35
+ * })
36
+ */
37
+ export const waitForUserOperationReceipt = (bundlerClient, { hash, pollingInterval = bundlerClient.pollingInterval, timeout }) => {
38
+ const observerId = stringify(["waitForUserOperationReceipt", bundlerClient.uid, hash]);
39
+ let userOperationReceipt;
40
+ return new Promise((resolve, reject) => {
41
+ if (timeout) {
42
+ setTimeout(() => reject(new WaitForUserOperationReceiptTimeoutError({ hash })), timeout);
43
+ }
44
+ const _unobserve = observe(observerId, { resolve, reject }, async (emit) => {
45
+ const _removeInterval = setInterval(async () => {
46
+ const done = (fn) => {
47
+ clearInterval(_removeInterval);
48
+ fn();
49
+ _unobserve();
50
+ };
51
+ const _userOperationReceipt = await getUserOperationReceipt(bundlerClient, { hash });
52
+ if (_userOperationReceipt !== null) {
53
+ userOperationReceipt = _userOperationReceipt;
54
+ }
55
+ if (userOperationReceipt) {
56
+ done(() => emit.resolve(userOperationReceipt));
57
+ return;
58
+ }
59
+ }, pollingInterval);
60
+ });
61
+ });
62
+ };
63
+ //# sourceMappingURL=waitForUserOperationReceipt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"waitForUserOperationReceipt.js","sourceRoot":"","sources":["../../../actions/b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oBACJ,UAAU,EAAE,CAAA;gBAChB,CAAC,CAAA;gBAED,MAAM,qBAAqB,GAAG,MAAM,uBAAuB,CAAC,aAAa,EAAE,EAAE,IAAI,EAAE,CAAC,CAAA;gBAEpF,IAAI,qBAAqB,KAAK,IAAI,EAAE;oBAChC,oBAAoB,GAAG,qBAAqB,CAAA;iBAC/C;gBAED,IAAI,oBAAoB,EAAE;oBACtB,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAA;oBAC9C,OAAM;iBACT;YACL,CAAC,EAAE,eAAe,CAAC,CAAA;QACvB,CAAC,CAAC,CAAA;IACN,CAAC,CAAC,CAAA;AACN,CAAC,CAAA"}
@@ -1,4 +1,12 @@
1
- import { bundlerActions, chainId, estimateUserOperationGas, getUserOperationByHash, getUserOperationReceipt, sendUserOperation, supportedEntryPoints } from "./bundler";
2
- import { getAccountNonce, getSenderAddress } from "./public";
3
- export { bundlerActions, sendUserOperation, estimateUserOperationGas, supportedEntryPoints, chainId, getUserOperationByHash, getUserOperationReceipt, getSenderAddress, getAccountNonce };
1
+ import { InvalidEntryPointError, getSenderAddress } from "./public/getSenderAddress.js";
2
+ import { chainId } from "./bundler/chainId.js";
3
+ import { estimateUserOperationGas } from "./bundler/estimateUserOperationGas.js";
4
+ import { getUserOperationByHash } from "./bundler/getUserOperationByHash.js";
5
+ import { getUserOperationReceipt } from "./bundler/getUserOperationReceipt.js";
6
+ import { sendUserOperation } from "./bundler/sendUserOperation.js";
7
+ import { supportedEntryPoints } from "./bundler/supportedEntryPoints.js";
8
+ import { waitForUserOperationReceipt } from "./bundler/waitForUserOperationReceipt.js";
9
+ import { WaitForUserOperationReceiptTimeoutError } from "./bundler/waitForUserOperationReceipt.js";
10
+ import { getAccountNonce } from "./public/getAccountNonce.js";
11
+ export { sendUserOperation, estimateUserOperationGas, supportedEntryPoints, chainId, getUserOperationByHash, getUserOperationReceipt, getSenderAddress, getAccountNonce, InvalidEntryPointError, waitForUserOperationReceipt, WaitForUserOperationReceiptTimeoutError };
4
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../actions/index.ts"],"names":[],"mappings":"AAUA,OAAO,EACH,cAAc,EACd,OAAO,EACP,wBAAwB,EACxB,sBAAsB,EACtB,uBAAuB,EACvB,iBAAiB,EACjB,oBAAoB,EACvB,MAAM,WAAW,CAAA;AAIlB,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAa5D,OAAO,EACH,cAAc,EACd,iBAAiB,EACjB,wBAAwB,EACxB,oBAAoB,EACpB,OAAO,EACP,sBAAsB,EACtB,uBAAuB,EACvB,gBAAgB,EAChB,eAAe,EAClB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../actions/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAEvF,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAA;AAChF,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAA;AAC5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAA;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAA;AACxE,OAAO,EAAE,2BAA2B,EAAE,MAAM,0CAA0C,CAAA;AACtF,OAAO,EAEH,uCAAuC,EAC1C,MAAM,0CAA0C,CAAA;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAe7D,OAAO,EACH,iBAAiB,EACjB,wBAAwB,EACxB,oBAAoB,EACpB,OAAO,EACP,sBAAsB,EACtB,uBAAuB,EACvB,gBAAgB,EAChB,eAAe,EACf,sBAAsB,EACtB,2BAA2B,EAC3B,uCAAuC,EAC1C,CAAA"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Returns the live gas prices that you can use to send a user operation.
3
+ *
4
+ * - Docs: https://docs.pimlico.io/permissionless/reference/pimlico-bundler-actions/getUserOperationGasPrice
5
+ *
6
+ * @param client {@link PimlicoBundlerClient} that you created using viem's createClient whose transport url is pointing to the Pimlico's bundler.
7
+ * @returns slow, standard & fast values for maxFeePerGas & maxPriorityFeePerGas
8
+ *
9
+ *
10
+ * @example
11
+ * import { createClient } from "viem"
12
+ * import { getUserOperationGasPrice } from "permissionless/actions/pimlico"
13
+ *
14
+ * const bundlerClient = createClient({
15
+ * chain: goerli,
16
+ * transport: http("https://api.pimlico.io/v1/goerli/rpc?apikey=YOUR_API_KEY_HERE")
17
+ * })
18
+ *
19
+ * await getUserOperationGasPrice(bundlerClient)
20
+ *
21
+ */
22
+ export const getUserOperationGasPrice = async (client) => {
23
+ const gasPrices = await client.request({
24
+ method: "pimlico_getUserOperationGasPrice",
25
+ params: []
26
+ });
27
+ return {
28
+ slow: {
29
+ maxFeePerGas: BigInt(gasPrices.slow.maxFeePerGas),
30
+ maxPriorityFeePerGas: BigInt(gasPrices.slow.maxPriorityFeePerGas)
31
+ },
32
+ standard: {
33
+ maxFeePerGas: BigInt(gasPrices.standard.maxFeePerGas),
34
+ maxPriorityFeePerGas: BigInt(gasPrices.standard.maxPriorityFeePerGas)
35
+ },
36
+ fast: {
37
+ maxFeePerGas: BigInt(gasPrices.fast.maxFeePerGas),
38
+ maxPriorityFeePerGas: BigInt(gasPrices.fast.maxPriorityFeePerGas)
39
+ }
40
+ };
41
+ };
42
+ //# sourceMappingURL=getUserOperationGasPrice.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getUserOperationGasPrice.js","sourceRoot":"","sources":["../../../actions/pimlico/getUserOperationGasPrice.ts"],"names":[],"mappings":"AAiBA;;;;;;;;;;;;;;;;;;;;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,CAAC,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC;YACjD,oBAAoB,EAAE,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,oBAAoB,CAAC;SACpE;KACJ,CAAA;AACL,CAAC,CAAA"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Returns the status of the userOperation that is pending in the mempool.
3
+ *
4
+ * - Docs: https://docs.pimlico.io/permissionless/reference/pimlico-bundler-actions/getUserOperationStatus
5
+ *
6
+ * @param client {@link PimlicoBundlerClient} that you created using viem's createClient whose transport url is pointing to the Pimlico's bundler.
7
+ * @param hash {@link Hash} UserOpHash that you must have received from sendUserOperation.
8
+ * @returns status & transaction hash if included {@link GetUserOperationStatusReturnType}
9
+ *
10
+ *
11
+ * @example
12
+ * import { createClient } from "viem"
13
+ * import { getUserOperationStatus } from "permissionless/actions/pimlico"
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 getUserOperationStatus(bundlerClient, { hash: userOpHash })
21
+ *
22
+ */
23
+ export const getUserOperationStatus = async (client, { hash }) => {
24
+ return client.request({
25
+ method: "pimlico_getUserOperationStatus",
26
+ params: [hash]
27
+ });
28
+ };
29
+ //# sourceMappingURL=getUserOperationStatus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getUserOperationStatus.js","sourceRoot":"","sources":["../../../actions/pimlico/getUserOperationStatus.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,EACvC,MAA4B,EAC5B,EAAE,IAAI,EAAoC,EACD,EAAE;IAC3C,OAAO,MAAM,CAAC,OAAO,CAAC;QAClB,MAAM,EAAE,gCAAgC;QACxC,MAAM,EAAE,CAAC,IAAI,CAAC;KACjB,CAAC,CAAA;AACN,CAAC,CAAA"}
@@ -0,0 +1,39 @@
1
+ import { deepHexlify } from "../../utils/deepHexlify.js";
2
+ /**
3
+ * Returns paymasterAndData & updated gas parameters required to sponsor a userOperation.
4
+ *
5
+ * - Docs: https://docs.pimlico.io/permissionless/reference/pimlico-paymaster-actions/sponsorUserOperation
6
+ *
7
+ * @param client {@link PimlicoBundlerClient} that you created using viem's createClient whose transport url is pointing to the Pimlico's bundler.
8
+ * @param args {@link sponsorUserOperationParameters} UserOperation you want to sponsor & entryPoint.
9
+ * @returns paymasterAndData & updated gas parameters, see {@link SponsorUserOperationReturnType}
10
+ *
11
+ *
12
+ * @example
13
+ * import { createClient } from "viem"
14
+ * import { sponsorUserOperation } from "permissionless/actions/pimlico"
15
+ *
16
+ * const bundlerClient = createClient({
17
+ * chain: goerli,
18
+ * transport: http("https://api.pimlico.io/v2/goerli/rpc?apikey=YOUR_API_KEY_HERE")
19
+ * })
20
+ *
21
+ * await sponsorUserOperation(bundlerClient, {
22
+ * userOperation: userOperationWithDummySignature,
23
+ * entryPoint: entryPoint
24
+ * }})
25
+ *
26
+ */
27
+ export const sponsorUserOperation = async (client, args) => {
28
+ const response = await client.request({
29
+ method: "pm_sponsorUserOperation",
30
+ params: [deepHexlify(args.userOperation), args.entryPoint]
31
+ });
32
+ return {
33
+ paymasterAndData: response.paymasterAndData,
34
+ preVerificationGas: BigInt(response.preVerificationGas),
35
+ verificationGasLimit: BigInt(response.verificationGasLimit),
36
+ callGasLimit: BigInt(response.callGasLimit)
37
+ };
38
+ };
39
+ //# sourceMappingURL=sponsorUserOperation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sponsorUserOperation.js","sourceRoot":"","sources":["../../../actions/pimlico/sponsorUserOperation.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAiBxD;;;;;;;;;;;;;;;;;;;;;;;;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,CAAC;KAC7F,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"}
@@ -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,CAAC,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC;YACjD,oBAAoB,EAAE,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,oBAAoB,CAAC;SACpE;KACJ,CAAA;AACL,CAAC,CAAA;AAED;;;;;;;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BAAoB,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,iGAAiG,EACjG;YACI,KAAK;SACR,CACJ,CAAA;QAVI;;;;mBAAO,wBAAwB;WAAA;IAWxC,CAAC;CACJ;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,MAAM,gB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,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/deepHexlify.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,4BAA4B,CAAA;AAkBxD;;;;;;;;;;;;;;;;;;;;;;;;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;AAS7E;;;;;;;;;;;;;;;;;;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,18 @@
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
+ import { waitForUserOperationReceipt } from "../../actions/bundler/waitForUserOperationReceipt.js";
8
+ const bundlerActions = (client) => ({
9
+ sendUserOperation: async (args) => sendUserOperation(client, args),
10
+ estimateUserOperationGas: (args) => estimateUserOperationGas(client, args),
11
+ supportedEntryPoints: () => supportedEntryPoints(client),
12
+ chainId: () => chainId(client),
13
+ getUserOperationByHash: (args) => getUserOperationByHash(client, args),
14
+ getUserOperationReceipt: (args) => getUserOperationReceipt(client, args),
15
+ waitForUserOperationReceipt: (args) => waitForUserOperationReceipt(client, args)
16
+ });
17
+ export { bundlerActions };
18
+ //# 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;AACpF,OAAO,EAEH,2BAA2B,EAC9B,MAAM,sDAAsD,CAAA;AA4K7D,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;IAC1D,2BAA2B,EAAE,CAAC,IAA2C,EAAE,EAAE,CACzE,2BAA2B,CAAC,MAAuB,EAAE,IAAI,CAAC;CACjE,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