permissionless 0.3.6 → 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 (209) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/_cjs/accounts/biconomy/toBiconomySmartAccount.js +9 -5
  3. package/_cjs/accounts/biconomy/toBiconomySmartAccount.js.map +1 -1
  4. package/_cjs/accounts/kernel/toKernelSmartAccount.js +4 -0
  5. package/_cjs/accounts/kernel/toKernelSmartAccount.js.map +1 -1
  6. package/_cjs/accounts/light/toLightSmartAccount.js +9 -5
  7. package/_cjs/accounts/light/toLightSmartAccount.js.map +1 -1
  8. package/_cjs/accounts/safe/signUserOperation.js +3 -0
  9. package/_cjs/accounts/safe/signUserOperation.js.map +1 -1
  10. package/_cjs/accounts/safe/toSafeSmartAccount.js +4 -3
  11. package/_cjs/accounts/safe/toSafeSmartAccount.js.map +1 -1
  12. package/_cjs/accounts/simple/toSimpleSmartAccount.js +15 -10
  13. package/_cjs/accounts/simple/toSimpleSmartAccount.js.map +1 -1
  14. package/_cjs/accounts/thirdweb/utils/decodeCallData.js +7 -5
  15. package/_cjs/accounts/thirdweb/utils/decodeCallData.js.map +1 -1
  16. package/_cjs/accounts/trust/utils/decodeCallData.js +7 -5
  17. package/_cjs/accounts/trust/utils/decodeCallData.js.map +1 -1
  18. package/_cjs/actions/{erc7579.js → erc7579/index.js} +9 -9
  19. package/_cjs/actions/erc7579/index.js.map +1 -0
  20. package/_cjs/actions/{etherspot.js → etherspot/index.js} +2 -2
  21. package/_cjs/actions/etherspot/index.js.map +1 -0
  22. package/_cjs/actions/{passkeyServer.js → passkeyServer/index.js} +4 -4
  23. package/_cjs/actions/passkeyServer/index.js.map +1 -0
  24. package/_cjs/actions/pimlico/estimateErc20PaymasterCost.js +7 -3
  25. package/_cjs/actions/pimlico/estimateErc20PaymasterCost.js.map +1 -1
  26. package/_cjs/actions/{pimlico.js → pimlico/index.js} +8 -8
  27. package/_cjs/actions/pimlico/index.js.map +1 -0
  28. package/_cjs/actions/{smartAccount.js → smartAccount/index.js} +5 -5
  29. package/_cjs/actions/smartAccount/index.js.map +1 -0
  30. package/_cjs/clients/createSmartAccountClient.js.map +1 -1
  31. package/_cjs/clients/decorators/pimlico.js +4 -4
  32. package/_cjs/clients/decorators/pimlico.js.map +1 -1
  33. package/_cjs/clients/{passkeyServer.js → passkeyServer/index.js} +2 -2
  34. package/_cjs/clients/passkeyServer/index.js.map +1 -0
  35. package/_cjs/clients/{pimlico.js → pimlico/index.js} +2 -2
  36. package/_cjs/clients/pimlico/index.js.map +1 -0
  37. package/_cjs/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.js +6 -5
  38. package/_cjs/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.js.map +1 -1
  39. package/_esm/accounts/biconomy/toBiconomySmartAccount.js +9 -5
  40. package/_esm/accounts/biconomy/toBiconomySmartAccount.js.map +1 -1
  41. package/_esm/accounts/kernel/toKernelSmartAccount.js +4 -0
  42. package/_esm/accounts/kernel/toKernelSmartAccount.js.map +1 -1
  43. package/_esm/accounts/light/toLightSmartAccount.js +9 -5
  44. package/_esm/accounts/light/toLightSmartAccount.js.map +1 -1
  45. package/_esm/accounts/safe/signUserOperation.js +3 -0
  46. package/_esm/accounts/safe/signUserOperation.js.map +1 -1
  47. package/_esm/accounts/safe/toSafeSmartAccount.js +4 -3
  48. package/_esm/accounts/safe/toSafeSmartAccount.js.map +1 -1
  49. package/_esm/accounts/simple/toSimpleSmartAccount.js +15 -10
  50. package/_esm/accounts/simple/toSimpleSmartAccount.js.map +1 -1
  51. package/_esm/accounts/thirdweb/utils/decodeCallData.js +7 -5
  52. package/_esm/accounts/thirdweb/utils/decodeCallData.js.map +1 -1
  53. package/_esm/accounts/trust/utils/decodeCallData.js +7 -5
  54. package/_esm/accounts/trust/utils/decodeCallData.js.map +1 -1
  55. package/_esm/actions/{erc7579.js → erc7579/index.js} +9 -9
  56. package/_esm/actions/erc7579/index.js.map +1 -0
  57. package/_esm/actions/etherspot/index.js +2 -0
  58. package/_esm/actions/etherspot/index.js.map +1 -0
  59. package/_esm/actions/passkeyServer/index.js +4 -0
  60. package/_esm/actions/passkeyServer/index.js.map +1 -0
  61. package/_esm/actions/pimlico/estimateErc20PaymasterCost.js +7 -3
  62. package/_esm/actions/pimlico/estimateErc20PaymasterCost.js.map +1 -1
  63. package/_esm/actions/pimlico/index.js +8 -0
  64. package/_esm/actions/pimlico/index.js.map +1 -0
  65. package/_esm/actions/smartAccount/index.js +5 -0
  66. package/_esm/actions/smartAccount/index.js.map +1 -0
  67. package/_esm/clients/createSmartAccountClient.js.map +1 -1
  68. package/_esm/clients/decorators/pimlico.js +1 -1
  69. package/_esm/clients/decorators/pimlico.js.map +1 -1
  70. package/_esm/clients/{passkeyServer.js → passkeyServer/index.js} +2 -2
  71. package/_esm/clients/passkeyServer/index.js.map +1 -0
  72. package/_esm/clients/{pimlico.js → pimlico/index.js} +2 -2
  73. package/_esm/clients/pimlico/index.js.map +1 -0
  74. package/_esm/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.js +5 -4
  75. package/_esm/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.js.map +1 -1
  76. package/_types/accounts/biconomy/toBiconomySmartAccount.d.ts.map +1 -1
  77. package/_types/accounts/kernel/toKernelSmartAccount.d.ts.map +1 -1
  78. package/_types/accounts/light/toLightSmartAccount.d.ts.map +1 -1
  79. package/_types/accounts/safe/signUserOperation.d.ts.map +1 -1
  80. package/_types/accounts/safe/toSafeSmartAccount.d.ts.map +1 -1
  81. package/_types/accounts/simple/toSimpleSmartAccount.d.ts.map +1 -1
  82. package/_types/accounts/thirdweb/utils/decodeCallData.d.ts.map +1 -1
  83. package/_types/accounts/trust/utils/decodeCallData.d.ts.map +1 -1
  84. package/_types/actions/{erc7579.d.ts → erc7579/index.d.ts} +11 -11
  85. package/_types/actions/erc7579/index.d.ts.map +1 -0
  86. package/_types/actions/etherspot/index.d.ts +2 -0
  87. package/_types/actions/etherspot/index.d.ts.map +1 -0
  88. package/_types/actions/passkeyServer/index.d.ts +4 -0
  89. package/_types/actions/passkeyServer/index.d.ts.map +1 -0
  90. package/_types/actions/pimlico/estimateErc20PaymasterCost.d.ts.map +1 -1
  91. package/_types/actions/pimlico/index.d.ts +8 -0
  92. package/_types/actions/pimlico/index.d.ts.map +1 -0
  93. package/_types/actions/smartAccount/index.d.ts +5 -0
  94. package/_types/actions/smartAccount/index.d.ts.map +1 -0
  95. package/_types/clients/createSmartAccountClient.d.ts +9 -1
  96. package/_types/clients/createSmartAccountClient.d.ts.map +1 -1
  97. package/_types/clients/decorators/pimlico.d.ts +1 -1
  98. package/_types/clients/decorators/pimlico.d.ts.map +1 -1
  99. package/_types/clients/{passkeyServer.d.ts → passkeyServer/index.d.ts} +8 -4
  100. package/_types/clients/passkeyServer/index.d.ts.map +1 -0
  101. package/_types/clients/pimlico/index.d.ts +21 -0
  102. package/_types/clients/pimlico/index.d.ts.map +1 -0
  103. package/_types/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.d.ts.map +1 -1
  104. package/accounts/biconomy/package.json +6 -0
  105. package/accounts/biconomy/toBiconomySmartAccount.ts +13 -5
  106. package/accounts/etherspot/package.json +6 -0
  107. package/accounts/kernel/package.json +6 -0
  108. package/accounts/kernel/toKernelSmartAccount.ts +7 -0
  109. package/accounts/light/package.json +6 -0
  110. package/accounts/light/toLightSmartAccount.ts +13 -5
  111. package/accounts/nexus/package.json +6 -0
  112. package/accounts/package.json +6 -0
  113. package/accounts/safe/package.json +6 -0
  114. package/accounts/safe/signUserOperation.ts +4 -0
  115. package/accounts/safe/toSafeSmartAccount.ts +5 -3
  116. package/accounts/simple/package.json +6 -0
  117. package/accounts/simple/toSimpleSmartAccount.ts +21 -10
  118. package/accounts/thirdweb/package.json +6 -0
  119. package/accounts/thirdweb/utils/decodeCallData.ts +9 -5
  120. package/accounts/trust/package.json +6 -0
  121. package/accounts/trust/utils/decodeCallData.ts +9 -5
  122. package/actions/{erc7579.ts → erc7579/index.ts} +10 -16
  123. package/actions/erc7579/package.json +6 -0
  124. package/actions/{etherspot.ts → etherspot/index.ts} +1 -1
  125. package/actions/etherspot/package.json +6 -0
  126. package/actions/{passkeyServer.ts → passkeyServer/index.ts} +3 -3
  127. package/actions/passkeyServer/package.json +6 -0
  128. package/actions/pimlico/estimateErc20PaymasterCost.ts +9 -3
  129. package/actions/{pimlico.ts → pimlico/index.ts} +7 -7
  130. package/actions/pimlico/package.json +6 -0
  131. package/actions/smartAccount/index.ts +7 -0
  132. package/actions/smartAccount/package.json +6 -0
  133. package/clients/createSmartAccountClient.ts +45 -20
  134. package/clients/decorators/pimlico.ts +10 -10
  135. package/clients/package.json +6 -0
  136. package/clients/{passkeyServer.ts → passkeyServer/index.ts} +15 -13
  137. package/clients/passkeyServer/package.json +6 -0
  138. package/clients/{pimlico.ts → pimlico/index.ts} +50 -23
  139. package/clients/pimlico/package.json +6 -0
  140. package/errors/package.json +6 -0
  141. package/experimental/pimlico/package.json +6 -0
  142. package/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.ts +6 -4
  143. package/package.json +34 -29
  144. package/utils/package.json +6 -0
  145. package/_cjs/actions/erc7579.js.map +0 -1
  146. package/_cjs/actions/etherspot.js.map +0 -1
  147. package/_cjs/actions/passkeyServer.js.map +0 -1
  148. package/_cjs/actions/pimlico.js.map +0 -1
  149. package/_cjs/actions/smartAccount.js.map +0 -1
  150. package/_cjs/clients/passkeyServer.js.map +0 -1
  151. package/_cjs/clients/pimlico.js.map +0 -1
  152. package/_esm/actions/erc7579.js.map +0 -1
  153. package/_esm/actions/etherspot.js +0 -2
  154. package/_esm/actions/etherspot.js.map +0 -1
  155. package/_esm/actions/passkeyServer.js +0 -4
  156. package/_esm/actions/passkeyServer.js.map +0 -1
  157. package/_esm/actions/pimlico.js +0 -8
  158. package/_esm/actions/pimlico.js.map +0 -1
  159. package/_esm/actions/smartAccount.js +0 -5
  160. package/_esm/actions/smartAccount.js.map +0 -1
  161. package/_esm/clients/passkeyServer.js.map +0 -1
  162. package/_esm/clients/pimlico.js.map +0 -1
  163. package/_types/actions/erc7579.d.ts.map +0 -1
  164. package/_types/actions/etherspot.d.ts +0 -2
  165. package/_types/actions/etherspot.d.ts.map +0 -1
  166. package/_types/actions/passkeyServer.d.ts +0 -4
  167. package/_types/actions/passkeyServer.d.ts.map +0 -1
  168. package/_types/actions/pimlico.d.ts +0 -8
  169. package/_types/actions/pimlico.d.ts.map +0 -1
  170. package/_types/actions/smartAccount.d.ts +0 -5
  171. package/_types/actions/smartAccount.d.ts.map +0 -1
  172. package/_types/clients/passkeyServer.d.ts.map +0 -1
  173. package/_types/clients/pimlico.d.ts +0 -13
  174. package/_types/clients/pimlico.d.ts.map +0 -1
  175. package/accounts/decodeCalls.test.ts +0 -505
  176. package/accounts/safe/signUserOperation.test.ts +0 -275
  177. package/actions/erc7579/accountId.test.ts +0 -39
  178. package/actions/erc7579/installModule.test.ts +0 -214
  179. package/actions/erc7579/installModules.test.ts +0 -235
  180. package/actions/erc7579/isModuleInstalled.test.ts +0 -72
  181. package/actions/erc7579/supportsExecutionMode.test.ts +0 -108
  182. package/actions/erc7579/supportsModule.test.ts +0 -35
  183. package/actions/erc7579/uninstallModule.test.ts +0 -128
  184. package/actions/erc7579/uninstallModules.test.ts +0 -117
  185. package/actions/pimlico/getTokenQuotes.test.ts +0 -90
  186. package/actions/pimlico/getUserOperationGasPrice.test.ts +0 -82
  187. package/actions/pimlico/getUserOperationStatus.test.ts +0 -223
  188. package/actions/pimlico/sponsorUserOperation.test.ts +0 -236
  189. package/actions/pimlico/validateSponsorshipPolicies.test.ts +0 -153
  190. package/actions/public/getAccountNonce.test.ts +0 -96
  191. package/actions/public/getSenderAddress.test.ts +0 -154
  192. package/actions/smartAccount/getCallsStatus.test.ts +0 -253
  193. package/actions/smartAccount/sendCalls.test.ts +0 -569
  194. package/actions/smartAccount/sendTransaction.test.ts +0 -414
  195. package/actions/smartAccount/signMessage.test.ts +0 -217
  196. package/actions/smartAccount/signTypedData.test.ts +0 -226
  197. package/actions/smartAccount.ts +0 -7
  198. package/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.test.ts +0 -574
  199. package/types/package.json +0 -6
  200. package/utils/decodeNonce.test.ts +0 -40
  201. package/utils/deepHexlify.test.ts +0 -57
  202. package/utils/encode7579Calls.test.ts +0 -69
  203. package/utils/encodeNonce.test.ts +0 -38
  204. package/utils/erc20AllowanceOverride.test.ts +0 -59
  205. package/utils/erc20BalanceOverride.test.ts +0 -57
  206. package/utils/getAddressFromInitCodeOrPaymasterAndData.test.ts +0 -31
  207. package/utils/getPackedUserOperation.test.ts +0 -204
  208. package/utils/getRequiredPrefund.test.ts +0 -90
  209. package/vitest.config.ts +0 -41
@@ -1,253 +0,0 @@
1
- import { type Hex, zeroAddress } from "viem"
2
- import { generatePrivateKey, privateKeyToAccount } from "viem/accounts"
3
- import { describe, expect } from "vitest"
4
- import { testWithRpc } from "../../../permissionless-test/src/testWithRpc"
5
- import {
6
- getCoreSmartAccounts,
7
- getPublicClient
8
- } from "../../../permissionless-test/src/utils"
9
- import { getCallsStatus } from "./getCallsStatus"
10
- import { sendCalls } from "./sendCalls"
11
-
12
- describe.each(getCoreSmartAccounts())(
13
- "getCallsStatus $name",
14
- ({
15
- getSmartAccountClient,
16
- supportsEntryPointV06,
17
- supportsEntryPointV07,
18
- supportsEntryPointV08,
19
- isEip7702Compliant
20
- }) => {
21
- const privateKey = generatePrivateKey()
22
- testWithRpc.skipIf(!supportsEntryPointV06)(
23
- "getCallsStatus_v06",
24
- async ({ rpc }) => {
25
- const { anvilRpc } = rpc
26
-
27
- const smartClient = await getSmartAccountClient({
28
- entryPoint: {
29
- version: "0.6"
30
- },
31
- ...rpc
32
- })
33
-
34
- const { id: userOpHash } = await sendCalls(smartClient, {
35
- calls: [
36
- {
37
- to: zeroAddress,
38
- data: "0x",
39
- value: 0n
40
- }
41
- ]
42
- })
43
-
44
- expect(userOpHash).toBeTruthy()
45
-
46
- await smartClient.waitForUserOperationReceipt({
47
- hash: userOpHash as Hex
48
- })
49
-
50
- const status = await getCallsStatus(smartClient, {
51
- id: userOpHash
52
- })
53
-
54
- expect(status).toBeTruthy()
55
- expect(status.id).toBe(userOpHash)
56
- expect(status.version).toBe("1.0")
57
- expect(status.chainId).toBe(smartClient.chain.id)
58
- expect(status.atomic).toBe(true)
59
- expect(status.status).toBe("success")
60
- expect(status.statusCode).toBe(200)
61
- expect(status.receipts).toBeDefined()
62
- expect(status.receipts?.length).toBeGreaterThan(0)
63
- expect(status.receipts?.[0].status).toBe("success")
64
- }
65
- )
66
-
67
- testWithRpc.skipIf(!supportsEntryPointV06)(
68
- "getCallsStatus_v06 pending status",
69
- async ({ rpc }) => {
70
- const smartClient = await getSmartAccountClient({
71
- entryPoint: {
72
- version: "0.6"
73
- },
74
- ...rpc
75
- })
76
-
77
- const { id: userOpHash } = await sendCalls(smartClient, {
78
- calls: [
79
- {
80
- to: zeroAddress,
81
- data: "0x",
82
- value: 0n
83
- }
84
- ]
85
- })
86
-
87
- expect(userOpHash).toBeTruthy()
88
-
89
- // Check status immediately (should be pending)
90
- const status = await getCallsStatus(smartClient, {
91
- id: userOpHash
92
- })
93
-
94
- expect(status).toBeTruthy()
95
- expect(status.id).toBe(userOpHash)
96
- expect(status.version).toBe("1.0")
97
- expect(status.chainId).toBe(smartClient.chain.id)
98
- expect(status.atomic).toBe(true)
99
- expect(["pending", "success"]).toContain(status.status)
100
- expect([100, 200]).toContain(status.statusCode)
101
- }
102
- )
103
-
104
- testWithRpc.skipIf(!supportsEntryPointV07)(
105
- "getCallsStatus_v07",
106
- async ({ rpc }) => {
107
- const { anvilRpc } = rpc
108
-
109
- const privateKeyAccount = privateKeyToAccount(privateKey)
110
-
111
- const smartClient = await getSmartAccountClient({
112
- entryPoint: {
113
- version: "0.7"
114
- },
115
- privateKey,
116
- ...rpc
117
- })
118
-
119
- const publicClient = getPublicClient(anvilRpc)
120
-
121
- const { id: userOpHash } = await sendCalls(smartClient, {
122
- calls: [
123
- {
124
- to: zeroAddress,
125
- data: "0x",
126
- value: 0n
127
- }
128
- ],
129
- authorization: isEip7702Compliant
130
- ? await privateKeyAccount.signAuthorization({
131
- address: (smartClient.account as any)
132
- .implementation,
133
- chainId: smartClient.chain.id,
134
- nonce: await publicClient.getTransactionCount({
135
- address: smartClient.account.address
136
- })
137
- })
138
- : undefined
139
- })
140
-
141
- expect(userOpHash).toBeTruthy()
142
-
143
- await smartClient.waitForUserOperationReceipt({
144
- hash: userOpHash as Hex
145
- })
146
-
147
- const status = await getCallsStatus(smartClient, {
148
- id: userOpHash
149
- })
150
-
151
- expect(status).toBeTruthy()
152
- expect(status.id).toBe(userOpHash)
153
- expect(status.version).toBe("1.0")
154
- expect(status.chainId).toBe(smartClient.chain.id)
155
- expect(status.atomic).toBe(true)
156
- expect(status.status).toBe("success")
157
- expect(status.statusCode).toBe(200)
158
- expect(status.receipts).toBeDefined()
159
- expect(status.receipts?.length).toBeGreaterThan(0)
160
- expect(status.receipts?.[0].status).toBe("success")
161
- }
162
- )
163
-
164
- testWithRpc.skipIf(!supportsEntryPointV08)(
165
- "getCallsStatus_v08",
166
- async ({ rpc }) => {
167
- const { anvilRpc } = rpc
168
-
169
- const privateKeyAccount = privateKeyToAccount(privateKey)
170
-
171
- const smartClient = await getSmartAccountClient({
172
- entryPoint: {
173
- version: "0.8"
174
- },
175
- privateKey,
176
- ...rpc
177
- })
178
-
179
- const publicClient = getPublicClient(anvilRpc)
180
-
181
- const authorization = isEip7702Compliant
182
- ? await privateKeyAccount.signAuthorization({
183
- address: (smartClient.account as any).implementation,
184
- chainId: smartClient.chain.id,
185
- nonce: await publicClient.getTransactionCount({
186
- address: smartClient.account.address
187
- })
188
- })
189
- : undefined
190
-
191
- const { id: userOpHash } = await sendCalls(smartClient, {
192
- calls: [
193
- {
194
- to: zeroAddress,
195
- data: "0x",
196
- value: 0n
197
- }
198
- ],
199
- authorization
200
- })
201
-
202
- expect(userOpHash).toBeTruthy()
203
-
204
- await smartClient.waitForUserOperationReceipt({
205
- hash: userOpHash as Hex
206
- })
207
-
208
- const status = await getCallsStatus(smartClient, {
209
- id: userOpHash
210
- })
211
-
212
- expect(status).toBeTruthy()
213
- expect(status.id).toBe(userOpHash)
214
- expect(status.version).toBe("1.0")
215
- expect(status.chainId).toBe(smartClient.chain.id)
216
- expect(status.atomic).toBe(true)
217
- expect(status.status).toBe("success")
218
- expect(status.statusCode).toBe(200)
219
- expect(status.receipts).toBeDefined()
220
- expect(status.receipts?.length).toBeGreaterThan(0)
221
- expect(status.receipts?.[0].status).toBe("success")
222
- }
223
- )
224
-
225
- testWithRpc.skipIf(!supportsEntryPointV06)(
226
- "getCallsStatus_v06 with invalid hash",
227
- async ({ rpc }) => {
228
- const smartClient = await getSmartAccountClient({
229
- entryPoint: {
230
- version: "0.6"
231
- },
232
- ...rpc
233
- })
234
-
235
- const invalidHash =
236
- "0x1234567890123456789012345678901234567890123456789012345678901234"
237
-
238
- const status = await getCallsStatus(smartClient, {
239
- id: invalidHash
240
- })
241
-
242
- expect(status).toBeTruthy()
243
- expect(status.id).toBe(invalidHash)
244
- expect(status.version).toBe("1.0")
245
- expect(status.chainId).toBe(smartClient.chain.id)
246
- expect(status.atomic).toBe(true)
247
- expect(status.status).toBe("pending")
248
- expect(status.statusCode).toBe(100)
249
- expect(status.receipts).toBeUndefined()
250
- }
251
- )
252
- }
253
- )