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,571 +0,0 @@
1
- import { type Hex, zeroAddress } from "viem"
2
- import { waitForUserOperationReceipt } from "viem/account-abstraction"
3
- import { privateKeyToAccount } from "viem/accounts"
4
- import { describe, expect } from "vitest"
5
- import { testWithRpc } from "../../../permissionless-test/src/testWithRpc"
6
- import {
7
- getCoreSmartAccounts,
8
- getPublicClient
9
- } from "../../../permissionless-test/src/utils"
10
- import { sendCalls } from "./sendCalls"
11
-
12
- const privateKey =
13
- "0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356"
14
-
15
- describe.each(getCoreSmartAccounts())(
16
- "sendCalls $name",
17
- ({
18
- getSmartAccountClient,
19
- supportsEntryPointV06,
20
- supportsEntryPointV07,
21
- supportsEntryPointV08,
22
- isEip7702Compliant
23
- }) => {
24
- testWithRpc.skipIf(!supportsEntryPointV06)(
25
- "sendCalls_v06",
26
- async ({ rpc }) => {
27
- const { anvilRpc } = rpc
28
-
29
- const smartClient = await getSmartAccountClient({
30
- entryPoint: {
31
- version: "0.6"
32
- },
33
- ...rpc
34
- })
35
-
36
- const { id: userOpHash } = await sendCalls(smartClient, {
37
- calls: [
38
- {
39
- to: zeroAddress,
40
- data: "0x",
41
- value: 0n
42
- }
43
- ]
44
- })
45
-
46
- expect(userOpHash).toBeTruthy()
47
- expect(userOpHash).toMatch(/^0x[a-fA-F0-9]{64}$/)
48
-
49
- const receipt = await waitForUserOperationReceipt(smartClient, {
50
- hash: userOpHash as Hex
51
- })
52
-
53
- expect(receipt).toBeTruthy()
54
- expect(receipt.success).toBe(true)
55
-
56
- const publicClient = getPublicClient(anvilRpc)
57
-
58
- const txReceipt = await publicClient.getTransactionReceipt({
59
- hash: receipt.receipt.transactionHash
60
- })
61
-
62
- expect(txReceipt).toBeTruthy()
63
- expect(txReceipt.status).toBe("success")
64
- }
65
- )
66
-
67
- testWithRpc.skipIf(!supportsEntryPointV06)(
68
- "sendCalls_v06 with multiple calls",
69
- async ({ rpc }) => {
70
- const { anvilRpc } = rpc
71
-
72
- const smartClient = await getSmartAccountClient({
73
- entryPoint: {
74
- version: "0.6"
75
- },
76
- ...rpc
77
- })
78
-
79
- const { id: userOpHash } = await sendCalls(smartClient, {
80
- calls: [
81
- {
82
- to: zeroAddress,
83
- data: "0x",
84
- value: 0n
85
- },
86
- {
87
- to: zeroAddress,
88
- data: "0x1234",
89
- value: 0n
90
- },
91
- {
92
- to: zeroAddress,
93
- data: "0x5678",
94
- value: 0n
95
- }
96
- ]
97
- })
98
-
99
- expect(userOpHash).toBeTruthy()
100
- expect(userOpHash).toMatch(/^0x[a-fA-F0-9]{64}$/)
101
-
102
- const receipt = await waitForUserOperationReceipt(smartClient, {
103
- hash: userOpHash as Hex
104
- })
105
-
106
- expect(receipt).toBeTruthy()
107
- expect(receipt.success).toBe(true)
108
-
109
- const publicClient = getPublicClient(anvilRpc)
110
-
111
- const txReceipt = await publicClient.getTransactionReceipt({
112
- hash: receipt.receipt.transactionHash
113
- })
114
-
115
- expect(txReceipt).toBeTruthy()
116
- expect(txReceipt.status).toBe("success")
117
- }
118
- )
119
-
120
- testWithRpc.skipIf(!supportsEntryPointV07)(
121
- "sendCalls_v07",
122
- async ({ rpc }) => {
123
- const { anvilRpc } = rpc
124
-
125
- const privateKeyAccount = privateKeyToAccount(privateKey)
126
-
127
- const smartClient = await getSmartAccountClient({
128
- entryPoint: {
129
- version: "0.7"
130
- },
131
- privateKey,
132
- ...rpc
133
- })
134
-
135
- const publicClient = getPublicClient(anvilRpc)
136
-
137
- const { id: userOpHash } = await sendCalls(smartClient, {
138
- calls: [
139
- {
140
- to: zeroAddress,
141
- data: "0x",
142
- value: 0n
143
- }
144
- ],
145
- authorization: isEip7702Compliant
146
- ? await privateKeyAccount.signAuthorization({
147
- address: (smartClient.account as any)
148
- .implementation,
149
- chainId: smartClient.chain.id,
150
- nonce: await publicClient.getTransactionCount({
151
- address: smartClient.account.address
152
- })
153
- })
154
- : undefined
155
- })
156
-
157
- expect(userOpHash).toBeTruthy()
158
- expect(userOpHash).toMatch(/^0x[a-fA-F0-9]{64}$/)
159
-
160
- const receipt = await waitForUserOperationReceipt(smartClient, {
161
- hash: userOpHash as Hex
162
- })
163
-
164
- expect(receipt).toBeTruthy()
165
- expect(receipt.success).toBe(true)
166
-
167
- const txReceipt = await publicClient.getTransactionReceipt({
168
- hash: receipt.receipt.transactionHash
169
- })
170
-
171
- expect(txReceipt).toBeTruthy()
172
- expect(txReceipt.status).toBe("success")
173
-
174
- // Second transaction after deployment
175
- const { id: userOpHash2 } = await sendCalls(smartClient, {
176
- calls: [
177
- {
178
- to: zeroAddress,
179
- data: "0x",
180
- value: 0n
181
- }
182
- ]
183
- })
184
-
185
- expect(userOpHash2).toBeTruthy()
186
- expect(userOpHash2).toMatch(/^0x[a-fA-F0-9]{64}$/)
187
-
188
- const receipt2 = await waitForUserOperationReceipt(
189
- smartClient,
190
- {
191
- hash: userOpHash2 as Hex
192
- }
193
- )
194
-
195
- expect(receipt2).toBeTruthy()
196
- expect(receipt2.success).toBe(true)
197
- }
198
- )
199
-
200
- testWithRpc.skipIf(!supportsEntryPointV08)(
201
- "sendCalls_v08",
202
- async ({ rpc }) => {
203
- const { anvilRpc } = rpc
204
-
205
- const privateKeyAccount = privateKeyToAccount(privateKey)
206
-
207
- const smartClient = await getSmartAccountClient({
208
- entryPoint: {
209
- version: "0.8"
210
- },
211
- privateKey,
212
- ...rpc
213
- })
214
-
215
- const publicClient = getPublicClient(anvilRpc)
216
-
217
- const authorization = isEip7702Compliant
218
- ? await privateKeyAccount.signAuthorization({
219
- address: (smartClient.account as any).implementation,
220
- chainId: smartClient.chain.id,
221
- nonce: await publicClient.getTransactionCount({
222
- address: smartClient.account.address
223
- })
224
- })
225
- : undefined
226
-
227
- const { id: userOpHash } = await sendCalls(smartClient, {
228
- calls: [
229
- {
230
- to: zeroAddress,
231
- data: "0x",
232
- value: 0n
233
- }
234
- ],
235
- authorization
236
- })
237
-
238
- expect(userOpHash).toBeTruthy()
239
- expect(userOpHash).toMatch(/^0x[a-fA-F0-9]{64}$/)
240
-
241
- const receipt = await waitForUserOperationReceipt(smartClient, {
242
- hash: userOpHash as Hex
243
- })
244
-
245
- expect(receipt).toBeTruthy()
246
- expect(receipt.success).toBe(true)
247
-
248
- const txReceipt = await publicClient.getTransactionReceipt({
249
- hash: receipt.receipt.transactionHash
250
- })
251
-
252
- expect(txReceipt).toBeTruthy()
253
- expect(txReceipt.status).toBe("success")
254
-
255
- // Second transaction after deployment
256
- const { id: userOpHash2 } = await sendCalls(smartClient, {
257
- calls: [
258
- {
259
- to: zeroAddress,
260
- data: "0x",
261
- value: 0n
262
- }
263
- ]
264
- })
265
-
266
- expect(userOpHash2).toBeTruthy()
267
- expect(userOpHash2).toMatch(/^0x[a-fA-F0-9]{64}$/)
268
-
269
- const receipt2 = await waitForUserOperationReceipt(
270
- smartClient,
271
- {
272
- hash: userOpHash2 as Hex
273
- }
274
- )
275
-
276
- expect(receipt2).toBeTruthy()
277
- expect(receipt2.success).toBe(true)
278
- }
279
- )
280
-
281
- testWithRpc.skipIf(!supportsEntryPointV06)(
282
- "sendCalls_v06 post deployment",
283
- async ({ rpc }) => {
284
- const { anvilRpc } = rpc
285
-
286
- await (async () => {
287
- const smartClient = await getSmartAccountClient({
288
- entryPoint: {
289
- version: "0.6"
290
- },
291
- privateKey,
292
- ...rpc
293
- })
294
-
295
- const { id: userOpHash } = await sendCalls(smartClient, {
296
- calls: [
297
- {
298
- to: zeroAddress,
299
- data: "0x",
300
- value: 0n
301
- }
302
- ]
303
- })
304
-
305
- expect(userOpHash).toBeTruthy()
306
-
307
- const receipt = await waitForUserOperationReceipt(
308
- smartClient,
309
- {
310
- hash: userOpHash as Hex
311
- }
312
- )
313
-
314
- expect(receipt).toBeTruthy()
315
- expect(receipt.success).toBe(true)
316
-
317
- const publicClient = getPublicClient(anvilRpc)
318
-
319
- const txReceipt = await publicClient.getTransactionReceipt({
320
- hash: receipt.receipt.transactionHash
321
- })
322
-
323
- expect(txReceipt).toBeTruthy()
324
- expect(txReceipt.status).toBe("success")
325
- })()
326
-
327
- const smartClient = await getSmartAccountClient({
328
- entryPoint: {
329
- version: "0.6"
330
- },
331
- privateKey,
332
- ...rpc
333
- })
334
-
335
- // Second transaction after deployment
336
- const { id: userOpHash2 } = await sendCalls(smartClient, {
337
- calls: [
338
- {
339
- to: zeroAddress,
340
- data: "0x",
341
- value: 0n
342
- }
343
- ]
344
- })
345
-
346
- expect(userOpHash2).toBeTruthy()
347
-
348
- const receipt2 = await waitForUserOperationReceipt(
349
- smartClient,
350
- {
351
- hash: userOpHash2 as Hex
352
- }
353
- )
354
-
355
- expect(receipt2).toBeTruthy()
356
- expect(receipt2.success).toBe(true)
357
-
358
- const publicClient = getPublicClient(anvilRpc)
359
-
360
- const txReceipt2 = await publicClient.getTransactionReceipt({
361
- hash: receipt2.receipt.transactionHash
362
- })
363
-
364
- expect(txReceipt2).toBeTruthy()
365
- expect(txReceipt2.status).toBe("success")
366
- }
367
- )
368
-
369
- testWithRpc.skipIf(!supportsEntryPointV07)(
370
- "sendCalls_v07 post deployment",
371
- async ({ rpc }) => {
372
- const { anvilRpc } = rpc
373
-
374
- await (async () => {
375
- const privateKeyAccount = privateKeyToAccount(privateKey)
376
-
377
- const smartClient = await getSmartAccountClient({
378
- entryPoint: {
379
- version: "0.7"
380
- },
381
- privateKey,
382
- ...rpc
383
- })
384
-
385
- const publicClient = getPublicClient(anvilRpc)
386
-
387
- const authorization = isEip7702Compliant
388
- ? await privateKeyAccount.signAuthorization({
389
- address: (smartClient.account as any)
390
- .implementation,
391
- chainId: smartClient.chain.id,
392
- nonce: await publicClient.getTransactionCount({
393
- address: smartClient.account.address
394
- })
395
- })
396
- : undefined
397
-
398
- const { id: userOpHash } = await sendCalls(smartClient, {
399
- calls: [
400
- {
401
- to: zeroAddress,
402
- data: "0x",
403
- value: 0n
404
- }
405
- ],
406
- authorization
407
- })
408
-
409
- expect(userOpHash).toBeTruthy()
410
-
411
- const receipt = await waitForUserOperationReceipt(
412
- smartClient,
413
- {
414
- hash: userOpHash as Hex
415
- }
416
- )
417
-
418
- expect(receipt).toBeTruthy()
419
- expect(receipt.success).toBe(true)
420
-
421
- const txReceipt = await publicClient.getTransactionReceipt({
422
- hash: receipt.receipt.transactionHash
423
- })
424
-
425
- expect(txReceipt).toBeTruthy()
426
- expect(txReceipt.status).toBe("success")
427
- })()
428
-
429
- const smartClient = await getSmartAccountClient({
430
- entryPoint: {
431
- version: "0.7"
432
- },
433
- privateKey,
434
- ...rpc
435
- })
436
-
437
- const { id: userOpHash2 } = await sendCalls(smartClient, {
438
- calls: [
439
- {
440
- to: zeroAddress,
441
- data: "0x",
442
- value: 0n
443
- }
444
- ]
445
- })
446
-
447
- expect(userOpHash2).toBeTruthy()
448
-
449
- const receipt2 = await waitForUserOperationReceipt(
450
- smartClient,
451
- {
452
- hash: userOpHash2 as Hex
453
- }
454
- )
455
-
456
- expect(receipt2).toBeTruthy()
457
- expect(receipt2.success).toBe(true)
458
-
459
- const publicClient = getPublicClient(anvilRpc)
460
-
461
- const txReceipt2 = await publicClient.getTransactionReceipt({
462
- hash: receipt2.receipt.transactionHash
463
- })
464
-
465
- expect(txReceipt2).toBeTruthy()
466
- expect(txReceipt2.status).toBe("success")
467
- }
468
- )
469
-
470
- testWithRpc.skipIf(!supportsEntryPointV08)(
471
- "sendCalls_v08 post deployment",
472
- async ({ rpc }) => {
473
- const { anvilRpc } = rpc
474
-
475
- const privateKeyAccount = privateKeyToAccount(privateKey)
476
-
477
- await (async () => {
478
- const smartClient = await getSmartAccountClient({
479
- entryPoint: {
480
- version: "0.8"
481
- },
482
- privateKey,
483
- ...rpc
484
- })
485
-
486
- const publicClient = getPublicClient(anvilRpc)
487
-
488
- const authorization = isEip7702Compliant
489
- ? await privateKeyAccount.signAuthorization({
490
- address: (smartClient.account as any)
491
- .implementation,
492
- chainId: smartClient.chain.id,
493
- nonce: await publicClient.getTransactionCount({
494
- address: smartClient.account.address
495
- })
496
- })
497
- : undefined
498
-
499
- const { id: userOpHash } = await sendCalls(smartClient, {
500
- calls: [
501
- {
502
- to: zeroAddress,
503
- data: "0x",
504
- value: 0n
505
- }
506
- ],
507
- authorization
508
- })
509
-
510
- expect(userOpHash).toBeTruthy()
511
-
512
- const receipt = await waitForUserOperationReceipt(
513
- smartClient,
514
- {
515
- hash: userOpHash as Hex
516
- }
517
- )
518
-
519
- expect(receipt).toBeTruthy()
520
- expect(receipt.success).toBe(true)
521
-
522
- const txReceipt = await publicClient.getTransactionReceipt({
523
- hash: receipt.receipt.transactionHash
524
- })
525
-
526
- expect(txReceipt).toBeTruthy()
527
- expect(txReceipt.status).toBe("success")
528
- })()
529
-
530
- const smartClient = await getSmartAccountClient({
531
- entryPoint: {
532
- version: "0.8"
533
- },
534
- privateKey,
535
- ...rpc
536
- })
537
-
538
- const { id: userOpHash2 } = await sendCalls(smartClient, {
539
- calls: [
540
- {
541
- to: zeroAddress,
542
- data: "0x",
543
- value: 0n
544
- }
545
- ]
546
- })
547
-
548
- expect(userOpHash2).toBeTruthy()
549
-
550
- const receipt2 = await waitForUserOperationReceipt(
551
- smartClient,
552
- {
553
- hash: userOpHash2 as Hex
554
- }
555
- )
556
-
557
- expect(receipt2).toBeTruthy()
558
- expect(receipt2.success).toBe(true)
559
-
560
- const publicClient = getPublicClient(anvilRpc)
561
-
562
- const txReceipt2 = await publicClient.getTransactionReceipt({
563
- hash: receipt2.receipt.transactionHash
564
- })
565
-
566
- expect(txReceipt2).toBeTruthy()
567
- expect(txReceipt2.status).toBe("success")
568
- }
569
- )
570
- }
571
- )