@crossmint/wallets-sdk 1.9.0 → 1.10.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.
- package/dist/api/__tests__/test-utils.cjs +1 -1
- package/dist/api/__tests__/test-utils.js +1 -1
- package/dist/api/client.cjs +1 -1
- package/dist/api/client.js +1 -1
- package/dist/api/index.cjs +1 -1
- package/dist/api/index.js +1 -1
- package/dist/chains/adapters/evm.cjs +1 -1
- package/dist/chains/adapters/evm.js +1 -1
- package/dist/chains/adapters/solana.cjs +1 -1
- package/dist/chains/adapters/solana.js +1 -1
- package/dist/chains/adapters/stellar.cjs +1 -1
- package/dist/chains/adapters/stellar.js +1 -1
- package/dist/chains/chain-adapter.cjs +1 -1
- package/dist/chains/chain-adapter.js +1 -1
- package/dist/chains/chains.cjs +1 -1
- package/dist/chains/chains.js +1 -1
- package/dist/{chunk-BDQ6PRDN.js → chunk-375QJHH2.js} +1 -1
- package/dist/chunk-3MF3O7DM.js +1 -0
- package/dist/{chunk-5UR3TR3H.cjs → chunk-3V7BHEQD.cjs} +1 -1
- package/dist/chunk-3VKLU6RH.cjs +1 -0
- package/dist/chunk-5ARUTNXL.cjs +1 -0
- package/dist/chunk-5GYNNLVW.cjs +1 -0
- package/dist/{chunk-SSC676RL.js → chunk-5RW5KBQT.js} +1 -1
- package/dist/{chunk-CGQR7B2H.cjs → chunk-72ATJ6TI.cjs} +1 -1
- package/dist/chunk-D5MVJQXK.js +1 -0
- package/dist/{chunk-J4L3FCIC.js → chunk-DI6RHRZL.js} +1 -1
- package/dist/{chunk-5OGNXLOH.js → chunk-DPU7ZDOR.js} +1 -1
- package/dist/{chunk-J42KB6M4.cjs → chunk-F44BTXOF.cjs} +1 -1
- package/dist/{chunk-464D53RC.js → chunk-FQ72MI5X.js} +1 -1
- package/dist/chunk-GPV7CQRP.cjs +1 -0
- package/dist/{chunk-HBGLYYE4.js → chunk-HIQJJVCM.js} +1 -1
- package/dist/{chunk-IHJXAM3H.cjs → chunk-ILD5AY26.cjs} +1 -1
- package/dist/chunk-IP6YYDHR.cjs +1 -0
- package/dist/{chunk-IASKJ4WS.js → chunk-IX4WR4RQ.js} +1 -1
- package/dist/{chunk-23X5QOE6.cjs → chunk-KICS3RGF.cjs} +1 -1
- package/dist/{chunk-WLTYJRB5.js → chunk-KRBTB7ZD.js} +1 -1
- package/dist/{chunk-5KGXMZFJ.js → chunk-KRODF7KK.js} +1 -1
- package/dist/{chunk-532BF2RA.cjs → chunk-LTTMLPVE.cjs} +1 -1
- package/dist/{chunk-OHR5JRFH.cjs → chunk-MBFZQQQY.cjs} +1 -1
- package/dist/{chunk-DZAG4SRY.js → chunk-MMIBGH44.js} +1 -1
- package/dist/chunk-MSG2HGUJ.js +1 -0
- package/dist/{chunk-222WHEBO.js → chunk-PWOSYRP7.js} +1 -1
- package/dist/{chunk-LOZ4BC3H.cjs → chunk-Q542QHF4.cjs} +1 -1
- package/dist/{chunk-ILCNZB3A.cjs → chunk-QFZSILOI.cjs} +1 -1
- package/dist/{chunk-5M4L42QQ.js → chunk-QQYB76KH.js} +1 -1
- package/dist/chunk-S5VWQSTF.js +1 -0
- package/dist/{chunk-HXN3ZART.js → chunk-SI3GYRHH.js} +1 -1
- package/dist/{chunk-HRRPQMFM.cjs → chunk-T2DDN34X.cjs} +1 -1
- package/dist/{chunk-2SUPM5NU.js → chunk-THDXNOZG.js} +1 -1
- package/dist/{chunk-Z7GMI25O.cjs → chunk-TMSRJGFL.cjs} +1 -1
- package/dist/{chunk-DVTKFD3K.js → chunk-TODN3BHC.js} +1 -1
- package/dist/chunk-TZR7N7VZ.js +1 -0
- package/dist/{chunk-KZ62YXDQ.cjs → chunk-UWQ6UZGE.cjs} +1 -1
- package/dist/{chunk-4T45LK43.cjs → chunk-UZN6B2NV.cjs} +1 -1
- package/dist/{chunk-PZC2L2XZ.cjs → chunk-VGDORB2L.cjs} +1 -1
- package/dist/{chunk-CTJQUZUF.js → chunk-W7V3VEMM.js} +1 -1
- package/dist/chunk-WFWX6G26.cjs +1 -0
- package/dist/{chunk-E7Z24LRS.cjs → chunk-WKHVIEB2.cjs} +1 -1
- package/dist/{chunk-HJIKAOPC.cjs → chunk-X6FEF7IR.cjs} +1 -1
- package/dist/{chunk-AERFTEJI.cjs → chunk-XNH3I436.cjs} +1 -1
- package/dist/{chunk-YLMVZCBF.js → chunk-YAWVSDCB.js} +1 -1
- package/dist/{chunk-2UL2H43T.js → chunk-YFYV2J4S.js} +1 -1
- package/dist/{chunk-J64QG3LS.js → chunk-Z3YQFRAQ.js} +1 -1
- package/dist/{chunk-7AE4UN5A.cjs → chunk-Z7NKKPX3.cjs} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/logger/index.cjs +1 -1
- package/dist/logger/index.js +1 -1
- package/dist/logger/init.cjs +1 -1
- package/dist/logger/init.js +1 -1
- package/dist/sdk.cjs +1 -1
- package/dist/sdk.js +1 -1
- package/dist/signers/index.cjs +1 -1
- package/dist/signers/index.d.cts +2 -1
- package/dist/signers/index.d.ts +2 -1
- package/dist/signers/index.js +1 -1
- package/dist/signers/non-custodial/index.cjs +1 -1
- package/dist/signers/non-custodial/index.js +1 -1
- package/dist/signers/non-custodial/ncs-evm-signer.cjs +1 -1
- package/dist/signers/non-custodial/ncs-evm-signer.js +1 -1
- package/dist/signers/non-custodial/ncs-signer.cjs +1 -1
- package/dist/signers/non-custodial/ncs-signer.js +1 -1
- package/dist/signers/non-custodial/ncs-solana-signer.cjs +1 -1
- package/dist/signers/non-custodial/ncs-solana-signer.js +1 -1
- package/dist/signers/non-custodial/ncs-stellar-signer.cjs +1 -1
- package/dist/signers/non-custodial/ncs-stellar-signer.js +1 -1
- package/dist/utils/constants.cjs +1 -1
- package/dist/utils/constants.js +1 -1
- package/dist/utils/device-signers/IframeDeviceSignerKeyStorage.cjs +1 -1
- package/dist/utils/device-signers/IframeDeviceSignerKeyStorage.js +1 -1
- package/dist/utils/device-signers/index.cjs +1 -1
- package/dist/utils/device-signers/index.js +1 -1
- package/dist/wallets/__tests__/test-helpers.cjs +1 -1
- package/dist/wallets/__tests__/test-helpers.js +1 -1
- package/dist/wallets/evm.cjs +1 -1
- package/dist/wallets/evm.js +1 -1
- package/dist/wallets/services/balance-formatter.cjs +1 -1
- package/dist/wallets/services/balance-formatter.js +1 -1
- package/dist/wallets/services/device-recovery-service.cjs +1 -1
- package/dist/wallets/services/device-recovery-service.d.cts +3 -2
- package/dist/wallets/services/device-recovery-service.d.ts +3 -2
- package/dist/wallets/services/device-recovery-service.js +1 -1
- package/dist/wallets/services/operation-poller.cjs +1 -1
- package/dist/wallets/services/operation-poller.js +1 -1
- package/dist/wallets/services/signer-manager.cjs +1 -1
- package/dist/wallets/services/signer-manager.js +1 -1
- package/dist/wallets/solana.cjs +1 -1
- package/dist/wallets/solana.js +1 -1
- package/dist/wallets/stellar.cjs +1 -1
- package/dist/wallets/stellar.js +1 -1
- package/dist/wallets/wallet-factory.cjs +1 -1
- package/dist/wallets/wallet-factory.js +1 -1
- package/dist/wallets/wallet.cjs +1 -1
- package/dist/wallets/wallet.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-2F6CGFVL.cjs +0 -1
- package/dist/chunk-2TVSRZ42.js +0 -1
- package/dist/chunk-6DEQI3XT.cjs +0 -1
- package/dist/chunk-DFIZFCX4.js +0 -1
- package/dist/chunk-DX2WEUVJ.js +0 -1
- package/dist/chunk-IBQQA6L3.js +0 -1
- package/dist/chunk-J5W5S2WG.cjs +0 -1
- package/dist/chunk-K2W3NIDO.cjs +0 -1
- package/dist/chunk-LKYOZL7U.cjs +0 -1
- package/dist/chunk-N5LPV5FV.js +0 -1
- package/dist/chunk-QYNJ3CQP.cjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunk3V7BHEQDcjs = require('./chunk-3V7BHEQD.cjs');var _chunkQFZSILOIcjs = require('./chunk-QFZSILOI.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');var _web3js = require('@solana/web3.js');var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);var g=class c extends _chunk3V7BHEQDcjs.a{constructor(n){super(n)}signMessage(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for email signer"))})}signTransaction(n){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var i;yield this.handleAuthRequired();let d=this.getJwtOrThrow(),m=_bs582.default.decode(n),y=_web3js.VersionedTransaction.deserialize(m).message.serialize();_chunkQFZSILOIcjs.a.info("sign: sending request",{keyType:"ed25519"});let l=Date.now(),e=yield(i=this.config.clientTEEConnection)==null?void 0:i.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:d,apiKey:this.config.crossmint.apiKey},data:{keyType:"ed25519",bytes:_bs582.default.encode(new Uint8Array(y)),encoding:"base58"}},options:_chunk3V7BHEQDcjs.b});if(_chunkQFZSILOIcjs.a.info("sign: response received",{status:e==null?void 0:e.status,durationMs:Date.now()-l}),(e==null?void 0:e.status)==="error")throw new Error(e.error);if((e==null?void 0:e.signature)==null)throw new Error("Failed to sign transaction");return c.verifyPublicKeyFormat(e.publicKey),{signature:e.signature.bytes}})}static verifyPublicKeyFormat(n){if(n==null)throw new Error("No public key found");if(n.encoding!=="base58"||n.keyType!=="ed25519"||n.bytes==null)throw new Error("Not supported. Expected public key to be in base58 encoding and ed25519 key type. Got: "+JSON.stringify(n))}getChainKeyParams(){return{scheme:"ed25519",encoding:"base58"}}};exports.a = g;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkGMU3ZYLScjs = require('./chunk-GMU3ZYLS.cjs');var _chunkTVD45ZZMcjs = require('./chunk-TVD45ZZM.cjs');var _chunkGPV7CQRPcjs = require('./chunk-GPV7CQRP.cjs');var _chunkQPCZFIUVcjs = require('./chunk-QPCZFIUV.cjs');var _chunkLHAOCUXTcjs = require('./chunk-LHAOCUXT.cjs');var _chunkQFZSILOIcjs = require('./chunk-QFZSILOI.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');var l,w,m,d,S,n,A,C,D,b,k,p,x,j,V,q,M= exports.a =class{constructor(r){_chunkDSIFRRBScjs.e.call(void 0, this,p);_chunkDSIFRRBScjs.e.call(void 0, this,l,"unknown");_chunkDSIFRRBScjs.e.call(void 0, this,w,!1);_chunkDSIFRRBScjs.e.call(void 0, this,m);_chunkDSIFRRBScjs.e.call(void 0, this,d);_chunkDSIFRRBScjs.e.call(void 0, this,S);_chunkDSIFRRBScjs.e.call(void 0, this,n);_chunkDSIFRRBScjs.e.call(void 0, this,A);_chunkDSIFRRBScjs.e.call(void 0, this,C);_chunkDSIFRRBScjs.e.call(void 0, this,D);_chunkDSIFRRBScjs.e.call(void 0, this,b);_chunkDSIFRRBScjs.e.call(void 0, this,k);_chunkDSIFRRBScjs.f.call(void 0, this,m,r.chain),_chunkDSIFRRBScjs.f.call(void 0, this,d,r.walletAddress),_chunkDSIFRRBScjs.f.call(void 0, this,S,r.options),_chunkDSIFRRBScjs.f.call(void 0, this,n,r.signerManager),_chunkDSIFRRBScjs.f.call(void 0, this,A,r.serverSignerResolver),_chunkDSIFRRBScjs.f.call(void 0, this,C,r.signers),_chunkDSIFRRBScjs.f.call(void 0, this,D,r.addSigner),_chunkDSIFRRBScjs.f.call(void 0, this,b,r.approveSignature),_chunkDSIFRRBScjs.f.call(void 0, this,k,r.approveTransaction)}get needsRecovery(){return _chunkDSIFRRBScjs.d.call(void 0, this,l)==="needs-recovery"}onSignerSelected(){_chunkDSIFRRBScjs.d.call(void 0, this,l)==="needs-recovery"&&_chunkDSIFRRBScjs.f.call(void 0, this,l,"unknown")}initDeviceSigner(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var g;if(((g=_chunkDSIFRRBScjs.d.call(void 0, this,S))==null?void 0:g.deviceSignerKeyStorage)==null||_chunkDSIFRRBScjs.d.call(void 0, this,w))return;let i={type:"device"};try{yield this.resolveAvailability(i)}catch(h){_chunkQFZSILOIcjs.a.error("wallet.initDeviceSigner.error",{error:h}),_chunkDSIFRRBScjs.f.call(void 0, this,l,"needs-recovery");return}if(_chunkDSIFRRBScjs.d.call(void 0, this,l)==="needs-recovery")return;let a=_chunkTVD45ZZMcjs.a.call(void 0, i.type).buildInternalConfig(i,_chunkDSIFRRBScjs.d.call(void 0, this,n).descriptorContext()),t=yield _chunkDSIFRRBScjs.d.call(void 0, this,n).assemble(a);_chunkDSIFRRBScjs.d.call(void 0, this,n).setActiveSigner(t),_chunkDSIFRRBScjs.d.call(void 0, this,n).isApprovedSignerStatus(t.status)||(_chunkQFZSILOIcjs.a.info("wallet.initDeviceSigner.pendingApproval",{signerLocator:t.locator(),status:t.status}),_chunkDSIFRRBScjs.f.call(void 0, this,l,"needs-recovery"))})}recover(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var h;if(_chunkQFZSILOIcjs.a.info("wallet.recover.start"),_chunkDSIFRRBScjs.d.call(void 0, this,l)==="resolved"){_chunkQFZSILOIcjs.a.info("wallet.recover.skipped",{reason:"Device signer already approved (cached)"});return}if(_chunkDSIFRRBScjs.d.call(void 0, this,w)){_chunkQFZSILOIcjs.a.info("wallet.recover.skipped",{reason:"device signer not supported (cached)"}),_chunkDSIFRRBScjs.f.call(void 0, this,l,"resolved");return}let r=_chunkDSIFRRBScjs.d.call(void 0, this,n).activeSigner;if((r==null?void 0:r.type)==="device"&&(yield _chunkDSIFRRBScjs.g.call(void 0, this,p,x).call(this,r))){_chunkDSIFRRBScjs.f.call(void 0, this,l,"resolved");return}if(r!=null&&r.type!=="device"){_chunkQFZSILOIcjs.a.warn("wallet.recover.skipped",{reason:"Recovery is only supported for device signers"}),_chunkDSIFRRBScjs.f.call(void 0, this,l,"unknown");return}let i=(h=_chunkDSIFRRBScjs.d.call(void 0, this,S))==null?void 0:h.deviceSignerKeyStorage;if(i==null){if(_chunkDSIFRRBScjs.d.call(void 0, this,l)!=="needs-recovery")return;throw new Error("Device signer key storage is required to recover a device signer")}let a=yield _chunkDSIFRRBScjs.g.call(void 0, this,p,V).call(this,i);if(a!=null&&(yield _chunkDSIFRRBScjs.g.call(void 0, this,p,x).call(this,a))){_chunkDSIFRRBScjs.d.call(void 0, this,n).setActiveSigner(a),_chunkDSIFRRBScjs.f.call(void 0, this,l,"resolved");let s=a.locator().replace("device:","");try{yield i.mapAddressToKey(_chunkDSIFRRBScjs.d.call(void 0, this,d),s)}catch(y){_chunkQFZSILOIcjs.a.warn("wallet.recover.mapAddressToKey.error",{error:y})}return}let t=yield _chunkGMU3ZYLScjs.a.call(void 0, i,_chunkDSIFRRBScjs.d.call(void 0, this,d));try{yield _chunkDSIFRRBScjs.d.call(void 0, this,D).call(this,t)}catch(s){if(s instanceof _chunkLHAOCUXTcjs.m){_chunkQFZSILOIcjs.a.info("wallet.recover.device.unsupportedFallback",{signerLocator:t.locator}),yield i.deleteKey(_chunkDSIFRRBScjs.d.call(void 0, this,d)),_chunkDSIFRRBScjs.f.call(void 0, this,w,!0),_chunkDSIFRRBScjs.f.call(void 0, this,l,"resolved"),yield _chunkDSIFRRBScjs.g.call(void 0, this,p,q).call(this);return}else if(B(s))_chunkQFZSILOIcjs.a.info("wallet.recover.skipped",{reason:"Device signer already approved",signerLocator:t.locator});else throw s instanceof _chunkQPCZFIUVcjs.a||s instanceof Error&&s.name==="AuthRejectedError"?(_chunkQFZSILOIcjs.a.info("wallet.recover.device.authRejected",{signerLocator:t.locator}),s):s instanceof _chunkQPCZFIUVcjs.b||s instanceof Error&&s.name==="OtpValidationError"?(_chunkQFZSILOIcjs.a.warn("wallet.recover.device.otpValidationFailed",{signerLocator:t.locator,code:s instanceof _chunkQPCZFIUVcjs.b?s.code:void 0}),s):(_chunkQFZSILOIcjs.a.error("wallet.recover.device.error",{error:s}),yield i.deleteKey(_chunkDSIFRRBScjs.d.call(void 0, this,d)),s)}let g=yield _chunkDSIFRRBScjs.d.call(void 0, this,n).assemble({type:"device",locator:t.locator,address:_chunkDSIFRRBScjs.d.call(void 0, this,d)});_chunkDSIFRRBScjs.d.call(void 0, this,n).setActiveSigner(g),g.type==="device"&&(g.status="success"),_chunkQFZSILOIcjs.a.info("wallet.recover.device.success",{signerLocator:t.locator}),_chunkDSIFRRBScjs.f.call(void 0, this,l,"resolved")})}resolveAvailability(r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var h;let i=(h=_chunkDSIFRRBScjs.d.call(void 0, this,S))==null?void 0:h.deviceSignerKeyStorage;if(i==null)throw new Error("Device signer key storage is required for device signers");let a=yield i.getKey(_chunkDSIFRRBScjs.d.call(void 0, this,d));if(a!=null){r.locator=`device:${a}`,_chunkDSIFRRBScjs.f.call(void 0, this,l,"unknown");return}let g=(yield _chunkDSIFRRBScjs.d.call(void 0, this,C).call(this)).filter(s=>s.locator.startsWith("device:"));for(let s of g){let y=s.locator.replace("device:","");if(yield i.hasKey(y)){yield i.mapAddressToKey(_chunkDSIFRRBScjs.d.call(void 0, this,d),y),r.locator=s.locator,_chunkDSIFRRBScjs.f.call(void 0, this,l,"unknown");return}}_chunkDSIFRRBScjs.f.call(void 0, this,l,"needs-recovery")})}tryResolveLocallyAvailableSigner(t){return _chunkDSIFRRBScjs.h.call(void 0, this,arguments,function*(r,i=(a=>(a=_chunkDSIFRRBScjs.d.call(void 0, this,S))==null?void 0:a.deviceSignerKeyStorage)()){if(i==null)return null;try{return yield _chunkGPV7CQRPcjs.b.call(void 0, _chunkDSIFRRBScjs.d.call(void 0, this,m),r,_chunkDSIFRRBScjs.d.call(void 0, this,d),i)}catch(g){return _chunkQFZSILOIcjs.a.warn("wallet.deviceRecovery.tryResolveLocallyAvailableSigner.failed",{signerLocator:r,error:g}),null}})}};l=new WeakMap,w=new WeakMap,m=new WeakMap,d=new WeakMap,S=new WeakMap,n=new WeakMap,A=new WeakMap,C=new WeakMap,D=new WeakMap,b=new WeakMap,k=new WeakMap,p=new WeakSet,x=function(r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var a;if(_chunkDSIFRRBScjs.d.call(void 0, this,n).isApprovedSignerStatus(r.status))return _chunkQFZSILOIcjs.a.info("wallet.recover.skipped",{reason:"Device signer already approved"}),!0;let i=yield _chunkDSIFRRBScjs.d.call(void 0, this,n).getSignerState(r.locator());return r.status=(a=i.signer)==null?void 0:a.status,i.pendingOperation!=null?(yield _chunkDSIFRRBScjs.g.call(void 0, this,p,j).call(this,r,i.pendingOperation),!0):_chunkDSIFRRBScjs.d.call(void 0, this,n).isApprovedSignerStatus(r.status)?(_chunkQFZSILOIcjs.a.info("wallet.recover.skipped",{reason:"Device signer already approved"}),!0):!1})},j=function(r,i){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var y;let a=_chunkDSIFRRBScjs.d.call(void 0, this,n).activeSigner,t=_chunkDSIFRRBScjs.d.call(void 0, this,n).recovery;if(_chunkQPCZFIUVcjs.f.call(void 0, t)&&!_chunkDSIFRRBScjs.d.call(void 0, this,A).hasRecoveryResolution)throw new Error('Cannot resume pending approval: no secret available. Call wallet.useSigner({ type: "server", secret: ... }) first with the recovery server secret.');let g=_chunkTVD45ZZMcjs.a.call(void 0, t.type),h=_chunkDSIFRRBScjs.d.call(void 0, this,n).descriptorContext();if(t.type==="external-wallet"&&!g.canAutoAssemble(t,h))throw new Error('Cannot resume pending approval: no onSign callback available. Call wallet.useSigner({ type: "external-wallet", address: "0x...", onSign: async (tx) => ... }) first.');let s=g.buildInternalConfig(t,h);_chunkDSIFRRBScjs.d.call(void 0, this,n).setActiveSigner(_chunkGPV7CQRPcjs.a.call(void 0, _chunkDSIFRRBScjs.d.call(void 0, this,m),s,(y=_chunkDSIFRRBScjs.d.call(void 0, this,S))==null?void 0:y.deviceSignerKeyStorage));try{i.type==="signature"?yield _chunkDSIFRRBScjs.d.call(void 0, this,b).call(this,i.id):yield _chunkDSIFRRBScjs.d.call(void 0, this,k).call(this,i.id)}catch(L){throw _chunkDSIFRRBScjs.d.call(void 0, this,n).setActiveSigner(r),L}finally{_chunkDSIFRRBScjs.d.call(void 0, this,n).activeSigner!==r&&_chunkDSIFRRBScjs.d.call(void 0, this,n).setActiveSigner(a)}r.status="success",_chunkQFZSILOIcjs.a.info("wallet.recover.device.success",{signerLocator:r.locator(),resumed:!0})})},V=function(r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let a=(yield _chunkDSIFRRBScjs.d.call(void 0, this,C).call(this)).filter(t=>t.locator.startsWith("device:"));for(let t of a){let g=yield this.tryResolveLocallyAvailableSigner(t.locator,r);if(g!=null)return _chunkQFZSILOIcjs.a.info("wallet.recover.foundLocalDeviceSigner",{signerLocator:t.locator}),g}return null})},q=function(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let r=_chunkDSIFRRBScjs.d.call(void 0, this,n).recovery,i=_chunkTVD45ZZMcjs.a.call(void 0, r.type),a=_chunkDSIFRRBScjs.d.call(void 0, this,n).descriptorContext();if(i.canAutoAssemble(r,a))try{let t=i.buildInternalConfig(r,a);_chunkDSIFRRBScjs.d.call(void 0, this,n).setActiveSigner(yield _chunkDSIFRRBScjs.d.call(void 0, this,n).assemble(t,{isAdminSigner:!0}))}catch(t){_chunkQFZSILOIcjs.a.warn("wallet.recover.device.unsupportedFallback.autoAssemblyFailed",{recoveryType:r.type,error:t})}})};function B(P){if(!(P instanceof Error))return!1;let r=P.message.toLowerCase();return r.includes("delegated signer")&&r.includes("already")&&r.includes("approved")}exports.a = M;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./chunk-
|
|
1
|
+
import{a as e}from"./chunk-SI3GYRHH.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 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkTM77X7C3cjs = require('./chunk-TM77X7C3.cjs');var _chunkLHAOCUXTcjs = require('./chunk-LHAOCUXT.cjs');var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkTM77X7C3cjs = require('./chunk-TM77X7C3.cjs');var _chunkLHAOCUXTcjs = require('./chunk-LHAOCUXT.cjs');var _chunkQFZSILOIcjs = require('./chunk-QFZSILOI.cjs');var f={nativeToken:"eth",walletLocatorPrefix:"me:evm:smart",supportsSignatures:!0,addSignerChain(e){return e},extractAddSignerOperation(e,r,n){var a,t,o,d;if(!("chains"in e))throw _chunkQFZSILOIcjs.a.error("wallet.addSigner.error",{error:"Expected chains in response for EVM chain"}),new Error("Expected chains in response for EVM chain");if(((t=(a=e.chains)==null?void 0:a[r])==null?void 0:t.status)==="failed")throw _chunkQFZSILOIcjs.a.error("wallet.addSigner.failed",{chain:r,signerType:n.type,signerLocator:n.locator,chainStatus:(o=e.chains)==null?void 0:o[r]}),new (0, _chunkLHAOCUXTcjs.j)(`Signer registration failed for chain ${r} (signer: ${n.locator})`,JSON.stringify((d=e.chains)==null?void 0:d[r]));return _chunkTM77X7C3cjs.c.call(void 0, e,r)},balanceTokenFields(e){return e!=null&&"contractAddress"in e?{contractAddress:e.contractAddress}:{}},emptyBalanceTokenFields(){return{contractAddress:void 0}}};exports.a = f;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as l}from"./chunk-FT5EVMLB.js";import{a as o}from"./chunk-SVIKBM3S.js";import{a as S}from"./chunk-KKQBZXFE.js";import{a as A}from"./chunk-S3DYQVRD.js";import{a as O}from"./chunk-KUP7H7X2.js";import{b as i,c as s}from"./chunk-SLPKMZNW.js";import{a as E}from"./chunk-
|
|
1
|
+
import{a as l}from"./chunk-FT5EVMLB.js";import{a as o}from"./chunk-SVIKBM3S.js";import{a as S}from"./chunk-KKQBZXFE.js";import{a as A}from"./chunk-S3DYQVRD.js";import{a as O}from"./chunk-KUP7H7X2.js";import{b as i,c as s}from"./chunk-SLPKMZNW.js";import{a as E}from"./chunk-SI3GYRHH.js";import{APIKeyEnvironmentPrefix as M,BlockchainIncludingTestnet as e}from"@crossmint/common-sdk-base";import{baseSepolia as m,base as _,polygonAmoy as L,polygon as P,optimismSepolia as u,optimism as c,arbitrumSepolia as R,arbitrum as N,arbitrumNova as p,modeTestnet as h,mode as d,mainnet as f,bsc as W,shape as U,zora as V,zoraSepolia as B,sepolia as y,flowMainnet as H,flowTestnet as v,plume as x,plumeTestnet as b}from"viem/chains";var w=[e.ABSTRACT_TESTNET,e.ARBITRUM_SEPOLIA,e.BASE_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.SCROLL_SEPOLIA,e.SEI_ATLANTIC_2_TESTNET,e.STORY_TESTNET,e.WORLD_CHAIN_SEPOLIA,e.ZORA_SEPOLIA,e.ARC_TESTNET,e.TEMPO_TESTNET],D=[e.ABSTRACT,e.APECHAIN,e.ARBITRUM,e.ARBITRUMNOVA,e.BASE,e.BSC,e.ETHEREUM,e.FLOW,e.MANTLE,e.MODE,e.OPTIMISM,e.PLUME,e.POLYGON,e.SCROLL,e.SEI_PACIFIC_1,e.SHAPE,e.STORY,e.TEMPO,e.WORLDCHAIN,e.ZORA];function ee(t){switch(t){case e.BASE_SEPOLIA:return m;case e.BASE:return _;case e.POLYGON_AMOY:return L;case e.POLYGON:return P;case e.OPTIMISM_SEPOLIA:return u;case e.OPTIMISM:return c;case e.ARBITRUM_SEPOLIA:return R;case e.ARBITRUM:return N;case e.ARBITRUMNOVA:return p;case e.STORY_TESTNET:return A;case e.STORY:return S;case e.MODE_SEPOLIA:return h;case e.MODE:return d;case e.BSC:return W;case e.SHAPE:return U;case e.ZORA:return V;case e.ZORA_SEPOLIA:return B;case e.ETHEREUM_SEPOLIA:return y;case e.ETHEREUM:return f;case e.FLOW:return H;case e.FLOW_TESTNET:return v;case e.PLUME_TESTNET:return b;case e.PLUME:return x;case e.ARC_TESTNET:return o;case e.TEMPO:return O;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 I(t){return w.includes(t)}function C(t){return D.includes(t)}var Y={[e.ABSTRACT]:e.ABSTRACT_TESTNET,[e.APECHAIN]:e.CURTIS,[e.ARBITRUM]:e.ARBITRUM_SEPOLIA,[e.BASE]:e.BASE_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.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};function g(t){return Y[t]}function F(t){return t==="solana"||t==="stellar"||I(t)||C(t)}function te(t,a){if(!F(t))throw new s(`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===M.PRODUCTION;if(T&&I(r))throw new i(`Chain "${t}" is a testnet chain and cannot be used in production. Please use a mainnet chain instead.`);if(!T&&C(r)){let n=g(r);if(n!=null)return 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{ee as a,I as b,C as c,g as d,F as e,te as f};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as g}from"./chunk-6HB4WO5J.js";import{j as s}from"./chunk-SLPKMZNW.js";import{a as i}from"./chunk-
|
|
1
|
+
import{c as g}from"./chunk-6HB4WO5J.js";import{j as s}from"./chunk-SLPKMZNW.js";import{a as i}from"./chunk-SI3GYRHH.js";var h={nativeToken:"eth",walletLocatorPrefix:"me:evm:smart",supportsSignatures:!0,addSignerChain(e){return e},extractAddSignerOperation(e,r,n){var a,t,o,d;if(!("chains"in e))throw i.error("wallet.addSigner.error",{error:"Expected chains in response for EVM chain"}),new Error("Expected chains in response for EVM chain");if(((t=(a=e.chains)==null?void 0:a[r])==null?void 0:t.status)==="failed")throw i.error("wallet.addSigner.failed",{chain:r,signerType:n.type,signerLocator:n.locator,chainStatus:(o=e.chains)==null?void 0:o[r]}),new s(`Signer registration failed for chain ${r} (signer: ${n.locator})`,JSON.stringify((d=e.chains)==null?void 0:d[r]));return g(e,r)},balanceTokenFields(e){return e!=null&&"contractAddress"in e?{contractAddress:e.contractAddress}:{}},emptyBalanceTokenFields(){return{contractAddress:void 0}}};export{h as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk3V7BHEQDcjs = require('./chunk-3V7BHEQD.cjs');var _chunkQFZSILOIcjs = require('./chunk-QFZSILOI.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');var a=class g extends _chunk3V7BHEQDcjs.a{constructor(n){super(n)}signMessage(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for stellar signer"))})}signTransaction(n){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var i;yield this.handleAuthRequired();let c=this.getJwtOrThrow();_chunkQFZSILOIcjs.a.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:_chunk3V7BHEQDcjs.b});if(_chunkQFZSILOIcjs.a.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"}}};exports.a = a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkZ7NKKPX3cjs = require('./chunk-Z7NKKPX3.cjs');var _chunkGMU3ZYLScjs = require('./chunk-GMU3ZYLS.cjs');var _chunkXNH3I436cjs = require('./chunk-XNH3I436.cjs');var _chunkQFZSILOIcjs = require('./chunk-QFZSILOI.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var _ox = require('ox');var o=class c{constructor(e){_chunkQFZSILOIcjs.b.call(void 0, e.apiKey);let t=new (0, _chunkXNH3I436cjs.a)(e);this.walletFactory=new (0, _chunkZ7NKKPX3cjs.a)(t),_chunkQFZSILOIcjs.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 +1 @@
|
|
|
1
|
-
import{a as e}from"./chunk-
|
|
1
|
+
import{a as e}from"./chunk-SI3GYRHH.js";var s={nativeToken:"sol",walletLocatorPrefix:"me:solana:smart",supportsSignatures:!1,addSignerChain(n){},extractAddSignerOperation(n,r,a){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&&"mintHash"in n?{mintHash:n.mintHash}:n!=null&&"contractAddress"in n?{contractAddress:n.contractAddress}:{}},emptyBalanceTokenFields(){return{mintHash:void 0}}};export{s as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as T}from"./chunk-5LNDUSMZ.js";import{a as K}from"./chunk-E2GL7NJM.js";import{a as W,b as O}from"./chunk-D5MVJQXK.js";import{a as F,b as R,f as I}from"./chunk-DCKFFFPG.js";import{m as E}from"./chunk-SLPKMZNW.js";import{a as c}from"./chunk-SI3GYRHH.js";import{d as e,e as v,f as o,g as f,h as u}from"./chunk-NU7VF7MC.js";var l,w,m,d,S,n,A,C,D,b,k,p,x,j,V,q,M=class{constructor(r){v(this,p);v(this,l,"unknown");v(this,w,!1);v(this,m);v(this,d);v(this,S);v(this,n);v(this,A);v(this,C);v(this,D);v(this,b);v(this,k);o(this,m,r.chain),o(this,d,r.walletAddress),o(this,S,r.options),o(this,n,r.signerManager),o(this,A,r.serverSignerResolver),o(this,C,r.signers),o(this,D,r.addSigner),o(this,b,r.approveSignature),o(this,k,r.approveTransaction)}get needsRecovery(){return e(this,l)==="needs-recovery"}onSignerSelected(){e(this,l)==="needs-recovery"&&o(this,l,"unknown")}initDeviceSigner(){return u(this,null,function*(){var g;if(((g=e(this,S))==null?void 0:g.deviceSignerKeyStorage)==null||e(this,w))return;let i={type:"device"};try{yield this.resolveAvailability(i)}catch(h){c.error("wallet.initDeviceSigner.error",{error:h}),o(this,l,"needs-recovery");return}if(e(this,l)==="needs-recovery")return;let a=K(i.type).buildInternalConfig(i,e(this,n).descriptorContext()),t=yield e(this,n).assemble(a);e(this,n).setActiveSigner(t),e(this,n).isApprovedSignerStatus(t.status)||(c.info("wallet.initDeviceSigner.pendingApproval",{signerLocator:t.locator(),status:t.status}),o(this,l,"needs-recovery"))})}recover(){return u(this,null,function*(){var h;if(c.info("wallet.recover.start"),e(this,l)==="resolved"){c.info("wallet.recover.skipped",{reason:"Device signer already approved (cached)"});return}if(e(this,w)){c.info("wallet.recover.skipped",{reason:"device signer not supported (cached)"}),o(this,l,"resolved");return}let r=e(this,n).activeSigner;if((r==null?void 0:r.type)==="device"&&(yield f(this,p,x).call(this,r))){o(this,l,"resolved");return}if(r!=null&&r.type!=="device"){c.warn("wallet.recover.skipped",{reason:"Recovery is only supported for device signers"}),o(this,l,"unknown");return}let i=(h=e(this,S))==null?void 0:h.deviceSignerKeyStorage;if(i==null){if(e(this,l)!=="needs-recovery")return;throw new Error("Device signer key storage is required to recover a device signer")}let a=yield f(this,p,V).call(this,i);if(a!=null&&(yield f(this,p,x).call(this,a))){e(this,n).setActiveSigner(a),o(this,l,"resolved");let s=a.locator().replace("device:","");try{yield i.mapAddressToKey(e(this,d),s)}catch(y){c.warn("wallet.recover.mapAddressToKey.error",{error:y})}return}let t=yield T(i,e(this,d));try{yield e(this,D).call(this,t)}catch(s){if(s instanceof E){c.info("wallet.recover.device.unsupportedFallback",{signerLocator:t.locator}),yield i.deleteKey(e(this,d)),o(this,w,!0),o(this,l,"resolved"),yield f(this,p,q).call(this);return}else if(B(s))c.info("wallet.recover.skipped",{reason:"Device signer already approved",signerLocator:t.locator});else throw s instanceof F||s instanceof Error&&s.name==="AuthRejectedError"?(c.info("wallet.recover.device.authRejected",{signerLocator:t.locator}),s):s instanceof R||s instanceof Error&&s.name==="OtpValidationError"?(c.warn("wallet.recover.device.otpValidationFailed",{signerLocator:t.locator,code:s instanceof R?s.code:void 0}),s):(c.error("wallet.recover.device.error",{error:s}),yield i.deleteKey(e(this,d)),s)}let g=yield e(this,n).assemble({type:"device",locator:t.locator,address:e(this,d)});e(this,n).setActiveSigner(g),g.type==="device"&&(g.status="success"),c.info("wallet.recover.device.success",{signerLocator:t.locator}),o(this,l,"resolved")})}resolveAvailability(r){return u(this,null,function*(){var h;let i=(h=e(this,S))==null?void 0:h.deviceSignerKeyStorage;if(i==null)throw new Error("Device signer key storage is required for device signers");let a=yield i.getKey(e(this,d));if(a!=null){r.locator=`device:${a}`,o(this,l,"unknown");return}let g=(yield e(this,C).call(this)).filter(s=>s.locator.startsWith("device:"));for(let s of g){let y=s.locator.replace("device:","");if(yield i.hasKey(y)){yield i.mapAddressToKey(e(this,d),y),r.locator=s.locator,o(this,l,"unknown");return}}o(this,l,"needs-recovery")})}tryResolveLocallyAvailableSigner(t){return u(this,arguments,function*(r,i=(a=>(a=e(this,S))==null?void 0:a.deviceSignerKeyStorage)()){if(i==null)return null;try{return yield O(e(this,m),r,e(this,d),i)}catch(g){return c.warn("wallet.deviceRecovery.tryResolveLocallyAvailableSigner.failed",{signerLocator:r,error:g}),null}})}};l=new WeakMap,w=new WeakMap,m=new WeakMap,d=new WeakMap,S=new WeakMap,n=new WeakMap,A=new WeakMap,C=new WeakMap,D=new WeakMap,b=new WeakMap,k=new WeakMap,p=new WeakSet,x=function(r){return u(this,null,function*(){var a;if(e(this,n).isApprovedSignerStatus(r.status))return c.info("wallet.recover.skipped",{reason:"Device signer already approved"}),!0;let i=yield e(this,n).getSignerState(r.locator());return r.status=(a=i.signer)==null?void 0:a.status,i.pendingOperation!=null?(yield f(this,p,j).call(this,r,i.pendingOperation),!0):e(this,n).isApprovedSignerStatus(r.status)?(c.info("wallet.recover.skipped",{reason:"Device signer already approved"}),!0):!1})},j=function(r,i){return u(this,null,function*(){var y;let a=e(this,n).activeSigner,t=e(this,n).recovery;if(I(t)&&!e(this,A).hasRecoveryResolution)throw new Error('Cannot resume pending approval: no secret available. Call wallet.useSigner({ type: "server", secret: ... }) first with the recovery server secret.');let g=K(t.type),h=e(this,n).descriptorContext();if(t.type==="external-wallet"&&!g.canAutoAssemble(t,h))throw new Error('Cannot resume pending approval: no onSign callback available. Call wallet.useSigner({ type: "external-wallet", address: "0x...", onSign: async (tx) => ... }) first.');let s=g.buildInternalConfig(t,h);e(this,n).setActiveSigner(W(e(this,m),s,(y=e(this,S))==null?void 0:y.deviceSignerKeyStorage));try{i.type==="signature"?yield e(this,b).call(this,i.id):yield e(this,k).call(this,i.id)}catch(L){throw e(this,n).setActiveSigner(r),L}finally{e(this,n).activeSigner!==r&&e(this,n).setActiveSigner(a)}r.status="success",c.info("wallet.recover.device.success",{signerLocator:r.locator(),resumed:!0})})},V=function(r){return u(this,null,function*(){let a=(yield e(this,C).call(this)).filter(t=>t.locator.startsWith("device:"));for(let t of a){let g=yield this.tryResolveLocallyAvailableSigner(t.locator,r);if(g!=null)return c.info("wallet.recover.foundLocalDeviceSigner",{signerLocator:t.locator}),g}return null})},q=function(){return u(this,null,function*(){let r=e(this,n).recovery,i=K(r.type),a=e(this,n).descriptorContext();if(i.canAutoAssemble(r,a))try{let t=i.buildInternalConfig(r,a);e(this,n).setActiveSigner(yield e(this,n).assemble(t,{isAdminSigner:!0}))}catch(t){c.warn("wallet.recover.device.unsupportedFallback.autoAssemblyFailed",{recoveryType:r.type,error:t})}})};function B(P){if(!(P instanceof Error))return!1;let r=P.message.toLowerCase();return r.includes("delegated signer")&&r.includes("already")&&r.includes("approved")}export{M as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as s,b as o}from"./chunk-
|
|
1
|
+
import{a as s,b as o}from"./chunk-DPU7ZDOR.js";import{a as r}from"./chunk-SI3GYRHH.js";import{h as t}from"./chunk-NU7VF7MC.js";import{VersionedTransaction as u}from"@solana/web3.js";import a from"bs58";var g=class c extends s{constructor(n){super(n)}signMessage(){return t(this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for email signer"))})}signTransaction(n){return t(this,null,function*(){var i;yield this.handleAuthRequired();let d=this.getJwtOrThrow(),m=a.decode(n),y=u.deserialize(m).message.serialize();r.info("sign: sending request",{keyType:"ed25519"});let l=Date.now(),e=yield(i=this.config.clientTEEConnection)==null?void 0:i.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:d,apiKey:this.config.crossmint.apiKey},data:{keyType:"ed25519",bytes:a.encode(new Uint8Array(y)),encoding:"base58"}},options:o});if(r.info("sign: response received",{status:e==null?void 0:e.status,durationMs:Date.now()-l}),(e==null?void 0:e.status)==="error")throw new Error(e.error);if((e==null?void 0:e.signature)==null)throw new Error("Failed to sign transaction");return c.verifyPublicKeyFormat(e.publicKey),{signature:e.signature.bytes}})}static verifyPublicKeyFormat(n){if(n==null)throw new Error("No public key found");if(n.encoding!=="base58"||n.keyType!=="ed25519"||n.bytes==null)throw new Error("Not supported. Expected public key to be in base58 encoding and ed25519 key type. Got: "+JSON.stringify(n))}getChainKeyParams(){return{scheme:"ed25519",encoding:"base58"}}};export{g 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 _chunkLHAOCUXTcjs = require('./chunk-LHAOCUXT.cjs');var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkGSNFNRH2cjs = require('./chunk-GSNFNRH2.cjs');var _chunk3VYGTPRFcjs = require('./chunk-3VYGTPRF.cjs');var _chunkLHAOCUXTcjs = require('./chunk-LHAOCUXT.cjs');var _chunkQFZSILOIcjs = require('./chunk-QFZSILOI.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, _chunkLHAOCUXTcjs.n)("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){_chunkQFZSILOIcjs.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:_chunkQFZSILOIcjs.a,methodName:"deviceSignerKeyStorage.generateKey"})],c.prototype,"generateKey",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkQFZSILOIcjs.a,methodName:"deviceSignerKeyStorage.mapAddressToKey"})],c.prototype,"mapAddressToKey",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkQFZSILOIcjs.a,methodName:"deviceSignerKeyStorage.getKey"})],c.prototype,"getKey",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkQFZSILOIcjs.a,methodName:"deviceSignerKeyStorage.hasKey"})],c.prototype,"hasKey",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkQFZSILOIcjs.a,methodName:"deviceSignerKeyStorage.signMessage"})],c.prototype,"signMessage",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkQFZSILOIcjs.a,methodName:"deviceSignerKeyStorage.deleteKey"})],c.prototype,"deleteKey",1);exports.a = c;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk5GYNNLVWcjs = require('./chunk-5GYNNLVW.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:_chunk5GYNNLVWcjs.c,packageVersion:_chunk5GYNNLVWcjs.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 +1 @@
|
|
|
1
|
-
import{a as m}from"./chunk-
|
|
1
|
+
import{a as m}from"./chunk-5RW5KBQT.js";import{a as C}from"./chunk-OQZTL6ZG.js";import{a as u}from"./chunk-NU7VF7MC.js";function d(s,n){var e,l,r,i,a;let t=(e=s.chains)==null?void 0:e[n],o=m(n).balanceTokenFields(t);return u({symbol:(l=s.symbol)!=null?l:"",name:(r=s.name)!=null?r:"",amount:(i=s.amount)!=null?i:"0",decimals:s.decimals,rawAmount:(a=s.rawAmount)!=null?a:"0"},o)}function h(s,n){let t={symbol:s,name:s,amount:"0",decimals:0,rawAmount:"0"},o=m(n).emptyBalanceTokenFields();return u(u({},t),o)}function B(s,n,t){var r,i,a,f,p;if(n==null)return!0;let o=((r=s.symbol)!=null?r:"").toLowerCase();if(n.has(o))return!0;let e=(i=s.chains)==null?void 0:i[t];if(e==null)return!1;let l=C(t);if(l==="solana"&&"mintHash"in e){let c=(a=e.mintHash)==null?void 0:a.toLowerCase();return c!=null&&(n.has(c)||n.has(`solana:${c}`))}if(l==="stellar"&&"contractId"in e){let c=(f=e.contractId)==null?void 0:f.toLowerCase();return c!=null&&(n.has(c)||n.has(`stellar:${c}`))}if("contractAddress"in e){let c=(p=e.contractAddress)==null?void 0:p.toLowerCase();return c!=null&&(n.has(c)||n.has(`${t}:${c}`))}return!1}function g(s,n,t,o){let e=s.find(a=>a.symbol===t),l=s.find(a=>a.symbol==="usdc"),r=o!=null?new Set(o.map(a=>a.toLowerCase())):null,i=s.filter(a=>a.symbol!==t&&a.symbol!=="usdc"&&B(a,r,n));return{nativeToken:e!=null?d(e,n):h(t,n),usdc:l!=null?d(l,n):h("usdc",n),tokens:i.map(a=>d(a,n))}}export{g as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as A}from"./chunk-E2GL7NJM.js";import{a as R}from"./chunk-D5MVJQXK.js";import{f as m}from"./chunk-DCKFFFPG.js";import{b,c as x}from"./chunk-6HB4WO5J.js";import{a as w}from"./chunk-SI3GYRHH.js";import{d as r,e as o,f as s,h as p}from"./chunk-NU7VF7MC.js";var a,n,d,l,S,C,u,h,v,y,F=class{constructor(e){o(this,a);o(this,n);o(this,d);o(this,l);o(this,S);o(this,C);o(this,u);o(this,h);o(this,v);o(this,y);s(this,d,e.apiClient),s(this,l,e.options),s(this,S,e.chain),s(this,C,e.walletAddress),s(this,u,e.walletLocator),s(this,h,e.serverSignerResolver),s(this,n,e.recovery),s(this,v,e.initialSigners),s(this,y,e.signers),s(this,a,e.signer)}get activeSigner(){return r(this,a)}setActiveSigner(e){s(this,a,e)}get recovery(){return r(this,n)}descriptorContext(){var e,i,t,g,c;return{chain:r(this,S),walletAddress:r(this,C),crossmint:r(this,d).crossmint,clientTEEConnection:(e=r(this,l))==null?void 0:e.clientTEEConnection,resetSignerFrame:(i=r(this,l))==null?void 0:i.resetSignerFrame,onAuthRequired:(g=(t=r(this,l))==null?void 0:t.callbacks)==null?void 0:g.onAuthRequired,deviceSignerKeyStorage:(c=r(this,l))==null?void 0:c.deviceSignerKeyStorage,serverSigners:r(this,h)}}adoptRecoveryConfig(e){s(this,n,e)}stripSecretFromRecovery(){let e=r(this,h).resolvedRecoveryAddress;r(this,n)!=null&&r(this,n).type==="server"&&!m(r(this,n))&&e!=null&&s(this,n,{type:"server",address:e})}assemble(e,i){return p(this,null,function*(){var g,c;let t=R(r(this,S),e,(g=r(this,l))==null?void 0:g.deviceSignerKeyStorage);if(i!=null&&i.isAdminSigner)t.status="active";else{let f=yield this.getSignerState(t.locator());t.status=(c=f.signer)==null?void 0:c.status}return t})}require(){if(r(this,a)==null){if(r(this,v).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=A(r(this,n).type),i=e.signerUnavailableReason();throw i!=null?new Error(i):e.canAutoAssemble(r(this,n),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 r(this,a)}withRecoverySigner(e){return p(this,null,function*(){var f;let i=r(this,a);if(m(r(this,n))&&!r(this,h).hasRecoveryResolution)throw new Error('Cannot assemble server signer: no secret available. Call wallet.useSigner({ type: "server", secret: ... }) first with the recovery server secret.');let t=A(r(this,n).type),g=this.descriptorContext();if(r(this,n)!=null&&r(this,n).type==="external-wallet"&&!t.canAutoAssemble(r(this,n),g))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 c=t.buildInternalConfig(r(this,n),g);s(this,a,R(r(this,S),c,(f=r(this,l))==null?void 0:f.deviceSignerKeyStorage));try{return yield e()}finally{s(this,a,i)}})}getSignerState(e){return p(this,null,function*(){let i=null;try{i=yield r(this,d).getSigner(r(this,u).call(this),e)}catch(g){return w.warn("wallet.signers.getSignerState.fetchFailed",{signerLocator:e,error:g}),{response:null,signer:null,pendingOperation:null}}if(i==null||typeof i!="object"||"error"in i)return w.warn("wallet.signers.getSignerState.errorResponse",{signerLocator:e,response:i}),{response:null,signer:null,pendingOperation:null};let t=b(i,r(this,S));return{response:i,signer:t,pendingOperation:x(i,r(this,S))}})}signerIsRegistered(e){return p(this,null,function*(){return(yield r(this,y).call(this)).some(t=>t.locator===e)})}isSignerApproved(e){return p(this,null,function*(){var t;let i=yield this.getSignerState(e);return this.isApprovedSignerStatus((t=i.signer)==null?void 0:t.status)})}isApprovedSignerStatus(e){return e==="success"||e==="active"}};a=new WeakMap,n=new WeakMap,d=new WeakMap,l=new WeakMap,S=new WeakMap,C=new WeakMap,u=new WeakMap,h=new WeakMap,v=new WeakMap,y=new WeakMap;export{F as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as n,c as i}from"./chunk-
|
|
1
|
+
import{b as n,c as i}from"./chunk-TZR7N7VZ.js";import{SdkLogger as d,BrowserDatadogSink as k,detectPlatform as g,validateAPIKey as l,ServerDatadogSink as m}from"@crossmint/common-sdk-base";var t=new d;function f(s){let o=g(),e=l(s);if(!e.isValid)throw new Error(`Invalid API key: ${e.message}`);let{environment:a,projectId:c}=e;switch(t.init({packageName:i,packageVersion:n,environment:a,projectId:c,platform:o}),o){case"browser":{let r=new k(a);t.addSink(r);break}case"react-native":break;case"server":{let r=new m(a);t.addSink(r);break}default:break}}export{t as a,f as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk3VKLU6RHcjs = require('./chunk-3VKLU6RH.cjs');var _chunkLHAOCUXTcjs = require('./chunk-LHAOCUXT.cjs');var _chunkQFZSILOIcjs = require('./chunk-QFZSILOI.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var m=409,l=class l extends _chunk3VKLU6RHcjs.a{constructor(e){super({chain:e.chain,address:e.address,owner:e.owner,options:_chunk3VKLU6RHcjs.a.getOptions(e),alias:e.alias,recovery:_chunk3VKLU6RHcjs.a.getRecovery(e),apiRecoveryServerSignerAddress:_chunk3VKLU6RHcjs.a.getApiRecoveryServerSignerAddress(e),apiDelegatedServerSignerAddresses:_chunk3VKLU6RHcjs.a.getApiDelegatedServerSignerAddresses(e),signer:e.signer,signers:_chunk3VKLU6RHcjs.a.getInitialSigners(e)},_chunk3VKLU6RHcjs.a.getApiClient(e))}static from(e){if(!_commonsdkbase.isValidStellarAddress.call(void 0, e.address))throw new Error("Wallet is not a Stellar wallet");return new l(e)}sendTransaction(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var d;_chunkQFZSILOIcjs.a.info("stellarWallet.sendTransaction.start"),yield this.preAuthIfNeeded();let r=yield this.createTransaction(e);if((d=e.options)!=null&&d.prepareOnly)return _chunkQFZSILOIcjs.a.info("stellarWallet.sendTransaction.prepared",{transactionId:r.id}),{hash:void 0,explorerLink:void 0,transactionId:r.id};let a={},n=yield this.approveTransactionAndWait(r.id,a);return _chunkQFZSILOIcjs.a.info("stellarWallet.sendTransaction.success",{transactionId:r.id,hash:n.hash}),n})}upgrade(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){_chunkQFZSILOIcjs.a.info("stellarWallet.upgrade.start"),yield this.preAuthIfNeeded();let r=yield this.createWalletLifecycleTransaction("upgrade-wallet",e);if(r!=null){if(e!=null&&e.prepareOnly)return _chunkQFZSILOIcjs.a.info("stellarWallet.upgrade.prepared",{transactionId:r}),{hash:void 0,explorerLink:void 0,transactionId:r};yield this.approveTransactionAndWait(r),_chunkQFZSILOIcjs.a.info("stellarWallet.upgrade.phase1.success",{transactionId:r})}else _chunkQFZSILOIcjs.a.info("stellarWallet.upgrade.phase1.skipped",{reason:"wallet already locked from a prior upgrade"});let a=yield this.migrateInternal({signer:e==null?void 0:e.signer,prepareOnly:e==null?void 0:e.prepareOnly});return _chunkQFZSILOIcjs.a.info("stellarWallet.upgrade.success",{transactionId:a.transactionId,hash:a.hash}),a})}migrate(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return yield this.preAuthIfNeeded(),yield this.migrateInternal(e)})}migrateInternal(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){_chunkQFZSILOIcjs.a.info("stellarWallet.migrate.start");let r=yield this.createWalletLifecycleTransaction("migrate-wallet",e);if(r==null)throw new (0, _chunkLHAOCUXTcjs.y)("Failed to create migrate-wallet transaction");if(e!=null&&e.prepareOnly)return _chunkQFZSILOIcjs.a.info("stellarWallet.migrate.prepared",{transactionId:r}),{hash:void 0,explorerLink:void 0,transactionId:r};let a=yield this.approveTransactionAndWait(r);return _chunkQFZSILOIcjs.a.info("stellarWallet.migrate.success",{transactionId:r,hash:a.hash}),a})}createTransaction(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let{contractId:r,options:a}=e,n=this.resolveStellarSigner(a==null?void 0:a.signer),d="transaction"in e?{type:"serialized-transaction",serializedTransaction:e.transaction,contractId:r}:{type:"contract-call",contractId:r,method:e.method,memo:e.memo!=null?{type:"text",value:e.memo}:void 0,args:e.args},p=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:d,signer:n}});if("error"in p)throw new (0, _chunkLHAOCUXTcjs.y)(JSON.stringify(p));return p})}createWalletLifecycleTransaction(e,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let a=(r==null?void 0:r.signer)!=null?this.resolveStellarSigner(r.signer):void 0,n=yield this.apiClient.createTransaction(this.walletLocator,{params:_chunkDSIFRRBScjs.a.call(void 0, {transaction:{type:e}},a!=null?{signer:a}:{})});if("error"in n){if(e==="upgrade-wallet"&&y(n))return null;throw new (0, _chunkLHAOCUXTcjs.y)(JSON.stringify(n))}return n.id})}resolveStellarSigner(e){return e==null?this.signerManager.require().locator():typeof e=="string"?e:this.resolveServerSignerApiLocator(e)}};_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkQFZSILOIcjs.a,methodName:"stellarWallet.sendTransaction",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"sendTransaction",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkQFZSILOIcjs.a,methodName:"stellarWallet.upgrade",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"upgrade",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkQFZSILOIcjs.a,methodName:"stellarWallet.migrate",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"migrate",1);var h=l;function y(o){return typeof o=="object"&&o!==null&&"statusCode"in o&&o.statusCode===m}exports.a = h;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as x,B as A,C as y,D as k,H as w,r as M,u as m,w as b,z as C}from"./chunk-SLPKMZNW.js";import{a as E}from"./chunk-
|
|
1
|
+
import{A as x,B as A,C as y,D as k,H as w,r as M,u as m,w as b,z as C}from"./chunk-SLPKMZNW.js";import{a as E}from"./chunk-SI3GYRHH.js";import{d as S}from"./chunk-TZR7N7VZ.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
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk3VKLU6RHcjs = require('./chunk-3VKLU6RH.cjs');var _chunkWKHVIEB2cjs = require('./chunk-WKHVIEB2.cjs');var _chunkLHAOCUXTcjs = require('./chunk-LHAOCUXT.cjs');var _chunkQFZSILOIcjs = require('./chunk-QFZSILOI.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');var _viem = require('viem');var _commonsdkbase = require('@crossmint/common-sdk-base');var c=class c extends _chunk3VKLU6RHcjs.a{constructor(e){super({chain:e.chain,address:e.address,owner:e.owner,options:_chunk3VKLU6RHcjs.a.getOptions(e),alias:e.alias,recovery:_chunk3VKLU6RHcjs.a.getRecovery(e),apiRecoveryServerSignerAddress:_chunk3VKLU6RHcjs.a.getApiRecoveryServerSignerAddress(e),apiDelegatedServerSignerAddresses:_chunk3VKLU6RHcjs.a.getApiDelegatedServerSignerAddresses(e),signer:e.signer,signers:_chunk3VKLU6RHcjs.a.getInitialSigners(e)},_chunk3VKLU6RHcjs.a.getApiClient(e))}static from(e){if(!_commonsdkbase.isValidEvmAddress.call(void 0, e.address))throw new Error("Wallet is not an EVM wallet");return new c(e)}sendTransaction(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var i;_chunkQFZSILOIcjs.a.info("evmWallet.sendTransaction.start"),yield this.preAuthIfNeeded();let t=this.buildTransaction(e),r=yield this.createTransaction(t,e.options);if((i=e.options)!=null&&i.prepareOnly)return _chunkQFZSILOIcjs.a.info("evmWallet.sendTransaction.prepared",{transactionId:r.id}),{hash:void 0,explorerLink:void 0,transactionId:r.id};let a=yield this.approveTransactionAndWait(r.id);return _chunkQFZSILOIcjs.a.info("evmWallet.sendTransaction.success",{transactionId:r.id,hash:a.hash}),a})}signMessage(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var i;_chunkQFZSILOIcjs.a.info("evmWallet.signMessage.start"),yield this.preAuthIfNeeded();let t=this.signerManager.require(),r=yield this.apiClient.createSignature(this.walletLocator,{type:"message",params:{message:e.message,signer:t.locator(),chain:this.chain}});if("error"in r)throw _chunkQFZSILOIcjs.a.error("evmWallet.signMessage.error",{error:r}),new (0, _chunkLHAOCUXTcjs.t)(JSON.stringify(r));if((i=e.options)!=null&&i.prepareOnly)return _chunkQFZSILOIcjs.a.info("evmWallet.signMessage.prepared",{signatureId:r.id}),{signature:void 0,signatureId:r.id};let a=yield this.approveSignatureAndWait(r.id);return _chunkQFZSILOIcjs.a.info("evmWallet.signMessage.success",{signatureId:r.id}),a})}signTypedData(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var C;_chunkQFZSILOIcjs.a.info("evmWallet.signTypedData.start"),yield this.preAuthIfNeeded();let t=this.signerManager.require(),{domain:r,message:a,primaryType:i,types:g,chain:T}=e;if(!r||!a||!g||!T)throw _chunkQFZSILOIcjs.a.error("evmWallet.signTypedData.error",{error:"Invalid typed data"}),new (0, _chunkLHAOCUXTcjs.p)("Invalid typed data");let{name:m,version:v,chainId:S,verifyingContract:I,salt:b}=r;if(!m||!v||!S||!I)throw _chunkQFZSILOIcjs.a.error("evmWallet.signTypedData.error",{error:"Invalid typed data domain"}),new (0, _chunkLHAOCUXTcjs.p)("Invalid typed data domain");let d=yield this.apiClient.createSignature(this.walletLocator,{type:"typed-data",params:{typedData:{domain:{name:m,version:v,chainId:Number(S),verifyingContract:I,salt:b},message:y(a),primaryType:i,types:g},signer:t.locator(),chain:T}});if("error"in d)throw _chunkQFZSILOIcjs.a.error("evmWallet.signTypedData.error",{error:d}),new (0, _chunkLHAOCUXTcjs.t)(JSON.stringify(d));if((C=e.options)!=null&&C.prepareOnly)return _chunkQFZSILOIcjs.a.info("evmWallet.signTypedData.prepared",{signatureId:d.id}),{signature:void 0,signatureId:d.id};let D=yield this.approveSignatureAndWait(d.id);return _chunkQFZSILOIcjs.a.info("evmWallet.signTypedData.success",{signatureId:d.id}),D})}getViemClient(e){var t;return _viem.createPublicClient.call(void 0, {transport:(t=e==null?void 0:e.transport)!=null?t:_viem.http.call(void 0, ),chain:_chunkWKHVIEB2cjs.a.call(void 0, this.chain)})}createTransaction(e,t){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let r;(t==null?void 0:t.signer)==null?r=this.signerManager.require().locator():typeof t.signer=="string"?r=t.signer:r=this.resolveServerSignerApiLocator(t.signer);let a=yield this.apiClient.createTransaction(this.walletLocator,{params:{signer:r,chain:this.chain,calls:[e]}});if("error"in a)throw new (0, _chunkLHAOCUXTcjs.y)(JSON.stringify(a));return a})}buildTransaction(e){var t,r,a,i,g;if("transaction"in e)return{transaction:e.transaction};if(e.abi==null)return{to:e.to,value:(r=(t=e.value)==null?void 0:t.toString())!=null?r:"0",data:(a=e.data)!=null?a:"0x"};if(!e.functionName)throw new Error("Function name is required");return{to:e.to,value:(g=(i=e.value)==null?void 0:i.toString())!=null?g:"0",data:_viem.encodeFunctionData.call(void 0, {abi:e.abi,functionName:e.functionName,args:e.args})}}};_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkQFZSILOIcjs.a,methodName:"evmWallet.sendTransaction",buildContext(e){return{chain:e.chain,address:e.address}}})],c.prototype,"sendTransaction",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkQFZSILOIcjs.a,methodName:"evmWallet.signMessage",buildContext(e){return{chain:e.chain,address:e.address}}})],c.prototype,"signMessage",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkQFZSILOIcjs.a,methodName:"evmWallet.signTypedData",buildContext(e){return{chain:e.chain,address:e.address}}})],c.prototype,"signTypedData",1);var M=c;function y(s){return typeof s=="bigint"?s.toString():Array.isArray(s)?s.map(y):s!==null&&typeof s=="object"?Object.fromEntries(Object.entries(s).map(([e,t])=>[e,y(t)])):s}exports.a = M;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as r}from"./chunk-
|
|
1
|
+
import{a as r}from"./chunk-3MF3O7DM.js";import{a as h}from"./chunk-SRN6KQRK.js";import{y as S}from"./chunk-SLPKMZNW.js";import{a as t}from"./chunk-SI3GYRHH.js";import{c as u,h as c}from"./chunk-NU7VF7MC.js";import T from"bs58";import{isValidSolanaAddress as y,WithLoggerContext as m}from"@crossmint/common-sdk-base";var o=class o extends r{constructor(e){super({chain:e.chain,address:e.address,owner:e.owner,options:r.getOptions(e),alias:e.alias,recovery:r.getRecovery(e),apiRecoveryServerSignerAddress:r.getApiRecoveryServerSignerAddress(e),apiDelegatedServerSignerAddresses:r.getApiDelegatedServerSignerAddresses(e),signer:e.signer,signers:r.getInitialSigners(e)},r.getApiClient(e))}static from(e){if(!y(e.address))throw new Error("Wallet is not a Solana wallet");return new o(e)}sendTransaction(e){return c(this,null,function*(){var l,p;t.info("solanaWallet.sendTransaction.start"),yield this.preAuthIfNeeded();let n=yield this.createTransaction(e);if((l=e.options)!=null&&l.prepareOnly)return t.info("solanaWallet.sendTransaction.prepared",{transactionId:n.id}),{hash:void 0,explorerLink:void 0,transactionId:n.id};let i={additionalSigners:(p=e.additionalSigners)==null?void 0:p.map(d=>new h({type:"external-wallet",address:d.publicKey.toString(),locator:`external-wallet:${d.publicKey.toString()}`,onSign:g=>(g.sign([d]),Promise.resolve(g))}))},a=yield this.approveTransactionAndWait(n.id,i);return t.info("solanaWallet.sendTransaction.success",{transactionId:n.id,hash:a.hash}),a})}createTransaction(e){return c(this,null,function*(){var a;let n;((a=e.options)==null?void 0:a.signer)==null?n=this.signerManager.require().locator():typeof e.options.signer=="string"?n=e.options.signer:n=this.resolveServerSignerApiLocator(e.options.signer);let s;"serializedTransaction"in e?s=e.serializedTransaction:s=T.encode(e.transaction.serialize());let i=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:s,signer:n}});if("error"in i)throw new S(JSON.stringify(i));return i})}};u([m({logger:t,methodName:"solanaWallet.sendTransaction",buildContext(e){return{chain:e.chain,address:e.address}}})],o.prototype,"sendTransaction",1);var f=o;export{f as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var s="@crossmint/wallets-sdk",t="1.10.0";var c="WALLETS_SDK",r=t,a=s,d=200;export{c as a,r as b,a as c,d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkQFZSILOIcjs = require('./chunk-QFZSILOI.cjs');var o={nativeToken:"sol",walletLocatorPrefix:"me:solana:smart",supportsSignatures:!1,addSignerChain(n){},extractAddSignerOperation(n,r,a){if(!("transaction"in n)||n.transaction==null)throw _chunkQFZSILOIcjs.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&&"mintHash"in n?{mintHash:n.mintHash}:n!=null&&"contractAddress"in n?{contractAddress:n.contractAddress}:{}},emptyBalanceTokenFields(){return{mintHash:void 0}}};exports.a = o;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkLHAOCUXTcjs = require('./chunk-LHAOCUXT.cjs');var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkLHAOCUXTcjs = require('./chunk-LHAOCUXT.cjs');var _chunkQFZSILOIcjs = require('./chunk-QFZSILOI.cjs');var _chunk5GYNNLVWcjs = require('./chunk-5GYNNLVW.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');function R(i,o,a,r){return _chunkDSIFRRBScjs.h.call(void 0, 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:{};_chunkQFZSILOIcjs.a.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 (0, _chunkLHAOCUXTcjs.A)("Transaction confirmation timeout");let s=Date.now();if(t=yield i.getTransaction(o,a),t.error)throw _chunkLHAOCUXTcjs.H.call(void 0, t),new (0, _chunkLHAOCUXTcjs.z)(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 (0, _chunkLHAOCUXTcjs.B)(`Transaction sending failed: ${JSON.stringify(t)}`);if(t.status==="awaiting-approval")throw new (0, _chunkLHAOCUXTcjs.C)("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 (0, _chunkLHAOCUXTcjs.D)("Transaction hash not found on transaction response");return{hash:g,explorerLink:(d=t.onChain.explorerLink)!=null?d:"",transactionId:t.id}})}function W(i,o,a,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let{timeoutMs:e=6e4}=r!=null?r:{},u=Date.now(),n=null;do{if(Date.now()-u>e)throw new (0, _chunkLHAOCUXTcjs.w)("Signature confirmation timeout");if(yield new Promise(f=>setTimeout(f,_chunk5GYNNLVWcjs.d)),n=yield i.getSignature(o,a),"error"in n)throw _chunkLHAOCUXTcjs.H.call(void 0, n),new (0, _chunkLHAOCUXTcjs.u)(JSON.stringify(n))}while(n===null||n.status==="pending");if(n.status==="failed")throw new (0, _chunkLHAOCUXTcjs.r)("Signature signing failed");if(!n.outputSignature)throw new (0, _chunkLHAOCUXTcjs.u)("Signature not available");return{signature:n.outputSignature,signatureId:a}})}function D(i){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return new Promise(o=>setTimeout(o,i))})}exports.a = R; exports.b = W;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkQFZSILOIcjs = require('./chunk-QFZSILOI.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 _chunkQFZSILOIcjs.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 D}from"./chunk-
|
|
1
|
+
import{a as D}from"./chunk-3MF3O7DM.js";import{a as E}from"./chunk-5LNDUSMZ.js";import{a as k}from"./chunk-PJKTUGX2.js";import{b as A,c as P}from"./chunk-EZ6E5QGL.js";import{b as W,c as x}from"./chunk-TSJUK3ED.js";import{f as w}from"./chunk-KRBTB7ZD.js";import{e as F,g,l as b}from"./chunk-SLPKMZNW.js";import{a as d}from"./chunk-SI3GYRHH.js";import{a as f,b as v,c as S,h as C}from"./chunk-NU7VF7MC.js";import{WithLoggerContext as T}from"@crossmint/common-sdk-base";import{WebAuthnP256 as I}from"ox";var $="When 'signers' is provided to a method that may fetch an existing wallet, each specified signer must exist in that wallet's configuration.",u=class{constructor(e){this.apiClient=e}getWallet(e,t){return C(this,null,function*(){let r,i;if(typeof e=="string"){if(!this.apiClient.isServerSide)throw new g("getWallet with walletLocator is only available on the server side. Use getWallet(args) instead.");if(t==null)throw new g("Wallet configuration is required when using walletLocator: https://docs.crossmint.com/sdk-reference/wallets/type-aliases/WalletArgsFor");r=e,i=t}else{if(this.apiClient.isServerSide)throw new g("getWallet on server side requires a walletLocator parameter. Use getWallet(walletLocator, args) instead.");i=e,r=this.getWalletLocator(i)}let n=v(f({},i),{chain:w(i.chain,this.apiClient.environment)});d.info("walletFactory.getWallet.start");let a=yield this.apiClient.getWallet(r);if("error"in a)throw d.warn("walletFactory.getWallet.notFound",{error:a.error}),new F(JSON.stringify(a));return d.info("walletFactory.getWallet.success",{address:a.address}),yield this.createWalletInstance(a,n)})}createWallet(e){return C(this,null,function*(){var o,c,p,h,y,R;let t=v(f({},e),{chain:w(e.chain,this.apiClient.environment)});if(yield(p=(c=(o=t.options)==null?void 0:o.callbacks)==null?void 0:c.onWalletCreationStart)==null?void 0:p.call(c),d.info("walletFactory.createWallet.start"),!this.apiClient.isServerSide&&t.owner!=null)throw d.error("walletFactory.createWallet.error",{error:"Owner field cannot be specified in client-side createWallet calls"}),new g("Owner field cannot be specified in client-side createWallet calls. Owner is determined from JWT authentication.");let r=(h=t.signers)!=null?h:[],i=((y=t.options)==null?void 0:y.deviceSignerKeyStorage)!=null&&!r.some(m=>m.type==="device"),n=i?[...r,{type:"device"}]:r,a=yield this.registerSigners(n,t.chain,(R=t.options)==null?void 0:R.deviceSignerKeyStorage),s;if(t.recovery.type==="passkey"&&t.recovery.id==null)s=yield this.createPasskeySigner(t.recovery);else if(t.recovery.type==="server"){let{derivedAddress:m}=W(t.recovery,t.chain,this.apiClient.projectId,this.apiClient.environment);s={type:"server",address:m}}else s=t.recovery;let l=yield this.createSmartWallet(t,s,a,i);if("error"in l)throw d.error("walletFactory.createWallet.error",{error:l.error}),new g(JSON.stringify(l));return d.info("walletFactory.createWallet.success",{address:l.address}),yield this.createWalletInstance(l,t)})}createSmartWallet(e,t,r,i){return C(this,null,function*(){let n=o=>{var c,p;return{type:"smart",chainType:this.getChainType(e.chain),config:f(f({adminSigner:t},e.plugins?{plugins:e.plugins}:{}),o!=null?{delegatedSigners:o}:{}),owner:(c=e.owner)!=null?c:void 0,alias:(p=e.alias)!=null?p:void 0}},a=yield this.apiClient.createWallet(n(r));if(!(i&&"error"in a&&a.code===b))return a;d.info("walletFactory.createWallet.deviceSignerUnsupported.retryWithoutDeviceSigner",{chain:e.chain});let l=r.filter(o=>!this.isBuiltDeviceSigner(o));return yield this.apiClient.createWallet(n(l))})}isBuiltDeviceSigner(e){let t=e.signer;return typeof t=="object"&&t!=null&&t.type==="device"}createWalletInstance(e,t){return C(this,null,function*(){var p,h;this.validateExistingWalletConfig(e,t);let r=t,i=e.config.adminSigner,n=((p=r.recovery)==null?void 0:p.type)==="server"||((h=r.recovery)==null?void 0:h.type)==="external-wallet"?r.recovery:i,a=e.config.delegatedSigners,s=a;s!=null&&s.length===1&&(s[0].type==="server"||s[0].type==="external-wallet")&&(s=r.signers);let l=i.type==="server"&&"address"in i&&!("secret"in i)?i.address:void 0,o=(a!=null?a:[]).filter(y=>y.type==="server"&&"address"in y&&!("secret"in y)).map(y=>y.address),c=new D({chain:t.chain,address:e.address,owner:e.owner,options:t.options,alias:t.alias,recovery:n,apiRecoveryServerSignerAddress:l,apiDelegatedServerSignerAddresses:o,signers:s!=null?s:[]},this.apiClient);return yield c.waitForInit(),c})}getWalletLocator(e){return`me:${this.getChainType(e.chain)}:smart`+(e.alias!=null?`:alias:${e.alias}`:"")}createPasskeySigner(e){return C(this,null,function*(){var i;if(e.type!=="passkey")throw new Error("Signer is not a passkey");let t=(i=e.name)!=null?i:`Crossmint Wallet ${Date.now()}`,r=e.onCreatePasskey?yield e.onCreatePasskey(t):yield I.createCredential({name:t});return{type:"passkey",id:r.id,name:t,publicKey:{x:r.publicKey.x.toString(),y:r.publicKey.y.toString()}}})}validateExistingWalletConfig(e,t){if(t.owner!=null&&e.owner!=null&&A(t.owner)!==A(e.owner))throw new g("Wallet owner does not match existing wallet's linked user");if(t.chain==="solana"&&e.chainType!=="solana"||t.chain!=="solana"&&e.chainType==="solana"||t.chain==="stellar"&&e.chainType!=="stellar"||t.chain!=="stellar"&&e.chainType==="stellar")throw new g(`Wallet chain does not match existing wallet's chain. You must use chain: ${e.chainType}.`);if(e.type!=="smart")return;let r=t;if(r.recovery!=null||r.signers!=null){let i=e.config,n=i==null?void 0:i.adminSigner;if(r.recovery!=null&&n!=null){if(r.recovery.type!==n.type)throw new g("The wallet recovery signer type does not match the existing wallet's recovery signer type");P(r.recovery,n)}let a=r.signers;a!=null&&this.validateSigners(e,a,t.chain)}}validateSigners(e,t,r){let i=e.config,n=i==null?void 0:i.delegatedSigners;if(t.length!==0){if(n==null||n.length===0)throw new g(`${t.length} signer(s) specified, but wallet "${e.address}" has no signers. ${$}`);for(let a of t){let s=n.find(l=>{if(this.isMatchingPasskeySigner(a,l,i)||l.type==="device"&&a.type==="device")return!0;if(a.type==="server"){let{primary:o,legacy:c}=x(a,r,this.apiClient.projectId,this.apiClient.environment);return l.locator===`server:${o.derivedAddress}`||c!=null&&l.locator===`server:${c.derivedAddress}`}return l.locator===k(a)});if(s==null){let l=n.map(o=>o.locator).join(", ");throw new g(`Signer '${a.type}' does not exist in wallet "${e.address}". Available signers: ${l}. ${$}`)}P(a,s)}}}isMatchingPasskeySigner(e,t,r){var n,a;let i=((a=(n=r.delegatedSigners)==null?void 0:n.filter(s=>s.type==="passkey").length)!=null?a:0)+(r.adminSigner.type==="passkey"?1:0);if(e.type==="passkey"){if(e.id==null&&i===1)return t.type==="passkey";if(e.id==null&&i>1)throw new g("When creating a wallet with multiple passkeys, you must provide the passkey ID for each passkey.")}return!1}registerSigners(e,t,r){return C(this,null,function*(){var i;return yield Promise.all((i=e==null?void 0:e.map(n=>C(this,null,function*(){if(n.type==="passkey")return n.id==null?{signer:yield this.createPasskeySigner(n)}:{signer:n};if(n.type==="device"){if(n.publicKey!=null)return{signer:{type:"device",publicKey:n.publicKey,name:n.name}};if(n.locator!=null)return{signer:n.locator};if(r==null)throw new g("Device signer key storage is required for device signers");let a=yield E(r);return{signer:{type:"device",publicKey:a.publicKey,name:a.name}}}if(n.type==="server"&&t!=null){let{derivedAddress:a}=W(n,t,this.apiClient.projectId,this.apiClient.environment);return{signer:`server:${a}`}}return{signer:k(n)}})))!=null?i:[])})}getChainType(e){return e==="solana"?"solana":e==="stellar"?"stellar":"evm"}};S([T({logger:d,methodName:"walletFactory.getWallet",buildContext(e,t){if(typeof t[0]=="string"){let i=t[1];return{walletLocator:t[0],chain:i==null?void 0:i.chain}}let r=t[0];return{chain:r==null?void 0:r.chain}}})],u.prototype,"getWallet",1),S([T({logger:d,methodName:"walletFactory.createWallet",buildContext(e,t){return{chain:t[0].chain}}})],u.prototype,"createWallet",1);export{u as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkKICS3RGFcjs = require('./chunk-KICS3RGF.cjs');var _chunkUWQ6UZGEcjs = require('./chunk-UWQ6UZGE.cjs');var _chunkVGDORB2Lcjs = require('./chunk-VGDORB2L.cjs');var _chunkENU3EKBGcjs = require('./chunk-ENU3EKBG.cjs');var i={evm:_chunkKICS3RGFcjs.a,solana:_chunkUWQ6UZGEcjs.a,stellar:_chunkVGDORB2Lcjs.a};function h(e){return i[_chunkENU3EKBGcjs.a.call(void 0, e)]}function g(e){return Object.prototype.hasOwnProperty.call(i,e)}exports.a = h; exports.b = g;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk5X4EOJFGcjs = require('./chunk-5X4EOJFG.cjs');var _chunkHRUMWG2Fcjs = require('./chunk-HRUMWG2F.cjs');var _chunkIR5WN6FQcjs = require('./chunk-IR5WN6FQ.cjs');var _chunkGEY574THcjs = require('./chunk-GEY574TH.cjs');var _chunkUE3WVHTMcjs = require('./chunk-UE3WVHTM.cjs');var _chunkLHAOCUXTcjs = require('./chunk-LHAOCUXT.cjs');var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk5X4EOJFGcjs = require('./chunk-5X4EOJFG.cjs');var _chunkHRUMWG2Fcjs = require('./chunk-HRUMWG2F.cjs');var _chunkIR5WN6FQcjs = require('./chunk-IR5WN6FQ.cjs');var _chunkGEY574THcjs = require('./chunk-GEY574TH.cjs');var _chunkUE3WVHTMcjs = require('./chunk-UE3WVHTM.cjs');var _chunkLHAOCUXTcjs = require('./chunk-LHAOCUXT.cjs');var _chunkQFZSILOIcjs = require('./chunk-QFZSILOI.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var _chains = require('viem/chains');var w=[_commonsdkbase.BlockchainIncludingTestnet.ABSTRACT_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.ARBITRUM_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.BASE_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.CURTIS,_commonsdkbase.BlockchainIncludingTestnet.ETHEREUM_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.FLOW_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.MANTLE_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.MODE_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.OPTIMISM_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.PLUME_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.POLYGON_AMOY,_commonsdkbase.BlockchainIncludingTestnet.SCROLL_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.SEI_ATLANTIC_2_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.STORY_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.WORLD_CHAIN_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.ZORA_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.ARC_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.TEMPO_TESTNET],D=[_commonsdkbase.BlockchainIncludingTestnet.ABSTRACT,_commonsdkbase.BlockchainIncludingTestnet.APECHAIN,_commonsdkbase.BlockchainIncludingTestnet.ARBITRUM,_commonsdkbase.BlockchainIncludingTestnet.ARBITRUMNOVA,_commonsdkbase.BlockchainIncludingTestnet.BASE,_commonsdkbase.BlockchainIncludingTestnet.BSC,_commonsdkbase.BlockchainIncludingTestnet.ETHEREUM,_commonsdkbase.BlockchainIncludingTestnet.FLOW,_commonsdkbase.BlockchainIncludingTestnet.MANTLE,_commonsdkbase.BlockchainIncludingTestnet.MODE,_commonsdkbase.BlockchainIncludingTestnet.OPTIMISM,_commonsdkbase.BlockchainIncludingTestnet.PLUME,_commonsdkbase.BlockchainIncludingTestnet.POLYGON,_commonsdkbase.BlockchainIncludingTestnet.SCROLL,_commonsdkbase.BlockchainIncludingTestnet.SEI_PACIFIC_1,_commonsdkbase.BlockchainIncludingTestnet.SHAPE,_commonsdkbase.BlockchainIncludingTestnet.STORY,_commonsdkbase.BlockchainIncludingTestnet.TEMPO,_commonsdkbase.BlockchainIncludingTestnet.WORLDCHAIN,_commonsdkbase.BlockchainIncludingTestnet.ZORA];function X(t){switch(t){case _commonsdkbase.BlockchainIncludingTestnet.BASE_SEPOLIA:return _chains.baseSepolia;case _commonsdkbase.BlockchainIncludingTestnet.BASE:return _chains.base;case _commonsdkbase.BlockchainIncludingTestnet.POLYGON_AMOY:return _chains.polygonAmoy;case _commonsdkbase.BlockchainIncludingTestnet.POLYGON:return _chains.polygon;case _commonsdkbase.BlockchainIncludingTestnet.OPTIMISM_SEPOLIA:return _chains.optimismSepolia;case _commonsdkbase.BlockchainIncludingTestnet.OPTIMISM:return _chains.optimism;case _commonsdkbase.BlockchainIncludingTestnet.ARBITRUM_SEPOLIA:return _chains.arbitrumSepolia;case _commonsdkbase.BlockchainIncludingTestnet.ARBITRUM:return _chains.arbitrum;case _commonsdkbase.BlockchainIncludingTestnet.ARBITRUMNOVA:return _chains.arbitrumNova;case _commonsdkbase.BlockchainIncludingTestnet.STORY_TESTNET:return _chunkGEY574THcjs.a;case _commonsdkbase.BlockchainIncludingTestnet.STORY:return _chunkIR5WN6FQcjs.a;case _commonsdkbase.BlockchainIncludingTestnet.MODE_SEPOLIA:return _chains.modeTestnet;case _commonsdkbase.BlockchainIncludingTestnet.MODE:return _chains.mode;case _commonsdkbase.BlockchainIncludingTestnet.BSC:return _chains.bsc;case _commonsdkbase.BlockchainIncludingTestnet.SHAPE:return _chains.shape;case _commonsdkbase.BlockchainIncludingTestnet.ZORA:return _chains.zora;case _commonsdkbase.BlockchainIncludingTestnet.ZORA_SEPOLIA:return _chains.zoraSepolia;case _commonsdkbase.BlockchainIncludingTestnet.ETHEREUM_SEPOLIA:return _chains.sepolia;case _commonsdkbase.BlockchainIncludingTestnet.ETHEREUM:return _chains.mainnet;case _commonsdkbase.BlockchainIncludingTestnet.FLOW:return _chains.flowMainnet;case _commonsdkbase.BlockchainIncludingTestnet.FLOW_TESTNET:return _chains.flowTestnet;case _commonsdkbase.BlockchainIncludingTestnet.PLUME_TESTNET:return _chains.plumeTestnet;case _commonsdkbase.BlockchainIncludingTestnet.PLUME:return _chains.plume;case _commonsdkbase.BlockchainIncludingTestnet.ARC_TESTNET:return _chunkHRUMWG2Fcjs.a;case _commonsdkbase.BlockchainIncludingTestnet.TEMPO:return _chunkUE3WVHTMcjs.a;case _commonsdkbase.BlockchainIncludingTestnet.TEMPO_TESTNET:return _chunk5X4EOJFGcjs.a;case _commonsdkbase.BlockchainIncludingTestnet.ABSTRACT:case _commonsdkbase.BlockchainIncludingTestnet.ABSTRACT_TESTNET:case _commonsdkbase.BlockchainIncludingTestnet.APECHAIN:case _commonsdkbase.BlockchainIncludingTestnet.MANTLE:case _commonsdkbase.BlockchainIncludingTestnet.MANTLE_SEPOLIA:case _commonsdkbase.BlockchainIncludingTestnet.SCROLL:case _commonsdkbase.BlockchainIncludingTestnet.SCROLL_SEPOLIA:case _commonsdkbase.BlockchainIncludingTestnet.SEI_PACIFIC_1:case _commonsdkbase.BlockchainIncludingTestnet.SEI_ATLANTIC_2_TESTNET:case _commonsdkbase.BlockchainIncludingTestnet.CURTIS:case _commonsdkbase.BlockchainIncludingTestnet.WORLDCHAIN:case _commonsdkbase.BlockchainIncludingTestnet.WORLD_CHAIN_SEPOLIA:throw new Error(`Chain ${t} is not yet supported in toViemChain function. Please add the appropriate viem chain definition.`);default:throw new Error(`Unknown chain: ${t}`)}}function I(t){return w.includes(t)}function C(t){return D.includes(t)}var Y={[_commonsdkbase.BlockchainIncludingTestnet.ABSTRACT]:_commonsdkbase.BlockchainIncludingTestnet.ABSTRACT_TESTNET,[_commonsdkbase.BlockchainIncludingTestnet.APECHAIN]:_commonsdkbase.BlockchainIncludingTestnet.CURTIS,[_commonsdkbase.BlockchainIncludingTestnet.ARBITRUM]:_commonsdkbase.BlockchainIncludingTestnet.ARBITRUM_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.BASE]:_commonsdkbase.BlockchainIncludingTestnet.BASE_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.ETHEREUM]:_commonsdkbase.BlockchainIncludingTestnet.ETHEREUM_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.FLOW]:_commonsdkbase.BlockchainIncludingTestnet.FLOW_TESTNET,[_commonsdkbase.BlockchainIncludingTestnet.MANTLE]:_commonsdkbase.BlockchainIncludingTestnet.MANTLE_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.MODE]:_commonsdkbase.BlockchainIncludingTestnet.MODE_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.OPTIMISM]:_commonsdkbase.BlockchainIncludingTestnet.OPTIMISM_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.PLUME]:_commonsdkbase.BlockchainIncludingTestnet.PLUME_TESTNET,[_commonsdkbase.BlockchainIncludingTestnet.POLYGON]:_commonsdkbase.BlockchainIncludingTestnet.POLYGON_AMOY,[_commonsdkbase.BlockchainIncludingTestnet.SCROLL]:_commonsdkbase.BlockchainIncludingTestnet.SCROLL_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.SEI_PACIFIC_1]:_commonsdkbase.BlockchainIncludingTestnet.SEI_ATLANTIC_2_TESTNET,[_commonsdkbase.BlockchainIncludingTestnet.STORY]:_commonsdkbase.BlockchainIncludingTestnet.STORY_TESTNET,[_commonsdkbase.BlockchainIncludingTestnet.WORLDCHAIN]:_commonsdkbase.BlockchainIncludingTestnet.WORLD_CHAIN_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.ZORA]:_commonsdkbase.BlockchainIncludingTestnet.ZORA_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.TEMPO]:_commonsdkbase.BlockchainIncludingTestnet.TEMPO_TESTNET};function g(t){return Y[t]}function F(t){return t==="solana"||t==="stellar"||I(t)||C(t)}function ee(t,a){if(!F(t))throw new (0, _chunkLHAOCUXTcjs.c)(`Unknown chain "${t}". Please use a supported chain name (e.g. "base-sepolia", "polygon", "solana", "stellar").`);if(t==="solana"||t==="stellar")return t;let r=t,T=a===_commonsdkbase.APIKeyEnvironmentPrefix.PRODUCTION;if(T&&I(r))throw new (0, _chunkLHAOCUXTcjs.b)(`Chain "${t}" is a testnet chain and cannot be used in production. Please use a mainnet chain instead.`);if(!T&&C(r)){let n=g(r);if(n!=null)return _chunkQFZSILOIcjs.a.debug("validateChainForEnvironment.autoConverted",{chain:t,convertedTo:n,environment:a,message:`Chain "${t}" is a mainnet chain and cannot be used in ${a} environment. Automatically converted to "${n}".`}),n;_chunkQFZSILOIcjs.a.debug("validateChainForEnvironment.mismatch",{chain:t,environment:a,message:`Chain "${t}" is a mainnet chain and should not be used in ${a} environment. No testnet equivalent is available. Please use a testnet chain instead.`})}return t}exports.a = X; exports.b = I; exports.c = C; exports.d = g; exports.e = F; exports.f = ee;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkWFWX6G26cjs = require('./chunk-WFWX6G26.cjs');var _chunkENU3EKBGcjs = require('./chunk-ENU3EKBG.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');function d(s,n){var e,l,r,i,a;let t=(e=s.chains)==null?void 0:e[n],o=_chunkWFWX6G26cjs.a.call(void 0, n).balanceTokenFields(t);return _chunkDSIFRRBScjs.a.call(void 0, {symbol:(l=s.symbol)!=null?l:"",name:(r=s.name)!=null?r:"",amount:(i=s.amount)!=null?i:"0",decimals:s.decimals,rawAmount:(a=s.rawAmount)!=null?a:"0"},o)}function h(s,n){let t={symbol:s,name:s,amount:"0",decimals:0,rawAmount:"0"},o=_chunkWFWX6G26cjs.a.call(void 0, n).emptyBalanceTokenFields();return _chunkDSIFRRBScjs.a.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {},t),o)}function B(s,n,t){var r,i,a,f,p;if(n==null)return!0;let o=((r=s.symbol)!=null?r:"").toLowerCase();if(n.has(o))return!0;let e=(i=s.chains)==null?void 0:i[t];if(e==null)return!1;let l=_chunkENU3EKBGcjs.a.call(void 0, t);if(l==="solana"&&"mintHash"in e){let c=(a=e.mintHash)==null?void 0:a.toLowerCase();return c!=null&&(n.has(c)||n.has(`solana:${c}`))}if(l==="stellar"&&"contractId"in e){let c=(f=e.contractId)==null?void 0:f.toLowerCase();return c!=null&&(n.has(c)||n.has(`stellar:${c}`))}if("contractAddress"in e){let c=(p=e.contractAddress)==null?void 0:p.toLowerCase();return c!=null&&(n.has(c)||n.has(`${t}:${c}`))}return!1}function T(s,n,t,o){let e=s.find(a=>a.symbol===t),l=s.find(a=>a.symbol==="usdc"),r=o!=null?new Set(o.map(a=>a.toLowerCase())):null,i=s.filter(a=>a.symbol!==t&&a.symbol!=="usdc"&&B(a,r,n));return{nativeToken:e!=null?d(e,n):h(t,n),usdc:l!=null?d(l,n):h("usdc",n),tokens:i.map(a=>d(a,n))}}exports.a = T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkLHAOCUXTcjs = require('./chunk-LHAOCUXT.cjs');var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkLHAOCUXTcjs = require('./chunk-LHAOCUXT.cjs');var _chunkQFZSILOIcjs = require('./chunk-QFZSILOI.cjs');var _chunk5GYNNLVWcjs = require('./chunk-5GYNNLVW.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var h=class extends _commonsdkbase.CrossmintApiClient{constructor(e){super(e,{internalConfig:{sdkMetadata:{name:_chunk5GYNNLVWcjs.c,version:_chunk5GYNNLVWcjs.b}}});this.apiPrefix="api/2025-06-09/wallets";this.unstableApiPrefix="api/unstable/wallets"}createWallet(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let s=this.isServerSide?`${this.apiPrefix}`:`${this.apiPrefix}/me`;_chunkQFZSILOIcjs.a.info("wallets.api.createWallet",{chainType:e.chainType,walletType:e.type});let n=yield(yield this.post(s,{body:JSON.stringify(e),headers:this.headers})).json();return"error"in n?_chunkQFZSILOIcjs.a.error("wallets.api.createWallet.error",{error:n.error,chainType:e.chainType}):"address"in n&&_chunkQFZSILOIcjs.a.info("wallets.api.createWallet.success",{address:n.address,chainType:e.chainType}),n})}getWallet(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){_chunkQFZSILOIcjs.a.info("wallets.api.getWallet",{locator:e});let r=yield(yield this.get(`${this.apiPrefix}/${e}`,{headers:this.headers})).json();return"error"in r?_chunkQFZSILOIcjs.a.warn("wallets.api.getWallet.error",{locator:e,error:r.error}):"address"in r&&_chunkQFZSILOIcjs.a.info("wallets.api.getWallet.success",{address:r.address,locator:e}),r})}createTransaction(e,s){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveTransaction(e,s,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions/${s}/approvals`,{body:JSON.stringify(r),headers:this.headers})).json()})}getTransaction(e,s){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions/${s}`,{headers:this.headers})).json()})}createSignature(e,s){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signatures`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveSignature(e,s,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let n=yield this.post(`${this.apiPrefix}/${e}/signatures/${s}/approvals`,{body:JSON.stringify(r),headers:this.headers});return n.status===422?this.getSignature(e,s):n.json()})}getSignature(e,s){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/signatures/${s}`,{headers:this.headers})).json()})}getTransactions(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions`,{headers:this.headers})).json()})}getNfts(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let s=new URLSearchParams;s.append("page",e.page.toString()),s.append("perPage",e.perPage.toString());let r=`${e.chain}:${e.address}`;return(yield this.get(`${this.apiPrefix}/${r}/nfts?${s.toString()}`,{headers:this.headers})).json()})}getTransfers(e,s){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let r=new URLSearchParams;return r.append("chain",s.chain.toString()),s.tokens!=null&&r.append("tokens",s.tokens),r.append("status",s.status),(yield this.get(`${this.unstableApiPrefix}/${e}/transfers?${r.toString()}`,{headers:this.headers})).json()})}getBalance(e,s){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let r=new URLSearchParams;return r.append("tokens",s.tokens.join(",")),r.append("chains",s.chains.join(",")),(yield this.get(`${this.apiPrefix}/${e}/balances?${r.toString()}`,{headers:this.headers})).json()})}fundWallet(e,s){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){if(this.environment===_commonsdkbase.APIKeyEnvironmentPrefix.PRODUCTION)throw new Error("Funding wallets is only supported in staging environment");return(yield this.post(`api/v1-alpha2/wallets/${e}/balances`,{body:JSON.stringify(s),headers:this.headers})).json()})}registerSigner(e,s){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signers`,{body:JSON.stringify(s),headers:this.headers})).json()})}removeSigner(e,s,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let n=encodeURIComponent(s),i=new URLSearchParams;r.chain&&i.append("chain",r.chain);let l=`${this.apiPrefix}/${e}/signers/${n}${i.size>0?`?${i.toString()}`:""}`;return(yield this.delete(l,{headers:this.headers})).json()})}getSigner(e,s){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let r=encodeURIComponent(s);return(yield this.get(`${this.apiPrefix}/${e}/signers/${r}`,{headers:this.headers})).json()})}send(e,s,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){_chunkQFZSILOIcjs.a.info("wallets.api.send",{walletLocator:e,tokenLocator:s,recipient:r.recipient});let i=yield(yield this.post(`${this.apiPrefix}/${e}/tokens/${s}/transfers`,{body:JSON.stringify(r),headers:this.headers})).json();return"error"in i?_chunkQFZSILOIcjs.a.error("wallets.api.send.error",{walletLocator:e,tokenLocator:s,error:i.error}):"id"in i&&_chunkQFZSILOIcjs.a.info("wallets.api.send.success",{walletLocator:e,transactionId:i.id}),i})}get isServerSide(){return this.parsedAPIKey.usageOrigin===_commonsdkbase.APIKeyUsageOrigin.SERVER}get environment(){if(!this.parsedAPIKey.isValid)throw new (0, _chunkLHAOCUXTcjs.a)("Invalid API key");return this.parsedAPIKey.environment}get projectId(){if(!this.parsedAPIKey.isValid)throw new (0, _chunkLHAOCUXTcjs.a)("Invalid API key");return this.parsedAPIKey.projectId}get headers(){return{"Content-Type":"application/json"}}};exports.a = h;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as i}from"./chunk-
|
|
1
|
+
import{a as i}from"./chunk-3MF3O7DM.js";import{y as u}from"./chunk-SLPKMZNW.js";import{a as t}from"./chunk-SI3GYRHH.js";import{a as f,c,h as s}from"./chunk-NU7VF7MC.js";import{isValidStellarAddress as T,WithLoggerContext as g}from"@crossmint/common-sdk-base";var m=409,l=class l extends i{constructor(e){super({chain:e.chain,address:e.address,owner:e.owner,options:i.getOptions(e),alias:e.alias,recovery:i.getRecovery(e),apiRecoveryServerSignerAddress:i.getApiRecoveryServerSignerAddress(e),apiDelegatedServerSignerAddresses:i.getApiDelegatedServerSignerAddresses(e),signer:e.signer,signers:i.getInitialSigners(e)},i.getApiClient(e))}static from(e){if(!T(e.address))throw new Error("Wallet is not a Stellar wallet");return new l(e)}sendTransaction(e){return s(this,null,function*(){var d;t.info("stellarWallet.sendTransaction.start"),yield this.preAuthIfNeeded();let r=yield this.createTransaction(e);if((d=e.options)!=null&&d.prepareOnly)return t.info("stellarWallet.sendTransaction.prepared",{transactionId:r.id}),{hash:void 0,explorerLink:void 0,transactionId:r.id};let a={},n=yield this.approveTransactionAndWait(r.id,a);return t.info("stellarWallet.sendTransaction.success",{transactionId:r.id,hash:n.hash}),n})}upgrade(e){return s(this,null,function*(){t.info("stellarWallet.upgrade.start"),yield this.preAuthIfNeeded();let r=yield this.createWalletLifecycleTransaction("upgrade-wallet",e);if(r!=null){if(e!=null&&e.prepareOnly)return t.info("stellarWallet.upgrade.prepared",{transactionId:r}),{hash:void 0,explorerLink:void 0,transactionId:r};yield this.approveTransactionAndWait(r),t.info("stellarWallet.upgrade.phase1.success",{transactionId:r})}else t.info("stellarWallet.upgrade.phase1.skipped",{reason:"wallet already locked from a prior upgrade"});let a=yield this.migrateInternal({signer:e==null?void 0:e.signer,prepareOnly:e==null?void 0:e.prepareOnly});return t.info("stellarWallet.upgrade.success",{transactionId:a.transactionId,hash:a.hash}),a})}migrate(e){return s(this,null,function*(){return yield this.preAuthIfNeeded(),yield this.migrateInternal(e)})}migrateInternal(e){return s(this,null,function*(){t.info("stellarWallet.migrate.start");let r=yield this.createWalletLifecycleTransaction("migrate-wallet",e);if(r==null)throw new u("Failed to create migrate-wallet transaction");if(e!=null&&e.prepareOnly)return t.info("stellarWallet.migrate.prepared",{transactionId:r}),{hash:void 0,explorerLink:void 0,transactionId:r};let a=yield this.approveTransactionAndWait(r);return t.info("stellarWallet.migrate.success",{transactionId:r,hash:a.hash}),a})}createTransaction(e){return s(this,null,function*(){let{contractId:r,options:a}=e,n=this.resolveStellarSigner(a==null?void 0:a.signer),d="transaction"in e?{type:"serialized-transaction",serializedTransaction:e.transaction,contractId:r}:{type:"contract-call",contractId:r,method:e.method,memo:e.memo!=null?{type:"text",value:e.memo}:void 0,args:e.args},p=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:d,signer:n}});if("error"in p)throw new u(JSON.stringify(p));return p})}createWalletLifecycleTransaction(e,r){return s(this,null,function*(){let a=(r==null?void 0:r.signer)!=null?this.resolveStellarSigner(r.signer):void 0,n=yield this.apiClient.createTransaction(this.walletLocator,{params:f({transaction:{type:e}},a!=null?{signer:a}:{})});if("error"in n){if(e==="upgrade-wallet"&&y(n))return null;throw new u(JSON.stringify(n))}return n.id})}resolveStellarSigner(e){return e==null?this.signerManager.require().locator():typeof e=="string"?e:this.resolveServerSignerApiLocator(e)}};c([g({logger:t,methodName:"stellarWallet.sendTransaction",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"sendTransaction",1),c([g({logger:t,methodName:"stellarWallet.upgrade",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"upgrade",1),c([g({logger:t,methodName:"stellarWallet.migrate",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"migrate",1);var h=l;function y(o){return typeof o=="object"&&o!==null&&"statusCode"in o&&o.statusCode===m}export{h as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b as g}from"./chunk-
|
|
1
|
+
import{a,b as g}from"./chunk-DPU7ZDOR.js";import{a as s}from"./chunk-SI3GYRHH.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
|
-
import{a as s,b as o}from"./chunk-
|
|
1
|
+
import{a as s,b as o}from"./chunk-DPU7ZDOR.js";import{a as r}from"./chunk-SI3GYRHH.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};
|