@crossmint/wallets-sdk 0.10.16 → 0.11.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 (72) hide show
  1. package/README.md +8 -0
  2. package/dist/api/client.cjs +1 -1
  3. package/dist/api/client.js +1 -1
  4. package/dist/api/index.cjs +1 -1
  5. package/dist/api/index.js +1 -1
  6. package/dist/chains/chains.cjs +1 -1
  7. package/dist/chains/chains.d.cts +4 -4
  8. package/dist/chains/chains.d.ts +4 -4
  9. package/dist/chains/chains.js +1 -1
  10. package/dist/{chunk-5KA7SYRH.cjs → chunk-243LSD4S.cjs} +1 -1
  11. package/dist/{chunk-3HZJR6A3.cjs → chunk-3BCOIESI.cjs} +1 -1
  12. package/dist/chunk-3SWZYW4B.cjs +3 -0
  13. package/dist/chunk-4QU7PZVR.js +1 -0
  14. package/dist/{chunk-4FM7WA5H.js → chunk-4UVL6FIE.js} +1 -1
  15. package/dist/{chunk-X7Y4HEDK.cjs → chunk-4VOZ6LDI.cjs} +1 -1
  16. package/dist/chunk-5UKD6N4G.js +1 -0
  17. package/dist/{chunk-IQB4HWD3.cjs → chunk-CQL2S4AX.cjs} +1 -1
  18. package/dist/{chunk-77UQTNS7.cjs → chunk-EK35EJ7W.cjs} +1 -1
  19. package/dist/{chunk-5777T43M.js → chunk-FLTIUJPZ.js} +1 -1
  20. package/dist/{chunk-5U4PVNPM.js → chunk-JMTREPVI.js} +1 -1
  21. package/dist/chunk-JUSY5XEE.js +1 -0
  22. package/dist/{chunk-7OMPE56G.cjs → chunk-KGL2AM4D.cjs} +1 -1
  23. package/dist/{chunk-U3KINSXQ.js → chunk-KXFOQTZ2.js} +1 -1
  24. package/dist/chunk-LTISHXFE.cjs +1 -0
  25. package/dist/chunk-M4PSXLIC.cjs +1 -0
  26. package/dist/chunk-MQP5VZCA.cjs +1 -0
  27. package/dist/chunk-NP4EN5GQ.js +1 -0
  28. package/dist/chunk-OWDKPU47.cjs +1 -0
  29. package/dist/{chunk-UQPCW4TD.js → chunk-QHQFOPJW.js} +1 -1
  30. package/dist/{chunk-PW4RFMOB.cjs → chunk-QQAM6RK7.cjs} +1 -1
  31. package/dist/{chunk-XXIW4AEP.js → chunk-R4VZXJ5G.js} +1 -1
  32. package/dist/{chunk-XTGLXZAW.cjs → chunk-SEOBA7FS.cjs} +1 -1
  33. package/dist/chunk-V5ID6H27.js +3 -0
  34. package/dist/{chunk-XP4QXJGR.js → chunk-XV2TIRND.js} +1 -1
  35. package/dist/{chunk-VRWKCVVK.js → chunk-ZTYAEP5F.js} +1 -1
  36. package/dist/index.cjs +1 -1
  37. package/dist/index.js +1 -1
  38. package/dist/sdk.cjs +1 -1
  39. package/dist/sdk.js +1 -1
  40. package/dist/signers/index.cjs +1 -1
  41. package/dist/signers/index.js +1 -1
  42. package/dist/signers/non-custodial/index.cjs +1 -1
  43. package/dist/signers/non-custodial/index.js +1 -1
  44. package/dist/signers/non-custodial/ncs-evm-signer.cjs +1 -1
  45. package/dist/signers/non-custodial/ncs-evm-signer.js +1 -1
  46. package/dist/signers/non-custodial/ncs-iframe-manager.cjs +1 -1
  47. package/dist/signers/non-custodial/ncs-iframe-manager.js +1 -1
  48. package/dist/signers/non-custodial/ncs-signer.cjs +1 -1
  49. package/dist/signers/non-custodial/ncs-signer.js +1 -1
  50. package/dist/signers/non-custodial/ncs-solana-signer.cjs +1 -1
  51. package/dist/signers/non-custodial/ncs-solana-signer.js +1 -1
  52. package/dist/utils/constants.cjs +1 -1
  53. package/dist/utils/constants.js +1 -1
  54. package/dist/wallets/evm.cjs +1 -1
  55. package/dist/wallets/evm.js +1 -1
  56. package/dist/wallets/solana.cjs +1 -1
  57. package/dist/wallets/solana.js +1 -1
  58. package/dist/wallets/wallet-factory.cjs +1 -1
  59. package/dist/wallets/wallet-factory.js +1 -1
  60. package/dist/wallets/wallet.cjs +1 -1
  61. package/dist/wallets/wallet.js +1 -1
  62. package/package.json +3 -3
  63. package/dist/chunk-6VJEBYPN.cjs +0 -1
  64. package/dist/chunk-AIH4VH3N.js +0 -1
  65. package/dist/chunk-BJDS5BJG.js +0 -1
  66. package/dist/chunk-M3EZNQE5.cjs +0 -1
  67. package/dist/chunk-MLOSILO2.cjs +0 -1
  68. package/dist/chunk-NAI62DBY.cjs +0 -1
  69. package/dist/chunk-TXMD64BR.js +0 -1
  70. package/dist/chunk-U4S6GWMK.cjs +0 -1
  71. package/dist/chunk-Y5NVCPZ2.js +0 -1
  72. package/dist/chunk-YNIO2LU5.js +0 -1
package/README.md CHANGED
@@ -27,6 +27,14 @@ const wallet = await crossmintWallets.getOrCreateWallet({
27
27
  signer: {
28
28
  type: "email",
29
29
  email: "<your-email>",
30
+ onAuthRequired: async (needsAuth, sendEmailWithOtp, verifyOtp, reject) => {
31
+ if (needsAuth) {
32
+ await sendEmailWithOtp();
33
+ // Prompt the user to check their email for the OTP code.
34
+ // Once the user provides the OTP, pass it to verifyOtp(otp).
35
+ // NOTE: If using our React/React Native SDK, this is handled automatically by the provider.
36
+ }
37
+ },
30
38
  },
31
39
  });
32
40
 
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkPW4RFMOBcjs = require('../chunk-PW4RFMOB.cjs');require('../chunk-M3EZNQE5.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-XALFCQKD.cjs');exports.ApiClient = _chunkPW4RFMOBcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkQQAM6RK7cjs = require('../chunk-QQAM6RK7.cjs');require('../chunk-M4PSXLIC.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-XALFCQKD.cjs');exports.ApiClient = _chunkQQAM6RK7cjs.a;
@@ -1 +1 @@
1
- import{a}from"../chunk-5777T43M.js";import"../chunk-AIH4VH3N.js";import"../chunk-7ENJXL4H.js";import"../chunk-BW7YYVZE.js";export{a as ApiClient};
1
+ import{a}from"../chunk-FLTIUJPZ.js";import"../chunk-5UKD6N4G.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 _chunkPW4RFMOBcjs = require('../chunk-PW4RFMOB.cjs');require('../chunk-M3EZNQE5.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-ECAM5KTH.cjs');require('../chunk-XALFCQKD.cjs');exports.ApiClient = _chunkPW4RFMOBcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-6HXIZLEQ.cjs');var _chunkQQAM6RK7cjs = require('../chunk-QQAM6RK7.cjs');require('../chunk-M4PSXLIC.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-ECAM5KTH.cjs');require('../chunk-XALFCQKD.cjs');exports.ApiClient = _chunkQQAM6RK7cjs.a;
package/dist/api/index.js CHANGED
@@ -1 +1 @@
1
- import"../chunk-5IFDVB4Y.js";import{a}from"../chunk-5777T43M.js";import"../chunk-AIH4VH3N.js";import"../chunk-7ENJXL4H.js";import"../chunk-KBJA7JDT.js";import"../chunk-BW7YYVZE.js";export{a as ApiClient};
1
+ import"../chunk-5IFDVB4Y.js";import{a}from"../chunk-FLTIUJPZ.js";import"../chunk-5UKD6N4G.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 _chunk6VJEBYPNcjs = require('../chunk-6VJEBYPN.cjs');require('../chunk-IR5WN6FQ.cjs');require('../chunk-GEY574TH.cjs');require('../chunk-XALFCQKD.cjs');exports.toViemChain = _chunk6VJEBYPNcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkLTISHXFEcjs = require('../chunk-LTISHXFE.cjs');require('../chunk-IR5WN6FQ.cjs');require('../chunk-GEY574TH.cjs');require('../chunk-XALFCQKD.cjs');exports.toViemChain = _chunkLTISHXFEcjs.a;
@@ -1,9 +1,9 @@
1
1
  import { Chain as Chain$1 } from 'viem';
2
2
 
3
- declare const EVM_SMART_WALLET_TESTNET_CHAINS: readonly ["base-sepolia", "polygon-amoy", "optimism-sepolia", "arbitrum-sepolia", "story-testnet", "mode-sepolia"];
4
- declare const EVM_SMART_WALLET_MAINNET_CHAINS: readonly ["base", "polygon", "optimism", "arbitrum", "story", "mode", "bsc", "shape"];
5
- type EVMSmartWalletTestnet = (typeof EVM_SMART_WALLET_TESTNET_CHAINS)[number];
6
- type EVMSmartWalletMainnet = (typeof EVM_SMART_WALLET_MAINNET_CHAINS)[number];
3
+ declare const TESTNET_AA_CHAINS: readonly ["abstract-testnet", "arbitrum-sepolia", "base-sepolia", "curtis", "ethereum-sepolia", "mantle-sepolia", "mode-sepolia", "optimism-sepolia", "polygon-amoy", "scroll-sepolia", "sei-atlantic-2-testnet", "story-testnet", "world-chain-sepolia", "zora-sepolia"];
4
+ declare const PRODUCTION_AA_CHAINS: readonly ["abstract", "apechain", "arbitrum", "arbitrumnova", "base", "bsc", "mantle", "mode", "optimism", "polygon", "scroll", "sei-pacific-1", "shape", "story", "world-chain", "zora"];
5
+ type EVMSmartWalletTestnet = (typeof TESTNET_AA_CHAINS)[number];
6
+ type EVMSmartWalletMainnet = (typeof PRODUCTION_AA_CHAINS)[number];
7
7
  type EVMSmartWalletChain = EVMSmartWalletTestnet | EVMSmartWalletMainnet;
8
8
  declare function toViemChain(chain: EVMSmartWalletChain): Chain$1;
9
9
  type SolanaChain = "solana";
@@ -1,9 +1,9 @@
1
1
  import { Chain as Chain$1 } from 'viem';
2
2
 
3
- declare const EVM_SMART_WALLET_TESTNET_CHAINS: readonly ["base-sepolia", "polygon-amoy", "optimism-sepolia", "arbitrum-sepolia", "story-testnet", "mode-sepolia"];
4
- declare const EVM_SMART_WALLET_MAINNET_CHAINS: readonly ["base", "polygon", "optimism", "arbitrum", "story", "mode", "bsc", "shape"];
5
- type EVMSmartWalletTestnet = (typeof EVM_SMART_WALLET_TESTNET_CHAINS)[number];
6
- type EVMSmartWalletMainnet = (typeof EVM_SMART_WALLET_MAINNET_CHAINS)[number];
3
+ declare const TESTNET_AA_CHAINS: readonly ["abstract-testnet", "arbitrum-sepolia", "base-sepolia", "curtis", "ethereum-sepolia", "mantle-sepolia", "mode-sepolia", "optimism-sepolia", "polygon-amoy", "scroll-sepolia", "sei-atlantic-2-testnet", "story-testnet", "world-chain-sepolia", "zora-sepolia"];
4
+ declare const PRODUCTION_AA_CHAINS: readonly ["abstract", "apechain", "arbitrum", "arbitrumnova", "base", "bsc", "mantle", "mode", "optimism", "polygon", "scroll", "sei-pacific-1", "shape", "story", "world-chain", "zora"];
5
+ type EVMSmartWalletTestnet = (typeof TESTNET_AA_CHAINS)[number];
6
+ type EVMSmartWalletMainnet = (typeof PRODUCTION_AA_CHAINS)[number];
7
7
  type EVMSmartWalletChain = EVMSmartWalletTestnet | EVMSmartWalletMainnet;
8
8
  declare function toViemChain(chain: EVMSmartWalletChain): Chain$1;
9
9
  type SolanaChain = "solana";
@@ -1 +1 @@
1
- import{a}from"../chunk-BJDS5BJG.js";import"../chunk-KKQBZXFE.js";import"../chunk-S3DYQVRD.js";import"../chunk-BW7YYVZE.js";export{a as toViemChain};
1
+ import{a}from"../chunk-4QU7PZVR.js";import"../chunk-KKQBZXFE.js";import"../chunk-S3DYQVRD.js";import"../chunk-BW7YYVZE.js";export{a as toViemChain};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkMLOSILO2cjs = require('./chunk-MLOSILO2.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _web3js = require('@solana/web3.js');var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);var a=class g extends _chunkMLOSILO2cjs.a{constructor(e){super(e)}locator(){return this.config.locator}signMessage(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for email signer"))})}signTransaction(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var r;yield this.handleAuthRequired();let c=this.getJwtOrThrow(),d=_bs582.default.decode(e),l=_web3js.VersionedTransaction.deserialize(d).message.serialize(),n=yield(r=this.config.clientTEEConnection)==null?void 0:r.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:c,apiKey:this.config.crossmint.apiKey},data:{keyType:"ed25519",bytes:_bs582.default.encode(l),encoding:"base58"}},options:_chunkMLOSILO2cjs.b});if((n==null?void 0:n.status)==="error")throw new Error(n.error);if((n==null?void 0:n.signature)==null)throw new Error("Failed to sign transaction");return g.verifyPublicKeyFormat(n.publicKey),{signature:n.signature.bytes}})}static verifyPublicKeyFormat(e){if(e==null)throw new Error("No public key found");if(e.encoding!=="base58"||e.keyType!=="ed25519"||e.bytes==null)throw new Error("Not supported. Expected public key to be in base58 encoding and ed25519 key type. Got: "+JSON.stringify(e))}};exports.a = a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkOWDKPU47cjs = require('./chunk-OWDKPU47.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _web3js = require('@solana/web3.js');var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);var a=class g extends _chunkOWDKPU47cjs.a{constructor(e){super(e)}locator(){return this.config.locator}signMessage(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for email signer"))})}signTransaction(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var r;yield this.handleAuthRequired();let c=this.getJwtOrThrow(),d=_bs582.default.decode(e),l=_web3js.VersionedTransaction.deserialize(d).message.serialize(),n=yield(r=this.config.clientTEEConnection)==null?void 0:r.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:c,apiKey:this.config.crossmint.apiKey},data:{keyType:"ed25519",bytes:_bs582.default.encode(l),encoding:"base58"}},options:_chunkOWDKPU47cjs.b});if((n==null?void 0:n.status)==="error")throw new Error(n.error);if((n==null?void 0:n.signature)==null)throw new Error("Failed to sign transaction");return g.verifyPublicKeyFormat(n.publicKey),{signature:n.signature.bytes}})}static verifyPublicKeyFormat(e){if(e==null)throw new Error("No public key found");if(e.encoding!=="base58"||e.keyType!=="ed25519"||e.bytes==null)throw new Error("Not supported. Expected public key to be in base58 encoding and ed25519 key type. Got: "+JSON.stringify(e))}};exports.a = a;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkMLOSILO2cjs = require('./chunk-MLOSILO2.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _ox = require('ox');var _viem = require('viem');var g=class c extends _chunkMLOSILO2cjs.a{constructor(n){super(n)}locator(){return this.config.locator}signMessage(n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let r=_viem.isHex.call(void 0, n)?n:_viem.toHex.call(void 0, n),i=_ox.PersonalMessage.getSignPayload(r);return yield this.sign(i)})}signTransaction(n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.sign(n)})}sign(n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var s;yield this.handleAuthRequired();let r=this.getJwtOrThrow(),i=n.replace("0x",""),t=yield(s=this.config.clientTEEConnection)==null?void 0:s.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:r,apiKey:this.config.crossmint.apiKey},data:{keyType:"secp256k1",bytes:i,encoding:"hex"}},options:_chunkMLOSILO2cjs.b});if((t==null?void 0:t.status)==="error")throw new Error(t.error);if((t==null?void 0:t.signature)==null)throw new Error("Failed to sign transaction");return c.verifyPublicKeyFormat(t.publicKey),{signature:t.signature.bytes}})}static verifyPublicKeyFormat(n){if(n==null)throw new Error("No public key found");if(n.encoding!=="hex"||n.keyType!=="secp256k1"||n.bytes==null)throw new Error("Not supported. Expected public key to be in hex encoding and secp256k1 key type. Got: "+JSON.stringify(n))}};exports.a = g;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkOWDKPU47cjs = require('./chunk-OWDKPU47.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _ox = require('ox');var _viem = require('viem');var g=class c extends _chunkOWDKPU47cjs.a{constructor(n){super(n)}locator(){return this.config.locator}signMessage(n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let r=_viem.isHex.call(void 0, n)?n:_viem.toHex.call(void 0, n),i=_ox.PersonalMessage.getSignPayload(r);return yield this.sign(i)})}signTransaction(n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.sign(n)})}sign(n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var s;yield this.handleAuthRequired();let r=this.getJwtOrThrow(),i=n.replace("0x",""),t=yield(s=this.config.clientTEEConnection)==null?void 0:s.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:r,apiKey:this.config.crossmint.apiKey},data:{keyType:"secp256k1",bytes:i,encoding:"hex"}},options:_chunkOWDKPU47cjs.b});if((t==null?void 0:t.status)==="error")throw new Error(t.error);if((t==null?void 0:t.signature)==null)throw new Error("Failed to sign transaction");return c.verifyPublicKeyFormat(t.publicKey),{signature:t.signature.bytes}})}static verifyPublicKeyFormat(n){if(n==null)throw new Error("No public key found");if(n.encoding!=="hex"||n.keyType!=="secp256k1"||n.bytes==null)throw new Error("Not supported. Expected public key to be in hex encoding and secp256k1 key type. Got: "+JSON.stringify(n))}};exports.a = g;
@@ -0,0 +1,3 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkKGL2AM4Dcjs = require('./chunk-KGL2AM4D.cjs');var _chunkCQL2S4AXcjs = require('./chunk-CQL2S4AX.cjs');var _chunkRFK6N7LCcjs = require('./chunk-RFK6N7LC.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _ox = require('ox');var S=class{constructor(e){this.apiClient=e}getOrCreateWallet(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(this.apiClient.isServerSide)throw new (0, _chunkCT2UGJELcjs.f)(`getOrCreateWallet can only be called from client-side code.
2
+ - Make sure you're running this in the browser (or another client environment), not on your server.
3
+ - Use your Crossmint Client API Key (not a server key).`);let i=yield this.apiClient.getWallet(`me:${e.chain==="solana"?"solana":"evm"}:smart`);return i!=null&&!("error"in i)?this.createWalletInstance(i,e):this.createWallet(e)})}getWallet(e,i){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(!this.apiClient.isServerSide)throw new (0, _chunkCT2UGJELcjs.f)("getWallet is not supported on client side, use getOrCreateWallet instead");let n=yield this.apiClient.getWallet(e);if("error"in n)throw new (0, _chunkCT2UGJELcjs.d)(JSON.stringify(n));return this.createWalletInstance(n,i)})}createWallet(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var t,r,o,l;yield(o=(r=(t=e.options)==null?void 0:t.experimental_callbacks)==null?void 0:r.onWalletCreationStart)==null?void 0:o.call(r),this.mutateSignerFromCustomAuth(e,!0);let i=e.signer.type==="passkey"?yield this.createPasskeyAdminSigner(e.signer):e.signer,n=yield this.apiClient.createWallet({type:"smart",chainType:e.chain==="solana"?"solana":"evm",config:{adminSigner:i},owner:(l=e.owner)!=null?l:void 0});if("error"in n)throw new (0, _chunkCT2UGJELcjs.f)(JSON.stringify(n));return this.createWalletInstance(n,e)})}createWalletInstance(e,i){this.validateExistingWalletConfig(e,i);let n=this.toInternalSignerConfig(e,i.signer,i.options);return new (0, _chunkKGL2AM4Dcjs.a)({chain:i.chain,address:e.address,owner:e.owner,signer:_chunkCQL2S4AXcjs.a.call(void 0, i.chain,n),options:i.options},this.apiClient)}toInternalSignerConfig(e,i,n){var t,r,o,l,C,g;if(!(e.chainType==="evm"||e.chainType==="solana"))throw new (0, _chunkCT2UGJELcjs.f)(`Wallet type ${e.chainType} is not supported`);if(i==null&&((t=e.config)==null?void 0:t.adminSigner)==null)throw new (0, _chunkCT2UGJELcjs.f)("Signer is required to create a wallet");switch(i.type){case"api-key":{if(((r=e.config)==null?void 0:r.adminSigner.type)!=="api-key")throw new (0, _chunkCT2UGJELcjs.f)("API key signer does not match the wallet's signer type");return{type:"api-key",address:e.config.adminSigner.address,locator:e.config.adminSigner.locator}}case"external-wallet":if(((o=e.config)==null?void 0:o.adminSigner.type)!=="external-wallet")throw new (0, _chunkCT2UGJELcjs.f)("External wallet signer does not match the wallet's signer type");return _chunkXALFCQKDcjs.a.call(void 0, _chunkXALFCQKDcjs.a.call(void 0, {},e.config.adminSigner),i);case"passkey":if(((l=e.config)==null?void 0:l.adminSigner.type)!=="passkey")throw new (0, _chunkCT2UGJELcjs.f)("Passkey signer does not match the wallet's signer type");return{type:"passkey",id:e.config.adminSigner.id,name:e.config.adminSigner.name,locator:e.config.adminSigner.locator,onCreatePasskey:i.onCreatePasskey,onSignWithPasskey:i.onSignWithPasskey};case"email":{if(((C=e.config)==null?void 0:C.adminSigner.type)!=="email")throw new (0, _chunkCT2UGJELcjs.f)("Email signer does not match the wallet's signer type");let{locator:c,email:h}=e.config.adminSigner;return{type:"email",email:h,locator:c,crossmint:this.apiClient.crossmint,onAuthRequired:i.onAuthRequired,clientTEEConnection:n==null?void 0:n.clientTEEConnection}}case"phone":{if(((g=e.config)==null?void 0:g.adminSigner.type)!=="phone")throw new (0, _chunkCT2UGJELcjs.f)("Phone signer does not match the wallet's signer type");let{locator:c,phone:h}=e.config.adminSigner;return{type:"phone",phone:h,locator:c,crossmint:this.apiClient.crossmint,onAuthRequired:i.onAuthRequired,clientTEEConnection:n==null?void 0:n.clientTEEConnection}}default:throw new Error("Invalid signer type")}}createPasskeyAdminSigner(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var t;if(e.type!=="passkey")throw new Error("Signer is not a passkey");let i=(t=e.name)!=null?t:`Crossmint Wallet ${Date.now()}`,n=e.onCreatePasskey?yield e.onCreatePasskey(i):yield _ox.WebAuthnP256.createCredential({name:i});return{type:"passkey",id:n.id,name:i,publicKey:{x:n.publicKey.x.toString(),y:n.publicKey.y.toString()}}})}mutateSignerFromCustomAuth(e,i=!1){var t,r;let{experimental_customAuth:n}=this.apiClient.crossmint;e.signer.type==="email"&&(n==null?void 0:n.email)!=null&&(e.signer.email=(t=e.signer.email)!=null?t:n.email),e.signer.type==="phone"&&(n==null?void 0:n.phone)!=null&&(e.signer.phone=(r=e.signer.phone)!=null?r:n.phone),e.signer.type==="external-wallet"&&(n==null?void 0:n.externalWalletSigner)!=null&&(e.signer=i?{type:"external-wallet",address:n.externalWalletSigner.address}:n.externalWalletSigner)}validateExistingWalletConfig(e,i){var r;if(this.mutateSignerFromCustomAuth(i),i.owner!=null&&e.owner!=null&&i.owner!==e.owner)throw new (0, _chunkCT2UGJELcjs.f)("Wallet owner does not match existing wallet's linked user");if(i.chain==="solana"&&e.chainType!=="solana"||i.chain!=="solana"&&e.chainType==="solana")throw new (0, _chunkCT2UGJELcjs.f)(`Wallet chain does not match existing wallet's chain. You must use chain: ${e.chainType}.`);if(e.type!=="smart")return;let n=i.signer,t=(r=e==null?void 0:e.config)==null?void 0:r.adminSigner;if(n!=null&&t!=null){if(n.type!==t.type)throw new (0, _chunkCT2UGJELcjs.f)("The wallet signer type provided in the wallet config does not match the existing wallet's adminSigner type");_chunkRFK6N7LCcjs.a.call(void 0, n,t)}}};exports.a = S;
@@ -0,0 +1 @@
1
+ import{a as t}from"./chunk-KKQBZXFE.js";import{a as r}from"./chunk-S3DYQVRD.js";import{BlockchainIncludingTestnet as e}from"@crossmint/common-sdk-base";import{baseSepolia as A,base as S,polygonAmoy as E,polygon as n,optimismSepolia as T,optimism as o,arbitrumSepolia as O,arbitrum as s,arbitrumNova as I,modeTestnet as i,mode as C,bsc as _,shape as c,zora as L,zoraSepolia as R,sepolia as M}from"viem/chains";var h=[e.ABSTRACT_TESTNET,e.ARBITRUM_SEPOLIA,e.BASE_SEPOLIA,e.CURTIS,e.ETHEREUM_SEPOLIA,e.MANTLE_SEPOLIA,e.MODE_SEPOLIA,e.OPTIMISM_SEPOLIA,e.POLYGON_AMOY,e.SCROLL_SEPOLIA,e.SEI_ATLANTIC_2_TESTNET,e.STORY_TESTNET,e.WORLD_CHAIN_SEPOLIA,e.ZORA_SEPOLIA],B=[e.ABSTRACT,e.APECHAIN,e.ARBITRUM,e.ARBITRUMNOVA,e.BASE,e.BSC,e.MANTLE,e.MODE,e.OPTIMISM,e.POLYGON,e.SCROLL,e.SEI_PACIFIC_1,e.SHAPE,e.STORY,e.WORLDCHAIN,e.ZORA];function y(a){switch(a){case e.BASE_SEPOLIA:return A;case e.BASE:return S;case e.POLYGON_AMOY:return E;case e.POLYGON:return n;case e.OPTIMISM_SEPOLIA:return T;case e.OPTIMISM:return o;case e.ARBITRUM_SEPOLIA:return O;case e.ARBITRUM:return s;case e.ARBITRUMNOVA:return I;case e.STORY_TESTNET:return r;case e.STORY:return t;case e.MODE_SEPOLIA:return i;case e.MODE:return C;case e.BSC:return _;case e.SHAPE:return c;case e.ZORA:return L;case e.ZORA_SEPOLIA:return R;case e.ETHEREUM_SEPOLIA:return M;case e.ABSTRACT:case e.ABSTRACT_TESTNET:case e.APECHAIN:case e.MANTLE:case e.MANTLE_SEPOLIA:case e.SCROLL:case e.SCROLL_SEPOLIA:case e.SEI_PACIFIC_1:case e.SEI_ATLANTIC_2_TESTNET:case e.CURTIS:case e.WORLDCHAIN:case e.WORLD_CHAIN_SEPOLIA:throw new Error(`Chain ${a} is not yet supported in toViemChain function. Please add the appropriate viem chain definition.`);default:throw new Error(`Unknown chain: ${a}`)}}export{y as a};
@@ -1 +1 @@
1
- import{a as o,b as a}from"./chunk-YNIO2LU5.js";import{f as e}from"./chunk-BW7YYVZE.js";import{PersonalMessage as p}from"ox";import{isHex as y,toHex as l}from"viem";var g=class c extends o{constructor(n){super(n)}locator(){return this.config.locator}signMessage(n){return e(this,null,function*(){let r=y(n)?n:l(n),i=p.getSignPayload(r);return yield this.sign(i)})}signTransaction(n){return e(this,null,function*(){return yield this.sign(n)})}sign(n){return e(this,null,function*(){var s;yield this.handleAuthRequired();let r=this.getJwtOrThrow(),i=n.replace("0x",""),t=yield(s=this.config.clientTEEConnection)==null?void 0:s.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:r,apiKey:this.config.crossmint.apiKey},data:{keyType:"secp256k1",bytes:i,encoding:"hex"}},options:a});if((t==null?void 0:t.status)==="error")throw new Error(t.error);if((t==null?void 0:t.signature)==null)throw new Error("Failed to sign transaction");return c.verifyPublicKeyFormat(t.publicKey),{signature:t.signature.bytes}})}static verifyPublicKeyFormat(n){if(n==null)throw new Error("No public key found");if(n.encoding!=="hex"||n.keyType!=="secp256k1"||n.bytes==null)throw new Error("Not supported. Expected public key to be in hex encoding and secp256k1 key type. Got: "+JSON.stringify(n))}};export{g as a};
1
+ import{a as o,b as a}from"./chunk-NP4EN5GQ.js";import{f as e}from"./chunk-BW7YYVZE.js";import{PersonalMessage as p}from"ox";import{isHex as y,toHex as l}from"viem";var g=class c extends o{constructor(n){super(n)}locator(){return this.config.locator}signMessage(n){return e(this,null,function*(){let r=y(n)?n:l(n),i=p.getSignPayload(r);return yield this.sign(i)})}signTransaction(n){return e(this,null,function*(){return yield this.sign(n)})}sign(n){return e(this,null,function*(){var s;yield this.handleAuthRequired();let r=this.getJwtOrThrow(),i=n.replace("0x",""),t=yield(s=this.config.clientTEEConnection)==null?void 0:s.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:r,apiKey:this.config.crossmint.apiKey},data:{keyType:"secp256k1",bytes:i,encoding:"hex"}},options:a});if((t==null?void 0:t.status)==="error")throw new Error(t.error);if((t==null?void 0:t.signature)==null)throw new Error("Failed to sign transaction");return c.verifyPublicKeyFormat(t.publicKey),{signature:t.signature.bytes}})}static verifyPublicKeyFormat(n){if(n==null)throw new Error("No public key found");if(n.encoding!=="hex"||n.keyType!=="secp256k1"||n.bytes==null)throw new Error("Not supported. Expected public key to be in hex encoding and secp256k1 key type. Got: "+JSON.stringify(n))}};export{g as a};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunk7OMPE56Gcjs = require('./chunk-7OMPE56G.cjs');var _chunkYTAW674Lcjs = require('./chunk-YTAW674L.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);var _commonsdkbase = require('@crossmint/common-sdk-base');var d=class u extends _chunk7OMPE56Gcjs.a{constructor(n){super({chain:n.chain,address:n.address,owner:n.owner,signer:n.signer,options:_chunk7OMPE56Gcjs.a.getOptions(n)},_chunk7OMPE56Gcjs.a.getApiClient(n))}static from(n){if(!_commonsdkbase.isValidSolanaAddress.call(void 0, n.address))throw new Error("Wallet is not a Solana wallet");return new u(n)}sendTransaction(n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var e,r;let a=yield this.createTransaction(n);if((e=n.options)!=null&&e.experimental_prepareOnly)return{hash:void 0,explorerLink:void 0,transactionId:a.id};let i={additionalSigners:(r=n.additionalSigners)==null?void 0:r.map(o=>new (0, _chunkYTAW674Lcjs.a)({type:"external-wallet",address:o.publicKey.toString(),locator:`external-wallet:${o.publicKey.toString()}`,onSignTransaction:p=>(p.sign([o]),Promise.resolve(p))}))};return yield this.approveAndWait(a.id,i)})}createTransaction(S){return _chunkXALFCQKDcjs.f.call(void 0, this,arguments,function*({transaction:n,options:a}){var r;let i=(r=a==null?void 0:a.experimental_signer)!=null?r:this.signer.locator(),e=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:_bs582.default.encode(n.serialize()),signer:i}});if("error"in e)throw new (0, _chunkCT2UGJELcjs.q)(JSON.stringify(e));return e})}};exports.a = d;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkKGL2AM4Dcjs = require('./chunk-KGL2AM4D.cjs');var _chunkYTAW674Lcjs = require('./chunk-YTAW674L.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);var _commonsdkbase = require('@crossmint/common-sdk-base');var d=class u extends _chunkKGL2AM4Dcjs.a{constructor(n){super({chain:n.chain,address:n.address,owner:n.owner,signer:n.signer,options:_chunkKGL2AM4Dcjs.a.getOptions(n)},_chunkKGL2AM4Dcjs.a.getApiClient(n))}static from(n){if(!_commonsdkbase.isValidSolanaAddress.call(void 0, n.address))throw new Error("Wallet is not a Solana wallet");return new u(n)}sendTransaction(n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var e,r;let a=yield this.createTransaction(n);if((e=n.options)!=null&&e.experimental_prepareOnly)return{hash:void 0,explorerLink:void 0,transactionId:a.id};let i={additionalSigners:(r=n.additionalSigners)==null?void 0:r.map(o=>new (0, _chunkYTAW674Lcjs.a)({type:"external-wallet",address:o.publicKey.toString(),locator:`external-wallet:${o.publicKey.toString()}`,onSignTransaction:p=>(p.sign([o]),Promise.resolve(p))}))};return yield this.approveAndWait(a.id,i)})}createTransaction(S){return _chunkXALFCQKDcjs.f.call(void 0, this,arguments,function*({transaction:n,options:a}){var r;let i=(r=a==null?void 0:a.experimental_signer)!=null?r:this.signer.locator(),e=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:_bs582.default.encode(n.serialize()),signer:i}});if("error"in e)throw new (0, _chunkCT2UGJELcjs.q)(JSON.stringify(e));return e})}};exports.a = d;
@@ -0,0 +1 @@
1
+ var s="@crossmint/wallets-sdk",t="0.11.0";var c="WALLETS_SDK",r=t,d=s,a=500;export{c as a,r as b,d as c,a as d};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk3HZJR6A3cjs = require('./chunk-3HZJR6A3.cjs');var _chunk5KA7SYRHcjs = require('./chunk-5KA7SYRH.cjs');var _chunkYWPTI2QOcjs = require('./chunk-YWPTI2QO.cjs');var _chunk4KXOWU5Ecjs = require('./chunk-4KXOWU5E.cjs');var _chunkYTAW674Lcjs = require('./chunk-YTAW674L.cjs');var _chunkYZ4HRYSLcjs = require('./chunk-YZ4HRYSL.cjs');var _chunkBULGM35Wcjs = require('./chunk-BULGM35W.cjs');function u(r,e){switch(e.type){case"email":case"phone":return r==="solana"?new (0, _chunk5KA7SYRHcjs.a)(e):new (0, _chunk3HZJR6A3cjs.a)(e);case"api-key":return r==="solana"?new (0, _chunk4KXOWU5Ecjs.a)(e):new (0, _chunkYZ4HRYSLcjs.a)(e);case"external-wallet":return r==="solana"?new (0, _chunkYTAW674Lcjs.a)(e):new (0, _chunkBULGM35Wcjs.a)(e);case"passkey":return new (0, _chunkYWPTI2QOcjs.a)(e)}}exports.a = u;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk3BCOIESIcjs = require('./chunk-3BCOIESI.cjs');var _chunk243LSD4Scjs = require('./chunk-243LSD4S.cjs');var _chunkYWPTI2QOcjs = require('./chunk-YWPTI2QO.cjs');var _chunk4KXOWU5Ecjs = require('./chunk-4KXOWU5E.cjs');var _chunkYTAW674Lcjs = require('./chunk-YTAW674L.cjs');var _chunkYZ4HRYSLcjs = require('./chunk-YZ4HRYSL.cjs');var _chunkBULGM35Wcjs = require('./chunk-BULGM35W.cjs');function u(r,e){switch(e.type){case"email":case"phone":return r==="solana"?new (0, _chunk243LSD4Scjs.a)(e):new (0, _chunk3BCOIESIcjs.a)(e);case"api-key":return r==="solana"?new (0, _chunk4KXOWU5Ecjs.a)(e):new (0, _chunkYZ4HRYSLcjs.a)(e);case"external-wallet":return r==="solana"?new (0, _chunkYTAW674Lcjs.a)(e):new (0, _chunkBULGM35Wcjs.a)(e);case"passkey":return new (0, _chunkYWPTI2QOcjs.a)(e)}}exports.a = u;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk7OMPE56Gcjs = require('./chunk-7OMPE56G.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunk6VJEBYPNcjs = require('./chunk-6VJEBYPN.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _viem = require('viem');var _commonsdkbase = require('@crossmint/common-sdk-base');var w=class C extends _chunk7OMPE56Gcjs.a{constructor(t){super({chain:t.chain,address:t.address,owner:t.owner,signer:t.signer,options:_chunk7OMPE56Gcjs.a.getOptions(t)},_chunk7OMPE56Gcjs.a.getApiClient(t))}static from(t){if(!_commonsdkbase.isValidEvmAddress.call(void 0, t.address))throw new Error("Wallet is not an EVM wallet");return new C(t)}sendTransaction(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var e;let n=this.buildTransaction(t),a=yield this.createTransaction(n,t.options);return(e=t.options)!=null&&e.experimental_prepareOnly?{hash:void 0,explorerLink:void 0,transactionId:a.id}:yield this.approveAndWait(a.id)})}signMessage(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var i;let n=yield this.apiClient.createSignature(this.walletLocator,{type:"message",params:{message:t,signer:this.signer.locator(),chain:this.chain}});if("error"in n)throw new (0, _chunkCT2UGJELcjs.o)(JSON.stringify(n));let a=n.id,e=((i=n.approvals)==null?void 0:i.pending)||[];return yield this.approveSignature(e,a),yield this.waitForSignature(a)})}signTypedData(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var T;let{domain:n,message:a,primaryType:e,types:i,chain:r}=t;if(!n||!a||!i||!r)throw new (0, _chunkCT2UGJELcjs.k)("Invalid typed data");let{name:u,version:l,chainId:h,verifyingContract:y,salt:v}=n;if(!u||!l||!h||!y)throw new (0, _chunkCT2UGJELcjs.k)("Invalid typed data domain");let s=yield this.apiClient.createSignature(this.walletLocator,{type:"typed-data",params:{typedData:{domain:{name:u,version:l,chainId:Number(h),verifyingContract:y,salt:v},message:a,primaryType:e,types:i},signer:this.signer.locator(),chain:r,isSmartWalletSignature:!1}});if("error"in s)throw new (0, _chunkCT2UGJELcjs.o)(JSON.stringify(s));let g=s.id,D=((T=s.approvals)==null?void 0:T.pending)||[];return yield this.approveSignature(D,g),yield this.waitForSignature(g)})}getViemClient(t){var n;return _viem.createPublicClient.call(void 0, {transport:(n=t==null?void 0:t.transport)!=null?n:_viem.http.call(void 0, ),chain:_chunk6VJEBYPNcjs.a.call(void 0, this.chain)})}createTransaction(t,n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var i;let a=(i=n==null?void 0:n.experimental_signer)!=null?i:this.signer.locator(),e=yield this.apiClient.createTransaction(this.walletLocator,{params:{signer:a,chain:this.chain,calls:[t]}});if("error"in e)throw new (0, _chunkCT2UGJELcjs.q)(JSON.stringify(e));return e})}buildTransaction(t){var n,a,e,i,r;if("transaction"in t)return{transaction:t.transaction};if(t.abi==null)return{to:t.to,value:(a=(n=t.value)==null?void 0:n.toString())!=null?a:"0",data:(e=t.data)!=null?e:"0x"};if(!t.functionName)throw new Error("Function name is required");return{to:t.to,value:(r=(i=t.value)==null?void 0:i.toString())!=null?r:"0",data:_viem.encodeFunctionData.call(void 0, {abi:t.abi,functionName:t.functionName,args:t.args})}}};exports.a = w;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkKGL2AM4Dcjs = require('./chunk-KGL2AM4D.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunkLTISHXFEcjs = require('./chunk-LTISHXFE.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _viem = require('viem');var _commonsdkbase = require('@crossmint/common-sdk-base');var w=class C extends _chunkKGL2AM4Dcjs.a{constructor(t){super({chain:t.chain,address:t.address,owner:t.owner,signer:t.signer,options:_chunkKGL2AM4Dcjs.a.getOptions(t)},_chunkKGL2AM4Dcjs.a.getApiClient(t))}static from(t){if(!_commonsdkbase.isValidEvmAddress.call(void 0, t.address))throw new Error("Wallet is not an EVM wallet");return new C(t)}sendTransaction(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var e;let n=this.buildTransaction(t),a=yield this.createTransaction(n,t.options);return(e=t.options)!=null&&e.experimental_prepareOnly?{hash:void 0,explorerLink:void 0,transactionId:a.id}:yield this.approveAndWait(a.id)})}signMessage(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var i;let n=yield this.apiClient.createSignature(this.walletLocator,{type:"message",params:{message:t,signer:this.signer.locator(),chain:this.chain}});if("error"in n)throw new (0, _chunkCT2UGJELcjs.o)(JSON.stringify(n));let a=n.id,e=((i=n.approvals)==null?void 0:i.pending)||[];return yield this.approveSignature(e,a),yield this.waitForSignature(a)})}signTypedData(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var T;let{domain:n,message:a,primaryType:e,types:i,chain:r}=t;if(!n||!a||!i||!r)throw new (0, _chunkCT2UGJELcjs.k)("Invalid typed data");let{name:u,version:l,chainId:h,verifyingContract:y,salt:v}=n;if(!u||!l||!h||!y)throw new (0, _chunkCT2UGJELcjs.k)("Invalid typed data domain");let s=yield this.apiClient.createSignature(this.walletLocator,{type:"typed-data",params:{typedData:{domain:{name:u,version:l,chainId:Number(h),verifyingContract:y,salt:v},message:a,primaryType:e,types:i},signer:this.signer.locator(),chain:r,isSmartWalletSignature:!1}});if("error"in s)throw new (0, _chunkCT2UGJELcjs.o)(JSON.stringify(s));let g=s.id,D=((T=s.approvals)==null?void 0:T.pending)||[];return yield this.approveSignature(D,g),yield this.waitForSignature(g)})}getViemClient(t){var n;return _viem.createPublicClient.call(void 0, {transport:(n=t==null?void 0:t.transport)!=null?n:_viem.http.call(void 0, ),chain:_chunkLTISHXFEcjs.a.call(void 0, this.chain)})}createTransaction(t,n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var i;let a=(i=n==null?void 0:n.experimental_signer)!=null?i:this.signer.locator(),e=yield this.apiClient.createTransaction(this.walletLocator,{params:{signer:a,chain:this.chain,calls:[t]}});if("error"in e)throw new (0, _chunkCT2UGJELcjs.q)(JSON.stringify(e));return e})}buildTransaction(t){var n,a,e,i,r;if("transaction"in t)return{transaction:t.transaction};if(t.abi==null)return{to:t.to,value:(a=(n=t.value)==null?void 0:n.toString())!=null?a:"0",data:(e=t.data)!=null?e:"0x"};if(!t.functionName)throw new Error("Function name is required");return{to:t.to,value:(r=(i=t.value)==null?void 0:i.toString())!=null?r:"0",data:_viem.encodeFunctionData.call(void 0, {abi:t.abi,functionName:t.functionName,args:t.args})}}};exports.a = w;
@@ -1 +1 @@
1
- import{b as n,c as i}from"./chunk-AIH4VH3N.js";import{a as o}from"./chunk-7ENJXL4H.js";import{f as r}from"./chunk-BW7YYVZE.js";import{APIKeyUsageOrigin as c,CrossmintApiClient as h}from"@crossmint/common-sdk-base";var p=class extends h{constructor(e){super(e,{internalConfig:{sdkMetadata:{name:i,version:n}}});this.apiPrefix="api/2025-06-09/wallets";this.legacyApiPrefix="api/2022-06-09/wallets"}createWallet(e){return r(this,null,function*(){let s=this.isServerSide?`${this.apiPrefix}`:`${this.apiPrefix}/me`;return(yield this.post(s,{body:JSON.stringify(e),headers:this.headers})).json()})}getWallet(e){return r(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}`,{headers:this.headers})).json()})}createTransaction(e,s){return r(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveTransaction(e,s,t){return r(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions/${s}/approvals`,{body:JSON.stringify(t),headers:this.headers})).json()})}getTransaction(e,s){return r(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions/${s}`,{headers:this.headers})).json()})}createSignature(e,s){return r(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signatures`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveSignature(e,s,t){return r(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signatures/${s}/approvals`,{body:JSON.stringify(t),headers:this.headers})).json()})}getSignature(e,s){return r(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/signatures/${s}`,{headers:this.headers})).json()})}getTransactions(e){return r(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions`,{headers:this.headers})).json()})}experimental_getNfts(e){return r(this,null,function*(){let s=new URLSearchParams;s.append("page",e.page.toString()),s.append("perPage",e.perPage.toString());let t=`${e.chain}:${e.address}`;return(yield this.get(`${this.apiPrefix}/${t}/nfts?${s.toString()}`,{headers:this.headers})).json()})}experimental_activity(e,s){return r(this,null,function*(){let t=e;this.isServerSide||(t=`me:${s.chain==="solana"?"solana-smart-wallet":"evm-smart-wallet"}`);let a=new URLSearchParams;return a.append("chain",s.chain.toString()),(yield this.get(`${this.legacyApiPrefix}/${t}/activity?${a.toString()}`,{headers:this.headers})).json()})}getBalance(e,s){return r(this,null,function*(){let t=new URLSearchParams;return t.append("tokens",s.tokens.join(",")),t.append("chains",s.chains.join(",")),(yield this.get(`${this.apiPrefix}/${e}/balances?${t.toString()}`,{headers:this.headers})).json()})}registerSigner(e,s){return r(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signers`,{body:JSON.stringify(s),headers:this.headers})).json()})}getSigner(e,s){return r(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/signers/${s}`,{headers:this.headers})).json()})}send(e,s,t){return r(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/tokens/${s}/transfers`,{body:JSON.stringify(t),headers:this.headers})).json()})}get isServerSide(){return this.parsedAPIKey.usageOrigin===c.SERVER}get environment(){if(!this.parsedAPIKey.isValid)throw new o("Invalid API key");return this.parsedAPIKey.environment}get headers(){return{"Content-Type":"application/json"}}};export{p as a};
1
+ import{b as n,c as i}from"./chunk-5UKD6N4G.js";import{a as o}from"./chunk-7ENJXL4H.js";import{f as r}from"./chunk-BW7YYVZE.js";import{APIKeyUsageOrigin as c,CrossmintApiClient as h}from"@crossmint/common-sdk-base";var p=class extends h{constructor(e){super(e,{internalConfig:{sdkMetadata:{name:i,version:n}}});this.apiPrefix="api/2025-06-09/wallets";this.legacyApiPrefix="api/2022-06-09/wallets"}createWallet(e){return r(this,null,function*(){let s=this.isServerSide?`${this.apiPrefix}`:`${this.apiPrefix}/me`;return(yield this.post(s,{body:JSON.stringify(e),headers:this.headers})).json()})}getWallet(e){return r(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}`,{headers:this.headers})).json()})}createTransaction(e,s){return r(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveTransaction(e,s,t){return r(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions/${s}/approvals`,{body:JSON.stringify(t),headers:this.headers})).json()})}getTransaction(e,s){return r(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions/${s}`,{headers:this.headers})).json()})}createSignature(e,s){return r(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signatures`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveSignature(e,s,t){return r(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signatures/${s}/approvals`,{body:JSON.stringify(t),headers:this.headers})).json()})}getSignature(e,s){return r(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/signatures/${s}`,{headers:this.headers})).json()})}getTransactions(e){return r(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions`,{headers:this.headers})).json()})}experimental_getNfts(e){return r(this,null,function*(){let s=new URLSearchParams;s.append("page",e.page.toString()),s.append("perPage",e.perPage.toString());let t=`${e.chain}:${e.address}`;return(yield this.get(`${this.apiPrefix}/${t}/nfts?${s.toString()}`,{headers:this.headers})).json()})}experimental_activity(e,s){return r(this,null,function*(){let t=e;this.isServerSide||(t=`me:${s.chain==="solana"?"solana-smart-wallet":"evm-smart-wallet"}`);let a=new URLSearchParams;return a.append("chain",s.chain.toString()),(yield this.get(`${this.legacyApiPrefix}/${t}/activity?${a.toString()}`,{headers:this.headers})).json()})}getBalance(e,s){return r(this,null,function*(){let t=new URLSearchParams;return t.append("tokens",s.tokens.join(",")),t.append("chains",s.chains.join(",")),(yield this.get(`${this.apiPrefix}/${e}/balances?${t.toString()}`,{headers:this.headers})).json()})}registerSigner(e,s){return r(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signers`,{body:JSON.stringify(s),headers:this.headers})).json()})}getSigner(e,s){return r(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/signers/${s}`,{headers:this.headers})).json()})}send(e,s,t){return r(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/tokens/${s}/transfers`,{body:JSON.stringify(t),headers:this.headers})).json()})}get isServerSide(){return this.parsedAPIKey.usageOrigin===c.SERVER}get environment(){if(!this.parsedAPIKey.isValid)throw new o("Invalid API key");return this.parsedAPIKey.environment}get headers(){return{"Content-Type":"application/json"}}};export{p as a};
@@ -1 +1 @@
1
- import{a}from"./chunk-4FM7WA5H.js";import{a as n}from"./chunk-U3KINSXQ.js";import{a as o}from"./chunk-UBOWSXW3.js";import{a as s}from"./chunk-IGBQEAD5.js";import{a as t}from"./chunk-SCS4UDW7.js";import{a as l}from"./chunk-LW6JSI4J.js";import{a as i}from"./chunk-5S6YZJHE.js";function x(r,e){switch(e.type){case"email":case"phone":return r==="solana"?new n(e):new a(e);case"api-key":return r==="solana"?new s(e):new l(e);case"external-wallet":return r==="solana"?new t(e):new i(e);case"passkey":return new o(e)}}export{x as a};
1
+ import{a}from"./chunk-4UVL6FIE.js";import{a as n}from"./chunk-KXFOQTZ2.js";import{a as o}from"./chunk-UBOWSXW3.js";import{a as s}from"./chunk-IGBQEAD5.js";import{a as t}from"./chunk-SCS4UDW7.js";import{a as l}from"./chunk-LW6JSI4J.js";import{a as i}from"./chunk-5S6YZJHE.js";function x(r,e){switch(e.type){case"email":case"phone":return r==="solana"?new n(e):new a(e);case"api-key":return r==="solana"?new s(e):new l(e);case"external-wallet":return r==="solana"?new t(e):new i(e);case"passkey":return new o(e)}}export{x as a};
@@ -0,0 +1 @@
1
+ import{f as t}from"./chunk-BW7YYVZE.js";import{IFrameWindow as a,SignersWindowTransport as s}from"@crossmint/client-sdk-window";import{environmentUrlConfig as m,signerInboundEvents as d,signerOutboundEvents as h}from"@crossmint/client-signers";var i=class{constructor(e){this.config=e;this.handshakeParent=null}initialize(){return t(this,null,function*(){if(this.handshakeParent)return this.handshakeParent;let e=new URL(m[this.config.environment]);e.searchParams.set("targetOrigin",window.location.origin);let n=yield this.createInvisibleIFrame(e.toString());return this.handshakeParent=yield a.init(n,{targetOrigin:e.origin,incomingEvents:h,outgoingEvents:d},s),yield this.handshakeParent.handshakeWithChild(),this.handshakeParent})}createInvisibleIFrame(e){return t(this,null,function*(){let n=document.createElement("iframe");return n.src=e,Object.assign(n.style,{position:"absolute",opacity:"0",pointerEvents:"none",width:"0",height:"0",border:"none",top:"-9999px",left:"-9999px"}),new Promise((r,o)=>{n.onload=()=>r(n),n.onerror=()=>o(new Error("Failed to load iframe content")),document.body.appendChild(n)})})}};export{i as a};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkM3EZNQE5cjs = require('./chunk-M3EZNQE5.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var m,o,R= exports.a =class{constructor(t,r){_chunkXALFCQKDcjs.d.call(void 0, this,m);_chunkXALFCQKDcjs.d.call(void 0, this,o);let{chain:n,address:a,owner:e,signer:g,options:u}=t;_chunkXALFCQKDcjs.e.call(void 0, this,o,r),this.chain=n,this.address=a,this.owner=e,this.signer=g,_chunkXALFCQKDcjs.e.call(void 0, this,m,u)}static getApiClient(t){return t.apiClient}static getOptions(t){return t.options}get apiClient(){return _chunkXALFCQKDcjs.c.call(void 0, this,o)}get options(){return _chunkXALFCQKDcjs.c.call(void 0, this,m)}balances(t,r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let n=this.chain==="solana"?"sol":"eth",a=[n,"usdc",...t!=null?t:[]],e=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getBalance(this.address,{chains:r!=null?r:[this.chain],tokens:a.map(g=>g.toLowerCase())});if("error"in e)throw new Error(`Failed to get balances for wallet: ${JSON.stringify(e.message)}`);return this.transformBalanceResponse(e,n,t)})}transformBalanceResponse(t,r,n){let a=i=>{var f,h,y,T,v;let d=(f=i.chains)==null?void 0:f[this.chain],w="contractAddress"in d?d.contractAddress:void 0;return{symbol:(h=i.symbol)!=null?h:"",name:(y=i.symbol)!=null?y:"",amount:(T=i.amount)!=null?T:"0",contractAddress:w,decimals:i.decimals,rawAmount:(v=i.rawAmount)!=null?v:"0"}},e=t.find(i=>i.symbol===r),g=t.find(i=>i.symbol==="usdc"),u=t.filter(i=>{var d;return i.symbol!==r&&i.symbol!=="usdc"&&(n==null?void 0:n.includes((d=i.symbol)!=null?d:""))}),s=i=>({symbol:i,name:i,amount:"0",contractAddress:void 0,decimals:0,rawAmount:"0"});return{nativeToken:e!=null?a(e):s(r),usdc:g!=null?a(g):s("usdc"),tokens:u.map(a)}}experimental_nfts(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield _chunkXALFCQKDcjs.c.call(void 0, this,o).experimental_getNfts(_chunkXALFCQKDcjs.b.call(void 0, _chunkXALFCQKDcjs.a.call(void 0, {},t),{chain:this.chain,address:this.address}))})}experimental_transactions(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let t=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getTransactions(this.walletLocator);if("error"in t)throw new Error(`Failed to get transactions: ${JSON.stringify(t.message)}`);return t})}experimental_transaction(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let r=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getTransaction(this.walletLocator,t);if("error"in r)throw new Error(`Failed to get transaction: ${JSON.stringify(r.error)}`);return r})}experimental_activity(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let t=yield this.apiClient.experimental_activity(this.walletLocator,{chain:this.chain});if("error"in t)throw new Error(`Failed to get activity: ${JSON.stringify(t.message)}`);return t})}send(t,r,n,a){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let e=k(t),g=H(r,this.chain),u={recipient:e,amount:n},s=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).send(this.walletLocator,g,u);if("message"in s)throw new (0, _chunkCT2UGJELcjs.q)(`Failed to send token: ${JSON.stringify(s.message)}`);return a!=null&&a.experimental_prepareOnly?{hash:void 0,explorerLink:void 0,transactionId:s.id}:yield this.approveAndWait(s.id)})}approveTransaction(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.approveAndWait(t.transactionId,t.options)})}addDelegatedSigner(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var n,a;let r=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).registerSigner(this.walletLocator,{signer:t.signer,chain:this.chain==="solana"?void 0:this.chain});if("error"in r)throw new Error(`Failed to register signer: ${JSON.stringify(r.message)}`);if("transaction"in r){let e=r.transaction.id;yield this.approveAndWait(e)}else{let e=(n=r.chains)==null?void 0:n[this.chain];if((e==null?void 0:e.status)==="awaiting-approval"){let g=((a=e.approvals)==null?void 0:a.pending)||[];yield this.approveSignature(g,e.id),yield this.waitForSignature(e.id);return}if((e==null?void 0:e.status)==="pending"){yield this.waitForSignature(e.id);return}}})}delegatedSigners(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var r,n,a;let t=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getWallet(this.walletLocator);if("error"in t)throw new (0, _chunkCT2UGJELcjs.d)(JSON.stringify(t));if(t.type!=="smart"||t.chainType!=="evm"&&t.chainType!=="solana")throw new (0, _chunkCT2UGJELcjs.c)(`Wallet type ${t.type} not supported`);return(a=(n=(r=t==null?void 0:t.config)==null?void 0:r.delegatedSigners)==null?void 0:n.map(e=>{let g=e.locator.indexOf(":");return{signer:`external-wallet:${g>=0?e.locator.slice(g+1):e.locator}`}}))!=null?a:[]})}get walletLocator(){return _chunkXALFCQKDcjs.c.call(void 0, this,o).isServerSide?this.address:`me:${this.chain==="solana"?"solana":"evm"}:smart`}get isSolanaWallet(){return this.chain==="solana"}approveAndWait(t,r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.approveTransactionInternal(t,r),yield this.sleep(1e3),yield this.waitForTransaction(t)})}approveTransactionInternal(t,r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var s,i,d,w,f;let n=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getTransaction(this.walletLocator,t);if("error"in n)throw new (0, _chunkCT2UGJELcjs.r)(JSON.stringify(n));if(yield(d=(i=(s=_chunkXALFCQKDcjs.c.call(void 0, this,m))==null?void 0:s.experimental_callbacks)==null?void 0:i.onTransactionStart)==null?void 0:d.call(i),this.signer.type==="api-key")return n;if((r==null?void 0:r.experimental_approval)!=null){let h=[r.experimental_approval];return yield this.executeApprovalWithErrorHandling(t,h)}let a=(w=n.approvals)==null?void 0:w.pending;if(a==null)return n;let e=[...(f=r==null?void 0:r.additionalSigners)!=null?f:[],this.signer],u=(yield Promise.all(a.map(h=>{let y=e.find(v=>v.locator()===h.signer.locator);if(y==null)throw new (0, _chunkCT2UGJELcjs.i)(`Signer ${h.signer} not found in pending approvals`);let T=n.chainType==="solana"&&"transaction"in n.onChain?n.onChain.transaction:h.message;return y.signTransaction(T)}))).map(h=>_chunkXALFCQKDcjs.b.call(void 0, _chunkXALFCQKDcjs.a.call(void 0, {},h),{signer:this.signer.locator()}));return yield this.executeApprovalWithErrorHandling(t,u)})}executeApprovalWithErrorHandling(t,r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let n=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).approveTransaction(this.walletLocator,t,{approvals:r});if(n.error)throw new (0, _chunkCT2UGJELcjs.w)(JSON.stringify(n));return n})}approveSignature(t,r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(this.isSolanaWallet)throw new Error("Approving signatures is only supported for EVM smart wallets");let n=t.find(e=>e.signer.locator===this.signer.locator());if(!n)throw new (0, _chunkCT2UGJELcjs.i)(`Signer ${this.signer.locator()} not found in pending approvals`);let a=yield this.signer.signMessage(n.message);return yield _chunkXALFCQKDcjs.c.call(void 0, this,o).approveSignature(this.walletLocator,r,{approvals:[_chunkXALFCQKDcjs.a.call(void 0, {signer:this.signer.locator()},a)]}),a})}waitForSignature(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let r=null;do if(yield new Promise(n=>setTimeout(n,_chunkM3EZNQE5cjs.d)),r=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getSignature(this.walletLocator,t),"error"in r)throw new (0, _chunkCT2UGJELcjs.p)(JSON.stringify(r));while(r===null||r.status==="pending");if(r.status==="failed")throw new (0, _chunkCT2UGJELcjs.m)("Signature signing failed");if(!r.outputSignature)throw new (0, _chunkCT2UGJELcjs.p)("Signature not available");return r.outputSignature})}waitForTransaction(g){return _chunkXALFCQKDcjs.f.call(void 0, this,arguments,function*(t,r=6e4,{backoffMultiplier:n=1.1,maxBackoffMs:a=2e3,initialBackoffMs:e=_chunkM3EZNQE5cjs.d}={}){var d;let u=Date.now(),s;do{if(Date.now()-u>r)throw new (0, _chunkCT2UGJELcjs.s)("Transaction confirmation timeout");if(s=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getTransaction(this.walletLocator,t),s.error)throw new (0, _chunkCT2UGJELcjs.r)(JSON.stringify(s));yield this.sleep(e),e=Math.min(e*n,a)}while(s.status==="pending");if(s.status==="failed")throw new (0, _chunkCT2UGJELcjs.t)(`Transaction sending failed: ${JSON.stringify(s.error)}`);if(s.status==="awaiting-approval")throw new (0, _chunkCT2UGJELcjs.u)("Transaction is awaiting approval. Please submit required approvals before waiting for completion.");let i=s.onChain.txId;if(i==null)throw new (0, _chunkCT2UGJELcjs.v)("Transaction hash not found on transaction response");return{hash:i,explorerLink:(d=s.onChain.explorerLink)!=null?d:"",transactionId:s.id}})}sleep(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return new Promise(r=>setTimeout(r,t))})}};m=new WeakMap,o=new WeakMap;function k(c){if(typeof c=="string")return c;if("email"in c)return`email:${c.email}`;if("x"in c)return`x:${c.x}`;if("twitter"in c)return`twitter:${c.twitter}`;if("phone"in c)return`phoneNumber:${c.phone}`;if("userId"in c)return`userId:${c.userId}`;throw new Error("Invalid recipient locator")}function H(c,t){return _commonsdkbase.isValidAddress.call(void 0, c)?`${t}:${c}`:`${t}:${c.toLowerCase()}`}exports.a = R;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkM4PSXLICcjs = require('./chunk-M4PSXLIC.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var m,o,R= exports.a =class{constructor(t,r){_chunkXALFCQKDcjs.d.call(void 0, this,m);_chunkXALFCQKDcjs.d.call(void 0, this,o);let{chain:n,address:a,owner:e,signer:g,options:u}=t;_chunkXALFCQKDcjs.e.call(void 0, this,o,r),this.chain=n,this.address=a,this.owner=e,this.signer=g,_chunkXALFCQKDcjs.e.call(void 0, this,m,u)}static getApiClient(t){return t.apiClient}static getOptions(t){return t.options}get apiClient(){return _chunkXALFCQKDcjs.c.call(void 0, this,o)}get options(){return _chunkXALFCQKDcjs.c.call(void 0, this,m)}balances(t,r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let n=this.chain==="solana"?"sol":"eth",a=[n,"usdc",...t!=null?t:[]],e=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getBalance(this.address,{chains:r!=null?r:[this.chain],tokens:a.map(g=>g.toLowerCase())});if("error"in e)throw new Error(`Failed to get balances for wallet: ${JSON.stringify(e.message)}`);return this.transformBalanceResponse(e,n,t)})}transformBalanceResponse(t,r,n){let a=i=>{var f,h,y,T,v;let d=(f=i.chains)==null?void 0:f[this.chain],w="contractAddress"in d?d.contractAddress:void 0;return{symbol:(h=i.symbol)!=null?h:"",name:(y=i.symbol)!=null?y:"",amount:(T=i.amount)!=null?T:"0",contractAddress:w,decimals:i.decimals,rawAmount:(v=i.rawAmount)!=null?v:"0"}},e=t.find(i=>i.symbol===r),g=t.find(i=>i.symbol==="usdc"),u=t.filter(i=>{var d;return i.symbol!==r&&i.symbol!=="usdc"&&(n==null?void 0:n.includes((d=i.symbol)!=null?d:""))}),s=i=>({symbol:i,name:i,amount:"0",contractAddress:void 0,decimals:0,rawAmount:"0"});return{nativeToken:e!=null?a(e):s(r),usdc:g!=null?a(g):s("usdc"),tokens:u.map(a)}}experimental_nfts(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield _chunkXALFCQKDcjs.c.call(void 0, this,o).experimental_getNfts(_chunkXALFCQKDcjs.b.call(void 0, _chunkXALFCQKDcjs.a.call(void 0, {},t),{chain:this.chain,address:this.address}))})}experimental_transactions(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let t=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getTransactions(this.walletLocator);if("error"in t)throw new Error(`Failed to get transactions: ${JSON.stringify(t.message)}`);return t})}experimental_transaction(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let r=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getTransaction(this.walletLocator,t);if("error"in r)throw new Error(`Failed to get transaction: ${JSON.stringify(r.error)}`);return r})}experimental_activity(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let t=yield this.apiClient.experimental_activity(this.walletLocator,{chain:this.chain});if("error"in t)throw new Error(`Failed to get activity: ${JSON.stringify(t.message)}`);return t})}send(t,r,n,a){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let e=k(t),g=H(r,this.chain),u={recipient:e,amount:n},s=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).send(this.walletLocator,g,u);if("message"in s)throw new (0, _chunkCT2UGJELcjs.q)(`Failed to send token: ${JSON.stringify(s.message)}`);return a!=null&&a.experimental_prepareOnly?{hash:void 0,explorerLink:void 0,transactionId:s.id}:yield this.approveAndWait(s.id)})}approveTransaction(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.approveAndWait(t.transactionId,t.options)})}addDelegatedSigner(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var n,a;let r=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).registerSigner(this.walletLocator,{signer:t.signer,chain:this.chain==="solana"?void 0:this.chain});if("error"in r)throw new Error(`Failed to register signer: ${JSON.stringify(r.message)}`);if("transaction"in r){let e=r.transaction.id;yield this.approveAndWait(e)}else{let e=(n=r.chains)==null?void 0:n[this.chain];if((e==null?void 0:e.status)==="awaiting-approval"){let g=((a=e.approvals)==null?void 0:a.pending)||[];yield this.approveSignature(g,e.id),yield this.waitForSignature(e.id);return}if((e==null?void 0:e.status)==="pending"){yield this.waitForSignature(e.id);return}}})}delegatedSigners(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var r,n,a;let t=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getWallet(this.walletLocator);if("error"in t)throw new (0, _chunkCT2UGJELcjs.d)(JSON.stringify(t));if(t.type!=="smart"||t.chainType!=="evm"&&t.chainType!=="solana")throw new (0, _chunkCT2UGJELcjs.c)(`Wallet type ${t.type} not supported`);return(a=(n=(r=t==null?void 0:t.config)==null?void 0:r.delegatedSigners)==null?void 0:n.map(e=>{let g=e.locator.indexOf(":");return{signer:`external-wallet:${g>=0?e.locator.slice(g+1):e.locator}`}}))!=null?a:[]})}get walletLocator(){return _chunkXALFCQKDcjs.c.call(void 0, this,o).isServerSide?this.address:`me:${this.chain==="solana"?"solana":"evm"}:smart`}get isSolanaWallet(){return this.chain==="solana"}approveAndWait(t,r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.approveTransactionInternal(t,r),yield this.sleep(1e3),yield this.waitForTransaction(t)})}approveTransactionInternal(t,r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var s,i,d,w,f;let n=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getTransaction(this.walletLocator,t);if("error"in n)throw new (0, _chunkCT2UGJELcjs.r)(JSON.stringify(n));if(yield(d=(i=(s=_chunkXALFCQKDcjs.c.call(void 0, this,m))==null?void 0:s.experimental_callbacks)==null?void 0:i.onTransactionStart)==null?void 0:d.call(i),this.signer.type==="api-key")return n;if((r==null?void 0:r.experimental_approval)!=null){let h=[r.experimental_approval];return yield this.executeApprovalWithErrorHandling(t,h)}let a=(w=n.approvals)==null?void 0:w.pending;if(a==null)return n;let e=[...(f=r==null?void 0:r.additionalSigners)!=null?f:[],this.signer],u=(yield Promise.all(a.map(h=>{let y=e.find(v=>v.locator()===h.signer.locator);if(y==null)throw new (0, _chunkCT2UGJELcjs.i)(`Signer ${h.signer} not found in pending approvals`);let T=n.chainType==="solana"&&"transaction"in n.onChain?n.onChain.transaction:h.message;return y.signTransaction(T)}))).map(h=>_chunkXALFCQKDcjs.b.call(void 0, _chunkXALFCQKDcjs.a.call(void 0, {},h),{signer:this.signer.locator()}));return yield this.executeApprovalWithErrorHandling(t,u)})}executeApprovalWithErrorHandling(t,r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let n=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).approveTransaction(this.walletLocator,t,{approvals:r});if(n.error)throw new (0, _chunkCT2UGJELcjs.w)(JSON.stringify(n));return n})}approveSignature(t,r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(this.isSolanaWallet)throw new Error("Approving signatures is only supported for EVM smart wallets");let n=t.find(e=>e.signer.locator===this.signer.locator());if(!n)throw new (0, _chunkCT2UGJELcjs.i)(`Signer ${this.signer.locator()} not found in pending approvals`);let a=yield this.signer.signMessage(n.message);return yield _chunkXALFCQKDcjs.c.call(void 0, this,o).approveSignature(this.walletLocator,r,{approvals:[_chunkXALFCQKDcjs.a.call(void 0, {signer:this.signer.locator()},a)]}),a})}waitForSignature(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let r=null;do if(yield new Promise(n=>setTimeout(n,_chunkM4PSXLICcjs.d)),r=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getSignature(this.walletLocator,t),"error"in r)throw new (0, _chunkCT2UGJELcjs.p)(JSON.stringify(r));while(r===null||r.status==="pending");if(r.status==="failed")throw new (0, _chunkCT2UGJELcjs.m)("Signature signing failed");if(!r.outputSignature)throw new (0, _chunkCT2UGJELcjs.p)("Signature not available");return r.outputSignature})}waitForTransaction(g){return _chunkXALFCQKDcjs.f.call(void 0, this,arguments,function*(t,r=6e4,{backoffMultiplier:n=1.1,maxBackoffMs:a=2e3,initialBackoffMs:e=_chunkM4PSXLICcjs.d}={}){var d;let u=Date.now(),s;do{if(Date.now()-u>r)throw new (0, _chunkCT2UGJELcjs.s)("Transaction confirmation timeout");if(s=yield _chunkXALFCQKDcjs.c.call(void 0, this,o).getTransaction(this.walletLocator,t),s.error)throw new (0, _chunkCT2UGJELcjs.r)(JSON.stringify(s));yield this.sleep(e),e=Math.min(e*n,a)}while(s.status==="pending");if(s.status==="failed")throw new (0, _chunkCT2UGJELcjs.t)(`Transaction sending failed: ${JSON.stringify(s.error)}`);if(s.status==="awaiting-approval")throw new (0, _chunkCT2UGJELcjs.u)("Transaction is awaiting approval. Please submit required approvals before waiting for completion.");let i=s.onChain.txId;if(i==null)throw new (0, _chunkCT2UGJELcjs.v)("Transaction hash not found on transaction response");return{hash:i,explorerLink:(d=s.onChain.explorerLink)!=null?d:"",transactionId:s.id}})}sleep(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return new Promise(r=>setTimeout(r,t))})}};m=new WeakMap,o=new WeakMap;function k(c){if(typeof c=="string")return c;if("email"in c)return`email:${c.email}`;if("x"in c)return`x:${c.x}`;if("twitter"in c)return`twitter:${c.twitter}`;if("phone"in c)return`phoneNumber:${c.phone}`;if("userId"in c)return`userId:${c.userId}`;throw new Error("Invalid recipient locator")}function H(c,t){return _commonsdkbase.isValidAddress.call(void 0, c)?`${t}:${c}`:`${t}:${c.toLowerCase()}`}exports.a = R;
@@ -1 +1 @@
1
- import{a as i,b as o}from"./chunk-YNIO2LU5.js";import{f as t}from"./chunk-BW7YYVZE.js";import{VersionedTransaction as y}from"@solana/web3.js";import s from"bs58";var a=class g extends i{constructor(e){super(e)}locator(){return this.config.locator}signMessage(){return t(this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for email signer"))})}signTransaction(e){return t(this,null,function*(){var r;yield this.handleAuthRequired();let c=this.getJwtOrThrow(),d=s.decode(e),l=y.deserialize(d).message.serialize(),n=yield(r=this.config.clientTEEConnection)==null?void 0:r.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:c,apiKey:this.config.crossmint.apiKey},data:{keyType:"ed25519",bytes:s.encode(l),encoding:"base58"}},options:o});if((n==null?void 0:n.status)==="error")throw new Error(n.error);if((n==null?void 0:n.signature)==null)throw new Error("Failed to sign transaction");return g.verifyPublicKeyFormat(n.publicKey),{signature:n.signature.bytes}})}static verifyPublicKeyFormat(e){if(e==null)throw new Error("No public key found");if(e.encoding!=="base58"||e.keyType!=="ed25519"||e.bytes==null)throw new Error("Not supported. Expected public key to be in base58 encoding and ed25519 key type. Got: "+JSON.stringify(e))}};export{a};
1
+ import{a as i,b as o}from"./chunk-NP4EN5GQ.js";import{f as t}from"./chunk-BW7YYVZE.js";import{VersionedTransaction as y}from"@solana/web3.js";import s from"bs58";var a=class g extends i{constructor(e){super(e)}locator(){return this.config.locator}signMessage(){return t(this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for email signer"))})}signTransaction(e){return t(this,null,function*(){var r;yield this.handleAuthRequired();let c=this.getJwtOrThrow(),d=s.decode(e),l=y.deserialize(d).message.serialize(),n=yield(r=this.config.clientTEEConnection)==null?void 0:r.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:c,apiKey:this.config.crossmint.apiKey},data:{keyType:"ed25519",bytes:s.encode(l),encoding:"base58"}},options:o});if((n==null?void 0:n.status)==="error")throw new Error(n.error);if((n==null?void 0:n.signature)==null)throw new Error("Failed to sign transaction");return g.verifyPublicKeyFormat(n.publicKey),{signature:n.signature.bytes}})}static verifyPublicKeyFormat(e){if(e==null)throw new Error("No public key found");if(e.encoding!=="base58"||e.keyType!=="ed25519"||e.bytes==null)throw new Error("Not supported. Expected public key to be in base58 encoding and ed25519 key type. Got: "+JSON.stringify(e))}};export{a};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkIR5WN6FQcjs = require('./chunk-IR5WN6FQ.cjs');var _chunkGEY574THcjs = require('./chunk-GEY574TH.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var _chains = require('viem/chains');var u=[_commonsdkbase.BlockchainIncludingTestnet.ABSTRACT_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.ARBITRUM_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.BASE_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.CURTIS,_commonsdkbase.BlockchainIncludingTestnet.ETHEREUM_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.MANTLE_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.MODE_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.OPTIMISM_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.POLYGON_AMOY,_commonsdkbase.BlockchainIncludingTestnet.SCROLL_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.SEI_ATLANTIC_2_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.STORY_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.WORLD_CHAIN_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.ZORA_SEPOLIA],h=[_commonsdkbase.BlockchainIncludingTestnet.ABSTRACT,_commonsdkbase.BlockchainIncludingTestnet.APECHAIN,_commonsdkbase.BlockchainIncludingTestnet.ARBITRUM,_commonsdkbase.BlockchainIncludingTestnet.ARBITRUMNOVA,_commonsdkbase.BlockchainIncludingTestnet.BASE,_commonsdkbase.BlockchainIncludingTestnet.BSC,_commonsdkbase.BlockchainIncludingTestnet.MANTLE,_commonsdkbase.BlockchainIncludingTestnet.MODE,_commonsdkbase.BlockchainIncludingTestnet.OPTIMISM,_commonsdkbase.BlockchainIncludingTestnet.POLYGON,_commonsdkbase.BlockchainIncludingTestnet.SCROLL,_commonsdkbase.BlockchainIncludingTestnet.SEI_PACIFIC_1,_commonsdkbase.BlockchainIncludingTestnet.SHAPE,_commonsdkbase.BlockchainIncludingTestnet.STORY,_commonsdkbase.BlockchainIncludingTestnet.WORLDCHAIN,_commonsdkbase.BlockchainIncludingTestnet.ZORA];function B(a){switch(a){case _commonsdkbase.BlockchainIncludingTestnet.BASE_SEPOLIA:return _chains.baseSepolia;case _commonsdkbase.BlockchainIncludingTestnet.BASE:return _chains.base;case _commonsdkbase.BlockchainIncludingTestnet.POLYGON_AMOY:return _chains.polygonAmoy;case _commonsdkbase.BlockchainIncludingTestnet.POLYGON:return _chains.polygon;case _commonsdkbase.BlockchainIncludingTestnet.OPTIMISM_SEPOLIA:return _chains.optimismSepolia;case _commonsdkbase.BlockchainIncludingTestnet.OPTIMISM:return _chains.optimism;case _commonsdkbase.BlockchainIncludingTestnet.ARBITRUM_SEPOLIA:return _chains.arbitrumSepolia;case _commonsdkbase.BlockchainIncludingTestnet.ARBITRUM:return _chains.arbitrum;case _commonsdkbase.BlockchainIncludingTestnet.ARBITRUMNOVA:return _chains.arbitrumNova;case _commonsdkbase.BlockchainIncludingTestnet.STORY_TESTNET:return _chunkGEY574THcjs.a;case _commonsdkbase.BlockchainIncludingTestnet.STORY:return _chunkIR5WN6FQcjs.a;case _commonsdkbase.BlockchainIncludingTestnet.MODE_SEPOLIA:return _chains.modeTestnet;case _commonsdkbase.BlockchainIncludingTestnet.MODE:return _chains.mode;case _commonsdkbase.BlockchainIncludingTestnet.BSC:return _chains.bsc;case _commonsdkbase.BlockchainIncludingTestnet.SHAPE:return _chains.shape;case _commonsdkbase.BlockchainIncludingTestnet.ZORA:return _chains.zora;case _commonsdkbase.BlockchainIncludingTestnet.ZORA_SEPOLIA:return _chains.zoraSepolia;case _commonsdkbase.BlockchainIncludingTestnet.ETHEREUM_SEPOLIA:return _chains.sepolia;case _commonsdkbase.BlockchainIncludingTestnet.ABSTRACT:case _commonsdkbase.BlockchainIncludingTestnet.ABSTRACT_TESTNET:case _commonsdkbase.BlockchainIncludingTestnet.APECHAIN:case _commonsdkbase.BlockchainIncludingTestnet.MANTLE:case _commonsdkbase.BlockchainIncludingTestnet.MANTLE_SEPOLIA:case _commonsdkbase.BlockchainIncludingTestnet.SCROLL:case _commonsdkbase.BlockchainIncludingTestnet.SCROLL_SEPOLIA:case _commonsdkbase.BlockchainIncludingTestnet.SEI_PACIFIC_1:case _commonsdkbase.BlockchainIncludingTestnet.SEI_ATLANTIC_2_TESTNET:case _commonsdkbase.BlockchainIncludingTestnet.CURTIS:case _commonsdkbase.BlockchainIncludingTestnet.WORLDCHAIN:case _commonsdkbase.BlockchainIncludingTestnet.WORLD_CHAIN_SEPOLIA:throw new Error(`Chain ${a} is not yet supported in toViemChain function. Please add the appropriate viem chain definition.`);default:throw new Error(`Unknown chain: ${a}`)}}exports.a = B;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var s="@crossmint/wallets-sdk",t="0.11.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});var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _clientsdkwindow = require('@crossmint/client-sdk-window');var _clientsigners = require('@crossmint/client-signers');var i=class{constructor(e){this.config=e;this.handshakeParent=null}initialize(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(this.handshakeParent)return this.handshakeParent;let e=new URL(_clientsigners.environmentUrlConfig[this.config.environment]);e.searchParams.set("targetOrigin",window.location.origin);let n=yield this.createInvisibleIFrame(e.toString());return this.handshakeParent=yield _clientsdkwindow.IFrameWindow.init(n,{targetOrigin:e.origin,incomingEvents:_clientsigners.signerOutboundEvents,outgoingEvents:_clientsigners.signerInboundEvents},_clientsdkwindow.SignersWindowTransport),yield this.handshakeParent.handshakeWithChild(),this.handshakeParent})}createInvisibleIFrame(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let n=document.createElement("iframe");return n.src=e,Object.assign(n.style,{position:"absolute",opacity:"0",pointerEvents:"none",width:"0",height:"0",border:"none",top:"-9999px",left:"-9999px"}),new Promise((r,o)=>{n.onload=()=>r(n),n.onerror=()=>o(new Error("Failed to load iframe content")),document.body.appendChild(n)})})}};exports.a = i;
@@ -0,0 +1 @@
1
+ import{a as l}from"./chunk-JUSY5XEE.js";import{a as u}from"./chunk-M4ELAV7U.js";import{f as c}from"./chunk-BW7YYVZE.js";import{validateAPIKey as m}from"@crossmint/common-sdk-base";var d=class{constructor(t){this.config=t;this._needsAuth=!0;this._authPromise=null;this.initialize(),this.type=this.config.type}initialize(){return c(this,null,function*(){if(this.config.clientTEEConnection==null){let t=m(this.config.crossmint.apiKey);if(!t.isValid)throw new Error("Invalid API key");let r=new l({environment:t.environment});this.config.clientTEEConnection=yield r.initialize()}})}handleAuthRequired(){return c(this,null,function*(){var o,s,a;if(this.config.clientTEEConnection==null)throw this.config.onAuthRequired==null?new Error(`${this.type} signer requires the onAuthRequired callback to handle OTP verification. This callback manages the authentication flow (sending OTP and verifying user input). If using our React/React Native SDK, this is handled automatically by the provider. For other environments, implement: onAuthRequired: (needsAuth, sendOtp, verifyOtp, reject) => { /* your UI logic */ }`):new Error("Handshake parent not initialized");let t=yield(a=this.config.clientTEEConnection)==null?void 0:a.sendAction({event:"request:get-status",responseEvent:"response:get-status",data:{authData:{jwt:(s=(o=this.config.crossmint.experimental_customAuth)==null?void 0:o.jwt)!=null?s:"",apiKey:this.config.crossmint.apiKey}},options:h});if((t==null?void 0:t.status)!=="success")throw new Error(t==null?void 0:t.error);if(t.signerStatus==="ready"){this._needsAuth=!1;return}let{promise:r,resolve:i,reject:n}=this.createAuthPromise();if(this._authPromise={promise:r,resolve:i,reject:n},this.config.onAuthRequired)try{yield this.config.onAuthRequired(this._needsAuth,()=>this.sendMessageWithOtp(),e=>this.verifyOtp(e),()=>n(new u))}catch(e){n(e)}try{yield r}catch(e){throw e}})}getJwtOrThrow(){var r;let t=(r=this.config.crossmint.experimental_customAuth)==null?void 0:r.jwt;if(t==null)throw new Error("JWT is required");return t}createAuthPromise(){let t,r;return{promise:new Promise((n,o)=>{t=n,r=o}),resolve:t,reject:r}}sendMessageWithOtp(){return c(this,null,function*(){var n,o,s;if(this.config.clientTEEConnection==null)throw new Error("Handshake parent not initialized");let t=this.config.clientTEEConnection,r=this.getAuthId(),i=yield t.sendAction({event:"request:start-onboarding",responseEvent:"response:start-onboarding",data:{authData:{jwt:(o=(n=this.config.crossmint.experimental_customAuth)==null?void 0:n.jwt)!=null?o:"",apiKey:this.config.crossmint.apiKey},data:{authId:r}},options:h});if((i==null?void 0:i.status)==="success"&&i.signerStatus==="ready"){this._needsAuth=!1;return}(i==null?void 0:i.status)==="error"&&(console.error("[sendMessageWithOtp] Failed to send OTP:",i),(s=this._authPromise)==null||s.reject(new Error(i.error||"Failed to initiate OTP process.")))})}getAuthId(){return this.config.type==="email"?`email:${this.config.email}`:`phone:${this.config.phone}`}verifyOtp(t){return c(this,null,function*(){var i,n,o,s,a;if(this.config.clientTEEConnection==null)throw new Error("Handshake parent not initialized");let r=this.config.clientTEEConnection;try{let e=yield r.sendAction({event:"request:complete-onboarding",responseEvent:"response:complete-onboarding",data:{authData:{jwt:(n=(i=this.config.crossmint.experimental_customAuth)==null?void 0:i.jwt)!=null?n:"",apiKey:this.config.crossmint.apiKey},data:{onboardingAuthentication:{encryptedOtp:t}}},options:h});if((e==null?void 0:e.status)==="success"){this._needsAuth=!1,(o=this._authPromise)==null||o.resolve();return}console.error("[verifyOtp] Failed to validate OTP:",e),this._needsAuth=!0;let g=(e==null?void 0:e.status)==="error"?e.error:"Failed to validate encrypted OTP";(s=this._authPromise)==null||s.reject(new Error(g))}catch(e){throw console.error("[verifyOtp] Error sending OTP validation request:",e),this._needsAuth=!0,(a=this._authPromise)==null||a.reject(e),e}})}},h={timeoutMs:1e4,intervalMs:5e3};export{d as a,h as b};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkMQP5VZCAcjs = require('./chunk-MQP5VZCA.cjs');var _chunkZSWIQU3Ucjs = require('./chunk-ZSWIQU3U.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var d=class{constructor(t){this.config=t;this._needsAuth=!0;this._authPromise=null;this.initialize(),this.type=this.config.type}initialize(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(this.config.clientTEEConnection==null){let t=_commonsdkbase.validateAPIKey.call(void 0, this.config.crossmint.apiKey);if(!t.isValid)throw new Error("Invalid API key");let r=new (0, _chunkMQP5VZCAcjs.a)({environment:t.environment});this.config.clientTEEConnection=yield r.initialize()}})}handleAuthRequired(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var o,s,a;if(this.config.clientTEEConnection==null)throw this.config.onAuthRequired==null?new Error(`${this.type} signer requires the onAuthRequired callback to handle OTP verification. This callback manages the authentication flow (sending OTP and verifying user input). If using our React/React Native SDK, this is handled automatically by the provider. For other environments, implement: onAuthRequired: (needsAuth, sendOtp, verifyOtp, reject) => { /* your UI logic */ }`):new Error("Handshake parent not initialized");let t=yield(a=this.config.clientTEEConnection)==null?void 0:a.sendAction({event:"request:get-status",responseEvent:"response:get-status",data:{authData:{jwt:(s=(o=this.config.crossmint.experimental_customAuth)==null?void 0:o.jwt)!=null?s:"",apiKey:this.config.crossmint.apiKey}},options:h});if((t==null?void 0:t.status)!=="success")throw new Error(t==null?void 0:t.error);if(t.signerStatus==="ready"){this._needsAuth=!1;return}let{promise:r,resolve:i,reject:n}=this.createAuthPromise();if(this._authPromise={promise:r,resolve:i,reject:n},this.config.onAuthRequired)try{yield this.config.onAuthRequired(this._needsAuth,()=>this.sendMessageWithOtp(),e=>this.verifyOtp(e),()=>n(new _chunkZSWIQU3Ucjs.a))}catch(e){n(e)}try{yield r}catch(e){throw e}})}getJwtOrThrow(){var r;let t=(r=this.config.crossmint.experimental_customAuth)==null?void 0:r.jwt;if(t==null)throw new Error("JWT is required");return t}createAuthPromise(){let t,r;return{promise:new Promise((n,o)=>{t=n,r=o}),resolve:t,reject:r}}sendMessageWithOtp(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var n,o,s;if(this.config.clientTEEConnection==null)throw new Error("Handshake parent not initialized");let t=this.config.clientTEEConnection,r=this.getAuthId(),i=yield t.sendAction({event:"request:start-onboarding",responseEvent:"response:start-onboarding",data:{authData:{jwt:(o=(n=this.config.crossmint.experimental_customAuth)==null?void 0:n.jwt)!=null?o:"",apiKey:this.config.crossmint.apiKey},data:{authId:r}},options:h});if((i==null?void 0:i.status)==="success"&&i.signerStatus==="ready"){this._needsAuth=!1;return}(i==null?void 0:i.status)==="error"&&(console.error("[sendMessageWithOtp] Failed to send OTP:",i),(s=this._authPromise)==null||s.reject(new Error(i.error||"Failed to initiate OTP process.")))})}getAuthId(){return this.config.type==="email"?`email:${this.config.email}`:`phone:${this.config.phone}`}verifyOtp(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var i,n,o,s,a;if(this.config.clientTEEConnection==null)throw new Error("Handshake parent not initialized");let r=this.config.clientTEEConnection;try{let e=yield r.sendAction({event:"request:complete-onboarding",responseEvent:"response:complete-onboarding",data:{authData:{jwt:(n=(i=this.config.crossmint.experimental_customAuth)==null?void 0:i.jwt)!=null?n:"",apiKey:this.config.crossmint.apiKey},data:{onboardingAuthentication:{encryptedOtp:t}}},options:h});if((e==null?void 0:e.status)==="success"){this._needsAuth=!1,(o=this._authPromise)==null||o.resolve();return}console.error("[verifyOtp] Failed to validate OTP:",e),this._needsAuth=!0;let g=(e==null?void 0:e.status)==="error"?e.error:"Failed to validate encrypted OTP";(s=this._authPromise)==null||s.reject(new Error(g))}catch(e){throw console.error("[verifyOtp] Error sending OTP validation request:",e),this._needsAuth=!0,(a=this._authPromise)==null||a.reject(e),e}})}},h= exports.b ={timeoutMs:1e4,intervalMs:5e3};exports.a = d; exports.b = h;
@@ -1 +1 @@
1
- import{a as l}from"./chunk-TXMD64BR.js";import{a}from"./chunk-5777T43M.js";import{f as e}from"./chunk-BW7YYVZE.js";import{createCrossmint as p}from"@crossmint/common-sdk-base";var i=class o{constructor(t){let r=new a(t);this.walletFactory=new l(r)}static from(t){return new o(t)}getOrCreateWallet(t){return e(this,null,function*(){return yield this.walletFactory.getOrCreateWallet(t)})}getWallet(t,r){return e(this,null,function*(){return yield this.walletFactory.getWallet(t,r)})}createWallet(t){return e(this,null,function*(){return yield this.walletFactory.createWallet(t)})}};export{p as a,i as b};
1
+ import{a as l}from"./chunk-V5ID6H27.js";import{a}from"./chunk-FLTIUJPZ.js";import{f as e}from"./chunk-BW7YYVZE.js";import{createCrossmint as p}from"@crossmint/common-sdk-base";var i=class o{constructor(t){let r=new a(t);this.walletFactory=new l(r)}static from(t){return new o(t)}getOrCreateWallet(t){return e(this,null,function*(){return yield this.walletFactory.getOrCreateWallet(t)})}getWallet(t,r){return e(this,null,function*(){return yield this.walletFactory.getWallet(t,r)})}createWallet(t){return e(this,null,function*(){return yield this.walletFactory.createWallet(t)})}};export{p as a,i as b};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkM3EZNQE5cjs = require('./chunk-M3EZNQE5.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var p=class extends _commonsdkbase.CrossmintApiClient{constructor(e){super(e,{internalConfig:{sdkMetadata:{name:_chunkM3EZNQE5cjs.c,version:_chunkM3EZNQE5cjs.b}}});this.apiPrefix="api/2025-06-09/wallets";this.legacyApiPrefix="api/2022-06-09/wallets"}createWallet(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let s=this.isServerSide?`${this.apiPrefix}`:`${this.apiPrefix}/me`;return(yield this.post(s,{body:JSON.stringify(e),headers:this.headers})).json()})}getWallet(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}`,{headers:this.headers})).json()})}createTransaction(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveTransaction(e,s,t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions/${s}/approvals`,{body:JSON.stringify(t),headers:this.headers})).json()})}getTransaction(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions/${s}`,{headers:this.headers})).json()})}createSignature(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signatures`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveSignature(e,s,t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signatures/${s}/approvals`,{body:JSON.stringify(t),headers:this.headers})).json()})}getSignature(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/signatures/${s}`,{headers:this.headers})).json()})}getTransactions(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions`,{headers:this.headers})).json()})}experimental_getNfts(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let s=new URLSearchParams;s.append("page",e.page.toString()),s.append("perPage",e.perPage.toString());let t=`${e.chain}:${e.address}`;return(yield this.get(`${this.apiPrefix}/${t}/nfts?${s.toString()}`,{headers:this.headers})).json()})}experimental_activity(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let t=e;this.isServerSide||(t=`me:${s.chain==="solana"?"solana-smart-wallet":"evm-smart-wallet"}`);let a=new URLSearchParams;return a.append("chain",s.chain.toString()),(yield this.get(`${this.legacyApiPrefix}/${t}/activity?${a.toString()}`,{headers:this.headers})).json()})}getBalance(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let t=new URLSearchParams;return t.append("tokens",s.tokens.join(",")),t.append("chains",s.chains.join(",")),(yield this.get(`${this.apiPrefix}/${e}/balances?${t.toString()}`,{headers:this.headers})).json()})}registerSigner(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signers`,{body:JSON.stringify(s),headers:this.headers})).json()})}getSigner(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/signers/${s}`,{headers:this.headers})).json()})}send(e,s,t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/tokens/${s}/transfers`,{body:JSON.stringify(t),headers:this.headers})).json()})}get isServerSide(){return this.parsedAPIKey.usageOrigin===_commonsdkbase.APIKeyUsageOrigin.SERVER}get environment(){if(!this.parsedAPIKey.isValid)throw new (0, _chunkCT2UGJELcjs.a)("Invalid API key");return this.parsedAPIKey.environment}get headers(){return{"Content-Type":"application/json"}}};exports.a = p;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkM4PSXLICcjs = require('./chunk-M4PSXLIC.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:_chunkM4PSXLICcjs.c,version:_chunkM4PSXLICcjs.b}}});this.apiPrefix="api/2025-06-09/wallets";this.legacyApiPrefix="api/2022-06-09/wallets"}createWallet(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let s=this.isServerSide?`${this.apiPrefix}`:`${this.apiPrefix}/me`;return(yield this.post(s,{body:JSON.stringify(e),headers:this.headers})).json()})}getWallet(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}`,{headers:this.headers})).json()})}createTransaction(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveTransaction(e,s,t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions/${s}/approvals`,{body:JSON.stringify(t),headers:this.headers})).json()})}getTransaction(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions/${s}`,{headers:this.headers})).json()})}createSignature(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signatures`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveSignature(e,s,t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signatures/${s}/approvals`,{body:JSON.stringify(t),headers:this.headers})).json()})}getSignature(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/signatures/${s}`,{headers:this.headers})).json()})}getTransactions(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions`,{headers:this.headers})).json()})}experimental_getNfts(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let s=new URLSearchParams;s.append("page",e.page.toString()),s.append("perPage",e.perPage.toString());let t=`${e.chain}:${e.address}`;return(yield this.get(`${this.apiPrefix}/${t}/nfts?${s.toString()}`,{headers:this.headers})).json()})}experimental_activity(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let t=e;this.isServerSide||(t=`me:${s.chain==="solana"?"solana-smart-wallet":"evm-smart-wallet"}`);let a=new URLSearchParams;return a.append("chain",s.chain.toString()),(yield this.get(`${this.legacyApiPrefix}/${t}/activity?${a.toString()}`,{headers:this.headers})).json()})}getBalance(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let t=new URLSearchParams;return t.append("tokens",s.tokens.join(",")),t.append("chains",s.chains.join(",")),(yield this.get(`${this.apiPrefix}/${e}/balances?${t.toString()}`,{headers:this.headers})).json()})}registerSigner(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signers`,{body:JSON.stringify(s),headers:this.headers})).json()})}getSigner(e,s){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/signers/${s}`,{headers:this.headers})).json()})}send(e,s,t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/tokens/${s}/transfers`,{body:JSON.stringify(t),headers:this.headers})).json()})}get isServerSide(){return this.parsedAPIKey.usageOrigin===_commonsdkbase.APIKeyUsageOrigin.SERVER}get environment(){if(!this.parsedAPIKey.isValid)throw new (0, _chunkCT2UGJELcjs.a)("Invalid API key");return this.parsedAPIKey.environment}get headers(){return{"Content-Type":"application/json"}}};exports.a = p;
@@ -1 +1 @@
1
- import{a as t}from"./chunk-VRWKCVVK.js";import{a as l}from"./chunk-SCS4UDW7.js";import{q as c}from"./chunk-7ENJXL4H.js";import{f as s}from"./chunk-BW7YYVZE.js";import m from"bs58";import{isValidSolanaAddress as T}from"@crossmint/common-sdk-base";var d=class u extends t{constructor(n){super({chain:n.chain,address:n.address,owner:n.owner,signer:n.signer,options:t.getOptions(n)},t.getApiClient(n))}static from(n){if(!T(n.address))throw new Error("Wallet is not a Solana wallet");return new u(n)}sendTransaction(n){return s(this,null,function*(){var e,r;let a=yield this.createTransaction(n);if((e=n.options)!=null&&e.experimental_prepareOnly)return{hash:void 0,explorerLink:void 0,transactionId:a.id};let i={additionalSigners:(r=n.additionalSigners)==null?void 0:r.map(o=>new l({type:"external-wallet",address:o.publicKey.toString(),locator:`external-wallet:${o.publicKey.toString()}`,onSignTransaction:p=>(p.sign([o]),Promise.resolve(p))}))};return yield this.approveAndWait(a.id,i)})}createTransaction(S){return s(this,arguments,function*({transaction:n,options:a}){var r;let i=(r=a==null?void 0:a.experimental_signer)!=null?r:this.signer.locator(),e=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:m.encode(n.serialize()),signer:i}});if("error"in e)throw new c(JSON.stringify(e));return e})}};export{d as a};
1
+ import{a as t}from"./chunk-ZTYAEP5F.js";import{a as l}from"./chunk-SCS4UDW7.js";import{q as c}from"./chunk-7ENJXL4H.js";import{f as s}from"./chunk-BW7YYVZE.js";import m from"bs58";import{isValidSolanaAddress as T}from"@crossmint/common-sdk-base";var d=class u extends t{constructor(n){super({chain:n.chain,address:n.address,owner:n.owner,signer:n.signer,options:t.getOptions(n)},t.getApiClient(n))}static from(n){if(!T(n.address))throw new Error("Wallet is not a Solana wallet");return new u(n)}sendTransaction(n){return s(this,null,function*(){var e,r;let a=yield this.createTransaction(n);if((e=n.options)!=null&&e.experimental_prepareOnly)return{hash:void 0,explorerLink:void 0,transactionId:a.id};let i={additionalSigners:(r=n.additionalSigners)==null?void 0:r.map(o=>new l({type:"external-wallet",address:o.publicKey.toString(),locator:`external-wallet:${o.publicKey.toString()}`,onSignTransaction:p=>(p.sign([o]),Promise.resolve(p))}))};return yield this.approveAndWait(a.id,i)})}createTransaction(S){return s(this,arguments,function*({transaction:n,options:a}){var r;let i=(r=a==null?void 0:a.experimental_signer)!=null?r:this.signer.locator(),e=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:m.encode(n.serialize()),signer:i}});if("error"in e)throw new c(JSON.stringify(e));return e})}};export{d as a};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkNAI62DBYcjs = require('./chunk-NAI62DBY.cjs');var _chunkPW4RFMOBcjs = require('./chunk-PW4RFMOB.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var i=class o{constructor(t){let r=new (0, _chunkPW4RFMOBcjs.a)(t);this.walletFactory=new (0, _chunkNAI62DBYcjs.a)(r)}static from(t){return new o(t)}getOrCreateWallet(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.walletFactory.getOrCreateWallet(t)})}getWallet(t,r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.walletFactory.getWallet(t,r)})}createWallet(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.walletFactory.createWallet(t)})}};exports.a = _commonsdkbase.createCrossmint; exports.b = i;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk3SWZYW4Bcjs = require('./chunk-3SWZYW4B.cjs');var _chunkQQAM6RK7cjs = require('./chunk-QQAM6RK7.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var i=class o{constructor(t){let r=new (0, _chunkQQAM6RK7cjs.a)(t);this.walletFactory=new (0, _chunk3SWZYW4Bcjs.a)(r)}static from(t){return new o(t)}getOrCreateWallet(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.walletFactory.getOrCreateWallet(t)})}getWallet(t,r){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.walletFactory.getWallet(t,r)})}createWallet(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){return yield this.walletFactory.createWallet(t)})}};exports.a = _commonsdkbase.createCrossmint; exports.b = i;
@@ -0,0 +1,3 @@
1
+ import{a as p}from"./chunk-ZTYAEP5F.js";import{a as d}from"./chunk-JMTREPVI.js";import{a as f}from"./chunk-IJMFCZIY.js";import{d as y,f as a}from"./chunk-7ENJXL4H.js";import{a as m,f as s}from"./chunk-BW7YYVZE.js";import{WebAuthnP256 as u}from"ox";var S=class{constructor(e){this.apiClient=e}getOrCreateWallet(e){return s(this,null,function*(){if(this.apiClient.isServerSide)throw new a(`getOrCreateWallet can only be called from client-side code.
2
+ - Make sure you're running this in the browser (or another client environment), not on your server.
3
+ - Use your Crossmint Client API Key (not a server key).`);let i=yield this.apiClient.getWallet(`me:${e.chain==="solana"?"solana":"evm"}:smart`);return i!=null&&!("error"in i)?this.createWalletInstance(i,e):this.createWallet(e)})}getWallet(e,i){return s(this,null,function*(){if(!this.apiClient.isServerSide)throw new a("getWallet is not supported on client side, use getOrCreateWallet instead");let n=yield this.apiClient.getWallet(e);if("error"in n)throw new y(JSON.stringify(n));return this.createWalletInstance(n,i)})}createWallet(e){return s(this,null,function*(){var t,r,o,l;yield(o=(r=(t=e.options)==null?void 0:t.experimental_callbacks)==null?void 0:r.onWalletCreationStart)==null?void 0:o.call(r),this.mutateSignerFromCustomAuth(e,!0);let i=e.signer.type==="passkey"?yield this.createPasskeyAdminSigner(e.signer):e.signer,n=yield this.apiClient.createWallet({type:"smart",chainType:e.chain==="solana"?"solana":"evm",config:{adminSigner:i},owner:(l=e.owner)!=null?l:void 0});if("error"in n)throw new a(JSON.stringify(n));return this.createWalletInstance(n,e)})}createWalletInstance(e,i){this.validateExistingWalletConfig(e,i);let n=this.toInternalSignerConfig(e,i.signer,i.options);return new p({chain:i.chain,address:e.address,owner:e.owner,signer:d(i.chain,n),options:i.options},this.apiClient)}toInternalSignerConfig(e,i,n){var t,r,o,l,C,g;if(!(e.chainType==="evm"||e.chainType==="solana"))throw new a(`Wallet type ${e.chainType} is not supported`);if(i==null&&((t=e.config)==null?void 0:t.adminSigner)==null)throw new a("Signer is required to create a wallet");switch(i.type){case"api-key":{if(((r=e.config)==null?void 0:r.adminSigner.type)!=="api-key")throw new a("API key signer does not match the wallet's signer type");return{type:"api-key",address:e.config.adminSigner.address,locator:e.config.adminSigner.locator}}case"external-wallet":if(((o=e.config)==null?void 0:o.adminSigner.type)!=="external-wallet")throw new a("External wallet signer does not match the wallet's signer type");return m(m({},e.config.adminSigner),i);case"passkey":if(((l=e.config)==null?void 0:l.adminSigner.type)!=="passkey")throw new a("Passkey signer does not match the wallet's signer type");return{type:"passkey",id:e.config.adminSigner.id,name:e.config.adminSigner.name,locator:e.config.adminSigner.locator,onCreatePasskey:i.onCreatePasskey,onSignWithPasskey:i.onSignWithPasskey};case"email":{if(((C=e.config)==null?void 0:C.adminSigner.type)!=="email")throw new a("Email signer does not match the wallet's signer type");let{locator:c,email:h}=e.config.adminSigner;return{type:"email",email:h,locator:c,crossmint:this.apiClient.crossmint,onAuthRequired:i.onAuthRequired,clientTEEConnection:n==null?void 0:n.clientTEEConnection}}case"phone":{if(((g=e.config)==null?void 0:g.adminSigner.type)!=="phone")throw new a("Phone signer does not match the wallet's signer type");let{locator:c,phone:h}=e.config.adminSigner;return{type:"phone",phone:h,locator:c,crossmint:this.apiClient.crossmint,onAuthRequired:i.onAuthRequired,clientTEEConnection:n==null?void 0:n.clientTEEConnection}}default:throw new Error("Invalid signer type")}}createPasskeyAdminSigner(e){return s(this,null,function*(){var t;if(e.type!=="passkey")throw new Error("Signer is not a passkey");let i=(t=e.name)!=null?t:`Crossmint Wallet ${Date.now()}`,n=e.onCreatePasskey?yield e.onCreatePasskey(i):yield u.createCredential({name:i});return{type:"passkey",id:n.id,name:i,publicKey:{x:n.publicKey.x.toString(),y:n.publicKey.y.toString()}}})}mutateSignerFromCustomAuth(e,i=!1){var t,r;let{experimental_customAuth:n}=this.apiClient.crossmint;e.signer.type==="email"&&(n==null?void 0:n.email)!=null&&(e.signer.email=(t=e.signer.email)!=null?t:n.email),e.signer.type==="phone"&&(n==null?void 0:n.phone)!=null&&(e.signer.phone=(r=e.signer.phone)!=null?r:n.phone),e.signer.type==="external-wallet"&&(n==null?void 0:n.externalWalletSigner)!=null&&(e.signer=i?{type:"external-wallet",address:n.externalWalletSigner.address}:n.externalWalletSigner)}validateExistingWalletConfig(e,i){var r;if(this.mutateSignerFromCustomAuth(i),i.owner!=null&&e.owner!=null&&i.owner!==e.owner)throw new a("Wallet owner does not match existing wallet's linked user");if(i.chain==="solana"&&e.chainType!=="solana"||i.chain!=="solana"&&e.chainType==="solana")throw new a(`Wallet chain does not match existing wallet's chain. You must use chain: ${e.chainType}.`);if(e.type!=="smart")return;let n=i.signer,t=(r=e==null?void 0:e.config)==null?void 0:r.adminSigner;if(n!=null&&t!=null){if(n.type!==t.type)throw new a("The wallet signer type provided in the wallet config does not match the existing wallet's adminSigner type");f(n,t)}}};export{S as a};
@@ -1 +1 @@
1
- import{a as c}from"./chunk-VRWKCVVK.js";import{k as p,o as d,q as m}from"./chunk-7ENJXL4H.js";import{a as f}from"./chunk-BJDS5BJG.js";import{f as o}from"./chunk-BW7YYVZE.js";import{createPublicClient as E,encodeFunctionData as S,http as V}from"viem";import{isValidEvmAddress as I}from"@crossmint/common-sdk-base";var w=class C extends c{constructor(t){super({chain:t.chain,address:t.address,owner:t.owner,signer:t.signer,options:c.getOptions(t)},c.getApiClient(t))}static from(t){if(!I(t.address))throw new Error("Wallet is not an EVM wallet");return new C(t)}sendTransaction(t){return o(this,null,function*(){var e;let n=this.buildTransaction(t),a=yield this.createTransaction(n,t.options);return(e=t.options)!=null&&e.experimental_prepareOnly?{hash:void 0,explorerLink:void 0,transactionId:a.id}:yield this.approveAndWait(a.id)})}signMessage(t){return o(this,null,function*(){var i;let n=yield this.apiClient.createSignature(this.walletLocator,{type:"message",params:{message:t,signer:this.signer.locator(),chain:this.chain}});if("error"in n)throw new d(JSON.stringify(n));let a=n.id,e=((i=n.approvals)==null?void 0:i.pending)||[];return yield this.approveSignature(e,a),yield this.waitForSignature(a)})}signTypedData(t){return o(this,null,function*(){var T;let{domain:n,message:a,primaryType:e,types:i,chain:r}=t;if(!n||!a||!i||!r)throw new p("Invalid typed data");let{name:u,version:l,chainId:h,verifyingContract:y,salt:v}=n;if(!u||!l||!h||!y)throw new p("Invalid typed data domain");let s=yield this.apiClient.createSignature(this.walletLocator,{type:"typed-data",params:{typedData:{domain:{name:u,version:l,chainId:Number(h),verifyingContract:y,salt:v},message:a,primaryType:e,types:i},signer:this.signer.locator(),chain:r,isSmartWalletSignature:!1}});if("error"in s)throw new d(JSON.stringify(s));let g=s.id,D=((T=s.approvals)==null?void 0:T.pending)||[];return yield this.approveSignature(D,g),yield this.waitForSignature(g)})}getViemClient(t){var n;return E({transport:(n=t==null?void 0:t.transport)!=null?n:V(),chain:f(this.chain)})}createTransaction(t,n){return o(this,null,function*(){var i;let a=(i=n==null?void 0:n.experimental_signer)!=null?i:this.signer.locator(),e=yield this.apiClient.createTransaction(this.walletLocator,{params:{signer:a,chain:this.chain,calls:[t]}});if("error"in e)throw new m(JSON.stringify(e));return e})}buildTransaction(t){var n,a,e,i,r;if("transaction"in t)return{transaction:t.transaction};if(t.abi==null)return{to:t.to,value:(a=(n=t.value)==null?void 0:n.toString())!=null?a:"0",data:(e=t.data)!=null?e:"0x"};if(!t.functionName)throw new Error("Function name is required");return{to:t.to,value:(r=(i=t.value)==null?void 0:i.toString())!=null?r:"0",data:S({abi:t.abi,functionName:t.functionName,args:t.args})}}};export{w as a};
1
+ import{a as c}from"./chunk-ZTYAEP5F.js";import{k as p,o as d,q as m}from"./chunk-7ENJXL4H.js";import{a as f}from"./chunk-4QU7PZVR.js";import{f as o}from"./chunk-BW7YYVZE.js";import{createPublicClient as E,encodeFunctionData as S,http as V}from"viem";import{isValidEvmAddress as I}from"@crossmint/common-sdk-base";var w=class C extends c{constructor(t){super({chain:t.chain,address:t.address,owner:t.owner,signer:t.signer,options:c.getOptions(t)},c.getApiClient(t))}static from(t){if(!I(t.address))throw new Error("Wallet is not an EVM wallet");return new C(t)}sendTransaction(t){return o(this,null,function*(){var e;let n=this.buildTransaction(t),a=yield this.createTransaction(n,t.options);return(e=t.options)!=null&&e.experimental_prepareOnly?{hash:void 0,explorerLink:void 0,transactionId:a.id}:yield this.approveAndWait(a.id)})}signMessage(t){return o(this,null,function*(){var i;let n=yield this.apiClient.createSignature(this.walletLocator,{type:"message",params:{message:t,signer:this.signer.locator(),chain:this.chain}});if("error"in n)throw new d(JSON.stringify(n));let a=n.id,e=((i=n.approvals)==null?void 0:i.pending)||[];return yield this.approveSignature(e,a),yield this.waitForSignature(a)})}signTypedData(t){return o(this,null,function*(){var T;let{domain:n,message:a,primaryType:e,types:i,chain:r}=t;if(!n||!a||!i||!r)throw new p("Invalid typed data");let{name:u,version:l,chainId:h,verifyingContract:y,salt:v}=n;if(!u||!l||!h||!y)throw new p("Invalid typed data domain");let s=yield this.apiClient.createSignature(this.walletLocator,{type:"typed-data",params:{typedData:{domain:{name:u,version:l,chainId:Number(h),verifyingContract:y,salt:v},message:a,primaryType:e,types:i},signer:this.signer.locator(),chain:r,isSmartWalletSignature:!1}});if("error"in s)throw new d(JSON.stringify(s));let g=s.id,D=((T=s.approvals)==null?void 0:T.pending)||[];return yield this.approveSignature(D,g),yield this.waitForSignature(g)})}getViemClient(t){var n;return E({transport:(n=t==null?void 0:t.transport)!=null?n:V(),chain:f(this.chain)})}createTransaction(t,n){return o(this,null,function*(){var i;let a=(i=n==null?void 0:n.experimental_signer)!=null?i:this.signer.locator(),e=yield this.apiClient.createTransaction(this.walletLocator,{params:{signer:a,chain:this.chain,calls:[t]}});if("error"in e)throw new m(JSON.stringify(e));return e})}buildTransaction(t){var n,a,e,i,r;if("transaction"in t)return{transaction:t.transaction};if(t.abi==null)return{to:t.to,value:(a=(n=t.value)==null?void 0:n.toString())!=null?a:"0",data:(e=t.data)!=null?e:"0x"};if(!t.functionName)throw new Error("Function name is required");return{to:t.to,value:(r=(i=t.value)==null?void 0:i.toString())!=null?r:"0",data:S({abi:t.abi,functionName:t.functionName,args:t.args})}}};export{w as a};
@@ -1 +1 @@
1
- import{d as x}from"./chunk-AIH4VH3N.js";import{c as P,d as W,i as L,m as N,p as O,q as $,r as E,s as _,t as B,u as F,v as I,w as J}from"./chunk-7ENJXL4H.js";import{a as S,b as A,c as l,d as C,e as b,f as p}from"./chunk-BW7YYVZE.js";import{isValidAddress as G}from"@crossmint/common-sdk-base";var m,o,R=class{constructor(t,r){C(this,m);C(this,o);let{chain:n,address:a,owner:e,signer:g,options:u}=t;b(this,o,r),this.chain=n,this.address=a,this.owner=e,this.signer=g,b(this,m,u)}static getApiClient(t){return t.apiClient}static getOptions(t){return t.options}get apiClient(){return l(this,o)}get options(){return l(this,m)}balances(t,r){return p(this,null,function*(){let n=this.chain==="solana"?"sol":"eth",a=[n,"usdc",...t!=null?t:[]],e=yield l(this,o).getBalance(this.address,{chains:r!=null?r:[this.chain],tokens:a.map(g=>g.toLowerCase())});if("error"in e)throw new Error(`Failed to get balances for wallet: ${JSON.stringify(e.message)}`);return this.transformBalanceResponse(e,n,t)})}transformBalanceResponse(t,r,n){let a=i=>{var f,h,y,T,v;let d=(f=i.chains)==null?void 0:f[this.chain],w="contractAddress"in d?d.contractAddress:void 0;return{symbol:(h=i.symbol)!=null?h:"",name:(y=i.symbol)!=null?y:"",amount:(T=i.amount)!=null?T:"0",contractAddress:w,decimals:i.decimals,rawAmount:(v=i.rawAmount)!=null?v:"0"}},e=t.find(i=>i.symbol===r),g=t.find(i=>i.symbol==="usdc"),u=t.filter(i=>{var d;return i.symbol!==r&&i.symbol!=="usdc"&&(n==null?void 0:n.includes((d=i.symbol)!=null?d:""))}),s=i=>({symbol:i,name:i,amount:"0",contractAddress:void 0,decimals:0,rawAmount:"0"});return{nativeToken:e!=null?a(e):s(r),usdc:g!=null?a(g):s("usdc"),tokens:u.map(a)}}experimental_nfts(t){return p(this,null,function*(){return yield l(this,o).experimental_getNfts(A(S({},t),{chain:this.chain,address:this.address}))})}experimental_transactions(){return p(this,null,function*(){let t=yield l(this,o).getTransactions(this.walletLocator);if("error"in t)throw new Error(`Failed to get transactions: ${JSON.stringify(t.message)}`);return t})}experimental_transaction(t){return p(this,null,function*(){let r=yield l(this,o).getTransaction(this.walletLocator,t);if("error"in r)throw new Error(`Failed to get transaction: ${JSON.stringify(r.error)}`);return r})}experimental_activity(){return p(this,null,function*(){let t=yield this.apiClient.experimental_activity(this.walletLocator,{chain:this.chain});if("error"in t)throw new Error(`Failed to get activity: ${JSON.stringify(t.message)}`);return t})}send(t,r,n,a){return p(this,null,function*(){let e=k(t),g=H(r,this.chain),u={recipient:e,amount:n},s=yield l(this,o).send(this.walletLocator,g,u);if("message"in s)throw new $(`Failed to send token: ${JSON.stringify(s.message)}`);return a!=null&&a.experimental_prepareOnly?{hash:void 0,explorerLink:void 0,transactionId:s.id}:yield this.approveAndWait(s.id)})}approveTransaction(t){return p(this,null,function*(){return yield this.approveAndWait(t.transactionId,t.options)})}addDelegatedSigner(t){return p(this,null,function*(){var n,a;let r=yield l(this,o).registerSigner(this.walletLocator,{signer:t.signer,chain:this.chain==="solana"?void 0:this.chain});if("error"in r)throw new Error(`Failed to register signer: ${JSON.stringify(r.message)}`);if("transaction"in r){let e=r.transaction.id;yield this.approveAndWait(e)}else{let e=(n=r.chains)==null?void 0:n[this.chain];if((e==null?void 0:e.status)==="awaiting-approval"){let g=((a=e.approvals)==null?void 0:a.pending)||[];yield this.approveSignature(g,e.id),yield this.waitForSignature(e.id);return}if((e==null?void 0:e.status)==="pending"){yield this.waitForSignature(e.id);return}}})}delegatedSigners(){return p(this,null,function*(){var r,n,a;let t=yield l(this,o).getWallet(this.walletLocator);if("error"in t)throw new W(JSON.stringify(t));if(t.type!=="smart"||t.chainType!=="evm"&&t.chainType!=="solana")throw new P(`Wallet type ${t.type} not supported`);return(a=(n=(r=t==null?void 0:t.config)==null?void 0:r.delegatedSigners)==null?void 0:n.map(e=>{let g=e.locator.indexOf(":");return{signer:`external-wallet:${g>=0?e.locator.slice(g+1):e.locator}`}}))!=null?a:[]})}get walletLocator(){return l(this,o).isServerSide?this.address:`me:${this.chain==="solana"?"solana":"evm"}:smart`}get isSolanaWallet(){return this.chain==="solana"}approveAndWait(t,r){return p(this,null,function*(){return yield this.approveTransactionInternal(t,r),yield this.sleep(1e3),yield this.waitForTransaction(t)})}approveTransactionInternal(t,r){return p(this,null,function*(){var s,i,d,w,f;let n=yield l(this,o).getTransaction(this.walletLocator,t);if("error"in n)throw new E(JSON.stringify(n));if(yield(d=(i=(s=l(this,m))==null?void 0:s.experimental_callbacks)==null?void 0:i.onTransactionStart)==null?void 0:d.call(i),this.signer.type==="api-key")return n;if((r==null?void 0:r.experimental_approval)!=null){let h=[r.experimental_approval];return yield this.executeApprovalWithErrorHandling(t,h)}let a=(w=n.approvals)==null?void 0:w.pending;if(a==null)return n;let e=[...(f=r==null?void 0:r.additionalSigners)!=null?f:[],this.signer],u=(yield Promise.all(a.map(h=>{let y=e.find(v=>v.locator()===h.signer.locator);if(y==null)throw new L(`Signer ${h.signer} not found in pending approvals`);let T=n.chainType==="solana"&&"transaction"in n.onChain?n.onChain.transaction:h.message;return y.signTransaction(T)}))).map(h=>A(S({},h),{signer:this.signer.locator()}));return yield this.executeApprovalWithErrorHandling(t,u)})}executeApprovalWithErrorHandling(t,r){return p(this,null,function*(){let n=yield l(this,o).approveTransaction(this.walletLocator,t,{approvals:r});if(n.error)throw new J(JSON.stringify(n));return n})}approveSignature(t,r){return p(this,null,function*(){if(this.isSolanaWallet)throw new Error("Approving signatures is only supported for EVM smart wallets");let n=t.find(e=>e.signer.locator===this.signer.locator());if(!n)throw new L(`Signer ${this.signer.locator()} not found in pending approvals`);let a=yield this.signer.signMessage(n.message);return yield l(this,o).approveSignature(this.walletLocator,r,{approvals:[S({signer:this.signer.locator()},a)]}),a})}waitForSignature(t){return p(this,null,function*(){let r=null;do if(yield new Promise(n=>setTimeout(n,x)),r=yield l(this,o).getSignature(this.walletLocator,t),"error"in r)throw new O(JSON.stringify(r));while(r===null||r.status==="pending");if(r.status==="failed")throw new N("Signature signing failed");if(!r.outputSignature)throw new O("Signature not available");return r.outputSignature})}waitForTransaction(g){return p(this,arguments,function*(t,r=6e4,{backoffMultiplier:n=1.1,maxBackoffMs:a=2e3,initialBackoffMs:e=x}={}){var d;let u=Date.now(),s;do{if(Date.now()-u>r)throw new _("Transaction confirmation timeout");if(s=yield l(this,o).getTransaction(this.walletLocator,t),s.error)throw new E(JSON.stringify(s));yield this.sleep(e),e=Math.min(e*n,a)}while(s.status==="pending");if(s.status==="failed")throw new B(`Transaction sending failed: ${JSON.stringify(s.error)}`);if(s.status==="awaiting-approval")throw new F("Transaction is awaiting approval. Please submit required approvals before waiting for completion.");let i=s.onChain.txId;if(i==null)throw new I("Transaction hash not found on transaction response");return{hash:i,explorerLink:(d=s.onChain.explorerLink)!=null?d:"",transactionId:s.id}})}sleep(t){return p(this,null,function*(){return new Promise(r=>setTimeout(r,t))})}};m=new WeakMap,o=new WeakMap;function k(c){if(typeof c=="string")return c;if("email"in c)return`email:${c.email}`;if("x"in c)return`x:${c.x}`;if("twitter"in c)return`twitter:${c.twitter}`;if("phone"in c)return`phoneNumber:${c.phone}`;if("userId"in c)return`userId:${c.userId}`;throw new Error("Invalid recipient locator")}function H(c,t){return G(c)?`${t}:${c}`:`${t}:${c.toLowerCase()}`}export{R as a};
1
+ import{d as x}from"./chunk-5UKD6N4G.js";import{c as P,d as W,i as L,m as N,p as O,q as $,r as E,s as _,t as B,u as F,v as I,w as J}from"./chunk-7ENJXL4H.js";import{a as S,b as A,c as l,d as C,e as b,f as p}from"./chunk-BW7YYVZE.js";import{isValidAddress as G}from"@crossmint/common-sdk-base";var m,o,R=class{constructor(t,r){C(this,m);C(this,o);let{chain:n,address:a,owner:e,signer:g,options:u}=t;b(this,o,r),this.chain=n,this.address=a,this.owner=e,this.signer=g,b(this,m,u)}static getApiClient(t){return t.apiClient}static getOptions(t){return t.options}get apiClient(){return l(this,o)}get options(){return l(this,m)}balances(t,r){return p(this,null,function*(){let n=this.chain==="solana"?"sol":"eth",a=[n,"usdc",...t!=null?t:[]],e=yield l(this,o).getBalance(this.address,{chains:r!=null?r:[this.chain],tokens:a.map(g=>g.toLowerCase())});if("error"in e)throw new Error(`Failed to get balances for wallet: ${JSON.stringify(e.message)}`);return this.transformBalanceResponse(e,n,t)})}transformBalanceResponse(t,r,n){let a=i=>{var f,h,y,T,v;let d=(f=i.chains)==null?void 0:f[this.chain],w="contractAddress"in d?d.contractAddress:void 0;return{symbol:(h=i.symbol)!=null?h:"",name:(y=i.symbol)!=null?y:"",amount:(T=i.amount)!=null?T:"0",contractAddress:w,decimals:i.decimals,rawAmount:(v=i.rawAmount)!=null?v:"0"}},e=t.find(i=>i.symbol===r),g=t.find(i=>i.symbol==="usdc"),u=t.filter(i=>{var d;return i.symbol!==r&&i.symbol!=="usdc"&&(n==null?void 0:n.includes((d=i.symbol)!=null?d:""))}),s=i=>({symbol:i,name:i,amount:"0",contractAddress:void 0,decimals:0,rawAmount:"0"});return{nativeToken:e!=null?a(e):s(r),usdc:g!=null?a(g):s("usdc"),tokens:u.map(a)}}experimental_nfts(t){return p(this,null,function*(){return yield l(this,o).experimental_getNfts(A(S({},t),{chain:this.chain,address:this.address}))})}experimental_transactions(){return p(this,null,function*(){let t=yield l(this,o).getTransactions(this.walletLocator);if("error"in t)throw new Error(`Failed to get transactions: ${JSON.stringify(t.message)}`);return t})}experimental_transaction(t){return p(this,null,function*(){let r=yield l(this,o).getTransaction(this.walletLocator,t);if("error"in r)throw new Error(`Failed to get transaction: ${JSON.stringify(r.error)}`);return r})}experimental_activity(){return p(this,null,function*(){let t=yield this.apiClient.experimental_activity(this.walletLocator,{chain:this.chain});if("error"in t)throw new Error(`Failed to get activity: ${JSON.stringify(t.message)}`);return t})}send(t,r,n,a){return p(this,null,function*(){let e=k(t),g=H(r,this.chain),u={recipient:e,amount:n},s=yield l(this,o).send(this.walletLocator,g,u);if("message"in s)throw new $(`Failed to send token: ${JSON.stringify(s.message)}`);return a!=null&&a.experimental_prepareOnly?{hash:void 0,explorerLink:void 0,transactionId:s.id}:yield this.approveAndWait(s.id)})}approveTransaction(t){return p(this,null,function*(){return yield this.approveAndWait(t.transactionId,t.options)})}addDelegatedSigner(t){return p(this,null,function*(){var n,a;let r=yield l(this,o).registerSigner(this.walletLocator,{signer:t.signer,chain:this.chain==="solana"?void 0:this.chain});if("error"in r)throw new Error(`Failed to register signer: ${JSON.stringify(r.message)}`);if("transaction"in r){let e=r.transaction.id;yield this.approveAndWait(e)}else{let e=(n=r.chains)==null?void 0:n[this.chain];if((e==null?void 0:e.status)==="awaiting-approval"){let g=((a=e.approvals)==null?void 0:a.pending)||[];yield this.approveSignature(g,e.id),yield this.waitForSignature(e.id);return}if((e==null?void 0:e.status)==="pending"){yield this.waitForSignature(e.id);return}}})}delegatedSigners(){return p(this,null,function*(){var r,n,a;let t=yield l(this,o).getWallet(this.walletLocator);if("error"in t)throw new W(JSON.stringify(t));if(t.type!=="smart"||t.chainType!=="evm"&&t.chainType!=="solana")throw new P(`Wallet type ${t.type} not supported`);return(a=(n=(r=t==null?void 0:t.config)==null?void 0:r.delegatedSigners)==null?void 0:n.map(e=>{let g=e.locator.indexOf(":");return{signer:`external-wallet:${g>=0?e.locator.slice(g+1):e.locator}`}}))!=null?a:[]})}get walletLocator(){return l(this,o).isServerSide?this.address:`me:${this.chain==="solana"?"solana":"evm"}:smart`}get isSolanaWallet(){return this.chain==="solana"}approveAndWait(t,r){return p(this,null,function*(){return yield this.approveTransactionInternal(t,r),yield this.sleep(1e3),yield this.waitForTransaction(t)})}approveTransactionInternal(t,r){return p(this,null,function*(){var s,i,d,w,f;let n=yield l(this,o).getTransaction(this.walletLocator,t);if("error"in n)throw new E(JSON.stringify(n));if(yield(d=(i=(s=l(this,m))==null?void 0:s.experimental_callbacks)==null?void 0:i.onTransactionStart)==null?void 0:d.call(i),this.signer.type==="api-key")return n;if((r==null?void 0:r.experimental_approval)!=null){let h=[r.experimental_approval];return yield this.executeApprovalWithErrorHandling(t,h)}let a=(w=n.approvals)==null?void 0:w.pending;if(a==null)return n;let e=[...(f=r==null?void 0:r.additionalSigners)!=null?f:[],this.signer],u=(yield Promise.all(a.map(h=>{let y=e.find(v=>v.locator()===h.signer.locator);if(y==null)throw new L(`Signer ${h.signer} not found in pending approvals`);let T=n.chainType==="solana"&&"transaction"in n.onChain?n.onChain.transaction:h.message;return y.signTransaction(T)}))).map(h=>A(S({},h),{signer:this.signer.locator()}));return yield this.executeApprovalWithErrorHandling(t,u)})}executeApprovalWithErrorHandling(t,r){return p(this,null,function*(){let n=yield l(this,o).approveTransaction(this.walletLocator,t,{approvals:r});if(n.error)throw new J(JSON.stringify(n));return n})}approveSignature(t,r){return p(this,null,function*(){if(this.isSolanaWallet)throw new Error("Approving signatures is only supported for EVM smart wallets");let n=t.find(e=>e.signer.locator===this.signer.locator());if(!n)throw new L(`Signer ${this.signer.locator()} not found in pending approvals`);let a=yield this.signer.signMessage(n.message);return yield l(this,o).approveSignature(this.walletLocator,r,{approvals:[S({signer:this.signer.locator()},a)]}),a})}waitForSignature(t){return p(this,null,function*(){let r=null;do if(yield new Promise(n=>setTimeout(n,x)),r=yield l(this,o).getSignature(this.walletLocator,t),"error"in r)throw new O(JSON.stringify(r));while(r===null||r.status==="pending");if(r.status==="failed")throw new N("Signature signing failed");if(!r.outputSignature)throw new O("Signature not available");return r.outputSignature})}waitForTransaction(g){return p(this,arguments,function*(t,r=6e4,{backoffMultiplier:n=1.1,maxBackoffMs:a=2e3,initialBackoffMs:e=x}={}){var d;let u=Date.now(),s;do{if(Date.now()-u>r)throw new _("Transaction confirmation timeout");if(s=yield l(this,o).getTransaction(this.walletLocator,t),s.error)throw new E(JSON.stringify(s));yield this.sleep(e),e=Math.min(e*n,a)}while(s.status==="pending");if(s.status==="failed")throw new B(`Transaction sending failed: ${JSON.stringify(s.error)}`);if(s.status==="awaiting-approval")throw new F("Transaction is awaiting approval. Please submit required approvals before waiting for completion.");let i=s.onChain.txId;if(i==null)throw new I("Transaction hash not found on transaction response");return{hash:i,explorerLink:(d=s.onChain.explorerLink)!=null?d:"",transactionId:s.id}})}sleep(t){return p(this,null,function*(){return new Promise(r=>setTimeout(r,t))})}};m=new WeakMap,o=new WeakMap;function k(c){if(typeof c=="string")return c;if("email"in c)return`email:${c.email}`;if("x"in c)return`x:${c.x}`;if("twitter"in c)return`twitter:${c.twitter}`;if("phone"in c)return`phoneNumber:${c.phone}`;if("userId"in c)return`userId:${c.userId}`;throw new Error("Invalid recipient locator")}function H(c,t){return G(c)?`${t}:${c}`:`${t}:${c.toLowerCase()}`}export{R as a};
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk77UQTNS7cjs = require('./chunk-77UQTNS7.cjs');var _chunkX7Y4HEDKcjs = require('./chunk-X7Y4HEDK.cjs');var _chunkXTGLXZAWcjs = require('./chunk-XTGLXZAW.cjs');require('./chunk-NAI62DBY.cjs');var _chunk7OMPE56Gcjs = require('./chunk-7OMPE56G.cjs');require('./chunk-IQB4HWD3.cjs');require('./chunk-3ABHUDKX.cjs');require('./chunk-3HZJR6A3.cjs');require('./chunk-5KA7SYRH.cjs');require('./chunk-MLOSILO2.cjs');require('./chunk-U4S6GWMK.cjs');require('./chunk-YWPTI2QO.cjs');require('./chunk-4KXOWU5E.cjs');require('./chunk-YTAW674L.cjs');require('./chunk-ZSWIQU3U.cjs');require('./chunk-RFK6N7LC.cjs');require('./chunk-6HXIZLEQ.cjs');var _chunkPW4RFMOBcjs = require('./chunk-PW4RFMOB.cjs');require('./chunk-M3EZNQE5.cjs');require('./chunk-CT2UGJEL.cjs');require('./chunk-ECAM5KTH.cjs');require('./chunk-6VJEBYPN.cjs');require('./chunk-IR5WN6FQ.cjs');require('./chunk-GEY574TH.cjs');require('./chunk-YZ4HRYSL.cjs');require('./chunk-BULGM35W.cjs');require('./chunk-XALFCQKD.cjs');exports.CrossmintWallets = _chunkXTGLXZAWcjs.b; exports.EVMWallet = _chunk77UQTNS7cjs.a; exports.SolanaWallet = _chunkX7Y4HEDKcjs.a; exports.Wallet = _chunk7OMPE56Gcjs.a; exports.WalletsApiClient = _chunkPW4RFMOBcjs.a; exports.createCrossmint = _chunkXTGLXZAWcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkEK35EJ7Wcjs = require('./chunk-EK35EJ7W.cjs');var _chunk4VOZ6LDIcjs = require('./chunk-4VOZ6LDI.cjs');var _chunkSEOBA7FScjs = require('./chunk-SEOBA7FS.cjs');require('./chunk-3SWZYW4B.cjs');var _chunkKGL2AM4Dcjs = require('./chunk-KGL2AM4D.cjs');require('./chunk-CQL2S4AX.cjs');require('./chunk-3ABHUDKX.cjs');require('./chunk-3BCOIESI.cjs');require('./chunk-243LSD4S.cjs');require('./chunk-OWDKPU47.cjs');require('./chunk-MQP5VZCA.cjs');require('./chunk-YWPTI2QO.cjs');require('./chunk-4KXOWU5E.cjs');require('./chunk-YTAW674L.cjs');require('./chunk-ZSWIQU3U.cjs');require('./chunk-RFK6N7LC.cjs');require('./chunk-6HXIZLEQ.cjs');var _chunkQQAM6RK7cjs = require('./chunk-QQAM6RK7.cjs');require('./chunk-M4PSXLIC.cjs');require('./chunk-CT2UGJEL.cjs');require('./chunk-ECAM5KTH.cjs');require('./chunk-LTISHXFE.cjs');require('./chunk-IR5WN6FQ.cjs');require('./chunk-GEY574TH.cjs');require('./chunk-YZ4HRYSL.cjs');require('./chunk-BULGM35W.cjs');require('./chunk-XALFCQKD.cjs');exports.CrossmintWallets = _chunkSEOBA7FScjs.b; exports.EVMWallet = _chunkEK35EJ7Wcjs.a; exports.SolanaWallet = _chunk4VOZ6LDIcjs.a; exports.Wallet = _chunkKGL2AM4Dcjs.a; exports.WalletsApiClient = _chunkQQAM6RK7cjs.a; exports.createCrossmint = _chunkSEOBA7FScjs.a;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{a as o}from"./chunk-XP4QXJGR.js";import{a as r}from"./chunk-XXIW4AEP.js";import{a,b as t}from"./chunk-UQPCW4TD.js";import"./chunk-TXMD64BR.js";import{a as n}from"./chunk-VRWKCVVK.js";import"./chunk-5U4PVNPM.js";import"./chunk-7AFCY47Q.js";import"./chunk-4FM7WA5H.js";import"./chunk-U3KINSXQ.js";import"./chunk-YNIO2LU5.js";import"./chunk-Y5NVCPZ2.js";import"./chunk-UBOWSXW3.js";import"./chunk-IGBQEAD5.js";import"./chunk-SCS4UDW7.js";import"./chunk-M4ELAV7U.js";import"./chunk-IJMFCZIY.js";import"./chunk-5IFDVB4Y.js";import{a as e}from"./chunk-5777T43M.js";import"./chunk-AIH4VH3N.js";import"./chunk-7ENJXL4H.js";import"./chunk-KBJA7JDT.js";import"./chunk-BJDS5BJG.js";import"./chunk-KKQBZXFE.js";import"./chunk-S3DYQVRD.js";import"./chunk-LW6JSI4J.js";import"./chunk-5S6YZJHE.js";import"./chunk-BW7YYVZE.js";export{t as CrossmintWallets,o as EVMWallet,r as SolanaWallet,n as Wallet,e as WalletsApiClient,a as createCrossmint};
1
+ import{a as o}from"./chunk-XV2TIRND.js";import{a as r}from"./chunk-R4VZXJ5G.js";import{a,b as t}from"./chunk-QHQFOPJW.js";import"./chunk-V5ID6H27.js";import{a as n}from"./chunk-ZTYAEP5F.js";import"./chunk-JMTREPVI.js";import"./chunk-7AFCY47Q.js";import"./chunk-4UVL6FIE.js";import"./chunk-KXFOQTZ2.js";import"./chunk-NP4EN5GQ.js";import"./chunk-JUSY5XEE.js";import"./chunk-UBOWSXW3.js";import"./chunk-IGBQEAD5.js";import"./chunk-SCS4UDW7.js";import"./chunk-M4ELAV7U.js";import"./chunk-IJMFCZIY.js";import"./chunk-5IFDVB4Y.js";import{a as e}from"./chunk-FLTIUJPZ.js";import"./chunk-5UKD6N4G.js";import"./chunk-7ENJXL4H.js";import"./chunk-KBJA7JDT.js";import"./chunk-4QU7PZVR.js";import"./chunk-KKQBZXFE.js";import"./chunk-S3DYQVRD.js";import"./chunk-LW6JSI4J.js";import"./chunk-5S6YZJHE.js";import"./chunk-BW7YYVZE.js";export{t as CrossmintWallets,o as EVMWallet,r as SolanaWallet,n as Wallet,e as WalletsApiClient,a as createCrossmint};
package/dist/sdk.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkXTGLXZAWcjs = require('./chunk-XTGLXZAW.cjs');require('./chunk-NAI62DBY.cjs');require('./chunk-7OMPE56G.cjs');require('./chunk-IQB4HWD3.cjs');require('./chunk-3ABHUDKX.cjs');require('./chunk-3HZJR6A3.cjs');require('./chunk-5KA7SYRH.cjs');require('./chunk-MLOSILO2.cjs');require('./chunk-U4S6GWMK.cjs');require('./chunk-YWPTI2QO.cjs');require('./chunk-4KXOWU5E.cjs');require('./chunk-YTAW674L.cjs');require('./chunk-ZSWIQU3U.cjs');require('./chunk-RFK6N7LC.cjs');require('./chunk-6HXIZLEQ.cjs');require('./chunk-PW4RFMOB.cjs');require('./chunk-M3EZNQE5.cjs');require('./chunk-CT2UGJEL.cjs');require('./chunk-ECAM5KTH.cjs');require('./chunk-YZ4HRYSL.cjs');require('./chunk-BULGM35W.cjs');require('./chunk-XALFCQKD.cjs');exports.CrossmintWallets = _chunkXTGLXZAWcjs.b; exports.createCrossmint = _chunkXTGLXZAWcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkSEOBA7FScjs = require('./chunk-SEOBA7FS.cjs');require('./chunk-3SWZYW4B.cjs');require('./chunk-KGL2AM4D.cjs');require('./chunk-CQL2S4AX.cjs');require('./chunk-3ABHUDKX.cjs');require('./chunk-3BCOIESI.cjs');require('./chunk-243LSD4S.cjs');require('./chunk-OWDKPU47.cjs');require('./chunk-MQP5VZCA.cjs');require('./chunk-YWPTI2QO.cjs');require('./chunk-4KXOWU5E.cjs');require('./chunk-YTAW674L.cjs');require('./chunk-ZSWIQU3U.cjs');require('./chunk-RFK6N7LC.cjs');require('./chunk-6HXIZLEQ.cjs');require('./chunk-QQAM6RK7.cjs');require('./chunk-M4PSXLIC.cjs');require('./chunk-CT2UGJEL.cjs');require('./chunk-ECAM5KTH.cjs');require('./chunk-YZ4HRYSL.cjs');require('./chunk-BULGM35W.cjs');require('./chunk-XALFCQKD.cjs');exports.CrossmintWallets = _chunkSEOBA7FScjs.b; exports.createCrossmint = _chunkSEOBA7FScjs.a;
package/dist/sdk.js CHANGED
@@ -1 +1 @@
1
- import{a,b}from"./chunk-UQPCW4TD.js";import"./chunk-TXMD64BR.js";import"./chunk-VRWKCVVK.js";import"./chunk-5U4PVNPM.js";import"./chunk-7AFCY47Q.js";import"./chunk-4FM7WA5H.js";import"./chunk-U3KINSXQ.js";import"./chunk-YNIO2LU5.js";import"./chunk-Y5NVCPZ2.js";import"./chunk-UBOWSXW3.js";import"./chunk-IGBQEAD5.js";import"./chunk-SCS4UDW7.js";import"./chunk-M4ELAV7U.js";import"./chunk-IJMFCZIY.js";import"./chunk-5IFDVB4Y.js";import"./chunk-5777T43M.js";import"./chunk-AIH4VH3N.js";import"./chunk-7ENJXL4H.js";import"./chunk-KBJA7JDT.js";import"./chunk-LW6JSI4J.js";import"./chunk-5S6YZJHE.js";import"./chunk-BW7YYVZE.js";export{b as CrossmintWallets,a as createCrossmint};
1
+ import{a,b}from"./chunk-QHQFOPJW.js";import"./chunk-V5ID6H27.js";import"./chunk-ZTYAEP5F.js";import"./chunk-JMTREPVI.js";import"./chunk-7AFCY47Q.js";import"./chunk-4UVL6FIE.js";import"./chunk-KXFOQTZ2.js";import"./chunk-NP4EN5GQ.js";import"./chunk-JUSY5XEE.js";import"./chunk-UBOWSXW3.js";import"./chunk-IGBQEAD5.js";import"./chunk-SCS4UDW7.js";import"./chunk-M4ELAV7U.js";import"./chunk-IJMFCZIY.js";import"./chunk-5IFDVB4Y.js";import"./chunk-FLTIUJPZ.js";import"./chunk-5UKD6N4G.js";import"./chunk-7ENJXL4H.js";import"./chunk-KBJA7JDT.js";import"./chunk-LW6JSI4J.js";import"./chunk-5S6YZJHE.js";import"./chunk-BW7YYVZE.js";export{b as CrossmintWallets,a as createCrossmint};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkIQB4HWD3cjs = require('../chunk-IQB4HWD3.cjs');require('../chunk-3ABHUDKX.cjs');require('../chunk-3HZJR6A3.cjs');require('../chunk-5KA7SYRH.cjs');require('../chunk-MLOSILO2.cjs');require('../chunk-U4S6GWMK.cjs');require('../chunk-YWPTI2QO.cjs');require('../chunk-4KXOWU5E.cjs');require('../chunk-YTAW674L.cjs');require('../chunk-ZSWIQU3U.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-YZ4HRYSL.cjs');require('../chunk-BULGM35W.cjs');require('../chunk-XALFCQKD.cjs');exports.assembleSigner = _chunkIQB4HWD3cjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkCQL2S4AXcjs = require('../chunk-CQL2S4AX.cjs');require('../chunk-3ABHUDKX.cjs');require('../chunk-3BCOIESI.cjs');require('../chunk-243LSD4S.cjs');require('../chunk-OWDKPU47.cjs');require('../chunk-MQP5VZCA.cjs');require('../chunk-YWPTI2QO.cjs');require('../chunk-4KXOWU5E.cjs');require('../chunk-YTAW674L.cjs');require('../chunk-ZSWIQU3U.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-YZ4HRYSL.cjs');require('../chunk-BULGM35W.cjs');require('../chunk-XALFCQKD.cjs');exports.assembleSigner = _chunkCQL2S4AXcjs.a;
@@ -1 +1 @@
1
- import{a}from"../chunk-5U4PVNPM.js";import"../chunk-7AFCY47Q.js";import"../chunk-4FM7WA5H.js";import"../chunk-U3KINSXQ.js";import"../chunk-YNIO2LU5.js";import"../chunk-Y5NVCPZ2.js";import"../chunk-UBOWSXW3.js";import"../chunk-IGBQEAD5.js";import"../chunk-SCS4UDW7.js";import"../chunk-M4ELAV7U.js";import"../chunk-7ENJXL4H.js";import"../chunk-LW6JSI4J.js";import"../chunk-5S6YZJHE.js";import"../chunk-BW7YYVZE.js";export{a as assembleSigner};
1
+ import{a}from"../chunk-JMTREPVI.js";import"../chunk-7AFCY47Q.js";import"../chunk-4UVL6FIE.js";import"../chunk-KXFOQTZ2.js";import"../chunk-NP4EN5GQ.js";import"../chunk-JUSY5XEE.js";import"../chunk-UBOWSXW3.js";import"../chunk-IGBQEAD5.js";import"../chunk-SCS4UDW7.js";import"../chunk-M4ELAV7U.js";import"../chunk-7ENJXL4H.js";import"../chunk-LW6JSI4J.js";import"../chunk-5S6YZJHE.js";import"../chunk-BW7YYVZE.js";export{a as assembleSigner};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../../chunk-3ABHUDKX.cjs');var _chunk3HZJR6A3cjs = require('../../chunk-3HZJR6A3.cjs');var _chunk5KA7SYRHcjs = require('../../chunk-5KA7SYRH.cjs');var _chunkMLOSILO2cjs = require('../../chunk-MLOSILO2.cjs');require('../../chunk-U4S6GWMK.cjs');require('../../chunk-ZSWIQU3U.cjs');require('../../chunk-XALFCQKD.cjs');exports.DEFAULT_EVENT_OPTIONS = _chunkMLOSILO2cjs.b; exports.EVMNonCustodialSigner = _chunk3HZJR6A3cjs.a; exports.NonCustodialSigner = _chunkMLOSILO2cjs.a; exports.SolanaNonCustodialSigner = _chunk5KA7SYRHcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../../chunk-3ABHUDKX.cjs');var _chunk3BCOIESIcjs = require('../../chunk-3BCOIESI.cjs');var _chunk243LSD4Scjs = require('../../chunk-243LSD4S.cjs');var _chunkOWDKPU47cjs = require('../../chunk-OWDKPU47.cjs');require('../../chunk-MQP5VZCA.cjs');require('../../chunk-ZSWIQU3U.cjs');require('../../chunk-XALFCQKD.cjs');exports.DEFAULT_EVENT_OPTIONS = _chunkOWDKPU47cjs.b; exports.EVMNonCustodialSigner = _chunk3BCOIESIcjs.a; exports.NonCustodialSigner = _chunkOWDKPU47cjs.a; exports.SolanaNonCustodialSigner = _chunk243LSD4Scjs.a;
@@ -1 +1 @@
1
- import"../../chunk-7AFCY47Q.js";import{a as d}from"../../chunk-4FM7WA5H.js";import{a as c}from"../../chunk-U3KINSXQ.js";import{a,b}from"../../chunk-YNIO2LU5.js";import"../../chunk-Y5NVCPZ2.js";import"../../chunk-M4ELAV7U.js";import"../../chunk-BW7YYVZE.js";export{b as DEFAULT_EVENT_OPTIONS,d as EVMNonCustodialSigner,a as NonCustodialSigner,c as SolanaNonCustodialSigner};
1
+ import"../../chunk-7AFCY47Q.js";import{a as d}from"../../chunk-4UVL6FIE.js";import{a as c}from"../../chunk-KXFOQTZ2.js";import{a,b}from"../../chunk-NP4EN5GQ.js";import"../../chunk-JUSY5XEE.js";import"../../chunk-M4ELAV7U.js";import"../../chunk-BW7YYVZE.js";export{b as DEFAULT_EVENT_OPTIONS,d as EVMNonCustodialSigner,a as NonCustodialSigner,c as SolanaNonCustodialSigner};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk3HZJR6A3cjs = require('../../chunk-3HZJR6A3.cjs');require('../../chunk-MLOSILO2.cjs');require('../../chunk-U4S6GWMK.cjs');require('../../chunk-ZSWIQU3U.cjs');require('../../chunk-XALFCQKD.cjs');exports.EVMNonCustodialSigner = _chunk3HZJR6A3cjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk3BCOIESIcjs = require('../../chunk-3BCOIESI.cjs');require('../../chunk-OWDKPU47.cjs');require('../../chunk-MQP5VZCA.cjs');require('../../chunk-ZSWIQU3U.cjs');require('../../chunk-XALFCQKD.cjs');exports.EVMNonCustodialSigner = _chunk3BCOIESIcjs.a;
@@ -1 +1 @@
1
- import{a}from"../../chunk-4FM7WA5H.js";import"../../chunk-YNIO2LU5.js";import"../../chunk-Y5NVCPZ2.js";import"../../chunk-M4ELAV7U.js";import"../../chunk-BW7YYVZE.js";export{a as EVMNonCustodialSigner};
1
+ import{a}from"../../chunk-4UVL6FIE.js";import"../../chunk-NP4EN5GQ.js";import"../../chunk-JUSY5XEE.js";import"../../chunk-M4ELAV7U.js";import"../../chunk-BW7YYVZE.js";export{a as EVMNonCustodialSigner};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkU4S6GWMKcjs = require('../../chunk-U4S6GWMK.cjs');require('../../chunk-XALFCQKD.cjs');exports.NcsIframeManager = _chunkU4S6GWMKcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkMQP5VZCAcjs = require('../../chunk-MQP5VZCA.cjs');require('../../chunk-XALFCQKD.cjs');exports.NcsIframeManager = _chunkMQP5VZCAcjs.a;
@@ -1 +1 @@
1
- import{a}from"../../chunk-Y5NVCPZ2.js";import"../../chunk-BW7YYVZE.js";export{a as NcsIframeManager};
1
+ import{a}from"../../chunk-JUSY5XEE.js";import"../../chunk-BW7YYVZE.js";export{a as NcsIframeManager};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkMLOSILO2cjs = require('../../chunk-MLOSILO2.cjs');require('../../chunk-U4S6GWMK.cjs');require('../../chunk-ZSWIQU3U.cjs');require('../../chunk-XALFCQKD.cjs');exports.DEFAULT_EVENT_OPTIONS = _chunkMLOSILO2cjs.b; exports.NonCustodialSigner = _chunkMLOSILO2cjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkOWDKPU47cjs = require('../../chunk-OWDKPU47.cjs');require('../../chunk-MQP5VZCA.cjs');require('../../chunk-ZSWIQU3U.cjs');require('../../chunk-XALFCQKD.cjs');exports.DEFAULT_EVENT_OPTIONS = _chunkOWDKPU47cjs.b; exports.NonCustodialSigner = _chunkOWDKPU47cjs.a;
@@ -1 +1 @@
1
- import{a,b}from"../../chunk-YNIO2LU5.js";import"../../chunk-Y5NVCPZ2.js";import"../../chunk-M4ELAV7U.js";import"../../chunk-BW7YYVZE.js";export{b as DEFAULT_EVENT_OPTIONS,a as NonCustodialSigner};
1
+ import{a,b}from"../../chunk-NP4EN5GQ.js";import"../../chunk-JUSY5XEE.js";import"../../chunk-M4ELAV7U.js";import"../../chunk-BW7YYVZE.js";export{b as DEFAULT_EVENT_OPTIONS,a as NonCustodialSigner};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk5KA7SYRHcjs = require('../../chunk-5KA7SYRH.cjs');require('../../chunk-MLOSILO2.cjs');require('../../chunk-U4S6GWMK.cjs');require('../../chunk-ZSWIQU3U.cjs');require('../../chunk-XALFCQKD.cjs');exports.SolanaNonCustodialSigner = _chunk5KA7SYRHcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk243LSD4Scjs = require('../../chunk-243LSD4S.cjs');require('../../chunk-OWDKPU47.cjs');require('../../chunk-MQP5VZCA.cjs');require('../../chunk-ZSWIQU3U.cjs');require('../../chunk-XALFCQKD.cjs');exports.SolanaNonCustodialSigner = _chunk243LSD4Scjs.a;
@@ -1 +1 @@
1
- import{a}from"../../chunk-U3KINSXQ.js";import"../../chunk-YNIO2LU5.js";import"../../chunk-Y5NVCPZ2.js";import"../../chunk-M4ELAV7U.js";import"../../chunk-BW7YYVZE.js";export{a as SolanaNonCustodialSigner};
1
+ import{a}from"../../chunk-KXFOQTZ2.js";import"../../chunk-NP4EN5GQ.js";import"../../chunk-JUSY5XEE.js";import"../../chunk-M4ELAV7U.js";import"../../chunk-BW7YYVZE.js";export{a as SolanaNonCustodialSigner};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkM3EZNQE5cjs = require('../chunk-M3EZNQE5.cjs');require('../chunk-XALFCQKD.cjs');exports.SDK_NAME = _chunkM3EZNQE5cjs.c; exports.SDK_VERSION = _chunkM3EZNQE5cjs.b; exports.STATUS_POLLING_INTERVAL_MS = _chunkM3EZNQE5cjs.d; exports.WALLETS_SERVICE = _chunkM3EZNQE5cjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkM4PSXLICcjs = require('../chunk-M4PSXLIC.cjs');require('../chunk-XALFCQKD.cjs');exports.SDK_NAME = _chunkM4PSXLICcjs.c; exports.SDK_VERSION = _chunkM4PSXLICcjs.b; exports.STATUS_POLLING_INTERVAL_MS = _chunkM4PSXLICcjs.d; exports.WALLETS_SERVICE = _chunkM4PSXLICcjs.a;
@@ -1 +1 @@
1
- import{a,b,c,d}from"../chunk-AIH4VH3N.js";import"../chunk-BW7YYVZE.js";export{c as SDK_NAME,b as SDK_VERSION,d as STATUS_POLLING_INTERVAL_MS,a as WALLETS_SERVICE};
1
+ import{a,b,c,d}from"../chunk-5UKD6N4G.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 _chunk77UQTNS7cjs = require('../chunk-77UQTNS7.cjs');require('../chunk-7OMPE56G.cjs');require('../chunk-M3EZNQE5.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-6VJEBYPN.cjs');require('../chunk-IR5WN6FQ.cjs');require('../chunk-GEY574TH.cjs');require('../chunk-XALFCQKD.cjs');exports.EVMWallet = _chunk77UQTNS7cjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkEK35EJ7Wcjs = require('../chunk-EK35EJ7W.cjs');require('../chunk-KGL2AM4D.cjs');require('../chunk-M4PSXLIC.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-LTISHXFE.cjs');require('../chunk-IR5WN6FQ.cjs');require('../chunk-GEY574TH.cjs');require('../chunk-XALFCQKD.cjs');exports.EVMWallet = _chunkEK35EJ7Wcjs.a;
@@ -1 +1 @@
1
- import{a}from"../chunk-XP4QXJGR.js";import"../chunk-VRWKCVVK.js";import"../chunk-AIH4VH3N.js";import"../chunk-7ENJXL4H.js";import"../chunk-BJDS5BJG.js";import"../chunk-KKQBZXFE.js";import"../chunk-S3DYQVRD.js";import"../chunk-BW7YYVZE.js";export{a as EVMWallet};
1
+ import{a}from"../chunk-XV2TIRND.js";import"../chunk-ZTYAEP5F.js";import"../chunk-5UKD6N4G.js";import"../chunk-7ENJXL4H.js";import"../chunk-4QU7PZVR.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 _chunkX7Y4HEDKcjs = require('../chunk-X7Y4HEDK.cjs');require('../chunk-7OMPE56G.cjs');require('../chunk-YTAW674L.cjs');require('../chunk-M3EZNQE5.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-XALFCQKD.cjs');exports.SolanaWallet = _chunkX7Y4HEDKcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk4VOZ6LDIcjs = require('../chunk-4VOZ6LDI.cjs');require('../chunk-KGL2AM4D.cjs');require('../chunk-YTAW674L.cjs');require('../chunk-M4PSXLIC.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-XALFCQKD.cjs');exports.SolanaWallet = _chunk4VOZ6LDIcjs.a;
@@ -1 +1 @@
1
- import{a}from"../chunk-XXIW4AEP.js";import"../chunk-VRWKCVVK.js";import"../chunk-SCS4UDW7.js";import"../chunk-AIH4VH3N.js";import"../chunk-7ENJXL4H.js";import"../chunk-BW7YYVZE.js";export{a as SolanaWallet};
1
+ import{a}from"../chunk-R4VZXJ5G.js";import"../chunk-ZTYAEP5F.js";import"../chunk-SCS4UDW7.js";import"../chunk-5UKD6N4G.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 _chunkNAI62DBYcjs = require('../chunk-NAI62DBY.cjs');require('../chunk-7OMPE56G.cjs');require('../chunk-IQB4HWD3.cjs');require('../chunk-3ABHUDKX.cjs');require('../chunk-3HZJR6A3.cjs');require('../chunk-5KA7SYRH.cjs');require('../chunk-MLOSILO2.cjs');require('../chunk-U4S6GWMK.cjs');require('../chunk-YWPTI2QO.cjs');require('../chunk-4KXOWU5E.cjs');require('../chunk-YTAW674L.cjs');require('../chunk-ZSWIQU3U.cjs');require('../chunk-RFK6N7LC.cjs');require('../chunk-M3EZNQE5.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-YZ4HRYSL.cjs');require('../chunk-BULGM35W.cjs');require('../chunk-XALFCQKD.cjs');exports.WalletFactory = _chunkNAI62DBYcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk3SWZYW4Bcjs = require('../chunk-3SWZYW4B.cjs');require('../chunk-KGL2AM4D.cjs');require('../chunk-CQL2S4AX.cjs');require('../chunk-3ABHUDKX.cjs');require('../chunk-3BCOIESI.cjs');require('../chunk-243LSD4S.cjs');require('../chunk-OWDKPU47.cjs');require('../chunk-MQP5VZCA.cjs');require('../chunk-YWPTI2QO.cjs');require('../chunk-4KXOWU5E.cjs');require('../chunk-YTAW674L.cjs');require('../chunk-ZSWIQU3U.cjs');require('../chunk-RFK6N7LC.cjs');require('../chunk-M4PSXLIC.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-YZ4HRYSL.cjs');require('../chunk-BULGM35W.cjs');require('../chunk-XALFCQKD.cjs');exports.WalletFactory = _chunk3SWZYW4Bcjs.a;
@@ -1 +1 @@
1
- import{a}from"../chunk-TXMD64BR.js";import"../chunk-VRWKCVVK.js";import"../chunk-5U4PVNPM.js";import"../chunk-7AFCY47Q.js";import"../chunk-4FM7WA5H.js";import"../chunk-U3KINSXQ.js";import"../chunk-YNIO2LU5.js";import"../chunk-Y5NVCPZ2.js";import"../chunk-UBOWSXW3.js";import"../chunk-IGBQEAD5.js";import"../chunk-SCS4UDW7.js";import"../chunk-M4ELAV7U.js";import"../chunk-IJMFCZIY.js";import"../chunk-AIH4VH3N.js";import"../chunk-7ENJXL4H.js";import"../chunk-LW6JSI4J.js";import"../chunk-5S6YZJHE.js";import"../chunk-BW7YYVZE.js";export{a as WalletFactory};
1
+ import{a}from"../chunk-V5ID6H27.js";import"../chunk-ZTYAEP5F.js";import"../chunk-JMTREPVI.js";import"../chunk-7AFCY47Q.js";import"../chunk-4UVL6FIE.js";import"../chunk-KXFOQTZ2.js";import"../chunk-NP4EN5GQ.js";import"../chunk-JUSY5XEE.js";import"../chunk-UBOWSXW3.js";import"../chunk-IGBQEAD5.js";import"../chunk-SCS4UDW7.js";import"../chunk-M4ELAV7U.js";import"../chunk-IJMFCZIY.js";import"../chunk-5UKD6N4G.js";import"../chunk-7ENJXL4H.js";import"../chunk-LW6JSI4J.js";import"../chunk-5S6YZJHE.js";import"../chunk-BW7YYVZE.js";export{a as WalletFactory};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk7OMPE56Gcjs = require('../chunk-7OMPE56G.cjs');require('../chunk-M3EZNQE5.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-XALFCQKD.cjs');exports.Wallet = _chunk7OMPE56Gcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkKGL2AM4Dcjs = require('../chunk-KGL2AM4D.cjs');require('../chunk-M4PSXLIC.cjs');require('../chunk-CT2UGJEL.cjs');require('../chunk-XALFCQKD.cjs');exports.Wallet = _chunkKGL2AM4Dcjs.a;
@@ -1 +1 @@
1
- import{a}from"../chunk-VRWKCVVK.js";import"../chunk-AIH4VH3N.js";import"../chunk-7ENJXL4H.js";import"../chunk-BW7YYVZE.js";export{a as Wallet};
1
+ import{a}from"../chunk-ZTYAEP5F.js";import"../chunk-5UKD6N4G.js";import"../chunk-7ENJXL4H.js";import"../chunk-BW7YYVZE.js";export{a as Wallet};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crossmint/wallets-sdk",
3
- "version": "0.10.16",
3
+ "version": "0.11.0",
4
4
  "repository": "https://github.com/Crossmint/crossmint-sdk",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Paella Labs Inc",
@@ -25,9 +25,9 @@
25
25
  "ox": "0.6.9",
26
26
  "tweetnacl": "1.0.3",
27
27
  "viem": "2.23.6",
28
- "@crossmint/common-sdk-base": "0.8.5",
28
+ "@crossmint/client-sdk-window": "1.0.3",
29
29
  "@crossmint/client-signers": "0.0.18",
30
- "@crossmint/client-sdk-window": "1.0.2"
30
+ "@crossmint/common-sdk-base": "0.9.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@hey-api/openapi-ts": "0.69.2",
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkIR5WN6FQcjs = require('./chunk-IR5WN6FQ.cjs');var _chunkGEY574THcjs = require('./chunk-GEY574TH.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var _chains = require('viem/chains');var L=[_commonsdkbase.BlockchainIncludingTestnet.BASE_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.POLYGON_AMOY,_commonsdkbase.BlockchainIncludingTestnet.OPTIMISM_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.ARBITRUM_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.STORY_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.MODE_SEPOLIA],C=[_commonsdkbase.BlockchainIncludingTestnet.BASE,_commonsdkbase.BlockchainIncludingTestnet.POLYGON,_commonsdkbase.BlockchainIncludingTestnet.OPTIMISM,_commonsdkbase.BlockchainIncludingTestnet.ARBITRUM,_commonsdkbase.BlockchainIncludingTestnet.STORY,_commonsdkbase.BlockchainIncludingTestnet.MODE,_commonsdkbase.BlockchainIncludingTestnet.BSC,_commonsdkbase.BlockchainIncludingTestnet.SHAPE];function P(t){switch(t){case _commonsdkbase.BlockchainIncludingTestnet.BASE_SEPOLIA:return _chains.baseSepolia;case _commonsdkbase.BlockchainIncludingTestnet.BASE:return _chains.base;case _commonsdkbase.BlockchainIncludingTestnet.POLYGON_AMOY:return _chains.polygonAmoy;case _commonsdkbase.BlockchainIncludingTestnet.POLYGON:return _chains.polygon;case _commonsdkbase.BlockchainIncludingTestnet.OPTIMISM_SEPOLIA:return _chains.optimismSepolia;case _commonsdkbase.BlockchainIncludingTestnet.OPTIMISM:return _chains.optimism;case _commonsdkbase.BlockchainIncludingTestnet.ARBITRUM_SEPOLIA:return _chains.arbitrumSepolia;case _commonsdkbase.BlockchainIncludingTestnet.ARBITRUM:return _chains.arbitrum;case _commonsdkbase.BlockchainIncludingTestnet.STORY_TESTNET:return _chunkGEY574THcjs.a;case _commonsdkbase.BlockchainIncludingTestnet.STORY:return _chunkIR5WN6FQcjs.a;case _commonsdkbase.BlockchainIncludingTestnet.MODE_SEPOLIA:return _chains.modeTestnet;case _commonsdkbase.BlockchainIncludingTestnet.MODE:return _chains.mode;case _commonsdkbase.BlockchainIncludingTestnet.BSC:return _chains.bsc;case _commonsdkbase.BlockchainIncludingTestnet.SHAPE:return _chains.shape;default:throw new Error(`Unknown chain: ${t}`)}}exports.a = P;
@@ -1 +0,0 @@
1
- var s="@crossmint/wallets-sdk",t="0.10.16";var c="WALLETS_SDK",r=t,d=s,a=500;export{c as a,r as b,d as c,a as d};
@@ -1 +0,0 @@
1
- import{a as r}from"./chunk-KKQBZXFE.js";import{a}from"./chunk-S3DYQVRD.js";import{BlockchainIncludingTestnet as e}from"@crossmint/common-sdk-base";import{baseSepolia as n,base as S,polygonAmoy as o,polygon as E,optimismSepolia as M,optimism as T,arbitrumSepolia as i,arbitrum as s,modeTestnet as A,mode as m,bsc as O,shape as p}from"viem/chains";var C=[e.BASE_SEPOLIA,e.POLYGON_AMOY,e.OPTIMISM_SEPOLIA,e.ARBITRUM_SEPOLIA,e.STORY_TESTNET,e.MODE_SEPOLIA],P=[e.BASE,e.POLYGON,e.OPTIMISM,e.ARBITRUM,e.STORY,e.MODE,e.BSC,e.SHAPE];function h(t){switch(t){case e.BASE_SEPOLIA:return n;case e.BASE:return S;case e.POLYGON_AMOY:return o;case e.POLYGON:return E;case e.OPTIMISM_SEPOLIA:return M;case e.OPTIMISM:return T;case e.ARBITRUM_SEPOLIA:return i;case e.ARBITRUM:return s;case e.STORY_TESTNET:return a;case e.STORY:return r;case e.MODE_SEPOLIA:return A;case e.MODE:return m;case e.BSC:return O;case e.SHAPE:return p;default:throw new Error(`Unknown chain: ${t}`)}}export{h as a};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var s="@crossmint/wallets-sdk",t="0.10.16";var p="WALLETS_SDK",c= exports.b =t,r= exports.c =s,d= exports.d =500;exports.a = p; exports.b = c; exports.c = r; exports.d = d;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkU4S6GWMKcjs = require('./chunk-U4S6GWMK.cjs');var _chunkZSWIQU3Ucjs = require('./chunk-ZSWIQU3U.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var d=class{constructor(t){this.config=t;this._needsAuth=!0;this._authPromise=null;this.initialize(),this.type=this.config.type}initialize(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(this.config.clientTEEConnection==null){let t=_commonsdkbase.validateAPIKey.call(void 0, this.config.crossmint.apiKey);if(!t.isValid)throw new Error("Invalid API key");let r=new (0, _chunkU4S6GWMKcjs.a)({environment:t.environment});this.config.clientTEEConnection=yield r.initialize()}})}handleAuthRequired(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var o,s,a;if(this.config.clientTEEConnection==null)throw new Error("Handshake parent not initialized");let t=yield(a=this.config.clientTEEConnection)==null?void 0:a.sendAction({event:"request:get-status",responseEvent:"response:get-status",data:{authData:{jwt:(s=(o=this.config.crossmint.experimental_customAuth)==null?void 0:o.jwt)!=null?s:"",apiKey:this.config.crossmint.apiKey}},options:h});if((t==null?void 0:t.status)!=="success")throw new Error(t==null?void 0:t.error);if(t.signerStatus==="ready"){this._needsAuth=!1;return}let{promise:r,resolve:i,reject:n}=this.createAuthPromise();if(this._authPromise={promise:r,resolve:i,reject:n},this.config.onAuthRequired)try{yield this.config.onAuthRequired(this._needsAuth,()=>this.sendMessageWithOtp(),e=>this.verifyOtp(e),()=>n(new _chunkZSWIQU3Ucjs.a))}catch(e){n(e)}try{yield r}catch(e){throw e}})}getJwtOrThrow(){var r;let t=(r=this.config.crossmint.experimental_customAuth)==null?void 0:r.jwt;if(t==null)throw new Error("JWT is required");return t}createAuthPromise(){let t,r;return{promise:new Promise((n,o)=>{t=n,r=o}),resolve:t,reject:r}}sendMessageWithOtp(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var n,o,s;if(this.config.clientTEEConnection==null)throw new Error("Handshake parent not initialized");let t=this.config.clientTEEConnection,r=this.getAuthId(),i=yield t.sendAction({event:"request:start-onboarding",responseEvent:"response:start-onboarding",data:{authData:{jwt:(o=(n=this.config.crossmint.experimental_customAuth)==null?void 0:n.jwt)!=null?o:"",apiKey:this.config.crossmint.apiKey},data:{authId:r}},options:h});if((i==null?void 0:i.status)==="success"&&i.signerStatus==="ready"){this._needsAuth=!1;return}(i==null?void 0:i.status)==="error"&&(console.error("[sendMessageWithOtp] Failed to send OTP:",i),(s=this._authPromise)==null||s.reject(new Error(i.error||"Failed to initiate OTP process.")))})}getAuthId(){return this.config.type==="email"?`email:${this.config.email}`:`phone:${this.config.phone}`}verifyOtp(t){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var i,n,o,s,a;if(this.config.clientTEEConnection==null)throw new Error("Handshake parent not initialized");let r=this.config.clientTEEConnection;try{let e=yield r.sendAction({event:"request:complete-onboarding",responseEvent:"response:complete-onboarding",data:{authData:{jwt:(n=(i=this.config.crossmint.experimental_customAuth)==null?void 0:i.jwt)!=null?n:"",apiKey:this.config.crossmint.apiKey},data:{onboardingAuthentication:{encryptedOtp:t}}},options:h});if((e==null?void 0:e.status)==="success"){this._needsAuth=!1,(o=this._authPromise)==null||o.resolve();return}console.error("[verifyOtp] Failed to validate OTP:",e),this._needsAuth=!0;let g=(e==null?void 0:e.status)==="error"?e.error:"Failed to validate encrypted OTP";(s=this._authPromise)==null||s.reject(new Error(g))}catch(e){throw console.error("[verifyOtp] Error sending OTP validation request:",e),this._needsAuth=!0,(a=this._authPromise)==null||a.reject(e),e}})}},h= exports.b ={timeoutMs:1e4,intervalMs:5e3};exports.a = d; exports.b = h;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk7OMPE56Gcjs = require('./chunk-7OMPE56G.cjs');var _chunkIQB4HWD3cjs = require('./chunk-IQB4HWD3.cjs');var _chunkRFK6N7LCcjs = require('./chunk-RFK6N7LC.cjs');var _chunkCT2UGJELcjs = require('./chunk-CT2UGJEL.cjs');var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _ox = require('ox');var S=class{constructor(e){this.apiClient=e}getOrCreateWallet(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(this.apiClient.isServerSide)throw new (0, _chunkCT2UGJELcjs.f)("getOrCreateWallet is not supported on server side");let i=yield this.apiClient.getWallet(`me:${e.chain==="solana"?"solana":"evm"}:smart`);return i!=null&&!("error"in i)?this.createWalletInstance(i,e):this.createWallet(e)})}getWallet(e,i){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(!this.apiClient.isServerSide)throw new (0, _chunkCT2UGJELcjs.f)("getWallet is not supported on client side, use getOrCreateWallet instead");let n=yield this.apiClient.getWallet(e);if("error"in n)throw new (0, _chunkCT2UGJELcjs.d)(JSON.stringify(n));return this.createWalletInstance(n,i)})}createWallet(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var t,r,o,l;yield(o=(r=(t=e.options)==null?void 0:t.experimental_callbacks)==null?void 0:r.onWalletCreationStart)==null?void 0:o.call(r),this.mutateSignerFromCustomAuth(e,!0);let i=e.signer.type==="passkey"?yield this.createPasskeyAdminSigner(e.signer):e.signer,n=yield this.apiClient.createWallet({type:"smart",chainType:e.chain==="solana"?"solana":"evm",config:{adminSigner:i},owner:(l=e.owner)!=null?l:void 0});if("error"in n)throw new (0, _chunkCT2UGJELcjs.f)(JSON.stringify(n));return this.createWalletInstance(n,e)})}createWalletInstance(e,i){this.validateExistingWalletConfig(e,i);let n=this.toInternalSignerConfig(e,i.signer,i.options);return new (0, _chunk7OMPE56Gcjs.a)({chain:i.chain,address:e.address,owner:e.owner,signer:_chunkIQB4HWD3cjs.a.call(void 0, i.chain,n),options:i.options},this.apiClient)}toInternalSignerConfig(e,i,n){var t,r,o,l,p,g;if(!(e.chainType==="evm"||e.chainType==="solana"))throw new (0, _chunkCT2UGJELcjs.f)(`Wallet type ${e.chainType} is not supported`);if(i==null&&((t=e.config)==null?void 0:t.adminSigner)==null)throw new (0, _chunkCT2UGJELcjs.f)("Signer is required to create a wallet");switch(i.type){case"api-key":{if(((r=e.config)==null?void 0:r.adminSigner.type)!=="api-key")throw new (0, _chunkCT2UGJELcjs.f)("API key signer does not match the wallet's signer type");return{type:"api-key",address:e.config.adminSigner.address,locator:e.config.adminSigner.locator}}case"external-wallet":if(((o=e.config)==null?void 0:o.adminSigner.type)!=="external-wallet")throw new (0, _chunkCT2UGJELcjs.f)("External wallet signer does not match the wallet's signer type");return _chunkXALFCQKDcjs.a.call(void 0, _chunkXALFCQKDcjs.a.call(void 0, {},e.config.adminSigner),i);case"passkey":if(((l=e.config)==null?void 0:l.adminSigner.type)!=="passkey")throw new (0, _chunkCT2UGJELcjs.f)("Passkey signer does not match the wallet's signer type");return{type:"passkey",id:e.config.adminSigner.id,name:e.config.adminSigner.name,locator:e.config.adminSigner.locator,onCreatePasskey:i.onCreatePasskey,onSignWithPasskey:i.onSignWithPasskey};case"email":{if(((p=e.config)==null?void 0:p.adminSigner.type)!=="email")throw new (0, _chunkCT2UGJELcjs.f)("Email signer does not match the wallet's signer type");let{locator:c,email:h}=e.config.adminSigner;return{type:"email",email:h,locator:c,crossmint:this.apiClient.crossmint,onAuthRequired:i.onAuthRequired,clientTEEConnection:n==null?void 0:n.clientTEEConnection}}case"phone":{if(((g=e.config)==null?void 0:g.adminSigner.type)!=="phone")throw new (0, _chunkCT2UGJELcjs.f)("Phone signer does not match the wallet's signer type");let{locator:c,phone:h}=e.config.adminSigner;return{type:"phone",phone:h,locator:c,crossmint:this.apiClient.crossmint,onAuthRequired:i.onAuthRequired,clientTEEConnection:n==null?void 0:n.clientTEEConnection}}default:throw new Error("Invalid signer type")}}createPasskeyAdminSigner(e){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){var t;if(e.type!=="passkey")throw new Error("Signer is not a passkey");let i=(t=e.name)!=null?t:`Crossmint Wallet ${Date.now()}`,n=e.onCreatePasskey?yield e.onCreatePasskey(i):yield _ox.WebAuthnP256.createCredential({name:i});return{type:"passkey",id:n.id,name:i,publicKey:{x:n.publicKey.x.toString(),y:n.publicKey.y.toString()}}})}mutateSignerFromCustomAuth(e,i=!1){var t,r;let{experimental_customAuth:n}=this.apiClient.crossmint;e.signer.type==="email"&&(n==null?void 0:n.email)!=null&&(e.signer.email=(t=e.signer.email)!=null?t:n.email),e.signer.type==="phone"&&(n==null?void 0:n.phone)!=null&&(e.signer.phone=(r=e.signer.phone)!=null?r:n.phone),e.signer.type==="external-wallet"&&(n==null?void 0:n.externalWalletSigner)!=null&&(e.signer=i?{type:"external-wallet",address:n.externalWalletSigner.address}:n.externalWalletSigner)}validateExistingWalletConfig(e,i){var r;if(this.mutateSignerFromCustomAuth(i),i.owner!=null&&e.owner!=null&&i.owner!==e.owner)throw new (0, _chunkCT2UGJELcjs.f)("Wallet owner does not match existing wallet's linked user");if(i.chain==="solana"&&e.chainType!=="solana"||i.chain!=="solana"&&e.chainType==="solana")throw new (0, _chunkCT2UGJELcjs.f)(`Wallet chain does not match existing wallet's chain. You must use chain: ${e.chainType}.`);if(e.type!=="smart")return;let n=i.signer,t=(r=e==null?void 0:e.config)==null?void 0:r.adminSigner;if(n!=null&&t!=null){if(n.type!==t.type)throw new (0, _chunkCT2UGJELcjs.f)("The wallet signer type provided in the wallet config does not match the existing wallet's adminSigner type");_chunkRFK6N7LCcjs.a.call(void 0, n,t)}}};exports.a = S;
@@ -1 +0,0 @@
1
- import{a as d}from"./chunk-VRWKCVVK.js";import{a as y}from"./chunk-5U4PVNPM.js";import{a as f}from"./chunk-IJMFCZIY.js";import{d as C,f as a}from"./chunk-7ENJXL4H.js";import{a as m,f as s}from"./chunk-BW7YYVZE.js";import{WebAuthnP256 as u}from"ox";var S=class{constructor(e){this.apiClient=e}getOrCreateWallet(e){return s(this,null,function*(){if(this.apiClient.isServerSide)throw new a("getOrCreateWallet is not supported on server side");let i=yield this.apiClient.getWallet(`me:${e.chain==="solana"?"solana":"evm"}:smart`);return i!=null&&!("error"in i)?this.createWalletInstance(i,e):this.createWallet(e)})}getWallet(e,i){return s(this,null,function*(){if(!this.apiClient.isServerSide)throw new a("getWallet is not supported on client side, use getOrCreateWallet instead");let n=yield this.apiClient.getWallet(e);if("error"in n)throw new C(JSON.stringify(n));return this.createWalletInstance(n,i)})}createWallet(e){return s(this,null,function*(){var t,r,o,l;yield(o=(r=(t=e.options)==null?void 0:t.experimental_callbacks)==null?void 0:r.onWalletCreationStart)==null?void 0:o.call(r),this.mutateSignerFromCustomAuth(e,!0);let i=e.signer.type==="passkey"?yield this.createPasskeyAdminSigner(e.signer):e.signer,n=yield this.apiClient.createWallet({type:"smart",chainType:e.chain==="solana"?"solana":"evm",config:{adminSigner:i},owner:(l=e.owner)!=null?l:void 0});if("error"in n)throw new a(JSON.stringify(n));return this.createWalletInstance(n,e)})}createWalletInstance(e,i){this.validateExistingWalletConfig(e,i);let n=this.toInternalSignerConfig(e,i.signer,i.options);return new d({chain:i.chain,address:e.address,owner:e.owner,signer:y(i.chain,n),options:i.options},this.apiClient)}toInternalSignerConfig(e,i,n){var t,r,o,l,p,g;if(!(e.chainType==="evm"||e.chainType==="solana"))throw new a(`Wallet type ${e.chainType} is not supported`);if(i==null&&((t=e.config)==null?void 0:t.adminSigner)==null)throw new a("Signer is required to create a wallet");switch(i.type){case"api-key":{if(((r=e.config)==null?void 0:r.adminSigner.type)!=="api-key")throw new a("API key signer does not match the wallet's signer type");return{type:"api-key",address:e.config.adminSigner.address,locator:e.config.adminSigner.locator}}case"external-wallet":if(((o=e.config)==null?void 0:o.adminSigner.type)!=="external-wallet")throw new a("External wallet signer does not match the wallet's signer type");return m(m({},e.config.adminSigner),i);case"passkey":if(((l=e.config)==null?void 0:l.adminSigner.type)!=="passkey")throw new a("Passkey signer does not match the wallet's signer type");return{type:"passkey",id:e.config.adminSigner.id,name:e.config.adminSigner.name,locator:e.config.adminSigner.locator,onCreatePasskey:i.onCreatePasskey,onSignWithPasskey:i.onSignWithPasskey};case"email":{if(((p=e.config)==null?void 0:p.adminSigner.type)!=="email")throw new a("Email signer does not match the wallet's signer type");let{locator:c,email:h}=e.config.adminSigner;return{type:"email",email:h,locator:c,crossmint:this.apiClient.crossmint,onAuthRequired:i.onAuthRequired,clientTEEConnection:n==null?void 0:n.clientTEEConnection}}case"phone":{if(((g=e.config)==null?void 0:g.adminSigner.type)!=="phone")throw new a("Phone signer does not match the wallet's signer type");let{locator:c,phone:h}=e.config.adminSigner;return{type:"phone",phone:h,locator:c,crossmint:this.apiClient.crossmint,onAuthRequired:i.onAuthRequired,clientTEEConnection:n==null?void 0:n.clientTEEConnection}}default:throw new Error("Invalid signer type")}}createPasskeyAdminSigner(e){return s(this,null,function*(){var t;if(e.type!=="passkey")throw new Error("Signer is not a passkey");let i=(t=e.name)!=null?t:`Crossmint Wallet ${Date.now()}`,n=e.onCreatePasskey?yield e.onCreatePasskey(i):yield u.createCredential({name:i});return{type:"passkey",id:n.id,name:i,publicKey:{x:n.publicKey.x.toString(),y:n.publicKey.y.toString()}}})}mutateSignerFromCustomAuth(e,i=!1){var t,r;let{experimental_customAuth:n}=this.apiClient.crossmint;e.signer.type==="email"&&(n==null?void 0:n.email)!=null&&(e.signer.email=(t=e.signer.email)!=null?t:n.email),e.signer.type==="phone"&&(n==null?void 0:n.phone)!=null&&(e.signer.phone=(r=e.signer.phone)!=null?r:n.phone),e.signer.type==="external-wallet"&&(n==null?void 0:n.externalWalletSigner)!=null&&(e.signer=i?{type:"external-wallet",address:n.externalWalletSigner.address}:n.externalWalletSigner)}validateExistingWalletConfig(e,i){var r;if(this.mutateSignerFromCustomAuth(i),i.owner!=null&&e.owner!=null&&i.owner!==e.owner)throw new a("Wallet owner does not match existing wallet's linked user");if(i.chain==="solana"&&e.chainType!=="solana"||i.chain!=="solana"&&e.chainType==="solana")throw new a(`Wallet chain does not match existing wallet's chain. You must use chain: ${e.chainType}.`);if(e.type!=="smart")return;let n=i.signer,t=(r=e==null?void 0:e.config)==null?void 0:r.adminSigner;if(n!=null&&t!=null){if(n.type!==t.type)throw new a("The wallet signer type provided in the wallet config does not match the existing wallet's adminSigner type");f(n,t)}}};export{S as a};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkXALFCQKDcjs = require('./chunk-XALFCQKD.cjs');var _clientsdkwindow = require('@crossmint/client-sdk-window');var _clientsigners = require('@crossmint/client-signers');var i=class{constructor(n){this.config=n;this.handshakeParent=null}initialize(){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){if(this.handshakeParent)return this.handshakeParent;let n=new URL(_clientsigners.environmentUrlConfig[this.config.environment]);n.searchParams.set("targetOrigin",window.location.origin);let e=yield this.createInvisibleIFrame(n.toString());return this.handshakeParent=yield _clientsdkwindow.IFrameWindow.init(e,{targetOrigin:n.origin,incomingEvents:_clientsigners.signerOutboundEvents,outgoingEvents:_clientsigners.signerInboundEvents}),yield this.handshakeParent.handshakeWithChild(),this.handshakeParent})}createInvisibleIFrame(n){return _chunkXALFCQKDcjs.f.call(void 0, this,null,function*(){let e=document.createElement("iframe");return e.src=n,Object.assign(e.style,{position:"absolute",opacity:"0",pointerEvents:"none",width:"0",height:"0",border:"none",top:"-9999px",left:"-9999px"}),new Promise((r,o)=>{e.onload=()=>r(e),e.onerror=()=>o(new Error("Failed to load iframe content")),document.body.appendChild(e)})})}};exports.a = i;
@@ -1 +0,0 @@
1
- import{f as t}from"./chunk-BW7YYVZE.js";import{IFrameWindow as a}from"@crossmint/client-sdk-window";import{environmentUrlConfig as s,signerInboundEvents as m,signerOutboundEvents as h}from"@crossmint/client-signers";var i=class{constructor(n){this.config=n;this.handshakeParent=null}initialize(){return t(this,null,function*(){if(this.handshakeParent)return this.handshakeParent;let n=new URL(s[this.config.environment]);n.searchParams.set("targetOrigin",window.location.origin);let e=yield this.createInvisibleIFrame(n.toString());return this.handshakeParent=yield a.init(e,{targetOrigin:n.origin,incomingEvents:h,outgoingEvents:m}),yield this.handshakeParent.handshakeWithChild(),this.handshakeParent})}createInvisibleIFrame(n){return t(this,null,function*(){let e=document.createElement("iframe");return e.src=n,Object.assign(e.style,{position:"absolute",opacity:"0",pointerEvents:"none",width:"0",height:"0",border:"none",top:"-9999px",left:"-9999px"}),new Promise((r,o)=>{e.onload=()=>r(e),e.onerror=()=>o(new Error("Failed to load iframe content")),document.body.appendChild(e)})})}};export{i as a};
@@ -1 +0,0 @@
1
- import{a as u}from"./chunk-Y5NVCPZ2.js";import{a as l}from"./chunk-M4ELAV7U.js";import{f as c}from"./chunk-BW7YYVZE.js";import{validateAPIKey as m}from"@crossmint/common-sdk-base";var d=class{constructor(t){this.config=t;this._needsAuth=!0;this._authPromise=null;this.initialize(),this.type=this.config.type}initialize(){return c(this,null,function*(){if(this.config.clientTEEConnection==null){let t=m(this.config.crossmint.apiKey);if(!t.isValid)throw new Error("Invalid API key");let r=new u({environment:t.environment});this.config.clientTEEConnection=yield r.initialize()}})}handleAuthRequired(){return c(this,null,function*(){var o,s,a;if(this.config.clientTEEConnection==null)throw new Error("Handshake parent not initialized");let t=yield(a=this.config.clientTEEConnection)==null?void 0:a.sendAction({event:"request:get-status",responseEvent:"response:get-status",data:{authData:{jwt:(s=(o=this.config.crossmint.experimental_customAuth)==null?void 0:o.jwt)!=null?s:"",apiKey:this.config.crossmint.apiKey}},options:h});if((t==null?void 0:t.status)!=="success")throw new Error(t==null?void 0:t.error);if(t.signerStatus==="ready"){this._needsAuth=!1;return}let{promise:r,resolve:i,reject:n}=this.createAuthPromise();if(this._authPromise={promise:r,resolve:i,reject:n},this.config.onAuthRequired)try{yield this.config.onAuthRequired(this._needsAuth,()=>this.sendMessageWithOtp(),e=>this.verifyOtp(e),()=>n(new l))}catch(e){n(e)}try{yield r}catch(e){throw e}})}getJwtOrThrow(){var r;let t=(r=this.config.crossmint.experimental_customAuth)==null?void 0:r.jwt;if(t==null)throw new Error("JWT is required");return t}createAuthPromise(){let t,r;return{promise:new Promise((n,o)=>{t=n,r=o}),resolve:t,reject:r}}sendMessageWithOtp(){return c(this,null,function*(){var n,o,s;if(this.config.clientTEEConnection==null)throw new Error("Handshake parent not initialized");let t=this.config.clientTEEConnection,r=this.getAuthId(),i=yield t.sendAction({event:"request:start-onboarding",responseEvent:"response:start-onboarding",data:{authData:{jwt:(o=(n=this.config.crossmint.experimental_customAuth)==null?void 0:n.jwt)!=null?o:"",apiKey:this.config.crossmint.apiKey},data:{authId:r}},options:h});if((i==null?void 0:i.status)==="success"&&i.signerStatus==="ready"){this._needsAuth=!1;return}(i==null?void 0:i.status)==="error"&&(console.error("[sendMessageWithOtp] Failed to send OTP:",i),(s=this._authPromise)==null||s.reject(new Error(i.error||"Failed to initiate OTP process.")))})}getAuthId(){return this.config.type==="email"?`email:${this.config.email}`:`phone:${this.config.phone}`}verifyOtp(t){return c(this,null,function*(){var i,n,o,s,a;if(this.config.clientTEEConnection==null)throw new Error("Handshake parent not initialized");let r=this.config.clientTEEConnection;try{let e=yield r.sendAction({event:"request:complete-onboarding",responseEvent:"response:complete-onboarding",data:{authData:{jwt:(n=(i=this.config.crossmint.experimental_customAuth)==null?void 0:i.jwt)!=null?n:"",apiKey:this.config.crossmint.apiKey},data:{onboardingAuthentication:{encryptedOtp:t}}},options:h});if((e==null?void 0:e.status)==="success"){this._needsAuth=!1,(o=this._authPromise)==null||o.resolve();return}console.error("[verifyOtp] Failed to validate OTP:",e),this._needsAuth=!0;let g=(e==null?void 0:e.status)==="error"?e.error:"Failed to validate encrypted OTP";(s=this._authPromise)==null||s.reject(new Error(g))}catch(e){throw console.error("[verifyOtp] Error sending OTP validation request:",e),this._needsAuth=!0,(a=this._authPromise)==null||a.reject(e),e}})}},h={timeoutMs:1e4,intervalMs:5e3};export{d as a,h as b};