permissionless 0.3.5 → 0.3.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 (286) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/_cjs/accounts/biconomy/index.js +8 -0
  3. package/_cjs/accounts/biconomy/index.js.map +1 -0
  4. package/_cjs/accounts/biconomy/toBiconomySmartAccount.js +9 -5
  5. package/_cjs/accounts/biconomy/toBiconomySmartAccount.js.map +1 -1
  6. package/_cjs/accounts/etherspot/index.js +8 -0
  7. package/_cjs/accounts/etherspot/index.js.map +1 -0
  8. package/_cjs/accounts/kernel/index.js +18 -0
  9. package/_cjs/accounts/kernel/index.js.map +1 -0
  10. package/_cjs/accounts/kernel/toKernelSmartAccount.js +10 -6
  11. package/_cjs/accounts/kernel/toKernelSmartAccount.js.map +1 -1
  12. package/_cjs/accounts/kernel/utils/signMessage.js +9 -7
  13. package/_cjs/accounts/kernel/utils/signMessage.js.map +1 -1
  14. package/_cjs/accounts/kernel/utils/signTypedData.js +7 -6
  15. package/_cjs/accounts/kernel/utils/signTypedData.js.map +1 -1
  16. package/_cjs/accounts/kernel/utils/wrapMessageHash.js +3 -3
  17. package/_cjs/accounts/kernel/utils/wrapMessageHash.js.map +1 -1
  18. package/_cjs/accounts/light/index.js +8 -0
  19. package/_cjs/accounts/light/index.js.map +1 -0
  20. package/_cjs/accounts/light/toLightSmartAccount.js +9 -5
  21. package/_cjs/accounts/light/toLightSmartAccount.js.map +1 -1
  22. package/_cjs/accounts/nexus/index.js +8 -0
  23. package/_cjs/accounts/nexus/index.js.map +1 -0
  24. package/_cjs/accounts/safe/signUserOperation.js +3 -0
  25. package/_cjs/accounts/safe/signUserOperation.js.map +1 -1
  26. package/_cjs/accounts/safe/toSafeSmartAccount.js +4 -3
  27. package/_cjs/accounts/safe/toSafeSmartAccount.js.map +1 -1
  28. package/_cjs/accounts/simple/index.js +10 -0
  29. package/_cjs/accounts/simple/index.js.map +1 -0
  30. package/_cjs/accounts/simple/toSimpleSmartAccount.js +15 -10
  31. package/_cjs/accounts/simple/toSimpleSmartAccount.js.map +1 -1
  32. package/_cjs/accounts/thirdweb/index.js +8 -0
  33. package/_cjs/accounts/thirdweb/index.js.map +1 -0
  34. package/_cjs/accounts/thirdweb/utils/decodeCallData.js +7 -5
  35. package/_cjs/accounts/thirdweb/utils/decodeCallData.js.map +1 -1
  36. package/_cjs/accounts/trust/index.js +8 -0
  37. package/_cjs/accounts/trust/index.js.map +1 -0
  38. package/_cjs/accounts/trust/utils/decodeCallData.js +7 -5
  39. package/_cjs/accounts/trust/utils/decodeCallData.js.map +1 -1
  40. package/_cjs/actions/{erc7579.js → erc7579/index.js} +9 -9
  41. package/_cjs/actions/erc7579/index.js.map +1 -0
  42. package/_cjs/actions/{etherspot.js → etherspot/index.js} +2 -2
  43. package/_cjs/actions/etherspot/index.js.map +1 -0
  44. package/_cjs/actions/{passkeyServer.js → passkeyServer/index.js} +4 -4
  45. package/_cjs/actions/passkeyServer/index.js.map +1 -0
  46. package/_cjs/actions/pimlico/estimateErc20PaymasterCost.js +7 -3
  47. package/_cjs/actions/pimlico/estimateErc20PaymasterCost.js.map +1 -1
  48. package/_cjs/actions/{pimlico.js → pimlico/index.js} +8 -8
  49. package/_cjs/actions/pimlico/index.js.map +1 -0
  50. package/_cjs/actions/{smartAccount.js → smartAccount/index.js} +5 -5
  51. package/_cjs/actions/smartAccount/index.js.map +1 -0
  52. package/_cjs/clients/createSmartAccountClient.js.map +1 -1
  53. package/_cjs/clients/decorators/pimlico.js +4 -4
  54. package/_cjs/clients/decorators/pimlico.js.map +1 -1
  55. package/_cjs/clients/{passkeyServer.js → passkeyServer/index.js} +2 -2
  56. package/_cjs/clients/passkeyServer/index.js.map +1 -0
  57. package/_cjs/clients/{pimlico.js → pimlico/index.js} +2 -2
  58. package/_cjs/clients/pimlico/index.js.map +1 -0
  59. package/_cjs/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.js +6 -5
  60. package/_cjs/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.js.map +1 -1
  61. package/_esm/accounts/biconomy/index.js +5 -0
  62. package/_esm/accounts/biconomy/index.js.map +1 -0
  63. package/_esm/accounts/biconomy/toBiconomySmartAccount.js +9 -5
  64. package/_esm/accounts/biconomy/toBiconomySmartAccount.js.map +1 -1
  65. package/_esm/accounts/etherspot/index.js +5 -0
  66. package/_esm/accounts/etherspot/index.js.map +1 -0
  67. package/_esm/accounts/kernel/index.js +15 -0
  68. package/_esm/accounts/kernel/index.js.map +1 -0
  69. package/_esm/accounts/kernel/toKernelSmartAccount.js +10 -6
  70. package/_esm/accounts/kernel/toKernelSmartAccount.js.map +1 -1
  71. package/_esm/accounts/kernel/utils/signMessage.js +9 -7
  72. package/_esm/accounts/kernel/utils/signMessage.js.map +1 -1
  73. package/_esm/accounts/kernel/utils/signTypedData.js +7 -6
  74. package/_esm/accounts/kernel/utils/signTypedData.js.map +1 -1
  75. package/_esm/accounts/kernel/utils/wrapMessageHash.js +3 -3
  76. package/_esm/accounts/kernel/utils/wrapMessageHash.js.map +1 -1
  77. package/_esm/accounts/light/index.js +5 -0
  78. package/_esm/accounts/light/index.js.map +1 -0
  79. package/_esm/accounts/light/toLightSmartAccount.js +9 -5
  80. package/_esm/accounts/light/toLightSmartAccount.js.map +1 -1
  81. package/_esm/accounts/nexus/index.js +5 -0
  82. package/_esm/accounts/nexus/index.js.map +1 -0
  83. package/_esm/accounts/safe/signUserOperation.js +3 -0
  84. package/_esm/accounts/safe/signUserOperation.js.map +1 -1
  85. package/_esm/accounts/safe/toSafeSmartAccount.js +4 -3
  86. package/_esm/accounts/safe/toSafeSmartAccount.js.map +1 -1
  87. package/_esm/accounts/simple/index.js +7 -0
  88. package/_esm/accounts/simple/index.js.map +1 -0
  89. package/_esm/accounts/simple/toSimpleSmartAccount.js +15 -10
  90. package/_esm/accounts/simple/toSimpleSmartAccount.js.map +1 -1
  91. package/_esm/accounts/thirdweb/index.js +5 -0
  92. package/_esm/accounts/thirdweb/index.js.map +1 -0
  93. package/_esm/accounts/thirdweb/utils/decodeCallData.js +7 -5
  94. package/_esm/accounts/thirdweb/utils/decodeCallData.js.map +1 -1
  95. package/_esm/accounts/trust/index.js +5 -0
  96. package/_esm/accounts/trust/index.js.map +1 -0
  97. package/_esm/accounts/trust/utils/decodeCallData.js +7 -5
  98. package/_esm/accounts/trust/utils/decodeCallData.js.map +1 -1
  99. package/_esm/actions/{erc7579.js → erc7579/index.js} +9 -9
  100. package/_esm/actions/erc7579/index.js.map +1 -0
  101. package/_esm/actions/etherspot/index.js +2 -0
  102. package/_esm/actions/etherspot/index.js.map +1 -0
  103. package/_esm/actions/passkeyServer/index.js +4 -0
  104. package/_esm/actions/passkeyServer/index.js.map +1 -0
  105. package/_esm/actions/pimlico/estimateErc20PaymasterCost.js +7 -3
  106. package/_esm/actions/pimlico/estimateErc20PaymasterCost.js.map +1 -1
  107. package/_esm/actions/pimlico/index.js +8 -0
  108. package/_esm/actions/pimlico/index.js.map +1 -0
  109. package/_esm/actions/smartAccount/index.js +5 -0
  110. package/_esm/actions/smartAccount/index.js.map +1 -0
  111. package/_esm/clients/createSmartAccountClient.js.map +1 -1
  112. package/_esm/clients/decorators/pimlico.js +1 -1
  113. package/_esm/clients/decorators/pimlico.js.map +1 -1
  114. package/_esm/clients/{passkeyServer.js → passkeyServer/index.js} +2 -2
  115. package/_esm/clients/passkeyServer/index.js.map +1 -0
  116. package/_esm/clients/{pimlico.js → pimlico/index.js} +2 -2
  117. package/_esm/clients/pimlico/index.js.map +1 -0
  118. package/_esm/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.js +5 -4
  119. package/_esm/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.js.map +1 -1
  120. package/_types/accounts/biconomy/index.d.ts +6 -0
  121. package/_types/accounts/biconomy/index.d.ts.map +1 -0
  122. package/_types/accounts/biconomy/toBiconomySmartAccount.d.ts.map +1 -1
  123. package/_types/accounts/etherspot/index.d.ts +6 -0
  124. package/_types/accounts/etherspot/index.d.ts.map +1 -0
  125. package/_types/accounts/kernel/index.d.ts +22 -0
  126. package/_types/accounts/kernel/index.d.ts.map +1 -0
  127. package/_types/accounts/kernel/toKernelSmartAccount.d.ts.map +1 -1
  128. package/_types/accounts/kernel/utils/signMessage.d.ts +4 -5
  129. package/_types/accounts/kernel/utils/signMessage.d.ts.map +1 -1
  130. package/_types/accounts/kernel/utils/signTypedData.d.ts +4 -4
  131. package/_types/accounts/kernel/utils/signTypedData.d.ts.map +1 -1
  132. package/_types/accounts/kernel/utils/wrapMessageHash.d.ts +8 -3
  133. package/_types/accounts/kernel/utils/wrapMessageHash.d.ts.map +1 -1
  134. package/_types/accounts/light/index.d.ts +6 -0
  135. package/_types/accounts/light/index.d.ts.map +1 -0
  136. package/_types/accounts/light/toLightSmartAccount.d.ts.map +1 -1
  137. package/_types/accounts/nexus/index.d.ts +6 -0
  138. package/_types/accounts/nexus/index.d.ts.map +1 -0
  139. package/_types/accounts/safe/signUserOperation.d.ts.map +1 -1
  140. package/_types/accounts/safe/toSafeSmartAccount.d.ts.map +1 -1
  141. package/_types/accounts/simple/index.d.ts +9 -0
  142. package/_types/accounts/simple/index.d.ts.map +1 -0
  143. package/_types/accounts/simple/toSimpleSmartAccount.d.ts.map +1 -1
  144. package/_types/accounts/thirdweb/index.d.ts +6 -0
  145. package/_types/accounts/thirdweb/index.d.ts.map +1 -0
  146. package/_types/accounts/thirdweb/utils/decodeCallData.d.ts.map +1 -1
  147. package/_types/accounts/trust/index.d.ts +6 -0
  148. package/_types/accounts/trust/index.d.ts.map +1 -0
  149. package/_types/accounts/trust/utils/decodeCallData.d.ts.map +1 -1
  150. package/_types/actions/{erc7579.d.ts → erc7579/index.d.ts} +11 -11
  151. package/_types/actions/erc7579/index.d.ts.map +1 -0
  152. package/_types/actions/etherspot/index.d.ts +2 -0
  153. package/_types/actions/etherspot/index.d.ts.map +1 -0
  154. package/_types/actions/passkeyServer/index.d.ts +4 -0
  155. package/_types/actions/passkeyServer/index.d.ts.map +1 -0
  156. package/_types/actions/pimlico/estimateErc20PaymasterCost.d.ts.map +1 -1
  157. package/_types/actions/pimlico/index.d.ts +8 -0
  158. package/_types/actions/pimlico/index.d.ts.map +1 -0
  159. package/_types/actions/smartAccount/index.d.ts +5 -0
  160. package/_types/actions/smartAccount/index.d.ts.map +1 -0
  161. package/_types/clients/createSmartAccountClient.d.ts +9 -1
  162. package/_types/clients/createSmartAccountClient.d.ts.map +1 -1
  163. package/_types/clients/decorators/pimlico.d.ts +1 -1
  164. package/_types/clients/decorators/pimlico.d.ts.map +1 -1
  165. package/_types/clients/{passkeyServer.d.ts → passkeyServer/index.d.ts} +8 -4
  166. package/_types/clients/passkeyServer/index.d.ts.map +1 -0
  167. package/_types/clients/pimlico/index.d.ts +21 -0
  168. package/_types/clients/pimlico/index.d.ts.map +1 -0
  169. package/_types/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.d.ts.map +1 -1
  170. package/accounts/biconomy/index.ts +11 -0
  171. package/accounts/biconomy/package.json +6 -0
  172. package/accounts/biconomy/toBiconomySmartAccount.ts +13 -5
  173. package/accounts/etherspot/index.ts +11 -0
  174. package/accounts/etherspot/package.json +6 -0
  175. package/accounts/kernel/index.ts +33 -0
  176. package/accounts/kernel/package.json +6 -0
  177. package/accounts/kernel/toKernelSmartAccount.ts +13 -6
  178. package/accounts/kernel/utils/signMessage.ts +19 -15
  179. package/accounts/kernel/utils/signTypedData.ts +14 -11
  180. package/accounts/kernel/utils/wrapMessageHash.ts +11 -8
  181. package/accounts/light/index.ts +12 -0
  182. package/accounts/light/package.json +6 -0
  183. package/accounts/light/toLightSmartAccount.ts +13 -5
  184. package/accounts/nexus/index.ts +11 -0
  185. package/accounts/nexus/package.json +6 -0
  186. package/accounts/package.json +6 -0
  187. package/accounts/safe/package.json +6 -0
  188. package/accounts/safe/signUserOperation.ts +4 -0
  189. package/accounts/safe/toSafeSmartAccount.ts +5 -3
  190. package/accounts/simple/index.ts +18 -0
  191. package/accounts/simple/package.json +6 -0
  192. package/accounts/simple/toSimpleSmartAccount.ts +21 -10
  193. package/accounts/thirdweb/index.ts +11 -0
  194. package/accounts/thirdweb/package.json +6 -0
  195. package/accounts/thirdweb/utils/decodeCallData.ts +9 -5
  196. package/accounts/trust/index.ts +11 -0
  197. package/accounts/trust/package.json +6 -0
  198. package/accounts/trust/utils/decodeCallData.ts +9 -5
  199. package/actions/{erc7579.ts → erc7579/index.ts} +10 -16
  200. package/actions/erc7579/package.json +6 -0
  201. package/actions/{etherspot.ts → etherspot/index.ts} +1 -1
  202. package/actions/etherspot/package.json +6 -0
  203. package/actions/{passkeyServer.ts → passkeyServer/index.ts} +3 -3
  204. package/actions/passkeyServer/package.json +6 -0
  205. package/actions/pimlico/estimateErc20PaymasterCost.ts +9 -3
  206. package/actions/{pimlico.ts → pimlico/index.ts} +7 -7
  207. package/actions/pimlico/package.json +6 -0
  208. package/actions/smartAccount/index.ts +7 -0
  209. package/actions/smartAccount/package.json +6 -0
  210. package/clients/createSmartAccountClient.ts +45 -20
  211. package/clients/decorators/pimlico.ts +10 -10
  212. package/clients/package.json +6 -0
  213. package/clients/{passkeyServer.ts → passkeyServer/index.ts} +15 -13
  214. package/clients/passkeyServer/package.json +6 -0
  215. package/clients/{pimlico.ts → pimlico/index.ts} +50 -23
  216. package/clients/pimlico/package.json +6 -0
  217. package/errors/package.json +6 -0
  218. package/experimental/pimlico/package.json +6 -0
  219. package/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.ts +6 -4
  220. package/package.json +74 -29
  221. package/utils/package.json +6 -0
  222. package/_cjs/actions/erc7579.js.map +0 -1
  223. package/_cjs/actions/etherspot.js.map +0 -1
  224. package/_cjs/actions/passkeyServer.js.map +0 -1
  225. package/_cjs/actions/pimlico.js.map +0 -1
  226. package/_cjs/actions/smartAccount.js.map +0 -1
  227. package/_cjs/clients/passkeyServer.js.map +0 -1
  228. package/_cjs/clients/pimlico.js.map +0 -1
  229. package/_esm/actions/erc7579.js.map +0 -1
  230. package/_esm/actions/etherspot.js +0 -2
  231. package/_esm/actions/etherspot.js.map +0 -1
  232. package/_esm/actions/passkeyServer.js +0 -4
  233. package/_esm/actions/passkeyServer.js.map +0 -1
  234. package/_esm/actions/pimlico.js +0 -8
  235. package/_esm/actions/pimlico.js.map +0 -1
  236. package/_esm/actions/smartAccount.js +0 -5
  237. package/_esm/actions/smartAccount.js.map +0 -1
  238. package/_esm/clients/passkeyServer.js.map +0 -1
  239. package/_esm/clients/pimlico.js.map +0 -1
  240. package/_types/actions/erc7579.d.ts.map +0 -1
  241. package/_types/actions/etherspot.d.ts +0 -2
  242. package/_types/actions/etherspot.d.ts.map +0 -1
  243. package/_types/actions/passkeyServer.d.ts +0 -4
  244. package/_types/actions/passkeyServer.d.ts.map +0 -1
  245. package/_types/actions/pimlico.d.ts +0 -8
  246. package/_types/actions/pimlico.d.ts.map +0 -1
  247. package/_types/actions/smartAccount.d.ts +0 -5
  248. package/_types/actions/smartAccount.d.ts.map +0 -1
  249. package/_types/clients/passkeyServer.d.ts.map +0 -1
  250. package/_types/clients/pimlico.d.ts +0 -13
  251. package/_types/clients/pimlico.d.ts.map +0 -1
  252. package/accounts/decodeCalls.test.ts +0 -505
  253. package/accounts/safe/signUserOperation.test.ts +0 -275
  254. package/actions/erc7579/accountId.test.ts +0 -39
  255. package/actions/erc7579/installModule.test.ts +0 -216
  256. package/actions/erc7579/installModules.test.ts +0 -237
  257. package/actions/erc7579/isModuleInstalled.test.ts +0 -72
  258. package/actions/erc7579/supportsExecutionMode.test.ts +0 -108
  259. package/actions/erc7579/supportsModule.test.ts +0 -35
  260. package/actions/erc7579/uninstallModule.test.ts +0 -129
  261. package/actions/erc7579/uninstallModules.test.ts +0 -117
  262. package/actions/pimlico/getTokenQuotes.test.ts +0 -90
  263. package/actions/pimlico/getUserOperationGasPrice.test.ts +0 -82
  264. package/actions/pimlico/getUserOperationStatus.test.ts +0 -199
  265. package/actions/pimlico/sponsorUserOperation.test.ts +0 -236
  266. package/actions/pimlico/validateSponsorshipPolicies.test.ts +0 -153
  267. package/actions/public/getAccountNonce.test.ts +0 -96
  268. package/actions/public/getSenderAddress.test.ts +0 -154
  269. package/actions/smartAccount/getCallsStatus.test.ts +0 -255
  270. package/actions/smartAccount/sendCalls.test.ts +0 -571
  271. package/actions/smartAccount/sendTransaction.test.ts +0 -416
  272. package/actions/smartAccount/signMessage.test.ts +0 -219
  273. package/actions/smartAccount/signTypedData.test.ts +0 -228
  274. package/actions/smartAccount.ts +0 -7
  275. package/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.test.ts +0 -523
  276. package/types/package.json +0 -6
  277. package/utils/decodeNonce.test.ts +0 -40
  278. package/utils/deepHexlify.test.ts +0 -57
  279. package/utils/encode7579Calls.test.ts +0 -69
  280. package/utils/encodeNonce.test.ts +0 -38
  281. package/utils/erc20AllowanceOverride.test.ts +0 -59
  282. package/utils/erc20BalanceOverride.test.ts +0 -57
  283. package/utils/getAddressFromInitCodeOrPaymasterAndData.test.ts +0 -31
  284. package/utils/getPackedUserOperation.test.ts +0 -204
  285. package/utils/getRequiredPrefund.test.ts +0 -90
  286. package/vitest.config.ts +0 -31
@@ -1,117 +0,0 @@
1
- import { encodeAbiParameters, encodePacked, isHash, zeroAddress } from "viem"
2
- import { describe, expect } from "vitest"
3
- import { testWithRpc } from "../../../permissionless-test/src/testWithRpc"
4
- import { getCoreSmartAccounts } from "../../../permissionless-test/src/utils"
5
- import { erc7579Actions } from "../erc7579"
6
- import { uninstallModules } from "./uninstallModules"
7
-
8
- describe.each(getCoreSmartAccounts())(
9
- "uninstallModules $name",
10
- ({ getErc7579SmartAccountClient, name }) => {
11
- testWithRpc.skipIf(!getErc7579SmartAccountClient)(
12
- "uninstallModules",
13
- async ({ rpc }) => {
14
- if (!getErc7579SmartAccountClient) {
15
- throw new Error("getErc7579SmartAccountClient not defined")
16
- }
17
-
18
- const smartClientWithoutExtend =
19
- await getErc7579SmartAccountClient({
20
- entryPoint: {
21
- version: "0.7"
22
- },
23
- ...rpc
24
- })
25
-
26
- const smartClient = smartClientWithoutExtend.extend(
27
- erc7579Actions()
28
- )
29
-
30
- const moduleData = encodePacked(
31
- ["address"],
32
- [smartClient.account.address]
33
- )
34
-
35
- const opHash = await smartClient.installModule({
36
- type: "executor",
37
- address: "0x4Fd8d57b94966982B62e9588C27B4171B55E8354",
38
- context: name.startsWith("Kernel 7579")
39
- ? encodePacked(
40
- ["address", "bytes"],
41
- [
42
- zeroAddress,
43
- encodeAbiParameters(
44
- [{ type: "bytes" }, { type: "bytes" }],
45
- [moduleData, "0x"]
46
- )
47
- ]
48
- )
49
- : moduleData
50
- })
51
-
52
- await smartClient.waitForUserOperationReceipt({
53
- hash: opHash,
54
- timeout: 100000
55
- })
56
-
57
- const uninstallModulesUserOpHash = await uninstallModules(
58
- smartClient,
59
- {
60
- account: smartClient.account,
61
- modules: [
62
- {
63
- type: "executor",
64
- address:
65
- "0x4Fd8d57b94966982B62e9588C27B4171B55E8354",
66
- context: name.startsWith("Kernel 7579")
67
- ? "0x"
68
- : encodeAbiParameters(
69
- [
70
- {
71
- name: "prev",
72
- type: "address"
73
- },
74
- {
75
- name: "moduleInitData",
76
- type: "bytes"
77
- }
78
- ],
79
- [
80
- "0x0000000000000000000000000000000000000001",
81
- "0x"
82
- ]
83
- )
84
- }
85
- ]
86
- }
87
- )
88
-
89
- expect(isHash(uninstallModulesUserOpHash)).toBe(true)
90
-
91
- const userOperationReceiptUninstallModules =
92
- await smartClient.waitForUserOperationReceipt({
93
- hash: uninstallModulesUserOpHash,
94
- timeout: 100000
95
- })
96
- expect(userOperationReceiptUninstallModules).not.toBeNull()
97
- expect(userOperationReceiptUninstallModules?.userOpHash).toBe(
98
- uninstallModulesUserOpHash
99
- )
100
- expect(
101
- userOperationReceiptUninstallModules?.receipt
102
- .transactionHash
103
- ).toBeTruthy()
104
-
105
- const receiptUninstallModules =
106
- await smartClient.getUserOperationReceipt({
107
- hash: uninstallModulesUserOpHash
108
- })
109
-
110
- expect(receiptUninstallModules?.receipt.transactionHash).toBe(
111
- userOperationReceiptUninstallModules?.receipt
112
- .transactionHash
113
- )
114
- }
115
- )
116
- }
117
- )
@@ -1,90 +0,0 @@
1
- import { getAddress, isAddress } from "viem"
2
- import { entryPoint07Address } from "viem/account-abstraction"
3
- import { foundry } from "viem/chains"
4
- import { describe, expect } from "vitest"
5
- import { testWithRpc } from "../../../permissionless-test/src/testWithRpc"
6
- import { getPimlicoClient } from "../../../permissionless-test/src/utils"
7
- import { getTokenQuotes } from "./getTokenQuotes"
8
-
9
- describe("getTokenQuotes", () => {
10
- testWithRpc("getTokenQuotes v0.6", async ({ rpc }) => {
11
- const pimlicoBundlerClient = getPimlicoClient({
12
- entryPointVersion: "0.6",
13
- altoRpc: rpc.paymasterRpc
14
- })
15
-
16
- const token = getAddress("0xffffffffffffffffffffffffffffffffffffffff")
17
-
18
- const quotes = await getTokenQuotes(pimlicoBundlerClient, {
19
- tokens: [token],
20
- entryPointAddress: entryPoint07Address,
21
- chain: foundry
22
- })
23
-
24
- expect(quotes).toBeTruthy()
25
- expect(Array.isArray(quotes)).toBe(true)
26
- expect(quotes[0].token).toBeTruthy()
27
- expect(isAddress(quotes[0].token))
28
- expect(quotes[0].token).toEqual(token)
29
- expect(quotes[0].paymaster).toBeTruthy()
30
- expect(isAddress(quotes[0].paymaster))
31
- expect(quotes[0].exchangeRate).toBeTruthy()
32
- expect(quotes[0].exchangeRate).toBeGreaterThan(0n)
33
- expect(quotes[0].postOpGas).toBeTruthy()
34
- expect(quotes[0].postOpGas).toBeGreaterThan(0n)
35
- })
36
-
37
- testWithRpc("getTokenQuotes v0.7", async ({ rpc }) => {
38
- const pimlicoBundlerClient = getPimlicoClient({
39
- entryPointVersion: "0.7",
40
- altoRpc: rpc.paymasterRpc
41
- })
42
-
43
- const token = getAddress("0xffffffffffffffffffffffffffffffffffffffff")
44
-
45
- const quotes = await getTokenQuotes(pimlicoBundlerClient, {
46
- tokens: [token],
47
- entryPointAddress: entryPoint07Address,
48
- chain: foundry
49
- })
50
-
51
- expect(quotes).toBeTruthy()
52
- expect(Array.isArray(quotes)).toBe(true)
53
- expect(quotes[0].token).toBeTruthy()
54
- expect(isAddress(quotes[0].token))
55
- expect(quotes[0].token).toEqual(token)
56
- expect(quotes[0].paymaster).toBeTruthy()
57
- expect(isAddress(quotes[0].paymaster))
58
- expect(quotes[0].exchangeRate).toBeTruthy()
59
- expect(quotes[0].exchangeRate).toBeGreaterThan(0n)
60
- expect(quotes[0].postOpGas).toBeTruthy()
61
- expect(quotes[0].postOpGas).toBeGreaterThan(0n)
62
- })
63
-
64
- testWithRpc("getTokenQuotes v0.8", async ({ rpc }) => {
65
- const pimlicoBundlerClient = getPimlicoClient({
66
- entryPointVersion: "0.8",
67
- altoRpc: rpc.paymasterRpc
68
- })
69
-
70
- const token = getAddress("0xffffffffffffffffffffffffffffffffffffffff")
71
-
72
- const quotes = await getTokenQuotes(pimlicoBundlerClient, {
73
- tokens: [token],
74
- entryPointAddress: entryPoint07Address,
75
- chain: foundry
76
- })
77
-
78
- expect(quotes).toBeTruthy()
79
- expect(Array.isArray(quotes)).toBe(true)
80
- expect(quotes[0].token).toBeTruthy()
81
- expect(isAddress(quotes[0].token))
82
- expect(quotes[0].token).toEqual(token)
83
- expect(quotes[0].paymaster).toBeTruthy()
84
- expect(isAddress(quotes[0].paymaster))
85
- expect(quotes[0].exchangeRate).toBeTruthy()
86
- expect(quotes[0].exchangeRate).toBeGreaterThan(0n)
87
- expect(quotes[0].postOpGas).toBeTruthy()
88
- expect(quotes[0].postOpGas).toBeGreaterThan(0n)
89
- })
90
- })
@@ -1,82 +0,0 @@
1
- import { describe, expect } from "vitest"
2
- import { testWithRpc } from "../../../permissionless-test/src/testWithRpc"
3
- import { getPimlicoClient } from "../../../permissionless-test/src/utils"
4
- import { getUserOperationGasPrice } from "./getUserOperationGasPrice"
5
-
6
- describe("getUserOperationGasPrice", () => {
7
- testWithRpc("getUserOperationGasPrice", async ({ rpc }) => {
8
- const pimlicoBundlerClient = getPimlicoClient({
9
- entryPointVersion: "0.6",
10
- altoRpc: rpc.altoRpc
11
- })
12
-
13
- const gasPrice = await getUserOperationGasPrice(pimlicoBundlerClient)
14
-
15
- expect(gasPrice).toBeTruthy()
16
- expect(gasPrice.slow).toBeTruthy()
17
- expect(gasPrice.standard).toBeTruthy()
18
- expect(gasPrice.fast).toBeTruthy()
19
- expect(typeof gasPrice.slow.maxFeePerGas).toBe("bigint")
20
- expect(gasPrice.slow.maxFeePerGas).toBeGreaterThan(0n)
21
- expect(typeof gasPrice.slow.maxPriorityFeePerGas).toBe("bigint")
22
- expect(gasPrice.slow.maxPriorityFeePerGas).toBeGreaterThan(0n)
23
- expect(typeof gasPrice.standard.maxFeePerGas).toBe("bigint")
24
- expect(gasPrice.standard.maxFeePerGas).toBeGreaterThan(0n)
25
- expect(typeof gasPrice.standard.maxPriorityFeePerGas).toBe("bigint")
26
- expect(gasPrice.standard.maxPriorityFeePerGas).toBeGreaterThan(0n)
27
- expect(typeof gasPrice.fast.maxFeePerGas).toBe("bigint")
28
- expect(gasPrice.fast.maxFeePerGas).toBeGreaterThan(0n)
29
- expect(typeof gasPrice.fast.maxPriorityFeePerGas).toBe("bigint")
30
- expect(gasPrice.fast.maxPriorityFeePerGas).toBeGreaterThan(0n)
31
- })
32
- testWithRpc("getUserOperationGasPrice", async ({ rpc }) => {
33
- const pimlicoBundlerClient = getPimlicoClient({
34
- entryPointVersion: "0.7",
35
- altoRpc: rpc.altoRpc
36
- })
37
-
38
- const gasPrice = await getUserOperationGasPrice(pimlicoBundlerClient)
39
-
40
- expect(gasPrice).toBeTruthy()
41
- expect(gasPrice.slow).toBeTruthy()
42
- expect(gasPrice.standard).toBeTruthy()
43
- expect(gasPrice.fast).toBeTruthy()
44
- expect(typeof gasPrice.slow.maxFeePerGas).toBe("bigint")
45
- expect(gasPrice.slow.maxFeePerGas).toBeGreaterThan(0n)
46
- expect(typeof gasPrice.slow.maxPriorityFeePerGas).toBe("bigint")
47
- expect(gasPrice.slow.maxPriorityFeePerGas).toBeGreaterThan(0n)
48
- expect(typeof gasPrice.standard.maxFeePerGas).toBe("bigint")
49
- expect(gasPrice.standard.maxFeePerGas).toBeGreaterThan(0n)
50
- expect(typeof gasPrice.standard.maxPriorityFeePerGas).toBe("bigint")
51
- expect(gasPrice.standard.maxPriorityFeePerGas).toBeGreaterThan(0n)
52
- expect(typeof gasPrice.fast.maxFeePerGas).toBe("bigint")
53
- expect(gasPrice.fast.maxFeePerGas).toBeGreaterThan(0n)
54
- expect(typeof gasPrice.fast.maxPriorityFeePerGas).toBe("bigint")
55
- expect(gasPrice.fast.maxPriorityFeePerGas).toBeGreaterThan(0n)
56
- })
57
- testWithRpc("getUserOperationGasPrice", async ({ rpc }) => {
58
- const pimlicoBundlerClient = getPimlicoClient({
59
- entryPointVersion: "0.8",
60
- altoRpc: rpc.altoRpc
61
- })
62
-
63
- const gasPrice = await getUserOperationGasPrice(pimlicoBundlerClient)
64
-
65
- expect(gasPrice).toBeTruthy()
66
- expect(gasPrice.slow).toBeTruthy()
67
- expect(gasPrice.standard).toBeTruthy()
68
- expect(gasPrice.fast).toBeTruthy()
69
- expect(typeof gasPrice.slow.maxFeePerGas).toBe("bigint")
70
- expect(gasPrice.slow.maxFeePerGas).toBeGreaterThan(0n)
71
- expect(typeof gasPrice.slow.maxPriorityFeePerGas).toBe("bigint")
72
- expect(gasPrice.slow.maxPriorityFeePerGas).toBeGreaterThan(0n)
73
- expect(typeof gasPrice.standard.maxFeePerGas).toBe("bigint")
74
- expect(gasPrice.standard.maxFeePerGas).toBeGreaterThan(0n)
75
- expect(typeof gasPrice.standard.maxPriorityFeePerGas).toBe("bigint")
76
- expect(gasPrice.standard.maxPriorityFeePerGas).toBeGreaterThan(0n)
77
- expect(typeof gasPrice.fast.maxFeePerGas).toBe("bigint")
78
- expect(gasPrice.fast.maxFeePerGas).toBeGreaterThan(0n)
79
- expect(typeof gasPrice.fast.maxPriorityFeePerGas).toBe("bigint")
80
- expect(gasPrice.fast.maxPriorityFeePerGas).toBeGreaterThan(0n)
81
- })
82
- })
@@ -1,199 +0,0 @@
1
- import { isHash, zeroAddress } from "viem"
2
- import { describe, expect } from "vitest"
3
- import { testWithRpc } from "../../../permissionless-test/src/testWithRpc"
4
- import {
5
- getBundlerClient,
6
- getPimlicoClient,
7
- getSimpleAccountClient
8
- } from "../../../permissionless-test/src/utils"
9
- import { getUserOperationStatus } from "./getUserOperationStatus"
10
-
11
- describe("getUserOperationStatus", () => {
12
- testWithRpc("getUserOperationStatus_V06", async ({ rpc }) => {
13
- const { altoRpc } = rpc
14
-
15
- const bundlerClient = getPimlicoClient({
16
- entryPointVersion: "0.6",
17
- altoRpc: altoRpc
18
- })
19
-
20
- const simpleAccountClient = getBundlerClient({
21
- account: await getSimpleAccountClient({
22
- ...rpc,
23
- entryPoint: {
24
- version: "0.6"
25
- }
26
- }),
27
- entryPoint: {
28
- version: "0.6"
29
- },
30
- ...rpc
31
- })
32
-
33
- const opHash = await simpleAccountClient.sendUserOperation({
34
- calls: [
35
- {
36
- to: zeroAddress,
37
- data: "0x",
38
- value: 0n
39
- }
40
- ]
41
- })
42
-
43
- expect(isHash(opHash)).toBe(true)
44
-
45
- const userOperationReceipt =
46
- await bundlerClient.waitForUserOperationReceipt({
47
- hash: opHash,
48
- timeout: 100000
49
- })
50
- expect(userOperationReceipt).not.toBeNull()
51
- expect(userOperationReceipt?.userOpHash).toBe(opHash)
52
- expect(userOperationReceipt?.receipt.transactionHash).toBeTruthy()
53
-
54
- const receipt = await bundlerClient.getUserOperationReceipt({
55
- hash: opHash
56
- })
57
-
58
- expect(receipt?.receipt.transactionHash).toBe(
59
- userOperationReceipt?.receipt.transactionHash
60
- )
61
- const userOperationStatus = await getUserOperationStatus(
62
- bundlerClient,
63
- {
64
- hash: opHash
65
- }
66
- )
67
- expect(userOperationStatus).not.toBeNull()
68
- expect(userOperationStatus).not.toBeUndefined()
69
- expect(userOperationStatus.status).toBe("included")
70
- expect(userOperationStatus.transactionHash).toBe(
71
- userOperationReceipt?.receipt.transactionHash
72
- )
73
- })
74
-
75
- testWithRpc("getUserOperationStatus_V07", async ({ rpc }) => {
76
- const { altoRpc } = rpc
77
-
78
- const bundlerClient = getPimlicoClient({
79
- entryPointVersion: "0.7",
80
- altoRpc: altoRpc
81
- })
82
-
83
- const simpleAccountClient = getBundlerClient({
84
- account: await getSimpleAccountClient({
85
- ...rpc,
86
- entryPoint: {
87
- version: "0.7"
88
- }
89
- }),
90
- entryPoint: {
91
- version: "0.7"
92
- },
93
- ...rpc
94
- })
95
-
96
- const opHash = await simpleAccountClient.sendUserOperation({
97
- calls: [
98
- {
99
- to: zeroAddress,
100
- data: "0x",
101
- value: 0n
102
- }
103
- ]
104
- })
105
-
106
- expect(isHash(opHash)).toBe(true)
107
-
108
- const userOperationReceipt =
109
- await bundlerClient.waitForUserOperationReceipt({
110
- hash: opHash,
111
- timeout: 100000
112
- })
113
- expect(userOperationReceipt).not.toBeNull()
114
- expect(userOperationReceipt?.userOpHash).toBe(opHash)
115
- expect(userOperationReceipt?.receipt.transactionHash).toBeTruthy()
116
-
117
- const receipt = await bundlerClient.getUserOperationReceipt({
118
- hash: opHash
119
- })
120
-
121
- expect(receipt?.receipt.transactionHash).toBe(
122
- userOperationReceipt?.receipt.transactionHash
123
- )
124
- const userOperationStatus = await getUserOperationStatus(
125
- bundlerClient,
126
- {
127
- hash: opHash
128
- }
129
- )
130
- expect(userOperationStatus).not.toBeNull()
131
- expect(userOperationStatus).not.toBeUndefined()
132
- expect(userOperationStatus.status).toBe("included")
133
- expect(userOperationStatus.transactionHash).toBe(
134
- userOperationReceipt?.receipt.transactionHash
135
- )
136
- })
137
- testWithRpc("getUserOperationStatus_V07", async ({ rpc }) => {
138
- const { altoRpc } = rpc
139
-
140
- const bundlerClient = getPimlicoClient({
141
- entryPointVersion: "0.8",
142
- altoRpc: altoRpc
143
- })
144
-
145
- const simpleAccountClient = getBundlerClient({
146
- account: await getSimpleAccountClient({
147
- ...rpc,
148
- entryPoint: {
149
- version: "0.8"
150
- }
151
- }),
152
- entryPoint: {
153
- version: "0.8"
154
- },
155
- ...rpc
156
- })
157
-
158
- const opHash = await simpleAccountClient.sendUserOperation({
159
- calls: [
160
- {
161
- to: zeroAddress,
162
- data: "0x",
163
- value: 0n
164
- }
165
- ]
166
- })
167
-
168
- expect(isHash(opHash)).toBe(true)
169
-
170
- const userOperationReceipt =
171
- await bundlerClient.waitForUserOperationReceipt({
172
- hash: opHash,
173
- timeout: 100000
174
- })
175
- expect(userOperationReceipt).not.toBeNull()
176
- expect(userOperationReceipt?.userOpHash).toBe(opHash)
177
- expect(userOperationReceipt?.receipt.transactionHash).toBeTruthy()
178
-
179
- const receipt = await bundlerClient.getUserOperationReceipt({
180
- hash: opHash
181
- })
182
-
183
- expect(receipt?.receipt.transactionHash).toBe(
184
- userOperationReceipt?.receipt.transactionHash
185
- )
186
- const userOperationStatus = await getUserOperationStatus(
187
- bundlerClient,
188
- {
189
- hash: opHash
190
- }
191
- )
192
- expect(userOperationStatus).not.toBeNull()
193
- expect(userOperationStatus).not.toBeUndefined()
194
- expect(userOperationStatus.status).toBe("included")
195
- expect(userOperationStatus.transactionHash).toBe(
196
- userOperationReceipt?.receipt.transactionHash
197
- )
198
- })
199
- })