permissionless 0.2.15 → 0.2.17

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 (281) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/_cjs/accounts/biconomy/toBiconomySmartAccount.js +11 -11
  3. package/_cjs/accounts/biconomy/toBiconomySmartAccount.js.map +1 -1
  4. package/_cjs/accounts/index.js +16 -16
  5. package/_cjs/accounts/index.js.map +1 -1
  6. package/_cjs/accounts/kernel/toEcdsaKernelSmartAccount.js +30 -30
  7. package/_cjs/accounts/kernel/toEcdsaKernelSmartAccount.js.map +1 -1
  8. package/_cjs/accounts/kernel/utils/encodeCallData.js +7 -7
  9. package/_cjs/accounts/kernel/utils/encodeCallData.js.map +1 -1
  10. package/_cjs/accounts/kernel/utils/getNonceKey.js +5 -5
  11. package/_cjs/accounts/kernel/utils/getNonceKey.js.map +1 -1
  12. package/_cjs/accounts/kernel/utils/signMessage.js +3 -4
  13. package/_cjs/accounts/kernel/utils/signMessage.js.map +1 -1
  14. package/_cjs/accounts/kernel/utils/signTypedData.js +3 -4
  15. package/_cjs/accounts/kernel/utils/signTypedData.js.map +1 -1
  16. package/_cjs/accounts/kernel/utils/wrapMessageHash.js +4 -1
  17. package/_cjs/accounts/kernel/utils/wrapMessageHash.js.map +1 -1
  18. package/_cjs/accounts/light/toLightSmartAccount.js +6 -6
  19. package/_cjs/accounts/light/toLightSmartAccount.js.map +1 -1
  20. package/_cjs/accounts/nexus/toNexusSmartAccount.js +6 -6
  21. package/_cjs/accounts/nexus/toNexusSmartAccount.js.map +1 -1
  22. package/_cjs/accounts/safe/toSafeSmartAccount.js +9 -8
  23. package/_cjs/accounts/safe/toSafeSmartAccount.js.map +1 -1
  24. package/_cjs/accounts/simple/toSimpleSmartAccount.js +6 -6
  25. package/_cjs/accounts/simple/toSimpleSmartAccount.js.map +1 -1
  26. package/_cjs/accounts/thirdweb/toThirdwebSmartAccount.js +14 -14
  27. package/_cjs/accounts/thirdweb/toThirdwebSmartAccount.js.map +1 -1
  28. package/_cjs/accounts/trust/toTrustSmartAccount.js +10 -10
  29. package/_cjs/accounts/trust/toTrustSmartAccount.js.map +1 -1
  30. package/_cjs/actions/erc7579/accountId.js +2 -2
  31. package/_cjs/actions/erc7579/accountId.js.map +1 -1
  32. package/_cjs/actions/erc7579/installModule.js +4 -4
  33. package/_cjs/actions/erc7579/installModule.js.map +1 -1
  34. package/_cjs/actions/erc7579/installModules.js +4 -4
  35. package/_cjs/actions/erc7579/installModules.js.map +1 -1
  36. package/_cjs/actions/erc7579/isModuleInstalled.js +5 -5
  37. package/_cjs/actions/erc7579/isModuleInstalled.js.map +1 -1
  38. package/_cjs/actions/erc7579/supportsExecutionMode.js +2 -2
  39. package/_cjs/actions/erc7579/supportsExecutionMode.js.map +1 -1
  40. package/_cjs/actions/erc7579/supportsModule.js +2 -2
  41. package/_cjs/actions/erc7579/supportsModule.js.map +1 -1
  42. package/_cjs/actions/erc7579/uninstallModule.js +4 -4
  43. package/_cjs/actions/erc7579/uninstallModule.js.map +1 -1
  44. package/_cjs/actions/erc7579/uninstallModules.js +4 -4
  45. package/_cjs/actions/erc7579/uninstallModules.js.map +1 -1
  46. package/_cjs/actions/erc7579.js +24 -24
  47. package/_cjs/actions/erc7579.js.map +1 -1
  48. package/_cjs/actions/index.js +5 -5
  49. package/_cjs/actions/index.js.map +1 -1
  50. package/_cjs/actions/pimlico/sponsorUserOperation.js +3 -3
  51. package/_cjs/actions/pimlico/sponsorUserOperation.js.map +1 -1
  52. package/_cjs/actions/pimlico/validateSponsorshipPolicies.js +2 -2
  53. package/_cjs/actions/pimlico/validateSponsorshipPolicies.js.map +1 -1
  54. package/_cjs/actions/pimlico.js +14 -14
  55. package/_cjs/actions/pimlico.js.map +1 -1
  56. package/_cjs/actions/public/getSenderAddress.js +30 -137
  57. package/_cjs/actions/public/getSenderAddress.js.map +1 -1
  58. package/_cjs/actions/smartAccount/sendTransaction.js +2 -2
  59. package/_cjs/actions/smartAccount/sendTransaction.js.map +1 -1
  60. package/_cjs/actions/smartAccount/signMessage.js +2 -2
  61. package/_cjs/actions/smartAccount/signMessage.js.map +1 -1
  62. package/_cjs/actions/smartAccount/signTypedData.js +2 -2
  63. package/_cjs/actions/smartAccount/signTypedData.js.map +1 -1
  64. package/_cjs/actions/smartAccount/writeContract.js +2 -2
  65. package/_cjs/actions/smartAccount/writeContract.js.map +1 -1
  66. package/_cjs/actions/smartAccount.js +8 -8
  67. package/_cjs/actions/smartAccount.js.map +1 -1
  68. package/_cjs/clients/createSmartAccountClient.js +3 -3
  69. package/_cjs/clients/createSmartAccountClient.js.map +1 -1
  70. package/_cjs/clients/decorators/pimlico.js +10 -10
  71. package/_cjs/clients/decorators/pimlico.js.map +1 -1
  72. package/_cjs/clients/decorators/smartAccount.js +11 -11
  73. package/_cjs/clients/decorators/smartAccount.js.map +1 -1
  74. package/_cjs/clients/index.js.map +1 -1
  75. package/_cjs/clients/pimlico.js +2 -2
  76. package/_cjs/clients/pimlico.js.map +1 -1
  77. package/_cjs/experimental/pimlico/index.js +2 -2
  78. package/_cjs/experimental/pimlico/index.js.map +1 -1
  79. package/_cjs/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.js +6 -5
  80. package/_cjs/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.js.map +1 -1
  81. package/_cjs/index.js.map +1 -1
  82. package/_cjs/utils/encode7579Calls.js +3 -3
  83. package/_cjs/utils/encode7579Calls.js.map +1 -1
  84. package/_cjs/utils/encodeInstallModule.js +4 -4
  85. package/_cjs/utils/encodeInstallModule.js.map +1 -1
  86. package/_cjs/utils/encodeUninstallModule.js +4 -4
  87. package/_cjs/utils/encodeUninstallModule.js.map +1 -1
  88. package/_cjs/utils/index.js +25 -25
  89. package/_cjs/utils/index.js.map +1 -1
  90. package/_esm/accounts/biconomy/toBiconomySmartAccount.js.map +1 -1
  91. package/_esm/accounts/index.js.map +1 -1
  92. package/_esm/accounts/kernel/toEcdsaKernelSmartAccount.js.map +1 -1
  93. package/_esm/accounts/kernel/utils/encodeCallData.js.map +1 -1
  94. package/_esm/accounts/kernel/utils/getNonceKey.js.map +1 -1
  95. package/_esm/accounts/kernel/utils/signMessage.js +1 -2
  96. package/_esm/accounts/kernel/utils/signMessage.js.map +1 -1
  97. package/_esm/accounts/kernel/utils/signTypedData.js +1 -2
  98. package/_esm/accounts/kernel/utils/signTypedData.js.map +1 -1
  99. package/_esm/accounts/kernel/utils/wrapMessageHash.js +4 -1
  100. package/_esm/accounts/kernel/utils/wrapMessageHash.js.map +1 -1
  101. package/_esm/accounts/light/toLightSmartAccount.js.map +1 -1
  102. package/_esm/accounts/nexus/toNexusSmartAccount.js +1 -1
  103. package/_esm/accounts/nexus/toNexusSmartAccount.js.map +1 -1
  104. package/_esm/accounts/safe/toSafeSmartAccount.js +2 -1
  105. package/_esm/accounts/safe/toSafeSmartAccount.js.map +1 -1
  106. package/_esm/accounts/simple/toSimpleSmartAccount.js.map +1 -1
  107. package/_esm/accounts/thirdweb/toThirdwebSmartAccount.js.map +1 -1
  108. package/_esm/accounts/trust/toTrustSmartAccount.js.map +1 -1
  109. package/_esm/actions/erc7579/accountId.js.map +1 -1
  110. package/_esm/actions/erc7579/installModule.js +1 -1
  111. package/_esm/actions/erc7579/installModule.js.map +1 -1
  112. package/_esm/actions/erc7579/installModules.js.map +1 -1
  113. package/_esm/actions/erc7579/isModuleInstalled.js.map +1 -1
  114. package/_esm/actions/erc7579/supportsExecutionMode.js.map +1 -1
  115. package/_esm/actions/erc7579/supportsModule.js.map +1 -1
  116. package/_esm/actions/erc7579/uninstallModule.js.map +1 -1
  117. package/_esm/actions/erc7579/uninstallModules.js.map +1 -1
  118. package/_esm/actions/erc7579.js.map +1 -1
  119. package/_esm/actions/index.js.map +1 -1
  120. package/_esm/actions/pimlico/sponsorUserOperation.js.map +1 -1
  121. package/_esm/actions/pimlico/validateSponsorshipPolicies.js.map +1 -1
  122. package/_esm/actions/pimlico.js.map +1 -1
  123. package/_esm/actions/public/getSenderAddress.js +33 -142
  124. package/_esm/actions/public/getSenderAddress.js.map +1 -1
  125. package/_esm/actions/smartAccount/sendTransaction.js.map +1 -1
  126. package/_esm/actions/smartAccount/signMessage.js.map +1 -1
  127. package/_esm/actions/smartAccount/signTypedData.js.map +1 -1
  128. package/_esm/actions/smartAccount/writeContract.js.map +1 -1
  129. package/_esm/actions/smartAccount.js.map +1 -1
  130. package/_esm/clients/createSmartAccountClient.js +2 -2
  131. package/_esm/clients/createSmartAccountClient.js.map +1 -1
  132. package/_esm/clients/decorators/pimlico.js.map +1 -1
  133. package/_esm/clients/decorators/smartAccount.js +3 -3
  134. package/_esm/clients/decorators/smartAccount.js.map +1 -1
  135. package/_esm/clients/index.js.map +1 -1
  136. package/_esm/clients/pimlico.js.map +1 -1
  137. package/_esm/experimental/pimlico/index.js.map +1 -1
  138. package/_esm/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.js +2 -1
  139. package/_esm/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.js.map +1 -1
  140. package/_esm/index.js.map +1 -1
  141. package/_esm/utils/encode7579Calls.js.map +1 -1
  142. package/_esm/utils/encodeInstallModule.js.map +1 -1
  143. package/_esm/utils/encodeUninstallModule.js.map +1 -1
  144. package/_esm/utils/index.js.map +1 -1
  145. package/_types/accounts/biconomy/toBiconomySmartAccount.d.ts +1 -1
  146. package/_types/accounts/biconomy/toBiconomySmartAccount.d.ts.map +1 -1
  147. package/_types/accounts/index.d.ts +8 -8
  148. package/_types/accounts/index.d.ts.map +1 -1
  149. package/_types/accounts/kernel/toEcdsaKernelSmartAccount.d.ts +1 -1
  150. package/_types/accounts/kernel/toEcdsaKernelSmartAccount.d.ts.map +1 -1
  151. package/_types/accounts/kernel/utils/encodeCallData.d.ts +1 -1
  152. package/_types/accounts/kernel/utils/encodeCallData.d.ts.map +1 -1
  153. package/_types/accounts/kernel/utils/getNonceKey.d.ts +1 -1
  154. package/_types/accounts/kernel/utils/getNonceKey.d.ts.map +1 -1
  155. package/_types/accounts/kernel/utils/isKernelV2.d.ts +1 -1
  156. package/_types/accounts/kernel/utils/isKernelV2.d.ts.map +1 -1
  157. package/_types/accounts/kernel/utils/signMessage.d.ts +1 -1
  158. package/_types/accounts/kernel/utils/signMessage.d.ts.map +1 -1
  159. package/_types/accounts/kernel/utils/signTypedData.d.ts +1 -1
  160. package/_types/accounts/kernel/utils/signTypedData.d.ts.map +1 -1
  161. package/_types/accounts/kernel/utils/wrapMessageHash.d.ts +1 -1
  162. package/_types/accounts/kernel/utils/wrapMessageHash.d.ts.map +1 -1
  163. package/_types/accounts/light/toLightSmartAccount.d.ts +1 -1
  164. package/_types/accounts/light/toLightSmartAccount.d.ts.map +1 -1
  165. package/_types/accounts/nexus/toNexusSmartAccount.d.ts +1 -1
  166. package/_types/accounts/nexus/toNexusSmartAccount.d.ts.map +1 -1
  167. package/_types/accounts/safe/toSafeSmartAccount.d.ts +1 -1
  168. package/_types/accounts/safe/toSafeSmartAccount.d.ts.map +1 -1
  169. package/_types/accounts/simple/toSimpleSmartAccount.d.ts +1 -1
  170. package/_types/accounts/simple/toSimpleSmartAccount.d.ts.map +1 -1
  171. package/_types/accounts/thirdweb/toThirdwebSmartAccount.d.ts +1 -1
  172. package/_types/accounts/thirdweb/toThirdwebSmartAccount.d.ts.map +1 -1
  173. package/_types/accounts/trust/toTrustSmartAccount.d.ts +1 -1
  174. package/_types/accounts/trust/toTrustSmartAccount.d.ts.map +1 -1
  175. package/_types/actions/erc7579/installModule.d.ts +1 -1
  176. package/_types/actions/erc7579/installModule.d.ts.map +1 -1
  177. package/_types/actions/erc7579/installModules.d.ts +1 -1
  178. package/_types/actions/erc7579/installModules.d.ts.map +1 -1
  179. package/_types/actions/erc7579/isModuleInstalled.d.ts +1 -1
  180. package/_types/actions/erc7579/isModuleInstalled.d.ts.map +1 -1
  181. package/_types/actions/erc7579/uninstallModule.d.ts +1 -1
  182. package/_types/actions/erc7579/uninstallModule.d.ts.map +1 -1
  183. package/_types/actions/erc7579/uninstallModules.d.ts +1 -1
  184. package/_types/actions/erc7579/uninstallModules.d.ts.map +1 -1
  185. package/_types/actions/erc7579.d.ts +10 -10
  186. package/_types/actions/erc7579.d.ts.map +1 -1
  187. package/_types/actions/index.d.ts +4 -4
  188. package/_types/actions/index.d.ts.map +1 -1
  189. package/_types/actions/pimlico/getTokenQuotes.d.ts +1 -1
  190. package/_types/actions/pimlico/getTokenQuotes.d.ts.map +1 -1
  191. package/_types/actions/pimlico/getUserOperationGasPrice.d.ts +1 -1
  192. package/_types/actions/pimlico/getUserOperationGasPrice.d.ts.map +1 -1
  193. package/_types/actions/pimlico/getUserOperationStatus.d.ts +1 -1
  194. package/_types/actions/pimlico/getUserOperationStatus.d.ts.map +1 -1
  195. package/_types/actions/pimlico/sendCompressedUserOperation.d.ts +1 -1
  196. package/_types/actions/pimlico/sendCompressedUserOperation.d.ts.map +1 -1
  197. package/_types/actions/pimlico/sponsorUserOperation.d.ts +1 -1
  198. package/_types/actions/pimlico/sponsorUserOperation.d.ts.map +1 -1
  199. package/_types/actions/pimlico/validateSponsorshipPolicies.d.ts +1 -1
  200. package/_types/actions/pimlico/validateSponsorshipPolicies.d.ts.map +1 -1
  201. package/_types/actions/pimlico.d.ts +8 -8
  202. package/_types/actions/pimlico.d.ts.map +1 -1
  203. package/_types/actions/public/getSenderAddress.d.ts.map +1 -1
  204. package/_types/actions/smartAccount.d.ts +4 -4
  205. package/_types/actions/smartAccount.d.ts.map +1 -1
  206. package/_types/clients/createSmartAccountClient.d.ts +1 -1
  207. package/_types/clients/createSmartAccountClient.d.ts.map +1 -1
  208. package/_types/clients/decorators/pimlico.d.ts +4 -4
  209. package/_types/clients/decorators/pimlico.d.ts.map +1 -1
  210. package/_types/clients/decorators/smartAccount.d.ts +5 -51
  211. package/_types/clients/decorators/smartAccount.d.ts.map +1 -1
  212. package/_types/clients/index.d.ts +2 -2
  213. package/_types/clients/index.d.ts.map +1 -1
  214. package/_types/clients/pimlico.d.ts +2 -2
  215. package/_types/clients/pimlico.d.ts.map +1 -1
  216. package/_types/experimental/pimlico/index.d.ts +1 -1
  217. package/_types/experimental/pimlico/index.d.ts.map +1 -1
  218. package/_types/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.d.ts.map +1 -1
  219. package/_types/index.d.ts +3 -3
  220. package/_types/index.d.ts.map +1 -1
  221. package/_types/utils/encode7579Calls.d.ts +1 -1
  222. package/_types/utils/encode7579Calls.d.ts.map +1 -1
  223. package/_types/utils/encodeInstallModule.d.ts +1 -1
  224. package/_types/utils/encodeInstallModule.d.ts.map +1 -1
  225. package/_types/utils/encodeUninstallModule.d.ts +1 -1
  226. package/_types/utils/encodeUninstallModule.d.ts.map +1 -1
  227. package/_types/utils/index.d.ts +12 -12
  228. package/_types/utils/index.d.ts.map +1 -1
  229. package/accounts/biconomy/toBiconomySmartAccount.ts +3 -3
  230. package/accounts/index.ts +8 -8
  231. package/accounts/kernel/toEcdsaKernelSmartAccount.ts +15 -12
  232. package/accounts/kernel/utils/encodeCallData.ts +4 -4
  233. package/accounts/kernel/utils/getNonceKey.ts +3 -3
  234. package/accounts/kernel/utils/isKernelV2.ts +1 -1
  235. package/accounts/kernel/utils/signMessage.ts +5 -3
  236. package/accounts/kernel/utils/signTypedData.ts +5 -3
  237. package/accounts/kernel/utils/wrapMessageHash.ts +11 -7
  238. package/accounts/light/toLightSmartAccount.ts +3 -3
  239. package/accounts/nexus/toNexusSmartAccount.ts +3 -3
  240. package/accounts/safe/toSafeSmartAccount.ts +4 -4
  241. package/accounts/simple/toSimpleSmartAccount.ts +3 -3
  242. package/accounts/thirdweb/toThirdwebSmartAccount.ts +7 -7
  243. package/accounts/trust/toTrustSmartAccount.ts +5 -5
  244. package/actions/erc7579/accountId.ts +1 -1
  245. package/actions/erc7579/installModule.ts +3 -3
  246. package/actions/erc7579/installModules.ts +2 -2
  247. package/actions/erc7579/isModuleInstalled.ts +2 -2
  248. package/actions/erc7579/supportsExecutionMode.ts +1 -1
  249. package/actions/erc7579/supportsModule.ts +1 -1
  250. package/actions/erc7579/uninstallModule.ts +3 -3
  251. package/actions/erc7579/uninstallModules.ts +2 -2
  252. package/actions/erc7579.ts +13 -10
  253. package/actions/index.ts +4 -4
  254. package/actions/pimlico/getTokenQuotes.ts +1 -1
  255. package/actions/pimlico/getUserOperationGasPrice.ts +1 -1
  256. package/actions/pimlico/getUserOperationStatus.ts +1 -1
  257. package/actions/pimlico/sendCompressedUserOperation.ts +1 -1
  258. package/actions/pimlico/sponsorUserOperation.ts +2 -2
  259. package/actions/pimlico/validateSponsorshipPolicies.ts +2 -2
  260. package/actions/pimlico.ts +8 -8
  261. package/actions/public/getSenderAddress.test.ts +1 -1
  262. package/actions/public/getSenderAddress.ts +42 -186
  263. package/actions/smartAccount/sendTransaction.ts +1 -1
  264. package/actions/smartAccount/signMessage.ts +1 -1
  265. package/actions/smartAccount/signTypedData.ts +1 -1
  266. package/actions/smartAccount/writeContract.ts +1 -1
  267. package/actions/smartAccount.ts +4 -4
  268. package/clients/createSmartAccountClient.ts +3 -3
  269. package/clients/decorators/pimlico.ts +4 -4
  270. package/clients/decorators/smartAccount.ts +12 -14
  271. package/clients/index.ts +2 -2
  272. package/clients/pimlico.ts +2 -2
  273. package/experimental/pimlico/index.ts +1 -1
  274. package/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.test.ts +16 -11
  275. package/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.ts +3 -2
  276. package/index.ts +3 -3
  277. package/package.json +1 -1
  278. package/utils/encode7579Calls.ts +1 -1
  279. package/utils/encodeInstallModule.ts +2 -2
  280. package/utils/encodeUninstallModule.ts +2 -2
  281. package/utils/index.ts +15 -12
@@ -7,11 +7,11 @@ import {
7
7
  } from "viem/account-abstraction"
8
8
  import { getAction } from "viem/utils"
9
9
  import { parseAccount } from "viem/utils"
10
- import { AccountNotFoundError } from "../../errors"
10
+ import { AccountNotFoundError } from "../../errors/index.js"
11
11
  import {
12
12
  type EncodeUninstallModuleParameters,
13
13
  encodeUninstallModule
14
- } from "../../utils/encodeUninstallModule"
14
+ } from "../../utils/encodeUninstallModule.js"
15
15
 
16
16
  export type UninstallModulesParameters<
17
17
  TSmartAccount extends SmartAccount | undefined,
@@ -3,37 +3,40 @@ import type {
3
3
  GetSmartAccountParameter,
4
4
  SmartAccount
5
5
  } from "viem/account-abstraction"
6
- import { accountId } from "./erc7579/accountId"
6
+ import { accountId } from "./erc7579/accountId.js"
7
7
  import {
8
8
  type InstallModuleParameters,
9
9
  installModule
10
- } from "./erc7579/installModule"
10
+ } from "./erc7579/installModule.js"
11
11
  import {
12
12
  type InstallModulesParameters,
13
13
  installModules
14
- } from "./erc7579/installModules"
14
+ } from "./erc7579/installModules.js"
15
15
  import {
16
16
  type IsModuleInstalledParameters,
17
17
  isModuleInstalled
18
- } from "./erc7579/isModuleInstalled"
18
+ } from "./erc7579/isModuleInstalled.js"
19
19
  import {
20
20
  type SupportsExecutionModeParameters,
21
21
  supportsExecutionMode
22
- } from "./erc7579/supportsExecutionMode"
23
- import type { CallType, ExecutionMode } from "./erc7579/supportsExecutionMode"
22
+ } from "./erc7579/supportsExecutionMode.js"
23
+ import type {
24
+ CallType,
25
+ ExecutionMode
26
+ } from "./erc7579/supportsExecutionMode.js"
24
27
  import {
25
28
  type SupportsModuleParameters,
26
29
  supportsModule
27
- } from "./erc7579/supportsModule"
28
- import type { ModuleType } from "./erc7579/supportsModule"
30
+ } from "./erc7579/supportsModule.js"
31
+ import type { ModuleType } from "./erc7579/supportsModule.js"
29
32
  import {
30
33
  type UninstallModuleParameters,
31
34
  uninstallModule
32
- } from "./erc7579/uninstallModule"
35
+ } from "./erc7579/uninstallModule.js"
33
36
  import {
34
37
  type UninstallModulesParameters,
35
38
  uninstallModules
36
- } from "./erc7579/uninstallModules"
39
+ } from "./erc7579/uninstallModules.js"
37
40
 
38
41
  export type Erc7579Actions<TSmartAccount extends SmartAccount | undefined> = {
39
42
  accountId: (
package/actions/index.ts CHANGED
@@ -1,11 +1,11 @@
1
- import type { GetSenderAddressParams } from "./public/getSenderAddress"
1
+ import type { GetSenderAddressParams } from "./public/getSenderAddress.js"
2
2
  import {
3
3
  InvalidEntryPointError,
4
4
  getSenderAddress
5
- } from "./public/getSenderAddress"
5
+ } from "./public/getSenderAddress.js"
6
6
 
7
- import type { GetAccountNonceParams } from "./public/getAccountNonce"
8
- import { getAccountNonce } from "./public/getAccountNonce"
7
+ import type { GetAccountNonceParams } from "./public/getAccountNonce.js"
8
+ import { getAccountNonce } from "./public/getAccountNonce.js"
9
9
 
10
10
  export type { GetSenderAddressParams, GetAccountNonceParams }
11
11
 
@@ -9,7 +9,7 @@ import {
9
9
  hexToBigInt,
10
10
  numberToHex
11
11
  } from "viem"
12
- import type { PimlicoRpcSchema } from "../../types/pimlico"
12
+ import type { PimlicoRpcSchema } from "../../types/pimlico.js"
13
13
 
14
14
  export type GetTokenQuotesParameters<
15
15
  TChain extends Chain | undefined,
@@ -1,5 +1,5 @@
1
1
  import type { Account, Chain, Client, Transport } from "viem"
2
- import type { PimlicoRpcSchema } from "../../types/pimlico"
2
+ import type { PimlicoRpcSchema } from "../../types/pimlico.js"
3
3
 
4
4
  export type GetUserOperationGasPriceReturnType = {
5
5
  slow: {
@@ -2,7 +2,7 @@ import type { Account, Chain, Client, Hash, Transport } from "viem"
2
2
  import type {
3
3
  PimlicoRpcSchema,
4
4
  PimlicoUserOperationStatus
5
- } from "../../types/pimlico"
5
+ } from "../../types/pimlico.js"
6
6
 
7
7
  export type GetUserOperationStatusParameters = {
8
8
  hash: Hash
@@ -7,7 +7,7 @@ import type {
7
7
  Hex,
8
8
  Transport
9
9
  } from "viem"
10
- import type { PimlicoRpcSchema } from "../../types/pimlico"
10
+ import type { PimlicoRpcSchema } from "../../types/pimlico.js"
11
11
 
12
12
  export type SendCompressedUserOperationParameters = {
13
13
  compressedUserOperation: Hex
@@ -9,8 +9,8 @@ import type {
9
9
  Transport
10
10
  } from "viem"
11
11
  import type { UserOperation } from "viem/account-abstraction"
12
- import type { PimlicoRpcSchema } from "../../types/pimlico"
13
- import { deepHexlify } from "../../utils/deepHexlify"
12
+ import type { PimlicoRpcSchema } from "../../types/pimlico.js"
13
+ import { deepHexlify } from "../../utils/deepHexlify.js"
14
14
 
15
15
  export type PimlicoSponsorUserOperationParameters<
16
16
  entryPointVersion extends "0.6" | "0.7"
@@ -1,7 +1,7 @@
1
1
  import type { Account, Address, Chain, Client, Transport } from "viem"
2
2
  import type { UserOperation } from "viem/account-abstraction"
3
- import type { PimlicoRpcSchema } from "../../types/pimlico"
4
- import { deepHexlify } from "../../utils/deepHexlify"
3
+ import type { PimlicoRpcSchema } from "../../types/pimlico.js"
4
+ import { deepHexlify } from "../../utils/deepHexlify.js"
5
5
 
6
6
  export type ValidateSponsorshipPoliciesParameters = {
7
7
  userOperation: UserOperation
@@ -2,34 +2,34 @@ import {
2
2
  type GetTokenQuotesParameters,
3
3
  type GetTokenQuotesReturnType,
4
4
  getTokenQuotes
5
- } from "./pimlico/getTokenQuotes"
5
+ } from "./pimlico/getTokenQuotes.js"
6
6
  import {
7
7
  type GetUserOperationGasPriceReturnType,
8
8
  getUserOperationGasPrice
9
- } from "./pimlico/getUserOperationGasPrice"
9
+ } from "./pimlico/getUserOperationGasPrice.js"
10
10
  import {
11
11
  type GetUserOperationStatusParameters,
12
12
  type GetUserOperationStatusReturnType,
13
13
  getUserOperationStatus
14
- } from "./pimlico/getUserOperationStatus"
14
+ } from "./pimlico/getUserOperationStatus.js"
15
15
  import {
16
16
  type SendCompressedUserOperationParameters,
17
17
  sendCompressedUserOperation
18
- } from "./pimlico/sendCompressedUserOperation"
18
+ } from "./pimlico/sendCompressedUserOperation.js"
19
19
  import {
20
20
  type PimlicoSponsorUserOperationParameters,
21
21
  type SponsorUserOperationReturnType,
22
22
  sponsorUserOperation
23
- } from "./pimlico/sponsorUserOperation"
23
+ } from "./pimlico/sponsorUserOperation.js"
24
24
 
25
- import type { PimlicoActions } from "../clients/decorators/pimlico"
26
- import { pimlicoActions } from "../clients/decorators/pimlico"
25
+ import type { PimlicoActions } from "../clients/decorators/pimlico.js"
26
+ import { pimlicoActions } from "../clients/decorators/pimlico.js"
27
27
 
28
28
  import {
29
29
  type ValidateSponsorshipPolicies,
30
30
  type ValidateSponsorshipPoliciesParameters,
31
31
  validateSponsorshipPolicies
32
- } from "./pimlico/validateSponsorshipPolicies"
32
+ } from "./pimlico/validateSponsorshipPolicies.js"
33
33
 
34
34
  export type {
35
35
  GetUserOperationGasPriceReturnType,
@@ -78,7 +78,7 @@ describe("getSenderAddress", () => {
78
78
  entryPointAddress: "0x0000000000000000000000000000000000000000",
79
79
  initCode: concatHex([factory, factoryData])
80
80
  })
81
- ).rejects.toThrowError(/not a valid entry point/)
81
+ ).rejects.toThrowError()
82
82
  })
83
83
  testWithRpc("getSenderAddress_V07", async ({ rpc }) => {
84
84
  const { anvilRpc, altoRpc } = rpc
@@ -2,22 +2,40 @@ import {
2
2
  type Address,
3
3
  BaseError,
4
4
  type Client,
5
- type ContractFunctionExecutionErrorType,
6
- ContractFunctionRevertedError,
7
5
  type Hex,
8
- InvalidInputRpcError,
9
6
  type OneOf,
10
7
  type Prettify,
11
- RawContractError,
12
- RpcRequestError,
13
- UnknownRpcError,
14
8
  concat,
15
- decodeErrorResult
9
+ encodeDeployData,
10
+ getAddress
16
11
  } from "viem"
17
12
 
18
- import { simulateContract } from "viem/actions"
13
+ import { call } from "viem/actions"
19
14
  import { getAction } from "viem/utils"
20
15
 
16
+ // https://github.com/pimlicolabs/entrypoint-estimations/blob/main/src/GetSenderAddressHelper.sol
17
+ const GetSenderAddressHelperByteCode =
18
+ "0x608060405260405161058a38038061058a83398181016040528101906100259190610341565b5f808373ffffffffffffffffffffffffffffffffffffffff16639b249f6960e01b8460405160240161005791906103ed565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516100c19190610447565b5f604051808303815f865af19150503d805f81146100fa576040519150601f19603f3d011682016040523d82523d5f602084013e6100ff565b606091505b50915091505f8261015f576004825111156101245760248201519050805f526014600cf35b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610156906104dd565b60405180910390fd5b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101919061056b565b60405180910390fd5b5f604051905090565b5f80fd5b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6101d4826101ab565b9050919050565b6101e4816101ca565b81146101ee575f80fd5b50565b5f815190506101ff816101db565b92915050565b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6102538261020d565b810181811067ffffffffffffffff821117156102725761027161021d565b5b80604052505050565b5f61028461019a565b9050610290828261024a565b919050565b5f67ffffffffffffffff8211156102af576102ae61021d565b5b6102b88261020d565b9050602081019050919050565b8281835e5f83830152505050565b5f6102e56102e084610295565b61027b565b90508281526020810184848401111561030157610300610209565b5b61030c8482856102c5565b509392505050565b5f82601f83011261032857610327610205565b5b81516103388482602086016102d3565b91505092915050565b5f8060408385031215610357576103566101a3565b5b5f610364858286016101f1565b925050602083015167ffffffffffffffff811115610385576103846101a7565b5b61039185828601610314565b9150509250929050565b5f81519050919050565b5f82825260208201905092915050565b5f6103bf8261039b565b6103c981856103a5565b93506103d98185602086016102c5565b6103e28161020d565b840191505092915050565b5f6020820190508181035f83015261040581846103b5565b905092915050565b5f81905092915050565b5f6104218261039b565b61042b818561040d565b935061043b8185602086016102c5565b80840191505092915050565b5f6104528284610417565b915081905092915050565b5f82825260208201905092915050565b7f67657453656e64657241646472657373206661696c656420776974686f7574205f8201527f6461746100000000000000000000000000000000000000000000000000000000602082015250565b5f6104c760248361045d565b91506104d28261046d565b604082019050919050565b5f6020820190508181035f8301526104f4816104bb565b9050919050565b7f67657453656e6465724164647265737320646964206e6f7420726576657274205f8201527f6173206578706563746564000000000000000000000000000000000000000000602082015250565b5f610555602b8361045d565b9150610560826104fb565b604082019050919050565b5f6020820190508181035f83015261058281610549565b905091905056fe"
19
+
20
+ const GetSenderAddressHelperAbi = [
21
+ {
22
+ inputs: [
23
+ {
24
+ internalType: "address",
25
+ name: "_entryPoint",
26
+ type: "address"
27
+ },
28
+ {
29
+ internalType: "bytes",
30
+ name: "initCode",
31
+ type: "bytes"
32
+ }
33
+ ],
34
+ stateMutability: "payable",
35
+ type: "constructor"
36
+ }
37
+ ]
38
+
21
39
  export type GetSenderAddressParams = OneOf<
22
40
  | {
23
41
  initCode: Hex
@@ -88,186 +106,24 @@ export const getSenderAddress = async (
88
106
  )
89
107
  }
90
108
 
91
- try {
92
- await getAction(
93
- client,
94
- simulateContract,
95
- "simulateContract"
96
- )({
97
- address: entryPointAddress,
98
- abi: [
99
- {
100
- inputs: [
101
- {
102
- internalType: "address",
103
- name: "sender",
104
- type: "address"
105
- }
106
- ],
107
- name: "SenderAddressResult",
108
- type: "error"
109
- },
110
- {
111
- inputs: [
112
- {
113
- internalType: "bytes",
114
- name: "initCode",
115
- type: "bytes"
116
- }
117
- ],
118
- name: "getSenderAddress",
119
- outputs: [],
120
- stateMutability: "nonpayable",
121
- type: "function"
122
- }
123
- ],
124
- functionName: "getSenderAddress",
125
- args: [initCode || concat([factory as Hex, factoryData as Hex])]
109
+ const formattedInitCode =
110
+ initCode || concat([factory as Hex, factoryData as Hex])
111
+
112
+ const { data } = await getAction(
113
+ client,
114
+ call,
115
+ "call"
116
+ )({
117
+ data: encodeDeployData({
118
+ abi: GetSenderAddressHelperAbi,
119
+ bytecode: GetSenderAddressHelperByteCode,
120
+ args: [entryPointAddress, formattedInitCode]
126
121
  })
127
- } catch (e) {
128
- const revertError = (e as ContractFunctionExecutionErrorType).walk(
129
- (err) =>
130
- err instanceof ContractFunctionRevertedError ||
131
- err instanceof RpcRequestError ||
132
- err instanceof InvalidInputRpcError ||
133
- err instanceof UnknownRpcError
134
- )
135
-
136
- if (!revertError) {
137
- const cause = (e as ContractFunctionExecutionErrorType).cause as any
138
- const errorName = cause?.data?.errorName ?? ""
139
- if (
140
- errorName === "SenderAddressResult" &&
141
- cause?.data?.args &&
142
- cause?.data?.args[0]
143
- ) {
144
- return cause.data?.args[0] as Address
145
- }
146
- }
147
-
148
- if (revertError instanceof ContractFunctionRevertedError) {
149
- const errorName = revertError.data?.errorName ?? ""
150
- if (
151
- errorName === "SenderAddressResult" &&
152
- revertError.data?.args &&
153
- revertError.data?.args[0]
154
- ) {
155
- return revertError.data?.args[0] as Address
156
- }
157
- }
158
-
159
- if (revertError instanceof RpcRequestError) {
160
- const hexStringRegex = /0x[a-fA-F0-9]+/
161
- // biome-ignore lint/suspicious/noExplicitAny:
162
- const match = (revertError as unknown as any).cause.data.match(
163
- hexStringRegex
164
- )
165
-
166
- if (!match) {
167
- throw new Error(
168
- "Failed to parse revert bytes from RPC response"
169
- )
170
- }
171
-
172
- const data: Hex = match[0]
173
-
174
- const error = decodeErrorResult({
175
- abi: [
176
- {
177
- inputs: [
178
- {
179
- internalType: "address",
180
- name: "sender",
181
- type: "address"
182
- }
183
- ],
184
- name: "SenderAddressResult",
185
- type: "error"
186
- }
187
- ],
188
- data
189
- })
190
-
191
- return error.args[0] as Address
192
- }
193
-
194
- if (revertError instanceof InvalidInputRpcError) {
195
- const { data: data_ } = (
196
- e instanceof RawContractError
197
- ? e
198
- : e instanceof BaseError
199
- ? e.walk((err) => "data" in (err as Error)) || e.walk()
200
- : {}
201
- ) as RawContractError
202
-
203
- const data = typeof data_ === "string" ? data_ : data_?.data
204
-
205
- if (data === undefined) {
206
- throw new Error(
207
- "Failed to parse revert bytes from RPC response"
208
- )
209
- }
210
-
211
- const error = decodeErrorResult({
212
- abi: [
213
- {
214
- inputs: [
215
- {
216
- internalType: "address",
217
- name: "sender",
218
- type: "address"
219
- }
220
- ],
221
- name: "SenderAddressResult",
222
- type: "error"
223
- }
224
- ],
225
- data
226
- })
227
-
228
- return error.args[0] as Address
229
- }
230
-
231
- if (revertError instanceof UnknownRpcError) {
232
- const parsedBody = JSON.parse(
233
- // biome-ignore lint/suspicious/noExplicitAny:
234
- (revertError as unknown as any).cause.body
235
- )
236
- const revertData = parsedBody.error.data
237
-
238
- const hexStringRegex = /0x[a-fA-F0-9]+/
239
- const match = revertData.match(hexStringRegex)
240
-
241
- if (!match) {
242
- throw new Error(
243
- "Failed to parse revert bytes from RPC response"
244
- )
245
- }
246
-
247
- const data: Hex = match[0]
248
-
249
- const error = decodeErrorResult({
250
- abi: [
251
- {
252
- inputs: [
253
- {
254
- internalType: "address",
255
- name: "sender",
256
- type: "address"
257
- }
258
- ],
259
- name: "SenderAddressResult",
260
- type: "error"
261
- }
262
- ],
263
- data
264
- })
265
-
266
- return error.args[0] as Address
267
- }
122
+ })
268
123
 
269
- throw e
124
+ if (!data) {
125
+ throw new Error("Failed to get sender address")
270
126
  }
271
127
 
272
- throw new InvalidEntryPointError({ entryPointAddress })
128
+ return getAddress(data)
273
129
  }
@@ -12,7 +12,7 @@ import {
12
12
  waitForUserOperationReceipt
13
13
  } from "viem/account-abstraction"
14
14
  import { getAction, parseAccount } from "viem/utils"
15
- import { AccountNotFoundError } from "../../errors"
15
+ import { AccountNotFoundError } from "../../errors/index.js"
16
16
 
17
17
  /**
18
18
  * Creates, signs, and sends a new transaction to the network.
@@ -7,7 +7,7 @@ import type {
7
7
  } from "viem"
8
8
  import type { SmartAccount } from "viem/account-abstraction"
9
9
  import { parseAccount } from "viem/utils"
10
- import { AccountNotFoundError } from "../../errors"
10
+ import { AccountNotFoundError } from "../../errors/index.js"
11
11
 
12
12
  /**
13
13
  * Calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191): `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`.
@@ -12,7 +12,7 @@ import {
12
12
  } from "viem"
13
13
  import type { SmartAccount } from "viem/account-abstraction"
14
14
  import { parseAccount } from "viem/utils"
15
- import { AccountNotFoundError } from "../../errors"
15
+ import { AccountNotFoundError } from "../../errors/index.js"
16
16
 
17
17
  /**
18
18
  * Signs typed data and calculates an Ethereum-specific signature in [https://eips.ethereum.org/EIPS/eip-712](https://eips.ethereum.org/EIPS/eip-712): `sign(keccak256("\x19\x01" ‖ domainSeparator ‖ hashStruct(message)))`
@@ -13,7 +13,7 @@ import {
13
13
  } from "viem"
14
14
  import type { SmartAccount } from "viem/account-abstraction"
15
15
  import { getAction } from "viem/utils"
16
- import { sendTransaction } from "./sendTransaction"
16
+ import { sendTransaction } from "./sendTransaction.js"
17
17
 
18
18
  export async function writeContract<
19
19
  TChain extends Chain | undefined,
@@ -1,9 +1,9 @@
1
- import { sendTransaction } from "./smartAccount/sendTransaction"
1
+ import { sendTransaction } from "./smartAccount/sendTransaction.js"
2
2
 
3
- import { signMessage } from "./smartAccount/signMessage"
3
+ import { signMessage } from "./smartAccount/signMessage.js"
4
4
 
5
- import { signTypedData } from "./smartAccount/signTypedData"
5
+ import { signTypedData } from "./smartAccount/signTypedData.js"
6
6
 
7
- import { writeContract } from "./smartAccount/writeContract"
7
+ import { writeContract } from "./smartAccount/writeContract.js"
8
8
 
9
9
  export { sendTransaction, signMessage, signTypedData, writeContract }
@@ -22,7 +22,7 @@ import {
22
22
  import {
23
23
  type SmartAccountActions,
24
24
  smartAccountActions
25
- } from "./decorators/smartAccount"
25
+ } from "./decorators/smartAccount.js"
26
26
 
27
27
  /**
28
28
  * TODO:
@@ -172,10 +172,10 @@ export function createSmartAccountClient(
172
172
  return customPrepareUserOp(client, args)
173
173
  }
174
174
  }))
175
- .extend(smartAccountActions()) as SmartAccountClient
175
+ .extend(smartAccountActions) as SmartAccountClient
176
176
  }
177
177
 
178
178
  return client
179
179
  .extend(bundlerActions)
180
- .extend(smartAccountActions()) as SmartAccountClient
180
+ .extend(smartAccountActions) as SmartAccountClient
181
181
  }
@@ -8,21 +8,21 @@ import {
8
8
  getTokenQuotes,
9
9
  sendCompressedUserOperation,
10
10
  validateSponsorshipPolicies
11
- } from "../../actions/pimlico"
11
+ } from "../../actions/pimlico.js"
12
12
  import {
13
13
  type GetUserOperationGasPriceReturnType,
14
14
  getUserOperationGasPrice
15
- } from "../../actions/pimlico/getUserOperationGasPrice"
15
+ } from "../../actions/pimlico/getUserOperationGasPrice.js"
16
16
  import {
17
17
  type GetUserOperationStatusParameters,
18
18
  type GetUserOperationStatusReturnType,
19
19
  getUserOperationStatus
20
- } from "../../actions/pimlico/getUserOperationStatus"
20
+ } from "../../actions/pimlico/getUserOperationStatus.js"
21
21
  import {
22
22
  type PimlicoSponsorUserOperationParameters,
23
23
  type SponsorUserOperationReturnType,
24
24
  sponsorUserOperation
25
- } from "../../actions/pimlico/sponsorUserOperation"
25
+ } from "../../actions/pimlico/sponsorUserOperation.js"
26
26
 
27
27
  export type PimlicoActions<
28
28
  TChain extends Chain | undefined,
@@ -11,10 +11,10 @@ import type {
11
11
  WriteContractParameters
12
12
  } from "viem"
13
13
  import type { SmartAccount } from "viem/account-abstraction"
14
- import { sendTransaction } from "../../actions/smartAccount/sendTransaction"
15
- import { signMessage } from "../../actions/smartAccount/signMessage"
16
- import { signTypedData } from "../../actions/smartAccount/signTypedData"
17
- import { writeContract } from "../../actions/smartAccount/writeContract"
14
+ import { sendTransaction } from "../../actions/smartAccount/sendTransaction.js"
15
+ import { signMessage } from "../../actions/smartAccount/signMessage.js"
16
+ import { signTypedData } from "../../actions/smartAccount/signTypedData.js"
17
+ import { writeContract } from "../../actions/smartAccount/writeContract.js"
18
18
 
19
19
  export type SmartAccountActions<
20
20
  TChain extends Chain | undefined = Chain | undefined,
@@ -311,18 +311,16 @@ export type SmartAccountActions<
311
311
  >
312
312
  }
313
313
 
314
- export function smartAccountActions() {
315
- return <
316
- TChain extends Chain | undefined = Chain | undefined,
317
- TSmartAccount extends SmartAccount | undefined =
318
- | SmartAccount
319
- | undefined
320
- >(
321
- client: Client<Transport, TChain, TSmartAccount>
322
- ): SmartAccountActions<TChain, TSmartAccount> => ({
314
+ export function smartAccountActions<
315
+ TChain extends Chain | undefined = Chain | undefined,
316
+ TSmartAccount extends SmartAccount | undefined = SmartAccount | undefined
317
+ >(
318
+ client: Client<Transport, TChain, TSmartAccount>
319
+ ): SmartAccountActions<TChain, TSmartAccount> {
320
+ return {
323
321
  sendTransaction: (args) => sendTransaction(client, args as any),
324
322
  signMessage: (args) => signMessage(client, args),
325
323
  signTypedData: (args) => signTypedData(client, args),
326
324
  writeContract: (args) => writeContract(client, args)
327
- })
325
+ }
328
326
  }
package/clients/index.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from "./createSmartAccountClient"
2
- export * from "./decorators/smartAccount"
1
+ export * from "./createSmartAccountClient.js"
2
+ export * from "./decorators/smartAccount.js"
@@ -17,8 +17,8 @@ import {
17
17
  entryPoint07Address,
18
18
  paymasterActions
19
19
  } from "viem/account-abstraction"
20
- import type { PimlicoRpcSchema } from "../types/pimlico"
21
- import { type PimlicoActions, pimlicoActions } from "./decorators/pimlico"
20
+ import type { PimlicoRpcSchema } from "../types/pimlico.js"
21
+ import { type PimlicoActions, pimlicoActions } from "./decorators/pimlico.js"
22
22
 
23
23
  export type PimlicoClient<
24
24
  entryPointVersion extends "0.6" | "0.7" = "0.7" | "0.6",
@@ -1,2 +1,2 @@
1
- import { prepareUserOperationForErc20Paymaster } from "./utils/prepareUserOperationForErc20Paymaster"
1
+ import { prepareUserOperationForErc20Paymaster } from "./utils/prepareUserOperationForErc20Paymaster.js"
2
2
  export { prepareUserOperationForErc20Paymaster }