@crossmint/wallets-sdk 1.4.0 → 1.4.1

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 (171) hide show
  1. package/dist/api/__tests__/constants.d.cts +1 -1
  2. package/dist/api/__tests__/constants.d.ts +1 -1
  3. package/dist/api/__tests__/test-utils.cjs +1 -1
  4. package/dist/api/__tests__/test-utils.d.cts +1 -1
  5. package/dist/api/__tests__/test-utils.d.ts +1 -1
  6. package/dist/api/__tests__/test-utils.js +1 -1
  7. package/dist/api/client.cjs +1 -1
  8. package/dist/api/client.d.cts +1 -1
  9. package/dist/api/client.d.ts +1 -1
  10. package/dist/api/client.js +1 -1
  11. package/dist/api/index.cjs +1 -1
  12. package/dist/api/index.d.cts +1 -1
  13. package/dist/api/index.d.ts +1 -1
  14. package/dist/api/index.js +1 -1
  15. package/dist/api/types.d.cts +1 -1
  16. package/dist/api/types.d.ts +1 -1
  17. package/dist/chains/chains.cjs +1 -1
  18. package/dist/chains/chains.js +1 -1
  19. package/dist/{chunk-BAUUDBGT.js → chunk-2K5HK56F.js} +1 -1
  20. package/dist/{chunk-6HOOT6LH.js → chunk-2SD7X4WK.js} +1 -1
  21. package/dist/{chunk-EIRVLXOC.js → chunk-2ZRCE5CX.js} +1 -1
  22. package/dist/{chunk-RWQ6ZQST.js → chunk-3ISCHYRJ.js} +1 -1
  23. package/dist/chunk-4KGM7M2B.js +1 -0
  24. package/dist/{chunk-F2HEHICC.cjs → chunk-5NP5DTTC.cjs} +1 -1
  25. package/dist/chunk-6QCKGV44.cjs +1 -0
  26. package/dist/{chunk-SI4L3UZ4.cjs → chunk-7FESCNM4.cjs} +1 -1
  27. package/dist/{chunk-PG7BGWKX.js → chunk-7SSRCAY5.js} +1 -1
  28. package/dist/{chunk-JFG54X5X.cjs → chunk-ALHK57YG.cjs} +1 -1
  29. package/dist/{chunk-XCIS2OND.js → chunk-B2CQ3W4K.js} +1 -1
  30. package/dist/{chunk-XEL7JKRY.js → chunk-COSMEPV7.js} +1 -1
  31. package/dist/chunk-EHMQ5WD7.cjs +1 -0
  32. package/dist/{chunk-52I473WC.cjs → chunk-H7PU3STI.cjs} +1 -1
  33. package/dist/{chunk-A3J3367O.cjs → chunk-HJPVODRW.cjs} +1 -1
  34. package/dist/{chunk-J4XCFNQH.js → chunk-IACFN22W.js} +1 -1
  35. package/dist/{chunk-BI3AUJVK.cjs → chunk-IMF5Z7BC.cjs} +1 -1
  36. package/dist/{chunk-ZH3WV7OE.js → chunk-IR7XWJVH.js} +1 -1
  37. package/dist/{chunk-BTMBO7VM.cjs → chunk-J4IMLBTS.cjs} +2 -2
  38. package/dist/{chunk-AAUS7KTR.cjs → chunk-JJIGKUQA.cjs} +1 -1
  39. package/dist/{chunk-KW2623VI.cjs → chunk-LFUTA2C4.cjs} +1 -1
  40. package/dist/chunk-PYIURK5B.js +1 -0
  41. package/dist/{chunk-FXCUVWXJ.js → chunk-Q65NMVP3.js} +1 -1
  42. package/dist/chunk-QTCM42EB.js +3 -0
  43. package/dist/{chunk-CFB27BFV.cjs → chunk-SFXFZ2J5.cjs} +1 -1
  44. package/dist/{chunk-4GHTG2VD.js → chunk-SQW56WQT.js} +1 -1
  45. package/dist/{chunk-4LXI2OQW.cjs → chunk-SSQAEYUV.cjs} +1 -1
  46. package/dist/{chunk-X7E2YEIV.cjs → chunk-UQ72BJGO.cjs} +1 -1
  47. package/dist/{chunk-UBDPBFAR.js → chunk-VOVJ4RNT.js} +1 -1
  48. package/dist/{chunk-WUNTNM5R.cjs → chunk-VQ267WBR.cjs} +1 -1
  49. package/dist/{chunk-4GEG5JA6.js → chunk-WDLFZXBG.js} +1 -1
  50. package/dist/chunk-Y55LWZDS.js +1 -0
  51. package/dist/{chunk-RLBY6JO3.cjs → chunk-YK3YZZ5F.cjs} +1 -1
  52. package/dist/{chunk-AET7QPSV.cjs → chunk-YKIPDFOB.cjs} +1 -1
  53. package/dist/index.cjs +1 -1
  54. package/dist/index.d.cts +1 -1
  55. package/dist/index.d.ts +1 -1
  56. package/dist/index.js +1 -1
  57. package/dist/logger/index.cjs +1 -1
  58. package/dist/logger/index.js +1 -1
  59. package/dist/logger/init.cjs +1 -1
  60. package/dist/logger/init.js +1 -1
  61. package/dist/sdk.cjs +1 -1
  62. package/dist/sdk.d.cts +1 -1
  63. package/dist/sdk.d.ts +1 -1
  64. package/dist/sdk.js +1 -1
  65. package/dist/signers/device.d.cts +1 -1
  66. package/dist/signers/device.d.ts +1 -1
  67. package/dist/signers/evm-api-key.d.cts +1 -1
  68. package/dist/signers/evm-api-key.d.ts +1 -1
  69. package/dist/signers/evm-external-wallet.d.cts +1 -1
  70. package/dist/signers/evm-external-wallet.d.ts +1 -1
  71. package/dist/signers/external-wallet-signer.d.cts +1 -1
  72. package/dist/signers/external-wallet-signer.d.ts +1 -1
  73. package/dist/signers/index.cjs +1 -1
  74. package/dist/signers/index.d.cts +1 -1
  75. package/dist/signers/index.d.ts +1 -1
  76. package/dist/signers/index.js +1 -1
  77. package/dist/signers/non-custodial/index.cjs +1 -1
  78. package/dist/signers/non-custodial/index.d.cts +1 -1
  79. package/dist/signers/non-custodial/index.d.ts +1 -1
  80. package/dist/signers/non-custodial/index.js +1 -1
  81. package/dist/signers/non-custodial/ncs-evm-signer.cjs +1 -1
  82. package/dist/signers/non-custodial/ncs-evm-signer.d.cts +1 -1
  83. package/dist/signers/non-custodial/ncs-evm-signer.d.ts +1 -1
  84. package/dist/signers/non-custodial/ncs-evm-signer.js +1 -1
  85. package/dist/signers/non-custodial/ncs-signer.cjs +1 -1
  86. package/dist/signers/non-custodial/ncs-signer.d.cts +1 -1
  87. package/dist/signers/non-custodial/ncs-signer.d.ts +1 -1
  88. package/dist/signers/non-custodial/ncs-signer.js +1 -1
  89. package/dist/signers/non-custodial/ncs-solana-signer.cjs +1 -1
  90. package/dist/signers/non-custodial/ncs-solana-signer.d.cts +1 -1
  91. package/dist/signers/non-custodial/ncs-solana-signer.d.ts +1 -1
  92. package/dist/signers/non-custodial/ncs-solana-signer.js +1 -1
  93. package/dist/signers/non-custodial/ncs-stellar-signer.cjs +1 -1
  94. package/dist/signers/non-custodial/ncs-stellar-signer.d.cts +1 -1
  95. package/dist/signers/non-custodial/ncs-stellar-signer.d.ts +1 -1
  96. package/dist/signers/non-custodial/ncs-stellar-signer.js +1 -1
  97. package/dist/signers/passkey.d.cts +1 -1
  98. package/dist/signers/passkey.d.ts +1 -1
  99. package/dist/signers/server/assemble-server-signer.d.cts +1 -1
  100. package/dist/signers/server/assemble-server-signer.d.ts +1 -1
  101. package/dist/signers/server/evm-server-signer.d.cts +1 -1
  102. package/dist/signers/server/evm-server-signer.d.ts +1 -1
  103. package/dist/signers/server/helpers/derive-server-signer.d.cts +1 -1
  104. package/dist/signers/server/helpers/derive-server-signer.d.ts +1 -1
  105. package/dist/signers/server/helpers/index.d.cts +1 -1
  106. package/dist/signers/server/helpers/index.d.ts +1 -1
  107. package/dist/signers/server/index.d.cts +1 -1
  108. package/dist/signers/server/index.d.ts +1 -1
  109. package/dist/signers/server/solana-server-signer.d.cts +1 -1
  110. package/dist/signers/server/solana-server-signer.d.ts +1 -1
  111. package/dist/signers/server/stellar-server-signer.d.cts +1 -1
  112. package/dist/signers/server/stellar-server-signer.d.ts +1 -1
  113. package/dist/signers/solana-api-key.d.cts +1 -1
  114. package/dist/signers/solana-api-key.d.ts +1 -1
  115. package/dist/signers/solana-external-wallet.d.cts +1 -1
  116. package/dist/signers/solana-external-wallet.d.ts +1 -1
  117. package/dist/signers/stellar-external-wallet.d.cts +1 -1
  118. package/dist/signers/stellar-external-wallet.d.ts +1 -1
  119. package/dist/signers/types.cjs +1 -1
  120. package/dist/signers/types.d.cts +1 -1
  121. package/dist/signers/types.d.ts +1 -1
  122. package/dist/signers/types.js +1 -1
  123. package/dist/{types-CRMCeDuN.d.ts → types-Br5La8FI.d.ts} +5 -1
  124. package/dist/{types-5kZcVs3E.d.cts → types-Cc0Mr7mS.d.cts} +5 -1
  125. package/dist/utils/constants.cjs +1 -1
  126. package/dist/utils/constants.js +1 -1
  127. package/dist/utils/device-signers/IframeDeviceSignerKeyStorage.cjs +1 -1
  128. package/dist/utils/device-signers/IframeDeviceSignerKeyStorage.js +1 -1
  129. package/dist/utils/device-signers/createDeviceSigner.d.cts +1 -1
  130. package/dist/utils/device-signers/createDeviceSigner.d.ts +1 -1
  131. package/dist/utils/device-signers/index.cjs +1 -1
  132. package/dist/utils/device-signers/index.d.cts +1 -1
  133. package/dist/utils/device-signers/index.d.ts +1 -1
  134. package/dist/utils/device-signers/index.js +1 -1
  135. package/dist/utils/signer-locator.d.cts +1 -1
  136. package/dist/utils/signer-locator.d.ts +1 -1
  137. package/dist/utils/signer-mapping.d.cts +1 -1
  138. package/dist/utils/signer-mapping.d.ts +1 -1
  139. package/dist/wallets/__tests__/test-helpers.cjs +1 -1
  140. package/dist/wallets/__tests__/test-helpers.d.cts +1 -1
  141. package/dist/wallets/__tests__/test-helpers.d.ts +1 -1
  142. package/dist/wallets/__tests__/test-helpers.js +1 -1
  143. package/dist/wallets/evm.cjs +1 -1
  144. package/dist/wallets/evm.d.cts +1 -1
  145. package/dist/wallets/evm.d.ts +1 -1
  146. package/dist/wallets/evm.js +1 -1
  147. package/dist/wallets/solana.cjs +1 -1
  148. package/dist/wallets/solana.d.cts +1 -1
  149. package/dist/wallets/solana.d.ts +1 -1
  150. package/dist/wallets/solana.js +1 -1
  151. package/dist/wallets/stellar.cjs +1 -1
  152. package/dist/wallets/stellar.d.cts +1 -1
  153. package/dist/wallets/stellar.d.ts +1 -1
  154. package/dist/wallets/stellar.js +1 -1
  155. package/dist/wallets/types.d.cts +1 -1
  156. package/dist/wallets/types.d.ts +1 -1
  157. package/dist/wallets/wallet-factory.cjs +1 -1
  158. package/dist/wallets/wallet-factory.d.cts +1 -1
  159. package/dist/wallets/wallet-factory.d.ts +1 -1
  160. package/dist/wallets/wallet-factory.js +1 -1
  161. package/dist/wallets/wallet.cjs +1 -1
  162. package/dist/wallets/wallet.d.cts +1 -1
  163. package/dist/wallets/wallet.d.ts +1 -1
  164. package/dist/wallets/wallet.js +1 -1
  165. package/package.json +1 -1
  166. package/dist/chunk-6RX65NOA.js +0 -1
  167. package/dist/chunk-AS2YN2YC.cjs +0 -1
  168. package/dist/chunk-QQ46JY33.js +0 -1
  169. package/dist/chunk-XX6FO5QS.js +0 -1
  170. package/dist/chunk-YSB7XIS7.js +0 -3
  171. package/dist/chunk-YYFLQQPV.cjs +0 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBTMBO7VMcjs = require('../chunk-BTMBO7VM.cjs');require('../chunk-CUHDOBKN.cjs');require('../chunk-YHV3672R.cjs');require('../chunk-A3J3367O.cjs');require('../chunk-3VYGTPRF.cjs');require('../chunk-NX256LAH.cjs');require('../chunk-KXKBZNET.cjs');require('../chunk-AET7QPSV.cjs');require('../chunk-5IC7UWND.cjs');require('../chunk-GZP2JQ6P.cjs');require('../chunk-IGRPHTXZ.cjs');require('../chunk-I3RWATD5.cjs');require('../chunk-ENU3EKBG.cjs');require('../chunk-3SVXPFSP.cjs');require('../chunk-4DJWSV7I.cjs');require('../chunk-YF5G4U6L.cjs');require('../chunk-PO6S7UR3.cjs');require('../chunk-RLBY6JO3.cjs');require('../chunk-4LXI2OQW.cjs');require('../chunk-BI3AUJVK.cjs');require('../chunk-YYFLQQPV.cjs');require('../chunk-JBP52JOH.cjs');require('../chunk-5FH7WFWL.cjs');require('../chunk-SPTXAOFR.cjs');require('../chunk-AS2YN2YC.cjs');require('../chunk-YGL4ITFK.cjs');require('../chunk-GEY3BU62.cjs');require('../chunk-PHPBBEXU.cjs');require('../chunk-A33BEWR7.cjs');require('../chunk-OGP7B5O3.cjs');require('../chunk-IJ632UXD.cjs');require('../chunk-E4EOD7MP.cjs');require('../chunk-SCEPJO4Q.cjs');require('../chunk-AAUS7KTR.cjs');require('../chunk-GEY574TH.cjs');require('../chunk-UE3WVHTM.cjs');require('../chunk-5X4EOJFG.cjs');require('../chunk-HRUMWG2F.cjs');require('../chunk-IR5WN6FQ.cjs');require('../chunk-OWQZPI3U.cjs');require('../chunk-CCIGWTAO.cjs');require('../chunk-CFB27BFV.cjs');require('../chunk-X7E2YEIV.cjs');require('../chunk-2GKPWQBQ.cjs');exports.Wallet = _chunkBTMBO7VMcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkJ4IMLBTScjs = require('../chunk-J4IMLBTS.cjs');require('../chunk-CUHDOBKN.cjs');require('../chunk-YHV3672R.cjs');require('../chunk-HJPVODRW.cjs');require('../chunk-3VYGTPRF.cjs');require('../chunk-NX256LAH.cjs');require('../chunk-KXKBZNET.cjs');require('../chunk-YKIPDFOB.cjs');require('../chunk-5IC7UWND.cjs');require('../chunk-GZP2JQ6P.cjs');require('../chunk-IGRPHTXZ.cjs');require('../chunk-I3RWATD5.cjs');require('../chunk-ENU3EKBG.cjs');require('../chunk-3SVXPFSP.cjs');require('../chunk-4DJWSV7I.cjs');require('../chunk-YF5G4U6L.cjs');require('../chunk-PO6S7UR3.cjs');require('../chunk-YK3YZZ5F.cjs');require('../chunk-SSQAEYUV.cjs');require('../chunk-IMF5Z7BC.cjs');require('../chunk-6QCKGV44.cjs');require('../chunk-JBP52JOH.cjs');require('../chunk-5FH7WFWL.cjs');require('../chunk-SPTXAOFR.cjs');require('../chunk-EHMQ5WD7.cjs');require('../chunk-YGL4ITFK.cjs');require('../chunk-GEY3BU62.cjs');require('../chunk-PHPBBEXU.cjs');require('../chunk-A33BEWR7.cjs');require('../chunk-OGP7B5O3.cjs');require('../chunk-IJ632UXD.cjs');require('../chunk-E4EOD7MP.cjs');require('../chunk-SCEPJO4Q.cjs');require('../chunk-JJIGKUQA.cjs');require('../chunk-GEY574TH.cjs');require('../chunk-UE3WVHTM.cjs');require('../chunk-5X4EOJFG.cjs');require('../chunk-HRUMWG2F.cjs');require('../chunk-IR5WN6FQ.cjs');require('../chunk-OWQZPI3U.cjs');require('../chunk-CCIGWTAO.cjs');require('../chunk-SFXFZ2J5.cjs');require('../chunk-UQ72BJGO.cjs');require('../chunk-2GKPWQBQ.cjs');exports.Wallet = _chunkJ4IMLBTScjs.a;
@@ -1,6 +1,6 @@
1
1
  import { WalletsTransactionV2025ResponseDtoClass } from '../api/gen/types.gen.cjs';
2
2
  import { ApiClient } from '../api/client.cjs';
3
- import { G as WalletOptions, a1 as RecoverySignerConfigForChain, u as SignerConfigForChain, t as SignerAdapter, q as ServerSignerConfig, B as Balances, a2 as FundWalletResponse, a3 as GetTransactionsResponse, a4 as GetTransactionSuccessResponse, z as Transfers, a5 as SendTokenTransactionOptions, a6 as UserLocator, T as Transaction, V as PrepareOnly, c as ApproveParams, a7 as ApproveResult, A as AddSignerOptions, k as ExternalWalletRegistrationConfig, a8 as AddSignerReturnType, s as Signer, p as RemoveSignerOptions, a9 as RemoveSignerReturnType, v as SignerLocator, aa as WalletLocator, b as ApproveOptions, ab as ApproveSignatureResponse, r as Signature } from '../types-5kZcVs3E.cjs';
3
+ import { H as WalletOptions, a3 as RecoverySignerConfigForChain, v as SignerConfigForChain, u as SignerAdapter, r as ServerSignerConfig, B as Balances, a4 as FundWalletResponse, a5 as GetTransactionsResponse, a6 as GetTransactionSuccessResponse, F as Transfers, a7 as SendTokenTransactionOptions, a8 as UserLocator, T as Transaction, Y as PrepareOnly, c as ApproveParams, a9 as ApproveResult, A as AddSignerOptions, l as ExternalWalletRegistrationConfig, aa as AddSignerReturnType, t as Signer, q as RemoveSignerOptions, ab as RemoveSignerReturnType, w as SignerLocator, ac as WalletLocator, b as ApproveOptions, ad as ApproveSignatureResponse, s as Signature } from '../types-Cc0Mr7mS.cjs';
4
4
  import { Chain } from '../chains/chains.cjs';
5
5
  import '@crossmint/common-sdk-base';
6
6
  import 'viem';
@@ -1,6 +1,6 @@
1
1
  import { WalletsTransactionV2025ResponseDtoClass } from '../api/gen/types.gen.js';
2
2
  import { ApiClient } from '../api/client.js';
3
- import { G as WalletOptions, a1 as RecoverySignerConfigForChain, u as SignerConfigForChain, t as SignerAdapter, q as ServerSignerConfig, B as Balances, a2 as FundWalletResponse, a3 as GetTransactionsResponse, a4 as GetTransactionSuccessResponse, z as Transfers, a5 as SendTokenTransactionOptions, a6 as UserLocator, T as Transaction, V as PrepareOnly, c as ApproveParams, a7 as ApproveResult, A as AddSignerOptions, k as ExternalWalletRegistrationConfig, a8 as AddSignerReturnType, s as Signer, p as RemoveSignerOptions, a9 as RemoveSignerReturnType, v as SignerLocator, aa as WalletLocator, b as ApproveOptions, ab as ApproveSignatureResponse, r as Signature } from '../types-CRMCeDuN.js';
3
+ import { H as WalletOptions, a3 as RecoverySignerConfigForChain, v as SignerConfigForChain, u as SignerAdapter, r as ServerSignerConfig, B as Balances, a4 as FundWalletResponse, a5 as GetTransactionsResponse, a6 as GetTransactionSuccessResponse, F as Transfers, a7 as SendTokenTransactionOptions, a8 as UserLocator, T as Transaction, Y as PrepareOnly, c as ApproveParams, a9 as ApproveResult, A as AddSignerOptions, l as ExternalWalletRegistrationConfig, aa as AddSignerReturnType, t as Signer, q as RemoveSignerOptions, ab as RemoveSignerReturnType, w as SignerLocator, ac as WalletLocator, b as ApproveOptions, ad as ApproveSignatureResponse, s as Signature } from '../types-Br5La8FI.js';
4
4
  import { Chain } from '../chains/chains.js';
5
5
  import '@crossmint/common-sdk-base';
6
6
  import 'viem';
@@ -1 +1 @@
1
- import{a}from"../chunk-YSB7XIS7.js";import"../chunk-TOAFCAVT.js";import"../chunk-N4IWDL6M.js";import"../chunk-BAUUDBGT.js";import"../chunk-IOSADDL5.js";import"../chunk-GOXB2RBF.js";import"../chunk-KZMDZJGM.js";import"../chunk-EIRVLXOC.js";import"../chunk-L52GDMSH.js";import"../chunk-6X5JEJD7.js";import"../chunk-QM3BB4E2.js";import"../chunk-F5NTM2RX.js";import"../chunk-OQZTL6ZG.js";import"../chunk-N355UETO.js";import"../chunk-3VRN3GKQ.js";import"../chunk-BITOMWYZ.js";import"../chunk-YDZRBHS3.js";import"../chunk-4GEG5JA6.js";import"../chunk-RWQ6ZQST.js";import"../chunk-PG7BGWKX.js";import"../chunk-QQ46JY33.js";import"../chunk-O6VBO7KG.js";import"../chunk-EM3D5Q3A.js";import"../chunk-EE4ITUGS.js";import"../chunk-6RX65NOA.js";import"../chunk-XNZLCUTY.js";import"../chunk-CKZYSQOK.js";import"../chunk-QVTKTDED.js";import"../chunk-XS5B3TUE.js";import"../chunk-M335XCYO.js";import"../chunk-YH7G2U6V.js";import"../chunk-2O6HQK34.js";import"../chunk-2YLRFJ66.js";import"../chunk-FXCUVWXJ.js";import"../chunk-S3DYQVRD.js";import"../chunk-KUP7H7X2.js";import"../chunk-FT5EVMLB.js";import"../chunk-SVIKBM3S.js";import"../chunk-KKQBZXFE.js";import"../chunk-5OYPWGMX.js";import"../chunk-455NK5LB.js";import"../chunk-UBDPBFAR.js";import"../chunk-XX6FO5QS.js";import"../chunk-J3R36SGJ.js";export{a as Wallet};
1
+ import{a}from"../chunk-QTCM42EB.js";import"../chunk-TOAFCAVT.js";import"../chunk-N4IWDL6M.js";import"../chunk-2K5HK56F.js";import"../chunk-IOSADDL5.js";import"../chunk-GOXB2RBF.js";import"../chunk-KZMDZJGM.js";import"../chunk-2ZRCE5CX.js";import"../chunk-L52GDMSH.js";import"../chunk-6X5JEJD7.js";import"../chunk-QM3BB4E2.js";import"../chunk-F5NTM2RX.js";import"../chunk-OQZTL6ZG.js";import"../chunk-N355UETO.js";import"../chunk-3VRN3GKQ.js";import"../chunk-BITOMWYZ.js";import"../chunk-YDZRBHS3.js";import"../chunk-WDLFZXBG.js";import"../chunk-3ISCHYRJ.js";import"../chunk-7SSRCAY5.js";import"../chunk-4KGM7M2B.js";import"../chunk-O6VBO7KG.js";import"../chunk-EM3D5Q3A.js";import"../chunk-EE4ITUGS.js";import"../chunk-PYIURK5B.js";import"../chunk-XNZLCUTY.js";import"../chunk-CKZYSQOK.js";import"../chunk-QVTKTDED.js";import"../chunk-XS5B3TUE.js";import"../chunk-M335XCYO.js";import"../chunk-YH7G2U6V.js";import"../chunk-2O6HQK34.js";import"../chunk-2YLRFJ66.js";import"../chunk-Q65NMVP3.js";import"../chunk-S3DYQVRD.js";import"../chunk-KUP7H7X2.js";import"../chunk-FT5EVMLB.js";import"../chunk-SVIKBM3S.js";import"../chunk-KKQBZXFE.js";import"../chunk-5OYPWGMX.js";import"../chunk-455NK5LB.js";import"../chunk-VOVJ4RNT.js";import"../chunk-Y55LWZDS.js";import"../chunk-J3R36SGJ.js";export{a as Wallet};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crossmint/wallets-sdk",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "repository": "https://github.com/Crossmint/crossmint-sdk",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Paella Labs Inc",
@@ -1 +0,0 @@
1
- var n=class extends Error{constructor(){super("Authentication was rejected by the user"),this.name="AuthRejectedError"}};function i(e){return e.type==="server"&&!("secret"in e)}function o(e){return e._exportPrivateKey!==void 0}export{n as a,i as b,o as c};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var n=class extends Error{constructor(){super("Authentication was rejected by the user"),this.name="AuthRejectedError"}};function t(e){return e.type==="server"&&!("secret"in e)}function i(e){return e._exportPrivateKey!==void 0}exports.a = n; exports.b = t; exports.c = i;
@@ -1 +0,0 @@
1
- import{a as g}from"./chunk-O6VBO7KG.js";import{a as l}from"./chunk-6RX65NOA.js";import{a as o}from"./chunk-UBDPBFAR.js";import{c as m,g as h}from"./chunk-J3R36SGJ.js";import{validateAPIKey as p,WithLoggerContext as w}from"@crossmint/common-sdk-base";var f=class{constructor(i){this.config=i;this._needsAuth=!0;this._authPromise=null;this._initializationPromise=null;typeof window!="undefined"&&(this._initializationPromise=this.initialize()),this.type=this.config.type}locator(){return this.config.locator}address(){return this.config.address}initialize(){return h(this,null,function*(){try{if(this.config.clientTEEConnection==null){let i=p(this.config.crossmint.apiKey);if(!i.isValid)throw new Error("Invalid API key");let t=new g({environment:i.environment});this.config.clientTEEConnection=yield t.initialize()}}finally{this._initializationPromise=null}})}getTEEConnection(){return h(this,null,function*(){if(this.config.clientTEEConnection==null){if(this._initializationPromise){if(yield this._initializationPromise,this.config.clientTEEConnection==null)throw new Error("Failed to initialize TEE connection");return this.config.clientTEEConnection}this._initializationPromise=this.initializeTEEConnection();try{yield this._initializationPromise}finally{this._initializationPromise=null}}if(this.config.clientTEEConnection==null)throw new Error("TEE connection is not initialized");return this.config.clientTEEConnection})}initializeTEEConnection(){return h(this,null,function*(){o.info("TEE connection not initialized, initializing now");let i=p(this.config.crossmint.apiKey);if(!i.isValid)throw new Error("Invalid API key");let t=new g({environment:i.environment});if(this.config.clientTEEConnection=yield t.initialize(),this.config.clientTEEConnection==null)throw new Error("Failed to initialize TEE connection");o.info("TEE connection initialized successfully")})}handleAuthRequired(){return h(this,null,function*(){var u;let i=yield this.getTEEConnection();if(this.config.onAuthRequired==null)throw new Error(`${this.type} signer requires the onAuthRequired callback to handle OTP verification. This callback manages the authentication flow (sending OTP and verifying user input). If using our React/React Native SDK, this is handled automatically by the provider. For other environments, implement: onAuthRequired: (needsAuth, sendOtp, verifyOtp, reject) => { /* your UI logic */ }`);o.info("get-status: sending request");let t=Date.now(),r=yield i.sendAction({event:"request:get-status",responseEvent:"response:get-status",data:{authData:{jwt:(u=this.config.crossmint.jwt)!=null?u:"",apiKey:this.config.crossmint.apiKey}},options:d}),n=Date.now()-t;if((r==null?void 0:r.status)!=="success")throw o.error("get-status: failed",{status:r==null?void 0:r.status,error:r==null?void 0:r.error,durationMs:n}),new Error(r==null?void 0:r.error);if(o.info("get-status: response received",{signerStatus:r.signerStatus,durationMs:n}),r.signerStatus==="ready"){this._needsAuth=!1;return}else this._needsAuth=!0;o.info("Auth required, initiating OTP flow",{needsAuth:this._needsAuth});let{promise:a,resolve:s,reject:c}=this.createAuthPromise();if(this._authPromise={promise:a,resolve:s,reject:c},this.config.onAuthRequired)try{yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),e=>this.verifyOtp(e),()=>h(this,null,function*(){o.info("Auth rejected",{authRejected:!0}),this._needsAuth=!1,this.config.onAuthRequired!=null&&(yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),e=>this.verifyOtp(e),()=>{var e;return(e=this._authPromise)==null?void 0:e.reject(new l)})),c(new l)}))}catch(e){o.error("handleAuthRequired error",{error:e}),c(e)}try{yield a}catch(e){throw o.error("handleAuthRequired promise error",{error:e}),e}})}ensureAuthenticated(){return h(this,null,function*(){yield this.handleAuthRequired()})}getJwtOrThrow(){let i=this.config.crossmint.jwt;if(i==null)throw new Error("JWT is required");return i}createAuthPromise(){let i,t;return{promise:new Promise((n,a)=>{i=n,t=a}),resolve:i,reject:t}}sendMessageWithOtp(){return h(this,null,function*(){var s,c;let i=yield this.getTEEConnection(),t=this.getAuthId();o.info("start-onboarding: sending request");let r=Date.now(),n=yield i.sendAction({event:"request:start-onboarding",responseEvent:"response:start-onboarding",data:{authData:{jwt:(s=this.config.crossmint.jwt)!=null?s:"",apiKey:this.config.crossmint.apiKey},data:{authId:t}},options:d}),a=Date.now()-r;if(o.info("start-onboarding: response received",{status:n==null?void 0:n.status,durationMs:a}),(n==null?void 0:n.status)==="success"&&n.signerStatus==="ready"){this._needsAuth=!1;return}(n==null?void 0:n.status)==="error"&&(o.error("start-onboarding: failed",{error:n.error}),(c=this._authPromise)==null||c.reject(new Error(n.error||"Failed to initiate OTP process.")))})}getAuthId(){return this.config.type==="email"?`email:${this.config.email}`:`phone:${this.config.phone}`}verifyOtp(i){return h(this,null,function*(){var a,s,c,u;let t;try{let e=yield this.getTEEConnection();o.info("complete-onboarding: sending request");let E=Date.now();t=yield e.sendAction({event:"request:complete-onboarding",responseEvent:"response:complete-onboarding",data:{authData:{jwt:(a=this.config.crossmint.jwt)!=null?a:"",apiKey:this.config.crossmint.apiKey},data:{onboardingAuthentication:{encryptedOtp:i}}},options:d}),o.info("complete-onboarding: response received",{status:t==null?void 0:t.status,durationMs:Date.now()-E})}catch(e){throw o.error("complete-onboarding: error",{error:e}),this._needsAuth=!0,(s=this._authPromise)==null||s.reject(e),e}if((t==null?void 0:t.status)==="success"){this._needsAuth=!1,this.config.onAuthRequired!=null&&(yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),e=>this.verifyOtp(e),()=>{var e;return(e=this._authPromise)==null?void 0:e.reject(new l)})),(c=this._authPromise)==null||c.resolve();return}o.error("complete-onboarding: OTP validation failed",{status:t==null?void 0:t.status}),this._needsAuth=!0;let r=(t==null?void 0:t.status)==="error"?t.error:"Failed to validate encrypted OTP",n=new Error(r);throw(u=this._authPromise)==null||u.reject(n),n})}_exportPrivateKey(i,t){return h(this,null,function*(){yield this.handleAuthRequired();let r=this.getJwtOrThrow(),{scheme:n,encoding:a}=this.getChainKeyParams();if(t!=null){let c=i.on("event:key-exported",u=>{i.off(c),u.status==="success"&&Promise.resolve().then(()=>t()).catch(()=>{console.error("[NCS Signer] onExport callback error")})})}let s=yield i.sendAction({event:"request:export-signer",responseEvent:"response:export-signer",data:{authData:{jwt:r,apiKey:this.config.crossmint.apiKey},data:{scheme:n,encoding:a}},options:d});if((s==null?void 0:s.status)==="error")throw new Error(s.error||"Failed to export private key")})}};m([w({logger:o,methodName:"handleAuthRequired"})],f.prototype,"handleAuthRequired",1);var d={timeoutMs:3e4};export{f as a,d as b};
@@ -1 +0,0 @@
1
- var s="@crossmint/wallets-sdk",t="1.4.0";var c="WALLETS_SDK",r=t,a=s,d=500;export{c as a,r as b,a as c,d};
@@ -1,3 +0,0 @@
1
- import{a as he}from"./chunk-N4IWDL6M.js";import{a as N}from"./chunk-GOXB2RBF.js";import{b as j,c as z}from"./chunk-KZMDZJGM.js";import{a as q}from"./chunk-EIRVLXOC.js";import{c as ue}from"./chunk-F5NTM2RX.js";import{a as ge}from"./chunk-QQ46JY33.js";import{a as de,b as W}from"./chunk-6RX65NOA.js";import{f as ce}from"./chunk-FXCUVWXJ.js";import{A as ae,B as oe,D as le,d as Y,e as Q,j as _,k as X,l as M,p as Z,s as G,t as ee,u as re,v as ie,w as V,x as te,y as ne,z as se}from"./chunk-5OYPWGMX.js";import{a as s}from"./chunk-UBDPBFAR.js";import{d as U}from"./chunk-XX6FO5QS.js";import{a as b,b as O,c as k,d as n,e as T,f as c,g as d}from"./chunk-J3R36SGJ.js";import{isValidAddress as pe,WithLoggerContext as P}from"@crossmint/common-sdk-base";var p,A,f,v,R,w,I,x,L,$,K,D,B,E=class{constructor(e,r){T(this,p);T(this,A);T(this,f);T(this,v);T(this,R);T(this,w,!1);T(this,I,!1);T(this,x,null);T(this,L,null);T(this,$,[]);T(this,K);T(this,D,null);T(this,B,!1);let{chain:i,address:t,owner:a,options:h,alias:o,recovery:l,apiRecoveryServerSignerAddress:g,apiDelegatedServerSignerAddresses:u,signers:S,signer:y}=e;c(this,f,r),this.chain=i,this.address=t,this.owner=a,c(this,A,h),this.alias=o,c(this,v,l),g!=null?c(this,L,g):l.type==="server"&&W(l)&&c(this,L,l.address),c(this,$,u!=null?u:[]),c(this,R,S!=null?S:[]),c(this,p,y),c(this,K,this.initDefaultSigner())}get signer(){return n(this,p)}waitForInit(){return d(this,null,function*(){yield n(this,K)})}initDeviceSigner(){return d(this,null,function*(){var t;let e=(t=n(this,A))==null?void 0:t.deviceSignerKeyStorage;if(e==null||n(this,B))return;let r={type:"device"};try{yield this.resolveDeviceSignerAvailability(r)}catch(a){s.error("wallet.initDeviceSigner.error",{error:a}),c(this,w,!0);return}if(n(this,w))return;let i=this.buildInternalSignerConfig(r);c(this,p,yield this.assembleFullSigner(i,e)),this.isApprovedSignerStatus(n(this,p).status)||(s.info("wallet.initDeviceSigner.pendingApproval",{signerLocator:n(this,p).locator(),status:n(this,p).status}),c(this,w,!0),c(this,I,!1))})}initDefaultSigner(){return d(this,null,function*(){if(n(this,p)!=null||(yield this.initDeviceSigner(),n(this,p)!=null||n(this,w)))return;let e=n(this,R).length===0?n(this,v):n(this,R).length===1?n(this,R)[0]:null;if(e==null||!this.isAutoAssemblableSignerConfig(e))return;let r=e===n(this,v);try{let i=this.buildInternalSignerConfig(e);c(this,p,yield this.assembleFullSigner(i,void 0,{isAdminSigner:r}))}catch(i){s.warn("wallet.initDefaultSigner.autoAssemblyFailed",{recoveryType:n(this,v).type,signerCount:n(this,R).length,error:i})}})}assembleRecoverySignerFallback(){return d(this,null,function*(){if(this.isAutoAssemblableSignerConfig(n(this,v)))try{let e=this.buildInternalSignerConfig(n(this,v));c(this,p,yield this.assembleFullSigner(e,void 0,{isAdminSigner:!0}))}catch(e){s.warn("wallet.recover.device.unsupportedFallback.autoAssemblyFailed",{recoveryType:n(this,v).type,error:e})}})}static getApiClient(e){return e.apiClient}static getOptions(e){return e.options}static getRecovery(e){return n(e,v)}static getInitialSigners(e){return n(e,R)}static getApiRecoveryServerSignerAddress(e){var r;return(r=n(e,L))!=null?r:void 0}static getApiDelegatedServerSignerAddresses(e){return n(e,$)}get apiClient(){return n(this,f)}get options(){return n(this,A)}deriveServerSignerCandidates(e){return ue(e,this.chain,n(this,f).projectId,n(this,f).environment)}matchResolvedServerSigner(e){if(n(this,x)==null)return null;let{primary:r,legacy:i}=this.deriveServerSignerCandidates(e),t=n(this,x).derivedAddress;return t===r.derivedAddress||i!=null&&t===i.derivedAddress?n(this,x):null}resolveServerSignerDerivation(e){let r=this.matchResolvedServerSigner(e);if(r!=null)return r;let{primary:i,legacy:t}=this.deriveServerSignerCandidates(e);return t!=null&&(t.derivedAddress===n(this,L)||n(this,R).some(a=>a.type==="server"&&W(a)&&a.address===t.derivedAddress)||n(this,$).includes(t.derivedAddress))?t:i}resolveServerSignerApiLocator(e){return`server:${this.resolveServerSignerDerivation(e).derivedAddress}`}get recovery(){return n(this,v)}balances(e){return d(this,null,function*(){s.info("wallet.balances.start");let r=this.resolveChainForEnvironment(),i;switch(this.chain){case"solana":i="sol";break;case"stellar":i="xlm";break;default:i="eth";break}let t=[i,"usdc",...e!=null?e:[]],a=yield n(this,f).getBalance(this.address,{chains:[r],tokens:t});if("error"in a)throw s.error("wallet.balances.error",{error:a}),new Error(`Failed to get balances for wallet: ${JSON.stringify(a.message)}`);return s.info("wallet.balances.success"),this.transformBalanceResponse(a,i,e)})}stagingFund(e,r){return d(this,null,function*(){s.info("wallet.stagingFund.start",{amount:e,chain:r!=null?r:this.chain});let i=yield this.apiClient.fundWallet(this.address,{amount:e,token:"usdxm",chain:r!=null?r:this.chain});if("error"in i)throw s.error("wallet.stagingFund.error",{error:i}),new Error(`Failed to fund wallet: ${JSON.stringify(i.message)}`);return s.info("wallet.stagingFund.success"),i})}transformBalanceResponse(e,r,i){let t=g=>{var y,C,F,H,J;let u=(y=g.chains)==null?void 0:y[this.chain],S={};return this.chain==="solana"&&u!=null&&"mintHash"in u?S={mintHash:u.mintHash}:this.chain==="stellar"&&u!=null&&"contractId"in u?S={contractId:u.contractId}:u!=null&&"contractAddress"in u&&(S={contractAddress:u.contractAddress}),b({symbol:(C=g.symbol)!=null?C:"",name:(F=g.name)!=null?F:"",amount:(H=g.amount)!=null?H:"0",decimals:g.decimals,rawAmount:(J=g.rawAmount)!=null?J:"0"},S)},a=e.find(g=>g.symbol===r),h=e.find(g=>g.symbol==="usdc"),o=e.filter(g=>{var u;return g.symbol!==r&&g.symbol!=="usdc"&&(i==null||i.includes((u=g.symbol)!=null?u:""))}),l=g=>{let u={symbol:g,name:g,amount:"0",decimals:0,rawAmount:"0"},S={};return this.chain==="solana"?S={mintHash:void 0}:this.chain==="stellar"?S={contractId:void 0}:S={contractAddress:void 0},b(b({},u),S)};return{nativeToken:a!=null?t(a):l(r),usdc:h!=null?t(h):l("usdc"),tokens:o.map(t)}}nfts(e){return d(this,null,function*(){return yield n(this,f).getNfts(O(b({},e),{chain:this.chain,address:this.address}))})}transactions(){return d(this,null,function*(){let e=yield n(this,f).getTransactions(this.walletLocator);if("error"in e)throw new Error(`Failed to get transactions: ${JSON.stringify(e.message)}`);return e})}transaction(e){return d(this,null,function*(){let r=yield n(this,f).getTransaction(this.walletLocator,e);if("error"in r)throw new Error(`Failed to get transaction: ${JSON.stringify(r.error)}`);return r})}transfers(e){return d(this,null,function*(){let r=this.resolveChainForEnvironment(),i=yield this.apiClient.getTransfers(this.walletLocator,{chain:r,tokens:e.tokens,status:e.status});if("error"in i)throw new Error(`Failed to get transfers: ${JSON.stringify(i.message)}`);return i})}send(e,r,i,t){return d(this,null,function*(){let a=this.resolveChainForEnvironment(),h=fe(e),o=we(r,a),l=Number(i);if(Number.isNaN(l)||!Number.isFinite(l)||l<=0)throw new re(`Invalid transfer amount: "${i}". Amount must be a positive number greater than zero.`);s.info("wallet.send.start",b({recipient:h,token:o,amount:i},(t==null?void 0:t.transactionType)!=null?{transactionType:t.transactionType}:{})),yield this.preAuthIfNeeded();let g=this.requireSigner(),u;(t==null?void 0:t.signer)==null?u=g.locator():typeof t.signer=="string"?u=t.signer:u=this.resolveServerSignerApiLocator(t.signer);let S=b({recipient:h,amount:i,signer:u},(t==null?void 0:t.transactionType)!=null?{transactionType:t.transactionType}:{}),y=yield n(this,f).send(this.walletLocator,o,S);if("message"in y)throw s.error("wallet.send.error",{error:y}),new ie(`Failed to send token: ${JSON.stringify(y.message)}`);if((t==null?void 0:t.prepareOnly)===!0)return s.info("wallet.send.prepared",{transactionId:y.id}),{hash:void 0,explorerLink:void 0,transactionId:y.id};let C=yield this.approveTransactionAndWait(y.id);return s.info("wallet.send.success",{transactionId:y.id,hash:C.hash}),C})}approveTransaction(e){return d(this,null,function*(){return console.warn("approveTransaction is deprecated. Use approve instead. This method will be removed in the next major version."),yield this.approve(e)})}approve(e){return d(this,null,function*(){if(s.info("wallet.approve.start",{transactionId:e.transactionId,signatureId:e.signatureId}),yield this.preAuthIfNeeded(),e.transactionId!=null){let r=yield this.approveTransactionAndWait(e.transactionId,e.options);return s.info("wallet.approve.success",{transactionId:e.transactionId}),r}if(e.signatureId!=null){let r=yield this.approveSignatureAndWait(e.signatureId,e.options);return s.info("wallet.approve.success",{signatureId:e.signatureId}),r}throw s.error("wallet.approve.error",{error:"Either transactionId or signatureId must be provided"}),new Error("Either transactionId or signatureId must be provided")})}addSigner(e,r){return d(this,null,function*(){s.info("wallet.addSigner.start");let i=typeof e=="object"&&"type"in e&&e.type==="server"?this.resolveServerSignerApiLocator(e):e;return this.withRecoverySigner(()=>d(this,null,function*(){var u,S;let t=typeof i=="string"?i:N(i),a=yield this.getSignerState(t);if(a.signer!=null){if(this.isApprovedSignerStatus(a.signer.status))return s.info("wallet.addSigner.alreadyApproved"),this.completeSignerRegistration(a.signer,null,r);if(a.pendingOperation!=null)return s.info("wallet.addSigner.resuming",{operationType:a.pendingOperation.type,operationId:a.pendingOperation.id}),this.completeSignerRegistration(a.signer,a.pendingOperation,r)}let h=typeof i=="string"||i.type==="passkey"?i:i.type==="device"&&"publicKey"in i&&i.publicKey!=null?{type:"device",publicKey:i.publicKey,name:i.name}:N(i),o=yield n(this,f).registerSigner(this.walletLocator,b({signer:h,chain:this.getSignerRegistrationChain()},(r==null?void 0:r.scopes)!=null&&{scopes:r.scopes}));if("error"in o)throw s.error("wallet.addSigner.error",{error:o}),o.code===X?new M(o.message):new _(`Failed to register signer: ${JSON.stringify(o.message)}`);let l=j(o,this.chain);if(l==null)throw new Error(`No approval found for chain ${this.chain} in register signer response`);let g=null;if(this.chain==="solana"||this.chain==="stellar"){if(!("transaction"in o)||o.transaction==null)throw s.error("wallet.addSigner.error",{error:"Expected transaction in response for Solana/Stellar chain"}),new Error("Expected transaction in response for Solana/Stellar chain");g={type:"transaction",id:o.transaction.id}}else{if(!("chains"in o))throw s.error("wallet.addSigner.error",{error:"Expected chains in response for EVM chain"}),new Error("Expected chains in response for EVM chain");if(((S=(u=o.chains)==null?void 0:u[this.chain])==null?void 0:S.status)==="failed")throw new Error(`Signer registration failed for chain ${this.chain}`);g=z(o,this.chain)}return this.completeSignerRegistration(l,g,r)}))})}completeSignerRegistration(e,r,i){return d(this,null,function*(){if(i!=null&&i.prepareOnly){if(r==null)return b({},e);switch(r.type){case"transaction":{let t={transactionId:r.id};return s.info("wallet.addSigner.prepared",t),b(b({},e),t)}case"signature":{let t={signatureId:r.id};return s.info("wallet.addSigner.prepared",t),b(b({},e),t)}default:{let t=r.type;throw new Error(`Unknown pending operation type: ${t}`)}}}if(r!=null)switch(r.type){case"transaction":yield this.approveTransactionAndWait(r.id),s.info("wallet.addSigner.success",{transactionId:r.id});break;case"signature":yield this.approveSignatureAndWait(r.id),s.info("wallet.addSigner.success",{signatureId:r.id});break;default:{let t=r.type;throw new Error(`Unknown pending operation type: ${t}`)}}else s.info("wallet.addSigner.success");return O(b({},e),{status:"success"})})}removeSigner(e,r){return d(this,null,function*(){let i=this.resolveSignerLocator(e);return s.info("wallet.removeSigner.start",{signerLocator:i}),this.withRecoverySigner(()=>d(this,null,function*(){let t=yield n(this,f).removeSigner(this.walletLocator,i,{chain:this.getSignerRegistrationChain()});if("error"in t)throw s.error("wallet.removeSigner.error",{error:t}),new Error(`Failed to remove signer: ${JSON.stringify(t)}`);let a=t.id;return r!=null&&r.prepareOnly?(s.info("wallet.removeSigner.prepared",{transactionId:a}),{transactionId:a,status:void 0}):(yield this.approveTransactionAndWait(a),s.info("wallet.removeSigner.success",{transactionId:a}),{transactionId:a,status:"success"})}))})}useSigner(e){return d(this,null,function*(){s.info("wallet.useSigner.start"),e.type==="server"&&c(this,x,null),this.validateSignerInput(e);let r=!1;e.type==="device"?yield this.resolveDeviceSignerAvailability(e):r=yield this.resolveNonDeviceSigner(e);let i=this.buildInternalSignerConfig(e),t=N(e);c(this,p,yield this.assembleFullSigner(i,void 0,{isAdminSigner:r})),s.info("wallet.useSigner.success",{signerLocator:t})})}resolveNonDeviceSigner(e){return d(this,null,function*(){if(e.type!=="passkey"&&e.type!=="server"&&this.isRecoverySigner(e))return c(this,w,!1),!0;if(e.type==="passkey"&&this.isPasskeyMissingId(e)&&!(yield this.tryAutoSelectPasskey(e))){if(this.isRecoverySigner(e))return c(this,w,!1),!0;throw new Error("No passkey signer is registered on this wallet.")}if(e.type==="server")return this.resolveServerSigner(e);let r=this.resolveSignerLocator(e);if(yield this.signerIsRegistered(r))return c(this,w,!1),!1;if(this.isRecoverySigner(e))return c(this,w,!1),!0;throw new Error(`Signer "${r}" is not registered in this wallet.`)})}resolveServerSigner(e){return d(this,null,function*(){let{primary:r,legacy:i}=this.deriveServerSignerCandidates(e),t=yield this.signers();if(t.some(h=>h.locator===`server:${r.derivedAddress}`))return c(this,x,r),c(this,w,!1),!1;if(i!=null&&t.some(h=>h.locator===`server:${i.derivedAddress}`))return c(this,x,i),c(this,w,!1),!1;if(this.isRecoverySigner(e))return n(this,L)!=null&&i!=null&&i.derivedAddress===n(this,L)?c(this,x,i):c(this,x,r),c(this,w,!1),!0;let a=i!=null?`"server:${r.derivedAddress}" or "server:${i.derivedAddress}"`:`"server:${r.derivedAddress}"`;throw new Error(`Signer ${a} is not registered in this wallet.`)})}tryAutoSelectPasskey(e){return d(this,null,function*(){let i=(yield this.signers()).filter(t=>t.type==="passkey");if(i.length===0)return!1;if(i.length>1)throw new Error('Multiple passkey signers are registered on this wallet. Please specify the credential id: wallet.useSigner({ type: "passkey", id: "<credential-id>" })');return e.id=i[0].locator.replace("passkey:",""),!0})}resolveSignerLocator(e){return e.type==="server"?this.resolveServerSignerApiLocator(e):N(e)}getSignerRegistrationChain(){if(!(this.chain==="solana"||this.chain==="stellar"))return this.chain}withRecoverySigner(e){return d(this,null,function*(){var t;let r=this.signer;if(W(n(this,v)))throw new Error('Cannot assemble server signer: no secret available. Call wallet.useSigner({ type: "server", secret: ... }) first with the recovery server secret.');if(n(this,v)!=null&&n(this,v).type==="external-wallet"&&!this.isAutoAssemblableSignerConfig(n(this,v)))throw new Error('Cannot assemble external wallet signer: no onSign callback available. Call wallet.useSigner({ type: "external-wallet", address: "0x...", onSign: async (tx) => ... }) first.');let i=this.buildInternalSignerConfig(n(this,v));c(this,p,q(this.chain,i,(t=n(this,A))==null?void 0:t.deviceSignerKeyStorage));try{return yield e()}finally{c(this,p,r)}})}isPasskeyMissingId(e){return e.id==null||e.id===""}signerIsRegistered(e){return d(this,null,function*(){return(yield this.signers()).some(i=>i.locator===e)})}isSignerApproved(e){return d(this,null,function*(){var i;let r=yield this.getSignerState(e);return this.isApprovedSignerStatus((i=r.signer)==null?void 0:i.status)})}isApprovedSignerStatus(e){return e==="success"||e==="active"}needsRecovery(){return n(this,w)}recover(){return d(this,null,function*(){var a,h;if(s.info("wallet.recover.start"),n(this,I)){s.info("wallet.recover.skipped",{reason:"Device signer already approved (cached)"});return}if(n(this,B)){s.info("wallet.recover.skipped",{reason:"device signer not supported (cached)"}),c(this,w,!1),c(this,I,!0);return}let e=()=>{c(this,w,!1),c(this,I,!0)};if(((a=n(this,p))==null?void 0:a.type)==="device"&&(yield this.checkAndResumeDeviceSigner(n(this,p)))){e();return}if(n(this,p)!=null&&n(this,p).type!=="device"){s.warn("wallet.recover.skipped",{reason:"Recovery is only supported for device signers"}),c(this,w,!1);return}let r=(h=n(this,A))==null?void 0:h.deviceSignerKeyStorage;if(r==null){if(!n(this,w))return;throw new Error("Device signer key storage is required to recover a device signer")}let i=yield this.findLocalDeviceSigner(r);if(i!=null&&(yield this.checkAndResumeDeviceSigner(i))){c(this,p,i),e();let o=i.locator().replace("device:","");try{yield r.mapAddressToKey(this.address,o)}catch(l){s.warn("wallet.recover.mapAddressToKey.error",{error:l})}return}let t=yield he(r,this.address);try{yield this.addSigner(t)}catch(o){let l=o instanceof Error&&o.message.toLowerCase().includes("delegated signer")&&o.message.toLowerCase().includes("already")&&o.message.toLowerCase().includes("approved");if(o instanceof M){s.info("wallet.recover.device.unsupportedFallback",{signerLocator:t.locator}),yield r.deleteKey(this.address),c(this,B,!0),c(this,w,!1),c(this,I,!0),yield this.assembleRecoverySignerFallback();return}else if(l)s.info("wallet.recover.skipped",{reason:"Device signer already approved",signerLocator:t.locator});else throw o instanceof de||o instanceof Error&&o.name==="AuthRejectedError"?(s.info("wallet.recover.device.authRejected",{signerLocator:t.locator}),o):(s.error("wallet.recover.device.error",{error:o}),yield r.deleteKey(this.address),o)}c(this,p,yield this.assembleFullSigner({type:"device",locator:t.locator,address:this.address},r)),n(this,p).type==="device"&&(n(this,p).status="success"),s.info("wallet.recover.device.success",{signerLocator:t.locator}),e()})}checkAndResumeDeviceSigner(e){return d(this,null,function*(){var i;if(this.isApprovedSignerStatus(e.status))return s.info("wallet.recover.skipped",{reason:"Device signer already approved"}),!0;let r=yield this.getSignerState(e.locator());return e.status=(i=r.signer)==null?void 0:i.status,r.pendingOperation!=null?(yield this.resumePendingDeviceSignerApproval(e,r.pendingOperation),!0):this.isApprovedSignerStatus(e.status)?(s.info("wallet.recover.skipped",{reason:"Device signer already approved"}),!0):!1})}resumePendingDeviceSignerApproval(e,r){return d(this,null,function*(){var a;let i=n(this,p);if(W(n(this,v)))throw new Error('Cannot resume pending approval: no secret available. Call wallet.useSigner({ type: "server", secret: ... }) first with the recovery server secret.');if(n(this,v)!=null&&n(this,v).type==="external-wallet"&&!this.isAutoAssemblableSignerConfig(n(this,v)))throw new Error('Cannot resume pending approval: no onSign callback available. Call wallet.useSigner({ type: "external-wallet", address: "0x...", onSign: async (tx) => ... }) first.');let t=this.buildInternalSignerConfig(n(this,v));c(this,p,q(this.chain,t,(a=n(this,A))==null?void 0:a.deviceSignerKeyStorage));try{r.type==="signature"?yield this.approveSignatureAndWait(r.id):yield this.approveTransactionAndWait(r.id)}catch(h){throw c(this,p,e),h}finally{n(this,p)!==e&&c(this,p,i)}e.status="success",s.info("wallet.recover.device.success",{signerLocator:e.locator(),resumed:!0})})}findLocalDeviceSigner(e){return d(this,null,function*(){let i=(yield this.signers()).filter(t=>t.locator.startsWith("device:"));for(let t of i){let a=t.locator.replace("device:","");try{if(yield e.hasKey(a)){let o=q(this.chain,{type:"device",locator:t.locator,address:this.address},e);return s.info("wallet.recover.foundLocalDeviceSigner",{signerLocator:t.locator}),o}}catch(h){s.warn("wallet.recover.findLocalDeviceSigner.keyCheckError",{signerLocator:t.locator,error:h})}}return null})}signers(){return d(this,null,function*(){var a,h;s.info("wallet.signers.start");let e=yield n(this,f).getWallet(this.walletLocator);if("error"in e)throw s.error("wallet.signers.error",{error:e}),new Q(JSON.stringify(e));if(e.type!=="smart"||e.chainType!=="evm"&&e.chainType!=="solana"&&e.chainType!=="stellar")throw s.error("wallet.signers.error",{error:`Wallet type ${e.type} not supported`}),new Y(`Wallet type ${e.type} not supported`);let r=(h=(a=e==null?void 0:e.config)==null?void 0:a.delegatedSigners)!=null?h:[],t=(yield Promise.all(r.map(o=>d(this,null,function*(){try{return(yield this.getSignerState(o.locator)).signer}catch(l){return null}})))).filter(o=>o!=null);return s.info("wallet.signers.success",{count:t.length}),t})}get walletLocator(){if(n(this,f).isServerSide)return this.address;{let e;switch(this.chain){case"stellar":e="me:stellar:smart";break;case"solana":e="me:solana:smart";break;default:e="me:evm:smart";break}let r=this.alias!=null?`:alias:${this.alias}`:"";return e+r}}requireSigner(){if(n(this,p)==null)throw n(this,R).length>1?new Error("No signer is set. This wallet has multiple signers configured. Call wallet.useSigner() to select which signer to use before signing operations."):n(this,v).type==="server"?new Error(`No signer is set. Server wallets require calling wallet.useSigner() with the server secret before signing operations.
2
- Example: wallet.useSigner({ type: "server", secret: process.env.YOUR_SERVER_SECRET })`):n(this,v).type==="external-wallet"||!this.isAutoAssemblableSignerConfig(n(this,v))?new Error(`No signer is set. External wallet signers require calling wallet.useSigner() with the onSign callback before signing operations.
3
- Example: wallet.useSigner({ type: "external-wallet", address: "0x...", onSign: async (tx) => ... })`):new Error("This wallet is read-only because no signer was provided. Operations that require signing (send, approve, addSigner, etc.) are not available.");return n(this,p)}preAuthIfNeeded(){return d(this,null,function*(){yield n(this,K),n(this,D)==null&&c(this,D,this.recover());try{yield n(this,D)}finally{c(this,D,null)}let e=this.requireSigner();e instanceof ge&&(yield e.ensureAuthenticated())})}isRecoverySigner(e){let r=n(this,v);if(r==null||r.type!==e.type||e.type==="device")return!1;if(e.type==="passkey")return!0;if(e.type==="server"&&r.type==="server"){let i=o=>{if(W(o))return[o.address];let{primary:l,legacy:g}=this.deriveServerSignerCandidates(o),u=[l.derivedAddress];return g!=null&&u.push(g.derivedAddress),u},t=i(e),a=i(r);if(!t.some(o=>a.includes(o)))return!1}else if(N(e)!==N(r))return!1;return c(this,v,e),!0}validateSignerInput(e){switch(e.type){case"email":if(!("email"in e)||e.email==null)throw new Error("Email signer requires an email address");break;case"phone":if(!("phone"in e)||e.phone==null)throw new Error("Phone signer requires a phone number");break;case"external-wallet":if(!("address"in e)||e.address==null)throw new Error("External wallet signer requires a wallet address");if(!("onSign"in e)||typeof e.onSign!="function")throw new Error("External wallet signer requires an onSign callback");break;case"passkey":case"device":case"api-key":break;default:break}}resolveDeviceSignerAvailability(e){return d(this,null,function*(){var h;let r=(h=n(this,A))==null?void 0:h.deviceSignerKeyStorage;if(r==null)throw new Error("Device signer key storage is required for device signers");let i=yield r.getKey(this.address);if(i!=null){e.locator=`device:${i}`;return}let a=(yield this.signers()).filter(o=>o.locator.startsWith("device:"));for(let o of a){let l=o.locator.replace("device:","");if(yield r.hasKey(l)){yield r.mapAddressToKey(this.address,l),e.locator=o.locator;return}}c(this,w,!0),c(this,I,!1)})}assembleFullSigner(a){return d(this,arguments,function*(e,r=(t=>(t=n(this,A))==null?void 0:t.deviceSignerKeyStorage)(),i){var o;let h=q(this.chain,e,r);if(i!=null&&i.isAdminSigner)h.status="active";else{let l=yield this.getSignerState(h.locator());h.status=(o=l.signer)==null?void 0:o.status}return h})}getSignerState(e){return d(this,null,function*(){let r=null;try{r=yield n(this,f).getSigner(this.walletLocator,e)}catch(t){return{response:null,signer:null,pendingOperation:null}}if(r==null||typeof r!="object"||"error"in r)return{response:null,signer:null,pendingOperation:null};let i=j(r,this.chain);return{response:r,signer:i,pendingOperation:z(r,this.chain)}})}buildInternalSignerConfig(e){var r,i,t,a,h,o;switch(e.type){case"email":return{type:"email",email:e.email,locator:`email:${e.email}`,address:this.address,crossmint:n(this,f).crossmint,clientTEEConnection:(r=n(this,A))==null?void 0:r.clientTEEConnection,onAuthRequired:(t=(i=n(this,A))==null?void 0:i.callbacks)==null?void 0:t.onAuthRequired};case"phone":return{type:"phone",phone:e.phone,locator:`phone:${e.phone}`,address:this.address,crossmint:n(this,f).crossmint,clientTEEConnection:(a=n(this,A))==null?void 0:a.clientTEEConnection,onAuthRequired:(o=(h=n(this,A))==null?void 0:h.callbacks)==null?void 0:o.onAuthRequired};case"passkey":{let l="id"in e&&e.id?e.id:"";return{type:"passkey",id:l,locator:`passkey:${l}`,name:"name"in e?e.name:void 0,publicKey:"publicKey"in e?e.publicKey:void 0,onCreatePasskey:e.onCreatePasskey,onSignWithPasskey:e.onSignWithPasskey}}case"device":return{type:"device",locator:"locator"in e&&e.locator?e.locator:void 0,address:this.address};case"external-wallet":return O(b({},e),{locator:`external-wallet:${e.address}`});case"api-key":return{type:"api-key",locator:"api-key",address:this.address};case"server":{let{derivedKeyBytes:l,derivedAddress:g}=this.resolveServerSignerDerivation(e);return{type:"server",derivedKeyBytes:l,locator:`server:${g}`,address:g}}default:throw new Error(`Unknown signer type: ${e==null?void 0:e.type}`)}}isAutoAssemblableSignerConfig(e){var r;switch(e.type){case"email":case"phone":case"passkey":case"api-key":return!0;case"device":return((r=n(this,A))==null?void 0:r.deviceSignerKeyStorage)!=null;case"server":return!W(e);case"external-wallet":return"onSign"in e&&typeof e.onSign=="function";default:return!1}}get isSolanaWallet(){return this.chain==="solana"}resolveChainForEnvironment(){let e=ce(this.chain,n(this,f).environment);return e!==this.chain&&(this.chain=e),this.chain}approveTransactionAndWait(e,r){return d(this,null,function*(){return yield this.approveTransactionInternal(e,r),yield this.sleep(1e3),yield this.waitForTransaction(e)})}approveSignatureAndWait(e,r){return d(this,null,function*(){let i=yield this.approveSignatureInternal(e,r);return!("error"in i)&&i.status==="success"&&i.outputSignature!=null?{signature:i.outputSignature,signatureId:e}:(yield this.sleep(1e3),yield this.waitForSignature(e))})}approveSignatureInternal(e,r){return d(this,null,function*(){var l,g;if(this.isSolanaWallet)throw new Error("Approving signatures is only supported for EVM smart wallets");let i=this.requireSigner(),t=yield n(this,f).getSignature(this.walletLocator,e);if("error"in t)throw new G(JSON.stringify(t));if(i.type==="api-key")return t;if((r==null?void 0:r.approval)!=null){let u=[r.approval];return yield this.executeApproveSignatureWithErrorHandling(e,u)}let a=(l=t.approvals)==null?void 0:l.pending;if(a==null||a.length===0)return t;let h=[...(g=r==null?void 0:r.additionalSigners)!=null?g:[],i],o=yield Promise.all(a.map(u=>d(this,null,function*(){let S=h.find(C=>C.locator()===u.signer.locator);if(S==null)throw new _(`Signer ${u.signer.locator} not found in pending approvals`);let y=yield S.signMessage(u.message);return O(b({},y),{signer:S.locator()})})));return yield this.executeApproveSignatureWithErrorHandling(e,o)})}approveTransactionInternal(e,r){return d(this,null,function*(){var l,g,u,S,y;let i=yield n(this,f).getTransaction(this.walletLocator,e);if("error"in i)throw new V(JSON.stringify(i));yield(u=(g=(l=n(this,A))==null?void 0:l.callbacks)==null?void 0:g.onTransactionStart)==null?void 0:u.call(g);let t=this.requireSigner();if(t.type==="api-key")return i;if((r==null?void 0:r.approval)!=null){let C=[r.approval];return yield this.executeApproveTransactionWithErrorHandling(e,C)}let a=(S=i.approvals)==null?void 0:S.pending;if(a==null||a.length===0)return i;let h=[...(y=r==null?void 0:r.additionalSigners)!=null?y:[],t],o=yield Promise.all(a.map(C=>d(this,null,function*(){let F=h.find(ve=>ve.locator()===C.signer.locator);if(F==null)throw new _(`Signer ${C.signer.locator} not found in pending approvals`);let H=F.type==="device",J=i.chainType==="solana"&&"transaction"in i.onChain&&!H?i.onChain.transaction:C.message,Se=yield F.signTransaction(J);return O(b({},Se),{signer:F.locator()})})));return yield this.executeApproveTransactionWithErrorHandling(e,o)})}executeApproveTransactionWithErrorHandling(e,r){return d(this,null,function*(){s.info("wallet.approve: submitting approval to API",{transactionId:e});let i=yield n(this,f).approveTransaction(this.walletLocator,e,{approvals:r});if(i.error)throw new oe(JSON.stringify(i));return i})}executeApproveSignatureWithErrorHandling(e,r){return d(this,null,function*(){let i=yield n(this,f).approveSignature(this.walletLocator,e,{approvals:r});if(i.error)throw new ee(JSON.stringify(i));return i})}waitForSignature(e){return d(this,null,function*(){let r=null;do if(yield new Promise(i=>setTimeout(i,U)),r=yield n(this,f).getSignature(this.walletLocator,e),"error"in r)throw new G(JSON.stringify(r));while(r===null||r.status==="pending");if(r.status==="failed")throw new Z("Signature signing failed");if(!r.outputSignature)throw new G("Signature not available");return{signature:r.outputSignature,signatureId:e}})}waitForTransaction(h){return d(this,arguments,function*(e,r=6e4,{backoffMultiplier:i=1.1,maxBackoffMs:t=2e3,initialBackoffMs:a=U}={}){var S,y;s.info("wallet.approve: waiting for transaction confirmation",{transactionId:e,timeoutMs:r});let o=Date.now(),l;do{if(Date.now()-o>r)throw new te("Transaction confirmation timeout");if(l=yield n(this,f).getTransaction(this.walletLocator,e),l.error)throw new V(JSON.stringify(l));yield this.sleep(a),a=Math.min(a*i,t)}while(l.status==="pending");if(l.status==="failed")throw new ne(`Transaction sending failed: ${JSON.stringify(l.error)}`);if(l.status==="awaiting-approval")throw new se("Transaction is awaiting approval. Please submit required approvals before waiting for completion.");let g="txHash"in l.onChain&&typeof l.onChain.txHash=="string"?l.onChain.txHash:void 0,u=(S=l.onChain.txId)!=null?S:g;if(u==null)throw new ae("Transaction hash not found on transaction response");return{hash:u,explorerLink:(y=l.onChain.explorerLink)!=null?y:"",transactionId:l.id}})}sleep(e){return d(this,null,function*(){return new Promise(r=>setTimeout(r,e))})}};p=new WeakMap,A=new WeakMap,f=new WeakMap,v=new WeakMap,R=new WeakMap,w=new WeakMap,I=new WeakMap,x=new WeakMap,L=new WeakMap,$=new WeakMap,K=new WeakMap,D=new WeakMap,B=new WeakMap,k([P({logger:s,methodName:"wallet.balances",buildContext(e){return{chain:e.chain,address:e.address}}})],E.prototype,"balances",1),k([P({logger:s,methodName:"wallet.stagingFund",buildContext(e){return{chain:e.chain,address:e.address}}})],E.prototype,"stagingFund",1),k([P({logger:s,methodName:"wallet.send",buildContext(e){return{chain:e.chain,address:e.address}}})],E.prototype,"send",1),k([P({logger:s,methodName:"wallet.approve",buildContext(e){return{chain:e.chain,address:e.address}}})],E.prototype,"approve",1),k([P({logger:s,methodName:"wallet.addSigner",buildContext(e){return{chain:e.chain,address:e.address}}})],E.prototype,"addSigner",1),k([P({logger:s,methodName:"wallet.removeSigner",buildContext(e){return{chain:e.chain,address:e.address}}})],E.prototype,"removeSigner",1),k([P({logger:s,methodName:"wallet.useSigner",buildContext(e){return{chain:e.chain,address:e.address}}})],E.prototype,"useSigner",1),k([P({logger:s,methodName:"wallet.recover",buildContext(e){return{chain:e.chain,address:e.address}}})],E.prototype,"recover",1),k([P({logger:s,methodName:"wallet.signers",buildContext(e){return{chain:e.chain,address:e.address}}})],E.prototype,"signers",1);function fe(m){if(typeof m=="string"){if(!pe(m))throw new le(`Invalid recipient address: "${m}". Expected a valid EVM (0x...), Solana (base58), or Stellar (G.../C...) address.`);return m}if("email"in m)return`email:${m.email}`;if("x"in m)return`x:${m.x}`;if("twitter"in m)return`twitter:${m.twitter}`;if("phone"in m)return`phoneNumber:${m.phone}`;if("userId"in m)return`userId:${m.userId}`;throw new Error("Invalid recipient locator")}function we(m,e){return pe(m)?`${e}:${m}`:`${e}:${m.toLowerCase()}`}export{E as a};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkJBP52JOHcjs = require('./chunk-JBP52JOH.cjs');var _chunkAS2YN2YCcjs = require('./chunk-AS2YN2YC.cjs');var _chunkCFB27BFVcjs = require('./chunk-CFB27BFV.cjs');var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var f=class{constructor(i){this.config=i;this._needsAuth=!0;this._authPromise=null;this._initializationPromise=null;typeof window!="undefined"&&(this._initializationPromise=this.initialize()),this.type=this.config.type}locator(){return this.config.locator}address(){return this.config.address}initialize(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){try{if(this.config.clientTEEConnection==null){let i=_commonsdkbase.validateAPIKey.call(void 0, this.config.crossmint.apiKey);if(!i.isValid)throw new Error("Invalid API key");let t=new (0, _chunkJBP52JOHcjs.a)({environment:i.environment});this.config.clientTEEConnection=yield t.initialize()}}finally{this._initializationPromise=null}})}getTEEConnection(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){if(this.config.clientTEEConnection==null){if(this._initializationPromise){if(yield this._initializationPromise,this.config.clientTEEConnection==null)throw new Error("Failed to initialize TEE connection");return this.config.clientTEEConnection}this._initializationPromise=this.initializeTEEConnection();try{yield this._initializationPromise}finally{this._initializationPromise=null}}if(this.config.clientTEEConnection==null)throw new Error("TEE connection is not initialized");return this.config.clientTEEConnection})}initializeTEEConnection(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){_chunkCFB27BFVcjs.a.info("TEE connection not initialized, initializing now");let i=_commonsdkbase.validateAPIKey.call(void 0, this.config.crossmint.apiKey);if(!i.isValid)throw new Error("Invalid API key");let t=new (0, _chunkJBP52JOHcjs.a)({environment:i.environment});if(this.config.clientTEEConnection=yield t.initialize(),this.config.clientTEEConnection==null)throw new Error("Failed to initialize TEE connection");_chunkCFB27BFVcjs.a.info("TEE connection initialized successfully")})}handleAuthRequired(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var u;let i=yield this.getTEEConnection();if(this.config.onAuthRequired==null)throw new Error(`${this.type} signer requires the onAuthRequired callback to handle OTP verification. This callback manages the authentication flow (sending OTP and verifying user input). If using our React/React Native SDK, this is handled automatically by the provider. For other environments, implement: onAuthRequired: (needsAuth, sendOtp, verifyOtp, reject) => { /* your UI logic */ }`);_chunkCFB27BFVcjs.a.info("get-status: sending request");let t=Date.now(),r=yield i.sendAction({event:"request:get-status",responseEvent:"response:get-status",data:{authData:{jwt:(u=this.config.crossmint.jwt)!=null?u:"",apiKey:this.config.crossmint.apiKey}},options:d}),n=Date.now()-t;if((r==null?void 0:r.status)!=="success")throw _chunkCFB27BFVcjs.a.error("get-status: failed",{status:r==null?void 0:r.status,error:r==null?void 0:r.error,durationMs:n}),new Error(r==null?void 0:r.error);if(_chunkCFB27BFVcjs.a.info("get-status: response received",{signerStatus:r.signerStatus,durationMs:n}),r.signerStatus==="ready"){this._needsAuth=!1;return}else this._needsAuth=!0;_chunkCFB27BFVcjs.a.info("Auth required, initiating OTP flow",{needsAuth:this._needsAuth});let{promise:a,resolve:s,reject:c}=this.createAuthPromise();if(this._authPromise={promise:a,resolve:s,reject:c},this.config.onAuthRequired)try{yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),e=>this.verifyOtp(e),()=>_chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){_chunkCFB27BFVcjs.a.info("Auth rejected",{authRejected:!0}),this._needsAuth=!1,this.config.onAuthRequired!=null&&(yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),e=>this.verifyOtp(e),()=>{var e;return(e=this._authPromise)==null?void 0:e.reject(new _chunkAS2YN2YCcjs.a)})),c(new _chunkAS2YN2YCcjs.a)}))}catch(e){_chunkCFB27BFVcjs.a.error("handleAuthRequired error",{error:e}),c(e)}try{yield a}catch(e){throw _chunkCFB27BFVcjs.a.error("handleAuthRequired promise error",{error:e}),e}})}ensureAuthenticated(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){yield this.handleAuthRequired()})}getJwtOrThrow(){let i=this.config.crossmint.jwt;if(i==null)throw new Error("JWT is required");return i}createAuthPromise(){let i,t;return{promise:new Promise((n,a)=>{i=n,t=a}),resolve:i,reject:t}}sendMessageWithOtp(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var s,c;let i=yield this.getTEEConnection(),t=this.getAuthId();_chunkCFB27BFVcjs.a.info("start-onboarding: sending request");let r=Date.now(),n=yield i.sendAction({event:"request:start-onboarding",responseEvent:"response:start-onboarding",data:{authData:{jwt:(s=this.config.crossmint.jwt)!=null?s:"",apiKey:this.config.crossmint.apiKey},data:{authId:t}},options:d}),a=Date.now()-r;if(_chunkCFB27BFVcjs.a.info("start-onboarding: response received",{status:n==null?void 0:n.status,durationMs:a}),(n==null?void 0:n.status)==="success"&&n.signerStatus==="ready"){this._needsAuth=!1;return}(n==null?void 0:n.status)==="error"&&(_chunkCFB27BFVcjs.a.error("start-onboarding: failed",{error:n.error}),(c=this._authPromise)==null||c.reject(new Error(n.error||"Failed to initiate OTP process.")))})}getAuthId(){return this.config.type==="email"?`email:${this.config.email}`:`phone:${this.config.phone}`}verifyOtp(i){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var a,s,c,u;let t;try{let e=yield this.getTEEConnection();_chunkCFB27BFVcjs.a.info("complete-onboarding: sending request");let E=Date.now();t=yield e.sendAction({event:"request:complete-onboarding",responseEvent:"response:complete-onboarding",data:{authData:{jwt:(a=this.config.crossmint.jwt)!=null?a:"",apiKey:this.config.crossmint.apiKey},data:{onboardingAuthentication:{encryptedOtp:i}}},options:d}),_chunkCFB27BFVcjs.a.info("complete-onboarding: response received",{status:t==null?void 0:t.status,durationMs:Date.now()-E})}catch(e){throw _chunkCFB27BFVcjs.a.error("complete-onboarding: error",{error:e}),this._needsAuth=!0,(s=this._authPromise)==null||s.reject(e),e}if((t==null?void 0:t.status)==="success"){this._needsAuth=!1,this.config.onAuthRequired!=null&&(yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),e=>this.verifyOtp(e),()=>{var e;return(e=this._authPromise)==null?void 0:e.reject(new _chunkAS2YN2YCcjs.a)})),(c=this._authPromise)==null||c.resolve();return}_chunkCFB27BFVcjs.a.error("complete-onboarding: OTP validation failed",{status:t==null?void 0:t.status}),this._needsAuth=!0;let r=(t==null?void 0:t.status)==="error"?t.error:"Failed to validate encrypted OTP",n=new Error(r);throw(u=this._authPromise)==null||u.reject(n),n})}_exportPrivateKey(i,t){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){yield this.handleAuthRequired();let r=this.getJwtOrThrow(),{scheme:n,encoding:a}=this.getChainKeyParams();if(t!=null){let c=i.on("event:key-exported",u=>{i.off(c),u.status==="success"&&Promise.resolve().then(()=>t()).catch(()=>{console.error("[NCS Signer] onExport callback error")})})}let s=yield i.sendAction({event:"request:export-signer",responseEvent:"response:export-signer",data:{authData:{jwt:r,apiKey:this.config.crossmint.apiKey},data:{scheme:n,encoding:a}},options:d});if((s==null?void 0:s.status)==="error")throw new Error(s.error||"Failed to export private key")})}};_chunk2GKPWQBQcjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkCFB27BFVcjs.a,methodName:"handleAuthRequired"})],f.prototype,"handleAuthRequired",1);var d={timeoutMs:3e4};exports.a = f; exports.b = d;