@crossmint/wallets-sdk 1.17.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 (333) 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 +3 -1
  9. package/dist/api/client.d.ts +3 -1
  10. package/dist/api/client.js +1 -1
  11. package/dist/api/gen/index.cjs +1 -1
  12. package/dist/api/gen/index.d.cts +2 -2
  13. package/dist/api/gen/index.d.ts +2 -2
  14. package/dist/api/gen/index.js +1 -1
  15. package/dist/api/gen/sdk.gen.cjs +1 -1
  16. package/dist/api/gen/sdk.gen.d.cts +22 -2
  17. package/dist/api/gen/sdk.gen.d.ts +22 -2
  18. package/dist/api/gen/sdk.gen.js +1 -1
  19. package/dist/api/gen/types.gen.d.cts +4201 -710
  20. package/dist/api/gen/types.gen.d.ts +4201 -710
  21. package/dist/api/index.cjs +1 -1
  22. package/dist/api/index.d.cts +1 -1
  23. package/dist/api/index.d.ts +1 -1
  24. package/dist/api/index.js +1 -1
  25. package/dist/api/types.d.cts +1 -1
  26. package/dist/api/types.d.ts +1 -1
  27. package/dist/chains/adapters/evm.cjs +1 -1
  28. package/dist/chains/adapters/evm.d.cts +1 -1
  29. package/dist/chains/adapters/evm.d.ts +1 -1
  30. package/dist/chains/adapters/evm.js +1 -1
  31. package/dist/chains/adapters/solana.cjs +1 -1
  32. package/dist/chains/adapters/solana.d.cts +1 -1
  33. package/dist/chains/adapters/solana.d.ts +1 -1
  34. package/dist/chains/adapters/solana.js +1 -1
  35. package/dist/chains/adapters/stellar.cjs +1 -1
  36. package/dist/chains/adapters/stellar.d.cts +1 -1
  37. package/dist/chains/adapters/stellar.d.ts +1 -1
  38. package/dist/chains/adapters/stellar.js +1 -1
  39. package/dist/chains/chain-adapter.cjs +1 -1
  40. package/dist/chains/chain-adapter.d.cts +1 -1
  41. package/dist/chains/chain-adapter.d.ts +1 -1
  42. package/dist/chains/chain-adapter.js +1 -1
  43. package/dist/chains/chains.cjs +1 -1
  44. package/dist/chains/chains.d.cts +2 -2
  45. package/dist/chains/chains.d.ts +2 -2
  46. package/dist/chains/chains.js +1 -1
  47. package/dist/{chunk-3UROOLIH.js → chunk-266RS53K.js} +1 -1
  48. package/dist/chunk-2E6IJLDW.js +1 -0
  49. package/dist/{chunk-6M2N2ULU.js → chunk-2J5RPKHK.js} +1 -1
  50. package/dist/{chunk-SWQSW2AD.js → chunk-2KGAVQXR.js} +1 -1
  51. package/dist/{chunk-INUEMQPG.js → chunk-2YLAHC7J.js} +1 -1
  52. package/dist/{chunk-W3BYSI7F.cjs → chunk-36GZTRZX.cjs} +1 -1
  53. package/dist/chunk-3F4Z2URU.js +1 -0
  54. package/dist/{chunk-NWFQRNBN.cjs → chunk-3FQB7LST.cjs} +1 -1
  55. package/dist/chunk-3FUVUUXU.cjs +1 -0
  56. package/dist/{chunk-T5LUBX5J.cjs → chunk-3SSOE7BV.cjs} +2 -2
  57. package/dist/chunk-3W22A7E7.js +1 -0
  58. package/dist/chunk-4I3EXM4B.js +1 -0
  59. package/dist/{chunk-3RVLLQ4M.cjs → chunk-4LXZPDTP.cjs} +1 -1
  60. package/dist/{chunk-AB2JJTW4.js → chunk-54LGZZX4.js} +1 -1
  61. package/dist/{chunk-STB2VIIK.cjs → chunk-5GYSXH4X.cjs} +1 -1
  62. package/dist/chunk-67VE25UL.js +1 -0
  63. package/dist/{chunk-4HOB7SBT.cjs → chunk-6XLTNU2N.cjs} +1 -1
  64. package/dist/{chunk-M42AKAZK.cjs → chunk-AEHDAUN4.cjs} +1 -1
  65. package/dist/{chunk-P5VJ455G.cjs → chunk-B45GSXKN.cjs} +1 -1
  66. package/dist/{chunk-R2XC4F3M.cjs → chunk-BJJXTZJB.cjs} +1 -1
  67. package/dist/chunk-C5LIXILN.js +1 -0
  68. package/dist/{chunk-TDI66D63.cjs → chunk-CFRSSHAG.cjs} +1 -1
  69. package/dist/chunk-CMER6QR6.cjs +1 -0
  70. package/dist/chunk-D2S37DJ5.cjs +1 -0
  71. package/dist/chunk-DBFCNM4F.js +1 -0
  72. package/dist/{chunk-ZMU6KU3L.js → chunk-DCZP3IV7.js} +1 -1
  73. package/dist/{chunk-PWVGLO7T.cjs → chunk-DXF5442W.cjs} +1 -1
  74. package/dist/{chunk-JAXFDUNN.js → chunk-ECKSTWA3.js} +1 -1
  75. package/dist/{chunk-NB6EQOHP.cjs → chunk-FNDMOANS.cjs} +1 -1
  76. package/dist/chunk-GAKX357N.cjs +1 -0
  77. package/dist/chunk-GBTTVLK5.cjs +1 -0
  78. package/dist/chunk-GPE7YQZ2.js +1 -0
  79. package/dist/{chunk-W222P6C6.cjs → chunk-HHA4QJLV.cjs} +1 -1
  80. package/dist/{chunk-PKFCOQOM.js → chunk-HHY65A7I.js} +1 -1
  81. package/dist/{chunk-PHIW7FUJ.cjs → chunk-HITDGEGW.cjs} +1 -1
  82. package/dist/chunk-HLI46UDR.js +1 -0
  83. package/dist/{chunk-AEO4REZV.js → chunk-HQ2RXBAN.js} +1 -1
  84. package/dist/{chunk-LJRWHLTK.cjs → chunk-HUZNB3IW.cjs} +1 -1
  85. package/dist/{chunk-HXNRP6QX.js → chunk-J5VWZVHL.js} +1 -1
  86. package/dist/{chunk-D6UK5JAA.cjs → chunk-JI3OXPVC.cjs} +1 -1
  87. package/dist/chunk-KQDPQXLL.cjs +1 -0
  88. package/dist/chunk-LEPWAFFZ.js +1 -0
  89. package/dist/{chunk-52EJ53LP.cjs → chunk-MI3DBGDV.cjs} +1 -1
  90. package/dist/{chunk-DWUBPIYD.cjs → chunk-MT2D5VRF.cjs} +1 -1
  91. package/dist/{chunk-BTTVP3MP.js → chunk-MVGSX46H.js} +1 -1
  92. package/dist/{chunk-MJZZHBC2.cjs → chunk-NDYXTEUL.cjs} +1 -1
  93. package/dist/chunk-NM33FBA3.cjs +1 -0
  94. package/dist/{chunk-PZRFDTBH.cjs → chunk-NS7UW4BA.cjs} +1 -1
  95. package/dist/chunk-O2ET3L2R.cjs +1 -0
  96. package/dist/{chunk-V5D6CUMS.js → chunk-OOMMVXZB.js} +1 -1
  97. package/dist/{chunk-WVKODEVW.js → chunk-PA3RU64J.js} +1 -1
  98. package/dist/{chunk-F7ERKXXH.js → chunk-PH4EWT7R.js} +1 -1
  99. package/dist/{chunk-C2QJ3WKC.js → chunk-PJ76KALO.js} +1 -1
  100. package/dist/chunk-PSIZCLMC.js +1 -0
  101. package/dist/chunk-PWHMYEUN.cjs +1 -0
  102. package/dist/{chunk-JLWNRQ4S.js → chunk-PWYCEHYZ.js} +1 -1
  103. package/dist/{chunk-25TINDQ4.js → chunk-Q7EO6OOI.js} +1 -1
  104. package/dist/{chunk-IQ6EAHDU.cjs → chunk-QJ3BV3MW.cjs} +1 -1
  105. package/dist/chunk-QUPMMNGB.js +1 -0
  106. package/dist/chunk-QYBC7GTA.js +1 -0
  107. package/dist/chunk-R4LSFTQB.js +1 -0
  108. package/dist/{chunk-BV6IQIQK.js → chunk-RV3Q5EIA.js} +1 -1
  109. package/dist/chunk-SE5L5SQK.cjs +1 -0
  110. package/dist/{chunk-HHIMK2FC.js → chunk-UFYLMDRQ.js} +1 -1
  111. package/dist/{chunk-FTUJ5XHD.js → chunk-VG67JHRI.js} +1 -1
  112. package/dist/{chunk-2KMXYKU6.js → chunk-VW24W4N4.js} +1 -1
  113. package/dist/{chunk-KQIDRPAB.cjs → chunk-VXWRNGOB.cjs} +1 -1
  114. package/dist/{chunk-ABOMDBIJ.js → chunk-WRXF6ZSY.js} +1 -1
  115. package/dist/chunk-WSCABGVO.cjs +1 -0
  116. package/dist/{chunk-CZC2MNVK.cjs → chunk-WSDMIQNG.cjs} +1 -1
  117. package/dist/{chunk-WP4GRRR2.js → chunk-WXHLPGEB.js} +1 -1
  118. package/dist/chunk-X2CTI7IK.cjs +1 -0
  119. package/dist/chunk-XMV4T3J5.cjs +1 -0
  120. package/dist/{chunk-HGH3VTQM.cjs → chunk-Y5JB3XEX.cjs} +1 -1
  121. package/dist/{chunk-NZHMWFOO.js → chunk-YOF3WB3D.js} +1 -1
  122. package/dist/chunk-YSR4FJK7.js +1 -0
  123. package/dist/{chunk-7RC4ESQH.cjs → chunk-ZACJIS35.cjs} +1 -1
  124. package/dist/{chunk-TLCSIHPP.cjs → chunk-ZR63HKN6.cjs} +1 -1
  125. package/dist/index.cjs +1 -1
  126. package/dist/index.d.cts +2 -2
  127. package/dist/index.d.ts +2 -2
  128. package/dist/index.js +1 -1
  129. package/dist/logger/index.cjs +1 -1
  130. package/dist/logger/index.js +1 -1
  131. package/dist/logger/init.cjs +1 -1
  132. package/dist/logger/init.js +1 -1
  133. package/dist/sdk.cjs +1 -1
  134. package/dist/sdk.d.cts +1 -1
  135. package/dist/sdk.d.ts +1 -1
  136. package/dist/sdk.js +1 -1
  137. package/dist/signers/descriptors/api-key.cjs +1 -1
  138. package/dist/signers/descriptors/api-key.d.cts +1 -1
  139. package/dist/signers/descriptors/api-key.d.ts +1 -1
  140. package/dist/signers/descriptors/api-key.js +1 -1
  141. package/dist/signers/descriptors/device.cjs +1 -1
  142. package/dist/signers/descriptors/device.d.cts +1 -1
  143. package/dist/signers/descriptors/device.d.ts +1 -1
  144. package/dist/signers/descriptors/device.js +1 -1
  145. package/dist/signers/descriptors/email.cjs +1 -1
  146. package/dist/signers/descriptors/email.d.cts +1 -1
  147. package/dist/signers/descriptors/email.d.ts +1 -1
  148. package/dist/signers/descriptors/email.js +1 -1
  149. package/dist/signers/descriptors/external-wallet.cjs +1 -1
  150. package/dist/signers/descriptors/external-wallet.d.cts +1 -1
  151. package/dist/signers/descriptors/external-wallet.d.ts +1 -1
  152. package/dist/signers/descriptors/external-wallet.js +1 -1
  153. package/dist/signers/descriptors/index.cjs +1 -1
  154. package/dist/signers/descriptors/index.d.cts +1 -1
  155. package/dist/signers/descriptors/index.d.ts +1 -1
  156. package/dist/signers/descriptors/index.js +1 -1
  157. package/dist/signers/descriptors/passkey.cjs +1 -1
  158. package/dist/signers/descriptors/passkey.d.cts +1 -1
  159. package/dist/signers/descriptors/passkey.d.ts +1 -1
  160. package/dist/signers/descriptors/passkey.js +1 -1
  161. package/dist/signers/descriptors/phone.cjs +1 -1
  162. package/dist/signers/descriptors/phone.d.cts +1 -1
  163. package/dist/signers/descriptors/phone.d.ts +1 -1
  164. package/dist/signers/descriptors/phone.js +1 -1
  165. package/dist/signers/descriptors/server.d.cts +1 -1
  166. package/dist/signers/descriptors/server.d.ts +1 -1
  167. package/dist/signers/descriptors/types.d.cts +1 -1
  168. package/dist/signers/descriptors/types.d.ts +1 -1
  169. package/dist/signers/device.d.cts +1 -1
  170. package/dist/signers/device.d.ts +1 -1
  171. package/dist/signers/evm-api-key.d.cts +1 -1
  172. package/dist/signers/evm-api-key.d.ts +1 -1
  173. package/dist/signers/evm-external-wallet.d.cts +1 -1
  174. package/dist/signers/evm-external-wallet.d.ts +1 -1
  175. package/dist/signers/external-wallet-signer.d.cts +1 -1
  176. package/dist/signers/external-wallet-signer.d.ts +1 -1
  177. package/dist/signers/index.cjs +1 -1
  178. package/dist/signers/index.d.cts +1 -1
  179. package/dist/signers/index.d.ts +1 -1
  180. package/dist/signers/index.js +1 -1
  181. package/dist/signers/non-custodial/index.cjs +1 -1
  182. package/dist/signers/non-custodial/index.d.cts +1 -1
  183. package/dist/signers/non-custodial/index.d.ts +1 -1
  184. package/dist/signers/non-custodial/index.js +1 -1
  185. package/dist/signers/non-custodial/ncs-evm-signer.cjs +1 -1
  186. package/dist/signers/non-custodial/ncs-evm-signer.d.cts +1 -1
  187. package/dist/signers/non-custodial/ncs-evm-signer.d.ts +1 -1
  188. package/dist/signers/non-custodial/ncs-evm-signer.js +1 -1
  189. package/dist/signers/non-custodial/ncs-signer.cjs +1 -1
  190. package/dist/signers/non-custodial/ncs-signer.d.cts +2 -2
  191. package/dist/signers/non-custodial/ncs-signer.d.ts +2 -2
  192. package/dist/signers/non-custodial/ncs-signer.js +1 -1
  193. package/dist/signers/non-custodial/ncs-solana-signer.cjs +1 -1
  194. package/dist/signers/non-custodial/ncs-solana-signer.d.cts +1 -1
  195. package/dist/signers/non-custodial/ncs-solana-signer.d.ts +1 -1
  196. package/dist/signers/non-custodial/ncs-solana-signer.js +1 -1
  197. package/dist/signers/non-custodial/ncs-stellar-signer.cjs +1 -1
  198. package/dist/signers/non-custodial/ncs-stellar-signer.d.cts +1 -1
  199. package/dist/signers/non-custodial/ncs-stellar-signer.d.ts +1 -1
  200. package/dist/signers/non-custodial/ncs-stellar-signer.js +1 -1
  201. package/dist/signers/passkey.cjs +1 -1
  202. package/dist/signers/passkey.d.cts +1 -1
  203. package/dist/signers/passkey.d.ts +1 -1
  204. package/dist/signers/passkey.js +1 -1
  205. package/dist/signers/server/assemble-server-signer.d.cts +1 -1
  206. package/dist/signers/server/assemble-server-signer.d.ts +1 -1
  207. package/dist/signers/server/evm-server-signer.d.cts +1 -1
  208. package/dist/signers/server/evm-server-signer.d.ts +1 -1
  209. package/dist/signers/server/helpers/derive-server-signer.d.cts +1 -1
  210. package/dist/signers/server/helpers/derive-server-signer.d.ts +1 -1
  211. package/dist/signers/server/helpers/index.d.cts +1 -1
  212. package/dist/signers/server/helpers/index.d.ts +1 -1
  213. package/dist/signers/server/index.d.cts +1 -1
  214. package/dist/signers/server/index.d.ts +1 -1
  215. package/dist/signers/server/resolver.d.cts +1 -1
  216. package/dist/signers/server/resolver.d.ts +1 -1
  217. package/dist/signers/server/solana-server-signer.d.cts +1 -1
  218. package/dist/signers/server/solana-server-signer.d.ts +1 -1
  219. package/dist/signers/server/stellar-server-signer.d.cts +1 -1
  220. package/dist/signers/server/stellar-server-signer.d.ts +1 -1
  221. package/dist/signers/solana-api-key.d.cts +1 -1
  222. package/dist/signers/solana-api-key.d.ts +1 -1
  223. package/dist/signers/solana-external-wallet.cjs +1 -1
  224. package/dist/signers/solana-external-wallet.d.cts +1 -1
  225. package/dist/signers/solana-external-wallet.d.ts +1 -1
  226. package/dist/signers/solana-external-wallet.js +1 -1
  227. package/dist/signers/stellar-external-wallet.d.cts +1 -1
  228. package/dist/signers/stellar-external-wallet.d.ts +1 -1
  229. package/dist/signers/types.d.cts +1 -1
  230. package/dist/signers/types.d.ts +1 -1
  231. package/dist/{types-B4kzDRWb.d.cts → types-BrPpsHHA.d.cts} +30 -6
  232. package/dist/{types-Bxb54lGe.d.ts → types-D0tKSMr1.d.ts} +30 -6
  233. package/dist/utils/constants.cjs +1 -1
  234. package/dist/utils/constants.js +1 -1
  235. package/dist/utils/device-signers/IframeDeviceSignerKeyStorage.cjs +1 -1
  236. package/dist/utils/device-signers/IframeDeviceSignerKeyStorage.js +1 -1
  237. package/dist/utils/device-signers/createDeviceSigner.d.cts +1 -1
  238. package/dist/utils/device-signers/createDeviceSigner.d.ts +1 -1
  239. package/dist/utils/device-signers/index.cjs +1 -1
  240. package/dist/utils/device-signers/index.d.cts +1 -1
  241. package/dist/utils/device-signers/index.d.ts +1 -1
  242. package/dist/utils/device-signers/index.js +1 -1
  243. package/dist/utils/errors.cjs +1 -1
  244. package/dist/utils/errors.d.cts +4 -2
  245. package/dist/utils/errors.d.ts +4 -2
  246. package/dist/utils/errors.js +1 -1
  247. package/dist/utils/locators.cjs +1 -1
  248. package/dist/utils/locators.d.cts +1 -1
  249. package/dist/utils/locators.d.ts +1 -1
  250. package/dist/utils/locators.js +1 -1
  251. package/dist/utils/recovery.cjs +1 -1
  252. package/dist/utils/recovery.d.cts +1 -1
  253. package/dist/utils/recovery.d.ts +1 -1
  254. package/dist/utils/recovery.js +1 -1
  255. package/dist/utils/signer-locator.cjs +1 -1
  256. package/dist/utils/signer-locator.d.cts +1 -1
  257. package/dist/utils/signer-locator.d.ts +1 -1
  258. package/dist/utils/signer-locator.js +1 -1
  259. package/dist/utils/signer-mapping.d.cts +1 -1
  260. package/dist/utils/signer-mapping.d.ts +1 -1
  261. package/dist/utils/signer-validation.cjs +1 -1
  262. package/dist/utils/signer-validation.js +1 -1
  263. package/dist/wallets/__tests__/test-helpers.cjs +1 -1
  264. package/dist/wallets/__tests__/test-helpers.d.cts +3 -1
  265. package/dist/wallets/__tests__/test-helpers.d.ts +3 -1
  266. package/dist/wallets/__tests__/test-helpers.js +1 -1
  267. package/dist/wallets/evm.cjs +1 -1
  268. package/dist/wallets/evm.d.cts +1 -1
  269. package/dist/wallets/evm.d.ts +1 -1
  270. package/dist/wallets/evm.js +1 -1
  271. package/dist/wallets/services/balance-formatter.cjs +1 -1
  272. package/dist/wallets/services/balance-formatter.d.cts +1 -1
  273. package/dist/wallets/services/balance-formatter.d.ts +1 -1
  274. package/dist/wallets/services/balance-formatter.js +1 -1
  275. package/dist/wallets/services/device-recovery-service.cjs +1 -1
  276. package/dist/wallets/services/device-recovery-service.d.cts +1 -1
  277. package/dist/wallets/services/device-recovery-service.d.ts +1 -1
  278. package/dist/wallets/services/device-recovery-service.js +1 -1
  279. package/dist/wallets/services/operation-poller.cjs +1 -1
  280. package/dist/wallets/services/operation-poller.d.cts +1 -1
  281. package/dist/wallets/services/operation-poller.d.ts +1 -1
  282. package/dist/wallets/services/operation-poller.js +1 -1
  283. package/dist/wallets/services/signer-manager.cjs +1 -1
  284. package/dist/wallets/services/signer-manager.d.cts +19 -4
  285. package/dist/wallets/services/signer-manager.d.ts +19 -4
  286. package/dist/wallets/services/signer-manager.js +1 -1
  287. package/dist/wallets/solana.cjs +1 -1
  288. package/dist/wallets/solana.d.cts +1 -1
  289. package/dist/wallets/solana.d.ts +1 -1
  290. package/dist/wallets/solana.js +1 -1
  291. package/dist/wallets/stellar.cjs +1 -1
  292. package/dist/wallets/stellar.d.cts +1 -1
  293. package/dist/wallets/stellar.d.ts +1 -1
  294. package/dist/wallets/stellar.js +1 -1
  295. package/dist/wallets/types.d.cts +1 -1
  296. package/dist/wallets/types.d.ts +1 -1
  297. package/dist/wallets/wallet-factory.cjs +1 -1
  298. package/dist/wallets/wallet-factory.d.cts +1 -1
  299. package/dist/wallets/wallet-factory.d.ts +1 -1
  300. package/dist/wallets/wallet-factory.js +1 -1
  301. package/dist/wallets/wallet.cjs +1 -1
  302. package/dist/wallets/wallet.d.cts +46 -4
  303. package/dist/wallets/wallet.d.ts +46 -4
  304. package/dist/wallets/wallet.js +1 -1
  305. package/package.json +5 -5
  306. package/dist/chunk-2QCYHRPX.cjs +0 -1
  307. package/dist/chunk-3NAV25KH.js +0 -1
  308. package/dist/chunk-4JR5AF3R.cjs +0 -1
  309. package/dist/chunk-5X66U2JL.cjs +0 -1
  310. package/dist/chunk-6BNGRRNH.cjs +0 -1
  311. package/dist/chunk-7ER4XMKQ.js +0 -1
  312. package/dist/chunk-7SRQ77HY.cjs +0 -1
  313. package/dist/chunk-A3NUC7CS.js +0 -1
  314. package/dist/chunk-AA2XAWEU.cjs +0 -1
  315. package/dist/chunk-AF6NBGQT.js +0 -1
  316. package/dist/chunk-AXFHMPWT.cjs +0 -1
  317. package/dist/chunk-BK4RGDMJ.cjs +0 -1
  318. package/dist/chunk-BZYYVTXK.js +0 -1
  319. package/dist/chunk-C2LINO2L.js +0 -1
  320. package/dist/chunk-JGLNAY5C.js +0 -1
  321. package/dist/chunk-K4KSI3GM.js +0 -1
  322. package/dist/chunk-KOHPRJDP.js +0 -1
  323. package/dist/chunk-L7DGQX3V.js +0 -1
  324. package/dist/chunk-MDAPK5FG.js +0 -1
  325. package/dist/chunk-NUCKXAQL.js +0 -1
  326. package/dist/chunk-QV4LLMZM.js +0 -1
  327. package/dist/chunk-TA5VIPMH.cjs +0 -1
  328. package/dist/chunk-TWYVUVLB.js +0 -1
  329. package/dist/chunk-UY7L4D4M.cjs +0 -1
  330. package/dist/chunk-VS6I4S7X.cjs +0 -1
  331. package/dist/chunk-WIKKXJH7.cjs +0 -1
  332. package/dist/chunk-YKRLB374.js +0 -1
  333. package/dist/chunk-ZATY4PKV.cjs +0 -1
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _commonsdkbase = require('@crossmint/common-sdk-base');var u=class extends _commonsdkbase.CrossmintSDKError{constructor(t,r){super(t,_commonsdkbase.WalletErrorCode.API_KEY_INVALID,r)}},x= exports.b =class extends _commonsdkbase.CrossmintSDKError{constructor(t,r){super(t,_commonsdkbase.WalletErrorCode.ENVIRONMENT_INVALID,r)}},A= exports.c =class extends _commonsdkbase.CrossmintSDKError{constructor(t,r){super(t,_commonsdkbase.WalletErrorCode.WALLET_CREATION_FAILED,r)}},g= exports.d =class extends _commonsdkbase.CrossmintSDKError{constructor(t,r){super(t,_commonsdkbase.WalletErrorCode.WALLET_TYPE_INVALID,r)}},_= exports.e =class extends _commonsdkbase.CrossmintSDKError{constructor(t,r){super(t,_commonsdkbase.WalletErrorCode.WALLET_NOT_AVAILABLE,r)}},d= exports.f =class extends _commonsdkbase.CrossmintSDKError{constructor(t,r){super(t,_commonsdkbase.WalletErrorCode.WALLET_NOT_AVAILABLE,r)}},R= exports.g =class extends _commonsdkbase.CrossmintSDKError{constructor(t,r){super(t,_commonsdkbase.WalletErrorCode.WALLET_CREATION_FAILED,r)}},l= exports.h =class extends _commonsdkbase.CrossmintSDKError{constructor(t,r){super(t,_commonsdkbase.WalletErrorCode.WALLET_TYPE_INVALID,r)}},a= exports.i =class extends _commonsdkbase.CrossmintSDKError{constructor(t,r){super(t,_commonsdkbase.WalletErrorCode.SIGNER_INVALID,r)}},T= exports.j =class extends _commonsdkbase.CrossmintSDKError{constructor(t,r){super(t,_commonsdkbase.WalletErrorCode.SIGNER_INVALID,r)}},D= exports.k =class extends _commonsdkbase.CrossmintSDKError{constructor(t,r){super(t,_commonsdkbase.WalletErrorCode.SIGNER_INVALID,r)}},tr= exports.l ="DEVICE_SIGNER_NOT_SUPPORTED",L= exports.m =class extends _commonsdkbase.CrossmintSDKError{constructor(t,r){super(t,_commonsdkbase.WalletErrorCode.SIGNER_INVALID,r)}},S= exports.n =class extends _commonsdkbase.CrossmintSDKError{constructor(t,r){super(t,_commonsdkbase.WalletErrorCode.SIGNER_INVALID,r)}},O= exports.o =class extends _commonsdkbase.CrossmintSDKError{constructor(t,r){super(t,_commonsdkbase.WalletErrorCode.SIGNER_INVALID,r)}},c= exports.p =class extends _commonsdkbase.CrossmintSDKError{constructor(t,r){super(t,_commonsdkbase.WalletErrorCode.SIGNER_INVALID,r)}},i= exports.q =class extends _commonsdkbase.CrossmintSDKError{constructor(t,r){super(t,_commonsdkbase.WalletErrorCode.SIGNER_INVALID,r)}},I= exports.r =class extends _commonsdkbase.CrossmintSDKError{constructor(t,r){super(t,_commonsdkbase.WalletErrorCode.SIGNER_INVALID,r)}},o= exports.s =class extends _commonsdkbase.CrossmintSDKError{constructor(t,r){super(t,_commonsdkbase.WalletErrorCode.SIGNER_INVALID,r)}},h= exports.t =class extends o{},E= exports.u =class extends _commonsdkbase.CrossmintSDKError{constructor(t,r){super(t,_commonsdkbase.WalletErrorCode.SIGNER_INVALID,r)}},N= exports.v =class extends _commonsdkbase.CrossmintSDKError{constructor(t,r){super(t,_commonsdkbase.WalletErrorCode.SIGNER_INVALID,r)}},p= exports.w =class extends _commonsdkbase.CrossmintSDKError{constructor(t,r){super(t,_commonsdkbase.WalletErrorCode.SIGNER_INVALID,r)}},w= exports.x =class extends _commonsdkbase.CrossmintSDKError{constructor(t,r){super(t,_commonsdkbase.WalletErrorCode.ENVIRONMENT_INVALID,r)}},C= exports.y =class extends _commonsdkbase.CrossmintSDKError{constructor(t,r){super(t,_commonsdkbase.WalletErrorCode.MESSAGE_INVALID,r)}},G= exports.z =class extends _commonsdkbase.CrossmintSDKError{constructor(t,r){super(t,_commonsdkbase.WalletErrorCode.MESSAGE_INVALID,r)}},V= exports.A =class extends _commonsdkbase.CrossmintSDKError{constructor(t,r){super(t,_commonsdkbase.WalletErrorCode.SIGNING_FAILED,r)}},W= exports.B =class extends _commonsdkbase.CrossmintSDKError{constructor(t,r){super(t,_commonsdkbase.WalletErrorCode.SIGNING_FAILED,r)}},y= exports.C =class extends _commonsdkbase.CrossmintSDKError{constructor(t,r){super(t,_commonsdkbase.WalletErrorCode.SIGNING_FAILED,r)}},J= exports.D =class extends _commonsdkbase.CrossmintSDKError{constructor(t,r){super(t,_commonsdkbase.WalletErrorCode.NO_SIGNATURE,r)}},f= exports.E =class extends _commonsdkbase.CrossmintSDKError{constructor(t,r){super(t,_commonsdkbase.WalletErrorCode.NO_SIGNATURE,r)}},P= exports.F =class extends _commonsdkbase.CrossmintSDKError{constructor(t,r){super(t,_commonsdkbase.WalletErrorCode.SIGNING_FAILED,r)}},F= exports.G =class extends _commonsdkbase.CrossmintSDKError{constructor(t,r){super(t,_commonsdkbase.WalletErrorCode.SIGNING_FAILED,r)}},v= exports.H =class extends _commonsdkbase.CrossmintSDKError{constructor(t,r){super(t,_commonsdkbase.WalletErrorCode.NO_TRANSACTION,r)}},M= exports.I =class extends _commonsdkbase.CrossmintSDKError{constructor(t,r){super(t,_commonsdkbase.WalletErrorCode.NO_TRANSACTION,r)}},U= exports.J =class extends _commonsdkbase.CrossmintSDKError{constructor(t,r){super(t,_commonsdkbase.WalletErrorCode.NO_TRANSACTION,r)}},Y= exports.K =class extends _commonsdkbase.CrossmintSDKError{constructor(t,r){super(t,_commonsdkbase.WalletErrorCode.TRANSACTION_FAILED,r)}},b= exports.L =class extends _commonsdkbase.CrossmintSDKError{constructor(t,r){super(t,_commonsdkbase.WalletErrorCode.TRANSACTION_FAILED,r)}},m= exports.M =class extends _commonsdkbase.CrossmintSDKError{constructor(t,r){super(t,_commonsdkbase.WalletErrorCode.TRANSACTION_FAILED,r)}},B= exports.N =class extends _commonsdkbase.CrossmintSDKError{constructor(t,r){super(t,_commonsdkbase.WalletErrorCode.TRANSACTION_FAILED,r)}},z= exports.O =class extends _commonsdkbase.CrossmintSDKError{constructor(t,r){super(t,_commonsdkbase.WalletErrorCode.TRANSACTION_FAILED,r)}},K= exports.P =class extends _commonsdkbase.CrossmintSDKError{constructor(t,r){super(t,_commonsdkbase.WalletErrorCode.TRANSACTION_FAILED,r)}},k= exports.Q =class extends _commonsdkbase.CrossmintSDKError{constructor(t,r){super(t,_commonsdkbase.WalletErrorCode.RECIPIENT_ADDRESS_INVALID,r)}};function H(s){return typeof s=="object"&&s!=null}function sr(s){var r;if(!H(s)||s.code==null)return;let t=JSON.stringify(s);switch(s.code){case"ERROR_JWT_EXPIRED":throw new (0, _commonsdkbase.JWTExpiredError)(s.expiredAt,t);case"ERROR_JWT_INVALID":throw new (0, _commonsdkbase.JWTInvalidError)(t);case"ERROR_JWT_DECRYPTION":throw new (0, _commonsdkbase.JWTDecryptionError)(t);case"ERROR_JWT_IDENTIFIER_ERROR":throw new (0, _commonsdkbase.JWTIdentifierError)(s.identifierKey,t);case"ERROR_JWT_AUDIENCE_MISMATCH":throw new (0, _commonsdkbase.NotAuthorizedError)((r=s.message)!=null?r:"JWT audience mismatch",t)}}function er(s){if(!H(s)||s.code==null)return;let t=JSON.stringify(s),r=s.message;switch(s.code){case"SIGNER_LIMIT_EXCEEDED":throw new c(r!=null?r:"The wallet exceeds the maximum number of recovery signers",t);case"RECOVERY_DUPLICATE_SIGNER":throw new i(r!=null?r:"The recovery list contains the same signer more than once",t);case"RECOVERY_SIGNER_CONFLICT":throw new I(r!=null?r:"A recovery signer cannot also be registered as an operational signer",t);case"SIGNER_REQUIRED":throw new o(r!=null?r:"This wallet has multiple recovery signers, so the signer to authorize with must be specified explicitly",t);case"RECOVERY_NOT_SUPPORTED_ON_CHAIN":throw new E(r!=null?r:"Multiple recovery signers are not supported on this chain yet",t);case"NOT_SUPPORTED_ON_API_VERSION":throw new N(r!=null?r:"Multiple recovery signers are not supported on this API version",t);case"RECOVERY_ADMIN_SIGNER_CONFLICT":throw new p(r!=null?r:"Only one of `adminSigner` and `recovery` can be provided",t)}}exports.a = u; exports.b = x; exports.c = A; exports.d = g; exports.e = _; exports.f = d; exports.g = R; exports.h = l; exports.i = a; exports.j = T; exports.k = D; exports.l = tr; exports.m = L; exports.n = S; exports.o = O; exports.p = c; exports.q = i; exports.r = I; exports.s = o; exports.t = h; exports.u = E; exports.v = N; exports.w = p; exports.x = w; exports.y = C; exports.z = G; exports.A = V; exports.B = W; exports.C = y; exports.D = J; exports.E = f; exports.F = P; exports.G = F; exports.H = v; exports.I = M; exports.J = U; exports.K = Y; exports.L = b; exports.M = m; exports.N = B; exports.O = z; exports.P = K; exports.Q = k; exports.R = sr; exports.S = er; exports.T = _commonsdkbase.NotAuthorizedError; exports.U = _commonsdkbase.JWTExpiredError; exports.V = _commonsdkbase.JWTInvalidError; exports.W = _commonsdkbase.JWTDecryptionError; exports.X = _commonsdkbase.JWTIdentifierError;
@@ -0,0 +1 @@
1
+ import{a as W,b as I}from"./chunk-YOF3WB3D.js";import{a as N}from"./chunk-C5LIXILN.js";import{a as L}from"./chunk-5LNDUSMZ.js";import{b as w}from"./chunk-RV3Q5EIA.js";import{b,c as E}from"./chunk-TSJUK3ED.js";import{b as u,c as x}from"./chunk-PWYCEHYZ.js";import{f as k}from"./chunk-PSIZCLMC.js";import{S as K,e as $,g as h,l as M,o as P,u as q}from"./chunk-4I3EXM4B.js";import{a as C}from"./chunk-2YLAHC7J.js";import{a as f,b as S,c as F,h as y}from"./chunk-NU7VF7MC.js";import{WithLoggerContext as O}from"@crossmint/common-sdk-base";import{WebAuthnP256 as _}from"ox";var j="When 'signers' is provided to a method that may fetch an existing wallet, each specified signer must exist in that wallet's configuration.",R=class{constructor(e){this.apiClient=e}getWallet(e,r){return y(this,null,function*(){let n,i;if(typeof e=="string"){if(!this.apiClient.isServerSide)throw new h("getWallet with walletLocator is only available on the server side. Use getWallet(args) instead.");if(r==null)throw new h("Wallet configuration is required when using walletLocator: https://docs.crossmint.com/sdk-reference/wallets/type-aliases/WalletArgsFor");n=e,i=r}else{if(this.apiClient.isServerSide)throw new h("getWallet on server side requires a walletLocator parameter. Use getWallet(walletLocator, args) instead.");i=e,n=this.getWalletLocator(i)}let t=S(f({},i),{chain:k(i.chain,this.apiClient.environment)});C.info("walletFactory.getWallet.start");let a=yield this.apiClient.getWallet(n);if("error"in a)throw C.warn("walletFactory.getWallet.notFound",{error:a.error}),new $(JSON.stringify(a));return C.info("walletFactory.getWallet.success",{address:a.address}),yield this.createWalletInstance(a,t)})}createWallet(e){return y(this,null,function*(){var p,c,v,m,D,T;let r=S(f({},e),{chain:k(e.chain,this.apiClient.environment)}),n=W(r);if(n.length===0)throw new P(I(r)?"At least one recovery method is required":"A recovery method is required");if(yield(v=(c=(p=r.options)==null?void 0:p.callbacks)==null?void 0:c.onWalletCreationStart)==null?void 0:v.call(c),C.info("walletFactory.createWallet.start"),!this.apiClient.isServerSide&&r.owner!=null)throw C.error("walletFactory.createWallet.error",{error:"Owner field cannot be specified in client-side createWallet calls"}),new h("Owner field cannot be specified in client-side createWallet calls. Owner is determined from JWT authentication.");let i=(m=r.signers)!=null?m:[],t=((D=r.options)==null?void 0:D.deviceSignerKeyStorage)!=null&&!i.some(A=>A.type==="device"),a=t?[...i,{type:"device"}]:i,l=yield this.registerSigners(a,r.chain,(T=r.options)==null?void 0:T.deviceSignerKeyStorage),s=this.validatedRecoverySignerList(n,r.chain),o=[];for(let A of s)o.push(yield this.resolveRecoverySigner(A,r.chain));let d=this.buildRecoveryRequestConfig(r,o),g=yield this.createSmartWallet(r,d,l,t);if("error"in g)throw C.error("walletFactory.createWallet.error",{error:g.error}),K(g),new h(JSON.stringify(g));return C.info("walletFactory.createWallet.success",{address:g.address}),yield this.createWalletInstance(g,r)})}createSmartWallet(e,r,n,i){return y(this,null,function*(){let t=o=>{var d,g;return{type:"smart",chainType:this.getChainType(e.chain),config:f(f(f({},r),e.plugins?{plugins:e.plugins}:{}),o!=null?{delegatedSigners:o}:{}),owner:(d=e.owner)!=null?d:void 0,alias:(g=e.alias)!=null?g:void 0}},a=yield this.apiClient.createWallet(t(n));if(!(i&&"error"in a&&a.code===M))return a;C.info("walletFactory.createWallet.deviceSignerUnsupported.retryWithoutDeviceSigner",{chain:e.chain});let s=n.filter(o=>!this.isBuiltDeviceSigner(o));return yield this.apiClient.createWallet(t(s))})}buildRecoveryRequestConfig(e,r){return I(e)&&(e.chain==="solana"||e.chain==="stellar")?{recoveryMethods:r}:{adminSigner:r[0]}}validatedRecoverySignerList(e,r){if(e.length===0)throw new P("At least one recovery method is required");if(e.length>1&&r!=="solana"&&r!=="stellar")throw new q(`Multiple recovery methods are not supported on ${r} yet. Pass a single recovery method.`);return e}resolveRecoverySigner(e,r){return y(this,null,function*(){if(e.type==="passkey"&&e.id==null)return yield this.createPasskeySigner(e);if(e.type==="server"){let{derivedAddress:n}=b(e,r,this.apiClient.projectId,this.apiClient.environment);return{type:"server",address:n}}return e})}isBuiltDeviceSigner(e){let r=e.signer;return typeof r=="object"&&r!=null&&r.type==="device"}mergePhoneChannel(e,r){return e.type!=="phone"||(r==null?void 0:r.type)!=="phone"||r.channel==null?e:S(f({},e),{channel:r.channel})}createWalletInstance(e,r){return y(this,null,function*(){var p;this.validateExistingWalletConfig(e,r);let n=r,i=e.config,t=(p=i.recoveryMethods)!=null?p:[i.adminSigner],a=this.mergeRecoverySigners(t,W(n),r.chain),l=i.delegatedSigners,s=l;if(s!=null&&s.length===1&&(s[0].type==="server"||s[0].type==="external-wallet"))s=n.signers;else if(s!=null){let c=n.signers;s=s.map(v=>this.mergePhoneChannel(v,c==null?void 0:c.find(m=>m.type==="phone"&&v.type==="phone"&&w(m)===v.locator)))}let o=t.filter(c=>c.type==="server"&&"address"in c&&!("secret"in c)).map(c=>c.address),d=(l!=null?l:[]).filter(c=>c.type==="server"&&"address"in c&&!("secret"in c)).map(c=>c.address),g=new N({chain:r.chain,address:e.address,owner:e.owner,options:r.options,alias:r.alias,recovery:a,apiRecoveryServerSignerAddresses:o,apiDelegatedServerSignerAddresses:d,signers:s!=null?s:[]},this.apiClient);return yield g.waitForInit(),g})}mergeRecoverySigners(e,r,n){let i=[...r],t=new Map,a=[(l,s)=>this.matchesRecoverySigner(l,s,n),(l,s)=>l.type===s.type];for(let l of a)e.forEach((s,o)=>{if(t.has(o))return;let d=i.findIndex(g=>l(g,s));d!==-1&&t.set(o,i.splice(d,1)[0])});return e.map((l,s)=>{let o=t.get(s);return o==null?l:o.type==="server"||o.type==="external-wallet"?o:this.mergePhoneChannel(l,o)})}matchesRecoverySigner(e,r,n){if(e.type!==r.type)return!1;if(e.type==="email"&&"email"in r)return u(e.email)===u(r.email);if(e.type==="phone"&&"phone"in r)return e.phone===r.phone;if(e.type==="external-wallet"&&"address"in r)return e.address===r.address;if(e.type==="server"&&"address"in r){if(!("secret"in e))return e.address===r.address;let{primary:i,legacy:t}=E(e,n,this.apiClient.projectId,this.apiClient.environment);return i.derivedAddress===r.address||(t==null?void 0:t.derivedAddress)===r.address}return!0}getWalletLocator(e){return`me:${this.getChainType(e.chain)}:smart`+(e.alias!=null?`:alias:${e.alias}`:"")}createPasskeySigner(e){return y(this,null,function*(){var i;if(e.type!=="passkey")throw new Error("Signer is not a passkey");let r=(i=e.name)!=null?i:`Crossmint Wallet ${Date.now()}`,n=e.onCreatePasskey?yield e.onCreatePasskey(r):yield _.createCredential({name:r});return{type:"passkey",id:n.id,name:r,publicKey:{x:n.publicKey.x.toString(),y:n.publicKey.y.toString()}}})}validateExistingWalletConfig(e,r){var t;if(r.owner!=null&&e.owner!=null&&u(r.owner)!==u(e.owner))throw new h("Wallet owner does not match existing wallet's linked user");if(r.chain==="solana"&&e.chainType!=="solana"||r.chain!=="solana"&&e.chainType==="solana"||r.chain==="stellar"&&e.chainType!=="stellar"||r.chain!=="stellar"&&e.chainType==="stellar")throw new h(`Wallet chain does not match existing wallet's chain. You must use chain: ${e.chainType}.`);if(e.type!=="smart")return;let n=r,i=W(n);if(n.recovery!=null||n.recoveryMethods!=null||n.signers!=null){let a=e.config,l=(t=a==null?void 0:a.recoveryMethods)!=null?t:(a==null?void 0:a.adminSigner)!=null?[a.adminSigner]:[],s=[...l];for(let d of i){if(l.length===0)break;let g=s.findIndex(c=>this.matchesRecoverySigner(d,c,r.chain)),p=g===-1?s.find(c=>c.type===d.type):s[g];if(p==null)throw new h("The wallet recovery signer type does not match the existing wallet's recovery signer type");x(d,p),g!==-1&&s.splice(g,1)}let o=n.signers;o!=null&&this.validateSigners(e,o,r.chain)}}validateSigners(e,r,n){let i=e.config,t=i==null?void 0:i.delegatedSigners;if(r.length!==0){if(t==null||t.length===0)throw new h(`${r.length} signer(s) specified, but wallet "${e.address}" has no signers. ${j}`);for(let a of r){let l=t.find(s=>{if(this.isMatchingPasskeySigner(a,s,i)||s.type==="device"&&a.type==="device")return!0;if(a.type==="server"){let{primary:o,legacy:d}=E(a,n,this.apiClient.projectId,this.apiClient.environment);return s.locator===`server:${o.derivedAddress}`||d!=null&&s.locator===`server:${d.derivedAddress}`}return s.locator===w(a)});if(l==null){let s=t.map(o=>o.locator).join(", ");throw new h(`Signer '${a.type}' does not exist in wallet "${e.address}". Available signers: ${s}. ${j}`)}x(a,l)}}}isMatchingPasskeySigner(e,r,n){var t,a;let i=((a=(t=n.delegatedSigners)==null?void 0:t.filter(l=>l.type==="passkey").length)!=null?a:0)+(n.adminSigner.type==="passkey"?1:0);if(e.type==="passkey"){if(e.id==null&&i===1)return r.type==="passkey";if(e.id==null&&i>1)throw new h("When creating a wallet with multiple passkeys, you must provide the passkey ID for each passkey.")}return!1}registerSigners(e,r,n){return y(this,null,function*(){var i;return yield Promise.all((i=e==null?void 0:e.map(t=>y(this,null,function*(){if(t.type==="passkey")return t.id==null?{signer:yield this.createPasskeySigner(t)}:{signer:t};if(t.type==="device"){if(t.publicKey!=null)return{signer:{type:"device",publicKey:t.publicKey,name:t.name}};if(t.locator!=null)return{signer:t.locator};if(n==null)throw new h("Device signer key storage is required for device signers");let a=yield L(n);return{signer:{type:"device",publicKey:a.publicKey,name:a.name}}}if(t.type==="server"&&r!=null){let{derivedAddress:a}=b(t,r,this.apiClient.projectId,this.apiClient.environment);return{signer:`server:${a}`}}return{signer:w(t)}})))!=null?i:[])})}getChainType(e){return e==="solana"?"solana":e==="stellar"?"stellar":"evm"}};F([O({logger:C,methodName:"walletFactory.getWallet",buildContext(e,r){if(typeof r[0]=="string"){let i=r[1];return{walletLocator:r[0],chain:i==null?void 0:i.chain}}let n=r[0];return{chain:n==null?void 0:n.chain}}})],R.prototype,"getWallet",1),F([O({logger:C,methodName:"walletFactory.createWallet",buildContext(e,r){return{chain:r[0].chain}}})],R.prototype,"createWallet",1);export{R as a};
@@ -1 +1 @@
1
- import{A as M,D as m,F as b,I as C,J as x,K as A,L as y,M as k,Q as w}from"./chunk-KOHPRJDP.js";import{a as E}from"./chunk-INUEMQPG.js";import{d as S}from"./chunk-MDAPK5FG.js";import{h as l}from"./chunk-NU7VF7MC.js";function W(i,o,a,r){return l(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:{};E.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 x("Transaction confirmation timeout");let s=Date.now();if(t=yield i.getTransaction(o,a),t.error)throw w(t),new C(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 A(`Transaction sending failed: ${JSON.stringify(t)}`);if(t.status==="awaiting-approval")throw new y("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 k("Transaction hash not found on transaction response");return{hash:g,explorerLink:(d=t.onChain.explorerLink)!=null?d:"",transactionId:t.id}})}function B(i,o,a,r){return l(this,null,function*(){let{timeoutMs:e=6e4}=r!=null?r:{},u=Date.now(),n=null;do{if(Date.now()-u>e)throw new b("Signature confirmation timeout");if(yield new Promise(f=>setTimeout(f,S)),n=yield i.getSignature(o,a),"error"in n)throw w(n),new m(JSON.stringify(n))}while(n===null||n.status==="pending");if(n.status==="failed")throw new M("Signature signing failed");if(!n.outputSignature)throw new m("Signature not available");return{signature:n.outputSignature,signatureId:a}})}function D(i){return l(this,null,function*(){return new Promise(o=>setTimeout(o,i))})}export{W as a,B as b};
1
+ import{B as M,E as m,G as b,J as C,K as x,L as A,M as y,N as k,R as w}from"./chunk-4I3EXM4B.js";import{a as E}from"./chunk-2YLAHC7J.js";import{d as S}from"./chunk-QYBC7GTA.js";import{h as l}from"./chunk-NU7VF7MC.js";function W(i,o,a,r){return l(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:{};E.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 x("Transaction confirmation timeout");let s=Date.now();if(t=yield i.getTransaction(o,a),t.error)throw w(t),new C(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 A(`Transaction sending failed: ${JSON.stringify(t)}`);if(t.status==="awaiting-approval")throw new y("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 k("Transaction hash not found on transaction response");return{hash:g,explorerLink:(d=t.onChain.explorerLink)!=null?d:"",transactionId:t.id}})}function B(i,o,a,r){return l(this,null,function*(){let{timeoutMs:e=6e4}=r!=null?r:{},u=Date.now(),n=null;do{if(Date.now()-u>e)throw new b("Signature confirmation timeout");if(yield new Promise(f=>setTimeout(f,S)),n=yield i.getSignature(o,a),"error"in n)throw w(n),new m(JSON.stringify(n))}while(n===null||n.status==="pending");if(n.status==="failed")throw new M("Signature signing failed");if(!n.outputSignature)throw new m("Signature not available");return{signature:n.outputSignature,signatureId:a}})}function D(i){return l(this,null,function*(){return new Promise(o=>setTimeout(o,i))})}export{W as a,B as b};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkVS6I4S7Xcjs = require('./chunk-VS6I4S7X.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');var _ox = require('ox');var u=37,h=32,f=4;function A(i){let t=_ox.Hex.toBytes(i);return t.length<u?!1:(t[h]&f)!==0}var a=class{constructor(t){this.config=t;this.type="passkey";this.id=t.id}locator(){return this.config.locator}signMessage(t){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){if(this.config.onSignWithPasskey){let r=yield this.config.onSignWithPasskey(t);if(!A(r.metadata.authenticatorData))throw new (0, _chunkVS6I4S7Xcjs.A)('The passkey assertion was created without user verification, and the on-chain verifier requires it. Request the assertion with `userVerification: "required"` so the authenticator prompts for biometrics or a PIN.');return r}let{signature:s,metadata:o}=yield _ox.WebAuthnP256.sign({credentialId:this.id,challenge:t});return{signature:{r:`0x${s.r.toString(16)}`,s:`0x${s.s.toString(16)}`},metadata:o}})}signTransaction(t){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return yield this.signMessage(t)})}};exports.a = a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkD2S37DJ5cjs = require('./chunk-D2S37DJ5.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');var _ox = require('ox');var u=37,h=32,f=4;function A(i){let t=_ox.Hex.toBytes(i);return t.length<u?!1:(t[h]&f)!==0}var a=class{constructor(t){this.config=t;this.type="passkey";this.id=t.id}locator(){return this.config.locator}signMessage(t){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){if(this.config.onSignWithPasskey){let r=yield this.config.onSignWithPasskey(t);if(!A(r.metadata.authenticatorData))throw new (0, _chunkD2S37DJ5cjs.B)('The passkey assertion was created without user verification, and the on-chain verifier requires it. Request the assertion with `userVerification: "required"` so the authenticator prompts for biometrics or a PIN.');return r}let{signature:s,metadata:o}=yield _ox.WebAuthnP256.sign({credentialId:this.id,challenge:t});return{signature:{r:`0x${s.r.toString(16)}`,s:`0x${s.s.toString(16)}`},metadata:o}})}signTransaction(t){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return yield this.signMessage(t)})}};exports.a = a;
@@ -1 +1 @@
1
- import{a as o}from"./chunk-2YLRFJ66.js";import{N as t}from"./chunk-KOHPRJDP.js";import{h as i}from"./chunk-NU7VF7MC.js";import{PublicKey as h,VersionedTransaction as y}from"@solana/web3.js";import l from"bs58";var g=class extends o{constructor(n){super(n),this.onSign=n.onSign,this.onSignBytes=n.onSignBytes}signMessage(n){return i(this,null,function*(){if(this.onSignBytes==null)throw new Error("[SolanaExternalWalletSigner] No onSignBytes callback provided. Pass an onSignBytes callback when configuring the external wallet signer.");let e=yield this.onSignBytes(n);if(e==null)throw new t("[SolanaExternalWalletSigner] onSignBytes returned no signature");return{signature:e}})}signTransaction(n){return i(this,null,function*(){if(this.onSign==null)throw new Error("[SolanaExternalWalletSigner] No onSign callback provided. Pass an onSign callback when configuring the external wallet signer.");let e=l.decode(n),c=y.deserialize(e),a=yield this.onSign(c),d=new h(this._address),r=a.message.staticAccountKeys.findIndex(S=>S.equals(d));if(r===-1)throw new t("Wallet public key not found in transaction signers");let s=a.signatures[r];if(s==null)throw new t("No valid signature found in the transaction");let u=new Uint8Array(Object.values(s));return{signature:l.encode(u)}})}};export{g as a};
1
+ import{a as o}from"./chunk-2YLRFJ66.js";import{O as t}from"./chunk-4I3EXM4B.js";import{h as i}from"./chunk-NU7VF7MC.js";import{PublicKey as h,VersionedTransaction as y}from"@solana/web3.js";import l from"bs58";var g=class extends o{constructor(n){super(n),this.onSign=n.onSign,this.onSignBytes=n.onSignBytes}signMessage(n){return i(this,null,function*(){if(this.onSignBytes==null)throw new Error("[SolanaExternalWalletSigner] No onSignBytes callback provided. Pass an onSignBytes callback when configuring the external wallet signer.");let e=yield this.onSignBytes(n);if(e==null)throw new t("[SolanaExternalWalletSigner] onSignBytes returned no signature");return{signature:e}})}signTransaction(n){return i(this,null,function*(){if(this.onSign==null)throw new Error("[SolanaExternalWalletSigner] No onSign callback provided. Pass an onSign callback when configuring the external wallet signer.");let e=l.decode(n),c=y.deserialize(e),a=yield this.onSign(c),d=new h(this._address),r=a.message.staticAccountKeys.findIndex(S=>S.equals(d));if(r===-1)throw new t("Wallet public key not found in transaction signers");let s=a.signatures[r];if(s==null)throw new t("No valid signature found in the transaction");let u=new Uint8Array(Object.values(s));return{signature:l.encode(u)}})}};export{g as a};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkNWFQRNBNcjs = require('./chunk-NWFQRNBN.cjs');var _chunkUY7L4D4Mcjs = require('./chunk-UY7L4D4M.cjs');var _chunkGMU3ZYLScjs = require('./chunk-GMU3ZYLS.cjs');var _chunkCZC2MNVKcjs = require('./chunk-CZC2MNVK.cjs');var _chunkPHIW7FUJcjs = require('./chunk-PHIW7FUJ.cjs');var _chunkQ66YRLSWcjs = require('./chunk-Q66YRLSW.cjs');var _chunk5X66U2JLcjs = require('./chunk-5X66U2JL.cjs');var _chunkVS6I4S7Xcjs = require('./chunk-VS6I4S7X.cjs');var _chunkW3BYSI7Fcjs = require('./chunk-W3BYSI7F.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var _ox = require('ox');var j="When 'signers' is provided to a method that may fetch an existing wallet, each specified signer must exist in that wallet's configuration.",R= exports.a =class{constructor(e){this.apiClient=e}getWallet(e,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let n,i;if(typeof e=="string"){if(!this.apiClient.isServerSide)throw new (0, _chunkVS6I4S7Xcjs.g)("getWallet with walletLocator is only available on the server side. Use getWallet(args) instead.");if(r==null)throw new (0, _chunkVS6I4S7Xcjs.g)("Wallet configuration is required when using walletLocator: https://docs.crossmint.com/sdk-reference/wallets/type-aliases/WalletArgsFor");n=e,i=r}else{if(this.apiClient.isServerSide)throw new (0, _chunkVS6I4S7Xcjs.g)("getWallet on server side requires a walletLocator parameter. Use getWallet(walletLocator, args) instead.");i=e,n=this.getWalletLocator(i)}let t=_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {},i),{chain:_chunk5X66U2JLcjs.f.call(void 0, i.chain,this.apiClient.environment)});_chunkW3BYSI7Fcjs.a.info("walletFactory.getWallet.start");let a=yield this.apiClient.getWallet(n);if("error"in a)throw _chunkW3BYSI7Fcjs.a.warn("walletFactory.getWallet.notFound",{error:a.error}),new (0, _chunkVS6I4S7Xcjs.e)(JSON.stringify(a));return _chunkW3BYSI7Fcjs.a.info("walletFactory.getWallet.success",{address:a.address}),yield this.createWalletInstance(a,t)})}createWallet(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var p,c,v,m,D,T;let r=_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {},e),{chain:_chunk5X66U2JLcjs.f.call(void 0, e.chain,this.apiClient.environment)}),n=_chunkNWFQRNBNcjs.a.call(void 0, r);if(n.length===0)throw new (0, _chunkVS6I4S7Xcjs.o)(_chunkNWFQRNBNcjs.b.call(void 0, r)?"At least one recovery method is required":"A recovery method is required");if(yield(v=(c=(p=r.options)==null?void 0:p.callbacks)==null?void 0:c.onWalletCreationStart)==null?void 0:v.call(c),_chunkW3BYSI7Fcjs.a.info("walletFactory.createWallet.start"),!this.apiClient.isServerSide&&r.owner!=null)throw _chunkW3BYSI7Fcjs.a.error("walletFactory.createWallet.error",{error:"Owner field cannot be specified in client-side createWallet calls"}),new (0, _chunkVS6I4S7Xcjs.g)("Owner field cannot be specified in client-side createWallet calls. Owner is determined from JWT authentication.");let i=(m=r.signers)!=null?m:[],t=((D=r.options)==null?void 0:D.deviceSignerKeyStorage)!=null&&!i.some(A=>A.type==="device"),a=t?[...i,{type:"device"}]:i,l=yield this.registerSigners(a,r.chain,(T=r.options)==null?void 0:T.deviceSignerKeyStorage),s=this.validatedRecoverySignerList(n,r.chain),o=[];for(let A of s)o.push(yield this.resolveRecoverySigner(A,r.chain));let d=this.buildRecoveryRequestConfig(r,o),g=yield this.createSmartWallet(r,d,l,t);if("error"in g)throw _chunkW3BYSI7Fcjs.a.error("walletFactory.createWallet.error",{error:g.error}),_chunkVS6I4S7Xcjs.R.call(void 0, g),new (0, _chunkVS6I4S7Xcjs.g)(JSON.stringify(g));return _chunkW3BYSI7Fcjs.a.info("walletFactory.createWallet.success",{address:g.address}),yield this.createWalletInstance(g,r)})}createSmartWallet(e,r,n,i){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let t=o=>{var d,g;return{type:"smart",chainType:this.getChainType(e.chain),config:_chunkDSIFRRBScjs.a.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {},r),e.plugins?{plugins:e.plugins}:{}),o!=null?{delegatedSigners:o}:{}),owner:(d=e.owner)!=null?d:void 0,alias:(g=e.alias)!=null?g:void 0}},a=yield this.apiClient.createWallet(t(n));if(!(i&&"error"in a&&a.code===_chunkVS6I4S7Xcjs.l))return a;_chunkW3BYSI7Fcjs.a.info("walletFactory.createWallet.deviceSignerUnsupported.retryWithoutDeviceSigner",{chain:e.chain});let s=n.filter(o=>!this.isBuiltDeviceSigner(o));return yield this.apiClient.createWallet(t(s))})}buildRecoveryRequestConfig(e,r){return _chunkNWFQRNBNcjs.b.call(void 0, e)&&(e.chain==="solana"||e.chain==="stellar")?{recoveryMethods:r}:{adminSigner:r[0]}}validatedRecoverySignerList(e,r){if(e.length===0)throw new (0, _chunkVS6I4S7Xcjs.o)("At least one recovery method is required");if(e.length>1&&r!=="solana"&&r!=="stellar")throw new (0, _chunkVS6I4S7Xcjs.t)(`Multiple recovery methods are not supported on ${r} yet. Pass a single recovery method.`);return e}resolveRecoverySigner(e,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){if(e.type==="passkey"&&e.id==null)return yield this.createPasskeySigner(e);if(e.type==="server"){let{derivedAddress:n}=_chunkQ66YRLSWcjs.b.call(void 0, e,r,this.apiClient.projectId,this.apiClient.environment);return{type:"server",address:n}}return e})}isBuiltDeviceSigner(e){let r=e.signer;return typeof r=="object"&&r!=null&&r.type==="device"}mergePhoneChannel(e,r){return e.type!=="phone"||(r==null?void 0:r.type)!=="phone"||r.channel==null?e:_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {},e),{channel:r.channel})}createWalletInstance(e,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var p;this.validateExistingWalletConfig(e,r);let n=r,i=e.config,t=(p=i.recoveryMethods)!=null?p:[i.adminSigner],a=this.mergeRecoverySigners(t,_chunkNWFQRNBNcjs.a.call(void 0, n),r.chain),l=i.delegatedSigners,s=l;if(s!=null&&s.length===1&&(s[0].type==="server"||s[0].type==="external-wallet"))s=n.signers;else if(s!=null){let c=n.signers;s=s.map(v=>this.mergePhoneChannel(v,c==null?void 0:c.find(m=>m.type==="phone"&&v.type==="phone"&&_chunkCZC2MNVKcjs.b.call(void 0, m)===v.locator)))}let o=t.filter(c=>c.type==="server"&&"address"in c&&!("secret"in c)).map(c=>c.address),d=(l!=null?l:[]).filter(c=>c.type==="server"&&"address"in c&&!("secret"in c)).map(c=>c.address),g=new (0, _chunkUY7L4D4Mcjs.a)({chain:r.chain,address:e.address,owner:e.owner,options:r.options,alias:r.alias,recovery:a,apiRecoveryServerSignerAddresses:o,apiDelegatedServerSignerAddresses:d,signers:s!=null?s:[]},this.apiClient);return yield g.waitForInit(),g})}mergeRecoverySigners(e,r,n){let i=[...r],t=new Map,a=[(l,s)=>this.matchesRecoverySigner(l,s,n),(l,s)=>l.type===s.type];for(let l of a)e.forEach((s,o)=>{if(t.has(o))return;let d=i.findIndex(g=>l(g,s));d!==-1&&t.set(o,i.splice(d,1)[0])});return e.map((l,s)=>{let o=t.get(s);return o==null?l:o.type==="server"||o.type==="external-wallet"?o:this.mergePhoneChannel(l,o)})}matchesRecoverySigner(e,r,n){if(e.type!==r.type)return!1;if(e.type==="email"&&"email"in r)return _chunkPHIW7FUJcjs.b.call(void 0, e.email)===_chunkPHIW7FUJcjs.b.call(void 0, r.email);if(e.type==="phone"&&"phone"in r)return e.phone===r.phone;if(e.type==="external-wallet"&&"address"in r)return e.address===r.address;if(e.type==="server"&&"address"in r){if(!("secret"in e))return e.address===r.address;let{primary:i,legacy:t}=_chunkQ66YRLSWcjs.c.call(void 0, e,n,this.apiClient.projectId,this.apiClient.environment);return i.derivedAddress===r.address||(t==null?void 0:t.derivedAddress)===r.address}return!0}getWalletLocator(e){return`me:${this.getChainType(e.chain)}:smart`+(e.alias!=null?`:alias:${e.alias}`:"")}createPasskeySigner(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var i;if(e.type!=="passkey")throw new Error("Signer is not a passkey");let r=(i=e.name)!=null?i:`Crossmint Wallet ${Date.now()}`,n=e.onCreatePasskey?yield e.onCreatePasskey(r):yield _ox.WebAuthnP256.createCredential({name:r});return{type:"passkey",id:n.id,name:r,publicKey:{x:n.publicKey.x.toString(),y:n.publicKey.y.toString()}}})}validateExistingWalletConfig(e,r){var t;if(r.owner!=null&&e.owner!=null&&_chunkPHIW7FUJcjs.b.call(void 0, r.owner)!==_chunkPHIW7FUJcjs.b.call(void 0, e.owner))throw new (0, _chunkVS6I4S7Xcjs.g)("Wallet owner does not match existing wallet's linked user");if(r.chain==="solana"&&e.chainType!=="solana"||r.chain!=="solana"&&e.chainType==="solana"||r.chain==="stellar"&&e.chainType!=="stellar"||r.chain!=="stellar"&&e.chainType==="stellar")throw new (0, _chunkVS6I4S7Xcjs.g)(`Wallet chain does not match existing wallet's chain. You must use chain: ${e.chainType}.`);if(e.type!=="smart")return;let n=r,i=_chunkNWFQRNBNcjs.a.call(void 0, n);if(n.recovery!=null||n.recoveryMethods!=null||n.signers!=null){let a=e.config,l=(t=a==null?void 0:a.recoveryMethods)!=null?t:(a==null?void 0:a.adminSigner)!=null?[a.adminSigner]:[],s=[...l];for(let d of i){if(l.length===0)break;let g=s.findIndex(c=>this.matchesRecoverySigner(d,c,r.chain)),p=g===-1?s.find(c=>c.type===d.type):s[g];if(p==null)throw new (0, _chunkVS6I4S7Xcjs.g)("The wallet recovery signer type does not match the existing wallet's recovery signer type");_chunkPHIW7FUJcjs.c.call(void 0, d,p),g!==-1&&s.splice(g,1)}let o=n.signers;o!=null&&this.validateSigners(e,o,r.chain)}}validateSigners(e,r,n){let i=e.config,t=i==null?void 0:i.delegatedSigners;if(r.length!==0){if(t==null||t.length===0)throw new (0, _chunkVS6I4S7Xcjs.g)(`${r.length} signer(s) specified, but wallet "${e.address}" has no signers. ${j}`);for(let a of r){let l=t.find(s=>{if(this.isMatchingPasskeySigner(a,s,i)||s.type==="device"&&a.type==="device")return!0;if(a.type==="server"){let{primary:o,legacy:d}=_chunkQ66YRLSWcjs.c.call(void 0, a,n,this.apiClient.projectId,this.apiClient.environment);return s.locator===`server:${o.derivedAddress}`||d!=null&&s.locator===`server:${d.derivedAddress}`}return s.locator===_chunkCZC2MNVKcjs.b.call(void 0, a)});if(l==null){let s=t.map(o=>o.locator).join(", ");throw new (0, _chunkVS6I4S7Xcjs.g)(`Signer '${a.type}' does not exist in wallet "${e.address}". Available signers: ${s}. ${j}`)}_chunkPHIW7FUJcjs.c.call(void 0, a,l)}}}isMatchingPasskeySigner(e,r,n){var t,a;let i=((a=(t=n.delegatedSigners)==null?void 0:t.filter(l=>l.type==="passkey").length)!=null?a:0)+(n.adminSigner.type==="passkey"?1:0);if(e.type==="passkey"){if(e.id==null&&i===1)return r.type==="passkey";if(e.id==null&&i>1)throw new (0, _chunkVS6I4S7Xcjs.g)("When creating a wallet with multiple passkeys, you must provide the passkey ID for each passkey.")}return!1}registerSigners(e,r,n){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var i;return yield Promise.all((i=e==null?void 0:e.map(t=>_chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){if(t.type==="passkey")return t.id==null?{signer:yield this.createPasskeySigner(t)}:{signer:t};if(t.type==="device"){if(t.publicKey!=null)return{signer:{type:"device",publicKey:t.publicKey,name:t.name}};if(t.locator!=null)return{signer:t.locator};if(n==null)throw new (0, _chunkVS6I4S7Xcjs.g)("Device signer key storage is required for device signers");let a=yield _chunkGMU3ZYLScjs.a.call(void 0, n);return{signer:{type:"device",publicKey:a.publicKey,name:a.name}}}if(t.type==="server"&&r!=null){let{derivedAddress:a}=_chunkQ66YRLSWcjs.b.call(void 0, t,r,this.apiClient.projectId,this.apiClient.environment);return{signer:`server:${a}`}}return{signer:_chunkCZC2MNVKcjs.b.call(void 0, t)}})))!=null?i:[])})}getChainType(e){return e==="solana"?"solana":e==="stellar"?"stellar":"evm"}};_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkW3BYSI7Fcjs.a,methodName:"walletFactory.getWallet",buildContext(e,r){if(typeof r[0]=="string"){let i=r[1];return{walletLocator:r[0],chain:i==null?void 0:i.chain}}let n=r[0];return{chain:n==null?void 0:n.chain}}})],R.prototype,"getWallet",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkW3BYSI7Fcjs.a,methodName:"walletFactory.createWallet",buildContext(e,r){return{chain:r[0].chain}}})],R.prototype,"createWallet",1);exports.a = R;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk3FQB7LSTcjs = require('./chunk-3FQB7LST.cjs');var _chunkX2CTI7IKcjs = require('./chunk-X2CTI7IK.cjs');var _chunkGMU3ZYLScjs = require('./chunk-GMU3ZYLS.cjs');var _chunkWSDMIQNGcjs = require('./chunk-WSDMIQNG.cjs');var _chunkQ66YRLSWcjs = require('./chunk-Q66YRLSW.cjs');var _chunkHITDGEGWcjs = require('./chunk-HITDGEGW.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 _ox = require('ox');var j="When 'signers' is provided to a method that may fetch an existing wallet, each specified signer must exist in that wallet's configuration.",R= exports.a =class{constructor(e){this.apiClient=e}getWallet(e,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let n,i;if(typeof e=="string"){if(!this.apiClient.isServerSide)throw new (0, _chunkD2S37DJ5cjs.g)("getWallet with walletLocator is only available on the server side. Use getWallet(args) instead.");if(r==null)throw new (0, _chunkD2S37DJ5cjs.g)("Wallet configuration is required when using walletLocator: https://docs.crossmint.com/sdk-reference/wallets/type-aliases/WalletArgsFor");n=e,i=r}else{if(this.apiClient.isServerSide)throw new (0, _chunkD2S37DJ5cjs.g)("getWallet on server side requires a walletLocator parameter. Use getWallet(walletLocator, args) instead.");i=e,n=this.getWalletLocator(i)}let t=_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {},i),{chain:_chunkKQDPQXLLcjs.f.call(void 0, i.chain,this.apiClient.environment)});_chunk36GZTRZXcjs.a.info("walletFactory.getWallet.start");let a=yield this.apiClient.getWallet(n);if("error"in a)throw _chunk36GZTRZXcjs.a.warn("walletFactory.getWallet.notFound",{error:a.error}),new (0, _chunkD2S37DJ5cjs.e)(JSON.stringify(a));return _chunk36GZTRZXcjs.a.info("walletFactory.getWallet.success",{address:a.address}),yield this.createWalletInstance(a,t)})}createWallet(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var p,c,v,m,D,T;let r=_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {},e),{chain:_chunkKQDPQXLLcjs.f.call(void 0, e.chain,this.apiClient.environment)}),n=_chunk3FQB7LSTcjs.a.call(void 0, r);if(n.length===0)throw new (0, _chunkD2S37DJ5cjs.o)(_chunk3FQB7LSTcjs.b.call(void 0, r)?"At least one recovery method is required":"A recovery method is required");if(yield(v=(c=(p=r.options)==null?void 0:p.callbacks)==null?void 0:c.onWalletCreationStart)==null?void 0:v.call(c),_chunk36GZTRZXcjs.a.info("walletFactory.createWallet.start"),!this.apiClient.isServerSide&&r.owner!=null)throw _chunk36GZTRZXcjs.a.error("walletFactory.createWallet.error",{error:"Owner field cannot be specified in client-side createWallet calls"}),new (0, _chunkD2S37DJ5cjs.g)("Owner field cannot be specified in client-side createWallet calls. Owner is determined from JWT authentication.");let i=(m=r.signers)!=null?m:[],t=((D=r.options)==null?void 0:D.deviceSignerKeyStorage)!=null&&!i.some(A=>A.type==="device"),a=t?[...i,{type:"device"}]:i,l=yield this.registerSigners(a,r.chain,(T=r.options)==null?void 0:T.deviceSignerKeyStorage),s=this.validatedRecoverySignerList(n,r.chain),o=[];for(let A of s)o.push(yield this.resolveRecoverySigner(A,r.chain));let d=this.buildRecoveryRequestConfig(r,o),g=yield this.createSmartWallet(r,d,l,t);if("error"in g)throw _chunk36GZTRZXcjs.a.error("walletFactory.createWallet.error",{error:g.error}),_chunkD2S37DJ5cjs.S.call(void 0, g),new (0, _chunkD2S37DJ5cjs.g)(JSON.stringify(g));return _chunk36GZTRZXcjs.a.info("walletFactory.createWallet.success",{address:g.address}),yield this.createWalletInstance(g,r)})}createSmartWallet(e,r,n,i){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let t=o=>{var d,g;return{type:"smart",chainType:this.getChainType(e.chain),config:_chunkDSIFRRBScjs.a.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {},r),e.plugins?{plugins:e.plugins}:{}),o!=null?{delegatedSigners:o}:{}),owner:(d=e.owner)!=null?d:void 0,alias:(g=e.alias)!=null?g:void 0}},a=yield this.apiClient.createWallet(t(n));if(!(i&&"error"in a&&a.code===_chunkD2S37DJ5cjs.l))return a;_chunk36GZTRZXcjs.a.info("walletFactory.createWallet.deviceSignerUnsupported.retryWithoutDeviceSigner",{chain:e.chain});let s=n.filter(o=>!this.isBuiltDeviceSigner(o));return yield this.apiClient.createWallet(t(s))})}buildRecoveryRequestConfig(e,r){return _chunk3FQB7LSTcjs.b.call(void 0, e)&&(e.chain==="solana"||e.chain==="stellar")?{recoveryMethods:r}:{adminSigner:r[0]}}validatedRecoverySignerList(e,r){if(e.length===0)throw new (0, _chunkD2S37DJ5cjs.o)("At least one recovery method is required");if(e.length>1&&r!=="solana"&&r!=="stellar")throw new (0, _chunkD2S37DJ5cjs.u)(`Multiple recovery methods are not supported on ${r} yet. Pass a single recovery method.`);return e}resolveRecoverySigner(e,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){if(e.type==="passkey"&&e.id==null)return yield this.createPasskeySigner(e);if(e.type==="server"){let{derivedAddress:n}=_chunkQ66YRLSWcjs.b.call(void 0, e,r,this.apiClient.projectId,this.apiClient.environment);return{type:"server",address:n}}return e})}isBuiltDeviceSigner(e){let r=e.signer;return typeof r=="object"&&r!=null&&r.type==="device"}mergePhoneChannel(e,r){return e.type!=="phone"||(r==null?void 0:r.type)!=="phone"||r.channel==null?e:_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {},e),{channel:r.channel})}createWalletInstance(e,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var p;this.validateExistingWalletConfig(e,r);let n=r,i=e.config,t=(p=i.recoveryMethods)!=null?p:[i.adminSigner],a=this.mergeRecoverySigners(t,_chunk3FQB7LSTcjs.a.call(void 0, n),r.chain),l=i.delegatedSigners,s=l;if(s!=null&&s.length===1&&(s[0].type==="server"||s[0].type==="external-wallet"))s=n.signers;else if(s!=null){let c=n.signers;s=s.map(v=>this.mergePhoneChannel(v,c==null?void 0:c.find(m=>m.type==="phone"&&v.type==="phone"&&_chunkWSDMIQNGcjs.b.call(void 0, m)===v.locator)))}let o=t.filter(c=>c.type==="server"&&"address"in c&&!("secret"in c)).map(c=>c.address),d=(l!=null?l:[]).filter(c=>c.type==="server"&&"address"in c&&!("secret"in c)).map(c=>c.address),g=new (0, _chunkX2CTI7IKcjs.a)({chain:r.chain,address:e.address,owner:e.owner,options:r.options,alias:r.alias,recovery:a,apiRecoveryServerSignerAddresses:o,apiDelegatedServerSignerAddresses:d,signers:s!=null?s:[]},this.apiClient);return yield g.waitForInit(),g})}mergeRecoverySigners(e,r,n){let i=[...r],t=new Map,a=[(l,s)=>this.matchesRecoverySigner(l,s,n),(l,s)=>l.type===s.type];for(let l of a)e.forEach((s,o)=>{if(t.has(o))return;let d=i.findIndex(g=>l(g,s));d!==-1&&t.set(o,i.splice(d,1)[0])});return e.map((l,s)=>{let o=t.get(s);return o==null?l:o.type==="server"||o.type==="external-wallet"?o:this.mergePhoneChannel(l,o)})}matchesRecoverySigner(e,r,n){if(e.type!==r.type)return!1;if(e.type==="email"&&"email"in r)return _chunkHITDGEGWcjs.b.call(void 0, e.email)===_chunkHITDGEGWcjs.b.call(void 0, r.email);if(e.type==="phone"&&"phone"in r)return e.phone===r.phone;if(e.type==="external-wallet"&&"address"in r)return e.address===r.address;if(e.type==="server"&&"address"in r){if(!("secret"in e))return e.address===r.address;let{primary:i,legacy:t}=_chunkQ66YRLSWcjs.c.call(void 0, e,n,this.apiClient.projectId,this.apiClient.environment);return i.derivedAddress===r.address||(t==null?void 0:t.derivedAddress)===r.address}return!0}getWalletLocator(e){return`me:${this.getChainType(e.chain)}:smart`+(e.alias!=null?`:alias:${e.alias}`:"")}createPasskeySigner(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var i;if(e.type!=="passkey")throw new Error("Signer is not a passkey");let r=(i=e.name)!=null?i:`Crossmint Wallet ${Date.now()}`,n=e.onCreatePasskey?yield e.onCreatePasskey(r):yield _ox.WebAuthnP256.createCredential({name:r});return{type:"passkey",id:n.id,name:r,publicKey:{x:n.publicKey.x.toString(),y:n.publicKey.y.toString()}}})}validateExistingWalletConfig(e,r){var t;if(r.owner!=null&&e.owner!=null&&_chunkHITDGEGWcjs.b.call(void 0, r.owner)!==_chunkHITDGEGWcjs.b.call(void 0, e.owner))throw new (0, _chunkD2S37DJ5cjs.g)("Wallet owner does not match existing wallet's linked user");if(r.chain==="solana"&&e.chainType!=="solana"||r.chain!=="solana"&&e.chainType==="solana"||r.chain==="stellar"&&e.chainType!=="stellar"||r.chain!=="stellar"&&e.chainType==="stellar")throw new (0, _chunkD2S37DJ5cjs.g)(`Wallet chain does not match existing wallet's chain. You must use chain: ${e.chainType}.`);if(e.type!=="smart")return;let n=r,i=_chunk3FQB7LSTcjs.a.call(void 0, n);if(n.recovery!=null||n.recoveryMethods!=null||n.signers!=null){let a=e.config,l=(t=a==null?void 0:a.recoveryMethods)!=null?t:(a==null?void 0:a.adminSigner)!=null?[a.adminSigner]:[],s=[...l];for(let d of i){if(l.length===0)break;let g=s.findIndex(c=>this.matchesRecoverySigner(d,c,r.chain)),p=g===-1?s.find(c=>c.type===d.type):s[g];if(p==null)throw new (0, _chunkD2S37DJ5cjs.g)("The wallet recovery signer type does not match the existing wallet's recovery signer type");_chunkHITDGEGWcjs.c.call(void 0, d,p),g!==-1&&s.splice(g,1)}let o=n.signers;o!=null&&this.validateSigners(e,o,r.chain)}}validateSigners(e,r,n){let i=e.config,t=i==null?void 0:i.delegatedSigners;if(r.length!==0){if(t==null||t.length===0)throw new (0, _chunkD2S37DJ5cjs.g)(`${r.length} signer(s) specified, but wallet "${e.address}" has no signers. ${j}`);for(let a of r){let l=t.find(s=>{if(this.isMatchingPasskeySigner(a,s,i)||s.type==="device"&&a.type==="device")return!0;if(a.type==="server"){let{primary:o,legacy:d}=_chunkQ66YRLSWcjs.c.call(void 0, a,n,this.apiClient.projectId,this.apiClient.environment);return s.locator===`server:${o.derivedAddress}`||d!=null&&s.locator===`server:${d.derivedAddress}`}return s.locator===_chunkWSDMIQNGcjs.b.call(void 0, a)});if(l==null){let s=t.map(o=>o.locator).join(", ");throw new (0, _chunkD2S37DJ5cjs.g)(`Signer '${a.type}' does not exist in wallet "${e.address}". Available signers: ${s}. ${j}`)}_chunkHITDGEGWcjs.c.call(void 0, a,l)}}}isMatchingPasskeySigner(e,r,n){var t,a;let i=((a=(t=n.delegatedSigners)==null?void 0:t.filter(l=>l.type==="passkey").length)!=null?a:0)+(n.adminSigner.type==="passkey"?1:0);if(e.type==="passkey"){if(e.id==null&&i===1)return r.type==="passkey";if(e.id==null&&i>1)throw new (0, _chunkD2S37DJ5cjs.g)("When creating a wallet with multiple passkeys, you must provide the passkey ID for each passkey.")}return!1}registerSigners(e,r,n){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var i;return yield Promise.all((i=e==null?void 0:e.map(t=>_chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){if(t.type==="passkey")return t.id==null?{signer:yield this.createPasskeySigner(t)}:{signer:t};if(t.type==="device"){if(t.publicKey!=null)return{signer:{type:"device",publicKey:t.publicKey,name:t.name}};if(t.locator!=null)return{signer:t.locator};if(n==null)throw new (0, _chunkD2S37DJ5cjs.g)("Device signer key storage is required for device signers");let a=yield _chunkGMU3ZYLScjs.a.call(void 0, n);return{signer:{type:"device",publicKey:a.publicKey,name:a.name}}}if(t.type==="server"&&r!=null){let{derivedAddress:a}=_chunkQ66YRLSWcjs.b.call(void 0, t,r,this.apiClient.projectId,this.apiClient.environment);return{signer:`server:${a}`}}return{signer:_chunkWSDMIQNGcjs.b.call(void 0, t)}})))!=null?i:[])})}getChainType(e){return e==="solana"?"solana":e==="stellar"?"stellar":"evm"}};_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunk36GZTRZXcjs.a,methodName:"walletFactory.getWallet",buildContext(e,r){if(typeof r[0]=="string"){let i=r[1];return{walletLocator:r[0],chain:i==null?void 0:i.chain}}let n=r[0];return{chain:n==null?void 0:n.chain}}})],R.prototype,"getWallet",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunk36GZTRZXcjs.a,methodName:"walletFactory.createWallet",buildContext(e,r){return{chain:r[0].chain}}})],R.prototype,"createWallet",1);exports.a = R;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkWSCABGVOcjs = require('./chunk-WSCABGVO.cjs');var _chunk36GZTRZXcjs = require('./chunk-36GZTRZX.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);var g=class d extends _chunkWSCABGVOcjs.a{constructor(e){super(e)}signMessage(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return yield this.sign(_bs582.default.decode(e))})}signTransaction(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return yield this.signMessage(e)})}sign(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var r;yield this.handleAuthRequired();let c=this.getJwtOrThrow();_chunk36GZTRZXcjs.a.info("sign: sending request",{keyType:"ed25519"});let u=Date.now(),n=yield(r=this.config.clientTEEConnection)==null?void 0:r.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:c,apiKey:this.config.crossmint.apiKey},data:{keyType:"ed25519",bytes:_bs582.default.encode(new Uint8Array(e)),encoding:"base58",authId:this.getAuthId()}},options:_chunkWSCABGVOcjs.b});if(_chunk36GZTRZXcjs.a.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 payload");return d.verifyPublicKeyFormat(n.publicKey),{signature:n.signature.bytes}})}static verifyPublicKeyFormat(e){if(e==null)throw new Error("No public key found");if(e.encoding!=="base58"||e.keyType!=="ed25519"||e.bytes==null)throw new Error("Not supported. Expected public key to be in base58 encoding and ed25519 key type. Got: "+JSON.stringify(e))}getChainKeyParams(){return{scheme:"ed25519",encoding:"base58"}}};exports.a = g;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkO2ET3L2Rcjs = require('./chunk-O2ET3L2R.cjs');var _chunkWSDMIQNGcjs = require('./chunk-WSDMIQNG.cjs');var _chunkXMV4T3J5cjs = require('./chunk-XMV4T3J5.cjs');var _chunkHCV4M7X2cjs = require('./chunk-HCV4M7X2.cjs');var _chunkJNKTRQPScjs = require('./chunk-JNKTRQPS.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 g,o,p,u,c,h,m,y,C,R,A,S,E,k,M= exports.a =class{constructor(e){_chunkDSIFRRBScjs.e.call(void 0, this,S);_chunkDSIFRRBScjs.e.call(void 0, this,g);_chunkDSIFRRBScjs.e.call(void 0, this,o);_chunkDSIFRRBScjs.e.call(void 0, this,p,null);_chunkDSIFRRBScjs.e.call(void 0, this,u);_chunkDSIFRRBScjs.e.call(void 0, this,c);_chunkDSIFRRBScjs.e.call(void 0, this,h);_chunkDSIFRRBScjs.e.call(void 0, this,m);_chunkDSIFRRBScjs.e.call(void 0, this,y);_chunkDSIFRRBScjs.e.call(void 0, this,C);_chunkDSIFRRBScjs.e.call(void 0, this,R);_chunkDSIFRRBScjs.e.call(void 0, this,A);if(_chunkDSIFRRBScjs.f.call(void 0, this,u,e.apiClient),_chunkDSIFRRBScjs.f.call(void 0, this,c,e.options),_chunkDSIFRRBScjs.f.call(void 0, this,h,e.chain),_chunkDSIFRRBScjs.f.call(void 0, this,m,e.walletAddress),_chunkDSIFRRBScjs.f.call(void 0, this,y,e.walletLocator),_chunkDSIFRRBScjs.f.call(void 0, this,C,e.serverSignerResolver),e.recoverySigners.length===0)throw new (0, _chunkD2S37DJ5cjs.o)("At least one recovery signer is required");_chunkDSIFRRBScjs.f.call(void 0, this,o,[...e.recoverySigners]),_chunkDSIFRRBScjs.f.call(void 0, this,R,e.initialSigners),_chunkDSIFRRBScjs.f.call(void 0, this,A,e.signers),_chunkDSIFRRBScjs.f.call(void 0, this,g,e.signer)}get activeSigner(){return _chunkDSIFRRBScjs.d.call(void 0, this,g)}setActiveSigner(e){_chunkDSIFRRBScjs.f.call(void 0, this,g,e)}get recovery(){return _chunkDSIFRRBScjs.d.call(void 0, this,o)[0]}get recoverySigners(){return[..._chunkDSIFRRBScjs.d.call(void 0, this,o)]}get selectedRecovery(){var e,r;return(r=(e=_chunkDSIFRRBScjs.d.call(void 0, this,p))==null?void 0:e.config)!=null?r:null}selectRecovery(e,r=_chunkDSIFRRBScjs.d.call(void 0, this,o)[e]){_chunkDSIFRRBScjs.g.call(void 0, this,S,E).call(this,e),_chunkDSIFRRBScjs.f.call(void 0, this,p,{index:e,config:r})}descriptorContext(){var e,r,n,s,t;return{chain:_chunkDSIFRRBScjs.d.call(void 0, this,h),walletAddress:_chunkDSIFRRBScjs.d.call(void 0, this,m),crossmint:_chunkDSIFRRBScjs.d.call(void 0, this,u).crossmint,clientTEEConnection:(e=_chunkDSIFRRBScjs.d.call(void 0, this,c))==null?void 0:e.clientTEEConnection,resetSignerFrame:(r=_chunkDSIFRRBScjs.d.call(void 0, this,c))==null?void 0:r.resetSignerFrame,onAuthRequired:(s=(n=_chunkDSIFRRBScjs.d.call(void 0, this,c))==null?void 0:n.callbacks)==null?void 0:s.onAuthRequired,deviceSignerKeyStorage:(t=_chunkDSIFRRBScjs.d.call(void 0, this,c))==null?void 0:t.deviceSignerKeyStorage,serverSigners:_chunkDSIFRRBScjs.d.call(void 0, this,C)}}adoptRecoveryConfig(e,r){_chunkDSIFRRBScjs.g.call(void 0, this,S,E).call(this,e),_chunkDSIFRRBScjs.d.call(void 0, this,o)[e]=r}stripSecretFromRecovery(e,r){_chunkDSIFRRBScjs.g.call(void 0, this,S,E).call(this,e);let n=_chunkDSIFRRBScjs.d.call(void 0, this,o)[e];n.type==="server"&&!_chunkHCV4M7X2cjs.g.call(void 0, n)&&(_chunkDSIFRRBScjs.d.call(void 0, this,o)[e]={type:"server",address:r})}addRecoverySigner(e){let r=this.recoveryLocator(e);r!=null&&_chunkDSIFRRBScjs.d.call(void 0, this,o).some(s=>this.recoveryLocator(s)===r)||_chunkDSIFRRBScjs.d.call(void 0, this,o).push(e)}removeRecoverySigner(e){let r=_chunkDSIFRRBScjs.d.call(void 0, this,p),n=r==null?null:_chunkDSIFRRBScjs.d.call(void 0, this,o)[r.index],s=r!=null&&this.recoveryLocator(r.config)===e;if(_chunkDSIFRRBScjs.f.call(void 0, this,o,_chunkDSIFRRBScjs.d.call(void 0, this,o).filter(t=>this.recoveryLocator(t)!==e&&!(s&&t===n))),r!=null){let t=s||n==null?-1:_chunkDSIFRRBScjs.d.call(void 0, this,o).indexOf(n);_chunkDSIFRRBScjs.f.call(void 0, this,p,t===-1?null:_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {},r),{index:t}))}}assemble(e,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var s,t;let n=_chunkXMV4T3J5cjs.a.call(void 0, _chunkDSIFRRBScjs.d.call(void 0, this,h),e,(s=_chunkDSIFRRBScjs.d.call(void 0, this,c))==null?void 0:s.deviceSignerKeyStorage);if(r!=null&&r.isAdminSigner)n.status="active";else{let v=yield this.getSignerState(n.locator());n.status=(t=v.signer)==null?void 0:t.status}return n})}require(){if(_chunkDSIFRRBScjs.d.call(void 0, this,g)==null){if(_chunkDSIFRRBScjs.d.call(void 0, this,R).length>1)throw new Error("No signer is set. This wallet has multiple signers configured. Call wallet.useSigner() to select which signer to use before signing operations.");let e=this.recovery,r=_chunkO2ET3L2Rcjs.a.call(void 0, e.type),n=r.signerUnavailableReason();throw n!=null?new Error(n):r.canAutoAssemble(e,this.descriptorContext())?new Error("This wallet is read-only because no signer was provided. Operations that require signing (send, approve, addSigner, etc.) are not available."):new Error("No signer is set. This wallet requires calling wallet.useSigner() before signing operations.")}return _chunkDSIFRRBScjs.d.call(void 0, this,g)}resolveAuthorizingRecovery(){var t,v;let e=this.selectedRecovery;if(e!=null)return{recovery:e,approver:(t=this.recoveryLocator(e))!=null?t:void 0};if(_chunkDSIFRRBScjs.d.call(void 0, this,o).length===1)return{recovery:_chunkDSIFRRBScjs.d.call(void 0, this,o)[0],approver:void 0};let r=_chunkDSIFRRBScjs.d.call(void 0, this,o).map(f=>this.recoveryLocator(f)),n=(v=_chunkDSIFRRBScjs.d.call(void 0, this,g))==null?void 0:v.locator(),s=n==null?-1:r.indexOf(n);if(s===-1){let b=`Call wallet.useRecoveryMethod() with one of them (${r.filter(F=>F!=null).join(", ")}) first.`;throw new (0, _chunkD2S37DJ5cjs.t)(n==null?`This wallet has multiple recovery methods, so the one authorizing this operation must be selected. ${b}`:`Signer "${n}" is not one of this wallet's recovery methods, and only a recovery method can add or remove signers. ${b}`)}return{recovery:_chunkDSIFRRBScjs.d.call(void 0, this,o)[s],approver:n}}recoveryLocator(e){return e.type==="server"?_chunkHCV4M7X2cjs.g.call(void 0, e)?`server:${e.address}`:null:_chunkWSDMIQNGcjs.b.call(void 0, e)}withRecoverySigner(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var F;let r=_chunkDSIFRRBScjs.d.call(void 0, this,g),{recovery:n,approver:s}=this.resolveAuthorizingRecovery(),t=n;if(_chunkHCV4M7X2cjs.g.call(void 0, t)&&!_chunkDSIFRRBScjs.d.call(void 0, this,C).hasRecoveryResolutionFor(t.address))throw new Error('Cannot assemble server signer: no secret available. Call wallet.useRecoveryMethod({ type: "server", secret: ... }) first with the recovery server secret.');let v=_chunkO2ET3L2Rcjs.a.call(void 0, t.type),f=this.descriptorContext();if(t.type==="external-wallet"&&!v.canAutoAssemble(t,f))throw new Error('Cannot assemble external wallet signer: no onSign callback available. Call wallet.useRecoveryMethod({ type: "external-wallet", address: "0x...", onSign: async (tx) => ... }) first.');let b=v.buildInternalConfig(t,f);_chunkDSIFRRBScjs.f.call(void 0, this,g,_chunkXMV4T3J5cjs.a.call(void 0, _chunkDSIFRRBScjs.d.call(void 0, this,h),b,(F=_chunkDSIFRRBScjs.d.call(void 0, this,c))==null?void 0:F.deviceSignerKeyStorage));try{return yield e(s)}finally{_chunkDSIFRRBScjs.f.call(void 0, this,g,r)}})}getSignerState(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let r=null;try{r=yield _chunkDSIFRRBScjs.d.call(void 0, this,u).getSigner(_chunkDSIFRRBScjs.d.call(void 0, this,y).call(this),e)}catch(s){return _chunk36GZTRZXcjs.a.warn("wallet.signers.getSignerState.fetchFailed",{signerLocator:e,error:s}),{response:null,signer:null,pendingOperation:null}}if(r==null||typeof r!="object"||"error"in r)return _chunk36GZTRZXcjs.a.warn("wallet.signers.getSignerState.errorResponse",{signerLocator:e,response:r}),{response:null,signer:null,pendingOperation:null};let n=_chunkJNKTRQPScjs.b.call(void 0, r,_chunkDSIFRRBScjs.d.call(void 0, this,h));return{response:r,signer:n,pendingOperation:_chunkJNKTRQPScjs.c.call(void 0, r,_chunkDSIFRRBScjs.d.call(void 0, this,h))}})}signerIsRegistered(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return(yield _chunkDSIFRRBScjs.d.call(void 0, this,A).call(this)).some(n=>n.locator===e)})}isSignerApproved(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){try{let r=yield _chunkDSIFRRBScjs.g.call(void 0, this,S,k).call(this,e);return this.isApprovedSignerStatus(r==null?void 0:r.status)}catch(r){if(r instanceof _commonsdkbase.ApiClientError&&r.status===404)return!1;throw _chunk36GZTRZXcjs.a.error("wallet.signers.isSignerApproved.failed",{signerLocator:e,error:r}),r}})}isApprovedSignerStatus(e){return e==="success"||e==="active"}};g=new WeakMap,o=new WeakMap,p=new WeakMap,u=new WeakMap,c=new WeakMap,h=new WeakMap,m=new WeakMap,y=new WeakMap,C=new WeakMap,R=new WeakMap,A=new WeakMap,S=new WeakSet,E=function(e){if(e<0||e>=_chunkDSIFRRBScjs.d.call(void 0, this,o).length)throw new Error(`Recovery signer index ${e} is out of range`)},k=function(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let r=yield _chunkDSIFRRBScjs.d.call(void 0, this,u).getSigner(_chunkDSIFRRBScjs.d.call(void 0, this,y).call(this),e);if(r==null||typeof r!="object"||"error"in r)throw new Error(`Failed to fetch the approval state of signer ${e}`);return _chunkJNKTRQPScjs.b.call(void 0, r,_chunkDSIFRRBScjs.d.call(void 0, this,h))})};exports.a = M;
@@ -0,0 +1 @@
1
+ import{a as l}from"./chunk-5M7IRODB.js";import{a as t,b as o}from"./chunk-NU7VF7MC.js";var C=e=>{var r;return((r=e.client)!=null?r:l).get(t({url:"/v1-alpha2/wallets/{walletLocator}/balances"},e))},c=e=>{var r;return((r=e.client)!=null?r:l).post(o(t({url:"/v1-alpha2/wallets/{walletLocator}/balances"},e),{headers:t({"Content-Type":"application/json"},e.headers)}))},i=e=>{var r;return((r=e.client)!=null?r:l).post(o(t({url:"/unstable/wallets/me{walletType}/tokens/{tokenLocator}/transfers"},e),{headers:t({"Content-Type":"application/json"},e.headers)}))},d=e=>{var r;return((r=e.client)!=null?r:l).get(t({url:"/unstable/wallets/me{walletLocator}/transfers"},e))},p=e=>{var r;return((r=e.client)!=null?r:l).get(t({url:"/unstable/wallets/{walletLocator}/transfers"},e))},w=e=>{var r;return((r=e.client)!=null?r:l).post(o(t({url:"/unstable/wallets/{walletLocator}/tokens/{tokenLocator}/transfers"},e),{headers:t({"Content-Type":"application/json"},e.headers)}))},T=e=>{var r;return((r=e.client)!=null?r:l).get(t({url:"/unstable/wallets/{walletLocator}/balances"},e))},W=e=>{var r;return((r=e.client)!=null?r:l).post(o(t({url:"/2025-06-09/wallets/me{walletLocator}/transactions/{transactionId}/approvals"},e),{headers:t({"Content-Type":"application/json"},e.headers)}))},u=e=>{var r;return((r=e.client)!=null?r:l).get(t({url:"/2025-06-09/wallets/me{walletLocator}/transactions/{transactionId}"},e))},h=e=>{var r;return((r=e.client)!=null?r:l).get(t({url:"/2025-06-09/wallets/me{walletLocator}/transactions"},e))},V=e=>{var r;return((r=e.client)!=null?r:l).post(o(t({url:"/2025-06-09/wallets/me{walletLocator}/transactions"},e),{headers:t({"Content-Type":"application/json"},e.headers)}))},E=e=>{var r;return((r=e.client)!=null?r:l).post(o(t({url:"/2025-06-09/wallets/me{walletLocator}/tokens/{tokenLocator}/transfers"},e),{headers:t({"Content-Type":"application/json"},e.headers)}))},O=e=>{var r;return((r=e.client)!=null?r:l).delete(t({url:"/2025-06-09/wallets/me{walletLocator}/signers/{signer}"},e))},g=e=>{var r;return((r=e.client)!=null?r:l).get(t({url:"/2025-06-09/wallets/me{walletLocator}/signers/{signer}"},e))},S=e=>{var r;return((r=e.client)!=null?r:l).post(o(t({url:"/2025-06-09/wallets/me{walletLocator}/signers"},e),{headers:t({"Content-Type":"application/json"},e.headers)}))},R=e=>{var r;return((r=e.client)!=null?r:l).post(o(t({url:"/2025-06-09/wallets/me{walletLocator}/signatures/{signatureId}/approvals"},e),{headers:t({"Content-Type":"application/json"},e.headers)}))},D=e=>{var r;return((r=e.client)!=null?r:l).get(t({url:"/2025-06-09/wallets/me{walletLocator}/signatures/{signatureId}"},e))},G=e=>{var r;return((r=e.client)!=null?r:l).get(t({url:"/2025-06-09/wallets/me{walletLocator}/signatures"},e))},M=e=>{var r;return((r=e.client)!=null?r:l).post(o(t({url:"/2025-06-09/wallets/me{walletLocator}/signatures"},e),{headers:t({"Content-Type":"application/json"},e.headers)}))},v=e=>{var r;return((r=e.client)!=null?r:l).get(t({url:"/2025-06-09/wallets/me{walletLocator}"},e))},b=e=>{var r;return((r=e.client)!=null?r:l).post(o(t({url:"/2025-06-09/wallets/me"},e),{headers:t({"Content-Type":"application/json"},e.headers)}))},x=e=>{var r;return((r=e.client)!=null?r:l).delete(t({url:"/2025-06-09/wallets/card-providers/{providerName}"},e))},y=e=>{var r;return((r=e.client)!=null?r:l).patch(o(t({url:"/2025-06-09/wallets/card-providers/{providerName}"},e),{headers:t({"Content-Type":"application/json"},e.headers)}))},L=e=>{var r;return((r=e.client)!=null?r:l).post(o(t({url:"/2025-06-09/wallets/card-providers"},e),{headers:t({"Content-Type":"application/json"},e.headers)}))},m=e=>{var r;return((r=e.client)!=null?r:l).post(o(t({url:"/2025-06-09/wallets/{walletLocator}/transactions/{transactionId}/approvals"},e),{headers:t({"Content-Type":"application/json"},e.headers)}))},k=e=>{var r;return((r=e.client)!=null?r:l).get(t({url:"/2025-06-09/wallets/{walletLocator}/transactions/{transactionId}"},e))},A=e=>{var r;return((r=e.client)!=null?r:l).get(t({url:"/2025-06-09/wallets/{walletLocator}/transactions"},e))},B=e=>{var r;return((r=e.client)!=null?r:l).post(o(t({url:"/2025-06-09/wallets/{walletLocator}/transactions"},e),{headers:t({"Content-Type":"application/json"},e.headers)}))},f=e=>{var r;return((r=e.client)!=null?r:l).get(t({url:"/2025-06-09/wallets/{walletLocator}/tokens/{tokenLocator}/transfers/{transactionId}"},e))},F=e=>{var r;return((r=e.client)!=null?r:l).post(o(t({url:"/2025-06-09/wallets/{walletLocator}/tokens/{tokenLocator}/transfers"},e),{headers:t({"Content-Type":"application/json"},e.headers)}))},U=e=>{var r;return((r=e.client)!=null?r:l).delete(t({url:"/2025-06-09/wallets/{walletLocator}/signers/{signer}"},e))},j=e=>{var r;return((r=e.client)!=null?r:l).get(t({url:"/2025-06-09/wallets/{walletLocator}/signers/{signer}"},e))},P=e=>{var r;return((r=e.client)!=null?r:l).post(o(t({url:"/2025-06-09/wallets/{walletLocator}/signers"},e),{headers:t({"Content-Type":"application/json"},e.headers)}))},q=e=>{var r;return((r=e.client)!=null?r:l).post(o(t({url:"/2025-06-09/wallets/me{walletLocator}/recovery-methods"},e),{headers:t({"Content-Type":"application/json"},e.headers)}))},I=e=>{var r;return((r=e.client)!=null?r:l).delete(t({url:"/2025-06-09/wallets/me{walletLocator}/recovery-methods/{signer}"},e))},N=e=>{var r;return((r=e.client)!=null?r:l).post(o(t({url:"/2025-06-09/wallets/{walletLocator}/recovery-methods"},e),{headers:t({"Content-Type":"application/json"},e.headers)}))},_=e=>{var r;return((r=e.client)!=null?r:l).delete(t({url:"/2025-06-09/wallets/{walletLocator}/recovery-methods/{signer}"},e))},z=e=>{var r;return((r=e.client)!=null?r:l).post(o(t({url:"/2025-06-09/wallets/{walletLocator}/signatures/{signatureId}/approvals"},e),{headers:t({"Content-Type":"application/json"},e.headers)}))},H=e=>{var r;return((r=e.client)!=null?r:l).get(t({url:"/2025-06-09/wallets/{walletLocator}/signatures/{signatureId}"},e))},J=e=>{var r;return((r=e.client)!=null?r:l).get(t({url:"/2025-06-09/wallets/{walletLocator}/signatures"},e))},K=e=>{var r;return((r=e.client)!=null?r:l).post(o(t({url:"/2025-06-09/wallets/{walletLocator}/signatures"},e),{headers:t({"Content-Type":"application/json"},e.headers)}))},Q=e=>{var r;return((r=e.client)!=null?r:l).delete(t({url:"/2025-06-09/wallets/{walletLocator}/cards/{cardLocator}"},e))},X=e=>{var r;return((r=e.client)!=null?r:l).get(t({url:"/2025-06-09/wallets/{walletLocator}/cards/{cardLocator}"},e))},Y=e=>{var r;return((r=e.client)!=null?r:l).get(t({url:"/2025-06-09/wallets/{walletLocator}/cards"},e))},Z=e=>{var r;return((r=e.client)!=null?r:l).post(o(t({url:"/2025-06-09/wallets/{walletLocator}/cards"},e),{headers:t({"Content-Type":"application/json"},e.headers)}))},$=e=>{var r;return((r=e.client)!=null?r:l).get(t({url:"/2025-06-09/wallets/{walletLocator}/balances"},e))},ee=e=>{var r;return((r=e.client)!=null?r:l).get(t({url:"/2025-06-09/wallets/{walletLocator}"},e))},re=e=>{var r;return((r=e.client)!=null?r:l).post(o(t({url:"/2025-06-09/wallets"},e),{headers:t({"Content-Type":"application/json"},e.headers)}))},te=e=>{var r;return((r=e.client)!=null?r:l).get(t({url:"/2024-09-26/wallets/{walletLocator}/balances"},e))},le=e=>{var r;return((r=e.client)!=null?r:l).post(o(t({url:"/2024-09-26/wallets/{walletLocator}/balances"},e),{headers:t({"Content-Type":"application/json"},e.headers)}))};export{C as a,c as b,i as c,d,p as e,w as f,T as g,W as h,u as i,h as j,V as k,E as l,O as m,g as n,S as o,R as p,D as q,G as r,M as s,v as t,b as u,x as v,y as w,L as x,m as y,k as z,A,B,f as C,F as D,U as E,j as F,P as G,q as H,I,N as J,_ as K,z as L,H as M,J as N,K as O,Q as P,X as Q,Y as R,Z as S,$ as T,ee as U,re as V,te as W,le as X};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkVS6I4S7Xcjs = require('./chunk-VS6I4S7X.cjs');var _chunkW3BYSI7Fcjs = require('./chunk-W3BYSI7F.cjs');var _chunkM42AKAZKcjs = require('./chunk-M42AKAZK.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var h=class extends _commonsdkbase.CrossmintApiClient{constructor(e){super(e,{internalConfig:{sdkMetadata:{name:_chunkM42AKAZKcjs.c,version:_chunkM42AKAZKcjs.b}}});this.apiPrefix="api/2025-06-09/wallets";this.unstableApiPrefix="api/unstable/wallets"}createWallet(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let s=this.isServerSide?`${this.apiPrefix}`:`${this.apiPrefix}/me`;_chunkW3BYSI7Fcjs.a.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?_chunkW3BYSI7Fcjs.a.error("wallets.api.createWallet.error",{error:t.error,chainType:e.chainType}):"address"in t&&_chunkW3BYSI7Fcjs.a.info("wallets.api.createWallet.success",{address:t.address,chainType:e.chainType}),t})}getWallet(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){_chunkW3BYSI7Fcjs.a.info("wallets.api.getWallet",{locator:e});let r=yield(yield this.get(`${this.apiPrefix}/${e}`,{headers:this.headers})).json();return"error"in r?_chunkW3BYSI7Fcjs.a.warn("wallets.api.getWallet.error",{locator:e,error:r.error}):"address"in r&&_chunkW3BYSI7Fcjs.a.info("wallets.api.getWallet.success",{address:r.address,locator:e}),r})}createTransaction(e,s){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveTransaction(e,s,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions/${s}/approvals`,{body:JSON.stringify(r),headers:this.headers})).json()})}getTransaction(e,s){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions/${s}`,{headers:this.headers})).json()})}createSignature(e,s){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signatures`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveSignature(e,s,r){return _chunkDSIFRRBScjs.h.call(void 0, 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 _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/signatures/${s}`,{headers:this.headers})).json()})}getTransactions(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions`,{headers:this.headers})).json()})}getNfts(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let s=new URLSearchParams;s.append("page",e.page.toString()),s.append("perPage",e.perPage.toString());let r=`${e.chain}:${e.address}`;return(yield this.get(`${this.apiPrefix}/${r}/nfts?${s.toString()}`,{headers:this.headers})).json()})}getTransfers(e,s){return _chunkDSIFRRBScjs.h.call(void 0, 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 _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let r=new URLSearchParams;return r.append("tokens",s.tokens.join(",")),r.append("chains",s.chains.join(",")),(yield this.get(`${this.apiPrefix}/${e}/balances?${r.toString()}`,{headers:this.headers})).json()})}fundWallet(e,s){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){if(this.environment===_commonsdkbase.APIKeyEnvironmentPrefix.PRODUCTION)throw new Error("Funding wallets is only supported in staging environment");return(yield this.post(`api/v1-alpha2/wallets/${e}/balances`,{body:JSON.stringify(s),headers:this.headers})).json()})}registerSigner(e,s){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signers`,{body:JSON.stringify(s),headers:this.headers})).json()})}removeSigner(e,s,r){return _chunkDSIFRRBScjs.h.call(void 0, 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 p=`${this.apiPrefix}/${e}/signers/${t}${a.size>0?`?${a.toString()}`:""}`;return(yield this.delete(p,{headers:this.headers})).json()})}getSigner(e,s){return _chunkDSIFRRBScjs.h.call(void 0, 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(p){}throw new (0, _commonsdkbase.ApiClientError)(`API request failed: ${t.status} ${t.statusText}`,t.status,t.statusText,a)}return t.json()})}send(e,s,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){_chunkW3BYSI7Fcjs.a.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?_chunkW3BYSI7Fcjs.a.error("wallets.api.send.error",{walletLocator:e,tokenLocator:s,error:a.error}):"id"in a&&_chunkW3BYSI7Fcjs.a.info("wallets.api.send.success",{walletLocator:e,transactionId:a.id}),a})}get isServerSide(){return this.parsedAPIKey.usageOrigin===_commonsdkbase.APIKeyUsageOrigin.SERVER}get environment(){if(!this.parsedAPIKey.isValid)throw new (0, _chunkVS6I4S7Xcjs.a)("Invalid API key");return this.parsedAPIKey.environment}get projectId(){if(!this.parsedAPIKey.isValid)throw new (0, _chunkVS6I4S7Xcjs.a)("Invalid API key");return this.parsedAPIKey.projectId}get headers(){return{"Content-Type":"application/json"}}};exports.a = h;
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');var _commonsdkbase = require('@crossmint/common-sdk-base');var l=class extends _commonsdkbase.CrossmintApiClient{constructor(e){super(e,{internalConfig:{sdkMetadata:{name:_chunkAEHDAUN4cjs.c,version:_chunkAEHDAUN4cjs.b}}});this.apiPrefix="api/2025-06-09/wallets";this.unstableApiPrefix="api/unstable/wallets"}createWallet(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let s=this.isServerSide?`${this.apiPrefix}`:`${this.apiPrefix}/me`;_chunk36GZTRZXcjs.a.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?_chunk36GZTRZXcjs.a.error("wallets.api.createWallet.error",{error:t.error,chainType:e.chainType}):"address"in t&&_chunk36GZTRZXcjs.a.info("wallets.api.createWallet.success",{address:t.address,chainType:e.chainType}),t})}getWallet(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){_chunk36GZTRZXcjs.a.info("wallets.api.getWallet",{locator:e});let r=yield(yield this.get(`${this.apiPrefix}/${e}`,{headers:this.headers})).json();return"error"in r?_chunk36GZTRZXcjs.a.warn("wallets.api.getWallet.error",{locator:e,error:r.error}):"address"in r&&_chunk36GZTRZXcjs.a.info("wallets.api.getWallet.success",{address:r.address,locator:e}),r})}createTransaction(e,s){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveTransaction(e,s,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions/${s}/approvals`,{body:JSON.stringify(r),headers:this.headers})).json()})}getTransaction(e,s){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions/${s}`,{headers:this.headers})).json()})}createSignature(e,s){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signatures`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveSignature(e,s,r){return _chunkDSIFRRBScjs.h.call(void 0, 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 _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/signatures/${s}`,{headers:this.headers})).json()})}getTransactions(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions`,{headers:this.headers})).json()})}getNfts(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let s=new URLSearchParams;s.append("page",e.page.toString()),s.append("perPage",e.perPage.toString());let r=`${e.chain}:${e.address}`;return(yield this.get(`${this.apiPrefix}/${r}/nfts?${s.toString()}`,{headers:this.headers})).json()})}getTransfers(e,s){return _chunkDSIFRRBScjs.h.call(void 0, 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 _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let r=new URLSearchParams;return r.append("tokens",s.tokens.join(",")),r.append("chains",s.chains.join(",")),(yield this.get(`${this.apiPrefix}/${e}/balances?${r.toString()}`,{headers:this.headers})).json()})}fundWallet(e,s){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){if(this.environment===_commonsdkbase.APIKeyEnvironmentPrefix.PRODUCTION)throw new Error("Funding wallets is only supported in staging environment");return(yield this.post(`api/v1-alpha2/wallets/${e}/balances`,{body:JSON.stringify(s),headers:this.headers})).json()})}registerSigner(e,s){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signers`,{body:JSON.stringify(s),headers:this.headers})).json()})}removeSigner(e,s,r){return _chunkDSIFRRBScjs.h.call(void 0, 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 _chunkDSIFRRBScjs.h.call(void 0, 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 _chunkDSIFRRBScjs.h.call(void 0, 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 _chunkDSIFRRBScjs.h.call(void 0, 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 (0, _commonsdkbase.ApiClientError)(`API request failed: ${t.status} ${t.statusText}`,t.status,t.statusText,a)}return t.json()})}send(e,s,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){_chunk36GZTRZXcjs.a.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?_chunk36GZTRZXcjs.a.error("wallets.api.send.error",{walletLocator:e,tokenLocator:s,error:a.error}):"id"in a&&_chunk36GZTRZXcjs.a.info("wallets.api.send.success",{walletLocator:e,transactionId:a.id}),a})}get isServerSide(){return this.parsedAPIKey.usageOrigin===_commonsdkbase.APIKeyUsageOrigin.SERVER}get environment(){if(!this.parsedAPIKey.isValid)throw new (0, _chunkD2S37DJ5cjs.a)("Invalid API key");return this.parsedAPIKey.environment}get projectId(){if(!this.parsedAPIKey.isValid)throw new (0, _chunkD2S37DJ5cjs.a)("Invalid API key");return this.parsedAPIKey.projectId}get headers(){return{"Content-Type":"application/json"}}};exports.a = l;
@@ -1 +1 @@
1
- import{b as r}from"./chunk-BV6IQIQK.js";var t={type:"api-key",validateConfig(){},buildInternalConfig(e,i){return{type:"api-key",locator:"api-key",address:i.walletAddress}},canAutoAssemble(){return!0},addSignerPayload(e){return r(e)},matchesRecovery(e,i){return r(e)===r(i)},adoptsRecoveryConfigOnMatch:!0,signerUnavailableReason:()=>null};export{t as a};
1
+ import{b as r}from"./chunk-RV3Q5EIA.js";var t={type:"api-key",validateConfig(){},buildInternalConfig(e,i){return{type:"api-key",locator:"api-key",address:i.walletAddress}},canAutoAssemble(){return!0},addSignerPayload(e){return r(e)},matchesRecovery(e,i){return r(e)===r(i)},adoptsRecoveryConfigOnMatch:!0,signerUnavailableReason:()=>null};export{t as a};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkVS6I4S7Xcjs = require('./chunk-VS6I4S7X.cjs');var _commonsdkauth = require('@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(_commonsdkauth.isEmailValid.call(void 0, 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 (0, _chunkVS6I4S7Xcjs.g)(m(i,s,e))}}}exports.a = u; exports.b = l; exports.c = d;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkD2S37DJ5cjs = require('./chunk-D2S37DJ5.cjs');var _commonsdkauth = require('@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(_commonsdkauth.isEmailValid.call(void 0, 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 (0, _chunkD2S37DJ5cjs.g)(m(i,s,e))}}}exports.a = u; exports.b = l; exports.c = d;
@@ -0,0 +1 @@
1
+ import{a as P}from"./chunk-NZXYWQE5.js";import{a as v}from"./chunk-IOSADDL5.js";import{x as w}from"./chunk-4I3EXM4B.js";import{a as l}from"./chunk-2YLAHC7J.js";import{c as m,h as n}from"./chunk-NU7VF7MC.js";import{getEnvironmentForKey as K,APIKeyEnvironmentPrefix as h,WithLoggerContext as u}from"@crossmint/common-sdk-base";import{WebAuthnP256 as b}from"ox";var R={[h.DEVELOPMENT]:"https://development.devicekey.store",[h.STAGING]:"https://staging.devicekey.store",[h.PRODUCTION]:"https://devicekey.store"},E=6e4,L="indexeddb-fatal",c=class extends v{constructor(e){super(e);this.iframePromise=null;this.reloading=null;this.biometricRequestHandler=null;this.biometricListener=null;if(typeof window!="undefined"&&!P())throw new 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=K(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 n(this,arguments,function*(e={biometricPolicy:"none"}){return(yield this.rpc("generateKey",e)).publicKeyBase64})}mapAddressToKey(e,r){return n(this,null,function*(){yield this.rpc("mapAddressToKey",{address:e,publicKeyBase64:r})})}getKey(e){return n(this,null,function*(){return(yield this.rpc("getKey",{address:e})).publicKeyBase64})}hasKey(e){return n(this,null,function*(){return(yield this.rpc("hasKey",{publicKeyBase64:e})).hasKey})}signMessage(e,r){return n(this,null,function*(){return yield this.rpc("signMessage",{address:e,message:r})})}deleteKey(e){return n(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 n(this,null,function*(){let i=yield this.sendRpc(e,r);if(i.fatal){l.warn(`[IframeDeviceSignerKeyStorage] Recoverable IDB error on "${e}", reloading iframe and retrying`),yield this.reloadIframe();let t=yield this.sendRpc(e,r);if(t.fatal)throw new Error(`Device signer IDB fatal error on "${e}" persisted after iframe reload`);return t.value}return i.value})}sendRpc(e,r){return n(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 n(this,null,function*(){if(this.reloading!=null)return this.reloading;let e=n(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=>n(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 b.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 b.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}};m([u({logger:l,methodName:"deviceSignerKeyStorage.generateKey"})],c.prototype,"generateKey",1),m([u({logger:l,methodName:"deviceSignerKeyStorage.mapAddressToKey"})],c.prototype,"mapAddressToKey",1),m([u({logger:l,methodName:"deviceSignerKeyStorage.getKey"})],c.prototype,"getKey",1),m([u({logger:l,methodName:"deviceSignerKeyStorage.hasKey"})],c.prototype,"hasKey",1),m([u({logger:l,methodName:"deviceSignerKeyStorage.signMessage"})],c.prototype,"signMessage",1),m([u({logger:l,methodName:"deviceSignerKeyStorage.deleteKey"})],c.prototype,"deleteKey",1);export{c as a};
@@ -1 +1 @@
1
- import{b as r}from"./chunk-BV6IQIQK.js";var g={type:"phone",validateConfig(n){if(!("phone"in n)||n.phone==null)throw new Error("Phone signer requires a phone number")},buildInternalConfig(n,e){let i=n;return{type:"phone",phone:i.phone,channel:i.channel,locator:`phone:${i.phone}`,address:e.walletAddress,crossmint:e.crossmint,clientTEEConnection:e.clientTEEConnection,resetSignerFrame:e.resetSignerFrame,onAuthRequired:e.onAuthRequired}},canAutoAssemble(){return!0},addSignerPayload(n){return r(n)},matchesRecovery(n,e){return r(n)===r(e)},adoptsRecoveryConfigOnMatch:!0,signerUnavailableReason:()=>null};export{g as a};
1
+ import{b as r}from"./chunk-RV3Q5EIA.js";var g={type:"phone",validateConfig(n){if(!("phone"in n)||n.phone==null)throw new Error("Phone signer requires a phone number")},buildInternalConfig(n,e){let i=n;return{type:"phone",phone:i.phone,channel:i.channel,locator:`phone:${i.phone}`,address:e.walletAddress,crossmint:e.crossmint,clientTEEConnection:e.clientTEEConnection,resetSignerFrame:e.resetSignerFrame,onAuthRequired:e.onAuthRequired}},canAutoAssemble(){return!0},addSignerPayload(n){return r(n)},matchesRecovery(n,e){return r(n)===r(e)},adoptsRecoveryConfigOnMatch:!0,signerUnavailableReason:()=>null};export{g as a};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkUY7L4D4Mcjs = require('./chunk-UY7L4D4M.cjs');var _chunkVS6I4S7Xcjs = require('./chunk-VS6I4S7X.cjs');var _chunkW3BYSI7Fcjs = require('./chunk-W3BYSI7F.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var m=409,l=class l extends _chunkUY7L4D4Mcjs.a{constructor(e){super({chain:e.chain,address:e.address,owner:e.owner,options:_chunkUY7L4D4Mcjs.a.getOptions(e),alias:e.alias,recovery:_chunkUY7L4D4Mcjs.a.getRecoverySigners(e),apiRecoveryServerSignerAddresses:_chunkUY7L4D4Mcjs.a.getApiRecoveryServerSignerAddresses(e),apiDelegatedServerSignerAddresses:_chunkUY7L4D4Mcjs.a.getApiDelegatedServerSignerAddresses(e),signer:e.signer,signers:_chunkUY7L4D4Mcjs.a.getInitialSigners(e)},_chunkUY7L4D4Mcjs.a.getApiClient(e))}static from(e){if(!_commonsdkbase.isValidStellarAddress.call(void 0, e.address))throw new Error("Wallet is not a Stellar wallet");return new l(e)}sendTransaction(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var d;_chunkW3BYSI7Fcjs.a.info("stellarWallet.sendTransaction.start"),yield this.preAuthIfNeeded();let r=yield this.createTransaction(e);if((d=e.options)!=null&&d.prepareOnly)return _chunkW3BYSI7Fcjs.a.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 _chunkW3BYSI7Fcjs.a.info("stellarWallet.sendTransaction.success",{transactionId:r.id,hash:n.hash}),n})}upgrade(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){_chunkW3BYSI7Fcjs.a.info("stellarWallet.upgrade.start"),yield this.preAuthIfNeeded();let r=yield this.createWalletLifecycleTransaction("upgrade-wallet",e);if(r!=null){if(e!=null&&e.prepareOnly)return _chunkW3BYSI7Fcjs.a.info("stellarWallet.upgrade.prepared",{transactionId:r}),{hash:void 0,explorerLink:void 0,transactionId:r};yield this.approveTransactionAndWait(r),_chunkW3BYSI7Fcjs.a.info("stellarWallet.upgrade.phase1.success",{transactionId:r})}else _chunkW3BYSI7Fcjs.a.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 _chunkW3BYSI7Fcjs.a.info("stellarWallet.upgrade.success",{transactionId:a.transactionId,hash:a.hash}),a})}migrate(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return yield this.preAuthIfNeeded(),yield this.migrateInternal(e)})}migrateInternal(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){_chunkW3BYSI7Fcjs.a.info("stellarWallet.migrate.start");let r=yield this.createWalletLifecycleTransaction("migrate-wallet",e);if(r==null)throw new (0, _chunkVS6I4S7Xcjs.H)("Failed to create migrate-wallet transaction");if(e!=null&&e.prepareOnly)return _chunkW3BYSI7Fcjs.a.info("stellarWallet.migrate.prepared",{transactionId:r}),{hash:void 0,explorerLink:void 0,transactionId:r};let a=yield this.approveTransactionAndWait(r);return _chunkW3BYSI7Fcjs.a.info("stellarWallet.migrate.success",{transactionId:r,hash:a.hash}),a})}createTransaction(e){return _chunkDSIFRRBScjs.h.call(void 0, 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 (0, _chunkVS6I4S7Xcjs.H)(JSON.stringify(p));return p})}createWalletLifecycleTransaction(e,r){return _chunkDSIFRRBScjs.h.call(void 0, 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:_chunkDSIFRRBScjs.a.call(void 0, {transaction:{type:e}},a!=null?{signer:a}:{})});if("error"in n){if(e==="upgrade-wallet"&&y(n))return null;throw new (0, _chunkVS6I4S7Xcjs.H)(JSON.stringify(n))}return n.id})}resolveStellarSigner(e){return e==null?this.signerManager.require().locator():typeof e=="string"?e:this.resolveServerSignerApiLocator(e)}};_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkW3BYSI7Fcjs.a,methodName:"stellarWallet.sendTransaction",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"sendTransaction",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkW3BYSI7Fcjs.a,methodName:"stellarWallet.upgrade",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"upgrade",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkW3BYSI7Fcjs.a,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}exports.a = h;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkX2CTI7IKcjs = require('./chunk-X2CTI7IK.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 m=409,l=class l extends _chunkX2CTI7IKcjs.a{constructor(e){super({chain:e.chain,address:e.address,owner:e.owner,options:_chunkX2CTI7IKcjs.a.getOptions(e),alias:e.alias,recovery:_chunkX2CTI7IKcjs.a.getRecoverySigners(e),apiRecoveryServerSignerAddresses:_chunkX2CTI7IKcjs.a.getApiRecoveryServerSignerAddresses(e),apiDelegatedServerSignerAddresses:_chunkX2CTI7IKcjs.a.getApiDelegatedServerSignerAddresses(e),signer:e.signer,signers:_chunkX2CTI7IKcjs.a.getInitialSigners(e)},_chunkX2CTI7IKcjs.a.getApiClient(e))}static from(e){if(!_commonsdkbase.isValidStellarAddress.call(void 0, e.address))throw new Error("Wallet is not a Stellar wallet");return new l(e)}sendTransaction(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var d;_chunk36GZTRZXcjs.a.info("stellarWallet.sendTransaction.start"),yield this.preAuthIfNeeded();let r=yield this.createTransaction(e);if((d=e.options)!=null&&d.prepareOnly)return _chunk36GZTRZXcjs.a.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 _chunk36GZTRZXcjs.a.info("stellarWallet.sendTransaction.success",{transactionId:r.id,hash:n.hash}),n})}upgrade(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){_chunk36GZTRZXcjs.a.info("stellarWallet.upgrade.start"),yield this.preAuthIfNeeded();let r=yield this.createWalletLifecycleTransaction("upgrade-wallet",e);if(r!=null){if(e!=null&&e.prepareOnly)return _chunk36GZTRZXcjs.a.info("stellarWallet.upgrade.prepared",{transactionId:r}),{hash:void 0,explorerLink:void 0,transactionId:r};yield this.approveTransactionAndWait(r),_chunk36GZTRZXcjs.a.info("stellarWallet.upgrade.phase1.success",{transactionId:r})}else _chunk36GZTRZXcjs.a.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 _chunk36GZTRZXcjs.a.info("stellarWallet.upgrade.success",{transactionId:a.transactionId,hash:a.hash}),a})}migrate(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return yield this.preAuthIfNeeded(),yield this.migrateInternal(e)})}migrateInternal(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){_chunk36GZTRZXcjs.a.info("stellarWallet.migrate.start");let r=yield this.createWalletLifecycleTransaction("migrate-wallet",e);if(r==null)throw new (0, _chunkD2S37DJ5cjs.I)("Failed to create migrate-wallet transaction");if(e!=null&&e.prepareOnly)return _chunk36GZTRZXcjs.a.info("stellarWallet.migrate.prepared",{transactionId:r}),{hash:void 0,explorerLink:void 0,transactionId:r};let a=yield this.approveTransactionAndWait(r);return _chunk36GZTRZXcjs.a.info("stellarWallet.migrate.success",{transactionId:r,hash:a.hash}),a})}createTransaction(e){return _chunkDSIFRRBScjs.h.call(void 0, 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 (0, _chunkD2S37DJ5cjs.I)(JSON.stringify(p));return p})}createWalletLifecycleTransaction(e,r){return _chunkDSIFRRBScjs.h.call(void 0, 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:_chunkDSIFRRBScjs.a.call(void 0, {transaction:{type:e}},a!=null?{signer:a}:{})});if("error"in n){if(e==="upgrade-wallet"&&y(n))return null;throw new (0, _chunkD2S37DJ5cjs.I)(JSON.stringify(n))}return n.id})}resolveStellarSigner(e){return e==null?this.signerManager.require().locator():typeof e=="string"?e:this.resolveServerSignerApiLocator(e)}};_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunk36GZTRZXcjs.a,methodName:"stellarWallet.sendTransaction",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"sendTransaction",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunk36GZTRZXcjs.a,methodName:"stellarWallet.upgrade",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"upgrade",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunk36GZTRZXcjs.a,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}exports.a = h;
@@ -1 +1 @@
1
- import{a as r}from"./chunk-3NAV25KH.js";import{a as f}from"./chunk-JAXFDUNN.js";import{H as h}from"./chunk-KOHPRJDP.js";import{a as t}from"./chunk-INUEMQPG.js";import{c as u,h as l}from"./chunk-NU7VF7MC.js";import p from"bs58";import m from"tweetnacl";import{isValidSolanaAddress as y,WithLoggerContext as v}from"@crossmint/common-sdk-base";var c=class c extends r{constructor(e){super({chain:e.chain,address:e.address,owner:e.owner,options:r.getOptions(e),alias:e.alias,recovery:r.getRecoverySigners(e),apiRecoveryServerSignerAddresses:r.getApiRecoveryServerSignerAddresses(e),apiDelegatedServerSignerAddresses:r.getApiDelegatedServerSignerAddresses(e),signer:e.signer,signers:r.getInitialSigners(e)},r.getApiClient(e))}static from(e){if(!y(e.address))throw new Error("Wallet is not a Solana wallet");return new c(e)}sendTransaction(e){return l(this,null,function*(){var g,S;t.info("solanaWallet.sendTransaction.start"),yield this.preAuthIfNeeded();let n=yield this.createTransaction(e);if((g=e.options)!=null&&g.prepareOnly)return t.info("solanaWallet.sendTransaction.prepared",{transactionId:n.id}),{hash:void 0,explorerLink:void 0,transactionId:n.id};let i={additionalSigners:(S=e.additionalSigners)==null?void 0:S.map(o=>new f({type:"external-wallet",address:o.publicKey.toString(),locator:`external-wallet:${o.publicKey.toString()}`,onSign:d=>(d.sign([o]),Promise.resolve(d)),onSignBytes:d=>Promise.resolve(p.encode(m.sign.detached(p.decode(d),o.secretKey)))}))},a=yield this.approveTransactionAndWait(n.id,i);return t.info("solanaWallet.sendTransaction.success",{transactionId:n.id,hash:a.hash}),a})}createTransaction(e){return l(this,null,function*(){var a;let n;((a=e.options)==null?void 0:a.signer)==null?n=this.signerManager.require().locator():typeof e.options.signer=="string"?n=e.options.signer:n=this.resolveServerSignerApiLocator(e.options.signer);let s;"serializedTransaction"in e?s=e.serializedTransaction:s=p.encode(e.transaction.serialize());let i=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:s,signer:n}});if("error"in i)throw new h(JSON.stringify(i));return i})}};u([v({logger:t,methodName:"solanaWallet.sendTransaction",buildContext(e){return{chain:e.chain,address:e.address}}})],c.prototype,"sendTransaction",1);var T=c;export{T as a};
1
+ import{a as r}from"./chunk-C5LIXILN.js";import{a as f}from"./chunk-ECKSTWA3.js";import{I as h}from"./chunk-4I3EXM4B.js";import{a as t}from"./chunk-2YLAHC7J.js";import{c as u,h as l}from"./chunk-NU7VF7MC.js";import p from"bs58";import m from"tweetnacl";import{isValidSolanaAddress as y,WithLoggerContext as v}from"@crossmint/common-sdk-base";var c=class c extends r{constructor(e){super({chain:e.chain,address:e.address,owner:e.owner,options:r.getOptions(e),alias:e.alias,recovery:r.getRecoverySigners(e),apiRecoveryServerSignerAddresses:r.getApiRecoveryServerSignerAddresses(e),apiDelegatedServerSignerAddresses:r.getApiDelegatedServerSignerAddresses(e),signer:e.signer,signers:r.getInitialSigners(e)},r.getApiClient(e))}static from(e){if(!y(e.address))throw new Error("Wallet is not a Solana wallet");return new c(e)}sendTransaction(e){return l(this,null,function*(){var g,S;t.info("solanaWallet.sendTransaction.start"),yield this.preAuthIfNeeded();let n=yield this.createTransaction(e);if((g=e.options)!=null&&g.prepareOnly)return t.info("solanaWallet.sendTransaction.prepared",{transactionId:n.id}),{hash:void 0,explorerLink:void 0,transactionId:n.id};let i={additionalSigners:(S=e.additionalSigners)==null?void 0:S.map(o=>new f({type:"external-wallet",address:o.publicKey.toString(),locator:`external-wallet:${o.publicKey.toString()}`,onSign:d=>(d.sign([o]),Promise.resolve(d)),onSignBytes:d=>Promise.resolve(p.encode(m.sign.detached(p.decode(d),o.secretKey)))}))},a=yield this.approveTransactionAndWait(n.id,i);return t.info("solanaWallet.sendTransaction.success",{transactionId:n.id,hash:a.hash}),a})}createTransaction(e){return l(this,null,function*(){var a;let n;((a=e.options)==null?void 0:a.signer)==null?n=this.signerManager.require().locator():typeof e.options.signer=="string"?n=e.options.signer:n=this.resolveServerSignerApiLocator(e.options.signer);let s;"serializedTransaction"in e?s=e.serializedTransaction:s=p.encode(e.transaction.serialize());let i=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:s,signer:n}});if("error"in i)throw new h(JSON.stringify(i));return i})}};u([v({logger:t,methodName:"solanaWallet.sendTransaction",buildContext(e){return{chain:e.chain,address:e.address}}})],c.prototype,"sendTransaction",1);var T=c;export{T as a};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkCZC2MNVKcjs = require('./chunk-CZC2MNVK.cjs');var t={type:"phone",validateConfig(n){if(!("phone"in n)||n.phone==null)throw new Error("Phone signer requires a phone number")},buildInternalConfig(n,e){let i=n;return{type:"phone",phone:i.phone,channel:i.channel,locator:`phone:${i.phone}`,address:e.walletAddress,crossmint:e.crossmint,clientTEEConnection:e.clientTEEConnection,resetSignerFrame:e.resetSignerFrame,onAuthRequired:e.onAuthRequired}},canAutoAssemble(){return!0},addSignerPayload(n){return _chunkCZC2MNVKcjs.b.call(void 0, n)},matchesRecovery(n,e){return _chunkCZC2MNVKcjs.b.call(void 0, n)===_chunkCZC2MNVKcjs.b.call(void 0, e)},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:"phone",validateConfig(n){if(!("phone"in n)||n.phone==null)throw new Error("Phone signer requires a phone number")},buildInternalConfig(n,e){let i=n;return{type:"phone",phone:i.phone,channel:i.channel,locator:`phone:${i.phone}`,address:e.walletAddress,crossmint:e.crossmint,clientTEEConnection:e.clientTEEConnection,resetSignerFrame:e.resetSignerFrame,onAuthRequired:e.onAuthRequired}},canAutoAssemble(){return!0},addSignerPayload(n){return _chunkWSDMIQNGcjs.b.call(void 0, n)},matchesRecovery(n,e){return _chunkWSDMIQNGcjs.b.call(void 0, n)===_chunkWSDMIQNGcjs.b.call(void 0, e)},adoptsRecoveryConfigOnMatch:!0,signerUnavailableReason:()=>null};exports.a = t;
@@ -0,0 +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 _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 _chunkW3BYSI7Fcjs = require('./chunk-W3BYSI7F.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 _chunkW3BYSI7Fcjs.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 _chunkW3BYSI7Fcjs.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 _chunkW3BYSI7Fcjs = require('./chunk-W3BYSI7F.cjs');var _chunkM42AKAZKcjs = require('./chunk-M42AKAZK.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:{};_chunkW3BYSI7Fcjs.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,_chunkM42AKAZKcjs.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 o}from"./chunk-KOHPRJDP.js";import{a as i}from"./chunk-INUEMQPG.js";import{b as c,c as l}from"./chunk-MDAPK5FG.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 h=class extends P{constructor(e){super(e,{internalConfig:{sdkMetadata:{name:l,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 p=`${this.apiPrefix}/${e}/signers/${t}${a.size>0?`?${a.toString()}`:""}`;return(yield this.delete(p,{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(p){}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 o("Invalid API key");return this.parsedAPIKey.environment}get projectId(){if(!this.parsedAPIKey.isValid)throw new o("Invalid API key");return this.parsedAPIKey.projectId}get headers(){return{"Content-Type":"application/json"}}};export{h 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};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkSTYSP6KLcjs = require('./chunk-STYSP6KL.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');var s=e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunkDSIFRRBScjs.a.call(void 0, {url:"/v1-alpha2/wallets/{walletLocator}/balances"},e))},C= exports.b =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {url:"/v1-alpha2/wallets/{walletLocator}/balances"},e),{headers:_chunkDSIFRRBScjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},i= exports.c =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {url:"/unstable/wallets/me{walletType}/tokens/{tokenLocator}/transfers"},e),{headers:_chunkDSIFRRBScjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},c= exports.d =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunkDSIFRRBScjs.a.call(void 0, {url:"/unstable/wallets/me{walletLocator}/transfers"},e))},d= exports.e =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunkDSIFRRBScjs.a.call(void 0, {url:"/unstable/wallets/{walletLocator}/transfers"},e))},p= exports.f =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {url:"/unstable/wallets/{walletLocator}/tokens/{tokenLocator}/transfers"},e),{headers:_chunkDSIFRRBScjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},w= exports.g =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunkDSIFRRBScjs.a.call(void 0, {url:"/unstable/wallets/{walletLocator}/balances"},e))},T= exports.h =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/me{walletLocator}/transactions/{transactionId}/approvals"},e),{headers:_chunkDSIFRRBScjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},u= exports.i =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/me{walletLocator}/transactions/{transactionId}"},e))},W= exports.j =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/me{walletLocator}/transactions"},e))},V= exports.k =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/me{walletLocator}/transactions"},e),{headers:_chunkDSIFRRBScjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},h= exports.l =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/me{walletLocator}/tokens/{tokenLocator}/transfers"},e),{headers:_chunkDSIFRRBScjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},E= exports.m =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).delete(_chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/me{walletLocator}/signers/{signer}"},e))},O= exports.n =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/me{walletLocator}/signers/{signer}"},e))},g= exports.o =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/me{walletLocator}/signers"},e),{headers:_chunkDSIFRRBScjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},S= exports.p =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/me{walletLocator}/signatures/{signatureId}/approvals"},e),{headers:_chunkDSIFRRBScjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},D= exports.q =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/me{walletLocator}/signatures/{signatureId}"},e))},G= exports.r =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/me{walletLocator}/signatures"},e))},R= exports.s =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/me{walletLocator}/signatures"},e),{headers:_chunkDSIFRRBScjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},b= exports.t =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/me{walletLocator}"},e))},M= exports.u =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/me"},e),{headers:_chunkDSIFRRBScjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},v= exports.v =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).delete(_chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/card-providers/{providerName}"},e))},x= exports.w =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).patch(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/card-providers/{providerName}"},e),{headers:_chunkDSIFRRBScjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},L= exports.x =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/card-providers"},e),{headers:_chunkDSIFRRBScjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},k= exports.y =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/transactions/{transactionId}/approvals"},e),{headers:_chunkDSIFRRBScjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},B= exports.z =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/transactions/{transactionId}"},e))},m= exports.A =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/transactions"},e))},f= exports.B =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/transactions"},e),{headers:_chunkDSIFRRBScjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},A= exports.C =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/tokens/{tokenLocator}/transfers/{transactionId}"},e))},y= exports.D =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/tokens/{tokenLocator}/transfers"},e),{headers:_chunkDSIFRRBScjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},F= exports.E =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).delete(_chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/signers/{signer}"},e))},U= exports.F =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/signers/{signer}"},e))},j= exports.G =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/signers"},e),{headers:_chunkDSIFRRBScjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},P= exports.H =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/signatures/{signatureId}/approvals"},e),{headers:_chunkDSIFRRBScjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},q= exports.I =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/signatures/{signatureId}"},e))},I= exports.J =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/signatures"},e))},N= exports.K =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/signatures"},e),{headers:_chunkDSIFRRBScjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},_= exports.L =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).delete(_chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/cards/{cardLocator}"},e))},z= exports.M =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/cards/{cardLocator}"},e))},H= exports.N =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/cards"},e))},J= exports.O =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/cards"},e),{headers:_chunkDSIFRRBScjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},K= exports.P =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/balances"},e))},Q= exports.Q =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}"},e))},X= exports.R =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets"},e),{headers:_chunkDSIFRRBScjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},Y= exports.S =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunkDSIFRRBScjs.a.call(void 0, {url:"/2024-09-26/wallets/{walletLocator}/balances"},e))},Z= exports.T =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {url:"/2024-09-26/wallets/{walletLocator}/balances"},e),{headers:_chunkDSIFRRBScjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))};exports.a = s; exports.b = C; exports.c = i; exports.d = c; exports.e = d; exports.f = p; exports.g = w; exports.h = T; exports.i = u; exports.j = W; exports.k = V; exports.l = h; exports.m = E; exports.n = O; exports.o = g; exports.p = S; exports.q = D; exports.r = G; exports.s = R; exports.t = b; exports.u = M; exports.v = v; exports.w = x; exports.x = L; exports.y = k; exports.z = B; exports.A = m; exports.B = f; exports.C = A; exports.D = y; exports.E = F; exports.F = U; exports.G = j; exports.H = P; exports.I = q; exports.J = I; exports.K = N; exports.L = _; exports.M = z; exports.N = H; exports.O = J; exports.P = K; exports.Q = Q; exports.R = X; exports.S = Y; exports.T = Z;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkSTYSP6KLcjs = require('./chunk-STYSP6KL.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');var s=e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunkDSIFRRBScjs.a.call(void 0, {url:"/v1-alpha2/wallets/{walletLocator}/balances"},e))},C= exports.b =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {url:"/v1-alpha2/wallets/{walletLocator}/balances"},e),{headers:_chunkDSIFRRBScjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},c= exports.c =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {url:"/unstable/wallets/me{walletType}/tokens/{tokenLocator}/transfers"},e),{headers:_chunkDSIFRRBScjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},i= exports.d =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunkDSIFRRBScjs.a.call(void 0, {url:"/unstable/wallets/me{walletLocator}/transfers"},e))},d= exports.e =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunkDSIFRRBScjs.a.call(void 0, {url:"/unstable/wallets/{walletLocator}/transfers"},e))},p= exports.f =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {url:"/unstable/wallets/{walletLocator}/tokens/{tokenLocator}/transfers"},e),{headers:_chunkDSIFRRBScjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},w= exports.g =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunkDSIFRRBScjs.a.call(void 0, {url:"/unstable/wallets/{walletLocator}/balances"},e))},T= exports.h =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/me{walletLocator}/transactions/{transactionId}/approvals"},e),{headers:_chunkDSIFRRBScjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},W= exports.i =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/me{walletLocator}/transactions/{transactionId}"},e))},u= exports.j =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/me{walletLocator}/transactions"},e))},h= exports.k =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/me{walletLocator}/transactions"},e),{headers:_chunkDSIFRRBScjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},V= exports.l =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/me{walletLocator}/tokens/{tokenLocator}/transfers"},e),{headers:_chunkDSIFRRBScjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},E= exports.m =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).delete(_chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/me{walletLocator}/signers/{signer}"},e))},O= exports.n =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/me{walletLocator}/signers/{signer}"},e))},g= exports.o =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/me{walletLocator}/signers"},e),{headers:_chunkDSIFRRBScjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},S= exports.p =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/me{walletLocator}/signatures/{signatureId}/approvals"},e),{headers:_chunkDSIFRRBScjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},R= exports.q =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/me{walletLocator}/signatures/{signatureId}"},e))},D= exports.r =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/me{walletLocator}/signatures"},e))},G= exports.s =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/me{walletLocator}/signatures"},e),{headers:_chunkDSIFRRBScjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},M= exports.t =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/me{walletLocator}"},e))},v= exports.u =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/me"},e),{headers:_chunkDSIFRRBScjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},b= exports.v =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).delete(_chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/card-providers/{providerName}"},e))},x= exports.w =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).patch(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/card-providers/{providerName}"},e),{headers:_chunkDSIFRRBScjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},y= exports.x =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/card-providers"},e),{headers:_chunkDSIFRRBScjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},L= exports.y =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/transactions/{transactionId}/approvals"},e),{headers:_chunkDSIFRRBScjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},m= exports.z =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/transactions/{transactionId}"},e))},k= exports.A =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/transactions"},e))},A= exports.B =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/transactions"},e),{headers:_chunkDSIFRRBScjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},B= exports.C =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/tokens/{tokenLocator}/transfers/{transactionId}"},e))},f= exports.D =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/tokens/{tokenLocator}/transfers"},e),{headers:_chunkDSIFRRBScjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},F= exports.E =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).delete(_chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/signers/{signer}"},e))},U= exports.F =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/signers/{signer}"},e))},j= exports.G =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/signers"},e),{headers:_chunkDSIFRRBScjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},P= exports.H =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/me{walletLocator}/recovery-methods"},e),{headers:_chunkDSIFRRBScjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},q= exports.I =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).delete(_chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/me{walletLocator}/recovery-methods/{signer}"},e))},I= exports.J =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/recovery-methods"},e),{headers:_chunkDSIFRRBScjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},N= exports.K =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).delete(_chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/recovery-methods/{signer}"},e))},_= exports.L =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/signatures/{signatureId}/approvals"},e),{headers:_chunkDSIFRRBScjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},z= exports.M =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/signatures/{signatureId}"},e))},H= exports.N =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/signatures"},e))},J= exports.O =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/signatures"},e),{headers:_chunkDSIFRRBScjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},K= exports.P =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).delete(_chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/cards/{cardLocator}"},e))},Q= exports.Q =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/cards/{cardLocator}"},e))},X= exports.R =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/cards"},e))},Y= exports.S =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/cards"},e),{headers:_chunkDSIFRRBScjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},Z= exports.T =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}/balances"},e))},$= exports.U =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets/{walletLocator}"},e))},ee= exports.V =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {url:"/2025-06-09/wallets"},e),{headers:_chunkDSIFRRBScjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))},re= exports.W =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).get(_chunkDSIFRRBScjs.a.call(void 0, {url:"/2024-09-26/wallets/{walletLocator}/balances"},e))},te= exports.X =e=>{var r;return((r=e.client)!=null?r:_chunkSTYSP6KLcjs.a).post(_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {url:"/2024-09-26/wallets/{walletLocator}/balances"},e),{headers:_chunkDSIFRRBScjs.a.call(void 0, {"Content-Type":"application/json"},e.headers)}))};exports.a = s; exports.b = C; exports.c = c; exports.d = i; exports.e = d; exports.f = p; exports.g = w; exports.h = T; exports.i = W; exports.j = u; exports.k = h; exports.l = V; exports.m = E; exports.n = O; exports.o = g; exports.p = S; exports.q = R; exports.r = D; exports.s = G; exports.t = M; exports.u = v; exports.v = b; exports.w = x; exports.x = y; exports.y = L; exports.z = m; exports.A = k; exports.B = A; exports.C = B; exports.D = f; exports.E = F; exports.F = U; exports.G = j; exports.H = P; exports.I = q; exports.J = I; exports.K = N; exports.L = _; exports.M = z; exports.N = H; exports.O = J; exports.P = K; exports.Q = Q; exports.R = X; exports.S = Y; exports.T = Z; exports.U = $; exports.V = ee; exports.W = re; exports.X = te;
@@ -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 _chunkW3BYSI7Fcjs = require('./chunk-W3BYSI7F.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){_chunkW3BYSI7Fcjs.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:_chunkW3BYSI7Fcjs.a,methodName:"deviceSignerKeyStorage.generateKey"})],c.prototype,"generateKey",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkW3BYSI7Fcjs.a,methodName:"deviceSignerKeyStorage.mapAddressToKey"})],c.prototype,"mapAddressToKey",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkW3BYSI7Fcjs.a,methodName:"deviceSignerKeyStorage.getKey"})],c.prototype,"getKey",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkW3BYSI7Fcjs.a,methodName:"deviceSignerKeyStorage.hasKey"})],c.prototype,"hasKey",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkW3BYSI7Fcjs.a,methodName:"deviceSignerKeyStorage.signMessage"})],c.prototype,"signMessage",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkW3BYSI7Fcjs.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-C2QJ3WKC.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};