@crossmint/client-sdk-smart-wallet 0.1.21 → 0.1.22

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 (308) hide show
  1. package/dist/SmartWalletSDK.cjs +34 -1
  2. package/dist/SmartWalletSDK.cjs.map +1 -0
  3. package/dist/SmartWalletSDK.js +34 -1
  4. package/dist/SmartWalletSDK.js.map +1 -0
  5. package/dist/api/CrossmintWalletService.cjs +13 -1
  6. package/dist/api/CrossmintWalletService.cjs.map +1 -0
  7. package/dist/api/CrossmintWalletService.js +13 -1
  8. package/dist/api/CrossmintWalletService.js.map +1 -0
  9. package/dist/blockchain/chains.cjs +23 -1
  10. package/dist/blockchain/chains.cjs.map +1 -0
  11. package/dist/blockchain/chains.js +23 -1
  12. package/dist/blockchain/chains.js.map +1 -0
  13. package/dist/blockchain/rpc.cjs +11 -1
  14. package/dist/blockchain/rpc.cjs.map +1 -0
  15. package/dist/blockchain/rpc.js +11 -1
  16. package/dist/blockchain/rpc.js.map +1 -0
  17. package/dist/blockchain/transfer.cjs +7 -1
  18. package/dist/blockchain/transfer.cjs.map +1 -0
  19. package/dist/blockchain/transfer.js +7 -1
  20. package/dist/blockchain/transfer.js.map +1 -0
  21. package/dist/blockchain/wallets/EVMSmartWallet.cjs +10 -1
  22. package/dist/blockchain/wallets/EVMSmartWallet.cjs.map +1 -0
  23. package/dist/blockchain/wallets/EVMSmartWallet.js +10 -1
  24. package/dist/blockchain/wallets/EVMSmartWallet.js.map +1 -0
  25. package/dist/blockchain/wallets/SendTransactionService.cjs +11 -1
  26. package/dist/blockchain/wallets/SendTransactionService.cjs.map +1 -0
  27. package/dist/blockchain/wallets/SendTransactionService.js +11 -1
  28. package/dist/blockchain/wallets/SendTransactionService.js.map +1 -0
  29. package/dist/blockchain/wallets/account/cache.cjs +9 -1
  30. package/dist/blockchain/wallets/account/cache.cjs.map +1 -0
  31. package/dist/blockchain/wallets/account/cache.js +9 -1
  32. package/dist/blockchain/wallets/account/cache.js.map +1 -0
  33. package/dist/blockchain/wallets/account/config.cjs +9 -1
  34. package/dist/blockchain/wallets/account/config.cjs.map +1 -0
  35. package/dist/blockchain/wallets/account/config.js +9 -1
  36. package/dist/blockchain/wallets/account/config.js.map +1 -0
  37. package/dist/blockchain/wallets/account/creator.cjs +10 -1
  38. package/dist/blockchain/wallets/account/creator.cjs.map +1 -0
  39. package/dist/blockchain/wallets/account/creator.js +10 -1
  40. package/dist/blockchain/wallets/account/creator.js.map +1 -0
  41. package/dist/blockchain/wallets/account/eoa.cjs +11 -1
  42. package/dist/blockchain/wallets/account/eoa.cjs.map +1 -0
  43. package/dist/blockchain/wallets/account/eoa.js +11 -1
  44. package/dist/blockchain/wallets/account/eoa.js.map +1 -0
  45. package/dist/blockchain/wallets/account/passkey.cjs +9 -1
  46. package/dist/blockchain/wallets/account/passkey.cjs.map +1 -0
  47. package/dist/blockchain/wallets/account/passkey.js +9 -1
  48. package/dist/blockchain/wallets/account/passkey.js.map +1 -0
  49. package/dist/blockchain/wallets/account/signer.cjs +9 -1
  50. package/dist/blockchain/wallets/account/signer.cjs.map +1 -0
  51. package/dist/blockchain/wallets/account/signer.js +9 -1
  52. package/dist/blockchain/wallets/account/signer.js.map +1 -0
  53. package/dist/blockchain/wallets/account/strategy.cjs +1 -1
  54. package/dist/blockchain/wallets/account/strategy.cjs.map +1 -0
  55. package/dist/blockchain/wallets/account/strategy.js +1 -0
  56. package/dist/blockchain/wallets/account/strategy.js.map +1 -0
  57. package/dist/blockchain/wallets/clientDecorator.cjs +12 -1
  58. package/dist/blockchain/wallets/clientDecorator.cjs.map +1 -0
  59. package/dist/blockchain/wallets/clientDecorator.js +12 -1
  60. package/dist/blockchain/wallets/clientDecorator.js.map +1 -0
  61. package/dist/blockchain/wallets/index.cjs +10 -1
  62. package/dist/blockchain/wallets/index.cjs.map +1 -0
  63. package/dist/blockchain/wallets/index.js +10 -1
  64. package/dist/blockchain/wallets/index.js.map +1 -0
  65. package/dist/blockchain/wallets/paymaster.cjs +10 -1
  66. package/dist/blockchain/wallets/paymaster.cjs.map +1 -0
  67. package/dist/blockchain/wallets/paymaster.js +10 -1
  68. package/dist/blockchain/wallets/paymaster.js.map +1 -0
  69. package/dist/blockchain/wallets/service.cjs +16 -1
  70. package/dist/blockchain/wallets/service.cjs.map +1 -0
  71. package/dist/blockchain/wallets/service.js +16 -1
  72. package/dist/blockchain/wallets/service.js.map +1 -0
  73. package/dist/chunk-2HB65Y7D.js +79 -0
  74. package/dist/chunk-2HB65Y7D.js.map +1 -0
  75. package/dist/chunk-3EQHAQXO.js +112 -0
  76. package/dist/chunk-3EQHAQXO.js.map +1 -0
  77. package/dist/chunk-3R6PW6HY.js +30 -0
  78. package/dist/chunk-3R6PW6HY.js.map +1 -0
  79. package/dist/chunk-4NTNOPLE.cjs +14 -0
  80. package/dist/chunk-4NTNOPLE.cjs.map +1 -0
  81. package/dist/chunk-535JCXYA.js +44 -0
  82. package/dist/chunk-535JCXYA.js.map +1 -0
  83. package/dist/chunk-5EHCB2XX.cjs +22 -0
  84. package/dist/chunk-5EHCB2XX.cjs.map +1 -0
  85. package/dist/{chunk-XJGFG3RT.cjs → chunk-5MG5CIEX.cjs} +13 -1
  86. package/dist/chunk-5MG5CIEX.cjs.map +1 -0
  87. package/dist/chunk-5URMCCO6.js +9 -0
  88. package/dist/chunk-5URMCCO6.js.map +1 -0
  89. package/dist/chunk-5WVQ7J3E.cjs +369 -0
  90. package/dist/chunk-5WVQ7J3E.cjs.map +1 -0
  91. package/dist/chunk-6NJVFL2X.js +60 -0
  92. package/dist/chunk-6NJVFL2X.js.map +1 -0
  93. package/dist/chunk-77GT6B5L.cjs +79 -0
  94. package/dist/chunk-77GT6B5L.cjs.map +1 -0
  95. package/dist/chunk-7KTQNIAZ.cjs +112 -0
  96. package/dist/chunk-7KTQNIAZ.cjs.map +1 -0
  97. package/dist/chunk-A6KV4FS7.cjs +99 -0
  98. package/dist/chunk-A6KV4FS7.cjs.map +1 -0
  99. package/dist/chunk-AKSNZLJ2.cjs +39 -0
  100. package/dist/chunk-AKSNZLJ2.cjs.map +1 -0
  101. package/dist/chunk-ASIPMVRQ.js +90 -0
  102. package/dist/chunk-ASIPMVRQ.js.map +1 -0
  103. package/dist/chunk-BARW756O.js +27 -0
  104. package/dist/chunk-BARW756O.js.map +1 -0
  105. package/dist/chunk-BEKNEEJQ.js +36 -0
  106. package/dist/chunk-BEKNEEJQ.js.map +1 -0
  107. package/dist/chunk-BQ5BBWL3.cjs +93 -0
  108. package/dist/chunk-BQ5BBWL3.cjs.map +1 -0
  109. package/dist/chunk-BXSAJOIV.cjs +90 -0
  110. package/dist/chunk-BXSAJOIV.cjs.map +1 -0
  111. package/dist/chunk-DTEA33DF.cjs +59 -0
  112. package/dist/chunk-DTEA33DF.cjs.map +1 -0
  113. package/dist/chunk-DYO4HODM.cjs +36 -0
  114. package/dist/chunk-DYO4HODM.cjs.map +1 -0
  115. package/dist/chunk-ECIGZ74W.js +123 -0
  116. package/dist/chunk-ECIGZ74W.js.map +1 -0
  117. package/dist/chunk-EPEGJY6N.cjs +9 -0
  118. package/dist/chunk-EPEGJY6N.cjs.map +1 -0
  119. package/dist/chunk-EQSMHR77.js +30 -0
  120. package/dist/chunk-EQSMHR77.js.map +1 -0
  121. package/dist/chunk-FSIMJYXR.js +36 -0
  122. package/dist/chunk-FSIMJYXR.js.map +1 -0
  123. package/dist/chunk-FXGOVLZW.cjs +9 -0
  124. package/dist/chunk-FXGOVLZW.cjs.map +1 -0
  125. package/dist/chunk-IKVGZHGP.cjs +44 -0
  126. package/dist/chunk-IKVGZHGP.cjs.map +1 -0
  127. package/dist/chunk-IYBOBUTI.js +66 -0
  128. package/dist/chunk-IYBOBUTI.js.map +1 -0
  129. package/dist/chunk-JOB7STIS.js +9 -0
  130. package/dist/chunk-JOB7STIS.js.map +1 -0
  131. package/dist/chunk-JSFGHJTS.js +82 -0
  132. package/dist/chunk-JSFGHJTS.js.map +1 -0
  133. package/dist/chunk-KHROQTVY.js +1 -0
  134. package/dist/chunk-KHROQTVY.js.map +1 -0
  135. package/dist/chunk-LGYR5QB5.cjs +66 -0
  136. package/dist/chunk-LGYR5QB5.cjs.map +1 -0
  137. package/dist/chunk-MILDB23W.js +14 -0
  138. package/dist/chunk-MILDB23W.js.map +1 -0
  139. package/dist/chunk-N6DG5EZG.cjs +156 -0
  140. package/dist/chunk-N6DG5EZG.cjs.map +1 -0
  141. package/dist/chunk-O3YQNP7C.js +99 -0
  142. package/dist/chunk-O3YQNP7C.js.map +1 -0
  143. package/dist/chunk-O6IFYHDP.cjs +36 -0
  144. package/dist/chunk-O6IFYHDP.cjs.map +1 -0
  145. package/dist/chunk-OGA3YDWS.cjs +112 -0
  146. package/dist/chunk-OGA3YDWS.cjs.map +1 -0
  147. package/dist/chunk-ON4DOYVD.js +369 -0
  148. package/dist/chunk-ON4DOYVD.js.map +1 -0
  149. package/dist/chunk-OSQSSEFB.cjs +123 -0
  150. package/dist/chunk-OSQSSEFB.cjs.map +1 -0
  151. package/dist/chunk-PF7Q7DFL.cjs +82 -0
  152. package/dist/chunk-PF7Q7DFL.cjs.map +1 -0
  153. package/dist/chunk-PVFA6PBX.cjs +60 -0
  154. package/dist/chunk-PVFA6PBX.cjs.map +1 -0
  155. package/dist/chunk-QFMVSQA5.js +93 -0
  156. package/dist/chunk-QFMVSQA5.js.map +1 -0
  157. package/dist/chunk-QJ3BSVGV.js +36 -0
  158. package/dist/chunk-QJ3BSVGV.js.map +1 -0
  159. package/dist/chunk-QZWWILWQ.cjs +36 -0
  160. package/dist/chunk-QZWWILWQ.cjs.map +1 -0
  161. package/dist/chunk-SEA2NTT5.js +22 -0
  162. package/dist/chunk-SEA2NTT5.js.map +1 -0
  163. package/dist/chunk-SMDX2MXU.js +13 -0
  164. package/dist/chunk-SMDX2MXU.js.map +1 -0
  165. package/dist/chunk-TDJDKTRS.js +156 -0
  166. package/dist/chunk-TDJDKTRS.js.map +1 -0
  167. package/dist/chunk-U4OBHCIP.js +59 -0
  168. package/dist/chunk-U4OBHCIP.js.map +1 -0
  169. package/dist/chunk-UQKE6R5W.cjs +27 -0
  170. package/dist/chunk-UQKE6R5W.cjs.map +1 -0
  171. package/dist/chunk-UZGHOTKZ.js +112 -0
  172. package/dist/chunk-UZGHOTKZ.js.map +1 -0
  173. package/dist/chunk-W3Y26K52.cjs +41 -0
  174. package/dist/chunk-W3Y26K52.cjs.map +1 -0
  175. package/dist/chunk-YVORZRCJ.js +39 -0
  176. package/dist/chunk-YVORZRCJ.js.map +1 -0
  177. package/dist/chunk-YWCXHOSD.cjs +30 -0
  178. package/dist/chunk-YWCXHOSD.cjs.map +1 -0
  179. package/dist/chunk-Z4DWICCM.js +41 -0
  180. package/dist/chunk-Z4DWICCM.js.map +1 -0
  181. package/dist/chunk-ZN42AA2G.cjs +1 -0
  182. package/dist/chunk-ZN42AA2G.cjs.map +1 -0
  183. package/dist/chunk-ZOXKITU4.cjs +30 -0
  184. package/dist/chunk-ZOXKITU4.cjs.map +1 -0
  185. package/dist/error/index.cjs +25 -1
  186. package/dist/error/index.cjs.map +1 -0
  187. package/dist/error/index.js +25 -1
  188. package/dist/error/index.js.map +1 -0
  189. package/dist/error/processor.cjs +9 -1
  190. package/dist/error/processor.cjs.map +1 -0
  191. package/dist/error/processor.js +9 -1
  192. package/dist/error/processor.js.map +1 -0
  193. package/dist/index.cjs +86 -1
  194. package/dist/index.cjs.map +1 -0
  195. package/dist/index.js +86 -1
  196. package/dist/index.js.map +1 -0
  197. package/dist/services/index.cjs +11 -1
  198. package/dist/services/index.cjs.map +1 -0
  199. package/dist/services/index.js +11 -1
  200. package/dist/services/index.js.map +1 -0
  201. package/dist/services/logger.cjs +10 -1
  202. package/dist/services/logger.cjs.map +1 -0
  203. package/dist/services/logger.js +10 -1
  204. package/dist/services/logger.js.map +1 -0
  205. package/dist/types/internal.cjs +18 -1
  206. package/dist/types/internal.cjs.map +1 -0
  207. package/dist/types/internal.js +18 -1
  208. package/dist/types/internal.js.map +1 -0
  209. package/dist/types/params.cjs +1 -1
  210. package/dist/types/params.cjs.map +1 -0
  211. package/dist/types/params.js +1 -0
  212. package/dist/types/params.js.map +1 -0
  213. package/dist/types/schema.cjs +16 -1
  214. package/dist/types/schema.cjs.map +1 -0
  215. package/dist/types/schema.js +16 -1
  216. package/dist/types/schema.js.map +1 -0
  217. package/dist/types/service.cjs +1 -1
  218. package/dist/types/service.cjs.map +1 -0
  219. package/dist/types/service.js +1 -0
  220. package/dist/types/service.js.map +1 -0
  221. package/dist/types/token.cjs +1 -1
  222. package/dist/types/token.cjs.map +1 -0
  223. package/dist/types/token.js +1 -0
  224. package/dist/types/token.js.map +1 -0
  225. package/dist/utils/api.cjs +9 -1
  226. package/dist/utils/api.cjs.map +1 -0
  227. package/dist/utils/api.js +9 -1
  228. package/dist/utils/api.js.map +1 -0
  229. package/dist/utils/blockchain.cjs +7 -1
  230. package/dist/utils/blockchain.cjs.map +1 -0
  231. package/dist/utils/blockchain.js +7 -1
  232. package/dist/utils/blockchain.js.map +1 -0
  233. package/dist/utils/constants.cjs +19 -1
  234. package/dist/utils/constants.cjs.map +1 -0
  235. package/dist/utils/constants.js +19 -1
  236. package/dist/utils/constants.js.map +1 -0
  237. package/dist/utils/environment.cjs +7 -1
  238. package/dist/utils/environment.cjs.map +1 -0
  239. package/dist/utils/environment.js +7 -1
  240. package/dist/utils/environment.js.map +1 -0
  241. package/dist/utils/helpers.cjs +9 -1
  242. package/dist/utils/helpers.cjs.map +1 -0
  243. package/dist/utils/helpers.js +9 -1
  244. package/dist/utils/helpers.js.map +1 -0
  245. package/dist/utils/signer.cjs +10 -1
  246. package/dist/utils/signer.cjs.map +1 -0
  247. package/dist/utils/signer.js +10 -1
  248. package/dist/utils/signer.js.map +1 -0
  249. package/dist/utils/test.cjs +27 -1
  250. package/dist/utils/test.cjs.map +1 -0
  251. package/dist/utils/test.js +27 -1
  252. package/dist/utils/test.js.map +1 -0
  253. package/package.json +4 -4
  254. package/dist/chunk-27US7ZBX.js +0 -1
  255. package/dist/chunk-2GS5TXEY.cjs +0 -1
  256. package/dist/chunk-2R6HK64N.cjs +0 -1
  257. package/dist/chunk-3F6P4HUZ.js +0 -1
  258. package/dist/chunk-4SPA557P.js +0 -0
  259. package/dist/chunk-5M3MSPHK.cjs +0 -1
  260. package/dist/chunk-6DE5YEO5.cjs +0 -1
  261. package/dist/chunk-7AVDZZGD.cjs +0 -1
  262. package/dist/chunk-7FXFOOQU.cjs +0 -1
  263. package/dist/chunk-7JAT6GQU.js +0 -1
  264. package/dist/chunk-ATQ4WGCW.js +0 -1
  265. package/dist/chunk-B3LJJZXD.cjs +0 -2
  266. package/dist/chunk-BJZQA5VC.js +0 -1
  267. package/dist/chunk-BXXREMNR.cjs +0 -1
  268. package/dist/chunk-C3VZY7VJ.js +0 -1
  269. package/dist/chunk-CPYNP4XI.js +0 -1
  270. package/dist/chunk-CUTQYF3F.js +0 -1
  271. package/dist/chunk-D4NDUT36.js +0 -1
  272. package/dist/chunk-DIDKPOO2.cjs +0 -1
  273. package/dist/chunk-ETVJGLNY.js +0 -1
  274. package/dist/chunk-FHNNZVNU.js +0 -1
  275. package/dist/chunk-FIJ3CBJ4.js +0 -3
  276. package/dist/chunk-G57LROTD.js +0 -1
  277. package/dist/chunk-GB35YMN4.cjs +0 -1
  278. package/dist/chunk-H4CMXNVK.js +0 -1
  279. package/dist/chunk-IQTGPM2U.cjs +0 -1
  280. package/dist/chunk-KYPTGHC6.cjs +0 -1
  281. package/dist/chunk-LMVY4C4Y.js +0 -1
  282. package/dist/chunk-M4K3IZTT.cjs +0 -1
  283. package/dist/chunk-NLGILHJS.js +0 -1
  284. package/dist/chunk-O2ACORII.cjs +0 -1
  285. package/dist/chunk-OCJYX5QF.cjs +0 -1
  286. package/dist/chunk-ODAUWGUU.cjs +0 -1
  287. package/dist/chunk-PBUJXVQT.js +0 -1
  288. package/dist/chunk-PLRQBDYS.cjs +0 -1
  289. package/dist/chunk-PPTSNCSQ.cjs +0 -1
  290. package/dist/chunk-PZ6Q22YJ.js +0 -1
  291. package/dist/chunk-Q44P7MO7.cjs +0 -1
  292. package/dist/chunk-QVB3HE6Q.js +0 -2
  293. package/dist/chunk-S2XBSAGM.js +0 -1
  294. package/dist/chunk-SCXFZMLR.cjs +0 -1
  295. package/dist/chunk-STH2LE35.cjs +0 -1
  296. package/dist/chunk-SWWOVT47.cjs +0 -1
  297. package/dist/chunk-TZG6MROQ.js +0 -1
  298. package/dist/chunk-UG47CBKR.js +0 -1
  299. package/dist/chunk-UPURFW46.js +0 -1
  300. package/dist/chunk-WDM7PN4O.js +0 -1
  301. package/dist/chunk-WJ6XJMRD.cjs +0 -1
  302. package/dist/chunk-WTPE2I2Q.cjs +0 -1
  303. package/dist/chunk-XHSA4YTO.cjs +0 -3
  304. package/dist/chunk-XP6ESWVJ.js +0 -1
  305. package/dist/chunk-XQ2K2K23.cjs +0 -1
  306. package/dist/chunk-YBHSEZMB.js +0 -1
  307. package/dist/chunk-YZQJV2KA.cjs +0 -1
  308. package/dist/chunk-Z22H3MJS.js +0 -1
@@ -0,0 +1,60 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/blockchain/chains.ts
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+ var _chains = require('viem/chains');
12
+ var _commonsdkbase = require('@crossmint/common-sdk-base');
13
+ var SmartWalletTestnet = {
14
+ BASE_SEPOLIA: _commonsdkbase.BlockchainIncludingTestnet.BASE_SEPOLIA,
15
+ POLYGON_AMOY: _commonsdkbase.BlockchainIncludingTestnet.POLYGON_AMOY,
16
+ OPTIMISM_SEPOLIA: _commonsdkbase.BlockchainIncludingTestnet.OPTIMISM_SEPOLIA,
17
+ ARBITRUM_SEPOLIA: _commonsdkbase.BlockchainIncludingTestnet.ARBITRUM_SEPOLIA
18
+ };
19
+ var SMART_WALLET_TESTNETS = _commonsdkbase.objectValues.call(void 0, SmartWalletTestnet);
20
+ var SmartWalletMainnet = {
21
+ BASE: _commonsdkbase.BlockchainIncludingTestnet.BASE,
22
+ POLYGON: _commonsdkbase.BlockchainIncludingTestnet.POLYGON,
23
+ OPTIMISM: _commonsdkbase.BlockchainIncludingTestnet.OPTIMISM,
24
+ ARBITRUM: _commonsdkbase.BlockchainIncludingTestnet.ARBITRUM
25
+ };
26
+ var SMART_WALLET_MAINNETS = _commonsdkbase.objectValues.call(void 0, SmartWalletMainnet);
27
+ var SmartWalletChain = {
28
+ ...SmartWalletTestnet,
29
+ ...SmartWalletMainnet
30
+ };
31
+ var SMART_WALLET_CHAINS = _commonsdkbase.objectValues.call(void 0, SmartWalletChain);
32
+ function isTestnetChain(chain) {
33
+ return SMART_WALLET_TESTNETS.includes(chain);
34
+ }
35
+ function isMainnetChain(chain) {
36
+ return SMART_WALLET_MAINNETS.includes(chain);
37
+ }
38
+ var viemNetworks = {
39
+ polygon: _chains.polygon,
40
+ "polygon-amoy": _chains.polygonAmoy,
41
+ base: _chains.base,
42
+ "base-sepolia": _chains.baseSepolia,
43
+ optimism: _chains.optimism,
44
+ "optimism-sepolia": _chains.optimismSepolia,
45
+ arbitrum: _chains.arbitrum,
46
+ "arbitrum-sepolia": _chains.arbitrumSepolia
47
+ };
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+ exports.SmartWalletTestnet = SmartWalletTestnet; exports.SMART_WALLET_TESTNETS = SMART_WALLET_TESTNETS; exports.SmartWalletMainnet = SmartWalletMainnet; exports.SMART_WALLET_MAINNETS = SMART_WALLET_MAINNETS; exports.SmartWalletChain = SmartWalletChain; exports.SMART_WALLET_CHAINS = SMART_WALLET_CHAINS; exports.isTestnetChain = isTestnetChain; exports.isMainnetChain = isMainnetChain; exports.viemNetworks = viemNetworks;
60
+ //# sourceMappingURL=chunk-PVFA6PBX.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/blockchain/chains.ts"],"names":[],"mappings":";AAAA;AAAA,EAEI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AAEP,SAAS,8BAA8B,YAA+B,oBAAoB;AAEnF,IAAM,qBAAqB;AAAA,EAC9B,cAAc,WAAW;AAAA,EACzB,cAAc,WAAW;AAAA,EACzB,kBAAkB,WAAW;AAAA,EAC7B,kBAAkB,WAAW;AACjC;AAEO,IAAM,wBAAwB,aAAa,kBAAkB;AAE7D,IAAM,qBAAqB;AAAA,EAC9B,MAAM,WAAW;AAAA,EACjB,SAAS,WAAW;AAAA,EACpB,UAAU,WAAW;AAAA,EACrB,UAAU,WAAW;AACzB;AAEO,IAAM,wBAAwB,aAAa,kBAAkB;AAE7D,IAAM,mBAAmB;AAAA,EAC5B,GAAG;AAAA,EACH,GAAG;AACP;AAEO,IAAM,sBAAsB,aAAa,gBAAgB;AAEzD,SAAS,eAAe,OAAsD;AACjF,SAAQ,sBAA8B,SAAS,KAAK;AACxD;AAEO,SAAS,eAAe,OAAsD;AACjF,SAAQ,sBAA8B,SAAS,KAAK;AACxD;AAEO,IAAM,eAAgD;AAAA,EACzD;AAAA,EACA,gBAAgB;AAAA,EAChB;AAAA,EACA,gBAAgB;AAAA,EAChB;AAAA,EACA,oBAAoB;AAAA,EACpB;AAAA,EACA,oBAAoB;AACxB","sourcesContent":["import {\n type Chain,\n arbitrum,\n arbitrumSepolia,\n base,\n baseSepolia,\n optimism,\n optimismSepolia,\n polygon,\n polygonAmoy,\n} from \"viem/chains\";\n\nimport { BlockchainIncludingTestnet as Blockchain, type ObjectValues, objectValues } from \"@crossmint/common-sdk-base\";\n\nexport const SmartWalletTestnet = {\n BASE_SEPOLIA: Blockchain.BASE_SEPOLIA,\n POLYGON_AMOY: Blockchain.POLYGON_AMOY,\n OPTIMISM_SEPOLIA: Blockchain.OPTIMISM_SEPOLIA,\n ARBITRUM_SEPOLIA: Blockchain.ARBITRUM_SEPOLIA,\n} as const;\nexport type SmartWalletTestnet = ObjectValues<typeof SmartWalletTestnet>;\nexport const SMART_WALLET_TESTNETS = objectValues(SmartWalletTestnet);\n\nexport const SmartWalletMainnet = {\n BASE: Blockchain.BASE,\n POLYGON: Blockchain.POLYGON,\n OPTIMISM: Blockchain.OPTIMISM,\n ARBITRUM: Blockchain.ARBITRUM,\n} as const;\nexport type SmartWalletMainnet = ObjectValues<typeof SmartWalletMainnet>;\nexport const SMART_WALLET_MAINNETS = objectValues(SmartWalletMainnet);\n\nexport const SmartWalletChain = {\n ...SmartWalletTestnet,\n ...SmartWalletMainnet,\n} as const;\nexport type SmartWalletChain = ObjectValues<typeof SmartWalletChain>;\nexport const SMART_WALLET_CHAINS = objectValues(SmartWalletChain);\n\nexport function isTestnetChain(chain: SmartWalletChain): chain is SmartWalletTestnet {\n return (SMART_WALLET_TESTNETS as any).includes(chain);\n}\n\nexport function isMainnetChain(chain: SmartWalletChain): chain is SmartWalletMainnet {\n return (SMART_WALLET_MAINNETS as any).includes(chain);\n}\n\nexport const viemNetworks: Record<SmartWalletChain, Chain> = {\n polygon: polygon,\n \"polygon-amoy\": polygonAmoy,\n base: base,\n \"base-sepolia\": baseSepolia,\n optimism: optimism,\n \"optimism-sepolia\": optimismSepolia,\n arbitrum: arbitrum,\n \"arbitrum-sepolia\": arbitrumSepolia,\n};\n"]}
@@ -0,0 +1,93 @@
1
+ import {
2
+ usesGelatoBundler
3
+ } from "./chunk-JOB7STIS.js";
4
+ import {
5
+ scwLogger
6
+ } from "./chunk-MILDB23W.js";
7
+ import {
8
+ SmartWalletError
9
+ } from "./chunk-ASIPMVRQ.js";
10
+
11
+ // src/blockchain/wallets/clientDecorator.ts
12
+ import { stringify } from "viem";
13
+ var transactionMethods = [
14
+ "sendTransaction",
15
+ "writeContract",
16
+ "sendUserOperation"
17
+ ];
18
+ var signingMethods = [
19
+ "signMessage",
20
+ "signTypedData"
21
+ ];
22
+ function isTxnMethod(method) {
23
+ return transactionMethods.includes(method);
24
+ }
25
+ function isSignMethod(method) {
26
+ return signingMethods.includes(method);
27
+ }
28
+ var ClientDecorator = class {
29
+ constructor(errorProcessor, logger = scwLogger) {
30
+ this.errorProcessor = errorProcessor;
31
+ this.logger = logger;
32
+ }
33
+ decorate({
34
+ crossmintChain,
35
+ smartAccountClient
36
+ }) {
37
+ return new Proxy(smartAccountClient, {
38
+ get: (target, prop, receiver) => {
39
+ const originalMethod = Reflect.get(target, prop, receiver);
40
+ if (typeof originalMethod !== "function" || typeof prop !== "string" || !(isSignMethod(prop) || isTxnMethod(prop))) {
41
+ return originalMethod;
42
+ }
43
+ return (...args) => this.logger.logPerformance(
44
+ `CrossmintSmartWallet.${prop}`,
45
+ () => this.execute(target, prop, originalMethod, args, crossmintChain)
46
+ );
47
+ }
48
+ });
49
+ }
50
+ async execute(target, prop, originalMethod, args, crossmintChain) {
51
+ try {
52
+ this.logger.log(`[CrossmintSmartWallet.${prop}] - params: ${stringify(args)}`);
53
+ const processed = isTxnMethod(prop) ? this.processTxnArgs(prop, crossmintChain, args) : args;
54
+ return await originalMethod.call(target, ...processed);
55
+ } catch (error) {
56
+ const description = isTxnMethod(prop) ? "signing" : "sending transaction";
57
+ throw this.errorProcessor.map(
58
+ error,
59
+ new SmartWalletError(`Error ${description}: ${error.message}`, stringify(error))
60
+ );
61
+ }
62
+ }
63
+ processTxnArgs(prop, crossmintChain, args) {
64
+ if (prop === "sendUserOperation") {
65
+ const [{ userOperation, middleware, account }] = args;
66
+ return [
67
+ {
68
+ middleware,
69
+ account,
70
+ userOperation: this.addGelatoBundlerProperties(crossmintChain, userOperation)
71
+ },
72
+ ...args.slice(1)
73
+ ];
74
+ }
75
+ const [txn] = args;
76
+ return [this.addGelatoBundlerProperties(crossmintChain, txn), ...args.slice(1)];
77
+ }
78
+ /*
79
+ * Chain that ZD uses Gelato as for bundler require special parameters:
80
+ * https://docs.zerodev.app/sdk/faqs/use-with-gelato#transaction-configuration
81
+ */
82
+ addGelatoBundlerProperties(crossmintChain, txnParams) {
83
+ if (usesGelatoBundler(crossmintChain)) {
84
+ return { ...txnParams, maxFeePerGas: "0x0", maxPriorityFeePerGas: "0x0" };
85
+ }
86
+ return txnParams;
87
+ }
88
+ };
89
+
90
+ export {
91
+ ClientDecorator
92
+ };
93
+ //# sourceMappingURL=chunk-QFMVSQA5.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/blockchain/wallets/clientDecorator.ts"],"sourcesContent":["import type { SmartAccountClient } from \"permissionless\";\nimport type { EntryPoint } from \"permissionless/types/entrypoint\";\nimport { stringify } from \"viem\";\n\nimport { SmartWalletError } from \"../../error\";\nimport type { ErrorProcessor } from \"../../error/processor\";\nimport { scwLogger } from \"../../services\";\nimport { usesGelatoBundler } from \"../../utils/blockchain\";\nimport type { SmartWalletChain } from \"../chains\";\n\nconst transactionMethods = [\n \"sendTransaction\",\n \"writeContract\",\n \"sendUserOperation\",\n] as const satisfies readonly (keyof SmartAccountClient<EntryPoint>)[];\n\nconst signingMethods = [\n \"signMessage\",\n \"signTypedData\",\n] as const satisfies readonly (keyof SmartAccountClient<EntryPoint>)[];\n\ntype TxnMethod = (typeof transactionMethods)[number];\ntype SignMethod = (typeof signingMethods)[number];\n\nfunction isTxnMethod(method: string): method is TxnMethod {\n return transactionMethods.includes(method as any);\n}\n\nfunction isSignMethod(method: string): method is SignMethod {\n return signingMethods.includes(method as any);\n}\n\n/**\n * A decorator class for SmartAccountClient instances. It enhances the client with:\n * - Error handling & logging.\n * - Performance metrics.\n * - Automatic formatting of transactions for Gelato bundler compatibility.\n * */\nexport class ClientDecorator {\n constructor(\n private readonly errorProcessor: ErrorProcessor,\n protected logger = scwLogger\n ) {}\n\n public decorate<Client extends SmartAccountClient<EntryPoint>>({\n crossmintChain,\n smartAccountClient,\n }: {\n crossmintChain: SmartWalletChain;\n smartAccountClient: Client;\n }): Client {\n return new Proxy(smartAccountClient, {\n get: (target, prop, receiver) => {\n const originalMethod = Reflect.get(target, prop, receiver);\n\n if (\n typeof originalMethod !== \"function\" ||\n typeof prop !== \"string\" ||\n !(isSignMethod(prop) || isTxnMethod(prop))\n ) {\n return originalMethod;\n }\n\n return (...args: any[]) =>\n this.logger.logPerformance(`CrossmintSmartWallet.${prop}`, () =>\n this.execute(target, prop, originalMethod, args, crossmintChain)\n );\n },\n }) as Client;\n }\n\n private async execute<M extends TxnMethod | SignMethod>(\n target: SmartAccountClient<EntryPoint>,\n prop: M,\n originalMethod: Function,\n args: any[],\n crossmintChain: SmartWalletChain\n ) {\n try {\n this.logger.log(`[CrossmintSmartWallet.${prop}] - params: ${stringify(args)}`);\n const processed = isTxnMethod(prop) ? this.processTxnArgs(prop, crossmintChain, args) : args;\n return await originalMethod.call(target, ...processed);\n } catch (error: any) {\n const description = isTxnMethod(prop) ? \"signing\" : \"sending transaction\";\n throw this.errorProcessor.map(\n error,\n new SmartWalletError(`Error ${description}: ${error.message}`, stringify(error))\n );\n }\n }\n\n private processTxnArgs(prop: TxnMethod, crossmintChain: SmartWalletChain, args: any[]): any[] {\n if (prop === \"sendUserOperation\") {\n const [{ userOperation, middleware, account }] = args as Parameters<\n SmartAccountClient<EntryPoint>[\"sendUserOperation\"]\n >;\n return [\n {\n middleware,\n account,\n userOperation: this.addGelatoBundlerProperties(crossmintChain, userOperation),\n },\n ...args.slice(1),\n ];\n }\n\n const [txn] = args as\n | Parameters<SmartAccountClient<EntryPoint>[\"sendTransaction\"]>\n | Parameters<SmartAccountClient<EntryPoint>[\"writeContract\"]>;\n\n return [this.addGelatoBundlerProperties(crossmintChain, txn), ...args.slice(1)];\n }\n\n /*\n * Chain that ZD uses Gelato as for bundler require special parameters:\n * https://docs.zerodev.app/sdk/faqs/use-with-gelato#transaction-configuration\n */\n private addGelatoBundlerProperties(\n crossmintChain: SmartWalletChain,\n txnParams: { maxFeePerGas?: bigint; maxPriorityFeePerGas?: bigint }\n ) {\n if (usesGelatoBundler(crossmintChain)) {\n return { ...txnParams, maxFeePerGas: \"0x0\" as any, maxPriorityFeePerGas: \"0x0\" as any };\n }\n\n return txnParams;\n }\n}\n"],"mappings":";;;;;;;;;;;AAEA,SAAS,iBAAiB;AAQ1B,IAAM,qBAAqB;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AACJ;AAEA,IAAM,iBAAiB;AAAA,EACnB;AAAA,EACA;AACJ;AAKA,SAAS,YAAY,QAAqC;AACtD,SAAO,mBAAmB,SAAS,MAAa;AACpD;AAEA,SAAS,aAAa,QAAsC;AACxD,SAAO,eAAe,SAAS,MAAa;AAChD;AAQO,IAAM,kBAAN,MAAsB;AAAA,EACzB,YACqB,gBACP,SAAS,WACrB;AAFmB;AACP;AAAA,EACX;AAAA,EAEI,SAAwD;AAAA,IAC3D;AAAA,IACA;AAAA,EACJ,GAGW;AACP,WAAO,IAAI,MAAM,oBAAoB;AAAA,MACjC,KAAK,CAAC,QAAQ,MAAM,aAAa;AAC7B,cAAM,iBAAiB,QAAQ,IAAI,QAAQ,MAAM,QAAQ;AAEzD,YACI,OAAO,mBAAmB,cAC1B,OAAO,SAAS,YAChB,EAAE,aAAa,IAAI,KAAK,YAAY,IAAI,IAC1C;AACE,iBAAO;AAAA,QACX;AAEA,eAAO,IAAI,SACP,KAAK,OAAO;AAAA,UAAe,wBAAwB,IAAI;AAAA,UAAI,MACvD,KAAK,QAAQ,QAAQ,MAAM,gBAAgB,MAAM,cAAc;AAAA,QACnE;AAAA,MACR;AAAA,IACJ,CAAC;AAAA,EACL;AAAA,EAEA,MAAc,QACV,QACA,MACA,gBACA,MACA,gBACF;AACE,QAAI;AACA,WAAK,OAAO,IAAI,yBAAyB,IAAI,eAAe,UAAU,IAAI,CAAC,EAAE;AAC7E,YAAM,YAAY,YAAY,IAAI,IAAI,KAAK,eAAe,MAAM,gBAAgB,IAAI,IAAI;AACxF,aAAO,MAAM,eAAe,KAAK,QAAQ,GAAG,SAAS;AAAA,IACzD,SAAS,OAAY;AACjB,YAAM,cAAc,YAAY,IAAI,IAAI,YAAY;AACpD,YAAM,KAAK,eAAe;AAAA,QACtB;AAAA,QACA,IAAI,iBAAiB,SAAS,WAAW,KAAK,MAAM,OAAO,IAAI,UAAU,KAAK,CAAC;AAAA,MACnF;AAAA,IACJ;AAAA,EACJ;AAAA,EAEQ,eAAe,MAAiB,gBAAkC,MAAoB;AAC1F,QAAI,SAAS,qBAAqB;AAC9B,YAAM,CAAC,EAAE,eAAe,YAAY,QAAQ,CAAC,IAAI;AAGjD,aAAO;AAAA,QACH;AAAA,UACI;AAAA,UACA;AAAA,UACA,eAAe,KAAK,2BAA2B,gBAAgB,aAAa;AAAA,QAChF;AAAA,QACA,GAAG,KAAK,MAAM,CAAC;AAAA,MACnB;AAAA,IACJ;AAEA,UAAM,CAAC,GAAG,IAAI;AAId,WAAO,CAAC,KAAK,2BAA2B,gBAAgB,GAAG,GAAG,GAAG,KAAK,MAAM,CAAC,CAAC;AAAA,EAClF;AAAA;AAAA;AAAA;AAAA;AAAA,EAMQ,2BACJ,gBACA,WACF;AACE,QAAI,kBAAkB,cAAc,GAAG;AACnC,aAAO,EAAE,GAAG,WAAW,cAAc,OAAc,sBAAsB,MAAa;AAAA,IAC1F;AAEA,WAAO;AAAA,EACX;AACJ;","names":[]}
@@ -0,0 +1,36 @@
1
+ import {
2
+ usesGelatoBundler
3
+ } from "./chunk-JOB7STIS.js";
4
+
5
+ // src/blockchain/wallets/paymaster.ts
6
+ function usePaymaster(chain) {
7
+ return !usesGelatoBundler(chain);
8
+ }
9
+ function paymasterMiddleware({
10
+ bundlerClient,
11
+ entryPoint,
12
+ chain,
13
+ walletService,
14
+ user
15
+ }) {
16
+ return {
17
+ middleware: {
18
+ gasPrice: async () => (await bundlerClient.getUserOperationGasPrice()).fast,
19
+ sponsorUserOperation: async ({ userOperation }) => {
20
+ const { sponsorUserOpParams } = await walletService.sponsorUserOperation(
21
+ user,
22
+ userOperation,
23
+ entryPoint,
24
+ chain
25
+ );
26
+ return sponsorUserOpParams;
27
+ }
28
+ }
29
+ };
30
+ }
31
+
32
+ export {
33
+ usePaymaster,
34
+ paymasterMiddleware
35
+ };
36
+ //# sourceMappingURL=chunk-QJ3BSVGV.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/blockchain/wallets/paymaster.ts"],"sourcesContent":["import type { CrossmintWalletService } from \"@/api/CrossmintWalletService\";\nimport type { Middleware } from \"permissionless/actions/smartAccount\";\nimport type { PimlicoBundlerClient } from \"permissionless/clients/pimlico\";\nimport type { EntryPoint } from \"permissionless/types/entrypoint\";\n\nimport type { UserParams } from \"../../types/params\";\nimport { usesGelatoBundler } from \"../../utils/blockchain\";\nimport type { SmartWalletChain } from \"../chains\";\n\nexport function usePaymaster(chain: SmartWalletChain) {\n return !usesGelatoBundler(chain);\n}\n\nexport function paymasterMiddleware({\n bundlerClient,\n entryPoint,\n chain,\n walletService,\n user,\n}: {\n bundlerClient: PimlicoBundlerClient<EntryPoint>;\n entryPoint: EntryPoint;\n chain: SmartWalletChain;\n walletService: CrossmintWalletService;\n user: UserParams;\n}): Middleware<EntryPoint> {\n return {\n middleware: {\n gasPrice: async () => (await bundlerClient.getUserOperationGasPrice()).fast,\n sponsorUserOperation: async ({ userOperation }) => {\n const { sponsorUserOpParams } = await walletService.sponsorUserOperation(\n user,\n userOperation,\n entryPoint,\n chain\n );\n return sponsorUserOpParams;\n },\n },\n };\n}\n"],"mappings":";;;;;AASO,SAAS,aAAa,OAAyB;AAClD,SAAO,CAAC,kBAAkB,KAAK;AACnC;AAEO,SAAS,oBAAoB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ,GAM2B;AACvB,SAAO;AAAA,IACH,YAAY;AAAA,MACR,UAAU,aAAa,MAAM,cAAc,yBAAyB,GAAG;AAAA,MACvE,sBAAsB,OAAO,EAAE,cAAc,MAAM;AAC/C,cAAM,EAAE,oBAAoB,IAAI,MAAM,cAAc;AAAA,UAChD;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACJ;AACA,eAAO;AAAA,MACX;AAAA,IACJ;AAAA,EACJ;AACJ;","names":[]}
@@ -0,0 +1,36 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+ var _chunk5EHCB2XXcjs = require('./chunk-5EHCB2XX.cjs');
5
+
6
+ // src/types/internal.ts
7
+ function isSupportedKernelVersion(version) {
8
+ return _chunk5EHCB2XXcjs.SUPPORTED_KERNEL_VERSIONS.includes(version);
9
+ }
10
+ function isSupportedEntryPointVersion(version) {
11
+ return _chunk5EHCB2XXcjs.SUPPORTED_ENTRYPOINT_VERSIONS.includes(version);
12
+ }
13
+ function isPasskeyWalletParams(params) {
14
+ return "signer" in params && "type" in params.signer && params.signer.type === "PASSKEY";
15
+ }
16
+ function isPasskeyCreationContext(params) {
17
+ const signerIsPasskeyOrUndefined = params.existing == null || params.existing.signerConfig.type === "passkeys";
18
+ return isPasskeyWalletParams(params.walletParams) && signerIsPasskeyOrUndefined;
19
+ }
20
+ function isEOAWalletParams(params) {
21
+ return "signer" in params && ("type" in params.signer && params.signer.type === "VIEM_ACCOUNT" || "request" in params.signer && typeof params.signer.request === "function");
22
+ }
23
+ function isEOACreationContext(params) {
24
+ const signerIsEOAOrUndefined = params.existing == null || params.existing.signerConfig.type === "eoa";
25
+ return isEOAWalletParams(params.walletParams) && signerIsEOAOrUndefined;
26
+ }
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+ exports.isSupportedKernelVersion = isSupportedKernelVersion; exports.isSupportedEntryPointVersion = isSupportedEntryPointVersion; exports.isPasskeyWalletParams = isPasskeyWalletParams; exports.isPasskeyCreationContext = isPasskeyCreationContext; exports.isEOAWalletParams = isEOAWalletParams; exports.isEOACreationContext = isEOACreationContext;
36
+ //# sourceMappingURL=chunk-QZWWILWQ.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/types/internal.ts"],"names":[],"mappings":";;;;;;AAYO,SAAS,yBAAyB,SAAoD;AACzF,SAAO,0BAA0B,SAAS,OAAc;AAC5D;AAGO,SAAS,6BAA6B,SAAwD;AACjG,SAAO,8BAA8B,SAAS,OAAc;AAChE;AA2BO,SAAS,sBAAsB,QAA0E;AAC5G,SAAO,YAAY,UAAU,UAAU,OAAO,UAAU,OAAO,OAAO,SAAS;AACnF;AAEO,SAAS,yBAAyB,QAAiE;AACtG,QAAM,6BAA6B,OAAO,YAAY,QAAQ,OAAO,SAAS,aAAa,SAAS;AAEpG,SAAO,sBAAsB,OAAO,YAAY,KAAK;AACzD;AAEO,SAAS,kBAAkB,QAA2E;AACzG,SACI,YAAY,WACV,UAAU,OAAO,UAAU,OAAO,OAAO,SAAS,kBAC/C,aAAa,OAAO,UAAU,OAAO,OAAO,OAAO,YAAY;AAE5E;AAEO,SAAS,qBAAqB,QAA6D;AAC9F,QAAM,yBAAyB,OAAO,YAAY,QAAQ,OAAO,SAAS,aAAa,SAAS;AAEhG,SAAO,kBAAkB,OAAO,YAAY,KAAK;AACrD","sourcesContent":["import type { KernelSmartAccount } from \"@zerodev/sdk\";\nimport type { SmartAccountClient } from \"permissionless\";\nimport type { SmartAccount } from \"permissionless/accounts\";\nimport type { EntryPoint } from \"permissionless/types/entrypoint\";\nimport type { Address, Chain, HttpTransport, PublicClient } from \"viem\";\n\nimport type { SmartWalletChain } from \"../blockchain/chains\";\nimport type { EOASignerConfig, PasskeySignerConfig, SignerConfig } from \"../blockchain/wallets/account/signer\";\nimport { SUPPORTED_ENTRYPOINT_VERSIONS, SUPPORTED_KERNEL_VERSIONS } from \"../utils/constants\";\nimport type { ExternalSigner, PasskeySigner, UserParams, WalletParams } from \"./params\";\n\nexport type SupportedKernelVersion = (typeof SUPPORTED_KERNEL_VERSIONS)[number];\nexport function isSupportedKernelVersion(version: string): version is SupportedKernelVersion {\n return SUPPORTED_KERNEL_VERSIONS.includes(version as any);\n}\n\nexport type SupportedEntryPointVersion = (typeof SUPPORTED_ENTRYPOINT_VERSIONS)[number];\nexport function isSupportedEntryPointVersion(version: string): version is SupportedEntryPointVersion {\n return SUPPORTED_ENTRYPOINT_VERSIONS.includes(version as any);\n}\n\nexport interface PreExistingWalletProperties {\n signerConfig: SignerConfig;\n address: Address;\n}\n\nexport interface WalletCreationContext {\n user: UserParams & { id: string };\n chain: SmartWalletChain;\n publicClient: PublicClient<HttpTransport>;\n walletParams: WalletParams;\n entryPoint: EntryPoint;\n kernelVersion: SupportedKernelVersion;\n existing?: PreExistingWalletProperties;\n}\n\nexport interface PasskeyCreationContext extends WalletCreationContext {\n walletParams: WalletParams & { signer: PasskeySigner };\n existing?: { signerConfig: PasskeySignerConfig; address: Address };\n}\n\nexport interface EOACreationContext extends WalletCreationContext {\n walletParams: WalletParams & { signer: ExternalSigner };\n existing?: { signerConfig: EOASignerConfig; address: Address };\n}\n\nexport function isPasskeyWalletParams(params: WalletParams): params is WalletParams & { signer: PasskeySigner } {\n return \"signer\" in params && \"type\" in params.signer && params.signer.type === \"PASSKEY\";\n}\n\nexport function isPasskeyCreationContext(params: WalletCreationContext): params is PasskeyCreationContext {\n const signerIsPasskeyOrUndefined = params.existing == null || params.existing.signerConfig.type === \"passkeys\";\n\n return isPasskeyWalletParams(params.walletParams) && signerIsPasskeyOrUndefined;\n}\n\nexport function isEOAWalletParams(params: WalletParams): params is WalletParams & { signer: ExternalSigner } {\n return (\n \"signer\" in params &&\n ((\"type\" in params.signer && params.signer.type === \"VIEM_ACCOUNT\") ||\n (\"request\" in params.signer && typeof params.signer.request === \"function\"))\n );\n}\n\nexport function isEOACreationContext(params: WalletCreationContext): params is EOACreationContext {\n const signerIsEOAOrUndefined = params.existing == null || params.existing.signerConfig.type === \"eoa\";\n\n return isEOAWalletParams(params.walletParams) && signerIsEOAOrUndefined;\n}\n\nexport interface AccountAndSigner {\n account: KernelSmartAccount<EntryPoint, HttpTransport>;\n signerConfig: SignerConfig;\n}\n\nexport type SmartWalletClient = SmartAccountClient<EntryPoint, HttpTransport, Chain, SmartAccount<EntryPoint>>;\n"]}
@@ -0,0 +1,22 @@
1
+ // package.json
2
+ var version = "0.1.22";
3
+
4
+ // src/utils/constants.ts
5
+ var ZERO_DEV_TYPE = "ZeroDev";
6
+ var CURRENT_VERSION = 0;
7
+ var SCW_SERVICE = "SCW_SDK";
8
+ var SDK_VERSION = version;
9
+ var API_VERSION = "2024-06-09";
10
+ var SUPPORTED_KERNEL_VERSIONS = ["0.3.1", "0.3.0", "0.2.4"];
11
+ var SUPPORTED_ENTRYPOINT_VERSIONS = ["v0.6", "v0.7"];
12
+
13
+ export {
14
+ ZERO_DEV_TYPE,
15
+ CURRENT_VERSION,
16
+ SCW_SERVICE,
17
+ SDK_VERSION,
18
+ API_VERSION,
19
+ SUPPORTED_KERNEL_VERSIONS,
20
+ SUPPORTED_ENTRYPOINT_VERSIONS
21
+ };
22
+ //# sourceMappingURL=chunk-SEA2NTT5.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../package.json","../src/utils/constants.ts"],"sourcesContent":["{\n \"name\": \"@crossmint/client-sdk-smart-wallet\",\n \"version\": \"0.1.22\",\n \"repository\": \"https://github.com/Crossmint/crossmint-sdk\",\n \"license\": \"Apache-2.0\",\n \"author\": \"Paella Labs Inc\",\n \"sideEffects\": false,\n \"type\": \"module\",\n \"exports\": {\n \"import\": \"./dist/index.js\",\n \"require\": \"./dist/index.cjs\"\n },\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"files\": [\"dist\", \"src\", \"LICENSE\"],\n \"scripts\": {\n \"build\": \"tsup\",\n \"dev\": \"tsup --watch\",\n \"test:vitest\": \"vitest run\"\n },\n \"dependencies\": {\n \"@crossmint/client-sdk-base\": \"workspace:*\",\n \"@crossmint/common-sdk-base\": \"workspace:*\",\n \"@zerodev/ecdsa-validator\": \"5.3.1\",\n \"@zerodev/passkey-validator\": \"5.4.0\",\n \"@zerodev/sdk\": \"5.3.3\",\n \"@zerodev/webauthn-key\": \"5.3.1\",\n \"permissionless\": \"0.1.36\",\n \"viem\": \"2.17.5\",\n \"zod\": \"3.22.4\"\n },\n \"devDependencies\": {\n \"typedoc\": \"0.26.5\",\n \"typedoc-plugin-frontmatter\": \"1.0.0\",\n \"typedoc-plugin-markdown\": \"4.2.3\"\n }\n}\n","import { version } from \"../../package.json\";\n\nexport const ZERO_DEV_TYPE = \"ZeroDev\";\nexport const CURRENT_VERSION = 0;\nexport const SCW_SERVICE = \"SCW_SDK\";\nexport const SDK_VERSION = version;\nexport const API_VERSION = \"2024-06-09\";\nexport const SUPPORTED_KERNEL_VERSIONS = [\"0.3.1\", \"0.3.0\", \"0.2.4\"] as const;\nexport const SUPPORTED_ENTRYPOINT_VERSIONS = [\"v0.6\", \"v0.7\"] as const;\n"],"mappings":";AAEI,cAAW;;;ACAR,IAAM,gBAAgB;AACtB,IAAM,kBAAkB;AACxB,IAAM,cAAc;AACpB,IAAM,cAAc;AACpB,IAAM,cAAc;AACpB,IAAM,4BAA4B,CAAC,SAAS,SAAS,OAAO;AAC5D,IAAM,gCAAgC,CAAC,QAAQ,MAAM;","names":[]}
@@ -0,0 +1,13 @@
1
+ // src/utils/helpers.ts
2
+ function isEmpty(str) {
3
+ return !str || str.length === 0 || str.trim().length === 0;
4
+ }
5
+ function equalsIgnoreCase(a, b) {
6
+ return a?.toLowerCase() === b?.toLowerCase();
7
+ }
8
+
9
+ export {
10
+ isEmpty,
11
+ equalsIgnoreCase
12
+ };
13
+ //# sourceMappingURL=chunk-SMDX2MXU.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/helpers.ts"],"sourcesContent":["export function isEmpty(str: string | undefined | null): str is undefined | null {\n return !str || str.length === 0 || str.trim().length === 0;\n}\n\nexport function equalsIgnoreCase(a?: string, b?: string): boolean {\n return a?.toLowerCase() === b?.toLowerCase();\n}\n"],"mappings":";AAAO,SAAS,QAAQ,KAAyD;AAC7E,SAAO,CAAC,OAAO,IAAI,WAAW,KAAK,IAAI,KAAK,EAAE,WAAW;AAC7D;AAEO,SAAS,iBAAiB,GAAY,GAAqB;AAC9D,SAAO,GAAG,YAAY,MAAM,GAAG,YAAY;AAC/C;","names":[]}
@@ -0,0 +1,156 @@
1
+ import {
2
+ PasskeySignerConfig
3
+ } from "./chunk-3R6PW6HY.js";
4
+ import {
5
+ PasskeyIncompatibleAuthenticatorError,
6
+ PasskeyMismatchError,
7
+ PasskeyPromptError,
8
+ PasskeyRegistrationError
9
+ } from "./chunk-ASIPMVRQ.js";
10
+
11
+ // src/blockchain/wallets/account/passkey.ts
12
+ import { PasskeyValidatorContractVersion, WebAuthnMode, toPasskeyValidator } from "@zerodev/passkey-validator";
13
+ import { createKernelAccount } from "@zerodev/sdk";
14
+ import { toWebAuthnKey } from "@zerodev/webauthn-key";
15
+ var PasskeyCreationStrategy = class {
16
+ constructor(passkeyServerUrl, apiKey) {
17
+ this.passkeyServerUrl = passkeyServerUrl;
18
+ this.apiKey = apiKey;
19
+ }
20
+ async create({
21
+ user,
22
+ publicClient,
23
+ walletParams,
24
+ entryPoint,
25
+ kernelVersion,
26
+ existing
27
+ }) {
28
+ const inputPasskeyName = walletParams.signer.passkeyName ?? user.id;
29
+ if (existing != null && existing.signerConfig.data.passkeyName !== inputPasskeyName) {
30
+ throw new PasskeyMismatchError(
31
+ `User '${user.id}' has an existing wallet created with a passkey named '${existing.signerConfig.data.passkeyName}', this does match input passkey name '${inputPasskeyName}'.`,
32
+ existing.signerConfig.display()
33
+ );
34
+ }
35
+ try {
36
+ if (existing == null && walletParams.signer.onPrePasskeyRegistration != null) {
37
+ await walletParams.signer.onPrePasskeyRegistration();
38
+ }
39
+ const passkey = await this.getPasskey(user, inputPasskeyName, existing?.signerConfig.data);
40
+ const latestValidatorVersion = PasskeyValidatorContractVersion.V0_0_2;
41
+ const validatorContractVersion = existing == null ? latestValidatorVersion : existing.signerConfig.data.validatorContractVersion;
42
+ const validator = await toPasskeyValidator(publicClient, {
43
+ webAuthnKey: passkey,
44
+ entryPoint,
45
+ validatorContractVersion,
46
+ kernelVersion
47
+ });
48
+ const kernelAccount = await createKernelAccount(publicClient, {
49
+ plugins: { sudo: validator },
50
+ entryPoint,
51
+ kernelVersion,
52
+ deployedAccountAddress: existing?.address
53
+ });
54
+ return {
55
+ signerConfig: this.getSignerConfig(validator, validatorContractVersion, inputPasskeyName),
56
+ account: this.decorate(kernelAccount, inputPasskeyName, walletParams)
57
+ };
58
+ } catch (error) {
59
+ if (walletParams.signer.onPasskeyRegistrationError != null) {
60
+ walletParams.signer.onPasskeyRegistrationError(error);
61
+ }
62
+ throw this.mapError(error, inputPasskeyName);
63
+ }
64
+ }
65
+ async getPasskey(user, passkeyName, existing) {
66
+ if (existing != null) {
67
+ return {
68
+ pubX: BigInt(existing.pubKeyX),
69
+ pubY: BigInt(existing.pubKeyY),
70
+ authenticatorId: existing.authenticatorId,
71
+ authenticatorIdHash: existing.authenticatorIdHash
72
+ };
73
+ }
74
+ return toWebAuthnKey({
75
+ passkeyName,
76
+ passkeyServerUrl: this.passkeyServerUrl,
77
+ mode: WebAuthnMode.Register,
78
+ passkeyServerHeaders: this.createPasskeysServerHeaders(user)
79
+ });
80
+ }
81
+ getSignerConfig(validator, validatorContractVersion, passkeyName) {
82
+ return new PasskeySignerConfig({
83
+ ...deserializePasskeyValidatorData(validator.getSerializedData()),
84
+ passkeyName,
85
+ validatorContractVersion,
86
+ domain: window.location.hostname,
87
+ type: "passkeys"
88
+ });
89
+ }
90
+ createPasskeysServerHeaders(user) {
91
+ return {
92
+ "x-api-key": this.apiKey,
93
+ Authorization: `Bearer ${user.jwt}`
94
+ };
95
+ }
96
+ mapError(error, passkeyName) {
97
+ if (error.code === 0 && error.name === "DataError") {
98
+ return new PasskeyIncompatibleAuthenticatorError(passkeyName);
99
+ }
100
+ if (error.message === "Registration not verified") {
101
+ return new PasskeyRegistrationError(passkeyName);
102
+ }
103
+ if (error.code === "ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY" && error.name === "NotAllowedError") {
104
+ return new PasskeyPromptError(passkeyName);
105
+ }
106
+ return error;
107
+ }
108
+ decorate(account, passkeyName, walletParams) {
109
+ return new Proxy(account, {
110
+ get: (target, prop, receiver) => {
111
+ const original = Reflect.get(target, prop, receiver);
112
+ if (typeof original !== "function" || typeof prop !== "string" || !isAccountSigningMethod(prop)) {
113
+ return original;
114
+ }
115
+ const signer = walletParams.signer;
116
+ return async (...args) => {
117
+ const isFirstTransaction = args?.[0]?.factoryData != null;
118
+ if (isFirstTransaction && prop === "signUserOperation" && signer.type === "PASSKEY" && signer.onFirstTimePasskeySigning != null) {
119
+ await signer.onFirstTimePasskeySigning();
120
+ }
121
+ try {
122
+ return await original.call(target, ...args);
123
+ } catch (error) {
124
+ if (signer.onFirstTimePasskeySigningError != null) {
125
+ await signer.onFirstTimePasskeySigningError(error);
126
+ }
127
+ throw this.mapError(error, passkeyName);
128
+ }
129
+ };
130
+ }
131
+ });
132
+ }
133
+ };
134
+ var accountSigningMethods = [
135
+ "signMessage",
136
+ "signTypedData",
137
+ "signUserOperation",
138
+ "signTransaction"
139
+ ];
140
+ function isAccountSigningMethod(method) {
141
+ return accountSigningMethods.includes(method);
142
+ }
143
+ var deserializePasskeyValidatorData = (params) => {
144
+ const uint8Array = base64ToBytes(params);
145
+ const jsonString = new TextDecoder().decode(uint8Array);
146
+ return JSON.parse(jsonString);
147
+ };
148
+ function base64ToBytes(base64) {
149
+ const binString = atob(base64);
150
+ return Uint8Array.from(binString, (m) => m.codePointAt(0));
151
+ }
152
+
153
+ export {
154
+ PasskeyCreationStrategy
155
+ };
156
+ //# sourceMappingURL=chunk-TDJDKTRS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/blockchain/wallets/account/passkey.ts"],"sourcesContent":["import { PasskeyValidatorContractVersion, WebAuthnMode, toPasskeyValidator } from \"@zerodev/passkey-validator\";\nimport { type KernelSmartAccount, type KernelValidator, createKernelAccount } from \"@zerodev/sdk\";\nimport { type WebAuthnKey, toWebAuthnKey } from \"@zerodev/webauthn-key\";\nimport type { SmartAccount } from \"permissionless/accounts\";\nimport type { EntryPoint } from \"permissionless/types/entrypoint\";\n\nimport {\n PasskeyIncompatibleAuthenticatorError,\n PasskeyMismatchError,\n PasskeyPromptError,\n PasskeyRegistrationError,\n} from \"../../../error\";\nimport type { AccountAndSigner, PasskeyCreationContext } from \"../../../types/internal\";\nimport type { PasskeySigner, UserParams, WalletParams } from \"../../../types/params\";\nimport type { PasskeySignerData, PasskeyValidatorSerializedData } from \"../../../types/service\";\nimport { PasskeySignerConfig } from \"./signer\";\nimport type { AccountCreationStrategy } from \"./strategy\";\n\ntype PasskeyValidator = KernelValidator<EntryPoint, \"WebAuthnValidator\"> & {\n getSerializedData: () => string;\n};\nexport class PasskeyCreationStrategy implements AccountCreationStrategy {\n constructor(\n private readonly passkeyServerUrl: string,\n private readonly apiKey: string\n ) {}\n\n public async create({\n user,\n publicClient,\n walletParams,\n entryPoint,\n kernelVersion,\n existing,\n }: PasskeyCreationContext): Promise<AccountAndSigner> {\n const inputPasskeyName = walletParams.signer.passkeyName ?? user.id;\n if (existing != null && existing.signerConfig.data.passkeyName !== inputPasskeyName) {\n throw new PasskeyMismatchError(\n `User '${user.id}' has an existing wallet created with a passkey named '${existing.signerConfig.data.passkeyName}', this does match input passkey name '${inputPasskeyName}'.`,\n existing.signerConfig.display()\n );\n }\n\n try {\n if (existing == null && walletParams.signer.onPrePasskeyRegistration != null) {\n await walletParams.signer.onPrePasskeyRegistration();\n }\n\n const passkey = await this.getPasskey(user, inputPasskeyName, existing?.signerConfig.data);\n\n const latestValidatorVersion = PasskeyValidatorContractVersion.V0_0_2;\n const validatorContractVersion =\n existing == null ? latestValidatorVersion : existing.signerConfig.data.validatorContractVersion;\n\n const validator = await toPasskeyValidator(publicClient, {\n webAuthnKey: passkey,\n entryPoint,\n validatorContractVersion,\n kernelVersion,\n });\n\n const kernelAccount = await createKernelAccount(publicClient, {\n plugins: { sudo: validator },\n entryPoint,\n kernelVersion,\n deployedAccountAddress: existing?.address,\n });\n\n return {\n signerConfig: this.getSignerConfig(validator, validatorContractVersion, inputPasskeyName),\n account: this.decorate(kernelAccount, inputPasskeyName, walletParams),\n };\n } catch (error) {\n if (walletParams.signer.onPasskeyRegistrationError != null) {\n walletParams.signer.onPasskeyRegistrationError(error);\n }\n throw this.mapError(error, inputPasskeyName);\n }\n }\n\n private async getPasskey(\n user: UserParams,\n passkeyName: string,\n existing?: PasskeySignerData\n ): Promise<WebAuthnKey> {\n if (existing != null) {\n return {\n pubX: BigInt(existing.pubKeyX),\n pubY: BigInt(existing.pubKeyY),\n authenticatorId: existing.authenticatorId,\n authenticatorIdHash: existing.authenticatorIdHash,\n };\n }\n\n return toWebAuthnKey({\n passkeyName,\n passkeyServerUrl: this.passkeyServerUrl,\n mode: WebAuthnMode.Register,\n passkeyServerHeaders: this.createPasskeysServerHeaders(user),\n });\n }\n\n private getSignerConfig(\n validator: PasskeyValidator,\n validatorContractVersion: PasskeyValidatorContractVersion,\n passkeyName: string\n ): PasskeySignerConfig {\n return new PasskeySignerConfig({\n ...deserializePasskeyValidatorData(validator.getSerializedData()),\n passkeyName,\n validatorContractVersion,\n domain: window.location.hostname,\n type: \"passkeys\",\n });\n }\n\n private createPasskeysServerHeaders(user: UserParams) {\n return {\n \"x-api-key\": this.apiKey,\n Authorization: `Bearer ${user.jwt}`,\n };\n }\n\n private mapError(error: any, passkeyName: string) {\n if (error.code === 0 && error.name === \"DataError\") {\n return new PasskeyIncompatibleAuthenticatorError(passkeyName);\n }\n\n if (error.message === \"Registration not verified\") {\n return new PasskeyRegistrationError(passkeyName);\n }\n\n if (error.code === \"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY\" && error.name === \"NotAllowedError\") {\n return new PasskeyPromptError(passkeyName);\n }\n\n return error;\n }\n\n private decorate<Account extends KernelSmartAccount<EntryPoint>>(\n account: Account,\n passkeyName: string,\n walletParams: WalletParams\n ): Account {\n return new Proxy(account, {\n get: (target, prop, receiver) => {\n const original = Reflect.get(target, prop, receiver);\n if (typeof original !== \"function\" || typeof prop !== \"string\" || !isAccountSigningMethod(prop)) {\n return original;\n }\n\n const signer = walletParams.signer as PasskeySigner;\n return async (...args: any[]) => {\n const isFirstTransaction = args?.[0]?.factoryData != null;\n if (\n isFirstTransaction &&\n prop === \"signUserOperation\" &&\n signer.type === \"PASSKEY\" &&\n signer.onFirstTimePasskeySigning != null\n ) {\n await signer.onFirstTimePasskeySigning();\n }\n try {\n return await original.call(target, ...args);\n } catch (error) {\n if (signer.onFirstTimePasskeySigningError != null) {\n await signer.onFirstTimePasskeySigningError(error);\n }\n throw this.mapError(error, passkeyName);\n }\n };\n },\n });\n }\n}\n\nconst accountSigningMethods = [\n \"signMessage\",\n \"signTypedData\",\n \"signUserOperation\",\n \"signTransaction\",\n] as const satisfies readonly (keyof SmartAccount<EntryPoint>)[];\n\nfunction isAccountSigningMethod(method: string): method is (typeof accountSigningMethods)[number] {\n return accountSigningMethods.includes(method as any);\n}\n\nconst deserializePasskeyValidatorData = (params: string) => {\n const uint8Array = base64ToBytes(params);\n const jsonString = new TextDecoder().decode(uint8Array);\n\n return JSON.parse(jsonString) as PasskeyValidatorSerializedData;\n};\n\nfunction base64ToBytes(base64: string) {\n const binString = atob(base64);\n return Uint8Array.from(binString, (m) => m.codePointAt(0) as number);\n}\n"],"mappings":"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","names":[]}
@@ -0,0 +1,59 @@
1
+ import {
2
+ EOASignerConfig
3
+ } from "./chunk-3R6PW6HY.js";
4
+ import {
5
+ equalsIgnoreCase
6
+ } from "./chunk-SMDX2MXU.js";
7
+ import {
8
+ createOwnerSigner
9
+ } from "./chunk-EQSMHR77.js";
10
+ import {
11
+ AdminMismatchError
12
+ } from "./chunk-ASIPMVRQ.js";
13
+
14
+ // src/blockchain/wallets/account/eoa.ts
15
+ import { signerToEcdsaValidator } from "@zerodev/ecdsa-validator";
16
+ import { createKernelAccount } from "@zerodev/sdk";
17
+ var EOACreationStrategy = class {
18
+ async create({
19
+ chain,
20
+ publicClient,
21
+ entryPoint,
22
+ walletParams,
23
+ kernelVersion,
24
+ user,
25
+ existing
26
+ }) {
27
+ const eoa = await createOwnerSigner({
28
+ chain,
29
+ walletParams
30
+ });
31
+ if (existing != null && !equalsIgnoreCase(eoa.address, existing.signerConfig.data.eoaAddress)) {
32
+ throw new AdminMismatchError(
33
+ `User '${user.id}' has an existing wallet with an eoa signer '${existing.signerConfig.data.eoaAddress}', this does not match input eoa signer '${eoa.address}'.`,
34
+ existing.signerConfig.display(),
35
+ { type: "eoa", eoaAddress: existing.signerConfig.data.eoaAddress }
36
+ );
37
+ }
38
+ const ecdsaValidator = await signerToEcdsaValidator(publicClient, {
39
+ signer: eoa,
40
+ entryPoint,
41
+ kernelVersion
42
+ });
43
+ const account = await createKernelAccount(publicClient, {
44
+ plugins: {
45
+ sudo: ecdsaValidator
46
+ },
47
+ index: 0n,
48
+ entryPoint,
49
+ kernelVersion,
50
+ deployedAccountAddress: existing?.address
51
+ });
52
+ return { account, signerConfig: new EOASignerConfig({ eoaAddress: eoa.address, type: "eoa" }) };
53
+ }
54
+ };
55
+
56
+ export {
57
+ EOACreationStrategy
58
+ };
59
+ //# sourceMappingURL=chunk-U4OBHCIP.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/blockchain/wallets/account/eoa.ts"],"sourcesContent":["import { signerToEcdsaValidator } from \"@zerodev/ecdsa-validator\";\nimport { createKernelAccount } from \"@zerodev/sdk\";\n\nimport { AdminMismatchError } from \"../../../error\";\nimport type { AccountAndSigner, EOACreationContext } from \"../../../types/internal\";\nimport { equalsIgnoreCase } from \"../../../utils/helpers\";\nimport { createOwnerSigner } from \"../../../utils/signer\";\nimport { EOASignerConfig } from \"./signer\";\nimport type { AccountCreationStrategy } from \"./strategy\";\n\nexport class EOACreationStrategy implements AccountCreationStrategy {\n public async create({\n chain,\n publicClient,\n entryPoint,\n walletParams,\n kernelVersion,\n user,\n existing,\n }: EOACreationContext): Promise<AccountAndSigner> {\n const eoa = await createOwnerSigner({\n chain,\n walletParams,\n });\n\n if (existing != null && !equalsIgnoreCase(eoa.address, existing.signerConfig.data.eoaAddress)) {\n throw new AdminMismatchError(\n `User '${user.id}' has an existing wallet with an eoa signer '${existing.signerConfig.data.eoaAddress}', this does not match input eoa signer '${eoa.address}'.`,\n existing.signerConfig.display(),\n { type: \"eoa\", eoaAddress: existing.signerConfig.data.eoaAddress }\n );\n }\n\n const ecdsaValidator = await signerToEcdsaValidator(publicClient, {\n signer: eoa,\n entryPoint,\n kernelVersion,\n });\n const account = await createKernelAccount(publicClient, {\n plugins: {\n sudo: ecdsaValidator,\n },\n index: 0n,\n entryPoint,\n kernelVersion,\n deployedAccountAddress: existing?.address,\n });\n\n return { account, signerConfig: new EOASignerConfig({ eoaAddress: eoa.address, type: \"eoa\" }) };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA,SAAS,8BAA8B;AACvC,SAAS,2BAA2B;AAS7B,IAAM,sBAAN,MAA6D;AAAA,EAChE,MAAa,OAAO;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACJ,GAAkD;AAC9C,UAAM,MAAM,MAAM,kBAAkB;AAAA,MAChC;AAAA,MACA;AAAA,IACJ,CAAC;AAED,QAAI,YAAY,QAAQ,CAAC,iBAAiB,IAAI,SAAS,SAAS,aAAa,KAAK,UAAU,GAAG;AAC3F,YAAM,IAAI;AAAA,QACN,SAAS,KAAK,EAAE,gDAAgD,SAAS,aAAa,KAAK,UAAU,4CAA4C,IAAI,OAAO;AAAA,QAC5J,SAAS,aAAa,QAAQ;AAAA,QAC9B,EAAE,MAAM,OAAO,YAAY,SAAS,aAAa,KAAK,WAAW;AAAA,MACrE;AAAA,IACJ;AAEA,UAAM,iBAAiB,MAAM,uBAAuB,cAAc;AAAA,MAC9D,QAAQ;AAAA,MACR;AAAA,MACA;AAAA,IACJ,CAAC;AACD,UAAM,UAAU,MAAM,oBAAoB,cAAc;AAAA,MACpD,SAAS;AAAA,QACL,MAAM;AAAA,MACV;AAAA,MACA,OAAO;AAAA,MACP;AAAA,MACA;AAAA,MACA,wBAAwB,UAAU;AAAA,IACtC,CAAC;AAED,WAAO,EAAE,SAAS,cAAc,IAAI,gBAAgB,EAAE,YAAY,IAAI,SAAS,MAAM,MAAM,CAAC,EAAE;AAAA,EAClG;AACJ;","names":[]}
@@ -0,0 +1,27 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/blockchain/rpc.ts
2
+ var _commonsdkbase = require('@crossmint/common-sdk-base');
3
+ var ALCHEMY_API_KEY = "-7M6vRDBDknwvMxnqah_jbcieWg0qad9";
4
+ var PIMLICO_API_KEY = "pim_9dKmQPxiTCvtbUNF7XFBbA";
5
+ var ALCHEMY_RPC_SUBDOMAIN = {
6
+ polygon: "polygon-mainnet",
7
+ "polygon-amoy": "polygon-amoy",
8
+ base: "base-mainnet",
9
+ "base-sepolia": "base-sepolia",
10
+ optimism: "opt-mainnet",
11
+ "optimism-sepolia": "opt-sepolia",
12
+ arbitrum: "arb-mainnet",
13
+ "arbitrum-sepolia": "arb-sepolia"
14
+ };
15
+ function getAlchemyRPC(chain) {
16
+ return `https://${ALCHEMY_RPC_SUBDOMAIN[chain]}.g.alchemy.com/v2/${ALCHEMY_API_KEY}`;
17
+ }
18
+ function getPimlicoBundlerRPC(chain) {
19
+ return `https://api.pimlico.io/v2/${_commonsdkbase.blockchainToChainId.call(void 0, chain)}/rpc?apikey=${PIMLICO_API_KEY}`;
20
+ }
21
+
22
+
23
+
24
+
25
+
26
+ exports.ALCHEMY_RPC_SUBDOMAIN = ALCHEMY_RPC_SUBDOMAIN; exports.getAlchemyRPC = getAlchemyRPC; exports.getPimlicoBundlerRPC = getPimlicoBundlerRPC;
27
+ //# sourceMappingURL=chunk-UQKE6R5W.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/blockchain/rpc.ts"],"names":[],"mappings":";AAAA,SAAS,2BAA2B;AAIpC,IAAM,kBAAkB;AACxB,IAAM,kBAAkB;AAEjB,IAAM,wBAA0D;AAAA,EACnE,SAAS;AAAA,EACT,gBAAgB;AAAA,EAChB,MAAM;AAAA,EACN,gBAAgB;AAAA,EAChB,UAAU;AAAA,EACV,oBAAoB;AAAA,EACpB,UAAU;AAAA,EACV,oBAAoB;AACxB;AAEO,SAAS,cAAc,OAAiC;AAC3D,SAAO,WAAW,sBAAsB,KAAK,CAAC,qBAAqB,eAAe;AACtF;AAEO,SAAS,qBAAqB,OAAiC;AAClE,SAAO,6BAA6B,oBAAoB,KAAK,CAAC,eAAe,eAAe;AAChG","sourcesContent":["import { blockchainToChainId } from \"@crossmint/common-sdk-base\";\n\nimport type { SmartWalletChain } from \"./chains\";\n\nconst ALCHEMY_API_KEY = \"-7M6vRDBDknwvMxnqah_jbcieWg0qad9\";\nconst PIMLICO_API_KEY = \"pim_9dKmQPxiTCvtbUNF7XFBbA\";\n\nexport const ALCHEMY_RPC_SUBDOMAIN: Record<SmartWalletChain, string> = {\n polygon: \"polygon-mainnet\",\n \"polygon-amoy\": \"polygon-amoy\",\n base: \"base-mainnet\",\n \"base-sepolia\": \"base-sepolia\",\n optimism: \"opt-mainnet\",\n \"optimism-sepolia\": \"opt-sepolia\",\n arbitrum: \"arb-mainnet\",\n \"arbitrum-sepolia\": \"arb-sepolia\",\n};\n\nexport function getAlchemyRPC(chain: SmartWalletChain): string {\n return `https://${ALCHEMY_RPC_SUBDOMAIN[chain]}.g.alchemy.com/v2/${ALCHEMY_API_KEY}`;\n}\n\nexport function getPimlicoBundlerRPC(chain: SmartWalletChain): string {\n return `https://api.pimlico.io/v2/${blockchainToChainId(chain)}/rpc?apikey=${PIMLICO_API_KEY}`;\n}\n"]}