@crossmint/wallets-sdk 0.9.6 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/dist/api/client.cjs +1 -1
  2. package/dist/api/client.js +1 -1
  3. package/dist/api/index.cjs +1 -1
  4. package/dist/api/index.js +1 -1
  5. package/dist/{chunk-YUXGNX2R.cjs → chunk-33ZMLROF.cjs} +1 -1
  6. package/dist/{chunk-UVQDAYSR.js → chunk-37FBC6CT.js} +1 -1
  7. package/dist/chunk-3D5RTPTJ.js +1 -0
  8. package/dist/chunk-5HTPBFDH.cjs +1 -0
  9. package/dist/chunk-AFYBD7FI.cjs +1 -0
  10. package/dist/chunk-DIZVZP5P.cjs +1 -0
  11. package/dist/{chunk-STSNT4Z6.js → chunk-DXPZTNTR.js} +1 -1
  12. package/dist/{chunk-NQYAOPHP.cjs → chunk-EXGOZRL3.cjs} +1 -1
  13. package/dist/chunk-GVFGQUCO.cjs +1 -0
  14. package/dist/{chunk-W3EMZ2Y7.js → chunk-IIS42MVC.js} +1 -1
  15. package/dist/{chunk-RDZYRVMZ.cjs → chunk-JKPTRQD2.cjs} +1 -1
  16. package/dist/{chunk-HMQIDZ53.cjs → chunk-MSKWNMPV.cjs} +1 -1
  17. package/dist/{chunk-BXVLIZ6G.js → chunk-NIEQGTTW.js} +1 -1
  18. package/dist/{chunk-BASQXCCA.js → chunk-OGGPNJY3.js} +1 -1
  19. package/dist/{chunk-5K5HFPJQ.cjs → chunk-PSBX4PZW.cjs} +1 -1
  20. package/dist/{chunk-UYFBYHIT.cjs → chunk-QK3HMP6H.cjs} +1 -1
  21. package/dist/chunk-QTSZSHKK.js +1 -0
  22. package/dist/{chunk-JASS6LGM.js → chunk-QTZTCEUF.js} +1 -1
  23. package/dist/chunk-T3ICQDFS.js +1 -0
  24. package/dist/chunk-VBWFY7JR.js +1 -0
  25. package/dist/{chunk-LWQ7YF46.js → chunk-VELN4PVT.js} +1 -1
  26. package/dist/{chunk-KTTTMBOT.cjs → chunk-WFS45YN4.cjs} +1 -1
  27. package/dist/chunk-XLWK4XHD.cjs +1 -0
  28. package/dist/{chunk-GCWUK6WO.js → chunk-YHRRQBIE.js} +1 -1
  29. package/dist/index.cjs +1 -1
  30. package/dist/index.d.cts +2 -2
  31. package/dist/index.d.ts +2 -2
  32. package/dist/index.js +1 -1
  33. package/dist/sdk.cjs +1 -1
  34. package/dist/sdk.d.cts +1 -1
  35. package/dist/sdk.d.ts +1 -1
  36. package/dist/sdk.js +1 -1
  37. package/dist/signers/email/email-signer-api-client.cjs +1 -1
  38. package/dist/signers/email/email-signer-api-client.js +1 -1
  39. package/dist/signers/email/email.cjs +1 -1
  40. package/dist/signers/email/email.d.cts +1 -2
  41. package/dist/signers/email/email.d.ts +1 -2
  42. package/dist/signers/email/email.js +1 -1
  43. package/dist/signers/email/index.cjs +1 -1
  44. package/dist/signers/email/index.d.cts +1 -2
  45. package/dist/signers/email/index.d.ts +1 -2
  46. package/dist/signers/email/index.js +1 -1
  47. package/dist/signers/evm-api-key.d.cts +1 -2
  48. package/dist/signers/evm-api-key.d.ts +1 -2
  49. package/dist/signers/evm-external-wallet.cjs +1 -1
  50. package/dist/signers/evm-external-wallet.d.cts +2 -3
  51. package/dist/signers/evm-external-wallet.d.ts +2 -3
  52. package/dist/signers/evm-external-wallet.js +1 -1
  53. package/dist/signers/index.cjs +1 -1
  54. package/dist/signers/index.d.cts +0 -1
  55. package/dist/signers/index.d.ts +0 -1
  56. package/dist/signers/index.js +1 -1
  57. package/dist/signers/passkey.d.cts +1 -2
  58. package/dist/signers/passkey.d.ts +1 -2
  59. package/dist/signers/solana-api-key.d.cts +1 -2
  60. package/dist/signers/solana-api-key.d.ts +1 -2
  61. package/dist/signers/solana-external-wallet.cjs +1 -1
  62. package/dist/signers/solana-external-wallet.d.cts +3 -3
  63. package/dist/signers/solana-external-wallet.d.ts +3 -3
  64. package/dist/signers/solana-external-wallet.js +1 -1
  65. package/dist/signers/types.d.cts +4 -23
  66. package/dist/signers/types.d.ts +4 -23
  67. package/dist/utils/constants.cjs +1 -1
  68. package/dist/utils/constants.js +1 -1
  69. package/dist/wallets/evm.cjs +1 -1
  70. package/dist/wallets/evm.js +1 -1
  71. package/dist/wallets/solana.cjs +1 -1
  72. package/dist/wallets/solana.js +1 -1
  73. package/dist/wallets/wallet-factory.cjs +1 -1
  74. package/dist/wallets/wallet-factory.d.cts +1 -1
  75. package/dist/wallets/wallet-factory.d.ts +1 -1
  76. package/dist/wallets/wallet-factory.js +1 -1
  77. package/dist/wallets/wallet.cjs +1 -1
  78. package/dist/wallets/wallet.d.cts +2 -2
  79. package/dist/wallets/wallet.d.ts +2 -2
  80. package/dist/wallets/wallet.js +1 -1
  81. package/package.json +3 -3
  82. package/dist/chunk-2AWC6KEP.js +0 -1
  83. package/dist/chunk-3FUD4JAM.cjs +0 -1
  84. package/dist/chunk-57EIEFQU.cjs +0 -1
  85. package/dist/chunk-LFYI7K4T.js +0 -1
  86. package/dist/chunk-LQKXECMQ.js +0 -1
  87. package/dist/chunk-R7KEBAQ2.js +0 -1
  88. package/dist/chunk-TWQ6DA3Y.cjs +0 -1
  89. package/dist/chunk-V3CBWWX2.cjs +0 -1
  90. package/dist/chunk-YAORQK6R.cjs +0 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkNQYAOPHPcjs = require('../chunk-NQYAOPHP.cjs');require('../chunk-V3CBWWX2.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-XALFCQKD.cjs');exports.ApiClient = _chunkNQYAOPHPcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkEXGOZRL3cjs = require('../chunk-EXGOZRL3.cjs');require('../chunk-5HTPBFDH.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-XALFCQKD.cjs');exports.ApiClient = _chunkEXGOZRL3cjs.a;
@@ -1 +1 @@
1
- import{a}from"../chunk-LWQ7YF46.js";import"../chunk-LQKXECMQ.js";import"../chunk-7ENJXL4H.js";import"../chunk-BW7YYVZE.js";export{a as ApiClient};
1
+ import{a}from"../chunk-VELN4PVT.js";import"../chunk-3D5RTPTJ.js";import"../chunk-7ENJXL4H.js";import"../chunk-BW7YYVZE.js";export{a as ApiClient};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-6HXIZLEQ.cjs');var _chunkNQYAOPHPcjs = require('../chunk-NQYAOPHP.cjs');require('../chunk-V3CBWWX2.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-ECAM5KTH.cjs');require('../chunk-XALFCQKD.cjs');exports.ApiClient = _chunkNQYAOPHPcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-6HXIZLEQ.cjs');var _chunkEXGOZRL3cjs = require('../chunk-EXGOZRL3.cjs');require('../chunk-5HTPBFDH.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-ECAM5KTH.cjs');require('../chunk-XALFCQKD.cjs');exports.ApiClient = _chunkEXGOZRL3cjs.a;
package/dist/api/index.js CHANGED
@@ -1 +1 @@
1
- import"../chunk-5IFDVB4Y.js";import{a}from"../chunk-LWQ7YF46.js";import"../chunk-LQKXECMQ.js";import"../chunk-7ENJXL4H.js";import"../chunk-KBJA7JDT.js";import"../chunk-BW7YYVZE.js";export{a as ApiClient};
1
+ import"../chunk-5IFDVB4Y.js";import{a}from"../chunk-VELN4PVT.js";import"../chunk-3D5RTPTJ.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});var _chunk5K5HFPJQcjs = require('./chunk-5K5HFPJQ.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunk6VJEBYPNcjs = require('./chunk-6VJEBYPN.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _viem = require('viem');var C=class v extends _chunk5K5HFPJQcjs.a{constructor(t){super({chain:t.chain,address:t.address,owner:t.owner,signer:t.signer,options:_chunk5K5HFPJQcjs.a.getOptions(t)},_chunk5K5HFPJQcjs.a.getApiClient(t))}static from(t){return new v(t)}sendTransaction(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var i;let a=yield this.apiClient.createTransaction(this.walletLocator,{params:{signer:this.signer.locator(),chain:this.chain,calls:[{to:t.to,value:t.value?t.value.toString():"0",data:(i=t.data)!=null?i:"0x"}]}});if("error"in a)throw new (0, _chunkCT2UGJELcjs.q)(JSON.stringify(a));return yield this.approveAndWait(a.id)})}signMessage(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var n;let a=yield this.apiClient.createSignature(this.walletLocator,{type:"evm-message",params:{message:t,signer:this.signer.locator(),chain:this.chain}});if("error"in a)throw new (0, _chunkCT2UGJELcjs.o)(JSON.stringify(a));let i=a.id,o=((n=a.approvals)==null?void 0:n.pending)||[];return yield this.approveSignature(o,i),yield this.waitForSignature(i)})}createTypedDataSignature(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var u;let{domain:a,message:i,primaryType:o,types:n,chain:d}=t;if(!a||!i||!n||!d)throw new (0, _chunkCT2UGJELcjs.k)("Invalid typed data");let{name:g,version:h,chainId:y,verifyingContract:m,salt:D}=a;if(!g||!h||!y||!m)throw new (0, _chunkCT2UGJELcjs.k)("Invalid typed data domain");let e=yield this.apiClient.createSignature(this.walletLocator,{type:"evm-typed-data",params:{typedData:{domain:{name:g,version:h,chainId:Number(y),verifyingContract:m,salt:D},message:i,primaryType:o,types:n},signer:this.signer.locator(),chain:d,isSmartWalletSignature:!1}});if("error"in e)throw new (0, _chunkCT2UGJELcjs.o)(JSON.stringify(e));let l=e.id,T=((u=e.approvals)==null?void 0:u.pending)||[];return yield this.approveSignature(T,l),yield this.waitForSignature(l)})}getViemClient(t){var a;return _viem.createPublicClient.call(void 0, {transport:(a=t==null?void 0:t.transport)!=null?a:_viem.http.call(void 0, ),chain:_chunk6VJEBYPNcjs.a.call(void 0, this.chain)})}};exports.a = C;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkPSBX4PZWcjs = require('./chunk-PSBX4PZW.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunk6VJEBYPNcjs = require('./chunk-6VJEBYPN.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _viem = require('viem');var C=class v extends _chunkPSBX4PZWcjs.a{constructor(t){super({chain:t.chain,address:t.address,owner:t.owner,signer:t.signer,options:_chunkPSBX4PZWcjs.a.getOptions(t)},_chunkPSBX4PZWcjs.a.getApiClient(t))}static from(t){return new v(t)}sendTransaction(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var i;let a=yield this.apiClient.createTransaction(this.walletLocator,{params:{signer:this.signer.locator(),chain:this.chain,calls:[{to:t.to,value:t.value?t.value.toString():"0",data:(i=t.data)!=null?i:"0x"}]}});if("error"in a)throw new (0, _chunkCT2UGJELcjs.q)(JSON.stringify(a));return yield this.approveAndWait(a.id)})}signMessage(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var n;let a=yield this.apiClient.createSignature(this.walletLocator,{type:"evm-message",params:{message:t,signer:this.signer.locator(),chain:this.chain}});if("error"in a)throw new (0, _chunkCT2UGJELcjs.o)(JSON.stringify(a));let i=a.id,o=((n=a.approvals)==null?void 0:n.pending)||[];return yield this.approveSignature(o,i),yield this.waitForSignature(i)})}createTypedDataSignature(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var u;let{domain:a,message:i,primaryType:o,types:n,chain:d}=t;if(!a||!i||!n||!d)throw new (0, _chunkCT2UGJELcjs.k)("Invalid typed data");let{name:g,version:h,chainId:y,verifyingContract:m,salt:D}=a;if(!g||!h||!y||!m)throw new (0, _chunkCT2UGJELcjs.k)("Invalid typed data domain");let e=yield this.apiClient.createSignature(this.walletLocator,{type:"evm-typed-data",params:{typedData:{domain:{name:g,version:h,chainId:Number(y),verifyingContract:m,salt:D},message:i,primaryType:o,types:n},signer:this.signer.locator(),chain:d,isSmartWalletSignature:!1}});if("error"in e)throw new (0, _chunkCT2UGJELcjs.o)(JSON.stringify(e));let l=e.id,T=((u=e.approvals)==null?void 0:u.pending)||[];return yield this.approveSignature(T,l),yield this.waitForSignature(l)})}getViemClient(t){var a;return _viem.createPublicClient.call(void 0, {transport:(a=t==null?void 0:t.transport)!=null?a:_viem.http.call(void 0, ),chain:_chunk6VJEBYPNcjs.a.call(void 0, this.chain)})}};exports.a = C;
@@ -1 +1 @@
1
- import{a as d}from"./chunk-GCWUK6WO.js";import{a as y}from"./chunk-JASS6LGM.js";import{a as m}from"./chunk-2AWC6KEP.js";import{a as C}from"./chunk-FUUYGB4K.js";import{d as c,f as r}from"./chunk-7ENJXL4H.js";import{f as s}from"./chunk-BW7YYVZE.js";import{WebAuthnP256 as h}from"ox";var f=class{constructor(e){this.apiClient=e}getOrCreateWallet(e){return s(this,null,function*(){if(this.apiClient.isServerSide)throw new r("getOrCreateWallet is not supported on server side");let t=yield this.apiClient.getWallet(`me:${e.chain==="solana"?"solana-smart-wallet":"evm-smart-wallet"}`);return t&&!("error"in t)?(yield this.validateWalletConfig(t,e),this.createWalletInstance(t,e)):this.createWallet(e)})}getWallet(e,t){return s(this,null,function*(){if(!this.apiClient.isServerSide)throw new r("getWallet is not supported on client side, use getOrCreateWallet instead");let i=yield this.apiClient.getWallet(e);if("error"in i)throw new c(JSON.stringify(i));return this.createWalletInstance(i,t)})}createWallet(e){return s(this,null,function*(){var a,n,o,l,p;yield(o=(n=(a=e.options)==null?void 0:a.experimental_callbacks)==null?void 0:n.onWalletCreationStart)==null?void 0:o.call(n);let t;e.chain==="solana"?t={type:"solana-smart-wallet",config:{adminSigner:yield this.configureSigner(e.chain,e.signer)},linkedUser:(l=e.owner)!=null?l:void 0}:t={type:"evm-smart-wallet",config:{adminSigner:yield this.configureSigner(e.chain,e.signer)},linkedUser:(p=e.owner)!=null?p:void 0};let i=yield this.apiClient.createWallet(t);if("error"in i)throw new r(JSON.stringify(i));return this.createWalletInstance(i,e)})}createWalletInstance(e,t){let i=this.toInternalSignerConfig(e,t.signer);return new d({chain:t.chain,address:e.address,signer:y(t.chain,i),options:t.options},this.apiClient)}toInternalSignerConfig(e,t){var i,a;if(t==null)throw new r("Signer is required to create a wallet");switch(t.type){case"api-key":{let n;switch(e.type){case"solana-smart-wallet":n=e.config.adminSigner.address;break;case"evm-smart-wallet":e.config.adminSigner.type==="evm-fireblocks-custodial"&&(n=e.config.adminSigner.address);break}if(n==null)throw new r("Wallet signer 'api-key' has no address");return{type:"api-key",address:n}}case"external-wallet":return t;case"passkey":if(e.type==="evm-smart-wallet"&&e.config.adminSigner.type==="evm-passkey")return{type:"passkey",id:e.config.adminSigner.id,name:e.config.adminSigner.name,onCreatePasskey:t.onCreatePasskey,onSignWithPasskey:t.onSignWithPasskey};throw new r("Passkey signer is not supported for this wallet type");case"email":{if(e.type!=="solana-smart-wallet"||e.config.adminSigner.type!=="solana-keypair")throw new r("Wallet signer 'email' has no address");let n=e.config.adminSigner.address;return{type:"email",email:(a=t.email)!=null?a:(i=this.apiClient.crossmint.experimental_customAuth)==null?void 0:i.email,signerAddress:n,crossmint:this.apiClient.crossmint,onAuthRequired:t.onAuthRequired,_handshakeParent:t._handshakeParent}}default:throw new Error("Invalid signer type")}}configureSigner(e,t){return s(this,null,function*(){var i;if((t==null?void 0:t.type)==="passkey"){let a=(i=t.name)!=null?i:`Crossmint Wallet ${Date.now()}`,n=t.onCreatePasskey?yield t.onCreatePasskey(a):yield h.createCredential({name:a});return{type:"evm-passkey",id:n.id,name:a,publicKey:{x:n.publicKey.x.toString(),y:n.publicKey.y.toString()}}}return yield this.toExternalSignerConfig(e,t)})}toExternalSignerConfig(e,t,i){return s(this,null,function*(){var a,n;if(!t||t.type==="api-key")return{type:e==="solana"?"solana-fireblocks-custodial":"evm-fireblocks-custodial"};if(t.type==="external-wallet")return{type:e==="solana"?"solana-keypair":"evm-keypair",address:t.address};if(t.type==="passkey"&&i!=null){if((i==null?void 0:i.type)!=="evm-smart-wallet"||i.config.adminSigner.type!=="evm-passkey")throw new r("Passkey signer is not supported for this wallet type");return{type:"evm-passkey",id:i.config.adminSigner.id,name:i.config.adminSigner.name,publicKey:{x:i.config.adminSigner.publicKey.x,y:i.config.adminSigner.publicKey.y}}}if(t.type==="email"){let o=(n=t.email)!=null?n:(a=this.apiClient.crossmint.experimental_customAuth)==null?void 0:a.email;if(o==null)throw new Error("Email is required to create a wallet with email signer");if(e!=="solana")throw new Error("Email signer is only supported for Solana wallets");return{type:"solana-keypair",address:yield m.pregenerateSigner(o,this.apiClient.crossmint)}}throw new Error("Invalid signer type")})}validateWalletConfig(e,t){return s(this,null,function*(){if(t.owner!=null&&e.linkedUser!=null&&t.owner!==e.linkedUser)throw new r("Wallet owner does not match existing wallet's linked user");if(e.type!=="solana-smart-wallet"&&e.type!=="evm-smart-wallet")return;let i=yield this.toExternalSignerConfig(t.chain,t.signer,e),a=e.config.adminSigner;if(i&&a){if(i.type!==a.type)throw new r("The wallet signer type provided in the wallet config does not match the existing wallet's adminSigner type");C(i,a)}})}};export{f as a};
1
+ import{a as d}from"./chunk-YHRRQBIE.js";import{a as y}from"./chunk-QTZTCEUF.js";import{a as m}from"./chunk-VBWFY7JR.js";import{a as C}from"./chunk-FUUYGB4K.js";import{d as c,f as r}from"./chunk-7ENJXL4H.js";import{f as s}from"./chunk-BW7YYVZE.js";import{WebAuthnP256 as h}from"ox";var f=class{constructor(e){this.apiClient=e}getOrCreateWallet(e){return s(this,null,function*(){if(this.apiClient.isServerSide)throw new r("getOrCreateWallet is not supported on server side");let t=yield this.apiClient.getWallet(`me:${e.chain==="solana"?"solana-smart-wallet":"evm-smart-wallet"}`);return t&&!("error"in t)?(yield this.validateWalletConfig(t,e),this.createWalletInstance(t,e)):this.createWallet(e)})}getWallet(e,t){return s(this,null,function*(){if(!this.apiClient.isServerSide)throw new r("getWallet is not supported on client side, use getOrCreateWallet instead");let i=yield this.apiClient.getWallet(e);if("error"in i)throw new c(JSON.stringify(i));return this.createWalletInstance(i,t)})}createWallet(e){return s(this,null,function*(){var a,n,o,l,p;yield(o=(n=(a=e.options)==null?void 0:a.experimental_callbacks)==null?void 0:n.onWalletCreationStart)==null?void 0:o.call(n);let t;e.chain==="solana"?t={type:"solana-smart-wallet",config:{adminSigner:yield this.configureSigner(e.chain,e.signer)},linkedUser:(l=e.owner)!=null?l:void 0}:t={type:"evm-smart-wallet",config:{adminSigner:yield this.configureSigner(e.chain,e.signer)},linkedUser:(p=e.owner)!=null?p:void 0};let i=yield this.apiClient.createWallet(t);if("error"in i)throw new r(JSON.stringify(i));return this.createWalletInstance(i,e)})}createWalletInstance(e,t){let i=this.toInternalSignerConfig(e,t.signer);return new d({chain:t.chain,address:e.address,signer:y(t.chain,i),options:t.options},this.apiClient)}toInternalSignerConfig(e,t){var i,a;if(t==null)throw new r("Signer is required to create a wallet");switch(t.type){case"api-key":{let n;switch(e.type){case"solana-smart-wallet":n=e.config.adminSigner.address;break;case"evm-smart-wallet":e.config.adminSigner.type==="evm-fireblocks-custodial"&&(n=e.config.adminSigner.address);break}if(n==null)throw new r("Wallet signer 'api-key' has no address");return{type:"api-key",address:n}}case"external-wallet":return t;case"passkey":if(e.type==="evm-smart-wallet"&&e.config.adminSigner.type==="evm-passkey")return{type:"passkey",id:e.config.adminSigner.id,name:e.config.adminSigner.name,onCreatePasskey:t.onCreatePasskey,onSignWithPasskey:t.onSignWithPasskey};throw new r("Passkey signer is not supported for this wallet type");case"email":{if(e.type!=="solana-smart-wallet"||e.config.adminSigner.type!=="solana-keypair")throw new r("Wallet signer 'email' has no address");let n=e.config.adminSigner.address;return{type:"email",email:(a=t.email)!=null?a:(i=this.apiClient.crossmint.experimental_customAuth)==null?void 0:i.email,signerAddress:n,crossmint:this.apiClient.crossmint,onAuthRequired:t.onAuthRequired,_handshakeParent:t._handshakeParent}}default:throw new Error("Invalid signer type")}}configureSigner(e,t){return s(this,null,function*(){var i;if((t==null?void 0:t.type)==="passkey"){let a=(i=t.name)!=null?i:`Crossmint Wallet ${Date.now()}`,n=t.onCreatePasskey?yield t.onCreatePasskey(a):yield h.createCredential({name:a});return{type:"evm-passkey",id:n.id,name:a,publicKey:{x:n.publicKey.x.toString(),y:n.publicKey.y.toString()}}}return yield this.toExternalSignerConfig(e,t)})}toExternalSignerConfig(e,t,i){return s(this,null,function*(){var a,n;if(!t||t.type==="api-key")return{type:e==="solana"?"solana-fireblocks-custodial":"evm-fireblocks-custodial"};if(t.type==="external-wallet")return{type:e==="solana"?"solana-keypair":"evm-keypair",address:t.address};if(t.type==="passkey"&&i!=null){if((i==null?void 0:i.type)!=="evm-smart-wallet"||i.config.adminSigner.type!=="evm-passkey")throw new r("Passkey signer is not supported for this wallet type");return{type:"evm-passkey",id:i.config.adminSigner.id,name:i.config.adminSigner.name,publicKey:{x:i.config.adminSigner.publicKey.x,y:i.config.adminSigner.publicKey.y}}}if(t.type==="email"){let o=(n=t.email)!=null?n:(a=this.apiClient.crossmint.experimental_customAuth)==null?void 0:a.email;if(o==null)throw new Error("Email is required to create a wallet with email signer");if(e!=="solana")throw new Error("Email signer is only supported for Solana wallets");return{type:"solana-keypair",address:yield m.pregenerateSigner(o,this.apiClient.crossmint)}}throw new Error("Invalid signer type")})}validateWalletConfig(e,t){return s(this,null,function*(){if(t.owner!=null&&e.linkedUser!=null&&t.owner!==e.linkedUser)throw new r("Wallet owner does not match existing wallet's linked user");if(e.type!=="solana-smart-wallet"&&e.type!=="evm-smart-wallet")return;let i=yield this.toExternalSignerConfig(t.chain,t.signer,e),a=e.config.adminSigner;if(i&&a){if(i.type!==a.type)throw new r("The wallet signer type provided in the wallet config does not match the existing wallet's adminSigner type");C(i,a)}})}};export{f as a};
@@ -0,0 +1 @@
1
+ var s="@crossmint/wallets-sdk",t="0.10.0";var c="WALLETS_SDK",r=t,d=s,a=500;export{c as a,r as b,d as c,a as d};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var s="@crossmint/wallets-sdk",t="0.10.0";var p="WALLETS_SDK",c= exports.b =t,r= exports.c =s,d= exports.d =500;exports.a = p; exports.b = c; exports.c = r; exports.d = d;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _web3js = require('@solana/web3.js');var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);var o=class{constructor(n){this.type="external-wallet";if(n.address==null)throw new Error("Please provide an address for the External Wallet Signer");this.address=n.address,this.onSignTransaction=n.onSignTransaction}locator(){return`solana-keypair:${this.address}`}signMessage(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for solana external wallet signer"))})}signTransaction(n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(this.onSignTransaction==null)return yield Promise.reject(new Error("onSignTransaction method is required to sign transactions with a Solana external wallet"));let l=_bs582.default.decode(n),c=_web3js.VersionedTransaction.deserialize(l),t=yield this.onSignTransaction(c),d=new (0, _web3js.PublicKey)(this.address),a=t.message.staticAccountKeys.findIndex(u=>u.equals(d));if(a===-1)throw new (0, _chunkCT2UGJELcjs.w)("Wallet public key not found in transaction signers");let s=t.signatures[a];if(s==null)throw new (0, _chunkCT2UGJELcjs.w)("No valid signature found in the transaction");let g=new Uint8Array(Object.values(s));return{signature:_bs582.default.encode(g)}})}};exports.a = o;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var t=class{constructor(e){this.type="external-wallet";if(e.address==null)throw new Error("Please provide an address for the External Wallet Signer");this.address=e.address,this.provider=e.provider,this.viemAccount=e.viemAccount}locator(){return`evm-keypair:${this.address}`}signMessage(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var i;if(this.provider!=null){let r=yield this.provider.request({method:"personal_sign",params:[e,this.address]});if(r==null)throw new Error("[EVMExternalWalletSigner] Failed to sign message: EIP1193 provider signMessage returned null");return{signature:r}}if(((i=this.viemAccount)==null?void 0:i.signMessage)!=null){let r=yield this.viemAccount.signMessage({message:{raw:e}});if(r==null)throw new Error("[EVMExternalWalletSigner] Failed to sign message: Viem account signMessage returned null");return{signature:r}}throw new Error("No signer provider or viem account provided")})}signTransaction(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.signMessage(e)})}};exports.a = t;
@@ -1 +1 @@
1
- import{a as s}from"./chunk-GCWUK6WO.js";import{k as p,o as c,q as f}from"./chunk-7ENJXL4H.js";import{a as w}from"./chunk-BJDS5BJG.js";import{f as r}from"./chunk-BW7YYVZE.js";import{createPublicClient as S,http as E}from"viem";var C=class v extends s{constructor(t){super({chain:t.chain,address:t.address,owner:t.owner,signer:t.signer,options:s.getOptions(t)},s.getApiClient(t))}static from(t){return new v(t)}sendTransaction(t){return r(this,null,function*(){var i;let a=yield this.apiClient.createTransaction(this.walletLocator,{params:{signer:this.signer.locator(),chain:this.chain,calls:[{to:t.to,value:t.value?t.value.toString():"0",data:(i=t.data)!=null?i:"0x"}]}});if("error"in a)throw new f(JSON.stringify(a));return yield this.approveAndWait(a.id)})}signMessage(t){return r(this,null,function*(){var n;let a=yield this.apiClient.createSignature(this.walletLocator,{type:"evm-message",params:{message:t,signer:this.signer.locator(),chain:this.chain}});if("error"in a)throw new c(JSON.stringify(a));let i=a.id,o=((n=a.approvals)==null?void 0:n.pending)||[];return yield this.approveSignature(o,i),yield this.waitForSignature(i)})}createTypedDataSignature(t){return r(this,null,function*(){var u;let{domain:a,message:i,primaryType:o,types:n,chain:d}=t;if(!a||!i||!n||!d)throw new p("Invalid typed data");let{name:g,version:h,chainId:y,verifyingContract:m,salt:D}=a;if(!g||!h||!y||!m)throw new p("Invalid typed data domain");let e=yield this.apiClient.createSignature(this.walletLocator,{type:"evm-typed-data",params:{typedData:{domain:{name:g,version:h,chainId:Number(y),verifyingContract:m,salt:D},message:i,primaryType:o,types:n},signer:this.signer.locator(),chain:d,isSmartWalletSignature:!1}});if("error"in e)throw new c(JSON.stringify(e));let l=e.id,T=((u=e.approvals)==null?void 0:u.pending)||[];return yield this.approveSignature(T,l),yield this.waitForSignature(l)})}getViemClient(t){var a;return S({transport:(a=t==null?void 0:t.transport)!=null?a:E(),chain:w(this.chain)})}};export{C as a};
1
+ import{a as s}from"./chunk-YHRRQBIE.js";import{k as p,o as c,q as f}from"./chunk-7ENJXL4H.js";import{a as w}from"./chunk-BJDS5BJG.js";import{f as r}from"./chunk-BW7YYVZE.js";import{createPublicClient as S,http as E}from"viem";var C=class v extends s{constructor(t){super({chain:t.chain,address:t.address,owner:t.owner,signer:t.signer,options:s.getOptions(t)},s.getApiClient(t))}static from(t){return new v(t)}sendTransaction(t){return r(this,null,function*(){var i;let a=yield this.apiClient.createTransaction(this.walletLocator,{params:{signer:this.signer.locator(),chain:this.chain,calls:[{to:t.to,value:t.value?t.value.toString():"0",data:(i=t.data)!=null?i:"0x"}]}});if("error"in a)throw new f(JSON.stringify(a));return yield this.approveAndWait(a.id)})}signMessage(t){return r(this,null,function*(){var n;let a=yield this.apiClient.createSignature(this.walletLocator,{type:"evm-message",params:{message:t,signer:this.signer.locator(),chain:this.chain}});if("error"in a)throw new c(JSON.stringify(a));let i=a.id,o=((n=a.approvals)==null?void 0:n.pending)||[];return yield this.approveSignature(o,i),yield this.waitForSignature(i)})}createTypedDataSignature(t){return r(this,null,function*(){var u;let{domain:a,message:i,primaryType:o,types:n,chain:d}=t;if(!a||!i||!n||!d)throw new p("Invalid typed data");let{name:g,version:h,chainId:y,verifyingContract:m,salt:D}=a;if(!g||!h||!y||!m)throw new p("Invalid typed data domain");let e=yield this.apiClient.createSignature(this.walletLocator,{type:"evm-typed-data",params:{typedData:{domain:{name:g,version:h,chainId:Number(y),verifyingContract:m,salt:D},message:i,primaryType:o,types:n},signer:this.signer.locator(),chain:d,isSmartWalletSignature:!1}});if("error"in e)throw new c(JSON.stringify(e));let l=e.id,T=((u=e.approvals)==null?void 0:u.pending)||[];return yield this.approveSignature(T,l),yield this.waitForSignature(l)})}getViemClient(t){var a;return S({transport:(a=t==null?void 0:t.transport)!=null?a:E(),chain:w(this.chain)})}};export{C as a};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkV3CBWWX2cjs = require('./chunk-V3CBWWX2.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:_chunkV3CBWWX2cjs.c,version:_chunkV3CBWWX2cjs.b}}});this.apiPrefix="api/2022-06-09/wallets"}createWallet(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let s=this.isServerSide?`${this.apiPrefix}`:`${this.apiPrefix}/me`;return(yield this.post(s,{body:JSON.stringify(e),headers:this.headers})).json()})}getWallet(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}`,{headers:this.headers})).json()})}createTransaction(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveTransaction(e,s,t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions/${s}/approvals`,{body:JSON.stringify(t),headers:this.headers})).json()})}getTransaction(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions/${s}`,{headers:this.headers})).json()})}createSignature(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signatures`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveSignature(e,s,t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signatures/${s}/approvals`,{body:JSON.stringify(t),headers:this.headers})).json()})}getSignature(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/signatures/${s}`,{headers:this.headers})).json()})}getTransactions(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions`,{headers:this.headers})).json()})}unstable_getNfts(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let s=new URLSearchParams;s.append("page",e.page.toString()),s.append("perPage",e.perPage.toString());let t=`${e.chain}:${e.address}`;return(yield this.get(`${this.apiPrefix}/${t}/nfts?${s.toString()}`,{headers:this.headers})).json()})}experimental_activity(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let t=new URLSearchParams;return t.append("chain",s.chain.toString()),(yield this.get(`${this.apiPrefix}/${e}/activity?${t.toString()}`,{headers:this.headers})).json()})}getBalance(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let t=new URLSearchParams;return t.append("tokenLocators",s.tokens.join(",")),t.append("chains",s.chains.join(",")),(yield this.get(`api/unstable/wallets/${e}/balances?${t.toString()}`,{headers:this.headers})).json()})}registerSigner(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signers`,{body:JSON.stringify(s),headers:this.headers})).json()})}getSigner(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/signers/${s}`,{headers:this.headers})).json()})}send(e,s,t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.post(`api/unstable/wallets/${e}/tokens/${s}/transfers`,{body:JSON.stringify(t),headers:this.headers})).json()})}get isServerSide(){return this.parsedAPIKey.usageOrigin===_commonsdkbase.APIKeyUsageOrigin.SERVER}get environment(){if(!this.parsedAPIKey.isValid)throw new (0, _chunkCT2UGJELcjs.a)("Invalid API key");return this.parsedAPIKey.environment}get headers(){return{"Content-Type":"application/json"}}};exports.a = p;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk5HTPBFDHcjs = require('./chunk-5HTPBFDH.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:_chunk5HTPBFDHcjs.c,version:_chunk5HTPBFDHcjs.b}}});this.apiPrefix="api/2022-06-09/wallets"}createWallet(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let s=this.isServerSide?`${this.apiPrefix}`:`${this.apiPrefix}/me`;return(yield this.post(s,{body:JSON.stringify(e),headers:this.headers})).json()})}getWallet(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}`,{headers:this.headers})).json()})}createTransaction(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveTransaction(e,s,t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions/${s}/approvals`,{body:JSON.stringify(t),headers:this.headers})).json()})}getTransaction(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions/${s}`,{headers:this.headers})).json()})}createSignature(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signatures`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveSignature(e,s,t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signatures/${s}/approvals`,{body:JSON.stringify(t),headers:this.headers})).json()})}getSignature(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/signatures/${s}`,{headers:this.headers})).json()})}getTransactions(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions`,{headers:this.headers})).json()})}unstable_getNfts(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let s=new URLSearchParams;s.append("page",e.page.toString()),s.append("perPage",e.perPage.toString());let t=`${e.chain}:${e.address}`;return(yield this.get(`${this.apiPrefix}/${t}/nfts?${s.toString()}`,{headers:this.headers})).json()})}experimental_activity(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let t=new URLSearchParams;return t.append("chain",s.chain.toString()),(yield this.get(`${this.apiPrefix}/${e}/activity?${t.toString()}`,{headers:this.headers})).json()})}getBalance(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let t=new URLSearchParams;return t.append("tokenLocators",s.tokens.join(",")),t.append("chains",s.chains.join(",")),(yield this.get(`api/unstable/wallets/${e}/balances?${t.toString()}`,{headers:this.headers})).json()})}registerSigner(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signers`,{body:JSON.stringify(s),headers:this.headers})).json()})}getSigner(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/signers/${s}`,{headers:this.headers})).json()})}send(e,s,t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.post(`api/unstable/wallets/${e}/tokens/${s}/transfers`,{body:JSON.stringify(t),headers:this.headers})).json()})}get isServerSide(){return this.parsedAPIKey.usageOrigin===_commonsdkbase.APIKeyUsageOrigin.SERVER}get environment(){if(!this.parsedAPIKey.isValid)throw new (0, _chunkCT2UGJELcjs.a)("Invalid API key");return this.parsedAPIKey.environment}get headers(){return{"Content-Type":"application/json"}}};exports.a = p;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkXLWK4XHDcjs = require('./chunk-XLWK4XHD.cjs');var _chunkDYRSQN7Xcjs = require('./chunk-DYRSQN7X.cjs');var _chunkNVJN7LPYcjs = require('./chunk-NVJN7LPY.cjs');var _chunkAFYBD7FIcjs = require('./chunk-AFYBD7FI.cjs');var _chunkYO6BJ2DIcjs = require('./chunk-YO6BJ2DI.cjs');var _chunkDIZVZP5Pcjs = require('./chunk-DIZVZP5P.cjs');function w(r,e){switch(e.type){case"email":return new (0, _chunkXLWK4XHDcjs.a)(e);case"api-key":return r==="solana"?new (0, _chunkNVJN7LPYcjs.a)(e):new (0, _chunkYO6BJ2DIcjs.a)(e);case"external-wallet":return r==="solana"?new (0, _chunkAFYBD7FIcjs.a)(e):new (0, _chunkDIZVZP5Pcjs.a)(e);case"passkey":return new (0, _chunkDYRSQN7Xcjs.a)(e)}}exports.a = w;
@@ -1 +1 @@
1
- import{a as t}from"./chunk-GCWUK6WO.js";import{a as c}from"./chunk-LFYI7K4T.js";import{q as s}from"./chunk-7ENJXL4H.js";import{f as i}from"./chunk-BW7YYVZE.js";import f from"bs58";var p=class m extends t{constructor(r){super({chain:r.chain,address:r.address,owner:r.owner,signer:r.signer},t.getApiClient(r))}static from(r){return new m(r)}sendTransaction(W){return i(this,arguments,function*({transaction:r,additionalSigners:n}){let l={transaction:f.encode(r.serialize())},a=yield this.apiClient.createTransaction(this.walletLocator,{params:l});if(a.error)throw new s(JSON.stringify(a));let h=n==null?void 0:n.map(o=>new c({type:"external-wallet",address:o.publicKey.toString(),onSignTransaction:e=>(e.sign([o]),Promise.resolve(e))}));return yield this.approveAndWait(a.id,h)})}};export{p as a};
1
+ import{a as t}from"./chunk-YHRRQBIE.js";import{a as c}from"./chunk-T3ICQDFS.js";import{q as s}from"./chunk-7ENJXL4H.js";import{f as i}from"./chunk-BW7YYVZE.js";import f from"bs58";var p=class m extends t{constructor(r){super({chain:r.chain,address:r.address,owner:r.owner,signer:r.signer},t.getApiClient(r))}static from(r){return new m(r)}sendTransaction(W){return i(this,arguments,function*({transaction:r,additionalSigners:n}){let l={transaction:f.encode(r.serialize())},a=yield this.apiClient.createTransaction(this.walletLocator,{params:l});if(a.error)throw new s(JSON.stringify(a));let h=n==null?void 0:n.map(o=>new c({type:"external-wallet",address:o.publicKey.toString(),onSignTransaction:e=>(e.sign([o]),Promise.resolve(e))}));return yield this.approveAndWait(a.id,h)})}};export{p as a};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk5K5HFPJQcjs = require('./chunk-5K5HFPJQ.cjs');var _chunk57EIEFQUcjs = require('./chunk-57EIEFQU.cjs');var _chunk3FUD4JAMcjs = require('./chunk-3FUD4JAM.cjs');var _chunkRD5PG4M6cjs = require('./chunk-RD5PG4M6.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _ox = require('ox');var f=class{constructor(e){this.apiClient=e}getOrCreateWallet(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(this.apiClient.isServerSide)throw new (0, _chunkCT2UGJELcjs.f)("getOrCreateWallet is not supported on server side");let t=yield this.apiClient.getWallet(`me:${e.chain==="solana"?"solana-smart-wallet":"evm-smart-wallet"}`);return t&&!("error"in t)?(yield this.validateWalletConfig(t,e),this.createWalletInstance(t,e)):this.createWallet(e)})}getWallet(e,t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(!this.apiClient.isServerSide)throw new (0, _chunkCT2UGJELcjs.f)("getWallet is not supported on client side, use getOrCreateWallet instead");let i=yield this.apiClient.getWallet(e);if("error"in i)throw new (0, _chunkCT2UGJELcjs.d)(JSON.stringify(i));return this.createWalletInstance(i,t)})}createWallet(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var a,n,o,l,p;yield(o=(n=(a=e.options)==null?void 0:a.experimental_callbacks)==null?void 0:n.onWalletCreationStart)==null?void 0:o.call(n);let t;e.chain==="solana"?t={type:"solana-smart-wallet",config:{adminSigner:yield this.configureSigner(e.chain,e.signer)},linkedUser:(l=e.owner)!=null?l:void 0}:t={type:"evm-smart-wallet",config:{adminSigner:yield this.configureSigner(e.chain,e.signer)},linkedUser:(p=e.owner)!=null?p:void 0};let i=yield this.apiClient.createWallet(t);if("error"in i)throw new (0, _chunkCT2UGJELcjs.f)(JSON.stringify(i));return this.createWalletInstance(i,e)})}createWalletInstance(e,t){let i=this.toInternalSignerConfig(e,t.signer);return new (0, _chunk5K5HFPJQcjs.a)({chain:t.chain,address:e.address,signer:_chunk57EIEFQUcjs.a.call(void 0, t.chain,i),options:t.options},this.apiClient)}toInternalSignerConfig(e,t){var i,a;if(t==null)throw new (0, _chunkCT2UGJELcjs.f)("Signer is required to create a wallet");switch(t.type){case"api-key":{let n;switch(e.type){case"solana-smart-wallet":n=e.config.adminSigner.address;break;case"evm-smart-wallet":e.config.adminSigner.type==="evm-fireblocks-custodial"&&(n=e.config.adminSigner.address);break}if(n==null)throw new (0, _chunkCT2UGJELcjs.f)("Wallet signer 'api-key' has no address");return{type:"api-key",address:n}}case"external-wallet":return t;case"passkey":if(e.type==="evm-smart-wallet"&&e.config.adminSigner.type==="evm-passkey")return{type:"passkey",id:e.config.adminSigner.id,name:e.config.adminSigner.name,onCreatePasskey:t.onCreatePasskey,onSignWithPasskey:t.onSignWithPasskey};throw new (0, _chunkCT2UGJELcjs.f)("Passkey signer is not supported for this wallet type");case"email":{if(e.type!=="solana-smart-wallet"||e.config.adminSigner.type!=="solana-keypair")throw new (0, _chunkCT2UGJELcjs.f)("Wallet signer 'email' has no address");let n=e.config.adminSigner.address;return{type:"email",email:(a=t.email)!=null?a:(i=this.apiClient.crossmint.experimental_customAuth)==null?void 0:i.email,signerAddress:n,crossmint:this.apiClient.crossmint,onAuthRequired:t.onAuthRequired,_handshakeParent:t._handshakeParent}}default:throw new Error("Invalid signer type")}}configureSigner(e,t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var i;if((t==null?void 0:t.type)==="passkey"){let a=(i=t.name)!=null?i:`Crossmint Wallet ${Date.now()}`,n=t.onCreatePasskey?yield t.onCreatePasskey(a):yield _ox.WebAuthnP256.createCredential({name:a});return{type:"evm-passkey",id:n.id,name:a,publicKey:{x:n.publicKey.x.toString(),y:n.publicKey.y.toString()}}}return yield this.toExternalSignerConfig(e,t)})}toExternalSignerConfig(e,t,i){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var a,n;if(!t||t.type==="api-key")return{type:e==="solana"?"solana-fireblocks-custodial":"evm-fireblocks-custodial"};if(t.type==="external-wallet")return{type:e==="solana"?"solana-keypair":"evm-keypair",address:t.address};if(t.type==="passkey"&&i!=null){if((i==null?void 0:i.type)!=="evm-smart-wallet"||i.config.adminSigner.type!=="evm-passkey")throw new (0, _chunkCT2UGJELcjs.f)("Passkey signer is not supported for this wallet type");return{type:"evm-passkey",id:i.config.adminSigner.id,name:i.config.adminSigner.name,publicKey:{x:i.config.adminSigner.publicKey.x,y:i.config.adminSigner.publicKey.y}}}if(t.type==="email"){let o=(n=t.email)!=null?n:(a=this.apiClient.crossmint.experimental_customAuth)==null?void 0:a.email;if(o==null)throw new Error("Email is required to create a wallet with email signer");if(e!=="solana")throw new Error("Email signer is only supported for Solana wallets");return{type:"solana-keypair",address:yield _chunk3FUD4JAMcjs.a.pregenerateSigner(o,this.apiClient.crossmint)}}throw new Error("Invalid signer type")})}validateWalletConfig(e,t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(t.owner!=null&&e.linkedUser!=null&&t.owner!==e.linkedUser)throw new (0, _chunkCT2UGJELcjs.f)("Wallet owner does not match existing wallet's linked user");if(e.type!=="solana-smart-wallet"&&e.type!=="evm-smart-wallet")return;let i=yield this.toExternalSignerConfig(t.chain,t.signer,e),a=e.config.adminSigner;if(i&&a){if(i.type!==a.type)throw new (0, _chunkCT2UGJELcjs.f)("The wallet signer type provided in the wallet config does not match the existing wallet's adminSigner type");_chunkRD5PG4M6cjs.a.call(void 0, i,a)}})}};exports.a = f;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkPSBX4PZWcjs = require('./chunk-PSBX4PZW.cjs');var _chunkGVFGQUCOcjs = require('./chunk-GVFGQUCO.cjs');var _chunkXLWK4XHDcjs = require('./chunk-XLWK4XHD.cjs');var _chunkRD5PG4M6cjs = require('./chunk-RD5PG4M6.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _ox = require('ox');var f=class{constructor(e){this.apiClient=e}getOrCreateWallet(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(this.apiClient.isServerSide)throw new (0, _chunkCT2UGJELcjs.f)("getOrCreateWallet is not supported on server side");let t=yield this.apiClient.getWallet(`me:${e.chain==="solana"?"solana-smart-wallet":"evm-smart-wallet"}`);return t&&!("error"in t)?(yield this.validateWalletConfig(t,e),this.createWalletInstance(t,e)):this.createWallet(e)})}getWallet(e,t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(!this.apiClient.isServerSide)throw new (0, _chunkCT2UGJELcjs.f)("getWallet is not supported on client side, use getOrCreateWallet instead");let i=yield this.apiClient.getWallet(e);if("error"in i)throw new (0, _chunkCT2UGJELcjs.d)(JSON.stringify(i));return this.createWalletInstance(i,t)})}createWallet(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var a,n,o,l,p;yield(o=(n=(a=e.options)==null?void 0:a.experimental_callbacks)==null?void 0:n.onWalletCreationStart)==null?void 0:o.call(n);let t;e.chain==="solana"?t={type:"solana-smart-wallet",config:{adminSigner:yield this.configureSigner(e.chain,e.signer)},linkedUser:(l=e.owner)!=null?l:void 0}:t={type:"evm-smart-wallet",config:{adminSigner:yield this.configureSigner(e.chain,e.signer)},linkedUser:(p=e.owner)!=null?p:void 0};let i=yield this.apiClient.createWallet(t);if("error"in i)throw new (0, _chunkCT2UGJELcjs.f)(JSON.stringify(i));return this.createWalletInstance(i,e)})}createWalletInstance(e,t){let i=this.toInternalSignerConfig(e,t.signer);return new (0, _chunkPSBX4PZWcjs.a)({chain:t.chain,address:e.address,signer:_chunkGVFGQUCOcjs.a.call(void 0, t.chain,i),options:t.options},this.apiClient)}toInternalSignerConfig(e,t){var i,a;if(t==null)throw new (0, _chunkCT2UGJELcjs.f)("Signer is required to create a wallet");switch(t.type){case"api-key":{let n;switch(e.type){case"solana-smart-wallet":n=e.config.adminSigner.address;break;case"evm-smart-wallet":e.config.adminSigner.type==="evm-fireblocks-custodial"&&(n=e.config.adminSigner.address);break}if(n==null)throw new (0, _chunkCT2UGJELcjs.f)("Wallet signer 'api-key' has no address");return{type:"api-key",address:n}}case"external-wallet":return t;case"passkey":if(e.type==="evm-smart-wallet"&&e.config.adminSigner.type==="evm-passkey")return{type:"passkey",id:e.config.adminSigner.id,name:e.config.adminSigner.name,onCreatePasskey:t.onCreatePasskey,onSignWithPasskey:t.onSignWithPasskey};throw new (0, _chunkCT2UGJELcjs.f)("Passkey signer is not supported for this wallet type");case"email":{if(e.type!=="solana-smart-wallet"||e.config.adminSigner.type!=="solana-keypair")throw new (0, _chunkCT2UGJELcjs.f)("Wallet signer 'email' has no address");let n=e.config.adminSigner.address;return{type:"email",email:(a=t.email)!=null?a:(i=this.apiClient.crossmint.experimental_customAuth)==null?void 0:i.email,signerAddress:n,crossmint:this.apiClient.crossmint,onAuthRequired:t.onAuthRequired,_handshakeParent:t._handshakeParent}}default:throw new Error("Invalid signer type")}}configureSigner(e,t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var i;if((t==null?void 0:t.type)==="passkey"){let a=(i=t.name)!=null?i:`Crossmint Wallet ${Date.now()}`,n=t.onCreatePasskey?yield t.onCreatePasskey(a):yield _ox.WebAuthnP256.createCredential({name:a});return{type:"evm-passkey",id:n.id,name:a,publicKey:{x:n.publicKey.x.toString(),y:n.publicKey.y.toString()}}}return yield this.toExternalSignerConfig(e,t)})}toExternalSignerConfig(e,t,i){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var a,n;if(!t||t.type==="api-key")return{type:e==="solana"?"solana-fireblocks-custodial":"evm-fireblocks-custodial"};if(t.type==="external-wallet")return{type:e==="solana"?"solana-keypair":"evm-keypair",address:t.address};if(t.type==="passkey"&&i!=null){if((i==null?void 0:i.type)!=="evm-smart-wallet"||i.config.adminSigner.type!=="evm-passkey")throw new (0, _chunkCT2UGJELcjs.f)("Passkey signer is not supported for this wallet type");return{type:"evm-passkey",id:i.config.adminSigner.id,name:i.config.adminSigner.name,publicKey:{x:i.config.adminSigner.publicKey.x,y:i.config.adminSigner.publicKey.y}}}if(t.type==="email"){let o=(n=t.email)!=null?n:(a=this.apiClient.crossmint.experimental_customAuth)==null?void 0:a.email;if(o==null)throw new Error("Email is required to create a wallet with email signer");if(e!=="solana")throw new Error("Email signer is only supported for Solana wallets");return{type:"solana-keypair",address:yield _chunkXLWK4XHDcjs.a.pregenerateSigner(o,this.apiClient.crossmint)}}throw new Error("Invalid signer type")})}validateWalletConfig(e,t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(t.owner!=null&&e.linkedUser!=null&&t.owner!==e.linkedUser)throw new (0, _chunkCT2UGJELcjs.f)("Wallet owner does not match existing wallet's linked user");if(e.type!=="solana-smart-wallet"&&e.type!=="evm-smart-wallet")return;let i=yield this.toExternalSignerConfig(t.chain,t.signer,e),a=e.config.adminSigner;if(i&&a){if(i.type!==a.type)throw new (0, _chunkCT2UGJELcjs.f)("The wallet signer type provided in the wallet config does not match the existing wallet's adminSigner type");_chunkRD5PG4M6cjs.a.call(void 0, i,a)}})}};exports.a = f;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkRDZYRVMZcjs = require('./chunk-RDZYRVMZ.cjs');var _chunkNQYAOPHPcjs = require('./chunk-NQYAOPHP.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var i=class o{constructor(t){let r=new (0, _chunkNQYAOPHPcjs.a)(t);this.walletFactory=new (0, _chunkRDZYRVMZcjs.a)(r)}static from(t){return new o(t)}getOrCreateWallet(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.walletFactory.getOrCreateWallet(t)})}getWallet(t,r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.walletFactory.getWallet(t,r)})}createWallet(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.walletFactory.createWallet(t)})}};exports.a = _commonsdkbase.createCrossmint; exports.b = i;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkJKPTRQD2cjs = require('./chunk-JKPTRQD2.cjs');var _chunkEXGOZRL3cjs = require('./chunk-EXGOZRL3.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var i=class o{constructor(t){let r=new (0, _chunkEXGOZRL3cjs.a)(t);this.walletFactory=new (0, _chunkJKPTRQD2cjs.a)(r)}static from(t){return new o(t)}getOrCreateWallet(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.walletFactory.getOrCreateWallet(t)})}getWallet(t,r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.walletFactory.getWallet(t,r)})}createWallet(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.walletFactory.createWallet(t)})}};exports.a = _commonsdkbase.createCrossmint; exports.b = i;
@@ -1 +1 @@
1
- import{a as l}from"./chunk-UVQDAYSR.js";import{a}from"./chunk-LWQ7YF46.js";import{f as e}from"./chunk-BW7YYVZE.js";import{createCrossmint as C}from"@crossmint/common-sdk-base";var i=class o{constructor(t){let r=new a(t);this.walletFactory=new l(r)}static from(t){return new o(t)}getOrCreateWallet(t){return e(this,null,function*(){return yield this.walletFactory.getOrCreateWallet(t)})}getWallet(t,r){return e(this,null,function*(){return yield this.walletFactory.getWallet(t,r)})}createWallet(t){return e(this,null,function*(){return yield this.walletFactory.createWallet(t)})}};export{C as a,i as b};
1
+ import{a as l}from"./chunk-37FBC6CT.js";import{a}from"./chunk-VELN4PVT.js";import{f as e}from"./chunk-BW7YYVZE.js";import{createCrossmint as C}from"@crossmint/common-sdk-base";var i=class o{constructor(t){let r=new a(t);this.walletFactory=new l(r)}static from(t){return new o(t)}getOrCreateWallet(t){return e(this,null,function*(){return yield this.walletFactory.getOrCreateWallet(t)})}getWallet(t,r){return e(this,null,function*(){return yield this.walletFactory.getWallet(t,r)})}createWallet(t){return e(this,null,function*(){return yield this.walletFactory.createWallet(t)})}};export{C as a,i as b};
@@ -1 +1 @@
1
- import{b as i,c as s}from"./chunk-LQKXECMQ.js";import{a as n}from"./chunk-7ENJXL4H.js";import{f as t}from"./chunk-BW7YYVZE.js";import{APIKeyUsageOrigin as p,CrossmintApiClient as d}from"@crossmint/common-sdk-base";var a=class extends d{constructor(e){super(e,{internalConfig:{sdkMetadata:{name:s,version:i}}});this.apiPrefix="api/v1/signers"}pregenerateSigner(e){return t(this,null,function*(){let r=yield this.post(`${this.apiPrefix}/derive-public-key`,{body:JSON.stringify({authId:`email:${e}`,keyType:"ed25519"}),headers:this.headers});if(!r.ok){let o=yield r.text();throw new Error(`Failed to fetch public key: ${r.status} ${o}`)}return yield r.json()})}get isServerSide(){return this.parsedAPIKey.usageOrigin===p.SERVER}get environment(){if(!this.parsedAPIKey.isValid)throw new n("Invalid API key");return this.parsedAPIKey.environment}get headers(){return{"Content-Type":"application/json"}}};export{a};
1
+ import{b as i,c as s}from"./chunk-3D5RTPTJ.js";import{a as n}from"./chunk-7ENJXL4H.js";import{f as t}from"./chunk-BW7YYVZE.js";import{APIKeyUsageOrigin as p,CrossmintApiClient as d}from"@crossmint/common-sdk-base";var a=class extends d{constructor(e){super(e,{internalConfig:{sdkMetadata:{name:s,version:i}}});this.apiPrefix="api/v1/signers"}pregenerateSigner(e){return t(this,null,function*(){let r=yield this.post(`${this.apiPrefix}/derive-public-key`,{body:JSON.stringify({authId:`email:${e}`,keyType:"ed25519"}),headers:this.headers});if(!r.ok){let o=yield r.text();throw new Error(`Failed to fetch public key: ${r.status} ${o}`)}return yield r.json()})}get isServerSide(){return this.parsedAPIKey.usageOrigin===p.SERVER}get environment(){if(!this.parsedAPIKey.isValid)throw new n("Invalid API key");return this.parsedAPIKey.environment}get headers(){return{"Content-Type":"application/json"}}};export{a};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkV3CBWWX2cjs = require('./chunk-V3CBWWX2.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var w,o,I= exports.a =class{constructor({chain:t,address:i,owner:r,signer:s,options:n},e){_chunkXALFCQKDcjs.d.call(void 0, this,w);_chunkXALFCQKDcjs.d.call(void 0, this,o);_chunkXALFCQKDcjs.e.call(void 0, this,o,e),this.chain=t,this.address=i,this.owner=r,this.signer=s,_chunkXALFCQKDcjs.e.call(void 0, this,w,n)}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,w)}balances(t,i){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let r=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getBalance(this.address,{chains:i!=null?i:[this.chain],tokens:t});if("error"in r)throw new Error(`Failed to get balances for wallet: ${JSON.stringify(r.error)}`);return r})}unstable_nfts(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield _chunkXALFCQKDcjs.c.call(void 0, this,o).unstable_getNfts(_chunkXALFCQKDcjs.b.call(void 0, _chunkXALFCQKDcjs.a.call(void 0, {},t),{chain:this.chain,address:this.address}))})}unstable_transactions(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getTransactions(this.walletLocator)})}experimental_activity(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let t=yield this.apiClient.experimental_activity(this.walletLocator,{chain:this.chain});if("error"in t)throw new Error(`Failed to get activity: ${JSON.stringify(t.error)}`);return t})}send(t,i,r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let s=k(t),n=U(i,this.chain),e={recipient:s,amount:r},c=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).send(this.walletLocator,n,e);if("message"in c)throw new (0, _chunkCT2UGJELcjs.q)(`Failed to send token: ${JSON.stringify(c.message)}`);return yield this.approveAndWait(c.id)})}addDelegatedSigner(i){return _chunkXALFCQKDcjs.f.call(void 0, this,arguments,function*({signer:t}){var s,n;let r=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).registerSigner(this.walletLocator,{signer:t,chain:this.chain==="solana"?void 0:this.chain});if("error"in r)throw new Error(`Failed to register signer: ${JSON.stringify(r.error)}`);if("transaction"in r){let e=r.transaction.id;yield this.approveAndWait(e)}else{let e=(s=r.chains)==null?void 0:s[this.chain];if((e==null?void 0:e.status)==="awaiting-approval"){let c=((n=e.approvals)==null?void 0:n.pending)||[];yield this.approveSignature(c,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 i,r,s;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!=="solana-smart-wallet"&&t.type!=="evm-smart-wallet")throw new (0, _chunkCT2UGJELcjs.c)(`Wallet type ${t.type} not supported`);return(s=(r=(i=t==null?void 0:t.config)==null?void 0:i.delegatedSigners)==null?void 0:r.map(n=>{let e=n.locator.indexOf(":");return{signer:`external-wallet:${e>=0?n.locator.slice(e+1):n.locator}`}}))!=null?s:[]})}get walletLocator(){return _chunkXALFCQKDcjs.c.call(void 0, this,o).isServerSide?this.address:`me:${this.isSolanaWallet?"solana-smart-wallet":"evm-smart-wallet"}`}get isSolanaWallet(){return this.chain==="solana"}approveAndWait(t,i){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.approveTransaction(t,i),yield this.sleep(1e3),yield this.waitForTransaction(t)})}approveTransaction(t,i){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var g,h,u,b;let r=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getTransaction(this.walletLocator,t);if(r.error)throw new (0, _chunkCT2UGJELcjs.r)(JSON.stringify(r));if(yield(u=(h=(g=_chunkXALFCQKDcjs.c.call(void 0, this,w))==null?void 0:g.experimental_callbacks)==null?void 0:h.onTransactionStart)==null?void 0:u.call(h),this.signer.type==="api-key")return r;let s=(b=r.approvals)==null?void 0:b.pending;if(s==null)return r;let n=[...i!=null?i:[],this.signer],e=yield Promise.all(s.map(d=>{let A=n.find(D=>D.locator()===d.signer);if(A==null)throw new (0, _chunkCT2UGJELcjs.i)(`Signer ${d.signer} not found in pending approvals`);let J=r.walletType==="solana-smart-wallet"?r.onChain.transaction:d.message;return A.signTransaction(J)})),c=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).approveTransaction(this.walletLocator,r.id,{approvals:e.map(d=>_chunkXALFCQKDcjs.a.call(void 0, {signer:this.signer.locator()},d))});if(c.error)throw new (0, _chunkCT2UGJELcjs.w)(JSON.stringify(c));return c})}approveSignature(t,i){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(this.isSolanaWallet)throw new Error("Approving signatures is only supported for EVM smart wallets");let r=t.find(n=>n.signer===this.signer.locator());if(!r)throw new (0, _chunkCT2UGJELcjs.i)(`Signer ${this.signer.locator()} not found in pending approvals`);let s=yield this.signer.signMessage(r.message);return yield _chunkXALFCQKDcjs.c.call(void 0, this,o).approveSignature(this.walletLocator,i,{approvals:[_chunkXALFCQKDcjs.a.call(void 0, {signer:this.signer.locator()},s)]}),s})}waitForSignature(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let i=null;do if(yield new Promise(r=>setTimeout(r,_chunkV3CBWWX2cjs.d)),i=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getSignature(this.walletLocator,t),"error"in i)throw new (0, _chunkCT2UGJELcjs.p)(JSON.stringify(i));while(i===null||i.status==="pending");if(i.status==="failed")throw new (0, _chunkCT2UGJELcjs.m)("Signature signing failed");if(!i.outputSignature)throw new (0, _chunkCT2UGJELcjs.p)("Signature not available");return i.outputSignature})}waitForTransaction(e){return _chunkXALFCQKDcjs.f.call(void 0, this,arguments,function*(t,i=6e4,{backoffMultiplier:r=1.1,maxBackoffMs:s=2e3,initialBackoffMs:n=_chunkV3CBWWX2cjs.d}={}){let c=Date.now(),g;do{if(Date.now()-c>i)throw new (0, _chunkCT2UGJELcjs.s)("Transaction confirmation timeout");if(g=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getTransaction(this.walletLocator,t),g.error)throw new (0, _chunkCT2UGJELcjs.r)(JSON.stringify(g));yield this.sleep(n),n=Math.min(n*r,s)}while(g.status==="pending");if(g.status==="failed")throw new (0, _chunkCT2UGJELcjs.t)(`Transaction sending failed: ${JSON.stringify(g.error)}`);if(g.status==="awaiting-approval")throw new (0, _chunkCT2UGJELcjs.u)("Transaction is awaiting approval. Please submit required approvals before waiting for completion.");let h=g.onChain.txId;if(h==null)throw new (0, _chunkCT2UGJELcjs.v)("Transaction hash not found on transaction response");return h})}sleep(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return new Promise(i=>setTimeout(i,t))})}};w=new WeakMap,o=new WeakMap;function k(a){if(typeof a=="string")return a;if("email"in a)return`email:${a.email}`;if("x"in a)return`x:${a.x}`;if("twitter"in a)return`twitter:${a.twitter}`;if("phone"in a)return`phoneNumber:${a.phone}`;if("userId"in a)return`userId:${a.userId}`;throw new Error("Invalid recipient locator")}function U(a,t){return _commonsdkbase.isValidAddress.call(void 0, a)?`${t}:${a}`:`${t}:${a.toLowerCase()}`}exports.a = I;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk5HTPBFDHcjs = require('./chunk-5HTPBFDH.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var w,o,I= exports.a =class{constructor({chain:t,address:i,owner:r,signer:s,options:n},e){_chunkXALFCQKDcjs.d.call(void 0, this,w);_chunkXALFCQKDcjs.d.call(void 0, this,o);_chunkXALFCQKDcjs.e.call(void 0, this,o,e),this.chain=t,this.address=i,this.owner=r,this.signer=s,_chunkXALFCQKDcjs.e.call(void 0, this,w,n)}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,w)}balances(t,i){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let r=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getBalance(this.address,{chains:i!=null?i:[this.chain],tokens:t});if("error"in r)throw new Error(`Failed to get balances for wallet: ${JSON.stringify(r.error)}`);return r})}unstable_nfts(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield _chunkXALFCQKDcjs.c.call(void 0, this,o).unstable_getNfts(_chunkXALFCQKDcjs.b.call(void 0, _chunkXALFCQKDcjs.a.call(void 0, {},t),{chain:this.chain,address:this.address}))})}unstable_transactions(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getTransactions(this.walletLocator)})}experimental_activity(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let t=yield this.apiClient.experimental_activity(this.walletLocator,{chain:this.chain});if("error"in t)throw new Error(`Failed to get activity: ${JSON.stringify(t.error)}`);return t})}send(t,i,r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let s=k(t),n=U(i,this.chain),e={recipient:s,amount:r},c=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).send(this.walletLocator,n,e);if("message"in c)throw new (0, _chunkCT2UGJELcjs.q)(`Failed to send token: ${JSON.stringify(c.message)}`);return yield this.approveAndWait(c.id)})}addDelegatedSigner(i){return _chunkXALFCQKDcjs.f.call(void 0, this,arguments,function*({signer:t}){var s,n;let r=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).registerSigner(this.walletLocator,{signer:t,chain:this.chain==="solana"?void 0:this.chain});if("error"in r)throw new Error(`Failed to register signer: ${JSON.stringify(r.error)}`);if("transaction"in r){let e=r.transaction.id;yield this.approveAndWait(e)}else{let e=(s=r.chains)==null?void 0:s[this.chain];if((e==null?void 0:e.status)==="awaiting-approval"){let c=((n=e.approvals)==null?void 0:n.pending)||[];yield this.approveSignature(c,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 i,r,s;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!=="solana-smart-wallet"&&t.type!=="evm-smart-wallet")throw new (0, _chunkCT2UGJELcjs.c)(`Wallet type ${t.type} not supported`);return(s=(r=(i=t==null?void 0:t.config)==null?void 0:i.delegatedSigners)==null?void 0:r.map(n=>{let e=n.locator.indexOf(":");return{signer:`external-wallet:${e>=0?n.locator.slice(e+1):n.locator}`}}))!=null?s:[]})}get walletLocator(){return _chunkXALFCQKDcjs.c.call(void 0, this,o).isServerSide?this.address:`me:${this.isSolanaWallet?"solana-smart-wallet":"evm-smart-wallet"}`}get isSolanaWallet(){return this.chain==="solana"}approveAndWait(t,i){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.approveTransaction(t,i),yield this.sleep(1e3),yield this.waitForTransaction(t)})}approveTransaction(t,i){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var g,h,u,b;let r=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getTransaction(this.walletLocator,t);if(r.error)throw new (0, _chunkCT2UGJELcjs.r)(JSON.stringify(r));if(yield(u=(h=(g=_chunkXALFCQKDcjs.c.call(void 0, this,w))==null?void 0:g.experimental_callbacks)==null?void 0:h.onTransactionStart)==null?void 0:u.call(h),this.signer.type==="api-key")return r;let s=(b=r.approvals)==null?void 0:b.pending;if(s==null)return r;let n=[...i!=null?i:[],this.signer],e=yield Promise.all(s.map(d=>{let A=n.find(D=>D.locator()===d.signer);if(A==null)throw new (0, _chunkCT2UGJELcjs.i)(`Signer ${d.signer} not found in pending approvals`);let J=r.walletType==="solana-smart-wallet"?r.onChain.transaction:d.message;return A.signTransaction(J)})),c=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).approveTransaction(this.walletLocator,r.id,{approvals:e.map(d=>_chunkXALFCQKDcjs.a.call(void 0, {signer:this.signer.locator()},d))});if(c.error)throw new (0, _chunkCT2UGJELcjs.w)(JSON.stringify(c));return c})}approveSignature(t,i){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(this.isSolanaWallet)throw new Error("Approving signatures is only supported for EVM smart wallets");let r=t.find(n=>n.signer===this.signer.locator());if(!r)throw new (0, _chunkCT2UGJELcjs.i)(`Signer ${this.signer.locator()} not found in pending approvals`);let s=yield this.signer.signMessage(r.message);return yield _chunkXALFCQKDcjs.c.call(void 0, this,o).approveSignature(this.walletLocator,i,{approvals:[_chunkXALFCQKDcjs.a.call(void 0, {signer:this.signer.locator()},s)]}),s})}waitForSignature(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let i=null;do if(yield new Promise(r=>setTimeout(r,_chunk5HTPBFDHcjs.d)),i=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getSignature(this.walletLocator,t),"error"in i)throw new (0, _chunkCT2UGJELcjs.p)(JSON.stringify(i));while(i===null||i.status==="pending");if(i.status==="failed")throw new (0, _chunkCT2UGJELcjs.m)("Signature signing failed");if(!i.outputSignature)throw new (0, _chunkCT2UGJELcjs.p)("Signature not available");return i.outputSignature})}waitForTransaction(e){return _chunkXALFCQKDcjs.f.call(void 0, this,arguments,function*(t,i=6e4,{backoffMultiplier:r=1.1,maxBackoffMs:s=2e3,initialBackoffMs:n=_chunk5HTPBFDHcjs.d}={}){let c=Date.now(),g;do{if(Date.now()-c>i)throw new (0, _chunkCT2UGJELcjs.s)("Transaction confirmation timeout");if(g=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getTransaction(this.walletLocator,t),g.error)throw new (0, _chunkCT2UGJELcjs.r)(JSON.stringify(g));yield this.sleep(n),n=Math.min(n*r,s)}while(g.status==="pending");if(g.status==="failed")throw new (0, _chunkCT2UGJELcjs.t)(`Transaction sending failed: ${JSON.stringify(g.error)}`);if(g.status==="awaiting-approval")throw new (0, _chunkCT2UGJELcjs.u)("Transaction is awaiting approval. Please submit required approvals before waiting for completion.");let h=g.onChain.txId;if(h==null)throw new (0, _chunkCT2UGJELcjs.v)("Transaction hash not found on transaction response");return h})}sleep(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return new Promise(i=>setTimeout(i,t))})}};w=new WeakMap,o=new WeakMap;function k(a){if(typeof a=="string")return a;if("email"in a)return`email:${a.email}`;if("x"in a)return`x:${a.x}`;if("twitter"in a)return`twitter:${a.twitter}`;if("phone"in a)return`phoneNumber:${a.phone}`;if("userId"in a)return`userId:${a.userId}`;throw new Error("Invalid recipient locator")}function U(a,t){return _commonsdkbase.isValidAddress.call(void 0, a)?`${t}:${a}`:`${t}:${a.toLowerCase()}`}exports.a = I;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunk5K5HFPJQcjs = require('./chunk-5K5HFPJQ.cjs');var _chunkTWQ6DA3Ycjs = require('./chunk-TWQ6DA3Y.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);var p=class m extends _chunk5K5HFPJQcjs.a{constructor(r){super({chain:r.chain,address:r.address,owner:r.owner,signer:r.signer},_chunk5K5HFPJQcjs.a.getApiClient(r))}static from(r){return new m(r)}sendTransaction(x){return _chunkXALFCQKDcjs.f.call(void 0, this,arguments,function*({transaction:r,additionalSigners:n}){let l={transaction:_bs582.default.encode(r.serialize())},a=yield this.apiClient.createTransaction(this.walletLocator,{params:l});if(a.error)throw new (0, _chunkCT2UGJELcjs.q)(JSON.stringify(a));let h=n==null?void 0:n.map(o=>new (0, _chunkTWQ6DA3Ycjs.a)({type:"external-wallet",address:o.publicKey.toString(),onSignTransaction:e=>(e.sign([o]),Promise.resolve(e))}));return yield this.approveAndWait(a.id,h)})}};exports.a = p;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkPSBX4PZWcjs = require('./chunk-PSBX4PZW.cjs');var _chunkAFYBD7FIcjs = require('./chunk-AFYBD7FI.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);var p=class m extends _chunkPSBX4PZWcjs.a{constructor(r){super({chain:r.chain,address:r.address,owner:r.owner,signer:r.signer},_chunkPSBX4PZWcjs.a.getApiClient(r))}static from(r){return new m(r)}sendTransaction(x){return _chunkXALFCQKDcjs.f.call(void 0, this,arguments,function*({transaction:r,additionalSigners:n}){let l={transaction:_bs582.default.encode(r.serialize())},a=yield this.apiClient.createTransaction(this.walletLocator,{params:l});if(a.error)throw new (0, _chunkCT2UGJELcjs.q)(JSON.stringify(a));let h=n==null?void 0:n.map(o=>new (0, _chunkAFYBD7FIcjs.a)({type:"external-wallet",address:o.publicKey.toString(),onSignTransaction:e=>(e.sign([o]),Promise.resolve(e))}));return yield this.approveAndWait(a.id,h)})}};exports.a = p;
@@ -0,0 +1 @@
1
+ import{f as s}from"./chunk-BW7YYVZE.js";var t=class{constructor(e){this.type="external-wallet";if(e.address==null)throw new Error("Please provide an address for the External Wallet Signer");this.address=e.address,this.provider=e.provider,this.viemAccount=e.viemAccount}locator(){return`evm-keypair:${this.address}`}signMessage(e){return s(this,null,function*(){var i;if(this.provider!=null){let r=yield this.provider.request({method:"personal_sign",params:[e,this.address]});if(r==null)throw new Error("[EVMExternalWalletSigner] Failed to sign message: EIP1193 provider signMessage returned null");return{signature:r}}if(((i=this.viemAccount)==null?void 0:i.signMessage)!=null){let r=yield this.viemAccount.signMessage({message:{raw:e}});if(r==null)throw new Error("[EVMExternalWalletSigner] Failed to sign message: Viem account signMessage returned null");return{signature:r}}throw new Error("No signer provider or viem account provided")})}signTransaction(e){return s(this,null,function*(){return yield this.signMessage(e)})}};export{t as a};
@@ -1 +1 @@
1
- import{a as n}from"./chunk-2AWC6KEP.js";import{a as i}from"./chunk-OV4CFQ36.js";import{a as o}from"./chunk-77QBSFHG.js";import{a}from"./chunk-LFYI7K4T.js";import{a as l}from"./chunk-2KK65AC6.js";import{a as t}from"./chunk-R7KEBAQ2.js";function f(r,e){switch(e.type){case"email":return new n(e);case"api-key":return r==="solana"?new o(e):new l(e);case"external-wallet":return r==="solana"?new a(e):new t(e);case"passkey":return new i(e)}}export{f as a};
1
+ import{a as n}from"./chunk-VBWFY7JR.js";import{a as i}from"./chunk-OV4CFQ36.js";import{a as o}from"./chunk-77QBSFHG.js";import{a}from"./chunk-T3ICQDFS.js";import{a as l}from"./chunk-2KK65AC6.js";import{a as t}from"./chunk-QTSZSHKK.js";function f(r,e){switch(e.type){case"email":return new n(e);case"api-key":return r==="solana"?new o(e):new l(e);case"external-wallet":return r==="solana"?new a(e):new t(e);case"passkey":return new i(e)}}export{f as a};
@@ -0,0 +1 @@
1
+ import{w as r}from"./chunk-7ENJXL4H.js";import{f as e}from"./chunk-BW7YYVZE.js";import{PublicKey as m,VersionedTransaction as w}from"@solana/web3.js";import i from"bs58";var o=class{constructor(n){this.type="external-wallet";if(n.address==null)throw new Error("Please provide an address for the External Wallet Signer");this.address=n.address,this.onSignTransaction=n.onSignTransaction}locator(){return`solana-keypair:${this.address}`}signMessage(){return e(this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for solana external wallet signer"))})}signTransaction(n){return e(this,null,function*(){if(this.onSignTransaction==null)return yield Promise.reject(new Error("onSignTransaction method is required to sign transactions with a Solana external wallet"));let l=i.decode(n),c=w.deserialize(l),t=yield this.onSignTransaction(c),d=new m(this.address),a=t.message.staticAccountKeys.findIndex(u=>u.equals(d));if(a===-1)throw new r("Wallet public key not found in transaction signers");let s=t.signatures[a];if(s==null)throw new r("No valid signature found in the transaction");let g=new Uint8Array(Object.values(s));return{signature:i.encode(g)}})}};export{o as a};
@@ -0,0 +1 @@
1
+ import{a as l}from"./chunk-U34BYZY2.js";import{a as u}from"./chunk-OGGPNJY3.js";import{a as d}from"./chunk-M4ELAV7U.js";import{f as c}from"./chunk-BW7YYVZE.js";import{VersionedTransaction as f}from"@solana/web3.js";import p from"bs58";import{validateAPIKey as y}from"@crossmint/common-sdk-base";var m=class{constructor(t){this.config=t;this.type="email";this._needsAuth=!0;this._authPromise=null;this.initialize()}locator(){return`solana-keypair:${this.config.signerAddress}`}initialize(){return c(this,null,function*(){if(this.config._handshakeParent==null){let t=y(this.config.crossmint.apiKey);if(!t.isValid)throw new Error("Invalid API key");let n=new l({environment:t.environment});this.config._handshakeParent=yield n.initialize()}})}signMessage(){return c(this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for email signer"))})}signTransaction(t){return c(this,null,function*(){var a,o,r;yield this.handleAuthRequired();let n=p.decode(t),s=f.deserialize(n).message.serialize(),e=yield(r=this.config._handshakeParent)==null?void 0:r.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:(o=(a=this.config.crossmint.experimental_customAuth)==null?void 0:a.jwt)!=null?o:"",apiKey:this.config.crossmint.apiKey},data:{keyType:"ed25519",bytes:p.encode(s),encoding:"base58"}},options:h});if((e==null?void 0:e.status)==="error")throw new Error(e.error);if((e==null?void 0:e.signature)==null)throw new Error("Failed to sign transaction");return{signature:e.signature.bytes}})}handleAuthRequired(){return c(this,null,function*(){var e,a,o;if(this.config._handshakeParent==null)throw new Error("Handshake parent not initialized");let t=yield(o=this.config._handshakeParent)==null?void 0:o.sendAction({event:"request:get-status",responseEvent:"response:get-status",data:{authData:{jwt:(a=(e=this.config.crossmint.experimental_customAuth)==null?void 0:e.jwt)!=null?a:"",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:n,resolve:i,reject:s}=this.createAuthPromise();if(this._authPromise={promise:n,resolve:i,reject:s},this.config.onAuthRequired)try{yield this.config.onAuthRequired(this._needsAuth,()=>this.sendEmailWithOtp(),r=>this.verifyOtp(r),()=>s(new d))}catch(r){s(r)}try{yield n}catch(r){throw r}})}createAuthPromise(){let t,n;return{promise:new Promise((s,e)=>{t=s,n=e}),resolve:t,reject:n}}sendEmailWithOtp(){return c(this,null,function*(){var s,e,a;if(this.config._handshakeParent==null)throw new Error("Handshake parent not initialized");let t=this.config._handshakeParent,n=`email:${this.config.email}`,i=yield t.sendAction({event:"request:start-onboarding",responseEvent:"response:start-onboarding",data:{authData:{jwt:(e=(s=this.config.crossmint.experimental_customAuth)==null?void 0:s.jwt)!=null?e:"",apiKey:this.config.crossmint.apiKey},data:{authId:n}},options:h});if((i==null?void 0:i.status)==="success"&&i.signerStatus==="ready"){this._needsAuth=!1;return}(i==null?void 0:i.status)==="error"&&(console.error("[sendEmailWithOtp] Failed to send OTP:",i),(a=this._authPromise)==null||a.reject(new Error(i.error||"Failed to initiate OTP process.")))})}verifyOtp(t){return c(this,null,function*(){var i,s,e,a,o;if(this.config._handshakeParent==null)throw new Error("Handshake parent not initialized");let n=this.config._handshakeParent;try{let r=yield n.sendAction({event:"request:complete-onboarding",responseEvent:"response:complete-onboarding",data:{authData:{jwt:(s=(i=this.config.crossmint.experimental_customAuth)==null?void 0:i.jwt)!=null?s:"",apiKey:this.config.crossmint.apiKey},data:{onboardingAuthentication:{encryptedOtp:t}}},options:h});if((r==null?void 0:r.status)==="success"){console.log("[verifyOtp] OTP validation successful"),this._needsAuth=!1,(e=this._authPromise)==null||e.resolve();return}console.error("[verifyOtp] Failed to validate OTP:",r),this._needsAuth=!0;let g=(r==null?void 0:r.status)==="error"?r.error:"Failed to validate encrypted OTP";(a=this._authPromise)==null||a.reject(new Error(g))}catch(r){throw console.error("[verifyOtp] Error sending OTP validation request:",r),this._needsAuth=!0,(o=this._authPromise)==null||o.reject(r),r}})}static pregenerateSigner(t,n){return c(this,null,function*(){var i;if(t==null||((i=n.experimental_customAuth)==null?void 0:i.email)==null)throw new Error("Email is required to pregenerate a signer");try{let e=(yield new u(n).pregenerateSigner(t!=null?t:n.experimental_customAuth.email)).publicKey;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));return e.bytes}catch(s){throw console.error("[EmailSigner] Failed to pregenerate signer:",s),s}})}},h={timeoutMs:1e4,intervalMs:5e3};export{m as a};
@@ -1 +1 @@
1
- import{b as n,c as i}from"./chunk-LQKXECMQ.js";import{a as o}from"./chunk-7ENJXL4H.js";import{f as r}from"./chunk-BW7YYVZE.js";import{APIKeyUsageOrigin as c,CrossmintApiClient as h}from"@crossmint/common-sdk-base";var p=class extends h{constructor(e){super(e,{internalConfig:{sdkMetadata:{name:i,version:n}}});this.apiPrefix="api/2022-06-09/wallets"}createWallet(e){return r(this,null,function*(){let s=this.isServerSide?`${this.apiPrefix}`:`${this.apiPrefix}/me`;return(yield this.post(s,{body:JSON.stringify(e),headers:this.headers})).json()})}getWallet(e){return r(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}`,{headers:this.headers})).json()})}createTransaction(e,s){return r(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveTransaction(e,s,t){return r(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions/${s}/approvals`,{body:JSON.stringify(t),headers:this.headers})).json()})}getTransaction(e,s){return r(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions/${s}`,{headers:this.headers})).json()})}createSignature(e,s){return r(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signatures`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveSignature(e,s,t){return r(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signatures/${s}/approvals`,{body:JSON.stringify(t),headers:this.headers})).json()})}getSignature(e,s){return r(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/signatures/${s}`,{headers:this.headers})).json()})}getTransactions(e){return r(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions`,{headers:this.headers})).json()})}unstable_getNfts(e){return r(this,null,function*(){let s=new URLSearchParams;s.append("page",e.page.toString()),s.append("perPage",e.perPage.toString());let t=`${e.chain}:${e.address}`;return(yield this.get(`${this.apiPrefix}/${t}/nfts?${s.toString()}`,{headers:this.headers})).json()})}experimental_activity(e,s){return r(this,null,function*(){let t=new URLSearchParams;return t.append("chain",s.chain.toString()),(yield this.get(`${this.apiPrefix}/${e}/activity?${t.toString()}`,{headers:this.headers})).json()})}getBalance(e,s){return r(this,null,function*(){let t=new URLSearchParams;return t.append("tokenLocators",s.tokens.join(",")),t.append("chains",s.chains.join(",")),(yield this.get(`api/unstable/wallets/${e}/balances?${t.toString()}`,{headers:this.headers})).json()})}registerSigner(e,s){return r(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signers`,{body:JSON.stringify(s),headers:this.headers})).json()})}getSigner(e,s){return r(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/signers/${s}`,{headers:this.headers})).json()})}send(e,s,t){return r(this,null,function*(){return(yield this.post(`api/unstable/wallets/${e}/tokens/${s}/transfers`,{body:JSON.stringify(t),headers:this.headers})).json()})}get isServerSide(){return this.parsedAPIKey.usageOrigin===c.SERVER}get environment(){if(!this.parsedAPIKey.isValid)throw new o("Invalid API key");return this.parsedAPIKey.environment}get headers(){return{"Content-Type":"application/json"}}};export{p as a};
1
+ import{b as n,c as i}from"./chunk-3D5RTPTJ.js";import{a as o}from"./chunk-7ENJXL4H.js";import{f as r}from"./chunk-BW7YYVZE.js";import{APIKeyUsageOrigin as c,CrossmintApiClient as h}from"@crossmint/common-sdk-base";var p=class extends h{constructor(e){super(e,{internalConfig:{sdkMetadata:{name:i,version:n}}});this.apiPrefix="api/2022-06-09/wallets"}createWallet(e){return r(this,null,function*(){let s=this.isServerSide?`${this.apiPrefix}`:`${this.apiPrefix}/me`;return(yield this.post(s,{body:JSON.stringify(e),headers:this.headers})).json()})}getWallet(e){return r(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}`,{headers:this.headers})).json()})}createTransaction(e,s){return r(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveTransaction(e,s,t){return r(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions/${s}/approvals`,{body:JSON.stringify(t),headers:this.headers})).json()})}getTransaction(e,s){return r(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions/${s}`,{headers:this.headers})).json()})}createSignature(e,s){return r(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signatures`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveSignature(e,s,t){return r(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signatures/${s}/approvals`,{body:JSON.stringify(t),headers:this.headers})).json()})}getSignature(e,s){return r(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/signatures/${s}`,{headers:this.headers})).json()})}getTransactions(e){return r(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions`,{headers:this.headers})).json()})}unstable_getNfts(e){return r(this,null,function*(){let s=new URLSearchParams;s.append("page",e.page.toString()),s.append("perPage",e.perPage.toString());let t=`${e.chain}:${e.address}`;return(yield this.get(`${this.apiPrefix}/${t}/nfts?${s.toString()}`,{headers:this.headers})).json()})}experimental_activity(e,s){return r(this,null,function*(){let t=new URLSearchParams;return t.append("chain",s.chain.toString()),(yield this.get(`${this.apiPrefix}/${e}/activity?${t.toString()}`,{headers:this.headers})).json()})}getBalance(e,s){return r(this,null,function*(){let t=new URLSearchParams;return t.append("tokenLocators",s.tokens.join(",")),t.append("chains",s.chains.join(",")),(yield this.get(`api/unstable/wallets/${e}/balances?${t.toString()}`,{headers:this.headers})).json()})}registerSigner(e,s){return r(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signers`,{body:JSON.stringify(s),headers:this.headers})).json()})}getSigner(e,s){return r(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/signers/${s}`,{headers:this.headers})).json()})}send(e,s,t){return r(this,null,function*(){return(yield this.post(`api/unstable/wallets/${e}/tokens/${s}/transfers`,{body:JSON.stringify(t),headers:this.headers})).json()})}get isServerSide(){return this.parsedAPIKey.usageOrigin===c.SERVER}get environment(){if(!this.parsedAPIKey.isValid)throw new o("Invalid API key");return this.parsedAPIKey.environment}get headers(){return{"Content-Type":"application/json"}}};export{p as a};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkV3CBWWX2cjs = require('./chunk-V3CBWWX2.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var a=class extends _commonsdkbase.CrossmintApiClient{constructor(e){super(e,{internalConfig:{sdkMetadata:{name:_chunkV3CBWWX2cjs.c,version:_chunkV3CBWWX2cjs.b}}});this.apiPrefix="api/v1/signers"}pregenerateSigner(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let r=yield this.post(`${this.apiPrefix}/derive-public-key`,{body:JSON.stringify({authId:`email:${e}`,keyType:"ed25519"}),headers:this.headers});if(!r.ok){let o=yield r.text();throw new Error(`Failed to fetch public key: ${r.status} ${o}`)}return yield r.json()})}get isServerSide(){return this.parsedAPIKey.usageOrigin===_commonsdkbase.APIKeyUsageOrigin.SERVER}get environment(){if(!this.parsedAPIKey.isValid)throw new (0, _chunkCT2UGJELcjs.a)("Invalid API key");return this.parsedAPIKey.environment}get headers(){return{"Content-Type":"application/json"}}};exports.a = a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk5HTPBFDHcjs = require('./chunk-5HTPBFDH.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var a=class extends _commonsdkbase.CrossmintApiClient{constructor(e){super(e,{internalConfig:{sdkMetadata:{name:_chunk5HTPBFDHcjs.c,version:_chunk5HTPBFDHcjs.b}}});this.apiPrefix="api/v1/signers"}pregenerateSigner(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let r=yield this.post(`${this.apiPrefix}/derive-public-key`,{body:JSON.stringify({authId:`email:${e}`,keyType:"ed25519"}),headers:this.headers});if(!r.ok){let o=yield r.text();throw new Error(`Failed to fetch public key: ${r.status} ${o}`)}return yield r.json()})}get isServerSide(){return this.parsedAPIKey.usageOrigin===_commonsdkbase.APIKeyUsageOrigin.SERVER}get environment(){if(!this.parsedAPIKey.isValid)throw new (0, _chunkCT2UGJELcjs.a)("Invalid API key");return this.parsedAPIKey.environment}get headers(){return{"Content-Type":"application/json"}}};exports.a = a;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunk3ZKXOCI7cjs = require('./chunk-3ZKXOCI7.cjs');var _chunkWFS45YN4cjs = require('./chunk-WFS45YN4.cjs');var _chunkZSWIQU3Ucjs = require('./chunk-ZSWIQU3U.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _web3js = require('@solana/web3.js');var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);var _commonsdkbase = require('@crossmint/common-sdk-base');var m=class{constructor(t){this.config=t;this.type="email";this._needsAuth=!0;this._authPromise=null;this.initialize()}locator(){return`solana-keypair:${this.config.signerAddress}`}initialize(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(this.config._handshakeParent==null){let t=_commonsdkbase.validateAPIKey.call(void 0, this.config.crossmint.apiKey);if(!t.isValid)throw new Error("Invalid API key");let n=new (0, _chunk3ZKXOCI7cjs.a)({environment:t.environment});this.config._handshakeParent=yield n.initialize()}})}signMessage(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for email signer"))})}signTransaction(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var a,o,r;yield this.handleAuthRequired();let n=_bs582.default.decode(t),s=_web3js.VersionedTransaction.deserialize(n).message.serialize(),e=yield(r=this.config._handshakeParent)==null?void 0:r.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:(o=(a=this.config.crossmint.experimental_customAuth)==null?void 0:a.jwt)!=null?o:"",apiKey:this.config.crossmint.apiKey},data:{keyType:"ed25519",bytes:_bs582.default.encode(s),encoding:"base58"}},options:h});if((e==null?void 0:e.status)==="error")throw new Error(e.error);if((e==null?void 0:e.signature)==null)throw new Error("Failed to sign transaction");return{signature:e.signature.bytes}})}handleAuthRequired(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var e,a,o;if(this.config._handshakeParent==null)throw new Error("Handshake parent not initialized");let t=yield(o=this.config._handshakeParent)==null?void 0:o.sendAction({event:"request:get-status",responseEvent:"response:get-status",data:{authData:{jwt:(a=(e=this.config.crossmint.experimental_customAuth)==null?void 0:e.jwt)!=null?a:"",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:n,resolve:i,reject:s}=this.createAuthPromise();if(this._authPromise={promise:n,resolve:i,reject:s},this.config.onAuthRequired)try{yield this.config.onAuthRequired(this._needsAuth,()=>this.sendEmailWithOtp(),r=>this.verifyOtp(r),()=>s(new _chunkZSWIQU3Ucjs.a))}catch(r){s(r)}try{yield n}catch(r){throw r}})}createAuthPromise(){let t,n;return{promise:new Promise((s,e)=>{t=s,n=e}),resolve:t,reject:n}}sendEmailWithOtp(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var s,e,a;if(this.config._handshakeParent==null)throw new Error("Handshake parent not initialized");let t=this.config._handshakeParent,n=`email:${this.config.email}`,i=yield t.sendAction({event:"request:start-onboarding",responseEvent:"response:start-onboarding",data:{authData:{jwt:(e=(s=this.config.crossmint.experimental_customAuth)==null?void 0:s.jwt)!=null?e:"",apiKey:this.config.crossmint.apiKey},data:{authId:n}},options:h});if((i==null?void 0:i.status)==="success"&&i.signerStatus==="ready"){this._needsAuth=!1;return}(i==null?void 0:i.status)==="error"&&(console.error("[sendEmailWithOtp] Failed to send OTP:",i),(a=this._authPromise)==null||a.reject(new Error(i.error||"Failed to initiate OTP process.")))})}verifyOtp(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var i,s,e,a,o;if(this.config._handshakeParent==null)throw new Error("Handshake parent not initialized");let n=this.config._handshakeParent;try{let r=yield n.sendAction({event:"request:complete-onboarding",responseEvent:"response:complete-onboarding",data:{authData:{jwt:(s=(i=this.config.crossmint.experimental_customAuth)==null?void 0:i.jwt)!=null?s:"",apiKey:this.config.crossmint.apiKey},data:{onboardingAuthentication:{encryptedOtp:t}}},options:h});if((r==null?void 0:r.status)==="success"){console.log("[verifyOtp] OTP validation successful"),this._needsAuth=!1,(e=this._authPromise)==null||e.resolve();return}console.error("[verifyOtp] Failed to validate OTP:",r),this._needsAuth=!0;let g=(r==null?void 0:r.status)==="error"?r.error:"Failed to validate encrypted OTP";(a=this._authPromise)==null||a.reject(new Error(g))}catch(r){throw console.error("[verifyOtp] Error sending OTP validation request:",r),this._needsAuth=!0,(o=this._authPromise)==null||o.reject(r),r}})}static pregenerateSigner(t,n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var i;if(t==null||((i=n.experimental_customAuth)==null?void 0:i.email)==null)throw new Error("Email is required to pregenerate a signer");try{let e=(yield new (0, _chunkWFS45YN4cjs.a)(n).pregenerateSigner(t!=null?t:n.experimental_customAuth.email)).publicKey;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));return e.bytes}catch(s){throw console.error("[EmailSigner] Failed to pregenerate signer:",s),s}})}},h={timeoutMs:1e4,intervalMs:5e3};exports.a = m;
@@ -1 +1 @@
1
- import{d as S}from"./chunk-LQKXECMQ.js";import{c as N,d as E,i as v,m as $,p as T,q as x,r as C,s as O,t as W,u as F,v as P,w as _}from"./chunk-7ENJXL4H.js";import{a as f,b as L,c as l,d as m,e as y,f as p}from"./chunk-BW7YYVZE.js";import{isValidAddress as M}from"@crossmint/common-sdk-base";var w,o,I=class{constructor({chain:t,address:i,owner:r,signer:s,options:n},e){m(this,w);m(this,o);y(this,o,e),this.chain=t,this.address=i,this.owner=r,this.signer=s,y(this,w,n)}static getApiClient(t){return t.apiClient}static getOptions(t){return t.options}get apiClient(){return l(this,o)}get options(){return l(this,w)}balances(t,i){return p(this,null,function*(){let r=yield l(this,o).getBalance(this.address,{chains:i!=null?i:[this.chain],tokens:t});if("error"in r)throw new Error(`Failed to get balances for wallet: ${JSON.stringify(r.error)}`);return r})}unstable_nfts(t){return p(this,null,function*(){return yield l(this,o).unstable_getNfts(L(f({},t),{chain:this.chain,address:this.address}))})}unstable_transactions(){return p(this,null,function*(){return yield l(this,o).getTransactions(this.walletLocator)})}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.error)}`);return t})}send(t,i,r){return p(this,null,function*(){let s=k(t),n=U(i,this.chain),e={recipient:s,amount:r},c=yield l(this,o).send(this.walletLocator,n,e);if("message"in c)throw new x(`Failed to send token: ${JSON.stringify(c.message)}`);return yield this.approveAndWait(c.id)})}addDelegatedSigner(i){return p(this,arguments,function*({signer:t}){var s,n;let r=yield l(this,o).registerSigner(this.walletLocator,{signer:t,chain:this.chain==="solana"?void 0:this.chain});if("error"in r)throw new Error(`Failed to register signer: ${JSON.stringify(r.error)}`);if("transaction"in r){let e=r.transaction.id;yield this.approveAndWait(e)}else{let e=(s=r.chains)==null?void 0:s[this.chain];if((e==null?void 0:e.status)==="awaiting-approval"){let c=((n=e.approvals)==null?void 0:n.pending)||[];yield this.approveSignature(c,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 i,r,s;let t=yield l(this,o).getWallet(this.walletLocator);if("error"in t)throw new E(JSON.stringify(t));if(t.type!=="solana-smart-wallet"&&t.type!=="evm-smart-wallet")throw new N(`Wallet type ${t.type} not supported`);return(s=(r=(i=t==null?void 0:t.config)==null?void 0:i.delegatedSigners)==null?void 0:r.map(n=>{let e=n.locator.indexOf(":");return{signer:`external-wallet:${e>=0?n.locator.slice(e+1):n.locator}`}}))!=null?s:[]})}get walletLocator(){return l(this,o).isServerSide?this.address:`me:${this.isSolanaWallet?"solana-smart-wallet":"evm-smart-wallet"}`}get isSolanaWallet(){return this.chain==="solana"}approveAndWait(t,i){return p(this,null,function*(){return yield this.approveTransaction(t,i),yield this.sleep(1e3),yield this.waitForTransaction(t)})}approveTransaction(t,i){return p(this,null,function*(){var g,h,u,b;let r=yield l(this,o).getTransaction(this.walletLocator,t);if(r.error)throw new C(JSON.stringify(r));if(yield(u=(h=(g=l(this,w))==null?void 0:g.experimental_callbacks)==null?void 0:h.onTransactionStart)==null?void 0:u.call(h),this.signer.type==="api-key")return r;let s=(b=r.approvals)==null?void 0:b.pending;if(s==null)return r;let n=[...i!=null?i:[],this.signer],e=yield Promise.all(s.map(d=>{let A=n.find(D=>D.locator()===d.signer);if(A==null)throw new v(`Signer ${d.signer} not found in pending approvals`);let J=r.walletType==="solana-smart-wallet"?r.onChain.transaction:d.message;return A.signTransaction(J)})),c=yield l(this,o).approveTransaction(this.walletLocator,r.id,{approvals:e.map(d=>f({signer:this.signer.locator()},d))});if(c.error)throw new _(JSON.stringify(c));return c})}approveSignature(t,i){return p(this,null,function*(){if(this.isSolanaWallet)throw new Error("Approving signatures is only supported for EVM smart wallets");let r=t.find(n=>n.signer===this.signer.locator());if(!r)throw new v(`Signer ${this.signer.locator()} not found in pending approvals`);let s=yield this.signer.signMessage(r.message);return yield l(this,o).approveSignature(this.walletLocator,i,{approvals:[f({signer:this.signer.locator()},s)]}),s})}waitForSignature(t){return p(this,null,function*(){let i=null;do if(yield new Promise(r=>setTimeout(r,S)),i=yield l(this,o).getSignature(this.walletLocator,t),"error"in i)throw new T(JSON.stringify(i));while(i===null||i.status==="pending");if(i.status==="failed")throw new $("Signature signing failed");if(!i.outputSignature)throw new T("Signature not available");return i.outputSignature})}waitForTransaction(e){return p(this,arguments,function*(t,i=6e4,{backoffMultiplier:r=1.1,maxBackoffMs:s=2e3,initialBackoffMs:n=S}={}){let c=Date.now(),g;do{if(Date.now()-c>i)throw new O("Transaction confirmation timeout");if(g=yield l(this,o).getTransaction(this.walletLocator,t),g.error)throw new C(JSON.stringify(g));yield this.sleep(n),n=Math.min(n*r,s)}while(g.status==="pending");if(g.status==="failed")throw new W(`Transaction sending failed: ${JSON.stringify(g.error)}`);if(g.status==="awaiting-approval")throw new F("Transaction is awaiting approval. Please submit required approvals before waiting for completion.");let h=g.onChain.txId;if(h==null)throw new P("Transaction hash not found on transaction response");return h})}sleep(t){return p(this,null,function*(){return new Promise(i=>setTimeout(i,t))})}};w=new WeakMap,o=new WeakMap;function k(a){if(typeof a=="string")return a;if("email"in a)return`email:${a.email}`;if("x"in a)return`x:${a.x}`;if("twitter"in a)return`twitter:${a.twitter}`;if("phone"in a)return`phoneNumber:${a.phone}`;if("userId"in a)return`userId:${a.userId}`;throw new Error("Invalid recipient locator")}function U(a,t){return M(a)?`${t}:${a}`:`${t}:${a.toLowerCase()}`}export{I as a};
1
+ import{d as S}from"./chunk-3D5RTPTJ.js";import{c as N,d as E,i as v,m as $,p as T,q as x,r as C,s as O,t as W,u as F,v as P,w as _}from"./chunk-7ENJXL4H.js";import{a as f,b as L,c as l,d as m,e as y,f as p}from"./chunk-BW7YYVZE.js";import{isValidAddress as M}from"@crossmint/common-sdk-base";var w,o,I=class{constructor({chain:t,address:i,owner:r,signer:s,options:n},e){m(this,w);m(this,o);y(this,o,e),this.chain=t,this.address=i,this.owner=r,this.signer=s,y(this,w,n)}static getApiClient(t){return t.apiClient}static getOptions(t){return t.options}get apiClient(){return l(this,o)}get options(){return l(this,w)}balances(t,i){return p(this,null,function*(){let r=yield l(this,o).getBalance(this.address,{chains:i!=null?i:[this.chain],tokens:t});if("error"in r)throw new Error(`Failed to get balances for wallet: ${JSON.stringify(r.error)}`);return r})}unstable_nfts(t){return p(this,null,function*(){return yield l(this,o).unstable_getNfts(L(f({},t),{chain:this.chain,address:this.address}))})}unstable_transactions(){return p(this,null,function*(){return yield l(this,o).getTransactions(this.walletLocator)})}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.error)}`);return t})}send(t,i,r){return p(this,null,function*(){let s=k(t),n=U(i,this.chain),e={recipient:s,amount:r},c=yield l(this,o).send(this.walletLocator,n,e);if("message"in c)throw new x(`Failed to send token: ${JSON.stringify(c.message)}`);return yield this.approveAndWait(c.id)})}addDelegatedSigner(i){return p(this,arguments,function*({signer:t}){var s,n;let r=yield l(this,o).registerSigner(this.walletLocator,{signer:t,chain:this.chain==="solana"?void 0:this.chain});if("error"in r)throw new Error(`Failed to register signer: ${JSON.stringify(r.error)}`);if("transaction"in r){let e=r.transaction.id;yield this.approveAndWait(e)}else{let e=(s=r.chains)==null?void 0:s[this.chain];if((e==null?void 0:e.status)==="awaiting-approval"){let c=((n=e.approvals)==null?void 0:n.pending)||[];yield this.approveSignature(c,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 i,r,s;let t=yield l(this,o).getWallet(this.walletLocator);if("error"in t)throw new E(JSON.stringify(t));if(t.type!=="solana-smart-wallet"&&t.type!=="evm-smart-wallet")throw new N(`Wallet type ${t.type} not supported`);return(s=(r=(i=t==null?void 0:t.config)==null?void 0:i.delegatedSigners)==null?void 0:r.map(n=>{let e=n.locator.indexOf(":");return{signer:`external-wallet:${e>=0?n.locator.slice(e+1):n.locator}`}}))!=null?s:[]})}get walletLocator(){return l(this,o).isServerSide?this.address:`me:${this.isSolanaWallet?"solana-smart-wallet":"evm-smart-wallet"}`}get isSolanaWallet(){return this.chain==="solana"}approveAndWait(t,i){return p(this,null,function*(){return yield this.approveTransaction(t,i),yield this.sleep(1e3),yield this.waitForTransaction(t)})}approveTransaction(t,i){return p(this,null,function*(){var g,h,u,b;let r=yield l(this,o).getTransaction(this.walletLocator,t);if(r.error)throw new C(JSON.stringify(r));if(yield(u=(h=(g=l(this,w))==null?void 0:g.experimental_callbacks)==null?void 0:h.onTransactionStart)==null?void 0:u.call(h),this.signer.type==="api-key")return r;let s=(b=r.approvals)==null?void 0:b.pending;if(s==null)return r;let n=[...i!=null?i:[],this.signer],e=yield Promise.all(s.map(d=>{let A=n.find(D=>D.locator()===d.signer);if(A==null)throw new v(`Signer ${d.signer} not found in pending approvals`);let J=r.walletType==="solana-smart-wallet"?r.onChain.transaction:d.message;return A.signTransaction(J)})),c=yield l(this,o).approveTransaction(this.walletLocator,r.id,{approvals:e.map(d=>f({signer:this.signer.locator()},d))});if(c.error)throw new _(JSON.stringify(c));return c})}approveSignature(t,i){return p(this,null,function*(){if(this.isSolanaWallet)throw new Error("Approving signatures is only supported for EVM smart wallets");let r=t.find(n=>n.signer===this.signer.locator());if(!r)throw new v(`Signer ${this.signer.locator()} not found in pending approvals`);let s=yield this.signer.signMessage(r.message);return yield l(this,o).approveSignature(this.walletLocator,i,{approvals:[f({signer:this.signer.locator()},s)]}),s})}waitForSignature(t){return p(this,null,function*(){let i=null;do if(yield new Promise(r=>setTimeout(r,S)),i=yield l(this,o).getSignature(this.walletLocator,t),"error"in i)throw new T(JSON.stringify(i));while(i===null||i.status==="pending");if(i.status==="failed")throw new $("Signature signing failed");if(!i.outputSignature)throw new T("Signature not available");return i.outputSignature})}waitForTransaction(e){return p(this,arguments,function*(t,i=6e4,{backoffMultiplier:r=1.1,maxBackoffMs:s=2e3,initialBackoffMs:n=S}={}){let c=Date.now(),g;do{if(Date.now()-c>i)throw new O("Transaction confirmation timeout");if(g=yield l(this,o).getTransaction(this.walletLocator,t),g.error)throw new C(JSON.stringify(g));yield this.sleep(n),n=Math.min(n*r,s)}while(g.status==="pending");if(g.status==="failed")throw new W(`Transaction sending failed: ${JSON.stringify(g.error)}`);if(g.status==="awaiting-approval")throw new F("Transaction is awaiting approval. Please submit required approvals before waiting for completion.");let h=g.onChain.txId;if(h==null)throw new P("Transaction hash not found on transaction response");return h})}sleep(t){return p(this,null,function*(){return new Promise(i=>setTimeout(i,t))})}};w=new WeakMap,o=new WeakMap;function k(a){if(typeof a=="string")return a;if("email"in a)return`email:${a.email}`;if("x"in a)return`x:${a.x}`;if("twitter"in a)return`twitter:${a.twitter}`;if("phone"in a)return`phoneNumber:${a.phone}`;if("userId"in a)return`userId:${a.userId}`;throw new Error("Invalid recipient locator")}function U(a,t){return M(a)?`${t}:${a}`:`${t}:${a.toLowerCase()}`}export{I as a};
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkYUXGNX2Rcjs = require('./chunk-YUXGNX2R.cjs');var _chunkUYFBYHITcjs = require('./chunk-UYFBYHIT.cjs');require('./chunk-MHKWLGN5.cjs');var _chunkHMQIDZ53cjs = require('./chunk-HMQIDZ53.cjs');var _chunkRDZYRVMZcjs = require('./chunk-RDZYRVMZ.cjs');var _chunk5K5HFPJQcjs = require('./chunk-5K5HFPJQ.cjs');require('./chunk-57EIEFQU.cjs');require('./chunk-W5TFNIA7.cjs');require('./chunk-3FUD4JAM.cjs');require('./chunk-3ZKXOCI7.cjs');require('./chunk-KTTTMBOT.cjs');require('./chunk-DYRSQN7X.cjs');require('./chunk-NVJN7LPY.cjs');require('./chunk-TWQ6DA3Y.cjs');var _chunkZSWIQU3Ucjs = require('./chunk-ZSWIQU3U.cjs');require('./chunk-RD5PG4M6.cjs');require('./chunk-6HXIZLEQ.cjs');require('./chunk-NQYAOPHP.cjs');require('./chunk-V3CBWWX2.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');require('./chunk-ECAM5KTH.cjs');var _chunk6VJEBYPNcjs = require('./chunk-6VJEBYPN.cjs');require('./chunk-IR5WN6FQ.cjs');require('./chunk-GEY574TH.cjs');require('./chunk-YO6BJ2DI.cjs');require('./chunk-YAORQK6R.cjs');require('./chunk-XALFCQKD.cjs');exports.AuthRejectedError = _chunkZSWIQU3Ucjs.a; exports.CrossmintWallets = _chunkHMQIDZ53cjs.b; exports.EVMWallet = _chunkYUXGNX2Rcjs.a; exports.InvalidApiKeyError = _chunkCT2UGJELcjs.a; exports.InvalidEnvironmentError = _chunkCT2UGJELcjs.b; exports.InvalidMessageFormatError = _chunkCT2UGJELcjs.j; exports.InvalidSignerError = _chunkCT2UGJELcjs.i; exports.InvalidTypedDataError = _chunkCT2UGJELcjs.k; exports.InvalidWalletConfigError = _chunkCT2UGJELcjs.e; exports.MessageSigningNotSupportedError = _chunkCT2UGJELcjs.n; exports.PendingApprovalsError = _chunkCT2UGJELcjs.x; exports.SignatureNotAvailableError = _chunkCT2UGJELcjs.p; exports.SignatureNotCreatedError = _chunkCT2UGJELcjs.o; exports.SignatureNotFoundError = _chunkCT2UGJELcjs.l; exports.SignerTypeMismatchError = _chunkCT2UGJELcjs.h; exports.SigningFailedError = _chunkCT2UGJELcjs.m; exports.SolanaWallet = _chunkUYFBYHITcjs.a; exports.TransactionAwaitingApprovalError = _chunkCT2UGJELcjs.u; exports.TransactionConfirmationTimeoutError = _chunkCT2UGJELcjs.s; exports.TransactionFailedError = _chunkCT2UGJELcjs.w; exports.TransactionHashNotFoundError = _chunkCT2UGJELcjs.v; exports.TransactionNotAvailableError = _chunkCT2UGJELcjs.r; exports.TransactionNotCreatedError = _chunkCT2UGJELcjs.q; exports.TransactionSendingFailedError = _chunkCT2UGJELcjs.t; exports.Wallet = _chunk5K5HFPJQcjs.a; exports.WalletCreationError = _chunkCT2UGJELcjs.f; exports.WalletFactory = _chunkRDZYRVMZcjs.a; exports.WalletNotAvailableError = _chunkCT2UGJELcjs.d; exports.WalletTypeMismatchError = _chunkCT2UGJELcjs.g; exports.WalletTypeNotSupportedError = _chunkCT2UGJELcjs.c; exports.createCrossmint = _chunkHMQIDZ53cjs.a; exports.toViemChain = _chunk6VJEBYPNcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk33ZMLROFcjs = require('./chunk-33ZMLROF.cjs');var _chunkQK3HMP6Hcjs = require('./chunk-QK3HMP6H.cjs');require('./chunk-MHKWLGN5.cjs');var _chunkMSKWNMPVcjs = require('./chunk-MSKWNMPV.cjs');var _chunkJKPTRQD2cjs = require('./chunk-JKPTRQD2.cjs');var _chunkPSBX4PZWcjs = require('./chunk-PSBX4PZW.cjs');require('./chunk-GVFGQUCO.cjs');require('./chunk-W5TFNIA7.cjs');require('./chunk-XLWK4XHD.cjs');require('./chunk-3ZKXOCI7.cjs');require('./chunk-WFS45YN4.cjs');require('./chunk-DYRSQN7X.cjs');require('./chunk-NVJN7LPY.cjs');require('./chunk-AFYBD7FI.cjs');var _chunkZSWIQU3Ucjs = require('./chunk-ZSWIQU3U.cjs');require('./chunk-RD5PG4M6.cjs');require('./chunk-6HXIZLEQ.cjs');require('./chunk-EXGOZRL3.cjs');require('./chunk-5HTPBFDH.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');require('./chunk-ECAM5KTH.cjs');var _chunk6VJEBYPNcjs = require('./chunk-6VJEBYPN.cjs');require('./chunk-IR5WN6FQ.cjs');require('./chunk-GEY574TH.cjs');require('./chunk-YO6BJ2DI.cjs');require('./chunk-DIZVZP5P.cjs');require('./chunk-XALFCQKD.cjs');exports.AuthRejectedError = _chunkZSWIQU3Ucjs.a; exports.CrossmintWallets = _chunkMSKWNMPVcjs.b; exports.EVMWallet = _chunk33ZMLROFcjs.a; exports.InvalidApiKeyError = _chunkCT2UGJELcjs.a; exports.InvalidEnvironmentError = _chunkCT2UGJELcjs.b; exports.InvalidMessageFormatError = _chunkCT2UGJELcjs.j; exports.InvalidSignerError = _chunkCT2UGJELcjs.i; exports.InvalidTypedDataError = _chunkCT2UGJELcjs.k; exports.InvalidWalletConfigError = _chunkCT2UGJELcjs.e; exports.MessageSigningNotSupportedError = _chunkCT2UGJELcjs.n; exports.PendingApprovalsError = _chunkCT2UGJELcjs.x; exports.SignatureNotAvailableError = _chunkCT2UGJELcjs.p; exports.SignatureNotCreatedError = _chunkCT2UGJELcjs.o; exports.SignatureNotFoundError = _chunkCT2UGJELcjs.l; exports.SignerTypeMismatchError = _chunkCT2UGJELcjs.h; exports.SigningFailedError = _chunkCT2UGJELcjs.m; exports.SolanaWallet = _chunkQK3HMP6Hcjs.a; exports.TransactionAwaitingApprovalError = _chunkCT2UGJELcjs.u; exports.TransactionConfirmationTimeoutError = _chunkCT2UGJELcjs.s; exports.TransactionFailedError = _chunkCT2UGJELcjs.w; exports.TransactionHashNotFoundError = _chunkCT2UGJELcjs.v; exports.TransactionNotAvailableError = _chunkCT2UGJELcjs.r; exports.TransactionNotCreatedError = _chunkCT2UGJELcjs.q; exports.TransactionSendingFailedError = _chunkCT2UGJELcjs.t; exports.Wallet = _chunkPSBX4PZWcjs.a; exports.WalletCreationError = _chunkCT2UGJELcjs.f; exports.WalletFactory = _chunkJKPTRQD2cjs.a; exports.WalletNotAvailableError = _chunkCT2UGJELcjs.d; exports.WalletTypeMismatchError = _chunkCT2UGJELcjs.g; exports.WalletTypeNotSupportedError = _chunkCT2UGJELcjs.c; exports.createCrossmint = _chunkMSKWNMPVcjs.a; exports.toViemChain = _chunk6VJEBYPNcjs.a;
package/dist/index.d.cts CHANGED
@@ -6,8 +6,8 @@ export { SolanaWallet } from './wallets/solana.cjs';
6
6
  export { EVMWallet } from './wallets/evm.cjs';
7
7
  export { Callbacks, DelegatedSigner, EVMTransactionInput, PendingApproval, SolanaTransactionInput, WalletOptions } from './wallets/types.cjs';
8
8
  export { Chain, EVMChain, EVMSmartWalletChain, EVMSmartWalletMainnet, EVMSmartWalletTestnet, SolanaChain, toViemChain } from './chains/chains.cjs';
9
- export { ApiKeyInternalSignerConfig, ApiKeySignerConfig, AuthRejectedError, BaseExternalWalletSignerConfig, BaseSignResult, BaseSignerConfig, EmailInternalSignerConfig, EmailSignerConfig, EvmExternalWalletSignerConfig, ExternalWalletInternalSignerConfig, ExternalWalletSignerConfigForChain, GenericEIP1193Provider, InternalSignerConfig, PasskeyInternalSignerConfig, PasskeySignResult, PasskeySignerConfig, Signer, SignerConfigForChain, SolanaExternalWalletSignerConfig } from './signers/types.cjs';
10
- export { Crossmint, createCrossmint } from '@crossmint/common-sdk-base';
9
+ export { ApiKeyInternalSignerConfig, ApiKeySignerConfig, AuthRejectedError, BaseSignResult, BaseSignerConfig, EmailInternalSignerConfig, EmailSignerConfig, ExternalWalletInternalSignerConfig, ExternalWalletSignerConfigForChain, InternalSignerConfig, PasskeyInternalSignerConfig, PasskeySignResult, PasskeySignerConfig, Signer, SignerConfigForChain } from './signers/types.cjs';
10
+ export { Crossmint, EvmExternalWalletSignerConfig, GenericEIP1193Provider, SolanaExternalWalletSignerConfig, createCrossmint } from '@crossmint/common-sdk-base';
11
11
  export { Activity, Balances } from './api/types.cjs';
12
12
  import './api/gen/types.gen.cjs';
13
13
  import './api/client.cjs';
package/dist/index.d.ts CHANGED
@@ -6,8 +6,8 @@ export { SolanaWallet } from './wallets/solana.js';
6
6
  export { EVMWallet } from './wallets/evm.js';
7
7
  export { Callbacks, DelegatedSigner, EVMTransactionInput, PendingApproval, SolanaTransactionInput, WalletOptions } from './wallets/types.js';
8
8
  export { Chain, EVMChain, EVMSmartWalletChain, EVMSmartWalletMainnet, EVMSmartWalletTestnet, SolanaChain, toViemChain } from './chains/chains.js';
9
- export { ApiKeyInternalSignerConfig, ApiKeySignerConfig, AuthRejectedError, BaseExternalWalletSignerConfig, BaseSignResult, BaseSignerConfig, EmailInternalSignerConfig, EmailSignerConfig, EvmExternalWalletSignerConfig, ExternalWalletInternalSignerConfig, ExternalWalletSignerConfigForChain, GenericEIP1193Provider, InternalSignerConfig, PasskeyInternalSignerConfig, PasskeySignResult, PasskeySignerConfig, Signer, SignerConfigForChain, SolanaExternalWalletSignerConfig } from './signers/types.js';
10
- export { Crossmint, createCrossmint } from '@crossmint/common-sdk-base';
9
+ export { ApiKeyInternalSignerConfig, ApiKeySignerConfig, AuthRejectedError, BaseSignResult, BaseSignerConfig, EmailInternalSignerConfig, EmailSignerConfig, ExternalWalletInternalSignerConfig, ExternalWalletSignerConfigForChain, InternalSignerConfig, PasskeyInternalSignerConfig, PasskeySignResult, PasskeySignerConfig, Signer, SignerConfigForChain } from './signers/types.js';
10
+ export { Crossmint, EvmExternalWalletSignerConfig, GenericEIP1193Provider, SolanaExternalWalletSignerConfig, createCrossmint } from '@crossmint/common-sdk-base';
11
11
  export { Activity, Balances } from './api/types.js';
12
12
  import './api/gen/types.gen.js';
13
13
  import './api/client.js';
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{a as F}from"./chunk-STSNT4Z6.js";import{a as D}from"./chunk-W3EMZ2Y7.js";import"./chunk-PJUVPRKB.js";import{a as B,b as C}from"./chunk-BXVLIZ6G.js";import{a as A}from"./chunk-UVQDAYSR.js";import{a as y}from"./chunk-GCWUK6WO.js";import"./chunk-JASS6LGM.js";import"./chunk-3W44OI5M.js";import"./chunk-2AWC6KEP.js";import"./chunk-U34BYZY2.js";import"./chunk-BASQXCCA.js";import"./chunk-OV4CFQ36.js";import"./chunk-77QBSFHG.js";import"./chunk-LFYI7K4T.js";import{a as z}from"./chunk-M4ELAV7U.js";import"./chunk-FUUYGB4K.js";import"./chunk-5IFDVB4Y.js";import"./chunk-LWQ7YF46.js";import"./chunk-LQKXECMQ.js";import{a as o,b as r,c as e,d as f,e as m,f as p,g as t,h as x,i as a,j as b,k as c,l as d,m as g,n as h,o as i,p as j,q as k,r as l,s as n,t as q,u as s,v as u,w as v,x as w}from"./chunk-7ENJXL4H.js";import"./chunk-KBJA7JDT.js";import{a as E}from"./chunk-BJDS5BJG.js";import"./chunk-KKQBZXFE.js";import"./chunk-S3DYQVRD.js";import"./chunk-2KK65AC6.js";import"./chunk-R7KEBAQ2.js";import"./chunk-BW7YYVZE.js";export{z as AuthRejectedError,C as CrossmintWallets,F as EVMWallet,o as InvalidApiKeyError,r as InvalidEnvironmentError,b as InvalidMessageFormatError,a as InvalidSignerError,c as InvalidTypedDataError,m as InvalidWalletConfigError,h as MessageSigningNotSupportedError,w as PendingApprovalsError,j as SignatureNotAvailableError,i as SignatureNotCreatedError,d as SignatureNotFoundError,x as SignerTypeMismatchError,g as SigningFailedError,D as SolanaWallet,s as TransactionAwaitingApprovalError,n as TransactionConfirmationTimeoutError,v as TransactionFailedError,u as TransactionHashNotFoundError,l as TransactionNotAvailableError,k as TransactionNotCreatedError,q as TransactionSendingFailedError,y as Wallet,p as WalletCreationError,A as WalletFactory,f as WalletNotAvailableError,t as WalletTypeMismatchError,e as WalletTypeNotSupportedError,B as createCrossmint,E as toViemChain};
1
+ import{a as F}from"./chunk-DXPZTNTR.js";import{a as D}from"./chunk-IIS42MVC.js";import"./chunk-PJUVPRKB.js";import{a as B,b as C}from"./chunk-NIEQGTTW.js";import{a as A}from"./chunk-37FBC6CT.js";import{a as y}from"./chunk-YHRRQBIE.js";import"./chunk-QTZTCEUF.js";import"./chunk-3W44OI5M.js";import"./chunk-VBWFY7JR.js";import"./chunk-U34BYZY2.js";import"./chunk-OGGPNJY3.js";import"./chunk-OV4CFQ36.js";import"./chunk-77QBSFHG.js";import"./chunk-T3ICQDFS.js";import{a as z}from"./chunk-M4ELAV7U.js";import"./chunk-FUUYGB4K.js";import"./chunk-5IFDVB4Y.js";import"./chunk-VELN4PVT.js";import"./chunk-3D5RTPTJ.js";import{a as o,b as r,c as e,d as f,e as m,f as p,g as t,h as x,i as a,j as b,k as c,l as d,m as g,n as h,o as i,p as j,q as k,r as l,s as n,t as q,u as s,v as u,w as v,x as w}from"./chunk-7ENJXL4H.js";import"./chunk-KBJA7JDT.js";import{a as E}from"./chunk-BJDS5BJG.js";import"./chunk-KKQBZXFE.js";import"./chunk-S3DYQVRD.js";import"./chunk-2KK65AC6.js";import"./chunk-QTSZSHKK.js";import"./chunk-BW7YYVZE.js";export{z as AuthRejectedError,C as CrossmintWallets,F as EVMWallet,o as InvalidApiKeyError,r as InvalidEnvironmentError,b as InvalidMessageFormatError,a as InvalidSignerError,c as InvalidTypedDataError,m as InvalidWalletConfigError,h as MessageSigningNotSupportedError,w as PendingApprovalsError,j as SignatureNotAvailableError,i as SignatureNotCreatedError,d as SignatureNotFoundError,x as SignerTypeMismatchError,g as SigningFailedError,D as SolanaWallet,s as TransactionAwaitingApprovalError,n as TransactionConfirmationTimeoutError,v as TransactionFailedError,u as TransactionHashNotFoundError,l as TransactionNotAvailableError,k as TransactionNotCreatedError,q as TransactionSendingFailedError,y as Wallet,p as WalletCreationError,A as WalletFactory,f as WalletNotAvailableError,t as WalletTypeMismatchError,e as WalletTypeNotSupportedError,B as createCrossmint,E as toViemChain};
package/dist/sdk.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkHMQIDZ53cjs = require('./chunk-HMQIDZ53.cjs');require('./chunk-RDZYRVMZ.cjs');require('./chunk-5K5HFPJQ.cjs');require('./chunk-57EIEFQU.cjs');require('./chunk-W5TFNIA7.cjs');require('./chunk-3FUD4JAM.cjs');require('./chunk-3ZKXOCI7.cjs');require('./chunk-KTTTMBOT.cjs');require('./chunk-DYRSQN7X.cjs');require('./chunk-NVJN7LPY.cjs');require('./chunk-TWQ6DA3Y.cjs');require('./chunk-ZSWIQU3U.cjs');require('./chunk-RD5PG4M6.cjs');require('./chunk-6HXIZLEQ.cjs');require('./chunk-NQYAOPHP.cjs');require('./chunk-V3CBWWX2.cjs');require('./chunk-CT2UGJEL.cjs');require('./chunk-ECAM5KTH.cjs');require('./chunk-YO6BJ2DI.cjs');require('./chunk-YAORQK6R.cjs');require('./chunk-XALFCQKD.cjs');exports.CrossmintWallets = _chunkHMQIDZ53cjs.b; exports.createCrossmint = _chunkHMQIDZ53cjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkMSKWNMPVcjs = require('./chunk-MSKWNMPV.cjs');require('./chunk-JKPTRQD2.cjs');require('./chunk-PSBX4PZW.cjs');require('./chunk-GVFGQUCO.cjs');require('./chunk-W5TFNIA7.cjs');require('./chunk-XLWK4XHD.cjs');require('./chunk-3ZKXOCI7.cjs');require('./chunk-WFS45YN4.cjs');require('./chunk-DYRSQN7X.cjs');require('./chunk-NVJN7LPY.cjs');require('./chunk-AFYBD7FI.cjs');require('./chunk-ZSWIQU3U.cjs');require('./chunk-RD5PG4M6.cjs');require('./chunk-6HXIZLEQ.cjs');require('./chunk-EXGOZRL3.cjs');require('./chunk-5HTPBFDH.cjs');require('./chunk-CT2UGJEL.cjs');require('./chunk-ECAM5KTH.cjs');require('./chunk-YO6BJ2DI.cjs');require('./chunk-DIZVZP5P.cjs');require('./chunk-XALFCQKD.cjs');exports.CrossmintWallets = _chunkMSKWNMPVcjs.b; exports.createCrossmint = _chunkMSKWNMPVcjs.a;
package/dist/sdk.d.cts CHANGED
@@ -9,10 +9,10 @@ import 'viem';
9
9
  import './api/gen/types.gen.cjs';
10
10
  import './signers/types.cjs';
11
11
  import 'ox';
12
- import '@solana/web3.js';
13
12
  import '@crossmint/client-sdk-window';
14
13
  import '@crossmint/client-signers';
15
14
  import './wallets/types.cjs';
15
+ import '@solana/web3.js';
16
16
 
17
17
  declare class CrossmintWallets {
18
18
  private readonly walletFactory;
package/dist/sdk.d.ts CHANGED
@@ -9,10 +9,10 @@ import 'viem';
9
9
  import './api/gen/types.gen.js';
10
10
  import './signers/types.js';
11
11
  import 'ox';
12
- import '@solana/web3.js';
13
12
  import '@crossmint/client-sdk-window';
14
13
  import '@crossmint/client-signers';
15
14
  import './wallets/types.js';
15
+ import '@solana/web3.js';
16
16
 
17
17
  declare class CrossmintWallets {
18
18
  private readonly walletFactory;
package/dist/sdk.js CHANGED
@@ -1 +1 @@
1
- import{a,b}from"./chunk-BXVLIZ6G.js";import"./chunk-UVQDAYSR.js";import"./chunk-GCWUK6WO.js";import"./chunk-JASS6LGM.js";import"./chunk-3W44OI5M.js";import"./chunk-2AWC6KEP.js";import"./chunk-U34BYZY2.js";import"./chunk-BASQXCCA.js";import"./chunk-OV4CFQ36.js";import"./chunk-77QBSFHG.js";import"./chunk-LFYI7K4T.js";import"./chunk-M4ELAV7U.js";import"./chunk-FUUYGB4K.js";import"./chunk-5IFDVB4Y.js";import"./chunk-LWQ7YF46.js";import"./chunk-LQKXECMQ.js";import"./chunk-7ENJXL4H.js";import"./chunk-KBJA7JDT.js";import"./chunk-2KK65AC6.js";import"./chunk-R7KEBAQ2.js";import"./chunk-BW7YYVZE.js";export{b as CrossmintWallets,a as createCrossmint};
1
+ import{a,b}from"./chunk-NIEQGTTW.js";import"./chunk-37FBC6CT.js";import"./chunk-YHRRQBIE.js";import"./chunk-QTZTCEUF.js";import"./chunk-3W44OI5M.js";import"./chunk-VBWFY7JR.js";import"./chunk-U34BYZY2.js";import"./chunk-OGGPNJY3.js";import"./chunk-OV4CFQ36.js";import"./chunk-77QBSFHG.js";import"./chunk-T3ICQDFS.js";import"./chunk-M4ELAV7U.js";import"./chunk-FUUYGB4K.js";import"./chunk-5IFDVB4Y.js";import"./chunk-VELN4PVT.js";import"./chunk-3D5RTPTJ.js";import"./chunk-7ENJXL4H.js";import"./chunk-KBJA7JDT.js";import"./chunk-2KK65AC6.js";import"./chunk-QTSZSHKK.js";import"./chunk-BW7YYVZE.js";export{b as CrossmintWallets,a as createCrossmint};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkKTTTMBOTcjs = require('../../chunk-KTTTMBOT.cjs');require('../../chunk-V3CBWWX2.cjs');require('../../chunk-CT2UGJEL.cjs');require('../../chunk-XALFCQKD.cjs');exports.EmailSignerApiClient = _chunkKTTTMBOTcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkWFS45YN4cjs = require('../../chunk-WFS45YN4.cjs');require('../../chunk-5HTPBFDH.cjs');require('../../chunk-CT2UGJEL.cjs');require('../../chunk-XALFCQKD.cjs');exports.EmailSignerApiClient = _chunkWFS45YN4cjs.a;
@@ -1 +1 @@
1
- import{a}from"../../chunk-BASQXCCA.js";import"../../chunk-LQKXECMQ.js";import"../../chunk-7ENJXL4H.js";import"../../chunk-BW7YYVZE.js";export{a as EmailSignerApiClient};
1
+ import{a}from"../../chunk-OGGPNJY3.js";import"../../chunk-3D5RTPTJ.js";import"../../chunk-7ENJXL4H.js";import"../../chunk-BW7YYVZE.js";export{a as EmailSignerApiClient};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk3FUD4JAMcjs = require('../../chunk-3FUD4JAM.cjs');require('../../chunk-3ZKXOCI7.cjs');require('../../chunk-KTTTMBOT.cjs');require('../../chunk-ZSWIQU3U.cjs');require('../../chunk-V3CBWWX2.cjs');require('../../chunk-CT2UGJEL.cjs');require('../../chunk-XALFCQKD.cjs');exports.EmailSigner = _chunk3FUD4JAMcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkXLWK4XHDcjs = require('../../chunk-XLWK4XHD.cjs');require('../../chunk-3ZKXOCI7.cjs');require('../../chunk-WFS45YN4.cjs');require('../../chunk-ZSWIQU3U.cjs');require('../../chunk-5HTPBFDH.cjs');require('../../chunk-CT2UGJEL.cjs');require('../../chunk-XALFCQKD.cjs');exports.EmailSigner = _chunkXLWK4XHDcjs.a;
@@ -1,11 +1,10 @@
1
1
  import { Signer, EmailInternalSignerConfig } from '../types.cjs';
2
2
  import { Crossmint } from '@crossmint/common-sdk-base';
3
3
  import 'ox';
4
- import '@solana/web3.js';
5
- import 'viem';
6
4
  import '@crossmint/client-sdk-window';
7
5
  import '@crossmint/client-signers';
8
6
  import '../../chains/chains.cjs';
7
+ import 'viem';
9
8
 
10
9
  declare class EmailSigner implements Signer {
11
10
  private config;
@@ -1,11 +1,10 @@
1
1
  import { Signer, EmailInternalSignerConfig } from '../types.js';
2
2
  import { Crossmint } from '@crossmint/common-sdk-base';
3
3
  import 'ox';
4
- import '@solana/web3.js';
5
- import 'viem';
6
4
  import '@crossmint/client-sdk-window';
7
5
  import '@crossmint/client-signers';
8
6
  import '../../chains/chains.js';
7
+ import 'viem';
9
8
 
10
9
  declare class EmailSigner implements Signer {
11
10
  private config;
@@ -1 +1 @@
1
- import{a}from"../../chunk-2AWC6KEP.js";import"../../chunk-U34BYZY2.js";import"../../chunk-BASQXCCA.js";import"../../chunk-M4ELAV7U.js";import"../../chunk-LQKXECMQ.js";import"../../chunk-7ENJXL4H.js";import"../../chunk-BW7YYVZE.js";export{a as EmailSigner};
1
+ import{a}from"../../chunk-VBWFY7JR.js";import"../../chunk-U34BYZY2.js";import"../../chunk-OGGPNJY3.js";import"../../chunk-M4ELAV7U.js";import"../../chunk-3D5RTPTJ.js";import"../../chunk-7ENJXL4H.js";import"../../chunk-BW7YYVZE.js";export{a as EmailSigner};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../../chunk-W5TFNIA7.cjs');var _chunk3FUD4JAMcjs = require('../../chunk-3FUD4JAM.cjs');require('../../chunk-3ZKXOCI7.cjs');require('../../chunk-KTTTMBOT.cjs');require('../../chunk-ZSWIQU3U.cjs');require('../../chunk-V3CBWWX2.cjs');require('../../chunk-CT2UGJEL.cjs');require('../../chunk-XALFCQKD.cjs');exports.EmailSigner = _chunk3FUD4JAMcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../../chunk-W5TFNIA7.cjs');var _chunkXLWK4XHDcjs = require('../../chunk-XLWK4XHD.cjs');require('../../chunk-3ZKXOCI7.cjs');require('../../chunk-WFS45YN4.cjs');require('../../chunk-ZSWIQU3U.cjs');require('../../chunk-5HTPBFDH.cjs');require('../../chunk-CT2UGJEL.cjs');require('../../chunk-XALFCQKD.cjs');exports.EmailSigner = _chunkXLWK4XHDcjs.a;
@@ -1,9 +1,8 @@
1
1
  export { EmailSigner } from './email.cjs';
2
2
  import '../types.cjs';
3
3
  import 'ox';
4
- import '@solana/web3.js';
5
- import 'viem';
6
4
  import '@crossmint/client-sdk-window';
7
5
  import '@crossmint/client-signers';
8
6
  import '@crossmint/common-sdk-base';
9
7
  import '../../chains/chains.cjs';
8
+ import 'viem';
@@ -1,9 +1,8 @@
1
1
  export { EmailSigner } from './email.js';
2
2
  import '../types.js';
3
3
  import 'ox';
4
- import '@solana/web3.js';
5
- import 'viem';
6
4
  import '@crossmint/client-sdk-window';
7
5
  import '@crossmint/client-signers';
8
6
  import '@crossmint/common-sdk-base';
9
7
  import '../../chains/chains.js';
8
+ import 'viem';
@@ -1 +1 @@
1
- import"../../chunk-3W44OI5M.js";import{a}from"../../chunk-2AWC6KEP.js";import"../../chunk-U34BYZY2.js";import"../../chunk-BASQXCCA.js";import"../../chunk-M4ELAV7U.js";import"../../chunk-LQKXECMQ.js";import"../../chunk-7ENJXL4H.js";import"../../chunk-BW7YYVZE.js";export{a as EmailSigner};
1
+ import"../../chunk-3W44OI5M.js";import{a}from"../../chunk-VBWFY7JR.js";import"../../chunk-U34BYZY2.js";import"../../chunk-OGGPNJY3.js";import"../../chunk-M4ELAV7U.js";import"../../chunk-3D5RTPTJ.js";import"../../chunk-7ENJXL4H.js";import"../../chunk-BW7YYVZE.js";export{a as EmailSigner};
@@ -1,11 +1,10 @@
1
1
  import { Signer, ApiKeyInternalSignerConfig } from './types.cjs';
2
2
  import 'ox';
3
- import '@solana/web3.js';
4
- import 'viem';
5
3
  import '@crossmint/client-sdk-window';
6
4
  import '@crossmint/client-signers';
7
5
  import '@crossmint/common-sdk-base';
8
6
  import '../chains/chains.cjs';
7
+ import 'viem';
9
8
 
10
9
  declare class EVMApiKeySigner implements Signer {
11
10
  private readonly config;
@@ -1,11 +1,10 @@
1
1
  import { Signer, ApiKeyInternalSignerConfig } from './types.js';
2
2
  import 'ox';
3
- import '@solana/web3.js';
4
- import 'viem';
5
3
  import '@crossmint/client-sdk-window';
6
4
  import '@crossmint/client-signers';
7
5
  import '@crossmint/common-sdk-base';
8
6
  import '../chains/chains.js';
7
+ import 'viem';
9
8
 
10
9
  declare class EVMApiKeySigner implements Signer {
11
10
  private readonly config;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkYAORQK6Rcjs = require('../chunk-YAORQK6R.cjs');require('../chunk-XALFCQKD.cjs');exports.EVMExternalWalletSigner = _chunkYAORQK6Rcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkDIZVZP5Pcjs = require('../chunk-DIZVZP5P.cjs');require('../chunk-XALFCQKD.cjs');exports.EVMExternalWalletSigner = _chunkDIZVZP5Pcjs.a;
@@ -1,10 +1,9 @@
1
1
  import { EIP1193Provider, Account } from 'viem';
2
- import { Signer, GenericEIP1193Provider, EvmExternalWalletSignerConfig } from './types.cjs';
2
+ import { Signer } from './types.cjs';
3
+ import { GenericEIP1193Provider, EvmExternalWalletSignerConfig } from '@crossmint/common-sdk-base';
3
4
  import 'ox';
4
- import '@solana/web3.js';
5
5
  import '@crossmint/client-sdk-window';
6
6
  import '@crossmint/client-signers';
7
- import '@crossmint/common-sdk-base';
8
7
  import '../chains/chains.cjs';
9
8
 
10
9
  declare class EVMExternalWalletSigner implements Signer {
@@ -1,10 +1,9 @@
1
1
  import { EIP1193Provider, Account } from 'viem';
2
- import { Signer, GenericEIP1193Provider, EvmExternalWalletSignerConfig } from './types.js';
2
+ import { Signer } from './types.js';
3
+ import { GenericEIP1193Provider, EvmExternalWalletSignerConfig } from '@crossmint/common-sdk-base';
3
4
  import 'ox';
4
- import '@solana/web3.js';
5
5
  import '@crossmint/client-sdk-window';
6
6
  import '@crossmint/client-signers';
7
- import '@crossmint/common-sdk-base';
8
7
  import '../chains/chains.js';
9
8
 
10
9
  declare class EVMExternalWalletSigner implements Signer {
@@ -1 +1 @@
1
- import{a}from"../chunk-R7KEBAQ2.js";import"../chunk-BW7YYVZE.js";export{a as EVMExternalWalletSigner};
1
+ import{a}from"../chunk-QTSZSHKK.js";import"../chunk-BW7YYVZE.js";export{a as EVMExternalWalletSigner};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk57EIEFQUcjs = require('../chunk-57EIEFQU.cjs');require('../chunk-W5TFNIA7.cjs');require('../chunk-3FUD4JAM.cjs');require('../chunk-3ZKXOCI7.cjs');require('../chunk-KTTTMBOT.cjs');require('../chunk-DYRSQN7X.cjs');require('../chunk-NVJN7LPY.cjs');require('../chunk-TWQ6DA3Y.cjs');require('../chunk-ZSWIQU3U.cjs');require('../chunk-V3CBWWX2.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-YO6BJ2DI.cjs');require('../chunk-YAORQK6R.cjs');require('../chunk-XALFCQKD.cjs');exports.assembleSigner = _chunk57EIEFQUcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkGVFGQUCOcjs = require('../chunk-GVFGQUCO.cjs');require('../chunk-W5TFNIA7.cjs');require('../chunk-XLWK4XHD.cjs');require('../chunk-3ZKXOCI7.cjs');require('../chunk-WFS45YN4.cjs');require('../chunk-DYRSQN7X.cjs');require('../chunk-NVJN7LPY.cjs');require('../chunk-AFYBD7FI.cjs');require('../chunk-ZSWIQU3U.cjs');require('../chunk-5HTPBFDH.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-YO6BJ2DI.cjs');require('../chunk-DIZVZP5P.cjs');require('../chunk-XALFCQKD.cjs');exports.assembleSigner = _chunkGVFGQUCOcjs.a;
@@ -2,7 +2,6 @@ import { Chain } from '../chains/chains.cjs';
2
2
  import { InternalSignerConfig, Signer } from './types.cjs';
3
3
  import 'viem';
4
4
  import 'ox';
5
- import '@solana/web3.js';
6
5
  import '@crossmint/client-sdk-window';
7
6
  import '@crossmint/client-signers';
8
7
  import '@crossmint/common-sdk-base';
@@ -2,7 +2,6 @@ import { Chain } from '../chains/chains.js';
2
2
  import { InternalSignerConfig, Signer } from './types.js';
3
3
  import 'viem';
4
4
  import 'ox';
5
- import '@solana/web3.js';
6
5
  import '@crossmint/client-sdk-window';
7
6
  import '@crossmint/client-signers';
8
7
  import '@crossmint/common-sdk-base';
@@ -1 +1 @@
1
- import{a}from"../chunk-JASS6LGM.js";import"../chunk-3W44OI5M.js";import"../chunk-2AWC6KEP.js";import"../chunk-U34BYZY2.js";import"../chunk-BASQXCCA.js";import"../chunk-OV4CFQ36.js";import"../chunk-77QBSFHG.js";import"../chunk-LFYI7K4T.js";import"../chunk-M4ELAV7U.js";import"../chunk-LQKXECMQ.js";import"../chunk-7ENJXL4H.js";import"../chunk-2KK65AC6.js";import"../chunk-R7KEBAQ2.js";import"../chunk-BW7YYVZE.js";export{a as assembleSigner};
1
+ import{a}from"../chunk-QTZTCEUF.js";import"../chunk-3W44OI5M.js";import"../chunk-VBWFY7JR.js";import"../chunk-U34BYZY2.js";import"../chunk-OGGPNJY3.js";import"../chunk-OV4CFQ36.js";import"../chunk-77QBSFHG.js";import"../chunk-T3ICQDFS.js";import"../chunk-M4ELAV7U.js";import"../chunk-3D5RTPTJ.js";import"../chunk-7ENJXL4H.js";import"../chunk-2KK65AC6.js";import"../chunk-QTSZSHKK.js";import"../chunk-BW7YYVZE.js";export{a as assembleSigner};
@@ -1,11 +1,10 @@
1
1
  import { Signer, PasskeyInternalSignerConfig, PasskeySignResult } from './types.cjs';
2
2
  import 'ox';
3
- import '@solana/web3.js';
4
- import 'viem';
5
3
  import '@crossmint/client-sdk-window';
6
4
  import '@crossmint/client-signers';
7
5
  import '@crossmint/common-sdk-base';
8
6
  import '../chains/chains.cjs';
7
+ import 'viem';
9
8
 
10
9
  declare class PasskeySigner implements Signer {
11
10
  private config;
@@ -1,11 +1,10 @@
1
1
  import { Signer, PasskeyInternalSignerConfig, PasskeySignResult } from './types.js';
2
2
  import 'ox';
3
- import '@solana/web3.js';
4
- import 'viem';
5
3
  import '@crossmint/client-sdk-window';
6
4
  import '@crossmint/client-signers';
7
5
  import '@crossmint/common-sdk-base';
8
6
  import '../chains/chains.js';
7
+ import 'viem';
9
8
 
10
9
  declare class PasskeySigner implements Signer {
11
10
  private config;
@@ -1,11 +1,10 @@
1
1
  import { Signer, ApiKeyInternalSignerConfig } from './types.cjs';
2
2
  import 'ox';
3
- import '@solana/web3.js';
4
- import 'viem';
5
3
  import '@crossmint/client-sdk-window';
6
4
  import '@crossmint/client-signers';
7
5
  import '@crossmint/common-sdk-base';
8
6
  import '../chains/chains.cjs';
7
+ import 'viem';
9
8
 
10
9
  declare class SolanaApiKeySigner implements Signer {
11
10
  private readonly config;
@@ -1,11 +1,10 @@
1
1
  import { Signer, ApiKeyInternalSignerConfig } from './types.js';
2
2
  import 'ox';
3
- import '@solana/web3.js';
4
- import 'viem';
5
3
  import '@crossmint/client-sdk-window';
6
4
  import '@crossmint/client-signers';
7
5
  import '@crossmint/common-sdk-base';
8
6
  import '../chains/chains.js';
7
+ import 'viem';
9
8
 
10
9
  declare class SolanaApiKeySigner implements Signer {
11
10
  private readonly config;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkTWQ6DA3Ycjs = require('../chunk-TWQ6DA3Y.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-XALFCQKD.cjs');exports.SolanaExternalWalletSigner = _chunkTWQ6DA3Ycjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkAFYBD7FIcjs = require('../chunk-AFYBD7FI.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-XALFCQKD.cjs');exports.SolanaExternalWalletSigner = _chunkAFYBD7FIcjs.a;
@@ -1,11 +1,11 @@
1
1
  import { VersionedTransaction } from '@solana/web3.js';
2
- import { Signer, SolanaExternalWalletSignerConfig } from './types.cjs';
2
+ import { Signer } from './types.cjs';
3
+ import { SolanaExternalWalletSignerConfig } from '@crossmint/common-sdk-base';
3
4
  import 'ox';
4
- import 'viem';
5
5
  import '@crossmint/client-sdk-window';
6
6
  import '@crossmint/client-signers';
7
- import '@crossmint/common-sdk-base';
8
7
  import '../chains/chains.cjs';
8
+ import 'viem';
9
9
 
10
10
  declare class SolanaExternalWalletSigner implements Signer {
11
11
  type: "external-wallet";
@@ -1,11 +1,11 @@
1
1
  import { VersionedTransaction } from '@solana/web3.js';
2
- import { Signer, SolanaExternalWalletSignerConfig } from './types.js';
2
+ import { Signer } from './types.js';
3
+ import { SolanaExternalWalletSignerConfig } from '@crossmint/common-sdk-base';
3
4
  import 'ox';
4
- import 'viem';
5
5
  import '@crossmint/client-sdk-window';
6
6
  import '@crossmint/client-signers';
7
- import '@crossmint/common-sdk-base';
8
7
  import '../chains/chains.js';
8
+ import 'viem';
9
9
 
10
10
  declare class SolanaExternalWalletSigner implements Signer {
11
11
  type: "external-wallet";
@@ -1 +1 @@
1
- import{a}from"../chunk-LFYI7K4T.js";import"../chunk-7ENJXL4H.js";import"../chunk-BW7YYVZE.js";export{a as SolanaExternalWalletSigner};
1
+ import{a}from"../chunk-T3ICQDFS.js";import"../chunk-7ENJXL4H.js";import"../chunk-BW7YYVZE.js";export{a as SolanaExternalWalletSigner};
@@ -1,10 +1,10 @@
1
1
  import { WebAuthnP256 } from 'ox';
2
- import { VersionedTransaction } from '@solana/web3.js';
3
- import { EIP1193Provider, Account } from 'viem';
4
2
  import { HandshakeParent } from '@crossmint/client-sdk-window';
5
3
  import { signerOutboundEvents, signerInboundEvents } from '@crossmint/client-signers';
6
- import { Crossmint } from '@crossmint/common-sdk-base';
4
+ import { SolanaExternalWalletSignerConfig, EvmExternalWalletSignerConfig, Crossmint } from '@crossmint/common-sdk-base';
5
+ export { EvmExternalWalletSignerConfig, GenericEIP1193Provider, SolanaExternalWalletSignerConfig } from '@crossmint/common-sdk-base';
7
6
  import { Chain, SolanaChain } from '../chains/chains.cjs';
7
+ import 'viem';
8
8
 
9
9
  declare class AuthRejectedError extends Error {
10
10
  constructor();
@@ -15,26 +15,7 @@ type EmailSignerConfig = {
15
15
  onAuthRequired?: (needsAuth: boolean, sendEmailWithOtp: () => Promise<void>, verifyOtp: (otp: string) => Promise<void>, reject: () => void) => Promise<void>;
16
16
  _handshakeParent?: HandshakeParent<typeof signerOutboundEvents, typeof signerInboundEvents>;
17
17
  };
18
- type BaseExternalWalletSignerConfig = {
19
- type: "external-wallet";
20
- address: string;
21
- };
22
- type EvmExternalWalletSignerConfig = BaseExternalWalletSignerConfig & {
23
- provider?: GenericEIP1193Provider | EIP1193Provider;
24
- viemAccount?: Account;
25
- };
26
- type SolanaExternalWalletSignerConfig = BaseExternalWalletSignerConfig & {
27
- onSignTransaction: (transaction: VersionedTransaction) => Promise<VersionedTransaction>;
28
- };
29
18
  type ExternalWalletSignerConfigForChain<C extends Chain> = C extends SolanaChain ? SolanaExternalWalletSignerConfig : EvmExternalWalletSignerConfig;
30
- interface GenericEIP1193Provider {
31
- request(args: {
32
- method: string;
33
- params?: any[];
34
- }): Promise<any>;
35
- on(event: string, listener: (...args: any[]) => void): void;
36
- removeListener(event: string, listener: (...args: any[]) => void): void;
37
- }
38
19
  type ApiKeySignerConfig = {
39
20
  type: "api-key";
40
21
  };
@@ -88,4 +69,4 @@ interface Signer<T extends keyof SignResultMap = keyof SignResultMap> {
88
69
  signTransaction(transaction: string): Promise<SignResultMap[T]>;
89
70
  }
90
71
 
91
- export { type ApiKeyInternalSignerConfig, type ApiKeySignerConfig, AuthRejectedError, type BaseExternalWalletSignerConfig, type BaseSignResult, type BaseSignerConfig, type EmailInternalSignerConfig, type EmailSignerConfig, type EvmExternalWalletSignerConfig, type ExternalWalletInternalSignerConfig, type ExternalWalletSignerConfigForChain, type GenericEIP1193Provider, type InternalSignerConfig, type PasskeyInternalSignerConfig, type PasskeySignResult, type PasskeySignerConfig, type Signer, type SignerConfigForChain, type SolanaExternalWalletSignerConfig };
72
+ export { type ApiKeyInternalSignerConfig, type ApiKeySignerConfig, AuthRejectedError, type BaseSignResult, type BaseSignerConfig, type EmailInternalSignerConfig, type EmailSignerConfig, type ExternalWalletInternalSignerConfig, type ExternalWalletSignerConfigForChain, type InternalSignerConfig, type PasskeyInternalSignerConfig, type PasskeySignResult, type PasskeySignerConfig, type Signer, type SignerConfigForChain };
@@ -1,10 +1,10 @@
1
1
  import { WebAuthnP256 } from 'ox';
2
- import { VersionedTransaction } from '@solana/web3.js';
3
- import { EIP1193Provider, Account } from 'viem';
4
2
  import { HandshakeParent } from '@crossmint/client-sdk-window';
5
3
  import { signerOutboundEvents, signerInboundEvents } from '@crossmint/client-signers';
6
- import { Crossmint } from '@crossmint/common-sdk-base';
4
+ import { SolanaExternalWalletSignerConfig, EvmExternalWalletSignerConfig, Crossmint } from '@crossmint/common-sdk-base';
5
+ export { EvmExternalWalletSignerConfig, GenericEIP1193Provider, SolanaExternalWalletSignerConfig } from '@crossmint/common-sdk-base';
7
6
  import { Chain, SolanaChain } from '../chains/chains.js';
7
+ import 'viem';
8
8
 
9
9
  declare class AuthRejectedError extends Error {
10
10
  constructor();
@@ -15,26 +15,7 @@ type EmailSignerConfig = {
15
15
  onAuthRequired?: (needsAuth: boolean, sendEmailWithOtp: () => Promise<void>, verifyOtp: (otp: string) => Promise<void>, reject: () => void) => Promise<void>;
16
16
  _handshakeParent?: HandshakeParent<typeof signerOutboundEvents, typeof signerInboundEvents>;
17
17
  };
18
- type BaseExternalWalletSignerConfig = {
19
- type: "external-wallet";
20
- address: string;
21
- };
22
- type EvmExternalWalletSignerConfig = BaseExternalWalletSignerConfig & {
23
- provider?: GenericEIP1193Provider | EIP1193Provider;
24
- viemAccount?: Account;
25
- };
26
- type SolanaExternalWalletSignerConfig = BaseExternalWalletSignerConfig & {
27
- onSignTransaction: (transaction: VersionedTransaction) => Promise<VersionedTransaction>;
28
- };
29
18
  type ExternalWalletSignerConfigForChain<C extends Chain> = C extends SolanaChain ? SolanaExternalWalletSignerConfig : EvmExternalWalletSignerConfig;
30
- interface GenericEIP1193Provider {
31
- request(args: {
32
- method: string;
33
- params?: any[];
34
- }): Promise<any>;
35
- on(event: string, listener: (...args: any[]) => void): void;
36
- removeListener(event: string, listener: (...args: any[]) => void): void;
37
- }
38
19
  type ApiKeySignerConfig = {
39
20
  type: "api-key";
40
21
  };
@@ -88,4 +69,4 @@ interface Signer<T extends keyof SignResultMap = keyof SignResultMap> {
88
69
  signTransaction(transaction: string): Promise<SignResultMap[T]>;
89
70
  }
90
71
 
91
- export { type ApiKeyInternalSignerConfig, type ApiKeySignerConfig, AuthRejectedError, type BaseExternalWalletSignerConfig, type BaseSignResult, type BaseSignerConfig, type EmailInternalSignerConfig, type EmailSignerConfig, type EvmExternalWalletSignerConfig, type ExternalWalletInternalSignerConfig, type ExternalWalletSignerConfigForChain, type GenericEIP1193Provider, type InternalSignerConfig, type PasskeyInternalSignerConfig, type PasskeySignResult, type PasskeySignerConfig, type Signer, type SignerConfigForChain, type SolanaExternalWalletSignerConfig };
72
+ export { type ApiKeyInternalSignerConfig, type ApiKeySignerConfig, AuthRejectedError, type BaseSignResult, type BaseSignerConfig, type EmailInternalSignerConfig, type EmailSignerConfig, type ExternalWalletInternalSignerConfig, type ExternalWalletSignerConfigForChain, type InternalSignerConfig, type PasskeyInternalSignerConfig, type PasskeySignResult, type PasskeySignerConfig, type Signer, type SignerConfigForChain };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkV3CBWWX2cjs = require('../chunk-V3CBWWX2.cjs');require('../chunk-XALFCQKD.cjs');exports.SDK_NAME = _chunkV3CBWWX2cjs.c; exports.SDK_VERSION = _chunkV3CBWWX2cjs.b; exports.STATUS_POLLING_INTERVAL_MS = _chunkV3CBWWX2cjs.d; exports.WALLETS_SERVICE = _chunkV3CBWWX2cjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk5HTPBFDHcjs = require('../chunk-5HTPBFDH.cjs');require('../chunk-XALFCQKD.cjs');exports.SDK_NAME = _chunk5HTPBFDHcjs.c; exports.SDK_VERSION = _chunk5HTPBFDHcjs.b; exports.STATUS_POLLING_INTERVAL_MS = _chunk5HTPBFDHcjs.d; exports.WALLETS_SERVICE = _chunk5HTPBFDHcjs.a;
@@ -1 +1 @@
1
- import{a,b,c,d}from"../chunk-LQKXECMQ.js";import"../chunk-BW7YYVZE.js";export{c as SDK_NAME,b as SDK_VERSION,d as STATUS_POLLING_INTERVAL_MS,a as WALLETS_SERVICE};
1
+ import{a,b,c,d}from"../chunk-3D5RTPTJ.js";import"../chunk-BW7YYVZE.js";export{c as SDK_NAME,b as SDK_VERSION,d as STATUS_POLLING_INTERVAL_MS,a as WALLETS_SERVICE};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkYUXGNX2Rcjs = require('../chunk-YUXGNX2R.cjs');require('../chunk-5K5HFPJQ.cjs');require('../chunk-V3CBWWX2.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-6VJEBYPN.cjs');require('../chunk-IR5WN6FQ.cjs');require('../chunk-GEY574TH.cjs');require('../chunk-XALFCQKD.cjs');exports.EVMWallet = _chunkYUXGNX2Rcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk33ZMLROFcjs = require('../chunk-33ZMLROF.cjs');require('../chunk-PSBX4PZW.cjs');require('../chunk-5HTPBFDH.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-6VJEBYPN.cjs');require('../chunk-IR5WN6FQ.cjs');require('../chunk-GEY574TH.cjs');require('../chunk-XALFCQKD.cjs');exports.EVMWallet = _chunk33ZMLROFcjs.a;
@@ -1 +1 @@
1
- import{a}from"../chunk-STSNT4Z6.js";import"../chunk-GCWUK6WO.js";import"../chunk-LQKXECMQ.js";import"../chunk-7ENJXL4H.js";import"../chunk-BJDS5BJG.js";import"../chunk-KKQBZXFE.js";import"../chunk-S3DYQVRD.js";import"../chunk-BW7YYVZE.js";export{a as EVMWallet};
1
+ import{a}from"../chunk-DXPZTNTR.js";import"../chunk-YHRRQBIE.js";import"../chunk-3D5RTPTJ.js";import"../chunk-7ENJXL4H.js";import"../chunk-BJDS5BJG.js";import"../chunk-KKQBZXFE.js";import"../chunk-S3DYQVRD.js";import"../chunk-BW7YYVZE.js";export{a as EVMWallet};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkUYFBYHITcjs = require('../chunk-UYFBYHIT.cjs');require('../chunk-5K5HFPJQ.cjs');require('../chunk-TWQ6DA3Y.cjs');require('../chunk-V3CBWWX2.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-XALFCQKD.cjs');exports.SolanaWallet = _chunkUYFBYHITcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkQK3HMP6Hcjs = require('../chunk-QK3HMP6H.cjs');require('../chunk-PSBX4PZW.cjs');require('../chunk-AFYBD7FI.cjs');require('../chunk-5HTPBFDH.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-XALFCQKD.cjs');exports.SolanaWallet = _chunkQK3HMP6Hcjs.a;
@@ -1 +1 @@
1
- import{a}from"../chunk-W3EMZ2Y7.js";import"../chunk-GCWUK6WO.js";import"../chunk-LFYI7K4T.js";import"../chunk-LQKXECMQ.js";import"../chunk-7ENJXL4H.js";import"../chunk-BW7YYVZE.js";export{a as SolanaWallet};
1
+ import{a}from"../chunk-IIS42MVC.js";import"../chunk-YHRRQBIE.js";import"../chunk-T3ICQDFS.js";import"../chunk-3D5RTPTJ.js";import"../chunk-7ENJXL4H.js";import"../chunk-BW7YYVZE.js";export{a as SolanaWallet};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkRDZYRVMZcjs = require('../chunk-RDZYRVMZ.cjs');require('../chunk-5K5HFPJQ.cjs');require('../chunk-57EIEFQU.cjs');require('../chunk-W5TFNIA7.cjs');require('../chunk-3FUD4JAM.cjs');require('../chunk-3ZKXOCI7.cjs');require('../chunk-KTTTMBOT.cjs');require('../chunk-DYRSQN7X.cjs');require('../chunk-NVJN7LPY.cjs');require('../chunk-TWQ6DA3Y.cjs');require('../chunk-ZSWIQU3U.cjs');require('../chunk-RD5PG4M6.cjs');require('../chunk-V3CBWWX2.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-YO6BJ2DI.cjs');require('../chunk-YAORQK6R.cjs');require('../chunk-XALFCQKD.cjs');exports.WalletFactory = _chunkRDZYRVMZcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkJKPTRQD2cjs = require('../chunk-JKPTRQD2.cjs');require('../chunk-PSBX4PZW.cjs');require('../chunk-GVFGQUCO.cjs');require('../chunk-W5TFNIA7.cjs');require('../chunk-XLWK4XHD.cjs');require('../chunk-3ZKXOCI7.cjs');require('../chunk-WFS45YN4.cjs');require('../chunk-DYRSQN7X.cjs');require('../chunk-NVJN7LPY.cjs');require('../chunk-AFYBD7FI.cjs');require('../chunk-ZSWIQU3U.cjs');require('../chunk-RD5PG4M6.cjs');require('../chunk-5HTPBFDH.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-YO6BJ2DI.cjs');require('../chunk-DIZVZP5P.cjs');require('../chunk-XALFCQKD.cjs');exports.WalletFactory = _chunkJKPTRQD2cjs.a;
@@ -8,9 +8,9 @@ import '../api/types.cjs';
8
8
  import 'viem';
9
9
  import '../api/gen/types.gen.cjs';
10
10
  import 'ox';
11
- import '@solana/web3.js';
12
11
  import '@crossmint/client-sdk-window';
13
12
  import '@crossmint/client-signers';
13
+ import '@solana/web3.js';
14
14
 
15
15
  type WalletArgsFor<C extends Chain> = {
16
16
  chain: C;
@@ -8,9 +8,9 @@ import '../api/types.js';
8
8
  import 'viem';
9
9
  import '../api/gen/types.gen.js';
10
10
  import 'ox';
11
- import '@solana/web3.js';
12
11
  import '@crossmint/client-sdk-window';
13
12
  import '@crossmint/client-signers';
13
+ import '@solana/web3.js';
14
14
 
15
15
  type WalletArgsFor<C extends Chain> = {
16
16
  chain: C;
@@ -1 +1 @@
1
- import{a}from"../chunk-UVQDAYSR.js";import"../chunk-GCWUK6WO.js";import"../chunk-JASS6LGM.js";import"../chunk-3W44OI5M.js";import"../chunk-2AWC6KEP.js";import"../chunk-U34BYZY2.js";import"../chunk-BASQXCCA.js";import"../chunk-OV4CFQ36.js";import"../chunk-77QBSFHG.js";import"../chunk-LFYI7K4T.js";import"../chunk-M4ELAV7U.js";import"../chunk-FUUYGB4K.js";import"../chunk-LQKXECMQ.js";import"../chunk-7ENJXL4H.js";import"../chunk-2KK65AC6.js";import"../chunk-R7KEBAQ2.js";import"../chunk-BW7YYVZE.js";export{a as WalletFactory};
1
+ import{a}from"../chunk-37FBC6CT.js";import"../chunk-YHRRQBIE.js";import"../chunk-QTZTCEUF.js";import"../chunk-3W44OI5M.js";import"../chunk-VBWFY7JR.js";import"../chunk-U34BYZY2.js";import"../chunk-OGGPNJY3.js";import"../chunk-OV4CFQ36.js";import"../chunk-77QBSFHG.js";import"../chunk-T3ICQDFS.js";import"../chunk-M4ELAV7U.js";import"../chunk-FUUYGB4K.js";import"../chunk-3D5RTPTJ.js";import"../chunk-7ENJXL4H.js";import"../chunk-2KK65AC6.js";import"../chunk-QTSZSHKK.js";import"../chunk-BW7YYVZE.js";export{a as WalletFactory};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk5K5HFPJQcjs = require('../chunk-5K5HFPJQ.cjs');require('../chunk-V3CBWWX2.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-XALFCQKD.cjs');exports.Wallet = _chunk5K5HFPJQcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkPSBX4PZWcjs = require('../chunk-PSBX4PZW.cjs');require('../chunk-5HTPBFDH.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-XALFCQKD.cjs');exports.Wallet = _chunkPSBX4PZWcjs.a;
@@ -5,11 +5,11 @@ import { Balances, GetNftsResponse, GetTransactionsResponse, Activity } from '..
5
5
  import { WalletOptions, DelegatedSigner, PendingApproval } from './types.cjs';
6
6
  import { Chain } from '../chains/chains.cjs';
7
7
  import 'ox';
8
- import '@solana/web3.js';
9
- import 'viem';
10
8
  import '@crossmint/client-sdk-window';
11
9
  import '@crossmint/client-signers';
12
10
  import '@crossmint/common-sdk-base';
11
+ import 'viem';
12
+ import '@solana/web3.js';
13
13
 
14
14
  type WalletContructorType<C extends Chain> = {
15
15
  chain: C;
@@ -5,11 +5,11 @@ import { Balances, GetNftsResponse, GetTransactionsResponse, Activity } from '..
5
5
  import { WalletOptions, DelegatedSigner, PendingApproval } from './types.js';
6
6
  import { Chain } from '../chains/chains.js';
7
7
  import 'ox';
8
- import '@solana/web3.js';
9
- import 'viem';
10
8
  import '@crossmint/client-sdk-window';
11
9
  import '@crossmint/client-signers';
12
10
  import '@crossmint/common-sdk-base';
11
+ import 'viem';
12
+ import '@solana/web3.js';
13
13
 
14
14
  type WalletContructorType<C extends Chain> = {
15
15
  chain: C;
@@ -1 +1 @@
1
- import{a}from"../chunk-GCWUK6WO.js";import"../chunk-LQKXECMQ.js";import"../chunk-7ENJXL4H.js";import"../chunk-BW7YYVZE.js";export{a as Wallet};
1
+ import{a}from"../chunk-YHRRQBIE.js";import"../chunk-3D5RTPTJ.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.9.6",
3
+ "version": "0.10.0",
4
4
  "repository": "https://github.com/Crossmint/crossmint-sdk",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Paella Labs Inc",
@@ -24,8 +24,8 @@
24
24
  "ox": "0.6.9",
25
25
  "tweetnacl": "1.0.3",
26
26
  "viem": "2.23.6",
27
- "@crossmint/common-sdk-auth": "1.0.36",
28
- "@crossmint/common-sdk-base": "0.7.2",
27
+ "@crossmint/common-sdk-auth": "1.0.37",
28
+ "@crossmint/common-sdk-base": "0.8.0",
29
29
  "@crossmint/client-sdk-window": "1.0.0",
30
30
  "@crossmint/client-signers": "0.0.16"
31
31
  },
@@ -1 +0,0 @@
1
- import{a as l}from"./chunk-U34BYZY2.js";import{a as d}from"./chunk-BASQXCCA.js";import{a as h}from"./chunk-M4ELAV7U.js";import{f as o}from"./chunk-BW7YYVZE.js";import{VersionedTransaction as m}from"@solana/web3.js";import u from"bs58";import{validateAPIKey as f}from"@crossmint/common-sdk-base";var p=class{constructor(t){this.config=t;this.type="email";this._needsAuth=!0;this._authPromise=null;this.initialize()}locator(){return`solana-keypair:${this.config.signerAddress}`}initialize(){return o(this,null,function*(){if(this.config._handshakeParent==null){let t=f(this.config.crossmint.apiKey);if(!t.isValid)throw new Error("Invalid API key");let n=new l({environment:t.environment});this.config._handshakeParent=yield n.initialize()}})}signMessage(){return o(this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for email signer"))})}signTransaction(t){return o(this,null,function*(){var a,r;yield this.handleAuthRequired();let n=u.decode(t),s=m.deserialize(n).message.serialize(),e=yield(r=this.config._handshakeParent)==null?void 0:r.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:(a=this.config.crossmint.jwt)!=null?a:"",apiKey:this.config.crossmint.apiKey},data:{keyType:"ed25519",bytes:u.encode(s),encoding:"base58"}},options:c});if((e==null?void 0:e.status)==="error")throw new Error(e.error);if((e==null?void 0:e.signature)==null)throw new Error("Failed to sign transaction");return{signature:e.signature.bytes}})}handleAuthRequired(){return o(this,null,function*(){var e,a;if(this.config._handshakeParent==null)throw new Error("Handshake parent not initialized");let t=yield(a=this.config._handshakeParent)==null?void 0:a.sendAction({event:"request:get-status",responseEvent:"response:get-status",data:{authData:{jwt:(e=this.config.crossmint.jwt)!=null?e:"",apiKey:this.config.crossmint.apiKey}},options:c});if((t==null?void 0:t.status)!=="success")throw new Error(t==null?void 0:t.error);if(t.signerStatus==="ready"){this._needsAuth=!1;return}let{promise:n,resolve:i,reject:s}=this.createAuthPromise();if(this._authPromise={promise:n,resolve:i,reject:s},this.config.onAuthRequired)try{yield this.config.onAuthRequired(this._needsAuth,()=>this.sendEmailWithOtp(),r=>this.verifyOtp(r),()=>s(new h))}catch(r){s(r)}try{yield n}catch(r){throw r}})}createAuthPromise(){let t,n;return{promise:new Promise((s,e)=>{t=s,n=e}),resolve:t,reject:n}}sendEmailWithOtp(){return o(this,null,function*(){var s,e;if(this.config._handshakeParent==null)throw new Error("Handshake parent not initialized");let t=this.config._handshakeParent,n=`email:${this.config.email}`,i=yield t.sendAction({event:"request:start-onboarding",responseEvent:"response:start-onboarding",data:{authData:{jwt:(s=this.config.crossmint.jwt)!=null?s:"",apiKey:this.config.crossmint.apiKey},data:{authId:n}},options:c});if((i==null?void 0:i.status)==="success"&&i.signerStatus==="ready"){this._needsAuth=!1;return}(i==null?void 0:i.status)==="error"&&(console.error("[sendEmailWithOtp] Failed to send OTP:",i),(e=this._authPromise)==null||e.reject(new Error(i.error||"Failed to initiate OTP process.")))})}verifyOtp(t){return o(this,null,function*(){var i,s,e,a;if(this.config._handshakeParent==null)throw new Error("Handshake parent not initialized");let n=this.config._handshakeParent;try{let r=yield n.sendAction({event:"request:complete-onboarding",responseEvent:"response:complete-onboarding",data:{authData:{jwt:(i=this.config.crossmint.jwt)!=null?i:"",apiKey:this.config.crossmint.apiKey},data:{onboardingAuthentication:{encryptedOtp:t}}},options:c});if((r==null?void 0:r.status)==="success"){console.log("[verifyOtp] OTP validation successful"),this._needsAuth=!1,(s=this._authPromise)==null||s.resolve();return}console.error("[verifyOtp] Failed to validate OTP:",r),this._needsAuth=!0;let g=(r==null?void 0:r.status)==="error"?r.error:"Failed to validate encrypted OTP";(e=this._authPromise)==null||e.reject(new Error(g))}catch(r){throw console.error("[verifyOtp] Error sending OTP validation request:",r),this._needsAuth=!0,(a=this._authPromise)==null||a.reject(r),r}})}static pregenerateSigner(t,n){return o(this,null,function*(){var i;if(t==null||((i=n.experimental_customAuth)==null?void 0:i.email)==null)throw new Error("Email is required to pregenerate a signer");try{let e=(yield new d(n).pregenerateSigner(t!=null?t:n.experimental_customAuth.email)).publicKey;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));return e.bytes}catch(s){throw console.error("[EmailSigner] Failed to pregenerate signer:",s),s}})}},c={timeoutMs:1e4,intervalMs:5e3};export{p as a};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunk3ZKXOCI7cjs = require('./chunk-3ZKXOCI7.cjs');var _chunkKTTTMBOTcjs = require('./chunk-KTTTMBOT.cjs');var _chunkZSWIQU3Ucjs = require('./chunk-ZSWIQU3U.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _web3js = require('@solana/web3.js');var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);var _commonsdkbase = require('@crossmint/common-sdk-base');var p=class{constructor(t){this.config=t;this.type="email";this._needsAuth=!0;this._authPromise=null;this.initialize()}locator(){return`solana-keypair:${this.config.signerAddress}`}initialize(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(this.config._handshakeParent==null){let t=_commonsdkbase.validateAPIKey.call(void 0, this.config.crossmint.apiKey);if(!t.isValid)throw new Error("Invalid API key");let n=new (0, _chunk3ZKXOCI7cjs.a)({environment:t.environment});this.config._handshakeParent=yield n.initialize()}})}signMessage(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for email signer"))})}signTransaction(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var a,r;yield this.handleAuthRequired();let n=_bs582.default.decode(t),s=_web3js.VersionedTransaction.deserialize(n).message.serialize(),e=yield(r=this.config._handshakeParent)==null?void 0:r.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:(a=this.config.crossmint.jwt)!=null?a:"",apiKey:this.config.crossmint.apiKey},data:{keyType:"ed25519",bytes:_bs582.default.encode(s),encoding:"base58"}},options:c});if((e==null?void 0:e.status)==="error")throw new Error(e.error);if((e==null?void 0:e.signature)==null)throw new Error("Failed to sign transaction");return{signature:e.signature.bytes}})}handleAuthRequired(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var e,a;if(this.config._handshakeParent==null)throw new Error("Handshake parent not initialized");let t=yield(a=this.config._handshakeParent)==null?void 0:a.sendAction({event:"request:get-status",responseEvent:"response:get-status",data:{authData:{jwt:(e=this.config.crossmint.jwt)!=null?e:"",apiKey:this.config.crossmint.apiKey}},options:c});if((t==null?void 0:t.status)!=="success")throw new Error(t==null?void 0:t.error);if(t.signerStatus==="ready"){this._needsAuth=!1;return}let{promise:n,resolve:i,reject:s}=this.createAuthPromise();if(this._authPromise={promise:n,resolve:i,reject:s},this.config.onAuthRequired)try{yield this.config.onAuthRequired(this._needsAuth,()=>this.sendEmailWithOtp(),r=>this.verifyOtp(r),()=>s(new _chunkZSWIQU3Ucjs.a))}catch(r){s(r)}try{yield n}catch(r){throw r}})}createAuthPromise(){let t,n;return{promise:new Promise((s,e)=>{t=s,n=e}),resolve:t,reject:n}}sendEmailWithOtp(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var s,e;if(this.config._handshakeParent==null)throw new Error("Handshake parent not initialized");let t=this.config._handshakeParent,n=`email:${this.config.email}`,i=yield t.sendAction({event:"request:start-onboarding",responseEvent:"response:start-onboarding",data:{authData:{jwt:(s=this.config.crossmint.jwt)!=null?s:"",apiKey:this.config.crossmint.apiKey},data:{authId:n}},options:c});if((i==null?void 0:i.status)==="success"&&i.signerStatus==="ready"){this._needsAuth=!1;return}(i==null?void 0:i.status)==="error"&&(console.error("[sendEmailWithOtp] Failed to send OTP:",i),(e=this._authPromise)==null||e.reject(new Error(i.error||"Failed to initiate OTP process.")))})}verifyOtp(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var i,s,e,a;if(this.config._handshakeParent==null)throw new Error("Handshake parent not initialized");let n=this.config._handshakeParent;try{let r=yield n.sendAction({event:"request:complete-onboarding",responseEvent:"response:complete-onboarding",data:{authData:{jwt:(i=this.config.crossmint.jwt)!=null?i:"",apiKey:this.config.crossmint.apiKey},data:{onboardingAuthentication:{encryptedOtp:t}}},options:c});if((r==null?void 0:r.status)==="success"){console.log("[verifyOtp] OTP validation successful"),this._needsAuth=!1,(s=this._authPromise)==null||s.resolve();return}console.error("[verifyOtp] Failed to validate OTP:",r),this._needsAuth=!0;let g=(r==null?void 0:r.status)==="error"?r.error:"Failed to validate encrypted OTP";(e=this._authPromise)==null||e.reject(new Error(g))}catch(r){throw console.error("[verifyOtp] Error sending OTP validation request:",r),this._needsAuth=!0,(a=this._authPromise)==null||a.reject(r),r}})}static pregenerateSigner(t,n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var i;if(t==null||((i=n.experimental_customAuth)==null?void 0:i.email)==null)throw new Error("Email is required to pregenerate a signer");try{let e=(yield new (0, _chunkKTTTMBOTcjs.a)(n).pregenerateSigner(t!=null?t:n.experimental_customAuth.email)).publicKey;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));return e.bytes}catch(s){throw console.error("[EmailSigner] Failed to pregenerate signer:",s),s}})}},c={timeoutMs:1e4,intervalMs:5e3};exports.a = p;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk3FUD4JAMcjs = require('./chunk-3FUD4JAM.cjs');var _chunkDYRSQN7Xcjs = require('./chunk-DYRSQN7X.cjs');var _chunkNVJN7LPYcjs = require('./chunk-NVJN7LPY.cjs');var _chunkTWQ6DA3Ycjs = require('./chunk-TWQ6DA3Y.cjs');var _chunkYO6BJ2DIcjs = require('./chunk-YO6BJ2DI.cjs');var _chunkYAORQK6Rcjs = require('./chunk-YAORQK6R.cjs');function w(r,e){switch(e.type){case"email":return new (0, _chunk3FUD4JAMcjs.a)(e);case"api-key":return r==="solana"?new (0, _chunkNVJN7LPYcjs.a)(e):new (0, _chunkYO6BJ2DIcjs.a)(e);case"external-wallet":return r==="solana"?new (0, _chunkTWQ6DA3Ycjs.a)(e):new (0, _chunkYAORQK6Rcjs.a)(e);case"passkey":return new (0, _chunkDYRSQN7Xcjs.a)(e)}}exports.a = w;
@@ -1 +0,0 @@
1
- import{w as t}from"./chunk-7ENJXL4H.js";import{f as e}from"./chunk-BW7YYVZE.js";import{PublicKey as m,VersionedTransaction as w}from"@solana/web3.js";import i from"bs58";var o=class{constructor(n){this.type="external-wallet";this.address=n.address,this.onSignTransaction=n.onSignTransaction}locator(){return`solana-keypair:${this.address}`}signMessage(){return e(this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for solana external wallet signer"))})}signTransaction(n){return e(this,null,function*(){if(this.onSignTransaction==null)return yield Promise.reject(new Error("onSignTransaction method is required to sign transactions with a Solana external wallet"));let c=i.decode(n),l=w.deserialize(c),s=yield this.onSignTransaction(l),d=new m(this.address),a=s.message.staticAccountKeys.findIndex(u=>u.equals(d));if(a===-1)throw new t("Wallet public key not found in transaction signers");let r=s.signatures[a];if(r==null)throw new t("No valid signature found in the transaction");let g=new Uint8Array(Object.values(r));return{signature:i.encode(g)}})}};export{o as a};
@@ -1 +0,0 @@
1
- var s="@crossmint/wallets-sdk",t="0.9.6";var c="WALLETS_SDK",r=t,d=s,a=500;export{c as a,r as b,d as c,a as d};
@@ -1 +0,0 @@
1
- import{f as i}from"./chunk-BW7YYVZE.js";var t=class{constructor(e){this.type="external-wallet";this.address=e.address,this.provider=e.provider,this.viemAccount=e.viemAccount}locator(){return`evm-keypair:${this.address}`}signMessage(e){return i(this,null,function*(){var s;if(this.provider!=null){let r=yield this.provider.request({method:"personal_sign",params:[e,this.address]});if(r==null)throw new Error("[EVMExternalWalletSigner] Failed to sign message: EIP1193 provider signMessage returned null");return{signature:r}}if(((s=this.viemAccount)==null?void 0:s.signMessage)!=null){let r=yield this.viemAccount.signMessage({message:{raw:e}});if(r==null)throw new Error("[EVMExternalWalletSigner] Failed to sign message: Viem account signMessage returned null");return{signature:r}}throw new Error("No signer provider or viem account provided")})}signTransaction(e){return i(this,null,function*(){return yield this.signMessage(e)})}};export{t as a};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _web3js = require('@solana/web3.js');var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);var o=class{constructor(n){this.type="external-wallet";this.address=n.address,this.onSignTransaction=n.onSignTransaction}locator(){return`solana-keypair:${this.address}`}signMessage(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for solana external wallet signer"))})}signTransaction(n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(this.onSignTransaction==null)return yield Promise.reject(new Error("onSignTransaction method is required to sign transactions with a Solana external wallet"));let c=_bs582.default.decode(n),l=_web3js.VersionedTransaction.deserialize(c),s=yield this.onSignTransaction(l),d=new (0, _web3js.PublicKey)(this.address),a=s.message.staticAccountKeys.findIndex(u=>u.equals(d));if(a===-1)throw new (0, _chunkCT2UGJELcjs.w)("Wallet public key not found in transaction signers");let r=s.signatures[a];if(r==null)throw new (0, _chunkCT2UGJELcjs.w)("No valid signature found in the transaction");let g=new Uint8Array(Object.values(r));return{signature:_bs582.default.encode(g)}})}};exports.a = o;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var s="@crossmint/wallets-sdk",t="0.9.6";var p="WALLETS_SDK",c= exports.b =t,r= exports.c =s,d= exports.d =500;exports.a = p; exports.b = c; exports.c = r; exports.d = d;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var t=class{constructor(e){this.type="external-wallet";this.address=e.address,this.provider=e.provider,this.viemAccount=e.viemAccount}locator(){return`evm-keypair:${this.address}`}signMessage(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var s;if(this.provider!=null){let r=yield this.provider.request({method:"personal_sign",params:[e,this.address]});if(r==null)throw new Error("[EVMExternalWalletSigner] Failed to sign message: EIP1193 provider signMessage returned null");return{signature:r}}if(((s=this.viemAccount)==null?void 0:s.signMessage)!=null){let r=yield this.viemAccount.signMessage({message:{raw:e}});if(r==null)throw new Error("[EVMExternalWalletSigner] Failed to sign message: Viem account signMessage returned null");return{signature:r}}throw new Error("No signer provider or viem account provided")})}signTransaction(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.signMessage(e)})}};exports.a = t;