@crossmint/wallets-sdk 1.18.0 → 1.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (305) hide show
  1. package/dist/api/__tests__/constants.d.cts +1 -1
  2. package/dist/api/__tests__/constants.d.ts +1 -1
  3. package/dist/api/__tests__/test-utils.cjs +1 -1
  4. package/dist/api/__tests__/test-utils.d.cts +1 -1
  5. package/dist/api/__tests__/test-utils.d.ts +1 -1
  6. package/dist/api/__tests__/test-utils.js +1 -1
  7. package/dist/api/client.cjs +1 -1
  8. package/dist/api/client.d.cts +1 -1
  9. package/dist/api/client.d.ts +1 -1
  10. package/dist/api/client.js +1 -1
  11. package/dist/api/index.cjs +1 -1
  12. package/dist/api/index.d.cts +1 -1
  13. package/dist/api/index.d.ts +1 -1
  14. package/dist/api/index.js +1 -1
  15. package/dist/api/types.d.cts +1 -1
  16. package/dist/api/types.d.ts +1 -1
  17. package/dist/chains/adapters/evm.cjs +1 -1
  18. package/dist/chains/adapters/evm.d.cts +1 -1
  19. package/dist/chains/adapters/evm.d.ts +1 -1
  20. package/dist/chains/adapters/evm.js +1 -1
  21. package/dist/chains/adapters/solana.cjs +1 -1
  22. package/dist/chains/adapters/solana.d.cts +1 -1
  23. package/dist/chains/adapters/solana.d.ts +1 -1
  24. package/dist/chains/adapters/solana.js +1 -1
  25. package/dist/chains/adapters/stellar.cjs +1 -1
  26. package/dist/chains/adapters/stellar.d.cts +1 -1
  27. package/dist/chains/adapters/stellar.d.ts +1 -1
  28. package/dist/chains/adapters/stellar.js +1 -1
  29. package/dist/chains/chain-adapter.cjs +1 -1
  30. package/dist/chains/chain-adapter.d.cts +1 -1
  31. package/dist/chains/chain-adapter.d.ts +1 -1
  32. package/dist/chains/chain-adapter.js +1 -1
  33. package/dist/chains/chains.cjs +1 -1
  34. package/dist/chains/chains.js +1 -1
  35. package/dist/{chunk-3UROOLIH.js → chunk-266RS53K.js} +1 -1
  36. package/dist/{chunk-KSPUJL3Z.js → chunk-2E6IJLDW.js} +1 -1
  37. package/dist/{chunk-PU3WUUJ6.js → chunk-2J5RPKHK.js} +1 -1
  38. package/dist/{chunk-SWQSW2AD.js → chunk-2KGAVQXR.js} +1 -1
  39. package/dist/{chunk-VOFCBB2P.js → chunk-2YLAHC7J.js} +1 -1
  40. package/dist/{chunk-T5EOJ3ZF.cjs → chunk-36GZTRZX.cjs} +1 -1
  41. package/dist/{chunk-SH6HXAB2.js → chunk-3F4Z2URU.js} +1 -1
  42. package/dist/{chunk-MUOGCO7D.cjs → chunk-3FQB7LST.cjs} +1 -1
  43. package/dist/chunk-3FUVUUXU.cjs +1 -0
  44. package/dist/{chunk-T5LUBX5J.cjs → chunk-3SSOE7BV.cjs} +2 -2
  45. package/dist/chunk-3W22A7E7.js +1 -0
  46. package/dist/chunk-4I3EXM4B.js +1 -0
  47. package/dist/{chunk-3RVLLQ4M.cjs → chunk-4LXZPDTP.cjs} +1 -1
  48. package/dist/{chunk-AB2JJTW4.js → chunk-54LGZZX4.js} +1 -1
  49. package/dist/{chunk-STB2VIIK.cjs → chunk-5GYSXH4X.cjs} +1 -1
  50. package/dist/chunk-67VE25UL.js +1 -0
  51. package/dist/{chunk-F7DCMK3I.cjs → chunk-6XLTNU2N.cjs} +1 -1
  52. package/dist/{chunk-AIAYUJJG.cjs → chunk-AEHDAUN4.cjs} +1 -1
  53. package/dist/{chunk-P5VJ455G.cjs → chunk-B45GSXKN.cjs} +1 -1
  54. package/dist/{chunk-R2XC4F3M.cjs → chunk-BJJXTZJB.cjs} +1 -1
  55. package/dist/chunk-C5LIXILN.js +1 -0
  56. package/dist/{chunk-ZAIKHHRP.cjs → chunk-CFRSSHAG.cjs} +1 -1
  57. package/dist/{chunk-XUWIECBY.cjs → chunk-CMER6QR6.cjs} +1 -1
  58. package/dist/chunk-D2S37DJ5.cjs +1 -0
  59. package/dist/{chunk-7SDHPRH6.js → chunk-DBFCNM4F.js} +1 -1
  60. package/dist/{chunk-PJAMNLC2.js → chunk-DCZP3IV7.js} +1 -1
  61. package/dist/{chunk-PWVGLO7T.cjs → chunk-DXF5442W.cjs} +1 -1
  62. package/dist/{chunk-JAXFDUNN.js → chunk-ECKSTWA3.js} +1 -1
  63. package/dist/{chunk-O673G7YH.cjs → chunk-FNDMOANS.cjs} +1 -1
  64. package/dist/{chunk-IN5ZETZE.cjs → chunk-GAKX357N.cjs} +1 -1
  65. package/dist/{chunk-FYWSZVID.cjs → chunk-GBTTVLK5.cjs} +1 -1
  66. package/dist/{chunk-ZRIMMPXR.cjs → chunk-HHA4QJLV.cjs} +1 -1
  67. package/dist/{chunk-PKFCOQOM.js → chunk-HHY65A7I.js} +1 -1
  68. package/dist/{chunk-PHIW7FUJ.cjs → chunk-HITDGEGW.cjs} +1 -1
  69. package/dist/chunk-HLI46UDR.js +1 -0
  70. package/dist/{chunk-AEO4REZV.js → chunk-HQ2RXBAN.js} +1 -1
  71. package/dist/{chunk-ZDKIEL5N.cjs → chunk-HUZNB3IW.cjs} +1 -1
  72. package/dist/{chunk-RE6GCFXZ.js → chunk-J5VWZVHL.js} +1 -1
  73. package/dist/{chunk-D6UK5JAA.cjs → chunk-JI3OXPVC.cjs} +1 -1
  74. package/dist/{chunk-OIBCJAF2.cjs → chunk-KQDPQXLL.cjs} +1 -1
  75. package/dist/chunk-LEPWAFFZ.js +1 -0
  76. package/dist/{chunk-QQDUYSLH.cjs → chunk-MI3DBGDV.cjs} +1 -1
  77. package/dist/{chunk-LVSOX532.cjs → chunk-MT2D5VRF.cjs} +1 -1
  78. package/dist/{chunk-ZV2UOOBX.js → chunk-MVGSX46H.js} +1 -1
  79. package/dist/chunk-NM33FBA3.cjs +1 -0
  80. package/dist/{chunk-OMTRYUKH.cjs → chunk-NS7UW4BA.cjs} +1 -1
  81. package/dist/chunk-O2ET3L2R.cjs +1 -0
  82. package/dist/{chunk-GC55YCPK.js → chunk-OOMMVXZB.js} +1 -1
  83. package/dist/{chunk-WVKODEVW.js → chunk-PA3RU64J.js} +1 -1
  84. package/dist/{chunk-JQIKTIVR.js → chunk-PH4EWT7R.js} +1 -1
  85. package/dist/{chunk-X56YW5CL.js → chunk-PJ76KALO.js} +1 -1
  86. package/dist/{chunk-INPOGMPS.js → chunk-PSIZCLMC.js} +1 -1
  87. package/dist/{chunk-V37HIVBA.cjs → chunk-PWHMYEUN.cjs} +1 -1
  88. package/dist/{chunk-JLWNRQ4S.js → chunk-PWYCEHYZ.js} +1 -1
  89. package/dist/{chunk-25TINDQ4.js → chunk-Q7EO6OOI.js} +1 -1
  90. package/dist/{chunk-IQ6EAHDU.cjs → chunk-QJ3BV3MW.cjs} +1 -1
  91. package/dist/{chunk-WX6KBOP5.js → chunk-QUPMMNGB.js} +1 -1
  92. package/dist/chunk-QYBC7GTA.js +1 -0
  93. package/dist/{chunk-HUGHRNQ3.js → chunk-R4LSFTQB.js} +1 -1
  94. package/dist/{chunk-BV6IQIQK.js → chunk-RV3Q5EIA.js} +1 -1
  95. package/dist/chunk-SE5L5SQK.cjs +1 -0
  96. package/dist/{chunk-T4RCLJ5G.js → chunk-UFYLMDRQ.js} +1 -1
  97. package/dist/{chunk-FTUJ5XHD.js → chunk-VG67JHRI.js} +1 -1
  98. package/dist/{chunk-FN4NQTKS.js → chunk-VW24W4N4.js} +1 -1
  99. package/dist/{chunk-KQIDRPAB.cjs → chunk-VXWRNGOB.cjs} +1 -1
  100. package/dist/{chunk-X4GV76CR.js → chunk-WRXF6ZSY.js} +1 -1
  101. package/dist/{chunk-M76VM347.cjs → chunk-WSCABGVO.cjs} +1 -1
  102. package/dist/{chunk-CZC2MNVK.cjs → chunk-WSDMIQNG.cjs} +1 -1
  103. package/dist/{chunk-YQ4GAIPZ.js → chunk-WXHLPGEB.js} +1 -1
  104. package/dist/chunk-X2CTI7IK.cjs +1 -0
  105. package/dist/chunk-XMV4T3J5.cjs +1 -0
  106. package/dist/{chunk-7PRP6CYJ.cjs → chunk-Y5JB3XEX.cjs} +1 -1
  107. package/dist/{chunk-6PNYLGI4.js → chunk-YOF3WB3D.js} +1 -1
  108. package/dist/{chunk-5V2RGAOS.js → chunk-YSR4FJK7.js} +1 -1
  109. package/dist/{chunk-SIBFVGGQ.cjs → chunk-ZACJIS35.cjs} +1 -1
  110. package/dist/{chunk-DVLQXFLW.cjs → chunk-ZR63HKN6.cjs} +1 -1
  111. package/dist/index.cjs +1 -1
  112. package/dist/index.d.cts +2 -2
  113. package/dist/index.d.ts +2 -2
  114. package/dist/index.js +1 -1
  115. package/dist/logger/index.cjs +1 -1
  116. package/dist/logger/index.js +1 -1
  117. package/dist/logger/init.cjs +1 -1
  118. package/dist/logger/init.js +1 -1
  119. package/dist/sdk.cjs +1 -1
  120. package/dist/sdk.d.cts +1 -1
  121. package/dist/sdk.d.ts +1 -1
  122. package/dist/sdk.js +1 -1
  123. package/dist/signers/descriptors/api-key.cjs +1 -1
  124. package/dist/signers/descriptors/api-key.d.cts +1 -1
  125. package/dist/signers/descriptors/api-key.d.ts +1 -1
  126. package/dist/signers/descriptors/api-key.js +1 -1
  127. package/dist/signers/descriptors/device.cjs +1 -1
  128. package/dist/signers/descriptors/device.d.cts +1 -1
  129. package/dist/signers/descriptors/device.d.ts +1 -1
  130. package/dist/signers/descriptors/device.js +1 -1
  131. package/dist/signers/descriptors/email.cjs +1 -1
  132. package/dist/signers/descriptors/email.d.cts +1 -1
  133. package/dist/signers/descriptors/email.d.ts +1 -1
  134. package/dist/signers/descriptors/email.js +1 -1
  135. package/dist/signers/descriptors/external-wallet.cjs +1 -1
  136. package/dist/signers/descriptors/external-wallet.d.cts +1 -1
  137. package/dist/signers/descriptors/external-wallet.d.ts +1 -1
  138. package/dist/signers/descriptors/external-wallet.js +1 -1
  139. package/dist/signers/descriptors/index.cjs +1 -1
  140. package/dist/signers/descriptors/index.d.cts +1 -1
  141. package/dist/signers/descriptors/index.d.ts +1 -1
  142. package/dist/signers/descriptors/index.js +1 -1
  143. package/dist/signers/descriptors/passkey.cjs +1 -1
  144. package/dist/signers/descriptors/passkey.d.cts +1 -1
  145. package/dist/signers/descriptors/passkey.d.ts +1 -1
  146. package/dist/signers/descriptors/passkey.js +1 -1
  147. package/dist/signers/descriptors/phone.cjs +1 -1
  148. package/dist/signers/descriptors/phone.d.cts +1 -1
  149. package/dist/signers/descriptors/phone.d.ts +1 -1
  150. package/dist/signers/descriptors/phone.js +1 -1
  151. package/dist/signers/descriptors/server.d.cts +1 -1
  152. package/dist/signers/descriptors/server.d.ts +1 -1
  153. package/dist/signers/descriptors/types.d.cts +1 -1
  154. package/dist/signers/descriptors/types.d.ts +1 -1
  155. package/dist/signers/device.d.cts +1 -1
  156. package/dist/signers/device.d.ts +1 -1
  157. package/dist/signers/evm-api-key.d.cts +1 -1
  158. package/dist/signers/evm-api-key.d.ts +1 -1
  159. package/dist/signers/evm-external-wallet.d.cts +1 -1
  160. package/dist/signers/evm-external-wallet.d.ts +1 -1
  161. package/dist/signers/external-wallet-signer.d.cts +1 -1
  162. package/dist/signers/external-wallet-signer.d.ts +1 -1
  163. package/dist/signers/index.cjs +1 -1
  164. package/dist/signers/index.d.cts +1 -1
  165. package/dist/signers/index.d.ts +1 -1
  166. package/dist/signers/index.js +1 -1
  167. package/dist/signers/non-custodial/index.cjs +1 -1
  168. package/dist/signers/non-custodial/index.d.cts +1 -1
  169. package/dist/signers/non-custodial/index.d.ts +1 -1
  170. package/dist/signers/non-custodial/index.js +1 -1
  171. package/dist/signers/non-custodial/ncs-evm-signer.cjs +1 -1
  172. package/dist/signers/non-custodial/ncs-evm-signer.d.cts +1 -1
  173. package/dist/signers/non-custodial/ncs-evm-signer.d.ts +1 -1
  174. package/dist/signers/non-custodial/ncs-evm-signer.js +1 -1
  175. package/dist/signers/non-custodial/ncs-signer.cjs +1 -1
  176. package/dist/signers/non-custodial/ncs-signer.d.cts +1 -1
  177. package/dist/signers/non-custodial/ncs-signer.d.ts +1 -1
  178. package/dist/signers/non-custodial/ncs-signer.js +1 -1
  179. package/dist/signers/non-custodial/ncs-solana-signer.cjs +1 -1
  180. package/dist/signers/non-custodial/ncs-solana-signer.d.cts +1 -1
  181. package/dist/signers/non-custodial/ncs-solana-signer.d.ts +1 -1
  182. package/dist/signers/non-custodial/ncs-solana-signer.js +1 -1
  183. package/dist/signers/non-custodial/ncs-stellar-signer.cjs +1 -1
  184. package/dist/signers/non-custodial/ncs-stellar-signer.d.cts +1 -1
  185. package/dist/signers/non-custodial/ncs-stellar-signer.d.ts +1 -1
  186. package/dist/signers/non-custodial/ncs-stellar-signer.js +1 -1
  187. package/dist/signers/passkey.cjs +1 -1
  188. package/dist/signers/passkey.d.cts +1 -1
  189. package/dist/signers/passkey.d.ts +1 -1
  190. package/dist/signers/passkey.js +1 -1
  191. package/dist/signers/server/assemble-server-signer.d.cts +1 -1
  192. package/dist/signers/server/assemble-server-signer.d.ts +1 -1
  193. package/dist/signers/server/evm-server-signer.d.cts +1 -1
  194. package/dist/signers/server/evm-server-signer.d.ts +1 -1
  195. package/dist/signers/server/helpers/derive-server-signer.d.cts +1 -1
  196. package/dist/signers/server/helpers/derive-server-signer.d.ts +1 -1
  197. package/dist/signers/server/helpers/index.d.cts +1 -1
  198. package/dist/signers/server/helpers/index.d.ts +1 -1
  199. package/dist/signers/server/index.d.cts +1 -1
  200. package/dist/signers/server/index.d.ts +1 -1
  201. package/dist/signers/server/resolver.d.cts +1 -1
  202. package/dist/signers/server/resolver.d.ts +1 -1
  203. package/dist/signers/server/solana-server-signer.d.cts +1 -1
  204. package/dist/signers/server/solana-server-signer.d.ts +1 -1
  205. package/dist/signers/server/stellar-server-signer.d.cts +1 -1
  206. package/dist/signers/server/stellar-server-signer.d.ts +1 -1
  207. package/dist/signers/solana-api-key.d.cts +1 -1
  208. package/dist/signers/solana-api-key.d.ts +1 -1
  209. package/dist/signers/solana-external-wallet.cjs +1 -1
  210. package/dist/signers/solana-external-wallet.d.cts +1 -1
  211. package/dist/signers/solana-external-wallet.d.ts +1 -1
  212. package/dist/signers/solana-external-wallet.js +1 -1
  213. package/dist/signers/stellar-external-wallet.d.cts +1 -1
  214. package/dist/signers/stellar-external-wallet.d.ts +1 -1
  215. package/dist/signers/types.d.cts +1 -1
  216. package/dist/signers/types.d.ts +1 -1
  217. package/dist/{types-PtseJnku.d.cts → types-BrPpsHHA.d.cts} +7 -4
  218. package/dist/{types-BzTdj2KC.d.ts → types-D0tKSMr1.d.ts} +7 -4
  219. package/dist/utils/constants.cjs +1 -1
  220. package/dist/utils/constants.js +1 -1
  221. package/dist/utils/device-signers/IframeDeviceSignerKeyStorage.cjs +1 -1
  222. package/dist/utils/device-signers/IframeDeviceSignerKeyStorage.js +1 -1
  223. package/dist/utils/device-signers/createDeviceSigner.d.cts +1 -1
  224. package/dist/utils/device-signers/createDeviceSigner.d.ts +1 -1
  225. package/dist/utils/device-signers/index.cjs +1 -1
  226. package/dist/utils/device-signers/index.d.cts +1 -1
  227. package/dist/utils/device-signers/index.d.ts +1 -1
  228. package/dist/utils/device-signers/index.js +1 -1
  229. package/dist/utils/errors.cjs +1 -1
  230. package/dist/utils/errors.d.cts +4 -2
  231. package/dist/utils/errors.d.ts +4 -2
  232. package/dist/utils/errors.js +1 -1
  233. package/dist/utils/locators.cjs +1 -1
  234. package/dist/utils/locators.d.cts +1 -1
  235. package/dist/utils/locators.d.ts +1 -1
  236. package/dist/utils/locators.js +1 -1
  237. package/dist/utils/recovery.cjs +1 -1
  238. package/dist/utils/recovery.d.cts +1 -1
  239. package/dist/utils/recovery.d.ts +1 -1
  240. package/dist/utils/recovery.js +1 -1
  241. package/dist/utils/signer-locator.cjs +1 -1
  242. package/dist/utils/signer-locator.d.cts +1 -1
  243. package/dist/utils/signer-locator.d.ts +1 -1
  244. package/dist/utils/signer-locator.js +1 -1
  245. package/dist/utils/signer-mapping.d.cts +1 -1
  246. package/dist/utils/signer-mapping.d.ts +1 -1
  247. package/dist/utils/signer-validation.cjs +1 -1
  248. package/dist/utils/signer-validation.js +1 -1
  249. package/dist/wallets/__tests__/test-helpers.cjs +1 -1
  250. package/dist/wallets/__tests__/test-helpers.d.cts +1 -1
  251. package/dist/wallets/__tests__/test-helpers.d.ts +1 -1
  252. package/dist/wallets/__tests__/test-helpers.js +1 -1
  253. package/dist/wallets/evm.cjs +1 -1
  254. package/dist/wallets/evm.d.cts +1 -1
  255. package/dist/wallets/evm.d.ts +1 -1
  256. package/dist/wallets/evm.js +1 -1
  257. package/dist/wallets/services/balance-formatter.cjs +1 -1
  258. package/dist/wallets/services/balance-formatter.d.cts +1 -1
  259. package/dist/wallets/services/balance-formatter.d.ts +1 -1
  260. package/dist/wallets/services/balance-formatter.js +1 -1
  261. package/dist/wallets/services/device-recovery-service.cjs +1 -1
  262. package/dist/wallets/services/device-recovery-service.d.cts +1 -1
  263. package/dist/wallets/services/device-recovery-service.d.ts +1 -1
  264. package/dist/wallets/services/device-recovery-service.js +1 -1
  265. package/dist/wallets/services/operation-poller.cjs +1 -1
  266. package/dist/wallets/services/operation-poller.d.cts +1 -1
  267. package/dist/wallets/services/operation-poller.d.ts +1 -1
  268. package/dist/wallets/services/operation-poller.js +1 -1
  269. package/dist/wallets/services/signer-manager.cjs +1 -1
  270. package/dist/wallets/services/signer-manager.d.cts +1 -1
  271. package/dist/wallets/services/signer-manager.d.ts +1 -1
  272. package/dist/wallets/services/signer-manager.js +1 -1
  273. package/dist/wallets/solana.cjs +1 -1
  274. package/dist/wallets/solana.d.cts +1 -1
  275. package/dist/wallets/solana.d.ts +1 -1
  276. package/dist/wallets/solana.js +1 -1
  277. package/dist/wallets/stellar.cjs +1 -1
  278. package/dist/wallets/stellar.d.cts +1 -1
  279. package/dist/wallets/stellar.d.ts +1 -1
  280. package/dist/wallets/stellar.js +1 -1
  281. package/dist/wallets/types.d.cts +1 -1
  282. package/dist/wallets/types.d.ts +1 -1
  283. package/dist/wallets/wallet-factory.cjs +1 -1
  284. package/dist/wallets/wallet-factory.d.cts +1 -1
  285. package/dist/wallets/wallet-factory.d.ts +1 -1
  286. package/dist/wallets/wallet-factory.js +1 -1
  287. package/dist/wallets/wallet.cjs +1 -1
  288. package/dist/wallets/wallet.d.cts +8 -2
  289. package/dist/wallets/wallet.d.ts +8 -2
  290. package/dist/wallets/wallet.js +1 -1
  291. package/package.json +4 -4
  292. package/dist/chunk-AXFHMPWT.cjs +0 -1
  293. package/dist/chunk-BHLJZVGK.js +0 -1
  294. package/dist/chunk-BVFMFBOG.js +0 -1
  295. package/dist/chunk-BZYYVTXK.js +0 -1
  296. package/dist/chunk-IGO2ME4H.js +0 -1
  297. package/dist/chunk-KOHPRJDP.js +0 -1
  298. package/dist/chunk-OS5IMZ5L.cjs +0 -1
  299. package/dist/chunk-RFBVYUAZ.cjs +0 -1
  300. package/dist/chunk-TFAJDUF3.cjs +0 -1
  301. package/dist/chunk-VIOAYLVZ.cjs +0 -1
  302. package/dist/chunk-VNFATNQJ.js +0 -1
  303. package/dist/chunk-VPUAUWI4.js +0 -1
  304. package/dist/chunk-VS6I4S7X.cjs +0 -1
  305. package/dist/chunk-ZHI5V3DM.cjs +0 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkOQFZL5LIcjs = require('./chunk-OQFZL5LI.cjs');var _chunkAUO6R32Hcjs = require('./chunk-AUO6R32H.cjs');var _chunkZPO3XSWUcjs = require('./chunk-ZPO3XSWU.cjs');var _chunkIR5WN6FQcjs = require('./chunk-IR5WN6FQ.cjs');var _chunkGEY574THcjs = require('./chunk-GEY574TH.cjs');var _chunkUE3WVHTMcjs = require('./chunk-UE3WVHTM.cjs');var _chunk5X4EOJFGcjs = require('./chunk-5X4EOJFG.cjs');var _chunkTCDH5Q6Qcjs = require('./chunk-TCDH5Q6Q.cjs');var _chunkHRUMWG2Fcjs = require('./chunk-HRUMWG2F.cjs');var _chunkVS6I4S7Xcjs = require('./chunk-VS6I4S7X.cjs');var _chunkT5EOJ3ZFcjs = require('./chunk-T5EOJ3ZF.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var _chains = require('viem/chains');var g=[_commonsdkbase.BlockchainIncludingTestnet.ABSTRACT_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.ARBITRUM_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.AVALANCHE_FUJI,_commonsdkbase.BlockchainIncludingTestnet.BASE_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.CELO_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.CURTIS,_commonsdkbase.BlockchainIncludingTestnet.ETHEREUM_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.FLOW_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.MANTLE_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.OPTIMISM_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.POLYGON_AMOY,_commonsdkbase.BlockchainIncludingTestnet.ROBINHOOD_CHAIN_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.SCROLL_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.SEI_ATLANTIC_2_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.STORY_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.ZORA_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.ARC_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.TEMPO_TESTNET],D=[_commonsdkbase.BlockchainIncludingTestnet.ABSTRACT,_commonsdkbase.BlockchainIncludingTestnet.APECHAIN,_commonsdkbase.BlockchainIncludingTestnet.ARBITRUM,_commonsdkbase.BlockchainIncludingTestnet.ARBITRUMNOVA,_commonsdkbase.BlockchainIncludingTestnet.ARC,_commonsdkbase.BlockchainIncludingTestnet.AVALANCHE,_commonsdkbase.BlockchainIncludingTestnet.BASE,_commonsdkbase.BlockchainIncludingTestnet.BSC,_commonsdkbase.BlockchainIncludingTestnet.CELO,_commonsdkbase.BlockchainIncludingTestnet.ETHEREUM,_commonsdkbase.BlockchainIncludingTestnet.FLOW,_commonsdkbase.BlockchainIncludingTestnet.MANTLE,_commonsdkbase.BlockchainIncludingTestnet.OPTIMISM,_commonsdkbase.BlockchainIncludingTestnet.POLYGON,_commonsdkbase.BlockchainIncludingTestnet.ROBINHOOD_CHAIN,_commonsdkbase.BlockchainIncludingTestnet.SCROLL,_commonsdkbase.BlockchainIncludingTestnet.SEI_PACIFIC_1,_commonsdkbase.BlockchainIncludingTestnet.SHAPE,_commonsdkbase.BlockchainIncludingTestnet.STORY,_commonsdkbase.BlockchainIncludingTestnet.TEMPO,_commonsdkbase.BlockchainIncludingTestnet.ZORA];function Te(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.AVALANCHE:return _chains.avalanche;case _commonsdkbase.BlockchainIncludingTestnet.AVALANCHE_FUJI:return _chains.avalancheFuji;case _commonsdkbase.BlockchainIncludingTestnet.CELO:return _chains.celo;case _commonsdkbase.BlockchainIncludingTestnet.CELO_SEPOLIA:return _chunkOQFZL5LIcjs.a;case _commonsdkbase.BlockchainIncludingTestnet.ROBINHOOD_CHAIN:return _chunkAUO6R32Hcjs.a;case _commonsdkbase.BlockchainIncludingTestnet.ROBINHOOD_CHAIN_TESTNET:return _chunkZPO3XSWUcjs.a;case _commonsdkbase.BlockchainIncludingTestnet.STORY_TESTNET:return _chunkGEY574THcjs.a;case _commonsdkbase.BlockchainIncludingTestnet.STORY:return _chunkIR5WN6FQcjs.a;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.ETHEREUM:return _chains.mainnet;case _commonsdkbase.BlockchainIncludingTestnet.FLOW:return _chains.flowMainnet;case _commonsdkbase.BlockchainIncludingTestnet.FLOW_TESTNET:return _chains.flowTestnet;case _commonsdkbase.BlockchainIncludingTestnet.ARC:return _chunkTCDH5Q6Qcjs.a;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: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 c(t){return g.includes(t)}function u(t){return D.includes(t)}var $={[_commonsdkbase.BlockchainIncludingTestnet.ABSTRACT]:_commonsdkbase.BlockchainIncludingTestnet.ABSTRACT_TESTNET,[_commonsdkbase.BlockchainIncludingTestnet.APECHAIN]:_commonsdkbase.BlockchainIncludingTestnet.CURTIS,[_commonsdkbase.BlockchainIncludingTestnet.ARBITRUM]:_commonsdkbase.BlockchainIncludingTestnet.ARBITRUM_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.AVALANCHE]:_commonsdkbase.BlockchainIncludingTestnet.AVALANCHE_FUJI,[_commonsdkbase.BlockchainIncludingTestnet.BASE]:_commonsdkbase.BlockchainIncludingTestnet.BASE_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.CELO]:_commonsdkbase.BlockchainIncludingTestnet.CELO_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.ETHEREUM]:_commonsdkbase.BlockchainIncludingTestnet.ETHEREUM_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.FLOW]:_commonsdkbase.BlockchainIncludingTestnet.FLOW_TESTNET,[_commonsdkbase.BlockchainIncludingTestnet.MANTLE]:_commonsdkbase.BlockchainIncludingTestnet.MANTLE_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.OPTIMISM]:_commonsdkbase.BlockchainIncludingTestnet.OPTIMISM_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.POLYGON]:_commonsdkbase.BlockchainIncludingTestnet.POLYGON_AMOY,[_commonsdkbase.BlockchainIncludingTestnet.ROBINHOOD_CHAIN]:_commonsdkbase.BlockchainIncludingTestnet.ROBINHOOD_CHAIN_TESTNET,[_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.ZORA]:_commonsdkbase.BlockchainIncludingTestnet.ZORA_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.TEMPO]:_commonsdkbase.BlockchainIncludingTestnet.TEMPO_TESTNET,[_commonsdkbase.BlockchainIncludingTestnet.ARC]:_commonsdkbase.BlockchainIncludingTestnet.ARC_TESTNET};function G(t){return $[t]}function Z(t){return t==="solana"||t==="stellar"||c(t)||u(t)}function ie(t,a){if(!Z(t))throw new (0, _chunkVS6I4S7Xcjs.c)(`Unknown chain "${t}". Please use a supported chain name (e.g. "base-sepolia", "polygon", "solana", "stellar").`);if(t==="solana"||t==="stellar")return t;let r=t,T=a===_commonsdkbase.APIKeyEnvironmentPrefix.PRODUCTION;if(T&&c(r))throw new (0, _chunkVS6I4S7Xcjs.b)(`Chain "${t}" is a testnet chain and cannot be used in production. Please use a mainnet chain instead.`);if(!T&&u(r)){let n=G(r);if(n!=null)return _chunkT5EOJ3ZFcjs.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;_chunkT5EOJ3ZFcjs.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 = Te; exports.b = c; exports.c = u; exports.d = G; exports.e = Z; exports.f = ie;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkOQFZL5LIcjs = require('./chunk-OQFZL5LI.cjs');var _chunkAUO6R32Hcjs = require('./chunk-AUO6R32H.cjs');var _chunkZPO3XSWUcjs = require('./chunk-ZPO3XSWU.cjs');var _chunkIR5WN6FQcjs = require('./chunk-IR5WN6FQ.cjs');var _chunkGEY574THcjs = require('./chunk-GEY574TH.cjs');var _chunkUE3WVHTMcjs = require('./chunk-UE3WVHTM.cjs');var _chunk5X4EOJFGcjs = require('./chunk-5X4EOJFG.cjs');var _chunkTCDH5Q6Qcjs = require('./chunk-TCDH5Q6Q.cjs');var _chunkHRUMWG2Fcjs = require('./chunk-HRUMWG2F.cjs');var _chunkD2S37DJ5cjs = require('./chunk-D2S37DJ5.cjs');var _chunk36GZTRZXcjs = require('./chunk-36GZTRZX.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var _chains = require('viem/chains');var g=[_commonsdkbase.BlockchainIncludingTestnet.ABSTRACT_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.ARBITRUM_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.AVALANCHE_FUJI,_commonsdkbase.BlockchainIncludingTestnet.BASE_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.CELO_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.CURTIS,_commonsdkbase.BlockchainIncludingTestnet.ETHEREUM_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.FLOW_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.MANTLE_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.OPTIMISM_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.POLYGON_AMOY,_commonsdkbase.BlockchainIncludingTestnet.ROBINHOOD_CHAIN_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.SCROLL_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.SEI_ATLANTIC_2_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.STORY_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.ZORA_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.ARC_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.TEMPO_TESTNET],D=[_commonsdkbase.BlockchainIncludingTestnet.ABSTRACT,_commonsdkbase.BlockchainIncludingTestnet.APECHAIN,_commonsdkbase.BlockchainIncludingTestnet.ARBITRUM,_commonsdkbase.BlockchainIncludingTestnet.ARBITRUMNOVA,_commonsdkbase.BlockchainIncludingTestnet.ARC,_commonsdkbase.BlockchainIncludingTestnet.AVALANCHE,_commonsdkbase.BlockchainIncludingTestnet.BASE,_commonsdkbase.BlockchainIncludingTestnet.BSC,_commonsdkbase.BlockchainIncludingTestnet.CELO,_commonsdkbase.BlockchainIncludingTestnet.ETHEREUM,_commonsdkbase.BlockchainIncludingTestnet.FLOW,_commonsdkbase.BlockchainIncludingTestnet.MANTLE,_commonsdkbase.BlockchainIncludingTestnet.OPTIMISM,_commonsdkbase.BlockchainIncludingTestnet.POLYGON,_commonsdkbase.BlockchainIncludingTestnet.ROBINHOOD_CHAIN,_commonsdkbase.BlockchainIncludingTestnet.SCROLL,_commonsdkbase.BlockchainIncludingTestnet.SEI_PACIFIC_1,_commonsdkbase.BlockchainIncludingTestnet.SHAPE,_commonsdkbase.BlockchainIncludingTestnet.STORY,_commonsdkbase.BlockchainIncludingTestnet.TEMPO,_commonsdkbase.BlockchainIncludingTestnet.ZORA];function Te(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.AVALANCHE:return _chains.avalanche;case _commonsdkbase.BlockchainIncludingTestnet.AVALANCHE_FUJI:return _chains.avalancheFuji;case _commonsdkbase.BlockchainIncludingTestnet.CELO:return _chains.celo;case _commonsdkbase.BlockchainIncludingTestnet.CELO_SEPOLIA:return _chunkOQFZL5LIcjs.a;case _commonsdkbase.BlockchainIncludingTestnet.ROBINHOOD_CHAIN:return _chunkAUO6R32Hcjs.a;case _commonsdkbase.BlockchainIncludingTestnet.ROBINHOOD_CHAIN_TESTNET:return _chunkZPO3XSWUcjs.a;case _commonsdkbase.BlockchainIncludingTestnet.STORY_TESTNET:return _chunkGEY574THcjs.a;case _commonsdkbase.BlockchainIncludingTestnet.STORY:return _chunkIR5WN6FQcjs.a;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.ETHEREUM:return _chains.mainnet;case _commonsdkbase.BlockchainIncludingTestnet.FLOW:return _chains.flowMainnet;case _commonsdkbase.BlockchainIncludingTestnet.FLOW_TESTNET:return _chains.flowTestnet;case _commonsdkbase.BlockchainIncludingTestnet.ARC:return _chunkTCDH5Q6Qcjs.a;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: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 c(t){return g.includes(t)}function u(t){return D.includes(t)}var $={[_commonsdkbase.BlockchainIncludingTestnet.ABSTRACT]:_commonsdkbase.BlockchainIncludingTestnet.ABSTRACT_TESTNET,[_commonsdkbase.BlockchainIncludingTestnet.APECHAIN]:_commonsdkbase.BlockchainIncludingTestnet.CURTIS,[_commonsdkbase.BlockchainIncludingTestnet.ARBITRUM]:_commonsdkbase.BlockchainIncludingTestnet.ARBITRUM_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.AVALANCHE]:_commonsdkbase.BlockchainIncludingTestnet.AVALANCHE_FUJI,[_commonsdkbase.BlockchainIncludingTestnet.BASE]:_commonsdkbase.BlockchainIncludingTestnet.BASE_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.CELO]:_commonsdkbase.BlockchainIncludingTestnet.CELO_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.ETHEREUM]:_commonsdkbase.BlockchainIncludingTestnet.ETHEREUM_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.FLOW]:_commonsdkbase.BlockchainIncludingTestnet.FLOW_TESTNET,[_commonsdkbase.BlockchainIncludingTestnet.MANTLE]:_commonsdkbase.BlockchainIncludingTestnet.MANTLE_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.OPTIMISM]:_commonsdkbase.BlockchainIncludingTestnet.OPTIMISM_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.POLYGON]:_commonsdkbase.BlockchainIncludingTestnet.POLYGON_AMOY,[_commonsdkbase.BlockchainIncludingTestnet.ROBINHOOD_CHAIN]:_commonsdkbase.BlockchainIncludingTestnet.ROBINHOOD_CHAIN_TESTNET,[_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.ZORA]:_commonsdkbase.BlockchainIncludingTestnet.ZORA_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.TEMPO]:_commonsdkbase.BlockchainIncludingTestnet.TEMPO_TESTNET,[_commonsdkbase.BlockchainIncludingTestnet.ARC]:_commonsdkbase.BlockchainIncludingTestnet.ARC_TESTNET};function G(t){return $[t]}function Z(t){return t==="solana"||t==="stellar"||c(t)||u(t)}function ie(t,a){if(!Z(t))throw new (0, _chunkD2S37DJ5cjs.c)(`Unknown chain "${t}". Please use a supported chain name (e.g. "base-sepolia", "polygon", "solana", "stellar").`);if(t==="solana"||t==="stellar")return t;let r=t,T=a===_commonsdkbase.APIKeyEnvironmentPrefix.PRODUCTION;if(T&&c(r))throw new (0, _chunkD2S37DJ5cjs.b)(`Chain "${t}" is a testnet chain and cannot be used in production. Please use a mainnet chain instead.`);if(!T&&u(r)){let n=G(r);if(n!=null)return _chunk36GZTRZXcjs.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;_chunk36GZTRZXcjs.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 = Te; exports.b = c; exports.c = u; exports.d = G; exports.e = Z; exports.f = ie;
@@ -0,0 +1 @@
1
+ import{a as t}from"./chunk-266RS53K.js";import{a as o}from"./chunk-Q7EO6OOI.js";import{b as n}from"./chunk-2KGAVQXR.js";import{a as s}from"./chunk-PA3RU64J.js";import{a as p}from"./chunk-HQ2RXBAN.js";import{a as c}from"./chunk-X7V2C53V.js";import{a as i}from"./chunk-HHY65A7I.js";import{k as e}from"./chunk-4I3EXM4B.js";function h(r){switch(r){case"email":return o;case"phone":return p;case"passkey":return s;case"device":return t;case"api-key":return i;case"server":return c;case"external-wallet":return n;default:throw new e(`Unknown signer type: ${r}`)}}export{h as a};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkJNKTRQPScjs = require('./chunk-JNKTRQPS.cjs');var _chunkVS6I4S7Xcjs = require('./chunk-VS6I4S7X.cjs');var _chunkT5EOJ3ZFcjs = require('./chunk-T5EOJ3ZF.cjs');var f={nativeToken:"eth",walletLocatorPrefix:"me:evm:smart",supportsSignatures:!0,addSignerChain(e){return e},extractAddSignerOperation(e,r,n){var t,a,o,s;if(!("chains"in e))throw _chunkT5EOJ3ZFcjs.a.error("wallet.addSigner.error",{error:"Expected chains in response for EVM chain"}),new Error("Expected chains in response for EVM chain");if(((a=(t=e.chains)==null?void 0:t[r])==null?void 0:a.status)==="failed")throw _chunkT5EOJ3ZFcjs.a.error("wallet.addSigner.failed",{chain:r,signerType:n.type,signerLocator:n.locator,chainStatus:(o=e.chains)==null?void 0:o[r]}),new (0, _chunkVS6I4S7Xcjs.j)(`Signer registration failed for chain ${r} (signer: ${n.locator})`,JSON.stringify((s=e.chains)==null?void 0:s[r]));return _chunkJNKTRQPScjs.c.call(void 0, e,r)},balanceTokenFields(e){return e!=null&&"contractAddress"in e?{contractAddress:e.contractAddress}:{}},emptyBalanceTokenFields(){return{contractAddress:void 0}},signApproval(e,r,n){return e.signTransaction(n)}};exports.a = f;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkJNKTRQPScjs = require('./chunk-JNKTRQPS.cjs');var _chunkD2S37DJ5cjs = require('./chunk-D2S37DJ5.cjs');var _chunk36GZTRZXcjs = require('./chunk-36GZTRZX.cjs');var f={nativeToken:"eth",walletLocatorPrefix:"me:evm:smart",supportsSignatures:!0,addSignerChain(e){return e},extractAddSignerOperation(e,r,n){var t,a,o,s;if(!("chains"in e))throw _chunk36GZTRZXcjs.a.error("wallet.addSigner.error",{error:"Expected chains in response for EVM chain"}),new Error("Expected chains in response for EVM chain");if(((a=(t=e.chains)==null?void 0:t[r])==null?void 0:a.status)==="failed")throw _chunk36GZTRZXcjs.a.error("wallet.addSigner.failed",{chain:r,signerType:n.type,signerLocator:n.locator,chainStatus:(o=e.chains)==null?void 0:o[r]}),new (0, _chunkD2S37DJ5cjs.j)(`Signer registration failed for chain ${r} (signer: ${n.locator})`,JSON.stringify((s=e.chains)==null?void 0:s[r]));return _chunkJNKTRQPScjs.c.call(void 0, e,r)},balanceTokenFields(e){return e!=null&&"contractAddress"in e?{contractAddress:e.contractAddress}:{}},emptyBalanceTokenFields(){return{contractAddress:void 0}},signApproval(e,r,n){return e.signTransaction(n)}};exports.a = f;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkVS6I4S7Xcjs = require('./chunk-VS6I4S7X.cjs');var _chunkT5EOJ3ZFcjs = require('./chunk-T5EOJ3ZF.cjs');var _chunkAIAYUJJGcjs = require('./chunk-AIAYUJJG.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');function R(i,o,a,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var h,d;let{timeoutMs:e=6e4,initialBackoffMs:u=500,backoffMultiplier:n=1.5,maxBackoffMs:f=2e3,fastWindowMs:L=5e3}=r!=null?r:{};_chunkT5EOJ3ZFcjs.a.info("wallet.approve: waiting for transaction confirmation",{transactionId:a,timeoutMs:e});let p=Date.now(),c=u,t;do{if(Date.now()-p>e)throw new (0, _chunkVS6I4S7Xcjs.J)("Transaction confirmation timeout");let s=Date.now();if(t=yield i.getTransaction(o,a),t.error)throw _chunkVS6I4S7Xcjs.Q.call(void 0, t),new (0, _chunkVS6I4S7Xcjs.I)(JSON.stringify(t));if(t.status!=="pending")break;let T=Date.now()-p;T>L&&(c=Math.min(Math.round(c*n),f));let v=Date.now()-s;yield D(Math.max(1,Math.min(c-v,e-T)))}while(!0);if(t.status==="failed")throw new (0, _chunkVS6I4S7Xcjs.K)(`Transaction sending failed: ${JSON.stringify(t)}`);if(t.status==="awaiting-approval")throw new (0, _chunkVS6I4S7Xcjs.L)("Transaction is awaiting approval. Please submit required approvals before waiting for completion.");let P="txHash"in t.onChain&&typeof t.onChain.txHash=="string"?t.onChain.txHash:void 0,g=(h=t.onChain.txId)!=null?h:P;if(g==null)throw new (0, _chunkVS6I4S7Xcjs.M)("Transaction hash not found on transaction response");return{hash:g,explorerLink:(d=t.onChain.explorerLink)!=null?d:"",transactionId:t.id}})}function W(i,o,a,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let{timeoutMs:e=6e4}=r!=null?r:{},u=Date.now(),n=null;do{if(Date.now()-u>e)throw new (0, _chunkVS6I4S7Xcjs.F)("Signature confirmation timeout");if(yield new Promise(f=>setTimeout(f,_chunkAIAYUJJGcjs.d)),n=yield i.getSignature(o,a),"error"in n)throw _chunkVS6I4S7Xcjs.Q.call(void 0, n),new (0, _chunkVS6I4S7Xcjs.D)(JSON.stringify(n))}while(n===null||n.status==="pending");if(n.status==="failed")throw new (0, _chunkVS6I4S7Xcjs.A)("Signature signing failed");if(!n.outputSignature)throw new (0, _chunkVS6I4S7Xcjs.D)("Signature not available");return{signature:n.outputSignature,signatureId:a}})}function D(i){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return new Promise(o=>setTimeout(o,i))})}exports.a = R; exports.b = W;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkD2S37DJ5cjs = require('./chunk-D2S37DJ5.cjs');var _chunk36GZTRZXcjs = require('./chunk-36GZTRZX.cjs');var _chunkAEHDAUN4cjs = require('./chunk-AEHDAUN4.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');function R(i,o,a,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var h,d;let{timeoutMs:e=6e4,initialBackoffMs:u=500,backoffMultiplier:n=1.5,maxBackoffMs:f=2e3,fastWindowMs:L=5e3}=r!=null?r:{};_chunk36GZTRZXcjs.a.info("wallet.approve: waiting for transaction confirmation",{transactionId:a,timeoutMs:e});let p=Date.now(),c=u,t;do{if(Date.now()-p>e)throw new (0, _chunkD2S37DJ5cjs.K)("Transaction confirmation timeout");let s=Date.now();if(t=yield i.getTransaction(o,a),t.error)throw _chunkD2S37DJ5cjs.R.call(void 0, t),new (0, _chunkD2S37DJ5cjs.J)(JSON.stringify(t));if(t.status!=="pending")break;let T=Date.now()-p;T>L&&(c=Math.min(Math.round(c*n),f));let v=Date.now()-s;yield D(Math.max(1,Math.min(c-v,e-T)))}while(!0);if(t.status==="failed")throw new (0, _chunkD2S37DJ5cjs.L)(`Transaction sending failed: ${JSON.stringify(t)}`);if(t.status==="awaiting-approval")throw new (0, _chunkD2S37DJ5cjs.M)("Transaction is awaiting approval. Please submit required approvals before waiting for completion.");let P="txHash"in t.onChain&&typeof t.onChain.txHash=="string"?t.onChain.txHash:void 0,g=(h=t.onChain.txId)!=null?h:P;if(g==null)throw new (0, _chunkD2S37DJ5cjs.N)("Transaction hash not found on transaction response");return{hash:g,explorerLink:(d=t.onChain.explorerLink)!=null?d:"",transactionId:t.id}})}function W(i,o,a,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let{timeoutMs:e=6e4}=r!=null?r:{},u=Date.now(),n=null;do{if(Date.now()-u>e)throw new (0, _chunkD2S37DJ5cjs.G)("Signature confirmation timeout");if(yield new Promise(f=>setTimeout(f,_chunkAEHDAUN4cjs.d)),n=yield i.getSignature(o,a),"error"in n)throw _chunkD2S37DJ5cjs.R.call(void 0, n),new (0, _chunkD2S37DJ5cjs.E)(JSON.stringify(n))}while(n===null||n.status==="pending");if(n.status==="failed")throw new (0, _chunkD2S37DJ5cjs.B)("Signature signing failed");if(!n.outputSignature)throw new (0, _chunkD2S37DJ5cjs.E)("Signature not available");return{signature:n.outputSignature,signatureId:a}})}function D(i){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return new Promise(o=>setTimeout(o,i))})}exports.a = R; exports.b = W;
@@ -1 +1 @@
1
- import{a as p}from"./chunk-KOHPRJDP.js";import{a as i}from"./chunk-VOFCBB2P.js";import{b as c,c as h}from"./chunk-BVFMFBOG.js";import{h as n}from"./chunk-NU7VF7MC.js";import{APIKeyEnvironmentPrefix as d,APIKeyUsageOrigin as g,ApiClientError as u,CrossmintApiClient as P}from"@crossmint/common-sdk-base";var l=class extends P{constructor(e){super(e,{internalConfig:{sdkMetadata:{name:h,version:c}}});this.apiPrefix="api/2025-06-09/wallets";this.unstableApiPrefix="api/unstable/wallets"}createWallet(e){return n(this,null,function*(){let s=this.isServerSide?`${this.apiPrefix}`:`${this.apiPrefix}/me`;i.info("wallets.api.createWallet",{chainType:e.chainType,walletType:e.type});let t=yield(yield this.post(s,{body:JSON.stringify(e),headers:this.headers})).json();return"error"in t?i.error("wallets.api.createWallet.error",{error:t.error,chainType:e.chainType}):"address"in t&&i.info("wallets.api.createWallet.success",{address:t.address,chainType:e.chainType}),t})}getWallet(e){return n(this,null,function*(){i.info("wallets.api.getWallet",{locator:e});let r=yield(yield this.get(`${this.apiPrefix}/${e}`,{headers:this.headers})).json();return"error"in r?i.warn("wallets.api.getWallet.error",{locator:e,error:r.error}):"address"in r&&i.info("wallets.api.getWallet.success",{address:r.address,locator:e}),r})}createTransaction(e,s){return n(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveTransaction(e,s,r){return n(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 n(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions/${s}`,{headers:this.headers})).json()})}createSignature(e,s){return n(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signatures`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveSignature(e,s,r){return n(this,null,function*(){let t=yield this.post(`${this.apiPrefix}/${e}/signatures/${s}/approvals`,{body:JSON.stringify(r),headers:this.headers});return t.status===422?this.getSignature(e,s):t.json()})}getSignature(e,s){return n(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/signatures/${s}`,{headers:this.headers})).json()})}getTransactions(e){return n(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions`,{headers:this.headers})).json()})}getNfts(e){return n(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 n(this,null,function*(){let r=new URLSearchParams;return r.append("chain",s.chain.toString()),s.tokens!=null&&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 n(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 n(this,null,function*(){if(this.environment===d.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 n(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signers`,{body:JSON.stringify(s),headers:this.headers})).json()})}removeSigner(e,s,r){return n(this,null,function*(){let t=encodeURIComponent(s),a=new URLSearchParams;r.chain&&a.append("chain",r.chain),r.approver!=null&&a.append("approver",r.approver);let o=`${this.apiPrefix}/${e}/signers/${t}${a.size>0?`?${a.toString()}`:""}`;return(yield this.delete(o,{headers:this.headers})).json()})}registerRecoveryMethod(e,s){return n(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/recovery-methods`,{body:JSON.stringify(s),headers:this.headers})).json()})}removeRecoveryMethod(e,s,r){return n(this,null,function*(){let t=encodeURIComponent(s),a=new URLSearchParams;return r.chain!=null&&a.append("chain",r.chain),a.append("approver",r.approver),(yield this.delete(`${this.apiPrefix}/${e}/recovery-methods/${t}?${a.toString()}`,{headers:this.headers})).json()})}getSigner(e,s){return n(this,null,function*(){let r=encodeURIComponent(s),t=yield this.get(`${this.apiPrefix}/${e}/signers/${r}`,{headers:this.headers});if(!t.ok){let a=null;try{a=yield t.text()}catch(o){}throw new u(`API request failed: ${t.status} ${t.statusText}`,t.status,t.statusText,a)}return t.json()})}send(e,s,r){return n(this,null,function*(){i.info("wallets.api.send",{walletLocator:e,tokenLocator:s,recipient:r.recipient});let a=yield(yield this.post(`${this.apiPrefix}/${e}/tokens/${s}/transfers`,{body:JSON.stringify(r),headers:this.headers})).json();return"error"in a?i.error("wallets.api.send.error",{walletLocator:e,tokenLocator:s,error:a.error}):"id"in a&&i.info("wallets.api.send.success",{walletLocator:e,transactionId:a.id}),a})}get isServerSide(){return this.parsedAPIKey.usageOrigin===g.SERVER}get environment(){if(!this.parsedAPIKey.isValid)throw new p("Invalid API key");return this.parsedAPIKey.environment}get projectId(){if(!this.parsedAPIKey.isValid)throw new p("Invalid API key");return this.parsedAPIKey.projectId}get headers(){return{"Content-Type":"application/json"}}};export{l as a};
1
+ import{a as p}from"./chunk-4I3EXM4B.js";import{a as i}from"./chunk-2YLAHC7J.js";import{b as c,c as h}from"./chunk-QYBC7GTA.js";import{h as n}from"./chunk-NU7VF7MC.js";import{APIKeyEnvironmentPrefix as d,APIKeyUsageOrigin as g,ApiClientError as u,CrossmintApiClient as P}from"@crossmint/common-sdk-base";var l=class extends P{constructor(e){super(e,{internalConfig:{sdkMetadata:{name:h,version:c}}});this.apiPrefix="api/2025-06-09/wallets";this.unstableApiPrefix="api/unstable/wallets"}createWallet(e){return n(this,null,function*(){let s=this.isServerSide?`${this.apiPrefix}`:`${this.apiPrefix}/me`;i.info("wallets.api.createWallet",{chainType:e.chainType,walletType:e.type});let t=yield(yield this.post(s,{body:JSON.stringify(e),headers:this.headers})).json();return"error"in t?i.error("wallets.api.createWallet.error",{error:t.error,chainType:e.chainType}):"address"in t&&i.info("wallets.api.createWallet.success",{address:t.address,chainType:e.chainType}),t})}getWallet(e){return n(this,null,function*(){i.info("wallets.api.getWallet",{locator:e});let r=yield(yield this.get(`${this.apiPrefix}/${e}`,{headers:this.headers})).json();return"error"in r?i.warn("wallets.api.getWallet.error",{locator:e,error:r.error}):"address"in r&&i.info("wallets.api.getWallet.success",{address:r.address,locator:e}),r})}createTransaction(e,s){return n(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveTransaction(e,s,r){return n(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 n(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions/${s}`,{headers:this.headers})).json()})}createSignature(e,s){return n(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signatures`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveSignature(e,s,r){return n(this,null,function*(){let t=yield this.post(`${this.apiPrefix}/${e}/signatures/${s}/approvals`,{body:JSON.stringify(r),headers:this.headers});return t.status===422?this.getSignature(e,s):t.json()})}getSignature(e,s){return n(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/signatures/${s}`,{headers:this.headers})).json()})}getTransactions(e){return n(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions`,{headers:this.headers})).json()})}getNfts(e){return n(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 n(this,null,function*(){let r=new URLSearchParams;return r.append("chain",s.chain.toString()),s.tokens!=null&&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 n(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 n(this,null,function*(){if(this.environment===d.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 n(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signers`,{body:JSON.stringify(s),headers:this.headers})).json()})}removeSigner(e,s,r){return n(this,null,function*(){let t=encodeURIComponent(s),a=new URLSearchParams;r.chain&&a.append("chain",r.chain),r.approver!=null&&a.append("approver",r.approver);let o=`${this.apiPrefix}/${e}/signers/${t}${a.size>0?`?${a.toString()}`:""}`;return(yield this.delete(o,{headers:this.headers})).json()})}registerRecoveryMethod(e,s){return n(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/recovery-methods`,{body:JSON.stringify(s),headers:this.headers})).json()})}removeRecoveryMethod(e,s,r){return n(this,null,function*(){let t=encodeURIComponent(s),a=new URLSearchParams;return r.chain!=null&&a.append("chain",r.chain),a.append("approver",r.approver),(yield this.delete(`${this.apiPrefix}/${e}/recovery-methods/${t}?${a.toString()}`,{headers:this.headers})).json()})}getSigner(e,s){return n(this,null,function*(){let r=encodeURIComponent(s),t=yield this.get(`${this.apiPrefix}/${e}/signers/${r}`,{headers:this.headers});if(!t.ok){let a=null;try{a=yield t.text()}catch(o){}throw new u(`API request failed: ${t.status} ${t.statusText}`,t.status,t.statusText,a)}return t.json()})}send(e,s,r){return n(this,null,function*(){i.info("wallets.api.send",{walletLocator:e,tokenLocator:s,recipient:r.recipient});let a=yield(yield this.post(`${this.apiPrefix}/${e}/tokens/${s}/transfers`,{body:JSON.stringify(r),headers:this.headers})).json();return"error"in a?i.error("wallets.api.send.error",{walletLocator:e,tokenLocator:s,error:a.error}):"id"in a&&i.info("wallets.api.send.success",{walletLocator:e,transactionId:a.id}),a})}get isServerSide(){return this.parsedAPIKey.usageOrigin===g.SERVER}get environment(){if(!this.parsedAPIKey.isValid)throw new p("Invalid API key");return this.parsedAPIKey.environment}get projectId(){if(!this.parsedAPIKey.isValid)throw new p("Invalid API key");return this.parsedAPIKey.projectId}get headers(){return{"Content-Type":"application/json"}}};export{l as a};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkMI3DBGDVcjs = require('./chunk-MI3DBGDV.cjs');var _chunkSE5L5SQKcjs = require('./chunk-SE5L5SQK.cjs');var _chunk3FUVUUXUcjs = require('./chunk-3FUVUUXU.cjs');var _chunkENU3EKBGcjs = require('./chunk-ENU3EKBG.cjs');var n={evm:_chunkMI3DBGDVcjs.a,solana:_chunkSE5L5SQKcjs.a,stellar:_chunk3FUVUUXUcjs.a};function h(e){return n[_chunkENU3EKBGcjs.a.call(void 0, e)]}function p(e){return Object.prototype.hasOwnProperty.call(n,e)}function m(e,o){return p(e)?n[e]:o}exports.a = h; exports.b = p; exports.c = m;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkGSNFNRH2cjs = require('./chunk-GSNFNRH2.cjs');var _chunk3VYGTPRFcjs = require('./chunk-3VYGTPRF.cjs');var _chunkVS6I4S7Xcjs = require('./chunk-VS6I4S7X.cjs');var _chunkT5EOJ3ZFcjs = require('./chunk-T5EOJ3ZF.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var _ox = require('ox');var R={[_commonsdkbase.APIKeyEnvironmentPrefix.DEVELOPMENT]:"https://development.devicekey.store",[_commonsdkbase.APIKeyEnvironmentPrefix.STAGING]:"https://staging.devicekey.store",[_commonsdkbase.APIKeyEnvironmentPrefix.PRODUCTION]:"https://devicekey.store"},E=6e4,L="indexeddb-fatal",c= exports.a =class extends _chunk3VYGTPRFcjs.a{constructor(e){super(e);this.iframePromise=null;this.reloading=null;this.biometricRequestHandler=null;this.biometricListener=null;if(typeof window!="undefined"&&!_chunkGSNFNRH2cjs.a.call(void 0, ))throw new (0, _chunkVS6I4S7Xcjs.w)("Device signer requires a browser with third-party storage partitioning (Chrome \u2265 115, Firefox \u2265 103, or Safari). Without storage partitioning, different embedders of the same iframe can share IndexedDB, allowing cross-site key access. See https://developer.chrome.com/blog/storage-partitioning");let r=_commonsdkbase.getEnvironmentForKey.call(void 0, e);if(r==null)throw new Error("Unable to determine environment from API key");this.iframeUrl=R[r]}setBiometricRequestHandler(e){this.biometricRequestHandler=e}generateKey(){return _chunkDSIFRRBScjs.h.call(void 0, this,arguments,function*(e={biometricPolicy:"none"}){return(yield this.rpc("generateKey",e)).publicKeyBase64})}mapAddressToKey(e,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){yield this.rpc("mapAddressToKey",{address:e,publicKeyBase64:r})})}getKey(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return(yield this.rpc("getKey",{address:e})).publicKeyBase64})}hasKey(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return(yield this.rpc("hasKey",{publicKeyBase64:e})).hasKey})}signMessage(e,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return yield this.rpc("signMessage",{address:e,message:r})})}deleteKey(e){return _chunkDSIFRRBScjs.h.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 _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let i=yield this.sendRpc(e,r);if(i.fatal){_chunkT5EOJ3ZFcjs.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 i.value})}sendRpc(e,r){return _chunkDSIFRRBScjs.h.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((s,o)=>{let f=setTimeout(()=>{window.removeEventListener("message",p),o(new Error(`Device signer RPC "${e}" timed out after ${E}ms`))},E);function p(y){let d=y.data;d==null||d.id!==g||y.origin===a&&(clearTimeout(f),window.removeEventListener("message",p),d.type==="error"&&d.code===L?s({fatal:!0}):d.type==="error"?o(new Error(d.error)):s({value:d.result,fatal:!1}))}window.addEventListener("message",p),t.postMessage({type:e,id:g,payload:r},this.iframeUrl)})})}reloadIframe(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){if(this.reloading!=null)return this.reloading;let e=_chunkDSIFRRBScjs.h.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=i=>_chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){if(i.origin!==r)return;let t=i.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 s=t.payload,o=yield _ox.WebAuthnP256.createCredential({name:s.name});a={id:o.id,publicKey:{x:`0x${o.publicKey.x.toString(16)}`,y:`0x${o.publicKey.y.toString(16)}`}}}else if(t.action==="sign"){let s=t.payload,{signature:o,metadata:f}=yield _ox.WebAuthnP256.sign({credentialId:s.credentialId,challenge:s.challenge});a={signature:{r:`0x${o.r.toString(16)}`,s:`0x${o.s.toString(16)}`},metadata:f}}g.postMessage({type:"biometric-response",id:t.id,result:a},this.iframeUrl)}catch(a){let s=a instanceof Error?a.message:"Unknown biometric error";g.postMessage({type:"biometric-response",id:t.id,error:s},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,i)=>{e.onload=()=>{this.setupBiometricListener(e),r(e)},e.onerror=()=>i(new Error("Failed to load device signer iframe")),document.body.appendChild(e)})}getDeviceName(){var t;if(typeof navigator=="undefined")return"Unknown Device";let e=navigator.userAgent,r=this.parseDevice(e),i=this.parseBrowser(e);return r!=null&&i!=null?`${i} on ${r}`:(t=r!=null?r:i)!=null?t:"Unknown Device"}parseDevice(e){return/iPad/.test(e)?"iPad":/iPhone/.test(e)?"iPhone":/Macintosh|Mac OS X/.test(e)?"Mac":/Windows/.test(e)?"Windows":/Android/.test(e)?"Android":/Linux/.test(e)?"Linux":/CrOS/.test(e)?"ChromeOS":null}parseBrowser(e){return/Edg\//.test(e)?"Edge":/OPR\/|Opera/.test(e)?"Opera":typeof navigator!="undefined"&&"brave"in navigator?"Brave":/Chrome\//.test(e)?"Chrome":/Safari\//.test(e)&&!/Chrome\//.test(e)?"Safari":/Firefox\//.test(e)?"Firefox":null}};_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkT5EOJ3ZFcjs.a,methodName:"deviceSignerKeyStorage.generateKey"})],c.prototype,"generateKey",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkT5EOJ3ZFcjs.a,methodName:"deviceSignerKeyStorage.mapAddressToKey"})],c.prototype,"mapAddressToKey",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkT5EOJ3ZFcjs.a,methodName:"deviceSignerKeyStorage.getKey"})],c.prototype,"getKey",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkT5EOJ3ZFcjs.a,methodName:"deviceSignerKeyStorage.hasKey"})],c.prototype,"hasKey",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkT5EOJ3ZFcjs.a,methodName:"deviceSignerKeyStorage.signMessage"})],c.prototype,"signMessage",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkT5EOJ3ZFcjs.a,methodName:"deviceSignerKeyStorage.deleteKey"})],c.prototype,"deleteKey",1);exports.a = c;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkGSNFNRH2cjs = require('./chunk-GSNFNRH2.cjs');var _chunk3VYGTPRFcjs = require('./chunk-3VYGTPRF.cjs');var _chunkD2S37DJ5cjs = require('./chunk-D2S37DJ5.cjs');var _chunk36GZTRZXcjs = require('./chunk-36GZTRZX.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var _ox = require('ox');var R={[_commonsdkbase.APIKeyEnvironmentPrefix.DEVELOPMENT]:"https://development.devicekey.store",[_commonsdkbase.APIKeyEnvironmentPrefix.STAGING]:"https://staging.devicekey.store",[_commonsdkbase.APIKeyEnvironmentPrefix.PRODUCTION]:"https://devicekey.store"},E=6e4,L="indexeddb-fatal",c= exports.a =class extends _chunk3VYGTPRFcjs.a{constructor(e){super(e);this.iframePromise=null;this.reloading=null;this.biometricRequestHandler=null;this.biometricListener=null;if(typeof window!="undefined"&&!_chunkGSNFNRH2cjs.a.call(void 0, ))throw new (0, _chunkD2S37DJ5cjs.x)("Device signer requires a browser with third-party storage partitioning (Chrome \u2265 115, Firefox \u2265 103, or Safari). Without storage partitioning, different embedders of the same iframe can share IndexedDB, allowing cross-site key access. See https://developer.chrome.com/blog/storage-partitioning");let r=_commonsdkbase.getEnvironmentForKey.call(void 0, e);if(r==null)throw new Error("Unable to determine environment from API key");this.iframeUrl=R[r]}setBiometricRequestHandler(e){this.biometricRequestHandler=e}generateKey(){return _chunkDSIFRRBScjs.h.call(void 0, this,arguments,function*(e={biometricPolicy:"none"}){return(yield this.rpc("generateKey",e)).publicKeyBase64})}mapAddressToKey(e,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){yield this.rpc("mapAddressToKey",{address:e,publicKeyBase64:r})})}getKey(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return(yield this.rpc("getKey",{address:e})).publicKeyBase64})}hasKey(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return(yield this.rpc("hasKey",{publicKeyBase64:e})).hasKey})}signMessage(e,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return yield this.rpc("signMessage",{address:e,message:r})})}deleteKey(e){return _chunkDSIFRRBScjs.h.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 _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let i=yield this.sendRpc(e,r);if(i.fatal){_chunk36GZTRZXcjs.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 i.value})}sendRpc(e,r){return _chunkDSIFRRBScjs.h.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((s,o)=>{let f=setTimeout(()=>{window.removeEventListener("message",p),o(new Error(`Device signer RPC "${e}" timed out after ${E}ms`))},E);function p(y){let d=y.data;d==null||d.id!==g||y.origin===a&&(clearTimeout(f),window.removeEventListener("message",p),d.type==="error"&&d.code===L?s({fatal:!0}):d.type==="error"?o(new Error(d.error)):s({value:d.result,fatal:!1}))}window.addEventListener("message",p),t.postMessage({type:e,id:g,payload:r},this.iframeUrl)})})}reloadIframe(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){if(this.reloading!=null)return this.reloading;let e=_chunkDSIFRRBScjs.h.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=i=>_chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){if(i.origin!==r)return;let t=i.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 s=t.payload,o=yield _ox.WebAuthnP256.createCredential({name:s.name});a={id:o.id,publicKey:{x:`0x${o.publicKey.x.toString(16)}`,y:`0x${o.publicKey.y.toString(16)}`}}}else if(t.action==="sign"){let s=t.payload,{signature:o,metadata:f}=yield _ox.WebAuthnP256.sign({credentialId:s.credentialId,challenge:s.challenge});a={signature:{r:`0x${o.r.toString(16)}`,s:`0x${o.s.toString(16)}`},metadata:f}}g.postMessage({type:"biometric-response",id:t.id,result:a},this.iframeUrl)}catch(a){let s=a instanceof Error?a.message:"Unknown biometric error";g.postMessage({type:"biometric-response",id:t.id,error:s},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,i)=>{e.onload=()=>{this.setupBiometricListener(e),r(e)},e.onerror=()=>i(new Error("Failed to load device signer iframe")),document.body.appendChild(e)})}getDeviceName(){var t;if(typeof navigator=="undefined")return"Unknown Device";let e=navigator.userAgent,r=this.parseDevice(e),i=this.parseBrowser(e);return r!=null&&i!=null?`${i} on ${r}`:(t=r!=null?r:i)!=null?t:"Unknown Device"}parseDevice(e){return/iPad/.test(e)?"iPad":/iPhone/.test(e)?"iPhone":/Macintosh|Mac OS X/.test(e)?"Mac":/Windows/.test(e)?"Windows":/Android/.test(e)?"Android":/Linux/.test(e)?"Linux":/CrOS/.test(e)?"ChromeOS":null}parseBrowser(e){return/Edg\//.test(e)?"Edge":/OPR\/|Opera/.test(e)?"Opera":typeof navigator!="undefined"&&"brave"in navigator?"Brave":/Chrome\//.test(e)?"Chrome":/Safari\//.test(e)&&!/Chrome\//.test(e)?"Safari":/Firefox\//.test(e)?"Firefox":null}};_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunk36GZTRZXcjs.a,methodName:"deviceSignerKeyStorage.generateKey"})],c.prototype,"generateKey",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunk36GZTRZXcjs.a,methodName:"deviceSignerKeyStorage.mapAddressToKey"})],c.prototype,"mapAddressToKey",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunk36GZTRZXcjs.a,methodName:"deviceSignerKeyStorage.getKey"})],c.prototype,"getKey",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunk36GZTRZXcjs.a,methodName:"deviceSignerKeyStorage.hasKey"})],c.prototype,"hasKey",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunk36GZTRZXcjs.a,methodName:"deviceSignerKeyStorage.signMessage"})],c.prototype,"signMessage",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunk36GZTRZXcjs.a,methodName:"deviceSignerKeyStorage.deleteKey"})],c.prototype,"deleteKey",1);exports.a = c;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkQJ3BV3MWcjs = require('./chunk-QJ3BV3MW.cjs');var _chunkB45GSXKNcjs = require('./chunk-B45GSXKN.cjs');var _chunk3SSOE7BVcjs = require('./chunk-3SSOE7BV.cjs');var _chunk4LXZPDTPcjs = require('./chunk-4LXZPDTP.cjs');var _chunkJI3OXPVCcjs = require('./chunk-JI3OXPVC.cjs');var _chunkXFUCYR24cjs = require('./chunk-XFUCYR24.cjs');var _chunkVXWRNGOBcjs = require('./chunk-VXWRNGOB.cjs');var _chunkD2S37DJ5cjs = require('./chunk-D2S37DJ5.cjs');function u(r){switch(r){case"email":return _chunkB45GSXKNcjs.a;case"phone":return _chunkJI3OXPVCcjs.a;case"passkey":return _chunk4LXZPDTPcjs.a;case"device":return _chunkQJ3BV3MWcjs.a;case"api-key":return _chunkVXWRNGOBcjs.a;case"server":return _chunkXFUCYR24cjs.a;case"external-wallet":return _chunk3SSOE7BVcjs.b;default:throw new (0, _chunkD2S37DJ5cjs.k)(`Unknown signer type: ${r}`)}}exports.a = u;
@@ -1 +1 @@
1
- import{a as m}from"./chunk-X56YW5CL.js";import{a as C}from"./chunk-OQZTL6ZG.js";import{a as u}from"./chunk-NU7VF7MC.js";function d(e,s){var l,t,r,i,a;let n=(l=e.chains)==null?void 0:l[s],c=m(s).balanceTokenFields(n);return u(u(u(u({symbol:(t=e.symbol)!=null?t:"",name:(r=e.name)!=null?r:"",amount:(i=e.amount)!=null?i:"0",decimals:e.decimals,rawAmount:(a=e.rawAmount)!=null?a:"0"},(n==null?void 0:n.available)!=null?{available:n.available}:{}),(n==null?void 0:n.locked)!=null?{locked:n.locked}:{}),(n==null?void 0:n.accounts)!=null?{accounts:n.accounts}:{}),c)}function B(e,s){let n={symbol:e,name:e,amount:"0",decimals:0,rawAmount:"0"},c=m(s).emptyBalanceTokenFields();return u(u({},n),c)}function b(e,s,n){var r,i,a,f,p;if(s==null)return!0;let c=((r=e.symbol)!=null?r:"").toLowerCase();if(s.has(c))return!0;let l=(i=e.chains)==null?void 0:i[n];if(l==null)return!1;let t=C(n);if(t==="solana"&&"mintHash"in l){let o=(a=l.mintHash)==null?void 0:a.toLowerCase();return o!=null&&(s.has(o)||s.has(`solana:${o}`))}if(t==="stellar"&&"contractId"in l){let o=(f=l.contractId)==null?void 0:f.toLowerCase();return o!=null&&(s.has(o)||s.has(`stellar:${o}`))}if("contractAddress"in l){let o=(p=l.contractAddress)==null?void 0:p.toLowerCase();return o!=null&&(s.has(o)||s.has(`${n}:${o}`))}return!1}function g(e,s,n,c){let l=e.find(a=>a.symbol===n),t=e.find(a=>a.symbol==="usdc"),r=c!=null?new Set(c.map(a=>a.toLowerCase())):null,i=e.filter(a=>a.symbol!==n&&a.symbol!=="usdc"&&b(a,r,s));return{nativeToken:l!=null?d(l,s):B(n,s),usdc:t!=null?d(t,s):B("usdc",s),tokens:i.map(a=>d(a,s))}}export{g as a};
1
+ import{a as m}from"./chunk-PJ76KALO.js";import{a as C}from"./chunk-OQZTL6ZG.js";import{a as u}from"./chunk-NU7VF7MC.js";function d(e,s){var l,t,r,i,a;let n=(l=e.chains)==null?void 0:l[s],c=m(s).balanceTokenFields(n);return u(u(u(u({symbol:(t=e.symbol)!=null?t:"",name:(r=e.name)!=null?r:"",amount:(i=e.amount)!=null?i:"0",decimals:e.decimals,rawAmount:(a=e.rawAmount)!=null?a:"0"},(n==null?void 0:n.available)!=null?{available:n.available}:{}),(n==null?void 0:n.locked)!=null?{locked:n.locked}:{}),(n==null?void 0:n.accounts)!=null?{accounts:n.accounts}:{}),c)}function B(e,s){let n={symbol:e,name:e,amount:"0",decimals:0,rawAmount:"0"},c=m(s).emptyBalanceTokenFields();return u(u({},n),c)}function b(e,s,n){var r,i,a,f,p;if(s==null)return!0;let c=((r=e.symbol)!=null?r:"").toLowerCase();if(s.has(c))return!0;let l=(i=e.chains)==null?void 0:i[n];if(l==null)return!1;let t=C(n);if(t==="solana"&&"mintHash"in l){let o=(a=l.mintHash)==null?void 0:a.toLowerCase();return o!=null&&(s.has(o)||s.has(`solana:${o}`))}if(t==="stellar"&&"contractId"in l){let o=(f=l.contractId)==null?void 0:f.toLowerCase();return o!=null&&(s.has(o)||s.has(`stellar:${o}`))}if("contractAddress"in l){let o=(p=l.contractAddress)==null?void 0:p.toLowerCase();return o!=null&&(s.has(o)||s.has(`${n}:${o}`))}return!1}function g(e,s,n,c){let l=e.find(a=>a.symbol===n),t=e.find(a=>a.symbol==="usdc"),r=c!=null?new Set(c.map(a=>a.toLowerCase())):null,i=e.filter(a=>a.symbol!==n&&a.symbol!=="usdc"&&b(a,r,s));return{nativeToken:l!=null?d(l,s):B(n,s),usdc:t!=null?d(t,s):B("usdc",s),tokens:i.map(a=>d(a,s))}}export{g as a};
@@ -1 +1 @@
1
- import{a as o}from"./chunk-BV6IQIQK.js";var t={type:"passkey",validateConfig(){},buildInternalConfig(n){var r;let e=n,i=(r=o(e))!=null?r:"";return{type:"passkey",id:i,locator:`passkey:${i}`,name:"name"in e?e.name:void 0,publicKey:"publicKey"in e?e.publicKey:void 0,onCreatePasskey:e.onCreatePasskey,onSignWithPasskey:e.onSignWithPasskey}},canAutoAssemble(){return!0},addSignerPayload(n){return n},matchesRecovery(n,e){let i=o(n),r=o(e);return i==null||r==null?!0:i===r},adoptsRecoveryConfigOnMatch:!1,signerUnavailableReason:()=>null};export{t as a};
1
+ import{a as o}from"./chunk-RV3Q5EIA.js";var t={type:"passkey",validateConfig(){},buildInternalConfig(n){var r;let e=n,i=(r=o(e))!=null?r:"";return{type:"passkey",id:i,locator:`passkey:${i}`,name:"name"in e?e.name:void 0,publicKey:"publicKey"in e?e.publicKey:void 0,onCreatePasskey:e.onCreatePasskey,onSignWithPasskey:e.onSignWithPasskey}},canAutoAssemble(){return!0},addSignerPayload(n){return n},matchesRecovery(n,e){let i=o(n),r=o(e);return i==null||r==null?!0:i===r},adoptsRecoveryConfigOnMatch:!1,signerUnavailableReason:()=>null};export{t as a};
@@ -1 +1 @@
1
- import{a as i}from"./chunk-BHLJZVGK.js";import{H as u}from"./chunk-KOHPRJDP.js";import{a as t}from"./chunk-VOFCBB2P.js";import{a as f,c,h as s}from"./chunk-NU7VF7MC.js";import{isValidStellarAddress as T,WithLoggerContext as g}from"@crossmint/common-sdk-base";var m=409,l=class l extends i{constructor(e){super({chain:e.chain,address:e.address,owner:e.owner,options:i.getOptions(e),alias:e.alias,recovery:i.getRecoverySigners(e),apiRecoveryServerSignerAddresses:i.getApiRecoveryServerSignerAddresses(e),apiDelegatedServerSignerAddresses:i.getApiDelegatedServerSignerAddresses(e),signer:e.signer,signers:i.getInitialSigners(e)},i.getApiClient(e))}static from(e){if(!T(e.address))throw new Error("Wallet is not a Stellar wallet");return new l(e)}sendTransaction(e){return s(this,null,function*(){var d;t.info("stellarWallet.sendTransaction.start"),yield this.preAuthIfNeeded();let r=yield this.createTransaction(e);if((d=e.options)!=null&&d.prepareOnly)return t.info("stellarWallet.sendTransaction.prepared",{transactionId:r.id}),{hash:void 0,explorerLink:void 0,transactionId:r.id};let a={},n=yield this.approveTransactionAndWait(r.id,a);return t.info("stellarWallet.sendTransaction.success",{transactionId:r.id,hash:n.hash}),n})}upgrade(e){return s(this,null,function*(){t.info("stellarWallet.upgrade.start"),yield this.preAuthIfNeeded();let r=yield this.createWalletLifecycleTransaction("upgrade-wallet",e);if(r!=null){if(e!=null&&e.prepareOnly)return t.info("stellarWallet.upgrade.prepared",{transactionId:r}),{hash:void 0,explorerLink:void 0,transactionId:r};yield this.approveTransactionAndWait(r),t.info("stellarWallet.upgrade.phase1.success",{transactionId:r})}else t.info("stellarWallet.upgrade.phase1.skipped",{reason:"wallet already locked from a prior upgrade"});let a=yield this.migrateInternal({signer:e==null?void 0:e.signer,prepareOnly:e==null?void 0:e.prepareOnly});return t.info("stellarWallet.upgrade.success",{transactionId:a.transactionId,hash:a.hash}),a})}migrate(e){return s(this,null,function*(){return yield this.preAuthIfNeeded(),yield this.migrateInternal(e)})}migrateInternal(e){return s(this,null,function*(){t.info("stellarWallet.migrate.start");let r=yield this.createWalletLifecycleTransaction("migrate-wallet",e);if(r==null)throw new u("Failed to create migrate-wallet transaction");if(e!=null&&e.prepareOnly)return t.info("stellarWallet.migrate.prepared",{transactionId:r}),{hash:void 0,explorerLink:void 0,transactionId:r};let a=yield this.approveTransactionAndWait(r);return t.info("stellarWallet.migrate.success",{transactionId:r,hash:a.hash}),a})}createTransaction(e){return s(this,null,function*(){let{contractId:r,options:a}=e,n=this.resolveStellarSigner(a==null?void 0:a.signer),d="transaction"in e?{type:"serialized-transaction",serializedTransaction:e.transaction,contractId:r}:{type:"contract-call",contractId:r,method:e.method,memo:e.memo!=null?{type:"text",value:e.memo}:void 0,args:e.args},p=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:d,signer:n}});if("error"in p)throw new u(JSON.stringify(p));return p})}createWalletLifecycleTransaction(e,r){return s(this,null,function*(){let a=(r==null?void 0:r.signer)!=null?this.resolveStellarSigner(r.signer):void 0,n=yield this.apiClient.createTransaction(this.walletLocator,{params:f({transaction:{type:e}},a!=null?{signer:a}:{})});if("error"in n){if(e==="upgrade-wallet"&&y(n))return null;throw new u(JSON.stringify(n))}return n.id})}resolveStellarSigner(e){return e==null?this.signerManager.require().locator():typeof e=="string"?e:this.resolveServerSignerApiLocator(e)}};c([g({logger:t,methodName:"stellarWallet.sendTransaction",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"sendTransaction",1),c([g({logger:t,methodName:"stellarWallet.upgrade",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"upgrade",1),c([g({logger:t,methodName:"stellarWallet.migrate",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"migrate",1);var h=l;function y(o){return typeof o=="object"&&o!==null&&"statusCode"in o&&o.statusCode===m}export{h as a};
1
+ import{a as i}from"./chunk-C5LIXILN.js";import{I as u}from"./chunk-4I3EXM4B.js";import{a as t}from"./chunk-2YLAHC7J.js";import{a as f,c,h as s}from"./chunk-NU7VF7MC.js";import{isValidStellarAddress as T,WithLoggerContext as g}from"@crossmint/common-sdk-base";var m=409,l=class l extends i{constructor(e){super({chain:e.chain,address:e.address,owner:e.owner,options:i.getOptions(e),alias:e.alias,recovery:i.getRecoverySigners(e),apiRecoveryServerSignerAddresses:i.getApiRecoveryServerSignerAddresses(e),apiDelegatedServerSignerAddresses:i.getApiDelegatedServerSignerAddresses(e),signer:e.signer,signers:i.getInitialSigners(e)},i.getApiClient(e))}static from(e){if(!T(e.address))throw new Error("Wallet is not a Stellar wallet");return new l(e)}sendTransaction(e){return s(this,null,function*(){var d;t.info("stellarWallet.sendTransaction.start"),yield this.preAuthIfNeeded();let r=yield this.createTransaction(e);if((d=e.options)!=null&&d.prepareOnly)return t.info("stellarWallet.sendTransaction.prepared",{transactionId:r.id}),{hash:void 0,explorerLink:void 0,transactionId:r.id};let a={},n=yield this.approveTransactionAndWait(r.id,a);return t.info("stellarWallet.sendTransaction.success",{transactionId:r.id,hash:n.hash}),n})}upgrade(e){return s(this,null,function*(){t.info("stellarWallet.upgrade.start"),yield this.preAuthIfNeeded();let r=yield this.createWalletLifecycleTransaction("upgrade-wallet",e);if(r!=null){if(e!=null&&e.prepareOnly)return t.info("stellarWallet.upgrade.prepared",{transactionId:r}),{hash:void 0,explorerLink:void 0,transactionId:r};yield this.approveTransactionAndWait(r),t.info("stellarWallet.upgrade.phase1.success",{transactionId:r})}else t.info("stellarWallet.upgrade.phase1.skipped",{reason:"wallet already locked from a prior upgrade"});let a=yield this.migrateInternal({signer:e==null?void 0:e.signer,prepareOnly:e==null?void 0:e.prepareOnly});return t.info("stellarWallet.upgrade.success",{transactionId:a.transactionId,hash:a.hash}),a})}migrate(e){return s(this,null,function*(){return yield this.preAuthIfNeeded(),yield this.migrateInternal(e)})}migrateInternal(e){return s(this,null,function*(){t.info("stellarWallet.migrate.start");let r=yield this.createWalletLifecycleTransaction("migrate-wallet",e);if(r==null)throw new u("Failed to create migrate-wallet transaction");if(e!=null&&e.prepareOnly)return t.info("stellarWallet.migrate.prepared",{transactionId:r}),{hash:void 0,explorerLink:void 0,transactionId:r};let a=yield this.approveTransactionAndWait(r);return t.info("stellarWallet.migrate.success",{transactionId:r,hash:a.hash}),a})}createTransaction(e){return s(this,null,function*(){let{contractId:r,options:a}=e,n=this.resolveStellarSigner(a==null?void 0:a.signer),d="transaction"in e?{type:"serialized-transaction",serializedTransaction:e.transaction,contractId:r}:{type:"contract-call",contractId:r,method:e.method,memo:e.memo!=null?{type:"text",value:e.memo}:void 0,args:e.args},p=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:d,signer:n}});if("error"in p)throw new u(JSON.stringify(p));return p})}createWalletLifecycleTransaction(e,r){return s(this,null,function*(){let a=(r==null?void 0:r.signer)!=null?this.resolveStellarSigner(r.signer):void 0,n=yield this.apiClient.createTransaction(this.walletLocator,{params:f({transaction:{type:e}},a!=null?{signer:a}:{})});if("error"in n){if(e==="upgrade-wallet"&&y(n))return null;throw new u(JSON.stringify(n))}return n.id})}resolveStellarSigner(e){return e==null?this.signerManager.require().locator():typeof e=="string"?e:this.resolveServerSignerApiLocator(e)}};c([g({logger:t,methodName:"stellarWallet.sendTransaction",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"sendTransaction",1),c([g({logger:t,methodName:"stellarWallet.upgrade",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"upgrade",1),c([g({logger:t,methodName:"stellarWallet.migrate",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"migrate",1);var h=l;function y(o){return typeof o=="object"&&o!==null&&"statusCode"in o&&o.statusCode===m}export{h as a};
@@ -1 +1 @@
1
- import{a as t}from"./chunk-X4GV76CR.js";import{a}from"./chunk-VPUAUWI4.js";import{a as i}from"./chunk-VNFATNQJ.js";import{a as r}from"./chunk-OQZTL6ZG.js";var n={evm:t,solana:a,stellar:i};function m(e){return n[r(e)]}function p(e){return Object.prototype.hasOwnProperty.call(n,e)}function A(e,o){return p(e)?n[e]:o}export{m as a,p as b,A as c};
1
+ import{a as t}from"./chunk-WRXF6ZSY.js";import{a}from"./chunk-3W22A7E7.js";import{a as i}from"./chunk-67VE25UL.js";import{a as r}from"./chunk-OQZTL6ZG.js";var n={evm:t,solana:a,stellar:i};function m(e){return n[r(e)]}function p(e){return Object.prototype.hasOwnProperty.call(n,e)}function A(e,o){return p(e)?n[e]:o}export{m as a,p as b,A as c};
@@ -1 +1 @@
1
- import{a as S}from"./chunk-C6E6WC4P.js";import{a as O}from"./chunk-V5NY4W5H.js";import{a as C}from"./chunk-CGQCRDG7.js";import{a as l}from"./chunk-KKQBZXFE.js";import{a as I}from"./chunk-S3DYQVRD.js";import{a as m}from"./chunk-KUP7H7X2.js";import{a as _}from"./chunk-FT5EVMLB.js";import{a as s}from"./chunk-QLOW4D2N.js";import{a as A}from"./chunk-SVIKBM3S.js";import{b as i,c as o}from"./chunk-KOHPRJDP.js";import{a as E}from"./chunk-VOFCBB2P.js";import{APIKeyEnvironmentPrefix as N,BlockchainIncludingTestnet as e}from"@crossmint/common-sdk-base";import{baseSepolia as L,base as M,polygonAmoy as R,polygon as P,optimismSepolia as p,optimism as h,arbitrumSepolia as d,arbitrum as f,arbitrumNova as H,avalanche as V,avalancheFuji as B,celo as U,mainnet as W,bsc as v,shape as y,zora as b,zoraSepolia as x,sepolia as F,flowMainnet as w,flowTestnet as Y}from"viem/chains";var g=[e.ABSTRACT_TESTNET,e.ARBITRUM_SEPOLIA,e.AVALANCHE_FUJI,e.BASE_SEPOLIA,e.CELO_SEPOLIA,e.CURTIS,e.ETHEREUM_SEPOLIA,e.FLOW_TESTNET,e.MANTLE_SEPOLIA,e.OPTIMISM_SEPOLIA,e.POLYGON_AMOY,e.ROBINHOOD_CHAIN_TESTNET,e.SCROLL_SEPOLIA,e.SEI_ATLANTIC_2_TESTNET,e.STORY_TESTNET,e.ZORA_SEPOLIA,e.ARC_TESTNET,e.TEMPO_TESTNET],D=[e.ABSTRACT,e.APECHAIN,e.ARBITRUM,e.ARBITRUMNOVA,e.ARC,e.AVALANCHE,e.BASE,e.BSC,e.CELO,e.ETHEREUM,e.FLOW,e.MANTLE,e.OPTIMISM,e.POLYGON,e.ROBINHOOD_CHAIN,e.SCROLL,e.SEI_PACIFIC_1,e.SHAPE,e.STORY,e.TEMPO,e.ZORA];function ie(t){switch(t){case e.BASE_SEPOLIA:return L;case e.BASE:return M;case e.POLYGON_AMOY:return R;case e.POLYGON:return P;case e.OPTIMISM_SEPOLIA:return p;case e.OPTIMISM:return h;case e.ARBITRUM_SEPOLIA:return d;case e.ARBITRUM:return f;case e.ARBITRUMNOVA:return H;case e.AVALANCHE:return V;case e.AVALANCHE_FUJI:return B;case e.CELO:return U;case e.CELO_SEPOLIA:return S;case e.ROBINHOOD_CHAIN:return O;case e.ROBINHOOD_CHAIN_TESTNET:return C;case e.STORY_TESTNET:return I;case e.STORY:return l;case e.BSC:return v;case e.SHAPE:return y;case e.ZORA:return b;case e.ZORA_SEPOLIA:return x;case e.ETHEREUM_SEPOLIA:return F;case e.ETHEREUM:return W;case e.FLOW:return w;case e.FLOW_TESTNET:return Y;case e.ARC:return s;case e.ARC_TESTNET:return A;case e.TEMPO:return m;case e.TEMPO_TESTNET:return _;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: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 c(t){return g.includes(t)}function u(t){return D.includes(t)}var $={[e.ABSTRACT]:e.ABSTRACT_TESTNET,[e.APECHAIN]:e.CURTIS,[e.ARBITRUM]:e.ARBITRUM_SEPOLIA,[e.AVALANCHE]:e.AVALANCHE_FUJI,[e.BASE]:e.BASE_SEPOLIA,[e.CELO]:e.CELO_SEPOLIA,[e.ETHEREUM]:e.ETHEREUM_SEPOLIA,[e.FLOW]:e.FLOW_TESTNET,[e.MANTLE]:e.MANTLE_SEPOLIA,[e.OPTIMISM]:e.OPTIMISM_SEPOLIA,[e.POLYGON]:e.POLYGON_AMOY,[e.ROBINHOOD_CHAIN]:e.ROBINHOOD_CHAIN_TESTNET,[e.SCROLL]:e.SCROLL_SEPOLIA,[e.SEI_PACIFIC_1]:e.SEI_ATLANTIC_2_TESTNET,[e.STORY]:e.STORY_TESTNET,[e.ZORA]:e.ZORA_SEPOLIA,[e.TEMPO]:e.TEMPO_TESTNET,[e.ARC]:e.ARC_TESTNET};function G(t){return $[t]}function Z(t){return t==="solana"||t==="stellar"||c(t)||u(t)}function oe(t,a){if(!Z(t))throw new o(`Unknown chain "${t}". Please use a supported chain name (e.g. "base-sepolia", "polygon", "solana", "stellar").`);if(t==="solana"||t==="stellar")return t;let r=t,T=a===N.PRODUCTION;if(T&&c(r))throw new i(`Chain "${t}" is a testnet chain and cannot be used in production. Please use a mainnet chain instead.`);if(!T&&u(r)){let n=G(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{ie as a,c as b,u as c,G as d,Z as e,oe as f};
1
+ import{a as S}from"./chunk-C6E6WC4P.js";import{a as O}from"./chunk-V5NY4W5H.js";import{a as C}from"./chunk-CGQCRDG7.js";import{a as l}from"./chunk-KKQBZXFE.js";import{a as I}from"./chunk-S3DYQVRD.js";import{a as m}from"./chunk-KUP7H7X2.js";import{a as _}from"./chunk-FT5EVMLB.js";import{a as s}from"./chunk-QLOW4D2N.js";import{a as A}from"./chunk-SVIKBM3S.js";import{b as i,c as o}from"./chunk-4I3EXM4B.js";import{a as E}from"./chunk-2YLAHC7J.js";import{APIKeyEnvironmentPrefix as N,BlockchainIncludingTestnet as e}from"@crossmint/common-sdk-base";import{baseSepolia as L,base as M,polygonAmoy as R,polygon as P,optimismSepolia as p,optimism as h,arbitrumSepolia as d,arbitrum as f,arbitrumNova as H,avalanche as V,avalancheFuji as B,celo as U,mainnet as W,bsc as v,shape as y,zora as b,zoraSepolia as x,sepolia as F,flowMainnet as w,flowTestnet as Y}from"viem/chains";var g=[e.ABSTRACT_TESTNET,e.ARBITRUM_SEPOLIA,e.AVALANCHE_FUJI,e.BASE_SEPOLIA,e.CELO_SEPOLIA,e.CURTIS,e.ETHEREUM_SEPOLIA,e.FLOW_TESTNET,e.MANTLE_SEPOLIA,e.OPTIMISM_SEPOLIA,e.POLYGON_AMOY,e.ROBINHOOD_CHAIN_TESTNET,e.SCROLL_SEPOLIA,e.SEI_ATLANTIC_2_TESTNET,e.STORY_TESTNET,e.ZORA_SEPOLIA,e.ARC_TESTNET,e.TEMPO_TESTNET],D=[e.ABSTRACT,e.APECHAIN,e.ARBITRUM,e.ARBITRUMNOVA,e.ARC,e.AVALANCHE,e.BASE,e.BSC,e.CELO,e.ETHEREUM,e.FLOW,e.MANTLE,e.OPTIMISM,e.POLYGON,e.ROBINHOOD_CHAIN,e.SCROLL,e.SEI_PACIFIC_1,e.SHAPE,e.STORY,e.TEMPO,e.ZORA];function ie(t){switch(t){case e.BASE_SEPOLIA:return L;case e.BASE:return M;case e.POLYGON_AMOY:return R;case e.POLYGON:return P;case e.OPTIMISM_SEPOLIA:return p;case e.OPTIMISM:return h;case e.ARBITRUM_SEPOLIA:return d;case e.ARBITRUM:return f;case e.ARBITRUMNOVA:return H;case e.AVALANCHE:return V;case e.AVALANCHE_FUJI:return B;case e.CELO:return U;case e.CELO_SEPOLIA:return S;case e.ROBINHOOD_CHAIN:return O;case e.ROBINHOOD_CHAIN_TESTNET:return C;case e.STORY_TESTNET:return I;case e.STORY:return l;case e.BSC:return v;case e.SHAPE:return y;case e.ZORA:return b;case e.ZORA_SEPOLIA:return x;case e.ETHEREUM_SEPOLIA:return F;case e.ETHEREUM:return W;case e.FLOW:return w;case e.FLOW_TESTNET:return Y;case e.ARC:return s;case e.ARC_TESTNET:return A;case e.TEMPO:return m;case e.TEMPO_TESTNET:return _;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: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 c(t){return g.includes(t)}function u(t){return D.includes(t)}var $={[e.ABSTRACT]:e.ABSTRACT_TESTNET,[e.APECHAIN]:e.CURTIS,[e.ARBITRUM]:e.ARBITRUM_SEPOLIA,[e.AVALANCHE]:e.AVALANCHE_FUJI,[e.BASE]:e.BASE_SEPOLIA,[e.CELO]:e.CELO_SEPOLIA,[e.ETHEREUM]:e.ETHEREUM_SEPOLIA,[e.FLOW]:e.FLOW_TESTNET,[e.MANTLE]:e.MANTLE_SEPOLIA,[e.OPTIMISM]:e.OPTIMISM_SEPOLIA,[e.POLYGON]:e.POLYGON_AMOY,[e.ROBINHOOD_CHAIN]:e.ROBINHOOD_CHAIN_TESTNET,[e.SCROLL]:e.SCROLL_SEPOLIA,[e.SEI_PACIFIC_1]:e.SEI_ATLANTIC_2_TESTNET,[e.STORY]:e.STORY_TESTNET,[e.ZORA]:e.ZORA_SEPOLIA,[e.TEMPO]:e.TEMPO_TESTNET,[e.ARC]:e.ARC_TESTNET};function G(t){return $[t]}function Z(t){return t==="solana"||t==="stellar"||c(t)||u(t)}function oe(t,a){if(!Z(t))throw new o(`Unknown chain "${t}". Please use a supported chain name (e.g. "base-sepolia", "polygon", "solana", "stellar").`);if(t==="solana"||t==="stellar")return t;let r=t,T=a===N.PRODUCTION;if(T&&c(r))throw new i(`Chain "${t}" is a testnet chain and cannot be used in production. Please use a mainnet chain instead.`);if(!T&&u(r)){let n=G(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{ie as a,c as b,u as c,G as d,Z as e,oe as f};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkM76VM347cjs = require('./chunk-M76VM347.cjs');var _chunkT5EOJ3ZFcjs = require('./chunk-T5EOJ3ZF.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');var a=class g extends _chunkM76VM347cjs.a{constructor(n){super(n)}signMessage(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for stellar signer"))})}signTransaction(n){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var i;yield this.handleAuthRequired();let d=this.getJwtOrThrow();_chunkT5EOJ3ZFcjs.a.info("sign: sending request",{keyType:"ed25519"});let c=Date.now(),e=yield(i=this.config.clientTEEConnection)==null?void 0:i.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:d,apiKey:this.config.crossmint.apiKey},data:{keyType:"ed25519",bytes:n,encoding:"base64",authId:this.getAuthId()}},options:_chunkM76VM347cjs.b});if(_chunkT5EOJ3ZFcjs.a.info("sign: response received",{status:e==null?void 0:e.status,durationMs:Date.now()-c}),(e==null?void 0:e.status)==="error")throw new Error(e.error);if((e==null?void 0:e.signature)==null)throw new Error("Failed to sign transaction");if(g.verifyPublicKeyFormat(e.publicKey),e.signature.encoding!=="base64")throw new Error("Wrong encoding for signature. Expected base64, got "+e.signature.encoding);return{signature:e.signature.bytes}})}static verifyPublicKeyFormat(n){if(n==null)throw new Error("No public key found");if(n.encoding!=="base64"||n.keyType!=="ed25519"||n.bytes==null)throw new Error("Not supported. Expected public key to be in base64 encoding and ed25519 key type. Got: "+JSON.stringify(n))}getChainKeyParams(){return{scheme:"ed25519",encoding:"strkey"}}};exports.a = a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkWSCABGVOcjs = require('./chunk-WSCABGVO.cjs');var _chunk36GZTRZXcjs = require('./chunk-36GZTRZX.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');var a=class g extends _chunkWSCABGVOcjs.a{constructor(n){super(n)}signMessage(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for stellar signer"))})}signTransaction(n){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var i;yield this.handleAuthRequired();let d=this.getJwtOrThrow();_chunk36GZTRZXcjs.a.info("sign: sending request",{keyType:"ed25519"});let c=Date.now(),e=yield(i=this.config.clientTEEConnection)==null?void 0:i.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:d,apiKey:this.config.crossmint.apiKey},data:{keyType:"ed25519",bytes:n,encoding:"base64",authId:this.getAuthId()}},options:_chunkWSCABGVOcjs.b});if(_chunk36GZTRZXcjs.a.info("sign: response received",{status:e==null?void 0:e.status,durationMs:Date.now()-c}),(e==null?void 0:e.status)==="error")throw new Error(e.error);if((e==null?void 0:e.signature)==null)throw new Error("Failed to sign transaction");if(g.verifyPublicKeyFormat(e.publicKey),e.signature.encoding!=="base64")throw new Error("Wrong encoding for signature. Expected base64, got "+e.signature.encoding);return{signature:e.signature.bytes}})}static verifyPublicKeyFormat(n){if(n==null)throw new Error("No public key found");if(n.encoding!=="base64"||n.keyType!=="ed25519"||n.bytes==null)throw new Error("Not supported. Expected public key to be in base64 encoding and ed25519 key type. Got: "+JSON.stringify(n))}getChainKeyParams(){return{scheme:"ed25519",encoding:"strkey"}}};exports.a = a;
@@ -1 +1 @@
1
- import{g as a}from"./chunk-KOHPRJDP.js";import{isEmailValid as c}from"@crossmint/common-sdk-auth";var m=(n,t,o)=>`Wallet signer configuration mismatch at "${n}" - expected "${o}" from existing wallet but found "${t}"`;function u(n){let o=n.toLowerCase().split("@"),r=o[1],i=r==="googlemail.com",e=(i||r==="gmail.com")&&o[0].includes(".");return i&&(o[1]="gmail.com"),e&&(o[0]=o[0].replace(/\./g,"")),`${o[0]}@${o[1]}`}function f(n){return/^0x[0-9a-fA-F]+$/.test(n)?BigInt(n).toString():n}function l(n,t=""){if(typeof n=="string"){if(c(n))return u(n);if(t.endsWith(".x")||t.endsWith(".y"))return f(n)}return n}function d(n,t,o=""){if(n!==t){if(n==null||t==null)throw new Error(`Cannot compare null or undefined signer configs at path: ${o}`);for(let r of Object.keys(n)){if(!(r in t))continue;let i=o?`${o}.${r}`:r,s=n[r],e=t[r];if(typeof s=="object"&&s!==null&&typeof e=="object"&&e!==null)d(s,e,i);else if(l(s,i)!==l(e,i))throw new a(m(i,s,e))}}}export{u as a,l as b,d as c};
1
+ import{g as a}from"./chunk-4I3EXM4B.js";import{isEmailValid as c}from"@crossmint/common-sdk-auth";var m=(n,t,o)=>`Wallet signer configuration mismatch at "${n}" - expected "${o}" from existing wallet but found "${t}"`;function u(n){let o=n.toLowerCase().split("@"),r=o[1],i=r==="googlemail.com",e=(i||r==="gmail.com")&&o[0].includes(".");return i&&(o[1]="gmail.com"),e&&(o[0]=o[0].replace(/\./g,"")),`${o[0]}@${o[1]}`}function f(n){return/^0x[0-9a-fA-F]+$/.test(n)?BigInt(n).toString():n}function l(n,t=""){if(typeof n=="string"){if(c(n))return u(n);if(t.endsWith(".x")||t.endsWith(".y"))return f(n)}return n}function d(n,t,o=""){if(n!==t){if(n==null||t==null)throw new Error(`Cannot compare null or undefined signer configs at path: ${o}`);for(let r of Object.keys(n)){if(!(r in t))continue;let i=o?`${o}.${r}`:r,s=n[r],e=t[r];if(typeof s=="object"&&s!==null&&typeof e=="object"&&e!==null)d(s,e,i);else if(l(s,i)!==l(e,i))throw new a(m(i,s,e))}}}export{u as a,l as b,d as c};
@@ -1 +1 @@
1
- import{b as n}from"./chunk-BV6IQIQK.js";var s={type:"email",validateConfig(e){if(!("email"in e)||e.email==null)throw new Error("Email signer requires an email address")},buildInternalConfig(e,i){let r=e,o=n(e);return{type:"email",email:r.email,locator:o,address:i.walletAddress,crossmint:i.crossmint,clientTEEConnection:i.clientTEEConnection,resetSignerFrame:i.resetSignerFrame,onAuthRequired:i.onAuthRequired}},canAutoAssemble(){return!0},addSignerPayload(e){return n(e)},matchesRecovery(e,i){return n(e)===n(i)},adoptsRecoveryConfigOnMatch:!0,signerUnavailableReason:()=>null};export{s as a};
1
+ import{b as n}from"./chunk-RV3Q5EIA.js";var s={type:"email",validateConfig(e){if(!("email"in e)||e.email==null)throw new Error("Email signer requires an email address")},buildInternalConfig(e,i){let r=e,o=n(e);return{type:"email",email:r.email,locator:o,address:i.walletAddress,crossmint:i.crossmint,clientTEEConnection:i.clientTEEConnection,resetSignerFrame:i.resetSignerFrame,onAuthRequired:i.onAuthRequired}},canAutoAssemble(){return!0},addSignerPayload(e){return n(e)},matchesRecovery(e,i){return n(e)===n(i)},adoptsRecoveryConfigOnMatch:!0,signerUnavailableReason:()=>null};export{s as a};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkCZC2MNVKcjs = require('./chunk-CZC2MNVK.cjs');var t={type:"device",validateConfig(e){},buildInternalConfig(e,r){return{type:"device",locator:"locator"in e&&e.locator?e.locator:void 0,address:r.walletAddress}},canAutoAssemble(e,r){return r.deviceSignerKeyStorage!=null},addSignerPayload(e){return"publicKey"in e&&e.publicKey!=null?{type:"device",publicKey:e.publicKey,name:e.name}:_chunkCZC2MNVKcjs.b.call(void 0, e)},matchesRecovery(){return!1},adoptsRecoveryConfigOnMatch:!0,signerUnavailableReason:()=>null};exports.a = t;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkWSDMIQNGcjs = require('./chunk-WSDMIQNG.cjs');var t={type:"device",validateConfig(e){},buildInternalConfig(e,r){return{type:"device",locator:"locator"in e&&e.locator?e.locator:void 0,address:r.walletAddress}},canAutoAssemble(e,r){return r.deviceSignerKeyStorage!=null},addSignerPayload(e){return"publicKey"in e&&e.publicKey!=null?{type:"device",publicKey:e.publicKey,name:e.name}:_chunkWSDMIQNGcjs.b.call(void 0, e)},matchesRecovery(){return!1},adoptsRecoveryConfigOnMatch:!0,signerUnavailableReason:()=>null};exports.a = t;
@@ -1 +1 @@
1
- import{a,b as g}from"./chunk-SH6HXAB2.js";import{a as s}from"./chunk-VOFCBB2P.js";import{h as t}from"./chunk-NU7VF7MC.js";import{PersonalMessage as h}from"ox";import{isHex as y,toHex as d}from"viem";var c=class p extends a{constructor(e){super(e)}signMessage(e){return t(this,null,function*(){let i=y(e)?e:d(e),r=h.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 u=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",authId:this.getAuthId()}},options:g});if(s.info("sign: response received",{status:n==null?void 0:n.status,durationMs:Date.now()-u}),(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};
1
+ import{a,b as g}from"./chunk-3F4Z2URU.js";import{a as s}from"./chunk-2YLAHC7J.js";import{h as t}from"./chunk-NU7VF7MC.js";import{PersonalMessage as h}from"ox";import{isHex as y,toHex as d}from"viem";var c=class p extends a{constructor(e){super(e)}signMessage(e){return t(this,null,function*(){let i=y(e)?e:d(e),r=h.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 u=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",authId:this.getAuthId()}},options:g});if(s.info("sign: response received",{status:n==null?void 0:n.status,durationMs:Date.now()-u}),(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
+ var s="@crossmint/wallets-sdk",t="1.19.0";var c="WALLETS_SDK",r=t,a=s,d=200;export{c as a,r as b,a as c,d};
@@ -1 +1 @@
1
- import{a as s,b as o}from"./chunk-SH6HXAB2.js";import{a as r}from"./chunk-VOFCBB2P.js";import{h as t}from"./chunk-NU7VF7MC.js";var a=class g extends s{constructor(n){super(n)}signMessage(){return t(this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for stellar signer"))})}signTransaction(n){return t(this,null,function*(){var i;yield this.handleAuthRequired();let d=this.getJwtOrThrow();r.info("sign: sending request",{keyType:"ed25519"});let c=Date.now(),e=yield(i=this.config.clientTEEConnection)==null?void 0:i.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:d,apiKey:this.config.crossmint.apiKey},data:{keyType:"ed25519",bytes:n,encoding:"base64",authId:this.getAuthId()}},options:o});if(r.info("sign: response received",{status:e==null?void 0:e.status,durationMs:Date.now()-c}),(e==null?void 0:e.status)==="error")throw new Error(e.error);if((e==null?void 0:e.signature)==null)throw new Error("Failed to sign transaction");if(g.verifyPublicKeyFormat(e.publicKey),e.signature.encoding!=="base64")throw new Error("Wrong encoding for signature. Expected base64, got "+e.signature.encoding);return{signature:e.signature.bytes}})}static verifyPublicKeyFormat(n){if(n==null)throw new Error("No public key found");if(n.encoding!=="base64"||n.keyType!=="ed25519"||n.bytes==null)throw new Error("Not supported. Expected public key to be in base64 encoding and ed25519 key type. Got: "+JSON.stringify(n))}getChainKeyParams(){return{scheme:"ed25519",encoding:"strkey"}}};export{a};
1
+ import{a as s,b as o}from"./chunk-3F4Z2URU.js";import{a as r}from"./chunk-2YLAHC7J.js";import{h as t}from"./chunk-NU7VF7MC.js";var a=class g extends s{constructor(n){super(n)}signMessage(){return t(this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for stellar signer"))})}signTransaction(n){return t(this,null,function*(){var i;yield this.handleAuthRequired();let d=this.getJwtOrThrow();r.info("sign: sending request",{keyType:"ed25519"});let c=Date.now(),e=yield(i=this.config.clientTEEConnection)==null?void 0:i.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:d,apiKey:this.config.crossmint.apiKey},data:{keyType:"ed25519",bytes:n,encoding:"base64",authId:this.getAuthId()}},options:o});if(r.info("sign: response received",{status:e==null?void 0:e.status,durationMs:Date.now()-c}),(e==null?void 0:e.status)==="error")throw new Error(e.error);if((e==null?void 0:e.signature)==null)throw new Error("Failed to sign transaction");if(g.verifyPublicKeyFormat(e.publicKey),e.signature.encoding!=="base64")throw new Error("Wrong encoding for signature. Expected base64, got "+e.signature.encoding);return{signature:e.signature.bytes}})}static verifyPublicKeyFormat(n){if(n==null)throw new Error("No public key found");if(n.encoding!=="base64"||n.keyType!=="ed25519"||n.bytes==null)throw new Error("Not supported. Expected public key to be in base64 encoding and ed25519 key type. Got: "+JSON.stringify(n))}getChainKeyParams(){return{scheme:"ed25519",encoding:"strkey"}}};export{a};
@@ -1 +1 @@
1
- import{a as r}from"./chunk-JLWNRQ4S.js";var i="passkey:";function n(e){if(e.id!=null&&e.id!=="")return e.id;if(e.locator!=null&&e.locator.startsWith(i)){let t=e.locator.slice(i.length);return t===""?null:t}return null}function p(e){if(e.type==="external-wallet")return`external-wallet:${e.address}`;if(e.type==="email"&&e.email)return`email:${r(e.email)}`;if(e.type==="phone"&&e.phone)return`phone:${e.phone}`;if(e.type==="passkey"){let t=n(e);if(t!=null)return`passkey:${t}`;if("id"in e)return`passkey:${e.id}`}return e.type==="api-key"?"api-key":e.type==="device"?"locator"in e&&e.locator!=null?e.locator:"device:":e.type}function s(e){let t=e.indexOf(":");return t===-1?{type:e,value:""}:{type:e.substring(0,t),value:e.substring(t+1)}}export{n as a,p as b,s as c};
1
+ import{a as r}from"./chunk-PWYCEHYZ.js";var i="passkey:";function n(e){if(e.id!=null&&e.id!=="")return e.id;if(e.locator!=null&&e.locator.startsWith(i)){let t=e.locator.slice(i.length);return t===""?null:t}return null}function p(e){if(e.type==="external-wallet")return`external-wallet:${e.address}`;if(e.type==="email"&&e.email)return`email:${r(e.email)}`;if(e.type==="phone"&&e.phone)return`phone:${e.phone}`;if(e.type==="passkey"){let t=n(e);if(t!=null)return`passkey:${t}`;if("id"in e)return`passkey:${e.id}`}return e.type==="api-key"?"api-key":e.type==="device"?"locator"in e&&e.locator!=null?e.locator:"device:":e.type}function s(e){let t=e.indexOf(":");return t===-1?{type:e,value:""}:{type:e.substring(0,t),value:e.substring(t+1)}}export{n as a,p as b,s as c};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunk36GZTRZXcjs = require('./chunk-36GZTRZX.cjs');var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);var _ox = require('ox');function d(n){let e=_bs582.default.decode(n)[0];return e!=null&&(e&128)!==0&&(e&127)===1}function c(n){return"transaction"in n.onChain&&typeof n.onChain.transaction=="string"?n.onChain.transaction:void 0}var g={nativeToken:"sol",walletLocatorPrefix:"me:solana:smart",supportsSignatures:!1,addSignerChain(n){},extractAddSignerOperation(n,e,r){if(!("transaction"in n)||n.transaction==null)throw _chunk36GZTRZXcjs.a.error("wallet.addSigner.error",{error:"Expected transaction in response for Solana/Stellar chain"}),new Error("Expected transaction in response for Solana/Stellar chain");return{type:"transaction",id:n.transaction.id}},balanceTokenFields(n){return n!=null&&"mintHash"in n?{mintHash:n.mintHash}:n!=null&&"contractAddress"in n?{contractAddress:n.contractAddress}:{}},emptyBalanceTokenFields(){return{mintHash:void 0}},signApproval(n,e,r){var t;return n.type==="passkey"?n.signTransaction(_ox.Hex.fromBytes(_ox.Base64.toBytes(r))):n.type!=="external-wallet"?n.signTransaction(r):d(r)?n.signMessage(r):n.signTransaction((t=c(e))!=null?t:r)}};exports.a = g;
@@ -1 +1 @@
1
- import{a as s}from"./chunk-WX6KBOP5.js";import{a as l}from"./chunk-5V2RGAOS.js";import{a as o}from"./chunk-HUGHRNQ3.js";import{a as S}from"./chunk-IQARABFX.js";import{a as g}from"./chunk-JAXFDUNN.js";import{a as y}from"./chunk-K7BPGUFU.js";import{a as f}from"./chunk-MN2BGRRJ.js";import{a as C}from"./chunk-FQ5F3VYJ.js";import{a as m}from"./chunk-HAQMNZO5.js";import{a as p}from"./chunk-AB2JJTW4.js";import{a as u}from"./chunk-MLROTECD.js";import{g as i}from"./chunk-KOHPRJDP.js";import{h as t}from"./chunk-NU7VF7MC.js";function c(r,e,n){switch(e.type){case"email":case"phone":return r==="solana"?new l(e):r==="stellar"?new o(e):new s(e);case"api-key":return r==="solana"?new u(e):new C(e);case"external-wallet":return r==="solana"?new g(e):r==="stellar"?new y(e):new m(e);case"server":return S(r,e);case"passkey":return new p(e);case"device":if(n==null)throw new i("Device signer key storage is required for device signers");return new f(e,n)}}function k(r,e,n,a){return t(this,null,function*(){if(!e.startsWith("device:"))return null;let w=e.replace("device:","");return(yield a.hasKey(w))?c(r,{type:"device",locator:e,address:n},a):null})}export{c as a,k as b};
1
+ import{a as s}from"./chunk-QUPMMNGB.js";import{a as l}from"./chunk-YSR4FJK7.js";import{a as o}from"./chunk-R4LSFTQB.js";import{a as S}from"./chunk-IQARABFX.js";import{a as g}from"./chunk-ECKSTWA3.js";import{a as y}from"./chunk-K7BPGUFU.js";import{a as f}from"./chunk-MN2BGRRJ.js";import{a as C}from"./chunk-FQ5F3VYJ.js";import{a as m}from"./chunk-HAQMNZO5.js";import{a as p}from"./chunk-54LGZZX4.js";import{a as u}from"./chunk-MLROTECD.js";import{g as i}from"./chunk-4I3EXM4B.js";import{h as t}from"./chunk-NU7VF7MC.js";function c(r,e,n){switch(e.type){case"email":case"phone":return r==="solana"?new l(e):r==="stellar"?new o(e):new s(e);case"api-key":return r==="solana"?new u(e):new C(e);case"external-wallet":return r==="solana"?new g(e):r==="stellar"?new y(e):new m(e);case"server":return S(r,e);case"passkey":return new p(e);case"device":if(n==null)throw new i("Device signer key storage is required for device signers");return new f(e,n)}}function k(r,e,n,a){return t(this,null,function*(){if(!e.startsWith("device:"))return null;let w=e.replace("device:","");return(yield a.hasKey(w))?c(r,{type:"device",locator:e,address:n},a):null})}export{c as a,k as b};
@@ -1 +1 @@
1
- import{P as i}from"./chunk-KOHPRJDP.js";import{isValidAddress as t}from"@crossmint/common-sdk-base";function d(r){if(typeof r=="string"){if(!t(r))throw new i(`Invalid recipient address: "${r}". Expected a valid EVM (0x...), Solana (base58), or Stellar (G.../C...) address.`);return r}if("email"in r)return`email:${r.email}`;if("x"in r)return`x:${r.x}`;if("twitter"in r)return`twitter:${r.twitter}`;if("phone"in r)return`phoneNumber:${r.phone}`;if("userId"in r)return`userId:${r.userId}`;throw new Error("Invalid recipient locator")}function p(r,e){return t(r)?`${e}:${r}`:`${e}:${r.toLowerCase()}`}export{d as a,p as b};
1
+ import{Q as i}from"./chunk-4I3EXM4B.js";import{isValidAddress as t}from"@crossmint/common-sdk-base";function d(r){if(typeof r=="string"){if(!t(r))throw new i(`Invalid recipient address: "${r}". Expected a valid EVM (0x...), Solana (base58), or Stellar (G.../C...) address.`);return r}if("email"in r)return`email:${r.email}`;if("x"in r)return`x:${r.x}`;if("twitter"in r)return`twitter:${r.twitter}`;if("phone"in r)return`phoneNumber:${r.phone}`;if("userId"in r)return`userId:${r.userId}`;throw new Error("Invalid recipient locator")}function p(r,e){return t(r)?`${e}:${r}`:`${e}:${r.toLowerCase()}`}export{d as a,p as b};
@@ -1 +1 @@
1
- import{a as n}from"./chunk-7SDHPRH6.js";import{a as s}from"./chunk-5LNDUSMZ.js";import{a as l}from"./chunk-ZV2UOOBX.js";import{a,b as i}from"./chunk-VOFCBB2P.js";import{h as r}from"./chunk-NU7VF7MC.js";import{createCrossmint as C}from"@crossmint/common-sdk-base";import{WebAuthnP256 as p}from"ox";var o=class c{constructor(e){i(e.apiKey);let t=new l(e);this.walletFactory=new n(t),a.info("wallets.sdk.initialized")}static from(e){return new c(e)}getWallet(e,t){return r(this,null,function*(){if(typeof e=="string"){if(t==null)throw new Error("Args parameter is required when walletLocator is provided");return yield this.walletFactory.getWallet(e,t)}return yield this.walletFactory.getWallet(e)})}createWallet(e){return r(this,null,function*(){return yield this.walletFactory.createWallet(e)})}createDeviceSigner(e,t){return r(this,null,function*(){return yield s(e,t)})}createPasskeySigner(e){return r(this,null,function*(){let t=yield p.createCredential({name:e});return{type:"passkey",id:t.id,name:e,publicKey:{x:t.publicKey.x.toString(),y:t.publicKey.y.toString()}}})}};export{C as a,o as b};
1
+ import{a as n}from"./chunk-DBFCNM4F.js";import{a as s}from"./chunk-5LNDUSMZ.js";import{a as l}from"./chunk-MVGSX46H.js";import{a,b as i}from"./chunk-2YLAHC7J.js";import{h as r}from"./chunk-NU7VF7MC.js";import{createCrossmint as C}from"@crossmint/common-sdk-base";import{WebAuthnP256 as p}from"ox";var o=class c{constructor(e){i(e.apiKey);let t=new l(e);this.walletFactory=new n(t),a.info("wallets.sdk.initialized")}static from(e){return new c(e)}getWallet(e,t){return r(this,null,function*(){if(typeof e=="string"){if(t==null)throw new Error("Args parameter is required when walletLocator is provided");return yield this.walletFactory.getWallet(e,t)}return yield this.walletFactory.getWallet(e)})}createWallet(e){return r(this,null,function*(){return yield this.walletFactory.createWallet(e)})}createDeviceSigner(e,t){return r(this,null,function*(){return yield s(e,t)})}createPasskeySigner(e){return r(this,null,function*(){let t=yield p.createCredential({name:e});return{type:"passkey",id:t.id,name:e,publicKey:{x:t.publicKey.x.toString(),y:t.publicKey.y.toString()}}})}};export{C as a,o as b};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkCZC2MNVKcjs = require('./chunk-CZC2MNVK.cjs');var a={type:"api-key",validateConfig(){},buildInternalConfig(e,i){return{type:"api-key",locator:"api-key",address:i.walletAddress}},canAutoAssemble(){return!0},addSignerPayload(e){return _chunkCZC2MNVKcjs.b.call(void 0, e)},matchesRecovery(e,i){return _chunkCZC2MNVKcjs.b.call(void 0, e)===_chunkCZC2MNVKcjs.b.call(void 0, i)},adoptsRecoveryConfigOnMatch:!0,signerUnavailableReason:()=>null};exports.a = a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkWSDMIQNGcjs = require('./chunk-WSDMIQNG.cjs');var a={type:"api-key",validateConfig(){},buildInternalConfig(e,i){return{type:"api-key",locator:"api-key",address:i.walletAddress}},canAutoAssemble(){return!0},addSignerPayload(e){return _chunkWSDMIQNGcjs.b.call(void 0, e)},matchesRecovery(e,i){return _chunkWSDMIQNGcjs.b.call(void 0, e)===_chunkWSDMIQNGcjs.b.call(void 0, i)},adoptsRecoveryConfigOnMatch:!0,signerUnavailableReason:()=>null};exports.a = a;
@@ -1 +1 @@
1
- import{c as g}from"./chunk-B4GYB3XY.js";import{j as d}from"./chunk-KOHPRJDP.js";import{a as i}from"./chunk-VOFCBB2P.js";var m={nativeToken:"eth",walletLocatorPrefix:"me:evm:smart",supportsSignatures:!0,addSignerChain(e){return e},extractAddSignerOperation(e,r,n){var t,a,o,s;if(!("chains"in e))throw i.error("wallet.addSigner.error",{error:"Expected chains in response for EVM chain"}),new Error("Expected chains in response for EVM chain");if(((a=(t=e.chains)==null?void 0:t[r])==null?void 0:a.status)==="failed")throw i.error("wallet.addSigner.failed",{chain:r,signerType:n.type,signerLocator:n.locator,chainStatus:(o=e.chains)==null?void 0:o[r]}),new d(`Signer registration failed for chain ${r} (signer: ${n.locator})`,JSON.stringify((s=e.chains)==null?void 0:s[r]));return g(e,r)},balanceTokenFields(e){return e!=null&&"contractAddress"in e?{contractAddress:e.contractAddress}:{}},emptyBalanceTokenFields(){return{contractAddress:void 0}},signApproval(e,r,n){return e.signTransaction(n)}};export{m as a};
1
+ import{c as g}from"./chunk-B4GYB3XY.js";import{j as d}from"./chunk-4I3EXM4B.js";import{a as i}from"./chunk-2YLAHC7J.js";var m={nativeToken:"eth",walletLocatorPrefix:"me:evm:smart",supportsSignatures:!0,addSignerChain(e){return e},extractAddSignerOperation(e,r,n){var t,a,o,s;if(!("chains"in e))throw i.error("wallet.addSigner.error",{error:"Expected chains in response for EVM chain"}),new Error("Expected chains in response for EVM chain");if(((a=(t=e.chains)==null?void 0:t[r])==null?void 0:a.status)==="failed")throw i.error("wallet.addSigner.failed",{chain:r,signerType:n.type,signerLocator:n.locator,chainStatus:(o=e.chains)==null?void 0:o[r]}),new d(`Signer registration failed for chain ${r} (signer: ${n.locator})`,JSON.stringify((s=e.chains)==null?void 0:s[r]));return g(e,r)},balanceTokenFields(e){return e!=null&&"contractAddress"in e?{contractAddress:e.contractAddress}:{}},emptyBalanceTokenFields(){return{contractAddress:void 0}},signApproval(e,r,n){return e.signTransaction(n)}};export{m as a};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkATIC4ENGcjs = require('./chunk-ATIC4ENG.cjs');var _chunkPHIW7FUJcjs = require('./chunk-PHIW7FUJ.cjs');var _chunkHCV4M7X2cjs = require('./chunk-HCV4M7X2.cjs');var _chunkT5EOJ3ZFcjs = require('./chunk-T5EOJ3ZF.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var w=class{constructor(i){this.config=i;this._needsAuth=!0;this._authPromise=null;this._initializationPromise=null;this._onboardingConnectionGeneration=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 _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){try{if(this.config.clientTEEConnection==null){let i=_commonsdkbase.validateAPIKey.call(void 0, this.config.crossmint.apiKey);if(!i.isValid)throw new Error("Invalid API key");let t=new (0, _chunkATIC4ENGcjs.a)({environment:i.environment});this.config.clientTEEConnection=yield t.initialize()}}finally{this._initializationPromise=null}})}getTEEConnection(){return _chunkDSIFRRBScjs.h.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 _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){_chunkT5EOJ3ZFcjs.a.info("TEE connection not initialized, initializing now");let i=_commonsdkbase.validateAPIKey.call(void 0, this.config.crossmint.apiKey);if(!i.isValid)throw new Error("Invalid API key");let t=new (0, _chunkATIC4ENGcjs.a)({environment:i.environment});if(this.config.clientTEEConnection=yield t.initialize(),this.config.clientTEEConnection==null)throw new Error("Failed to initialize TEE connection");_chunkT5EOJ3ZFcjs.a.info("TEE connection initialized successfully")})}handleAuthRequired(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let i=this.getAuthDataOrThrow(),t=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 */ }`);_chunkT5EOJ3ZFcjs.a.info("get-status: sending request");let h=Date.now(),r=yield t.sendAction({event:"request:get-status",responseEvent:"response:get-status",data:{authData:i,data:{authId:this.getAuthId()}},options:f}),a=Date.now()-h;if((r==null?void 0:r.status)!=="success"){let o=(r==null?void 0:r.status)==="error"&&r.error||"Failed to retrieve signer status",l=(r==null?void 0:r.status)==="error"?r.code:void 0;throw _chunkT5EOJ3ZFcjs.a.error("get-status: failed",{status:r==null?void 0:r.status,error:(r==null?void 0:r.status)==="error"?r.error:void 0,code:l,durationMs:a}),_(o,l)?new (0, _chunkHCV4M7X2cjs.c)(o,l):new (0, _chunkHCV4M7X2cjs.d)(o,l)}if(_chunkT5EOJ3ZFcjs.a.info("get-status: response received",{signerStatus:r.signerStatus,durationMs:a}),r.signerStatus==="ready"){this._needsAuth=!1;return}else this._needsAuth=!0;_chunkT5EOJ3ZFcjs.a.info("Auth required, initiating OTP flow",{needsAuth:this._needsAuth});let{promise:e,resolve:c,reject:d}=this.createAuthPromise();if(this._authPromise={promise:e,resolve:c,reject:d},this.config.onAuthRequired)try{yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),o=>this.verifyOtp(o),()=>_chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){_chunkT5EOJ3ZFcjs.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(),o=>this.verifyOtp(o),()=>{var o;return(o=this._authPromise)==null?void 0:o.reject(new _chunkHCV4M7X2cjs.a)})),d(new _chunkHCV4M7X2cjs.a)}))}catch(o){_chunkT5EOJ3ZFcjs.a.error("handleAuthRequired error",{error:o}),d(o)}try{yield e}catch(o){throw _chunkT5EOJ3ZFcjs.a.error("handleAuthRequired promise error",{error:o}),o}})}ensureAuthenticated(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){this.getJwtOrThrow(),this.config.resetSignerFrame!=null&&(yield this.config.resetSignerFrame()),yield this.handleAuthRequired()})}getJwtOrThrow(){let i=this.config.crossmint.jwt;if(i==null||i.trim()==="")throw new (0, _chunkHCV4M7X2cjs.c)(`${this.type} signer requires a valid Crossmint JWT. The user's session is missing or has expired: re-authenticate the user and refresh the JWT before retrying.`,S);return i}getAuthDataOrThrow(){return{jwt:this.getJwtOrThrow(),apiKey:this.config.crossmint.apiKey}}createAuthPromise(){let i,t;return{promise:new Promise((r,a)=>{i=r,t=a}),resolve:i,reject:t}}sendMessageWithOtp(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var i;try{yield this.startOnboarding()}catch(t){throw t instanceof _chunkHCV4M7X2cjs.c&&((i=this._authPromise)==null||i.reject(t)),t}})}startOnboarding(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let i=this.getAuthDataOrThrow(),t=yield this.getTEEConnection(),h=this.getAuthId();_chunkT5EOJ3ZFcjs.a.info("start-onboarding: sending request");let r=Date.now(),a=this.config.type==="phone"?this.config.channel:void 0,e=yield t.sendAction({event:"request:start-onboarding",responseEvent:"response:start-onboarding",data:{authData:i,data:_chunkDSIFRRBScjs.a.call(void 0, {authId:h},a!=null?{channel:a}:{})},options:f}),c=Date.now()-r;if(this._onboardingConnectionGeneration=t.connectionGeneration,_chunkT5EOJ3ZFcjs.a.info("start-onboarding: response received",{status:e==null?void 0:e.status,durationMs:c}),(e==null?void 0:e.status)==="success"&&e.signerStatus==="ready"){this._needsAuth=!1;return}if((e==null?void 0:e.status)==="error"){_chunkT5EOJ3ZFcjs.a.error("start-onboarding: failed",{error:e.error,code:e.code});let d=e.error||"Failed to initiate OTP process.";throw _(d,e.code)?new (0, _chunkHCV4M7X2cjs.c)(d,e.code):new (0, _chunkHCV4M7X2cjs.b)(d,e.code)}})}getAuthId(){return this.config.type==="email"?this.config.email!=null?`email:${_chunkPHIW7FUJcjs.a.call(void 0, this.config.email)}`:this.config.locator:this.config.phone!=null?`phone:${this.config.phone}`:this.config.locator}verifyOtp(i){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var a;let t;try{let e=yield this.getTEEConnection();_chunkT5EOJ3ZFcjs.a.info("complete-onboarding: sending request");let c=Date.now();t=yield e.sendAction({event:"request:complete-onboarding",responseEvent:"response:complete-onboarding",data:{authData:this.getAuthDataOrThrow(),data:{onboardingAuthentication:{encryptedOtp:i}}},options:f}),_chunkT5EOJ3ZFcjs.a.info("complete-onboarding: response received",{status:t==null?void 0:t.status,durationMs:Date.now()-c})}catch(e){return _chunkT5EOJ3ZFcjs.a.error("complete-onboarding: error",{error:e}),yield this.handleOnboardingVerificationFailure(e)}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(),e=>this.verifyOtp(e),()=>{var e;return(e=this._authPromise)==null?void 0:e.reject(new _chunkHCV4M7X2cjs.a)})),(a=this._authPromise)==null||a.resolve();return}_chunkT5EOJ3ZFcjs.a.error("complete-onboarding: OTP validation failed",{status:t==null?void 0:t.status,error:(t==null?void 0:t.status)==="error"?t.error:void 0,code:(t==null?void 0:t.status)==="error"?t.code:void 0});let h=(t==null?void 0:t.status)==="error"&&t.error||"Failed to validate encrypted OTP",r=(t==null?void 0:t.status)==="error"?t.code:void 0;return yield this.handleOnboardingVerificationFailure(new (0, _chunkHCV4M7X2cjs.b)(h,r))})}handleOnboardingVerificationFailure(i){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var r,a,e;this._needsAuth=!0;let t=this.config.clientTEEConnection;if(this._onboardingConnectionGeneration!=null&&t!=null&&t.connectionGeneration!==this._onboardingConnectionGeneration){_chunkT5EOJ3ZFcjs.a.warn("tee.signer.onboarding.reissued",{reason:"signer frame reloaded mid-onboarding, re-issuing OTP",onboardingGeneration:this._onboardingConnectionGeneration,currentGeneration:t==null?void 0:t.connectionGeneration});try{yield this.sendMessageWithOtp()}catch(c){throw(r=this._authPromise)==null||r.reject(c),c}if(!this._needsAuth){(a=this._authPromise)==null||a.resolve();return}throw new _chunkHCV4M7X2cjs.f}throw(e=this._authPromise)==null||e.reject(i),i})}_exportPrivateKey(i,t){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){yield this.ensureAuthenticated();let h=this.getJwtOrThrow(),{scheme:r,encoding:a}=this.getChainKeyParams();if(t!=null){let c=i.on("event:key-exported",d=>{i.off(c),d.status==="success"&&Promise.resolve().then(()=>t()).catch(()=>{console.error("[NCS Signer] onExport callback error")})})}let e=yield i.sendAction({event:"request:export-signer",responseEvent:"response:export-signer",data:{authData:{jwt:h,apiKey:this.config.crossmint.apiKey},data:{scheme:r,encoding:a,walletAddress:this.config.address,authId:this.getAuthId()}},options:f});if((e==null?void 0:e.status)==="error")throw _chunkT5EOJ3ZFcjs.a.error("export-signer: failed",{error:e.error,code:e.code}),new (0, _chunkHCV4M7X2cjs.e)(e.error||"Failed to export private key",e.code)})}};_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkT5EOJ3ZFcjs.a,methodName:"handleAuthRequired"})],w.prototype,"handleAuthRequired",1);var f={timeoutMs:3e4},S= exports.c ="jwt-required",q=new Set(["unauthorized","unauthenticated"]);function _(E,i){return i!=null&&q.has(i.toLowerCase())?!0:/\bHTTP 401\b/.test(E)}exports.a = w; exports.b = f; exports.c = S;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkATIC4ENGcjs = require('./chunk-ATIC4ENG.cjs');var _chunkHITDGEGWcjs = require('./chunk-HITDGEGW.cjs');var _chunkHCV4M7X2cjs = require('./chunk-HCV4M7X2.cjs');var _chunk36GZTRZXcjs = require('./chunk-36GZTRZX.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var w=class{constructor(i){this.config=i;this._needsAuth=!0;this._authPromise=null;this._initializationPromise=null;this._onboardingConnectionGeneration=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 _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){try{if(this.config.clientTEEConnection==null){let i=_commonsdkbase.validateAPIKey.call(void 0, this.config.crossmint.apiKey);if(!i.isValid)throw new Error("Invalid API key");let t=new (0, _chunkATIC4ENGcjs.a)({environment:i.environment});this.config.clientTEEConnection=yield t.initialize()}}finally{this._initializationPromise=null}})}getTEEConnection(){return _chunkDSIFRRBScjs.h.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 _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){_chunk36GZTRZXcjs.a.info("TEE connection not initialized, initializing now");let i=_commonsdkbase.validateAPIKey.call(void 0, this.config.crossmint.apiKey);if(!i.isValid)throw new Error("Invalid API key");let t=new (0, _chunkATIC4ENGcjs.a)({environment:i.environment});if(this.config.clientTEEConnection=yield t.initialize(),this.config.clientTEEConnection==null)throw new Error("Failed to initialize TEE connection");_chunk36GZTRZXcjs.a.info("TEE connection initialized successfully")})}handleAuthRequired(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let i=this.getAuthDataOrThrow(),t=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 */ }`);_chunk36GZTRZXcjs.a.info("get-status: sending request");let h=Date.now(),r=yield t.sendAction({event:"request:get-status",responseEvent:"response:get-status",data:{authData:i,data:{authId:this.getAuthId()}},options:f}),a=Date.now()-h;if((r==null?void 0:r.status)!=="success"){let o=(r==null?void 0:r.status)==="error"&&r.error||"Failed to retrieve signer status",l=(r==null?void 0:r.status)==="error"?r.code:void 0;throw _chunk36GZTRZXcjs.a.error("get-status: failed",{status:r==null?void 0:r.status,error:(r==null?void 0:r.status)==="error"?r.error:void 0,code:l,durationMs:a}),_(o,l)?new (0, _chunkHCV4M7X2cjs.c)(o,l):new (0, _chunkHCV4M7X2cjs.d)(o,l)}if(_chunk36GZTRZXcjs.a.info("get-status: response received",{signerStatus:r.signerStatus,durationMs:a}),r.signerStatus==="ready"){this._needsAuth=!1;return}else this._needsAuth=!0;_chunk36GZTRZXcjs.a.info("Auth required, initiating OTP flow",{needsAuth:this._needsAuth});let{promise:e,resolve:c,reject:d}=this.createAuthPromise();if(this._authPromise={promise:e,resolve:c,reject:d},this.config.onAuthRequired)try{yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),o=>this.verifyOtp(o),()=>_chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){_chunk36GZTRZXcjs.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(),o=>this.verifyOtp(o),()=>{var o;return(o=this._authPromise)==null?void 0:o.reject(new _chunkHCV4M7X2cjs.a)})),d(new _chunkHCV4M7X2cjs.a)}))}catch(o){_chunk36GZTRZXcjs.a.error("handleAuthRequired error",{error:o}),d(o)}try{yield e}catch(o){throw _chunk36GZTRZXcjs.a.error("handleAuthRequired promise error",{error:o}),o}})}ensureAuthenticated(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){this.getJwtOrThrow(),this.config.resetSignerFrame!=null&&(yield this.config.resetSignerFrame()),yield this.handleAuthRequired()})}getJwtOrThrow(){let i=this.config.crossmint.jwt;if(i==null||i.trim()==="")throw new (0, _chunkHCV4M7X2cjs.c)(`${this.type} signer requires a valid Crossmint JWT. The user's session is missing or has expired: re-authenticate the user and refresh the JWT before retrying.`,S);return i}getAuthDataOrThrow(){return{jwt:this.getJwtOrThrow(),apiKey:this.config.crossmint.apiKey}}createAuthPromise(){let i,t;return{promise:new Promise((r,a)=>{i=r,t=a}),resolve:i,reject:t}}sendMessageWithOtp(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var i;try{yield this.startOnboarding()}catch(t){throw t instanceof _chunkHCV4M7X2cjs.c&&((i=this._authPromise)==null||i.reject(t)),t}})}startOnboarding(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let i=this.getAuthDataOrThrow(),t=yield this.getTEEConnection(),h=this.getAuthId();_chunk36GZTRZXcjs.a.info("start-onboarding: sending request");let r=Date.now(),a=this.config.type==="phone"?this.config.channel:void 0,e=yield t.sendAction({event:"request:start-onboarding",responseEvent:"response:start-onboarding",data:{authData:i,data:_chunkDSIFRRBScjs.a.call(void 0, {authId:h},a!=null?{channel:a}:{})},options:f}),c=Date.now()-r;if(this._onboardingConnectionGeneration=t.connectionGeneration,_chunk36GZTRZXcjs.a.info("start-onboarding: response received",{status:e==null?void 0:e.status,durationMs:c}),(e==null?void 0:e.status)==="success"&&e.signerStatus==="ready"){this._needsAuth=!1;return}if((e==null?void 0:e.status)==="error"){_chunk36GZTRZXcjs.a.error("start-onboarding: failed",{error:e.error,code:e.code});let d=e.error||"Failed to initiate OTP process.";throw _(d,e.code)?new (0, _chunkHCV4M7X2cjs.c)(d,e.code):new (0, _chunkHCV4M7X2cjs.b)(d,e.code)}})}getAuthId(){return this.config.type==="email"?this.config.email!=null?`email:${_chunkHITDGEGWcjs.a.call(void 0, this.config.email)}`:this.config.locator:this.config.phone!=null?`phone:${this.config.phone}`:this.config.locator}verifyOtp(i){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var a;let t;try{let e=yield this.getTEEConnection();_chunk36GZTRZXcjs.a.info("complete-onboarding: sending request");let c=Date.now();t=yield e.sendAction({event:"request:complete-onboarding",responseEvent:"response:complete-onboarding",data:{authData:this.getAuthDataOrThrow(),data:{onboardingAuthentication:{encryptedOtp:i}}},options:f}),_chunk36GZTRZXcjs.a.info("complete-onboarding: response received",{status:t==null?void 0:t.status,durationMs:Date.now()-c})}catch(e){return _chunk36GZTRZXcjs.a.error("complete-onboarding: error",{error:e}),yield this.handleOnboardingVerificationFailure(e)}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(),e=>this.verifyOtp(e),()=>{var e;return(e=this._authPromise)==null?void 0:e.reject(new _chunkHCV4M7X2cjs.a)})),(a=this._authPromise)==null||a.resolve();return}_chunk36GZTRZXcjs.a.error("complete-onboarding: OTP validation failed",{status:t==null?void 0:t.status,error:(t==null?void 0:t.status)==="error"?t.error:void 0,code:(t==null?void 0:t.status)==="error"?t.code:void 0});let h=(t==null?void 0:t.status)==="error"&&t.error||"Failed to validate encrypted OTP",r=(t==null?void 0:t.status)==="error"?t.code:void 0;return yield this.handleOnboardingVerificationFailure(new (0, _chunkHCV4M7X2cjs.b)(h,r))})}handleOnboardingVerificationFailure(i){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var r,a,e;this._needsAuth=!0;let t=this.config.clientTEEConnection;if(this._onboardingConnectionGeneration!=null&&t!=null&&t.connectionGeneration!==this._onboardingConnectionGeneration){_chunk36GZTRZXcjs.a.warn("tee.signer.onboarding.reissued",{reason:"signer frame reloaded mid-onboarding, re-issuing OTP",onboardingGeneration:this._onboardingConnectionGeneration,currentGeneration:t==null?void 0:t.connectionGeneration});try{yield this.sendMessageWithOtp()}catch(c){throw(r=this._authPromise)==null||r.reject(c),c}if(!this._needsAuth){(a=this._authPromise)==null||a.resolve();return}throw new _chunkHCV4M7X2cjs.f}throw(e=this._authPromise)==null||e.reject(i),i})}_exportPrivateKey(i,t){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){yield this.ensureAuthenticated();let h=this.getJwtOrThrow(),{scheme:r,encoding:a}=this.getChainKeyParams();if(t!=null){let c=i.on("event:key-exported",d=>{i.off(c),d.status==="success"&&Promise.resolve().then(()=>t()).catch(()=>{console.error("[NCS Signer] onExport callback error")})})}let e=yield i.sendAction({event:"request:export-signer",responseEvent:"response:export-signer",data:{authData:{jwt:h,apiKey:this.config.crossmint.apiKey},data:{scheme:r,encoding:a,walletAddress:this.config.address,authId:this.getAuthId()}},options:f});if((e==null?void 0:e.status)==="error")throw _chunk36GZTRZXcjs.a.error("export-signer: failed",{error:e.error,code:e.code}),new (0, _chunkHCV4M7X2cjs.e)(e.error||"Failed to export private key",e.code)})}};_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunk36GZTRZXcjs.a,methodName:"handleAuthRequired"})],w.prototype,"handleAuthRequired",1);var f={timeoutMs:3e4},S= exports.c ="jwt-required",q=new Set(["unauthorized","unauthenticated"]);function _(E,i){return i!=null&&q.has(i.toLowerCase())?!0:/\bHTTP 401\b/.test(E)}exports.a = w; exports.b = f; exports.c = S;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkPHIW7FUJcjs = require('./chunk-PHIW7FUJ.cjs');var i="passkey:";function n(e){if(e.id!=null&&e.id!=="")return e.id;if(e.locator!=null&&e.locator.startsWith(i)){let t=e.locator.slice(i.length);return t===""?null:t}return null}function l(e){if(e.type==="external-wallet")return`external-wallet:${e.address}`;if(e.type==="email"&&e.email)return`email:${_chunkPHIW7FUJcjs.a.call(void 0, e.email)}`;if(e.type==="phone"&&e.phone)return`phone:${e.phone}`;if(e.type==="passkey"){let t=n(e);if(t!=null)return`passkey:${t}`;if("id"in e)return`passkey:${e.id}`}return e.type==="api-key"?"api-key":e.type==="device"?"locator"in e&&e.locator!=null?e.locator:"device:":e.type}function p(e){let t=e.indexOf(":");return t===-1?{type:e,value:""}:{type:e.substring(0,t),value:e.substring(t+1)}}exports.a = n; exports.b = l; exports.c = p;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkHITDGEGWcjs = require('./chunk-HITDGEGW.cjs');var i="passkey:";function n(e){if(e.id!=null&&e.id!=="")return e.id;if(e.locator!=null&&e.locator.startsWith(i)){let t=e.locator.slice(i.length);return t===""?null:t}return null}function l(e){if(e.type==="external-wallet")return`external-wallet:${e.address}`;if(e.type==="email"&&e.email)return`email:${_chunkHITDGEGWcjs.a.call(void 0, e.email)}`;if(e.type==="phone"&&e.phone)return`phone:${e.phone}`;if(e.type==="passkey"){let t=n(e);if(t!=null)return`passkey:${t}`;if("id"in e)return`passkey:${e.id}`}return e.type==="api-key"?"api-key":e.type==="device"?"locator"in e&&e.locator!=null?e.locator:"device:":e.type}function p(e){let t=e.indexOf(":");return t===-1?{type:e,value:""}:{type:e.substring(0,t),value:e.substring(t+1)}}exports.a = n; exports.b = l; exports.c = p;
@@ -1 +1 @@
1
- import{a as N}from"./chunk-5LNDUSMZ.js";import{a as R}from"./chunk-BZYYVTXK.js";import{a as M,b as j}from"./chunk-T4RCLJ5G.js";import{a as O,b as E,c as F,g as T}from"./chunk-P3P5Q5XX.js";import{m as W}from"./chunk-KOHPRJDP.js";import{a}from"./chunk-VOFCBB2P.js";import{d as e,e as d,f as s,g as w,h as f}from"./chunk-NU7VF7MC.js";var l,m,C,S,y,o,b,A,k,L,K,P,u,q,I,B,$,z,V=class{constructor(r){d(this,u);d(this,l,"unknown");d(this,m,!1);d(this,C);d(this,S);d(this,y);d(this,o);d(this,b);d(this,A);d(this,k);d(this,L);d(this,K);d(this,P);s(this,C,r.chain),s(this,S,r.walletAddress),s(this,y,r.options),s(this,o,r.signerManager),s(this,b,r.serverSignerResolver),s(this,A,r.signers),s(this,k,r.addSigner),s(this,L,r.removeSigner),s(this,K,r.approveSignature),s(this,P,r.approveTransaction)}get needsRecovery(){return e(this,l)==="needs-recovery"}onSignerSelected(){e(this,l)==="needs-recovery"&&s(this,l,"unknown")}initDeviceSigner(){return f(this,null,function*(){var g;if(((g=e(this,y))==null?void 0:g.deviceSignerKeyStorage)==null||e(this,m))return;let i={type:"device"};try{yield this.resolveAvailability(i)}catch(h){a.error("wallet.initDeviceSigner.error",{error:h}),s(this,l,"needs-recovery");return}if(e(this,l)==="needs-recovery")return;let c=R(i.type).buildInternalConfig(i,e(this,o).descriptorContext()),t=yield e(this,o).assemble(c);e(this,o).setActiveSigner(t),e(this,o).isApprovedSignerStatus(t.status)||(a.info("wallet.initDeviceSigner.pendingApproval",{signerLocator:t.locator(),status:t.status}),s(this,l,"needs-recovery"))})}recover(){return f(this,null,function*(){var D;if(a.info("wallet.recover.start"),e(this,l)==="resolved"){a.info("wallet.recover.skipped",{reason:"Device signer already approved (cached)"});return}if(e(this,m)){a.info("wallet.recover.skipped",{reason:"device signer not supported (cached)"}),s(this,l,"resolved");return}let r=e(this,o).activeSigner;if((r==null?void 0:r.type)==="device"&&(yield w(this,u,I).call(this,r))){s(this,l,"resolved");return}if(r!=null&&r.type!=="device"){a.warn("wallet.recover.skipped",{reason:"Recovery is only supported for device signers"}),s(this,l,"unknown");return}let i=(D=e(this,y))==null?void 0:D.deviceSignerKeyStorage;if(i==null){if(e(this,l)!=="needs-recovery")return;throw new Error("Device signer key storage is required to recover a device signer")}let c=yield e(this,A).call(this),t=yield w(this,u,$).call(this,i,c);if(t!=null&&(yield w(this,u,I).call(this,t))){e(this,o).setActiveSigner(t),s(this,l,"resolved");let n=t.locator().replace("device:","");try{yield i.mapAddressToKey(e(this,S),n)}catch(G){a.warn("wallet.recover.mapAddressToKey.error",{error:G})}return}let g=c.filter(n=>n.type==="device"),h=w(this,u,q).call(this,g,i),v=yield N(i,e(this,S));try{yield e(this,k).call(this,v)}catch(n){if(n instanceof W){a.info("wallet.recover.device.unsupportedFallback",{signerLocator:v.locator}),yield i.deleteKey(e(this,S)),s(this,m,!0),s(this,l,"resolved"),yield w(this,u,z).call(this);return}else if(H(n))a.info("wallet.recover.skipped",{reason:"Device signer already approved",signerLocator:v.locator});else throw n instanceof O||n instanceof Error&&n.name==="AuthRejectedError"?(a.info("wallet.recover.device.authRejected",{signerLocator:v.locator}),n):n instanceof F||n instanceof Error&&n.name==="SignerAuthenticationError"?(a.warn("wallet.recover.device.authenticationFailed",{signerLocator:v.locator,code:n instanceof F?n.code:void 0}),n):n instanceof E||n instanceof Error&&n.name==="OtpValidationError"?(a.warn("wallet.recover.device.otpValidationFailed",{signerLocator:v.locator,code:n instanceof E?n.code:void 0}),n):(a.error("wallet.recover.device.error",{error:n}),yield i.deleteKey(e(this,S)),n)}let p=yield e(this,o).assemble({type:"device",locator:v.locator,address:e(this,S)});if(e(this,o).setActiveSigner(p),p.type==="device"&&(p.status="success"),a.info("wallet.recover.device.success",{signerLocator:v.locator}),s(this,l,"resolved"),h!=null)try{yield e(this,L).call(this,h),a.info("wallet.recover.staleSignerRemoved",{signerLocator:h})}catch(n){a.warn("wallet.recover.staleSignerRemovalFailed",{signerLocator:h,error:n})}})}resolveAvailability(r){return f(this,null,function*(){var h;let i=(h=e(this,y))==null?void 0:h.deviceSignerKeyStorage;if(i==null)throw new Error("Device signer key storage is required for device signers");let c=yield i.getKey(e(this,S));if(c!=null){r.locator=`device:${c}`,s(this,l,"unknown");return}let g=(yield e(this,A).call(this)).filter(v=>v.locator.startsWith("device:"));for(let v of g){let p=v.locator.replace("device:","");if(yield i.hasKey(p)){yield i.mapAddressToKey(e(this,S),p),r.locator=v.locator,s(this,l,"unknown");return}}s(this,l,"needs-recovery")})}tryResolveLocallyAvailableSigner(t){return f(this,arguments,function*(r,i=(c=>(c=e(this,y))==null?void 0:c.deviceSignerKeyStorage)()){if(i==null)return null;try{return yield j(e(this,C),r,e(this,S),i)}catch(g){return a.warn("wallet.deviceRecovery.tryResolveLocallyAvailableSigner.failed",{signerLocator:r,error:g}),null}})}};l=new WeakMap,m=new WeakMap,C=new WeakMap,S=new WeakMap,y=new WeakMap,o=new WeakMap,b=new WeakMap,A=new WeakMap,k=new WeakMap,L=new WeakMap,K=new WeakMap,P=new WeakMap,u=new WeakSet,q=function(r,i){if(r.length===0)return;if(r.length===1)return r[0].locator;let c=i.getDeviceName(),t=r.filter(g=>g.name===c);return t.length===1?t[0].locator:void 0},I=function(r){return f(this,null,function*(){var c;if(e(this,o).isApprovedSignerStatus(r.status))return a.info("wallet.recover.skipped",{reason:"Device signer already approved"}),!0;let i=yield e(this,o).getSignerState(r.locator());return r.status=(c=i.signer)==null?void 0:c.status,i.pendingOperation!=null?(yield w(this,u,B).call(this,r,i.pendingOperation),!0):e(this,o).isApprovedSignerStatus(r.status)?(a.info("wallet.recover.skipped",{reason:"Device signer already approved"}),!0):!1})},B=function(r,i){return f(this,null,function*(){var p;let c=e(this,o).activeSigner,t=e(this,o).recovery;if(T(t)&&!e(this,b).hasRecoveryResolutionFor(t.address))throw new Error('Cannot resume pending approval: no secret available. Call wallet.useSigner({ type: "server", secret: ... }) first with the recovery server secret.');let g=R(t.type),h=e(this,o).descriptorContext();if(t.type==="external-wallet"&&!g.canAutoAssemble(t,h))throw new Error('Cannot resume pending approval: no onSign callback available. Call wallet.useSigner({ type: "external-wallet", address: "0x...", onSign: async (tx) => ... }) first.');let v=g.buildInternalConfig(t,h);e(this,o).setActiveSigner(M(e(this,C),v,(p=e(this,y))==null?void 0:p.deviceSignerKeyStorage));try{i.type==="signature"?yield e(this,K).call(this,i.id):yield e(this,P).call(this,i.id)}catch(D){throw e(this,o).setActiveSigner(r),D}finally{e(this,o).activeSigner!==r&&e(this,o).setActiveSigner(c)}r.status="success",a.info("wallet.recover.device.success",{signerLocator:r.locator(),resumed:!0})})},$=function(r,i){return f(this,null,function*(){let c=i.filter(t=>t.locator.startsWith("device:"));for(let t of c){let g=yield this.tryResolveLocallyAvailableSigner(t.locator,r);if(g!=null)return a.info("wallet.recover.foundLocalDeviceSigner",{signerLocator:t.locator}),g}return null})},z=function(){return f(this,null,function*(){let r=e(this,o).recovery,i=R(r.type),c=e(this,o).descriptorContext();if(i.canAutoAssemble(r,c))try{let t=i.buildInternalConfig(r,c);e(this,o).setActiveSigner(yield e(this,o).assemble(t,{isAdminSigner:!0}))}catch(t){a.warn("wallet.recover.device.unsupportedFallback.autoAssemblyFailed",{recoveryType:r.type,error:t})}})};function H(x){if(!(x instanceof Error))return!1;let r=x.message.toLowerCase();return r.includes("delegated signer")&&r.includes("already")&&r.includes("approved")}export{V as a};
1
+ import{a as N}from"./chunk-5LNDUSMZ.js";import{a as R}from"./chunk-LEPWAFFZ.js";import{a as M,b as j}from"./chunk-UFYLMDRQ.js";import{a as O,b as E,c as F,g as T}from"./chunk-P3P5Q5XX.js";import{m as W}from"./chunk-4I3EXM4B.js";import{a}from"./chunk-2YLAHC7J.js";import{d as e,e as d,f as s,g as w,h as f}from"./chunk-NU7VF7MC.js";var l,m,C,S,y,o,b,A,k,L,K,P,u,q,I,B,$,z,V=class{constructor(r){d(this,u);d(this,l,"unknown");d(this,m,!1);d(this,C);d(this,S);d(this,y);d(this,o);d(this,b);d(this,A);d(this,k);d(this,L);d(this,K);d(this,P);s(this,C,r.chain),s(this,S,r.walletAddress),s(this,y,r.options),s(this,o,r.signerManager),s(this,b,r.serverSignerResolver),s(this,A,r.signers),s(this,k,r.addSigner),s(this,L,r.removeSigner),s(this,K,r.approveSignature),s(this,P,r.approveTransaction)}get needsRecovery(){return e(this,l)==="needs-recovery"}onSignerSelected(){e(this,l)==="needs-recovery"&&s(this,l,"unknown")}initDeviceSigner(){return f(this,null,function*(){var g;if(((g=e(this,y))==null?void 0:g.deviceSignerKeyStorage)==null||e(this,m))return;let i={type:"device"};try{yield this.resolveAvailability(i)}catch(h){a.error("wallet.initDeviceSigner.error",{error:h}),s(this,l,"needs-recovery");return}if(e(this,l)==="needs-recovery")return;let c=R(i.type).buildInternalConfig(i,e(this,o).descriptorContext()),t=yield e(this,o).assemble(c);e(this,o).setActiveSigner(t),e(this,o).isApprovedSignerStatus(t.status)||(a.info("wallet.initDeviceSigner.pendingApproval",{signerLocator:t.locator(),status:t.status}),s(this,l,"needs-recovery"))})}recover(){return f(this,null,function*(){var D;if(a.info("wallet.recover.start"),e(this,l)==="resolved"){a.info("wallet.recover.skipped",{reason:"Device signer already approved (cached)"});return}if(e(this,m)){a.info("wallet.recover.skipped",{reason:"device signer not supported (cached)"}),s(this,l,"resolved");return}let r=e(this,o).activeSigner;if((r==null?void 0:r.type)==="device"&&(yield w(this,u,I).call(this,r))){s(this,l,"resolved");return}if(r!=null&&r.type!=="device"){a.warn("wallet.recover.skipped",{reason:"Recovery is only supported for device signers"}),s(this,l,"unknown");return}let i=(D=e(this,y))==null?void 0:D.deviceSignerKeyStorage;if(i==null){if(e(this,l)!=="needs-recovery")return;throw new Error("Device signer key storage is required to recover a device signer")}let c=yield e(this,A).call(this),t=yield w(this,u,$).call(this,i,c);if(t!=null&&(yield w(this,u,I).call(this,t))){e(this,o).setActiveSigner(t),s(this,l,"resolved");let n=t.locator().replace("device:","");try{yield i.mapAddressToKey(e(this,S),n)}catch(G){a.warn("wallet.recover.mapAddressToKey.error",{error:G})}return}let g=c.filter(n=>n.type==="device"),h=w(this,u,q).call(this,g,i),v=yield N(i,e(this,S));try{yield e(this,k).call(this,v)}catch(n){if(n instanceof W){a.info("wallet.recover.device.unsupportedFallback",{signerLocator:v.locator}),yield i.deleteKey(e(this,S)),s(this,m,!0),s(this,l,"resolved"),yield w(this,u,z).call(this);return}else if(H(n))a.info("wallet.recover.skipped",{reason:"Device signer already approved",signerLocator:v.locator});else throw n instanceof O||n instanceof Error&&n.name==="AuthRejectedError"?(a.info("wallet.recover.device.authRejected",{signerLocator:v.locator}),n):n instanceof F||n instanceof Error&&n.name==="SignerAuthenticationError"?(a.warn("wallet.recover.device.authenticationFailed",{signerLocator:v.locator,code:n instanceof F?n.code:void 0}),n):n instanceof E||n instanceof Error&&n.name==="OtpValidationError"?(a.warn("wallet.recover.device.otpValidationFailed",{signerLocator:v.locator,code:n instanceof E?n.code:void 0}),n):(a.error("wallet.recover.device.error",{error:n}),yield i.deleteKey(e(this,S)),n)}let p=yield e(this,o).assemble({type:"device",locator:v.locator,address:e(this,S)});if(e(this,o).setActiveSigner(p),p.type==="device"&&(p.status="success"),a.info("wallet.recover.device.success",{signerLocator:v.locator}),s(this,l,"resolved"),h!=null)try{yield e(this,L).call(this,h),a.info("wallet.recover.staleSignerRemoved",{signerLocator:h})}catch(n){a.warn("wallet.recover.staleSignerRemovalFailed",{signerLocator:h,error:n})}})}resolveAvailability(r){return f(this,null,function*(){var h;let i=(h=e(this,y))==null?void 0:h.deviceSignerKeyStorage;if(i==null)throw new Error("Device signer key storage is required for device signers");let c=yield i.getKey(e(this,S));if(c!=null){r.locator=`device:${c}`,s(this,l,"unknown");return}let g=(yield e(this,A).call(this)).filter(v=>v.locator.startsWith("device:"));for(let v of g){let p=v.locator.replace("device:","");if(yield i.hasKey(p)){yield i.mapAddressToKey(e(this,S),p),r.locator=v.locator,s(this,l,"unknown");return}}s(this,l,"needs-recovery")})}tryResolveLocallyAvailableSigner(t){return f(this,arguments,function*(r,i=(c=>(c=e(this,y))==null?void 0:c.deviceSignerKeyStorage)()){if(i==null)return null;try{return yield j(e(this,C),r,e(this,S),i)}catch(g){return a.warn("wallet.deviceRecovery.tryResolveLocallyAvailableSigner.failed",{signerLocator:r,error:g}),null}})}};l=new WeakMap,m=new WeakMap,C=new WeakMap,S=new WeakMap,y=new WeakMap,o=new WeakMap,b=new WeakMap,A=new WeakMap,k=new WeakMap,L=new WeakMap,K=new WeakMap,P=new WeakMap,u=new WeakSet,q=function(r,i){if(r.length===0)return;if(r.length===1)return r[0].locator;let c=i.getDeviceName(),t=r.filter(g=>g.name===c);return t.length===1?t[0].locator:void 0},I=function(r){return f(this,null,function*(){var c;if(e(this,o).isApprovedSignerStatus(r.status))return a.info("wallet.recover.skipped",{reason:"Device signer already approved"}),!0;let i=yield e(this,o).getSignerState(r.locator());return r.status=(c=i.signer)==null?void 0:c.status,i.pendingOperation!=null?(yield w(this,u,B).call(this,r,i.pendingOperation),!0):e(this,o).isApprovedSignerStatus(r.status)?(a.info("wallet.recover.skipped",{reason:"Device signer already approved"}),!0):!1})},B=function(r,i){return f(this,null,function*(){var p;let c=e(this,o).activeSigner,t=e(this,o).recovery;if(T(t)&&!e(this,b).hasRecoveryResolutionFor(t.address))throw new Error('Cannot resume pending approval: no secret available. Call wallet.useSigner({ type: "server", secret: ... }) first with the recovery server secret.');let g=R(t.type),h=e(this,o).descriptorContext();if(t.type==="external-wallet"&&!g.canAutoAssemble(t,h))throw new Error('Cannot resume pending approval: no onSign callback available. Call wallet.useSigner({ type: "external-wallet", address: "0x...", onSign: async (tx) => ... }) first.');let v=g.buildInternalConfig(t,h);e(this,o).setActiveSigner(M(e(this,C),v,(p=e(this,y))==null?void 0:p.deviceSignerKeyStorage));try{i.type==="signature"?yield e(this,K).call(this,i.id):yield e(this,P).call(this,i.id)}catch(D){throw e(this,o).setActiveSigner(r),D}finally{e(this,o).activeSigner!==r&&e(this,o).setActiveSigner(c)}r.status="success",a.info("wallet.recover.device.success",{signerLocator:r.locator(),resumed:!0})})},$=function(r,i){return f(this,null,function*(){let c=i.filter(t=>t.locator.startsWith("device:"));for(let t of c){let g=yield this.tryResolveLocallyAvailableSigner(t.locator,r);if(g!=null)return a.info("wallet.recover.foundLocalDeviceSigner",{signerLocator:t.locator}),g}return null})},z=function(){return f(this,null,function*(){let r=e(this,o).recovery,i=R(r.type),c=e(this,o).descriptorContext();if(i.canAutoAssemble(r,c))try{let t=i.buildInternalConfig(r,c);e(this,o).setActiveSigner(yield e(this,o).assemble(t,{isAdminSigner:!0}))}catch(t){a.warn("wallet.recover.device.unsupportedFallback.autoAssemblyFailed",{recoveryType:r.type,error:t})}})};function H(x){if(!(x instanceof Error))return!1;let r=x.message.toLowerCase();return r.includes("delegated signer")&&r.includes("already")&&r.includes("approved")}export{V as a};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkGBTTVLK5cjs = require('./chunk-GBTTVLK5.cjs');var _chunk6XLTNU2Ncjs = require('./chunk-6XLTNU2N.cjs');var _chunkY5JB3XEXcjs = require('./chunk-Y5JB3XEX.cjs');var _chunkMT2D5VRFcjs = require('./chunk-MT2D5VRF.cjs');var _chunkWY5KEIIJcjs = require('./chunk-WY5KEIIJ.cjs');var _chunkO2ET3L2Rcjs = require('./chunk-O2ET3L2R.cjs');var _chunkWSDMIQNGcjs = require('./chunk-WSDMIQNG.cjs');var _chunkBJJXTZJBcjs = require('./chunk-BJJXTZJB.cjs');var _chunkWSCABGVOcjs = require('./chunk-WSCABGVO.cjs');var _chunkHCV4M7X2cjs = require('./chunk-HCV4M7X2.cjs');var _chunkNM33FBA3cjs = require('./chunk-NM33FBA3.cjs');var _chunkJNKTRQPScjs = require('./chunk-JNKTRQPS.cjs');var _chunkKQDPQXLLcjs = require('./chunk-KQDPQXLL.cjs');var _chunkD2S37DJ5cjs = require('./chunk-D2S37DJ5.cjs');var _chunk36GZTRZXcjs = require('./chunk-36GZTRZX.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var O,d,F,T,o,S,W,M,L,b,fe,we,j,H,w= exports.a =class{constructor(e,r){_chunkDSIFRRBScjs.e.call(void 0, this,b);_chunkDSIFRRBScjs.e.call(void 0, this,O);_chunkDSIFRRBScjs.e.call(void 0, this,d);_chunkDSIFRRBScjs.e.call(void 0, this,F);_chunkDSIFRRBScjs.e.call(void 0, this,T);_chunkDSIFRRBScjs.e.call(void 0, this,o);_chunkDSIFRRBScjs.e.call(void 0, this,S);_chunkDSIFRRBScjs.e.call(void 0, this,W,[]);_chunkDSIFRRBScjs.e.call(void 0, this,M);_chunkDSIFRRBScjs.e.call(void 0, this,L,null);let{chain:t,address:n,owner:a,options:c,alias:g,recovery:v,apiRecoveryServerSignerAddresses:y,apiDelegatedServerSignerAddresses:h,signers:C,signer:f}=e;_chunkDSIFRRBScjs.f.call(void 0, this,d,r),this.chain=t,this.address=n,this.owner=a,_chunkDSIFRRBScjs.f.call(void 0, this,O,c),this.alias=g;let m=Array.isArray(v)?v:[v],U=y!=null?y:m.filter(p=>p.type==="server"&&_chunkHCV4M7X2cjs.g.call(void 0, p)).map(p=>p.address);_chunkDSIFRRBScjs.f.call(void 0, this,W,h!=null?h:[]),_chunkDSIFRRBScjs.f.call(void 0, this,F,C!=null?C:[]),_chunkDSIFRRBScjs.f.call(void 0, this,T,new (0, _chunkWY5KEIIJcjs.a)({chain:t,projectId:_chunkDSIFRRBScjs.d.call(void 0, this,d).projectId,environment:_chunkDSIFRRBScjs.d.call(void 0, this,d).environment,apiRecoveryAddresses:U,apiDelegatedAddresses:_chunkDSIFRRBScjs.d.call(void 0, this,W),knownOnChainAddresses:()=>[..._chunkDSIFRRBScjs.d.call(void 0, this,F).filter(p=>p.type==="server"&&_chunkHCV4M7X2cjs.g.call(void 0, p)).map(p=>p.address),..._chunkDSIFRRBScjs.d.call(void 0, this,W)]})),_chunkDSIFRRBScjs.f.call(void 0, this,o,new (0, _chunkGBTTVLK5cjs.a)({apiClient:r,options:c,chain:t,walletAddress:this.address,walletLocator:()=>this.walletLocator,serverSignerResolver:_chunkDSIFRRBScjs.d.call(void 0, this,T),recoverySigners:m,initialSigners:_chunkDSIFRRBScjs.d.call(void 0, this,F),signers:()=>this.signers(),signer:f})),m.forEach((p,Ce)=>{p.type==="server"&&!_chunkHCV4M7X2cjs.g.call(void 0, p)&&_chunkDSIFRRBScjs.d.call(void 0, this,o).stripSecretFromRecovery(Ce,_chunkDSIFRRBScjs.d.call(void 0, this,T).resolveRecovery(p))}),_chunkDSIFRRBScjs.f.call(void 0, this,S,new (0, _chunkY5JB3XEXcjs.a)({chain:t,walletAddress:this.address,options:c,signerManager:_chunkDSIFRRBScjs.d.call(void 0, this,o),serverSignerResolver:_chunkDSIFRRBScjs.d.call(void 0, this,T),signers:()=>this.signers(),addSigner:p=>this.addSigner(p),removeSigner:p=>this.removeSigner({type:"device",locator:p}),approveSignature:p=>this.approveSignatureAndWait(p),approveTransaction:p=>this.approveTransactionAndWait(p)})),_chunkDSIFRRBScjs.f.call(void 0, this,M,this.initDefaultSigner())}get signer(){return _chunkDSIFRRBScjs.d.call(void 0, this,o).activeSigner}waitForInit(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){yield _chunkDSIFRRBScjs.d.call(void 0, this,M)})}initDefaultSigner(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){if(_chunkDSIFRRBScjs.d.call(void 0, this,o).activeSigner!=null||(yield _chunkDSIFRRBScjs.d.call(void 0, this,S).initDeviceSigner(),_chunkDSIFRRBScjs.d.call(void 0, this,o).activeSigner!=null||_chunkDSIFRRBScjs.d.call(void 0, this,S).needsRecovery))return;let e=_chunkDSIFRRBScjs.d.call(void 0, this,F).length===0?_chunkDSIFRRBScjs.d.call(void 0, this,o).recovery:_chunkDSIFRRBScjs.d.call(void 0, this,F).length===1?_chunkDSIFRRBScjs.d.call(void 0, this,F)[0]:null;if(e==null)return;let r=_chunkO2ET3L2Rcjs.a.call(void 0, e.type),t=_chunkDSIFRRBScjs.d.call(void 0, this,o).descriptorContext();if(!r.canAutoAssemble(e,t))return;let n=e===_chunkDSIFRRBScjs.d.call(void 0, this,o).recovery;try{let a=r.buildInternalConfig(e,t);_chunkDSIFRRBScjs.d.call(void 0, this,o).setActiveSigner(yield _chunkDSIFRRBScjs.d.call(void 0, this,o).assemble(a,{isAdminSigner:n}))}catch(a){_chunk36GZTRZXcjs.a.warn("wallet.initDefaultSigner.autoAssemblyFailed",{recoveryType:_chunkDSIFRRBScjs.d.call(void 0, this,o).recovery.type,signerCount:_chunkDSIFRRBScjs.d.call(void 0, this,F).length,error:a})}})}static getApiClient(e){return e.apiClient}static getOptions(e){return e.options}static getRecoverySigners(e){return e.recoveryMethods}static getInitialSigners(e){return _chunkDSIFRRBScjs.d.call(void 0, e,F)}static getApiRecoveryServerSignerAddresses(e){return _chunkDSIFRRBScjs.d.call(void 0, e,T).apiRecoveryAddresses}static getApiDelegatedServerSignerAddresses(e){return _chunkDSIFRRBScjs.d.call(void 0, e,W)}get apiClient(){return _chunkDSIFRRBScjs.d.call(void 0, this,d)}get options(){return _chunkDSIFRRBScjs.d.call(void 0, this,O)}get chainAdapter(){return _chunkNM33FBA3cjs.a.call(void 0, this.chain)}resolveServerSignerApiLocator(e){return _chunkDSIFRRBScjs.d.call(void 0, this,T).apiLocator(e)}get recovery(){return _chunkDSIFRRBScjs.d.call(void 0, this,o).recovery}get recoveryMethods(){return _chunkDSIFRRBScjs.d.call(void 0, this,o).recoverySigners}balances(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){_chunk36GZTRZXcjs.a.info("wallet.balances.start");let r=this.resolveChainForEnvironment(),t=this.chainAdapter.nativeToken,n=[t,"usdc",...e!=null?e:[]],a=yield _chunkDSIFRRBScjs.d.call(void 0, this,d).getBalance(this.address,{chains:[r],tokens:n});if("error"in a)throw _chunk36GZTRZXcjs.a.error("wallet.balances.error",{error:a}),new Error(`Failed to get balances for wallet: ${JSON.stringify(a.message)}`);return _chunk36GZTRZXcjs.a.info("wallet.balances.success"),_chunk6XLTNU2Ncjs.a.call(void 0, a,this.chain,t,e)})}stagingFund(e,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){_chunk36GZTRZXcjs.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 _chunk36GZTRZXcjs.a.error("wallet.stagingFund.error",{error:t}),new Error(`Failed to fund wallet: ${JSON.stringify(t.message)}`);return _chunk36GZTRZXcjs.a.info("wallet.stagingFund.success"),t})}nfts(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let r=this.resolveChainForEnvironment(),t=yield _chunkDSIFRRBScjs.d.call(void 0, this,d).getNfts(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {},e),{chain:r,address:this.address}));if(t!=null&&typeof t=="object"&&"error"in t)throw _chunk36GZTRZXcjs.a.error("wallet.nfts.error",{error:t}),new Error(`Failed to get nfts: ${JSON.stringify(t.message)}`);return t})}transactions(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let e=yield _chunkDSIFRRBScjs.d.call(void 0, this,d).getTransactions(this.walletLocator);if("error"in e)throw new Error(`Failed to get transactions: ${JSON.stringify(e.message)}`);return e})}transaction(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let r=yield _chunkDSIFRRBScjs.d.call(void 0, this,d).getTransaction(this.walletLocator,e);if("error"in r)throw new Error(`Failed to get transaction: ${JSON.stringify(r.message)}`);return r})}transfers(e){return _chunkDSIFRRBScjs.h.call(void 0, 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,n){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let a=Number(t);if(Number.isNaN(a)||!Number.isFinite(a)||a<=0)throw new (0, _chunkD2S37DJ5cjs.H)(`Invalid transfer amount: "${t}". Amount must be a positive number greater than zero.`);let c=_chunkBJJXTZJBcjs.a.call(void 0, e),g=this.resolveChainForEnvironment(),v=_chunkBJJXTZJBcjs.b.call(void 0, r,g);_chunk36GZTRZXcjs.a.info("wallet.send.start",_chunkDSIFRRBScjs.a.call(void 0, {recipient:c,token:v,amount:t},(n==null?void 0:n.transactionType)!=null?{transactionType:n.transactionType}:{})),yield this.preAuthIfNeeded();let y=_chunkDSIFRRBScjs.d.call(void 0, this,o).require(),h;(n==null?void 0:n.signer)==null?h=y.locator():typeof n.signer=="string"?h=n.signer:h=this.resolveServerSignerApiLocator(n.signer);let C=_chunkDSIFRRBScjs.a.call(void 0, {recipient:c,amount:t,signer:h},(n==null?void 0:n.transactionType)!=null?{transactionType:n.transactionType}:{}),f=yield _chunkDSIFRRBScjs.d.call(void 0, this,d).send(this.walletLocator,v,C);if("message"in f)throw _chunk36GZTRZXcjs.a.error("wallet.send.error",{error:f}),new (0, _chunkD2S37DJ5cjs.I)(`Failed to send token: ${JSON.stringify(f.message)}`);if((n==null?void 0:n.prepareOnly)===!0)return _chunk36GZTRZXcjs.a.info("wallet.send.prepared",{transactionId:f.id}),{hash:void 0,explorerLink:void 0,transactionId:f.id};let m=yield this.approveTransactionAndWait(f.id);return _chunk36GZTRZXcjs.a.info("wallet.send.success",{transactionId:f.id,hash:m.hash}),m})}approveTransaction(e){return _chunkDSIFRRBScjs.h.call(void 0, 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 _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){if(_chunk36GZTRZXcjs.a.info("wallet.approve.start",{transactionId:e.transactionId,signatureId:e.signatureId}),yield this.preAuthIfNeeded(),e.transactionId!=null){let r=yield this.approveTransactionAndWait(e.transactionId,e.options);return _chunk36GZTRZXcjs.a.info("wallet.approve.success",{transactionId:e.transactionId}),r}if(e.signatureId!=null){let r=yield this.approveSignatureAndWait(e.signatureId,e.options);return _chunk36GZTRZXcjs.a.info("wallet.approve.success",{signatureId:e.signatureId}),r}throw _chunk36GZTRZXcjs.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 _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){_chunk36GZTRZXcjs.a.info("wallet.addSigner.start");let t=typeof e=="object"&&"type"in e&&e.type==="server"?this.resolveServerSignerApiLocator(e):e;return _chunkDSIFRRBScjs.d.call(void 0, this,o).withRecoverySigner(n=>_chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var m;let a=typeof t=="string"?t:_chunkWSDMIQNGcjs.b.call(void 0, t),c=yield _chunkDSIFRRBScjs.d.call(void 0, this,o).getSignerState(a);if(c.signer!=null){if(_chunkDSIFRRBScjs.d.call(void 0, this,o).isApprovedSignerStatus(c.signer.status))return(r==null?void 0:r.scopes)!=null&&_chunk36GZTRZXcjs.a.warn("wallet.addSigner.scopesIgnored",{reason:"signer already approved",signerLocator:a}),_chunk36GZTRZXcjs.a.info("wallet.addSigner.alreadyApproved"),this.completeSignerRegistration(c.signer,null,r);if(c.pendingOperation!=null){if((r==null?void 0:r.scopes)!=null)throw new Error("Cannot apply scopes when resuming a pending signer registration. Remove the pending signer and register it again with the desired scopes.");return _chunk36GZTRZXcjs.a.info("wallet.addSigner.resuming",{operationType:c.pendingOperation.type,operationId:c.pendingOperation.id}),this.completeSignerRegistration(c.signer,c.pendingOperation,r)}}let g=typeof t=="string"?t:_chunkO2ET3L2Rcjs.a.call(void 0, t.type).addSignerPayload(t,_chunkDSIFRRBScjs.d.call(void 0, this,o).descriptorContext()),y=this.chain!=="solana"&&this.chain!=="stellar"?(m=r==null?void 0:r.deployImmediately)!=null?m:!0:void 0,h=yield _chunkDSIFRRBScjs.d.call(void 0, this,d).registerSigner(this.walletLocator,_chunkDSIFRRBScjs.a.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {signer:g,chain:this.chainAdapter.addSignerChain(this.chain)},(r==null?void 0:r.scopes)!=null&&{scopes:r.scopes}),y!=null&&{deployImmediately:y}),n!=null&&{approver:n}));if("error"in h)throw _chunk36GZTRZXcjs.a.error("wallet.addSigner.error",{error:h}),h.code===_chunkD2S37DJ5cjs.l?new (0, _chunkD2S37DJ5cjs.m)(h.message):new (0, _chunkD2S37DJ5cjs.j)(`Failed to register signer: ${JSON.stringify(h.message)}`);let C=_chunkJNKTRQPScjs.b.call(void 0, h,this.chain);if(C==null)throw new Error(`No approval found for chain ${this.chain} in register signer response`);let f=this.chainAdapter.extractAddSignerOperation(h,this.chain,{locator:a,type:e.type});return this.completeSignerRegistration(C,f,r)}))})}completeSignerRegistration(e,r,t){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){if(t!=null&&t.prepareOnly){if(r==null)return _chunkDSIFRRBScjs.a.call(void 0, {},e);switch(r.type){case"transaction":{let n={transactionId:r.id};return _chunk36GZTRZXcjs.a.info("wallet.addSigner.prepared",n),_chunkDSIFRRBScjs.a.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {},e),n)}case"signature":{let n={signatureId:r.id};return _chunk36GZTRZXcjs.a.info("wallet.addSigner.prepared",n),_chunkDSIFRRBScjs.a.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {},e),n)}default:{let n=r.type;throw new Error(`Unknown pending operation type: ${n}`)}}}if(r!=null)switch(r.type){case"transaction":yield this.approveTransactionAndWait(r.id),_chunk36GZTRZXcjs.a.info("wallet.addSigner.success",{transactionId:r.id});break;case"signature":yield this.approveSignatureAndWait(r.id),_chunk36GZTRZXcjs.a.info("wallet.addSigner.success",{signatureId:r.id});break;default:{let n=r.type;throw new Error(`Unknown pending operation type: ${n}`)}}else _chunk36GZTRZXcjs.a.info("wallet.addSigner.success");return _chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {},e),{status:"success"})})}removeSigner(e,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let t=this.resolveSignerLocator(e);return _chunk36GZTRZXcjs.a.info("wallet.removeSigner.start",{signerLocator:t}),_chunkDSIFRRBScjs.d.call(void 0, this,o).withRecoverySigner(n=>_chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let a=yield _chunkDSIFRRBScjs.d.call(void 0, this,d).removeSigner(this.walletLocator,t,_chunkDSIFRRBScjs.a.call(void 0, {chain:this.chainAdapter.addSignerChain(this.chain)},n!=null&&{approver:n}));if("error"in a)throw _chunk36GZTRZXcjs.a.error("wallet.removeSigner.error",{error:a}),new Error(`Failed to remove signer: ${JSON.stringify(a)}`);let c=a.id;return r!=null&&r.prepareOnly?(_chunk36GZTRZXcjs.a.info("wallet.removeSigner.prepared",{transactionId:c}),{transactionId:c,status:void 0}):(yield this.approveTransactionAndWait(c),_chunk36GZTRZXcjs.a.info("wallet.removeSigner.success",{transactionId:c}),{transactionId:c,status:"success"})}))})}addRecoveryMethod(e,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){this.assertRecoveryMethodManagementSupported(),_chunk36GZTRZXcjs.a.info("wallet.addRecoveryMethod.start");let t=e.type==="server"?this.resolveServerSignerApiLocator(e):e;return _chunkDSIFRRBScjs.d.call(void 0, this,o).withRecoverySigner(n=>_chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let a=typeof t=="string"?t:_chunkO2ET3L2Rcjs.a.call(void 0, t.type).addSignerPayload(t,_chunkDSIFRRBScjs.d.call(void 0, this,o).descriptorContext()),c=yield _chunkDSIFRRBScjs.d.call(void 0, this,d).registerRecoveryMethod(this.walletLocator,{recoveryMethods:a,approver:this.resolveRecoveryApprover(n)});if("error"in c)throw _chunk36GZTRZXcjs.a.error("wallet.addRecoveryMethod.error",{error:c}),new (0, _chunkD2S37DJ5cjs.j)(`Failed to add recovery method: ${JSON.stringify(c.message)}`);let g=c.tx.id;return r!=null&&r.prepareOnly?(_chunk36GZTRZXcjs.a.info("wallet.addRecoveryMethod.prepared",{transactionId:g}),{transactionId:g,status:void 0}):(yield this.approveTransactionAndWait(g),_chunkDSIFRRBScjs.d.call(void 0, this,o).addRecoverySigner(typeof t=="string"?{type:"server",address:t.slice(7)}:t),_chunk36GZTRZXcjs.a.info("wallet.addRecoveryMethod.success",{transactionId:g}),{transactionId:g,status:"success"})}))})}removeRecoveryMethod(e,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){this.assertRecoveryMethodManagementSupported();let t=this.resolveSignerLocator(e);return _chunk36GZTRZXcjs.a.info("wallet.removeRecoveryMethod.start",{recoveryMethodLocator:t}),_chunkDSIFRRBScjs.d.call(void 0, this,o).withRecoverySigner(n=>_chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let a=yield _chunkDSIFRRBScjs.d.call(void 0, this,d).removeRecoveryMethod(this.walletLocator,t,{approver:this.resolveRecoveryApprover(n)});if("error"in a)throw _chunk36GZTRZXcjs.a.error("wallet.removeRecoveryMethod.error",{error:a}),new Error(`Failed to remove recovery method: ${JSON.stringify(a)}`);let c=a.id;return r!=null&&r.prepareOnly?(_chunk36GZTRZXcjs.a.info("wallet.removeRecoveryMethod.prepared",{transactionId:c}),{transactionId:c,status:void 0}):(yield this.approveTransactionAndWait(c),_chunkDSIFRRBScjs.d.call(void 0, this,o).removeRecoverySigner(t),_chunk36GZTRZXcjs.a.info("wallet.removeRecoveryMethod.success",{transactionId:c}),{transactionId:c,status:"success"})}))})}assertRecoveryMethodManagementSupported(){if(this.chain!=="solana"&&this.chain!=="stellar")throw new (0, _chunkD2S37DJ5cjs.u)(`Adding and removing recovery methods is not supported on ${this.chain} yet. It is available on Solana and Stellar.`)}resolveRecoveryApprover(e){return e!=null?e:_chunkDSIFRRBScjs.d.call(void 0, this,o).require().locator()}useSigner(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){_chunk36GZTRZXcjs.a.info("wallet.useSigner.start"),e.type==="server"&&_chunkDSIFRRBScjs.d.call(void 0, this,T).resetDelegatedCache(),_chunkO2ET3L2Rcjs.a.call(void 0, e.type).validateConfig(e);let r=!1;e.type==="device"?yield _chunkDSIFRRBScjs.d.call(void 0, this,S).resolveAvailability(e):r=yield this.resolveNonDeviceSigner(e);let t=_chunkO2ET3L2Rcjs.a.call(void 0, e.type).buildInternalConfig(e,_chunkDSIFRRBScjs.d.call(void 0, this,o).descriptorContext()),n=_chunkWSDMIQNGcjs.b.call(void 0, e);_chunkDSIFRRBScjs.d.call(void 0, this,o).setActiveSigner(yield _chunkDSIFRRBScjs.d.call(void 0, this,o).assemble(t,{isAdminSigner:r})),_chunk36GZTRZXcjs.a.info("wallet.useSigner.success",{signerLocator:n})})}useRecoveryMethod(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){_chunk36GZTRZXcjs.a.info("wallet.useRecoveryMethod.start"),_chunkO2ET3L2Rcjs.a.call(void 0, e.type).validateConfig(e);let r=this.matchRecoverySigner(e);if(r==null){let n=this.recoveryMethods.map(a=>_chunkDSIFRRBScjs.d.call(void 0, this,o).recoveryLocator(a)).filter(a=>a!=null).join(", ");throw new (0, _chunkD2S37DJ5cjs.o)(`Signer "${this.resolveSignerLocator(e)}" is not one of this wallet's recovery methods (${n}).`)}e.type==="server"&&_chunkDSIFRRBScjs.d.call(void 0, this,o).stripSecretFromRecovery(r,_chunkDSIFRRBScjs.d.call(void 0, this,T).resolveRecovery(e));let t=_chunkO2ET3L2Rcjs.a.call(void 0, e.type).adoptsRecoveryConfigOnMatch?this.recoveryMethods[r]:e.type==="passkey"?this.withPasskeyRecoveryCredentialId(e,r):e;_chunkDSIFRRBScjs.d.call(void 0, this,o).selectRecovery(r,t),_chunk36GZTRZXcjs.a.info("wallet.useRecoveryMethod.success",{recoveryMethodLocator:_chunkDSIFRRBScjs.d.call(void 0, this,o).recoveryLocator(t)})})}resolveNonDeviceSigner(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){if(e.type!=="passkey"&&e.type!=="server"&&this.isRecoverySigner(e))return _chunkDSIFRRBScjs.d.call(void 0, this,S).onSignerSelected(),!0;if(e.type==="passkey"&&this.isPasskeyMissingId(e)&&!(yield this.tryAutoSelectPasskey(e))){if(this.isRecoverySigner(e))return _chunkDSIFRRBScjs.d.call(void 0, this,S).onSignerSelected(),!0;throw new Error("No passkey signer is registered on this wallet.")}if(e.type==="server")return this.resolveServerSigner(e);let r=this.resolveSignerLocator(e);if(yield this.signerIsRegistered(r))return _chunkDSIFRRBScjs.d.call(void 0, this,S).onSignerSelected(),!1;if(this.isRecoverySigner(e))return _chunkDSIFRRBScjs.d.call(void 0, this,S).onSignerSelected(),!0;throw new Error(`Signer "${r}" is not registered in this wallet.`)})}resolveServerSigner(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let t=(yield this.signers()).map(c=>c.locator),n={recoveryIndex:null},a=_chunkDSIFRRBScjs.d.call(void 0, this,T).resolveForUseSigner(e,t,()=>(n.recoveryIndex=this.matchRecoverySigner(e),n.recoveryIndex!=null));switch(a.kind){case"delegated":return _chunkDSIFRRBScjs.d.call(void 0, this,S).onSignerSelected(),!1;case"recovery":return n.recoveryIndex!=null&&_chunkDSIFRRBScjs.d.call(void 0, this,o).stripSecretFromRecovery(n.recoveryIndex,a.address),_chunkDSIFRRBScjs.d.call(void 0, this,S).onSignerSelected(),!0;case"unregistered":throw new Error(a.message)}})}withPasskeyRecoveryCredentialId(e,r){if(_chunkWSDMIQNGcjs.a.call(void 0, e)!=null)return e;if(this.recoveryMethods.filter(a=>a.type==="passkey").length>1)throw new (0, _chunkD2S37DJ5cjs.o)('Multiple passkey recovery methods are registered on this wallet. Please specify the credential id: wallet.useRecoveryMethod({ type: "passkey", id: "<credential-id>" })');let n=_chunkWSDMIQNGcjs.a.call(void 0, this.recoveryMethods[r]);if(n==null)throw new (0, _chunkD2S37DJ5cjs.o)('The passkey recovery method has no credential id. Please specify it: wallet.useRecoveryMethod({ type: "passkey", id: "<credential-id>" })');return _chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {},e),{id:n})}tryAutoSelectPasskey(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let t=(yield this.signers()).filter(n=>n.type==="passkey");if(t.length===0)return!1;if(t.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>" })');return e.id=t[0].locator.replace("passkey:",""),!0})}resolveSignerLocator(e){return e.type==="server"?this.resolveServerSignerApiLocator(e):_chunkWSDMIQNGcjs.b.call(void 0, e)}isPasskeyMissingId(e){return _chunkWSDMIQNGcjs.a.call(void 0, e)==null}signerIsRegistered(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return _chunkDSIFRRBScjs.d.call(void 0, this,o).signerIsRegistered(e)})}isSignerApproved(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return _chunkDSIFRRBScjs.d.call(void 0, this,o).isSignerApproved(e)})}needsRecovery(){return _chunkDSIFRRBScjs.d.call(void 0, this,S).needsRecovery}recover(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){yield _chunkDSIFRRBScjs.d.call(void 0, this,S).recover()})}signers(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var a,c;_chunk36GZTRZXcjs.a.info("wallet.signers.start");let e=yield _chunkDSIFRRBScjs.d.call(void 0, this,d).getWallet(this.walletLocator);if("error"in e)throw _chunk36GZTRZXcjs.a.error("wallet.signers.error",{error:e}),new (0, _chunkD2S37DJ5cjs.e)(JSON.stringify(e));if(!me(e)){let g=e.type!=="smart"?`Wallet type ${e.type} not supported`:`Wallet chain type ${e.chainType} not supported`;throw _chunk36GZTRZXcjs.a.error("wallet.signers.error",{error:g}),new (0, _chunkD2S37DJ5cjs.d)(g)}let r=(c=(a=e==null?void 0:e.config)==null?void 0:a.delegatedSigners)!=null?c:[],n=(yield Promise.all(r.map(g=>_chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){try{return(yield _chunkDSIFRRBScjs.d.call(void 0, this,o).getSignerState(g.locator)).signer}catch(v){return _chunk36GZTRZXcjs.a.warn("wallet.signers.mapSigner.failed",{locator:g.locator,error:v}),null}})))).filter(g=>g!=null);return _chunk36GZTRZXcjs.a.info("wallet.signers.success",{count:n.length}),n})}get walletLocator(){if(_chunkDSIFRRBScjs.d.call(void 0, this,d).isServerSide)return this.address;{let e=this.chainAdapter.walletLocatorPrefix,r=this.alias!=null?`:alias:${this.alias}`:"";return e+r}}get signerManager(){return _chunkDSIFRRBScjs.d.call(void 0, this,o)}preAuthIfNeeded(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){yield _chunkDSIFRRBScjs.d.call(void 0, this,M),_chunkDSIFRRBScjs.d.call(void 0, this,L)==null&&_chunkDSIFRRBScjs.f.call(void 0, this,L,this.recover());try{yield _chunkDSIFRRBScjs.d.call(void 0, this,L)}finally{_chunkDSIFRRBScjs.f.call(void 0, this,L,null)}let e=_chunkDSIFRRBScjs.d.call(void 0, this,o).require();e instanceof _chunkWSCABGVOcjs.a&&(yield e.ensureAuthenticated())})}isRecoverySigner(e){return this.matchRecoverySigner(e)!=null}matchRecoverySigner(e){let r=_chunkO2ET3L2Rcjs.a.call(void 0, e.type),t=_chunkDSIFRRBScjs.d.call(void 0, this,o).descriptorContext(),n=this.recoveryMethods.findIndex(a=>a.type===e.type&&r.matchesRecovery(e,a,t));return n===-1?null:(r.adoptsRecoveryConfigOnMatch&&_chunkDSIFRRBScjs.d.call(void 0, this,o).adoptRecoveryConfig(n,e),n)}resolveChainForEnvironment(){let e=_chunkKQDPQXLLcjs.f.call(void 0, this.chain,_chunkDSIFRRBScjs.d.call(void 0, this,d).environment);return e!==this.chain&&(this.chain=e),this.chain}approveTransactionAndWait(e,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return yield this.approveTransactionInternal(e,r),yield this.sleep(1e3),yield this.waitForTransaction(e)})}approveSignatureAndWait(e,r){return _chunkDSIFRRBScjs.h.call(void 0, 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 _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var v,y;if(!this.chainAdapter.supportsSignatures)throw new Error("Approving signatures is only supported for EVM smart wallets");let t=_chunkDSIFRRBScjs.d.call(void 0, this,o).require(),n=yield _chunkDSIFRRBScjs.d.call(void 0, this,d).getSignature(this.walletLocator,e);if("error"in n)throw _chunkD2S37DJ5cjs.R.call(void 0, n),new (0, _chunkD2S37DJ5cjs.E)(JSON.stringify(n));if(t.type==="api-key")return n;if((r==null?void 0:r.approval)!=null){let h=[r.approval];return yield this.executeApproveSignatureWithErrorHandling(e,h)}let a=(v=n.approvals)==null?void 0:v.pending;if(a==null||a.length===0)return n;let c=[...(y=r==null?void 0:r.additionalSigners)!=null?y:[],t],g=yield _chunkDSIFRRBScjs.g.call(void 0, this,b,H).call(this,_chunkDSIFRRBScjs.g.call(void 0, this,b,j).call(this,a),c,(h,C)=>h.signMessage(C.message));return yield this.executeApproveSignatureWithErrorHandling(e,g)})}approveTransactionInternal(e,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var v,y,h,C,f;let t=yield _chunkDSIFRRBScjs.d.call(void 0, this,d).getTransaction(this.walletLocator,e);if("error"in t)throw _chunkD2S37DJ5cjs.R.call(void 0, t),new (0, _chunkD2S37DJ5cjs.J)(JSON.stringify(t));yield(h=(y=(v=_chunkDSIFRRBScjs.d.call(void 0, this,O))==null?void 0:v.callbacks)==null?void 0:y.onTransactionStart)==null?void 0:h.call(y);let n=_chunkDSIFRRBScjs.d.call(void 0, this,o).require();if(n.type==="api-key")return t;if((r==null?void 0:r.approval)!=null){let m=[r.approval];return yield this.executeApproveTransactionWithErrorHandling(e,m)}let a=(C=t.approvals)==null?void 0:C.pending;if(a==null||a.length===0)return t;let c=[...(f=r==null?void 0:r.additionalSigners)!=null?f:[],n],g=yield _chunkDSIFRRBScjs.g.call(void 0, this,b,H).call(this,_chunkDSIFRRBScjs.g.call(void 0, this,b,j).call(this,a),c,(m,U)=>_chunkNM33FBA3cjs.c.call(void 0, t.chainType,this.chainAdapter).signApproval(m,t,U.message));return yield this.executeApproveTransactionWithErrorHandling(e,g)})}executeApproveTransactionWithErrorHandling(e,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){_chunk36GZTRZXcjs.a.info("wallet.approve: submitting approval to API",{transactionId:e});let t=yield _chunkDSIFRRBScjs.d.call(void 0, this,d).approveTransaction(this.walletLocator,e,{approvals:r});if(t.error)throw _chunkD2S37DJ5cjs.R.call(void 0, t),new (0, _chunkD2S37DJ5cjs.O)(JSON.stringify(t));return t})}executeApproveSignatureWithErrorHandling(e,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let t=yield _chunkDSIFRRBScjs.d.call(void 0, this,d).approveSignature(this.walletLocator,e,{approvals:r});if(t.error)throw _chunkD2S37DJ5cjs.R.call(void 0, t),new (0, _chunkD2S37DJ5cjs.F)(JSON.stringify(t));return t})}waitForSignature(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return yield _chunkMT2D5VRFcjs.b.call(void 0, _chunkDSIFRRBScjs.d.call(void 0, this,d),this.walletLocator,e)})}waitForTransaction(n){return _chunkDSIFRRBScjs.h.call(void 0, this,arguments,function*(e,r=6e4,t={}){return yield _chunkMT2D5VRFcjs.a.call(void 0, _chunkDSIFRRBScjs.d.call(void 0, this,d),this.walletLocator,e,_chunkDSIFRRBScjs.a.call(void 0, {timeoutMs:r},t))})}sleep(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return new Promise(r=>setTimeout(r,e))})}};O=new WeakMap,d=new WeakMap,F=new WeakMap,T=new WeakMap,o=new WeakMap,S=new WeakMap,W=new WeakMap,M=new WeakMap,L=new WeakMap,b=new WeakSet,fe=function(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let r=yield _chunkDSIFRRBScjs.d.call(void 0, this,S).tryResolveLocallyAvailableSigner(e);return r!=null&&_chunk36GZTRZXcjs.a.info("wallet.approve.deviceSignerRecoveredViaFallback",{signerLocator:e}),r})},we=function(e,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var n;let t=e.find(a=>a.locator()===r);if(t==null&&(t=(n=yield _chunkDSIFRRBScjs.g.call(void 0, this,b,fe).call(this,r))!=null?n:void 0),t==null)throw new (0, _chunkD2S37DJ5cjs.j)(`Signer ${r} not found in pending approvals`);return t})},j=function(e){return e.map(r=>{if(r.signer.type==="quorum")throw new (0, _chunkD2S37DJ5cjs.n)(`This wallet requires approval from a quorum signer (${r.signer.locator}), which is not yet supported by this SDK version`);return r})},H=function(e,r,t){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return yield Promise.all(e.map(n=>_chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let a=yield _chunkDSIFRRBScjs.g.call(void 0, this,b,we).call(this,r,n.signer.locator),c=yield t(a,n);return _chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {},c),{signer:a.locator()})})))})},_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunk36GZTRZXcjs.a,methodName:"wallet.balances",buildContext(e){return{chain:e.chain,address:e.address}}})],w.prototype,"balances",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunk36GZTRZXcjs.a,methodName:"wallet.stagingFund",buildContext(e){return{chain:e.chain,address:e.address}}})],w.prototype,"stagingFund",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunk36GZTRZXcjs.a,methodName:"wallet.send",buildContext(e){return{chain:e.chain,address:e.address}}})],w.prototype,"send",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunk36GZTRZXcjs.a,methodName:"wallet.approve",buildContext(e){return{chain:e.chain,address:e.address}}})],w.prototype,"approve",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunk36GZTRZXcjs.a,methodName:"wallet.addSigner",buildContext(e){return{chain:e.chain,address:e.address}}})],w.prototype,"addSigner",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunk36GZTRZXcjs.a,methodName:"wallet.removeSigner",buildContext(e){return{chain:e.chain,address:e.address}}})],w.prototype,"removeSigner",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunk36GZTRZXcjs.a,methodName:"wallet.addRecoveryMethod",buildContext(e){return{chain:e.chain,address:e.address}}})],w.prototype,"addRecoveryMethod",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunk36GZTRZXcjs.a,methodName:"wallet.removeRecoveryMethod",buildContext(e){return{chain:e.chain,address:e.address}}})],w.prototype,"removeRecoveryMethod",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunk36GZTRZXcjs.a,methodName:"wallet.useSigner",buildContext(e){return{chain:e.chain,address:e.address}}})],w.prototype,"useSigner",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunk36GZTRZXcjs.a,methodName:"wallet.useRecoveryMethod",buildContext(e){return{chain:e.chain,address:e.address}}})],w.prototype,"useRecoveryMethod",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunk36GZTRZXcjs.a,methodName:"wallet.recover",buildContext(e){return{chain:e.chain,address:e.address}}})],w.prototype,"recover",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunk36GZTRZXcjs.a,methodName:"wallet.signers",buildContext(e){return{chain:e.chain,address:e.address}}})],w.prototype,"signers",1);function me(G){return G.type==="smart"&&_chunkNM33FBA3cjs.b.call(void 0, G.chainType)}exports.a = w;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkCMER6QR6cjs = require('./chunk-CMER6QR6.cjs');var _chunkGAKX357Ncjs = require('./chunk-GAKX357N.cjs');var _chunkPWHMYEUNcjs = require('./chunk-PWHMYEUN.cjs');var _chunk7FIAYQ4Ocjs = require('./chunk-7FIAYQ4O.cjs');var _chunk5GYSXH4Xcjs = require('./chunk-5GYSXH4X.cjs');var _chunk5FVDLMWWcjs = require('./chunk-5FVDLMWW.cjs');var _chunkXWQC6G7Ncjs = require('./chunk-XWQC6G7N.cjs');var _chunkR4SBFRTMcjs = require('./chunk-R4SBFRTM.cjs');var _chunkHYWIWJ6Hcjs = require('./chunk-HYWIWJ6H.cjs');var _chunkDXF5442Wcjs = require('./chunk-DXF5442W.cjs');var _chunkCDHMNLZ6cjs = require('./chunk-CDHMNLZ6.cjs');var _chunkD2S37DJ5cjs = require('./chunk-D2S37DJ5.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');function c(r,e,n){switch(e.type){case"email":case"phone":return r==="solana"?new (0, _chunkGAKX357Ncjs.a)(e):r==="stellar"?new (0, _chunkPWHMYEUNcjs.a)(e):new (0, _chunkCMER6QR6cjs.a)(e);case"api-key":return r==="solana"?new (0, _chunkCDHMNLZ6cjs.a)(e):new (0, _chunkR4SBFRTMcjs.a)(e);case"external-wallet":return r==="solana"?new (0, _chunk5GYSXH4Xcjs.a)(e):r==="stellar"?new (0, _chunk5FVDLMWWcjs.a)(e):new (0, _chunkHYWIWJ6Hcjs.a)(e);case"server":return _chunk7FIAYQ4Ocjs.a.call(void 0, r,e);case"passkey":return new (0, _chunkDXF5442Wcjs.a)(e);case"device":if(n==null)throw new (0, _chunkD2S37DJ5cjs.g)("Device signer key storage is required for device signers");return new (0, _chunkXWQC6G7Ncjs.a)(e,n)}}function b(r,e,n,a){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){if(!e.startsWith("device:"))return null;let w=e.replace("device:","");return(yield a.hasKey(w))?c(r,{type:"device",locator:e,address:n},a):null})}exports.a = c; exports.b = b;