@crossmint/wallets-sdk 0.10.15 → 0.10.17
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/README.md +11 -1
- 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-5KA7SYRH.cjs → chunk-243LSD4S.cjs} +1 -1
- package/dist/chunk-34KTPATC.js +1 -0
- package/dist/{chunk-3HZJR6A3.cjs → chunk-3BCOIESI.cjs} +1 -1
- package/dist/{chunk-BCOGNFY7.cjs → chunk-3ILHWXXP.cjs} +1 -1
- package/dist/{chunk-4FM7WA5H.js → chunk-4UVL6FIE.js} +1 -1
- package/dist/chunk-4X475QLF.js +1 -0
- package/dist/{chunk-VWPHXUTU.cjs → chunk-5IJISQS5.cjs} +1 -1
- package/dist/chunk-7WVULM5A.cjs +3 -0
- package/dist/{chunk-IQB4HWD3.cjs → chunk-CQL2S4AX.cjs} +1 -1
- package/dist/chunk-FIEPPMQZ.js +3 -0
- package/dist/{chunk-2I26U7NK.js → chunk-GRF2D4TT.js} +1 -1
- package/dist/chunk-IYV6TMKK.cjs +1 -0
- package/dist/{chunk-5U4PVNPM.js → chunk-JMTREPVI.js} +1 -1
- package/dist/chunk-JUSY5XEE.js +1 -0
- package/dist/{chunk-KQJXLOUT.js → chunk-KPRNFRAS.js} +1 -1
- package/dist/{chunk-U3KINSXQ.js → chunk-KXFOQTZ2.js} +1 -1
- package/dist/chunk-MQP5VZCA.cjs +1 -0
- package/dist/chunk-MWPC3MS2.js +1 -0
- package/dist/chunk-NP4EN5GQ.js +1 -0
- package/dist/chunk-O7EUUTCW.js +1 -0
- package/dist/chunk-OWDKPU47.cjs +1 -0
- package/dist/chunk-RM654WCC.cjs +1 -0
- package/dist/{chunk-NVGWQJBW.cjs → chunk-VGEZ34G3.cjs} +1 -1
- package/dist/chunk-YLOYCYMZ.cjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/sdk.cjs +1 -1
- package/dist/sdk.d.cts +1 -1
- package/dist/sdk.d.ts +1 -1
- package/dist/sdk.js +1 -1
- package/dist/signers/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-evm-signer.cjs +1 -1
- package/dist/signers/non-custodial/ncs-evm-signer.js +1 -1
- package/dist/signers/non-custodial/ncs-iframe-manager.cjs +1 -1
- package/dist/signers/non-custodial/ncs-iframe-manager.js +1 -1
- package/dist/signers/non-custodial/ncs-signer.cjs +1 -1
- package/dist/signers/non-custodial/ncs-signer.js +1 -1
- package/dist/signers/non-custodial/ncs-solana-signer.cjs +1 -1
- package/dist/signers/non-custodial/ncs-solana-signer.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/types.d.cts +14 -2
- package/dist/wallets/types.d.ts +14 -2
- 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.d.cts +23 -6
- package/dist/wallets/wallet.d.ts +23 -6
- package/dist/wallets/wallet.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-7JFXS23U.cjs +0 -1
- package/dist/chunk-7L2MNVVS.cjs +0 -1
- package/dist/chunk-AEZDU2JM.js +0 -1
- package/dist/chunk-BOJW3SWK.cjs +0 -1
- package/dist/chunk-EQRZJV6Q.js +0 -1
- package/dist/chunk-JGHXHURY.js +0 -1
- package/dist/chunk-MLOSILO2.cjs +0 -1
- package/dist/chunk-OEEB24PA.js +0 -1
- package/dist/chunk-SGL7VVQD.js +0 -1
- package/dist/chunk-U4S6GWMK.cjs +0 -1
- package/dist/chunk-VOVPHLO5.cjs +0 -1
- package/dist/chunk-Y5NVCPZ2.js +0 -1
- package/dist/chunk-YNIO2LU5.js +0 -1
package/README.md
CHANGED
|
@@ -17,7 +17,9 @@ import { CrossmintWallets, createCrossmint } from "@crossmint/wallets-sdk";
|
|
|
17
17
|
|
|
18
18
|
const crossmint = createCrossmint({
|
|
19
19
|
apiKey: "<your-client-OR-server-api-key>",
|
|
20
|
-
|
|
20
|
+
experimental_customAuth: {
|
|
21
|
+
jwt: "<your-jwt>", // required for client-side calls, optional for server-side calls
|
|
22
|
+
},
|
|
21
23
|
});
|
|
22
24
|
const crossmintWallets = CrossmintWallets.from(crossmint);
|
|
23
25
|
const wallet = await crossmintWallets.getOrCreateWallet({
|
|
@@ -25,6 +27,14 @@ const wallet = await crossmintWallets.getOrCreateWallet({
|
|
|
25
27
|
signer: {
|
|
26
28
|
type: "email",
|
|
27
29
|
email: "<your-email>",
|
|
30
|
+
onAuthRequired: async (needsAuth, sendEmailWithOtp, verifyOtp, reject) => {
|
|
31
|
+
if (needsAuth) {
|
|
32
|
+
await sendEmailWithOtp();
|
|
33
|
+
// Prompt the user to check their email for the OTP code.
|
|
34
|
+
// Once the user provides the OTP, pass it to verifyOtp(otp).
|
|
35
|
+
// NOTE: If using our React/React Native SDK, this is handled automatically by the provider.
|
|
36
|
+
}
|
|
37
|
+
},
|
|
28
38
|
},
|
|
29
39
|
});
|
|
30
40
|
|
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 _chunkVGEZ34G3cjs = require('../chunk-VGEZ34G3.cjs');require('../chunk-3ILHWXXP.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-XALFCQKD.cjs');exports.ApiClient = _chunkVGEZ34G3cjs.a;
|
package/dist/api/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-KPRNFRAS.js";import"../chunk-4X475QLF.js";import"../chunk-7ENJXL4H.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 _chunkVGEZ34G3cjs = require('../chunk-VGEZ34G3.cjs');require('../chunk-3ILHWXXP.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-ECAM5KTH.cjs');require('../chunk-XALFCQKD.cjs');exports.ApiClient = _chunkVGEZ34G3cjs.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-KPRNFRAS.js";import"../chunk-4X475QLF.js";import"../chunk-7ENJXL4H.js";import"../chunk-KBJA7JDT.js";import"../chunk-BW7YYVZE.js";export{a as ApiClient};
|
|
@@ -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 _chunkOWDKPU47cjs = require('./chunk-OWDKPU47.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _web3js = require('@solana/web3.js');var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);var a=class g extends _chunkOWDKPU47cjs.a{constructor(e){super(e)}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 email signer"))})}signTransaction(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var r;yield this.handleAuthRequired();let c=this.getJwtOrThrow(),d=_bs582.default.decode(e),l=_web3js.VersionedTransaction.deserialize(d).message.serialize(),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:_bs582.default.encode(l),encoding:"base58"}},options:_chunkOWDKPU47cjs.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");return g.verifyPublicKeyFormat(n.publicKey),{signature:n.signature.bytes}})}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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as x}from"./chunk-4X475QLF.js";import{c as P,d as W,i as L,m as N,p as O,q as $,r as E,s as _,t as B,u as F,v as I,w as J}from"./chunk-7ENJXL4H.js";import{a as S,b as A,c as l,d as C,e as b,f as p}from"./chunk-BW7YYVZE.js";import{isValidAddress as G}from"@crossmint/common-sdk-base";var m,o,R=class{constructor(t,r){C(this,m);C(this,o);let{chain:n,address:a,owner:e,signer:g,options:u}=t;b(this,o,r),this.chain=n,this.address=a,this.owner=e,this.signer=g,b(this,m,u)}static getApiClient(t){return t.apiClient}static getOptions(t){return t.options}get apiClient(){return l(this,o)}get options(){return l(this,m)}balances(t,r){return p(this,null,function*(){let n=this.chain==="solana"?"sol":"eth",a=[n,"usdc",...t!=null?t:[]],e=yield l(this,o).getBalance(this.address,{chains:r!=null?r:[this.chain],tokens:a.map(g=>g.toLowerCase())});if("error"in e)throw new Error(`Failed to get balances for wallet: ${JSON.stringify(e.message)}`);return this.transformBalanceResponse(e,n,t)})}transformBalanceResponse(t,r,n){let a=i=>{var f,h,y,T,v;let d=(f=i.chains)==null?void 0:f[this.chain],w="contractAddress"in d?d.contractAddress:void 0;return{symbol:(h=i.symbol)!=null?h:"",name:(y=i.symbol)!=null?y:"",amount:(T=i.amount)!=null?T:"0",contractAddress:w,decimals:i.decimals,rawAmount:(v=i.rawAmount)!=null?v:"0"}},e=t.find(i=>i.symbol===r),g=t.find(i=>i.symbol==="usdc"),u=t.filter(i=>{var d;return i.symbol!==r&&i.symbol!=="usdc"&&(n==null?void 0:n.includes((d=i.symbol)!=null?d:""))}),s=i=>({symbol:i,name:i,amount:"0",contractAddress:void 0,decimals:0,rawAmount:"0"});return{nativeToken:e!=null?a(e):s(r),usdc:g!=null?a(g):s("usdc"),tokens:u.map(a)}}experimental_nfts(t){return p(this,null,function*(){return yield l(this,o).experimental_getNfts(A(S({},t),{chain:this.chain,address:this.address}))})}experimental_transactions(){return p(this,null,function*(){let t=yield l(this,o).getTransactions(this.walletLocator);if("error"in t)throw new Error(`Failed to get transactions: ${JSON.stringify(t.message)}`);return t})}experimental_transaction(t){return p(this,null,function*(){let r=yield l(this,o).getTransaction(this.walletLocator,t);if("error"in r)throw new Error(`Failed to get transaction: ${JSON.stringify(r.error)}`);return r})}experimental_activity(){return p(this,null,function*(){let t=yield this.apiClient.experimental_activity(this.walletLocator,{chain:this.chain});if("error"in t)throw new Error(`Failed to get activity: ${JSON.stringify(t.message)}`);return t})}send(t,r,n,a){return p(this,null,function*(){let e=k(t),g=H(r,this.chain),u={recipient:e,amount:n},s=yield l(this,o).send(this.walletLocator,g,u);if("message"in s)throw new $(`Failed to send token: ${JSON.stringify(s.message)}`);return a!=null&&a.experimental_prepareOnly?{hash:void 0,explorerLink:void 0,transactionId:s.id}:yield this.approveAndWait(s.id)})}approveTransaction(t){return p(this,null,function*(){return yield this.approveAndWait(t.transactionId,t.options)})}addDelegatedSigner(t){return p(this,null,function*(){var n,a;let r=yield l(this,o).registerSigner(this.walletLocator,{signer:t.signer,chain:this.chain==="solana"?void 0:this.chain});if("error"in r)throw new Error(`Failed to register signer: ${JSON.stringify(r.message)}`);if("transaction"in r){let e=r.transaction.id;yield this.approveAndWait(e)}else{let e=(n=r.chains)==null?void 0:n[this.chain];if((e==null?void 0:e.status)==="awaiting-approval"){let g=((a=e.approvals)==null?void 0:a.pending)||[];yield this.approveSignature(g,e.id),yield this.waitForSignature(e.id);return}if((e==null?void 0:e.status)==="pending"){yield this.waitForSignature(e.id);return}}})}delegatedSigners(){return p(this,null,function*(){var r,n,a;let t=yield l(this,o).getWallet(this.walletLocator);if("error"in t)throw new W(JSON.stringify(t));if(t.type!=="smart"||t.chainType!=="evm"&&t.chainType!=="solana")throw new P(`Wallet type ${t.type} not supported`);return(a=(n=(r=t==null?void 0:t.config)==null?void 0:r.delegatedSigners)==null?void 0:n.map(e=>{let g=e.locator.indexOf(":");return{signer:`external-wallet:${g>=0?e.locator.slice(g+1):e.locator}`}}))!=null?a:[]})}get walletLocator(){return l(this,o).isServerSide?this.address:`me:${this.chain==="solana"?"solana":"evm"}:smart`}get isSolanaWallet(){return this.chain==="solana"}approveAndWait(t,r){return p(this,null,function*(){return yield this.approveTransactionInternal(t,r),yield this.sleep(1e3),yield this.waitForTransaction(t)})}approveTransactionInternal(t,r){return p(this,null,function*(){var s,i,d,w,f;let n=yield l(this,o).getTransaction(this.walletLocator,t);if("error"in n)throw new E(JSON.stringify(n));if(yield(d=(i=(s=l(this,m))==null?void 0:s.experimental_callbacks)==null?void 0:i.onTransactionStart)==null?void 0:d.call(i),this.signer.type==="api-key")return n;if((r==null?void 0:r.experimental_approval)!=null){let h=[r.experimental_approval];return yield this.executeApprovalWithErrorHandling(t,h)}let a=(w=n.approvals)==null?void 0:w.pending;if(a==null)return n;let e=[...(f=r==null?void 0:r.additionalSigners)!=null?f:[],this.signer],u=(yield Promise.all(a.map(h=>{let y=e.find(v=>v.locator()===h.signer.locator);if(y==null)throw new L(`Signer ${h.signer} not found in pending approvals`);let T=n.chainType==="solana"&&"transaction"in n.onChain?n.onChain.transaction:h.message;return y.signTransaction(T)}))).map(h=>A(S({},h),{signer:this.signer.locator()}));return yield this.executeApprovalWithErrorHandling(t,u)})}executeApprovalWithErrorHandling(t,r){return p(this,null,function*(){let n=yield l(this,o).approveTransaction(this.walletLocator,t,{approvals:r});if(n.error)throw new J(JSON.stringify(n));return n})}approveSignature(t,r){return p(this,null,function*(){if(this.isSolanaWallet)throw new Error("Approving signatures is only supported for EVM smart wallets");let n=t.find(e=>e.signer.locator===this.signer.locator());if(!n)throw new L(`Signer ${this.signer.locator()} not found in pending approvals`);let a=yield this.signer.signMessage(n.message);return yield l(this,o).approveSignature(this.walletLocator,r,{approvals:[S({signer:this.signer.locator()},a)]}),a})}waitForSignature(t){return p(this,null,function*(){let r=null;do if(yield new Promise(n=>setTimeout(n,x)),r=yield l(this,o).getSignature(this.walletLocator,t),"error"in r)throw new O(JSON.stringify(r));while(r===null||r.status==="pending");if(r.status==="failed")throw new N("Signature signing failed");if(!r.outputSignature)throw new O("Signature not available");return r.outputSignature})}waitForTransaction(g){return p(this,arguments,function*(t,r=6e4,{backoffMultiplier:n=1.1,maxBackoffMs:a=2e3,initialBackoffMs:e=x}={}){var d;let u=Date.now(),s;do{if(Date.now()-u>r)throw new _("Transaction confirmation timeout");if(s=yield l(this,o).getTransaction(this.walletLocator,t),s.error)throw new E(JSON.stringify(s));yield this.sleep(e),e=Math.min(e*n,a)}while(s.status==="pending");if(s.status==="failed")throw new B(`Transaction sending failed: ${JSON.stringify(s.error)}`);if(s.status==="awaiting-approval")throw new F("Transaction is awaiting approval. Please submit required approvals before waiting for completion.");let i=s.onChain.txId;if(i==null)throw new I("Transaction hash not found on transaction response");return{hash:i,explorerLink:(d=s.onChain.explorerLink)!=null?d:"",transactionId:s.id}})}sleep(t){return p(this,null,function*(){return new Promise(r=>setTimeout(r,t))})}};m=new WeakMap,o=new WeakMap;function k(c){if(typeof c=="string")return c;if("email"in c)return`email:${c.email}`;if("x"in c)return`x:${c.x}`;if("twitter"in c)return`twitter:${c.twitter}`;if("phone"in c)return`phoneNumber:${c.phone}`;if("userId"in c)return`userId:${c.userId}`;throw new Error("Invalid recipient locator")}function H(c,t){return G(c)?`${t}:${c}`:`${t}:${c.toLowerCase()}`}export{R as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkOWDKPU47cjs = require('./chunk-OWDKPU47.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _ox = require('ox');var _viem = require('viem');var g=class c extends _chunkOWDKPU47cjs.a{constructor(n){super(n)}locator(){return this.config.locator}signMessage(n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let r=_viem.isHex.call(void 0, n)?n:_viem.toHex.call(void 0, n),i=_ox.PersonalMessage.getSignPayload(r);return yield this.sign(i)})}signTransaction(n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.sign(n)})}sign(n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var s;yield this.handleAuthRequired();let r=this.getJwtOrThrow(),i=n.replace("0x",""),t=yield(s=this.config.clientTEEConnection)==null?void 0:s.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:r,apiKey:this.config.crossmint.apiKey},data:{keyType:"secp256k1",bytes:i,encoding:"hex"}},options:_chunkOWDKPU47cjs.b});if((t==null?void 0:t.status)==="error")throw new Error(t.error);if((t==null?void 0:t.signature)==null)throw new Error("Failed to sign transaction");return c.verifyPublicKeyFormat(t.publicKey),{signature:t.signature.bytes}})}static verifyPublicKeyFormat(n){if(n==null)throw new Error("No public key found");if(n.encoding!=="hex"||n.keyType!=="secp256k1"||n.bytes==null)throw new Error("Not supported. Expected public key to be in hex encoding and secp256k1 key type. Got: "+JSON.stringify(n))}};exports.a = g;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var s="@crossmint/wallets-sdk",t="0.10.
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var s="@crossmint/wallets-sdk",t="0.10.17";var p="WALLETS_SDK",c= exports.b =t,r= exports.c =s,d= exports.d =500;exports.a = p; exports.b = c; exports.c = r; exports.d = d;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o,b as a}from"./chunk-
|
|
1
|
+
import{a as o,b as a}from"./chunk-NP4EN5GQ.js";import{f as e}from"./chunk-BW7YYVZE.js";import{PersonalMessage as p}from"ox";import{isHex as y,toHex as l}from"viem";var g=class c extends o{constructor(n){super(n)}locator(){return this.config.locator}signMessage(n){return e(this,null,function*(){let r=y(n)?n:l(n),i=p.getSignPayload(r);return yield this.sign(i)})}signTransaction(n){return e(this,null,function*(){return yield this.sign(n)})}sign(n){return e(this,null,function*(){var s;yield this.handleAuthRequired();let r=this.getJwtOrThrow(),i=n.replace("0x",""),t=yield(s=this.config.clientTEEConnection)==null?void 0:s.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:r,apiKey:this.config.crossmint.apiKey},data:{keyType:"secp256k1",bytes:i,encoding:"hex"}},options:a});if((t==null?void 0:t.status)==="error")throw new Error(t.error);if((t==null?void 0:t.signature)==null)throw new Error("Failed to sign transaction");return c.verifyPublicKeyFormat(t.publicKey),{signature:t.signature.bytes}})}static verifyPublicKeyFormat(n){if(n==null)throw new Error("No public key found");if(n.encoding!=="hex"||n.keyType!=="secp256k1"||n.bytes==null)throw new Error("Not supported. Expected public key to be in hex encoding and secp256k1 key type. Got: "+JSON.stringify(n))}};export{g as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var s="@crossmint/wallets-sdk",t="0.10.17";var c="WALLETS_SDK",r=t,d=s,a=500;export{c as a,r as b,d as c,a as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk7WVULM5Acjs = require('./chunk-7WVULM5A.cjs');var _chunkVGEZ34G3cjs = require('./chunk-VGEZ34G3.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var i=class o{constructor(t){let r=new (0, _chunkVGEZ34G3cjs.a)(t);this.walletFactory=new (0, _chunk7WVULM5Acjs.a)(r)}static from(t){return new o(t)}getOrCreateWallet(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.walletFactory.getOrCreateWallet(t)})}getWallet(t,r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.walletFactory.getWallet(t,r)})}createWallet(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.walletFactory.createWallet(t)})}};exports.a = _commonsdkbase.createCrossmint; exports.b = i;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkRM654WCCcjs = require('./chunk-RM654WCC.cjs');var _chunkCQL2S4AXcjs = require('./chunk-CQL2S4AX.cjs');var _chunkRFK6N7LCcjs = require('./chunk-RFK6N7LC.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _ox = require('ox');var S=class{constructor(e){this.apiClient=e}getOrCreateWallet(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(this.apiClient.isServerSide)throw new (0, _chunkCT2UGJELcjs.f)(`getOrCreateWallet can only be called from client-side code.
|
|
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:${e.chain==="solana"?"solana":"evm"}:smart`);return i!=null&&!("error"in i)?this.createWalletInstance(i,e):this.createWallet(e)})}getWallet(e,i){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(!this.apiClient.isServerSide)throw new (0, _chunkCT2UGJELcjs.f)("getWallet is not supported on client side, use getOrCreateWallet instead");let n=yield this.apiClient.getWallet(e);if("error"in n)throw new (0, _chunkCT2UGJELcjs.d)(JSON.stringify(n));return this.createWalletInstance(n,i)})}createWallet(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var t,r,o,l;yield(o=(r=(t=e.options)==null?void 0:t.experimental_callbacks)==null?void 0:r.onWalletCreationStart)==null?void 0:o.call(r),this.mutateSignerFromCustomAuth(e,!0);let i=e.signer.type==="passkey"?yield this.createPasskeyAdminSigner(e.signer):e.signer,n=yield this.apiClient.createWallet({type:"smart",chainType:e.chain==="solana"?"solana":"evm",config:{adminSigner:i},owner:(l=e.owner)!=null?l:void 0});if("error"in n)throw new (0, _chunkCT2UGJELcjs.f)(JSON.stringify(n));return this.createWalletInstance(n,e)})}createWalletInstance(e,i){this.validateExistingWalletConfig(e,i);let n=this.toInternalSignerConfig(e,i.signer,i.options);return new (0, _chunkRM654WCCcjs.a)({chain:i.chain,address:e.address,owner:e.owner,signer:_chunkCQL2S4AXcjs.a.call(void 0, i.chain,n),options:i.options},this.apiClient)}toInternalSignerConfig(e,i,n){var t,r,o,l,C,g;if(!(e.chainType==="evm"||e.chainType==="solana"))throw new (0, _chunkCT2UGJELcjs.f)(`Wallet type ${e.chainType} is not supported`);if(i==null&&((t=e.config)==null?void 0:t.adminSigner)==null)throw new (0, _chunkCT2UGJELcjs.f)("Signer is required to create a wallet");switch(i.type){case"api-key":{if(((r=e.config)==null?void 0:r.adminSigner.type)!=="api-key")throw new (0, _chunkCT2UGJELcjs.f)("API key signer does not match the wallet's signer type");return{type:"api-key",address:e.config.adminSigner.address,locator:e.config.adminSigner.locator}}case"external-wallet":if(((o=e.config)==null?void 0:o.adminSigner.type)!=="external-wallet")throw new (0, _chunkCT2UGJELcjs.f)("External wallet signer does not match the wallet's signer type");return _chunkXALFCQKDcjs.a.call(void 0, _chunkXALFCQKDcjs.a.call(void 0, {},e.config.adminSigner),i);case"passkey":if(((l=e.config)==null?void 0:l.adminSigner.type)!=="passkey")throw new (0, _chunkCT2UGJELcjs.f)("Passkey signer does not match the wallet's signer type");return{type:"passkey",id:e.config.adminSigner.id,name:e.config.adminSigner.name,locator:e.config.adminSigner.locator,onCreatePasskey:i.onCreatePasskey,onSignWithPasskey:i.onSignWithPasskey};case"email":{if(((C=e.config)==null?void 0:C.adminSigner.type)!=="email")throw new (0, _chunkCT2UGJELcjs.f)("Email signer does not match the wallet's signer type");let{locator:c,email:h}=e.config.adminSigner;return{type:"email",email:h,locator:c,crossmint:this.apiClient.crossmint,onAuthRequired:i.onAuthRequired,clientTEEConnection:n==null?void 0:n.clientTEEConnection}}case"phone":{if(((g=e.config)==null?void 0:g.adminSigner.type)!=="phone")throw new (0, _chunkCT2UGJELcjs.f)("Phone signer does not match the wallet's signer type");let{locator:c,phone:h}=e.config.adminSigner;return{type:"phone",phone:h,locator:c,crossmint:this.apiClient.crossmint,onAuthRequired:i.onAuthRequired,clientTEEConnection:n==null?void 0:n.clientTEEConnection}}default:throw new Error("Invalid signer type")}}createPasskeyAdminSigner(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var t;if(e.type!=="passkey")throw new Error("Signer is not a passkey");let i=(t=e.name)!=null?t:`Crossmint Wallet ${Date.now()}`,n=e.onCreatePasskey?yield e.onCreatePasskey(i):yield _ox.WebAuthnP256.createCredential({name:i});return{type:"passkey",id:n.id,name:i,publicKey:{x:n.publicKey.x.toString(),y:n.publicKey.y.toString()}}})}mutateSignerFromCustomAuth(e,i=!1){var t,r;let{experimental_customAuth:n}=this.apiClient.crossmint;e.signer.type==="email"&&(n==null?void 0:n.email)!=null&&(e.signer.email=(t=e.signer.email)!=null?t:n.email),e.signer.type==="phone"&&(n==null?void 0:n.phone)!=null&&(e.signer.phone=(r=e.signer.phone)!=null?r:n.phone),e.signer.type==="external-wallet"&&(n==null?void 0:n.externalWalletSigner)!=null&&(e.signer=i?{type:"external-wallet",address:n.externalWalletSigner.address}:n.externalWalletSigner)}validateExistingWalletConfig(e,i){var r;if(this.mutateSignerFromCustomAuth(i),i.owner!=null&&e.owner!=null&&i.owner!==e.owner)throw new (0, _chunkCT2UGJELcjs.f)("Wallet owner does not match existing wallet's linked user");if(i.chain==="solana"&&e.chainType!=="solana"||i.chain!=="solana"&&e.chainType==="solana")throw new (0, _chunkCT2UGJELcjs.f)(`Wallet chain does not match existing wallet's chain. You must use chain: ${e.chainType}.`);if(e.type!=="smart")return;let n=i.signer,t=(r=e==null?void 0:e.config)==null?void 0:r.adminSigner;if(n!=null&&t!=null){if(n.type!==t.type)throw new (0, _chunkCT2UGJELcjs.f)("The wallet signer type provided in the wallet config does not match the existing wallet's adminSigner type");_chunkRFK6N7LCcjs.a.call(void 0, n,t)}}};exports.a = S;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk3BCOIESIcjs = require('./chunk-3BCOIESI.cjs');var _chunk243LSD4Scjs = require('./chunk-243LSD4S.cjs');var _chunkYWPTI2QOcjs = require('./chunk-YWPTI2QO.cjs');var _chunk4KXOWU5Ecjs = require('./chunk-4KXOWU5E.cjs');var _chunkYTAW674Lcjs = require('./chunk-YTAW674L.cjs');var _chunkYZ4HRYSLcjs = require('./chunk-YZ4HRYSL.cjs');var _chunkBULGM35Wcjs = require('./chunk-BULGM35W.cjs');function u(r,e){switch(e.type){case"email":case"phone":return r==="solana"?new (0, _chunk243LSD4Scjs.a)(e):new (0, _chunk3BCOIESIcjs.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, _chunkYTAW674Lcjs.a)(e):new (0, _chunkBULGM35Wcjs.a)(e);case"passkey":return new (0, _chunkYWPTI2QOcjs.a)(e)}}exports.a = u;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as p}from"./chunk-34KTPATC.js";import{a as d}from"./chunk-JMTREPVI.js";import{a as f}from"./chunk-IJMFCZIY.js";import{d as y,f as a}from"./chunk-7ENJXL4H.js";import{a as m,f as s}from"./chunk-BW7YYVZE.js";import{WebAuthnP256 as u}from"ox";var S=class{constructor(e){this.apiClient=e}getOrCreateWallet(e){return s(this,null,function*(){if(this.apiClient.isServerSide)throw new a(`getOrCreateWallet can only be called from client-side code.
|
|
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:${e.chain==="solana"?"solana":"evm"}:smart`);return i!=null&&!("error"in i)?this.createWalletInstance(i,e):this.createWallet(e)})}getWallet(e,i){return s(this,null,function*(){if(!this.apiClient.isServerSide)throw new a("getWallet is not supported on client side, use getOrCreateWallet instead");let n=yield this.apiClient.getWallet(e);if("error"in n)throw new y(JSON.stringify(n));return this.createWalletInstance(n,i)})}createWallet(e){return s(this,null,function*(){var t,r,o,l;yield(o=(r=(t=e.options)==null?void 0:t.experimental_callbacks)==null?void 0:r.onWalletCreationStart)==null?void 0:o.call(r),this.mutateSignerFromCustomAuth(e,!0);let i=e.signer.type==="passkey"?yield this.createPasskeyAdminSigner(e.signer):e.signer,n=yield this.apiClient.createWallet({type:"smart",chainType:e.chain==="solana"?"solana":"evm",config:{adminSigner:i},owner:(l=e.owner)!=null?l:void 0});if("error"in n)throw new a(JSON.stringify(n));return this.createWalletInstance(n,e)})}createWalletInstance(e,i){this.validateExistingWalletConfig(e,i);let n=this.toInternalSignerConfig(e,i.signer,i.options);return new p({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,r,o,l,C,g;if(!(e.chainType==="evm"||e.chainType==="solana"))throw new a(`Wallet type ${e.chainType} is not supported`);if(i==null&&((t=e.config)==null?void 0:t.adminSigner)==null)throw new a("Signer is required to create a wallet");switch(i.type){case"api-key":{if(((r=e.config)==null?void 0:r.adminSigner.type)!=="api-key")throw new a("API key signer does not match the wallet's signer type");return{type:"api-key",address:e.config.adminSigner.address,locator:e.config.adminSigner.locator}}case"external-wallet":if(((o=e.config)==null?void 0:o.adminSigner.type)!=="external-wallet")throw new a("External wallet signer does not match the wallet's signer type");return m(m({},e.config.adminSigner),i);case"passkey":if(((l=e.config)==null?void 0:l.adminSigner.type)!=="passkey")throw new a("Passkey signer does not match the wallet's signer type");return{type:"passkey",id:e.config.adminSigner.id,name:e.config.adminSigner.name,locator:e.config.adminSigner.locator,onCreatePasskey:i.onCreatePasskey,onSignWithPasskey:i.onSignWithPasskey};case"email":{if(((C=e.config)==null?void 0:C.adminSigner.type)!=="email")throw new a("Email signer does not match the wallet's signer type");let{locator:c,email:h}=e.config.adminSigner;return{type:"email",email:h,locator:c,crossmint:this.apiClient.crossmint,onAuthRequired:i.onAuthRequired,clientTEEConnection:n==null?void 0:n.clientTEEConnection}}case"phone":{if(((g=e.config)==null?void 0:g.adminSigner.type)!=="phone")throw new a("Phone signer does not match the wallet's signer type");let{locator:c,phone:h}=e.config.adminSigner;return{type:"phone",phone:h,locator:c,crossmint:this.apiClient.crossmint,onAuthRequired:i.onAuthRequired,clientTEEConnection:n==null?void 0:n.clientTEEConnection}}default:throw new Error("Invalid signer type")}}createPasskeyAdminSigner(e){return s(this,null,function*(){var t;if(e.type!=="passkey")throw new Error("Signer is not a passkey");let i=(t=e.name)!=null?t:`Crossmint Wallet ${Date.now()}`,n=e.onCreatePasskey?yield e.onCreatePasskey(i):yield u.createCredential({name:i});return{type:"passkey",id:n.id,name:i,publicKey:{x:n.publicKey.x.toString(),y:n.publicKey.y.toString()}}})}mutateSignerFromCustomAuth(e,i=!1){var t,r;let{experimental_customAuth:n}=this.apiClient.crossmint;e.signer.type==="email"&&(n==null?void 0:n.email)!=null&&(e.signer.email=(t=e.signer.email)!=null?t:n.email),e.signer.type==="phone"&&(n==null?void 0:n.phone)!=null&&(e.signer.phone=(r=e.signer.phone)!=null?r:n.phone),e.signer.type==="external-wallet"&&(n==null?void 0:n.externalWalletSigner)!=null&&(e.signer=i?{type:"external-wallet",address:n.externalWalletSigner.address}:n.externalWalletSigner)}validateExistingWalletConfig(e,i){var r;if(this.mutateSignerFromCustomAuth(i),i.owner!=null&&e.owner!=null&&i.owner!==e.owner)throw new a("Wallet owner does not match existing wallet's linked user");if(i.chain==="solana"&&e.chainType!=="solana"||i.chain!=="solana"&&e.chainType==="solana")throw new a(`Wallet chain does not match existing wallet's chain. You must use chain: ${e.chainType}.`);if(e.type!=="smart")return;let n=i.signer,t=(r=e==null?void 0:e.config)==null?void 0:r.adminSigner;if(n!=null&&t!=null){if(n.type!==t.type)throw new a("The wallet signer type provided in the wallet config does not match the existing wallet's adminSigner type");f(n,t)}}};export{S as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as l}from"./chunk-
|
|
1
|
+
import{a as l}from"./chunk-FIEPPMQZ.js";import{a}from"./chunk-KPRNFRAS.js";import{f as e}from"./chunk-BW7YYVZE.js";import{createCrossmint as p}from"@crossmint/common-sdk-base";var i=class o{constructor(t){let r=new a(t);this.walletFactory=new l(r)}static from(t){return new o(t)}getOrCreateWallet(t){return e(this,null,function*(){return yield this.walletFactory.getOrCreateWallet(t)})}getWallet(t,r){return e(this,null,function*(){return yield this.walletFactory.getWallet(t,r)})}createWallet(t){return e(this,null,function*(){return yield this.walletFactory.createWallet(t)})}};export{p as a,i as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkRM654WCCcjs = require('./chunk-RM654WCC.cjs');var _chunkYTAW674Lcjs = require('./chunk-YTAW674L.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);var _commonsdkbase = require('@crossmint/common-sdk-base');var d=class u extends _chunkRM654WCCcjs.a{constructor(n){super({chain:n.chain,address:n.address,owner:n.owner,signer:n.signer,options:_chunkRM654WCCcjs.a.getOptions(n)},_chunkRM654WCCcjs.a.getApiClient(n))}static from(n){if(!_commonsdkbase.isValidSolanaAddress.call(void 0, n.address))throw new Error("Wallet is not a Solana wallet");return new u(n)}sendTransaction(n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var e,r;let a=yield this.createTransaction(n);if((e=n.options)!=null&&e.experimental_prepareOnly)return{hash:void 0,explorerLink:void 0,transactionId:a.id};let i={additionalSigners:(r=n.additionalSigners)==null?void 0:r.map(o=>new (0, _chunkYTAW674Lcjs.a)({type:"external-wallet",address:o.publicKey.toString(),locator:`external-wallet:${o.publicKey.toString()}`,onSignTransaction:p=>(p.sign([o]),Promise.resolve(p))}))};return yield this.approveAndWait(a.id,i)})}createTransaction(S){return _chunkXALFCQKDcjs.f.call(void 0, this,arguments,function*({transaction:n,options:a}){var r;let i=(r=a==null?void 0:a.experimental_signer)!=null?r:this.signer.locator(),e=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:_bs582.default.encode(n.serialize()),signer:i}});if("error"in e)throw new (0, _chunkCT2UGJELcjs.q)(JSON.stringify(e));return e})}};exports.a = d;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-4UVL6FIE.js";import{a as n}from"./chunk-KXFOQTZ2.js";import{a as o}from"./chunk-UBOWSXW3.js";import{a as s}from"./chunk-IGBQEAD5.js";import{a as t}from"./chunk-SCS4UDW7.js";import{a as l}from"./chunk-LW6JSI4J.js";import{a as i}from"./chunk-5S6YZJHE.js";function x(r,e){switch(e.type){case"email":case"phone":return r==="solana"?new n(e):new a(e);case"api-key":return r==="solana"?new s(e):new l(e);case"external-wallet":return r==="solana"?new t(e):new i(e);case"passkey":return new o(e)}}export{x as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{f as t}from"./chunk-BW7YYVZE.js";import{IFrameWindow as a,SignersWindowTransport as s}from"@crossmint/client-sdk-window";import{environmentUrlConfig as m,signerInboundEvents as d,signerOutboundEvents as h}from"@crossmint/client-signers";var i=class{constructor(e){this.config=e;this.handshakeParent=null}initialize(){return t(this,null,function*(){if(this.handshakeParent)return this.handshakeParent;let e=new URL(m[this.config.environment]);e.searchParams.set("targetOrigin",window.location.origin);let n=yield this.createInvisibleIFrame(e.toString());return this.handshakeParent=yield a.init(n,{targetOrigin:e.origin,incomingEvents:h,outgoingEvents:d},s),yield this.handshakeParent.handshakeWithChild(),this.handshakeParent})}createInvisibleIFrame(e){return t(this,null,function*(){let n=document.createElement("iframe");return n.src=e,Object.assign(n.style,{position:"absolute",opacity:"0",pointerEvents:"none",width:"0",height:"0",border:"none",top:"-9999px",left:"-9999px"}),new Promise((r,o)=>{n.onload=()=>r(n),n.onerror=()=>o(new Error("Failed to load iframe content")),document.body.appendChild(n)})})}};export{i as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as n,c as i}from"./chunk-
|
|
1
|
+
import{b as n,c as i}from"./chunk-4X475QLF.js";import{a as o}from"./chunk-7ENJXL4H.js";import{f as r}from"./chunk-BW7YYVZE.js";import{APIKeyUsageOrigin as c,CrossmintApiClient as h}from"@crossmint/common-sdk-base";var p=class extends h{constructor(e){super(e,{internalConfig:{sdkMetadata:{name:i,version:n}}});this.apiPrefix="api/2025-06-09/wallets";this.legacyApiPrefix="api/2022-06-09/wallets"}createWallet(e){return r(this,null,function*(){let s=this.isServerSide?`${this.apiPrefix}`:`${this.apiPrefix}/me`;return(yield this.post(s,{body:JSON.stringify(e),headers:this.headers})).json()})}getWallet(e){return r(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}`,{headers:this.headers})).json()})}createTransaction(e,s){return r(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveTransaction(e,s,t){return r(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions/${s}/approvals`,{body:JSON.stringify(t),headers:this.headers})).json()})}getTransaction(e,s){return r(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions/${s}`,{headers:this.headers})).json()})}createSignature(e,s){return r(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signatures`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveSignature(e,s,t){return r(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signatures/${s}/approvals`,{body:JSON.stringify(t),headers:this.headers})).json()})}getSignature(e,s){return r(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/signatures/${s}`,{headers:this.headers})).json()})}getTransactions(e){return r(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions`,{headers:this.headers})).json()})}experimental_getNfts(e){return r(this,null,function*(){let s=new URLSearchParams;s.append("page",e.page.toString()),s.append("perPage",e.perPage.toString());let t=`${e.chain}:${e.address}`;return(yield this.get(`${this.apiPrefix}/${t}/nfts?${s.toString()}`,{headers:this.headers})).json()})}experimental_activity(e,s){return r(this,null,function*(){let t=e;this.isServerSide||(t=`me:${s.chain==="solana"?"solana-smart-wallet":"evm-smart-wallet"}`);let a=new URLSearchParams;return a.append("chain",s.chain.toString()),(yield this.get(`${this.legacyApiPrefix}/${t}/activity?${a.toString()}`,{headers:this.headers})).json()})}getBalance(e,s){return r(this,null,function*(){let t=new URLSearchParams;return t.append("tokens",s.tokens.join(",")),t.append("chains",s.chains.join(",")),(yield this.get(`${this.apiPrefix}/${e}/balances?${t.toString()}`,{headers:this.headers})).json()})}registerSigner(e,s){return r(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signers`,{body:JSON.stringify(s),headers:this.headers})).json()})}getSigner(e,s){return r(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/signers/${s}`,{headers:this.headers})).json()})}send(e,s,t){return r(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/tokens/${s}/transfers`,{body:JSON.stringify(t),headers:this.headers})).json()})}get isServerSide(){return this.parsedAPIKey.usageOrigin===c.SERVER}get environment(){if(!this.parsedAPIKey.isValid)throw new o("Invalid API key");return this.parsedAPIKey.environment}get headers(){return{"Content-Type":"application/json"}}};export{p as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as i,b as o}from"./chunk-
|
|
1
|
+
import{a as i,b as o}from"./chunk-NP4EN5GQ.js";import{f as t}from"./chunk-BW7YYVZE.js";import{VersionedTransaction as y}from"@solana/web3.js";import s from"bs58";var a=class g extends i{constructor(e){super(e)}locator(){return this.config.locator}signMessage(){return t(this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for email signer"))})}signTransaction(e){return t(this,null,function*(){var r;yield this.handleAuthRequired();let c=this.getJwtOrThrow(),d=s.decode(e),l=y.deserialize(d).message.serialize(),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:s.encode(l),encoding:"base58"}},options:o});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");return g.verifyPublicKeyFormat(n.publicKey),{signature:n.signature.bytes}})}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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _clientsdkwindow = require('@crossmint/client-sdk-window');var _clientsigners = require('@crossmint/client-signers');var i=class{constructor(e){this.config=e;this.handshakeParent=null}initialize(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(this.handshakeParent)return this.handshakeParent;let e=new URL(_clientsigners.environmentUrlConfig[this.config.environment]);e.searchParams.set("targetOrigin",window.location.origin);let n=yield this.createInvisibleIFrame(e.toString());return this.handshakeParent=yield _clientsdkwindow.IFrameWindow.init(n,{targetOrigin:e.origin,incomingEvents:_clientsigners.signerOutboundEvents,outgoingEvents:_clientsigners.signerInboundEvents},_clientsdkwindow.SignersWindowTransport),yield this.handshakeParent.handshakeWithChild(),this.handshakeParent})}createInvisibleIFrame(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let n=document.createElement("iframe");return n.src=e,Object.assign(n.style,{position:"absolute",opacity:"0",pointerEvents:"none",width:"0",height:"0",border:"none",top:"-9999px",left:"-9999px"}),new Promise((r,o)=>{n.onload=()=>r(n),n.onerror=()=>o(new Error("Failed to load iframe content")),document.body.appendChild(n)})})}};exports.a = i;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as t}from"./chunk-34KTPATC.js";import{a as l}from"./chunk-SCS4UDW7.js";import{q as c}from"./chunk-7ENJXL4H.js";import{f as s}from"./chunk-BW7YYVZE.js";import m from"bs58";import{isValidSolanaAddress as T}from"@crossmint/common-sdk-base";var d=class u extends t{constructor(n){super({chain:n.chain,address:n.address,owner:n.owner,signer:n.signer,options:t.getOptions(n)},t.getApiClient(n))}static from(n){if(!T(n.address))throw new Error("Wallet is not a Solana wallet");return new u(n)}sendTransaction(n){return s(this,null,function*(){var e,r;let a=yield this.createTransaction(n);if((e=n.options)!=null&&e.experimental_prepareOnly)return{hash:void 0,explorerLink:void 0,transactionId:a.id};let i={additionalSigners:(r=n.additionalSigners)==null?void 0:r.map(o=>new l({type:"external-wallet",address:o.publicKey.toString(),locator:`external-wallet:${o.publicKey.toString()}`,onSignTransaction:p=>(p.sign([o]),Promise.resolve(p))}))};return yield this.approveAndWait(a.id,i)})}createTransaction(S){return s(this,arguments,function*({transaction:n,options:a}){var r;let i=(r=a==null?void 0:a.experimental_signer)!=null?r:this.signer.locator(),e=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:m.encode(n.serialize()),signer:i}});if("error"in e)throw new c(JSON.stringify(e));return e})}};export{d as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as l}from"./chunk-JUSY5XEE.js";import{a as u}from"./chunk-M4ELAV7U.js";import{f as c}from"./chunk-BW7YYVZE.js";import{validateAPIKey as m}from"@crossmint/common-sdk-base";var d=class{constructor(t){this.config=t;this._needsAuth=!0;this._authPromise=null;this.initialize(),this.type=this.config.type}initialize(){return c(this,null,function*(){if(this.config.clientTEEConnection==null){let t=m(this.config.crossmint.apiKey);if(!t.isValid)throw new Error("Invalid API key");let r=new l({environment:t.environment});this.config.clientTEEConnection=yield r.initialize()}})}handleAuthRequired(){return c(this,null,function*(){var o,s,a;if(this.config.clientTEEConnection==null)throw this.config.onAuthRequired==null?new Error(`${this.type} signer requires the onAuthRequired callback to handle OTP verification. This callback manages the authentication flow (sending OTP and verifying user input). If using our React/React Native SDK, this is handled automatically by the provider. For other environments, implement: onAuthRequired: (needsAuth, sendOtp, verifyOtp, reject) => { /* your UI logic */ }`):new Error("Handshake parent not initialized");let t=yield(a=this.config.clientTEEConnection)==null?void 0:a.sendAction({event:"request:get-status",responseEvent:"response:get-status",data:{authData:{jwt:(s=(o=this.config.crossmint.experimental_customAuth)==null?void 0:o.jwt)!=null?s:"",apiKey:this.config.crossmint.apiKey}},options:h});if((t==null?void 0:t.status)!=="success")throw new Error(t==null?void 0:t.error);if(t.signerStatus==="ready"){this._needsAuth=!1;return}let{promise:r,resolve:i,reject:n}=this.createAuthPromise();if(this._authPromise={promise:r,resolve:i,reject:n},this.config.onAuthRequired)try{yield this.config.onAuthRequired(this._needsAuth,()=>this.sendMessageWithOtp(),e=>this.verifyOtp(e),()=>n(new u))}catch(e){n(e)}try{yield r}catch(e){throw e}})}getJwtOrThrow(){var r;let t=(r=this.config.crossmint.experimental_customAuth)==null?void 0:r.jwt;if(t==null)throw new Error("JWT is required");return t}createAuthPromise(){let t,r;return{promise:new Promise((n,o)=>{t=n,r=o}),resolve:t,reject:r}}sendMessageWithOtp(){return c(this,null,function*(){var n,o,s;if(this.config.clientTEEConnection==null)throw new Error("Handshake parent not initialized");let t=this.config.clientTEEConnection,r=this.getAuthId(),i=yield t.sendAction({event:"request:start-onboarding",responseEvent:"response:start-onboarding",data:{authData:{jwt:(o=(n=this.config.crossmint.experimental_customAuth)==null?void 0:n.jwt)!=null?o:"",apiKey:this.config.crossmint.apiKey},data:{authId:r}},options:h});if((i==null?void 0:i.status)==="success"&&i.signerStatus==="ready"){this._needsAuth=!1;return}(i==null?void 0:i.status)==="error"&&(console.error("[sendMessageWithOtp] Failed to send OTP:",i),(s=this._authPromise)==null||s.reject(new Error(i.error||"Failed to initiate OTP process.")))})}getAuthId(){return this.config.type==="email"?`email:${this.config.email}`:`phone:${this.config.phone}`}verifyOtp(t){return c(this,null,function*(){var i,n,o,s,a;if(this.config.clientTEEConnection==null)throw new Error("Handshake parent not initialized");let r=this.config.clientTEEConnection;try{let e=yield r.sendAction({event:"request:complete-onboarding",responseEvent:"response:complete-onboarding",data:{authData:{jwt:(n=(i=this.config.crossmint.experimental_customAuth)==null?void 0:i.jwt)!=null?n:"",apiKey:this.config.crossmint.apiKey},data:{onboardingAuthentication:{encryptedOtp:t}}},options:h});if((e==null?void 0:e.status)==="success"){this._needsAuth=!1,(o=this._authPromise)==null||o.resolve();return}console.error("[verifyOtp] Failed to validate OTP:",e),this._needsAuth=!0;let g=(e==null?void 0:e.status)==="error"?e.error:"Failed to validate encrypted OTP";(s=this._authPromise)==null||s.reject(new Error(g))}catch(e){throw console.error("[verifyOtp] Error sending OTP validation request:",e),this._needsAuth=!0,(a=this._authPromise)==null||a.reject(e),e}})}},h={timeoutMs:1e4,intervalMs:5e3};export{d as a,h as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as c}from"./chunk-34KTPATC.js";import{k as p,o as d,q as m}from"./chunk-7ENJXL4H.js";import{a as f}from"./chunk-BJDS5BJG.js";import{f as o}from"./chunk-BW7YYVZE.js";import{createPublicClient as E,encodeFunctionData as S,http as V}from"viem";import{isValidEvmAddress as I}from"@crossmint/common-sdk-base";var w=class C extends c{constructor(t){super({chain:t.chain,address:t.address,owner:t.owner,signer:t.signer,options:c.getOptions(t)},c.getApiClient(t))}static from(t){if(!I(t.address))throw new Error("Wallet is not an EVM wallet");return new C(t)}sendTransaction(t){return o(this,null,function*(){var e;let n=this.buildTransaction(t),a=yield this.createTransaction(n,t.options);return(e=t.options)!=null&&e.experimental_prepareOnly?{hash:void 0,explorerLink:void 0,transactionId:a.id}:yield this.approveAndWait(a.id)})}signMessage(t){return o(this,null,function*(){var i;let n=yield this.apiClient.createSignature(this.walletLocator,{type:"message",params:{message:t,signer:this.signer.locator(),chain:this.chain}});if("error"in n)throw new d(JSON.stringify(n));let a=n.id,e=((i=n.approvals)==null?void 0:i.pending)||[];return yield this.approveSignature(e,a),yield this.waitForSignature(a)})}signTypedData(t){return o(this,null,function*(){var T;let{domain:n,message:a,primaryType:e,types:i,chain:r}=t;if(!n||!a||!i||!r)throw new p("Invalid typed data");let{name:u,version:l,chainId:h,verifyingContract:y,salt:v}=n;if(!u||!l||!h||!y)throw new p("Invalid typed data domain");let s=yield this.apiClient.createSignature(this.walletLocator,{type:"typed-data",params:{typedData:{domain:{name:u,version:l,chainId:Number(h),verifyingContract:y,salt:v},message:a,primaryType:e,types:i},signer:this.signer.locator(),chain:r,isSmartWalletSignature:!1}});if("error"in s)throw new d(JSON.stringify(s));let g=s.id,D=((T=s.approvals)==null?void 0:T.pending)||[];return yield this.approveSignature(D,g),yield this.waitForSignature(g)})}getViemClient(t){var n;return E({transport:(n=t==null?void 0:t.transport)!=null?n:V(),chain:f(this.chain)})}createTransaction(t,n){return o(this,null,function*(){var i;let a=(i=n==null?void 0:n.experimental_signer)!=null?i:this.signer.locator(),e=yield this.apiClient.createTransaction(this.walletLocator,{params:{signer:a,chain:this.chain,calls:[t]}});if("error"in e)throw new m(JSON.stringify(e));return e})}buildTransaction(t){var n,a,e,i,r;if("transaction"in t)return{transaction:t.transaction};if(t.abi==null)return{to:t.to,value:(a=(n=t.value)==null?void 0:n.toString())!=null?a:"0",data:(e=t.data)!=null?e:"0x"};if(!t.functionName)throw new Error("Function name is required");return{to:t.to,value:(r=(i=t.value)==null?void 0:i.toString())!=null?r:"0",data:S({abi:t.abi,functionName:t.functionName,args:t.args})}}};export{w as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkMQP5VZCAcjs = require('./chunk-MQP5VZCA.cjs');var _chunkZSWIQU3Ucjs = require('./chunk-ZSWIQU3U.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var d=class{constructor(t){this.config=t;this._needsAuth=!0;this._authPromise=null;this.initialize(),this.type=this.config.type}initialize(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(this.config.clientTEEConnection==null){let t=_commonsdkbase.validateAPIKey.call(void 0, this.config.crossmint.apiKey);if(!t.isValid)throw new Error("Invalid API key");let r=new (0, _chunkMQP5VZCAcjs.a)({environment:t.environment});this.config.clientTEEConnection=yield r.initialize()}})}handleAuthRequired(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var o,s,a;if(this.config.clientTEEConnection==null)throw this.config.onAuthRequired==null?new Error(`${this.type} signer requires the onAuthRequired callback to handle OTP verification. This callback manages the authentication flow (sending OTP and verifying user input). If using our React/React Native SDK, this is handled automatically by the provider. For other environments, implement: onAuthRequired: (needsAuth, sendOtp, verifyOtp, reject) => { /* your UI logic */ }`):new Error("Handshake parent not initialized");let t=yield(a=this.config.clientTEEConnection)==null?void 0:a.sendAction({event:"request:get-status",responseEvent:"response:get-status",data:{authData:{jwt:(s=(o=this.config.crossmint.experimental_customAuth)==null?void 0:o.jwt)!=null?s:"",apiKey:this.config.crossmint.apiKey}},options:h});if((t==null?void 0:t.status)!=="success")throw new Error(t==null?void 0:t.error);if(t.signerStatus==="ready"){this._needsAuth=!1;return}let{promise:r,resolve:i,reject:n}=this.createAuthPromise();if(this._authPromise={promise:r,resolve:i,reject:n},this.config.onAuthRequired)try{yield this.config.onAuthRequired(this._needsAuth,()=>this.sendMessageWithOtp(),e=>this.verifyOtp(e),()=>n(new _chunkZSWIQU3Ucjs.a))}catch(e){n(e)}try{yield r}catch(e){throw e}})}getJwtOrThrow(){var r;let t=(r=this.config.crossmint.experimental_customAuth)==null?void 0:r.jwt;if(t==null)throw new Error("JWT is required");return t}createAuthPromise(){let t,r;return{promise:new Promise((n,o)=>{t=n,r=o}),resolve:t,reject:r}}sendMessageWithOtp(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var n,o,s;if(this.config.clientTEEConnection==null)throw new Error("Handshake parent not initialized");let t=this.config.clientTEEConnection,r=this.getAuthId(),i=yield t.sendAction({event:"request:start-onboarding",responseEvent:"response:start-onboarding",data:{authData:{jwt:(o=(n=this.config.crossmint.experimental_customAuth)==null?void 0:n.jwt)!=null?o:"",apiKey:this.config.crossmint.apiKey},data:{authId:r}},options:h});if((i==null?void 0:i.status)==="success"&&i.signerStatus==="ready"){this._needsAuth=!1;return}(i==null?void 0:i.status)==="error"&&(console.error("[sendMessageWithOtp] Failed to send OTP:",i),(s=this._authPromise)==null||s.reject(new Error(i.error||"Failed to initiate OTP process.")))})}getAuthId(){return this.config.type==="email"?`email:${this.config.email}`:`phone:${this.config.phone}`}verifyOtp(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var i,n,o,s,a;if(this.config.clientTEEConnection==null)throw new Error("Handshake parent not initialized");let r=this.config.clientTEEConnection;try{let e=yield r.sendAction({event:"request:complete-onboarding",responseEvent:"response:complete-onboarding",data:{authData:{jwt:(n=(i=this.config.crossmint.experimental_customAuth)==null?void 0:i.jwt)!=null?n:"",apiKey:this.config.crossmint.apiKey},data:{onboardingAuthentication:{encryptedOtp:t}}},options:h});if((e==null?void 0:e.status)==="success"){this._needsAuth=!1,(o=this._authPromise)==null||o.resolve();return}console.error("[verifyOtp] Failed to validate OTP:",e),this._needsAuth=!0;let g=(e==null?void 0:e.status)==="error"?e.error:"Failed to validate encrypted OTP";(s=this._authPromise)==null||s.reject(new Error(g))}catch(e){throw console.error("[verifyOtp] Error sending OTP validation request:",e),this._needsAuth=!0,(a=this._authPromise)==null||a.reject(e),e}})}},h= exports.b ={timeoutMs:1e4,intervalMs:5e3};exports.a = d; exports.b = h;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk3ILHWXXPcjs = require('./chunk-3ILHWXXP.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var m,o,R= exports.a =class{constructor(t,r){_chunkXALFCQKDcjs.d.call(void 0, this,m);_chunkXALFCQKDcjs.d.call(void 0, this,o);let{chain:n,address:a,owner:e,signer:g,options:u}=t;_chunkXALFCQKDcjs.e.call(void 0, this,o,r),this.chain=n,this.address=a,this.owner=e,this.signer=g,_chunkXALFCQKDcjs.e.call(void 0, this,m,u)}static getApiClient(t){return t.apiClient}static getOptions(t){return t.options}get apiClient(){return _chunkXALFCQKDcjs.c.call(void 0, this,o)}get options(){return _chunkXALFCQKDcjs.c.call(void 0, this,m)}balances(t,r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let n=this.chain==="solana"?"sol":"eth",a=[n,"usdc",...t!=null?t:[]],e=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getBalance(this.address,{chains:r!=null?r:[this.chain],tokens:a.map(g=>g.toLowerCase())});if("error"in e)throw new Error(`Failed to get balances for wallet: ${JSON.stringify(e.message)}`);return this.transformBalanceResponse(e,n,t)})}transformBalanceResponse(t,r,n){let a=i=>{var f,h,y,T,v;let d=(f=i.chains)==null?void 0:f[this.chain],w="contractAddress"in d?d.contractAddress:void 0;return{symbol:(h=i.symbol)!=null?h:"",name:(y=i.symbol)!=null?y:"",amount:(T=i.amount)!=null?T:"0",contractAddress:w,decimals:i.decimals,rawAmount:(v=i.rawAmount)!=null?v:"0"}},e=t.find(i=>i.symbol===r),g=t.find(i=>i.symbol==="usdc"),u=t.filter(i=>{var d;return i.symbol!==r&&i.symbol!=="usdc"&&(n==null?void 0:n.includes((d=i.symbol)!=null?d:""))}),s=i=>({symbol:i,name:i,amount:"0",contractAddress:void 0,decimals:0,rawAmount:"0"});return{nativeToken:e!=null?a(e):s(r),usdc:g!=null?a(g):s("usdc"),tokens:u.map(a)}}experimental_nfts(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield _chunkXALFCQKDcjs.c.call(void 0, this,o).experimental_getNfts(_chunkXALFCQKDcjs.b.call(void 0, _chunkXALFCQKDcjs.a.call(void 0, {},t),{chain:this.chain,address:this.address}))})}experimental_transactions(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let t=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getTransactions(this.walletLocator);if("error"in t)throw new Error(`Failed to get transactions: ${JSON.stringify(t.message)}`);return t})}experimental_transaction(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let r=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getTransaction(this.walletLocator,t);if("error"in r)throw new Error(`Failed to get transaction: ${JSON.stringify(r.error)}`);return r})}experimental_activity(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let t=yield this.apiClient.experimental_activity(this.walletLocator,{chain:this.chain});if("error"in t)throw new Error(`Failed to get activity: ${JSON.stringify(t.message)}`);return t})}send(t,r,n,a){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let e=k(t),g=H(r,this.chain),u={recipient:e,amount:n},s=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).send(this.walletLocator,g,u);if("message"in s)throw new (0, _chunkCT2UGJELcjs.q)(`Failed to send token: ${JSON.stringify(s.message)}`);return a!=null&&a.experimental_prepareOnly?{hash:void 0,explorerLink:void 0,transactionId:s.id}:yield this.approveAndWait(s.id)})}approveTransaction(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.approveAndWait(t.transactionId,t.options)})}addDelegatedSigner(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var n,a;let r=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).registerSigner(this.walletLocator,{signer:t.signer,chain:this.chain==="solana"?void 0:this.chain});if("error"in r)throw new Error(`Failed to register signer: ${JSON.stringify(r.message)}`);if("transaction"in r){let e=r.transaction.id;yield this.approveAndWait(e)}else{let e=(n=r.chains)==null?void 0:n[this.chain];if((e==null?void 0:e.status)==="awaiting-approval"){let g=((a=e.approvals)==null?void 0:a.pending)||[];yield this.approveSignature(g,e.id),yield this.waitForSignature(e.id);return}if((e==null?void 0:e.status)==="pending"){yield this.waitForSignature(e.id);return}}})}delegatedSigners(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var r,n,a;let t=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getWallet(this.walletLocator);if("error"in t)throw new (0, _chunkCT2UGJELcjs.d)(JSON.stringify(t));if(t.type!=="smart"||t.chainType!=="evm"&&t.chainType!=="solana")throw new (0, _chunkCT2UGJELcjs.c)(`Wallet type ${t.type} not supported`);return(a=(n=(r=t==null?void 0:t.config)==null?void 0:r.delegatedSigners)==null?void 0:n.map(e=>{let g=e.locator.indexOf(":");return{signer:`external-wallet:${g>=0?e.locator.slice(g+1):e.locator}`}}))!=null?a:[]})}get walletLocator(){return _chunkXALFCQKDcjs.c.call(void 0, this,o).isServerSide?this.address:`me:${this.chain==="solana"?"solana":"evm"}:smart`}get isSolanaWallet(){return this.chain==="solana"}approveAndWait(t,r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.approveTransactionInternal(t,r),yield this.sleep(1e3),yield this.waitForTransaction(t)})}approveTransactionInternal(t,r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var s,i,d,w,f;let n=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getTransaction(this.walletLocator,t);if("error"in n)throw new (0, _chunkCT2UGJELcjs.r)(JSON.stringify(n));if(yield(d=(i=(s=_chunkXALFCQKDcjs.c.call(void 0, this,m))==null?void 0:s.experimental_callbacks)==null?void 0:i.onTransactionStart)==null?void 0:d.call(i),this.signer.type==="api-key")return n;if((r==null?void 0:r.experimental_approval)!=null){let h=[r.experimental_approval];return yield this.executeApprovalWithErrorHandling(t,h)}let a=(w=n.approvals)==null?void 0:w.pending;if(a==null)return n;let e=[...(f=r==null?void 0:r.additionalSigners)!=null?f:[],this.signer],u=(yield Promise.all(a.map(h=>{let y=e.find(v=>v.locator()===h.signer.locator);if(y==null)throw new (0, _chunkCT2UGJELcjs.i)(`Signer ${h.signer} not found in pending approvals`);let T=n.chainType==="solana"&&"transaction"in n.onChain?n.onChain.transaction:h.message;return y.signTransaction(T)}))).map(h=>_chunkXALFCQKDcjs.b.call(void 0, _chunkXALFCQKDcjs.a.call(void 0, {},h),{signer:this.signer.locator()}));return yield this.executeApprovalWithErrorHandling(t,u)})}executeApprovalWithErrorHandling(t,r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let n=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).approveTransaction(this.walletLocator,t,{approvals:r});if(n.error)throw new (0, _chunkCT2UGJELcjs.w)(JSON.stringify(n));return n})}approveSignature(t,r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(this.isSolanaWallet)throw new Error("Approving signatures is only supported for EVM smart wallets");let n=t.find(e=>e.signer.locator===this.signer.locator());if(!n)throw new (0, _chunkCT2UGJELcjs.i)(`Signer ${this.signer.locator()} not found in pending approvals`);let a=yield this.signer.signMessage(n.message);return yield _chunkXALFCQKDcjs.c.call(void 0, this,o).approveSignature(this.walletLocator,r,{approvals:[_chunkXALFCQKDcjs.a.call(void 0, {signer:this.signer.locator()},a)]}),a})}waitForSignature(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let r=null;do if(yield new Promise(n=>setTimeout(n,_chunk3ILHWXXPcjs.d)),r=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getSignature(this.walletLocator,t),"error"in r)throw new (0, _chunkCT2UGJELcjs.p)(JSON.stringify(r));while(r===null||r.status==="pending");if(r.status==="failed")throw new (0, _chunkCT2UGJELcjs.m)("Signature signing failed");if(!r.outputSignature)throw new (0, _chunkCT2UGJELcjs.p)("Signature not available");return r.outputSignature})}waitForTransaction(g){return _chunkXALFCQKDcjs.f.call(void 0, this,arguments,function*(t,r=6e4,{backoffMultiplier:n=1.1,maxBackoffMs:a=2e3,initialBackoffMs:e=_chunk3ILHWXXPcjs.d}={}){var d;let u=Date.now(),s;do{if(Date.now()-u>r)throw new (0, _chunkCT2UGJELcjs.s)("Transaction confirmation timeout");if(s=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getTransaction(this.walletLocator,t),s.error)throw new (0, _chunkCT2UGJELcjs.r)(JSON.stringify(s));yield this.sleep(e),e=Math.min(e*n,a)}while(s.status==="pending");if(s.status==="failed")throw new (0, _chunkCT2UGJELcjs.t)(`Transaction sending failed: ${JSON.stringify(s.error)}`);if(s.status==="awaiting-approval")throw new (0, _chunkCT2UGJELcjs.u)("Transaction is awaiting approval. Please submit required approvals before waiting for completion.");let i=s.onChain.txId;if(i==null)throw new (0, _chunkCT2UGJELcjs.v)("Transaction hash not found on transaction response");return{hash:i,explorerLink:(d=s.onChain.explorerLink)!=null?d:"",transactionId:s.id}})}sleep(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return new Promise(r=>setTimeout(r,t))})}};m=new WeakMap,o=new WeakMap;function k(c){if(typeof c=="string")return c;if("email"in c)return`email:${c.email}`;if("x"in c)return`x:${c.x}`;if("twitter"in c)return`twitter:${c.twitter}`;if("phone"in c)return`phoneNumber:${c.phone}`;if("userId"in c)return`userId:${c.userId}`;throw new Error("Invalid recipient locator")}function H(c,t){return _commonsdkbase.isValidAddress.call(void 0, c)?`${t}:${c}`:`${t}:${c.toLowerCase()}`}exports.a = R;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk3ILHWXXPcjs = require('./chunk-3ILHWXXP.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var p=class extends _commonsdkbase.CrossmintApiClient{constructor(e){super(e,{internalConfig:{sdkMetadata:{name:_chunk3ILHWXXPcjs.c,version:_chunk3ILHWXXPcjs.b}}});this.apiPrefix="api/2025-06-09/wallets";this.legacyApiPrefix="api/2022-06-09/wallets"}createWallet(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let s=this.isServerSide?`${this.apiPrefix}`:`${this.apiPrefix}/me`;return(yield this.post(s,{body:JSON.stringify(e),headers:this.headers})).json()})}getWallet(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}`,{headers:this.headers})).json()})}createTransaction(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveTransaction(e,s,t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions/${s}/approvals`,{body:JSON.stringify(t),headers:this.headers})).json()})}getTransaction(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions/${s}`,{headers:this.headers})).json()})}createSignature(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signatures`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveSignature(e,s,t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signatures/${s}/approvals`,{body:JSON.stringify(t),headers:this.headers})).json()})}getSignature(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/signatures/${s}`,{headers:this.headers})).json()})}getTransactions(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions`,{headers:this.headers})).json()})}experimental_getNfts(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let s=new URLSearchParams;s.append("page",e.page.toString()),s.append("perPage",e.perPage.toString());let t=`${e.chain}:${e.address}`;return(yield this.get(`${this.apiPrefix}/${t}/nfts?${s.toString()}`,{headers:this.headers})).json()})}experimental_activity(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let t=e;this.isServerSide||(t=`me:${s.chain==="solana"?"solana-smart-wallet":"evm-smart-wallet"}`);let a=new URLSearchParams;return a.append("chain",s.chain.toString()),(yield this.get(`${this.legacyApiPrefix}/${t}/activity?${a.toString()}`,{headers:this.headers})).json()})}getBalance(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let t=new URLSearchParams;return t.append("tokens",s.tokens.join(",")),t.append("chains",s.chains.join(",")),(yield this.get(`${this.apiPrefix}/${e}/balances?${t.toString()}`,{headers:this.headers})).json()})}registerSigner(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signers`,{body:JSON.stringify(s),headers:this.headers})).json()})}getSigner(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/signers/${s}`,{headers:this.headers})).json()})}send(e,s,t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/tokens/${s}/transfers`,{body:JSON.stringify(t),headers:this.headers})).json()})}get isServerSide(){return this.parsedAPIKey.usageOrigin===_commonsdkbase.APIKeyUsageOrigin.SERVER}get environment(){if(!this.parsedAPIKey.isValid)throw new (0, _chunkCT2UGJELcjs.a)("Invalid API key");return this.parsedAPIKey.environment}get headers(){return{"Content-Type":"application/json"}}};exports.a = p;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkRM654WCCcjs = require('./chunk-RM654WCC.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunk6VJEBYPNcjs = require('./chunk-6VJEBYPN.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _viem = require('viem');var _commonsdkbase = require('@crossmint/common-sdk-base');var w=class C extends _chunkRM654WCCcjs.a{constructor(t){super({chain:t.chain,address:t.address,owner:t.owner,signer:t.signer,options:_chunkRM654WCCcjs.a.getOptions(t)},_chunkRM654WCCcjs.a.getApiClient(t))}static from(t){if(!_commonsdkbase.isValidEvmAddress.call(void 0, t.address))throw new Error("Wallet is not an EVM wallet");return new C(t)}sendTransaction(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var e;let n=this.buildTransaction(t),a=yield this.createTransaction(n,t.options);return(e=t.options)!=null&&e.experimental_prepareOnly?{hash:void 0,explorerLink:void 0,transactionId:a.id}:yield this.approveAndWait(a.id)})}signMessage(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var i;let n=yield this.apiClient.createSignature(this.walletLocator,{type:"message",params:{message:t,signer:this.signer.locator(),chain:this.chain}});if("error"in n)throw new (0, _chunkCT2UGJELcjs.o)(JSON.stringify(n));let a=n.id,e=((i=n.approvals)==null?void 0:i.pending)||[];return yield this.approveSignature(e,a),yield this.waitForSignature(a)})}signTypedData(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var T;let{domain:n,message:a,primaryType:e,types:i,chain:r}=t;if(!n||!a||!i||!r)throw new (0, _chunkCT2UGJELcjs.k)("Invalid typed data");let{name:u,version:l,chainId:h,verifyingContract:y,salt:v}=n;if(!u||!l||!h||!y)throw new (0, _chunkCT2UGJELcjs.k)("Invalid typed data domain");let s=yield this.apiClient.createSignature(this.walletLocator,{type:"typed-data",params:{typedData:{domain:{name:u,version:l,chainId:Number(h),verifyingContract:y,salt:v},message:a,primaryType:e,types:i},signer:this.signer.locator(),chain:r,isSmartWalletSignature:!1}});if("error"in s)throw new (0, _chunkCT2UGJELcjs.o)(JSON.stringify(s));let g=s.id,D=((T=s.approvals)==null?void 0:T.pending)||[];return yield this.approveSignature(D,g),yield this.waitForSignature(g)})}getViemClient(t){var n;return _viem.createPublicClient.call(void 0, {transport:(n=t==null?void 0:t.transport)!=null?n:_viem.http.call(void 0, ),chain:_chunk6VJEBYPNcjs.a.call(void 0, this.chain)})}createTransaction(t,n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var i;let a=(i=n==null?void 0:n.experimental_signer)!=null?i:this.signer.locator(),e=yield this.apiClient.createTransaction(this.walletLocator,{params:{signer:a,chain:this.chain,calls:[t]}});if("error"in e)throw new (0, _chunkCT2UGJELcjs.q)(JSON.stringify(e));return e})}buildTransaction(t){var n,a,e,i,r;if("transaction"in t)return{transaction:t.transaction};if(t.abi==null)return{to:t.to,value:(a=(n=t.value)==null?void 0:n.toString())!=null?a:"0",data:(e=t.data)!=null?e:"0x"};if(!t.functionName)throw new Error("Function name is required");return{to:t.to,value:(r=(i=t.value)==null?void 0:i.toString())!=null?r:"0",data:_viem.encodeFunctionData.call(void 0, {abi:t.abi,functionName:t.functionName,args:t.args})}}};exports.a = w;
|
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 _chunkYLOYCYMZcjs = require('./chunk-YLOYCYMZ.cjs');var _chunkIYV6TMKKcjs = require('./chunk-IYV6TMKK.cjs');var _chunk5IJISQS5cjs = require('./chunk-5IJISQS5.cjs');require('./chunk-7WVULM5A.cjs');var _chunkRM654WCCcjs = require('./chunk-RM654WCC.cjs');require('./chunk-CQL2S4AX.cjs');require('./chunk-3ABHUDKX.cjs');require('./chunk-3BCOIESI.cjs');require('./chunk-243LSD4S.cjs');require('./chunk-OWDKPU47.cjs');require('./chunk-MQP5VZCA.cjs');require('./chunk-YWPTI2QO.cjs');require('./chunk-4KXOWU5E.cjs');require('./chunk-YTAW674L.cjs');require('./chunk-ZSWIQU3U.cjs');require('./chunk-RFK6N7LC.cjs');require('./chunk-6HXIZLEQ.cjs');var _chunkVGEZ34G3cjs = require('./chunk-VGEZ34G3.cjs');require('./chunk-3ILHWXXP.cjs');require('./chunk-CT2UGJEL.cjs');require('./chunk-ECAM5KTH.cjs');require('./chunk-6VJEBYPN.cjs');require('./chunk-IR5WN6FQ.cjs');require('./chunk-GEY574TH.cjs');require('./chunk-YZ4HRYSL.cjs');require('./chunk-BULGM35W.cjs');require('./chunk-XALFCQKD.cjs');exports.CrossmintWallets = _chunk5IJISQS5cjs.b; exports.EVMWallet = _chunkYLOYCYMZcjs.a; exports.SolanaWallet = _chunkIYV6TMKKcjs.a; exports.Wallet = _chunkRM654WCCcjs.a; exports.WalletsApiClient = _chunkVGEZ34G3cjs.a; exports.createCrossmint = _chunk5IJISQS5cjs.a;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o}from"./chunk-
|
|
1
|
+
import{a as o}from"./chunk-O7EUUTCW.js";import{a as r}from"./chunk-MWPC3MS2.js";import{a,b as t}from"./chunk-GRF2D4TT.js";import"./chunk-FIEPPMQZ.js";import{a as n}from"./chunk-34KTPATC.js";import"./chunk-JMTREPVI.js";import"./chunk-7AFCY47Q.js";import"./chunk-4UVL6FIE.js";import"./chunk-KXFOQTZ2.js";import"./chunk-NP4EN5GQ.js";import"./chunk-JUSY5XEE.js";import"./chunk-UBOWSXW3.js";import"./chunk-IGBQEAD5.js";import"./chunk-SCS4UDW7.js";import"./chunk-M4ELAV7U.js";import"./chunk-IJMFCZIY.js";import"./chunk-5IFDVB4Y.js";import{a as e}from"./chunk-KPRNFRAS.js";import"./chunk-4X475QLF.js";import"./chunk-7ENJXL4H.js";import"./chunk-KBJA7JDT.js";import"./chunk-BJDS5BJG.js";import"./chunk-KKQBZXFE.js";import"./chunk-S3DYQVRD.js";import"./chunk-LW6JSI4J.js";import"./chunk-5S6YZJHE.js";import"./chunk-BW7YYVZE.js";export{t as CrossmintWallets,o as EVMWallet,r as SolanaWallet,n as Wallet,e as WalletsApiClient,a as createCrossmint};
|
package/dist/sdk.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk5IJISQS5cjs = require('./chunk-5IJISQS5.cjs');require('./chunk-7WVULM5A.cjs');require('./chunk-RM654WCC.cjs');require('./chunk-CQL2S4AX.cjs');require('./chunk-3ABHUDKX.cjs');require('./chunk-3BCOIESI.cjs');require('./chunk-243LSD4S.cjs');require('./chunk-OWDKPU47.cjs');require('./chunk-MQP5VZCA.cjs');require('./chunk-YWPTI2QO.cjs');require('./chunk-4KXOWU5E.cjs');require('./chunk-YTAW674L.cjs');require('./chunk-ZSWIQU3U.cjs');require('./chunk-RFK6N7LC.cjs');require('./chunk-6HXIZLEQ.cjs');require('./chunk-VGEZ34G3.cjs');require('./chunk-3ILHWXXP.cjs');require('./chunk-CT2UGJEL.cjs');require('./chunk-ECAM5KTH.cjs');require('./chunk-YZ4HRYSL.cjs');require('./chunk-BULGM35W.cjs');require('./chunk-XALFCQKD.cjs');exports.CrossmintWallets = _chunk5IJISQS5cjs.b; exports.createCrossmint = _chunk5IJISQS5cjs.a;
|
package/dist/sdk.d.cts
CHANGED
|
@@ -7,10 +7,10 @@ import './signers/types.cjs';
|
|
|
7
7
|
import 'ox';
|
|
8
8
|
import '@crossmint/client-sdk-window';
|
|
9
9
|
import '@crossmint/client-signers';
|
|
10
|
+
import './api/gen/types.gen.cjs';
|
|
10
11
|
import './api/client.cjs';
|
|
11
12
|
import './api/types.cjs';
|
|
12
13
|
import 'viem';
|
|
13
|
-
import './api/gen/types.gen.cjs';
|
|
14
14
|
import '@solana/web3.js';
|
|
15
15
|
import 'abitype';
|
|
16
16
|
|
package/dist/sdk.d.ts
CHANGED
|
@@ -7,10 +7,10 @@ import './signers/types.js';
|
|
|
7
7
|
import 'ox';
|
|
8
8
|
import '@crossmint/client-sdk-window';
|
|
9
9
|
import '@crossmint/client-signers';
|
|
10
|
+
import './api/gen/types.gen.js';
|
|
10
11
|
import './api/client.js';
|
|
11
12
|
import './api/types.js';
|
|
12
13
|
import 'viem';
|
|
13
|
-
import './api/gen/types.gen.js';
|
|
14
14
|
import '@solana/web3.js';
|
|
15
15
|
import 'abitype';
|
|
16
16
|
|
package/dist/sdk.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b}from"./chunk-
|
|
1
|
+
import{a,b}from"./chunk-GRF2D4TT.js";import"./chunk-FIEPPMQZ.js";import"./chunk-34KTPATC.js";import"./chunk-JMTREPVI.js";import"./chunk-7AFCY47Q.js";import"./chunk-4UVL6FIE.js";import"./chunk-KXFOQTZ2.js";import"./chunk-NP4EN5GQ.js";import"./chunk-JUSY5XEE.js";import"./chunk-UBOWSXW3.js";import"./chunk-IGBQEAD5.js";import"./chunk-SCS4UDW7.js";import"./chunk-M4ELAV7U.js";import"./chunk-IJMFCZIY.js";import"./chunk-5IFDVB4Y.js";import"./chunk-KPRNFRAS.js";import"./chunk-4X475QLF.js";import"./chunk-7ENJXL4H.js";import"./chunk-KBJA7JDT.js";import"./chunk-LW6JSI4J.js";import"./chunk-5S6YZJHE.js";import"./chunk-BW7YYVZE.js";export{b as CrossmintWallets,a as createCrossmint};
|
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 _chunkCQL2S4AXcjs = require('../chunk-CQL2S4AX.cjs');require('../chunk-3ABHUDKX.cjs');require('../chunk-3BCOIESI.cjs');require('../chunk-243LSD4S.cjs');require('../chunk-OWDKPU47.cjs');require('../chunk-MQP5VZCA.cjs');require('../chunk-YWPTI2QO.cjs');require('../chunk-4KXOWU5E.cjs');require('../chunk-YTAW674L.cjs');require('../chunk-ZSWIQU3U.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-YZ4HRYSL.cjs');require('../chunk-BULGM35W.cjs');require('../chunk-XALFCQKD.cjs');exports.assembleSigner = _chunkCQL2S4AXcjs.a;
|
package/dist/signers/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-JMTREPVI.js";import"../chunk-7AFCY47Q.js";import"../chunk-4UVL6FIE.js";import"../chunk-KXFOQTZ2.js";import"../chunk-NP4EN5GQ.js";import"../chunk-JUSY5XEE.js";import"../chunk-UBOWSXW3.js";import"../chunk-IGBQEAD5.js";import"../chunk-SCS4UDW7.js";import"../chunk-M4ELAV7U.js";import"../chunk-7ENJXL4H.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-3ABHUDKX.cjs');var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../../chunk-3ABHUDKX.cjs');var _chunk3BCOIESIcjs = require('../../chunk-3BCOIESI.cjs');var _chunk243LSD4Scjs = require('../../chunk-243LSD4S.cjs');var _chunkOWDKPU47cjs = require('../../chunk-OWDKPU47.cjs');require('../../chunk-MQP5VZCA.cjs');require('../../chunk-ZSWIQU3U.cjs');require('../../chunk-XALFCQKD.cjs');exports.DEFAULT_EVENT_OPTIONS = _chunkOWDKPU47cjs.b; exports.EVMNonCustodialSigner = _chunk3BCOIESIcjs.a; exports.NonCustodialSigner = _chunkOWDKPU47cjs.a; exports.SolanaNonCustodialSigner = _chunk243LSD4Scjs.a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../chunk-7AFCY47Q.js";import{a as d}from"../../chunk-
|
|
1
|
+
import"../../chunk-7AFCY47Q.js";import{a as d}from"../../chunk-4UVL6FIE.js";import{a as c}from"../../chunk-KXFOQTZ2.js";import{a,b}from"../../chunk-NP4EN5GQ.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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk3BCOIESIcjs = require('../../chunk-3BCOIESI.cjs');require('../../chunk-OWDKPU47.cjs');require('../../chunk-MQP5VZCA.cjs');require('../../chunk-ZSWIQU3U.cjs');require('../../chunk-XALFCQKD.cjs');exports.EVMNonCustodialSigner = _chunk3BCOIESIcjs.a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-4UVL6FIE.js";import"../../chunk-NP4EN5GQ.js";import"../../chunk-JUSY5XEE.js";import"../../chunk-M4ELAV7U.js";import"../../chunk-BW7YYVZE.js";export{a as EVMNonCustodialSigner};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkMQP5VZCAcjs = require('../../chunk-MQP5VZCA.cjs');require('../../chunk-XALFCQKD.cjs');exports.NcsIframeManager = _chunkMQP5VZCAcjs.a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-JUSY5XEE.js";import"../../chunk-BW7YYVZE.js";export{a as NcsIframeManager};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkOWDKPU47cjs = require('../../chunk-OWDKPU47.cjs');require('../../chunk-MQP5VZCA.cjs');require('../../chunk-ZSWIQU3U.cjs');require('../../chunk-XALFCQKD.cjs');exports.DEFAULT_EVENT_OPTIONS = _chunkOWDKPU47cjs.b; exports.NonCustodialSigner = _chunkOWDKPU47cjs.a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b}from"../../chunk-
|
|
1
|
+
import{a,b}from"../../chunk-NP4EN5GQ.js";import"../../chunk-JUSY5XEE.js";import"../../chunk-M4ELAV7U.js";import"../../chunk-BW7YYVZE.js";export{b as DEFAULT_EVENT_OPTIONS,a as NonCustodialSigner};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk243LSD4Scjs = require('../../chunk-243LSD4S.cjs');require('../../chunk-OWDKPU47.cjs');require('../../chunk-MQP5VZCA.cjs');require('../../chunk-ZSWIQU3U.cjs');require('../../chunk-XALFCQKD.cjs');exports.SolanaNonCustodialSigner = _chunk243LSD4Scjs.a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-KXFOQTZ2.js";import"../../chunk-NP4EN5GQ.js";import"../../chunk-JUSY5XEE.js";import"../../chunk-M4ELAV7U.js";import"../../chunk-BW7YYVZE.js";export{a as SolanaNonCustodialSigner};
|
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 _chunk3ILHWXXPcjs = require('../chunk-3ILHWXXP.cjs');require('../chunk-XALFCQKD.cjs');exports.SDK_NAME = _chunk3ILHWXXPcjs.c; exports.SDK_VERSION = _chunk3ILHWXXPcjs.b; exports.STATUS_POLLING_INTERVAL_MS = _chunk3ILHWXXPcjs.d; exports.WALLETS_SERVICE = _chunk3ILHWXXPcjs.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-4X475QLF.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 _chunkYLOYCYMZcjs = require('../chunk-YLOYCYMZ.cjs');require('../chunk-RM654WCC.cjs');require('../chunk-3ILHWXXP.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-6VJEBYPN.cjs');require('../chunk-IR5WN6FQ.cjs');require('../chunk-GEY574TH.cjs');require('../chunk-XALFCQKD.cjs');exports.EVMWallet = _chunkYLOYCYMZcjs.a;
|
package/dist/wallets/evm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-O7EUUTCW.js";import"../chunk-34KTPATC.js";import"../chunk-4X475QLF.js";import"../chunk-7ENJXL4H.js";import"../chunk-BJDS5BJG.js";import"../chunk-KKQBZXFE.js";import"../chunk-S3DYQVRD.js";import"../chunk-BW7YYVZE.js";export{a as EVMWallet};
|
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 _chunkIYV6TMKKcjs = require('../chunk-IYV6TMKK.cjs');require('../chunk-RM654WCC.cjs');require('../chunk-YTAW674L.cjs');require('../chunk-3ILHWXXP.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-XALFCQKD.cjs');exports.SolanaWallet = _chunkIYV6TMKKcjs.a;
|
package/dist/wallets/solana.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-MWPC3MS2.js";import"../chunk-34KTPATC.js";import"../chunk-SCS4UDW7.js";import"../chunk-4X475QLF.js";import"../chunk-7ENJXL4H.js";import"../chunk-BW7YYVZE.js";export{a as SolanaWallet};
|
package/dist/wallets/types.d.cts
CHANGED
|
@@ -5,7 +5,7 @@ import { Abi } from 'abitype';
|
|
|
5
5
|
import { CreateTransactionSuccessResponse } from '../api/types.cjs';
|
|
6
6
|
export { Activity } from '../api/types.cjs';
|
|
7
7
|
import { Chain } from '../chains/chains.cjs';
|
|
8
|
-
import { SignerConfigForChain } from '../signers/types.cjs';
|
|
8
|
+
import { SignerConfigForChain, BaseSignResult, PasskeySignResult, Signer } from '../signers/types.cjs';
|
|
9
9
|
import 'viem';
|
|
10
10
|
import '../api/gen/types.gen.cjs';
|
|
11
11
|
import 'ox';
|
|
@@ -13,6 +13,7 @@ import '@crossmint/common-sdk-base';
|
|
|
13
13
|
|
|
14
14
|
type TransactionInputOptions = {
|
|
15
15
|
experimental_prepareOnly?: boolean;
|
|
16
|
+
experimental_signer?: string;
|
|
16
17
|
};
|
|
17
18
|
type EVMTransactionInputBase = {
|
|
18
19
|
options?: TransactionInputOptions;
|
|
@@ -90,5 +91,16 @@ type Transaction<TPrepareOnly extends boolean = false> = TPrepareOnly extends tr
|
|
|
90
91
|
explorerLink: string;
|
|
91
92
|
transactionId: string;
|
|
92
93
|
};
|
|
94
|
+
type ApproveTransactionOptions = {
|
|
95
|
+
experimental_approval?: Approval;
|
|
96
|
+
additionalSigners?: Signer[];
|
|
97
|
+
};
|
|
98
|
+
type ApproveTransactionParams = {
|
|
99
|
+
transactionId: string;
|
|
100
|
+
options?: ApproveTransactionOptions;
|
|
101
|
+
};
|
|
102
|
+
type Approval = (BaseSignResult | PasskeySignResult) & {
|
|
103
|
+
signer: string;
|
|
104
|
+
};
|
|
93
105
|
|
|
94
|
-
export type { Balances, Callbacks, DelegatedSigner, EVMTransactionInput, FormattedEVMTransaction, PendingApproval, SolanaTransactionInput, TokenBalance, Transaction, TransactionInputOptions, UserLocator, WalletArgsFor, WalletOptions };
|
|
106
|
+
export type { Approval, ApproveTransactionOptions, ApproveTransactionParams, Balances, Callbacks, DelegatedSigner, EVMTransactionInput, FormattedEVMTransaction, PendingApproval, SolanaTransactionInput, TokenBalance, Transaction, TransactionInputOptions, UserLocator, WalletArgsFor, WalletOptions };
|
package/dist/wallets/types.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { Abi } from 'abitype';
|
|
|
5
5
|
import { CreateTransactionSuccessResponse } from '../api/types.js';
|
|
6
6
|
export { Activity } from '../api/types.js';
|
|
7
7
|
import { Chain } from '../chains/chains.js';
|
|
8
|
-
import { SignerConfigForChain } from '../signers/types.js';
|
|
8
|
+
import { SignerConfigForChain, BaseSignResult, PasskeySignResult, Signer } from '../signers/types.js';
|
|
9
9
|
import 'viem';
|
|
10
10
|
import '../api/gen/types.gen.js';
|
|
11
11
|
import 'ox';
|
|
@@ -13,6 +13,7 @@ import '@crossmint/common-sdk-base';
|
|
|
13
13
|
|
|
14
14
|
type TransactionInputOptions = {
|
|
15
15
|
experimental_prepareOnly?: boolean;
|
|
16
|
+
experimental_signer?: string;
|
|
16
17
|
};
|
|
17
18
|
type EVMTransactionInputBase = {
|
|
18
19
|
options?: TransactionInputOptions;
|
|
@@ -90,5 +91,16 @@ type Transaction<TPrepareOnly extends boolean = false> = TPrepareOnly extends tr
|
|
|
90
91
|
explorerLink: string;
|
|
91
92
|
transactionId: string;
|
|
92
93
|
};
|
|
94
|
+
type ApproveTransactionOptions = {
|
|
95
|
+
experimental_approval?: Approval;
|
|
96
|
+
additionalSigners?: Signer[];
|
|
97
|
+
};
|
|
98
|
+
type ApproveTransactionParams = {
|
|
99
|
+
transactionId: string;
|
|
100
|
+
options?: ApproveTransactionOptions;
|
|
101
|
+
};
|
|
102
|
+
type Approval = (BaseSignResult | PasskeySignResult) & {
|
|
103
|
+
signer: string;
|
|
104
|
+
};
|
|
93
105
|
|
|
94
|
-
export type { Balances, Callbacks, DelegatedSigner, EVMTransactionInput, FormattedEVMTransaction, PendingApproval, SolanaTransactionInput, TokenBalance, Transaction, TransactionInputOptions, UserLocator, WalletArgsFor, WalletOptions };
|
|
106
|
+
export type { Approval, ApproveTransactionOptions, ApproveTransactionParams, Balances, Callbacks, DelegatedSigner, EVMTransactionInput, FormattedEVMTransaction, PendingApproval, SolanaTransactionInput, TokenBalance, Transaction, TransactionInputOptions, UserLocator, WalletArgsFor, WalletOptions };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk7WVULM5Acjs = require('../chunk-7WVULM5A.cjs');require('../chunk-RM654WCC.cjs');require('../chunk-CQL2S4AX.cjs');require('../chunk-3ABHUDKX.cjs');require('../chunk-3BCOIESI.cjs');require('../chunk-243LSD4S.cjs');require('../chunk-OWDKPU47.cjs');require('../chunk-MQP5VZCA.cjs');require('../chunk-YWPTI2QO.cjs');require('../chunk-4KXOWU5E.cjs');require('../chunk-YTAW674L.cjs');require('../chunk-ZSWIQU3U.cjs');require('../chunk-RFK6N7LC.cjs');require('../chunk-3ILHWXXP.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-YZ4HRYSL.cjs');require('../chunk-BULGM35W.cjs');require('../chunk-XALFCQKD.cjs');exports.WalletFactory = _chunk7WVULM5Acjs.a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-FIEPPMQZ.js";import"../chunk-34KTPATC.js";import"../chunk-JMTREPVI.js";import"../chunk-7AFCY47Q.js";import"../chunk-4UVL6FIE.js";import"../chunk-KXFOQTZ2.js";import"../chunk-NP4EN5GQ.js";import"../chunk-JUSY5XEE.js";import"../chunk-UBOWSXW3.js";import"../chunk-IGBQEAD5.js";import"../chunk-SCS4UDW7.js";import"../chunk-M4ELAV7U.js";import"../chunk-IJMFCZIY.js";import"../chunk-4X475QLF.js";import"../chunk-7ENJXL4H.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 _chunkRM654WCCcjs = require('../chunk-RM654WCC.cjs');require('../chunk-3ILHWXXP.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-XALFCQKD.cjs');exports.Wallet = _chunkRM654WCCcjs.a;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Signer, PasskeySignResult, BaseSignResult } from '../signers/types.cjs';
|
|
2
|
-
import { ApiClient } from '../api/client.cjs';
|
|
3
|
-
import { GetTransactionsResponse, GetTransactionResponse, Activity, RegisterSignerPasskeyParams, WalletLocator } from '../api/types.cjs';
|
|
4
2
|
import { WalletNftsResponseDto, WalletsTransactionV2025ResponseDto } from '../api/gen/types.gen.cjs';
|
|
5
|
-
import {
|
|
3
|
+
import { ApiClient } from '../api/client.cjs';
|
|
4
|
+
import { GetTransactionsResponse, GetTransactionSuccessResponse, Activity, RegisterSignerPasskeyParams, WalletLocator } from '../api/types.cjs';
|
|
5
|
+
import { WalletOptions, Balances, TransactionInputOptions, UserLocator, Transaction, ApproveTransactionParams, DelegatedSigner, ApproveTransactionOptions, PendingApproval } from './types.cjs';
|
|
6
6
|
import { Chain } from '../chains/chains.cjs';
|
|
7
7
|
import 'ox';
|
|
8
8
|
import '@crossmint/client-sdk-window';
|
|
@@ -59,13 +59,15 @@ declare class Wallet<C extends Chain> {
|
|
|
59
59
|
/**
|
|
60
60
|
* Get the wallet transactions
|
|
61
61
|
* @returns The transactions
|
|
62
|
+
* @throws {Error} If the transactions cannot be retrieved
|
|
62
63
|
*/
|
|
63
64
|
experimental_transactions(): Promise<GetTransactionsResponse>;
|
|
64
65
|
/**
|
|
65
66
|
* Get a transaction by id
|
|
66
67
|
* @returns The transaction
|
|
68
|
+
* @throws {Error} If the transaction cannot be retrieved
|
|
67
69
|
*/
|
|
68
|
-
experimental_transaction(transactionId: string): Promise<
|
|
70
|
+
experimental_transaction(transactionId: string): Promise<GetTransactionSuccessResponse>;
|
|
69
71
|
/**
|
|
70
72
|
* Get the wallet activity
|
|
71
73
|
* @returns The activity
|
|
@@ -84,6 +86,20 @@ declare class Wallet<C extends Chain> {
|
|
|
84
86
|
send<T extends TransactionInputOptions | undefined = undefined>(to: string | UserLocator, token: string, amount: string, options?: T): Promise<Transaction<T extends {
|
|
85
87
|
experimental_prepareOnly: true;
|
|
86
88
|
} ? true : false>>;
|
|
89
|
+
/**
|
|
90
|
+
* Approve a transaction
|
|
91
|
+
* @param params - The parameters
|
|
92
|
+
* @param params.transactionId - The transaction id
|
|
93
|
+
* @param params.options - The options for the transaction
|
|
94
|
+
* @param params.options.experimental_approval - The approval
|
|
95
|
+
* @param params.options.additionalSigners - The additional signers
|
|
96
|
+
* @returns The transaction
|
|
97
|
+
*/
|
|
98
|
+
approveTransaction(params: ApproveTransactionParams): Promise<{
|
|
99
|
+
hash: string;
|
|
100
|
+
explorerLink: string;
|
|
101
|
+
transactionId: string;
|
|
102
|
+
}>;
|
|
87
103
|
/**
|
|
88
104
|
* Add a delegated signer to the wallet
|
|
89
105
|
* @param signer - The signer. For Solana, it must be a string. For EVM, it can be a string or a passkey.
|
|
@@ -95,12 +111,13 @@ declare class Wallet<C extends Chain> {
|
|
|
95
111
|
delegatedSigners(): Promise<DelegatedSigner[]>;
|
|
96
112
|
protected get walletLocator(): WalletLocator;
|
|
97
113
|
protected get isSolanaWallet(): boolean;
|
|
98
|
-
protected approveAndWait(transactionId: string,
|
|
114
|
+
protected approveAndWait(transactionId: string, options?: ApproveTransactionOptions): Promise<{
|
|
99
115
|
hash: string;
|
|
100
116
|
explorerLink: string;
|
|
101
117
|
transactionId: string;
|
|
102
118
|
}>;
|
|
103
|
-
protected
|
|
119
|
+
protected approveTransactionInternal(transactionId: string, options?: ApproveTransactionOptions): Promise<WalletsTransactionV2025ResponseDto>;
|
|
120
|
+
private executeApprovalWithErrorHandling;
|
|
104
121
|
protected approveSignature(pendingApprovals: Array<PendingApproval>, signatureId: string): Promise<PasskeySignResult | BaseSignResult>;
|
|
105
122
|
protected waitForSignature(signatureId: string): Promise<string>;
|
|
106
123
|
protected waitForTransaction(transactionId: string, timeoutMs?: number, { backoffMultiplier, maxBackoffMs, initialBackoffMs, }?: {
|
package/dist/wallets/wallet.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Signer, PasskeySignResult, BaseSignResult } from '../signers/types.js';
|
|
2
|
-
import { ApiClient } from '../api/client.js';
|
|
3
|
-
import { GetTransactionsResponse, GetTransactionResponse, Activity, RegisterSignerPasskeyParams, WalletLocator } from '../api/types.js';
|
|
4
2
|
import { WalletNftsResponseDto, WalletsTransactionV2025ResponseDto } from '../api/gen/types.gen.js';
|
|
5
|
-
import {
|
|
3
|
+
import { ApiClient } from '../api/client.js';
|
|
4
|
+
import { GetTransactionsResponse, GetTransactionSuccessResponse, Activity, RegisterSignerPasskeyParams, WalletLocator } from '../api/types.js';
|
|
5
|
+
import { WalletOptions, Balances, TransactionInputOptions, UserLocator, Transaction, ApproveTransactionParams, DelegatedSigner, ApproveTransactionOptions, PendingApproval } from './types.js';
|
|
6
6
|
import { Chain } from '../chains/chains.js';
|
|
7
7
|
import 'ox';
|
|
8
8
|
import '@crossmint/client-sdk-window';
|
|
@@ -59,13 +59,15 @@ declare class Wallet<C extends Chain> {
|
|
|
59
59
|
/**
|
|
60
60
|
* Get the wallet transactions
|
|
61
61
|
* @returns The transactions
|
|
62
|
+
* @throws {Error} If the transactions cannot be retrieved
|
|
62
63
|
*/
|
|
63
64
|
experimental_transactions(): Promise<GetTransactionsResponse>;
|
|
64
65
|
/**
|
|
65
66
|
* Get a transaction by id
|
|
66
67
|
* @returns The transaction
|
|
68
|
+
* @throws {Error} If the transaction cannot be retrieved
|
|
67
69
|
*/
|
|
68
|
-
experimental_transaction(transactionId: string): Promise<
|
|
70
|
+
experimental_transaction(transactionId: string): Promise<GetTransactionSuccessResponse>;
|
|
69
71
|
/**
|
|
70
72
|
* Get the wallet activity
|
|
71
73
|
* @returns The activity
|
|
@@ -84,6 +86,20 @@ declare class Wallet<C extends Chain> {
|
|
|
84
86
|
send<T extends TransactionInputOptions | undefined = undefined>(to: string | UserLocator, token: string, amount: string, options?: T): Promise<Transaction<T extends {
|
|
85
87
|
experimental_prepareOnly: true;
|
|
86
88
|
} ? true : false>>;
|
|
89
|
+
/**
|
|
90
|
+
* Approve a transaction
|
|
91
|
+
* @param params - The parameters
|
|
92
|
+
* @param params.transactionId - The transaction id
|
|
93
|
+
* @param params.options - The options for the transaction
|
|
94
|
+
* @param params.options.experimental_approval - The approval
|
|
95
|
+
* @param params.options.additionalSigners - The additional signers
|
|
96
|
+
* @returns The transaction
|
|
97
|
+
*/
|
|
98
|
+
approveTransaction(params: ApproveTransactionParams): Promise<{
|
|
99
|
+
hash: string;
|
|
100
|
+
explorerLink: string;
|
|
101
|
+
transactionId: string;
|
|
102
|
+
}>;
|
|
87
103
|
/**
|
|
88
104
|
* Add a delegated signer to the wallet
|
|
89
105
|
* @param signer - The signer. For Solana, it must be a string. For EVM, it can be a string or a passkey.
|
|
@@ -95,12 +111,13 @@ declare class Wallet<C extends Chain> {
|
|
|
95
111
|
delegatedSigners(): Promise<DelegatedSigner[]>;
|
|
96
112
|
protected get walletLocator(): WalletLocator;
|
|
97
113
|
protected get isSolanaWallet(): boolean;
|
|
98
|
-
protected approveAndWait(transactionId: string,
|
|
114
|
+
protected approveAndWait(transactionId: string, options?: ApproveTransactionOptions): Promise<{
|
|
99
115
|
hash: string;
|
|
100
116
|
explorerLink: string;
|
|
101
117
|
transactionId: string;
|
|
102
118
|
}>;
|
|
103
|
-
protected
|
|
119
|
+
protected approveTransactionInternal(transactionId: string, options?: ApproveTransactionOptions): Promise<WalletsTransactionV2025ResponseDto>;
|
|
120
|
+
private executeApprovalWithErrorHandling;
|
|
104
121
|
protected approveSignature(pendingApprovals: Array<PendingApproval>, signatureId: string): Promise<PasskeySignResult | BaseSignResult>;
|
|
105
122
|
protected waitForSignature(signatureId: string): Promise<string>;
|
|
106
123
|
protected waitForTransaction(transactionId: string, timeoutMs?: number, { backoffMultiplier, maxBackoffMs, initialBackoffMs, }?: {
|
package/dist/wallets/wallet.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-34KTPATC.js";import"../chunk-4X475QLF.js";import"../chunk-7ENJXL4H.js";import"../chunk-BW7YYVZE.js";export{a as Wallet};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crossmint/wallets-sdk",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.17",
|
|
4
4
|
"repository": "https://github.com/Crossmint/crossmint-sdk",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Paella Labs Inc",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"ox": "0.6.9",
|
|
26
26
|
"tweetnacl": "1.0.3",
|
|
27
27
|
"viem": "2.23.6",
|
|
28
|
-
"@crossmint/client-sdk-window": "1.0.2",
|
|
29
28
|
"@crossmint/client-signers": "0.0.18",
|
|
29
|
+
"@crossmint/client-sdk-window": "1.0.3",
|
|
30
30
|
"@crossmint/common-sdk-base": "0.8.5"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
package/dist/chunk-7JFXS23U.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 _chunkVOVPHLO5cjs = require('./chunk-VOVPHLO5.cjs');var _chunkYTAW674Lcjs = require('./chunk-YTAW674L.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);var _commonsdkbase = require('@crossmint/common-sdk-base');var d=class u extends _chunkVOVPHLO5cjs.a{constructor(n){super({chain:n.chain,address:n.address,owner:n.owner,signer:n.signer},_chunkVOVPHLO5cjs.a.getApiClient(n))}static from(n){if(!_commonsdkbase.isValidSolanaAddress.call(void 0, n.address))throw new Error("Wallet is not a Solana wallet");return new u(n)}sendTransaction(n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var o,s;let i=yield this.createTransaction(n);if((o=n.options)!=null&&o.experimental_prepareOnly)return{hash:void 0,explorerLink:void 0,transactionId:i.id};let a=(s=n.additionalSigners)==null?void 0:s.map(e=>new (0, _chunkYTAW674Lcjs.a)({type:"external-wallet",address:e.publicKey.toString(),locator:`external-wallet:${e.publicKey.toString()}`,onSignTransaction:c=>(c.sign([e]),Promise.resolve(c))}));return yield this.approveAndWait(i.id,a)})}createTransaction(i){return _chunkXALFCQKDcjs.f.call(void 0, this,arguments,function*({transaction:n}){let a=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:_bs582.default.encode(n.serialize())}});if("error"in a)throw new (0, _chunkCT2UGJELcjs.q)(JSON.stringify(a));return a})}};exports.a = d;
|
package/dist/chunk-7L2MNVVS.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkVOVPHLO5cjs = require('./chunk-VOVPHLO5.cjs');var _chunkIQB4HWD3cjs = require('./chunk-IQB4HWD3.cjs');var _chunkRFK6N7LCcjs = require('./chunk-RFK6N7LC.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _ox = require('ox');var S=class{constructor(e){this.apiClient=e}getOrCreateWallet(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(this.apiClient.isServerSide)throw new (0, _chunkCT2UGJELcjs.f)("getOrCreateWallet is not supported on server side");let i=yield this.apiClient.getWallet(`me:${e.chain==="solana"?"solana":"evm"}:smart`);return i!=null&&!("error"in i)?this.createWalletInstance(i,e):this.createWallet(e)})}getWallet(e,i){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(!this.apiClient.isServerSide)throw new (0, _chunkCT2UGJELcjs.f)("getWallet is not supported on client side, use getOrCreateWallet instead");let n=yield this.apiClient.getWallet(e);if("error"in n)throw new (0, _chunkCT2UGJELcjs.d)(JSON.stringify(n));return this.createWalletInstance(n,i)})}createWallet(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var t,r,o,l;yield(o=(r=(t=e.options)==null?void 0:t.experimental_callbacks)==null?void 0:r.onWalletCreationStart)==null?void 0:o.call(r),this.mutateSignerFromCustomAuth(e,!0);let i=e.signer.type==="passkey"?yield this.createPasskeyAdminSigner(e.signer):e.signer,n=yield this.apiClient.createWallet({type:"smart",chainType:e.chain==="solana"?"solana":"evm",config:{adminSigner:i},owner:(l=e.owner)!=null?l:void 0});if("error"in n)throw new (0, _chunkCT2UGJELcjs.f)(JSON.stringify(n));return this.createWalletInstance(n,e)})}createWalletInstance(e,i){this.validateExistingWalletConfig(e,i);let n=this.toInternalSignerConfig(e,i.signer,i.options);return new (0, _chunkVOVPHLO5cjs.a)({chain:i.chain,address:e.address,owner:e.owner,signer:_chunkIQB4HWD3cjs.a.call(void 0, i.chain,n),options:i.options},this.apiClient)}toInternalSignerConfig(e,i,n){var t,r,o,l,p,g;if(!(e.chainType==="evm"||e.chainType==="solana"))throw new (0, _chunkCT2UGJELcjs.f)(`Wallet type ${e.chainType} is not supported`);if(i==null&&((t=e.config)==null?void 0:t.adminSigner)==null)throw new (0, _chunkCT2UGJELcjs.f)("Signer is required to create a wallet");switch(i.type){case"api-key":{if(((r=e.config)==null?void 0:r.adminSigner.type)!=="api-key")throw new (0, _chunkCT2UGJELcjs.f)("API key signer does not match the wallet's signer type");return{type:"api-key",address:e.config.adminSigner.address,locator:e.config.adminSigner.locator}}case"external-wallet":if(((o=e.config)==null?void 0:o.adminSigner.type)!=="external-wallet")throw new (0, _chunkCT2UGJELcjs.f)("External wallet signer does not match the wallet's signer type");return _chunkXALFCQKDcjs.a.call(void 0, _chunkXALFCQKDcjs.a.call(void 0, {},e.config.adminSigner),i);case"passkey":if(((l=e.config)==null?void 0:l.adminSigner.type)!=="passkey")throw new (0, _chunkCT2UGJELcjs.f)("Passkey signer does not match the wallet's signer type");return{type:"passkey",id:e.config.adminSigner.id,name:e.config.adminSigner.name,locator:e.config.adminSigner.locator,onCreatePasskey:i.onCreatePasskey,onSignWithPasskey:i.onSignWithPasskey};case"email":{if(((p=e.config)==null?void 0:p.adminSigner.type)!=="email")throw new (0, _chunkCT2UGJELcjs.f)("Email signer does not match the wallet's signer type");let{locator:c,email:h}=e.config.adminSigner;return{type:"email",email:h,locator:c,crossmint:this.apiClient.crossmint,onAuthRequired:i.onAuthRequired,clientTEEConnection:n==null?void 0:n.clientTEEConnection}}case"phone":{if(((g=e.config)==null?void 0:g.adminSigner.type)!=="phone")throw new (0, _chunkCT2UGJELcjs.f)("Phone signer does not match the wallet's signer type");let{locator:c,phone:h}=e.config.adminSigner;return{type:"phone",phone:h,locator:c,crossmint:this.apiClient.crossmint,onAuthRequired:i.onAuthRequired,clientTEEConnection:n==null?void 0:n.clientTEEConnection}}default:throw new Error("Invalid signer type")}}createPasskeyAdminSigner(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var t;if(e.type!=="passkey")throw new Error("Signer is not a passkey");let i=(t=e.name)!=null?t:`Crossmint Wallet ${Date.now()}`,n=e.onCreatePasskey?yield e.onCreatePasskey(i):yield _ox.WebAuthnP256.createCredential({name:i});return{type:"passkey",id:n.id,name:i,publicKey:{x:n.publicKey.x.toString(),y:n.publicKey.y.toString()}}})}mutateSignerFromCustomAuth(e,i=!1){var t,r;let{experimental_customAuth:n}=this.apiClient.crossmint;e.signer.type==="email"&&(n==null?void 0:n.email)!=null&&(e.signer.email=(t=e.signer.email)!=null?t:n.email),e.signer.type==="phone"&&(n==null?void 0:n.phone)!=null&&(e.signer.phone=(r=e.signer.phone)!=null?r:n.phone),e.signer.type==="external-wallet"&&(n==null?void 0:n.externalWalletSigner)!=null&&(e.signer=i?{type:"external-wallet",address:n.externalWalletSigner.address}:n.externalWalletSigner)}validateExistingWalletConfig(e,i){var r;if(this.mutateSignerFromCustomAuth(i),i.owner!=null&&e.owner!=null&&i.owner!==e.owner)throw new (0, _chunkCT2UGJELcjs.f)("Wallet owner does not match existing wallet's linked user");if(i.chain==="solana"&&e.chainType!=="solana"||i.chain!=="solana"&&e.chainType==="solana")throw new (0, _chunkCT2UGJELcjs.f)(`Wallet chain does not match existing wallet's chain. You must use chain: ${e.chainType}.`);if(e.type!=="smart")return;let n=i.signer,t=(r=e==null?void 0:e.config)==null?void 0:r.adminSigner;if(n!=null&&t!=null){if(n.type!==t.type)throw new (0, _chunkCT2UGJELcjs.f)("The wallet signer type provided in the wallet config does not match the existing wallet's adminSigner type");_chunkRFK6N7LCcjs.a.call(void 0, n,t)}}};exports.a = S;
|
package/dist/chunk-AEZDU2JM.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as p}from"./chunk-JGHXHURY.js";import{k as c,o as d,q as T}from"./chunk-7ENJXL4H.js";import{a as f}from"./chunk-BJDS5BJG.js";import{f as o}from"./chunk-BW7YYVZE.js";import{createPublicClient as E,encodeFunctionData as S,http as V}from"viem";import{isValidEvmAddress as M}from"@crossmint/common-sdk-base";var w=class C extends p{constructor(t){super({chain:t.chain,address:t.address,owner:t.owner,signer:t.signer,options:p.getOptions(t)},p.getApiClient(t))}static from(t){if(!M(t.address))throw new Error("Wallet is not an EVM wallet");return new C(t)}sendTransaction(t){return o(this,null,function*(){var e;let n=this.buildTransaction(t),a=yield this.createTransaction(n);return(e=t.options)!=null&&e.experimental_prepareOnly?{hash:void 0,explorerLink:void 0,transactionId:a.id}:yield this.approveAndWait(a.id)})}signMessage(t){return o(this,null,function*(){var i;let n=yield this.apiClient.createSignature(this.walletLocator,{type:"message",params:{message:t,signer:this.signer.locator(),chain:this.chain}});if("error"in n)throw new d(JSON.stringify(n));let a=n.id,e=((i=n.approvals)==null?void 0:i.pending)||[];return yield this.approveSignature(e,a),yield this.waitForSignature(a)})}signTypedData(t){return o(this,null,function*(){var m;let{domain:n,message:a,primaryType:e,types:i,chain:r}=t;if(!n||!a||!i||!r)throw new c("Invalid typed data");let{name:u,version:l,chainId:h,verifyingContract:y,salt:v}=n;if(!u||!l||!h||!y)throw new c("Invalid typed data domain");let s=yield this.apiClient.createSignature(this.walletLocator,{type:"typed-data",params:{typedData:{domain:{name:u,version:l,chainId:Number(h),verifyingContract:y,salt:v},message:a,primaryType:e,types:i},signer:this.signer.locator(),chain:r,isSmartWalletSignature:!1}});if("error"in s)throw new d(JSON.stringify(s));let g=s.id,D=((m=s.approvals)==null?void 0:m.pending)||[];return yield this.approveSignature(D,g),yield this.waitForSignature(g)})}getViemClient(t){var n;return E({transport:(n=t==null?void 0:t.transport)!=null?n:V(),chain:f(this.chain)})}createTransaction(t){return o(this,null,function*(){let n=yield this.apiClient.createTransaction(this.walletLocator,{params:{signer:this.signer.locator(),chain:this.chain,calls:[t]}});if("error"in n)throw new T(JSON.stringify(n));return n})}buildTransaction(t){var n,a,e,i,r;if("transaction"in t)return{transaction:t.transaction};if(t.abi==null)return{to:t.to,value:(a=(n=t.value)==null?void 0:n.toString())!=null?a:"0",data:(e=t.data)!=null?e:"0x"};if(!t.functionName)throw new Error("Function name is required");return{to:t.to,value:(r=(i=t.value)==null?void 0:i.toString())!=null?r:"0",data:S({abi:t.abi,functionName:t.functionName,args:t.args})}}};export{w as a};
|
package/dist/chunk-BOJW3SWK.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkVOVPHLO5cjs = require('./chunk-VOVPHLO5.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunk6VJEBYPNcjs = require('./chunk-6VJEBYPN.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _viem = require('viem');var _commonsdkbase = require('@crossmint/common-sdk-base');var w=class C extends _chunkVOVPHLO5cjs.a{constructor(t){super({chain:t.chain,address:t.address,owner:t.owner,signer:t.signer,options:_chunkVOVPHLO5cjs.a.getOptions(t)},_chunkVOVPHLO5cjs.a.getApiClient(t))}static from(t){if(!_commonsdkbase.isValidEvmAddress.call(void 0, t.address))throw new Error("Wallet is not an EVM wallet");return new C(t)}sendTransaction(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var e;let n=this.buildTransaction(t),a=yield this.createTransaction(n);return(e=t.options)!=null&&e.experimental_prepareOnly?{hash:void 0,explorerLink:void 0,transactionId:a.id}:yield this.approveAndWait(a.id)})}signMessage(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var i;let n=yield this.apiClient.createSignature(this.walletLocator,{type:"message",params:{message:t,signer:this.signer.locator(),chain:this.chain}});if("error"in n)throw new (0, _chunkCT2UGJELcjs.o)(JSON.stringify(n));let a=n.id,e=((i=n.approvals)==null?void 0:i.pending)||[];return yield this.approveSignature(e,a),yield this.waitForSignature(a)})}signTypedData(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var m;let{domain:n,message:a,primaryType:e,types:i,chain:r}=t;if(!n||!a||!i||!r)throw new (0, _chunkCT2UGJELcjs.k)("Invalid typed data");let{name:u,version:l,chainId:h,verifyingContract:y,salt:v}=n;if(!u||!l||!h||!y)throw new (0, _chunkCT2UGJELcjs.k)("Invalid typed data domain");let s=yield this.apiClient.createSignature(this.walletLocator,{type:"typed-data",params:{typedData:{domain:{name:u,version:l,chainId:Number(h),verifyingContract:y,salt:v},message:a,primaryType:e,types:i},signer:this.signer.locator(),chain:r,isSmartWalletSignature:!1}});if("error"in s)throw new (0, _chunkCT2UGJELcjs.o)(JSON.stringify(s));let g=s.id,D=((m=s.approvals)==null?void 0:m.pending)||[];return yield this.approveSignature(D,g),yield this.waitForSignature(g)})}getViemClient(t){var n;return _viem.createPublicClient.call(void 0, {transport:(n=t==null?void 0:t.transport)!=null?n:_viem.http.call(void 0, ),chain:_chunk6VJEBYPNcjs.a.call(void 0, this.chain)})}createTransaction(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let n=yield this.apiClient.createTransaction(this.walletLocator,{params:{signer:this.signer.locator(),chain:this.chain,calls:[t]}});if("error"in n)throw new (0, _chunkCT2UGJELcjs.q)(JSON.stringify(n));return n})}buildTransaction(t){var n,a,e,i,r;if("transaction"in t)return{transaction:t.transaction};if(t.abi==null)return{to:t.to,value:(a=(n=t.value)==null?void 0:n.toString())!=null?a:"0",data:(e=t.data)!=null?e:"0x"};if(!t.functionName)throw new Error("Function name is required");return{to:t.to,value:(r=(i=t.value)==null?void 0:i.toString())!=null?r:"0",data:_viem.encodeFunctionData.call(void 0, {abi:t.abi,functionName:t.functionName,args:t.args})}}};exports.a = w;
|
package/dist/chunk-EQRZJV6Q.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var s="@crossmint/wallets-sdk",t="0.10.15";var c="WALLETS_SDK",r=t,d=s,a=500;export{c as a,r as b,d as c,a as d};
|
package/dist/chunk-JGHXHURY.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as b}from"./chunk-EQRZJV6Q.js";import{c as E,d as P,i as A,m as W,p as x,q as $,r as L,s as _,t as B,u as F,v as I,w as J}from"./chunk-7ENJXL4H.js";import{a as S,b as N,c as l,d as v,e as C,f as g}from"./chunk-BW7YYVZE.js";import{isValidAddress as G}from"@crossmint/common-sdk-base";var m,o,R=class{constructor(t,n){v(this,m);v(this,o);let{chain:e,address:i,owner:r,signer:p,options:d}=t;C(this,o,n),this.chain=e,this.address=i,this.owner=r,this.signer=p,C(this,m,d)}static getApiClient(t){return t.apiClient}static getOptions(t){return t.options}get apiClient(){return l(this,o)}get options(){return l(this,m)}balances(t,n){return g(this,null,function*(){let e=this.chain==="solana"?"sol":"eth",i=[e,"usdc",...t!=null?t:[]],r=yield l(this,o).getBalance(this.address,{chains:n!=null?n:[this.chain],tokens:i.map(p=>p.toLowerCase())});if("error"in r)throw new Error(`Failed to get balances for wallet: ${JSON.stringify(r.message)}`);return this.transformBalanceResponse(r,e,t)})}transformBalanceResponse(t,n,e){let i=a=>{var w,f,y,T,O;let u=(w=a.chains)==null?void 0:w[this.chain],h="contractAddress"in u?u.contractAddress:void 0;return{symbol:(f=a.symbol)!=null?f:"",name:(y=a.symbol)!=null?y:"",amount:(T=a.amount)!=null?T:"0",contractAddress:h,decimals:a.decimals,rawAmount:(O=a.rawAmount)!=null?O:"0"}},r=t.find(a=>a.symbol===n),p=t.find(a=>a.symbol==="usdc"),d=t.filter(a=>{var u;return a.symbol!==n&&a.symbol!=="usdc"&&(e==null?void 0:e.includes((u=a.symbol)!=null?u:""))}),s=a=>({symbol:a,name:a,amount:"0",contractAddress:void 0,decimals:0,rawAmount:"0"});return{nativeToken:r!=null?i(r):s(n),usdc:p!=null?i(p):s("usdc"),tokens:d.map(i)}}experimental_nfts(t){return g(this,null,function*(){return yield l(this,o).experimental_getNfts(N(S({},t),{chain:this.chain,address:this.address}))})}experimental_transactions(){return g(this,null,function*(){return yield l(this,o).getTransactions(this.walletLocator)})}experimental_transaction(t){return g(this,null,function*(){return yield l(this,o).getTransaction(this.walletLocator,t)})}experimental_activity(){return g(this,null,function*(){let t=yield this.apiClient.experimental_activity(this.walletLocator,{chain:this.chain});if("error"in t)throw new Error(`Failed to get activity: ${JSON.stringify(t.message)}`);return t})}send(t,n,e,i){return g(this,null,function*(){let r=k(t),p=M(n,this.chain),d={recipient:r,amount:e},s=yield l(this,o).send(this.walletLocator,p,d);if("message"in s)throw new $(`Failed to send token: ${JSON.stringify(s.message)}`);return i!=null&&i.experimental_prepareOnly?{hash:void 0,explorerLink:void 0,transactionId:s.id}:yield this.approveAndWait(s.id)})}addDelegatedSigner(t){return g(this,null,function*(){var e,i;let n=yield l(this,o).registerSigner(this.walletLocator,{signer:t.signer,chain:this.chain==="solana"?void 0:this.chain});if("error"in n)throw new Error(`Failed to register signer: ${JSON.stringify(n.message)}`);if("transaction"in n){let r=n.transaction.id;yield this.approveAndWait(r)}else{let r=(e=n.chains)==null?void 0:e[this.chain];if((r==null?void 0:r.status)==="awaiting-approval"){let p=((i=r.approvals)==null?void 0:i.pending)||[];yield this.approveSignature(p,r.id),yield this.waitForSignature(r.id);return}if((r==null?void 0:r.status)==="pending"){yield this.waitForSignature(r.id);return}}})}delegatedSigners(){return g(this,null,function*(){var n,e,i;let t=yield l(this,o).getWallet(this.walletLocator);if("error"in t)throw new P(JSON.stringify(t));if(t.type!=="smart"||t.chainType!=="evm"&&t.chainType!=="solana")throw new E(`Wallet type ${t.type} not supported`);return(i=(e=(n=t==null?void 0:t.config)==null?void 0:n.delegatedSigners)==null?void 0:e.map(r=>{let p=r.locator.indexOf(":");return{signer:`external-wallet:${p>=0?r.locator.slice(p+1):r.locator}`}}))!=null?i:[]})}get walletLocator(){return l(this,o).isServerSide?this.address:`me:${this.chain==="solana"?"solana":"evm"}:smart`}get isSolanaWallet(){return this.chain==="solana"}approveAndWait(t,n){return g(this,null,function*(){return yield this.approveTransaction(t,n),yield this.sleep(1e3),yield this.waitForTransaction(t)})}approveTransaction(t,n){return g(this,null,function*(){var s,a,u,h;let e=yield l(this,o).getTransaction(this.walletLocator,t);if("error"in e)throw new L(JSON.stringify(e));if(yield(u=(a=(s=l(this,m))==null?void 0:s.experimental_callbacks)==null?void 0:a.onTransactionStart)==null?void 0:u.call(a),this.signer.type==="api-key")return e;let i=(h=e.approvals)==null?void 0:h.pending;if(i==null)return e;let r=[...n!=null?n:[],this.signer],p=yield Promise.all(i.map(w=>{let f=r.find(T=>T.locator()===w.signer.locator);if(f==null)throw new A(`Signer ${w.signer} not found in pending approvals`);let y=e.chainType==="solana"&&"transaction"in e.onChain?e.onChain.transaction:w.message;return f.signTransaction(y)})),d=yield l(this,o).approveTransaction(this.walletLocator,e.id,{approvals:p.map(w=>S({signer:this.signer.locator()},w))});if(d.error)throw new J(JSON.stringify(d));return d})}approveSignature(t,n){return g(this,null,function*(){if(this.isSolanaWallet)throw new Error("Approving signatures is only supported for EVM smart wallets");let e=t.find(r=>r.signer.locator===this.signer.locator());if(!e)throw new A(`Signer ${this.signer.locator()} not found in pending approvals`);let i=yield this.signer.signMessage(e.message);return yield l(this,o).approveSignature(this.walletLocator,n,{approvals:[S({signer:this.signer.locator()},i)]}),i})}waitForSignature(t){return g(this,null,function*(){let n=null;do if(yield new Promise(e=>setTimeout(e,b)),n=yield l(this,o).getSignature(this.walletLocator,t),"error"in n)throw new x(JSON.stringify(n));while(n===null||n.status==="pending");if(n.status==="failed")throw new W("Signature signing failed");if(!n.outputSignature)throw new x("Signature not available");return n.outputSignature})}waitForTransaction(p){return g(this,arguments,function*(t,n=6e4,{backoffMultiplier:e=1.1,maxBackoffMs:i=2e3,initialBackoffMs:r=b}={}){var u;let d=Date.now(),s;do{if(Date.now()-d>n)throw new _("Transaction confirmation timeout");if(s=yield l(this,o).getTransaction(this.walletLocator,t),s.error)throw new L(JSON.stringify(s));yield this.sleep(r),r=Math.min(r*e,i)}while(s.status==="pending");if(s.status==="failed")throw new B(`Transaction sending failed: ${JSON.stringify(s.error)}`);if(s.status==="awaiting-approval")throw new F("Transaction is awaiting approval. Please submit required approvals before waiting for completion.");let a=s.onChain.txId;if(a==null)throw new I("Transaction hash not found on transaction response");return{hash:a,explorerLink:(u=s.onChain.explorerLink)!=null?u:"",transactionId:s.id}})}sleep(t){return g(this,null,function*(){return new Promise(n=>setTimeout(n,t))})}};m=new WeakMap,o=new WeakMap;function k(c){if(typeof c=="string")return c;if("email"in c)return`email:${c.email}`;if("x"in c)return`x:${c.x}`;if("twitter"in c)return`twitter:${c.twitter}`;if("phone"in c)return`phoneNumber:${c.phone}`;if("userId"in c)return`userId:${c.userId}`;throw new Error("Invalid recipient locator")}function M(c,t){return G(c)?`${t}:${c}`:`${t}:${c.toLowerCase()}`}export{R as a};
|
package/dist/chunk-MLOSILO2.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkU4S6GWMKcjs = require('./chunk-U4S6GWMK.cjs');var _chunkZSWIQU3Ucjs = require('./chunk-ZSWIQU3U.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var d=class{constructor(t){this.config=t;this._needsAuth=!0;this._authPromise=null;this.initialize(),this.type=this.config.type}initialize(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(this.config.clientTEEConnection==null){let t=_commonsdkbase.validateAPIKey.call(void 0, this.config.crossmint.apiKey);if(!t.isValid)throw new Error("Invalid API key");let r=new (0, _chunkU4S6GWMKcjs.a)({environment:t.environment});this.config.clientTEEConnection=yield r.initialize()}})}handleAuthRequired(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var o,s,a;if(this.config.clientTEEConnection==null)throw new Error("Handshake parent not initialized");let t=yield(a=this.config.clientTEEConnection)==null?void 0:a.sendAction({event:"request:get-status",responseEvent:"response:get-status",data:{authData:{jwt:(s=(o=this.config.crossmint.experimental_customAuth)==null?void 0:o.jwt)!=null?s:"",apiKey:this.config.crossmint.apiKey}},options:h});if((t==null?void 0:t.status)!=="success")throw new Error(t==null?void 0:t.error);if(t.signerStatus==="ready"){this._needsAuth=!1;return}let{promise:r,resolve:i,reject:n}=this.createAuthPromise();if(this._authPromise={promise:r,resolve:i,reject:n},this.config.onAuthRequired)try{yield this.config.onAuthRequired(this._needsAuth,()=>this.sendMessageWithOtp(),e=>this.verifyOtp(e),()=>n(new _chunkZSWIQU3Ucjs.a))}catch(e){n(e)}try{yield r}catch(e){throw e}})}getJwtOrThrow(){var r;let t=(r=this.config.crossmint.experimental_customAuth)==null?void 0:r.jwt;if(t==null)throw new Error("JWT is required");return t}createAuthPromise(){let t,r;return{promise:new Promise((n,o)=>{t=n,r=o}),resolve:t,reject:r}}sendMessageWithOtp(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var n,o,s;if(this.config.clientTEEConnection==null)throw new Error("Handshake parent not initialized");let t=this.config.clientTEEConnection,r=this.getAuthId(),i=yield t.sendAction({event:"request:start-onboarding",responseEvent:"response:start-onboarding",data:{authData:{jwt:(o=(n=this.config.crossmint.experimental_customAuth)==null?void 0:n.jwt)!=null?o:"",apiKey:this.config.crossmint.apiKey},data:{authId:r}},options:h});if((i==null?void 0:i.status)==="success"&&i.signerStatus==="ready"){this._needsAuth=!1;return}(i==null?void 0:i.status)==="error"&&(console.error("[sendMessageWithOtp] Failed to send OTP:",i),(s=this._authPromise)==null||s.reject(new Error(i.error||"Failed to initiate OTP process.")))})}getAuthId(){return this.config.type==="email"?`email:${this.config.email}`:`phone:${this.config.phone}`}verifyOtp(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var i,n,o,s,a;if(this.config.clientTEEConnection==null)throw new Error("Handshake parent not initialized");let r=this.config.clientTEEConnection;try{let e=yield r.sendAction({event:"request:complete-onboarding",responseEvent:"response:complete-onboarding",data:{authData:{jwt:(n=(i=this.config.crossmint.experimental_customAuth)==null?void 0:i.jwt)!=null?n:"",apiKey:this.config.crossmint.apiKey},data:{onboardingAuthentication:{encryptedOtp:t}}},options:h});if((e==null?void 0:e.status)==="success"){this._needsAuth=!1,(o=this._authPromise)==null||o.resolve();return}console.error("[verifyOtp] Failed to validate OTP:",e),this._needsAuth=!0;let g=(e==null?void 0:e.status)==="error"?e.error:"Failed to validate encrypted OTP";(s=this._authPromise)==null||s.reject(new Error(g))}catch(e){throw console.error("[verifyOtp] Error sending OTP validation request:",e),this._needsAuth=!0,(a=this._authPromise)==null||a.reject(e),e}})}},h= exports.b ={timeoutMs:1e4,intervalMs:5e3};exports.a = d; exports.b = h;
|
package/dist/chunk-OEEB24PA.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as d}from"./chunk-JGHXHURY.js";import{a as y}from"./chunk-5U4PVNPM.js";import{a as f}from"./chunk-IJMFCZIY.js";import{d as C,f as a}from"./chunk-7ENJXL4H.js";import{a as m,f as s}from"./chunk-BW7YYVZE.js";import{WebAuthnP256 as u}from"ox";var S=class{constructor(e){this.apiClient=e}getOrCreateWallet(e){return s(this,null,function*(){if(this.apiClient.isServerSide)throw new a("getOrCreateWallet is not supported on server side");let i=yield this.apiClient.getWallet(`me:${e.chain==="solana"?"solana":"evm"}:smart`);return i!=null&&!("error"in i)?this.createWalletInstance(i,e):this.createWallet(e)})}getWallet(e,i){return s(this,null,function*(){if(!this.apiClient.isServerSide)throw new a("getWallet is not supported on client side, use getOrCreateWallet instead");let n=yield this.apiClient.getWallet(e);if("error"in n)throw new C(JSON.stringify(n));return this.createWalletInstance(n,i)})}createWallet(e){return s(this,null,function*(){var t,r,o,l;yield(o=(r=(t=e.options)==null?void 0:t.experimental_callbacks)==null?void 0:r.onWalletCreationStart)==null?void 0:o.call(r),this.mutateSignerFromCustomAuth(e,!0);let i=e.signer.type==="passkey"?yield this.createPasskeyAdminSigner(e.signer):e.signer,n=yield this.apiClient.createWallet({type:"smart",chainType:e.chain==="solana"?"solana":"evm",config:{adminSigner:i},owner:(l=e.owner)!=null?l:void 0});if("error"in n)throw new a(JSON.stringify(n));return this.createWalletInstance(n,e)})}createWalletInstance(e,i){this.validateExistingWalletConfig(e,i);let n=this.toInternalSignerConfig(e,i.signer,i.options);return new d({chain:i.chain,address:e.address,owner:e.owner,signer:y(i.chain,n),options:i.options},this.apiClient)}toInternalSignerConfig(e,i,n){var t,r,o,l,p,g;if(!(e.chainType==="evm"||e.chainType==="solana"))throw new a(`Wallet type ${e.chainType} is not supported`);if(i==null&&((t=e.config)==null?void 0:t.adminSigner)==null)throw new a("Signer is required to create a wallet");switch(i.type){case"api-key":{if(((r=e.config)==null?void 0:r.adminSigner.type)!=="api-key")throw new a("API key signer does not match the wallet's signer type");return{type:"api-key",address:e.config.adminSigner.address,locator:e.config.adminSigner.locator}}case"external-wallet":if(((o=e.config)==null?void 0:o.adminSigner.type)!=="external-wallet")throw new a("External wallet signer does not match the wallet's signer type");return m(m({},e.config.adminSigner),i);case"passkey":if(((l=e.config)==null?void 0:l.adminSigner.type)!=="passkey")throw new a("Passkey signer does not match the wallet's signer type");return{type:"passkey",id:e.config.adminSigner.id,name:e.config.adminSigner.name,locator:e.config.adminSigner.locator,onCreatePasskey:i.onCreatePasskey,onSignWithPasskey:i.onSignWithPasskey};case"email":{if(((p=e.config)==null?void 0:p.adminSigner.type)!=="email")throw new a("Email signer does not match the wallet's signer type");let{locator:c,email:h}=e.config.adminSigner;return{type:"email",email:h,locator:c,crossmint:this.apiClient.crossmint,onAuthRequired:i.onAuthRequired,clientTEEConnection:n==null?void 0:n.clientTEEConnection}}case"phone":{if(((g=e.config)==null?void 0:g.adminSigner.type)!=="phone")throw new a("Phone signer does not match the wallet's signer type");let{locator:c,phone:h}=e.config.adminSigner;return{type:"phone",phone:h,locator:c,crossmint:this.apiClient.crossmint,onAuthRequired:i.onAuthRequired,clientTEEConnection:n==null?void 0:n.clientTEEConnection}}default:throw new Error("Invalid signer type")}}createPasskeyAdminSigner(e){return s(this,null,function*(){var t;if(e.type!=="passkey")throw new Error("Signer is not a passkey");let i=(t=e.name)!=null?t:`Crossmint Wallet ${Date.now()}`,n=e.onCreatePasskey?yield e.onCreatePasskey(i):yield u.createCredential({name:i});return{type:"passkey",id:n.id,name:i,publicKey:{x:n.publicKey.x.toString(),y:n.publicKey.y.toString()}}})}mutateSignerFromCustomAuth(e,i=!1){var t,r;let{experimental_customAuth:n}=this.apiClient.crossmint;e.signer.type==="email"&&(n==null?void 0:n.email)!=null&&(e.signer.email=(t=e.signer.email)!=null?t:n.email),e.signer.type==="phone"&&(n==null?void 0:n.phone)!=null&&(e.signer.phone=(r=e.signer.phone)!=null?r:n.phone),e.signer.type==="external-wallet"&&(n==null?void 0:n.externalWalletSigner)!=null&&(e.signer=i?{type:"external-wallet",address:n.externalWalletSigner.address}:n.externalWalletSigner)}validateExistingWalletConfig(e,i){var r;if(this.mutateSignerFromCustomAuth(i),i.owner!=null&&e.owner!=null&&i.owner!==e.owner)throw new a("Wallet owner does not match existing wallet's linked user");if(i.chain==="solana"&&e.chainType!=="solana"||i.chain!=="solana"&&e.chainType==="solana")throw new a(`Wallet chain does not match existing wallet's chain. You must use chain: ${e.chainType}.`);if(e.type!=="smart")return;let n=i.signer,t=(r=e==null?void 0:e.config)==null?void 0:r.adminSigner;if(n!=null&&t!=null){if(n.type!==t.type)throw new a("The wallet signer type provided in the wallet config does not match the existing wallet's adminSigner type");f(n,t)}}};export{S as a};
|
package/dist/chunk-SGL7VVQD.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as t}from"./chunk-JGHXHURY.js";import{a as l}from"./chunk-SCS4UDW7.js";import{q as p}from"./chunk-7ENJXL4H.js";import{f as r}from"./chunk-BW7YYVZE.js";import m from"bs58";import{isValidSolanaAddress as T}from"@crossmint/common-sdk-base";var d=class u extends t{constructor(n){super({chain:n.chain,address:n.address,owner:n.owner,signer:n.signer},t.getApiClient(n))}static from(n){if(!T(n.address))throw new Error("Wallet is not a Solana wallet");return new u(n)}sendTransaction(n){return r(this,null,function*(){var o,s;let i=yield this.createTransaction(n);if((o=n.options)!=null&&o.experimental_prepareOnly)return{hash:void 0,explorerLink:void 0,transactionId:i.id};let a=(s=n.additionalSigners)==null?void 0:s.map(e=>new l({type:"external-wallet",address:e.publicKey.toString(),locator:`external-wallet:${e.publicKey.toString()}`,onSignTransaction:c=>(c.sign([e]),Promise.resolve(c))}));return yield this.approveAndWait(i.id,a)})}createTransaction(i){return r(this,arguments,function*({transaction:n}){let a=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:m.encode(n.serialize())}});if("error"in a)throw new p(JSON.stringify(a));return a})}};export{d as a};
|
package/dist/chunk-U4S6GWMK.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _clientsdkwindow = require('@crossmint/client-sdk-window');var _clientsigners = require('@crossmint/client-signers');var i=class{constructor(n){this.config=n;this.handshakeParent=null}initialize(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(this.handshakeParent)return this.handshakeParent;let n=new URL(_clientsigners.environmentUrlConfig[this.config.environment]);n.searchParams.set("targetOrigin",window.location.origin);let e=yield this.createInvisibleIFrame(n.toString());return this.handshakeParent=yield _clientsdkwindow.IFrameWindow.init(e,{targetOrigin:n.origin,incomingEvents:_clientsigners.signerOutboundEvents,outgoingEvents:_clientsigners.signerInboundEvents}),yield this.handshakeParent.handshakeWithChild(),this.handshakeParent})}createInvisibleIFrame(n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let e=document.createElement("iframe");return e.src=n,Object.assign(e.style,{position:"absolute",opacity:"0",pointerEvents:"none",width:"0",height:"0",border:"none",top:"-9999px",left:"-9999px"}),new Promise((r,o)=>{e.onload=()=>r(e),e.onerror=()=>o(new Error("Failed to load iframe content")),document.body.appendChild(e)})})}};exports.a = i;
|
package/dist/chunk-VOVPHLO5.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBCOGNFY7cjs = require('./chunk-BCOGNFY7.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var m,o,R= exports.a =class{constructor(t,n){_chunkXALFCQKDcjs.d.call(void 0, this,m);_chunkXALFCQKDcjs.d.call(void 0, this,o);let{chain:e,address:i,owner:r,signer:p,options:d}=t;_chunkXALFCQKDcjs.e.call(void 0, this,o,n),this.chain=e,this.address=i,this.owner=r,this.signer=p,_chunkXALFCQKDcjs.e.call(void 0, this,m,d)}static getApiClient(t){return t.apiClient}static getOptions(t){return t.options}get apiClient(){return _chunkXALFCQKDcjs.c.call(void 0, this,o)}get options(){return _chunkXALFCQKDcjs.c.call(void 0, this,m)}balances(t,n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let e=this.chain==="solana"?"sol":"eth",i=[e,"usdc",...t!=null?t:[]],r=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getBalance(this.address,{chains:n!=null?n:[this.chain],tokens:i.map(p=>p.toLowerCase())});if("error"in r)throw new Error(`Failed to get balances for wallet: ${JSON.stringify(r.message)}`);return this.transformBalanceResponse(r,e,t)})}transformBalanceResponse(t,n,e){let i=a=>{var w,f,y,T,O;let u=(w=a.chains)==null?void 0:w[this.chain],h="contractAddress"in u?u.contractAddress:void 0;return{symbol:(f=a.symbol)!=null?f:"",name:(y=a.symbol)!=null?y:"",amount:(T=a.amount)!=null?T:"0",contractAddress:h,decimals:a.decimals,rawAmount:(O=a.rawAmount)!=null?O:"0"}},r=t.find(a=>a.symbol===n),p=t.find(a=>a.symbol==="usdc"),d=t.filter(a=>{var u;return a.symbol!==n&&a.symbol!=="usdc"&&(e==null?void 0:e.includes((u=a.symbol)!=null?u:""))}),s=a=>({symbol:a,name:a,amount:"0",contractAddress:void 0,decimals:0,rawAmount:"0"});return{nativeToken:r!=null?i(r):s(n),usdc:p!=null?i(p):s("usdc"),tokens:d.map(i)}}experimental_nfts(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield _chunkXALFCQKDcjs.c.call(void 0, this,o).experimental_getNfts(_chunkXALFCQKDcjs.b.call(void 0, _chunkXALFCQKDcjs.a.call(void 0, {},t),{chain:this.chain,address:this.address}))})}experimental_transactions(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getTransactions(this.walletLocator)})}experimental_transaction(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getTransaction(this.walletLocator,t)})}experimental_activity(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let t=yield this.apiClient.experimental_activity(this.walletLocator,{chain:this.chain});if("error"in t)throw new Error(`Failed to get activity: ${JSON.stringify(t.message)}`);return t})}send(t,n,e,i){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let r=k(t),p=M(n,this.chain),d={recipient:r,amount:e},s=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).send(this.walletLocator,p,d);if("message"in s)throw new (0, _chunkCT2UGJELcjs.q)(`Failed to send token: ${JSON.stringify(s.message)}`);return i!=null&&i.experimental_prepareOnly?{hash:void 0,explorerLink:void 0,transactionId:s.id}:yield this.approveAndWait(s.id)})}addDelegatedSigner(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var e,i;let n=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).registerSigner(this.walletLocator,{signer:t.signer,chain:this.chain==="solana"?void 0:this.chain});if("error"in n)throw new Error(`Failed to register signer: ${JSON.stringify(n.message)}`);if("transaction"in n){let r=n.transaction.id;yield this.approveAndWait(r)}else{let r=(e=n.chains)==null?void 0:e[this.chain];if((r==null?void 0:r.status)==="awaiting-approval"){let p=((i=r.approvals)==null?void 0:i.pending)||[];yield this.approveSignature(p,r.id),yield this.waitForSignature(r.id);return}if((r==null?void 0:r.status)==="pending"){yield this.waitForSignature(r.id);return}}})}delegatedSigners(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var n,e,i;let t=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getWallet(this.walletLocator);if("error"in t)throw new (0, _chunkCT2UGJELcjs.d)(JSON.stringify(t));if(t.type!=="smart"||t.chainType!=="evm"&&t.chainType!=="solana")throw new (0, _chunkCT2UGJELcjs.c)(`Wallet type ${t.type} not supported`);return(i=(e=(n=t==null?void 0:t.config)==null?void 0:n.delegatedSigners)==null?void 0:e.map(r=>{let p=r.locator.indexOf(":");return{signer:`external-wallet:${p>=0?r.locator.slice(p+1):r.locator}`}}))!=null?i:[]})}get walletLocator(){return _chunkXALFCQKDcjs.c.call(void 0, this,o).isServerSide?this.address:`me:${this.chain==="solana"?"solana":"evm"}:smart`}get isSolanaWallet(){return this.chain==="solana"}approveAndWait(t,n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.approveTransaction(t,n),yield this.sleep(1e3),yield this.waitForTransaction(t)})}approveTransaction(t,n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var s,a,u,h;let e=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getTransaction(this.walletLocator,t);if("error"in e)throw new (0, _chunkCT2UGJELcjs.r)(JSON.stringify(e));if(yield(u=(a=(s=_chunkXALFCQKDcjs.c.call(void 0, this,m))==null?void 0:s.experimental_callbacks)==null?void 0:a.onTransactionStart)==null?void 0:u.call(a),this.signer.type==="api-key")return e;let i=(h=e.approvals)==null?void 0:h.pending;if(i==null)return e;let r=[...n!=null?n:[],this.signer],p=yield Promise.all(i.map(w=>{let f=r.find(T=>T.locator()===w.signer.locator);if(f==null)throw new (0, _chunkCT2UGJELcjs.i)(`Signer ${w.signer} not found in pending approvals`);let y=e.chainType==="solana"&&"transaction"in e.onChain?e.onChain.transaction:w.message;return f.signTransaction(y)})),d=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).approveTransaction(this.walletLocator,e.id,{approvals:p.map(w=>_chunkXALFCQKDcjs.a.call(void 0, {signer:this.signer.locator()},w))});if(d.error)throw new (0, _chunkCT2UGJELcjs.w)(JSON.stringify(d));return d})}approveSignature(t,n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(this.isSolanaWallet)throw new Error("Approving signatures is only supported for EVM smart wallets");let e=t.find(r=>r.signer.locator===this.signer.locator());if(!e)throw new (0, _chunkCT2UGJELcjs.i)(`Signer ${this.signer.locator()} not found in pending approvals`);let i=yield this.signer.signMessage(e.message);return yield _chunkXALFCQKDcjs.c.call(void 0, this,o).approveSignature(this.walletLocator,n,{approvals:[_chunkXALFCQKDcjs.a.call(void 0, {signer:this.signer.locator()},i)]}),i})}waitForSignature(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let n=null;do if(yield new Promise(e=>setTimeout(e,_chunkBCOGNFY7cjs.d)),n=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getSignature(this.walletLocator,t),"error"in n)throw new (0, _chunkCT2UGJELcjs.p)(JSON.stringify(n));while(n===null||n.status==="pending");if(n.status==="failed")throw new (0, _chunkCT2UGJELcjs.m)("Signature signing failed");if(!n.outputSignature)throw new (0, _chunkCT2UGJELcjs.p)("Signature not available");return n.outputSignature})}waitForTransaction(p){return _chunkXALFCQKDcjs.f.call(void 0, this,arguments,function*(t,n=6e4,{backoffMultiplier:e=1.1,maxBackoffMs:i=2e3,initialBackoffMs:r=_chunkBCOGNFY7cjs.d}={}){var u;let d=Date.now(),s;do{if(Date.now()-d>n)throw new (0, _chunkCT2UGJELcjs.s)("Transaction confirmation timeout");if(s=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getTransaction(this.walletLocator,t),s.error)throw new (0, _chunkCT2UGJELcjs.r)(JSON.stringify(s));yield this.sleep(r),r=Math.min(r*e,i)}while(s.status==="pending");if(s.status==="failed")throw new (0, _chunkCT2UGJELcjs.t)(`Transaction sending failed: ${JSON.stringify(s.error)}`);if(s.status==="awaiting-approval")throw new (0, _chunkCT2UGJELcjs.u)("Transaction is awaiting approval. Please submit required approvals before waiting for completion.");let a=s.onChain.txId;if(a==null)throw new (0, _chunkCT2UGJELcjs.v)("Transaction hash not found on transaction response");return{hash:a,explorerLink:(u=s.onChain.explorerLink)!=null?u:"",transactionId:s.id}})}sleep(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return new Promise(n=>setTimeout(n,t))})}};m=new WeakMap,o=new WeakMap;function k(c){if(typeof c=="string")return c;if("email"in c)return`email:${c.email}`;if("x"in c)return`x:${c.x}`;if("twitter"in c)return`twitter:${c.twitter}`;if("phone"in c)return`phoneNumber:${c.phone}`;if("userId"in c)return`userId:${c.userId}`;throw new Error("Invalid recipient locator")}function M(c,t){return _commonsdkbase.isValidAddress.call(void 0, c)?`${t}:${c}`:`${t}:${c.toLowerCase()}`}exports.a = R;
|
package/dist/chunk-Y5NVCPZ2.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{f as t}from"./chunk-BW7YYVZE.js";import{IFrameWindow as a}from"@crossmint/client-sdk-window";import{environmentUrlConfig as s,signerInboundEvents as m,signerOutboundEvents as h}from"@crossmint/client-signers";var i=class{constructor(n){this.config=n;this.handshakeParent=null}initialize(){return t(this,null,function*(){if(this.handshakeParent)return this.handshakeParent;let n=new URL(s[this.config.environment]);n.searchParams.set("targetOrigin",window.location.origin);let e=yield this.createInvisibleIFrame(n.toString());return this.handshakeParent=yield a.init(e,{targetOrigin:n.origin,incomingEvents:h,outgoingEvents:m}),yield this.handshakeParent.handshakeWithChild(),this.handshakeParent})}createInvisibleIFrame(n){return t(this,null,function*(){let e=document.createElement("iframe");return e.src=n,Object.assign(e.style,{position:"absolute",opacity:"0",pointerEvents:"none",width:"0",height:"0",border:"none",top:"-9999px",left:"-9999px"}),new Promise((r,o)=>{e.onload=()=>r(e),e.onerror=()=>o(new Error("Failed to load iframe content")),document.body.appendChild(e)})})}};export{i as a};
|
package/dist/chunk-YNIO2LU5.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as u}from"./chunk-Y5NVCPZ2.js";import{a as l}from"./chunk-M4ELAV7U.js";import{f as c}from"./chunk-BW7YYVZE.js";import{validateAPIKey as m}from"@crossmint/common-sdk-base";var d=class{constructor(t){this.config=t;this._needsAuth=!0;this._authPromise=null;this.initialize(),this.type=this.config.type}initialize(){return c(this,null,function*(){if(this.config.clientTEEConnection==null){let t=m(this.config.crossmint.apiKey);if(!t.isValid)throw new Error("Invalid API key");let r=new u({environment:t.environment});this.config.clientTEEConnection=yield r.initialize()}})}handleAuthRequired(){return c(this,null,function*(){var o,s,a;if(this.config.clientTEEConnection==null)throw new Error("Handshake parent not initialized");let t=yield(a=this.config.clientTEEConnection)==null?void 0:a.sendAction({event:"request:get-status",responseEvent:"response:get-status",data:{authData:{jwt:(s=(o=this.config.crossmint.experimental_customAuth)==null?void 0:o.jwt)!=null?s:"",apiKey:this.config.crossmint.apiKey}},options:h});if((t==null?void 0:t.status)!=="success")throw new Error(t==null?void 0:t.error);if(t.signerStatus==="ready"){this._needsAuth=!1;return}let{promise:r,resolve:i,reject:n}=this.createAuthPromise();if(this._authPromise={promise:r,resolve:i,reject:n},this.config.onAuthRequired)try{yield this.config.onAuthRequired(this._needsAuth,()=>this.sendMessageWithOtp(),e=>this.verifyOtp(e),()=>n(new l))}catch(e){n(e)}try{yield r}catch(e){throw e}})}getJwtOrThrow(){var r;let t=(r=this.config.crossmint.experimental_customAuth)==null?void 0:r.jwt;if(t==null)throw new Error("JWT is required");return t}createAuthPromise(){let t,r;return{promise:new Promise((n,o)=>{t=n,r=o}),resolve:t,reject:r}}sendMessageWithOtp(){return c(this,null,function*(){var n,o,s;if(this.config.clientTEEConnection==null)throw new Error("Handshake parent not initialized");let t=this.config.clientTEEConnection,r=this.getAuthId(),i=yield t.sendAction({event:"request:start-onboarding",responseEvent:"response:start-onboarding",data:{authData:{jwt:(o=(n=this.config.crossmint.experimental_customAuth)==null?void 0:n.jwt)!=null?o:"",apiKey:this.config.crossmint.apiKey},data:{authId:r}},options:h});if((i==null?void 0:i.status)==="success"&&i.signerStatus==="ready"){this._needsAuth=!1;return}(i==null?void 0:i.status)==="error"&&(console.error("[sendMessageWithOtp] Failed to send OTP:",i),(s=this._authPromise)==null||s.reject(new Error(i.error||"Failed to initiate OTP process.")))})}getAuthId(){return this.config.type==="email"?`email:${this.config.email}`:`phone:${this.config.phone}`}verifyOtp(t){return c(this,null,function*(){var i,n,o,s,a;if(this.config.clientTEEConnection==null)throw new Error("Handshake parent not initialized");let r=this.config.clientTEEConnection;try{let e=yield r.sendAction({event:"request:complete-onboarding",responseEvent:"response:complete-onboarding",data:{authData:{jwt:(n=(i=this.config.crossmint.experimental_customAuth)==null?void 0:i.jwt)!=null?n:"",apiKey:this.config.crossmint.apiKey},data:{onboardingAuthentication:{encryptedOtp:t}}},options:h});if((e==null?void 0:e.status)==="success"){this._needsAuth=!1,(o=this._authPromise)==null||o.resolve();return}console.error("[verifyOtp] Failed to validate OTP:",e),this._needsAuth=!0;let g=(e==null?void 0:e.status)==="error"?e.error:"Failed to validate encrypted OTP";(s=this._authPromise)==null||s.reject(new Error(g))}catch(e){throw console.error("[verifyOtp] Error sending OTP validation request:",e),this._needsAuth=!0,(a=this._authPromise)==null||a.reject(e),e}})}},h={timeoutMs:1e4,intervalMs:5e3};export{d as a,h as b};
|