@crossmint/wallets-sdk 1.0.0-beta.4 → 1.0.0-beta.6

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 (221) hide show
  1. package/dist/api/__tests__/constants.d.cts +1 -1
  2. package/dist/api/__tests__/constants.d.ts +1 -1
  3. package/dist/api/__tests__/test-utils.cjs +1 -1
  4. package/dist/api/__tests__/test-utils.d.cts +1 -1
  5. package/dist/api/__tests__/test-utils.d.ts +1 -1
  6. package/dist/api/__tests__/test-utils.js +1 -1
  7. package/dist/api/client.cjs +1 -1
  8. package/dist/api/client.d.cts +1 -1
  9. package/dist/api/client.d.ts +1 -1
  10. package/dist/api/client.js +1 -1
  11. package/dist/api/index.cjs +1 -1
  12. package/dist/api/index.d.cts +1 -1
  13. package/dist/api/index.d.ts +1 -1
  14. package/dist/api/index.js +1 -1
  15. package/dist/api/types.d.cts +1 -1
  16. package/dist/api/types.d.ts +1 -1
  17. package/dist/chains/chains.cjs +1 -1
  18. package/dist/chains/chains.js +1 -1
  19. package/dist/{chunk-IYRVMHRW.js → chunk-2GHG5OLB.js} +1 -1
  20. package/dist/{chunk-KCOND2E6.js → chunk-3NHE4HDZ.js} +1 -1
  21. package/dist/{chunk-MMFZP54X.js → chunk-3VRN3GKQ.js} +1 -1
  22. package/dist/{chunk-7VUOD7EI.cjs → chunk-4DJWSV7I.cjs} +1 -1
  23. package/dist/{chunk-L3HSG6Q5.cjs → chunk-5ZVOGNTQ.cjs} +1 -1
  24. package/dist/{chunk-6XY4DLBW.js → chunk-6X5JEJD7.js} +1 -1
  25. package/dist/chunk-775TCWSR.js +1 -0
  26. package/dist/{chunk-O5WMZIT3.cjs → chunk-7V3D66VW.cjs} +1 -1
  27. package/dist/{chunk-2ITOLYW3.js → chunk-AP3LII6O.js} +1 -1
  28. package/dist/{chunk-LB4V5KKI.js → chunk-CKZYSQOK.js} +1 -1
  29. package/dist/chunk-CSSZNKEY.js +1 -0
  30. package/dist/chunk-CZ2D3WAR.cjs +1 -0
  31. package/dist/chunk-D6SLJ5C2.cjs +1 -0
  32. package/dist/{chunk-NJEW3A4J.cjs → chunk-E54SDHZV.cjs} +1 -1
  33. package/dist/{chunk-CIKFO2S5.js → chunk-EUV6MRGJ.js} +1 -1
  34. package/dist/chunk-F5O43FK3.js +1 -0
  35. package/dist/{chunk-NJWSHT2H.cjs → chunk-GEY3BU62.cjs} +1 -1
  36. package/dist/chunk-GJ3YJPL4.cjs +1 -0
  37. package/dist/{chunk-TTNUB2AD.cjs → chunk-GZP2JQ6P.cjs} +1 -1
  38. package/dist/{chunk-RD3ZYT3L.cjs → chunk-I5OHRBMR.cjs} +1 -1
  39. package/dist/{chunk-RXRRXB74.cjs → chunk-IJ632UXD.cjs} +1 -1
  40. package/dist/{chunk-J35YEECK.cjs → chunk-JXNZMD5W.cjs} +1 -1
  41. package/dist/{chunk-U2AHGQVY.cjs → chunk-K5SDVE5F.cjs} +1 -1
  42. package/dist/chunk-KGBCGBUZ.js +3 -0
  43. package/dist/chunk-LBA7SXSA.cjs +1 -0
  44. package/dist/chunk-LSPTALFD.cjs +3 -0
  45. package/dist/chunk-M2IOHEJR.js +1 -0
  46. package/dist/chunk-M335XCYO.js +1 -0
  47. package/dist/{chunk-ZE4NT3CJ.js → chunk-N355UETO.js} +1 -1
  48. package/dist/chunk-N4IWDL6M.js +1 -0
  49. package/dist/chunk-N7F2TDUR.cjs +1 -0
  50. package/dist/chunk-OGP7B5O3.cjs +1 -0
  51. package/dist/{chunk-X56VYCUR.js → chunk-OJUPTHNV.js} +1 -1
  52. package/dist/{chunk-XTXZKBPM.js → chunk-OXNBTAYA.js} +1 -1
  53. package/dist/{chunk-JJMKQ5PK.cjs → chunk-PHPBBEXU.cjs} +1 -1
  54. package/dist/{chunk-SH7KRBXV.js → chunk-QVTKTDED.js} +1 -1
  55. package/dist/{chunk-N57ARKT3.cjs → chunk-RKTFURXX.cjs} +1 -1
  56. package/dist/{chunk-EBSUOTYD.cjs → chunk-SCX54NM2.cjs} +1 -1
  57. package/dist/{chunk-RNAUBUFH.cjs → chunk-SGQ75PW5.cjs} +1 -1
  58. package/dist/chunk-T37VPMV3.cjs +1 -0
  59. package/dist/{chunk-OIYYEGNS.js → chunk-TIBTXGTU.js} +1 -1
  60. package/dist/chunk-TTUZDIDK.js +1 -0
  61. package/dist/chunk-UOKPSLMQ.js +1 -0
  62. package/dist/chunk-VADIEIDS.js +1 -0
  63. package/dist/{chunk-2GXYCJD4.js → chunk-X7BAYHQI.js} +1 -1
  64. package/dist/{chunk-WBIKVPHW.js → chunk-YH7G2U6V.js} +1 -1
  65. package/dist/chunk-YHV3672R.cjs +1 -0
  66. package/dist/{chunk-MBFWSNXX.js → chunk-YQKIRK4F.js} +1 -1
  67. package/dist/chunk-Z42FAU67.cjs +1 -0
  68. package/dist/index.cjs +1 -1
  69. package/dist/index.d.cts +1 -1
  70. package/dist/index.d.ts +1 -1
  71. package/dist/index.js +1 -1
  72. package/dist/logger/index.cjs +1 -1
  73. package/dist/logger/index.js +1 -1
  74. package/dist/logger/init.cjs +1 -1
  75. package/dist/logger/init.js +1 -1
  76. package/dist/sdk.cjs +1 -1
  77. package/dist/sdk.d.cts +1 -2
  78. package/dist/sdk.d.ts +1 -2
  79. package/dist/sdk.js +1 -1
  80. package/dist/signers/device.cjs +1 -1
  81. package/dist/signers/device.d.cts +2 -2
  82. package/dist/signers/device.d.ts +2 -2
  83. package/dist/signers/device.js +1 -1
  84. package/dist/signers/evm-api-key.cjs +1 -1
  85. package/dist/signers/evm-api-key.d.cts +2 -2
  86. package/dist/signers/evm-api-key.d.ts +2 -2
  87. package/dist/signers/evm-api-key.js +1 -1
  88. package/dist/signers/evm-external-wallet.d.cts +1 -1
  89. package/dist/signers/evm-external-wallet.d.ts +1 -1
  90. package/dist/signers/external-wallet-signer.d.cts +2 -2
  91. package/dist/signers/external-wallet-signer.d.ts +2 -2
  92. package/dist/signers/index.cjs +1 -1
  93. package/dist/signers/index.d.cts +2 -2
  94. package/dist/signers/index.d.ts +2 -2
  95. package/dist/signers/index.js +1 -1
  96. package/dist/signers/non-custodial/index.cjs +1 -1
  97. package/dist/signers/non-custodial/index.d.cts +1 -1
  98. package/dist/signers/non-custodial/index.d.ts +1 -1
  99. package/dist/signers/non-custodial/index.js +1 -1
  100. package/dist/signers/non-custodial/ncs-evm-signer.cjs +1 -1
  101. package/dist/signers/non-custodial/ncs-evm-signer.d.cts +1 -1
  102. package/dist/signers/non-custodial/ncs-evm-signer.d.ts +1 -1
  103. package/dist/signers/non-custodial/ncs-evm-signer.js +1 -1
  104. package/dist/signers/non-custodial/ncs-signer.cjs +1 -1
  105. package/dist/signers/non-custodial/ncs-signer.d.cts +2 -2
  106. package/dist/signers/non-custodial/ncs-signer.d.ts +2 -2
  107. package/dist/signers/non-custodial/ncs-signer.js +1 -1
  108. package/dist/signers/non-custodial/ncs-solana-signer.cjs +1 -1
  109. package/dist/signers/non-custodial/ncs-solana-signer.d.cts +1 -1
  110. package/dist/signers/non-custodial/ncs-solana-signer.d.ts +1 -1
  111. package/dist/signers/non-custodial/ncs-solana-signer.js +1 -1
  112. package/dist/signers/non-custodial/ncs-stellar-signer.cjs +1 -1
  113. package/dist/signers/non-custodial/ncs-stellar-signer.d.cts +1 -1
  114. package/dist/signers/non-custodial/ncs-stellar-signer.d.ts +1 -1
  115. package/dist/signers/non-custodial/ncs-stellar-signer.js +1 -1
  116. package/dist/signers/passkey.cjs +1 -1
  117. package/dist/signers/passkey.d.cts +2 -2
  118. package/dist/signers/passkey.d.ts +2 -2
  119. package/dist/signers/passkey.js +1 -1
  120. package/dist/signers/server/assemble-server-signer.cjs +1 -1
  121. package/dist/signers/server/assemble-server-signer.d.cts +2 -2
  122. package/dist/signers/server/assemble-server-signer.d.ts +2 -2
  123. package/dist/signers/server/assemble-server-signer.js +1 -1
  124. package/dist/signers/server/evm-server-signer.cjs +1 -1
  125. package/dist/signers/server/evm-server-signer.d.cts +2 -2
  126. package/dist/signers/server/evm-server-signer.d.ts +2 -2
  127. package/dist/signers/server/evm-server-signer.js +1 -1
  128. package/dist/signers/server/helpers/derive-server-signer.d.cts +1 -1
  129. package/dist/signers/server/helpers/derive-server-signer.d.ts +1 -1
  130. package/dist/signers/server/helpers/index.d.cts +1 -1
  131. package/dist/signers/server/helpers/index.d.ts +1 -1
  132. package/dist/signers/server/index.cjs +1 -1
  133. package/dist/signers/server/index.d.cts +1 -1
  134. package/dist/signers/server/index.d.ts +1 -1
  135. package/dist/signers/server/index.js +1 -1
  136. package/dist/signers/server/solana-server-signer.cjs +1 -1
  137. package/dist/signers/server/solana-server-signer.d.cts +2 -2
  138. package/dist/signers/server/solana-server-signer.d.ts +2 -2
  139. package/dist/signers/server/solana-server-signer.js +1 -1
  140. package/dist/signers/server/stellar-server-signer.d.cts +2 -2
  141. package/dist/signers/server/stellar-server-signer.d.ts +2 -2
  142. package/dist/signers/solana-api-key.cjs +1 -1
  143. package/dist/signers/solana-api-key.d.cts +2 -2
  144. package/dist/signers/solana-api-key.d.ts +2 -2
  145. package/dist/signers/solana-api-key.js +1 -1
  146. package/dist/signers/solana-external-wallet.d.cts +1 -1
  147. package/dist/signers/solana-external-wallet.d.ts +1 -1
  148. package/dist/signers/stellar-external-wallet.d.cts +1 -1
  149. package/dist/signers/stellar-external-wallet.d.ts +1 -1
  150. package/dist/signers/types.cjs +1 -1
  151. package/dist/signers/types.d.cts +1 -1
  152. package/dist/signers/types.d.ts +1 -1
  153. package/dist/signers/types.js +1 -1
  154. package/dist/{types-DVXPGSpw.d.ts → types-D85tj2g6.d.ts} +13 -12
  155. package/dist/{types-CpT91HUW.d.cts → types-DBvW4nPw.d.cts} +13 -12
  156. package/dist/utils/constants.cjs +1 -1
  157. package/dist/utils/constants.js +1 -1
  158. package/dist/utils/device-signers/IframeDeviceSignerKeyStorage.cjs +1 -1
  159. package/dist/utils/device-signers/IframeDeviceSignerKeyStorage.js +1 -1
  160. package/dist/utils/device-signers/createDeviceSigner.cjs +1 -1
  161. package/dist/utils/device-signers/createDeviceSigner.d.cts +1 -1
  162. package/dist/utils/device-signers/createDeviceSigner.d.ts +1 -1
  163. package/dist/utils/device-signers/createDeviceSigner.js +1 -1
  164. package/dist/utils/device-signers/index.cjs +1 -1
  165. package/dist/utils/device-signers/index.d.cts +1 -1
  166. package/dist/utils/device-signers/index.d.ts +1 -1
  167. package/dist/utils/device-signers/index.js +1 -1
  168. package/dist/utils/signer-locator.d.cts +1 -1
  169. package/dist/utils/signer-locator.d.ts +1 -1
  170. package/dist/utils/signer-mapping.cjs +1 -1
  171. package/dist/utils/signer-mapping.d.cts +13 -9
  172. package/dist/utils/signer-mapping.d.ts +13 -9
  173. package/dist/utils/signer-mapping.js +1 -1
  174. package/dist/wallets/__tests__/test-helpers.cjs +1 -1
  175. package/dist/wallets/__tests__/test-helpers.d.cts +1 -1
  176. package/dist/wallets/__tests__/test-helpers.d.ts +1 -1
  177. package/dist/wallets/__tests__/test-helpers.js +1 -1
  178. package/dist/wallets/evm.cjs +1 -1
  179. package/dist/wallets/evm.d.cts +1 -1
  180. package/dist/wallets/evm.d.ts +1 -1
  181. package/dist/wallets/evm.js +1 -1
  182. package/dist/wallets/solana.cjs +1 -1
  183. package/dist/wallets/solana.d.cts +1 -1
  184. package/dist/wallets/solana.d.ts +1 -1
  185. package/dist/wallets/solana.js +1 -1
  186. package/dist/wallets/stellar.cjs +1 -1
  187. package/dist/wallets/stellar.d.cts +1 -1
  188. package/dist/wallets/stellar.d.ts +1 -1
  189. package/dist/wallets/stellar.js +1 -1
  190. package/dist/wallets/types.d.cts +1 -1
  191. package/dist/wallets/types.d.ts +1 -1
  192. package/dist/wallets/wallet-factory.cjs +1 -1
  193. package/dist/wallets/wallet-factory.d.cts +1 -1
  194. package/dist/wallets/wallet-factory.d.ts +1 -1
  195. package/dist/wallets/wallet-factory.js +1 -1
  196. package/dist/wallets/wallet.cjs +1 -1
  197. package/dist/wallets/wallet.d.cts +23 -14
  198. package/dist/wallets/wallet.d.ts +23 -14
  199. package/dist/wallets/wallet.js +1 -1
  200. package/package.json +1 -1
  201. package/dist/chunk-576HP23H.cjs +0 -1
  202. package/dist/chunk-5URDSXVQ.js +0 -1
  203. package/dist/chunk-6FGJ3ICD.js +0 -1
  204. package/dist/chunk-DCHEMXSV.cjs +0 -1
  205. package/dist/chunk-EIHK5TYE.js +0 -1
  206. package/dist/chunk-GEN63WDH.js +0 -1
  207. package/dist/chunk-HCC5C4YI.js +0 -1
  208. package/dist/chunk-ITNNPNZL.cjs +0 -1
  209. package/dist/chunk-KLL2BBSZ.cjs +0 -1
  210. package/dist/chunk-LY5YPRHI.js +0 -1
  211. package/dist/chunk-LZNQBJEK.cjs +0 -1
  212. package/dist/chunk-MDJPC3BI.cjs +0 -1
  213. package/dist/chunk-N5WVT7QE.js +0 -1
  214. package/dist/chunk-SE7543EV.cjs +0 -1
  215. package/dist/chunk-TTSJFEM5.cjs +0 -1
  216. package/dist/chunk-YZDV5F74.js +0 -1
  217. package/dist/chunk-ZB35EKCS.cjs +0 -1
  218. package/dist/chunk-ZIUQ3B7O.js +0 -1
  219. package/dist/chunk-ZS3XSKA4.cjs +0 -1
  220. package/dist/chunk-ZUZCUZSL.js +0 -1
  221. /package/dist/{chunk-W5EH3HYF.cjs → chunk-3SVXPFSP.cjs} +0 -0
@@ -1,4 +1,4 @@
1
- import { a2 as WalletLocator } from '../../types-CpT91HUW.cjs';
1
+ import { a2 as WalletLocator } from '../../types-DBvW4nPw.cjs';
2
2
  import 'viem';
3
3
  import '../gen/types.gen.cjs';
4
4
  import 'ox';
@@ -1,4 +1,4 @@
1
- import { a2 as WalletLocator } from '../../types-DVXPGSpw.js';
1
+ import { a2 as WalletLocator } from '../../types-D85tj2g6.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 _chunkITNNPNZLcjs = require('../../chunk-ITNNPNZL.cjs');require('../../chunk-T3U46LK3.cjs');require('../../chunk-U2AHGQVY.cjs');require('../../chunk-N57ARKT3.cjs');var _chunk2GKPWQBQcjs = require('../../chunk-2GKPWQBQ.cjs');var _vitest = require('vitest');var b=({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=>b({data:e}),P= exports.createMockErrorResponse =(e,t=400,n="Bad Request")=>b({data:e,status:t,ok:!1,statusText:n}),B= exports.createMockCrossmint =(e={})=>{let t=_chunk2GKPWQBQcjs.a.call(void 0, {apiKey:_chunkJ33QM2IDcjs.m},e);return _chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {},t),{setJwt:_vitest.vi.fn().mockReturnThis()})},L= exports.createTestApiClient =e=>new (0, _chunkITNNPNZLcjs.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)=>_chunk2GKPWQBQcjs.g.call(void 0, void 0,null,function*(){t.mockResolvedValue(P(n,s));let a=yield e();_vitest.expect.call(void 0, u(a)).toBe(!0),u(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)=>_chunk2GKPWQBQcjs.g.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 l={error:!0,message:g};t.mockResolvedValueOnce(P(l,c));let m=yield e();_vitest.expect.call(void 0, u(m)).toBe(!0)}}),Q= exports.testNetworkError =(e,t)=>_chunk2GKPWQBQcjs.g.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)=>_chunk2GKPWQBQcjs.g.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)=>_chunk2GKPWQBQcjs.g.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)=>_chunk2GKPWQBQcjs.g.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={})=>_chunk2GKPWQBQcjs.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={})=>_chunk2GKPWQBQcjs.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 u(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error===!0}function h(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=_chunk2GKPWQBQcjs.a.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {apiKey:e},t&&{overrideBaseUrl:t}),n),a=_chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {},s),{setJwt:()=>a});return new (0, _chunkITNNPNZLcjs.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 _chunk2GKPWQBQcjs.g.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:l="default"}=n,m=g||`userId:integration-${l}-${Date.now()}`,f=yield e.createWallet(_chunk2GKPWQBQcjs.a.call(void 0, {chainType:o,type:c},g&&{owner:m}));if(h(f))return t.addWallet(f.address),f.address})}function pe(e,t,n){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let s=yield e.createWallet(n);return h(s)&&t.addWallet(s.address),s})}function ue(e,t){_vitest.expect.call(void 0, u(e)).toBe(!0),t&&_vitest.expect.call(void 0, e.message).toBeDefined()}function le(e){_vitest.expect.call(void 0, h(e)).toBe(!0)}function de(e){_vitest.expect.call(void 0, $(e)).toBe(!0)}var I=(e,t,n,s="usdxm",a="base-sepolia")=>_chunk2GKPWQBQcjs.g.call(void 0, void 0,null,function*(){let o={amount:n,token:s,chain:a},c=yield e.fundWallet(t,o);if(u(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)=>_chunk2GKPWQBQcjs.g.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(u(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:""}))},C=yield e.approveTransaction(t,n,O);if(u(C))throw new Error(`Failed to approve transaction: ${C.message||"Unknown error"}`);yield x(_chunkJ33QM2IDcjs.j);continue}yield x(_chunkJ33QM2IDcjs.i)}let l=yield e.getTransaction(t,n);if(u(l))throw new Error(`Transaction not found after retries: ${l.message||"Unknown error"}`);if(!("status"in l))throw new Error("Transaction response missing status property");return l}),me= exports.fundWalletAndWait =(e,t,n=1,s="usdxm",a="base-sepolia")=>_chunk2GKPWQBQcjs.g.call(void 0, void 0,null,function*(){return I(e,t,n,s,a)}),fe= exports.sendTokenAndApprove =(e,t,n,s,a)=>_chunk2GKPWQBQcjs.g.call(void 0, void 0,null,function*(){let o=yield e.send(t,n,{recipient:s,amount:a});if(u(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")=>_chunk2GKPWQBQcjs.g.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 = P; exports.createMockResponse = b; 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 = ue; exports.expectRequestBody = q; exports.expectRequestPath = N; exports.expectSuccessTransactionResponse = de; exports.expectSuccessWalletResponse = le; exports.extractFetchCall = Y; exports.fundWallet = I; exports.fundWalletAndWait = me; exports.isErrorResponse = u; exports.isSuccessTransactionResponse = $; exports.isSuccessWalletResponse = h; 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 _chunkZ42FAU67cjs = require('../../chunk-Z42FAU67.cjs');require('../../chunk-T3U46LK3.cjs');require('../../chunk-K5SDVE5F.cjs');require('../../chunk-RKTFURXX.cjs');var _chunk2GKPWQBQcjs = require('../../chunk-2GKPWQBQ.cjs');var _vitest = require('vitest');var b=({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=>b({data:e}),P= exports.createMockErrorResponse =(e,t=400,n="Bad Request")=>b({data:e,status:t,ok:!1,statusText:n}),B= exports.createMockCrossmint =(e={})=>{let t=_chunk2GKPWQBQcjs.a.call(void 0, {apiKey:_chunkJ33QM2IDcjs.m},e);return _chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {},t),{setJwt:_vitest.vi.fn().mockReturnThis()})},L= exports.createTestApiClient =e=>new (0, _chunkZ42FAU67cjs.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)=>_chunk2GKPWQBQcjs.g.call(void 0, void 0,null,function*(){t.mockResolvedValue(P(n,s));let a=yield e();_vitest.expect.call(void 0, u(a)).toBe(!0),u(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)=>_chunk2GKPWQBQcjs.g.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 l={error:!0,message:g};t.mockResolvedValueOnce(P(l,c));let m=yield e();_vitest.expect.call(void 0, u(m)).toBe(!0)}}),Q= exports.testNetworkError =(e,t)=>_chunk2GKPWQBQcjs.g.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)=>_chunk2GKPWQBQcjs.g.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)=>_chunk2GKPWQBQcjs.g.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)=>_chunk2GKPWQBQcjs.g.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={})=>_chunk2GKPWQBQcjs.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={})=>_chunk2GKPWQBQcjs.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 u(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error===!0}function h(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=_chunk2GKPWQBQcjs.a.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {apiKey:e},t&&{overrideBaseUrl:t}),n),a=_chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {},s),{setJwt:()=>a});return new (0, _chunkZ42FAU67cjs.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 _chunk2GKPWQBQcjs.g.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:l="default"}=n,m=g||`userId:integration-${l}-${Date.now()}`,f=yield e.createWallet(_chunk2GKPWQBQcjs.a.call(void 0, {chainType:o,type:c},g&&{owner:m}));if(h(f))return t.addWallet(f.address),f.address})}function pe(e,t,n){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let s=yield e.createWallet(n);return h(s)&&t.addWallet(s.address),s})}function ue(e,t){_vitest.expect.call(void 0, u(e)).toBe(!0),t&&_vitest.expect.call(void 0, e.message).toBeDefined()}function le(e){_vitest.expect.call(void 0, h(e)).toBe(!0)}function de(e){_vitest.expect.call(void 0, $(e)).toBe(!0)}var I=(e,t,n,s="usdxm",a="base-sepolia")=>_chunk2GKPWQBQcjs.g.call(void 0, void 0,null,function*(){let o={amount:n,token:s,chain:a},c=yield e.fundWallet(t,o);if(u(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)=>_chunk2GKPWQBQcjs.g.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(u(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:""}))},C=yield e.approveTransaction(t,n,O);if(u(C))throw new Error(`Failed to approve transaction: ${C.message||"Unknown error"}`);yield x(_chunkJ33QM2IDcjs.j);continue}yield x(_chunkJ33QM2IDcjs.i)}let l=yield e.getTransaction(t,n);if(u(l))throw new Error(`Transaction not found after retries: ${l.message||"Unknown error"}`);if(!("status"in l))throw new Error("Transaction response missing status property");return l}),me= exports.fundWalletAndWait =(e,t,n=1,s="usdxm",a="base-sepolia")=>_chunk2GKPWQBQcjs.g.call(void 0, void 0,null,function*(){return I(e,t,n,s,a)}),fe= exports.sendTokenAndApprove =(e,t,n,s,a)=>_chunk2GKPWQBQcjs.g.call(void 0, void 0,null,function*(){let o=yield e.send(t,n,{recipient:s,amount:a});if(u(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")=>_chunk2GKPWQBQcjs.g.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 = P; exports.createMockResponse = b; 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 = ue; exports.expectRequestBody = q; exports.expectRequestPath = N; exports.expectSuccessTransactionResponse = de; exports.expectSuccessWalletResponse = le; exports.extractFetchCall = Y; exports.fundWallet = I; exports.fundWalletAndWait = me; exports.isErrorResponse = u; exports.isSuccessTransactionResponse = $; exports.isSuccessWalletResponse = h; 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 { a5 as CreateWalletResponse, a6 as SendResponse, a7 as CreateWalletParams, a2 as WalletLocator, U as FundWalletResponse, a8 as GetTransactionResponse } from '../../types-CpT91HUW.cjs';
4
+ import { a5 as CreateWalletResponse, a6 as SendResponse, a7 as CreateWalletParams, a2 as WalletLocator, U as FundWalletResponse, a8 as GetTransactionResponse } from '../../types-DBvW4nPw.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 { a5 as CreateWalletResponse, a6 as SendResponse, a7 as CreateWalletParams, a2 as WalletLocator, U as FundWalletResponse, a8 as GetTransactionResponse } from '../../types-DVXPGSpw.js';
4
+ import { a5 as CreateWalletResponse, a6 as SendResponse, a7 as CreateWalletParams, a2 as WalletLocator, U as FundWalletResponse, a8 as GetTransactionResponse } from '../../types-D85tj2g6.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 E,k as M,l as W,m as S}from"../../chunk-DIGDDKSF.js";import{a as w}from"../../chunk-LY5YPRHI.js";import"../../chunk-EXC7TCGL.js";import"../../chunk-IYRVMHRW.js";import"../../chunk-ZUZCUZSL.js";import{a as p,b as k,g as i}from"../../chunk-J3R36SGJ.js";import{expect as r,vi as y}from"vitest";var b=({data:e,status:t=200,ok:n=!0,statusText:s="OK"})=>({json:y.fn().mockResolvedValue(e),ok:n,status:t,statusText:s}),j=e=>b({data:e}),P=(e,t=400,n="Bad Request")=>b({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(P(n,s));let a=yield e();r(u(a)).toBe(!0),u(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 l={error:!0,message:g};t.mockResolvedValueOnce(P(l,c));let m=yield e();r(u(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:M.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 u(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error===!0}function h(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:l="default"}=n,m=g||`userId:integration-${l}-${Date.now()}`,f=yield e.createWallet(p({chainType:o,type:c},g&&{owner:m}));if(h(f))return t.addWallet(f.address),f.address})}function ue(e,t,n){return i(this,null,function*(){let s=yield e.createWallet(n);return h(s)&&t.addWallet(s.address),s})}function le(e,t){r(u(e)).toBe(!0),t&&r(e.message).toBeDefined()}function de(e){r(h(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(u(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=W.APPROVE_TRANSACTION_MAX_RETRIES){var m;for(let f=0;f<s;f++){let d=yield e.getTransaction(t,n);if(u(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:""}))},C=yield e.approveTransaction(t,n,O);if(u(C))throw new Error(`Failed to approve transaction: ${C.message||"Unknown error"}`);yield x(E);continue}yield x(R)}let l=yield e.getTransaction(t,n);if(u(l))throw new Error(`Transaction not found after retries: ${l.message||"Unknown error"}`);if(!("status"in l))throw new Error("Transaction response missing status property");return l}),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(u(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,P as createMockErrorResponse,b as createMockResponse,re as createMockSendResponse,j as createMockSuccessResponse,oe as createMockWalletResponse,Y as createServerSideApiClient,L as createTestApiClient,ue as createTestWallet,x as delay,pe as ensureWalletExists,Te as ensureWalletFunded,V as expectCommonHeaders,le as expectErrorResponse,q as expectRequestBody,N as expectRequestPath,me as expectSuccessTransactionResponse,de as expectSuccessWalletResponse,z as extractFetchCall,I as fundWallet,fe as fundWalletAndWait,u as isErrorResponse,$ as isSuccessTransactionResponse,h 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 E,k as M,l as W,m as S}from"../../chunk-DIGDDKSF.js";import{a as w}from"../../chunk-UOKPSLMQ.js";import"../../chunk-EXC7TCGL.js";import"../../chunk-2GHG5OLB.js";import"../../chunk-775TCWSR.js";import{a as p,b as k,g as i}from"../../chunk-J3R36SGJ.js";import{expect as r,vi as y}from"vitest";var b=({data:e,status:t=200,ok:n=!0,statusText:s="OK"})=>({json:y.fn().mockResolvedValue(e),ok:n,status:t,statusText:s}),j=e=>b({data:e}),P=(e,t=400,n="Bad Request")=>b({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(P(n,s));let a=yield e();r(u(a)).toBe(!0),u(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 l={error:!0,message:g};t.mockResolvedValueOnce(P(l,c));let m=yield e();r(u(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:M.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 u(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error===!0}function h(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:l="default"}=n,m=g||`userId:integration-${l}-${Date.now()}`,f=yield e.createWallet(p({chainType:o,type:c},g&&{owner:m}));if(h(f))return t.addWallet(f.address),f.address})}function ue(e,t,n){return i(this,null,function*(){let s=yield e.createWallet(n);return h(s)&&t.addWallet(s.address),s})}function le(e,t){r(u(e)).toBe(!0),t&&r(e.message).toBeDefined()}function de(e){r(h(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(u(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=W.APPROVE_TRANSACTION_MAX_RETRIES){var m;for(let f=0;f<s;f++){let d=yield e.getTransaction(t,n);if(u(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:""}))},C=yield e.approveTransaction(t,n,O);if(u(C))throw new Error(`Failed to approve transaction: ${C.message||"Unknown error"}`);yield x(E);continue}yield x(R)}let l=yield e.getTransaction(t,n);if(u(l))throw new Error(`Transaction not found after retries: ${l.message||"Unknown error"}`);if(!("status"in l))throw new Error("Transaction response missing status property");return l}),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(u(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,P as createMockErrorResponse,b as createMockResponse,re as createMockSendResponse,j as createMockSuccessResponse,oe as createMockWalletResponse,Y as createServerSideApiClient,L as createTestApiClient,ue as createTestWallet,x as delay,pe as ensureWalletExists,Te as ensureWalletFunded,V as expectCommonHeaders,le as expectErrorResponse,q as expectRequestBody,N as expectRequestPath,me as expectSuccessTransactionResponse,de as expectSuccessWalletResponse,z as extractFetchCall,I as fundWallet,fe as fundWalletAndWait,u as isErrorResponse,$ as isSuccessTransactionResponse,h 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 _chunkITNNPNZLcjs = require('../chunk-ITNNPNZL.cjs');require('../chunk-T3U46LK3.cjs');require('../chunk-U2AHGQVY.cjs');require('../chunk-N57ARKT3.cjs');require('../chunk-2GKPWQBQ.cjs');exports.ApiClient = _chunkITNNPNZLcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkZ42FAU67cjs = require('../chunk-Z42FAU67.cjs');require('../chunk-T3U46LK3.cjs');require('../chunk-K5SDVE5F.cjs');require('../chunk-RKTFURXX.cjs');require('../chunk-2GKPWQBQ.cjs');exports.ApiClient = _chunkZ42FAU67cjs.a;
@@ -1,5 +1,5 @@
1
1
  import { CrossmintApiClient, Crossmint, APIKeyEnvironmentPrefix } from '@crossmint/common-sdk-base';
2
- import { a7 as CreateWalletParams, a5 as CreateWalletResponse, a2 as WalletLocator, ad as GetWalletResponse, ae as CreateTransactionParams, af as CreateTransactionResponse, ag as ApproveTransactionParams, ah as ApproveTransactionResponse, a8 as GetTransactionResponse, ai as CreateSignatureParams, aj as CreateSignatureResponse, ak as ApproveSignatureParams, a4 as ApproveSignatureResponse, al as GetSignatureResponse, V as GetTransactionsResponse, am as GetTransfersResponse, an as GetBalanceResponse, ao as FundWalletParams, U as FundWalletResponse, ap as RegisterSignerParams, aq as RegisterSignerResponse, ar as GetSignerResponse, as as SendParams, a6 as SendResponse } from '../types-CpT91HUW.cjs';
2
+ import { a7 as CreateWalletParams, a5 as CreateWalletResponse, a2 as WalletLocator, ad as GetWalletResponse, ae as CreateTransactionParams, af as CreateTransactionResponse, ag as ApproveTransactionParams, ah as ApproveTransactionResponse, a8 as GetTransactionResponse, ai as CreateSignatureParams, aj as CreateSignatureResponse, ak as ApproveSignatureParams, a4 as ApproveSignatureResponse, al as GetSignatureResponse, V as GetTransactionsResponse, am as GetTransfersResponse, an as GetBalanceResponse, ao as FundWalletParams, U as FundWalletResponse, ap as RegisterSignerParams, aq as RegisterSignerResponse, ar as GetSignerResponse, as as SendParams, a6 as SendResponse } from '../types-DBvW4nPw.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 { a7 as CreateWalletParams, a5 as CreateWalletResponse, a2 as WalletLocator, ad as GetWalletResponse, ae as CreateTransactionParams, af as CreateTransactionResponse, ag as ApproveTransactionParams, ah as ApproveTransactionResponse, a8 as GetTransactionResponse, ai as CreateSignatureParams, aj as CreateSignatureResponse, ak as ApproveSignatureParams, a4 as ApproveSignatureResponse, al as GetSignatureResponse, V as GetTransactionsResponse, am as GetTransfersResponse, an as GetBalanceResponse, ao as FundWalletParams, U as FundWalletResponse, ap as RegisterSignerParams, aq as RegisterSignerResponse, ar as GetSignerResponse, as as SendParams, a6 as SendResponse } from '../types-DVXPGSpw.js';
2
+ import { a7 as CreateWalletParams, a5 as CreateWalletResponse, a2 as WalletLocator, ad as GetWalletResponse, ae as CreateTransactionParams, af as CreateTransactionResponse, ag as ApproveTransactionParams, ah as ApproveTransactionResponse, a8 as GetTransactionResponse, ai as CreateSignatureParams, aj as CreateSignatureResponse, ak as ApproveSignatureParams, a4 as ApproveSignatureResponse, al as GetSignatureResponse, V as GetTransactionsResponse, am as GetTransfersResponse, an as GetBalanceResponse, ao as FundWalletParams, U as FundWalletResponse, ap as RegisterSignerParams, aq as RegisterSignerResponse, ar as GetSignerResponse, as as SendParams, a6 as SendResponse } from '../types-D85tj2g6.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-LY5YPRHI.js";import"../chunk-EXC7TCGL.js";import"../chunk-IYRVMHRW.js";import"../chunk-ZUZCUZSL.js";import"../chunk-J3R36SGJ.js";export{a as ApiClient};
1
+ import{a}from"../chunk-UOKPSLMQ.js";import"../chunk-EXC7TCGL.js";import"../chunk-2GHG5OLB.js";import"../chunk-775TCWSR.js";import"../chunk-J3R36SGJ.js";export{a as ApiClient};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-6HXIZLEQ.cjs');var _chunkITNNPNZLcjs = require('../chunk-ITNNPNZL.cjs');require('../chunk-ECAM5KTH.cjs');require('../chunk-T3U46LK3.cjs');require('../chunk-U2AHGQVY.cjs');require('../chunk-N57ARKT3.cjs');require('../chunk-2GKPWQBQ.cjs');exports.ApiClient = _chunkITNNPNZLcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-6HXIZLEQ.cjs');var _chunkZ42FAU67cjs = require('../chunk-Z42FAU67.cjs');require('../chunk-ECAM5KTH.cjs');require('../chunk-T3U46LK3.cjs');require('../chunk-K5SDVE5F.cjs');require('../chunk-RKTFURXX.cjs');require('../chunk-2GKPWQBQ.cjs');exports.ApiClient = _chunkZ42FAU67cjs.a;
@@ -1,5 +1,5 @@
1
1
  export { ApiClient } from './client.cjs';
2
- export { au as AdminSignerConfig, ak as ApproveSignatureParams, a4 as ApproveSignatureResponse, ag as ApproveTransactionParams, ah as ApproveTransactionResponse, ai as CreateSignatureParams, aj as CreateSignatureResponse, ae as CreateTransactionParams, af as CreateTransactionResponse, av as CreateTransactionSuccessResponse, a7 as CreateWalletParams, a5 as CreateWalletResponse, K as DelegatedSigner, ao as FundWalletParams, U as FundWalletResponse, an as GetBalanceResponse, aw as GetBalanceSuccessResponse, ay as GetDelegatedSignersResponse, al as GetSignatureResponse, ar as GetSignerResponse, a8 as GetTransactionResponse, X as GetTransactionSuccessResponse, V as GetTransactionsResponse, am as GetTransfersResponse, ad as GetWalletResponse, at as GetWalletSuccessResponse, ax as RegisterSignerChain, ap as RegisterSignerParams, R as RegisterSignerPasskeyParams, aq as RegisterSignerResponse, as as SendParams, a6 as SendResponse, T as Transfers, a2 as WalletLocator } from '../types-CpT91HUW.cjs';
2
+ export { ak as ApproveSignatureParams, a4 as ApproveSignatureResponse, ag as ApproveTransactionParams, ah as ApproveTransactionResponse, ai as CreateSignatureParams, aj as CreateSignatureResponse, ae as CreateTransactionParams, af as CreateTransactionResponse, av as CreateTransactionSuccessResponse, a7 as CreateWalletParams, a5 as CreateWalletResponse, ao as FundWalletParams, U as FundWalletResponse, an as GetBalanceResponse, aw as GetBalanceSuccessResponse, al as GetSignatureResponse, ar as GetSignerResponse, ay as GetSignersResponse, a8 as GetTransactionResponse, X as GetTransactionSuccessResponse, V as GetTransactionsResponse, am as GetTransfersResponse, ad as GetWalletResponse, at as GetWalletSuccessResponse, au as RecoverySignerConfig, ax as RegisterSignerChain, ap as RegisterSignerParams, R as RegisterSignerPasskeyParams, aq as RegisterSignerResponse, as as SendParams, a6 as SendResponse, K as Signer, T as Transfers, a2 as WalletLocator } from '../types-DBvW4nPw.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 { au as AdminSignerConfig, ak as ApproveSignatureParams, a4 as ApproveSignatureResponse, ag as ApproveTransactionParams, ah as ApproveTransactionResponse, ai as CreateSignatureParams, aj as CreateSignatureResponse, ae as CreateTransactionParams, af as CreateTransactionResponse, av as CreateTransactionSuccessResponse, a7 as CreateWalletParams, a5 as CreateWalletResponse, K as DelegatedSigner, ao as FundWalletParams, U as FundWalletResponse, an as GetBalanceResponse, aw as GetBalanceSuccessResponse, ay as GetDelegatedSignersResponse, al as GetSignatureResponse, ar as GetSignerResponse, a8 as GetTransactionResponse, X as GetTransactionSuccessResponse, V as GetTransactionsResponse, am as GetTransfersResponse, ad as GetWalletResponse, at as GetWalletSuccessResponse, ax as RegisterSignerChain, ap as RegisterSignerParams, R as RegisterSignerPasskeyParams, aq as RegisterSignerResponse, as as SendParams, a6 as SendResponse, T as Transfers, a2 as WalletLocator } from '../types-DVXPGSpw.js';
2
+ export { ak as ApproveSignatureParams, a4 as ApproveSignatureResponse, ag as ApproveTransactionParams, ah as ApproveTransactionResponse, ai as CreateSignatureParams, aj as CreateSignatureResponse, ae as CreateTransactionParams, af as CreateTransactionResponse, av as CreateTransactionSuccessResponse, a7 as CreateWalletParams, a5 as CreateWalletResponse, ao as FundWalletParams, U as FundWalletResponse, an as GetBalanceResponse, aw as GetBalanceSuccessResponse, al as GetSignatureResponse, ar as GetSignerResponse, ay as GetSignersResponse, a8 as GetTransactionResponse, X as GetTransactionSuccessResponse, V as GetTransactionsResponse, am as GetTransfersResponse, ad as GetWalletResponse, at as GetWalletSuccessResponse, au as RecoverySignerConfig, ax as RegisterSignerChain, ap as RegisterSignerParams, R as RegisterSignerPasskeyParams, aq as RegisterSignerResponse, as as SendParams, a6 as SendResponse, K as Signer, T as Transfers, a2 as WalletLocator } from '../types-D85tj2g6.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-LY5YPRHI.js";import"../chunk-KBJA7JDT.js";import"../chunk-EXC7TCGL.js";import"../chunk-IYRVMHRW.js";import"../chunk-ZUZCUZSL.js";import"../chunk-J3R36SGJ.js";export{a as ApiClient};
1
+ import"../chunk-5IFDVB4Y.js";import{a}from"../chunk-UOKPSLMQ.js";import"../chunk-KBJA7JDT.js";import"../chunk-EXC7TCGL.js";import"../chunk-2GHG5OLB.js";import"../chunk-775TCWSR.js";import"../chunk-J3R36SGJ.js";export{a as ApiClient};
@@ -1,6 +1,6 @@
1
1
  import 'viem';
2
2
  import './gen/types.gen.cjs';
3
- export { au as AdminSignerConfig, ak as ApproveSignatureParams, a4 as ApproveSignatureResponse, ag as ApproveTransactionParams, ah as ApproveTransactionResponse, ai as CreateSignatureParams, aj as CreateSignatureResponse, ae as CreateTransactionParams, af as CreateTransactionResponse, av as CreateTransactionSuccessResponse, a7 as CreateWalletParams, a5 as CreateWalletResponse, K as DelegatedSigner, ao as FundWalletParams, U as FundWalletResponse, an as GetBalanceResponse, aw as GetBalanceSuccessResponse, ay as GetDelegatedSignersResponse, al as GetSignatureResponse, ar as GetSignerResponse, a8 as GetTransactionResponse, X as GetTransactionSuccessResponse, V as GetTransactionsResponse, am as GetTransfersResponse, ad as GetWalletResponse, at as GetWalletSuccessResponse, ax as RegisterSignerChain, ap as RegisterSignerParams, R as RegisterSignerPasskeyParams, aq as RegisterSignerResponse, as as SendParams, a6 as SendResponse, T as Transfers, a2 as WalletLocator } from '../types-CpT91HUW.cjs';
3
+ export { ak as ApproveSignatureParams, a4 as ApproveSignatureResponse, ag as ApproveTransactionParams, ah as ApproveTransactionResponse, ai as CreateSignatureParams, aj as CreateSignatureResponse, ae as CreateTransactionParams, af as CreateTransactionResponse, av as CreateTransactionSuccessResponse, a7 as CreateWalletParams, a5 as CreateWalletResponse, ao as FundWalletParams, U as FundWalletResponse, an as GetBalanceResponse, aw as GetBalanceSuccessResponse, al as GetSignatureResponse, ar as GetSignerResponse, ay as GetSignersResponse, a8 as GetTransactionResponse, X as GetTransactionSuccessResponse, V as GetTransactionsResponse, am as GetTransfersResponse, ad as GetWalletResponse, at as GetWalletSuccessResponse, au as RecoverySignerConfig, ax as RegisterSignerChain, ap as RegisterSignerParams, R as RegisterSignerPasskeyParams, aq as RegisterSignerResponse, as as SendParams, a6 as SendResponse, K as Signer, T as Transfers, a2 as WalletLocator } from '../types-DBvW4nPw.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 { au as AdminSignerConfig, ak as ApproveSignatureParams, a4 as ApproveSignatureResponse, ag as ApproveTransactionParams, ah as ApproveTransactionResponse, ai as CreateSignatureParams, aj as CreateSignatureResponse, ae as CreateTransactionParams, af as CreateTransactionResponse, av as CreateTransactionSuccessResponse, a7 as CreateWalletParams, a5 as CreateWalletResponse, K as DelegatedSigner, ao as FundWalletParams, U as FundWalletResponse, an as GetBalanceResponse, aw as GetBalanceSuccessResponse, ay as GetDelegatedSignersResponse, al as GetSignatureResponse, ar as GetSignerResponse, a8 as GetTransactionResponse, X as GetTransactionSuccessResponse, V as GetTransactionsResponse, am as GetTransfersResponse, ad as GetWalletResponse, at as GetWalletSuccessResponse, ax as RegisterSignerChain, ap as RegisterSignerParams, R as RegisterSignerPasskeyParams, aq as RegisterSignerResponse, as as SendParams, a6 as SendResponse, T as Transfers, a2 as WalletLocator } from '../types-DVXPGSpw.js';
3
+ export { ak as ApproveSignatureParams, a4 as ApproveSignatureResponse, ag as ApproveTransactionParams, ah as ApproveTransactionResponse, ai as CreateSignatureParams, aj as CreateSignatureResponse, ae as CreateTransactionParams, af as CreateTransactionResponse, av as CreateTransactionSuccessResponse, a7 as CreateWalletParams, a5 as CreateWalletResponse, ao as FundWalletParams, U as FundWalletResponse, an as GetBalanceResponse, aw as GetBalanceSuccessResponse, al as GetSignatureResponse, ar as GetSignerResponse, ay as GetSignersResponse, a8 as GetTransactionResponse, X as GetTransactionSuccessResponse, V as GetTransactionsResponse, am as GetTransfersResponse, ad as GetWalletResponse, at as GetWalletSuccessResponse, au as RecoverySignerConfig, ax as RegisterSignerChain, ap as RegisterSignerParams, R as RegisterSignerPasskeyParams, aq as RegisterSignerResponse, as as SendParams, a6 as SendResponse, K as Signer, T as Transfers, a2 as WalletLocator } from '../types-D85tj2g6.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 _chunkL3HSG6Q5cjs = require('../chunk-L3HSG6Q5.cjs');require('../chunk-GEY574TH.cjs');require('../chunk-UE3WVHTM.cjs');require('../chunk-5X4EOJFG.cjs');require('../chunk-HRUMWG2F.cjs');require('../chunk-IR5WN6FQ.cjs');require('../chunk-T3U46LK3.cjs');require('../chunk-CCIGWTAO.cjs');require('../chunk-U2AHGQVY.cjs');require('../chunk-N57ARKT3.cjs');require('../chunk-2GKPWQBQ.cjs');exports.isMainnetChain = _chunkL3HSG6Q5cjs.c; exports.isTestnetChain = _chunkL3HSG6Q5cjs.b; exports.isValidChain = _chunkL3HSG6Q5cjs.e; exports.mainnetToTestnet = _chunkL3HSG6Q5cjs.d; exports.toViemChain = _chunkL3HSG6Q5cjs.a; exports.validateChainForEnvironment = _chunkL3HSG6Q5cjs.f;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk5ZVOGNTQcjs = require('../chunk-5ZVOGNTQ.cjs');require('../chunk-GEY574TH.cjs');require('../chunk-UE3WVHTM.cjs');require('../chunk-5X4EOJFG.cjs');require('../chunk-HRUMWG2F.cjs');require('../chunk-IR5WN6FQ.cjs');require('../chunk-T3U46LK3.cjs');require('../chunk-CCIGWTAO.cjs');require('../chunk-K5SDVE5F.cjs');require('../chunk-RKTFURXX.cjs');require('../chunk-2GKPWQBQ.cjs');exports.isMainnetChain = _chunk5ZVOGNTQcjs.c; exports.isTestnetChain = _chunk5ZVOGNTQcjs.b; exports.isValidChain = _chunk5ZVOGNTQcjs.e; exports.mainnetToTestnet = _chunk5ZVOGNTQcjs.d; exports.toViemChain = _chunk5ZVOGNTQcjs.a; exports.validateChainForEnvironment = _chunk5ZVOGNTQcjs.f;
@@ -1 +1 @@
1
- import{a,b,c,d,e,f}from"../chunk-2GXYCJD4.js";import"../chunk-S3DYQVRD.js";import"../chunk-KUP7H7X2.js";import"../chunk-FT5EVMLB.js";import"../chunk-SVIKBM3S.js";import"../chunk-KKQBZXFE.js";import"../chunk-EXC7TCGL.js";import"../chunk-455NK5LB.js";import"../chunk-IYRVMHRW.js";import"../chunk-ZUZCUZSL.js";import"../chunk-J3R36SGJ.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-X7BAYHQI.js";import"../chunk-S3DYQVRD.js";import"../chunk-KUP7H7X2.js";import"../chunk-FT5EVMLB.js";import"../chunk-SVIKBM3S.js";import"../chunk-KKQBZXFE.js";import"../chunk-EXC7TCGL.js";import"../chunk-455NK5LB.js";import"../chunk-2GHG5OLB.js";import"../chunk-775TCWSR.js";import"../chunk-J3R36SGJ.js";export{c as isMainnetChain,b as isTestnetChain,e as isValidChain,d as mainnetToTestnet,a as toViemChain,f as validateChainForEnvironment};
@@ -1 +1 @@
1
- import{b as n,c as i}from"./chunk-ZUZCUZSL.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-775TCWSR.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 g}from"./chunk-O6VBO7KG.js";import{a as l}from"./chunk-WCGUGIGJ.js";import{a as o}from"./chunk-IYRVMHRW.js";import{c as m,g as a}from"./chunk-J3R36SGJ.js";import{validateAPIKey as p,WithLoggerContext as w}from"@crossmint/common-sdk-base";var f=class{constructor(r){this.config=r;this._needsAuth=!0;this._authPromise=null;this._initializationPromise=null;typeof window!="undefined"&&(this._initializationPromise=this.initialize()),this.type=this.config.type}locator(){return this.config.locator}address(){return this.config.address}initialize(){return a(this,null,function*(){try{if(this.config.clientTEEConnection==null){let r=p(this.config.crossmint.apiKey);if(!r.isValid)throw new Error("Invalid API key");let t=new g({environment:r.environment});this.config.clientTEEConnection=yield t.initialize()}}finally{this._initializationPromise=null}})}getTEEConnection(){return a(this,null,function*(){if(this.config.clientTEEConnection==null){if(this._initializationPromise){if(yield this._initializationPromise,this.config.clientTEEConnection==null)throw new Error("Failed to initialize TEE connection");return this.config.clientTEEConnection}this._initializationPromise=this.initializeTEEConnection();try{yield this._initializationPromise}finally{this._initializationPromise=null}}if(this.config.clientTEEConnection==null)throw new Error("TEE connection is not initialized");return this.config.clientTEEConnection})}initializeTEEConnection(){return a(this,null,function*(){o.info("TEE connection not initialized, initializing now");let r=p(this.config.crossmint.apiKey);if(!r.isValid)throw new Error("Invalid API key");let t=new g({environment:r.environment});if(this.config.clientTEEConnection=yield t.initialize(),this.config.clientTEEConnection==null)throw new Error("Failed to initialize TEE connection");o.info("TEE connection initialized successfully")})}handleAuthRequired(){return a(this,null,function*(){var u;let r=yield this.getTEEConnection();if(this.config.onAuthRequired==null)throw new Error(`${this.type} signer requires the onAuthRequired callback to handle OTP verification. This callback manages the authentication flow (sending OTP and verifying user input). If using our React/React Native SDK, this is handled automatically by the provider. For other environments, implement: onAuthRequired: (needsAuth, sendOtp, verifyOtp, reject) => { /* your UI logic */ }`);o.info("get-status: sending request");let t=Date.now(),n=yield r.sendAction({event:"request:get-status",responseEvent:"response:get-status",data:{authData:{jwt:(u=this.config.crossmint.jwt)!=null?u:"",apiKey:this.config.crossmint.apiKey}},options:d}),e=Date.now()-t;if((n==null?void 0:n.status)!=="success")throw o.error("get-status: failed",{status:n==null?void 0:n.status,error:n==null?void 0:n.error,durationMs:e}),new Error(n==null?void 0:n.error);if(o.info("get-status: response received",{signerStatus:n.signerStatus,durationMs:e}),n.signerStatus==="ready"){this._needsAuth=!1;return}else this._needsAuth=!0;o.info("Auth required, initiating OTP flow",{needsAuth:this._needsAuth});let{promise:s,resolve:h,reject:c}=this.createAuthPromise();if(this._authPromise={promise:s,resolve:h,reject:c},this.config.onAuthRequired)try{yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),i=>this.verifyOtp(i),()=>a(this,null,function*(){o.info("Auth rejected",{authRejected:!0}),this._needsAuth=!1,this.config.onAuthRequired!=null&&(yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),i=>this.verifyOtp(i),()=>{var i;return(i=this._authPromise)==null?void 0:i.reject(new l)})),c(new l)}))}catch(i){o.error("handleAuthRequired error",{error:i}),c(i)}try{yield s}catch(i){throw o.error("handleAuthRequired promise error",{error:i}),i}})}ensureAuthenticated(){return a(this,null,function*(){yield this.handleAuthRequired()})}getJwtOrThrow(){let r=this.config.crossmint.jwt;if(r==null)throw new Error("JWT is required");return r}createAuthPromise(){let r,t;return{promise:new Promise((e,s)=>{r=e,t=s}),resolve:r,reject:t}}sendMessageWithOtp(){return a(this,null,function*(){var h,c;let r=yield this.getTEEConnection(),t=this.getAuthId();o.info("start-onboarding: sending request");let n=Date.now(),e=yield r.sendAction({event:"request:start-onboarding",responseEvent:"response:start-onboarding",data:{authData:{jwt:(h=this.config.crossmint.jwt)!=null?h:"",apiKey:this.config.crossmint.apiKey},data:{authId:t}},options:d}),s=Date.now()-n;if(o.info("start-onboarding: response received",{status:e==null?void 0:e.status,durationMs:s}),(e==null?void 0:e.status)==="success"&&e.signerStatus==="ready"){this._needsAuth=!1;return}(e==null?void 0:e.status)==="error"&&(o.error("start-onboarding: failed",{error:e.error}),(c=this._authPromise)==null||c.reject(new Error(e.error||"Failed to initiate OTP process.")))})}getAuthId(){return this.config.type==="email"?`email:${this.config.email}`:`phone:${this.config.phone}`}verifyOtp(r){return a(this,null,function*(){var s,h,c,u;let t;try{let i=yield this.getTEEConnection();o.info("complete-onboarding: sending request");let E=Date.now();t=yield i.sendAction({event:"request:complete-onboarding",responseEvent:"response:complete-onboarding",data:{authData:{jwt:(s=this.config.crossmint.jwt)!=null?s:"",apiKey:this.config.crossmint.apiKey},data:{onboardingAuthentication:{encryptedOtp:r}}},options:d}),o.info("complete-onboarding: response received",{status:t==null?void 0:t.status,durationMs:Date.now()-E})}catch(i){throw o.error("complete-onboarding: error",{error:i}),this._needsAuth=!0,(h=this._authPromise)==null||h.reject(i),i}if((t==null?void 0:t.status)==="success"){this._needsAuth=!1,this.config.onAuthRequired!=null&&(yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),i=>this.verifyOtp(i),()=>{var i;return(i=this._authPromise)==null?void 0:i.reject(new l)})),(c=this._authPromise)==null||c.resolve();return}o.error("complete-onboarding: OTP validation failed",{status:t==null?void 0:t.status}),this._needsAuth=!0;let n=(t==null?void 0:t.status)==="error"?t.error:"Failed to validate encrypted OTP",e=new Error(n);throw(u=this._authPromise)==null||u.reject(e),e})}_exportPrivateKey(r){return a(this,null,function*(){yield this.handleAuthRequired();let t=this.getJwtOrThrow(),{scheme:n,encoding:e}=this.getChainKeyParams(),s=yield r.sendAction({event:"request:export-signer",responseEvent:"response:export-signer",data:{authData:{jwt:t,apiKey:this.config.crossmint.apiKey},data:{scheme:n,encoding:e}},options:d});if((s==null?void 0:s.status)==="error")throw new Error(s.error||"Failed to export private key")})}};m([w({logger:o,methodName:"handleAuthRequired"})],f.prototype,"handleAuthRequired",1);var d={timeoutMs:3e4};export{f as a,d as b};
1
+ import{a as g}from"./chunk-O6VBO7KG.js";import{a as l}from"./chunk-WCGUGIGJ.js";import{a as o}from"./chunk-2GHG5OLB.js";import{c as m,g as a}from"./chunk-J3R36SGJ.js";import{validateAPIKey as p,WithLoggerContext as w}from"@crossmint/common-sdk-base";var f=class{constructor(r){this.config=r;this._needsAuth=!0;this._authPromise=null;this._initializationPromise=null;typeof window!="undefined"&&(this._initializationPromise=this.initialize()),this.type=this.config.type}locator(){return this.config.locator}address(){return this.config.address}initialize(){return a(this,null,function*(){try{if(this.config.clientTEEConnection==null){let r=p(this.config.crossmint.apiKey);if(!r.isValid)throw new Error("Invalid API key");let t=new g({environment:r.environment});this.config.clientTEEConnection=yield t.initialize()}}finally{this._initializationPromise=null}})}getTEEConnection(){return a(this,null,function*(){if(this.config.clientTEEConnection==null){if(this._initializationPromise){if(yield this._initializationPromise,this.config.clientTEEConnection==null)throw new Error("Failed to initialize TEE connection");return this.config.clientTEEConnection}this._initializationPromise=this.initializeTEEConnection();try{yield this._initializationPromise}finally{this._initializationPromise=null}}if(this.config.clientTEEConnection==null)throw new Error("TEE connection is not initialized");return this.config.clientTEEConnection})}initializeTEEConnection(){return a(this,null,function*(){o.info("TEE connection not initialized, initializing now");let r=p(this.config.crossmint.apiKey);if(!r.isValid)throw new Error("Invalid API key");let t=new g({environment:r.environment});if(this.config.clientTEEConnection=yield t.initialize(),this.config.clientTEEConnection==null)throw new Error("Failed to initialize TEE connection");o.info("TEE connection initialized successfully")})}handleAuthRequired(){return a(this,null,function*(){var u;let r=yield this.getTEEConnection();if(this.config.onAuthRequired==null)throw new Error(`${this.type} signer requires the onAuthRequired callback to handle OTP verification. This callback manages the authentication flow (sending OTP and verifying user input). If using our React/React Native SDK, this is handled automatically by the provider. For other environments, implement: onAuthRequired: (needsAuth, sendOtp, verifyOtp, reject) => { /* your UI logic */ }`);o.info("get-status: sending request");let t=Date.now(),n=yield r.sendAction({event:"request:get-status",responseEvent:"response:get-status",data:{authData:{jwt:(u=this.config.crossmint.jwt)!=null?u:"",apiKey:this.config.crossmint.apiKey}},options:d}),i=Date.now()-t;if((n==null?void 0:n.status)!=="success")throw o.error("get-status: failed",{status:n==null?void 0:n.status,error:n==null?void 0:n.error,durationMs:i}),new Error(n==null?void 0:n.error);if(o.info("get-status: response received",{signerStatus:n.signerStatus,durationMs:i}),n.signerStatus==="ready"){this._needsAuth=!1;return}else this._needsAuth=!0;o.info("Auth required, initiating OTP flow",{needsAuth:this._needsAuth});let{promise:s,resolve:h,reject:c}=this.createAuthPromise();if(this._authPromise={promise:s,resolve:h,reject:c},this.config.onAuthRequired)try{yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),e=>this.verifyOtp(e),()=>a(this,null,function*(){o.info("Auth rejected",{authRejected:!0}),this._needsAuth=!1,this.config.onAuthRequired!=null&&(yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),e=>this.verifyOtp(e),()=>{var e;return(e=this._authPromise)==null?void 0:e.reject(new l)})),c(new l)}))}catch(e){o.error("handleAuthRequired error",{error:e}),c(e)}try{yield s}catch(e){throw o.error("handleAuthRequired promise error",{error:e}),e}})}ensureAuthenticated(){return a(this,null,function*(){yield this.handleAuthRequired()})}getJwtOrThrow(){let r=this.config.crossmint.jwt;if(r==null)throw new Error("JWT is required");return r}createAuthPromise(){let r,t;return{promise:new Promise((i,s)=>{r=i,t=s}),resolve:r,reject:t}}sendMessageWithOtp(){return a(this,null,function*(){var h,c;let r=yield this.getTEEConnection(),t=this.getAuthId();o.info("start-onboarding: sending request");let n=Date.now(),i=yield r.sendAction({event:"request:start-onboarding",responseEvent:"response:start-onboarding",data:{authData:{jwt:(h=this.config.crossmint.jwt)!=null?h:"",apiKey:this.config.crossmint.apiKey},data:{authId:t}},options:d}),s=Date.now()-n;if(o.info("start-onboarding: response received",{status:i==null?void 0:i.status,durationMs:s}),(i==null?void 0:i.status)==="success"&&i.signerStatus==="ready"){this._needsAuth=!1;return}(i==null?void 0:i.status)==="error"&&(o.error("start-onboarding: failed",{error:i.error}),(c=this._authPromise)==null||c.reject(new Error(i.error||"Failed to initiate OTP process.")))})}getAuthId(){return this.config.type==="email"?`email:${this.config.email}`:`phone:${this.config.phone}`}verifyOtp(r){return a(this,null,function*(){var s,h,c,u;let t;try{let e=yield this.getTEEConnection();o.info("complete-onboarding: sending request");let E=Date.now();t=yield e.sendAction({event:"request:complete-onboarding",responseEvent:"response:complete-onboarding",data:{authData:{jwt:(s=this.config.crossmint.jwt)!=null?s:"",apiKey:this.config.crossmint.apiKey},data:{onboardingAuthentication:{encryptedOtp:r}}},options:d}),o.info("complete-onboarding: response received",{status:t==null?void 0:t.status,durationMs:Date.now()-E})}catch(e){throw o.error("complete-onboarding: error",{error:e}),this._needsAuth=!0,(h=this._authPromise)==null||h.reject(e),e}if((t==null?void 0:t.status)==="success"){this._needsAuth=!1,this.config.onAuthRequired!=null&&(yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),e=>this.verifyOtp(e),()=>{var e;return(e=this._authPromise)==null?void 0:e.reject(new l)})),(c=this._authPromise)==null||c.resolve();return}o.error("complete-onboarding: OTP validation failed",{status:t==null?void 0:t.status}),this._needsAuth=!0;let n=(t==null?void 0:t.status)==="error"?t.error:"Failed to validate encrypted OTP",i=new Error(n);throw(u=this._authPromise)==null||u.reject(i),i})}_exportPrivateKey(r){return a(this,null,function*(){yield this.handleAuthRequired();let t=this.getJwtOrThrow(),{scheme:n,encoding:i}=this.getChainKeyParams(),s=yield r.sendAction({event:"request:export-signer",responseEvent:"response:export-signer",data:{authData:{jwt:t,apiKey:this.config.crossmint.apiKey},data:{scheme:n,encoding:i}},options:d});if((s==null?void 0:s.status)==="error")throw new Error(s.error||"Failed to export private key")})}};m([w({logger:o,methodName:"handleAuthRequired"})],f.prototype,"handleAuthRequired",1);var d={timeoutMs:3e4};export{f as a,d as b};
@@ -1 +1 @@
1
- import{g as t}from"./chunk-J3R36SGJ.js";import{Keypair as d,VersionedTransaction as y}from"@solana/web3.js";import r from"bs58";import n from"tweetnacl";var a=class{constructor(e){this.type="server";this.keypair=d.fromSeed(e.derivedKeyBytes),this._address=this.keypair.publicKey.toBase58(),this._locator=e.locator}address(){return this._address}locator(){return this._locator}signMessage(e){return t(this,null,function*(){let s=r.decode(e),i=n.sign.detached(s,this.keypair.secretKey);return{signature:r.encode(i)}})}signTransaction(e){return t(this,null,function*(){let s=r.decode(e),o=y.deserialize(s).message.serialize(),c=n.sign.detached(o,this.keypair.secretKey);return{signature:r.encode(c)}})}};export{a};
1
+ import{g as t}from"./chunk-J3R36SGJ.js";import{Keypair as d,VersionedTransaction as p}from"@solana/web3.js";import r from"bs58";import a from"tweetnacl";var n=class{constructor(e){this.type="server";this.keypair=d.fromSeed(e.derivedKeyBytes),this._address=this.keypair.publicKey.toBase58(),this._locator=e.locator}address(){return this._address}locator(){return this._locator}signMessage(e){return t(this,null,function*(){let s=r.decode(e),i=a.sign.detached(s,this.keypair.secretKey);return{signature:r.encode(i)}})}signTransaction(e){return t(this,null,function*(){let s=r.decode(e),o=p.deserialize(s).message.serialize(),c=a.sign.detached(o,this.keypair.secretKey);return{signature:r.encode(c)}})}};export{n as a};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var _web3js = require('@solana/web3.js');var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);var _tweetnacl = require('tweetnacl'); var _tweetnacl2 = _interopRequireDefault(_tweetnacl);var a=class{constructor(e){this.type="server";this.keypair=_web3js.Keypair.fromSeed(e.derivedKeyBytes),this._address=this.keypair.publicKey.toBase58(),this._locator=e.locator}address(){return this._address}locator(){return this._locator}signMessage(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let s=_bs582.default.decode(e),i=_tweetnacl2.default.sign.detached(s,this.keypair.secretKey);return{signature:_bs582.default.encode(i)}})}signTransaction(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let s=_bs582.default.decode(e),o=_web3js.VersionedTransaction.deserialize(s).message.serialize(),c=_tweetnacl2.default.sign.detached(o,this.keypair.secretKey);return{signature:_bs582.default.encode(c)}})}};exports.a = a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var _web3js = require('@solana/web3.js');var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);var _tweetnacl = require('tweetnacl'); var _tweetnacl2 = _interopRequireDefault(_tweetnacl);var n=class{constructor(e){this.type="server";this.keypair=_web3js.Keypair.fromSeed(e.derivedKeyBytes),this._address=this.keypair.publicKey.toBase58(),this._locator=e.locator}address(){return this._address}locator(){return this._locator}signMessage(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let s=_bs582.default.decode(e),i=_tweetnacl2.default.sign.detached(s,this.keypair.secretKey);return{signature:_bs582.default.encode(i)}})}signTransaction(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let s=_bs582.default.decode(e),o=_web3js.VersionedTransaction.deserialize(s).message.serialize(),c=_tweetnacl2.default.sign.detached(o,this.keypair.secretKey);return{signature:_bs582.default.encode(c)}})}};exports.a = n;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkGEY574THcjs = require('./chunk-GEY574TH.cjs');var _chunkUE3WVHTMcjs = require('./chunk-UE3WVHTM.cjs');var _chunk5X4EOJFGcjs = require('./chunk-5X4EOJFG.cjs');var _chunkHRUMWG2Fcjs = require('./chunk-HRUMWG2F.cjs');var _chunkIR5WN6FQcjs = require('./chunk-IR5WN6FQ.cjs');var _chunkT3U46LK3cjs = require('./chunk-T3U46LK3.cjs');var _chunkU2AHGQVYcjs = require('./chunk-U2AHGQVY.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var _chains = require('viem/chains');var b=[_commonsdkbase.BlockchainIncludingTestnet.ABSTRACT_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.ARBITRUM_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.BASE_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.CURTIS,_commonsdkbase.BlockchainIncludingTestnet.ETHEREUM_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.FLOW_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.MANTLE_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.MODE_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.OPTIMISM_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.PLUME_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.POLYGON_AMOY,_commonsdkbase.BlockchainIncludingTestnet.SCROLL_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.SEI_ATLANTIC_2_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.STORY_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.WORLD_CHAIN_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.ZORA_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.ARC_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.TEMPO_TESTNET],w=[_commonsdkbase.BlockchainIncludingTestnet.ABSTRACT,_commonsdkbase.BlockchainIncludingTestnet.APECHAIN,_commonsdkbase.BlockchainIncludingTestnet.ARBITRUM,_commonsdkbase.BlockchainIncludingTestnet.ARBITRUMNOVA,_commonsdkbase.BlockchainIncludingTestnet.BASE,_commonsdkbase.BlockchainIncludingTestnet.BSC,_commonsdkbase.BlockchainIncludingTestnet.FLOW,_commonsdkbase.BlockchainIncludingTestnet.MANTLE,_commonsdkbase.BlockchainIncludingTestnet.MODE,_commonsdkbase.BlockchainIncludingTestnet.OPTIMISM,_commonsdkbase.BlockchainIncludingTestnet.PLUME,_commonsdkbase.BlockchainIncludingTestnet.POLYGON,_commonsdkbase.BlockchainIncludingTestnet.SCROLL,_commonsdkbase.BlockchainIncludingTestnet.SEI_PACIFIC_1,_commonsdkbase.BlockchainIncludingTestnet.SHAPE,_commonsdkbase.BlockchainIncludingTestnet.STORY,_commonsdkbase.BlockchainIncludingTestnet.TEMPO,_commonsdkbase.BlockchainIncludingTestnet.WORLDCHAIN,_commonsdkbase.BlockchainIncludingTestnet.ZORA];function Q(t){switch(t){case _commonsdkbase.BlockchainIncludingTestnet.BASE_SEPOLIA:return _chains.baseSepolia;case _commonsdkbase.BlockchainIncludingTestnet.BASE:return _chains.base;case _commonsdkbase.BlockchainIncludingTestnet.POLYGON_AMOY:return _chains.polygonAmoy;case _commonsdkbase.BlockchainIncludingTestnet.POLYGON:return _chains.polygon;case _commonsdkbase.BlockchainIncludingTestnet.OPTIMISM_SEPOLIA:return _chains.optimismSepolia;case _commonsdkbase.BlockchainIncludingTestnet.OPTIMISM:return _chains.optimism;case _commonsdkbase.BlockchainIncludingTestnet.ARBITRUM_SEPOLIA:return _chains.arbitrumSepolia;case _commonsdkbase.BlockchainIncludingTestnet.ARBITRUM:return _chains.arbitrum;case _commonsdkbase.BlockchainIncludingTestnet.ARBITRUMNOVA:return _chains.arbitrumNova;case _commonsdkbase.BlockchainIncludingTestnet.STORY_TESTNET:return _chunkGEY574THcjs.a;case _commonsdkbase.BlockchainIncludingTestnet.STORY:return _chunkIR5WN6FQcjs.a;case _commonsdkbase.BlockchainIncludingTestnet.MODE_SEPOLIA:return _chains.modeTestnet;case _commonsdkbase.BlockchainIncludingTestnet.MODE:return _chains.mode;case _commonsdkbase.BlockchainIncludingTestnet.BSC:return _chains.bsc;case _commonsdkbase.BlockchainIncludingTestnet.SHAPE:return _chains.shape;case _commonsdkbase.BlockchainIncludingTestnet.ZORA:return _chains.zora;case _commonsdkbase.BlockchainIncludingTestnet.ZORA_SEPOLIA:return _chains.zoraSepolia;case _commonsdkbase.BlockchainIncludingTestnet.ETHEREUM_SEPOLIA:return _chains.sepolia;case _commonsdkbase.BlockchainIncludingTestnet.FLOW:return _chains.flowMainnet;case _commonsdkbase.BlockchainIncludingTestnet.FLOW_TESTNET:return _chains.flowTestnet;case _commonsdkbase.BlockchainIncludingTestnet.PLUME_TESTNET:return _chains.plumeTestnet;case _commonsdkbase.BlockchainIncludingTestnet.PLUME:return _chains.plume;case _commonsdkbase.BlockchainIncludingTestnet.ARC_TESTNET:return _chunkHRUMWG2Fcjs.a;case _commonsdkbase.BlockchainIncludingTestnet.TEMPO:return _chunkUE3WVHTMcjs.a;case _commonsdkbase.BlockchainIncludingTestnet.TEMPO_TESTNET:return _chunk5X4EOJFGcjs.a;case _commonsdkbase.BlockchainIncludingTestnet.ABSTRACT:case _commonsdkbase.BlockchainIncludingTestnet.ABSTRACT_TESTNET:case _commonsdkbase.BlockchainIncludingTestnet.APECHAIN:case _commonsdkbase.BlockchainIncludingTestnet.MANTLE:case _commonsdkbase.BlockchainIncludingTestnet.MANTLE_SEPOLIA:case _commonsdkbase.BlockchainIncludingTestnet.SCROLL:case _commonsdkbase.BlockchainIncludingTestnet.SCROLL_SEPOLIA:case _commonsdkbase.BlockchainIncludingTestnet.SEI_PACIFIC_1:case _commonsdkbase.BlockchainIncludingTestnet.SEI_ATLANTIC_2_TESTNET:case _commonsdkbase.BlockchainIncludingTestnet.CURTIS:case _commonsdkbase.BlockchainIncludingTestnet.WORLDCHAIN:case _commonsdkbase.BlockchainIncludingTestnet.WORLD_CHAIN_SEPOLIA:throw new Error(`Chain ${t} is not yet supported in toViemChain function. Please add the appropriate viem chain definition.`);default:throw new Error(`Unknown chain: ${t}`)}}function I(t){return b.includes(t)}function C(t){return w.includes(t)}var D={[_commonsdkbase.BlockchainIncludingTestnet.ABSTRACT]:_commonsdkbase.BlockchainIncludingTestnet.ABSTRACT_TESTNET,[_commonsdkbase.BlockchainIncludingTestnet.APECHAIN]:_commonsdkbase.BlockchainIncludingTestnet.CURTIS,[_commonsdkbase.BlockchainIncludingTestnet.ARBITRUM]:_commonsdkbase.BlockchainIncludingTestnet.ARBITRUM_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.BASE]:_commonsdkbase.BlockchainIncludingTestnet.BASE_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.FLOW]:_commonsdkbase.BlockchainIncludingTestnet.FLOW_TESTNET,[_commonsdkbase.BlockchainIncludingTestnet.MANTLE]:_commonsdkbase.BlockchainIncludingTestnet.MANTLE_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.MODE]:_commonsdkbase.BlockchainIncludingTestnet.MODE_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.OPTIMISM]:_commonsdkbase.BlockchainIncludingTestnet.OPTIMISM_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.PLUME]:_commonsdkbase.BlockchainIncludingTestnet.PLUME_TESTNET,[_commonsdkbase.BlockchainIncludingTestnet.POLYGON]:_commonsdkbase.BlockchainIncludingTestnet.POLYGON_AMOY,[_commonsdkbase.BlockchainIncludingTestnet.SCROLL]:_commonsdkbase.BlockchainIncludingTestnet.SCROLL_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.SEI_PACIFIC_1]:_commonsdkbase.BlockchainIncludingTestnet.SEI_ATLANTIC_2_TESTNET,[_commonsdkbase.BlockchainIncludingTestnet.STORY]:_commonsdkbase.BlockchainIncludingTestnet.STORY_TESTNET,[_commonsdkbase.BlockchainIncludingTestnet.WORLDCHAIN]:_commonsdkbase.BlockchainIncludingTestnet.WORLD_CHAIN_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.ZORA]:_commonsdkbase.BlockchainIncludingTestnet.ZORA_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.TEMPO]:_commonsdkbase.BlockchainIncludingTestnet.TEMPO_TESTNET};function Y(t){return D[t]}function g(t){return t==="solana"||t==="stellar"||I(t)||C(t)}function X(t,a){if(!g(t))throw new (0, _chunkT3U46LK3cjs.c)(`Unknown chain "${t}". Please use a supported chain name (e.g. "base-sepolia", "polygon", "solana", "stellar").`);if(t==="solana"||t==="stellar")return t;let r=t,T=a===_commonsdkbase.APIKeyEnvironmentPrefix.PRODUCTION;if(T&&I(r))throw new (0, _chunkT3U46LK3cjs.b)(`Chain "${t}" is a testnet chain and cannot be used in production. Please use a mainnet chain instead.`);if(!T&&C(r)){let n=Y(r);if(n!=null)return _chunkU2AHGQVYcjs.a.debug("validateChainForEnvironment.autoConverted",{chain:t,convertedTo:n,environment:a,message:`Chain "${t}" is a mainnet chain and cannot be used in ${a} environment. Automatically converted to "${n}".`}),n;_chunkU2AHGQVYcjs.a.debug("validateChainForEnvironment.mismatch",{chain:t,environment:a,message:`Chain "${t}" is a mainnet chain and should not be used in ${a} environment. No testnet equivalent is available. Please use a testnet chain instead.`})}return t}exports.a = Q; exports.b = I; exports.c = C; exports.d = Y; exports.e = g; exports.f = X;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkGEY574THcjs = require('./chunk-GEY574TH.cjs');var _chunkUE3WVHTMcjs = require('./chunk-UE3WVHTM.cjs');var _chunk5X4EOJFGcjs = require('./chunk-5X4EOJFG.cjs');var _chunkHRUMWG2Fcjs = require('./chunk-HRUMWG2F.cjs');var _chunkIR5WN6FQcjs = require('./chunk-IR5WN6FQ.cjs');var _chunkT3U46LK3cjs = require('./chunk-T3U46LK3.cjs');var _chunkK5SDVE5Fcjs = require('./chunk-K5SDVE5F.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var _chains = require('viem/chains');var b=[_commonsdkbase.BlockchainIncludingTestnet.ABSTRACT_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.ARBITRUM_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.BASE_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.CURTIS,_commonsdkbase.BlockchainIncludingTestnet.ETHEREUM_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.FLOW_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.MANTLE_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.MODE_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.OPTIMISM_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.PLUME_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.POLYGON_AMOY,_commonsdkbase.BlockchainIncludingTestnet.SCROLL_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.SEI_ATLANTIC_2_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.STORY_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.WORLD_CHAIN_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.ZORA_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.ARC_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.TEMPO_TESTNET],w=[_commonsdkbase.BlockchainIncludingTestnet.ABSTRACT,_commonsdkbase.BlockchainIncludingTestnet.APECHAIN,_commonsdkbase.BlockchainIncludingTestnet.ARBITRUM,_commonsdkbase.BlockchainIncludingTestnet.ARBITRUMNOVA,_commonsdkbase.BlockchainIncludingTestnet.BASE,_commonsdkbase.BlockchainIncludingTestnet.BSC,_commonsdkbase.BlockchainIncludingTestnet.FLOW,_commonsdkbase.BlockchainIncludingTestnet.MANTLE,_commonsdkbase.BlockchainIncludingTestnet.MODE,_commonsdkbase.BlockchainIncludingTestnet.OPTIMISM,_commonsdkbase.BlockchainIncludingTestnet.PLUME,_commonsdkbase.BlockchainIncludingTestnet.POLYGON,_commonsdkbase.BlockchainIncludingTestnet.SCROLL,_commonsdkbase.BlockchainIncludingTestnet.SEI_PACIFIC_1,_commonsdkbase.BlockchainIncludingTestnet.SHAPE,_commonsdkbase.BlockchainIncludingTestnet.STORY,_commonsdkbase.BlockchainIncludingTestnet.TEMPO,_commonsdkbase.BlockchainIncludingTestnet.WORLDCHAIN,_commonsdkbase.BlockchainIncludingTestnet.ZORA];function Q(t){switch(t){case _commonsdkbase.BlockchainIncludingTestnet.BASE_SEPOLIA:return _chains.baseSepolia;case _commonsdkbase.BlockchainIncludingTestnet.BASE:return _chains.base;case _commonsdkbase.BlockchainIncludingTestnet.POLYGON_AMOY:return _chains.polygonAmoy;case _commonsdkbase.BlockchainIncludingTestnet.POLYGON:return _chains.polygon;case _commonsdkbase.BlockchainIncludingTestnet.OPTIMISM_SEPOLIA:return _chains.optimismSepolia;case _commonsdkbase.BlockchainIncludingTestnet.OPTIMISM:return _chains.optimism;case _commonsdkbase.BlockchainIncludingTestnet.ARBITRUM_SEPOLIA:return _chains.arbitrumSepolia;case _commonsdkbase.BlockchainIncludingTestnet.ARBITRUM:return _chains.arbitrum;case _commonsdkbase.BlockchainIncludingTestnet.ARBITRUMNOVA:return _chains.arbitrumNova;case _commonsdkbase.BlockchainIncludingTestnet.STORY_TESTNET:return _chunkGEY574THcjs.a;case _commonsdkbase.BlockchainIncludingTestnet.STORY:return _chunkIR5WN6FQcjs.a;case _commonsdkbase.BlockchainIncludingTestnet.MODE_SEPOLIA:return _chains.modeTestnet;case _commonsdkbase.BlockchainIncludingTestnet.MODE:return _chains.mode;case _commonsdkbase.BlockchainIncludingTestnet.BSC:return _chains.bsc;case _commonsdkbase.BlockchainIncludingTestnet.SHAPE:return _chains.shape;case _commonsdkbase.BlockchainIncludingTestnet.ZORA:return _chains.zora;case _commonsdkbase.BlockchainIncludingTestnet.ZORA_SEPOLIA:return _chains.zoraSepolia;case _commonsdkbase.BlockchainIncludingTestnet.ETHEREUM_SEPOLIA:return _chains.sepolia;case _commonsdkbase.BlockchainIncludingTestnet.FLOW:return _chains.flowMainnet;case _commonsdkbase.BlockchainIncludingTestnet.FLOW_TESTNET:return _chains.flowTestnet;case _commonsdkbase.BlockchainIncludingTestnet.PLUME_TESTNET:return _chains.plumeTestnet;case _commonsdkbase.BlockchainIncludingTestnet.PLUME:return _chains.plume;case _commonsdkbase.BlockchainIncludingTestnet.ARC_TESTNET:return _chunkHRUMWG2Fcjs.a;case _commonsdkbase.BlockchainIncludingTestnet.TEMPO:return _chunkUE3WVHTMcjs.a;case _commonsdkbase.BlockchainIncludingTestnet.TEMPO_TESTNET:return _chunk5X4EOJFGcjs.a;case _commonsdkbase.BlockchainIncludingTestnet.ABSTRACT:case _commonsdkbase.BlockchainIncludingTestnet.ABSTRACT_TESTNET:case _commonsdkbase.BlockchainIncludingTestnet.APECHAIN:case _commonsdkbase.BlockchainIncludingTestnet.MANTLE:case _commonsdkbase.BlockchainIncludingTestnet.MANTLE_SEPOLIA:case _commonsdkbase.BlockchainIncludingTestnet.SCROLL:case _commonsdkbase.BlockchainIncludingTestnet.SCROLL_SEPOLIA:case _commonsdkbase.BlockchainIncludingTestnet.SEI_PACIFIC_1:case _commonsdkbase.BlockchainIncludingTestnet.SEI_ATLANTIC_2_TESTNET:case _commonsdkbase.BlockchainIncludingTestnet.CURTIS:case _commonsdkbase.BlockchainIncludingTestnet.WORLDCHAIN:case _commonsdkbase.BlockchainIncludingTestnet.WORLD_CHAIN_SEPOLIA:throw new Error(`Chain ${t} is not yet supported in toViemChain function. Please add the appropriate viem chain definition.`);default:throw new Error(`Unknown chain: ${t}`)}}function I(t){return b.includes(t)}function C(t){return w.includes(t)}var D={[_commonsdkbase.BlockchainIncludingTestnet.ABSTRACT]:_commonsdkbase.BlockchainIncludingTestnet.ABSTRACT_TESTNET,[_commonsdkbase.BlockchainIncludingTestnet.APECHAIN]:_commonsdkbase.BlockchainIncludingTestnet.CURTIS,[_commonsdkbase.BlockchainIncludingTestnet.ARBITRUM]:_commonsdkbase.BlockchainIncludingTestnet.ARBITRUM_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.BASE]:_commonsdkbase.BlockchainIncludingTestnet.BASE_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.FLOW]:_commonsdkbase.BlockchainIncludingTestnet.FLOW_TESTNET,[_commonsdkbase.BlockchainIncludingTestnet.MANTLE]:_commonsdkbase.BlockchainIncludingTestnet.MANTLE_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.MODE]:_commonsdkbase.BlockchainIncludingTestnet.MODE_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.OPTIMISM]:_commonsdkbase.BlockchainIncludingTestnet.OPTIMISM_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.PLUME]:_commonsdkbase.BlockchainIncludingTestnet.PLUME_TESTNET,[_commonsdkbase.BlockchainIncludingTestnet.POLYGON]:_commonsdkbase.BlockchainIncludingTestnet.POLYGON_AMOY,[_commonsdkbase.BlockchainIncludingTestnet.SCROLL]:_commonsdkbase.BlockchainIncludingTestnet.SCROLL_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.SEI_PACIFIC_1]:_commonsdkbase.BlockchainIncludingTestnet.SEI_ATLANTIC_2_TESTNET,[_commonsdkbase.BlockchainIncludingTestnet.STORY]:_commonsdkbase.BlockchainIncludingTestnet.STORY_TESTNET,[_commonsdkbase.BlockchainIncludingTestnet.WORLDCHAIN]:_commonsdkbase.BlockchainIncludingTestnet.WORLD_CHAIN_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.ZORA]:_commonsdkbase.BlockchainIncludingTestnet.ZORA_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.TEMPO]:_commonsdkbase.BlockchainIncludingTestnet.TEMPO_TESTNET};function Y(t){return D[t]}function g(t){return t==="solana"||t==="stellar"||I(t)||C(t)}function X(t,a){if(!g(t))throw new (0, _chunkT3U46LK3cjs.c)(`Unknown chain "${t}". Please use a supported chain name (e.g. "base-sepolia", "polygon", "solana", "stellar").`);if(t==="solana"||t==="stellar")return t;let r=t,T=a===_commonsdkbase.APIKeyEnvironmentPrefix.PRODUCTION;if(T&&I(r))throw new (0, _chunkT3U46LK3cjs.b)(`Chain "${t}" is a testnet chain and cannot be used in production. Please use a mainnet chain instead.`);if(!T&&C(r)){let n=Y(r);if(n!=null)return _chunkK5SDVE5Fcjs.a.debug("validateChainForEnvironment.autoConverted",{chain:t,convertedTo:n,environment:a,message:`Chain "${t}" is a mainnet chain and cannot be used in ${a} environment. Automatically converted to "${n}".`}),n;_chunkK5SDVE5Fcjs.a.debug("validateChainForEnvironment.mismatch",{chain:t,environment:a,message:`Chain "${t}" is a mainnet chain and should not be used in ${a} environment. No testnet equivalent is available. Please use a testnet chain instead.`})}return t}exports.a = Q; exports.b = I; exports.c = C; exports.d = Y; exports.e = g; exports.f = X;
@@ -1 +1 @@
1
- import{a as r}from"./chunk-OQZTL6ZG.js";import{a as n}from"./chunk-ZE4NT3CJ.js";import{a as i}from"./chunk-MMFZP54X.js";import{a as t}from"./chunk-BITOMWYZ.js";function c(a,e){switch(r(a)){case"evm":return new n(e);case"solana":return new i(e);case"stellar":return new t(e)}}export{c as a};
1
+ import{a as r}from"./chunk-OQZTL6ZG.js";import{a as n}from"./chunk-N355UETO.js";import{a as i}from"./chunk-3VRN3GKQ.js";import{a as t}from"./chunk-BITOMWYZ.js";function c(a,e){switch(r(a)){case"evm":return new n(e);case"solana":return new i(e);case"stellar":return new t(e)}}export{c as a};
@@ -0,0 +1 @@
1
+ var s="@crossmint/wallets-sdk",t="1.0.0-beta.6";var c="WALLETS_SDK",r=t,a=s,d=500;export{c as a,r as b,a as c,d};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkNJEW3A4Jcjs = require('./chunk-NJEW3A4J.cjs');var _chunkU2AHGQVYcjs = require('./chunk-U2AHGQVY.cjs');var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var _web3js = require('@solana/web3.js');var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);var g=class c extends _chunkNJEW3A4Jcjs.a{constructor(n){super(n)}signMessage(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for email signer"))})}signTransaction(n){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var i;yield this.handleAuthRequired();let d=this.getJwtOrThrow(),m=_bs582.default.decode(n),y=_web3js.VersionedTransaction.deserialize(m).message.serialize();_chunkU2AHGQVYcjs.a.info("sign: sending request",{keyType:"ed25519"});let l=Date.now(),e=yield(i=this.config.clientTEEConnection)==null?void 0:i.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:d,apiKey:this.config.crossmint.apiKey},data:{keyType:"ed25519",bytes:_bs582.default.encode(new Uint8Array(y)),encoding:"base58"}},options:_chunkNJEW3A4Jcjs.b});if(_chunkU2AHGQVYcjs.a.info("sign: response received",{status:e==null?void 0:e.status,durationMs:Date.now()-l}),(e==null?void 0:e.status)==="error")throw new Error(e.error);if((e==null?void 0:e.signature)==null)throw new Error("Failed to sign transaction");return c.verifyPublicKeyFormat(e.publicKey),{signature:e.signature.bytes}})}static verifyPublicKeyFormat(n){if(n==null)throw new Error("No public key found");if(n.encoding!=="base58"||n.keyType!=="ed25519"||n.bytes==null)throw new Error("Not supported. Expected public key to be in base58 encoding and ed25519 key type. Got: "+JSON.stringify(n))}getChainKeyParams(){return{scheme:"ed25519",encoding:"base58"}}};exports.a = g;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkE54SDHZVcjs = require('./chunk-E54SDHZV.cjs');var _chunkK5SDVE5Fcjs = require('./chunk-K5SDVE5F.cjs');var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var _web3js = require('@solana/web3.js');var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);var g=class c extends _chunkE54SDHZVcjs.a{constructor(n){super(n)}signMessage(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for email signer"))})}signTransaction(n){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var i;yield this.handleAuthRequired();let d=this.getJwtOrThrow(),m=_bs582.default.decode(n),y=_web3js.VersionedTransaction.deserialize(m).message.serialize();_chunkK5SDVE5Fcjs.a.info("sign: sending request",{keyType:"ed25519"});let l=Date.now(),e=yield(i=this.config.clientTEEConnection)==null?void 0:i.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:d,apiKey:this.config.crossmint.apiKey},data:{keyType:"ed25519",bytes:_bs582.default.encode(new Uint8Array(y)),encoding:"base58"}},options:_chunkE54SDHZVcjs.b});if(_chunkK5SDVE5Fcjs.a.info("sign: response received",{status:e==null?void 0:e.status,durationMs:Date.now()-l}),(e==null?void 0:e.status)==="error")throw new Error(e.error);if((e==null?void 0:e.signature)==null)throw new Error("Failed to sign transaction");return c.verifyPublicKeyFormat(e.publicKey),{signature:e.signature.bytes}})}static verifyPublicKeyFormat(n){if(n==null)throw new Error("No public key found");if(n.encoding!=="base58"||n.keyType!=="ed25519"||n.bytes==null)throw new Error("Not supported. Expected public key to be in base58 encoding and ed25519 key type. Got: "+JSON.stringify(n))}getChainKeyParams(){return{scheme:"ed25519",encoding:"base58"}}};exports.a = g;
@@ -1 +1 @@
1
- import{a,b as g}from"./chunk-KCOND2E6.js";import{a as s}from"./chunk-IYRVMHRW.js";import{g as t}from"./chunk-J3R36SGJ.js";import{PersonalMessage as u}from"ox";import{isHex as h,toHex as l}from"viem";var c=class p extends a{constructor(e){super(e)}signMessage(e){return t(this,null,function*(){let i=h(e)?e:l(e),r=u.getSignPayload(i);return yield this.sign(r)})}signTransaction(e){return t(this,null,function*(){return yield this.sign(e)})}sign(e){return t(this,null,function*(){var o;yield this.handleAuthRequired();let i=this.getJwtOrThrow(),r=e.replace("0x","");s.info("sign: sending request",{keyType:"secp256k1"});let y=Date.now(),n=yield(o=this.config.clientTEEConnection)==null?void 0:o.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:i,apiKey:this.config.crossmint.apiKey},data:{keyType:"secp256k1",bytes:r,encoding:"hex"}},options:g});if(s.info("sign: response received",{status:n==null?void 0:n.status,durationMs:Date.now()-y}),(n==null?void 0:n.status)==="error")throw new Error(n.error);if((n==null?void 0:n.signature)==null)throw new Error("Failed to sign transaction");return p.verifyPublicKeyFormat(n.publicKey),{signature:n.signature.bytes}})}static verifyPublicKeyFormat(e){if(e==null)throw new Error("No public key found");if(e.encoding!=="hex"||e.keyType!=="secp256k1"||e.bytes==null)throw new Error("Not supported. Expected public key to be in hex encoding and secp256k1 key type. Got: "+JSON.stringify(e))}getChainKeyParams(){return{scheme:"secp256k1",encoding:"hex"}}};export{c as a};
1
+ import{a,b as g}from"./chunk-3NHE4HDZ.js";import{a as s}from"./chunk-2GHG5OLB.js";import{g as t}from"./chunk-J3R36SGJ.js";import{PersonalMessage as u}from"ox";import{isHex as h,toHex as l}from"viem";var c=class p extends a{constructor(e){super(e)}signMessage(e){return t(this,null,function*(){let i=h(e)?e:l(e),r=u.getSignPayload(i);return yield this.sign(r)})}signTransaction(e){return t(this,null,function*(){return yield this.sign(e)})}sign(e){return t(this,null,function*(){var o;yield this.handleAuthRequired();let i=this.getJwtOrThrow(),r=e.replace("0x","");s.info("sign: sending request",{keyType:"secp256k1"});let y=Date.now(),n=yield(o=this.config.clientTEEConnection)==null?void 0:o.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:i,apiKey:this.config.crossmint.apiKey},data:{keyType:"secp256k1",bytes:r,encoding:"hex"}},options:g});if(s.info("sign: response received",{status:n==null?void 0:n.status,durationMs:Date.now()-y}),(n==null?void 0:n.status)==="error")throw new Error(n.error);if((n==null?void 0:n.signature)==null)throw new Error("Failed to sign transaction");return p.verifyPublicKeyFormat(n.publicKey),{signature:n.signature.bytes}})}static verifyPublicKeyFormat(e){if(e==null)throw new Error("No public key found");if(e.encoding!=="hex"||e.keyType!=="secp256k1"||e.bytes==null)throw new Error("Not supported. Expected public key to be in hex encoding and secp256k1 key type. Got: "+JSON.stringify(e))}getChainKeyParams(){return{scheme:"secp256k1",encoding:"hex"}}};export{c as a};
@@ -1 +1 @@
1
- import{g as i}from"./chunk-J3R36SGJ.js";var n=class{constructor(e,r){this.type="device";this.config=e,this.deviceSignerKeyStorage=r}locator(){return this.config.locator||"device:"}signMessage(e){return i(this,null,function*(){return{signature:yield this.deviceSignerKeyStorage.signMessage(this.config.address,e)}})}signTransaction(e){return i(this,null,function*(){return yield this.signMessage(e)})}};export{n as a};
1
+ import{g as i}from"./chunk-J3R36SGJ.js";var t=class{constructor(e,r){this.type="device";this.config=e,this.deviceSignerKeyStorage=r}locator(){return this.config.locator||"device:"}signMessage(e){return i(this,null,function*(){return{signature:yield this.deviceSignerKeyStorage.signMessage(this.config.address,e)}})}signTransaction(e){return i(this,null,function*(){return yield this.signMessage(e)})}};export{t as a};
@@ -0,0 +1 @@
1
+ import{a as i}from"./chunk-KGBCGBUZ.js";import{b as u}from"./chunk-RBSMBO4T.js";import{t as h}from"./chunk-EXC7TCGL.js";import{a as s}from"./chunk-2GHG5OLB.js";import{c as p,g as l}from"./chunk-J3R36SGJ.js";import{isValidStellarAddress as m,WithLoggerContext as y}from"@crossmint/common-sdk-base";var o=class o 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),signer:e.signer,signers:i.getInitialSigners(e)},i.getApiClient(e))}static from(e){if(!m(e.address))throw new Error("Wallet is not a Stellar wallet");return new o(e)}sendTransaction(e){return l(this,null,function*(){var a;s.info("stellarWallet.sendTransaction.start"),yield this.preAuthIfNeeded();let t=yield this.createTransaction(e);if((a=e.options)!=null&&a.prepareOnly)return s.info("stellarWallet.sendTransaction.prepared",{transactionId:t.id}),{hash:void 0,explorerLink:void 0,transactionId:t.id};let n={},r=yield this.approveTransactionAndWait(t.id,n);return s.info("stellarWallet.sendTransaction.success",{transactionId:t.id,hash:r.hash}),r})}createTransaction(e){return l(this,null,function*(){let{contractId:t,options:n}=e,r;(n==null?void 0:n.signer)==null?r=this.requireSigner().locator():typeof n.signer=="string"?r=n.signer:r=`server:${u(n.signer,this.chain,this.apiClient.projectId,this.apiClient.environment).derivedAddress}`;let a;if("transaction"in e)a={type:"serialized-transaction",serializedTransaction:e.transaction,contractId:t};else{let{method:T,memo:d,args:g}=e;a={type:"contract-call",contractId:t,method:T,memo:d!=null?{type:"text",value:d}:void 0,args:g}}let c=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:a,signer:r}});if("error"in c)throw new h(JSON.stringify(c));return c})}};p([y({logger:s,methodName:"stellarWallet.sendTransaction",buildContext(e){return{chain:e.chain,address:e.address}}})],o.prototype,"sendTransaction",1);var f=o;export{f as a};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkLSPTALFDcjs = require('./chunk-LSPTALFD.cjs');var _chunkYHV3672Rcjs = require('./chunk-YHV3672R.cjs');var _chunkNX256LAHcjs = require('./chunk-NX256LAH.cjs');var _chunkK5TQ4QU3cjs = require('./chunk-K5TQ4QU3.cjs');var _chunk3VSFHDFHcjs = require('./chunk-3VSFHDFH.cjs');var _chunk5ZVOGNTQcjs = require('./chunk-5ZVOGNTQ.cjs');var _chunkT3U46LK3cjs = require('./chunk-T3U46LK3.cjs');var _chunkK5SDVE5Fcjs = require('./chunk-K5SDVE5F.cjs');var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var _ox = require('ox');var E="When 'signers' is provided to a method that may fetch an existing wallet, each specified signer must exist in that wallet's configuration.",y= exports.a =class{constructor(t){this.apiClient=t}getWallet(t,e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let a,n;if(typeof t=="string"){if(!this.apiClient.isServerSide)throw new (0, _chunkT3U46LK3cjs.g)("getWallet with walletLocator is only available on the server side. Use getWallet(args) instead.");if(e==null)throw new (0, _chunkT3U46LK3cjs.g)("Wallet configuration is required when using walletLocator: https://docs.crossmint.com/sdk-reference/wallets/type-aliases/WalletArgsFor");a=t,n=e}else{if(this.apiClient.isServerSide)throw new (0, _chunkT3U46LK3cjs.g)("getWallet on server side requires a walletLocator parameter. Use getWallet(walletLocator, args) instead.");n=t,a=this.getWalletLocator(n)}let i=_chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {},n),{chain:_chunk5ZVOGNTQcjs.f.call(void 0, n.chain,this.apiClient.environment)});_chunkK5SDVE5Fcjs.a.info("walletFactory.getWallet.start");let r=yield this.apiClient.getWallet(a);if("error"in r)throw _chunkK5SDVE5Fcjs.a.warn("walletFactory.getWallet.notFound",{error:r.error}),new (0, _chunkT3U46LK3cjs.e)(JSON.stringify(r));return _chunkK5SDVE5Fcjs.a.info("walletFactory.getWallet.success",{address:r.address}),yield this.createWalletInstance(r,i)})}createWallet(t){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var o,s,g,w,W,A,k,F;let e=_chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {},t),{chain:_chunk5ZVOGNTQcjs.f.call(void 0, t.chain,this.apiClient.environment)});if(yield(g=(s=(o=e.options)==null?void 0:o.callbacks)==null?void 0:s.onWalletCreationStart)==null?void 0:g.call(s),_chunkK5SDVE5Fcjs.a.info("walletFactory.createWallet.start"),!this.apiClient.isServerSide&&e.owner!=null)throw _chunkK5SDVE5Fcjs.a.error("walletFactory.createWallet.error",{error:"Owner field cannot be specified in client-side createWallet calls"}),new (0, _chunkT3U46LK3cjs.g)("Owner field cannot be specified in client-side createWallet calls. Owner is determined from JWT authentication.");let a=((w=e.options)==null?void 0:w.deviceSignerKeyStorage)!=null?this.ensureDeviceSignerInSigners(e):(W=e.signers)!=null?W:[],n=yield this.registerSigners(a,e.chain,(A=e.options)==null?void 0:A.deviceSignerKeyStorage),i;if(e.recovery.type==="passkey"&&e.recovery.id==null)i=yield this.createPasskeySigner(e.recovery);else if(e.recovery.type==="server"){let{derivedAddress:D}=_chunk3VSFHDFHcjs.b.call(void 0, e.recovery,e.chain,this.apiClient.projectId,this.apiClient.environment);i={type:"server",address:D}}else i=e.recovery;let r=yield this.apiClient.createWallet({type:"smart",chainType:this.getChainType(e.chain),config:_chunk2GKPWQBQcjs.a.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {adminSigner:i},e.plugins?{plugins:e.plugins}:{}),n!=null?{delegatedSigners:n}:{}),owner:(k=e.owner)!=null?k:void 0,alias:(F=e.alias)!=null?F:void 0});if("error"in r)throw _chunkK5SDVE5Fcjs.a.error("walletFactory.createWallet.error",{error:r.error}),new (0, _chunkT3U46LK3cjs.g)(JSON.stringify(r));return _chunkK5SDVE5Fcjs.a.info("walletFactory.createWallet.success",{address:r.address}),yield this.createWalletInstance(r,e)})}createWalletInstance(t,e){var o,s;this.validateExistingWalletConfig(t,e);let a=e,n=t.config.adminSigner,i=((o=a.recovery)==null?void 0:o.type)==="server"||((s=a.recovery)==null?void 0:s.type)==="external-wallet"?a.recovery:n,r=t.config.delegatedSigners;return r!=null&&r.length===1&&(r[0].type==="server"||r[0].type==="external-wallet")&&(r=a.signers),new (0, _chunkLSPTALFDcjs.a)({chain:e.chain,address:t.address,owner:t.owner,options:e.options,alias:e.alias,recovery:i,signers:r!=null?r:[]},this.apiClient)}getWalletLocator(t){return`me:${this.getChainType(t.chain)}:smart`+(t.alias!=null?`:alias:${t.alias}`:"")}createPasskeySigner(t){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var n;if(t.type!=="passkey")throw new Error("Signer is not a passkey");let e=(n=t.name)!=null?n:`Crossmint Wallet ${Date.now()}`,a=t.onCreatePasskey?yield t.onCreatePasskey(e):yield _ox.WebAuthnP256.createCredential({name:e});return{type:"passkey",id:a.id,name:e,publicKey:{x:a.publicKey.x.toString(),y:a.publicKey.y.toString()}}})}ensureDeviceSignerInSigners(t){var n,i;if(t.chain==="solana")return(n=t.signers)!=null?n:[];let e=(i=t.signers)!=null?i:[];return e.some(r=>r.type==="device")?e:[...e,{type:"device"}]}validateExistingWalletConfig(t,e){if(e.owner!=null&&t.owner!=null&&_chunkK5TQ4QU3cjs.a.call(void 0, e.owner)!==_chunkK5TQ4QU3cjs.a.call(void 0, t.owner))throw new (0, _chunkT3U46LK3cjs.g)("Wallet owner does not match existing wallet's linked user");if(e.chain==="solana"&&t.chainType!=="solana"||e.chain!=="solana"&&t.chainType==="solana"||e.chain==="stellar"&&t.chainType!=="stellar"||e.chain!=="stellar"&&t.chainType==="stellar")throw new (0, _chunkT3U46LK3cjs.g)(`Wallet chain does not match existing wallet's chain. You must use chain: ${t.chainType}.`);if(t.type!=="smart")return;let a=e;if(a.recovery!=null||a.signers!=null){let n=t.config,i=n==null?void 0:n.adminSigner;if(a.recovery!=null&&i!=null){if(a.recovery.type!==i.type)throw new (0, _chunkT3U46LK3cjs.g)("The wallet recovery signer type does not match the existing wallet's recovery signer type");_chunkK5TQ4QU3cjs.b.call(void 0, a.recovery,i)}let r=a.signers;r!=null&&this.validateSigners(t,r,e.chain)}}validateSigners(t,e,a){let n=t.config,i=n==null?void 0:n.delegatedSigners;if(e.length!==0){if(i==null||i.length===0)throw new (0, _chunkT3U46LK3cjs.g)(`${e.length} signer(s) specified, but wallet "${t.address}" has no signers. ${E}`);for(let r of e){let o=i.find(s=>{if(this.isMatchingPasskeySigner(r,s,n)||s.type==="device"&&r.type==="device")return!0;if(r.type==="server"){let{derivedAddress:g}=_chunk3VSFHDFHcjs.b.call(void 0, r,a,this.apiClient.projectId,this.apiClient.environment);return s.locator===`server:${g}`}return s.locator===_chunkNX256LAHcjs.a.call(void 0, r)});if(o==null){let s=i.map(g=>g.locator).join(", ");throw new (0, _chunkT3U46LK3cjs.g)(`Signer '${r.type}' does not exist in wallet "${t.address}". Available signers: ${s}. ${E}`)}_chunkK5TQ4QU3cjs.b.call(void 0, r,o)}}}isMatchingPasskeySigner(t,e,a){var i,r;let n=((r=(i=a.delegatedSigners)==null?void 0:i.filter(o=>o.type==="passkey").length)!=null?r:0)+(a.adminSigner.type==="passkey"?1:0);if(t.type==="passkey"){if(t.id==null&&n===1)return e.type==="passkey";if(t.id==null&&n>1)throw new (0, _chunkT3U46LK3cjs.g)("When creating a wallet with multiple passkeys, you must provide the passkey ID for each passkey.")}return!1}registerSigners(t,e,a){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var n;return yield Promise.all((n=t==null?void 0:t.map(i=>_chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){if(i.type==="passkey")return i.id==null?{signer:yield this.createPasskeySigner(i)}:{signer:i};if(i.type==="device"){if(i.publicKey!=null)return{signer:{type:"device",publicKey:i.publicKey,name:i.name}};if(i.locator!=null)return{signer:i.locator};if(a==null)throw new (0, _chunkT3U46LK3cjs.g)("Device signer key storage is required for device signers");let r=yield _chunkYHV3672Rcjs.a.call(void 0, a);return{signer:{type:"device",publicKey:r.publicKey,name:r.name}}}if(i.type==="server"&&e!=null){let{derivedAddress:r}=_chunk3VSFHDFHcjs.b.call(void 0, i,e,this.apiClient.projectId,this.apiClient.environment);return{signer:`server:${r}`}}return{signer:_chunkNX256LAHcjs.a.call(void 0, i)}})))!=null?n:[])})}getChainType(t){return t==="solana"?"solana":t==="stellar"?"stellar":"evm"}};_chunk2GKPWQBQcjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkK5SDVE5Fcjs.a,methodName:"walletFactory.getWallet",buildContext(t,e){if(typeof e[0]=="string"){let n=e[1];return{walletLocator:e[0],chain:n==null?void 0:n.chain}}let a=e[0];return{chain:a==null?void 0:a.chain}}})],y.prototype,"getWallet",1),_chunk2GKPWQBQcjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkK5SDVE5Fcjs.a,methodName:"walletFactory.createWallet",buildContext(t,e){return{chain:e[0].chain}}})],y.prototype,"createWallet",1);exports.a = y;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');function o(t){switch(t.type){case"passkey":return{type:"passkey",id:t.id,name:t.name,publicKey:t.publicKey,validatorContractVersion:t.validatorContractVersion,locator:t.locator};case"api-key":return{type:"api-key",address:t.address,locator:t.locator};case"external-wallet":return{type:"external-wallet",address:t.address,locator:t.locator};case"email":return{type:"email",email:t.email,address:t.address,locator:t.locator};case"phone":return{type:"phone",phone:t.phone,address:t.address,locator:t.locator};case"device":return{type:"device",publicKey:t.publicKey,locator:t.locator};case"server":return{type:"server",address:t.address,locator:t.locator};default:throw new Error(`Unknown signer type: ${t.type}`)}}function c(t,s){let e=o(t);if(s==="solana"||s==="stellar"){let n="success";return"transaction"in t&&t.transaction!=null&&(n=t.transaction.status),_chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {},e),{status:n})}if("chains"in t&&t.chains!=null&&Object.keys(t.chains).length>0){let n=t.chains[s];return n==null?null:_chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {},e),{status:n.status})}return _chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {},e),{status:"success"})}function u(t,s){if(s==="solana"||s==="stellar")return"transaction"in t&&t.transaction!=null&&(t.transaction.status==="pending"||t.transaction.status==="awaiting-approval")?{type:"transaction",id:t.transaction.id}:null;if("chains"in t&&t.chains!=null){let e=t.chains[s];if(e!=null&&(e.status==="pending"||e.status==="awaiting-approval"))return{type:"signature",id:e.id}}return null}function i(t,s){let e=_chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {},t),{status:s});return t.locator.indexOf(":")===-1&&(t.type==="api-key"?e.locator=t.locator:(e.locator=`external-wallet:${t.locator}`,e.type="external-wallet")),e}exports.a = o; exports.b = c; exports.c = u; exports.d = i;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkJBP52JOHcjs = require('./chunk-JBP52JOH.cjs');var _chunk5QIW67NUcjs = require('./chunk-5QIW67NU.cjs');var _chunkU2AHGQVYcjs = require('./chunk-U2AHGQVY.cjs');var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var f=class{constructor(r){this.config=r;this._needsAuth=!0;this._authPromise=null;this._initializationPromise=null;typeof window!="undefined"&&(this._initializationPromise=this.initialize()),this.type=this.config.type}locator(){return this.config.locator}address(){return this.config.address}initialize(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){try{if(this.config.clientTEEConnection==null){let r=_commonsdkbase.validateAPIKey.call(void 0, this.config.crossmint.apiKey);if(!r.isValid)throw new Error("Invalid API key");let t=new (0, _chunkJBP52JOHcjs.a)({environment:r.environment});this.config.clientTEEConnection=yield t.initialize()}}finally{this._initializationPromise=null}})}getTEEConnection(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){if(this.config.clientTEEConnection==null){if(this._initializationPromise){if(yield this._initializationPromise,this.config.clientTEEConnection==null)throw new Error("Failed to initialize TEE connection");return this.config.clientTEEConnection}this._initializationPromise=this.initializeTEEConnection();try{yield this._initializationPromise}finally{this._initializationPromise=null}}if(this.config.clientTEEConnection==null)throw new Error("TEE connection is not initialized");return this.config.clientTEEConnection})}initializeTEEConnection(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){_chunkU2AHGQVYcjs.a.info("TEE connection not initialized, initializing now");let r=_commonsdkbase.validateAPIKey.call(void 0, this.config.crossmint.apiKey);if(!r.isValid)throw new Error("Invalid API key");let t=new (0, _chunkJBP52JOHcjs.a)({environment:r.environment});if(this.config.clientTEEConnection=yield t.initialize(),this.config.clientTEEConnection==null)throw new Error("Failed to initialize TEE connection");_chunkU2AHGQVYcjs.a.info("TEE connection initialized successfully")})}handleAuthRequired(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var u;let r=yield this.getTEEConnection();if(this.config.onAuthRequired==null)throw new Error(`${this.type} signer requires the onAuthRequired callback to handle OTP verification. This callback manages the authentication flow (sending OTP and verifying user input). If using our React/React Native SDK, this is handled automatically by the provider. For other environments, implement: onAuthRequired: (needsAuth, sendOtp, verifyOtp, reject) => { /* your UI logic */ }`);_chunkU2AHGQVYcjs.a.info("get-status: sending request");let t=Date.now(),n=yield r.sendAction({event:"request:get-status",responseEvent:"response:get-status",data:{authData:{jwt:(u=this.config.crossmint.jwt)!=null?u:"",apiKey:this.config.crossmint.apiKey}},options:d}),e=Date.now()-t;if((n==null?void 0:n.status)!=="success")throw _chunkU2AHGQVYcjs.a.error("get-status: failed",{status:n==null?void 0:n.status,error:n==null?void 0:n.error,durationMs:e}),new Error(n==null?void 0:n.error);if(_chunkU2AHGQVYcjs.a.info("get-status: response received",{signerStatus:n.signerStatus,durationMs:e}),n.signerStatus==="ready"){this._needsAuth=!1;return}else this._needsAuth=!0;_chunkU2AHGQVYcjs.a.info("Auth required, initiating OTP flow",{needsAuth:this._needsAuth});let{promise:s,resolve:h,reject:c}=this.createAuthPromise();if(this._authPromise={promise:s,resolve:h,reject:c},this.config.onAuthRequired)try{yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),i=>this.verifyOtp(i),()=>_chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){_chunkU2AHGQVYcjs.a.info("Auth rejected",{authRejected:!0}),this._needsAuth=!1,this.config.onAuthRequired!=null&&(yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),i=>this.verifyOtp(i),()=>{var i;return(i=this._authPromise)==null?void 0:i.reject(new _chunk5QIW67NUcjs.a)})),c(new _chunk5QIW67NUcjs.a)}))}catch(i){_chunkU2AHGQVYcjs.a.error("handleAuthRequired error",{error:i}),c(i)}try{yield s}catch(i){throw _chunkU2AHGQVYcjs.a.error("handleAuthRequired promise error",{error:i}),i}})}ensureAuthenticated(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){yield this.handleAuthRequired()})}getJwtOrThrow(){let r=this.config.crossmint.jwt;if(r==null)throw new Error("JWT is required");return r}createAuthPromise(){let r,t;return{promise:new Promise((e,s)=>{r=e,t=s}),resolve:r,reject:t}}sendMessageWithOtp(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var h,c;let r=yield this.getTEEConnection(),t=this.getAuthId();_chunkU2AHGQVYcjs.a.info("start-onboarding: sending request");let n=Date.now(),e=yield r.sendAction({event:"request:start-onboarding",responseEvent:"response:start-onboarding",data:{authData:{jwt:(h=this.config.crossmint.jwt)!=null?h:"",apiKey:this.config.crossmint.apiKey},data:{authId:t}},options:d}),s=Date.now()-n;if(_chunkU2AHGQVYcjs.a.info("start-onboarding: response received",{status:e==null?void 0:e.status,durationMs:s}),(e==null?void 0:e.status)==="success"&&e.signerStatus==="ready"){this._needsAuth=!1;return}(e==null?void 0:e.status)==="error"&&(_chunkU2AHGQVYcjs.a.error("start-onboarding: failed",{error:e.error}),(c=this._authPromise)==null||c.reject(new Error(e.error||"Failed to initiate OTP process.")))})}getAuthId(){return this.config.type==="email"?`email:${this.config.email}`:`phone:${this.config.phone}`}verifyOtp(r){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var s,h,c,u;let t;try{let i=yield this.getTEEConnection();_chunkU2AHGQVYcjs.a.info("complete-onboarding: sending request");let E=Date.now();t=yield i.sendAction({event:"request:complete-onboarding",responseEvent:"response:complete-onboarding",data:{authData:{jwt:(s=this.config.crossmint.jwt)!=null?s:"",apiKey:this.config.crossmint.apiKey},data:{onboardingAuthentication:{encryptedOtp:r}}},options:d}),_chunkU2AHGQVYcjs.a.info("complete-onboarding: response received",{status:t==null?void 0:t.status,durationMs:Date.now()-E})}catch(i){throw _chunkU2AHGQVYcjs.a.error("complete-onboarding: error",{error:i}),this._needsAuth=!0,(h=this._authPromise)==null||h.reject(i),i}if((t==null?void 0:t.status)==="success"){this._needsAuth=!1,this.config.onAuthRequired!=null&&(yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),i=>this.verifyOtp(i),()=>{var i;return(i=this._authPromise)==null?void 0:i.reject(new _chunk5QIW67NUcjs.a)})),(c=this._authPromise)==null||c.resolve();return}_chunkU2AHGQVYcjs.a.error("complete-onboarding: OTP validation failed",{status:t==null?void 0:t.status}),this._needsAuth=!0;let n=(t==null?void 0:t.status)==="error"?t.error:"Failed to validate encrypted OTP",e=new Error(n);throw(u=this._authPromise)==null||u.reject(e),e})}_exportPrivateKey(r){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){yield this.handleAuthRequired();let t=this.getJwtOrThrow(),{scheme:n,encoding:e}=this.getChainKeyParams(),s=yield r.sendAction({event:"request:export-signer",responseEvent:"response:export-signer",data:{authData:{jwt:t,apiKey:this.config.crossmint.apiKey},data:{scheme:n,encoding:e}},options:d});if((s==null?void 0:s.status)==="error")throw new Error(s.error||"Failed to export private key")})}};_chunk2GKPWQBQcjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkU2AHGQVYcjs.a,methodName:"handleAuthRequired"})],f.prototype,"handleAuthRequired",1);var d={timeoutMs:3e4};exports.a = f; exports.b = d;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkJBP52JOHcjs = require('./chunk-JBP52JOH.cjs');var _chunk5QIW67NUcjs = require('./chunk-5QIW67NU.cjs');var _chunkK5SDVE5Fcjs = require('./chunk-K5SDVE5F.cjs');var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var f=class{constructor(r){this.config=r;this._needsAuth=!0;this._authPromise=null;this._initializationPromise=null;typeof window!="undefined"&&(this._initializationPromise=this.initialize()),this.type=this.config.type}locator(){return this.config.locator}address(){return this.config.address}initialize(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){try{if(this.config.clientTEEConnection==null){let r=_commonsdkbase.validateAPIKey.call(void 0, this.config.crossmint.apiKey);if(!r.isValid)throw new Error("Invalid API key");let t=new (0, _chunkJBP52JOHcjs.a)({environment:r.environment});this.config.clientTEEConnection=yield t.initialize()}}finally{this._initializationPromise=null}})}getTEEConnection(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){if(this.config.clientTEEConnection==null){if(this._initializationPromise){if(yield this._initializationPromise,this.config.clientTEEConnection==null)throw new Error("Failed to initialize TEE connection");return this.config.clientTEEConnection}this._initializationPromise=this.initializeTEEConnection();try{yield this._initializationPromise}finally{this._initializationPromise=null}}if(this.config.clientTEEConnection==null)throw new Error("TEE connection is not initialized");return this.config.clientTEEConnection})}initializeTEEConnection(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){_chunkK5SDVE5Fcjs.a.info("TEE connection not initialized, initializing now");let r=_commonsdkbase.validateAPIKey.call(void 0, this.config.crossmint.apiKey);if(!r.isValid)throw new Error("Invalid API key");let t=new (0, _chunkJBP52JOHcjs.a)({environment:r.environment});if(this.config.clientTEEConnection=yield t.initialize(),this.config.clientTEEConnection==null)throw new Error("Failed to initialize TEE connection");_chunkK5SDVE5Fcjs.a.info("TEE connection initialized successfully")})}handleAuthRequired(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var u;let r=yield this.getTEEConnection();if(this.config.onAuthRequired==null)throw new Error(`${this.type} signer requires the onAuthRequired callback to handle OTP verification. This callback manages the authentication flow (sending OTP and verifying user input). If using our React/React Native SDK, this is handled automatically by the provider. For other environments, implement: onAuthRequired: (needsAuth, sendOtp, verifyOtp, reject) => { /* your UI logic */ }`);_chunkK5SDVE5Fcjs.a.info("get-status: sending request");let t=Date.now(),n=yield r.sendAction({event:"request:get-status",responseEvent:"response:get-status",data:{authData:{jwt:(u=this.config.crossmint.jwt)!=null?u:"",apiKey:this.config.crossmint.apiKey}},options:d}),i=Date.now()-t;if((n==null?void 0:n.status)!=="success")throw _chunkK5SDVE5Fcjs.a.error("get-status: failed",{status:n==null?void 0:n.status,error:n==null?void 0:n.error,durationMs:i}),new Error(n==null?void 0:n.error);if(_chunkK5SDVE5Fcjs.a.info("get-status: response received",{signerStatus:n.signerStatus,durationMs:i}),n.signerStatus==="ready"){this._needsAuth=!1;return}else this._needsAuth=!0;_chunkK5SDVE5Fcjs.a.info("Auth required, initiating OTP flow",{needsAuth:this._needsAuth});let{promise:s,resolve:h,reject:c}=this.createAuthPromise();if(this._authPromise={promise:s,resolve:h,reject:c},this.config.onAuthRequired)try{yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),e=>this.verifyOtp(e),()=>_chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){_chunkK5SDVE5Fcjs.a.info("Auth rejected",{authRejected:!0}),this._needsAuth=!1,this.config.onAuthRequired!=null&&(yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),e=>this.verifyOtp(e),()=>{var e;return(e=this._authPromise)==null?void 0:e.reject(new _chunk5QIW67NUcjs.a)})),c(new _chunk5QIW67NUcjs.a)}))}catch(e){_chunkK5SDVE5Fcjs.a.error("handleAuthRequired error",{error:e}),c(e)}try{yield s}catch(e){throw _chunkK5SDVE5Fcjs.a.error("handleAuthRequired promise error",{error:e}),e}})}ensureAuthenticated(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){yield this.handleAuthRequired()})}getJwtOrThrow(){let r=this.config.crossmint.jwt;if(r==null)throw new Error("JWT is required");return r}createAuthPromise(){let r,t;return{promise:new Promise((i,s)=>{r=i,t=s}),resolve:r,reject:t}}sendMessageWithOtp(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var h,c;let r=yield this.getTEEConnection(),t=this.getAuthId();_chunkK5SDVE5Fcjs.a.info("start-onboarding: sending request");let n=Date.now(),i=yield r.sendAction({event:"request:start-onboarding",responseEvent:"response:start-onboarding",data:{authData:{jwt:(h=this.config.crossmint.jwt)!=null?h:"",apiKey:this.config.crossmint.apiKey},data:{authId:t}},options:d}),s=Date.now()-n;if(_chunkK5SDVE5Fcjs.a.info("start-onboarding: response received",{status:i==null?void 0:i.status,durationMs:s}),(i==null?void 0:i.status)==="success"&&i.signerStatus==="ready"){this._needsAuth=!1;return}(i==null?void 0:i.status)==="error"&&(_chunkK5SDVE5Fcjs.a.error("start-onboarding: failed",{error:i.error}),(c=this._authPromise)==null||c.reject(new Error(i.error||"Failed to initiate OTP process.")))})}getAuthId(){return this.config.type==="email"?`email:${this.config.email}`:`phone:${this.config.phone}`}verifyOtp(r){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var s,h,c,u;let t;try{let e=yield this.getTEEConnection();_chunkK5SDVE5Fcjs.a.info("complete-onboarding: sending request");let E=Date.now();t=yield e.sendAction({event:"request:complete-onboarding",responseEvent:"response:complete-onboarding",data:{authData:{jwt:(s=this.config.crossmint.jwt)!=null?s:"",apiKey:this.config.crossmint.apiKey},data:{onboardingAuthentication:{encryptedOtp:r}}},options:d}),_chunkK5SDVE5Fcjs.a.info("complete-onboarding: response received",{status:t==null?void 0:t.status,durationMs:Date.now()-E})}catch(e){throw _chunkK5SDVE5Fcjs.a.error("complete-onboarding: error",{error:e}),this._needsAuth=!0,(h=this._authPromise)==null||h.reject(e),e}if((t==null?void 0:t.status)==="success"){this._needsAuth=!1,this.config.onAuthRequired!=null&&(yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),e=>this.verifyOtp(e),()=>{var e;return(e=this._authPromise)==null?void 0:e.reject(new _chunk5QIW67NUcjs.a)})),(c=this._authPromise)==null||c.resolve();return}_chunkK5SDVE5Fcjs.a.error("complete-onboarding: OTP validation failed",{status:t==null?void 0:t.status}),this._needsAuth=!0;let n=(t==null?void 0:t.status)==="error"?t.error:"Failed to validate encrypted OTP",i=new Error(n);throw(u=this._authPromise)==null||u.reject(i),i})}_exportPrivateKey(r){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){yield this.handleAuthRequired();let t=this.getJwtOrThrow(),{scheme:n,encoding:i}=this.getChainKeyParams(),s=yield r.sendAction({event:"request:export-signer",responseEvent:"response:export-signer",data:{authData:{jwt:t,apiKey:this.config.crossmint.apiKey},data:{scheme:n,encoding:i}},options:d});if((s==null?void 0:s.status)==="error")throw new Error(s.error||"Failed to export private key")})}};_chunk2GKPWQBQcjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkK5SDVE5Fcjs.a,methodName:"handleAuthRequired"})],f.prototype,"handleAuthRequired",1);var d={timeoutMs:3e4};exports.a = f; exports.b = d;
@@ -1 +1 @@
1
- import{a as n}from"./chunk-YZDV5F74.js";import{a as s}from"./chunk-6FGJ3ICD.js";import{a as l}from"./chunk-LY5YPRHI.js";import{a,b as i}from"./chunk-IYRVMHRW.js";import{g as r}from"./chunk-J3R36SGJ.js";import{createCrossmint as C}from"@crossmint/common-sdk-base";import{WebAuthnP256 as p}from"ox";var o=class c{constructor(e){i(e.apiKey);let t=new l(e);this.walletFactory=new n(t),a.info("wallets.sdk.initialized")}static from(e){return new c(e)}getWallet(e,t){return r(this,null,function*(){if(typeof e=="string"){if(t==null)throw new Error("Args parameter is required when walletLocator is provided");return yield this.walletFactory.getWallet(e,t)}return yield this.walletFactory.getWallet(e)})}createWallet(e){return r(this,null,function*(){return yield this.walletFactory.createWallet(e)})}createDeviceSigner(e,t){return r(this,null,function*(){return yield s(e,t)})}createPasskeySigner(e){return r(this,null,function*(){let t=yield p.createCredential({name:e});return{type:"passkey",id:t.id,name:e,publicKey:{x:t.publicKey.x.toString(),y:t.publicKey.y.toString()}}})}};export{C as a,o as b};
1
+ import{a as n}from"./chunk-TTUZDIDK.js";import{a as s}from"./chunk-N4IWDL6M.js";import{a as l}from"./chunk-UOKPSLMQ.js";import{a,b as i}from"./chunk-2GHG5OLB.js";import{g as r}from"./chunk-J3R36SGJ.js";import{createCrossmint as C}from"@crossmint/common-sdk-base";import{WebAuthnP256 as p}from"ox";var o=class c{constructor(e){i(e.apiKey);let t=new l(e);this.walletFactory=new n(t),a.info("wallets.sdk.initialized")}static from(e){return new c(e)}getWallet(e,t){return r(this,null,function*(){if(typeof e=="string"){if(t==null)throw new Error("Args parameter is required when walletLocator is provided");return yield this.walletFactory.getWallet(e,t)}return yield this.walletFactory.getWallet(e)})}createWallet(e){return r(this,null,function*(){return yield this.walletFactory.createWallet(e)})}createDeviceSigner(e,t){return r(this,null,function*(){return yield s(e,t)})}createPasskeySigner(e){return r(this,null,function*(){let t=yield p.createCredential({name:e});return{type:"passkey",id:t.id,name:e,publicKey:{x:t.publicKey.x.toString(),y:t.publicKey.y.toString()}}})}};export{C as a,o as b};
@@ -0,0 +1 @@
1
+ import{a as o}from"./chunk-KGBCGBUZ.js";import{b as w}from"./chunk-RBSMBO4T.js";import{a as S}from"./chunk-X7BAYHQI.js";import{l as u,p as g,t as C}from"./chunk-EXC7TCGL.js";import{a as r}from"./chunk-2GHG5OLB.js";import{c as p,g as l}from"./chunk-J3R36SGJ.js";import{createPublicClient as x,encodeFunctionData as E,http as O}from"viem";import{isValidEvmAddress as b,WithLoggerContext as h}from"@crossmint/common-sdk-base";var d=class d extends o{constructor(e){super({chain:e.chain,address:e.address,owner:e.owner,options:o.getOptions(e),alias:e.alias,recovery:o.getRecovery(e),signer:e.signer,signers:o.getInitialSigners(e)},o.getApiClient(e))}static from(e){if(!b(e.address))throw new Error("Wallet is not an EVM wallet");return new d(e)}sendTransaction(e){return l(this,null,function*(){var i;r.info("evmWallet.sendTransaction.start"),yield this.preAuthIfNeeded();let n=this.buildTransaction(e),t=yield this.createTransaction(n,e.options);if((i=e.options)!=null&&i.prepareOnly)return r.info("evmWallet.sendTransaction.prepared",{transactionId:t.id}),{hash:void 0,explorerLink:void 0,transactionId:t.id};let a=yield this.approveTransactionAndWait(t.id);return r.info("evmWallet.sendTransaction.success",{transactionId:t.id,hash:a.hash}),a})}signMessage(e){return l(this,null,function*(){var i;r.info("evmWallet.signMessage.start"),yield this.preAuthIfNeeded();let n=this.requireSigner(),t=yield this.apiClient.createSignature(this.walletLocator,{type:"message",params:{message:e.message,signer:n.locator(),chain:this.chain}});if("error"in t)throw r.error("evmWallet.signMessage.error",{error:t}),new g(JSON.stringify(t));if((i=e.options)!=null&&i.prepareOnly)return r.info("evmWallet.signMessage.prepared",{signatureId:t.id}),{signature:void 0,signatureId:t.id};let a=yield this.approveSignatureAndWait(t.id);return r.info("evmWallet.signMessage.success",{signatureId:t.id}),a})}signTypedData(e){return l(this,null,function*(){var I;r.info("evmWallet.signTypedData.start"),yield this.preAuthIfNeeded();let n=this.requireSigner(),{domain:t,message:a,primaryType:i,types:c,chain:m}=e;if(!t||!a||!c||!m)throw r.error("evmWallet.signTypedData.error",{error:"Invalid typed data"}),new u("Invalid typed data");let{name:T,version:f,chainId:y,verifyingContract:v,salt:D}=t;if(!T||!f||!y||!v)throw r.error("evmWallet.signTypedData.error",{error:"Invalid typed data domain"}),new u("Invalid typed data domain");let s=yield this.apiClient.createSignature(this.walletLocator,{type:"typed-data",params:{typedData:{domain:{name:T,version:f,chainId:Number(y),verifyingContract:v,salt:D},message:a,primaryType:i,types:c},signer:n.locator(),chain:m}});if("error"in s)throw r.error("evmWallet.signTypedData.error",{error:s}),new g(JSON.stringify(s));if((I=e.options)!=null&&I.prepareOnly)return r.info("evmWallet.signTypedData.prepared",{signatureId:s.id}),{signature:void 0,signatureId:s.id};let M=yield this.approveSignatureAndWait(s.id);return r.info("evmWallet.signTypedData.success",{signatureId:s.id}),M})}getViemClient(e){var n;return x({transport:(n=e==null?void 0:e.transport)!=null?n:O(),chain:S(this.chain)})}createTransaction(e,n){return l(this,null,function*(){let t;(n==null?void 0:n.signer)==null?t=this.requireSigner().locator():typeof n.signer=="string"?t=n.signer:t=`server:${w(n.signer,this.chain,this.apiClient.projectId,this.apiClient.environment).derivedAddress}`;let a=yield this.apiClient.createTransaction(this.walletLocator,{params:{signer:t,chain:this.chain,calls:[e]}});if("error"in a)throw new C(JSON.stringify(a));return a})}buildTransaction(e){var n,t,a,i,c;if("transaction"in e)return{transaction:e.transaction};if(e.abi==null)return{to:e.to,value:(t=(n=e.value)==null?void 0:n.toString())!=null?t:"0",data:(a=e.data)!=null?a:"0x"};if(!e.functionName)throw new Error("Function name is required");return{to:e.to,value:(c=(i=e.value)==null?void 0:i.toString())!=null?c:"0",data:E({abi:e.abi,functionName:e.functionName,args:e.args})}}};p([h({logger:r,methodName:"evmWallet.sendTransaction",buildContext(e){return{chain:e.chain,address:e.address}}})],d.prototype,"sendTransaction",1),p([h({logger:r,methodName:"evmWallet.signMessage",buildContext(e){return{chain:e.chain,address:e.address}}})],d.prototype,"signMessage",1),p([h({logger:r,methodName:"evmWallet.signTypedData",buildContext(e){return{chain:e.chain,address:e.address}}})],d.prototype,"signTypedData",1);var W=d;export{W as a};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var n=class{constructor(e,r){this.type="device";this.config=e,this.deviceSignerKeyStorage=r}locator(){return this.config.locator||"device:"}signMessage(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return{signature:yield this.deviceSignerKeyStorage.signMessage(this.config.address,e)}})}signTransaction(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return yield this.signMessage(e)})}};exports.a = n;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var t=class{constructor(e,r){this.type="device";this.config=e,this.deviceSignerKeyStorage=r}locator(){return this.config.locator||"device:"}signMessage(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return{signature:yield this.deviceSignerKeyStorage.signMessage(this.config.address,e)}})}signTransaction(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return yield this.signMessage(e)})}};exports.a = t;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkGZP2JQ6Pcjs = require('./chunk-GZP2JQ6P.cjs');var _chunkSGQ75PW5cjs = require('./chunk-SGQ75PW5.cjs');var _chunkJXNZMD5Wcjs = require('./chunk-JXNZMD5W.cjs');var _chunk7V3D66VWcjs = require('./chunk-7V3D66VW.cjs');var _chunkSPTXAOFRcjs = require('./chunk-SPTXAOFR.cjs');var _chunkGEY3BU62cjs = require('./chunk-GEY3BU62.cjs');var _chunkPHPBBEXUcjs = require('./chunk-PHPBBEXU.cjs');var _chunkA33BEWR7cjs = require('./chunk-A33BEWR7.cjs');var _chunkOGP7B5O3cjs = require('./chunk-OGP7B5O3.cjs');var _chunkIJ632UXDcjs = require('./chunk-IJ632UXD.cjs');var _chunk6EZCCLTKcjs = require('./chunk-6EZCCLTK.cjs');var _chunkT3U46LK3cjs = require('./chunk-T3U46LK3.cjs');function M(r,e,n){switch(e.type){case"email":case"phone":return r==="solana"?new (0, _chunk7V3D66VWcjs.a)(e):r==="stellar"?new (0, _chunkSGQ75PW5cjs.a)(e):new (0, _chunkJXNZMD5Wcjs.a)(e);case"api-key":return r==="solana"?new (0, _chunkIJ632UXDcjs.a)(e):new (0, _chunkPHPBBEXUcjs.a)(e);case"external-wallet":return r==="solana"?new (0, _chunk6EZCCLTKcjs.a)(e):r==="stellar"?new (0, _chunkSPTXAOFRcjs.a)(e):new (0, _chunkA33BEWR7cjs.a)(e);case"server":return _chunkGZP2JQ6Pcjs.a.call(void 0, r,e);case"passkey":return new (0, _chunkOGP7B5O3cjs.a)(e);case"device":if(n==null)throw new (0, _chunkT3U46LK3cjs.g)("Device signer key storage is required for device signers");return new (0, _chunkGEY3BU62cjs.a)(e,n)}}exports.a = M;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkENU3EKBGcjs = require('./chunk-ENU3EKBG.cjs');var _chunkW5EH3HYFcjs = require('./chunk-W5EH3HYF.cjs');var _chunk7VUOD7EIcjs = require('./chunk-7VUOD7EI.cjs');var _chunkYF5G4U6Lcjs = require('./chunk-YF5G4U6L.cjs');function l(a,e){switch(_chunkENU3EKBGcjs.a.call(void 0, a)){case"evm":return new (0, _chunkW5EH3HYFcjs.a)(e);case"solana":return new (0, _chunk7VUOD7EIcjs.a)(e);case"stellar":return new (0, _chunkYF5G4U6Lcjs.a)(e)}}exports.a = l;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkENU3EKBGcjs = require('./chunk-ENU3EKBG.cjs');var _chunk3SVXPFSPcjs = require('./chunk-3SVXPFSP.cjs');var _chunk4DJWSV7Icjs = require('./chunk-4DJWSV7I.cjs');var _chunkYF5G4U6Lcjs = require('./chunk-YF5G4U6L.cjs');function l(a,e){switch(_chunkENU3EKBGcjs.a.call(void 0, a)){case"evm":return new (0, _chunk3SVXPFSPcjs.a)(e);case"solana":return new (0, _chunk4DJWSV7Icjs.a)(e);case"stellar":return new (0, _chunkYF5G4U6Lcjs.a)(e)}}exports.a = l;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkZB35EKCScjs = require('./chunk-ZB35EKCS.cjs');var _chunkLZNQBJEKcjs = require('./chunk-LZNQBJEK.cjs');var _chunkITNNPNZLcjs = require('./chunk-ITNNPNZL.cjs');var _chunkU2AHGQVYcjs = require('./chunk-U2AHGQVY.cjs');var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var _ox = require('ox');var o=class c{constructor(e){_chunkU2AHGQVYcjs.b.call(void 0, e.apiKey);let t=new (0, _chunkITNNPNZLcjs.a)(e);this.walletFactory=new (0, _chunkZB35EKCScjs.a)(t),_chunkU2AHGQVYcjs.a.info("wallets.sdk.initialized")}static from(e){return new c(e)}getWallet(e,t){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){if(typeof e=="string"){if(t==null)throw new Error("Args parameter is required when walletLocator is provided");return yield this.walletFactory.getWallet(e,t)}return yield this.walletFactory.getWallet(e)})}createWallet(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return yield this.walletFactory.createWallet(e)})}createDeviceSigner(e,t){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return yield _chunkLZNQBJEKcjs.a.call(void 0, e,t)})}createPasskeySigner(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let t=yield _ox.WebAuthnP256.createCredential({name:e});return{type:"passkey",id:t.id,name:e,publicKey:{x:t.publicKey.x.toString(),y:t.publicKey.y.toString()}}})}};exports.a = _commonsdkbase.createCrossmint; exports.b = o;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkCZ2D3WARcjs = require('./chunk-CZ2D3WAR.cjs');var _chunkYHV3672Rcjs = require('./chunk-YHV3672R.cjs');var _chunkZ42FAU67cjs = require('./chunk-Z42FAU67.cjs');var _chunkK5SDVE5Fcjs = require('./chunk-K5SDVE5F.cjs');var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var _ox = require('ox');var o=class c{constructor(e){_chunkK5SDVE5Fcjs.b.call(void 0, e.apiKey);let t=new (0, _chunkZ42FAU67cjs.a)(e);this.walletFactory=new (0, _chunkCZ2D3WARcjs.a)(t),_chunkK5SDVE5Fcjs.a.info("wallets.sdk.initialized")}static from(e){return new c(e)}getWallet(e,t){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){if(typeof e=="string"){if(t==null)throw new Error("Args parameter is required when walletLocator is provided");return yield this.walletFactory.getWallet(e,t)}return yield this.walletFactory.getWallet(e)})}createWallet(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return yield this.walletFactory.createWallet(e)})}createDeviceSigner(e,t){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return yield _chunkYHV3672Rcjs.a.call(void 0, e,t)})}createPasskeySigner(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let t=yield _ox.WebAuthnP256.createCredential({name:e});return{type:"passkey",id:t.id,name:e,publicKey:{x:t.publicKey.x.toString(),y:t.publicKey.y.toString()}}})}};exports.a = _commonsdkbase.createCrossmint; exports.b = o;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var n=class{constructor(t){this.config=t;this.type="api-key"}locator(){return this.config.locator}signMessage(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return yield Promise.reject(new Error("API key signers do not support direct message signing - signatures are handled automatically by the backend"))})}signTransaction(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return yield Promise.reject(new Error("API key signers do not support direct transaction signing - transaction are handled automatically by the backend"))})}};exports.a = n;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var r=class{constructor(t){this.config=t;this.type="api-key"}locator(){return this.config.locator}signMessage(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return yield Promise.reject(new Error("API key signers do not support direct message signing - signatures are handled automatically by the backend"))})}signTransaction(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return yield Promise.reject(new Error("API key signers do not support direct transaction signing - transaction are handled automatically by the backend"))})}};exports.a = r;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkNJEW3A4Jcjs = require('./chunk-NJEW3A4J.cjs');var _chunkU2AHGQVYcjs = require('./chunk-U2AHGQVY.cjs');var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var _ox = require('ox');var _viem = require('viem');var c=class p extends _chunkNJEW3A4Jcjs.a{constructor(e){super(e)}signMessage(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let i=_viem.isHex.call(void 0, e)?e:_viem.toHex.call(void 0, e),r=_ox.PersonalMessage.getSignPayload(i);return yield this.sign(r)})}signTransaction(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return yield this.sign(e)})}sign(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var o;yield this.handleAuthRequired();let i=this.getJwtOrThrow(),r=e.replace("0x","");_chunkU2AHGQVYcjs.a.info("sign: sending request",{keyType:"secp256k1"});let y=Date.now(),n=yield(o=this.config.clientTEEConnection)==null?void 0:o.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:i,apiKey:this.config.crossmint.apiKey},data:{keyType:"secp256k1",bytes:r,encoding:"hex"}},options:_chunkNJEW3A4Jcjs.b});if(_chunkU2AHGQVYcjs.a.info("sign: response received",{status:n==null?void 0:n.status,durationMs:Date.now()-y}),(n==null?void 0:n.status)==="error")throw new Error(n.error);if((n==null?void 0:n.signature)==null)throw new Error("Failed to sign transaction");return p.verifyPublicKeyFormat(n.publicKey),{signature:n.signature.bytes}})}static verifyPublicKeyFormat(e){if(e==null)throw new Error("No public key found");if(e.encoding!=="hex"||e.keyType!=="secp256k1"||e.bytes==null)throw new Error("Not supported. Expected public key to be in hex encoding and secp256k1 key type. Got: "+JSON.stringify(e))}getChainKeyParams(){return{scheme:"secp256k1",encoding:"hex"}}};exports.a = c;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkE54SDHZVcjs = require('./chunk-E54SDHZV.cjs');var _chunkK5SDVE5Fcjs = require('./chunk-K5SDVE5F.cjs');var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var _ox = require('ox');var _viem = require('viem');var c=class p extends _chunkE54SDHZVcjs.a{constructor(e){super(e)}signMessage(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let i=_viem.isHex.call(void 0, e)?e:_viem.toHex.call(void 0, e),r=_ox.PersonalMessage.getSignPayload(i);return yield this.sign(r)})}signTransaction(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return yield this.sign(e)})}sign(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var o;yield this.handleAuthRequired();let i=this.getJwtOrThrow(),r=e.replace("0x","");_chunkK5SDVE5Fcjs.a.info("sign: sending request",{keyType:"secp256k1"});let y=Date.now(),n=yield(o=this.config.clientTEEConnection)==null?void 0:o.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:i,apiKey:this.config.crossmint.apiKey},data:{keyType:"secp256k1",bytes:r,encoding:"hex"}},options:_chunkE54SDHZVcjs.b});if(_chunkK5SDVE5Fcjs.a.info("sign: response received",{status:n==null?void 0:n.status,durationMs:Date.now()-y}),(n==null?void 0:n.status)==="error")throw new Error(n.error);if((n==null?void 0:n.signature)==null)throw new Error("Failed to sign transaction");return p.verifyPublicKeyFormat(n.publicKey),{signature:n.signature.bytes}})}static verifyPublicKeyFormat(e){if(e==null)throw new Error("No public key found");if(e.encoding!=="hex"||e.keyType!=="secp256k1"||e.bytes==null)throw new Error("Not supported. Expected public key to be in hex encoding and secp256k1 key type. Got: "+JSON.stringify(e))}getChainKeyParams(){return{scheme:"secp256k1",encoding:"hex"}}};exports.a = c;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkN57ARKT3cjs = require('./chunk-N57ARKT3.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var t=new _commonsdkbase.SdkLogger;function v(s){let o=_commonsdkbase.detectPlatform.call(void 0, ),e=_commonsdkbase.validateAPIKey.call(void 0, s);if(!e.isValid)throw new Error(`Invalid API key: ${e.message}`);let{environment:a,projectId:c}=e;switch(t.init({packageName:_chunkN57ARKT3cjs.c,packageVersion:_chunkN57ARKT3cjs.b,environment:a,projectId:c,platform:o}),o){case"browser":{let r=new (0, _commonsdkbase.BrowserDatadogSink)(a);t.addSink(r);break}case"react-native":break;case"server":{let r=new (0, _commonsdkbase.ServerDatadogSink)(a);t.addSink(r);break}default:break}}exports.a = t; exports.b = v;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkRKTFURXXcjs = require('./chunk-RKTFURXX.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var t=new _commonsdkbase.SdkLogger;function v(s){let o=_commonsdkbase.detectPlatform.call(void 0, ),e=_commonsdkbase.validateAPIKey.call(void 0, s);if(!e.isValid)throw new Error(`Invalid API key: ${e.message}`);let{environment:a,projectId:c}=e;switch(t.init({packageName:_chunkRKTFURXXcjs.c,packageVersion:_chunkRKTFURXXcjs.b,environment:a,projectId:c,platform:o}),o){case"browser":{let r=new (0, _commonsdkbase.BrowserDatadogSink)(a);t.addSink(r);break}case"react-native":break;case"server":{let r=new (0, _commonsdkbase.ServerDatadogSink)(a);t.addSink(r);break}default:break}}exports.a = t; exports.b = v;