@crossmint/wallets-sdk 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/__tests__/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/types.gen.d.cts +24 -0
- package/dist/api/gen/types.gen.d.ts +24 -0
- 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/chains.cjs +1 -1
- package/dist/chains/chains.js +1 -1
- package/dist/{chunk-EWVP34QQ.js → chunk-4GEG5JA6.js} +1 -1
- package/dist/{chunk-CJ72RXT3.js → chunk-4GHTG2VD.js} +1 -1
- package/dist/{chunk-JZQRPPBO.cjs → chunk-4LXI2OQW.cjs} +1 -1
- package/dist/{chunk-UYEVHCSK.cjs → chunk-52I473WC.cjs} +1 -1
- package/dist/{chunk-X7GUV4FC.js → chunk-6HOOT6LH.js} +1 -1
- package/dist/{chunk-A6W63L6D.cjs → chunk-A3J3367O.cjs} +1 -1
- package/dist/{chunk-FPZLN3J7.cjs → chunk-AAUS7KTR.cjs} +1 -1
- package/dist/{chunk-7Y65TH65.cjs → chunk-AET7QPSV.cjs} +1 -1
- package/dist/{chunk-AXMTWCRH.js → chunk-BAUUDBGT.js} +1 -1
- package/dist/{chunk-YOWBOABQ.cjs → chunk-BI3AUJVK.cjs} +1 -1
- package/dist/{chunk-XUQ75QGR.cjs → chunk-BTMBO7VM.cjs} +2 -2
- package/dist/{chunk-O7RRLQG3.cjs → chunk-CFB27BFV.cjs} +1 -1
- package/dist/{chunk-VUV7WGLL.js → chunk-EIRVLXOC.js} +1 -1
- package/dist/{chunk-HHCDXU3A.cjs → chunk-F2HEHICC.cjs} +1 -1
- package/dist/{chunk-DNOW5UUH.js → chunk-FXCUVWXJ.js} +1 -1
- package/dist/{chunk-II2N5KN2.js → chunk-J4XCFNQH.js} +1 -1
- package/dist/{chunk-4QHFVAIF.cjs → chunk-JFG54X5X.cjs} +1 -1
- package/dist/{chunk-35US6OGA.cjs → chunk-KW2623VI.cjs} +1 -1
- package/dist/chunk-KXKBZNET.cjs +1 -0
- package/dist/chunk-KZMDZJGM.js +1 -0
- package/dist/{chunk-RE34TLPR.js → chunk-PG7BGWKX.js} +1 -1
- package/dist/{chunk-56BXO4HW.js → chunk-QQ46JY33.js} +1 -1
- package/dist/{chunk-5Z36EWLT.cjs → chunk-RLBY6JO3.cjs} +1 -1
- package/dist/{chunk-QNWDL2ID.js → chunk-RWQ6ZQST.js} +1 -1
- package/dist/{chunk-AFF7UCCF.cjs → chunk-SI4L3UZ4.cjs} +1 -1
- package/dist/{chunk-U4XPLZMB.js → chunk-UBDPBFAR.js} +1 -1
- package/dist/{chunk-BTEPD4YH.cjs → chunk-WUNTNM5R.cjs} +1 -1
- package/dist/{chunk-7IPLWUZP.cjs → chunk-X7E2YEIV.cjs} +1 -1
- package/dist/{chunk-AGLGRVTP.js → chunk-XCIS2OND.js} +1 -1
- package/dist/{chunk-2D43XDDF.js → chunk-XEL7JKRY.js} +1 -1
- package/dist/chunk-XX6FO5QS.js +1 -0
- package/dist/{chunk-LC7FS25M.js → chunk-YSB7XIS7.js} +2 -2
- package/dist/{chunk-JFTYS63R.cjs → chunk-YYFLQQPV.cjs} +1 -1
- package/dist/{chunk-MRSYCJIG.js → chunk-ZH3WV7OE.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/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/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-DZWn68Po.d.cts → types-5kZcVs3E.d.cts} +23 -2
- package/dist/{types-CtOIG5sn.d.ts → types-CRMCeDuN.d.ts} +23 -2
- 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/signer-locator.d.cts +1 -1
- package/dist/utils/signer-locator.d.ts +1 -1
- package/dist/utils/signer-mapping.cjs +1 -1
- package/dist/utils/signer-mapping.d.cts +1 -1
- package/dist/utils/signer-mapping.d.ts +1 -1
- package/dist/utils/signer-mapping.js +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/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 +1 -1
- package/dist/wallets/wallet-factory.d.ts +1 -1
- package/dist/wallets/wallet-factory.js +1 -1
- package/dist/wallets/wallet.cjs +1 -1
- package/dist/wallets/wallet.d.cts +1 -1
- package/dist/wallets/wallet.d.ts +1 -1
- package/dist/wallets/wallet.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-AJZZPB4R.js +0 -1
- package/dist/chunk-D6SLJ5C2.cjs +0 -1
- package/dist/chunk-VADIEIDS.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as A,b as k}from"./chunk-JGWGYONV.js";import{a as E}from"./chunk-
|
|
1
|
+
import{a as A,b as k}from"./chunk-JGWGYONV.js";import{a as E}from"./chunk-YSB7XIS7.js";import{a as x}from"./chunk-N4IWDL6M.js";import{a as W}from"./chunk-GOXB2RBF.js";import{b as w,c as b}from"./chunk-F5NTM2RX.js";import{f as S}from"./chunk-FXCUVWXJ.js";import{e as R,g as l}from"./chunk-5OYPWGMX.js";import{a as g}from"./chunk-UBDPBFAR.js";import{a as f,b as m,c as v,g as y}from"./chunk-J3R36SGJ.js";import{WithLoggerContext as D}from"@crossmint/common-sdk-base";import{WebAuthnP256 as K}from"ox";var $="When 'signers' is provided to a method that may fetch an existing wallet, each specified signer must exist in that wallet's configuration.",u=class{constructor(r){this.apiClient=r}getWallet(r,e){return y(this,null,function*(){let i,t;if(typeof r=="string"){if(!this.apiClient.isServerSide)throw new l("getWallet with walletLocator is only available on the server side. Use getWallet(args) instead.");if(e==null)throw new l("Wallet configuration is required when using walletLocator: https://docs.crossmint.com/sdk-reference/wallets/type-aliases/WalletArgsFor");i=r,t=e}else{if(this.apiClient.isServerSide)throw new l("getWallet on server side requires a walletLocator parameter. Use getWallet(walletLocator, args) instead.");t=r,i=this.getWalletLocator(t)}let a=m(f({},t),{chain:S(t.chain,this.apiClient.environment)});g.info("walletFactory.getWallet.start");let n=yield this.apiClient.getWallet(i);if("error"in n)throw g.warn("walletFactory.getWallet.notFound",{error:n.error}),new R(JSON.stringify(n));return g.info("walletFactory.getWallet.success",{address:n.address}),yield this.createWalletInstance(n,a)})}createWallet(r){return y(this,null,function*(){var o,c,d,h,C,p,F,P;let e=m(f({},r),{chain:S(r.chain,this.apiClient.environment)});if(yield(d=(c=(o=e.options)==null?void 0:o.callbacks)==null?void 0:c.onWalletCreationStart)==null?void 0:d.call(c),g.info("walletFactory.createWallet.start"),!this.apiClient.isServerSide&&e.owner!=null)throw g.error("walletFactory.createWallet.error",{error:"Owner field cannot be specified in client-side createWallet calls"}),new l("Owner field cannot be specified in client-side createWallet calls. Owner is determined from JWT authentication.");let t=((h=e.options)==null?void 0:h.deviceSignerKeyStorage)!=null&&e.chain!=="solana"?this.ensureDeviceSignerInSigners(e):(C=e.signers)!=null?C:[],a=yield this.registerSigners(t,e.chain,(p=e.options)==null?void 0:p.deviceSignerKeyStorage),n;if(e.recovery.type==="passkey"&&e.recovery.id==null)n=yield this.createPasskeySigner(e.recovery);else if(e.recovery.type==="server"){let{derivedAddress:I}=w(e.recovery,e.chain,this.apiClient.projectId,this.apiClient.environment);n={type:"server",address:I}}else n=e.recovery;let s=yield this.apiClient.createWallet({type:"smart",chainType:this.getChainType(e.chain),config:f(f({adminSigner:n},e.plugins?{plugins:e.plugins}:{}),a!=null?{delegatedSigners:a}:{}),owner:(F=e.owner)!=null?F:void 0,alias:(P=e.alias)!=null?P:void 0});if("error"in s)throw g.error("walletFactory.createWallet.error",{error:s.error}),new l(JSON.stringify(s));return g.info("walletFactory.createWallet.success",{address:s.address}),yield this.createWalletInstance(s,e)})}createWalletInstance(r,e){return y(this,null,function*(){var h,C;this.validateExistingWalletConfig(r,e);let i=e,t=r.config.adminSigner,a=((h=i.recovery)==null?void 0:h.type)==="server"||((C=i.recovery)==null?void 0:C.type)==="external-wallet"?i.recovery:t,n=r.config.delegatedSigners,s=n;s!=null&&s.length===1&&(s[0].type==="server"||s[0].type==="external-wallet")&&(s=i.signers);let o=t.type==="server"&&"address"in t&&!("secret"in t)?t.address:void 0,c=(n!=null?n:[]).filter(p=>p.type==="server"&&"address"in p&&!("secret"in p)).map(p=>p.address),d=new E({chain:e.chain,address:r.address,owner:r.owner,options:e.options,alias:e.alias,recovery:a,apiRecoveryServerSignerAddress:o,apiDelegatedServerSignerAddresses:c,signers:s!=null?s:[]},this.apiClient);return yield d.waitForInit(),d})}getWalletLocator(r){return`me:${this.getChainType(r.chain)}:smart`+(r.alias!=null?`:alias:${r.alias}`:"")}createPasskeySigner(r){return y(this,null,function*(){var t;if(r.type!=="passkey")throw new Error("Signer is not a passkey");let e=(t=r.name)!=null?t:`Crossmint Wallet ${Date.now()}`,i=r.onCreatePasskey?yield r.onCreatePasskey(e):yield K.createCredential({name:e});return{type:"passkey",id:i.id,name:e,publicKey:{x:i.publicKey.x.toString(),y:i.publicKey.y.toString()}}})}ensureDeviceSignerInSigners(r){var t;let e=(t=r.signers)!=null?t:[];return e.some(a=>a.type==="device")?e:[...e,{type:"device"}]}validateExistingWalletConfig(r,e){if(e.owner!=null&&r.owner!=null&&A(e.owner)!==A(r.owner))throw new l("Wallet owner does not match existing wallet's linked user");if(e.chain==="solana"&&r.chainType!=="solana"||e.chain!=="solana"&&r.chainType==="solana"||e.chain==="stellar"&&r.chainType!=="stellar"||e.chain!=="stellar"&&r.chainType==="stellar")throw new l(`Wallet chain does not match existing wallet's chain. You must use chain: ${r.chainType}.`);if(r.type!=="smart")return;let i=e;if(i.recovery!=null||i.signers!=null){let t=r.config,a=t==null?void 0:t.adminSigner;if(i.recovery!=null&&a!=null){if(i.recovery.type!==a.type)throw new l("The wallet recovery signer type does not match the existing wallet's recovery signer type");k(i.recovery,a)}let n=i.signers;n!=null&&this.validateSigners(r,n,e.chain)}}validateSigners(r,e,i){let t=r.config,a=t==null?void 0:t.delegatedSigners;if(e.length!==0){if(a==null||a.length===0)throw new l(`${e.length} signer(s) specified, but wallet "${r.address}" has no signers. ${$}`);for(let n of e){let s=a.find(o=>{if(this.isMatchingPasskeySigner(n,o,t)||o.type==="device"&&n.type==="device")return!0;if(n.type==="server"){let{primary:c,legacy:d}=b(n,i,this.apiClient.projectId,this.apiClient.environment);return o.locator===`server:${c.derivedAddress}`||d!=null&&o.locator===`server:${d.derivedAddress}`}return o.locator===W(n)});if(s==null){let o=a.map(c=>c.locator).join(", ");throw new l(`Signer '${n.type}' does not exist in wallet "${r.address}". Available signers: ${o}. ${$}`)}k(n,s)}}}isMatchingPasskeySigner(r,e,i){var a,n;let t=((n=(a=i.delegatedSigners)==null?void 0:a.filter(s=>s.type==="passkey").length)!=null?n:0)+(i.adminSigner.type==="passkey"?1:0);if(r.type==="passkey"){if(r.id==null&&t===1)return e.type==="passkey";if(r.id==null&&t>1)throw new l("When creating a wallet with multiple passkeys, you must provide the passkey ID for each passkey.")}return!1}registerSigners(r,e,i){return y(this,null,function*(){var t;return yield Promise.all((t=r==null?void 0:r.map(a=>y(this,null,function*(){if(a.type==="passkey")return a.id==null?{signer:yield this.createPasskeySigner(a)}:{signer:a};if(a.type==="device"){if(a.publicKey!=null)return{signer:{type:"device",publicKey:a.publicKey,name:a.name}};if(a.locator!=null)return{signer:a.locator};if(i==null)throw new l("Device signer key storage is required for device signers");let n=yield x(i);return{signer:{type:"device",publicKey:n.publicKey,name:n.name}}}if(a.type==="server"&&e!=null){let{derivedAddress:n}=w(a,e,this.apiClient.projectId,this.apiClient.environment);return{signer:`server:${n}`}}return{signer:W(a)}})))!=null?t:[])})}getChainType(r){return r==="solana"?"solana":r==="stellar"?"stellar":"evm"}};v([D({logger:g,methodName:"walletFactory.getWallet",buildContext(r,e){if(typeof e[0]=="string"){let t=e[1];return{walletLocator:e[0],chain:t==null?void 0:t.chain}}let i=e[0];return{chain:i==null?void 0:i.chain}}})],u.prototype,"getWallet",1),v([D({logger:g,methodName:"walletFactory.createWallet",buildContext(r,e){return{chain:e[0].chain}}})],u.prototype,"createWallet",1);export{u as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var s="@crossmint/wallets-sdk",t="1.4.0";var c="WALLETS_SDK",r=t,a=s,d=500;export{c as a,r as b,a as c,d};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as he}from"./chunk-N4IWDL6M.js";import{a as N}from"./chunk-GOXB2RBF.js";import{b as j,c as z}from"./chunk-VADIEIDS.js";import{a as q}from"./chunk-VUV7WGLL.js";import{c as ue}from"./chunk-F5NTM2RX.js";import{a as ge}from"./chunk-56BXO4HW.js";import{a as de,b as W}from"./chunk-6RX65NOA.js";import{f as ce}from"./chunk-DNOW5UUH.js";import{A as ae,B as oe,D as le,d as Y,e as Q,j as _,k as X,l as M,p as Z,s as G,t as ee,u as re,v as ie,w as V,x as te,y as ne,z as se}from"./chunk-5OYPWGMX.js";import{a as s}from"./chunk-U4XPLZMB.js";import{d as U}from"./chunk-AJZZPB4R.js";import{a as A,b as O,c as k,d as n,e as T,f as c,g as d}from"./chunk-J3R36SGJ.js";import{isValidAddress as pe,WithLoggerContext as P}from"@crossmint/common-sdk-base";var p,b,f,v,R,w,I,x,L,$,K,D,B,E=class{constructor(e,r){T(this,p);T(this,b);T(this,f);T(this,v);T(this,R);T(this,w,!1);T(this,I,!1);T(this,x,null);T(this,L,null);T(this,$,[]);T(this,K);T(this,D,null);T(this,B,!1);let{chain:i,address:t,owner:a,options:h,alias:o,recovery:l,apiRecoveryServerSignerAddress:g,apiDelegatedServerSignerAddresses:u,signers:S,signer:y}=e;c(this,f,r),this.chain=i,this.address=t,this.owner=a,c(this,b,h),this.alias=o,c(this,v,l),g!=null?c(this,L,g):l.type==="server"&&W(l)&&c(this,L,l.address),c(this,$,u!=null?u:[]),c(this,R,S!=null?S:[]),c(this,p,y),c(this,K,this.initDefaultSigner())}get signer(){return n(this,p)}waitForInit(){return d(this,null,function*(){yield n(this,K)})}initDeviceSigner(){return d(this,null,function*(){var t;let e=(t=n(this,b))==null?void 0:t.deviceSignerKeyStorage;if(e==null||n(this,B))return;let r={type:"device"};try{yield this.resolveDeviceSignerAvailability(r)}catch(a){s.error("wallet.initDeviceSigner.error",{error:a}),c(this,w,!0);return}if(n(this,w))return;let i=this.buildInternalSignerConfig(r);c(this,p,yield this.assembleFullSigner(i,e)),this.isApprovedSignerStatus(n(this,p).status)||(s.info("wallet.initDeviceSigner.pendingApproval",{signerLocator:n(this,p).locator(),status:n(this,p).status}),c(this,w,!0),c(this,I,!1))})}initDefaultSigner(){return d(this,null,function*(){if(n(this,p)!=null||(yield this.initDeviceSigner(),n(this,p)!=null||n(this,w)))return;let e=n(this,R).length===0?n(this,v):n(this,R).length===1?n(this,R)[0]:null;if(e==null||!this.isAutoAssemblableSignerConfig(e))return;let r=e===n(this,v);try{let i=this.buildInternalSignerConfig(e);c(this,p,yield this.assembleFullSigner(i,void 0,{isAdminSigner:r}))}catch(i){s.warn("wallet.initDefaultSigner.autoAssemblyFailed",{recoveryType:n(this,v).type,signerCount:n(this,R).length,error:i})}})}assembleRecoverySignerFallback(){return d(this,null,function*(){if(this.isAutoAssemblableSignerConfig(n(this,v)))try{let e=this.buildInternalSignerConfig(n(this,v));c(this,p,yield this.assembleFullSigner(e,void 0,{isAdminSigner:!0}))}catch(e){s.warn("wallet.recover.device.unsupportedFallback.autoAssemblyFailed",{recoveryType:n(this,v).type,error:e})}})}static getApiClient(e){return e.apiClient}static getOptions(e){return e.options}static getRecovery(e){return n(e,v)}static getInitialSigners(e){return n(e,R)}static getApiRecoveryServerSignerAddress(e){var r;return(r=n(e,L))!=null?r:void 0}static getApiDelegatedServerSignerAddresses(e){return n(e,$)}get apiClient(){return n(this,f)}get options(){return n(this,b)}deriveServerSignerCandidates(e){return ue(e,this.chain,n(this,f).projectId,n(this,f).environment)}matchResolvedServerSigner(e){if(n(this,x)==null)return null;let{primary:r,legacy:i}=this.deriveServerSignerCandidates(e),t=n(this,x).derivedAddress;return t===r.derivedAddress||i!=null&&t===i.derivedAddress?n(this,x):null}resolveServerSignerDerivation(e){let r=this.matchResolvedServerSigner(e);if(r!=null)return r;let{primary:i,legacy:t}=this.deriveServerSignerCandidates(e);return t!=null&&(t.derivedAddress===n(this,L)||n(this,R).some(a=>a.type==="server"&&W(a)&&a.address===t.derivedAddress)||n(this,$).includes(t.derivedAddress))?t:i}resolveServerSignerApiLocator(e){return`server:${this.resolveServerSignerDerivation(e).derivedAddress}`}get recovery(){return n(this,v)}balances(e){return d(this,null,function*(){s.info("wallet.balances.start");let r=this.resolveChainForEnvironment(),i;switch(this.chain){case"solana":i="sol";break;case"stellar":i="xlm";break;default:i="eth";break}let t=[i,"usdc",...e!=null?e:[]],a=yield n(this,f).getBalance(this.address,{chains:[r],tokens:t});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"),this.transformBalanceResponse(a,i,e)})}stagingFund(e,r){return d(this,null,function*(){s.info("wallet.stagingFund.start",{amount:e,chain:r!=null?r:this.chain});let i=yield this.apiClient.fundWallet(this.address,{amount:e,token:"usdxm",chain:r!=null?r:this.chain});if("error"in i)throw s.error("wallet.stagingFund.error",{error:i}),new Error(`Failed to fund wallet: ${JSON.stringify(i.message)}`);return s.info("wallet.stagingFund.success"),i})}transformBalanceResponse(e,r,i){let t=g=>{var y,C,F,H,J;let u=(y=g.chains)==null?void 0:y[this.chain],S={};return this.chain==="solana"&&u!=null&&"mintHash"in u?S={mintHash:u.mintHash}:this.chain==="stellar"&&u!=null&&"contractId"in u?S={contractId:u.contractId}:u!=null&&"contractAddress"in u&&(S={contractAddress:u.contractAddress}),A({symbol:(C=g.symbol)!=null?C:"",name:(F=g.name)!=null?F:"",amount:(H=g.amount)!=null?H:"0",decimals:g.decimals,rawAmount:(J=g.rawAmount)!=null?J:"0"},S)},a=e.find(g=>g.symbol===r),h=e.find(g=>g.symbol==="usdc"),o=e.filter(g=>{var u;return g.symbol!==r&&g.symbol!=="usdc"&&(i==null||i.includes((u=g.symbol)!=null?u:""))}),l=g=>{let u={symbol:g,name:g,amount:"0",decimals:0,rawAmount:"0"},S={};return this.chain==="solana"?S={mintHash:void 0}:this.chain==="stellar"?S={contractId:void 0}:S={contractAddress:void 0},A(A({},u),S)};return{nativeToken:a!=null?t(a):l(r),usdc:h!=null?t(h):l("usdc"),tokens:o.map(t)}}nfts(e){return d(this,null,function*(){return yield n(this,f).getNfts(O(A({},e),{chain:this.chain,address:this.address}))})}transactions(){return d(this,null,function*(){let e=yield n(this,f).getTransactions(this.walletLocator);if("error"in e)throw new Error(`Failed to get transactions: ${JSON.stringify(e.message)}`);return e})}transaction(e){return d(this,null,function*(){let r=yield n(this,f).getTransaction(this.walletLocator,e);if("error"in r)throw new Error(`Failed to get transaction: ${JSON.stringify(r.error)}`);return r})}transfers(e){return d(this,null,function*(){let r=this.resolveChainForEnvironment(),i=yield this.apiClient.getTransfers(this.walletLocator,{chain:r,tokens:e.tokens,status:e.status});if("error"in i)throw new Error(`Failed to get transfers: ${JSON.stringify(i.message)}`);return i})}send(e,r,i,t){return d(this,null,function*(){let a=this.resolveChainForEnvironment(),h=fe(e),o=we(r,a),l=Number(i);if(Number.isNaN(l)||!Number.isFinite(l)||l<=0)throw new re(`Invalid transfer amount: "${i}". Amount must be a positive number greater than zero.`);s.info("wallet.send.start",A({recipient:h,token:o,amount:i},(t==null?void 0:t.transactionType)!=null?{transactionType:t.transactionType}:{})),yield this.preAuthIfNeeded();let g=this.requireSigner(),u;(t==null?void 0:t.signer)==null?u=g.locator():typeof t.signer=="string"?u=t.signer:u=this.resolveServerSignerApiLocator(t.signer);let S=A({recipient:h,amount:i,signer:u},(t==null?void 0:t.transactionType)!=null?{transactionType:t.transactionType}:{}),y=yield n(this,f).send(this.walletLocator,o,S);if("message"in y)throw s.error("wallet.send.error",{error:y}),new ie(`Failed to send token: ${JSON.stringify(y.message)}`);if((t==null?void 0:t.prepareOnly)===!0)return s.info("wallet.send.prepared",{transactionId:y.id}),{hash:void 0,explorerLink:void 0,transactionId:y.id};let C=yield this.approveTransactionAndWait(y.id);return s.info("wallet.send.success",{transactionId:y.id,hash:C.hash}),C})}approveTransaction(e){return d(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 d(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 d(this,null,function*(){s.info("wallet.addSigner.start");let i=typeof e=="object"&&"type"in e&&e.type==="server"?this.resolveServerSignerApiLocator(e):e;return this.withRecoverySigner(()=>d(this,null,function*(){var u,S;let t=typeof i=="string"?i:N(i),a=yield this.getSignerState(t);if(a.signer!=null){if(this.isApprovedSignerStatus(a.signer.status))return s.info("wallet.addSigner.alreadyApproved"),this.completeSignerRegistration(a.signer,null,r);if(a.pendingOperation!=null)return s.info("wallet.addSigner.resuming",{operationType:a.pendingOperation.type,operationId:a.pendingOperation.id}),this.completeSignerRegistration(a.signer,a.pendingOperation,r)}let h=typeof i=="string"||i.type==="passkey"?i:i.type==="device"&&"publicKey"in i&&i.publicKey!=null?{type:"device",publicKey:i.publicKey,name:i.name}:N(i),o=yield n(this,f).registerSigner(this.walletLocator,{signer:h,chain:this.getSignerRegistrationChain()});if("error"in o)throw s.error("wallet.addSigner.error",{error:o}),o.code===X?new M(o.message):new _(`Failed to register signer: ${JSON.stringify(o.message)}`);let l=j(o,this.chain);if(l==null)throw new Error(`No approval found for chain ${this.chain} in register signer response`);let g=null;if(this.chain==="solana"||this.chain==="stellar"){if(!("transaction"in o)||o.transaction==null)throw s.error("wallet.addSigner.error",{error:"Expected transaction in response for Solana/Stellar chain"}),new Error("Expected transaction in response for Solana/Stellar chain");g={type:"transaction",id:o.transaction.id}}else{if(!("chains"in o))throw s.error("wallet.addSigner.error",{error:"Expected chains in response for EVM chain"}),new Error("Expected chains in response for EVM chain");if(((S=(u=o.chains)==null?void 0:u[this.chain])==null?void 0:S.status)==="failed")throw new Error(`Signer registration failed for chain ${this.chain}`);g=z(o,this.chain)}return this.completeSignerRegistration(l,g,r)}))})}completeSignerRegistration(e,r,i){return d(this,null,function*(){if(i!=null&&i.prepareOnly){if(r==null)return A({},e);switch(r.type){case"transaction":{let t={transactionId:r.id};return s.info("wallet.addSigner.prepared",t),A(A({},e),t)}case"signature":{let t={signatureId:r.id};return s.info("wallet.addSigner.prepared",t),A(A({},e),t)}default:{let t=r.type;throw new Error(`Unknown pending operation type: ${t}`)}}}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 t=r.type;throw new Error(`Unknown pending operation type: ${t}`)}}else s.info("wallet.addSigner.success");return O(A({},e),{status:"success"})})}removeSigner(e,r){return d(this,null,function*(){let i=this.resolveSignerLocator(e);return s.info("wallet.removeSigner.start",{signerLocator:i}),this.withRecoverySigner(()=>d(this,null,function*(){let t=yield n(this,f).removeSigner(this.walletLocator,i,{chain:this.getSignerRegistrationChain()});if("error"in t)throw s.error("wallet.removeSigner.error",{error:t}),new Error(`Failed to remove signer: ${JSON.stringify(t)}`);let a=t.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 d(this,null,function*(){s.info("wallet.useSigner.start"),e.type==="server"&&c(this,x,null),this.validateSignerInput(e);let r=!1;e.type==="device"?yield this.resolveDeviceSignerAvailability(e):r=yield this.resolveNonDeviceSigner(e);let i=this.buildInternalSignerConfig(e),t=N(e);c(this,p,yield this.assembleFullSigner(i,void 0,{isAdminSigner:r})),s.info("wallet.useSigner.success",{signerLocator:t})})}resolveNonDeviceSigner(e){return d(this,null,function*(){if(e.type!=="passkey"&&e.type!=="server"&&this.isRecoverySigner(e))return c(this,w,!1),!0;if(e.type==="passkey"&&this.isPasskeyMissingId(e)&&!(yield this.tryAutoSelectPasskey(e))){if(this.isRecoverySigner(e))return c(this,w,!1),!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 c(this,w,!1),!1;if(this.isRecoverySigner(e))return c(this,w,!1),!0;throw new Error(`Signer "${r}" is not registered in this wallet.`)})}resolveServerSigner(e){return d(this,null,function*(){let{primary:r,legacy:i}=this.deriveServerSignerCandidates(e),t=yield this.signers();if(t.some(h=>h.locator===`server:${r.derivedAddress}`))return c(this,x,r),c(this,w,!1),!1;if(i!=null&&t.some(h=>h.locator===`server:${i.derivedAddress}`))return c(this,x,i),c(this,w,!1),!1;if(this.isRecoverySigner(e))return n(this,L)!=null&&i!=null&&i.derivedAddress===n(this,L)?c(this,x,i):c(this,x,r),c(this,w,!1),!0;let a=i!=null?`"server:${r.derivedAddress}" or "server:${i.derivedAddress}"`:`"server:${r.derivedAddress}"`;throw new Error(`Signer ${a} is not registered in this wallet.`)})}tryAutoSelectPasskey(e){return d(this,null,function*(){let i=(yield this.signers()).filter(t=>t.type==="passkey");if(i.length===0)return!1;if(i.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=i[0].locator.replace("passkey:",""),!0})}resolveSignerLocator(e){return e.type==="server"?this.resolveServerSignerApiLocator(e):N(e)}getSignerRegistrationChain(){if(!(this.chain==="solana"||this.chain==="stellar"))return this.chain}withRecoverySigner(e){return d(this,null,function*(){var t;let r=this.signer;if(W(n(this,v)))throw new Error('Cannot assemble server signer: no secret available. Call wallet.useSigner({ type: "server", secret: ... }) first with the recovery server secret.');if(n(this,v)!=null&&n(this,v).type==="external-wallet"&&!this.isAutoAssemblableSignerConfig(n(this,v)))throw new Error('Cannot assemble external wallet signer: no onSign callback available. Call wallet.useSigner({ type: "external-wallet", address: "0x...", onSign: async (tx) => ... }) first.');let i=this.buildInternalSignerConfig(n(this,v));c(this,p,q(this.chain,i,(t=n(this,b))==null?void 0:t.deviceSignerKeyStorage));try{return yield e()}finally{c(this,p,r)}})}isPasskeyMissingId(e){return e.id==null||e.id===""}signerIsRegistered(e){return d(this,null,function*(){return(yield this.signers()).some(i=>i.locator===e)})}isSignerApproved(e){return d(this,null,function*(){var i;let r=yield this.getSignerState(e);return this.isApprovedSignerStatus((i=r.signer)==null?void 0:i.status)})}isApprovedSignerStatus(e){return e==="success"||e==="active"}needsRecovery(){return n(this,w)}recover(){return d(this,null,function*(){var a,h;if(s.info("wallet.recover.start"),n(this,I)){s.info("wallet.recover.skipped",{reason:"Device signer already approved (cached)"});return}if(n(this,B)){s.info("wallet.recover.skipped",{reason:"device signer not supported (cached)"}),c(this,w,!1),c(this,I,!0);return}let e=()=>{c(this,w,!1),c(this,I,!0)};if(((a=n(this,p))==null?void 0:a.type)==="device"&&(yield this.checkAndResumeDeviceSigner(n(this,p)))){e();return}if(n(this,p)!=null&&n(this,p).type!=="device"){s.warn("wallet.recover.skipped",{reason:"Recovery is only supported for device signers"}),c(this,w,!1);return}let r=(h=n(this,b))==null?void 0:h.deviceSignerKeyStorage;if(r==null){if(!n(this,w))return;throw new Error("Device signer key storage is required to recover a device signer")}let i=yield this.findLocalDeviceSigner(r);if(i!=null&&(yield this.checkAndResumeDeviceSigner(i))){c(this,p,i),e();let o=i.locator().replace("device:","");try{yield r.mapAddressToKey(this.address,o)}catch(l){s.warn("wallet.recover.mapAddressToKey.error",{error:l})}return}let t=yield he(r,this.address);try{yield this.addSigner(t)}catch(o){let l=o instanceof Error&&o.message.toLowerCase().includes("delegated signer")&&o.message.toLowerCase().includes("already")&&o.message.toLowerCase().includes("approved");if(o instanceof M){s.info("wallet.recover.device.unsupportedFallback",{signerLocator:t.locator}),yield r.deleteKey(this.address),c(this,B,!0),c(this,w,!1),c(this,I,!0),yield this.assembleRecoverySignerFallback();return}else if(l)s.info("wallet.recover.skipped",{reason:"Device signer already approved",signerLocator:t.locator});else throw o instanceof de||o instanceof Error&&o.name==="AuthRejectedError"?(s.info("wallet.recover.device.authRejected",{signerLocator:t.locator}),o):(s.error("wallet.recover.device.error",{error:o}),yield r.deleteKey(this.address),o)}c(this,p,yield this.assembleFullSigner({type:"device",locator:t.locator,address:this.address},r)),n(this,p).type==="device"&&(n(this,p).status="success"),s.info("wallet.recover.device.success",{signerLocator:t.locator}),e()})}checkAndResumeDeviceSigner(e){return d(this,null,function*(){var i;if(this.isApprovedSignerStatus(e.status))return s.info("wallet.recover.skipped",{reason:"Device signer already approved"}),!0;let r=yield this.getSignerState(e.locator());return e.status=(i=r.signer)==null?void 0:i.status,r.pendingOperation!=null?(yield this.resumePendingDeviceSignerApproval(e,r.pendingOperation),!0):this.isApprovedSignerStatus(e.status)?(s.info("wallet.recover.skipped",{reason:"Device signer already approved"}),!0):!1})}resumePendingDeviceSignerApproval(e,r){return d(this,null,function*(){var a;let i=n(this,p);if(W(n(this,v)))throw new Error('Cannot resume pending approval: no secret available. Call wallet.useSigner({ type: "server", secret: ... }) first with the recovery server secret.');if(n(this,v)!=null&&n(this,v).type==="external-wallet"&&!this.isAutoAssemblableSignerConfig(n(this,v)))throw new Error('Cannot resume pending approval: no onSign callback available. Call wallet.useSigner({ type: "external-wallet", address: "0x...", onSign: async (tx) => ... }) first.');let t=this.buildInternalSignerConfig(n(this,v));c(this,p,q(this.chain,t,(a=n(this,b))==null?void 0:a.deviceSignerKeyStorage));try{r.type==="signature"?yield this.approveSignatureAndWait(r.id):yield this.approveTransactionAndWait(r.id)}catch(h){throw c(this,p,e),h}finally{n(this,p)!==e&&c(this,p,i)}e.status="success",s.info("wallet.recover.device.success",{signerLocator:e.locator(),resumed:!0})})}findLocalDeviceSigner(e){return d(this,null,function*(){let i=(yield this.signers()).filter(t=>t.locator.startsWith("device:"));for(let t of i){let a=t.locator.replace("device:","");try{if(yield e.hasKey(a)){let o=q(this.chain,{type:"device",locator:t.locator,address:this.address},e);return s.info("wallet.recover.foundLocalDeviceSigner",{signerLocator:t.locator}),o}}catch(h){s.warn("wallet.recover.findLocalDeviceSigner.keyCheckError",{signerLocator:t.locator,error:h})}}return null})}signers(){return d(this,null,function*(){var a,h;s.info("wallet.signers.start");let e=yield n(this,f).getWallet(this.walletLocator);if("error"in e)throw s.error("wallet.signers.error",{error:e}),new Q(JSON.stringify(e));if(e.type!=="smart"||e.chainType!=="evm"&&e.chainType!=="solana"&&e.chainType!=="stellar")throw s.error("wallet.signers.error",{error:`Wallet type ${e.type} not supported`}),new Y(`Wallet type ${e.type} not supported`);let r=(h=(a=e==null?void 0:e.config)==null?void 0:a.delegatedSigners)!=null?h:[],t=(yield Promise.all(r.map(o=>d(this,null,function*(){try{return(yield this.getSignerState(o.locator)).signer}catch(l){return null}})))).filter(o=>o!=null);return s.info("wallet.signers.success",{count:t.length}),t})}get walletLocator(){if(n(this,f).isServerSide)return this.address;{let e;switch(this.chain){case"stellar":e="me:stellar:smart";break;case"solana":e="me:solana:smart";break;default:e="me:evm:smart";break}let r=this.alias!=null?`:alias:${this.alias}`:"";return e+r}}requireSigner(){if(n(this,p)==null)throw n(this,R).length>1?new Error("No signer is set. This wallet has multiple signers configured. Call wallet.useSigner() to select which signer to use before signing operations."):n(this,v).type==="server"?new Error(`No signer is set. Server wallets require calling wallet.useSigner() with the server secret before signing operations.
|
|
1
|
+
import{a as he}from"./chunk-N4IWDL6M.js";import{a as N}from"./chunk-GOXB2RBF.js";import{b as j,c as z}from"./chunk-KZMDZJGM.js";import{a as q}from"./chunk-EIRVLXOC.js";import{c as ue}from"./chunk-F5NTM2RX.js";import{a as ge}from"./chunk-QQ46JY33.js";import{a as de,b as W}from"./chunk-6RX65NOA.js";import{f as ce}from"./chunk-FXCUVWXJ.js";import{A as ae,B as oe,D as le,d as Y,e as Q,j as _,k as X,l as M,p as Z,s as G,t as ee,u as re,v as ie,w as V,x as te,y as ne,z as se}from"./chunk-5OYPWGMX.js";import{a as s}from"./chunk-UBDPBFAR.js";import{d as U}from"./chunk-XX6FO5QS.js";import{a as b,b as O,c as k,d as n,e as T,f as c,g as d}from"./chunk-J3R36SGJ.js";import{isValidAddress as pe,WithLoggerContext as P}from"@crossmint/common-sdk-base";var p,A,f,v,R,w,I,x,L,$,K,D,B,E=class{constructor(e,r){T(this,p);T(this,A);T(this,f);T(this,v);T(this,R);T(this,w,!1);T(this,I,!1);T(this,x,null);T(this,L,null);T(this,$,[]);T(this,K);T(this,D,null);T(this,B,!1);let{chain:i,address:t,owner:a,options:h,alias:o,recovery:l,apiRecoveryServerSignerAddress:g,apiDelegatedServerSignerAddresses:u,signers:S,signer:y}=e;c(this,f,r),this.chain=i,this.address=t,this.owner=a,c(this,A,h),this.alias=o,c(this,v,l),g!=null?c(this,L,g):l.type==="server"&&W(l)&&c(this,L,l.address),c(this,$,u!=null?u:[]),c(this,R,S!=null?S:[]),c(this,p,y),c(this,K,this.initDefaultSigner())}get signer(){return n(this,p)}waitForInit(){return d(this,null,function*(){yield n(this,K)})}initDeviceSigner(){return d(this,null,function*(){var t;let e=(t=n(this,A))==null?void 0:t.deviceSignerKeyStorage;if(e==null||n(this,B))return;let r={type:"device"};try{yield this.resolveDeviceSignerAvailability(r)}catch(a){s.error("wallet.initDeviceSigner.error",{error:a}),c(this,w,!0);return}if(n(this,w))return;let i=this.buildInternalSignerConfig(r);c(this,p,yield this.assembleFullSigner(i,e)),this.isApprovedSignerStatus(n(this,p).status)||(s.info("wallet.initDeviceSigner.pendingApproval",{signerLocator:n(this,p).locator(),status:n(this,p).status}),c(this,w,!0),c(this,I,!1))})}initDefaultSigner(){return d(this,null,function*(){if(n(this,p)!=null||(yield this.initDeviceSigner(),n(this,p)!=null||n(this,w)))return;let e=n(this,R).length===0?n(this,v):n(this,R).length===1?n(this,R)[0]:null;if(e==null||!this.isAutoAssemblableSignerConfig(e))return;let r=e===n(this,v);try{let i=this.buildInternalSignerConfig(e);c(this,p,yield this.assembleFullSigner(i,void 0,{isAdminSigner:r}))}catch(i){s.warn("wallet.initDefaultSigner.autoAssemblyFailed",{recoveryType:n(this,v).type,signerCount:n(this,R).length,error:i})}})}assembleRecoverySignerFallback(){return d(this,null,function*(){if(this.isAutoAssemblableSignerConfig(n(this,v)))try{let e=this.buildInternalSignerConfig(n(this,v));c(this,p,yield this.assembleFullSigner(e,void 0,{isAdminSigner:!0}))}catch(e){s.warn("wallet.recover.device.unsupportedFallback.autoAssemblyFailed",{recoveryType:n(this,v).type,error:e})}})}static getApiClient(e){return e.apiClient}static getOptions(e){return e.options}static getRecovery(e){return n(e,v)}static getInitialSigners(e){return n(e,R)}static getApiRecoveryServerSignerAddress(e){var r;return(r=n(e,L))!=null?r:void 0}static getApiDelegatedServerSignerAddresses(e){return n(e,$)}get apiClient(){return n(this,f)}get options(){return n(this,A)}deriveServerSignerCandidates(e){return ue(e,this.chain,n(this,f).projectId,n(this,f).environment)}matchResolvedServerSigner(e){if(n(this,x)==null)return null;let{primary:r,legacy:i}=this.deriveServerSignerCandidates(e),t=n(this,x).derivedAddress;return t===r.derivedAddress||i!=null&&t===i.derivedAddress?n(this,x):null}resolveServerSignerDerivation(e){let r=this.matchResolvedServerSigner(e);if(r!=null)return r;let{primary:i,legacy:t}=this.deriveServerSignerCandidates(e);return t!=null&&(t.derivedAddress===n(this,L)||n(this,R).some(a=>a.type==="server"&&W(a)&&a.address===t.derivedAddress)||n(this,$).includes(t.derivedAddress))?t:i}resolveServerSignerApiLocator(e){return`server:${this.resolveServerSignerDerivation(e).derivedAddress}`}get recovery(){return n(this,v)}balances(e){return d(this,null,function*(){s.info("wallet.balances.start");let r=this.resolveChainForEnvironment(),i;switch(this.chain){case"solana":i="sol";break;case"stellar":i="xlm";break;default:i="eth";break}let t=[i,"usdc",...e!=null?e:[]],a=yield n(this,f).getBalance(this.address,{chains:[r],tokens:t});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"),this.transformBalanceResponse(a,i,e)})}stagingFund(e,r){return d(this,null,function*(){s.info("wallet.stagingFund.start",{amount:e,chain:r!=null?r:this.chain});let i=yield this.apiClient.fundWallet(this.address,{amount:e,token:"usdxm",chain:r!=null?r:this.chain});if("error"in i)throw s.error("wallet.stagingFund.error",{error:i}),new Error(`Failed to fund wallet: ${JSON.stringify(i.message)}`);return s.info("wallet.stagingFund.success"),i})}transformBalanceResponse(e,r,i){let t=g=>{var y,C,F,H,J;let u=(y=g.chains)==null?void 0:y[this.chain],S={};return this.chain==="solana"&&u!=null&&"mintHash"in u?S={mintHash:u.mintHash}:this.chain==="stellar"&&u!=null&&"contractId"in u?S={contractId:u.contractId}:u!=null&&"contractAddress"in u&&(S={contractAddress:u.contractAddress}),b({symbol:(C=g.symbol)!=null?C:"",name:(F=g.name)!=null?F:"",amount:(H=g.amount)!=null?H:"0",decimals:g.decimals,rawAmount:(J=g.rawAmount)!=null?J:"0"},S)},a=e.find(g=>g.symbol===r),h=e.find(g=>g.symbol==="usdc"),o=e.filter(g=>{var u;return g.symbol!==r&&g.symbol!=="usdc"&&(i==null||i.includes((u=g.symbol)!=null?u:""))}),l=g=>{let u={symbol:g,name:g,amount:"0",decimals:0,rawAmount:"0"},S={};return this.chain==="solana"?S={mintHash:void 0}:this.chain==="stellar"?S={contractId:void 0}:S={contractAddress:void 0},b(b({},u),S)};return{nativeToken:a!=null?t(a):l(r),usdc:h!=null?t(h):l("usdc"),tokens:o.map(t)}}nfts(e){return d(this,null,function*(){return yield n(this,f).getNfts(O(b({},e),{chain:this.chain,address:this.address}))})}transactions(){return d(this,null,function*(){let e=yield n(this,f).getTransactions(this.walletLocator);if("error"in e)throw new Error(`Failed to get transactions: ${JSON.stringify(e.message)}`);return e})}transaction(e){return d(this,null,function*(){let r=yield n(this,f).getTransaction(this.walletLocator,e);if("error"in r)throw new Error(`Failed to get transaction: ${JSON.stringify(r.error)}`);return r})}transfers(e){return d(this,null,function*(){let r=this.resolveChainForEnvironment(),i=yield this.apiClient.getTransfers(this.walletLocator,{chain:r,tokens:e.tokens,status:e.status});if("error"in i)throw new Error(`Failed to get transfers: ${JSON.stringify(i.message)}`);return i})}send(e,r,i,t){return d(this,null,function*(){let a=this.resolveChainForEnvironment(),h=fe(e),o=we(r,a),l=Number(i);if(Number.isNaN(l)||!Number.isFinite(l)||l<=0)throw new re(`Invalid transfer amount: "${i}". Amount must be a positive number greater than zero.`);s.info("wallet.send.start",b({recipient:h,token:o,amount:i},(t==null?void 0:t.transactionType)!=null?{transactionType:t.transactionType}:{})),yield this.preAuthIfNeeded();let g=this.requireSigner(),u;(t==null?void 0:t.signer)==null?u=g.locator():typeof t.signer=="string"?u=t.signer:u=this.resolveServerSignerApiLocator(t.signer);let S=b({recipient:h,amount:i,signer:u},(t==null?void 0:t.transactionType)!=null?{transactionType:t.transactionType}:{}),y=yield n(this,f).send(this.walletLocator,o,S);if("message"in y)throw s.error("wallet.send.error",{error:y}),new ie(`Failed to send token: ${JSON.stringify(y.message)}`);if((t==null?void 0:t.prepareOnly)===!0)return s.info("wallet.send.prepared",{transactionId:y.id}),{hash:void 0,explorerLink:void 0,transactionId:y.id};let C=yield this.approveTransactionAndWait(y.id);return s.info("wallet.send.success",{transactionId:y.id,hash:C.hash}),C})}approveTransaction(e){return d(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 d(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 d(this,null,function*(){s.info("wallet.addSigner.start");let i=typeof e=="object"&&"type"in e&&e.type==="server"?this.resolveServerSignerApiLocator(e):e;return this.withRecoverySigner(()=>d(this,null,function*(){var u,S;let t=typeof i=="string"?i:N(i),a=yield this.getSignerState(t);if(a.signer!=null){if(this.isApprovedSignerStatus(a.signer.status))return s.info("wallet.addSigner.alreadyApproved"),this.completeSignerRegistration(a.signer,null,r);if(a.pendingOperation!=null)return s.info("wallet.addSigner.resuming",{operationType:a.pendingOperation.type,operationId:a.pendingOperation.id}),this.completeSignerRegistration(a.signer,a.pendingOperation,r)}let h=typeof i=="string"||i.type==="passkey"?i:i.type==="device"&&"publicKey"in i&&i.publicKey!=null?{type:"device",publicKey:i.publicKey,name:i.name}:N(i),o=yield n(this,f).registerSigner(this.walletLocator,b({signer:h,chain:this.getSignerRegistrationChain()},(r==null?void 0:r.scopes)!=null&&{scopes:r.scopes}));if("error"in o)throw s.error("wallet.addSigner.error",{error:o}),o.code===X?new M(o.message):new _(`Failed to register signer: ${JSON.stringify(o.message)}`);let l=j(o,this.chain);if(l==null)throw new Error(`No approval found for chain ${this.chain} in register signer response`);let g=null;if(this.chain==="solana"||this.chain==="stellar"){if(!("transaction"in o)||o.transaction==null)throw s.error("wallet.addSigner.error",{error:"Expected transaction in response for Solana/Stellar chain"}),new Error("Expected transaction in response for Solana/Stellar chain");g={type:"transaction",id:o.transaction.id}}else{if(!("chains"in o))throw s.error("wallet.addSigner.error",{error:"Expected chains in response for EVM chain"}),new Error("Expected chains in response for EVM chain");if(((S=(u=o.chains)==null?void 0:u[this.chain])==null?void 0:S.status)==="failed")throw new Error(`Signer registration failed for chain ${this.chain}`);g=z(o,this.chain)}return this.completeSignerRegistration(l,g,r)}))})}completeSignerRegistration(e,r,i){return d(this,null,function*(){if(i!=null&&i.prepareOnly){if(r==null)return b({},e);switch(r.type){case"transaction":{let t={transactionId:r.id};return s.info("wallet.addSigner.prepared",t),b(b({},e),t)}case"signature":{let t={signatureId:r.id};return s.info("wallet.addSigner.prepared",t),b(b({},e),t)}default:{let t=r.type;throw new Error(`Unknown pending operation type: ${t}`)}}}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 t=r.type;throw new Error(`Unknown pending operation type: ${t}`)}}else s.info("wallet.addSigner.success");return O(b({},e),{status:"success"})})}removeSigner(e,r){return d(this,null,function*(){let i=this.resolveSignerLocator(e);return s.info("wallet.removeSigner.start",{signerLocator:i}),this.withRecoverySigner(()=>d(this,null,function*(){let t=yield n(this,f).removeSigner(this.walletLocator,i,{chain:this.getSignerRegistrationChain()});if("error"in t)throw s.error("wallet.removeSigner.error",{error:t}),new Error(`Failed to remove signer: ${JSON.stringify(t)}`);let a=t.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 d(this,null,function*(){s.info("wallet.useSigner.start"),e.type==="server"&&c(this,x,null),this.validateSignerInput(e);let r=!1;e.type==="device"?yield this.resolveDeviceSignerAvailability(e):r=yield this.resolveNonDeviceSigner(e);let i=this.buildInternalSignerConfig(e),t=N(e);c(this,p,yield this.assembleFullSigner(i,void 0,{isAdminSigner:r})),s.info("wallet.useSigner.success",{signerLocator:t})})}resolveNonDeviceSigner(e){return d(this,null,function*(){if(e.type!=="passkey"&&e.type!=="server"&&this.isRecoverySigner(e))return c(this,w,!1),!0;if(e.type==="passkey"&&this.isPasskeyMissingId(e)&&!(yield this.tryAutoSelectPasskey(e))){if(this.isRecoverySigner(e))return c(this,w,!1),!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 c(this,w,!1),!1;if(this.isRecoverySigner(e))return c(this,w,!1),!0;throw new Error(`Signer "${r}" is not registered in this wallet.`)})}resolveServerSigner(e){return d(this,null,function*(){let{primary:r,legacy:i}=this.deriveServerSignerCandidates(e),t=yield this.signers();if(t.some(h=>h.locator===`server:${r.derivedAddress}`))return c(this,x,r),c(this,w,!1),!1;if(i!=null&&t.some(h=>h.locator===`server:${i.derivedAddress}`))return c(this,x,i),c(this,w,!1),!1;if(this.isRecoverySigner(e))return n(this,L)!=null&&i!=null&&i.derivedAddress===n(this,L)?c(this,x,i):c(this,x,r),c(this,w,!1),!0;let a=i!=null?`"server:${r.derivedAddress}" or "server:${i.derivedAddress}"`:`"server:${r.derivedAddress}"`;throw new Error(`Signer ${a} is not registered in this wallet.`)})}tryAutoSelectPasskey(e){return d(this,null,function*(){let i=(yield this.signers()).filter(t=>t.type==="passkey");if(i.length===0)return!1;if(i.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=i[0].locator.replace("passkey:",""),!0})}resolveSignerLocator(e){return e.type==="server"?this.resolveServerSignerApiLocator(e):N(e)}getSignerRegistrationChain(){if(!(this.chain==="solana"||this.chain==="stellar"))return this.chain}withRecoverySigner(e){return d(this,null,function*(){var t;let r=this.signer;if(W(n(this,v)))throw new Error('Cannot assemble server signer: no secret available. Call wallet.useSigner({ type: "server", secret: ... }) first with the recovery server secret.');if(n(this,v)!=null&&n(this,v).type==="external-wallet"&&!this.isAutoAssemblableSignerConfig(n(this,v)))throw new Error('Cannot assemble external wallet signer: no onSign callback available. Call wallet.useSigner({ type: "external-wallet", address: "0x...", onSign: async (tx) => ... }) first.');let i=this.buildInternalSignerConfig(n(this,v));c(this,p,q(this.chain,i,(t=n(this,A))==null?void 0:t.deviceSignerKeyStorage));try{return yield e()}finally{c(this,p,r)}})}isPasskeyMissingId(e){return e.id==null||e.id===""}signerIsRegistered(e){return d(this,null,function*(){return(yield this.signers()).some(i=>i.locator===e)})}isSignerApproved(e){return d(this,null,function*(){var i;let r=yield this.getSignerState(e);return this.isApprovedSignerStatus((i=r.signer)==null?void 0:i.status)})}isApprovedSignerStatus(e){return e==="success"||e==="active"}needsRecovery(){return n(this,w)}recover(){return d(this,null,function*(){var a,h;if(s.info("wallet.recover.start"),n(this,I)){s.info("wallet.recover.skipped",{reason:"Device signer already approved (cached)"});return}if(n(this,B)){s.info("wallet.recover.skipped",{reason:"device signer not supported (cached)"}),c(this,w,!1),c(this,I,!0);return}let e=()=>{c(this,w,!1),c(this,I,!0)};if(((a=n(this,p))==null?void 0:a.type)==="device"&&(yield this.checkAndResumeDeviceSigner(n(this,p)))){e();return}if(n(this,p)!=null&&n(this,p).type!=="device"){s.warn("wallet.recover.skipped",{reason:"Recovery is only supported for device signers"}),c(this,w,!1);return}let r=(h=n(this,A))==null?void 0:h.deviceSignerKeyStorage;if(r==null){if(!n(this,w))return;throw new Error("Device signer key storage is required to recover a device signer")}let i=yield this.findLocalDeviceSigner(r);if(i!=null&&(yield this.checkAndResumeDeviceSigner(i))){c(this,p,i),e();let o=i.locator().replace("device:","");try{yield r.mapAddressToKey(this.address,o)}catch(l){s.warn("wallet.recover.mapAddressToKey.error",{error:l})}return}let t=yield he(r,this.address);try{yield this.addSigner(t)}catch(o){let l=o instanceof Error&&o.message.toLowerCase().includes("delegated signer")&&o.message.toLowerCase().includes("already")&&o.message.toLowerCase().includes("approved");if(o instanceof M){s.info("wallet.recover.device.unsupportedFallback",{signerLocator:t.locator}),yield r.deleteKey(this.address),c(this,B,!0),c(this,w,!1),c(this,I,!0),yield this.assembleRecoverySignerFallback();return}else if(l)s.info("wallet.recover.skipped",{reason:"Device signer already approved",signerLocator:t.locator});else throw o instanceof de||o instanceof Error&&o.name==="AuthRejectedError"?(s.info("wallet.recover.device.authRejected",{signerLocator:t.locator}),o):(s.error("wallet.recover.device.error",{error:o}),yield r.deleteKey(this.address),o)}c(this,p,yield this.assembleFullSigner({type:"device",locator:t.locator,address:this.address},r)),n(this,p).type==="device"&&(n(this,p).status="success"),s.info("wallet.recover.device.success",{signerLocator:t.locator}),e()})}checkAndResumeDeviceSigner(e){return d(this,null,function*(){var i;if(this.isApprovedSignerStatus(e.status))return s.info("wallet.recover.skipped",{reason:"Device signer already approved"}),!0;let r=yield this.getSignerState(e.locator());return e.status=(i=r.signer)==null?void 0:i.status,r.pendingOperation!=null?(yield this.resumePendingDeviceSignerApproval(e,r.pendingOperation),!0):this.isApprovedSignerStatus(e.status)?(s.info("wallet.recover.skipped",{reason:"Device signer already approved"}),!0):!1})}resumePendingDeviceSignerApproval(e,r){return d(this,null,function*(){var a;let i=n(this,p);if(W(n(this,v)))throw new Error('Cannot resume pending approval: no secret available. Call wallet.useSigner({ type: "server", secret: ... }) first with the recovery server secret.');if(n(this,v)!=null&&n(this,v).type==="external-wallet"&&!this.isAutoAssemblableSignerConfig(n(this,v)))throw new Error('Cannot resume pending approval: no onSign callback available. Call wallet.useSigner({ type: "external-wallet", address: "0x...", onSign: async (tx) => ... }) first.');let t=this.buildInternalSignerConfig(n(this,v));c(this,p,q(this.chain,t,(a=n(this,A))==null?void 0:a.deviceSignerKeyStorage));try{r.type==="signature"?yield this.approveSignatureAndWait(r.id):yield this.approveTransactionAndWait(r.id)}catch(h){throw c(this,p,e),h}finally{n(this,p)!==e&&c(this,p,i)}e.status="success",s.info("wallet.recover.device.success",{signerLocator:e.locator(),resumed:!0})})}findLocalDeviceSigner(e){return d(this,null,function*(){let i=(yield this.signers()).filter(t=>t.locator.startsWith("device:"));for(let t of i){let a=t.locator.replace("device:","");try{if(yield e.hasKey(a)){let o=q(this.chain,{type:"device",locator:t.locator,address:this.address},e);return s.info("wallet.recover.foundLocalDeviceSigner",{signerLocator:t.locator}),o}}catch(h){s.warn("wallet.recover.findLocalDeviceSigner.keyCheckError",{signerLocator:t.locator,error:h})}}return null})}signers(){return d(this,null,function*(){var a,h;s.info("wallet.signers.start");let e=yield n(this,f).getWallet(this.walletLocator);if("error"in e)throw s.error("wallet.signers.error",{error:e}),new Q(JSON.stringify(e));if(e.type!=="smart"||e.chainType!=="evm"&&e.chainType!=="solana"&&e.chainType!=="stellar")throw s.error("wallet.signers.error",{error:`Wallet type ${e.type} not supported`}),new Y(`Wallet type ${e.type} not supported`);let r=(h=(a=e==null?void 0:e.config)==null?void 0:a.delegatedSigners)!=null?h:[],t=(yield Promise.all(r.map(o=>d(this,null,function*(){try{return(yield this.getSignerState(o.locator)).signer}catch(l){return null}})))).filter(o=>o!=null);return s.info("wallet.signers.success",{count:t.length}),t})}get walletLocator(){if(n(this,f).isServerSide)return this.address;{let e;switch(this.chain){case"stellar":e="me:stellar:smart";break;case"solana":e="me:solana:smart";break;default:e="me:evm:smart";break}let r=this.alias!=null?`:alias:${this.alias}`:"";return e+r}}requireSigner(){if(n(this,p)==null)throw n(this,R).length>1?new Error("No signer is set. This wallet has multiple signers configured. Call wallet.useSigner() to select which signer to use before signing operations."):n(this,v).type==="server"?new Error(`No signer is set. Server wallets require calling wallet.useSigner() with the server secret before signing operations.
|
|
2
2
|
Example: wallet.useSigner({ type: "server", secret: process.env.YOUR_SERVER_SECRET })`):n(this,v).type==="external-wallet"||!this.isAutoAssemblableSignerConfig(n(this,v))?new Error(`No signer is set. External wallet signers require calling wallet.useSigner() with the onSign callback before signing operations.
|
|
3
|
-
Example: wallet.useSigner({ type: "external-wallet", address: "0x...", onSign: async (tx) => ... })`):new Error("This wallet is read-only because no signer was provided. Operations that require signing (send, approve, addSigner, etc.) are not available.");return n(this,p)}preAuthIfNeeded(){return d(this,null,function*(){yield n(this,K),n(this,D)==null&&c(this,D,this.recover());try{yield n(this,D)}finally{c(this,D,null)}let e=this.requireSigner();e instanceof ge&&(yield e.ensureAuthenticated())})}isRecoverySigner(e){let r=n(this,v);if(r==null||r.type!==e.type||e.type==="device")return!1;if(e.type==="passkey")return!0;if(e.type==="server"&&r.type==="server"){let i=o=>{if(W(o))return[o.address];let{primary:l,legacy:g}=this.deriveServerSignerCandidates(o),u=[l.derivedAddress];return g!=null&&u.push(g.derivedAddress),u},t=i(e),a=i(r);if(!t.some(o=>a.includes(o)))return!1}else if(N(e)!==N(r))return!1;return c(this,v,e),!0}validateSignerInput(e){switch(e.type){case"email":if(!("email"in e)||e.email==null)throw new Error("Email signer requires an email address");break;case"phone":if(!("phone"in e)||e.phone==null)throw new Error("Phone signer requires a phone number");break;case"external-wallet":if(!("address"in e)||e.address==null)throw new Error("External wallet signer requires a wallet address");if(!("onSign"in e)||typeof e.onSign!="function")throw new Error("External wallet signer requires an onSign callback");break;case"passkey":case"device":case"api-key":break;default:break}}resolveDeviceSignerAvailability(e){return d(this,null,function*(){var h;let r=(h=n(this,b))==null?void 0:h.deviceSignerKeyStorage;if(r==null)throw new Error("Device signer key storage is required for device signers");let i=yield r.getKey(this.address);if(i!=null){e.locator=`device:${i}`;return}let a=(yield this.signers()).filter(o=>o.locator.startsWith("device:"));for(let o of a){let l=o.locator.replace("device:","");if(yield r.hasKey(l)){yield r.mapAddressToKey(this.address,l),e.locator=o.locator;return}}c(this,w,!0),c(this,I,!1)})}assembleFullSigner(a){return d(this,arguments,function*(e,r=(t=>(t=n(this,b))==null?void 0:t.deviceSignerKeyStorage)(),i){var o;let h=q(this.chain,e,r);if(i!=null&&i.isAdminSigner)h.status="active";else{let l=yield this.getSignerState(h.locator());h.status=(o=l.signer)==null?void 0:o.status}return h})}getSignerState(e){return d(this,null,function*(){let r=null;try{r=yield n(this,f).getSigner(this.walletLocator,e)}catch(t){return{response:null,signer:null,pendingOperation:null}}if(r==null||typeof r!="object"||"error"in r)return{response:null,signer:null,pendingOperation:null};let i=j(r,this.chain);return{response:r,signer:i,pendingOperation:z(r,this.chain)}})}buildInternalSignerConfig(e){var r,i,t,a,h,o;switch(e.type){case"email":return{type:"email",email:e.email,locator:`email:${e.email}`,address:this.address,crossmint:n(this,f).crossmint,clientTEEConnection:(r=n(this,b))==null?void 0:r.clientTEEConnection,onAuthRequired:(t=(i=n(this,b))==null?void 0:i.callbacks)==null?void 0:t.onAuthRequired};case"phone":return{type:"phone",phone:e.phone,locator:`phone:${e.phone}`,address:this.address,crossmint:n(this,f).crossmint,clientTEEConnection:(a=n(this,b))==null?void 0:a.clientTEEConnection,onAuthRequired:(o=(h=n(this,b))==null?void 0:h.callbacks)==null?void 0:o.onAuthRequired};case"passkey":{let l="id"in e&&e.id?e.id:"";return{type:"passkey",id:l,locator:`passkey:${l}`,name:"name"in e?e.name:void 0,publicKey:"publicKey"in e?e.publicKey:void 0,onCreatePasskey:e.onCreatePasskey,onSignWithPasskey:e.onSignWithPasskey}}case"device":return{type:"device",locator:"locator"in e&&e.locator?e.locator:void 0,address:this.address};case"external-wallet":return O(A({},e),{locator:`external-wallet:${e.address}`});case"api-key":return{type:"api-key",locator:"api-key",address:this.address};case"server":{let{derivedKeyBytes:l,derivedAddress:g}=this.resolveServerSignerDerivation(e);return{type:"server",derivedKeyBytes:l,locator:`server:${g}`,address:g}}default:throw new Error(`Unknown signer type: ${e==null?void 0:e.type}`)}}isAutoAssemblableSignerConfig(e){var r;switch(e.type){case"email":case"phone":case"passkey":case"api-key":return!0;case"device":return((r=n(this,b))==null?void 0:r.deviceSignerKeyStorage)!=null;case"server":return!W(e);case"external-wallet":return"onSign"in e&&typeof e.onSign=="function";default:return!1}}get isSolanaWallet(){return this.chain==="solana"}resolveChainForEnvironment(){let e=ce(this.chain,n(this,f).environment);return e!==this.chain&&(this.chain=e),this.chain}approveTransactionAndWait(e,r){return d(this,null,function*(){return yield this.approveTransactionInternal(e,r),yield this.sleep(1e3),yield this.waitForTransaction(e)})}approveSignatureAndWait(e,r){return d(this,null,function*(){let i=yield this.approveSignatureInternal(e,r);return!("error"in i)&&i.status==="success"&&i.outputSignature!=null?{signature:i.outputSignature,signatureId:e}:(yield this.sleep(1e3),yield this.waitForSignature(e))})}approveSignatureInternal(e,r){return d(this,null,function*(){var l,g;if(this.isSolanaWallet)throw new Error("Approving signatures is only supported for EVM smart wallets");let i=this.requireSigner(),t=yield n(this,f).getSignature(this.walletLocator,e);if("error"in t)throw new G(JSON.stringify(t));if(i.type==="api-key")return t;if((r==null?void 0:r.approval)!=null){let u=[r.approval];return yield this.executeApproveSignatureWithErrorHandling(e,u)}let a=(l=t.approvals)==null?void 0:l.pending;if(a==null||a.length===0)return t;let h=[...(g=r==null?void 0:r.additionalSigners)!=null?g:[],i],o=yield Promise.all(a.map(u=>d(this,null,function*(){let S=h.find(C=>C.locator()===u.signer.locator);if(S==null)throw new _(`Signer ${u.signer.locator} not found in pending approvals`);let y=yield S.signMessage(u.message);return O(A({},y),{signer:S.locator()})})));return yield this.executeApproveSignatureWithErrorHandling(e,o)})}approveTransactionInternal(e,r){return d(this,null,function*(){var l,g,u,S,y;let i=yield n(this,f).getTransaction(this.walletLocator,e);if("error"in i)throw new V(JSON.stringify(i));yield(u=(g=(l=n(this,b))==null?void 0:l.callbacks)==null?void 0:g.onTransactionStart)==null?void 0:u.call(g);let t=this.requireSigner();if(t.type==="api-key")return i;if((r==null?void 0:r.approval)!=null){let C=[r.approval];return yield this.executeApproveTransactionWithErrorHandling(e,C)}let a=(S=i.approvals)==null?void 0:S.pending;if(a==null||a.length===0)return i;let h=[...(y=r==null?void 0:r.additionalSigners)!=null?y:[],t],o=yield Promise.all(a.map(C=>d(this,null,function*(){let F=h.find(ve=>ve.locator()===C.signer.locator);if(F==null)throw new _(`Signer ${C.signer.locator} not found in pending approvals`);let H=F.type==="device",J=i.chainType==="solana"&&"transaction"in i.onChain&&!H?i.onChain.transaction:C.message,Se=yield F.signTransaction(J);return O(A({},Se),{signer:F.locator()})})));return yield this.executeApproveTransactionWithErrorHandling(e,o)})}executeApproveTransactionWithErrorHandling(e,r){return d(this,null,function*(){s.info("wallet.approve: submitting approval to API",{transactionId:e});let i=yield n(this,f).approveTransaction(this.walletLocator,e,{approvals:r});if(i.error)throw new oe(JSON.stringify(i));return i})}executeApproveSignatureWithErrorHandling(e,r){return d(this,null,function*(){let i=yield n(this,f).approveSignature(this.walletLocator,e,{approvals:r});if(i.error)throw new ee(JSON.stringify(i));return i})}waitForSignature(e){return d(this,null,function*(){let r=null;do if(yield new Promise(i=>setTimeout(i,U)),r=yield n(this,f).getSignature(this.walletLocator,e),"error"in r)throw new G(JSON.stringify(r));while(r===null||r.status==="pending");if(r.status==="failed")throw new Z("Signature signing failed");if(!r.outputSignature)throw new G("Signature not available");return{signature:r.outputSignature,signatureId:e}})}waitForTransaction(h){return d(this,arguments,function*(e,r=6e4,{backoffMultiplier:i=1.1,maxBackoffMs:t=2e3,initialBackoffMs:a=U}={}){var S,y;s.info("wallet.approve: waiting for transaction confirmation",{transactionId:e,timeoutMs:r});let o=Date.now(),l;do{if(Date.now()-o>r)throw new te("Transaction confirmation timeout");if(l=yield n(this,f).getTransaction(this.walletLocator,e),l.error)throw new V(JSON.stringify(l));yield this.sleep(a),a=Math.min(a*i,t)}while(l.status==="pending");if(l.status==="failed")throw new ne(`Transaction sending failed: ${JSON.stringify(l.error)}`);if(l.status==="awaiting-approval")throw new se("Transaction is awaiting approval. Please submit required approvals before waiting for completion.");let g="txHash"in l.onChain&&typeof l.onChain.txHash=="string"?l.onChain.txHash:void 0,u=(S=l.onChain.txId)!=null?S:g;if(u==null)throw new ae("Transaction hash not found on transaction response");return{hash:u,explorerLink:(y=l.onChain.explorerLink)!=null?y:"",transactionId:l.id}})}sleep(e){return d(this,null,function*(){return new Promise(r=>setTimeout(r,e))})}};p=new WeakMap,b=new WeakMap,f=new WeakMap,v=new WeakMap,R=new WeakMap,w=new WeakMap,I=new WeakMap,x=new WeakMap,L=new WeakMap,$=new WeakMap,K=new WeakMap,D=new WeakMap,B=new WeakMap,k([P({logger:s,methodName:"wallet.balances",buildContext(e){return{chain:e.chain,address:e.address}}})],E.prototype,"balances",1),k([P({logger:s,methodName:"wallet.stagingFund",buildContext(e){return{chain:e.chain,address:e.address}}})],E.prototype,"stagingFund",1),k([P({logger:s,methodName:"wallet.send",buildContext(e){return{chain:e.chain,address:e.address}}})],E.prototype,"send",1),k([P({logger:s,methodName:"wallet.approve",buildContext(e){return{chain:e.chain,address:e.address}}})],E.prototype,"approve",1),k([P({logger:s,methodName:"wallet.addSigner",buildContext(e){return{chain:e.chain,address:e.address}}})],E.prototype,"addSigner",1),k([P({logger:s,methodName:"wallet.removeSigner",buildContext(e){return{chain:e.chain,address:e.address}}})],E.prototype,"removeSigner",1),k([P({logger:s,methodName:"wallet.useSigner",buildContext(e){return{chain:e.chain,address:e.address}}})],E.prototype,"useSigner",1),k([P({logger:s,methodName:"wallet.recover",buildContext(e){return{chain:e.chain,address:e.address}}})],E.prototype,"recover",1),k([P({logger:s,methodName:"wallet.signers",buildContext(e){return{chain:e.chain,address:e.address}}})],E.prototype,"signers",1);function fe(m){if(typeof m=="string"){if(!pe(m))throw new le(`Invalid recipient address: "${m}". Expected a valid EVM (0x...), Solana (base58), or Stellar (G.../C...) address.`);return m}if("email"in m)return`email:${m.email}`;if("x"in m)return`x:${m.x}`;if("twitter"in m)return`twitter:${m.twitter}`;if("phone"in m)return`phoneNumber:${m.phone}`;if("userId"in m)return`userId:${m.userId}`;throw new Error("Invalid recipient locator")}function we(m,e){return pe(m)?`${e}:${m}`:`${e}:${m.toLowerCase()}`}export{E as a};
|
|
3
|
+
Example: wallet.useSigner({ type: "external-wallet", address: "0x...", onSign: async (tx) => ... })`):new Error("This wallet is read-only because no signer was provided. Operations that require signing (send, approve, addSigner, etc.) are not available.");return n(this,p)}preAuthIfNeeded(){return d(this,null,function*(){yield n(this,K),n(this,D)==null&&c(this,D,this.recover());try{yield n(this,D)}finally{c(this,D,null)}let e=this.requireSigner();e instanceof ge&&(yield e.ensureAuthenticated())})}isRecoverySigner(e){let r=n(this,v);if(r==null||r.type!==e.type||e.type==="device")return!1;if(e.type==="passkey")return!0;if(e.type==="server"&&r.type==="server"){let i=o=>{if(W(o))return[o.address];let{primary:l,legacy:g}=this.deriveServerSignerCandidates(o),u=[l.derivedAddress];return g!=null&&u.push(g.derivedAddress),u},t=i(e),a=i(r);if(!t.some(o=>a.includes(o)))return!1}else if(N(e)!==N(r))return!1;return c(this,v,e),!0}validateSignerInput(e){switch(e.type){case"email":if(!("email"in e)||e.email==null)throw new Error("Email signer requires an email address");break;case"phone":if(!("phone"in e)||e.phone==null)throw new Error("Phone signer requires a phone number");break;case"external-wallet":if(!("address"in e)||e.address==null)throw new Error("External wallet signer requires a wallet address");if(!("onSign"in e)||typeof e.onSign!="function")throw new Error("External wallet signer requires an onSign callback");break;case"passkey":case"device":case"api-key":break;default:break}}resolveDeviceSignerAvailability(e){return d(this,null,function*(){var h;let r=(h=n(this,A))==null?void 0:h.deviceSignerKeyStorage;if(r==null)throw new Error("Device signer key storage is required for device signers");let i=yield r.getKey(this.address);if(i!=null){e.locator=`device:${i}`;return}let a=(yield this.signers()).filter(o=>o.locator.startsWith("device:"));for(let o of a){let l=o.locator.replace("device:","");if(yield r.hasKey(l)){yield r.mapAddressToKey(this.address,l),e.locator=o.locator;return}}c(this,w,!0),c(this,I,!1)})}assembleFullSigner(a){return d(this,arguments,function*(e,r=(t=>(t=n(this,A))==null?void 0:t.deviceSignerKeyStorage)(),i){var o;let h=q(this.chain,e,r);if(i!=null&&i.isAdminSigner)h.status="active";else{let l=yield this.getSignerState(h.locator());h.status=(o=l.signer)==null?void 0:o.status}return h})}getSignerState(e){return d(this,null,function*(){let r=null;try{r=yield n(this,f).getSigner(this.walletLocator,e)}catch(t){return{response:null,signer:null,pendingOperation:null}}if(r==null||typeof r!="object"||"error"in r)return{response:null,signer:null,pendingOperation:null};let i=j(r,this.chain);return{response:r,signer:i,pendingOperation:z(r,this.chain)}})}buildInternalSignerConfig(e){var r,i,t,a,h,o;switch(e.type){case"email":return{type:"email",email:e.email,locator:`email:${e.email}`,address:this.address,crossmint:n(this,f).crossmint,clientTEEConnection:(r=n(this,A))==null?void 0:r.clientTEEConnection,onAuthRequired:(t=(i=n(this,A))==null?void 0:i.callbacks)==null?void 0:t.onAuthRequired};case"phone":return{type:"phone",phone:e.phone,locator:`phone:${e.phone}`,address:this.address,crossmint:n(this,f).crossmint,clientTEEConnection:(a=n(this,A))==null?void 0:a.clientTEEConnection,onAuthRequired:(o=(h=n(this,A))==null?void 0:h.callbacks)==null?void 0:o.onAuthRequired};case"passkey":{let l="id"in e&&e.id?e.id:"";return{type:"passkey",id:l,locator:`passkey:${l}`,name:"name"in e?e.name:void 0,publicKey:"publicKey"in e?e.publicKey:void 0,onCreatePasskey:e.onCreatePasskey,onSignWithPasskey:e.onSignWithPasskey}}case"device":return{type:"device",locator:"locator"in e&&e.locator?e.locator:void 0,address:this.address};case"external-wallet":return O(b({},e),{locator:`external-wallet:${e.address}`});case"api-key":return{type:"api-key",locator:"api-key",address:this.address};case"server":{let{derivedKeyBytes:l,derivedAddress:g}=this.resolveServerSignerDerivation(e);return{type:"server",derivedKeyBytes:l,locator:`server:${g}`,address:g}}default:throw new Error(`Unknown signer type: ${e==null?void 0:e.type}`)}}isAutoAssemblableSignerConfig(e){var r;switch(e.type){case"email":case"phone":case"passkey":case"api-key":return!0;case"device":return((r=n(this,A))==null?void 0:r.deviceSignerKeyStorage)!=null;case"server":return!W(e);case"external-wallet":return"onSign"in e&&typeof e.onSign=="function";default:return!1}}get isSolanaWallet(){return this.chain==="solana"}resolveChainForEnvironment(){let e=ce(this.chain,n(this,f).environment);return e!==this.chain&&(this.chain=e),this.chain}approveTransactionAndWait(e,r){return d(this,null,function*(){return yield this.approveTransactionInternal(e,r),yield this.sleep(1e3),yield this.waitForTransaction(e)})}approveSignatureAndWait(e,r){return d(this,null,function*(){let i=yield this.approveSignatureInternal(e,r);return!("error"in i)&&i.status==="success"&&i.outputSignature!=null?{signature:i.outputSignature,signatureId:e}:(yield this.sleep(1e3),yield this.waitForSignature(e))})}approveSignatureInternal(e,r){return d(this,null,function*(){var l,g;if(this.isSolanaWallet)throw new Error("Approving signatures is only supported for EVM smart wallets");let i=this.requireSigner(),t=yield n(this,f).getSignature(this.walletLocator,e);if("error"in t)throw new G(JSON.stringify(t));if(i.type==="api-key")return t;if((r==null?void 0:r.approval)!=null){let u=[r.approval];return yield this.executeApproveSignatureWithErrorHandling(e,u)}let a=(l=t.approvals)==null?void 0:l.pending;if(a==null||a.length===0)return t;let h=[...(g=r==null?void 0:r.additionalSigners)!=null?g:[],i],o=yield Promise.all(a.map(u=>d(this,null,function*(){let S=h.find(C=>C.locator()===u.signer.locator);if(S==null)throw new _(`Signer ${u.signer.locator} not found in pending approvals`);let y=yield S.signMessage(u.message);return O(b({},y),{signer:S.locator()})})));return yield this.executeApproveSignatureWithErrorHandling(e,o)})}approveTransactionInternal(e,r){return d(this,null,function*(){var l,g,u,S,y;let i=yield n(this,f).getTransaction(this.walletLocator,e);if("error"in i)throw new V(JSON.stringify(i));yield(u=(g=(l=n(this,A))==null?void 0:l.callbacks)==null?void 0:g.onTransactionStart)==null?void 0:u.call(g);let t=this.requireSigner();if(t.type==="api-key")return i;if((r==null?void 0:r.approval)!=null){let C=[r.approval];return yield this.executeApproveTransactionWithErrorHandling(e,C)}let a=(S=i.approvals)==null?void 0:S.pending;if(a==null||a.length===0)return i;let h=[...(y=r==null?void 0:r.additionalSigners)!=null?y:[],t],o=yield Promise.all(a.map(C=>d(this,null,function*(){let F=h.find(ve=>ve.locator()===C.signer.locator);if(F==null)throw new _(`Signer ${C.signer.locator} not found in pending approvals`);let H=F.type==="device",J=i.chainType==="solana"&&"transaction"in i.onChain&&!H?i.onChain.transaction:C.message,Se=yield F.signTransaction(J);return O(b({},Se),{signer:F.locator()})})));return yield this.executeApproveTransactionWithErrorHandling(e,o)})}executeApproveTransactionWithErrorHandling(e,r){return d(this,null,function*(){s.info("wallet.approve: submitting approval to API",{transactionId:e});let i=yield n(this,f).approveTransaction(this.walletLocator,e,{approvals:r});if(i.error)throw new oe(JSON.stringify(i));return i})}executeApproveSignatureWithErrorHandling(e,r){return d(this,null,function*(){let i=yield n(this,f).approveSignature(this.walletLocator,e,{approvals:r});if(i.error)throw new ee(JSON.stringify(i));return i})}waitForSignature(e){return d(this,null,function*(){let r=null;do if(yield new Promise(i=>setTimeout(i,U)),r=yield n(this,f).getSignature(this.walletLocator,e),"error"in r)throw new G(JSON.stringify(r));while(r===null||r.status==="pending");if(r.status==="failed")throw new Z("Signature signing failed");if(!r.outputSignature)throw new G("Signature not available");return{signature:r.outputSignature,signatureId:e}})}waitForTransaction(h){return d(this,arguments,function*(e,r=6e4,{backoffMultiplier:i=1.1,maxBackoffMs:t=2e3,initialBackoffMs:a=U}={}){var S,y;s.info("wallet.approve: waiting for transaction confirmation",{transactionId:e,timeoutMs:r});let o=Date.now(),l;do{if(Date.now()-o>r)throw new te("Transaction confirmation timeout");if(l=yield n(this,f).getTransaction(this.walletLocator,e),l.error)throw new V(JSON.stringify(l));yield this.sleep(a),a=Math.min(a*i,t)}while(l.status==="pending");if(l.status==="failed")throw new ne(`Transaction sending failed: ${JSON.stringify(l.error)}`);if(l.status==="awaiting-approval")throw new se("Transaction is awaiting approval. Please submit required approvals before waiting for completion.");let g="txHash"in l.onChain&&typeof l.onChain.txHash=="string"?l.onChain.txHash:void 0,u=(S=l.onChain.txId)!=null?S:g;if(u==null)throw new ae("Transaction hash not found on transaction response");return{hash:u,explorerLink:(y=l.onChain.explorerLink)!=null?y:"",transactionId:l.id}})}sleep(e){return d(this,null,function*(){return new Promise(r=>setTimeout(r,e))})}};p=new WeakMap,A=new WeakMap,f=new WeakMap,v=new WeakMap,R=new WeakMap,w=new WeakMap,I=new WeakMap,x=new WeakMap,L=new WeakMap,$=new WeakMap,K=new WeakMap,D=new WeakMap,B=new WeakMap,k([P({logger:s,methodName:"wallet.balances",buildContext(e){return{chain:e.chain,address:e.address}}})],E.prototype,"balances",1),k([P({logger:s,methodName:"wallet.stagingFund",buildContext(e){return{chain:e.chain,address:e.address}}})],E.prototype,"stagingFund",1),k([P({logger:s,methodName:"wallet.send",buildContext(e){return{chain:e.chain,address:e.address}}})],E.prototype,"send",1),k([P({logger:s,methodName:"wallet.approve",buildContext(e){return{chain:e.chain,address:e.address}}})],E.prototype,"approve",1),k([P({logger:s,methodName:"wallet.addSigner",buildContext(e){return{chain:e.chain,address:e.address}}})],E.prototype,"addSigner",1),k([P({logger:s,methodName:"wallet.removeSigner",buildContext(e){return{chain:e.chain,address:e.address}}})],E.prototype,"removeSigner",1),k([P({logger:s,methodName:"wallet.useSigner",buildContext(e){return{chain:e.chain,address:e.address}}})],E.prototype,"useSigner",1),k([P({logger:s,methodName:"wallet.recover",buildContext(e){return{chain:e.chain,address:e.address}}})],E.prototype,"recover",1),k([P({logger:s,methodName:"wallet.signers",buildContext(e){return{chain:e.chain,address:e.address}}})],E.prototype,"signers",1);function fe(m){if(typeof m=="string"){if(!pe(m))throw new le(`Invalid recipient address: "${m}". Expected a valid EVM (0x...), Solana (base58), or Stellar (G.../C...) address.`);return m}if("email"in m)return`email:${m.email}`;if("x"in m)return`x:${m.x}`;if("twitter"in m)return`twitter:${m.twitter}`;if("phone"in m)return`phoneNumber:${m.phone}`;if("userId"in m)return`userId:${m.userId}`;throw new Error("Invalid recipient locator")}function we(m,e){return pe(m)?`${e}:${m}`:`${e}:${m.toLowerCase()}`}export{E as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkJBP52JOHcjs = require('./chunk-JBP52JOH.cjs');var _chunkAS2YN2YCcjs = require('./chunk-AS2YN2YC.cjs');var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkJBP52JOHcjs = require('./chunk-JBP52JOH.cjs');var _chunkAS2YN2YCcjs = require('./chunk-AS2YN2YC.cjs');var _chunkCFB27BFVcjs = require('./chunk-CFB27BFV.cjs');var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var f=class{constructor(i){this.config=i;this._needsAuth=!0;this._authPromise=null;this._initializationPromise=null;typeof window!="undefined"&&(this._initializationPromise=this.initialize()),this.type=this.config.type}locator(){return this.config.locator}address(){return this.config.address}initialize(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){try{if(this.config.clientTEEConnection==null){let i=_commonsdkbase.validateAPIKey.call(void 0, this.config.crossmint.apiKey);if(!i.isValid)throw new Error("Invalid API key");let t=new (0, _chunkJBP52JOHcjs.a)({environment:i.environment});this.config.clientTEEConnection=yield t.initialize()}}finally{this._initializationPromise=null}})}getTEEConnection(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){if(this.config.clientTEEConnection==null){if(this._initializationPromise){if(yield this._initializationPromise,this.config.clientTEEConnection==null)throw new Error("Failed to initialize TEE connection");return this.config.clientTEEConnection}this._initializationPromise=this.initializeTEEConnection();try{yield this._initializationPromise}finally{this._initializationPromise=null}}if(this.config.clientTEEConnection==null)throw new Error("TEE connection is not initialized");return this.config.clientTEEConnection})}initializeTEEConnection(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){_chunkCFB27BFVcjs.a.info("TEE connection not initialized, initializing now");let i=_commonsdkbase.validateAPIKey.call(void 0, this.config.crossmint.apiKey);if(!i.isValid)throw new Error("Invalid API key");let t=new (0, _chunkJBP52JOHcjs.a)({environment:i.environment});if(this.config.clientTEEConnection=yield t.initialize(),this.config.clientTEEConnection==null)throw new Error("Failed to initialize TEE connection");_chunkCFB27BFVcjs.a.info("TEE connection initialized successfully")})}handleAuthRequired(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var u;let i=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 */ }`);_chunkCFB27BFVcjs.a.info("get-status: sending request");let t=Date.now(),r=yield i.sendAction({event:"request:get-status",responseEvent:"response:get-status",data:{authData:{jwt:(u=this.config.crossmint.jwt)!=null?u:"",apiKey:this.config.crossmint.apiKey}},options:d}),n=Date.now()-t;if((r==null?void 0:r.status)!=="success")throw _chunkCFB27BFVcjs.a.error("get-status: failed",{status:r==null?void 0:r.status,error:r==null?void 0:r.error,durationMs:n}),new Error(r==null?void 0:r.error);if(_chunkCFB27BFVcjs.a.info("get-status: response received",{signerStatus:r.signerStatus,durationMs:n}),r.signerStatus==="ready"){this._needsAuth=!1;return}else this._needsAuth=!0;_chunkCFB27BFVcjs.a.info("Auth required, initiating OTP flow",{needsAuth:this._needsAuth});let{promise:a,resolve:s,reject:c}=this.createAuthPromise();if(this._authPromise={promise:a,resolve:s,reject:c},this.config.onAuthRequired)try{yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),e=>this.verifyOtp(e),()=>_chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){_chunkCFB27BFVcjs.a.info("Auth rejected",{authRejected:!0}),this._needsAuth=!1,this.config.onAuthRequired!=null&&(yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),e=>this.verifyOtp(e),()=>{var e;return(e=this._authPromise)==null?void 0:e.reject(new _chunkAS2YN2YCcjs.a)})),c(new _chunkAS2YN2YCcjs.a)}))}catch(e){_chunkCFB27BFVcjs.a.error("handleAuthRequired error",{error:e}),c(e)}try{yield a}catch(e){throw _chunkCFB27BFVcjs.a.error("handleAuthRequired promise error",{error:e}),e}})}ensureAuthenticated(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){yield this.handleAuthRequired()})}getJwtOrThrow(){let i=this.config.crossmint.jwt;if(i==null)throw new Error("JWT is required");return i}createAuthPromise(){let i,t;return{promise:new Promise((n,a)=>{i=n,t=a}),resolve:i,reject:t}}sendMessageWithOtp(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var s,c;let i=yield this.getTEEConnection(),t=this.getAuthId();_chunkCFB27BFVcjs.a.info("start-onboarding: sending request");let r=Date.now(),n=yield i.sendAction({event:"request:start-onboarding",responseEvent:"response:start-onboarding",data:{authData:{jwt:(s=this.config.crossmint.jwt)!=null?s:"",apiKey:this.config.crossmint.apiKey},data:{authId:t}},options:d}),a=Date.now()-r;if(_chunkCFB27BFVcjs.a.info("start-onboarding: response received",{status:n==null?void 0:n.status,durationMs:a}),(n==null?void 0:n.status)==="success"&&n.signerStatus==="ready"){this._needsAuth=!1;return}(n==null?void 0:n.status)==="error"&&(_chunkCFB27BFVcjs.a.error("start-onboarding: failed",{error:n.error}),(c=this._authPromise)==null||c.reject(new Error(n.error||"Failed to initiate OTP process.")))})}getAuthId(){return this.config.type==="email"?`email:${this.config.email}`:`phone:${this.config.phone}`}verifyOtp(i){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var a,s,c,u;let t;try{let e=yield this.getTEEConnection();_chunkCFB27BFVcjs.a.info("complete-onboarding: sending request");let E=Date.now();t=yield e.sendAction({event:"request:complete-onboarding",responseEvent:"response:complete-onboarding",data:{authData:{jwt:(a=this.config.crossmint.jwt)!=null?a:"",apiKey:this.config.crossmint.apiKey},data:{onboardingAuthentication:{encryptedOtp:i}}},options:d}),_chunkCFB27BFVcjs.a.info("complete-onboarding: response received",{status:t==null?void 0:t.status,durationMs:Date.now()-E})}catch(e){throw _chunkCFB27BFVcjs.a.error("complete-onboarding: error",{error:e}),this._needsAuth=!0,(s=this._authPromise)==null||s.reject(e),e}if((t==null?void 0:t.status)==="success"){this._needsAuth=!1,this.config.onAuthRequired!=null&&(yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),e=>this.verifyOtp(e),()=>{var e;return(e=this._authPromise)==null?void 0:e.reject(new _chunkAS2YN2YCcjs.a)})),(c=this._authPromise)==null||c.resolve();return}_chunkCFB27BFVcjs.a.error("complete-onboarding: OTP validation failed",{status:t==null?void 0:t.status}),this._needsAuth=!0;let r=(t==null?void 0:t.status)==="error"?t.error:"Failed to validate encrypted OTP",n=new Error(r);throw(u=this._authPromise)==null||u.reject(n),n})}_exportPrivateKey(i,t){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){yield this.handleAuthRequired();let r=this.getJwtOrThrow(),{scheme:n,encoding:a}=this.getChainKeyParams();if(t!=null){let c=i.on("event:key-exported",u=>{i.off(c),u.status==="success"&&Promise.resolve().then(()=>t()).catch(()=>{console.error("[NCS Signer] onExport callback error")})})}let s=yield i.sendAction({event:"request:export-signer",responseEvent:"response:export-signer",data:{authData:{jwt:r,apiKey:this.config.crossmint.apiKey},data:{scheme:n,encoding:a}},options:d});if((s==null?void 0:s.status)==="error")throw new Error(s.error||"Failed to export private key")})}};_chunk2GKPWQBQcjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkCFB27BFVcjs.a,methodName:"handleAuthRequired"})],f.prototype,"handleAuthRequired",1);var d={timeoutMs:3e4};exports.a = f; exports.b = d;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as r}from"./chunk-
|
|
1
|
+
import{a as r}from"./chunk-YSB7XIS7.js";import{a as h}from"./chunk-2O6HQK34.js";import{v as S}from"./chunk-5OYPWGMX.js";import{a as t}from"./chunk-UBDPBFAR.js";import{c as u,g as c}from"./chunk-J3R36SGJ.js";import T from"bs58";import{isValidSolanaAddress as y,WithLoggerContext as m}from"@crossmint/common-sdk-base";var o=class o extends r{constructor(e){super({chain:e.chain,address:e.address,owner:e.owner,options:r.getOptions(e),alias:e.alias,recovery:r.getRecovery(e),apiRecoveryServerSignerAddress:r.getApiRecoveryServerSignerAddress(e),apiDelegatedServerSignerAddresses:r.getApiDelegatedServerSignerAddresses(e),signer:e.signer,signers:r.getInitialSigners(e)},r.getApiClient(e))}static from(e){if(!y(e.address))throw new Error("Wallet is not a Solana wallet");return new o(e)}sendTransaction(e){return c(this,null,function*(){var l,p;t.info("solanaWallet.sendTransaction.start"),yield this.preAuthIfNeeded();let n=yield this.createTransaction(e);if((l=e.options)!=null&&l.prepareOnly)return t.info("solanaWallet.sendTransaction.prepared",{transactionId:n.id}),{hash:void 0,explorerLink:void 0,transactionId:n.id};let i={additionalSigners:(p=e.additionalSigners)==null?void 0:p.map(d=>new h({type:"external-wallet",address:d.publicKey.toString(),locator:`external-wallet:${d.publicKey.toString()}`,onSign:g=>(g.sign([d]),Promise.resolve(g))}))},a=yield this.approveTransactionAndWait(n.id,i);return t.info("solanaWallet.sendTransaction.success",{transactionId:n.id,hash:a.hash}),a})}createTransaction(e){return c(this,null,function*(){var a;let n;((a=e.options)==null?void 0:a.signer)==null?n=this.requireSigner().locator():typeof e.options.signer=="string"?n=e.options.signer:n=this.resolveServerSignerApiLocator(e.options.signer);let s;"serializedTransaction"in e?s=e.serializedTransaction:s=T.encode(e.transaction.serialize());let i=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:s,signer:n}});if("error"in i)throw new S(JSON.stringify(i));return i})}};u([m({logger:t,methodName:"solanaWallet.sendTransaction",buildContext(e){return{chain:e.chain,address:e.address}}})],o.prototype,"sendTransaction",1);var f=o;export{f as a};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkWUNTNM5Rcjs = require('./chunk-WUNTNM5R.cjs');var _chunk52I473WCcjs = require('./chunk-52I473WC.cjs');var _chunkSI4L3UZ4cjs = require('./chunk-SI4L3UZ4.cjs');var _chunkJFG54X5Xcjs = require('./chunk-JFG54X5X.cjs');require('./chunk-KW2623VI.cjs');require('./chunk-6EUBBDIV.cjs');var _chunkBTMBO7VMcjs = require('./chunk-BTMBO7VM.cjs');require('./chunk-CUHDOBKN.cjs');var _chunkYHV3672Rcjs = require('./chunk-YHV3672R.cjs');var _chunkA3J3367Ocjs = require('./chunk-A3J3367O.cjs');var _chunk3VYGTPRFcjs = require('./chunk-3VYGTPRF.cjs');require('./chunk-NX256LAH.cjs');require('./chunk-KXKBZNET.cjs');require('./chunk-AET7QPSV.cjs');require('./chunk-5IC7UWND.cjs');require('./chunk-GZP2JQ6P.cjs');require('./chunk-IGRPHTXZ.cjs');require('./chunk-I3RWATD5.cjs');require('./chunk-ENU3EKBG.cjs');require('./chunk-3SVXPFSP.cjs');require('./chunk-4DJWSV7I.cjs');require('./chunk-YF5G4U6L.cjs');require('./chunk-PO6S7UR3.cjs');require('./chunk-RLBY6JO3.cjs');require('./chunk-4LXI2OQW.cjs');require('./chunk-BI3AUJVK.cjs');require('./chunk-YYFLQQPV.cjs');require('./chunk-JBP52JOH.cjs');require('./chunk-5FH7WFWL.cjs');require('./chunk-SPTXAOFR.cjs');var _chunkAS2YN2YCcjs = require('./chunk-AS2YN2YC.cjs');require('./chunk-YGL4ITFK.cjs');require('./chunk-GEY3BU62.cjs');require('./chunk-PHPBBEXU.cjs');require('./chunk-A33BEWR7.cjs');require('./chunk-OGP7B5O3.cjs');require('./chunk-IJ632UXD.cjs');require('./chunk-E4EOD7MP.cjs');require('./chunk-SCEPJO4Q.cjs');require('./chunk-6HXIZLEQ.cjs');var _chunkF2HEHICCcjs = require('./chunk-F2HEHICC.cjs');require('./chunk-ECAM5KTH.cjs');require('./chunk-AAUS7KTR.cjs');require('./chunk-GEY574TH.cjs');require('./chunk-UE3WVHTM.cjs');require('./chunk-5X4EOJFG.cjs');require('./chunk-HRUMWG2F.cjs');require('./chunk-IR5WN6FQ.cjs');var _chunkOWQZPI3Ucjs = require('./chunk-OWQZPI3U.cjs');require('./chunk-CCIGWTAO.cjs');require('./chunk-CFB27BFV.cjs');require('./chunk-X7E2YEIV.cjs');require('./chunk-2GKPWQBQ.cjs');exports.CrossmintWallets = _chunkJFG54X5Xcjs.b; exports.DeviceSignerKeyStorage = _chunk3VYGTPRFcjs.a; exports.EVMWallet = _chunkWUNTNM5Rcjs.a; exports.IframeDeviceSignerKeyStorage = _chunkA3J3367Ocjs.a; exports.InvalidTransferAmountError = _chunkOWQZPI3Ucjs.u; exports.SolanaWallet = _chunk52I473WCcjs.a; exports.StellarWallet = _chunkSI4L3UZ4cjs.a; exports.Wallet = _chunkBTMBO7VMcjs.a; exports.WalletNotAvailableError = _chunkOWQZPI3Ucjs.e; exports.WalletsApiClient = _chunkF2HEHICCcjs.a; exports.createCrossmint = _chunkJFG54X5Xcjs.a; exports.createDeviceSigner = _chunkYHV3672Rcjs.a; exports.isExportableSignerAdapter = _chunkAS2YN2YCcjs.c;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { CrossmintWallets } from './sdk.cjs';
|
|
2
2
|
export { InvalidTransferAmountError, 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, B as Balances, C as Callbacks, d as ClientSideWalletArgsFor, e as ClientSideWalletCreateArgs, D as DeviceSignerConfig, f as DeviceSignerLocator, E as EVMTransactionInput, g as EmailSignerConfig, h as EmailSignerLocator, i as ExportSignerTEEConnection, j as ExportableSignerAdapter, k as ExternalWalletRegistrationConfig, l as ExternalWalletSignerConfigForChain, m as ExternalWalletSignerLocator, P as PasskeySignerLocator, n as PhoneSignerConfig, o as PhoneSignerLocator, R as RegisterSignerPasskeyParams, p as RemoveSignerOptions, S as
|
|
4
|
+
export { A as AddSignerOptions, a as ApiKeySignerLocator, b as ApproveOptions, c as ApproveParams, B as Balances, C as Callbacks, d as ClientSideWalletArgsFor, e as ClientSideWalletCreateArgs, D as DeviceSignerConfig, f as DeviceSignerLocator, E as EVMTransactionInput, g as EmailSignerConfig, h as EmailSignerLocator, i as ExportSignerTEEConnection, j as ExportableSignerAdapter, k as ExternalWalletRegistrationConfig, l as ExternalWalletSignerConfigForChain, m as ExternalWalletSignerLocator, P as PasskeySignerLocator, n as PhoneSignerConfig, o as PhoneSignerLocator, R as RegisterSignerPasskeyParams, p as RemoveSignerOptions, S as Scope, q as ServerSignerConfig, r as Signature, s as Signer, t as SignerAdapter, u as SignerConfigForChain, v as SignerLocator, w as SignerStatus, x as SolanaTransactionInput, T as Transaction, y as TransferScope, z as Transfers, W as WalletArgsFor, F as WalletCreateArgs, G as WalletOptions, H as WalletPlugin, I as isExportableSignerAdapter } from './types-5kZcVs3E.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, 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, B as Balances, C as Callbacks, d as ClientSideWalletArgsFor, e as ClientSideWalletCreateArgs, D as DeviceSignerConfig, f as DeviceSignerLocator, E as EVMTransactionInput, g as EmailSignerConfig, h as EmailSignerLocator, i as ExportSignerTEEConnection, j as ExportableSignerAdapter, k as ExternalWalletRegistrationConfig, l as ExternalWalletSignerConfigForChain, m as ExternalWalletSignerLocator, P as PasskeySignerLocator, n as PhoneSignerConfig, o as PhoneSignerLocator, R as RegisterSignerPasskeyParams, p as RemoveSignerOptions, S as
|
|
4
|
+
export { A as AddSignerOptions, a as ApiKeySignerLocator, b as ApproveOptions, c as ApproveParams, B as Balances, C as Callbacks, d as ClientSideWalletArgsFor, e as ClientSideWalletCreateArgs, D as DeviceSignerConfig, f as DeviceSignerLocator, E as EVMTransactionInput, g as EmailSignerConfig, h as EmailSignerLocator, i as ExportSignerTEEConnection, j as ExportableSignerAdapter, k as ExternalWalletRegistrationConfig, l as ExternalWalletSignerConfigForChain, m as ExternalWalletSignerLocator, P as PasskeySignerLocator, n as PhoneSignerConfig, o as PhoneSignerLocator, R as RegisterSignerPasskeyParams, p as RemoveSignerOptions, S as Scope, q as ServerSignerConfig, r as Signature, s as Signer, t as SignerAdapter, u as SignerConfigForChain, v as SignerLocator, w as SignerStatus, x as SolanaTransactionInput, T as Transaction, y as TransferScope, z as Transfers, W as WalletArgsFor, F as WalletCreateArgs, G as WalletOptions, H as WalletPlugin, I as isExportableSignerAdapter } from './types-CRMCeDuN.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{a as p}from"./chunk-
|
|
1
|
+
import{a as p}from"./chunk-J4XCFNQH.js";import{a as S}from"./chunk-ZH3WV7OE.js";import{a as f}from"./chunk-6HOOT6LH.js";import{a as g,b as s}from"./chunk-4GHTG2VD.js";import"./chunk-XEL7JKRY.js";import"./chunk-JGWGYONV.js";import{a as l}from"./chunk-YSB7XIS7.js";import"./chunk-TOAFCAVT.js";import{a as o}from"./chunk-N4IWDL6M.js";import{a as i}from"./chunk-BAUUDBGT.js";import{a as n}from"./chunk-IOSADDL5.js";import"./chunk-GOXB2RBF.js";import"./chunk-KZMDZJGM.js";import"./chunk-EIRVLXOC.js";import"./chunk-L52GDMSH.js";import"./chunk-6X5JEJD7.js";import"./chunk-QM3BB4E2.js";import"./chunk-F5NTM2RX.js";import"./chunk-OQZTL6ZG.js";import"./chunk-N355UETO.js";import"./chunk-3VRN3GKQ.js";import"./chunk-BITOMWYZ.js";import"./chunk-YDZRBHS3.js";import"./chunk-4GEG5JA6.js";import"./chunk-RWQ6ZQST.js";import"./chunk-PG7BGWKX.js";import"./chunk-QQ46JY33.js";import"./chunk-O6VBO7KG.js";import"./chunk-EM3D5Q3A.js";import"./chunk-EE4ITUGS.js";import{c as a}from"./chunk-6RX65NOA.js";import"./chunk-XNZLCUTY.js";import"./chunk-CKZYSQOK.js";import"./chunk-QVTKTDED.js";import"./chunk-XS5B3TUE.js";import"./chunk-M335XCYO.js";import"./chunk-YH7G2U6V.js";import"./chunk-2O6HQK34.js";import"./chunk-2YLRFJ66.js";import"./chunk-5IFDVB4Y.js";import{a as t}from"./chunk-XCIS2OND.js";import"./chunk-KBJA7JDT.js";import"./chunk-FXCUVWXJ.js";import"./chunk-S3DYQVRD.js";import"./chunk-KUP7H7X2.js";import"./chunk-FT5EVMLB.js";import"./chunk-SVIKBM3S.js";import"./chunk-KKQBZXFE.js";import{e,u as r}from"./chunk-5OYPWGMX.js";import"./chunk-455NK5LB.js";import"./chunk-UBDPBFAR.js";import"./chunk-XX6FO5QS.js";import"./chunk-J3R36SGJ.js";export{s as CrossmintWallets,n as DeviceSignerKeyStorage,p as EVMWallet,i as IframeDeviceSignerKeyStorage,r as InvalidTransferAmountError,S as SolanaWallet,f as StellarWallet,l as Wallet,e as WalletNotAvailableError,t as WalletsApiClient,g as createCrossmint,o as createDeviceSigner,a 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 _chunkCFB27BFVcjs = require('../chunk-CFB27BFV.cjs');require('../chunk-X7E2YEIV.cjs');require('../chunk-2GKPWQBQ.cjs');exports.initWalletsLogger = _chunkCFB27BFVcjs.b; exports.walletsLogger = _chunkCFB27BFVcjs.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-UBDPBFAR.js";import"../chunk-XX6FO5QS.js";import"../chunk-J3R36SGJ.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 _chunkCFB27BFVcjs = require('../chunk-CFB27BFV.cjs');require('../chunk-X7E2YEIV.cjs');require('../chunk-2GKPWQBQ.cjs');exports.initWalletsLogger = _chunkCFB27BFVcjs.b; exports.walletsLogger = _chunkCFB27BFVcjs.a;
|
package/dist/logger/init.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b}from"../chunk-
|
|
1
|
+
import{a,b}from"../chunk-UBDPBFAR.js";import"../chunk-XX6FO5QS.js";import"../chunk-J3R36SGJ.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 _chunkJFG54X5Xcjs = require('./chunk-JFG54X5X.cjs');require('./chunk-KW2623VI.cjs');require('./chunk-6EUBBDIV.cjs');require('./chunk-BTMBO7VM.cjs');require('./chunk-CUHDOBKN.cjs');require('./chunk-YHV3672R.cjs');require('./chunk-A3J3367O.cjs');require('./chunk-3VYGTPRF.cjs');require('./chunk-NX256LAH.cjs');require('./chunk-KXKBZNET.cjs');require('./chunk-AET7QPSV.cjs');require('./chunk-5IC7UWND.cjs');require('./chunk-GZP2JQ6P.cjs');require('./chunk-IGRPHTXZ.cjs');require('./chunk-I3RWATD5.cjs');require('./chunk-ENU3EKBG.cjs');require('./chunk-3SVXPFSP.cjs');require('./chunk-4DJWSV7I.cjs');require('./chunk-YF5G4U6L.cjs');require('./chunk-PO6S7UR3.cjs');require('./chunk-RLBY6JO3.cjs');require('./chunk-4LXI2OQW.cjs');require('./chunk-BI3AUJVK.cjs');require('./chunk-YYFLQQPV.cjs');require('./chunk-JBP52JOH.cjs');require('./chunk-5FH7WFWL.cjs');require('./chunk-SPTXAOFR.cjs');require('./chunk-AS2YN2YC.cjs');require('./chunk-YGL4ITFK.cjs');require('./chunk-GEY3BU62.cjs');require('./chunk-PHPBBEXU.cjs');require('./chunk-A33BEWR7.cjs');require('./chunk-OGP7B5O3.cjs');require('./chunk-IJ632UXD.cjs');require('./chunk-E4EOD7MP.cjs');require('./chunk-SCEPJO4Q.cjs');require('./chunk-6HXIZLEQ.cjs');require('./chunk-F2HEHICC.cjs');require('./chunk-ECAM5KTH.cjs');require('./chunk-AAUS7KTR.cjs');require('./chunk-GEY574TH.cjs');require('./chunk-UE3WVHTM.cjs');require('./chunk-5X4EOJFG.cjs');require('./chunk-HRUMWG2F.cjs');require('./chunk-IR5WN6FQ.cjs');require('./chunk-OWQZPI3U.cjs');require('./chunk-CCIGWTAO.cjs');require('./chunk-CFB27BFV.cjs');require('./chunk-X7E2YEIV.cjs');require('./chunk-2GKPWQBQ.cjs');exports.CrossmintWallets = _chunkJFG54X5Xcjs.b; exports.createCrossmint = _chunkJFG54X5Xcjs.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,
|
|
3
|
+
import { W as WalletArgsFor, F as WalletCreateArgs, D as DeviceSignerConfig, R as RegisterSignerPasskeyParams } from './types-5kZcVs3E.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,
|
|
3
|
+
import { W as WalletArgsFor, F as WalletCreateArgs, D as DeviceSignerConfig, R as RegisterSignerPasskeyParams } from './types-CRMCeDuN.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-4GHTG2VD.js";import"./chunk-XEL7JKRY.js";import"./chunk-JGWGYONV.js";import"./chunk-YSB7XIS7.js";import"./chunk-TOAFCAVT.js";import"./chunk-N4IWDL6M.js";import"./chunk-BAUUDBGT.js";import"./chunk-IOSADDL5.js";import"./chunk-GOXB2RBF.js";import"./chunk-KZMDZJGM.js";import"./chunk-EIRVLXOC.js";import"./chunk-L52GDMSH.js";import"./chunk-6X5JEJD7.js";import"./chunk-QM3BB4E2.js";import"./chunk-F5NTM2RX.js";import"./chunk-OQZTL6ZG.js";import"./chunk-N355UETO.js";import"./chunk-3VRN3GKQ.js";import"./chunk-BITOMWYZ.js";import"./chunk-YDZRBHS3.js";import"./chunk-4GEG5JA6.js";import"./chunk-RWQ6ZQST.js";import"./chunk-PG7BGWKX.js";import"./chunk-QQ46JY33.js";import"./chunk-O6VBO7KG.js";import"./chunk-EM3D5Q3A.js";import"./chunk-EE4ITUGS.js";import"./chunk-6RX65NOA.js";import"./chunk-XNZLCUTY.js";import"./chunk-CKZYSQOK.js";import"./chunk-QVTKTDED.js";import"./chunk-XS5B3TUE.js";import"./chunk-M335XCYO.js";import"./chunk-YH7G2U6V.js";import"./chunk-2O6HQK34.js";import"./chunk-2YLRFJ66.js";import"./chunk-5IFDVB4Y.js";import"./chunk-XCIS2OND.js";import"./chunk-KBJA7JDT.js";import"./chunk-FXCUVWXJ.js";import"./chunk-S3DYQVRD.js";import"./chunk-KUP7H7X2.js";import"./chunk-FT5EVMLB.js";import"./chunk-SVIKBM3S.js";import"./chunk-KKQBZXFE.js";import"./chunk-5OYPWGMX.js";import"./chunk-455NK5LB.js";import"./chunk-UBDPBFAR.js";import"./chunk-XX6FO5QS.js";import"./chunk-J3R36SGJ.js";export{b as CrossmintWallets,a as createCrossmint};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as SignerAdapter, J as DeviceInternalSignerConfig, f as DeviceSignerLocator, K as DeviceSignResult } from '../types-5kZcVs3E.cjs';
|
|
2
2
|
import { DeviceSignerKeyStorage } from '../utils/device-signers/DeviceSignerKeyStorage.cjs';
|
|
3
3
|
import 'viem';
|
|
4
4
|
import '../api/gen/types.gen.cjs';
|
package/dist/signers/device.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as SignerAdapter, J as DeviceInternalSignerConfig, f as DeviceSignerLocator, K as DeviceSignResult } from '../types-CRMCeDuN.js';
|
|
2
2
|
import { DeviceSignerKeyStorage } from '../utils/device-signers/DeviceSignerKeyStorage.js';
|
|
3
3
|
import 'viem';
|
|
4
4
|
import '../api/gen/types.gen.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as SignerAdapter, L as ApiKeyInternalSignerConfig, a as ApiKeySignerLocator } from '../types-5kZcVs3E.cjs';
|
|
2
2
|
import 'viem';
|
|
3
3
|
import '../api/gen/types.gen.cjs';
|
|
4
4
|
import 'ox';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as SignerAdapter, L as ApiKeyInternalSignerConfig, a as ApiKeySignerLocator } from '../types-CRMCeDuN.js';
|
|
2
2
|
import 'viem';
|
|
3
3
|
import '../api/gen/types.gen.js';
|
|
4
4
|
import 'ox';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { M as ExternalWalletInternalSignerConfig } from '../types-5kZcVs3E.cjs';
|
|
2
2
|
import { EVMChain } from '../chains/chains.cjs';
|
|
3
3
|
import { ExternalWalletSigner } from './external-wallet-signer.cjs';
|
|
4
4
|
import 'viem';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { M as ExternalWalletInternalSignerConfig } from '../types-CRMCeDuN.js';
|
|
2
2
|
import { EVMChain } from '../chains/chains.js';
|
|
3
3
|
import { ExternalWalletSigner } from './external-wallet-signer.js';
|
|
4
4
|
import 'viem';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Chain } from '../chains/chains.cjs';
|
|
2
|
-
import {
|
|
2
|
+
import { t as SignerAdapter, M as ExternalWalletInternalSignerConfig, m as ExternalWalletSignerLocator } from '../types-5kZcVs3E.cjs';
|
|
3
3
|
import '@crossmint/common-sdk-base';
|
|
4
4
|
import 'viem';
|
|
5
5
|
import '../api/gen/types.gen.cjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Chain } from '../chains/chains.js';
|
|
2
|
-
import {
|
|
2
|
+
import { t as SignerAdapter, M as ExternalWalletInternalSignerConfig, m as ExternalWalletSignerLocator } from '../types-CRMCeDuN.js';
|
|
3
3
|
import '@crossmint/common-sdk-base';
|
|
4
4
|
import 'viem';
|
|
5
5
|
import '../api/gen/types.gen.js';
|
package/dist/signers/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkAET7QPSVcjs = require('../chunk-AET7QPSV.cjs');require('../chunk-5IC7UWND.cjs');require('../chunk-GZP2JQ6P.cjs');require('../chunk-IGRPHTXZ.cjs');require('../chunk-I3RWATD5.cjs');require('../chunk-ENU3EKBG.cjs');require('../chunk-3SVXPFSP.cjs');require('../chunk-4DJWSV7I.cjs');require('../chunk-YF5G4U6L.cjs');require('../chunk-PO6S7UR3.cjs');require('../chunk-RLBY6JO3.cjs');require('../chunk-4LXI2OQW.cjs');require('../chunk-BI3AUJVK.cjs');require('../chunk-YYFLQQPV.cjs');require('../chunk-JBP52JOH.cjs');require('../chunk-5FH7WFWL.cjs');require('../chunk-SPTXAOFR.cjs');require('../chunk-AS2YN2YC.cjs');require('../chunk-YGL4ITFK.cjs');require('../chunk-GEY3BU62.cjs');require('../chunk-PHPBBEXU.cjs');require('../chunk-A33BEWR7.cjs');require('../chunk-OGP7B5O3.cjs');require('../chunk-IJ632UXD.cjs');require('../chunk-E4EOD7MP.cjs');require('../chunk-SCEPJO4Q.cjs');require('../chunk-OWQZPI3U.cjs');require('../chunk-CCIGWTAO.cjs');require('../chunk-CFB27BFV.cjs');require('../chunk-X7E2YEIV.cjs');require('../chunk-2GKPWQBQ.cjs');exports.assembleSigner = _chunkAET7QPSVcjs.a;
|
package/dist/signers/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Chain } from '../chains/chains.cjs';
|
|
2
|
-
import {
|
|
2
|
+
import { N as InternalSignerConfig, t as SignerAdapter } from '../types-5kZcVs3E.cjs';
|
|
3
3
|
import { DeviceSignerKeyStorage } from '../utils/device-signers/DeviceSignerKeyStorage.cjs';
|
|
4
4
|
import '@crossmint/common-sdk-base';
|
|
5
5
|
import 'viem';
|
package/dist/signers/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Chain } from '../chains/chains.js';
|
|
2
|
-
import {
|
|
2
|
+
import { N as InternalSignerConfig, t as SignerAdapter } from '../types-CRMCeDuN.js';
|
|
3
3
|
import { DeviceSignerKeyStorage } from '../utils/device-signers/DeviceSignerKeyStorage.js';
|
|
4
4
|
import '@crossmint/common-sdk-base';
|
|
5
5
|
import 'viem';
|
package/dist/signers/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-EIRVLXOC.js";import"../chunk-L52GDMSH.js";import"../chunk-6X5JEJD7.js";import"../chunk-QM3BB4E2.js";import"../chunk-F5NTM2RX.js";import"../chunk-OQZTL6ZG.js";import"../chunk-N355UETO.js";import"../chunk-3VRN3GKQ.js";import"../chunk-BITOMWYZ.js";import"../chunk-YDZRBHS3.js";import"../chunk-4GEG5JA6.js";import"../chunk-RWQ6ZQST.js";import"../chunk-PG7BGWKX.js";import"../chunk-QQ46JY33.js";import"../chunk-O6VBO7KG.js";import"../chunk-EM3D5Q3A.js";import"../chunk-EE4ITUGS.js";import"../chunk-6RX65NOA.js";import"../chunk-XNZLCUTY.js";import"../chunk-CKZYSQOK.js";import"../chunk-QVTKTDED.js";import"../chunk-XS5B3TUE.js";import"../chunk-M335XCYO.js";import"../chunk-YH7G2U6V.js";import"../chunk-2O6HQK34.js";import"../chunk-2YLRFJ66.js";import"../chunk-5OYPWGMX.js";import"../chunk-455NK5LB.js";import"../chunk-UBDPBFAR.js";import"../chunk-XX6FO5QS.js";import"../chunk-J3R36SGJ.js";export{a as assembleSigner};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../../chunk-PO6S7UR3.cjs');var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../../chunk-PO6S7UR3.cjs');var _chunkRLBY6JO3cjs = require('../../chunk-RLBY6JO3.cjs');var _chunk4LXI2OQWcjs = require('../../chunk-4LXI2OQW.cjs');var _chunkBI3AUJVKcjs = require('../../chunk-BI3AUJVK.cjs');var _chunkYYFLQQPVcjs = require('../../chunk-YYFLQQPV.cjs');require('../../chunk-JBP52JOH.cjs');require('../../chunk-AS2YN2YC.cjs');require('../../chunk-CCIGWTAO.cjs');require('../../chunk-CFB27BFV.cjs');require('../../chunk-X7E2YEIV.cjs');require('../../chunk-2GKPWQBQ.cjs');exports.DEFAULT_EVENT_OPTIONS = _chunkYYFLQQPVcjs.b; exports.EVMNonCustodialSigner = _chunk4LXI2OQWcjs.a; exports.NonCustodialSigner = _chunkYYFLQQPVcjs.a; exports.SolanaNonCustodialSigner = _chunkBI3AUJVKcjs.a; exports.StellarNonCustodialSigner = _chunkRLBY6JO3cjs.a;
|
|
@@ -2,7 +2,7 @@ export { DEFAULT_EVENT_OPTIONS, NonCustodialSigner } from './ncs-signer.cjs';
|
|
|
2
2
|
export { SolanaNonCustodialSigner } from './ncs-solana-signer.cjs';
|
|
3
3
|
export { EVMNonCustodialSigner } from './ncs-evm-signer.cjs';
|
|
4
4
|
export { StellarNonCustodialSigner } from './ncs-stellar-signer.cjs';
|
|
5
|
-
import '../../types-
|
|
5
|
+
import '../../types-5kZcVs3E.cjs';
|
|
6
6
|
import 'viem';
|
|
7
7
|
import '../../api/gen/types.gen.cjs';
|
|
8
8
|
import 'ox';
|
|
@@ -2,7 +2,7 @@ export { DEFAULT_EVENT_OPTIONS, NonCustodialSigner } from './ncs-signer.js';
|
|
|
2
2
|
export { SolanaNonCustodialSigner } from './ncs-solana-signer.js';
|
|
3
3
|
export { EVMNonCustodialSigner } from './ncs-evm-signer.js';
|
|
4
4
|
export { StellarNonCustodialSigner } from './ncs-stellar-signer.js';
|
|
5
|
-
import '../../types-
|
|
5
|
+
import '../../types-CRMCeDuN.js';
|
|
6
6
|
import 'viem';
|
|
7
7
|
import '../../api/gen/types.gen.js';
|
|
8
8
|
import 'ox';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../chunk-YDZRBHS3.js";import{a as e}from"../../chunk-
|
|
1
|
+
import"../../chunk-YDZRBHS3.js";import{a as e}from"../../chunk-4GEG5JA6.js";import{a as d}from"../../chunk-RWQ6ZQST.js";import{a as c}from"../../chunk-PG7BGWKX.js";import{a,b}from"../../chunk-QQ46JY33.js";import"../../chunk-O6VBO7KG.js";import"../../chunk-6RX65NOA.js";import"../../chunk-455NK5LB.js";import"../../chunk-UBDPBFAR.js";import"../../chunk-XX6FO5QS.js";import"../../chunk-J3R36SGJ.js";export{b as DEFAULT_EVENT_OPTIONS,d as EVMNonCustodialSigner,a as NonCustodialSigner,c as SolanaNonCustodialSigner,e as StellarNonCustodialSigner};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk4LXI2OQWcjs = require('../../chunk-4LXI2OQW.cjs');require('../../chunk-YYFLQQPV.cjs');require('../../chunk-JBP52JOH.cjs');require('../../chunk-AS2YN2YC.cjs');require('../../chunk-CCIGWTAO.cjs');require('../../chunk-CFB27BFV.cjs');require('../../chunk-X7E2YEIV.cjs');require('../../chunk-2GKPWQBQ.cjs');exports.EVMNonCustodialSigner = _chunk4LXI2OQWcjs.a;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ag as EmailInternalSignerConfig, ah as PhoneInternalSignerConfig } from '../../types-5kZcVs3E.cjs';
|
|
2
2
|
import { NonCustodialSigner } from './ncs-signer.cjs';
|
|
3
3
|
import 'viem';
|
|
4
4
|
import '../../api/gen/types.gen.cjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ag as EmailInternalSignerConfig, ah as PhoneInternalSignerConfig } from '../../types-CRMCeDuN.js';
|
|
2
2
|
import { NonCustodialSigner } from './ncs-signer.js';
|
|
3
3
|
import 'viem';
|
|
4
4
|
import '../../api/gen/types.gen.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-RWQ6ZQST.js";import"../../chunk-QQ46JY33.js";import"../../chunk-O6VBO7KG.js";import"../../chunk-6RX65NOA.js";import"../../chunk-455NK5LB.js";import"../../chunk-UBDPBFAR.js";import"../../chunk-XX6FO5QS.js";import"../../chunk-J3R36SGJ.js";export{a as EVMNonCustodialSigner};
|