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
@@ -0,0 +1,11 @@
1
+ import { toEtherspotSmartAccount } from "./toEtherspotSmartAccount.js"
2
+
3
+ export const EtherspotSmartAccount = {
4
+ toEtherspotSmartAccount
5
+ }
6
+
7
+ export type {
8
+ EtherspotSmartAccountImplementation,
9
+ ToEtherspotSmartAccountParameters,
10
+ ToEtherspotSmartAccountReturnType
11
+ } from "./toEtherspotSmartAccount.js"
@@ -0,0 +1,6 @@
1
+ {
2
+ "type": "module",
3
+ "types": "../../_types/accounts/etherspot/index.d.ts",
4
+ "module": "../../_esm/accounts/etherspot/index.js",
5
+ "main": "../../_cjs/accounts/etherspot/index.js"
6
+ }
@@ -0,0 +1,33 @@
1
+ import { to7702KernelSmartAccount } from "./to7702KernelSmartAccount.js"
2
+ import { toKernelSmartAccount } from "./toKernelSmartAccount.js"
3
+ import { isKernelV2 } from "./utils/isKernelV2.js"
4
+ import { signMessage } from "./utils/signMessage.js"
5
+ import { signTypedData } from "./utils/signTypedData.js"
6
+ import { wrapMessageHash } from "./utils/wrapMessageHash.js"
7
+
8
+ export const KernelSmartAccount = {
9
+ toKernelSmartAccount,
10
+ to7702KernelSmartAccount,
11
+ wrapMessageHash,
12
+ signMessage,
13
+ signTypedData,
14
+ isKernelV2
15
+ }
16
+
17
+ export type {
18
+ KernelSmartAccountImplementation,
19
+ KernelVersion,
20
+ ToKernelSmartAccountParameters,
21
+ ToKernelSmartAccountReturnType
22
+ } from "./toKernelSmartAccount.js"
23
+ export type {
24
+ EcdsaKernelSmartAccountImplementation,
25
+ ToEcdsaKernelSmartAccountParameters,
26
+ ToEcdsaKernelSmartAccountReturnType
27
+ } from "./toEcdsaKernelSmartAccount.js"
28
+ export type {
29
+ To7702KernelSmartAccountImplementation,
30
+ To7702KernelSmartAccountParameters,
31
+ To7702KernelSmartAccountReturnType
32
+ } from "./to7702KernelSmartAccount.js"
33
+ export type { WrapMessageHashParams } from "./utils/wrapMessageHash.js"
@@ -0,0 +1,6 @@
1
+ {
2
+ "type": "module",
3
+ "types": "../../_types/accounts/kernel/index.d.ts",
4
+ "module": "../../_esm/accounts/kernel/index.js",
5
+ "main": "../../_cjs/accounts/kernel/index.js"
6
+ }
@@ -774,6 +774,13 @@ export async function toKernelSmartAccount<
774
774
  ]
775
775
  })
776
776
 
777
+ if (
778
+ installFallbackCall === undefined ||
779
+ uninstallFallbackCall === undefined
780
+ ) {
781
+ throw new Error("Failed to encode fallback module calls")
782
+ }
783
+
777
784
  const executeCallData = encodeCallData({
778
785
  calls,
779
786
  kernelVersion
@@ -901,8 +908,8 @@ export async function toKernelSmartAccount<
901
908
  const signature = await signMessage({
902
909
  owner,
903
910
  message,
904
- accountAddress: await this.getAddress(),
905
- kernelVersion: kernelVersion,
911
+ address: await this.getAddress(),
912
+ version: kernelVersion,
906
913
  chainId: await getMemoizedChainId(),
907
914
  eip7702: eip7702
908
915
  })
@@ -931,8 +938,8 @@ export async function toKernelSmartAccount<
931
938
  owner: owner,
932
939
  chainId: await getMemoizedChainId(),
933
940
  ...(typedData as TypedDataDefinition),
934
- accountAddress: await this.getAddress(),
935
- kernelVersion: kernelVersion,
941
+ address: await this.getAddress(),
942
+ version: kernelVersion,
936
943
  eip7702
937
944
  })
938
945
 
@@ -966,8 +973,8 @@ export async function toKernelSmartAccount<
966
973
  owner,
967
974
  message: { raw: hash },
968
975
  chainId,
969
- accountAddress: await this.getAddress(),
970
- kernelVersion,
976
+ address: await this.getAddress(),
977
+ version: kernelVersion,
971
978
  eip7702: false
972
979
  })
973
980
  : await owner.signMessage({
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  type Hash,
3
3
  type LocalAccount,
4
+ type Prettify,
4
5
  type SignMessageReturnType,
5
6
  type SignableMessage,
6
7
  encodeAbiParameters,
@@ -18,23 +19,25 @@ import {
18
19
  export async function signMessage({
19
20
  message,
20
21
  owner,
21
- accountAddress,
22
- kernelVersion: accountVersion,
22
+ address: accountAddress,
23
+ version: accountVersion,
23
24
  chainId,
24
- eip7702
25
- }: {
26
- chainId: number
27
- message: SignableMessage
28
- owner: LocalAccount | WebAuthnAccount
29
- eip7702: boolean
30
- } & WrapMessageHashParams): Promise<SignMessageReturnType> {
25
+ eip7702 = false
26
+ }: Prettify<
27
+ {
28
+ message: SignableMessage
29
+ owner: LocalAccount | WebAuthnAccount
30
+ eip7702?: boolean
31
+ } & WrapMessageHashParams
32
+ >): Promise<SignMessageReturnType> {
31
33
  if (isWebAuthnAccount(owner)) {
32
34
  let messageContent: string
33
35
  if (typeof message === "string") {
34
36
  // message is a string
35
- messageContent = wrapMessageHash(hashMessage(message), {
36
- kernelVersion: accountVersion,
37
- accountAddress,
37
+ messageContent = wrapMessageHash({
38
+ hash: hashMessage(message),
39
+ version: accountVersion,
40
+ address: accountAddress,
38
41
  chainId
39
42
  // chainId: client.chain
40
43
  // ? client.chain.id
@@ -100,9 +103,10 @@ export async function signMessage({
100
103
  })
101
104
  }
102
105
 
103
- const wrappedMessageHash = wrapMessageHash(hashMessage(message), {
104
- kernelVersion: accountVersion,
105
- accountAddress,
106
+ const wrappedMessageHash = wrapMessageHash({
107
+ hash: hashMessage(message),
108
+ version: accountVersion,
109
+ address: accountAddress,
106
110
  chainId
107
111
  // chainId: client.chain
108
112
  // ? client.chain.id
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  type LocalAccount,
3
+ type Prettify,
3
4
  type SignTypedDataReturnType,
4
5
  type TypedDataDefinition,
5
6
  getTypesForEIP712Domain,
@@ -15,18 +16,19 @@ import {
15
16
  } from "./wrapMessageHash.js"
16
17
 
17
18
  export async function signTypedData(
18
- parameters: TypedDataDefinition &
19
+ parameters: Prettify<
19
20
  WrapMessageHashParams & {
20
21
  owner: LocalAccount | WebAuthnAccount
21
- eip7702: boolean
22
- }
22
+ eip7702?: boolean
23
+ } & TypedDataDefinition
24
+ >
23
25
  ): Promise<SignTypedDataReturnType> {
24
26
  const {
25
27
  owner,
26
- accountAddress,
27
- kernelVersion: accountVersion,
28
+ address: accountAddress,
29
+ version: accountVersion,
28
30
  chainId,
29
- eip7702,
31
+ eip7702 = false,
30
32
  ...typedData
31
33
  } = parameters
32
34
 
@@ -74,9 +76,10 @@ export async function signTypedData(
74
76
  })
75
77
  }
76
78
 
77
- const wrappedMessageHash = wrapMessageHash(typedHash, {
78
- kernelVersion: accountVersion,
79
- accountAddress,
79
+ const wrappedMessageHash = wrapMessageHash({
80
+ hash: typedHash,
81
+ version: accountVersion,
82
+ address: accountAddress,
80
83
  chainId: chainId
81
84
  })
82
85
 
@@ -84,8 +87,8 @@ export async function signTypedData(
84
87
  return signMessage({
85
88
  message: { raw: wrappedMessageHash },
86
89
  owner,
87
- accountAddress,
88
- kernelVersion: accountVersion,
90
+ address: accountAddress,
91
+ version: accountVersion,
89
92
  chainId,
90
93
  eip7702: false
91
94
  })
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  type Address,
3
3
  type Hex,
4
+ type Prettify,
4
5
  concatHex,
5
6
  domainSeparator,
6
7
  encodeAbiParameters,
@@ -11,15 +12,17 @@ import type { KernelVersion } from "../toKernelSmartAccount.js"
11
12
  import { isKernelV2 } from "./isKernelV2.js"
12
13
 
13
14
  export type WrapMessageHashParams = {
14
- kernelVersion: KernelVersion<"0.6" | "0.7">
15
- accountAddress: Address
15
+ version: KernelVersion<"0.6" | "0.7">
16
+ address: Address
16
17
  chainId: number
17
18
  }
18
19
 
19
- export const wrapMessageHash = (
20
- messageHash: Hex,
21
- { accountAddress, kernelVersion, chainId }: WrapMessageHashParams
22
- ) => {
20
+ export const wrapMessageHash = ({
21
+ hash,
22
+ address: accountAddress,
23
+ version: kernelVersion,
24
+ chainId
25
+ }: Prettify<{ hash: Hex } & WrapMessageHashParams>) => {
23
26
  const _domainSeparator = domainSeparator({
24
27
  domain: {
25
28
  name: "Kernel",
@@ -29,11 +32,11 @@ export const wrapMessageHash = (
29
32
  }
30
33
  })
31
34
  const wrappedMessageHash = isKernelV2(kernelVersion)
32
- ? messageHash
35
+ ? hash
33
36
  : keccak256(
34
37
  encodeAbiParameters(
35
38
  [{ type: "bytes32" }, { type: "bytes32" }],
36
- [keccak256(stringToHex("Kernel(bytes32 hash)")), messageHash]
39
+ [keccak256(stringToHex("Kernel(bytes32 hash)")), hash]
37
40
  )
38
41
  )
39
42
 
@@ -0,0 +1,12 @@
1
+ import { toLightSmartAccount } from "./toLightSmartAccount.js"
2
+
3
+ export const LightSmartAccount = {
4
+ toLightSmartAccount
5
+ }
6
+
7
+ export type {
8
+ LightAccountVersion,
9
+ LightSmartAccountImplementation,
10
+ ToLightSmartAccountParameters,
11
+ ToLightSmartAccountReturnType
12
+ } from "./toLightSmartAccount.js"
@@ -0,0 +1,6 @@
1
+ {
2
+ "type": "module",
3
+ "types": "../../_types/accounts/light/index.d.ts",
4
+ "module": "../../_esm/accounts/light/index.js",
5
+ "main": "../../_cjs/accounts/light/index.js"
6
+ }
@@ -355,11 +355,19 @@ export async function toLightSmartAccount<
355
355
  }[] = []
356
356
 
357
357
  for (let i = 0; i < decoded.args[0].length; i++) {
358
- calls.push({
359
- to: decoded.args[0][i],
360
- value: decoded.args[1][i],
361
- data: decoded.args[2][i]
362
- })
358
+ const to = decoded.args[0][i]
359
+ const value = decoded.args[1][i]
360
+ const data = decoded.args[2][i]
361
+
362
+ if (
363
+ to === undefined ||
364
+ value === undefined ||
365
+ data === undefined
366
+ ) {
367
+ throw new Error("Invalid batch call data")
368
+ }
369
+
370
+ calls.push({ to, value, data })
363
371
  }
364
372
 
365
373
  return calls
@@ -0,0 +1,11 @@
1
+ import { toNexusSmartAccount } from "./toNexusSmartAccount.js"
2
+
3
+ export const NexusSmartAccount = {
4
+ toNexusSmartAccount
5
+ }
6
+
7
+ export type {
8
+ NexusSmartAccountImplementation,
9
+ ToNexusSmartAccountParameters,
10
+ ToNexusSmartAccountReturnType
11
+ } from "./toNexusSmartAccount.js"
@@ -0,0 +1,6 @@
1
+ {
2
+ "type": "module",
3
+ "types": "../../_types/accounts/nexus/index.d.ts",
4
+ "module": "../../_esm/accounts/nexus/index.js",
5
+ "main": "../../_cjs/accounts/nexus/index.js"
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "type": "module",
3
+ "types": "../_types/accounts/index.d.ts",
4
+ "module": "../_esm/accounts/index.js",
5
+ "main": "../_cjs/accounts/index.js"
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "type": "module",
3
+ "types": "../../_types/accounts/safe/index.d.ts",
4
+ "module": "../../_esm/accounts/safe/index.js",
5
+ "main": "../../_cjs/accounts/safe/index.js"
6
+ }
@@ -97,6 +97,10 @@ export const getWebAuthnSignature = async ({
97
97
 
98
98
  const [, fields] = match
99
99
 
100
+ if (fields === undefined) {
101
+ throw new Error("challenge not found in client data JSON")
102
+ }
103
+
100
104
  return encodeAbiParameters(
101
105
  [
102
106
  { name: "authenticatorData", type: "bytes" },
@@ -904,15 +904,17 @@ const getInitializerCode = async ({
904
904
  })
905
905
  }
906
906
 
907
- if (!useMultiSendForSetup && multiCalls.length === 1) {
907
+ const firstMultiCall = multiCalls[0]
908
+
909
+ if (!useMultiSendForSetup && multiCalls.length === 1 && firstMultiCall) {
908
910
  return encodeFunctionData({
909
911
  abi: setupAbi,
910
912
  functionName: "setup",
911
913
  args: [
912
914
  ownerAddresses,
913
915
  threshold,
914
- multiCalls[0].to,
915
- multiCalls[0].data,
916
+ firstMultiCall.to,
917
+ firstMultiCall.data,
916
918
  safe4337ModuleAddress,
917
919
  paymentToken,
918
920
  payment,
@@ -0,0 +1,18 @@
1
+ import { to7702SimpleSmartAccount } from "./to7702SimpleSmartAccount.js"
2
+ import { toSimpleSmartAccount } from "./toSimpleSmartAccount.js"
3
+
4
+ export const SimpleSmartAccount = {
5
+ toSimpleSmartAccount,
6
+ to7702SimpleSmartAccount
7
+ }
8
+
9
+ export type {
10
+ SimpleSmartAccountImplementation,
11
+ ToSimpleSmartAccountParameters,
12
+ ToSimpleSmartAccountReturnType
13
+ } from "./toSimpleSmartAccount.js"
14
+ export type {
15
+ To7702SimpleSmartAccountImplementation,
16
+ To7702SimpleSmartAccountParameters,
17
+ To7702SimpleSmartAccountReturnType
18
+ } from "./to7702SimpleSmartAccount.js"
@@ -0,0 +1,6 @@
1
+ {
2
+ "type": "module",
3
+ "types": "../../_types/accounts/simple/index.d.ts",
4
+ "module": "../../_esm/accounts/simple/index.js",
5
+ "main": "../../_cjs/accounts/simple/index.js"
6
+ }
@@ -374,11 +374,19 @@ export async function toSimpleSmartAccount<
374
374
  const datas = decodedV7.args[2]
375
375
 
376
376
  for (let i = 0; i < destinations.length; i++) {
377
- calls.push({
378
- to: destinations[i],
379
- data: datas[i],
380
- value: values[i]
381
- })
377
+ const to = destinations[i]
378
+ const data = datas[i]
379
+ const value = values[i]
380
+
381
+ if (
382
+ to === undefined ||
383
+ data === undefined ||
384
+ value === undefined
385
+ ) {
386
+ throw new Error("Invalid batch call data")
387
+ }
388
+
389
+ calls.push({ to, data, value })
382
390
  }
383
391
 
384
392
  return calls
@@ -394,11 +402,14 @@ export async function toSimpleSmartAccount<
394
402
  const datas = decodedV6.args[1]
395
403
 
396
404
  for (let i = 0; i < destinations.length; i++) {
397
- calls.push({
398
- to: destinations[i],
399
- data: datas[i],
400
- value: 0n
401
- })
405
+ const to = destinations[i]
406
+ const data = datas[i]
407
+
408
+ if (to === undefined || data === undefined) {
409
+ throw new Error("Invalid batch call data")
410
+ }
411
+
412
+ calls.push({ to, data, value: 0n })
402
413
  }
403
414
 
404
415
  return calls
@@ -0,0 +1,11 @@
1
+ import { toThirdwebSmartAccount } from "./toThirdwebSmartAccount.js"
2
+
3
+ export const ThirdwebSmartAccount = {
4
+ toThirdwebSmartAccount
5
+ }
6
+
7
+ export type {
8
+ ThirdwebSmartAccountImplementation,
9
+ ToThirdwebSmartAccountParameters,
10
+ ToThirdwebSmartAccountReturnType
11
+ } from "./toThirdwebSmartAccount.js"
@@ -0,0 +1,6 @@
1
+ {
2
+ "type": "module",
3
+ "types": "../../_types/accounts/thirdweb/index.d.ts",
4
+ "module": "../../_esm/accounts/thirdweb/index.js",
5
+ "main": "../../_cjs/accounts/thirdweb/index.js"
6
+ }
@@ -38,11 +38,15 @@ export const decodeCallData = async (callData: Hex) => {
38
38
  }[] = []
39
39
 
40
40
  for (let i = 0; i < decodedBatch.args[0].length; i++) {
41
- calls.push({
42
- to: decodedBatch.args[0][i],
43
- value: decodedBatch.args[1][i],
44
- data: decodedBatch.args[2][i]
45
- })
41
+ const to = decodedBatch.args[0][i]
42
+ const value = decodedBatch.args[1][i]
43
+ const data = decodedBatch.args[2][i]
44
+
45
+ if (to === undefined || data === undefined) {
46
+ throw new Error("Invalid batch call data")
47
+ }
48
+
49
+ calls.push({ to, value, data })
46
50
  }
47
51
 
48
52
  return calls
@@ -0,0 +1,11 @@
1
+ import { toTrustSmartAccount } from "./toTrustSmartAccount.js"
2
+
3
+ export const TrustSmartAccount = {
4
+ toTrustSmartAccount
5
+ }
6
+
7
+ export type {
8
+ ToTrustSmartAccountParameters,
9
+ ToTrustSmartAccountReturnType,
10
+ TrustSmartAccountImplementation
11
+ } from "./toTrustSmartAccount.js"
@@ -0,0 +1,6 @@
1
+ {
2
+ "type": "module",
3
+ "types": "../../_types/accounts/trust/index.d.ts",
4
+ "module": "../../_esm/accounts/trust/index.js",
5
+ "main": "../../_cjs/accounts/trust/index.js"
6
+ }
@@ -38,11 +38,15 @@ export const decodeCallData = async (callData: Hex) => {
38
38
  }[] = []
39
39
 
40
40
  for (let i = 0; i < decodedBatch.args[0].length; i++) {
41
- calls.push({
42
- to: decodedBatch.args[0][i],
43
- value: decodedBatch.args[1][i],
44
- data: decodedBatch.args[2][i]
45
- })
41
+ const to = decodedBatch.args[0][i]
42
+ const value = decodedBatch.args[1][i]
43
+ const data = decodedBatch.args[2][i]
44
+
45
+ if (to === undefined || data === undefined) {
46
+ throw new Error("Invalid batch call data")
47
+ }
48
+
49
+ calls.push({ to, value, data })
46
50
  }
47
51
 
48
52
  return calls
@@ -3,40 +3,34 @@ import type {
3
3
  GetSmartAccountParameter,
4
4
  SmartAccount
5
5
  } from "viem/account-abstraction"
6
- import { accountId } from "./erc7579/accountId.js"
7
- import {
8
- type InstallModuleParameters,
9
- installModule
10
- } from "./erc7579/installModule.js"
6
+ import { accountId } from "./accountId.js"
7
+ import { type InstallModuleParameters, installModule } from "./installModule.js"
11
8
  import {
12
9
  type InstallModulesParameters,
13
10
  installModules
14
- } from "./erc7579/installModules.js"
11
+ } from "./installModules.js"
15
12
  import {
16
13
  type IsModuleInstalledParameters,
17
14
  isModuleInstalled
18
- } from "./erc7579/isModuleInstalled.js"
15
+ } from "./isModuleInstalled.js"
19
16
  import {
20
17
  type SupportsExecutionModeParameters,
21
18
  supportsExecutionMode
22
- } from "./erc7579/supportsExecutionMode.js"
23
- import type {
24
- CallType,
25
- ExecutionMode
26
- } from "./erc7579/supportsExecutionMode.js"
19
+ } from "./supportsExecutionMode.js"
20
+ import type { CallType, ExecutionMode } from "./supportsExecutionMode.js"
27
21
  import {
28
22
  type SupportsModuleParameters,
29
23
  supportsModule
30
- } from "./erc7579/supportsModule.js"
31
- import type { ModuleType } from "./erc7579/supportsModule.js"
24
+ } from "./supportsModule.js"
25
+ import type { ModuleType } from "./supportsModule.js"
32
26
  import {
33
27
  type UninstallModuleParameters,
34
28
  uninstallModule
35
- } from "./erc7579/uninstallModule.js"
29
+ } from "./uninstallModule.js"
36
30
  import {
37
31
  type UninstallModulesParameters,
38
32
  uninstallModules
39
- } from "./erc7579/uninstallModules.js"
33
+ } from "./uninstallModules.js"
40
34
 
41
35
  export type Erc7579Actions<TSmartAccount extends SmartAccount | undefined> = {
42
36
  accountId: (
@@ -0,0 +1,6 @@
1
+ {
2
+ "type": "module",
3
+ "types": "../../_types/actions/erc7579/index.d.ts",
4
+ "module": "../../_esm/actions/erc7579/index.js",
5
+ "main": "../../_cjs/actions/erc7579/index.js"
6
+ }
@@ -1,4 +1,4 @@
1
1
  export {
2
2
  type GetGasPriceResponseReturnType,
3
3
  getUserOperationGasPrice
4
- } from "./etherspot/getUserOperationGasPrice.js"
4
+ } from "./getUserOperationGasPrice.js"
@@ -0,0 +1,6 @@
1
+ {
2
+ "type": "module",
3
+ "types": "../../_types/actions/etherspot/index.d.ts",
4
+ "module": "../../_esm/actions/etherspot/index.js",
5
+ "main": "../../_cjs/actions/etherspot/index.js"
6
+ }
@@ -2,16 +2,16 @@ export {
2
2
  type StartRegistrationParameters,
3
3
  type StartRegistrationReturnType,
4
4
  startRegistration
5
- } from "./passkeyServer/startRegistration.js"
5
+ } from "./startRegistration.js"
6
6
 
7
7
  export {
8
8
  type VerifyRegistrationParameters,
9
9
  type VerifyRegistrationReturnType,
10
10
  verifyRegistration
11
- } from "./passkeyServer/verifyRegistration.js"
11
+ } from "./verifyRegistration.js"
12
12
 
13
13
  export {
14
14
  type GetCredentialsParameters,
15
15
  type GetCredentialsReturnType,
16
16
  getCredentials
17
- } from "./passkeyServer/getCredentials.js"
17
+ } from "./getCredentials.js"
@@ -0,0 +1,6 @@
1
+ {
2
+ "type": "module",
3
+ "types": "../../_types/actions/passkeyServer/index.d.ts",
4
+ "module": "../../_esm/actions/passkeyServer/index.js",
5
+ "main": "../../_cjs/actions/passkeyServer/index.js"
6
+ }