zksync-sso 0.5.0-beta.3 → 1.0.0-beta.2

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 (595) hide show
  1. package/dist/_cjs/abi/SessionKeyValidator.js +729 -993
  2. package/dist/_cjs/abi/SessionKeyValidator.js.map +1 -1
  3. package/dist/_cjs/abi/{WebAuthValidator.js → WebAuthnValidator.js} +273 -306
  4. package/dist/_cjs/abi/WebAuthnValidator.js.map +1 -0
  5. package/dist/_cjs/abi/index.js +17 -15
  6. package/dist/_cjs/abi/index.js.map +1 -1
  7. package/dist/_cjs/actions/sendUserOperation.js +14 -0
  8. package/dist/_cjs/actions/sendUserOperation.js.map +1 -0
  9. package/dist/_cjs/client/actions/deploy.js +53 -0
  10. package/dist/_cjs/client/actions/deploy.js.map +1 -0
  11. package/dist/_cjs/client/actions/index.js +22 -0
  12. package/dist/_cjs/client/actions/index.js.map +1 -0
  13. package/dist/_cjs/client/actions/modules.js +42 -0
  14. package/dist/_cjs/client/actions/modules.js.map +1 -0
  15. package/dist/_cjs/client/actions/passkey.js +89 -0
  16. package/dist/_cjs/client/actions/passkey.js.map +1 -0
  17. package/dist/_cjs/client/actions/sessions.js +178 -0
  18. package/dist/_cjs/client/actions/sessions.js.map +1 -0
  19. package/dist/_cjs/client/actions/utils.js +8 -0
  20. package/dist/_cjs/client/actions/utils.js.map +1 -0
  21. package/dist/_cjs/client/common/smart-account-client-actions.js +173 -0
  22. package/dist/_cjs/client/common/smart-account-client-actions.js.map +1 -0
  23. package/dist/_cjs/client/ecdsa/account.js +75 -30
  24. package/dist/_cjs/client/ecdsa/account.js.map +1 -1
  25. package/dist/_cjs/client/ecdsa/client-actions.js +14 -0
  26. package/dist/_cjs/client/ecdsa/client-actions.js.map +1 -0
  27. package/dist/_cjs/client/ecdsa/client.js +29 -23
  28. package/dist/_cjs/client/ecdsa/client.js.map +1 -1
  29. package/dist/_cjs/client/ecdsa/index.js +5 -5
  30. package/dist/_cjs/client/ecdsa/index.js.map +1 -1
  31. package/dist/_cjs/client/index.js +7 -82
  32. package/dist/_cjs/client/index.js.map +1 -1
  33. package/dist/_cjs/client/passkey/account.js +88 -33
  34. package/dist/_cjs/client/passkey/account.js.map +1 -1
  35. package/dist/_cjs/client/passkey/client-actions.js +42 -0
  36. package/dist/_cjs/client/passkey/client-actions.js.map +1 -0
  37. package/dist/_cjs/client/passkey/client.js +32 -41
  38. package/dist/_cjs/client/passkey/client.js.map +1 -1
  39. package/dist/_cjs/client/passkey/index.js +14 -18
  40. package/dist/_cjs/client/passkey/index.js.map +1 -1
  41. package/dist/_cjs/client/passkey/webauthn.js +381 -0
  42. package/dist/_cjs/client/passkey/webauthn.js.map +1 -0
  43. package/dist/_cjs/client/session/account.js +91 -34
  44. package/dist/_cjs/client/session/account.js.map +1 -1
  45. package/dist/_cjs/client/session/client-actions.js +19 -0
  46. package/dist/_cjs/client/session/client-actions.js.map +1 -0
  47. package/dist/_cjs/client/session/client.js +29 -83
  48. package/dist/_cjs/client/session/client.js.map +1 -1
  49. package/dist/_cjs/client/session/formatSessionPreferences.js +263 -0
  50. package/dist/_cjs/client/session/formatSessionPreferences.js.map +1 -0
  51. package/dist/_cjs/client/session/index.js +5 -0
  52. package/dist/_cjs/client/session/index.js.map +1 -1
  53. package/dist/_cjs/client/session/monitor.js +138 -0
  54. package/dist/_cjs/client/session/monitor.js.map +1 -0
  55. package/dist/_cjs/client/session/types.js +83 -0
  56. package/dist/_cjs/client/session/types.js.map +1 -0
  57. package/dist/_cjs/client/session/utils.js +95 -0
  58. package/dist/_cjs/client/session/utils.js.map +1 -0
  59. package/dist/_cjs/client-auth-server/Signer.js +67 -43
  60. package/dist/_cjs/client-auth-server/Signer.js.map +1 -1
  61. package/dist/_cjs/client-auth-server/WalletProvider.js +6 -7
  62. package/dist/_cjs/client-auth-server/WalletProvider.js.map +1 -1
  63. package/dist/_cjs/client-auth-server/session/index.js +36 -21
  64. package/dist/_cjs/client-auth-server/session/index.js.map +1 -1
  65. package/dist/_cjs/client-auth-server/session/utils.js.map +1 -1
  66. package/dist/_cjs/client-auth-server/utils/helpers.js.map +1 -0
  67. package/dist/_cjs/{client/recovery → client-auth-server/utils}/index.js +2 -2
  68. package/dist/_cjs/client-auth-server/utils/index.js.map +1 -0
  69. package/dist/_cjs/client-auth-server/utils/storage.js.map +1 -0
  70. package/dist/_cjs/connector/index.js +92 -13
  71. package/dist/_cjs/connector/index.js.map +1 -1
  72. package/dist/_cjs/index.js +19 -3
  73. package/dist/_cjs/index.js.map +1 -1
  74. package/dist/_esm/abi/SessionKeyValidator.js +729 -993
  75. package/dist/_esm/abi/SessionKeyValidator.js.map +1 -1
  76. package/dist/_esm/abi/{WebAuthValidator.js → WebAuthnValidator.js} +272 -305
  77. package/dist/_esm/abi/WebAuthnValidator.js.map +1 -0
  78. package/dist/_esm/abi/index.js +3 -7
  79. package/dist/_esm/abi/index.js.map +1 -1
  80. package/dist/_esm/actions/sendUserOperation.js +26 -0
  81. package/dist/_esm/actions/sendUserOperation.js.map +1 -0
  82. package/dist/_esm/client/actions/deploy.js +114 -0
  83. package/dist/_esm/client/actions/deploy.js.map +1 -0
  84. package/dist/_esm/client/actions/index.js +7 -0
  85. package/dist/_esm/client/actions/index.js.map +1 -0
  86. package/dist/_esm/client/actions/modules.js +75 -0
  87. package/dist/_esm/client/actions/modules.js.map +1 -0
  88. package/dist/_esm/client/actions/passkey.js +200 -0
  89. package/dist/_esm/client/actions/passkey.js.map +1 -0
  90. package/dist/_esm/client/actions/sessions.js +279 -0
  91. package/dist/_esm/client/actions/sessions.js.map +1 -0
  92. package/dist/_esm/client/actions/utils.js +27 -0
  93. package/dist/_esm/client/actions/utils.js.map +1 -0
  94. package/dist/_esm/client/common/smart-account-client-actions.js +209 -0
  95. package/dist/_esm/client/common/smart-account-client-actions.js.map +1 -0
  96. package/dist/_esm/client/ecdsa/account.js +91 -29
  97. package/dist/_esm/client/ecdsa/account.js.map +1 -1
  98. package/dist/_esm/client/ecdsa/client-actions.js +16 -0
  99. package/dist/_esm/client/ecdsa/client-actions.js.map +1 -0
  100. package/dist/_esm/client/ecdsa/client.js +90 -23
  101. package/dist/_esm/client/ecdsa/client.js.map +1 -1
  102. package/dist/_esm/client/ecdsa/index.js +2 -5
  103. package/dist/_esm/client/ecdsa/index.js.map +1 -1
  104. package/dist/_esm/client/index.js +6 -77
  105. package/dist/_esm/client/index.js.map +1 -1
  106. package/dist/_esm/client/passkey/account.js +118 -32
  107. package/dist/_esm/client/passkey/account.js.map +1 -1
  108. package/dist/_esm/client/passkey/client-actions.js +51 -0
  109. package/dist/_esm/client/passkey/client-actions.js.map +1 -0
  110. package/dist/_esm/client/passkey/client.js +99 -42
  111. package/dist/_esm/client/passkey/client.js.map +1 -1
  112. package/dist/_esm/client/passkey/index.js +4 -4
  113. package/dist/_esm/client/passkey/index.js.map +1 -1
  114. package/dist/_esm/client/passkey/webauthn.js +493 -0
  115. package/dist/_esm/client/passkey/webauthn.js.map +1 -0
  116. package/dist/_esm/client/session/account.js +114 -33
  117. package/dist/_esm/client/session/account.js.map +1 -1
  118. package/dist/_esm/client/session/client-actions.js +20 -0
  119. package/dist/_esm/client/session/client-actions.js.map +1 -0
  120. package/dist/_esm/client/session/client.js +34 -84
  121. package/dist/_esm/client/session/client.js.map +1 -1
  122. package/dist/_esm/client/session/formatSessionPreferences.js +283 -0
  123. package/dist/_esm/client/session/formatSessionPreferences.js.map +1 -0
  124. package/dist/_esm/client/session/index.js +5 -0
  125. package/dist/_esm/client/session/index.js.map +1 -1
  126. package/dist/_esm/client/session/monitor.js +195 -0
  127. package/dist/_esm/client/session/monitor.js.map +1 -0
  128. package/dist/_esm/client/session/types.js +110 -0
  129. package/dist/_esm/client/session/types.js.map +1 -0
  130. package/dist/_esm/client/session/utils.js +115 -0
  131. package/dist/_esm/client/session/utils.js.map +1 -0
  132. package/dist/_esm/client-auth-server/Signer.js +84 -43
  133. package/dist/_esm/client-auth-server/Signer.js.map +1 -1
  134. package/dist/_esm/client-auth-server/WalletProvider.js +6 -5
  135. package/dist/_esm/client-auth-server/WalletProvider.js.map +1 -1
  136. package/dist/_esm/client-auth-server/session/index.js +2 -1
  137. package/dist/_esm/client-auth-server/session/index.js.map +1 -1
  138. package/dist/_esm/client-auth-server/session/utils.js.map +1 -1
  139. package/dist/_esm/client-auth-server/utils/helpers.js.map +1 -0
  140. package/dist/_esm/client-auth-server/utils/index.js +3 -0
  141. package/dist/_esm/client-auth-server/utils/index.js.map +1 -0
  142. package/dist/_esm/client-auth-server/utils/storage.js.map +1 -0
  143. package/dist/_esm/connector/index.js +105 -11
  144. package/dist/_esm/connector/index.js.map +1 -1
  145. package/dist/_esm/index.js +9 -1
  146. package/dist/_esm/index.js.map +1 -1
  147. package/dist/_types/abi/SessionKeyValidator.d.ts +612 -602
  148. package/dist/_types/abi/SessionKeyValidator.d.ts.map +1 -1
  149. package/dist/_types/abi/{WebAuthValidator.d.ts → WebAuthnValidator.d.ts} +234 -186
  150. package/dist/_types/abi/WebAuthnValidator.d.ts.map +1 -0
  151. package/dist/_types/abi/index.d.ts +3 -7
  152. package/dist/_types/abi/index.d.ts.map +1 -1
  153. package/dist/_types/actions/sendUserOperation.d.ts +49 -0
  154. package/dist/_types/actions/sendUserOperation.d.ts.map +1 -0
  155. package/dist/_types/client/actions/deploy.d.ts +108 -0
  156. package/dist/_types/client/actions/deploy.d.ts.map +1 -0
  157. package/dist/_types/client/actions/index.d.ts +10 -0
  158. package/dist/_types/client/actions/index.d.ts.map +1 -0
  159. package/dist/_types/client/actions/modules.d.ts +65 -0
  160. package/dist/_types/client/actions/modules.d.ts.map +1 -0
  161. package/dist/_types/client/actions/passkey.d.ts +192 -0
  162. package/dist/_types/client/actions/passkey.d.ts.map +1 -0
  163. package/dist/_types/client/actions/sessions.d.ts +225 -0
  164. package/dist/_types/client/actions/sessions.d.ts.map +1 -0
  165. package/dist/_types/client/actions/utils.d.ts +25 -0
  166. package/dist/_types/client/actions/utils.d.ts.map +1 -0
  167. package/dist/_types/client/common/smart-account-client-actions.d.ts +50 -0
  168. package/dist/_types/client/common/smart-account-client-actions.d.ts.map +1 -0
  169. package/dist/_types/client/ecdsa/account.d.ts +16 -11
  170. package/dist/_types/client/ecdsa/account.d.ts.map +1 -1
  171. package/dist/_types/client/ecdsa/client-actions.d.ts +25 -0
  172. package/dist/_types/client/ecdsa/client-actions.d.ts.map +1 -0
  173. package/dist/_types/client/ecdsa/client.d.ts +92 -22
  174. package/dist/_types/client/ecdsa/client.d.ts.map +1 -1
  175. package/dist/_types/client/ecdsa/index.d.ts +2 -5
  176. package/dist/_types/client/ecdsa/index.d.ts.map +1 -1
  177. package/dist/_types/client/index.d.ts +7 -31
  178. package/dist/_types/client/index.d.ts.map +1 -1
  179. package/dist/_types/client/passkey/account.d.ts +22 -15
  180. package/dist/_types/client/passkey/account.d.ts.map +1 -1
  181. package/dist/_types/client/passkey/client-actions.d.ts +54 -0
  182. package/dist/_types/client/passkey/client-actions.d.ts.map +1 -0
  183. package/dist/_types/client/passkey/client.d.ts +103 -32
  184. package/dist/_types/client/passkey/client.d.ts.map +1 -1
  185. package/dist/_types/client/passkey/index.d.ts +4 -4
  186. package/dist/_types/client/passkey/index.d.ts.map +1 -1
  187. package/dist/_types/client/passkey/webauthn.d.ts +123 -0
  188. package/dist/_types/client/passkey/webauthn.d.ts.map +1 -0
  189. package/dist/_types/client/session/account.d.ts +26 -13
  190. package/dist/_types/client/session/account.d.ts.map +1 -1
  191. package/dist/_types/client/session/client-actions.d.ts +26 -0
  192. package/dist/_types/client/session/client-actions.d.ts.map +1 -0
  193. package/dist/_types/client/session/client.d.ts +38 -36
  194. package/dist/_types/client/session/client.d.ts.map +1 -1
  195. package/dist/_types/client/session/formatSessionPreferences.d.ts +101 -0
  196. package/dist/_types/client/session/formatSessionPreferences.d.ts.map +1 -0
  197. package/dist/_types/client/session/index.d.ts +5 -0
  198. package/dist/_types/client/session/index.d.ts.map +1 -1
  199. package/dist/_types/client/session/monitor.d.ts +93 -0
  200. package/dist/_types/client/session/monitor.d.ts.map +1 -0
  201. package/dist/_types/client/session/types.d.ts +133 -0
  202. package/dist/_types/client/session/types.d.ts.map +1 -0
  203. package/dist/_types/client/session/utils.d.ts +47 -0
  204. package/dist/_types/client/session/utils.d.ts.map +1 -0
  205. package/dist/_types/client-auth-server/Signer.d.ts +241 -245
  206. package/dist/_types/client-auth-server/Signer.d.ts.map +1 -1
  207. package/dist/_types/client-auth-server/WalletProvider.d.ts +236 -241
  208. package/dist/_types/client-auth-server/WalletProvider.d.ts.map +1 -1
  209. package/dist/_types/client-auth-server/interface.d.ts +2 -2
  210. package/dist/_types/client-auth-server/interface.d.ts.map +1 -1
  211. package/dist/_types/client-auth-server/rpc.d.ts +4 -0
  212. package/dist/_types/client-auth-server/rpc.d.ts.map +1 -1
  213. package/dist/_types/client-auth-server/session/index.d.ts +5 -4
  214. package/dist/_types/client-auth-server/session/index.d.ts.map +1 -1
  215. package/dist/_types/client-auth-server/session/utils.d.ts +3 -3
  216. package/dist/_types/client-auth-server/session/utils.d.ts.map +1 -1
  217. package/dist/_types/client-auth-server/utils/helpers.d.ts.map +1 -0
  218. package/dist/_types/client-auth-server/utils/index.d.ts +3 -0
  219. package/dist/_types/client-auth-server/utils/index.d.ts.map +1 -0
  220. package/dist/_types/client-auth-server/utils/storage.d.ts.map +1 -0
  221. package/dist/_types/communicator/interface.d.ts +5 -0
  222. package/dist/_types/communicator/interface.d.ts.map +1 -1
  223. package/dist/_types/connector/index.d.ts +11 -9
  224. package/dist/_types/connector/index.d.ts.map +1 -1
  225. package/dist/_types/index.d.ts +5 -3
  226. package/dist/_types/index.d.ts.map +1 -1
  227. package/package.json +36 -55
  228. package/prepare-package.mjs +8 -0
  229. package/project.json +7 -7
  230. package/src/abi/SessionKeyValidator.ts +861 -1125
  231. package/src/abi/WebAuthnValidator.ts +324 -0
  232. package/src/abi/index.ts +3 -7
  233. package/src/actions/sendUserOperation.ts +98 -0
  234. package/src/client/actions/deploy.ts +225 -0
  235. package/src/client/actions/index.ts +39 -0
  236. package/src/client/actions/modules.ts +112 -0
  237. package/src/client/actions/passkey.ts +344 -0
  238. package/src/client/actions/sessions.ts +457 -0
  239. package/src/client/actions/utils.ts +30 -0
  240. package/src/client/common/smart-account-client-actions.ts +317 -0
  241. package/src/client/ecdsa/account.ts +146 -42
  242. package/src/client/ecdsa/client-actions.ts +54 -0
  243. package/src/client/ecdsa/client.ts +177 -75
  244. package/src/client/ecdsa/index.ts +9 -5
  245. package/src/client/index.ts +10 -122
  246. package/src/client/passkey/account.ts +180 -55
  247. package/src/client/passkey/client-actions.ts +117 -0
  248. package/src/client/passkey/client.ts +194 -108
  249. package/src/client/passkey/index.ts +21 -4
  250. package/src/client/passkey/webauthn.ts +638 -0
  251. package/src/client/session/account.ts +211 -46
  252. package/src/client/session/client-actions.ts +62 -0
  253. package/src/client/session/client.ts +121 -160
  254. package/src/client/session/formatSessionPreferences.ts +444 -0
  255. package/src/client/session/index.ts +5 -0
  256. package/src/client/session/monitor.ts +292 -0
  257. package/src/client/session/types.ts +205 -0
  258. package/src/client/session/utils.ts +160 -0
  259. package/src/client-auth-server/Signer.ts +91 -41
  260. package/src/client-auth-server/WalletProvider.ts +12 -11
  261. package/src/client-auth-server/interface.ts +2 -2
  262. package/src/client-auth-server/rpc.ts +4 -0
  263. package/src/client-auth-server/session/index.ts +6 -4
  264. package/src/client-auth-server/session/utils.ts +4 -4
  265. package/src/client-auth-server/utils/index.ts +2 -0
  266. package/src/communicator/interface.ts +6 -0
  267. package/src/connector/index.ts +137 -24
  268. package/src/index.ts +12 -3
  269. package/tsconfig.json +1 -1
  270. package/dist/_cjs/abi/GuardianRecoveryModule.js +0 -767
  271. package/dist/_cjs/abi/GuardianRecoveryModule.js.map +0 -1
  272. package/dist/_cjs/abi/GuardianRecoveryValidator.js +0 -813
  273. package/dist/_cjs/abi/GuardianRecoveryValidator.js.map +0 -1
  274. package/dist/_cjs/abi/OidcKeyRegistry.js +0 -492
  275. package/dist/_cjs/abi/OidcKeyRegistry.js.map +0 -1
  276. package/dist/_cjs/abi/OidcRecoveryValidator.js +0 -650
  277. package/dist/_cjs/abi/OidcRecoveryValidator.js.map +0 -1
  278. package/dist/_cjs/abi/SsoAccount.js +0 -1354
  279. package/dist/_cjs/abi/SsoAccount.js.map +0 -1
  280. package/dist/_cjs/abi/WebAuthValidator.js.map +0 -1
  281. package/dist/_cjs/client/ecdsa/actions/account.js +0 -83
  282. package/dist/_cjs/client/ecdsa/actions/account.js.map +0 -1
  283. package/dist/_cjs/client/ecdsa/decorators/ecdsa.js +0 -22
  284. package/dist/_cjs/client/ecdsa/decorators/ecdsa.js.map +0 -1
  285. package/dist/_cjs/client/ecdsa/decorators/wallet.js +0 -53
  286. package/dist/_cjs/client/ecdsa/decorators/wallet.js.map +0 -1
  287. package/dist/_cjs/client/ecdsa/types.js +0 -63
  288. package/dist/_cjs/client/ecdsa/types.js.map +0 -1
  289. package/dist/_cjs/client/oidc/account.js +0 -43
  290. package/dist/_cjs/client/oidc/account.js.map +0 -1
  291. package/dist/_cjs/client/oidc/actions/addNewPasskeyViaOidc.js +0 -28
  292. package/dist/_cjs/client/oidc/actions/addNewPasskeyViaOidc.js.map +0 -1
  293. package/dist/_cjs/client/oidc/actions/index.js +0 -12
  294. package/dist/_cjs/client/oidc/actions/index.js.map +0 -1
  295. package/dist/_cjs/client/oidc/client.js +0 -46
  296. package/dist/_cjs/client/oidc/client.js.map +0 -1
  297. package/dist/_cjs/client/oidc/decorators/actions.js +0 -3
  298. package/dist/_cjs/client/oidc/decorators/actions.js.map +0 -1
  299. package/dist/_cjs/client/oidc/index.js +0 -20
  300. package/dist/_cjs/client/oidc/index.js.map +0 -1
  301. package/dist/_cjs/client/oidc/serialize.js +0 -3
  302. package/dist/_cjs/client/oidc/serialize.js.map +0 -1
  303. package/dist/_cjs/client/passkey/actions/account.js +0 -169
  304. package/dist/_cjs/client/passkey/actions/account.js.map +0 -1
  305. package/dist/_cjs/client/passkey/actions/passkey.js +0 -151
  306. package/dist/_cjs/client/passkey/actions/passkey.js.map +0 -1
  307. package/dist/_cjs/client/passkey/decorators/passkey.js +0 -52
  308. package/dist/_cjs/client/passkey/decorators/passkey.js.map +0 -1
  309. package/dist/_cjs/client/passkey/decorators/wallet.js +0 -54
  310. package/dist/_cjs/client/passkey/decorators/wallet.js.map +0 -1
  311. package/dist/_cjs/client/recovery/account.js +0 -46
  312. package/dist/_cjs/client/recovery/account.js.map +0 -1
  313. package/dist/_cjs/client/recovery/actions/oidc.js +0 -69
  314. package/dist/_cjs/client/recovery/actions/oidc.js.map +0 -1
  315. package/dist/_cjs/client/recovery/actions/recovery.js +0 -114
  316. package/dist/_cjs/client/recovery/actions/recovery.js.map +0 -1
  317. package/dist/_cjs/client/recovery/actions/sendEip712Transaction.js +0 -45
  318. package/dist/_cjs/client/recovery/actions/sendEip712Transaction.js.map +0 -1
  319. package/dist/_cjs/client/recovery/client.js +0 -49
  320. package/dist/_cjs/client/recovery/client.js.map +0 -1
  321. package/dist/_cjs/client/recovery/decorators/publicActionsRewrite.js +0 -33
  322. package/dist/_cjs/client/recovery/decorators/publicActionsRewrite.js.map +0 -1
  323. package/dist/_cjs/client/recovery/decorators/recovery.js +0 -15
  324. package/dist/_cjs/client/recovery/decorators/recovery.js.map +0 -1
  325. package/dist/_cjs/client/recovery/decorators/wallet.js +0 -46
  326. package/dist/_cjs/client/recovery/decorators/wallet.js.map +0 -1
  327. package/dist/_cjs/client/recovery/index.js.map +0 -1
  328. package/dist/_cjs/client/session/actions/sendEip712Transaction.js +0 -45
  329. package/dist/_cjs/client/session/actions/sendEip712Transaction.js.map +0 -1
  330. package/dist/_cjs/client/session/actions/session.js +0 -116
  331. package/dist/_cjs/client/session/actions/session.js.map +0 -1
  332. package/dist/_cjs/client/session/decorators/publicActionsRewrite.js +0 -58
  333. package/dist/_cjs/client/session/decorators/publicActionsRewrite.js.map +0 -1
  334. package/dist/_cjs/client/session/decorators/wallet.js +0 -93
  335. package/dist/_cjs/client/session/decorators/wallet.js.map +0 -1
  336. package/dist/_cjs/client/utils/assertEip712Transaction.js +0 -44
  337. package/dist/_cjs/client/utils/assertEip712Transaction.js.map +0 -1
  338. package/dist/_cjs/client/utils/getEip712Domain.js +0 -57
  339. package/dist/_cjs/client/utils/getEip712Domain.js.map +0 -1
  340. package/dist/_cjs/client/utils/isEip712Transaction.js +0 -16
  341. package/dist/_cjs/client/utils/isEip712Transaction.js.map +0 -1
  342. package/dist/_cjs/paymaster/handlers/general.js +0 -13
  343. package/dist/_cjs/paymaster/handlers/general.js.map +0 -1
  344. package/dist/_cjs/paymaster/handlers/index.js +0 -19
  345. package/dist/_cjs/paymaster/handlers/index.js.map +0 -1
  346. package/dist/_cjs/paymaster/handlers/zyfi.js +0 -57
  347. package/dist/_cjs/paymaster/handlers/zyfi.js.map +0 -1
  348. package/dist/_cjs/paymaster/index.js +0 -54
  349. package/dist/_cjs/paymaster/index.js.map +0 -1
  350. package/dist/_cjs/utils/encoding.js +0 -56
  351. package/dist/_cjs/utils/encoding.js.map +0 -1
  352. package/dist/_cjs/utils/helpers.js.map +0 -1
  353. package/dist/_cjs/utils/index.js +0 -20
  354. package/dist/_cjs/utils/index.js.map +0 -1
  355. package/dist/_cjs/utils/passkey.js +0 -245
  356. package/dist/_cjs/utils/passkey.js.map +0 -1
  357. package/dist/_cjs/utils/session.js +0 -346
  358. package/dist/_cjs/utils/session.js.map +0 -1
  359. package/dist/_cjs/utils/storage.js.map +0 -1
  360. package/dist/_esm/abi/GuardianRecoveryModule.js +0 -764
  361. package/dist/_esm/abi/GuardianRecoveryModule.js.map +0 -1
  362. package/dist/_esm/abi/GuardianRecoveryValidator.js +0 -810
  363. package/dist/_esm/abi/GuardianRecoveryValidator.js.map +0 -1
  364. package/dist/_esm/abi/OidcKeyRegistry.js +0 -489
  365. package/dist/_esm/abi/OidcKeyRegistry.js.map +0 -1
  366. package/dist/_esm/abi/OidcRecoveryValidator.js +0 -647
  367. package/dist/_esm/abi/OidcRecoveryValidator.js.map +0 -1
  368. package/dist/_esm/abi/SsoAccount.js +0 -1351
  369. package/dist/_esm/abi/SsoAccount.js.map +0 -1
  370. package/dist/_esm/abi/WebAuthValidator.js.map +0 -1
  371. package/dist/_esm/client/ecdsa/actions/account.js +0 -82
  372. package/dist/_esm/client/ecdsa/actions/account.js.map +0 -1
  373. package/dist/_esm/client/ecdsa/decorators/ecdsa.js +0 -19
  374. package/dist/_esm/client/ecdsa/decorators/ecdsa.js.map +0 -1
  375. package/dist/_esm/client/ecdsa/decorators/wallet.js +0 -54
  376. package/dist/_esm/client/ecdsa/decorators/wallet.js.map +0 -1
  377. package/dist/_esm/client/ecdsa/types.js +0 -61
  378. package/dist/_esm/client/ecdsa/types.js.map +0 -1
  379. package/dist/_esm/client/oidc/account.js +0 -40
  380. package/dist/_esm/client/oidc/account.js.map +0 -1
  381. package/dist/_esm/client/oidc/actions/addNewPasskeyViaOidc.js +0 -26
  382. package/dist/_esm/client/oidc/actions/addNewPasskeyViaOidc.js.map +0 -1
  383. package/dist/_esm/client/oidc/actions/index.js +0 -9
  384. package/dist/_esm/client/oidc/actions/index.js.map +0 -1
  385. package/dist/_esm/client/oidc/client.js +0 -41
  386. package/dist/_esm/client/oidc/client.js.map +0 -1
  387. package/dist/_esm/client/oidc/decorators/actions.js +0 -2
  388. package/dist/_esm/client/oidc/decorators/actions.js.map +0 -1
  389. package/dist/_esm/client/oidc/index.js +0 -4
  390. package/dist/_esm/client/oidc/index.js.map +0 -1
  391. package/dist/_esm/client/oidc/serialize.js +0 -2
  392. package/dist/_esm/client/oidc/serialize.js.map +0 -1
  393. package/dist/_esm/client/passkey/actions/account.js +0 -165
  394. package/dist/_esm/client/passkey/actions/account.js.map +0 -1
  395. package/dist/_esm/client/passkey/actions/passkey.js +0 -148
  396. package/dist/_esm/client/passkey/actions/passkey.js.map +0 -1
  397. package/dist/_esm/client/passkey/decorators/passkey.js +0 -50
  398. package/dist/_esm/client/passkey/decorators/passkey.js.map +0 -1
  399. package/dist/_esm/client/passkey/decorators/wallet.js +0 -54
  400. package/dist/_esm/client/passkey/decorators/wallet.js.map +0 -1
  401. package/dist/_esm/client/recovery/account.js +0 -43
  402. package/dist/_esm/client/recovery/account.js.map +0 -1
  403. package/dist/_esm/client/recovery/actions/oidc.js +0 -69
  404. package/dist/_esm/client/recovery/actions/oidc.js.map +0 -1
  405. package/dist/_esm/client/recovery/actions/recovery.js +0 -111
  406. package/dist/_esm/client/recovery/actions/recovery.js.map +0 -1
  407. package/dist/_esm/client/recovery/actions/sendEip712Transaction.js +0 -93
  408. package/dist/_esm/client/recovery/actions/sendEip712Transaction.js.map +0 -1
  409. package/dist/_esm/client/recovery/client.js +0 -45
  410. package/dist/_esm/client/recovery/client.js.map +0 -1
  411. package/dist/_esm/client/recovery/decorators/publicActionsRewrite.js +0 -31
  412. package/dist/_esm/client/recovery/decorators/publicActionsRewrite.js.map +0 -1
  413. package/dist/_esm/client/recovery/decorators/recovery.js +0 -13
  414. package/dist/_esm/client/recovery/decorators/recovery.js.map +0 -1
  415. package/dist/_esm/client/recovery/decorators/wallet.js +0 -45
  416. package/dist/_esm/client/recovery/decorators/wallet.js.map +0 -1
  417. package/dist/_esm/client/recovery/index.js +0 -3
  418. package/dist/_esm/client/recovery/index.js.map +0 -1
  419. package/dist/_esm/client/session/actions/sendEip712Transaction.js +0 -93
  420. package/dist/_esm/client/session/actions/sendEip712Transaction.js.map +0 -1
  421. package/dist/_esm/client/session/actions/session.js +0 -119
  422. package/dist/_esm/client/session/actions/session.js.map +0 -1
  423. package/dist/_esm/client/session/decorators/publicActionsRewrite.js +0 -55
  424. package/dist/_esm/client/session/decorators/publicActionsRewrite.js.map +0 -1
  425. package/dist/_esm/client/session/decorators/wallet.js +0 -100
  426. package/dist/_esm/client/session/decorators/wallet.js.map +0 -1
  427. package/dist/_esm/client/utils/assertEip712Transaction.js +0 -39
  428. package/dist/_esm/client/utils/assertEip712Transaction.js.map +0 -1
  429. package/dist/_esm/client/utils/getEip712Domain.js +0 -57
  430. package/dist/_esm/client/utils/getEip712Domain.js.map +0 -1
  431. package/dist/_esm/client/utils/isEip712Transaction.js +0 -13
  432. package/dist/_esm/client/utils/isEip712Transaction.js.map +0 -1
  433. package/dist/_esm/paymaster/handlers/general.js +0 -11
  434. package/dist/_esm/paymaster/handlers/general.js.map +0 -1
  435. package/dist/_esm/paymaster/handlers/index.js +0 -3
  436. package/dist/_esm/paymaster/handlers/index.js.map +0 -1
  437. package/dist/_esm/paymaster/handlers/zyfi.js +0 -54
  438. package/dist/_esm/paymaster/handlers/zyfi.js.map +0 -1
  439. package/dist/_esm/paymaster/index.js +0 -37
  440. package/dist/_esm/paymaster/index.js.map +0 -1
  441. package/dist/_esm/utils/encoding.js +0 -49
  442. package/dist/_esm/utils/encoding.js.map +0 -1
  443. package/dist/_esm/utils/helpers.js.map +0 -1
  444. package/dist/_esm/utils/index.js +0 -4
  445. package/dist/_esm/utils/index.js.map +0 -1
  446. package/dist/_esm/utils/passkey.js +0 -296
  447. package/dist/_esm/utils/passkey.js.map +0 -1
  448. package/dist/_esm/utils/session.js +0 -358
  449. package/dist/_esm/utils/session.js.map +0 -1
  450. package/dist/_esm/utils/storage.js.map +0 -1
  451. package/dist/_types/abi/GuardianRecoveryModule.d.ts +0 -590
  452. package/dist/_types/abi/GuardianRecoveryModule.d.ts.map +0 -1
  453. package/dist/_types/abi/GuardianRecoveryValidator.d.ts +0 -626
  454. package/dist/_types/abi/GuardianRecoveryValidator.d.ts.map +0 -1
  455. package/dist/_types/abi/OidcKeyRegistry.d.ts +0 -375
  456. package/dist/_types/abi/OidcKeyRegistry.d.ts.map +0 -1
  457. package/dist/_types/abi/OidcRecoveryValidator.d.ts +0 -501
  458. package/dist/_types/abi/OidcRecoveryValidator.d.ts.map +0 -1
  459. package/dist/_types/abi/SsoAccount.d.ts +0 -1044
  460. package/dist/_types/abi/SsoAccount.d.ts.map +0 -1
  461. package/dist/_types/abi/WebAuthValidator.d.ts.map +0 -1
  462. package/dist/_types/client/ecdsa/actions/account.d.ts +0 -38
  463. package/dist/_types/client/ecdsa/actions/account.d.ts.map +0 -1
  464. package/dist/_types/client/ecdsa/decorators/ecdsa.d.ts +0 -16
  465. package/dist/_types/client/ecdsa/decorators/ecdsa.d.ts.map +0 -1
  466. package/dist/_types/client/ecdsa/decorators/wallet.d.ts +0 -5
  467. package/dist/_types/client/ecdsa/decorators/wallet.d.ts.map +0 -1
  468. package/dist/_types/client/ecdsa/types.d.ts +0 -10
  469. package/dist/_types/client/ecdsa/types.d.ts.map +0 -1
  470. package/dist/_types/client/oidc/account.d.ts +0 -13
  471. package/dist/_types/client/oidc/account.d.ts.map +0 -1
  472. package/dist/_types/client/oidc/actions/addNewPasskeyViaOidc.d.ts +0 -12
  473. package/dist/_types/client/oidc/actions/addNewPasskeyViaOidc.d.ts.map +0 -1
  474. package/dist/_types/client/oidc/actions/index.d.ts +0 -5
  475. package/dist/_types/client/oidc/actions/index.d.ts.map +0 -1
  476. package/dist/_types/client/oidc/client.d.ts +0 -24
  477. package/dist/_types/client/oidc/client.d.ts.map +0 -1
  478. package/dist/_types/client/oidc/decorators/actions.d.ts +0 -5
  479. package/dist/_types/client/oidc/decorators/actions.d.ts.map +0 -1
  480. package/dist/_types/client/oidc/index.d.ts +0 -4
  481. package/dist/_types/client/oidc/index.d.ts.map +0 -1
  482. package/dist/_types/client/oidc/serialize.d.ts +0 -10
  483. package/dist/_types/client/oidc/serialize.d.ts.map +0 -1
  484. package/dist/_types/client/passkey/actions/account.d.ts +0 -48
  485. package/dist/_types/client/passkey/actions/account.d.ts.map +0 -1
  486. package/dist/_types/client/passkey/actions/passkey.d.ts +0 -55
  487. package/dist/_types/client/passkey/actions/passkey.d.ts.map +0 -1
  488. package/dist/_types/client/passkey/decorators/passkey.d.ts +0 -16
  489. package/dist/_types/client/passkey/decorators/passkey.d.ts.map +0 -1
  490. package/dist/_types/client/passkey/decorators/wallet.d.ts +0 -5
  491. package/dist/_types/client/passkey/decorators/wallet.d.ts.map +0 -1
  492. package/dist/_types/client/recovery/account.d.ts +0 -14
  493. package/dist/_types/client/recovery/account.d.ts.map +0 -1
  494. package/dist/_types/client/recovery/actions/oidc.d.ts +0 -24
  495. package/dist/_types/client/recovery/actions/oidc.d.ts.map +0 -1
  496. package/dist/_types/client/recovery/actions/recovery.d.ts +0 -50
  497. package/dist/_types/client/recovery/actions/recovery.d.ts.map +0 -1
  498. package/dist/_types/client/recovery/actions/sendEip712Transaction.d.ts +0 -60
  499. package/dist/_types/client/recovery/actions/sendEip712Transaction.d.ts.map +0 -1
  500. package/dist/_types/client/recovery/client.d.ts +0 -23
  501. package/dist/_types/client/recovery/client.d.ts.map +0 -1
  502. package/dist/_types/client/recovery/decorators/publicActionsRewrite.d.ts +0 -4
  503. package/dist/_types/client/recovery/decorators/publicActionsRewrite.d.ts.map +0 -1
  504. package/dist/_types/client/recovery/decorators/recovery.d.ts +0 -8
  505. package/dist/_types/client/recovery/decorators/recovery.d.ts.map +0 -1
  506. package/dist/_types/client/recovery/decorators/wallet.d.ts +0 -5
  507. package/dist/_types/client/recovery/decorators/wallet.d.ts.map +0 -1
  508. package/dist/_types/client/recovery/index.d.ts +0 -3
  509. package/dist/_types/client/recovery/index.d.ts.map +0 -1
  510. package/dist/_types/client/session/actions/sendEip712Transaction.d.ts +0 -60
  511. package/dist/_types/client/session/actions/sendEip712Transaction.d.ts.map +0 -1
  512. package/dist/_types/client/session/actions/session.d.ts +0 -61
  513. package/dist/_types/client/session/actions/session.d.ts.map +0 -1
  514. package/dist/_types/client/session/decorators/publicActionsRewrite.d.ts +0 -4
  515. package/dist/_types/client/session/decorators/publicActionsRewrite.d.ts.map +0 -1
  516. package/dist/_types/client/session/decorators/wallet.d.ts +0 -5
  517. package/dist/_types/client/session/decorators/wallet.d.ts.map +0 -1
  518. package/dist/_types/client/utils/assertEip712Transaction.d.ts +0 -11
  519. package/dist/_types/client/utils/assertEip712Transaction.d.ts.map +0 -1
  520. package/dist/_types/client/utils/getEip712Domain.d.ts +0 -3
  521. package/dist/_types/client/utils/getEip712Domain.d.ts.map +0 -1
  522. package/dist/_types/client/utils/isEip712Transaction.d.ts +0 -4
  523. package/dist/_types/client/utils/isEip712Transaction.d.ts.map +0 -1
  524. package/dist/_types/paymaster/handlers/general.d.ts +0 -4
  525. package/dist/_types/paymaster/handlers/general.d.ts.map +0 -1
  526. package/dist/_types/paymaster/handlers/index.d.ts +0 -3
  527. package/dist/_types/paymaster/handlers/index.d.ts.map +0 -1
  528. package/dist/_types/paymaster/handlers/zyfi.d.ts +0 -18
  529. package/dist/_types/paymaster/handlers/zyfi.d.ts.map +0 -1
  530. package/dist/_types/paymaster/index.d.ts +0 -29
  531. package/dist/_types/paymaster/index.d.ts.map +0 -1
  532. package/dist/_types/utils/encoding.d.ts +0 -19
  533. package/dist/_types/utils/encoding.d.ts.map +0 -1
  534. package/dist/_types/utils/helpers.d.ts.map +0 -1
  535. package/dist/_types/utils/index.d.ts +0 -4
  536. package/dist/_types/utils/index.d.ts.map +0 -1
  537. package/dist/_types/utils/passkey.d.ts +0 -47
  538. package/dist/_types/utils/passkey.d.ts.map +0 -1
  539. package/dist/_types/utils/session.d.ts +0 -179
  540. package/dist/_types/utils/session.d.ts.map +0 -1
  541. package/dist/_types/utils/storage.d.ts.map +0 -1
  542. package/src/abi/GuardianRecoveryModule.ts +0 -763
  543. package/src/abi/GuardianRecoveryValidator.ts +0 -809
  544. package/src/abi/OidcKeyRegistry.ts +0 -488
  545. package/src/abi/OidcRecoveryValidator.ts +0 -646
  546. package/src/abi/SsoAccount.ts +0 -1350
  547. package/src/abi/WebAuthValidator.ts +0 -357
  548. package/src/client/ecdsa/actions/account.ts +0 -146
  549. package/src/client/ecdsa/decorators/ecdsa.ts +0 -32
  550. package/src/client/ecdsa/decorators/wallet.ts +0 -80
  551. package/src/client/ecdsa/types.ts +0 -108
  552. package/src/client/oidc/account.ts +0 -65
  553. package/src/client/oidc/actions/addNewPasskeyViaOidc.ts +0 -54
  554. package/src/client/oidc/actions/index.ts +0 -16
  555. package/src/client/oidc/client.ts +0 -122
  556. package/src/client/oidc/decorators/actions.ts +0 -5
  557. package/src/client/oidc/index.ts +0 -3
  558. package/src/client/oidc/serialize.ts +0 -10
  559. package/src/client/passkey/actions/account.ts +0 -241
  560. package/src/client/passkey/actions/passkey.ts +0 -208
  561. package/src/client/passkey/decorators/passkey.ts +0 -77
  562. package/src/client/passkey/decorators/wallet.ts +0 -79
  563. package/src/client/recovery/account.ts +0 -61
  564. package/src/client/recovery/actions/oidc.ts +0 -119
  565. package/src/client/recovery/actions/recovery.ts +0 -176
  566. package/src/client/recovery/actions/sendEip712Transaction.ts +0 -149
  567. package/src/client/recovery/client.ts +0 -102
  568. package/src/client/recovery/decorators/publicActionsRewrite.ts +0 -38
  569. package/src/client/recovery/decorators/recovery.ts +0 -22
  570. package/src/client/recovery/decorators/wallet.ts +0 -59
  571. package/src/client/recovery/index.ts +0 -2
  572. package/src/client/session/actions/sendEip712Transaction.ts +0 -149
  573. package/src/client/session/actions/session.ts +0 -204
  574. package/src/client/session/decorators/publicActionsRewrite.ts +0 -63
  575. package/src/client/session/decorators/wallet.ts +0 -143
  576. package/src/client/utils/assertEip712Transaction.ts +0 -49
  577. package/src/client/utils/getEip712Domain.ts +0 -84
  578. package/src/client/utils/isEip712Transaction.ts +0 -18
  579. package/src/paymaster/handlers/general.ts +0 -14
  580. package/src/paymaster/handlers/index.ts +0 -2
  581. package/src/paymaster/handlers/zyfi.ts +0 -108
  582. package/src/paymaster/index.ts +0 -76
  583. package/src/types/index.d.ts +0 -9
  584. package/src/utils/encoding.ts +0 -70
  585. package/src/utils/index.ts +0 -3
  586. package/src/utils/passkey.ts +0 -347
  587. package/src/utils/session.ts +0 -524
  588. /package/dist/_cjs/{utils → client-auth-server/utils}/helpers.js +0 -0
  589. /package/dist/_cjs/{utils → client-auth-server/utils}/storage.js +0 -0
  590. /package/dist/_esm/{utils → client-auth-server/utils}/helpers.js +0 -0
  591. /package/dist/_esm/{utils → client-auth-server/utils}/storage.js +0 -0
  592. /package/dist/_types/{utils → client-auth-server/utils}/helpers.d.ts +0 -0
  593. /package/dist/_types/{utils → client-auth-server/utils}/storage.d.ts +0 -0
  594. /package/src/{utils → client-auth-server/utils}/helpers.ts +0 -0
  595. /package/src/{utils → client-auth-server/utils}/storage.ts +0 -0
@@ -0,0 +1,317 @@
1
+ import {
2
+ type Account,
3
+ type Address,
4
+ type Chain,
5
+ type Client,
6
+ encodeFunctionData,
7
+ type Hash,
8
+ type Hex,
9
+ type Transport,
10
+ type WalletActions,
11
+ } from "viem";
12
+ import type { BundlerClient, ToSmartAccountReturnType } from "viem/account-abstraction";
13
+ import {
14
+ getAddresses,
15
+ getCallsStatus,
16
+ getCapabilities,
17
+ getChainId,
18
+ sendRawTransaction as viemSendRawTransaction,
19
+ showCallsStatus,
20
+ waitForCallsStatus,
21
+ } from "viem/actions";
22
+
23
+ import type { PaymasterConfig } from "../../actions/sendUserOperation.js";
24
+ import { addPasskey as addPasskeyAction } from "../actions/passkey.js";
25
+
26
+ /**
27
+ * Generic smart account client configuration
28
+ */
29
+ export type SmartAccountClientData<
30
+ TTransport extends Transport = Transport,
31
+ TChain extends Chain = Chain,
32
+ > = {
33
+ /** Bundler client for sending user operations */
34
+ bundler: BundlerClient;
35
+ /** Factory function to create smart account (lazy-loaded) */
36
+ accountFactory: () => Promise<ToSmartAccountReturnType>;
37
+ /** Client for making RPC calls */
38
+ client: Client<TTransport, TChain, Account | undefined>;
39
+ /** Smart account address */
40
+ accountAddress: Address;
41
+ /** Optional paymaster configuration for sponsoring transactions - can be either a full config object or just an address string */
42
+ paymaster?: PaymasterConfig | Address;
43
+ };
44
+
45
+ /**
46
+ * Wallet actions type for smart account client
47
+ * Based on WalletActions but omits methods that don't make sense for smart accounts or are overridden
48
+ */
49
+ export type SmartAccountClientActions<TChain extends Chain = Chain, TAccount extends Account = Account> = Omit<
50
+ WalletActions<TChain, TAccount>,
51
+ "addChain" | "getPermissions" | "requestAddresses" | "requestPermissions" | "switchChain" | "watchAsset" | "prepareTransactionRequest" | "signTransaction"
52
+ > & {
53
+
54
+ /**
55
+ * Add a passkey to the smart account.
56
+ * Returns the transaction hash.
57
+ */
58
+ addPasskey: (params: {
59
+ credentialId: Hex;
60
+ publicKey: { x: Hex; y: Hex };
61
+ originDomain: string;
62
+ webauthnValidatorAddress: Address;
63
+ }) => Promise<Hash>;
64
+
65
+ /**
66
+ * Wait for a user operation receipt.
67
+ */
68
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
69
+ waitForUserOperationReceipt: (params: { hash: Hash }) => Promise<any>;
70
+ };
71
+
72
+ /**
73
+ * Generic decorator that provides wallet actions for smart account clients.
74
+ * Overrides standard wallet methods to use ERC-4337 bundler under the hood.
75
+ * Works with any smart account type (passkey, ECDSA, etc.) that returns ToSmartAccountReturnType.
76
+ */
77
+ export function smartAccountClientActions<
78
+ TTransport extends Transport,
79
+ TChain extends Chain,
80
+ TAccount extends Account | undefined = undefined,
81
+ >(
82
+ config: SmartAccountClientData<TTransport, TChain>,
83
+ ): SmartAccountClientActions<TChain, TAccount extends Account ? TAccount : Account> {
84
+ // Normalize paymaster to PaymasterConfig format at the start
85
+ // config.paymaster can be either PaymasterConfig object OR string address
86
+ const normalizedPaymaster = config.paymaster
87
+ ? typeof config.paymaster === "string"
88
+ ? {
89
+ address: config.paymaster as Address,
90
+ verificationGasLimit: 500_000n,
91
+ postOpGasLimit: 1_000_000n,
92
+ data: "0x" as `0x${string}`,
93
+ }
94
+ : config.paymaster
95
+ : undefined;
96
+
97
+ // Lazy-load the smart account (cached after first load)
98
+ let smartAccountPromise: Promise<ToSmartAccountReturnType> | null = null;
99
+ const getSmartAccount = async (): Promise<ToSmartAccountReturnType> => {
100
+ if (!smartAccountPromise) {
101
+ smartAccountPromise = config.accountFactory();
102
+ }
103
+ return smartAccountPromise;
104
+ };
105
+
106
+ return {
107
+ // Read-only actions - pass through
108
+ getAddresses: () => getAddresses(config.client),
109
+ getChainId: () => getChainId(config.client),
110
+ getCallsStatus: (args) => getCallsStatus(config.client, args),
111
+ getCapabilities: (args) => getCapabilities(config.client, args),
112
+ showCallsStatus: (args) => showCallsStatus(config.client, args),
113
+ waitForCallsStatus: (args) => waitForCallsStatus(config.client, args),
114
+
115
+ // Send raw transaction - pass through to transport
116
+ sendRawTransaction: (args) => viemSendRawTransaction(config.client, args),
117
+
118
+ deployContract: () => {
119
+ throw new Error("deployContract is not supported for smart accounts.");
120
+ },
121
+
122
+ // Send multiple calls in a single userOp
123
+ sendCalls: async (args) => {
124
+ const account = await getSmartAccount();
125
+
126
+ // For v0.8 EntryPoint, pass separate paymaster fields (not packed paymasterAndData)
127
+ // These fields get included in the UserOp BEFORE signing
128
+ const paymasterParams = normalizedPaymaster
129
+ ? {
130
+ paymaster: normalizedPaymaster.address,
131
+ paymasterData: normalizedPaymaster.data ?? ("0x" as Hex),
132
+ paymasterVerificationGasLimit: normalizedPaymaster.verificationGasLimit ?? 500_000n,
133
+ paymasterPostOpGasLimit: normalizedPaymaster.postOpGasLimit ?? 1_000_000n,
134
+ }
135
+ : {};
136
+
137
+ // Send all calls through bundler in a single userOp
138
+ const userOpHash = await config.bundler.sendUserOperation({
139
+ account,
140
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
141
+ calls: args.calls.map((call: any) => ({
142
+ to: call.to!,
143
+ value: call.value ?? 0n,
144
+ data: call.data ?? "0x",
145
+ })),
146
+ ...paymasterParams,
147
+ });
148
+
149
+ // Return the userOp hash as the ID in the expected format
150
+ return {
151
+ id: userOpHash,
152
+ };
153
+ },
154
+
155
+ signTypedData: async () => {
156
+ throw new Error("signTypedData is not supported for this smart account type");
157
+ },
158
+ signMessage: async () => {
159
+ throw new Error("signMessage is not supported for this smart account type");
160
+ },
161
+
162
+ // Unsupported signing actions - throw errors
163
+ signAuthorization: () => {
164
+ throw new Error("signAuthorization is not supported for smart accounts");
165
+ },
166
+ prepareAuthorization: () => {
167
+ throw new Error("prepareAuthorization is not supported for smart accounts");
168
+ },
169
+
170
+ // Override sendTransaction to use bundler
171
+ // Note: We accept an extended parameter set with optional paymaster
172
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
173
+ sendTransaction: async (args: any) => {
174
+ const account = await getSmartAccount();
175
+
176
+ // Use per-transaction paymaster if provided, otherwise fall back to config
177
+ const paymasterAddress = args.paymaster ?? normalizedPaymaster?.address;
178
+
179
+ // For v0.8 EntryPoint, pass separate paymaster fields (not packed paymasterAndData)
180
+ // These fields get included in the UserOp BEFORE signing
181
+ const paymasterParams
182
+ = normalizedPaymaster || paymasterAddress
183
+ ? {
184
+ paymaster: paymasterAddress!,
185
+ paymasterData: normalizedPaymaster?.data ?? ("0x" as Hex),
186
+ paymasterVerificationGasLimit: normalizedPaymaster?.verificationGasLimit ?? 500_000n,
187
+ paymasterPostOpGasLimit: normalizedPaymaster?.postOpGasLimit ?? 1_000_000n,
188
+ }
189
+ : {};
190
+
191
+ // Send user operation through bundler
192
+ const userOpHash = await config.bundler.sendUserOperation({
193
+ account,
194
+ calls: [
195
+ {
196
+ to: args.to!,
197
+ value: args.value ?? 0n,
198
+ data: args.data ?? "0x",
199
+ },
200
+ ],
201
+ ...paymasterParams,
202
+ });
203
+
204
+ // Wait for the user operation to be included and get the actual transaction hash
205
+ const receipt = await config.bundler.waitForUserOperationReceipt({
206
+ hash: userOpHash,
207
+ });
208
+
209
+ // Return the actual transaction hash (not the userOp hash)
210
+ // This makes the client fully compatible with EOA behavior
211
+ return receipt.receipt.transactionHash;
212
+ },
213
+
214
+ // Override writeContract to use bundler
215
+ writeContract: async (args) => {
216
+ const account = await getSmartAccount();
217
+
218
+ // Encode the contract call data
219
+ const data = encodeFunctionData({
220
+ abi: args.abi,
221
+ functionName: args.functionName,
222
+ args: args.args,
223
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
224
+ } as any);
225
+
226
+ // For paymaster to be included in signature, use paymasterContext not callback
227
+ const paymasterParams = normalizedPaymaster
228
+ ? {
229
+ paymaster: normalizedPaymaster.address,
230
+ paymasterData: normalizedPaymaster.data ?? ("0x" as Hex),
231
+ paymasterVerificationGasLimit: normalizedPaymaster.verificationGasLimit ?? 500_000n,
232
+ paymasterPostOpGasLimit: normalizedPaymaster.postOpGasLimit ?? 1_000_000n,
233
+ }
234
+ : {};
235
+
236
+ // Send through bundler
237
+ const userOpHash = await config.bundler.sendUserOperation({
238
+ account,
239
+ calls: [
240
+ {
241
+ to: args.address,
242
+ value: args.value ?? 0n,
243
+ data,
244
+ },
245
+ ],
246
+ ...paymasterParams,
247
+ });
248
+
249
+ // Wait for confirmation and return actual tx hash
250
+ const receipt = await config.bundler.waitForUserOperationReceipt({
251
+ hash: userOpHash,
252
+ });
253
+
254
+ return receipt.receipt.transactionHash;
255
+ },
256
+
257
+ // Add passkey to the smart account
258
+ addPasskey: async (params: {
259
+ credentialId: Hex;
260
+ publicKey: { x: Hex; y: Hex };
261
+ originDomain: string;
262
+ webauthnValidatorAddress: Address;
263
+ }) => {
264
+ const account = await getSmartAccount();
265
+
266
+ // Generate the transaction using the existing addPasskey function
267
+ const { transaction } = addPasskeyAction({
268
+ account: config.accountAddress,
269
+ contracts: {
270
+ webauthnValidator: params.webauthnValidatorAddress,
271
+ },
272
+ passkeySigner: {
273
+ credentialId: params.credentialId,
274
+ publicKey: params.publicKey,
275
+ originDomain: params.originDomain,
276
+ },
277
+ });
278
+
279
+ const paymasterParams = normalizedPaymaster
280
+ ? {
281
+ paymaster: normalizedPaymaster.address,
282
+ paymasterData: normalizedPaymaster.data ?? ("0x" as Hex),
283
+ paymasterVerificationGasLimit: normalizedPaymaster.verificationGasLimit ?? 500_000n,
284
+ paymasterPostOpGasLimit: normalizedPaymaster.postOpGasLimit ?? 1_000_000n,
285
+ }
286
+ : {};
287
+
288
+ // Send the transaction through bundler
289
+ const userOpHash = await config.bundler.sendUserOperation({
290
+ account,
291
+ calls: [
292
+ {
293
+ to: transaction.to,
294
+ data: transaction.data,
295
+ value: 0n,
296
+ },
297
+ ],
298
+ ...paymasterParams,
299
+ });
300
+
301
+ // Wait for the user operation to be included
302
+ const receipt = await config.bundler.waitForUserOperationReceipt({
303
+ hash: userOpHash,
304
+ });
305
+
306
+ // Return the actual transaction hash from the receipt
307
+ return receipt.receipt.transactionHash;
308
+ },
309
+
310
+ // Bundler-specific helper
311
+ waitForUserOperationReceipt: (params: { hash: Hash }) => {
312
+ return config.bundler.waitForUserOperationReceipt({
313
+ hash: params.hash,
314
+ });
315
+ },
316
+ };
317
+ }
@@ -1,56 +1,160 @@
1
- import type { Address } from "abitype";
2
- import type { CustomSource, LocalAccount } from "viem";
3
- import { toAccount } from "viem/accounts";
4
- import { serializeTransaction, type ZksyncTransactionSerializableEIP712 } from "viem/zksync";
1
+ import {
2
+ type Address,
3
+ type Chain,
4
+ type Hash,
5
+ hashMessage,
6
+ type Hex,
7
+ type PublicClient,
8
+ type Transport,
9
+ } from "viem";
10
+ import {
11
+ entryPoint08Abi,
12
+ entryPoint08Address,
13
+ getUserOperationHash,
14
+ toSmartAccount,
15
+ type ToSmartAccountReturnType,
16
+ } from "viem/account-abstraction";
17
+ import {
18
+ decode_nonce_result,
19
+ encode_execute_call_data,
20
+ encode_get_nonce_call_data,
21
+ generate_eoa_stub_signature,
22
+ sign_eoa_message,
23
+ sign_eoa_user_operation_hash,
24
+ } from "zksync-sso-web-sdk/bundler";
5
25
 
6
- import { getEip712Domain } from "../utils/getEip712Domain.js";
7
- import { type Signer, toOwner } from "./types.js";
8
-
9
- export type ToEcdsaAccountParameters = {
10
- /** Address of the deployed SSO Wallet */
26
+ export type ToEcdsaSmartAccountParams<
27
+ TTransport extends Transport = Transport,
28
+ TChain extends Chain = Chain,
29
+ > = {
30
+ /** Public client used internally by the smart account implementation (must have chain). */
31
+ client: PublicClient<TTransport, TChain>;
32
+ /** EOA signer private key. */
33
+ signerPrivateKey: Hash;
34
+ /** Smart account address (required - no counterfactual support). */
11
35
  address: Address;
12
- /** Owner of the EOA */
13
- owner: Signer;
36
+ /** EOA validator contract address (required for stub signature generation). */
37
+ eoaValidatorAddress: Address;
38
+ /** Optional override for EntryPoint address (defaults to viem's entryPoint08Address). */
39
+ entryPointAddress?: Address;
14
40
  };
15
41
 
16
- export type EcdsaAccount = LocalAccount<"ssoEcdsaAccount"> & {
17
- sign: NonNullable<CustomSource["sign"]>;
18
- };
42
+ /**
43
+ * Builds a SSO SmartAccount instance which uses an ECDSA EOA for signing.
44
+ */
45
+ export async function toEcdsaSmartAccount<
46
+ TTransport extends Transport = Transport,
47
+ TChain extends Chain = Chain,
48
+ >({
49
+ client,
50
+ signerPrivateKey,
51
+ address,
52
+ eoaValidatorAddress,
53
+ entryPointAddress,
54
+ }: ToEcdsaSmartAccountParams<TTransport, TChain>): Promise<ToSmartAccountReturnType> {
55
+ const epAddress = entryPointAddress ?? entryPoint08Address;
56
+ return toSmartAccount({
57
+ client,
58
+ entryPoint: {
59
+ abi: entryPoint08Abi,
60
+ address: epAddress,
61
+ version: "0.8",
62
+ },
63
+ async getNonce() {
64
+ const sender = await this.getAddress();
65
+ const calldata = encode_get_nonce_call_data(sender, "0") as Hex;
66
+ const result = await client.request({
67
+ method: "eth_call",
68
+ params: [{
69
+ from: sender,
70
+ to: epAddress,
71
+ data: calldata,
72
+ }],
73
+ });
74
+ const nonceStr = decode_nonce_result(result);
75
+ return BigInt(nonceStr as string);
76
+ },
19
77
 
20
- export async function toEcdsaAccount(
21
- parameters: ToEcdsaAccountParameters,
22
- ): Promise<EcdsaAccount> {
23
- const { address, owner } = parameters;
78
+ // --- Calls encoding (execute only - batch not supported yet) ---
79
+ async encodeCalls(calls) {
80
+ // Only support single calls (no batch operations)
81
+ if (calls.length !== 1) {
82
+ throw new Error("Batch transactions are not supported. Only single execute() calls are allowed.");
83
+ }
24
84
 
25
- const localOwner = await toOwner({ owner, address });
85
+ const call = calls[0];
26
86
 
27
- const account = toAccount({
28
- address,
29
- async signMessage({ message }) {
30
- return localOwner.signMessage({ message });
87
+ // Use Rust SDK for encoding
88
+ // Convert value to string (Rust expects string representation)
89
+ const valueStr = (call.value ?? 0n).toString();
90
+
91
+ // Call Rust SDK to encode
92
+ const encoded = encode_execute_call_data(
93
+ call.to,
94
+ valueStr,
95
+ call.data ?? "0x",
96
+ ) as Hex;
97
+
98
+ return encoded;
99
+ },
100
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
101
+ async decodeCalls(data) {
102
+ throw new Error("decodeCalls is not supported yet.");
31
103
  },
32
- async signTransaction(transaction) {
33
- const signableTransaction = {
34
- ...transaction,
35
- from: this.address!,
36
- type: "eip712",
37
- } as ZksyncTransactionSerializableEIP712;
38
104
 
39
- const eip712DomainAndMessage = getEip712Domain(signableTransaction);
40
- const signature = await localOwner.signTypedData(eip712DomainAndMessage);
105
+ // --- Address & factory args ---
106
+ async getAddress() {
107
+ // Simply return the provided address (no counterfactual support yet)
108
+ return address;
109
+ },
110
+ async getFactoryArgs() {
111
+ // No counterfactual deployment support yet
112
+ throw new Error("getFactoryArgs is not supported. Deploy the account first and provide the address.");
113
+ },
41
114
 
42
- return serializeTransaction({
43
- ...signableTransaction,
44
- customSignature: signature,
45
- });
115
+ // --- Stubs & signing ---
116
+ async getStubSignature() {
117
+ // Use Rust SDK to generate proper stub signature
118
+ return generate_eoa_stub_signature(eoaValidatorAddress) as Hex;
46
119
  },
47
- async signTypedData(typedData) {
48
- return localOwner.signTypedData(typedData);
120
+ async signMessage({ message }) {
121
+ // Hash the message if it's not already hashed
122
+ const messageToSign = typeof message === "string" ? message : hashMessage(message);
123
+ return sign_eoa_message(signerPrivateKey, messageToSign) as Hex;
49
124
  },
50
- });
125
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
126
+ async signTypedData({ domain, types, primaryType, message }) {
127
+ throw new Error("signTypedData is not supported for ECDSA smart accounts");
128
+ },
129
+ async signUserOperation(params) {
130
+ const sender = await this.getAddress();
131
+ // Compute user operation hash locally with full fields (including paymaster)
132
+ const userOpHash = getUserOperationHash({
133
+ chainId: Number(client.chain!.id),
134
+ entryPointAddress: this.entryPoint.address,
135
+ entryPointVersion: "0.8",
136
+ userOperation: {
137
+ sender,
138
+ nonce: params.nonce,
139
+ initCode: (params.initCode ?? "0x") as Hex,
140
+ callData: (params.callData ?? "0x") as Hex,
141
+ callGasLimit: params.callGasLimit,
142
+ verificationGasLimit: params.verificationGasLimit,
143
+ preVerificationGas: params.preVerificationGas,
144
+ maxFeePerGas: params.maxFeePerGas,
145
+ maxPriorityFeePerGas: params.maxPriorityFeePerGas,
146
+ paymasterAndData: (params.paymasterAndData ?? "0x") as Hex,
147
+ signature: "0x",
148
+ },
149
+ } as any) as Hex;
150
+
151
+ const signature = sign_eoa_user_operation_hash(
152
+ userOpHash,
153
+ signerPrivateKey,
154
+ eoaValidatorAddress,
155
+ ) as Hex;
51
156
 
52
- return {
53
- ...account,
54
- source: "ssoEcdsaAccount",
55
- } as EcdsaAccount;
157
+ return signature;
158
+ },
159
+ });
56
160
  }
@@ -0,0 +1,54 @@
1
+ import type {
2
+ Account,
3
+ Address,
4
+ Chain,
5
+ Client,
6
+ Transport,
7
+ } from "viem";
8
+ import type { BundlerClient } from "viem/account-abstraction";
9
+
10
+ import {
11
+ type SmartAccountClientActions,
12
+ smartAccountClientActions,
13
+ } from "../common/smart-account-client-actions.js";
14
+ import { toEcdsaSmartAccount, type ToEcdsaSmartAccountParams } from "./account.js";
15
+
16
+ /**
17
+ * Extended client type that includes bundler-specific configuration for ECDSA
18
+ */
19
+ export type EcdsaClientData<
20
+ TTransport extends Transport = Transport,
21
+ TChain extends Chain = Chain,
22
+ > = {
23
+ bundler: BundlerClient;
24
+ ecdsaAccount: ToEcdsaSmartAccountParams<TTransport, TChain>;
25
+ accountAddress: Address;
26
+ };
27
+
28
+ /**
29
+ * Wallet actions type for ECDSA client
30
+ * Uses generic smart account actions (no ECDSA-specific actions needed)
31
+ */
32
+ export type EcdsaClientActions<TChain extends Chain = Chain, TAccount extends Account = Account> = SmartAccountClientActions<TChain, TAccount>;
33
+
34
+ /**
35
+ * Decorator that provides wallet actions for ECDSA client.
36
+ * Overrides standard wallet methods to use ERC-4337 bundler under the hood.
37
+ */
38
+ export function ecdsaClientActions<
39
+ TTransport extends Transport,
40
+ TChain extends Chain,
41
+ TAccount extends Account | undefined = undefined,
42
+ >(
43
+ config: EcdsaClientData<TTransport, TChain> & {
44
+ client: Client<TTransport, TChain, TAccount>;
45
+ },
46
+ ): EcdsaClientActions<TChain, TAccount extends Account ? TAccount : Account> {
47
+ // Return generic smart account actions
48
+ return smartAccountClientActions<TTransport, TChain, TAccount>({
49
+ bundler: config.bundler,
50
+ accountFactory: () => toEcdsaSmartAccount(config.ecdsaAccount),
51
+ client: config.client,
52
+ accountAddress: config.accountAddress,
53
+ });
54
+ }