@crossmint/wallets-sdk 1.11.0 → 1.12.1
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__/constants.d.cts +1 -1
- package/dist/api/__tests__/constants.d.ts +1 -1
- package/dist/api/__tests__/test-utils.cjs +1 -1
- package/dist/api/__tests__/test-utils.d.cts +1 -1
- package/dist/api/__tests__/test-utils.d.ts +1 -1
- package/dist/api/__tests__/test-utils.js +1 -1
- package/dist/api/client.cjs +1 -1
- package/dist/api/client.d.cts +1 -1
- package/dist/api/client.d.ts +1 -1
- package/dist/api/client.js +1 -1
- package/dist/api/gen/index.cjs +1 -1
- package/dist/api/gen/index.js +1 -1
- package/dist/api/index.cjs +1 -1
- package/dist/api/index.d.cts +1 -1
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.js +1 -1
- package/dist/api/types.d.cts +1 -1
- package/dist/api/types.d.ts +1 -1
- package/dist/chains/adapters/evm.cjs +1 -1
- package/dist/chains/adapters/evm.d.cts +1 -1
- package/dist/chains/adapters/evm.d.ts +1 -1
- package/dist/chains/adapters/evm.js +1 -1
- package/dist/chains/adapters/solana.cjs +1 -1
- package/dist/chains/adapters/solana.d.cts +1 -1
- package/dist/chains/adapters/solana.d.ts +1 -1
- package/dist/chains/adapters/solana.js +1 -1
- package/dist/chains/adapters/stellar.cjs +1 -1
- package/dist/chains/adapters/stellar.d.cts +1 -1
- package/dist/chains/adapters/stellar.d.ts +1 -1
- package/dist/chains/adapters/stellar.js +1 -1
- package/dist/chains/chain-adapter.cjs +1 -1
- package/dist/chains/chain-adapter.d.cts +1 -1
- package/dist/chains/chain-adapter.d.ts +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-UPSASDJP.cjs → chunk-2DB3DLAA.cjs} +1 -1
- package/dist/{chunk-Q3LD5CYJ.cjs → chunk-2GFL3HTC.cjs} +1 -1
- package/dist/{chunk-ZUBX7T2L.js → chunk-2IBE7HWB.js} +1 -1
- package/dist/{chunk-HIHX5FRO.js → chunk-2LA5ZWPD.js} +1 -1
- package/dist/{chunk-OV256XVK.cjs → chunk-44ICOOCJ.cjs} +1 -1
- package/dist/chunk-47M4FIGW.js +1 -0
- package/dist/{chunk-AUDTBFZ4.cjs → chunk-63Y6LGFL.cjs} +1 -1
- package/dist/{chunk-C2LCF6GA.js → chunk-6XKILBKX.js} +1 -1
- package/dist/{chunk-3CEGPUJH.js → chunk-7JR76V7P.js} +1 -1
- package/dist/{chunk-HE4BTHTY.cjs → chunk-ANE62EYK.cjs} +1 -1
- package/dist/{chunk-F3NUWFQW.js → chunk-AQRU3SSV.js} +1 -1
- package/dist/{chunk-65BIFI5E.cjs → chunk-B2275OIH.cjs} +1 -1
- package/dist/{chunk-KVGWACFA.js → chunk-B5ERXUGO.js} +1 -1
- package/dist/{chunk-7O3W4JAP.cjs → chunk-BOMJ4MFZ.cjs} +1 -1
- package/dist/{chunk-EFBUJ2BS.js → chunk-DSLYYS6N.js} +1 -1
- package/dist/{chunk-PEY3R7XG.cjs → chunk-EY352O5T.cjs} +1 -1
- package/dist/{chunk-N7SKSCSW.js → chunk-F42HGJBY.js} +1 -1
- package/dist/chunk-GPIDFXMJ.cjs +1 -0
- package/dist/{chunk-SGP5B33N.js → chunk-GQDDB57A.js} +1 -1
- package/dist/{chunk-KZ7LB6ZV.js → chunk-HEXHZLES.js} +1 -1
- package/dist/chunk-HH6B2NTT.cjs +1 -0
- package/dist/{chunk-IDRQPLGQ.cjs → chunk-HI7CAJMU.cjs} +1 -1
- package/dist/{chunk-EGX2IXWU.js → chunk-HLCF6MRD.js} +1 -1
- package/dist/{chunk-VCX2M3JY.cjs → chunk-I7R32ENT.cjs} +1 -1
- package/dist/chunk-IRAZVSWU.js +1 -0
- package/dist/{chunk-3A424HCV.js → chunk-JEKHYLBB.js} +1 -1
- package/dist/{chunk-6GZQZEGQ.cjs → chunk-JJIO5FRQ.cjs} +1 -1
- package/dist/chunk-JLKWUFQU.cjs +1 -0
- package/dist/{chunk-WTJC5QBH.cjs → chunk-K7C5ZVNY.cjs} +1 -1
- package/dist/{chunk-WO4ZWJT6.js → chunk-LT6GDX64.js} +1 -1
- package/dist/{chunk-UF5HZQUO.cjs → chunk-LUFASRMR.cjs} +1 -1
- package/dist/{chunk-SNBCG5HR.cjs → chunk-LXRF6CRW.cjs} +1 -1
- package/dist/{chunk-TY33CSCI.js → chunk-NHXWNB3V.js} +1 -1
- package/dist/{chunk-3N7PKPCH.cjs → chunk-OIHXWQZ3.cjs} +1 -1
- package/dist/chunk-PKREDLDO.cjs +1 -0
- package/dist/{chunk-TJBIBZMF.js → chunk-PSDE5X7P.js} +1 -1
- package/dist/chunk-PT6QTDSN.js +1 -0
- package/dist/{chunk-6IV3GB5W.js → chunk-PX2QER4D.js} +1 -1
- package/dist/{chunk-URQQBUUX.js → chunk-QG6GFZHT.js} +1 -1
- package/dist/{chunk-7SGXWFCJ.cjs → chunk-QK57CJTH.cjs} +1 -1
- package/dist/{chunk-KSN4TWLX.js → chunk-SFEGES23.js} +1 -1
- package/dist/{chunk-677M3EWV.cjs → chunk-SHFB7XOM.cjs} +1 -1
- package/dist/{chunk-P7KLEZYV.cjs → chunk-U34JZIST.cjs} +1 -1
- package/dist/{chunk-MHKIVDKZ.cjs → chunk-UPXD2IIW.cjs} +1 -1
- package/dist/{chunk-6ZAGINES.cjs → chunk-V7LXNAA3.cjs} +1 -1
- package/dist/{chunk-P4EW7S5I.cjs → chunk-VXFJQERS.cjs} +1 -1
- package/dist/chunk-W36RYDND.js +1 -0
- package/dist/chunk-WOQNCBUX.cjs +1 -0
- package/dist/chunk-WQQOCTIU.js +1 -0
- package/dist/chunk-XPBFCTYU.js +1 -0
- package/dist/{chunk-3TZJ6D4G.js → chunk-YJNAB33W.js} +1 -1
- package/dist/{chunk-6U5MZQQP.js → chunk-YWFVK6C5.js} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +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.d.cts +1 -1
- package/dist/sdk.d.ts +1 -1
- package/dist/sdk.js +1 -1
- package/dist/signers/descriptors/api-key.d.cts +1 -1
- package/dist/signers/descriptors/api-key.d.ts +1 -1
- package/dist/signers/descriptors/device.d.cts +1 -1
- package/dist/signers/descriptors/device.d.ts +1 -1
- package/dist/signers/descriptors/email.d.cts +1 -1
- package/dist/signers/descriptors/email.d.ts +1 -1
- package/dist/signers/descriptors/external-wallet.d.cts +1 -1
- package/dist/signers/descriptors/external-wallet.d.ts +1 -1
- package/dist/signers/descriptors/index.cjs +1 -1
- package/dist/signers/descriptors/index.d.cts +1 -1
- package/dist/signers/descriptors/index.d.ts +1 -1
- package/dist/signers/descriptors/index.js +1 -1
- package/dist/signers/descriptors/passkey.d.cts +1 -1
- package/dist/signers/descriptors/passkey.d.ts +1 -1
- package/dist/signers/descriptors/phone.cjs +1 -1
- package/dist/signers/descriptors/phone.d.cts +1 -1
- package/dist/signers/descriptors/phone.d.ts +1 -1
- package/dist/signers/descriptors/phone.js +1 -1
- package/dist/signers/descriptors/server.d.cts +1 -1
- package/dist/signers/descriptors/server.d.ts +1 -1
- package/dist/signers/descriptors/types.d.cts +1 -1
- package/dist/signers/descriptors/types.d.ts +1 -1
- package/dist/signers/device.d.cts +1 -1
- package/dist/signers/device.d.ts +1 -1
- package/dist/signers/evm-api-key.d.cts +1 -1
- package/dist/signers/evm-api-key.d.ts +1 -1
- package/dist/signers/evm-external-wallet.d.cts +1 -1
- package/dist/signers/evm-external-wallet.d.ts +1 -1
- package/dist/signers/external-wallet-signer.d.cts +1 -1
- package/dist/signers/external-wallet-signer.d.ts +1 -1
- package/dist/signers/index.cjs +1 -1
- package/dist/signers/index.d.cts +1 -1
- package/dist/signers/index.d.ts +1 -1
- package/dist/signers/index.js +1 -1
- package/dist/signers/non-custodial/index.cjs +1 -1
- package/dist/signers/non-custodial/index.d.cts +1 -1
- package/dist/signers/non-custodial/index.d.ts +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.d.cts +1 -1
- package/dist/signers/non-custodial/ncs-evm-signer.d.ts +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.d.cts +1 -1
- package/dist/signers/non-custodial/ncs-signer.d.ts +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.d.cts +1 -1
- package/dist/signers/non-custodial/ncs-solana-signer.d.ts +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.d.cts +1 -1
- package/dist/signers/non-custodial/ncs-stellar-signer.d.ts +1 -1
- package/dist/signers/non-custodial/ncs-stellar-signer.js +1 -1
- package/dist/signers/passkey.d.cts +1 -1
- package/dist/signers/passkey.d.ts +1 -1
- package/dist/signers/server/assemble-server-signer.d.cts +1 -1
- package/dist/signers/server/assemble-server-signer.d.ts +1 -1
- package/dist/signers/server/evm-server-signer.d.cts +1 -1
- package/dist/signers/server/evm-server-signer.d.ts +1 -1
- package/dist/signers/server/helpers/derive-server-signer.d.cts +1 -1
- package/dist/signers/server/helpers/derive-server-signer.d.ts +1 -1
- package/dist/signers/server/helpers/index.d.cts +1 -1
- package/dist/signers/server/helpers/index.d.ts +1 -1
- package/dist/signers/server/index.d.cts +1 -1
- package/dist/signers/server/index.d.ts +1 -1
- package/dist/signers/server/resolver.d.cts +1 -1
- package/dist/signers/server/resolver.d.ts +1 -1
- package/dist/signers/server/solana-server-signer.d.cts +1 -1
- package/dist/signers/server/solana-server-signer.d.ts +1 -1
- package/dist/signers/server/stellar-server-signer.d.cts +1 -1
- package/dist/signers/server/stellar-server-signer.d.ts +1 -1
- package/dist/signers/solana-api-key.d.cts +1 -1
- package/dist/signers/solana-api-key.d.ts +1 -1
- package/dist/signers/solana-external-wallet.d.cts +1 -1
- package/dist/signers/solana-external-wallet.d.ts +1 -1
- package/dist/signers/stellar-external-wallet.d.cts +1 -1
- package/dist/signers/stellar-external-wallet.d.ts +1 -1
- package/dist/signers/types.d.cts +1 -1
- package/dist/signers/types.d.ts +1 -1
- package/dist/{types-4EOfiBxs.d.cts → types-86FbKjRz.d.cts} +1 -0
- package/dist/{types-DfpYAsst.d.ts → types-BcjKqQz3.d.ts} +1 -0
- 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/createDeviceSigner.d.cts +1 -1
- package/dist/utils/device-signers/createDeviceSigner.d.ts +1 -1
- package/dist/utils/device-signers/index.cjs +1 -1
- package/dist/utils/device-signers/index.d.cts +1 -1
- package/dist/utils/device-signers/index.d.ts +1 -1
- package/dist/utils/device-signers/index.js +1 -1
- package/dist/utils/locators.d.cts +1 -1
- package/dist/utils/locators.d.ts +1 -1
- package/dist/utils/signer-locator.d.cts +1 -1
- package/dist/utils/signer-locator.d.ts +1 -1
- package/dist/utils/signer-mapping.d.cts +1 -1
- package/dist/utils/signer-mapping.d.ts +1 -1
- package/dist/wallets/__tests__/test-helpers.cjs +1 -1
- package/dist/wallets/__tests__/test-helpers.d.cts +1 -1
- package/dist/wallets/__tests__/test-helpers.d.ts +1 -1
- package/dist/wallets/__tests__/test-helpers.js +1 -1
- package/dist/wallets/evm.cjs +1 -1
- package/dist/wallets/evm.d.cts +1 -1
- package/dist/wallets/evm.d.ts +1 -1
- package/dist/wallets/evm.js +1 -1
- package/dist/wallets/services/balance-formatter.cjs +1 -1
- package/dist/wallets/services/balance-formatter.d.cts +1 -1
- package/dist/wallets/services/balance-formatter.d.ts +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 +1 -1
- package/dist/wallets/services/device-recovery-service.d.ts +1 -1
- 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.d.cts +1 -1
- package/dist/wallets/services/operation-poller.d.ts +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.d.cts +1 -1
- package/dist/wallets/services/signer-manager.d.ts +1 -1
- package/dist/wallets/services/signer-manager.js +1 -1
- package/dist/wallets/solana.cjs +1 -1
- package/dist/wallets/solana.d.cts +1 -1
- package/dist/wallets/solana.d.ts +1 -1
- package/dist/wallets/solana.js +1 -1
- package/dist/wallets/stellar.cjs +1 -1
- package/dist/wallets/stellar.d.cts +1 -1
- package/dist/wallets/stellar.d.ts +1 -1
- package/dist/wallets/stellar.js +1 -1
- package/dist/wallets/types.d.cts +1 -1
- package/dist/wallets/types.d.ts +1 -1
- package/dist/wallets/wallet-factory.cjs +1 -1
- package/dist/wallets/wallet-factory.d.cts +2 -1
- package/dist/wallets/wallet-factory.d.ts +2 -1
- package/dist/wallets/wallet-factory.js +1 -1
- package/dist/wallets/wallet.cjs +1 -1
- package/dist/wallets/wallet.d.cts +3 -2
- package/dist/wallets/wallet.d.ts +3 -2
- package/dist/wallets/wallet.js +1 -1
- package/package.json +4 -4
- package/dist/chunk-B5U3A75U.cjs +0 -1
- package/dist/chunk-EAU5Z5O5.cjs +0 -1
- package/dist/chunk-F3CW7X6C.js +0 -1
- package/dist/chunk-NUBGDLR2.js +0 -1
- package/dist/chunk-NUIG3XY3.cjs +0 -1
- package/dist/chunk-PMQQEVKL.cjs +0 -1
- package/dist/chunk-RFWY44CJ.js +0 -1
- package/dist/chunk-VFJ7NZBI.js +0 -1
- package/dist/chunk-VPJBVKHY.js +0 -1
- package/dist/chunk-W6APCBJW.cjs +0 -1
- package/dist/chunk-XEWCMK3Z.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as n,c as i}from"./chunk-
|
|
1
|
+
import{b as n,c as i}from"./chunk-47M4FIGW.js";import{SdkLogger as d,BrowserDatadogSink as k,detectPlatform as g,validateAPIKey as l,ServerDatadogSink as m}from"@crossmint/common-sdk-base";var t=new d;function f(s){let o=g(),e=l(s);if(!e.isValid)throw new Error(`Invalid API key: ${e.message}`);let{environment:a,projectId:c}=e;switch(t.init({packageName:i,packageVersion:n,environment:a,projectId:c,platform:o}),o){case"browser":{let r=new k(a);t.addSink(r);break}case"react-native":break;case"server":{let r=new m(a);t.addSink(r);break}default:break}}export{t as a,f as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as f}from"./chunk-IHMMTMFG.js";import{a as u,b as g,c as v,d as y,e as P}from"./chunk-DCKFFFPG.js";import{a as o}from"./chunk-PSDE5X7P.js";import{a as E,c as w,h}from"./chunk-NU7VF7MC.js";import{validateAPIKey as A,WithLoggerContext as T}from"@crossmint/common-sdk-base";var m=class{constructor(n){this.config=n;this._needsAuth=!0;this._authPromise=null;this._initializationPromise=null;this._onboardingConnectionGeneration=null;typeof window!="undefined"&&(this._initializationPromise=this.initialize()),this.type=this.config.type}locator(){return this.config.locator}address(){return this.config.address}initialize(){return h(this,null,function*(){try{if(this.config.clientTEEConnection==null){let n=A(this.config.crossmint.apiKey);if(!n.isValid)throw new Error("Invalid API key");let t=new f({environment:n.environment});this.config.clientTEEConnection=yield t.initialize()}}finally{this._initializationPromise=null}})}getTEEConnection(){return h(this,null,function*(){if(this.config.clientTEEConnection==null){if(this._initializationPromise){if(yield this._initializationPromise,this.config.clientTEEConnection==null)throw new Error("Failed to initialize TEE connection");return this.config.clientTEEConnection}this._initializationPromise=this.initializeTEEConnection();try{yield this._initializationPromise}finally{this._initializationPromise=null}}if(this.config.clientTEEConnection==null)throw new Error("TEE connection is not initialized");return this.config.clientTEEConnection})}initializeTEEConnection(){return h(this,null,function*(){o.info("TEE connection not initialized, initializing now");let n=A(this.config.crossmint.apiKey);if(!n.isValid)throw new Error("Invalid API key");let t=new f({environment:n.environment});if(this.config.clientTEEConnection=yield t.initialize(),this.config.clientTEEConnection==null)throw new Error("Failed to initialize TEE connection");o.info("TEE connection initialized successfully")})}handleAuthRequired(){return h(this,null,function*(){var d;let n=yield this.getTEEConnection();if(this.config.onAuthRequired==null)throw new Error(`${this.type} signer requires the onAuthRequired callback to handle OTP verification. This callback manages the authentication flow (sending OTP and verifying user input). If using our React/React Native SDK, this is handled automatically by the provider. For other environments, implement: onAuthRequired: (needsAuth, sendOtp, verifyOtp, reject) => { /* your UI logic */ }`);o.info("get-status: sending request");let t=Date.now(),e=yield n.sendAction({event:"request:get-status",responseEvent:"response:get-status",data:{authData:{jwt:(d=this.config.crossmint.jwt)!=null?d:"",apiKey:this.config.crossmint.apiKey}},options:l}),s=Date.now()-t;if((e==null?void 0:e.status)!=="success"){let c=(e==null?void 0:e.status)==="error"&&e.error||"Failed to retrieve signer status",p=(e==null?void 0:e.status)==="error"?e.code:void 0;throw o.error("get-status: failed",{status:e==null?void 0:e.status,error:(e==null?void 0:e.status)==="error"?e.error:void 0,code:p,durationMs:s}),new v(c,p)}if(o.info("get-status: response received",{signerStatus:e.signerStatus,durationMs:s}),e.signerStatus==="ready"){this._needsAuth=!1;return}else this._needsAuth=!0;o.info("Auth required, initiating OTP flow",{needsAuth:this._needsAuth});let{promise:i,resolve:a,reject:r}=this.createAuthPromise();if(this._authPromise={promise:i,resolve:a,reject:r},this.config.onAuthRequired)try{yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),c=>this.verifyOtp(c),()=>h(this,null,function*(){o.info("Auth rejected",{authRejected:!0}),this._needsAuth=!1,this.config.onAuthRequired!=null&&(yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),c=>this.verifyOtp(c),()=>{var c;return(c=this._authPromise)==null?void 0:c.reject(new u)})),r(new u)}))}catch(c){o.error("handleAuthRequired error",{error:c}),r(c)}try{yield i}catch(c){throw o.error("handleAuthRequired promise error",{error:c}),c}})}ensureAuthenticated(){return h(this,null,function*(){this.config.resetSignerFrame!=null&&(yield this.config.resetSignerFrame()),yield this.handleAuthRequired()})}getJwtOrThrow(){let n=this.config.crossmint.jwt;if(n==null)throw new Error("JWT is required");return n}createAuthPromise(){let n,t;return{promise:new Promise((s,i)=>{n=s,t=i}),resolve:n,reject:t}}sendMessageWithOtp(){return h(this,null,function*(){var r;let n=yield this.getTEEConnection(),t=this.getAuthId();o.info("start-onboarding: sending request");let e=Date.now(),s=this.config.type==="phone"?this.config.channel:void 0,i=yield n.sendAction({event:"request:start-onboarding",responseEvent:"response:start-onboarding",data:{authData:{jwt:(r=this.config.crossmint.jwt)!=null?r:"",apiKey:this.config.crossmint.apiKey},data:E({authId:t},s!=null?{channel:s}:{})},options:l}),a=Date.now()-e;if(this._onboardingConnectionGeneration=n.connectionGeneration,o.info("start-onboarding: response received",{status:i==null?void 0:i.status,durationMs:a}),(i==null?void 0:i.status)==="success"&&i.signerStatus==="ready"){this._needsAuth=!1;return}if((i==null?void 0:i.status)==="error")throw o.error("start-onboarding: failed",{error:i.error,code:i.code}),new g(i.error||"Failed to initiate OTP process.",i.code)})}getAuthId(){return this.config.type==="email"?`email:${this.config.email}`:`phone:${this.config.phone}`}verifyOtp(n){return h(this,null,function*(){var i,a;let t;try{let r=yield this.getTEEConnection();o.info("complete-onboarding: sending request");let d=Date.now();t=yield r.sendAction({event:"request:complete-onboarding",responseEvent:"response:complete-onboarding",data:{authData:{jwt:(i=this.config.crossmint.jwt)!=null?i:"",apiKey:this.config.crossmint.apiKey},data:{onboardingAuthentication:{encryptedOtp:n}}},options:l}),o.info("complete-onboarding: response received",{status:t==null?void 0:t.status,durationMs:Date.now()-d})}catch(r){return o.error("complete-onboarding: error",{error:r}),yield this.handleOnboardingVerificationFailure(r)}if((t==null?void 0:t.status)==="success"){this._needsAuth=!1,this.config.onAuthRequired!=null&&(yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),r=>this.verifyOtp(r),()=>{var r;return(r=this._authPromise)==null?void 0:r.reject(new u)})),(a=this._authPromise)==null||a.resolve();return}o.error("complete-onboarding: OTP validation failed",{status:t==null?void 0:t.status,error:(t==null?void 0:t.status)==="error"?t.error:void 0,code:(t==null?void 0:t.status)==="error"?t.code:void 0});let e=(t==null?void 0:t.status)==="error"&&t.error||"Failed to validate encrypted OTP",s=(t==null?void 0:t.status)==="error"?t.code:void 0;return yield this.handleOnboardingVerificationFailure(new g(e,s))})}handleOnboardingVerificationFailure(n){return h(this,null,function*(){var s,i,a;this._needsAuth=!0;let t=this.config.clientTEEConnection;if(this._onboardingConnectionGeneration!=null&&t!=null&&t.connectionGeneration!==this._onboardingConnectionGeneration){o.warn("tee.signer.onboarding.reissued",{reason:"signer frame reloaded mid-onboarding, re-issuing OTP",onboardingGeneration:this._onboardingConnectionGeneration,currentGeneration:t==null?void 0:t.connectionGeneration});try{yield this.sendMessageWithOtp()}catch(r){throw(s=this._authPromise)==null||s.reject(r),r}if(!this._needsAuth){(i=this._authPromise)==null||i.resolve();return}throw new P}throw(a=this._authPromise)==null||a.reject(n),n})}_exportPrivateKey(n,t){return h(this,null,function*(){yield this.ensureAuthenticated();let e=this.getJwtOrThrow(),{scheme:s,encoding:i}=this.getChainKeyParams();if(t!=null){let r=n.on("event:key-exported",d=>{n.off(r),d.status==="success"&&Promise.resolve().then(()=>t()).catch(()=>{console.error("[NCS Signer] onExport callback error")})})}let a=yield n.sendAction({event:"request:export-signer",responseEvent:"response:export-signer",data:{authData:{jwt:e,apiKey:this.config.crossmint.apiKey},data:{scheme:s,encoding:i,walletAddress:this.config.address,authId:this.getAuthId()}},options:l});if((a==null?void 0:a.status)==="error")throw o.error("export-signer: failed",{error:a.error,code:a.code}),new y(a.error||"Failed to export private key",a.code)})}};w([T({logger:o,methodName:"handleAuthRequired"})],m.prototype,"handleAuthRequired",1);var l={timeoutMs:3e4};export{m as a,l as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as C,B as x,C as A,D as y,E as k,I as w,s as M,v as m,x as b}from"./chunk-7FEY62ID.js";import{a as E}from"./chunk-
|
|
1
|
+
import{A as C,B as x,C as A,D as y,E as k,I as w,s as M,v as m,x as b}from"./chunk-7FEY62ID.js";import{a as E}from"./chunk-PSDE5X7P.js";import{d as S}from"./chunk-47M4FIGW.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
|
-
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-7FEY62ID.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-7FEY62ID.js";import{a as E}from"./chunk-PSDE5X7P.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
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkXZ4NKVEBcjs = require('./chunk-XZ4NKVEB.cjs');var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkXZ4NKVEBcjs = require('./chunk-XZ4NKVEB.cjs');var _chunkBOMJ4MFZcjs = require('./chunk-BOMJ4MFZ.cjs');var _chunkV7LXNAA3cjs = require('./chunk-V7LXNAA3.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:{};_chunkBOMJ4MFZcjs.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, _chunkXZ4NKVEBcjs.B)("Transaction confirmation timeout");let s=Date.now();if(t=yield i.getTransaction(o,a),t.error)throw _chunkXZ4NKVEBcjs.I.call(void 0, t),new (0, _chunkXZ4NKVEBcjs.A)(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, _chunkXZ4NKVEBcjs.C)(`Transaction sending failed: ${JSON.stringify(t)}`);if(t.status==="awaiting-approval")throw new (0, _chunkXZ4NKVEBcjs.D)("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, _chunkXZ4NKVEBcjs.E)("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, _chunkXZ4NKVEBcjs.x)("Signature confirmation timeout");if(yield new Promise(f=>setTimeout(f,_chunkV7LXNAA3cjs.d)),n=yield i.getSignature(o,a),"error"in n)throw _chunkXZ4NKVEBcjs.I.call(void 0, n),new (0, _chunkXZ4NKVEBcjs.v)(JSON.stringify(n))}while(n===null||n.status==="pending");if(n.status==="failed")throw new (0, _chunkXZ4NKVEBcjs.s)("Signature signing failed");if(!n.outputSignature)throw new (0, _chunkXZ4NKVEBcjs.v)("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
|
-
import{a as j}from"./chunk-5LNDUSMZ.js";import{a as R}from"./chunk-
|
|
1
|
+
import{a as j}from"./chunk-5LNDUSMZ.js";import{a as R}from"./chunk-JEKHYLBB.js";import{a as T,b as M}from"./chunk-GQDDB57A.js";import{a as W,b as E,f as O}from"./chunk-DCKFFFPG.js";import{m as I}from"./chunk-7FEY62ID.js";import{a as s}from"./chunk-PSDE5X7P.js";import{d as e,e as d,f as o,g as w,h as f}from"./chunk-NU7VF7MC.js";var l,m,C,p,y,n,b,A,k,L,K,P,u,V,F,q,B,$,N=class{constructor(r){d(this,u);d(this,l,"unknown");d(this,m,!1);d(this,C);d(this,p);d(this,y);d(this,n);d(this,b);d(this,A);d(this,k);d(this,L);d(this,K);d(this,P);o(this,C,r.chain),o(this,p,r.walletAddress),o(this,y,r.options),o(this,n,r.signerManager),o(this,b,r.serverSignerResolver),o(this,A,r.signers),o(this,k,r.addSigner),o(this,L,r.removeSigner),o(this,K,r.approveSignature),o(this,P,r.approveTransaction)}get needsRecovery(){return e(this,l)==="needs-recovery"}onSignerSelected(){e(this,l)==="needs-recovery"&&o(this,l,"unknown")}initDeviceSigner(){return f(this,null,function*(){var g;if(((g=e(this,y))==null?void 0:g.deviceSignerKeyStorage)==null||e(this,m))return;let i={type:"device"};try{yield this.resolveAvailability(i)}catch(S){s.error("wallet.initDeviceSigner.error",{error:S}),o(this,l,"needs-recovery");return}if(e(this,l)==="needs-recovery")return;let a=R(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)||(s.info("wallet.initDeviceSigner.pendingApproval",{signerLocator:t.locator(),status:t.status}),o(this,l,"needs-recovery"))})}recover(){return f(this,null,function*(){var D;if(s.info("wallet.recover.start"),e(this,l)==="resolved"){s.info("wallet.recover.skipped",{reason:"Device signer already approved (cached)"});return}if(e(this,m)){s.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 w(this,u,F).call(this,r))){o(this,l,"resolved");return}if(r!=null&&r.type!=="device"){s.warn("wallet.recover.skipped",{reason:"Recovery is only supported for device signers"}),o(this,l,"unknown");return}let i=(D=e(this,y))==null?void 0:D.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 e(this,A).call(this),t=yield w(this,u,B).call(this,i,a);if(t!=null&&(yield w(this,u,F).call(this,t))){e(this,n).setActiveSigner(t),o(this,l,"resolved");let c=t.locator().replace("device:","");try{yield i.mapAddressToKey(e(this,p),c)}catch(z){s.warn("wallet.recover.mapAddressToKey.error",{error:z})}return}let g=a.filter(c=>c.type==="device"),S=w(this,u,V).call(this,g,i),v=yield j(i,e(this,p));try{yield e(this,k).call(this,v)}catch(c){if(c instanceof I){s.info("wallet.recover.device.unsupportedFallback",{signerLocator:v.locator}),yield i.deleteKey(e(this,p)),o(this,m,!0),o(this,l,"resolved"),yield w(this,u,$).call(this);return}else if(G(c))s.info("wallet.recover.skipped",{reason:"Device signer already approved",signerLocator:v.locator});else throw c instanceof W||c instanceof Error&&c.name==="AuthRejectedError"?(s.info("wallet.recover.device.authRejected",{signerLocator:v.locator}),c):c instanceof E||c instanceof Error&&c.name==="OtpValidationError"?(s.warn("wallet.recover.device.otpValidationFailed",{signerLocator:v.locator,code:c instanceof E?c.code:void 0}),c):(s.error("wallet.recover.device.error",{error:c}),yield i.deleteKey(e(this,p)),c)}let h=yield e(this,n).assemble({type:"device",locator:v.locator,address:e(this,p)});if(e(this,n).setActiveSigner(h),h.type==="device"&&(h.status="success"),s.info("wallet.recover.device.success",{signerLocator:v.locator}),o(this,l,"resolved"),S!=null)try{yield e(this,L).call(this,S),s.info("wallet.recover.staleSignerRemoved",{signerLocator:S})}catch(c){s.warn("wallet.recover.staleSignerRemovalFailed",{signerLocator:S,error:c})}})}resolveAvailability(r){return f(this,null,function*(){var S;let i=(S=e(this,y))==null?void 0:S.deviceSignerKeyStorage;if(i==null)throw new Error("Device signer key storage is required for device signers");let a=yield i.getKey(e(this,p));if(a!=null){r.locator=`device:${a}`,o(this,l,"unknown");return}let g=(yield e(this,A).call(this)).filter(v=>v.locator.startsWith("device:"));for(let v of g){let h=v.locator.replace("device:","");if(yield i.hasKey(h)){yield i.mapAddressToKey(e(this,p),h),r.locator=v.locator,o(this,l,"unknown");return}}o(this,l,"needs-recovery")})}tryResolveLocallyAvailableSigner(t){return f(this,arguments,function*(r,i=(a=>(a=e(this,y))==null?void 0:a.deviceSignerKeyStorage)()){if(i==null)return null;try{return yield M(e(this,C),r,e(this,p),i)}catch(g){return s.warn("wallet.deviceRecovery.tryResolveLocallyAvailableSigner.failed",{signerLocator:r,error:g}),null}})}};l=new WeakMap,m=new WeakMap,C=new WeakMap,p=new WeakMap,y=new WeakMap,n=new WeakMap,b=new WeakMap,A=new WeakMap,k=new WeakMap,L=new WeakMap,K=new WeakMap,P=new WeakMap,u=new WeakSet,V=function(r,i){if(r.length===0)return;if(r.length===1)return r[0].locator;let a=i.getDeviceName(),t=r.filter(g=>g.name===a);return t.length===1?t[0].locator:void 0},F=function(r){return f(this,null,function*(){var a;if(e(this,n).isApprovedSignerStatus(r.status))return s.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 w(this,u,q).call(this,r,i.pendingOperation),!0):e(this,n).isApprovedSignerStatus(r.status)?(s.info("wallet.recover.skipped",{reason:"Device signer already approved"}),!0):!1})},q=function(r,i){return f(this,null,function*(){var h;let a=e(this,n).activeSigner,t=e(this,n).recovery;if(O(t)&&!e(this,b).hasRecoveryResolution)throw new Error('Cannot resume pending approval: no secret available. Call wallet.useSigner({ type: "server", secret: ... }) first with the recovery server secret.');let g=R(t.type),S=e(this,n).descriptorContext();if(t.type==="external-wallet"&&!g.canAutoAssemble(t,S))throw new Error('Cannot resume pending approval: no onSign callback available. Call wallet.useSigner({ type: "external-wallet", address: "0x...", onSign: async (tx) => ... }) first.');let v=g.buildInternalConfig(t,S);e(this,n).setActiveSigner(T(e(this,C),v,(h=e(this,y))==null?void 0:h.deviceSignerKeyStorage));try{i.type==="signature"?yield e(this,K).call(this,i.id):yield e(this,P).call(this,i.id)}catch(D){throw e(this,n).setActiveSigner(r),D}finally{e(this,n).activeSigner!==r&&e(this,n).setActiveSigner(a)}r.status="success",s.info("wallet.recover.device.success",{signerLocator:r.locator(),resumed:!0})})},B=function(r,i){return f(this,null,function*(){let a=i.filter(t=>t.locator.startsWith("device:"));for(let t of a){let g=yield this.tryResolveLocallyAvailableSigner(t.locator,r);if(g!=null)return s.info("wallet.recover.foundLocalDeviceSigner",{signerLocator:t.locator}),g}return null})},$=function(){return f(this,null,function*(){let r=e(this,n).recovery,i=R(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){s.warn("wallet.recover.device.unsupportedFallback.autoAssemblyFailed",{recoveryType:r.type,error:t})}})};function G(x){if(!(x instanceof Error))return!1;let r=x.message.toLowerCase();return r.includes("delegated signer")&&r.includes("already")&&r.includes("approved")}export{N as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkPKREDLDOcjs = require('./chunk-PKREDLDO.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=_chunkPKREDLDOcjs.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=_chunkPKREDLDOcjs.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}); 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 _chunkHH6B2NTTcjs = require('./chunk-HH6B2NTT.cjs');var _chunkBOMJ4MFZcjs = require('./chunk-BOMJ4MFZ.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 _chunkHH6B2NTTcjs.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();_chunkBOMJ4MFZcjs.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:_chunkHH6B2NTTcjs.b});if(_chunkBOMJ4MFZcjs.a.info("sign: response received",{status:e==null?void 0:e.status,durationMs:Date.now()-l}),(e==null?void 0:e.status)==="error")throw new Error(e.error);if((e==null?void 0:e.signature)==null)throw new Error("Failed to sign transaction");return c.verifyPublicKeyFormat(e.publicKey),{signature:e.signature.bytes}})}static verifyPublicKeyFormat(n){if(n==null)throw new Error("No public key found");if(n.encoding!=="base58"||n.keyType!=="ed25519"||n.bytes==null)throw new Error("Not supported. Expected public key to be in base58 encoding and ed25519 key type. Got: "+JSON.stringify(n))}getChainKeyParams(){return{scheme:"ed25519",encoding:"base58"}}};exports.a = g;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkHI7CAJMUcjs = require('./chunk-HI7CAJMU.cjs');var _chunkK7C5ZVNYcjs = require('./chunk-K7C5ZVNY.cjs');var _chunkXZ4NKVEBcjs = require('./chunk-XZ4NKVEB.cjs');var _chunkBOMJ4MFZcjs = require('./chunk-BOMJ4MFZ.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');var _viem = require('viem');var _commonsdkbase = require('@crossmint/common-sdk-base');var c=class c extends _chunkHI7CAJMUcjs.a{constructor(e){super({chain:e.chain,address:e.address,owner:e.owner,options:_chunkHI7CAJMUcjs.a.getOptions(e),alias:e.alias,recovery:_chunkHI7CAJMUcjs.a.getRecovery(e),apiRecoveryServerSignerAddress:_chunkHI7CAJMUcjs.a.getApiRecoveryServerSignerAddress(e),apiDelegatedServerSignerAddresses:_chunkHI7CAJMUcjs.a.getApiDelegatedServerSignerAddresses(e),signer:e.signer,signers:_chunkHI7CAJMUcjs.a.getInitialSigners(e)},_chunkHI7CAJMUcjs.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;_chunkBOMJ4MFZcjs.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 _chunkBOMJ4MFZcjs.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 _chunkBOMJ4MFZcjs.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;_chunkBOMJ4MFZcjs.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 _chunkBOMJ4MFZcjs.a.error("evmWallet.signMessage.error",{error:r}),new (0, _chunkXZ4NKVEBcjs.u)(JSON.stringify(r));if((i=e.options)!=null&&i.prepareOnly)return _chunkBOMJ4MFZcjs.a.info("evmWallet.signMessage.prepared",{signatureId:r.id}),{signature:void 0,signatureId:r.id};let a=yield this.approveSignatureAndWait(r.id);return _chunkBOMJ4MFZcjs.a.info("evmWallet.signMessage.success",{signatureId:r.id}),a})}signTypedData(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var C;_chunkBOMJ4MFZcjs.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 _chunkBOMJ4MFZcjs.a.error("evmWallet.signTypedData.error",{error:"Invalid typed data"}),new (0, _chunkXZ4NKVEBcjs.q)("Invalid typed data");let{name:m,version:v,chainId:S,verifyingContract:I,salt:b}=r;if(!m||!v||!S||!I)throw _chunkBOMJ4MFZcjs.a.error("evmWallet.signTypedData.error",{error:"Invalid typed data domain"}),new (0, _chunkXZ4NKVEBcjs.q)("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 _chunkBOMJ4MFZcjs.a.error("evmWallet.signTypedData.error",{error:d}),new (0, _chunkXZ4NKVEBcjs.u)(JSON.stringify(d));if((C=e.options)!=null&&C.prepareOnly)return _chunkBOMJ4MFZcjs.a.info("evmWallet.signTypedData.prepared",{signatureId:d.id}),{signature:void 0,signatureId:d.id};let D=yield this.approveSignatureAndWait(d.id);return _chunkBOMJ4MFZcjs.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:_chunkK7C5ZVNYcjs.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, _chunkXZ4NKVEBcjs.z)(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:_chunkBOMJ4MFZcjs.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:_chunkBOMJ4MFZcjs.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:_chunkBOMJ4MFZcjs.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
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var s="@crossmint/wallets-sdk",t="1.
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var s="@crossmint/wallets-sdk",t="1.12.1";var p="WALLETS_SDK",c= exports.b =t,r= exports.c =s,a= exports.d =200;exports.a = p; exports.b = c; exports.c = r; exports.d = a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBOMJ4MFZcjs = require('./chunk-BOMJ4MFZ.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 _chunkBOMJ4MFZcjs.a.error("wallet.addSigner.error",{error:"Expected transaction in response for Solana/Stellar chain"}),new Error("Expected transaction in response for Solana/Stellar chain");return{type:"transaction",id:n.transaction.id}},balanceTokenFields(n){return n!=null&&"contractId"in n?{contractId:n.contractId}:n!=null&&"contractAddress"in n?{contractAddress:n.contractAddress}:{}},emptyBalanceTokenFields(){return{contractId:void 0}}};exports.a = o;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as r}from"./chunk-VCOKK7C2.js";var g={type:"phone",validateConfig(n){if(!("phone"in n)||n.phone==null)throw new Error("Phone signer requires a phone number")},buildInternalConfig(n,e){let i=n;return{type:"phone",phone:i.phone,channel:i.channel,locator:`phone:${i.phone}`,address:e.walletAddress,crossmint:e.crossmint,clientTEEConnection:e.clientTEEConnection,resetSignerFrame:e.resetSignerFrame,onAuthRequired:e.onAuthRequired}},canAutoAssemble(){return!0},addSignerPayload(n){return r(n)},matchesRecovery(n,e){return r(n)===r(e)},adoptsRecoveryConfigOnMatch:!0,signerUnavailableReason:()=>null};export{g as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkW6L7J3KLcjs = require('./chunk-W6L7J3KL.cjs');var t={type:"phone",validateConfig(n){if(!("phone"in n)||n.phone==null)throw new Error("Phone signer requires a phone number")},buildInternalConfig(n,e){let i=n;return{type:"phone",phone:i.phone,channel:i.channel,locator:`phone:${i.phone}`,address:e.walletAddress,crossmint:e.crossmint,clientTEEConnection:e.clientTEEConnection,resetSignerFrame:e.resetSignerFrame,onAuthRequired:e.onAuthRequired}},canAutoAssemble(){return!0},addSignerPayload(n){return _chunkW6L7J3KLcjs.a.call(void 0, n)},matchesRecovery(n,e){return _chunkW6L7J3KLcjs.a.call(void 0, n)===_chunkW6L7J3KLcjs.a.call(void 0, e)},adoptsRecoveryConfigOnMatch:!0,signerUnavailableReason:()=>null};exports.a = t;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as o}from"./chunk-7FEY62ID.js";import{a as i}from"./chunk-PSDE5X7P.js";import{b as c,c as l}from"./chunk-47M4FIGW.js";import{h as n}from"./chunk-NU7VF7MC.js";import{APIKeyEnvironmentPrefix as d,APIKeyUsageOrigin as g,ApiClientError as u,CrossmintApiClient as P}from"@crossmint/common-sdk-base";var h=class extends P{constructor(e){super(e,{internalConfig:{sdkMetadata:{name:l,version:c}}});this.apiPrefix="api/2025-06-09/wallets";this.unstableApiPrefix="api/unstable/wallets"}createWallet(e){return n(this,null,function*(){let s=this.isServerSide?`${this.apiPrefix}`:`${this.apiPrefix}/me`;i.info("wallets.api.createWallet",{chainType:e.chainType,walletType:e.type});let t=yield(yield this.post(s,{body:JSON.stringify(e),headers:this.headers})).json();return"error"in t?i.error("wallets.api.createWallet.error",{error:t.error,chainType:e.chainType}):"address"in t&&i.info("wallets.api.createWallet.success",{address:t.address,chainType:e.chainType}),t})}getWallet(e){return n(this,null,function*(){i.info("wallets.api.getWallet",{locator:e});let r=yield(yield this.get(`${this.apiPrefix}/${e}`,{headers:this.headers})).json();return"error"in r?i.warn("wallets.api.getWallet.error",{locator:e,error:r.error}):"address"in r&&i.info("wallets.api.getWallet.success",{address:r.address,locator:e}),r})}createTransaction(e,s){return n(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveTransaction(e,s,r){return n(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 n(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions/${s}`,{headers:this.headers})).json()})}createSignature(e,s){return n(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signatures`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveSignature(e,s,r){return n(this,null,function*(){let t=yield this.post(`${this.apiPrefix}/${e}/signatures/${s}/approvals`,{body:JSON.stringify(r),headers:this.headers});return t.status===422?this.getSignature(e,s):t.json()})}getSignature(e,s){return n(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/signatures/${s}`,{headers:this.headers})).json()})}getTransactions(e){return n(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions`,{headers:this.headers})).json()})}getNfts(e){return n(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 n(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 n(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 n(this,null,function*(){if(this.environment===d.PRODUCTION)throw new Error("Funding wallets is only supported in staging environment");return(yield this.post(`api/v1-alpha2/wallets/${e}/balances`,{body:JSON.stringify(s),headers:this.headers})).json()})}registerSigner(e,s){return n(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signers`,{body:JSON.stringify(s),headers:this.headers})).json()})}removeSigner(e,s,r){return n(this,null,function*(){let t=encodeURIComponent(s),a=new URLSearchParams;r.chain&&a.append("chain",r.chain);let p=`${this.apiPrefix}/${e}/signers/${t}${a.size>0?`?${a.toString()}`:""}`;return(yield this.delete(p,{headers:this.headers})).json()})}getSigner(e,s){return n(this,null,function*(){let r=encodeURIComponent(s),t=yield this.get(`${this.apiPrefix}/${e}/signers/${r}`,{headers:this.headers});if(!t.ok){let a=null;try{a=yield t.text()}catch(p){}throw new u(`API request failed: ${t.status} ${t.statusText}`,t.status,t.statusText,a)}return t.json()})}send(e,s,r){return n(this,null,function*(){i.info("wallets.api.send",{walletLocator:e,tokenLocator:s,recipient:r.recipient});let a=yield(yield this.post(`${this.apiPrefix}/${e}/tokens/${s}/transfers`,{body:JSON.stringify(r),headers:this.headers})).json();return"error"in a?i.error("wallets.api.send.error",{walletLocator:e,tokenLocator:s,error:a.error}):"id"in a&&i.info("wallets.api.send.success",{walletLocator:e,transactionId:a.id}),a})}get isServerSide(){return this.parsedAPIKey.usageOrigin===g.SERVER}get environment(){if(!this.parsedAPIKey.isValid)throw new o("Invalid API key");return this.parsedAPIKey.environment}get projectId(){if(!this.parsedAPIKey.isValid)throw new o("Invalid API key");return this.parsedAPIKey.projectId}get headers(){return{"Content-Type":"application/json"}}};export{h as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as D}from"./chunk-YJNAB33W.js";import{a as E}from"./chunk-5LNDUSMZ.js";import{a as S}from"./chunk-VCOKK7C2.js";import{b as k,c as R}from"./chunk-STRSYJNY.js";import{f as P}from"./chunk-QG6GFZHT.js";import{b as A,c as x}from"./chunk-TSJUK3ED.js";import{e as F,g,l as b}from"./chunk-7FEY62ID.js";import{a as p}from"./chunk-PSDE5X7P.js";import{a as f,b as v,c as W,h}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.",w=class{constructor(t){this.apiClient=t}getWallet(t,e){return h(this,null,function*(){let r,i;if(typeof t=="string"){if(!this.apiClient.isServerSide)throw new g("getWallet with walletLocator is only available on the server side. Use getWallet(args) instead.");if(e==null)throw new g("Wallet configuration is required when using walletLocator: https://docs.crossmint.com/sdk-reference/wallets/type-aliases/WalletArgsFor");r=t,i=e}else{if(this.apiClient.isServerSide)throw new g("getWallet on server side requires a walletLocator parameter. Use getWallet(walletLocator, args) instead.");i=t,r=this.getWalletLocator(i)}let n=v(f({},i),{chain:P(i.chain,this.apiClient.environment)});p.info("walletFactory.getWallet.start");let a=yield this.apiClient.getWallet(r);if("error"in a)throw p.warn("walletFactory.getWallet.notFound",{error:a.error}),new F(JSON.stringify(a));return p.info("walletFactory.getWallet.success",{address:a.address}),yield this.createWalletInstance(a,n)})}createWallet(t){return h(this,null,function*(){var o,c,y,u,d,C;let e=v(f({},t),{chain:P(t.chain,this.apiClient.environment)});if(yield(y=(c=(o=e.options)==null?void 0:o.callbacks)==null?void 0:c.onWalletCreationStart)==null?void 0:y.call(c),p.info("walletFactory.createWallet.start"),!this.apiClient.isServerSide&&e.owner!=null)throw p.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=(u=e.signers)!=null?u:[],i=((d=e.options)==null?void 0:d.deviceSignerKeyStorage)!=null&&!r.some(m=>m.type==="device"),n=i?[...r,{type:"device"}]:r,a=yield this.registerSigners(n,e.chain,(C=e.options)==null?void 0:C.deviceSignerKeyStorage),s;if(e.recovery.type==="passkey"&&e.recovery.id==null)s=yield this.createPasskeySigner(e.recovery);else if(e.recovery.type==="server"){let{derivedAddress:m}=A(e.recovery,e.chain,this.apiClient.projectId,this.apiClient.environment);s={type:"server",address:m}}else s=e.recovery;let l=yield this.createSmartWallet(e,s,a,i);if("error"in l)throw p.error("walletFactory.createWallet.error",{error:l.error}),new g(JSON.stringify(l));return p.info("walletFactory.createWallet.success",{address:l.address}),yield this.createWalletInstance(l,e)})}createSmartWallet(t,e,r,i){return h(this,null,function*(){let n=o=>{var c,y;return{type:"smart",chainType:this.getChainType(t.chain),config:f(f({adminSigner:e},t.plugins?{plugins:t.plugins}:{}),o!=null?{delegatedSigners:o}:{}),owner:(c=t.owner)!=null?c:void 0,alias:(y=t.alias)!=null?y:void 0}},a=yield this.apiClient.createWallet(n(r));if(!(i&&"error"in a&&a.code===b))return a;p.info("walletFactory.createWallet.deviceSignerUnsupported.retryWithoutDeviceSigner",{chain:t.chain});let l=r.filter(o=>!this.isBuiltDeviceSigner(o));return yield this.apiClient.createWallet(n(l))})}isBuiltDeviceSigner(t){let e=t.signer;return typeof e=="object"&&e!=null&&e.type==="device"}mergePhoneChannel(t,e){return t.type!=="phone"||(e==null?void 0:e.type)!=="phone"||e.channel==null?t:v(f({},t),{channel:e.channel})}createWalletInstance(t,e){return h(this,null,function*(){var y,u;this.validateExistingWalletConfig(t,e);let r=e,i=t.config.adminSigner,n=((y=r.recovery)==null?void 0:y.type)==="server"||((u=r.recovery)==null?void 0:u.type)==="external-wallet"?r.recovery:this.mergePhoneChannel(i,r.recovery),a=t.config.delegatedSigners,s=a;if(s!=null&&s.length===1&&(s[0].type==="server"||s[0].type==="external-wallet"))s=r.signers;else if(s!=null){let d=r.signers;s=s.map(C=>this.mergePhoneChannel(C,d==null?void 0:d.find(m=>m.type==="phone"&&C.type==="phone"&&S(m)===C.locator)))}let l=i.type==="server"&&"address"in i&&!("secret"in i)?i.address:void 0,o=(a!=null?a:[]).filter(d=>d.type==="server"&&"address"in d&&!("secret"in d)).map(d=>d.address),c=new D({chain:e.chain,address:t.address,owner:t.owner,options:e.options,alias:e.alias,recovery:n,apiRecoveryServerSignerAddress:l,apiDelegatedServerSignerAddresses:o,signers:s!=null?s:[]},this.apiClient);return yield c.waitForInit(),c})}getWalletLocator(t){return`me:${this.getChainType(t.chain)}:smart`+(t.alias!=null?`:alias:${t.alias}`:"")}createPasskeySigner(t){return h(this,null,function*(){var i;if(t.type!=="passkey")throw new Error("Signer is not a passkey");let e=(i=t.name)!=null?i:`Crossmint Wallet ${Date.now()}`,r=t.onCreatePasskey?yield t.onCreatePasskey(e):yield I.createCredential({name:e});return{type:"passkey",id:r.id,name:e,publicKey:{x:r.publicKey.x.toString(),y:r.publicKey.y.toString()}}})}validateExistingWalletConfig(t,e){if(e.owner!=null&&t.owner!=null&&k(e.owner)!==k(t.owner))throw new g("Wallet owner does not match existing wallet's linked user");if(e.chain==="solana"&&t.chainType!=="solana"||e.chain!=="solana"&&t.chainType==="solana"||e.chain==="stellar"&&t.chainType!=="stellar"||e.chain!=="stellar"&&t.chainType==="stellar")throw new g(`Wallet chain does not match existing wallet's chain. You must use chain: ${t.chainType}.`);if(t.type!=="smart")return;let r=e;if(r.recovery!=null||r.signers!=null){let i=t.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");R(r.recovery,n)}let a=r.signers;a!=null&&this.validateSigners(t,a,e.chain)}}validateSigners(t,e,r){let i=t.config,n=i==null?void 0:i.delegatedSigners;if(e.length!==0){if(n==null||n.length===0)throw new g(`${e.length} signer(s) specified, but wallet "${t.address}" has no signers. ${$}`);for(let a of e){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===S(a)});if(s==null){let l=n.map(o=>o.locator).join(", ");throw new g(`Signer '${a.type}' does not exist in wallet "${t.address}". Available signers: ${l}. ${$}`)}R(a,s)}}}isMatchingPasskeySigner(t,e,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(t.type==="passkey"){if(t.id==null&&i===1)return e.type==="passkey";if(t.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(t,e,r){return h(this,null,function*(){var i;return yield Promise.all((i=t==null?void 0:t.map(n=>h(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"&&e!=null){let{derivedAddress:a}=A(n,e,this.apiClient.projectId,this.apiClient.environment);return{signer:`server:${a}`}}return{signer:S(n)}})))!=null?i:[])})}getChainType(t){return t==="solana"?"solana":t==="stellar"?"stellar":"evm"}};W([T({logger:p,methodName:"walletFactory.getWallet",buildContext(t,e){if(typeof e[0]=="string"){let i=e[1];return{walletLocator:e[0],chain:i==null?void 0:i.chain}}let r=e[0];return{chain:r==null?void 0:r.chain}}})],w.prototype,"getWallet",1),W([T({logger:p,methodName:"walletFactory.createWallet",buildContext(t,e){return{chain:e[0].chain}}})],w.prototype,"createWallet",1);export{w as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as ge}from"./chunk-KSN4TWLX.js";import{a as de,b as pe}from"./chunk-6IV3GB5W.js";import{a as ce}from"./chunk-F3CW7X6C.js";import{a as le}from"./chunk-HIHX5FRO.js";import{a as se}from"./chunk-OMTJMVSG.js";import{a as L}from"./chunk-3A424HCV.js";import{a as $}from"./chunk-VCOKK7C2.js";import{a as ae,b as oe}from"./chunk-ARQVCU6M.js";import{a as ne}from"./chunk-XEWCMK3Z.js";import{f as _}from"./chunk-DCKFFFPG.js";import{a as te,b as ie}from"./chunk-EGX2IXWU.js";import{b as re}from"./chunk-B4GYB3XY.js";import{f as ee}from"./chunk-URQQBUUX.js";import{A as Y,F as Z,I as k,d as U,e as H,j as J,l as j,m as B,n as V,v as z,w as Q,y as K,z as X}from"./chunk-7FEY62ID.js";import{a as s}from"./chunk-TJBIBZMF.js";import{a as w,b as D,c as P,d as i,e as A,f as T,g as W,h as o}from"./chunk-NU7VF7MC.js";import{WithLoggerContext as E}from"@crossmint/common-sdk-base";var N,c,b,x,l,S,F,O,I,C,he,ue,q,G,R=class{constructor(e,r){A(this,C);A(this,N);A(this,c);A(this,b);A(this,x);A(this,l);A(this,S);A(this,F,[]);A(this,O);A(this,I,null);let{chain:t,address:n,owner:a,options:h,alias:u,recovery:d,apiRecoveryServerSignerAddress:g,apiDelegatedServerSignerAddresses:p,signers:y,signer:v}=e;T(this,c,r),this.chain=t,this.address=n,this.owner=a,T(this,N,h),this.alias=u;let m=null;g!=null?m=g:d.type==="server"&&_(d)&&(m=d.address),T(this,F,p!=null?p:[]),T(this,b,y!=null?y:[]),T(this,x,new se({chain:t,projectId:i(this,c).projectId,environment:i(this,c).environment,apiRecoveryAddress:m,apiDelegatedAddresses:i(this,F),knownOnChainAddresses:()=>[...i(this,b).filter(f=>f.type==="server"&&_(f)).map(f=>f.address),...i(this,F)]})),T(this,l,new ce({apiClient:r,options:h,chain:t,walletAddress:this.address,walletLocator:()=>this.walletLocator,serverSignerResolver:i(this,x),recovery:d,initialSigners:i(this,b),signers:()=>this.signers(),signer:v})),T(this,S,new ge({chain:t,walletAddress:this.address,options:h,signerManager:i(this,l),serverSignerResolver:i(this,x),signers:()=>this.signers(),addSigner:f=>this.addSigner(f),removeSigner:f=>this.removeSigner({type:"device",locator:f}),approveSignature:f=>this.approveSignatureAndWait(f),approveTransaction:f=>this.approveTransactionAndWait(f)})),T(this,O,this.initDefaultSigner())}get signer(){return i(this,l).activeSigner}waitForInit(){return o(this,null,function*(){yield i(this,O)})}initDefaultSigner(){return o(this,null,function*(){if(i(this,l).activeSigner!=null||(yield i(this,S).initDeviceSigner(),i(this,l).activeSigner!=null||i(this,S).needsRecovery))return;let e=i(this,b).length===0?i(this,l).recovery:i(this,b).length===1?i(this,b)[0]:null;if(e==null)return;let r=L(e.type),t=i(this,l).descriptorContext();if(!r.canAutoAssemble(e,t))return;let n=e===i(this,l).recovery;try{let a=r.buildInternalConfig(e,t);i(this,l).setActiveSigner(yield i(this,l).assemble(a,{isAdminSigner:n}))}catch(a){s.warn("wallet.initDefaultSigner.autoAssemblyFailed",{recoveryType:i(this,l).recovery.type,signerCount:i(this,b).length,error:a})}})}static getApiClient(e){return e.apiClient}static getOptions(e){return e.options}static getRecovery(e){return i(e,l).recovery}static getInitialSigners(e){return i(e,b)}static getApiRecoveryServerSignerAddress(e){var r;return(r=i(e,x).apiRecoveryAddress)!=null?r:void 0}static getApiDelegatedServerSignerAddresses(e){return i(e,F)}get apiClient(){return i(this,c)}get options(){return i(this,N)}get chainAdapter(){return te(this.chain)}resolveServerSignerApiLocator(e){return i(this,x).apiLocator(e)}get recovery(){return i(this,l).recovery}balances(e){return o(this,null,function*(){s.info("wallet.balances.start");let r=this.resolveChainForEnvironment(),t=this.chainAdapter.nativeToken,n=[t,"usdc",...e!=null?e:[]],a=yield i(this,c).getBalance(this.address,{chains:[r],tokens:n});if("error"in a)throw s.error("wallet.balances.error",{error:a}),new Error(`Failed to get balances for wallet: ${JSON.stringify(a.message)}`);return s.info("wallet.balances.success"),le(a,this.chain,t,e)})}stagingFund(e,r){return o(this,null,function*(){s.info("wallet.stagingFund.start",{amount:e,chain:r!=null?r:this.chain});let t=yield this.apiClient.fundWallet(this.address,{amount:e,token:"usdxm",chain:r!=null?r:this.chain});if("error"in t)throw s.error("wallet.stagingFund.error",{error:t}),new Error(`Failed to fund wallet: ${JSON.stringify(t.message)}`);return s.info("wallet.stagingFund.success"),t})}nfts(e){return o(this,null,function*(){let r=this.resolveChainForEnvironment(),t=yield i(this,c).getNfts(D(w({},e),{chain:r,address:this.address}));if(t!=null&&typeof t=="object"&&"error"in t)throw s.error("wallet.nfts.error",{error:t}),new Error(`Failed to get nfts: ${JSON.stringify(t.message)}`);return t})}transactions(){return o(this,null,function*(){let e=yield i(this,c).getTransactions(this.walletLocator);if("error"in e)throw new Error(`Failed to get transactions: ${JSON.stringify(e.message)}`);return e})}transaction(e){return o(this,null,function*(){let r=yield i(this,c).getTransaction(this.walletLocator,e);if("error"in r)throw new Error(`Failed to get transaction: ${JSON.stringify(r.message)}`);return r})}transfers(e){return o(this,null,function*(){let r=this.resolveChainForEnvironment(),t=yield this.apiClient.getTransfers(this.walletLocator,{chain:r,tokens:e.tokens,status:e.status});if("error"in t)throw new Error(`Failed to get transfers: ${JSON.stringify(t.message)}`);return t})}send(e,r,t,n){return o(this,null,function*(){let a=Number(t);if(Number.isNaN(a)||!Number.isFinite(a)||a<=0)throw new K(`Invalid transfer amount: "${t}". Amount must be a positive number greater than zero.`);let h=ae(e),u=this.resolveChainForEnvironment(),d=oe(r,u);s.info("wallet.send.start",w({recipient:h,token:d,amount:t},(n==null?void 0:n.transactionType)!=null?{transactionType:n.transactionType}:{})),yield this.preAuthIfNeeded();let g=i(this,l).require(),p;(n==null?void 0:n.signer)==null?p=g.locator():typeof n.signer=="string"?p=n.signer:p=this.resolveServerSignerApiLocator(n.signer);let y=w({recipient:h,amount:t,signer:p},(n==null?void 0:n.transactionType)!=null?{transactionType:n.transactionType}:{}),v=yield i(this,c).send(this.walletLocator,d,y);if("message"in v)throw s.error("wallet.send.error",{error:v}),new X(`Failed to send token: ${JSON.stringify(v.message)}`);if((n==null?void 0:n.prepareOnly)===!0)return s.info("wallet.send.prepared",{transactionId:v.id}),{hash:void 0,explorerLink:void 0,transactionId:v.id};let m=yield this.approveTransactionAndWait(v.id);return s.info("wallet.send.success",{transactionId:v.id,hash:m.hash}),m})}approveTransaction(e){return o(this,null,function*(){return console.warn("approveTransaction is deprecated. Use approve instead. This method will be removed in the next major version."),yield this.approve(e)})}approve(e){return o(this,null,function*(){if(s.info("wallet.approve.start",{transactionId:e.transactionId,signatureId:e.signatureId}),yield this.preAuthIfNeeded(),e.transactionId!=null){let r=yield this.approveTransactionAndWait(e.transactionId,e.options);return s.info("wallet.approve.success",{transactionId:e.transactionId}),r}if(e.signatureId!=null){let r=yield this.approveSignatureAndWait(e.signatureId,e.options);return s.info("wallet.approve.success",{signatureId:e.signatureId}),r}throw s.error("wallet.approve.error",{error:"Either transactionId or signatureId must be provided"}),new Error("Either transactionId or signatureId must be provided")})}addSigner(e,r){return o(this,null,function*(){s.info("wallet.addSigner.start");let t=typeof e=="object"&&"type"in e&&e.type==="server"?this.resolveServerSignerApiLocator(e):e;return i(this,l).withRecoverySigner(()=>o(this,null,function*(){var v;let n=typeof t=="string"?t:$(t),a=yield i(this,l).getSignerState(n);if(a.signer!=null){if(i(this,l).isApprovedSignerStatus(a.signer.status))return(r==null?void 0:r.scopes)!=null&&s.warn("wallet.addSigner.scopesIgnored",{reason:"signer already approved",signerLocator:n}),s.info("wallet.addSigner.alreadyApproved"),this.completeSignerRegistration(a.signer,null,r);if(a.pendingOperation!=null){if((r==null?void 0:r.scopes)!=null)throw new Error("Cannot apply scopes when resuming a pending signer registration. Remove the pending signer and register it again with the desired scopes.");return s.info("wallet.addSigner.resuming",{operationType:a.pendingOperation.type,operationId:a.pendingOperation.id}),this.completeSignerRegistration(a.signer,a.pendingOperation,r)}}let h=typeof t=="string"?t:L(t.type).addSignerPayload(t,i(this,l).descriptorContext()),d=this.chain!=="solana"&&this.chain!=="stellar"?(v=r==null?void 0:r.deployImmediately)!=null?v:!0:void 0,g=yield i(this,c).registerSigner(this.walletLocator,w(w({signer:h,chain:this.chainAdapter.addSignerChain(this.chain)},(r==null?void 0:r.scopes)!=null&&{scopes:r.scopes}),d!=null&&{deployImmediately:d}));if("error"in g)throw s.error("wallet.addSigner.error",{error:g}),g.code===j?new B(g.message):new J(`Failed to register signer: ${JSON.stringify(g.message)}`);let p=re(g,this.chain);if(p==null)throw new Error(`No approval found for chain ${this.chain} in register signer response`);let y=this.chainAdapter.extractAddSignerOperation(g,this.chain,{locator:n,type:e.type});return this.completeSignerRegistration(p,y,r)}))})}completeSignerRegistration(e,r,t){return o(this,null,function*(){if(t!=null&&t.prepareOnly){if(r==null)return w({},e);switch(r.type){case"transaction":{let n={transactionId:r.id};return s.info("wallet.addSigner.prepared",n),w(w({},e),n)}case"signature":{let n={signatureId:r.id};return s.info("wallet.addSigner.prepared",n),w(w({},e),n)}default:{let n=r.type;throw new Error(`Unknown pending operation type: ${n}`)}}}if(r!=null)switch(r.type){case"transaction":yield this.approveTransactionAndWait(r.id),s.info("wallet.addSigner.success",{transactionId:r.id});break;case"signature":yield this.approveSignatureAndWait(r.id),s.info("wallet.addSigner.success",{signatureId:r.id});break;default:{let n=r.type;throw new Error(`Unknown pending operation type: ${n}`)}}else s.info("wallet.addSigner.success");return D(w({},e),{status:"success"})})}removeSigner(e,r){return o(this,null,function*(){let t=this.resolveSignerLocator(e);return s.info("wallet.removeSigner.start",{signerLocator:t}),i(this,l).withRecoverySigner(()=>o(this,null,function*(){let n=yield i(this,c).removeSigner(this.walletLocator,t,{chain:this.chainAdapter.addSignerChain(this.chain)});if("error"in n)throw s.error("wallet.removeSigner.error",{error:n}),new Error(`Failed to remove signer: ${JSON.stringify(n)}`);let a=n.id;return r!=null&&r.prepareOnly?(s.info("wallet.removeSigner.prepared",{transactionId:a}),{transactionId:a,status:void 0}):(yield this.approveTransactionAndWait(a),s.info("wallet.removeSigner.success",{transactionId:a}),{transactionId:a,status:"success"})}))})}useSigner(e){return o(this,null,function*(){s.info("wallet.useSigner.start"),e.type==="server"&&i(this,x).resetDelegatedCache(),L(e.type).validateConfig(e);let r=!1;e.type==="device"?yield i(this,S).resolveAvailability(e):r=yield this.resolveNonDeviceSigner(e);let t=L(e.type).buildInternalConfig(e,i(this,l).descriptorContext()),n=$(e);i(this,l).setActiveSigner(yield i(this,l).assemble(t,{isAdminSigner:r})),s.info("wallet.useSigner.success",{signerLocator:n})})}resolveNonDeviceSigner(e){return o(this,null,function*(){if(e.type!=="passkey"&&e.type!=="server"&&this.isRecoverySigner(e))return i(this,S).onSignerSelected(),!0;if(e.type==="passkey"&&this.isPasskeyMissingId(e)&&!(yield this.tryAutoSelectPasskey(e))){if(this.isRecoverySigner(e))return i(this,S).onSignerSelected(),!0;throw new Error("No passkey signer is registered on this wallet.")}if(e.type==="server")return this.resolveServerSigner(e);let r=this.resolveSignerLocator(e);if(yield this.signerIsRegistered(r))return i(this,S).onSignerSelected(),!1;if(this.isRecoverySigner(e))return i(this,S).onSignerSelected(),!0;throw new Error(`Signer "${r}" is not registered in this wallet.`)})}resolveServerSigner(e){return o(this,null,function*(){let t=(yield this.signers()).map(a=>a.locator),n=i(this,x).resolveForUseSigner(e,t,()=>this.isRecoverySigner(e));switch(n.kind){case"delegated":return i(this,S).onSignerSelected(),!1;case"recovery":return i(this,l).stripSecretFromRecovery(),i(this,S).onSignerSelected(),!0;case"unregistered":throw new Error(n.message)}})}tryAutoSelectPasskey(e){return o(this,null,function*(){let t=(yield this.signers()).filter(n=>n.type==="passkey");if(t.length===0)return!1;if(t.length>1)throw new Error('Multiple passkey signers are registered on this wallet. Please specify the credential id: wallet.useSigner({ type: "passkey", id: "<credential-id>" })');return e.id=t[0].locator.replace("passkey:",""),!0})}resolveSignerLocator(e){return e.type==="server"?this.resolveServerSignerApiLocator(e):$(e)}isPasskeyMissingId(e){return e.id==null||e.id===""}signerIsRegistered(e){return o(this,null,function*(){return i(this,l).signerIsRegistered(e)})}isSignerApproved(e){return o(this,null,function*(){return i(this,l).isSignerApproved(e)})}needsRecovery(){return i(this,S).needsRecovery}recover(){return o(this,null,function*(){yield i(this,S).recover()})}signers(){return o(this,null,function*(){var a,h;s.info("wallet.signers.start");let e=yield i(this,c).getWallet(this.walletLocator);if("error"in e)throw s.error("wallet.signers.error",{error:e}),new H(JSON.stringify(e));if(!fe(e)){let u=e.type!=="smart"?`Wallet type ${e.type} not supported`:`Wallet chain type ${e.chainType} not supported`;throw s.error("wallet.signers.error",{error:u}),new U(u)}let r=(h=(a=e==null?void 0:e.config)==null?void 0:a.delegatedSigners)!=null?h:[],n=(yield Promise.all(r.map(u=>o(this,null,function*(){try{return(yield i(this,l).getSignerState(u.locator)).signer}catch(d){return s.warn("wallet.signers.mapSigner.failed",{locator:u.locator,error:d}),null}})))).filter(u=>u!=null);return s.info("wallet.signers.success",{count:n.length}),n})}get walletLocator(){if(i(this,c).isServerSide)return this.address;{let e=this.chainAdapter.walletLocatorPrefix,r=this.alias!=null?`:alias:${this.alias}`:"";return e+r}}get signerManager(){return i(this,l)}preAuthIfNeeded(){return o(this,null,function*(){yield i(this,O),i(this,I)==null&&T(this,I,this.recover());try{yield i(this,I)}finally{T(this,I,null)}let e=i(this,l).require();e instanceof ne&&(yield e.ensureAuthenticated())})}isRecoverySigner(e){let r=i(this,l).recovery;if(r==null||r.type!==e.type)return!1;let t=L(e.type);return t.matchesRecovery(e,r,i(this,l).descriptorContext())?(t.adoptsRecoveryConfigOnMatch&&i(this,l).adoptRecoveryConfig(e),!0):!1}resolveChainForEnvironment(){let e=ee(this.chain,i(this,c).environment);return e!==this.chain&&(this.chain=e),this.chain}approveTransactionAndWait(e,r){return o(this,null,function*(){return yield this.approveTransactionInternal(e,r),yield this.sleep(1e3),yield this.waitForTransaction(e)})}approveSignatureAndWait(e,r){return o(this,null,function*(){let t=yield this.approveSignatureInternal(e,r);return!("error"in t)&&t.status==="success"&&t.outputSignature!=null?{signature:t.outputSignature,signatureId:e}:(yield this.sleep(1e3),yield this.waitForSignature(e))})}approveSignatureInternal(e,r){return o(this,null,function*(){var d,g;if(!this.chainAdapter.supportsSignatures)throw new Error("Approving signatures is only supported for EVM smart wallets");let t=i(this,l).require(),n=yield i(this,c).getSignature(this.walletLocator,e);if("error"in n)throw k(n),new z(JSON.stringify(n));if(t.type==="api-key")return n;if((r==null?void 0:r.approval)!=null){let p=[r.approval];return yield this.executeApproveSignatureWithErrorHandling(e,p)}let a=(d=n.approvals)==null?void 0:d.pending;if(a==null||a.length===0)return n;let h=[...(g=r==null?void 0:r.additionalSigners)!=null?g:[],t],u=yield W(this,C,G).call(this,W(this,C,q).call(this,a),h,(p,y)=>p.signMessage(y.message));return yield this.executeApproveSignatureWithErrorHandling(e,u)})}approveTransactionInternal(e,r){return o(this,null,function*(){var d,g,p,y,v;let t=yield i(this,c).getTransaction(this.walletLocator,e);if("error"in t)throw k(t),new Y(JSON.stringify(t));yield(p=(g=(d=i(this,N))==null?void 0:d.callbacks)==null?void 0:g.onTransactionStart)==null?void 0:p.call(g);let n=i(this,l).require();if(n.type==="api-key")return t;if((r==null?void 0:r.approval)!=null){let m=[r.approval];return yield this.executeApproveTransactionWithErrorHandling(e,m)}let a=(y=t.approvals)==null?void 0:y.pending;if(a==null||a.length===0)return t;let h=[...(v=r==null?void 0:r.additionalSigners)!=null?v:[],n],u=yield W(this,C,G).call(this,W(this,C,q).call(this,a),h,(m,f)=>{let Se=m.type==="device",ve=t.chainType==="solana"&&"transaction"in t.onChain&&!Se?t.onChain.transaction:f.message;return m.signTransaction(ve)});return yield this.executeApproveTransactionWithErrorHandling(e,u)})}executeApproveTransactionWithErrorHandling(e,r){return o(this,null,function*(){s.info("wallet.approve: submitting approval to API",{transactionId:e});let t=yield i(this,c).approveTransaction(this.walletLocator,e,{approvals:r});if(t.error)throw k(t),new Z(JSON.stringify(t));return t})}executeApproveSignatureWithErrorHandling(e,r){return o(this,null,function*(){let t=yield i(this,c).approveSignature(this.walletLocator,e,{approvals:r});if(t.error)throw k(t),new Q(JSON.stringify(t));return t})}waitForSignature(e){return o(this,null,function*(){return yield pe(i(this,c),this.walletLocator,e)})}waitForTransaction(n){return o(this,arguments,function*(e,r=6e4,t={}){return yield de(i(this,c),this.walletLocator,e,w({timeoutMs:r},t))})}sleep(e){return o(this,null,function*(){return new Promise(r=>setTimeout(r,e))})}};N=new WeakMap,c=new WeakMap,b=new WeakMap,x=new WeakMap,l=new WeakMap,S=new WeakMap,F=new WeakMap,O=new WeakMap,I=new WeakMap,C=new WeakSet,he=function(e){return o(this,null,function*(){let r=yield i(this,S).tryResolveLocallyAvailableSigner(e);return r!=null&&s.info("wallet.approve.deviceSignerRecoveredViaFallback",{signerLocator:e}),r})},ue=function(e,r){return o(this,null,function*(){var n;let t=e.find(a=>a.locator()===r);if(t==null&&(t=(n=yield W(this,C,he).call(this,r))!=null?n:void 0),t==null)throw new J(`Signer ${r} not found in pending approvals`);return t})},q=function(e){return e.map(r=>{if(r.signer.type==="quorum")throw new V(`This wallet requires approval from a quorum signer (${r.signer.locator}), which is not yet supported by this SDK version`);return r})},G=function(e,r,t){return o(this,null,function*(){return yield Promise.all(e.map(n=>o(this,null,function*(){let a=yield W(this,C,ue).call(this,r,n.signer.locator),h=yield t(a,n);return D(w({},h),{signer:a.locator()})})))})},P([E({logger:s,methodName:"wallet.balances",buildContext(e){return{chain:e.chain,address:e.address}}})],R.prototype,"balances",1),P([E({logger:s,methodName:"wallet.stagingFund",buildContext(e){return{chain:e.chain,address:e.address}}})],R.prototype,"stagingFund",1),P([E({logger:s,methodName:"wallet.send",buildContext(e){return{chain:e.chain,address:e.address}}})],R.prototype,"send",1),P([E({logger:s,methodName:"wallet.approve",buildContext(e){return{chain:e.chain,address:e.address}}})],R.prototype,"approve",1),P([E({logger:s,methodName:"wallet.addSigner",buildContext(e){return{chain:e.chain,address:e.address}}})],R.prototype,"addSigner",1),P([E({logger:s,methodName:"wallet.removeSigner",buildContext(e){return{chain:e.chain,address:e.address}}})],R.prototype,"removeSigner",1),P([E({logger:s,methodName:"wallet.useSigner",buildContext(e){return{chain:e.chain,address:e.address}}})],R.prototype,"useSigner",1),P([E({logger:s,methodName:"wallet.recover",buildContext(e){return{chain:e.chain,address:e.address}}})],R.prototype,"recover",1),P([E({logger:s,methodName:"wallet.signers",buildContext(e){return{chain:e.chain,address:e.address}}})],R.prototype,"signers",1);function fe(M){return M.type==="smart"&&ie(M.chainType)}export{R as a};
|
|
1
|
+
import{a as ge}from"./chunk-SFEGES23.js";import{a as de,b as pe}from"./chunk-PX2QER4D.js";import{a as ce}from"./chunk-IRAZVSWU.js";import{a as le}from"./chunk-2LA5ZWPD.js";import{a as se}from"./chunk-OMTJMVSG.js";import{a as L}from"./chunk-JEKHYLBB.js";import{a as $}from"./chunk-VCOKK7C2.js";import{a as ae,b as oe}from"./chunk-ARQVCU6M.js";import{f as ee}from"./chunk-QG6GFZHT.js";import{a as ne}from"./chunk-PT6QTDSN.js";import{f as _}from"./chunk-DCKFFFPG.js";import{a as te,b as ie}from"./chunk-HLCF6MRD.js";import{b as re}from"./chunk-B4GYB3XY.js";import{A as Y,F as Z,I as k,d as U,e as H,j as J,l as j,m as B,n as V,v as z,w as Q,y as K,z as X}from"./chunk-7FEY62ID.js";import{a as s}from"./chunk-PSDE5X7P.js";import{a as w,b as D,c as P,d as i,e as A,f as T,g as W,h as o}from"./chunk-NU7VF7MC.js";import{WithLoggerContext as E}from"@crossmint/common-sdk-base";var N,c,b,x,l,S,F,O,I,C,he,ue,q,G,R=class{constructor(e,r){A(this,C);A(this,N);A(this,c);A(this,b);A(this,x);A(this,l);A(this,S);A(this,F,[]);A(this,O);A(this,I,null);let{chain:t,address:n,owner:a,options:h,alias:u,recovery:d,apiRecoveryServerSignerAddress:g,apiDelegatedServerSignerAddresses:p,signers:y,signer:v}=e;T(this,c,r),this.chain=t,this.address=n,this.owner=a,T(this,N,h),this.alias=u;let m=null;g!=null?m=g:d.type==="server"&&_(d)&&(m=d.address),T(this,F,p!=null?p:[]),T(this,b,y!=null?y:[]),T(this,x,new se({chain:t,projectId:i(this,c).projectId,environment:i(this,c).environment,apiRecoveryAddress:m,apiDelegatedAddresses:i(this,F),knownOnChainAddresses:()=>[...i(this,b).filter(f=>f.type==="server"&&_(f)).map(f=>f.address),...i(this,F)]})),T(this,l,new ce({apiClient:r,options:h,chain:t,walletAddress:this.address,walletLocator:()=>this.walletLocator,serverSignerResolver:i(this,x),recovery:d,initialSigners:i(this,b),signers:()=>this.signers(),signer:v})),T(this,S,new ge({chain:t,walletAddress:this.address,options:h,signerManager:i(this,l),serverSignerResolver:i(this,x),signers:()=>this.signers(),addSigner:f=>this.addSigner(f),removeSigner:f=>this.removeSigner({type:"device",locator:f}),approveSignature:f=>this.approveSignatureAndWait(f),approveTransaction:f=>this.approveTransactionAndWait(f)})),T(this,O,this.initDefaultSigner())}get signer(){return i(this,l).activeSigner}waitForInit(){return o(this,null,function*(){yield i(this,O)})}initDefaultSigner(){return o(this,null,function*(){if(i(this,l).activeSigner!=null||(yield i(this,S).initDeviceSigner(),i(this,l).activeSigner!=null||i(this,S).needsRecovery))return;let e=i(this,b).length===0?i(this,l).recovery:i(this,b).length===1?i(this,b)[0]:null;if(e==null)return;let r=L(e.type),t=i(this,l).descriptorContext();if(!r.canAutoAssemble(e,t))return;let n=e===i(this,l).recovery;try{let a=r.buildInternalConfig(e,t);i(this,l).setActiveSigner(yield i(this,l).assemble(a,{isAdminSigner:n}))}catch(a){s.warn("wallet.initDefaultSigner.autoAssemblyFailed",{recoveryType:i(this,l).recovery.type,signerCount:i(this,b).length,error:a})}})}static getApiClient(e){return e.apiClient}static getOptions(e){return e.options}static getRecovery(e){return i(e,l).recovery}static getInitialSigners(e){return i(e,b)}static getApiRecoveryServerSignerAddress(e){var r;return(r=i(e,x).apiRecoveryAddress)!=null?r:void 0}static getApiDelegatedServerSignerAddresses(e){return i(e,F)}get apiClient(){return i(this,c)}get options(){return i(this,N)}get chainAdapter(){return te(this.chain)}resolveServerSignerApiLocator(e){return i(this,x).apiLocator(e)}get recovery(){return i(this,l).recovery}balances(e){return o(this,null,function*(){s.info("wallet.balances.start");let r=this.resolveChainForEnvironment(),t=this.chainAdapter.nativeToken,n=[t,"usdc",...e!=null?e:[]],a=yield i(this,c).getBalance(this.address,{chains:[r],tokens:n});if("error"in a)throw s.error("wallet.balances.error",{error:a}),new Error(`Failed to get balances for wallet: ${JSON.stringify(a.message)}`);return s.info("wallet.balances.success"),le(a,this.chain,t,e)})}stagingFund(e,r){return o(this,null,function*(){s.info("wallet.stagingFund.start",{amount:e,chain:r!=null?r:this.chain});let t=yield this.apiClient.fundWallet(this.address,{amount:e,token:"usdxm",chain:r!=null?r:this.chain});if("error"in t)throw s.error("wallet.stagingFund.error",{error:t}),new Error(`Failed to fund wallet: ${JSON.stringify(t.message)}`);return s.info("wallet.stagingFund.success"),t})}nfts(e){return o(this,null,function*(){let r=this.resolveChainForEnvironment(),t=yield i(this,c).getNfts(D(w({},e),{chain:r,address:this.address}));if(t!=null&&typeof t=="object"&&"error"in t)throw s.error("wallet.nfts.error",{error:t}),new Error(`Failed to get nfts: ${JSON.stringify(t.message)}`);return t})}transactions(){return o(this,null,function*(){let e=yield i(this,c).getTransactions(this.walletLocator);if("error"in e)throw new Error(`Failed to get transactions: ${JSON.stringify(e.message)}`);return e})}transaction(e){return o(this,null,function*(){let r=yield i(this,c).getTransaction(this.walletLocator,e);if("error"in r)throw new Error(`Failed to get transaction: ${JSON.stringify(r.message)}`);return r})}transfers(e){return o(this,null,function*(){let r=this.resolveChainForEnvironment(),t=yield this.apiClient.getTransfers(this.walletLocator,{chain:r,tokens:e.tokens,status:e.status});if("error"in t)throw new Error(`Failed to get transfers: ${JSON.stringify(t.message)}`);return t})}send(e,r,t,n){return o(this,null,function*(){let a=Number(t);if(Number.isNaN(a)||!Number.isFinite(a)||a<=0)throw new K(`Invalid transfer amount: "${t}". Amount must be a positive number greater than zero.`);let h=ae(e),u=this.resolveChainForEnvironment(),d=oe(r,u);s.info("wallet.send.start",w({recipient:h,token:d,amount:t},(n==null?void 0:n.transactionType)!=null?{transactionType:n.transactionType}:{})),yield this.preAuthIfNeeded();let g=i(this,l).require(),p;(n==null?void 0:n.signer)==null?p=g.locator():typeof n.signer=="string"?p=n.signer:p=this.resolveServerSignerApiLocator(n.signer);let y=w({recipient:h,amount:t,signer:p},(n==null?void 0:n.transactionType)!=null?{transactionType:n.transactionType}:{}),v=yield i(this,c).send(this.walletLocator,d,y);if("message"in v)throw s.error("wallet.send.error",{error:v}),new X(`Failed to send token: ${JSON.stringify(v.message)}`);if((n==null?void 0:n.prepareOnly)===!0)return s.info("wallet.send.prepared",{transactionId:v.id}),{hash:void 0,explorerLink:void 0,transactionId:v.id};let m=yield this.approveTransactionAndWait(v.id);return s.info("wallet.send.success",{transactionId:v.id,hash:m.hash}),m})}approveTransaction(e){return o(this,null,function*(){return console.warn("approveTransaction is deprecated. Use approve instead. This method will be removed in the next major version."),yield this.approve(e)})}approve(e){return o(this,null,function*(){if(s.info("wallet.approve.start",{transactionId:e.transactionId,signatureId:e.signatureId}),yield this.preAuthIfNeeded(),e.transactionId!=null){let r=yield this.approveTransactionAndWait(e.transactionId,e.options);return s.info("wallet.approve.success",{transactionId:e.transactionId}),r}if(e.signatureId!=null){let r=yield this.approveSignatureAndWait(e.signatureId,e.options);return s.info("wallet.approve.success",{signatureId:e.signatureId}),r}throw s.error("wallet.approve.error",{error:"Either transactionId or signatureId must be provided"}),new Error("Either transactionId or signatureId must be provided")})}addSigner(e,r){return o(this,null,function*(){s.info("wallet.addSigner.start");let t=typeof e=="object"&&"type"in e&&e.type==="server"?this.resolveServerSignerApiLocator(e):e;return i(this,l).withRecoverySigner(()=>o(this,null,function*(){var v;let n=typeof t=="string"?t:$(t),a=yield i(this,l).getSignerState(n);if(a.signer!=null){if(i(this,l).isApprovedSignerStatus(a.signer.status))return(r==null?void 0:r.scopes)!=null&&s.warn("wallet.addSigner.scopesIgnored",{reason:"signer already approved",signerLocator:n}),s.info("wallet.addSigner.alreadyApproved"),this.completeSignerRegistration(a.signer,null,r);if(a.pendingOperation!=null){if((r==null?void 0:r.scopes)!=null)throw new Error("Cannot apply scopes when resuming a pending signer registration. Remove the pending signer and register it again with the desired scopes.");return s.info("wallet.addSigner.resuming",{operationType:a.pendingOperation.type,operationId:a.pendingOperation.id}),this.completeSignerRegistration(a.signer,a.pendingOperation,r)}}let h=typeof t=="string"?t:L(t.type).addSignerPayload(t,i(this,l).descriptorContext()),d=this.chain!=="solana"&&this.chain!=="stellar"?(v=r==null?void 0:r.deployImmediately)!=null?v:!0:void 0,g=yield i(this,c).registerSigner(this.walletLocator,w(w({signer:h,chain:this.chainAdapter.addSignerChain(this.chain)},(r==null?void 0:r.scopes)!=null&&{scopes:r.scopes}),d!=null&&{deployImmediately:d}));if("error"in g)throw s.error("wallet.addSigner.error",{error:g}),g.code===j?new B(g.message):new J(`Failed to register signer: ${JSON.stringify(g.message)}`);let p=re(g,this.chain);if(p==null)throw new Error(`No approval found for chain ${this.chain} in register signer response`);let y=this.chainAdapter.extractAddSignerOperation(g,this.chain,{locator:n,type:e.type});return this.completeSignerRegistration(p,y,r)}))})}completeSignerRegistration(e,r,t){return o(this,null,function*(){if(t!=null&&t.prepareOnly){if(r==null)return w({},e);switch(r.type){case"transaction":{let n={transactionId:r.id};return s.info("wallet.addSigner.prepared",n),w(w({},e),n)}case"signature":{let n={signatureId:r.id};return s.info("wallet.addSigner.prepared",n),w(w({},e),n)}default:{let n=r.type;throw new Error(`Unknown pending operation type: ${n}`)}}}if(r!=null)switch(r.type){case"transaction":yield this.approveTransactionAndWait(r.id),s.info("wallet.addSigner.success",{transactionId:r.id});break;case"signature":yield this.approveSignatureAndWait(r.id),s.info("wallet.addSigner.success",{signatureId:r.id});break;default:{let n=r.type;throw new Error(`Unknown pending operation type: ${n}`)}}else s.info("wallet.addSigner.success");return D(w({},e),{status:"success"})})}removeSigner(e,r){return o(this,null,function*(){let t=this.resolveSignerLocator(e);return s.info("wallet.removeSigner.start",{signerLocator:t}),i(this,l).withRecoverySigner(()=>o(this,null,function*(){let n=yield i(this,c).removeSigner(this.walletLocator,t,{chain:this.chainAdapter.addSignerChain(this.chain)});if("error"in n)throw s.error("wallet.removeSigner.error",{error:n}),new Error(`Failed to remove signer: ${JSON.stringify(n)}`);let a=n.id;return r!=null&&r.prepareOnly?(s.info("wallet.removeSigner.prepared",{transactionId:a}),{transactionId:a,status:void 0}):(yield this.approveTransactionAndWait(a),s.info("wallet.removeSigner.success",{transactionId:a}),{transactionId:a,status:"success"})}))})}useSigner(e){return o(this,null,function*(){s.info("wallet.useSigner.start"),e.type==="server"&&i(this,x).resetDelegatedCache(),L(e.type).validateConfig(e);let r=!1;e.type==="device"?yield i(this,S).resolveAvailability(e):r=yield this.resolveNonDeviceSigner(e);let t=L(e.type).buildInternalConfig(e,i(this,l).descriptorContext()),n=$(e);i(this,l).setActiveSigner(yield i(this,l).assemble(t,{isAdminSigner:r})),s.info("wallet.useSigner.success",{signerLocator:n})})}resolveNonDeviceSigner(e){return o(this,null,function*(){if(e.type!=="passkey"&&e.type!=="server"&&this.isRecoverySigner(e))return i(this,S).onSignerSelected(),!0;if(e.type==="passkey"&&this.isPasskeyMissingId(e)&&!(yield this.tryAutoSelectPasskey(e))){if(this.isRecoverySigner(e))return i(this,S).onSignerSelected(),!0;throw new Error("No passkey signer is registered on this wallet.")}if(e.type==="server")return this.resolveServerSigner(e);let r=this.resolveSignerLocator(e);if(yield this.signerIsRegistered(r))return i(this,S).onSignerSelected(),!1;if(this.isRecoverySigner(e))return i(this,S).onSignerSelected(),!0;throw new Error(`Signer "${r}" is not registered in this wallet.`)})}resolveServerSigner(e){return o(this,null,function*(){let t=(yield this.signers()).map(a=>a.locator),n=i(this,x).resolveForUseSigner(e,t,()=>this.isRecoverySigner(e));switch(n.kind){case"delegated":return i(this,S).onSignerSelected(),!1;case"recovery":return i(this,l).stripSecretFromRecovery(),i(this,S).onSignerSelected(),!0;case"unregistered":throw new Error(n.message)}})}tryAutoSelectPasskey(e){return o(this,null,function*(){let t=(yield this.signers()).filter(n=>n.type==="passkey");if(t.length===0)return!1;if(t.length>1)throw new Error('Multiple passkey signers are registered on this wallet. Please specify the credential id: wallet.useSigner({ type: "passkey", id: "<credential-id>" })');return e.id=t[0].locator.replace("passkey:",""),!0})}resolveSignerLocator(e){return e.type==="server"?this.resolveServerSignerApiLocator(e):$(e)}isPasskeyMissingId(e){return e.id==null||e.id===""}signerIsRegistered(e){return o(this,null,function*(){return i(this,l).signerIsRegistered(e)})}isSignerApproved(e){return o(this,null,function*(){return i(this,l).isSignerApproved(e)})}needsRecovery(){return i(this,S).needsRecovery}recover(){return o(this,null,function*(){yield i(this,S).recover()})}signers(){return o(this,null,function*(){var a,h;s.info("wallet.signers.start");let e=yield i(this,c).getWallet(this.walletLocator);if("error"in e)throw s.error("wallet.signers.error",{error:e}),new H(JSON.stringify(e));if(!fe(e)){let u=e.type!=="smart"?`Wallet type ${e.type} not supported`:`Wallet chain type ${e.chainType} not supported`;throw s.error("wallet.signers.error",{error:u}),new U(u)}let r=(h=(a=e==null?void 0:e.config)==null?void 0:a.delegatedSigners)!=null?h:[],n=(yield Promise.all(r.map(u=>o(this,null,function*(){try{return(yield i(this,l).getSignerState(u.locator)).signer}catch(d){return s.warn("wallet.signers.mapSigner.failed",{locator:u.locator,error:d}),null}})))).filter(u=>u!=null);return s.info("wallet.signers.success",{count:n.length}),n})}get walletLocator(){if(i(this,c).isServerSide)return this.address;{let e=this.chainAdapter.walletLocatorPrefix,r=this.alias!=null?`:alias:${this.alias}`:"";return e+r}}get signerManager(){return i(this,l)}preAuthIfNeeded(){return o(this,null,function*(){yield i(this,O),i(this,I)==null&&T(this,I,this.recover());try{yield i(this,I)}finally{T(this,I,null)}let e=i(this,l).require();e instanceof ne&&(yield e.ensureAuthenticated())})}isRecoverySigner(e){let r=i(this,l).recovery;if(r==null||r.type!==e.type)return!1;let t=L(e.type);return t.matchesRecovery(e,r,i(this,l).descriptorContext())?(t.adoptsRecoveryConfigOnMatch&&i(this,l).adoptRecoveryConfig(e),!0):!1}resolveChainForEnvironment(){let e=ee(this.chain,i(this,c).environment);return e!==this.chain&&(this.chain=e),this.chain}approveTransactionAndWait(e,r){return o(this,null,function*(){return yield this.approveTransactionInternal(e,r),yield this.sleep(1e3),yield this.waitForTransaction(e)})}approveSignatureAndWait(e,r){return o(this,null,function*(){let t=yield this.approveSignatureInternal(e,r);return!("error"in t)&&t.status==="success"&&t.outputSignature!=null?{signature:t.outputSignature,signatureId:e}:(yield this.sleep(1e3),yield this.waitForSignature(e))})}approveSignatureInternal(e,r){return o(this,null,function*(){var d,g;if(!this.chainAdapter.supportsSignatures)throw new Error("Approving signatures is only supported for EVM smart wallets");let t=i(this,l).require(),n=yield i(this,c).getSignature(this.walletLocator,e);if("error"in n)throw k(n),new z(JSON.stringify(n));if(t.type==="api-key")return n;if((r==null?void 0:r.approval)!=null){let p=[r.approval];return yield this.executeApproveSignatureWithErrorHandling(e,p)}let a=(d=n.approvals)==null?void 0:d.pending;if(a==null||a.length===0)return n;let h=[...(g=r==null?void 0:r.additionalSigners)!=null?g:[],t],u=yield W(this,C,G).call(this,W(this,C,q).call(this,a),h,(p,y)=>p.signMessage(y.message));return yield this.executeApproveSignatureWithErrorHandling(e,u)})}approveTransactionInternal(e,r){return o(this,null,function*(){var d,g,p,y,v;let t=yield i(this,c).getTransaction(this.walletLocator,e);if("error"in t)throw k(t),new Y(JSON.stringify(t));yield(p=(g=(d=i(this,N))==null?void 0:d.callbacks)==null?void 0:g.onTransactionStart)==null?void 0:p.call(g);let n=i(this,l).require();if(n.type==="api-key")return t;if((r==null?void 0:r.approval)!=null){let m=[r.approval];return yield this.executeApproveTransactionWithErrorHandling(e,m)}let a=(y=t.approvals)==null?void 0:y.pending;if(a==null||a.length===0)return t;let h=[...(v=r==null?void 0:r.additionalSigners)!=null?v:[],n],u=yield W(this,C,G).call(this,W(this,C,q).call(this,a),h,(m,f)=>{let Se=m.type==="device",ve=t.chainType==="solana"&&"transaction"in t.onChain&&!Se?t.onChain.transaction:f.message;return m.signTransaction(ve)});return yield this.executeApproveTransactionWithErrorHandling(e,u)})}executeApproveTransactionWithErrorHandling(e,r){return o(this,null,function*(){s.info("wallet.approve: submitting approval to API",{transactionId:e});let t=yield i(this,c).approveTransaction(this.walletLocator,e,{approvals:r});if(t.error)throw k(t),new Z(JSON.stringify(t));return t})}executeApproveSignatureWithErrorHandling(e,r){return o(this,null,function*(){let t=yield i(this,c).approveSignature(this.walletLocator,e,{approvals:r});if(t.error)throw k(t),new Q(JSON.stringify(t));return t})}waitForSignature(e){return o(this,null,function*(){return yield pe(i(this,c),this.walletLocator,e)})}waitForTransaction(n){return o(this,arguments,function*(e,r=6e4,t={}){return yield de(i(this,c),this.walletLocator,e,w({timeoutMs:r},t))})}sleep(e){return o(this,null,function*(){return new Promise(r=>setTimeout(r,e))})}};N=new WeakMap,c=new WeakMap,b=new WeakMap,x=new WeakMap,l=new WeakMap,S=new WeakMap,F=new WeakMap,O=new WeakMap,I=new WeakMap,C=new WeakSet,he=function(e){return o(this,null,function*(){let r=yield i(this,S).tryResolveLocallyAvailableSigner(e);return r!=null&&s.info("wallet.approve.deviceSignerRecoveredViaFallback",{signerLocator:e}),r})},ue=function(e,r){return o(this,null,function*(){var n;let t=e.find(a=>a.locator()===r);if(t==null&&(t=(n=yield W(this,C,he).call(this,r))!=null?n:void 0),t==null)throw new J(`Signer ${r} not found in pending approvals`);return t})},q=function(e){return e.map(r=>{if(r.signer.type==="quorum")throw new V(`This wallet requires approval from a quorum signer (${r.signer.locator}), which is not yet supported by this SDK version`);return r})},G=function(e,r,t){return o(this,null,function*(){return yield Promise.all(e.map(n=>o(this,null,function*(){let a=yield W(this,C,ue).call(this,r,n.signer.locator),h=yield t(a,n);return D(w({},h),{signer:a.locator()})})))})},P([E({logger:s,methodName:"wallet.balances",buildContext(e){return{chain:e.chain,address:e.address}}})],R.prototype,"balances",1),P([E({logger:s,methodName:"wallet.stagingFund",buildContext(e){return{chain:e.chain,address:e.address}}})],R.prototype,"stagingFund",1),P([E({logger:s,methodName:"wallet.send",buildContext(e){return{chain:e.chain,address:e.address}}})],R.prototype,"send",1),P([E({logger:s,methodName:"wallet.approve",buildContext(e){return{chain:e.chain,address:e.address}}})],R.prototype,"approve",1),P([E({logger:s,methodName:"wallet.addSigner",buildContext(e){return{chain:e.chain,address:e.address}}})],R.prototype,"addSigner",1),P([E({logger:s,methodName:"wallet.removeSigner",buildContext(e){return{chain:e.chain,address:e.address}}})],R.prototype,"removeSigner",1),P([E({logger:s,methodName:"wallet.useSigner",buildContext(e){return{chain:e.chain,address:e.address}}})],R.prototype,"useSigner",1),P([E({logger:s,methodName:"wallet.recover",buildContext(e){return{chain:e.chain,address:e.address}}})],R.prototype,"recover",1),P([E({logger:s,methodName:"wallet.signers",buildContext(e){return{chain:e.chain,address:e.address}}})],R.prototype,"signers",1);function fe(M){return M.type==="smart"&&ie(M.chainType)}export{R as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as s,b as o}from"./chunk-
|
|
1
|
+
import{a as s,b as o}from"./chunk-PT6QTDSN.js";import{a as r}from"./chunk-PSDE5X7P.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};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-YRZHJB2T.cjs');var _chunkYEHBDKR3cjs = require('./chunk-YEHBDKR3.cjs');var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-YRZHJB2T.cjs');var _chunkYEHBDKR3cjs = require('./chunk-YEHBDKR3.cjs');var _chunkUPXD2IIWcjs = require('./chunk-UPXD2IIW.cjs');var _chunkB2275OIHcjs = require('./chunk-B2275OIH.cjs');var _chunk2DB3DLAAcjs = require('./chunk-2DB3DLAA.cjs');var _chunkOIHXWQZ3cjs = require('./chunk-OIHXWQZ3.cjs');require('./chunk-JLKWUFQU.cjs');var _chunkHI7CAJMUcjs = require('./chunk-HI7CAJMU.cjs');require('./chunk-63Y6LGFL.cjs');require('./chunk-QK57CJTH.cjs');require('./chunk-GPIDFXMJ.cjs');require('./chunk-CUHDOBKN.cjs');var _chunkGMU3ZYLScjs = require('./chunk-GMU3ZYLS.cjs');require('./chunk-SHFB7XOM.cjs');require('./chunk-I3H3U7XW.cjs');var _chunkANE62EYKcjs = require('./chunk-ANE62EYK.cjs');require('./chunk-GSNFNRH2.cjs');var _chunk3VYGTPRFcjs = require('./chunk-3VYGTPRF.cjs');require('./chunk-44ICOOCJ.cjs');require('./chunk-IW4FVUP5.cjs');require('./chunk-GUFTPTSI.cjs');require('./chunk-EBQT52SL.cjs');require('./chunk-JEJYT3WD.cjs');require('./chunk-MIPKK2GZ.cjs');require('./chunk-UWX7ID4X.cjs');require('./chunk-WOQNCBUX.cjs');require('./chunk-W6L7J3KL.cjs');require('./chunk-7SOKSLRQ.cjs');require('./chunk-UP5EGWNN.cjs');require('./chunk-K7C5ZVNY.cjs');require('./chunk-5X4EOJFG.cjs');require('./chunk-HRUMWG2F.cjs');require('./chunk-IR5WN6FQ.cjs');require('./chunk-GEY574TH.cjs');require('./chunk-UE3WVHTM.cjs');require('./chunk-2GFL3HTC.cjs');require('./chunk-5IC7UWND.cjs');require('./chunk-KULR5B4O.cjs');require('./chunk-IGRPHTXZ.cjs');require('./chunk-Q66YRLSW.cjs');require('./chunk-VMDJJX7P.cjs');require('./chunk-HJH2S644.cjs');require('./chunk-AK3REMFI.cjs');require('./chunk-PO6S7UR3.cjs');require('./chunk-I7R32ENT.cjs');require('./chunk-U34JZIST.cjs');require('./chunk-EY352O5T.cjs');require('./chunk-HH6B2NTT.cjs');require('./chunk-ATIC4ENG.cjs');require('./chunk-2YZQ4YYU.cjs');require('./chunk-5FH7WFWL.cjs');require('./chunk-FQZXBS7L.cjs');require('./chunk-5FVDLMWW.cjs');var _chunkQPCZFIUVcjs = require('./chunk-QPCZFIUV.cjs');require('./chunk-LWA3SX6Z.cjs');require('./chunk-XWQC6G7N.cjs');require('./chunk-R4SBFRTM.cjs');require('./chunk-HYWIWJ6H.cjs');require('./chunk-SCEPJO4Q.cjs');require('./chunk-LMHH6ODX.cjs');require('./chunk-CDHMNLZ6.cjs');require('./chunk-6HXIZLEQ.cjs');var _chunkJJIO5FRQcjs = require('./chunk-JJIO5FRQ.cjs');require('./chunk-ECAM5KTH.cjs');require('./chunk-PKREDLDO.cjs');require('./chunk-LUFASRMR.cjs');require('./chunk-LXRF6CRW.cjs');require('./chunk-VXFJQERS.cjs');require('./chunk-JNKTRQPS.cjs');require('./chunk-ENU3EKBG.cjs');var _chunkXZ4NKVEBcjs = require('./chunk-XZ4NKVEB.cjs');require('./chunk-CCIGWTAO.cjs');require('./chunk-BOMJ4MFZ.cjs');require('./chunk-V7LXNAA3.cjs');require('./chunk-DSIFRRBS.cjs');exports.AuthRejectedError = _chunkQPCZFIUVcjs.a; exports.CrossmintWallets = _chunkOIHXWQZ3cjs.b; exports.DeviceSignerKeyStorage = _chunk3VYGTPRFcjs.a; exports.EVMWallet = _chunkUPXD2IIWcjs.a; exports.IframeDeviceSignerKeyStorage = _chunkANE62EYKcjs.a; exports.InvalidTransferAmountError = _chunkXZ4NKVEBcjs.y; exports.JWTDecryptionError = _chunkXZ4NKVEBcjs.M; exports.JWTExpiredError = _chunkXZ4NKVEBcjs.K; exports.JWTIdentifierError = _chunkXZ4NKVEBcjs.N; exports.JWTInvalidError = _chunkXZ4NKVEBcjs.L; exports.KeyExportError = _chunkQPCZFIUVcjs.d; exports.NotAuthorizedError = _chunkXZ4NKVEBcjs.J; exports.OnboardingSessionExpiredError = _chunkQPCZFIUVcjs.e; exports.OtpValidationError = _chunkQPCZFIUVcjs.b; exports.QuorumSignerNotSupportedError = _chunkXZ4NKVEBcjs.n; exports.SignerStatusError = _chunkQPCZFIUVcjs.c; exports.SolanaWallet = _chunkB2275OIHcjs.a; exports.StellarWallet = _chunk2DB3DLAAcjs.a; exports.UnsupportedBrowserError = _chunkXZ4NKVEBcjs.o; exports.Wallet = _chunkHI7CAJMUcjs.a; exports.WalletNotAvailableError = _chunkXZ4NKVEBcjs.e; exports.WalletsApiClient = _chunkJJIO5FRQcjs.a; exports.createCrossmint = _chunkOIHXWQZ3cjs.a; exports.createDeviceSigner = _chunkGMU3ZYLScjs.a; exports.createServerSigner = _chunkYEHBDKR3cjs.a; exports.isExportableSignerAdapter = _chunkQPCZFIUVcjs.g;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { CrossmintWallets } from './sdk.cjs';
|
|
2
2
|
export { InvalidTransferAmountError, QuorumSignerNotSupportedError, UnsupportedBrowserError, WalletNotAvailableError } from './utils/errors.cjs';
|
|
3
3
|
export { ApiClient as WalletsApiClient } from './api/client.cjs';
|
|
4
|
-
export { A as AddSignerOptions, a as ApiKeySignerLocator, b as ApproveOptions, c as ApproveParams, d as AuthRejectedError, B as Balances, C as Callbacks, e as ClientSideWalletArgsFor, f as ClientSideWalletCreateArgs, D as DeviceSignerConfig, g as DeviceSignerLocator, E as EVMTransactionInput, h as EmailSignerConfig, i as EmailSignerLocator, j as ExportSignerTEEConnection, k as ExportableSignerAdapter, l as ExternalWalletRegistrationConfig, m as ExternalWalletSignerConfigForChain, n as ExternalWalletSignerLocator, K as KeyExportError, O as OnboardingSessionExpiredError, o as OtpValidationError, P as PasskeySignerLocator, p as PhoneSignerConfig, q as PhoneSignerLocator, R as RegisterSignerPasskeyParams, r as RemoveSignerOptions, S as Scope, s as ServerSignerConfig, t as Signature, u as Signer, v as SignerAdapter, w as SignerConfigForChain, x as SignerLocator, y as SignerStatus, z as SignerStatusError, F as SolanaTransactionInput, T as Transaction, G as TransferScope, H as Transfers, W as WalletArgsFor, I as WalletCreateArgs, J as WalletOptions, L as WalletPlugin, M as isExportableSignerAdapter } from './types-
|
|
4
|
+
export { A as AddSignerOptions, a as ApiKeySignerLocator, b as ApproveOptions, c as ApproveParams, d as AuthRejectedError, B as Balances, C as Callbacks, e as ClientSideWalletArgsFor, f as ClientSideWalletCreateArgs, D as DeviceSignerConfig, g as DeviceSignerLocator, E as EVMTransactionInput, h as EmailSignerConfig, i as EmailSignerLocator, j as ExportSignerTEEConnection, k as ExportableSignerAdapter, l as ExternalWalletRegistrationConfig, m as ExternalWalletSignerConfigForChain, n as ExternalWalletSignerLocator, K as KeyExportError, O as OnboardingSessionExpiredError, o as OtpValidationError, P as PasskeySignerLocator, p as PhoneSignerConfig, q as PhoneSignerLocator, R as RegisterSignerPasskeyParams, r as RemoveSignerOptions, S as Scope, s as ServerSignerConfig, t as Signature, u as Signer, v as SignerAdapter, w as SignerConfigForChain, x as SignerLocator, y as SignerStatus, z as SignerStatusError, F as SolanaTransactionInput, T as Transaction, G as TransferScope, H as Transfers, W as WalletArgsFor, I as WalletCreateArgs, J as WalletOptions, L as WalletPlugin, M as isExportableSignerAdapter } from './types-86FbKjRz.cjs';
|
|
5
5
|
export { Wallet } from './wallets/wallet.cjs';
|
|
6
6
|
export { SolanaWallet } from './wallets/solana.cjs';
|
|
7
7
|
export { EVMWallet } from './wallets/evm.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { CrossmintWallets } from './sdk.js';
|
|
2
2
|
export { InvalidTransferAmountError, QuorumSignerNotSupportedError, UnsupportedBrowserError, WalletNotAvailableError } from './utils/errors.js';
|
|
3
3
|
export { ApiClient as WalletsApiClient } from './api/client.js';
|
|
4
|
-
export { A as AddSignerOptions, a as ApiKeySignerLocator, b as ApproveOptions, c as ApproveParams, d as AuthRejectedError, B as Balances, C as Callbacks, e as ClientSideWalletArgsFor, f as ClientSideWalletCreateArgs, D as DeviceSignerConfig, g as DeviceSignerLocator, E as EVMTransactionInput, h as EmailSignerConfig, i as EmailSignerLocator, j as ExportSignerTEEConnection, k as ExportableSignerAdapter, l as ExternalWalletRegistrationConfig, m as ExternalWalletSignerConfigForChain, n as ExternalWalletSignerLocator, K as KeyExportError, O as OnboardingSessionExpiredError, o as OtpValidationError, P as PasskeySignerLocator, p as PhoneSignerConfig, q as PhoneSignerLocator, R as RegisterSignerPasskeyParams, r as RemoveSignerOptions, S as Scope, s as ServerSignerConfig, t as Signature, u as Signer, v as SignerAdapter, w as SignerConfigForChain, x as SignerLocator, y as SignerStatus, z as SignerStatusError, F as SolanaTransactionInput, T as Transaction, G as TransferScope, H as Transfers, W as WalletArgsFor, I as WalletCreateArgs, J as WalletOptions, L as WalletPlugin, M as isExportableSignerAdapter } from './types-
|
|
4
|
+
export { A as AddSignerOptions, a as ApiKeySignerLocator, b as ApproveOptions, c as ApproveParams, d as AuthRejectedError, B as Balances, C as Callbacks, e as ClientSideWalletArgsFor, f as ClientSideWalletCreateArgs, D as DeviceSignerConfig, g as DeviceSignerLocator, E as EVMTransactionInput, h as EmailSignerConfig, i as EmailSignerLocator, j as ExportSignerTEEConnection, k as ExportableSignerAdapter, l as ExternalWalletRegistrationConfig, m as ExternalWalletSignerConfigForChain, n as ExternalWalletSignerLocator, K as KeyExportError, O as OnboardingSessionExpiredError, o as OtpValidationError, P as PasskeySignerLocator, p as PhoneSignerConfig, q as PhoneSignerLocator, R as RegisterSignerPasskeyParams, r as RemoveSignerOptions, S as Scope, s as ServerSignerConfig, t as Signature, u as Signer, v as SignerAdapter, w as SignerConfigForChain, x as SignerLocator, y as SignerStatus, z as SignerStatusError, F as SolanaTransactionInput, T as Transaction, G as TransferScope, H as Transfers, W as WalletArgsFor, I as WalletCreateArgs, J as WalletOptions, L as WalletPlugin, M as isExportableSignerAdapter } from './types-BcjKqQz3.js';
|
|
5
5
|
export { Wallet } from './wallets/wallet.js';
|
|
6
6
|
export { SolanaWallet } from './wallets/solana.js';
|
|
7
7
|
export { EVMWallet } from './wallets/evm.js';
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk-DTGCFFNW.js";import{a as T}from"./chunk-WTIV4TTS.js";import{a as u}from"./chunk-
|
|
1
|
+
import"./chunk-DTGCFFNW.js";import{a as T}from"./chunk-WTIV4TTS.js";import{a as u}from"./chunk-6XKILBKX.js";import{a as A}from"./chunk-F42HGJBY.js";import{a as h}from"./chunk-HEXHZLES.js";import{a as v,b as y}from"./chunk-B5ERXUGO.js";import"./chunk-XPBFCTYU.js";import{a as d}from"./chunk-YJNAB33W.js";import"./chunk-SFEGES23.js";import"./chunk-PX2QER4D.js";import"./chunk-IRAZVSWU.js";import"./chunk-TOAFCAVT.js";import{a as W}from"./chunk-5LNDUSMZ.js";import"./chunk-2LA5ZWPD.js";import"./chunk-OMTJMVSG.js";import{a as C}from"./chunk-LT6GDX64.js";import"./chunk-NZXYWQE5.js";import{a as x}from"./chunk-IOSADDL5.js";import"./chunk-JEKHYLBB.js";import"./chunk-OEMMPPUX.js";import"./chunk-5HMRFOCH.js";import"./chunk-OE6CWWFM.js";import"./chunk-7BW7B47N.js";import"./chunk-VTTD4HPY.js";import"./chunk-TM45QNB3.js";import"./chunk-W36RYDND.js";import"./chunk-VCOKK7C2.js";import"./chunk-STRSYJNY.js";import"./chunk-ARQVCU6M.js";import"./chunk-QG6GFZHT.js";import"./chunk-FT5EVMLB.js";import"./chunk-SVIKBM3S.js";import"./chunk-KKQBZXFE.js";import"./chunk-S3DYQVRD.js";import"./chunk-KUP7H7X2.js";import"./chunk-GQDDB57A.js";import"./chunk-L52GDMSH.js";import"./chunk-SEOBV6KR.js";import"./chunk-QM3BB4E2.js";import"./chunk-TSJUK3ED.js";import"./chunk-277G6KNG.js";import"./chunk-IQ3QQ4M6.js";import"./chunk-GA7EPR4Z.js";import"./chunk-YDZRBHS3.js";import"./chunk-AQRU3SSV.js";import"./chunk-7JR76V7P.js";import"./chunk-YWFVK6C5.js";import"./chunk-PT6QTDSN.js";import"./chunk-IHMMTMFG.js";import"./chunk-E3H6RZHM.js";import"./chunk-EM3D5Q3A.js";import"./chunk-3QKB6K3J.js";import"./chunk-K7BPGUFU.js";import{a as p,b as s,c as E,d as f,e as c,g as m}from"./chunk-DCKFFFPG.js";import"./chunk-FJPAMX7L.js";import"./chunk-MN2BGRRJ.js";import"./chunk-FQ5F3VYJ.js";import"./chunk-HAQMNZO5.js";import"./chunk-2YLRFJ66.js";import"./chunk-TMOWGJ5Z.js";import"./chunk-MLROTECD.js";import"./chunk-5IFDVB4Y.js";import{a as S}from"./chunk-WQQOCTIU.js";import"./chunk-KBJA7JDT.js";import"./chunk-HLCF6MRD.js";import"./chunk-DSLYYS6N.js";import"./chunk-NHXWNB3V.js";import"./chunk-2IBE7HWB.js";import"./chunk-B4GYB3XY.js";import"./chunk-OQZTL6ZG.js";import{J as n,K as i,L as a,M as l,N as g,e as r,n as e,o as t,y as o}from"./chunk-7FEY62ID.js";import"./chunk-455NK5LB.js";import"./chunk-PSDE5X7P.js";import"./chunk-47M4FIGW.js";import"./chunk-NU7VF7MC.js";export{p as AuthRejectedError,y as CrossmintWallets,x as DeviceSignerKeyStorage,u as EVMWallet,C as IframeDeviceSignerKeyStorage,o as InvalidTransferAmountError,l as JWTDecryptionError,i as JWTExpiredError,g as JWTIdentifierError,a as JWTInvalidError,f as KeyExportError,n as NotAuthorizedError,c as OnboardingSessionExpiredError,s as OtpValidationError,e as QuorumSignerNotSupportedError,E as SignerStatusError,A as SolanaWallet,h as StellarWallet,t as UnsupportedBrowserError,d as Wallet,r as WalletNotAvailableError,S as WalletsApiClient,v as createCrossmint,W as createDeviceSigner,T as createServerSigner,m as isExportableSignerAdapter};
|
package/dist/logger/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-CCIGWTAO.cjs');var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-CCIGWTAO.cjs');var _chunkBOMJ4MFZcjs = require('../chunk-BOMJ4MFZ.cjs');require('../chunk-V7LXNAA3.cjs');require('../chunk-DSIFRRBS.cjs');exports.initWalletsLogger = _chunkBOMJ4MFZcjs.b; exports.walletsLogger = _chunkBOMJ4MFZcjs.a;
|
package/dist/logger/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../chunk-455NK5LB.js";import{a,b}from"../chunk-
|
|
1
|
+
import"../chunk-455NK5LB.js";import{a,b}from"../chunk-PSDE5X7P.js";import"../chunk-47M4FIGW.js";import"../chunk-NU7VF7MC.js";export{b as initWalletsLogger,a as walletsLogger};
|
package/dist/logger/init.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBOMJ4MFZcjs = require('../chunk-BOMJ4MFZ.cjs');require('../chunk-V7LXNAA3.cjs');require('../chunk-DSIFRRBS.cjs');exports.initWalletsLogger = _chunkBOMJ4MFZcjs.b; exports.walletsLogger = _chunkBOMJ4MFZcjs.a;
|
package/dist/logger/init.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b}from"../chunk-
|
|
1
|
+
import{a,b}from"../chunk-PSDE5X7P.js";import"../chunk-47M4FIGW.js";import"../chunk-NU7VF7MC.js";export{b as initWalletsLogger,a as walletsLogger};
|
package/dist/sdk.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkOIHXWQZ3cjs = require('./chunk-OIHXWQZ3.cjs');require('./chunk-JLKWUFQU.cjs');require('./chunk-HI7CAJMU.cjs');require('./chunk-63Y6LGFL.cjs');require('./chunk-QK57CJTH.cjs');require('./chunk-GPIDFXMJ.cjs');require('./chunk-CUHDOBKN.cjs');require('./chunk-GMU3ZYLS.cjs');require('./chunk-SHFB7XOM.cjs');require('./chunk-I3H3U7XW.cjs');require('./chunk-ANE62EYK.cjs');require('./chunk-GSNFNRH2.cjs');require('./chunk-3VYGTPRF.cjs');require('./chunk-44ICOOCJ.cjs');require('./chunk-IW4FVUP5.cjs');require('./chunk-GUFTPTSI.cjs');require('./chunk-EBQT52SL.cjs');require('./chunk-JEJYT3WD.cjs');require('./chunk-MIPKK2GZ.cjs');require('./chunk-UWX7ID4X.cjs');require('./chunk-WOQNCBUX.cjs');require('./chunk-W6L7J3KL.cjs');require('./chunk-7SOKSLRQ.cjs');require('./chunk-UP5EGWNN.cjs');require('./chunk-K7C5ZVNY.cjs');require('./chunk-5X4EOJFG.cjs');require('./chunk-HRUMWG2F.cjs');require('./chunk-IR5WN6FQ.cjs');require('./chunk-GEY574TH.cjs');require('./chunk-UE3WVHTM.cjs');require('./chunk-2GFL3HTC.cjs');require('./chunk-5IC7UWND.cjs');require('./chunk-KULR5B4O.cjs');require('./chunk-IGRPHTXZ.cjs');require('./chunk-Q66YRLSW.cjs');require('./chunk-VMDJJX7P.cjs');require('./chunk-HJH2S644.cjs');require('./chunk-AK3REMFI.cjs');require('./chunk-PO6S7UR3.cjs');require('./chunk-I7R32ENT.cjs');require('./chunk-U34JZIST.cjs');require('./chunk-EY352O5T.cjs');require('./chunk-HH6B2NTT.cjs');require('./chunk-ATIC4ENG.cjs');require('./chunk-2YZQ4YYU.cjs');require('./chunk-5FH7WFWL.cjs');require('./chunk-FQZXBS7L.cjs');require('./chunk-5FVDLMWW.cjs');require('./chunk-QPCZFIUV.cjs');require('./chunk-LWA3SX6Z.cjs');require('./chunk-XWQC6G7N.cjs');require('./chunk-R4SBFRTM.cjs');require('./chunk-HYWIWJ6H.cjs');require('./chunk-SCEPJO4Q.cjs');require('./chunk-LMHH6ODX.cjs');require('./chunk-CDHMNLZ6.cjs');require('./chunk-6HXIZLEQ.cjs');require('./chunk-JJIO5FRQ.cjs');require('./chunk-ECAM5KTH.cjs');require('./chunk-PKREDLDO.cjs');require('./chunk-LUFASRMR.cjs');require('./chunk-LXRF6CRW.cjs');require('./chunk-VXFJQERS.cjs');require('./chunk-JNKTRQPS.cjs');require('./chunk-ENU3EKBG.cjs');require('./chunk-XZ4NKVEB.cjs');require('./chunk-CCIGWTAO.cjs');require('./chunk-BOMJ4MFZ.cjs');require('./chunk-V7LXNAA3.cjs');require('./chunk-DSIFRRBS.cjs');exports.CrossmintWallets = _chunkOIHXWQZ3cjs.b; exports.createCrossmint = _chunkOIHXWQZ3cjs.a;
|
package/dist/sdk.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Crossmint } from '@crossmint/common-sdk-base';
|
|
2
2
|
export { Crossmint, createCrossmint } from '@crossmint/common-sdk-base';
|
|
3
|
-
import { W as WalletArgsFor, I as WalletCreateArgs, D as DeviceSignerConfig, R as RegisterSignerPasskeyParams } from './types-
|
|
3
|
+
import { W as WalletArgsFor, I as WalletCreateArgs, D as DeviceSignerConfig, R as RegisterSignerPasskeyParams } from './types-86FbKjRz.cjs';
|
|
4
4
|
import { Chain } from './chains/chains.cjs';
|
|
5
5
|
import { Wallet } from './wallets/wallet.cjs';
|
|
6
6
|
import { DeviceSignerKeyStorage } from './utils/device-signers/DeviceSignerKeyStorage.cjs';
|
package/dist/sdk.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Crossmint } from '@crossmint/common-sdk-base';
|
|
2
2
|
export { Crossmint, createCrossmint } from '@crossmint/common-sdk-base';
|
|
3
|
-
import { W as WalletArgsFor, I as WalletCreateArgs, D as DeviceSignerConfig, R as RegisterSignerPasskeyParams } from './types-
|
|
3
|
+
import { W as WalletArgsFor, I as WalletCreateArgs, D as DeviceSignerConfig, R as RegisterSignerPasskeyParams } from './types-BcjKqQz3.js';
|
|
4
4
|
import { Chain } from './chains/chains.js';
|
|
5
5
|
import { Wallet } from './wallets/wallet.js';
|
|
6
6
|
import { DeviceSignerKeyStorage } from './utils/device-signers/DeviceSignerKeyStorage.js';
|
package/dist/sdk.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b}from"./chunk-
|
|
1
|
+
import{a,b}from"./chunk-B5ERXUGO.js";import"./chunk-XPBFCTYU.js";import"./chunk-YJNAB33W.js";import"./chunk-SFEGES23.js";import"./chunk-PX2QER4D.js";import"./chunk-IRAZVSWU.js";import"./chunk-TOAFCAVT.js";import"./chunk-5LNDUSMZ.js";import"./chunk-2LA5ZWPD.js";import"./chunk-OMTJMVSG.js";import"./chunk-LT6GDX64.js";import"./chunk-NZXYWQE5.js";import"./chunk-IOSADDL5.js";import"./chunk-JEKHYLBB.js";import"./chunk-OEMMPPUX.js";import"./chunk-5HMRFOCH.js";import"./chunk-OE6CWWFM.js";import"./chunk-7BW7B47N.js";import"./chunk-VTTD4HPY.js";import"./chunk-TM45QNB3.js";import"./chunk-W36RYDND.js";import"./chunk-VCOKK7C2.js";import"./chunk-STRSYJNY.js";import"./chunk-ARQVCU6M.js";import"./chunk-QG6GFZHT.js";import"./chunk-FT5EVMLB.js";import"./chunk-SVIKBM3S.js";import"./chunk-KKQBZXFE.js";import"./chunk-S3DYQVRD.js";import"./chunk-KUP7H7X2.js";import"./chunk-GQDDB57A.js";import"./chunk-L52GDMSH.js";import"./chunk-SEOBV6KR.js";import"./chunk-QM3BB4E2.js";import"./chunk-TSJUK3ED.js";import"./chunk-277G6KNG.js";import"./chunk-IQ3QQ4M6.js";import"./chunk-GA7EPR4Z.js";import"./chunk-YDZRBHS3.js";import"./chunk-AQRU3SSV.js";import"./chunk-7JR76V7P.js";import"./chunk-YWFVK6C5.js";import"./chunk-PT6QTDSN.js";import"./chunk-IHMMTMFG.js";import"./chunk-E3H6RZHM.js";import"./chunk-EM3D5Q3A.js";import"./chunk-3QKB6K3J.js";import"./chunk-K7BPGUFU.js";import"./chunk-DCKFFFPG.js";import"./chunk-FJPAMX7L.js";import"./chunk-MN2BGRRJ.js";import"./chunk-FQ5F3VYJ.js";import"./chunk-HAQMNZO5.js";import"./chunk-2YLRFJ66.js";import"./chunk-TMOWGJ5Z.js";import"./chunk-MLROTECD.js";import"./chunk-5IFDVB4Y.js";import"./chunk-WQQOCTIU.js";import"./chunk-KBJA7JDT.js";import"./chunk-HLCF6MRD.js";import"./chunk-DSLYYS6N.js";import"./chunk-NHXWNB3V.js";import"./chunk-2IBE7HWB.js";import"./chunk-B4GYB3XY.js";import"./chunk-OQZTL6ZG.js";import"./chunk-7FEY62ID.js";import"./chunk-455NK5LB.js";import"./chunk-PSDE5X7P.js";import"./chunk-47M4FIGW.js";import"./chunk-NU7VF7MC.js";export{b as CrossmintWallets,a as createCrossmint};
|
|
@@ -2,7 +2,7 @@ import { SignerDescriptor } from './types.cjs';
|
|
|
2
2
|
import '@crossmint/client-sdk-window';
|
|
3
3
|
import '@crossmint/client-signers';
|
|
4
4
|
import '@crossmint/common-sdk-base';
|
|
5
|
-
import '../../types-
|
|
5
|
+
import '../../types-86FbKjRz.cjs';
|
|
6
6
|
import 'viem';
|
|
7
7
|
import '../../api/gen/types.gen.cjs';
|
|
8
8
|
import 'ox';
|
|
@@ -2,7 +2,7 @@ import { SignerDescriptor } from './types.js';
|
|
|
2
2
|
import '@crossmint/client-sdk-window';
|
|
3
3
|
import '@crossmint/client-signers';
|
|
4
4
|
import '@crossmint/common-sdk-base';
|
|
5
|
-
import '../../types-
|
|
5
|
+
import '../../types-BcjKqQz3.js';
|
|
6
6
|
import 'viem';
|
|
7
7
|
import '../../api/gen/types.gen.js';
|
|
8
8
|
import 'ox';
|
|
@@ -2,7 +2,7 @@ import { SignerDescriptor } from './types.cjs';
|
|
|
2
2
|
import '@crossmint/client-sdk-window';
|
|
3
3
|
import '@crossmint/client-signers';
|
|
4
4
|
import '@crossmint/common-sdk-base';
|
|
5
|
-
import '../../types-
|
|
5
|
+
import '../../types-86FbKjRz.cjs';
|
|
6
6
|
import 'viem';
|
|
7
7
|
import '../../api/gen/types.gen.cjs';
|
|
8
8
|
import 'ox';
|
|
@@ -2,7 +2,7 @@ import { SignerDescriptor } from './types.js';
|
|
|
2
2
|
import '@crossmint/client-sdk-window';
|
|
3
3
|
import '@crossmint/client-signers';
|
|
4
4
|
import '@crossmint/common-sdk-base';
|
|
5
|
-
import '../../types-
|
|
5
|
+
import '../../types-BcjKqQz3.js';
|
|
6
6
|
import 'viem';
|
|
7
7
|
import '../../api/gen/types.gen.js';
|
|
8
8
|
import 'ox';
|
|
@@ -2,7 +2,7 @@ import { SignerDescriptor } from './types.cjs';
|
|
|
2
2
|
import '@crossmint/client-sdk-window';
|
|
3
3
|
import '@crossmint/client-signers';
|
|
4
4
|
import '@crossmint/common-sdk-base';
|
|
5
|
-
import '../../types-
|
|
5
|
+
import '../../types-86FbKjRz.cjs';
|
|
6
6
|
import 'viem';
|
|
7
7
|
import '../../api/gen/types.gen.cjs';
|
|
8
8
|
import 'ox';
|