@crossmint/wallets-sdk 1.15.0 → 1.16.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 (156) hide show
  1. package/dist/api/__tests__/test-utils.cjs +1 -1
  2. package/dist/api/__tests__/test-utils.js +1 -1
  3. package/dist/api/client.cjs +1 -1
  4. package/dist/api/client.js +1 -1
  5. package/dist/api/gen/types.gen.d.cts +66 -22
  6. package/dist/api/gen/types.gen.d.ts +66 -22
  7. package/dist/api/index.cjs +1 -1
  8. package/dist/api/index.js +1 -1
  9. package/dist/chains/adapters/evm.cjs +1 -1
  10. package/dist/chains/adapters/evm.js +1 -1
  11. package/dist/chains/adapters/solana.cjs +1 -1
  12. package/dist/chains/adapters/solana.js +1 -1
  13. package/dist/chains/adapters/stellar.cjs +1 -1
  14. package/dist/chains/adapters/stellar.js +1 -1
  15. package/dist/chains/chain-adapter.cjs +1 -1
  16. package/dist/chains/chain-adapter.js +1 -1
  17. package/dist/chains/chains.cjs +1 -1
  18. package/dist/chains/chains.d.cts +2 -2
  19. package/dist/chains/chains.d.ts +2 -2
  20. package/dist/chains/chains.js +1 -1
  21. package/dist/chains/definitions/arc.cjs +1 -0
  22. package/dist/chains/definitions/arc.d.cts +44 -0
  23. package/dist/chains/definitions/arc.d.ts +44 -0
  24. package/dist/chains/definitions/arc.js +1 -0
  25. package/dist/chains/definitions/celoSepolia.cjs +1 -0
  26. package/dist/chains/definitions/celoSepolia.d.cts +44 -0
  27. package/dist/chains/definitions/celoSepolia.d.ts +44 -0
  28. package/dist/chains/definitions/celoSepolia.js +1 -0
  29. package/dist/chains/definitions/robinhoodChain.cjs +1 -0
  30. package/dist/chains/definitions/robinhoodChain.d.cts +44 -0
  31. package/dist/chains/definitions/robinhoodChain.d.ts +44 -0
  32. package/dist/chains/definitions/robinhoodChain.js +1 -0
  33. package/dist/chains/definitions/robinhoodChainTestnet.cjs +1 -0
  34. package/dist/chains/definitions/robinhoodChainTestnet.d.cts +44 -0
  35. package/dist/chains/definitions/robinhoodChainTestnet.d.ts +44 -0
  36. package/dist/chains/definitions/robinhoodChainTestnet.js +1 -0
  37. package/dist/{chunk-I76IKSS4.js → chunk-24CGMAY3.js} +1 -1
  38. package/dist/{chunk-MXY4ZKZJ.cjs → chunk-2G4Y25AJ.cjs} +1 -1
  39. package/dist/{chunk-P22QL24A.js → chunk-4KOHNUNP.js} +1 -1
  40. package/dist/{chunk-N3HRM33G.cjs → chunk-4R2UUYLC.cjs} +1 -1
  41. package/dist/{chunk-CEP5E7JG.cjs → chunk-53VKI7FJ.cjs} +1 -1
  42. package/dist/{chunk-YFRKZGZ4.js → chunk-5IC6BHP5.js} +1 -1
  43. package/dist/{chunk-YJLJ2IHS.cjs → chunk-5L5MJAFS.cjs} +1 -1
  44. package/dist/{chunk-2VMMA4Y6.cjs → chunk-5SREMYFJ.cjs} +1 -1
  45. package/dist/{chunk-6OUANX4J.js → chunk-62EHAJRH.js} +1 -1
  46. package/dist/{chunk-QP5JU7UO.cjs → chunk-62XSK3ZX.cjs} +1 -1
  47. package/dist/{chunk-3L3U3TID.cjs → chunk-63VNTHGQ.cjs} +1 -1
  48. package/dist/{chunk-MFCNJSCL.js → chunk-66IZJXGV.js} +1 -1
  49. package/dist/{chunk-NYGW4HYK.js → chunk-6T4GBLXY.js} +1 -1
  50. package/dist/{chunk-OVUX5RFT.js → chunk-7CUHY3S4.js} +1 -1
  51. package/dist/{chunk-JMVDYHTG.cjs → chunk-7HOXBHKP.cjs} +1 -1
  52. package/dist/{chunk-S6MOVJXB.js → chunk-A7DA5DSE.js} +1 -1
  53. package/dist/chunk-AUO6R32H.cjs +1 -0
  54. package/dist/{chunk-JNGPW247.js → chunk-AZAIXRGS.js} +1 -1
  55. package/dist/chunk-BHHXVRU6.cjs +1 -0
  56. package/dist/{chunk-WEWCIFFY.js → chunk-BHSOWQOR.js} +1 -1
  57. package/dist/{chunk-IZVYNUFO.cjs → chunk-BJC5DQQ3.cjs} +1 -1
  58. package/dist/{chunk-EH75GTUJ.js → chunk-BKN5HSDC.js} +1 -1
  59. package/dist/{chunk-K55HJTOE.js → chunk-BL7A7ROX.js} +1 -1
  60. package/dist/chunk-C6E6WC4P.js +1 -0
  61. package/dist/chunk-CGQCRDG7.js +1 -0
  62. package/dist/{chunk-Q3JQUVKI.js → chunk-CXWFJGKI.js} +1 -1
  63. package/dist/{chunk-VPDZLVMK.cjs → chunk-D2QNNQ26.cjs} +1 -1
  64. package/dist/chunk-D5IIHIEW.cjs +1 -0
  65. package/dist/{chunk-GAACIEE2.cjs → chunk-DB3TFNM2.cjs} +1 -1
  66. package/dist/{chunk-BEGVH4DX.js → chunk-FBOM4U3X.js} +1 -1
  67. package/dist/chunk-FUZ2TPGD.js +1 -0
  68. package/dist/{chunk-W7IPXUD5.cjs → chunk-IU7J7IPE.cjs} +1 -1
  69. package/dist/{chunk-RMILQMLJ.cjs → chunk-JAWHGOGP.cjs} +1 -1
  70. package/dist/{chunk-4IIZO5PI.cjs → chunk-KQFRFHM4.cjs} +1 -1
  71. package/dist/{chunk-4I5SLLAX.cjs → chunk-KVMPBMNG.cjs} +1 -1
  72. package/dist/{chunk-L7RATGRO.js → chunk-LUUUKDHQ.js} +1 -1
  73. package/dist/chunk-NMUHOXYI.js +1 -0
  74. package/dist/{chunk-RNQMEZIV.js → chunk-NQ3PROUV.js} +1 -1
  75. package/dist/chunk-OQFZL5LI.cjs +1 -0
  76. package/dist/{chunk-W4DR7B3L.cjs → chunk-Q6UT242Q.cjs} +1 -1
  77. package/dist/chunk-QLOW4D2N.js +1 -0
  78. package/dist/{chunk-IXNKZURT.js → chunk-QNM7BGTP.js} +1 -1
  79. package/dist/chunk-QYNWUGXV.js +1 -0
  80. package/dist/{chunk-YHCEO3GD.cjs → chunk-SDXHKREB.cjs} +1 -1
  81. package/dist/{chunk-WIAIJCQ2.cjs → chunk-SP5DQZ6D.cjs} +1 -1
  82. package/dist/chunk-TCDH5Q6Q.cjs +1 -0
  83. package/dist/{chunk-GD5GDQXC.js → chunk-UP6VFZQH.js} +1 -1
  84. package/dist/{chunk-O2BU2KJD.cjs → chunk-UX2FEVDY.cjs} +1 -1
  85. package/dist/{chunk-KYR4ZYRD.js → chunk-V3LZ3MNU.js} +1 -1
  86. package/dist/chunk-V5NY4W5H.js +1 -0
  87. package/dist/{chunk-6KW2HYAX.js → chunk-WJDR3MG5.js} +1 -1
  88. package/dist/{chunk-3TPBVNNF.cjs → chunk-XFCHACH7.cjs} +1 -1
  89. package/dist/{chunk-HOQ2JQHJ.cjs → chunk-Y7P2T5BP.cjs} +1 -1
  90. package/dist/{chunk-IX4EJZH5.js → chunk-YFNCXOVW.js} +1 -1
  91. package/dist/{chunk-4MNSKZHW.cjs → chunk-YWN6HKW7.cjs} +1 -1
  92. package/dist/{chunk-BSZJJNA7.js → chunk-Z4ZDZYZ3.js} +1 -1
  93. package/dist/{chunk-3TJEBF5U.cjs → chunk-ZHGXG7JM.cjs} +1 -1
  94. package/dist/chunk-ZPO3XSWU.cjs +1 -0
  95. package/dist/{chunk-GVRXRDGC.js → chunk-ZSFPKH2C.js} +1 -1
  96. package/dist/{chunk-4L7JP2WL.cjs → chunk-ZUG5ROPF.cjs} +1 -1
  97. package/dist/index.cjs +1 -1
  98. package/dist/index.js +1 -1
  99. package/dist/logger/index.cjs +1 -1
  100. package/dist/logger/index.js +1 -1
  101. package/dist/logger/init.cjs +1 -1
  102. package/dist/logger/init.js +1 -1
  103. package/dist/sdk.cjs +1 -1
  104. package/dist/sdk.js +1 -1
  105. package/dist/signers/descriptors/index.cjs +1 -1
  106. package/dist/signers/descriptors/index.js +1 -1
  107. package/dist/signers/index.cjs +1 -1
  108. package/dist/signers/index.js +1 -1
  109. package/dist/signers/non-custodial/index.cjs +1 -1
  110. package/dist/signers/non-custodial/index.js +1 -1
  111. package/dist/signers/non-custodial/ncs-evm-signer.cjs +1 -1
  112. package/dist/signers/non-custodial/ncs-evm-signer.js +1 -1
  113. package/dist/signers/non-custodial/ncs-signer.cjs +1 -1
  114. package/dist/signers/non-custodial/ncs-signer.js +1 -1
  115. package/dist/signers/non-custodial/ncs-solana-signer.cjs +1 -1
  116. package/dist/signers/non-custodial/ncs-solana-signer.js +1 -1
  117. package/dist/signers/non-custodial/ncs-stellar-signer.cjs +1 -1
  118. package/dist/signers/non-custodial/ncs-stellar-signer.js +1 -1
  119. package/dist/signers/server/assemble-server-signer.cjs +1 -1
  120. package/dist/signers/server/assemble-server-signer.js +1 -1
  121. package/dist/signers/server/index.cjs +1 -1
  122. package/dist/signers/server/index.js +1 -1
  123. package/dist/signers/server/resolver.cjs +1 -1
  124. package/dist/signers/server/resolver.js +1 -1
  125. package/dist/utils/constants.cjs +1 -1
  126. package/dist/utils/constants.js +1 -1
  127. package/dist/utils/device-signers/IframeDeviceSignerKeyStorage.cjs +1 -1
  128. package/dist/utils/device-signers/IframeDeviceSignerKeyStorage.js +1 -1
  129. package/dist/utils/device-signers/index.cjs +1 -1
  130. package/dist/utils/device-signers/index.js +1 -1
  131. package/dist/wallets/__tests__/test-helpers.cjs +1 -1
  132. package/dist/wallets/__tests__/test-helpers.js +1 -1
  133. package/dist/wallets/evm.cjs +1 -1
  134. package/dist/wallets/evm.js +1 -1
  135. package/dist/wallets/services/balance-formatter.cjs +1 -1
  136. package/dist/wallets/services/balance-formatter.js +1 -1
  137. package/dist/wallets/services/device-recovery-service.cjs +1 -1
  138. package/dist/wallets/services/device-recovery-service.js +1 -1
  139. package/dist/wallets/services/operation-poller.cjs +1 -1
  140. package/dist/wallets/services/operation-poller.js +1 -1
  141. package/dist/wallets/services/signer-manager.cjs +1 -1
  142. package/dist/wallets/services/signer-manager.js +1 -1
  143. package/dist/wallets/solana.cjs +1 -1
  144. package/dist/wallets/solana.js +1 -1
  145. package/dist/wallets/stellar.cjs +1 -1
  146. package/dist/wallets/stellar.js +1 -1
  147. package/dist/wallets/wallet-factory.cjs +1 -1
  148. package/dist/wallets/wallet-factory.js +1 -1
  149. package/dist/wallets/wallet.cjs +1 -1
  150. package/dist/wallets/wallet.js +1 -1
  151. package/package.json +4 -4
  152. package/dist/chunk-BXEH6VXA.js +0 -1
  153. package/dist/chunk-CTCUJBU2.js +0 -1
  154. package/dist/chunk-D6BFMPZA.cjs +0 -1
  155. package/dist/chunk-QU5AAJAW.js +0 -1
  156. package/dist/chunk-ZEGNY3K3.cjs +0 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkWIAIJCQ2cjs = require('./chunk-WIAIJCQ2.cjs');var o={nativeToken:"xlm",walletLocatorPrefix:"me:stellar:smart",supportsSignatures:!1,addSignerChain(n){},extractAddSignerOperation(n,r,t){if(!("transaction"in n)||n.transaction==null)throw _chunkWIAIJCQ2cjs.a.error("wallet.addSigner.error",{error:"Expected transaction in response for Solana/Stellar chain"}),new Error("Expected transaction in response for Solana/Stellar chain");return{type:"transaction",id:n.transaction.id}},balanceTokenFields(n){return n!=null&&"contractId"in n?{contractId:n.contractId}:n!=null&&"contractAddress"in n?{contractAddress:n.contractAddress}:{}},emptyBalanceTokenFields(){return{contractId:void 0}}};exports.a = o;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkSP5DQZ6Dcjs = require('./chunk-SP5DQZ6D.cjs');var o={nativeToken:"xlm",walletLocatorPrefix:"me:stellar:smart",supportsSignatures:!1,addSignerChain(n){},extractAddSignerOperation(n,r,t){if(!("transaction"in n)||n.transaction==null)throw _chunkSP5DQZ6Dcjs.a.error("wallet.addSigner.error",{error:"Expected transaction in response for Solana/Stellar chain"}),new Error("Expected transaction in response for Solana/Stellar chain");return{type:"transaction",id:n.transaction.id}},balanceTokenFields(n){return n!=null&&"contractId"in n?{contractId:n.contractId}:n!=null&&"contractAddress"in n?{contractAddress:n.contractAddress}:{}},emptyBalanceTokenFields(){return{contractId:void 0}}};exports.a = o;
@@ -1 +1 @@
1
- import{a as de}from"./chunk-WEWCIFFY.js";import{a as he}from"./chunk-EH75GTUJ.js";import{a as ue,b as Se}from"./chunk-IX4EJZH5.js";import{a as pe}from"./chunk-IXNKZURT.js";import{a as oe}from"./chunk-OQFOUCTW.js";import{a as L}from"./chunk-CTCUJBU2.js";import{a as le,b as M}from"./chunk-BV6IQIQK.js";import{a as ce,b as ge}from"./chunk-FTUJ5XHD.js";import{a as ae}from"./chunk-S6MOVJXB.js";import{f as $}from"./chunk-DCKFFFPG.js";import{a as ne,b as se}from"./chunk-6KW2HYAX.js";import{b as ie}from"./chunk-B4GYB3XY.js";import{f as te}from"./chunk-BXEH6VXA.js";import{D as K,E as X,G as Y,H as Z,I as ee,N as re,Q as k,d as j,e as B,j as G,l as V,m as z,n as Q}from"./chunk-KOHPRJDP.js";import{a as s}from"./chunk-JNGPW247.js";import{a as v,b as D,c as P,d as i,e as A,f as T,g as F,h as o}from"./chunk-NU7VF7MC.js";import{WithLoggerContext as E}from"@crossmint/common-sdk-base";var N,p,b,x,l,f,I,O,W,m,ve,fe,U,H,R=class{constructor(e,r){A(this,m);A(this,N);A(this,p);A(this,b);A(this,x);A(this,l);A(this,f);A(this,I,[]);A(this,O);A(this,W,null);let{chain:t,address:n,owner:a,options:c,alias:h,recovery:u,apiRecoveryServerSignerAddresses:S,apiDelegatedServerSignerAddresses:g,signers:C,signer:y}=e;T(this,p,r),this.chain=t,this.address=n,this.owner=a,T(this,N,c),this.alias=h;let w=Array.isArray(u)?u:[u],_=S!=null?S:w.filter(d=>d.type==="server"&&$(d)).map(d=>d.address);T(this,I,g!=null?g:[]),T(this,b,C!=null?C:[]),T(this,x,new oe({chain:t,projectId:i(this,p).projectId,environment:i(this,p).environment,apiRecoveryAddresses:_,apiDelegatedAddresses:i(this,I),knownOnChainAddresses:()=>[...i(this,b).filter(d=>d.type==="server"&&$(d)).map(d=>d.address),...i(this,I)]})),T(this,l,new pe({apiClient:r,options:c,chain:t,walletAddress:this.address,walletLocator:()=>this.walletLocator,serverSignerResolver:i(this,x),recoverySigners:w,initialSigners:i(this,b),signers:()=>this.signers(),signer:y})),w.forEach((d,q)=>{d.type==="server"&&!$(d)&&i(this,l).stripSecretFromRecovery(q,i(this,x).resolveRecovery(d))}),T(this,f,new he({chain:t,walletAddress:this.address,options:c,signerManager:i(this,l),serverSignerResolver:i(this,x),signers:()=>this.signers(),addSigner:d=>this.addSigner(d),removeSigner:d=>this.removeSigner({type:"device",locator:d}),approveSignature:d=>this.approveSignatureAndWait(d),approveTransaction:d=>this.approveTransactionAndWait(d)})),T(this,O,this.initDefaultSigner())}get signer(){return i(this,l).activeSigner}waitForInit(){return o(this,null,function*(){yield i(this,O)})}initDefaultSigner(){return o(this,null,function*(){if(i(this,l).activeSigner!=null||(yield i(this,f).initDeviceSigner(),i(this,l).activeSigner!=null||i(this,f).needsRecovery))return;let e=i(this,b).length===0?i(this,l).recovery:i(this,b).length===1?i(this,b)[0]:null;if(e==null)return;let r=L(e.type),t=i(this,l).descriptorContext();if(!r.canAutoAssemble(e,t))return;let n=e===i(this,l).recovery;try{let a=r.buildInternalConfig(e,t);i(this,l).setActiveSigner(yield i(this,l).assemble(a,{isAdminSigner:n}))}catch(a){s.warn("wallet.initDefaultSigner.autoAssemblyFailed",{recoveryType:i(this,l).recovery.type,signerCount:i(this,b).length,error:a})}})}static getApiClient(e){return e.apiClient}static getOptions(e){return e.options}static getRecoverySigners(e){return e.recoveryMethods}static getInitialSigners(e){return i(e,b)}static getApiRecoveryServerSignerAddresses(e){return i(e,x).apiRecoveryAddresses}static getApiDelegatedServerSignerAddresses(e){return i(e,I)}get apiClient(){return i(this,p)}get options(){return i(this,N)}get chainAdapter(){return ne(this.chain)}resolveServerSignerApiLocator(e){return i(this,x).apiLocator(e)}get recovery(){return i(this,l).recovery}get recoveryMethods(){return i(this,l).recoverySigners}balances(e){return o(this,null,function*(){s.info("wallet.balances.start");let r=this.resolveChainForEnvironment(),t=this.chainAdapter.nativeToken,n=[t,"usdc",...e!=null?e:[]],a=yield i(this,p).getBalance(this.address,{chains:[r],tokens:n});if("error"in a)throw s.error("wallet.balances.error",{error:a}),new Error(`Failed to get balances for wallet: ${JSON.stringify(a.message)}`);return s.info("wallet.balances.success"),de(a,this.chain,t,e)})}stagingFund(e,r){return o(this,null,function*(){s.info("wallet.stagingFund.start",{amount:e,chain:r!=null?r:this.chain});let t=yield this.apiClient.fundWallet(this.address,{amount:e,token:"usdxm",chain:r!=null?r:this.chain});if("error"in t)throw s.error("wallet.stagingFund.error",{error:t}),new Error(`Failed to fund wallet: ${JSON.stringify(t.message)}`);return s.info("wallet.stagingFund.success"),t})}nfts(e){return o(this,null,function*(){let r=this.resolveChainForEnvironment(),t=yield i(this,p).getNfts(D(v({},e),{chain:r,address:this.address}));if(t!=null&&typeof t=="object"&&"error"in t)throw s.error("wallet.nfts.error",{error:t}),new Error(`Failed to get nfts: ${JSON.stringify(t.message)}`);return t})}transactions(){return o(this,null,function*(){let e=yield i(this,p).getTransactions(this.walletLocator);if("error"in e)throw new Error(`Failed to get transactions: ${JSON.stringify(e.message)}`);return e})}transaction(e){return o(this,null,function*(){let r=yield i(this,p).getTransaction(this.walletLocator,e);if("error"in r)throw new Error(`Failed to get transaction: ${JSON.stringify(r.message)}`);return r})}transfers(e){return o(this,null,function*(){let r=this.resolveChainForEnvironment(),t=yield this.apiClient.getTransfers(this.walletLocator,{chain:r,tokens:e.tokens,status:e.status});if("error"in t)throw new Error(`Failed to get transfers: ${JSON.stringify(t.message)}`);return t})}send(e,r,t,n){return o(this,null,function*(){let a=Number(t);if(Number.isNaN(a)||!Number.isFinite(a)||a<=0)throw new Y(`Invalid transfer amount: "${t}". Amount must be a positive number greater than zero.`);let c=ce(e),h=this.resolveChainForEnvironment(),u=ge(r,h);s.info("wallet.send.start",v({recipient:c,token:u,amount:t},(n==null?void 0:n.transactionType)!=null?{transactionType:n.transactionType}:{})),yield this.preAuthIfNeeded();let S=i(this,l).require(),g;(n==null?void 0:n.signer)==null?g=S.locator():typeof n.signer=="string"?g=n.signer:g=this.resolveServerSignerApiLocator(n.signer);let C=v({recipient:c,amount:t,signer:g},(n==null?void 0:n.transactionType)!=null?{transactionType:n.transactionType}:{}),y=yield i(this,p).send(this.walletLocator,u,C);if("message"in y)throw s.error("wallet.send.error",{error:y}),new Z(`Failed to send token: ${JSON.stringify(y.message)}`);if((n==null?void 0:n.prepareOnly)===!0)return s.info("wallet.send.prepared",{transactionId:y.id}),{hash:void 0,explorerLink:void 0,transactionId:y.id};let w=yield this.approveTransactionAndWait(y.id);return s.info("wallet.send.success",{transactionId:y.id,hash:w.hash}),w})}approveTransaction(e){return o(this,null,function*(){return console.warn("approveTransaction is deprecated. Use approve instead. This method will be removed in the next major version."),yield this.approve(e)})}approve(e){return o(this,null,function*(){if(s.info("wallet.approve.start",{transactionId:e.transactionId,signatureId:e.signatureId}),yield this.preAuthIfNeeded(),e.transactionId!=null){let r=yield this.approveTransactionAndWait(e.transactionId,e.options);return s.info("wallet.approve.success",{transactionId:e.transactionId}),r}if(e.signatureId!=null){let r=yield this.approveSignatureAndWait(e.signatureId,e.options);return s.info("wallet.approve.success",{signatureId:e.signatureId}),r}throw s.error("wallet.approve.error",{error:"Either transactionId or signatureId must be provided"}),new Error("Either transactionId or signatureId must be provided")})}addSigner(e,r){return o(this,null,function*(){s.info("wallet.addSigner.start");let t=typeof e=="object"&&"type"in e&&e.type==="server"?this.resolveServerSignerApiLocator(e):e;return i(this,l).withRecoverySigner(n=>o(this,null,function*(){var w;let a=typeof t=="string"?t:M(t),c=yield i(this,l).getSignerState(a);if(c.signer!=null){if(i(this,l).isApprovedSignerStatus(c.signer.status))return(r==null?void 0:r.scopes)!=null&&s.warn("wallet.addSigner.scopesIgnored",{reason:"signer already approved",signerLocator:a}),s.info("wallet.addSigner.alreadyApproved"),this.completeSignerRegistration(c.signer,null,r);if(c.pendingOperation!=null){if((r==null?void 0:r.scopes)!=null)throw new Error("Cannot apply scopes when resuming a pending signer registration. Remove the pending signer and register it again with the desired scopes.");return s.info("wallet.addSigner.resuming",{operationType:c.pendingOperation.type,operationId:c.pendingOperation.id}),this.completeSignerRegistration(c.signer,c.pendingOperation,r)}}let h=typeof t=="string"?t:L(t.type).addSignerPayload(t,i(this,l).descriptorContext()),S=this.chain!=="solana"&&this.chain!=="stellar"?(w=r==null?void 0:r.deployImmediately)!=null?w:!0:void 0,g=yield i(this,p).registerSigner(this.walletLocator,v(v(v({signer:h,chain:this.chainAdapter.addSignerChain(this.chain)},(r==null?void 0:r.scopes)!=null&&{scopes:r.scopes}),S!=null&&{deployImmediately:S}),n!=null&&{approver:n}));if("error"in g)throw s.error("wallet.addSigner.error",{error:g}),g.code===V?new z(g.message):new G(`Failed to register signer: ${JSON.stringify(g.message)}`);let C=ie(g,this.chain);if(C==null)throw new Error(`No approval found for chain ${this.chain} in register signer response`);let y=this.chainAdapter.extractAddSignerOperation(g,this.chain,{locator:a,type:e.type});return this.completeSignerRegistration(C,y,r)}))})}completeSignerRegistration(e,r,t){return o(this,null,function*(){if(t!=null&&t.prepareOnly){if(r==null)return v({},e);switch(r.type){case"transaction":{let n={transactionId:r.id};return s.info("wallet.addSigner.prepared",n),v(v({},e),n)}case"signature":{let n={signatureId:r.id};return s.info("wallet.addSigner.prepared",n),v(v({},e),n)}default:{let n=r.type;throw new Error(`Unknown pending operation type: ${n}`)}}}if(r!=null)switch(r.type){case"transaction":yield this.approveTransactionAndWait(r.id),s.info("wallet.addSigner.success",{transactionId:r.id});break;case"signature":yield this.approveSignatureAndWait(r.id),s.info("wallet.addSigner.success",{signatureId:r.id});break;default:{let n=r.type;throw new Error(`Unknown pending operation type: ${n}`)}}else s.info("wallet.addSigner.success");return D(v({},e),{status:"success"})})}removeSigner(e,r){return o(this,null,function*(){let t=this.resolveSignerLocator(e);return s.info("wallet.removeSigner.start",{signerLocator:t}),i(this,l).withRecoverySigner(n=>o(this,null,function*(){let a=yield i(this,p).removeSigner(this.walletLocator,t,v({chain:this.chainAdapter.addSignerChain(this.chain)},n!=null&&{approver:n}));if("error"in a)throw s.error("wallet.removeSigner.error",{error:a}),new Error(`Failed to remove signer: ${JSON.stringify(a)}`);let c=a.id;return r!=null&&r.prepareOnly?(s.info("wallet.removeSigner.prepared",{transactionId:c}),{transactionId:c,status:void 0}):(yield this.approveTransactionAndWait(c),s.info("wallet.removeSigner.success",{transactionId:c}),{transactionId:c,status:"success"})}))})}useSigner(e){return o(this,null,function*(){s.info("wallet.useSigner.start"),e.type==="server"&&i(this,x).resetDelegatedCache(),L(e.type).validateConfig(e);let r=!1;e.type==="device"?yield i(this,f).resolveAvailability(e):r=yield this.resolveNonDeviceSigner(e);let t=L(e.type).buildInternalConfig(e,i(this,l).descriptorContext()),n=M(e);i(this,l).setActiveSigner(yield i(this,l).assemble(t,{isAdminSigner:r})),s.info("wallet.useSigner.success",{signerLocator:n})})}resolveNonDeviceSigner(e){return o(this,null,function*(){if(e.type!=="passkey"&&e.type!=="server"&&this.isRecoverySigner(e))return i(this,f).onSignerSelected(),!0;if(e.type==="passkey"&&this.isPasskeyMissingId(e)&&!(yield this.tryAutoSelectPasskey(e))){if(this.isRecoverySigner(e))return i(this,f).onSignerSelected(),!0;throw new Error("No passkey signer is registered on this wallet.")}if(e.type==="server")return this.resolveServerSigner(e);let r=this.resolveSignerLocator(e);if(yield this.signerIsRegistered(r))return i(this,f).onSignerSelected(),!1;if(this.isRecoverySigner(e))return i(this,f).onSignerSelected(),!0;throw new Error(`Signer "${r}" is not registered in this wallet.`)})}resolveServerSigner(e){return o(this,null,function*(){let t=(yield this.signers()).map(c=>c.locator),n={recoveryIndex:null},a=i(this,x).resolveForUseSigner(e,t,()=>(n.recoveryIndex=this.matchRecoverySigner(e),n.recoveryIndex!=null));switch(a.kind){case"delegated":return i(this,f).onSignerSelected(),!1;case"recovery":return n.recoveryIndex!=null&&i(this,l).stripSecretFromRecovery(n.recoveryIndex,a.address),i(this,f).onSignerSelected(),!0;case"unregistered":throw new Error(a.message)}})}tryAutoSelectPasskey(e){return o(this,null,function*(){let t=(yield this.signers()).filter(n=>n.type==="passkey");if(t.length===0)return!1;if(t.length>1)throw new Error('Multiple passkey signers are registered on this wallet. Please specify the credential id: wallet.useSigner({ type: "passkey", id: "<credential-id>" })');return e.id=t[0].locator.replace("passkey:",""),!0})}resolveSignerLocator(e){return e.type==="server"?this.resolveServerSignerApiLocator(e):M(e)}isPasskeyMissingId(e){return le(e)==null}signerIsRegistered(e){return o(this,null,function*(){return i(this,l).signerIsRegistered(e)})}isSignerApproved(e){return o(this,null,function*(){return i(this,l).isSignerApproved(e)})}needsRecovery(){return i(this,f).needsRecovery}recover(){return o(this,null,function*(){yield i(this,f).recover()})}signers(){return o(this,null,function*(){var a,c;s.info("wallet.signers.start");let e=yield i(this,p).getWallet(this.walletLocator);if("error"in e)throw s.error("wallet.signers.error",{error:e}),new B(JSON.stringify(e));if(!ye(e)){let h=e.type!=="smart"?`Wallet type ${e.type} not supported`:`Wallet chain type ${e.chainType} not supported`;throw s.error("wallet.signers.error",{error:h}),new j(h)}let r=(c=(a=e==null?void 0:e.config)==null?void 0:a.delegatedSigners)!=null?c:[],n=(yield Promise.all(r.map(h=>o(this,null,function*(){try{return(yield i(this,l).getSignerState(h.locator)).signer}catch(u){return s.warn("wallet.signers.mapSigner.failed",{locator:h.locator,error:u}),null}})))).filter(h=>h!=null);return s.info("wallet.signers.success",{count:n.length}),n})}get walletLocator(){if(i(this,p).isServerSide)return this.address;{let e=this.chainAdapter.walletLocatorPrefix,r=this.alias!=null?`:alias:${this.alias}`:"";return e+r}}get signerManager(){return i(this,l)}preAuthIfNeeded(){return o(this,null,function*(){yield i(this,O),i(this,W)==null&&T(this,W,this.recover());try{yield i(this,W)}finally{T(this,W,null)}let e=i(this,l).require();e instanceof ae&&(yield e.ensureAuthenticated())})}isRecoverySigner(e){return this.matchRecoverySigner(e)!=null}matchRecoverySigner(e){let r=L(e.type),t=i(this,l).descriptorContext(),n=this.recoveryMethods.findIndex(a=>a.type===e.type&&r.matchesRecovery(e,a,t));return n===-1?null:(r.adoptsRecoveryConfigOnMatch&&i(this,l).adoptRecoveryConfig(n,e),n)}resolveChainForEnvironment(){let e=te(this.chain,i(this,p).environment);return e!==this.chain&&(this.chain=e),this.chain}approveTransactionAndWait(e,r){return o(this,null,function*(){return yield this.approveTransactionInternal(e,r),yield this.sleep(1e3),yield this.waitForTransaction(e)})}approveSignatureAndWait(e,r){return o(this,null,function*(){let t=yield this.approveSignatureInternal(e,r);return!("error"in t)&&t.status==="success"&&t.outputSignature!=null?{signature:t.outputSignature,signatureId:e}:(yield this.sleep(1e3),yield this.waitForSignature(e))})}approveSignatureInternal(e,r){return o(this,null,function*(){var u,S;if(!this.chainAdapter.supportsSignatures)throw new Error("Approving signatures is only supported for EVM smart wallets");let t=i(this,l).require(),n=yield i(this,p).getSignature(this.walletLocator,e);if("error"in n)throw k(n),new K(JSON.stringify(n));if(t.type==="api-key")return n;if((r==null?void 0:r.approval)!=null){let g=[r.approval];return yield this.executeApproveSignatureWithErrorHandling(e,g)}let a=(u=n.approvals)==null?void 0:u.pending;if(a==null||a.length===0)return n;let c=[...(S=r==null?void 0:r.additionalSigners)!=null?S:[],t],h=yield F(this,m,H).call(this,F(this,m,U).call(this,a),c,(g,C)=>g.signMessage(C.message));return yield this.executeApproveSignatureWithErrorHandling(e,h)})}approveTransactionInternal(e,r){return o(this,null,function*(){var u,S,g,C,y;let t=yield i(this,p).getTransaction(this.walletLocator,e);if("error"in t)throw k(t),new ee(JSON.stringify(t));yield(g=(S=(u=i(this,N))==null?void 0:u.callbacks)==null?void 0:S.onTransactionStart)==null?void 0:g.call(S);let n=i(this,l).require();if(n.type==="api-key")return t;if((r==null?void 0:r.approval)!=null){let w=[r.approval];return yield this.executeApproveTransactionWithErrorHandling(e,w)}let a=(C=t.approvals)==null?void 0:C.pending;if(a==null||a.length===0)return t;let c=[...(y=r==null?void 0:r.additionalSigners)!=null?y:[],n],h=yield F(this,m,H).call(this,F(this,m,U).call(this,a),c,(w,_)=>{let d=w.type==="device",q=t.chainType==="solana"&&"transaction"in t.onChain&&!d?t.onChain.transaction:_.message;return w.signTransaction(q)});return yield this.executeApproveTransactionWithErrorHandling(e,h)})}executeApproveTransactionWithErrorHandling(e,r){return o(this,null,function*(){s.info("wallet.approve: submitting approval to API",{transactionId:e});let t=yield i(this,p).approveTransaction(this.walletLocator,e,{approvals:r});if(t.error)throw k(t),new re(JSON.stringify(t));return t})}executeApproveSignatureWithErrorHandling(e,r){return o(this,null,function*(){let t=yield i(this,p).approveSignature(this.walletLocator,e,{approvals:r});if(t.error)throw k(t),new X(JSON.stringify(t));return t})}waitForSignature(e){return o(this,null,function*(){return yield Se(i(this,p),this.walletLocator,e)})}waitForTransaction(n){return o(this,arguments,function*(e,r=6e4,t={}){return yield ue(i(this,p),this.walletLocator,e,v({timeoutMs:r},t))})}sleep(e){return o(this,null,function*(){return new Promise(r=>setTimeout(r,e))})}};N=new WeakMap,p=new WeakMap,b=new WeakMap,x=new WeakMap,l=new WeakMap,f=new WeakMap,I=new WeakMap,O=new WeakMap,W=new WeakMap,m=new WeakSet,ve=function(e){return o(this,null,function*(){let r=yield i(this,f).tryResolveLocallyAvailableSigner(e);return r!=null&&s.info("wallet.approve.deviceSignerRecoveredViaFallback",{signerLocator:e}),r})},fe=function(e,r){return o(this,null,function*(){var n;let t=e.find(a=>a.locator()===r);if(t==null&&(t=(n=yield F(this,m,ve).call(this,r))!=null?n:void 0),t==null)throw new G(`Signer ${r} not found in pending approvals`);return t})},U=function(e){return e.map(r=>{if(r.signer.type==="quorum")throw new Q(`This wallet requires approval from a quorum signer (${r.signer.locator}), which is not yet supported by this SDK version`);return r})},H=function(e,r,t){return o(this,null,function*(){return yield Promise.all(e.map(n=>o(this,null,function*(){let a=yield F(this,m,fe).call(this,r,n.signer.locator),c=yield t(a,n);return D(v({},c),{signer:a.locator()})})))})},P([E({logger:s,methodName:"wallet.balances",buildContext(e){return{chain:e.chain,address:e.address}}})],R.prototype,"balances",1),P([E({logger:s,methodName:"wallet.stagingFund",buildContext(e){return{chain:e.chain,address:e.address}}})],R.prototype,"stagingFund",1),P([E({logger:s,methodName:"wallet.send",buildContext(e){return{chain:e.chain,address:e.address}}})],R.prototype,"send",1),P([E({logger:s,methodName:"wallet.approve",buildContext(e){return{chain:e.chain,address:e.address}}})],R.prototype,"approve",1),P([E({logger:s,methodName:"wallet.addSigner",buildContext(e){return{chain:e.chain,address:e.address}}})],R.prototype,"addSigner",1),P([E({logger:s,methodName:"wallet.removeSigner",buildContext(e){return{chain:e.chain,address:e.address}}})],R.prototype,"removeSigner",1),P([E({logger:s,methodName:"wallet.useSigner",buildContext(e){return{chain:e.chain,address:e.address}}})],R.prototype,"useSigner",1),P([E({logger:s,methodName:"wallet.recover",buildContext(e){return{chain:e.chain,address:e.address}}})],R.prototype,"recover",1),P([E({logger:s,methodName:"wallet.signers",buildContext(e){return{chain:e.chain,address:e.address}}})],R.prototype,"signers",1);function ye(J){return J.type==="smart"&&se(J.chainType)}export{R as a};
1
+ import{a as de}from"./chunk-BHSOWQOR.js";import{a as he}from"./chunk-BKN5HSDC.js";import{a as ue,b as Se}from"./chunk-YFNCXOVW.js";import{a as pe}from"./chunk-QNM7BGTP.js";import{a as oe}from"./chunk-OQFOUCTW.js";import{a as L}from"./chunk-QYNWUGXV.js";import{a as le,b as M}from"./chunk-BV6IQIQK.js";import{a as ce,b as ge}from"./chunk-FTUJ5XHD.js";import{a as ae}from"./chunk-A7DA5DSE.js";import{f as $}from"./chunk-DCKFFFPG.js";import{a as ne,b as se}from"./chunk-WJDR3MG5.js";import{b as ie}from"./chunk-B4GYB3XY.js";import{f as te}from"./chunk-NMUHOXYI.js";import{D as K,E as X,G as Y,H as Z,I as ee,N as re,Q as k,d as j,e as B,j as G,l as V,m as z,n as Q}from"./chunk-KOHPRJDP.js";import{a as s}from"./chunk-AZAIXRGS.js";import{a as v,b as D,c as P,d as i,e as A,f as T,g as F,h as o}from"./chunk-NU7VF7MC.js";import{WithLoggerContext as E}from"@crossmint/common-sdk-base";var N,p,b,x,l,f,I,O,W,m,ve,fe,U,H,R=class{constructor(e,r){A(this,m);A(this,N);A(this,p);A(this,b);A(this,x);A(this,l);A(this,f);A(this,I,[]);A(this,O);A(this,W,null);let{chain:t,address:n,owner:a,options:c,alias:h,recovery:u,apiRecoveryServerSignerAddresses:S,apiDelegatedServerSignerAddresses:g,signers:C,signer:y}=e;T(this,p,r),this.chain=t,this.address=n,this.owner=a,T(this,N,c),this.alias=h;let w=Array.isArray(u)?u:[u],_=S!=null?S:w.filter(d=>d.type==="server"&&$(d)).map(d=>d.address);T(this,I,g!=null?g:[]),T(this,b,C!=null?C:[]),T(this,x,new oe({chain:t,projectId:i(this,p).projectId,environment:i(this,p).environment,apiRecoveryAddresses:_,apiDelegatedAddresses:i(this,I),knownOnChainAddresses:()=>[...i(this,b).filter(d=>d.type==="server"&&$(d)).map(d=>d.address),...i(this,I)]})),T(this,l,new pe({apiClient:r,options:c,chain:t,walletAddress:this.address,walletLocator:()=>this.walletLocator,serverSignerResolver:i(this,x),recoverySigners:w,initialSigners:i(this,b),signers:()=>this.signers(),signer:y})),w.forEach((d,q)=>{d.type==="server"&&!$(d)&&i(this,l).stripSecretFromRecovery(q,i(this,x).resolveRecovery(d))}),T(this,f,new he({chain:t,walletAddress:this.address,options:c,signerManager:i(this,l),serverSignerResolver:i(this,x),signers:()=>this.signers(),addSigner:d=>this.addSigner(d),removeSigner:d=>this.removeSigner({type:"device",locator:d}),approveSignature:d=>this.approveSignatureAndWait(d),approveTransaction:d=>this.approveTransactionAndWait(d)})),T(this,O,this.initDefaultSigner())}get signer(){return i(this,l).activeSigner}waitForInit(){return o(this,null,function*(){yield i(this,O)})}initDefaultSigner(){return o(this,null,function*(){if(i(this,l).activeSigner!=null||(yield i(this,f).initDeviceSigner(),i(this,l).activeSigner!=null||i(this,f).needsRecovery))return;let e=i(this,b).length===0?i(this,l).recovery:i(this,b).length===1?i(this,b)[0]:null;if(e==null)return;let r=L(e.type),t=i(this,l).descriptorContext();if(!r.canAutoAssemble(e,t))return;let n=e===i(this,l).recovery;try{let a=r.buildInternalConfig(e,t);i(this,l).setActiveSigner(yield i(this,l).assemble(a,{isAdminSigner:n}))}catch(a){s.warn("wallet.initDefaultSigner.autoAssemblyFailed",{recoveryType:i(this,l).recovery.type,signerCount:i(this,b).length,error:a})}})}static getApiClient(e){return e.apiClient}static getOptions(e){return e.options}static getRecoverySigners(e){return e.recoveryMethods}static getInitialSigners(e){return i(e,b)}static getApiRecoveryServerSignerAddresses(e){return i(e,x).apiRecoveryAddresses}static getApiDelegatedServerSignerAddresses(e){return i(e,I)}get apiClient(){return i(this,p)}get options(){return i(this,N)}get chainAdapter(){return ne(this.chain)}resolveServerSignerApiLocator(e){return i(this,x).apiLocator(e)}get recovery(){return i(this,l).recovery}get recoveryMethods(){return i(this,l).recoverySigners}balances(e){return o(this,null,function*(){s.info("wallet.balances.start");let r=this.resolveChainForEnvironment(),t=this.chainAdapter.nativeToken,n=[t,"usdc",...e!=null?e:[]],a=yield i(this,p).getBalance(this.address,{chains:[r],tokens:n});if("error"in a)throw s.error("wallet.balances.error",{error:a}),new Error(`Failed to get balances for wallet: ${JSON.stringify(a.message)}`);return s.info("wallet.balances.success"),de(a,this.chain,t,e)})}stagingFund(e,r){return o(this,null,function*(){s.info("wallet.stagingFund.start",{amount:e,chain:r!=null?r:this.chain});let t=yield this.apiClient.fundWallet(this.address,{amount:e,token:"usdxm",chain:r!=null?r:this.chain});if("error"in t)throw s.error("wallet.stagingFund.error",{error:t}),new Error(`Failed to fund wallet: ${JSON.stringify(t.message)}`);return s.info("wallet.stagingFund.success"),t})}nfts(e){return o(this,null,function*(){let r=this.resolveChainForEnvironment(),t=yield i(this,p).getNfts(D(v({},e),{chain:r,address:this.address}));if(t!=null&&typeof t=="object"&&"error"in t)throw s.error("wallet.nfts.error",{error:t}),new Error(`Failed to get nfts: ${JSON.stringify(t.message)}`);return t})}transactions(){return o(this,null,function*(){let e=yield i(this,p).getTransactions(this.walletLocator);if("error"in e)throw new Error(`Failed to get transactions: ${JSON.stringify(e.message)}`);return e})}transaction(e){return o(this,null,function*(){let r=yield i(this,p).getTransaction(this.walletLocator,e);if("error"in r)throw new Error(`Failed to get transaction: ${JSON.stringify(r.message)}`);return r})}transfers(e){return o(this,null,function*(){let r=this.resolveChainForEnvironment(),t=yield this.apiClient.getTransfers(this.walletLocator,{chain:r,tokens:e.tokens,status:e.status});if("error"in t)throw new Error(`Failed to get transfers: ${JSON.stringify(t.message)}`);return t})}send(e,r,t,n){return o(this,null,function*(){let a=Number(t);if(Number.isNaN(a)||!Number.isFinite(a)||a<=0)throw new Y(`Invalid transfer amount: "${t}". Amount must be a positive number greater than zero.`);let c=ce(e),h=this.resolveChainForEnvironment(),u=ge(r,h);s.info("wallet.send.start",v({recipient:c,token:u,amount:t},(n==null?void 0:n.transactionType)!=null?{transactionType:n.transactionType}:{})),yield this.preAuthIfNeeded();let S=i(this,l).require(),g;(n==null?void 0:n.signer)==null?g=S.locator():typeof n.signer=="string"?g=n.signer:g=this.resolveServerSignerApiLocator(n.signer);let C=v({recipient:c,amount:t,signer:g},(n==null?void 0:n.transactionType)!=null?{transactionType:n.transactionType}:{}),y=yield i(this,p).send(this.walletLocator,u,C);if("message"in y)throw s.error("wallet.send.error",{error:y}),new Z(`Failed to send token: ${JSON.stringify(y.message)}`);if((n==null?void 0:n.prepareOnly)===!0)return s.info("wallet.send.prepared",{transactionId:y.id}),{hash:void 0,explorerLink:void 0,transactionId:y.id};let w=yield this.approveTransactionAndWait(y.id);return s.info("wallet.send.success",{transactionId:y.id,hash:w.hash}),w})}approveTransaction(e){return o(this,null,function*(){return console.warn("approveTransaction is deprecated. Use approve instead. This method will be removed in the next major version."),yield this.approve(e)})}approve(e){return o(this,null,function*(){if(s.info("wallet.approve.start",{transactionId:e.transactionId,signatureId:e.signatureId}),yield this.preAuthIfNeeded(),e.transactionId!=null){let r=yield this.approveTransactionAndWait(e.transactionId,e.options);return s.info("wallet.approve.success",{transactionId:e.transactionId}),r}if(e.signatureId!=null){let r=yield this.approveSignatureAndWait(e.signatureId,e.options);return s.info("wallet.approve.success",{signatureId:e.signatureId}),r}throw s.error("wallet.approve.error",{error:"Either transactionId or signatureId must be provided"}),new Error("Either transactionId or signatureId must be provided")})}addSigner(e,r){return o(this,null,function*(){s.info("wallet.addSigner.start");let t=typeof e=="object"&&"type"in e&&e.type==="server"?this.resolveServerSignerApiLocator(e):e;return i(this,l).withRecoverySigner(n=>o(this,null,function*(){var w;let a=typeof t=="string"?t:M(t),c=yield i(this,l).getSignerState(a);if(c.signer!=null){if(i(this,l).isApprovedSignerStatus(c.signer.status))return(r==null?void 0:r.scopes)!=null&&s.warn("wallet.addSigner.scopesIgnored",{reason:"signer already approved",signerLocator:a}),s.info("wallet.addSigner.alreadyApproved"),this.completeSignerRegistration(c.signer,null,r);if(c.pendingOperation!=null){if((r==null?void 0:r.scopes)!=null)throw new Error("Cannot apply scopes when resuming a pending signer registration. Remove the pending signer and register it again with the desired scopes.");return s.info("wallet.addSigner.resuming",{operationType:c.pendingOperation.type,operationId:c.pendingOperation.id}),this.completeSignerRegistration(c.signer,c.pendingOperation,r)}}let h=typeof t=="string"?t:L(t.type).addSignerPayload(t,i(this,l).descriptorContext()),S=this.chain!=="solana"&&this.chain!=="stellar"?(w=r==null?void 0:r.deployImmediately)!=null?w:!0:void 0,g=yield i(this,p).registerSigner(this.walletLocator,v(v(v({signer:h,chain:this.chainAdapter.addSignerChain(this.chain)},(r==null?void 0:r.scopes)!=null&&{scopes:r.scopes}),S!=null&&{deployImmediately:S}),n!=null&&{approver:n}));if("error"in g)throw s.error("wallet.addSigner.error",{error:g}),g.code===V?new z(g.message):new G(`Failed to register signer: ${JSON.stringify(g.message)}`);let C=ie(g,this.chain);if(C==null)throw new Error(`No approval found for chain ${this.chain} in register signer response`);let y=this.chainAdapter.extractAddSignerOperation(g,this.chain,{locator:a,type:e.type});return this.completeSignerRegistration(C,y,r)}))})}completeSignerRegistration(e,r,t){return o(this,null,function*(){if(t!=null&&t.prepareOnly){if(r==null)return v({},e);switch(r.type){case"transaction":{let n={transactionId:r.id};return s.info("wallet.addSigner.prepared",n),v(v({},e),n)}case"signature":{let n={signatureId:r.id};return s.info("wallet.addSigner.prepared",n),v(v({},e),n)}default:{let n=r.type;throw new Error(`Unknown pending operation type: ${n}`)}}}if(r!=null)switch(r.type){case"transaction":yield this.approveTransactionAndWait(r.id),s.info("wallet.addSigner.success",{transactionId:r.id});break;case"signature":yield this.approveSignatureAndWait(r.id),s.info("wallet.addSigner.success",{signatureId:r.id});break;default:{let n=r.type;throw new Error(`Unknown pending operation type: ${n}`)}}else s.info("wallet.addSigner.success");return D(v({},e),{status:"success"})})}removeSigner(e,r){return o(this,null,function*(){let t=this.resolveSignerLocator(e);return s.info("wallet.removeSigner.start",{signerLocator:t}),i(this,l).withRecoverySigner(n=>o(this,null,function*(){let a=yield i(this,p).removeSigner(this.walletLocator,t,v({chain:this.chainAdapter.addSignerChain(this.chain)},n!=null&&{approver:n}));if("error"in a)throw s.error("wallet.removeSigner.error",{error:a}),new Error(`Failed to remove signer: ${JSON.stringify(a)}`);let c=a.id;return r!=null&&r.prepareOnly?(s.info("wallet.removeSigner.prepared",{transactionId:c}),{transactionId:c,status:void 0}):(yield this.approveTransactionAndWait(c),s.info("wallet.removeSigner.success",{transactionId:c}),{transactionId:c,status:"success"})}))})}useSigner(e){return o(this,null,function*(){s.info("wallet.useSigner.start"),e.type==="server"&&i(this,x).resetDelegatedCache(),L(e.type).validateConfig(e);let r=!1;e.type==="device"?yield i(this,f).resolveAvailability(e):r=yield this.resolveNonDeviceSigner(e);let t=L(e.type).buildInternalConfig(e,i(this,l).descriptorContext()),n=M(e);i(this,l).setActiveSigner(yield i(this,l).assemble(t,{isAdminSigner:r})),s.info("wallet.useSigner.success",{signerLocator:n})})}resolveNonDeviceSigner(e){return o(this,null,function*(){if(e.type!=="passkey"&&e.type!=="server"&&this.isRecoverySigner(e))return i(this,f).onSignerSelected(),!0;if(e.type==="passkey"&&this.isPasskeyMissingId(e)&&!(yield this.tryAutoSelectPasskey(e))){if(this.isRecoverySigner(e))return i(this,f).onSignerSelected(),!0;throw new Error("No passkey signer is registered on this wallet.")}if(e.type==="server")return this.resolveServerSigner(e);let r=this.resolveSignerLocator(e);if(yield this.signerIsRegistered(r))return i(this,f).onSignerSelected(),!1;if(this.isRecoverySigner(e))return i(this,f).onSignerSelected(),!0;throw new Error(`Signer "${r}" is not registered in this wallet.`)})}resolveServerSigner(e){return o(this,null,function*(){let t=(yield this.signers()).map(c=>c.locator),n={recoveryIndex:null},a=i(this,x).resolveForUseSigner(e,t,()=>(n.recoveryIndex=this.matchRecoverySigner(e),n.recoveryIndex!=null));switch(a.kind){case"delegated":return i(this,f).onSignerSelected(),!1;case"recovery":return n.recoveryIndex!=null&&i(this,l).stripSecretFromRecovery(n.recoveryIndex,a.address),i(this,f).onSignerSelected(),!0;case"unregistered":throw new Error(a.message)}})}tryAutoSelectPasskey(e){return o(this,null,function*(){let t=(yield this.signers()).filter(n=>n.type==="passkey");if(t.length===0)return!1;if(t.length>1)throw new Error('Multiple passkey signers are registered on this wallet. Please specify the credential id: wallet.useSigner({ type: "passkey", id: "<credential-id>" })');return e.id=t[0].locator.replace("passkey:",""),!0})}resolveSignerLocator(e){return e.type==="server"?this.resolveServerSignerApiLocator(e):M(e)}isPasskeyMissingId(e){return le(e)==null}signerIsRegistered(e){return o(this,null,function*(){return i(this,l).signerIsRegistered(e)})}isSignerApproved(e){return o(this,null,function*(){return i(this,l).isSignerApproved(e)})}needsRecovery(){return i(this,f).needsRecovery}recover(){return o(this,null,function*(){yield i(this,f).recover()})}signers(){return o(this,null,function*(){var a,c;s.info("wallet.signers.start");let e=yield i(this,p).getWallet(this.walletLocator);if("error"in e)throw s.error("wallet.signers.error",{error:e}),new B(JSON.stringify(e));if(!ye(e)){let h=e.type!=="smart"?`Wallet type ${e.type} not supported`:`Wallet chain type ${e.chainType} not supported`;throw s.error("wallet.signers.error",{error:h}),new j(h)}let r=(c=(a=e==null?void 0:e.config)==null?void 0:a.delegatedSigners)!=null?c:[],n=(yield Promise.all(r.map(h=>o(this,null,function*(){try{return(yield i(this,l).getSignerState(h.locator)).signer}catch(u){return s.warn("wallet.signers.mapSigner.failed",{locator:h.locator,error:u}),null}})))).filter(h=>h!=null);return s.info("wallet.signers.success",{count:n.length}),n})}get walletLocator(){if(i(this,p).isServerSide)return this.address;{let e=this.chainAdapter.walletLocatorPrefix,r=this.alias!=null?`:alias:${this.alias}`:"";return e+r}}get signerManager(){return i(this,l)}preAuthIfNeeded(){return o(this,null,function*(){yield i(this,O),i(this,W)==null&&T(this,W,this.recover());try{yield i(this,W)}finally{T(this,W,null)}let e=i(this,l).require();e instanceof ae&&(yield e.ensureAuthenticated())})}isRecoverySigner(e){return this.matchRecoverySigner(e)!=null}matchRecoverySigner(e){let r=L(e.type),t=i(this,l).descriptorContext(),n=this.recoveryMethods.findIndex(a=>a.type===e.type&&r.matchesRecovery(e,a,t));return n===-1?null:(r.adoptsRecoveryConfigOnMatch&&i(this,l).adoptRecoveryConfig(n,e),n)}resolveChainForEnvironment(){let e=te(this.chain,i(this,p).environment);return e!==this.chain&&(this.chain=e),this.chain}approveTransactionAndWait(e,r){return o(this,null,function*(){return yield this.approveTransactionInternal(e,r),yield this.sleep(1e3),yield this.waitForTransaction(e)})}approveSignatureAndWait(e,r){return o(this,null,function*(){let t=yield this.approveSignatureInternal(e,r);return!("error"in t)&&t.status==="success"&&t.outputSignature!=null?{signature:t.outputSignature,signatureId:e}:(yield this.sleep(1e3),yield this.waitForSignature(e))})}approveSignatureInternal(e,r){return o(this,null,function*(){var u,S;if(!this.chainAdapter.supportsSignatures)throw new Error("Approving signatures is only supported for EVM smart wallets");let t=i(this,l).require(),n=yield i(this,p).getSignature(this.walletLocator,e);if("error"in n)throw k(n),new K(JSON.stringify(n));if(t.type==="api-key")return n;if((r==null?void 0:r.approval)!=null){let g=[r.approval];return yield this.executeApproveSignatureWithErrorHandling(e,g)}let a=(u=n.approvals)==null?void 0:u.pending;if(a==null||a.length===0)return n;let c=[...(S=r==null?void 0:r.additionalSigners)!=null?S:[],t],h=yield F(this,m,H).call(this,F(this,m,U).call(this,a),c,(g,C)=>g.signMessage(C.message));return yield this.executeApproveSignatureWithErrorHandling(e,h)})}approveTransactionInternal(e,r){return o(this,null,function*(){var u,S,g,C,y;let t=yield i(this,p).getTransaction(this.walletLocator,e);if("error"in t)throw k(t),new ee(JSON.stringify(t));yield(g=(S=(u=i(this,N))==null?void 0:u.callbacks)==null?void 0:S.onTransactionStart)==null?void 0:g.call(S);let n=i(this,l).require();if(n.type==="api-key")return t;if((r==null?void 0:r.approval)!=null){let w=[r.approval];return yield this.executeApproveTransactionWithErrorHandling(e,w)}let a=(C=t.approvals)==null?void 0:C.pending;if(a==null||a.length===0)return t;let c=[...(y=r==null?void 0:r.additionalSigners)!=null?y:[],n],h=yield F(this,m,H).call(this,F(this,m,U).call(this,a),c,(w,_)=>{let d=w.type==="device",q=t.chainType==="solana"&&"transaction"in t.onChain&&!d?t.onChain.transaction:_.message;return w.signTransaction(q)});return yield this.executeApproveTransactionWithErrorHandling(e,h)})}executeApproveTransactionWithErrorHandling(e,r){return o(this,null,function*(){s.info("wallet.approve: submitting approval to API",{transactionId:e});let t=yield i(this,p).approveTransaction(this.walletLocator,e,{approvals:r});if(t.error)throw k(t),new re(JSON.stringify(t));return t})}executeApproveSignatureWithErrorHandling(e,r){return o(this,null,function*(){let t=yield i(this,p).approveSignature(this.walletLocator,e,{approvals:r});if(t.error)throw k(t),new X(JSON.stringify(t));return t})}waitForSignature(e){return o(this,null,function*(){return yield Se(i(this,p),this.walletLocator,e)})}waitForTransaction(n){return o(this,arguments,function*(e,r=6e4,t={}){return yield ue(i(this,p),this.walletLocator,e,v({timeoutMs:r},t))})}sleep(e){return o(this,null,function*(){return new Promise(r=>setTimeout(r,e))})}};N=new WeakMap,p=new WeakMap,b=new WeakMap,x=new WeakMap,l=new WeakMap,f=new WeakMap,I=new WeakMap,O=new WeakMap,W=new WeakMap,m=new WeakSet,ve=function(e){return o(this,null,function*(){let r=yield i(this,f).tryResolveLocallyAvailableSigner(e);return r!=null&&s.info("wallet.approve.deviceSignerRecoveredViaFallback",{signerLocator:e}),r})},fe=function(e,r){return o(this,null,function*(){var n;let t=e.find(a=>a.locator()===r);if(t==null&&(t=(n=yield F(this,m,ve).call(this,r))!=null?n:void 0),t==null)throw new G(`Signer ${r} not found in pending approvals`);return t})},U=function(e){return e.map(r=>{if(r.signer.type==="quorum")throw new Q(`This wallet requires approval from a quorum signer (${r.signer.locator}), which is not yet supported by this SDK version`);return r})},H=function(e,r,t){return o(this,null,function*(){return yield Promise.all(e.map(n=>o(this,null,function*(){let a=yield F(this,m,fe).call(this,r,n.signer.locator),c=yield t(a,n);return D(v({},c),{signer:a.locator()})})))})},P([E({logger:s,methodName:"wallet.balances",buildContext(e){return{chain:e.chain,address:e.address}}})],R.prototype,"balances",1),P([E({logger:s,methodName:"wallet.stagingFund",buildContext(e){return{chain:e.chain,address:e.address}}})],R.prototype,"stagingFund",1),P([E({logger:s,methodName:"wallet.send",buildContext(e){return{chain:e.chain,address:e.address}}})],R.prototype,"send",1),P([E({logger:s,methodName:"wallet.approve",buildContext(e){return{chain:e.chain,address:e.address}}})],R.prototype,"approve",1),P([E({logger:s,methodName:"wallet.addSigner",buildContext(e){return{chain:e.chain,address:e.address}}})],R.prototype,"addSigner",1),P([E({logger:s,methodName:"wallet.removeSigner",buildContext(e){return{chain:e.chain,address:e.address}}})],R.prototype,"removeSigner",1),P([E({logger:s,methodName:"wallet.useSigner",buildContext(e){return{chain:e.chain,address:e.address}}})],R.prototype,"useSigner",1),P([E({logger:s,methodName:"wallet.recover",buildContext(e){return{chain:e.chain,address:e.address}}})],R.prototype,"recover",1),P([E({logger:s,methodName:"wallet.signers",buildContext(e){return{chain:e.chain,address:e.address}}})],R.prototype,"signers",1);function ye(J){return J.type==="smart"&&se(J.chainType)}export{R as a};
@@ -0,0 +1 @@
1
+ import{a as O}from"./chunk-V5NY4W5H.js";import{a as C}from"./chunk-CGQCRDG7.js";import{a as I}from"./chunk-KKQBZXFE.js";import{a as l}from"./chunk-S3DYQVRD.js";import{a as _}from"./chunk-KUP7H7X2.js";import{a as L}from"./chunk-FT5EVMLB.js";import{a as A}from"./chunk-QLOW4D2N.js";import{a as s}from"./chunk-SVIKBM3S.js";import{a as S}from"./chunk-C6E6WC4P.js";import{b as o,c as i}from"./chunk-KOHPRJDP.js";import{a as E}from"./chunk-AZAIXRGS.js";import{APIKeyEnvironmentPrefix as N,BlockchainIncludingTestnet as e}from"@crossmint/common-sdk-base";import{baseSepolia as c,base as u,polygonAmoy as P,polygon as R,optimismSepolia as p,optimism as h,arbitrumSepolia as d,arbitrum as H,arbitrumNova as f,avalanche as V,avalancheFuji as U,celo as B,modeTestnet as W,mode as v,mainnet as y,bsc as D,shape as b,zora as x,zoraSepolia as F,sepolia as w,flowMainnet as Y,flowTestnet as g,plume as $,plumeTestnet as G}from"viem/chains";var Z=[e.ABSTRACT_TESTNET,e.ARBITRUM_SEPOLIA,e.AVALANCHE_FUJI,e.BASE_SEPOLIA,e.CELO_SEPOLIA,e.CURTIS,e.ETHEREUM_SEPOLIA,e.FLOW_TESTNET,e.MANTLE_SEPOLIA,e.MODE_SEPOLIA,e.OPTIMISM_SEPOLIA,e.PLUME_TESTNET,e.POLYGON_AMOY,e.ROBINHOOD_CHAIN_TESTNET,e.SCROLL_SEPOLIA,e.SEI_ATLANTIC_2_TESTNET,e.STORY_TESTNET,e.WORLD_CHAIN_SEPOLIA,e.ZORA_SEPOLIA,e.ARC_TESTNET,e.TEMPO_TESTNET],k=[e.ABSTRACT,e.APECHAIN,e.ARBITRUM,e.ARBITRUMNOVA,e.ARC,e.AVALANCHE,e.BASE,e.BSC,e.CELO,e.ETHEREUM,e.FLOW,e.MANTLE,e.MODE,e.OPTIMISM,e.PLUME,e.POLYGON,e.ROBINHOOD_CHAIN,e.SCROLL,e.SEI_PACIFIC_1,e.SHAPE,e.STORY,e.TEMPO,e.WORLDCHAIN,e.ZORA];function Se(t){switch(t){case e.BASE_SEPOLIA:return c;case e.BASE:return u;case e.POLYGON_AMOY:return P;case e.POLYGON:return R;case e.OPTIMISM_SEPOLIA:return p;case e.OPTIMISM:return h;case e.ARBITRUM_SEPOLIA:return d;case e.ARBITRUM:return H;case e.ARBITRUMNOVA:return f;case e.AVALANCHE:return V;case e.AVALANCHE_FUJI:return U;case e.CELO:return B;case e.CELO_SEPOLIA:return S;case e.ROBINHOOD_CHAIN:return O;case e.ROBINHOOD_CHAIN_TESTNET:return C;case e.STORY_TESTNET:return l;case e.STORY:return I;case e.MODE_SEPOLIA:return W;case e.MODE:return v;case e.BSC:return D;case e.SHAPE:return b;case e.ZORA:return x;case e.ZORA_SEPOLIA:return F;case e.ETHEREUM_SEPOLIA:return w;case e.ETHEREUM:return y;case e.FLOW:return Y;case e.FLOW_TESTNET:return g;case e.PLUME_TESTNET:return G;case e.PLUME:return $;case e.ARC:return A;case e.ARC_TESTNET:return s;case e.TEMPO:return _;case e.TEMPO_TESTNET:return L;case e.ABSTRACT:case e.ABSTRACT_TESTNET:case e.APECHAIN:case e.MANTLE:case e.MANTLE_SEPOLIA:case e.SCROLL:case e.SCROLL_SEPOLIA:case e.SEI_PACIFIC_1:case e.SEI_ATLANTIC_2_TESTNET:case e.CURTIS:case e.WORLDCHAIN:case e.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 m(t){return Z.includes(t)}function M(t){return k.includes(t)}var J={[e.ABSTRACT]:e.ABSTRACT_TESTNET,[e.APECHAIN]:e.CURTIS,[e.ARBITRUM]:e.ARBITRUM_SEPOLIA,[e.AVALANCHE]:e.AVALANCHE_FUJI,[e.BASE]:e.BASE_SEPOLIA,[e.CELO]:e.CELO_SEPOLIA,[e.ETHEREUM]:e.ETHEREUM_SEPOLIA,[e.FLOW]:e.FLOW_TESTNET,[e.MANTLE]:e.MANTLE_SEPOLIA,[e.MODE]:e.MODE_SEPOLIA,[e.OPTIMISM]:e.OPTIMISM_SEPOLIA,[e.PLUME]:e.PLUME_TESTNET,[e.POLYGON]:e.POLYGON_AMOY,[e.ROBINHOOD_CHAIN]:e.ROBINHOOD_CHAIN_TESTNET,[e.SCROLL]:e.SCROLL_SEPOLIA,[e.SEI_PACIFIC_1]:e.SEI_ATLANTIC_2_TESTNET,[e.STORY]:e.STORY_TESTNET,[e.WORLDCHAIN]:e.WORLD_CHAIN_SEPOLIA,[e.ZORA]:e.ZORA_SEPOLIA,[e.TEMPO]:e.TEMPO_TESTNET,[e.ARC]:e.ARC_TESTNET};function q(t){return J[t]}function z(t){return t==="solana"||t==="stellar"||m(t)||M(t)}function Oe(t,a){if(!z(t))throw new i(`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===N.PRODUCTION;if(T&&m(r))throw new o(`Chain "${t}" is a testnet chain and cannot be used in production. Please use a mainnet chain instead.`);if(!T&&M(r)){let n=q(r);if(n!=null)return E.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;E.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}export{Se as a,m as b,M as c,q as d,z as e,Oe as f};
@@ -1 +1 @@
1
- import{a as e}from"./chunk-JNGPW247.js";var d={nativeToken:"xlm",walletLocatorPrefix:"me:stellar:smart",supportsSignatures:!1,addSignerChain(n){},extractAddSignerOperation(n,r,t){if(!("transaction"in n)||n.transaction==null)throw e.error("wallet.addSigner.error",{error:"Expected transaction in response for Solana/Stellar chain"}),new Error("Expected transaction in response for Solana/Stellar chain");return{type:"transaction",id:n.transaction.id}},balanceTokenFields(n){return n!=null&&"contractId"in n?{contractId:n.contractId}:n!=null&&"contractAddress"in n?{contractAddress:n.contractAddress}:{}},emptyBalanceTokenFields(){return{contractId:void 0}}};export{d as a};
1
+ import{a as e}from"./chunk-AZAIXRGS.js";var d={nativeToken:"xlm",walletLocatorPrefix:"me:stellar:smart",supportsSignatures:!1,addSignerChain(n){},extractAddSignerOperation(n,r,t){if(!("transaction"in n)||n.transaction==null)throw e.error("wallet.addSigner.error",{error:"Expected transaction in response for Solana/Stellar chain"}),new Error("Expected transaction in response for Solana/Stellar chain");return{type:"transaction",id:n.transaction.id}},balanceTokenFields(n){return n!=null&&"contractId"in n?{contractId:n.contractId}:n!=null&&"contractAddress"in n?{contractAddress:n.contractAddress}:{}},emptyBalanceTokenFields(){return{contractId:void 0}}};export{d as a};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _viem = require('viem');var t=_viem.defineChain.call(void 0, {id:11142220,name:"Celo Sepolia",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://forno.celo-sepolia.celo-testnet.org"]}},blockExplorers:{default:{name:"Celo Sepolia Blockscout",url:"https://celo-sepolia.blockscout.com",apiUrl:"https://celo-sepolia.blockscout.com/api"}},testnet:!0});exports.a = t;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkHOQ2JQHJcjs = require('./chunk-HOQ2JQHJ.cjs');var _chunkGMU3ZYLScjs = require('./chunk-GMU3ZYLS.cjs');var _chunkCEP5E7JGcjs = require('./chunk-CEP5E7JG.cjs');var _chunkWIAIJCQ2cjs = require('./chunk-WIAIJCQ2.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var _ox = require('ox');var o=class c{constructor(e){_chunkWIAIJCQ2cjs.b.call(void 0, e.apiKey);let t=new (0, _chunkCEP5E7JGcjs.a)(e);this.walletFactory=new (0, _chunkHOQ2JQHJcjs.a)(t),_chunkWIAIJCQ2cjs.a.info("wallets.sdk.initialized")}static from(e){return new c(e)}getWallet(e,t){return _chunkDSIFRRBScjs.h.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 _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return yield this.walletFactory.createWallet(e)})}createDeviceSigner(e,t){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return yield _chunkGMU3ZYLScjs.a.call(void 0, e,t)})}createPasskeySigner(e){return _chunkDSIFRRBScjs.h.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 _chunkY7P2T5BPcjs = require('./chunk-Y7P2T5BP.cjs');var _chunkGMU3ZYLScjs = require('./chunk-GMU3ZYLS.cjs');var _chunk53VKI7FJcjs = require('./chunk-53VKI7FJ.cjs');var _chunkSP5DQZ6Dcjs = require('./chunk-SP5DQZ6D.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var _ox = require('ox');var o=class c{constructor(e){_chunkSP5DQZ6Dcjs.b.call(void 0, e.apiKey);let t=new (0, _chunk53VKI7FJcjs.a)(e);this.walletFactory=new (0, _chunkY7P2T5BPcjs.a)(t),_chunkSP5DQZ6Dcjs.a.info("wallets.sdk.initialized")}static from(e){return new c(e)}getWallet(e,t){return _chunkDSIFRRBScjs.h.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 _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return yield this.walletFactory.createWallet(e)})}createDeviceSigner(e,t){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return yield _chunkGMU3ZYLScjs.a.call(void 0, e,t)})}createPasskeySigner(e){return _chunkDSIFRRBScjs.h.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
+ import{defineChain as r}from"viem";var e=r({id:5042,name:"Arc",nativeCurrency:{decimals:18,name:"USDC",symbol:"USDC"},rpcUrls:{default:{http:["https://rpc.arc-scan.org"]}},blockExplorers:{default:{name:"Arcscan",url:"https://arc-scan.org",apiUrl:"https://api.arc-scan.org/api"}},testnet:!1});export{e as a};
@@ -1 +1 @@
1
- import{a as L}from"./chunk-CTCUJBU2.js";import{b as I}from"./chunk-BV6IQIQK.js";import{a as x}from"./chunk-6OUANX4J.js";import{f as b}from"./chunk-DCKFFFPG.js";import{b as F,c as T}from"./chunk-B4GYB3XY.js";import{o as O,s as W}from"./chunk-KOHPRJDP.js";import{a as A}from"./chunk-JNGPW247.js";import{d as i,e as g,f as o,g as f,h as v}from"./chunk-NU7VF7MC.js";import{ApiClientError as z}from"@crossmint/common-sdk-base";var l,s,d,c,h,y,u,C,w,m,S,E,$,D,q=class{constructor(e){g(this,S);g(this,l);g(this,s);g(this,d);g(this,c);g(this,h);g(this,y);g(this,u);g(this,C);g(this,w);g(this,m);if(o(this,d,e.apiClient),o(this,c,e.options),o(this,h,e.chain),o(this,y,e.walletAddress),o(this,u,e.walletLocator),o(this,C,e.serverSignerResolver),e.recoverySigners.length===0)throw new O("At least one recovery signer is required");o(this,s,[...e.recoverySigners]),o(this,w,e.initialSigners),o(this,m,e.signers),o(this,l,e.signer)}get activeSigner(){return i(this,l)}setActiveSigner(e){o(this,l,e)}get recovery(){return i(this,s)[0]}get recoverySigners(){return[...i(this,s)]}descriptorContext(){var e,r,n,a,t;return{chain:i(this,h),walletAddress:i(this,y),crossmint:i(this,d).crossmint,clientTEEConnection:(e=i(this,c))==null?void 0:e.clientTEEConnection,resetSignerFrame:(r=i(this,c))==null?void 0:r.resetSignerFrame,onAuthRequired:(a=(n=i(this,c))==null?void 0:n.callbacks)==null?void 0:a.onAuthRequired,deviceSignerKeyStorage:(t=i(this,c))==null?void 0:t.deviceSignerKeyStorage,serverSigners:i(this,C)}}adoptRecoveryConfig(e,r){f(this,S,E).call(this,e),i(this,s)[e]=r}stripSecretFromRecovery(e,r){f(this,S,E).call(this,e);let n=i(this,s)[e];n.type==="server"&&!b(n)&&(i(this,s)[e]={type:"server",address:r})}assemble(e,r){return v(this,null,function*(){var a,t;let n=x(i(this,h),e,(a=i(this,c))==null?void 0:a.deviceSignerKeyStorage);if(r!=null&&r.isAdminSigner)n.status="active";else{let p=yield this.getSignerState(n.locator());n.status=(t=p.signer)==null?void 0:t.status}return n})}require(){if(i(this,l)==null){if(i(this,w).length>1)throw new Error("No signer is set. This wallet has multiple signers configured. Call wallet.useSigner() to select which signer to use before signing operations.");let e=this.recovery,r=L(e.type),n=r.signerUnavailableReason();throw n!=null?new Error(n):r.canAutoAssemble(e,this.descriptorContext())?new Error("This wallet is read-only because no signer was provided. Operations that require signing (send, approve, addSigner, etc.) are not available."):new Error("No signer is set. This wallet requires calling wallet.useSigner() before signing operations.")}return i(this,l)}resolveAuthorizingRecovery(){var a;if(i(this,s).length===1)return{recovery:i(this,s)[0],approver:void 0};let e=i(this,s).map(t=>f(this,S,$).call(this,t)),r=(a=i(this,l))==null?void 0:a.locator(),n=r==null?-1:e.indexOf(r);if(n===-1){let p=`Call wallet.useSigner() with one of them (${e.filter(R=>R!=null).join(", ")}) first.`;throw new W(r==null?`This wallet has multiple recovery methods, so the one authorizing this operation must be selected. ${p}`:`Signer "${r}" is not one of this wallet's recovery methods, and only a recovery method can add or remove signers. ${p}`)}return{recovery:i(this,s)[n],approver:r}}withRecoverySigner(e){return v(this,null,function*(){var P;let r=i(this,l),{recovery:n,approver:a}=this.resolveAuthorizingRecovery(),t=n;if(b(t)&&!i(this,C).hasRecoveryResolutionFor(t.address))throw new Error('Cannot assemble server signer: no secret available. Call wallet.useSigner({ type: "server", secret: ... }) first with the recovery server secret.');let p=L(t.type),R=this.descriptorContext();if(t.type==="external-wallet"&&!p.canAutoAssemble(t,R))throw new Error('Cannot assemble external wallet signer: no onSign callback available. Call wallet.useSigner({ type: "external-wallet", address: "0x...", onSign: async (tx) => ... }) first.');let k=p.buildInternalConfig(t,R);o(this,l,x(i(this,h),k,(P=i(this,c))==null?void 0:P.deviceSignerKeyStorage));try{return yield e(a)}finally{o(this,l,r)}})}getSignerState(e){return v(this,null,function*(){let r=null;try{r=yield i(this,d).getSigner(i(this,u).call(this),e)}catch(a){return A.warn("wallet.signers.getSignerState.fetchFailed",{signerLocator:e,error:a}),{response:null,signer:null,pendingOperation:null}}if(r==null||typeof r!="object"||"error"in r)return A.warn("wallet.signers.getSignerState.errorResponse",{signerLocator:e,response:r}),{response:null,signer:null,pendingOperation:null};let n=F(r,i(this,h));return{response:r,signer:n,pendingOperation:T(r,i(this,h))}})}signerIsRegistered(e){return v(this,null,function*(){return(yield i(this,m).call(this)).some(n=>n.locator===e)})}isSignerApproved(e){return v(this,null,function*(){try{let r=yield f(this,S,D).call(this,e);return this.isApprovedSignerStatus(r==null?void 0:r.status)}catch(r){if(r instanceof z&&r.status===404)return!1;throw A.error("wallet.signers.isSignerApproved.failed",{signerLocator:e,error:r}),r}})}isApprovedSignerStatus(e){return e==="success"||e==="active"}};l=new WeakMap,s=new WeakMap,d=new WeakMap,c=new WeakMap,h=new WeakMap,y=new WeakMap,u=new WeakMap,C=new WeakMap,w=new WeakMap,m=new WeakMap,S=new WeakSet,E=function(e){if(e<0||e>=i(this,s).length)throw new Error(`Recovery signer index ${e} is out of range`)},$=function(e){return e.type==="server"?b(e)?`server:${e.address}`:null:I(e)},D=function(e){return v(this,null,function*(){let r=yield i(this,d).getSigner(i(this,u).call(this),e);if(r==null||typeof r!="object"||"error"in r)throw new Error(`Failed to fetch the approval state of signer ${e}`);return F(r,i(this,h))})};export{q as a};
1
+ import{a as L}from"./chunk-QYNWUGXV.js";import{b as I}from"./chunk-BV6IQIQK.js";import{a as x}from"./chunk-62EHAJRH.js";import{f as b}from"./chunk-DCKFFFPG.js";import{b as F,c as T}from"./chunk-B4GYB3XY.js";import{o as O,s as W}from"./chunk-KOHPRJDP.js";import{a as A}from"./chunk-AZAIXRGS.js";import{d as i,e as g,f as o,g as f,h as v}from"./chunk-NU7VF7MC.js";import{ApiClientError as z}from"@crossmint/common-sdk-base";var l,s,d,c,h,y,u,C,w,m,S,E,$,D,q=class{constructor(e){g(this,S);g(this,l);g(this,s);g(this,d);g(this,c);g(this,h);g(this,y);g(this,u);g(this,C);g(this,w);g(this,m);if(o(this,d,e.apiClient),o(this,c,e.options),o(this,h,e.chain),o(this,y,e.walletAddress),o(this,u,e.walletLocator),o(this,C,e.serverSignerResolver),e.recoverySigners.length===0)throw new O("At least one recovery signer is required");o(this,s,[...e.recoverySigners]),o(this,w,e.initialSigners),o(this,m,e.signers),o(this,l,e.signer)}get activeSigner(){return i(this,l)}setActiveSigner(e){o(this,l,e)}get recovery(){return i(this,s)[0]}get recoverySigners(){return[...i(this,s)]}descriptorContext(){var e,r,n,a,t;return{chain:i(this,h),walletAddress:i(this,y),crossmint:i(this,d).crossmint,clientTEEConnection:(e=i(this,c))==null?void 0:e.clientTEEConnection,resetSignerFrame:(r=i(this,c))==null?void 0:r.resetSignerFrame,onAuthRequired:(a=(n=i(this,c))==null?void 0:n.callbacks)==null?void 0:a.onAuthRequired,deviceSignerKeyStorage:(t=i(this,c))==null?void 0:t.deviceSignerKeyStorage,serverSigners:i(this,C)}}adoptRecoveryConfig(e,r){f(this,S,E).call(this,e),i(this,s)[e]=r}stripSecretFromRecovery(e,r){f(this,S,E).call(this,e);let n=i(this,s)[e];n.type==="server"&&!b(n)&&(i(this,s)[e]={type:"server",address:r})}assemble(e,r){return v(this,null,function*(){var a,t;let n=x(i(this,h),e,(a=i(this,c))==null?void 0:a.deviceSignerKeyStorage);if(r!=null&&r.isAdminSigner)n.status="active";else{let p=yield this.getSignerState(n.locator());n.status=(t=p.signer)==null?void 0:t.status}return n})}require(){if(i(this,l)==null){if(i(this,w).length>1)throw new Error("No signer is set. This wallet has multiple signers configured. Call wallet.useSigner() to select which signer to use before signing operations.");let e=this.recovery,r=L(e.type),n=r.signerUnavailableReason();throw n!=null?new Error(n):r.canAutoAssemble(e,this.descriptorContext())?new Error("This wallet is read-only because no signer was provided. Operations that require signing (send, approve, addSigner, etc.) are not available."):new Error("No signer is set. This wallet requires calling wallet.useSigner() before signing operations.")}return i(this,l)}resolveAuthorizingRecovery(){var a;if(i(this,s).length===1)return{recovery:i(this,s)[0],approver:void 0};let e=i(this,s).map(t=>f(this,S,$).call(this,t)),r=(a=i(this,l))==null?void 0:a.locator(),n=r==null?-1:e.indexOf(r);if(n===-1){let p=`Call wallet.useSigner() with one of them (${e.filter(R=>R!=null).join(", ")}) first.`;throw new W(r==null?`This wallet has multiple recovery methods, so the one authorizing this operation must be selected. ${p}`:`Signer "${r}" is not one of this wallet's recovery methods, and only a recovery method can add or remove signers. ${p}`)}return{recovery:i(this,s)[n],approver:r}}withRecoverySigner(e){return v(this,null,function*(){var P;let r=i(this,l),{recovery:n,approver:a}=this.resolveAuthorizingRecovery(),t=n;if(b(t)&&!i(this,C).hasRecoveryResolutionFor(t.address))throw new Error('Cannot assemble server signer: no secret available. Call wallet.useSigner({ type: "server", secret: ... }) first with the recovery server secret.');let p=L(t.type),R=this.descriptorContext();if(t.type==="external-wallet"&&!p.canAutoAssemble(t,R))throw new Error('Cannot assemble external wallet signer: no onSign callback available. Call wallet.useSigner({ type: "external-wallet", address: "0x...", onSign: async (tx) => ... }) first.');let k=p.buildInternalConfig(t,R);o(this,l,x(i(this,h),k,(P=i(this,c))==null?void 0:P.deviceSignerKeyStorage));try{return yield e(a)}finally{o(this,l,r)}})}getSignerState(e){return v(this,null,function*(){let r=null;try{r=yield i(this,d).getSigner(i(this,u).call(this),e)}catch(a){return A.warn("wallet.signers.getSignerState.fetchFailed",{signerLocator:e,error:a}),{response:null,signer:null,pendingOperation:null}}if(r==null||typeof r!="object"||"error"in r)return A.warn("wallet.signers.getSignerState.errorResponse",{signerLocator:e,response:r}),{response:null,signer:null,pendingOperation:null};let n=F(r,i(this,h));return{response:r,signer:n,pendingOperation:T(r,i(this,h))}})}signerIsRegistered(e){return v(this,null,function*(){return(yield i(this,m).call(this)).some(n=>n.locator===e)})}isSignerApproved(e){return v(this,null,function*(){try{let r=yield f(this,S,D).call(this,e);return this.isApprovedSignerStatus(r==null?void 0:r.status)}catch(r){if(r instanceof z&&r.status===404)return!1;throw A.error("wallet.signers.isSignerApproved.failed",{signerLocator:e,error:r}),r}})}isApprovedSignerStatus(e){return e==="success"||e==="active"}};l=new WeakMap,s=new WeakMap,d=new WeakMap,c=new WeakMap,h=new WeakMap,y=new WeakMap,u=new WeakMap,C=new WeakMap,w=new WeakMap,m=new WeakMap,S=new WeakSet,E=function(e){if(e<0||e>=i(this,s).length)throw new Error(`Recovery signer index ${e} is out of range`)},$=function(e){return e.type==="server"?b(e)?`server:${e.address}`:null:I(e)},D=function(e){return v(this,null,function*(){let r=yield i(this,d).getSigner(i(this,u).call(this),e);if(r==null||typeof r!="object"||"error"in r)throw new Error(`Failed to fetch the approval state of signer ${e}`);return F(r,i(this,h))})};export{q as a};
@@ -0,0 +1 @@
1
+ import{a as o}from"./chunk-25TINDQ4.js";import{b as n}from"./chunk-SWQSW2AD.js";import{a as s}from"./chunk-WVKODEVW.js";import{a as p}from"./chunk-AEO4REZV.js";import{a as c}from"./chunk-VHSQUXJK.js";import{a as i}from"./chunk-PKFCOQOM.js";import{a as t}from"./chunk-3UROOLIH.js";import{k as e}from"./chunk-KOHPRJDP.js";function h(r){switch(r){case"email":return o;case"phone":return p;case"passkey":return s;case"device":return t;case"api-key":return i;case"server":return c;case"external-wallet":return n;default:throw new e(`Unknown signer type: ${r}`)}}export{h as a};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkGSNFNRH2cjs = require('./chunk-GSNFNRH2.cjs');var _chunk3VYGTPRFcjs = require('./chunk-3VYGTPRF.cjs');var _chunkVS6I4S7Xcjs = require('./chunk-VS6I4S7X.cjs');var _chunkWIAIJCQ2cjs = require('./chunk-WIAIJCQ2.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var _ox = require('ox');var R={[_commonsdkbase.APIKeyEnvironmentPrefix.DEVELOPMENT]:"https://development.devicekey.store",[_commonsdkbase.APIKeyEnvironmentPrefix.STAGING]:"https://staging.devicekey.store",[_commonsdkbase.APIKeyEnvironmentPrefix.PRODUCTION]:"https://devicekey.store"},E=6e4,L="indexeddb-fatal",c= exports.a =class extends _chunk3VYGTPRFcjs.a{constructor(e){super(e);this.iframePromise=null;this.reloading=null;this.biometricRequestHandler=null;this.biometricListener=null;if(typeof window!="undefined"&&!_chunkGSNFNRH2cjs.a.call(void 0, ))throw new (0, _chunkVS6I4S7Xcjs.w)("Device signer requires a browser with third-party storage partitioning (Chrome \u2265 115, Firefox \u2265 103, or Safari). Without storage partitioning, different embedders of the same iframe can share IndexedDB, allowing cross-site key access. See https://developer.chrome.com/blog/storage-partitioning");let r=_commonsdkbase.getEnvironmentForKey.call(void 0, e);if(r==null)throw new Error("Unable to determine environment from API key");this.iframeUrl=R[r]}setBiometricRequestHandler(e){this.biometricRequestHandler=e}generateKey(){return _chunkDSIFRRBScjs.h.call(void 0, this,arguments,function*(e={biometricPolicy:"none"}){return(yield this.rpc("generateKey",e)).publicKeyBase64})}mapAddressToKey(e,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){yield this.rpc("mapAddressToKey",{address:e,publicKeyBase64:r})})}getKey(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return(yield this.rpc("getKey",{address:e})).publicKeyBase64})}hasKey(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return(yield this.rpc("hasKey",{publicKeyBase64:e})).hasKey})}signMessage(e,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return yield this.rpc("signMessage",{address:e,message:r})})}deleteKey(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){yield this.rpc("deleteKey",{address:e})})}destroy(){this.biometricListener!=null&&(window.removeEventListener("message",this.biometricListener),this.biometricListener=null),this.iframePromise!=null&&(this.iframePromise.then(e=>e.remove()).catch(()=>{}),this.iframePromise=null)}rpc(e,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let i=yield this.sendRpc(e,r);if(i.fatal){_chunkWIAIJCQ2cjs.a.warn(`[IframeDeviceSignerKeyStorage] Recoverable IDB error on "${e}", reloading iframe and retrying`),yield this.reloadIframe();let t=yield this.sendRpc(e,r);if(t.fatal)throw new Error(`Device signer IDB fatal error on "${e}" persisted after iframe reload`);return t.value}return i.value})}sendRpc(e,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let t=(yield this.getIframe()).contentWindow;if(t==null)throw new Error("Device signer iframe has no contentWindow");let g=crypto.randomUUID(),a=new URL(this.iframeUrl).origin;return new Promise((s,o)=>{let f=setTimeout(()=>{window.removeEventListener("message",p),o(new Error(`Device signer RPC "${e}" timed out after ${E}ms`))},E);function p(y){let d=y.data;d==null||d.id!==g||y.origin===a&&(clearTimeout(f),window.removeEventListener("message",p),d.type==="error"&&d.code===L?s({fatal:!0}):d.type==="error"?o(new Error(d.error)):s({value:d.result,fatal:!1}))}window.addEventListener("message",p),t.postMessage({type:e,id:g,payload:r},this.iframeUrl)})})}reloadIframe(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){if(this.reloading!=null)return this.reloading;let e=_chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){try{this.destroy(),yield this.getIframe()}finally{this.reloading=null}});return this.reloading=e,e})}setupBiometricListener(e){let r=new URL(this.iframeUrl).origin;this.biometricListener=i=>_chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){if(i.origin!==r)return;let t=i.data;if((t==null?void 0:t.type)!=="biometric-request")return;let g=e.contentWindow;if(g!=null)try{this.biometricRequestHandler!=null&&(yield this.biometricRequestHandler(t.action));let a=null;if(t.action==="createCredential"){let s=t.payload,o=yield _ox.WebAuthnP256.createCredential({name:s.name});a={id:o.id,publicKey:{x:`0x${o.publicKey.x.toString(16)}`,y:`0x${o.publicKey.y.toString(16)}`}}}else if(t.action==="sign"){let s=t.payload,{signature:o,metadata:f}=yield _ox.WebAuthnP256.sign({credentialId:s.credentialId,challenge:s.challenge});a={signature:{r:`0x${o.r.toString(16)}`,s:`0x${o.s.toString(16)}`},metadata:f}}g.postMessage({type:"biometric-response",id:t.id,result:a},this.iframeUrl)}catch(a){let s=a instanceof Error?a.message:"Unknown biometric error";g.postMessage({type:"biometric-response",id:t.id,error:s},this.iframeUrl)}}),window.addEventListener("message",this.biometricListener)}getIframe(){return this.iframePromise==null&&(this.iframePromise=this.createIframe().catch(e=>{throw this.iframePromise=null,e})),this.iframePromise}createIframe(){let e=document.createElement("iframe");return e.src=this.iframeUrl,Object.assign(e.style,{position:"absolute",opacity:"0",pointerEvents:"none",width:"0",height:"0",border:"none",top:"-9999px",left:"-9999px"}),new Promise((r,i)=>{e.onload=()=>{this.setupBiometricListener(e),r(e)},e.onerror=()=>i(new Error("Failed to load device signer iframe")),document.body.appendChild(e)})}getDeviceName(){var t;if(typeof navigator=="undefined")return"Unknown Device";let e=navigator.userAgent,r=this.parseDevice(e),i=this.parseBrowser(e);return r!=null&&i!=null?`${i} on ${r}`:(t=r!=null?r:i)!=null?t:"Unknown Device"}parseDevice(e){return/iPad/.test(e)?"iPad":/iPhone/.test(e)?"iPhone":/Macintosh|Mac OS X/.test(e)?"Mac":/Windows/.test(e)?"Windows":/Android/.test(e)?"Android":/Linux/.test(e)?"Linux":/CrOS/.test(e)?"ChromeOS":null}parseBrowser(e){return/Edg\//.test(e)?"Edge":/OPR\/|Opera/.test(e)?"Opera":typeof navigator!="undefined"&&"brave"in navigator?"Brave":/Chrome\//.test(e)?"Chrome":/Safari\//.test(e)&&!/Chrome\//.test(e)?"Safari":/Firefox\//.test(e)?"Firefox":null}};_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkWIAIJCQ2cjs.a,methodName:"deviceSignerKeyStorage.generateKey"})],c.prototype,"generateKey",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkWIAIJCQ2cjs.a,methodName:"deviceSignerKeyStorage.mapAddressToKey"})],c.prototype,"mapAddressToKey",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkWIAIJCQ2cjs.a,methodName:"deviceSignerKeyStorage.getKey"})],c.prototype,"getKey",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkWIAIJCQ2cjs.a,methodName:"deviceSignerKeyStorage.hasKey"})],c.prototype,"hasKey",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkWIAIJCQ2cjs.a,methodName:"deviceSignerKeyStorage.signMessage"})],c.prototype,"signMessage",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkWIAIJCQ2cjs.a,methodName:"deviceSignerKeyStorage.deleteKey"})],c.prototype,"deleteKey",1);exports.a = c;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk3VYGTPRFcjs = require('./chunk-3VYGTPRF.cjs');var _chunkGSNFNRH2cjs = require('./chunk-GSNFNRH2.cjs');var _chunkVS6I4S7Xcjs = require('./chunk-VS6I4S7X.cjs');var _chunkSP5DQZ6Dcjs = require('./chunk-SP5DQZ6D.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var _ox = require('ox');var R={[_commonsdkbase.APIKeyEnvironmentPrefix.DEVELOPMENT]:"https://development.devicekey.store",[_commonsdkbase.APIKeyEnvironmentPrefix.STAGING]:"https://staging.devicekey.store",[_commonsdkbase.APIKeyEnvironmentPrefix.PRODUCTION]:"https://devicekey.store"},E=6e4,L="indexeddb-fatal",c= exports.a =class extends _chunk3VYGTPRFcjs.a{constructor(e){super(e);this.iframePromise=null;this.reloading=null;this.biometricRequestHandler=null;this.biometricListener=null;if(typeof window!="undefined"&&!_chunkGSNFNRH2cjs.a.call(void 0, ))throw new (0, _chunkVS6I4S7Xcjs.w)("Device signer requires a browser with third-party storage partitioning (Chrome \u2265 115, Firefox \u2265 103, or Safari). Without storage partitioning, different embedders of the same iframe can share IndexedDB, allowing cross-site key access. See https://developer.chrome.com/blog/storage-partitioning");let r=_commonsdkbase.getEnvironmentForKey.call(void 0, e);if(r==null)throw new Error("Unable to determine environment from API key");this.iframeUrl=R[r]}setBiometricRequestHandler(e){this.biometricRequestHandler=e}generateKey(){return _chunkDSIFRRBScjs.h.call(void 0, this,arguments,function*(e={biometricPolicy:"none"}){return(yield this.rpc("generateKey",e)).publicKeyBase64})}mapAddressToKey(e,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){yield this.rpc("mapAddressToKey",{address:e,publicKeyBase64:r})})}getKey(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return(yield this.rpc("getKey",{address:e})).publicKeyBase64})}hasKey(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return(yield this.rpc("hasKey",{publicKeyBase64:e})).hasKey})}signMessage(e,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return yield this.rpc("signMessage",{address:e,message:r})})}deleteKey(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){yield this.rpc("deleteKey",{address:e})})}destroy(){this.biometricListener!=null&&(window.removeEventListener("message",this.biometricListener),this.biometricListener=null),this.iframePromise!=null&&(this.iframePromise.then(e=>e.remove()).catch(()=>{}),this.iframePromise=null)}rpc(e,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let i=yield this.sendRpc(e,r);if(i.fatal){_chunkSP5DQZ6Dcjs.a.warn(`[IframeDeviceSignerKeyStorage] Recoverable IDB error on "${e}", reloading iframe and retrying`),yield this.reloadIframe();let t=yield this.sendRpc(e,r);if(t.fatal)throw new Error(`Device signer IDB fatal error on "${e}" persisted after iframe reload`);return t.value}return i.value})}sendRpc(e,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let t=(yield this.getIframe()).contentWindow;if(t==null)throw new Error("Device signer iframe has no contentWindow");let g=crypto.randomUUID(),a=new URL(this.iframeUrl).origin;return new Promise((s,o)=>{let f=setTimeout(()=>{window.removeEventListener("message",p),o(new Error(`Device signer RPC "${e}" timed out after ${E}ms`))},E);function p(y){let d=y.data;d==null||d.id!==g||y.origin===a&&(clearTimeout(f),window.removeEventListener("message",p),d.type==="error"&&d.code===L?s({fatal:!0}):d.type==="error"?o(new Error(d.error)):s({value:d.result,fatal:!1}))}window.addEventListener("message",p),t.postMessage({type:e,id:g,payload:r},this.iframeUrl)})})}reloadIframe(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){if(this.reloading!=null)return this.reloading;let e=_chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){try{this.destroy(),yield this.getIframe()}finally{this.reloading=null}});return this.reloading=e,e})}setupBiometricListener(e){let r=new URL(this.iframeUrl).origin;this.biometricListener=i=>_chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){if(i.origin!==r)return;let t=i.data;if((t==null?void 0:t.type)!=="biometric-request")return;let g=e.contentWindow;if(g!=null)try{this.biometricRequestHandler!=null&&(yield this.biometricRequestHandler(t.action));let a=null;if(t.action==="createCredential"){let s=t.payload,o=yield _ox.WebAuthnP256.createCredential({name:s.name});a={id:o.id,publicKey:{x:`0x${o.publicKey.x.toString(16)}`,y:`0x${o.publicKey.y.toString(16)}`}}}else if(t.action==="sign"){let s=t.payload,{signature:o,metadata:f}=yield _ox.WebAuthnP256.sign({credentialId:s.credentialId,challenge:s.challenge});a={signature:{r:`0x${o.r.toString(16)}`,s:`0x${o.s.toString(16)}`},metadata:f}}g.postMessage({type:"biometric-response",id:t.id,result:a},this.iframeUrl)}catch(a){let s=a instanceof Error?a.message:"Unknown biometric error";g.postMessage({type:"biometric-response",id:t.id,error:s},this.iframeUrl)}}),window.addEventListener("message",this.biometricListener)}getIframe(){return this.iframePromise==null&&(this.iframePromise=this.createIframe().catch(e=>{throw this.iframePromise=null,e})),this.iframePromise}createIframe(){let e=document.createElement("iframe");return e.src=this.iframeUrl,Object.assign(e.style,{position:"absolute",opacity:"0",pointerEvents:"none",width:"0",height:"0",border:"none",top:"-9999px",left:"-9999px"}),new Promise((r,i)=>{e.onload=()=>{this.setupBiometricListener(e),r(e)},e.onerror=()=>i(new Error("Failed to load device signer iframe")),document.body.appendChild(e)})}getDeviceName(){var t;if(typeof navigator=="undefined")return"Unknown Device";let e=navigator.userAgent,r=this.parseDevice(e),i=this.parseBrowser(e);return r!=null&&i!=null?`${i} on ${r}`:(t=r!=null?r:i)!=null?t:"Unknown Device"}parseDevice(e){return/iPad/.test(e)?"iPad":/iPhone/.test(e)?"iPhone":/Macintosh|Mac OS X/.test(e)?"Mac":/Windows/.test(e)?"Windows":/Android/.test(e)?"Android":/Linux/.test(e)?"Linux":/CrOS/.test(e)?"ChromeOS":null}parseBrowser(e){return/Edg\//.test(e)?"Edge":/OPR\/|Opera/.test(e)?"Opera":typeof navigator!="undefined"&&"brave"in navigator?"Brave":/Chrome\//.test(e)?"Chrome":/Safari\//.test(e)&&!/Chrome\//.test(e)?"Safari":/Firefox\//.test(e)?"Firefox":null}};_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkSP5DQZ6Dcjs.a,methodName:"deviceSignerKeyStorage.generateKey"})],c.prototype,"generateKey",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkSP5DQZ6Dcjs.a,methodName:"deviceSignerKeyStorage.mapAddressToKey"})],c.prototype,"mapAddressToKey",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkSP5DQZ6Dcjs.a,methodName:"deviceSignerKeyStorage.getKey"})],c.prototype,"getKey",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkSP5DQZ6Dcjs.a,methodName:"deviceSignerKeyStorage.hasKey"})],c.prototype,"hasKey",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkSP5DQZ6Dcjs.a,methodName:"deviceSignerKeyStorage.signMessage"})],c.prototype,"signMessage",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkSP5DQZ6Dcjs.a,methodName:"deviceSignerKeyStorage.deleteKey"})],c.prototype,"deleteKey",1);exports.a = c;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk3TPBVNNFcjs = require('./chunk-3TPBVNNF.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var t=new _commonsdkbase.SdkLogger;function v(s){let o=_commonsdkbase.detectPlatform.call(void 0, ),e=_commonsdkbase.validateAPIKey.call(void 0, s);if(!e.isValid)throw new Error(`Invalid API key: ${e.message}`);let{environment:a,projectId:c}=e;switch(t.init({packageName:_chunk3TPBVNNFcjs.c,packageVersion:_chunk3TPBVNNFcjs.b,environment:a,projectId:c,platform:o}),o){case"browser":{let r=new (0, _commonsdkbase.BrowserDatadogSink)(a);t.addSink(r);break}case"react-native":break;case"server":{let r=new (0, _commonsdkbase.ServerDatadogSink)(a);t.addSink(r);break}default:break}}exports.a = t; exports.b = v;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkXFCHACH7cjs = require('./chunk-XFCHACH7.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var t=new _commonsdkbase.SdkLogger;function v(s){let o=_commonsdkbase.detectPlatform.call(void 0, ),e=_commonsdkbase.validateAPIKey.call(void 0, s);if(!e.isValid)throw new Error(`Invalid API key: ${e.message}`);let{environment:a,projectId:c}=e;switch(t.init({packageName:_chunkXFCHACH7cjs.c,packageVersion:_chunkXFCHACH7cjs.b,environment:a,projectId:c,platform:o}),o){case"browser":{let r=new (0, _commonsdkbase.BrowserDatadogSink)(a);t.addSink(r);break}case"react-native":break;case"server":{let r=new (0, _commonsdkbase.ServerDatadogSink)(a);t.addSink(r);break}default:break}}exports.a = t; exports.b = v;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _viem = require('viem');var c=_viem.defineChain.call(void 0, {id:5042,name:"Arc",nativeCurrency:{decimals:18,name:"USDC",symbol:"USDC"},rpcUrls:{default:{http:["https://rpc.arc-scan.org"]}},blockExplorers:{default:{name:"Arcscan",url:"https://arc-scan.org",apiUrl:"https://api.arc-scan.org/api"}},testnet:!1});exports.a = c;
@@ -1 +1 @@
1
- import{a as s,b as o}from"./chunk-S6MOVJXB.js";import{a as r}from"./chunk-JNGPW247.js";import{h as t}from"./chunk-NU7VF7MC.js";var a=class g extends s{constructor(n){super(n)}signMessage(){return t(this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for stellar signer"))})}signTransaction(n){return t(this,null,function*(){var i;yield this.handleAuthRequired();let c=this.getJwtOrThrow();r.info("sign: sending request",{keyType:"ed25519"});let d=Date.now(),e=yield(i=this.config.clientTEEConnection)==null?void 0:i.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:c,apiKey:this.config.crossmint.apiKey},data:{keyType:"ed25519",bytes:n,encoding:"base64"}},options:o});if(r.info("sign: response received",{status:e==null?void 0:e.status,durationMs:Date.now()-d}),(e==null?void 0:e.status)==="error")throw new Error(e.error);if((e==null?void 0:e.signature)==null)throw new Error("Failed to sign transaction");if(g.verifyPublicKeyFormat(e.publicKey),e.signature.encoding!=="base64")throw new Error("Wrong encoding for signature. Expected base64, got "+e.signature.encoding);return{signature:e.signature.bytes}})}static verifyPublicKeyFormat(n){if(n==null)throw new Error("No public key found");if(n.encoding!=="base64"||n.keyType!=="ed25519"||n.bytes==null)throw new Error("Not supported. Expected public key to be in base64 encoding and ed25519 key type. Got: "+JSON.stringify(n))}getChainKeyParams(){return{scheme:"ed25519",encoding:"strkey"}}};export{a};
1
+ import{a as s,b as o}from"./chunk-A7DA5DSE.js";import{a as r}from"./chunk-AZAIXRGS.js";import{h as t}from"./chunk-NU7VF7MC.js";var a=class g extends s{constructor(n){super(n)}signMessage(){return t(this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for stellar signer"))})}signTransaction(n){return t(this,null,function*(){var i;yield this.handleAuthRequired();let c=this.getJwtOrThrow();r.info("sign: sending request",{keyType:"ed25519"});let d=Date.now(),e=yield(i=this.config.clientTEEConnection)==null?void 0:i.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:c,apiKey:this.config.crossmint.apiKey},data:{keyType:"ed25519",bytes:n,encoding:"base64"}},options:o});if(r.info("sign: response received",{status:e==null?void 0:e.status,durationMs:Date.now()-d}),(e==null?void 0:e.status)==="error")throw new Error(e.error);if((e==null?void 0:e.signature)==null)throw new Error("Failed to sign transaction");if(g.verifyPublicKeyFormat(e.publicKey),e.signature.encoding!=="base64")throw new Error("Wrong encoding for signature. Expected base64, got "+e.signature.encoding);return{signature:e.signature.bytes}})}static verifyPublicKeyFormat(n){if(n==null)throw new Error("No public key found");if(n.encoding!=="base64"||n.keyType!=="ed25519"||n.bytes==null)throw new Error("Not supported. Expected public key to be in base64 encoding and ed25519 key type. Got: "+JSON.stringify(n))}getChainKeyParams(){return{scheme:"ed25519",encoding:"strkey"}}};export{a};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkVMDJJX7Pcjs = require('./chunk-VMDJJX7P.cjs');var _chunkHJH2S644cjs = require('./chunk-HJH2S644.cjs');var _chunk2D6B7AZ6cjs = require('./chunk-2D6B7AZ6.cjs');var _chunkENU3EKBGcjs = require('./chunk-ENU3EKBG.cjs');function l(a,e){switch(_chunkENU3EKBGcjs.a.call(void 0, a)){case"evm":return new (0, _chunkVMDJJX7Pcjs.a)(e);case"solana":return new (0, _chunkHJH2S644cjs.a)(e);case"stellar":return new (0, _chunk2D6B7AZ6cjs.a)(e)}}exports.a = l;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkHJH2S644cjs = require('./chunk-HJH2S644.cjs');var _chunk2D6B7AZ6cjs = require('./chunk-2D6B7AZ6.cjs');var _chunkVMDJJX7Pcjs = require('./chunk-VMDJJX7P.cjs');var _chunkENU3EKBGcjs = require('./chunk-ENU3EKBG.cjs');function l(a,e){switch(_chunkENU3EKBGcjs.a.call(void 0, a)){case"evm":return new (0, _chunkVMDJJX7Pcjs.a)(e);case"solana":return new (0, _chunkHJH2S644cjs.a)(e);case"stellar":return new (0, _chunk2D6B7AZ6cjs.a)(e)}}exports.a = l;
@@ -1 +1 @@
1
- import{a as P}from"./chunk-NZXYWQE5.js";import{a as v}from"./chunk-IOSADDL5.js";import{w}from"./chunk-KOHPRJDP.js";import{a as l}from"./chunk-JNGPW247.js";import{c as m,h as n}from"./chunk-NU7VF7MC.js";import{getEnvironmentForKey as K,APIKeyEnvironmentPrefix as h,WithLoggerContext as u}from"@crossmint/common-sdk-base";import{WebAuthnP256 as b}from"ox";var R={[h.DEVELOPMENT]:"https://development.devicekey.store",[h.STAGING]:"https://staging.devicekey.store",[h.PRODUCTION]:"https://devicekey.store"},E=6e4,L="indexeddb-fatal",c=class extends v{constructor(e){super(e);this.iframePromise=null;this.reloading=null;this.biometricRequestHandler=null;this.biometricListener=null;if(typeof window!="undefined"&&!P())throw new w("Device signer requires a browser with third-party storage partitioning (Chrome \u2265 115, Firefox \u2265 103, or Safari). Without storage partitioning, different embedders of the same iframe can share IndexedDB, allowing cross-site key access. See https://developer.chrome.com/blog/storage-partitioning");let r=K(e);if(r==null)throw new Error("Unable to determine environment from API key");this.iframeUrl=R[r]}setBiometricRequestHandler(e){this.biometricRequestHandler=e}generateKey(){return n(this,arguments,function*(e={biometricPolicy:"none"}){return(yield this.rpc("generateKey",e)).publicKeyBase64})}mapAddressToKey(e,r){return n(this,null,function*(){yield this.rpc("mapAddressToKey",{address:e,publicKeyBase64:r})})}getKey(e){return n(this,null,function*(){return(yield this.rpc("getKey",{address:e})).publicKeyBase64})}hasKey(e){return n(this,null,function*(){return(yield this.rpc("hasKey",{publicKeyBase64:e})).hasKey})}signMessage(e,r){return n(this,null,function*(){return yield this.rpc("signMessage",{address:e,message:r})})}deleteKey(e){return n(this,null,function*(){yield this.rpc("deleteKey",{address:e})})}destroy(){this.biometricListener!=null&&(window.removeEventListener("message",this.biometricListener),this.biometricListener=null),this.iframePromise!=null&&(this.iframePromise.then(e=>e.remove()).catch(()=>{}),this.iframePromise=null)}rpc(e,r){return n(this,null,function*(){let i=yield this.sendRpc(e,r);if(i.fatal){l.warn(`[IframeDeviceSignerKeyStorage] Recoverable IDB error on "${e}", reloading iframe and retrying`),yield this.reloadIframe();let t=yield this.sendRpc(e,r);if(t.fatal)throw new Error(`Device signer IDB fatal error on "${e}" persisted after iframe reload`);return t.value}return i.value})}sendRpc(e,r){return n(this,null,function*(){let t=(yield this.getIframe()).contentWindow;if(t==null)throw new Error("Device signer iframe has no contentWindow");let g=crypto.randomUUID(),a=new URL(this.iframeUrl).origin;return new Promise((s,o)=>{let f=setTimeout(()=>{window.removeEventListener("message",p),o(new Error(`Device signer RPC "${e}" timed out after ${E}ms`))},E);function p(y){let d=y.data;d==null||d.id!==g||y.origin===a&&(clearTimeout(f),window.removeEventListener("message",p),d.type==="error"&&d.code===L?s({fatal:!0}):d.type==="error"?o(new Error(d.error)):s({value:d.result,fatal:!1}))}window.addEventListener("message",p),t.postMessage({type:e,id:g,payload:r},this.iframeUrl)})})}reloadIframe(){return n(this,null,function*(){if(this.reloading!=null)return this.reloading;let e=n(this,null,function*(){try{this.destroy(),yield this.getIframe()}finally{this.reloading=null}});return this.reloading=e,e})}setupBiometricListener(e){let r=new URL(this.iframeUrl).origin;this.biometricListener=i=>n(this,null,function*(){if(i.origin!==r)return;let t=i.data;if((t==null?void 0:t.type)!=="biometric-request")return;let g=e.contentWindow;if(g!=null)try{this.biometricRequestHandler!=null&&(yield this.biometricRequestHandler(t.action));let a=null;if(t.action==="createCredential"){let s=t.payload,o=yield b.createCredential({name:s.name});a={id:o.id,publicKey:{x:`0x${o.publicKey.x.toString(16)}`,y:`0x${o.publicKey.y.toString(16)}`}}}else if(t.action==="sign"){let s=t.payload,{signature:o,metadata:f}=yield b.sign({credentialId:s.credentialId,challenge:s.challenge});a={signature:{r:`0x${o.r.toString(16)}`,s:`0x${o.s.toString(16)}`},metadata:f}}g.postMessage({type:"biometric-response",id:t.id,result:a},this.iframeUrl)}catch(a){let s=a instanceof Error?a.message:"Unknown biometric error";g.postMessage({type:"biometric-response",id:t.id,error:s},this.iframeUrl)}}),window.addEventListener("message",this.biometricListener)}getIframe(){return this.iframePromise==null&&(this.iframePromise=this.createIframe().catch(e=>{throw this.iframePromise=null,e})),this.iframePromise}createIframe(){let e=document.createElement("iframe");return e.src=this.iframeUrl,Object.assign(e.style,{position:"absolute",opacity:"0",pointerEvents:"none",width:"0",height:"0",border:"none",top:"-9999px",left:"-9999px"}),new Promise((r,i)=>{e.onload=()=>{this.setupBiometricListener(e),r(e)},e.onerror=()=>i(new Error("Failed to load device signer iframe")),document.body.appendChild(e)})}getDeviceName(){var t;if(typeof navigator=="undefined")return"Unknown Device";let e=navigator.userAgent,r=this.parseDevice(e),i=this.parseBrowser(e);return r!=null&&i!=null?`${i} on ${r}`:(t=r!=null?r:i)!=null?t:"Unknown Device"}parseDevice(e){return/iPad/.test(e)?"iPad":/iPhone/.test(e)?"iPhone":/Macintosh|Mac OS X/.test(e)?"Mac":/Windows/.test(e)?"Windows":/Android/.test(e)?"Android":/Linux/.test(e)?"Linux":/CrOS/.test(e)?"ChromeOS":null}parseBrowser(e){return/Edg\//.test(e)?"Edge":/OPR\/|Opera/.test(e)?"Opera":typeof navigator!="undefined"&&"brave"in navigator?"Brave":/Chrome\//.test(e)?"Chrome":/Safari\//.test(e)&&!/Chrome\//.test(e)?"Safari":/Firefox\//.test(e)?"Firefox":null}};m([u({logger:l,methodName:"deviceSignerKeyStorage.generateKey"})],c.prototype,"generateKey",1),m([u({logger:l,methodName:"deviceSignerKeyStorage.mapAddressToKey"})],c.prototype,"mapAddressToKey",1),m([u({logger:l,methodName:"deviceSignerKeyStorage.getKey"})],c.prototype,"getKey",1),m([u({logger:l,methodName:"deviceSignerKeyStorage.hasKey"})],c.prototype,"hasKey",1),m([u({logger:l,methodName:"deviceSignerKeyStorage.signMessage"})],c.prototype,"signMessage",1),m([u({logger:l,methodName:"deviceSignerKeyStorage.deleteKey"})],c.prototype,"deleteKey",1);export{c as a};
1
+ import{a as v}from"./chunk-IOSADDL5.js";import{a as P}from"./chunk-NZXYWQE5.js";import{w}from"./chunk-KOHPRJDP.js";import{a as l}from"./chunk-AZAIXRGS.js";import{c as m,h as n}from"./chunk-NU7VF7MC.js";import{getEnvironmentForKey as K,APIKeyEnvironmentPrefix as h,WithLoggerContext as u}from"@crossmint/common-sdk-base";import{WebAuthnP256 as b}from"ox";var R={[h.DEVELOPMENT]:"https://development.devicekey.store",[h.STAGING]:"https://staging.devicekey.store",[h.PRODUCTION]:"https://devicekey.store"},E=6e4,L="indexeddb-fatal",c=class extends v{constructor(e){super(e);this.iframePromise=null;this.reloading=null;this.biometricRequestHandler=null;this.biometricListener=null;if(typeof window!="undefined"&&!P())throw new w("Device signer requires a browser with third-party storage partitioning (Chrome \u2265 115, Firefox \u2265 103, or Safari). Without storage partitioning, different embedders of the same iframe can share IndexedDB, allowing cross-site key access. See https://developer.chrome.com/blog/storage-partitioning");let r=K(e);if(r==null)throw new Error("Unable to determine environment from API key");this.iframeUrl=R[r]}setBiometricRequestHandler(e){this.biometricRequestHandler=e}generateKey(){return n(this,arguments,function*(e={biometricPolicy:"none"}){return(yield this.rpc("generateKey",e)).publicKeyBase64})}mapAddressToKey(e,r){return n(this,null,function*(){yield this.rpc("mapAddressToKey",{address:e,publicKeyBase64:r})})}getKey(e){return n(this,null,function*(){return(yield this.rpc("getKey",{address:e})).publicKeyBase64})}hasKey(e){return n(this,null,function*(){return(yield this.rpc("hasKey",{publicKeyBase64:e})).hasKey})}signMessage(e,r){return n(this,null,function*(){return yield this.rpc("signMessage",{address:e,message:r})})}deleteKey(e){return n(this,null,function*(){yield this.rpc("deleteKey",{address:e})})}destroy(){this.biometricListener!=null&&(window.removeEventListener("message",this.biometricListener),this.biometricListener=null),this.iframePromise!=null&&(this.iframePromise.then(e=>e.remove()).catch(()=>{}),this.iframePromise=null)}rpc(e,r){return n(this,null,function*(){let i=yield this.sendRpc(e,r);if(i.fatal){l.warn(`[IframeDeviceSignerKeyStorage] Recoverable IDB error on "${e}", reloading iframe and retrying`),yield this.reloadIframe();let t=yield this.sendRpc(e,r);if(t.fatal)throw new Error(`Device signer IDB fatal error on "${e}" persisted after iframe reload`);return t.value}return i.value})}sendRpc(e,r){return n(this,null,function*(){let t=(yield this.getIframe()).contentWindow;if(t==null)throw new Error("Device signer iframe has no contentWindow");let g=crypto.randomUUID(),a=new URL(this.iframeUrl).origin;return new Promise((s,o)=>{let f=setTimeout(()=>{window.removeEventListener("message",p),o(new Error(`Device signer RPC "${e}" timed out after ${E}ms`))},E);function p(y){let d=y.data;d==null||d.id!==g||y.origin===a&&(clearTimeout(f),window.removeEventListener("message",p),d.type==="error"&&d.code===L?s({fatal:!0}):d.type==="error"?o(new Error(d.error)):s({value:d.result,fatal:!1}))}window.addEventListener("message",p),t.postMessage({type:e,id:g,payload:r},this.iframeUrl)})})}reloadIframe(){return n(this,null,function*(){if(this.reloading!=null)return this.reloading;let e=n(this,null,function*(){try{this.destroy(),yield this.getIframe()}finally{this.reloading=null}});return this.reloading=e,e})}setupBiometricListener(e){let r=new URL(this.iframeUrl).origin;this.biometricListener=i=>n(this,null,function*(){if(i.origin!==r)return;let t=i.data;if((t==null?void 0:t.type)!=="biometric-request")return;let g=e.contentWindow;if(g!=null)try{this.biometricRequestHandler!=null&&(yield this.biometricRequestHandler(t.action));let a=null;if(t.action==="createCredential"){let s=t.payload,o=yield b.createCredential({name:s.name});a={id:o.id,publicKey:{x:`0x${o.publicKey.x.toString(16)}`,y:`0x${o.publicKey.y.toString(16)}`}}}else if(t.action==="sign"){let s=t.payload,{signature:o,metadata:f}=yield b.sign({credentialId:s.credentialId,challenge:s.challenge});a={signature:{r:`0x${o.r.toString(16)}`,s:`0x${o.s.toString(16)}`},metadata:f}}g.postMessage({type:"biometric-response",id:t.id,result:a},this.iframeUrl)}catch(a){let s=a instanceof Error?a.message:"Unknown biometric error";g.postMessage({type:"biometric-response",id:t.id,error:s},this.iframeUrl)}}),window.addEventListener("message",this.biometricListener)}getIframe(){return this.iframePromise==null&&(this.iframePromise=this.createIframe().catch(e=>{throw this.iframePromise=null,e})),this.iframePromise}createIframe(){let e=document.createElement("iframe");return e.src=this.iframeUrl,Object.assign(e.style,{position:"absolute",opacity:"0",pointerEvents:"none",width:"0",height:"0",border:"none",top:"-9999px",left:"-9999px"}),new Promise((r,i)=>{e.onload=()=>{this.setupBiometricListener(e),r(e)},e.onerror=()=>i(new Error("Failed to load device signer iframe")),document.body.appendChild(e)})}getDeviceName(){var t;if(typeof navigator=="undefined")return"Unknown Device";let e=navigator.userAgent,r=this.parseDevice(e),i=this.parseBrowser(e);return r!=null&&i!=null?`${i} on ${r}`:(t=r!=null?r:i)!=null?t:"Unknown Device"}parseDevice(e){return/iPad/.test(e)?"iPad":/iPhone/.test(e)?"iPhone":/Macintosh|Mac OS X/.test(e)?"Mac":/Windows/.test(e)?"Windows":/Android/.test(e)?"Android":/Linux/.test(e)?"Linux":/CrOS/.test(e)?"ChromeOS":null}parseBrowser(e){return/Edg\//.test(e)?"Edge":/OPR\/|Opera/.test(e)?"Opera":typeof navigator!="undefined"&&"brave"in navigator?"Brave":/Chrome\//.test(e)?"Chrome":/Safari\//.test(e)&&!/Chrome\//.test(e)?"Safari":/Firefox\//.test(e)?"Firefox":null}};m([u({logger:l,methodName:"deviceSignerKeyStorage.generateKey"})],c.prototype,"generateKey",1),m([u({logger:l,methodName:"deviceSignerKeyStorage.mapAddressToKey"})],c.prototype,"mapAddressToKey",1),m([u({logger:l,methodName:"deviceSignerKeyStorage.getKey"})],c.prototype,"getKey",1),m([u({logger:l,methodName:"deviceSignerKeyStorage.hasKey"})],c.prototype,"hasKey",1),m([u({logger:l,methodName:"deviceSignerKeyStorage.signMessage"})],c.prototype,"signMessage",1),m([u({logger:l,methodName:"deviceSignerKeyStorage.deleteKey"})],c.prototype,"deleteKey",1);export{c as a};
@@ -0,0 +1 @@
1
+ import{defineChain as o}from"viem";var r=o({id:4663,name:"Robinhood Chain",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.mainnet.chain.robinhood.com"]}},blockExplorers:{default:{name:"Robinhood Chain Explorer",url:"https://robinhoodchain.blockscout.com",apiUrl:"https://robinhoodchain.blockscout.com/api"}},testnet:!1});export{r as a};
@@ -1 +1 @@
1
- import{a}from"./chunk-NYGW4HYK.js";import{a as r}from"./chunk-Q3JQUVKI.js";import{a as t}from"./chunk-RNQMEZIV.js";import{a as n}from"./chunk-OQZTL6ZG.js";var i={evm:a,solana:r,stellar:t};function g(e){return i[n(e)]}function m(e){return Object.prototype.hasOwnProperty.call(i,e)}export{g as a,m as b};
1
+ import{a}from"./chunk-6T4GBLXY.js";import{a as r}from"./chunk-CXWFJGKI.js";import{a as t}from"./chunk-NQ3PROUV.js";import{a as n}from"./chunk-OQZTL6ZG.js";var i={evm:a,solana:r,stellar:t};function g(e){return i[n(e)]}function m(e){return Object.prototype.hasOwnProperty.call(i,e)}export{g as a,m as b};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var s="@crossmint/wallets-sdk",t="1.15.0";var p="WALLETS_SDK",c= exports.b =t,r= exports.c =s,a= exports.d =200;exports.a = p; exports.b = c; exports.c = r; exports.d = a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var s="@crossmint/wallets-sdk",t="1.16.0";var p="WALLETS_SDK",c= exports.b =t,r= exports.c =s,a= exports.d =200;exports.a = p; exports.b = c; exports.c = r; exports.d = a;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk3L3U3TIDcjs = require('./chunk-3L3U3TID.cjs');var _chunkGMU3ZYLScjs = require('./chunk-GMU3ZYLS.cjs');var _chunkCZC2MNVKcjs = require('./chunk-CZC2MNVK.cjs');var _chunkPHIW7FUJcjs = require('./chunk-PHIW7FUJ.cjs');var _chunk3DK46BDIcjs = require('./chunk-3DK46BDI.cjs');var _chunkQ66YRLSWcjs = require('./chunk-Q66YRLSW.cjs');var _chunkZEGNY3K3cjs = require('./chunk-ZEGNY3K3.cjs');var _chunkVS6I4S7Xcjs = require('./chunk-VS6I4S7X.cjs');var _chunkWIAIJCQ2cjs = require('./chunk-WIAIJCQ2.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var _ox = require('ox');var O="When 'signers' is provided to a method that may fetch an existing wallet, each specified signer must exist in that wallet's configuration.",R= exports.a =class{constructor(e){this.apiClient=e}getWallet(e,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let n,i;if(typeof e=="string"){if(!this.apiClient.isServerSide)throw new (0, _chunkVS6I4S7Xcjs.g)("getWallet with walletLocator is only available on the server side. Use getWallet(args) instead.");if(r==null)throw new (0, _chunkVS6I4S7Xcjs.g)("Wallet configuration is required when using walletLocator: https://docs.crossmint.com/sdk-reference/wallets/type-aliases/WalletArgsFor");n=e,i=r}else{if(this.apiClient.isServerSide)throw new (0, _chunkVS6I4S7Xcjs.g)("getWallet on server side requires a walletLocator parameter. Use getWallet(walletLocator, args) instead.");i=e,n=this.getWalletLocator(i)}let t=_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {},i),{chain:_chunkZEGNY3K3cjs.f.call(void 0, i.chain,this.apiClient.environment)});_chunkWIAIJCQ2cjs.a.info("walletFactory.getWallet.start");let s=yield this.apiClient.getWallet(n);if("error"in s)throw _chunkWIAIJCQ2cjs.a.warn("walletFactory.getWallet.notFound",{error:s.error}),new (0, _chunkVS6I4S7Xcjs.e)(JSON.stringify(s));return _chunkWIAIJCQ2cjs.a.info("walletFactory.getWallet.success",{address:s.address}),yield this.createWalletInstance(s,t)})}createWallet(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var d,y,g,v,m,E;let r=_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {},e),{chain:_chunkZEGNY3K3cjs.f.call(void 0, e.chain,this.apiClient.environment)});if(yield(g=(y=(d=r.options)==null?void 0:d.callbacks)==null?void 0:y.onWalletCreationStart)==null?void 0:g.call(y),_chunkWIAIJCQ2cjs.a.info("walletFactory.createWallet.start"),!this.apiClient.isServerSide&&r.owner!=null)throw _chunkWIAIJCQ2cjs.a.error("walletFactory.createWallet.error",{error:"Owner field cannot be specified in client-side createWallet calls"}),new (0, _chunkVS6I4S7Xcjs.g)("Owner field cannot be specified in client-side createWallet calls. Owner is determined from JWT authentication.");let n=(v=r.signers)!=null?v:[],i=((m=r.options)==null?void 0:m.deviceSignerKeyStorage)!=null&&!n.some(A=>A.type==="device"),t=i?[...n,{type:"device"}]:n,s=yield this.registerSigners(t,r.chain,(E=r.options)==null?void 0:E.deviceSignerKeyStorage),o=this.validatedRecoverySignerList(r.recovery,r.chain),a=[];for(let A of o)a.push(yield this.resolveRecoverySigner(A,r.chain));let l=Array.isArray(r.recovery)?{recoveryMethods:a}:{adminSigner:a[0]},c=yield this.createSmartWallet(r,l,s,i);if("error"in c)throw _chunkWIAIJCQ2cjs.a.error("walletFactory.createWallet.error",{error:c.error}),_chunkVS6I4S7Xcjs.R.call(void 0, c),new (0, _chunkVS6I4S7Xcjs.g)(JSON.stringify(c));return _chunkWIAIJCQ2cjs.a.info("walletFactory.createWallet.success",{address:c.address}),yield this.createWalletInstance(c,r)})}createSmartWallet(e,r,n,i){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let t=l=>{var c,d;return{type:"smart",chainType:this.getChainType(e.chain),config:_chunkDSIFRRBScjs.a.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {},r),e.plugins?{plugins:e.plugins}:{}),l!=null?{delegatedSigners:l}:{}),owner:(c=e.owner)!=null?c:void 0,alias:(d=e.alias)!=null?d:void 0}},s=yield this.apiClient.createWallet(t(n));if(!(i&&"error"in s&&s.code===_chunkVS6I4S7Xcjs.l))return s;_chunkWIAIJCQ2cjs.a.info("walletFactory.createWallet.deviceSignerUnsupported.retryWithoutDeviceSigner",{chain:e.chain});let a=n.filter(l=>!this.isBuiltDeviceSigner(l));return yield this.apiClient.createWallet(t(a))})}validatedRecoverySignerList(e,r){let n=_chunk3DK46BDIcjs.a.call(void 0, e);if(!Array.isArray(e))return n;if(r!=="solana"&&r!=="stellar")throw new (0, _chunkVS6I4S7Xcjs.t)(`Multiple recovery signers are not supported on ${r} yet. Pass a single recovery signer.`);if(n.length===0)throw new (0, _chunkVS6I4S7Xcjs.o)("At least one recovery signer is required");return n}resolveRecoverySigner(e,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){if(e.type==="passkey"&&e.id==null)return yield this.createPasskeySigner(e);if(e.type==="server"){let{derivedAddress:n}=_chunkQ66YRLSWcjs.b.call(void 0, e,r,this.apiClient.projectId,this.apiClient.environment);return{type:"server",address:n}}return e})}isBuiltDeviceSigner(e){let r=e.signer;return typeof r=="object"&&r!=null&&r.type==="device"}mergePhoneChannel(e,r){return e.type!=="phone"||(r==null?void 0:r.type)!=="phone"||r.channel==null?e:_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {},e),{channel:r.channel})}createWalletInstance(e,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var y;this.validateExistingWalletConfig(e,r);let n=r,i=e.config,t=(y=i.recoveryMethods)!=null?y:[i.adminSigner],s=this.mergeRecoverySigners(t,_chunk3DK46BDIcjs.a.call(void 0, n.recovery),r.chain),o=i.delegatedSigners,a=o;if(a!=null&&a.length===1&&(a[0].type==="server"||a[0].type==="external-wallet"))a=n.signers;else if(a!=null){let g=n.signers;a=a.map(v=>this.mergePhoneChannel(v,g==null?void 0:g.find(m=>m.type==="phone"&&v.type==="phone"&&_chunkCZC2MNVKcjs.b.call(void 0, m)===v.locator)))}let l=t.filter(g=>g.type==="server"&&"address"in g&&!("secret"in g)).map(g=>g.address),c=(o!=null?o:[]).filter(g=>g.type==="server"&&"address"in g&&!("secret"in g)).map(g=>g.address),d=new (0, _chunk3L3U3TIDcjs.a)({chain:r.chain,address:e.address,owner:e.owner,options:r.options,alias:r.alias,recovery:s,apiRecoveryServerSignerAddresses:l,apiDelegatedServerSignerAddresses:c,signers:a!=null?a:[]},this.apiClient);return yield d.waitForInit(),d})}mergeRecoverySigners(e,r,n){let i=[...r],t=new Map,s=[(o,a)=>this.matchesRecoverySigner(o,a,n),(o,a)=>o.type===a.type];for(let o of s)e.forEach((a,l)=>{if(t.has(l))return;let c=i.findIndex(d=>o(d,a));c!==-1&&t.set(l,i.splice(c,1)[0])});return e.map((o,a)=>{let l=t.get(a);return l==null?o:l.type==="server"||l.type==="external-wallet"?l:this.mergePhoneChannel(o,l)})}matchesRecoverySigner(e,r,n){if(e.type!==r.type)return!1;if(e.type==="email"&&"email"in r)return _chunkPHIW7FUJcjs.b.call(void 0, e.email)===_chunkPHIW7FUJcjs.b.call(void 0, r.email);if(e.type==="phone"&&"phone"in r)return e.phone===r.phone;if(e.type==="external-wallet"&&"address"in r)return e.address===r.address;if(e.type==="server"&&"address"in r){if(!("secret"in e))return e.address===r.address;let{primary:i,legacy:t}=_chunkQ66YRLSWcjs.c.call(void 0, e,n,this.apiClient.projectId,this.apiClient.environment);return i.derivedAddress===r.address||(t==null?void 0:t.derivedAddress)===r.address}return!0}getWalletLocator(e){return`me:${this.getChainType(e.chain)}:smart`+(e.alias!=null?`:alias:${e.alias}`:"")}createPasskeySigner(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var i;if(e.type!=="passkey")throw new Error("Signer is not a passkey");let r=(i=e.name)!=null?i:`Crossmint Wallet ${Date.now()}`,n=e.onCreatePasskey?yield e.onCreatePasskey(r):yield _ox.WebAuthnP256.createCredential({name:r});return{type:"passkey",id:n.id,name:r,publicKey:{x:n.publicKey.x.toString(),y:n.publicKey.y.toString()}}})}validateExistingWalletConfig(e,r){var i;if(r.owner!=null&&e.owner!=null&&_chunkPHIW7FUJcjs.b.call(void 0, r.owner)!==_chunkPHIW7FUJcjs.b.call(void 0, e.owner))throw new (0, _chunkVS6I4S7Xcjs.g)("Wallet owner does not match existing wallet's linked user");if(r.chain==="solana"&&e.chainType!=="solana"||r.chain!=="solana"&&e.chainType==="solana"||r.chain==="stellar"&&e.chainType!=="stellar"||r.chain!=="stellar"&&e.chainType==="stellar")throw new (0, _chunkVS6I4S7Xcjs.g)(`Wallet chain does not match existing wallet's chain. You must use chain: ${e.chainType}.`);if(e.type!=="smart")return;let n=r;if(n.recovery!=null||n.signers!=null){let t=e.config,s=(i=t==null?void 0:t.recoveryMethods)!=null?i:(t==null?void 0:t.adminSigner)!=null?[t.adminSigner]:[],o=[...s];for(let l of _chunk3DK46BDIcjs.a.call(void 0, n.recovery)){if(s.length===0)break;let c=o.findIndex(y=>this.matchesRecoverySigner(l,y,r.chain)),d=c===-1?o.find(y=>y.type===l.type):o[c];if(d==null)throw new (0, _chunkVS6I4S7Xcjs.g)("The wallet recovery signer type does not match the existing wallet's recovery signer type");_chunkPHIW7FUJcjs.c.call(void 0, l,d),c!==-1&&o.splice(c,1)}let a=n.signers;a!=null&&this.validateSigners(e,a,r.chain)}}validateSigners(e,r,n){let i=e.config,t=i==null?void 0:i.delegatedSigners;if(r.length!==0){if(t==null||t.length===0)throw new (0, _chunkVS6I4S7Xcjs.g)(`${r.length} signer(s) specified, but wallet "${e.address}" has no signers. ${O}`);for(let s of r){let o=t.find(a=>{if(this.isMatchingPasskeySigner(s,a,i)||a.type==="device"&&s.type==="device")return!0;if(s.type==="server"){let{primary:l,legacy:c}=_chunkQ66YRLSWcjs.c.call(void 0, s,n,this.apiClient.projectId,this.apiClient.environment);return a.locator===`server:${l.derivedAddress}`||c!=null&&a.locator===`server:${c.derivedAddress}`}return a.locator===_chunkCZC2MNVKcjs.b.call(void 0, s)});if(o==null){let a=t.map(l=>l.locator).join(", ");throw new (0, _chunkVS6I4S7Xcjs.g)(`Signer '${s.type}' does not exist in wallet "${e.address}". Available signers: ${a}. ${O}`)}_chunkPHIW7FUJcjs.c.call(void 0, s,o)}}}isMatchingPasskeySigner(e,r,n){var t,s;let i=((s=(t=n.delegatedSigners)==null?void 0:t.filter(o=>o.type==="passkey").length)!=null?s:0)+(n.adminSigner.type==="passkey"?1:0);if(e.type==="passkey"){if(e.id==null&&i===1)return r.type==="passkey";if(e.id==null&&i>1)throw new (0, _chunkVS6I4S7Xcjs.g)("When creating a wallet with multiple passkeys, you must provide the passkey ID for each passkey.")}return!1}registerSigners(e,r,n){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var i;return yield Promise.all((i=e==null?void 0:e.map(t=>_chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){if(t.type==="passkey")return t.id==null?{signer:yield this.createPasskeySigner(t)}:{signer:t};if(t.type==="device"){if(t.publicKey!=null)return{signer:{type:"device",publicKey:t.publicKey,name:t.name}};if(t.locator!=null)return{signer:t.locator};if(n==null)throw new (0, _chunkVS6I4S7Xcjs.g)("Device signer key storage is required for device signers");let s=yield _chunkGMU3ZYLScjs.a.call(void 0, n);return{signer:{type:"device",publicKey:s.publicKey,name:s.name}}}if(t.type==="server"&&r!=null){let{derivedAddress:s}=_chunkQ66YRLSWcjs.b.call(void 0, t,r,this.apiClient.projectId,this.apiClient.environment);return{signer:`server:${s}`}}return{signer:_chunkCZC2MNVKcjs.b.call(void 0, t)}})))!=null?i:[])})}getChainType(e){return e==="solana"?"solana":e==="stellar"?"stellar":"evm"}};_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkWIAIJCQ2cjs.a,methodName:"walletFactory.getWallet",buildContext(e,r){if(typeof r[0]=="string"){let i=r[1];return{walletLocator:r[0],chain:i==null?void 0:i.chain}}let n=r[0];return{chain:n==null?void 0:n.chain}}})],R.prototype,"getWallet",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkWIAIJCQ2cjs.a,methodName:"walletFactory.createWallet",buildContext(e,r){return{chain:r[0].chain}}})],R.prototype,"createWallet",1);exports.a = R;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk63VNTHGQcjs = require('./chunk-63VNTHGQ.cjs');var _chunkGMU3ZYLScjs = require('./chunk-GMU3ZYLS.cjs');var _chunkCZC2MNVKcjs = require('./chunk-CZC2MNVK.cjs');var _chunkPHIW7FUJcjs = require('./chunk-PHIW7FUJ.cjs');var _chunk3DK46BDIcjs = require('./chunk-3DK46BDI.cjs');var _chunkQ66YRLSWcjs = require('./chunk-Q66YRLSW.cjs');var _chunkBHHXVRU6cjs = require('./chunk-BHHXVRU6.cjs');var _chunkVS6I4S7Xcjs = require('./chunk-VS6I4S7X.cjs');var _chunkSP5DQZ6Dcjs = require('./chunk-SP5DQZ6D.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var _ox = require('ox');var O="When 'signers' is provided to a method that may fetch an existing wallet, each specified signer must exist in that wallet's configuration.",R= exports.a =class{constructor(e){this.apiClient=e}getWallet(e,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let n,i;if(typeof e=="string"){if(!this.apiClient.isServerSide)throw new (0, _chunkVS6I4S7Xcjs.g)("getWallet with walletLocator is only available on the server side. Use getWallet(args) instead.");if(r==null)throw new (0, _chunkVS6I4S7Xcjs.g)("Wallet configuration is required when using walletLocator: https://docs.crossmint.com/sdk-reference/wallets/type-aliases/WalletArgsFor");n=e,i=r}else{if(this.apiClient.isServerSide)throw new (0, _chunkVS6I4S7Xcjs.g)("getWallet on server side requires a walletLocator parameter. Use getWallet(walletLocator, args) instead.");i=e,n=this.getWalletLocator(i)}let t=_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {},i),{chain:_chunkBHHXVRU6cjs.f.call(void 0, i.chain,this.apiClient.environment)});_chunkSP5DQZ6Dcjs.a.info("walletFactory.getWallet.start");let s=yield this.apiClient.getWallet(n);if("error"in s)throw _chunkSP5DQZ6Dcjs.a.warn("walletFactory.getWallet.notFound",{error:s.error}),new (0, _chunkVS6I4S7Xcjs.e)(JSON.stringify(s));return _chunkSP5DQZ6Dcjs.a.info("walletFactory.getWallet.success",{address:s.address}),yield this.createWalletInstance(s,t)})}createWallet(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var d,y,g,v,m,E;let r=_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {},e),{chain:_chunkBHHXVRU6cjs.f.call(void 0, e.chain,this.apiClient.environment)});if(yield(g=(y=(d=r.options)==null?void 0:d.callbacks)==null?void 0:y.onWalletCreationStart)==null?void 0:g.call(y),_chunkSP5DQZ6Dcjs.a.info("walletFactory.createWallet.start"),!this.apiClient.isServerSide&&r.owner!=null)throw _chunkSP5DQZ6Dcjs.a.error("walletFactory.createWallet.error",{error:"Owner field cannot be specified in client-side createWallet calls"}),new (0, _chunkVS6I4S7Xcjs.g)("Owner field cannot be specified in client-side createWallet calls. Owner is determined from JWT authentication.");let n=(v=r.signers)!=null?v:[],i=((m=r.options)==null?void 0:m.deviceSignerKeyStorage)!=null&&!n.some(A=>A.type==="device"),t=i?[...n,{type:"device"}]:n,s=yield this.registerSigners(t,r.chain,(E=r.options)==null?void 0:E.deviceSignerKeyStorage),o=this.validatedRecoverySignerList(r.recovery,r.chain),a=[];for(let A of o)a.push(yield this.resolveRecoverySigner(A,r.chain));let l=Array.isArray(r.recovery)?{recoveryMethods:a}:{adminSigner:a[0]},c=yield this.createSmartWallet(r,l,s,i);if("error"in c)throw _chunkSP5DQZ6Dcjs.a.error("walletFactory.createWallet.error",{error:c.error}),_chunkVS6I4S7Xcjs.R.call(void 0, c),new (0, _chunkVS6I4S7Xcjs.g)(JSON.stringify(c));return _chunkSP5DQZ6Dcjs.a.info("walletFactory.createWallet.success",{address:c.address}),yield this.createWalletInstance(c,r)})}createSmartWallet(e,r,n,i){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let t=l=>{var c,d;return{type:"smart",chainType:this.getChainType(e.chain),config:_chunkDSIFRRBScjs.a.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {},r),e.plugins?{plugins:e.plugins}:{}),l!=null?{delegatedSigners:l}:{}),owner:(c=e.owner)!=null?c:void 0,alias:(d=e.alias)!=null?d:void 0}},s=yield this.apiClient.createWallet(t(n));if(!(i&&"error"in s&&s.code===_chunkVS6I4S7Xcjs.l))return s;_chunkSP5DQZ6Dcjs.a.info("walletFactory.createWallet.deviceSignerUnsupported.retryWithoutDeviceSigner",{chain:e.chain});let a=n.filter(l=>!this.isBuiltDeviceSigner(l));return yield this.apiClient.createWallet(t(a))})}validatedRecoverySignerList(e,r){let n=_chunk3DK46BDIcjs.a.call(void 0, e);if(!Array.isArray(e))return n;if(r!=="solana"&&r!=="stellar")throw new (0, _chunkVS6I4S7Xcjs.t)(`Multiple recovery signers are not supported on ${r} yet. Pass a single recovery signer.`);if(n.length===0)throw new (0, _chunkVS6I4S7Xcjs.o)("At least one recovery signer is required");return n}resolveRecoverySigner(e,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){if(e.type==="passkey"&&e.id==null)return yield this.createPasskeySigner(e);if(e.type==="server"){let{derivedAddress:n}=_chunkQ66YRLSWcjs.b.call(void 0, e,r,this.apiClient.projectId,this.apiClient.environment);return{type:"server",address:n}}return e})}isBuiltDeviceSigner(e){let r=e.signer;return typeof r=="object"&&r!=null&&r.type==="device"}mergePhoneChannel(e,r){return e.type!=="phone"||(r==null?void 0:r.type)!=="phone"||r.channel==null?e:_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {},e),{channel:r.channel})}createWalletInstance(e,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var y;this.validateExistingWalletConfig(e,r);let n=r,i=e.config,t=(y=i.recoveryMethods)!=null?y:[i.adminSigner],s=this.mergeRecoverySigners(t,_chunk3DK46BDIcjs.a.call(void 0, n.recovery),r.chain),o=i.delegatedSigners,a=o;if(a!=null&&a.length===1&&(a[0].type==="server"||a[0].type==="external-wallet"))a=n.signers;else if(a!=null){let g=n.signers;a=a.map(v=>this.mergePhoneChannel(v,g==null?void 0:g.find(m=>m.type==="phone"&&v.type==="phone"&&_chunkCZC2MNVKcjs.b.call(void 0, m)===v.locator)))}let l=t.filter(g=>g.type==="server"&&"address"in g&&!("secret"in g)).map(g=>g.address),c=(o!=null?o:[]).filter(g=>g.type==="server"&&"address"in g&&!("secret"in g)).map(g=>g.address),d=new (0, _chunk63VNTHGQcjs.a)({chain:r.chain,address:e.address,owner:e.owner,options:r.options,alias:r.alias,recovery:s,apiRecoveryServerSignerAddresses:l,apiDelegatedServerSignerAddresses:c,signers:a!=null?a:[]},this.apiClient);return yield d.waitForInit(),d})}mergeRecoverySigners(e,r,n){let i=[...r],t=new Map,s=[(o,a)=>this.matchesRecoverySigner(o,a,n),(o,a)=>o.type===a.type];for(let o of s)e.forEach((a,l)=>{if(t.has(l))return;let c=i.findIndex(d=>o(d,a));c!==-1&&t.set(l,i.splice(c,1)[0])});return e.map((o,a)=>{let l=t.get(a);return l==null?o:l.type==="server"||l.type==="external-wallet"?l:this.mergePhoneChannel(o,l)})}matchesRecoverySigner(e,r,n){if(e.type!==r.type)return!1;if(e.type==="email"&&"email"in r)return _chunkPHIW7FUJcjs.b.call(void 0, e.email)===_chunkPHIW7FUJcjs.b.call(void 0, r.email);if(e.type==="phone"&&"phone"in r)return e.phone===r.phone;if(e.type==="external-wallet"&&"address"in r)return e.address===r.address;if(e.type==="server"&&"address"in r){if(!("secret"in e))return e.address===r.address;let{primary:i,legacy:t}=_chunkQ66YRLSWcjs.c.call(void 0, e,n,this.apiClient.projectId,this.apiClient.environment);return i.derivedAddress===r.address||(t==null?void 0:t.derivedAddress)===r.address}return!0}getWalletLocator(e){return`me:${this.getChainType(e.chain)}:smart`+(e.alias!=null?`:alias:${e.alias}`:"")}createPasskeySigner(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var i;if(e.type!=="passkey")throw new Error("Signer is not a passkey");let r=(i=e.name)!=null?i:`Crossmint Wallet ${Date.now()}`,n=e.onCreatePasskey?yield e.onCreatePasskey(r):yield _ox.WebAuthnP256.createCredential({name:r});return{type:"passkey",id:n.id,name:r,publicKey:{x:n.publicKey.x.toString(),y:n.publicKey.y.toString()}}})}validateExistingWalletConfig(e,r){var i;if(r.owner!=null&&e.owner!=null&&_chunkPHIW7FUJcjs.b.call(void 0, r.owner)!==_chunkPHIW7FUJcjs.b.call(void 0, e.owner))throw new (0, _chunkVS6I4S7Xcjs.g)("Wallet owner does not match existing wallet's linked user");if(r.chain==="solana"&&e.chainType!=="solana"||r.chain!=="solana"&&e.chainType==="solana"||r.chain==="stellar"&&e.chainType!=="stellar"||r.chain!=="stellar"&&e.chainType==="stellar")throw new (0, _chunkVS6I4S7Xcjs.g)(`Wallet chain does not match existing wallet's chain. You must use chain: ${e.chainType}.`);if(e.type!=="smart")return;let n=r;if(n.recovery!=null||n.signers!=null){let t=e.config,s=(i=t==null?void 0:t.recoveryMethods)!=null?i:(t==null?void 0:t.adminSigner)!=null?[t.adminSigner]:[],o=[...s];for(let l of _chunk3DK46BDIcjs.a.call(void 0, n.recovery)){if(s.length===0)break;let c=o.findIndex(y=>this.matchesRecoverySigner(l,y,r.chain)),d=c===-1?o.find(y=>y.type===l.type):o[c];if(d==null)throw new (0, _chunkVS6I4S7Xcjs.g)("The wallet recovery signer type does not match the existing wallet's recovery signer type");_chunkPHIW7FUJcjs.c.call(void 0, l,d),c!==-1&&o.splice(c,1)}let a=n.signers;a!=null&&this.validateSigners(e,a,r.chain)}}validateSigners(e,r,n){let i=e.config,t=i==null?void 0:i.delegatedSigners;if(r.length!==0){if(t==null||t.length===0)throw new (0, _chunkVS6I4S7Xcjs.g)(`${r.length} signer(s) specified, but wallet "${e.address}" has no signers. ${O}`);for(let s of r){let o=t.find(a=>{if(this.isMatchingPasskeySigner(s,a,i)||a.type==="device"&&s.type==="device")return!0;if(s.type==="server"){let{primary:l,legacy:c}=_chunkQ66YRLSWcjs.c.call(void 0, s,n,this.apiClient.projectId,this.apiClient.environment);return a.locator===`server:${l.derivedAddress}`||c!=null&&a.locator===`server:${c.derivedAddress}`}return a.locator===_chunkCZC2MNVKcjs.b.call(void 0, s)});if(o==null){let a=t.map(l=>l.locator).join(", ");throw new (0, _chunkVS6I4S7Xcjs.g)(`Signer '${s.type}' does not exist in wallet "${e.address}". Available signers: ${a}. ${O}`)}_chunkPHIW7FUJcjs.c.call(void 0, s,o)}}}isMatchingPasskeySigner(e,r,n){var t,s;let i=((s=(t=n.delegatedSigners)==null?void 0:t.filter(o=>o.type==="passkey").length)!=null?s:0)+(n.adminSigner.type==="passkey"?1:0);if(e.type==="passkey"){if(e.id==null&&i===1)return r.type==="passkey";if(e.id==null&&i>1)throw new (0, _chunkVS6I4S7Xcjs.g)("When creating a wallet with multiple passkeys, you must provide the passkey ID for each passkey.")}return!1}registerSigners(e,r,n){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var i;return yield Promise.all((i=e==null?void 0:e.map(t=>_chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){if(t.type==="passkey")return t.id==null?{signer:yield this.createPasskeySigner(t)}:{signer:t};if(t.type==="device"){if(t.publicKey!=null)return{signer:{type:"device",publicKey:t.publicKey,name:t.name}};if(t.locator!=null)return{signer:t.locator};if(n==null)throw new (0, _chunkVS6I4S7Xcjs.g)("Device signer key storage is required for device signers");let s=yield _chunkGMU3ZYLScjs.a.call(void 0, n);return{signer:{type:"device",publicKey:s.publicKey,name:s.name}}}if(t.type==="server"&&r!=null){let{derivedAddress:s}=_chunkQ66YRLSWcjs.b.call(void 0, t,r,this.apiClient.projectId,this.apiClient.environment);return{signer:`server:${s}`}}return{signer:_chunkCZC2MNVKcjs.b.call(void 0, t)}})))!=null?i:[])})}getChainType(e){return e==="solana"?"solana":e==="stellar"?"stellar":"evm"}};_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkSP5DQZ6Dcjs.a,methodName:"walletFactory.getWallet",buildContext(e,r){if(typeof r[0]=="string"){let i=r[1];return{walletLocator:r[0],chain:i==null?void 0:i.chain}}let n=r[0];return{chain:n==null?void 0:n.chain}}})],R.prototype,"getWallet",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkSP5DQZ6Dcjs.a,methodName:"walletFactory.createWallet",buildContext(e,r){return{chain:r[0].chain}}})],R.prototype,"createWallet",1);exports.a = R;
@@ -1 +1 @@
1
- import{A as M,D as m,F as b,I as C,J as x,K as A,L as y,M as k,Q as w}from"./chunk-KOHPRJDP.js";import{a as E}from"./chunk-JNGPW247.js";import{d as S}from"./chunk-QU5AAJAW.js";import{h as l}from"./chunk-NU7VF7MC.js";function W(i,o,a,r){return l(this,null,function*(){var h,d;let{timeoutMs:e=6e4,initialBackoffMs:u=500,backoffMultiplier:n=1.5,maxBackoffMs:f=2e3,fastWindowMs:L=5e3}=r!=null?r:{};E.info("wallet.approve: waiting for transaction confirmation",{transactionId:a,timeoutMs:e});let p=Date.now(),c=u,t;do{if(Date.now()-p>e)throw new x("Transaction confirmation timeout");let s=Date.now();if(t=yield i.getTransaction(o,a),t.error)throw w(t),new C(JSON.stringify(t));if(t.status!=="pending")break;let T=Date.now()-p;T>L&&(c=Math.min(Math.round(c*n),f));let v=Date.now()-s;yield D(Math.max(1,Math.min(c-v,e-T)))}while(!0);if(t.status==="failed")throw new A(`Transaction sending failed: ${JSON.stringify(t)}`);if(t.status==="awaiting-approval")throw new y("Transaction is awaiting approval. Please submit required approvals before waiting for completion.");let P="txHash"in t.onChain&&typeof t.onChain.txHash=="string"?t.onChain.txHash:void 0,g=(h=t.onChain.txId)!=null?h:P;if(g==null)throw new k("Transaction hash not found on transaction response");return{hash:g,explorerLink:(d=t.onChain.explorerLink)!=null?d:"",transactionId:t.id}})}function B(i,o,a,r){return l(this,null,function*(){let{timeoutMs:e=6e4}=r!=null?r:{},u=Date.now(),n=null;do{if(Date.now()-u>e)throw new b("Signature confirmation timeout");if(yield new Promise(f=>setTimeout(f,S)),n=yield i.getSignature(o,a),"error"in n)throw w(n),new m(JSON.stringify(n))}while(n===null||n.status==="pending");if(n.status==="failed")throw new M("Signature signing failed");if(!n.outputSignature)throw new m("Signature not available");return{signature:n.outputSignature,signatureId:a}})}function D(i){return l(this,null,function*(){return new Promise(o=>setTimeout(o,i))})}export{W as a,B as b};
1
+ import{A as M,D as m,F as b,I as C,J as x,K as A,L as y,M as k,Q as w}from"./chunk-KOHPRJDP.js";import{a as E}from"./chunk-AZAIXRGS.js";import{d as S}from"./chunk-FUZ2TPGD.js";import{h as l}from"./chunk-NU7VF7MC.js";function W(i,o,a,r){return l(this,null,function*(){var h,d;let{timeoutMs:e=6e4,initialBackoffMs:u=500,backoffMultiplier:n=1.5,maxBackoffMs:f=2e3,fastWindowMs:L=5e3}=r!=null?r:{};E.info("wallet.approve: waiting for transaction confirmation",{transactionId:a,timeoutMs:e});let p=Date.now(),c=u,t;do{if(Date.now()-p>e)throw new x("Transaction confirmation timeout");let s=Date.now();if(t=yield i.getTransaction(o,a),t.error)throw w(t),new C(JSON.stringify(t));if(t.status!=="pending")break;let T=Date.now()-p;T>L&&(c=Math.min(Math.round(c*n),f));let v=Date.now()-s;yield D(Math.max(1,Math.min(c-v,e-T)))}while(!0);if(t.status==="failed")throw new A(`Transaction sending failed: ${JSON.stringify(t)}`);if(t.status==="awaiting-approval")throw new y("Transaction is awaiting approval. Please submit required approvals before waiting for completion.");let P="txHash"in t.onChain&&typeof t.onChain.txHash=="string"?t.onChain.txHash:void 0,g=(h=t.onChain.txId)!=null?h:P;if(g==null)throw new k("Transaction hash not found on transaction response");return{hash:g,explorerLink:(d=t.onChain.explorerLink)!=null?d:"",transactionId:t.id}})}function B(i,o,a,r){return l(this,null,function*(){let{timeoutMs:e=6e4}=r!=null?r:{},u=Date.now(),n=null;do{if(Date.now()-u>e)throw new b("Signature confirmation timeout");if(yield new Promise(f=>setTimeout(f,S)),n=yield i.getSignature(o,a),"error"in n)throw w(n),new m(JSON.stringify(n))}while(n===null||n.status==="pending");if(n.status==="failed")throw new M("Signature signing failed");if(!n.outputSignature)throw new m("Signature not available");return{signature:n.outputSignature,signatureId:a}})}function D(i){return l(this,null,function*(){return new Promise(o=>setTimeout(o,i))})}export{W as a,B as b};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkD6UK5JAAcjs = require('./chunk-D6UK5JAA.cjs');var _chunkT7DD437Dcjs = require('./chunk-T7DD437D.cjs');var _chunkKQIDRPABcjs = require('./chunk-KQIDRPAB.cjs');var _chunkIQ6EAHDUcjs = require('./chunk-IQ6EAHDU.cjs');var _chunkP5VJ455Gcjs = require('./chunk-P5VJ455G.cjs');var _chunkT5LUBX5Jcjs = require('./chunk-T5LUBX5J.cjs');var _chunk3RVLLQ4Mcjs = require('./chunk-3RVLLQ4M.cjs');var _chunkVS6I4S7Xcjs = require('./chunk-VS6I4S7X.cjs');function u(r){switch(r){case"email":return _chunkP5VJ455Gcjs.a;case"phone":return _chunkD6UK5JAAcjs.a;case"passkey":return _chunk3RVLLQ4Mcjs.a;case"device":return _chunkIQ6EAHDUcjs.a;case"api-key":return _chunkKQIDRPABcjs.a;case"server":return _chunkT7DD437Dcjs.a;case"external-wallet":return _chunkT5LUBX5Jcjs.b;default:throw new (0, _chunkVS6I4S7Xcjs.k)(`Unknown signer type: ${r}`)}}exports.a = u;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkP5VJ455Gcjs = require('./chunk-P5VJ455G.cjs');var _chunkT5LUBX5Jcjs = require('./chunk-T5LUBX5J.cjs');var _chunk3RVLLQ4Mcjs = require('./chunk-3RVLLQ4M.cjs');var _chunkD6UK5JAAcjs = require('./chunk-D6UK5JAA.cjs');var _chunkT7DD437Dcjs = require('./chunk-T7DD437D.cjs');var _chunkKQIDRPABcjs = require('./chunk-KQIDRPAB.cjs');var _chunkIQ6EAHDUcjs = require('./chunk-IQ6EAHDU.cjs');var _chunkVS6I4S7Xcjs = require('./chunk-VS6I4S7X.cjs');function u(r){switch(r){case"email":return _chunkP5VJ455Gcjs.a;case"phone":return _chunkD6UK5JAAcjs.a;case"passkey":return _chunk3RVLLQ4Mcjs.a;case"device":return _chunkIQ6EAHDUcjs.a;case"api-key":return _chunkKQIDRPABcjs.a;case"server":return _chunkT7DD437Dcjs.a;case"external-wallet":return _chunkT5LUBX5Jcjs.b;default:throw new (0, _chunkVS6I4S7Xcjs.k)(`Unknown signer type: ${r}`)}}exports.a = u;
@@ -1 +1 @@
1
- import{a as i}from"./chunk-L7RATGRO.js";import{H as u}from"./chunk-KOHPRJDP.js";import{a as t}from"./chunk-JNGPW247.js";import{a as f,c,h as s}from"./chunk-NU7VF7MC.js";import{isValidStellarAddress as T,WithLoggerContext as g}from"@crossmint/common-sdk-base";var m=409,l=class l extends i{constructor(e){super({chain:e.chain,address:e.address,owner:e.owner,options:i.getOptions(e),alias:e.alias,recovery:i.getRecoverySigners(e),apiRecoveryServerSignerAddresses:i.getApiRecoveryServerSignerAddresses(e),apiDelegatedServerSignerAddresses:i.getApiDelegatedServerSignerAddresses(e),signer:e.signer,signers:i.getInitialSigners(e)},i.getApiClient(e))}static from(e){if(!T(e.address))throw new Error("Wallet is not a Stellar wallet");return new l(e)}sendTransaction(e){return s(this,null,function*(){var d;t.info("stellarWallet.sendTransaction.start"),yield this.preAuthIfNeeded();let r=yield this.createTransaction(e);if((d=e.options)!=null&&d.prepareOnly)return t.info("stellarWallet.sendTransaction.prepared",{transactionId:r.id}),{hash:void 0,explorerLink:void 0,transactionId:r.id};let a={},n=yield this.approveTransactionAndWait(r.id,a);return t.info("stellarWallet.sendTransaction.success",{transactionId:r.id,hash:n.hash}),n})}upgrade(e){return s(this,null,function*(){t.info("stellarWallet.upgrade.start"),yield this.preAuthIfNeeded();let r=yield this.createWalletLifecycleTransaction("upgrade-wallet",e);if(r!=null){if(e!=null&&e.prepareOnly)return t.info("stellarWallet.upgrade.prepared",{transactionId:r}),{hash:void 0,explorerLink:void 0,transactionId:r};yield this.approveTransactionAndWait(r),t.info("stellarWallet.upgrade.phase1.success",{transactionId:r})}else t.info("stellarWallet.upgrade.phase1.skipped",{reason:"wallet already locked from a prior upgrade"});let a=yield this.migrateInternal({signer:e==null?void 0:e.signer,prepareOnly:e==null?void 0:e.prepareOnly});return t.info("stellarWallet.upgrade.success",{transactionId:a.transactionId,hash:a.hash}),a})}migrate(e){return s(this,null,function*(){return yield this.preAuthIfNeeded(),yield this.migrateInternal(e)})}migrateInternal(e){return s(this,null,function*(){t.info("stellarWallet.migrate.start");let r=yield this.createWalletLifecycleTransaction("migrate-wallet",e);if(r==null)throw new u("Failed to create migrate-wallet transaction");if(e!=null&&e.prepareOnly)return t.info("stellarWallet.migrate.prepared",{transactionId:r}),{hash:void 0,explorerLink:void 0,transactionId:r};let a=yield this.approveTransactionAndWait(r);return t.info("stellarWallet.migrate.success",{transactionId:r,hash:a.hash}),a})}createTransaction(e){return s(this,null,function*(){let{contractId:r,options:a}=e,n=this.resolveStellarSigner(a==null?void 0:a.signer),d="transaction"in e?{type:"serialized-transaction",serializedTransaction:e.transaction,contractId:r}:{type:"contract-call",contractId:r,method:e.method,memo:e.memo!=null?{type:"text",value:e.memo}:void 0,args:e.args},p=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:d,signer:n}});if("error"in p)throw new u(JSON.stringify(p));return p})}createWalletLifecycleTransaction(e,r){return s(this,null,function*(){let a=(r==null?void 0:r.signer)!=null?this.resolveStellarSigner(r.signer):void 0,n=yield this.apiClient.createTransaction(this.walletLocator,{params:f({transaction:{type:e}},a!=null?{signer:a}:{})});if("error"in n){if(e==="upgrade-wallet"&&y(n))return null;throw new u(JSON.stringify(n))}return n.id})}resolveStellarSigner(e){return e==null?this.signerManager.require().locator():typeof e=="string"?e:this.resolveServerSignerApiLocator(e)}};c([g({logger:t,methodName:"stellarWallet.sendTransaction",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"sendTransaction",1),c([g({logger:t,methodName:"stellarWallet.upgrade",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"upgrade",1),c([g({logger:t,methodName:"stellarWallet.migrate",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"migrate",1);var h=l;function y(o){return typeof o=="object"&&o!==null&&"statusCode"in o&&o.statusCode===m}export{h as a};
1
+ import{a as i}from"./chunk-LUUUKDHQ.js";import{H as u}from"./chunk-KOHPRJDP.js";import{a as t}from"./chunk-AZAIXRGS.js";import{a as f,c,h as s}from"./chunk-NU7VF7MC.js";import{isValidStellarAddress as T,WithLoggerContext as g}from"@crossmint/common-sdk-base";var m=409,l=class l extends i{constructor(e){super({chain:e.chain,address:e.address,owner:e.owner,options:i.getOptions(e),alias:e.alias,recovery:i.getRecoverySigners(e),apiRecoveryServerSignerAddresses:i.getApiRecoveryServerSignerAddresses(e),apiDelegatedServerSignerAddresses:i.getApiDelegatedServerSignerAddresses(e),signer:e.signer,signers:i.getInitialSigners(e)},i.getApiClient(e))}static from(e){if(!T(e.address))throw new Error("Wallet is not a Stellar wallet");return new l(e)}sendTransaction(e){return s(this,null,function*(){var d;t.info("stellarWallet.sendTransaction.start"),yield this.preAuthIfNeeded();let r=yield this.createTransaction(e);if((d=e.options)!=null&&d.prepareOnly)return t.info("stellarWallet.sendTransaction.prepared",{transactionId:r.id}),{hash:void 0,explorerLink:void 0,transactionId:r.id};let a={},n=yield this.approveTransactionAndWait(r.id,a);return t.info("stellarWallet.sendTransaction.success",{transactionId:r.id,hash:n.hash}),n})}upgrade(e){return s(this,null,function*(){t.info("stellarWallet.upgrade.start"),yield this.preAuthIfNeeded();let r=yield this.createWalletLifecycleTransaction("upgrade-wallet",e);if(r!=null){if(e!=null&&e.prepareOnly)return t.info("stellarWallet.upgrade.prepared",{transactionId:r}),{hash:void 0,explorerLink:void 0,transactionId:r};yield this.approveTransactionAndWait(r),t.info("stellarWallet.upgrade.phase1.success",{transactionId:r})}else t.info("stellarWallet.upgrade.phase1.skipped",{reason:"wallet already locked from a prior upgrade"});let a=yield this.migrateInternal({signer:e==null?void 0:e.signer,prepareOnly:e==null?void 0:e.prepareOnly});return t.info("stellarWallet.upgrade.success",{transactionId:a.transactionId,hash:a.hash}),a})}migrate(e){return s(this,null,function*(){return yield this.preAuthIfNeeded(),yield this.migrateInternal(e)})}migrateInternal(e){return s(this,null,function*(){t.info("stellarWallet.migrate.start");let r=yield this.createWalletLifecycleTransaction("migrate-wallet",e);if(r==null)throw new u("Failed to create migrate-wallet transaction");if(e!=null&&e.prepareOnly)return t.info("stellarWallet.migrate.prepared",{transactionId:r}),{hash:void 0,explorerLink:void 0,transactionId:r};let a=yield this.approveTransactionAndWait(r);return t.info("stellarWallet.migrate.success",{transactionId:r,hash:a.hash}),a})}createTransaction(e){return s(this,null,function*(){let{contractId:r,options:a}=e,n=this.resolveStellarSigner(a==null?void 0:a.signer),d="transaction"in e?{type:"serialized-transaction",serializedTransaction:e.transaction,contractId:r}:{type:"contract-call",contractId:r,method:e.method,memo:e.memo!=null?{type:"text",value:e.memo}:void 0,args:e.args},p=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:d,signer:n}});if("error"in p)throw new u(JSON.stringify(p));return p})}createWalletLifecycleTransaction(e,r){return s(this,null,function*(){let a=(r==null?void 0:r.signer)!=null?this.resolveStellarSigner(r.signer):void 0,n=yield this.apiClient.createTransaction(this.walletLocator,{params:f({transaction:{type:e}},a!=null?{signer:a}:{})});if("error"in n){if(e==="upgrade-wallet"&&y(n))return null;throw new u(JSON.stringify(n))}return n.id})}resolveStellarSigner(e){return e==null?this.signerManager.require().locator():typeof e=="string"?e:this.resolveServerSignerApiLocator(e)}};c([g({logger:t,methodName:"stellarWallet.sendTransaction",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"sendTransaction",1),c([g({logger:t,methodName:"stellarWallet.upgrade",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"upgrade",1),c([g({logger:t,methodName:"stellarWallet.migrate",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"migrate",1);var h=l;function y(o){return typeof o=="object"&&o!==null&&"statusCode"in o&&o.statusCode===m}export{h as a};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkATIC4ENGcjs = require('./chunk-ATIC4ENG.cjs');var _chunkQPCZFIUVcjs = require('./chunk-QPCZFIUV.cjs');var _chunkWIAIJCQ2cjs = require('./chunk-WIAIJCQ2.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var m=class{constructor(n){this.config=n;this._needsAuth=!0;this._authPromise=null;this._initializationPromise=null;this._onboardingConnectionGeneration=null;typeof window!="undefined"&&(this._initializationPromise=this.initialize()),this.type=this.config.type}locator(){return this.config.locator}address(){return this.config.address}initialize(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){try{if(this.config.clientTEEConnection==null){let n=_commonsdkbase.validateAPIKey.call(void 0, this.config.crossmint.apiKey);if(!n.isValid)throw new Error("Invalid API key");let t=new (0, _chunkATIC4ENGcjs.a)({environment:n.environment});this.config.clientTEEConnection=yield t.initialize()}}finally{this._initializationPromise=null}})}getTEEConnection(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){if(this.config.clientTEEConnection==null){if(this._initializationPromise){if(yield this._initializationPromise,this.config.clientTEEConnection==null)throw new Error("Failed to initialize TEE connection");return this.config.clientTEEConnection}this._initializationPromise=this.initializeTEEConnection();try{yield this._initializationPromise}finally{this._initializationPromise=null}}if(this.config.clientTEEConnection==null)throw new Error("TEE connection is not initialized");return this.config.clientTEEConnection})}initializeTEEConnection(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){_chunkWIAIJCQ2cjs.a.info("TEE connection not initialized, initializing now");let n=_commonsdkbase.validateAPIKey.call(void 0, this.config.crossmint.apiKey);if(!n.isValid)throw new Error("Invalid API key");let t=new (0, _chunkATIC4ENGcjs.a)({environment:n.environment});if(this.config.clientTEEConnection=yield t.initialize(),this.config.clientTEEConnection==null)throw new Error("Failed to initialize TEE connection");_chunkWIAIJCQ2cjs.a.info("TEE connection initialized successfully")})}handleAuthRequired(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var d;let n=yield this.getTEEConnection();if(this.config.onAuthRequired==null)throw new Error(`${this.type} signer requires the onAuthRequired callback to handle OTP verification. This callback manages the authentication flow (sending OTP and verifying user input). If using our React/React Native SDK, this is handled automatically by the provider. For other environments, implement: onAuthRequired: (needsAuth, sendOtp, verifyOtp, reject) => { /* your UI logic */ }`);_chunkWIAIJCQ2cjs.a.info("get-status: sending request");let t=Date.now(),e=yield n.sendAction({event:"request:get-status",responseEvent:"response:get-status",data:{authData:{jwt:(d=this.config.crossmint.jwt)!=null?d:"",apiKey:this.config.crossmint.apiKey}},options:l}),s=Date.now()-t;if((e==null?void 0:e.status)!=="success"){let c=(e==null?void 0:e.status)==="error"&&e.error||"Failed to retrieve signer status",p=(e==null?void 0:e.status)==="error"?e.code:void 0;throw _chunkWIAIJCQ2cjs.a.error("get-status: failed",{status:e==null?void 0:e.status,error:(e==null?void 0:e.status)==="error"?e.error:void 0,code:p,durationMs:s}),new (0, _chunkQPCZFIUVcjs.c)(c,p)}if(_chunkWIAIJCQ2cjs.a.info("get-status: response received",{signerStatus:e.signerStatus,durationMs:s}),e.signerStatus==="ready"){this._needsAuth=!1;return}else this._needsAuth=!0;_chunkWIAIJCQ2cjs.a.info("Auth required, initiating OTP flow",{needsAuth:this._needsAuth});let{promise:i,resolve:a,reject:r}=this.createAuthPromise();if(this._authPromise={promise:i,resolve:a,reject:r},this.config.onAuthRequired)try{yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),c=>this.verifyOtp(c),()=>_chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){_chunkWIAIJCQ2cjs.a.info("Auth rejected",{authRejected:!0}),this._needsAuth=!1,this.config.onAuthRequired!=null&&(yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),c=>this.verifyOtp(c),()=>{var c;return(c=this._authPromise)==null?void 0:c.reject(new _chunkQPCZFIUVcjs.a)})),r(new _chunkQPCZFIUVcjs.a)}))}catch(c){_chunkWIAIJCQ2cjs.a.error("handleAuthRequired error",{error:c}),r(c)}try{yield i}catch(c){throw _chunkWIAIJCQ2cjs.a.error("handleAuthRequired promise error",{error:c}),c}})}ensureAuthenticated(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){this.config.resetSignerFrame!=null&&(yield this.config.resetSignerFrame()),yield this.handleAuthRequired()})}getJwtOrThrow(){let n=this.config.crossmint.jwt;if(n==null)throw new Error("JWT is required");return n}createAuthPromise(){let n,t;return{promise:new Promise((s,i)=>{n=s,t=i}),resolve:n,reject:t}}sendMessageWithOtp(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var r;let n=yield this.getTEEConnection(),t=this.getAuthId();_chunkWIAIJCQ2cjs.a.info("start-onboarding: sending request");let e=Date.now(),s=this.config.type==="phone"?this.config.channel:void 0,i=yield n.sendAction({event:"request:start-onboarding",responseEvent:"response:start-onboarding",data:{authData:{jwt:(r=this.config.crossmint.jwt)!=null?r:"",apiKey:this.config.crossmint.apiKey},data:_chunkDSIFRRBScjs.a.call(void 0, {authId:t},s!=null?{channel:s}:{})},options:l}),a=Date.now()-e;if(this._onboardingConnectionGeneration=n.connectionGeneration,_chunkWIAIJCQ2cjs.a.info("start-onboarding: response received",{status:i==null?void 0:i.status,durationMs:a}),(i==null?void 0:i.status)==="success"&&i.signerStatus==="ready"){this._needsAuth=!1;return}if((i==null?void 0:i.status)==="error")throw _chunkWIAIJCQ2cjs.a.error("start-onboarding: failed",{error:i.error,code:i.code}),new (0, _chunkQPCZFIUVcjs.b)(i.error||"Failed to initiate OTP process.",i.code)})}getAuthId(){return this.config.type==="email"?`email:${this.config.email}`:`phone:${this.config.phone}`}verifyOtp(n){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var i,a;let t;try{let r=yield this.getTEEConnection();_chunkWIAIJCQ2cjs.a.info("complete-onboarding: sending request");let d=Date.now();t=yield r.sendAction({event:"request:complete-onboarding",responseEvent:"response:complete-onboarding",data:{authData:{jwt:(i=this.config.crossmint.jwt)!=null?i:"",apiKey:this.config.crossmint.apiKey},data:{onboardingAuthentication:{encryptedOtp:n}}},options:l}),_chunkWIAIJCQ2cjs.a.info("complete-onboarding: response received",{status:t==null?void 0:t.status,durationMs:Date.now()-d})}catch(r){return _chunkWIAIJCQ2cjs.a.error("complete-onboarding: error",{error:r}),yield this.handleOnboardingVerificationFailure(r)}if((t==null?void 0:t.status)==="success"){this._needsAuth=!1,this.config.onAuthRequired!=null&&(yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),r=>this.verifyOtp(r),()=>{var r;return(r=this._authPromise)==null?void 0:r.reject(new _chunkQPCZFIUVcjs.a)})),(a=this._authPromise)==null||a.resolve();return}_chunkWIAIJCQ2cjs.a.error("complete-onboarding: OTP validation failed",{status:t==null?void 0:t.status,error:(t==null?void 0:t.status)==="error"?t.error:void 0,code:(t==null?void 0:t.status)==="error"?t.code:void 0});let e=(t==null?void 0:t.status)==="error"&&t.error||"Failed to validate encrypted OTP",s=(t==null?void 0:t.status)==="error"?t.code:void 0;return yield this.handleOnboardingVerificationFailure(new (0, _chunkQPCZFIUVcjs.b)(e,s))})}handleOnboardingVerificationFailure(n){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var s,i,a;this._needsAuth=!0;let t=this.config.clientTEEConnection;if(this._onboardingConnectionGeneration!=null&&t!=null&&t.connectionGeneration!==this._onboardingConnectionGeneration){_chunkWIAIJCQ2cjs.a.warn("tee.signer.onboarding.reissued",{reason:"signer frame reloaded mid-onboarding, re-issuing OTP",onboardingGeneration:this._onboardingConnectionGeneration,currentGeneration:t==null?void 0:t.connectionGeneration});try{yield this.sendMessageWithOtp()}catch(r){throw(s=this._authPromise)==null||s.reject(r),r}if(!this._needsAuth){(i=this._authPromise)==null||i.resolve();return}throw new _chunkQPCZFIUVcjs.e}throw(a=this._authPromise)==null||a.reject(n),n})}_exportPrivateKey(n,t){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){yield this.ensureAuthenticated();let e=this.getJwtOrThrow(),{scheme:s,encoding:i}=this.getChainKeyParams();if(t!=null){let r=n.on("event:key-exported",d=>{n.off(r),d.status==="success"&&Promise.resolve().then(()=>t()).catch(()=>{console.error("[NCS Signer] onExport callback error")})})}let a=yield n.sendAction({event:"request:export-signer",responseEvent:"response:export-signer",data:{authData:{jwt:e,apiKey:this.config.crossmint.apiKey},data:{scheme:s,encoding:i,walletAddress:this.config.address,authId:this.getAuthId()}},options:l});if((a==null?void 0:a.status)==="error")throw _chunkWIAIJCQ2cjs.a.error("export-signer: failed",{error:a.error,code:a.code}),new (0, _chunkQPCZFIUVcjs.d)(a.error||"Failed to export private key",a.code)})}};_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkWIAIJCQ2cjs.a,methodName:"handleAuthRequired"})],m.prototype,"handleAuthRequired",1);var l={timeoutMs:3e4};exports.a = m; exports.b = l;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkATIC4ENGcjs = require('./chunk-ATIC4ENG.cjs');var _chunkQPCZFIUVcjs = require('./chunk-QPCZFIUV.cjs');var _chunkSP5DQZ6Dcjs = require('./chunk-SP5DQZ6D.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var m=class{constructor(n){this.config=n;this._needsAuth=!0;this._authPromise=null;this._initializationPromise=null;this._onboardingConnectionGeneration=null;typeof window!="undefined"&&(this._initializationPromise=this.initialize()),this.type=this.config.type}locator(){return this.config.locator}address(){return this.config.address}initialize(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){try{if(this.config.clientTEEConnection==null){let n=_commonsdkbase.validateAPIKey.call(void 0, this.config.crossmint.apiKey);if(!n.isValid)throw new Error("Invalid API key");let t=new (0, _chunkATIC4ENGcjs.a)({environment:n.environment});this.config.clientTEEConnection=yield t.initialize()}}finally{this._initializationPromise=null}})}getTEEConnection(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){if(this.config.clientTEEConnection==null){if(this._initializationPromise){if(yield this._initializationPromise,this.config.clientTEEConnection==null)throw new Error("Failed to initialize TEE connection");return this.config.clientTEEConnection}this._initializationPromise=this.initializeTEEConnection();try{yield this._initializationPromise}finally{this._initializationPromise=null}}if(this.config.clientTEEConnection==null)throw new Error("TEE connection is not initialized");return this.config.clientTEEConnection})}initializeTEEConnection(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){_chunkSP5DQZ6Dcjs.a.info("TEE connection not initialized, initializing now");let n=_commonsdkbase.validateAPIKey.call(void 0, this.config.crossmint.apiKey);if(!n.isValid)throw new Error("Invalid API key");let t=new (0, _chunkATIC4ENGcjs.a)({environment:n.environment});if(this.config.clientTEEConnection=yield t.initialize(),this.config.clientTEEConnection==null)throw new Error("Failed to initialize TEE connection");_chunkSP5DQZ6Dcjs.a.info("TEE connection initialized successfully")})}handleAuthRequired(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var d;let n=yield this.getTEEConnection();if(this.config.onAuthRequired==null)throw new Error(`${this.type} signer requires the onAuthRequired callback to handle OTP verification. This callback manages the authentication flow (sending OTP and verifying user input). If using our React/React Native SDK, this is handled automatically by the provider. For other environments, implement: onAuthRequired: (needsAuth, sendOtp, verifyOtp, reject) => { /* your UI logic */ }`);_chunkSP5DQZ6Dcjs.a.info("get-status: sending request");let t=Date.now(),e=yield n.sendAction({event:"request:get-status",responseEvent:"response:get-status",data:{authData:{jwt:(d=this.config.crossmint.jwt)!=null?d:"",apiKey:this.config.crossmint.apiKey}},options:l}),s=Date.now()-t;if((e==null?void 0:e.status)!=="success"){let c=(e==null?void 0:e.status)==="error"&&e.error||"Failed to retrieve signer status",p=(e==null?void 0:e.status)==="error"?e.code:void 0;throw _chunkSP5DQZ6Dcjs.a.error("get-status: failed",{status:e==null?void 0:e.status,error:(e==null?void 0:e.status)==="error"?e.error:void 0,code:p,durationMs:s}),new (0, _chunkQPCZFIUVcjs.c)(c,p)}if(_chunkSP5DQZ6Dcjs.a.info("get-status: response received",{signerStatus:e.signerStatus,durationMs:s}),e.signerStatus==="ready"){this._needsAuth=!1;return}else this._needsAuth=!0;_chunkSP5DQZ6Dcjs.a.info("Auth required, initiating OTP flow",{needsAuth:this._needsAuth});let{promise:i,resolve:a,reject:r}=this.createAuthPromise();if(this._authPromise={promise:i,resolve:a,reject:r},this.config.onAuthRequired)try{yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),c=>this.verifyOtp(c),()=>_chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){_chunkSP5DQZ6Dcjs.a.info("Auth rejected",{authRejected:!0}),this._needsAuth=!1,this.config.onAuthRequired!=null&&(yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),c=>this.verifyOtp(c),()=>{var c;return(c=this._authPromise)==null?void 0:c.reject(new _chunkQPCZFIUVcjs.a)})),r(new _chunkQPCZFIUVcjs.a)}))}catch(c){_chunkSP5DQZ6Dcjs.a.error("handleAuthRequired error",{error:c}),r(c)}try{yield i}catch(c){throw _chunkSP5DQZ6Dcjs.a.error("handleAuthRequired promise error",{error:c}),c}})}ensureAuthenticated(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){this.config.resetSignerFrame!=null&&(yield this.config.resetSignerFrame()),yield this.handleAuthRequired()})}getJwtOrThrow(){let n=this.config.crossmint.jwt;if(n==null)throw new Error("JWT is required");return n}createAuthPromise(){let n,t;return{promise:new Promise((s,i)=>{n=s,t=i}),resolve:n,reject:t}}sendMessageWithOtp(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var r;let n=yield this.getTEEConnection(),t=this.getAuthId();_chunkSP5DQZ6Dcjs.a.info("start-onboarding: sending request");let e=Date.now(),s=this.config.type==="phone"?this.config.channel:void 0,i=yield n.sendAction({event:"request:start-onboarding",responseEvent:"response:start-onboarding",data:{authData:{jwt:(r=this.config.crossmint.jwt)!=null?r:"",apiKey:this.config.crossmint.apiKey},data:_chunkDSIFRRBScjs.a.call(void 0, {authId:t},s!=null?{channel:s}:{})},options:l}),a=Date.now()-e;if(this._onboardingConnectionGeneration=n.connectionGeneration,_chunkSP5DQZ6Dcjs.a.info("start-onboarding: response received",{status:i==null?void 0:i.status,durationMs:a}),(i==null?void 0:i.status)==="success"&&i.signerStatus==="ready"){this._needsAuth=!1;return}if((i==null?void 0:i.status)==="error")throw _chunkSP5DQZ6Dcjs.a.error("start-onboarding: failed",{error:i.error,code:i.code}),new (0, _chunkQPCZFIUVcjs.b)(i.error||"Failed to initiate OTP process.",i.code)})}getAuthId(){return this.config.type==="email"?`email:${this.config.email}`:`phone:${this.config.phone}`}verifyOtp(n){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var i,a;let t;try{let r=yield this.getTEEConnection();_chunkSP5DQZ6Dcjs.a.info("complete-onboarding: sending request");let d=Date.now();t=yield r.sendAction({event:"request:complete-onboarding",responseEvent:"response:complete-onboarding",data:{authData:{jwt:(i=this.config.crossmint.jwt)!=null?i:"",apiKey:this.config.crossmint.apiKey},data:{onboardingAuthentication:{encryptedOtp:n}}},options:l}),_chunkSP5DQZ6Dcjs.a.info("complete-onboarding: response received",{status:t==null?void 0:t.status,durationMs:Date.now()-d})}catch(r){return _chunkSP5DQZ6Dcjs.a.error("complete-onboarding: error",{error:r}),yield this.handleOnboardingVerificationFailure(r)}if((t==null?void 0:t.status)==="success"){this._needsAuth=!1,this.config.onAuthRequired!=null&&(yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),r=>this.verifyOtp(r),()=>{var r;return(r=this._authPromise)==null?void 0:r.reject(new _chunkQPCZFIUVcjs.a)})),(a=this._authPromise)==null||a.resolve();return}_chunkSP5DQZ6Dcjs.a.error("complete-onboarding: OTP validation failed",{status:t==null?void 0:t.status,error:(t==null?void 0:t.status)==="error"?t.error:void 0,code:(t==null?void 0:t.status)==="error"?t.code:void 0});let e=(t==null?void 0:t.status)==="error"&&t.error||"Failed to validate encrypted OTP",s=(t==null?void 0:t.status)==="error"?t.code:void 0;return yield this.handleOnboardingVerificationFailure(new (0, _chunkQPCZFIUVcjs.b)(e,s))})}handleOnboardingVerificationFailure(n){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var s,i,a;this._needsAuth=!0;let t=this.config.clientTEEConnection;if(this._onboardingConnectionGeneration!=null&&t!=null&&t.connectionGeneration!==this._onboardingConnectionGeneration){_chunkSP5DQZ6Dcjs.a.warn("tee.signer.onboarding.reissued",{reason:"signer frame reloaded mid-onboarding, re-issuing OTP",onboardingGeneration:this._onboardingConnectionGeneration,currentGeneration:t==null?void 0:t.connectionGeneration});try{yield this.sendMessageWithOtp()}catch(r){throw(s=this._authPromise)==null||s.reject(r),r}if(!this._needsAuth){(i=this._authPromise)==null||i.resolve();return}throw new _chunkQPCZFIUVcjs.e}throw(a=this._authPromise)==null||a.reject(n),n})}_exportPrivateKey(n,t){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){yield this.ensureAuthenticated();let e=this.getJwtOrThrow(),{scheme:s,encoding:i}=this.getChainKeyParams();if(t!=null){let r=n.on("event:key-exported",d=>{n.off(r),d.status==="success"&&Promise.resolve().then(()=>t()).catch(()=>{console.error("[NCS Signer] onExport callback error")})})}let a=yield n.sendAction({event:"request:export-signer",responseEvent:"response:export-signer",data:{authData:{jwt:e,apiKey:this.config.crossmint.apiKey},data:{scheme:s,encoding:i,walletAddress:this.config.address,authId:this.getAuthId()}},options:l});if((a==null?void 0:a.status)==="error")throw _chunkSP5DQZ6Dcjs.a.error("export-signer: failed",{error:a.error,code:a.code}),new (0, _chunkQPCZFIUVcjs.d)(a.error||"Failed to export private key",a.code)})}};_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkSP5DQZ6Dcjs.a,methodName:"handleAuthRequired"})],m.prototype,"handleAuthRequired",1);var l={timeoutMs:3e4};exports.a = m; exports.b = l;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _viem = require('viem');var n=_viem.defineChain.call(void 0, {id:46630,name:"Robinhood Chain Testnet",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.testnet.chain.robinhood.com"]}},blockExplorers:{default:{name:"Robinhood Chain Testnet Explorer",url:"https://explorer.testnet.chain.robinhood.com",apiUrl:"https://explorer.testnet.chain.robinhood.com/api"}},testnet:!0});exports.a = n;
@@ -1 +1 @@
1
- import{a,b as g}from"./chunk-S6MOVJXB.js";import{a as s}from"./chunk-JNGPW247.js";import{h as t}from"./chunk-NU7VF7MC.js";import{PersonalMessage as u}from"ox";import{isHex as h,toHex as l}from"viem";var c=class p extends a{constructor(e){super(e)}signMessage(e){return t(this,null,function*(){let i=h(e)?e:l(e),r=u.getSignPayload(i);return yield this.sign(r)})}signTransaction(e){return t(this,null,function*(){return yield this.sign(e)})}sign(e){return t(this,null,function*(){var o;yield this.handleAuthRequired();let i=this.getJwtOrThrow(),r=e.replace("0x","");s.info("sign: sending request",{keyType:"secp256k1"});let y=Date.now(),n=yield(o=this.config.clientTEEConnection)==null?void 0:o.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:i,apiKey:this.config.crossmint.apiKey},data:{keyType:"secp256k1",bytes:r,encoding:"hex"}},options:g});if(s.info("sign: response received",{status:n==null?void 0:n.status,durationMs:Date.now()-y}),(n==null?void 0:n.status)==="error")throw new Error(n.error);if((n==null?void 0:n.signature)==null)throw new Error("Failed to sign transaction");return p.verifyPublicKeyFormat(n.publicKey),{signature:n.signature.bytes}})}static verifyPublicKeyFormat(e){if(e==null)throw new Error("No public key found");if(e.encoding!=="hex"||e.keyType!=="secp256k1"||e.bytes==null)throw new Error("Not supported. Expected public key to be in hex encoding and secp256k1 key type. Got: "+JSON.stringify(e))}getChainKeyParams(){return{scheme:"secp256k1",encoding:"hex"}}};export{c as a};
1
+ import{a,b as g}from"./chunk-A7DA5DSE.js";import{a as s}from"./chunk-AZAIXRGS.js";import{h as t}from"./chunk-NU7VF7MC.js";import{PersonalMessage as u}from"ox";import{isHex as h,toHex as l}from"viem";var c=class p extends a{constructor(e){super(e)}signMessage(e){return t(this,null,function*(){let i=h(e)?e:l(e),r=u.getSignPayload(i);return yield this.sign(r)})}signTransaction(e){return t(this,null,function*(){return yield this.sign(e)})}sign(e){return t(this,null,function*(){var o;yield this.handleAuthRequired();let i=this.getJwtOrThrow(),r=e.replace("0x","");s.info("sign: sending request",{keyType:"secp256k1"});let y=Date.now(),n=yield(o=this.config.clientTEEConnection)==null?void 0:o.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:i,apiKey:this.config.crossmint.apiKey},data:{keyType:"secp256k1",bytes:r,encoding:"hex"}},options:g});if(s.info("sign: response received",{status:n==null?void 0:n.status,durationMs:Date.now()-y}),(n==null?void 0:n.status)==="error")throw new Error(n.error);if((n==null?void 0:n.signature)==null)throw new Error("Failed to sign transaction");return p.verifyPublicKeyFormat(n.publicKey),{signature:n.signature.bytes}})}static verifyPublicKeyFormat(e){if(e==null)throw new Error("No public key found");if(e.encoding!=="hex"||e.keyType!=="secp256k1"||e.bytes==null)throw new Error("Not supported. Expected public key to be in hex encoding and secp256k1 key type. Got: "+JSON.stringify(e))}getChainKeyParams(){return{scheme:"secp256k1",encoding:"hex"}}};export{c as a};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk3TJEBF5Ucjs = require('./chunk-3TJEBF5U.cjs');var _chunkWIAIJCQ2cjs = require('./chunk-WIAIJCQ2.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');var _ox = require('ox');var _viem = require('viem');var c=class p extends _chunk3TJEBF5Ucjs.a{constructor(e){super(e)}signMessage(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let i=_viem.isHex.call(void 0, e)?e:_viem.toHex.call(void 0, e),r=_ox.PersonalMessage.getSignPayload(i);return yield this.sign(r)})}signTransaction(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return yield this.sign(e)})}sign(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var o;yield this.handleAuthRequired();let i=this.getJwtOrThrow(),r=e.replace("0x","");_chunkWIAIJCQ2cjs.a.info("sign: sending request",{keyType:"secp256k1"});let y=Date.now(),n=yield(o=this.config.clientTEEConnection)==null?void 0:o.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:i,apiKey:this.config.crossmint.apiKey},data:{keyType:"secp256k1",bytes:r,encoding:"hex"}},options:_chunk3TJEBF5Ucjs.b});if(_chunkWIAIJCQ2cjs.a.info("sign: response received",{status:n==null?void 0:n.status,durationMs:Date.now()-y}),(n==null?void 0:n.status)==="error")throw new Error(n.error);if((n==null?void 0:n.signature)==null)throw new Error("Failed to sign transaction");return p.verifyPublicKeyFormat(n.publicKey),{signature:n.signature.bytes}})}static verifyPublicKeyFormat(e){if(e==null)throw new Error("No public key found");if(e.encoding!=="hex"||e.keyType!=="secp256k1"||e.bytes==null)throw new Error("Not supported. Expected public key to be in hex encoding and secp256k1 key type. Got: "+JSON.stringify(e))}getChainKeyParams(){return{scheme:"secp256k1",encoding:"hex"}}};exports.a = c;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkZHGXG7JMcjs = require('./chunk-ZHGXG7JM.cjs');var _chunkSP5DQZ6Dcjs = require('./chunk-SP5DQZ6D.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');var _ox = require('ox');var _viem = require('viem');var c=class p extends _chunkZHGXG7JMcjs.a{constructor(e){super(e)}signMessage(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let i=_viem.isHex.call(void 0, e)?e:_viem.toHex.call(void 0, e),r=_ox.PersonalMessage.getSignPayload(i);return yield this.sign(r)})}signTransaction(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return yield this.sign(e)})}sign(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var o;yield this.handleAuthRequired();let i=this.getJwtOrThrow(),r=e.replace("0x","");_chunkSP5DQZ6Dcjs.a.info("sign: sending request",{keyType:"secp256k1"});let y=Date.now(),n=yield(o=this.config.clientTEEConnection)==null?void 0:o.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:i,apiKey:this.config.crossmint.apiKey},data:{keyType:"secp256k1",bytes:r,encoding:"hex"}},options:_chunkZHGXG7JMcjs.b});if(_chunkSP5DQZ6Dcjs.a.info("sign: response received",{status:n==null?void 0:n.status,durationMs:Date.now()-y}),(n==null?void 0:n.status)==="error")throw new Error(n.error);if((n==null?void 0:n.signature)==null)throw new Error("Failed to sign transaction");return p.verifyPublicKeyFormat(n.publicKey),{signature:n.signature.bytes}})}static verifyPublicKeyFormat(e){if(e==null)throw new Error("No public key found");if(e.encoding!=="hex"||e.keyType!=="secp256k1"||e.bytes==null)throw new Error("Not supported. Expected public key to be in hex encoding and secp256k1 key type. Got: "+JSON.stringify(e))}getChainKeyParams(){return{scheme:"secp256k1",encoding:"hex"}}};exports.a = c;
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-YRZHJB2T.cjs');var _chunkYEHBDKR3cjs = require('./chunk-YEHBDKR3.cjs');var _chunkQP5JU7UOcjs = require('./chunk-QP5JU7UO.cjs');var _chunk2VMMA4Y6cjs = require('./chunk-2VMMA4Y6.cjs');var _chunkVPDZLVMKcjs = require('./chunk-VPDZLVMK.cjs');var _chunkW4DR7B3Lcjs = require('./chunk-W4DR7B3L.cjs');require('./chunk-HOQ2JQHJ.cjs');var _chunk3L3U3TIDcjs = require('./chunk-3L3U3TID.cjs');require('./chunk-W7IPXUD5.cjs');require('./chunk-GAACIEE2.cjs');require('./chunk-IZVYNUFO.cjs');require('./chunk-JMVDYHTG.cjs');require('./chunk-CUHDOBKN.cjs');var _chunkYHCEO3GDcjs = require('./chunk-YHCEO3GD.cjs');var _chunkGMU3ZYLScjs = require('./chunk-GMU3ZYLS.cjs');require('./chunk-GSNFNRH2.cjs');require('./chunk-U5DLRN5U.cjs');var _chunk3VYGTPRFcjs = require('./chunk-3VYGTPRF.cjs');require('./chunk-4MNSKZHW.cjs');require('./chunk-D6UK5JAA.cjs');require('./chunk-T7DD437D.cjs');require('./chunk-KQIDRPAB.cjs');require('./chunk-IQ6EAHDU.cjs');require('./chunk-P5VJ455G.cjs');require('./chunk-T5LUBX5J.cjs');require('./chunk-3RVLLQ4M.cjs');require('./chunk-CZC2MNVK.cjs');require('./chunk-PHIW7FUJ.cjs');require('./chunk-R2XC4F3M.cjs');var _chunk3DK46BDIcjs = require('./chunk-3DK46BDI.cjs');require('./chunk-N3HRM33G.cjs');require('./chunk-5IC7UWND.cjs');require('./chunk-O2BU2KJD.cjs');require('./chunk-IGRPHTXZ.cjs');require('./chunk-Q66YRLSW.cjs');require('./chunk-VMDJJX7P.cjs');require('./chunk-HJH2S644.cjs');require('./chunk-2D6B7AZ6.cjs');require('./chunk-PO6S7UR3.cjs');require('./chunk-RMILQMLJ.cjs');require('./chunk-4L7JP2WL.cjs');require('./chunk-4IIZO5PI.cjs');require('./chunk-3TJEBF5U.cjs');require('./chunk-ATIC4ENG.cjs');require('./chunk-LWA3SX6Z.cjs');require('./chunk-2YZQ4YYU.cjs');require('./chunk-5FH7WFWL.cjs');require('./chunk-LXAEBSEY.cjs');require('./chunk-5FVDLMWW.cjs');var _chunkQPCZFIUVcjs = require('./chunk-QPCZFIUV.cjs');require('./chunk-XWQC6G7N.cjs');require('./chunk-R4SBFRTM.cjs');require('./chunk-HYWIWJ6H.cjs');require('./chunk-SCEPJO4Q.cjs');require('./chunk-PWVGLO7T.cjs');require('./chunk-CDHMNLZ6.cjs');require('./chunk-6HXIZLEQ.cjs');var _chunkCEP5E7JGcjs = require('./chunk-CEP5E7JG.cjs');require('./chunk-ECAM5KTH.cjs');require('./chunk-D6BFMPZA.cjs');require('./chunk-MXY4ZKZJ.cjs');require('./chunk-YJLJ2IHS.cjs');require('./chunk-4I5SLLAX.cjs');require('./chunk-JNKTRQPS.cjs');require('./chunk-ENU3EKBG.cjs');require('./chunk-ZEGNY3K3.cjs');require('./chunk-UE3WVHTM.cjs');require('./chunk-5X4EOJFG.cjs');require('./chunk-HRUMWG2F.cjs');require('./chunk-IR5WN6FQ.cjs');require('./chunk-GEY574TH.cjs');var _chunkVS6I4S7Xcjs = require('./chunk-VS6I4S7X.cjs');require('./chunk-CCIGWTAO.cjs');require('./chunk-WIAIJCQ2.cjs');require('./chunk-3TPBVNNF.cjs');require('./chunk-DSIFRRBS.cjs');exports.AuthRejectedError = _chunkQPCZFIUVcjs.a; exports.CrossmintWallets = _chunkW4DR7B3Lcjs.b; exports.DeviceSignerKeyStorage = _chunk3VYGTPRFcjs.a; exports.DuplicateRecoverySignerError = _chunkVS6I4S7Xcjs.q; exports.EVMWallet = _chunk2VMMA4Y6cjs.a; exports.IframeDeviceSignerKeyStorage = _chunkYHCEO3GDcjs.a; exports.InvalidRecoveryConfigError = _chunkVS6I4S7Xcjs.o; exports.InvalidTransferAmountError = _chunkVS6I4S7Xcjs.G; exports.JWTDecryptionError = _chunkVS6I4S7Xcjs.V; exports.JWTExpiredError = _chunkVS6I4S7Xcjs.T; exports.JWTIdentifierError = _chunkVS6I4S7Xcjs.W; exports.JWTInvalidError = _chunkVS6I4S7Xcjs.U; exports.KeyExportError = _chunkQPCZFIUVcjs.d; exports.NotAuthorizedError = _chunkVS6I4S7Xcjs.S; exports.NotSupportedOnApiVersionError = _chunkVS6I4S7Xcjs.u; exports.OnboardingSessionExpiredError = _chunkQPCZFIUVcjs.e; exports.OtpValidationError = _chunkQPCZFIUVcjs.b; exports.QuorumSignerNotSupportedError = _chunkVS6I4S7Xcjs.n; exports.RecoveryAdminSignerConflictError = _chunkVS6I4S7Xcjs.v; exports.RecoveryNotSupportedOnChainError = _chunkVS6I4S7Xcjs.t; exports.RecoverySignerConflictError = _chunkVS6I4S7Xcjs.r; exports.RecoverySignerLimitExceededError = _chunkVS6I4S7Xcjs.p; exports.SignerRequiredError = _chunkVS6I4S7Xcjs.s; exports.SignerStatusError = _chunkQPCZFIUVcjs.c; exports.SolanaWallet = _chunkVPDZLVMKcjs.a; exports.StellarWallet = _chunkQP5JU7UOcjs.a; exports.UnsupportedBrowserError = _chunkVS6I4S7Xcjs.w; exports.Wallet = _chunk3L3U3TIDcjs.a; exports.WalletNotAvailableError = _chunkVS6I4S7Xcjs.e; exports.WalletsApiClient = _chunkCEP5E7JGcjs.a; exports.createCrossmint = _chunkW4DR7B3Lcjs.a; exports.createDeviceSigner = _chunkGMU3ZYLScjs.a; exports.createServerSigner = _chunkYEHBDKR3cjs.a; exports.isExportableSignerAdapter = _chunkQPCZFIUVcjs.g; exports.toRecoverySignerList = _chunk3DK46BDIcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-YRZHJB2T.cjs');var _chunkYEHBDKR3cjs = require('./chunk-YEHBDKR3.cjs');var _chunk62XSK3ZXcjs = require('./chunk-62XSK3ZX.cjs');var _chunk5SREMYFJcjs = require('./chunk-5SREMYFJ.cjs');var _chunkD2QNNQ26cjs = require('./chunk-D2QNNQ26.cjs');var _chunkQ6UT242Qcjs = require('./chunk-Q6UT242Q.cjs');require('./chunk-Y7P2T5BP.cjs');var _chunk63VNTHGQcjs = require('./chunk-63VNTHGQ.cjs');require('./chunk-IU7J7IPE.cjs');require('./chunk-DB3TFNM2.cjs');require('./chunk-BJC5DQQ3.cjs');require('./chunk-7HOXBHKP.cjs');require('./chunk-U5DLRN5U.cjs');require('./chunk-CUHDOBKN.cjs');var _chunkSDXHKREBcjs = require('./chunk-SDXHKREB.cjs');var _chunk3VYGTPRFcjs = require('./chunk-3VYGTPRF.cjs');var _chunkGMU3ZYLScjs = require('./chunk-GMU3ZYLS.cjs');require('./chunk-GSNFNRH2.cjs');require('./chunk-YWN6HKW7.cjs');require('./chunk-P5VJ455G.cjs');require('./chunk-T5LUBX5J.cjs');require('./chunk-3RVLLQ4M.cjs');require('./chunk-D6UK5JAA.cjs');require('./chunk-T7DD437D.cjs');require('./chunk-KQIDRPAB.cjs');require('./chunk-IQ6EAHDU.cjs');require('./chunk-CZC2MNVK.cjs');require('./chunk-PHIW7FUJ.cjs');require('./chunk-R2XC4F3M.cjs');var _chunk3DK46BDIcjs = require('./chunk-3DK46BDI.cjs');require('./chunk-4R2UUYLC.cjs');require('./chunk-5IC7UWND.cjs');require('./chunk-UX2FEVDY.cjs');require('./chunk-IGRPHTXZ.cjs');require('./chunk-Q66YRLSW.cjs');require('./chunk-HJH2S644.cjs');require('./chunk-2D6B7AZ6.cjs');require('./chunk-VMDJJX7P.cjs');require('./chunk-PO6S7UR3.cjs');require('./chunk-ZUG5ROPF.cjs');require('./chunk-KQFRFHM4.cjs');require('./chunk-JAWHGOGP.cjs');require('./chunk-ZHGXG7JM.cjs');require('./chunk-ATIC4ENG.cjs');require('./chunk-LWA3SX6Z.cjs');require('./chunk-2YZQ4YYU.cjs');require('./chunk-5FH7WFWL.cjs');require('./chunk-LXAEBSEY.cjs');require('./chunk-5FVDLMWW.cjs');var _chunkQPCZFIUVcjs = require('./chunk-QPCZFIUV.cjs');require('./chunk-XWQC6G7N.cjs');require('./chunk-R4SBFRTM.cjs');require('./chunk-HYWIWJ6H.cjs');require('./chunk-SCEPJO4Q.cjs');require('./chunk-PWVGLO7T.cjs');require('./chunk-CDHMNLZ6.cjs');require('./chunk-6HXIZLEQ.cjs');var _chunk53VKI7FJcjs = require('./chunk-53VKI7FJ.cjs');require('./chunk-ECAM5KTH.cjs');require('./chunk-D5IIHIEW.cjs');require('./chunk-2G4Y25AJ.cjs');require('./chunk-5L5MJAFS.cjs');require('./chunk-KVMPBMNG.cjs');require('./chunk-JNKTRQPS.cjs');require('./chunk-ENU3EKBG.cjs');require('./chunk-BHHXVRU6.cjs');require('./chunk-AUO6R32H.cjs');require('./chunk-ZPO3XSWU.cjs');require('./chunk-IR5WN6FQ.cjs');require('./chunk-GEY574TH.cjs');require('./chunk-UE3WVHTM.cjs');require('./chunk-5X4EOJFG.cjs');require('./chunk-TCDH5Q6Q.cjs');require('./chunk-HRUMWG2F.cjs');require('./chunk-OQFZL5LI.cjs');var _chunkVS6I4S7Xcjs = require('./chunk-VS6I4S7X.cjs');require('./chunk-CCIGWTAO.cjs');require('./chunk-SP5DQZ6D.cjs');require('./chunk-XFCHACH7.cjs');require('./chunk-DSIFRRBS.cjs');exports.AuthRejectedError = _chunkQPCZFIUVcjs.a; exports.CrossmintWallets = _chunkQ6UT242Qcjs.b; exports.DeviceSignerKeyStorage = _chunk3VYGTPRFcjs.a; exports.DuplicateRecoverySignerError = _chunkVS6I4S7Xcjs.q; exports.EVMWallet = _chunk5SREMYFJcjs.a; exports.IframeDeviceSignerKeyStorage = _chunkSDXHKREBcjs.a; exports.InvalidRecoveryConfigError = _chunkVS6I4S7Xcjs.o; exports.InvalidTransferAmountError = _chunkVS6I4S7Xcjs.G; exports.JWTDecryptionError = _chunkVS6I4S7Xcjs.V; exports.JWTExpiredError = _chunkVS6I4S7Xcjs.T; exports.JWTIdentifierError = _chunkVS6I4S7Xcjs.W; exports.JWTInvalidError = _chunkVS6I4S7Xcjs.U; exports.KeyExportError = _chunkQPCZFIUVcjs.d; exports.NotAuthorizedError = _chunkVS6I4S7Xcjs.S; exports.NotSupportedOnApiVersionError = _chunkVS6I4S7Xcjs.u; exports.OnboardingSessionExpiredError = _chunkQPCZFIUVcjs.e; exports.OtpValidationError = _chunkQPCZFIUVcjs.b; exports.QuorumSignerNotSupportedError = _chunkVS6I4S7Xcjs.n; exports.RecoveryAdminSignerConflictError = _chunkVS6I4S7Xcjs.v; exports.RecoveryNotSupportedOnChainError = _chunkVS6I4S7Xcjs.t; exports.RecoverySignerConflictError = _chunkVS6I4S7Xcjs.r; exports.RecoverySignerLimitExceededError = _chunkVS6I4S7Xcjs.p; exports.SignerRequiredError = _chunkVS6I4S7Xcjs.s; exports.SignerStatusError = _chunkQPCZFIUVcjs.c; exports.SolanaWallet = _chunkD2QNNQ26cjs.a; exports.StellarWallet = _chunk62XSK3ZXcjs.a; exports.UnsupportedBrowserError = _chunkVS6I4S7Xcjs.w; exports.Wallet = _chunk63VNTHGQcjs.a; exports.WalletNotAvailableError = _chunkVS6I4S7Xcjs.e; exports.WalletsApiClient = _chunk53VKI7FJcjs.a; exports.createCrossmint = _chunkQ6UT242Qcjs.a; exports.createDeviceSigner = _chunkGMU3ZYLScjs.a; exports.createServerSigner = _chunkYEHBDKR3cjs.a; exports.isExportableSignerAdapter = _chunkQPCZFIUVcjs.g; exports.toRecoverySignerList = _chunk3DK46BDIcjs.a;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import"./chunk-DTGCFFNW.js";import{a as N}from"./chunk-WTIV4TTS.js";import{a as F}from"./chunk-BSZJJNA7.js";import{a as b}from"./chunk-MFCNJSCL.js";import{a as I}from"./chunk-OVUX5RFT.js";import{a as P,b as D}from"./chunk-YFRKZGZ4.js";import"./chunk-P22QL24A.js";import{a as L}from"./chunk-L7RATGRO.js";import"./chunk-WEWCIFFY.js";import"./chunk-EH75GTUJ.js";import"./chunk-IX4EJZH5.js";import"./chunk-IXNKZURT.js";import"./chunk-TOAFCAVT.js";import{a as R}from"./chunk-KYR4ZYRD.js";import{a as T}from"./chunk-5LNDUSMZ.js";import"./chunk-NZXYWQE5.js";import"./chunk-OQFOUCTW.js";import{a as h}from"./chunk-IOSADDL5.js";import"./chunk-CTCUJBU2.js";import"./chunk-AEO4REZV.js";import"./chunk-VHSQUXJK.js";import"./chunk-PKFCOQOM.js";import"./chunk-3UROOLIH.js";import"./chunk-25TINDQ4.js";import"./chunk-SWQSW2AD.js";import"./chunk-WVKODEVW.js";import"./chunk-BV6IQIQK.js";import"./chunk-JLWNRQ4S.js";import"./chunk-FTUJ5XHD.js";import{a as O}from"./chunk-3KAXLLXJ.js";import"./chunk-6OUANX4J.js";import"./chunk-L52GDMSH.js";import"./chunk-I76IKSS4.js";import"./chunk-QM3BB4E2.js";import"./chunk-TSJUK3ED.js";import"./chunk-277G6KNG.js";import"./chunk-IQ3QQ4M6.js";import"./chunk-GXUPHO44.js";import"./chunk-YDZRBHS3.js";import"./chunk-GD5GDQXC.js";import"./chunk-GVRXRDGC.js";import"./chunk-BEGVH4DX.js";import"./chunk-S6MOVJXB.js";import"./chunk-IHMMTMFG.js";import"./chunk-FJPAMX7L.js";import"./chunk-E3H6RZHM.js";import"./chunk-EM3D5Q3A.js";import"./chunk-7KKHT5PF.js";import"./chunk-K7BPGUFU.js";import{a as d,b as v,c as y,d as W,e as u,g as A}from"./chunk-DCKFFFPG.js";import"./chunk-MN2BGRRJ.js";import"./chunk-FQ5F3VYJ.js";import"./chunk-HAQMNZO5.js";import"./chunk-2YLRFJ66.js";import"./chunk-AB2JJTW4.js";import"./chunk-MLROTECD.js";import"./chunk-5IFDVB4Y.js";import{a as x}from"./chunk-K55HJTOE.js";import"./chunk-KBJA7JDT.js";import"./chunk-6KW2HYAX.js";import"./chunk-NYGW4HYK.js";import"./chunk-Q3JQUVKI.js";import"./chunk-RNQMEZIV.js";import"./chunk-B4GYB3XY.js";import"./chunk-OQZTL6ZG.js";import"./chunk-BXEH6VXA.js";import"./chunk-KUP7H7X2.js";import"./chunk-FT5EVMLB.js";import"./chunk-SVIKBM3S.js";import"./chunk-KKQBZXFE.js";import"./chunk-S3DYQVRD.js";import{G as s,S as E,T as c,U as f,V as C,W as m,e as r,n as e,o,p as t,q as i,r as n,s as a,t as l,u as g,v as S,w as p}from"./chunk-KOHPRJDP.js";import"./chunk-455NK5LB.js";import"./chunk-JNGPW247.js";import"./chunk-QU5AAJAW.js";import"./chunk-NU7VF7MC.js";export{d as AuthRejectedError,D as CrossmintWallets,h as DeviceSignerKeyStorage,i as DuplicateRecoverySignerError,b as EVMWallet,R as IframeDeviceSignerKeyStorage,o as InvalidRecoveryConfigError,s as InvalidTransferAmountError,C as JWTDecryptionError,c as JWTExpiredError,m as JWTIdentifierError,f as JWTInvalidError,W as KeyExportError,E as NotAuthorizedError,g as NotSupportedOnApiVersionError,u as OnboardingSessionExpiredError,v as OtpValidationError,e as QuorumSignerNotSupportedError,S as RecoveryAdminSignerConflictError,l as RecoveryNotSupportedOnChainError,n as RecoverySignerConflictError,t as RecoverySignerLimitExceededError,a as SignerRequiredError,y as SignerStatusError,I as SolanaWallet,F as StellarWallet,p as UnsupportedBrowserError,L as Wallet,r as WalletNotAvailableError,x as WalletsApiClient,P as createCrossmint,T as createDeviceSigner,N as createServerSigner,A as isExportableSignerAdapter,O as toRecoverySignerList};
1
+ import"./chunk-DTGCFFNW.js";import{a as N}from"./chunk-WTIV4TTS.js";import{a as F}from"./chunk-Z4ZDZYZ3.js";import{a as b}from"./chunk-66IZJXGV.js";import{a as I}from"./chunk-7CUHY3S4.js";import{a as P,b as D}from"./chunk-5IC6BHP5.js";import"./chunk-4KOHNUNP.js";import{a as L}from"./chunk-LUUUKDHQ.js";import"./chunk-BHSOWQOR.js";import"./chunk-BKN5HSDC.js";import"./chunk-YFNCXOVW.js";import"./chunk-QNM7BGTP.js";import"./chunk-OQFOUCTW.js";import"./chunk-TOAFCAVT.js";import{a as R}from"./chunk-V3LZ3MNU.js";import{a as h}from"./chunk-IOSADDL5.js";import{a as T}from"./chunk-5LNDUSMZ.js";import"./chunk-NZXYWQE5.js";import"./chunk-QYNWUGXV.js";import"./chunk-25TINDQ4.js";import"./chunk-SWQSW2AD.js";import"./chunk-WVKODEVW.js";import"./chunk-AEO4REZV.js";import"./chunk-VHSQUXJK.js";import"./chunk-PKFCOQOM.js";import"./chunk-3UROOLIH.js";import"./chunk-BV6IQIQK.js";import"./chunk-JLWNRQ4S.js";import"./chunk-FTUJ5XHD.js";import{a as O}from"./chunk-3KAXLLXJ.js";import"./chunk-62EHAJRH.js";import"./chunk-L52GDMSH.js";import"./chunk-24CGMAY3.js";import"./chunk-QM3BB4E2.js";import"./chunk-TSJUK3ED.js";import"./chunk-IQ3QQ4M6.js";import"./chunk-GXUPHO44.js";import"./chunk-277G6KNG.js";import"./chunk-YDZRBHS3.js";import"./chunk-ZSFPKH2C.js";import"./chunk-FBOM4U3X.js";import"./chunk-UP6VFZQH.js";import"./chunk-A7DA5DSE.js";import"./chunk-IHMMTMFG.js";import"./chunk-FJPAMX7L.js";import"./chunk-E3H6RZHM.js";import"./chunk-EM3D5Q3A.js";import"./chunk-7KKHT5PF.js";import"./chunk-K7BPGUFU.js";import{a as d,b as v,c as y,d as W,e as u,g as A}from"./chunk-DCKFFFPG.js";import"./chunk-MN2BGRRJ.js";import"./chunk-FQ5F3VYJ.js";import"./chunk-HAQMNZO5.js";import"./chunk-2YLRFJ66.js";import"./chunk-AB2JJTW4.js";import"./chunk-MLROTECD.js";import"./chunk-5IFDVB4Y.js";import{a as x}from"./chunk-BL7A7ROX.js";import"./chunk-KBJA7JDT.js";import"./chunk-WJDR3MG5.js";import"./chunk-6T4GBLXY.js";import"./chunk-CXWFJGKI.js";import"./chunk-NQ3PROUV.js";import"./chunk-B4GYB3XY.js";import"./chunk-OQZTL6ZG.js";import"./chunk-NMUHOXYI.js";import"./chunk-V5NY4W5H.js";import"./chunk-CGQCRDG7.js";import"./chunk-KKQBZXFE.js";import"./chunk-S3DYQVRD.js";import"./chunk-KUP7H7X2.js";import"./chunk-FT5EVMLB.js";import"./chunk-QLOW4D2N.js";import"./chunk-SVIKBM3S.js";import"./chunk-C6E6WC4P.js";import{G as s,S as E,T as c,U as f,V as C,W as m,e as r,n as e,o,p as t,q as i,r as n,s as a,t as l,u as g,v as S,w as p}from"./chunk-KOHPRJDP.js";import"./chunk-455NK5LB.js";import"./chunk-AZAIXRGS.js";import"./chunk-FUZ2TPGD.js";import"./chunk-NU7VF7MC.js";export{d as AuthRejectedError,D as CrossmintWallets,h as DeviceSignerKeyStorage,i as DuplicateRecoverySignerError,b as EVMWallet,R as IframeDeviceSignerKeyStorage,o as InvalidRecoveryConfigError,s as InvalidTransferAmountError,C as JWTDecryptionError,c as JWTExpiredError,m as JWTIdentifierError,f as JWTInvalidError,W as KeyExportError,E as NotAuthorizedError,g as NotSupportedOnApiVersionError,u as OnboardingSessionExpiredError,v as OtpValidationError,e as QuorumSignerNotSupportedError,S as RecoveryAdminSignerConflictError,l as RecoveryNotSupportedOnChainError,n as RecoverySignerConflictError,t as RecoverySignerLimitExceededError,a as SignerRequiredError,y as SignerStatusError,I as SolanaWallet,F as StellarWallet,p as UnsupportedBrowserError,L as Wallet,r as WalletNotAvailableError,x as WalletsApiClient,P as createCrossmint,T as createDeviceSigner,N as createServerSigner,A as isExportableSignerAdapter,O as toRecoverySignerList};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-CCIGWTAO.cjs');var _chunkWIAIJCQ2cjs = require('../chunk-WIAIJCQ2.cjs');require('../chunk-3TPBVNNF.cjs');require('../chunk-DSIFRRBS.cjs');exports.initWalletsLogger = _chunkWIAIJCQ2cjs.b; exports.walletsLogger = _chunkWIAIJCQ2cjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-CCIGWTAO.cjs');var _chunkSP5DQZ6Dcjs = require('../chunk-SP5DQZ6D.cjs');require('../chunk-XFCHACH7.cjs');require('../chunk-DSIFRRBS.cjs');exports.initWalletsLogger = _chunkSP5DQZ6Dcjs.b; exports.walletsLogger = _chunkSP5DQZ6Dcjs.a;