@crossmint/wallets-sdk 1.11.0 → 1.12.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 (247) hide show
  1. package/dist/api/__tests__/constants.d.cts +1 -1
  2. package/dist/api/__tests__/constants.d.ts +1 -1
  3. package/dist/api/__tests__/test-utils.cjs +1 -1
  4. package/dist/api/__tests__/test-utils.d.cts +1 -1
  5. package/dist/api/__tests__/test-utils.d.ts +1 -1
  6. package/dist/api/__tests__/test-utils.js +1 -1
  7. package/dist/api/client.cjs +1 -1
  8. package/dist/api/client.d.cts +1 -1
  9. package/dist/api/client.d.ts +1 -1
  10. package/dist/api/client.js +1 -1
  11. package/dist/api/index.cjs +1 -1
  12. package/dist/api/index.d.cts +1 -1
  13. package/dist/api/index.d.ts +1 -1
  14. package/dist/api/index.js +1 -1
  15. package/dist/api/types.d.cts +1 -1
  16. package/dist/api/types.d.ts +1 -1
  17. package/dist/chains/adapters/evm.cjs +1 -1
  18. package/dist/chains/adapters/evm.d.cts +1 -1
  19. package/dist/chains/adapters/evm.d.ts +1 -1
  20. package/dist/chains/adapters/evm.js +1 -1
  21. package/dist/chains/adapters/solana.cjs +1 -1
  22. package/dist/chains/adapters/solana.d.cts +1 -1
  23. package/dist/chains/adapters/solana.d.ts +1 -1
  24. package/dist/chains/adapters/solana.js +1 -1
  25. package/dist/chains/adapters/stellar.cjs +1 -1
  26. package/dist/chains/adapters/stellar.d.cts +1 -1
  27. package/dist/chains/adapters/stellar.d.ts +1 -1
  28. package/dist/chains/adapters/stellar.js +1 -1
  29. package/dist/chains/chain-adapter.cjs +1 -1
  30. package/dist/chains/chain-adapter.d.cts +1 -1
  31. package/dist/chains/chain-adapter.d.ts +1 -1
  32. package/dist/chains/chain-adapter.js +1 -1
  33. package/dist/chains/chains.cjs +1 -1
  34. package/dist/chains/chains.js +1 -1
  35. package/dist/{chunk-6IV3GB5W.js → chunk-2277DKO3.js} +1 -1
  36. package/dist/chunk-26DL7XRG.js +1 -0
  37. package/dist/{chunk-SGP5B33N.js → chunk-3SHAB7GH.js} +1 -1
  38. package/dist/{chunk-AUDTBFZ4.cjs → chunk-3WJUXFU2.cjs} +1 -1
  39. package/dist/{chunk-OV256XVK.cjs → chunk-44ICOOCJ.cjs} +1 -1
  40. package/dist/{chunk-TJBIBZMF.js → chunk-4ILFMPNK.js} +1 -1
  41. package/dist/{chunk-KZ7LB6ZV.js → chunk-53JN7AMK.js} +1 -1
  42. package/dist/{chunk-P4EW7S5I.cjs → chunk-5BRX4CFK.cjs} +1 -1
  43. package/dist/chunk-5VUIA6TB.cjs +1 -0
  44. package/dist/{chunk-WO4ZWJT6.js → chunk-BDCQ4HVW.js} +1 -1
  45. package/dist/{chunk-UPSASDJP.cjs → chunk-BM6GYJSE.cjs} +1 -1
  46. package/dist/{chunk-KSN4TWLX.js → chunk-CB3YEJ7F.js} +1 -1
  47. package/dist/chunk-ECHVBCCM.js +1 -0
  48. package/dist/{chunk-NUIG3XY3.cjs → chunk-FJYRJSKU.cjs} +1 -1
  49. package/dist/{chunk-PEY3R7XG.cjs → chunk-GIYB3U37.cjs} +1 -1
  50. package/dist/chunk-HSLCNCPW.cjs +1 -0
  51. package/dist/{chunk-UF5HZQUO.cjs → chunk-IX5TSD73.cjs} +1 -1
  52. package/dist/{chunk-IDRQPLGQ.cjs → chunk-J2C3XP4Z.cjs} +1 -1
  53. package/dist/{chunk-6GZQZEGQ.cjs → chunk-J5CHOVJL.cjs} +1 -1
  54. package/dist/{chunk-3A424HCV.js → chunk-JEKHYLBB.js} +1 -1
  55. package/dist/{chunk-3N7PKPCH.cjs → chunk-JJVNOMYX.cjs} +1 -1
  56. package/dist/{chunk-F3NUWFQW.js → chunk-KJNGLQC7.js} +1 -1
  57. package/dist/{chunk-P7KLEZYV.cjs → chunk-L5X5RA7E.cjs} +1 -1
  58. package/dist/{chunk-6ZAGINES.cjs → chunk-LJNSIXGN.cjs} +1 -1
  59. package/dist/{chunk-VCX2M3JY.cjs → chunk-LKEPKOKU.cjs} +1 -1
  60. package/dist/{chunk-EFBUJ2BS.js → chunk-M3IEG5GA.js} +1 -1
  61. package/dist/{chunk-SNBCG5HR.cjs → chunk-MGQGQXRP.cjs} +1 -1
  62. package/dist/{chunk-7SGXWFCJ.cjs → chunk-MYIY3CX7.cjs} +1 -1
  63. package/dist/{chunk-MHKIVDKZ.cjs → chunk-N7DIMQBP.cjs} +1 -1
  64. package/dist/{chunk-URQQBUUX.js → chunk-N7Z3C5RJ.js} +1 -1
  65. package/dist/{chunk-Q3LD5CYJ.cjs → chunk-NL4MRKYW.cjs} +1 -1
  66. package/dist/{chunk-6U5MZQQP.js → chunk-NUGL76QG.js} +1 -1
  67. package/dist/{chunk-WTJC5QBH.cjs → chunk-OHTCLNE3.cjs} +1 -1
  68. package/dist/{chunk-RFWY44CJ.js → chunk-OQN2SFDC.js} +1 -1
  69. package/dist/{chunk-HIHX5FRO.js → chunk-OUZECW5T.js} +1 -1
  70. package/dist/{chunk-65BIFI5E.cjs → chunk-P3SMYLDM.cjs} +1 -1
  71. package/dist/{chunk-7O3W4JAP.cjs → chunk-PSK7FYV7.cjs} +1 -1
  72. package/dist/{chunk-TY33CSCI.js → chunk-QVE2LOBH.js} +1 -1
  73. package/dist/chunk-S3PBSOOZ.cjs +1 -0
  74. package/dist/chunk-SCEZVF7J.js +1 -0
  75. package/dist/{chunk-ZUBX7T2L.js → chunk-SZXFHFA5.js} +1 -1
  76. package/dist/{chunk-F3CW7X6C.js → chunk-T2R4SPKJ.js} +1 -1
  77. package/dist/{chunk-3TZJ6D4G.js → chunk-TZGYISF7.js} +1 -1
  78. package/dist/{chunk-C2LCF6GA.js → chunk-UTZP5A65.js} +1 -1
  79. package/dist/chunk-W36RYDND.js +1 -0
  80. package/dist/chunk-WOQNCBUX.cjs +1 -0
  81. package/dist/{chunk-N7SKSCSW.js → chunk-WQDLMGEG.js} +1 -1
  82. package/dist/{chunk-677M3EWV.cjs → chunk-WTLEFDHS.cjs} +1 -1
  83. package/dist/{chunk-3CEGPUJH.js → chunk-XHANQPKI.js} +1 -1
  84. package/dist/{chunk-HE4BTHTY.cjs → chunk-XN7S5JJY.cjs} +1 -1
  85. package/dist/{chunk-EGX2IXWU.js → chunk-YRX44YXB.js} +1 -1
  86. package/dist/{chunk-KVGWACFA.js → chunk-ZF4ENDFP.js} +1 -1
  87. package/dist/index.cjs +1 -1
  88. package/dist/index.d.cts +1 -1
  89. package/dist/index.d.ts +1 -1
  90. package/dist/index.js +1 -1
  91. package/dist/logger/index.cjs +1 -1
  92. package/dist/logger/index.js +1 -1
  93. package/dist/logger/init.cjs +1 -1
  94. package/dist/logger/init.js +1 -1
  95. package/dist/sdk.cjs +1 -1
  96. package/dist/sdk.d.cts +1 -1
  97. package/dist/sdk.d.ts +1 -1
  98. package/dist/sdk.js +1 -1
  99. package/dist/signers/descriptors/api-key.d.cts +1 -1
  100. package/dist/signers/descriptors/api-key.d.ts +1 -1
  101. package/dist/signers/descriptors/device.d.cts +1 -1
  102. package/dist/signers/descriptors/device.d.ts +1 -1
  103. package/dist/signers/descriptors/email.d.cts +1 -1
  104. package/dist/signers/descriptors/email.d.ts +1 -1
  105. package/dist/signers/descriptors/external-wallet.d.cts +1 -1
  106. package/dist/signers/descriptors/external-wallet.d.ts +1 -1
  107. package/dist/signers/descriptors/index.cjs +1 -1
  108. package/dist/signers/descriptors/index.d.cts +1 -1
  109. package/dist/signers/descriptors/index.d.ts +1 -1
  110. package/dist/signers/descriptors/index.js +1 -1
  111. package/dist/signers/descriptors/passkey.d.cts +1 -1
  112. package/dist/signers/descriptors/passkey.d.ts +1 -1
  113. package/dist/signers/descriptors/phone.cjs +1 -1
  114. package/dist/signers/descriptors/phone.d.cts +1 -1
  115. package/dist/signers/descriptors/phone.d.ts +1 -1
  116. package/dist/signers/descriptors/phone.js +1 -1
  117. package/dist/signers/descriptors/server.d.cts +1 -1
  118. package/dist/signers/descriptors/server.d.ts +1 -1
  119. package/dist/signers/descriptors/types.d.cts +1 -1
  120. package/dist/signers/descriptors/types.d.ts +1 -1
  121. package/dist/signers/device.d.cts +1 -1
  122. package/dist/signers/device.d.ts +1 -1
  123. package/dist/signers/evm-api-key.d.cts +1 -1
  124. package/dist/signers/evm-api-key.d.ts +1 -1
  125. package/dist/signers/evm-external-wallet.d.cts +1 -1
  126. package/dist/signers/evm-external-wallet.d.ts +1 -1
  127. package/dist/signers/external-wallet-signer.d.cts +1 -1
  128. package/dist/signers/external-wallet-signer.d.ts +1 -1
  129. package/dist/signers/index.cjs +1 -1
  130. package/dist/signers/index.d.cts +1 -1
  131. package/dist/signers/index.d.ts +1 -1
  132. package/dist/signers/index.js +1 -1
  133. package/dist/signers/non-custodial/index.cjs +1 -1
  134. package/dist/signers/non-custodial/index.d.cts +1 -1
  135. package/dist/signers/non-custodial/index.d.ts +1 -1
  136. package/dist/signers/non-custodial/index.js +1 -1
  137. package/dist/signers/non-custodial/ncs-evm-signer.cjs +1 -1
  138. package/dist/signers/non-custodial/ncs-evm-signer.d.cts +1 -1
  139. package/dist/signers/non-custodial/ncs-evm-signer.d.ts +1 -1
  140. package/dist/signers/non-custodial/ncs-evm-signer.js +1 -1
  141. package/dist/signers/non-custodial/ncs-signer.cjs +1 -1
  142. package/dist/signers/non-custodial/ncs-signer.d.cts +1 -1
  143. package/dist/signers/non-custodial/ncs-signer.d.ts +1 -1
  144. package/dist/signers/non-custodial/ncs-signer.js +1 -1
  145. package/dist/signers/non-custodial/ncs-solana-signer.cjs +1 -1
  146. package/dist/signers/non-custodial/ncs-solana-signer.d.cts +1 -1
  147. package/dist/signers/non-custodial/ncs-solana-signer.d.ts +1 -1
  148. package/dist/signers/non-custodial/ncs-solana-signer.js +1 -1
  149. package/dist/signers/non-custodial/ncs-stellar-signer.cjs +1 -1
  150. package/dist/signers/non-custodial/ncs-stellar-signer.d.cts +1 -1
  151. package/dist/signers/non-custodial/ncs-stellar-signer.d.ts +1 -1
  152. package/dist/signers/non-custodial/ncs-stellar-signer.js +1 -1
  153. package/dist/signers/passkey.d.cts +1 -1
  154. package/dist/signers/passkey.d.ts +1 -1
  155. package/dist/signers/server/assemble-server-signer.d.cts +1 -1
  156. package/dist/signers/server/assemble-server-signer.d.ts +1 -1
  157. package/dist/signers/server/evm-server-signer.d.cts +1 -1
  158. package/dist/signers/server/evm-server-signer.d.ts +1 -1
  159. package/dist/signers/server/helpers/derive-server-signer.d.cts +1 -1
  160. package/dist/signers/server/helpers/derive-server-signer.d.ts +1 -1
  161. package/dist/signers/server/helpers/index.d.cts +1 -1
  162. package/dist/signers/server/helpers/index.d.ts +1 -1
  163. package/dist/signers/server/index.d.cts +1 -1
  164. package/dist/signers/server/index.d.ts +1 -1
  165. package/dist/signers/server/resolver.d.cts +1 -1
  166. package/dist/signers/server/resolver.d.ts +1 -1
  167. package/dist/signers/server/solana-server-signer.d.cts +1 -1
  168. package/dist/signers/server/solana-server-signer.d.ts +1 -1
  169. package/dist/signers/server/stellar-server-signer.d.cts +1 -1
  170. package/dist/signers/server/stellar-server-signer.d.ts +1 -1
  171. package/dist/signers/solana-api-key.d.cts +1 -1
  172. package/dist/signers/solana-api-key.d.ts +1 -1
  173. package/dist/signers/solana-external-wallet.d.cts +1 -1
  174. package/dist/signers/solana-external-wallet.d.ts +1 -1
  175. package/dist/signers/stellar-external-wallet.d.cts +1 -1
  176. package/dist/signers/stellar-external-wallet.d.ts +1 -1
  177. package/dist/signers/types.d.cts +1 -1
  178. package/dist/signers/types.d.ts +1 -1
  179. package/dist/{types-4EOfiBxs.d.cts → types-86FbKjRz.d.cts} +1 -0
  180. package/dist/{types-DfpYAsst.d.ts → types-BcjKqQz3.d.ts} +1 -0
  181. package/dist/utils/constants.cjs +1 -1
  182. package/dist/utils/constants.js +1 -1
  183. package/dist/utils/device-signers/IframeDeviceSignerKeyStorage.cjs +1 -1
  184. package/dist/utils/device-signers/IframeDeviceSignerKeyStorage.js +1 -1
  185. package/dist/utils/device-signers/createDeviceSigner.d.cts +1 -1
  186. package/dist/utils/device-signers/createDeviceSigner.d.ts +1 -1
  187. package/dist/utils/device-signers/index.cjs +1 -1
  188. package/dist/utils/device-signers/index.d.cts +1 -1
  189. package/dist/utils/device-signers/index.d.ts +1 -1
  190. package/dist/utils/device-signers/index.js +1 -1
  191. package/dist/utils/locators.d.cts +1 -1
  192. package/dist/utils/locators.d.ts +1 -1
  193. package/dist/utils/signer-locator.d.cts +1 -1
  194. package/dist/utils/signer-locator.d.ts +1 -1
  195. package/dist/utils/signer-mapping.d.cts +1 -1
  196. package/dist/utils/signer-mapping.d.ts +1 -1
  197. package/dist/wallets/__tests__/test-helpers.cjs +1 -1
  198. package/dist/wallets/__tests__/test-helpers.d.cts +1 -1
  199. package/dist/wallets/__tests__/test-helpers.d.ts +1 -1
  200. package/dist/wallets/__tests__/test-helpers.js +1 -1
  201. package/dist/wallets/evm.cjs +1 -1
  202. package/dist/wallets/evm.d.cts +1 -1
  203. package/dist/wallets/evm.d.ts +1 -1
  204. package/dist/wallets/evm.js +1 -1
  205. package/dist/wallets/services/balance-formatter.cjs +1 -1
  206. package/dist/wallets/services/balance-formatter.d.cts +1 -1
  207. package/dist/wallets/services/balance-formatter.d.ts +1 -1
  208. package/dist/wallets/services/balance-formatter.js +1 -1
  209. package/dist/wallets/services/device-recovery-service.cjs +1 -1
  210. package/dist/wallets/services/device-recovery-service.d.cts +1 -1
  211. package/dist/wallets/services/device-recovery-service.d.ts +1 -1
  212. package/dist/wallets/services/device-recovery-service.js +1 -1
  213. package/dist/wallets/services/operation-poller.cjs +1 -1
  214. package/dist/wallets/services/operation-poller.d.cts +1 -1
  215. package/dist/wallets/services/operation-poller.d.ts +1 -1
  216. package/dist/wallets/services/operation-poller.js +1 -1
  217. package/dist/wallets/services/signer-manager.cjs +1 -1
  218. package/dist/wallets/services/signer-manager.d.cts +1 -1
  219. package/dist/wallets/services/signer-manager.d.ts +1 -1
  220. package/dist/wallets/services/signer-manager.js +1 -1
  221. package/dist/wallets/solana.cjs +1 -1
  222. package/dist/wallets/solana.d.cts +1 -1
  223. package/dist/wallets/solana.d.ts +1 -1
  224. package/dist/wallets/solana.js +1 -1
  225. package/dist/wallets/stellar.cjs +1 -1
  226. package/dist/wallets/stellar.d.cts +1 -1
  227. package/dist/wallets/stellar.d.ts +1 -1
  228. package/dist/wallets/stellar.js +1 -1
  229. package/dist/wallets/types.d.cts +1 -1
  230. package/dist/wallets/types.d.ts +1 -1
  231. package/dist/wallets/wallet-factory.cjs +1 -1
  232. package/dist/wallets/wallet-factory.d.cts +2 -1
  233. package/dist/wallets/wallet-factory.d.ts +2 -1
  234. package/dist/wallets/wallet-factory.js +1 -1
  235. package/dist/wallets/wallet.cjs +1 -1
  236. package/dist/wallets/wallet.d.cts +1 -1
  237. package/dist/wallets/wallet.d.ts +1 -1
  238. package/dist/wallets/wallet.js +1 -1
  239. package/package.json +3 -3
  240. package/dist/chunk-B5U3A75U.cjs +0 -1
  241. package/dist/chunk-EAU5Z5O5.cjs +0 -1
  242. package/dist/chunk-NUBGDLR2.js +0 -1
  243. package/dist/chunk-PMQQEVKL.cjs +0 -1
  244. package/dist/chunk-VFJ7NZBI.js +0 -1
  245. package/dist/chunk-VPJBVKHY.js +0 -1
  246. package/dist/chunk-W6APCBJW.cjs +0 -1
  247. package/dist/chunk-XEWCMK3Z.js +0 -1
@@ -1,4 +1,4 @@
1
- import { ah as WalletLocator } from '../../types-4EOfiBxs.cjs';
1
+ import { ah as WalletLocator } from '../../types-86FbKjRz.cjs';
2
2
  import 'viem';
3
3
  import '../gen/types.gen.cjs';
4
4
  import 'ox';
@@ -1,4 +1,4 @@
1
- import { ah as WalletLocator } from '../../types-DfpYAsst.js';
1
+ import { ah as WalletLocator } from '../../types-BcjKqQz3.js';
2
2
  import 'viem';
3
3
  import '../gen/types.gen.js';
4
4
  import 'ox';
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkJ33QM2IDcjs = require('../../chunk-J33QM2ID.cjs');var _chunk6GZQZEGQcjs = require('../../chunk-6GZQZEGQ.cjs');require('../../chunk-XZ4NKVEB.cjs');require('../../chunk-7O3W4JAP.cjs');require('../../chunk-6ZAGINES.cjs');var _chunkDSIFRRBScjs = require('../../chunk-DSIFRRBS.cjs');var _vitest = require('vitest');var P=({data:e,status:t=200,ok:n=!0,statusText:s="OK"})=>({json:_vitest.vi.fn().mockResolvedValue(e),ok:n,status:t,statusText:s}),j= exports.createMockSuccessResponse =e=>P({data:e}),b= exports.createMockErrorResponse =(e,t=400,n="Bad Request")=>P({data:e,status:t,ok:!1,statusText:n}),B= exports.createMockCrossmint =(e={})=>{let t=_chunkDSIFRRBScjs.a.call(void 0, {apiKey:_chunkJ33QM2IDcjs.m},e);return _chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {},t),{setJwt:_vitest.vi.fn().mockReturnThis()})},L= exports.createTestApiClient =e=>new (0, _chunk6GZQZEGQcjs.a)(e||B()),K= exports.createServerSideApiClient =()=>{let e=L();return Object.defineProperty(e,"isServerSide",{get:()=>!0,configurable:!0}),e},Y= exports.extractFetchCall =e=>{let t=e.mock.calls;if(t.length===0)return;let n=t[t.length-1];return{path:n[0],options:n[1]}},N= exports.expectRequestPath =(e,t)=>{_vitest.expect.call(void 0, e==null?void 0:e.path).toBe(t)},V= exports.expectCommonHeaders =e=>{_vitest.expect.call(void 0, e["Content-Type"]).toBe("application/json")},q= exports.expectRequestBody =(e,t)=>{_vitest.expect.call(void 0, e.body).toBe(JSON.stringify(t))},z= exports.validateRequest =(e,t,n)=>{_vitest.expect.call(void 0, e).toBeDefined(),e&&(N(e,t),e.options.headers&&V(e.options.headers),n!==void 0&&e.options&&q(e.options,n))},X= exports.testHttpErrorResponse =(e,t,n,s)=>_chunkDSIFRRBScjs.h.call(void 0, void 0,null,function*(){t.mockResolvedValue(b(n,s));let a=yield e();_vitest.expect.call(void 0, l(a)).toBe(!0),l(a)&&(_vitest.expect.call(void 0, a.error).toBe(!0),n.message&&_vitest.expect.call(void 0, a.message).toBe(n.message))}),Z= exports.testCommonHttpErrors =(s,a,...o)=>_chunkDSIFRRBScjs.h.call(void 0, void 0,[s,a,...o],function*(e,t,n=[]){for(let{status:c,message:g}of _chunkJ33QM2IDcjs.a){if(n.includes(c))continue;let u={error:!0,message:g};t.mockResolvedValueOnce(b(u,c));let m=yield e();_vitest.expect.call(void 0, l(m)).toBe(!0)}}),Q= exports.testNetworkError =(e,t)=>_chunkDSIFRRBScjs.h.call(void 0, void 0,null,function*(){t.mockRejectedValue(new Error("Network error")),yield _vitest.expect.call(void 0, e()).rejects.toThrow("Network error")}),ee= exports.testInvalidJsonResponse =(e,t)=>_chunkDSIFRRBScjs.h.call(void 0, void 0,null,function*(){let n={json:_vitest.vi.fn().mockRejectedValue(new Error("Invalid JSON")),ok:!0,status:200};t.mockResolvedValue(n),yield _vitest.expect.call(void 0, e()).rejects.toThrow()}),te= exports.testTimeoutError =(e,t)=>_chunkDSIFRRBScjs.h.call(void 0, void 0,null,function*(){t.mockImplementation(()=>new Promise((n,s)=>setTimeout(()=>s(new Error("Request timeout")),0))),yield _vitest.expect.call(void 0, e()).rejects.toThrow("Request timeout")}),ne= exports.testMalformedResponse =(e,t,n)=>_chunkDSIFRRBScjs.h.call(void 0, void 0,null,function*(){t.mockResolvedValue(j(n));let s=yield e();_vitest.expect.call(void 0, s).toEqual(n)}),se= exports.createMockWalletResponse =(e={})=>_chunkDSIFRRBScjs.a.call(void 0, {address:_chunkJ33QM2IDcjs.b.evmAddress,chainType:"evm",type:"smart",config:{adminSigner:{type:"external-wallet",address:_chunkJ33QM2IDcjs.k.EVM_TEST}}},e),oe= exports.createMockSendResponse =(e={})=>_chunkDSIFRRBScjs.a.call(void 0, {id:"txn-123",status:"pending",chainType:"evm",walletType:"evm-smart-wallet",params:{transaction:"0x1234567890abcdef",signer:"api-key:test"},onChain:{txId:"0xabcdef1234567890abcdef1234567890abcdef12",explorerLink:"https://explorer.example.com/tx/0xabcdef1234567890abcdef1234567890abcdef12"},createdAt:Date.now()},e);function l(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error===!0}function C(e){return typeof e=="object"&&e!==null&&"address"in e&&"chainType"in e&&"type"in e}function $(e){return typeof e=="object"&&e!==null&&"id"in e&&"status"in e&&"chainType"in e}var x=e=>new Promise(t=>setTimeout(t,e)),re= exports.isValidEthereumAddress =e=>/^0x[a-fA-F0-9]{40}$/.test(e),ae= exports.isValidSolanaAddress =e=>/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(e),ie= exports.createIntegrationApiClient =(e,t,n={})=>{let s=_chunkDSIFRRBScjs.a.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {apiKey:e},t&&{overrideBaseUrl:t}),n),a=_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {},s),{setJwt:()=>a});return new (0, _chunk6GZQZEGQcjs.a)(a)},v= exports.TestDataFactory =class{constructor(){this.wallets=[];this.transactions=[]}addWallet(t){t&&!this.wallets.includes(t)&&this.wallets.push(t)}addTransaction(t){t&&!this.transactions.includes(t)&&this.transactions.push(t)}getWallet(t=0){return this.wallets[t]}getTransaction(t=0){return this.transactions[t]}hasWallets(){return this.wallets.length>0}clear(){this.wallets=[],this.transactions=[]}};function ce(s,a){return _chunkDSIFRRBScjs.h.call(void 0, this,arguments,function*(e,t,n={}){if(t.hasWallets())return t.getWallet();let{chainType:o="evm",type:c="mpc",owner:g,testName:u="default"}=n,m=g||`userId:integration-${u}-${Date.now()}`,f=yield e.createWallet(_chunkDSIFRRBScjs.a.call(void 0, {chainType:o,type:c},g&&{owner:m}));if(C(f))return t.addWallet(f.address),f.address})}function pe(e,t,n){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let s=yield e.createWallet(n);return C(s)&&t.addWallet(s.address),s})}function le(e,t){_vitest.expect.call(void 0, l(e)).toBe(!0),t&&_vitest.expect.call(void 0, e.message).toBeDefined()}function ue(e){_vitest.expect.call(void 0, C(e)).toBe(!0)}function de(e){_vitest.expect.call(void 0, $(e)).toBe(!0)}var I=(e,t,n,s="usdxm",a="base-sepolia")=>_chunkDSIFRRBScjs.h.call(void 0, void 0,null,function*(){let o={amount:n,token:s,chain:a},c=yield e.fundWallet(t,o);if(l(c))throw new Error(`Failed to fund wallet: ${c.message||"Unknown error"}`);return yield x(_chunkJ33QM2IDcjs.i),c}),U= exports.approveTransaction =(a,o,c,...g)=>_chunkDSIFRRBScjs.h.call(void 0, void 0,[a,o,c,...g],function*(e,t,n,s=_chunkJ33QM2IDcjs.l.APPROVE_TRANSACTION_MAX_RETRIES){var m;for(let f=0;f<s;f++){let d=yield e.getTransaction(t,n);if(l(d))throw new Error(`Transaction not found: ${d.message||"Unknown error"}`);if("status"in d&&(d.status==="success"||d.status==="failed"))return d;let T="approvals"in d?(m=d.approvals)==null?void 0:m.pending:void 0;if(T&&T.length>0){let O={approvals:T.map(_=>({signer:_.signer.locator,signature:""}))},h=yield e.approveTransaction(t,n,O);if(l(h))throw new Error(`Failed to approve transaction: ${h.message||"Unknown error"}`);yield x(_chunkJ33QM2IDcjs.j);continue}yield x(_chunkJ33QM2IDcjs.i)}let u=yield e.getTransaction(t,n);if(l(u))throw new Error(`Transaction not found after retries: ${u.message||"Unknown error"}`);if(!("status"in u))throw new Error("Transaction response missing status property");return u}),me= exports.fundWalletAndWait =(e,t,n=1,s="usdxm",a="base-sepolia")=>_chunkDSIFRRBScjs.h.call(void 0, void 0,null,function*(){return I(e,t,n,s,a)}),fe= exports.sendTokenAndApprove =(e,t,n,s,a)=>_chunkDSIFRRBScjs.h.call(void 0, void 0,null,function*(){let o=yield e.send(t,n,{recipient:s,amount:a});if(l(o))throw new Error(`Failed to send token: ${o.message||"Unknown error"}`);if(typeof o=="object"&&o!==null&&"id"in o&&typeof o.id=="string")return U(e,t,o.id);throw new Error("Transaction ID not found in send response")}),ge= exports.ensureWalletFunded =(e,t,n=1,s="usdxm",a="base-sepolia")=>_chunkDSIFRRBScjs.h.call(void 0, void 0,null,function*(){try{yield I(e,t,n,s,a)}catch(o){let c=o instanceof Error?o.message:String(o);if(!c.includes("already funded")&&!c.includes("insufficient"))throw o}});exports.TestDataFactory = v; exports.approveTransaction = U; exports.createIntegrationApiClient = ie; exports.createMockCrossmint = B; exports.createMockErrorResponse = b; exports.createMockResponse = P; exports.createMockSendResponse = oe; exports.createMockSuccessResponse = j; exports.createMockWalletResponse = se; exports.createServerSideApiClient = K; exports.createTestApiClient = L; exports.createTestWallet = pe; exports.delay = x; exports.ensureWalletExists = ce; exports.ensureWalletFunded = ge; exports.expectCommonHeaders = V; exports.expectErrorResponse = le; exports.expectRequestBody = q; exports.expectRequestPath = N; exports.expectSuccessTransactionResponse = de; exports.expectSuccessWalletResponse = ue; exports.extractFetchCall = Y; exports.fundWallet = I; exports.fundWalletAndWait = me; exports.isErrorResponse = l; exports.isSuccessTransactionResponse = $; exports.isSuccessWalletResponse = C; exports.isValidEthereumAddress = re; exports.isValidSolanaAddress = ae; exports.sendTokenAndApprove = fe; exports.testCommonHttpErrors = Z; exports.testHttpErrorResponse = X; exports.testInvalidJsonResponse = ee; exports.testMalformedResponse = ne; exports.testNetworkError = Q; exports.testTimeoutError = te; exports.validateRequest = z;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkJ33QM2IDcjs = require('../../chunk-J33QM2ID.cjs');var _chunkJ5CHOVJLcjs = require('../../chunk-J5CHOVJL.cjs');require('../../chunk-XZ4NKVEB.cjs');require('../../chunk-PSK7FYV7.cjs');require('../../chunk-LJNSIXGN.cjs');var _chunkDSIFRRBScjs = require('../../chunk-DSIFRRBS.cjs');var _vitest = require('vitest');var P=({data:e,status:t=200,ok:n=!0,statusText:s="OK"})=>({json:_vitest.vi.fn().mockResolvedValue(e),ok:n,status:t,statusText:s}),j= exports.createMockSuccessResponse =e=>P({data:e}),b= exports.createMockErrorResponse =(e,t=400,n="Bad Request")=>P({data:e,status:t,ok:!1,statusText:n}),B= exports.createMockCrossmint =(e={})=>{let t=_chunkDSIFRRBScjs.a.call(void 0, {apiKey:_chunkJ33QM2IDcjs.m},e);return _chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {},t),{setJwt:_vitest.vi.fn().mockReturnThis()})},L= exports.createTestApiClient =e=>new (0, _chunkJ5CHOVJLcjs.a)(e||B()),K= exports.createServerSideApiClient =()=>{let e=L();return Object.defineProperty(e,"isServerSide",{get:()=>!0,configurable:!0}),e},Y= exports.extractFetchCall =e=>{let t=e.mock.calls;if(t.length===0)return;let n=t[t.length-1];return{path:n[0],options:n[1]}},N= exports.expectRequestPath =(e,t)=>{_vitest.expect.call(void 0, e==null?void 0:e.path).toBe(t)},V= exports.expectCommonHeaders =e=>{_vitest.expect.call(void 0, e["Content-Type"]).toBe("application/json")},q= exports.expectRequestBody =(e,t)=>{_vitest.expect.call(void 0, e.body).toBe(JSON.stringify(t))},z= exports.validateRequest =(e,t,n)=>{_vitest.expect.call(void 0, e).toBeDefined(),e&&(N(e,t),e.options.headers&&V(e.options.headers),n!==void 0&&e.options&&q(e.options,n))},X= exports.testHttpErrorResponse =(e,t,n,s)=>_chunkDSIFRRBScjs.h.call(void 0, void 0,null,function*(){t.mockResolvedValue(b(n,s));let a=yield e();_vitest.expect.call(void 0, l(a)).toBe(!0),l(a)&&(_vitest.expect.call(void 0, a.error).toBe(!0),n.message&&_vitest.expect.call(void 0, a.message).toBe(n.message))}),Z= exports.testCommonHttpErrors =(s,a,...o)=>_chunkDSIFRRBScjs.h.call(void 0, void 0,[s,a,...o],function*(e,t,n=[]){for(let{status:c,message:g}of _chunkJ33QM2IDcjs.a){if(n.includes(c))continue;let u={error:!0,message:g};t.mockResolvedValueOnce(b(u,c));let m=yield e();_vitest.expect.call(void 0, l(m)).toBe(!0)}}),Q= exports.testNetworkError =(e,t)=>_chunkDSIFRRBScjs.h.call(void 0, void 0,null,function*(){t.mockRejectedValue(new Error("Network error")),yield _vitest.expect.call(void 0, e()).rejects.toThrow("Network error")}),ee= exports.testInvalidJsonResponse =(e,t)=>_chunkDSIFRRBScjs.h.call(void 0, void 0,null,function*(){let n={json:_vitest.vi.fn().mockRejectedValue(new Error("Invalid JSON")),ok:!0,status:200};t.mockResolvedValue(n),yield _vitest.expect.call(void 0, e()).rejects.toThrow()}),te= exports.testTimeoutError =(e,t)=>_chunkDSIFRRBScjs.h.call(void 0, void 0,null,function*(){t.mockImplementation(()=>new Promise((n,s)=>setTimeout(()=>s(new Error("Request timeout")),0))),yield _vitest.expect.call(void 0, e()).rejects.toThrow("Request timeout")}),ne= exports.testMalformedResponse =(e,t,n)=>_chunkDSIFRRBScjs.h.call(void 0, void 0,null,function*(){t.mockResolvedValue(j(n));let s=yield e();_vitest.expect.call(void 0, s).toEqual(n)}),se= exports.createMockWalletResponse =(e={})=>_chunkDSIFRRBScjs.a.call(void 0, {address:_chunkJ33QM2IDcjs.b.evmAddress,chainType:"evm",type:"smart",config:{adminSigner:{type:"external-wallet",address:_chunkJ33QM2IDcjs.k.EVM_TEST}}},e),oe= exports.createMockSendResponse =(e={})=>_chunkDSIFRRBScjs.a.call(void 0, {id:"txn-123",status:"pending",chainType:"evm",walletType:"evm-smart-wallet",params:{transaction:"0x1234567890abcdef",signer:"api-key:test"},onChain:{txId:"0xabcdef1234567890abcdef1234567890abcdef12",explorerLink:"https://explorer.example.com/tx/0xabcdef1234567890abcdef1234567890abcdef12"},createdAt:Date.now()},e);function l(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error===!0}function C(e){return typeof e=="object"&&e!==null&&"address"in e&&"chainType"in e&&"type"in e}function $(e){return typeof e=="object"&&e!==null&&"id"in e&&"status"in e&&"chainType"in e}var x=e=>new Promise(t=>setTimeout(t,e)),re= exports.isValidEthereumAddress =e=>/^0x[a-fA-F0-9]{40}$/.test(e),ae= exports.isValidSolanaAddress =e=>/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(e),ie= exports.createIntegrationApiClient =(e,t,n={})=>{let s=_chunkDSIFRRBScjs.a.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {apiKey:e},t&&{overrideBaseUrl:t}),n),a=_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {},s),{setJwt:()=>a});return new (0, _chunkJ5CHOVJLcjs.a)(a)},v= exports.TestDataFactory =class{constructor(){this.wallets=[];this.transactions=[]}addWallet(t){t&&!this.wallets.includes(t)&&this.wallets.push(t)}addTransaction(t){t&&!this.transactions.includes(t)&&this.transactions.push(t)}getWallet(t=0){return this.wallets[t]}getTransaction(t=0){return this.transactions[t]}hasWallets(){return this.wallets.length>0}clear(){this.wallets=[],this.transactions=[]}};function ce(s,a){return _chunkDSIFRRBScjs.h.call(void 0, this,arguments,function*(e,t,n={}){if(t.hasWallets())return t.getWallet();let{chainType:o="evm",type:c="mpc",owner:g,testName:u="default"}=n,m=g||`userId:integration-${u}-${Date.now()}`,f=yield e.createWallet(_chunkDSIFRRBScjs.a.call(void 0, {chainType:o,type:c},g&&{owner:m}));if(C(f))return t.addWallet(f.address),f.address})}function pe(e,t,n){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let s=yield e.createWallet(n);return C(s)&&t.addWallet(s.address),s})}function le(e,t){_vitest.expect.call(void 0, l(e)).toBe(!0),t&&_vitest.expect.call(void 0, e.message).toBeDefined()}function ue(e){_vitest.expect.call(void 0, C(e)).toBe(!0)}function de(e){_vitest.expect.call(void 0, $(e)).toBe(!0)}var I=(e,t,n,s="usdxm",a="base-sepolia")=>_chunkDSIFRRBScjs.h.call(void 0, void 0,null,function*(){let o={amount:n,token:s,chain:a},c=yield e.fundWallet(t,o);if(l(c))throw new Error(`Failed to fund wallet: ${c.message||"Unknown error"}`);return yield x(_chunkJ33QM2IDcjs.i),c}),U= exports.approveTransaction =(a,o,c,...g)=>_chunkDSIFRRBScjs.h.call(void 0, void 0,[a,o,c,...g],function*(e,t,n,s=_chunkJ33QM2IDcjs.l.APPROVE_TRANSACTION_MAX_RETRIES){var m;for(let f=0;f<s;f++){let d=yield e.getTransaction(t,n);if(l(d))throw new Error(`Transaction not found: ${d.message||"Unknown error"}`);if("status"in d&&(d.status==="success"||d.status==="failed"))return d;let T="approvals"in d?(m=d.approvals)==null?void 0:m.pending:void 0;if(T&&T.length>0){let O={approvals:T.map(_=>({signer:_.signer.locator,signature:""}))},h=yield e.approveTransaction(t,n,O);if(l(h))throw new Error(`Failed to approve transaction: ${h.message||"Unknown error"}`);yield x(_chunkJ33QM2IDcjs.j);continue}yield x(_chunkJ33QM2IDcjs.i)}let u=yield e.getTransaction(t,n);if(l(u))throw new Error(`Transaction not found after retries: ${u.message||"Unknown error"}`);if(!("status"in u))throw new Error("Transaction response missing status property");return u}),me= exports.fundWalletAndWait =(e,t,n=1,s="usdxm",a="base-sepolia")=>_chunkDSIFRRBScjs.h.call(void 0, void 0,null,function*(){return I(e,t,n,s,a)}),fe= exports.sendTokenAndApprove =(e,t,n,s,a)=>_chunkDSIFRRBScjs.h.call(void 0, void 0,null,function*(){let o=yield e.send(t,n,{recipient:s,amount:a});if(l(o))throw new Error(`Failed to send token: ${o.message||"Unknown error"}`);if(typeof o=="object"&&o!==null&&"id"in o&&typeof o.id=="string")return U(e,t,o.id);throw new Error("Transaction ID not found in send response")}),ge= exports.ensureWalletFunded =(e,t,n=1,s="usdxm",a="base-sepolia")=>_chunkDSIFRRBScjs.h.call(void 0, void 0,null,function*(){try{yield I(e,t,n,s,a)}catch(o){let c=o instanceof Error?o.message:String(o);if(!c.includes("already funded")&&!c.includes("insufficient"))throw o}});exports.TestDataFactory = v; exports.approveTransaction = U; exports.createIntegrationApiClient = ie; exports.createMockCrossmint = B; exports.createMockErrorResponse = b; exports.createMockResponse = P; exports.createMockSendResponse = oe; exports.createMockSuccessResponse = j; exports.createMockWalletResponse = se; exports.createServerSideApiClient = K; exports.createTestApiClient = L; exports.createTestWallet = pe; exports.delay = x; exports.ensureWalletExists = ce; exports.ensureWalletFunded = ge; exports.expectCommonHeaders = V; exports.expectErrorResponse = le; exports.expectRequestBody = q; exports.expectRequestPath = N; exports.expectSuccessTransactionResponse = de; exports.expectSuccessWalletResponse = ue; exports.extractFetchCall = Y; exports.fundWallet = I; exports.fundWalletAndWait = me; exports.isErrorResponse = l; exports.isSuccessTransactionResponse = $; exports.isSuccessWalletResponse = C; exports.isValidEthereumAddress = re; exports.isValidSolanaAddress = ae; exports.sendTokenAndApprove = fe; exports.testCommonHttpErrors = Z; exports.testHttpErrorResponse = X; exports.testInvalidJsonResponse = ee; exports.testMalformedResponse = ne; exports.testNetworkError = Q; exports.testTimeoutError = te; exports.validateRequest = z;
@@ -1,7 +1,7 @@
1
1
  import { MockedFunction } from 'vitest';
2
2
  import { Crossmint } from '@crossmint/common-sdk-base';
3
3
  import { ApiClient } from '../client.cjs';
4
- import { ah as WalletLocator, aq as GetTransactionResponse, ar as SendResponse, as as CreateWalletResponse, at as CreateWalletParams, aa as FundWalletResponse } from '../../types-4EOfiBxs.cjs';
4
+ import { ah as WalletLocator, aq as GetTransactionResponse, ar as SendResponse, as as CreateWalletResponse, at as CreateWalletParams, aa as FundWalletResponse } from '../../types-86FbKjRz.cjs';
5
5
  import '../../chains/chains.cjs';
6
6
  import 'viem';
7
7
  import '../gen/types.gen.cjs';
@@ -1,7 +1,7 @@
1
1
  import { MockedFunction } from 'vitest';
2
2
  import { Crossmint } from '@crossmint/common-sdk-base';
3
3
  import { ApiClient } from '../client.js';
4
- import { ah as WalletLocator, aq as GetTransactionResponse, ar as SendResponse, as as CreateWalletResponse, at as CreateWalletParams, aa as FundWalletResponse } from '../../types-DfpYAsst.js';
4
+ import { ah as WalletLocator, aq as GetTransactionResponse, ar as SendResponse, as as CreateWalletResponse, at as CreateWalletParams, aa as FundWalletResponse } from '../../types-BcjKqQz3.js';
5
5
  import '../../chains/chains.js';
6
6
  import 'viem';
7
7
  import '../gen/types.gen.js';
@@ -1 +1 @@
1
- import{a as A,b as F,i as R,j as W,k as E,l as M,m as S}from"../../chunk-DIGDDKSF.js";import{a as w}from"../../chunk-RFWY44CJ.js";import"../../chunk-7FEY62ID.js";import"../../chunk-TJBIBZMF.js";import"../../chunk-NUBGDLR2.js";import{a as p,b as k,h as i}from"../../chunk-NU7VF7MC.js";import{expect as r,vi as y}from"vitest";var P=({data:e,status:t=200,ok:n=!0,statusText:s="OK"})=>({json:y.fn().mockResolvedValue(e),ok:n,status:t,statusText:s}),j=e=>P({data:e}),b=(e,t=400,n="Bad Request")=>P({data:e,status:t,ok:!1,statusText:n}),B=(e={})=>{let t=p({apiKey:S},e);return k(p({},t),{setJwt:y.fn().mockReturnThis()})},L=e=>new w(e||B()),Y=()=>{let e=L();return Object.defineProperty(e,"isServerSide",{get:()=>!0,configurable:!0}),e},z=e=>{let t=e.mock.calls;if(t.length===0)return;let n=t[t.length-1];return{path:n[0],options:n[1]}},N=(e,t)=>{r(e==null?void 0:e.path).toBe(t)},V=e=>{r(e["Content-Type"]).toBe("application/json")},q=(e,t)=>{r(e.body).toBe(JSON.stringify(t))},X=(e,t,n)=>{r(e).toBeDefined(),e&&(N(e,t),e.options.headers&&V(e.options.headers),n!==void 0&&e.options&&q(e.options,n))},Z=(e,t,n,s)=>i(void 0,null,function*(){t.mockResolvedValue(b(n,s));let a=yield e();r(l(a)).toBe(!0),l(a)&&(r(a.error).toBe(!0),n.message&&r(a.message).toBe(n.message))}),Q=(s,a,...o)=>i(void 0,[s,a,...o],function*(e,t,n=[]){for(let{status:c,message:g}of A){if(n.includes(c))continue;let u={error:!0,message:g};t.mockResolvedValueOnce(b(u,c));let m=yield e();r(l(m)).toBe(!0)}}),ee=(e,t)=>i(void 0,null,function*(){t.mockRejectedValue(new Error("Network error")),yield r(e()).rejects.toThrow("Network error")}),te=(e,t)=>i(void 0,null,function*(){let n={json:y.fn().mockRejectedValue(new Error("Invalid JSON")),ok:!0,status:200};t.mockResolvedValue(n),yield r(e()).rejects.toThrow()}),ne=(e,t)=>i(void 0,null,function*(){t.mockImplementation(()=>new Promise((n,s)=>setTimeout(()=>s(new Error("Request timeout")),0))),yield r(e()).rejects.toThrow("Request timeout")}),se=(e,t,n)=>i(void 0,null,function*(){t.mockResolvedValue(j(n));let s=yield e();r(s).toEqual(n)}),oe=(e={})=>p({address:F.evmAddress,chainType:"evm",type:"smart",config:{adminSigner:{type:"external-wallet",address:E.EVM_TEST}}},e),re=(e={})=>p({id:"txn-123",status:"pending",chainType:"evm",walletType:"evm-smart-wallet",params:{transaction:"0x1234567890abcdef",signer:"api-key:test"},onChain:{txId:"0xabcdef1234567890abcdef1234567890abcdef12",explorerLink:"https://explorer.example.com/tx/0xabcdef1234567890abcdef1234567890abcdef12"},createdAt:Date.now()},e);function l(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error===!0}function C(e){return typeof e=="object"&&e!==null&&"address"in e&&"chainType"in e&&"type"in e}function $(e){return typeof e=="object"&&e!==null&&"id"in e&&"status"in e&&"chainType"in e}var x=e=>new Promise(t=>setTimeout(t,e)),ae=e=>/^0x[a-fA-F0-9]{40}$/.test(e),ie=e=>/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(e),ce=(e,t,n={})=>{let s=p(p({apiKey:e},t&&{overrideBaseUrl:t}),n),a=k(p({},s),{setJwt:()=>a});return new w(a)},v=class{constructor(){this.wallets=[];this.transactions=[]}addWallet(t){t&&!this.wallets.includes(t)&&this.wallets.push(t)}addTransaction(t){t&&!this.transactions.includes(t)&&this.transactions.push(t)}getWallet(t=0){return this.wallets[t]}getTransaction(t=0){return this.transactions[t]}hasWallets(){return this.wallets.length>0}clear(){this.wallets=[],this.transactions=[]}};function pe(s,a){return i(this,arguments,function*(e,t,n={}){if(t.hasWallets())return t.getWallet();let{chainType:o="evm",type:c="mpc",owner:g,testName:u="default"}=n,m=g||`userId:integration-${u}-${Date.now()}`,f=yield e.createWallet(p({chainType:o,type:c},g&&{owner:m}));if(C(f))return t.addWallet(f.address),f.address})}function le(e,t,n){return i(this,null,function*(){let s=yield e.createWallet(n);return C(s)&&t.addWallet(s.address),s})}function ue(e,t){r(l(e)).toBe(!0),t&&r(e.message).toBeDefined()}function de(e){r(C(e)).toBe(!0)}function me(e){r($(e)).toBe(!0)}var I=(e,t,n,s="usdxm",a="base-sepolia")=>i(void 0,null,function*(){let o={amount:n,token:s,chain:a},c=yield e.fundWallet(t,o);if(l(c))throw new Error(`Failed to fund wallet: ${c.message||"Unknown error"}`);return yield x(R),c}),U=(a,o,c,...g)=>i(void 0,[a,o,c,...g],function*(e,t,n,s=M.APPROVE_TRANSACTION_MAX_RETRIES){var m;for(let f=0;f<s;f++){let d=yield e.getTransaction(t,n);if(l(d))throw new Error(`Transaction not found: ${d.message||"Unknown error"}`);if("status"in d&&(d.status==="success"||d.status==="failed"))return d;let T="approvals"in d?(m=d.approvals)==null?void 0:m.pending:void 0;if(T&&T.length>0){let O={approvals:T.map(_=>({signer:_.signer.locator,signature:""}))},h=yield e.approveTransaction(t,n,O);if(l(h))throw new Error(`Failed to approve transaction: ${h.message||"Unknown error"}`);yield x(W);continue}yield x(R)}let u=yield e.getTransaction(t,n);if(l(u))throw new Error(`Transaction not found after retries: ${u.message||"Unknown error"}`);if(!("status"in u))throw new Error("Transaction response missing status property");return u}),fe=(e,t,n=1,s="usdxm",a="base-sepolia")=>i(void 0,null,function*(){return I(e,t,n,s,a)}),ge=(e,t,n,s,a)=>i(void 0,null,function*(){let o=yield e.send(t,n,{recipient:s,amount:a});if(l(o))throw new Error(`Failed to send token: ${o.message||"Unknown error"}`);if(typeof o=="object"&&o!==null&&"id"in o&&typeof o.id=="string")return U(e,t,o.id);throw new Error("Transaction ID not found in send response")}),Te=(e,t,n=1,s="usdxm",a="base-sepolia")=>i(void 0,null,function*(){try{yield I(e,t,n,s,a)}catch(o){let c=o instanceof Error?o.message:String(o);if(!c.includes("already funded")&&!c.includes("insufficient"))throw o}});export{v as TestDataFactory,U as approveTransaction,ce as createIntegrationApiClient,B as createMockCrossmint,b as createMockErrorResponse,P as createMockResponse,re as createMockSendResponse,j as createMockSuccessResponse,oe as createMockWalletResponse,Y as createServerSideApiClient,L as createTestApiClient,le as createTestWallet,x as delay,pe as ensureWalletExists,Te as ensureWalletFunded,V as expectCommonHeaders,ue as expectErrorResponse,q as expectRequestBody,N as expectRequestPath,me as expectSuccessTransactionResponse,de as expectSuccessWalletResponse,z as extractFetchCall,I as fundWallet,fe as fundWalletAndWait,l as isErrorResponse,$ as isSuccessTransactionResponse,C as isSuccessWalletResponse,ae as isValidEthereumAddress,ie as isValidSolanaAddress,ge as sendTokenAndApprove,Q as testCommonHttpErrors,Z as testHttpErrorResponse,te as testInvalidJsonResponse,se as testMalformedResponse,ee as testNetworkError,ne as testTimeoutError,X as validateRequest};
1
+ import{a as A,b as F,i as R,j as W,k as E,l as M,m as S}from"../../chunk-DIGDDKSF.js";import{a as w}from"../../chunk-OQN2SFDC.js";import"../../chunk-7FEY62ID.js";import"../../chunk-4ILFMPNK.js";import"../../chunk-SCEZVF7J.js";import{a as p,b as k,h as i}from"../../chunk-NU7VF7MC.js";import{expect as r,vi as y}from"vitest";var P=({data:e,status:t=200,ok:n=!0,statusText:s="OK"})=>({json:y.fn().mockResolvedValue(e),ok:n,status:t,statusText:s}),j=e=>P({data:e}),b=(e,t=400,n="Bad Request")=>P({data:e,status:t,ok:!1,statusText:n}),B=(e={})=>{let t=p({apiKey:S},e);return k(p({},t),{setJwt:y.fn().mockReturnThis()})},L=e=>new w(e||B()),Y=()=>{let e=L();return Object.defineProperty(e,"isServerSide",{get:()=>!0,configurable:!0}),e},z=e=>{let t=e.mock.calls;if(t.length===0)return;let n=t[t.length-1];return{path:n[0],options:n[1]}},N=(e,t)=>{r(e==null?void 0:e.path).toBe(t)},V=e=>{r(e["Content-Type"]).toBe("application/json")},q=(e,t)=>{r(e.body).toBe(JSON.stringify(t))},X=(e,t,n)=>{r(e).toBeDefined(),e&&(N(e,t),e.options.headers&&V(e.options.headers),n!==void 0&&e.options&&q(e.options,n))},Z=(e,t,n,s)=>i(void 0,null,function*(){t.mockResolvedValue(b(n,s));let a=yield e();r(l(a)).toBe(!0),l(a)&&(r(a.error).toBe(!0),n.message&&r(a.message).toBe(n.message))}),Q=(s,a,...o)=>i(void 0,[s,a,...o],function*(e,t,n=[]){for(let{status:c,message:g}of A){if(n.includes(c))continue;let u={error:!0,message:g};t.mockResolvedValueOnce(b(u,c));let m=yield e();r(l(m)).toBe(!0)}}),ee=(e,t)=>i(void 0,null,function*(){t.mockRejectedValue(new Error("Network error")),yield r(e()).rejects.toThrow("Network error")}),te=(e,t)=>i(void 0,null,function*(){let n={json:y.fn().mockRejectedValue(new Error("Invalid JSON")),ok:!0,status:200};t.mockResolvedValue(n),yield r(e()).rejects.toThrow()}),ne=(e,t)=>i(void 0,null,function*(){t.mockImplementation(()=>new Promise((n,s)=>setTimeout(()=>s(new Error("Request timeout")),0))),yield r(e()).rejects.toThrow("Request timeout")}),se=(e,t,n)=>i(void 0,null,function*(){t.mockResolvedValue(j(n));let s=yield e();r(s).toEqual(n)}),oe=(e={})=>p({address:F.evmAddress,chainType:"evm",type:"smart",config:{adminSigner:{type:"external-wallet",address:E.EVM_TEST}}},e),re=(e={})=>p({id:"txn-123",status:"pending",chainType:"evm",walletType:"evm-smart-wallet",params:{transaction:"0x1234567890abcdef",signer:"api-key:test"},onChain:{txId:"0xabcdef1234567890abcdef1234567890abcdef12",explorerLink:"https://explorer.example.com/tx/0xabcdef1234567890abcdef1234567890abcdef12"},createdAt:Date.now()},e);function l(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error===!0}function C(e){return typeof e=="object"&&e!==null&&"address"in e&&"chainType"in e&&"type"in e}function $(e){return typeof e=="object"&&e!==null&&"id"in e&&"status"in e&&"chainType"in e}var x=e=>new Promise(t=>setTimeout(t,e)),ae=e=>/^0x[a-fA-F0-9]{40}$/.test(e),ie=e=>/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(e),ce=(e,t,n={})=>{let s=p(p({apiKey:e},t&&{overrideBaseUrl:t}),n),a=k(p({},s),{setJwt:()=>a});return new w(a)},v=class{constructor(){this.wallets=[];this.transactions=[]}addWallet(t){t&&!this.wallets.includes(t)&&this.wallets.push(t)}addTransaction(t){t&&!this.transactions.includes(t)&&this.transactions.push(t)}getWallet(t=0){return this.wallets[t]}getTransaction(t=0){return this.transactions[t]}hasWallets(){return this.wallets.length>0}clear(){this.wallets=[],this.transactions=[]}};function pe(s,a){return i(this,arguments,function*(e,t,n={}){if(t.hasWallets())return t.getWallet();let{chainType:o="evm",type:c="mpc",owner:g,testName:u="default"}=n,m=g||`userId:integration-${u}-${Date.now()}`,f=yield e.createWallet(p({chainType:o,type:c},g&&{owner:m}));if(C(f))return t.addWallet(f.address),f.address})}function le(e,t,n){return i(this,null,function*(){let s=yield e.createWallet(n);return C(s)&&t.addWallet(s.address),s})}function ue(e,t){r(l(e)).toBe(!0),t&&r(e.message).toBeDefined()}function de(e){r(C(e)).toBe(!0)}function me(e){r($(e)).toBe(!0)}var I=(e,t,n,s="usdxm",a="base-sepolia")=>i(void 0,null,function*(){let o={amount:n,token:s,chain:a},c=yield e.fundWallet(t,o);if(l(c))throw new Error(`Failed to fund wallet: ${c.message||"Unknown error"}`);return yield x(R),c}),U=(a,o,c,...g)=>i(void 0,[a,o,c,...g],function*(e,t,n,s=M.APPROVE_TRANSACTION_MAX_RETRIES){var m;for(let f=0;f<s;f++){let d=yield e.getTransaction(t,n);if(l(d))throw new Error(`Transaction not found: ${d.message||"Unknown error"}`);if("status"in d&&(d.status==="success"||d.status==="failed"))return d;let T="approvals"in d?(m=d.approvals)==null?void 0:m.pending:void 0;if(T&&T.length>0){let O={approvals:T.map(_=>({signer:_.signer.locator,signature:""}))},h=yield e.approveTransaction(t,n,O);if(l(h))throw new Error(`Failed to approve transaction: ${h.message||"Unknown error"}`);yield x(W);continue}yield x(R)}let u=yield e.getTransaction(t,n);if(l(u))throw new Error(`Transaction not found after retries: ${u.message||"Unknown error"}`);if(!("status"in u))throw new Error("Transaction response missing status property");return u}),fe=(e,t,n=1,s="usdxm",a="base-sepolia")=>i(void 0,null,function*(){return I(e,t,n,s,a)}),ge=(e,t,n,s,a)=>i(void 0,null,function*(){let o=yield e.send(t,n,{recipient:s,amount:a});if(l(o))throw new Error(`Failed to send token: ${o.message||"Unknown error"}`);if(typeof o=="object"&&o!==null&&"id"in o&&typeof o.id=="string")return U(e,t,o.id);throw new Error("Transaction ID not found in send response")}),Te=(e,t,n=1,s="usdxm",a="base-sepolia")=>i(void 0,null,function*(){try{yield I(e,t,n,s,a)}catch(o){let c=o instanceof Error?o.message:String(o);if(!c.includes("already funded")&&!c.includes("insufficient"))throw o}});export{v as TestDataFactory,U as approveTransaction,ce as createIntegrationApiClient,B as createMockCrossmint,b as createMockErrorResponse,P as createMockResponse,re as createMockSendResponse,j as createMockSuccessResponse,oe as createMockWalletResponse,Y as createServerSideApiClient,L as createTestApiClient,le as createTestWallet,x as delay,pe as ensureWalletExists,Te as ensureWalletFunded,V as expectCommonHeaders,ue as expectErrorResponse,q as expectRequestBody,N as expectRequestPath,me as expectSuccessTransactionResponse,de as expectSuccessWalletResponse,z as extractFetchCall,I as fundWallet,fe as fundWalletAndWait,l as isErrorResponse,$ as isSuccessTransactionResponse,C as isSuccessWalletResponse,ae as isValidEthereumAddress,ie as isValidSolanaAddress,ge as sendTokenAndApprove,Q as testCommonHttpErrors,Z as testHttpErrorResponse,te as testInvalidJsonResponse,se as testMalformedResponse,ee as testNetworkError,ne as testTimeoutError,X as validateRequest};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk6GZQZEGQcjs = require('../chunk-6GZQZEGQ.cjs');require('../chunk-XZ4NKVEB.cjs');require('../chunk-7O3W4JAP.cjs');require('../chunk-6ZAGINES.cjs');require('../chunk-DSIFRRBS.cjs');exports.ApiClient = _chunk6GZQZEGQcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkJ5CHOVJLcjs = require('../chunk-J5CHOVJL.cjs');require('../chunk-XZ4NKVEB.cjs');require('../chunk-PSK7FYV7.cjs');require('../chunk-LJNSIXGN.cjs');require('../chunk-DSIFRRBS.cjs');exports.ApiClient = _chunkJ5CHOVJLcjs.a;
@@ -1,5 +1,5 @@
1
1
  import { CrossmintApiClient, Crossmint, APIKeyEnvironmentPrefix } from '@crossmint/common-sdk-base';
2
- import { at as CreateWalletParams, as as CreateWalletResponse, ah as WalletLocator, az as GetWalletResponse, aA as CreateTransactionParams, aB as CreateTransactionResponse, aC as ApproveTransactionParams, aD as ApproveTransactionResponse, aq as GetTransactionResponse, aE as CreateSignatureParams, aF as CreateSignatureResponse, aG as ApproveSignatureParams, ai as ApproveSignatureResponse, aH as GetSignatureResponse, ab as GetTransactionsResponse, aI as GetTransfersResponse, aJ as GetBalanceResponse, aK as FundWalletParams, aa as FundWalletResponse, al as RegisterSignerParams, ao as RegisterSignerResponse, aL as RemoveSignerParams, aM as RemoveSignerResponse, aj as GetSignerResponse, aN as SendParams, ar as SendResponse } from '../types-4EOfiBxs.cjs';
2
+ import { at as CreateWalletParams, as as CreateWalletResponse, ah as WalletLocator, az as GetWalletResponse, aA as CreateTransactionParams, aB as CreateTransactionResponse, aC as ApproveTransactionParams, aD as ApproveTransactionResponse, aq as GetTransactionResponse, aE as CreateSignatureParams, aF as CreateSignatureResponse, aG as ApproveSignatureParams, ai as ApproveSignatureResponse, aH as GetSignatureResponse, ab as GetTransactionsResponse, aI as GetTransfersResponse, aJ as GetBalanceResponse, aK as FundWalletParams, aa as FundWalletResponse, al as RegisterSignerParams, ao as RegisterSignerResponse, aL as RemoveSignerParams, aM as RemoveSignerResponse, aj as GetSignerResponse, aN as SendParams, ar as SendResponse } from '../types-86FbKjRz.cjs';
3
3
  import { Chain } from '../chains/chains.cjs';
4
4
  import 'viem';
5
5
  import './gen/types.gen.cjs';
@@ -1,5 +1,5 @@
1
1
  import { CrossmintApiClient, Crossmint, APIKeyEnvironmentPrefix } from '@crossmint/common-sdk-base';
2
- import { at as CreateWalletParams, as as CreateWalletResponse, ah as WalletLocator, az as GetWalletResponse, aA as CreateTransactionParams, aB as CreateTransactionResponse, aC as ApproveTransactionParams, aD as ApproveTransactionResponse, aq as GetTransactionResponse, aE as CreateSignatureParams, aF as CreateSignatureResponse, aG as ApproveSignatureParams, ai as ApproveSignatureResponse, aH as GetSignatureResponse, ab as GetTransactionsResponse, aI as GetTransfersResponse, aJ as GetBalanceResponse, aK as FundWalletParams, aa as FundWalletResponse, al as RegisterSignerParams, ao as RegisterSignerResponse, aL as RemoveSignerParams, aM as RemoveSignerResponse, aj as GetSignerResponse, aN as SendParams, ar as SendResponse } from '../types-DfpYAsst.js';
2
+ import { at as CreateWalletParams, as as CreateWalletResponse, ah as WalletLocator, az as GetWalletResponse, aA as CreateTransactionParams, aB as CreateTransactionResponse, aC as ApproveTransactionParams, aD as ApproveTransactionResponse, aq as GetTransactionResponse, aE as CreateSignatureParams, aF as CreateSignatureResponse, aG as ApproveSignatureParams, ai as ApproveSignatureResponse, aH as GetSignatureResponse, ab as GetTransactionsResponse, aI as GetTransfersResponse, aJ as GetBalanceResponse, aK as FundWalletParams, aa as FundWalletResponse, al as RegisterSignerParams, ao as RegisterSignerResponse, aL as RemoveSignerParams, aM as RemoveSignerResponse, aj as GetSignerResponse, aN as SendParams, ar as SendResponse } from '../types-BcjKqQz3.js';
3
3
  import { Chain } from '../chains/chains.js';
4
4
  import 'viem';
5
5
  import './gen/types.gen.js';
@@ -1 +1 @@
1
- import{a}from"../chunk-RFWY44CJ.js";import"../chunk-7FEY62ID.js";import"../chunk-TJBIBZMF.js";import"../chunk-NUBGDLR2.js";import"../chunk-NU7VF7MC.js";export{a as ApiClient};
1
+ import{a}from"../chunk-OQN2SFDC.js";import"../chunk-7FEY62ID.js";import"../chunk-4ILFMPNK.js";import"../chunk-SCEZVF7J.js";import"../chunk-NU7VF7MC.js";export{a as ApiClient};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-6HXIZLEQ.cjs');var _chunk6GZQZEGQcjs = require('../chunk-6GZQZEGQ.cjs');require('../chunk-ECAM5KTH.cjs');require('../chunk-XZ4NKVEB.cjs');require('../chunk-7O3W4JAP.cjs');require('../chunk-6ZAGINES.cjs');require('../chunk-DSIFRRBS.cjs');exports.ApiClient = _chunk6GZQZEGQcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-6HXIZLEQ.cjs');var _chunkJ5CHOVJLcjs = require('../chunk-J5CHOVJL.cjs');require('../chunk-ECAM5KTH.cjs');require('../chunk-XZ4NKVEB.cjs');require('../chunk-PSK7FYV7.cjs');require('../chunk-LJNSIXGN.cjs');require('../chunk-DSIFRRBS.cjs');exports.ApiClient = _chunkJ5CHOVJLcjs.a;
@@ -1,5 +1,5 @@
1
1
  export { ApiClient } from './client.cjs';
2
- export { aG as ApproveSignatureParams, ai as ApproveSignatureResponse, aC as ApproveTransactionParams, aD as ApproveTransactionResponse, aE as CreateSignatureParams, aF as CreateSignatureResponse, aA as CreateTransactionParams, aB as CreateTransactionResponse, aO as CreateTransactionSuccessResponse, at as CreateWalletParams, as as CreateWalletResponse, aK as FundWalletParams, aa as FundWalletResponse, aJ as GetBalanceResponse, ay as GetBalanceSuccessResponse, aH as GetSignatureResponse, aj as GetSignerResponse, aP as GetSignersResponse, aq as GetTransactionResponse, ac as GetTransactionSuccessResponse, ab as GetTransactionsResponse, aI as GetTransfersResponse, az as GetWalletResponse, aQ as GetWalletSuccessResponse, aR as RecoverySignerConfig, an as RegisterSignerChain, al as RegisterSignerParams, R as RegisterSignerPasskeyParams, ao as RegisterSignerResponse, aL as RemoveSignerParams, aM as RemoveSignerResponse, S as Scope, aN as SendParams, ar as SendResponse, a0 as Signer, G as TransferScope, H as Transfers, ah as WalletLocator } from '../types-4EOfiBxs.cjs';
2
+ export { aG as ApproveSignatureParams, ai as ApproveSignatureResponse, aC as ApproveTransactionParams, aD as ApproveTransactionResponse, aE as CreateSignatureParams, aF as CreateSignatureResponse, aA as CreateTransactionParams, aB as CreateTransactionResponse, aO as CreateTransactionSuccessResponse, at as CreateWalletParams, as as CreateWalletResponse, aK as FundWalletParams, aa as FundWalletResponse, aJ as GetBalanceResponse, ay as GetBalanceSuccessResponse, aH as GetSignatureResponse, aj as GetSignerResponse, aP as GetSignersResponse, aq as GetTransactionResponse, ac as GetTransactionSuccessResponse, ab as GetTransactionsResponse, aI as GetTransfersResponse, az as GetWalletResponse, aQ as GetWalletSuccessResponse, aR as RecoverySignerConfig, an as RegisterSignerChain, al as RegisterSignerParams, R as RegisterSignerPasskeyParams, ao as RegisterSignerResponse, aL as RemoveSignerParams, aM as RemoveSignerResponse, S as Scope, aN as SendParams, ar as SendResponse, a0 as Signer, G as TransferScope, H as Transfers, ah as WalletLocator } from '../types-86FbKjRz.cjs';
3
3
  import '@crossmint/common-sdk-base';
4
4
  import '../chains/chains.cjs';
5
5
  import 'viem';
@@ -1,5 +1,5 @@
1
1
  export { ApiClient } from './client.js';
2
- export { aG as ApproveSignatureParams, ai as ApproveSignatureResponse, aC as ApproveTransactionParams, aD as ApproveTransactionResponse, aE as CreateSignatureParams, aF as CreateSignatureResponse, aA as CreateTransactionParams, aB as CreateTransactionResponse, aO as CreateTransactionSuccessResponse, at as CreateWalletParams, as as CreateWalletResponse, aK as FundWalletParams, aa as FundWalletResponse, aJ as GetBalanceResponse, ay as GetBalanceSuccessResponse, aH as GetSignatureResponse, aj as GetSignerResponse, aP as GetSignersResponse, aq as GetTransactionResponse, ac as GetTransactionSuccessResponse, ab as GetTransactionsResponse, aI as GetTransfersResponse, az as GetWalletResponse, aQ as GetWalletSuccessResponse, aR as RecoverySignerConfig, an as RegisterSignerChain, al as RegisterSignerParams, R as RegisterSignerPasskeyParams, ao as RegisterSignerResponse, aL as RemoveSignerParams, aM as RemoveSignerResponse, S as Scope, aN as SendParams, ar as SendResponse, a0 as Signer, G as TransferScope, H as Transfers, ah as WalletLocator } from '../types-DfpYAsst.js';
2
+ export { aG as ApproveSignatureParams, ai as ApproveSignatureResponse, aC as ApproveTransactionParams, aD as ApproveTransactionResponse, aE as CreateSignatureParams, aF as CreateSignatureResponse, aA as CreateTransactionParams, aB as CreateTransactionResponse, aO as CreateTransactionSuccessResponse, at as CreateWalletParams, as as CreateWalletResponse, aK as FundWalletParams, aa as FundWalletResponse, aJ as GetBalanceResponse, ay as GetBalanceSuccessResponse, aH as GetSignatureResponse, aj as GetSignerResponse, aP as GetSignersResponse, aq as GetTransactionResponse, ac as GetTransactionSuccessResponse, ab as GetTransactionsResponse, aI as GetTransfersResponse, az as GetWalletResponse, aQ as GetWalletSuccessResponse, aR as RecoverySignerConfig, an as RegisterSignerChain, al as RegisterSignerParams, R as RegisterSignerPasskeyParams, ao as RegisterSignerResponse, aL as RemoveSignerParams, aM as RemoveSignerResponse, S as Scope, aN as SendParams, ar as SendResponse, a0 as Signer, G as TransferScope, H as Transfers, ah as WalletLocator } from '../types-BcjKqQz3.js';
3
3
  import '@crossmint/common-sdk-base';
4
4
  import '../chains/chains.js';
5
5
  import 'viem';
package/dist/api/index.js CHANGED
@@ -1 +1 @@
1
- import"../chunk-5IFDVB4Y.js";import{a}from"../chunk-RFWY44CJ.js";import"../chunk-KBJA7JDT.js";import"../chunk-7FEY62ID.js";import"../chunk-TJBIBZMF.js";import"../chunk-NUBGDLR2.js";import"../chunk-NU7VF7MC.js";export{a as ApiClient};
1
+ import"../chunk-5IFDVB4Y.js";import{a}from"../chunk-OQN2SFDC.js";import"../chunk-KBJA7JDT.js";import"../chunk-7FEY62ID.js";import"../chunk-4ILFMPNK.js";import"../chunk-SCEZVF7J.js";import"../chunk-NU7VF7MC.js";export{a as ApiClient};
@@ -1,6 +1,6 @@
1
1
  import 'viem';
2
2
  import './gen/types.gen.cjs';
3
- export { aG as ApproveSignatureParams, ai as ApproveSignatureResponse, aC as ApproveTransactionParams, aD as ApproveTransactionResponse, aE as CreateSignatureParams, aF as CreateSignatureResponse, aA as CreateTransactionParams, aB as CreateTransactionResponse, aO as CreateTransactionSuccessResponse, at as CreateWalletParams, as as CreateWalletResponse, aK as FundWalletParams, aa as FundWalletResponse, aJ as GetBalanceResponse, ay as GetBalanceSuccessResponse, aH as GetSignatureResponse, aj as GetSignerResponse, aP as GetSignersResponse, aq as GetTransactionResponse, ac as GetTransactionSuccessResponse, ab as GetTransactionsResponse, aI as GetTransfersResponse, az as GetWalletResponse, aQ as GetWalletSuccessResponse, aR as RecoverySignerConfig, an as RegisterSignerChain, al as RegisterSignerParams, R as RegisterSignerPasskeyParams, ao as RegisterSignerResponse, aL as RemoveSignerParams, aM as RemoveSignerResponse, S as Scope, aN as SendParams, ar as SendResponse, a0 as Signer, G as TransferScope, H as Transfers, ah as WalletLocator } from '../types-4EOfiBxs.cjs';
3
+ export { aG as ApproveSignatureParams, ai as ApproveSignatureResponse, aC as ApproveTransactionParams, aD as ApproveTransactionResponse, aE as CreateSignatureParams, aF as CreateSignatureResponse, aA as CreateTransactionParams, aB as CreateTransactionResponse, aO as CreateTransactionSuccessResponse, at as CreateWalletParams, as as CreateWalletResponse, aK as FundWalletParams, aa as FundWalletResponse, aJ as GetBalanceResponse, ay as GetBalanceSuccessResponse, aH as GetSignatureResponse, aj as GetSignerResponse, aP as GetSignersResponse, aq as GetTransactionResponse, ac as GetTransactionSuccessResponse, ab as GetTransactionsResponse, aI as GetTransfersResponse, az as GetWalletResponse, aQ as GetWalletSuccessResponse, aR as RecoverySignerConfig, an as RegisterSignerChain, al as RegisterSignerParams, R as RegisterSignerPasskeyParams, ao as RegisterSignerResponse, aL as RemoveSignerParams, aM as RemoveSignerResponse, S as Scope, aN as SendParams, ar as SendResponse, a0 as Signer, G as TransferScope, H as Transfers, ah as WalletLocator } from '../types-86FbKjRz.cjs';
4
4
  import '../chains/chains.cjs';
5
5
  import 'ox';
6
6
  import '@crossmint/client-sdk-window';
@@ -1,6 +1,6 @@
1
1
  import 'viem';
2
2
  import './gen/types.gen.js';
3
- export { aG as ApproveSignatureParams, ai as ApproveSignatureResponse, aC as ApproveTransactionParams, aD as ApproveTransactionResponse, aE as CreateSignatureParams, aF as CreateSignatureResponse, aA as CreateTransactionParams, aB as CreateTransactionResponse, aO as CreateTransactionSuccessResponse, at as CreateWalletParams, as as CreateWalletResponse, aK as FundWalletParams, aa as FundWalletResponse, aJ as GetBalanceResponse, ay as GetBalanceSuccessResponse, aH as GetSignatureResponse, aj as GetSignerResponse, aP as GetSignersResponse, aq as GetTransactionResponse, ac as GetTransactionSuccessResponse, ab as GetTransactionsResponse, aI as GetTransfersResponse, az as GetWalletResponse, aQ as GetWalletSuccessResponse, aR as RecoverySignerConfig, an as RegisterSignerChain, al as RegisterSignerParams, R as RegisterSignerPasskeyParams, ao as RegisterSignerResponse, aL as RemoveSignerParams, aM as RemoveSignerResponse, S as Scope, aN as SendParams, ar as SendResponse, a0 as Signer, G as TransferScope, H as Transfers, ah as WalletLocator } from '../types-DfpYAsst.js';
3
+ export { aG as ApproveSignatureParams, ai as ApproveSignatureResponse, aC as ApproveTransactionParams, aD as ApproveTransactionResponse, aE as CreateSignatureParams, aF as CreateSignatureResponse, aA as CreateTransactionParams, aB as CreateTransactionResponse, aO as CreateTransactionSuccessResponse, at as CreateWalletParams, as as CreateWalletResponse, aK as FundWalletParams, aa as FundWalletResponse, aJ as GetBalanceResponse, ay as GetBalanceSuccessResponse, aH as GetSignatureResponse, aj as GetSignerResponse, aP as GetSignersResponse, aq as GetTransactionResponse, ac as GetTransactionSuccessResponse, ab as GetTransactionsResponse, aI as GetTransfersResponse, az as GetWalletResponse, aQ as GetWalletSuccessResponse, aR as RecoverySignerConfig, an as RegisterSignerChain, al as RegisterSignerParams, R as RegisterSignerPasskeyParams, ao as RegisterSignerResponse, aL as RemoveSignerParams, aM as RemoveSignerResponse, S as Scope, aN as SendParams, ar as SendResponse, a0 as Signer, G as TransferScope, H as Transfers, ah as WalletLocator } from '../types-BcjKqQz3.js';
4
4
  import '../chains/chains.js';
5
5
  import 'ox';
6
6
  import '@crossmint/client-sdk-window';
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkUF5HZQUOcjs = require('../../chunk-UF5HZQUO.cjs');require('../../chunk-JNKTRQPS.cjs');require('../../chunk-XZ4NKVEB.cjs');require('../../chunk-CCIGWTAO.cjs');require('../../chunk-7O3W4JAP.cjs');require('../../chunk-6ZAGINES.cjs');require('../../chunk-DSIFRRBS.cjs');exports.evmChainAdapter = _chunkUF5HZQUOcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkIX5TSD73cjs = require('../../chunk-IX5TSD73.cjs');require('../../chunk-JNKTRQPS.cjs');require('../../chunk-XZ4NKVEB.cjs');require('../../chunk-CCIGWTAO.cjs');require('../../chunk-PSK7FYV7.cjs');require('../../chunk-LJNSIXGN.cjs');require('../../chunk-DSIFRRBS.cjs');exports.evmChainAdapter = _chunkIX5TSD73cjs.a;
@@ -2,7 +2,7 @@ import { ChainAdapter } from '../chain-adapter.cjs';
2
2
  import '../chains.cjs';
3
3
  import '@crossmint/common-sdk-base';
4
4
  import 'viem';
5
- import '../../types-4EOfiBxs.cjs';
5
+ import '../../types-86FbKjRz.cjs';
6
6
  import '../../api/gen/types.gen.cjs';
7
7
  import 'ox';
8
8
  import '@crossmint/client-sdk-window';
@@ -2,7 +2,7 @@ import { ChainAdapter } from '../chain-adapter.js';
2
2
  import '../chains.js';
3
3
  import '@crossmint/common-sdk-base';
4
4
  import 'viem';
5
- import '../../types-DfpYAsst.js';
5
+ import '../../types-BcjKqQz3.js';
6
6
  import '../../api/gen/types.gen.js';
7
7
  import 'ox';
8
8
  import '@crossmint/client-sdk-window';
@@ -1 +1 @@
1
- import{a}from"../../chunk-EFBUJ2BS.js";import"../../chunk-B4GYB3XY.js";import"../../chunk-7FEY62ID.js";import"../../chunk-455NK5LB.js";import"../../chunk-TJBIBZMF.js";import"../../chunk-NUBGDLR2.js";import"../../chunk-NU7VF7MC.js";export{a as evmChainAdapter};
1
+ import{a}from"../../chunk-M3IEG5GA.js";import"../../chunk-B4GYB3XY.js";import"../../chunk-7FEY62ID.js";import"../../chunk-455NK5LB.js";import"../../chunk-4ILFMPNK.js";import"../../chunk-SCEZVF7J.js";import"../../chunk-NU7VF7MC.js";export{a as evmChainAdapter};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkSNBCG5HRcjs = require('../../chunk-SNBCG5HR.cjs');require('../../chunk-CCIGWTAO.cjs');require('../../chunk-7O3W4JAP.cjs');require('../../chunk-6ZAGINES.cjs');require('../../chunk-DSIFRRBS.cjs');exports.solanaChainAdapter = _chunkSNBCG5HRcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkMGQGQXRPcjs = require('../../chunk-MGQGQXRP.cjs');require('../../chunk-CCIGWTAO.cjs');require('../../chunk-PSK7FYV7.cjs');require('../../chunk-LJNSIXGN.cjs');require('../../chunk-DSIFRRBS.cjs');exports.solanaChainAdapter = _chunkMGQGQXRPcjs.a;
@@ -2,7 +2,7 @@ import { ChainAdapter } from '../chain-adapter.cjs';
2
2
  import '../chains.cjs';
3
3
  import '@crossmint/common-sdk-base';
4
4
  import 'viem';
5
- import '../../types-4EOfiBxs.cjs';
5
+ import '../../types-86FbKjRz.cjs';
6
6
  import '../../api/gen/types.gen.cjs';
7
7
  import 'ox';
8
8
  import '@crossmint/client-sdk-window';
@@ -2,7 +2,7 @@ import { ChainAdapter } from '../chain-adapter.js';
2
2
  import '../chains.js';
3
3
  import '@crossmint/common-sdk-base';
4
4
  import 'viem';
5
- import '../../types-DfpYAsst.js';
5
+ import '../../types-BcjKqQz3.js';
6
6
  import '../../api/gen/types.gen.js';
7
7
  import 'ox';
8
8
  import '@crossmint/client-sdk-window';
@@ -1 +1 @@
1
- import{a}from"../../chunk-TY33CSCI.js";import"../../chunk-455NK5LB.js";import"../../chunk-TJBIBZMF.js";import"../../chunk-NUBGDLR2.js";import"../../chunk-NU7VF7MC.js";export{a as solanaChainAdapter};
1
+ import{a}from"../../chunk-QVE2LOBH.js";import"../../chunk-455NK5LB.js";import"../../chunk-4ILFMPNK.js";import"../../chunk-SCEZVF7J.js";import"../../chunk-NU7VF7MC.js";export{a as solanaChainAdapter};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkP4EW7S5Icjs = require('../../chunk-P4EW7S5I.cjs');require('../../chunk-CCIGWTAO.cjs');require('../../chunk-7O3W4JAP.cjs');require('../../chunk-6ZAGINES.cjs');require('../../chunk-DSIFRRBS.cjs');exports.stellarChainAdapter = _chunkP4EW7S5Icjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk5BRX4CFKcjs = require('../../chunk-5BRX4CFK.cjs');require('../../chunk-CCIGWTAO.cjs');require('../../chunk-PSK7FYV7.cjs');require('../../chunk-LJNSIXGN.cjs');require('../../chunk-DSIFRRBS.cjs');exports.stellarChainAdapter = _chunk5BRX4CFKcjs.a;
@@ -2,7 +2,7 @@ import { ChainAdapter } from '../chain-adapter.cjs';
2
2
  import '../chains.cjs';
3
3
  import '@crossmint/common-sdk-base';
4
4
  import 'viem';
5
- import '../../types-4EOfiBxs.cjs';
5
+ import '../../types-86FbKjRz.cjs';
6
6
  import '../../api/gen/types.gen.cjs';
7
7
  import 'ox';
8
8
  import '@crossmint/client-sdk-window';
@@ -2,7 +2,7 @@ import { ChainAdapter } from '../chain-adapter.js';
2
2
  import '../chains.js';
3
3
  import '@crossmint/common-sdk-base';
4
4
  import 'viem';
5
- import '../../types-DfpYAsst.js';
5
+ import '../../types-BcjKqQz3.js';
6
6
  import '../../api/gen/types.gen.js';
7
7
  import 'ox';
8
8
  import '@crossmint/client-sdk-window';
@@ -1 +1 @@
1
- import{a}from"../../chunk-ZUBX7T2L.js";import"../../chunk-455NK5LB.js";import"../../chunk-TJBIBZMF.js";import"../../chunk-NUBGDLR2.js";import"../../chunk-NU7VF7MC.js";export{a as stellarChainAdapter};
1
+ import{a}from"../../chunk-SZXFHFA5.js";import"../../chunk-455NK5LB.js";import"../../chunk-4ILFMPNK.js";import"../../chunk-SCEZVF7J.js";import"../../chunk-NU7VF7MC.js";export{a as stellarChainAdapter};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkW6APCBJWcjs = require('../chunk-W6APCBJW.cjs');require('../chunk-UF5HZQUO.cjs');require('../chunk-SNBCG5HR.cjs');require('../chunk-P4EW7S5I.cjs');require('../chunk-JNKTRQPS.cjs');require('../chunk-ENU3EKBG.cjs');require('../chunk-XZ4NKVEB.cjs');require('../chunk-CCIGWTAO.cjs');require('../chunk-7O3W4JAP.cjs');require('../chunk-6ZAGINES.cjs');require('../chunk-DSIFRRBS.cjs');exports.getChainAdapter = _chunkW6APCBJWcjs.a; exports.isSupportedChainType = _chunkW6APCBJWcjs.b;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk5VUIA6TBcjs = require('../chunk-5VUIA6TB.cjs');require('../chunk-IX5TSD73.cjs');require('../chunk-MGQGQXRP.cjs');require('../chunk-5BRX4CFK.cjs');require('../chunk-JNKTRQPS.cjs');require('../chunk-ENU3EKBG.cjs');require('../chunk-XZ4NKVEB.cjs');require('../chunk-CCIGWTAO.cjs');require('../chunk-PSK7FYV7.cjs');require('../chunk-LJNSIXGN.cjs');require('../chunk-DSIFRRBS.cjs');exports.getChainAdapter = _chunk5VUIA6TBcjs.a; exports.isSupportedChainType = _chunk5VUIA6TBcjs.b;
@@ -1,5 +1,5 @@
1
1
  import { Chain } from './chains.cjs';
2
- import { an as RegisterSignerChain, ao as RegisterSignerResponse, a1 as PendingSignerOperation, ap as TokenBalance } from '../types-4EOfiBxs.cjs';
2
+ import { an as RegisterSignerChain, ao as RegisterSignerResponse, a1 as PendingSignerOperation, ap as TokenBalance } from '../types-86FbKjRz.cjs';
3
3
  import '@crossmint/common-sdk-base';
4
4
  import 'viem';
5
5
  import '../api/gen/types.gen.cjs';
@@ -1,5 +1,5 @@
1
1
  import { Chain } from './chains.js';
2
- import { an as RegisterSignerChain, ao as RegisterSignerResponse, a1 as PendingSignerOperation, ap as TokenBalance } from '../types-DfpYAsst.js';
2
+ import { an as RegisterSignerChain, ao as RegisterSignerResponse, a1 as PendingSignerOperation, ap as TokenBalance } from '../types-BcjKqQz3.js';
3
3
  import '@crossmint/common-sdk-base';
4
4
  import 'viem';
5
5
  import '../api/gen/types.gen.js';
@@ -1 +1 @@
1
- import{a,b}from"../chunk-EGX2IXWU.js";import"../chunk-EFBUJ2BS.js";import"../chunk-TY33CSCI.js";import"../chunk-ZUBX7T2L.js";import"../chunk-B4GYB3XY.js";import"../chunk-OQZTL6ZG.js";import"../chunk-7FEY62ID.js";import"../chunk-455NK5LB.js";import"../chunk-TJBIBZMF.js";import"../chunk-NUBGDLR2.js";import"../chunk-NU7VF7MC.js";export{a as getChainAdapter,b as isSupportedChainType};
1
+ import{a,b}from"../chunk-YRX44YXB.js";import"../chunk-M3IEG5GA.js";import"../chunk-QVE2LOBH.js";import"../chunk-SZXFHFA5.js";import"../chunk-B4GYB3XY.js";import"../chunk-OQZTL6ZG.js";import"../chunk-7FEY62ID.js";import"../chunk-455NK5LB.js";import"../chunk-4ILFMPNK.js";import"../chunk-SCEZVF7J.js";import"../chunk-NU7VF7MC.js";export{a as getChainAdapter,b as isSupportedChainType};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkWTJC5QBHcjs = require('../chunk-WTJC5QBH.cjs');require('../chunk-5X4EOJFG.cjs');require('../chunk-HRUMWG2F.cjs');require('../chunk-IR5WN6FQ.cjs');require('../chunk-GEY574TH.cjs');require('../chunk-UE3WVHTM.cjs');require('../chunk-XZ4NKVEB.cjs');require('../chunk-CCIGWTAO.cjs');require('../chunk-7O3W4JAP.cjs');require('../chunk-6ZAGINES.cjs');require('../chunk-DSIFRRBS.cjs');exports.isMainnetChain = _chunkWTJC5QBHcjs.c; exports.isTestnetChain = _chunkWTJC5QBHcjs.b; exports.isValidChain = _chunkWTJC5QBHcjs.e; exports.mainnetToTestnet = _chunkWTJC5QBHcjs.d; exports.toViemChain = _chunkWTJC5QBHcjs.a; exports.validateChainForEnvironment = _chunkWTJC5QBHcjs.f;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkOHTCLNE3cjs = require('../chunk-OHTCLNE3.cjs');require('../chunk-5X4EOJFG.cjs');require('../chunk-HRUMWG2F.cjs');require('../chunk-IR5WN6FQ.cjs');require('../chunk-GEY574TH.cjs');require('../chunk-UE3WVHTM.cjs');require('../chunk-XZ4NKVEB.cjs');require('../chunk-CCIGWTAO.cjs');require('../chunk-PSK7FYV7.cjs');require('../chunk-LJNSIXGN.cjs');require('../chunk-DSIFRRBS.cjs');exports.isMainnetChain = _chunkOHTCLNE3cjs.c; exports.isTestnetChain = _chunkOHTCLNE3cjs.b; exports.isValidChain = _chunkOHTCLNE3cjs.e; exports.mainnetToTestnet = _chunkOHTCLNE3cjs.d; exports.toViemChain = _chunkOHTCLNE3cjs.a; exports.validateChainForEnvironment = _chunkOHTCLNE3cjs.f;
@@ -1 +1 @@
1
- import{a,b,c,d,e,f}from"../chunk-URQQBUUX.js";import"../chunk-FT5EVMLB.js";import"../chunk-SVIKBM3S.js";import"../chunk-KKQBZXFE.js";import"../chunk-S3DYQVRD.js";import"../chunk-KUP7H7X2.js";import"../chunk-7FEY62ID.js";import"../chunk-455NK5LB.js";import"../chunk-TJBIBZMF.js";import"../chunk-NUBGDLR2.js";import"../chunk-NU7VF7MC.js";export{c as isMainnetChain,b as isTestnetChain,e as isValidChain,d as mainnetToTestnet,a as toViemChain,f as validateChainForEnvironment};
1
+ import{a,b,c,d,e,f}from"../chunk-N7Z3C5RJ.js";import"../chunk-FT5EVMLB.js";import"../chunk-SVIKBM3S.js";import"../chunk-KKQBZXFE.js";import"../chunk-S3DYQVRD.js";import"../chunk-KUP7H7X2.js";import"../chunk-7FEY62ID.js";import"../chunk-455NK5LB.js";import"../chunk-4ILFMPNK.js";import"../chunk-SCEZVF7J.js";import"../chunk-NU7VF7MC.js";export{c as isMainnetChain,b as isTestnetChain,e as isValidChain,d as mainnetToTestnet,a as toViemChain,f as validateChainForEnvironment};
@@ -1 +1 @@
1
- import{A as C,B as x,C as A,D as y,E as k,I as w,s as M,v as m,x as b}from"./chunk-7FEY62ID.js";import{a as E}from"./chunk-TJBIBZMF.js";import{d as S}from"./chunk-NUBGDLR2.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{A as C,B as x,C as A,D as y,E as k,I as w,s as M,v as m,x as b}from"./chunk-7FEY62ID.js";import{a as E}from"./chunk-4ILFMPNK.js";import{d as S}from"./chunk-SCEZVF7J.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};
@@ -0,0 +1 @@
1
+ import{a as f}from"./chunk-IHMMTMFG.js";import{a as u,b as g,c as v,d as y,e as P}from"./chunk-DCKFFFPG.js";import{a as o}from"./chunk-4ILFMPNK.js";import{a as E,c as w,h}from"./chunk-NU7VF7MC.js";import{validateAPIKey as A,WithLoggerContext as T}from"@crossmint/common-sdk-base";var m=class{constructor(n){this.config=n;this._needsAuth=!0;this._authPromise=null;this._initializationPromise=null;this._onboardingConnectionGeneration=null;typeof window!="undefined"&&(this._initializationPromise=this.initialize()),this.type=this.config.type}locator(){return this.config.locator}address(){return this.config.address}initialize(){return h(this,null,function*(){try{if(this.config.clientTEEConnection==null){let n=A(this.config.crossmint.apiKey);if(!n.isValid)throw new Error("Invalid API key");let t=new f({environment:n.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 n=A(this.config.crossmint.apiKey);if(!n.isValid)throw new Error("Invalid API key");let t=new f({environment:n.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 d;let n=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(),e=yield n.sendAction({event:"request:get-status",responseEvent:"response:get-status",data:{authData:{jwt:(d=this.config.crossmint.jwt)!=null?d:"",apiKey:this.config.crossmint.apiKey}},options:l}),s=Date.now()-t;if((e==null?void 0:e.status)!=="success"){let c=(e==null?void 0:e.status)==="error"&&e.error||"Failed to retrieve signer status",p=(e==null?void 0:e.status)==="error"?e.code:void 0;throw o.error("get-status: failed",{status:e==null?void 0:e.status,error:(e==null?void 0:e.status)==="error"?e.error:void 0,code:p,durationMs:s}),new v(c,p)}if(o.info("get-status: response received",{signerStatus:e.signerStatus,durationMs:s}),e.signerStatus==="ready"){this._needsAuth=!1;return}else this._needsAuth=!0;o.info("Auth required, initiating OTP flow",{needsAuth:this._needsAuth});let{promise:i,resolve:a,reject:r}=this.createAuthPromise();if(this._authPromise={promise:i,resolve:a,reject:r},this.config.onAuthRequired)try{yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),c=>this.verifyOtp(c),()=>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(),c=>this.verifyOtp(c),()=>{var c;return(c=this._authPromise)==null?void 0:c.reject(new u)})),r(new u)}))}catch(c){o.error("handleAuthRequired error",{error:c}),r(c)}try{yield i}catch(c){throw o.error("handleAuthRequired promise error",{error:c}),c}})}ensureAuthenticated(){return h(this,null,function*(){this.config.resetSignerFrame!=null&&(yield this.config.resetSignerFrame()),yield this.handleAuthRequired()})}getJwtOrThrow(){let n=this.config.crossmint.jwt;if(n==null)throw new Error("JWT is required");return n}createAuthPromise(){let n,t;return{promise:new Promise((s,i)=>{n=s,t=i}),resolve:n,reject:t}}sendMessageWithOtp(){return h(this,null,function*(){var r;let n=yield this.getTEEConnection(),t=this.getAuthId();o.info("start-onboarding: sending request");let e=Date.now(),s=this.config.type==="phone"?this.config.channel:void 0,i=yield n.sendAction({event:"request:start-onboarding",responseEvent:"response:start-onboarding",data:{authData:{jwt:(r=this.config.crossmint.jwt)!=null?r:"",apiKey:this.config.crossmint.apiKey},data:E({authId:t},s!=null?{channel:s}:{})},options:l}),a=Date.now()-e;if(this._onboardingConnectionGeneration=n.connectionGeneration,o.info("start-onboarding: response received",{status:i==null?void 0:i.status,durationMs:a}),(i==null?void 0:i.status)==="success"&&i.signerStatus==="ready"){this._needsAuth=!1;return}if((i==null?void 0:i.status)==="error")throw o.error("start-onboarding: failed",{error:i.error,code:i.code}),new g(i.error||"Failed to initiate OTP process.",i.code)})}getAuthId(){return this.config.type==="email"?`email:${this.config.email}`:`phone:${this.config.phone}`}verifyOtp(n){return h(this,null,function*(){var i,a;let t;try{let r=yield this.getTEEConnection();o.info("complete-onboarding: sending request");let d=Date.now();t=yield r.sendAction({event:"request:complete-onboarding",responseEvent:"response:complete-onboarding",data:{authData:{jwt:(i=this.config.crossmint.jwt)!=null?i:"",apiKey:this.config.crossmint.apiKey},data:{onboardingAuthentication:{encryptedOtp:n}}},options:l}),o.info("complete-onboarding: response received",{status:t==null?void 0:t.status,durationMs:Date.now()-d})}catch(r){return o.error("complete-onboarding: error",{error:r}),yield this.handleOnboardingVerificationFailure(r)}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(),r=>this.verifyOtp(r),()=>{var r;return(r=this._authPromise)==null?void 0:r.reject(new u)})),(a=this._authPromise)==null||a.resolve();return}o.error("complete-onboarding: OTP validation failed",{status:t==null?void 0:t.status,error:(t==null?void 0:t.status)==="error"?t.error:void 0,code:(t==null?void 0:t.status)==="error"?t.code:void 0});let e=(t==null?void 0:t.status)==="error"&&t.error||"Failed to validate encrypted OTP",s=(t==null?void 0:t.status)==="error"?t.code:void 0;return yield this.handleOnboardingVerificationFailure(new g(e,s))})}handleOnboardingVerificationFailure(n){return h(this,null,function*(){var s,i,a;this._needsAuth=!0;let t=this.config.clientTEEConnection;if(this._onboardingConnectionGeneration!=null&&t!=null&&t.connectionGeneration!==this._onboardingConnectionGeneration){o.warn("tee.signer.onboarding.reissued",{reason:"signer frame reloaded mid-onboarding, re-issuing OTP",onboardingGeneration:this._onboardingConnectionGeneration,currentGeneration:t==null?void 0:t.connectionGeneration});try{yield this.sendMessageWithOtp()}catch(r){throw(s=this._authPromise)==null||s.reject(r),r}if(!this._needsAuth){(i=this._authPromise)==null||i.resolve();return}throw new P}throw(a=this._authPromise)==null||a.reject(n),n})}_exportPrivateKey(n,t){return h(this,null,function*(){yield this.ensureAuthenticated();let e=this.getJwtOrThrow(),{scheme:s,encoding:i}=this.getChainKeyParams();if(t!=null){let r=n.on("event:key-exported",d=>{n.off(r),d.status==="success"&&Promise.resolve().then(()=>t()).catch(()=>{console.error("[NCS Signer] onExport callback error")})})}let a=yield n.sendAction({event:"request:export-signer",responseEvent:"response:export-signer",data:{authData:{jwt:e,apiKey:this.config.crossmint.apiKey},data:{scheme:s,encoding:i,walletAddress:this.config.address,authId:this.getAuthId()}},options:l});if((a==null?void 0:a.status)==="error")throw o.error("export-signer: failed",{error:a.error,code:a.code}),new y(a.error||"Failed to export private key",a.code)})}};w([T({logger:o,methodName:"handleAuthRequired"})],m.prototype,"handleAuthRequired",1);var l={timeoutMs:3e4};export{m as a,l as b};
@@ -1 +1 @@
1
- import{a as S}from"./chunk-SEOBV6KR.js";import{a as s}from"./chunk-F3NUWFQW.js";import{a as l}from"./chunk-3CEGPUJH.js";import{a as o}from"./chunk-6U5MZQQP.js";import{a as g}from"./chunk-3QKB6K3J.js";import{a as y}from"./chunk-K7BPGUFU.js";import{a as f}from"./chunk-MN2BGRRJ.js";import{a as C}from"./chunk-FQ5F3VYJ.js";import{a as m}from"./chunk-HAQMNZO5.js";import{a as p}from"./chunk-TMOWGJ5Z.js";import{a as u}from"./chunk-MLROTECD.js";import{g as i}from"./chunk-7FEY62ID.js";import{h as t}from"./chunk-NU7VF7MC.js";function c(r,e,n){switch(e.type){case"email":case"phone":return r==="solana"?new l(e):r==="stellar"?new o(e):new s(e);case"api-key":return r==="solana"?new u(e):new C(e);case"external-wallet":return r==="solana"?new g(e):r==="stellar"?new y(e):new m(e);case"server":return S(r,e);case"passkey":return new p(e);case"device":if(n==null)throw new i("Device signer key storage is required for device signers");return new f(e,n)}}function k(r,e,n,a){return t(this,null,function*(){if(!e.startsWith("device:"))return null;let w=e.replace("device:","");return(yield a.hasKey(w))?c(r,{type:"device",locator:e,address:n},a):null})}export{c as a,k as b};
1
+ import{a as S}from"./chunk-SEOBV6KR.js";import{a as s}from"./chunk-KJNGLQC7.js";import{a as l}from"./chunk-XHANQPKI.js";import{a as o}from"./chunk-NUGL76QG.js";import{a as g}from"./chunk-3QKB6K3J.js";import{a as y}from"./chunk-K7BPGUFU.js";import{a as f}from"./chunk-MN2BGRRJ.js";import{a as C}from"./chunk-FQ5F3VYJ.js";import{a as m}from"./chunk-HAQMNZO5.js";import{a as p}from"./chunk-TMOWGJ5Z.js";import{a as u}from"./chunk-MLROTECD.js";import{g as i}from"./chunk-7FEY62ID.js";import{h as t}from"./chunk-NU7VF7MC.js";function c(r,e,n){switch(e.type){case"email":case"phone":return r==="solana"?new l(e):r==="stellar"?new o(e):new s(e);case"api-key":return r==="solana"?new u(e):new C(e);case"external-wallet":return r==="solana"?new g(e):r==="stellar"?new y(e):new m(e);case"server":return S(r,e);case"passkey":return new p(e);case"device":if(n==null)throw new i("Device signer key storage is required for device signers");return new f(e,n)}}function k(r,e,n,a){return t(this,null,function*(){if(!e.startsWith("device:"))return null;let w=e.replace("device:","");return(yield a.hasKey(w))?c(r,{type:"device",locator:e,address:n},a):null})}export{c as a,k as b};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkGMU3ZYLScjs = require('./chunk-GMU3ZYLS.cjs');var _chunkOV256XVKcjs = require('./chunk-OV256XVK.cjs');var _chunkQ3LD5CYJcjs = require('./chunk-Q3LD5CYJ.cjs');var _chunkQPCZFIUVcjs = require('./chunk-QPCZFIUV.cjs');var _chunkXZ4NKVEBcjs = require('./chunk-XZ4NKVEB.cjs');var _chunk7O3W4JAPcjs = require('./chunk-7O3W4JAP.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');var l,m,C,p,y,n,b,A,k,L,K,P,u,V,F,q,B,$,N= exports.a =class{constructor(r){_chunkDSIFRRBScjs.e.call(void 0, this,u);_chunkDSIFRRBScjs.e.call(void 0, this,l,"unknown");_chunkDSIFRRBScjs.e.call(void 0, this,m,!1);_chunkDSIFRRBScjs.e.call(void 0, this,C);_chunkDSIFRRBScjs.e.call(void 0, this,p);_chunkDSIFRRBScjs.e.call(void 0, this,y);_chunkDSIFRRBScjs.e.call(void 0, this,n);_chunkDSIFRRBScjs.e.call(void 0, this,b);_chunkDSIFRRBScjs.e.call(void 0, this,A);_chunkDSIFRRBScjs.e.call(void 0, this,k);_chunkDSIFRRBScjs.e.call(void 0, this,L);_chunkDSIFRRBScjs.e.call(void 0, this,K);_chunkDSIFRRBScjs.e.call(void 0, this,P);_chunkDSIFRRBScjs.f.call(void 0, this,C,r.chain),_chunkDSIFRRBScjs.f.call(void 0, this,p,r.walletAddress),_chunkDSIFRRBScjs.f.call(void 0, this,y,r.options),_chunkDSIFRRBScjs.f.call(void 0, this,n,r.signerManager),_chunkDSIFRRBScjs.f.call(void 0, this,b,r.serverSignerResolver),_chunkDSIFRRBScjs.f.call(void 0, this,A,r.signers),_chunkDSIFRRBScjs.f.call(void 0, this,k,r.addSigner),_chunkDSIFRRBScjs.f.call(void 0, this,L,r.removeSigner),_chunkDSIFRRBScjs.f.call(void 0, this,K,r.approveSignature),_chunkDSIFRRBScjs.f.call(void 0, this,P,r.approveTransaction)}get needsRecovery(){return _chunkDSIFRRBScjs.d.call(void 0, this,l)==="needs-recovery"}onSignerSelected(){_chunkDSIFRRBScjs.d.call(void 0, this,l)==="needs-recovery"&&_chunkDSIFRRBScjs.f.call(void 0, this,l,"unknown")}initDeviceSigner(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var g;if(((g=_chunkDSIFRRBScjs.d.call(void 0, this,y))==null?void 0:g.deviceSignerKeyStorage)==null||_chunkDSIFRRBScjs.d.call(void 0, this,m))return;let i={type:"device"};try{yield this.resolveAvailability(i)}catch(S){_chunk7O3W4JAPcjs.a.error("wallet.initDeviceSigner.error",{error:S}),_chunkDSIFRRBScjs.f.call(void 0, this,l,"needs-recovery");return}if(_chunkDSIFRRBScjs.d.call(void 0, this,l)==="needs-recovery")return;let a=_chunkOV256XVKcjs.a.call(void 0, i.type).buildInternalConfig(i,_chunkDSIFRRBScjs.d.call(void 0, this,n).descriptorContext()),t=yield _chunkDSIFRRBScjs.d.call(void 0, this,n).assemble(a);_chunkDSIFRRBScjs.d.call(void 0, this,n).setActiveSigner(t),_chunkDSIFRRBScjs.d.call(void 0, this,n).isApprovedSignerStatus(t.status)||(_chunk7O3W4JAPcjs.a.info("wallet.initDeviceSigner.pendingApproval",{signerLocator:t.locator(),status:t.status}),_chunkDSIFRRBScjs.f.call(void 0, this,l,"needs-recovery"))})}recover(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var D;if(_chunk7O3W4JAPcjs.a.info("wallet.recover.start"),_chunkDSIFRRBScjs.d.call(void 0, this,l)==="resolved"){_chunk7O3W4JAPcjs.a.info("wallet.recover.skipped",{reason:"Device signer already approved (cached)"});return}if(_chunkDSIFRRBScjs.d.call(void 0, this,m)){_chunk7O3W4JAPcjs.a.info("wallet.recover.skipped",{reason:"device signer not supported (cached)"}),_chunkDSIFRRBScjs.f.call(void 0, this,l,"resolved");return}let r=_chunkDSIFRRBScjs.d.call(void 0, this,n).activeSigner;if((r==null?void 0:r.type)==="device"&&(yield _chunkDSIFRRBScjs.g.call(void 0, this,u,F).call(this,r))){_chunkDSIFRRBScjs.f.call(void 0, this,l,"resolved");return}if(r!=null&&r.type!=="device"){_chunk7O3W4JAPcjs.a.warn("wallet.recover.skipped",{reason:"Recovery is only supported for device signers"}),_chunkDSIFRRBScjs.f.call(void 0, this,l,"unknown");return}let i=(D=_chunkDSIFRRBScjs.d.call(void 0, this,y))==null?void 0:D.deviceSignerKeyStorage;if(i==null){if(_chunkDSIFRRBScjs.d.call(void 0, this,l)!=="needs-recovery")return;throw new Error("Device signer key storage is required to recover a device signer")}let a=yield _chunkDSIFRRBScjs.d.call(void 0, this,A).call(this),t=yield _chunkDSIFRRBScjs.g.call(void 0, this,u,B).call(this,i,a);if(t!=null&&(yield _chunkDSIFRRBScjs.g.call(void 0, this,u,F).call(this,t))){_chunkDSIFRRBScjs.d.call(void 0, this,n).setActiveSigner(t),_chunkDSIFRRBScjs.f.call(void 0, this,l,"resolved");let c=t.locator().replace("device:","");try{yield i.mapAddressToKey(_chunkDSIFRRBScjs.d.call(void 0, this,p),c)}catch(z){_chunk7O3W4JAPcjs.a.warn("wallet.recover.mapAddressToKey.error",{error:z})}return}let g=a.filter(c=>c.type==="device"),S=_chunkDSIFRRBScjs.g.call(void 0, this,u,V).call(this,g,i),v=yield _chunkGMU3ZYLScjs.a.call(void 0, i,_chunkDSIFRRBScjs.d.call(void 0, this,p));try{yield _chunkDSIFRRBScjs.d.call(void 0, this,k).call(this,v)}catch(c){if(c instanceof _chunkXZ4NKVEBcjs.m){_chunk7O3W4JAPcjs.a.info("wallet.recover.device.unsupportedFallback",{signerLocator:v.locator}),yield i.deleteKey(_chunkDSIFRRBScjs.d.call(void 0, this,p)),_chunkDSIFRRBScjs.f.call(void 0, this,m,!0),_chunkDSIFRRBScjs.f.call(void 0, this,l,"resolved"),yield _chunkDSIFRRBScjs.g.call(void 0, this,u,$).call(this);return}else if(G(c))_chunk7O3W4JAPcjs.a.info("wallet.recover.skipped",{reason:"Device signer already approved",signerLocator:v.locator});else throw c instanceof _chunkQPCZFIUVcjs.a||c instanceof Error&&c.name==="AuthRejectedError"?(_chunk7O3W4JAPcjs.a.info("wallet.recover.device.authRejected",{signerLocator:v.locator}),c):c instanceof _chunkQPCZFIUVcjs.b||c instanceof Error&&c.name==="OtpValidationError"?(_chunk7O3W4JAPcjs.a.warn("wallet.recover.device.otpValidationFailed",{signerLocator:v.locator,code:c instanceof _chunkQPCZFIUVcjs.b?c.code:void 0}),c):(_chunk7O3W4JAPcjs.a.error("wallet.recover.device.error",{error:c}),yield i.deleteKey(_chunkDSIFRRBScjs.d.call(void 0, this,p)),c)}let h=yield _chunkDSIFRRBScjs.d.call(void 0, this,n).assemble({type:"device",locator:v.locator,address:_chunkDSIFRRBScjs.d.call(void 0, this,p)});if(_chunkDSIFRRBScjs.d.call(void 0, this,n).setActiveSigner(h),h.type==="device"&&(h.status="success"),_chunk7O3W4JAPcjs.a.info("wallet.recover.device.success",{signerLocator:v.locator}),_chunkDSIFRRBScjs.f.call(void 0, this,l,"resolved"),S!=null)try{yield _chunkDSIFRRBScjs.d.call(void 0, this,L).call(this,S),_chunk7O3W4JAPcjs.a.info("wallet.recover.staleSignerRemoved",{signerLocator:S})}catch(c){_chunk7O3W4JAPcjs.a.warn("wallet.recover.staleSignerRemovalFailed",{signerLocator:S,error:c})}})}resolveAvailability(r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var S;let i=(S=_chunkDSIFRRBScjs.d.call(void 0, this,y))==null?void 0:S.deviceSignerKeyStorage;if(i==null)throw new Error("Device signer key storage is required for device signers");let a=yield i.getKey(_chunkDSIFRRBScjs.d.call(void 0, this,p));if(a!=null){r.locator=`device:${a}`,_chunkDSIFRRBScjs.f.call(void 0, this,l,"unknown");return}let g=(yield _chunkDSIFRRBScjs.d.call(void 0, this,A).call(this)).filter(v=>v.locator.startsWith("device:"));for(let v of g){let h=v.locator.replace("device:","");if(yield i.hasKey(h)){yield i.mapAddressToKey(_chunkDSIFRRBScjs.d.call(void 0, this,p),h),r.locator=v.locator,_chunkDSIFRRBScjs.f.call(void 0, this,l,"unknown");return}}_chunkDSIFRRBScjs.f.call(void 0, this,l,"needs-recovery")})}tryResolveLocallyAvailableSigner(t){return _chunkDSIFRRBScjs.h.call(void 0, this,arguments,function*(r,i=(a=>(a=_chunkDSIFRRBScjs.d.call(void 0, this,y))==null?void 0:a.deviceSignerKeyStorage)()){if(i==null)return null;try{return yield _chunkQ3LD5CYJcjs.b.call(void 0, _chunkDSIFRRBScjs.d.call(void 0, this,C),r,_chunkDSIFRRBScjs.d.call(void 0, this,p),i)}catch(g){return _chunk7O3W4JAPcjs.a.warn("wallet.deviceRecovery.tryResolveLocallyAvailableSigner.failed",{signerLocator:r,error:g}),null}})}};l=new WeakMap,m=new WeakMap,C=new WeakMap,p=new WeakMap,y=new WeakMap,n=new WeakMap,b=new WeakMap,A=new WeakMap,k=new WeakMap,L=new WeakMap,K=new WeakMap,P=new WeakMap,u=new WeakSet,V=function(r,i){if(r.length===0)return;if(r.length===1)return r[0].locator;let a=i.getDeviceName(),t=r.filter(g=>g.name===a);return t.length===1?t[0].locator:void 0},F=function(r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var a;if(_chunkDSIFRRBScjs.d.call(void 0, this,n).isApprovedSignerStatus(r.status))return _chunk7O3W4JAPcjs.a.info("wallet.recover.skipped",{reason:"Device signer already approved"}),!0;let i=yield _chunkDSIFRRBScjs.d.call(void 0, this,n).getSignerState(r.locator());return r.status=(a=i.signer)==null?void 0:a.status,i.pendingOperation!=null?(yield _chunkDSIFRRBScjs.g.call(void 0, this,u,q).call(this,r,i.pendingOperation),!0):_chunkDSIFRRBScjs.d.call(void 0, this,n).isApprovedSignerStatus(r.status)?(_chunk7O3W4JAPcjs.a.info("wallet.recover.skipped",{reason:"Device signer already approved"}),!0):!1})},q=function(r,i){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var h;let a=_chunkDSIFRRBScjs.d.call(void 0, this,n).activeSigner,t=_chunkDSIFRRBScjs.d.call(void 0, this,n).recovery;if(_chunkQPCZFIUVcjs.f.call(void 0, t)&&!_chunkDSIFRRBScjs.d.call(void 0, this,b).hasRecoveryResolution)throw new Error('Cannot resume pending approval: no secret available. Call wallet.useSigner({ type: "server", secret: ... }) first with the recovery server secret.');let g=_chunkOV256XVKcjs.a.call(void 0, t.type),S=_chunkDSIFRRBScjs.d.call(void 0, this,n).descriptorContext();if(t.type==="external-wallet"&&!g.canAutoAssemble(t,S))throw new Error('Cannot resume pending approval: no onSign callback available. Call wallet.useSigner({ type: "external-wallet", address: "0x...", onSign: async (tx) => ... }) first.');let v=g.buildInternalConfig(t,S);_chunkDSIFRRBScjs.d.call(void 0, this,n).setActiveSigner(_chunkQ3LD5CYJcjs.a.call(void 0, _chunkDSIFRRBScjs.d.call(void 0, this,C),v,(h=_chunkDSIFRRBScjs.d.call(void 0, this,y))==null?void 0:h.deviceSignerKeyStorage));try{i.type==="signature"?yield _chunkDSIFRRBScjs.d.call(void 0, this,K).call(this,i.id):yield _chunkDSIFRRBScjs.d.call(void 0, this,P).call(this,i.id)}catch(D){throw _chunkDSIFRRBScjs.d.call(void 0, this,n).setActiveSigner(r),D}finally{_chunkDSIFRRBScjs.d.call(void 0, this,n).activeSigner!==r&&_chunkDSIFRRBScjs.d.call(void 0, this,n).setActiveSigner(a)}r.status="success",_chunk7O3W4JAPcjs.a.info("wallet.recover.device.success",{signerLocator:r.locator(),resumed:!0})})},B=function(r,i){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let a=i.filter(t=>t.locator.startsWith("device:"));for(let t of a){let g=yield this.tryResolveLocallyAvailableSigner(t.locator,r);if(g!=null)return _chunk7O3W4JAPcjs.a.info("wallet.recover.foundLocalDeviceSigner",{signerLocator:t.locator}),g}return null})},$=function(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let r=_chunkDSIFRRBScjs.d.call(void 0, this,n).recovery,i=_chunkOV256XVKcjs.a.call(void 0, r.type),a=_chunkDSIFRRBScjs.d.call(void 0, this,n).descriptorContext();if(i.canAutoAssemble(r,a))try{let t=i.buildInternalConfig(r,a);_chunkDSIFRRBScjs.d.call(void 0, this,n).setActiveSigner(yield _chunkDSIFRRBScjs.d.call(void 0, this,n).assemble(t,{isAdminSigner:!0}))}catch(t){_chunk7O3W4JAPcjs.a.warn("wallet.recover.device.unsupportedFallback.autoAssemblyFailed",{recoveryType:r.type,error:t})}})};function G(x){if(!(x instanceof Error))return!1;let r=x.message.toLowerCase();return r.includes("delegated signer")&&r.includes("already")&&r.includes("approved")}exports.a = N;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkGMU3ZYLScjs = require('./chunk-GMU3ZYLS.cjs');var _chunk44ICOOCJcjs = require('./chunk-44ICOOCJ.cjs');var _chunkNL4MRKYWcjs = require('./chunk-NL4MRKYW.cjs');var _chunkQPCZFIUVcjs = require('./chunk-QPCZFIUV.cjs');var _chunkXZ4NKVEBcjs = require('./chunk-XZ4NKVEB.cjs');var _chunkPSK7FYV7cjs = require('./chunk-PSK7FYV7.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');var l,m,C,p,y,n,b,A,k,L,K,P,u,V,F,q,B,$,N= exports.a =class{constructor(r){_chunkDSIFRRBScjs.e.call(void 0, this,u);_chunkDSIFRRBScjs.e.call(void 0, this,l,"unknown");_chunkDSIFRRBScjs.e.call(void 0, this,m,!1);_chunkDSIFRRBScjs.e.call(void 0, this,C);_chunkDSIFRRBScjs.e.call(void 0, this,p);_chunkDSIFRRBScjs.e.call(void 0, this,y);_chunkDSIFRRBScjs.e.call(void 0, this,n);_chunkDSIFRRBScjs.e.call(void 0, this,b);_chunkDSIFRRBScjs.e.call(void 0, this,A);_chunkDSIFRRBScjs.e.call(void 0, this,k);_chunkDSIFRRBScjs.e.call(void 0, this,L);_chunkDSIFRRBScjs.e.call(void 0, this,K);_chunkDSIFRRBScjs.e.call(void 0, this,P);_chunkDSIFRRBScjs.f.call(void 0, this,C,r.chain),_chunkDSIFRRBScjs.f.call(void 0, this,p,r.walletAddress),_chunkDSIFRRBScjs.f.call(void 0, this,y,r.options),_chunkDSIFRRBScjs.f.call(void 0, this,n,r.signerManager),_chunkDSIFRRBScjs.f.call(void 0, this,b,r.serverSignerResolver),_chunkDSIFRRBScjs.f.call(void 0, this,A,r.signers),_chunkDSIFRRBScjs.f.call(void 0, this,k,r.addSigner),_chunkDSIFRRBScjs.f.call(void 0, this,L,r.removeSigner),_chunkDSIFRRBScjs.f.call(void 0, this,K,r.approveSignature),_chunkDSIFRRBScjs.f.call(void 0, this,P,r.approveTransaction)}get needsRecovery(){return _chunkDSIFRRBScjs.d.call(void 0, this,l)==="needs-recovery"}onSignerSelected(){_chunkDSIFRRBScjs.d.call(void 0, this,l)==="needs-recovery"&&_chunkDSIFRRBScjs.f.call(void 0, this,l,"unknown")}initDeviceSigner(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var g;if(((g=_chunkDSIFRRBScjs.d.call(void 0, this,y))==null?void 0:g.deviceSignerKeyStorage)==null||_chunkDSIFRRBScjs.d.call(void 0, this,m))return;let i={type:"device"};try{yield this.resolveAvailability(i)}catch(S){_chunkPSK7FYV7cjs.a.error("wallet.initDeviceSigner.error",{error:S}),_chunkDSIFRRBScjs.f.call(void 0, this,l,"needs-recovery");return}if(_chunkDSIFRRBScjs.d.call(void 0, this,l)==="needs-recovery")return;let a=_chunk44ICOOCJcjs.a.call(void 0, i.type).buildInternalConfig(i,_chunkDSIFRRBScjs.d.call(void 0, this,n).descriptorContext()),t=yield _chunkDSIFRRBScjs.d.call(void 0, this,n).assemble(a);_chunkDSIFRRBScjs.d.call(void 0, this,n).setActiveSigner(t),_chunkDSIFRRBScjs.d.call(void 0, this,n).isApprovedSignerStatus(t.status)||(_chunkPSK7FYV7cjs.a.info("wallet.initDeviceSigner.pendingApproval",{signerLocator:t.locator(),status:t.status}),_chunkDSIFRRBScjs.f.call(void 0, this,l,"needs-recovery"))})}recover(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var D;if(_chunkPSK7FYV7cjs.a.info("wallet.recover.start"),_chunkDSIFRRBScjs.d.call(void 0, this,l)==="resolved"){_chunkPSK7FYV7cjs.a.info("wallet.recover.skipped",{reason:"Device signer already approved (cached)"});return}if(_chunkDSIFRRBScjs.d.call(void 0, this,m)){_chunkPSK7FYV7cjs.a.info("wallet.recover.skipped",{reason:"device signer not supported (cached)"}),_chunkDSIFRRBScjs.f.call(void 0, this,l,"resolved");return}let r=_chunkDSIFRRBScjs.d.call(void 0, this,n).activeSigner;if((r==null?void 0:r.type)==="device"&&(yield _chunkDSIFRRBScjs.g.call(void 0, this,u,F).call(this,r))){_chunkDSIFRRBScjs.f.call(void 0, this,l,"resolved");return}if(r!=null&&r.type!=="device"){_chunkPSK7FYV7cjs.a.warn("wallet.recover.skipped",{reason:"Recovery is only supported for device signers"}),_chunkDSIFRRBScjs.f.call(void 0, this,l,"unknown");return}let i=(D=_chunkDSIFRRBScjs.d.call(void 0, this,y))==null?void 0:D.deviceSignerKeyStorage;if(i==null){if(_chunkDSIFRRBScjs.d.call(void 0, this,l)!=="needs-recovery")return;throw new Error("Device signer key storage is required to recover a device signer")}let a=yield _chunkDSIFRRBScjs.d.call(void 0, this,A).call(this),t=yield _chunkDSIFRRBScjs.g.call(void 0, this,u,B).call(this,i,a);if(t!=null&&(yield _chunkDSIFRRBScjs.g.call(void 0, this,u,F).call(this,t))){_chunkDSIFRRBScjs.d.call(void 0, this,n).setActiveSigner(t),_chunkDSIFRRBScjs.f.call(void 0, this,l,"resolved");let c=t.locator().replace("device:","");try{yield i.mapAddressToKey(_chunkDSIFRRBScjs.d.call(void 0, this,p),c)}catch(z){_chunkPSK7FYV7cjs.a.warn("wallet.recover.mapAddressToKey.error",{error:z})}return}let g=a.filter(c=>c.type==="device"),S=_chunkDSIFRRBScjs.g.call(void 0, this,u,V).call(this,g,i),v=yield _chunkGMU3ZYLScjs.a.call(void 0, i,_chunkDSIFRRBScjs.d.call(void 0, this,p));try{yield _chunkDSIFRRBScjs.d.call(void 0, this,k).call(this,v)}catch(c){if(c instanceof _chunkXZ4NKVEBcjs.m){_chunkPSK7FYV7cjs.a.info("wallet.recover.device.unsupportedFallback",{signerLocator:v.locator}),yield i.deleteKey(_chunkDSIFRRBScjs.d.call(void 0, this,p)),_chunkDSIFRRBScjs.f.call(void 0, this,m,!0),_chunkDSIFRRBScjs.f.call(void 0, this,l,"resolved"),yield _chunkDSIFRRBScjs.g.call(void 0, this,u,$).call(this);return}else if(G(c))_chunkPSK7FYV7cjs.a.info("wallet.recover.skipped",{reason:"Device signer already approved",signerLocator:v.locator});else throw c instanceof _chunkQPCZFIUVcjs.a||c instanceof Error&&c.name==="AuthRejectedError"?(_chunkPSK7FYV7cjs.a.info("wallet.recover.device.authRejected",{signerLocator:v.locator}),c):c instanceof _chunkQPCZFIUVcjs.b||c instanceof Error&&c.name==="OtpValidationError"?(_chunkPSK7FYV7cjs.a.warn("wallet.recover.device.otpValidationFailed",{signerLocator:v.locator,code:c instanceof _chunkQPCZFIUVcjs.b?c.code:void 0}),c):(_chunkPSK7FYV7cjs.a.error("wallet.recover.device.error",{error:c}),yield i.deleteKey(_chunkDSIFRRBScjs.d.call(void 0, this,p)),c)}let h=yield _chunkDSIFRRBScjs.d.call(void 0, this,n).assemble({type:"device",locator:v.locator,address:_chunkDSIFRRBScjs.d.call(void 0, this,p)});if(_chunkDSIFRRBScjs.d.call(void 0, this,n).setActiveSigner(h),h.type==="device"&&(h.status="success"),_chunkPSK7FYV7cjs.a.info("wallet.recover.device.success",{signerLocator:v.locator}),_chunkDSIFRRBScjs.f.call(void 0, this,l,"resolved"),S!=null)try{yield _chunkDSIFRRBScjs.d.call(void 0, this,L).call(this,S),_chunkPSK7FYV7cjs.a.info("wallet.recover.staleSignerRemoved",{signerLocator:S})}catch(c){_chunkPSK7FYV7cjs.a.warn("wallet.recover.staleSignerRemovalFailed",{signerLocator:S,error:c})}})}resolveAvailability(r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var S;let i=(S=_chunkDSIFRRBScjs.d.call(void 0, this,y))==null?void 0:S.deviceSignerKeyStorage;if(i==null)throw new Error("Device signer key storage is required for device signers");let a=yield i.getKey(_chunkDSIFRRBScjs.d.call(void 0, this,p));if(a!=null){r.locator=`device:${a}`,_chunkDSIFRRBScjs.f.call(void 0, this,l,"unknown");return}let g=(yield _chunkDSIFRRBScjs.d.call(void 0, this,A).call(this)).filter(v=>v.locator.startsWith("device:"));for(let v of g){let h=v.locator.replace("device:","");if(yield i.hasKey(h)){yield i.mapAddressToKey(_chunkDSIFRRBScjs.d.call(void 0, this,p),h),r.locator=v.locator,_chunkDSIFRRBScjs.f.call(void 0, this,l,"unknown");return}}_chunkDSIFRRBScjs.f.call(void 0, this,l,"needs-recovery")})}tryResolveLocallyAvailableSigner(t){return _chunkDSIFRRBScjs.h.call(void 0, this,arguments,function*(r,i=(a=>(a=_chunkDSIFRRBScjs.d.call(void 0, this,y))==null?void 0:a.deviceSignerKeyStorage)()){if(i==null)return null;try{return yield _chunkNL4MRKYWcjs.b.call(void 0, _chunkDSIFRRBScjs.d.call(void 0, this,C),r,_chunkDSIFRRBScjs.d.call(void 0, this,p),i)}catch(g){return _chunkPSK7FYV7cjs.a.warn("wallet.deviceRecovery.tryResolveLocallyAvailableSigner.failed",{signerLocator:r,error:g}),null}})}};l=new WeakMap,m=new WeakMap,C=new WeakMap,p=new WeakMap,y=new WeakMap,n=new WeakMap,b=new WeakMap,A=new WeakMap,k=new WeakMap,L=new WeakMap,K=new WeakMap,P=new WeakMap,u=new WeakSet,V=function(r,i){if(r.length===0)return;if(r.length===1)return r[0].locator;let a=i.getDeviceName(),t=r.filter(g=>g.name===a);return t.length===1?t[0].locator:void 0},F=function(r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var a;if(_chunkDSIFRRBScjs.d.call(void 0, this,n).isApprovedSignerStatus(r.status))return _chunkPSK7FYV7cjs.a.info("wallet.recover.skipped",{reason:"Device signer already approved"}),!0;let i=yield _chunkDSIFRRBScjs.d.call(void 0, this,n).getSignerState(r.locator());return r.status=(a=i.signer)==null?void 0:a.status,i.pendingOperation!=null?(yield _chunkDSIFRRBScjs.g.call(void 0, this,u,q).call(this,r,i.pendingOperation),!0):_chunkDSIFRRBScjs.d.call(void 0, this,n).isApprovedSignerStatus(r.status)?(_chunkPSK7FYV7cjs.a.info("wallet.recover.skipped",{reason:"Device signer already approved"}),!0):!1})},q=function(r,i){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var h;let a=_chunkDSIFRRBScjs.d.call(void 0, this,n).activeSigner,t=_chunkDSIFRRBScjs.d.call(void 0, this,n).recovery;if(_chunkQPCZFIUVcjs.f.call(void 0, t)&&!_chunkDSIFRRBScjs.d.call(void 0, this,b).hasRecoveryResolution)throw new Error('Cannot resume pending approval: no secret available. Call wallet.useSigner({ type: "server", secret: ... }) first with the recovery server secret.');let g=_chunk44ICOOCJcjs.a.call(void 0, t.type),S=_chunkDSIFRRBScjs.d.call(void 0, this,n).descriptorContext();if(t.type==="external-wallet"&&!g.canAutoAssemble(t,S))throw new Error('Cannot resume pending approval: no onSign callback available. Call wallet.useSigner({ type: "external-wallet", address: "0x...", onSign: async (tx) => ... }) first.');let v=g.buildInternalConfig(t,S);_chunkDSIFRRBScjs.d.call(void 0, this,n).setActiveSigner(_chunkNL4MRKYWcjs.a.call(void 0, _chunkDSIFRRBScjs.d.call(void 0, this,C),v,(h=_chunkDSIFRRBScjs.d.call(void 0, this,y))==null?void 0:h.deviceSignerKeyStorage));try{i.type==="signature"?yield _chunkDSIFRRBScjs.d.call(void 0, this,K).call(this,i.id):yield _chunkDSIFRRBScjs.d.call(void 0, this,P).call(this,i.id)}catch(D){throw _chunkDSIFRRBScjs.d.call(void 0, this,n).setActiveSigner(r),D}finally{_chunkDSIFRRBScjs.d.call(void 0, this,n).activeSigner!==r&&_chunkDSIFRRBScjs.d.call(void 0, this,n).setActiveSigner(a)}r.status="success",_chunkPSK7FYV7cjs.a.info("wallet.recover.device.success",{signerLocator:r.locator(),resumed:!0})})},B=function(r,i){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let a=i.filter(t=>t.locator.startsWith("device:"));for(let t of a){let g=yield this.tryResolveLocallyAvailableSigner(t.locator,r);if(g!=null)return _chunkPSK7FYV7cjs.a.info("wallet.recover.foundLocalDeviceSigner",{signerLocator:t.locator}),g}return null})},$=function(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let r=_chunkDSIFRRBScjs.d.call(void 0, this,n).recovery,i=_chunk44ICOOCJcjs.a.call(void 0, r.type),a=_chunkDSIFRRBScjs.d.call(void 0, this,n).descriptorContext();if(i.canAutoAssemble(r,a))try{let t=i.buildInternalConfig(r,a);_chunkDSIFRRBScjs.d.call(void 0, this,n).setActiveSigner(yield _chunkDSIFRRBScjs.d.call(void 0, this,n).assemble(t,{isAdminSigner:!0}))}catch(t){_chunkPSK7FYV7cjs.a.warn("wallet.recover.device.unsupportedFallback.autoAssemblyFailed",{recoveryType:r.type,error:t})}})};function G(x){if(!(x instanceof Error))return!1;let r=x.message.toLowerCase();return r.includes("delegated signer")&&r.includes("already")&&r.includes("approved")}exports.a = N;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkIW4FVUP5cjs = require('./chunk-IW4FVUP5.cjs');var _chunkGUFTPTSIcjs = require('./chunk-GUFTPTSI.cjs');var _chunkEBQT52SLcjs = require('./chunk-EBQT52SL.cjs');var _chunkJEJYT3WDcjs = require('./chunk-JEJYT3WD.cjs');var _chunkMIPKK2GZcjs = require('./chunk-MIPKK2GZ.cjs');var _chunkUWX7ID4Xcjs = require('./chunk-UWX7ID4X.cjs');var _chunkB5U3A75Ucjs = require('./chunk-B5U3A75U.cjs');var _chunkXZ4NKVEBcjs = require('./chunk-XZ4NKVEB.cjs');function u(r){switch(r){case"email":return _chunkJEJYT3WDcjs.a;case"phone":return _chunkB5U3A75Ucjs.a;case"passkey":return _chunkUWX7ID4Xcjs.a;case"device":return _chunkEBQT52SLcjs.a;case"api-key":return _chunkGUFTPTSIcjs.a;case"server":return _chunkIW4FVUP5cjs.a;case"external-wallet":return _chunkMIPKK2GZcjs.b;default:throw new (0, _chunkXZ4NKVEBcjs.k)(`Unknown signer type: ${r}`)}}exports.a = u;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkIW4FVUP5cjs = require('./chunk-IW4FVUP5.cjs');var _chunkGUFTPTSIcjs = require('./chunk-GUFTPTSI.cjs');var _chunkEBQT52SLcjs = require('./chunk-EBQT52SL.cjs');var _chunkJEJYT3WDcjs = require('./chunk-JEJYT3WD.cjs');var _chunkMIPKK2GZcjs = require('./chunk-MIPKK2GZ.cjs');var _chunkUWX7ID4Xcjs = require('./chunk-UWX7ID4X.cjs');var _chunkWOQNCBUXcjs = require('./chunk-WOQNCBUX.cjs');var _chunkXZ4NKVEBcjs = require('./chunk-XZ4NKVEB.cjs');function u(r){switch(r){case"email":return _chunkJEJYT3WDcjs.a;case"phone":return _chunkWOQNCBUXcjs.a;case"passkey":return _chunkUWX7ID4Xcjs.a;case"device":return _chunkEBQT52SLcjs.a;case"api-key":return _chunkGUFTPTSIcjs.a;case"server":return _chunkIW4FVUP5cjs.a;case"external-wallet":return _chunkMIPKK2GZcjs.b;default:throw new (0, _chunkXZ4NKVEBcjs.k)(`Unknown signer type: ${r}`)}}exports.a = u;
@@ -1 +1 @@
1
- import{b as n,c as i}from"./chunk-NUBGDLR2.js";import{SdkLogger as d,BrowserDatadogSink as k,detectPlatform as g,validateAPIKey as l,ServerDatadogSink as m}from"@crossmint/common-sdk-base";var t=new d;function f(s){let o=g(),e=l(s);if(!e.isValid)throw new Error(`Invalid API key: ${e.message}`);let{environment:a,projectId:c}=e;switch(t.init({packageName:i,packageVersion:n,environment:a,projectId:c,platform:o}),o){case"browser":{let r=new k(a);t.addSink(r);break}case"react-native":break;case"server":{let r=new m(a);t.addSink(r);break}default:break}}export{t as a,f as b};
1
+ import{b as n,c as i}from"./chunk-SCEZVF7J.js";import{SdkLogger as d,BrowserDatadogSink as k,detectPlatform as g,validateAPIKey as l,ServerDatadogSink as m}from"@crossmint/common-sdk-base";var t=new d;function f(s){let o=g(),e=l(s);if(!e.isValid)throw new Error(`Invalid API key: ${e.message}`);let{environment:a,projectId:c}=e;switch(t.init({packageName:i,packageVersion:n,environment:a,projectId:c,platform:o}),o){case"browser":{let r=new k(a);t.addSink(r);break}case"react-native":break;case"server":{let r=new m(a);t.addSink(r);break}default:break}}export{t as a,f as b};
@@ -1 +1 @@
1
- import{a as i}from"./chunk-3TZJ6D4G.js";import{z as u}from"./chunk-7FEY62ID.js";import{a as t}from"./chunk-TJBIBZMF.js";import{a as f,c,h as s}from"./chunk-NU7VF7MC.js";import{isValidStellarAddress as T,WithLoggerContext as g}from"@crossmint/common-sdk-base";var m=409,l=class l extends i{constructor(e){super({chain:e.chain,address:e.address,owner:e.owner,options:i.getOptions(e),alias:e.alias,recovery:i.getRecovery(e),apiRecoveryServerSignerAddress:i.getApiRecoveryServerSignerAddress(e),apiDelegatedServerSignerAddresses:i.getApiDelegatedServerSignerAddresses(e),signer:e.signer,signers:i.getInitialSigners(e)},i.getApiClient(e))}static from(e){if(!T(e.address))throw new Error("Wallet is not a Stellar wallet");return new l(e)}sendTransaction(e){return s(this,null,function*(){var d;t.info("stellarWallet.sendTransaction.start"),yield this.preAuthIfNeeded();let r=yield this.createTransaction(e);if((d=e.options)!=null&&d.prepareOnly)return t.info("stellarWallet.sendTransaction.prepared",{transactionId:r.id}),{hash:void 0,explorerLink:void 0,transactionId:r.id};let a={},n=yield this.approveTransactionAndWait(r.id,a);return t.info("stellarWallet.sendTransaction.success",{transactionId:r.id,hash:n.hash}),n})}upgrade(e){return s(this,null,function*(){t.info("stellarWallet.upgrade.start"),yield this.preAuthIfNeeded();let r=yield this.createWalletLifecycleTransaction("upgrade-wallet",e);if(r!=null){if(e!=null&&e.prepareOnly)return t.info("stellarWallet.upgrade.prepared",{transactionId:r}),{hash:void 0,explorerLink:void 0,transactionId:r};yield this.approveTransactionAndWait(r),t.info("stellarWallet.upgrade.phase1.success",{transactionId:r})}else t.info("stellarWallet.upgrade.phase1.skipped",{reason:"wallet already locked from a prior upgrade"});let a=yield this.migrateInternal({signer:e==null?void 0:e.signer,prepareOnly:e==null?void 0:e.prepareOnly});return t.info("stellarWallet.upgrade.success",{transactionId:a.transactionId,hash:a.hash}),a})}migrate(e){return s(this,null,function*(){return yield this.preAuthIfNeeded(),yield this.migrateInternal(e)})}migrateInternal(e){return s(this,null,function*(){t.info("stellarWallet.migrate.start");let r=yield this.createWalletLifecycleTransaction("migrate-wallet",e);if(r==null)throw new u("Failed to create migrate-wallet transaction");if(e!=null&&e.prepareOnly)return t.info("stellarWallet.migrate.prepared",{transactionId:r}),{hash:void 0,explorerLink:void 0,transactionId:r};let a=yield this.approveTransactionAndWait(r);return t.info("stellarWallet.migrate.success",{transactionId:r,hash:a.hash}),a})}createTransaction(e){return s(this,null,function*(){let{contractId:r,options:a}=e,n=this.resolveStellarSigner(a==null?void 0:a.signer),d="transaction"in e?{type:"serialized-transaction",serializedTransaction:e.transaction,contractId:r}:{type:"contract-call",contractId:r,method:e.method,memo:e.memo!=null?{type:"text",value:e.memo}:void 0,args:e.args},p=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:d,signer:n}});if("error"in p)throw new u(JSON.stringify(p));return p})}createWalletLifecycleTransaction(e,r){return s(this,null,function*(){let a=(r==null?void 0:r.signer)!=null?this.resolveStellarSigner(r.signer):void 0,n=yield this.apiClient.createTransaction(this.walletLocator,{params:f({transaction:{type:e}},a!=null?{signer:a}:{})});if("error"in n){if(e==="upgrade-wallet"&&y(n))return null;throw new u(JSON.stringify(n))}return n.id})}resolveStellarSigner(e){return e==null?this.signerManager.require().locator():typeof e=="string"?e:this.resolveServerSignerApiLocator(e)}};c([g({logger:t,methodName:"stellarWallet.sendTransaction",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"sendTransaction",1),c([g({logger:t,methodName:"stellarWallet.upgrade",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"upgrade",1),c([g({logger:t,methodName:"stellarWallet.migrate",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"migrate",1);var h=l;function y(o){return typeof o=="object"&&o!==null&&"statusCode"in o&&o.statusCode===m}export{h as a};
1
+ import{a as i}from"./chunk-TZGYISF7.js";import{z as u}from"./chunk-7FEY62ID.js";import{a as t}from"./chunk-4ILFMPNK.js";import{a as f,c,h as s}from"./chunk-NU7VF7MC.js";import{isValidStellarAddress as T,WithLoggerContext as g}from"@crossmint/common-sdk-base";var m=409,l=class l extends i{constructor(e){super({chain:e.chain,address:e.address,owner:e.owner,options:i.getOptions(e),alias:e.alias,recovery:i.getRecovery(e),apiRecoveryServerSignerAddress:i.getApiRecoveryServerSignerAddress(e),apiDelegatedServerSignerAddresses:i.getApiDelegatedServerSignerAddresses(e),signer:e.signer,signers:i.getInitialSigners(e)},i.getApiClient(e))}static from(e){if(!T(e.address))throw new Error("Wallet is not a Stellar wallet");return new l(e)}sendTransaction(e){return s(this,null,function*(){var d;t.info("stellarWallet.sendTransaction.start"),yield this.preAuthIfNeeded();let r=yield this.createTransaction(e);if((d=e.options)!=null&&d.prepareOnly)return t.info("stellarWallet.sendTransaction.prepared",{transactionId:r.id}),{hash:void 0,explorerLink:void 0,transactionId:r.id};let a={},n=yield this.approveTransactionAndWait(r.id,a);return t.info("stellarWallet.sendTransaction.success",{transactionId:r.id,hash:n.hash}),n})}upgrade(e){return s(this,null,function*(){t.info("stellarWallet.upgrade.start"),yield this.preAuthIfNeeded();let r=yield this.createWalletLifecycleTransaction("upgrade-wallet",e);if(r!=null){if(e!=null&&e.prepareOnly)return t.info("stellarWallet.upgrade.prepared",{transactionId:r}),{hash:void 0,explorerLink:void 0,transactionId:r};yield this.approveTransactionAndWait(r),t.info("stellarWallet.upgrade.phase1.success",{transactionId:r})}else t.info("stellarWallet.upgrade.phase1.skipped",{reason:"wallet already locked from a prior upgrade"});let a=yield this.migrateInternal({signer:e==null?void 0:e.signer,prepareOnly:e==null?void 0:e.prepareOnly});return t.info("stellarWallet.upgrade.success",{transactionId:a.transactionId,hash:a.hash}),a})}migrate(e){return s(this,null,function*(){return yield this.preAuthIfNeeded(),yield this.migrateInternal(e)})}migrateInternal(e){return s(this,null,function*(){t.info("stellarWallet.migrate.start");let r=yield this.createWalletLifecycleTransaction("migrate-wallet",e);if(r==null)throw new u("Failed to create migrate-wallet transaction");if(e!=null&&e.prepareOnly)return t.info("stellarWallet.migrate.prepared",{transactionId:r}),{hash:void 0,explorerLink:void 0,transactionId:r};let a=yield this.approveTransactionAndWait(r);return t.info("stellarWallet.migrate.success",{transactionId:r,hash:a.hash}),a})}createTransaction(e){return s(this,null,function*(){let{contractId:r,options:a}=e,n=this.resolveStellarSigner(a==null?void 0:a.signer),d="transaction"in e?{type:"serialized-transaction",serializedTransaction:e.transaction,contractId:r}:{type:"contract-call",contractId:r,method:e.method,memo:e.memo!=null?{type:"text",value:e.memo}:void 0,args:e.args},p=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:d,signer:n}});if("error"in p)throw new u(JSON.stringify(p));return p})}createWalletLifecycleTransaction(e,r){return s(this,null,function*(){let a=(r==null?void 0:r.signer)!=null?this.resolveStellarSigner(r.signer):void 0,n=yield this.apiClient.createTransaction(this.walletLocator,{params:f({transaction:{type:e}},a!=null?{signer:a}:{})});if("error"in n){if(e==="upgrade-wallet"&&y(n))return null;throw new u(JSON.stringify(n))}return n.id})}resolveStellarSigner(e){return e==null?this.signerManager.require().locator():typeof e=="string"?e:this.resolveServerSignerApiLocator(e)}};c([g({logger:t,methodName:"stellarWallet.sendTransaction",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"sendTransaction",1),c([g({logger:t,methodName:"stellarWallet.upgrade",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"upgrade",1),c([g({logger:t,methodName:"stellarWallet.migrate",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"migrate",1);var h=l;function y(o){return typeof o=="object"&&o!==null&&"statusCode"in o&&o.statusCode===m}export{h as a};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk7O3W4JAPcjs = require('./chunk-7O3W4JAP.cjs');var o={nativeToken:"xlm",walletLocatorPrefix:"me:stellar:smart",supportsSignatures:!1,addSignerChain(n){},extractAddSignerOperation(n,r,t){if(!("transaction"in n)||n.transaction==null)throw _chunk7O3W4JAPcjs.a.error("wallet.addSigner.error",{error:"Expected transaction in response for Solana/Stellar chain"}),new Error("Expected transaction in response for Solana/Stellar chain");return{type:"transaction",id:n.transaction.id}},balanceTokenFields(n){return n!=null&&"contractId"in n?{contractId:n.contractId}:n!=null&&"contractAddress"in n?{contractAddress:n.contractAddress}:{}},emptyBalanceTokenFields(){return{contractId:void 0}}};exports.a = o;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkPSK7FYV7cjs = require('./chunk-PSK7FYV7.cjs');var o={nativeToken:"xlm",walletLocatorPrefix:"me:stellar:smart",supportsSignatures:!1,addSignerChain(n){},extractAddSignerOperation(n,r,t){if(!("transaction"in n)||n.transaction==null)throw _chunkPSK7FYV7cjs.a.error("wallet.addSigner.error",{error:"Expected transaction in response for Solana/Stellar chain"}),new Error("Expected transaction in response for Solana/Stellar chain");return{type:"transaction",id:n.transaction.id}},balanceTokenFields(n){return n!=null&&"contractId"in n?{contractId:n.contractId}:n!=null&&"contractAddress"in n?{contractAddress:n.contractAddress}:{}},emptyBalanceTokenFields(){return{contractId:void 0}}};exports.a = o;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkIX5TSD73cjs = require('./chunk-IX5TSD73.cjs');var _chunkMGQGQXRPcjs = require('./chunk-MGQGQXRP.cjs');var _chunk5BRX4CFKcjs = require('./chunk-5BRX4CFK.cjs');var _chunkENU3EKBGcjs = require('./chunk-ENU3EKBG.cjs');var i={evm:_chunkIX5TSD73cjs.a,solana:_chunkMGQGQXRPcjs.a,stellar:_chunk5BRX4CFKcjs.a};function h(e){return i[_chunkENU3EKBGcjs.a.call(void 0, e)]}function g(e){return Object.prototype.hasOwnProperty.call(i,e)}exports.a = h; exports.b = g;
@@ -1 +1 @@
1
- import{a as P}from"./chunk-NZXYWQE5.js";import{a as v}from"./chunk-IOSADDL5.js";import{o as w}from"./chunk-7FEY62ID.js";import{a as l}from"./chunk-TJBIBZMF.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
+ import{a as P}from"./chunk-NZXYWQE5.js";import{a as v}from"./chunk-IOSADDL5.js";import{o as w}from"./chunk-7FEY62ID.js";import{a as l}from"./chunk-4ILFMPNK.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};