@crossmint/client-sdk-smart-wallet 0.1.36 → 0.3.0

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 (287) hide show
  1. package/README.md +293 -0
  2. package/dist/abi/entryPoint.cjs +1 -0
  3. package/dist/abi/entryPoint.d.cts +777 -0
  4. package/dist/abi/entryPoint.d.ts +777 -0
  5. package/dist/abi/entryPoint.js +1 -0
  6. package/dist/abi/erc1155.cjs +1 -0
  7. package/dist/abi/erc1155.d.cts +254 -0
  8. package/dist/abi/erc1155.d.ts +254 -0
  9. package/dist/abi/erc1155.js +1 -0
  10. package/dist/abi/erc20.cjs +1 -0
  11. package/dist/abi/erc20.d.cts +170 -0
  12. package/dist/abi/erc20.d.ts +170 -0
  13. package/dist/abi/erc20.js +1 -0
  14. package/dist/abi/erc721.cjs +1 -0
  15. package/dist/abi/erc721.d.cts +247 -0
  16. package/dist/abi/erc721.d.ts +247 -0
  17. package/dist/abi/erc721.js +1 -0
  18. package/dist/apiService-BYpt1gEl.d.cts +145 -0
  19. package/dist/apiService-D1sqTI5D.d.ts +145 -0
  20. package/dist/apiService.cjs +1 -0
  21. package/dist/apiService.d.cts +10 -0
  22. package/dist/apiService.d.ts +10 -0
  23. package/dist/apiService.js +1 -0
  24. package/dist/{chunk-IUIBQFWY.cjs → chunk-23IWY6XV.cjs} +1 -1
  25. package/dist/chunk-2LM65VO3.js +1 -0
  26. package/dist/chunk-2MQHIAJE.js +1 -0
  27. package/dist/chunk-2ZE5TIKL.cjs +1 -0
  28. package/dist/chunk-4PMBBA3O.cjs +1 -0
  29. package/dist/chunk-6EKMVDH4.js +1 -0
  30. package/dist/chunk-73LUJQGU.cjs +1 -0
  31. package/dist/chunk-75JNTS3U.js +1 -0
  32. package/dist/chunk-AS5VIM5V.cjs +1 -0
  33. package/dist/{chunk-2RB6U5DY.js → chunk-BF7L4FS4.js} +1 -1
  34. package/dist/chunk-DB2QM3HB.js +1 -0
  35. package/dist/chunk-F7ZYVWUR.cjs +1 -0
  36. package/dist/chunk-GGKMZPIA.js +1 -0
  37. package/dist/chunk-HQHK4WTT.js +1 -0
  38. package/dist/chunk-I5RZI2HB.js +1 -0
  39. package/dist/chunk-J5SRLI35.cjs +1 -0
  40. package/dist/chunk-JPF3ZY6Z.js +1 -0
  41. package/dist/chunk-KXYDJTZS.cjs +1 -0
  42. package/dist/chunk-LPLLPZFU.cjs +1 -0
  43. package/dist/chunk-MLTT5BGD.cjs +1 -0
  44. package/dist/chunk-MOCVP6AE.cjs +1 -0
  45. package/dist/chunk-NRMCCERQ.cjs +1 -0
  46. package/dist/chunk-NXTHA2ZL.js +1 -0
  47. package/dist/chunk-QIY34WEL.js +1 -0
  48. package/dist/chunk-UBRUUSMF.js +1 -0
  49. package/dist/chunk-VEZ3PQGX.js +1 -0
  50. package/dist/{chunk-2TPNP5FL.cjs → chunk-XVJ4PII4.cjs} +1 -1
  51. package/dist/chunk-XYN5AGKO.cjs +1 -0
  52. package/dist/error/index.cjs +1 -1
  53. package/dist/error/index.d.cts +25 -43
  54. package/dist/error/index.d.ts +25 -43
  55. package/dist/error/index.js +1 -1
  56. package/dist/error/processor.cjs +1 -1
  57. package/dist/error/processor.d.cts +0 -13
  58. package/dist/error/processor.d.ts +0 -13
  59. package/dist/error/processor.js +1 -1
  60. package/dist/evm/chains/definitions/story-testnet.cjs +1 -0
  61. package/dist/evm/chains/definitions/story-testnet.js +1 -0
  62. package/dist/evm/chains/definitions/story.cjs +1 -0
  63. package/dist/evm/chains/definitions/story.js +1 -0
  64. package/dist/evm/chains/index.cjs +1 -0
  65. package/dist/{blockchain/chains.d.cts → evm/chains/index.d.cts} +4 -7
  66. package/dist/{blockchain/chains.d.ts → evm/chains/index.d.ts} +4 -7
  67. package/dist/evm/chains/index.js +1 -0
  68. package/dist/evm/rpc.cjs +1 -0
  69. package/dist/{blockchain → evm}/rpc.d.cts +4 -3
  70. package/dist/{blockchain → evm}/rpc.d.ts +4 -3
  71. package/dist/evm/rpc.js +1 -0
  72. package/dist/evm/smartWalletClient.d.cts +64 -0
  73. package/dist/evm/smartWalletClient.d.ts +64 -0
  74. package/dist/evm/transfer.cjs +1 -0
  75. package/dist/evm/transfer.d.cts +8 -0
  76. package/dist/evm/transfer.d.ts +8 -0
  77. package/dist/evm/transfer.js +1 -0
  78. package/dist/evm/wallet.cjs +1 -0
  79. package/dist/evm/wallet.d.cts +10 -0
  80. package/dist/evm/wallet.d.ts +10 -0
  81. package/dist/evm/wallet.js +1 -0
  82. package/dist/index.cjs +1 -1
  83. package/dist/index.d.cts +9 -20
  84. package/dist/index.d.ts +9 -20
  85. package/dist/index.js +1 -1
  86. package/dist/sdk.cjs +1 -0
  87. package/dist/sdk.d.cts +45 -0
  88. package/dist/sdk.d.ts +45 -0
  89. package/dist/sdk.js +1 -0
  90. package/dist/services/index.cjs +1 -1
  91. package/dist/services/index.js +1 -1
  92. package/dist/services/logger.cjs +1 -1
  93. package/dist/services/logger.js +1 -1
  94. package/dist/smartWalletService.cjs +1 -0
  95. package/dist/smartWalletService.d.cts +10 -0
  96. package/dist/smartWalletService.d.ts +10 -0
  97. package/dist/smartWalletService.js +1 -0
  98. package/dist/types/api.d.cts +195 -0
  99. package/dist/types/api.d.ts +195 -0
  100. package/dist/types/transfer.d.cts +46 -0
  101. package/dist/types/transfer.d.ts +46 -0
  102. package/dist/utils/constants.cjs +1 -1
  103. package/dist/utils/constants.d.cts +5 -6
  104. package/dist/utils/constants.d.ts +5 -6
  105. package/dist/utils/constants.js +1 -1
  106. package/dist/utils/index.cjs +1 -0
  107. package/dist/utils/index.d.cts +3 -0
  108. package/dist/utils/index.d.ts +3 -0
  109. package/dist/utils/index.js +1 -0
  110. package/package.json +2 -7
  111. package/dist/SmartWalletSDK.cjs +0 -1
  112. package/dist/SmartWalletSDK.d.cts +0 -47
  113. package/dist/SmartWalletSDK.d.ts +0 -47
  114. package/dist/SmartWalletSDK.js +0 -1
  115. package/dist/api/CrossmintWalletService.cjs +0 -1
  116. package/dist/api/CrossmintWalletService.d.cts +0 -31
  117. package/dist/api/CrossmintWalletService.d.ts +0 -31
  118. package/dist/api/CrossmintWalletService.js +0 -1
  119. package/dist/blockchain/chains.cjs +0 -1
  120. package/dist/blockchain/chains.js +0 -1
  121. package/dist/blockchain/rpc.cjs +0 -1
  122. package/dist/blockchain/rpc.js +0 -1
  123. package/dist/blockchain/transfer.cjs +0 -1
  124. package/dist/blockchain/transfer.d.cts +0 -23
  125. package/dist/blockchain/transfer.d.ts +0 -23
  126. package/dist/blockchain/transfer.js +0 -1
  127. package/dist/blockchain/wallets/EVMSmartWallet.cjs +0 -1
  128. package/dist/blockchain/wallets/EVMSmartWallet.d.cts +0 -102
  129. package/dist/blockchain/wallets/EVMSmartWallet.d.ts +0 -102
  130. package/dist/blockchain/wallets/EVMSmartWallet.js +0 -1
  131. package/dist/blockchain/wallets/SendTransactionService.cjs +0 -1
  132. package/dist/blockchain/wallets/SendTransactionService.d.cts +0 -84
  133. package/dist/blockchain/wallets/SendTransactionService.d.ts +0 -84
  134. package/dist/blockchain/wallets/SendTransactionService.js +0 -1
  135. package/dist/blockchain/wallets/account/cache.cjs +0 -1
  136. package/dist/blockchain/wallets/account/cache.d.cts +0 -25
  137. package/dist/blockchain/wallets/account/cache.d.ts +0 -25
  138. package/dist/blockchain/wallets/account/cache.js +0 -1
  139. package/dist/blockchain/wallets/account/config.cjs +0 -1
  140. package/dist/blockchain/wallets/account/config.d.cts +0 -47
  141. package/dist/blockchain/wallets/account/config.d.ts +0 -47
  142. package/dist/blockchain/wallets/account/config.js +0 -1
  143. package/dist/blockchain/wallets/account/creator.cjs +0 -1
  144. package/dist/blockchain/wallets/account/creator.d.cts +0 -26
  145. package/dist/blockchain/wallets/account/creator.d.ts +0 -26
  146. package/dist/blockchain/wallets/account/creator.js +0 -1
  147. package/dist/blockchain/wallets/account/eoa.cjs +0 -1
  148. package/dist/blockchain/wallets/account/eoa.d.cts +0 -21
  149. package/dist/blockchain/wallets/account/eoa.d.ts +0 -21
  150. package/dist/blockchain/wallets/account/eoa.js +0 -1
  151. package/dist/blockchain/wallets/account/passkey.cjs +0 -1
  152. package/dist/blockchain/wallets/account/passkey.d.cts +0 -29
  153. package/dist/blockchain/wallets/account/passkey.d.ts +0 -29
  154. package/dist/blockchain/wallets/account/passkey.js +0 -1
  155. package/dist/blockchain/wallets/account/signer.cjs +0 -1
  156. package/dist/blockchain/wallets/account/signer.d.cts +0 -14
  157. package/dist/blockchain/wallets/account/signer.d.ts +0 -14
  158. package/dist/blockchain/wallets/account/signer.js +0 -1
  159. package/dist/blockchain/wallets/account/strategy.d.cts +0 -20
  160. package/dist/blockchain/wallets/account/strategy.d.ts +0 -20
  161. package/dist/blockchain/wallets/clientDecorator.cjs +0 -1
  162. package/dist/blockchain/wallets/clientDecorator.d.cts +0 -38
  163. package/dist/blockchain/wallets/clientDecorator.d.ts +0 -38
  164. package/dist/blockchain/wallets/clientDecorator.js +0 -1
  165. package/dist/blockchain/wallets/definitions/story-testnet.cjs +0 -1
  166. package/dist/blockchain/wallets/definitions/story-testnet.js +0 -1
  167. package/dist/blockchain/wallets/definitions/story.cjs +0 -1
  168. package/dist/blockchain/wallets/definitions/story.js +0 -1
  169. package/dist/blockchain/wallets/index.cjs +0 -1
  170. package/dist/blockchain/wallets/index.d.cts +0 -20
  171. package/dist/blockchain/wallets/index.d.ts +0 -20
  172. package/dist/blockchain/wallets/index.js +0 -1
  173. package/dist/blockchain/wallets/paymaster.cjs +0 -1
  174. package/dist/blockchain/wallets/paymaster.d.cts +0 -29
  175. package/dist/blockchain/wallets/paymaster.d.ts +0 -29
  176. package/dist/blockchain/wallets/paymaster.js +0 -1
  177. package/dist/blockchain/wallets/service.cjs +0 -1
  178. package/dist/blockchain/wallets/service.d.cts +0 -41
  179. package/dist/blockchain/wallets/service.d.ts +0 -41
  180. package/dist/blockchain/wallets/service.js +0 -1
  181. package/dist/chunk-2R6HK64N.cjs +0 -1
  182. package/dist/chunk-2ZFSHKM6.js +0 -1
  183. package/dist/chunk-3F6P4HUZ.js +0 -1
  184. package/dist/chunk-4YV6KMFQ.js +0 -1
  185. package/dist/chunk-6ODPWORJ.cjs +0 -1
  186. package/dist/chunk-7AVDZZGD.cjs +0 -1
  187. package/dist/chunk-7G7GOR7X.cjs +0 -1
  188. package/dist/chunk-ATQ4WGCW.js +0 -1
  189. package/dist/chunk-BII7Y2A3.cjs +0 -1
  190. package/dist/chunk-BJZQA5VC.js +0 -1
  191. package/dist/chunk-C3VZY7VJ.js +0 -1
  192. package/dist/chunk-CJBR5TGN.js +0 -3
  193. package/dist/chunk-CUTQYF3F.js +0 -1
  194. package/dist/chunk-D4NDUT36.js +0 -1
  195. package/dist/chunk-DIDKPOO2.cjs +0 -1
  196. package/dist/chunk-EBIEPPSD.js +0 -1
  197. package/dist/chunk-ETVJGLNY.js +0 -1
  198. package/dist/chunk-EVNFELF3.cjs +0 -3
  199. package/dist/chunk-FHNNZVNU.js +0 -1
  200. package/dist/chunk-FWARYLZ3.js +0 -1
  201. package/dist/chunk-GB35YMN4.cjs +0 -1
  202. package/dist/chunk-GGIAHBMC.js +0 -2
  203. package/dist/chunk-H4CMXNVK.js +0 -1
  204. package/dist/chunk-IQTGPM2U.cjs +0 -1
  205. package/dist/chunk-JYW5DCVU.js +0 -1
  206. package/dist/chunk-KCVR32TQ.cjs +0 -1
  207. package/dist/chunk-KREX6Z32.js +0 -1
  208. package/dist/chunk-KROX2DDP.cjs +0 -1
  209. package/dist/chunk-KYPTGHC6.cjs +0 -1
  210. package/dist/chunk-M4K3IZTT.cjs +0 -1
  211. package/dist/chunk-NLGILHJS.js +0 -1
  212. package/dist/chunk-NOTF3PP3.cjs +0 -1
  213. package/dist/chunk-NQUKI27M.cjs +0 -1
  214. package/dist/chunk-O2ACORII.cjs +0 -1
  215. package/dist/chunk-OXRLBURF.js +0 -1
  216. package/dist/chunk-PZ6Q22YJ.js +0 -1
  217. package/dist/chunk-S2XBSAGM.js +0 -1
  218. package/dist/chunk-S4V7TF5V.cjs +0 -2
  219. package/dist/chunk-SCXFZMLR.cjs +0 -1
  220. package/dist/chunk-STH2LE35.cjs +0 -1
  221. package/dist/chunk-SWWOVT47.cjs +0 -1
  222. package/dist/chunk-UG47CBKR.js +0 -1
  223. package/dist/chunk-UPURFW46.js +0 -1
  224. package/dist/chunk-WDKJ6P7K.js +0 -1
  225. package/dist/chunk-WJ6XJMRD.cjs +0 -1
  226. package/dist/chunk-XJGFG3RT.cjs +0 -1
  227. package/dist/chunk-XQ2K2K23.cjs +0 -1
  228. package/dist/chunk-XRZ2XPQM.js +0 -1
  229. package/dist/chunk-YVFO5W3R.cjs +0 -1
  230. package/dist/chunk-Z7AZOEVX.cjs +0 -1
  231. package/dist/chunk-ZQM4FEXV.js +0 -1
  232. package/dist/service-DqYCir8s.d.ts +0 -103
  233. package/dist/service-Ir-Qho-9.d.cts +0 -103
  234. package/dist/types/internal.cjs +0 -1
  235. package/dist/types/internal.d.cts +0 -14
  236. package/dist/types/internal.d.ts +0 -14
  237. package/dist/types/internal.js +0 -1
  238. package/dist/types/params.d.cts +0 -33
  239. package/dist/types/params.d.ts +0 -33
  240. package/dist/types/schema.cjs +0 -1
  241. package/dist/types/schema.d.cts +0 -241
  242. package/dist/types/schema.d.ts +0 -241
  243. package/dist/types/schema.js +0 -1
  244. package/dist/types/service.d.cts +0 -14
  245. package/dist/types/service.d.ts +0 -14
  246. package/dist/types/token.cjs +0 -1
  247. package/dist/types/token.d.cts +0 -35
  248. package/dist/types/token.d.ts +0 -35
  249. package/dist/types/token.js +0 -0
  250. package/dist/utils/api.cjs +0 -1
  251. package/dist/utils/api.d.cts +0 -4
  252. package/dist/utils/api.d.ts +0 -4
  253. package/dist/utils/api.js +0 -1
  254. package/dist/utils/blockchain.cjs +0 -1
  255. package/dist/utils/blockchain.d.cts +0 -7
  256. package/dist/utils/blockchain.d.ts +0 -7
  257. package/dist/utils/blockchain.js +0 -1
  258. package/dist/utils/environment.cjs +0 -1
  259. package/dist/utils/environment.d.cts +0 -3
  260. package/dist/utils/environment.d.ts +0 -3
  261. package/dist/utils/environment.js +0 -1
  262. package/dist/utils/helpers.cjs +0 -1
  263. package/dist/utils/helpers.d.cts +0 -4
  264. package/dist/utils/helpers.d.ts +0 -4
  265. package/dist/utils/helpers.js +0 -1
  266. package/dist/utils/signer.cjs +0 -1
  267. package/dist/utils/signer.d.cts +0 -15
  268. package/dist/utils/signer.d.ts +0 -15
  269. package/dist/utils/signer.js +0 -1
  270. package/dist/utils/test.cjs +0 -1
  271. package/dist/utils/test.d.cts +0 -18
  272. package/dist/utils/test.d.ts +0 -18
  273. package/dist/utils/test.js +0 -1
  274. /package/dist/{chunk-HQXF6VHP.cjs → chunk-5URY3C2T.cjs} +0 -0
  275. /package/dist/{chunk-DYVHPARQ.js → chunk-KVFFSUF4.js} +0 -0
  276. /package/dist/{chunk-GPZ7PHS6.cjs → chunk-MFUN74KH.cjs} +0 -0
  277. /package/dist/{chunk-NT7LBRZQ.js → chunk-XLACPZJJ.js} +0 -0
  278. /package/dist/{blockchain/wallets → evm/chains}/definitions/story-testnet.d.cts +0 -0
  279. /package/dist/{blockchain/wallets → evm/chains}/definitions/story-testnet.d.ts +0 -0
  280. /package/dist/{blockchain/wallets → evm/chains}/definitions/story.d.cts +0 -0
  281. /package/dist/{blockchain/wallets → evm/chains}/definitions/story.d.ts +0 -0
  282. /package/dist/{blockchain/wallets/account/strategy.cjs → evm/smartWalletClient.cjs} +0 -0
  283. /package/dist/{blockchain/wallets/account/strategy.js → evm/smartWalletClient.js} +0 -0
  284. /package/dist/types/{params.cjs → api.cjs} +0 -0
  285. /package/dist/types/{params.js → api.js} +0 -0
  286. /package/dist/types/{service.cjs → transfer.cjs} +0 -0
  287. /package/dist/types/{service.js → transfer.js} +0 -0
@@ -1,20 +0,0 @@
1
- export { EVMSmartWallet } from './EVMSmartWallet.js';
2
- import 'viem';
3
- import '../../api/CrossmintWalletService.js';
4
- import '@crossmint/client-sdk-base';
5
- import 'permissionless';
6
- import 'permissionless/types/entrypoint';
7
- import '../chains.js';
8
- import 'viem/chains';
9
- import '@crossmint/common-sdk-base';
10
- import '../../types/params.js';
11
- import '../../service-DqYCir8s.js';
12
- import 'zod';
13
- import '@zerodev/sdk';
14
- import 'permissionless/accounts';
15
- import '../../types/schema.js';
16
- import '@zerodev/passkey-validator';
17
- import '../../utils/constants.js';
18
- import '../../types/token.js';
19
- import './SendTransactionService.js';
20
- import 'permissionless/_types/types';
@@ -1 +0,0 @@
1
- import{a as o}from"../../chunk-ETVJGLNY.js";import"../../chunk-S2XBSAGM.js";import"../../chunk-3F6P4HUZ.js";import"../../chunk-UPURFW46.js";export{o as EVMSmartWallet};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkIQTGPM2Ucjs = require('../../chunk-IQTGPM2U.cjs');require('../../chunk-WJ6XJMRD.cjs');exports.paymasterMiddleware = _chunkIQTGPM2Ucjs.b; exports.usePaymaster = _chunkIQTGPM2Ucjs.a;
@@ -1,29 +0,0 @@
1
- import { CrossmintWalletService } from '../../api/CrossmintWalletService.cjs';
2
- import { Middleware } from 'permissionless/actions/smartAccount';
3
- import { PimlicoBundlerClient } from 'permissionless/clients/pimlico';
4
- import { EntryPoint } from 'permissionless/types/entrypoint';
5
- import { UserParams } from '../../types/params.cjs';
6
- import { SmartWalletChain } from '../chains.cjs';
7
- import '@crossmint/client-sdk-base';
8
- import 'permissionless';
9
- import '../../service-Ir-Qho-9.cjs';
10
- import 'zod';
11
- import '@zerodev/sdk';
12
- import 'permissionless/accounts';
13
- import 'viem';
14
- import '../../types/schema.cjs';
15
- import '@zerodev/passkey-validator';
16
- import '../../utils/constants.cjs';
17
- import 'viem/chains';
18
- import '@crossmint/common-sdk-base';
19
-
20
- declare function usePaymaster(chain: SmartWalletChain): boolean;
21
- declare function paymasterMiddleware({ bundlerClient, entryPoint, chain, walletService, user, }: {
22
- bundlerClient: PimlicoBundlerClient<EntryPoint>;
23
- entryPoint: EntryPoint;
24
- chain: SmartWalletChain;
25
- walletService: CrossmintWalletService;
26
- user: UserParams;
27
- }): Middleware<EntryPoint>;
28
-
29
- export { paymasterMiddleware, usePaymaster };
@@ -1,29 +0,0 @@
1
- import { CrossmintWalletService } from '../../api/CrossmintWalletService.js';
2
- import { Middleware } from 'permissionless/actions/smartAccount';
3
- import { PimlicoBundlerClient } from 'permissionless/clients/pimlico';
4
- import { EntryPoint } from 'permissionless/types/entrypoint';
5
- import { UserParams } from '../../types/params.js';
6
- import { SmartWalletChain } from '../chains.js';
7
- import '@crossmint/client-sdk-base';
8
- import 'permissionless';
9
- import '../../service-DqYCir8s.js';
10
- import 'zod';
11
- import '@zerodev/sdk';
12
- import 'permissionless/accounts';
13
- import 'viem';
14
- import '../../types/schema.js';
15
- import '@zerodev/passkey-validator';
16
- import '../../utils/constants.js';
17
- import 'viem/chains';
18
- import '@crossmint/common-sdk-base';
19
-
20
- declare function usePaymaster(chain: SmartWalletChain): boolean;
21
- declare function paymasterMiddleware({ bundlerClient, entryPoint, chain, walletService, user, }: {
22
- bundlerClient: PimlicoBundlerClient<EntryPoint>;
23
- entryPoint: EntryPoint;
24
- chain: SmartWalletChain;
25
- walletService: CrossmintWalletService;
26
- user: UserParams;
27
- }): Middleware<EntryPoint>;
28
-
29
- export { paymasterMiddleware, usePaymaster };
@@ -1 +0,0 @@
1
- import{a,b}from"../../chunk-NLGILHJS.js";import"../../chunk-C3VZY7VJ.js";export{b as paymasterMiddleware,a as usePaymaster};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkNOTF3PP3cjs = require('../../chunk-NOTF3PP3.cjs');require('../../chunk-IQTGPM2U.cjs');require('../../chunk-WJ6XJMRD.cjs');require('../../chunk-SWWOVT47.cjs');require('../../chunk-7AVDZZGD.cjs');require('../../chunk-IUIBQFWY.cjs');require('../../chunk-NQUKI27M.cjs');require('../../chunk-HQXF6VHP.cjs');require('../../chunk-GPZ7PHS6.cjs');require('../../chunk-KYPTGHC6.cjs');require('../../chunk-BII7Y2A3.cjs');require('../../chunk-M4K3IZTT.cjs');exports.SmartWalletService = _chunkNOTF3PP3cjs.a;
@@ -1,41 +0,0 @@
1
- import { CrossmintWalletService } from '../../api/CrossmintWalletService.cjs';
2
- import { UserParams, WalletParams } from '../../types/params.cjs';
3
- import { SmartWalletChain } from '../chains.cjs';
4
- import { EVMSmartWallet } from './EVMSmartWallet.cjs';
5
- import { AccountConfigService } from './account/config.cjs';
6
- import { AccountCreator } from './account/creator.cjs';
7
- import { ClientDecorator } from './clientDecorator.cjs';
8
- import '@crossmint/client-sdk-base';
9
- import 'permissionless';
10
- import 'permissionless/types/entrypoint';
11
- import '../../service-Ir-Qho-9.cjs';
12
- import 'zod';
13
- import '@zerodev/sdk';
14
- import 'permissionless/accounts';
15
- import 'viem';
16
- import '../../types/schema.cjs';
17
- import '@zerodev/passkey-validator';
18
- import '../../utils/constants.cjs';
19
- import 'viem/chains';
20
- import '@crossmint/common-sdk-base';
21
- import '../../types/token.cjs';
22
- import './SendTransactionService.cjs';
23
- import 'permissionless/_types/types';
24
- import './account/cache.cjs';
25
- import './account/eoa.cjs';
26
- import './account/strategy.cjs';
27
- import './account/passkey.cjs';
28
- import '../../error/processor.cjs';
29
- import '../../error/index.cjs';
30
-
31
- declare class SmartWalletService {
32
- private readonly crossmintService;
33
- private readonly accountConfigService;
34
- private readonly accountCreator;
35
- private readonly clientDecorator;
36
- constructor(crossmintService: CrossmintWalletService, accountConfigService: AccountConfigService, accountCreator: AccountCreator, clientDecorator: ClientDecorator);
37
- getOrCreate(user: UserParams, chain: SmartWalletChain, walletParams: WalletParams): Promise<EVMSmartWallet>;
38
- private smartAccountClient;
39
- }
40
-
41
- export { SmartWalletService };
@@ -1,41 +0,0 @@
1
- import { CrossmintWalletService } from '../../api/CrossmintWalletService.js';
2
- import { UserParams, WalletParams } from '../../types/params.js';
3
- import { SmartWalletChain } from '../chains.js';
4
- import { EVMSmartWallet } from './EVMSmartWallet.js';
5
- import { AccountConfigService } from './account/config.js';
6
- import { AccountCreator } from './account/creator.js';
7
- import { ClientDecorator } from './clientDecorator.js';
8
- import '@crossmint/client-sdk-base';
9
- import 'permissionless';
10
- import 'permissionless/types/entrypoint';
11
- import '../../service-DqYCir8s.js';
12
- import 'zod';
13
- import '@zerodev/sdk';
14
- import 'permissionless/accounts';
15
- import 'viem';
16
- import '../../types/schema.js';
17
- import '@zerodev/passkey-validator';
18
- import '../../utils/constants.js';
19
- import 'viem/chains';
20
- import '@crossmint/common-sdk-base';
21
- import '../../types/token.js';
22
- import './SendTransactionService.js';
23
- import 'permissionless/_types/types';
24
- import './account/cache.js';
25
- import './account/eoa.js';
26
- import './account/strategy.js';
27
- import './account/passkey.js';
28
- import '../../error/processor.js';
29
- import '../../error/index.js';
30
-
31
- declare class SmartWalletService {
32
- private readonly crossmintService;
33
- private readonly accountConfigService;
34
- private readonly accountCreator;
35
- private readonly clientDecorator;
36
- constructor(crossmintService: CrossmintWalletService, accountConfigService: AccountConfigService, accountCreator: AccountCreator, clientDecorator: ClientDecorator);
37
- getOrCreate(user: UserParams, chain: SmartWalletChain, walletParams: WalletParams): Promise<EVMSmartWallet>;
38
- private smartAccountClient;
39
- }
40
-
41
- export { SmartWalletService };
@@ -1 +0,0 @@
1
- import{a}from"../../chunk-JYW5DCVU.js";import"../../chunk-NLGILHJS.js";import"../../chunk-C3VZY7VJ.js";import"../../chunk-ETVJGLNY.js";import"../../chunk-S2XBSAGM.js";import"../../chunk-OXRLBURF.js";import"../../chunk-KREX6Z32.js";import"../../chunk-NT7LBRZQ.js";import"../../chunk-DYVHPARQ.js";import"../../chunk-3F6P4HUZ.js";import"../../chunk-4YV6KMFQ.js";import"../../chunk-UPURFW46.js";export{a as SmartWalletService};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkGB35YMN4cjs = require('./chunk-GB35YMN4.cjs');var _chunkXJGFG3RTcjs = require('./chunk-XJGFG3RT.cjs');var _chunkDIDKPOO2cjs = require('./chunk-DIDKPOO2.cjs');var _chunkM4K3IZTTcjs = require('./chunk-M4K3IZTT.cjs');var _ecdsavalidator = require('@zerodev/ecdsa-validator');var _sdk = require('@zerodev/sdk');var c=class{async create({chain:m,publicClient:o,entryPoint:a,walletParams:g,kernelVersion:t,user:p,existing:e}){let r=await _chunkDIDKPOO2cjs.a.call(void 0, {chain:m,walletParams:g});if(e!=null&&!_chunkXJGFG3RTcjs.b.call(void 0, r.address,e.signerConfig.data.eoaAddress))throw new (0, _chunkM4K3IZTTcjs.b)(`User '${p.id}' has an existing wallet with an eoa signer '${e.signerConfig.data.eoaAddress}', this does not match input eoa signer '${r.address}'.`,e.signerConfig.display(),{type:"eoa",eoaAddress:e.signerConfig.data.eoaAddress});let A=await _ecdsavalidator.signerToEcdsaValidator.call(void 0, o,{signer:r,entryPoint:a,kernelVersion:t});return{account:await _sdk.createKernelAccount.call(void 0, o,{plugins:{sudo:A},index:0n,entryPoint:a,kernelVersion:t,deployedAccountAddress:_optionalChain([e, 'optionalAccess', _ => _.address])}),signerConfig:new (0, _chunkGB35YMN4cjs.b)({eoaAddress:r.address,type:"eoa"})}}};exports.a = c;
@@ -1 +0,0 @@
1
- import{e as l}from"./chunk-EBIEPPSD.js";import{keccak256 as o,toHex as i}from"viem";var s=class{constructor(e){this.keyPrefix=e}set(e,t){localStorage.setItem(this.key(e),JSON.stringify(t))}get(e){let t=this.key(e),r=localStorage.getItem(t);if(r==null)return null;let a=l.safeParse(JSON.parse(r));return a.success?a.data:(localStorage.removeItem(t),null)}clear(){for(let e=0;e<localStorage.length;e++){let t=localStorage.key(e);t&&t.startsWith(this.keyPrefix)&&(localStorage.removeItem(t),e--)}}key(e){return`${this.keyPrefix}-${o(i(e.jwt))}`}};export{s as a};
@@ -1 +0,0 @@
1
- import{erc20Abi as i,erc721Abi as p}from"viem";var s=[{inputs:[{internalType:"string",name:"uri_",type:"string"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256[]",name:"ids",type:"uint256[]"},{indexed:!1,internalType:"uint256[]",name:"values",type:"uint256[]"}],name:"TransferBatch",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"TransferSingle",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"string",name:"value",type:"string"},{indexed:!0,internalType:"uint256",name:"id",type:"uint256"}],name:"URI",type:"event"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"id",type:"uint256"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address[]",name:"accounts",type:"address[]"},{internalType:"uint256[]",name:"ids",type:"uint256[]"}],name:"balanceOfBatch",outputs:[{internalType:"uint256[]",name:"",type:"uint256[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256[]",name:"ids",type:"uint256[]"},{internalType:"uint256[]",name:"amounts",type:"uint256[]"},{internalType:"bytes",name:"data",type:"bytes"}],name:"safeBatchTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"id",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"uri",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"}];function m({contract:t,config:e,from:n,to:a}){switch(e.token.type){case"ft":return{account:n,address:t,abi:i,functionName:"transfer",args:[a,e.amount]};case"sft":return{account:n,address:t,abi:s,functionName:"safeTransferFrom",args:[n.address,a,e.token.tokenId,e.quantity,"0x00"],tokenId:e.token.tokenId};case"nft":return{account:n,address:t,abi:p,functionName:"safeTransferFrom",args:[n.address,a,e.token.tokenId],tokenId:e.token.tokenId}}}export{m as a};
@@ -1 +0,0 @@
1
- var e="0.1.36";var r="ZeroDev",d=0,c="SCW_SDK",p=e,a="2024-06-09",m=["0.3.1","0.3.0","0.2.4"],E=["v0.6","v0.7"];export{r as a,d as b,c,p as d,a as e,m as f,E as g};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBII7Y2A3cjs = require('./chunk-BII7Y2A3.cjs');function l(e){return _chunkBII7Y2A3cjs.f.includes(e)}function p(e){return _chunkBII7Y2A3cjs.g.includes(e)}function i(e){return"signer"in e&&"type"in e.signer&&e.signer.type==="PASSKEY"}function g(e){let t=e.existing==null||e.existing.signerConfig.type==="passkeys";return i(e.walletParams)&&t}function s(e){return"signer"in e&&("type"in e.signer&&e.signer.type==="VIEM_ACCOUNT"||"request"in e.signer&&typeof e.signer.request=="function")}function P(e){let t=e.existing==null||e.existing.signerConfig.type==="eoa";return s(e.walletParams)&&t}exports.a = l; exports.b = p; exports.c = i; exports.d = g; exports.e = s; exports.f = P;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _viem = require('viem');var _clientsdkbase = require('@crossmint/client-sdk-base');var o=class extends _clientsdkbase.CrossmintSDKError{constructor(a,r,i,e=_clientsdkbase.WalletErrorCode.SEND_TRANSACTION_FAILED){super(a,e);this.viemError=r;this.stage=i}},c= exports.b =class extends o{constructor(a,r,i,e,n,h=i.data,f=i.reason){super(a,r,n,_clientsdkbase.WalletErrorCode.SEND_TRANSACTION_EXECUTION_REVERTED);this.viemError=r;this.txId=e;this.stage=n;this.data=h;this.reason=f}},p= exports.c =class{constructor(t,a={confirmations:2,transactionConfirmationTimeout:3e4}){this.client=t;this.defaultSendTransactionOptions=a}async sendTransaction(t,a={}){let{confirmations:r,transactionConfirmationTimeout:i}=this.getConfig(a);await this.simulateCall(t,void 0,"simulation");let e;try{e=await this.client.wallet.writeContract({...t,account:this.client.wallet.account,chain:this.client.wallet.chain})}catch(n){throw n instanceof _viem.BaseError?new o(n.message,n,"send"):n}try{let n=await this.client.public.waitForTransactionReceipt({hash:e,confirmations:r,timeout:i});return await this.handleReceipt(n,t)}catch(n){throw n instanceof _viem.BaseError?new o(n.message,n,"confirmation"):n}}getConfig(t){return{...this.defaultSendTransactionOptions,...t}}async handleReceipt(t,a){if(t.status==="reverted")throw await this.simulateCall(a,t.transactionHash,"execution"),new c("Transaction reverted but unable to detect the reason",new (0, _viem.ContractFunctionRevertedError)({abi:a.abi,functionName:a.functionName}),new (0, _viem.ContractFunctionRevertedError)({abi:a.abi,functionName:a.functionName}),t.transactionHash,"execution");return t.transactionHash}async simulateCall(t,a,r){try{await this.client.public.simulateContract({...t,account:this.client.wallet.account.address,chain:this.client.public.chain})}catch(i){if(i instanceof _viem.BaseError){let e=i.walk(n=>n instanceof _viem.ContractFunctionRevertedError);throw e instanceof _viem.ContractFunctionRevertedError?new c(e.message,i,e,a,r):new o(i.message,i,r)}throw i}}};exports.a = o; exports.b = c; exports.c = p;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBII7Y2A3cjs = require('./chunk-BII7Y2A3.cjs');var _clientsdkbase = require('@crossmint/client-sdk-base');var s=new (0, _clientsdkbase.SDKLogger)(_chunkBII7Y2A3cjs.c),w= exports.b =new (0, _clientsdkbase.SDKLogger)(_chunkBII7Y2A3cjs.c,_clientsdkbase.getBrowserLogger.call(void 0, _chunkBII7Y2A3cjs.c,{onlyDatadog:!0}));exports.a = s; exports.b = w;
@@ -1 +0,0 @@
1
- import{a as c,b as l}from"./chunk-BJZQA5VC.js";import{a as o}from"./chunk-UPURFW46.js";var p=class{constructor(t,e){this.crossmintService=t;this.configCache=e}async get(t,e){let i=this.configCache.get(t);if(i!=null)return{config:this.validateAndFormat(t,i),cached:!0};let r=await this.crossmintService.getSmartWalletConfig(t,e);return{config:this.validateAndFormat(t,r),cached:!1}}cache({entryPointVersion:t,kernelVersion:e,user:i,existing:r}){this.configCache.clear(),this.configCache.set(i,{entryPointVersion:t,kernelVersion:e,userId:i.id,signers:[{signerData:r.signerConfig.data}],smartContractWalletAddress:r.address})}validateAndFormat(t,{entryPointVersion:e,kernelVersion:i,signers:r,smartContractWalletAddress:n,userId:s}){if(e==="v0.7"&&i.startsWith("0.2")||e==="v0.6"&&i.startsWith("0.3"))throw new o(`Unsupported combination: entryPoint ${e} and kernel version ${i}. Please contact support`);let g=r.map(f=>f.signerData),a=this.getSigner(g);if(n!=null&&a==null||a!=null&&n==null)throw new o("Either both signer and address must be present, or both must be null");return a==null||n==null?{entryPointVersion:e,kernelVersion:i,userWithId:{...t,id:s}}:{entryPointVersion:e,kernelVersion:i,userWithId:{...t,id:s},existing:{signerConfig:a,address:n}}}getSigner(t){if(t.length===0)return;let e=t[0];if(e.type==="eoa")return new l(e);if(e.type==="passkeys")return new c(e)}};export{p as a};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var e="0.1.36";var n="ZeroDev",r= exports.b =0,d= exports.c ="SCW_SDK",c= exports.d =e,p= exports.e ="2024-06-09",a= exports.f =["0.3.1","0.3.0","0.2.4"],m= exports.g =["v0.6","v0.7"];exports.a = n; exports.b = r; exports.c = d; exports.d = c; exports.e = p; exports.f = a; exports.g = m;
@@ -1 +0,0 @@
1
- var e=class{constructor(a){this.type="passkeys";this.data=a}display(){return{pubKeyX:this.data.pubKeyX,pubKeyY:this.data.pubKeyY,passkeyName:this.data.passkeyName,type:this.type}}},t=class{constructor(a){this.type="eoa";this.data=a}display(){return this.data}};export{e as a,t as b};
@@ -1 +0,0 @@
1
- function n(a){return!1}export{n as a};
@@ -1,3 +0,0 @@
1
- import{c as i,d as s,f as n}from"./chunk-WDKJ6P7K.js";import{b as a,h as t}from"./chunk-UPURFW46.js";var o=class{constructor(e,r){this.eoaStrategy=e;this.passkeyStrategy=r}get(e){if(s(e))return this.passkeyStrategy.create(e);if(n(e))return this.eoaStrategy.create(e);if(e.existing==null)throw new t(`Unsupported wallet params:
2
- ${e.walletParams}`);let r=e.existing.signerConfig.display(),y=i(e.walletParams)?"passkey":"eoa";throw new a(`Cannot create wallet with ${y} signer for user ${e.user.id}', they already have a wallet with signer:
3
- '${JSON.stringify(r,null,2)}'`,r)}};export{o as a};
@@ -1 +0,0 @@
1
- function o(n){return!n||n.length===0||n.trim().length===0}function i(n,e){return n?.toLowerCase()===e?.toLowerCase()}export{o as a,i as b};
@@ -1 +0,0 @@
1
- function i(){return typeof window<"u"}export{i as a};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkM4K3IZTTcjs = require('./chunk-M4K3IZTT.cjs');var _permissionless = require('permissionless');async function p({walletParams:r}){if(i(r.signer))return await _permissionless.providerToSmartAccountSigner.call(void 0, r.signer);if(o(r.signer))return r.signer.account;{let t=r.signer;throw new (0, _chunkM4K3IZTTcjs.a)(`The signer type ${t.type} is not supported`)}}function i(r){return r&&typeof r.request=="function"}function o(r){return r&&r.type==="VIEM_ACCOUNT"}exports.a = p; exports.b = o;
@@ -1 +0,0 @@
1
- import{f as a,g as n}from"./chunk-4YV6KMFQ.js";import{PasskeyValidatorContractVersion as o}from"@zerodev/passkey-validator";import{isAddress as i,isHex as d}from"viem";import{z as e}from"zod";var m=e.custom(t=>d(t),{message:"Invalid hex string"}),s=e.custom(t=>i(t),{message:"Invalid evm address"}),p=e.object({eoaAddress:s,type:e.literal("eoa")}),c=e.object({entryPoint:s,validatorAddress:s,pubKeyX:e.string(),pubKeyY:e.string(),authenticatorIdHash:m,authenticatorId:e.string()}),l=c.extend({passkeyName:e.string(),validatorContractVersion:e.nativeEnum(o),domain:e.string(),type:e.literal("passkeys")}),g=e.discriminatedUnion("type",[l,p]),h=e.object({kernelVersion:e.enum(a,{errorMap:(t,r)=>({message:`Unsupported kernel version. Supported versions: ${a.join(", ")}. Version used: ${r.data}. Please contact support`})}),entryPointVersion:e.enum(n,{errorMap:(t,r)=>({message:`Unsupported entry point version. Supported versions: ${n.join(", ")}. Version used: ${r.data}. Please contact support`})}),userId:e.string().min(1),signers:e.array(e.object({signerData:g})).min(0).max(1,"Invalid wallet signer configuration. Please contact support"),smartContractWalletAddress:s.optional()});export{p as a,c as b,l as c,g as d,h as e};
@@ -1 +0,0 @@
1
- import{c}from"./chunk-S2XBSAGM.js";import{a as i}from"./chunk-3F6P4HUZ.js";import{a as r}from"./chunk-UPURFW46.js";var o=class{constructor(e,t,n,a=new c(e)){this.crossmintService=n;this.sendTransactionService=a;this.chain=t,this.client=e}get address(){return this.client.wallet.account.address}async transferToken(e,t){if(this.chain!==t.token.chain)throw new r(`Chain mismatch: Expected ${t.token.chain}, but got ${this.chain}. Ensure you are interacting with the correct blockchain.`);return this.executeContract(i({contract:t.token.contractAddress,to:e,from:this.client.wallet.account,config:t}))}async nfts(){return this.crossmintService.fetchNFTs(this.address,this.chain)}async executeContract({address:e,abi:t,functionName:n,args:a,value:s,config:l}){return this.sendTransactionService.sendTransaction({address:e,abi:t,functionName:n,args:a,value:s},l)}};export{o as a};
@@ -1,3 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk6ODPWORJcjs = require('./chunk-6ODPWORJ.cjs');var _chunkM4K3IZTTcjs = require('./chunk-M4K3IZTT.cjs');var o=class{constructor(e,r){this.eoaStrategy=e;this.passkeyStrategy=r}get(e){if(_chunk6ODPWORJcjs.d.call(void 0, e))return this.passkeyStrategy.create(e);if(_chunk6ODPWORJcjs.f.call(void 0, e))return this.eoaStrategy.create(e);if(e.existing==null)throw new (0, _chunkM4K3IZTTcjs.h)(`Unsupported wallet params:
2
- ${e.walletParams}`);let r=e.existing.signerConfig.display(),y=_chunk6ODPWORJcjs.c.call(void 0, e.walletParams)?"passkey":"eoa";throw new (0, _chunkM4K3IZTTcjs.b)(`Cannot create wallet with ${y} signer for user ${e.user.id}', they already have a wallet with signer:
3
- '${JSON.stringify(r,null,2)}'`,r)}};exports.a = o;
@@ -1 +0,0 @@
1
- import{a as e}from"./chunk-UPURFW46.js";import{providerToSmartAccountSigner as n}from"permissionless";async function m({walletParams:r}){if(i(r.signer))return await n(r.signer);if(o(r.signer))return r.signer.account;{let t=r.signer;throw new e(`The signer type ${t.type} is not supported`)}}function i(r){return r&&typeof r.request=="function"}function o(r){return r&&r.type==="VIEM_ACCOUNT"}export{m as a,o as b};
@@ -1 +0,0 @@
1
- import{a as S}from"./chunk-H4CMXNVK.js";import{a as y}from"./chunk-XRZ2XPQM.js";import{a as g}from"./chunk-JYW5DCVU.js";import{a as p}from"./chunk-2ZFSHKM6.js";import{a as v}from"./chunk-ATQ4WGCW.js";import{a as f}from"./chunk-CJBR5TGN.js";import{a as h}from"./chunk-UG47CBKR.js";import{a as C}from"./chunk-D4NDUT36.js";import{a as m}from"./chunk-GGIAHBMC.js";import{a as n,b as s}from"./chunk-2RB6U5DY.js";import{g as l,h as c}from"./chunk-KREX6Z32.js";import{a as w}from"./chunk-ZQM4FEXV.js";import{d as i}from"./chunk-4YV6KMFQ.js";import{a as o}from"./chunk-UPURFW46.js";import{stringify as A}from"viem";import{validateAPIKey as I}from"@crossmint/common-sdk-base";var P=class W{constructor(r,t,a,e=n){this.crossmintEnv=r;this.smartWalletService=t;this.errorProcessor=a;this.logger=e}static init({clientApiKey:r}){let t=I(r);if(!t.isValid)throw new Error("API key invalid");let a=new m(r),e=new w(s),d=new f(new h,new S(a.getPasskeyServerUrl(),r)),E=new p(`smart-wallet-${i}`),u=new g(a,new v(a,E),d,new y(e));return new W(t.environment,u,e)}async getOrCreateWallet(r,t,a={signer:{type:"PASSKEY"}}){if(!C())throw new o("Smart Wallet SDK should only be used client side.");return this.assertValidChain(t),await this.logger.logPerformance("GET_OR_CREATE_WALLET",async()=>{try{return await this.smartWalletService.getOrCreate(r,t,a)}catch(e){throw this.errorProcessor.map(e,new o(`Wallet creation failed: ${e.message}.`,A(e)))}})}assertValidChain(r){if(!this.validChain(r))throw new o(`The selected chain "${r}" is not available in "${this.crossmintEnv}". Either set a valid chain or check you're using an API key for the environment you're trying to target.`)}validChain(r){return this.crossmintEnv==="development"||this.crossmintEnv==="staging"?l(r):c(r)}};export{P as a};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var e=class{constructor(a){this.type="passkeys";this.data=a}display(){return{pubKeyX:this.data.pubKeyX,pubKeyY:this.data.pubKeyY,passkeyName:this.data.passkeyName,type:this.type}}},t= exports.b =class{constructor(a){this.type="eoa";this.data=a}display(){return this.data}};exports.a = e; exports.b = t;
@@ -1,2 +0,0 @@
1
- import{a as m}from"./chunk-2RB6U5DY.js";import{e as l}from"./chunk-EBIEPPSD.js";import{a as p,b as E}from"./chunk-PZ6Q22YJ.js";import{e as s}from"./chunk-4YV6KMFQ.js";import{d as a,i as n,j as i}from"./chunk-UPURFW46.js";import{APIErrorService as A,BaseCrossmintService as R,CrossmintServiceError as f}from"@crossmint/client-sdk-base";import{blockchainToChainId as h}from"@crossmint/common-sdk-base";var c=class extends R{constructor(){super(...arguments);this.logger=m;this.apiErrorService=new A({ERROR_USER_WALLET_ALREADY_CREATED:({userId:r})=>new a(r),ERROR_ADMIN_SIGNER_ALREADY_USED:()=>new n,ERROR_PROJECT_NONCUSTODIAL_WALLETS_NOT_ENABLED:()=>new i})}async idempotentCreateSmartWallet(r,t){await this.fetchCrossmintAPI(`${s}/sdk/smart-wallet`,{method:"PUT",body:JSON.stringify(t)},"Error creating abstract wallet. Please contact support",r.jwt)}async sponsorUserOperation(r,t,o,e){let S=h(e),P=await this.fetchCrossmintAPI(`${s}/sdk/paymaster`,{method:"POST",body:JSON.stringify({userOp:p(t),entryPoint:o,chainId:S})},"Error sponsoring user operation. Please contact support",r.jwt);return E(P)}async getSmartWalletConfig(r,t){let o=await this.fetchCrossmintAPI(`${s}/sdk/smart-wallet/config?chain=${t}`,{method:"GET"},"Error getting smart wallet version configuration. Please contact support",r.jwt),e=l.safeParse(o);if(!e.success)throw new f(`Invalid smart wallet config, please contact support. Details below:
2
- ${e.error.toString()}`);return e.data}async fetchNFTs(r,t){return this.fetchCrossmintAPI(`v1-alpha1/wallets/${t}:${r}/nfts`,{method:"GET"},`Error fetching NFTs for wallet: ${r}`)}getPasskeyServerUrl(){return this.crossmintBaseUrl+"api/internal/passkeys"}};export{c as a};
@@ -1 +0,0 @@
1
- import{a as P}from"./chunk-BJZQA5VC.js";import{c as u,e as p,f as l,g as m}from"./chunk-UPURFW46.js";import{PasskeyValidatorContractVersion as S,WebAuthnMode as h,toPasskeyValidator as A}from"@zerodev/passkey-validator";import{createKernelAccount as E}from"@zerodev/sdk";import{toWebAuthnKey as w}from"@zerodev/webauthn-key";var f=class{constructor(e,t){this.passkeyServerUrl=e;this.apiKey=t}async create({user:e,publicClient:t,walletParams:r,entryPoint:c,kernelVersion:i,existing:a}){let n=r.signer.passkeyName??e.id;if(a!=null&&a.signerConfig.data.passkeyName!==n)throw new u(`User '${e.id}' has an existing wallet created with a passkey named '${a.signerConfig.data.passkeyName}', this does match input passkey name '${n}'.`,a.signerConfig.display());try{a==null&&r.signer.onPrePasskeyRegistration!=null&&await r.signer.onPrePasskeyRegistration();let s=await this.getPasskey(e,n,a?.signerConfig.data),g=S.V0_0_2,d=a==null?g:a.signerConfig.data.validatorContractVersion,y=await A(t,{webAuthnKey:s,entryPoint:c,validatorContractVersion:d,kernelVersion:i}),k=await E(t,{plugins:{sudo:y},entryPoint:c,kernelVersion:i,deployedAccountAddress:a?.address});return{signerConfig:this.getSignerConfig(y,d,n),account:this.decorate(k,n,r)}}catch(s){throw r.signer.onPasskeyRegistrationError!=null&&r.signer.onPasskeyRegistrationError(s),this.mapError(s,n)}}async getPasskey(e,t,r){return r!=null?{pubX:BigInt(r.pubKeyX),pubY:BigInt(r.pubKeyY),authenticatorId:r.authenticatorId,authenticatorIdHash:r.authenticatorIdHash}:w({passkeyName:t,passkeyServerUrl:this.passkeyServerUrl,mode:h.Register,passkeyServerHeaders:this.createPasskeysServerHeaders(e)})}getSignerConfig(e,t,r){return new P({...V(e.getSerializedData()),passkeyName:r,validatorContractVersion:t,domain:window.location.hostname,type:"passkeys"})}createPasskeysServerHeaders(e){return{"x-api-key":this.apiKey,Authorization:`Bearer ${e.jwt}`}}mapError(e,t){return e.code===0&&e.name==="DataError"?new m(t):e.message==="Registration not verified"?new l(t):e.code==="ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY"&&e.name==="NotAllowedError"?new p(t):e}decorate(e,t,r){return new Proxy(e,{get:(c,i,a)=>{let n=Reflect.get(c,i,a);if(typeof n!="function"||typeof i!="string"||!v(i))return n;let s=r.signer;return async(...g)=>{g?.[0]?.factoryData!=null&&i==="signUserOperation"&&s.type==="PASSKEY"&&s.onFirstTimePasskeySigning!=null&&await s.onFirstTimePasskeySigning();try{return await n.call(c,...g)}catch(y){throw s.onFirstTimePasskeySigningError!=null&&await s.onFirstTimePasskeySigningError(y),this.mapError(y,t)}}}})}},C=["signMessage","signTypedData","signUserOperation","signTransaction"];function v(o){return C.includes(o)}var V=o=>{let e=b(o),t=new TextDecoder().decode(e);return JSON.parse(t)};function b(o){let e=atob(o);return Uint8Array.from(e,t=>t.codePointAt(0))}export{f as a};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkWJ6XJMRDcjs = require('./chunk-WJ6XJMRD.cjs');function p(r){return!_chunkWJ6XJMRDcjs.a.call(void 0, r)}function c({bundlerClient:r,entryPoint:t,chain:i,walletService:s,user:n}){return{middleware:{gasPrice:async()=>(await r.getUserOperationGasPrice()).fast,sponsorUserOperation:async({userOperation:a})=>{let{sponsorUserOpParams:o}=await s.sponsorUserOperation(n,a,t,i);return o}}}}exports.a = p; exports.b = c;
@@ -1 +0,0 @@
1
- import{a as f,b as S}from"./chunk-NLGILHJS.js";import{a as d}from"./chunk-ETVJGLNY.js";import{b as u,c as y}from"./chunk-OXRLBURF.js";import{i as C}from"./chunk-KREX6Z32.js";import{a as m,b as p}from"./chunk-4YV6KMFQ.js";import{ENTRYPOINT_ADDRESS_V06 as W,ENTRYPOINT_ADDRESS_V07 as A,createSmartAccountClient as E}from"permissionless";import{createPimlicoBundlerClient as h}from"permissionless/clients/pimlico";import{createPublicClient as D,http as P}from"viem";import{blockchainToChainId as R}from"@crossmint/common-sdk-base";var v=class{constructor(r,t,i,e){this.crossmintService=r;this.accountConfigService=t;this.accountCreator=i;this.clientDecorator=e}async getOrCreate(r,t,i){let{config:{entryPointVersion:e,kernelVersion:o,existing:n,userWithId:a},cached:g}=await this.accountConfigService.get(r,t),c=D({transport:P(u(t))}),{account:s,signerConfig:l}=await this.accountCreator.get({chain:t,walletParams:i,publicClient:c,user:a,entryPoint:e==="v0.6"?W:A,kernelVersion:o,existing:n});return n==null&&await this.crossmintService.idempotentCreateSmartWallet(r,{type:m,smartContractWalletAddress:s.address,signerData:l.data,version:p,baseLayer:"evm",chainId:R(t),entryPointVersion:e,kernelVersion:o}),g||this.accountConfigService.cache({entryPointVersion:e,kernelVersion:o,user:a,existing:{address:s.address,signerConfig:l}}),new d({wallet:this.smartAccountClient(t,s,r),public:c},t,this.crossmintService)}smartAccountClient(r,t,i){let e=P(y(r)),o={chain:C[r],entryPoint:t.entryPoint},n=h({...o,transport:e}),a=E({account:t,bundlerTransport:e,...o,...f(r)&&S({bundlerClient:n,entryPoint:t.entryPoint,chain:r,walletService:this.crossmintService,user:i})});return this.clientDecorator.decorate({crossmintChain:r,smartAccountClient:a})}};export{v as a};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkZ7AZOEVXcjs = require('./chunk-Z7AZOEVX.cjs');var _viem = require('viem');var s=class{constructor(e){this.keyPrefix=e}set(e,t){localStorage.setItem(this.key(e),JSON.stringify(t))}get(e){let t=this.key(e),r=localStorage.getItem(t);if(r==null)return null;let a=_chunkZ7AZOEVXcjs.e.safeParse(JSON.parse(r));return a.success?a.data:(localStorage.removeItem(t),null)}clear(){for(let e=0;e<localStorage.length;e++){let t=localStorage.key(e);t&&t.startsWith(this.keyPrefix)&&(localStorage.removeItem(t),e--)}}key(e){return`${this.keyPrefix}-${_viem.keccak256.call(void 0, _viem.toHex.call(void 0, e.jwt))}`}};exports.a = s;
@@ -1 +0,0 @@
1
- import{a as n}from"./chunk-NT7LBRZQ.js";import{a as o}from"./chunk-DYVHPARQ.js";import{arbitrum as s,arbitrumSepolia as l,base as S,baseSepolia as p,optimism as m,optimismSepolia as T,polygon as O,polygonAmoy as c}from"viem/chains";import{BlockchainIncludingTestnet as t,objectValues as a}from"@crossmint/common-sdk-base";var r={BASE_SEPOLIA:t.BASE_SEPOLIA,POLYGON_AMOY:t.POLYGON_AMOY,OPTIMISM_SEPOLIA:t.OPTIMISM_SEPOLIA,ARBITRUM_SEPOLIA:t.ARBITRUM_SEPOLIA,STORY_TESTNET:t.STORY_TESTNET},A=a(r),i={BASE:t.BASE,POLYGON:t.POLYGON,OPTIMISM:t.OPTIMISM,ARBITRUM:t.ARBITRUM,STORY:t.STORY},M=a(i),I={...r,...i},_=a(I);function h(e){return A.includes(e)}function P(e){return M.includes(e)}var b={polygon:O,"polygon-amoy":c,base:S,"base-sepolia":p,optimism:m,"optimism-sepolia":T,arbitrum:s,"arbitrum-sepolia":l,"story-testnet":n,story:o};export{r as a,A as b,i as c,M as d,I as e,_ as f,h as g,P as h,b as i};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkWJ6XJMRDcjs = require('./chunk-WJ6XJMRD.cjs');var _chunk7G7GOR7Xcjs = require('./chunk-7G7GOR7X.cjs');var _chunkM4K3IZTTcjs = require('./chunk-M4K3IZTT.cjs');var _viem = require('viem');var h=["sendTransaction","writeContract","sendUserOperation"],g=["signMessage","signTypedData"];function c(a){return h.includes(a)}function p(a){return g.includes(a)}var u=class{constructor(o,t=_chunk7G7GOR7Xcjs.a){this.errorProcessor=o;this.logger=t}decorate({crossmintChain:o,smartAccountClient:t}){return new Proxy(t,{get:(n,e,s)=>{let r=Reflect.get(n,e,s);return typeof r!="function"||typeof e!="string"||!(p(e)||c(e))?r:(...i)=>this.logger.logPerformance(`CrossmintSmartWallet.${e}`,()=>this.execute(n,e,r,i,o))}})}async execute(o,t,n,e,s){try{this.logger.log(`[CrossmintSmartWallet.${t}] - params: ${_viem.stringify.call(void 0, e)}`);let r=c(t)?this.processTxnArgs(t,s,e):e;return await n.call(o,...r)}catch(r){let i=c(t)?"signing":"sending transaction";throw this.errorProcessor.map(r,new (0, _chunkM4K3IZTTcjs.a)(`Error ${i}: ${r.message}`,_viem.stringify.call(void 0, r)))}}processTxnArgs(o,t,n){if(o==="sendUserOperation"){let[{userOperation:s,middleware:r,account:i}]=n;return[{middleware:r,account:i,userOperation:this.addGelatoBundlerProperties(t,s)},...n.slice(1)]}let[e]=n;return[this.addGelatoBundlerProperties(t,e),...n.slice(1)]}addGelatoBundlerProperties(o,t){return _chunkWJ6XJMRDcjs.a.call(void 0, o)?{...t,maxFeePerGas:"0x0",maxPriorityFeePerGas:"0x0"}:t}};exports.a = u;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _viem = require('viem');var s=[{inputs:[{internalType:"string",name:"uri_",type:"string"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256[]",name:"ids",type:"uint256[]"},{indexed:!1,internalType:"uint256[]",name:"values",type:"uint256[]"}],name:"TransferBatch",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"TransferSingle",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"string",name:"value",type:"string"},{indexed:!0,internalType:"uint256",name:"id",type:"uint256"}],name:"URI",type:"event"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"id",type:"uint256"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address[]",name:"accounts",type:"address[]"},{internalType:"uint256[]",name:"ids",type:"uint256[]"}],name:"balanceOfBatch",outputs:[{internalType:"uint256[]",name:"",type:"uint256[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256[]",name:"ids",type:"uint256[]"},{internalType:"uint256[]",name:"amounts",type:"uint256[]"},{internalType:"bytes",name:"data",type:"bytes"}],name:"safeBatchTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"id",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"uri",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"}];function l({contract:t,config:e,from:n,to:a}){switch(e.token.type){case"ft":return{account:n,address:t,abi:_viem.erc20Abi,functionName:"transfer",args:[a,e.amount]};case"sft":return{account:n,address:t,abi:s,functionName:"safeTransferFrom",args:[n.address,a,e.token.tokenId,e.quantity,"0x00"],tokenId:e.token.tokenId};case"nft":return{account:n,address:t,abi:_viem.erc721Abi,functionName:"safeTransferFrom",args:[n.address,a,e.token.tokenId],tokenId:e.token.tokenId}}}exports.a = l;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _clientsdkbase = require('@crossmint/client-sdk-base');var r=class extends _clientsdkbase.CrossmintSDKError{constructor(e,i,n=_clientsdkbase.SmartWalletErrorCode.UNCATEGORIZED){super(e,n,i)}},a= exports.b =class extends r{constructor(e,i,n){super(e,_clientsdkbase.SmartWalletErrorCode.ADMIN_MISMATCH),this.required=i,this.used=n}},p= exports.c =class extends r{constructor(e,i,n){super(e,_clientsdkbase.SmartWalletErrorCode.PASSKEY_MISMATCH),this.required=i,this.used=n}},l= exports.d =class extends r{constructor(i){super(`The user with userId ${i.toString()} already has a wallet created for this project`);this.code=_clientsdkbase.SmartWalletErrorCode.USER_WALLET_ALREADY_CREATED}},c= exports.e =class extends r{constructor(e){super(`Prompt was either cancelled or timed out for passkey ${e}`,void 0,_clientsdkbase.SmartWalletErrorCode.PASSKEY_PROMPT),this.passkeyName=e}},u= exports.f =class extends r{constructor(e){super(`Registration for passkey ${e} failed, either the registration took too long, or passkey signature vaildation failed.`,void 0,_clientsdkbase.SmartWalletErrorCode.PASSKEY_REGISTRATION),this.passkeyName=e}},d= exports.g =class extends r{constructor(e){super(`User selected authenticator for passkey ${e} is not compatible with Crossmint's Smart Wallets.`,void 0,_clientsdkbase.SmartWalletErrorCode.PASSKEY_INCOMPATIBLE_AUTHENTICATOR),this.passkeyName=e}},o= exports.h =class extends r{constructor(e){super(e,void 0,_clientsdkbase.SmartWalletErrorCode.WALLET_CONFIG)}},y= exports.i =class extends o{constructor(){super("This signer was already used to create another wallet. Please use a different signer.");this.code=_clientsdkbase.SmartWalletErrorCode.ADMIN_SIGNER_ALREADY_USED}},S= exports.j =class extends o{constructor(){super("Smart wallets are not enabled for this project. They can be enabled on the project settings page in the developer console.");this.code=_clientsdkbase.SmartWalletErrorCode.SMART_WALLETS_NOT_ENABLED}};exports.a = r; exports.b = a; exports.c = p; exports.d = l; exports.e = c; exports.f = u; exports.g = d; exports.h = o; exports.i = y; exports.j = S;
@@ -1 +0,0 @@
1
- import{a as e}from"./chunk-C3VZY7VJ.js";function c(r){return!e(r)}function y({bundlerClient:r,entryPoint:t,chain:i,walletService:s,user:n}){return{middleware:{gasPrice:async()=>(await r.getUserOperationGasPrice()).fast,sponsorUserOperation:async({userOperation:a})=>{let{sponsorUserOpParams:o}=await s.sponsorUserOperation(n,a,t,i);return o}}}}export{c as a,y as b};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkIQTGPM2Ucjs = require('./chunk-IQTGPM2U.cjs');var _chunkSWWOVT47cjs = require('./chunk-SWWOVT47.cjs');var _chunkIUIBQFWYcjs = require('./chunk-IUIBQFWY.cjs');var _chunkNQUKI27Mcjs = require('./chunk-NQUKI27M.cjs');var _chunkBII7Y2A3cjs = require('./chunk-BII7Y2A3.cjs');var _permissionless = require('permissionless');var _pimlico = require('permissionless/clients/pimlico');var _viem = require('viem');var _commonsdkbase = require('@crossmint/common-sdk-base');var v=class{constructor(r,t,i,e){this.crossmintService=r;this.accountConfigService=t;this.accountCreator=i;this.clientDecorator=e}async getOrCreate(r,t,i){let{config:{entryPointVersion:e,kernelVersion:o,existing:n,userWithId:a},cached:g}=await this.accountConfigService.get(r,t),c=_viem.createPublicClient.call(void 0, {transport:_viem.http.call(void 0, _chunkIUIBQFWYcjs.b.call(void 0, t))}),{account:s,signerConfig:l}=await this.accountCreator.get({chain:t,walletParams:i,publicClient:c,user:a,entryPoint:e==="v0.6"?_permissionless.ENTRYPOINT_ADDRESS_V06:_permissionless.ENTRYPOINT_ADDRESS_V07,kernelVersion:o,existing:n});return n==null&&await this.crossmintService.idempotentCreateSmartWallet(r,{type:_chunkBII7Y2A3cjs.a,smartContractWalletAddress:s.address,signerData:l.data,version:_chunkBII7Y2A3cjs.b,baseLayer:"evm",chainId:_commonsdkbase.blockchainToChainId.call(void 0, t),entryPointVersion:e,kernelVersion:o}),g||this.accountConfigService.cache({entryPointVersion:e,kernelVersion:o,user:a,existing:{address:s.address,signerConfig:l}}),new (0, _chunkSWWOVT47cjs.a)({wallet:this.smartAccountClient(t,s,r),public:c},t,this.crossmintService)}smartAccountClient(r,t,i){let e=_viem.http.call(void 0, _chunkIUIBQFWYcjs.c.call(void 0, r)),o={chain:_chunkNQUKI27Mcjs.i[r],entryPoint:t.entryPoint},n=_pimlico.createPimlicoBundlerClient.call(void 0, {...o,transport:e}),a=_permissionless.createSmartAccountClient.call(void 0, {account:t,bundlerTransport:e,...o,..._chunkIQTGPM2Ucjs.a.call(void 0, r)&&_chunkIQTGPM2Ucjs.b.call(void 0, {bundlerClient:n,entryPoint:t.entryPoint,chain:r,walletService:this.crossmintService,user:i})});return this.clientDecorator.decorate({crossmintChain:r,smartAccountClient:a})}};exports.a = v;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkHQXF6VHPcjs = require('./chunk-HQXF6VHP.cjs');var _chunkGPZ7PHS6cjs = require('./chunk-GPZ7PHS6.cjs');var _chains = require('viem/chains');var _commonsdkbase = require('@crossmint/common-sdk-base');var r={BASE_SEPOLIA:_commonsdkbase.BlockchainIncludingTestnet.BASE_SEPOLIA,POLYGON_AMOY:_commonsdkbase.BlockchainIncludingTestnet.POLYGON_AMOY,OPTIMISM_SEPOLIA:_commonsdkbase.BlockchainIncludingTestnet.OPTIMISM_SEPOLIA,ARBITRUM_SEPOLIA:_commonsdkbase.BlockchainIncludingTestnet.ARBITRUM_SEPOLIA,STORY_TESTNET:_commonsdkbase.BlockchainIncludingTestnet.STORY_TESTNET},A= exports.b =_commonsdkbase.objectValues.call(void 0, r),i= exports.c ={BASE:_commonsdkbase.BlockchainIncludingTestnet.BASE,POLYGON:_commonsdkbase.BlockchainIncludingTestnet.POLYGON,OPTIMISM:_commonsdkbase.BlockchainIncludingTestnet.OPTIMISM,ARBITRUM:_commonsdkbase.BlockchainIncludingTestnet.ARBITRUM,STORY:_commonsdkbase.BlockchainIncludingTestnet.STORY},M= exports.d =_commonsdkbase.objectValues.call(void 0, i),I= exports.e ={...r,...i},R= exports.f =_commonsdkbase.objectValues.call(void 0, I);function _(e){return A.includes(e)}function h(e){return M.includes(e)}var P={polygon:_chains.polygon,"polygon-amoy":_chains.polygonAmoy,base:_chains.base,"base-sepolia":_chains.baseSepolia,optimism:_chains.optimism,"optimism-sepolia":_chains.optimismSepolia,arbitrum:_chains.arbitrum,"arbitrum-sepolia":_chains.arbitrumSepolia,"story-testnet":_chunkHQXF6VHPcjs.a,story:_chunkGPZ7PHS6cjs.a};exports.a = r; exports.b = A; exports.c = i; exports.d = M; exports.e = I; exports.f = R; exports.g = _; exports.h = h; exports.i = P;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkGB35YMN4cjs = require('./chunk-GB35YMN4.cjs');var _chunkM4K3IZTTcjs = require('./chunk-M4K3IZTT.cjs');var p=class{constructor(t,e){this.crossmintService=t;this.configCache=e}async get(t,e){let i=this.configCache.get(t);if(i!=null)return{config:this.validateAndFormat(t,i),cached:!0};let r=await this.crossmintService.getSmartWalletConfig(t,e);return{config:this.validateAndFormat(t,r),cached:!1}}cache({entryPointVersion:t,kernelVersion:e,user:i,existing:r}){this.configCache.clear(),this.configCache.set(i,{entryPointVersion:t,kernelVersion:e,userId:i.id,signers:[{signerData:r.signerConfig.data}],smartContractWalletAddress:r.address})}validateAndFormat(t,{entryPointVersion:e,kernelVersion:i,signers:r,smartContractWalletAddress:n,userId:s}){if(e==="v0.7"&&i.startsWith("0.2")||e==="v0.6"&&i.startsWith("0.3"))throw new (0, _chunkM4K3IZTTcjs.a)(`Unsupported combination: entryPoint ${e} and kernel version ${i}. Please contact support`);let g=r.map(f=>f.signerData),a=this.getSigner(g);if(n!=null&&a==null||a!=null&&n==null)throw new (0, _chunkM4K3IZTTcjs.a)("Either both signer and address must be present, or both must be null");return a==null||n==null?{entryPointVersion:e,kernelVersion:i,userWithId:{...t,id:s}}:{entryPointVersion:e,kernelVersion:i,userWithId:{...t,id:s},existing:{signerConfig:a,address:n}}}getSigner(t){if(t.length===0)return;let e=t[0];if(e.type==="eoa")return new (0, _chunkGB35YMN4cjs.b)(e);if(e.type==="passkeys")return new (0, _chunkGB35YMN4cjs.a)(e)}};exports.a = p;
@@ -1 +0,0 @@
1
- import{i as o}from"./chunk-KREX6Z32.js";import{blockchainToChainId as a}from"@crossmint/common-sdk-base";var i="-7M6vRDBDknwvMxnqah_jbcieWg0qad9",e="pim_9dKmQPxiTCvtbUNF7XFBbA",r={polygon:"polygon-mainnet","polygon-amoy":"polygon-amoy",base:"base-mainnet","base-sepolia":"base-sepolia",optimism:"opt-mainnet","optimism-sepolia":"opt-sepolia",arbitrum:"arb-mainnet","arbitrum-sepolia":"arb-sepolia"};function n(t){return`https://${r[t]}.g.alchemy.com/v2/${i}`}function c(t){return t==="story-testnet"||t==="story"?o[t].rpcUrls.default.http[0]:n(t)}function C(t){return`https://api.pimlico.io/v2/${a(t)}/rpc?apikey=${e}`}export{r as a,c as b,C as c};
@@ -1 +0,0 @@
1
- import{toHex as p}from"viem";function n(r,e){let t=e(r);return t.replace?t.value:Array.isArray(r)?r.map(i=>n(i,e)):r!==null&&typeof r=="object"?Object.fromEntries(Object.entries(r).map(([i,o])=>[i,n(o,e)])):t.value}function s(r){return n(r,e=>typeof e=="bigint"?{value:p(e),replace:!0}:{value:e,replace:!1})}function f(r){return n(r,e=>e!=null&&typeof e=="object"&&"__xm_serializedType"in e&&"value"in e&&e.__xm_serializedType==="bigint"&&typeof e.value=="string"?{value:BigInt(e.value),replace:!0}:{value:e,replace:!1})}export{s as a,f as b};
@@ -1 +0,0 @@
1
- import{BaseError as l,ContractFunctionRevertedError as s}from"viem";import{CrossmintSDKError as d,WalletErrorCode as m}from"@crossmint/client-sdk-base";var o=class extends d{constructor(a,r,i,e=m.SEND_TRANSACTION_FAILED){super(a,e);this.viemError=r;this.stage=i}},c=class extends o{constructor(a,r,i,e,n,h=i.data,f=i.reason){super(a,r,n,m.SEND_TRANSACTION_EXECUTION_REVERTED);this.viemError=r;this.txId=e;this.stage=n;this.data=h;this.reason=f}},p=class{constructor(t,a={confirmations:2,transactionConfirmationTimeout:3e4}){this.client=t;this.defaultSendTransactionOptions=a}async sendTransaction(t,a={}){let{confirmations:r,transactionConfirmationTimeout:i}=this.getConfig(a);await this.simulateCall(t,void 0,"simulation");let e;try{e=await this.client.wallet.writeContract({...t,account:this.client.wallet.account,chain:this.client.wallet.chain})}catch(n){throw n instanceof l?new o(n.message,n,"send"):n}try{let n=await this.client.public.waitForTransactionReceipt({hash:e,confirmations:r,timeout:i});return await this.handleReceipt(n,t)}catch(n){throw n instanceof l?new o(n.message,n,"confirmation"):n}}getConfig(t){return{...this.defaultSendTransactionOptions,...t}}async handleReceipt(t,a){if(t.status==="reverted")throw await this.simulateCall(a,t.transactionHash,"execution"),new c("Transaction reverted but unable to detect the reason",new s({abi:a.abi,functionName:a.functionName}),new s({abi:a.abi,functionName:a.functionName}),t.transactionHash,"execution");return t.transactionHash}async simulateCall(t,a,r){try{await this.client.public.simulateContract({...t,account:this.client.wallet.account.address,chain:this.client.public.chain})}catch(i){if(i instanceof l){let e=i.walk(n=>n instanceof s);throw e instanceof s?new c(e.message,i,e,a,r):new o(i.message,i,r)}throw i}}};export{o as a,c as b,p as c};
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk7G7GOR7Xcjs = require('./chunk-7G7GOR7X.cjs');var _chunkZ7AZOEVXcjs = require('./chunk-Z7AZOEVX.cjs');var _chunkXQ2K2K23cjs = require('./chunk-XQ2K2K23.cjs');var _chunkBII7Y2A3cjs = require('./chunk-BII7Y2A3.cjs');var _chunkM4K3IZTTcjs = require('./chunk-M4K3IZTT.cjs');var _clientsdkbase = require('@crossmint/client-sdk-base');var _commonsdkbase = require('@crossmint/common-sdk-base');var c=class extends _clientsdkbase.BaseCrossmintService{constructor(){super(...arguments);this.logger=_chunk7G7GOR7Xcjs.a;this.apiErrorService=new (0, _clientsdkbase.APIErrorService)({ERROR_USER_WALLET_ALREADY_CREATED:({userId:r})=>new (0, _chunkM4K3IZTTcjs.d)(r),ERROR_ADMIN_SIGNER_ALREADY_USED:()=>new _chunkM4K3IZTTcjs.i,ERROR_PROJECT_NONCUSTODIAL_WALLETS_NOT_ENABLED:()=>new _chunkM4K3IZTTcjs.j})}async idempotentCreateSmartWallet(r,t){await this.fetchCrossmintAPI(`${_chunkBII7Y2A3cjs.e}/sdk/smart-wallet`,{method:"PUT",body:JSON.stringify(t)},"Error creating abstract wallet. Please contact support",r.jwt)}async sponsorUserOperation(r,t,o,e){let S=_commonsdkbase.blockchainToChainId.call(void 0, e),P=await this.fetchCrossmintAPI(`${_chunkBII7Y2A3cjs.e}/sdk/paymaster`,{method:"POST",body:JSON.stringify({userOp:_chunkXQ2K2K23cjs.a.call(void 0, t),entryPoint:o,chainId:S})},"Error sponsoring user operation. Please contact support",r.jwt);return _chunkXQ2K2K23cjs.b.call(void 0, P)}async getSmartWalletConfig(r,t){let o=await this.fetchCrossmintAPI(`${_chunkBII7Y2A3cjs.e}/sdk/smart-wallet/config?chain=${t}`,{method:"GET"},"Error getting smart wallet version configuration. Please contact support",r.jwt),e=_chunkZ7AZOEVXcjs.e.safeParse(o);if(!e.success)throw new (0, _clientsdkbase.CrossmintServiceError)(`Invalid smart wallet config, please contact support. Details below:
2
- ${e.error.toString()}`);return e.data}async fetchNFTs(r,t){return this.fetchCrossmintAPI(`v1-alpha1/wallets/${t}:${r}/nfts`,{method:"GET"},`Error fetching NFTs for wallet: ${r}`)}getPasskeyServerUrl(){return this.crossmintBaseUrl+"api/internal/passkeys"}};exports.a = c;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkGB35YMN4cjs = require('./chunk-GB35YMN4.cjs');var _chunkM4K3IZTTcjs = require('./chunk-M4K3IZTT.cjs');var _passkeyvalidator = require('@zerodev/passkey-validator');var _sdk = require('@zerodev/sdk');var _webauthnkey = require('@zerodev/webauthn-key');var f=class{constructor(e,t){this.passkeyServerUrl=e;this.apiKey=t}async create({user:e,publicClient:t,walletParams:r,entryPoint:c,kernelVersion:i,existing:a}){let n=_nullishCoalesce(r.signer.passkeyName, () => (e.id));if(a!=null&&a.signerConfig.data.passkeyName!==n)throw new (0, _chunkM4K3IZTTcjs.c)(`User '${e.id}' has an existing wallet created with a passkey named '${a.signerConfig.data.passkeyName}', this does match input passkey name '${n}'.`,a.signerConfig.display());try{a==null&&r.signer.onPrePasskeyRegistration!=null&&await r.signer.onPrePasskeyRegistration();let s=await this.getPasskey(e,n,_optionalChain([a, 'optionalAccess', _ => _.signerConfig, 'access', _2 => _2.data])),g=_passkeyvalidator.PasskeyValidatorContractVersion.V0_0_2,d=a==null?g:a.signerConfig.data.validatorContractVersion,y=await _passkeyvalidator.toPasskeyValidator.call(void 0, t,{webAuthnKey:s,entryPoint:c,validatorContractVersion:d,kernelVersion:i}),k=await _sdk.createKernelAccount.call(void 0, t,{plugins:{sudo:y},entryPoint:c,kernelVersion:i,deployedAccountAddress:_optionalChain([a, 'optionalAccess', _3 => _3.address])});return{signerConfig:this.getSignerConfig(y,d,n),account:this.decorate(k,n,r)}}catch(s){throw r.signer.onPasskeyRegistrationError!=null&&r.signer.onPasskeyRegistrationError(s),this.mapError(s,n)}}async getPasskey(e,t,r){return r!=null?{pubX:BigInt(r.pubKeyX),pubY:BigInt(r.pubKeyY),authenticatorId:r.authenticatorId,authenticatorIdHash:r.authenticatorIdHash}:_webauthnkey.toWebAuthnKey.call(void 0, {passkeyName:t,passkeyServerUrl:this.passkeyServerUrl,mode:_passkeyvalidator.WebAuthnMode.Register,passkeyServerHeaders:this.createPasskeysServerHeaders(e)})}getSignerConfig(e,t,r){return new (0, _chunkGB35YMN4cjs.a)({...V(e.getSerializedData()),passkeyName:r,validatorContractVersion:t,domain:window.location.hostname,type:"passkeys"})}createPasskeysServerHeaders(e){return{"x-api-key":this.apiKey,Authorization:`Bearer ${e.jwt}`}}mapError(e,t){return e.code===0&&e.name==="DataError"?new (0, _chunkM4K3IZTTcjs.g)(t):e.message==="Registration not verified"?new (0, _chunkM4K3IZTTcjs.f)(t):e.code==="ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY"&&e.name==="NotAllowedError"?new (0, _chunkM4K3IZTTcjs.e)(t):e}decorate(e,t,r){return new Proxy(e,{get:(c,i,a)=>{let n=Reflect.get(c,i,a);if(typeof n!="function"||typeof i!="string"||!v(i))return n;let s=r.signer;return async(...g)=>{_optionalChain([g, 'optionalAccess', _4 => _4[0], 'optionalAccess', _5 => _5.factoryData])!=null&&i==="signUserOperation"&&s.type==="PASSKEY"&&s.onFirstTimePasskeySigning!=null&&await s.onFirstTimePasskeySigning();try{return await n.call(c,...g)}catch(y){throw s.onFirstTimePasskeySigningError!=null&&await s.onFirstTimePasskeySigningError(y),this.mapError(y,t)}}}})}},C=["signMessage","signTypedData","signUserOperation","signTransaction"];function v(o){return C.includes(o)}var V=o=>{let e=b(o),t=new TextDecoder().decode(e);return JSON.parse(t)};function b(o){let e=atob(o);return Uint8Array.from(e,t=>t.codePointAt(0))}exports.a = f;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});function e(){return typeof window<"u"}exports.a = e;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk7AVDZZGDcjs = require('./chunk-7AVDZZGD.cjs');var _chunkKYPTGHC6cjs = require('./chunk-KYPTGHC6.cjs');var _chunkM4K3IZTTcjs = require('./chunk-M4K3IZTT.cjs');var o=class{constructor(e,t,n,a=new (0, _chunk7AVDZZGDcjs.c)(e)){this.crossmintService=n;this.sendTransactionService=a;this.chain=t,this.client=e}get address(){return this.client.wallet.account.address}async transferToken(e,t){if(this.chain!==t.token.chain)throw new (0, _chunkM4K3IZTTcjs.a)(`Chain mismatch: Expected ${t.token.chain}, but got ${this.chain}. Ensure you are interacting with the correct blockchain.`);return this.executeContract(_chunkKYPTGHC6cjs.a.call(void 0, {contract:t.token.contractAddress,to:e,from:this.client.wallet.account,config:t}))}async nfts(){return this.crossmintService.fetchNFTs(this.address,this.chain)}async executeContract({address:e,abi:t,functionName:n,args:a,value:s,config:l}){return this.sendTransactionService.sendTransaction({address:e,abi:t,functionName:n,args:a,value:s},l)}};exports.a = o;
@@ -1 +0,0 @@
1
- import{b as s}from"./chunk-BJZQA5VC.js";import{b as d}from"./chunk-CUTQYF3F.js";import{a as i}from"./chunk-FHNNZVNU.js";import{b as n}from"./chunk-UPURFW46.js";import{signerToEcdsaValidator as f}from"@zerodev/ecdsa-validator";import{createKernelAccount as u}from"@zerodev/sdk";var c=class{async create({chain:m,publicClient:o,entryPoint:a,walletParams:g,kernelVersion:t,user:p,existing:e}){let r=await i({chain:m,walletParams:g});if(e!=null&&!d(r.address,e.signerConfig.data.eoaAddress))throw new n(`User '${p.id}' has an existing wallet with an eoa signer '${e.signerConfig.data.eoaAddress}', this does not match input eoa signer '${r.address}'.`,e.signerConfig.display(),{type:"eoa",eoaAddress:e.signerConfig.data.eoaAddress});let A=await f(o,{signer:r,entryPoint:a,kernelVersion:t});return{account:await u(o,{plugins:{sudo:A},index:0n,entryPoint:a,kernelVersion:t,deployedAccountAddress:e?.address}),signerConfig:new s({eoaAddress:r.address,type:"eoa"})}}};export{c as a};
@@ -1 +0,0 @@
1
- import{CrossmintSDKError as g,SmartWalletErrorCode as s}from"@crossmint/client-sdk-base";var r=class extends g{constructor(e,i,n=s.UNCATEGORIZED){super(e,n,i)}},a=class extends r{constructor(e,i,n){super(e,s.ADMIN_MISMATCH),this.required=i,this.used=n}},p=class extends r{constructor(e,i,n){super(e,s.PASSKEY_MISMATCH),this.required=i,this.used=n}},l=class extends r{constructor(i){super(`The user with userId ${i.toString()} already has a wallet created for this project`);this.code=s.USER_WALLET_ALREADY_CREATED}},c=class extends r{constructor(e){super(`Prompt was either cancelled or timed out for passkey ${e}`,void 0,s.PASSKEY_PROMPT),this.passkeyName=e}},u=class extends r{constructor(e){super(`Registration for passkey ${e} failed, either the registration took too long, or passkey signature vaildation failed.`,void 0,s.PASSKEY_REGISTRATION),this.passkeyName=e}},d=class extends r{constructor(e){super(`User selected authenticator for passkey ${e} is not compatible with Crossmint's Smart Wallets.`,void 0,s.PASSKEY_INCOMPATIBLE_AUTHENTICATOR),this.passkeyName=e}},o=class extends r{constructor(e){super(e,void 0,s.WALLET_CONFIG)}},y=class extends o{constructor(){super("This signer was already used to create another wallet. Please use a different signer.");this.code=s.ADMIN_SIGNER_ALREADY_USED}},S=class extends o{constructor(){super("Smart wallets are not enabled for this project. They can be enabled on the project settings page in the developer console.");this.code=s.SMART_WALLETS_NOT_ENABLED}};export{r as a,a as b,p as c,l as d,c as e,u as f,d as g,o as h,y as i,S as j};
@@ -1 +0,0 @@
1
- import{f as n,g as r}from"./chunk-4YV6KMFQ.js";function p(e){return n.includes(e)}function g(e){return r.includes(e)}function i(e){return"signer"in e&&"type"in e.signer&&e.signer.type==="PASSKEY"}function P(e){let t=e.existing==null||e.existing.signerConfig.type==="passkeys";return i(e.walletParams)&&t}function s(e){return"signer"in e&&("type"in e.signer&&e.signer.type==="VIEM_ACCOUNT"||"request"in e.signer&&typeof e.signer.request=="function")}function C(e){let t=e.existing==null||e.existing.signerConfig.type==="eoa";return s(e.walletParams)&&t}export{p as a,g as b,i as c,P as d,s as e,C as f};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});function e(a){return!1}exports.a = e;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }function r(n){return!n||n.length===0||n.trim().length===0}function o(n,e){return _optionalChain([n, 'optionalAccess', _ => _.toLowerCase, 'call', _2 => _2()])===_optionalChain([e, 'optionalAccess', _3 => _3.toLowerCase, 'call', _4 => _4()])}exports.a = r; exports.b = o;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _viem = require('viem');function n(r,e){let t=e(r);return t.replace?t.value:Array.isArray(r)?r.map(i=>n(i,e)):r!==null&&typeof r=="object"?Object.fromEntries(Object.entries(r).map(([i,o])=>[i,n(o,e)])):t.value}function c(r){return n(r,e=>typeof e=="bigint"?{value:_viem.toHex.call(void 0, e),replace:!0}:{value:e,replace:!1})}function s(r){return n(r,e=>e!=null&&typeof e=="object"&&"__xm_serializedType"in e&&"value"in e&&e.__xm_serializedType==="bigint"&&typeof e.value=="string"?{value:BigInt(e.value),replace:!0}:{value:e,replace:!1})}exports.a = c; exports.b = s;
@@ -1 +0,0 @@
1
- import{a as d}from"./chunk-C3VZY7VJ.js";import{a as m}from"./chunk-2RB6U5DY.js";import{a as l}from"./chunk-UPURFW46.js";import{stringify as y}from"viem";var h=["sendTransaction","writeContract","sendUserOperation"],g=["signMessage","signTypedData"];function c(a){return h.includes(a)}function p(a){return g.includes(a)}var u=class{constructor(o,t=m){this.errorProcessor=o;this.logger=t}decorate({crossmintChain:o,smartAccountClient:t}){return new Proxy(t,{get:(n,e,s)=>{let r=Reflect.get(n,e,s);return typeof r!="function"||typeof e!="string"||!(p(e)||c(e))?r:(...i)=>this.logger.logPerformance(`CrossmintSmartWallet.${e}`,()=>this.execute(n,e,r,i,o))}})}async execute(o,t,n,e,s){try{this.logger.log(`[CrossmintSmartWallet.${t}] - params: ${y(e)}`);let r=c(t)?this.processTxnArgs(t,s,e):e;return await n.call(o,...r)}catch(r){let i=c(t)?"signing":"sending transaction";throw this.errorProcessor.map(r,new l(`Error ${i}: ${r.message}`,y(r)))}}processTxnArgs(o,t,n){if(o==="sendUserOperation"){let[{userOperation:s,middleware:r,account:i}]=n;return[{middleware:r,account:i,userOperation:this.addGelatoBundlerProperties(t,s)},...n.slice(1)]}let[e]=n;return[this.addGelatoBundlerProperties(t,e),...n.slice(1)]}addGelatoBundlerProperties(o,t){return d(o)?{...t,maxFeePerGas:"0x0",maxPriorityFeePerGas:"0x0"}:t}};export{u as a};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkSCXFZMLRcjs = require('./chunk-SCXFZMLR.cjs');var _chunkKROX2DDPcjs = require('./chunk-KROX2DDP.cjs');var _chunkNOTF3PP3cjs = require('./chunk-NOTF3PP3.cjs');var _chunkKCVR32TQcjs = require('./chunk-KCVR32TQ.cjs');var _chunkO2ACORIIcjs = require('./chunk-O2ACORII.cjs');var _chunkEVNFELF3cjs = require('./chunk-EVNFELF3.cjs');var _chunk2R6HK64Ncjs = require('./chunk-2R6HK64N.cjs');var _chunkSTH2LE35cjs = require('./chunk-STH2LE35.cjs');var _chunkS4V7TF5Vcjs = require('./chunk-S4V7TF5V.cjs');var _chunk7G7GOR7Xcjs = require('./chunk-7G7GOR7X.cjs');var _chunkNQUKI27Mcjs = require('./chunk-NQUKI27M.cjs');var _chunk2TPNP5FLcjs = require('./chunk-2TPNP5FL.cjs');var _chunkBII7Y2A3cjs = require('./chunk-BII7Y2A3.cjs');var _chunkM4K3IZTTcjs = require('./chunk-M4K3IZTT.cjs');var _viem = require('viem');var _commonsdkbase = require('@crossmint/common-sdk-base');var P=class W{constructor(r,t,a,e=_chunk7G7GOR7Xcjs.a){this.crossmintEnv=r;this.smartWalletService=t;this.errorProcessor=a;this.logger=e}static init({clientApiKey:r}){let t=_commonsdkbase.validateAPIKey.call(void 0, r);if(!t.isValid)throw new Error("API key invalid");let a=new (0, _chunkS4V7TF5Vcjs.a)(r),e=new (0, _chunk2TPNP5FLcjs.a)(_chunk7G7GOR7Xcjs.b),d=new (0, _chunkEVNFELF3cjs.a)(new _chunk2R6HK64Ncjs.a,new (0, _chunkSCXFZMLRcjs.a)(a.getPasskeyServerUrl(),r)),E=new (0, _chunkKCVR32TQcjs.a)(`smart-wallet-${_chunkBII7Y2A3cjs.d}`),u=new (0, _chunkNOTF3PP3cjs.a)(a,new (0, _chunkO2ACORIIcjs.a)(a,E),d,new (0, _chunkKROX2DDPcjs.a)(e));return new W(t.environment,u,e)}async getOrCreateWallet(r,t,a={signer:{type:"PASSKEY"}}){if(!_chunkSTH2LE35cjs.a.call(void 0, ))throw new (0, _chunkM4K3IZTTcjs.a)("Smart Wallet SDK should only be used client side.");return this.assertValidChain(t),await this.logger.logPerformance("GET_OR_CREATE_WALLET",async()=>{try{return await this.smartWalletService.getOrCreate(r,t,a)}catch(e){throw this.errorProcessor.map(e,new (0, _chunkM4K3IZTTcjs.a)(`Wallet creation failed: ${e.message}.`,_viem.stringify.call(void 0, e)))}})}assertValidChain(r){if(!this.validChain(r))throw new (0, _chunkM4K3IZTTcjs.a)(`The selected chain "${r}" is not available in "${this.crossmintEnv}". Either set a valid chain or check you're using an API key for the environment you're trying to target.`)}validChain(r){return this.crossmintEnv==="development"||this.crossmintEnv==="staging"?_chunkNQUKI27Mcjs.g.call(void 0, r):_chunkNQUKI27Mcjs.h.call(void 0, r)}};exports.a = P;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBII7Y2A3cjs = require('./chunk-BII7Y2A3.cjs');var _passkeyvalidator = require('@zerodev/passkey-validator');var _viem = require('viem');var _zod = require('zod');var m=_zod.z.custom(t=>_viem.isHex.call(void 0, t),{message:"Invalid hex string"}),s=_zod.z.custom(t=>_viem.isAddress.call(void 0, t),{message:"Invalid evm address"}),p= exports.a =_zod.z.object({eoaAddress:s,type:_zod.z.literal("eoa")}),c= exports.b =_zod.z.object({entryPoint:s,validatorAddress:s,pubKeyX:_zod.z.string(),pubKeyY:_zod.z.string(),authenticatorIdHash:m,authenticatorId:_zod.z.string()}),l= exports.c =c.extend({passkeyName:_zod.z.string(),validatorContractVersion:_zod.z.nativeEnum(_passkeyvalidator.PasskeyValidatorContractVersion),domain:_zod.z.string(),type:_zod.z.literal("passkeys")}),g= exports.d =_zod.z.discriminatedUnion("type",[l,p]),P= exports.e =_zod.z.object({kernelVersion:_zod.z.enum(_chunkBII7Y2A3cjs.f,{errorMap:(t,r)=>({message:`Unsupported kernel version. Supported versions: ${_chunkBII7Y2A3cjs.f.join(", ")}. Version used: ${r.data}. Please contact support`})}),entryPointVersion:_zod.z.enum(_chunkBII7Y2A3cjs.g,{errorMap:(t,r)=>({message:`Unsupported entry point version. Supported versions: ${_chunkBII7Y2A3cjs.g.join(", ")}. Version used: ${r.data}. Please contact support`})}),userId:_zod.z.string().min(1),signers:_zod.z.array(_zod.z.object({signerData:g})).min(0).max(1,"Invalid wallet signer configuration. Please contact support"),smartContractWalletAddress:s.optional()});exports.a = p; exports.b = c; exports.c = l; exports.d = g; exports.e = P;
@@ -1 +0,0 @@
1
- import{d as o}from"./chunk-4YV6KMFQ.js";import{a}from"./chunk-UPURFW46.js";import{BaseError as e,stringify as i}from"viem";var r=class{constructor(n){this.logger=n}map(n,t){return this.record(n),n instanceof a||n instanceof e?n:t}record(n){let t=n instanceof Error?n.message:String(n);this.logger.error(`Smart Wallet SDK Error: ${t}`,{stack:n instanceof Error?n.stack:void 0,name:n instanceof Error?n.name:"UnknownError",details:i(n),domain:window.location.hostname,sdk_version:o})}};export{r as a};