@crossmint/wallets-sdk 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) 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.d.cts +1 -1
  19. package/dist/chains/chains.d.ts +1 -1
  20. package/dist/chains/chains.js +1 -1
  21. package/dist/chunk-2323NR6Y.js +1 -0
  22. package/dist/{chunk-XEL7JKRY.js → chunk-3LXCIVWG.js} +1 -1
  23. package/dist/{chunk-6HOOT6LH.js → chunk-5DINTXSM.js} +1 -1
  24. package/dist/{chunk-EIRVLXOC.js → chunk-63CDDON3.js} +1 -1
  25. package/dist/{chunk-BAUUDBGT.js → chunk-6G4BWXEJ.js} +1 -1
  26. package/dist/{chunk-XCIS2OND.js → chunk-6TNAINPL.js} +1 -1
  27. package/dist/{chunk-J4XCFNQH.js → chunk-7DFXMYKM.js} +1 -1
  28. package/dist/{chunk-JFG54X5X.cjs → chunk-7M7XEKZE.cjs} +1 -1
  29. package/dist/chunk-AGN3B4GS.cjs +1 -0
  30. package/dist/{chunk-SI4L3UZ4.cjs → chunk-AJVO7VQY.cjs} +1 -1
  31. package/dist/{chunk-4GHTG2VD.js → chunk-BUC3VNP4.js} +1 -1
  32. package/dist/{chunk-UBDPBFAR.js → chunk-CHX7PG2J.js} +1 -1
  33. package/dist/chunk-EHMQ5WD7.cjs +1 -0
  34. package/dist/{chunk-ZH3WV7OE.js → chunk-EZOZZFCU.js} +1 -1
  35. package/dist/chunk-FLYEGDDE.js +3 -0
  36. package/dist/{chunk-BTMBO7VM.cjs → chunk-HF4IRNP6.cjs} +2 -2
  37. package/dist/{chunk-RWQ6ZQST.js → chunk-HVBMGZ2A.js} +1 -1
  38. package/dist/{chunk-F2HEHICC.cjs → chunk-N3P3SQ33.cjs} +1 -1
  39. package/dist/{chunk-A3J3367O.cjs → chunk-N7GVWKC7.cjs} +1 -1
  40. package/dist/{chunk-RLBY6JO3.cjs → chunk-OIEGMYEU.cjs} +1 -1
  41. package/dist/{chunk-PG7BGWKX.js → chunk-OWGOD5IM.js} +1 -1
  42. package/dist/{chunk-WUNTNM5R.cjs → chunk-OY2LMC4Y.cjs} +1 -1
  43. package/dist/{chunk-BI3AUJVK.cjs → chunk-PIJQUMGJ.cjs} +1 -1
  44. package/dist/chunk-PYIURK5B.js +1 -0
  45. package/dist/chunk-QJ54STYO.js +1 -0
  46. package/dist/chunk-RMXZH6CG.js +1 -0
  47. package/dist/chunk-SDVBLX5J.cjs +1 -0
  48. package/dist/{chunk-4GEG5JA6.js → chunk-SGGIB3UV.js} +1 -1
  49. package/dist/{chunk-4LXI2OQW.cjs → chunk-TENHJ7EH.cjs} +1 -1
  50. package/dist/{chunk-X7E2YEIV.cjs → chunk-TQCD2GOR.cjs} +1 -1
  51. package/dist/{chunk-KW2623VI.cjs → chunk-X6TSCK75.cjs} +1 -1
  52. package/dist/{chunk-CFB27BFV.cjs → chunk-XDHGCS4W.cjs} +1 -1
  53. package/dist/{chunk-AET7QPSV.cjs → chunk-YWTJTAIU.cjs} +1 -1
  54. package/dist/{chunk-52I473WC.cjs → chunk-ZAAS2UOD.cjs} +1 -1
  55. package/dist/index.cjs +1 -1
  56. package/dist/index.d.cts +1 -1
  57. package/dist/index.d.ts +1 -1
  58. package/dist/index.js +1 -1
  59. package/dist/logger/index.cjs +1 -1
  60. package/dist/logger/index.js +1 -1
  61. package/dist/logger/init.cjs +1 -1
  62. package/dist/logger/init.js +1 -1
  63. package/dist/sdk.cjs +1 -1
  64. package/dist/sdk.d.cts +1 -1
  65. package/dist/sdk.d.ts +1 -1
  66. package/dist/sdk.js +1 -1
  67. package/dist/signers/device.d.cts +1 -1
  68. package/dist/signers/device.d.ts +1 -1
  69. package/dist/signers/evm-api-key.d.cts +1 -1
  70. package/dist/signers/evm-api-key.d.ts +1 -1
  71. package/dist/signers/evm-external-wallet.d.cts +1 -1
  72. package/dist/signers/evm-external-wallet.d.ts +1 -1
  73. package/dist/signers/external-wallet-signer.d.cts +1 -1
  74. package/dist/signers/external-wallet-signer.d.ts +1 -1
  75. package/dist/signers/index.cjs +1 -1
  76. package/dist/signers/index.d.cts +1 -1
  77. package/dist/signers/index.d.ts +1 -1
  78. package/dist/signers/index.js +1 -1
  79. package/dist/signers/non-custodial/index.cjs +1 -1
  80. package/dist/signers/non-custodial/index.d.cts +1 -1
  81. package/dist/signers/non-custodial/index.d.ts +1 -1
  82. package/dist/signers/non-custodial/index.js +1 -1
  83. package/dist/signers/non-custodial/ncs-evm-signer.cjs +1 -1
  84. package/dist/signers/non-custodial/ncs-evm-signer.d.cts +1 -1
  85. package/dist/signers/non-custodial/ncs-evm-signer.d.ts +1 -1
  86. package/dist/signers/non-custodial/ncs-evm-signer.js +1 -1
  87. package/dist/signers/non-custodial/ncs-signer.cjs +1 -1
  88. package/dist/signers/non-custodial/ncs-signer.d.cts +1 -1
  89. package/dist/signers/non-custodial/ncs-signer.d.ts +1 -1
  90. package/dist/signers/non-custodial/ncs-signer.js +1 -1
  91. package/dist/signers/non-custodial/ncs-solana-signer.cjs +1 -1
  92. package/dist/signers/non-custodial/ncs-solana-signer.d.cts +1 -1
  93. package/dist/signers/non-custodial/ncs-solana-signer.d.ts +1 -1
  94. package/dist/signers/non-custodial/ncs-solana-signer.js +1 -1
  95. package/dist/signers/non-custodial/ncs-stellar-signer.cjs +1 -1
  96. package/dist/signers/non-custodial/ncs-stellar-signer.d.cts +1 -1
  97. package/dist/signers/non-custodial/ncs-stellar-signer.d.ts +1 -1
  98. package/dist/signers/non-custodial/ncs-stellar-signer.js +1 -1
  99. package/dist/signers/passkey.d.cts +1 -1
  100. package/dist/signers/passkey.d.ts +1 -1
  101. package/dist/signers/server/assemble-server-signer.d.cts +1 -1
  102. package/dist/signers/server/assemble-server-signer.d.ts +1 -1
  103. package/dist/signers/server/evm-server-signer.d.cts +1 -1
  104. package/dist/signers/server/evm-server-signer.d.ts +1 -1
  105. package/dist/signers/server/helpers/derive-server-signer.d.cts +1 -1
  106. package/dist/signers/server/helpers/derive-server-signer.d.ts +1 -1
  107. package/dist/signers/server/helpers/index.d.cts +1 -1
  108. package/dist/signers/server/helpers/index.d.ts +1 -1
  109. package/dist/signers/server/index.d.cts +1 -1
  110. package/dist/signers/server/index.d.ts +1 -1
  111. package/dist/signers/server/solana-server-signer.d.cts +1 -1
  112. package/dist/signers/server/solana-server-signer.d.ts +1 -1
  113. package/dist/signers/server/stellar-server-signer.d.cts +1 -1
  114. package/dist/signers/server/stellar-server-signer.d.ts +1 -1
  115. package/dist/signers/solana-api-key.d.cts +1 -1
  116. package/dist/signers/solana-api-key.d.ts +1 -1
  117. package/dist/signers/solana-external-wallet.d.cts +1 -1
  118. package/dist/signers/solana-external-wallet.d.ts +1 -1
  119. package/dist/signers/stellar-external-wallet.d.cts +1 -1
  120. package/dist/signers/stellar-external-wallet.d.ts +1 -1
  121. package/dist/signers/types.cjs +1 -1
  122. package/dist/signers/types.d.cts +1 -1
  123. package/dist/signers/types.d.ts +1 -1
  124. package/dist/signers/types.js +1 -1
  125. package/dist/{types-CRMCeDuN.d.ts → types-Br5La8FI.d.ts} +5 -1
  126. package/dist/{types-5kZcVs3E.d.cts → types-Cc0Mr7mS.d.cts} +5 -1
  127. package/dist/utils/constants.cjs +1 -1
  128. package/dist/utils/constants.js +1 -1
  129. package/dist/utils/device-signers/IframeDeviceSignerKeyStorage.cjs +1 -1
  130. package/dist/utils/device-signers/IframeDeviceSignerKeyStorage.js +1 -1
  131. package/dist/utils/device-signers/createDeviceSigner.d.cts +1 -1
  132. package/dist/utils/device-signers/createDeviceSigner.d.ts +1 -1
  133. package/dist/utils/device-signers/index.cjs +1 -1
  134. package/dist/utils/device-signers/index.d.cts +1 -1
  135. package/dist/utils/device-signers/index.d.ts +1 -1
  136. package/dist/utils/device-signers/index.js +1 -1
  137. package/dist/utils/signer-locator.d.cts +1 -1
  138. package/dist/utils/signer-locator.d.ts +1 -1
  139. package/dist/utils/signer-mapping.d.cts +1 -1
  140. package/dist/utils/signer-mapping.d.ts +1 -1
  141. package/dist/wallets/__tests__/test-helpers.cjs +1 -1
  142. package/dist/wallets/__tests__/test-helpers.d.cts +1 -1
  143. package/dist/wallets/__tests__/test-helpers.d.ts +1 -1
  144. package/dist/wallets/__tests__/test-helpers.js +1 -1
  145. package/dist/wallets/evm.cjs +1 -1
  146. package/dist/wallets/evm.d.cts +1 -1
  147. package/dist/wallets/evm.d.ts +1 -1
  148. package/dist/wallets/evm.js +1 -1
  149. package/dist/wallets/solana.cjs +1 -1
  150. package/dist/wallets/solana.d.cts +1 -1
  151. package/dist/wallets/solana.d.ts +1 -1
  152. package/dist/wallets/solana.js +1 -1
  153. package/dist/wallets/stellar.cjs +1 -1
  154. package/dist/wallets/stellar.d.cts +1 -1
  155. package/dist/wallets/stellar.d.ts +1 -1
  156. package/dist/wallets/stellar.js +1 -1
  157. package/dist/wallets/types.d.cts +1 -1
  158. package/dist/wallets/types.d.ts +1 -1
  159. package/dist/wallets/wallet-factory.cjs +1 -1
  160. package/dist/wallets/wallet-factory.d.cts +1 -1
  161. package/dist/wallets/wallet-factory.d.ts +1 -1
  162. package/dist/wallets/wallet-factory.js +1 -1
  163. package/dist/wallets/wallet.cjs +1 -1
  164. package/dist/wallets/wallet.d.cts +1 -1
  165. package/dist/wallets/wallet.d.ts +1 -1
  166. package/dist/wallets/wallet.js +1 -1
  167. package/package.json +2 -2
  168. package/dist/chunk-6RX65NOA.js +0 -1
  169. package/dist/chunk-AAUS7KTR.cjs +0 -1
  170. package/dist/chunk-AS2YN2YC.cjs +0 -1
  171. package/dist/chunk-FXCUVWXJ.js +0 -1
  172. package/dist/chunk-QQ46JY33.js +0 -1
  173. package/dist/chunk-XX6FO5QS.js +0 -1
  174. package/dist/chunk-YSB7XIS7.js +0 -3
  175. package/dist/chunk-YYFLQQPV.cjs +0 -1
@@ -1,4 +1,4 @@
1
- import { aa as WalletLocator } from '../../types-5kZcVs3E.cjs';
1
+ import { ac as WalletLocator } from '../../types-Cc0Mr7mS.cjs';
2
2
  import 'viem';
3
3
  import '../gen/types.gen.cjs';
4
4
  import 'ox';
@@ -1,4 +1,4 @@
1
- import { aa as WalletLocator } from '../../types-CRMCeDuN.js';
1
+ import { ac as WalletLocator } from '../../types-Br5La8FI.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 _chunkF2HEHICCcjs = require('../../chunk-F2HEHICC.cjs');require('../../chunk-OWQZPI3U.cjs');require('../../chunk-CFB27BFV.cjs');require('../../chunk-X7E2YEIV.cjs');var _chunk2GKPWQBQcjs = require('../../chunk-2GKPWQBQ.cjs');var _vitest = require('vitest');var P=({data:e,status:t=200,ok:n=!0,statusText:s="OK"})=>({json:_vitest.vi.fn().mockResolvedValue(e),ok:n,status:t,statusText:s}),j= exports.createMockSuccessResponse =e=>P({data:e}),b= exports.createMockErrorResponse =(e,t=400,n="Bad Request")=>P({data:e,status:t,ok:!1,statusText:n}),B= exports.createMockCrossmint =(e={})=>{let t=_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, _chunkF2HEHICCcjs.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(b(n,s));let a=yield e();_vitest.expect.call(void 0, l(a)).toBe(!0),l(a)&&(_vitest.expect.call(void 0, a.error).toBe(!0),n.message&&_vitest.expect.call(void 0, a.message).toBe(n.message))}),Z= exports.testCommonHttpErrors =(s,a,...o)=>_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 u={error:!0,message:g};t.mockResolvedValueOnce(b(u,c));let m=yield e();_vitest.expect.call(void 0, l(m)).toBe(!0)}}),Q= exports.testNetworkError =(e,t)=>_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 l(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error===!0}function C(e){return typeof e=="object"&&e!==null&&"address"in e&&"chainType"in e&&"type"in e}function $(e){return typeof e=="object"&&e!==null&&"id"in e&&"status"in e&&"chainType"in e}var x=e=>new Promise(t=>setTimeout(t,e)),re= exports.isValidEthereumAddress =e=>/^0x[a-fA-F0-9]{40}$/.test(e),ae= exports.isValidSolanaAddress =e=>/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(e),ie= exports.createIntegrationApiClient =(e,t,n={})=>{let s=_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, _chunkF2HEHICCcjs.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:u="default"}=n,m=g||`userId:integration-${u}-${Date.now()}`,f=yield e.createWallet(_chunk2GKPWQBQcjs.a.call(void 0, {chainType:o,type:c},g&&{owner:m}));if(C(f))return t.addWallet(f.address),f.address})}function pe(e,t,n){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let s=yield e.createWallet(n);return C(s)&&t.addWallet(s.address),s})}function le(e,t){_vitest.expect.call(void 0, l(e)).toBe(!0),t&&_vitest.expect.call(void 0, e.message).toBeDefined()}function ue(e){_vitest.expect.call(void 0, C(e)).toBe(!0)}function de(e){_vitest.expect.call(void 0, $(e)).toBe(!0)}var I=(e,t,n,s="usdxm",a="base-sepolia")=>_chunk2GKPWQBQcjs.g.call(void 0, void 0,null,function*(){let o={amount:n,token:s,chain:a},c=yield e.fundWallet(t,o);if(l(c))throw new Error(`Failed to fund wallet: ${c.message||"Unknown error"}`);return yield x(_chunkJ33QM2IDcjs.i),c}),U= exports.approveTransaction =(a,o,c,...g)=>_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(l(d))throw new Error(`Transaction not found: ${d.message||"Unknown error"}`);if("status"in d&&(d.status==="success"||d.status==="failed"))return d;let T="approvals"in d?(m=d.approvals)==null?void 0:m.pending:void 0;if(T&&T.length>0){let O={approvals:T.map(_=>({signer:_.signer.locator,signature:""}))},h=yield e.approveTransaction(t,n,O);if(l(h))throw new Error(`Failed to approve transaction: ${h.message||"Unknown error"}`);yield x(_chunkJ33QM2IDcjs.j);continue}yield x(_chunkJ33QM2IDcjs.i)}let u=yield e.getTransaction(t,n);if(l(u))throw new Error(`Transaction not found after retries: ${u.message||"Unknown error"}`);if(!("status"in u))throw new Error("Transaction response missing status property");return u}),me= exports.fundWalletAndWait =(e,t,n=1,s="usdxm",a="base-sepolia")=>_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(l(o))throw new Error(`Failed to send token: ${o.message||"Unknown error"}`);if(typeof o=="object"&&o!==null&&"id"in o&&typeof o.id=="string")return U(e,t,o.id);throw new Error("Transaction ID not found in send response")}),ge= exports.ensureWalletFunded =(e,t,n=1,s="usdxm",a="base-sepolia")=>_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 = b; exports.createMockResponse = P; exports.createMockSendResponse = oe; exports.createMockSuccessResponse = j; exports.createMockWalletResponse = se; exports.createServerSideApiClient = K; exports.createTestApiClient = L; exports.createTestWallet = pe; exports.delay = x; exports.ensureWalletExists = ce; exports.ensureWalletFunded = ge; exports.expectCommonHeaders = V; exports.expectErrorResponse = le; exports.expectRequestBody = q; exports.expectRequestPath = N; exports.expectSuccessTransactionResponse = de; exports.expectSuccessWalletResponse = ue; exports.extractFetchCall = Y; exports.fundWallet = I; exports.fundWalletAndWait = me; exports.isErrorResponse = l; exports.isSuccessTransactionResponse = $; exports.isSuccessWalletResponse = C; exports.isValidEthereumAddress = re; exports.isValidSolanaAddress = ae; exports.sendTokenAndApprove = fe; exports.testCommonHttpErrors = Z; exports.testHttpErrorResponse = X; exports.testInvalidJsonResponse = ee; exports.testMalformedResponse = ne; exports.testNetworkError = Q; exports.testTimeoutError = te; exports.validateRequest = z;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkJ33QM2IDcjs = require('../../chunk-J33QM2ID.cjs');var _chunkN3P3SQ33cjs = require('../../chunk-N3P3SQ33.cjs');require('../../chunk-OWQZPI3U.cjs');require('../../chunk-XDHGCS4W.cjs');require('../../chunk-TQCD2GOR.cjs');var _chunk2GKPWQBQcjs = require('../../chunk-2GKPWQBQ.cjs');var _vitest = require('vitest');var P=({data:e,status:t=200,ok:n=!0,statusText:s="OK"})=>({json:_vitest.vi.fn().mockResolvedValue(e),ok:n,status:t,statusText:s}),j= exports.createMockSuccessResponse =e=>P({data:e}),b= exports.createMockErrorResponse =(e,t=400,n="Bad Request")=>P({data:e,status:t,ok:!1,statusText:n}),B= exports.createMockCrossmint =(e={})=>{let t=_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, _chunkN3P3SQ33cjs.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(b(n,s));let a=yield e();_vitest.expect.call(void 0, l(a)).toBe(!0),l(a)&&(_vitest.expect.call(void 0, a.error).toBe(!0),n.message&&_vitest.expect.call(void 0, a.message).toBe(n.message))}),Z= exports.testCommonHttpErrors =(s,a,...o)=>_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 u={error:!0,message:g};t.mockResolvedValueOnce(b(u,c));let m=yield e();_vitest.expect.call(void 0, l(m)).toBe(!0)}}),Q= exports.testNetworkError =(e,t)=>_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 l(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error===!0}function C(e){return typeof e=="object"&&e!==null&&"address"in e&&"chainType"in e&&"type"in e}function $(e){return typeof e=="object"&&e!==null&&"id"in e&&"status"in e&&"chainType"in e}var x=e=>new Promise(t=>setTimeout(t,e)),re= exports.isValidEthereumAddress =e=>/^0x[a-fA-F0-9]{40}$/.test(e),ae= exports.isValidSolanaAddress =e=>/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(e),ie= exports.createIntegrationApiClient =(e,t,n={})=>{let s=_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, _chunkN3P3SQ33cjs.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:u="default"}=n,m=g||`userId:integration-${u}-${Date.now()}`,f=yield e.createWallet(_chunk2GKPWQBQcjs.a.call(void 0, {chainType:o,type:c},g&&{owner:m}));if(C(f))return t.addWallet(f.address),f.address})}function pe(e,t,n){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let s=yield e.createWallet(n);return C(s)&&t.addWallet(s.address),s})}function le(e,t){_vitest.expect.call(void 0, l(e)).toBe(!0),t&&_vitest.expect.call(void 0, e.message).toBeDefined()}function ue(e){_vitest.expect.call(void 0, C(e)).toBe(!0)}function de(e){_vitest.expect.call(void 0, $(e)).toBe(!0)}var I=(e,t,n,s="usdxm",a="base-sepolia")=>_chunk2GKPWQBQcjs.g.call(void 0, void 0,null,function*(){let o={amount:n,token:s,chain:a},c=yield e.fundWallet(t,o);if(l(c))throw new Error(`Failed to fund wallet: ${c.message||"Unknown error"}`);return yield x(_chunkJ33QM2IDcjs.i),c}),U= exports.approveTransaction =(a,o,c,...g)=>_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(l(d))throw new Error(`Transaction not found: ${d.message||"Unknown error"}`);if("status"in d&&(d.status==="success"||d.status==="failed"))return d;let T="approvals"in d?(m=d.approvals)==null?void 0:m.pending:void 0;if(T&&T.length>0){let O={approvals:T.map(_=>({signer:_.signer.locator,signature:""}))},h=yield e.approveTransaction(t,n,O);if(l(h))throw new Error(`Failed to approve transaction: ${h.message||"Unknown error"}`);yield x(_chunkJ33QM2IDcjs.j);continue}yield x(_chunkJ33QM2IDcjs.i)}let u=yield e.getTransaction(t,n);if(l(u))throw new Error(`Transaction not found after retries: ${u.message||"Unknown error"}`);if(!("status"in u))throw new Error("Transaction response missing status property");return u}),me= exports.fundWalletAndWait =(e,t,n=1,s="usdxm",a="base-sepolia")=>_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(l(o))throw new Error(`Failed to send token: ${o.message||"Unknown error"}`);if(typeof o=="object"&&o!==null&&"id"in o&&typeof o.id=="string")return U(e,t,o.id);throw new Error("Transaction ID not found in send response")}),ge= exports.ensureWalletFunded =(e,t,n=1,s="usdxm",a="base-sepolia")=>_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 = b; exports.createMockResponse = P; exports.createMockSendResponse = oe; exports.createMockSuccessResponse = j; exports.createMockWalletResponse = se; exports.createServerSideApiClient = K; exports.createTestApiClient = L; exports.createTestWallet = pe; exports.delay = x; exports.ensureWalletExists = ce; exports.ensureWalletFunded = ge; exports.expectCommonHeaders = V; exports.expectErrorResponse = le; exports.expectRequestBody = q; exports.expectRequestPath = N; exports.expectSuccessTransactionResponse = de; exports.expectSuccessWalletResponse = ue; exports.extractFetchCall = Y; exports.fundWallet = I; exports.fundWalletAndWait = me; exports.isErrorResponse = l; exports.isSuccessTransactionResponse = $; exports.isSuccessWalletResponse = C; exports.isValidEthereumAddress = re; exports.isValidSolanaAddress = ae; exports.sendTokenAndApprove = fe; exports.testCommonHttpErrors = Z; exports.testHttpErrorResponse = X; exports.testInvalidJsonResponse = ee; exports.testMalformedResponse = ne; exports.testNetworkError = Q; exports.testTimeoutError = te; exports.validateRequest = z;
@@ -1,7 +1,7 @@
1
1
  import { MockedFunction } from 'vitest';
2
2
  import { Crossmint } from '@crossmint/common-sdk-base';
3
3
  import { ApiClient } from '../client.cjs';
4
- import { aa as WalletLocator, ac as GetTransactionResponse, ad as SendResponse, ae as CreateWalletResponse, af as CreateWalletParams, a2 as FundWalletResponse } from '../../types-5kZcVs3E.cjs';
4
+ import { ac as WalletLocator, ae as GetTransactionResponse, af as SendResponse, ag as CreateWalletResponse, ah as CreateWalletParams, a4 as FundWalletResponse } from '../../types-Cc0Mr7mS.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 { aa as WalletLocator, ac as GetTransactionResponse, ad as SendResponse, ae as CreateWalletResponse, af as CreateWalletParams, a2 as FundWalletResponse } from '../../types-CRMCeDuN.js';
4
+ import { ac as WalletLocator, ae as GetTransactionResponse, af as SendResponse, ag as CreateWalletResponse, ah as CreateWalletParams, a4 as FundWalletResponse } from '../../types-Br5La8FI.js';
5
5
  import '../../chains/chains.js';
6
6
  import 'viem';
7
7
  import '../gen/types.gen.js';
@@ -1 +1 @@
1
- import{a as A,b as F,i as R,j as W,k as E,l as M,m as S}from"../../chunk-DIGDDKSF.js";import{a as w}from"../../chunk-XCIS2OND.js";import"../../chunk-5OYPWGMX.js";import"../../chunk-UBDPBFAR.js";import"../../chunk-XX6FO5QS.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 P=({data:e,status:t=200,ok:n=!0,statusText:s="OK"})=>({json:y.fn().mockResolvedValue(e),ok:n,status:t,statusText:s}),j=e=>P({data:e}),b=(e,t=400,n="Bad Request")=>P({data:e,status:t,ok:!1,statusText:n}),B=(e={})=>{let t=p({apiKey:S},e);return k(p({},t),{setJwt:y.fn().mockReturnThis()})},L=e=>new w(e||B()),Y=()=>{let e=L();return Object.defineProperty(e,"isServerSide",{get:()=>!0,configurable:!0}),e},z=e=>{let t=e.mock.calls;if(t.length===0)return;let n=t[t.length-1];return{path:n[0],options:n[1]}},N=(e,t)=>{r(e==null?void 0:e.path).toBe(t)},V=e=>{r(e["Content-Type"]).toBe("application/json")},q=(e,t)=>{r(e.body).toBe(JSON.stringify(t))},X=(e,t,n)=>{r(e).toBeDefined(),e&&(N(e,t),e.options.headers&&V(e.options.headers),n!==void 0&&e.options&&q(e.options,n))},Z=(e,t,n,s)=>i(void 0,null,function*(){t.mockResolvedValue(b(n,s));let a=yield e();r(l(a)).toBe(!0),l(a)&&(r(a.error).toBe(!0),n.message&&r(a.message).toBe(n.message))}),Q=(s,a,...o)=>i(void 0,[s,a,...o],function*(e,t,n=[]){for(let{status:c,message:g}of A){if(n.includes(c))continue;let u={error:!0,message:g};t.mockResolvedValueOnce(b(u,c));let m=yield e();r(l(m)).toBe(!0)}}),ee=(e,t)=>i(void 0,null,function*(){t.mockRejectedValue(new Error("Network error")),yield r(e()).rejects.toThrow("Network error")}),te=(e,t)=>i(void 0,null,function*(){let n={json:y.fn().mockRejectedValue(new Error("Invalid JSON")),ok:!0,status:200};t.mockResolvedValue(n),yield r(e()).rejects.toThrow()}),ne=(e,t)=>i(void 0,null,function*(){t.mockImplementation(()=>new Promise((n,s)=>setTimeout(()=>s(new Error("Request timeout")),0))),yield r(e()).rejects.toThrow("Request timeout")}),se=(e,t,n)=>i(void 0,null,function*(){t.mockResolvedValue(j(n));let s=yield e();r(s).toEqual(n)}),oe=(e={})=>p({address:F.evmAddress,chainType:"evm",type:"smart",config:{adminSigner:{type:"external-wallet",address:E.EVM_TEST}}},e),re=(e={})=>p({id:"txn-123",status:"pending",chainType:"evm",walletType:"evm-smart-wallet",params:{transaction:"0x1234567890abcdef",signer:"api-key:test"},onChain:{txId:"0xabcdef1234567890abcdef1234567890abcdef12",explorerLink:"https://explorer.example.com/tx/0xabcdef1234567890abcdef1234567890abcdef12"},createdAt:Date.now()},e);function l(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error===!0}function C(e){return typeof e=="object"&&e!==null&&"address"in e&&"chainType"in e&&"type"in e}function $(e){return typeof e=="object"&&e!==null&&"id"in e&&"status"in e&&"chainType"in e}var x=e=>new Promise(t=>setTimeout(t,e)),ae=e=>/^0x[a-fA-F0-9]{40}$/.test(e),ie=e=>/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(e),ce=(e,t,n={})=>{let s=p(p({apiKey:e},t&&{overrideBaseUrl:t}),n),a=k(p({},s),{setJwt:()=>a});return new w(a)},v=class{constructor(){this.wallets=[];this.transactions=[]}addWallet(t){t&&!this.wallets.includes(t)&&this.wallets.push(t)}addTransaction(t){t&&!this.transactions.includes(t)&&this.transactions.push(t)}getWallet(t=0){return this.wallets[t]}getTransaction(t=0){return this.transactions[t]}hasWallets(){return this.wallets.length>0}clear(){this.wallets=[],this.transactions=[]}};function pe(s,a){return i(this,arguments,function*(e,t,n={}){if(t.hasWallets())return t.getWallet();let{chainType:o="evm",type:c="mpc",owner:g,testName:u="default"}=n,m=g||`userId:integration-${u}-${Date.now()}`,f=yield e.createWallet(p({chainType:o,type:c},g&&{owner:m}));if(C(f))return t.addWallet(f.address),f.address})}function le(e,t,n){return i(this,null,function*(){let s=yield e.createWallet(n);return C(s)&&t.addWallet(s.address),s})}function ue(e,t){r(l(e)).toBe(!0),t&&r(e.message).toBeDefined()}function de(e){r(C(e)).toBe(!0)}function me(e){r($(e)).toBe(!0)}var I=(e,t,n,s="usdxm",a="base-sepolia")=>i(void 0,null,function*(){let o={amount:n,token:s,chain:a},c=yield e.fundWallet(t,o);if(l(c))throw new Error(`Failed to fund wallet: ${c.message||"Unknown error"}`);return yield x(R),c}),U=(a,o,c,...g)=>i(void 0,[a,o,c,...g],function*(e,t,n,s=M.APPROVE_TRANSACTION_MAX_RETRIES){var m;for(let f=0;f<s;f++){let d=yield e.getTransaction(t,n);if(l(d))throw new Error(`Transaction not found: ${d.message||"Unknown error"}`);if("status"in d&&(d.status==="success"||d.status==="failed"))return d;let T="approvals"in d?(m=d.approvals)==null?void 0:m.pending:void 0;if(T&&T.length>0){let O={approvals:T.map(_=>({signer:_.signer.locator,signature:""}))},h=yield e.approveTransaction(t,n,O);if(l(h))throw new Error(`Failed to approve transaction: ${h.message||"Unknown error"}`);yield x(W);continue}yield x(R)}let u=yield e.getTransaction(t,n);if(l(u))throw new Error(`Transaction not found after retries: ${u.message||"Unknown error"}`);if(!("status"in u))throw new Error("Transaction response missing status property");return u}),fe=(e,t,n=1,s="usdxm",a="base-sepolia")=>i(void 0,null,function*(){return I(e,t,n,s,a)}),ge=(e,t,n,s,a)=>i(void 0,null,function*(){let o=yield e.send(t,n,{recipient:s,amount:a});if(l(o))throw new Error(`Failed to send token: ${o.message||"Unknown error"}`);if(typeof o=="object"&&o!==null&&"id"in o&&typeof o.id=="string")return U(e,t,o.id);throw new Error("Transaction ID not found in send response")}),Te=(e,t,n=1,s="usdxm",a="base-sepolia")=>i(void 0,null,function*(){try{yield I(e,t,n,s,a)}catch(o){let c=o instanceof Error?o.message:String(o);if(!c.includes("already funded")&&!c.includes("insufficient"))throw o}});export{v as TestDataFactory,U as approveTransaction,ce as createIntegrationApiClient,B as createMockCrossmint,b as createMockErrorResponse,P as createMockResponse,re as createMockSendResponse,j as createMockSuccessResponse,oe as createMockWalletResponse,Y as createServerSideApiClient,L as createTestApiClient,le as createTestWallet,x as delay,pe as ensureWalletExists,Te as ensureWalletFunded,V as expectCommonHeaders,ue as expectErrorResponse,q as expectRequestBody,N as expectRequestPath,me as expectSuccessTransactionResponse,de as expectSuccessWalletResponse,z as extractFetchCall,I as fundWallet,fe as fundWalletAndWait,l as isErrorResponse,$ as isSuccessTransactionResponse,C as isSuccessWalletResponse,ae as isValidEthereumAddress,ie as isValidSolanaAddress,ge as sendTokenAndApprove,Q as testCommonHttpErrors,Z as testHttpErrorResponse,te as testInvalidJsonResponse,se as testMalformedResponse,ee as testNetworkError,ne as testTimeoutError,X as validateRequest};
1
+ import{a as A,b as F,i as R,j as W,k as E,l as M,m as S}from"../../chunk-DIGDDKSF.js";import{a as w}from"../../chunk-6TNAINPL.js";import"../../chunk-5OYPWGMX.js";import"../../chunk-CHX7PG2J.js";import"../../chunk-2323NR6Y.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 P=({data:e,status:t=200,ok:n=!0,statusText:s="OK"})=>({json:y.fn().mockResolvedValue(e),ok:n,status:t,statusText:s}),j=e=>P({data:e}),b=(e,t=400,n="Bad Request")=>P({data:e,status:t,ok:!1,statusText:n}),B=(e={})=>{let t=p({apiKey:S},e);return k(p({},t),{setJwt:y.fn().mockReturnThis()})},L=e=>new w(e||B()),Y=()=>{let e=L();return Object.defineProperty(e,"isServerSide",{get:()=>!0,configurable:!0}),e},z=e=>{let t=e.mock.calls;if(t.length===0)return;let n=t[t.length-1];return{path:n[0],options:n[1]}},N=(e,t)=>{r(e==null?void 0:e.path).toBe(t)},V=e=>{r(e["Content-Type"]).toBe("application/json")},q=(e,t)=>{r(e.body).toBe(JSON.stringify(t))},X=(e,t,n)=>{r(e).toBeDefined(),e&&(N(e,t),e.options.headers&&V(e.options.headers),n!==void 0&&e.options&&q(e.options,n))},Z=(e,t,n,s)=>i(void 0,null,function*(){t.mockResolvedValue(b(n,s));let a=yield e();r(l(a)).toBe(!0),l(a)&&(r(a.error).toBe(!0),n.message&&r(a.message).toBe(n.message))}),Q=(s,a,...o)=>i(void 0,[s,a,...o],function*(e,t,n=[]){for(let{status:c,message:g}of A){if(n.includes(c))continue;let u={error:!0,message:g};t.mockResolvedValueOnce(b(u,c));let m=yield e();r(l(m)).toBe(!0)}}),ee=(e,t)=>i(void 0,null,function*(){t.mockRejectedValue(new Error("Network error")),yield r(e()).rejects.toThrow("Network error")}),te=(e,t)=>i(void 0,null,function*(){let n={json:y.fn().mockRejectedValue(new Error("Invalid JSON")),ok:!0,status:200};t.mockResolvedValue(n),yield r(e()).rejects.toThrow()}),ne=(e,t)=>i(void 0,null,function*(){t.mockImplementation(()=>new Promise((n,s)=>setTimeout(()=>s(new Error("Request timeout")),0))),yield r(e()).rejects.toThrow("Request timeout")}),se=(e,t,n)=>i(void 0,null,function*(){t.mockResolvedValue(j(n));let s=yield e();r(s).toEqual(n)}),oe=(e={})=>p({address:F.evmAddress,chainType:"evm",type:"smart",config:{adminSigner:{type:"external-wallet",address:E.EVM_TEST}}},e),re=(e={})=>p({id:"txn-123",status:"pending",chainType:"evm",walletType:"evm-smart-wallet",params:{transaction:"0x1234567890abcdef",signer:"api-key:test"},onChain:{txId:"0xabcdef1234567890abcdef1234567890abcdef12",explorerLink:"https://explorer.example.com/tx/0xabcdef1234567890abcdef1234567890abcdef12"},createdAt:Date.now()},e);function l(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error===!0}function C(e){return typeof e=="object"&&e!==null&&"address"in e&&"chainType"in e&&"type"in e}function $(e){return typeof e=="object"&&e!==null&&"id"in e&&"status"in e&&"chainType"in e}var x=e=>new Promise(t=>setTimeout(t,e)),ae=e=>/^0x[a-fA-F0-9]{40}$/.test(e),ie=e=>/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(e),ce=(e,t,n={})=>{let s=p(p({apiKey:e},t&&{overrideBaseUrl:t}),n),a=k(p({},s),{setJwt:()=>a});return new w(a)},v=class{constructor(){this.wallets=[];this.transactions=[]}addWallet(t){t&&!this.wallets.includes(t)&&this.wallets.push(t)}addTransaction(t){t&&!this.transactions.includes(t)&&this.transactions.push(t)}getWallet(t=0){return this.wallets[t]}getTransaction(t=0){return this.transactions[t]}hasWallets(){return this.wallets.length>0}clear(){this.wallets=[],this.transactions=[]}};function pe(s,a){return i(this,arguments,function*(e,t,n={}){if(t.hasWallets())return t.getWallet();let{chainType:o="evm",type:c="mpc",owner:g,testName:u="default"}=n,m=g||`userId:integration-${u}-${Date.now()}`,f=yield e.createWallet(p({chainType:o,type:c},g&&{owner:m}));if(C(f))return t.addWallet(f.address),f.address})}function le(e,t,n){return i(this,null,function*(){let s=yield e.createWallet(n);return C(s)&&t.addWallet(s.address),s})}function ue(e,t){r(l(e)).toBe(!0),t&&r(e.message).toBeDefined()}function de(e){r(C(e)).toBe(!0)}function me(e){r($(e)).toBe(!0)}var I=(e,t,n,s="usdxm",a="base-sepolia")=>i(void 0,null,function*(){let o={amount:n,token:s,chain:a},c=yield e.fundWallet(t,o);if(l(c))throw new Error(`Failed to fund wallet: ${c.message||"Unknown error"}`);return yield x(R),c}),U=(a,o,c,...g)=>i(void 0,[a,o,c,...g],function*(e,t,n,s=M.APPROVE_TRANSACTION_MAX_RETRIES){var m;for(let f=0;f<s;f++){let d=yield e.getTransaction(t,n);if(l(d))throw new Error(`Transaction not found: ${d.message||"Unknown error"}`);if("status"in d&&(d.status==="success"||d.status==="failed"))return d;let T="approvals"in d?(m=d.approvals)==null?void 0:m.pending:void 0;if(T&&T.length>0){let O={approvals:T.map(_=>({signer:_.signer.locator,signature:""}))},h=yield e.approveTransaction(t,n,O);if(l(h))throw new Error(`Failed to approve transaction: ${h.message||"Unknown error"}`);yield x(W);continue}yield x(R)}let u=yield e.getTransaction(t,n);if(l(u))throw new Error(`Transaction not found after retries: ${u.message||"Unknown error"}`);if(!("status"in u))throw new Error("Transaction response missing status property");return u}),fe=(e,t,n=1,s="usdxm",a="base-sepolia")=>i(void 0,null,function*(){return I(e,t,n,s,a)}),ge=(e,t,n,s,a)=>i(void 0,null,function*(){let o=yield e.send(t,n,{recipient:s,amount:a});if(l(o))throw new Error(`Failed to send token: ${o.message||"Unknown error"}`);if(typeof o=="object"&&o!==null&&"id"in o&&typeof o.id=="string")return U(e,t,o.id);throw new Error("Transaction ID not found in send response")}),Te=(e,t,n=1,s="usdxm",a="base-sepolia")=>i(void 0,null,function*(){try{yield I(e,t,n,s,a)}catch(o){let c=o instanceof Error?o.message:String(o);if(!c.includes("already funded")&&!c.includes("insufficient"))throw o}});export{v as TestDataFactory,U as approveTransaction,ce as createIntegrationApiClient,B as createMockCrossmint,b as createMockErrorResponse,P as createMockResponse,re as createMockSendResponse,j as createMockSuccessResponse,oe as createMockWalletResponse,Y as createServerSideApiClient,L as createTestApiClient,le as createTestWallet,x as delay,pe as ensureWalletExists,Te as ensureWalletFunded,V as expectCommonHeaders,ue as expectErrorResponse,q as expectRequestBody,N as expectRequestPath,me as expectSuccessTransactionResponse,de as expectSuccessWalletResponse,z as extractFetchCall,I as fundWallet,fe as fundWalletAndWait,l as isErrorResponse,$ as isSuccessTransactionResponse,C as isSuccessWalletResponse,ae as isValidEthereumAddress,ie as isValidSolanaAddress,ge as sendTokenAndApprove,Q as testCommonHttpErrors,Z as testHttpErrorResponse,te as testInvalidJsonResponse,se as testMalformedResponse,ee as testNetworkError,ne as testTimeoutError,X as validateRequest};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkF2HEHICCcjs = require('../chunk-F2HEHICC.cjs');require('../chunk-OWQZPI3U.cjs');require('../chunk-CFB27BFV.cjs');require('../chunk-X7E2YEIV.cjs');require('../chunk-2GKPWQBQ.cjs');exports.ApiClient = _chunkF2HEHICCcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkN3P3SQ33cjs = require('../chunk-N3P3SQ33.cjs');require('../chunk-OWQZPI3U.cjs');require('../chunk-XDHGCS4W.cjs');require('../chunk-TQCD2GOR.cjs');require('../chunk-2GKPWQBQ.cjs');exports.ApiClient = _chunkN3P3SQ33cjs.a;
@@ -1,5 +1,5 @@
1
1
  import { CrossmintApiClient, Crossmint, APIKeyEnvironmentPrefix } from '@crossmint/common-sdk-base';
2
- import { af as CreateWalletParams, ae as CreateWalletResponse, aa as WalletLocator, ak as GetWalletResponse, al as CreateTransactionParams, am as CreateTransactionResponse, an as ApproveTransactionParams, ao as ApproveTransactionResponse, ac as GetTransactionResponse, ap as CreateSignatureParams, aq as CreateSignatureResponse, ar as ApproveSignatureParams, ab as ApproveSignatureResponse, as as GetSignatureResponse, a3 as GetTransactionsResponse, at as GetTransfersResponse, au as GetBalanceResponse, av as FundWalletParams, a2 as FundWalletResponse, aw as RegisterSignerParams, ax as RegisterSignerResponse, ay as RemoveSignerParams, az as RemoveSignerResponse, aA as GetSignerResponse, aB as SendParams, ad as SendResponse } from '../types-5kZcVs3E.cjs';
2
+ import { ah as CreateWalletParams, ag as CreateWalletResponse, ac as WalletLocator, am as GetWalletResponse, an as CreateTransactionParams, ao as CreateTransactionResponse, ap as ApproveTransactionParams, aq as ApproveTransactionResponse, ae as GetTransactionResponse, ar as CreateSignatureParams, as as CreateSignatureResponse, at as ApproveSignatureParams, ad as ApproveSignatureResponse, au as GetSignatureResponse, a5 as GetTransactionsResponse, av as GetTransfersResponse, aw as GetBalanceResponse, ax as FundWalletParams, a4 as FundWalletResponse, ay as RegisterSignerParams, az as RegisterSignerResponse, aA as RemoveSignerParams, aB as RemoveSignerResponse, aC as GetSignerResponse, aD as SendParams, af as SendResponse } from '../types-Cc0Mr7mS.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 { af as CreateWalletParams, ae as CreateWalletResponse, aa as WalletLocator, ak as GetWalletResponse, al as CreateTransactionParams, am as CreateTransactionResponse, an as ApproveTransactionParams, ao as ApproveTransactionResponse, ac as GetTransactionResponse, ap as CreateSignatureParams, aq as CreateSignatureResponse, ar as ApproveSignatureParams, ab as ApproveSignatureResponse, as as GetSignatureResponse, a3 as GetTransactionsResponse, at as GetTransfersResponse, au as GetBalanceResponse, av as FundWalletParams, a2 as FundWalletResponse, aw as RegisterSignerParams, ax as RegisterSignerResponse, ay as RemoveSignerParams, az as RemoveSignerResponse, aA as GetSignerResponse, aB as SendParams, ad as SendResponse } from '../types-CRMCeDuN.js';
2
+ import { ah as CreateWalletParams, ag as CreateWalletResponse, ac as WalletLocator, am as GetWalletResponse, an as CreateTransactionParams, ao as CreateTransactionResponse, ap as ApproveTransactionParams, aq as ApproveTransactionResponse, ae as GetTransactionResponse, ar as CreateSignatureParams, as as CreateSignatureResponse, at as ApproveSignatureParams, ad as ApproveSignatureResponse, au as GetSignatureResponse, a5 as GetTransactionsResponse, av as GetTransfersResponse, aw as GetBalanceResponse, ax as FundWalletParams, a4 as FundWalletResponse, ay as RegisterSignerParams, az as RegisterSignerResponse, aA as RemoveSignerParams, aB as RemoveSignerResponse, aC as GetSignerResponse, aD as SendParams, af as SendResponse } from '../types-Br5La8FI.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-XCIS2OND.js";import"../chunk-5OYPWGMX.js";import"../chunk-UBDPBFAR.js";import"../chunk-XX6FO5QS.js";import"../chunk-J3R36SGJ.js";export{a as ApiClient};
1
+ import{a}from"../chunk-6TNAINPL.js";import"../chunk-5OYPWGMX.js";import"../chunk-CHX7PG2J.js";import"../chunk-2323NR6Y.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 _chunkF2HEHICCcjs = require('../chunk-F2HEHICC.cjs');require('../chunk-ECAM5KTH.cjs');require('../chunk-OWQZPI3U.cjs');require('../chunk-CFB27BFV.cjs');require('../chunk-X7E2YEIV.cjs');require('../chunk-2GKPWQBQ.cjs');exports.ApiClient = _chunkF2HEHICCcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-6HXIZLEQ.cjs');var _chunkN3P3SQ33cjs = require('../chunk-N3P3SQ33.cjs');require('../chunk-ECAM5KTH.cjs');require('../chunk-OWQZPI3U.cjs');require('../chunk-XDHGCS4W.cjs');require('../chunk-TQCD2GOR.cjs');require('../chunk-2GKPWQBQ.cjs');exports.ApiClient = _chunkN3P3SQ33cjs.a;
@@ -1,5 +1,5 @@
1
1
  export { ApiClient } from './client.cjs';
2
- export { ar as ApproveSignatureParams, ab as ApproveSignatureResponse, an as ApproveTransactionParams, ao as ApproveTransactionResponse, ap as CreateSignatureParams, aq as CreateSignatureResponse, al as CreateTransactionParams, am as CreateTransactionResponse, aC as CreateTransactionSuccessResponse, af as CreateWalletParams, ae as CreateWalletResponse, av as FundWalletParams, a2 as FundWalletResponse, au as GetBalanceResponse, aD as GetBalanceSuccessResponse, as as GetSignatureResponse, aA as GetSignerResponse, aE as GetSignersResponse, ac as GetTransactionResponse, a4 as GetTransactionSuccessResponse, a3 as GetTransactionsResponse, at as GetTransfersResponse, ak as GetWalletResponse, aF as GetWalletSuccessResponse, aG as RecoverySignerConfig, aH as RegisterSignerChain, aw as RegisterSignerParams, R as RegisterSignerPasskeyParams, ax as RegisterSignerResponse, ay as RemoveSignerParams, az as RemoveSignerResponse, S as Scope, aB as SendParams, ad as SendResponse, U as Signer, y as TransferScope, z as Transfers, aa as WalletLocator } from '../types-5kZcVs3E.cjs';
2
+ export { at as ApproveSignatureParams, ad as ApproveSignatureResponse, ap as ApproveTransactionParams, aq as ApproveTransactionResponse, ar as CreateSignatureParams, as as CreateSignatureResponse, an as CreateTransactionParams, ao as CreateTransactionResponse, aE as CreateTransactionSuccessResponse, ah as CreateWalletParams, ag as CreateWalletResponse, ax as FundWalletParams, a4 as FundWalletResponse, aw as GetBalanceResponse, aF as GetBalanceSuccessResponse, au as GetSignatureResponse, aC as GetSignerResponse, aG as GetSignersResponse, ae as GetTransactionResponse, a6 as GetTransactionSuccessResponse, a5 as GetTransactionsResponse, av as GetTransfersResponse, am as GetWalletResponse, aH as GetWalletSuccessResponse, aI as RecoverySignerConfig, aJ as RegisterSignerChain, ay as RegisterSignerParams, R as RegisterSignerPasskeyParams, az as RegisterSignerResponse, aA as RemoveSignerParams, aB as RemoveSignerResponse, S as Scope, aD as SendParams, af as SendResponse, X as Signer, z as TransferScope, F as Transfers, ac as WalletLocator } from '../types-Cc0Mr7mS.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 { ar as ApproveSignatureParams, ab as ApproveSignatureResponse, an as ApproveTransactionParams, ao as ApproveTransactionResponse, ap as CreateSignatureParams, aq as CreateSignatureResponse, al as CreateTransactionParams, am as CreateTransactionResponse, aC as CreateTransactionSuccessResponse, af as CreateWalletParams, ae as CreateWalletResponse, av as FundWalletParams, a2 as FundWalletResponse, au as GetBalanceResponse, aD as GetBalanceSuccessResponse, as as GetSignatureResponse, aA as GetSignerResponse, aE as GetSignersResponse, ac as GetTransactionResponse, a4 as GetTransactionSuccessResponse, a3 as GetTransactionsResponse, at as GetTransfersResponse, ak as GetWalletResponse, aF as GetWalletSuccessResponse, aG as RecoverySignerConfig, aH as RegisterSignerChain, aw as RegisterSignerParams, R as RegisterSignerPasskeyParams, ax as RegisterSignerResponse, ay as RemoveSignerParams, az as RemoveSignerResponse, S as Scope, aB as SendParams, ad as SendResponse, U as Signer, y as TransferScope, z as Transfers, aa as WalletLocator } from '../types-CRMCeDuN.js';
2
+ export { at as ApproveSignatureParams, ad as ApproveSignatureResponse, ap as ApproveTransactionParams, aq as ApproveTransactionResponse, ar as CreateSignatureParams, as as CreateSignatureResponse, an as CreateTransactionParams, ao as CreateTransactionResponse, aE as CreateTransactionSuccessResponse, ah as CreateWalletParams, ag as CreateWalletResponse, ax as FundWalletParams, a4 as FundWalletResponse, aw as GetBalanceResponse, aF as GetBalanceSuccessResponse, au as GetSignatureResponse, aC as GetSignerResponse, aG as GetSignersResponse, ae as GetTransactionResponse, a6 as GetTransactionSuccessResponse, a5 as GetTransactionsResponse, av as GetTransfersResponse, am as GetWalletResponse, aH as GetWalletSuccessResponse, aI as RecoverySignerConfig, aJ as RegisterSignerChain, ay as RegisterSignerParams, R as RegisterSignerPasskeyParams, az as RegisterSignerResponse, aA as RemoveSignerParams, aB as RemoveSignerResponse, S as Scope, aD as SendParams, af as SendResponse, X as Signer, z as TransferScope, F as Transfers, ac as WalletLocator } from '../types-Br5La8FI.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-XCIS2OND.js";import"../chunk-KBJA7JDT.js";import"../chunk-5OYPWGMX.js";import"../chunk-UBDPBFAR.js";import"../chunk-XX6FO5QS.js";import"../chunk-J3R36SGJ.js";export{a as ApiClient};
1
+ import"../chunk-5IFDVB4Y.js";import{a}from"../chunk-6TNAINPL.js";import"../chunk-KBJA7JDT.js";import"../chunk-5OYPWGMX.js";import"../chunk-CHX7PG2J.js";import"../chunk-2323NR6Y.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 { ar as ApproveSignatureParams, ab as ApproveSignatureResponse, an as ApproveTransactionParams, ao as ApproveTransactionResponse, ap as CreateSignatureParams, aq as CreateSignatureResponse, al as CreateTransactionParams, am as CreateTransactionResponse, aC as CreateTransactionSuccessResponse, af as CreateWalletParams, ae as CreateWalletResponse, av as FundWalletParams, a2 as FundWalletResponse, au as GetBalanceResponse, aD as GetBalanceSuccessResponse, as as GetSignatureResponse, aA as GetSignerResponse, aE as GetSignersResponse, ac as GetTransactionResponse, a4 as GetTransactionSuccessResponse, a3 as GetTransactionsResponse, at as GetTransfersResponse, ak as GetWalletResponse, aF as GetWalletSuccessResponse, aG as RecoverySignerConfig, aH as RegisterSignerChain, aw as RegisterSignerParams, R as RegisterSignerPasskeyParams, ax as RegisterSignerResponse, ay as RemoveSignerParams, az as RemoveSignerResponse, S as Scope, aB as SendParams, ad as SendResponse, U as Signer, y as TransferScope, z as Transfers, aa as WalletLocator } from '../types-5kZcVs3E.cjs';
3
+ export { at as ApproveSignatureParams, ad as ApproveSignatureResponse, ap as ApproveTransactionParams, aq as ApproveTransactionResponse, ar as CreateSignatureParams, as as CreateSignatureResponse, an as CreateTransactionParams, ao as CreateTransactionResponse, aE as CreateTransactionSuccessResponse, ah as CreateWalletParams, ag as CreateWalletResponse, ax as FundWalletParams, a4 as FundWalletResponse, aw as GetBalanceResponse, aF as GetBalanceSuccessResponse, au as GetSignatureResponse, aC as GetSignerResponse, aG as GetSignersResponse, ae as GetTransactionResponse, a6 as GetTransactionSuccessResponse, a5 as GetTransactionsResponse, av as GetTransfersResponse, am as GetWalletResponse, aH as GetWalletSuccessResponse, aI as RecoverySignerConfig, aJ as RegisterSignerChain, ay as RegisterSignerParams, R as RegisterSignerPasskeyParams, az as RegisterSignerResponse, aA as RemoveSignerParams, aB as RemoveSignerResponse, S as Scope, aD as SendParams, af as SendResponse, X as Signer, z as TransferScope, F as Transfers, ac as WalletLocator } from '../types-Cc0Mr7mS.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 { ar as ApproveSignatureParams, ab as ApproveSignatureResponse, an as ApproveTransactionParams, ao as ApproveTransactionResponse, ap as CreateSignatureParams, aq as CreateSignatureResponse, al as CreateTransactionParams, am as CreateTransactionResponse, aC as CreateTransactionSuccessResponse, af as CreateWalletParams, ae as CreateWalletResponse, av as FundWalletParams, a2 as FundWalletResponse, au as GetBalanceResponse, aD as GetBalanceSuccessResponse, as as GetSignatureResponse, aA as GetSignerResponse, aE as GetSignersResponse, ac as GetTransactionResponse, a4 as GetTransactionSuccessResponse, a3 as GetTransactionsResponse, at as GetTransfersResponse, ak as GetWalletResponse, aF as GetWalletSuccessResponse, aG as RecoverySignerConfig, aH as RegisterSignerChain, aw as RegisterSignerParams, R as RegisterSignerPasskeyParams, ax as RegisterSignerResponse, ay as RemoveSignerParams, az as RemoveSignerResponse, S as Scope, aB as SendParams, ad as SendResponse, U as Signer, y as TransferScope, z as Transfers, aa as WalletLocator } from '../types-CRMCeDuN.js';
3
+ export { at as ApproveSignatureParams, ad as ApproveSignatureResponse, ap as ApproveTransactionParams, aq as ApproveTransactionResponse, ar as CreateSignatureParams, as as CreateSignatureResponse, an as CreateTransactionParams, ao as CreateTransactionResponse, aE as CreateTransactionSuccessResponse, ah as CreateWalletParams, ag as CreateWalletResponse, ax as FundWalletParams, a4 as FundWalletResponse, aw as GetBalanceResponse, aF as GetBalanceSuccessResponse, au as GetSignatureResponse, aC as GetSignerResponse, aG as GetSignersResponse, ae as GetTransactionResponse, a6 as GetTransactionSuccessResponse, a5 as GetTransactionsResponse, av as GetTransfersResponse, am as GetWalletResponse, aH as GetWalletSuccessResponse, aI as RecoverySignerConfig, aJ as RegisterSignerChain, ay as RegisterSignerParams, R as RegisterSignerPasskeyParams, az as RegisterSignerResponse, aA as RemoveSignerParams, aB as RemoveSignerResponse, S as Scope, aD as SendParams, af as SendResponse, X as Signer, z as TransferScope, F as Transfers, ac as WalletLocator } from '../types-Br5La8FI.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 _chunkAAUS7KTRcjs = require('../chunk-AAUS7KTR.cjs');require('../chunk-GEY574TH.cjs');require('../chunk-UE3WVHTM.cjs');require('../chunk-5X4EOJFG.cjs');require('../chunk-HRUMWG2F.cjs');require('../chunk-IR5WN6FQ.cjs');require('../chunk-OWQZPI3U.cjs');require('../chunk-CCIGWTAO.cjs');require('../chunk-CFB27BFV.cjs');require('../chunk-X7E2YEIV.cjs');require('../chunk-2GKPWQBQ.cjs');exports.isMainnetChain = _chunkAAUS7KTRcjs.c; exports.isTestnetChain = _chunkAAUS7KTRcjs.b; exports.isValidChain = _chunkAAUS7KTRcjs.e; exports.mainnetToTestnet = _chunkAAUS7KTRcjs.d; exports.toViemChain = _chunkAAUS7KTRcjs.a; exports.validateChainForEnvironment = _chunkAAUS7KTRcjs.f;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkAGN3B4GScjs = require('../chunk-AGN3B4GS.cjs');require('../chunk-GEY574TH.cjs');require('../chunk-UE3WVHTM.cjs');require('../chunk-5X4EOJFG.cjs');require('../chunk-HRUMWG2F.cjs');require('../chunk-IR5WN6FQ.cjs');require('../chunk-OWQZPI3U.cjs');require('../chunk-CCIGWTAO.cjs');require('../chunk-XDHGCS4W.cjs');require('../chunk-TQCD2GOR.cjs');require('../chunk-2GKPWQBQ.cjs');exports.isMainnetChain = _chunkAGN3B4GScjs.c; exports.isTestnetChain = _chunkAGN3B4GScjs.b; exports.isValidChain = _chunkAGN3B4GScjs.e; exports.mainnetToTestnet = _chunkAGN3B4GScjs.d; exports.toViemChain = _chunkAGN3B4GScjs.a; exports.validateChainForEnvironment = _chunkAGN3B4GScjs.f;
@@ -2,7 +2,7 @@ import { APIKeyEnvironmentPrefix } from '@crossmint/common-sdk-base';
2
2
  import { Chain as Chain$1 } from 'viem';
3
3
 
4
4
  declare const TESTNET_AA_CHAINS: readonly ["abstract-testnet", "arbitrum-sepolia", "base-sepolia", "curtis", "ethereum-sepolia", "flow-testnet", "mantle-sepolia", "mode-sepolia", "optimism-sepolia", "plume-testnet", "polygon-amoy", "scroll-sepolia", "sei-atlantic-2-testnet", "story-testnet", "world-chain-sepolia", "zora-sepolia", "arc-testnet", "tempo-testnet"];
5
- declare const PRODUCTION_AA_CHAINS: readonly ["abstract", "apechain", "arbitrum", "arbitrumnova", "base", "bsc", "flow", "mantle", "mode", "optimism", "plume", "polygon", "scroll", "sei-pacific-1", "shape", "story", "tempo", "world-chain", "zora"];
5
+ declare const PRODUCTION_AA_CHAINS: readonly ["abstract", "apechain", "arbitrum", "arbitrumnova", "base", "bsc", "ethereum", "flow", "mantle", "mode", "optimism", "plume", "polygon", "scroll", "sei-pacific-1", "shape", "story", "tempo", "world-chain", "zora"];
6
6
  type EVMSmartWalletTestnet = (typeof TESTNET_AA_CHAINS)[number];
7
7
  type EVMSmartWalletMainnet = (typeof PRODUCTION_AA_CHAINS)[number];
8
8
  type EVMSmartWalletChain = EVMSmartWalletTestnet | EVMSmartWalletMainnet;
@@ -2,7 +2,7 @@ import { APIKeyEnvironmentPrefix } from '@crossmint/common-sdk-base';
2
2
  import { Chain as Chain$1 } from 'viem';
3
3
 
4
4
  declare const TESTNET_AA_CHAINS: readonly ["abstract-testnet", "arbitrum-sepolia", "base-sepolia", "curtis", "ethereum-sepolia", "flow-testnet", "mantle-sepolia", "mode-sepolia", "optimism-sepolia", "plume-testnet", "polygon-amoy", "scroll-sepolia", "sei-atlantic-2-testnet", "story-testnet", "world-chain-sepolia", "zora-sepolia", "arc-testnet", "tempo-testnet"];
5
- declare const PRODUCTION_AA_CHAINS: readonly ["abstract", "apechain", "arbitrum", "arbitrumnova", "base", "bsc", "flow", "mantle", "mode", "optimism", "plume", "polygon", "scroll", "sei-pacific-1", "shape", "story", "tempo", "world-chain", "zora"];
5
+ declare const PRODUCTION_AA_CHAINS: readonly ["abstract", "apechain", "arbitrum", "arbitrumnova", "base", "bsc", "ethereum", "flow", "mantle", "mode", "optimism", "plume", "polygon", "scroll", "sei-pacific-1", "shape", "story", "tempo", "world-chain", "zora"];
6
6
  type EVMSmartWalletTestnet = (typeof TESTNET_AA_CHAINS)[number];
7
7
  type EVMSmartWalletMainnet = (typeof PRODUCTION_AA_CHAINS)[number];
8
8
  type EVMSmartWalletChain = EVMSmartWalletTestnet | EVMSmartWalletMainnet;
@@ -1 +1 @@
1
- import{a,b,c,d,e,f}from"../chunk-FXCUVWXJ.js";import"../chunk-S3DYQVRD.js";import"../chunk-KUP7H7X2.js";import"../chunk-FT5EVMLB.js";import"../chunk-SVIKBM3S.js";import"../chunk-KKQBZXFE.js";import"../chunk-5OYPWGMX.js";import"../chunk-455NK5LB.js";import"../chunk-UBDPBFAR.js";import"../chunk-XX6FO5QS.js";import"../chunk-J3R36SGJ.js";export{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-RMXZH6CG.js";import"../chunk-S3DYQVRD.js";import"../chunk-KUP7H7X2.js";import"../chunk-FT5EVMLB.js";import"../chunk-SVIKBM3S.js";import"../chunk-KKQBZXFE.js";import"../chunk-5OYPWGMX.js";import"../chunk-455NK5LB.js";import"../chunk-CHX7PG2J.js";import"../chunk-2323NR6Y.js";import"../chunk-J3R36SGJ.js";export{c as isMainnetChain,b as isTestnetChain,e as isValidChain,d as mainnetToTestnet,a as toViemChain,f as validateChainForEnvironment};
@@ -0,0 +1 @@
1
+ var s="@crossmint/wallets-sdk",t="1.5.0";var c="WALLETS_SDK",r=t,a=s,d=500;export{c as a,r as b,a as c,d};
@@ -1 +1 @@
1
- import{a as A,b as k}from"./chunk-JGWGYONV.js";import{a as E}from"./chunk-YSB7XIS7.js";import{a as x}from"./chunk-N4IWDL6M.js";import{a as W}from"./chunk-GOXB2RBF.js";import{b as w,c as b}from"./chunk-F5NTM2RX.js";import{f as S}from"./chunk-FXCUVWXJ.js";import{e as R,g as l}from"./chunk-5OYPWGMX.js";import{a as g}from"./chunk-UBDPBFAR.js";import{a as f,b as m,c as v,g as y}from"./chunk-J3R36SGJ.js";import{WithLoggerContext as D}from"@crossmint/common-sdk-base";import{WebAuthnP256 as K}from"ox";var $="When 'signers' is provided to a method that may fetch an existing wallet, each specified signer must exist in that wallet's configuration.",u=class{constructor(r){this.apiClient=r}getWallet(r,e){return y(this,null,function*(){let i,t;if(typeof r=="string"){if(!this.apiClient.isServerSide)throw new l("getWallet with walletLocator is only available on the server side. Use getWallet(args) instead.");if(e==null)throw new l("Wallet configuration is required when using walletLocator: https://docs.crossmint.com/sdk-reference/wallets/type-aliases/WalletArgsFor");i=r,t=e}else{if(this.apiClient.isServerSide)throw new l("getWallet on server side requires a walletLocator parameter. Use getWallet(walletLocator, args) instead.");t=r,i=this.getWalletLocator(t)}let a=m(f({},t),{chain:S(t.chain,this.apiClient.environment)});g.info("walletFactory.getWallet.start");let n=yield this.apiClient.getWallet(i);if("error"in n)throw g.warn("walletFactory.getWallet.notFound",{error:n.error}),new R(JSON.stringify(n));return g.info("walletFactory.getWallet.success",{address:n.address}),yield this.createWalletInstance(n,a)})}createWallet(r){return y(this,null,function*(){var o,c,d,h,C,p,F,P;let e=m(f({},r),{chain:S(r.chain,this.apiClient.environment)});if(yield(d=(c=(o=e.options)==null?void 0:o.callbacks)==null?void 0:c.onWalletCreationStart)==null?void 0:d.call(c),g.info("walletFactory.createWallet.start"),!this.apiClient.isServerSide&&e.owner!=null)throw g.error("walletFactory.createWallet.error",{error:"Owner field cannot be specified in client-side createWallet calls"}),new l("Owner field cannot be specified in client-side createWallet calls. Owner is determined from JWT authentication.");let t=((h=e.options)==null?void 0:h.deviceSignerKeyStorage)!=null&&e.chain!=="solana"?this.ensureDeviceSignerInSigners(e):(C=e.signers)!=null?C:[],a=yield this.registerSigners(t,e.chain,(p=e.options)==null?void 0:p.deviceSignerKeyStorage),n;if(e.recovery.type==="passkey"&&e.recovery.id==null)n=yield this.createPasskeySigner(e.recovery);else if(e.recovery.type==="server"){let{derivedAddress:I}=w(e.recovery,e.chain,this.apiClient.projectId,this.apiClient.environment);n={type:"server",address:I}}else n=e.recovery;let s=yield this.apiClient.createWallet({type:"smart",chainType:this.getChainType(e.chain),config:f(f({adminSigner:n},e.plugins?{plugins:e.plugins}:{}),a!=null?{delegatedSigners:a}:{}),owner:(F=e.owner)!=null?F:void 0,alias:(P=e.alias)!=null?P:void 0});if("error"in s)throw g.error("walletFactory.createWallet.error",{error:s.error}),new l(JSON.stringify(s));return g.info("walletFactory.createWallet.success",{address:s.address}),yield this.createWalletInstance(s,e)})}createWalletInstance(r,e){return y(this,null,function*(){var h,C;this.validateExistingWalletConfig(r,e);let i=e,t=r.config.adminSigner,a=((h=i.recovery)==null?void 0:h.type)==="server"||((C=i.recovery)==null?void 0:C.type)==="external-wallet"?i.recovery:t,n=r.config.delegatedSigners,s=n;s!=null&&s.length===1&&(s[0].type==="server"||s[0].type==="external-wallet")&&(s=i.signers);let o=t.type==="server"&&"address"in t&&!("secret"in t)?t.address:void 0,c=(n!=null?n:[]).filter(p=>p.type==="server"&&"address"in p&&!("secret"in p)).map(p=>p.address),d=new E({chain:e.chain,address:r.address,owner:r.owner,options:e.options,alias:e.alias,recovery:a,apiRecoveryServerSignerAddress:o,apiDelegatedServerSignerAddresses:c,signers:s!=null?s:[]},this.apiClient);return yield d.waitForInit(),d})}getWalletLocator(r){return`me:${this.getChainType(r.chain)}:smart`+(r.alias!=null?`:alias:${r.alias}`:"")}createPasskeySigner(r){return y(this,null,function*(){var t;if(r.type!=="passkey")throw new Error("Signer is not a passkey");let e=(t=r.name)!=null?t:`Crossmint Wallet ${Date.now()}`,i=r.onCreatePasskey?yield r.onCreatePasskey(e):yield K.createCredential({name:e});return{type:"passkey",id:i.id,name:e,publicKey:{x:i.publicKey.x.toString(),y:i.publicKey.y.toString()}}})}ensureDeviceSignerInSigners(r){var t;let e=(t=r.signers)!=null?t:[];return e.some(a=>a.type==="device")?e:[...e,{type:"device"}]}validateExistingWalletConfig(r,e){if(e.owner!=null&&r.owner!=null&&A(e.owner)!==A(r.owner))throw new l("Wallet owner does not match existing wallet's linked user");if(e.chain==="solana"&&r.chainType!=="solana"||e.chain!=="solana"&&r.chainType==="solana"||e.chain==="stellar"&&r.chainType!=="stellar"||e.chain!=="stellar"&&r.chainType==="stellar")throw new l(`Wallet chain does not match existing wallet's chain. You must use chain: ${r.chainType}.`);if(r.type!=="smart")return;let i=e;if(i.recovery!=null||i.signers!=null){let t=r.config,a=t==null?void 0:t.adminSigner;if(i.recovery!=null&&a!=null){if(i.recovery.type!==a.type)throw new l("The wallet recovery signer type does not match the existing wallet's recovery signer type");k(i.recovery,a)}let n=i.signers;n!=null&&this.validateSigners(r,n,e.chain)}}validateSigners(r,e,i){let t=r.config,a=t==null?void 0:t.delegatedSigners;if(e.length!==0){if(a==null||a.length===0)throw new l(`${e.length} signer(s) specified, but wallet "${r.address}" has no signers. ${$}`);for(let n of e){let s=a.find(o=>{if(this.isMatchingPasskeySigner(n,o,t)||o.type==="device"&&n.type==="device")return!0;if(n.type==="server"){let{primary:c,legacy:d}=b(n,i,this.apiClient.projectId,this.apiClient.environment);return o.locator===`server:${c.derivedAddress}`||d!=null&&o.locator===`server:${d.derivedAddress}`}return o.locator===W(n)});if(s==null){let o=a.map(c=>c.locator).join(", ");throw new l(`Signer '${n.type}' does not exist in wallet "${r.address}". Available signers: ${o}. ${$}`)}k(n,s)}}}isMatchingPasskeySigner(r,e,i){var a,n;let t=((n=(a=i.delegatedSigners)==null?void 0:a.filter(s=>s.type==="passkey").length)!=null?n:0)+(i.adminSigner.type==="passkey"?1:0);if(r.type==="passkey"){if(r.id==null&&t===1)return e.type==="passkey";if(r.id==null&&t>1)throw new l("When creating a wallet with multiple passkeys, you must provide the passkey ID for each passkey.")}return!1}registerSigners(r,e,i){return y(this,null,function*(){var t;return yield Promise.all((t=r==null?void 0:r.map(a=>y(this,null,function*(){if(a.type==="passkey")return a.id==null?{signer:yield this.createPasskeySigner(a)}:{signer:a};if(a.type==="device"){if(a.publicKey!=null)return{signer:{type:"device",publicKey:a.publicKey,name:a.name}};if(a.locator!=null)return{signer:a.locator};if(i==null)throw new l("Device signer key storage is required for device signers");let n=yield x(i);return{signer:{type:"device",publicKey:n.publicKey,name:n.name}}}if(a.type==="server"&&e!=null){let{derivedAddress:n}=w(a,e,this.apiClient.projectId,this.apiClient.environment);return{signer:`server:${n}`}}return{signer:W(a)}})))!=null?t:[])})}getChainType(r){return r==="solana"?"solana":r==="stellar"?"stellar":"evm"}};v([D({logger:g,methodName:"walletFactory.getWallet",buildContext(r,e){if(typeof e[0]=="string"){let t=e[1];return{walletLocator:e[0],chain:t==null?void 0:t.chain}}let i=e[0];return{chain:i==null?void 0:i.chain}}})],u.prototype,"getWallet",1),v([D({logger:g,methodName:"walletFactory.createWallet",buildContext(r,e){return{chain:e[0].chain}}})],u.prototype,"createWallet",1);export{u as a};
1
+ import{a as A,b as k}from"./chunk-JGWGYONV.js";import{a as E}from"./chunk-FLYEGDDE.js";import{a as x}from"./chunk-N4IWDL6M.js";import{a as W}from"./chunk-GOXB2RBF.js";import{b as w,c as b}from"./chunk-F5NTM2RX.js";import{f as S}from"./chunk-RMXZH6CG.js";import{e as R,g as l}from"./chunk-5OYPWGMX.js";import{a as g}from"./chunk-CHX7PG2J.js";import{a as f,b as m,c as v,g as y}from"./chunk-J3R36SGJ.js";import{WithLoggerContext as D}from"@crossmint/common-sdk-base";import{WebAuthnP256 as K}from"ox";var $="When 'signers' is provided to a method that may fetch an existing wallet, each specified signer must exist in that wallet's configuration.",u=class{constructor(r){this.apiClient=r}getWallet(r,e){return y(this,null,function*(){let i,t;if(typeof r=="string"){if(!this.apiClient.isServerSide)throw new l("getWallet with walletLocator is only available on the server side. Use getWallet(args) instead.");if(e==null)throw new l("Wallet configuration is required when using walletLocator: https://docs.crossmint.com/sdk-reference/wallets/type-aliases/WalletArgsFor");i=r,t=e}else{if(this.apiClient.isServerSide)throw new l("getWallet on server side requires a walletLocator parameter. Use getWallet(walletLocator, args) instead.");t=r,i=this.getWalletLocator(t)}let a=m(f({},t),{chain:S(t.chain,this.apiClient.environment)});g.info("walletFactory.getWallet.start");let n=yield this.apiClient.getWallet(i);if("error"in n)throw g.warn("walletFactory.getWallet.notFound",{error:n.error}),new R(JSON.stringify(n));return g.info("walletFactory.getWallet.success",{address:n.address}),yield this.createWalletInstance(n,a)})}createWallet(r){return y(this,null,function*(){var o,c,d,h,C,p,F,P;let e=m(f({},r),{chain:S(r.chain,this.apiClient.environment)});if(yield(d=(c=(o=e.options)==null?void 0:o.callbacks)==null?void 0:c.onWalletCreationStart)==null?void 0:d.call(c),g.info("walletFactory.createWallet.start"),!this.apiClient.isServerSide&&e.owner!=null)throw g.error("walletFactory.createWallet.error",{error:"Owner field cannot be specified in client-side createWallet calls"}),new l("Owner field cannot be specified in client-side createWallet calls. Owner is determined from JWT authentication.");let t=((h=e.options)==null?void 0:h.deviceSignerKeyStorage)!=null&&e.chain!=="solana"?this.ensureDeviceSignerInSigners(e):(C=e.signers)!=null?C:[],a=yield this.registerSigners(t,e.chain,(p=e.options)==null?void 0:p.deviceSignerKeyStorage),n;if(e.recovery.type==="passkey"&&e.recovery.id==null)n=yield this.createPasskeySigner(e.recovery);else if(e.recovery.type==="server"){let{derivedAddress:I}=w(e.recovery,e.chain,this.apiClient.projectId,this.apiClient.environment);n={type:"server",address:I}}else n=e.recovery;let s=yield this.apiClient.createWallet({type:"smart",chainType:this.getChainType(e.chain),config:f(f({adminSigner:n},e.plugins?{plugins:e.plugins}:{}),a!=null?{delegatedSigners:a}:{}),owner:(F=e.owner)!=null?F:void 0,alias:(P=e.alias)!=null?P:void 0});if("error"in s)throw g.error("walletFactory.createWallet.error",{error:s.error}),new l(JSON.stringify(s));return g.info("walletFactory.createWallet.success",{address:s.address}),yield this.createWalletInstance(s,e)})}createWalletInstance(r,e){return y(this,null,function*(){var h,C;this.validateExistingWalletConfig(r,e);let i=e,t=r.config.adminSigner,a=((h=i.recovery)==null?void 0:h.type)==="server"||((C=i.recovery)==null?void 0:C.type)==="external-wallet"?i.recovery:t,n=r.config.delegatedSigners,s=n;s!=null&&s.length===1&&(s[0].type==="server"||s[0].type==="external-wallet")&&(s=i.signers);let o=t.type==="server"&&"address"in t&&!("secret"in t)?t.address:void 0,c=(n!=null?n:[]).filter(p=>p.type==="server"&&"address"in p&&!("secret"in p)).map(p=>p.address),d=new E({chain:e.chain,address:r.address,owner:r.owner,options:e.options,alias:e.alias,recovery:a,apiRecoveryServerSignerAddress:o,apiDelegatedServerSignerAddresses:c,signers:s!=null?s:[]},this.apiClient);return yield d.waitForInit(),d})}getWalletLocator(r){return`me:${this.getChainType(r.chain)}:smart`+(r.alias!=null?`:alias:${r.alias}`:"")}createPasskeySigner(r){return y(this,null,function*(){var t;if(r.type!=="passkey")throw new Error("Signer is not a passkey");let e=(t=r.name)!=null?t:`Crossmint Wallet ${Date.now()}`,i=r.onCreatePasskey?yield r.onCreatePasskey(e):yield K.createCredential({name:e});return{type:"passkey",id:i.id,name:e,publicKey:{x:i.publicKey.x.toString(),y:i.publicKey.y.toString()}}})}ensureDeviceSignerInSigners(r){var t;let e=(t=r.signers)!=null?t:[];return e.some(a=>a.type==="device")?e:[...e,{type:"device"}]}validateExistingWalletConfig(r,e){if(e.owner!=null&&r.owner!=null&&A(e.owner)!==A(r.owner))throw new l("Wallet owner does not match existing wallet's linked user");if(e.chain==="solana"&&r.chainType!=="solana"||e.chain!=="solana"&&r.chainType==="solana"||e.chain==="stellar"&&r.chainType!=="stellar"||e.chain!=="stellar"&&r.chainType==="stellar")throw new l(`Wallet chain does not match existing wallet's chain. You must use chain: ${r.chainType}.`);if(r.type!=="smart")return;let i=e;if(i.recovery!=null||i.signers!=null){let t=r.config,a=t==null?void 0:t.adminSigner;if(i.recovery!=null&&a!=null){if(i.recovery.type!==a.type)throw new l("The wallet recovery signer type does not match the existing wallet's recovery signer type");k(i.recovery,a)}let n=i.signers;n!=null&&this.validateSigners(r,n,e.chain)}}validateSigners(r,e,i){let t=r.config,a=t==null?void 0:t.delegatedSigners;if(e.length!==0){if(a==null||a.length===0)throw new l(`${e.length} signer(s) specified, but wallet "${r.address}" has no signers. ${$}`);for(let n of e){let s=a.find(o=>{if(this.isMatchingPasskeySigner(n,o,t)||o.type==="device"&&n.type==="device")return!0;if(n.type==="server"){let{primary:c,legacy:d}=b(n,i,this.apiClient.projectId,this.apiClient.environment);return o.locator===`server:${c.derivedAddress}`||d!=null&&o.locator===`server:${d.derivedAddress}`}return o.locator===W(n)});if(s==null){let o=a.map(c=>c.locator).join(", ");throw new l(`Signer '${n.type}' does not exist in wallet "${r.address}". Available signers: ${o}. ${$}`)}k(n,s)}}}isMatchingPasskeySigner(r,e,i){var a,n;let t=((n=(a=i.delegatedSigners)==null?void 0:a.filter(s=>s.type==="passkey").length)!=null?n:0)+(i.adminSigner.type==="passkey"?1:0);if(r.type==="passkey"){if(r.id==null&&t===1)return e.type==="passkey";if(r.id==null&&t>1)throw new l("When creating a wallet with multiple passkeys, you must provide the passkey ID for each passkey.")}return!1}registerSigners(r,e,i){return y(this,null,function*(){var t;return yield Promise.all((t=r==null?void 0:r.map(a=>y(this,null,function*(){if(a.type==="passkey")return a.id==null?{signer:yield this.createPasskeySigner(a)}:{signer:a};if(a.type==="device"){if(a.publicKey!=null)return{signer:{type:"device",publicKey:a.publicKey,name:a.name}};if(a.locator!=null)return{signer:a.locator};if(i==null)throw new l("Device signer key storage is required for device signers");let n=yield x(i);return{signer:{type:"device",publicKey:n.publicKey,name:n.name}}}if(a.type==="server"&&e!=null){let{derivedAddress:n}=w(a,e,this.apiClient.projectId,this.apiClient.environment);return{signer:`server:${n}`}}return{signer:W(a)}})))!=null?t:[])})}getChainType(r){return r==="solana"?"solana":r==="stellar"?"stellar":"evm"}};v([D({logger:g,methodName:"walletFactory.getWallet",buildContext(r,e){if(typeof e[0]=="string"){let t=e[1];return{walletLocator:e[0],chain:t==null?void 0:t.chain}}let i=e[0];return{chain:i==null?void 0:i.chain}}})],u.prototype,"getWallet",1),v([D({logger:g,methodName:"walletFactory.createWallet",buildContext(r,e){return{chain:e[0].chain}}})],u.prototype,"createWallet",1);export{u as a};
@@ -1 +1 @@
1
- import{a as i}from"./chunk-YSB7XIS7.js";import{v as u}from"./chunk-5OYPWGMX.js";import{a as t}from"./chunk-UBDPBFAR.js";import{a as f,c,g as s}from"./chunk-J3R36SGJ.js";import{isValidStellarAddress as T,WithLoggerContext as g}from"@crossmint/common-sdk-base";var m=409,l=class l extends i{constructor(e){super({chain:e.chain,address:e.address,owner:e.owner,options:i.getOptions(e),alias:e.alias,recovery:i.getRecovery(e),apiRecoveryServerSignerAddress:i.getApiRecoveryServerSignerAddress(e),apiDelegatedServerSignerAddresses:i.getApiDelegatedServerSignerAddresses(e),signer:e.signer,signers:i.getInitialSigners(e)},i.getApiClient(e))}static from(e){if(!T(e.address))throw new Error("Wallet is not a Stellar wallet");return new l(e)}sendTransaction(e){return s(this,null,function*(){var d;t.info("stellarWallet.sendTransaction.start"),yield this.preAuthIfNeeded();let r=yield this.createTransaction(e);if((d=e.options)!=null&&d.prepareOnly)return t.info("stellarWallet.sendTransaction.prepared",{transactionId:r.id}),{hash:void 0,explorerLink:void 0,transactionId:r.id};let a={},n=yield this.approveTransactionAndWait(r.id,a);return t.info("stellarWallet.sendTransaction.success",{transactionId:r.id,hash:n.hash}),n})}upgrade(e){return s(this,null,function*(){t.info("stellarWallet.upgrade.start"),yield this.preAuthIfNeeded();let r=yield this.createWalletLifecycleTransaction("upgrade-wallet",e);if(r!=null){if(e!=null&&e.prepareOnly)return t.info("stellarWallet.upgrade.prepared",{transactionId:r}),{hash:void 0,explorerLink:void 0,transactionId:r};yield this.approveTransactionAndWait(r),t.info("stellarWallet.upgrade.phase1.success",{transactionId:r})}else t.info("stellarWallet.upgrade.phase1.skipped",{reason:"wallet already locked from a prior upgrade"});let a=yield this.migrateInternal({signer:e==null?void 0:e.signer,prepareOnly:e==null?void 0:e.prepareOnly});return t.info("stellarWallet.upgrade.success",{transactionId:a.transactionId,hash:a.hash}),a})}migrate(e){return s(this,null,function*(){return yield this.preAuthIfNeeded(),yield this.migrateInternal(e)})}migrateInternal(e){return s(this,null,function*(){t.info("stellarWallet.migrate.start");let r=yield this.createWalletLifecycleTransaction("migrate-wallet",e);if(r==null)throw new u("Failed to create migrate-wallet transaction");if(e!=null&&e.prepareOnly)return t.info("stellarWallet.migrate.prepared",{transactionId:r}),{hash:void 0,explorerLink:void 0,transactionId:r};let a=yield this.approveTransactionAndWait(r);return t.info("stellarWallet.migrate.success",{transactionId:r,hash:a.hash}),a})}createTransaction(e){return s(this,null,function*(){let{contractId:r,options:a}=e,n=this.resolveStellarSigner(a==null?void 0:a.signer),d="transaction"in e?{type:"serialized-transaction",serializedTransaction:e.transaction,contractId:r}:{type:"contract-call",contractId:r,method:e.method,memo:e.memo!=null?{type:"text",value:e.memo}:void 0,args:e.args},p=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:d,signer:n}});if("error"in p)throw new u(JSON.stringify(p));return p})}createWalletLifecycleTransaction(e,r){return s(this,null,function*(){let a=(r==null?void 0:r.signer)!=null?this.resolveStellarSigner(r.signer):void 0,n=yield this.apiClient.createTransaction(this.walletLocator,{params:f({transaction:{type:e}},a!=null?{signer:a}:{})});if("error"in n){if(e==="upgrade-wallet"&&y(n))return null;throw new u(JSON.stringify(n))}return n.id})}resolveStellarSigner(e){return e==null?this.requireSigner().locator():typeof e=="string"?e:this.resolveServerSignerApiLocator(e)}};c([g({logger:t,methodName:"stellarWallet.sendTransaction",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"sendTransaction",1),c([g({logger:t,methodName:"stellarWallet.upgrade",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"upgrade",1),c([g({logger:t,methodName:"stellarWallet.migrate",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"migrate",1);var h=l;function y(o){return typeof o=="object"&&o!==null&&"statusCode"in o&&o.statusCode===m}export{h as a};
1
+ import{a as i}from"./chunk-FLYEGDDE.js";import{v as u}from"./chunk-5OYPWGMX.js";import{a as t}from"./chunk-CHX7PG2J.js";import{a as f,c,g as s}from"./chunk-J3R36SGJ.js";import{isValidStellarAddress as T,WithLoggerContext as g}from"@crossmint/common-sdk-base";var m=409,l=class l extends i{constructor(e){super({chain:e.chain,address:e.address,owner:e.owner,options:i.getOptions(e),alias:e.alias,recovery:i.getRecovery(e),apiRecoveryServerSignerAddress:i.getApiRecoveryServerSignerAddress(e),apiDelegatedServerSignerAddresses:i.getApiDelegatedServerSignerAddresses(e),signer:e.signer,signers:i.getInitialSigners(e)},i.getApiClient(e))}static from(e){if(!T(e.address))throw new Error("Wallet is not a Stellar wallet");return new l(e)}sendTransaction(e){return s(this,null,function*(){var d;t.info("stellarWallet.sendTransaction.start"),yield this.preAuthIfNeeded();let r=yield this.createTransaction(e);if((d=e.options)!=null&&d.prepareOnly)return t.info("stellarWallet.sendTransaction.prepared",{transactionId:r.id}),{hash:void 0,explorerLink:void 0,transactionId:r.id};let a={},n=yield this.approveTransactionAndWait(r.id,a);return t.info("stellarWallet.sendTransaction.success",{transactionId:r.id,hash:n.hash}),n})}upgrade(e){return s(this,null,function*(){t.info("stellarWallet.upgrade.start"),yield this.preAuthIfNeeded();let r=yield this.createWalletLifecycleTransaction("upgrade-wallet",e);if(r!=null){if(e!=null&&e.prepareOnly)return t.info("stellarWallet.upgrade.prepared",{transactionId:r}),{hash:void 0,explorerLink:void 0,transactionId:r};yield this.approveTransactionAndWait(r),t.info("stellarWallet.upgrade.phase1.success",{transactionId:r})}else t.info("stellarWallet.upgrade.phase1.skipped",{reason:"wallet already locked from a prior upgrade"});let a=yield this.migrateInternal({signer:e==null?void 0:e.signer,prepareOnly:e==null?void 0:e.prepareOnly});return t.info("stellarWallet.upgrade.success",{transactionId:a.transactionId,hash:a.hash}),a})}migrate(e){return s(this,null,function*(){return yield this.preAuthIfNeeded(),yield this.migrateInternal(e)})}migrateInternal(e){return s(this,null,function*(){t.info("stellarWallet.migrate.start");let r=yield this.createWalletLifecycleTransaction("migrate-wallet",e);if(r==null)throw new u("Failed to create migrate-wallet transaction");if(e!=null&&e.prepareOnly)return t.info("stellarWallet.migrate.prepared",{transactionId:r}),{hash:void 0,explorerLink:void 0,transactionId:r};let a=yield this.approveTransactionAndWait(r);return t.info("stellarWallet.migrate.success",{transactionId:r,hash:a.hash}),a})}createTransaction(e){return s(this,null,function*(){let{contractId:r,options:a}=e,n=this.resolveStellarSigner(a==null?void 0:a.signer),d="transaction"in e?{type:"serialized-transaction",serializedTransaction:e.transaction,contractId:r}:{type:"contract-call",contractId:r,method:e.method,memo:e.memo!=null?{type:"text",value:e.memo}:void 0,args:e.args},p=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:d,signer:n}});if("error"in p)throw new u(JSON.stringify(p));return p})}createWalletLifecycleTransaction(e,r){return s(this,null,function*(){let a=(r==null?void 0:r.signer)!=null?this.resolveStellarSigner(r.signer):void 0,n=yield this.apiClient.createTransaction(this.walletLocator,{params:f({transaction:{type:e}},a!=null?{signer:a}:{})});if("error"in n){if(e==="upgrade-wallet"&&y(n))return null;throw new u(JSON.stringify(n))}return n.id})}resolveStellarSigner(e){return e==null?this.requireSigner().locator():typeof e=="string"?e:this.resolveServerSignerApiLocator(e)}};c([g({logger:t,methodName:"stellarWallet.sendTransaction",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"sendTransaction",1),c([g({logger:t,methodName:"stellarWallet.upgrade",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"upgrade",1),c([g({logger:t,methodName:"stellarWallet.migrate",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"migrate",1);var h=l;function y(o){return typeof o=="object"&&o!==null&&"statusCode"in o&&o.statusCode===m}export{h as a};
@@ -1 +1 @@
1
- import{a as S}from"./chunk-6X5JEJD7.js";import{a as l}from"./chunk-4GEG5JA6.js";import{a as i}from"./chunk-RWQ6ZQST.js";import{a as t}from"./chunk-PG7BGWKX.js";import{a as C}from"./chunk-EE4ITUGS.js";import{a as u}from"./chunk-CKZYSQOK.js";import{a as p}from"./chunk-QVTKTDED.js";import{a as s}from"./chunk-XS5B3TUE.js";import{a as m}from"./chunk-M335XCYO.js";import{a as g}from"./chunk-YH7G2U6V.js";import{a as o}from"./chunk-2O6HQK34.js";import{g as a}from"./chunk-5OYPWGMX.js";function V(r,e,n){switch(e.type){case"email":case"phone":return r==="solana"?new t(e):r==="stellar"?new l(e):new i(e);case"api-key":return r==="solana"?new g(e):new p(e);case"external-wallet":return r==="solana"?new o(e):r==="stellar"?new C(e):new s(e);case"server":return S(r,e);case"passkey":return new m(e);case"device":if(n==null)throw new a("Device signer key storage is required for device signers");return new u(e,n)}}export{V as a};
1
+ import{a as S}from"./chunk-6X5JEJD7.js";import{a as l}from"./chunk-SGGIB3UV.js";import{a as i}from"./chunk-HVBMGZ2A.js";import{a as t}from"./chunk-OWGOD5IM.js";import{a as C}from"./chunk-EE4ITUGS.js";import{a as u}from"./chunk-CKZYSQOK.js";import{a as p}from"./chunk-QVTKTDED.js";import{a as s}from"./chunk-XS5B3TUE.js";import{a as m}from"./chunk-M335XCYO.js";import{a as g}from"./chunk-YH7G2U6V.js";import{a as o}from"./chunk-2O6HQK34.js";import{g as a}from"./chunk-5OYPWGMX.js";function V(r,e,n){switch(e.type){case"email":case"phone":return r==="solana"?new t(e):r==="stellar"?new l(e):new i(e);case"api-key":return r==="solana"?new g(e):new p(e);case"external-wallet":return r==="solana"?new o(e):r==="stellar"?new C(e):new s(e);case"server":return S(r,e);case"passkey":return new m(e);case"device":if(n==null)throw new a("Device signer key storage is required for device signers");return new u(e,n)}}export{V as a};
@@ -1 +1 @@
1
- import{a as v}from"./chunk-IOSADDL5.js";import{a as l}from"./chunk-UBDPBFAR.js";import{c as d,g as n}from"./chunk-J3R36SGJ.js";import{getEnvironmentForKey as E,APIKeyEnvironmentPrefix as h,WithLoggerContext as u}from"@crossmint/common-sdk-base";import{WebAuthnP256 as w}from"ox";var b={[h.DEVELOPMENT]:"https://development.devicekey.store",[h.STAGING]:"https://staging.devicekey.store",[h.PRODUCTION]:"https://devicekey.store"},P=6e4,K="indexeddb-fatal",c=class extends v{constructor(e){super(e);this.iframePromise=null;this.reloading=null;this.biometricRequestHandler=null;this.biometricListener=null;let r=E(e);if(r==null)throw new Error("Unable to determine environment from API key");this.iframeUrl=b[r]}setBiometricRequestHandler(e){this.biometricRequestHandler=e}generateKey(){return n(this,arguments,function*(e={biometricPolicy:"none"}){return(yield this.rpc("generateKey",e)).publicKeyBase64})}mapAddressToKey(e,r){return n(this,null,function*(){yield this.rpc("mapAddressToKey",{address:e,publicKeyBase64:r})})}getKey(e){return n(this,null,function*(){return(yield this.rpc("getKey",{address:e})).publicKeyBase64})}hasKey(e){return n(this,null,function*(){return(yield this.rpc("hasKey",{publicKeyBase64:e})).hasKey})}signMessage(e,r){return n(this,null,function*(){return yield this.rpc("signMessage",{address:e,message:r})})}deleteKey(e){return n(this,null,function*(){yield this.rpc("deleteKey",{address:e})})}destroy(){this.biometricListener!=null&&(window.removeEventListener("message",this.biometricListener),this.biometricListener=null),this.iframePromise!=null&&(this.iframePromise.then(e=>e.remove()).catch(()=>{}),this.iframePromise=null)}rpc(e,r){return n(this,null,function*(){let i=yield this.sendRpc(e,r);if(i.fatal){l.warn(`[IframeDeviceSignerKeyStorage] Recoverable IDB error on "${e}", reloading iframe and retrying`),yield this.reloadIframe();let t=yield this.sendRpc(e,r);if(t.fatal)throw new Error(`Device signer IDB fatal error on "${e}" persisted after iframe reload`);return t.value}return i.value})}sendRpc(e,r){return n(this,null,function*(){let t=(yield this.getIframe()).contentWindow;if(t==null)throw new Error("Device signer iframe has no contentWindow");let g=crypto.randomUUID(),a=new URL(this.iframeUrl).origin;return new Promise((s,o)=>{let f=setTimeout(()=>{window.removeEventListener("message",p),o(new Error(`Device signer RPC "${e}" timed out after ${P}ms`))},P);function p(y){let m=y.data;m==null||m.id!==g||y.origin===a&&(clearTimeout(f),window.removeEventListener("message",p),m.type==="error"&&m.code===K?s({fatal:!0}):m.type==="error"?o(new Error(m.error)):s({value:m.result,fatal:!1}))}window.addEventListener("message",p),t.postMessage({type:e,id:g,payload:r},this.iframeUrl)})})}reloadIframe(){return n(this,null,function*(){if(this.reloading!=null)return this.reloading;let e=n(this,null,function*(){try{this.destroy(),yield this.getIframe()}finally{this.reloading=null}});return this.reloading=e,e})}setupBiometricListener(e){let r=new URL(this.iframeUrl).origin;this.biometricListener=i=>n(this,null,function*(){if(i.origin!==r)return;let t=i.data;if((t==null?void 0:t.type)!=="biometric-request")return;let g=e.contentWindow;if(g!=null)try{this.biometricRequestHandler!=null&&(yield this.biometricRequestHandler(t.action));let a=null;if(t.action==="createCredential"){let s=t.payload,o=yield w.createCredential({name:s.name});a={id:o.id,publicKey:{x:`0x${o.publicKey.x.toString(16)}`,y:`0x${o.publicKey.y.toString(16)}`}}}else if(t.action==="sign"){let s=t.payload,{signature:o,metadata:f}=yield w.sign({credentialId:s.credentialId,challenge:s.challenge});a={signature:{r:`0x${o.r.toString(16)}`,s:`0x${o.s.toString(16)}`},metadata:f}}g.postMessage({type:"biometric-response",id:t.id,result:a},this.iframeUrl)}catch(a){let s=a instanceof Error?a.message:"Unknown biometric error";g.postMessage({type:"biometric-response",id:t.id,error:s},this.iframeUrl)}}),window.addEventListener("message",this.biometricListener)}getIframe(){return this.iframePromise==null&&(this.iframePromise=this.createIframe().catch(e=>{throw this.iframePromise=null,e})),this.iframePromise}createIframe(){let e=document.createElement("iframe");return e.src=this.iframeUrl,Object.assign(e.style,{position:"absolute",opacity:"0",pointerEvents:"none",width:"0",height:"0",border:"none",top:"-9999px",left:"-9999px"}),new Promise((r,i)=>{e.onload=()=>{this.setupBiometricListener(e),r(e)},e.onerror=()=>i(new Error("Failed to load device signer iframe")),document.body.appendChild(e)})}getDeviceName(){var t;if(typeof navigator=="undefined")return"Unknown Device";let e=navigator.userAgent,r=this.parseDevice(e),i=this.parseBrowser(e);return r!=null&&i!=null?`${i} on ${r}`:(t=r!=null?r:i)!=null?t:"Unknown Device"}parseDevice(e){return/iPad/.test(e)?"iPad":/iPhone/.test(e)?"iPhone":/Macintosh|Mac OS X/.test(e)?"Mac":/Windows/.test(e)?"Windows":/Android/.test(e)?"Android":/Linux/.test(e)?"Linux":/CrOS/.test(e)?"ChromeOS":null}parseBrowser(e){return/Edg\//.test(e)?"Edge":/OPR\/|Opera/.test(e)?"Opera":typeof navigator!="undefined"&&"brave"in navigator?"Brave":/Chrome\//.test(e)?"Chrome":/Safari\//.test(e)&&!/Chrome\//.test(e)?"Safari":/Firefox\//.test(e)?"Firefox":null}};d([u({logger:l,methodName:"deviceSignerKeyStorage.generateKey"})],c.prototype,"generateKey",1),d([u({logger:l,methodName:"deviceSignerKeyStorage.mapAddressToKey"})],c.prototype,"mapAddressToKey",1),d([u({logger:l,methodName:"deviceSignerKeyStorage.getKey"})],c.prototype,"getKey",1),d([u({logger:l,methodName:"deviceSignerKeyStorage.hasKey"})],c.prototype,"hasKey",1),d([u({logger:l,methodName:"deviceSignerKeyStorage.signMessage"})],c.prototype,"signMessage",1),d([u({logger:l,methodName:"deviceSignerKeyStorage.deleteKey"})],c.prototype,"deleteKey",1);export{c as a};
1
+ import{a as v}from"./chunk-IOSADDL5.js";import{a as l}from"./chunk-CHX7PG2J.js";import{c as d,g as n}from"./chunk-J3R36SGJ.js";import{getEnvironmentForKey as E,APIKeyEnvironmentPrefix as h,WithLoggerContext as u}from"@crossmint/common-sdk-base";import{WebAuthnP256 as w}from"ox";var b={[h.DEVELOPMENT]:"https://development.devicekey.store",[h.STAGING]:"https://staging.devicekey.store",[h.PRODUCTION]:"https://devicekey.store"},P=6e4,K="indexeddb-fatal",c=class extends v{constructor(e){super(e);this.iframePromise=null;this.reloading=null;this.biometricRequestHandler=null;this.biometricListener=null;let r=E(e);if(r==null)throw new Error("Unable to determine environment from API key");this.iframeUrl=b[r]}setBiometricRequestHandler(e){this.biometricRequestHandler=e}generateKey(){return n(this,arguments,function*(e={biometricPolicy:"none"}){return(yield this.rpc("generateKey",e)).publicKeyBase64})}mapAddressToKey(e,r){return n(this,null,function*(){yield this.rpc("mapAddressToKey",{address:e,publicKeyBase64:r})})}getKey(e){return n(this,null,function*(){return(yield this.rpc("getKey",{address:e})).publicKeyBase64})}hasKey(e){return n(this,null,function*(){return(yield this.rpc("hasKey",{publicKeyBase64:e})).hasKey})}signMessage(e,r){return n(this,null,function*(){return yield this.rpc("signMessage",{address:e,message:r})})}deleteKey(e){return n(this,null,function*(){yield this.rpc("deleteKey",{address:e})})}destroy(){this.biometricListener!=null&&(window.removeEventListener("message",this.biometricListener),this.biometricListener=null),this.iframePromise!=null&&(this.iframePromise.then(e=>e.remove()).catch(()=>{}),this.iframePromise=null)}rpc(e,r){return n(this,null,function*(){let i=yield this.sendRpc(e,r);if(i.fatal){l.warn(`[IframeDeviceSignerKeyStorage] Recoverable IDB error on "${e}", reloading iframe and retrying`),yield this.reloadIframe();let t=yield this.sendRpc(e,r);if(t.fatal)throw new Error(`Device signer IDB fatal error on "${e}" persisted after iframe reload`);return t.value}return i.value})}sendRpc(e,r){return n(this,null,function*(){let t=(yield this.getIframe()).contentWindow;if(t==null)throw new Error("Device signer iframe has no contentWindow");let g=crypto.randomUUID(),a=new URL(this.iframeUrl).origin;return new Promise((s,o)=>{let f=setTimeout(()=>{window.removeEventListener("message",p),o(new Error(`Device signer RPC "${e}" timed out after ${P}ms`))},P);function p(y){let m=y.data;m==null||m.id!==g||y.origin===a&&(clearTimeout(f),window.removeEventListener("message",p),m.type==="error"&&m.code===K?s({fatal:!0}):m.type==="error"?o(new Error(m.error)):s({value:m.result,fatal:!1}))}window.addEventListener("message",p),t.postMessage({type:e,id:g,payload:r},this.iframeUrl)})})}reloadIframe(){return n(this,null,function*(){if(this.reloading!=null)return this.reloading;let e=n(this,null,function*(){try{this.destroy(),yield this.getIframe()}finally{this.reloading=null}});return this.reloading=e,e})}setupBiometricListener(e){let r=new URL(this.iframeUrl).origin;this.biometricListener=i=>n(this,null,function*(){if(i.origin!==r)return;let t=i.data;if((t==null?void 0:t.type)!=="biometric-request")return;let g=e.contentWindow;if(g!=null)try{this.biometricRequestHandler!=null&&(yield this.biometricRequestHandler(t.action));let a=null;if(t.action==="createCredential"){let s=t.payload,o=yield w.createCredential({name:s.name});a={id:o.id,publicKey:{x:`0x${o.publicKey.x.toString(16)}`,y:`0x${o.publicKey.y.toString(16)}`}}}else if(t.action==="sign"){let s=t.payload,{signature:o,metadata:f}=yield w.sign({credentialId:s.credentialId,challenge:s.challenge});a={signature:{r:`0x${o.r.toString(16)}`,s:`0x${o.s.toString(16)}`},metadata:f}}g.postMessage({type:"biometric-response",id:t.id,result:a},this.iframeUrl)}catch(a){let s=a instanceof Error?a.message:"Unknown biometric error";g.postMessage({type:"biometric-response",id:t.id,error:s},this.iframeUrl)}}),window.addEventListener("message",this.biometricListener)}getIframe(){return this.iframePromise==null&&(this.iframePromise=this.createIframe().catch(e=>{throw this.iframePromise=null,e})),this.iframePromise}createIframe(){let e=document.createElement("iframe");return e.src=this.iframeUrl,Object.assign(e.style,{position:"absolute",opacity:"0",pointerEvents:"none",width:"0",height:"0",border:"none",top:"-9999px",left:"-9999px"}),new Promise((r,i)=>{e.onload=()=>{this.setupBiometricListener(e),r(e)},e.onerror=()=>i(new Error("Failed to load device signer iframe")),document.body.appendChild(e)})}getDeviceName(){var t;if(typeof navigator=="undefined")return"Unknown Device";let e=navigator.userAgent,r=this.parseDevice(e),i=this.parseBrowser(e);return r!=null&&i!=null?`${i} on ${r}`:(t=r!=null?r:i)!=null?t:"Unknown Device"}parseDevice(e){return/iPad/.test(e)?"iPad":/iPhone/.test(e)?"iPhone":/Macintosh|Mac OS X/.test(e)?"Mac":/Windows/.test(e)?"Windows":/Android/.test(e)?"Android":/Linux/.test(e)?"Linux":/CrOS/.test(e)?"ChromeOS":null}parseBrowser(e){return/Edg\//.test(e)?"Edge":/OPR\/|Opera/.test(e)?"Opera":typeof navigator!="undefined"&&"brave"in navigator?"Brave":/Chrome\//.test(e)?"Chrome":/Safari\//.test(e)&&!/Chrome\//.test(e)?"Safari":/Firefox\//.test(e)?"Firefox":null}};d([u({logger:l,methodName:"deviceSignerKeyStorage.generateKey"})],c.prototype,"generateKey",1),d([u({logger:l,methodName:"deviceSignerKeyStorage.mapAddressToKey"})],c.prototype,"mapAddressToKey",1),d([u({logger:l,methodName:"deviceSignerKeyStorage.getKey"})],c.prototype,"getKey",1),d([u({logger:l,methodName:"deviceSignerKeyStorage.hasKey"})],c.prototype,"hasKey",1),d([u({logger:l,methodName:"deviceSignerKeyStorage.signMessage"})],c.prototype,"signMessage",1),d([u({logger:l,methodName:"deviceSignerKeyStorage.deleteKey"})],c.prototype,"deleteKey",1);export{c as a};
@@ -1 +1 @@
1
- import{a as o}from"./chunk-5OYPWGMX.js";import{a}from"./chunk-UBDPBFAR.js";import{b as p,c}from"./chunk-XX6FO5QS.js";import{g as t}from"./chunk-J3R36SGJ.js";import{APIKeyEnvironmentPrefix as d,APIKeyUsageOrigin as g,CrossmintApiClient as P}from"@crossmint/common-sdk-base";var h=class extends P{constructor(e){super(e,{internalConfig:{sdkMetadata:{name:c,version:p}}});this.apiPrefix="api/2025-06-09/wallets";this.unstableApiPrefix="api/unstable/wallets"}createWallet(e){return t(this,null,function*(){let s=this.isServerSide?`${this.apiPrefix}`:`${this.apiPrefix}/me`;a.info("wallets.api.createWallet",{chainType:e.chainType,walletType:e.type});let n=yield(yield this.post(s,{body:JSON.stringify(e),headers:this.headers})).json();return"error"in n?a.error("wallets.api.createWallet.error",{error:n.error,chainType:e.chainType}):"address"in n&&a.info("wallets.api.createWallet.success",{address:n.address,chainType:e.chainType}),n})}getWallet(e){return t(this,null,function*(){a.info("wallets.api.getWallet",{locator:e});let r=yield(yield this.get(`${this.apiPrefix}/${e}`,{headers:this.headers})).json();return"error"in r?a.warn("wallets.api.getWallet.error",{locator:e,error:r.error}):"address"in r&&a.info("wallets.api.getWallet.success",{address:r.address,locator:e}),r})}createTransaction(e,s){return t(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveTransaction(e,s,r){return t(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions/${s}/approvals`,{body:JSON.stringify(r),headers:this.headers})).json()})}getTransaction(e,s){return t(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions/${s}`,{headers:this.headers})).json()})}createSignature(e,s){return t(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signatures`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveSignature(e,s,r){return t(this,null,function*(){let n=yield this.post(`${this.apiPrefix}/${e}/signatures/${s}/approvals`,{body:JSON.stringify(r),headers:this.headers});return n.status===422?this.getSignature(e,s):n.json()})}getSignature(e,s){return t(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/signatures/${s}`,{headers:this.headers})).json()})}getTransactions(e){return t(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions`,{headers:this.headers})).json()})}getNfts(e){return t(this,null,function*(){let s=new URLSearchParams;s.append("page",e.page.toString()),s.append("perPage",e.perPage.toString());let r=`${e.chain}:${e.address}`;return(yield this.get(`${this.apiPrefix}/${r}/nfts?${s.toString()}`,{headers:this.headers})).json()})}getTransfers(e,s){return t(this,null,function*(){let r=new URLSearchParams;return r.append("chain",s.chain.toString()),s.tokens!=null&&r.append("tokens",s.tokens),r.append("status",s.status),(yield this.get(`${this.unstableApiPrefix}/${e}/transfers?${r.toString()}`,{headers:this.headers})).json()})}getBalance(e,s){return t(this,null,function*(){let r=new URLSearchParams;return r.append("tokens",s.tokens.join(",")),r.append("chains",s.chains.join(",")),(yield this.get(`${this.apiPrefix}/${e}/balances?${r.toString()}`,{headers:this.headers})).json()})}fundWallet(e,s){return t(this,null,function*(){if(this.environment===d.PRODUCTION)throw new Error("Funding wallets is only supported in staging environment");return(yield this.post(`api/v1-alpha2/wallets/${e}/balances`,{body:JSON.stringify(s),headers:this.headers})).json()})}registerSigner(e,s){return t(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signers`,{body:JSON.stringify(s),headers:this.headers})).json()})}removeSigner(e,s,r){return t(this,null,function*(){let n=encodeURIComponent(s),i=new URLSearchParams;r.chain&&i.append("chain",r.chain);let l=`${this.apiPrefix}/${e}/signers/${n}${i.size>0?`?${i.toString()}`:""}`;return(yield this.delete(l,{headers:this.headers})).json()})}getSigner(e,s){return t(this,null,function*(){let r=encodeURIComponent(s);return(yield this.get(`${this.apiPrefix}/${e}/signers/${r}`,{headers:this.headers})).json()})}send(e,s,r){return t(this,null,function*(){a.info("wallets.api.send",{walletLocator:e,tokenLocator:s,recipient:r.recipient});let i=yield(yield this.post(`${this.apiPrefix}/${e}/tokens/${s}/transfers`,{body:JSON.stringify(r),headers:this.headers})).json();return"error"in i?a.error("wallets.api.send.error",{walletLocator:e,tokenLocator:s,error:i.error}):"id"in i&&a.info("wallets.api.send.success",{walletLocator:e,transactionId:i.id}),i})}get isServerSide(){return this.parsedAPIKey.usageOrigin===g.SERVER}get environment(){if(!this.parsedAPIKey.isValid)throw new o("Invalid API key");return this.parsedAPIKey.environment}get projectId(){if(!this.parsedAPIKey.isValid)throw new o("Invalid API key");return this.parsedAPIKey.projectId}get headers(){return{"Content-Type":"application/json"}}};export{h as a};
1
+ import{a as o}from"./chunk-5OYPWGMX.js";import{a}from"./chunk-CHX7PG2J.js";import{b as p,c}from"./chunk-2323NR6Y.js";import{g as t}from"./chunk-J3R36SGJ.js";import{APIKeyEnvironmentPrefix as d,APIKeyUsageOrigin as g,CrossmintApiClient as P}from"@crossmint/common-sdk-base";var h=class extends P{constructor(e){super(e,{internalConfig:{sdkMetadata:{name:c,version:p}}});this.apiPrefix="api/2025-06-09/wallets";this.unstableApiPrefix="api/unstable/wallets"}createWallet(e){return t(this,null,function*(){let s=this.isServerSide?`${this.apiPrefix}`:`${this.apiPrefix}/me`;a.info("wallets.api.createWallet",{chainType:e.chainType,walletType:e.type});let n=yield(yield this.post(s,{body:JSON.stringify(e),headers:this.headers})).json();return"error"in n?a.error("wallets.api.createWallet.error",{error:n.error,chainType:e.chainType}):"address"in n&&a.info("wallets.api.createWallet.success",{address:n.address,chainType:e.chainType}),n})}getWallet(e){return t(this,null,function*(){a.info("wallets.api.getWallet",{locator:e});let r=yield(yield this.get(`${this.apiPrefix}/${e}`,{headers:this.headers})).json();return"error"in r?a.warn("wallets.api.getWallet.error",{locator:e,error:r.error}):"address"in r&&a.info("wallets.api.getWallet.success",{address:r.address,locator:e}),r})}createTransaction(e,s){return t(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveTransaction(e,s,r){return t(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions/${s}/approvals`,{body:JSON.stringify(r),headers:this.headers})).json()})}getTransaction(e,s){return t(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions/${s}`,{headers:this.headers})).json()})}createSignature(e,s){return t(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signatures`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveSignature(e,s,r){return t(this,null,function*(){let n=yield this.post(`${this.apiPrefix}/${e}/signatures/${s}/approvals`,{body:JSON.stringify(r),headers:this.headers});return n.status===422?this.getSignature(e,s):n.json()})}getSignature(e,s){return t(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/signatures/${s}`,{headers:this.headers})).json()})}getTransactions(e){return t(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions`,{headers:this.headers})).json()})}getNfts(e){return t(this,null,function*(){let s=new URLSearchParams;s.append("page",e.page.toString()),s.append("perPage",e.perPage.toString());let r=`${e.chain}:${e.address}`;return(yield this.get(`${this.apiPrefix}/${r}/nfts?${s.toString()}`,{headers:this.headers})).json()})}getTransfers(e,s){return t(this,null,function*(){let r=new URLSearchParams;return r.append("chain",s.chain.toString()),s.tokens!=null&&r.append("tokens",s.tokens),r.append("status",s.status),(yield this.get(`${this.unstableApiPrefix}/${e}/transfers?${r.toString()}`,{headers:this.headers})).json()})}getBalance(e,s){return t(this,null,function*(){let r=new URLSearchParams;return r.append("tokens",s.tokens.join(",")),r.append("chains",s.chains.join(",")),(yield this.get(`${this.apiPrefix}/${e}/balances?${r.toString()}`,{headers:this.headers})).json()})}fundWallet(e,s){return t(this,null,function*(){if(this.environment===d.PRODUCTION)throw new Error("Funding wallets is only supported in staging environment");return(yield this.post(`api/v1-alpha2/wallets/${e}/balances`,{body:JSON.stringify(s),headers:this.headers})).json()})}registerSigner(e,s){return t(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signers`,{body:JSON.stringify(s),headers:this.headers})).json()})}removeSigner(e,s,r){return t(this,null,function*(){let n=encodeURIComponent(s),i=new URLSearchParams;r.chain&&i.append("chain",r.chain);let l=`${this.apiPrefix}/${e}/signers/${n}${i.size>0?`?${i.toString()}`:""}`;return(yield this.delete(l,{headers:this.headers})).json()})}getSigner(e,s){return t(this,null,function*(){let r=encodeURIComponent(s);return(yield this.get(`${this.apiPrefix}/${e}/signers/${r}`,{headers:this.headers})).json()})}send(e,s,r){return t(this,null,function*(){a.info("wallets.api.send",{walletLocator:e,tokenLocator:s,recipient:r.recipient});let i=yield(yield this.post(`${this.apiPrefix}/${e}/tokens/${s}/transfers`,{body:JSON.stringify(r),headers:this.headers})).json();return"error"in i?a.error("wallets.api.send.error",{walletLocator:e,tokenLocator:s,error:i.error}):"id"in i&&a.info("wallets.api.send.success",{walletLocator:e,transactionId:i.id}),i})}get isServerSide(){return this.parsedAPIKey.usageOrigin===g.SERVER}get environment(){if(!this.parsedAPIKey.isValid)throw new o("Invalid API key");return this.parsedAPIKey.environment}get projectId(){if(!this.parsedAPIKey.isValid)throw new o("Invalid API key");return this.parsedAPIKey.projectId}get headers(){return{"Content-Type":"application/json"}}};export{h as a};
@@ -1 +1 @@
1
- import{a as o}from"./chunk-YSB7XIS7.js";import{a as W}from"./chunk-FXCUVWXJ.js";import{n as l,r as f,v as w}from"./chunk-5OYPWGMX.js";import{a as n}from"./chunk-UBDPBFAR.js";import{c as u,g as p}from"./chunk-J3R36SGJ.js";import{createPublicClient as O,encodeFunctionData as x,http as E}from"viem";import{isValidEvmAddress as A,WithLoggerContext as h}from"@crossmint/common-sdk-base";var c=class c 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),apiRecoveryServerSignerAddress:o.getApiRecoveryServerSignerAddress(e),apiDelegatedServerSignerAddresses:o.getApiDelegatedServerSignerAddresses(e),signer:e.signer,signers:o.getInitialSigners(e)},o.getApiClient(e))}static from(e){if(!A(e.address))throw new Error("Wallet is not an EVM wallet");return new c(e)}sendTransaction(e){return p(this,null,function*(){var i;n.info("evmWallet.sendTransaction.start"),yield this.preAuthIfNeeded();let r=this.buildTransaction(e),t=yield this.createTransaction(r,e.options);if((i=e.options)!=null&&i.prepareOnly)return n.info("evmWallet.sendTransaction.prepared",{transactionId:t.id}),{hash:void 0,explorerLink:void 0,transactionId:t.id};let a=yield this.approveTransactionAndWait(t.id);return n.info("evmWallet.sendTransaction.success",{transactionId:t.id,hash:a.hash}),a})}signMessage(e){return p(this,null,function*(){var i;n.info("evmWallet.signMessage.start"),yield this.preAuthIfNeeded();let r=this.requireSigner(),t=yield this.apiClient.createSignature(this.walletLocator,{type:"message",params:{message:e.message,signer:r.locator(),chain:this.chain}});if("error"in t)throw n.error("evmWallet.signMessage.error",{error:t}),new f(JSON.stringify(t));if((i=e.options)!=null&&i.prepareOnly)return n.info("evmWallet.signMessage.prepared",{signatureId:t.id}),{signature:void 0,signatureId:t.id};let a=yield this.approveSignatureAndWait(t.id);return n.info("evmWallet.signMessage.success",{signatureId:t.id}),a})}signTypedData(e){return p(this,null,function*(){var C;n.info("evmWallet.signTypedData.start"),yield this.preAuthIfNeeded();let r=this.requireSigner(),{domain:t,message:a,primaryType:i,types:g,chain:T}=e;if(!t||!a||!g||!T)throw n.error("evmWallet.signTypedData.error",{error:"Invalid typed data"}),new l("Invalid typed data");let{name:m,version:S,chainId:v,verifyingContract:I,salt:D}=t;if(!m||!S||!v||!I)throw n.error("evmWallet.signTypedData.error",{error:"Invalid typed data domain"}),new l("Invalid typed data domain");let d=yield this.apiClient.createSignature(this.walletLocator,{type:"typed-data",params:{typedData:{domain:{name:m,version:S,chainId:Number(v),verifyingContract:I,salt:D},message:y(a),primaryType:i,types:g},signer:r.locator(),chain:T}});if("error"in d)throw n.error("evmWallet.signTypedData.error",{error:d}),new f(JSON.stringify(d));if((C=e.options)!=null&&C.prepareOnly)return n.info("evmWallet.signTypedData.prepared",{signatureId:d.id}),{signature:void 0,signatureId:d.id};let M=yield this.approveSignatureAndWait(d.id);return n.info("evmWallet.signTypedData.success",{signatureId:d.id}),M})}getViemClient(e){var r;return O({transport:(r=e==null?void 0:e.transport)!=null?r:E(),chain:W(this.chain)})}createTransaction(e,r){return p(this,null,function*(){let t;(r==null?void 0:r.signer)==null?t=this.requireSigner().locator():typeof r.signer=="string"?t=r.signer:t=this.resolveServerSignerApiLocator(r.signer);let a=yield this.apiClient.createTransaction(this.walletLocator,{params:{signer:t,chain:this.chain,calls:[e]}});if("error"in a)throw new w(JSON.stringify(a));return a})}buildTransaction(e){var r,t,a,i,g;if("transaction"in e)return{transaction:e.transaction};if(e.abi==null)return{to:e.to,value:(t=(r=e.value)==null?void 0:r.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:(g=(i=e.value)==null?void 0:i.toString())!=null?g:"0",data:x({abi:e.abi,functionName:e.functionName,args:e.args})}}};u([h({logger:n,methodName:"evmWallet.sendTransaction",buildContext(e){return{chain:e.chain,address:e.address}}})],c.prototype,"sendTransaction",1),u([h({logger:n,methodName:"evmWallet.signMessage",buildContext(e){return{chain:e.chain,address:e.address}}})],c.prototype,"signMessage",1),u([h({logger:n,methodName:"evmWallet.signTypedData",buildContext(e){return{chain:e.chain,address:e.address}}})],c.prototype,"signTypedData",1);var b=c;function y(s){return typeof s=="bigint"?s.toString():Array.isArray(s)?s.map(y):s!==null&&typeof s=="object"?Object.fromEntries(Object.entries(s).map(([e,r])=>[e,y(r)])):s}export{b as a};
1
+ import{a as o}from"./chunk-FLYEGDDE.js";import{a as W}from"./chunk-RMXZH6CG.js";import{n as l,r as f,v as w}from"./chunk-5OYPWGMX.js";import{a as n}from"./chunk-CHX7PG2J.js";import{c as u,g as p}from"./chunk-J3R36SGJ.js";import{createPublicClient as O,encodeFunctionData as x,http as E}from"viem";import{isValidEvmAddress as A,WithLoggerContext as h}from"@crossmint/common-sdk-base";var c=class c 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),apiRecoveryServerSignerAddress:o.getApiRecoveryServerSignerAddress(e),apiDelegatedServerSignerAddresses:o.getApiDelegatedServerSignerAddresses(e),signer:e.signer,signers:o.getInitialSigners(e)},o.getApiClient(e))}static from(e){if(!A(e.address))throw new Error("Wallet is not an EVM wallet");return new c(e)}sendTransaction(e){return p(this,null,function*(){var i;n.info("evmWallet.sendTransaction.start"),yield this.preAuthIfNeeded();let r=this.buildTransaction(e),t=yield this.createTransaction(r,e.options);if((i=e.options)!=null&&i.prepareOnly)return n.info("evmWallet.sendTransaction.prepared",{transactionId:t.id}),{hash:void 0,explorerLink:void 0,transactionId:t.id};let a=yield this.approveTransactionAndWait(t.id);return n.info("evmWallet.sendTransaction.success",{transactionId:t.id,hash:a.hash}),a})}signMessage(e){return p(this,null,function*(){var i;n.info("evmWallet.signMessage.start"),yield this.preAuthIfNeeded();let r=this.requireSigner(),t=yield this.apiClient.createSignature(this.walletLocator,{type:"message",params:{message:e.message,signer:r.locator(),chain:this.chain}});if("error"in t)throw n.error("evmWallet.signMessage.error",{error:t}),new f(JSON.stringify(t));if((i=e.options)!=null&&i.prepareOnly)return n.info("evmWallet.signMessage.prepared",{signatureId:t.id}),{signature:void 0,signatureId:t.id};let a=yield this.approveSignatureAndWait(t.id);return n.info("evmWallet.signMessage.success",{signatureId:t.id}),a})}signTypedData(e){return p(this,null,function*(){var C;n.info("evmWallet.signTypedData.start"),yield this.preAuthIfNeeded();let r=this.requireSigner(),{domain:t,message:a,primaryType:i,types:g,chain:T}=e;if(!t||!a||!g||!T)throw n.error("evmWallet.signTypedData.error",{error:"Invalid typed data"}),new l("Invalid typed data");let{name:m,version:S,chainId:v,verifyingContract:I,salt:D}=t;if(!m||!S||!v||!I)throw n.error("evmWallet.signTypedData.error",{error:"Invalid typed data domain"}),new l("Invalid typed data domain");let d=yield this.apiClient.createSignature(this.walletLocator,{type:"typed-data",params:{typedData:{domain:{name:m,version:S,chainId:Number(v),verifyingContract:I,salt:D},message:y(a),primaryType:i,types:g},signer:r.locator(),chain:T}});if("error"in d)throw n.error("evmWallet.signTypedData.error",{error:d}),new f(JSON.stringify(d));if((C=e.options)!=null&&C.prepareOnly)return n.info("evmWallet.signTypedData.prepared",{signatureId:d.id}),{signature:void 0,signatureId:d.id};let M=yield this.approveSignatureAndWait(d.id);return n.info("evmWallet.signTypedData.success",{signatureId:d.id}),M})}getViemClient(e){var r;return O({transport:(r=e==null?void 0:e.transport)!=null?r:E(),chain:W(this.chain)})}createTransaction(e,r){return p(this,null,function*(){let t;(r==null?void 0:r.signer)==null?t=this.requireSigner().locator():typeof r.signer=="string"?t=r.signer:t=this.resolveServerSignerApiLocator(r.signer);let a=yield this.apiClient.createTransaction(this.walletLocator,{params:{signer:t,chain:this.chain,calls:[e]}});if("error"in a)throw new w(JSON.stringify(a));return a})}buildTransaction(e){var r,t,a,i,g;if("transaction"in e)return{transaction:e.transaction};if(e.abi==null)return{to:e.to,value:(t=(r=e.value)==null?void 0:r.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:(g=(i=e.value)==null?void 0:i.toString())!=null?g:"0",data:x({abi:e.abi,functionName:e.functionName,args:e.args})}}};u([h({logger:n,methodName:"evmWallet.sendTransaction",buildContext(e){return{chain:e.chain,address:e.address}}})],c.prototype,"sendTransaction",1),u([h({logger:n,methodName:"evmWallet.signMessage",buildContext(e){return{chain:e.chain,address:e.address}}})],c.prototype,"signMessage",1),u([h({logger:n,methodName:"evmWallet.signTypedData",buildContext(e){return{chain:e.chain,address:e.address}}})],c.prototype,"signTypedData",1);var b=c;function y(s){return typeof s=="bigint"?s.toString():Array.isArray(s)?s.map(y):s!==null&&typeof s=="object"?Object.fromEntries(Object.entries(s).map(([e,r])=>[e,y(r)])):s}export{b as a};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkKW2623VIcjs = require('./chunk-KW2623VI.cjs');var _chunkYHV3672Rcjs = require('./chunk-YHV3672R.cjs');var _chunkF2HEHICCcjs = require('./chunk-F2HEHICC.cjs');var _chunkCFB27BFVcjs = require('./chunk-CFB27BFV.cjs');var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var _ox = require('ox');var o=class c{constructor(e){_chunkCFB27BFVcjs.b.call(void 0, e.apiKey);let t=new (0, _chunkF2HEHICCcjs.a)(e);this.walletFactory=new (0, _chunkKW2623VIcjs.a)(t),_chunkCFB27BFVcjs.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
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkX6TSCK75cjs = require('./chunk-X6TSCK75.cjs');var _chunkYHV3672Rcjs = require('./chunk-YHV3672R.cjs');var _chunkN3P3SQ33cjs = require('./chunk-N3P3SQ33.cjs');var _chunkXDHGCS4Wcjs = require('./chunk-XDHGCS4W.cjs');var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var _ox = require('ox');var o=class c{constructor(e){_chunkXDHGCS4Wcjs.b.call(void 0, e.apiKey);let t=new (0, _chunkN3P3SQ33cjs.a)(e);this.walletFactory=new (0, _chunkX6TSCK75cjs.a)(t),_chunkXDHGCS4Wcjs.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;
@@ -0,0 +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 _chunkOWQZPI3Ucjs = require('./chunk-OWQZPI3U.cjs');var _chunkXDHGCS4Wcjs = require('./chunk-XDHGCS4W.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var _chains = require('viem/chains');var w=[_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],D=[_commonsdkbase.BlockchainIncludingTestnet.ABSTRACT,_commonsdkbase.BlockchainIncludingTestnet.APECHAIN,_commonsdkbase.BlockchainIncludingTestnet.ARBITRUM,_commonsdkbase.BlockchainIncludingTestnet.ARBITRUMNOVA,_commonsdkbase.BlockchainIncludingTestnet.BASE,_commonsdkbase.BlockchainIncludingTestnet.BSC,_commonsdkbase.BlockchainIncludingTestnet.ETHEREUM,_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 X(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.ETHEREUM:return _chains.mainnet;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 w.includes(t)}function C(t){return D.includes(t)}var Y={[_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.ETHEREUM]:_commonsdkbase.BlockchainIncludingTestnet.ETHEREUM_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 g(t){return Y[t]}function F(t){return t==="solana"||t==="stellar"||I(t)||C(t)}function ee(t,a){if(!F(t))throw new (0, _chunkOWQZPI3Ucjs.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, _chunkOWQZPI3Ucjs.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=g(r);if(n!=null)return _chunkXDHGCS4Wcjs.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;_chunkXDHGCS4Wcjs.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 = X; exports.b = I; exports.c = C; exports.d = g; exports.e = F; exports.f = ee;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBTMBO7VMcjs = require('./chunk-BTMBO7VM.cjs');var _chunkOWQZPI3Ucjs = require('./chunk-OWQZPI3U.cjs');var _chunkCFB27BFVcjs = require('./chunk-CFB27BFV.cjs');var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var m=409,l=class l extends _chunkBTMBO7VMcjs.a{constructor(e){super({chain:e.chain,address:e.address,owner:e.owner,options:_chunkBTMBO7VMcjs.a.getOptions(e),alias:e.alias,recovery:_chunkBTMBO7VMcjs.a.getRecovery(e),apiRecoveryServerSignerAddress:_chunkBTMBO7VMcjs.a.getApiRecoveryServerSignerAddress(e),apiDelegatedServerSignerAddresses:_chunkBTMBO7VMcjs.a.getApiDelegatedServerSignerAddresses(e),signer:e.signer,signers:_chunkBTMBO7VMcjs.a.getInitialSigners(e)},_chunkBTMBO7VMcjs.a.getApiClient(e))}static from(e){if(!_commonsdkbase.isValidStellarAddress.call(void 0, e.address))throw new Error("Wallet is not a Stellar wallet");return new l(e)}sendTransaction(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var d;_chunkCFB27BFVcjs.a.info("stellarWallet.sendTransaction.start"),yield this.preAuthIfNeeded();let r=yield this.createTransaction(e);if((d=e.options)!=null&&d.prepareOnly)return _chunkCFB27BFVcjs.a.info("stellarWallet.sendTransaction.prepared",{transactionId:r.id}),{hash:void 0,explorerLink:void 0,transactionId:r.id};let a={},n=yield this.approveTransactionAndWait(r.id,a);return _chunkCFB27BFVcjs.a.info("stellarWallet.sendTransaction.success",{transactionId:r.id,hash:n.hash}),n})}upgrade(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){_chunkCFB27BFVcjs.a.info("stellarWallet.upgrade.start"),yield this.preAuthIfNeeded();let r=yield this.createWalletLifecycleTransaction("upgrade-wallet",e);if(r!=null){if(e!=null&&e.prepareOnly)return _chunkCFB27BFVcjs.a.info("stellarWallet.upgrade.prepared",{transactionId:r}),{hash:void 0,explorerLink:void 0,transactionId:r};yield this.approveTransactionAndWait(r),_chunkCFB27BFVcjs.a.info("stellarWallet.upgrade.phase1.success",{transactionId:r})}else _chunkCFB27BFVcjs.a.info("stellarWallet.upgrade.phase1.skipped",{reason:"wallet already locked from a prior upgrade"});let a=yield this.migrateInternal({signer:e==null?void 0:e.signer,prepareOnly:e==null?void 0:e.prepareOnly});return _chunkCFB27BFVcjs.a.info("stellarWallet.upgrade.success",{transactionId:a.transactionId,hash:a.hash}),a})}migrate(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return yield this.preAuthIfNeeded(),yield this.migrateInternal(e)})}migrateInternal(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){_chunkCFB27BFVcjs.a.info("stellarWallet.migrate.start");let r=yield this.createWalletLifecycleTransaction("migrate-wallet",e);if(r==null)throw new (0, _chunkOWQZPI3Ucjs.v)("Failed to create migrate-wallet transaction");if(e!=null&&e.prepareOnly)return _chunkCFB27BFVcjs.a.info("stellarWallet.migrate.prepared",{transactionId:r}),{hash:void 0,explorerLink:void 0,transactionId:r};let a=yield this.approveTransactionAndWait(r);return _chunkCFB27BFVcjs.a.info("stellarWallet.migrate.success",{transactionId:r,hash:a.hash}),a})}createTransaction(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let{contractId:r,options:a}=e,n=this.resolveStellarSigner(a==null?void 0:a.signer),d="transaction"in e?{type:"serialized-transaction",serializedTransaction:e.transaction,contractId:r}:{type:"contract-call",contractId:r,method:e.method,memo:e.memo!=null?{type:"text",value:e.memo}:void 0,args:e.args},p=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:d,signer:n}});if("error"in p)throw new (0, _chunkOWQZPI3Ucjs.v)(JSON.stringify(p));return p})}createWalletLifecycleTransaction(e,r){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let a=(r==null?void 0:r.signer)!=null?this.resolveStellarSigner(r.signer):void 0,n=yield this.apiClient.createTransaction(this.walletLocator,{params:_chunk2GKPWQBQcjs.a.call(void 0, {transaction:{type:e}},a!=null?{signer:a}:{})});if("error"in n){if(e==="upgrade-wallet"&&y(n))return null;throw new (0, _chunkOWQZPI3Ucjs.v)(JSON.stringify(n))}return n.id})}resolveStellarSigner(e){return e==null?this.requireSigner().locator():typeof e=="string"?e:this.resolveServerSignerApiLocator(e)}};_chunk2GKPWQBQcjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkCFB27BFVcjs.a,methodName:"stellarWallet.sendTransaction",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"sendTransaction",1),_chunk2GKPWQBQcjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkCFB27BFVcjs.a,methodName:"stellarWallet.upgrade",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"upgrade",1),_chunk2GKPWQBQcjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkCFB27BFVcjs.a,methodName:"stellarWallet.migrate",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"migrate",1);var h=l;function y(o){return typeof o=="object"&&o!==null&&"statusCode"in o&&o.statusCode===m}exports.a = h;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkHF4IRNP6cjs = require('./chunk-HF4IRNP6.cjs');var _chunkOWQZPI3Ucjs = require('./chunk-OWQZPI3U.cjs');var _chunkXDHGCS4Wcjs = require('./chunk-XDHGCS4W.cjs');var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var m=409,l=class l extends _chunkHF4IRNP6cjs.a{constructor(e){super({chain:e.chain,address:e.address,owner:e.owner,options:_chunkHF4IRNP6cjs.a.getOptions(e),alias:e.alias,recovery:_chunkHF4IRNP6cjs.a.getRecovery(e),apiRecoveryServerSignerAddress:_chunkHF4IRNP6cjs.a.getApiRecoveryServerSignerAddress(e),apiDelegatedServerSignerAddresses:_chunkHF4IRNP6cjs.a.getApiDelegatedServerSignerAddresses(e),signer:e.signer,signers:_chunkHF4IRNP6cjs.a.getInitialSigners(e)},_chunkHF4IRNP6cjs.a.getApiClient(e))}static from(e){if(!_commonsdkbase.isValidStellarAddress.call(void 0, e.address))throw new Error("Wallet is not a Stellar wallet");return new l(e)}sendTransaction(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var d;_chunkXDHGCS4Wcjs.a.info("stellarWallet.sendTransaction.start"),yield this.preAuthIfNeeded();let r=yield this.createTransaction(e);if((d=e.options)!=null&&d.prepareOnly)return _chunkXDHGCS4Wcjs.a.info("stellarWallet.sendTransaction.prepared",{transactionId:r.id}),{hash:void 0,explorerLink:void 0,transactionId:r.id};let a={},n=yield this.approveTransactionAndWait(r.id,a);return _chunkXDHGCS4Wcjs.a.info("stellarWallet.sendTransaction.success",{transactionId:r.id,hash:n.hash}),n})}upgrade(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){_chunkXDHGCS4Wcjs.a.info("stellarWallet.upgrade.start"),yield this.preAuthIfNeeded();let r=yield this.createWalletLifecycleTransaction("upgrade-wallet",e);if(r!=null){if(e!=null&&e.prepareOnly)return _chunkXDHGCS4Wcjs.a.info("stellarWallet.upgrade.prepared",{transactionId:r}),{hash:void 0,explorerLink:void 0,transactionId:r};yield this.approveTransactionAndWait(r),_chunkXDHGCS4Wcjs.a.info("stellarWallet.upgrade.phase1.success",{transactionId:r})}else _chunkXDHGCS4Wcjs.a.info("stellarWallet.upgrade.phase1.skipped",{reason:"wallet already locked from a prior upgrade"});let a=yield this.migrateInternal({signer:e==null?void 0:e.signer,prepareOnly:e==null?void 0:e.prepareOnly});return _chunkXDHGCS4Wcjs.a.info("stellarWallet.upgrade.success",{transactionId:a.transactionId,hash:a.hash}),a})}migrate(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return yield this.preAuthIfNeeded(),yield this.migrateInternal(e)})}migrateInternal(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){_chunkXDHGCS4Wcjs.a.info("stellarWallet.migrate.start");let r=yield this.createWalletLifecycleTransaction("migrate-wallet",e);if(r==null)throw new (0, _chunkOWQZPI3Ucjs.v)("Failed to create migrate-wallet transaction");if(e!=null&&e.prepareOnly)return _chunkXDHGCS4Wcjs.a.info("stellarWallet.migrate.prepared",{transactionId:r}),{hash:void 0,explorerLink:void 0,transactionId:r};let a=yield this.approveTransactionAndWait(r);return _chunkXDHGCS4Wcjs.a.info("stellarWallet.migrate.success",{transactionId:r,hash:a.hash}),a})}createTransaction(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let{contractId:r,options:a}=e,n=this.resolveStellarSigner(a==null?void 0:a.signer),d="transaction"in e?{type:"serialized-transaction",serializedTransaction:e.transaction,contractId:r}:{type:"contract-call",contractId:r,method:e.method,memo:e.memo!=null?{type:"text",value:e.memo}:void 0,args:e.args},p=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:d,signer:n}});if("error"in p)throw new (0, _chunkOWQZPI3Ucjs.v)(JSON.stringify(p));return p})}createWalletLifecycleTransaction(e,r){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let a=(r==null?void 0:r.signer)!=null?this.resolveStellarSigner(r.signer):void 0,n=yield this.apiClient.createTransaction(this.walletLocator,{params:_chunk2GKPWQBQcjs.a.call(void 0, {transaction:{type:e}},a!=null?{signer:a}:{})});if("error"in n){if(e==="upgrade-wallet"&&y(n))return null;throw new (0, _chunkOWQZPI3Ucjs.v)(JSON.stringify(n))}return n.id})}resolveStellarSigner(e){return e==null?this.requireSigner().locator():typeof e=="string"?e:this.resolveServerSignerApiLocator(e)}};_chunk2GKPWQBQcjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkXDHGCS4Wcjs.a,methodName:"stellarWallet.sendTransaction",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"sendTransaction",1),_chunk2GKPWQBQcjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkXDHGCS4Wcjs.a,methodName:"stellarWallet.upgrade",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"upgrade",1),_chunk2GKPWQBQcjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkXDHGCS4Wcjs.a,methodName:"stellarWallet.migrate",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"migrate",1);var h=l;function y(o){return typeof o=="object"&&o!==null&&"statusCode"in o&&o.statusCode===m}exports.a = h;
@@ -1 +1 @@
1
- import{a as n}from"./chunk-XEL7JKRY.js";import{a as s}from"./chunk-N4IWDL6M.js";import{a as l}from"./chunk-XCIS2OND.js";import{a,b as i}from"./chunk-UBDPBFAR.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-3LXCIVWG.js";import{a as s}from"./chunk-N4IWDL6M.js";import{a as l}from"./chunk-6TNAINPL.js";import{a,b as i}from"./chunk-CHX7PG2J.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 +1 @@
1
- import{b as n,c as i}from"./chunk-XX6FO5QS.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-2323NR6Y.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};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var n=class extends Error{constructor(){super("Authentication was rejected by the user"),this.name="AuthRejectedError"}},r= exports.b =class extends Error{constructor(t,i){super(t),this.name="OtpValidationError",this.code=i}};function a(e){return e.type==="server"&&!("secret"in e)}function g(e){return e._exportPrivateKey!==void 0}exports.a = n; exports.b = r; exports.c = a; exports.d = g;
@@ -1 +1 @@
1
- import{a as r}from"./chunk-YSB7XIS7.js";import{a as h}from"./chunk-2O6HQK34.js";import{v as S}from"./chunk-5OYPWGMX.js";import{a as t}from"./chunk-UBDPBFAR.js";import{c as u,g as c}from"./chunk-J3R36SGJ.js";import T from"bs58";import{isValidSolanaAddress as y,WithLoggerContext as m}from"@crossmint/common-sdk-base";var o=class o extends r{constructor(e){super({chain:e.chain,address:e.address,owner:e.owner,options:r.getOptions(e),alias:e.alias,recovery:r.getRecovery(e),apiRecoveryServerSignerAddress:r.getApiRecoveryServerSignerAddress(e),apiDelegatedServerSignerAddresses:r.getApiDelegatedServerSignerAddresses(e),signer:e.signer,signers:r.getInitialSigners(e)},r.getApiClient(e))}static from(e){if(!y(e.address))throw new Error("Wallet is not a Solana wallet");return new o(e)}sendTransaction(e){return c(this,null,function*(){var l,p;t.info("solanaWallet.sendTransaction.start"),yield this.preAuthIfNeeded();let n=yield this.createTransaction(e);if((l=e.options)!=null&&l.prepareOnly)return t.info("solanaWallet.sendTransaction.prepared",{transactionId:n.id}),{hash:void 0,explorerLink:void 0,transactionId:n.id};let i={additionalSigners:(p=e.additionalSigners)==null?void 0:p.map(d=>new h({type:"external-wallet",address:d.publicKey.toString(),locator:`external-wallet:${d.publicKey.toString()}`,onSign:g=>(g.sign([d]),Promise.resolve(g))}))},a=yield this.approveTransactionAndWait(n.id,i);return t.info("solanaWallet.sendTransaction.success",{transactionId:n.id,hash:a.hash}),a})}createTransaction(e){return c(this,null,function*(){var a;let n;((a=e.options)==null?void 0:a.signer)==null?n=this.requireSigner().locator():typeof e.options.signer=="string"?n=e.options.signer:n=this.resolveServerSignerApiLocator(e.options.signer);let s;"serializedTransaction"in e?s=e.serializedTransaction:s=T.encode(e.transaction.serialize());let i=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:s,signer:n}});if("error"in i)throw new S(JSON.stringify(i));return i})}};u([m({logger:t,methodName:"solanaWallet.sendTransaction",buildContext(e){return{chain:e.chain,address:e.address}}})],o.prototype,"sendTransaction",1);var f=o;export{f as a};
1
+ import{a as r}from"./chunk-FLYEGDDE.js";import{a as h}from"./chunk-2O6HQK34.js";import{v as S}from"./chunk-5OYPWGMX.js";import{a as t}from"./chunk-CHX7PG2J.js";import{c as u,g as c}from"./chunk-J3R36SGJ.js";import T from"bs58";import{isValidSolanaAddress as y,WithLoggerContext as m}from"@crossmint/common-sdk-base";var o=class o extends r{constructor(e){super({chain:e.chain,address:e.address,owner:e.owner,options:r.getOptions(e),alias:e.alias,recovery:r.getRecovery(e),apiRecoveryServerSignerAddress:r.getApiRecoveryServerSignerAddress(e),apiDelegatedServerSignerAddresses:r.getApiDelegatedServerSignerAddresses(e),signer:e.signer,signers:r.getInitialSigners(e)},r.getApiClient(e))}static from(e){if(!y(e.address))throw new Error("Wallet is not a Solana wallet");return new o(e)}sendTransaction(e){return c(this,null,function*(){var l,p;t.info("solanaWallet.sendTransaction.start"),yield this.preAuthIfNeeded();let n=yield this.createTransaction(e);if((l=e.options)!=null&&l.prepareOnly)return t.info("solanaWallet.sendTransaction.prepared",{transactionId:n.id}),{hash:void 0,explorerLink:void 0,transactionId:n.id};let i={additionalSigners:(p=e.additionalSigners)==null?void 0:p.map(d=>new h({type:"external-wallet",address:d.publicKey.toString(),locator:`external-wallet:${d.publicKey.toString()}`,onSign:g=>(g.sign([d]),Promise.resolve(g))}))},a=yield this.approveTransactionAndWait(n.id,i);return t.info("solanaWallet.sendTransaction.success",{transactionId:n.id,hash:a.hash}),a})}createTransaction(e){return c(this,null,function*(){var a;let n;((a=e.options)==null?void 0:a.signer)==null?n=this.requireSigner().locator():typeof e.options.signer=="string"?n=e.options.signer:n=this.resolveServerSignerApiLocator(e.options.signer);let s;"serializedTransaction"in e?s=e.serializedTransaction:s=T.encode(e.transaction.serialize());let i=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:s,signer:n}});if("error"in i)throw new S(JSON.stringify(i));return i})}};u([m({logger:t,methodName:"solanaWallet.sendTransaction",buildContext(e){return{chain:e.chain,address:e.address}}})],o.prototype,"sendTransaction",1);var f=o;export{f as a};