@crossmint/wallets-sdk 0.21.0 → 1.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (396) hide show
  1. package/README.md +6 -6
  2. package/dist/api/__tests__/constants.cjs +1 -31
  3. package/dist/api/__tests__/constants.d.cts +9 -1
  4. package/dist/api/__tests__/constants.d.ts +9 -1
  5. package/dist/api/__tests__/constants.js +1 -31
  6. package/dist/api/__tests__/test-utils.cjs +1 -372
  7. package/dist/api/__tests__/test-utils.d.cts +10 -4
  8. package/dist/api/__tests__/test-utils.d.ts +10 -4
  9. package/dist/api/__tests__/test-utils.js +1 -372
  10. package/dist/api/client.cjs +1 -10
  11. package/dist/api/client.d.cts +14 -6
  12. package/dist/api/client.d.ts +14 -6
  13. package/dist/api/client.js +1 -10
  14. package/dist/api/gen/client.gen.cjs +1 -7
  15. package/dist/api/gen/client.gen.js +1 -7
  16. package/dist/api/gen/index.cjs +1 -79
  17. package/dist/api/gen/index.d.cts +2 -2
  18. package/dist/api/gen/index.d.ts +2 -2
  19. package/dist/api/gen/index.js +1 -79
  20. package/dist/api/gen/sdk.gen.cjs +1 -78
  21. package/dist/api/gen/sdk.gen.d.cts +2 -9
  22. package/dist/api/gen/sdk.gen.d.ts +2 -9
  23. package/dist/api/gen/sdk.gen.js +1 -78
  24. package/dist/api/gen/types.gen.d.cts +593 -92
  25. package/dist/api/gen/types.gen.d.ts +593 -92
  26. package/dist/api/gen/types.gen.js +1 -1
  27. package/dist/api/index.cjs +1 -12
  28. package/dist/api/index.d.cts +7 -1
  29. package/dist/api/index.d.ts +7 -1
  30. package/dist/api/index.js +1 -12
  31. package/dist/api/types.d.cts +11 -55
  32. package/dist/api/types.d.ts +11 -55
  33. package/dist/api/types.js +1 -1
  34. package/dist/chains/chains.cjs +1 -24
  35. package/dist/chains/chains.js +1 -24
  36. package/dist/chains/definitions/arcTestnet.cjs +1 -7
  37. package/dist/chains/definitions/arcTestnet.js +1 -7
  38. package/dist/chains/definitions/story.cjs +1 -7
  39. package/dist/chains/definitions/story.js +1 -7
  40. package/dist/chains/definitions/storyTestnet.cjs +1 -7
  41. package/dist/chains/definitions/storyTestnet.js +1 -7
  42. package/dist/chains/definitions/tempo.cjs +1 -7
  43. package/dist/chains/definitions/tempo.js +1 -7
  44. package/dist/chains/definitions/tempoTestnet.cjs +1 -7
  45. package/dist/chains/definitions/tempoTestnet.js +1 -7
  46. package/dist/chunk-2GKPWQBQ.cjs +1 -0
  47. package/dist/chunk-2YLRFJ66.js +1 -0
  48. package/dist/chunk-3HLCTEWX.js +1 -0
  49. package/dist/chunk-4ADZVYB5.cjs +1 -0
  50. package/dist/chunk-576HP23H.cjs +1 -0
  51. package/dist/chunk-5M7IRODB.js +1 -0
  52. package/dist/chunk-5QIW67NU.cjs +1 -0
  53. package/dist/chunk-5X4EOJFG.cjs +1 -0
  54. package/dist/chunk-5YG5A77Q.js +1 -0
  55. package/dist/chunk-67Z4SJMH.js +1 -0
  56. package/dist/chunk-6MGMZ3SI.cjs +1 -0
  57. package/dist/chunk-6OXELDPD.js +1 -0
  58. package/dist/chunk-7VUOD7EI.cjs +1 -0
  59. package/dist/chunk-A33BEWR7.cjs +1 -0
  60. package/dist/chunk-BEW7JDW6.cjs +1 -0
  61. package/dist/chunk-BFIHTTMM.cjs +1 -0
  62. package/dist/chunk-BW27ZG6O.cjs +1 -0
  63. package/dist/chunk-CUHDOBKN.cjs +1 -0
  64. package/dist/chunk-D5YDWSO5.cjs +1 -0
  65. package/dist/chunk-DIGDDKSF.js +1 -0
  66. package/dist/chunk-EE4ITUGS.js +1 -0
  67. package/dist/chunk-EIHK5TYE.js +1 -0
  68. package/dist/chunk-ENU3EKBG.cjs +1 -0
  69. package/dist/chunk-F6PYIH4E.cjs +1 -0
  70. package/dist/chunk-FT5EVMLB.js +1 -0
  71. package/dist/chunk-G5R6VQGJ.js +1 -0
  72. package/dist/chunk-GDRKG42L.cjs +1 -0
  73. package/dist/chunk-GEY574TH.cjs +1 -0
  74. package/dist/chunk-GOXB2RBF.js +1 -0
  75. package/dist/chunk-HOWDLODW.cjs +1 -0
  76. package/dist/chunk-HRUMWG2F.cjs +1 -0
  77. package/dist/chunk-IFD3BVMM.js +1 -0
  78. package/dist/chunk-IR5WN6FQ.cjs +1 -0
  79. package/dist/chunk-ISXH7QXG.cjs +1 -0
  80. package/dist/chunk-J33QM2ID.cjs +1 -0
  81. package/dist/chunk-J3R36SGJ.js +1 -0
  82. package/dist/chunk-JBP52JOH.cjs +1 -0
  83. package/dist/chunk-JINIR3YK.cjs +1 -0
  84. package/dist/chunk-JJMKQ5PK.cjs +1 -0
  85. package/dist/chunk-JLT4EA2Z.js +1 -0
  86. package/dist/chunk-JUKCHXJ6.cjs +1 -0
  87. package/dist/chunk-KKQBZXFE.js +1 -0
  88. package/dist/chunk-KUP7H7X2.js +1 -0
  89. package/dist/chunk-LB4V5KKI.js +1 -0
  90. package/dist/chunk-MCBBBEJT.js +1 -0
  91. package/dist/chunk-MMFZP54X.js +1 -0
  92. package/dist/chunk-N5WVT7QE.js +1 -0
  93. package/dist/chunk-NCXMTHC4.js +1 -0
  94. package/dist/chunk-NF7KU2ML.cjs +1 -0
  95. package/dist/chunk-NJWSHT2H.cjs +1 -0
  96. package/dist/chunk-NKR3UAMA.cjs +1 -0
  97. package/dist/chunk-NPCKXKQ7.js +1 -0
  98. package/dist/chunk-NX256LAH.cjs +1 -0
  99. package/dist/chunk-O4FVTK7X.cjs +1 -0
  100. package/dist/chunk-O6VBO7KG.js +1 -0
  101. package/dist/chunk-OQZTL6ZG.js +1 -0
  102. package/dist/chunk-P6MB5P2F.js +1 -0
  103. package/dist/chunk-PDHWPAGW.js +1 -0
  104. package/dist/chunk-PHXT77LR.js +1 -0
  105. package/dist/chunk-PKYRYRX4.js +1 -0
  106. package/dist/chunk-PSXRNSOE.js +1 -0
  107. package/dist/chunk-R3EQXI46.js +1 -0
  108. package/dist/chunk-RC6KDONJ.cjs +1 -0
  109. package/dist/chunk-RLAW2ERD.js +1 -0
  110. package/dist/chunk-RN77IYDQ.js +1 -0
  111. package/dist/chunk-RXRRXB74.cjs +1 -0
  112. package/dist/chunk-S3DMYMEQ.js +1 -0
  113. package/dist/chunk-S3DYQVRD.js +1 -0
  114. package/dist/chunk-S4O54O4C.cjs +1 -0
  115. package/dist/chunk-S5KDZFZ7.cjs +1 -0
  116. package/dist/chunk-SCEPJO4Q.cjs +1 -0
  117. package/dist/chunk-SH7KRBXV.js +1 -0
  118. package/dist/chunk-SP2YD44M.js +1 -0
  119. package/dist/chunk-SPTXAOFR.cjs +1 -0
  120. package/dist/chunk-SPVAZXRY.js +1 -0
  121. package/dist/chunk-STYSP6KL.cjs +1 -0
  122. package/dist/chunk-SVIKBM3S.js +1 -0
  123. package/dist/chunk-TFMNBTFK.cjs +1 -0
  124. package/dist/chunk-TOAFCAVT.js +0 -0
  125. package/dist/chunk-TTSJFEM5.cjs +1 -0
  126. package/dist/chunk-TYFWX53A.js +1 -0
  127. package/dist/chunk-U7QSF6P7.cjs +1 -0
  128. package/dist/chunk-UE3WVHTM.cjs +1 -0
  129. package/dist/chunk-W5EH3HYF.cjs +1 -0
  130. package/dist/chunk-WBIKVPHW.js +1 -0
  131. package/dist/chunk-WCGUGIGJ.js +1 -0
  132. package/dist/chunk-WT5MDUZY.js +1 -0
  133. package/dist/chunk-WTVI4AL4.js +1 -0
  134. package/dist/chunk-WYMBO52A.js +1 -0
  135. package/dist/chunk-XNZLCUTY.js +1 -0
  136. package/dist/chunk-XS5B3TUE.js +1 -0
  137. package/dist/chunk-YFAJXQAM.cjs +1 -0
  138. package/dist/chunk-YGL4ITFK.cjs +1 -0
  139. package/dist/chunk-YLRD3ANZ.cjs +1 -0
  140. package/dist/chunk-YQQWKSNT.cjs +1 -0
  141. package/dist/chunk-ZACCKNGY.cjs +1 -0
  142. package/dist/chunk-ZE4NT3CJ.js +1 -0
  143. package/dist/chunk-ZKL4RO4I.cjs +1 -0
  144. package/dist/index.cjs +1 -69
  145. package/dist/index.d.cts +9 -7
  146. package/dist/index.d.ts +9 -7
  147. package/dist/index.js +1 -69
  148. package/dist/logger/index.cjs +1 -11
  149. package/dist/logger/index.js +1 -11
  150. package/dist/logger/init.cjs +1 -10
  151. package/dist/logger/init.js +1 -10
  152. package/dist/sdk.cjs +1 -48
  153. package/dist/sdk.d.cts +25 -23
  154. package/dist/sdk.d.ts +25 -23
  155. package/dist/sdk.js +1 -48
  156. package/dist/signers/device.cjs +1 -0
  157. package/dist/signers/device.d.cts +23 -0
  158. package/dist/signers/device.d.ts +23 -0
  159. package/dist/signers/device.js +1 -0
  160. package/dist/signers/evm-api-key.cjs +1 -7
  161. package/dist/signers/evm-api-key.d.cts +8 -4
  162. package/dist/signers/evm-api-key.d.ts +8 -4
  163. package/dist/signers/evm-api-key.js +1 -7
  164. package/dist/signers/evm-external-wallet.cjs +1 -7
  165. package/dist/signers/evm-external-wallet.d.cts +13 -14
  166. package/dist/signers/evm-external-wallet.d.ts +13 -14
  167. package/dist/signers/evm-external-wallet.js +1 -7
  168. package/dist/signers/external-wallet-signer.cjs +1 -0
  169. package/dist/signers/external-wallet-signer.d.cts +28 -0
  170. package/dist/signers/external-wallet-signer.d.ts +28 -0
  171. package/dist/signers/external-wallet-signer.js +1 -0
  172. package/dist/signers/index.cjs +1 -33
  173. package/dist/signers/index.d.cts +7 -3
  174. package/dist/signers/index.d.ts +7 -3
  175. package/dist/signers/index.js +1 -33
  176. package/dist/signers/non-custodial/index.cjs +1 -27
  177. package/dist/signers/non-custodial/index.d.cts +7 -3
  178. package/dist/signers/non-custodial/index.d.ts +7 -3
  179. package/dist/signers/non-custodial/index.js +1 -27
  180. package/dist/signers/non-custodial/ncs-evm-signer.cjs +1 -13
  181. package/dist/signers/non-custodial/ncs-evm-signer.d.cts +7 -3
  182. package/dist/signers/non-custodial/ncs-evm-signer.d.ts +7 -3
  183. package/dist/signers/non-custodial/ncs-evm-signer.js +1 -13
  184. package/dist/signers/non-custodial/ncs-iframe-manager.cjs +1 -7
  185. package/dist/signers/non-custodial/ncs-iframe-manager.js +1 -7
  186. package/dist/signers/non-custodial/ncs-signer.cjs +1 -14
  187. package/dist/signers/non-custodial/ncs-signer.d.cts +8 -4
  188. package/dist/signers/non-custodial/ncs-signer.d.ts +8 -4
  189. package/dist/signers/non-custodial/ncs-signer.js +1 -14
  190. package/dist/signers/non-custodial/ncs-solana-signer.cjs +1 -13
  191. package/dist/signers/non-custodial/ncs-solana-signer.d.cts +7 -3
  192. package/dist/signers/non-custodial/ncs-solana-signer.d.ts +7 -3
  193. package/dist/signers/non-custodial/ncs-solana-signer.js +1 -13
  194. package/dist/signers/non-custodial/ncs-stellar-signer.cjs +1 -13
  195. package/dist/signers/non-custodial/ncs-stellar-signer.d.cts +7 -3
  196. package/dist/signers/non-custodial/ncs-stellar-signer.d.ts +7 -3
  197. package/dist/signers/non-custodial/ncs-stellar-signer.js +1 -13
  198. package/dist/signers/passkey.cjs +1 -7
  199. package/dist/signers/passkey.d.cts +8 -4
  200. package/dist/signers/passkey.d.ts +8 -4
  201. package/dist/signers/passkey.js +1 -7
  202. package/dist/signers/server/assemble-server-signer.cjs +1 -14
  203. package/dist/signers/server/assemble-server-signer.d.cts +6 -2
  204. package/dist/signers/server/assemble-server-signer.d.ts +6 -2
  205. package/dist/signers/server/assemble-server-signer.js +1 -14
  206. package/dist/signers/server/evm-server-signer.cjs +1 -7
  207. package/dist/signers/server/evm-server-signer.d.cts +8 -4
  208. package/dist/signers/server/evm-server-signer.d.ts +8 -4
  209. package/dist/signers/server/evm-server-signer.js +1 -7
  210. package/dist/signers/server/helpers/derive-server-signer.cjs +1 -11
  211. package/dist/signers/server/helpers/derive-server-signer.d.cts +6 -2
  212. package/dist/signers/server/helpers/derive-server-signer.d.ts +6 -2
  213. package/dist/signers/server/helpers/derive-server-signer.js +1 -11
  214. package/dist/signers/server/helpers/get-chain-type.cjs +1 -7
  215. package/dist/signers/server/helpers/get-chain-type.js +1 -7
  216. package/dist/signers/server/helpers/index.cjs +1 -15
  217. package/dist/signers/server/helpers/index.d.cts +6 -2
  218. package/dist/signers/server/helpers/index.d.ts +6 -2
  219. package/dist/signers/server/helpers/index.js +1 -15
  220. package/dist/signers/server/index.cjs +1 -29
  221. package/dist/signers/server/index.d.cts +6 -2
  222. package/dist/signers/server/index.d.ts +6 -2
  223. package/dist/signers/server/index.js +1 -29
  224. package/dist/signers/server/solana-server-signer.cjs +1 -7
  225. package/dist/signers/server/solana-server-signer.d.cts +8 -4
  226. package/dist/signers/server/solana-server-signer.d.ts +8 -4
  227. package/dist/signers/server/solana-server-signer.js +1 -7
  228. package/dist/signers/server/stellar-server-signer.cjs +1 -7
  229. package/dist/signers/server/stellar-server-signer.d.cts +8 -4
  230. package/dist/signers/server/stellar-server-signer.d.ts +8 -4
  231. package/dist/signers/server/stellar-server-signer.js +1 -7
  232. package/dist/signers/solana-api-key.cjs +1 -7
  233. package/dist/signers/solana-api-key.d.cts +8 -4
  234. package/dist/signers/solana-api-key.d.ts +8 -4
  235. package/dist/signers/solana-api-key.js +1 -7
  236. package/dist/signers/solana-external-wallet.cjs +1 -8
  237. package/dist/signers/solana-external-wallet.d.cts +10 -11
  238. package/dist/signers/solana-external-wallet.d.ts +10 -11
  239. package/dist/signers/solana-external-wallet.js +1 -8
  240. package/dist/signers/stellar-external-wallet.cjs +1 -7
  241. package/dist/signers/stellar-external-wallet.d.cts +10 -10
  242. package/dist/signers/stellar-external-wallet.d.ts +10 -10
  243. package/dist/signers/stellar-external-wallet.js +1 -7
  244. package/dist/signers/types.cjs +1 -9
  245. package/dist/signers/types.d.cts +10 -102
  246. package/dist/signers/types.d.ts +10 -102
  247. package/dist/signers/types.js +1 -9
  248. package/dist/types/base32.js.d.cjs +1 -0
  249. package/dist/types/base32.js.d.d.cts +4 -0
  250. package/dist/types/base32.js.d.d.ts +4 -0
  251. package/dist/types/base32.js.d.js +0 -0
  252. package/dist/types-BDRS_MOb.d.ts +425 -0
  253. package/dist/types-D-xASbms.d.cts +425 -0
  254. package/dist/utils/constants.cjs +1 -13
  255. package/dist/utils/constants.js +1 -13
  256. package/dist/utils/device-signers/DeviceSignerKeyStorage.cjs +1 -0
  257. package/dist/utils/device-signers/DeviceSignerKeyStorage.d.cts +66 -0
  258. package/dist/utils/device-signers/DeviceSignerKeyStorage.d.ts +66 -0
  259. package/dist/utils/device-signers/DeviceSignerKeyStorage.js +1 -0
  260. package/dist/utils/device-signers/IframeDeviceSignerKeyStorage.cjs +1 -0
  261. package/dist/utils/device-signers/IframeDeviceSignerKeyStorage.d.cts +48 -0
  262. package/dist/utils/device-signers/IframeDeviceSignerKeyStorage.d.ts +48 -0
  263. package/dist/utils/device-signers/IframeDeviceSignerKeyStorage.js +1 -0
  264. package/dist/utils/device-signers/createDeviceSigner.cjs +1 -0
  265. package/dist/utils/device-signers/createDeviceSigner.d.cts +27 -0
  266. package/dist/utils/device-signers/createDeviceSigner.d.ts +27 -0
  267. package/dist/utils/device-signers/createDeviceSigner.js +1 -0
  268. package/dist/utils/device-signers/index.cjs +1 -0
  269. package/dist/utils/device-signers/index.d.cts +13 -0
  270. package/dist/utils/device-signers/index.d.ts +13 -0
  271. package/dist/utils/device-signers/index.js +1 -0
  272. package/dist/utils/errors.cjs +1 -55
  273. package/dist/utils/errors.js +1 -55
  274. package/dist/utils/server-key-derivation.cjs +1 -9
  275. package/dist/utils/server-key-derivation.js +1 -9
  276. package/dist/utils/signer-locator.cjs +1 -0
  277. package/dist/utils/signer-locator.d.cts +26 -0
  278. package/dist/utils/signer-locator.d.ts +26 -0
  279. package/dist/utils/signer-locator.js +1 -0
  280. package/dist/utils/signer-mapping.cjs +1 -0
  281. package/dist/utils/signer-mapping.d.cts +32 -0
  282. package/dist/utils/signer-mapping.d.ts +32 -0
  283. package/dist/utils/signer-mapping.js +1 -0
  284. package/dist/utils/signer-validation.cjs +1 -10
  285. package/dist/utils/signer-validation.js +1 -10
  286. package/dist/wallets/__tests__/setup.cjs +1 -36
  287. package/dist/wallets/__tests__/setup.js +1 -36
  288. package/dist/wallets/__tests__/test-helpers.cjs +1 -102
  289. package/dist/wallets/__tests__/test-helpers.d.cts +6 -6
  290. package/dist/wallets/__tests__/test-helpers.d.ts +6 -6
  291. package/dist/wallets/__tests__/test-helpers.js +1 -102
  292. package/dist/wallets/evm.cjs +1 -34
  293. package/dist/wallets/evm.d.cts +2 -3
  294. package/dist/wallets/evm.d.ts +2 -3
  295. package/dist/wallets/evm.js +1 -34
  296. package/dist/wallets/solana.cjs +1 -35
  297. package/dist/wallets/solana.d.cts +5 -4
  298. package/dist/wallets/solana.d.ts +5 -4
  299. package/dist/wallets/solana.js +1 -35
  300. package/dist/wallets/stellar.cjs +1 -34
  301. package/dist/wallets/stellar.d.cts +2 -3
  302. package/dist/wallets/stellar.d.ts +2 -3
  303. package/dist/wallets/stellar.js +1 -34
  304. package/dist/wallets/types.d.cts +9 -171
  305. package/dist/wallets/types.d.ts +9 -171
  306. package/dist/wallets/wallet-factory.cjs +1 -42
  307. package/dist/wallets/wallet-factory.d.cts +17 -13
  308. package/dist/wallets/wallet-factory.d.ts +17 -13
  309. package/dist/wallets/wallet-factory.js +1 -42
  310. package/dist/wallets/wallet.cjs +1 -33
  311. package/dist/wallets/wallet.d.cts +97 -32
  312. package/dist/wallets/wallet.d.ts +97 -32
  313. package/dist/wallets/wallet.js +1 -33
  314. package/package.json +9 -5
  315. package/dist/chunk-2I2OFGNL.js +0 -36
  316. package/dist/chunk-2M32LBCA.cjs +0 -52
  317. package/dist/chunk-2PSAUSOG.js +0 -379
  318. package/dist/chunk-2RG6642I.js +0 -39
  319. package/dist/chunk-2T5HHKUI.js +0 -19
  320. package/dist/chunk-3U6UAYOV.js +0 -25
  321. package/dist/chunk-3WZUNLYI.cjs +0 -16
  322. package/dist/chunk-47WKYTRN.js +0 -63
  323. package/dist/chunk-4GFSUI2I.cjs +0 -66
  324. package/dist/chunk-4Z3YDHHG.js +0 -82
  325. package/dist/chunk-4ZWUI6LE.cjs +0 -757
  326. package/dist/chunk-55V4VMTX.cjs +0 -25
  327. package/dist/chunk-65KPNJ77.js +0 -119
  328. package/dist/chunk-7EZDSDKA.cjs +0 -125
  329. package/dist/chunk-7GOUUPS4.js +0 -36
  330. package/dist/chunk-7SUWMK4J.cjs +0 -246
  331. package/dist/chunk-7USEVMTW.cjs +0 -21
  332. package/dist/chunk-7W4HGN3H.cjs +0 -63
  333. package/dist/chunk-ASE2FXWP.js +0 -65
  334. package/dist/chunk-BR4UVMIC.js +0 -332
  335. package/dist/chunk-BUBSPQ7U.cjs +0 -332
  336. package/dist/chunk-CPZQ7BK5.cjs +0 -82
  337. package/dist/chunk-CTOLL4BK.js +0 -29
  338. package/dist/chunk-DDNG224J.cjs +0 -45
  339. package/dist/chunk-EVR4CD53.js +0 -63
  340. package/dist/chunk-F7L2TZ3I.cjs +0 -21
  341. package/dist/chunk-FOOISYCJ.js +0 -66
  342. package/dist/chunk-FZQG6OX2.js +0 -323
  343. package/dist/chunk-G6QJHFSY.cjs +0 -74
  344. package/dist/chunk-GJT2JD3E.js +0 -45
  345. package/dist/chunk-GLUD6EBN.js +0 -16
  346. package/dist/chunk-H6WV5NRT.js +0 -10
  347. package/dist/chunk-HFEF2URB.js +0 -84
  348. package/dist/chunk-HTSQPZHW.cjs +0 -25
  349. package/dist/chunk-HWTWDQYT.cjs +0 -42
  350. package/dist/chunk-HYA3ESUA.js +0 -69
  351. package/dist/chunk-IOMKHF6R.cjs +0 -44
  352. package/dist/chunk-IPO25BCU.js +0 -43
  353. package/dist/chunk-JSWTGW46.cjs +0 -36
  354. package/dist/chunk-JWMQALLN.js +0 -21
  355. package/dist/chunk-K6LSGLG6.js +0 -42
  356. package/dist/chunk-KHY5FXO4.cjs +0 -37
  357. package/dist/chunk-KT3CVXFG.js +0 -9
  358. package/dist/chunk-M47ZHA7Q.js +0 -246
  359. package/dist/chunk-M4HCASMG.cjs +0 -119
  360. package/dist/chunk-M6IPPGXQ.cjs +0 -29
  361. package/dist/chunk-M7OPRXZH.cjs +0 -69
  362. package/dist/chunk-MIKWTXUA.cjs +0 -223
  363. package/dist/chunk-MMISP35W.js +0 -21
  364. package/dist/chunk-MNHK6EQK.cjs +0 -57
  365. package/dist/chunk-NIBKCMQ2.cjs +0 -19
  366. package/dist/chunk-NO2KMGS2.cjs +0 -379
  367. package/dist/chunk-OPKFMXPI.cjs +0 -39
  368. package/dist/chunk-OXB6RTW7.js +0 -125
  369. package/dist/chunk-P4XJHOLW.cjs +0 -253
  370. package/dist/chunk-PIFD6KNH.js +0 -59
  371. package/dist/chunk-PJOJIRTY.js +0 -74
  372. package/dist/chunk-PK7J3Y3L.js +0 -44
  373. package/dist/chunk-Q52MMQSC.js +0 -57
  374. package/dist/chunk-Q5KNPVYI.cjs +0 -59
  375. package/dist/chunk-QQNDLR6E.cjs +0 -323
  376. package/dist/chunk-RBHGZDDX.cjs +0 -58
  377. package/dist/chunk-RHR6P2KP.cjs +0 -15
  378. package/dist/chunk-RUQYXEEG.cjs +0 -10
  379. package/dist/chunk-S2L5Z2ZT.js +0 -37
  380. package/dist/chunk-SGINWAB6.js +0 -155
  381. package/dist/chunk-T5NKL6F4.js +0 -89
  382. package/dist/chunk-U56Z2EOR.cjs +0 -89
  383. package/dist/chunk-UO2J2ZB2.cjs +0 -65
  384. package/dist/chunk-VLZ5ZS5U.js +0 -253
  385. package/dist/chunk-VTF3WCXG.cjs +0 -84
  386. package/dist/chunk-VVPGO564.js +0 -757
  387. package/dist/chunk-WJUPOCKJ.js +0 -15
  388. package/dist/chunk-X4SPF4KJ.js +0 -223
  389. package/dist/chunk-XC2V34TS.cjs +0 -155
  390. package/dist/chunk-XEPUH4XH.js +0 -52
  391. package/dist/chunk-XOCC3MPK.cjs +0 -36
  392. package/dist/chunk-ZBLW42YE.js +0 -25
  393. package/dist/chunk-ZNAGDENG.cjs +0 -43
  394. package/dist/chunk-ZP4ZZCIE.js +0 -58
  395. package/dist/chunk-ZT7EGOCI.cjs +0 -9
  396. package/dist/chunk-ZTEMOYS2.cjs +0 -63
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBEW7JDW6cjs = require('./chunk-BEW7JDW6.cjs');var _chunk6MGMZ3SIcjs = require('./chunk-6MGMZ3SI.cjs');var _chunkJUKCHXJ6cjs = require('./chunk-JUKCHXJ6.cjs');var _chunkO4FVTK7Xcjs = require('./chunk-O4FVTK7X.cjs');var _chunkS4O54O4Ccjs = require('./chunk-S4O54O4C.cjs');var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var _viem = require('viem');var _commonsdkbase = require('@crossmint/common-sdk-base');var o=class o extends _chunkBEW7JDW6cjs.a{constructor(e){super({chain:e.chain,address:e.address,owner:e.owner,options:_chunkBEW7JDW6cjs.a.getOptions(e),alias:e.alias,recovery:_chunkBEW7JDW6cjs.a.getRecovery(e),signer:e.signer},_chunkBEW7JDW6cjs.a.getApiClient(e))}static from(e){if(!_commonsdkbase.isValidEvmAddress.call(void 0, e.address))throw new Error("Wallet is not an EVM wallet");return new o(e)}sendTransaction(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var i;_chunkS4O54O4Ccjs.a.info("evmWallet.sendTransaction.start"),yield this.preAuthIfNeeded();let n=this.buildTransaction(e),t=yield this.createTransaction(n,e.options);if((i=e.options)!=null&&i.prepareOnly)return _chunkS4O54O4Ccjs.a.info("evmWallet.sendTransaction.prepared",{transactionId:t.id}),{hash:void 0,explorerLink:void 0,transactionId:t.id};let a=yield this.approveTransactionAndWait(t.id);return _chunkS4O54O4Ccjs.a.info("evmWallet.sendTransaction.success",{transactionId:t.id,hash:a.hash}),a})}signMessage(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var i;_chunkS4O54O4Ccjs.a.info("evmWallet.signMessage.start"),yield this.preAuthIfNeeded();let n=this.requireSigner(),t=yield this.apiClient.createSignature(this.walletLocator,{type:"message",params:{message:e.message,signer:n.locator(),chain:this.chain}});if("error"in t)throw _chunkS4O54O4Ccjs.a.error("evmWallet.signMessage.error",{error:t}),new (0, _chunkO4FVTK7Xcjs.o)(JSON.stringify(t));if((i=e.options)!=null&&i.prepareOnly)return _chunkS4O54O4Ccjs.a.info("evmWallet.signMessage.prepared",{signatureId:t.id}),{signature:void 0,signatureId:t.id};let a=yield this.approveSignatureAndWait(t.id);return _chunkS4O54O4Ccjs.a.info("evmWallet.signMessage.success",{signatureId:t.id}),a})}signTypedData(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var C;_chunkS4O54O4Ccjs.a.info("evmWallet.signTypedData.start"),yield this.preAuthIfNeeded();let n=this.requireSigner(),{domain:t,message:a,primaryType:i,types:d,chain:m}=e;if(!t||!a||!d||!m)throw _chunkS4O54O4Ccjs.a.error("evmWallet.signTypedData.error",{error:"Invalid typed data"}),new (0, _chunkO4FVTK7Xcjs.k)("Invalid typed data");let{name:T,version:f,chainId:y,verifyingContract:v,salt:D}=t;if(!T||!f||!y||!v)throw _chunkS4O54O4Ccjs.a.error("evmWallet.signTypedData.error",{error:"Invalid typed data domain"}),new (0, _chunkO4FVTK7Xcjs.k)("Invalid typed data domain");let s=yield this.apiClient.createSignature(this.walletLocator,{type:"typed-data",params:{typedData:{domain:{name:T,version:f,chainId:Number(y),verifyingContract:v,salt:D},message:a,primaryType:i,types:d},signer:n.locator(),chain:m}});if("error"in s)throw _chunkS4O54O4Ccjs.a.error("evmWallet.signTypedData.error",{error:s}),new (0, _chunkO4FVTK7Xcjs.o)(JSON.stringify(s));if((C=e.options)!=null&&C.prepareOnly)return _chunkS4O54O4Ccjs.a.info("evmWallet.signTypedData.prepared",{signatureId:s.id}),{signature:void 0,signatureId:s.id};let M=yield this.approveSignatureAndWait(s.id);return _chunkS4O54O4Ccjs.a.info("evmWallet.signTypedData.success",{signatureId:s.id}),M})}getViemClient(e){var n;return _viem.createPublicClient.call(void 0, {transport:(n=e==null?void 0:e.transport)!=null?n:_viem.http.call(void 0, ),chain:_chunkJUKCHXJ6cjs.a.call(void 0, this.chain)})}createTransaction(e,n){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let t;(n==null?void 0:n.signer)==null?t=this.requireSigner().locator():typeof n.signer=="string"?t=n.signer:t=`server:${_chunk6MGMZ3SIcjs.b.call(void 0, n.signer,this.chain,this.apiClient.projectId,this.apiClient.environment).derivedAddress}`;let a=yield this.apiClient.createTransaction(this.walletLocator,{params:{signer:t,chain:this.chain,calls:[e]}});if("error"in a)throw new (0, _chunkO4FVTK7Xcjs.r)(JSON.stringify(a));return a})}buildTransaction(e){var n,t,a,i,d;if("transaction"in e)return{transaction:e.transaction};if(e.abi==null)return{to:e.to,value:(t=(n=e.value)==null?void 0:n.toString())!=null?t:"0",data:(a=e.data)!=null?a:"0x"};if(!e.functionName)throw new Error("Function name is required");return{to:e.to,value:(d=(i=e.value)==null?void 0:i.toString())!=null?d:"0",data:_viem.encodeFunctionData.call(void 0, {abi:e.abi,functionName:e.functionName,args:e.args})}}};_chunk2GKPWQBQcjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkS4O54O4Ccjs.a,methodName:"evmWallet.sendTransaction",buildContext(e){return{chain:e.chain,address:e.address}}})],o.prototype,"sendTransaction",1),_chunk2GKPWQBQcjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkS4O54O4Ccjs.a,methodName:"evmWallet.signMessage",buildContext(e){return{chain:e.chain,address:e.address}}})],o.prototype,"signMessage",1),_chunk2GKPWQBQcjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkS4O54O4Ccjs.a,methodName:"evmWallet.signTypedData",buildContext(e){return{chain:e.chain,address:e.address}}})],o.prototype,"signTypedData",1);var W=o;exports.a = W;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _viem = require('viem');var n=_viem.defineChain.call(void 0, {id:5042002,name:"Arc Testnet",nativeCurrency:{decimals:6,name:"USDC",symbol:"USDC"},rpcUrls:{default:{http:["https://rpc.testnet.arc.network"]}},blockExplorers:{default:{name:"Arc Testnet Explorer",url:"https://testnet.arcscan.app"}},testnet:!0});exports.a = n;
@@ -0,0 +1 @@
1
+ import{a as s}from"./chunk-WTVI4AL4.js";import{b as u}from"./chunk-PKYRYRX4.js";import{r as h}from"./chunk-PSXRNSOE.js";import{a as i}from"./chunk-R3EQXI46.js";import{c as p,g as l}from"./chunk-J3R36SGJ.js";import{isValidStellarAddress as g,WithLoggerContext as y}from"@crossmint/common-sdk-base";var o=class o extends s{constructor(e){super({chain:e.chain,address:e.address,owner:e.owner,options:s.getOptions(e),alias:e.alias,recovery:s.getRecovery(e),signer:e.signer},s.getApiClient(e))}static from(e){if(!g(e.address))throw new Error("Wallet is not a Stellar wallet");return new o(e)}sendTransaction(e){return l(this,null,function*(){var a;i.info("stellarWallet.sendTransaction.start"),yield this.preAuthIfNeeded();let t=yield this.createTransaction(e);if((a=e.options)!=null&&a.prepareOnly)return i.info("stellarWallet.sendTransaction.prepared",{transactionId:t.id}),{hash:void 0,explorerLink:void 0,transactionId:t.id};let n={},r=yield this.approveTransactionAndWait(t.id,n);return i.info("stellarWallet.sendTransaction.success",{transactionId:t.id,hash:r.hash}),r})}createTransaction(e){return l(this,null,function*(){let{contractId:t,options:n}=e,r;(n==null?void 0:n.signer)==null?r=this.requireSigner().locator():typeof n.signer=="string"?r=n.signer:r=`server:${u(n.signer,this.chain,this.apiClient.projectId,this.apiClient.environment).derivedAddress}`;let a;if("transaction"in e)a={type:"serialized-transaction",serializedTransaction:e.transaction,contractId:t};else{let{method:T,memo:d,args:m}=e;a={type:"contract-call",contractId:t,method:T,memo:d!=null?{type:"text",value:d}:void 0,args:m}}let c=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:a,signer:r}});if("error"in c)throw new h(JSON.stringify(c));return c})}};p([y({logger:i,methodName:"stellarWallet.sendTransaction",buildContext(e){return{chain:e.chain,address:e.address}}})],o.prototype,"sendTransaction",1);var f=o;export{f as a};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _viem = require('viem');var r=_viem.defineChain.call(void 0, {id:1514,name:"Story",nativeCurrency:{decimals:18,name:"IP Token",symbol:"IP"},rpcUrls:{default:{http:["https://mainnet.storyrpc.io"]}},testnet:!1});exports.a = r;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkO4FVTK7Xcjs = require('./chunk-O4FVTK7X.cjs');var _chunkS4O54O4Ccjs = require('./chunk-S4O54O4C.cjs');var _chunkU7QSF6P7cjs = require('./chunk-U7QSF6P7.cjs');var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var c=class extends _commonsdkbase.CrossmintApiClient{constructor(e){super(e,{internalConfig:{sdkMetadata:{name:_chunkU7QSF6P7cjs.c,version:_chunkU7QSF6P7cjs.b}}});this.apiPrefix="api/2025-06-09/wallets";this.unstableApiPrefix="api/unstable/wallets"}createWallet(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let s=this.isServerSide?`${this.apiPrefix}`:`${this.apiPrefix}/me`;_chunkS4O54O4Ccjs.a.info("wallets.api.createWallet",{chainType:e.chainType,walletType:e.type});let a=yield(yield this.post(s,{body:JSON.stringify(e),headers:this.headers})).json();return"error"in a?_chunkS4O54O4Ccjs.a.error("wallets.api.createWallet.error",{error:a.error,chainType:e.chainType}):"address"in a&&_chunkS4O54O4Ccjs.a.info("wallets.api.createWallet.success",{address:a.address,chainType:e.chainType}),a})}getWallet(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){_chunkS4O54O4Ccjs.a.info("wallets.api.getWallet",{locator:e});let r=yield(yield this.get(`${this.apiPrefix}/${e}`,{headers:this.headers})).json();return"error"in r?_chunkS4O54O4Ccjs.a.warn("wallets.api.getWallet.error",{locator:e,error:r.error}):"address"in r&&_chunkS4O54O4Ccjs.a.info("wallets.api.getWallet.success",r),r})}createTransaction(e,s){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveTransaction(e,s,r){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions/${s}/approvals`,{body:JSON.stringify(r),headers:this.headers})).json()})}getTransaction(e,s){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions/${s}`,{headers:this.headers})).json()})}createSignature(e,s){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signatures`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveSignature(e,s,r){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signatures/${s}/approvals`,{body:JSON.stringify(r),headers:this.headers})).json()})}getSignature(e,s){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/signatures/${s}`,{headers:this.headers})).json()})}getTransactions(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions`,{headers:this.headers})).json()})}getNfts(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let s=new URLSearchParams;s.append("page",e.page.toString()),s.append("perPage",e.perPage.toString());let r=`${e.chain}:${e.address}`;return(yield this.get(`${this.apiPrefix}/${r}/nfts?${s.toString()}`,{headers:this.headers})).json()})}getTransfers(e,s){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let r=new URLSearchParams;return r.append("chain",s.chain.toString()),r.append("tokens",s.tokens),r.append("status",s.status),(yield this.get(`${this.unstableApiPrefix}/${e}/transfers?${r.toString()}`,{headers:this.headers})).json()})}getBalance(e,s){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let r=new URLSearchParams;return r.append("tokens",s.tokens.join(",")),r.append("chains",s.chains.join(",")),(yield this.get(`${this.apiPrefix}/${e}/balances?${r.toString()}`,{headers:this.headers})).json()})}fundWallet(e,s){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){if(this.environment===_commonsdkbase.APIKeyEnvironmentPrefix.PRODUCTION)throw new Error("Funding wallets is only supported in staging environment");return(yield this.post(`api/v1-alpha2/wallets/${e}/balances`,{body:JSON.stringify(s),headers:this.headers})).json()})}registerSigner(e,s){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signers`,{body:JSON.stringify(s),headers:this.headers})).json()})}getSigner(e,s){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/signers/${s}`,{headers:this.headers})).json()})}send(e,s,r){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){_chunkS4O54O4Ccjs.a.info("wallets.api.send",{walletLocator:e,tokenLocator:s,recipient:r.recipient});let i=yield(yield this.post(`${this.apiPrefix}/${e}/tokens/${s}/transfers`,{body:JSON.stringify(r),headers:this.headers})).json();return"error"in i?_chunkS4O54O4Ccjs.a.error("wallets.api.send.error",{walletLocator:e,tokenLocator:s,error:i.error}):"id"in i&&_chunkS4O54O4Ccjs.a.info("wallets.api.send.success",{walletLocator:e,transactionId:i.id}),i})}get isServerSide(){return this.parsedAPIKey.usageOrigin===_commonsdkbase.APIKeyUsageOrigin.SERVER}get environment(){if(!this.parsedAPIKey.isValid)throw new (0, _chunkO4FVTK7Xcjs.a)("Invalid API key");return this.parsedAPIKey.environment}get projectId(){if(!this.parsedAPIKey.isValid)throw new (0, _chunkO4FVTK7Xcjs.a)("Invalid API key");return this.parsedAPIKey.projectId}get headers(){return{"Content-Type":"application/json"}}};exports.a = c;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var s=[{status:400,message:"Bad Request"},{status:401,message:"Unauthorized"},{status:403,message:"Forbidden"},{status:404,message:"Not Found"},{status:429,message:"Rate limit exceeded"},{status:500,message:"Internal server error"},{status:502,message:"Bad Gateway"},{status:503,message:"Service Unavailable"}],a= exports.b ={evmSmart:"me:evm:smart",evmMpc:"me:evm:mpc",solanaSmart:"me:solana:smart",solanaAddress:"9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",evmAddress:"0x1234567890123456789012345678901234567890",evmAddressWithSpecialChars:"0xABCDEFabcdef0123456789ABCDEFabcdef012345"},t= exports.c ={eth:"base-sepolia:eth",usdc:"base-sepolia:usdc",sol:"solana:sol",customContract:"base-sepolia:0x1234567890123456789012345678901234567890",tokenWithSpecialChars:"base-sepolia:0xABCDEFabcdef0123456789ABCDEFabcdef012345"},E= exports.d =3e4,o= exports.e =6e4,T= exports.f =12e4,_= exports.g =200,A= exports.h =500,c= exports.i =1e3,r= exports.j =2e3,S= exports.k ={EVM_ADMIN_SIGNER:"0xe5E91D9b21C3563011cc332B050150fb9211bBEB",SOLANA_ADMIN_SIGNER:"CsHuaddA9J8j9vSTdL9wpvBsyjYe4F7iQQLuPg3EUqsU",EVM_RECIPIENT:"0xDF8b5F9c19E187f1Ea00730a1e46180152244315",EVM_NON_EXISTENT:"0x0000000000000000000000000000000000000000",EVM_TEST:"0xabcdefabcdefabcdefabcdefabcdefabcdefabcd"},L= exports.l ={FUNDING_AMOUNT_SMALL:1,FUNDING_AMOUNT_LARGE:10,SEND_AMOUNT_SMALL:"0.0001",SEND_AMOUNT_VERY_SMALL:"0.000000000000000001",SEND_AMOUNT_ZERO:"0",SEND_AMOUNT_INVALID:"999999999999999999.0",SEND_AMOUNT_EXTREME:"999999999999999999999999999999.999999999999999999",LONG_STRING_LENGTH:1e4,CONCURRENT_REQUESTS:3,RAPID_SEQUENTIAL_COUNT:3,RATE_LIMIT_BATCH_SIZE:5,RATE_LIMIT_BATCHES:3,RATE_LIMIT_RAPID_COUNT:20,RATE_LIMIT_STRESS_COUNT:50,APPROVE_TRANSACTION_MAX_RETRIES:10},N= exports.m ="ck_development_A61UZQnvjSQcM5qVBaBactgqebxafWAVsNdD2xLkgBxoYuH5q2guM8r9DUmZQzE1WYyoByGVYpEG2o9gVSzAZFsrLbfKGERUJ6D5CW6S9AsJGAc3ctgrsD4n2ioekzGj7KPbLwT3SysDjMamYXLxEroUbQSdwf6aLF4zeEpECq2crkTUQeLFzxzmjWNxFDHFYefDrfrFPCURvBXJLf5pCxCQ";exports.a = s; exports.b = a; exports.c = t; exports.d = E; exports.e = o; exports.f = T; exports.g = _; exports.h = A; exports.i = c; exports.j = r; exports.k = S; exports.l = L; exports.m = N;
@@ -0,0 +1 @@
1
+ var m=Object.defineProperty,p=Object.defineProperties,q=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyDescriptors;var k=Object.getOwnPropertySymbols;var s=Object.prototype.hasOwnProperty,t=Object.prototype.propertyIsEnumerable;var n=b=>{throw TypeError(b)};var l=(b,a,c)=>a in b?m(b,a,{enumerable:!0,configurable:!0,writable:!0,value:c}):b[a]=c,u=(b,a)=>{for(var c in a||(a={}))s.call(a,c)&&l(b,c,a[c]);if(k)for(var c of k(a))t.call(a,c)&&l(b,c,a[c]);return b},v=(b,a)=>p(b,r(a));var w=(b,a,c,e)=>{for(var d=e>1?void 0:e?q(a,c):a,g=b.length-1,h;g>=0;g--)(h=b[g])&&(d=(e?h(a,c,d):h(d))||d);return e&&d&&m(a,c,d),d};var o=(b,a,c)=>a.has(b)||n("Cannot "+c);var x=(b,a,c)=>(o(b,a,"read from private field"),c?c.call(b):a.get(b)),y=(b,a,c)=>a.has(b)?n("Cannot add the same private member more than once"):a instanceof WeakSet?a.add(b):a.set(b,c),z=(b,a,c,e)=>(o(b,a,"write to private field"),e?e.call(b,c):a.set(b,c),c);var A=(b,a,c)=>new Promise((e,d)=>{var g=f=>{try{i(c.next(f))}catch(j){d(j)}},h=f=>{try{i(c.throw(f))}catch(j){d(j)}},i=f=>f.done?e(f.value):Promise.resolve(f.value).then(g,h);i((c=c.apply(b,a)).next())});export{u as a,v as b,w as c,x as d,y as e,z as f,A as g};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var _clientsdkwindow = require('@crossmint/client-sdk-window');var _clientsigners = require('@crossmint/client-signers');var r=class{constructor(e){this.config=e;this.handshakeParent=null}initialize(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){if(this.handshakeParent)return this.handshakeParent;console.info("Initializing signers frame for the first time");let e=Date.now(),n=new URL(_clientsigners.environmentUrlConfig[this.config.environment]);n.searchParams.set("targetOrigin",window.location.origin);let t=yield this.createInvisibleIFrame(n.toString());return this.handshakeParent=yield _clientsdkwindow.IFrameWindow.init(t,{targetOrigin:n.origin,incomingEvents:_clientsigners.signerOutboundEvents,outgoingEvents:_clientsigners.signerInboundEvents,handshakeOptions:{timeoutMs:3e4,intervalMs:100}},_clientsdkwindow.SignersWindowTransport),yield this.handshakeParent.handshakeWithChild(),console.info(`Signers frame initialized in ${Date.now()-e}ms`),this.handshakeParent})}createInvisibleIFrame(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let n=document.createElement("iframe");return n.src=e,Object.assign(n.style,{position:"absolute",opacity:"0",pointerEvents:"none",width:"0",height:"0",border:"none",top:"-9999px",left:"-9999px"}),new Promise((t,o)=>{n.onload=()=>t(n),n.onerror=()=>o(new Error("Failed to load iframe content")),document.body.appendChild(n)})})}};exports.a = r;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkSTYSP6KLcjs = require('./chunk-STYSP6KL.cjs');var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var s=e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunk2GKPWQBQcjs.a.call(void 0, {url:"/v1-alpha2/wallets/{walletLocator}/balances"},e))},i= exports.b =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {url:"/v1-alpha2/wallets/{walletLocator}/balances"},e),{headers:_chunk2GKPWQBQcjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},C= exports.c =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {url:"/unstable/wallets/me{walletType}/tokens/{tokenLocator}/transfers"},e),{headers:_chunk2GKPWQBQcjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},c= exports.d =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunk2GKPWQBQcjs.a.call(void 0, {url:"/unstable/wallets/me{walletLocator}/transfers"},e))},p= exports.e =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunk2GKPWQBQcjs.a.call(void 0, {url:"/unstable/wallets/{walletLocator}/transfers"},e))},T= exports.f =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {url:"/unstable/wallets/{walletLocator}/tokens/{tokenLocator}/transfers"},e),{headers:_chunk2GKPWQBQcjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},W= exports.g =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunk2GKPWQBQcjs.a.call(void 0, {url:"/unstable/wallets/{walletLocator}/balances"},e))},u= exports.h =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {url:"/2025-06-09/wallets/me{walletLocator}/transactions/{transactionId}/approvals"},e),{headers:_chunk2GKPWQBQcjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},w= exports.i =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunk2GKPWQBQcjs.a.call(void 0, {url:"/2025-06-09/wallets/me{walletLocator}/transactions/{transactionId}"},e))},V= exports.j =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunk2GKPWQBQcjs.a.call(void 0, {url:"/2025-06-09/wallets/me{walletLocator}/transactions"},e))},h= exports.k =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {url:"/2025-06-09/wallets/me{walletLocator}/transactions"},e),{headers:_chunk2GKPWQBQcjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},E= exports.l =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {url:"/2025-06-09/wallets/me{walletLocator}/tokens/{tokenLocator}/transfers"},e),{headers:_chunk2GKPWQBQcjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},d= exports.m =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunk2GKPWQBQcjs.a.call(void 0, {url:"/2025-06-09/wallets/me{walletLocator}/signers/{signer}"},e))},S= exports.n =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {url:"/2025-06-09/wallets/me{walletLocator}/signers"},e),{headers:_chunk2GKPWQBQcjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},g= exports.o =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {url:"/2025-06-09/wallets/me{walletLocator}/signatures/{signatureId}/approvals"},e),{headers:_chunk2GKPWQBQcjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},O= exports.p =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunk2GKPWQBQcjs.a.call(void 0, {url:"/2025-06-09/wallets/me{walletLocator}/signatures/{signatureId}"},e))},G= exports.q =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunk2GKPWQBQcjs.a.call(void 0, {url:"/2025-06-09/wallets/me{walletLocator}/signatures"},e))},D= exports.r =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {url:"/2025-06-09/wallets/me{walletLocator}/signatures"},e),{headers:_chunk2GKPWQBQcjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},b= exports.s =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunk2GKPWQBQcjs.a.call(void 0, {url:"/2025-06-09/wallets/me{walletLocator}"},e))},M= exports.t =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {url:"/2025-06-09/wallets/me"},e),{headers:_chunk2GKPWQBQcjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},R= exports.u =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/transactions/{transactionId}/approvals"},e),{headers:_chunk2GKPWQBQcjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},x= exports.v =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunk2GKPWQBQcjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/transactions/{transactionId}"},e))},L= exports.w =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunk2GKPWQBQcjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/transactions"},e))},k= exports.x =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/transactions"},e),{headers:_chunk2GKPWQBQcjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},A= exports.y =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunk2GKPWQBQcjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/tokens/{tokenLocator}/transfers/{transactionId}"},e))},v= exports.z =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/tokens/{tokenLocator}/transfers"},e),{headers:_chunk2GKPWQBQcjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},y= exports.A =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunk2GKPWQBQcjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/signers/{signer}"},e))},f= exports.B =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/signers"},e),{headers:_chunk2GKPWQBQcjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},B= exports.C =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/signatures/{signatureId}/approvals"},e),{headers:_chunk2GKPWQBQcjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},m= exports.D =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunk2GKPWQBQcjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/signatures/{signatureId}"},e))},F= exports.E =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunk2GKPWQBQcjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/signatures"},e))},U= exports.F =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/signatures"},e),{headers:_chunk2GKPWQBQcjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},j= exports.G =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunk2GKPWQBQcjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/balances"},e))},q= exports.H =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunk2GKPWQBQcjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}"},e))},I= exports.I =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {url:"/2025-06-09/wallets"},e),{headers:_chunk2GKPWQBQcjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))};exports.a = s; exports.b = i; exports.c = C; exports.d = c; exports.e = p; exports.f = T; exports.g = W; exports.h = u; exports.i = w; exports.j = V; exports.k = h; exports.l = E; exports.m = d; exports.n = S; exports.o = g; exports.p = O; exports.q = G; exports.r = D; exports.s = b; exports.t = M; exports.u = R; exports.v = x; exports.w = L; exports.x = k; exports.y = A; exports.z = v; exports.A = y; exports.B = f; exports.C = B; exports.D = m; exports.E = F; exports.F = U; exports.G = j; exports.H = q; exports.I = I;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var n=class{constructor(t){this.config=t;this.type="api-key"}locator(){return this.config.locator}signMessage(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return yield Promise.reject(new Error("API key signers do not support direct message signing - signatures are handled automatically by the backend"))})}signTransaction(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return yield Promise.reject(new Error("API key signers do not support direct transaction signing - transaction are handled automatically by the backend"))})}};exports.a = n;
@@ -0,0 +1 @@
1
+ import{a as r}from"./chunk-WTVI4AL4.js";import{b as T}from"./chunk-PKYRYRX4.js";import{a as g}from"./chunk-WYMBO52A.js";import{r as f}from"./chunk-PSXRNSOE.js";import{a}from"./chunk-R3EQXI46.js";import{c as u,g as c}from"./chunk-J3R36SGJ.js";import m from"bs58";import{isValidSolanaAddress as y,WithLoggerContext as C}from"@crossmint/common-sdk-base";var o=class o extends r{constructor(n){super({chain:n.chain,address:n.address,owner:n.owner,options:r.getOptions(n),alias:n.alias,recovery:r.getRecovery(n),signer:n.signer},r.getApiClient(n))}static from(n){if(!y(n.address))throw new Error("Wallet is not a Solana wallet");return new o(n)}sendTransaction(n){return c(this,null,function*(){var d,p;a.info("solanaWallet.sendTransaction.start"),yield this.preAuthIfNeeded();let e=yield this.createTransaction(n);if((d=n.options)!=null&&d.prepareOnly)return a.info("solanaWallet.sendTransaction.prepared",{transactionId:e.id}),{hash:void 0,explorerLink:void 0,transactionId:e.id};let i={additionalSigners:(p=n.additionalSigners)==null?void 0:p.map(l=>new g({type:"external-wallet",address:l.publicKey.toString(),locator:`external-wallet:${l.publicKey.toString()}`,onSign:h=>(h.sign([l]),Promise.resolve(h))}))},t=yield this.approveTransactionAndWait(e.id,i);return a.info("solanaWallet.sendTransaction.success",{transactionId:e.id,hash:t.hash}),t})}createTransaction(n){return c(this,null,function*(){var t;let e;((t=n.options)==null?void 0:t.signer)==null?e=this.requireSigner().locator():typeof n.options.signer=="string"?e=n.options.signer:e=`server:${T(n.options.signer,this.chain,this.apiClient.projectId,this.apiClient.environment).derivedAddress}`;let s;"serializedTransaction"in n?s=n.serializedTransaction:s=m.encode(n.transaction.serialize());let i=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:s,signer:e}});if("error"in i)throw new f(JSON.stringify(i));return i})}};u([C({logger:a,methodName:"solanaWallet.sendTransaction",buildContext(n){return{chain:n.chain,address:n.address}}})],o.prototype,"sendTransaction",1);var S=o;export{S as a};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkUE3WVHTMcjs = require('./chunk-UE3WVHTM.cjs');var _chunk5X4EOJFGcjs = require('./chunk-5X4EOJFG.cjs');var _chunkHRUMWG2Fcjs = require('./chunk-HRUMWG2F.cjs');var _chunkIR5WN6FQcjs = require('./chunk-IR5WN6FQ.cjs');var _chunkGEY574THcjs = require('./chunk-GEY574TH.cjs');var _chunkO4FVTK7Xcjs = require('./chunk-O4FVTK7X.cjs');var _chunkS4O54O4Ccjs = require('./chunk-S4O54O4C.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var _chains = require('viem/chains');var v=[_commonsdkbase.BlockchainIncludingTestnet.ABSTRACT_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.ARBITRUM_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.BASE_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.CURTIS,_commonsdkbase.BlockchainIncludingTestnet.ETHEREUM_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.FLOW_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.MANTLE_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.MODE_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.OPTIMISM_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.PLUME_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.POLYGON_AMOY,_commonsdkbase.BlockchainIncludingTestnet.SCROLL_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.SEI_ATLANTIC_2_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.STORY_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.WORLD_CHAIN_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.ZORA_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.ARC_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.TEMPO_TESTNET],H=[_commonsdkbase.BlockchainIncludingTestnet.ABSTRACT,_commonsdkbase.BlockchainIncludingTestnet.APECHAIN,_commonsdkbase.BlockchainIncludingTestnet.ARBITRUM,_commonsdkbase.BlockchainIncludingTestnet.ARBITRUMNOVA,_commonsdkbase.BlockchainIncludingTestnet.BASE,_commonsdkbase.BlockchainIncludingTestnet.BSC,_commonsdkbase.BlockchainIncludingTestnet.FLOW,_commonsdkbase.BlockchainIncludingTestnet.MANTLE,_commonsdkbase.BlockchainIncludingTestnet.MODE,_commonsdkbase.BlockchainIncludingTestnet.OPTIMISM,_commonsdkbase.BlockchainIncludingTestnet.PLUME,_commonsdkbase.BlockchainIncludingTestnet.POLYGON,_commonsdkbase.BlockchainIncludingTestnet.SCROLL,_commonsdkbase.BlockchainIncludingTestnet.SEI_PACIFIC_1,_commonsdkbase.BlockchainIncludingTestnet.SHAPE,_commonsdkbase.BlockchainIncludingTestnet.STORY,_commonsdkbase.BlockchainIncludingTestnet.TEMPO,_commonsdkbase.BlockchainIncludingTestnet.WORLDCHAIN,_commonsdkbase.BlockchainIncludingTestnet.ZORA];function j(t){switch(t){case _commonsdkbase.BlockchainIncludingTestnet.BASE_SEPOLIA:return _chains.baseSepolia;case _commonsdkbase.BlockchainIncludingTestnet.BASE:return _chains.base;case _commonsdkbase.BlockchainIncludingTestnet.POLYGON_AMOY:return _chains.polygonAmoy;case _commonsdkbase.BlockchainIncludingTestnet.POLYGON:return _chains.polygon;case _commonsdkbase.BlockchainIncludingTestnet.OPTIMISM_SEPOLIA:return _chains.optimismSepolia;case _commonsdkbase.BlockchainIncludingTestnet.OPTIMISM:return _chains.optimism;case _commonsdkbase.BlockchainIncludingTestnet.ARBITRUM_SEPOLIA:return _chains.arbitrumSepolia;case _commonsdkbase.BlockchainIncludingTestnet.ARBITRUM:return _chains.arbitrum;case _commonsdkbase.BlockchainIncludingTestnet.ARBITRUMNOVA:return _chains.arbitrumNova;case _commonsdkbase.BlockchainIncludingTestnet.STORY_TESTNET:return _chunkGEY574THcjs.a;case _commonsdkbase.BlockchainIncludingTestnet.STORY:return _chunkIR5WN6FQcjs.a;case _commonsdkbase.BlockchainIncludingTestnet.MODE_SEPOLIA:return _chains.modeTestnet;case _commonsdkbase.BlockchainIncludingTestnet.MODE:return _chains.mode;case _commonsdkbase.BlockchainIncludingTestnet.BSC:return _chains.bsc;case _commonsdkbase.BlockchainIncludingTestnet.SHAPE:return _chains.shape;case _commonsdkbase.BlockchainIncludingTestnet.ZORA:return _chains.zora;case _commonsdkbase.BlockchainIncludingTestnet.ZORA_SEPOLIA:return _chains.zoraSepolia;case _commonsdkbase.BlockchainIncludingTestnet.ETHEREUM_SEPOLIA:return _chains.sepolia;case _commonsdkbase.BlockchainIncludingTestnet.FLOW:return _chains.flowMainnet;case _commonsdkbase.BlockchainIncludingTestnet.FLOW_TESTNET:return _chains.flowTestnet;case _commonsdkbase.BlockchainIncludingTestnet.PLUME_TESTNET:return _chains.plumeTestnet;case _commonsdkbase.BlockchainIncludingTestnet.PLUME:return _chains.plume;case _commonsdkbase.BlockchainIncludingTestnet.ARC_TESTNET:return _chunkHRUMWG2Fcjs.a;case _commonsdkbase.BlockchainIncludingTestnet.TEMPO:return _chunkUE3WVHTMcjs.a;case _commonsdkbase.BlockchainIncludingTestnet.TEMPO_TESTNET:return _chunk5X4EOJFGcjs.a;case _commonsdkbase.BlockchainIncludingTestnet.ABSTRACT:case _commonsdkbase.BlockchainIncludingTestnet.ABSTRACT_TESTNET:case _commonsdkbase.BlockchainIncludingTestnet.APECHAIN:case _commonsdkbase.BlockchainIncludingTestnet.MANTLE:case _commonsdkbase.BlockchainIncludingTestnet.MANTLE_SEPOLIA:case _commonsdkbase.BlockchainIncludingTestnet.SCROLL:case _commonsdkbase.BlockchainIncludingTestnet.SCROLL_SEPOLIA:case _commonsdkbase.BlockchainIncludingTestnet.SEI_PACIFIC_1:case _commonsdkbase.BlockchainIncludingTestnet.SEI_ATLANTIC_2_TESTNET:case _commonsdkbase.BlockchainIncludingTestnet.CURTIS:case _commonsdkbase.BlockchainIncludingTestnet.WORLDCHAIN:case _commonsdkbase.BlockchainIncludingTestnet.WORLD_CHAIN_SEPOLIA:throw new Error(`Chain ${t} is not yet supported in toViemChain function. Please add the appropriate viem chain definition.`);default:throw new Error(`Unknown chain: ${t}`)}}function x(t){return v.includes(t)}function D(t){return H.includes(t)}var Y={[_commonsdkbase.BlockchainIncludingTestnet.ABSTRACT]:_commonsdkbase.BlockchainIncludingTestnet.ABSTRACT_TESTNET,[_commonsdkbase.BlockchainIncludingTestnet.APECHAIN]:_commonsdkbase.BlockchainIncludingTestnet.CURTIS,[_commonsdkbase.BlockchainIncludingTestnet.ARBITRUM]:_commonsdkbase.BlockchainIncludingTestnet.ARBITRUM_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.BASE]:_commonsdkbase.BlockchainIncludingTestnet.BASE_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.FLOW]:_commonsdkbase.BlockchainIncludingTestnet.FLOW_TESTNET,[_commonsdkbase.BlockchainIncludingTestnet.MANTLE]:_commonsdkbase.BlockchainIncludingTestnet.MANTLE_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.MODE]:_commonsdkbase.BlockchainIncludingTestnet.MODE_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.OPTIMISM]:_commonsdkbase.BlockchainIncludingTestnet.OPTIMISM_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.PLUME]:_commonsdkbase.BlockchainIncludingTestnet.PLUME_TESTNET,[_commonsdkbase.BlockchainIncludingTestnet.POLYGON]:_commonsdkbase.BlockchainIncludingTestnet.POLYGON_AMOY,[_commonsdkbase.BlockchainIncludingTestnet.SCROLL]:_commonsdkbase.BlockchainIncludingTestnet.SCROLL_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.SEI_PACIFIC_1]:_commonsdkbase.BlockchainIncludingTestnet.SEI_ATLANTIC_2_TESTNET,[_commonsdkbase.BlockchainIncludingTestnet.STORY]:_commonsdkbase.BlockchainIncludingTestnet.STORY_TESTNET,[_commonsdkbase.BlockchainIncludingTestnet.WORLDCHAIN]:_commonsdkbase.BlockchainIncludingTestnet.WORLD_CHAIN_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.ZORA]:_commonsdkbase.BlockchainIncludingTestnet.ZORA_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.TEMPO]:_commonsdkbase.BlockchainIncludingTestnet.TEMPO_TESTNET};function b(t){return Y[t]}function J(t,a){if(t==="solana"||t==="stellar")return t;let r=t,T=a===_commonsdkbase.APIKeyEnvironmentPrefix.PRODUCTION;if(T&&x(r))throw new (0, _chunkO4FVTK7Xcjs.b)(`Chain "${t}" is a testnet chain and cannot be used in production. Please use a mainnet chain instead.`);if(!T&&D(r)){let n=b(r);if(n!=null)return _chunkS4O54O4Ccjs.a.debug("validateChainForEnvironment.autoConverted",{chain:t,convertedTo:n,environment:a,message:`Chain "${t}" is a mainnet chain and cannot be used in ${a} environment. Automatically converted to "${n}".`}),n;_chunkS4O54O4Ccjs.a.debug("validateChainForEnvironment.mismatch",{chain:t,environment:a,message:`Chain "${t}" is a mainnet chain and should not be used in ${a} environment. No testnet equivalent is available. Please use a testnet chain instead.`})}return t}exports.a = j; exports.b = x; exports.c = D; exports.d = b; exports.e = J;
@@ -0,0 +1 @@
1
+ import{defineChain as t}from"viem";var o=t({id:1514,name:"Story",nativeCurrency:{decimals:18,name:"IP Token",symbol:"IP"},rpcUrls:{default:{http:["https://mainnet.storyrpc.io"]}},testnet:!1});export{o as a};
@@ -0,0 +1 @@
1
+ import{defineChain as e}from"viem";var n=e({id:4217,name:"Tempo",nativeCurrency:void 0,rpcUrls:{default:{http:["https://rpc.tempo.xyz"]}},blockExplorers:{default:{name:"Tempo Explorer",url:"https://explore.mainnet.tempo.xyz"}},testnet:!1});export{n as a};
@@ -0,0 +1 @@
1
+ import{g as i}from"./chunk-J3R36SGJ.js";var n=class{constructor(e,r){this.type="device";this.config=e,this.deviceSignerKeyStorage=r}locator(){return this.config.locator||"device:"}signMessage(e){return i(this,null,function*(){return{signature:yield this.deviceSignerKeyStorage.signMessage(this.config.address,e)}})}signTransaction(e){return i(this,null,function*(){return yield this.signMessage(e)})}};export{n as a};
@@ -0,0 +1 @@
1
+ import{a as S}from"./chunk-G5R6VQGJ.js";import{a as i}from"./chunk-RN77IYDQ.js";import{a as t}from"./chunk-3HLCTEWX.js";import{a as l}from"./chunk-67Z4SJMH.js";import{a as C}from"./chunk-EE4ITUGS.js";import{a as u}from"./chunk-LB4V5KKI.js";import{a as p}from"./chunk-SH7KRBXV.js";import{a as s}from"./chunk-XS5B3TUE.js";import{a as m}from"./chunk-EIHK5TYE.js";import{a as g}from"./chunk-WBIKVPHW.js";import{a as o}from"./chunk-WYMBO52A.js";import{f as a}from"./chunk-PSXRNSOE.js";function V(r,e,n){switch(e.type){case"email":case"phone":return r==="solana"?new t(e):r==="stellar"?new l(e):new i(e);case"api-key":return r==="solana"?new g(e):new p(e);case"external-wallet":return r==="solana"?new o(e):r==="stellar"?new C(e):new s(e);case"server":return S(r,e);case"passkey":return new m(e);case"device":if(n==null)throw new a("Device signer key storage is required for device signers");return new u(e,n)}}export{V as a};
@@ -0,0 +1 @@
1
+ import{g as t}from"./chunk-J3R36SGJ.js";import{Keypair as d,VersionedTransaction as y}from"@solana/web3.js";import r from"bs58";import n from"tweetnacl";var a=class{constructor(e){this.type="server";this.keypair=d.fromSeed(e.derivedKeyBytes),this._address=this.keypair.publicKey.toBase58(),this._locator=e.locator}address(){return this._address}locator(){return this._locator}signMessage(e){return t(this,null,function*(){let s=r.decode(e),i=n.sign.detached(s,this.keypair.secretKey);return{signature:r.encode(i)}})}signTransaction(e){return t(this,null,function*(){let s=r.decode(e),o=y.deserialize(s).message.serialize(),c=n.sign.detached(o,this.keypair.secretKey);return{signature:r.encode(c)}})}};export{a};
@@ -0,0 +1 @@
1
+ import{a as r,b as o}from"./chunk-J3R36SGJ.js";function l(e){switch(e.type){case"passkey":return{type:"passkey",id:e.id,name:e.name,publicKey:e.publicKey,validatorContractVersion:e.validatorContractVersion,locator:e.locator};case"api-key":return{type:"api-key",address:e.address,locator:e.locator};case"external-wallet":return{type:"external-wallet",address:e.address,locator:e.locator};case"email":return{type:"email",email:e.email,address:e.address,locator:e.locator};case"phone":return{type:"phone",phone:e.phone,address:e.address,locator:e.locator};case"device":return{type:"device",publicKey:e.publicKey,locator:e.locator};case"server":return{type:"server",address:e.address,locator:e.locator};default:throw new Error(`Unknown signer type: ${e.type}`)}}function d(e,a){let t=l(e);if(a==="solana"||a==="stellar"){let s="success";return"transaction"in e&&e.transaction!=null&&(s=e.transaction.status),o(r({},t),{status:s})}if("chains"in e&&e.chains!=null&&Object.keys(e.chains).length>0){let s=e.chains[a];return s==null?null:o(r({},t),{status:s.status})}return o(r({},t),{status:"success"})}function u(e,a){let t=o(r({},e),{status:a});return e.locator.indexOf(":")===-1&&(e.type==="api-key"?t.locator=e.locator:(t.locator=`external-wallet:${e.locator}`,t.type="external-wallet")),t}export{l as a,d as b,u as c};
@@ -0,0 +1 @@
1
+ import{a as o}from"./chunk-PSXRNSOE.js";import{a as n}from"./chunk-R3EQXI46.js";import{b as p,c as l}from"./chunk-TYFWX53A.js";import{g as t}from"./chunk-J3R36SGJ.js";import{APIKeyEnvironmentPrefix as h,APIKeyUsageOrigin as d,CrossmintApiClient as g}from"@crossmint/common-sdk-base";var c=class extends g{constructor(e){super(e,{internalConfig:{sdkMetadata:{name:l,version:p}}});this.apiPrefix="api/2025-06-09/wallets";this.unstableApiPrefix="api/unstable/wallets"}createWallet(e){return t(this,null,function*(){let s=this.isServerSide?`${this.apiPrefix}`:`${this.apiPrefix}/me`;n.info("wallets.api.createWallet",{chainType:e.chainType,walletType:e.type});let a=yield(yield this.post(s,{body:JSON.stringify(e),headers:this.headers})).json();return"error"in a?n.error("wallets.api.createWallet.error",{error:a.error,chainType:e.chainType}):"address"in a&&n.info("wallets.api.createWallet.success",{address:a.address,chainType:e.chainType}),a})}getWallet(e){return t(this,null,function*(){n.info("wallets.api.getWallet",{locator:e});let r=yield(yield this.get(`${this.apiPrefix}/${e}`,{headers:this.headers})).json();return"error"in r?n.warn("wallets.api.getWallet.error",{locator:e,error:r.error}):"address"in r&&n.info("wallets.api.getWallet.success",r),r})}createTransaction(e,s){return t(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveTransaction(e,s,r){return t(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions/${s}/approvals`,{body:JSON.stringify(r),headers:this.headers})).json()})}getTransaction(e,s){return t(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions/${s}`,{headers:this.headers})).json()})}createSignature(e,s){return t(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signatures`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveSignature(e,s,r){return t(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signatures/${s}/approvals`,{body:JSON.stringify(r),headers:this.headers})).json()})}getSignature(e,s){return t(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/signatures/${s}`,{headers:this.headers})).json()})}getTransactions(e){return t(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions`,{headers:this.headers})).json()})}getNfts(e){return t(this,null,function*(){let s=new URLSearchParams;s.append("page",e.page.toString()),s.append("perPage",e.perPage.toString());let r=`${e.chain}:${e.address}`;return(yield this.get(`${this.apiPrefix}/${r}/nfts?${s.toString()}`,{headers:this.headers})).json()})}getTransfers(e,s){return t(this,null,function*(){let r=new URLSearchParams;return r.append("chain",s.chain.toString()),r.append("tokens",s.tokens),r.append("status",s.status),(yield this.get(`${this.unstableApiPrefix}/${e}/transfers?${r.toString()}`,{headers:this.headers})).json()})}getBalance(e,s){return t(this,null,function*(){let r=new URLSearchParams;return r.append("tokens",s.tokens.join(",")),r.append("chains",s.chains.join(",")),(yield this.get(`${this.apiPrefix}/${e}/balances?${r.toString()}`,{headers:this.headers})).json()})}fundWallet(e,s){return t(this,null,function*(){if(this.environment===h.PRODUCTION)throw new Error("Funding wallets is only supported in staging environment");return(yield this.post(`api/v1-alpha2/wallets/${e}/balances`,{body:JSON.stringify(s),headers:this.headers})).json()})}registerSigner(e,s){return t(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signers`,{body:JSON.stringify(s),headers:this.headers})).json()})}getSigner(e,s){return t(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/signers/${s}`,{headers:this.headers})).json()})}send(e,s,r){return t(this,null,function*(){n.info("wallets.api.send",{walletLocator:e,tokenLocator:s,recipient:r.recipient});let i=yield(yield this.post(`${this.apiPrefix}/${e}/tokens/${s}/transfers`,{body:JSON.stringify(r),headers:this.headers})).json();return"error"in i?n.error("wallets.api.send.error",{walletLocator:e,tokenLocator:s,error:i.error}):"id"in i&&n.info("wallets.api.send.success",{walletLocator:e,transactionId:i.id}),i})}get isServerSide(){return this.parsedAPIKey.usageOrigin===d.SERVER}get environment(){if(!this.parsedAPIKey.isValid)throw new o("Invalid API key");return this.parsedAPIKey.environment}get projectId(){if(!this.parsedAPIKey.isValid)throw new o("Invalid API key");return this.parsedAPIKey.projectId}get headers(){return{"Content-Type":"application/json"}}};export{c as a};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkYFAJXQAMcjs = require('./chunk-YFAJXQAM.cjs');var _chunkS4O54O4Ccjs = require('./chunk-S4O54O4C.cjs');var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var _ox = require('ox');var _viem = require('viem');var c=class p extends _chunkYFAJXQAMcjs.a{constructor(e){super(e)}signMessage(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let i=_viem.isHex.call(void 0, e)?e:_viem.toHex.call(void 0, e),r=_ox.PersonalMessage.getSignPayload(i);return yield this.sign(r)})}signTransaction(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return yield this.sign(e)})}sign(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var o;yield this.handleAuthRequired();let i=this.getJwtOrThrow(),r=e.replace("0x","");_chunkS4O54O4Ccjs.a.info("sign: sending request",{keyType:"secp256k1"});let y=Date.now(),n=yield(o=this.config.clientTEEConnection)==null?void 0:o.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:i,apiKey:this.config.crossmint.apiKey},data:{keyType:"secp256k1",bytes:r,encoding:"hex"}},options:_chunkYFAJXQAMcjs.b});if(_chunkS4O54O4Ccjs.a.info("sign: response received",{status:n==null?void 0:n.status,durationMs:Date.now()-y}),(n==null?void 0:n.status)==="error")throw new Error(n.error);if((n==null?void 0:n.signature)==null)throw new Error("Failed to sign transaction");return p.verifyPublicKeyFormat(n.publicKey),{signature:n.signature.bytes}})}static verifyPublicKeyFormat(e){if(e==null)throw new Error("No public key found");if(e.encoding!=="hex"||e.keyType!=="secp256k1"||e.bytes==null)throw new Error("Not supported. Expected public key to be in hex encoding and secp256k1 key type. Got: "+JSON.stringify(e))}getChainKeyParams(){return{scheme:"secp256k1",encoding:"hex"}}};exports.a = c;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var n=class{constructor(e,r){this.type="device";this.config=e,this.deviceSignerKeyStorage=r}locator(){return this.config.locator||"device:"}signMessage(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return{signature:yield this.deviceSignerKeyStorage.signMessage(this.config.address,e)}})}signTransaction(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return yield this.signMessage(e)})}};exports.a = n;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var _clientsignerscryptography = require('@crossmint/client-signers-cryptography');function l(c){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let t=yield c.generateKey({}),e=_clientsignerscryptography.decodeBase64.call(void 0, t);if(e.length!==65||e[0]!==4)throw new Error("Invalid uncompressed P-256 public key: expected 65 bytes starting with 0x04");let o=e.slice(1,33),n=e.slice(33,65),s=`0x${_clientsignerscryptography.encodeHex.call(void 0, o)}`,y=`0x${_clientsignerscryptography.encodeHex.call(void 0, n)}`;return{type:"device",publicKey:{x:s,y},locator:`device:${t}`}})}exports.a = l;
@@ -0,0 +1 @@
1
+ import{a as b}from"./chunk-P6MB5P2F.js";import{a as S,b as w}from"./chunk-6OXELDPD.js";import{a as x}from"./chunk-WTVI4AL4.js";import{a as u}from"./chunk-GOXB2RBF.js";import{b as h}from"./chunk-PKYRYRX4.js";import{e as m}from"./chunk-SPVAZXRY.js";import{d as P,f as s}from"./chunk-PSXRNSOE.js";import{a as o}from"./chunk-R3EQXI46.js";import{a as p,b as y,c as f,g as d}from"./chunk-J3R36SGJ.js";import{WithLoggerContext as R}from"@crossmint/common-sdk-base";import{WebAuthnP256 as $}from"ox";var D="When 'signers' is provided to a method that may fetch an existing wallet, each specified signer must exist in that wallet's configuration.",C=class{constructor(t){this.apiClient=t}getWallet(t,e){return d(this,null,function*(){let n,a;if(typeof t=="string"){if(!this.apiClient.isServerSide)throw new s("getWallet with walletLocator is only available on the server side. Use getWallet(args) instead.");if(e==null)throw new s("Wallet configuration is required when using walletLocator: https://docs.crossmint.com/sdk-reference/wallets/type-aliases/WalletArgsFor");n=t,a=e}else{if(this.apiClient.isServerSide)throw new s("getWallet on server side requires a walletLocator parameter. Use getWallet(walletLocator, args) instead.");a=t,n=this.getWalletLocator(a)}let r=y(p({},a),{chain:m(a.chain,this.apiClient.environment)});o.info("walletFactory.getWallet.start");let i=yield this.apiClient.getWallet(n);if("error"in i)throw o.warn("walletFactory.getWallet.notFound",{error:i.error}),new P(JSON.stringify(i));return o.info("walletFactory.getWallet.success",{address:i.address}),yield this.createWalletInstance(i,r)})}createWallet(t){return d(this,null,function*(){var c,l,g,v,W,A,k,F;let e=y(p({},t),{chain:m(t.chain,this.apiClient.environment)});if(yield(g=(l=(c=e.options)==null?void 0:c.callbacks)==null?void 0:l.onWalletCreationStart)==null?void 0:g.call(l),o.info("walletFactory.createWallet.start"),!this.apiClient.isServerSide&&e.owner!=null)throw o.error("walletFactory.createWallet.error",{error:"Owner field cannot be specified in client-side createWallet calls"}),new s("Owner field cannot be specified in client-side createWallet calls. Owner is determined from JWT authentication.");let n=((v=e.options)==null?void 0:v.deviceSignerKeyStorage)!=null?this.ensureDeviceSignerInSigners(e):(W=e.signers)!=null?W:[],a=yield this.registerSigners(n,e.chain,(A=e.options)==null?void 0:A.deviceSignerKeyStorage),r;if(e.recovery.type==="passkey"&&e.recovery.id==null)r=yield this.createPasskeySigner(e.recovery);else if(e.recovery.type==="server"){let{derivedAddress:E}=h(e.recovery,e.chain,this.apiClient.projectId,this.apiClient.environment);r={type:"server",address:E}}else r=e.recovery;let i=yield this.apiClient.createWallet({type:"smart",chainType:this.getChainType(e.chain),config:p(p({adminSigner:r},e.plugins?{plugins:e.plugins}:{}),a!=null?{delegatedSigners:a}:{}),owner:(k=e.owner)!=null?k:void 0,alias:(F=e.alias)!=null?F:void 0});if("error"in i)throw o.error("walletFactory.createWallet.error",{error:i.error}),new s(JSON.stringify(i));return o.info("walletFactory.createWallet.success",{address:i.address}),yield this.createWalletInstance(i,e)})}createWalletInstance(t,e){return this.validateExistingWalletConfig(t,e),new x({chain:e.chain,address:t.address,owner:t.owner,options:e.options,alias:e.alias,recovery:t.config.adminSigner},this.apiClient)}getWalletLocator(t){return`me:${this.getChainType(t.chain)}:smart`+(t.alias!=null?`:alias:${t.alias}`:"")}createPasskeySigner(t){return d(this,null,function*(){var a;if(t.type!=="passkey")throw new Error("Signer is not a passkey");let e=(a=t.name)!=null?a:`Crossmint Wallet ${Date.now()}`,n=t.onCreatePasskey?yield t.onCreatePasskey(e):yield $.createCredential({name:e});return{type:"passkey",id:n.id,name:e,publicKey:{x:n.publicKey.x.toString(),y:n.publicKey.y.toString()}}})}ensureDeviceSignerInSigners(t){var a,r;if(t.chain==="solana")return(a=t.signers)!=null?a:[];let e=(r=t.signers)!=null?r:[];return e.some(i=>i.type==="device")?e:[...e,{type:"device"}]}validateExistingWalletConfig(t,e){if(e.owner!=null&&t.owner!=null&&S(e.owner)!==S(t.owner))throw new s("Wallet owner does not match existing wallet's linked user");if(e.chain==="solana"&&t.chainType!=="solana"||e.chain!=="solana"&&t.chainType==="solana"||e.chain==="stellar"&&t.chainType!=="stellar"||e.chain!=="stellar"&&t.chainType==="stellar")throw new s(`Wallet chain does not match existing wallet's chain. You must use chain: ${t.chainType}.`);if(t.type!=="smart")return;let n=e;if(n.recovery!=null||n.signers!=null){let a=t.config,r=a==null?void 0:a.adminSigner;if(n.recovery!=null&&r!=null){if(n.recovery.type!==r.type)throw new s("The wallet recovery signer type does not match the existing wallet's recovery signer type");w(n.recovery,r)}let i=n.signers;i!=null&&this.validateSigners(t,i,e.chain)}}validateSigners(t,e,n){let a=t.config,r=a==null?void 0:a.delegatedSigners;if(e.length!==0){if(r==null||r.length===0)throw new s(`${e.length} signer(s) specified, but wallet "${t.address}" has no signers. ${D}`);for(let i of e){let c=r.find(l=>{if(this.isMatchingPasskeySigner(i,l,a)||l.type==="device"&&i.type==="device")return!0;if(i.type==="server"){let{derivedAddress:g}=h(i,n,this.apiClient.projectId,this.apiClient.environment);return l.locator===`server:${g}`}return l.locator===u(i)});if(c==null){let l=r.map(g=>g.locator).join(", ");throw new s(`Signer '${i.type}' does not exist in wallet "${t.address}". Available signers: ${l}. ${D}`)}w(i,c)}}}isMatchingPasskeySigner(t,e,n){var r,i;let a=((i=(r=n.delegatedSigners)==null?void 0:r.filter(c=>c.type==="passkey").length)!=null?i:0)+(n.adminSigner.type==="passkey"?1:0);if(t.type==="passkey"){if(t.id==null&&a===1)return e.type==="passkey";if(t.id==null&&a>1)throw new s("When creating a wallet with multiple passkeys, you must provide the passkey ID for each passkey.")}return!1}registerSigners(t,e,n){return d(this,null,function*(){var a;return yield Promise.all((a=t==null?void 0:t.map(r=>d(this,null,function*(){if(r.type==="passkey")return r.id==null?{signer:yield this.createPasskeySigner(r)}:{signer:r};if(r.type==="device"){if(r.locator!=null)return{signer:r.locator};if(n==null)throw new s("Device signer key storage is required for device signers");return{signer:(yield b(n)).locator}}if(r.type==="server"&&e!=null){let{derivedAddress:i}=h(r,e,this.apiClient.projectId,this.apiClient.environment);return{signer:`server:${i}`}}return{signer:u(r)}})))!=null?a:[])})}getChainType(t){return t==="solana"?"solana":t==="stellar"?"stellar":"evm"}};f([R({logger:o,methodName:"walletFactory.getWallet",buildContext(t,e){return typeof e[0]=="string"?{walletLocator:e[0],args:e[1]}:{args:e[0]}}})],C.prototype,"getWallet",1),f([R({logger:o,methodName:"walletFactory.createWallet",buildContext(t,e){return{chain:e[0].chain}}})],C.prototype,"createWallet",1);export{C as a};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});function a(e){return e.type==="external-wallet"?`external-wallet:${e.address}`:e.type==="email"&&e.email?`email:${e.email}`:e.type==="phone"&&e.phone?`phone:${e.phone}`:e.type==="passkey"&&"id"in e?`passkey:${e.id}`:e.type==="api-key"?"api-key":e.type==="device"?"locator"in e&&e.locator!=null?e.locator:"device:":e.type}function i(e){let t=e.indexOf(":");return t===-1?{type:e,value:""}:{type:e.substring(0,t),value:e.substring(t+1)}}exports.a = a; exports.b = i;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _commonsdkbase = require('@crossmint/common-sdk-base');var o=class extends _commonsdkbase.CrossmintSDKError{constructor(s,r){super(s,_commonsdkbase.WalletErrorCode.API_KEY_INVALID,r)}},c= exports.b =class extends _commonsdkbase.CrossmintSDKError{constructor(s,r){super(s,_commonsdkbase.WalletErrorCode.ENVIRONMENT_INVALID,r)}},p= exports.c =class extends _commonsdkbase.CrossmintSDKError{constructor(s,r){super(s,_commonsdkbase.WalletErrorCode.WALLET_TYPE_INVALID,r)}},i= exports.d =class extends _commonsdkbase.CrossmintSDKError{constructor(s,r){super(s,_commonsdkbase.WalletErrorCode.WALLET_NOT_AVAILABLE,r)}},A= exports.e =class extends _commonsdkbase.CrossmintSDKError{constructor(s,r){super(s,_commonsdkbase.WalletErrorCode.WALLET_NOT_AVAILABLE,r)}},I= exports.f =class extends _commonsdkbase.CrossmintSDKError{constructor(s,r){super(s,_commonsdkbase.WalletErrorCode.WALLET_CREATION_FAILED,r)}},x= exports.g =class extends _commonsdkbase.CrossmintSDKError{constructor(s,r){super(s,_commonsdkbase.WalletErrorCode.WALLET_TYPE_INVALID,r)}},g= exports.h =class extends _commonsdkbase.CrossmintSDKError{constructor(s,r){super(s,_commonsdkbase.WalletErrorCode.SIGNER_INVALID,r)}},u= exports.i =class extends _commonsdkbase.CrossmintSDKError{constructor(s,r){super(s,_commonsdkbase.WalletErrorCode.SIGNER_INVALID,r)}},N= exports.j =class extends _commonsdkbase.CrossmintSDKError{constructor(s,r){super(s,_commonsdkbase.WalletErrorCode.MESSAGE_INVALID,r)}},E= exports.k =class extends _commonsdkbase.CrossmintSDKError{constructor(s,r){super(s,_commonsdkbase.WalletErrorCode.MESSAGE_INVALID,r)}},L= exports.l =class extends _commonsdkbase.CrossmintSDKError{constructor(s,r){super(s,_commonsdkbase.WalletErrorCode.SIGNING_FAILED,r)}},_= exports.m =class extends _commonsdkbase.CrossmintSDKError{constructor(s,r){super(s,_commonsdkbase.WalletErrorCode.SIGNING_FAILED,r)}},l= exports.n =class extends _commonsdkbase.CrossmintSDKError{constructor(s,r){super(s,_commonsdkbase.WalletErrorCode.SIGNING_FAILED,r)}},T= exports.o =class extends _commonsdkbase.CrossmintSDKError{constructor(s,r){super(s,_commonsdkbase.WalletErrorCode.NO_SIGNATURE,r)}},a= exports.p =class extends _commonsdkbase.CrossmintSDKError{constructor(s,r){super(s,_commonsdkbase.WalletErrorCode.NO_SIGNATURE,r)}},d= exports.q =class extends _commonsdkbase.CrossmintSDKError{constructor(s,r){super(s,_commonsdkbase.WalletErrorCode.SIGNING_FAILED,r)}},S= exports.r =class extends _commonsdkbase.CrossmintSDKError{constructor(s,r){super(s,_commonsdkbase.WalletErrorCode.NO_TRANSACTION,r)}},D= exports.s =class extends _commonsdkbase.CrossmintSDKError{constructor(s,r){super(s,_commonsdkbase.WalletErrorCode.NO_TRANSACTION,r)}},O= exports.t =class extends _commonsdkbase.CrossmintSDKError{constructor(s,r){super(s,_commonsdkbase.WalletErrorCode.TRANSACTION_FAILED,r)}},G= exports.u =class extends _commonsdkbase.CrossmintSDKError{constructor(s,r){super(s,_commonsdkbase.WalletErrorCode.TRANSACTION_FAILED,r)}},R= exports.v =class extends _commonsdkbase.CrossmintSDKError{constructor(s,r){super(s,_commonsdkbase.WalletErrorCode.TRANSACTION_FAILED,r)}},C= exports.w =class extends _commonsdkbase.CrossmintSDKError{constructor(s,r){super(s,_commonsdkbase.WalletErrorCode.TRANSACTION_FAILED,r)}},F= exports.x =class extends _commonsdkbase.CrossmintSDKError{constructor(s,r){super(s,_commonsdkbase.WalletErrorCode.TRANSACTION_FAILED,r)}},V= exports.y =class extends _commonsdkbase.CrossmintSDKError{constructor(s,r){super(s,_commonsdkbase.WalletErrorCode.TRANSACTION_FAILED,r)}};exports.a = o; exports.b = c; exports.c = p; exports.d = i; exports.e = A; exports.f = I; exports.g = x; exports.h = g; exports.i = u; exports.j = N; exports.k = E; exports.l = L; exports.m = _; exports.n = l; exports.o = T; exports.p = a; exports.q = d; exports.r = S; exports.s = D; exports.t = O; exports.u = G; exports.v = R; exports.w = C; exports.x = F; exports.y = V;
@@ -0,0 +1 @@
1
+ import{g as i}from"./chunk-J3R36SGJ.js";import{IFrameWindow as a,SignersWindowTransport as s}from"@crossmint/client-sdk-window";import{environmentUrlConfig as m,signerInboundEvents as h,signerOutboundEvents as d}from"@crossmint/client-signers";var r=class{constructor(e){this.config=e;this.handshakeParent=null}initialize(){return i(this,null,function*(){if(this.handshakeParent)return this.handshakeParent;console.info("Initializing signers frame for the first time");let e=Date.now(),n=new URL(m[this.config.environment]);n.searchParams.set("targetOrigin",window.location.origin);let t=yield this.createInvisibleIFrame(n.toString());return this.handshakeParent=yield a.init(t,{targetOrigin:n.origin,incomingEvents:d,outgoingEvents:h,handshakeOptions:{timeoutMs:3e4,intervalMs:100}},s),yield this.handshakeParent.handshakeWithChild(),console.info(`Signers frame initialized in ${Date.now()-e}ms`),this.handshakeParent})}createInvisibleIFrame(e){return i(this,null,function*(){let n=document.createElement("iframe");return n.src=e,Object.assign(n.style,{position:"absolute",opacity:"0",pointerEvents:"none",width:"0",height:"0",border:"none",top:"-9999px",left:"-9999px"}),new Promise((t,o)=>{n.onload=()=>t(n),n.onerror=()=>o(new Error("Failed to load iframe content")),document.body.appendChild(n)})})}};export{r as a};
@@ -0,0 +1 @@
1
+ function r(a){return a==="solana"?"solana":a==="stellar"?"stellar":"evm"}export{r as a};
@@ -0,0 +1 @@
1
+ import{g as i}from"./chunk-J3R36SGJ.js";import{decodeBase64 as p,encodeHex as r}from"@crossmint/client-signers-cryptography";function v(c){return i(this,null,function*(){let t=yield c.generateKey({}),e=p(t);if(e.length!==65||e[0]!==4)throw new Error("Invalid uncompressed P-256 public key: expected 65 bytes starting with 0x04");let o=e.slice(1,33),n=e.slice(33,65),s=`0x${r(o)}`,y=`0x${r(n)}`;return{type:"device",publicKey:{x:s,y},locator:`device:${t}`}})}export{v as a};
@@ -0,0 +1 @@
1
+ import{a as l}from"./chunk-5M7IRODB.js";import{a as t,b as o}from"./chunk-J3R36SGJ.js";var i=e=>{var r;return((r=e.client)!=null?r:l).get(t({url:"/v1-alpha2/wallets/{walletLocator}/balances"},e))},C=e=>{var r;return((r=e.client)!=null?r:l).post(o(t({url:"/v1-alpha2/wallets/{walletLocator}/balances"},e),{headers:t({"Content-Type":"application/json"},e.headers)}))},c=e=>{var r;return((r=e.client)!=null?r:l).post(o(t({url:"/unstable/wallets/me{walletType}/tokens/{tokenLocator}/transfers"},e),{headers:t({"Content-Type":"application/json"},e.headers)}))},p=e=>{var r;return((r=e.client)!=null?r:l).get(t({url:"/unstable/wallets/me{walletLocator}/transfers"},e))},T=e=>{var r;return((r=e.client)!=null?r:l).get(t({url:"/unstable/wallets/{walletLocator}/transfers"},e))},W=e=>{var r;return((r=e.client)!=null?r:l).post(o(t({url:"/unstable/wallets/{walletLocator}/tokens/{tokenLocator}/transfers"},e),{headers:t({"Content-Type":"application/json"},e.headers)}))},u=e=>{var r;return((r=e.client)!=null?r:l).get(t({url:"/unstable/wallets/{walletLocator}/balances"},e))},w=e=>{var r;return((r=e.client)!=null?r:l).post(o(t({url:"/2025-06-09/wallets/me{walletLocator}/transactions/{transactionId}/approvals"},e),{headers:t({"Content-Type":"application/json"},e.headers)}))},V=e=>{var r;return((r=e.client)!=null?r:l).get(t({url:"/2025-06-09/wallets/me{walletLocator}/transactions/{transactionId}"},e))},h=e=>{var r;return((r=e.client)!=null?r:l).get(t({url:"/2025-06-09/wallets/me{walletLocator}/transactions"},e))},E=e=>{var r;return((r=e.client)!=null?r:l).post(o(t({url:"/2025-06-09/wallets/me{walletLocator}/transactions"},e),{headers:t({"Content-Type":"application/json"},e.headers)}))},d=e=>{var r;return((r=e.client)!=null?r:l).post(o(t({url:"/2025-06-09/wallets/me{walletLocator}/tokens/{tokenLocator}/transfers"},e),{headers:t({"Content-Type":"application/json"},e.headers)}))},S=e=>{var r;return((r=e.client)!=null?r:l).get(t({url:"/2025-06-09/wallets/me{walletLocator}/signers/{signer}"},e))},g=e=>{var r;return((r=e.client)!=null?r:l).post(o(t({url:"/2025-06-09/wallets/me{walletLocator}/signers"},e),{headers:t({"Content-Type":"application/json"},e.headers)}))},O=e=>{var r;return((r=e.client)!=null?r:l).post(o(t({url:"/2025-06-09/wallets/me{walletLocator}/signatures/{signatureId}/approvals"},e),{headers:t({"Content-Type":"application/json"},e.headers)}))},G=e=>{var r;return((r=e.client)!=null?r:l).get(t({url:"/2025-06-09/wallets/me{walletLocator}/signatures/{signatureId}"},e))},D=e=>{var r;return((r=e.client)!=null?r:l).get(t({url:"/2025-06-09/wallets/me{walletLocator}/signatures"},e))},b=e=>{var r;return((r=e.client)!=null?r:l).post(o(t({url:"/2025-06-09/wallets/me{walletLocator}/signatures"},e),{headers:t({"Content-Type":"application/json"},e.headers)}))},M=e=>{var r;return((r=e.client)!=null?r:l).get(t({url:"/2025-06-09/wallets/me{walletLocator}"},e))},R=e=>{var r;return((r=e.client)!=null?r:l).post(o(t({url:"/2025-06-09/wallets/me"},e),{headers:t({"Content-Type":"application/json"},e.headers)}))},x=e=>{var r;return((r=e.client)!=null?r:l).post(o(t({url:"/2025-06-09/wallets/{walletLocator}/transactions/{transactionId}/approvals"},e),{headers:t({"Content-Type":"application/json"},e.headers)}))},L=e=>{var r;return((r=e.client)!=null?r:l).get(t({url:"/2025-06-09/wallets/{walletLocator}/transactions/{transactionId}"},e))},k=e=>{var r;return((r=e.client)!=null?r:l).get(t({url:"/2025-06-09/wallets/{walletLocator}/transactions"},e))},A=e=>{var r;return((r=e.client)!=null?r:l).post(o(t({url:"/2025-06-09/wallets/{walletLocator}/transactions"},e),{headers:t({"Content-Type":"application/json"},e.headers)}))},v=e=>{var r;return((r=e.client)!=null?r:l).get(t({url:"/2025-06-09/wallets/{walletLocator}/tokens/{tokenLocator}/transfers/{transactionId}"},e))},y=e=>{var r;return((r=e.client)!=null?r:l).post(o(t({url:"/2025-06-09/wallets/{walletLocator}/tokens/{tokenLocator}/transfers"},e),{headers:t({"Content-Type":"application/json"},e.headers)}))},f=e=>{var r;return((r=e.client)!=null?r:l).get(t({url:"/2025-06-09/wallets/{walletLocator}/signers/{signer}"},e))},B=e=>{var r;return((r=e.client)!=null?r:l).post(o(t({url:"/2025-06-09/wallets/{walletLocator}/signers"},e),{headers:t({"Content-Type":"application/json"},e.headers)}))},m=e=>{var r;return((r=e.client)!=null?r:l).post(o(t({url:"/2025-06-09/wallets/{walletLocator}/signatures/{signatureId}/approvals"},e),{headers:t({"Content-Type":"application/json"},e.headers)}))},F=e=>{var r;return((r=e.client)!=null?r:l).get(t({url:"/2025-06-09/wallets/{walletLocator}/signatures/{signatureId}"},e))},U=e=>{var r;return((r=e.client)!=null?r:l).get(t({url:"/2025-06-09/wallets/{walletLocator}/signatures"},e))},j=e=>{var r;return((r=e.client)!=null?r:l).post(o(t({url:"/2025-06-09/wallets/{walletLocator}/signatures"},e),{headers:t({"Content-Type":"application/json"},e.headers)}))},q=e=>{var r;return((r=e.client)!=null?r:l).get(t({url:"/2025-06-09/wallets/{walletLocator}/balances"},e))},I=e=>{var r;return((r=e.client)!=null?r:l).get(t({url:"/2025-06-09/wallets/{walletLocator}"},e))},_=e=>{var r;return((r=e.client)!=null?r:l).post(o(t({url:"/2025-06-09/wallets"},e),{headers:t({"Content-Type":"application/json"},e.headers)}))};export{i as a,C as b,c,p as d,T as e,W as f,u as g,w as h,V as i,h as j,E as k,d as l,S as m,g as n,O as o,G as p,D as q,b as r,M as s,R as t,x as u,L as v,k as w,A as x,v as y,y as z,f as A,B,m as C,F as D,U as E,j as F,q as G,I as H,_ as I};
@@ -0,0 +1 @@
1
+ import{a as w}from"./chunk-RLAW2ERD.js";import{a as l}from"./chunk-R3EQXI46.js";import{c as d,g as i}from"./chunk-J3R36SGJ.js";import{getEnvironmentForKey as E,APIKeyEnvironmentPrefix as y,WithLoggerContext as u}from"@crossmint/common-sdk-base";import{WebAuthnP256 as v}from"ox";var b={[y.DEVELOPMENT]:"https://development.devicekey.store",[y.STAGING]:"https://staging.devicekey.store",[y.PRODUCTION]:"https://devicekey.store"},P=6e4,K="indexeddb-fatal",c=class extends w{constructor(e){super(e);this.iframePromise=null;this.reloading=null;this.biometricRequestHandler=null;this.biometricListener=null;let r=E(e);if(r==null)throw new Error("Unable to determine environment from API key");this.iframeUrl=b[r]}setBiometricRequestHandler(e){this.biometricRequestHandler=e}generateKey(){return i(this,arguments,function*(e={biometricPolicy:"none"}){return(yield this.rpc("generateKey",e)).publicKeyBase64})}mapAddressToKey(e,r){return i(this,null,function*(){yield this.rpc("mapAddressToKey",{address:e,publicKeyBase64:r})})}getKey(e){return i(this,null,function*(){return(yield this.rpc("getKey",{address:e})).publicKeyBase64})}hasKey(e){return i(this,null,function*(){return(yield this.rpc("hasKey",{publicKeyBase64:e})).hasKey})}signMessage(e,r){return i(this,null,function*(){return yield this.rpc("signMessage",{address:e,message:r})})}deleteKey(e){return i(this,null,function*(){yield this.rpc("deleteKey",{address:e})})}destroy(){this.biometricListener!=null&&(window.removeEventListener("message",this.biometricListener),this.biometricListener=null),this.iframePromise!=null&&(this.iframePromise.then(e=>e.remove()).catch(()=>{}),this.iframePromise=null)}rpc(e,r){return i(this,null,function*(){let o=yield this.sendRpc(e,r);if(o.fatal){l.warn(`[IframeDeviceSignerKeyStorage] Recoverable IDB error on "${e}", reloading iframe and retrying`),yield this.reloadIframe();let t=yield this.sendRpc(e,r);if(t.fatal)throw new Error(`Device signer IDB fatal error on "${e}" persisted after iframe reload`);return t.value}return o.value})}sendRpc(e,r){return i(this,null,function*(){let t=(yield this.getIframe()).contentWindow;if(t==null)throw new Error("Device signer iframe has no contentWindow");let g=crypto.randomUUID(),a=new URL(this.iframeUrl).origin;return new Promise((n,s)=>{let p=setTimeout(()=>{window.removeEventListener("message",h),s(new Error(`Device signer RPC "${e}" timed out after ${P}ms`))},P);function h(f){let m=f.data;m==null||m.id!==g||f.origin===a&&(clearTimeout(p),window.removeEventListener("message",h),m.type==="error"&&m.code===K?n({fatal:!0}):m.type==="error"?s(new Error(m.error)):n({value:m.result,fatal:!1}))}window.addEventListener("message",h),t.postMessage({type:e,id:g,payload:r},this.iframeUrl)})})}reloadIframe(){return i(this,null,function*(){if(this.reloading!=null)return this.reloading;let e=i(this,null,function*(){try{this.destroy(),yield this.getIframe()}finally{this.reloading=null}});return this.reloading=e,e})}setupBiometricListener(e){let r=new URL(this.iframeUrl).origin;this.biometricListener=o=>i(this,null,function*(){if(o.origin!==r)return;let t=o.data;if((t==null?void 0:t.type)!=="biometric-request")return;let g=e.contentWindow;if(g!=null)try{this.biometricRequestHandler!=null&&(yield this.biometricRequestHandler(t.action));let a=null;if(t.action==="createCredential"){let n=t.payload,s=yield v.createCredential({name:n.name});a={id:s.id,publicKey:{x:`0x${s.publicKey.x.toString(16)}`,y:`0x${s.publicKey.y.toString(16)}`}}}else if(t.action==="sign"){let n=t.payload,{signature:s,metadata:p}=yield v.sign({credentialId:n.credentialId,challenge:n.challenge});a={signature:{r:`0x${s.r.toString(16)}`,s:`0x${s.s.toString(16)}`},metadata:p}}g.postMessage({type:"biometric-response",id:t.id,result:a},this.iframeUrl)}catch(a){let n=a instanceof Error?a.message:"Unknown biometric error";g.postMessage({type:"biometric-response",id:t.id,error:n},this.iframeUrl)}}),window.addEventListener("message",this.biometricListener)}getIframe(){return this.iframePromise==null&&(this.iframePromise=this.createIframe().catch(e=>{throw this.iframePromise=null,e})),this.iframePromise}createIframe(){let e=document.createElement("iframe");return e.src=this.iframeUrl,Object.assign(e.style,{position:"absolute",opacity:"0",pointerEvents:"none",width:"0",height:"0",border:"none",top:"-9999px",left:"-9999px"}),new Promise((r,o)=>{e.onload=()=>{this.setupBiometricListener(e),r(e)},e.onerror=()=>o(new Error("Failed to load device signer iframe")),document.body.appendChild(e)})}};d([u({logger:l,methodName:"deviceSignerKeyStorage.generateKey"})],c.prototype,"generateKey",1),d([u({logger:l,methodName:"deviceSignerKeyStorage.mapAddressToKey"})],c.prototype,"mapAddressToKey",1),d([u({logger:l,methodName:"deviceSignerKeyStorage.getKey"})],c.prototype,"getKey",1),d([u({logger:l,methodName:"deviceSignerKeyStorage.hasKey"})],c.prototype,"hasKey",1),d([u({logger:l,methodName:"deviceSignerKeyStorage.signMessage"})],c.prototype,"signMessage",1),d([u({logger:l,methodName:"deviceSignerKeyStorage.deleteKey"})],c.prototype,"deleteKey",1);export{c as a};
@@ -0,0 +1 @@
1
+ import{a as n}from"./chunk-OQZTL6ZG.js";import{a as o}from"./chunk-XNZLCUTY.js";import{privateKeyToAccount as p}from"viem/accounts";import{bytesToHex as f}from"@noble/hashes/utils";import{Keypair as m}from"@solana/web3.js";import{Keypair as y}from"@stellar/stellar-sdk";function c(r,e){switch(n(e)){case"evm":return p(`0x${f(r)}`).address;case"solana":return m.fromSeed(r).publicKey.toBase58();case"stellar":return y.fromRawEd25519Seed(Buffer.from(r)).publicKey()}}function A(r,e,i,s){if(typeof window!="undefined")throw new Error("Server signers can only be used from server-side code.");let a=typeof e=="string"?e:String(e),t=o(r.secret,i,s,a),d=c(t,e);return{derivedKeyBytes:t,derivedAddress:d}}export{c as a,A as b};
@@ -0,0 +1 @@
1
+ import{CrossmintSDKError as t,WalletErrorCode as e}from"@crossmint/common-sdk-base";var o=class extends t{constructor(s,r){super(s,e.API_KEY_INVALID,r)}},c=class extends t{constructor(s,r){super(s,e.ENVIRONMENT_INVALID,r)}},p=class extends t{constructor(s,r){super(s,e.WALLET_TYPE_INVALID,r)}},i=class extends t{constructor(s,r){super(s,e.WALLET_NOT_AVAILABLE,r)}},A=class extends t{constructor(s,r){super(s,e.WALLET_NOT_AVAILABLE,r)}},I=class extends t{constructor(s,r){super(s,e.WALLET_CREATION_FAILED,r)}},x=class extends t{constructor(s,r){super(s,e.WALLET_TYPE_INVALID,r)}},g=class extends t{constructor(s,r){super(s,e.SIGNER_INVALID,r)}},u=class extends t{constructor(s,r){super(s,e.SIGNER_INVALID,r)}},N=class extends t{constructor(s,r){super(s,e.MESSAGE_INVALID,r)}},E=class extends t{constructor(s,r){super(s,e.MESSAGE_INVALID,r)}},L=class extends t{constructor(s,r){super(s,e.SIGNING_FAILED,r)}},_=class extends t{constructor(s,r){super(s,e.SIGNING_FAILED,r)}},l=class extends t{constructor(s,r){super(s,e.SIGNING_FAILED,r)}},T=class extends t{constructor(s,r){super(s,e.NO_SIGNATURE,r)}},a=class extends t{constructor(s,r){super(s,e.NO_SIGNATURE,r)}},d=class extends t{constructor(s,r){super(s,e.SIGNING_FAILED,r)}},S=class extends t{constructor(s,r){super(s,e.NO_TRANSACTION,r)}},D=class extends t{constructor(s,r){super(s,e.NO_TRANSACTION,r)}},O=class extends t{constructor(s,r){super(s,e.TRANSACTION_FAILED,r)}},G=class extends t{constructor(s,r){super(s,e.TRANSACTION_FAILED,r)}},R=class extends t{constructor(s,r){super(s,e.TRANSACTION_FAILED,r)}},C=class extends t{constructor(s,r){super(s,e.TRANSACTION_FAILED,r)}},F=class extends t{constructor(s,r){super(s,e.TRANSACTION_FAILED,r)}},V=class extends t{constructor(s,r){super(s,e.TRANSACTION_FAILED,r)}};export{o as a,c as b,p as c,i as d,A as e,I as f,x as g,g as h,u as i,N as j,E as k,L as l,_ as m,l as n,T as o,a as p,d as q,S as r,D as s,O as t,G as u,R as v,C as w,F as x,V as y};
@@ -0,0 +1 @@
1
+ import{b as n,c as i}from"./chunk-TYFWX53A.js";import{SdkLogger as d,BrowserDatadogSink as k,detectPlatform as g,validateAPIKey as l,ServerDatadogSink as m}from"@crossmint/common-sdk-base";var t=new d;function f(s){let o=g(),e=l(s);if(!e.isValid)throw new Error(`Invalid API key: ${e.message}`);let{environment:a,projectId:c}=e;switch(t.init({packageName:i,packageVersion:n,environment:a,projectId:c,platform:o}),o){case"browser":{let r=new k(a);t.addSink(r);break}case"react-native":break;case"server":{let r=new m(a);t.addSink(r);break}default:break}}export{t as a,f as b};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var _stellarsdk = require('@stellar/stellar-sdk');var s=class{constructor(e){this.type="server";this.keypair=_stellarsdk.Keypair.fromRawEd25519Seed(Buffer.from(e.derivedKeyBytes)),this._address=this.keypair.publicKey(),this._locator=e.locator}address(){return this._address}locator(){return this._locator}signMessage(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){if(!/^[A-Za-z0-9+/]*={0,2}$/.test(e))throw new Error("StellarServerSigner.signMessage: expected a base64-encoded string");let t=Buffer.from(e,"base64");return{signature:this.keypair.sign(t).toString("base64")}})}signTransaction(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return yield this.signMessage(e)})}};exports.a = s;
@@ -0,0 +1 @@
1
+ var s=class{constructor(e){this.apiKey=e}};export{s as a};
@@ -0,0 +1 @@
1
+ import{a,b as g}from"./chunk-SP2YD44M.js";import{a as s}from"./chunk-R3EQXI46.js";import{g as t}from"./chunk-J3R36SGJ.js";import{PersonalMessage as u}from"ox";import{isHex as h,toHex as l}from"viem";var c=class p extends a{constructor(e){super(e)}signMessage(e){return t(this,null,function*(){let i=h(e)?e:l(e),r=u.getSignPayload(i);return yield this.sign(r)})}signTransaction(e){return t(this,null,function*(){return yield this.sign(e)})}sign(e){return t(this,null,function*(){var o;yield this.handleAuthRequired();let i=this.getJwtOrThrow(),r=e.replace("0x","");s.info("sign: sending request",{keyType:"secp256k1"});let y=Date.now(),n=yield(o=this.config.clientTEEConnection)==null?void 0:o.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:i,apiKey:this.config.crossmint.apiKey},data:{keyType:"secp256k1",bytes:r,encoding:"hex"}},options:g});if(s.info("sign: response received",{status:n==null?void 0:n.status,durationMs:Date.now()-y}),(n==null?void 0:n.status)==="error")throw new Error(n.error);if((n==null?void 0:n.signature)==null)throw new Error("Failed to sign transaction");return p.verifyPublicKeyFormat(n.publicKey),{signature:n.signature.bytes}})}static verifyPublicKeyFormat(e){if(e==null)throw new Error("No public key found");if(e.encoding!=="hex"||e.keyType!=="secp256k1"||e.bytes==null)throw new Error("Not supported. Expected public key to be in hex encoding and secp256k1 key type. Got: "+JSON.stringify(e))}getChainKeyParams(){return{scheme:"secp256k1",encoding:"hex"}}};export{c as a};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var n=class{constructor(t){this.config=t;this.type="api-key"}locator(){return this.config.locator}signMessage(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return yield Promise.reject(new Error("API key signers do not support direct message signing - signatures are handled automatically by the backend"))})}signTransaction(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return yield Promise.reject(new Error("API key signers do not support direct transaction signing - transaction are handled automatically by the backend"))})}};exports.a = n;
@@ -0,0 +1 @@
1
+ import{a as l}from"./chunk-WTVI4AL4.js";import{b as w}from"./chunk-PKYRYRX4.js";import{a as S}from"./chunk-SPVAZXRY.js";import{k as u,o as g,r as I}from"./chunk-PSXRNSOE.js";import{a as r}from"./chunk-R3EQXI46.js";import{c as p,g as c}from"./chunk-J3R36SGJ.js";import{createPublicClient as x,encodeFunctionData as E,http as O}from"viem";import{isValidEvmAddress as b,WithLoggerContext as h}from"@crossmint/common-sdk-base";var o=class o extends l{constructor(e){super({chain:e.chain,address:e.address,owner:e.owner,options:l.getOptions(e),alias:e.alias,recovery:l.getRecovery(e),signer:e.signer},l.getApiClient(e))}static from(e){if(!b(e.address))throw new Error("Wallet is not an EVM wallet");return new o(e)}sendTransaction(e){return c(this,null,function*(){var i;r.info("evmWallet.sendTransaction.start"),yield this.preAuthIfNeeded();let n=this.buildTransaction(e),t=yield this.createTransaction(n,e.options);if((i=e.options)!=null&&i.prepareOnly)return r.info("evmWallet.sendTransaction.prepared",{transactionId:t.id}),{hash:void 0,explorerLink:void 0,transactionId:t.id};let a=yield this.approveTransactionAndWait(t.id);return r.info("evmWallet.sendTransaction.success",{transactionId:t.id,hash:a.hash}),a})}signMessage(e){return c(this,null,function*(){var i;r.info("evmWallet.signMessage.start"),yield this.preAuthIfNeeded();let n=this.requireSigner(),t=yield this.apiClient.createSignature(this.walletLocator,{type:"message",params:{message:e.message,signer:n.locator(),chain:this.chain}});if("error"in t)throw r.error("evmWallet.signMessage.error",{error:t}),new g(JSON.stringify(t));if((i=e.options)!=null&&i.prepareOnly)return r.info("evmWallet.signMessage.prepared",{signatureId:t.id}),{signature:void 0,signatureId:t.id};let a=yield this.approveSignatureAndWait(t.id);return r.info("evmWallet.signMessage.success",{signatureId:t.id}),a})}signTypedData(e){return c(this,null,function*(){var C;r.info("evmWallet.signTypedData.start"),yield this.preAuthIfNeeded();let n=this.requireSigner(),{domain:t,message:a,primaryType:i,types:d,chain:m}=e;if(!t||!a||!d||!m)throw r.error("evmWallet.signTypedData.error",{error:"Invalid typed data"}),new u("Invalid typed data");let{name:T,version:f,chainId:y,verifyingContract:v,salt:D}=t;if(!T||!f||!y||!v)throw r.error("evmWallet.signTypedData.error",{error:"Invalid typed data domain"}),new u("Invalid typed data domain");let s=yield this.apiClient.createSignature(this.walletLocator,{type:"typed-data",params:{typedData:{domain:{name:T,version:f,chainId:Number(y),verifyingContract:v,salt:D},message:a,primaryType:i,types:d},signer:n.locator(),chain:m}});if("error"in s)throw r.error("evmWallet.signTypedData.error",{error:s}),new g(JSON.stringify(s));if((C=e.options)!=null&&C.prepareOnly)return r.info("evmWallet.signTypedData.prepared",{signatureId:s.id}),{signature:void 0,signatureId:s.id};let M=yield this.approveSignatureAndWait(s.id);return r.info("evmWallet.signTypedData.success",{signatureId:s.id}),M})}getViemClient(e){var n;return x({transport:(n=e==null?void 0:e.transport)!=null?n:O(),chain:S(this.chain)})}createTransaction(e,n){return c(this,null,function*(){let t;(n==null?void 0:n.signer)==null?t=this.requireSigner().locator():typeof n.signer=="string"?t=n.signer:t=`server:${w(n.signer,this.chain,this.apiClient.projectId,this.apiClient.environment).derivedAddress}`;let a=yield this.apiClient.createTransaction(this.walletLocator,{params:{signer:t,chain:this.chain,calls:[e]}});if("error"in a)throw new I(JSON.stringify(a));return a})}buildTransaction(e){var n,t,a,i,d;if("transaction"in e)return{transaction:e.transaction};if(e.abi==null)return{to:e.to,value:(t=(n=e.value)==null?void 0:n.toString())!=null?t:"0",data:(a=e.data)!=null?a:"0x"};if(!e.functionName)throw new Error("Function name is required");return{to:e.to,value:(d=(i=e.value)==null?void 0:i.toString())!=null?d:"0",data:E({abi:e.abi,functionName:e.functionName,args:e.args})}}};p([h({logger:r,methodName:"evmWallet.sendTransaction",buildContext(e){return{chain:e.chain,address:e.address}}})],o.prototype,"sendTransaction",1),p([h({logger:r,methodName:"evmWallet.signMessage",buildContext(e){return{chain:e.chain,address:e.address}}})],o.prototype,"signMessage",1),p([h({logger:r,methodName:"evmWallet.signTypedData",buildContext(e){return{chain:e.chain,address:e.address}}})],o.prototype,"signTypedData",1);var W=o;export{W as a};
@@ -0,0 +1 @@
1
+ import{defineChain as t}from"viem";var n=t({id:1513,name:"Story Testnet",nativeCurrency:{decimals:18,name:"IP",symbol:"IP"},rpcUrls:{default:{http:["https://testnet.storyrpc.io"]}},blockExplorers:{default:{name:"Story Testnet Explorer",url:"https://testnet.storyscan.xyz"}},testnet:!0});export{n as a};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkU7QSF6P7cjs = require('./chunk-U7QSF6P7.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var t=new _commonsdkbase.SdkLogger;function v(s){let o=_commonsdkbase.detectPlatform.call(void 0, ),e=_commonsdkbase.validateAPIKey.call(void 0, s);if(!e.isValid)throw new Error(`Invalid API key: ${e.message}`);let{environment:a,projectId:c}=e;switch(t.init({packageName:_chunkU7QSF6P7cjs.c,packageVersion:_chunkU7QSF6P7cjs.b,environment:a,projectId:c,platform:o}),o){case"browser":{let r=new (0, _commonsdkbase.BrowserDatadogSink)(a);t.addSink(r);break}case"react-native":break;case"server":{let r=new (0, _commonsdkbase.ServerDatadogSink)(a);t.addSink(r);break}default:break}}exports.a = t; exports.b = v;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk4ADZVYB5cjs = require('./chunk-4ADZVYB5.cjs');var _chunkNF7KU2MLcjs = require('./chunk-NF7KU2ML.cjs');var _chunkF6PYIH4Ecjs = require('./chunk-F6PYIH4E.cjs');var _chunkBW27ZG6Ocjs = require('./chunk-BW27ZG6O.cjs');var _chunkSPTXAOFRcjs = require('./chunk-SPTXAOFR.cjs');var _chunkNJWSHT2Hcjs = require('./chunk-NJWSHT2H.cjs');var _chunkJJMKQ5PKcjs = require('./chunk-JJMKQ5PK.cjs');var _chunkA33BEWR7cjs = require('./chunk-A33BEWR7.cjs');var _chunkTTSJFEM5cjs = require('./chunk-TTSJFEM5.cjs');var _chunkRXRRXB74cjs = require('./chunk-RXRRXB74.cjs');var _chunkBFIHTTMMcjs = require('./chunk-BFIHTTMM.cjs');var _chunkO4FVTK7Xcjs = require('./chunk-O4FVTK7X.cjs');function M(r,e,n){switch(e.type){case"email":case"phone":return r==="solana"?new (0, _chunkF6PYIH4Ecjs.a)(e):r==="stellar"?new (0, _chunkBW27ZG6Ocjs.a)(e):new (0, _chunkNF7KU2MLcjs.a)(e);case"api-key":return r==="solana"?new (0, _chunkRXRRXB74cjs.a)(e):new (0, _chunkJJMKQ5PKcjs.a)(e);case"external-wallet":return r==="solana"?new (0, _chunkBFIHTTMMcjs.a)(e):r==="stellar"?new (0, _chunkSPTXAOFRcjs.a)(e):new (0, _chunkA33BEWR7cjs.a)(e);case"server":return _chunk4ADZVYB5cjs.a.call(void 0, r,e);case"passkey":return new (0, _chunkTTSJFEM5cjs.a)(e);case"device":if(n==null)throw new (0, _chunkO4FVTK7Xcjs.f)("Device signer key storage is required for device signers");return new (0, _chunkNJWSHT2Hcjs.a)(e,n)}}exports.a = M;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var t=class{constructor(r){this.config=r;this.type="external-wallet";this._address=r.address}address(){return this._address}locator(){return this.config.locator}};exports.a = t;
@@ -0,0 +1 @@
1
+ import{g as e}from"./chunk-J3R36SGJ.js";var n=class{constructor(t){this.config=t;this.type="api-key"}locator(){return this.config.locator}signMessage(){return e(this,null,function*(){return yield Promise.reject(new Error("API key signers do not support direct message signing - signatures are handled automatically by the backend"))})}signTransaction(){return e(this,null,function*(){return yield Promise.reject(new Error("API key signers do not support direct transaction signing - transaction are handled automatically by the backend"))})}};export{n as a};
@@ -0,0 +1 @@
1
+ import{a as g}from"./chunk-O6VBO7KG.js";import{a as l}from"./chunk-WCGUGIGJ.js";import{a as o}from"./chunk-R3EQXI46.js";import{c as m,g as a}from"./chunk-J3R36SGJ.js";import{validateAPIKey as p,WithLoggerContext as w}from"@crossmint/common-sdk-base";var f=class{constructor(r){this.config=r;this._needsAuth=!0;this._authPromise=null;this._initializationPromise=null;typeof window!="undefined"&&(this._initializationPromise=this.initialize()),this.type=this.config.type}locator(){return this.config.locator}address(){return this.config.address}initialize(){return a(this,null,function*(){try{if(this.config.clientTEEConnection==null){let r=p(this.config.crossmint.apiKey);if(!r.isValid)throw new Error("Invalid API key");let t=new g({environment:r.environment});this.config.clientTEEConnection=yield t.initialize()}}finally{this._initializationPromise=null}})}getTEEConnection(){return a(this,null,function*(){if(this.config.clientTEEConnection==null){if(this._initializationPromise){if(yield this._initializationPromise,this.config.clientTEEConnection==null)throw new Error("Failed to initialize TEE connection");return this.config.clientTEEConnection}this._initializationPromise=this.initializeTEEConnection();try{yield this._initializationPromise}finally{this._initializationPromise=null}}if(this.config.clientTEEConnection==null)throw new Error("TEE connection is not initialized");return this.config.clientTEEConnection})}initializeTEEConnection(){return a(this,null,function*(){o.info("TEE connection not initialized, initializing now");let r=p(this.config.crossmint.apiKey);if(!r.isValid)throw new Error("Invalid API key");let t=new g({environment:r.environment});if(this.config.clientTEEConnection=yield t.initialize(),this.config.clientTEEConnection==null)throw new Error("Failed to initialize TEE connection");o.info("TEE connection initialized successfully")})}handleAuthRequired(){return a(this,null,function*(){var u;let r=yield this.getTEEConnection();if(this.config.onAuthRequired==null)throw new Error(`${this.type} signer requires the onAuthRequired callback to handle OTP verification. This callback manages the authentication flow (sending OTP and verifying user input). If using our React/React Native SDK, this is handled automatically by the provider. For other environments, implement: onAuthRequired: (needsAuth, sendOtp, verifyOtp, reject) => { /* your UI logic */ }`);o.info("get-status: sending request");let t=Date.now(),n=yield r.sendAction({event:"request:get-status",responseEvent:"response:get-status",data:{authData:{jwt:(u=this.config.crossmint.jwt)!=null?u:"",apiKey:this.config.crossmint.apiKey}},options:d}),e=Date.now()-t;if((n==null?void 0:n.status)!=="success")throw o.error("get-status: failed",{status:n==null?void 0:n.status,error:n==null?void 0:n.error,durationMs:e}),new Error(n==null?void 0:n.error);if(o.info("get-status: response received",{signerStatus:n.signerStatus,durationMs:e}),n.signerStatus==="ready"){this._needsAuth=!1;return}else this._needsAuth=!0;o.info("Auth required, initiating OTP flow",{needsAuth:this._needsAuth});let{promise:s,resolve:h,reject:c}=this.createAuthPromise();if(this._authPromise={promise:s,resolve:h,reject:c},this.config.onAuthRequired)try{yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),i=>this.verifyOtp(i),()=>a(this,null,function*(){o.info("Auth rejected",{authRejected:!0}),this._needsAuth=!1,this.config.onAuthRequired!=null&&(yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),i=>this.verifyOtp(i),()=>{var i;return(i=this._authPromise)==null?void 0:i.reject(new l)})),c(new l)}))}catch(i){o.error("handleAuthRequired error",{error:i}),c(i)}try{yield s}catch(i){throw o.error("handleAuthRequired promise error",{error:i}),i}})}ensureAuthenticated(){return a(this,null,function*(){yield this.handleAuthRequired()})}getJwtOrThrow(){let r=this.config.crossmint.jwt;if(r==null)throw new Error("JWT is required");return r}createAuthPromise(){let r,t;return{promise:new Promise((e,s)=>{r=e,t=s}),resolve:r,reject:t}}sendMessageWithOtp(){return a(this,null,function*(){var h,c;let r=yield this.getTEEConnection(),t=this.getAuthId();o.info("start-onboarding: sending request");let n=Date.now(),e=yield r.sendAction({event:"request:start-onboarding",responseEvent:"response:start-onboarding",data:{authData:{jwt:(h=this.config.crossmint.jwt)!=null?h:"",apiKey:this.config.crossmint.apiKey},data:{authId:t}},options:d}),s=Date.now()-n;if(o.info("start-onboarding: response received",{status:e==null?void 0:e.status,durationMs:s}),(e==null?void 0:e.status)==="success"&&e.signerStatus==="ready"){this._needsAuth=!1;return}(e==null?void 0:e.status)==="error"&&(o.error("start-onboarding: failed",{error:e.error}),(c=this._authPromise)==null||c.reject(new Error(e.error||"Failed to initiate OTP process.")))})}getAuthId(){return this.config.type==="email"?`email:${this.config.email}`:`phone:${this.config.phone}`}verifyOtp(r){return a(this,null,function*(){var s,h,c,u;let t;try{let i=yield this.getTEEConnection();o.info("complete-onboarding: sending request");let E=Date.now();t=yield i.sendAction({event:"request:complete-onboarding",responseEvent:"response:complete-onboarding",data:{authData:{jwt:(s=this.config.crossmint.jwt)!=null?s:"",apiKey:this.config.crossmint.apiKey},data:{onboardingAuthentication:{encryptedOtp:r}}},options:d}),o.info("complete-onboarding: response received",{status:t==null?void 0:t.status,durationMs:Date.now()-E})}catch(i){throw o.error("complete-onboarding: error",{error:i}),this._needsAuth=!0,(h=this._authPromise)==null||h.reject(i),i}if((t==null?void 0:t.status)==="success"){this._needsAuth=!1,this.config.onAuthRequired!=null&&(yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),i=>this.verifyOtp(i),()=>{var i;return(i=this._authPromise)==null?void 0:i.reject(new l)})),(c=this._authPromise)==null||c.resolve();return}o.error("complete-onboarding: OTP validation failed",{status:t==null?void 0:t.status}),this._needsAuth=!0;let n=(t==null?void 0:t.status)==="error"?t.error:"Failed to validate encrypted OTP",e=new Error(n);throw(u=this._authPromise)==null||u.reject(e),e})}_exportPrivateKey(r){return a(this,null,function*(){yield this.handleAuthRequired();let t=this.getJwtOrThrow(),{scheme:n,encoding:e}=this.getChainKeyParams(),s=yield r.sendAction({event:"request:export-signer",responseEvent:"response:export-signer",data:{authData:{jwt:t,apiKey:this.config.crossmint.apiKey},data:{scheme:n,encoding:e}},options:d});if((s==null?void 0:s.status)==="error")throw new Error(s.error||"Failed to export private key")})}};m([w({logger:o,methodName:"handleAuthRequired"})],f.prototype,"handleAuthRequired",1);var d={timeoutMs:3e4};export{f as a,d as b};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkSCEPJO4Qcjs = require('./chunk-SCEPJO4Q.cjs');var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var t=class extends _chunkSCEPJO4Qcjs.a{constructor(n){super(n),this.onSign=n.onSign}signMessage(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for stellar external wallet signer"))})}signTransaction(n){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){if(this.onSign==null)throw new Error("[StellarExternalWalletSigner] No onSign callback provided. Pass an onSign callback when configuring the external wallet signer.");return{signature:yield this.onSign(n)}})}};exports.a = t;
@@ -0,0 +1 @@
1
+ import{a as A}from"./chunk-KUP7H7X2.js";import{a as O}from"./chunk-FT5EVMLB.js";import{a as S}from"./chunk-SVIKBM3S.js";import{a as o}from"./chunk-KKQBZXFE.js";import{a as s}from"./chunk-S3DYQVRD.js";import{b as i}from"./chunk-PSXRNSOE.js";import{a as E}from"./chunk-R3EQXI46.js";import{APIKeyEnvironmentPrefix as I,BlockchainIncludingTestnet as e}from"@crossmint/common-sdk-base";import{baseSepolia as l,base as C,polygonAmoy as M,polygon as _,optimismSepolia as m,optimism as L,arbitrumSepolia as P,arbitrum as c,arbitrumNova as u,modeTestnet as N,mode as R,bsc as p,shape as h,zora as d,zoraSepolia as f,sepolia as W,flowMainnet as B,flowTestnet as V,plume as U,plumeTestnet as y}from"viem/chains";var v=[e.ABSTRACT_TESTNET,e.ARBITRUM_SEPOLIA,e.BASE_SEPOLIA,e.CURTIS,e.ETHEREUM_SEPOLIA,e.FLOW_TESTNET,e.MANTLE_SEPOLIA,e.MODE_SEPOLIA,e.OPTIMISM_SEPOLIA,e.PLUME_TESTNET,e.POLYGON_AMOY,e.SCROLL_SEPOLIA,e.SEI_ATLANTIC_2_TESTNET,e.STORY_TESTNET,e.WORLD_CHAIN_SEPOLIA,e.ZORA_SEPOLIA,e.ARC_TESTNET,e.TEMPO_TESTNET],H=[e.ABSTRACT,e.APECHAIN,e.ARBITRUM,e.ARBITRUMNOVA,e.BASE,e.BSC,e.FLOW,e.MANTLE,e.MODE,e.OPTIMISM,e.PLUME,e.POLYGON,e.SCROLL,e.SEI_PACIFIC_1,e.SHAPE,e.STORY,e.TEMPO,e.WORLDCHAIN,e.ZORA];function J(t){switch(t){case e.BASE_SEPOLIA:return l;case e.BASE:return C;case e.POLYGON_AMOY:return M;case e.POLYGON:return _;case e.OPTIMISM_SEPOLIA:return m;case e.OPTIMISM:return L;case e.ARBITRUM_SEPOLIA:return P;case e.ARBITRUM:return c;case e.ARBITRUMNOVA:return u;case e.STORY_TESTNET:return s;case e.STORY:return o;case e.MODE_SEPOLIA:return N;case e.MODE:return R;case e.BSC:return p;case e.SHAPE:return h;case e.ZORA:return d;case e.ZORA_SEPOLIA:return f;case e.ETHEREUM_SEPOLIA:return W;case e.FLOW:return B;case e.FLOW_TESTNET:return V;case e.PLUME_TESTNET:return y;case e.PLUME:return U;case e.ARC_TESTNET:return S;case e.TEMPO:return A;case e.TEMPO_TESTNET:return O;case e.ABSTRACT:case e.ABSTRACT_TESTNET:case e.APECHAIN:case e.MANTLE:case e.MANTLE_SEPOLIA:case e.SCROLL:case e.SCROLL_SEPOLIA:case e.SEI_PACIFIC_1:case e.SEI_ATLANTIC_2_TESTNET:case e.CURTIS:case e.WORLDCHAIN:case e.WORLD_CHAIN_SEPOLIA:throw new Error(`Chain ${t} is not yet supported in toViemChain function. Please add the appropriate viem chain definition.`);default:throw new Error(`Unknown chain: ${t}`)}}function x(t){return v.includes(t)}function D(t){return H.includes(t)}var Y={[e.ABSTRACT]:e.ABSTRACT_TESTNET,[e.APECHAIN]:e.CURTIS,[e.ARBITRUM]:e.ARBITRUM_SEPOLIA,[e.BASE]:e.BASE_SEPOLIA,[e.FLOW]:e.FLOW_TESTNET,[e.MANTLE]:e.MANTLE_SEPOLIA,[e.MODE]:e.MODE_SEPOLIA,[e.OPTIMISM]:e.OPTIMISM_SEPOLIA,[e.PLUME]:e.PLUME_TESTNET,[e.POLYGON]:e.POLYGON_AMOY,[e.SCROLL]:e.SCROLL_SEPOLIA,[e.SEI_PACIFIC_1]:e.SEI_ATLANTIC_2_TESTNET,[e.STORY]:e.STORY_TESTNET,[e.WORLDCHAIN]:e.WORLD_CHAIN_SEPOLIA,[e.ZORA]:e.ZORA_SEPOLIA,[e.TEMPO]:e.TEMPO_TESTNET};function b(t){return Y[t]}function Q(t,a){if(t==="solana"||t==="stellar")return t;let r=t,T=a===I.PRODUCTION;if(T&&x(r))throw new i(`Chain "${t}" is a testnet chain and cannot be used in production. Please use a mainnet chain instead.`);if(!T&&D(r)){let n=b(r);if(n!=null)return E.debug("validateChainForEnvironment.autoConverted",{chain:t,convertedTo:n,environment:a,message:`Chain "${t}" is a mainnet chain and cannot be used in ${a} environment. Automatically converted to "${n}".`}),n;E.debug("validateChainForEnvironment.mismatch",{chain:t,environment:a,message:`Chain "${t}" is a mainnet chain and should not be used in ${a} environment. No testnet equivalent is available. Please use a testnet chain instead.`})}return t}export{J as a,x as b,D as c,b as d,Q as e};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _clientfetch = require('@hey-api/client-fetch');var o=_clientfetch.createClient.call(void 0, _clientfetch.createConfig.call(void 0, {baseUrl:"https://staging.crossmint.com/api"}));exports.a = o;
@@ -0,0 +1 @@
1
+ import{defineChain as t}from"viem";var s=t({id:5042002,name:"Arc Testnet",nativeCurrency:{decimals:6,name:"USDC",symbol:"USDC"},rpcUrls:{default:{http:["https://rpc.testnet.arc.network"]}},blockExplorers:{default:{name:"Arc Testnet Explorer",url:"https://testnet.arcscan.app"}},testnet:!0});export{s as a};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBEW7JDW6cjs = require('./chunk-BEW7JDW6.cjs');var _chunk6MGMZ3SIcjs = require('./chunk-6MGMZ3SI.cjs');var _chunkO4FVTK7Xcjs = require('./chunk-O4FVTK7X.cjs');var _chunkS4O54O4Ccjs = require('./chunk-S4O54O4C.cjs');var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var o=class o extends _chunkBEW7JDW6cjs.a{constructor(e){super({chain:e.chain,address:e.address,owner:e.owner,options:_chunkBEW7JDW6cjs.a.getOptions(e),alias:e.alias,recovery:_chunkBEW7JDW6cjs.a.getRecovery(e),signer:e.signer},_chunkBEW7JDW6cjs.a.getApiClient(e))}static from(e){if(!_commonsdkbase.isValidStellarAddress.call(void 0, e.address))throw new Error("Wallet is not a Stellar wallet");return new o(e)}sendTransaction(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var a;_chunkS4O54O4Ccjs.a.info("stellarWallet.sendTransaction.start"),yield this.preAuthIfNeeded();let t=yield this.createTransaction(e);if((a=e.options)!=null&&a.prepareOnly)return _chunkS4O54O4Ccjs.a.info("stellarWallet.sendTransaction.prepared",{transactionId:t.id}),{hash:void 0,explorerLink:void 0,transactionId:t.id};let n={},r=yield this.approveTransactionAndWait(t.id,n);return _chunkS4O54O4Ccjs.a.info("stellarWallet.sendTransaction.success",{transactionId:t.id,hash:r.hash}),r})}createTransaction(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let{contractId:t,options:n}=e,r;(n==null?void 0:n.signer)==null?r=this.requireSigner().locator():typeof n.signer=="string"?r=n.signer:r=`server:${_chunk6MGMZ3SIcjs.b.call(void 0, n.signer,this.chain,this.apiClient.projectId,this.apiClient.environment).derivedAddress}`;let a;if("transaction"in e)a={type:"serialized-transaction",serializedTransaction:e.transaction,contractId:t};else{let{method:T,memo:d,args:m}=e;a={type:"contract-call",contractId:t,method:T,memo:d!=null?{type:"text",value:d}:void 0,args:m}}let c=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:a,signer:r}});if("error"in c)throw new (0, _chunkO4FVTK7Xcjs.r)(JSON.stringify(c));return c})}};_chunk2GKPWQBQcjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkS4O54O4Ccjs.a,methodName:"stellarWallet.sendTransaction",buildContext(e){return{chain:e.chain,address:e.address}}})],o.prototype,"sendTransaction",1);var f=o;exports.a = f;
File without changes
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var _ox = require('ox');var n=class{constructor(s){this.config=s;this.type="passkey";this.id=s.id}locator(){return this.config.locator}signMessage(s){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){if(this.config.onSignWithPasskey)return yield this.config.onSignWithPasskey(s);let{signature:i,metadata:r}=yield _ox.WebAuthnP256.sign({credentialId:this.id,challenge:s});return{signature:{r:`0x${i.r.toString(16)}`,s:`0x${i.s.toString(16)}`},metadata:r}})}signTransaction(s){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return yield this.signMessage(s)})}};exports.a = n;
@@ -0,0 +1 @@
1
+ var s="@crossmint/wallets-sdk",t="1.0.0-beta.2";var r="WALLETS_SDK",c=t,a=s,d=500;export{r as a,c as b,a as c,d};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var s="@crossmint/wallets-sdk",t="1.0.0-beta.2";var p="WALLETS_SDK",r= exports.b =t,c= exports.c =s,a= exports.d =500;exports.a = p; exports.b = r; exports.c = c; exports.d = a;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _viem = require('viem');var r=_viem.defineChain.call(void 0, {id:4217,name:"Tempo",nativeCurrency:void 0,rpcUrls:{default:{http:["https://rpc.tempo.xyz"]}},blockExplorers:{default:{name:"Tempo Explorer",url:"https://explore.mainnet.tempo.xyz"}},testnet:!1});exports.a = r;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var _accounts = require('viem/accounts');var _utils = require('@noble/hashes/utils');var t=class{constructor(r){this.type="server";this.account=_accounts.privateKeyToAccount.call(void 0, `0x${_utils.bytesToHex.call(void 0, r.derivedKeyBytes)}`),this._address=this.account.address,this._locator=r.locator}address(){return this._address}locator(){return this._locator}signMessage(r){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){if(!r.startsWith("0x"))throw new Error(`EVMServerSigner.signMessage expects a 0x-prefixed hex string, got: ${r.slice(0,10)}...`);return{signature:yield this.account.signMessage({message:{raw:r}})}})}signTransaction(r){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return yield this.signMessage(r)})}};exports.a = t;
@@ -0,0 +1 @@
1
+ import{g as e}from"./chunk-J3R36SGJ.js";var n=class{constructor(t){this.config=t;this.type="api-key"}locator(){return this.config.locator}signMessage(){return e(this,null,function*(){return yield Promise.reject(new Error("API key signers do not support direct message signing - signatures are handled automatically by the backend"))})}signTransaction(){return e(this,null,function*(){return yield Promise.reject(new Error("API key signers do not support direct transaction signing - transaction are handled automatically by the backend"))})}};export{n as a};
@@ -0,0 +1 @@
1
+ var n=class extends Error{constructor(){super("Authentication was rejected by the user"),this.name="AuthRejectedError"}};function i(e){return e._exportPrivateKey!==void 0}export{n as a,i as b};
@@ -0,0 +1 @@
1
+ import{g as r}from"./chunk-J3R36SGJ.js";import{Keypair as i}from"@stellar/stellar-sdk";var s=class{constructor(e){this.type="server";this.keypair=i.fromRawEd25519Seed(Buffer.from(e.derivedKeyBytes)),this._address=this.keypair.publicKey(),this._locator=e.locator}address(){return this._address}locator(){return this._locator}signMessage(e){return r(this,null,function*(){if(!/^[A-Za-z0-9+/]*={0,2}$/.test(e))throw new Error("StellarServerSigner.signMessage: expected a base64-encoded string");let t=Buffer.from(e,"base64");return{signature:this.keypair.sign(t).toString("base64")}})}signTransaction(e){return r(this,null,function*(){return yield this.signMessage(e)})}};export{s as a};
@@ -0,0 +1 @@
1
+ import{a as K,b as te}from"./chunk-GOXB2RBF.js";import{b as H,c as G}from"./chunk-N5WVT7QE.js";import{a as O}from"./chunk-MCBBBEJT.js";import{b as N}from"./chunk-PKYRYRX4.js";import{a as re}from"./chunk-SP2YD44M.js";import{e as ee}from"./chunk-SPVAZXRY.js";import{c as j,d as M,i as q,m as U,p as D,q as _,r as V,s as J,t as z,u as Q,v as X,w as Y,x as Z}from"./chunk-PSXRNSOE.js";import{a}from"./chunk-R3EQXI46.js";import{d as B}from"./chunk-TYFWX53A.js";import{a as C,b,c as k,d as n,e as A,f,g as w}from"./chunk-J3R36SGJ.js";import{isValidAddress as ae,WithLoggerContext as I}from"@crossmint/common-sdk-base";var T,m,u,F,x,P,R,W,E=class{constructor(e,r){A(this,T);A(this,m);A(this,u);A(this,F);A(this,x,!1);A(this,P,!1);A(this,R);A(this,W,null);let{chain:t,address:i,owner:l,options:g,alias:c,recovery:s,signer:o}=e;f(this,u,r),this.chain=t,this.address=i,this.owner=l,f(this,m,g),this.alias=c,f(this,F,s),f(this,T,o),f(this,R,this.initDeviceSigner())}get signer(){return n(this,T)}initDeviceSigner(){return w(this,null,function*(){var i;let e=(i=n(this,m))==null?void 0:i.deviceSignerKeyStorage;if(e==null||this.chain==="solana")return;let r={type:"device"};try{yield this.resolveDeviceSignerAvailability(r)}catch(l){a.error("wallet.initDeviceSigner.error",{error:l}),f(this,x,!0);return}let t=this.buildInternalSignerConfig(r);f(this,T,O(this.chain,t,e))})}static getApiClient(e){return e.apiClient}static getOptions(e){return e.options}static getRecovery(e){return n(e,F)}get apiClient(){return n(this,u)}get options(){return n(this,m)}get recovery(){return n(this,F)}balances(e){return w(this,null,function*(){a.info("wallet.balances.start");let r=this.resolveChainForEnvironment(),t;switch(this.chain){case"solana":t="sol";break;case"stellar":t="xlm";break;default:t="eth";break}let i=[t,"usdc",...e!=null?e:[]],l=yield n(this,u).getBalance(this.address,{chains:[r],tokens:i});if("error"in l)throw a.error("wallet.balances.error",{error:l}),new Error(`Failed to get balances for wallet: ${JSON.stringify(l.message)}`);return a.info("wallet.balances.success"),this.transformBalanceResponse(l,t,e)})}stagingFund(e,r){return w(this,null,function*(){a.info("wallet.stagingFund.start",{amount:e,chain:r!=null?r:this.chain});let t=yield this.apiClient.fundWallet(this.address,{amount:e,token:"usdxm",chain:r!=null?r:this.chain});if("error"in t)throw a.error("wallet.stagingFund.error",{error:t}),new Error(`Failed to fund wallet: ${JSON.stringify(t.message)}`);return a.info("wallet.stagingFund.success"),t})}transformBalanceResponse(e,r,t){let i=o=>{var S,y,h,L,$;let d=(S=o.chains)==null?void 0:S[this.chain],p={};return this.chain==="solana"&&d!=null&&"mintHash"in d?p={mintHash:d.mintHash}:this.chain==="stellar"&&d!=null&&"contractId"in d?p={contractId:d.contractId}:d!=null&&"contractAddress"in d&&(p={contractAddress:d.contractAddress}),C({symbol:(y=o.symbol)!=null?y:"",name:(h=o.name)!=null?h:"",amount:(L=o.amount)!=null?L:"0",decimals:o.decimals,rawAmount:($=o.rawAmount)!=null?$:"0"},p)},l=e.find(o=>o.symbol===r),g=e.find(o=>o.symbol==="usdc"),c=e.filter(o=>{var d;return o.symbol!==r&&o.symbol!=="usdc"&&(t==null||t.includes((d=o.symbol)!=null?d:""))}),s=o=>{let d={symbol:o,name:o,amount:"0",decimals:0,rawAmount:"0"},p={};return this.chain==="solana"?p={mintHash:void 0}:this.chain==="stellar"?p={contractId:void 0}:p={contractAddress:void 0},C(C({},d),p)};return{nativeToken:l!=null?i(l):s(r),usdc:g!=null?i(g):s("usdc"),tokens:c.map(i)}}nfts(e){return w(this,null,function*(){return yield n(this,u).getNfts(b(C({},e),{chain:this.chain,address:this.address}))})}transactions(){return w(this,null,function*(){let e=yield n(this,u).getTransactions(this.walletLocator);if("error"in e)throw new Error(`Failed to get transactions: ${JSON.stringify(e.message)}`);return e})}transaction(e){return w(this,null,function*(){let r=yield n(this,u).getTransaction(this.walletLocator,e);if("error"in r)throw new Error(`Failed to get transaction: ${JSON.stringify(r.error)}`);return r})}transfers(e){return w(this,null,function*(){let r=this.resolveChainForEnvironment(),t=yield this.apiClient.getTransfers(this.walletLocator,{chain:r,tokens:e.tokens,status:e.status});if("error"in t)throw new Error(`Failed to get transfers: ${JSON.stringify(t.message)}`);return t})}send(e,r,t,i){return w(this,null,function*(){let l=this.resolveChainForEnvironment(),g=se(e),c=oe(r,l);a.info("wallet.send.start",C({recipient:g,token:c,amount:t},(i==null?void 0:i.transactionType)!=null?{transactionType:i.transactionType}:{})),yield this.preAuthIfNeeded();let s=this.requireSigner(),o;(i==null?void 0:i.signer)==null?o=s.locator():typeof i.signer=="string"?o=i.signer:o=`server:${N(i.signer,this.chain,n(this,u).projectId,n(this,u).environment).derivedAddress}`;let d=C({recipient:g,amount:t,signer:o},(i==null?void 0:i.transactionType)!=null?{transactionType:i.transactionType}:{}),p=yield n(this,u).send(this.walletLocator,c,d);if("message"in p)throw a.error("wallet.send.error",{error:p}),new V(`Failed to send token: ${JSON.stringify(p.message)}`);if((i==null?void 0:i.prepareOnly)===!0)return a.info("wallet.send.prepared",{transactionId:p.id}),{hash:void 0,explorerLink:void 0,transactionId:p.id};let S=yield this.approveTransactionAndWait(p.id);return a.info("wallet.send.success",{transactionId:p.id,hash:S.hash}),S})}approveTransaction(e){return w(this,null,function*(){return console.warn("approveTransaction is deprecated. Use approve instead. This method will be removed in the next major version."),yield this.approve(e)})}approve(e){return w(this,null,function*(){if(this.requireSigner(),a.info("wallet.approve.start",{transactionId:e.transactionId,signatureId:e.signatureId}),e.transactionId!=null){let r=yield this.approveTransactionAndWait(e.transactionId,e.options);return a.info("wallet.approve.success",{transactionId:e.transactionId}),r}if(e.signatureId!=null){let r=yield this.approveSignatureAndWait(e.signatureId,e.options);return a.info("wallet.approve.success",{signatureId:e.signatureId}),r}throw a.error("wallet.approve.error",{error:"Either transactionId or signatureId must be provided"}),new Error("Either transactionId or signatureId must be provided")})}addSigner(e,r){return w(this,null,function*(){var g,c,s,o,d;a.info("wallet.addSigner.start");let t=typeof e=="object"&&"type"in e&&e.type==="server"?`server:${N(e,this.chain,n(this,u).projectId,n(this,u).environment).derivedAddress}`:e,i=this.signer,l=b(C({},n(this,F)),{address:this.address,crossmint:n(this,u).crossmint,clientTEEConnection:(g=n(this,m))==null?void 0:g.clientTEEConnection,onAuthRequired:(s=(c=n(this,m))==null?void 0:c.callbacks)==null?void 0:s.onAuthRequired});f(this,T,O(this.chain,l,(o=n(this,m))==null?void 0:o.deviceSignerKeyStorage));try{let p=typeof t=="string"||t.type==="passkey"&&t.id==null?t:K(t),S=yield n(this,u).registerSigner(this.walletLocator,{signer:p,chain:this.chain==="solana"||this.chain==="stellar"?void 0:this.chain});if("error"in S)throw a.error("wallet.addSigner.error",{error:S}),new Error(`Failed to register signer: ${JSON.stringify(S.message)}`);let y=H(S,this.chain);if(this.chain==="solana"||this.chain==="stellar"){if(!("transaction"in S)||S.transaction==null)throw a.error("wallet.addSigner.error",{error:"Expected transaction in response for Solana/Stellar chain"}),new Error("Expected transaction in response for Solana/Stellar chain");let h=S.transaction.id;if(y==null)throw new Error(`No approval found for chain ${this.chain} in register signer response`);return r!=null&&r.prepareOnly?(a.info("wallet.addSigner.prepared",{transactionId:h}),b(C({},y),{transactionId:h})):(yield this.approveTransactionAndWait(h),a.info("wallet.addSigner.success",{transactionId:h}),b(C({},y),{status:"success"}))}else{if(!("chains"in S))throw a.error("wallet.addSigner.error",{error:"Expected chains in response for EVM chain"}),new Error("Expected chains in response for EVM chain");let h=(d=S.chains)==null?void 0:d[this.chain];if(y==null)throw new Error(`No approval found for chain ${this.chain} in register signer response`);if(r!=null&&r.prepareOnly){let L=(h==null?void 0:h.status)!=="success"?h==null?void 0:h.id:void 0;return a.info("wallet.addSigner.prepared",{signatureId:L}),b(C({},y),{signatureId:L})}if((h==null?void 0:h.status)==="awaiting-approval")yield this.approveSignatureAndWait(h.id),a.info("wallet.addSigner.success",{signatureId:h.id});else if((h==null?void 0:h.status)==="pending")yield this.waitForSignature(h.id),a.info("wallet.addSigner.success",{signatureId:h.id});else{if((h==null?void 0:h.status)==="failed")throw new Error(`Signer registration failed for chain ${this.chain}`);a.info("wallet.addSigner.success")}return b(C({},y),{status:"success"})}}finally{f(this,T,i)}})}useSigner(e){return w(this,null,function*(){var l;if(a.info("wallet.useSigner.start"),typeof e=="string"&&e.startsWith("external-wallet:"))throw new Error('Cannot use useSigner with an external-wallet locator string. Pass the full config object with an onSign callback instead: useSigner({ type: "external-wallet", address: "0x...", onSign: ... })');let r=this.resolveSignerInput(e);if(this.validateSignerInput(r),r.type==="passkey"&&(!("id"in r)||r.id==null||r.id==="")){let c=(yield this.signers()).filter(d=>d.type==="passkey");if(c.length===0)throw new Error("No passkey signer is registered on this wallet.");if(c.length>1)throw new Error('Multiple passkey signers are registered on this wallet. Please specify the credential id: wallet.useSigner({ type: "passkey", id: "<credential-id>" })');let o=c[0].locator.replace("passkey:","");r.id=o}if(r.type==="device")yield this.resolveDeviceSignerAvailability(r);else{let g;if(r.type==="server"){let{derivedAddress:s}=N(r,this.chain,n(this,u).projectId,n(this,u).environment);g=`server:${s}`}else g=K(r);if(!(yield this.signerIsRegistered(g)))throw new Error(`Signer "${g}" is not registered in this wallet.`);f(this,x,!1)}let t=this.buildInternalSignerConfig(r),i=typeof e=="string"?e:K(r);f(this,T,O(this.chain,t,(l=n(this,m))==null?void 0:l.deviceSignerKeyStorage)),a.info("wallet.useSigner.success",{signerLocator:i})})}signerIsRegistered(e){return w(this,null,function*(){return(yield this.signers()).some(t=>t.locator===e)})}needsRecovery(){return n(this,x)}recover(){return w(this,null,function*(){var g;if(a.info("wallet.recover.start"),n(this,T)==null&&(yield this.initDeviceSigner()),n(this,T)==null||n(this,T).type!=="device"){a.warn("wallet.recover.skipped",{reason:"Recovery is only supported for device signers"});return}if(n(this,P)){a.info("wallet.recover.skipped",{reason:"Device signer already approved (cached)"});return}let e=n(this,T).locator();if(yield this.signerIsRegistered(e)){a.info("wallet.recover.skipped",{reason:"Device signer already approved"}),f(this,x,!1),f(this,P,!0);return}let t=(g=n(this,m))==null?void 0:g.deviceSignerKeyStorage;if(t==null)throw new Error("Device signer key storage is required to recover a device signer");let l=`device:${yield t.generateKey({address:this.address})}`;try{yield this.addSigner({type:"device",locator:l})}catch(c){throw a.error("wallet.recover.device.error",{error:c}),yield t.deleteKey(this.address),c}f(this,T,O(this.chain,{type:"device",locator:l,address:this.address},t)),a.info("wallet.recover.device.success",{signerLocator:l}),f(this,x,!1),f(this,P,!0)})}signers(){return w(this,null,function*(){var l,g;a.info("wallet.signers.start");let e=yield n(this,u).getWallet(this.walletLocator);if("error"in e)throw a.error("wallet.signers.error",{error:e}),new M(JSON.stringify(e));if(e.type!=="smart"||e.chainType!=="evm"&&e.chainType!=="solana"&&e.chainType!=="stellar")throw a.error("wallet.signers.error",{error:`Wallet type ${e.type} not supported`}),new j(`Wallet type ${e.type} not supported`);let r=(g=(l=e==null?void 0:e.config)==null?void 0:l.delegatedSigners)!=null?g:[];if(this.chain==="solana"||this.chain==="stellar"){let c=r.map(s=>G(s,"success"));return a.info("wallet.signers.success",{count:c.length}),c}let i=(yield Promise.all(r.map(c=>w(this,null,function*(){if(c.locator.startsWith("device:"))return G(c,"success");try{let s=yield n(this,u).getSigner(this.walletLocator,c.locator);return"error"in s?null:H(s,this.chain)}catch(s){return null}})))).filter(c=>c!=null);return a.info("wallet.signers.success",{count:i.length}),i})}get walletLocator(){if(n(this,u).isServerSide)return this.address;{let e;switch(this.chain){case"stellar":e="me:stellar:smart";break;case"solana":e="me:solana:smart";break;default:e="me:evm:smart";break}let r=this.alias!=null?`:alias:${this.alias}`:"";return e+r}}requireSigner(){if(n(this,T)==null)throw new Error("This wallet is read-only because no signer was provided. Operations that require signing (send, approve, addSigner, etc.) are not available.");return n(this,T)}preAuthIfNeeded(){return w(this,null,function*(){yield n(this,R),n(this,W)==null&&f(this,W,this.recover());try{yield n(this,W)}finally{f(this,W,null)}let e=this.requireSigner();e instanceof re&&(yield e.ensureAuthenticated())})}resolveSignerInput(e){if(typeof e=="string"){let{type:r,value:t}=te(e);switch(r){case"email":return{type:"email",email:t};case"phone":return{type:"phone",phone:t};case"passkey":return{type:"passkey",id:t};case"device":return C({type:"device"},t?{locator:e}:{});case"external-wallet":return{type:"external-wallet",address:t};case"api-key":return{type:"api-key"};default:throw new Error(`Unknown signer type: ${r}`)}}return e}validateSignerInput(e){switch(e.type){case"email":if(!("email"in e)||e.email==null)throw new Error("Email signer requires an email address");break;case"phone":if(!("phone"in e)||e.phone==null)throw new Error("Phone signer requires a phone number");break;case"external-wallet":if(!("address"in e)||e.address==null)throw new Error("External wallet signer requires a wallet address");break;case"passkey":case"device":case"api-key":break;default:break}}resolveDeviceSignerAvailability(e){return w(this,null,function*(){var g;let r=(g=n(this,m))==null?void 0:g.deviceSignerKeyStorage;if(r==null)throw new Error("Device signer key storage is required for device signers");let t=yield r.getKey(this.address);if(t!=null){e.locator=`device:${t}`;return}let l=(yield this.signers()).filter(c=>c.locator.startsWith("device:"));for(let c of l){let s=c.locator.replace("device:","");if(yield r.hasKey(s)){yield r.mapAddressToKey(this.address,s),e.locator=c.locator;return}}f(this,x,!0),f(this,P,!1)})}buildInternalSignerConfig(e){var r,t,i,l,g,c;switch(e.type){case"email":return{type:"email",email:e.email,locator:`email:${e.email}`,address:this.address,crossmint:n(this,u).crossmint,clientTEEConnection:(r=n(this,m))==null?void 0:r.clientTEEConnection,onAuthRequired:(i=(t=n(this,m))==null?void 0:t.callbacks)==null?void 0:i.onAuthRequired};case"phone":return{type:"phone",phone:e.phone,locator:`phone:${e.phone}`,address:this.address,crossmint:n(this,u).crossmint,clientTEEConnection:(l=n(this,m))==null?void 0:l.clientTEEConnection,onAuthRequired:(c=(g=n(this,m))==null?void 0:g.callbacks)==null?void 0:c.onAuthRequired};case"passkey":{let s="id"in e&&e.id?e.id:"";return{type:"passkey",id:s,locator:`passkey:${s}`,name:"name"in e?e.name:void 0,publicKey:"publicKey"in e?e.publicKey:void 0,onCreatePasskey:e.onCreatePasskey,onSignWithPasskey:e.onSignWithPasskey}}case"device":return{type:"device",locator:"locator"in e&&e.locator?e.locator:void 0,address:this.address};case"external-wallet":return b(C({},e),{locator:`external-wallet:${e.address}`});case"api-key":return{type:"api-key",locator:"api-key",address:this.address};case"server":{let{derivedKeyBytes:s,derivedAddress:o}=N(e,this.chain,n(this,u).projectId,n(this,u).environment);return{type:"server",derivedKeyBytes:s,locator:`server:${o}`,address:o}}default:throw new Error(`Unknown signer type: ${e==null?void 0:e.type}`)}}get isSolanaWallet(){return this.chain==="solana"}resolveChainForEnvironment(){let e=ee(this.chain,n(this,u).environment);return e!==this.chain&&(this.chain=e),this.chain}approveTransactionAndWait(e,r){return w(this,null,function*(){return yield this.approveTransactionInternal(e,r),yield this.sleep(1e3),yield this.waitForTransaction(e)})}approveSignatureAndWait(e,r){return w(this,null,function*(){let t=yield this.approveSignatureInternal(e,r);return!("error"in t)&&t.status==="success"&&t.outputSignature!=null?{signature:t.outputSignature,signatureId:e}:(yield this.sleep(1e3),yield this.waitForSignature(e))})}approveSignatureInternal(e,r){return w(this,null,function*(){var s,o;if(this.isSolanaWallet)throw new Error("Approving signatures is only supported for EVM smart wallets");let t=this.requireSigner(),i=yield n(this,u).getSignature(this.walletLocator,e);if("error"in i)throw new D(JSON.stringify(i));if(t.type==="api-key")return i;if((r==null?void 0:r.approval)!=null){let d=[r.approval];return yield this.executeApproveSignatureWithErrorHandling(e,d)}let l=(s=i.approvals)==null?void 0:s.pending;if(l==null)return i;let g=[...(o=r==null?void 0:r.additionalSigners)!=null?o:[],t],c=yield Promise.all(l.map(d=>w(this,null,function*(){let p=g.find(y=>y.locator()===d.signer.locator);if(p==null)throw new q(`Signer ${d.signer.locator} not found in pending approvals`);let S=yield p.signMessage(d.message);return b(C({},S),{signer:p.locator()})})));return yield this.executeApproveSignatureWithErrorHandling(e,c)})}approveTransactionInternal(e,r){return w(this,null,function*(){var s,o,d,p,S;let t=yield n(this,u).getTransaction(this.walletLocator,e);if("error"in t)throw new J(JSON.stringify(t));yield(d=(o=(s=n(this,m))==null?void 0:s.callbacks)==null?void 0:o.onTransactionStart)==null?void 0:d.call(o);let i=this.requireSigner();if(i.type==="api-key")return t;if((r==null?void 0:r.approval)!=null){let y=[r.approval];return yield this.executeApproveTransactionWithErrorHandling(e,y)}let l=(p=t.approvals)==null?void 0:p.pending;if(l==null)return t;let g=[...(S=r==null?void 0:r.additionalSigners)!=null?S:[],i],c=yield Promise.all(l.map(y=>w(this,null,function*(){let h=g.find(ie=>ie.locator()===y.signer.locator);if(h==null)throw new q(`Signer ${y.signer.locator} not found in pending approvals`);let L=h.type==="device",$=t.chainType==="solana"&&"transaction"in t.onChain&&!L?t.onChain.transaction:y.message,ne=yield h.signTransaction($);return b(C({},ne),{signer:h.locator()})})));return yield this.executeApproveTransactionWithErrorHandling(e,c)})}executeApproveTransactionWithErrorHandling(e,r){return w(this,null,function*(){a.info("wallet.approve: submitting approval to API",{transactionId:e});let t=yield n(this,u).approveTransaction(this.walletLocator,e,{approvals:r});if(t.error)throw new Z(JSON.stringify(t));return t})}executeApproveSignatureWithErrorHandling(e,r){return w(this,null,function*(){let t=yield n(this,u).approveSignature(this.walletLocator,e,{approvals:r});if(t.error)throw new _(JSON.stringify(t));return t})}waitForSignature(e){return w(this,null,function*(){let r=null;do if(yield new Promise(t=>setTimeout(t,B)),r=yield n(this,u).getSignature(this.walletLocator,e),"error"in r)throw new D(JSON.stringify(r));while(r===null||r.status==="pending");if(r.status==="failed")throw new U("Signature signing failed");if(!r.outputSignature)throw new D("Signature not available");return{signature:r.outputSignature,signatureId:e}})}waitForTransaction(g){return w(this,arguments,function*(e,r=6e4,{backoffMultiplier:t=1.1,maxBackoffMs:i=2e3,initialBackoffMs:l=B}={}){var d;a.info("wallet.approve: waiting for transaction confirmation",{transactionId:e,timeoutMs:r});let c=Date.now(),s;do{if(Date.now()-c>r)throw new z("Transaction confirmation timeout");if(s=yield n(this,u).getTransaction(this.walletLocator,e),s.error)throw new J(JSON.stringify(s));yield this.sleep(l),l=Math.min(l*t,i)}while(s.status==="pending");if(s.status==="failed")throw new Q(`Transaction sending failed: ${JSON.stringify(s.error)}`);if(s.status==="awaiting-approval")throw new X("Transaction is awaiting approval. Please submit required approvals before waiting for completion.");let o=s.onChain.txId;if(o==null)throw new Y("Transaction hash not found on transaction response");return{hash:o,explorerLink:(d=s.onChain.explorerLink)!=null?d:"",transactionId:s.id}})}sleep(e){return w(this,null,function*(){return new Promise(r=>setTimeout(r,e))})}};T=new WeakMap,m=new WeakMap,u=new WeakMap,F=new WeakMap,x=new WeakMap,P=new WeakMap,R=new WeakMap,W=new WeakMap,k([I({logger:a,methodName:"wallet.balances",buildContext(e){return{chain:e.chain,address:e.address}}})],E.prototype,"balances",1),k([I({logger:a,methodName:"wallet.stagingFund",buildContext(e){return{chain:e.chain,address:e.address}}})],E.prototype,"stagingFund",1),k([I({logger:a,methodName:"wallet.send",buildContext(e){return{chain:e.chain,address:e.address}}})],E.prototype,"send",1),k([I({logger:a,methodName:"wallet.approve",buildContext(e){return{chain:e.chain,address:e.address}}})],E.prototype,"approve",1),k([I({logger:a,methodName:"wallet.addSigner",buildContext(e){return{chain:e.chain,address:e.address}}})],E.prototype,"addSigner",1),k([I({logger:a,methodName:"wallet.useSigner",buildContext(e){return{chain:e.chain,address:e.address}}})],E.prototype,"useSigner",1),k([I({logger:a,methodName:"wallet.recover",buildContext(e){return{chain:e.chain,address:e.address}}})],E.prototype,"recover",1),k([I({logger:a,methodName:"wallet.signers",buildContext(e){return{chain:e.chain,address:e.address}}})],E.prototype,"signers",1);function se(v){if(typeof v=="string")return v;if("email"in v)return`email:${v.email}`;if("x"in v)return`x:${v.x}`;if("twitter"in v)return`twitter:${v.twitter}`;if("phone"in v)return`phoneNumber:${v.phone}`;if("userId"in v)return`userId:${v.userId}`;throw new Error("Invalid recipient locator")}function oe(v,e){return ae(v)?`${e}:${v}`:`${e}:${v.toLowerCase()}`}export{E as a};
@@ -0,0 +1 @@
1
+ import{a as s}from"./chunk-2YLRFJ66.js";import{x as a}from"./chunk-PSXRNSOE.js";import{g as e}from"./chunk-J3R36SGJ.js";import{PublicKey as h,VersionedTransaction as f}from"@solana/web3.js";import o from"bs58";var l=class extends s{constructor(n){super(n),this.onSign=n.onSign}signMessage(){return e(this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for solana external wallet signer"))})}signTransaction(n){return e(this,null,function*(){if(this.onSign==null)throw new Error("[SolanaExternalWalletSigner] No onSign callback provided. Pass an onSign callback when configuring the external wallet signer.");let c=o.decode(n),g=f.deserialize(c),t=yield this.onSign(g),d=new h(this._address),i=t.message.staticAccountKeys.findIndex(m=>m.equals(d));if(i===-1)throw new a("Wallet public key not found in transaction signers");let r=t.signatures[i];if(r==null)throw new a("No valid signature found in the transaction");let u=new Uint8Array(Object.values(r));return{signature:o.encode(u)}})}};export{l as a};
@@ -0,0 +1 @@
1
+ import{hkdf as l}from"@noble/hashes/hkdf";import{sha256 as f}from"@noble/hashes/sha2";import{bytesToHex as u}from"@noble/hashes/utils";var h="crossmint",g="xmsk1_";function v(t,r,n,e){let i=d(t),s=m(i),o=E(e),c=`${r}:${n}:${e}-${o}`;return l(f,s,h,c,32)}function S(t,r,n,e){let i=d(t),s=m(i),o=`${r}:${n}:${e}-alias`,c=l(f,s,h,o,17);return`s-${u(c).slice(0,34)}`}var a=64;function d(t){let r=t.startsWith(g)?t.slice(g.length):t;if(r.length!==a)throw new Error(`Invalid server signer secret: expected ${a}-char hex string (256-bit), got ${r.length} chars`);return r}function E(t){return t==="solana"||t==="stellar"?"ed25519":"secp256k1"}function m(t){if(t.length%2!==0)throw new Error(`Invalid hex string: odd length (${t.length})`);if(!/^[0-9a-fA-F]+$/.test(t))throw new Error("Invalid hex string: contains non-hex characters");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=parseInt(t.slice(n,n+2),16);return r}export{v as a,S as b};
@@ -0,0 +1 @@
1
+ import{a as e}from"./chunk-2YLRFJ66.js";import{g as i}from"./chunk-J3R36SGJ.js";var t=class extends e{constructor(n){super(n),this.onSign=n.onSign}signMessage(n){return i(this,null,function*(){if(this.onSign==null)throw new Error("[EVMExternalWalletSigner] No onSign callback provided. Pass an onSign callback when configuring the external wallet signer.");let r=yield this.onSign(n);if(r==null)throw new Error("[EVMExternalWalletSigner] Failed to sign message: onSign returned null");return{signature:r}})}signTransaction(n){return i(this,null,function*(){return yield this.signMessage(n)})}};export{t as a};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkJBP52JOHcjs = require('./chunk-JBP52JOH.cjs');var _chunk5QIW67NUcjs = require('./chunk-5QIW67NU.cjs');var _chunkS4O54O4Ccjs = require('./chunk-S4O54O4C.cjs');var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var f=class{constructor(r){this.config=r;this._needsAuth=!0;this._authPromise=null;this._initializationPromise=null;typeof window!="undefined"&&(this._initializationPromise=this.initialize()),this.type=this.config.type}locator(){return this.config.locator}address(){return this.config.address}initialize(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){try{if(this.config.clientTEEConnection==null){let r=_commonsdkbase.validateAPIKey.call(void 0, this.config.crossmint.apiKey);if(!r.isValid)throw new Error("Invalid API key");let t=new (0, _chunkJBP52JOHcjs.a)({environment:r.environment});this.config.clientTEEConnection=yield t.initialize()}}finally{this._initializationPromise=null}})}getTEEConnection(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){if(this.config.clientTEEConnection==null){if(this._initializationPromise){if(yield this._initializationPromise,this.config.clientTEEConnection==null)throw new Error("Failed to initialize TEE connection");return this.config.clientTEEConnection}this._initializationPromise=this.initializeTEEConnection();try{yield this._initializationPromise}finally{this._initializationPromise=null}}if(this.config.clientTEEConnection==null)throw new Error("TEE connection is not initialized");return this.config.clientTEEConnection})}initializeTEEConnection(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){_chunkS4O54O4Ccjs.a.info("TEE connection not initialized, initializing now");let r=_commonsdkbase.validateAPIKey.call(void 0, this.config.crossmint.apiKey);if(!r.isValid)throw new Error("Invalid API key");let t=new (0, _chunkJBP52JOHcjs.a)({environment:r.environment});if(this.config.clientTEEConnection=yield t.initialize(),this.config.clientTEEConnection==null)throw new Error("Failed to initialize TEE connection");_chunkS4O54O4Ccjs.a.info("TEE connection initialized successfully")})}handleAuthRequired(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var u;let r=yield this.getTEEConnection();if(this.config.onAuthRequired==null)throw new Error(`${this.type} signer requires the onAuthRequired callback to handle OTP verification. This callback manages the authentication flow (sending OTP and verifying user input). If using our React/React Native SDK, this is handled automatically by the provider. For other environments, implement: onAuthRequired: (needsAuth, sendOtp, verifyOtp, reject) => { /* your UI logic */ }`);_chunkS4O54O4Ccjs.a.info("get-status: sending request");let t=Date.now(),n=yield r.sendAction({event:"request:get-status",responseEvent:"response:get-status",data:{authData:{jwt:(u=this.config.crossmint.jwt)!=null?u:"",apiKey:this.config.crossmint.apiKey}},options:d}),e=Date.now()-t;if((n==null?void 0:n.status)!=="success")throw _chunkS4O54O4Ccjs.a.error("get-status: failed",{status:n==null?void 0:n.status,error:n==null?void 0:n.error,durationMs:e}),new Error(n==null?void 0:n.error);if(_chunkS4O54O4Ccjs.a.info("get-status: response received",{signerStatus:n.signerStatus,durationMs:e}),n.signerStatus==="ready"){this._needsAuth=!1;return}else this._needsAuth=!0;_chunkS4O54O4Ccjs.a.info("Auth required, initiating OTP flow",{needsAuth:this._needsAuth});let{promise:s,resolve:h,reject:c}=this.createAuthPromise();if(this._authPromise={promise:s,resolve:h,reject:c},this.config.onAuthRequired)try{yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),i=>this.verifyOtp(i),()=>_chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){_chunkS4O54O4Ccjs.a.info("Auth rejected",{authRejected:!0}),this._needsAuth=!1,this.config.onAuthRequired!=null&&(yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),i=>this.verifyOtp(i),()=>{var i;return(i=this._authPromise)==null?void 0:i.reject(new _chunk5QIW67NUcjs.a)})),c(new _chunk5QIW67NUcjs.a)}))}catch(i){_chunkS4O54O4Ccjs.a.error("handleAuthRequired error",{error:i}),c(i)}try{yield s}catch(i){throw _chunkS4O54O4Ccjs.a.error("handleAuthRequired promise error",{error:i}),i}})}ensureAuthenticated(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){yield this.handleAuthRequired()})}getJwtOrThrow(){let r=this.config.crossmint.jwt;if(r==null)throw new Error("JWT is required");return r}createAuthPromise(){let r,t;return{promise:new Promise((e,s)=>{r=e,t=s}),resolve:r,reject:t}}sendMessageWithOtp(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var h,c;let r=yield this.getTEEConnection(),t=this.getAuthId();_chunkS4O54O4Ccjs.a.info("start-onboarding: sending request");let n=Date.now(),e=yield r.sendAction({event:"request:start-onboarding",responseEvent:"response:start-onboarding",data:{authData:{jwt:(h=this.config.crossmint.jwt)!=null?h:"",apiKey:this.config.crossmint.apiKey},data:{authId:t}},options:d}),s=Date.now()-n;if(_chunkS4O54O4Ccjs.a.info("start-onboarding: response received",{status:e==null?void 0:e.status,durationMs:s}),(e==null?void 0:e.status)==="success"&&e.signerStatus==="ready"){this._needsAuth=!1;return}(e==null?void 0:e.status)==="error"&&(_chunkS4O54O4Ccjs.a.error("start-onboarding: failed",{error:e.error}),(c=this._authPromise)==null||c.reject(new Error(e.error||"Failed to initiate OTP process.")))})}getAuthId(){return this.config.type==="email"?`email:${this.config.email}`:`phone:${this.config.phone}`}verifyOtp(r){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var s,h,c,u;let t;try{let i=yield this.getTEEConnection();_chunkS4O54O4Ccjs.a.info("complete-onboarding: sending request");let E=Date.now();t=yield i.sendAction({event:"request:complete-onboarding",responseEvent:"response:complete-onboarding",data:{authData:{jwt:(s=this.config.crossmint.jwt)!=null?s:"",apiKey:this.config.crossmint.apiKey},data:{onboardingAuthentication:{encryptedOtp:r}}},options:d}),_chunkS4O54O4Ccjs.a.info("complete-onboarding: response received",{status:t==null?void 0:t.status,durationMs:Date.now()-E})}catch(i){throw _chunkS4O54O4Ccjs.a.error("complete-onboarding: error",{error:i}),this._needsAuth=!0,(h=this._authPromise)==null||h.reject(i),i}if((t==null?void 0:t.status)==="success"){this._needsAuth=!1,this.config.onAuthRequired!=null&&(yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),i=>this.verifyOtp(i),()=>{var i;return(i=this._authPromise)==null?void 0:i.reject(new _chunk5QIW67NUcjs.a)})),(c=this._authPromise)==null||c.resolve();return}_chunkS4O54O4Ccjs.a.error("complete-onboarding: OTP validation failed",{status:t==null?void 0:t.status}),this._needsAuth=!0;let n=(t==null?void 0:t.status)==="error"?t.error:"Failed to validate encrypted OTP",e=new Error(n);throw(u=this._authPromise)==null||u.reject(e),e})}_exportPrivateKey(r){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){yield this.handleAuthRequired();let t=this.getJwtOrThrow(),{scheme:n,encoding:e}=this.getChainKeyParams(),s=yield r.sendAction({event:"request:export-signer",responseEvent:"response:export-signer",data:{authData:{jwt:t,apiKey:this.config.crossmint.apiKey},data:{scheme:n,encoding:e}},options:d});if((s==null?void 0:s.status)==="error")throw new Error(s.error||"Failed to export private key")})}};_chunk2GKPWQBQcjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkS4O54O4Ccjs.a,methodName:"handleAuthRequired"})],f.prototype,"handleAuthRequired",1);var d={timeoutMs:3e4};exports.a = f; exports.b = d;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _hkdf = require('@noble/hashes/hkdf');var _sha2 = require('@noble/hashes/sha2');var _utils = require('@noble/hashes/utils');var h="crossmint",g="xmsk1_";function A(t,r,n,e){let i=d(t),s=m(i),o=E(e),c=`${r}:${n}:${e}-${o}`;return _hkdf.hkdf.call(void 0, _sha2.sha256,s,h,c,32)}function v(t,r,n,e){let i=d(t),s=m(i),o=`${r}:${n}:${e}-alias`,c=_hkdf.hkdf.call(void 0, _sha2.sha256,s,h,o,17);return`s-${_utils.bytesToHex.call(void 0, c).slice(0,34)}`}var a=64;function d(t){let r=t.startsWith(g)?t.slice(g.length):t;if(r.length!==a)throw new Error(`Invalid server signer secret: expected ${a}-char hex string (256-bit), got ${r.length} chars`);return r}function E(t){return t==="solana"||t==="stellar"?"ed25519":"secp256k1"}function m(t){if(t.length%2!==0)throw new Error(`Invalid hex string: odd length (${t.length})`);if(!/^[0-9a-fA-F]+$/.test(t))throw new Error("Invalid hex string: contains non-hex characters");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=parseInt(t.slice(n,n+2),16);return r}exports.a = A; exports.b = v;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkD5YDWSO5cjs = require('./chunk-D5YDWSO5.cjs');var _chunkS4O54O4Ccjs = require('./chunk-S4O54O4C.cjs');var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var _ox = require('ox');var b={[_commonsdkbase.APIKeyEnvironmentPrefix.DEVELOPMENT]:"https://development.devicekey.store",[_commonsdkbase.APIKeyEnvironmentPrefix.STAGING]:"https://staging.devicekey.store",[_commonsdkbase.APIKeyEnvironmentPrefix.PRODUCTION]:"https://devicekey.store"},P=6e4,K="indexeddb-fatal",c= exports.a =class extends _chunkD5YDWSO5cjs.a{constructor(e){super(e);this.iframePromise=null;this.reloading=null;this.biometricRequestHandler=null;this.biometricListener=null;let r=_commonsdkbase.getEnvironmentForKey.call(void 0, e);if(r==null)throw new Error("Unable to determine environment from API key");this.iframeUrl=b[r]}setBiometricRequestHandler(e){this.biometricRequestHandler=e}generateKey(){return _chunk2GKPWQBQcjs.g.call(void 0, this,arguments,function*(e={biometricPolicy:"none"}){return(yield this.rpc("generateKey",e)).publicKeyBase64})}mapAddressToKey(e,r){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){yield this.rpc("mapAddressToKey",{address:e,publicKeyBase64:r})})}getKey(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return(yield this.rpc("getKey",{address:e})).publicKeyBase64})}hasKey(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return(yield this.rpc("hasKey",{publicKeyBase64:e})).hasKey})}signMessage(e,r){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return yield this.rpc("signMessage",{address:e,message:r})})}deleteKey(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){yield this.rpc("deleteKey",{address:e})})}destroy(){this.biometricListener!=null&&(window.removeEventListener("message",this.biometricListener),this.biometricListener=null),this.iframePromise!=null&&(this.iframePromise.then(e=>e.remove()).catch(()=>{}),this.iframePromise=null)}rpc(e,r){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let o=yield this.sendRpc(e,r);if(o.fatal){_chunkS4O54O4Ccjs.a.warn(`[IframeDeviceSignerKeyStorage] Recoverable IDB error on "${e}", reloading iframe and retrying`),yield this.reloadIframe();let t=yield this.sendRpc(e,r);if(t.fatal)throw new Error(`Device signer IDB fatal error on "${e}" persisted after iframe reload`);return t.value}return o.value})}sendRpc(e,r){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let t=(yield this.getIframe()).contentWindow;if(t==null)throw new Error("Device signer iframe has no contentWindow");let g=crypto.randomUUID(),a=new URL(this.iframeUrl).origin;return new Promise((n,s)=>{let p=setTimeout(()=>{window.removeEventListener("message",h),s(new Error(`Device signer RPC "${e}" timed out after ${P}ms`))},P);function h(f){let m=f.data;m==null||m.id!==g||f.origin===a&&(clearTimeout(p),window.removeEventListener("message",h),m.type==="error"&&m.code===K?n({fatal:!0}):m.type==="error"?s(new Error(m.error)):n({value:m.result,fatal:!1}))}window.addEventListener("message",h),t.postMessage({type:e,id:g,payload:r},this.iframeUrl)})})}reloadIframe(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){if(this.reloading!=null)return this.reloading;let e=_chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){try{this.destroy(),yield this.getIframe()}finally{this.reloading=null}});return this.reloading=e,e})}setupBiometricListener(e){let r=new URL(this.iframeUrl).origin;this.biometricListener=o=>_chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){if(o.origin!==r)return;let t=o.data;if((t==null?void 0:t.type)!=="biometric-request")return;let g=e.contentWindow;if(g!=null)try{this.biometricRequestHandler!=null&&(yield this.biometricRequestHandler(t.action));let a=null;if(t.action==="createCredential"){let n=t.payload,s=yield _ox.WebAuthnP256.createCredential({name:n.name});a={id:s.id,publicKey:{x:`0x${s.publicKey.x.toString(16)}`,y:`0x${s.publicKey.y.toString(16)}`}}}else if(t.action==="sign"){let n=t.payload,{signature:s,metadata:p}=yield _ox.WebAuthnP256.sign({credentialId:n.credentialId,challenge:n.challenge});a={signature:{r:`0x${s.r.toString(16)}`,s:`0x${s.s.toString(16)}`},metadata:p}}g.postMessage({type:"biometric-response",id:t.id,result:a},this.iframeUrl)}catch(a){let n=a instanceof Error?a.message:"Unknown biometric error";g.postMessage({type:"biometric-response",id:t.id,error:n},this.iframeUrl)}}),window.addEventListener("message",this.biometricListener)}getIframe(){return this.iframePromise==null&&(this.iframePromise=this.createIframe().catch(e=>{throw this.iframePromise=null,e})),this.iframePromise}createIframe(){let e=document.createElement("iframe");return e.src=this.iframeUrl,Object.assign(e.style,{position:"absolute",opacity:"0",pointerEvents:"none",width:"0",height:"0",border:"none",top:"-9999px",left:"-9999px"}),new Promise((r,o)=>{e.onload=()=>{this.setupBiometricListener(e),r(e)},e.onerror=()=>o(new Error("Failed to load device signer iframe")),document.body.appendChild(e)})}};_chunk2GKPWQBQcjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkS4O54O4Ccjs.a,methodName:"deviceSignerKeyStorage.generateKey"})],c.prototype,"generateKey",1),_chunk2GKPWQBQcjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkS4O54O4Ccjs.a,methodName:"deviceSignerKeyStorage.mapAddressToKey"})],c.prototype,"mapAddressToKey",1),_chunk2GKPWQBQcjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkS4O54O4Ccjs.a,methodName:"deviceSignerKeyStorage.getKey"})],c.prototype,"getKey",1),_chunk2GKPWQBQcjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkS4O54O4Ccjs.a,methodName:"deviceSignerKeyStorage.hasKey"})],c.prototype,"hasKey",1),_chunk2GKPWQBQcjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkS4O54O4Ccjs.a,methodName:"deviceSignerKeyStorage.signMessage"})],c.prototype,"signMessage",1),_chunk2GKPWQBQcjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkS4O54O4Ccjs.a,methodName:"deviceSignerKeyStorage.deleteKey"})],c.prototype,"deleteKey",1);exports.a = c;