@crossmint/wallets-sdk 0.11.6 → 0.11.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/client.cjs +1 -1
- package/dist/api/client.js +1 -1
- package/dist/api/index.cjs +1 -1
- package/dist/api/index.js +1 -1
- package/dist/{chunk-IFME6I2Z.js → chunk-2FUKUKUL.js} +1 -1
- package/dist/{chunk-MUNIVJ3F.js → chunk-4OPYCYFU.js} +1 -1
- package/dist/{chunk-AW36TJUH.cjs → chunk-4U7B4KP7.cjs} +2 -2
- package/dist/{chunk-5LXN6CNK.cjs → chunk-674X7BNY.cjs} +1 -1
- package/dist/{chunk-FAESMNDM.cjs → chunk-67U2B6QL.cjs} +1 -1
- package/dist/chunk-FZ6Z6ULO.js +1 -0
- package/dist/{chunk-4K2SL4XU.cjs → chunk-G2375BCR.cjs} +1 -1
- package/dist/{chunk-B2XKTKWJ.cjs → chunk-H472F4EV.cjs} +1 -1
- package/dist/{chunk-EWNW3TJA.js → chunk-H56FUTFU.js} +1 -1
- package/dist/{chunk-QLKB5ECC.js → chunk-IMHHL77D.js} +1 -1
- package/dist/chunk-IVO2G656.js +1 -0
- package/dist/{chunk-UE46TOC3.js → chunk-KD46HYGS.js} +1 -1
- package/dist/chunk-OMD5JARC.cjs +1 -0
- package/dist/chunk-QZL4LBYZ.js +1 -0
- package/dist/{chunk-TQWAU22O.cjs → chunk-RRHJSNJJ.cjs} +1 -1
- package/dist/chunk-TXVYEKTQ.cjs +1 -0
- package/dist/{chunk-QWRVDHGI.js → chunk-UAFD7PBR.js} +1 -1
- package/dist/{chunk-NNWBKQGB.cjs → chunk-VGFF3F5P.cjs} +1 -1
- package/dist/chunk-VWBH7SK5.js +1 -0
- package/dist/{chunk-NOHKFLIR.cjs → chunk-Y2BSZ42G.cjs} +1 -1
- package/dist/{chunk-ZIUPBZVK.cjs → chunk-YT45MH4E.cjs} +1 -1
- package/dist/{chunk-M6S6W56P.js → chunk-ZF22XIO6.js} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/sdk.cjs +1 -1
- package/dist/sdk.js +1 -1
- package/dist/signers/index.cjs +1 -1
- package/dist/signers/index.js +1 -1
- package/dist/signers/non-custodial/index.cjs +1 -1
- package/dist/signers/non-custodial/index.js +1 -1
- package/dist/signers/non-custodial/ncs-stellar-signer.cjs +1 -1
- package/dist/signers/non-custodial/ncs-stellar-signer.d.cts +1 -1
- package/dist/signers/non-custodial/ncs-stellar-signer.d.ts +1 -1
- package/dist/signers/non-custodial/ncs-stellar-signer.js +1 -1
- package/dist/signers/stellar-external-wallet.cjs +1 -1
- package/dist/signers/stellar-external-wallet.d.cts +2 -2
- package/dist/signers/stellar-external-wallet.d.ts +2 -2
- package/dist/signers/stellar-external-wallet.js +1 -1
- package/dist/utils/constants.cjs +1 -1
- package/dist/utils/constants.js +1 -1
- package/dist/wallets/evm.cjs +1 -1
- package/dist/wallets/evm.js +1 -1
- package/dist/wallets/solana.cjs +1 -1
- package/dist/wallets/solana.js +1 -1
- package/dist/wallets/stellar.cjs +1 -1
- package/dist/wallets/stellar.js +1 -1
- package/dist/wallets/wallet-factory.cjs +1 -1
- package/dist/wallets/wallet-factory.js +1 -1
- package/dist/wallets/wallet.cjs +1 -1
- package/dist/wallets/wallet.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-E2WBOL4Z.cjs +0 -1
- package/dist/chunk-GNSLUZU5.cjs +0 -1
- package/dist/chunk-Q6OF35PW.js +0 -1
- package/dist/chunk-VPIAMNQU.js +0 -1
- package/dist/chunk-VYWQOSTS.js +0 -1
- package/dist/chunk-WGFPSEE2.js +0 -1
package/dist/api/client.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkYT45MH4Ecjs = require('../chunk-YT45MH4E.cjs');require('../chunk-G2375BCR.cjs');require('../chunk-O4FVTK7X.cjs');require('../chunk-XALFCQKD.cjs');exports.ApiClient = _chunkYT45MH4Ecjs.a;
|
package/dist/api/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-4OPYCYFU.js";import"../chunk-FZ6Z6ULO.js";import"../chunk-PSXRNSOE.js";import"../chunk-BW7YYVZE.js";export{a as ApiClient};
|
package/dist/api/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-6HXIZLEQ.cjs');var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-6HXIZLEQ.cjs');var _chunkYT45MH4Ecjs = require('../chunk-YT45MH4E.cjs');require('../chunk-G2375BCR.cjs');require('../chunk-O4FVTK7X.cjs');require('../chunk-ECAM5KTH.cjs');require('../chunk-XALFCQKD.cjs');exports.ApiClient = _chunkYT45MH4Ecjs.a;
|
package/dist/api/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../chunk-5IFDVB4Y.js";import{a}from"../chunk-
|
|
1
|
+
import"../chunk-5IFDVB4Y.js";import{a}from"../chunk-4OPYCYFU.js";import"../chunk-FZ6Z6ULO.js";import"../chunk-PSXRNSOE.js";import"../chunk-KBJA7JDT.js";import"../chunk-BW7YYVZE.js";export{a as ApiClient};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as t}from"./chunk-
|
|
1
|
+
import{a as t}from"./chunk-VWBH7SK5.js";import{r as p}from"./chunk-PSXRNSOE.js";import{f as o}from"./chunk-BW7YYVZE.js";import{isValidStellarAddress as T}from"@crossmint/common-sdk-base";var l=class d extends 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 Stellar wallet");return new d(n)}sendTransaction(n){return o(this,null,function*(){var e;let r=yield this.createTransaction(n);if((e=n.options)!=null&&e.experimental_prepareOnly)return{hash:void 0,explorerLink:void 0,transactionId:r.id};let a={};return yield this.approveTransactionAndWait(r.id,a)})}createTransaction(x){return o(this,arguments,function*({contractId:n,method:r,memo:a,args:e,options:i}){var c;let u=(c=i==null?void 0:i.experimental_signer)!=null?c:this.signer.locator(),s=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:{type:"contract-call",contractId:n,method:r,memo:a,args:e},signer:u}});if("error"in s)throw new p(JSON.stringify(s));return s})}};export{l as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as n,c as i}from"./chunk-
|
|
1
|
+
import{b as n,c as i}from"./chunk-FZ6Z6ULO.js";import{a as o}from"./chunk-PSXRNSOE.js";import{f as r}from"./chunk-BW7YYVZE.js";import{APIKeyUsageOrigin as c,CrossmintApiClient as h}from"@crossmint/common-sdk-base";var p=class extends h{constructor(e){super(e,{internalConfig:{sdkMetadata:{name:i,version:n}}});this.apiPrefix="api/2025-06-09/wallets";this.legacyApiPrefix="api/2022-06-09/wallets"}createWallet(e){return r(this,null,function*(){let s=this.isServerSide?`${this.apiPrefix}`:`${this.apiPrefix}/me`;return(yield this.post(s,{body:JSON.stringify(e),headers:this.headers})).json()})}getWallet(e){return r(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}`,{headers:this.headers})).json()})}createTransaction(e,s){return r(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveTransaction(e,s,t){return r(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions/${s}/approvals`,{body:JSON.stringify(t),headers:this.headers})).json()})}getTransaction(e,s){return r(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions/${s}`,{headers:this.headers})).json()})}createSignature(e,s){return r(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signatures`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveSignature(e,s,t){return r(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signatures/${s}/approvals`,{body:JSON.stringify(t),headers:this.headers})).json()})}getSignature(e,s){return r(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/signatures/${s}`,{headers:this.headers})).json()})}getTransactions(e){return r(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions`,{headers:this.headers})).json()})}experimental_getNfts(e){return r(this,null,function*(){let s=new URLSearchParams;s.append("page",e.page.toString()),s.append("perPage",e.perPage.toString());let t=`${e.chain}:${e.address}`;return(yield this.get(`${this.apiPrefix}/${t}/nfts?${s.toString()}`,{headers:this.headers})).json()})}experimental_activity(e,s){return r(this,null,function*(){let t=e;this.isServerSide||(t=`me:${s.chain==="solana"?"solana-smart-wallet":"evm-smart-wallet"}`);let a=new URLSearchParams;return a.append("chain",s.chain.toString()),(yield this.get(`${this.legacyApiPrefix}/${t}/activity?${a.toString()}`,{headers:this.headers})).json()})}getBalance(e,s){return r(this,null,function*(){let t=new URLSearchParams;return t.append("tokens",s.tokens.join(",")),t.append("chains",s.chains.join(",")),(yield this.get(`${this.apiPrefix}/${e}/balances?${t.toString()}`,{headers:this.headers})).json()})}registerSigner(e,s){return r(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signers`,{body:JSON.stringify(s),headers:this.headers})).json()})}getSigner(e,s){return r(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/signers/${s}`,{headers:this.headers})).json()})}send(e,s,t){return r(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/tokens/${s}/transfers`,{body:JSON.stringify(t),headers:this.headers})).json()})}get isServerSide(){return this.parsedAPIKey.usageOrigin===c.SERVER}get environment(){if(!this.parsedAPIKey.isValid)throw new o("Invalid API key");return this.parsedAPIKey.environment}get headers(){return{"Content-Type":"application/json"}}};export{p as a};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk23BRREJGcjs = require('./chunk-23BRREJG.cjs');var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk23BRREJGcjs = require('./chunk-23BRREJG.cjs');var _chunkTXVYEKTQcjs = require('./chunk-TXVYEKTQ.cjs');var _chunkVGFF3F5Pcjs = require('./chunk-VGFF3F5P.cjs');var _chunkO4FVTK7Xcjs = require('./chunk-O4FVTK7X.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _ox = require('ox');var u=class{constructor(e){this.apiClient=e}getOrCreateWallet(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(this.apiClient.isServerSide)throw new (0, _chunkO4FVTK7Xcjs.f)(`getOrCreateWallet can only be called from client-side code.
|
|
2
2
|
- Make sure you're running this in the browser (or another client environment), not on your server.
|
|
3
|
-
- Use your Crossmint Client API Key (not a server key).`);let i=yield this.apiClient.getWallet(`me:${this.getChainType(e.chain)}: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, _chunkO4FVTK7Xcjs.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, _chunkO4FVTK7Xcjs.d)(JSON.stringify(n));return this.createWalletInstance(n,i)})}createWallet(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var t,a,o,l;yield(o=(a=(t=e.options)==null?void 0:t.experimental_callbacks)==null?void 0:a.onWalletCreationStart)==null?void 0:o.call(a),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:this.getChainType(e.chain),config:{adminSigner:i},owner:(l=e.owner)!=null?l:void 0});if("error"in n)throw new (0, _chunkO4FVTK7Xcjs.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,
|
|
3
|
+
- Use your Crossmint Client API Key (not a server key).`);let i=yield this.apiClient.getWallet(`me:${this.getChainType(e.chain)}: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, _chunkO4FVTK7Xcjs.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, _chunkO4FVTK7Xcjs.d)(JSON.stringify(n));return this.createWalletInstance(n,i)})}createWallet(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var t,a,o,l;yield(o=(a=(t=e.options)==null?void 0:t.experimental_callbacks)==null?void 0:a.onWalletCreationStart)==null?void 0:o.call(a),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:this.getChainType(e.chain),config:{adminSigner:i},owner:(l=e.owner)!=null?l:void 0});if("error"in n)throw new (0, _chunkO4FVTK7Xcjs.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, _chunkTXVYEKTQcjs.a)({chain:i.chain,address:e.address,owner:e.owner,signer:_chunkVGFF3F5Pcjs.a.call(void 0, i.chain,n),options:i.options},this.apiClient)}toInternalSignerConfig(e,i,n){var t,a,o,l,m,y;if(!(e.chainType==="evm"||e.chainType==="solana"||e.chainType==="stellar"))throw new (0, _chunkO4FVTK7Xcjs.f)(`Wallet type ${e.chainType} is not supported`);if(i==null&&((t=e.config)==null?void 0:t.adminSigner)==null)throw new (0, _chunkO4FVTK7Xcjs.f)("Signer is required to create a wallet");switch(i.type){case"api-key":{if(((a=e.config)==null?void 0:a.adminSigner.type)!=="api-key")throw new (0, _chunkO4FVTK7Xcjs.f)("API key signer does not match the wallet's signer type");return{type:"api-key",address:e.config.adminSigner.address,locator:e.config.adminSigner.locator}}case"external-wallet":if(((o=e.config)==null?void 0:o.adminSigner.type)!=="external-wallet")throw new (0, _chunkO4FVTK7Xcjs.f)("External wallet signer does not match the wallet's signer type");return _chunkXALFCQKDcjs.a.call(void 0, _chunkXALFCQKDcjs.a.call(void 0, {},e.config.adminSigner),i);case"passkey":if(((l=e.config)==null?void 0:l.adminSigner.type)!=="passkey")throw new (0, _chunkO4FVTK7Xcjs.f)("Passkey signer does not match the wallet's signer type");return{type:"passkey",id:e.config.adminSigner.id,name:e.config.adminSigner.name,locator:e.config.adminSigner.locator,onCreatePasskey:i.onCreatePasskey,onSignWithPasskey:i.onSignWithPasskey};case"email":{if(((m=e.config)==null?void 0:m.adminSigner.type)!=="email")throw new (0, _chunkO4FVTK7Xcjs.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(((y=e.config)==null?void 0:y.adminSigner.type)!=="phone")throw new (0, _chunkO4FVTK7Xcjs.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,a;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=(a=e.signer.phone)!=null?a: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 a;if(this.mutateSignerFromCustomAuth(i),i.owner!=null&&e.owner!=null&&i.owner!==e.owner)throw new (0, _chunkO4FVTK7Xcjs.f)("Wallet owner does not match existing wallet's linked user");if(i.chain==="solana"&&e.chainType!=="solana"||i.chain!=="solana"&&e.chainType==="solana"||i.chain==="stellar"&&e.chainType!=="stellar"||i.chain!=="stellar"&&e.chainType==="stellar")throw new (0, _chunkO4FVTK7Xcjs.f)(`Wallet chain does not match existing wallet's chain. You must use chain: ${e.chainType}.`);if(e.type!=="smart")return;let n=i.signer,t=(a=e==null?void 0:e.config)==null?void 0:a.adminSigner;if(n!=null&&t!=null){if(n.type!==t.type)throw new (0, _chunkO4FVTK7Xcjs.f)("The wallet signer type provided in the wallet config does not match the existing wallet's adminSigner type");_chunk23BRREJGcjs.a.call(void 0, n,t)}}getChainType(e){return e==="solana"?"solana":e==="stellar"?"stellar":"evm"}};exports.a = u;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkTXVYEKTQcjs = require('./chunk-TXVYEKTQ.cjs');var _chunkO4FVTK7Xcjs = require('./chunk-O4FVTK7X.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var l=class d extends _chunkTXVYEKTQcjs.a{constructor(n){super({chain:n.chain,address:n.address,owner:n.owner,signer:n.signer,options:_chunkTXVYEKTQcjs.a.getOptions(n)},_chunkTXVYEKTQcjs.a.getApiClient(n))}static from(n){if(!_commonsdkbase.isValidStellarAddress.call(void 0, n.address))throw new Error("Wallet is not a Stellar wallet");return new d(n)}sendTransaction(n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var e;let r=yield this.createTransaction(n);if((e=n.options)!=null&&e.experimental_prepareOnly)return{hash:void 0,explorerLink:void 0,transactionId:r.id};let a={};return yield this.approveTransactionAndWait(r.id,a)})}createTransaction(g){return _chunkXALFCQKDcjs.f.call(void 0, this,arguments,function*({contractId:n,method:r,memo:a,args:e,options:i}){var c;let u=(c=i==null?void 0:i.experimental_signer)!=null?c:this.signer.locator(),s=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:{type:"contract-call",contractId:n,method:r,memo:a,args:e},signer:u}});if("error"in s)throw new (0, _chunkO4FVTK7Xcjs.r)(JSON.stringify(s));return s})}};exports.a = l;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var e=class{constructor(
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var e=class{constructor(r){this.config=r;this.type="external-wallet";if(r.address==null)throw new Error("Please provide an address for the External Wallet Signer");this.address=r.address,this.onSignStellarTransaction=r.onSignStellarTransaction}locator(){return this.config.locator}signMessage(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for stellar external wallet signer"))})}signTransaction(r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return this.onSignStellarTransaction==null?yield Promise.reject(new Error("onSignStellarTransaction method is required to sign transactions with a Stellar external wallet")):{signature:yield this.onSignStellarTransaction(r)}})}};exports.a = e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var s="@crossmint/wallets-sdk",t="0.11.7";var r="WALLETS_SDK",c=t,a=s,d=500;export{r as a,c as b,a as c,d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var s="@crossmint/wallets-sdk",t="0.11.
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var s="@crossmint/wallets-sdk",t="0.11.7";var p="WALLETS_SDK",r= exports.b =t,c= exports.c =s,a= exports.d =500;exports.a = p; exports.b = r; exports.c = c; exports.d = a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk4U7B4KP7cjs = require('./chunk-4U7B4KP7.cjs');var _chunkYT45MH4Ecjs = require('./chunk-YT45MH4E.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var i=class o{constructor(t){let r=new (0, _chunkYT45MH4Ecjs.a)(t);this.walletFactory=new (0, _chunk4U7B4KP7cjs.a)(r)}static from(t){return new o(t)}getOrCreateWallet(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.walletFactory.getOrCreateWallet(t)})}getWallet(t,r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.walletFactory.getWallet(t,r)})}createWallet(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.walletFactory.createWallet(t)})}};exports.a = _commonsdkbase.createCrossmint; exports.b = i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as n}from"./chunk-KPHNZJD7.js";import{a}from"./chunk-
|
|
1
|
+
import{a as n}from"./chunk-KPHNZJD7.js";import{a}from"./chunk-IVO2G656.js";import{a as t}from"./chunk-BK2D2D22.js";import{a as o}from"./chunk-UBOWSXW3.js";import{a as m}from"./chunk-IGBQEAD5.js";import{a as l}from"./chunk-JMK64ITR.js";import{a as p}from"./chunk-QZL4LBYZ.js";import{a as s}from"./chunk-LW6JSI4J.js";import{a as i}from"./chunk-5S6YZJHE.js";function d(r,e){switch(e.type){case"email":case"phone":return r==="solana"?new n(e):r==="stellar"?new a(e):new t(e);case"api-key":return r==="solana"?new m(e):new s(e);case"external-wallet":return r==="solana"?new l(e):r==="stellar"?new p(e):new i(e);case"passkey":return new o(e)}}export{d as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as c}from"./chunk-
|
|
1
|
+
import{a as c}from"./chunk-VWBH7SK5.js";import{k as p,o as u,r as y}from"./chunk-PSXRNSOE.js";import{a as f}from"./chunk-RE7DBYTJ.js";import{f as s}from"./chunk-BW7YYVZE.js";import{createPublicClient as C,encodeFunctionData as x,http as I}from"viem";import{isValidEvmAddress as E}from"@crossmint/common-sdk-base";var m=class w extends c{constructor(t){super({chain:t.chain,address:t.address,owner:t.owner,signer:t.signer,options:c.getOptions(t)},c.getApiClient(t))}static from(t){if(!E(t.address))throw new Error("Wallet is not an EVM wallet");return new w(t)}sendTransaction(t){return s(this,null,function*(){var i;let n=this.buildTransaction(t),e=yield this.createTransaction(n,t.options);return(i=t.options)!=null&&i.experimental_prepareOnly?{hash:void 0,explorerLink:void 0,transactionId:e.id}:yield this.approveTransactionAndWait(e.id)})}signMessage(t){return s(this,null,function*(){var e;let n=yield this.apiClient.createSignature(this.walletLocator,{type:"message",params:{message:t.message,signer:this.signer.locator(),chain:this.chain}});if("error"in n)throw new u(JSON.stringify(n));return(e=t.options)!=null&&e.experimental_prepareOnly?{signature:void 0,signatureId:n.id}:yield this.approveSignatureAndWait(n.id)})}signTypedData(t){return s(this,null,function*(){var T;let{domain:n,message:e,primaryType:i,types:a,chain:r}=t;if(!n||!e||!a||!r)throw new p("Invalid typed data");let{name:d,version:l,chainId:g,verifyingContract:h,salt:S}=n;if(!d||!l||!g||!h)throw new p("Invalid typed data domain");let o=yield this.apiClient.createSignature(this.walletLocator,{type:"typed-data",params:{typedData:{domain:{name:d,version:l,chainId:Number(g),verifyingContract:h,salt:S},message:e,primaryType:i,types:a},signer:this.signer.locator(),chain:r,isSmartWalletSignature:!1}});if("error"in o)throw new u(JSON.stringify(o));return(T=t.options)!=null&&T.experimental_prepareOnly?{signature:void 0,signatureId:o.id}:yield this.approveSignatureAndWait(o.id)})}getViemClient(t){var n;return C({transport:(n=t==null?void 0:t.transport)!=null?n:I(),chain:f(this.chain)})}createTransaction(t,n){return s(this,null,function*(){var a;let e=(a=n==null?void 0:n.experimental_signer)!=null?a:this.signer.locator(),i=yield this.apiClient.createTransaction(this.walletLocator,{params:{signer:e,chain:this.chain,calls:[t]}});if("error"in i)throw new y(JSON.stringify(i));return i})}buildTransaction(t){var n,e,i,a,r;if("transaction"in t)return{transaction:t.transaction};if(t.abi==null)return{to:t.to,value:(e=(n=t.value)==null?void 0:n.toString())!=null?e:"0",data:(i=t.data)!=null?i:"0x"};if(!t.functionName)throw new Error("Function name is required");return{to:t.to,value:(r=(a=t.value)==null?void 0:a.toString())!=null?r:"0",data:x({abi:t.abi,functionName:t.functionName,args:t.args})}}};export{m as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as i,b as o}from"./chunk-VETSIYJQ.js";import{f as t}from"./chunk-BW7YYVZE.js";var s=class a extends i{constructor(n){super(n)}signMessage(){return t(this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for stellar signer"))})}signTransaction(n){return t(this,null,function*(){var r;yield this.handleAuthRequired();let g=this.getJwtOrThrow(),e=yield(r=this.config.clientTEEConnection)==null?void 0:r.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:g,apiKey:this.config.crossmint.apiKey},data:{keyType:"ed25519",bytes:n,encoding:"base64"}},options:o});if((e==null?void 0:e.status)==="error")throw new Error(e.error);if((e==null?void 0:e.signature)==null)throw new Error("Failed to sign transaction");if(a.verifyPublicKeyFormat(e.publicKey),e.signature.encoding!=="base64")throw new Error("Wrong encoding for signature. Expected base64, got "+e.signature.encoding);return{signature:e.signature.bytes}})}static verifyPublicKeyFormat(n){if(n==null)throw new Error("No public key found");if(n.encoding!=="base58"||n.keyType!=="ed25519"||n.bytes==null)throw new Error("Not supported. Expected public key to be in base58 encoding and ed25519 key type. Got: "+JSON.stringify(n))}};export{s as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as t}from"./chunk-
|
|
1
|
+
import{a as t}from"./chunk-VWBH7SK5.js";import{a as l}from"./chunk-JMK64ITR.js";import{r as p}from"./chunk-PSXRNSOE.js";import{f as s}from"./chunk-BW7YYVZE.js";import m from"bs58";import{isValidSolanaAddress as T}from"@crossmint/common-sdk-base";var d=class u extends t{constructor(n){super({chain:n.chain,address:n.address,owner:n.owner,signer:n.signer,options:t.getOptions(n)},t.getApiClient(n))}static from(n){if(!T(n.address))throw new Error("Wallet is not a Solana wallet");return new u(n)}sendTransaction(n){return s(this,null,function*(){var e,r;let a=yield this.createTransaction(n);if((e=n.options)!=null&&e.experimental_prepareOnly)return{hash:void 0,explorerLink:void 0,transactionId:a.id};let i={additionalSigners:(r=n.additionalSigners)==null?void 0:r.map(o=>new l({type:"external-wallet",address:o.publicKey.toString(),locator:`external-wallet:${o.publicKey.toString()}`,onSignTransaction:c=>(c.sign([o]),Promise.resolve(c))}))};return yield this.approveTransactionAndWait(a.id,i)})}createTransaction(S){return s(this,arguments,function*({transaction:n,options:a}){var r;let i=(r=a==null?void 0:a.experimental_signer)!=null?r:this.signer.locator(),e=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:m.encode(n.serialize()),signer:i}});if("error"in e)throw new p(JSON.stringify(e));return e})}};export{d as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkFC7FFQOVcjs = require('./chunk-FC7FFQOV.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var s=class a extends _chunkFC7FFQOVcjs.a{constructor(n){super(n)}signMessage(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for stellar signer"))})}signTransaction(n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var r;yield this.handleAuthRequired();let g=this.getJwtOrThrow(),e=yield(r=this.config.clientTEEConnection)==null?void 0:r.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:g,apiKey:this.config.crossmint.apiKey},data:{keyType:"ed25519",bytes:n,encoding:"base64"}},options:_chunkFC7FFQOVcjs.b});if((e==null?void 0:e.status)==="error")throw new Error(e.error);if((e==null?void 0:e.signature)==null)throw new Error("Failed to sign transaction");if(a.verifyPublicKeyFormat(e.publicKey),e.signature.encoding!=="base64")throw new Error("Wrong encoding for signature. Expected base64, got "+e.signature.encoding);return{signature:e.signature.bytes}})}static verifyPublicKeyFormat(n){if(n==null)throw new Error("No public key found");if(n.encoding!=="base58"||n.keyType!=="ed25519"||n.bytes==null)throw new Error("Not supported. Expected public key to be in base58 encoding and ed25519 key type. Got: "+JSON.stringify(n))}};exports.a = s;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{f as n}from"./chunk-BW7YYVZE.js";var e=class{constructor(r){this.config=r;this.type="external-wallet";if(r.address==null)throw new Error("Please provide an address for the External Wallet Signer");this.address=r.address,this.onSignStellarTransaction=r.onSignStellarTransaction}locator(){return this.config.locator}signMessage(){return n(this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for stellar external wallet signer"))})}signTransaction(r){return n(this,null,function*(){return this.onSignStellarTransaction==null?yield Promise.reject(new Error("onSignStellarTransaction method is required to sign transactions with a Stellar external wallet")):{signature:yield this.onSignStellarTransaction(r)}})}};export{e as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkTXVYEKTQcjs = require('./chunk-TXVYEKTQ.cjs');var _chunkO4FVTK7Xcjs = require('./chunk-O4FVTK7X.cjs');var _chunkLO5VLDH7cjs = require('./chunk-LO5VLDH7.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _viem = require('viem');var _commonsdkbase = require('@crossmint/common-sdk-base');var m=class w extends _chunkTXVYEKTQcjs.a{constructor(t){super({chain:t.chain,address:t.address,owner:t.owner,signer:t.signer,options:_chunkTXVYEKTQcjs.a.getOptions(t)},_chunkTXVYEKTQcjs.a.getApiClient(t))}static from(t){if(!_commonsdkbase.isValidEvmAddress.call(void 0, t.address))throw new Error("Wallet is not an EVM wallet");return new w(t)}sendTransaction(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var i;let n=this.buildTransaction(t),e=yield this.createTransaction(n,t.options);return(i=t.options)!=null&&i.experimental_prepareOnly?{hash:void 0,explorerLink:void 0,transactionId:e.id}:yield this.approveTransactionAndWait(e.id)})}signMessage(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var e;let n=yield this.apiClient.createSignature(this.walletLocator,{type:"message",params:{message:t.message,signer:this.signer.locator(),chain:this.chain}});if("error"in n)throw new (0, _chunkO4FVTK7Xcjs.o)(JSON.stringify(n));return(e=t.options)!=null&&e.experimental_prepareOnly?{signature:void 0,signatureId:n.id}:yield this.approveSignatureAndWait(n.id)})}signTypedData(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var T;let{domain:n,message:e,primaryType:i,types:a,chain:r}=t;if(!n||!e||!a||!r)throw new (0, _chunkO4FVTK7Xcjs.k)("Invalid typed data");let{name:d,version:l,chainId:g,verifyingContract:h,salt:S}=n;if(!d||!l||!g||!h)throw new (0, _chunkO4FVTK7Xcjs.k)("Invalid typed data domain");let o=yield this.apiClient.createSignature(this.walletLocator,{type:"typed-data",params:{typedData:{domain:{name:d,version:l,chainId:Number(g),verifyingContract:h,salt:S},message:e,primaryType:i,types:a},signer:this.signer.locator(),chain:r,isSmartWalletSignature:!1}});if("error"in o)throw new (0, _chunkO4FVTK7Xcjs.o)(JSON.stringify(o));return(T=t.options)!=null&&T.experimental_prepareOnly?{signature:void 0,signatureId:o.id}:yield this.approveSignatureAndWait(o.id)})}getViemClient(t){var n;return _viem.createPublicClient.call(void 0, {transport:(n=t==null?void 0:t.transport)!=null?n:_viem.http.call(void 0, ),chain:_chunkLO5VLDH7cjs.a.call(void 0, this.chain)})}createTransaction(t,n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var a;let e=(a=n==null?void 0:n.experimental_signer)!=null?a:this.signer.locator(),i=yield this.apiClient.createTransaction(this.walletLocator,{params:{signer:e,chain:this.chain,calls:[t]}});if("error"in i)throw new (0, _chunkO4FVTK7Xcjs.r)(JSON.stringify(i));return i})}buildTransaction(t){var n,e,i,a,r;if("transaction"in t)return{transaction:t.transaction};if(t.abi==null)return{to:t.to,value:(e=(n=t.value)==null?void 0:n.toString())!=null?e:"0",data:(i=t.data)!=null?i:"0x"};if(!t.functionName)throw new Error("Function name is required");return{to:t.to,value:(r=(a=t.value)==null?void 0:a.toString())!=null?r:"0",data:_viem.encodeFunctionData.call(void 0, {abi:t.abi,functionName:t.functionName,args:t.args})}}};exports.a = m;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkG2375BCRcjs = require('./chunk-G2375BCR.cjs');var _chunkO4FVTK7Xcjs = require('./chunk-O4FVTK7X.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var f,c,G= exports.a =class{constructor(r,e){_chunkXALFCQKDcjs.d.call(void 0, this,f);_chunkXALFCQKDcjs.d.call(void 0, this,c);let{chain:t,address:n,owner:s,signer:d,options:g}=r;_chunkXALFCQKDcjs.e.call(void 0, this,c,e),this.chain=t,this.address=n,this.owner=s,this.signer=d,_chunkXALFCQKDcjs.e.call(void 0, this,f,g)}static getApiClient(r){return r.apiClient}static getOptions(r){return r.options}get apiClient(){return _chunkXALFCQKDcjs.c.call(void 0, this,c)}get options(){return _chunkXALFCQKDcjs.c.call(void 0, this,f)}experimental_apiClient(){return _chunkXALFCQKDcjs.c.call(void 0, this,c)}balances(r,e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let t;switch(this.chain){case"solana":t="sol";break;case"stellar":t="xlm";break;default:t="eth";break}let n=[t,"usdc",...r!=null?r:[]],s=yield _chunkXALFCQKDcjs.c.call(void 0, this,c).getBalance(this.address,{chains:e!=null?e:[this.chain],tokens:n});if("error"in s)throw new Error(`Failed to get balances for wallet: ${JSON.stringify(s.message)}`);return this.transformBalanceResponse(s,t,r)})}transformBalanceResponse(r,e,t){let n=a=>{var m,w,v,y,T;let o=(m=a.chains)==null?void 0:m[this.chain],h=o!=null&&"contractAddress"in o?o.contractAddress:void 0;return{symbol:(w=a.symbol)!=null?w:"",name:(v=a.symbol)!=null?v:"",amount:(y=a.amount)!=null?y:"0",contractAddress:h,decimals:a.decimals,rawAmount:(T=a.rawAmount)!=null?T:"0"}},s=r.find(a=>a.symbol===e),d=r.find(a=>a.symbol==="usdc"),g=r.filter(a=>{var o;return a.symbol!==e&&a.symbol!=="usdc"&&(t==null?void 0:t.includes((o=a.symbol)!=null?o:""))}),i=a=>({symbol:a,name:a,amount:"0",contractAddress:void 0,decimals:0,rawAmount:"0"});return{nativeToken:s!=null?n(s):i(e),usdc:d!=null?n(d):i("usdc"),tokens:g.map(n)}}experimental_nfts(r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield _chunkXALFCQKDcjs.c.call(void 0, this,c).experimental_getNfts(_chunkXALFCQKDcjs.b.call(void 0, _chunkXALFCQKDcjs.a.call(void 0, {},r),{chain:this.chain,address:this.address}))})}experimental_transactions(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let r=yield _chunkXALFCQKDcjs.c.call(void 0, this,c).getTransactions(this.walletLocator);if("error"in r)throw new Error(`Failed to get transactions: ${JSON.stringify(r.message)}`);return r})}experimental_transaction(r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let e=yield _chunkXALFCQKDcjs.c.call(void 0, this,c).getTransaction(this.walletLocator,r);if("error"in e)throw new Error(`Failed to get transaction: ${JSON.stringify(e.error)}`);return e})}experimental_activity(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let r=yield this.apiClient.experimental_activity(this.walletLocator,{chain:this.chain});if("error"in r)throw new Error(`Failed to get activity: ${JSON.stringify(r.message)}`);return r})}send(r,e,t,n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let s=H(r),d=M(e,this.chain),g={recipient:s,amount:t},i=yield _chunkXALFCQKDcjs.c.call(void 0, this,c).send(this.walletLocator,d,g);if("message"in i)throw new (0, _chunkO4FVTK7Xcjs.r)(`Failed to send token: ${JSON.stringify(i.message)}`);return n!=null&&n.experimental_prepareOnly?{hash:void 0,explorerLink:void 0,transactionId:i.id}:yield this.approveTransactionAndWait(i.id)})}approveTransaction(r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return console.warn("approveTransaction is deprecated. Use approve instead. This method will be removed in the next major version."),yield this.approve(r)})}approve(r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(r.transactionId!=null)return yield this.approveTransactionAndWait(r.transactionId,r.options);if(r.signatureId!=null)return yield this.approveSignatureAndWait(r.signatureId,r.options);throw new Error("Either transactionId or signatureId must be provided")})}addDelegatedSigner(r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var t;let e=yield _chunkXALFCQKDcjs.c.call(void 0, this,c).registerSigner(this.walletLocator,{signer:r.signer,chain:this.chain==="solana"||this.chain==="stellar"?void 0:this.chain});if("error"in e)throw new Error(`Failed to register signer: ${JSON.stringify(e.message)}`);if("transaction"in e){let n=e.transaction.id;yield this.approveTransactionAndWait(n)}else{let n=(t=e.chains)==null?void 0:t[this.chain];if((n==null?void 0:n.status)==="awaiting-approval"){yield this.approveSignatureAndWait(n.id);return}if((n==null?void 0:n.status)==="pending"){yield this.waitForSignature(n.id);return}}})}delegatedSigners(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var e,t,n;let r=yield _chunkXALFCQKDcjs.c.call(void 0, this,c).getWallet(this.walletLocator);if("error"in r)throw new (0, _chunkO4FVTK7Xcjs.d)(JSON.stringify(r));if(this.chain==="stellar")return[];if(r.type!=="smart"||r.chainType!=="evm"&&r.chainType!=="solana")throw new (0, _chunkO4FVTK7Xcjs.c)(`Wallet type ${r.type} not supported`);return(n=(t=(e=r==null?void 0:r.config)==null?void 0:e.delegatedSigners)==null?void 0:t.map(s=>{let d=s.locator.indexOf(":");return{signer:`external-wallet:${d>=0?s.locator.slice(d+1):s.locator}`}}))!=null?n:[]})}get walletLocator(){return _chunkXALFCQKDcjs.c.call(void 0, this,c).isServerSide?this.address:this.chain==="stellar"?"me:stellar:smart":this.chain==="solana"?"me:solana:smart":"me:evm:smart"}get isSolanaWallet(){return this.chain==="solana"}approveTransactionAndWait(r,e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.approveTransactionInternal(r,e),yield this.sleep(1e3),yield this.waitForTransaction(r)})}approveSignatureAndWait(r,e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.approveSignatureInternal(r,e),yield this.sleep(1e3),yield this.waitForSignature(r)})}approveSignatureInternal(r,e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var i,a;if(this.isSolanaWallet)throw new Error("Approving signatures is only supported for EVM smart wallets");let t=yield _chunkXALFCQKDcjs.c.call(void 0, this,c).getSignature(this.walletLocator,r);if("error"in t)throw new (0, _chunkO4FVTK7Xcjs.p)(JSON.stringify(t));if(this.signer.type==="api-key")return t;if((e==null?void 0:e.experimental_approval)!=null){let o=[e.experimental_approval];return yield this.executeApproveSignatureWithErrorHandling(r,o)}let n=(i=t.approvals)==null?void 0:i.pending;if(n==null)return t;let s=[...(a=e==null?void 0:e.additionalSigners)!=null?a:[],this.signer],g=(yield Promise.all(n.map(o=>{let h=s.find(m=>m.locator()===o.signer.locator);if(h==null)throw new (0, _chunkO4FVTK7Xcjs.i)(`Signer ${o.signer} not found in pending approvals`);return h.signMessage(o.message)}))).map(o=>_chunkXALFCQKDcjs.b.call(void 0, _chunkXALFCQKDcjs.a.call(void 0, {},o),{signer:this.signer.locator()}));return yield this.executeApproveSignatureWithErrorHandling(r,g)})}approveTransactionInternal(r,e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var i,a,o,h,m;let t=yield _chunkXALFCQKDcjs.c.call(void 0, this,c).getTransaction(this.walletLocator,r);if("error"in t)throw new (0, _chunkO4FVTK7Xcjs.s)(JSON.stringify(t));if(yield(o=(a=(i=_chunkXALFCQKDcjs.c.call(void 0, this,f))==null?void 0:i.experimental_callbacks)==null?void 0:a.onTransactionStart)==null?void 0:o.call(a),this.signer.type==="api-key")return t;if((e==null?void 0:e.experimental_approval)!=null){let w=[e.experimental_approval];return yield this.executeApproveTransactionWithErrorHandling(r,w)}let n=(h=t.approvals)==null?void 0:h.pending;if(n==null)return t;let s=[...(m=e==null?void 0:e.additionalSigners)!=null?m:[],this.signer],g=(yield Promise.all(n.map(w=>{let v=s.find(T=>T.locator()===w.signer.locator);if(v==null)throw new (0, _chunkO4FVTK7Xcjs.i)(`Signer ${w.signer} not found in pending approvals`);let y=t.chainType==="solana"&&"transaction"in t.onChain?t.onChain.transaction:w.message;return v.signTransaction(y)}))).map(w=>_chunkXALFCQKDcjs.b.call(void 0, _chunkXALFCQKDcjs.a.call(void 0, {},w),{signer:this.signer.locator()}));return yield this.executeApproveTransactionWithErrorHandling(r,g)})}executeApproveTransactionWithErrorHandling(r,e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let t=yield _chunkXALFCQKDcjs.c.call(void 0, this,c).approveTransaction(this.walletLocator,r,{approvals:e});if(t.error)throw new (0, _chunkO4FVTK7Xcjs.x)(JSON.stringify(t));return t})}executeApproveSignatureWithErrorHandling(r,e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let t=yield _chunkXALFCQKDcjs.c.call(void 0, this,c).approveSignature(this.walletLocator,r,{approvals:e});if(t.error)throw new (0, _chunkO4FVTK7Xcjs.q)(JSON.stringify(t));return t})}waitForSignature(r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let e=null;do if(yield new Promise(t=>setTimeout(t,_chunkG2375BCRcjs.d)),e=yield _chunkXALFCQKDcjs.c.call(void 0, this,c).getSignature(this.walletLocator,r),"error"in e)throw new (0, _chunkO4FVTK7Xcjs.p)(JSON.stringify(e));while(e===null||e.status==="pending");if(e.status==="failed")throw new (0, _chunkO4FVTK7Xcjs.m)("Signature signing failed");if(!e.outputSignature)throw new (0, _chunkO4FVTK7Xcjs.p)("Signature not available");return{signature:e.outputSignature,signatureId:r}})}waitForTransaction(d){return _chunkXALFCQKDcjs.f.call(void 0, this,arguments,function*(r,e=6e4,{backoffMultiplier:t=1.1,maxBackoffMs:n=2e3,initialBackoffMs:s=_chunkG2375BCRcjs.d}={}){var o;let g=Date.now(),i;do{if(Date.now()-g>e)throw new (0, _chunkO4FVTK7Xcjs.t)("Transaction confirmation timeout");if(i=yield _chunkXALFCQKDcjs.c.call(void 0, this,c).getTransaction(this.walletLocator,r),i.error)throw new (0, _chunkO4FVTK7Xcjs.s)(JSON.stringify(i));yield this.sleep(s),s=Math.min(s*t,n)}while(i.status==="pending");if(i.status==="failed")throw new (0, _chunkO4FVTK7Xcjs.u)(`Transaction sending failed: ${JSON.stringify(i.error)}`);if(i.status==="awaiting-approval")throw new (0, _chunkO4FVTK7Xcjs.v)("Transaction is awaiting approval. Please submit required approvals before waiting for completion.");let a=i.onChain.txId;if(a==null)throw new (0, _chunkO4FVTK7Xcjs.w)("Transaction hash not found on transaction response");return{hash:a,explorerLink:(o=i.onChain.explorerLink)!=null?o:"",transactionId:i.id}})}sleep(r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return new Promise(e=>setTimeout(e,r))})}};f=new WeakMap,c=new WeakMap;function H(u){if(typeof u=="string")return u;if("email"in u)return`email:${u.email}`;if("x"in u)return`x:${u.x}`;if("twitter"in u)return`twitter:${u.twitter}`;if("phone"in u)return`phoneNumber:${u.phone}`;if("userId"in u)return`userId:${u.userId}`;throw new Error("Invalid recipient locator")}function M(u,r){return _commonsdkbase.isValidAddress.call(void 0, u)?`${r}:${u}`:`${r}:${u.toLowerCase()}`}exports.a = G;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as f}from"./chunk-BHGNJYYE.js";import{a as g}from"./chunk-
|
|
1
|
+
import{a as f}from"./chunk-BHGNJYYE.js";import{a as g}from"./chunk-VWBH7SK5.js";import{a as d}from"./chunk-H56FUTFU.js";import{d as p,f as r}from"./chunk-PSXRNSOE.js";import{a as C,f as s}from"./chunk-BW7YYVZE.js";import{WebAuthnP256 as S}from"ox";var u=class{constructor(e){this.apiClient=e}getOrCreateWallet(e){return s(this,null,function*(){if(this.apiClient.isServerSide)throw new r(`getOrCreateWallet can only be called from client-side code.
|
|
2
2
|
- Make sure you're running this in the browser (or another client environment), not on your server.
|
|
3
3
|
- Use your Crossmint Client API Key (not a server key).`);let i=yield this.apiClient.getWallet(`me:${this.getChainType(e.chain)}: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 r("getWallet is not supported on client side, use getOrCreateWallet instead");let n=yield this.apiClient.getWallet(e);if("error"in n)throw new p(JSON.stringify(n));return this.createWalletInstance(n,i)})}createWallet(e){return s(this,null,function*(){var t,a,o,l;yield(o=(a=(t=e.options)==null?void 0:t.experimental_callbacks)==null?void 0:a.onWalletCreationStart)==null?void 0:o.call(a),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:this.getChainType(e.chain),config:{adminSigner:i},owner:(l=e.owner)!=null?l:void 0});if("error"in n)throw new r(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 g({chain:i.chain,address:e.address,owner:e.owner,signer:d(i.chain,n),options:i.options},this.apiClient)}toInternalSignerConfig(e,i,n){var t,a,o,l,m,y;if(!(e.chainType==="evm"||e.chainType==="solana"||e.chainType==="stellar"))throw new r(`Wallet type ${e.chainType} is not supported`);if(i==null&&((t=e.config)==null?void 0:t.adminSigner)==null)throw new r("Signer is required to create a wallet");switch(i.type){case"api-key":{if(((a=e.config)==null?void 0:a.adminSigner.type)!=="api-key")throw new r("API key signer does not match the wallet's signer type");return{type:"api-key",address:e.config.adminSigner.address,locator:e.config.adminSigner.locator}}case"external-wallet":if(((o=e.config)==null?void 0:o.adminSigner.type)!=="external-wallet")throw new r("External wallet signer does not match the wallet's signer type");return C(C({},e.config.adminSigner),i);case"passkey":if(((l=e.config)==null?void 0:l.adminSigner.type)!=="passkey")throw new r("Passkey signer does not match the wallet's signer type");return{type:"passkey",id:e.config.adminSigner.id,name:e.config.adminSigner.name,locator:e.config.adminSigner.locator,onCreatePasskey:i.onCreatePasskey,onSignWithPasskey:i.onSignWithPasskey};case"email":{if(((m=e.config)==null?void 0:m.adminSigner.type)!=="email")throw new r("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(((y=e.config)==null?void 0:y.adminSigner.type)!=="phone")throw new r("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 S.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,a;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=(a=e.signer.phone)!=null?a: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 a;if(this.mutateSignerFromCustomAuth(i),i.owner!=null&&e.owner!=null&&i.owner!==e.owner)throw new r("Wallet owner does not match existing wallet's linked user");if(i.chain==="solana"&&e.chainType!=="solana"||i.chain!=="solana"&&e.chainType==="solana"||i.chain==="stellar"&&e.chainType!=="stellar"||i.chain!=="stellar"&&e.chainType==="stellar")throw new r(`Wallet chain does not match existing wallet's chain. You must use chain: ${e.chainType}.`);if(e.type!=="smart")return;let n=i.signer,t=(a=e==null?void 0:e.config)==null?void 0:a.adminSigner;if(n!=null&&t!=null){if(n.type!==t.type)throw new r("The wallet signer type provided in the wallet config does not match the existing wallet's adminSigner type");f(n,t)}}getChainType(e){return e==="solana"?"solana":e==="stellar"?"stellar":"evm"}};export{u as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk4GMYGJLUcjs = require('./chunk-4GMYGJLU.cjs');var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk4GMYGJLUcjs = require('./chunk-4GMYGJLU.cjs');var _chunkOMD5JARCcjs = require('./chunk-OMD5JARC.cjs');var _chunkMTZIGWOAcjs = require('./chunk-MTZIGWOA.cjs');var _chunkYWPTI2QOcjs = require('./chunk-YWPTI2QO.cjs');var _chunk4KXOWU5Ecjs = require('./chunk-4KXOWU5E.cjs');var _chunkMY4MQMBKcjs = require('./chunk-MY4MQMBK.cjs');var _chunk67U2B6QLcjs = require('./chunk-67U2B6QL.cjs');var _chunkYZ4HRYSLcjs = require('./chunk-YZ4HRYSL.cjs');var _chunkBULGM35Wcjs = require('./chunk-BULGM35W.cjs');function E(r,e){switch(e.type){case"email":case"phone":return r==="solana"?new (0, _chunk4GMYGJLUcjs.a)(e):r==="stellar"?new (0, _chunkOMD5JARCcjs.a)(e):new (0, _chunkMTZIGWOAcjs.a)(e);case"api-key":return r==="solana"?new (0, _chunk4KXOWU5Ecjs.a)(e):new (0, _chunkYZ4HRYSLcjs.a)(e);case"external-wallet":return r==="solana"?new (0, _chunkMY4MQMBKcjs.a)(e):r==="stellar"?new (0, _chunk67U2B6QLcjs.a)(e):new (0, _chunkBULGM35Wcjs.a)(e);case"passkey":return new (0, _chunkYWPTI2QOcjs.a)(e)}}exports.a = E;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as O}from"./chunk-FZ6Z6ULO.js";import{c as L,d as P,i as E,m as N,p as b,q as _,r as $,s as W,t as I,u as F,v as R,w as B,x as J}from"./chunk-PSXRNSOE.js";import{a as S,b as A,c as p,d as x,e as C,f as l}from"./chunk-BW7YYVZE.js";import{isValidAddress as k}from"@crossmint/common-sdk-base";var f,c,G=class{constructor(r,e){x(this,f);x(this,c);let{chain:t,address:n,owner:s,signer:d,options:g}=r;C(this,c,e),this.chain=t,this.address=n,this.owner=s,this.signer=d,C(this,f,g)}static getApiClient(r){return r.apiClient}static getOptions(r){return r.options}get apiClient(){return p(this,c)}get options(){return p(this,f)}experimental_apiClient(){return p(this,c)}balances(r,e){return l(this,null,function*(){let t;switch(this.chain){case"solana":t="sol";break;case"stellar":t="xlm";break;default:t="eth";break}let n=[t,"usdc",...r!=null?r:[]],s=yield p(this,c).getBalance(this.address,{chains:e!=null?e:[this.chain],tokens:n});if("error"in s)throw new Error(`Failed to get balances for wallet: ${JSON.stringify(s.message)}`);return this.transformBalanceResponse(s,t,r)})}transformBalanceResponse(r,e,t){let n=a=>{var m,w,v,y,T;let o=(m=a.chains)==null?void 0:m[this.chain],h=o!=null&&"contractAddress"in o?o.contractAddress:void 0;return{symbol:(w=a.symbol)!=null?w:"",name:(v=a.symbol)!=null?v:"",amount:(y=a.amount)!=null?y:"0",contractAddress:h,decimals:a.decimals,rawAmount:(T=a.rawAmount)!=null?T:"0"}},s=r.find(a=>a.symbol===e),d=r.find(a=>a.symbol==="usdc"),g=r.filter(a=>{var o;return a.symbol!==e&&a.symbol!=="usdc"&&(t==null?void 0:t.includes((o=a.symbol)!=null?o:""))}),i=a=>({symbol:a,name:a,amount:"0",contractAddress:void 0,decimals:0,rawAmount:"0"});return{nativeToken:s!=null?n(s):i(e),usdc:d!=null?n(d):i("usdc"),tokens:g.map(n)}}experimental_nfts(r){return l(this,null,function*(){return yield p(this,c).experimental_getNfts(A(S({},r),{chain:this.chain,address:this.address}))})}experimental_transactions(){return l(this,null,function*(){let r=yield p(this,c).getTransactions(this.walletLocator);if("error"in r)throw new Error(`Failed to get transactions: ${JSON.stringify(r.message)}`);return r})}experimental_transaction(r){return l(this,null,function*(){let e=yield p(this,c).getTransaction(this.walletLocator,r);if("error"in e)throw new Error(`Failed to get transaction: ${JSON.stringify(e.error)}`);return e})}experimental_activity(){return l(this,null,function*(){let r=yield this.apiClient.experimental_activity(this.walletLocator,{chain:this.chain});if("error"in r)throw new Error(`Failed to get activity: ${JSON.stringify(r.message)}`);return r})}send(r,e,t,n){return l(this,null,function*(){let s=H(r),d=M(e,this.chain),g={recipient:s,amount:t},i=yield p(this,c).send(this.walletLocator,d,g);if("message"in i)throw new $(`Failed to send token: ${JSON.stringify(i.message)}`);return n!=null&&n.experimental_prepareOnly?{hash:void 0,explorerLink:void 0,transactionId:i.id}:yield this.approveTransactionAndWait(i.id)})}approveTransaction(r){return l(this,null,function*(){return console.warn("approveTransaction is deprecated. Use approve instead. This method will be removed in the next major version."),yield this.approve(r)})}approve(r){return l(this,null,function*(){if(r.transactionId!=null)return yield this.approveTransactionAndWait(r.transactionId,r.options);if(r.signatureId!=null)return yield this.approveSignatureAndWait(r.signatureId,r.options);throw new Error("Either transactionId or signatureId must be provided")})}addDelegatedSigner(r){return l(this,null,function*(){var t;let e=yield p(this,c).registerSigner(this.walletLocator,{signer:r.signer,chain:this.chain==="solana"||this.chain==="stellar"?void 0:this.chain});if("error"in e)throw new Error(`Failed to register signer: ${JSON.stringify(e.message)}`);if("transaction"in e){let n=e.transaction.id;yield this.approveTransactionAndWait(n)}else{let n=(t=e.chains)==null?void 0:t[this.chain];if((n==null?void 0:n.status)==="awaiting-approval"){yield this.approveSignatureAndWait(n.id);return}if((n==null?void 0:n.status)==="pending"){yield this.waitForSignature(n.id);return}}})}delegatedSigners(){return l(this,null,function*(){var e,t,n;let r=yield p(this,c).getWallet(this.walletLocator);if("error"in r)throw new P(JSON.stringify(r));if(this.chain==="stellar")return[];if(r.type!=="smart"||r.chainType!=="evm"&&r.chainType!=="solana")throw new L(`Wallet type ${r.type} not supported`);return(n=(t=(e=r==null?void 0:r.config)==null?void 0:e.delegatedSigners)==null?void 0:t.map(s=>{let d=s.locator.indexOf(":");return{signer:`external-wallet:${d>=0?s.locator.slice(d+1):s.locator}`}}))!=null?n:[]})}get walletLocator(){return p(this,c).isServerSide?this.address:this.chain==="stellar"?"me:stellar:smart":this.chain==="solana"?"me:solana:smart":"me:evm:smart"}get isSolanaWallet(){return this.chain==="solana"}approveTransactionAndWait(r,e){return l(this,null,function*(){return yield this.approveTransactionInternal(r,e),yield this.sleep(1e3),yield this.waitForTransaction(r)})}approveSignatureAndWait(r,e){return l(this,null,function*(){return yield this.approveSignatureInternal(r,e),yield this.sleep(1e3),yield this.waitForSignature(r)})}approveSignatureInternal(r,e){return l(this,null,function*(){var i,a;if(this.isSolanaWallet)throw new Error("Approving signatures is only supported for EVM smart wallets");let t=yield p(this,c).getSignature(this.walletLocator,r);if("error"in t)throw new b(JSON.stringify(t));if(this.signer.type==="api-key")return t;if((e==null?void 0:e.experimental_approval)!=null){let o=[e.experimental_approval];return yield this.executeApproveSignatureWithErrorHandling(r,o)}let n=(i=t.approvals)==null?void 0:i.pending;if(n==null)return t;let s=[...(a=e==null?void 0:e.additionalSigners)!=null?a:[],this.signer],g=(yield Promise.all(n.map(o=>{let h=s.find(m=>m.locator()===o.signer.locator);if(h==null)throw new E(`Signer ${o.signer} not found in pending approvals`);return h.signMessage(o.message)}))).map(o=>A(S({},o),{signer:this.signer.locator()}));return yield this.executeApproveSignatureWithErrorHandling(r,g)})}approveTransactionInternal(r,e){return l(this,null,function*(){var i,a,o,h,m;let t=yield p(this,c).getTransaction(this.walletLocator,r);if("error"in t)throw new W(JSON.stringify(t));if(yield(o=(a=(i=p(this,f))==null?void 0:i.experimental_callbacks)==null?void 0:a.onTransactionStart)==null?void 0:o.call(a),this.signer.type==="api-key")return t;if((e==null?void 0:e.experimental_approval)!=null){let w=[e.experimental_approval];return yield this.executeApproveTransactionWithErrorHandling(r,w)}let n=(h=t.approvals)==null?void 0:h.pending;if(n==null)return t;let s=[...(m=e==null?void 0:e.additionalSigners)!=null?m:[],this.signer],g=(yield Promise.all(n.map(w=>{let v=s.find(T=>T.locator()===w.signer.locator);if(v==null)throw new E(`Signer ${w.signer} not found in pending approvals`);let y=t.chainType==="solana"&&"transaction"in t.onChain?t.onChain.transaction:w.message;return v.signTransaction(y)}))).map(w=>A(S({},w),{signer:this.signer.locator()}));return yield this.executeApproveTransactionWithErrorHandling(r,g)})}executeApproveTransactionWithErrorHandling(r,e){return l(this,null,function*(){let t=yield p(this,c).approveTransaction(this.walletLocator,r,{approvals:e});if(t.error)throw new J(JSON.stringify(t));return t})}executeApproveSignatureWithErrorHandling(r,e){return l(this,null,function*(){let t=yield p(this,c).approveSignature(this.walletLocator,r,{approvals:e});if(t.error)throw new _(JSON.stringify(t));return t})}waitForSignature(r){return l(this,null,function*(){let e=null;do if(yield new Promise(t=>setTimeout(t,O)),e=yield p(this,c).getSignature(this.walletLocator,r),"error"in e)throw new b(JSON.stringify(e));while(e===null||e.status==="pending");if(e.status==="failed")throw new N("Signature signing failed");if(!e.outputSignature)throw new b("Signature not available");return{signature:e.outputSignature,signatureId:r}})}waitForTransaction(d){return l(this,arguments,function*(r,e=6e4,{backoffMultiplier:t=1.1,maxBackoffMs:n=2e3,initialBackoffMs:s=O}={}){var o;let g=Date.now(),i;do{if(Date.now()-g>e)throw new I("Transaction confirmation timeout");if(i=yield p(this,c).getTransaction(this.walletLocator,r),i.error)throw new W(JSON.stringify(i));yield this.sleep(s),s=Math.min(s*t,n)}while(i.status==="pending");if(i.status==="failed")throw new F(`Transaction sending failed: ${JSON.stringify(i.error)}`);if(i.status==="awaiting-approval")throw new R("Transaction is awaiting approval. Please submit required approvals before waiting for completion.");let a=i.onChain.txId;if(a==null)throw new B("Transaction hash not found on transaction response");return{hash:a,explorerLink:(o=i.onChain.explorerLink)!=null?o:"",transactionId:i.id}})}sleep(r){return l(this,null,function*(){return new Promise(e=>setTimeout(e,r))})}};f=new WeakMap,c=new WeakMap;function H(u){if(typeof u=="string")return u;if("email"in u)return`email:${u.email}`;if("x"in u)return`x:${u.x}`;if("twitter"in u)return`twitter:${u.twitter}`;if("phone"in u)return`phoneNumber:${u.phone}`;if("userId"in u)return`userId:${u.userId}`;throw new Error("Invalid recipient locator")}function M(u,r){return k(u)?`${r}:${u}`:`${r}:${u.toLowerCase()}`}export{G as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkTXVYEKTQcjs = require('./chunk-TXVYEKTQ.cjs');var _chunkMY4MQMBKcjs = require('./chunk-MY4MQMBK.cjs');var _chunkO4FVTK7Xcjs = require('./chunk-O4FVTK7X.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);var _commonsdkbase = require('@crossmint/common-sdk-base');var d=class u extends _chunkTXVYEKTQcjs.a{constructor(n){super({chain:n.chain,address:n.address,owner:n.owner,signer:n.signer,options:_chunkTXVYEKTQcjs.a.getOptions(n)},_chunkTXVYEKTQcjs.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, _chunkMY4MQMBKcjs.a)({type:"external-wallet",address:o.publicKey.toString(),locator:`external-wallet:${o.publicKey.toString()}`,onSignTransaction:c=>(c.sign([o]),Promise.resolve(c))}))};return yield this.approveTransactionAndWait(a.id,i)})}createTransaction(S){return _chunkXALFCQKDcjs.f.call(void 0, this,arguments,function*({transaction:n,options:a}){var r;let i=(r=a==null?void 0:a.experimental_signer)!=null?r:this.signer.locator(),e=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:_bs582.default.encode(n.serialize()),signer:i}});if("error"in e)throw new (0, _chunkO4FVTK7Xcjs.r)(JSON.stringify(e));return e})}};exports.a = d;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkG2375BCRcjs = require('./chunk-G2375BCR.cjs');var _chunkO4FVTK7Xcjs = require('./chunk-O4FVTK7X.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var p=class extends _commonsdkbase.CrossmintApiClient{constructor(e){super(e,{internalConfig:{sdkMetadata:{name:_chunkG2375BCRcjs.c,version:_chunkG2375BCRcjs.b}}});this.apiPrefix="api/2025-06-09/wallets";this.legacyApiPrefix="api/2022-06-09/wallets"}createWallet(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let s=this.isServerSide?`${this.apiPrefix}`:`${this.apiPrefix}/me`;return(yield this.post(s,{body:JSON.stringify(e),headers:this.headers})).json()})}getWallet(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}`,{headers:this.headers})).json()})}createTransaction(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveTransaction(e,s,t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions/${s}/approvals`,{body:JSON.stringify(t),headers:this.headers})).json()})}getTransaction(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions/${s}`,{headers:this.headers})).json()})}createSignature(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signatures`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveSignature(e,s,t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signatures/${s}/approvals`,{body:JSON.stringify(t),headers:this.headers})).json()})}getSignature(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/signatures/${s}`,{headers:this.headers})).json()})}getTransactions(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions`,{headers:this.headers})).json()})}experimental_getNfts(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let s=new URLSearchParams;s.append("page",e.page.toString()),s.append("perPage",e.perPage.toString());let t=`${e.chain}:${e.address}`;return(yield this.get(`${this.apiPrefix}/${t}/nfts?${s.toString()}`,{headers:this.headers})).json()})}experimental_activity(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let t=e;this.isServerSide||(t=`me:${s.chain==="solana"?"solana-smart-wallet":"evm-smart-wallet"}`);let a=new URLSearchParams;return a.append("chain",s.chain.toString()),(yield this.get(`${this.legacyApiPrefix}/${t}/activity?${a.toString()}`,{headers:this.headers})).json()})}getBalance(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let t=new URLSearchParams;return t.append("tokens",s.tokens.join(",")),t.append("chains",s.chains.join(",")),(yield this.get(`${this.apiPrefix}/${e}/balances?${t.toString()}`,{headers:this.headers})).json()})}registerSigner(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signers`,{body:JSON.stringify(s),headers:this.headers})).json()})}getSigner(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/signers/${s}`,{headers:this.headers})).json()})}send(e,s,t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/tokens/${s}/transfers`,{body:JSON.stringify(t),headers:this.headers})).json()})}get isServerSide(){return this.parsedAPIKey.usageOrigin===_commonsdkbase.APIKeyUsageOrigin.SERVER}get environment(){if(!this.parsedAPIKey.isValid)throw new (0, _chunkO4FVTK7Xcjs.a)("Invalid API key");return this.parsedAPIKey.environment}get headers(){return{"Content-Type":"application/json"}}};exports.a = p;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as l}from"./chunk-
|
|
1
|
+
import{a as l}from"./chunk-UAFD7PBR.js";import{a}from"./chunk-4OPYCYFU.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};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkRRHJSNJJcjs = require('./chunk-RRHJSNJJ.cjs');var _chunkY2BSZ42Gcjs = require('./chunk-Y2BSZ42G.cjs');var _chunk674X7BNYcjs = require('./chunk-674X7BNY.cjs');var _chunkH472F4EVcjs = require('./chunk-H472F4EV.cjs');require('./chunk-4U7B4KP7.cjs');require('./chunk-23BRREJG.cjs');var _chunkTXVYEKTQcjs = require('./chunk-TXVYEKTQ.cjs');require('./chunk-VGFF3F5P.cjs');require('./chunk-PO6S7UR3.cjs');require('./chunk-4GMYGJLU.cjs');require('./chunk-OMD5JARC.cjs');require('./chunk-MTZIGWOA.cjs');require('./chunk-FC7FFQOV.cjs');require('./chunk-MQP5VZCA.cjs');require('./chunk-YWPTI2QO.cjs');require('./chunk-4KXOWU5E.cjs');require('./chunk-MY4MQMBK.cjs');require('./chunk-67U2B6QL.cjs');require('./chunk-ZSWIQU3U.cjs');require('./chunk-6HXIZLEQ.cjs');var _chunkYT45MH4Ecjs = require('./chunk-YT45MH4E.cjs');require('./chunk-G2375BCR.cjs');require('./chunk-O4FVTK7X.cjs');require('./chunk-ECAM5KTH.cjs');require('./chunk-LO5VLDH7.cjs');require('./chunk-IR5WN6FQ.cjs');require('./chunk-GEY574TH.cjs');require('./chunk-YZ4HRYSL.cjs');require('./chunk-BULGM35W.cjs');require('./chunk-XALFCQKD.cjs');exports.CrossmintWallets = _chunkH472F4EVcjs.b; exports.EVMWallet = _chunkRRHJSNJJcjs.a; exports.SolanaWallet = _chunkY2BSZ42Gcjs.a; exports.StellarWallet = _chunk674X7BNYcjs.a; exports.Wallet = _chunkTXVYEKTQcjs.a; exports.WalletsApiClient = _chunkYT45MH4Ecjs.a; exports.createCrossmint = _chunkH472F4EVcjs.a;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as l}from"./chunk-
|
|
1
|
+
import{a as l}from"./chunk-IMHHL77D.js";import{a as r}from"./chunk-KD46HYGS.js";import{a as o}from"./chunk-2FUKUKUL.js";import{a as n,b as t}from"./chunk-ZF22XIO6.js";import"./chunk-UAFD7PBR.js";import"./chunk-BHGNJYYE.js";import{a}from"./chunk-VWBH7SK5.js";import"./chunk-H56FUTFU.js";import"./chunk-YDZRBHS3.js";import"./chunk-KPHNZJD7.js";import"./chunk-IVO2G656.js";import"./chunk-BK2D2D22.js";import"./chunk-VETSIYJQ.js";import"./chunk-JUSY5XEE.js";import"./chunk-UBOWSXW3.js";import"./chunk-IGBQEAD5.js";import"./chunk-JMK64ITR.js";import"./chunk-QZL4LBYZ.js";import"./chunk-M4ELAV7U.js";import"./chunk-5IFDVB4Y.js";import{a as e}from"./chunk-4OPYCYFU.js";import"./chunk-FZ6Z6ULO.js";import"./chunk-PSXRNSOE.js";import"./chunk-KBJA7JDT.js";import"./chunk-RE7DBYTJ.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,l as EVMWallet,r as SolanaWallet,o as StellarWallet,a as Wallet,e as WalletsApiClient,n as createCrossmint};
|
package/dist/sdk.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkH472F4EVcjs = require('./chunk-H472F4EV.cjs');require('./chunk-4U7B4KP7.cjs');require('./chunk-23BRREJG.cjs');require('./chunk-TXVYEKTQ.cjs');require('./chunk-VGFF3F5P.cjs');require('./chunk-PO6S7UR3.cjs');require('./chunk-4GMYGJLU.cjs');require('./chunk-OMD5JARC.cjs');require('./chunk-MTZIGWOA.cjs');require('./chunk-FC7FFQOV.cjs');require('./chunk-MQP5VZCA.cjs');require('./chunk-YWPTI2QO.cjs');require('./chunk-4KXOWU5E.cjs');require('./chunk-MY4MQMBK.cjs');require('./chunk-67U2B6QL.cjs');require('./chunk-ZSWIQU3U.cjs');require('./chunk-6HXIZLEQ.cjs');require('./chunk-YT45MH4E.cjs');require('./chunk-G2375BCR.cjs');require('./chunk-O4FVTK7X.cjs');require('./chunk-ECAM5KTH.cjs');require('./chunk-YZ4HRYSL.cjs');require('./chunk-BULGM35W.cjs');require('./chunk-XALFCQKD.cjs');exports.CrossmintWallets = _chunkH472F4EVcjs.b; exports.createCrossmint = _chunkH472F4EVcjs.a;
|
package/dist/sdk.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b}from"./chunk-
|
|
1
|
+
import{a,b}from"./chunk-ZF22XIO6.js";import"./chunk-UAFD7PBR.js";import"./chunk-BHGNJYYE.js";import"./chunk-VWBH7SK5.js";import"./chunk-H56FUTFU.js";import"./chunk-YDZRBHS3.js";import"./chunk-KPHNZJD7.js";import"./chunk-IVO2G656.js";import"./chunk-BK2D2D22.js";import"./chunk-VETSIYJQ.js";import"./chunk-JUSY5XEE.js";import"./chunk-UBOWSXW3.js";import"./chunk-IGBQEAD5.js";import"./chunk-JMK64ITR.js";import"./chunk-QZL4LBYZ.js";import"./chunk-M4ELAV7U.js";import"./chunk-5IFDVB4Y.js";import"./chunk-4OPYCYFU.js";import"./chunk-FZ6Z6ULO.js";import"./chunk-PSXRNSOE.js";import"./chunk-KBJA7JDT.js";import"./chunk-LW6JSI4J.js";import"./chunk-5S6YZJHE.js";import"./chunk-BW7YYVZE.js";export{b as CrossmintWallets,a as createCrossmint};
|
package/dist/signers/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkVGFF3F5Pcjs = require('../chunk-VGFF3F5P.cjs');require('../chunk-PO6S7UR3.cjs');require('../chunk-4GMYGJLU.cjs');require('../chunk-OMD5JARC.cjs');require('../chunk-MTZIGWOA.cjs');require('../chunk-FC7FFQOV.cjs');require('../chunk-MQP5VZCA.cjs');require('../chunk-YWPTI2QO.cjs');require('../chunk-4KXOWU5E.cjs');require('../chunk-MY4MQMBK.cjs');require('../chunk-67U2B6QL.cjs');require('../chunk-ZSWIQU3U.cjs');require('../chunk-O4FVTK7X.cjs');require('../chunk-YZ4HRYSL.cjs');require('../chunk-BULGM35W.cjs');require('../chunk-XALFCQKD.cjs');exports.assembleSigner = _chunkVGFF3F5Pcjs.a;
|
package/dist/signers/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-H56FUTFU.js";import"../chunk-YDZRBHS3.js";import"../chunk-KPHNZJD7.js";import"../chunk-IVO2G656.js";import"../chunk-BK2D2D22.js";import"../chunk-VETSIYJQ.js";import"../chunk-JUSY5XEE.js";import"../chunk-UBOWSXW3.js";import"../chunk-IGBQEAD5.js";import"../chunk-JMK64ITR.js";import"../chunk-QZL4LBYZ.js";import"../chunk-M4ELAV7U.js";import"../chunk-PSXRNSOE.js";import"../chunk-LW6JSI4J.js";import"../chunk-5S6YZJHE.js";import"../chunk-BW7YYVZE.js";export{a as assembleSigner};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../../chunk-PO6S7UR3.cjs');var _chunk4GMYGJLUcjs = require('../../chunk-4GMYGJLU.cjs');var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../../chunk-PO6S7UR3.cjs');var _chunk4GMYGJLUcjs = require('../../chunk-4GMYGJLU.cjs');var _chunkOMD5JARCcjs = require('../../chunk-OMD5JARC.cjs');var _chunkMTZIGWOAcjs = require('../../chunk-MTZIGWOA.cjs');var _chunkFC7FFQOVcjs = require('../../chunk-FC7FFQOV.cjs');require('../../chunk-MQP5VZCA.cjs');require('../../chunk-ZSWIQU3U.cjs');require('../../chunk-XALFCQKD.cjs');exports.DEFAULT_EVENT_OPTIONS = _chunkFC7FFQOVcjs.b; exports.EVMNonCustodialSigner = _chunkMTZIGWOAcjs.a; exports.NonCustodialSigner = _chunkFC7FFQOVcjs.a; exports.SolanaNonCustodialSigner = _chunk4GMYGJLUcjs.a; exports.StellarNonCustodialSigner = _chunkOMD5JARCcjs.a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../chunk-YDZRBHS3.js";import{a as c}from"../../chunk-KPHNZJD7.js";import{a as e}from"../../chunk-
|
|
1
|
+
import"../../chunk-YDZRBHS3.js";import{a as c}from"../../chunk-KPHNZJD7.js";import{a as e}from"../../chunk-IVO2G656.js";import{a as d}from"../../chunk-BK2D2D22.js";import{a,b}from"../../chunk-VETSIYJQ.js";import"../../chunk-JUSY5XEE.js";import"../../chunk-M4ELAV7U.js";import"../../chunk-BW7YYVZE.js";export{b as DEFAULT_EVENT_OPTIONS,d as EVMNonCustodialSigner,a as NonCustodialSigner,c as SolanaNonCustodialSigner,e as StellarNonCustodialSigner};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkOMD5JARCcjs = require('../../chunk-OMD5JARC.cjs');require('../../chunk-FC7FFQOV.cjs');require('../../chunk-MQP5VZCA.cjs');require('../../chunk-ZSWIQU3U.cjs');require('../../chunk-XALFCQKD.cjs');exports.StellarNonCustodialSigner = _chunkOMD5JARCcjs.a;
|
|
@@ -10,7 +10,7 @@ import 'viem';
|
|
|
10
10
|
declare class StellarNonCustodialSigner extends NonCustodialSigner {
|
|
11
11
|
constructor(config: EmailInternalSignerConfig | PhoneInternalSignerConfig);
|
|
12
12
|
signMessage(): Promise<never>;
|
|
13
|
-
signTransaction(
|
|
13
|
+
signTransaction(payload: string): Promise<{
|
|
14
14
|
signature: string;
|
|
15
15
|
}>;
|
|
16
16
|
static verifyPublicKeyFormat(publicKey: {
|
|
@@ -10,7 +10,7 @@ import 'viem';
|
|
|
10
10
|
declare class StellarNonCustodialSigner extends NonCustodialSigner {
|
|
11
11
|
constructor(config: EmailInternalSignerConfig | PhoneInternalSignerConfig);
|
|
12
12
|
signMessage(): Promise<never>;
|
|
13
|
-
signTransaction(
|
|
13
|
+
signTransaction(payload: string): Promise<{
|
|
14
14
|
signature: string;
|
|
15
15
|
}>;
|
|
16
16
|
static verifyPublicKeyFormat(publicKey: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-IVO2G656.js";import"../../chunk-VETSIYJQ.js";import"../../chunk-JUSY5XEE.js";import"../../chunk-M4ELAV7U.js";import"../../chunk-BW7YYVZE.js";export{a as StellarNonCustodialSigner};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk67U2B6QLcjs = require('../chunk-67U2B6QL.cjs');require('../chunk-XALFCQKD.cjs');exports.StellarExternalWalletSigner = _chunk67U2B6QLcjs.a;
|
|
@@ -10,11 +10,11 @@ declare class StellarExternalWalletSigner implements Signer {
|
|
|
10
10
|
private config;
|
|
11
11
|
type: "external-wallet";
|
|
12
12
|
address: string;
|
|
13
|
-
onSignStellarTransaction?: (
|
|
13
|
+
onSignStellarTransaction?: (payload: string) => Promise<string>;
|
|
14
14
|
constructor(config: ExternalWalletInternalSignerConfig<StellarChain>);
|
|
15
15
|
locator(): string;
|
|
16
16
|
signMessage(): Promise<never>;
|
|
17
|
-
signTransaction(
|
|
17
|
+
signTransaction(payload: string): Promise<{
|
|
18
18
|
signature: string;
|
|
19
19
|
}>;
|
|
20
20
|
}
|
|
@@ -10,11 +10,11 @@ declare class StellarExternalWalletSigner implements Signer {
|
|
|
10
10
|
private config;
|
|
11
11
|
type: "external-wallet";
|
|
12
12
|
address: string;
|
|
13
|
-
onSignStellarTransaction?: (
|
|
13
|
+
onSignStellarTransaction?: (payload: string) => Promise<string>;
|
|
14
14
|
constructor(config: ExternalWalletInternalSignerConfig<StellarChain>);
|
|
15
15
|
locator(): string;
|
|
16
16
|
signMessage(): Promise<never>;
|
|
17
|
-
signTransaction(
|
|
17
|
+
signTransaction(payload: string): Promise<{
|
|
18
18
|
signature: string;
|
|
19
19
|
}>;
|
|
20
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-QZL4LBYZ.js";import"../chunk-BW7YYVZE.js";export{a as StellarExternalWalletSigner};
|
package/dist/utils/constants.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkG2375BCRcjs = require('../chunk-G2375BCR.cjs');require('../chunk-XALFCQKD.cjs');exports.SDK_NAME = _chunkG2375BCRcjs.c; exports.SDK_VERSION = _chunkG2375BCRcjs.b; exports.STATUS_POLLING_INTERVAL_MS = _chunkG2375BCRcjs.d; exports.WALLETS_SERVICE = _chunkG2375BCRcjs.a;
|
package/dist/utils/constants.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d}from"../chunk-
|
|
1
|
+
import{a,b,c,d}from"../chunk-FZ6Z6ULO.js";import"../chunk-BW7YYVZE.js";export{c as SDK_NAME,b as SDK_VERSION,d as STATUS_POLLING_INTERVAL_MS,a as WALLETS_SERVICE};
|
package/dist/wallets/evm.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkRRHJSNJJcjs = require('../chunk-RRHJSNJJ.cjs');require('../chunk-TXVYEKTQ.cjs');require('../chunk-G2375BCR.cjs');require('../chunk-O4FVTK7X.cjs');require('../chunk-LO5VLDH7.cjs');require('../chunk-IR5WN6FQ.cjs');require('../chunk-GEY574TH.cjs');require('../chunk-XALFCQKD.cjs');exports.EVMWallet = _chunkRRHJSNJJcjs.a;
|
package/dist/wallets/evm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-IMHHL77D.js";import"../chunk-VWBH7SK5.js";import"../chunk-FZ6Z6ULO.js";import"../chunk-PSXRNSOE.js";import"../chunk-RE7DBYTJ.js";import"../chunk-KKQBZXFE.js";import"../chunk-S3DYQVRD.js";import"../chunk-BW7YYVZE.js";export{a as EVMWallet};
|
package/dist/wallets/solana.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkY2BSZ42Gcjs = require('../chunk-Y2BSZ42G.cjs');require('../chunk-TXVYEKTQ.cjs');require('../chunk-MY4MQMBK.cjs');require('../chunk-G2375BCR.cjs');require('../chunk-O4FVTK7X.cjs');require('../chunk-XALFCQKD.cjs');exports.SolanaWallet = _chunkY2BSZ42Gcjs.a;
|
package/dist/wallets/solana.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-KD46HYGS.js";import"../chunk-VWBH7SK5.js";import"../chunk-JMK64ITR.js";import"../chunk-FZ6Z6ULO.js";import"../chunk-PSXRNSOE.js";import"../chunk-BW7YYVZE.js";export{a as SolanaWallet};
|
package/dist/wallets/stellar.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk674X7BNYcjs = require('../chunk-674X7BNY.cjs');require('../chunk-TXVYEKTQ.cjs');require('../chunk-G2375BCR.cjs');require('../chunk-O4FVTK7X.cjs');require('../chunk-XALFCQKD.cjs');exports.StellarWallet = _chunk674X7BNYcjs.a;
|
package/dist/wallets/stellar.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-2FUKUKUL.js";import"../chunk-VWBH7SK5.js";import"../chunk-FZ6Z6ULO.js";import"../chunk-PSXRNSOE.js";import"../chunk-BW7YYVZE.js";export{a as StellarWallet};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk4U7B4KP7cjs = require('../chunk-4U7B4KP7.cjs');require('../chunk-23BRREJG.cjs');require('../chunk-TXVYEKTQ.cjs');require('../chunk-VGFF3F5P.cjs');require('../chunk-PO6S7UR3.cjs');require('../chunk-4GMYGJLU.cjs');require('../chunk-OMD5JARC.cjs');require('../chunk-MTZIGWOA.cjs');require('../chunk-FC7FFQOV.cjs');require('../chunk-MQP5VZCA.cjs');require('../chunk-YWPTI2QO.cjs');require('../chunk-4KXOWU5E.cjs');require('../chunk-MY4MQMBK.cjs');require('../chunk-67U2B6QL.cjs');require('../chunk-ZSWIQU3U.cjs');require('../chunk-G2375BCR.cjs');require('../chunk-O4FVTK7X.cjs');require('../chunk-YZ4HRYSL.cjs');require('../chunk-BULGM35W.cjs');require('../chunk-XALFCQKD.cjs');exports.WalletFactory = _chunk4U7B4KP7cjs.a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-UAFD7PBR.js";import"../chunk-BHGNJYYE.js";import"../chunk-VWBH7SK5.js";import"../chunk-H56FUTFU.js";import"../chunk-YDZRBHS3.js";import"../chunk-KPHNZJD7.js";import"../chunk-IVO2G656.js";import"../chunk-BK2D2D22.js";import"../chunk-VETSIYJQ.js";import"../chunk-JUSY5XEE.js";import"../chunk-UBOWSXW3.js";import"../chunk-IGBQEAD5.js";import"../chunk-JMK64ITR.js";import"../chunk-QZL4LBYZ.js";import"../chunk-M4ELAV7U.js";import"../chunk-FZ6Z6ULO.js";import"../chunk-PSXRNSOE.js";import"../chunk-LW6JSI4J.js";import"../chunk-5S6YZJHE.js";import"../chunk-BW7YYVZE.js";export{a as WalletFactory};
|
package/dist/wallets/wallet.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkTXVYEKTQcjs = require('../chunk-TXVYEKTQ.cjs');require('../chunk-G2375BCR.cjs');require('../chunk-O4FVTK7X.cjs');require('../chunk-XALFCQKD.cjs');exports.Wallet = _chunkTXVYEKTQcjs.a;
|
package/dist/wallets/wallet.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-VWBH7SK5.js";import"../chunk-FZ6Z6ULO.js";import"../chunk-PSXRNSOE.js";import"../chunk-BW7YYVZE.js";export{a as Wallet};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crossmint/wallets-sdk",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.7",
|
|
4
4
|
"repository": "https://github.com/Crossmint/crossmint-sdk",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Paella Labs Inc",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"ox": "0.6.9",
|
|
27
27
|
"tweetnacl": "1.0.3",
|
|
28
28
|
"viem": "2.33.1",
|
|
29
|
-
"@crossmint/client-sdk-window": "1.0.3",
|
|
30
29
|
"@crossmint/client-signers": "0.0.18",
|
|
30
|
+
"@crossmint/client-sdk-window": "1.0.3",
|
|
31
31
|
"@crossmint/common-sdk-base": "0.9.3"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
package/dist/chunk-E2WBOL4Z.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkFC7FFQOVcjs = require('./chunk-FC7FFQOV.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);var a=class g extends _chunkFC7FFQOVcjs.a{constructor(e){super(e)}signMessage(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for stellar signer"))})}signTransaction(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var r;yield this.handleAuthRequired();let c=this.getJwtOrThrow(),f=Buffer.from(e,"base64"),u=_bs582.default.encode(f),n=yield(r=this.config.clientTEEConnection)==null?void 0:r.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:c,apiKey:this.config.crossmint.apiKey},data:{keyType:"ed25519",bytes:u,encoding:"base58"}},options:_chunkFC7FFQOVcjs.b});if((n==null?void 0:n.status)==="error")throw new Error(n.error);if((n==null?void 0:n.signature)==null)throw new Error("Failed to sign transaction");g.verifyPublicKeyFormat(n.publicKey);let d=_bs582.default.decode(n.signature.bytes);return{signature:Buffer.from(d).toString("base64")}})}static verifyPublicKeyFormat(e){if(e==null)throw new Error("No public key found");if(e.encoding!=="base58"||e.keyType!=="ed25519"||e.bytes==null)throw new Error("Not supported. Expected public key to be in base58 encoding and ed25519 key type. Got: "+JSON.stringify(e))}};exports.a = a;
|
package/dist/chunk-GNSLUZU5.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk4K2SL4XUcjs = require('./chunk-4K2SL4XU.cjs');var _chunkO4FVTK7Xcjs = require('./chunk-O4FVTK7X.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var f,c,G= exports.a =class{constructor(r,e){_chunkXALFCQKDcjs.d.call(void 0, this,f);_chunkXALFCQKDcjs.d.call(void 0, this,c);let{chain:t,address:n,owner:s,signer:g,options:d}=r;_chunkXALFCQKDcjs.e.call(void 0, this,c,e),this.chain=t,this.address=n,this.owner=s,this.signer=g,_chunkXALFCQKDcjs.e.call(void 0, this,f,d)}static getApiClient(r){return r.apiClient}static getOptions(r){return r.options}get apiClient(){return _chunkXALFCQKDcjs.c.call(void 0, this,c)}get options(){return _chunkXALFCQKDcjs.c.call(void 0, this,f)}experimental_apiClient(){return _chunkXALFCQKDcjs.c.call(void 0, this,c)}balances(r,e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let t;switch(this.chain){case"solana":t="sol";break;case"stellar":t="xlm";break;default:t="eth";break}let n=[t,"usdc",...r!=null?r:[]],s=yield _chunkXALFCQKDcjs.c.call(void 0, this,c).getBalance(this.address,{chains:e!=null?e:[this.chain],tokens:n.map(g=>g.toLowerCase())});if("error"in s)throw new Error(`Failed to get balances for wallet: ${JSON.stringify(s.message)}`);return this.transformBalanceResponse(s,t,r)})}transformBalanceResponse(r,e,t){let n=a=>{var m,w,v,y,T;let o=(m=a.chains)==null?void 0:m[this.chain],h=o!=null&&"contractAddress"in o?o.contractAddress:void 0;return{symbol:(w=a.symbol)!=null?w:"",name:(v=a.symbol)!=null?v:"",amount:(y=a.amount)!=null?y:"0",contractAddress:h,decimals:a.decimals,rawAmount:(T=a.rawAmount)!=null?T:"0"}},s=r.find(a=>a.symbol===e),g=r.find(a=>a.symbol==="usdc"),d=r.filter(a=>{var o;return a.symbol!==e&&a.symbol!=="usdc"&&(t==null?void 0:t.includes((o=a.symbol)!=null?o:""))}),i=a=>({symbol:a,name:a,amount:"0",contractAddress:void 0,decimals:0,rawAmount:"0"});return{nativeToken:s!=null?n(s):i(e),usdc:g!=null?n(g):i("usdc"),tokens:d.map(n)}}experimental_nfts(r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield _chunkXALFCQKDcjs.c.call(void 0, this,c).experimental_getNfts(_chunkXALFCQKDcjs.b.call(void 0, _chunkXALFCQKDcjs.a.call(void 0, {},r),{chain:this.chain,address:this.address}))})}experimental_transactions(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let r=yield _chunkXALFCQKDcjs.c.call(void 0, this,c).getTransactions(this.walletLocator);if("error"in r)throw new Error(`Failed to get transactions: ${JSON.stringify(r.message)}`);return r})}experimental_transaction(r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let e=yield _chunkXALFCQKDcjs.c.call(void 0, this,c).getTransaction(this.walletLocator,r);if("error"in e)throw new Error(`Failed to get transaction: ${JSON.stringify(e.error)}`);return e})}experimental_activity(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let r=yield this.apiClient.experimental_activity(this.walletLocator,{chain:this.chain});if("error"in r)throw new Error(`Failed to get activity: ${JSON.stringify(r.message)}`);return r})}send(r,e,t,n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let s=H(r),g=M(e,this.chain),d={recipient:s,amount:t},i=yield _chunkXALFCQKDcjs.c.call(void 0, this,c).send(this.walletLocator,g,d);if("message"in i)throw new (0, _chunkO4FVTK7Xcjs.r)(`Failed to send token: ${JSON.stringify(i.message)}`);return n!=null&&n.experimental_prepareOnly?{hash:void 0,explorerLink:void 0,transactionId:i.id}:(console.log("transactionCreationResponse",i),yield this.approveTransactionAndWait(i.id))})}approveTransaction(r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return console.warn("approveTransaction is deprecated. Use approve instead. This method will be removed in the next major version."),yield this.approve(r)})}approve(r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(r.transactionId!=null)return yield this.approveTransactionAndWait(r.transactionId,r.options);if(r.signatureId!=null)return yield this.approveSignatureAndWait(r.signatureId,r.options);throw new Error("Either transactionId or signatureId must be provided")})}addDelegatedSigner(r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var t;let e=yield _chunkXALFCQKDcjs.c.call(void 0, this,c).registerSigner(this.walletLocator,{signer:r.signer,chain:this.chain==="solana"||this.chain==="stellar"?void 0:this.chain});if("error"in e)throw new Error(`Failed to register signer: ${JSON.stringify(e.message)}`);if("transaction"in e){let n=e.transaction.id;yield this.approveTransactionAndWait(n)}else{let n=(t=e.chains)==null?void 0:t[this.chain];if((n==null?void 0:n.status)==="awaiting-approval"){yield this.approveSignatureAndWait(n.id);return}if((n==null?void 0:n.status)==="pending"){yield this.waitForSignature(n.id);return}}})}delegatedSigners(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var e,t,n;let r=yield _chunkXALFCQKDcjs.c.call(void 0, this,c).getWallet(this.walletLocator);if("error"in r)throw new (0, _chunkO4FVTK7Xcjs.d)(JSON.stringify(r));if(this.chain==="stellar")return[];if(r.type!=="smart"||r.chainType!=="evm"&&r.chainType!=="solana")throw new (0, _chunkO4FVTK7Xcjs.c)(`Wallet type ${r.type} not supported`);return(n=(t=(e=r==null?void 0:r.config)==null?void 0:e.delegatedSigners)==null?void 0:t.map(s=>{let g=s.locator.indexOf(":");return{signer:`external-wallet:${g>=0?s.locator.slice(g+1):s.locator}`}}))!=null?n:[]})}get walletLocator(){return _chunkXALFCQKDcjs.c.call(void 0, this,c).isServerSide?this.address:this.chain==="stellar"?"me:stellar:smart":this.chain==="solana"?"me:solana:smart":"me:evm:smart"}get isSolanaWallet(){return this.chain==="solana"}approveTransactionAndWait(r,e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.approveTransactionInternal(r,e),yield this.sleep(1e3),yield this.waitForTransaction(r)})}approveSignatureAndWait(r,e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.approveSignatureInternal(r,e),yield this.sleep(1e3),yield this.waitForSignature(r)})}approveSignatureInternal(r,e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var i,a;if(this.isSolanaWallet)throw new Error("Approving signatures is only supported for EVM smart wallets");let t=yield _chunkXALFCQKDcjs.c.call(void 0, this,c).getSignature(this.walletLocator,r);if("error"in t)throw new (0, _chunkO4FVTK7Xcjs.p)(JSON.stringify(t));if(this.signer.type==="api-key")return t;if((e==null?void 0:e.experimental_approval)!=null){let o=[e.experimental_approval];return yield this.executeApproveSignatureWithErrorHandling(r,o)}let n=(i=t.approvals)==null?void 0:i.pending;if(n==null)return t;let s=[...(a=e==null?void 0:e.additionalSigners)!=null?a:[],this.signer],d=(yield Promise.all(n.map(o=>{let h=s.find(m=>m.locator()===o.signer.locator);if(h==null)throw new (0, _chunkO4FVTK7Xcjs.i)(`Signer ${o.signer} not found in pending approvals`);return h.signMessage(o.message)}))).map(o=>_chunkXALFCQKDcjs.b.call(void 0, _chunkXALFCQKDcjs.a.call(void 0, {},o),{signer:this.signer.locator()}));return yield this.executeApproveSignatureWithErrorHandling(r,d)})}approveTransactionInternal(r,e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var i,a,o,h,m;let t=yield _chunkXALFCQKDcjs.c.call(void 0, this,c).getTransaction(this.walletLocator,r);if("error"in t)throw new (0, _chunkO4FVTK7Xcjs.s)(JSON.stringify(t));if(yield(o=(a=(i=_chunkXALFCQKDcjs.c.call(void 0, this,f))==null?void 0:i.experimental_callbacks)==null?void 0:a.onTransactionStart)==null?void 0:o.call(a),this.signer.type==="api-key")return t;if((e==null?void 0:e.experimental_approval)!=null){let w=[e.experimental_approval];return yield this.executeApproveTransactionWithErrorHandling(r,w)}let n=(h=t.approvals)==null?void 0:h.pending;if(n==null)return t;let s=[...(m=e==null?void 0:e.additionalSigners)!=null?m:[],this.signer],d=(yield Promise.all(n.map(w=>{let v=s.find(T=>T.locator()===w.signer.locator);if(v==null)throw new (0, _chunkO4FVTK7Xcjs.i)(`Signer ${w.signer} not found in pending approvals`);let y=t.chainType==="solana"&&"transaction"in t.onChain?t.onChain.transaction:w.message;return v.signTransaction(y)}))).map(w=>_chunkXALFCQKDcjs.b.call(void 0, _chunkXALFCQKDcjs.a.call(void 0, {},w),{signer:this.signer.locator()}));return yield this.executeApproveTransactionWithErrorHandling(r,d)})}executeApproveTransactionWithErrorHandling(r,e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let t=yield _chunkXALFCQKDcjs.c.call(void 0, this,c).approveTransaction(this.walletLocator,r,{approvals:e});if(t.error)throw new (0, _chunkO4FVTK7Xcjs.x)(JSON.stringify(t));return t})}executeApproveSignatureWithErrorHandling(r,e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let t=yield _chunkXALFCQKDcjs.c.call(void 0, this,c).approveSignature(this.walletLocator,r,{approvals:e});if(t.error)throw new (0, _chunkO4FVTK7Xcjs.q)(JSON.stringify(t));return t})}waitForSignature(r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let e=null;do if(yield new Promise(t=>setTimeout(t,_chunk4K2SL4XUcjs.d)),e=yield _chunkXALFCQKDcjs.c.call(void 0, this,c).getSignature(this.walletLocator,r),"error"in e)throw new (0, _chunkO4FVTK7Xcjs.p)(JSON.stringify(e));while(e===null||e.status==="pending");if(e.status==="failed")throw new (0, _chunkO4FVTK7Xcjs.m)("Signature signing failed");if(!e.outputSignature)throw new (0, _chunkO4FVTK7Xcjs.p)("Signature not available");return{signature:e.outputSignature,signatureId:r}})}waitForTransaction(g){return _chunkXALFCQKDcjs.f.call(void 0, this,arguments,function*(r,e=6e4,{backoffMultiplier:t=1.1,maxBackoffMs:n=2e3,initialBackoffMs:s=_chunk4K2SL4XUcjs.d}={}){var o;let d=Date.now(),i;do{if(Date.now()-d>e)throw new (0, _chunkO4FVTK7Xcjs.t)("Transaction confirmation timeout");if(i=yield _chunkXALFCQKDcjs.c.call(void 0, this,c).getTransaction(this.walletLocator,r),i.error)throw new (0, _chunkO4FVTK7Xcjs.s)(JSON.stringify(i));yield this.sleep(s),s=Math.min(s*t,n)}while(i.status==="pending");if(i.status==="failed")throw new (0, _chunkO4FVTK7Xcjs.u)(`Transaction sending failed: ${JSON.stringify(i.error)}`);if(i.status==="awaiting-approval")throw new (0, _chunkO4FVTK7Xcjs.v)("Transaction is awaiting approval. Please submit required approvals before waiting for completion.");let a=i.onChain.txId;if(a==null)throw new (0, _chunkO4FVTK7Xcjs.w)("Transaction hash not found on transaction response");return{hash:a,explorerLink:(o=i.onChain.explorerLink)!=null?o:"",transactionId:i.id}})}sleep(r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return new Promise(e=>setTimeout(e,r))})}};f=new WeakMap,c=new WeakMap;function H(u){if(typeof u=="string")return u;if("email"in u)return`email:${u.email}`;if("x"in u)return`x:${u.x}`;if("twitter"in u)return`twitter:${u.twitter}`;if("phone"in u)return`phoneNumber:${u.phone}`;if("userId"in u)return`userId:${u.userId}`;throw new Error("Invalid recipient locator")}function M(u,r){return _commonsdkbase.isValidAddress.call(void 0, u)?`${r}:${u}`:`${r}:${u.toLowerCase()}`}exports.a = G;
|
package/dist/chunk-Q6OF35PW.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var s="@crossmint/wallets-sdk",t="0.11.6";var r="WALLETS_SDK",c=t,a=s,d=500;export{r as a,c as b,a as c,d};
|
package/dist/chunk-VPIAMNQU.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as i,b as s}from"./chunk-VETSIYJQ.js";import{f as t}from"./chunk-BW7YYVZE.js";import o from"bs58";var a=class g extends i{constructor(e){super(e)}signMessage(){return t(this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for stellar signer"))})}signTransaction(e){return t(this,null,function*(){var r;yield this.handleAuthRequired();let c=this.getJwtOrThrow(),f=Buffer.from(e,"base64"),u=o.encode(f),n=yield(r=this.config.clientTEEConnection)==null?void 0:r.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:c,apiKey:this.config.crossmint.apiKey},data:{keyType:"ed25519",bytes:u,encoding:"base58"}},options:s});if((n==null?void 0:n.status)==="error")throw new Error(n.error);if((n==null?void 0:n.signature)==null)throw new Error("Failed to sign transaction");g.verifyPublicKeyFormat(n.publicKey);let d=o.decode(n.signature.bytes);return{signature:Buffer.from(d).toString("base64")}})}static verifyPublicKeyFormat(e){if(e==null)throw new Error("No public key found");if(e.encoding!=="base58"||e.keyType!=="ed25519"||e.bytes==null)throw new Error("Not supported. Expected public key to be in base58 encoding and ed25519 key type. Got: "+JSON.stringify(e))}};export{a};
|
package/dist/chunk-VYWQOSTS.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as O}from"./chunk-Q6OF35PW.js";import{c as W,d as P,i as E,m as N,p as b,q as _,r as $,s as L,t as I,u as R,v as F,w as B,x as J}from"./chunk-PSXRNSOE.js";import{a as S,b as A,c as p,d as x,e as C,f as l}from"./chunk-BW7YYVZE.js";import{isValidAddress as k}from"@crossmint/common-sdk-base";var f,c,G=class{constructor(r,e){x(this,f);x(this,c);let{chain:t,address:n,owner:s,signer:g,options:d}=r;C(this,c,e),this.chain=t,this.address=n,this.owner=s,this.signer=g,C(this,f,d)}static getApiClient(r){return r.apiClient}static getOptions(r){return r.options}get apiClient(){return p(this,c)}get options(){return p(this,f)}experimental_apiClient(){return p(this,c)}balances(r,e){return l(this,null,function*(){let t;switch(this.chain){case"solana":t="sol";break;case"stellar":t="xlm";break;default:t="eth";break}let n=[t,"usdc",...r!=null?r:[]],s=yield p(this,c).getBalance(this.address,{chains:e!=null?e:[this.chain],tokens:n.map(g=>g.toLowerCase())});if("error"in s)throw new Error(`Failed to get balances for wallet: ${JSON.stringify(s.message)}`);return this.transformBalanceResponse(s,t,r)})}transformBalanceResponse(r,e,t){let n=a=>{var m,w,v,y,T;let o=(m=a.chains)==null?void 0:m[this.chain],h=o!=null&&"contractAddress"in o?o.contractAddress:void 0;return{symbol:(w=a.symbol)!=null?w:"",name:(v=a.symbol)!=null?v:"",amount:(y=a.amount)!=null?y:"0",contractAddress:h,decimals:a.decimals,rawAmount:(T=a.rawAmount)!=null?T:"0"}},s=r.find(a=>a.symbol===e),g=r.find(a=>a.symbol==="usdc"),d=r.filter(a=>{var o;return a.symbol!==e&&a.symbol!=="usdc"&&(t==null?void 0:t.includes((o=a.symbol)!=null?o:""))}),i=a=>({symbol:a,name:a,amount:"0",contractAddress:void 0,decimals:0,rawAmount:"0"});return{nativeToken:s!=null?n(s):i(e),usdc:g!=null?n(g):i("usdc"),tokens:d.map(n)}}experimental_nfts(r){return l(this,null,function*(){return yield p(this,c).experimental_getNfts(A(S({},r),{chain:this.chain,address:this.address}))})}experimental_transactions(){return l(this,null,function*(){let r=yield p(this,c).getTransactions(this.walletLocator);if("error"in r)throw new Error(`Failed to get transactions: ${JSON.stringify(r.message)}`);return r})}experimental_transaction(r){return l(this,null,function*(){let e=yield p(this,c).getTransaction(this.walletLocator,r);if("error"in e)throw new Error(`Failed to get transaction: ${JSON.stringify(e.error)}`);return e})}experimental_activity(){return l(this,null,function*(){let r=yield this.apiClient.experimental_activity(this.walletLocator,{chain:this.chain});if("error"in r)throw new Error(`Failed to get activity: ${JSON.stringify(r.message)}`);return r})}send(r,e,t,n){return l(this,null,function*(){let s=H(r),g=M(e,this.chain),d={recipient:s,amount:t},i=yield p(this,c).send(this.walletLocator,g,d);if("message"in i)throw new $(`Failed to send token: ${JSON.stringify(i.message)}`);return n!=null&&n.experimental_prepareOnly?{hash:void 0,explorerLink:void 0,transactionId:i.id}:(console.log("transactionCreationResponse",i),yield this.approveTransactionAndWait(i.id))})}approveTransaction(r){return l(this,null,function*(){return console.warn("approveTransaction is deprecated. Use approve instead. This method will be removed in the next major version."),yield this.approve(r)})}approve(r){return l(this,null,function*(){if(r.transactionId!=null)return yield this.approveTransactionAndWait(r.transactionId,r.options);if(r.signatureId!=null)return yield this.approveSignatureAndWait(r.signatureId,r.options);throw new Error("Either transactionId or signatureId must be provided")})}addDelegatedSigner(r){return l(this,null,function*(){var t;let e=yield p(this,c).registerSigner(this.walletLocator,{signer:r.signer,chain:this.chain==="solana"||this.chain==="stellar"?void 0:this.chain});if("error"in e)throw new Error(`Failed to register signer: ${JSON.stringify(e.message)}`);if("transaction"in e){let n=e.transaction.id;yield this.approveTransactionAndWait(n)}else{let n=(t=e.chains)==null?void 0:t[this.chain];if((n==null?void 0:n.status)==="awaiting-approval"){yield this.approveSignatureAndWait(n.id);return}if((n==null?void 0:n.status)==="pending"){yield this.waitForSignature(n.id);return}}})}delegatedSigners(){return l(this,null,function*(){var e,t,n;let r=yield p(this,c).getWallet(this.walletLocator);if("error"in r)throw new P(JSON.stringify(r));if(this.chain==="stellar")return[];if(r.type!=="smart"||r.chainType!=="evm"&&r.chainType!=="solana")throw new W(`Wallet type ${r.type} not supported`);return(n=(t=(e=r==null?void 0:r.config)==null?void 0:e.delegatedSigners)==null?void 0:t.map(s=>{let g=s.locator.indexOf(":");return{signer:`external-wallet:${g>=0?s.locator.slice(g+1):s.locator}`}}))!=null?n:[]})}get walletLocator(){return p(this,c).isServerSide?this.address:this.chain==="stellar"?"me:stellar:smart":this.chain==="solana"?"me:solana:smart":"me:evm:smart"}get isSolanaWallet(){return this.chain==="solana"}approveTransactionAndWait(r,e){return l(this,null,function*(){return yield this.approveTransactionInternal(r,e),yield this.sleep(1e3),yield this.waitForTransaction(r)})}approveSignatureAndWait(r,e){return l(this,null,function*(){return yield this.approveSignatureInternal(r,e),yield this.sleep(1e3),yield this.waitForSignature(r)})}approveSignatureInternal(r,e){return l(this,null,function*(){var i,a;if(this.isSolanaWallet)throw new Error("Approving signatures is only supported for EVM smart wallets");let t=yield p(this,c).getSignature(this.walletLocator,r);if("error"in t)throw new b(JSON.stringify(t));if(this.signer.type==="api-key")return t;if((e==null?void 0:e.experimental_approval)!=null){let o=[e.experimental_approval];return yield this.executeApproveSignatureWithErrorHandling(r,o)}let n=(i=t.approvals)==null?void 0:i.pending;if(n==null)return t;let s=[...(a=e==null?void 0:e.additionalSigners)!=null?a:[],this.signer],d=(yield Promise.all(n.map(o=>{let h=s.find(m=>m.locator()===o.signer.locator);if(h==null)throw new E(`Signer ${o.signer} not found in pending approvals`);return h.signMessage(o.message)}))).map(o=>A(S({},o),{signer:this.signer.locator()}));return yield this.executeApproveSignatureWithErrorHandling(r,d)})}approveTransactionInternal(r,e){return l(this,null,function*(){var i,a,o,h,m;let t=yield p(this,c).getTransaction(this.walletLocator,r);if("error"in t)throw new L(JSON.stringify(t));if(yield(o=(a=(i=p(this,f))==null?void 0:i.experimental_callbacks)==null?void 0:a.onTransactionStart)==null?void 0:o.call(a),this.signer.type==="api-key")return t;if((e==null?void 0:e.experimental_approval)!=null){let w=[e.experimental_approval];return yield this.executeApproveTransactionWithErrorHandling(r,w)}let n=(h=t.approvals)==null?void 0:h.pending;if(n==null)return t;let s=[...(m=e==null?void 0:e.additionalSigners)!=null?m:[],this.signer],d=(yield Promise.all(n.map(w=>{let v=s.find(T=>T.locator()===w.signer.locator);if(v==null)throw new E(`Signer ${w.signer} not found in pending approvals`);let y=t.chainType==="solana"&&"transaction"in t.onChain?t.onChain.transaction:w.message;return v.signTransaction(y)}))).map(w=>A(S({},w),{signer:this.signer.locator()}));return yield this.executeApproveTransactionWithErrorHandling(r,d)})}executeApproveTransactionWithErrorHandling(r,e){return l(this,null,function*(){let t=yield p(this,c).approveTransaction(this.walletLocator,r,{approvals:e});if(t.error)throw new J(JSON.stringify(t));return t})}executeApproveSignatureWithErrorHandling(r,e){return l(this,null,function*(){let t=yield p(this,c).approveSignature(this.walletLocator,r,{approvals:e});if(t.error)throw new _(JSON.stringify(t));return t})}waitForSignature(r){return l(this,null,function*(){let e=null;do if(yield new Promise(t=>setTimeout(t,O)),e=yield p(this,c).getSignature(this.walletLocator,r),"error"in e)throw new b(JSON.stringify(e));while(e===null||e.status==="pending");if(e.status==="failed")throw new N("Signature signing failed");if(!e.outputSignature)throw new b("Signature not available");return{signature:e.outputSignature,signatureId:r}})}waitForTransaction(g){return l(this,arguments,function*(r,e=6e4,{backoffMultiplier:t=1.1,maxBackoffMs:n=2e3,initialBackoffMs:s=O}={}){var o;let d=Date.now(),i;do{if(Date.now()-d>e)throw new I("Transaction confirmation timeout");if(i=yield p(this,c).getTransaction(this.walletLocator,r),i.error)throw new L(JSON.stringify(i));yield this.sleep(s),s=Math.min(s*t,n)}while(i.status==="pending");if(i.status==="failed")throw new R(`Transaction sending failed: ${JSON.stringify(i.error)}`);if(i.status==="awaiting-approval")throw new F("Transaction is awaiting approval. Please submit required approvals before waiting for completion.");let a=i.onChain.txId;if(a==null)throw new B("Transaction hash not found on transaction response");return{hash:a,explorerLink:(o=i.onChain.explorerLink)!=null?o:"",transactionId:i.id}})}sleep(r){return l(this,null,function*(){return new Promise(e=>setTimeout(e,r))})}};f=new WeakMap,c=new WeakMap;function H(u){if(typeof u=="string")return u;if("email"in u)return`email:${u.email}`;if("x"in u)return`x:${u.x}`;if("twitter"in u)return`twitter:${u.twitter}`;if("phone"in u)return`phoneNumber:${u.phone}`;if("userId"in u)return`userId:${u.userId}`;throw new Error("Invalid recipient locator")}function M(u,r){return k(u)?`${r}:${u}`:`${r}:${u.toLowerCase()}`}export{G as a};
|
package/dist/chunk-WGFPSEE2.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{f as r}from"./chunk-BW7YYVZE.js";var e=class{constructor(n){this.config=n;this.type="external-wallet";if(n.address==null)throw new Error("Please provide an address for the External Wallet Signer");this.address=n.address,this.onSignStellarTransaction=n.onSignStellarTransaction}locator(){return this.config.locator}signMessage(){return r(this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for stellar external wallet signer"))})}signTransaction(n){return r(this,null,function*(){return this.onSignStellarTransaction==null?yield Promise.reject(new Error("onSignStellarTransaction method is required to sign transactions with a Stellar external wallet")):{signature:yield this.onSignStellarTransaction(n)}})}};export{e as a};
|