@crossmint/wallets-sdk 0.10.15 → 0.10.16

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.
Files changed (47) hide show
  1. package/README.md +3 -1
  2. package/dist/api/client.cjs +1 -1
  3. package/dist/api/client.js +1 -1
  4. package/dist/api/index.cjs +1 -1
  5. package/dist/api/index.js +1 -1
  6. package/dist/{chunk-KQJXLOUT.js → chunk-5777T43M.js} +1 -1
  7. package/dist/chunk-77UQTNS7.cjs +1 -0
  8. package/dist/chunk-7OMPE56G.cjs +1 -0
  9. package/dist/chunk-AIH4VH3N.js +1 -0
  10. package/dist/{chunk-BCOGNFY7.cjs → chunk-M3EZNQE5.cjs} +1 -1
  11. package/dist/{chunk-7L2MNVVS.cjs → chunk-NAI62DBY.cjs} +1 -1
  12. package/dist/{chunk-NVGWQJBW.cjs → chunk-PW4RFMOB.cjs} +1 -1
  13. package/dist/{chunk-OEEB24PA.js → chunk-TXMD64BR.js} +1 -1
  14. package/dist/{chunk-2I26U7NK.js → chunk-UQPCW4TD.js} +1 -1
  15. package/dist/chunk-VRWKCVVK.js +1 -0
  16. package/dist/chunk-X7Y4HEDK.cjs +1 -0
  17. package/dist/chunk-XP4QXJGR.js +1 -0
  18. package/dist/{chunk-VWPHXUTU.cjs → chunk-XTGLXZAW.cjs} +1 -1
  19. package/dist/chunk-XXIW4AEP.js +1 -0
  20. package/dist/index.cjs +1 -1
  21. package/dist/index.js +1 -1
  22. package/dist/sdk.cjs +1 -1
  23. package/dist/sdk.d.cts +1 -1
  24. package/dist/sdk.d.ts +1 -1
  25. package/dist/sdk.js +1 -1
  26. package/dist/utils/constants.cjs +1 -1
  27. package/dist/utils/constants.js +1 -1
  28. package/dist/wallets/evm.cjs +1 -1
  29. package/dist/wallets/evm.js +1 -1
  30. package/dist/wallets/solana.cjs +1 -1
  31. package/dist/wallets/solana.js +1 -1
  32. package/dist/wallets/types.d.cts +14 -2
  33. package/dist/wallets/types.d.ts +14 -2
  34. package/dist/wallets/wallet-factory.cjs +1 -1
  35. package/dist/wallets/wallet-factory.js +1 -1
  36. package/dist/wallets/wallet.cjs +1 -1
  37. package/dist/wallets/wallet.d.cts +23 -6
  38. package/dist/wallets/wallet.d.ts +23 -6
  39. package/dist/wallets/wallet.js +1 -1
  40. package/package.json +3 -3
  41. package/dist/chunk-7JFXS23U.cjs +0 -1
  42. package/dist/chunk-AEZDU2JM.js +0 -1
  43. package/dist/chunk-BOJW3SWK.cjs +0 -1
  44. package/dist/chunk-EQRZJV6Q.js +0 -1
  45. package/dist/chunk-JGHXHURY.js +0 -1
  46. package/dist/chunk-SGL7VVQD.js +0 -1
  47. package/dist/chunk-VOVPHLO5.cjs +0 -1
package/README.md CHANGED
@@ -17,7 +17,9 @@ import { CrossmintWallets, createCrossmint } from "@crossmint/wallets-sdk";
17
17
 
18
18
  const crossmint = createCrossmint({
19
19
  apiKey: "<your-client-OR-server-api-key>",
20
- jwt: "<your-jwt>", // required for client-side calls, optional for server-side calls
20
+ experimental_customAuth: {
21
+ jwt: "<your-jwt>", // required for client-side calls, optional for server-side calls
22
+ },
21
23
  });
22
24
  const crossmintWallets = CrossmintWallets.from(crossmint);
23
25
  const wallet = await crossmintWallets.getOrCreateWallet({
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkNVGWQJBWcjs = require('../chunk-NVGWQJBW.cjs');require('../chunk-BCOGNFY7.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-XALFCQKD.cjs');exports.ApiClient = _chunkNVGWQJBWcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkPW4RFMOBcjs = require('../chunk-PW4RFMOB.cjs');require('../chunk-M3EZNQE5.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-XALFCQKD.cjs');exports.ApiClient = _chunkPW4RFMOBcjs.a;
@@ -1 +1 @@
1
- import{a}from"../chunk-KQJXLOUT.js";import"../chunk-EQRZJV6Q.js";import"../chunk-7ENJXL4H.js";import"../chunk-BW7YYVZE.js";export{a as ApiClient};
1
+ import{a}from"../chunk-5777T43M.js";import"../chunk-AIH4VH3N.js";import"../chunk-7ENJXL4H.js";import"../chunk-BW7YYVZE.js";export{a as ApiClient};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-6HXIZLEQ.cjs');var _chunkNVGWQJBWcjs = require('../chunk-NVGWQJBW.cjs');require('../chunk-BCOGNFY7.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-ECAM5KTH.cjs');require('../chunk-XALFCQKD.cjs');exports.ApiClient = _chunkNVGWQJBWcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-6HXIZLEQ.cjs');var _chunkPW4RFMOBcjs = require('../chunk-PW4RFMOB.cjs');require('../chunk-M3EZNQE5.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-ECAM5KTH.cjs');require('../chunk-XALFCQKD.cjs');exports.ApiClient = _chunkPW4RFMOBcjs.a;
package/dist/api/index.js CHANGED
@@ -1 +1 @@
1
- import"../chunk-5IFDVB4Y.js";import{a}from"../chunk-KQJXLOUT.js";import"../chunk-EQRZJV6Q.js";import"../chunk-7ENJXL4H.js";import"../chunk-KBJA7JDT.js";import"../chunk-BW7YYVZE.js";export{a as ApiClient};
1
+ import"../chunk-5IFDVB4Y.js";import{a}from"../chunk-5777T43M.js";import"../chunk-AIH4VH3N.js";import"../chunk-7ENJXL4H.js";import"../chunk-KBJA7JDT.js";import"../chunk-BW7YYVZE.js";export{a as ApiClient};
@@ -1 +1 @@
1
- import{b as n,c as i}from"./chunk-EQRZJV6Q.js";import{a as o}from"./chunk-7ENJXL4H.js";import{f as r}from"./chunk-BW7YYVZE.js";import{APIKeyUsageOrigin as c,CrossmintApiClient as h}from"@crossmint/common-sdk-base";var p=class extends h{constructor(e){super(e,{internalConfig:{sdkMetadata:{name:i,version:n}}});this.apiPrefix="api/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
+ import{b as n,c as i}from"./chunk-AIH4VH3N.js";import{a as o}from"./chunk-7ENJXL4H.js";import{f as r}from"./chunk-BW7YYVZE.js";import{APIKeyUsageOrigin as c,CrossmintApiClient as h}from"@crossmint/common-sdk-base";var p=class extends h{constructor(e){super(e,{internalConfig:{sdkMetadata:{name:i,version:n}}});this.apiPrefix="api/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};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk7OMPE56Gcjs = require('./chunk-7OMPE56G.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunk6VJEBYPNcjs = require('./chunk-6VJEBYPN.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _viem = require('viem');var _commonsdkbase = require('@crossmint/common-sdk-base');var w=class C extends _chunk7OMPE56Gcjs.a{constructor(t){super({chain:t.chain,address:t.address,owner:t.owner,signer:t.signer,options:_chunk7OMPE56Gcjs.a.getOptions(t)},_chunk7OMPE56Gcjs.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 C(t)}sendTransaction(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var e;let n=this.buildTransaction(t),a=yield this.createTransaction(n,t.options);return(e=t.options)!=null&&e.experimental_prepareOnly?{hash:void 0,explorerLink:void 0,transactionId:a.id}:yield this.approveAndWait(a.id)})}signMessage(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var i;let n=yield this.apiClient.createSignature(this.walletLocator,{type:"message",params:{message:t,signer:this.signer.locator(),chain:this.chain}});if("error"in n)throw new (0, _chunkCT2UGJELcjs.o)(JSON.stringify(n));let a=n.id,e=((i=n.approvals)==null?void 0:i.pending)||[];return yield this.approveSignature(e,a),yield this.waitForSignature(a)})}signTypedData(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var T;let{domain:n,message:a,primaryType:e,types:i,chain:r}=t;if(!n||!a||!i||!r)throw new (0, _chunkCT2UGJELcjs.k)("Invalid typed data");let{name:u,version:l,chainId:h,verifyingContract:y,salt:v}=n;if(!u||!l||!h||!y)throw new (0, _chunkCT2UGJELcjs.k)("Invalid typed data domain");let s=yield this.apiClient.createSignature(this.walletLocator,{type:"typed-data",params:{typedData:{domain:{name:u,version:l,chainId:Number(h),verifyingContract:y,salt:v},message:a,primaryType:e,types:i},signer:this.signer.locator(),chain:r,isSmartWalletSignature:!1}});if("error"in s)throw new (0, _chunkCT2UGJELcjs.o)(JSON.stringify(s));let g=s.id,D=((T=s.approvals)==null?void 0:T.pending)||[];return yield this.approveSignature(D,g),yield this.waitForSignature(g)})}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:_chunk6VJEBYPNcjs.a.call(void 0, this.chain)})}createTransaction(t,n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var i;let a=(i=n==null?void 0:n.experimental_signer)!=null?i:this.signer.locator(),e=yield this.apiClient.createTransaction(this.walletLocator,{params:{signer:a,chain:this.chain,calls:[t]}});if("error"in e)throw new (0, _chunkCT2UGJELcjs.q)(JSON.stringify(e));return e})}buildTransaction(t){var n,a,e,i,r;if("transaction"in t)return{transaction:t.transaction};if(t.abi==null)return{to:t.to,value:(a=(n=t.value)==null?void 0:n.toString())!=null?a:"0",data:(e=t.data)!=null?e:"0x"};if(!t.functionName)throw new Error("Function name is required");return{to:t.to,value:(r=(i=t.value)==null?void 0:i.toString())!=null?r:"0",data:_viem.encodeFunctionData.call(void 0, {abi:t.abi,functionName:t.functionName,args:t.args})}}};exports.a = w;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkM3EZNQE5cjs = require('./chunk-M3EZNQE5.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var m,o,R= exports.a =class{constructor(t,r){_chunkXALFCQKDcjs.d.call(void 0, this,m);_chunkXALFCQKDcjs.d.call(void 0, this,o);let{chain:n,address:a,owner:e,signer:g,options:u}=t;_chunkXALFCQKDcjs.e.call(void 0, this,o,r),this.chain=n,this.address=a,this.owner=e,this.signer=g,_chunkXALFCQKDcjs.e.call(void 0, this,m,u)}static getApiClient(t){return t.apiClient}static getOptions(t){return t.options}get apiClient(){return _chunkXALFCQKDcjs.c.call(void 0, this,o)}get options(){return _chunkXALFCQKDcjs.c.call(void 0, this,m)}balances(t,r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let n=this.chain==="solana"?"sol":"eth",a=[n,"usdc",...t!=null?t:[]],e=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getBalance(this.address,{chains:r!=null?r:[this.chain],tokens:a.map(g=>g.toLowerCase())});if("error"in e)throw new Error(`Failed to get balances for wallet: ${JSON.stringify(e.message)}`);return this.transformBalanceResponse(e,n,t)})}transformBalanceResponse(t,r,n){let a=i=>{var f,h,y,T,v;let d=(f=i.chains)==null?void 0:f[this.chain],w="contractAddress"in d?d.contractAddress:void 0;return{symbol:(h=i.symbol)!=null?h:"",name:(y=i.symbol)!=null?y:"",amount:(T=i.amount)!=null?T:"0",contractAddress:w,decimals:i.decimals,rawAmount:(v=i.rawAmount)!=null?v:"0"}},e=t.find(i=>i.symbol===r),g=t.find(i=>i.symbol==="usdc"),u=t.filter(i=>{var d;return i.symbol!==r&&i.symbol!=="usdc"&&(n==null?void 0:n.includes((d=i.symbol)!=null?d:""))}),s=i=>({symbol:i,name:i,amount:"0",contractAddress:void 0,decimals:0,rawAmount:"0"});return{nativeToken:e!=null?a(e):s(r),usdc:g!=null?a(g):s("usdc"),tokens:u.map(a)}}experimental_nfts(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield _chunkXALFCQKDcjs.c.call(void 0, this,o).experimental_getNfts(_chunkXALFCQKDcjs.b.call(void 0, _chunkXALFCQKDcjs.a.call(void 0, {},t),{chain:this.chain,address:this.address}))})}experimental_transactions(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let t=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getTransactions(this.walletLocator);if("error"in t)throw new Error(`Failed to get transactions: ${JSON.stringify(t.message)}`);return t})}experimental_transaction(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let r=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getTransaction(this.walletLocator,t);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 t=yield this.apiClient.experimental_activity(this.walletLocator,{chain:this.chain});if("error"in t)throw new Error(`Failed to get activity: ${JSON.stringify(t.message)}`);return t})}send(t,r,n,a){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let e=k(t),g=H(r,this.chain),u={recipient:e,amount:n},s=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).send(this.walletLocator,g,u);if("message"in s)throw new (0, _chunkCT2UGJELcjs.q)(`Failed to send token: ${JSON.stringify(s.message)}`);return a!=null&&a.experimental_prepareOnly?{hash:void 0,explorerLink:void 0,transactionId:s.id}:yield this.approveAndWait(s.id)})}approveTransaction(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.approveAndWait(t.transactionId,t.options)})}addDelegatedSigner(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var n,a;let r=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).registerSigner(this.walletLocator,{signer:t.signer,chain:this.chain==="solana"?void 0:this.chain});if("error"in r)throw new Error(`Failed to register signer: ${JSON.stringify(r.message)}`);if("transaction"in r){let e=r.transaction.id;yield this.approveAndWait(e)}else{let e=(n=r.chains)==null?void 0:n[this.chain];if((e==null?void 0:e.status)==="awaiting-approval"){let g=((a=e.approvals)==null?void 0:a.pending)||[];yield this.approveSignature(g,e.id),yield this.waitForSignature(e.id);return}if((e==null?void 0:e.status)==="pending"){yield this.waitForSignature(e.id);return}}})}delegatedSigners(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var r,n,a;let t=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getWallet(this.walletLocator);if("error"in t)throw new (0, _chunkCT2UGJELcjs.d)(JSON.stringify(t));if(t.type!=="smart"||t.chainType!=="evm"&&t.chainType!=="solana")throw new (0, _chunkCT2UGJELcjs.c)(`Wallet type ${t.type} not supported`);return(a=(n=(r=t==null?void 0:t.config)==null?void 0:r.delegatedSigners)==null?void 0:n.map(e=>{let g=e.locator.indexOf(":");return{signer:`external-wallet:${g>=0?e.locator.slice(g+1):e.locator}`}}))!=null?a:[]})}get walletLocator(){return _chunkXALFCQKDcjs.c.call(void 0, this,o).isServerSide?this.address:`me:${this.chain==="solana"?"solana":"evm"}:smart`}get isSolanaWallet(){return this.chain==="solana"}approveAndWait(t,r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.approveTransactionInternal(t,r),yield this.sleep(1e3),yield this.waitForTransaction(t)})}approveTransactionInternal(t,r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var s,i,d,w,f;let n=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getTransaction(this.walletLocator,t);if("error"in n)throw new (0, _chunkCT2UGJELcjs.r)(JSON.stringify(n));if(yield(d=(i=(s=_chunkXALFCQKDcjs.c.call(void 0, this,m))==null?void 0:s.experimental_callbacks)==null?void 0:i.onTransactionStart)==null?void 0:d.call(i),this.signer.type==="api-key")return n;if((r==null?void 0:r.experimental_approval)!=null){let h=[r.experimental_approval];return yield this.executeApprovalWithErrorHandling(t,h)}let a=(w=n.approvals)==null?void 0:w.pending;if(a==null)return n;let e=[...(f=r==null?void 0:r.additionalSigners)!=null?f:[],this.signer],u=(yield Promise.all(a.map(h=>{let y=e.find(v=>v.locator()===h.signer.locator);if(y==null)throw new (0, _chunkCT2UGJELcjs.i)(`Signer ${h.signer} not found in pending approvals`);let T=n.chainType==="solana"&&"transaction"in n.onChain?n.onChain.transaction:h.message;return y.signTransaction(T)}))).map(h=>_chunkXALFCQKDcjs.b.call(void 0, _chunkXALFCQKDcjs.a.call(void 0, {},h),{signer:this.signer.locator()}));return yield this.executeApprovalWithErrorHandling(t,u)})}executeApprovalWithErrorHandling(t,r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let n=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).approveTransaction(this.walletLocator,t,{approvals:r});if(n.error)throw new (0, _chunkCT2UGJELcjs.w)(JSON.stringify(n));return n})}approveSignature(t,r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(this.isSolanaWallet)throw new Error("Approving signatures is only supported for EVM smart wallets");let n=t.find(e=>e.signer.locator===this.signer.locator());if(!n)throw new (0, _chunkCT2UGJELcjs.i)(`Signer ${this.signer.locator()} not found in pending approvals`);let a=yield this.signer.signMessage(n.message);return yield _chunkXALFCQKDcjs.c.call(void 0, this,o).approveSignature(this.walletLocator,r,{approvals:[_chunkXALFCQKDcjs.a.call(void 0, {signer:this.signer.locator()},a)]}),a})}waitForSignature(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let r=null;do if(yield new Promise(n=>setTimeout(n,_chunkM3EZNQE5cjs.d)),r=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getSignature(this.walletLocator,t),"error"in r)throw new (0, _chunkCT2UGJELcjs.p)(JSON.stringify(r));while(r===null||r.status==="pending");if(r.status==="failed")throw new (0, _chunkCT2UGJELcjs.m)("Signature signing failed");if(!r.outputSignature)throw new (0, _chunkCT2UGJELcjs.p)("Signature not available");return r.outputSignature})}waitForTransaction(g){return _chunkXALFCQKDcjs.f.call(void 0, this,arguments,function*(t,r=6e4,{backoffMultiplier:n=1.1,maxBackoffMs:a=2e3,initialBackoffMs:e=_chunkM3EZNQE5cjs.d}={}){var d;let u=Date.now(),s;do{if(Date.now()-u>r)throw new (0, _chunkCT2UGJELcjs.s)("Transaction confirmation timeout");if(s=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getTransaction(this.walletLocator,t),s.error)throw new (0, _chunkCT2UGJELcjs.r)(JSON.stringify(s));yield this.sleep(e),e=Math.min(e*n,a)}while(s.status==="pending");if(s.status==="failed")throw new (0, _chunkCT2UGJELcjs.t)(`Transaction sending failed: ${JSON.stringify(s.error)}`);if(s.status==="awaiting-approval")throw new (0, _chunkCT2UGJELcjs.u)("Transaction is awaiting approval. Please submit required approvals before waiting for completion.");let i=s.onChain.txId;if(i==null)throw new (0, _chunkCT2UGJELcjs.v)("Transaction hash not found on transaction response");return{hash:i,explorerLink:(d=s.onChain.explorerLink)!=null?d:"",transactionId:s.id}})}sleep(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return new Promise(r=>setTimeout(r,t))})}};m=new WeakMap,o=new WeakMap;function k(c){if(typeof c=="string")return c;if("email"in c)return`email:${c.email}`;if("x"in c)return`x:${c.x}`;if("twitter"in c)return`twitter:${c.twitter}`;if("phone"in c)return`phoneNumber:${c.phone}`;if("userId"in c)return`userId:${c.userId}`;throw new Error("Invalid recipient locator")}function H(c,t){return _commonsdkbase.isValidAddress.call(void 0, c)?`${t}:${c}`:`${t}:${c.toLowerCase()}`}exports.a = R;
@@ -0,0 +1 @@
1
+ var s="@crossmint/wallets-sdk",t="0.10.16";var c="WALLETS_SDK",r=t,d=s,a=500;export{c as a,r as b,d as c,a as d};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var s="@crossmint/wallets-sdk",t="0.10.15";var p="WALLETS_SDK",c= exports.b =t,r= exports.c =s,d= exports.d =500;exports.a = p; exports.b = c; exports.c = r; exports.d = d;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var s="@crossmint/wallets-sdk",t="0.10.16";var p="WALLETS_SDK",c= exports.b =t,r= exports.c =s,d= exports.d =500;exports.a = p; exports.b = c; exports.c = r; exports.d = d;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkVOVPHLO5cjs = require('./chunk-VOVPHLO5.cjs');var _chunkIQB4HWD3cjs = require('./chunk-IQB4HWD3.cjs');var _chunkRFK6N7LCcjs = require('./chunk-RFK6N7LC.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _ox = require('ox');var S=class{constructor(e){this.apiClient=e}getOrCreateWallet(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(this.apiClient.isServerSide)throw new (0, _chunkCT2UGJELcjs.f)("getOrCreateWallet is not supported on server side");let i=yield this.apiClient.getWallet(`me:${e.chain==="solana"?"solana":"evm"}:smart`);return i!=null&&!("error"in i)?this.createWalletInstance(i,e):this.createWallet(e)})}getWallet(e,i){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(!this.apiClient.isServerSide)throw new (0, _chunkCT2UGJELcjs.f)("getWallet is not supported on client side, use getOrCreateWallet instead");let n=yield this.apiClient.getWallet(e);if("error"in n)throw new (0, _chunkCT2UGJELcjs.d)(JSON.stringify(n));return this.createWalletInstance(n,i)})}createWallet(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var t,r,o,l;yield(o=(r=(t=e.options)==null?void 0:t.experimental_callbacks)==null?void 0:r.onWalletCreationStart)==null?void 0:o.call(r),this.mutateSignerFromCustomAuth(e,!0);let i=e.signer.type==="passkey"?yield this.createPasskeyAdminSigner(e.signer):e.signer,n=yield this.apiClient.createWallet({type:"smart",chainType:e.chain==="solana"?"solana":"evm",config:{adminSigner:i},owner:(l=e.owner)!=null?l:void 0});if("error"in n)throw new (0, _chunkCT2UGJELcjs.f)(JSON.stringify(n));return this.createWalletInstance(n,e)})}createWalletInstance(e,i){this.validateExistingWalletConfig(e,i);let n=this.toInternalSignerConfig(e,i.signer,i.options);return new (0, _chunkVOVPHLO5cjs.a)({chain:i.chain,address:e.address,owner:e.owner,signer:_chunkIQB4HWD3cjs.a.call(void 0, i.chain,n),options:i.options},this.apiClient)}toInternalSignerConfig(e,i,n){var t,r,o,l,p,g;if(!(e.chainType==="evm"||e.chainType==="solana"))throw new (0, _chunkCT2UGJELcjs.f)(`Wallet type ${e.chainType} is not supported`);if(i==null&&((t=e.config)==null?void 0:t.adminSigner)==null)throw new (0, _chunkCT2UGJELcjs.f)("Signer is required to create a wallet");switch(i.type){case"api-key":{if(((r=e.config)==null?void 0:r.adminSigner.type)!=="api-key")throw new (0, _chunkCT2UGJELcjs.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(((o=e.config)==null?void 0:o.adminSigner.type)!=="external-wallet")throw new (0, _chunkCT2UGJELcjs.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),i);case"passkey":if(((l=e.config)==null?void 0:l.adminSigner.type)!=="passkey")throw new (0, _chunkCT2UGJELcjs.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:i.onCreatePasskey,onSignWithPasskey:i.onSignWithPasskey};case"email":{if(((p=e.config)==null?void 0:p.adminSigner.type)!=="email")throw new (0, _chunkCT2UGJELcjs.f)("Email signer does not match the wallet's signer type");let{locator:c,email:h}=e.config.adminSigner;return{type:"email",email:h,locator:c,crossmint:this.apiClient.crossmint,onAuthRequired:i.onAuthRequired,clientTEEConnection:n==null?void 0:n.clientTEEConnection}}case"phone":{if(((g=e.config)==null?void 0:g.adminSigner.type)!=="phone")throw new (0, _chunkCT2UGJELcjs.f)("Phone signer does not match the wallet's signer type");let{locator:c,phone:h}=e.config.adminSigner;return{type:"phone",phone:h,locator:c,crossmint:this.apiClient.crossmint,onAuthRequired:i.onAuthRequired,clientTEEConnection:n==null?void 0:n.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 i=(t=e.name)!=null?t:`Crossmint Wallet ${Date.now()}`,n=e.onCreatePasskey?yield e.onCreatePasskey(i):yield _ox.WebAuthnP256.createCredential({name:i});return{type:"passkey",id:n.id,name:i,publicKey:{x:n.publicKey.x.toString(),y:n.publicKey.y.toString()}}})}mutateSignerFromCustomAuth(e,i=!1){var t,r;let{experimental_customAuth:n}=this.apiClient.crossmint;e.signer.type==="email"&&(n==null?void 0:n.email)!=null&&(e.signer.email=(t=e.signer.email)!=null?t:n.email),e.signer.type==="phone"&&(n==null?void 0:n.phone)!=null&&(e.signer.phone=(r=e.signer.phone)!=null?r:n.phone),e.signer.type==="external-wallet"&&(n==null?void 0:n.externalWalletSigner)!=null&&(e.signer=i?{type:"external-wallet",address:n.externalWalletSigner.address}:n.externalWalletSigner)}validateExistingWalletConfig(e,i){var r;if(this.mutateSignerFromCustomAuth(i),i.owner!=null&&e.owner!=null&&i.owner!==e.owner)throw new (0, _chunkCT2UGJELcjs.f)("Wallet owner does not match existing wallet's linked user");if(i.chain==="solana"&&e.chainType!=="solana"||i.chain!=="solana"&&e.chainType==="solana")throw new (0, _chunkCT2UGJELcjs.f)(`Wallet chain does not match existing wallet's chain. You must use chain: ${e.chainType}.`);if(e.type!=="smart")return;let n=i.signer,t=(r=e==null?void 0:e.config)==null?void 0:r.adminSigner;if(n!=null&&t!=null){if(n.type!==t.type)throw new (0, _chunkCT2UGJELcjs.f)("The wallet signer type provided in the wallet config does not match the existing wallet's adminSigner type");_chunkRFK6N7LCcjs.a.call(void 0, n,t)}}};exports.a = S;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk7OMPE56Gcjs = require('./chunk-7OMPE56G.cjs');var _chunkIQB4HWD3cjs = require('./chunk-IQB4HWD3.cjs');var _chunkRFK6N7LCcjs = require('./chunk-RFK6N7LC.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _ox = require('ox');var S=class{constructor(e){this.apiClient=e}getOrCreateWallet(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(this.apiClient.isServerSide)throw new (0, _chunkCT2UGJELcjs.f)("getOrCreateWallet is not supported on server side");let i=yield this.apiClient.getWallet(`me:${e.chain==="solana"?"solana":"evm"}:smart`);return i!=null&&!("error"in i)?this.createWalletInstance(i,e):this.createWallet(e)})}getWallet(e,i){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(!this.apiClient.isServerSide)throw new (0, _chunkCT2UGJELcjs.f)("getWallet is not supported on client side, use getOrCreateWallet instead");let n=yield this.apiClient.getWallet(e);if("error"in n)throw new (0, _chunkCT2UGJELcjs.d)(JSON.stringify(n));return this.createWalletInstance(n,i)})}createWallet(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var t,r,o,l;yield(o=(r=(t=e.options)==null?void 0:t.experimental_callbacks)==null?void 0:r.onWalletCreationStart)==null?void 0:o.call(r),this.mutateSignerFromCustomAuth(e,!0);let i=e.signer.type==="passkey"?yield this.createPasskeyAdminSigner(e.signer):e.signer,n=yield this.apiClient.createWallet({type:"smart",chainType:e.chain==="solana"?"solana":"evm",config:{adminSigner:i},owner:(l=e.owner)!=null?l:void 0});if("error"in n)throw new (0, _chunkCT2UGJELcjs.f)(JSON.stringify(n));return this.createWalletInstance(n,e)})}createWalletInstance(e,i){this.validateExistingWalletConfig(e,i);let n=this.toInternalSignerConfig(e,i.signer,i.options);return new (0, _chunk7OMPE56Gcjs.a)({chain:i.chain,address:e.address,owner:e.owner,signer:_chunkIQB4HWD3cjs.a.call(void 0, i.chain,n),options:i.options},this.apiClient)}toInternalSignerConfig(e,i,n){var t,r,o,l,p,g;if(!(e.chainType==="evm"||e.chainType==="solana"))throw new (0, _chunkCT2UGJELcjs.f)(`Wallet type ${e.chainType} is not supported`);if(i==null&&((t=e.config)==null?void 0:t.adminSigner)==null)throw new (0, _chunkCT2UGJELcjs.f)("Signer is required to create a wallet");switch(i.type){case"api-key":{if(((r=e.config)==null?void 0:r.adminSigner.type)!=="api-key")throw new (0, _chunkCT2UGJELcjs.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(((o=e.config)==null?void 0:o.adminSigner.type)!=="external-wallet")throw new (0, _chunkCT2UGJELcjs.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),i);case"passkey":if(((l=e.config)==null?void 0:l.adminSigner.type)!=="passkey")throw new (0, _chunkCT2UGJELcjs.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:i.onCreatePasskey,onSignWithPasskey:i.onSignWithPasskey};case"email":{if(((p=e.config)==null?void 0:p.adminSigner.type)!=="email")throw new (0, _chunkCT2UGJELcjs.f)("Email signer does not match the wallet's signer type");let{locator:c,email:h}=e.config.adminSigner;return{type:"email",email:h,locator:c,crossmint:this.apiClient.crossmint,onAuthRequired:i.onAuthRequired,clientTEEConnection:n==null?void 0:n.clientTEEConnection}}case"phone":{if(((g=e.config)==null?void 0:g.adminSigner.type)!=="phone")throw new (0, _chunkCT2UGJELcjs.f)("Phone signer does not match the wallet's signer type");let{locator:c,phone:h}=e.config.adminSigner;return{type:"phone",phone:h,locator:c,crossmint:this.apiClient.crossmint,onAuthRequired:i.onAuthRequired,clientTEEConnection:n==null?void 0:n.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 i=(t=e.name)!=null?t:`Crossmint Wallet ${Date.now()}`,n=e.onCreatePasskey?yield e.onCreatePasskey(i):yield _ox.WebAuthnP256.createCredential({name:i});return{type:"passkey",id:n.id,name:i,publicKey:{x:n.publicKey.x.toString(),y:n.publicKey.y.toString()}}})}mutateSignerFromCustomAuth(e,i=!1){var t,r;let{experimental_customAuth:n}=this.apiClient.crossmint;e.signer.type==="email"&&(n==null?void 0:n.email)!=null&&(e.signer.email=(t=e.signer.email)!=null?t:n.email),e.signer.type==="phone"&&(n==null?void 0:n.phone)!=null&&(e.signer.phone=(r=e.signer.phone)!=null?r:n.phone),e.signer.type==="external-wallet"&&(n==null?void 0:n.externalWalletSigner)!=null&&(e.signer=i?{type:"external-wallet",address:n.externalWalletSigner.address}:n.externalWalletSigner)}validateExistingWalletConfig(e,i){var r;if(this.mutateSignerFromCustomAuth(i),i.owner!=null&&e.owner!=null&&i.owner!==e.owner)throw new (0, _chunkCT2UGJELcjs.f)("Wallet owner does not match existing wallet's linked user");if(i.chain==="solana"&&e.chainType!=="solana"||i.chain!=="solana"&&e.chainType==="solana")throw new (0, _chunkCT2UGJELcjs.f)(`Wallet chain does not match existing wallet's chain. You must use chain: ${e.chainType}.`);if(e.type!=="smart")return;let n=i.signer,t=(r=e==null?void 0:e.config)==null?void 0:r.adminSigner;if(n!=null&&t!=null){if(n.type!==t.type)throw new (0, _chunkCT2UGJELcjs.f)("The wallet signer type provided in the wallet config does not match the existing wallet's adminSigner type");_chunkRFK6N7LCcjs.a.call(void 0, n,t)}}};exports.a = S;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBCOGNFY7cjs = require('./chunk-BCOGNFY7.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var p=class extends _commonsdkbase.CrossmintApiClient{constructor(e){super(e,{internalConfig:{sdkMetadata:{name:_chunkBCOGNFY7cjs.c,version:_chunkBCOGNFY7cjs.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, _chunkCT2UGJELcjs.a)("Invalid API key");return this.parsedAPIKey.environment}get headers(){return{"Content-Type":"application/json"}}};exports.a = p;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkM3EZNQE5cjs = require('./chunk-M3EZNQE5.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var p=class extends _commonsdkbase.CrossmintApiClient{constructor(e){super(e,{internalConfig:{sdkMetadata:{name:_chunkM3EZNQE5cjs.c,version:_chunkM3EZNQE5cjs.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, _chunkCT2UGJELcjs.a)("Invalid API key");return this.parsedAPIKey.environment}get headers(){return{"Content-Type":"application/json"}}};exports.a = p;
@@ -1 +1 @@
1
- import{a as d}from"./chunk-JGHXHURY.js";import{a as y}from"./chunk-5U4PVNPM.js";import{a as f}from"./chunk-IJMFCZIY.js";import{d as C,f as a}from"./chunk-7ENJXL4H.js";import{a as m,f as s}from"./chunk-BW7YYVZE.js";import{WebAuthnP256 as u}from"ox";var S=class{constructor(e){this.apiClient=e}getOrCreateWallet(e){return s(this,null,function*(){if(this.apiClient.isServerSide)throw new a("getOrCreateWallet is not supported on server side");let i=yield this.apiClient.getWallet(`me:${e.chain==="solana"?"solana":"evm"}:smart`);return i!=null&&!("error"in i)?this.createWalletInstance(i,e):this.createWallet(e)})}getWallet(e,i){return s(this,null,function*(){if(!this.apiClient.isServerSide)throw new a("getWallet is not supported on client side, use getOrCreateWallet instead");let n=yield this.apiClient.getWallet(e);if("error"in n)throw new C(JSON.stringify(n));return this.createWalletInstance(n,i)})}createWallet(e){return s(this,null,function*(){var t,r,o,l;yield(o=(r=(t=e.options)==null?void 0:t.experimental_callbacks)==null?void 0:r.onWalletCreationStart)==null?void 0:o.call(r),this.mutateSignerFromCustomAuth(e,!0);let i=e.signer.type==="passkey"?yield this.createPasskeyAdminSigner(e.signer):e.signer,n=yield this.apiClient.createWallet({type:"smart",chainType:e.chain==="solana"?"solana":"evm",config:{adminSigner:i},owner:(l=e.owner)!=null?l:void 0});if("error"in n)throw new a(JSON.stringify(n));return this.createWalletInstance(n,e)})}createWalletInstance(e,i){this.validateExistingWalletConfig(e,i);let n=this.toInternalSignerConfig(e,i.signer,i.options);return new d({chain:i.chain,address:e.address,owner:e.owner,signer:y(i.chain,n),options:i.options},this.apiClient)}toInternalSignerConfig(e,i,n){var t,r,o,l,p,g;if(!(e.chainType==="evm"||e.chainType==="solana"))throw new a(`Wallet type ${e.chainType} is not supported`);if(i==null&&((t=e.config)==null?void 0:t.adminSigner)==null)throw new a("Signer is required to create a wallet");switch(i.type){case"api-key":{if(((r=e.config)==null?void 0:r.adminSigner.type)!=="api-key")throw new a("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(((o=e.config)==null?void 0:o.adminSigner.type)!=="external-wallet")throw new a("External wallet signer does not match the wallet's signer type");return m(m({},e.config.adminSigner),i);case"passkey":if(((l=e.config)==null?void 0:l.adminSigner.type)!=="passkey")throw new a("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:i.onCreatePasskey,onSignWithPasskey:i.onSignWithPasskey};case"email":{if(((p=e.config)==null?void 0:p.adminSigner.type)!=="email")throw new a("Email signer does not match the wallet's signer type");let{locator:c,email:h}=e.config.adminSigner;return{type:"email",email:h,locator:c,crossmint:this.apiClient.crossmint,onAuthRequired:i.onAuthRequired,clientTEEConnection:n==null?void 0:n.clientTEEConnection}}case"phone":{if(((g=e.config)==null?void 0:g.adminSigner.type)!=="phone")throw new a("Phone signer does not match the wallet's signer type");let{locator:c,phone:h}=e.config.adminSigner;return{type:"phone",phone:h,locator:c,crossmint:this.apiClient.crossmint,onAuthRequired:i.onAuthRequired,clientTEEConnection:n==null?void 0:n.clientTEEConnection}}default:throw new Error("Invalid signer type")}}createPasskeyAdminSigner(e){return s(this,null,function*(){var t;if(e.type!=="passkey")throw new Error("Signer is not a passkey");let i=(t=e.name)!=null?t:`Crossmint Wallet ${Date.now()}`,n=e.onCreatePasskey?yield e.onCreatePasskey(i):yield u.createCredential({name:i});return{type:"passkey",id:n.id,name:i,publicKey:{x:n.publicKey.x.toString(),y:n.publicKey.y.toString()}}})}mutateSignerFromCustomAuth(e,i=!1){var t,r;let{experimental_customAuth:n}=this.apiClient.crossmint;e.signer.type==="email"&&(n==null?void 0:n.email)!=null&&(e.signer.email=(t=e.signer.email)!=null?t:n.email),e.signer.type==="phone"&&(n==null?void 0:n.phone)!=null&&(e.signer.phone=(r=e.signer.phone)!=null?r:n.phone),e.signer.type==="external-wallet"&&(n==null?void 0:n.externalWalletSigner)!=null&&(e.signer=i?{type:"external-wallet",address:n.externalWalletSigner.address}:n.externalWalletSigner)}validateExistingWalletConfig(e,i){var r;if(this.mutateSignerFromCustomAuth(i),i.owner!=null&&e.owner!=null&&i.owner!==e.owner)throw new a("Wallet owner does not match existing wallet's linked user");if(i.chain==="solana"&&e.chainType!=="solana"||i.chain!=="solana"&&e.chainType==="solana")throw new a(`Wallet chain does not match existing wallet's chain. You must use chain: ${e.chainType}.`);if(e.type!=="smart")return;let n=i.signer,t=(r=e==null?void 0:e.config)==null?void 0:r.adminSigner;if(n!=null&&t!=null){if(n.type!==t.type)throw new a("The wallet signer type provided in the wallet config does not match the existing wallet's adminSigner type");f(n,t)}}};export{S as a};
1
+ import{a as d}from"./chunk-VRWKCVVK.js";import{a as y}from"./chunk-5U4PVNPM.js";import{a as f}from"./chunk-IJMFCZIY.js";import{d as C,f as a}from"./chunk-7ENJXL4H.js";import{a as m,f as s}from"./chunk-BW7YYVZE.js";import{WebAuthnP256 as u}from"ox";var S=class{constructor(e){this.apiClient=e}getOrCreateWallet(e){return s(this,null,function*(){if(this.apiClient.isServerSide)throw new a("getOrCreateWallet is not supported on server side");let i=yield this.apiClient.getWallet(`me:${e.chain==="solana"?"solana":"evm"}:smart`);return i!=null&&!("error"in i)?this.createWalletInstance(i,e):this.createWallet(e)})}getWallet(e,i){return s(this,null,function*(){if(!this.apiClient.isServerSide)throw new a("getWallet is not supported on client side, use getOrCreateWallet instead");let n=yield this.apiClient.getWallet(e);if("error"in n)throw new C(JSON.stringify(n));return this.createWalletInstance(n,i)})}createWallet(e){return s(this,null,function*(){var t,r,o,l;yield(o=(r=(t=e.options)==null?void 0:t.experimental_callbacks)==null?void 0:r.onWalletCreationStart)==null?void 0:o.call(r),this.mutateSignerFromCustomAuth(e,!0);let i=e.signer.type==="passkey"?yield this.createPasskeyAdminSigner(e.signer):e.signer,n=yield this.apiClient.createWallet({type:"smart",chainType:e.chain==="solana"?"solana":"evm",config:{adminSigner:i},owner:(l=e.owner)!=null?l:void 0});if("error"in n)throw new a(JSON.stringify(n));return this.createWalletInstance(n,e)})}createWalletInstance(e,i){this.validateExistingWalletConfig(e,i);let n=this.toInternalSignerConfig(e,i.signer,i.options);return new d({chain:i.chain,address:e.address,owner:e.owner,signer:y(i.chain,n),options:i.options},this.apiClient)}toInternalSignerConfig(e,i,n){var t,r,o,l,p,g;if(!(e.chainType==="evm"||e.chainType==="solana"))throw new a(`Wallet type ${e.chainType} is not supported`);if(i==null&&((t=e.config)==null?void 0:t.adminSigner)==null)throw new a("Signer is required to create a wallet");switch(i.type){case"api-key":{if(((r=e.config)==null?void 0:r.adminSigner.type)!=="api-key")throw new a("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(((o=e.config)==null?void 0:o.adminSigner.type)!=="external-wallet")throw new a("External wallet signer does not match the wallet's signer type");return m(m({},e.config.adminSigner),i);case"passkey":if(((l=e.config)==null?void 0:l.adminSigner.type)!=="passkey")throw new a("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:i.onCreatePasskey,onSignWithPasskey:i.onSignWithPasskey};case"email":{if(((p=e.config)==null?void 0:p.adminSigner.type)!=="email")throw new a("Email signer does not match the wallet's signer type");let{locator:c,email:h}=e.config.adminSigner;return{type:"email",email:h,locator:c,crossmint:this.apiClient.crossmint,onAuthRequired:i.onAuthRequired,clientTEEConnection:n==null?void 0:n.clientTEEConnection}}case"phone":{if(((g=e.config)==null?void 0:g.adminSigner.type)!=="phone")throw new a("Phone signer does not match the wallet's signer type");let{locator:c,phone:h}=e.config.adminSigner;return{type:"phone",phone:h,locator:c,crossmint:this.apiClient.crossmint,onAuthRequired:i.onAuthRequired,clientTEEConnection:n==null?void 0:n.clientTEEConnection}}default:throw new Error("Invalid signer type")}}createPasskeyAdminSigner(e){return s(this,null,function*(){var t;if(e.type!=="passkey")throw new Error("Signer is not a passkey");let i=(t=e.name)!=null?t:`Crossmint Wallet ${Date.now()}`,n=e.onCreatePasskey?yield e.onCreatePasskey(i):yield u.createCredential({name:i});return{type:"passkey",id:n.id,name:i,publicKey:{x:n.publicKey.x.toString(),y:n.publicKey.y.toString()}}})}mutateSignerFromCustomAuth(e,i=!1){var t,r;let{experimental_customAuth:n}=this.apiClient.crossmint;e.signer.type==="email"&&(n==null?void 0:n.email)!=null&&(e.signer.email=(t=e.signer.email)!=null?t:n.email),e.signer.type==="phone"&&(n==null?void 0:n.phone)!=null&&(e.signer.phone=(r=e.signer.phone)!=null?r:n.phone),e.signer.type==="external-wallet"&&(n==null?void 0:n.externalWalletSigner)!=null&&(e.signer=i?{type:"external-wallet",address:n.externalWalletSigner.address}:n.externalWalletSigner)}validateExistingWalletConfig(e,i){var r;if(this.mutateSignerFromCustomAuth(i),i.owner!=null&&e.owner!=null&&i.owner!==e.owner)throw new a("Wallet owner does not match existing wallet's linked user");if(i.chain==="solana"&&e.chainType!=="solana"||i.chain!=="solana"&&e.chainType==="solana")throw new a(`Wallet chain does not match existing wallet's chain. You must use chain: ${e.chainType}.`);if(e.type!=="smart")return;let n=i.signer,t=(r=e==null?void 0:e.config)==null?void 0:r.adminSigner;if(n!=null&&t!=null){if(n.type!==t.type)throw new a("The wallet signer type provided in the wallet config does not match the existing wallet's adminSigner type");f(n,t)}}};export{S as a};
@@ -1 +1 @@
1
- import{a as l}from"./chunk-OEEB24PA.js";import{a}from"./chunk-KQJXLOUT.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};
1
+ import{a as l}from"./chunk-TXMD64BR.js";import{a}from"./chunk-5777T43M.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
+ import{d as x}from"./chunk-AIH4VH3N.js";import{c as P,d as W,i as L,m as N,p as O,q as $,r as E,s as _,t as B,u as F,v as I,w as J}from"./chunk-7ENJXL4H.js";import{a as S,b as A,c as l,d as C,e as b,f as p}from"./chunk-BW7YYVZE.js";import{isValidAddress as G}from"@crossmint/common-sdk-base";var m,o,R=class{constructor(t,r){C(this,m);C(this,o);let{chain:n,address:a,owner:e,signer:g,options:u}=t;b(this,o,r),this.chain=n,this.address=a,this.owner=e,this.signer=g,b(this,m,u)}static getApiClient(t){return t.apiClient}static getOptions(t){return t.options}get apiClient(){return l(this,o)}get options(){return l(this,m)}balances(t,r){return p(this,null,function*(){let n=this.chain==="solana"?"sol":"eth",a=[n,"usdc",...t!=null?t:[]],e=yield l(this,o).getBalance(this.address,{chains:r!=null?r:[this.chain],tokens:a.map(g=>g.toLowerCase())});if("error"in e)throw new Error(`Failed to get balances for wallet: ${JSON.stringify(e.message)}`);return this.transformBalanceResponse(e,n,t)})}transformBalanceResponse(t,r,n){let a=i=>{var f,h,y,T,v;let d=(f=i.chains)==null?void 0:f[this.chain],w="contractAddress"in d?d.contractAddress:void 0;return{symbol:(h=i.symbol)!=null?h:"",name:(y=i.symbol)!=null?y:"",amount:(T=i.amount)!=null?T:"0",contractAddress:w,decimals:i.decimals,rawAmount:(v=i.rawAmount)!=null?v:"0"}},e=t.find(i=>i.symbol===r),g=t.find(i=>i.symbol==="usdc"),u=t.filter(i=>{var d;return i.symbol!==r&&i.symbol!=="usdc"&&(n==null?void 0:n.includes((d=i.symbol)!=null?d:""))}),s=i=>({symbol:i,name:i,amount:"0",contractAddress:void 0,decimals:0,rawAmount:"0"});return{nativeToken:e!=null?a(e):s(r),usdc:g!=null?a(g):s("usdc"),tokens:u.map(a)}}experimental_nfts(t){return p(this,null,function*(){return yield l(this,o).experimental_getNfts(A(S({},t),{chain:this.chain,address:this.address}))})}experimental_transactions(){return p(this,null,function*(){let t=yield l(this,o).getTransactions(this.walletLocator);if("error"in t)throw new Error(`Failed to get transactions: ${JSON.stringify(t.message)}`);return t})}experimental_transaction(t){return p(this,null,function*(){let r=yield l(this,o).getTransaction(this.walletLocator,t);if("error"in r)throw new Error(`Failed to get transaction: ${JSON.stringify(r.error)}`);return r})}experimental_activity(){return p(this,null,function*(){let t=yield this.apiClient.experimental_activity(this.walletLocator,{chain:this.chain});if("error"in t)throw new Error(`Failed to get activity: ${JSON.stringify(t.message)}`);return t})}send(t,r,n,a){return p(this,null,function*(){let e=k(t),g=H(r,this.chain),u={recipient:e,amount:n},s=yield l(this,o).send(this.walletLocator,g,u);if("message"in s)throw new $(`Failed to send token: ${JSON.stringify(s.message)}`);return a!=null&&a.experimental_prepareOnly?{hash:void 0,explorerLink:void 0,transactionId:s.id}:yield this.approveAndWait(s.id)})}approveTransaction(t){return p(this,null,function*(){return yield this.approveAndWait(t.transactionId,t.options)})}addDelegatedSigner(t){return p(this,null,function*(){var n,a;let r=yield l(this,o).registerSigner(this.walletLocator,{signer:t.signer,chain:this.chain==="solana"?void 0:this.chain});if("error"in r)throw new Error(`Failed to register signer: ${JSON.stringify(r.message)}`);if("transaction"in r){let e=r.transaction.id;yield this.approveAndWait(e)}else{let e=(n=r.chains)==null?void 0:n[this.chain];if((e==null?void 0:e.status)==="awaiting-approval"){let g=((a=e.approvals)==null?void 0:a.pending)||[];yield this.approveSignature(g,e.id),yield this.waitForSignature(e.id);return}if((e==null?void 0:e.status)==="pending"){yield this.waitForSignature(e.id);return}}})}delegatedSigners(){return p(this,null,function*(){var r,n,a;let t=yield l(this,o).getWallet(this.walletLocator);if("error"in t)throw new W(JSON.stringify(t));if(t.type!=="smart"||t.chainType!=="evm"&&t.chainType!=="solana")throw new P(`Wallet type ${t.type} not supported`);return(a=(n=(r=t==null?void 0:t.config)==null?void 0:r.delegatedSigners)==null?void 0:n.map(e=>{let g=e.locator.indexOf(":");return{signer:`external-wallet:${g>=0?e.locator.slice(g+1):e.locator}`}}))!=null?a:[]})}get walletLocator(){return l(this,o).isServerSide?this.address:`me:${this.chain==="solana"?"solana":"evm"}:smart`}get isSolanaWallet(){return this.chain==="solana"}approveAndWait(t,r){return p(this,null,function*(){return yield this.approveTransactionInternal(t,r),yield this.sleep(1e3),yield this.waitForTransaction(t)})}approveTransactionInternal(t,r){return p(this,null,function*(){var s,i,d,w,f;let n=yield l(this,o).getTransaction(this.walletLocator,t);if("error"in n)throw new E(JSON.stringify(n));if(yield(d=(i=(s=l(this,m))==null?void 0:s.experimental_callbacks)==null?void 0:i.onTransactionStart)==null?void 0:d.call(i),this.signer.type==="api-key")return n;if((r==null?void 0:r.experimental_approval)!=null){let h=[r.experimental_approval];return yield this.executeApprovalWithErrorHandling(t,h)}let a=(w=n.approvals)==null?void 0:w.pending;if(a==null)return n;let e=[...(f=r==null?void 0:r.additionalSigners)!=null?f:[],this.signer],u=(yield Promise.all(a.map(h=>{let y=e.find(v=>v.locator()===h.signer.locator);if(y==null)throw new L(`Signer ${h.signer} not found in pending approvals`);let T=n.chainType==="solana"&&"transaction"in n.onChain?n.onChain.transaction:h.message;return y.signTransaction(T)}))).map(h=>A(S({},h),{signer:this.signer.locator()}));return yield this.executeApprovalWithErrorHandling(t,u)})}executeApprovalWithErrorHandling(t,r){return p(this,null,function*(){let n=yield l(this,o).approveTransaction(this.walletLocator,t,{approvals:r});if(n.error)throw new J(JSON.stringify(n));return n})}approveSignature(t,r){return p(this,null,function*(){if(this.isSolanaWallet)throw new Error("Approving signatures is only supported for EVM smart wallets");let n=t.find(e=>e.signer.locator===this.signer.locator());if(!n)throw new L(`Signer ${this.signer.locator()} not found in pending approvals`);let a=yield this.signer.signMessage(n.message);return yield l(this,o).approveSignature(this.walletLocator,r,{approvals:[S({signer:this.signer.locator()},a)]}),a})}waitForSignature(t){return p(this,null,function*(){let r=null;do if(yield new Promise(n=>setTimeout(n,x)),r=yield l(this,o).getSignature(this.walletLocator,t),"error"in r)throw new O(JSON.stringify(r));while(r===null||r.status==="pending");if(r.status==="failed")throw new N("Signature signing failed");if(!r.outputSignature)throw new O("Signature not available");return r.outputSignature})}waitForTransaction(g){return p(this,arguments,function*(t,r=6e4,{backoffMultiplier:n=1.1,maxBackoffMs:a=2e3,initialBackoffMs:e=x}={}){var d;let u=Date.now(),s;do{if(Date.now()-u>r)throw new _("Transaction confirmation timeout");if(s=yield l(this,o).getTransaction(this.walletLocator,t),s.error)throw new E(JSON.stringify(s));yield this.sleep(e),e=Math.min(e*n,a)}while(s.status==="pending");if(s.status==="failed")throw new B(`Transaction sending failed: ${JSON.stringify(s.error)}`);if(s.status==="awaiting-approval")throw new F("Transaction is awaiting approval. Please submit required approvals before waiting for completion.");let i=s.onChain.txId;if(i==null)throw new I("Transaction hash not found on transaction response");return{hash:i,explorerLink:(d=s.onChain.explorerLink)!=null?d:"",transactionId:s.id}})}sleep(t){return p(this,null,function*(){return new Promise(r=>setTimeout(r,t))})}};m=new WeakMap,o=new WeakMap;function k(c){if(typeof c=="string")return c;if("email"in c)return`email:${c.email}`;if("x"in c)return`x:${c.x}`;if("twitter"in c)return`twitter:${c.twitter}`;if("phone"in c)return`phoneNumber:${c.phone}`;if("userId"in c)return`userId:${c.userId}`;throw new Error("Invalid recipient locator")}function H(c,t){return G(c)?`${t}:${c}`:`${t}:${c.toLowerCase()}`}export{R as a};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunk7OMPE56Gcjs = require('./chunk-7OMPE56G.cjs');var _chunkYTAW674Lcjs = require('./chunk-YTAW674L.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);var _commonsdkbase = require('@crossmint/common-sdk-base');var d=class u extends _chunk7OMPE56Gcjs.a{constructor(n){super({chain:n.chain,address:n.address,owner:n.owner,signer:n.signer,options:_chunk7OMPE56Gcjs.a.getOptions(n)},_chunk7OMPE56Gcjs.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, _chunkYTAW674Lcjs.a)({type:"external-wallet",address:o.publicKey.toString(),locator:`external-wallet:${o.publicKey.toString()}`,onSignTransaction:p=>(p.sign([o]),Promise.resolve(p))}))};return yield this.approveAndWait(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, _chunkCT2UGJELcjs.q)(JSON.stringify(e));return e})}};exports.a = d;
@@ -0,0 +1 @@
1
+ import{a as c}from"./chunk-VRWKCVVK.js";import{k as p,o as d,q as m}from"./chunk-7ENJXL4H.js";import{a as f}from"./chunk-BJDS5BJG.js";import{f as o}from"./chunk-BW7YYVZE.js";import{createPublicClient as E,encodeFunctionData as S,http as V}from"viem";import{isValidEvmAddress as I}from"@crossmint/common-sdk-base";var w=class C 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(!I(t.address))throw new Error("Wallet is not an EVM wallet");return new C(t)}sendTransaction(t){return o(this,null,function*(){var e;let n=this.buildTransaction(t),a=yield this.createTransaction(n,t.options);return(e=t.options)!=null&&e.experimental_prepareOnly?{hash:void 0,explorerLink:void 0,transactionId:a.id}:yield this.approveAndWait(a.id)})}signMessage(t){return o(this,null,function*(){var i;let n=yield this.apiClient.createSignature(this.walletLocator,{type:"message",params:{message:t,signer:this.signer.locator(),chain:this.chain}});if("error"in n)throw new d(JSON.stringify(n));let a=n.id,e=((i=n.approvals)==null?void 0:i.pending)||[];return yield this.approveSignature(e,a),yield this.waitForSignature(a)})}signTypedData(t){return o(this,null,function*(){var T;let{domain:n,message:a,primaryType:e,types:i,chain:r}=t;if(!n||!a||!i||!r)throw new p("Invalid typed data");let{name:u,version:l,chainId:h,verifyingContract:y,salt:v}=n;if(!u||!l||!h||!y)throw new p("Invalid typed data domain");let s=yield this.apiClient.createSignature(this.walletLocator,{type:"typed-data",params:{typedData:{domain:{name:u,version:l,chainId:Number(h),verifyingContract:y,salt:v},message:a,primaryType:e,types:i},signer:this.signer.locator(),chain:r,isSmartWalletSignature:!1}});if("error"in s)throw new d(JSON.stringify(s));let g=s.id,D=((T=s.approvals)==null?void 0:T.pending)||[];return yield this.approveSignature(D,g),yield this.waitForSignature(g)})}getViemClient(t){var n;return E({transport:(n=t==null?void 0:t.transport)!=null?n:V(),chain:f(this.chain)})}createTransaction(t,n){return o(this,null,function*(){var i;let a=(i=n==null?void 0:n.experimental_signer)!=null?i:this.signer.locator(),e=yield this.apiClient.createTransaction(this.walletLocator,{params:{signer:a,chain:this.chain,calls:[t]}});if("error"in e)throw new m(JSON.stringify(e));return e})}buildTransaction(t){var n,a,e,i,r;if("transaction"in t)return{transaction:t.transaction};if(t.abi==null)return{to:t.to,value:(a=(n=t.value)==null?void 0:n.toString())!=null?a:"0",data:(e=t.data)!=null?e:"0x"};if(!t.functionName)throw new Error("Function name is required");return{to:t.to,value:(r=(i=t.value)==null?void 0:i.toString())!=null?r:"0",data:S({abi:t.abi,functionName:t.functionName,args:t.args})}}};export{w as a};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk7L2MNVVScjs = require('./chunk-7L2MNVVS.cjs');var _chunkNVGWQJBWcjs = require('./chunk-NVGWQJBW.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var i=class o{constructor(t){let r=new (0, _chunkNVGWQJBWcjs.a)(t);this.walletFactory=new (0, _chunk7L2MNVVScjs.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
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkNAI62DBYcjs = require('./chunk-NAI62DBY.cjs');var _chunkPW4RFMOBcjs = require('./chunk-PW4RFMOB.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var i=class o{constructor(t){let r=new (0, _chunkPW4RFMOBcjs.a)(t);this.walletFactory=new (0, _chunkNAI62DBYcjs.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;
@@ -0,0 +1 @@
1
+ import{a as t}from"./chunk-VRWKCVVK.js";import{a as l}from"./chunk-SCS4UDW7.js";import{q as c}from"./chunk-7ENJXL4H.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:p=>(p.sign([o]),Promise.resolve(p))}))};return yield this.approveAndWait(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 c(JSON.stringify(e));return e})}};export{d as a};
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBOJW3SWKcjs = require('./chunk-BOJW3SWK.cjs');var _chunk7JFXS23Ucjs = require('./chunk-7JFXS23U.cjs');var _chunkVWPHXUTUcjs = require('./chunk-VWPHXUTU.cjs');require('./chunk-7L2MNVVS.cjs');var _chunkVOVPHLO5cjs = require('./chunk-VOVPHLO5.cjs');require('./chunk-IQB4HWD3.cjs');require('./chunk-3ABHUDKX.cjs');require('./chunk-3HZJR6A3.cjs');require('./chunk-5KA7SYRH.cjs');require('./chunk-MLOSILO2.cjs');require('./chunk-U4S6GWMK.cjs');require('./chunk-YWPTI2QO.cjs');require('./chunk-4KXOWU5E.cjs');require('./chunk-YTAW674L.cjs');require('./chunk-ZSWIQU3U.cjs');require('./chunk-RFK6N7LC.cjs');require('./chunk-6HXIZLEQ.cjs');var _chunkNVGWQJBWcjs = require('./chunk-NVGWQJBW.cjs');require('./chunk-BCOGNFY7.cjs');require('./chunk-CT2UGJEL.cjs');require('./chunk-ECAM5KTH.cjs');require('./chunk-6VJEBYPN.cjs');require('./chunk-IR5WN6FQ.cjs');require('./chunk-GEY574TH.cjs');require('./chunk-YZ4HRYSL.cjs');require('./chunk-BULGM35W.cjs');require('./chunk-XALFCQKD.cjs');exports.CrossmintWallets = _chunkVWPHXUTUcjs.b; exports.EVMWallet = _chunkBOJW3SWKcjs.a; exports.SolanaWallet = _chunk7JFXS23Ucjs.a; exports.Wallet = _chunkVOVPHLO5cjs.a; exports.WalletsApiClient = _chunkNVGWQJBWcjs.a; exports.createCrossmint = _chunkVWPHXUTUcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk77UQTNS7cjs = require('./chunk-77UQTNS7.cjs');var _chunkX7Y4HEDKcjs = require('./chunk-X7Y4HEDK.cjs');var _chunkXTGLXZAWcjs = require('./chunk-XTGLXZAW.cjs');require('./chunk-NAI62DBY.cjs');var _chunk7OMPE56Gcjs = require('./chunk-7OMPE56G.cjs');require('./chunk-IQB4HWD3.cjs');require('./chunk-3ABHUDKX.cjs');require('./chunk-3HZJR6A3.cjs');require('./chunk-5KA7SYRH.cjs');require('./chunk-MLOSILO2.cjs');require('./chunk-U4S6GWMK.cjs');require('./chunk-YWPTI2QO.cjs');require('./chunk-4KXOWU5E.cjs');require('./chunk-YTAW674L.cjs');require('./chunk-ZSWIQU3U.cjs');require('./chunk-RFK6N7LC.cjs');require('./chunk-6HXIZLEQ.cjs');var _chunkPW4RFMOBcjs = require('./chunk-PW4RFMOB.cjs');require('./chunk-M3EZNQE5.cjs');require('./chunk-CT2UGJEL.cjs');require('./chunk-ECAM5KTH.cjs');require('./chunk-6VJEBYPN.cjs');require('./chunk-IR5WN6FQ.cjs');require('./chunk-GEY574TH.cjs');require('./chunk-YZ4HRYSL.cjs');require('./chunk-BULGM35W.cjs');require('./chunk-XALFCQKD.cjs');exports.CrossmintWallets = _chunkXTGLXZAWcjs.b; exports.EVMWallet = _chunk77UQTNS7cjs.a; exports.SolanaWallet = _chunkX7Y4HEDKcjs.a; exports.Wallet = _chunk7OMPE56Gcjs.a; exports.WalletsApiClient = _chunkPW4RFMOBcjs.a; exports.createCrossmint = _chunkXTGLXZAWcjs.a;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{a as o}from"./chunk-AEZDU2JM.js";import{a as r}from"./chunk-SGL7VVQD.js";import{a,b as t}from"./chunk-2I26U7NK.js";import"./chunk-OEEB24PA.js";import{a as n}from"./chunk-JGHXHURY.js";import"./chunk-5U4PVNPM.js";import"./chunk-7AFCY47Q.js";import"./chunk-4FM7WA5H.js";import"./chunk-U3KINSXQ.js";import"./chunk-YNIO2LU5.js";import"./chunk-Y5NVCPZ2.js";import"./chunk-UBOWSXW3.js";import"./chunk-IGBQEAD5.js";import"./chunk-SCS4UDW7.js";import"./chunk-M4ELAV7U.js";import"./chunk-IJMFCZIY.js";import"./chunk-5IFDVB4Y.js";import{a as e}from"./chunk-KQJXLOUT.js";import"./chunk-EQRZJV6Q.js";import"./chunk-7ENJXL4H.js";import"./chunk-KBJA7JDT.js";import"./chunk-BJDS5BJG.js";import"./chunk-KKQBZXFE.js";import"./chunk-S3DYQVRD.js";import"./chunk-LW6JSI4J.js";import"./chunk-5S6YZJHE.js";import"./chunk-BW7YYVZE.js";export{t as CrossmintWallets,o as EVMWallet,r as SolanaWallet,n as Wallet,e as WalletsApiClient,a as createCrossmint};
1
+ import{a as o}from"./chunk-XP4QXJGR.js";import{a as r}from"./chunk-XXIW4AEP.js";import{a,b as t}from"./chunk-UQPCW4TD.js";import"./chunk-TXMD64BR.js";import{a as n}from"./chunk-VRWKCVVK.js";import"./chunk-5U4PVNPM.js";import"./chunk-7AFCY47Q.js";import"./chunk-4FM7WA5H.js";import"./chunk-U3KINSXQ.js";import"./chunk-YNIO2LU5.js";import"./chunk-Y5NVCPZ2.js";import"./chunk-UBOWSXW3.js";import"./chunk-IGBQEAD5.js";import"./chunk-SCS4UDW7.js";import"./chunk-M4ELAV7U.js";import"./chunk-IJMFCZIY.js";import"./chunk-5IFDVB4Y.js";import{a as e}from"./chunk-5777T43M.js";import"./chunk-AIH4VH3N.js";import"./chunk-7ENJXL4H.js";import"./chunk-KBJA7JDT.js";import"./chunk-BJDS5BJG.js";import"./chunk-KKQBZXFE.js";import"./chunk-S3DYQVRD.js";import"./chunk-LW6JSI4J.js";import"./chunk-5S6YZJHE.js";import"./chunk-BW7YYVZE.js";export{t as CrossmintWallets,o as EVMWallet,r as SolanaWallet,n as Wallet,e as WalletsApiClient,a as createCrossmint};
package/dist/sdk.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkVWPHXUTUcjs = require('./chunk-VWPHXUTU.cjs');require('./chunk-7L2MNVVS.cjs');require('./chunk-VOVPHLO5.cjs');require('./chunk-IQB4HWD3.cjs');require('./chunk-3ABHUDKX.cjs');require('./chunk-3HZJR6A3.cjs');require('./chunk-5KA7SYRH.cjs');require('./chunk-MLOSILO2.cjs');require('./chunk-U4S6GWMK.cjs');require('./chunk-YWPTI2QO.cjs');require('./chunk-4KXOWU5E.cjs');require('./chunk-YTAW674L.cjs');require('./chunk-ZSWIQU3U.cjs');require('./chunk-RFK6N7LC.cjs');require('./chunk-6HXIZLEQ.cjs');require('./chunk-NVGWQJBW.cjs');require('./chunk-BCOGNFY7.cjs');require('./chunk-CT2UGJEL.cjs');require('./chunk-ECAM5KTH.cjs');require('./chunk-YZ4HRYSL.cjs');require('./chunk-BULGM35W.cjs');require('./chunk-XALFCQKD.cjs');exports.CrossmintWallets = _chunkVWPHXUTUcjs.b; exports.createCrossmint = _chunkVWPHXUTUcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkXTGLXZAWcjs = require('./chunk-XTGLXZAW.cjs');require('./chunk-NAI62DBY.cjs');require('./chunk-7OMPE56G.cjs');require('./chunk-IQB4HWD3.cjs');require('./chunk-3ABHUDKX.cjs');require('./chunk-3HZJR6A3.cjs');require('./chunk-5KA7SYRH.cjs');require('./chunk-MLOSILO2.cjs');require('./chunk-U4S6GWMK.cjs');require('./chunk-YWPTI2QO.cjs');require('./chunk-4KXOWU5E.cjs');require('./chunk-YTAW674L.cjs');require('./chunk-ZSWIQU3U.cjs');require('./chunk-RFK6N7LC.cjs');require('./chunk-6HXIZLEQ.cjs');require('./chunk-PW4RFMOB.cjs');require('./chunk-M3EZNQE5.cjs');require('./chunk-CT2UGJEL.cjs');require('./chunk-ECAM5KTH.cjs');require('./chunk-YZ4HRYSL.cjs');require('./chunk-BULGM35W.cjs');require('./chunk-XALFCQKD.cjs');exports.CrossmintWallets = _chunkXTGLXZAWcjs.b; exports.createCrossmint = _chunkXTGLXZAWcjs.a;
package/dist/sdk.d.cts CHANGED
@@ -7,10 +7,10 @@ import './signers/types.cjs';
7
7
  import 'ox';
8
8
  import '@crossmint/client-sdk-window';
9
9
  import '@crossmint/client-signers';
10
+ import './api/gen/types.gen.cjs';
10
11
  import './api/client.cjs';
11
12
  import './api/types.cjs';
12
13
  import 'viem';
13
- import './api/gen/types.gen.cjs';
14
14
  import '@solana/web3.js';
15
15
  import 'abitype';
16
16
 
package/dist/sdk.d.ts CHANGED
@@ -7,10 +7,10 @@ import './signers/types.js';
7
7
  import 'ox';
8
8
  import '@crossmint/client-sdk-window';
9
9
  import '@crossmint/client-signers';
10
+ import './api/gen/types.gen.js';
10
11
  import './api/client.js';
11
12
  import './api/types.js';
12
13
  import 'viem';
13
- import './api/gen/types.gen.js';
14
14
  import '@solana/web3.js';
15
15
  import 'abitype';
16
16
 
package/dist/sdk.js CHANGED
@@ -1 +1 @@
1
- import{a,b}from"./chunk-2I26U7NK.js";import"./chunk-OEEB24PA.js";import"./chunk-JGHXHURY.js";import"./chunk-5U4PVNPM.js";import"./chunk-7AFCY47Q.js";import"./chunk-4FM7WA5H.js";import"./chunk-U3KINSXQ.js";import"./chunk-YNIO2LU5.js";import"./chunk-Y5NVCPZ2.js";import"./chunk-UBOWSXW3.js";import"./chunk-IGBQEAD5.js";import"./chunk-SCS4UDW7.js";import"./chunk-M4ELAV7U.js";import"./chunk-IJMFCZIY.js";import"./chunk-5IFDVB4Y.js";import"./chunk-KQJXLOUT.js";import"./chunk-EQRZJV6Q.js";import"./chunk-7ENJXL4H.js";import"./chunk-KBJA7JDT.js";import"./chunk-LW6JSI4J.js";import"./chunk-5S6YZJHE.js";import"./chunk-BW7YYVZE.js";export{b as CrossmintWallets,a as createCrossmint};
1
+ import{a,b}from"./chunk-UQPCW4TD.js";import"./chunk-TXMD64BR.js";import"./chunk-VRWKCVVK.js";import"./chunk-5U4PVNPM.js";import"./chunk-7AFCY47Q.js";import"./chunk-4FM7WA5H.js";import"./chunk-U3KINSXQ.js";import"./chunk-YNIO2LU5.js";import"./chunk-Y5NVCPZ2.js";import"./chunk-UBOWSXW3.js";import"./chunk-IGBQEAD5.js";import"./chunk-SCS4UDW7.js";import"./chunk-M4ELAV7U.js";import"./chunk-IJMFCZIY.js";import"./chunk-5IFDVB4Y.js";import"./chunk-5777T43M.js";import"./chunk-AIH4VH3N.js";import"./chunk-7ENJXL4H.js";import"./chunk-KBJA7JDT.js";import"./chunk-LW6JSI4J.js";import"./chunk-5S6YZJHE.js";import"./chunk-BW7YYVZE.js";export{b as CrossmintWallets,a as createCrossmint};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBCOGNFY7cjs = require('../chunk-BCOGNFY7.cjs');require('../chunk-XALFCQKD.cjs');exports.SDK_NAME = _chunkBCOGNFY7cjs.c; exports.SDK_VERSION = _chunkBCOGNFY7cjs.b; exports.STATUS_POLLING_INTERVAL_MS = _chunkBCOGNFY7cjs.d; exports.WALLETS_SERVICE = _chunkBCOGNFY7cjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkM3EZNQE5cjs = require('../chunk-M3EZNQE5.cjs');require('../chunk-XALFCQKD.cjs');exports.SDK_NAME = _chunkM3EZNQE5cjs.c; exports.SDK_VERSION = _chunkM3EZNQE5cjs.b; exports.STATUS_POLLING_INTERVAL_MS = _chunkM3EZNQE5cjs.d; exports.WALLETS_SERVICE = _chunkM3EZNQE5cjs.a;
@@ -1 +1 @@
1
- import{a,b,c,d}from"../chunk-EQRZJV6Q.js";import"../chunk-BW7YYVZE.js";export{c as SDK_NAME,b as SDK_VERSION,d as STATUS_POLLING_INTERVAL_MS,a as WALLETS_SERVICE};
1
+ import{a,b,c,d}from"../chunk-AIH4VH3N.js";import"../chunk-BW7YYVZE.js";export{c as SDK_NAME,b as SDK_VERSION,d as STATUS_POLLING_INTERVAL_MS,a as WALLETS_SERVICE};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBOJW3SWKcjs = require('../chunk-BOJW3SWK.cjs');require('../chunk-VOVPHLO5.cjs');require('../chunk-BCOGNFY7.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-6VJEBYPN.cjs');require('../chunk-IR5WN6FQ.cjs');require('../chunk-GEY574TH.cjs');require('../chunk-XALFCQKD.cjs');exports.EVMWallet = _chunkBOJW3SWKcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk77UQTNS7cjs = require('../chunk-77UQTNS7.cjs');require('../chunk-7OMPE56G.cjs');require('../chunk-M3EZNQE5.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-6VJEBYPN.cjs');require('../chunk-IR5WN6FQ.cjs');require('../chunk-GEY574TH.cjs');require('../chunk-XALFCQKD.cjs');exports.EVMWallet = _chunk77UQTNS7cjs.a;
@@ -1 +1 @@
1
- import{a}from"../chunk-AEZDU2JM.js";import"../chunk-JGHXHURY.js";import"../chunk-EQRZJV6Q.js";import"../chunk-7ENJXL4H.js";import"../chunk-BJDS5BJG.js";import"../chunk-KKQBZXFE.js";import"../chunk-S3DYQVRD.js";import"../chunk-BW7YYVZE.js";export{a as EVMWallet};
1
+ import{a}from"../chunk-XP4QXJGR.js";import"../chunk-VRWKCVVK.js";import"../chunk-AIH4VH3N.js";import"../chunk-7ENJXL4H.js";import"../chunk-BJDS5BJG.js";import"../chunk-KKQBZXFE.js";import"../chunk-S3DYQVRD.js";import"../chunk-BW7YYVZE.js";export{a as EVMWallet};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk7JFXS23Ucjs = require('../chunk-7JFXS23U.cjs');require('../chunk-VOVPHLO5.cjs');require('../chunk-YTAW674L.cjs');require('../chunk-BCOGNFY7.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-XALFCQKD.cjs');exports.SolanaWallet = _chunk7JFXS23Ucjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkX7Y4HEDKcjs = require('../chunk-X7Y4HEDK.cjs');require('../chunk-7OMPE56G.cjs');require('../chunk-YTAW674L.cjs');require('../chunk-M3EZNQE5.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-XALFCQKD.cjs');exports.SolanaWallet = _chunkX7Y4HEDKcjs.a;
@@ -1 +1 @@
1
- import{a}from"../chunk-SGL7VVQD.js";import"../chunk-JGHXHURY.js";import"../chunk-SCS4UDW7.js";import"../chunk-EQRZJV6Q.js";import"../chunk-7ENJXL4H.js";import"../chunk-BW7YYVZE.js";export{a as SolanaWallet};
1
+ import{a}from"../chunk-XXIW4AEP.js";import"../chunk-VRWKCVVK.js";import"../chunk-SCS4UDW7.js";import"../chunk-AIH4VH3N.js";import"../chunk-7ENJXL4H.js";import"../chunk-BW7YYVZE.js";export{a as SolanaWallet};
@@ -5,7 +5,7 @@ import { Abi } from 'abitype';
5
5
  import { CreateTransactionSuccessResponse } from '../api/types.cjs';
6
6
  export { Activity } from '../api/types.cjs';
7
7
  import { Chain } from '../chains/chains.cjs';
8
- import { SignerConfigForChain } from '../signers/types.cjs';
8
+ import { SignerConfigForChain, BaseSignResult, PasskeySignResult, Signer } from '../signers/types.cjs';
9
9
  import 'viem';
10
10
  import '../api/gen/types.gen.cjs';
11
11
  import 'ox';
@@ -13,6 +13,7 @@ import '@crossmint/common-sdk-base';
13
13
 
14
14
  type TransactionInputOptions = {
15
15
  experimental_prepareOnly?: boolean;
16
+ experimental_signer?: string;
16
17
  };
17
18
  type EVMTransactionInputBase = {
18
19
  options?: TransactionInputOptions;
@@ -90,5 +91,16 @@ type Transaction<TPrepareOnly extends boolean = false> = TPrepareOnly extends tr
90
91
  explorerLink: string;
91
92
  transactionId: string;
92
93
  };
94
+ type ApproveTransactionOptions = {
95
+ experimental_approval?: Approval;
96
+ additionalSigners?: Signer[];
97
+ };
98
+ type ApproveTransactionParams = {
99
+ transactionId: string;
100
+ options?: ApproveTransactionOptions;
101
+ };
102
+ type Approval = (BaseSignResult | PasskeySignResult) & {
103
+ signer: string;
104
+ };
93
105
 
94
- export type { Balances, Callbacks, DelegatedSigner, EVMTransactionInput, FormattedEVMTransaction, PendingApproval, SolanaTransactionInput, TokenBalance, Transaction, TransactionInputOptions, UserLocator, WalletArgsFor, WalletOptions };
106
+ export type { Approval, ApproveTransactionOptions, ApproveTransactionParams, Balances, Callbacks, DelegatedSigner, EVMTransactionInput, FormattedEVMTransaction, PendingApproval, SolanaTransactionInput, TokenBalance, Transaction, TransactionInputOptions, UserLocator, WalletArgsFor, WalletOptions };
@@ -5,7 +5,7 @@ import { Abi } from 'abitype';
5
5
  import { CreateTransactionSuccessResponse } from '../api/types.js';
6
6
  export { Activity } from '../api/types.js';
7
7
  import { Chain } from '../chains/chains.js';
8
- import { SignerConfigForChain } from '../signers/types.js';
8
+ import { SignerConfigForChain, BaseSignResult, PasskeySignResult, Signer } from '../signers/types.js';
9
9
  import 'viem';
10
10
  import '../api/gen/types.gen.js';
11
11
  import 'ox';
@@ -13,6 +13,7 @@ import '@crossmint/common-sdk-base';
13
13
 
14
14
  type TransactionInputOptions = {
15
15
  experimental_prepareOnly?: boolean;
16
+ experimental_signer?: string;
16
17
  };
17
18
  type EVMTransactionInputBase = {
18
19
  options?: TransactionInputOptions;
@@ -90,5 +91,16 @@ type Transaction<TPrepareOnly extends boolean = false> = TPrepareOnly extends tr
90
91
  explorerLink: string;
91
92
  transactionId: string;
92
93
  };
94
+ type ApproveTransactionOptions = {
95
+ experimental_approval?: Approval;
96
+ additionalSigners?: Signer[];
97
+ };
98
+ type ApproveTransactionParams = {
99
+ transactionId: string;
100
+ options?: ApproveTransactionOptions;
101
+ };
102
+ type Approval = (BaseSignResult | PasskeySignResult) & {
103
+ signer: string;
104
+ };
93
105
 
94
- export type { Balances, Callbacks, DelegatedSigner, EVMTransactionInput, FormattedEVMTransaction, PendingApproval, SolanaTransactionInput, TokenBalance, Transaction, TransactionInputOptions, UserLocator, WalletArgsFor, WalletOptions };
106
+ export type { Approval, ApproveTransactionOptions, ApproveTransactionParams, Balances, Callbacks, DelegatedSigner, EVMTransactionInput, FormattedEVMTransaction, PendingApproval, SolanaTransactionInput, TokenBalance, Transaction, TransactionInputOptions, UserLocator, WalletArgsFor, WalletOptions };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk7L2MNVVScjs = require('../chunk-7L2MNVVS.cjs');require('../chunk-VOVPHLO5.cjs');require('../chunk-IQB4HWD3.cjs');require('../chunk-3ABHUDKX.cjs');require('../chunk-3HZJR6A3.cjs');require('../chunk-5KA7SYRH.cjs');require('../chunk-MLOSILO2.cjs');require('../chunk-U4S6GWMK.cjs');require('../chunk-YWPTI2QO.cjs');require('../chunk-4KXOWU5E.cjs');require('../chunk-YTAW674L.cjs');require('../chunk-ZSWIQU3U.cjs');require('../chunk-RFK6N7LC.cjs');require('../chunk-BCOGNFY7.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-YZ4HRYSL.cjs');require('../chunk-BULGM35W.cjs');require('../chunk-XALFCQKD.cjs');exports.WalletFactory = _chunk7L2MNVVScjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkNAI62DBYcjs = require('../chunk-NAI62DBY.cjs');require('../chunk-7OMPE56G.cjs');require('../chunk-IQB4HWD3.cjs');require('../chunk-3ABHUDKX.cjs');require('../chunk-3HZJR6A3.cjs');require('../chunk-5KA7SYRH.cjs');require('../chunk-MLOSILO2.cjs');require('../chunk-U4S6GWMK.cjs');require('../chunk-YWPTI2QO.cjs');require('../chunk-4KXOWU5E.cjs');require('../chunk-YTAW674L.cjs');require('../chunk-ZSWIQU3U.cjs');require('../chunk-RFK6N7LC.cjs');require('../chunk-M3EZNQE5.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-YZ4HRYSL.cjs');require('../chunk-BULGM35W.cjs');require('../chunk-XALFCQKD.cjs');exports.WalletFactory = _chunkNAI62DBYcjs.a;
@@ -1 +1 @@
1
- import{a}from"../chunk-OEEB24PA.js";import"../chunk-JGHXHURY.js";import"../chunk-5U4PVNPM.js";import"../chunk-7AFCY47Q.js";import"../chunk-4FM7WA5H.js";import"../chunk-U3KINSXQ.js";import"../chunk-YNIO2LU5.js";import"../chunk-Y5NVCPZ2.js";import"../chunk-UBOWSXW3.js";import"../chunk-IGBQEAD5.js";import"../chunk-SCS4UDW7.js";import"../chunk-M4ELAV7U.js";import"../chunk-IJMFCZIY.js";import"../chunk-EQRZJV6Q.js";import"../chunk-7ENJXL4H.js";import"../chunk-LW6JSI4J.js";import"../chunk-5S6YZJHE.js";import"../chunk-BW7YYVZE.js";export{a as WalletFactory};
1
+ import{a}from"../chunk-TXMD64BR.js";import"../chunk-VRWKCVVK.js";import"../chunk-5U4PVNPM.js";import"../chunk-7AFCY47Q.js";import"../chunk-4FM7WA5H.js";import"../chunk-U3KINSXQ.js";import"../chunk-YNIO2LU5.js";import"../chunk-Y5NVCPZ2.js";import"../chunk-UBOWSXW3.js";import"../chunk-IGBQEAD5.js";import"../chunk-SCS4UDW7.js";import"../chunk-M4ELAV7U.js";import"../chunk-IJMFCZIY.js";import"../chunk-AIH4VH3N.js";import"../chunk-7ENJXL4H.js";import"../chunk-LW6JSI4J.js";import"../chunk-5S6YZJHE.js";import"../chunk-BW7YYVZE.js";export{a as WalletFactory};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkVOVPHLO5cjs = require('../chunk-VOVPHLO5.cjs');require('../chunk-BCOGNFY7.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-XALFCQKD.cjs');exports.Wallet = _chunkVOVPHLO5cjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk7OMPE56Gcjs = require('../chunk-7OMPE56G.cjs');require('../chunk-M3EZNQE5.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-XALFCQKD.cjs');exports.Wallet = _chunk7OMPE56Gcjs.a;
@@ -1,8 +1,8 @@
1
1
  import { Signer, PasskeySignResult, BaseSignResult } from '../signers/types.cjs';
2
- import { ApiClient } from '../api/client.cjs';
3
- import { GetTransactionsResponse, GetTransactionResponse, Activity, RegisterSignerPasskeyParams, WalletLocator } from '../api/types.cjs';
4
2
  import { WalletNftsResponseDto, WalletsTransactionV2025ResponseDto } from '../api/gen/types.gen.cjs';
5
- import { WalletOptions, Balances, TransactionInputOptions, UserLocator, Transaction, DelegatedSigner, PendingApproval } from './types.cjs';
3
+ import { ApiClient } from '../api/client.cjs';
4
+ import { GetTransactionsResponse, GetTransactionSuccessResponse, Activity, RegisterSignerPasskeyParams, WalletLocator } from '../api/types.cjs';
5
+ import { WalletOptions, Balances, TransactionInputOptions, UserLocator, Transaction, ApproveTransactionParams, DelegatedSigner, ApproveTransactionOptions, PendingApproval } from './types.cjs';
6
6
  import { Chain } from '../chains/chains.cjs';
7
7
  import 'ox';
8
8
  import '@crossmint/client-sdk-window';
@@ -59,13 +59,15 @@ declare class Wallet<C extends Chain> {
59
59
  /**
60
60
  * Get the wallet transactions
61
61
  * @returns The transactions
62
+ * @throws {Error} If the transactions cannot be retrieved
62
63
  */
63
64
  experimental_transactions(): Promise<GetTransactionsResponse>;
64
65
  /**
65
66
  * Get a transaction by id
66
67
  * @returns The transaction
68
+ * @throws {Error} If the transaction cannot be retrieved
67
69
  */
68
- experimental_transaction(transactionId: string): Promise<GetTransactionResponse>;
70
+ experimental_transaction(transactionId: string): Promise<GetTransactionSuccessResponse>;
69
71
  /**
70
72
  * Get the wallet activity
71
73
  * @returns The activity
@@ -84,6 +86,20 @@ declare class Wallet<C extends Chain> {
84
86
  send<T extends TransactionInputOptions | undefined = undefined>(to: string | UserLocator, token: string, amount: string, options?: T): Promise<Transaction<T extends {
85
87
  experimental_prepareOnly: true;
86
88
  } ? true : false>>;
89
+ /**
90
+ * Approve a transaction
91
+ * @param params - The parameters
92
+ * @param params.transactionId - The transaction id
93
+ * @param params.options - The options for the transaction
94
+ * @param params.options.experimental_approval - The approval
95
+ * @param params.options.additionalSigners - The additional signers
96
+ * @returns The transaction
97
+ */
98
+ approveTransaction(params: ApproveTransactionParams): Promise<{
99
+ hash: string;
100
+ explorerLink: string;
101
+ transactionId: string;
102
+ }>;
87
103
  /**
88
104
  * Add a delegated signer to the wallet
89
105
  * @param signer - The signer. For Solana, it must be a string. For EVM, it can be a string or a passkey.
@@ -95,12 +111,13 @@ declare class Wallet<C extends Chain> {
95
111
  delegatedSigners(): Promise<DelegatedSigner[]>;
96
112
  protected get walletLocator(): WalletLocator;
97
113
  protected get isSolanaWallet(): boolean;
98
- protected approveAndWait(transactionId: string, additionalSigners?: Signer[]): Promise<{
114
+ protected approveAndWait(transactionId: string, options?: ApproveTransactionOptions): Promise<{
99
115
  hash: string;
100
116
  explorerLink: string;
101
117
  transactionId: string;
102
118
  }>;
103
- protected approveTransaction(transactionId: string, additionalSigners?: Signer[]): Promise<WalletsTransactionV2025ResponseDto>;
119
+ protected approveTransactionInternal(transactionId: string, options?: ApproveTransactionOptions): Promise<WalletsTransactionV2025ResponseDto>;
120
+ private executeApprovalWithErrorHandling;
104
121
  protected approveSignature(pendingApprovals: Array<PendingApproval>, signatureId: string): Promise<PasskeySignResult | BaseSignResult>;
105
122
  protected waitForSignature(signatureId: string): Promise<string>;
106
123
  protected waitForTransaction(transactionId: string, timeoutMs?: number, { backoffMultiplier, maxBackoffMs, initialBackoffMs, }?: {
@@ -1,8 +1,8 @@
1
1
  import { Signer, PasskeySignResult, BaseSignResult } from '../signers/types.js';
2
- import { ApiClient } from '../api/client.js';
3
- import { GetTransactionsResponse, GetTransactionResponse, Activity, RegisterSignerPasskeyParams, WalletLocator } from '../api/types.js';
4
2
  import { WalletNftsResponseDto, WalletsTransactionV2025ResponseDto } from '../api/gen/types.gen.js';
5
- import { WalletOptions, Balances, TransactionInputOptions, UserLocator, Transaction, DelegatedSigner, PendingApproval } from './types.js';
3
+ import { ApiClient } from '../api/client.js';
4
+ import { GetTransactionsResponse, GetTransactionSuccessResponse, Activity, RegisterSignerPasskeyParams, WalletLocator } from '../api/types.js';
5
+ import { WalletOptions, Balances, TransactionInputOptions, UserLocator, Transaction, ApproveTransactionParams, DelegatedSigner, ApproveTransactionOptions, PendingApproval } from './types.js';
6
6
  import { Chain } from '../chains/chains.js';
7
7
  import 'ox';
8
8
  import '@crossmint/client-sdk-window';
@@ -59,13 +59,15 @@ declare class Wallet<C extends Chain> {
59
59
  /**
60
60
  * Get the wallet transactions
61
61
  * @returns The transactions
62
+ * @throws {Error} If the transactions cannot be retrieved
62
63
  */
63
64
  experimental_transactions(): Promise<GetTransactionsResponse>;
64
65
  /**
65
66
  * Get a transaction by id
66
67
  * @returns The transaction
68
+ * @throws {Error} If the transaction cannot be retrieved
67
69
  */
68
- experimental_transaction(transactionId: string): Promise<GetTransactionResponse>;
70
+ experimental_transaction(transactionId: string): Promise<GetTransactionSuccessResponse>;
69
71
  /**
70
72
  * Get the wallet activity
71
73
  * @returns The activity
@@ -84,6 +86,20 @@ declare class Wallet<C extends Chain> {
84
86
  send<T extends TransactionInputOptions | undefined = undefined>(to: string | UserLocator, token: string, amount: string, options?: T): Promise<Transaction<T extends {
85
87
  experimental_prepareOnly: true;
86
88
  } ? true : false>>;
89
+ /**
90
+ * Approve a transaction
91
+ * @param params - The parameters
92
+ * @param params.transactionId - The transaction id
93
+ * @param params.options - The options for the transaction
94
+ * @param params.options.experimental_approval - The approval
95
+ * @param params.options.additionalSigners - The additional signers
96
+ * @returns The transaction
97
+ */
98
+ approveTransaction(params: ApproveTransactionParams): Promise<{
99
+ hash: string;
100
+ explorerLink: string;
101
+ transactionId: string;
102
+ }>;
87
103
  /**
88
104
  * Add a delegated signer to the wallet
89
105
  * @param signer - The signer. For Solana, it must be a string. For EVM, it can be a string or a passkey.
@@ -95,12 +111,13 @@ declare class Wallet<C extends Chain> {
95
111
  delegatedSigners(): Promise<DelegatedSigner[]>;
96
112
  protected get walletLocator(): WalletLocator;
97
113
  protected get isSolanaWallet(): boolean;
98
- protected approveAndWait(transactionId: string, additionalSigners?: Signer[]): Promise<{
114
+ protected approveAndWait(transactionId: string, options?: ApproveTransactionOptions): Promise<{
99
115
  hash: string;
100
116
  explorerLink: string;
101
117
  transactionId: string;
102
118
  }>;
103
- protected approveTransaction(transactionId: string, additionalSigners?: Signer[]): Promise<WalletsTransactionV2025ResponseDto>;
119
+ protected approveTransactionInternal(transactionId: string, options?: ApproveTransactionOptions): Promise<WalletsTransactionV2025ResponseDto>;
120
+ private executeApprovalWithErrorHandling;
104
121
  protected approveSignature(pendingApprovals: Array<PendingApproval>, signatureId: string): Promise<PasskeySignResult | BaseSignResult>;
105
122
  protected waitForSignature(signatureId: string): Promise<string>;
106
123
  protected waitForTransaction(transactionId: string, timeoutMs?: number, { backoffMultiplier, maxBackoffMs, initialBackoffMs, }?: {
@@ -1 +1 @@
1
- import{a}from"../chunk-JGHXHURY.js";import"../chunk-EQRZJV6Q.js";import"../chunk-7ENJXL4H.js";import"../chunk-BW7YYVZE.js";export{a as Wallet};
1
+ import{a}from"../chunk-VRWKCVVK.js";import"../chunk-AIH4VH3N.js";import"../chunk-7ENJXL4H.js";import"../chunk-BW7YYVZE.js";export{a as Wallet};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crossmint/wallets-sdk",
3
- "version": "0.10.15",
3
+ "version": "0.10.16",
4
4
  "repository": "https://github.com/Crossmint/crossmint-sdk",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Paella Labs Inc",
@@ -25,9 +25,9 @@
25
25
  "ox": "0.6.9",
26
26
  "tweetnacl": "1.0.3",
27
27
  "viem": "2.23.6",
28
- "@crossmint/client-sdk-window": "1.0.2",
28
+ "@crossmint/common-sdk-base": "0.8.5",
29
29
  "@crossmint/client-signers": "0.0.18",
30
- "@crossmint/common-sdk-base": "0.8.5"
30
+ "@crossmint/client-sdk-window": "1.0.2"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@hey-api/openapi-ts": "0.69.2",
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkVOVPHLO5cjs = require('./chunk-VOVPHLO5.cjs');var _chunkYTAW674Lcjs = require('./chunk-YTAW674L.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);var _commonsdkbase = require('@crossmint/common-sdk-base');var d=class u extends _chunkVOVPHLO5cjs.a{constructor(n){super({chain:n.chain,address:n.address,owner:n.owner,signer:n.signer},_chunkVOVPHLO5cjs.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 o,s;let i=yield this.createTransaction(n);if((o=n.options)!=null&&o.experimental_prepareOnly)return{hash:void 0,explorerLink:void 0,transactionId:i.id};let a=(s=n.additionalSigners)==null?void 0:s.map(e=>new (0, _chunkYTAW674Lcjs.a)({type:"external-wallet",address:e.publicKey.toString(),locator:`external-wallet:${e.publicKey.toString()}`,onSignTransaction:c=>(c.sign([e]),Promise.resolve(c))}));return yield this.approveAndWait(i.id,a)})}createTransaction(i){return _chunkXALFCQKDcjs.f.call(void 0, this,arguments,function*({transaction:n}){let a=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:_bs582.default.encode(n.serialize())}});if("error"in a)throw new (0, _chunkCT2UGJELcjs.q)(JSON.stringify(a));return a})}};exports.a = d;
@@ -1 +0,0 @@
1
- import{a as p}from"./chunk-JGHXHURY.js";import{k as c,o as d,q as T}from"./chunk-7ENJXL4H.js";import{a as f}from"./chunk-BJDS5BJG.js";import{f as o}from"./chunk-BW7YYVZE.js";import{createPublicClient as E,encodeFunctionData as S,http as V}from"viem";import{isValidEvmAddress as M}from"@crossmint/common-sdk-base";var w=class C extends p{constructor(t){super({chain:t.chain,address:t.address,owner:t.owner,signer:t.signer,options:p.getOptions(t)},p.getApiClient(t))}static from(t){if(!M(t.address))throw new Error("Wallet is not an EVM wallet");return new C(t)}sendTransaction(t){return o(this,null,function*(){var e;let n=this.buildTransaction(t),a=yield this.createTransaction(n);return(e=t.options)!=null&&e.experimental_prepareOnly?{hash:void 0,explorerLink:void 0,transactionId:a.id}:yield this.approveAndWait(a.id)})}signMessage(t){return o(this,null,function*(){var i;let n=yield this.apiClient.createSignature(this.walletLocator,{type:"message",params:{message:t,signer:this.signer.locator(),chain:this.chain}});if("error"in n)throw new d(JSON.stringify(n));let a=n.id,e=((i=n.approvals)==null?void 0:i.pending)||[];return yield this.approveSignature(e,a),yield this.waitForSignature(a)})}signTypedData(t){return o(this,null,function*(){var m;let{domain:n,message:a,primaryType:e,types:i,chain:r}=t;if(!n||!a||!i||!r)throw new c("Invalid typed data");let{name:u,version:l,chainId:h,verifyingContract:y,salt:v}=n;if(!u||!l||!h||!y)throw new c("Invalid typed data domain");let s=yield this.apiClient.createSignature(this.walletLocator,{type:"typed-data",params:{typedData:{domain:{name:u,version:l,chainId:Number(h),verifyingContract:y,salt:v},message:a,primaryType:e,types:i},signer:this.signer.locator(),chain:r,isSmartWalletSignature:!1}});if("error"in s)throw new d(JSON.stringify(s));let g=s.id,D=((m=s.approvals)==null?void 0:m.pending)||[];return yield this.approveSignature(D,g),yield this.waitForSignature(g)})}getViemClient(t){var n;return E({transport:(n=t==null?void 0:t.transport)!=null?n:V(),chain:f(this.chain)})}createTransaction(t){return o(this,null,function*(){let n=yield this.apiClient.createTransaction(this.walletLocator,{params:{signer:this.signer.locator(),chain:this.chain,calls:[t]}});if("error"in n)throw new T(JSON.stringify(n));return n})}buildTransaction(t){var n,a,e,i,r;if("transaction"in t)return{transaction:t.transaction};if(t.abi==null)return{to:t.to,value:(a=(n=t.value)==null?void 0:n.toString())!=null?a:"0",data:(e=t.data)!=null?e:"0x"};if(!t.functionName)throw new Error("Function name is required");return{to:t.to,value:(r=(i=t.value)==null?void 0:i.toString())!=null?r:"0",data:S({abi:t.abi,functionName:t.functionName,args:t.args})}}};export{w as a};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkVOVPHLO5cjs = require('./chunk-VOVPHLO5.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunk6VJEBYPNcjs = require('./chunk-6VJEBYPN.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _viem = require('viem');var _commonsdkbase = require('@crossmint/common-sdk-base');var w=class C extends _chunkVOVPHLO5cjs.a{constructor(t){super({chain:t.chain,address:t.address,owner:t.owner,signer:t.signer,options:_chunkVOVPHLO5cjs.a.getOptions(t)},_chunkVOVPHLO5cjs.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 C(t)}sendTransaction(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var e;let n=this.buildTransaction(t),a=yield this.createTransaction(n);return(e=t.options)!=null&&e.experimental_prepareOnly?{hash:void 0,explorerLink:void 0,transactionId:a.id}:yield this.approveAndWait(a.id)})}signMessage(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var i;let n=yield this.apiClient.createSignature(this.walletLocator,{type:"message",params:{message:t,signer:this.signer.locator(),chain:this.chain}});if("error"in n)throw new (0, _chunkCT2UGJELcjs.o)(JSON.stringify(n));let a=n.id,e=((i=n.approvals)==null?void 0:i.pending)||[];return yield this.approveSignature(e,a),yield this.waitForSignature(a)})}signTypedData(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var m;let{domain:n,message:a,primaryType:e,types:i,chain:r}=t;if(!n||!a||!i||!r)throw new (0, _chunkCT2UGJELcjs.k)("Invalid typed data");let{name:u,version:l,chainId:h,verifyingContract:y,salt:v}=n;if(!u||!l||!h||!y)throw new (0, _chunkCT2UGJELcjs.k)("Invalid typed data domain");let s=yield this.apiClient.createSignature(this.walletLocator,{type:"typed-data",params:{typedData:{domain:{name:u,version:l,chainId:Number(h),verifyingContract:y,salt:v},message:a,primaryType:e,types:i},signer:this.signer.locator(),chain:r,isSmartWalletSignature:!1}});if("error"in s)throw new (0, _chunkCT2UGJELcjs.o)(JSON.stringify(s));let g=s.id,D=((m=s.approvals)==null?void 0:m.pending)||[];return yield this.approveSignature(D,g),yield this.waitForSignature(g)})}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:_chunk6VJEBYPNcjs.a.call(void 0, this.chain)})}createTransaction(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let n=yield this.apiClient.createTransaction(this.walletLocator,{params:{signer:this.signer.locator(),chain:this.chain,calls:[t]}});if("error"in n)throw new (0, _chunkCT2UGJELcjs.q)(JSON.stringify(n));return n})}buildTransaction(t){var n,a,e,i,r;if("transaction"in t)return{transaction:t.transaction};if(t.abi==null)return{to:t.to,value:(a=(n=t.value)==null?void 0:n.toString())!=null?a:"0",data:(e=t.data)!=null?e:"0x"};if(!t.functionName)throw new Error("Function name is required");return{to:t.to,value:(r=(i=t.value)==null?void 0:i.toString())!=null?r:"0",data:_viem.encodeFunctionData.call(void 0, {abi:t.abi,functionName:t.functionName,args:t.args})}}};exports.a = w;
@@ -1 +0,0 @@
1
- var s="@crossmint/wallets-sdk",t="0.10.15";var c="WALLETS_SDK",r=t,d=s,a=500;export{c as a,r as b,d as c,a as d};
@@ -1 +0,0 @@
1
- import{d as b}from"./chunk-EQRZJV6Q.js";import{c as E,d as P,i as A,m as W,p as x,q as $,r as L,s as _,t as B,u as F,v as I,w as J}from"./chunk-7ENJXL4H.js";import{a as S,b as N,c as l,d as v,e as C,f as g}from"./chunk-BW7YYVZE.js";import{isValidAddress as G}from"@crossmint/common-sdk-base";var m,o,R=class{constructor(t,n){v(this,m);v(this,o);let{chain:e,address:i,owner:r,signer:p,options:d}=t;C(this,o,n),this.chain=e,this.address=i,this.owner=r,this.signer=p,C(this,m,d)}static getApiClient(t){return t.apiClient}static getOptions(t){return t.options}get apiClient(){return l(this,o)}get options(){return l(this,m)}balances(t,n){return g(this,null,function*(){let e=this.chain==="solana"?"sol":"eth",i=[e,"usdc",...t!=null?t:[]],r=yield l(this,o).getBalance(this.address,{chains:n!=null?n:[this.chain],tokens:i.map(p=>p.toLowerCase())});if("error"in r)throw new Error(`Failed to get balances for wallet: ${JSON.stringify(r.message)}`);return this.transformBalanceResponse(r,e,t)})}transformBalanceResponse(t,n,e){let i=a=>{var w,f,y,T,O;let u=(w=a.chains)==null?void 0:w[this.chain],h="contractAddress"in u?u.contractAddress:void 0;return{symbol:(f=a.symbol)!=null?f:"",name:(y=a.symbol)!=null?y:"",amount:(T=a.amount)!=null?T:"0",contractAddress:h,decimals:a.decimals,rawAmount:(O=a.rawAmount)!=null?O:"0"}},r=t.find(a=>a.symbol===n),p=t.find(a=>a.symbol==="usdc"),d=t.filter(a=>{var u;return a.symbol!==n&&a.symbol!=="usdc"&&(e==null?void 0:e.includes((u=a.symbol)!=null?u:""))}),s=a=>({symbol:a,name:a,amount:"0",contractAddress:void 0,decimals:0,rawAmount:"0"});return{nativeToken:r!=null?i(r):s(n),usdc:p!=null?i(p):s("usdc"),tokens:d.map(i)}}experimental_nfts(t){return g(this,null,function*(){return yield l(this,o).experimental_getNfts(N(S({},t),{chain:this.chain,address:this.address}))})}experimental_transactions(){return g(this,null,function*(){return yield l(this,o).getTransactions(this.walletLocator)})}experimental_transaction(t){return g(this,null,function*(){return yield l(this,o).getTransaction(this.walletLocator,t)})}experimental_activity(){return g(this,null,function*(){let t=yield this.apiClient.experimental_activity(this.walletLocator,{chain:this.chain});if("error"in t)throw new Error(`Failed to get activity: ${JSON.stringify(t.message)}`);return t})}send(t,n,e,i){return g(this,null,function*(){let r=k(t),p=M(n,this.chain),d={recipient:r,amount:e},s=yield l(this,o).send(this.walletLocator,p,d);if("message"in s)throw new $(`Failed to send token: ${JSON.stringify(s.message)}`);return i!=null&&i.experimental_prepareOnly?{hash:void 0,explorerLink:void 0,transactionId:s.id}:yield this.approveAndWait(s.id)})}addDelegatedSigner(t){return g(this,null,function*(){var e,i;let n=yield l(this,o).registerSigner(this.walletLocator,{signer:t.signer,chain:this.chain==="solana"?void 0:this.chain});if("error"in n)throw new Error(`Failed to register signer: ${JSON.stringify(n.message)}`);if("transaction"in n){let r=n.transaction.id;yield this.approveAndWait(r)}else{let r=(e=n.chains)==null?void 0:e[this.chain];if((r==null?void 0:r.status)==="awaiting-approval"){let p=((i=r.approvals)==null?void 0:i.pending)||[];yield this.approveSignature(p,r.id),yield this.waitForSignature(r.id);return}if((r==null?void 0:r.status)==="pending"){yield this.waitForSignature(r.id);return}}})}delegatedSigners(){return g(this,null,function*(){var n,e,i;let t=yield l(this,o).getWallet(this.walletLocator);if("error"in t)throw new P(JSON.stringify(t));if(t.type!=="smart"||t.chainType!=="evm"&&t.chainType!=="solana")throw new E(`Wallet type ${t.type} not supported`);return(i=(e=(n=t==null?void 0:t.config)==null?void 0:n.delegatedSigners)==null?void 0:e.map(r=>{let p=r.locator.indexOf(":");return{signer:`external-wallet:${p>=0?r.locator.slice(p+1):r.locator}`}}))!=null?i:[]})}get walletLocator(){return l(this,o).isServerSide?this.address:`me:${this.chain==="solana"?"solana":"evm"}:smart`}get isSolanaWallet(){return this.chain==="solana"}approveAndWait(t,n){return g(this,null,function*(){return yield this.approveTransaction(t,n),yield this.sleep(1e3),yield this.waitForTransaction(t)})}approveTransaction(t,n){return g(this,null,function*(){var s,a,u,h;let e=yield l(this,o).getTransaction(this.walletLocator,t);if("error"in e)throw new L(JSON.stringify(e));if(yield(u=(a=(s=l(this,m))==null?void 0:s.experimental_callbacks)==null?void 0:a.onTransactionStart)==null?void 0:u.call(a),this.signer.type==="api-key")return e;let i=(h=e.approvals)==null?void 0:h.pending;if(i==null)return e;let r=[...n!=null?n:[],this.signer],p=yield Promise.all(i.map(w=>{let f=r.find(T=>T.locator()===w.signer.locator);if(f==null)throw new A(`Signer ${w.signer} not found in pending approvals`);let y=e.chainType==="solana"&&"transaction"in e.onChain?e.onChain.transaction:w.message;return f.signTransaction(y)})),d=yield l(this,o).approveTransaction(this.walletLocator,e.id,{approvals:p.map(w=>S({signer:this.signer.locator()},w))});if(d.error)throw new J(JSON.stringify(d));return d})}approveSignature(t,n){return g(this,null,function*(){if(this.isSolanaWallet)throw new Error("Approving signatures is only supported for EVM smart wallets");let e=t.find(r=>r.signer.locator===this.signer.locator());if(!e)throw new A(`Signer ${this.signer.locator()} not found in pending approvals`);let i=yield this.signer.signMessage(e.message);return yield l(this,o).approveSignature(this.walletLocator,n,{approvals:[S({signer:this.signer.locator()},i)]}),i})}waitForSignature(t){return g(this,null,function*(){let n=null;do if(yield new Promise(e=>setTimeout(e,b)),n=yield l(this,o).getSignature(this.walletLocator,t),"error"in n)throw new x(JSON.stringify(n));while(n===null||n.status==="pending");if(n.status==="failed")throw new W("Signature signing failed");if(!n.outputSignature)throw new x("Signature not available");return n.outputSignature})}waitForTransaction(p){return g(this,arguments,function*(t,n=6e4,{backoffMultiplier:e=1.1,maxBackoffMs:i=2e3,initialBackoffMs:r=b}={}){var u;let d=Date.now(),s;do{if(Date.now()-d>n)throw new _("Transaction confirmation timeout");if(s=yield l(this,o).getTransaction(this.walletLocator,t),s.error)throw new L(JSON.stringify(s));yield this.sleep(r),r=Math.min(r*e,i)}while(s.status==="pending");if(s.status==="failed")throw new B(`Transaction sending failed: ${JSON.stringify(s.error)}`);if(s.status==="awaiting-approval")throw new F("Transaction is awaiting approval. Please submit required approvals before waiting for completion.");let a=s.onChain.txId;if(a==null)throw new I("Transaction hash not found on transaction response");return{hash:a,explorerLink:(u=s.onChain.explorerLink)!=null?u:"",transactionId:s.id}})}sleep(t){return g(this,null,function*(){return new Promise(n=>setTimeout(n,t))})}};m=new WeakMap,o=new WeakMap;function k(c){if(typeof c=="string")return c;if("email"in c)return`email:${c.email}`;if("x"in c)return`x:${c.x}`;if("twitter"in c)return`twitter:${c.twitter}`;if("phone"in c)return`phoneNumber:${c.phone}`;if("userId"in c)return`userId:${c.userId}`;throw new Error("Invalid recipient locator")}function M(c,t){return G(c)?`${t}:${c}`:`${t}:${c.toLowerCase()}`}export{R as a};
@@ -1 +0,0 @@
1
- import{a as t}from"./chunk-JGHXHURY.js";import{a as l}from"./chunk-SCS4UDW7.js";import{q as p}from"./chunk-7ENJXL4H.js";import{f as r}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},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 r(this,null,function*(){var o,s;let i=yield this.createTransaction(n);if((o=n.options)!=null&&o.experimental_prepareOnly)return{hash:void 0,explorerLink:void 0,transactionId:i.id};let a=(s=n.additionalSigners)==null?void 0:s.map(e=>new l({type:"external-wallet",address:e.publicKey.toString(),locator:`external-wallet:${e.publicKey.toString()}`,onSignTransaction:c=>(c.sign([e]),Promise.resolve(c))}));return yield this.approveAndWait(i.id,a)})}createTransaction(i){return r(this,arguments,function*({transaction:n}){let a=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:m.encode(n.serialize())}});if("error"in a)throw new p(JSON.stringify(a));return a})}};export{d as a};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBCOGNFY7cjs = require('./chunk-BCOGNFY7.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var m,o,R= exports.a =class{constructor(t,n){_chunkXALFCQKDcjs.d.call(void 0, this,m);_chunkXALFCQKDcjs.d.call(void 0, this,o);let{chain:e,address:i,owner:r,signer:p,options:d}=t;_chunkXALFCQKDcjs.e.call(void 0, this,o,n),this.chain=e,this.address=i,this.owner=r,this.signer=p,_chunkXALFCQKDcjs.e.call(void 0, this,m,d)}static getApiClient(t){return t.apiClient}static getOptions(t){return t.options}get apiClient(){return _chunkXALFCQKDcjs.c.call(void 0, this,o)}get options(){return _chunkXALFCQKDcjs.c.call(void 0, this,m)}balances(t,n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let e=this.chain==="solana"?"sol":"eth",i=[e,"usdc",...t!=null?t:[]],r=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getBalance(this.address,{chains:n!=null?n:[this.chain],tokens:i.map(p=>p.toLowerCase())});if("error"in r)throw new Error(`Failed to get balances for wallet: ${JSON.stringify(r.message)}`);return this.transformBalanceResponse(r,e,t)})}transformBalanceResponse(t,n,e){let i=a=>{var w,f,y,T,O;let u=(w=a.chains)==null?void 0:w[this.chain],h="contractAddress"in u?u.contractAddress:void 0;return{symbol:(f=a.symbol)!=null?f:"",name:(y=a.symbol)!=null?y:"",amount:(T=a.amount)!=null?T:"0",contractAddress:h,decimals:a.decimals,rawAmount:(O=a.rawAmount)!=null?O:"0"}},r=t.find(a=>a.symbol===n),p=t.find(a=>a.symbol==="usdc"),d=t.filter(a=>{var u;return a.symbol!==n&&a.symbol!=="usdc"&&(e==null?void 0:e.includes((u=a.symbol)!=null?u:""))}),s=a=>({symbol:a,name:a,amount:"0",contractAddress:void 0,decimals:0,rawAmount:"0"});return{nativeToken:r!=null?i(r):s(n),usdc:p!=null?i(p):s("usdc"),tokens:d.map(i)}}experimental_nfts(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield _chunkXALFCQKDcjs.c.call(void 0, this,o).experimental_getNfts(_chunkXALFCQKDcjs.b.call(void 0, _chunkXALFCQKDcjs.a.call(void 0, {},t),{chain:this.chain,address:this.address}))})}experimental_transactions(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getTransactions(this.walletLocator)})}experimental_transaction(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getTransaction(this.walletLocator,t)})}experimental_activity(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let t=yield this.apiClient.experimental_activity(this.walletLocator,{chain:this.chain});if("error"in t)throw new Error(`Failed to get activity: ${JSON.stringify(t.message)}`);return t})}send(t,n,e,i){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let r=k(t),p=M(n,this.chain),d={recipient:r,amount:e},s=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).send(this.walletLocator,p,d);if("message"in s)throw new (0, _chunkCT2UGJELcjs.q)(`Failed to send token: ${JSON.stringify(s.message)}`);return i!=null&&i.experimental_prepareOnly?{hash:void 0,explorerLink:void 0,transactionId:s.id}:yield this.approveAndWait(s.id)})}addDelegatedSigner(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var e,i;let n=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).registerSigner(this.walletLocator,{signer:t.signer,chain:this.chain==="solana"?void 0:this.chain});if("error"in n)throw new Error(`Failed to register signer: ${JSON.stringify(n.message)}`);if("transaction"in n){let r=n.transaction.id;yield this.approveAndWait(r)}else{let r=(e=n.chains)==null?void 0:e[this.chain];if((r==null?void 0:r.status)==="awaiting-approval"){let p=((i=r.approvals)==null?void 0:i.pending)||[];yield this.approveSignature(p,r.id),yield this.waitForSignature(r.id);return}if((r==null?void 0:r.status)==="pending"){yield this.waitForSignature(r.id);return}}})}delegatedSigners(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var n,e,i;let t=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getWallet(this.walletLocator);if("error"in t)throw new (0, _chunkCT2UGJELcjs.d)(JSON.stringify(t));if(t.type!=="smart"||t.chainType!=="evm"&&t.chainType!=="solana")throw new (0, _chunkCT2UGJELcjs.c)(`Wallet type ${t.type} not supported`);return(i=(e=(n=t==null?void 0:t.config)==null?void 0:n.delegatedSigners)==null?void 0:e.map(r=>{let p=r.locator.indexOf(":");return{signer:`external-wallet:${p>=0?r.locator.slice(p+1):r.locator}`}}))!=null?i:[]})}get walletLocator(){return _chunkXALFCQKDcjs.c.call(void 0, this,o).isServerSide?this.address:`me:${this.chain==="solana"?"solana":"evm"}:smart`}get isSolanaWallet(){return this.chain==="solana"}approveAndWait(t,n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.approveTransaction(t,n),yield this.sleep(1e3),yield this.waitForTransaction(t)})}approveTransaction(t,n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var s,a,u,h;let e=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getTransaction(this.walletLocator,t);if("error"in e)throw new (0, _chunkCT2UGJELcjs.r)(JSON.stringify(e));if(yield(u=(a=(s=_chunkXALFCQKDcjs.c.call(void 0, this,m))==null?void 0:s.experimental_callbacks)==null?void 0:a.onTransactionStart)==null?void 0:u.call(a),this.signer.type==="api-key")return e;let i=(h=e.approvals)==null?void 0:h.pending;if(i==null)return e;let r=[...n!=null?n:[],this.signer],p=yield Promise.all(i.map(w=>{let f=r.find(T=>T.locator()===w.signer.locator);if(f==null)throw new (0, _chunkCT2UGJELcjs.i)(`Signer ${w.signer} not found in pending approvals`);let y=e.chainType==="solana"&&"transaction"in e.onChain?e.onChain.transaction:w.message;return f.signTransaction(y)})),d=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).approveTransaction(this.walletLocator,e.id,{approvals:p.map(w=>_chunkXALFCQKDcjs.a.call(void 0, {signer:this.signer.locator()},w))});if(d.error)throw new (0, _chunkCT2UGJELcjs.w)(JSON.stringify(d));return d})}approveSignature(t,n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(this.isSolanaWallet)throw new Error("Approving signatures is only supported for EVM smart wallets");let e=t.find(r=>r.signer.locator===this.signer.locator());if(!e)throw new (0, _chunkCT2UGJELcjs.i)(`Signer ${this.signer.locator()} not found in pending approvals`);let i=yield this.signer.signMessage(e.message);return yield _chunkXALFCQKDcjs.c.call(void 0, this,o).approveSignature(this.walletLocator,n,{approvals:[_chunkXALFCQKDcjs.a.call(void 0, {signer:this.signer.locator()},i)]}),i})}waitForSignature(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let n=null;do if(yield new Promise(e=>setTimeout(e,_chunkBCOGNFY7cjs.d)),n=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getSignature(this.walletLocator,t),"error"in n)throw new (0, _chunkCT2UGJELcjs.p)(JSON.stringify(n));while(n===null||n.status==="pending");if(n.status==="failed")throw new (0, _chunkCT2UGJELcjs.m)("Signature signing failed");if(!n.outputSignature)throw new (0, _chunkCT2UGJELcjs.p)("Signature not available");return n.outputSignature})}waitForTransaction(p){return _chunkXALFCQKDcjs.f.call(void 0, this,arguments,function*(t,n=6e4,{backoffMultiplier:e=1.1,maxBackoffMs:i=2e3,initialBackoffMs:r=_chunkBCOGNFY7cjs.d}={}){var u;let d=Date.now(),s;do{if(Date.now()-d>n)throw new (0, _chunkCT2UGJELcjs.s)("Transaction confirmation timeout");if(s=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getTransaction(this.walletLocator,t),s.error)throw new (0, _chunkCT2UGJELcjs.r)(JSON.stringify(s));yield this.sleep(r),r=Math.min(r*e,i)}while(s.status==="pending");if(s.status==="failed")throw new (0, _chunkCT2UGJELcjs.t)(`Transaction sending failed: ${JSON.stringify(s.error)}`);if(s.status==="awaiting-approval")throw new (0, _chunkCT2UGJELcjs.u)("Transaction is awaiting approval. Please submit required approvals before waiting for completion.");let a=s.onChain.txId;if(a==null)throw new (0, _chunkCT2UGJELcjs.v)("Transaction hash not found on transaction response");return{hash:a,explorerLink:(u=s.onChain.explorerLink)!=null?u:"",transactionId:s.id}})}sleep(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return new Promise(n=>setTimeout(n,t))})}};m=new WeakMap,o=new WeakMap;function k(c){if(typeof c=="string")return c;if("email"in c)return`email:${c.email}`;if("x"in c)return`x:${c.x}`;if("twitter"in c)return`twitter:${c.twitter}`;if("phone"in c)return`phoneNumber:${c.phone}`;if("userId"in c)return`userId:${c.userId}`;throw new Error("Invalid recipient locator")}function M(c,t){return _commonsdkbase.isValidAddress.call(void 0, c)?`${t}:${c}`:`${t}:${c.toLowerCase()}`}exports.a = R;