@crossmint/wallets-sdk 0.12.1 → 0.12.3
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/index.cjs +1 -1
- package/dist/api/index.js +1 -1
- package/dist/{chunk-ZTVEOVAQ.js → chunk-4F7RMMET.js} +1 -1
- package/dist/chunk-5MEDIULY.cjs +1 -0
- package/dist/{chunk-CP3N5Q3C.cjs → chunk-AEXV7M7X.cjs} +1 -1
- package/dist/{chunk-PPS37EJL.cjs → chunk-B4QFWMS6.cjs} +1 -1
- package/dist/{chunk-6433AT57.js → chunk-EBNQ6AC3.js} +1 -1
- package/dist/chunk-JLLQURT2.js +1 -0
- package/dist/{chunk-2DDIFY2C.cjs → chunk-KEE7SKIF.cjs} +1 -1
- package/dist/{chunk-7SA335PZ.cjs → chunk-M7ZMIRW6.cjs} +1 -1
- package/dist/{chunk-WNJB4XC7.js → chunk-PBTKTO3K.js} +1 -1
- package/dist/{chunk-BMGQVO4K.js → chunk-PZGC5E75.js} +1 -1
- package/dist/{chunk-F6KWHHYO.js → chunk-QK2J65W4.js} +1 -1
- package/dist/{chunk-SYCCYHLT.cjs → chunk-SSVNEBWE.cjs} +1 -1
- package/dist/{chunk-2FBU6EOX.js → chunk-TCZTUYVT.js} +1 -1
- package/dist/{chunk-CARVGLYT.cjs → chunk-U7C5HG3Y.cjs} +2 -2
- package/dist/chunk-VXYHBIHJ.js +1 -0
- package/dist/{chunk-ZO4PSHX2.cjs → chunk-XQ5PORFC.cjs} +1 -1
- 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/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/stellar.cjs +1 -1
- package/dist/wallets/stellar.js +1 -1
- package/dist/wallets/wallet-factory.cjs +1 -1
- package/dist/wallets/wallet-factory.js +1 -1
- package/dist/wallets/wallet.cjs +1 -1
- package/dist/wallets/wallet.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-LE7DYESO.js +0 -1
- package/dist/chunk-VMBMJTB4.cjs +0 -1
- package/dist/chunk-XFNHQ4RR.js +0 -1
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 _chunkKEE7SKIFcjs = require('../chunk-KEE7SKIF.cjs');require('../chunk-M7ZMIRW6.cjs');require('../chunk-O4FVTK7X.cjs');require('../chunk-XALFCQKD.cjs');exports.ApiClient = _chunkKEE7SKIFcjs.a;
|
package/dist/api/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-PBTKTO3K.js";import"../chunk-JLLQURT2.js";import"../chunk-PSXRNSOE.js";import"../chunk-BW7YYVZE.js";export{a as ApiClient};
|
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 _chunkKEE7SKIFcjs = require('../chunk-KEE7SKIF.cjs');require('../chunk-M7ZMIRW6.cjs');require('../chunk-O4FVTK7X.cjs');require('../chunk-ECAM5KTH.cjs');require('../chunk-XALFCQKD.cjs');exports.ApiClient = _chunkKEE7SKIFcjs.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-PBTKTO3K.js";import"../chunk-JLLQURT2.js";import"../chunk-PSXRNSOE.js";import"../chunk-KBJA7JDT.js";import"../chunk-BW7YYVZE.js";export{a as ApiClient};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as l}from"./chunk-
|
|
1
|
+
import{a as l}from"./chunk-QK2J65W4.js";import{a}from"./chunk-PBTKTO3K.js";import{f as e}from"./chunk-BW7YYVZE.js";import{createCrossmint as p}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{p as a,i as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkM7ZMIRW6cjs = require('./chunk-M7ZMIRW6.cjs');var _chunkO4FVTK7Xcjs = require('./chunk-O4FVTK7X.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var m,l,J= exports.a =class{constructor(e,r){_chunkXALFCQKDcjs.d.call(void 0, this,m);_chunkXALFCQKDcjs.d.call(void 0, this,l);let{chain:t,address:n,owner:s,signer:d,options:g}=e;_chunkXALFCQKDcjs.e.call(void 0, this,l,r),this.chain=t,this.address=n,this.owner=s,this.signer=d,_chunkXALFCQKDcjs.e.call(void 0, this,m,g)}static getApiClient(e){return e.apiClient}static getOptions(e){return e.options}get apiClient(){return _chunkXALFCQKDcjs.c.call(void 0, this,l)}get options(){return _chunkXALFCQKDcjs.c.call(void 0, this,m)}experimental_apiClient(){return _chunkXALFCQKDcjs.c.call(void 0, this,l)}balances(e,r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let t;switch(this.chain){case"solana":t="sol";break;case"stellar":t="xlm";break;default:t="eth";break}let n=[t,"usdc",...e!=null?e:[]],s=yield _chunkXALFCQKDcjs.c.call(void 0, this,l).getBalance(this.address,{chains:r!=null?r:[this.chain],tokens:n});if("error"in s)throw new Error(`Failed to get balances for wallet: ${JSON.stringify(s.message)}`);return this.transformBalanceResponse(s,t,e)})}transformBalanceResponse(e,r,t){let n=a=>{var f,w,v,T,y;let u=(f=a.chains)==null?void 0:f[this.chain],h=u!=null&&"contractAddress"in u?u.contractAddress:void 0;return{symbol:(w=a.symbol)!=null?w:"",name:(v=a.name)!=null?v:"",amount:(T=a.amount)!=null?T:"0",contractAddress:h,decimals:a.decimals,rawAmount:(y=a.rawAmount)!=null?y:"0"}},s=e.find(a=>a.symbol===r),d=e.find(a=>a.symbol==="usdc"),g=e.filter(a=>a.symbol!==r&&a.symbol!=="usdc"),i=a=>({symbol:a,name:a,amount:"0",contractAddress:void 0,decimals:0,rawAmount:"0"});return{nativeToken:s!=null?n(s):i(r),usdc:d!=null?n(d):i("usdc"),tokens:g.map(n)}}experimental_nfts(e){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, {},e),{chain:this.chain,address:this.address}))})}experimental_transactions(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let e=yield _chunkXALFCQKDcjs.c.call(void 0, this,l).getTransactions(this.walletLocator);if("error"in e)throw new Error(`Failed to get transactions: ${JSON.stringify(e.message)}`);return e})}experimental_transaction(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let r=yield _chunkXALFCQKDcjs.c.call(void 0, this,l).getTransaction(this.walletLocator,e);if("error"in r)throw new Error(`Failed to get transaction: ${JSON.stringify(r.error)}`);return r})}experimental_activity(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let e=yield this.apiClient.experimental_activity(this.walletLocator,{chain:this.chain});if("error"in e)throw new Error(`Failed to get activity: ${JSON.stringify(e.message)}`);return e})}send(e,r,t,n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let s=H(e),d=M(r,this.chain),g={recipient:s,amount:t},i=yield _chunkXALFCQKDcjs.c.call(void 0, this,l).send(this.walletLocator,d,g);if("message"in i)throw new (0, _chunkO4FVTK7Xcjs.r)(`Failed to send token: ${JSON.stringify(i.message)}`);return n!=null&&n.experimental_prepareOnly?{hash:void 0,explorerLink:void 0,transactionId:i.id}:yield this.approveTransactionAndWait(i.id)})}approveTransaction(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return console.warn("approveTransaction is deprecated. Use approve instead. This method will be removed in the next major version."),yield this.approve(e)})}approve(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(e.transactionId!=null)return yield this.approveTransactionAndWait(e.transactionId,e.options);if(e.signatureId!=null)return yield this.approveSignatureAndWait(e.signatureId,e.options);throw new Error("Either transactionId or signatureId must be provided")})}addDelegatedSigner(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var t;let r=yield _chunkXALFCQKDcjs.c.call(void 0, this,l).registerSigner(this.walletLocator,{signer:e.signer,chain:this.chain==="solana"||this.chain==="stellar"?void 0:this.chain});if("error"in r)throw new Error(`Failed to register signer: ${JSON.stringify(r.message)}`);if("transaction"in r&&r.transaction!=null){let n=r.transaction.id;yield this.approveTransactionAndWait(n)}else if("chains"in r){let n=(t=r.chains)==null?void 0:t[this.chain];if((n==null?void 0:n.status)==="awaiting-approval"){yield this.approveSignatureAndWait(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 r,t,n;let e=yield _chunkXALFCQKDcjs.c.call(void 0, this,l).getWallet(this.walletLocator);if("error"in e)throw new (0, _chunkO4FVTK7Xcjs.d)(JSON.stringify(e));if(this.chain==="stellar")return[];if(e.type!=="smart"||e.chainType!=="evm"&&e.chainType!=="solana")throw new (0, _chunkO4FVTK7Xcjs.c)(`Wallet type ${e.type} not supported`);return(n=(t=(r=e==null?void 0:e.config)==null?void 0:r.delegatedSigners)==null?void 0:t.map(s=>{let d=s.locator.indexOf(":");return{signer:`external-wallet:${d>=0?s.locator.slice(d+1):s.locator}`}}))!=null?n:[]})}get walletLocator(){return _chunkXALFCQKDcjs.c.call(void 0, this,l).isServerSide?this.address:this.chain==="stellar"?"me:stellar:smart":this.chain==="solana"?"me:solana:smart":"me:evm:smart"}get isSolanaWallet(){return this.chain==="solana"}approveTransactionAndWait(e,r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.approveTransactionInternal(e,r),yield this.sleep(1e3),yield this.waitForTransaction(e)})}approveSignatureAndWait(e,r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.approveSignatureInternal(e,r),yield this.sleep(1e3),yield this.waitForSignature(e)})}approveSignatureInternal(e,r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var i,a;if(this.isSolanaWallet)throw new Error("Approving signatures is only supported for EVM smart wallets");let t=yield _chunkXALFCQKDcjs.c.call(void 0, this,l).getSignature(this.walletLocator,e);if("error"in t)throw new (0, _chunkO4FVTK7Xcjs.p)(JSON.stringify(t));if(this.signer.type==="api-key")return t;if((r==null?void 0:r.experimental_approval)!=null){let u=[r.experimental_approval];return yield this.executeApproveSignatureWithErrorHandling(e,u)}let n=(i=t.approvals)==null?void 0:i.pending;if(n==null)return t;let s=[...(a=r==null?void 0:r.additionalSigners)!=null?a:[],this.signer],g=(yield Promise.all(n.map(u=>{let h=s.find(f=>f.locator()===u.signer.locator);if(h==null)throw new (0, _chunkO4FVTK7Xcjs.i)(`Signer ${u.signer} not found in pending approvals`);return h.signMessage(u.message)}))).map(u=>_chunkXALFCQKDcjs.b.call(void 0, _chunkXALFCQKDcjs.a.call(void 0, {},u),{signer:this.signer.locator()}));return yield this.executeApproveSignatureWithErrorHandling(e,g)})}approveTransactionInternal(e,r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var i,a,u,h,f;let t=yield _chunkXALFCQKDcjs.c.call(void 0, this,l).getTransaction(this.walletLocator,e);if("error"in t)throw new (0, _chunkO4FVTK7Xcjs.s)(JSON.stringify(t));if(yield(u=(a=(i=_chunkXALFCQKDcjs.c.call(void 0, this,m))==null?void 0:i.experimental_callbacks)==null?void 0:a.onTransactionStart)==null?void 0:u.call(a),this.signer.type==="api-key")return t;if((r==null?void 0:r.experimental_approval)!=null){let w=[r.experimental_approval];return yield this.executeApproveTransactionWithErrorHandling(e,w)}let n=(h=t.approvals)==null?void 0:h.pending;if(n==null)return t;let s=[...(f=r==null?void 0:r.additionalSigners)!=null?f:[],this.signer],g=(yield Promise.all(n.map(w=>{let v=s.find(y=>y.locator()===w.signer.locator);if(v==null)throw new (0, _chunkO4FVTK7Xcjs.i)(`Signer ${w.signer} not found in pending approvals`);let T=t.chainType==="solana"&&"transaction"in t.onChain?t.onChain.transaction:w.message;return v.signTransaction(T)}))).map(w=>_chunkXALFCQKDcjs.b.call(void 0, _chunkXALFCQKDcjs.a.call(void 0, {},w),{signer:this.signer.locator()}));return yield this.executeApproveTransactionWithErrorHandling(e,g)})}executeApproveTransactionWithErrorHandling(e,r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let t=yield _chunkXALFCQKDcjs.c.call(void 0, this,l).approveTransaction(this.walletLocator,e,{approvals:r});if(t.error)throw new (0, _chunkO4FVTK7Xcjs.x)(JSON.stringify(t));return t})}executeApproveSignatureWithErrorHandling(e,r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let t=yield _chunkXALFCQKDcjs.c.call(void 0, this,l).approveSignature(this.walletLocator,e,{approvals:r});if(t.error)throw new (0, _chunkO4FVTK7Xcjs.q)(JSON.stringify(t));return t})}waitForSignature(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let r=null;do if(yield new Promise(t=>setTimeout(t,_chunkM7ZMIRW6cjs.d)),r=yield _chunkXALFCQKDcjs.c.call(void 0, this,l).getSignature(this.walletLocator,e),"error"in r)throw new (0, _chunkO4FVTK7Xcjs.p)(JSON.stringify(r));while(r===null||r.status==="pending");if(r.status==="failed")throw new (0, _chunkO4FVTK7Xcjs.m)("Signature signing failed");if(!r.outputSignature)throw new (0, _chunkO4FVTK7Xcjs.p)("Signature not available");return{signature:r.outputSignature,signatureId:e}})}waitForTransaction(d){return _chunkXALFCQKDcjs.f.call(void 0, this,arguments,function*(e,r=6e4,{backoffMultiplier:t=1.1,maxBackoffMs:n=2e3,initialBackoffMs:s=_chunkM7ZMIRW6cjs.d}={}){var u;let g=Date.now(),i;do{if(Date.now()-g>r)throw new (0, _chunkO4FVTK7Xcjs.t)("Transaction confirmation timeout");if(i=yield _chunkXALFCQKDcjs.c.call(void 0, this,l).getTransaction(this.walletLocator,e),i.error)throw new (0, _chunkO4FVTK7Xcjs.s)(JSON.stringify(i));yield this.sleep(s),s=Math.min(s*t,n)}while(i.status==="pending");if(i.status==="failed")throw new (0, _chunkO4FVTK7Xcjs.u)(`Transaction sending failed: ${JSON.stringify(i.error)}`);if(i.status==="awaiting-approval")throw new (0, _chunkO4FVTK7Xcjs.v)("Transaction is awaiting approval. Please submit required approvals before waiting for completion.");let a=i.onChain.txId;if(a==null)throw new (0, _chunkO4FVTK7Xcjs.w)("Transaction hash not found on transaction response");return{hash:a,explorerLink:(u=i.onChain.explorerLink)!=null?u:"",transactionId:i.id}})}sleep(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return new Promise(r=>setTimeout(r,e))})}};m=new WeakMap,l=new WeakMap;function H(p){if(typeof p=="string")return p;if("email"in p)return`email:${p.email}`;if("x"in p)return`x:${p.x}`;if("twitter"in p)return`twitter:${p.twitter}`;if("phone"in p)return`phoneNumber:${p.phone}`;if("userId"in p)return`userId:${p.userId}`;throw new Error("Invalid recipient locator")}function M(p,e){return _commonsdkbase.isValidAddress.call(void 0, p)?`${e}:${p}`:`${e}:${p.toLowerCase()}`}exports.a = J;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkU7C5HG3Ycjs = require('./chunk-U7C5HG3Y.cjs');var _chunkKEE7SKIFcjs = require('./chunk-KEE7SKIF.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var i=class o{constructor(t){let r=new (0, _chunkKEE7SKIFcjs.a)(t);this.walletFactory=new (0, _chunkU7C5HG3Ycjs.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 _chunk5MEDIULYcjs = require('./chunk-5MEDIULY.cjs');var _chunkO4FVTK7Xcjs = require('./chunk-O4FVTK7X.cjs');var _chunkCU6FZ36Vcjs = require('./chunk-CU6FZ36V.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _viem = require('viem');var _commonsdkbase = require('@crossmint/common-sdk-base');var m=class w extends _chunk5MEDIULYcjs.a{constructor(t){super({chain:t.chain,address:t.address,owner:t.owner,signer:t.signer,options:_chunk5MEDIULYcjs.a.getOptions(t)},_chunk5MEDIULYcjs.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 w(t)}sendTransaction(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var i;let n=this.buildTransaction(t),e=yield this.createTransaction(n,t.options);return(i=t.options)!=null&&i.experimental_prepareOnly?{hash:void 0,explorerLink:void 0,transactionId:e.id}:yield this.approveTransactionAndWait(e.id)})}signMessage(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var e;let n=yield this.apiClient.createSignature(this.walletLocator,{type:"message",params:{message:t.message,signer:this.signer.locator(),chain:this.chain}});if("error"in n)throw new (0, _chunkO4FVTK7Xcjs.o)(JSON.stringify(n));return(e=t.options)!=null&&e.experimental_prepareOnly?{signature:void 0,signatureId:n.id}:yield this.approveSignatureAndWait(n.id)})}signTypedData(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var T;let{domain:n,message:e,primaryType:i,types:a,chain:r}=t;if(!n||!e||!a||!r)throw new (0, _chunkO4FVTK7Xcjs.k)("Invalid typed data");let{name:d,version:l,chainId:g,verifyingContract:h,salt:S}=n;if(!d||!l||!g||!h)throw new (0, _chunkO4FVTK7Xcjs.k)("Invalid typed data domain");let o=yield this.apiClient.createSignature(this.walletLocator,{type:"typed-data",params:{typedData:{domain:{name:d,version:l,chainId:Number(g),verifyingContract:h,salt:S},message:e,primaryType:i,types:a},signer:this.signer.locator(),chain:r,isSmartWalletSignature:!1}});if("error"in o)throw new (0, _chunkO4FVTK7Xcjs.o)(JSON.stringify(o));return(T=t.options)!=null&&T.experimental_prepareOnly?{signature:void 0,signatureId:o.id}:yield this.approveSignatureAndWait(o.id)})}getViemClient(t){var n;return _viem.createPublicClient.call(void 0, {transport:(n=t==null?void 0:t.transport)!=null?n:_viem.http.call(void 0, ),chain:_chunkCU6FZ36Vcjs.a.call(void 0, this.chain)})}createTransaction(t,n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var a;let e=(a=n==null?void 0:n.experimental_signer)!=null?a:this.signer.locator(),i=yield this.apiClient.createTransaction(this.walletLocator,{params:{signer:e,chain:this.chain,calls:[t]}});if("error"in i)throw new (0, _chunkO4FVTK7Xcjs.r)(JSON.stringify(i));return i})}buildTransaction(t){var n,e,i,a,r;if("transaction"in t)return{transaction:t.transaction};if(t.abi==null)return{to:t.to,value:(e=(n=t.value)==null?void 0:n.toString())!=null?e:"0",data:(i=t.data)!=null?i:"0x"};if(!t.functionName)throw new Error("Function name is required");return{to:t.to,value:(r=(a=t.value)==null?void 0:a.toString())!=null?r:"0",data:_viem.encodeFunctionData.call(void 0, {abi:t.abi,functionName:t.functionName,args:t.args})}}};exports.a = m;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-VXYHBIHJ.js";import{r as p}from"./chunk-PSXRNSOE.js";import{f as o}from"./chunk-BW7YYVZE.js";import{isValidStellarAddress as T}from"@crossmint/common-sdk-base";var l=class d extends a{constructor(n){super({chain:n.chain,address:n.address,owner:n.owner,signer:n.signer,options:a.getOptions(n)},a.getApiClient(n))}static from(n){if(!T(n.address))throw new Error("Wallet is not a Stellar wallet");return new d(n)}sendTransaction(n){return o(this,null,function*(){var t;let e=yield this.createTransaction(n);if((t=n.options)!=null&&t.experimental_prepareOnly)return{hash:void 0,explorerLink:void 0,transactionId:e.id};let r={};return yield this.approveTransactionAndWait(e.id,r)})}createTransaction(g){return o(this,arguments,function*({contractId:n,method:e,memo:r,args:t,options:i}){var c;let u=(c=i==null?void 0:i.experimental_signer)!=null?c:this.signer.locator(),s=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:{type:"contract-call",contractId:n,method:e,memo:r!=null?{type:"text",value:r}:void 0,args:t},signer:u}});if("error"in s)throw new p(JSON.stringify(s));return s})}};export{l as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var s="@crossmint/wallets-sdk",t="0.12.3";var r="WALLETS_SDK",c=t,a=s,d=500;export{r as a,c as b,a as c,d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkM7ZMIRW6cjs = require('./chunk-M7ZMIRW6.cjs');var _chunkO4FVTK7Xcjs = require('./chunk-O4FVTK7X.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:_chunkM7ZMIRW6cjs.c,version:_chunkM7ZMIRW6cjs.b}}});this.apiPrefix="api/2025-06-09/wallets";this.legacyApiPrefix="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=e;this.isServerSide||(t=`me:${s.chain==="solana"?"solana-smart-wallet":"evm-smart-wallet"}`);let a=new URLSearchParams;return a.append("chain",s.chain.toString()),(yield this.get(`${this.legacyApiPrefix}/${t}/activity?${a.toString()}`,{headers:this.headers})).json()})}getBalance(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let t=new URLSearchParams;return t.append("tokens",s.tokens.join(",")),t.append("chains",s.chains.join(",")),(yield this.get(`${this.apiPrefix}/${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(`${this.apiPrefix}/${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, _chunkO4FVTK7Xcjs.a)("Invalid API key");return this.parsedAPIKey.environment}get headers(){return{"Content-Type":"application/json"}}};exports.a = p;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var s="@crossmint/wallets-sdk",t="0.12.
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var s="@crossmint/wallets-sdk",t="0.12.3";var p="WALLETS_SDK",r= exports.b =t,c= exports.c =s,a= exports.d =500;exports.a = p; exports.b = r; exports.c = c; exports.d = a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as n,c as i}from"./chunk-
|
|
1
|
+
import{b as n,c as i}from"./chunk-JLLQURT2.js";import{a as o}from"./chunk-PSXRNSOE.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/2025-06-09/wallets";this.legacyApiPrefix="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=e;this.isServerSide||(t=`me:${s.chain==="solana"?"solana-smart-wallet":"evm-smart-wallet"}`);let a=new URLSearchParams;return a.append("chain",s.chain.toString()),(yield this.get(`${this.legacyApiPrefix}/${t}/activity?${a.toString()}`,{headers:this.headers})).json()})}getBalance(e,s){return r(this,null,function*(){let t=new URLSearchParams;return t.append("tokens",s.tokens.join(",")),t.append("chains",s.chains.join(",")),(yield this.get(`${this.apiPrefix}/${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(`${this.apiPrefix}/${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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as t}from"./chunk-
|
|
1
|
+
import{a as t}from"./chunk-VXYHBIHJ.js";import{a as l}from"./chunk-6PVKL5RC.js";import{r as p}from"./chunk-PSXRNSOE.js";import{f as s}from"./chunk-BW7YYVZE.js";import m from"bs58";import{isValidSolanaAddress as T}from"@crossmint/common-sdk-base";var d=class u extends t{constructor(n){super({chain:n.chain,address:n.address,owner:n.owner,signer:n.signer,options:t.getOptions(n)},t.getApiClient(n))}static from(n){if(!T(n.address))throw new Error("Wallet is not a Solana wallet");return new u(n)}sendTransaction(n){return s(this,null,function*(){var e,r;let a=yield this.createTransaction(n);if((e=n.options)!=null&&e.experimental_prepareOnly)return{hash:void 0,explorerLink:void 0,transactionId:a.id};let i={additionalSigners:(r=n.additionalSigners)==null?void 0:r.map(o=>new l({type:"external-wallet",address:o.publicKey.toString(),locator:`external-wallet:${o.publicKey.toString()}`,onSignTransaction:c=>(c.sign([o]),Promise.resolve(c))}))};return yield this.approveTransactionAndWait(a.id,i)})}createTransaction(S){return s(this,arguments,function*({transaction:n,options:a}){var r;let i=(r=a==null?void 0:a.experimental_signer)!=null?r:this.signer.locator(),e=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:m.encode(n.serialize()),signer:i}});if("error"in e)throw new p(JSON.stringify(e));return e})}};export{d as a};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as S}from"./chunk-BHGNJYYE.js";import{a as C}from"./chunk-
|
|
1
|
+
import{a as S}from"./chunk-BHGNJYYE.js";import{a as C}from"./chunk-VXYHBIHJ.js";import{a as f}from"./chunk-7BEMA3KG.js";import{d as y,f as r}from"./chunk-PSXRNSOE.js";import{a as s,f as c}from"./chunk-BW7YYVZE.js";import{WebAuthnP256 as W}from"ox";var u="When 'delegatedSigners' is provided to a method that may fetch an existing wallet, each specified delegated signer must exist in that wallet's configuration.",w=class{constructor(e){this.apiClient=e}getOrCreateWallet(e){return c(this,null,function*(){if(this.apiClient.isServerSide)throw new r(`getOrCreateWallet can only be called from client-side code.
|
|
2
2
|
- Make sure you're running this in the browser (or another client environment), not on your server.
|
|
3
3
|
- Use your Crossmint Client API Key (not a server key).`);let n=yield this.apiClient.getWallet(`me:${this.getChainType(e.chain)}:smart`);return n!=null&&!("error"in n)?this.createWalletInstance(n,e):this.createWallet(e)})}getWallet(e,n){return c(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 y(JSON.stringify(i));return this.createWalletInstance(i,n)})}createWallet(e){return c(this,null,function*(){var t,a,l,o;yield(l=(a=(t=e.options)==null?void 0:t.experimental_callbacks)==null?void 0:a.onWalletCreationStart)==null?void 0:l.call(a),this.mutateSignerFromCustomAuth(e,!0);let n=e.signer.type==="passkey"?yield this.createPasskeyAdminSigner(e.signer):e.signer,i=yield this.apiClient.createWallet({type:"smart",chainType:this.getChainType(e.chain),config:s(s({adminSigner:n},e!=null&&e.plugins?{plugins:e.plugins}:{}),e.chain==="solana"&&e.delegatedSigners!=null?{delegatedSigners:e.delegatedSigners}:{}),owner:(o=e.owner)!=null?o:void 0});if("error"in i)throw new r(JSON.stringify(i));return this.createWalletInstance(i,e)})}createWalletInstance(e,n){this.validateExistingWalletConfig(e,n);let i=this.toInternalSignerConfig(e,n.signer,n.options);return new C({chain:n.chain,address:e.address,owner:e.owner,signer:f(n.chain,i),options:n.options},this.apiClient)}toInternalSignerConfig(e,n,i){var t,a,l,o,d,m;if(!(e.chainType==="evm"||e.chainType==="solana"||e.chainType==="stellar"))throw new r(`Wallet type ${e.chainType} is not supported`);if(n==null&&((t=e.config)==null?void 0:t.adminSigner)==null)throw new r("Signer is required to create a wallet");switch(n.type){case"api-key":{if(((a=e.config)==null?void 0:a.adminSigner.type)!=="api-key")throw new r("API key signer does not match the wallet's signer type");return{type:"api-key",address:e.config.adminSigner.address,locator:e.config.adminSigner.locator}}case"external-wallet":if(((l=e.config)==null?void 0:l.adminSigner.type)!=="external-wallet")throw new r("External wallet signer does not match the wallet's signer type");return s(s({},e.config.adminSigner),n);case"passkey":if(((o=e.config)==null?void 0:o.adminSigner.type)!=="passkey")throw new r("Passkey signer does not match the wallet's signer type");return{type:"passkey",id:e.config.adminSigner.id,name:e.config.adminSigner.name,locator:e.config.adminSigner.locator,onCreatePasskey:n.onCreatePasskey,onSignWithPasskey:n.onSignWithPasskey};case"email":{if(((d=e.config)==null?void 0:d.adminSigner.type)!=="email")throw new r("Email signer does not match the wallet's signer type");let{locator:h,email:g,address:p}=e.config.adminSigner;return{type:"email",email:g,locator:h,address:p,crossmint:this.apiClient.crossmint,onAuthRequired:n.onAuthRequired,clientTEEConnection:i==null?void 0:i.clientTEEConnection}}case"phone":{if(((m=e.config)==null?void 0:m.adminSigner.type)!=="phone")throw new r("Phone signer does not match the wallet's signer type");let{locator:h,phone:g,address:p}=e.config.adminSigner;return{type:"phone",phone:g,locator:h,address:p,crossmint:this.apiClient.crossmint,onAuthRequired:n.onAuthRequired,clientTEEConnection:i==null?void 0:i.clientTEEConnection}}default:throw new Error("Invalid signer type")}}createPasskeyAdminSigner(e){return c(this,null,function*(){var t;if(e.type!=="passkey")throw new Error("Signer is not a passkey");let n=(t=e.name)!=null?t:`Crossmint Wallet ${Date.now()}`,i=e.onCreatePasskey?yield e.onCreatePasskey(n):yield W.createCredential({name:n});return{type:"passkey",id:i.id,name:n,publicKey:{x:i.publicKey.x.toString(),y:i.publicKey.y.toString()}}})}mutateSignerFromCustomAuth(e,n=!1){var t,a;let{experimental_customAuth:i}=this.apiClient.crossmint;e.signer.type==="email"&&(i==null?void 0:i.email)!=null&&(e.signer.email=(t=e.signer.email)!=null?t:i.email),e.signer.type==="phone"&&(i==null?void 0:i.phone)!=null&&(e.signer.phone=(a=e.signer.phone)!=null?a:i.phone),e.signer.type==="external-wallet"&&(i==null?void 0:i.externalWalletSigner)!=null&&(e.signer=n?{type:"external-wallet",address:i.externalWalletSigner.address}:i.externalWalletSigner)}validateExistingWalletConfig(e,n){var a;if(this.mutateSignerFromCustomAuth(n),n.owner!=null&&e.owner!=null&&n.owner!==e.owner)throw new r("Wallet owner does not match existing wallet's linked user");if(n.chain==="solana"&&e.chainType!=="solana"||n.chain!=="solana"&&e.chainType==="solana"||n.chain==="stellar"&&e.chainType!=="stellar"||n.chain!=="stellar"&&e.chainType==="stellar")throw new r(`Wallet chain does not match existing wallet's chain. You must use chain: ${e.chainType}.`);if(e.type!=="smart")return;let i=n.signer,t=(a=e==null?void 0:e.config)==null?void 0:a.adminSigner;if(i!=null&&t!=null){if(i.type!==t.type)throw new r("The wallet signer type provided in the wallet config does not match the existing wallet's adminSigner type");S(i,t)}n.delegatedSigners!=null&&n.chain==="solana"&&this.validateDelegatedSigners(e,n.delegatedSigners)}validateDelegatedSigners(e,n){var t;let i=(t=e==null?void 0:e.config)==null?void 0:t.delegatedSigners;if(n.length!==0){if(i==null||i.length===0)throw new r(`${n.length} delegated signer(s) specified, but wallet "${e.address}" has no delegated signers. ${u}`);for(let a of n)if(i.find(o=>o.locator===a.signer)==null){let o=i.map(d=>d.locator).join(", ");throw new r(`Delegated signer '${a.signer}' does not exist in wallet "${e.address}". Available delegated signers: ${o}. ${u}`)}}}getChainType(e){return e==="solana"?"solana":e==="stellar"?"stellar":"evm"}};export{w as a};
|
|
@@ -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 _chunk5MEDIULYcjs = require('./chunk-5MEDIULY.cjs');var _chunkHRSVFJNDcjs = require('./chunk-HRSVFJND.cjs');var _chunkO4FVTK7Xcjs = require('./chunk-O4FVTK7X.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);var _commonsdkbase = require('@crossmint/common-sdk-base');var d=class u extends _chunk5MEDIULYcjs.a{constructor(n){super({chain:n.chain,address:n.address,owner:n.owner,signer:n.signer,options:_chunk5MEDIULYcjs.a.getOptions(n)},_chunk5MEDIULYcjs.a.getApiClient(n))}static from(n){if(!_commonsdkbase.isValidSolanaAddress.call(void 0, n.address))throw new Error("Wallet is not a Solana wallet");return new u(n)}sendTransaction(n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var e,r;let a=yield this.createTransaction(n);if((e=n.options)!=null&&e.experimental_prepareOnly)return{hash:void 0,explorerLink:void 0,transactionId:a.id};let i={additionalSigners:(r=n.additionalSigners)==null?void 0:r.map(o=>new (0, _chunkHRSVFJNDcjs.a)({type:"external-wallet",address:o.publicKey.toString(),locator:`external-wallet:${o.publicKey.toString()}`,onSignTransaction:c=>(c.sign([o]),Promise.resolve(c))}))};return yield this.approveTransactionAndWait(a.id,i)})}createTransaction(S){return _chunkXALFCQKDcjs.f.call(void 0, this,arguments,function*({transaction:n,options:a}){var r;let i=(r=a==null?void 0:a.experimental_signer)!=null?r:this.signer.locator(),e=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:_bs582.default.encode(n.serialize()),signer:i}});if("error"in e)throw new (0, _chunkO4FVTK7Xcjs.r)(JSON.stringify(e));return e})}};exports.a = d;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as c}from"./chunk-
|
|
1
|
+
import{a as c}from"./chunk-VXYHBIHJ.js";import{k as p,o as u,r as y}from"./chunk-PSXRNSOE.js";import{a as f}from"./chunk-I5COKXOT.js";import{f as s}from"./chunk-BW7YYVZE.js";import{createPublicClient as C,encodeFunctionData as x,http as I}from"viem";import{isValidEvmAddress as E}from"@crossmint/common-sdk-base";var m=class w extends c{constructor(t){super({chain:t.chain,address:t.address,owner:t.owner,signer:t.signer,options:c.getOptions(t)},c.getApiClient(t))}static from(t){if(!E(t.address))throw new Error("Wallet is not an EVM wallet");return new w(t)}sendTransaction(t){return s(this,null,function*(){var i;let n=this.buildTransaction(t),e=yield this.createTransaction(n,t.options);return(i=t.options)!=null&&i.experimental_prepareOnly?{hash:void 0,explorerLink:void 0,transactionId:e.id}:yield this.approveTransactionAndWait(e.id)})}signMessage(t){return s(this,null,function*(){var e;let n=yield this.apiClient.createSignature(this.walletLocator,{type:"message",params:{message:t.message,signer:this.signer.locator(),chain:this.chain}});if("error"in n)throw new u(JSON.stringify(n));return(e=t.options)!=null&&e.experimental_prepareOnly?{signature:void 0,signatureId:n.id}:yield this.approveSignatureAndWait(n.id)})}signTypedData(t){return s(this,null,function*(){var T;let{domain:n,message:e,primaryType:i,types:a,chain:r}=t;if(!n||!e||!a||!r)throw new p("Invalid typed data");let{name:d,version:l,chainId:g,verifyingContract:h,salt:S}=n;if(!d||!l||!g||!h)throw new p("Invalid typed data domain");let o=yield this.apiClient.createSignature(this.walletLocator,{type:"typed-data",params:{typedData:{domain:{name:d,version:l,chainId:Number(g),verifyingContract:h,salt:S},message:e,primaryType:i,types:a},signer:this.signer.locator(),chain:r,isSmartWalletSignature:!1}});if("error"in o)throw new u(JSON.stringify(o));return(T=t.options)!=null&&T.experimental_prepareOnly?{signature:void 0,signatureId:o.id}:yield this.approveSignatureAndWait(o.id)})}getViemClient(t){var n;return C({transport:(n=t==null?void 0:t.transport)!=null?n:I(),chain:f(this.chain)})}createTransaction(t,n){return s(this,null,function*(){var a;let e=(a=n==null?void 0:n.experimental_signer)!=null?a:this.signer.locator(),i=yield this.apiClient.createTransaction(this.walletLocator,{params:{signer:e,chain:this.chain,calls:[t]}});if("error"in i)throw new y(JSON.stringify(i));return i})}buildTransaction(t){var n,e,i,a,r;if("transaction"in t)return{transaction:t.transaction};if(t.abi==null)return{to:t.to,value:(e=(n=t.value)==null?void 0:n.toString())!=null?e:"0",data:(i=t.data)!=null?i:"0x"};if(!t.functionName)throw new Error("Function name is required");return{to:t.to,value:(r=(a=t.value)==null?void 0:a.toString())!=null?r:"0",data:x({abi:t.abi,functionName:t.functionName,args:t.args})}}};export{m as a};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk23BRREJGcjs = require('./chunk-23BRREJG.cjs');var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk23BRREJGcjs = require('./chunk-23BRREJG.cjs');var _chunk5MEDIULYcjs = require('./chunk-5MEDIULY.cjs');var _chunkUZXJ5FAAcjs = require('./chunk-UZXJ5FAA.cjs');var _chunkO4FVTK7Xcjs = require('./chunk-O4FVTK7X.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _ox = require('ox');var u="When 'delegatedSigners' is provided to a method that may fetch an existing wallet, each specified delegated signer must exist in that wallet's configuration.",w= exports.a =class{constructor(e){this.apiClient=e}getOrCreateWallet(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(this.apiClient.isServerSide)throw new (0, _chunkO4FVTK7Xcjs.f)(`getOrCreateWallet can only be called from client-side code.
|
|
2
2
|
- Make sure you're running this in the browser (or another client environment), not on your server.
|
|
3
|
-
- Use your Crossmint Client API Key (not a server key).`);let n=yield this.apiClient.getWallet(`me:${this.getChainType(e.chain)}:smart`);return n!=null&&!("error"in n)?this.createWalletInstance(n,e):this.createWallet(e)})}getWallet(e,n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(!this.apiClient.isServerSide)throw new (0, _chunkO4FVTK7Xcjs.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, _chunkO4FVTK7Xcjs.d)(JSON.stringify(i));return this.createWalletInstance(i,n)})}createWallet(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var t,a,l,o;yield(l=(a=(t=e.options)==null?void 0:t.experimental_callbacks)==null?void 0:a.onWalletCreationStart)==null?void 0:l.call(a),this.mutateSignerFromCustomAuth(e,!0);let n=e.signer.type==="passkey"?yield this.createPasskeyAdminSigner(e.signer):e.signer,i=yield this.apiClient.createWallet({type:"smart",chainType:this.getChainType(e.chain),config:_chunkXALFCQKDcjs.a.call(void 0, _chunkXALFCQKDcjs.a.call(void 0, {adminSigner:n},e!=null&&e.plugins?{plugins:e.plugins}:{}),e.chain==="solana"&&e.delegatedSigners!=null?{delegatedSigners:e.delegatedSigners}:{}),owner:(o=e.owner)!=null?o:void 0});if("error"in i)throw new (0, _chunkO4FVTK7Xcjs.f)(JSON.stringify(i));return this.createWalletInstance(i,e)})}createWalletInstance(e,n){this.validateExistingWalletConfig(e,n);let i=this.toInternalSignerConfig(e,n.signer,n.options);return new (0,
|
|
3
|
+
- Use your Crossmint Client API Key (not a server key).`);let n=yield this.apiClient.getWallet(`me:${this.getChainType(e.chain)}:smart`);return n!=null&&!("error"in n)?this.createWalletInstance(n,e):this.createWallet(e)})}getWallet(e,n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(!this.apiClient.isServerSide)throw new (0, _chunkO4FVTK7Xcjs.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, _chunkO4FVTK7Xcjs.d)(JSON.stringify(i));return this.createWalletInstance(i,n)})}createWallet(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var t,a,l,o;yield(l=(a=(t=e.options)==null?void 0:t.experimental_callbacks)==null?void 0:a.onWalletCreationStart)==null?void 0:l.call(a),this.mutateSignerFromCustomAuth(e,!0);let n=e.signer.type==="passkey"?yield this.createPasskeyAdminSigner(e.signer):e.signer,i=yield this.apiClient.createWallet({type:"smart",chainType:this.getChainType(e.chain),config:_chunkXALFCQKDcjs.a.call(void 0, _chunkXALFCQKDcjs.a.call(void 0, {adminSigner:n},e!=null&&e.plugins?{plugins:e.plugins}:{}),e.chain==="solana"&&e.delegatedSigners!=null?{delegatedSigners:e.delegatedSigners}:{}),owner:(o=e.owner)!=null?o:void 0});if("error"in i)throw new (0, _chunkO4FVTK7Xcjs.f)(JSON.stringify(i));return this.createWalletInstance(i,e)})}createWalletInstance(e,n){this.validateExistingWalletConfig(e,n);let i=this.toInternalSignerConfig(e,n.signer,n.options);return new (0, _chunk5MEDIULYcjs.a)({chain:n.chain,address:e.address,owner:e.owner,signer:_chunkUZXJ5FAAcjs.a.call(void 0, n.chain,i),options:n.options},this.apiClient)}toInternalSignerConfig(e,n,i){var t,a,l,o,d,m;if(!(e.chainType==="evm"||e.chainType==="solana"||e.chainType==="stellar"))throw new (0, _chunkO4FVTK7Xcjs.f)(`Wallet type ${e.chainType} is not supported`);if(n==null&&((t=e.config)==null?void 0:t.adminSigner)==null)throw new (0, _chunkO4FVTK7Xcjs.f)("Signer is required to create a wallet");switch(n.type){case"api-key":{if(((a=e.config)==null?void 0:a.adminSigner.type)!=="api-key")throw new (0, _chunkO4FVTK7Xcjs.f)("API key signer does not match the wallet's signer type");return{type:"api-key",address:e.config.adminSigner.address,locator:e.config.adminSigner.locator}}case"external-wallet":if(((l=e.config)==null?void 0:l.adminSigner.type)!=="external-wallet")throw new (0, _chunkO4FVTK7Xcjs.f)("External wallet signer does not match the wallet's signer type");return _chunkXALFCQKDcjs.a.call(void 0, _chunkXALFCQKDcjs.a.call(void 0, {},e.config.adminSigner),n);case"passkey":if(((o=e.config)==null?void 0:o.adminSigner.type)!=="passkey")throw new (0, _chunkO4FVTK7Xcjs.f)("Passkey signer does not match the wallet's signer type");return{type:"passkey",id:e.config.adminSigner.id,name:e.config.adminSigner.name,locator:e.config.adminSigner.locator,onCreatePasskey:n.onCreatePasskey,onSignWithPasskey:n.onSignWithPasskey};case"email":{if(((d=e.config)==null?void 0:d.adminSigner.type)!=="email")throw new (0, _chunkO4FVTK7Xcjs.f)("Email signer does not match the wallet's signer type");let{locator:h,email:g,address:p}=e.config.adminSigner;return{type:"email",email:g,locator:h,address:p,crossmint:this.apiClient.crossmint,onAuthRequired:n.onAuthRequired,clientTEEConnection:i==null?void 0:i.clientTEEConnection}}case"phone":{if(((m=e.config)==null?void 0:m.adminSigner.type)!=="phone")throw new (0, _chunkO4FVTK7Xcjs.f)("Phone signer does not match the wallet's signer type");let{locator:h,phone:g,address:p}=e.config.adminSigner;return{type:"phone",phone:g,locator:h,address:p,crossmint:this.apiClient.crossmint,onAuthRequired:n.onAuthRequired,clientTEEConnection:i==null?void 0:i.clientTEEConnection}}default:throw new Error("Invalid signer type")}}createPasskeyAdminSigner(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var t;if(e.type!=="passkey")throw new Error("Signer is not a passkey");let n=(t=e.name)!=null?t:`Crossmint Wallet ${Date.now()}`,i=e.onCreatePasskey?yield e.onCreatePasskey(n):yield _ox.WebAuthnP256.createCredential({name:n});return{type:"passkey",id:i.id,name:n,publicKey:{x:i.publicKey.x.toString(),y:i.publicKey.y.toString()}}})}mutateSignerFromCustomAuth(e,n=!1){var t,a;let{experimental_customAuth:i}=this.apiClient.crossmint;e.signer.type==="email"&&(i==null?void 0:i.email)!=null&&(e.signer.email=(t=e.signer.email)!=null?t:i.email),e.signer.type==="phone"&&(i==null?void 0:i.phone)!=null&&(e.signer.phone=(a=e.signer.phone)!=null?a:i.phone),e.signer.type==="external-wallet"&&(i==null?void 0:i.externalWalletSigner)!=null&&(e.signer=n?{type:"external-wallet",address:i.externalWalletSigner.address}:i.externalWalletSigner)}validateExistingWalletConfig(e,n){var a;if(this.mutateSignerFromCustomAuth(n),n.owner!=null&&e.owner!=null&&n.owner!==e.owner)throw new (0, _chunkO4FVTK7Xcjs.f)("Wallet owner does not match existing wallet's linked user");if(n.chain==="solana"&&e.chainType!=="solana"||n.chain!=="solana"&&e.chainType==="solana"||n.chain==="stellar"&&e.chainType!=="stellar"||n.chain!=="stellar"&&e.chainType==="stellar")throw new (0, _chunkO4FVTK7Xcjs.f)(`Wallet chain does not match existing wallet's chain. You must use chain: ${e.chainType}.`);if(e.type!=="smart")return;let i=n.signer,t=(a=e==null?void 0:e.config)==null?void 0:a.adminSigner;if(i!=null&&t!=null){if(i.type!==t.type)throw new (0, _chunkO4FVTK7Xcjs.f)("The wallet signer type provided in the wallet config does not match the existing wallet's adminSigner type");_chunk23BRREJGcjs.a.call(void 0, i,t)}n.delegatedSigners!=null&&n.chain==="solana"&&this.validateDelegatedSigners(e,n.delegatedSigners)}validateDelegatedSigners(e,n){var t;let i=(t=e==null?void 0:e.config)==null?void 0:t.delegatedSigners;if(n.length!==0){if(i==null||i.length===0)throw new (0, _chunkO4FVTK7Xcjs.f)(`${n.length} delegated signer(s) specified, but wallet "${e.address}" has no delegated signers. ${u}`);for(let a of n)if(i.find(o=>o.locator===a.signer)==null){let o=i.map(d=>d.locator).join(", ");throw new (0, _chunkO4FVTK7Xcjs.f)(`Delegated signer '${a.signer}' does not exist in wallet "${e.address}". Available delegated signers: ${o}. ${u}`)}}}getChainType(e){return e==="solana"?"solana":e==="stellar"?"stellar":"evm"}};exports.a = w;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as O}from"./chunk-JLLQURT2.js";import{c as L,d as P,i as E,m as N,p as x,q as _,r as $,s as W,t as I,u as F,v as R,w as k,x as B}from"./chunk-PSXRNSOE.js";import{a as S,b as A,c,d as b,e as C,f as o}from"./chunk-BW7YYVZE.js";import{isValidAddress as G}from"@crossmint/common-sdk-base";var m,l,J=class{constructor(e,r){b(this,m);b(this,l);let{chain:t,address:n,owner:s,signer:d,options:g}=e;C(this,l,r),this.chain=t,this.address=n,this.owner=s,this.signer=d,C(this,m,g)}static getApiClient(e){return e.apiClient}static getOptions(e){return e.options}get apiClient(){return c(this,l)}get options(){return c(this,m)}experimental_apiClient(){return c(this,l)}balances(e,r){return o(this,null,function*(){let t;switch(this.chain){case"solana":t="sol";break;case"stellar":t="xlm";break;default:t="eth";break}let n=[t,"usdc",...e!=null?e:[]],s=yield c(this,l).getBalance(this.address,{chains:r!=null?r:[this.chain],tokens:n});if("error"in s)throw new Error(`Failed to get balances for wallet: ${JSON.stringify(s.message)}`);return this.transformBalanceResponse(s,t,e)})}transformBalanceResponse(e,r,t){let n=a=>{var f,w,v,T,y;let u=(f=a.chains)==null?void 0:f[this.chain],h=u!=null&&"contractAddress"in u?u.contractAddress:void 0;return{symbol:(w=a.symbol)!=null?w:"",name:(v=a.name)!=null?v:"",amount:(T=a.amount)!=null?T:"0",contractAddress:h,decimals:a.decimals,rawAmount:(y=a.rawAmount)!=null?y:"0"}},s=e.find(a=>a.symbol===r),d=e.find(a=>a.symbol==="usdc"),g=e.filter(a=>a.symbol!==r&&a.symbol!=="usdc"),i=a=>({symbol:a,name:a,amount:"0",contractAddress:void 0,decimals:0,rawAmount:"0"});return{nativeToken:s!=null?n(s):i(r),usdc:d!=null?n(d):i("usdc"),tokens:g.map(n)}}experimental_nfts(e){return o(this,null,function*(){return yield c(this,l).experimental_getNfts(A(S({},e),{chain:this.chain,address:this.address}))})}experimental_transactions(){return o(this,null,function*(){let e=yield c(this,l).getTransactions(this.walletLocator);if("error"in e)throw new Error(`Failed to get transactions: ${JSON.stringify(e.message)}`);return e})}experimental_transaction(e){return o(this,null,function*(){let r=yield c(this,l).getTransaction(this.walletLocator,e);if("error"in r)throw new Error(`Failed to get transaction: ${JSON.stringify(r.error)}`);return r})}experimental_activity(){return o(this,null,function*(){let e=yield this.apiClient.experimental_activity(this.walletLocator,{chain:this.chain});if("error"in e)throw new Error(`Failed to get activity: ${JSON.stringify(e.message)}`);return e})}send(e,r,t,n){return o(this,null,function*(){let s=H(e),d=M(r,this.chain),g={recipient:s,amount:t},i=yield c(this,l).send(this.walletLocator,d,g);if("message"in i)throw new $(`Failed to send token: ${JSON.stringify(i.message)}`);return n!=null&&n.experimental_prepareOnly?{hash:void 0,explorerLink:void 0,transactionId:i.id}:yield this.approveTransactionAndWait(i.id)})}approveTransaction(e){return o(this,null,function*(){return console.warn("approveTransaction is deprecated. Use approve instead. This method will be removed in the next major version."),yield this.approve(e)})}approve(e){return o(this,null,function*(){if(e.transactionId!=null)return yield this.approveTransactionAndWait(e.transactionId,e.options);if(e.signatureId!=null)return yield this.approveSignatureAndWait(e.signatureId,e.options);throw new Error("Either transactionId or signatureId must be provided")})}addDelegatedSigner(e){return o(this,null,function*(){var t;let r=yield c(this,l).registerSigner(this.walletLocator,{signer:e.signer,chain:this.chain==="solana"||this.chain==="stellar"?void 0:this.chain});if("error"in r)throw new Error(`Failed to register signer: ${JSON.stringify(r.message)}`);if("transaction"in r&&r.transaction!=null){let n=r.transaction.id;yield this.approveTransactionAndWait(n)}else if("chains"in r){let n=(t=r.chains)==null?void 0:t[this.chain];if((n==null?void 0:n.status)==="awaiting-approval"){yield this.approveSignatureAndWait(n.id);return}if((n==null?void 0:n.status)==="pending"){yield this.waitForSignature(n.id);return}}})}delegatedSigners(){return o(this,null,function*(){var r,t,n;let e=yield c(this,l).getWallet(this.walletLocator);if("error"in e)throw new P(JSON.stringify(e));if(this.chain==="stellar")return[];if(e.type!=="smart"||e.chainType!=="evm"&&e.chainType!=="solana")throw new L(`Wallet type ${e.type} not supported`);return(n=(t=(r=e==null?void 0:e.config)==null?void 0:r.delegatedSigners)==null?void 0:t.map(s=>{let d=s.locator.indexOf(":");return{signer:`external-wallet:${d>=0?s.locator.slice(d+1):s.locator}`}}))!=null?n:[]})}get walletLocator(){return c(this,l).isServerSide?this.address:this.chain==="stellar"?"me:stellar:smart":this.chain==="solana"?"me:solana:smart":"me:evm:smart"}get isSolanaWallet(){return this.chain==="solana"}approveTransactionAndWait(e,r){return o(this,null,function*(){return yield this.approveTransactionInternal(e,r),yield this.sleep(1e3),yield this.waitForTransaction(e)})}approveSignatureAndWait(e,r){return o(this,null,function*(){return yield this.approveSignatureInternal(e,r),yield this.sleep(1e3),yield this.waitForSignature(e)})}approveSignatureInternal(e,r){return o(this,null,function*(){var i,a;if(this.isSolanaWallet)throw new Error("Approving signatures is only supported for EVM smart wallets");let t=yield c(this,l).getSignature(this.walletLocator,e);if("error"in t)throw new x(JSON.stringify(t));if(this.signer.type==="api-key")return t;if((r==null?void 0:r.experimental_approval)!=null){let u=[r.experimental_approval];return yield this.executeApproveSignatureWithErrorHandling(e,u)}let n=(i=t.approvals)==null?void 0:i.pending;if(n==null)return t;let s=[...(a=r==null?void 0:r.additionalSigners)!=null?a:[],this.signer],g=(yield Promise.all(n.map(u=>{let h=s.find(f=>f.locator()===u.signer.locator);if(h==null)throw new E(`Signer ${u.signer} not found in pending approvals`);return h.signMessage(u.message)}))).map(u=>A(S({},u),{signer:this.signer.locator()}));return yield this.executeApproveSignatureWithErrorHandling(e,g)})}approveTransactionInternal(e,r){return o(this,null,function*(){var i,a,u,h,f;let t=yield c(this,l).getTransaction(this.walletLocator,e);if("error"in t)throw new W(JSON.stringify(t));if(yield(u=(a=(i=c(this,m))==null?void 0:i.experimental_callbacks)==null?void 0:a.onTransactionStart)==null?void 0:u.call(a),this.signer.type==="api-key")return t;if((r==null?void 0:r.experimental_approval)!=null){let w=[r.experimental_approval];return yield this.executeApproveTransactionWithErrorHandling(e,w)}let n=(h=t.approvals)==null?void 0:h.pending;if(n==null)return t;let s=[...(f=r==null?void 0:r.additionalSigners)!=null?f:[],this.signer],g=(yield Promise.all(n.map(w=>{let v=s.find(y=>y.locator()===w.signer.locator);if(v==null)throw new E(`Signer ${w.signer} not found in pending approvals`);let T=t.chainType==="solana"&&"transaction"in t.onChain?t.onChain.transaction:w.message;return v.signTransaction(T)}))).map(w=>A(S({},w),{signer:this.signer.locator()}));return yield this.executeApproveTransactionWithErrorHandling(e,g)})}executeApproveTransactionWithErrorHandling(e,r){return o(this,null,function*(){let t=yield c(this,l).approveTransaction(this.walletLocator,e,{approvals:r});if(t.error)throw new B(JSON.stringify(t));return t})}executeApproveSignatureWithErrorHandling(e,r){return o(this,null,function*(){let t=yield c(this,l).approveSignature(this.walletLocator,e,{approvals:r});if(t.error)throw new _(JSON.stringify(t));return t})}waitForSignature(e){return o(this,null,function*(){let r=null;do if(yield new Promise(t=>setTimeout(t,O)),r=yield c(this,l).getSignature(this.walletLocator,e),"error"in r)throw new x(JSON.stringify(r));while(r===null||r.status==="pending");if(r.status==="failed")throw new N("Signature signing failed");if(!r.outputSignature)throw new x("Signature not available");return{signature:r.outputSignature,signatureId:e}})}waitForTransaction(d){return o(this,arguments,function*(e,r=6e4,{backoffMultiplier:t=1.1,maxBackoffMs:n=2e3,initialBackoffMs:s=O}={}){var u;let g=Date.now(),i;do{if(Date.now()-g>r)throw new I("Transaction confirmation timeout");if(i=yield c(this,l).getTransaction(this.walletLocator,e),i.error)throw new W(JSON.stringify(i));yield this.sleep(s),s=Math.min(s*t,n)}while(i.status==="pending");if(i.status==="failed")throw new F(`Transaction sending failed: ${JSON.stringify(i.error)}`);if(i.status==="awaiting-approval")throw new R("Transaction is awaiting approval. Please submit required approvals before waiting for completion.");let a=i.onChain.txId;if(a==null)throw new k("Transaction hash not found on transaction response");return{hash:a,explorerLink:(u=i.onChain.explorerLink)!=null?u:"",transactionId:i.id}})}sleep(e){return o(this,null,function*(){return new Promise(r=>setTimeout(r,e))})}};m=new WeakMap,l=new WeakMap;function H(p){if(typeof p=="string")return p;if("email"in p)return`email:${p.email}`;if("x"in p)return`x:${p.x}`;if("twitter"in p)return`twitter:${p.twitter}`;if("phone"in p)return`phoneNumber:${p.phone}`;if("userId"in p)return`userId:${p.userId}`;throw new Error("Invalid recipient locator")}function M(p,e){return G(p)?`${e}:${p}`:`${e}:${p.toLowerCase()}`}export{J as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk5MEDIULYcjs = require('./chunk-5MEDIULY.cjs');var _chunkO4FVTK7Xcjs = require('./chunk-O4FVTK7X.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var l=class d extends _chunk5MEDIULYcjs.a{constructor(n){super({chain:n.chain,address:n.address,owner:n.owner,signer:n.signer,options:_chunk5MEDIULYcjs.a.getOptions(n)},_chunk5MEDIULYcjs.a.getApiClient(n))}static from(n){if(!_commonsdkbase.isValidStellarAddress.call(void 0, n.address))throw new Error("Wallet is not a Stellar wallet");return new d(n)}sendTransaction(n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var t;let e=yield this.createTransaction(n);if((t=n.options)!=null&&t.experimental_prepareOnly)return{hash:void 0,explorerLink:void 0,transactionId:e.id};let r={};return yield this.approveTransactionAndWait(e.id,r)})}createTransaction(x){return _chunkXALFCQKDcjs.f.call(void 0, this,arguments,function*({contractId:n,method:e,memo:r,args:t,options:i}){var c;let u=(c=i==null?void 0:i.experimental_signer)!=null?c:this.signer.locator(),s=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:{type:"contract-call",contractId:n,method:e,memo:r!=null?{type:"text",value:r}:void 0,args:t},signer:u}});if("error"in s)throw new (0, _chunkO4FVTK7Xcjs.r)(JSON.stringify(s));return s})}};exports.a = l;
|
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 _chunkB4QFWMS6cjs = require('./chunk-B4QFWMS6.cjs');var _chunkSSVNEBWEcjs = require('./chunk-SSVNEBWE.cjs');var _chunkXQ5PORFCcjs = require('./chunk-XQ5PORFC.cjs');var _chunkAEXV7M7Xcjs = require('./chunk-AEXV7M7X.cjs');require('./chunk-U7C5HG3Y.cjs');require('./chunk-23BRREJG.cjs');var _chunk5MEDIULYcjs = require('./chunk-5MEDIULY.cjs');require('./chunk-UZXJ5FAA.cjs');require('./chunk-PO6S7UR3.cjs');require('./chunk-UT2U6NWW.cjs');require('./chunk-NPXTLMYS.cjs');require('./chunk-GNL4RC2A.cjs');require('./chunk-C3K5DA3W.cjs');require('./chunk-MQP5VZCA.cjs');require('./chunk-YWPTI2QO.cjs');require('./chunk-4KXOWU5E.cjs');require('./chunk-HRSVFJND.cjs');require('./chunk-C3T63EC7.cjs');require('./chunk-ZSWIQU3U.cjs');require('./chunk-6HXIZLEQ.cjs');var _chunkKEE7SKIFcjs = require('./chunk-KEE7SKIF.cjs');require('./chunk-M7ZMIRW6.cjs');require('./chunk-O4FVTK7X.cjs');require('./chunk-ECAM5KTH.cjs');require('./chunk-CU6FZ36V.cjs');require('./chunk-IR5WN6FQ.cjs');require('./chunk-GEY574TH.cjs');require('./chunk-YZ4HRYSL.cjs');require('./chunk-M4TOGGLV.cjs');require('./chunk-XALFCQKD.cjs');exports.CrossmintWallets = _chunkAEXV7M7Xcjs.b; exports.EVMWallet = _chunkB4QFWMS6cjs.a; exports.SolanaWallet = _chunkSSVNEBWEcjs.a; exports.StellarWallet = _chunkXQ5PORFCcjs.a; exports.Wallet = _chunk5MEDIULYcjs.a; exports.WalletsApiClient = _chunkKEE7SKIFcjs.a; exports.createCrossmint = _chunkAEXV7M7Xcjs.a;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as r}from"./chunk-
|
|
1
|
+
import{a as r}from"./chunk-TCZTUYVT.js";import{a as l}from"./chunk-PZGC5E75.js";import{a as i}from"./chunk-EBNQ6AC3.js";import{a as n,b as t}from"./chunk-4F7RMMET.js";import"./chunk-QK2J65W4.js";import"./chunk-BHGNJYYE.js";import{a}from"./chunk-VXYHBIHJ.js";import"./chunk-7BEMA3KG.js";import"./chunk-YDZRBHS3.js";import"./chunk-SK57FHH2.js";import"./chunk-HWWYX2CY.js";import"./chunk-V7O6CCYZ.js";import"./chunk-KRAAV3FK.js";import"./chunk-JUSY5XEE.js";import"./chunk-UBOWSXW3.js";import"./chunk-IGBQEAD5.js";import"./chunk-6PVKL5RC.js";import"./chunk-2SHDBC47.js";import"./chunk-M4ELAV7U.js";import"./chunk-5IFDVB4Y.js";import{a as e}from"./chunk-PBTKTO3K.js";import"./chunk-JLLQURT2.js";import"./chunk-PSXRNSOE.js";import"./chunk-KBJA7JDT.js";import"./chunk-I5COKXOT.js";import"./chunk-KKQBZXFE.js";import"./chunk-S3DYQVRD.js";import"./chunk-LW6JSI4J.js";import"./chunk-3APSOOE3.js";import"./chunk-BW7YYVZE.js";export{t as CrossmintWallets,r as EVMWallet,l as SolanaWallet,i as StellarWallet,a as Wallet,e as WalletsApiClient,n as createCrossmint};
|
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 _chunkAEXV7M7Xcjs = require('./chunk-AEXV7M7X.cjs');require('./chunk-U7C5HG3Y.cjs');require('./chunk-23BRREJG.cjs');require('./chunk-5MEDIULY.cjs');require('./chunk-UZXJ5FAA.cjs');require('./chunk-PO6S7UR3.cjs');require('./chunk-UT2U6NWW.cjs');require('./chunk-NPXTLMYS.cjs');require('./chunk-GNL4RC2A.cjs');require('./chunk-C3K5DA3W.cjs');require('./chunk-MQP5VZCA.cjs');require('./chunk-YWPTI2QO.cjs');require('./chunk-4KXOWU5E.cjs');require('./chunk-HRSVFJND.cjs');require('./chunk-C3T63EC7.cjs');require('./chunk-ZSWIQU3U.cjs');require('./chunk-6HXIZLEQ.cjs');require('./chunk-KEE7SKIF.cjs');require('./chunk-M7ZMIRW6.cjs');require('./chunk-O4FVTK7X.cjs');require('./chunk-ECAM5KTH.cjs');require('./chunk-YZ4HRYSL.cjs');require('./chunk-M4TOGGLV.cjs');require('./chunk-XALFCQKD.cjs');exports.CrossmintWallets = _chunkAEXV7M7Xcjs.b; exports.createCrossmint = _chunkAEXV7M7Xcjs.a;
|
package/dist/sdk.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b}from"./chunk-
|
|
1
|
+
import{a,b}from"./chunk-4F7RMMET.js";import"./chunk-QK2J65W4.js";import"./chunk-BHGNJYYE.js";import"./chunk-VXYHBIHJ.js";import"./chunk-7BEMA3KG.js";import"./chunk-YDZRBHS3.js";import"./chunk-SK57FHH2.js";import"./chunk-HWWYX2CY.js";import"./chunk-V7O6CCYZ.js";import"./chunk-KRAAV3FK.js";import"./chunk-JUSY5XEE.js";import"./chunk-UBOWSXW3.js";import"./chunk-IGBQEAD5.js";import"./chunk-6PVKL5RC.js";import"./chunk-2SHDBC47.js";import"./chunk-M4ELAV7U.js";import"./chunk-5IFDVB4Y.js";import"./chunk-PBTKTO3K.js";import"./chunk-JLLQURT2.js";import"./chunk-PSXRNSOE.js";import"./chunk-KBJA7JDT.js";import"./chunk-LW6JSI4J.js";import"./chunk-3APSOOE3.js";import"./chunk-BW7YYVZE.js";export{b as CrossmintWallets,a as createCrossmint};
|
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 _chunkM7ZMIRW6cjs = require('../chunk-M7ZMIRW6.cjs');require('../chunk-XALFCQKD.cjs');exports.SDK_NAME = _chunkM7ZMIRW6cjs.c; exports.SDK_VERSION = _chunkM7ZMIRW6cjs.b; exports.STATUS_POLLING_INTERVAL_MS = _chunkM7ZMIRW6cjs.d; exports.WALLETS_SERVICE = _chunkM7ZMIRW6cjs.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-JLLQURT2.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 _chunkB4QFWMS6cjs = require('../chunk-B4QFWMS6.cjs');require('../chunk-5MEDIULY.cjs');require('../chunk-M7ZMIRW6.cjs');require('../chunk-O4FVTK7X.cjs');require('../chunk-CU6FZ36V.cjs');require('../chunk-IR5WN6FQ.cjs');require('../chunk-GEY574TH.cjs');require('../chunk-XALFCQKD.cjs');exports.EVMWallet = _chunkB4QFWMS6cjs.a;
|
package/dist/wallets/evm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-TCZTUYVT.js";import"../chunk-VXYHBIHJ.js";import"../chunk-JLLQURT2.js";import"../chunk-PSXRNSOE.js";import"../chunk-I5COKXOT.js";import"../chunk-KKQBZXFE.js";import"../chunk-S3DYQVRD.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 _chunkSSVNEBWEcjs = require('../chunk-SSVNEBWE.cjs');require('../chunk-5MEDIULY.cjs');require('../chunk-HRSVFJND.cjs');require('../chunk-M7ZMIRW6.cjs');require('../chunk-O4FVTK7X.cjs');require('../chunk-XALFCQKD.cjs');exports.SolanaWallet = _chunkSSVNEBWEcjs.a;
|
package/dist/wallets/solana.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-PZGC5E75.js";import"../chunk-VXYHBIHJ.js";import"../chunk-6PVKL5RC.js";import"../chunk-JLLQURT2.js";import"../chunk-PSXRNSOE.js";import"../chunk-BW7YYVZE.js";export{a as SolanaWallet};
|
package/dist/wallets/stellar.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkXQ5PORFCcjs = require('../chunk-XQ5PORFC.cjs');require('../chunk-5MEDIULY.cjs');require('../chunk-M7ZMIRW6.cjs');require('../chunk-O4FVTK7X.cjs');require('../chunk-XALFCQKD.cjs');exports.StellarWallet = _chunkXQ5PORFCcjs.a;
|
package/dist/wallets/stellar.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-EBNQ6AC3.js";import"../chunk-VXYHBIHJ.js";import"../chunk-JLLQURT2.js";import"../chunk-PSXRNSOE.js";import"../chunk-BW7YYVZE.js";export{a as StellarWallet};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkU7C5HG3Ycjs = require('../chunk-U7C5HG3Y.cjs');require('../chunk-23BRREJG.cjs');require('../chunk-5MEDIULY.cjs');require('../chunk-UZXJ5FAA.cjs');require('../chunk-PO6S7UR3.cjs');require('../chunk-UT2U6NWW.cjs');require('../chunk-NPXTLMYS.cjs');require('../chunk-GNL4RC2A.cjs');require('../chunk-C3K5DA3W.cjs');require('../chunk-MQP5VZCA.cjs');require('../chunk-YWPTI2QO.cjs');require('../chunk-4KXOWU5E.cjs');require('../chunk-HRSVFJND.cjs');require('../chunk-C3T63EC7.cjs');require('../chunk-ZSWIQU3U.cjs');require('../chunk-M7ZMIRW6.cjs');require('../chunk-O4FVTK7X.cjs');require('../chunk-YZ4HRYSL.cjs');require('../chunk-M4TOGGLV.cjs');require('../chunk-XALFCQKD.cjs');exports.WalletFactory = _chunkU7C5HG3Ycjs.a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-QK2J65W4.js";import"../chunk-BHGNJYYE.js";import"../chunk-VXYHBIHJ.js";import"../chunk-7BEMA3KG.js";import"../chunk-YDZRBHS3.js";import"../chunk-SK57FHH2.js";import"../chunk-HWWYX2CY.js";import"../chunk-V7O6CCYZ.js";import"../chunk-KRAAV3FK.js";import"../chunk-JUSY5XEE.js";import"../chunk-UBOWSXW3.js";import"../chunk-IGBQEAD5.js";import"../chunk-6PVKL5RC.js";import"../chunk-2SHDBC47.js";import"../chunk-M4ELAV7U.js";import"../chunk-JLLQURT2.js";import"../chunk-PSXRNSOE.js";import"../chunk-LW6JSI4J.js";import"../chunk-3APSOOE3.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 _chunk5MEDIULYcjs = require('../chunk-5MEDIULY.cjs');require('../chunk-M7ZMIRW6.cjs');require('../chunk-O4FVTK7X.cjs');require('../chunk-XALFCQKD.cjs');exports.Wallet = _chunk5MEDIULYcjs.a;
|
package/dist/wallets/wallet.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-VXYHBIHJ.js";import"../chunk-JLLQURT2.js";import"../chunk-PSXRNSOE.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.12.
|
|
3
|
+
"version": "0.12.3",
|
|
4
4
|
"repository": "https://github.com/Crossmint/crossmint-sdk",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Paella Labs Inc",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"tweetnacl": "1.0.3",
|
|
28
28
|
"viem": "2.33.1",
|
|
29
29
|
"@crossmint/client-sdk-window": "1.0.3",
|
|
30
|
-
"@crossmint/
|
|
31
|
-
"@crossmint/
|
|
30
|
+
"@crossmint/client-signers": "0.0.20",
|
|
31
|
+
"@crossmint/common-sdk-base": "0.9.4"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@hey-api/openapi-ts": "0.69.2",
|
package/dist/chunk-LE7DYESO.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var s="@crossmint/wallets-sdk",t="0.12.1";var r="WALLETS_SDK",c=t,a=s,d=500;export{r as a,c as b,a as c,d};
|
package/dist/chunk-VMBMJTB4.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk7SA335PZcjs = require('./chunk-7SA335PZ.cjs');var _chunkO4FVTK7Xcjs = require('./chunk-O4FVTK7X.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var m,c,G= exports.a =class{constructor(r,e){_chunkXALFCQKDcjs.d.call(void 0, this,m);_chunkXALFCQKDcjs.d.call(void 0, this,c);let{chain:t,address:n,owner:s,signer:d,options:g}=r;_chunkXALFCQKDcjs.e.call(void 0, this,c,e),this.chain=t,this.address=n,this.owner=s,this.signer=d,_chunkXALFCQKDcjs.e.call(void 0, this,m,g)}static getApiClient(r){return r.apiClient}static getOptions(r){return r.options}get apiClient(){return _chunkXALFCQKDcjs.c.call(void 0, this,c)}get options(){return _chunkXALFCQKDcjs.c.call(void 0, this,m)}experimental_apiClient(){return _chunkXALFCQKDcjs.c.call(void 0, this,c)}balances(r,e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let t;switch(this.chain){case"solana":t="sol";break;case"stellar":t="xlm";break;default:t="eth";break}let n=[t,"usdc",...r!=null?r:[]],s=yield _chunkXALFCQKDcjs.c.call(void 0, this,c).getBalance(this.address,{chains:e!=null?e:[this.chain],tokens:n});if("error"in s)throw new Error(`Failed to get balances for wallet: ${JSON.stringify(s.message)}`);return this.transformBalanceResponse(s,t,r)})}transformBalanceResponse(r,e,t){let n=a=>{var f,w,v,T,y;let o=(f=a.chains)==null?void 0:f[this.chain],h=o!=null&&"contractAddress"in o?o.contractAddress:void 0;return{symbol:(w=a.symbol)!=null?w:"",name:(v=a.name)!=null?v:"",amount:(T=a.amount)!=null?T:"0",contractAddress:h,decimals:a.decimals,rawAmount:(y=a.rawAmount)!=null?y:"0"}},s=r.find(a=>a.symbol===e),d=r.find(a=>a.symbol==="usdc"),g=r.filter(a=>{var o;return a.symbol!==e&&a.symbol!=="usdc"&&(t==null?void 0:t.includes((o=a.symbol)!=null?o:""))}),i=a=>({symbol:a,name:a,amount:"0",contractAddress:void 0,decimals:0,rawAmount:"0"});return{nativeToken:s!=null?n(s):i(e),usdc:d!=null?n(d):i("usdc"),tokens:g.map(n)}}experimental_nfts(r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield _chunkXALFCQKDcjs.c.call(void 0, this,c).experimental_getNfts(_chunkXALFCQKDcjs.b.call(void 0, _chunkXALFCQKDcjs.a.call(void 0, {},r),{chain:this.chain,address:this.address}))})}experimental_transactions(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let r=yield _chunkXALFCQKDcjs.c.call(void 0, this,c).getTransactions(this.walletLocator);if("error"in r)throw new Error(`Failed to get transactions: ${JSON.stringify(r.message)}`);return r})}experimental_transaction(r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let e=yield _chunkXALFCQKDcjs.c.call(void 0, this,c).getTransaction(this.walletLocator,r);if("error"in e)throw new Error(`Failed to get transaction: ${JSON.stringify(e.error)}`);return e})}experimental_activity(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let r=yield this.apiClient.experimental_activity(this.walletLocator,{chain:this.chain});if("error"in r)throw new Error(`Failed to get activity: ${JSON.stringify(r.message)}`);return r})}send(r,e,t,n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let s=H(r),d=M(e,this.chain),g={recipient:s,amount:t},i=yield _chunkXALFCQKDcjs.c.call(void 0, this,c).send(this.walletLocator,d,g);if("message"in i)throw new (0, _chunkO4FVTK7Xcjs.r)(`Failed to send token: ${JSON.stringify(i.message)}`);return n!=null&&n.experimental_prepareOnly?{hash:void 0,explorerLink:void 0,transactionId:i.id}:yield this.approveTransactionAndWait(i.id)})}approveTransaction(r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return console.warn("approveTransaction is deprecated. Use approve instead. This method will be removed in the next major version."),yield this.approve(r)})}approve(r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(r.transactionId!=null)return yield this.approveTransactionAndWait(r.transactionId,r.options);if(r.signatureId!=null)return yield this.approveSignatureAndWait(r.signatureId,r.options);throw new Error("Either transactionId or signatureId must be provided")})}addDelegatedSigner(r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var t;let e=yield _chunkXALFCQKDcjs.c.call(void 0, this,c).registerSigner(this.walletLocator,{signer:r.signer,chain:this.chain==="solana"||this.chain==="stellar"?void 0:this.chain});if("error"in e)throw new Error(`Failed to register signer: ${JSON.stringify(e.message)}`);if("transaction"in e&&e.transaction!=null){let n=e.transaction.id;yield this.approveTransactionAndWait(n)}else if("chains"in e){let n=(t=e.chains)==null?void 0:t[this.chain];if((n==null?void 0:n.status)==="awaiting-approval"){yield this.approveSignatureAndWait(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,t,n;let r=yield _chunkXALFCQKDcjs.c.call(void 0, this,c).getWallet(this.walletLocator);if("error"in r)throw new (0, _chunkO4FVTK7Xcjs.d)(JSON.stringify(r));if(this.chain==="stellar")return[];if(r.type!=="smart"||r.chainType!=="evm"&&r.chainType!=="solana")throw new (0, _chunkO4FVTK7Xcjs.c)(`Wallet type ${r.type} not supported`);return(n=(t=(e=r==null?void 0:r.config)==null?void 0:e.delegatedSigners)==null?void 0:t.map(s=>{let d=s.locator.indexOf(":");return{signer:`external-wallet:${d>=0?s.locator.slice(d+1):s.locator}`}}))!=null?n:[]})}get walletLocator(){return _chunkXALFCQKDcjs.c.call(void 0, this,c).isServerSide?this.address:this.chain==="stellar"?"me:stellar:smart":this.chain==="solana"?"me:solana:smart":"me:evm:smart"}get isSolanaWallet(){return this.chain==="solana"}approveTransactionAndWait(r,e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.approveTransactionInternal(r,e),yield this.sleep(1e3),yield this.waitForTransaction(r)})}approveSignatureAndWait(r,e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.approveSignatureInternal(r,e),yield this.sleep(1e3),yield this.waitForSignature(r)})}approveSignatureInternal(r,e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var i,a;if(this.isSolanaWallet)throw new Error("Approving signatures is only supported for EVM smart wallets");let t=yield _chunkXALFCQKDcjs.c.call(void 0, this,c).getSignature(this.walletLocator,r);if("error"in t)throw new (0, _chunkO4FVTK7Xcjs.p)(JSON.stringify(t));if(this.signer.type==="api-key")return t;if((e==null?void 0:e.experimental_approval)!=null){let o=[e.experimental_approval];return yield this.executeApproveSignatureWithErrorHandling(r,o)}let n=(i=t.approvals)==null?void 0:i.pending;if(n==null)return t;let s=[...(a=e==null?void 0:e.additionalSigners)!=null?a:[],this.signer],g=(yield Promise.all(n.map(o=>{let h=s.find(f=>f.locator()===o.signer.locator);if(h==null)throw new (0, _chunkO4FVTK7Xcjs.i)(`Signer ${o.signer} not found in pending approvals`);return h.signMessage(o.message)}))).map(o=>_chunkXALFCQKDcjs.b.call(void 0, _chunkXALFCQKDcjs.a.call(void 0, {},o),{signer:this.signer.locator()}));return yield this.executeApproveSignatureWithErrorHandling(r,g)})}approveTransactionInternal(r,e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var i,a,o,h,f;let t=yield _chunkXALFCQKDcjs.c.call(void 0, this,c).getTransaction(this.walletLocator,r);if("error"in t)throw new (0, _chunkO4FVTK7Xcjs.s)(JSON.stringify(t));if(yield(o=(a=(i=_chunkXALFCQKDcjs.c.call(void 0, this,m))==null?void 0:i.experimental_callbacks)==null?void 0:a.onTransactionStart)==null?void 0:o.call(a),this.signer.type==="api-key")return t;if((e==null?void 0:e.experimental_approval)!=null){let w=[e.experimental_approval];return yield this.executeApproveTransactionWithErrorHandling(r,w)}let n=(h=t.approvals)==null?void 0:h.pending;if(n==null)return t;let s=[...(f=e==null?void 0:e.additionalSigners)!=null?f:[],this.signer],g=(yield Promise.all(n.map(w=>{let v=s.find(y=>y.locator()===w.signer.locator);if(v==null)throw new (0, _chunkO4FVTK7Xcjs.i)(`Signer ${w.signer} not found in pending approvals`);let T=t.chainType==="solana"&&"transaction"in t.onChain?t.onChain.transaction:w.message;return v.signTransaction(T)}))).map(w=>_chunkXALFCQKDcjs.b.call(void 0, _chunkXALFCQKDcjs.a.call(void 0, {},w),{signer:this.signer.locator()}));return yield this.executeApproveTransactionWithErrorHandling(r,g)})}executeApproveTransactionWithErrorHandling(r,e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let t=yield _chunkXALFCQKDcjs.c.call(void 0, this,c).approveTransaction(this.walletLocator,r,{approvals:e});if(t.error)throw new (0, _chunkO4FVTK7Xcjs.x)(JSON.stringify(t));return t})}executeApproveSignatureWithErrorHandling(r,e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let t=yield _chunkXALFCQKDcjs.c.call(void 0, this,c).approveSignature(this.walletLocator,r,{approvals:e});if(t.error)throw new (0, _chunkO4FVTK7Xcjs.q)(JSON.stringify(t));return t})}waitForSignature(r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let e=null;do if(yield new Promise(t=>setTimeout(t,_chunk7SA335PZcjs.d)),e=yield _chunkXALFCQKDcjs.c.call(void 0, this,c).getSignature(this.walletLocator,r),"error"in e)throw new (0, _chunkO4FVTK7Xcjs.p)(JSON.stringify(e));while(e===null||e.status==="pending");if(e.status==="failed")throw new (0, _chunkO4FVTK7Xcjs.m)("Signature signing failed");if(!e.outputSignature)throw new (0, _chunkO4FVTK7Xcjs.p)("Signature not available");return{signature:e.outputSignature,signatureId:r}})}waitForTransaction(d){return _chunkXALFCQKDcjs.f.call(void 0, this,arguments,function*(r,e=6e4,{backoffMultiplier:t=1.1,maxBackoffMs:n=2e3,initialBackoffMs:s=_chunk7SA335PZcjs.d}={}){var o;let g=Date.now(),i;do{if(Date.now()-g>e)throw new (0, _chunkO4FVTK7Xcjs.t)("Transaction confirmation timeout");if(i=yield _chunkXALFCQKDcjs.c.call(void 0, this,c).getTransaction(this.walletLocator,r),i.error)throw new (0, _chunkO4FVTK7Xcjs.s)(JSON.stringify(i));yield this.sleep(s),s=Math.min(s*t,n)}while(i.status==="pending");if(i.status==="failed")throw new (0, _chunkO4FVTK7Xcjs.u)(`Transaction sending failed: ${JSON.stringify(i.error)}`);if(i.status==="awaiting-approval")throw new (0, _chunkO4FVTK7Xcjs.v)("Transaction is awaiting approval. Please submit required approvals before waiting for completion.");let a=i.onChain.txId;if(a==null)throw new (0, _chunkO4FVTK7Xcjs.w)("Transaction hash not found on transaction response");return{hash:a,explorerLink:(o=i.onChain.explorerLink)!=null?o:"",transactionId:i.id}})}sleep(r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return new Promise(e=>setTimeout(e,r))})}};m=new WeakMap,c=new WeakMap;function H(u){if(typeof u=="string")return u;if("email"in u)return`email:${u.email}`;if("x"in u)return`x:${u.x}`;if("twitter"in u)return`twitter:${u.twitter}`;if("phone"in u)return`phoneNumber:${u.phone}`;if("userId"in u)return`userId:${u.userId}`;throw new Error("Invalid recipient locator")}function M(u,r){return _commonsdkbase.isValidAddress.call(void 0, u)?`${r}:${u}`:`${r}:${u.toLowerCase()}`}exports.a = G;
|
package/dist/chunk-XFNHQ4RR.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as O}from"./chunk-LE7DYESO.js";import{c as L,d as P,i as E,m as N,p as b,q as _,r as $,s as W,t as I,u as F,v as R,w as B,x as J}from"./chunk-PSXRNSOE.js";import{a as S,b as A,c as p,d as x,e as C,f as l}from"./chunk-BW7YYVZE.js";import{isValidAddress as k}from"@crossmint/common-sdk-base";var m,c,G=class{constructor(r,e){x(this,m);x(this,c);let{chain:t,address:n,owner:s,signer:d,options:g}=r;C(this,c,e),this.chain=t,this.address=n,this.owner=s,this.signer=d,C(this,m,g)}static getApiClient(r){return r.apiClient}static getOptions(r){return r.options}get apiClient(){return p(this,c)}get options(){return p(this,m)}experimental_apiClient(){return p(this,c)}balances(r,e){return l(this,null,function*(){let t;switch(this.chain){case"solana":t="sol";break;case"stellar":t="xlm";break;default:t="eth";break}let n=[t,"usdc",...r!=null?r:[]],s=yield p(this,c).getBalance(this.address,{chains:e!=null?e:[this.chain],tokens:n});if("error"in s)throw new Error(`Failed to get balances for wallet: ${JSON.stringify(s.message)}`);return this.transformBalanceResponse(s,t,r)})}transformBalanceResponse(r,e,t){let n=a=>{var f,w,v,T,y;let o=(f=a.chains)==null?void 0:f[this.chain],h=o!=null&&"contractAddress"in o?o.contractAddress:void 0;return{symbol:(w=a.symbol)!=null?w:"",name:(v=a.name)!=null?v:"",amount:(T=a.amount)!=null?T:"0",contractAddress:h,decimals:a.decimals,rawAmount:(y=a.rawAmount)!=null?y:"0"}},s=r.find(a=>a.symbol===e),d=r.find(a=>a.symbol==="usdc"),g=r.filter(a=>{var o;return a.symbol!==e&&a.symbol!=="usdc"&&(t==null?void 0:t.includes((o=a.symbol)!=null?o:""))}),i=a=>({symbol:a,name:a,amount:"0",contractAddress:void 0,decimals:0,rawAmount:"0"});return{nativeToken:s!=null?n(s):i(e),usdc:d!=null?n(d):i("usdc"),tokens:g.map(n)}}experimental_nfts(r){return l(this,null,function*(){return yield p(this,c).experimental_getNfts(A(S({},r),{chain:this.chain,address:this.address}))})}experimental_transactions(){return l(this,null,function*(){let r=yield p(this,c).getTransactions(this.walletLocator);if("error"in r)throw new Error(`Failed to get transactions: ${JSON.stringify(r.message)}`);return r})}experimental_transaction(r){return l(this,null,function*(){let e=yield p(this,c).getTransaction(this.walletLocator,r);if("error"in e)throw new Error(`Failed to get transaction: ${JSON.stringify(e.error)}`);return e})}experimental_activity(){return l(this,null,function*(){let r=yield this.apiClient.experimental_activity(this.walletLocator,{chain:this.chain});if("error"in r)throw new Error(`Failed to get activity: ${JSON.stringify(r.message)}`);return r})}send(r,e,t,n){return l(this,null,function*(){let s=H(r),d=M(e,this.chain),g={recipient:s,amount:t},i=yield p(this,c).send(this.walletLocator,d,g);if("message"in i)throw new $(`Failed to send token: ${JSON.stringify(i.message)}`);return n!=null&&n.experimental_prepareOnly?{hash:void 0,explorerLink:void 0,transactionId:i.id}:yield this.approveTransactionAndWait(i.id)})}approveTransaction(r){return l(this,null,function*(){return console.warn("approveTransaction is deprecated. Use approve instead. This method will be removed in the next major version."),yield this.approve(r)})}approve(r){return l(this,null,function*(){if(r.transactionId!=null)return yield this.approveTransactionAndWait(r.transactionId,r.options);if(r.signatureId!=null)return yield this.approveSignatureAndWait(r.signatureId,r.options);throw new Error("Either transactionId or signatureId must be provided")})}addDelegatedSigner(r){return l(this,null,function*(){var t;let e=yield p(this,c).registerSigner(this.walletLocator,{signer:r.signer,chain:this.chain==="solana"||this.chain==="stellar"?void 0:this.chain});if("error"in e)throw new Error(`Failed to register signer: ${JSON.stringify(e.message)}`);if("transaction"in e&&e.transaction!=null){let n=e.transaction.id;yield this.approveTransactionAndWait(n)}else if("chains"in e){let n=(t=e.chains)==null?void 0:t[this.chain];if((n==null?void 0:n.status)==="awaiting-approval"){yield this.approveSignatureAndWait(n.id);return}if((n==null?void 0:n.status)==="pending"){yield this.waitForSignature(n.id);return}}})}delegatedSigners(){return l(this,null,function*(){var e,t,n;let r=yield p(this,c).getWallet(this.walletLocator);if("error"in r)throw new P(JSON.stringify(r));if(this.chain==="stellar")return[];if(r.type!=="smart"||r.chainType!=="evm"&&r.chainType!=="solana")throw new L(`Wallet type ${r.type} not supported`);return(n=(t=(e=r==null?void 0:r.config)==null?void 0:e.delegatedSigners)==null?void 0:t.map(s=>{let d=s.locator.indexOf(":");return{signer:`external-wallet:${d>=0?s.locator.slice(d+1):s.locator}`}}))!=null?n:[]})}get walletLocator(){return p(this,c).isServerSide?this.address:this.chain==="stellar"?"me:stellar:smart":this.chain==="solana"?"me:solana:smart":"me:evm:smart"}get isSolanaWallet(){return this.chain==="solana"}approveTransactionAndWait(r,e){return l(this,null,function*(){return yield this.approveTransactionInternal(r,e),yield this.sleep(1e3),yield this.waitForTransaction(r)})}approveSignatureAndWait(r,e){return l(this,null,function*(){return yield this.approveSignatureInternal(r,e),yield this.sleep(1e3),yield this.waitForSignature(r)})}approveSignatureInternal(r,e){return l(this,null,function*(){var i,a;if(this.isSolanaWallet)throw new Error("Approving signatures is only supported for EVM smart wallets");let t=yield p(this,c).getSignature(this.walletLocator,r);if("error"in t)throw new b(JSON.stringify(t));if(this.signer.type==="api-key")return t;if((e==null?void 0:e.experimental_approval)!=null){let o=[e.experimental_approval];return yield this.executeApproveSignatureWithErrorHandling(r,o)}let n=(i=t.approvals)==null?void 0:i.pending;if(n==null)return t;let s=[...(a=e==null?void 0:e.additionalSigners)!=null?a:[],this.signer],g=(yield Promise.all(n.map(o=>{let h=s.find(f=>f.locator()===o.signer.locator);if(h==null)throw new E(`Signer ${o.signer} not found in pending approvals`);return h.signMessage(o.message)}))).map(o=>A(S({},o),{signer:this.signer.locator()}));return yield this.executeApproveSignatureWithErrorHandling(r,g)})}approveTransactionInternal(r,e){return l(this,null,function*(){var i,a,o,h,f;let t=yield p(this,c).getTransaction(this.walletLocator,r);if("error"in t)throw new W(JSON.stringify(t));if(yield(o=(a=(i=p(this,m))==null?void 0:i.experimental_callbacks)==null?void 0:a.onTransactionStart)==null?void 0:o.call(a),this.signer.type==="api-key")return t;if((e==null?void 0:e.experimental_approval)!=null){let w=[e.experimental_approval];return yield this.executeApproveTransactionWithErrorHandling(r,w)}let n=(h=t.approvals)==null?void 0:h.pending;if(n==null)return t;let s=[...(f=e==null?void 0:e.additionalSigners)!=null?f:[],this.signer],g=(yield Promise.all(n.map(w=>{let v=s.find(y=>y.locator()===w.signer.locator);if(v==null)throw new E(`Signer ${w.signer} not found in pending approvals`);let T=t.chainType==="solana"&&"transaction"in t.onChain?t.onChain.transaction:w.message;return v.signTransaction(T)}))).map(w=>A(S({},w),{signer:this.signer.locator()}));return yield this.executeApproveTransactionWithErrorHandling(r,g)})}executeApproveTransactionWithErrorHandling(r,e){return l(this,null,function*(){let t=yield p(this,c).approveTransaction(this.walletLocator,r,{approvals:e});if(t.error)throw new J(JSON.stringify(t));return t})}executeApproveSignatureWithErrorHandling(r,e){return l(this,null,function*(){let t=yield p(this,c).approveSignature(this.walletLocator,r,{approvals:e});if(t.error)throw new _(JSON.stringify(t));return t})}waitForSignature(r){return l(this,null,function*(){let e=null;do if(yield new Promise(t=>setTimeout(t,O)),e=yield p(this,c).getSignature(this.walletLocator,r),"error"in e)throw new b(JSON.stringify(e));while(e===null||e.status==="pending");if(e.status==="failed")throw new N("Signature signing failed");if(!e.outputSignature)throw new b("Signature not available");return{signature:e.outputSignature,signatureId:r}})}waitForTransaction(d){return l(this,arguments,function*(r,e=6e4,{backoffMultiplier:t=1.1,maxBackoffMs:n=2e3,initialBackoffMs:s=O}={}){var o;let g=Date.now(),i;do{if(Date.now()-g>e)throw new I("Transaction confirmation timeout");if(i=yield p(this,c).getTransaction(this.walletLocator,r),i.error)throw new W(JSON.stringify(i));yield this.sleep(s),s=Math.min(s*t,n)}while(i.status==="pending");if(i.status==="failed")throw new F(`Transaction sending failed: ${JSON.stringify(i.error)}`);if(i.status==="awaiting-approval")throw new R("Transaction is awaiting approval. Please submit required approvals before waiting for completion.");let a=i.onChain.txId;if(a==null)throw new B("Transaction hash not found on transaction response");return{hash:a,explorerLink:(o=i.onChain.explorerLink)!=null?o:"",transactionId:i.id}})}sleep(r){return l(this,null,function*(){return new Promise(e=>setTimeout(e,r))})}};m=new WeakMap,c=new WeakMap;function H(u){if(typeof u=="string")return u;if("email"in u)return`email:${u.email}`;if("x"in u)return`x:${u.x}`;if("twitter"in u)return`twitter:${u.twitter}`;if("phone"in u)return`phoneNumber:${u.phone}`;if("userId"in u)return`userId:${u.userId}`;throw new Error("Invalid recipient locator")}function M(u,r){return k(u)?`${r}:${u}`:`${r}:${u.toLowerCase()}`}export{G as a};
|