@crossmint/wallets-sdk 0.10.5 → 0.10.6
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/client.cjs +1 -1
- package/dist/api/client.js +1 -1
- package/dist/api/gen/index.cjs +1 -1
- package/dist/api/gen/index.js +1 -1
- package/dist/api/index.cjs +1 -1
- package/dist/api/index.js +1 -1
- package/dist/{chunk-3JTT2XLZ.js → chunk-2MOAPV7H.js} +1 -1
- package/dist/chunk-4UVO2GRG.cjs +1 -0
- package/dist/{chunk-SJBPKV23.cjs → chunk-64XBD4HK.cjs} +1 -1
- package/dist/chunk-7LUIRC4H.cjs +1 -0
- package/dist/{chunk-RKX5UHAR.cjs → chunk-ANTDXLCI.cjs} +1 -1
- package/dist/{chunk-GVYMN7XQ.cjs → chunk-BIDVRITM.cjs} +1 -1
- package/dist/chunk-BNLX7HKW.cjs +1 -0
- package/dist/{chunk-O6MMAZY7.cjs → chunk-BTNONXSS.cjs} +1 -1
- package/dist/{chunk-6P7BENHS.js → chunk-FLPUIGTL.js} +1 -1
- package/dist/chunk-GAURTX2I.js +1 -0
- package/dist/{chunk-6HE5RGSO.js → chunk-GLHBNZCD.js} +1 -1
- package/dist/{chunk-IBX6JQWW.js → chunk-H3EPTRZ2.js} +1 -1
- package/dist/chunk-JITEEQUZ.js +1 -0
- package/dist/chunk-KOQPWJBO.js +1 -0
- package/dist/chunk-LRV4CFS5.js +1 -0
- package/dist/chunk-NEP3LDXF.js +1 -0
- package/dist/chunk-NHIZ4TEB.cjs +1 -0
- package/dist/chunk-Q5BKSVUU.cjs +1 -0
- package/dist/{chunk-7LREAZTG.js → chunk-QYR7IUMS.js} +1 -1
- package/dist/chunk-SR4HCLCT.js +1 -0
- package/dist/chunk-UUR6LK3H.cjs +1 -0
- package/dist/{chunk-M6T4HH77.cjs → chunk-VNSDVH74.cjs} +1 -1
- package/dist/{chunk-W4MKUPUF.cjs → chunk-WM3HHCBW.cjs} +1 -1
- package/dist/chunk-XD35GYJQ.js +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/sdk.cjs +1 -1
- package/dist/sdk.js +1 -1
- package/dist/signers/email/email-signer-api-client.cjs +1 -1
- package/dist/signers/email/email-signer-api-client.d.cts +2 -1
- package/dist/signers/email/email-signer-api-client.d.ts +2 -1
- package/dist/signers/email/email-signer-api-client.js +1 -1
- package/dist/signers/email/email-signer.cjs +1 -0
- package/dist/signers/email/email-signer.d.cts +32 -0
- package/dist/signers/email/email-signer.d.ts +32 -0
- package/dist/signers/email/email-signer.js +1 -0
- package/dist/signers/email/evm-email-signer.cjs +1 -0
- package/dist/signers/email/evm-email-signer.d.cts +26 -0
- package/dist/signers/email/evm-email-signer.d.ts +26 -0
- package/dist/signers/email/evm-email-signer.js +1 -0
- package/dist/signers/email/index.cjs +1 -1
- package/dist/signers/email/index.d.cts +3 -1
- package/dist/signers/email/index.d.ts +3 -1
- package/dist/signers/email/index.js +1 -1
- package/dist/signers/email/solana-email-signer.cjs +1 -0
- package/dist/signers/email/{email.d.cts → solana-email-signer.d.cts} +9 -12
- package/dist/signers/email/{email.d.ts → solana-email-signer.d.ts} +9 -12
- package/dist/signers/email/solana-email-signer.js +1 -0
- package/dist/signers/index.cjs +1 -1
- package/dist/signers/index.js +1 -1
- package/dist/utils/constants.cjs +1 -1
- package/dist/utils/constants.js +1 -1
- package/dist/wallets/evm.cjs +1 -1
- package/dist/wallets/evm.js +1 -1
- package/dist/wallets/solana.cjs +1 -1
- package/dist/wallets/solana.js +1 -1
- package/dist/wallets/wallet-factory.cjs +1 -1
- package/dist/wallets/wallet-factory.js +1 -1
- package/dist/wallets/wallet.cjs +1 -1
- package/dist/wallets/wallet.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-5PQGSQCD.js +0 -1
- package/dist/chunk-64EPPE7R.cjs +0 -1
- package/dist/chunk-FPSS2IYY.js +0 -1
- package/dist/chunk-HDAM24ZL.js +0 -1
- package/dist/chunk-NOOBYBKD.js +0 -1
- package/dist/chunk-ROO2DTKQ.cjs +0 -1
- package/dist/chunk-TVZORU22.cjs +0 -1
- package/dist/chunk-UO6UBZQ7.cjs +0 -1
- package/dist/chunk-YKPKNCFG.js +0 -1
- package/dist/signers/email/email.cjs +0 -1
- package/dist/signers/email/email.js +0 -1
- /package/dist/{chunk-3W44OI5M.js → chunk-TN6YXWPL.js} +0 -0
- /package/dist/{chunk-W5TFNIA7.cjs → chunk-VMEGMTOD.cjs} +0 -0
package/dist/api/client.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBIDVRITMcjs = require('../chunk-BIDVRITM.cjs');require('../chunk-WM3HHCBW.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-XALFCQKD.cjs');exports.ApiClient = _chunkBIDVRITMcjs.a;
|
package/dist/api/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-H3EPTRZ2.js";import"../chunk-GAURTX2I.js";import"../chunk-7ENJXL4H.js";import"../chunk-BW7YYVZE.js";export{a as ApiClient};
|
package/dist/api/gen/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../../chunk-
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkHTEW2JRCcjs = require('../../chunk-HTEW2JRC.cjs');require('../../chunk-XPMCPXI3.cjs');require('../../chunk-STYSP6KL.cjs');require('../../chunk-XALFCQKD.cjs');exports.balanceControllerFundWallet2 = _chunkHTEW2JRCcjs.y; exports.balanceControllerGetBalanceForLocator2 = _chunkHTEW2JRCcjs.x; exports.balanceUnstableControllerGetBalanceForLocator2 = _chunkHTEW2JRCcjs.E; exports.fetchContentFromWallet = _chunkHTEW2JRCcjs.w; exports.walletsSendTokenControllerSendMeToken2 = _chunkHTEW2JRCcjs.C; exports.walletsSendTokenControllerSendToken2 = _chunkHTEW2JRCcjs.D; exports.walletsV1ControllerCreateDelegatedSigner4 = _chunkHTEW2JRCcjs.W; exports.walletsV1ControllerCreateDelegatedSigner5 = _chunkHTEW2JRCcjs.r; exports.walletsV1ControllerCreateMeDelegatedSigner4 = _chunkHTEW2JRCcjs.K; exports.walletsV1ControllerCreateMeDelegatedSigner5 = _chunkHTEW2JRCcjs.f; exports.walletsV1ControllerCreateMeSignatureRequest4 = _chunkHTEW2JRCcjs.N; exports.walletsV1ControllerCreateMeSignatureRequest5 = _chunkHTEW2JRCcjs.i; exports.walletsV1ControllerCreateMeTransaction4 = _chunkHTEW2JRCcjs.I; exports.walletsV1ControllerCreateMeTransaction5 = _chunkHTEW2JRCcjs.d; exports.walletsV1ControllerCreateMeWallet4 = _chunkHTEW2JRCcjs.Q; exports.walletsV1ControllerCreateMeWallet5 = _chunkHTEW2JRCcjs.l; exports.walletsV1ControllerCreateSignatureRequest4 = _chunkHTEW2JRCcjs._; exports.walletsV1ControllerCreateSignatureRequest5 = _chunkHTEW2JRCcjs.v; exports.walletsV1ControllerCreateTransaction4 = _chunkHTEW2JRCcjs.U; exports.walletsV1ControllerCreateTransaction5 = _chunkHTEW2JRCcjs.p; exports.walletsV1ControllerCreateWallet4 = _chunkHTEW2JRCcjs.ba; exports.walletsV1ControllerCreateWallet5 = _chunkHTEW2JRCcjs.B; exports.walletsV1ControllerGetAllSignatures4 = _chunkHTEW2JRCcjs.Z; exports.walletsV1ControllerGetAllSignatures5 = _chunkHTEW2JRCcjs.u; exports.walletsV1ControllerGetDelegatedSigner4 = _chunkHTEW2JRCcjs.V; exports.walletsV1ControllerGetDelegatedSigner5 = _chunkHTEW2JRCcjs.q; exports.walletsV1ControllerGetMeDelegatedSigner4 = _chunkHTEW2JRCcjs.J; exports.walletsV1ControllerGetMeDelegatedSigner5 = _chunkHTEW2JRCcjs.e; exports.walletsV1ControllerGetMeSignature4 = _chunkHTEW2JRCcjs.M; exports.walletsV1ControllerGetMeSignature5 = _chunkHTEW2JRCcjs.h; exports.walletsV1ControllerGetMeTransaction4 = _chunkHTEW2JRCcjs.G; exports.walletsV1ControllerGetMeTransaction5 = _chunkHTEW2JRCcjs.b; exports.walletsV1ControllerGetMeTransactionsWithoutChain4 = _chunkHTEW2JRCcjs.H; exports.walletsV1ControllerGetMeTransactionsWithoutChain5 = _chunkHTEW2JRCcjs.c; exports.walletsV1ControllerGetMeWallet4 = _chunkHTEW2JRCcjs.P; exports.walletsV1ControllerGetMeWallet5 = _chunkHTEW2JRCcjs.k; exports.walletsV1ControllerGetMeWalletActivity4 = _chunkHTEW2JRCcjs.O; exports.walletsV1ControllerGetMeWalletActivity5 = _chunkHTEW2JRCcjs.j; exports.walletsV1ControllerGetSignature4 = _chunkHTEW2JRCcjs.Y; exports.walletsV1ControllerGetSignature5 = _chunkHTEW2JRCcjs.t; exports.walletsV1ControllerGetTransaction4 = _chunkHTEW2JRCcjs.S; exports.walletsV1ControllerGetTransaction5 = _chunkHTEW2JRCcjs.n; exports.walletsV1ControllerGetTransactionsWithoutChain4 = _chunkHTEW2JRCcjs.T; exports.walletsV1ControllerGetTransactionsWithoutChain5 = _chunkHTEW2JRCcjs.o; exports.walletsV1ControllerGetWalletActivity4 = _chunkHTEW2JRCcjs.$; exports.walletsV1ControllerGetWalletActivity5 = _chunkHTEW2JRCcjs.z; exports.walletsV1ControllerGetWalletByLocator4 = _chunkHTEW2JRCcjs.aa; exports.walletsV1ControllerGetWalletByLocator5 = _chunkHTEW2JRCcjs.A; exports.walletsV1ControllerSubmitApprovals4 = _chunkHTEW2JRCcjs.R; exports.walletsV1ControllerSubmitApprovals5 = _chunkHTEW2JRCcjs.m; exports.walletsV1ControllerSubmitMeApprovals4 = _chunkHTEW2JRCcjs.F; exports.walletsV1ControllerSubmitMeApprovals5 = _chunkHTEW2JRCcjs.a; exports.walletsV1ControllerSubmitMeSignatureApprovals4 = _chunkHTEW2JRCcjs.L; exports.walletsV1ControllerSubmitMeSignatureApprovals5 = _chunkHTEW2JRCcjs.g; exports.walletsV1ControllerSubmitSignatureApprovals4 = _chunkHTEW2JRCcjs.X; exports.walletsV1ControllerSubmitSignatureApprovals5 = _chunkHTEW2JRCcjs.s;
|
package/dist/api/gen/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{$,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,_,a as o,aa as oo,b as r,ba as ro,c as e,d as f,e as m,f as p,g as t,h as x,i as a,j as b,k as c,l as d,m as g,n as h,o as i,p as j,q as k,r as l,s as n,t as q,u as s,v as u,w as v,x as w,y,z}from"../../chunk-Q3WOEBKN.js";import"../../chunk-YMRXMNME.js";import"../../chunk-5M7IRODB.js";import"../../chunk-BW7YYVZE.js";export{y as balanceControllerFundWallet2,w as balanceControllerGetBalanceForLocator2,E as balanceUnstableControllerGetBalanceForLocator2,v as fetchContentFromWallet,C as walletsSendTokenControllerSendMeToken2,D as walletsSendTokenControllerSendToken2,W as walletsV1ControllerCreateDelegatedSigner4,l as walletsV1ControllerCreateDelegatedSigner5,K as walletsV1ControllerCreateMeDelegatedSigner4,p as walletsV1ControllerCreateMeDelegatedSigner5,N as walletsV1ControllerCreateMeSignatureRequest4,a as walletsV1ControllerCreateMeSignatureRequest5,I as walletsV1ControllerCreateMeTransaction4,f as walletsV1ControllerCreateMeTransaction5,Q as walletsV1ControllerCreateMeWallet4,d as walletsV1ControllerCreateMeWallet5,_ as walletsV1ControllerCreateSignatureRequest4,u as walletsV1ControllerCreateSignatureRequest5,U as walletsV1ControllerCreateTransaction4,j as walletsV1ControllerCreateTransaction5,ro as walletsV1ControllerCreateWallet4,B as walletsV1ControllerCreateWallet5,Z as walletsV1ControllerGetAllSignatures4,s as walletsV1ControllerGetAllSignatures5,V as walletsV1ControllerGetDelegatedSigner4,k as walletsV1ControllerGetDelegatedSigner5,J as walletsV1ControllerGetMeDelegatedSigner4,m as walletsV1ControllerGetMeDelegatedSigner5,M as walletsV1ControllerGetMeSignature4,x as walletsV1ControllerGetMeSignature5,G as walletsV1ControllerGetMeTransaction4,r as walletsV1ControllerGetMeTransaction5,H as walletsV1ControllerGetMeTransactionsWithoutChain4,e as walletsV1ControllerGetMeTransactionsWithoutChain5,P as walletsV1ControllerGetMeWallet4,c as walletsV1ControllerGetMeWallet5,O as walletsV1ControllerGetMeWalletActivity4,b as walletsV1ControllerGetMeWalletActivity5,Y as walletsV1ControllerGetSignature4,q as walletsV1ControllerGetSignature5,S as walletsV1ControllerGetTransaction4,h as walletsV1ControllerGetTransaction5,T as walletsV1ControllerGetTransactionsWithoutChain4,i as walletsV1ControllerGetTransactionsWithoutChain5,$ as walletsV1ControllerGetWalletActivity4,z as walletsV1ControllerGetWalletActivity5,oo as walletsV1ControllerGetWalletByLocator4,A as walletsV1ControllerGetWalletByLocator5,R as walletsV1ControllerSubmitApprovals4,g as walletsV1ControllerSubmitApprovals5,F as walletsV1ControllerSubmitMeApprovals4,o as walletsV1ControllerSubmitMeApprovals5,L as walletsV1ControllerSubmitMeSignatureApprovals4,t as walletsV1ControllerSubmitMeSignatureApprovals5,X as walletsV1ControllerSubmitSignatureApprovals4,n as walletsV1ControllerSubmitSignatureApprovals5};
|
package/dist/api/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-6HXIZLEQ.cjs');var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-6HXIZLEQ.cjs');var _chunkBIDVRITMcjs = require('../chunk-BIDVRITM.cjs');require('../chunk-WM3HHCBW.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-ECAM5KTH.cjs');require('../chunk-XALFCQKD.cjs');exports.ApiClient = _chunkBIDVRITMcjs.a;
|
package/dist/api/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../chunk-5IFDVB4Y.js";import{a}from"../chunk-
|
|
1
|
+
import"../chunk-5IFDVB4Y.js";import{a}from"../chunk-H3EPTRZ2.js";import"../chunk-GAURTX2I.js";import"../chunk-7ENJXL4H.js";import"../chunk-KBJA7JDT.js";import"../chunk-BW7YYVZE.js";export{a as ApiClient};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as C}from"./chunk-
|
|
1
|
+
import{d as C}from"./chunk-GAURTX2I.js";import{c as E,d as $,i as A,m as N,p as L,q as O,r as x,s as W,t as B,u as P,v as F,w as k}from"./chunk-7ENJXL4H.js";import{a as S,b,c,d as v,e as T,f as u}from"./chunk-BW7YYVZE.js";import{getEnvironmentForKey as J,isValidAddress as G}from"@crossmint/common-sdk-base";var m,l,_=class{constructor({chain:t,address:e,owner:r,signer:a,options:i},n){v(this,m);v(this,l);T(this,l,n),this.chain=t,this.address=e,this.owner=r,this.signer=a,T(this,m,i)}static getApiClient(t){return t.apiClient}static getOptions(t){return t.options}get apiClient(){return c(this,l)}get options(){return c(this,m)}balances(t,e){return u(this,null,function*(){let r=this.chain==="solana"?"sol":"eth",a=[r,"usdc",...t!=null?t:[]],i=yield c(this,l).getBalance(this.address,{chains:e!=null?e:[this.chain],tokens:a.map(n=>n.toLowerCase())});if("error"in i)throw new Error(`Failed to get balances for wallet: ${JSON.stringify(i.message)}`);return this.transformBalanceResponse(i,r,t)})}transformBalanceResponse(t,e,r){let a=s=>{var w,f,y;let d,h=(w=s.forChain)==null?void 0:w[this.chain];return h&&"contractAddress"in h&&(d=h.contractAddress),{symbol:s.token,name:s.token,amount:(f=s.amount)!=null?f:"0",contractAddress:d,decimals:s.decimals,rawAmount:(y=s.rawAmount)!=null?y:"0"}},i=t.find(s=>s.token===e||s.token.toLowerCase().includes(e)),n=t.find(s=>s.token.toLowerCase().includes("usdc")),g=t.filter(s=>{let d=s.token.toLowerCase();return!d.includes(e)&&!d.includes("usdc")&&(r==null?void 0:r.some(h=>d.includes(h.toLowerCase())))}),p=s=>({symbol:s,name:s,amount:"0",contractAddress:void 0,decimals:0,rawAmount:"0"});return{nativeToken:i!=null?a(i):p(e),usdc:n!=null?a(n):p("usdc"),tokens:g.map(a)}}experimental_nfts(t){return u(this,null,function*(){return yield c(this,l).experimental_getNfts(b(S({},t),{chain:this.chain,address:this.address}))})}experimental_transactions(){return u(this,null,function*(){return yield c(this,l).getTransactions(this.walletLocator)})}experimental_activity(){return u(this,null,function*(){let t=yield this.apiClient.experimental_activity(this.walletLocator,{chain:this.chain});if("error"in t)throw new Error(`Failed to get activity: ${JSON.stringify(t.message)}`);return t})}send(t,e,r){return u(this,null,function*(){let a=M(t),i=U(e,this.chain),n={recipient:a,amount:r},g=yield c(this,l).send(this.walletLocator,i,n);if("message"in g)throw new O(`Failed to send token: ${JSON.stringify(g.message)}`);return yield this.approveAndWait(g.id)})}addDelegatedSigner(e){return u(this,arguments,function*({signer:t}){var a,i;let r=yield c(this,l).registerSigner(this.walletLocator,{signer:t,chain:this.chain==="solana"?void 0:this.chain});if("error"in r)throw new Error(`Failed to register signer: ${JSON.stringify(r.message)}`);if("transaction"in r){let n=r.transaction.id;yield this.approveAndWait(n)}else{let n=(a=r.chains)==null?void 0:a[this.chain];if((n==null?void 0:n.status)==="awaiting-approval"){let g=((i=n.approvals)==null?void 0:i.pending)||[];yield this.approveSignature(g,n.id),yield this.waitForSignature(n.id);return}if((n==null?void 0:n.status)==="pending"){yield this.waitForSignature(n.id);return}}})}delegatedSigners(){return u(this,null,function*(){var e,r,a;let t=yield c(this,l).getWallet(this.walletLocator);if("error"in t)throw new $(JSON.stringify(t));if(t.type!=="solana-smart-wallet"&&t.type!=="evm-smart-wallet")throw new E(`Wallet type ${t.type} not supported`);return(a=(r=(e=t==null?void 0:t.config)==null?void 0:e.delegatedSigners)==null?void 0:r.map(i=>{let n=i.locator.indexOf(":");return{signer:`external-wallet:${n>=0?i.locator.slice(n+1):i.locator}`}}))!=null?a:[]})}get walletLocator(){return c(this,l).isServerSide?this.address:`me:${this.isSolanaWallet?"solana-smart-wallet":"evm-smart-wallet"}`}get isSolanaWallet(){return this.chain==="solana"}approveAndWait(t,e){return u(this,null,function*(){return yield this.approveTransaction(t,e),yield this.sleep(1e3),yield this.waitForTransaction(t)})}approveTransaction(t,e){return u(this,null,function*(){var p,s,d,h;let r=yield c(this,l).getTransaction(this.walletLocator,t);if(r.error)throw new x(JSON.stringify(r));if(yield(d=(s=(p=c(this,m))==null?void 0:p.experimental_callbacks)==null?void 0:s.onTransactionStart)==null?void 0:d.call(s),this.signer.type==="api-key")return r;let a=(h=r.approvals)==null?void 0:h.pending;if(a==null)return r;let i=[...e!=null?e:[],this.signer],n=yield Promise.all(a.map(w=>{let f=i.find(I=>I.locator()===w.signer);if(f==null)throw new A(`Signer ${w.signer} not found in pending approvals`);let y=r.walletType==="solana-smart-wallet"?r.onChain.transaction:w.message;return f.signTransaction(y)})),g=yield c(this,l).approveTransaction(this.walletLocator,r.id,{approvals:n.map(w=>S({signer:this.signer.locator()},w))});if(g.error)throw new k(JSON.stringify(g));return g})}approveSignature(t,e){return u(this,null,function*(){if(this.isSolanaWallet)throw new Error("Approving signatures is only supported for EVM smart wallets");let r=t.find(i=>i.signer===this.signer.locator());if(!r)throw new A(`Signer ${this.signer.locator()} not found in pending approvals`);let a=yield this.signer.signMessage(r.message);return yield c(this,l).approveSignature(this.walletLocator,e,{approvals:[S({signer:this.signer.locator()},a)]}),a})}waitForSignature(t){return u(this,null,function*(){let e=null;do if(yield new Promise(r=>setTimeout(r,C)),e=yield c(this,l).getSignature(this.walletLocator,t),"error"in e)throw new L(JSON.stringify(e));while(e===null||e.status==="pending");if(e.status==="failed")throw new N("Signature signing failed");if(!e.outputSignature)throw new L("Signature not available");return e.outputSignature})}waitForTransaction(n){return u(this,arguments,function*(t,e=6e4,{backoffMultiplier:r=1.1,maxBackoffMs:a=2e3,initialBackoffMs:i=C}={}){let g=Date.now(),p;do{if(Date.now()-g>e)throw new W("Transaction confirmation timeout");if(p=yield c(this,l).getTransaction(this.walletLocator,t),p.error)throw new x(JSON.stringify(p));yield this.sleep(i),i=Math.min(i*r,a)}while(p.status==="pending");if(p.status==="failed")throw new B(`Transaction sending failed: ${JSON.stringify(p.error)}`);if(p.status==="awaiting-approval")throw new P("Transaction is awaiting approval. Please submit required approvals before waiting for completion.");let s=p.onChain.txId;if(s==null)throw new F("Transaction hash not found on transaction response");return{hash:s,explorerLink:R(p,this.apiClient.crossmint.apiKey)}})}sleep(t){return u(this,null,function*(){return new Promise(e=>setTimeout(e,t))})}};m=new WeakMap,l=new WeakMap;function R(o,t){let e;if(o.walletType==="evm-smart-wallet")e=o.onChain.explorerLink;else if(o.walletType==="solana-smart-wallet"){let r=new URLSearchParams;J(t)!=="production"&&r.append("cluster","devnet"),e=`https://explorer.solana.com/tx/${o.onChain.txId}?${r.toString()}`}return(e==null||e==="")&&(e="Explorer link not available"),e}function M(o){if(typeof o=="string")return o;if("email"in o)return`email:${o.email}`;if("x"in o)return`x:${o.x}`;if("twitter"in o)return`twitter:${o.twitter}`;if("phone"in o)return`phoneNumber:${o.phone}`;if("userId"in o)return`userId:${o.userId}`;throw new Error("Invalid recipient locator")}function U(o,t){return G(o)?`${t}:${o}`:`${t}:${o.toLowerCase()}`}export{_ as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkQ5BKSVUUcjs = require('./chunk-Q5BKSVUU.cjs');var _chunkBNLX7HKWcjs = require('./chunk-BNLX7HKW.cjs');var _chunkDYRSQN7Xcjs = require('./chunk-DYRSQN7X.cjs');var _chunkNVJN7LPYcjs = require('./chunk-NVJN7LPY.cjs');var _chunkAFYBD7FIcjs = require('./chunk-AFYBD7FI.cjs');var _chunkYO6BJ2DIcjs = require('./chunk-YO6BJ2DI.cjs');var _chunkDIZVZP5Pcjs = require('./chunk-DIZVZP5P.cjs');function E(r,e){switch(e.type){case"email":return r==="solana"?new (0, _chunkQ5BKSVUUcjs.a)(e):new (0, _chunkBNLX7HKWcjs.a)(e);case"api-key":return r==="solana"?new (0, _chunkNVJN7LPYcjs.a)(e):new (0, _chunkYO6BJ2DIcjs.a)(e);case"external-wallet":return r==="solana"?new (0, _chunkAFYBD7FIcjs.a)(e):new (0, _chunkDIZVZP5Pcjs.a)(e);case"passkey":return new (0, _chunkDYRSQN7Xcjs.a)(e)}}exports.a = E;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkBTNONXSScjs = require('./chunk-BTNONXSS.cjs');var _chunkAFYBD7FIcjs = require('./chunk-AFYBD7FI.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);var _commonsdkbase = require('@crossmint/common-sdk-base');var p=class l extends _chunkBTNONXSScjs.a{constructor(a){super({chain:a.chain,address:a.address,owner:a.owner,signer:a.signer},_chunkBTNONXSScjs.a.getApiClient(a))}static from(a){if(!_commonsdkbase.isValidSolanaAddress.call(void 0, a.address))throw new Error("Wallet is not a Solana wallet");return new l(a)}sendTransaction(b){return _chunkXALFCQKDcjs.f.call(void 0, this,arguments,function*({transaction:a,additionalSigners:r}){let m={transaction:_bs582.default.encode(a.serialize())},n=yield this.apiClient.createTransaction(this.walletLocator,{params:m});if(n.error)throw new (0, _chunkCT2UGJELcjs.q)(JSON.stringify(n));let h=r==null?void 0:r.map(o=>new (0, _chunkAFYBD7FIcjs.a)({type:"external-wallet",address:o.publicKey.toString(),onSignTransaction:e=>(e.sign([o]),Promise.resolve(e))}));return yield this.approveAndWait(n.id,h)})}};exports.a = p;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBTNONXSScjs = require('./chunk-BTNONXSS.cjs');var _chunk4UVO2GRGcjs = require('./chunk-4UVO2GRG.cjs');var _chunkQ5BKSVUUcjs = require('./chunk-Q5BKSVUU.cjs');var _chunkBNLX7HKWcjs = require('./chunk-BNLX7HKW.cjs');var _chunkRD5PG4M6cjs = require('./chunk-RD5PG4M6.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _ox = require('ox');var _commonsdkbase = require('@crossmint/common-sdk-base');var h=class{constructor(e){this.apiClient=e}getOrCreateWallet(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(this.apiClient.isServerSide)throw new (0, _chunkCT2UGJELcjs.f)("getOrCreateWallet is not supported on server side");let t=yield this.apiClient.getWallet(`me:${e.chain==="solana"?"solana-smart-wallet":"evm-smart-wallet"}`);return t&&!("error"in t)?(yield this.validateWalletConfig(t,e),this.createWalletInstance(t,e)):this.createWallet(e)})}getWallet(e,t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(!this.apiClient.isServerSide)throw new (0, _chunkCT2UGJELcjs.f)("getWallet is not supported on client side, use getOrCreateWallet instead");let i=yield this.apiClient.getWallet(e);if("error"in i)throw new (0, _chunkCT2UGJELcjs.d)(JSON.stringify(i));return this.createWalletInstance(i,t)})}createWallet(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var a,n,s,l,p;yield(s=(n=(a=e.options)==null?void 0:a.experimental_callbacks)==null?void 0:n.onWalletCreationStart)==null?void 0:s.call(n);let t;e.chain==="solana"?t={type:"solana-smart-wallet",config:{adminSigner:yield this.configureSigner(e.chain,e.signer)},linkedUser:(l=e.owner)!=null?l:void 0}:t={type:"evm-smart-wallet",config:{adminSigner:yield this.configureSigner(e.chain,e.signer)},linkedUser:(p=e.owner)!=null?p:void 0};let i=yield this.apiClient.createWallet(t);if("error"in i)throw new (0, _chunkCT2UGJELcjs.f)(JSON.stringify(i));return this.createWalletInstance(i,e)})}createWalletInstance(e,t){let i=this.toInternalSignerConfig(e,t.signer);return new (0, _chunkBTNONXSScjs.a)({chain:t.chain,address:e.address,signer:_chunk4UVO2GRGcjs.a.call(void 0, t.chain,i),options:t.options},this.apiClient)}toInternalSignerConfig(e,t){var i,a;if(t==null)throw new (0, _chunkCT2UGJELcjs.f)("Signer is required to create a wallet");switch(t.type){case"api-key":{let n;switch(e.type){case"solana-smart-wallet":n=e.config.adminSigner.address;break;case"evm-smart-wallet":e.config.adminSigner.type==="evm-fireblocks-custodial"&&(n=e.config.adminSigner.address);break}if(n==null)throw new (0, _chunkCT2UGJELcjs.f)("Wallet signer 'api-key' has no address");return{type:"api-key",address:n}}case"external-wallet":return t;case"passkey":if(e.type==="evm-smart-wallet"&&e.config.adminSigner.type==="evm-passkey")return{type:"passkey",id:e.config.adminSigner.id,name:e.config.adminSigner.name,onCreatePasskey:t.onCreatePasskey,onSignWithPasskey:t.onSignWithPasskey};throw new (0, _chunkCT2UGJELcjs.f)("Passkey signer is not supported for this wallet type");case"email":{if(!(e.type==="solana-smart-wallet"&&e.config.adminSigner.type==="solana-keypair"||e.type==="evm-smart-wallet"&&e.config.adminSigner.type==="evm-keypair"))throw new (0, _chunkCT2UGJELcjs.f)("Wallet signer 'email' has no address");let n=e.config.adminSigner.address;return{type:"email",email:(a=t.email)!=null?a:(i=this.apiClient.crossmint.experimental_customAuth)==null?void 0:i.email,signerAddress:n,crossmint:this.apiClient.crossmint,onAuthRequired:t.onAuthRequired,_handshakeParent:t._handshakeParent}}default:throw new Error("Invalid signer type")}}configureSigner(e,t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var i;if((t==null?void 0:t.type)==="passkey"){let a=(i=t.name)!=null?i:`Crossmint Wallet ${Date.now()}`,n=t.onCreatePasskey?yield t.onCreatePasskey(a):yield _ox.WebAuthnP256.createCredential({name:a});return{type:"evm-passkey",id:n.id,name:a,publicKey:{x:n.publicKey.x.toString(),y:n.publicKey.y.toString()}}}return yield this.toExternalSignerConfig(e,t)})}toExternalSignerConfig(e,t,i){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var a,n;if(!t||t.type==="api-key")return{type:e==="solana"?"solana-fireblocks-custodial":"evm-fireblocks-custodial"};if(t.type==="external-wallet")return{type:e==="solana"?"solana-keypair":"evm-keypair",address:t.address};if(t.type==="passkey"&&i!=null){if((i==null?void 0:i.type)!=="evm-smart-wallet"||i.config.adminSigner.type!=="evm-passkey")throw new (0, _chunkCT2UGJELcjs.f)("Passkey signer is not supported for this wallet type");return{type:"evm-passkey",id:i.config.adminSigner.id,name:i.config.adminSigner.name,publicKey:{x:i.config.adminSigner.publicKey.x,y:i.config.adminSigner.publicKey.y}}}if(t.type==="email"){let s=(n=t.email)!=null?n:(a=this.apiClient.crossmint.experimental_customAuth)==null?void 0:a.email;if(s==null)throw new Error("Email is required to create a wallet with email signer");if(e==="solana")return{type:"solana-keypair",address:yield _chunkQ5BKSVUUcjs.a.pregenerateSigner(s,this.apiClient.crossmint)};if(_commonsdkbase.isEVMBlockchain.call(void 0, e))return{type:"evm-keypair",address:yield _chunkBNLX7HKWcjs.a.pregenerateSigner(s,this.apiClient.crossmint)}}throw new Error("Invalid signer type")})}validateWalletConfig(e,t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(t.owner!=null&&e.linkedUser!=null&&t.owner!==e.linkedUser)throw new (0, _chunkCT2UGJELcjs.f)("Wallet owner does not match existing wallet's linked user");if(e.type!=="solana-smart-wallet"&&e.type!=="evm-smart-wallet")return;let i=yield this.toExternalSignerConfig(t.chain,t.signer,e),a=e.config.adminSigner;if(i&&a){if(i.type!==a.type)throw new (0, _chunkCT2UGJELcjs.f)("The wallet signer type provided in the wallet config does not match the existing wallet's adminSigner type");_chunkRD5PG4M6cjs.a.call(void 0, i,a)}})}};exports.a = h;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk7LUIRC4Hcjs = require('./chunk-7LUIRC4H.cjs');var _chunkBIDVRITMcjs = require('./chunk-BIDVRITM.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var i=class o{constructor(t){let r=new (0, _chunkBIDVRITMcjs.a)(t);this.walletFactory=new (0, _chunk7LUIRC4Hcjs.a)(r)}static from(t){return new o(t)}getOrCreateWallet(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.walletFactory.getOrCreateWallet(t)})}getWallet(t,r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.walletFactory.getWallet(t,r)})}createWallet(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.walletFactory.createWallet(t)})}};exports.a = _commonsdkbase.createCrossmint; exports.b = i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkWM3HHCBWcjs = require('./chunk-WM3HHCBW.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var p=class extends _commonsdkbase.CrossmintApiClient{constructor(e){super(e,{internalConfig:{sdkMetadata:{name:_chunkWM3HHCBWcjs.c,version:_chunkWM3HHCBWcjs.b}}});this.apiPrefix="api/2022-06-09/wallets"}createWallet(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let s=this.isServerSide?`${this.apiPrefix}`:`${this.apiPrefix}/me`;return(yield this.post(s,{body:JSON.stringify(e),headers:this.headers})).json()})}getWallet(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}`,{headers:this.headers})).json()})}createTransaction(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveTransaction(e,s,t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions/${s}/approvals`,{body:JSON.stringify(t),headers:this.headers})).json()})}getTransaction(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions/${s}`,{headers:this.headers})).json()})}createSignature(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signatures`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveSignature(e,s,t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signatures/${s}/approvals`,{body:JSON.stringify(t),headers:this.headers})).json()})}getSignature(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/signatures/${s}`,{headers:this.headers})).json()})}getTransactions(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions`,{headers:this.headers})).json()})}experimental_getNfts(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let s=new URLSearchParams;s.append("page",e.page.toString()),s.append("perPage",e.perPage.toString());let t=`${e.chain}:${e.address}`;return(yield this.get(`${this.apiPrefix}/${t}/nfts?${s.toString()}`,{headers:this.headers})).json()})}experimental_activity(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let t=new URLSearchParams;return t.append("chain",s.chain.toString()),(yield this.get(`${this.apiPrefix}/${e}/activity?${t.toString()}`,{headers:this.headers})).json()})}getBalance(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let t=new URLSearchParams;return t.append("tokenLocators",s.tokens.join(",")),t.append("chains",s.chains.join(",")),(yield this.get(`api/unstable/wallets/${e}/balances?${t.toString()}`,{headers:this.headers})).json()})}registerSigner(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signers`,{body:JSON.stringify(s),headers:this.headers})).json()})}getSigner(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/signers/${s}`,{headers:this.headers})).json()})}send(e,s,t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.post(`api/unstable/wallets/${e}/tokens/${s}/transfers`,{body:JSON.stringify(t),headers:this.headers})).json()})}get isServerSide(){return this.parsedAPIKey.usageOrigin===_commonsdkbase.APIKeyUsageOrigin.SERVER}get environment(){if(!this.parsedAPIKey.isValid)throw new (0, _chunkCT2UGJELcjs.a)("Invalid API key");return this.parsedAPIKey.environment}get headers(){return{"Content-Type":"application/json"}}};exports.a = p;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkNHIZ4TEBcjs = require('./chunk-NHIZ4TEB.cjs');var _chunkUUR6LK3Hcjs = require('./chunk-UUR6LK3H.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _ox = require('ox');var p=class u extends _chunkUUR6LK3Hcjs.a{constructor(e){super(e)}locator(){return`evm-keypair:${this.config.signerAddress}`}signMessage(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for email signer"))})}signTransaction(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var n;yield this.handleAuthRequired();let t=this.getJwtOrThrow(),i=e.replace("0x",""),r=yield(n=this.config._handshakeParent)==null?void 0:n.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:t,apiKey:this.config.crossmint.apiKey},data:{keyType:"secp256k1",bytes:i,encoding:"hex"}},options:_chunkUUR6LK3Hcjs.b});if((r==null?void 0:r.status)==="error")throw new Error(r.error);if((r==null?void 0:r.signature)==null)throw new Error("Failed to sign transaction");return u.verifyPublicKeyFormat(r.publicKey),{signature:r.signature.bytes}})}static pregenerateSigner(e,t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var r;let i=e!=null?e:(r=t.experimental_customAuth)==null?void 0:r.email;if(i==null)throw new Error("Email is required to pregenerate a signer");try{let o=(yield new (0, _chunkNHIZ4TEBcjs.a)(t).pregenerateSigner(i,"secp256k1")).publicKey;return this.verifyPublicKeyFormat(o),this.publicKeyToEvmAddress(o.bytes)}catch(n){throw console.error("[EvmEmailSigner] Failed to pregenerate signer:",n),n}})}static verifyPublicKeyFormat(e){if(e==null)throw new Error("No public key found");if(e.encoding!=="hex"||e.keyType!=="secp256k1"||e.bytes==null)throw new Error("Not supported. Expected public key to be in hex encoding and secp256k1 key type. Got: "+JSON.stringify(e))}static publicKeyToEvmAddress(e){let t=_ox.PublicKey.from(`0x${e}`);return _ox.Address.fromPublicKey(t,{checksum:!0})}};exports.a = p;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkWM3HHCBWcjs = require('./chunk-WM3HHCBW.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var m,l,_= exports.a =class{constructor({chain:t,address:e,owner:r,signer:a,options:i},n){_chunkXALFCQKDcjs.d.call(void 0, this,m);_chunkXALFCQKDcjs.d.call(void 0, this,l);_chunkXALFCQKDcjs.e.call(void 0, this,l,n),this.chain=t,this.address=e,this.owner=r,this.signer=a,_chunkXALFCQKDcjs.e.call(void 0, this,m,i)}static getApiClient(t){return t.apiClient}static getOptions(t){return t.options}get apiClient(){return _chunkXALFCQKDcjs.c.call(void 0, this,l)}get options(){return _chunkXALFCQKDcjs.c.call(void 0, this,m)}balances(t,e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let r=this.chain==="solana"?"sol":"eth",a=[r,"usdc",...t!=null?t:[]],i=yield _chunkXALFCQKDcjs.c.call(void 0, this,l).getBalance(this.address,{chains:e!=null?e:[this.chain],tokens:a.map(n=>n.toLowerCase())});if("error"in i)throw new Error(`Failed to get balances for wallet: ${JSON.stringify(i.message)}`);return this.transformBalanceResponse(i,r,t)})}transformBalanceResponse(t,e,r){let a=s=>{var w,f,y;let d,h=(w=s.forChain)==null?void 0:w[this.chain];return h&&"contractAddress"in h&&(d=h.contractAddress),{symbol:s.token,name:s.token,amount:(f=s.amount)!=null?f:"0",contractAddress:d,decimals:s.decimals,rawAmount:(y=s.rawAmount)!=null?y:"0"}},i=t.find(s=>s.token===e||s.token.toLowerCase().includes(e)),n=t.find(s=>s.token.toLowerCase().includes("usdc")),g=t.filter(s=>{let d=s.token.toLowerCase();return!d.includes(e)&&!d.includes("usdc")&&(r==null?void 0:r.some(h=>d.includes(h.toLowerCase())))}),p=s=>({symbol:s,name:s,amount:"0",contractAddress:void 0,decimals:0,rawAmount:"0"});return{nativeToken:i!=null?a(i):p(e),usdc:n!=null?a(n):p("usdc"),tokens:g.map(a)}}experimental_nfts(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield _chunkXALFCQKDcjs.c.call(void 0, this,l).experimental_getNfts(_chunkXALFCQKDcjs.b.call(void 0, _chunkXALFCQKDcjs.a.call(void 0, {},t),{chain:this.chain,address:this.address}))})}experimental_transactions(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield _chunkXALFCQKDcjs.c.call(void 0, this,l).getTransactions(this.walletLocator)})}experimental_activity(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let t=yield this.apiClient.experimental_activity(this.walletLocator,{chain:this.chain});if("error"in t)throw new Error(`Failed to get activity: ${JSON.stringify(t.message)}`);return t})}send(t,e,r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let a=M(t),i=U(e,this.chain),n={recipient:a,amount:r},g=yield _chunkXALFCQKDcjs.c.call(void 0, this,l).send(this.walletLocator,i,n);if("message"in g)throw new (0, _chunkCT2UGJELcjs.q)(`Failed to send token: ${JSON.stringify(g.message)}`);return yield this.approveAndWait(g.id)})}addDelegatedSigner(e){return _chunkXALFCQKDcjs.f.call(void 0, this,arguments,function*({signer:t}){var a,i;let r=yield _chunkXALFCQKDcjs.c.call(void 0, this,l).registerSigner(this.walletLocator,{signer:t,chain:this.chain==="solana"?void 0:this.chain});if("error"in r)throw new Error(`Failed to register signer: ${JSON.stringify(r.message)}`);if("transaction"in r){let n=r.transaction.id;yield this.approveAndWait(n)}else{let n=(a=r.chains)==null?void 0:a[this.chain];if((n==null?void 0:n.status)==="awaiting-approval"){let g=((i=n.approvals)==null?void 0:i.pending)||[];yield this.approveSignature(g,n.id),yield this.waitForSignature(n.id);return}if((n==null?void 0:n.status)==="pending"){yield this.waitForSignature(n.id);return}}})}delegatedSigners(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var e,r,a;let t=yield _chunkXALFCQKDcjs.c.call(void 0, this,l).getWallet(this.walletLocator);if("error"in t)throw new (0, _chunkCT2UGJELcjs.d)(JSON.stringify(t));if(t.type!=="solana-smart-wallet"&&t.type!=="evm-smart-wallet")throw new (0, _chunkCT2UGJELcjs.c)(`Wallet type ${t.type} not supported`);return(a=(r=(e=t==null?void 0:t.config)==null?void 0:e.delegatedSigners)==null?void 0:r.map(i=>{let n=i.locator.indexOf(":");return{signer:`external-wallet:${n>=0?i.locator.slice(n+1):i.locator}`}}))!=null?a:[]})}get walletLocator(){return _chunkXALFCQKDcjs.c.call(void 0, this,l).isServerSide?this.address:`me:${this.isSolanaWallet?"solana-smart-wallet":"evm-smart-wallet"}`}get isSolanaWallet(){return this.chain==="solana"}approveAndWait(t,e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.approveTransaction(t,e),yield this.sleep(1e3),yield this.waitForTransaction(t)})}approveTransaction(t,e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var p,s,d,h;let r=yield _chunkXALFCQKDcjs.c.call(void 0, this,l).getTransaction(this.walletLocator,t);if(r.error)throw new (0, _chunkCT2UGJELcjs.r)(JSON.stringify(r));if(yield(d=(s=(p=_chunkXALFCQKDcjs.c.call(void 0, this,m))==null?void 0:p.experimental_callbacks)==null?void 0:s.onTransactionStart)==null?void 0:d.call(s),this.signer.type==="api-key")return r;let a=(h=r.approvals)==null?void 0:h.pending;if(a==null)return r;let i=[...e!=null?e:[],this.signer],n=yield Promise.all(a.map(w=>{let f=i.find(I=>I.locator()===w.signer);if(f==null)throw new (0, _chunkCT2UGJELcjs.i)(`Signer ${w.signer} not found in pending approvals`);let y=r.walletType==="solana-smart-wallet"?r.onChain.transaction:w.message;return f.signTransaction(y)})),g=yield _chunkXALFCQKDcjs.c.call(void 0, this,l).approveTransaction(this.walletLocator,r.id,{approvals:n.map(w=>_chunkXALFCQKDcjs.a.call(void 0, {signer:this.signer.locator()},w))});if(g.error)throw new (0, _chunkCT2UGJELcjs.w)(JSON.stringify(g));return g})}approveSignature(t,e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(this.isSolanaWallet)throw new Error("Approving signatures is only supported for EVM smart wallets");let r=t.find(i=>i.signer===this.signer.locator());if(!r)throw new (0, _chunkCT2UGJELcjs.i)(`Signer ${this.signer.locator()} not found in pending approvals`);let a=yield this.signer.signMessage(r.message);return yield _chunkXALFCQKDcjs.c.call(void 0, this,l).approveSignature(this.walletLocator,e,{approvals:[_chunkXALFCQKDcjs.a.call(void 0, {signer:this.signer.locator()},a)]}),a})}waitForSignature(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let e=null;do if(yield new Promise(r=>setTimeout(r,_chunkWM3HHCBWcjs.d)),e=yield _chunkXALFCQKDcjs.c.call(void 0, this,l).getSignature(this.walletLocator,t),"error"in e)throw new (0, _chunkCT2UGJELcjs.p)(JSON.stringify(e));while(e===null||e.status==="pending");if(e.status==="failed")throw new (0, _chunkCT2UGJELcjs.m)("Signature signing failed");if(!e.outputSignature)throw new (0, _chunkCT2UGJELcjs.p)("Signature not available");return e.outputSignature})}waitForTransaction(n){return _chunkXALFCQKDcjs.f.call(void 0, this,arguments,function*(t,e=6e4,{backoffMultiplier:r=1.1,maxBackoffMs:a=2e3,initialBackoffMs:i=_chunkWM3HHCBWcjs.d}={}){let g=Date.now(),p;do{if(Date.now()-g>e)throw new (0, _chunkCT2UGJELcjs.s)("Transaction confirmation timeout");if(p=yield _chunkXALFCQKDcjs.c.call(void 0, this,l).getTransaction(this.walletLocator,t),p.error)throw new (0, _chunkCT2UGJELcjs.r)(JSON.stringify(p));yield this.sleep(i),i=Math.min(i*r,a)}while(p.status==="pending");if(p.status==="failed")throw new (0, _chunkCT2UGJELcjs.t)(`Transaction sending failed: ${JSON.stringify(p.error)}`);if(p.status==="awaiting-approval")throw new (0, _chunkCT2UGJELcjs.u)("Transaction is awaiting approval. Please submit required approvals before waiting for completion.");let s=p.onChain.txId;if(s==null)throw new (0, _chunkCT2UGJELcjs.v)("Transaction hash not found on transaction response");return{hash:s,explorerLink:R(p,this.apiClient.crossmint.apiKey)}})}sleep(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return new Promise(e=>setTimeout(e,t))})}};m=new WeakMap,l=new WeakMap;function R(o,t){let e;if(o.walletType==="evm-smart-wallet")e=o.onChain.explorerLink;else if(o.walletType==="solana-smart-wallet"){let r=new URLSearchParams;_commonsdkbase.getEnvironmentForKey.call(void 0, t)!=="production"&&r.append("cluster","devnet"),e=`https://explorer.solana.com/tx/${o.onChain.txId}?${r.toString()}`}return(e==null||e==="")&&(e="Explorer link not available"),e}function M(o){if(typeof o=="string")return o;if("email"in o)return`email:${o.email}`;if("x"in o)return`x:${o.x}`;if("twitter"in o)return`twitter:${o.twitter}`;if("phone"in o)return`phoneNumber:${o.phone}`;if("userId"in o)return`userId:${o.userId}`;throw new Error("Invalid recipient locator")}function U(o,t){return _commonsdkbase.isValidAddress.call(void 0, o)?`${t}:${o}`:`${t}:${o.toLowerCase()}`}exports.a = _;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as l}from"./chunk-
|
|
1
|
+
import{a as l}from"./chunk-NEP3LDXF.js";import{a}from"./chunk-H3EPTRZ2.js";import{f as e}from"./chunk-BW7YYVZE.js";import{createCrossmint as C}from"@crossmint/common-sdk-base";var i=class o{constructor(t){let r=new a(t);this.walletFactory=new l(r)}static from(t){return new o(t)}getOrCreateWallet(t){return e(this,null,function*(){return yield this.walletFactory.getOrCreateWallet(t)})}getWallet(t,r){return e(this,null,function*(){return yield this.walletFactory.getWallet(t,r)})}createWallet(t){return e(this,null,function*(){return yield this.walletFactory.createWallet(t)})}};export{C as a,i as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var s="@crossmint/wallets-sdk",t="0.10.6";var c="WALLETS_SDK",r=t,d=s,a=500;export{c as a,r as b,d as c,a as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as s}from"./chunk-
|
|
1
|
+
import{a as s}from"./chunk-2MOAPV7H.js";import{a as w}from"./chunk-BJDS5BJG.js";import{k as p,o as c,q as f}from"./chunk-7ENJXL4H.js";import{f as r}from"./chunk-BW7YYVZE.js";import{createPublicClient as S,http as E}from"viem";import{isValidEvmAddress as V}from"@crossmint/common-sdk-base";var C=class T extends s{constructor(t){super({chain:t.chain,address:t.address,owner:t.owner,signer:t.signer,options:s.getOptions(t)},s.getApiClient(t))}static from(t){if(!V(t.address))throw new Error("Wallet is not an EVM wallet");return new T(t)}sendTransaction(t){return r(this,null,function*(){var i;let a=yield this.apiClient.createTransaction(this.walletLocator,{params:{signer:this.signer.locator(),chain:this.chain,calls:[{to:t.to,value:t.value?t.value.toString():"0",data:(i=t.data)!=null?i:"0x"}]}});if("error"in a)throw new f(JSON.stringify(a));return yield this.approveAndWait(a.id)})}signMessage(t){return r(this,null,function*(){var n;let a=yield this.apiClient.createSignature(this.walletLocator,{type:"evm-message",params:{message:t,signer:this.signer.locator(),chain:this.chain}});if("error"in a)throw new c(JSON.stringify(a));let i=a.id,o=((n=a.approvals)==null?void 0:n.pending)||[];return yield this.approveSignature(o,i),yield this.waitForSignature(i)})}createTypedDataSignature(t){return r(this,null,function*(){var u;let{domain:a,message:i,primaryType:o,types:n,chain:d}=t;if(!a||!i||!n||!d)throw new p("Invalid typed data");let{name:h,version:g,chainId:y,verifyingContract:l,salt:v}=a;if(!h||!g||!y||!l)throw new p("Invalid typed data domain");let e=yield this.apiClient.createSignature(this.walletLocator,{type:"evm-typed-data",params:{typedData:{domain:{name:h,version:g,chainId:Number(y),verifyingContract:l,salt:v},message:i,primaryType:o,types:n},signer:this.signer.locator(),chain:d,isSmartWalletSignature:!1}});if("error"in e)throw new c(JSON.stringify(e));let m=e.id,D=((u=e.approvals)==null?void 0:u.pending)||[];return yield this.approveSignature(D,m),yield this.waitForSignature(m)})}getViemClient(t){var a;return S({transport:(a=t==null?void 0:t.transport)!=null?a:E(),chain:w(this.chain)})}};export{C as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as n,c as i}from"./chunk-
|
|
1
|
+
import{b as n,c as i}from"./chunk-GAURTX2I.js";import{a as o}from"./chunk-7ENJXL4H.js";import{f as r}from"./chunk-BW7YYVZE.js";import{APIKeyUsageOrigin as c,CrossmintApiClient as h}from"@crossmint/common-sdk-base";var p=class extends h{constructor(e){super(e,{internalConfig:{sdkMetadata:{name:i,version:n}}});this.apiPrefix="api/2022-06-09/wallets"}createWallet(e){return r(this,null,function*(){let s=this.isServerSide?`${this.apiPrefix}`:`${this.apiPrefix}/me`;return(yield this.post(s,{body:JSON.stringify(e),headers:this.headers})).json()})}getWallet(e){return r(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}`,{headers:this.headers})).json()})}createTransaction(e,s){return r(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveTransaction(e,s,t){return r(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions/${s}/approvals`,{body:JSON.stringify(t),headers:this.headers})).json()})}getTransaction(e,s){return r(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions/${s}`,{headers:this.headers})).json()})}createSignature(e,s){return r(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signatures`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveSignature(e,s,t){return r(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signatures/${s}/approvals`,{body:JSON.stringify(t),headers:this.headers})).json()})}getSignature(e,s){return r(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/signatures/${s}`,{headers:this.headers})).json()})}getTransactions(e){return r(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions`,{headers:this.headers})).json()})}experimental_getNfts(e){return r(this,null,function*(){let s=new URLSearchParams;s.append("page",e.page.toString()),s.append("perPage",e.perPage.toString());let t=`${e.chain}:${e.address}`;return(yield this.get(`${this.apiPrefix}/${t}/nfts?${s.toString()}`,{headers:this.headers})).json()})}experimental_activity(e,s){return r(this,null,function*(){let t=new URLSearchParams;return t.append("chain",s.chain.toString()),(yield this.get(`${this.apiPrefix}/${e}/activity?${t.toString()}`,{headers:this.headers})).json()})}getBalance(e,s){return r(this,null,function*(){let t=new URLSearchParams;return t.append("tokenLocators",s.tokens.join(",")),t.append("chains",s.chains.join(",")),(yield this.get(`api/unstable/wallets/${e}/balances?${t.toString()}`,{headers:this.headers})).json()})}registerSigner(e,s){return r(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signers`,{body:JSON.stringify(s),headers:this.headers})).json()})}getSigner(e,s){return r(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/signers/${s}`,{headers:this.headers})).json()})}send(e,s,t){return r(this,null,function*(){return(yield this.post(`api/unstable/wallets/${e}/tokens/${s}/transfers`,{body:JSON.stringify(t),headers:this.headers})).json()})}get isServerSide(){return this.parsedAPIKey.usageOrigin===c.SERVER}get environment(){if(!this.parsedAPIKey.isValid)throw new o("Invalid API key");return this.parsedAPIKey.environment}get headers(){return{"Content-Type":"application/json"}}};export{p as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as u}from"./chunk-PDL3XF5M.js";import{a as d}from"./chunk-M4ELAV7U.js";import{f as o}from"./chunk-BW7YYVZE.js";import{validateAPIKey as p}from"@crossmint/common-sdk-base";var l=class{constructor(t){this.config=t;this.type="email";this._needsAuth=!0;this._authPromise=null;this.initialize()}initialize(){return o(this,null,function*(){if(this.config._handshakeParent==null){let t=p(this.config.crossmint.apiKey);if(!t.isValid)throw new Error("Invalid API key");let i=new u({environment:t.environment});this.config._handshakeParent=yield i.initialize()}})}signMessage(){return o(this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for email signer"))})}handleAuthRequired(){return o(this,null,function*(){var n,a,h;if(this.config._handshakeParent==null)throw new Error("Handshake parent not initialized");let t=yield(h=this.config._handshakeParent)==null?void 0:h.sendAction({event:"request:get-status",responseEvent:"response:get-status",data:{authData:{jwt:(a=(n=this.config.crossmint.experimental_customAuth)==null?void 0:n.jwt)!=null?a:"",apiKey:this.config.crossmint.apiKey}},options:c});if((t==null?void 0:t.status)!=="success")throw new Error(t==null?void 0:t.error);if(t.signerStatus==="ready"){this._needsAuth=!1;return}let{promise:i,resolve:r,reject:s}=this.createAuthPromise();if(this._authPromise={promise:i,resolve:r,reject:s},this.config.onAuthRequired)try{yield this.config.onAuthRequired(this._needsAuth,()=>this.sendEmailWithOtp(),e=>this.verifyOtp(e),()=>s(new d))}catch(e){s(e)}try{yield i}catch(e){throw e}})}getJwtOrThrow(){var i;let t=(i=this.config.crossmint.experimental_customAuth)==null?void 0:i.jwt;if(t==null)throw new Error("JWT is required");return t}createAuthPromise(){let t,i;return{promise:new Promise((s,n)=>{t=s,i=n}),resolve:t,reject:i}}sendEmailWithOtp(){return o(this,null,function*(){var s,n,a;if(this.config._handshakeParent==null)throw new Error("Handshake parent not initialized");let t=this.config._handshakeParent,i=`email:${this.config.email}`,r=yield t.sendAction({event:"request:start-onboarding",responseEvent:"response:start-onboarding",data:{authData:{jwt:(n=(s=this.config.crossmint.experimental_customAuth)==null?void 0:s.jwt)!=null?n:"",apiKey:this.config.crossmint.apiKey},data:{authId:i}},options:c});if((r==null?void 0:r.status)==="success"&&r.signerStatus==="ready"){this._needsAuth=!1;return}(r==null?void 0:r.status)==="error"&&(console.error("[sendEmailWithOtp] Failed to send OTP:",r),(a=this._authPromise)==null||a.reject(new Error(r.error||"Failed to initiate OTP process.")))})}verifyOtp(t){return o(this,null,function*(){var r,s,n,a,h;if(this.config._handshakeParent==null)throw new Error("Handshake parent not initialized");let i=this.config._handshakeParent;try{let e=yield i.sendAction({event:"request:complete-onboarding",responseEvent:"response:complete-onboarding",data:{authData:{jwt:(s=(r=this.config.crossmint.experimental_customAuth)==null?void 0:r.jwt)!=null?s:"",apiKey:this.config.crossmint.apiKey},data:{onboardingAuthentication:{encryptedOtp:t}}},options:c});if((e==null?void 0:e.status)==="success"){this._needsAuth=!1,(n=this._authPromise)==null||n.resolve();return}console.error("[verifyOtp] Failed to validate OTP:",e),this._needsAuth=!0;let m=(e==null?void 0:e.status)==="error"?e.error:"Failed to validate encrypted OTP";(a=this._authPromise)==null||a.reject(new Error(m))}catch(e){throw console.error("[verifyOtp] Error sending OTP validation request:",e),this._needsAuth=!0,(h=this._authPromise)==null||h.reject(e),e}})}},c={timeoutMs:1e4,intervalMs:5e3};export{l as a,c as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as g}from"./chunk-LRV4CFS5.js";import{a,b as c}from"./chunk-JITEEQUZ.js";import{f as s}from"./chunk-BW7YYVZE.js";import{Address as m,PublicKey as y}from"ox";var p=class u extends a{constructor(e){super(e)}locator(){return`evm-keypair:${this.config.signerAddress}`}signMessage(){return s(this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for email signer"))})}signTransaction(e){return s(this,null,function*(){var n;yield this.handleAuthRequired();let t=this.getJwtOrThrow(),i=e.replace("0x",""),r=yield(n=this.config._handshakeParent)==null?void 0:n.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:t,apiKey:this.config.crossmint.apiKey},data:{keyType:"secp256k1",bytes:i,encoding:"hex"}},options:c});if((r==null?void 0:r.status)==="error")throw new Error(r.error);if((r==null?void 0:r.signature)==null)throw new Error("Failed to sign transaction");return u.verifyPublicKeyFormat(r.publicKey),{signature:r.signature.bytes}})}static pregenerateSigner(e,t){return s(this,null,function*(){var r;let i=e!=null?e:(r=t.experimental_customAuth)==null?void 0:r.email;if(i==null)throw new Error("Email is required to pregenerate a signer");try{let o=(yield new g(t).pregenerateSigner(i,"secp256k1")).publicKey;return this.verifyPublicKeyFormat(o),this.publicKeyToEvmAddress(o.bytes)}catch(n){throw console.error("[EvmEmailSigner] Failed to pregenerate signer:",n),n}})}static verifyPublicKeyFormat(e){if(e==null)throw new Error("No public key found");if(e.encoding!=="hex"||e.keyType!=="secp256k1"||e.bytes==null)throw new Error("Not supported. Expected public key to be in hex encoding and secp256k1 key type. Got: "+JSON.stringify(e))}static publicKeyToEvmAddress(e){let t=y.from(`0x${e}`);return m.fromPublicKey(t,{checksum:!0})}};export{p as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as i,c as s}from"./chunk-GAURTX2I.js";import{a as n}from"./chunk-7ENJXL4H.js";import{f as t}from"./chunk-BW7YYVZE.js";import{APIKeyUsageOrigin as d,CrossmintApiClient as y}from"@crossmint/common-sdk-base";var o=class extends y{constructor(e){super(e,{internalConfig:{sdkMetadata:{name:s,version:i}}});this.apiPrefix="api/v1/signers"}pregenerateSigner(e,a){return t(this,null,function*(){let r=yield this.post(`${this.apiPrefix}/derive-public-key`,{body:JSON.stringify({authId:`email:${e}`,keyType:a}),headers:this.headers});if(!r.ok){let p=yield r.text();throw new Error(`Failed to fetch public key: ${r.status} ${p}`)}return yield r.json()})}get isServerSide(){return this.parsedAPIKey.usageOrigin===d.SERVER}get environment(){if(!this.parsedAPIKey.isValid)throw new n("Invalid API key");return this.parsedAPIKey.environment}get headers(){return{"Content-Type":"application/json"}}};export{o as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as c}from"./chunk-2MOAPV7H.js";import{a as C}from"./chunk-SR4HCLCT.js";import{a as d}from"./chunk-XD35GYJQ.js";import{a as y}from"./chunk-KOQPWJBO.js";import{a as f}from"./chunk-FUUYGB4K.js";import{d as m,f as r}from"./chunk-7ENJXL4H.js";import{f as o}from"./chunk-BW7YYVZE.js";import{WebAuthnP256 as g}from"ox";import{isEVMBlockchain as u}from"@crossmint/common-sdk-base";var h=class{constructor(e){this.apiClient=e}getOrCreateWallet(e){return o(this,null,function*(){if(this.apiClient.isServerSide)throw new r("getOrCreateWallet is not supported on server side");let t=yield this.apiClient.getWallet(`me:${e.chain==="solana"?"solana-smart-wallet":"evm-smart-wallet"}`);return t&&!("error"in t)?(yield this.validateWalletConfig(t,e),this.createWalletInstance(t,e)):this.createWallet(e)})}getWallet(e,t){return o(this,null,function*(){if(!this.apiClient.isServerSide)throw new r("getWallet is not supported on client side, use getOrCreateWallet instead");let i=yield this.apiClient.getWallet(e);if("error"in i)throw new m(JSON.stringify(i));return this.createWalletInstance(i,t)})}createWallet(e){return o(this,null,function*(){var a,n,s,l,p;yield(s=(n=(a=e.options)==null?void 0:a.experimental_callbacks)==null?void 0:n.onWalletCreationStart)==null?void 0:s.call(n);let t;e.chain==="solana"?t={type:"solana-smart-wallet",config:{adminSigner:yield this.configureSigner(e.chain,e.signer)},linkedUser:(l=e.owner)!=null?l:void 0}:t={type:"evm-smart-wallet",config:{adminSigner:yield this.configureSigner(e.chain,e.signer)},linkedUser:(p=e.owner)!=null?p:void 0};let i=yield this.apiClient.createWallet(t);if("error"in i)throw new r(JSON.stringify(i));return this.createWalletInstance(i,e)})}createWalletInstance(e,t){let i=this.toInternalSignerConfig(e,t.signer);return new c({chain:t.chain,address:e.address,signer:C(t.chain,i),options:t.options},this.apiClient)}toInternalSignerConfig(e,t){var i,a;if(t==null)throw new r("Signer is required to create a wallet");switch(t.type){case"api-key":{let n;switch(e.type){case"solana-smart-wallet":n=e.config.adminSigner.address;break;case"evm-smart-wallet":e.config.adminSigner.type==="evm-fireblocks-custodial"&&(n=e.config.adminSigner.address);break}if(n==null)throw new r("Wallet signer 'api-key' has no address");return{type:"api-key",address:n}}case"external-wallet":return t;case"passkey":if(e.type==="evm-smart-wallet"&&e.config.adminSigner.type==="evm-passkey")return{type:"passkey",id:e.config.adminSigner.id,name:e.config.adminSigner.name,onCreatePasskey:t.onCreatePasskey,onSignWithPasskey:t.onSignWithPasskey};throw new r("Passkey signer is not supported for this wallet type");case"email":{if(!(e.type==="solana-smart-wallet"&&e.config.adminSigner.type==="solana-keypair"||e.type==="evm-smart-wallet"&&e.config.adminSigner.type==="evm-keypair"))throw new r("Wallet signer 'email' has no address");let n=e.config.adminSigner.address;return{type:"email",email:(a=t.email)!=null?a:(i=this.apiClient.crossmint.experimental_customAuth)==null?void 0:i.email,signerAddress:n,crossmint:this.apiClient.crossmint,onAuthRequired:t.onAuthRequired,_handshakeParent:t._handshakeParent}}default:throw new Error("Invalid signer type")}}configureSigner(e,t){return o(this,null,function*(){var i;if((t==null?void 0:t.type)==="passkey"){let a=(i=t.name)!=null?i:`Crossmint Wallet ${Date.now()}`,n=t.onCreatePasskey?yield t.onCreatePasskey(a):yield g.createCredential({name:a});return{type:"evm-passkey",id:n.id,name:a,publicKey:{x:n.publicKey.x.toString(),y:n.publicKey.y.toString()}}}return yield this.toExternalSignerConfig(e,t)})}toExternalSignerConfig(e,t,i){return o(this,null,function*(){var a,n;if(!t||t.type==="api-key")return{type:e==="solana"?"solana-fireblocks-custodial":"evm-fireblocks-custodial"};if(t.type==="external-wallet")return{type:e==="solana"?"solana-keypair":"evm-keypair",address:t.address};if(t.type==="passkey"&&i!=null){if((i==null?void 0:i.type)!=="evm-smart-wallet"||i.config.adminSigner.type!=="evm-passkey")throw new r("Passkey signer is not supported for this wallet type");return{type:"evm-passkey",id:i.config.adminSigner.id,name:i.config.adminSigner.name,publicKey:{x:i.config.adminSigner.publicKey.x,y:i.config.adminSigner.publicKey.y}}}if(t.type==="email"){let s=(n=t.email)!=null?n:(a=this.apiClient.crossmint.experimental_customAuth)==null?void 0:a.email;if(s==null)throw new Error("Email is required to create a wallet with email signer");if(e==="solana")return{type:"solana-keypair",address:yield d.pregenerateSigner(s,this.apiClient.crossmint)};if(u(e))return{type:"evm-keypair",address:yield y.pregenerateSigner(s,this.apiClient.crossmint)}}throw new Error("Invalid signer type")})}validateWalletConfig(e,t){return o(this,null,function*(){if(t.owner!=null&&e.linkedUser!=null&&t.owner!==e.linkedUser)throw new r("Wallet owner does not match existing wallet's linked user");if(e.type!=="solana-smart-wallet"&&e.type!=="evm-smart-wallet")return;let i=yield this.toExternalSignerConfig(t.chain,t.signer,e),a=e.config.adminSigner;if(i&&a){if(i.type!==a.type)throw new r("The wallet signer type provided in the wallet config does not match the existing wallet's adminSigner type");f(i,a)}})}};export{h as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkWM3HHCBWcjs = require('./chunk-WM3HHCBW.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var o=class extends _commonsdkbase.CrossmintApiClient{constructor(e){super(e,{internalConfig:{sdkMetadata:{name:_chunkWM3HHCBWcjs.c,version:_chunkWM3HHCBWcjs.b}}});this.apiPrefix="api/v1/signers"}pregenerateSigner(e,a){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let r=yield this.post(`${this.apiPrefix}/derive-public-key`,{body:JSON.stringify({authId:`email:${e}`,keyType:a}),headers:this.headers});if(!r.ok){let p=yield r.text();throw new Error(`Failed to fetch public key: ${r.status} ${p}`)}return yield r.json()})}get isServerSide(){return this.parsedAPIKey.usageOrigin===_commonsdkbase.APIKeyUsageOrigin.SERVER}get environment(){if(!this.parsedAPIKey.isValid)throw new (0, _chunkCT2UGJELcjs.a)("Invalid API key");return this.parsedAPIKey.environment}get headers(){return{"Content-Type":"application/json"}}};exports.a = o;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkNHIZ4TEBcjs = require('./chunk-NHIZ4TEB.cjs');var _chunkUUR6LK3Hcjs = require('./chunk-UUR6LK3H.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _web3js = require('@solana/web3.js');var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);var p=class l extends _chunkUUR6LK3Hcjs.a{constructor(e){super(e)}locator(){return`solana-keypair:${this.config.signerAddress}`}signMessage(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for email signer"))})}signTransaction(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var a;yield this.handleAuthRequired();let n=this.getJwtOrThrow(),i=_bs582.default.decode(e),t=_web3js.VersionedTransaction.deserialize(i).message.serialize(),r=yield(a=this.config._handshakeParent)==null?void 0:a.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:n,apiKey:this.config.crossmint.apiKey},data:{keyType:"ed25519",bytes:_bs582.default.encode(t),encoding:"base58"}},options:_chunkUUR6LK3Hcjs.b});if((r==null?void 0:r.status)==="error")throw new Error(r.error);if((r==null?void 0:r.signature)==null)throw new Error("Failed to sign transaction");return l.verifyPublicKeyFormat(r.publicKey),{signature:r.signature.bytes}})}static pregenerateSigner(e,n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var o;let i=e!=null?e:(o=n.experimental_customAuth)==null?void 0:o.email;if(i==null)throw new Error("Email is required to pregenerate a signer");try{let r=(yield new (0, _chunkNHIZ4TEBcjs.a)(n).pregenerateSigner(i,"ed25519")).publicKey;return this.verifyPublicKeyFormat(r),r.bytes}catch(t){throw console.error("[EmailSigner] Failed to pregenerate signer:",t),t}})}static verifyPublicKeyFormat(e){if(e==null)throw new Error("No public key found");if(e.encoding!=="base58"||e.keyType!=="ed25519"||e.bytes==null)throw new Error("Not supported. Expected public key to be in base58 encoding and ed25519 key type. Got: "+JSON.stringify(e))}};exports.a = p;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as t}from"./chunk-
|
|
1
|
+
import{a as t}from"./chunk-2MOAPV7H.js";import{a as c}from"./chunk-T3ICQDFS.js";import{q as s}from"./chunk-7ENJXL4H.js";import{f as i}from"./chunk-BW7YYVZE.js";import d from"bs58";import{isValidSolanaAddress as f}from"@crossmint/common-sdk-base";var p=class l extends t{constructor(a){super({chain:a.chain,address:a.address,owner:a.owner,signer:a.signer},t.getApiClient(a))}static from(a){if(!f(a.address))throw new Error("Wallet is not a Solana wallet");return new l(a)}sendTransaction(A){return i(this,arguments,function*({transaction:a,additionalSigners:r}){let m={transaction:d.encode(a.serialize())},n=yield this.apiClient.createTransaction(this.walletLocator,{params:m});if(n.error)throw new s(JSON.stringify(n));let h=r==null?void 0:r.map(o=>new c({type:"external-wallet",address:o.publicKey.toString(),onSignTransaction:e=>(e.sign([o]),Promise.resolve(e))}));return yield this.approveAndWait(n.id,h)})}};export{p as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as n}from"./chunk-XD35GYJQ.js";import{a}from"./chunk-KOQPWJBO.js";import{a as l}from"./chunk-OV4CFQ36.js";import{a as m}from"./chunk-77QBSFHG.js";import{a as t}from"./chunk-T3ICQDFS.js";import{a as o}from"./chunk-2KK65AC6.js";import{a as i}from"./chunk-QTSZSHKK.js";function x(r,e){switch(e.type){case"email":return r==="solana"?new n(e):new a(e);case"api-key":return r==="solana"?new m(e):new o(e);case"external-wallet":return r==="solana"?new t(e):new i(e);case"passkey":return new l(e)}}export{x as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkZWDS66FScjs = require('./chunk-ZWDS66FS.cjs');var _chunkZSWIQU3Ucjs = require('./chunk-ZSWIQU3U.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var l=class{constructor(t){this.config=t;this.type="email";this._needsAuth=!0;this._authPromise=null;this.initialize()}initialize(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(this.config._handshakeParent==null){let t=_commonsdkbase.validateAPIKey.call(void 0, this.config.crossmint.apiKey);if(!t.isValid)throw new Error("Invalid API key");let i=new (0, _chunkZWDS66FScjs.a)({environment:t.environment});this.config._handshakeParent=yield i.initialize()}})}signMessage(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for email signer"))})}handleAuthRequired(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var n,a,h;if(this.config._handshakeParent==null)throw new Error("Handshake parent not initialized");let t=yield(h=this.config._handshakeParent)==null?void 0:h.sendAction({event:"request:get-status",responseEvent:"response:get-status",data:{authData:{jwt:(a=(n=this.config.crossmint.experimental_customAuth)==null?void 0:n.jwt)!=null?a:"",apiKey:this.config.crossmint.apiKey}},options:c});if((t==null?void 0:t.status)!=="success")throw new Error(t==null?void 0:t.error);if(t.signerStatus==="ready"){this._needsAuth=!1;return}let{promise:i,resolve:r,reject:s}=this.createAuthPromise();if(this._authPromise={promise:i,resolve:r,reject:s},this.config.onAuthRequired)try{yield this.config.onAuthRequired(this._needsAuth,()=>this.sendEmailWithOtp(),e=>this.verifyOtp(e),()=>s(new _chunkZSWIQU3Ucjs.a))}catch(e){s(e)}try{yield i}catch(e){throw e}})}getJwtOrThrow(){var i;let t=(i=this.config.crossmint.experimental_customAuth)==null?void 0:i.jwt;if(t==null)throw new Error("JWT is required");return t}createAuthPromise(){let t,i;return{promise:new Promise((s,n)=>{t=s,i=n}),resolve:t,reject:i}}sendEmailWithOtp(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var s,n,a;if(this.config._handshakeParent==null)throw new Error("Handshake parent not initialized");let t=this.config._handshakeParent,i=`email:${this.config.email}`,r=yield t.sendAction({event:"request:start-onboarding",responseEvent:"response:start-onboarding",data:{authData:{jwt:(n=(s=this.config.crossmint.experimental_customAuth)==null?void 0:s.jwt)!=null?n:"",apiKey:this.config.crossmint.apiKey},data:{authId:i}},options:c});if((r==null?void 0:r.status)==="success"&&r.signerStatus==="ready"){this._needsAuth=!1;return}(r==null?void 0:r.status)==="error"&&(console.error("[sendEmailWithOtp] Failed to send OTP:",r),(a=this._authPromise)==null||a.reject(new Error(r.error||"Failed to initiate OTP process.")))})}verifyOtp(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var r,s,n,a,h;if(this.config._handshakeParent==null)throw new Error("Handshake parent not initialized");let i=this.config._handshakeParent;try{let e=yield i.sendAction({event:"request:complete-onboarding",responseEvent:"response:complete-onboarding",data:{authData:{jwt:(s=(r=this.config.crossmint.experimental_customAuth)==null?void 0:r.jwt)!=null?s:"",apiKey:this.config.crossmint.apiKey},data:{onboardingAuthentication:{encryptedOtp:t}}},options:c});if((e==null?void 0:e.status)==="success"){this._needsAuth=!1,(n=this._authPromise)==null||n.resolve();return}console.error("[verifyOtp] Failed to validate OTP:",e),this._needsAuth=!0;let m=(e==null?void 0:e.status)==="error"?e.error:"Failed to validate encrypted OTP";(a=this._authPromise)==null||a.reject(new Error(m))}catch(e){throw console.error("[verifyOtp] Error sending OTP validation request:",e),this._needsAuth=!0,(h=this._authPromise)==null||h.reject(e),e}})}},c= exports.b ={timeoutMs:1e4,intervalMs:5e3};exports.a = l; exports.b = c;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBTNONXSScjs = require('./chunk-BTNONXSS.cjs');var _chunk6VJEBYPNcjs = require('./chunk-6VJEBYPN.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _viem = require('viem');var _commonsdkbase = require('@crossmint/common-sdk-base');var C=class T extends _chunkBTNONXSScjs.a{constructor(t){super({chain:t.chain,address:t.address,owner:t.owner,signer:t.signer,options:_chunkBTNONXSScjs.a.getOptions(t)},_chunkBTNONXSScjs.a.getApiClient(t))}static from(t){if(!_commonsdkbase.isValidEvmAddress.call(void 0, t.address))throw new Error("Wallet is not an EVM wallet");return new T(t)}sendTransaction(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var i;let a=yield this.apiClient.createTransaction(this.walletLocator,{params:{signer:this.signer.locator(),chain:this.chain,calls:[{to:t.to,value:t.value?t.value.toString():"0",data:(i=t.data)!=null?i:"0x"}]}});if("error"in a)throw new (0, _chunkCT2UGJELcjs.q)(JSON.stringify(a));return yield this.approveAndWait(a.id)})}signMessage(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var n;let a=yield this.apiClient.createSignature(this.walletLocator,{type:"evm-message",params:{message:t,signer:this.signer.locator(),chain:this.chain}});if("error"in a)throw new (0, _chunkCT2UGJELcjs.o)(JSON.stringify(a));let i=a.id,o=((n=a.approvals)==null?void 0:n.pending)||[];return yield this.approveSignature(o,i),yield this.waitForSignature(i)})}createTypedDataSignature(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var u;let{domain:a,message:i,primaryType:o,types:n,chain:d}=t;if(!a||!i||!n||!d)throw new (0, _chunkCT2UGJELcjs.k)("Invalid typed data");let{name:h,version:g,chainId:y,verifyingContract:l,salt:v}=a;if(!h||!g||!y||!l)throw new (0, _chunkCT2UGJELcjs.k)("Invalid typed data domain");let e=yield this.apiClient.createSignature(this.walletLocator,{type:"evm-typed-data",params:{typedData:{domain:{name:h,version:g,chainId:Number(y),verifyingContract:l,salt:v},message:i,primaryType:o,types:n},signer:this.signer.locator(),chain:d,isSmartWalletSignature:!1}});if("error"in e)throw new (0, _chunkCT2UGJELcjs.o)(JSON.stringify(e));let m=e.id,D=((u=e.approvals)==null?void 0:u.pending)||[];return yield this.approveSignature(D,m),yield this.waitForSignature(m)})}getViemClient(t){var a;return _viem.createPublicClient.call(void 0, {transport:(a=t==null?void 0:t.transport)!=null?a:_viem.http.call(void 0, ),chain:_chunk6VJEBYPNcjs.a.call(void 0, this.chain)})}};exports.a = C;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var s="@crossmint/wallets-sdk",t="0.10.
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var s="@crossmint/wallets-sdk",t="0.10.6";var p="WALLETS_SDK",c= exports.b =t,r= exports.c =s,d= exports.d =500;exports.a = p; exports.b = c; exports.c = r; exports.d = d;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as d}from"./chunk-LRV4CFS5.js";import{a as g,b as c}from"./chunk-JITEEQUZ.js";import{f as s}from"./chunk-BW7YYVZE.js";import{VersionedTransaction as y}from"@solana/web3.js";import m from"bs58";var p=class l extends g{constructor(e){super(e)}locator(){return`solana-keypair:${this.config.signerAddress}`}signMessage(){return s(this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for email signer"))})}signTransaction(e){return s(this,null,function*(){var a;yield this.handleAuthRequired();let n=this.getJwtOrThrow(),i=m.decode(e),t=y.deserialize(i).message.serialize(),r=yield(a=this.config._handshakeParent)==null?void 0:a.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:n,apiKey:this.config.crossmint.apiKey},data:{keyType:"ed25519",bytes:m.encode(t),encoding:"base58"}},options:c});if((r==null?void 0:r.status)==="error")throw new Error(r.error);if((r==null?void 0:r.signature)==null)throw new Error("Failed to sign transaction");return l.verifyPublicKeyFormat(r.publicKey),{signature:r.signature.bytes}})}static pregenerateSigner(e,n){return s(this,null,function*(){var o;let i=e!=null?e:(o=n.experimental_customAuth)==null?void 0:o.email;if(i==null)throw new Error("Email is required to pregenerate a signer");try{let r=(yield new d(n).pregenerateSigner(i,"ed25519")).publicKey;return this.verifyPublicKeyFormat(r),r.bytes}catch(t){throw console.error("[EmailSigner] Failed to pregenerate signer:",t),t}})}static verifyPublicKeyFormat(e){if(e==null)throw new Error("No public key found");if(e.encoding!=="base58"||e.keyType!=="ed25519"||e.bytes==null)throw new Error("Not supported. Expected public key to be in base58 encoding and ed25519 key type. Got: "+JSON.stringify(e))}};export{p 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 _chunkVNSDVH74cjs = require('./chunk-VNSDVH74.cjs');var _chunk64XBD4HKcjs = require('./chunk-64XBD4HK.cjs');require('./chunk-MHKWLGN5.cjs');var _chunkANTDXLCIcjs = require('./chunk-ANTDXLCI.cjs');var _chunk7LUIRC4Hcjs = require('./chunk-7LUIRC4H.cjs');var _chunkBTNONXSScjs = require('./chunk-BTNONXSS.cjs');require('./chunk-4UVO2GRG.cjs');require('./chunk-VMEGMTOD.cjs');require('./chunk-Q5BKSVUU.cjs');require('./chunk-BNLX7HKW.cjs');require('./chunk-NHIZ4TEB.cjs');require('./chunk-UUR6LK3H.cjs');require('./chunk-ZWDS66FS.cjs');require('./chunk-DYRSQN7X.cjs');require('./chunk-NVJN7LPY.cjs');require('./chunk-AFYBD7FI.cjs');var _chunkZSWIQU3Ucjs = require('./chunk-ZSWIQU3U.cjs');require('./chunk-RD5PG4M6.cjs');var _chunk6VJEBYPNcjs = require('./chunk-6VJEBYPN.cjs');require('./chunk-IR5WN6FQ.cjs');require('./chunk-GEY574TH.cjs');require('./chunk-6HXIZLEQ.cjs');require('./chunk-BIDVRITM.cjs');require('./chunk-WM3HHCBW.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');require('./chunk-ECAM5KTH.cjs');require('./chunk-YO6BJ2DI.cjs');require('./chunk-DIZVZP5P.cjs');require('./chunk-XALFCQKD.cjs');exports.AuthRejectedError = _chunkZSWIQU3Ucjs.a; exports.CrossmintWallets = _chunkANTDXLCIcjs.b; exports.EVMWallet = _chunkVNSDVH74cjs.a; exports.InvalidApiKeyError = _chunkCT2UGJELcjs.a; exports.InvalidEnvironmentError = _chunkCT2UGJELcjs.b; exports.InvalidMessageFormatError = _chunkCT2UGJELcjs.j; exports.InvalidSignerError = _chunkCT2UGJELcjs.i; exports.InvalidTypedDataError = _chunkCT2UGJELcjs.k; exports.InvalidWalletConfigError = _chunkCT2UGJELcjs.e; exports.MessageSigningNotSupportedError = _chunkCT2UGJELcjs.n; exports.PendingApprovalsError = _chunkCT2UGJELcjs.x; exports.SignatureNotAvailableError = _chunkCT2UGJELcjs.p; exports.SignatureNotCreatedError = _chunkCT2UGJELcjs.o; exports.SignatureNotFoundError = _chunkCT2UGJELcjs.l; exports.SignerTypeMismatchError = _chunkCT2UGJELcjs.h; exports.SigningFailedError = _chunkCT2UGJELcjs.m; exports.SolanaWallet = _chunk64XBD4HKcjs.a; exports.TransactionAwaitingApprovalError = _chunkCT2UGJELcjs.u; exports.TransactionConfirmationTimeoutError = _chunkCT2UGJELcjs.s; exports.TransactionFailedError = _chunkCT2UGJELcjs.w; exports.TransactionHashNotFoundError = _chunkCT2UGJELcjs.v; exports.TransactionNotAvailableError = _chunkCT2UGJELcjs.r; exports.TransactionNotCreatedError = _chunkCT2UGJELcjs.q; exports.TransactionSendingFailedError = _chunkCT2UGJELcjs.t; exports.Wallet = _chunkBTNONXSScjs.a; exports.WalletCreationError = _chunkCT2UGJELcjs.f; exports.WalletFactory = _chunk7LUIRC4Hcjs.a; exports.WalletNotAvailableError = _chunkCT2UGJELcjs.d; exports.WalletTypeMismatchError = _chunkCT2UGJELcjs.g; exports.WalletTypeNotSupportedError = _chunkCT2UGJELcjs.c; exports.createCrossmint = _chunkANTDXLCIcjs.a; exports.toViemChain = _chunk6VJEBYPNcjs.a;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as F}from"./chunk-
|
|
1
|
+
import{a as F}from"./chunk-GLHBNZCD.js";import{a as D}from"./chunk-QYR7IUMS.js";import"./chunk-PJUVPRKB.js";import{a as B,b as C}from"./chunk-FLPUIGTL.js";import{a as A}from"./chunk-NEP3LDXF.js";import{a as y}from"./chunk-2MOAPV7H.js";import"./chunk-SR4HCLCT.js";import"./chunk-TN6YXWPL.js";import"./chunk-XD35GYJQ.js";import"./chunk-KOQPWJBO.js";import"./chunk-LRV4CFS5.js";import"./chunk-JITEEQUZ.js";import"./chunk-PDL3XF5M.js";import"./chunk-OV4CFQ36.js";import"./chunk-77QBSFHG.js";import"./chunk-T3ICQDFS.js";import{a as z}from"./chunk-M4ELAV7U.js";import"./chunk-FUUYGB4K.js";import{a as E}from"./chunk-BJDS5BJG.js";import"./chunk-KKQBZXFE.js";import"./chunk-S3DYQVRD.js";import"./chunk-5IFDVB4Y.js";import"./chunk-H3EPTRZ2.js";import"./chunk-GAURTX2I.js";import{a as o,b as r,c as e,d as f,e as m,f as p,g as t,h as x,i as a,j as b,k as c,l as d,m as g,n as h,o as i,p as j,q as k,r as l,s as n,t as q,u as s,v as u,w as v,x as w}from"./chunk-7ENJXL4H.js";import"./chunk-KBJA7JDT.js";import"./chunk-2KK65AC6.js";import"./chunk-QTSZSHKK.js";import"./chunk-BW7YYVZE.js";export{z as AuthRejectedError,C as CrossmintWallets,F as EVMWallet,o as InvalidApiKeyError,r as InvalidEnvironmentError,b as InvalidMessageFormatError,a as InvalidSignerError,c as InvalidTypedDataError,m as InvalidWalletConfigError,h as MessageSigningNotSupportedError,w as PendingApprovalsError,j as SignatureNotAvailableError,i as SignatureNotCreatedError,d as SignatureNotFoundError,x as SignerTypeMismatchError,g as SigningFailedError,D as SolanaWallet,s as TransactionAwaitingApprovalError,n as TransactionConfirmationTimeoutError,v as TransactionFailedError,u as TransactionHashNotFoundError,l as TransactionNotAvailableError,k as TransactionNotCreatedError,q as TransactionSendingFailedError,y as Wallet,p as WalletCreationError,A as WalletFactory,f as WalletNotAvailableError,t as WalletTypeMismatchError,e as WalletTypeNotSupportedError,B as createCrossmint,E as toViemChain};
|
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 _chunkANTDXLCIcjs = require('./chunk-ANTDXLCI.cjs');require('./chunk-7LUIRC4H.cjs');require('./chunk-BTNONXSS.cjs');require('./chunk-4UVO2GRG.cjs');require('./chunk-VMEGMTOD.cjs');require('./chunk-Q5BKSVUU.cjs');require('./chunk-BNLX7HKW.cjs');require('./chunk-NHIZ4TEB.cjs');require('./chunk-UUR6LK3H.cjs');require('./chunk-ZWDS66FS.cjs');require('./chunk-DYRSQN7X.cjs');require('./chunk-NVJN7LPY.cjs');require('./chunk-AFYBD7FI.cjs');require('./chunk-ZSWIQU3U.cjs');require('./chunk-RD5PG4M6.cjs');require('./chunk-6HXIZLEQ.cjs');require('./chunk-BIDVRITM.cjs');require('./chunk-WM3HHCBW.cjs');require('./chunk-CT2UGJEL.cjs');require('./chunk-ECAM5KTH.cjs');require('./chunk-YO6BJ2DI.cjs');require('./chunk-DIZVZP5P.cjs');require('./chunk-XALFCQKD.cjs');exports.CrossmintWallets = _chunkANTDXLCIcjs.b; exports.createCrossmint = _chunkANTDXLCIcjs.a;
|
package/dist/sdk.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b}from"./chunk-
|
|
1
|
+
import{a,b}from"./chunk-FLPUIGTL.js";import"./chunk-NEP3LDXF.js";import"./chunk-2MOAPV7H.js";import"./chunk-SR4HCLCT.js";import"./chunk-TN6YXWPL.js";import"./chunk-XD35GYJQ.js";import"./chunk-KOQPWJBO.js";import"./chunk-LRV4CFS5.js";import"./chunk-JITEEQUZ.js";import"./chunk-PDL3XF5M.js";import"./chunk-OV4CFQ36.js";import"./chunk-77QBSFHG.js";import"./chunk-T3ICQDFS.js";import"./chunk-M4ELAV7U.js";import"./chunk-FUUYGB4K.js";import"./chunk-5IFDVB4Y.js";import"./chunk-H3EPTRZ2.js";import"./chunk-GAURTX2I.js";import"./chunk-7ENJXL4H.js";import"./chunk-KBJA7JDT.js";import"./chunk-2KK65AC6.js";import"./chunk-QTSZSHKK.js";import"./chunk-BW7YYVZE.js";export{b as CrossmintWallets,a as createCrossmint};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkNHIZ4TEBcjs = require('../../chunk-NHIZ4TEB.cjs');require('../../chunk-WM3HHCBW.cjs');require('../../chunk-CT2UGJEL.cjs');require('../../chunk-XALFCQKD.cjs');exports.EmailSignerApiClient = _chunkNHIZ4TEBcjs.a;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as _crossmint_common_sdk_base from '@crossmint/common-sdk-base';
|
|
2
2
|
import { CrossmintApiClient, Crossmint } from '@crossmint/common-sdk-base';
|
|
3
|
+
import { KeyType } from '@crossmint/client-signers';
|
|
3
4
|
|
|
4
5
|
declare class EmailSignerApiClient extends CrossmintApiClient {
|
|
5
6
|
private apiPrefix;
|
|
6
7
|
constructor(crossmint: Crossmint);
|
|
7
|
-
pregenerateSigner(email: string): Promise<any>;
|
|
8
|
+
pregenerateSigner(email: string, keyType: KeyType): Promise<any>;
|
|
8
9
|
get isServerSide(): boolean;
|
|
9
10
|
get environment(): _crossmint_common_sdk_base.APIKeyEnvironmentPrefix;
|
|
10
11
|
private get headers();
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as _crossmint_common_sdk_base from '@crossmint/common-sdk-base';
|
|
2
2
|
import { CrossmintApiClient, Crossmint } from '@crossmint/common-sdk-base';
|
|
3
|
+
import { KeyType } from '@crossmint/client-signers';
|
|
3
4
|
|
|
4
5
|
declare class EmailSignerApiClient extends CrossmintApiClient {
|
|
5
6
|
private apiPrefix;
|
|
6
7
|
constructor(crossmint: Crossmint);
|
|
7
|
-
pregenerateSigner(email: string): Promise<any>;
|
|
8
|
+
pregenerateSigner(email: string, keyType: KeyType): Promise<any>;
|
|
8
9
|
get isServerSide(): boolean;
|
|
9
10
|
get environment(): _crossmint_common_sdk_base.APIKeyEnvironmentPrefix;
|
|
10
11
|
private get headers();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-LRV4CFS5.js";import"../../chunk-GAURTX2I.js";import"../../chunk-7ENJXL4H.js";import"../../chunk-BW7YYVZE.js";export{a as EmailSignerApiClient};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkUUR6LK3Hcjs = require('../../chunk-UUR6LK3H.cjs');require('../../chunk-ZWDS66FS.cjs');require('../../chunk-ZSWIQU3U.cjs');require('../../chunk-XALFCQKD.cjs');exports.DEFAULT_EVENT_OPTIONS = _chunkUUR6LK3Hcjs.b; exports.EmailSigner = _chunkUUR6LK3Hcjs.a;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Signer, EmailInternalSignerConfig } from '../types.cjs';
|
|
2
|
+
import 'ox';
|
|
3
|
+
import '@crossmint/client-sdk-window';
|
|
4
|
+
import '@crossmint/client-signers';
|
|
5
|
+
import '@crossmint/common-sdk-base';
|
|
6
|
+
import '../../chains/chains.cjs';
|
|
7
|
+
import 'viem';
|
|
8
|
+
|
|
9
|
+
declare abstract class EmailSigner implements Signer {
|
|
10
|
+
protected config: EmailInternalSignerConfig;
|
|
11
|
+
type: "email";
|
|
12
|
+
private _needsAuth;
|
|
13
|
+
private _authPromise;
|
|
14
|
+
constructor(config: EmailInternalSignerConfig);
|
|
15
|
+
abstract locator(): string;
|
|
16
|
+
private initialize;
|
|
17
|
+
signMessage(): Promise<never>;
|
|
18
|
+
abstract signTransaction(transaction: string): Promise<{
|
|
19
|
+
signature: string;
|
|
20
|
+
}>;
|
|
21
|
+
protected handleAuthRequired(): Promise<void>;
|
|
22
|
+
protected getJwtOrThrow(): string;
|
|
23
|
+
private createAuthPromise;
|
|
24
|
+
private sendEmailWithOtp;
|
|
25
|
+
private verifyOtp;
|
|
26
|
+
}
|
|
27
|
+
declare const DEFAULT_EVENT_OPTIONS: {
|
|
28
|
+
timeoutMs: number;
|
|
29
|
+
intervalMs: number;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { DEFAULT_EVENT_OPTIONS, EmailSigner };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Signer, EmailInternalSignerConfig } from '../types.js';
|
|
2
|
+
import 'ox';
|
|
3
|
+
import '@crossmint/client-sdk-window';
|
|
4
|
+
import '@crossmint/client-signers';
|
|
5
|
+
import '@crossmint/common-sdk-base';
|
|
6
|
+
import '../../chains/chains.js';
|
|
7
|
+
import 'viem';
|
|
8
|
+
|
|
9
|
+
declare abstract class EmailSigner implements Signer {
|
|
10
|
+
protected config: EmailInternalSignerConfig;
|
|
11
|
+
type: "email";
|
|
12
|
+
private _needsAuth;
|
|
13
|
+
private _authPromise;
|
|
14
|
+
constructor(config: EmailInternalSignerConfig);
|
|
15
|
+
abstract locator(): string;
|
|
16
|
+
private initialize;
|
|
17
|
+
signMessage(): Promise<never>;
|
|
18
|
+
abstract signTransaction(transaction: string): Promise<{
|
|
19
|
+
signature: string;
|
|
20
|
+
}>;
|
|
21
|
+
protected handleAuthRequired(): Promise<void>;
|
|
22
|
+
protected getJwtOrThrow(): string;
|
|
23
|
+
private createAuthPromise;
|
|
24
|
+
private sendEmailWithOtp;
|
|
25
|
+
private verifyOtp;
|
|
26
|
+
}
|
|
27
|
+
declare const DEFAULT_EVENT_OPTIONS: {
|
|
28
|
+
timeoutMs: number;
|
|
29
|
+
intervalMs: number;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { DEFAULT_EVENT_OPTIONS, EmailSigner };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b}from"../../chunk-JITEEQUZ.js";import"../../chunk-PDL3XF5M.js";import"../../chunk-M4ELAV7U.js";import"../../chunk-BW7YYVZE.js";export{b as DEFAULT_EVENT_OPTIONS,a as EmailSigner};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBNLX7HKWcjs = require('../../chunk-BNLX7HKW.cjs');require('../../chunk-NHIZ4TEB.cjs');require('../../chunk-UUR6LK3H.cjs');require('../../chunk-ZWDS66FS.cjs');require('../../chunk-ZSWIQU3U.cjs');require('../../chunk-WM3HHCBW.cjs');require('../../chunk-CT2UGJEL.cjs');require('../../chunk-XALFCQKD.cjs');exports.EvmEmailSigner = _chunkBNLX7HKWcjs.a;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { EmailInternalSignerConfig } from '../types.cjs';
|
|
2
|
+
import { EmailSigner } from './email-signer.cjs';
|
|
3
|
+
import { Crossmint } from '@crossmint/common-sdk-base';
|
|
4
|
+
import 'ox';
|
|
5
|
+
import '@crossmint/client-sdk-window';
|
|
6
|
+
import '@crossmint/client-signers';
|
|
7
|
+
import '../../chains/chains.cjs';
|
|
8
|
+
import 'viem';
|
|
9
|
+
|
|
10
|
+
declare class EvmEmailSigner extends EmailSigner {
|
|
11
|
+
constructor(config: EmailInternalSignerConfig);
|
|
12
|
+
locator(): string;
|
|
13
|
+
signMessage(): Promise<never>;
|
|
14
|
+
signTransaction(transaction: string): Promise<{
|
|
15
|
+
signature: string;
|
|
16
|
+
}>;
|
|
17
|
+
static pregenerateSigner(email: string, crossmint: Crossmint): Promise<string>;
|
|
18
|
+
static verifyPublicKeyFormat(publicKey: {
|
|
19
|
+
encoding: string;
|
|
20
|
+
keyType: string;
|
|
21
|
+
bytes: string;
|
|
22
|
+
} | null): void;
|
|
23
|
+
private static publicKeyToEvmAddress;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { EvmEmailSigner };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { EmailInternalSignerConfig } from '../types.js';
|
|
2
|
+
import { EmailSigner } from './email-signer.js';
|
|
3
|
+
import { Crossmint } from '@crossmint/common-sdk-base';
|
|
4
|
+
import 'ox';
|
|
5
|
+
import '@crossmint/client-sdk-window';
|
|
6
|
+
import '@crossmint/client-signers';
|
|
7
|
+
import '../../chains/chains.js';
|
|
8
|
+
import 'viem';
|
|
9
|
+
|
|
10
|
+
declare class EvmEmailSigner extends EmailSigner {
|
|
11
|
+
constructor(config: EmailInternalSignerConfig);
|
|
12
|
+
locator(): string;
|
|
13
|
+
signMessage(): Promise<never>;
|
|
14
|
+
signTransaction(transaction: string): Promise<{
|
|
15
|
+
signature: string;
|
|
16
|
+
}>;
|
|
17
|
+
static pregenerateSigner(email: string, crossmint: Crossmint): Promise<string>;
|
|
18
|
+
static verifyPublicKeyFormat(publicKey: {
|
|
19
|
+
encoding: string;
|
|
20
|
+
keyType: string;
|
|
21
|
+
bytes: string;
|
|
22
|
+
} | null): void;
|
|
23
|
+
private static publicKeyToEvmAddress;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { EvmEmailSigner };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"../../chunk-KOQPWJBO.js";import"../../chunk-LRV4CFS5.js";import"../../chunk-JITEEQUZ.js";import"../../chunk-PDL3XF5M.js";import"../../chunk-M4ELAV7U.js";import"../../chunk-GAURTX2I.js";import"../../chunk-7ENJXL4H.js";import"../../chunk-BW7YYVZE.js";export{a as EvmEmailSigner};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../../chunk-
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../../chunk-VMEGMTOD.cjs');var _chunkQ5BKSVUUcjs = require('../../chunk-Q5BKSVUU.cjs');var _chunkBNLX7HKWcjs = require('../../chunk-BNLX7HKW.cjs');require('../../chunk-NHIZ4TEB.cjs');var _chunkUUR6LK3Hcjs = require('../../chunk-UUR6LK3H.cjs');require('../../chunk-ZWDS66FS.cjs');require('../../chunk-ZSWIQU3U.cjs');require('../../chunk-WM3HHCBW.cjs');require('../../chunk-CT2UGJEL.cjs');require('../../chunk-XALFCQKD.cjs');exports.DEFAULT_EVENT_OPTIONS = _chunkUUR6LK3Hcjs.b; exports.EmailSigner = _chunkUUR6LK3Hcjs.a; exports.EvmEmailSigner = _chunkBNLX7HKWcjs.a; exports.SolanaEmailSigner = _chunkQ5BKSVUUcjs.a;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export { EmailSigner } from './email.cjs';
|
|
1
|
+
export { DEFAULT_EVENT_OPTIONS, EmailSigner } from './email-signer.cjs';
|
|
2
|
+
export { SolanaEmailSigner } from './solana-email-signer.cjs';
|
|
3
|
+
export { EvmEmailSigner } from './evm-email-signer.cjs';
|
|
2
4
|
import '../types.cjs';
|
|
3
5
|
import 'ox';
|
|
4
6
|
import '@crossmint/client-sdk-window';
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export { EmailSigner } from './email.js';
|
|
1
|
+
export { DEFAULT_EVENT_OPTIONS, EmailSigner } from './email-signer.js';
|
|
2
|
+
export { SolanaEmailSigner } from './solana-email-signer.js';
|
|
3
|
+
export { EvmEmailSigner } from './evm-email-signer.js';
|
|
2
4
|
import '../types.js';
|
|
3
5
|
import 'ox';
|
|
4
6
|
import '@crossmint/client-sdk-window';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../chunk-
|
|
1
|
+
import"../../chunk-TN6YXWPL.js";import{a as c}from"../../chunk-XD35GYJQ.js";import{a as d}from"../../chunk-KOQPWJBO.js";import"../../chunk-LRV4CFS5.js";import{a,b}from"../../chunk-JITEEQUZ.js";import"../../chunk-PDL3XF5M.js";import"../../chunk-M4ELAV7U.js";import"../../chunk-GAURTX2I.js";import"../../chunk-7ENJXL4H.js";import"../../chunk-BW7YYVZE.js";export{b as DEFAULT_EVENT_OPTIONS,a as EmailSigner,d as EvmEmailSigner,c as SolanaEmailSigner};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkQ5BKSVUUcjs = require('../../chunk-Q5BKSVUU.cjs');require('../../chunk-NHIZ4TEB.cjs');require('../../chunk-UUR6LK3H.cjs');require('../../chunk-ZWDS66FS.cjs');require('../../chunk-ZSWIQU3U.cjs');require('../../chunk-WM3HHCBW.cjs');require('../../chunk-CT2UGJEL.cjs');require('../../chunk-XALFCQKD.cjs');exports.SolanaEmailSigner = _chunkQ5BKSVUUcjs.a;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EmailInternalSignerConfig } from '../types.cjs';
|
|
2
|
+
import { EmailSigner } from './email-signer.cjs';
|
|
2
3
|
import { Crossmint } from '@crossmint/common-sdk-base';
|
|
3
4
|
import 'ox';
|
|
4
5
|
import '@crossmint/client-sdk-window';
|
|
@@ -6,23 +7,19 @@ import '@crossmint/client-signers';
|
|
|
6
7
|
import '../../chains/chains.cjs';
|
|
7
8
|
import 'viem';
|
|
8
9
|
|
|
9
|
-
declare class
|
|
10
|
-
private config;
|
|
11
|
-
type: "email";
|
|
12
|
-
private _needsAuth;
|
|
13
|
-
private _authPromise;
|
|
10
|
+
declare class SolanaEmailSigner extends EmailSigner {
|
|
14
11
|
constructor(config: EmailInternalSignerConfig);
|
|
15
12
|
locator(): string;
|
|
16
|
-
private initialize;
|
|
17
13
|
signMessage(): Promise<never>;
|
|
18
14
|
signTransaction(transaction: string): Promise<{
|
|
19
15
|
signature: string;
|
|
20
16
|
}>;
|
|
21
|
-
private handleAuthRequired;
|
|
22
|
-
private createAuthPromise;
|
|
23
|
-
private sendEmailWithOtp;
|
|
24
|
-
private verifyOtp;
|
|
25
17
|
static pregenerateSigner(email: string, crossmint: Crossmint): Promise<string>;
|
|
18
|
+
static verifyPublicKeyFormat(publicKey: {
|
|
19
|
+
encoding: string;
|
|
20
|
+
keyType: string;
|
|
21
|
+
bytes: string;
|
|
22
|
+
} | null): void;
|
|
26
23
|
}
|
|
27
24
|
|
|
28
|
-
export {
|
|
25
|
+
export { SolanaEmailSigner };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EmailInternalSignerConfig } from '../types.js';
|
|
2
|
+
import { EmailSigner } from './email-signer.js';
|
|
2
3
|
import { Crossmint } from '@crossmint/common-sdk-base';
|
|
3
4
|
import 'ox';
|
|
4
5
|
import '@crossmint/client-sdk-window';
|
|
@@ -6,23 +7,19 @@ import '@crossmint/client-signers';
|
|
|
6
7
|
import '../../chains/chains.js';
|
|
7
8
|
import 'viem';
|
|
8
9
|
|
|
9
|
-
declare class
|
|
10
|
-
private config;
|
|
11
|
-
type: "email";
|
|
12
|
-
private _needsAuth;
|
|
13
|
-
private _authPromise;
|
|
10
|
+
declare class SolanaEmailSigner extends EmailSigner {
|
|
14
11
|
constructor(config: EmailInternalSignerConfig);
|
|
15
12
|
locator(): string;
|
|
16
|
-
private initialize;
|
|
17
13
|
signMessage(): Promise<never>;
|
|
18
14
|
signTransaction(transaction: string): Promise<{
|
|
19
15
|
signature: string;
|
|
20
16
|
}>;
|
|
21
|
-
private handleAuthRequired;
|
|
22
|
-
private createAuthPromise;
|
|
23
|
-
private sendEmailWithOtp;
|
|
24
|
-
private verifyOtp;
|
|
25
17
|
static pregenerateSigner(email: string, crossmint: Crossmint): Promise<string>;
|
|
18
|
+
static verifyPublicKeyFormat(publicKey: {
|
|
19
|
+
encoding: string;
|
|
20
|
+
keyType: string;
|
|
21
|
+
bytes: string;
|
|
22
|
+
} | null): void;
|
|
26
23
|
}
|
|
27
24
|
|
|
28
|
-
export {
|
|
25
|
+
export { SolanaEmailSigner };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"../../chunk-XD35GYJQ.js";import"../../chunk-LRV4CFS5.js";import"../../chunk-JITEEQUZ.js";import"../../chunk-PDL3XF5M.js";import"../../chunk-M4ELAV7U.js";import"../../chunk-GAURTX2I.js";import"../../chunk-7ENJXL4H.js";import"../../chunk-BW7YYVZE.js";export{a as SolanaEmailSigner};
|
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 _chunk4UVO2GRGcjs = require('../chunk-4UVO2GRG.cjs');require('../chunk-VMEGMTOD.cjs');require('../chunk-Q5BKSVUU.cjs');require('../chunk-BNLX7HKW.cjs');require('../chunk-NHIZ4TEB.cjs');require('../chunk-UUR6LK3H.cjs');require('../chunk-ZWDS66FS.cjs');require('../chunk-DYRSQN7X.cjs');require('../chunk-NVJN7LPY.cjs');require('../chunk-AFYBD7FI.cjs');require('../chunk-ZSWIQU3U.cjs');require('../chunk-WM3HHCBW.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-YO6BJ2DI.cjs');require('../chunk-DIZVZP5P.cjs');require('../chunk-XALFCQKD.cjs');exports.assembleSigner = _chunk4UVO2GRGcjs.a;
|
package/dist/signers/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-SR4HCLCT.js";import"../chunk-TN6YXWPL.js";import"../chunk-XD35GYJQ.js";import"../chunk-KOQPWJBO.js";import"../chunk-LRV4CFS5.js";import"../chunk-JITEEQUZ.js";import"../chunk-PDL3XF5M.js";import"../chunk-OV4CFQ36.js";import"../chunk-77QBSFHG.js";import"../chunk-T3ICQDFS.js";import"../chunk-M4ELAV7U.js";import"../chunk-GAURTX2I.js";import"../chunk-7ENJXL4H.js";import"../chunk-2KK65AC6.js";import"../chunk-QTSZSHKK.js";import"../chunk-BW7YYVZE.js";export{a as assembleSigner};
|
package/dist/utils/constants.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkWM3HHCBWcjs = require('../chunk-WM3HHCBW.cjs');require('../chunk-XALFCQKD.cjs');exports.SDK_NAME = _chunkWM3HHCBWcjs.c; exports.SDK_VERSION = _chunkWM3HHCBWcjs.b; exports.STATUS_POLLING_INTERVAL_MS = _chunkWM3HHCBWcjs.d; exports.WALLETS_SERVICE = _chunkWM3HHCBWcjs.a;
|
package/dist/utils/constants.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d}from"../chunk-
|
|
1
|
+
import{a,b,c,d}from"../chunk-GAURTX2I.js";import"../chunk-BW7YYVZE.js";export{c as SDK_NAME,b as SDK_VERSION,d as STATUS_POLLING_INTERVAL_MS,a as WALLETS_SERVICE};
|
package/dist/wallets/evm.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkVNSDVH74cjs = require('../chunk-VNSDVH74.cjs');require('../chunk-BTNONXSS.cjs');require('../chunk-6VJEBYPN.cjs');require('../chunk-IR5WN6FQ.cjs');require('../chunk-GEY574TH.cjs');require('../chunk-WM3HHCBW.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-XALFCQKD.cjs');exports.EVMWallet = _chunkVNSDVH74cjs.a;
|
package/dist/wallets/evm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-GLHBNZCD.js";import"../chunk-2MOAPV7H.js";import"../chunk-BJDS5BJG.js";import"../chunk-KKQBZXFE.js";import"../chunk-S3DYQVRD.js";import"../chunk-GAURTX2I.js";import"../chunk-7ENJXL4H.js";import"../chunk-BW7YYVZE.js";export{a as EVMWallet};
|
package/dist/wallets/solana.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk64XBD4HKcjs = require('../chunk-64XBD4HK.cjs');require('../chunk-BTNONXSS.cjs');require('../chunk-AFYBD7FI.cjs');require('../chunk-WM3HHCBW.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-XALFCQKD.cjs');exports.SolanaWallet = _chunk64XBD4HKcjs.a;
|
package/dist/wallets/solana.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-QYR7IUMS.js";import"../chunk-2MOAPV7H.js";import"../chunk-T3ICQDFS.js";import"../chunk-GAURTX2I.js";import"../chunk-7ENJXL4H.js";import"../chunk-BW7YYVZE.js";export{a as SolanaWallet};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk7LUIRC4Hcjs = require('../chunk-7LUIRC4H.cjs');require('../chunk-BTNONXSS.cjs');require('../chunk-4UVO2GRG.cjs');require('../chunk-VMEGMTOD.cjs');require('../chunk-Q5BKSVUU.cjs');require('../chunk-BNLX7HKW.cjs');require('../chunk-NHIZ4TEB.cjs');require('../chunk-UUR6LK3H.cjs');require('../chunk-ZWDS66FS.cjs');require('../chunk-DYRSQN7X.cjs');require('../chunk-NVJN7LPY.cjs');require('../chunk-AFYBD7FI.cjs');require('../chunk-ZSWIQU3U.cjs');require('../chunk-RD5PG4M6.cjs');require('../chunk-WM3HHCBW.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-YO6BJ2DI.cjs');require('../chunk-DIZVZP5P.cjs');require('../chunk-XALFCQKD.cjs');exports.WalletFactory = _chunk7LUIRC4Hcjs.a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-NEP3LDXF.js";import"../chunk-2MOAPV7H.js";import"../chunk-SR4HCLCT.js";import"../chunk-TN6YXWPL.js";import"../chunk-XD35GYJQ.js";import"../chunk-KOQPWJBO.js";import"../chunk-LRV4CFS5.js";import"../chunk-JITEEQUZ.js";import"../chunk-PDL3XF5M.js";import"../chunk-OV4CFQ36.js";import"../chunk-77QBSFHG.js";import"../chunk-T3ICQDFS.js";import"../chunk-M4ELAV7U.js";import"../chunk-FUUYGB4K.js";import"../chunk-GAURTX2I.js";import"../chunk-7ENJXL4H.js";import"../chunk-2KK65AC6.js";import"../chunk-QTSZSHKK.js";import"../chunk-BW7YYVZE.js";export{a as WalletFactory};
|
package/dist/wallets/wallet.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBTNONXSScjs = require('../chunk-BTNONXSS.cjs');require('../chunk-WM3HHCBW.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-XALFCQKD.cjs');exports.Wallet = _chunkBTNONXSScjs.a;
|
package/dist/wallets/wallet.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-2MOAPV7H.js";import"../chunk-GAURTX2I.js";import"../chunk-7ENJXL4H.js";import"../chunk-BW7YYVZE.js";export{a as Wallet};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crossmint/wallets-sdk",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.6",
|
|
4
4
|
"repository": "https://github.com/Crossmint/crossmint-sdk",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Paella Labs Inc",
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"tweetnacl": "1.0.3",
|
|
26
26
|
"viem": "2.23.6",
|
|
27
27
|
"@crossmint/common-sdk-base": "0.8.1",
|
|
28
|
-
"@crossmint/
|
|
28
|
+
"@crossmint/common-sdk-auth": "1.0.38",
|
|
29
29
|
"@crossmint/client-sdk-window": "1.0.0",
|
|
30
|
-
"@crossmint/
|
|
30
|
+
"@crossmint/client-signers": "0.0.18"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@hey-api/openapi-ts": "0.69.2",
|
package/dist/chunk-5PQGSQCD.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as i,c as s}from"./chunk-FPSS2IYY.js";import{a as n}from"./chunk-7ENJXL4H.js";import{f as t}from"./chunk-BW7YYVZE.js";import{APIKeyUsageOrigin as p,CrossmintApiClient as d}from"@crossmint/common-sdk-base";var a=class extends d{constructor(e){super(e,{internalConfig:{sdkMetadata:{name:s,version:i}}});this.apiPrefix="api/v1/signers"}pregenerateSigner(e){return t(this,null,function*(){let r=yield this.post(`${this.apiPrefix}/derive-public-key`,{body:JSON.stringify({authId:`email:${e}`,keyType:"ed25519"}),headers:this.headers});if(!r.ok){let o=yield r.text();throw new Error(`Failed to fetch public key: ${r.status} ${o}`)}return yield r.json()})}get isServerSide(){return this.parsedAPIKey.usageOrigin===p.SERVER}get environment(){if(!this.parsedAPIKey.isValid)throw new n("Invalid API key");return this.parsedAPIKey.environment}get headers(){return{"Content-Type":"application/json"}}};export{a};
|
package/dist/chunk-64EPPE7R.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkO6MMAZY7cjs = require('./chunk-O6MMAZY7.cjs');var _chunkTVZORU22cjs = require('./chunk-TVZORU22.cjs');var _chunkUO6UBZQ7cjs = require('./chunk-UO6UBZQ7.cjs');var _chunkRD5PG4M6cjs = require('./chunk-RD5PG4M6.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _ox = require('ox');var f=class{constructor(e){this.apiClient=e}getOrCreateWallet(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(this.apiClient.isServerSide)throw new (0, _chunkCT2UGJELcjs.f)("getOrCreateWallet is not supported on server side");let t=yield this.apiClient.getWallet(`me:${e.chain==="solana"?"solana-smart-wallet":"evm-smart-wallet"}`);return t&&!("error"in t)?(yield this.validateWalletConfig(t,e),this.createWalletInstance(t,e)):this.createWallet(e)})}getWallet(e,t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(!this.apiClient.isServerSide)throw new (0, _chunkCT2UGJELcjs.f)("getWallet is not supported on client side, use getOrCreateWallet instead");let i=yield this.apiClient.getWallet(e);if("error"in i)throw new (0, _chunkCT2UGJELcjs.d)(JSON.stringify(i));return this.createWalletInstance(i,t)})}createWallet(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var a,n,o,l,p;yield(o=(n=(a=e.options)==null?void 0:a.experimental_callbacks)==null?void 0:n.onWalletCreationStart)==null?void 0:o.call(n);let t;e.chain==="solana"?t={type:"solana-smart-wallet",config:{adminSigner:yield this.configureSigner(e.chain,e.signer)},linkedUser:(l=e.owner)!=null?l:void 0}:t={type:"evm-smart-wallet",config:{adminSigner:yield this.configureSigner(e.chain,e.signer)},linkedUser:(p=e.owner)!=null?p:void 0};let i=yield this.apiClient.createWallet(t);if("error"in i)throw new (0, _chunkCT2UGJELcjs.f)(JSON.stringify(i));return this.createWalletInstance(i,e)})}createWalletInstance(e,t){let i=this.toInternalSignerConfig(e,t.signer);return new (0, _chunkO6MMAZY7cjs.a)({chain:t.chain,address:e.address,signer:_chunkTVZORU22cjs.a.call(void 0, t.chain,i),options:t.options},this.apiClient)}toInternalSignerConfig(e,t){var i,a;if(t==null)throw new (0, _chunkCT2UGJELcjs.f)("Signer is required to create a wallet");switch(t.type){case"api-key":{let n;switch(e.type){case"solana-smart-wallet":n=e.config.adminSigner.address;break;case"evm-smart-wallet":e.config.adminSigner.type==="evm-fireblocks-custodial"&&(n=e.config.adminSigner.address);break}if(n==null)throw new (0, _chunkCT2UGJELcjs.f)("Wallet signer 'api-key' has no address");return{type:"api-key",address:n}}case"external-wallet":return t;case"passkey":if(e.type==="evm-smart-wallet"&&e.config.adminSigner.type==="evm-passkey")return{type:"passkey",id:e.config.adminSigner.id,name:e.config.adminSigner.name,onCreatePasskey:t.onCreatePasskey,onSignWithPasskey:t.onSignWithPasskey};throw new (0, _chunkCT2UGJELcjs.f)("Passkey signer is not supported for this wallet type");case"email":{if(e.type!=="solana-smart-wallet"||e.config.adminSigner.type!=="solana-keypair")throw new (0, _chunkCT2UGJELcjs.f)("Wallet signer 'email' has no address");let n=e.config.adminSigner.address;return{type:"email",email:(a=t.email)!=null?a:(i=this.apiClient.crossmint.experimental_customAuth)==null?void 0:i.email,signerAddress:n,crossmint:this.apiClient.crossmint,onAuthRequired:t.onAuthRequired,_handshakeParent:t._handshakeParent}}default:throw new Error("Invalid signer type")}}configureSigner(e,t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var i;if((t==null?void 0:t.type)==="passkey"){let a=(i=t.name)!=null?i:`Crossmint Wallet ${Date.now()}`,n=t.onCreatePasskey?yield t.onCreatePasskey(a):yield _ox.WebAuthnP256.createCredential({name:a});return{type:"evm-passkey",id:n.id,name:a,publicKey:{x:n.publicKey.x.toString(),y:n.publicKey.y.toString()}}}return yield this.toExternalSignerConfig(e,t)})}toExternalSignerConfig(e,t,i){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var a,n;if(!t||t.type==="api-key")return{type:e==="solana"?"solana-fireblocks-custodial":"evm-fireblocks-custodial"};if(t.type==="external-wallet")return{type:e==="solana"?"solana-keypair":"evm-keypair",address:t.address};if(t.type==="passkey"&&i!=null){if((i==null?void 0:i.type)!=="evm-smart-wallet"||i.config.adminSigner.type!=="evm-passkey")throw new (0, _chunkCT2UGJELcjs.f)("Passkey signer is not supported for this wallet type");return{type:"evm-passkey",id:i.config.adminSigner.id,name:i.config.adminSigner.name,publicKey:{x:i.config.adminSigner.publicKey.x,y:i.config.adminSigner.publicKey.y}}}if(t.type==="email"){let o=(n=t.email)!=null?n:(a=this.apiClient.crossmint.experimental_customAuth)==null?void 0:a.email;if(o==null)throw new Error("Email is required to create a wallet with email signer");if(e!=="solana")throw new Error("Email signer is only supported for Solana wallets");return{type:"solana-keypair",address:yield _chunkUO6UBZQ7cjs.a.pregenerateSigner(o,this.apiClient.crossmint)}}throw new Error("Invalid signer type")})}validateWalletConfig(e,t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(t.owner!=null&&e.linkedUser!=null&&t.owner!==e.linkedUser)throw new (0, _chunkCT2UGJELcjs.f)("Wallet owner does not match existing wallet's linked user");if(e.type!=="solana-smart-wallet"&&e.type!=="evm-smart-wallet")return;let i=yield this.toExternalSignerConfig(t.chain,t.signer,e),a=e.config.adminSigner;if(i&&a){if(i.type!==a.type)throw new (0, _chunkCT2UGJELcjs.f)("The wallet signer type provided in the wallet config does not match the existing wallet's adminSigner type");_chunkRD5PG4M6cjs.a.call(void 0, i,a)}})}};exports.a = f;
|
package/dist/chunk-FPSS2IYY.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var s="@crossmint/wallets-sdk",t="0.10.5";var c="WALLETS_SDK",r=t,d=s,a=500;export{c as a,r as b,d as c,a as d};
|
package/dist/chunk-HDAM24ZL.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as d}from"./chunk-3JTT2XLZ.js";import{a as y}from"./chunk-NOOBYBKD.js";import{a as m}from"./chunk-YKPKNCFG.js";import{a as C}from"./chunk-FUUYGB4K.js";import{d as c,f as r}from"./chunk-7ENJXL4H.js";import{f as s}from"./chunk-BW7YYVZE.js";import{WebAuthnP256 as h}from"ox";var f=class{constructor(e){this.apiClient=e}getOrCreateWallet(e){return s(this,null,function*(){if(this.apiClient.isServerSide)throw new r("getOrCreateWallet is not supported on server side");let t=yield this.apiClient.getWallet(`me:${e.chain==="solana"?"solana-smart-wallet":"evm-smart-wallet"}`);return t&&!("error"in t)?(yield this.validateWalletConfig(t,e),this.createWalletInstance(t,e)):this.createWallet(e)})}getWallet(e,t){return s(this,null,function*(){if(!this.apiClient.isServerSide)throw new r("getWallet is not supported on client side, use getOrCreateWallet instead");let i=yield this.apiClient.getWallet(e);if("error"in i)throw new c(JSON.stringify(i));return this.createWalletInstance(i,t)})}createWallet(e){return s(this,null,function*(){var a,n,o,l,p;yield(o=(n=(a=e.options)==null?void 0:a.experimental_callbacks)==null?void 0:n.onWalletCreationStart)==null?void 0:o.call(n);let t;e.chain==="solana"?t={type:"solana-smart-wallet",config:{adminSigner:yield this.configureSigner(e.chain,e.signer)},linkedUser:(l=e.owner)!=null?l:void 0}:t={type:"evm-smart-wallet",config:{adminSigner:yield this.configureSigner(e.chain,e.signer)},linkedUser:(p=e.owner)!=null?p:void 0};let i=yield this.apiClient.createWallet(t);if("error"in i)throw new r(JSON.stringify(i));return this.createWalletInstance(i,e)})}createWalletInstance(e,t){let i=this.toInternalSignerConfig(e,t.signer);return new d({chain:t.chain,address:e.address,signer:y(t.chain,i),options:t.options},this.apiClient)}toInternalSignerConfig(e,t){var i,a;if(t==null)throw new r("Signer is required to create a wallet");switch(t.type){case"api-key":{let n;switch(e.type){case"solana-smart-wallet":n=e.config.adminSigner.address;break;case"evm-smart-wallet":e.config.adminSigner.type==="evm-fireblocks-custodial"&&(n=e.config.adminSigner.address);break}if(n==null)throw new r("Wallet signer 'api-key' has no address");return{type:"api-key",address:n}}case"external-wallet":return t;case"passkey":if(e.type==="evm-smart-wallet"&&e.config.adminSigner.type==="evm-passkey")return{type:"passkey",id:e.config.adminSigner.id,name:e.config.adminSigner.name,onCreatePasskey:t.onCreatePasskey,onSignWithPasskey:t.onSignWithPasskey};throw new r("Passkey signer is not supported for this wallet type");case"email":{if(e.type!=="solana-smart-wallet"||e.config.adminSigner.type!=="solana-keypair")throw new r("Wallet signer 'email' has no address");let n=e.config.adminSigner.address;return{type:"email",email:(a=t.email)!=null?a:(i=this.apiClient.crossmint.experimental_customAuth)==null?void 0:i.email,signerAddress:n,crossmint:this.apiClient.crossmint,onAuthRequired:t.onAuthRequired,_handshakeParent:t._handshakeParent}}default:throw new Error("Invalid signer type")}}configureSigner(e,t){return s(this,null,function*(){var i;if((t==null?void 0:t.type)==="passkey"){let a=(i=t.name)!=null?i:`Crossmint Wallet ${Date.now()}`,n=t.onCreatePasskey?yield t.onCreatePasskey(a):yield h.createCredential({name:a});return{type:"evm-passkey",id:n.id,name:a,publicKey:{x:n.publicKey.x.toString(),y:n.publicKey.y.toString()}}}return yield this.toExternalSignerConfig(e,t)})}toExternalSignerConfig(e,t,i){return s(this,null,function*(){var a,n;if(!t||t.type==="api-key")return{type:e==="solana"?"solana-fireblocks-custodial":"evm-fireblocks-custodial"};if(t.type==="external-wallet")return{type:e==="solana"?"solana-keypair":"evm-keypair",address:t.address};if(t.type==="passkey"&&i!=null){if((i==null?void 0:i.type)!=="evm-smart-wallet"||i.config.adminSigner.type!=="evm-passkey")throw new r("Passkey signer is not supported for this wallet type");return{type:"evm-passkey",id:i.config.adminSigner.id,name:i.config.adminSigner.name,publicKey:{x:i.config.adminSigner.publicKey.x,y:i.config.adminSigner.publicKey.y}}}if(t.type==="email"){let o=(n=t.email)!=null?n:(a=this.apiClient.crossmint.experimental_customAuth)==null?void 0:a.email;if(o==null)throw new Error("Email is required to create a wallet with email signer");if(e!=="solana")throw new Error("Email signer is only supported for Solana wallets");return{type:"solana-keypair",address:yield m.pregenerateSigner(o,this.apiClient.crossmint)}}throw new Error("Invalid signer type")})}validateWalletConfig(e,t){return s(this,null,function*(){if(t.owner!=null&&e.linkedUser!=null&&t.owner!==e.linkedUser)throw new r("Wallet owner does not match existing wallet's linked user");if(e.type!=="solana-smart-wallet"&&e.type!=="evm-smart-wallet")return;let i=yield this.toExternalSignerConfig(t.chain,t.signer,e),a=e.config.adminSigner;if(i&&a){if(i.type!==a.type)throw new r("The wallet signer type provided in the wallet config does not match the existing wallet's adminSigner type");C(i,a)}})}};export{f as a};
|
package/dist/chunk-NOOBYBKD.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as n}from"./chunk-YKPKNCFG.js";import{a as i}from"./chunk-OV4CFQ36.js";import{a as o}from"./chunk-77QBSFHG.js";import{a}from"./chunk-T3ICQDFS.js";import{a as l}from"./chunk-2KK65AC6.js";import{a as t}from"./chunk-QTSZSHKK.js";function f(r,e){switch(e.type){case"email":return new n(e);case"api-key":return r==="solana"?new o(e):new l(e);case"external-wallet":return r==="solana"?new a(e):new t(e);case"passkey":return new i(e)}}export{f as a};
|
package/dist/chunk-ROO2DTKQ.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkW4MKUPUFcjs = require('./chunk-W4MKUPUF.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var a=class extends _commonsdkbase.CrossmintApiClient{constructor(e){super(e,{internalConfig:{sdkMetadata:{name:_chunkW4MKUPUFcjs.c,version:_chunkW4MKUPUFcjs.b}}});this.apiPrefix="api/v1/signers"}pregenerateSigner(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let r=yield this.post(`${this.apiPrefix}/derive-public-key`,{body:JSON.stringify({authId:`email:${e}`,keyType:"ed25519"}),headers:this.headers});if(!r.ok){let o=yield r.text();throw new Error(`Failed to fetch public key: ${r.status} ${o}`)}return yield r.json()})}get isServerSide(){return this.parsedAPIKey.usageOrigin===_commonsdkbase.APIKeyUsageOrigin.SERVER}get environment(){if(!this.parsedAPIKey.isValid)throw new (0, _chunkCT2UGJELcjs.a)("Invalid API key");return this.parsedAPIKey.environment}get headers(){return{"Content-Type":"application/json"}}};exports.a = a;
|
package/dist/chunk-TVZORU22.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkUO6UBZQ7cjs = require('./chunk-UO6UBZQ7.cjs');var _chunkDYRSQN7Xcjs = require('./chunk-DYRSQN7X.cjs');var _chunkNVJN7LPYcjs = require('./chunk-NVJN7LPY.cjs');var _chunkAFYBD7FIcjs = require('./chunk-AFYBD7FI.cjs');var _chunkYO6BJ2DIcjs = require('./chunk-YO6BJ2DI.cjs');var _chunkDIZVZP5Pcjs = require('./chunk-DIZVZP5P.cjs');function w(r,e){switch(e.type){case"email":return new (0, _chunkUO6UBZQ7cjs.a)(e);case"api-key":return r==="solana"?new (0, _chunkNVJN7LPYcjs.a)(e):new (0, _chunkYO6BJ2DIcjs.a)(e);case"external-wallet":return r==="solana"?new (0, _chunkAFYBD7FIcjs.a)(e):new (0, _chunkDIZVZP5Pcjs.a)(e);case"passkey":return new (0, _chunkDYRSQN7Xcjs.a)(e)}}exports.a = w;
|
package/dist/chunk-UO6UBZQ7.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkZWDS66FScjs = require('./chunk-ZWDS66FS.cjs');var _chunkROO2DTKQcjs = require('./chunk-ROO2DTKQ.cjs');var _chunkZSWIQU3Ucjs = require('./chunk-ZSWIQU3U.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _web3js = require('@solana/web3.js');var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);var _commonsdkbase = require('@crossmint/common-sdk-base');var p=class{constructor(e){this.config=e;this.type="email";this._needsAuth=!0;this._authPromise=null;this.initialize()}locator(){return`solana-keypair:${this.config.signerAddress}`}initialize(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(this.config._handshakeParent==null){let e=_commonsdkbase.validateAPIKey.call(void 0, this.config.crossmint.apiKey);if(!e.isValid)throw new Error("Invalid API key");let s=new (0, _chunkZWDS66FScjs.a)({environment:e.environment});this.config._handshakeParent=yield s.initialize()}})}signMessage(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for email signer"))})}signTransaction(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var n,o,r;yield this.handleAuthRequired();let s=_bs582.default.decode(e),a=_web3js.VersionedTransaction.deserialize(s).message.serialize(),t=yield(r=this.config._handshakeParent)==null?void 0:r.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:(o=(n=this.config.crossmint.experimental_customAuth)==null?void 0:n.jwt)!=null?o:"",apiKey:this.config.crossmint.apiKey},data:{keyType:"ed25519",bytes:_bs582.default.encode(a),encoding:"base58"}},options:h});if((t==null?void 0:t.status)==="error")throw new Error(t.error);if((t==null?void 0:t.signature)==null)throw new Error("Failed to sign transaction");return{signature:t.signature.bytes}})}handleAuthRequired(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var t,n,o;if(this.config._handshakeParent==null)throw new Error("Handshake parent not initialized");let e=yield(o=this.config._handshakeParent)==null?void 0:o.sendAction({event:"request:get-status",responseEvent:"response:get-status",data:{authData:{jwt:(n=(t=this.config.crossmint.experimental_customAuth)==null?void 0:t.jwt)!=null?n:"",apiKey:this.config.crossmint.apiKey}},options:h});if((e==null?void 0:e.status)!=="success")throw new Error(e==null?void 0:e.error);if(e.signerStatus==="ready"){this._needsAuth=!1;return}let{promise:s,resolve:i,reject:a}=this.createAuthPromise();if(this._authPromise={promise:s,resolve:i,reject:a},this.config.onAuthRequired)try{yield this.config.onAuthRequired(this._needsAuth,()=>this.sendEmailWithOtp(),r=>this.verifyOtp(r),()=>a(new _chunkZSWIQU3Ucjs.a))}catch(r){a(r)}try{yield s}catch(r){throw r}})}createAuthPromise(){let e,s;return{promise:new Promise((a,t)=>{e=a,s=t}),resolve:e,reject:s}}sendEmailWithOtp(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var a,t,n;if(this.config._handshakeParent==null)throw new Error("Handshake parent not initialized");let e=this.config._handshakeParent,s=`email:${this.config.email}`,i=yield e.sendAction({event:"request:start-onboarding",responseEvent:"response:start-onboarding",data:{authData:{jwt:(t=(a=this.config.crossmint.experimental_customAuth)==null?void 0:a.jwt)!=null?t:"",apiKey:this.config.crossmint.apiKey},data:{authId:s}},options:h});if((i==null?void 0:i.status)==="success"&&i.signerStatus==="ready"){this._needsAuth=!1;return}(i==null?void 0:i.status)==="error"&&(console.error("[sendEmailWithOtp] Failed to send OTP:",i),(n=this._authPromise)==null||n.reject(new Error(i.error||"Failed to initiate OTP process.")))})}verifyOtp(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var i,a,t,n,o;if(this.config._handshakeParent==null)throw new Error("Handshake parent not initialized");let s=this.config._handshakeParent;try{let r=yield s.sendAction({event:"request:complete-onboarding",responseEvent:"response:complete-onboarding",data:{authData:{jwt:(a=(i=this.config.crossmint.experimental_customAuth)==null?void 0:i.jwt)!=null?a:"",apiKey:this.config.crossmint.apiKey},data:{onboardingAuthentication:{encryptedOtp:e}}},options:h});if((r==null?void 0:r.status)==="success"){this._needsAuth=!1,(t=this._authPromise)==null||t.resolve();return}console.error("[verifyOtp] Failed to validate OTP:",r),this._needsAuth=!0;let g=(r==null?void 0:r.status)==="error"?r.error:"Failed to validate encrypted OTP";(n=this._authPromise)==null||n.reject(new Error(g))}catch(r){throw console.error("[verifyOtp] Error sending OTP validation request:",r),this._needsAuth=!0,(o=this._authPromise)==null||o.reject(r),r}})}static pregenerateSigner(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var a;let i=e!=null?e:(a=s.experimental_customAuth)==null?void 0:a.email;if(i==null)throw new Error("Email is required to pregenerate a signer");try{let n=(yield new (0, _chunkROO2DTKQcjs.a)(s).pregenerateSigner(i)).publicKey;if(n==null)throw new Error("No public key found");if(n.encoding!=="base58"||n.keyType!=="ed25519"||n.bytes==null)throw new Error("Not supported. Expected public key to be in base58 encoding and ed25519 key type. Got: "+JSON.stringify(n));return n.bytes}catch(t){throw console.error("[EmailSigner] Failed to pregenerate signer:",t),t}})}},h={timeoutMs:1e4,intervalMs:5e3};exports.a = p;
|
package/dist/chunk-YKPKNCFG.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as l}from"./chunk-PDL3XF5M.js";import{a as u}from"./chunk-5PQGSQCD.js";import{a as d}from"./chunk-M4ELAV7U.js";import{f as c}from"./chunk-BW7YYVZE.js";import{VersionedTransaction as f}from"@solana/web3.js";import m from"bs58";import{validateAPIKey as y}from"@crossmint/common-sdk-base";var p=class{constructor(e){this.config=e;this.type="email";this._needsAuth=!0;this._authPromise=null;this.initialize()}locator(){return`solana-keypair:${this.config.signerAddress}`}initialize(){return c(this,null,function*(){if(this.config._handshakeParent==null){let e=y(this.config.crossmint.apiKey);if(!e.isValid)throw new Error("Invalid API key");let s=new l({environment:e.environment});this.config._handshakeParent=yield s.initialize()}})}signMessage(){return c(this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for email signer"))})}signTransaction(e){return c(this,null,function*(){var n,o,r;yield this.handleAuthRequired();let s=m.decode(e),a=f.deserialize(s).message.serialize(),t=yield(r=this.config._handshakeParent)==null?void 0:r.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:(o=(n=this.config.crossmint.experimental_customAuth)==null?void 0:n.jwt)!=null?o:"",apiKey:this.config.crossmint.apiKey},data:{keyType:"ed25519",bytes:m.encode(a),encoding:"base58"}},options:h});if((t==null?void 0:t.status)==="error")throw new Error(t.error);if((t==null?void 0:t.signature)==null)throw new Error("Failed to sign transaction");return{signature:t.signature.bytes}})}handleAuthRequired(){return c(this,null,function*(){var t,n,o;if(this.config._handshakeParent==null)throw new Error("Handshake parent not initialized");let e=yield(o=this.config._handshakeParent)==null?void 0:o.sendAction({event:"request:get-status",responseEvent:"response:get-status",data:{authData:{jwt:(n=(t=this.config.crossmint.experimental_customAuth)==null?void 0:t.jwt)!=null?n:"",apiKey:this.config.crossmint.apiKey}},options:h});if((e==null?void 0:e.status)!=="success")throw new Error(e==null?void 0:e.error);if(e.signerStatus==="ready"){this._needsAuth=!1;return}let{promise:s,resolve:i,reject:a}=this.createAuthPromise();if(this._authPromise={promise:s,resolve:i,reject:a},this.config.onAuthRequired)try{yield this.config.onAuthRequired(this._needsAuth,()=>this.sendEmailWithOtp(),r=>this.verifyOtp(r),()=>a(new d))}catch(r){a(r)}try{yield s}catch(r){throw r}})}createAuthPromise(){let e,s;return{promise:new Promise((a,t)=>{e=a,s=t}),resolve:e,reject:s}}sendEmailWithOtp(){return c(this,null,function*(){var a,t,n;if(this.config._handshakeParent==null)throw new Error("Handshake parent not initialized");let e=this.config._handshakeParent,s=`email:${this.config.email}`,i=yield e.sendAction({event:"request:start-onboarding",responseEvent:"response:start-onboarding",data:{authData:{jwt:(t=(a=this.config.crossmint.experimental_customAuth)==null?void 0:a.jwt)!=null?t:"",apiKey:this.config.crossmint.apiKey},data:{authId:s}},options:h});if((i==null?void 0:i.status)==="success"&&i.signerStatus==="ready"){this._needsAuth=!1;return}(i==null?void 0:i.status)==="error"&&(console.error("[sendEmailWithOtp] Failed to send OTP:",i),(n=this._authPromise)==null||n.reject(new Error(i.error||"Failed to initiate OTP process.")))})}verifyOtp(e){return c(this,null,function*(){var i,a,t,n,o;if(this.config._handshakeParent==null)throw new Error("Handshake parent not initialized");let s=this.config._handshakeParent;try{let r=yield s.sendAction({event:"request:complete-onboarding",responseEvent:"response:complete-onboarding",data:{authData:{jwt:(a=(i=this.config.crossmint.experimental_customAuth)==null?void 0:i.jwt)!=null?a:"",apiKey:this.config.crossmint.apiKey},data:{onboardingAuthentication:{encryptedOtp:e}}},options:h});if((r==null?void 0:r.status)==="success"){this._needsAuth=!1,(t=this._authPromise)==null||t.resolve();return}console.error("[verifyOtp] Failed to validate OTP:",r),this._needsAuth=!0;let g=(r==null?void 0:r.status)==="error"?r.error:"Failed to validate encrypted OTP";(n=this._authPromise)==null||n.reject(new Error(g))}catch(r){throw console.error("[verifyOtp] Error sending OTP validation request:",r),this._needsAuth=!0,(o=this._authPromise)==null||o.reject(r),r}})}static pregenerateSigner(e,s){return c(this,null,function*(){var a;let i=e!=null?e:(a=s.experimental_customAuth)==null?void 0:a.email;if(i==null)throw new Error("Email is required to pregenerate a signer");try{let n=(yield new u(s).pregenerateSigner(i)).publicKey;if(n==null)throw new Error("No public key found");if(n.encoding!=="base58"||n.keyType!=="ed25519"||n.bytes==null)throw new Error("Not supported. Expected public key to be in base58 encoding and ed25519 key type. Got: "+JSON.stringify(n));return n.bytes}catch(t){throw console.error("[EmailSigner] Failed to pregenerate signer:",t),t}})}},h={timeoutMs:1e4,intervalMs:5e3};export{p as a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkUO6UBZQ7cjs = require('../../chunk-UO6UBZQ7.cjs');require('../../chunk-ZWDS66FS.cjs');require('../../chunk-ROO2DTKQ.cjs');require('../../chunk-ZSWIQU3U.cjs');require('../../chunk-W4MKUPUF.cjs');require('../../chunk-CT2UGJEL.cjs');require('../../chunk-XALFCQKD.cjs');exports.EmailSigner = _chunkUO6UBZQ7cjs.a;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a}from"../../chunk-YKPKNCFG.js";import"../../chunk-PDL3XF5M.js";import"../../chunk-5PQGSQCD.js";import"../../chunk-M4ELAV7U.js";import"../../chunk-FPSS2IYY.js";import"../../chunk-7ENJXL4H.js";import"../../chunk-BW7YYVZE.js";export{a as EmailSigner};
|
|
File without changes
|
|
File without changes
|