@crossmint/wallets-sdk 0.18.14 → 0.19.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 (99) hide show
  1. package/dist/api/__tests__/constants.cjs +31 -0
  2. package/dist/api/__tests__/constants.d.cts +96 -0
  3. package/dist/api/__tests__/constants.d.ts +96 -0
  4. package/dist/api/__tests__/constants.js +31 -0
  5. package/dist/api/__tests__/test-utils.cjs +372 -0
  6. package/dist/api/__tests__/test-utils.d.cts +99 -0
  7. package/dist/api/__tests__/test-utils.d.ts +99 -0
  8. package/dist/api/__tests__/test-utils.js +372 -0
  9. package/dist/api/client.cjs +4 -4
  10. package/dist/api/client.js +3 -3
  11. package/dist/api/gen/types.gen.d.cts +8 -0
  12. package/dist/api/gen/types.gen.d.ts +8 -0
  13. package/dist/api/index.cjs +4 -4
  14. package/dist/api/index.js +3 -3
  15. package/dist/chains/chains.cjs +8 -4
  16. package/dist/chains/chains.d.cts +3 -1
  17. package/dist/chains/chains.d.ts +3 -1
  18. package/dist/chains/chains.js +7 -3
  19. package/dist/{chunk-AAESOWQL.js → chunk-57HPJVTI.js} +8 -3
  20. package/dist/{chunk-ADCODBBF.cjs → chunk-5CBGJLA4.cjs} +1 -1
  21. package/dist/{chunk-CEFMURL3.js → chunk-6EP3PLGP.js} +2 -2
  22. package/dist/{chunk-ZJZO6LQ3.js → chunk-7EZZGCYI.js} +10 -1
  23. package/dist/{chunk-THLRRDVV.js → chunk-7NKX266V.js} +39 -5
  24. package/dist/{chunk-5CTWIW7X.js → chunk-BBYNVHFR.js} +3 -3
  25. package/dist/{chunk-PUXRHELK.cjs → chunk-C5F6IECX.cjs} +12 -12
  26. package/dist/{chunk-GROJZ247.cjs → chunk-DIM3X4IX.cjs} +13 -5
  27. package/dist/{chunk-OPKBL6A2.cjs → chunk-EIZVQAZO.cjs} +54 -20
  28. package/dist/{chunk-VJ2ZKU3R.js → chunk-ETCH6L2Y.js} +5 -5
  29. package/dist/{chunk-SWPJZ5JX.cjs → chunk-FQV77LH4.cjs} +3 -3
  30. package/dist/chunk-G6QJHFSY.cjs +74 -0
  31. package/dist/{chunk-FV4PV7HU.cjs → chunk-JLW3Q65G.cjs} +6 -6
  32. package/dist/{chunk-FUMQWMQR.cjs → chunk-JZQYCISB.cjs} +9 -9
  33. package/dist/{chunk-SEGDDAL2.js → chunk-KE6LX37B.js} +1 -1
  34. package/dist/{chunk-3PI54IUS.js → chunk-L5IMC3NM.js} +2 -2
  35. package/dist/{chunk-KIS2P5DM.js → chunk-N65K6TUY.js} +10 -1
  36. package/dist/{chunk-PST7R25G.cjs → chunk-NXST74TX.cjs} +80 -43
  37. package/dist/chunk-PJOJIRTY.js +74 -0
  38. package/dist/{chunk-SGKMU5NX.cjs → chunk-REP547HH.cjs} +36 -13
  39. package/dist/{chunk-B24CPC6Y.js → chunk-S2AKC2CK.js} +1 -1
  40. package/dist/{chunk-PCZDMOJH.js → chunk-SUJQZWLJ.js} +2 -2
  41. package/dist/{chunk-BEJB6ZUK.cjs → chunk-TCNXKNBQ.cjs} +7 -7
  42. package/dist/{chunk-5TYDRD6D.cjs → chunk-VNPL3HFN.cjs} +12 -3
  43. package/dist/{chunk-G7TC2YMQ.cjs → chunk-VWENCGQO.cjs} +12 -3
  44. package/dist/{chunk-LKAE7D7W.js → chunk-W3OYA42M.js} +32 -9
  45. package/dist/{chunk-ZQACPBUW.js → chunk-XEZBA7I2.js} +58 -21
  46. package/dist/{chunk-5WJE5X7V.cjs → chunk-XQSMZXBR.cjs} +28 -23
  47. package/dist/{chunk-NJTKHWXR.js → chunk-XSMIDXUA.js} +15 -7
  48. package/dist/{chunk-UWKMOJ4D.js → chunk-YF4DYTBM.js} +10 -1
  49. package/dist/{chunk-2RVPHSR5.cjs → chunk-YFOUZXSM.cjs} +12 -3
  50. package/dist/{chunk-SB5FTFPM.cjs → chunk-YXFIZNFL.cjs} +9 -9
  51. package/dist/index.cjs +18 -18
  52. package/dist/index.js +17 -17
  53. package/dist/logger/index.cjs +3 -3
  54. package/dist/logger/index.js +2 -2
  55. package/dist/logger/init.cjs +3 -3
  56. package/dist/logger/init.js +2 -2
  57. package/dist/sdk.cjs +17 -12
  58. package/dist/sdk.js +16 -11
  59. package/dist/signers/index.cjs +8 -8
  60. package/dist/signers/index.js +7 -7
  61. package/dist/signers/non-custodial/index.cjs +7 -7
  62. package/dist/signers/non-custodial/index.js +8 -8
  63. package/dist/signers/non-custodial/ncs-evm-signer.cjs +5 -5
  64. package/dist/signers/non-custodial/ncs-evm-signer.js +4 -4
  65. package/dist/signers/non-custodial/ncs-signer.cjs +4 -4
  66. package/dist/signers/non-custodial/ncs-signer.js +3 -3
  67. package/dist/signers/non-custodial/ncs-solana-signer.cjs +5 -5
  68. package/dist/signers/non-custodial/ncs-solana-signer.js +4 -4
  69. package/dist/signers/non-custodial/ncs-stellar-signer.cjs +5 -5
  70. package/dist/signers/non-custodial/ncs-stellar-signer.js +4 -4
  71. package/dist/utils/constants.cjs +2 -2
  72. package/dist/utils/constants.js +1 -1
  73. package/dist/wallets/__tests__/test-helpers.cjs +10 -8
  74. package/dist/wallets/__tests__/test-helpers.d.cts +2 -1
  75. package/dist/wallets/__tests__/test-helpers.d.ts +2 -1
  76. package/dist/wallets/__tests__/test-helpers.js +9 -7
  77. package/dist/wallets/evm.cjs +12 -12
  78. package/dist/wallets/evm.d.cts +20 -0
  79. package/dist/wallets/evm.d.ts +20 -0
  80. package/dist/wallets/evm.js +11 -11
  81. package/dist/wallets/solana.cjs +9 -9
  82. package/dist/wallets/solana.d.cts +5 -0
  83. package/dist/wallets/solana.d.ts +5 -0
  84. package/dist/wallets/solana.js +8 -8
  85. package/dist/wallets/stellar.cjs +9 -9
  86. package/dist/wallets/stellar.d.cts +5 -0
  87. package/dist/wallets/stellar.d.ts +5 -0
  88. package/dist/wallets/stellar.js +8 -8
  89. package/dist/wallets/types.d.cts +5 -1
  90. package/dist/wallets/types.d.ts +5 -1
  91. package/dist/wallets/wallet-factory.cjs +15 -10
  92. package/dist/wallets/wallet-factory.d.cts +2 -0
  93. package/dist/wallets/wallet-factory.d.ts +2 -0
  94. package/dist/wallets/wallet-factory.js +14 -9
  95. package/dist/wallets/wallet.cjs +8 -8
  96. package/dist/wallets/wallet.d.cts +6 -2
  97. package/dist/wallets/wallet.d.ts +6 -2
  98. package/dist/wallets/wallet.js +7 -7
  99. package/package.json +4 -4
package/dist/api/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import "../chunk-5IFDVB4Y.js";
2
2
  import {
3
3
  ApiClient
4
- } from "../chunk-CEFMURL3.js";
4
+ } from "../chunk-6EP3PLGP.js";
5
5
  import "../chunk-SGINWAB6.js";
6
6
  import "../chunk-KBJA7JDT.js";
7
- import "../chunk-B24CPC6Y.js";
8
- import "../chunk-SEGDDAL2.js";
7
+ import "../chunk-S2AKC2CK.js";
8
+ import "../chunk-KE6LX37B.js";
9
9
  import "../chunk-ASE2FXWP.js";
10
10
  export {
11
11
  ApiClient
@@ -1,11 +1,15 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkGROJZ247cjs = require('../chunk-GROJZ247.cjs');
4
- require('../chunk-6H6ZBJC2.cjs');
5
- require('../chunk-HTSQPZHW.cjs');
3
+
4
+
5
+ var _chunkDIM3X4IXcjs = require('../chunk-DIM3X4IX.cjs');
6
6
  require('../chunk-NIBKCMQ2.cjs');
7
7
  require('../chunk-55V4VMTX.cjs');
8
+ require('../chunk-6H6ZBJC2.cjs');
9
+ require('../chunk-HTSQPZHW.cjs');
8
10
  require('../chunk-UO2J2ZB2.cjs');
9
11
 
10
12
 
11
- exports.toViemChain = _chunkGROJZ247cjs.toViemChain;
13
+
14
+
15
+ exports.isMainnetChain = _chunkDIM3X4IXcjs.isMainnetChain; exports.isTestnetChain = _chunkDIM3X4IXcjs.isTestnetChain; exports.toViemChain = _chunkDIM3X4IXcjs.toViemChain;
@@ -10,5 +10,7 @@ type SolanaChain = "solana";
10
10
  type StellarChain = "stellar";
11
11
  type EVMChain = EVMSmartWalletChain;
12
12
  type Chain = SolanaChain | EVMChain | StellarChain;
13
+ declare function isTestnetChain(chain: EVMSmartWalletChain): chain is EVMSmartWalletTestnet;
14
+ declare function isMainnetChain(chain: EVMSmartWalletChain): chain is EVMSmartWalletMainnet;
13
15
 
14
- export { type Chain, type EVMChain, type EVMSmartWalletChain, type EVMSmartWalletMainnet, type EVMSmartWalletTestnet, type SolanaChain, type StellarChain, toViemChain };
16
+ export { type Chain, type EVMChain, type EVMSmartWalletChain, type EVMSmartWalletMainnet, type EVMSmartWalletTestnet, type SolanaChain, type StellarChain, isMainnetChain, isTestnetChain, toViemChain };
@@ -10,5 +10,7 @@ type SolanaChain = "solana";
10
10
  type StellarChain = "stellar";
11
11
  type EVMChain = EVMSmartWalletChain;
12
12
  type Chain = SolanaChain | EVMChain | StellarChain;
13
+ declare function isTestnetChain(chain: EVMSmartWalletChain): chain is EVMSmartWalletTestnet;
14
+ declare function isMainnetChain(chain: EVMSmartWalletChain): chain is EVMSmartWalletMainnet;
13
15
 
14
- export { type Chain, type EVMChain, type EVMSmartWalletChain, type EVMSmartWalletMainnet, type EVMSmartWalletTestnet, type SolanaChain, type StellarChain, toViemChain };
16
+ export { type Chain, type EVMChain, type EVMSmartWalletChain, type EVMSmartWalletMainnet, type EVMSmartWalletTestnet, type SolanaChain, type StellarChain, isMainnetChain, isTestnetChain, toViemChain };
@@ -1,11 +1,15 @@
1
1
  import {
2
+ isMainnetChain,
3
+ isTestnetChain,
2
4
  toViemChain
3
- } from "../chunk-NJTKHWXR.js";
4
- import "../chunk-IZJUOXOZ.js";
5
- import "../chunk-ZBLW42YE.js";
5
+ } from "../chunk-XSMIDXUA.js";
6
6
  import "../chunk-2T5HHKUI.js";
7
7
  import "../chunk-3U6UAYOV.js";
8
+ import "../chunk-IZJUOXOZ.js";
9
+ import "../chunk-ZBLW42YE.js";
8
10
  import "../chunk-ASE2FXWP.js";
9
11
  export {
12
+ isMainnetChain,
13
+ isTestnetChain,
10
14
  toViemChain
11
15
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Wallet
3
- } from "./chunk-ZQACPBUW.js";
3
+ } from "./chunk-XEZBA7I2.js";
4
4
  import {
5
5
  InvalidTypedDataError,
6
6
  SignatureNotCreatedError,
@@ -8,10 +8,10 @@ import {
8
8
  } from "./chunk-SGINWAB6.js";
9
9
  import {
10
10
  toViemChain
11
- } from "./chunk-NJTKHWXR.js";
11
+ } from "./chunk-XSMIDXUA.js";
12
12
  import {
13
13
  walletsLogger
14
- } from "./chunk-B24CPC6Y.js";
14
+ } from "./chunk-S2AKC2CK.js";
15
15
  import {
16
16
  __async,
17
17
  __decorateClass
@@ -148,6 +148,11 @@ var _EVMWallet = class _EVMWallet extends Wallet {
148
148
  return result;
149
149
  });
150
150
  }
151
+ /**
152
+ * Get a Viem public client instance configured for this wallet's chain.
153
+ * @param params - Optional transport configuration
154
+ * @returns A Viem public client
155
+ */
151
156
  getViemClient(params) {
152
157
  var _a;
153
158
  return createPublicClient({
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});// package.json
2
2
  var name = "@crossmint/wallets-sdk";
3
- var version = "0.18.14";
3
+ var version = "0.19.0";
4
4
 
5
5
  // src/utils/constants.ts
6
6
  var WALLETS_SERVICE = "WALLETS_SDK";
@@ -3,11 +3,11 @@ import {
3
3
  } from "./chunk-SGINWAB6.js";
4
4
  import {
5
5
  walletsLogger
6
- } from "./chunk-B24CPC6Y.js";
6
+ } from "./chunk-S2AKC2CK.js";
7
7
  import {
8
8
  SDK_NAME,
9
9
  SDK_VERSION
10
- } from "./chunk-SEGDDAL2.js";
10
+ } from "./chunk-KE6LX37B.js";
11
11
  import {
12
12
  __async
13
13
  } from "./chunk-ASE2FXWP.js";
@@ -1,7 +1,10 @@
1
1
  import {
2
2
  DEFAULT_EVENT_OPTIONS,
3
3
  NonCustodialSigner
4
- } from "./chunk-LKAE7D7W.js";
4
+ } from "./chunk-W3OYA42M.js";
5
+ import {
6
+ walletsLogger
7
+ } from "./chunk-S2AKC2CK.js";
5
8
  import {
6
9
  __async
7
10
  } from "./chunk-ASE2FXWP.js";
@@ -26,6 +29,8 @@ var SolanaNonCustodialSigner = class _SolanaNonCustodialSigner extends NonCustod
26
29
  const transactionBytes = base58.decode(transaction);
27
30
  const deserializedTransaction = VersionedTransaction.deserialize(transactionBytes);
28
31
  const messageData = deserializedTransaction.message.serialize();
32
+ walletsLogger.info("sign: sending request", { keyType: "ed25519" });
33
+ const startTime = Date.now();
29
34
  const res = yield (_a = this.config.clientTEEConnection) == null ? void 0 : _a.sendAction({
30
35
  event: "request:sign",
31
36
  responseEvent: "response:sign",
@@ -42,6 +47,10 @@ var SolanaNonCustodialSigner = class _SolanaNonCustodialSigner extends NonCustod
42
47
  },
43
48
  options: DEFAULT_EVENT_OPTIONS
44
49
  });
50
+ walletsLogger.info("sign: response received", {
51
+ status: res == null ? void 0 : res.status,
52
+ durationMs: Date.now() - startTime
53
+ });
45
54
  if ((res == null ? void 0 : res.status) === "error") {
46
55
  throw new Error(res.error);
47
56
  }
@@ -4,17 +4,21 @@ import {
4
4
  } from "./chunk-ZP4ZZCIE.js";
5
5
  import {
6
6
  Wallet
7
- } from "./chunk-ZQACPBUW.js";
7
+ } from "./chunk-XEZBA7I2.js";
8
8
  import {
9
9
  assembleSigner
10
- } from "./chunk-VJ2ZKU3R.js";
10
+ } from "./chunk-ETCH6L2Y.js";
11
11
  import {
12
12
  WalletCreationError,
13
13
  WalletNotAvailableError
14
14
  } from "./chunk-SGINWAB6.js";
15
+ import {
16
+ isMainnetChain,
17
+ isTestnetChain
18
+ } from "./chunk-XSMIDXUA.js";
15
19
  import {
16
20
  walletsLogger
17
- } from "./chunk-B24CPC6Y.js";
21
+ } from "./chunk-S2AKC2CK.js";
18
22
  import {
19
23
  __async,
20
24
  __decorateClass,
@@ -22,7 +26,7 @@ import {
22
26
  } from "./chunk-ASE2FXWP.js";
23
27
 
24
28
  // src/wallets/wallet-factory.ts
25
- import { WithLoggerContext } from "@crossmint/common-sdk-base";
29
+ import { WithLoggerContext, APIKeyEnvironmentPrefix } from "@crossmint/common-sdk-base";
26
30
  import { WebAuthnP256 } from "ox";
27
31
  var DELEGATED_SIGNER_MISMATCH_ERROR = "When 'delegatedSigners' is provided to a method that may fetch an existing wallet, each specified delegated signer must exist in that wallet's configuration.";
28
32
  var WalletFactory = class {
@@ -39,6 +43,7 @@ var WalletFactory = class {
39
43
  "getOrCreateWallet can only be called from client-side code.\n- Make sure you're running this in the browser (or another client environment), not on your server.\n- Use your Crossmint Client API Key (not a server key)."
40
44
  );
41
45
  }
46
+ this.validateChainEnvironment(args.chain);
42
47
  const locator = this.getWalletLocator(args);
43
48
  walletsLogger.info("walletFactory.getOrCreateWallet.start");
44
49
  const existingWallet = yield this.apiClient.getWallet(locator);
@@ -49,7 +54,7 @@ var WalletFactory = class {
49
54
  return this.createWalletInstance(existingWallet, args);
50
55
  }
51
56
  walletsLogger.info("walletFactory.getOrCreateWallet.creating");
52
- return this.createWallet(args);
57
+ return this.createWalletInternal(args);
53
58
  });
54
59
  }
55
60
  getWallet(walletLocator, args) {
@@ -60,6 +65,7 @@ var WalletFactory = class {
60
65
  });
61
66
  throw new WalletCreationError("getWallet is not supported on client side, use getOrCreateWallet instead");
62
67
  }
68
+ this.validateChainEnvironment(args.chain);
63
69
  walletsLogger.info("walletFactory.getWallet.start");
64
70
  const existingWallet = yield this.apiClient.getWallet(walletLocator);
65
71
  if ("error" in existingWallet) {
@@ -75,6 +81,12 @@ var WalletFactory = class {
75
81
  });
76
82
  }
77
83
  createWallet(args) {
84
+ return __async(this, null, function* () {
85
+ this.validateChainEnvironment(args.chain);
86
+ return this.createWalletInternal(args);
87
+ });
88
+ }
89
+ createWalletInternal(args) {
78
90
  return __async(this, null, function* () {
79
91
  var _a, _b, _c, _d, _e;
80
92
  yield (_c = (_b = (_a = args.options) == null ? void 0 : _a.experimental_callbacks) == null ? void 0 : _b.onWalletCreationStart) == null ? void 0 : _c.call(_b);
@@ -286,6 +298,28 @@ var WalletFactory = class {
286
298
  }
287
299
  return "evm";
288
300
  }
301
+ validateChainEnvironment(chain) {
302
+ if (chain === "solana" || chain === "stellar") {
303
+ return;
304
+ }
305
+ const evmChain = chain;
306
+ const environment = this.apiClient.environment;
307
+ const isProduction = environment === APIKeyEnvironmentPrefix.PRODUCTION;
308
+ if (isProduction && isTestnetChain(evmChain)) {
309
+ walletsLogger.warn("walletFactory.validateChainEnvironment.mismatch", {
310
+ chain,
311
+ environment,
312
+ message: `Chain "${chain}" is a testnet chain and should not be used in production environment. Please use a mainnet chain instead.`
313
+ });
314
+ }
315
+ if (!isProduction && isMainnetChain(evmChain)) {
316
+ walletsLogger.warn("walletFactory.validateChainEnvironment.mismatch", {
317
+ chain,
318
+ environment,
319
+ message: `Chain "${chain}" is a mainnet chain and should not be used in ${environment} environment. Please use a testnet chain instead.`
320
+ });
321
+ }
322
+ }
289
323
  };
290
324
  __decorateClass([
291
325
  WithLoggerContext({
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  WalletFactory
3
- } from "./chunk-THLRRDVV.js";
3
+ } from "./chunk-7NKX266V.js";
4
4
  import {
5
5
  ApiClient
6
- } from "./chunk-CEFMURL3.js";
6
+ } from "./chunk-6EP3PLGP.js";
7
7
  import {
8
8
  initWalletsLogger,
9
9
  walletsLogger
10
- } from "./chunk-B24CPC6Y.js";
10
+ } from "./chunk-S2AKC2CK.js";
11
11
  import {
12
12
  __async
13
13
  } from "./chunk-ASE2FXWP.js";
@@ -3,11 +3,11 @@
3
3
  var _chunkXC2V34TScjs = require('./chunk-XC2V34TS.cjs');
4
4
 
5
5
 
6
- var _chunkSWPJZ5JXcjs = require('./chunk-SWPJZ5JX.cjs');
6
+ var _chunkFQV77LH4cjs = require('./chunk-FQV77LH4.cjs');
7
7
 
8
8
 
9
9
 
10
- var _chunkADCODBBFcjs = require('./chunk-ADCODBBF.cjs');
10
+ var _chunk5CBGJLA4cjs = require('./chunk-5CBGJLA4.cjs');
11
11
 
12
12
 
13
13
  var _chunkUO2J2ZB2cjs = require('./chunk-UO2J2ZB2.cjs');
@@ -22,7 +22,7 @@ var ApiClient = class extends _commonsdkbase.CrossmintApiClient {
22
22
  constructor(crossmint) {
23
23
  super(crossmint, {
24
24
  internalConfig: {
25
- sdkMetadata: { name: _chunkADCODBBFcjs.SDK_NAME, version: _chunkADCODBBFcjs.SDK_VERSION }
25
+ sdkMetadata: { name: _chunk5CBGJLA4cjs.SDK_NAME, version: _chunk5CBGJLA4cjs.SDK_VERSION }
26
26
  }
27
27
  });
28
28
  this.apiPrefix = "api/2025-06-09/wallets";
@@ -31,7 +31,7 @@ var ApiClient = class extends _commonsdkbase.CrossmintApiClient {
31
31
  createWallet(params) {
32
32
  return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
33
33
  const path = this.isServerSide ? `${this.apiPrefix}` : `${this.apiPrefix}/me`;
34
- _chunkSWPJZ5JXcjs.walletsLogger.info("wallets.api.createWallet", {
34
+ _chunkFQV77LH4cjs.walletsLogger.info("wallets.api.createWallet", {
35
35
  chainType: params.chainType,
36
36
  walletType: params.type
37
37
  });
@@ -41,12 +41,12 @@ var ApiClient = class extends _commonsdkbase.CrossmintApiClient {
41
41
  });
42
42
  const result = yield response.json();
43
43
  if ("error" in result) {
44
- _chunkSWPJZ5JXcjs.walletsLogger.error("wallets.api.createWallet.error", {
44
+ _chunkFQV77LH4cjs.walletsLogger.error("wallets.api.createWallet.error", {
45
45
  error: result.error,
46
46
  chainType: params.chainType
47
47
  });
48
48
  } else if ("address" in result) {
49
- _chunkSWPJZ5JXcjs.walletsLogger.info("wallets.api.createWallet.success", {
49
+ _chunkFQV77LH4cjs.walletsLogger.info("wallets.api.createWallet.success", {
50
50
  address: result.address,
51
51
  chainType: params.chainType
52
52
  });
@@ -56,18 +56,18 @@ var ApiClient = class extends _commonsdkbase.CrossmintApiClient {
56
56
  }
57
57
  getWallet(locator) {
58
58
  return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
59
- _chunkSWPJZ5JXcjs.walletsLogger.info("wallets.api.getWallet", { locator });
59
+ _chunkFQV77LH4cjs.walletsLogger.info("wallets.api.getWallet", { locator });
60
60
  const response = yield this.get(`${this.apiPrefix}/${locator}`, {
61
61
  headers: this.headers
62
62
  });
63
63
  const result = yield response.json();
64
64
  if ("error" in result) {
65
- _chunkSWPJZ5JXcjs.walletsLogger.warn("wallets.api.getWallet.error", {
65
+ _chunkFQV77LH4cjs.walletsLogger.warn("wallets.api.getWallet.error", {
66
66
  locator,
67
67
  error: result.error
68
68
  });
69
69
  } else if ("address" in result) {
70
- _chunkSWPJZ5JXcjs.walletsLogger.info("wallets.api.getWallet.success", result);
70
+ _chunkFQV77LH4cjs.walletsLogger.info("wallets.api.getWallet.success", result);
71
71
  }
72
72
  return result;
73
73
  });
@@ -200,7 +200,7 @@ var ApiClient = class extends _commonsdkbase.CrossmintApiClient {
200
200
  }
201
201
  send(walletLocator, tokenLocator, params) {
202
202
  return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
203
- _chunkSWPJZ5JXcjs.walletsLogger.info("wallets.api.send", {
203
+ _chunkFQV77LH4cjs.walletsLogger.info("wallets.api.send", {
204
204
  walletLocator,
205
205
  tokenLocator,
206
206
  recipient: params.recipient
@@ -211,13 +211,13 @@ var ApiClient = class extends _commonsdkbase.CrossmintApiClient {
211
211
  });
212
212
  const result = yield response.json();
213
213
  if ("error" in result) {
214
- _chunkSWPJZ5JXcjs.walletsLogger.error("wallets.api.send.error", {
214
+ _chunkFQV77LH4cjs.walletsLogger.error("wallets.api.send.error", {
215
215
  walletLocator,
216
216
  tokenLocator,
217
217
  error: result.error
218
218
  });
219
219
  } else if ("id" in result) {
220
- _chunkSWPJZ5JXcjs.walletsLogger.info("wallets.api.send.success", {
220
+ _chunkFQV77LH4cjs.walletsLogger.info("wallets.api.send.success", {
221
221
  walletLocator,
222
222
  transactionId: result.id
223
223
  });
@@ -1,15 +1,15 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk6H6ZBJC2cjs = require('./chunk-6H6ZBJC2.cjs');
3
+ var _chunkNIBKCMQ2cjs = require('./chunk-NIBKCMQ2.cjs');
4
4
 
5
5
 
6
- var _chunkHTSQPZHWcjs = require('./chunk-HTSQPZHW.cjs');
6
+ var _chunk55V4VMTXcjs = require('./chunk-55V4VMTX.cjs');
7
7
 
8
8
 
9
- var _chunkNIBKCMQ2cjs = require('./chunk-NIBKCMQ2.cjs');
9
+ var _chunk6H6ZBJC2cjs = require('./chunk-6H6ZBJC2.cjs');
10
10
 
11
11
 
12
- var _chunk55V4VMTXcjs = require('./chunk-55V4VMTX.cjs');
12
+ var _chunkHTSQPZHWcjs = require('./chunk-HTSQPZHW.cjs');
13
13
 
14
14
  // src/chains/chains.ts
15
15
  var _commonsdkbase = require('@crossmint/common-sdk-base');
@@ -144,7 +144,15 @@ function toViemChain(chain) {
144
144
  throw new Error(`Unknown chain: ${chain}`);
145
145
  }
146
146
  }
147
+ function isTestnetChain(chain) {
148
+ return TESTNET_AA_CHAINS.includes(chain);
149
+ }
150
+ function isMainnetChain(chain) {
151
+ return PRODUCTION_AA_CHAINS.includes(chain);
152
+ }
153
+
154
+
147
155
 
148
156
 
149
157
 
150
- exports.toViemChain = toViemChain;
158
+ exports.toViemChain = toViemChain; exports.isTestnetChain = isTestnetChain; exports.isMainnetChain = isMainnetChain;
@@ -4,17 +4,21 @@
4
4
  var _chunkRBHGZDDXcjs = require('./chunk-RBHGZDDX.cjs');
5
5
 
6
6
 
7
- var _chunkPST7R25Gcjs = require('./chunk-PST7R25G.cjs');
7
+ var _chunkNXST74TXcjs = require('./chunk-NXST74TX.cjs');
8
8
 
9
9
 
10
- var _chunkFV4PV7HUcjs = require('./chunk-FV4PV7HU.cjs');
10
+ var _chunkJLW3Q65Gcjs = require('./chunk-JLW3Q65G.cjs');
11
11
 
12
12
 
13
13
 
14
14
  var _chunkXC2V34TScjs = require('./chunk-XC2V34TS.cjs');
15
15
 
16
16
 
17
- var _chunkSWPJZ5JXcjs = require('./chunk-SWPJZ5JX.cjs');
17
+
18
+ var _chunkDIM3X4IXcjs = require('./chunk-DIM3X4IX.cjs');
19
+
20
+
21
+ var _chunkFQV77LH4cjs = require('./chunk-FQV77LH4.cjs');
18
22
 
19
23
 
20
24
 
@@ -32,53 +36,61 @@ var WalletFactory = class {
32
36
  getOrCreateWallet(args) {
33
37
  return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
34
38
  if (this.apiClient.isServerSide) {
35
- _chunkSWPJZ5JXcjs.walletsLogger.error("walletFactory.getOrCreateWallet.error", {
39
+ _chunkFQV77LH4cjs.walletsLogger.error("walletFactory.getOrCreateWallet.error", {
36
40
  error: "getOrCreateWallet can only be called from client-side code"
37
41
  });
38
42
  throw new (0, _chunkXC2V34TScjs.WalletCreationError)(
39
43
  "getOrCreateWallet can only be called from client-side code.\n- Make sure you're running this in the browser (or another client environment), not on your server.\n- Use your Crossmint Client API Key (not a server key)."
40
44
  );
41
45
  }
46
+ this.validateChainEnvironment(args.chain);
42
47
  const locator = this.getWalletLocator(args);
43
- _chunkSWPJZ5JXcjs.walletsLogger.info("walletFactory.getOrCreateWallet.start");
48
+ _chunkFQV77LH4cjs.walletsLogger.info("walletFactory.getOrCreateWallet.start");
44
49
  const existingWallet = yield this.apiClient.getWallet(locator);
45
50
  if (existingWallet != null && !("error" in existingWallet)) {
46
- _chunkSWPJZ5JXcjs.walletsLogger.info("walletFactory.getOrCreateWallet.existing", {
51
+ _chunkFQV77LH4cjs.walletsLogger.info("walletFactory.getOrCreateWallet.existing", {
47
52
  address: existingWallet.address
48
53
  });
49
54
  return this.createWalletInstance(existingWallet, args);
50
55
  }
51
- _chunkSWPJZ5JXcjs.walletsLogger.info("walletFactory.getOrCreateWallet.creating");
52
- return this.createWallet(args);
56
+ _chunkFQV77LH4cjs.walletsLogger.info("walletFactory.getOrCreateWallet.creating");
57
+ return this.createWalletInternal(args);
53
58
  });
54
59
  }
55
60
  getWallet(walletLocator, args) {
56
61
  return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
57
62
  if (!this.apiClient.isServerSide) {
58
- _chunkSWPJZ5JXcjs.walletsLogger.error("walletFactory.getWallet.error", {
63
+ _chunkFQV77LH4cjs.walletsLogger.error("walletFactory.getWallet.error", {
59
64
  error: "getWallet is not supported on client side"
60
65
  });
61
66
  throw new (0, _chunkXC2V34TScjs.WalletCreationError)("getWallet is not supported on client side, use getOrCreateWallet instead");
62
67
  }
63
- _chunkSWPJZ5JXcjs.walletsLogger.info("walletFactory.getWallet.start");
68
+ this.validateChainEnvironment(args.chain);
69
+ _chunkFQV77LH4cjs.walletsLogger.info("walletFactory.getWallet.start");
64
70
  const existingWallet = yield this.apiClient.getWallet(walletLocator);
65
71
  if ("error" in existingWallet) {
66
- _chunkSWPJZ5JXcjs.walletsLogger.warn("walletFactory.getWallet.notFound", {
72
+ _chunkFQV77LH4cjs.walletsLogger.warn("walletFactory.getWallet.notFound", {
67
73
  error: existingWallet.error
68
74
  });
69
75
  throw new (0, _chunkXC2V34TScjs.WalletNotAvailableError)(JSON.stringify(existingWallet));
70
76
  }
71
- _chunkSWPJZ5JXcjs.walletsLogger.info("walletFactory.getWallet.success", {
77
+ _chunkFQV77LH4cjs.walletsLogger.info("walletFactory.getWallet.success", {
72
78
  address: existingWallet.address
73
79
  });
74
80
  return this.createWalletInstance(existingWallet, args);
75
81
  });
76
82
  }
77
83
  createWallet(args) {
84
+ return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
85
+ this.validateChainEnvironment(args.chain);
86
+ return this.createWalletInternal(args);
87
+ });
88
+ }
89
+ createWalletInternal(args) {
78
90
  return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
79
91
  var _a, _b, _c, _d, _e;
80
92
  yield (_c = (_b = (_a = args.options) == null ? void 0 : _a.experimental_callbacks) == null ? void 0 : _b.onWalletCreationStart) == null ? void 0 : _c.call(_b);
81
- _chunkSWPJZ5JXcjs.walletsLogger.info("walletFactory.createWallet.start");
93
+ _chunkFQV77LH4cjs.walletsLogger.info("walletFactory.createWallet.start");
82
94
  this.mutateSignerFromCustomAuth(args, true);
83
95
  const adminSigner = args.signer.type === "passkey" ? yield this.createPasskeyAdminSigner(args.signer) : args.signer;
84
96
  const walletResponse = yield this.apiClient.createWallet({
@@ -91,12 +103,12 @@ var WalletFactory = class {
91
103
  alias: (_e = args.alias) != null ? _e : void 0
92
104
  });
93
105
  if ("error" in walletResponse) {
94
- _chunkSWPJZ5JXcjs.walletsLogger.error("walletFactory.createWallet.error", {
106
+ _chunkFQV77LH4cjs.walletsLogger.error("walletFactory.createWallet.error", {
95
107
  error: walletResponse.error
96
108
  });
97
109
  throw new (0, _chunkXC2V34TScjs.WalletCreationError)(JSON.stringify(walletResponse));
98
110
  }
99
- _chunkSWPJZ5JXcjs.walletsLogger.info("walletFactory.createWallet.success", {
111
+ _chunkFQV77LH4cjs.walletsLogger.info("walletFactory.createWallet.success", {
100
112
  address: walletResponse.address
101
113
  });
102
114
  return this.createWalletInstance(walletResponse, args);
@@ -105,12 +117,12 @@ var WalletFactory = class {
105
117
  createWalletInstance(walletResponse, args) {
106
118
  this.validateExistingWalletConfig(walletResponse, args);
107
119
  const signerConfig = this.toInternalSignerConfig(walletResponse, args.signer, args.options);
108
- return new (0, _chunkPST7R25Gcjs.Wallet)(
120
+ return new (0, _chunkNXST74TXcjs.Wallet)(
109
121
  {
110
122
  chain: args.chain,
111
123
  address: walletResponse.address,
112
124
  owner: walletResponse.owner,
113
- signer: _chunkFV4PV7HUcjs.assembleSigner.call(void 0, args.chain, signerConfig),
125
+ signer: _chunkJLW3Q65Gcjs.assembleSigner.call(void 0, args.chain, signerConfig),
114
126
  options: args.options,
115
127
  alias: args.alias
116
128
  },
@@ -286,10 +298,32 @@ var WalletFactory = class {
286
298
  }
287
299
  return "evm";
288
300
  }
301
+ validateChainEnvironment(chain) {
302
+ if (chain === "solana" || chain === "stellar") {
303
+ return;
304
+ }
305
+ const evmChain = chain;
306
+ const environment = this.apiClient.environment;
307
+ const isProduction = environment === _commonsdkbase.APIKeyEnvironmentPrefix.PRODUCTION;
308
+ if (isProduction && _chunkDIM3X4IXcjs.isTestnetChain.call(void 0, evmChain)) {
309
+ _chunkFQV77LH4cjs.walletsLogger.warn("walletFactory.validateChainEnvironment.mismatch", {
310
+ chain,
311
+ environment,
312
+ message: `Chain "${chain}" is a testnet chain and should not be used in production environment. Please use a mainnet chain instead.`
313
+ });
314
+ }
315
+ if (!isProduction && _chunkDIM3X4IXcjs.isMainnetChain.call(void 0, evmChain)) {
316
+ _chunkFQV77LH4cjs.walletsLogger.warn("walletFactory.validateChainEnvironment.mismatch", {
317
+ chain,
318
+ environment,
319
+ message: `Chain "${chain}" is a mainnet chain and should not be used in ${environment} environment. Please use a testnet chain instead.`
320
+ });
321
+ }
322
+ }
289
323
  };
290
324
  _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
291
325
  _commonsdkbase.WithLoggerContext.call(void 0, {
292
- logger: _chunkSWPJZ5JXcjs.walletsLogger,
326
+ logger: _chunkFQV77LH4cjs.walletsLogger,
293
327
  methodName: "walletFactory.getOrCreateWallet",
294
328
  buildContext(_thisArg, args) {
295
329
  const walletArgs = args[0];
@@ -299,7 +333,7 @@ _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
299
333
  ], WalletFactory.prototype, "getOrCreateWallet", 1);
300
334
  _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
301
335
  _commonsdkbase.WithLoggerContext.call(void 0, {
302
- logger: _chunkSWPJZ5JXcjs.walletsLogger,
336
+ logger: _chunkFQV77LH4cjs.walletsLogger,
303
337
  methodName: "walletFactory.getWallet",
304
338
  buildContext(_thisArg, args) {
305
339
  const walletLocator = args[0];
@@ -310,7 +344,7 @@ _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
310
344
  ], WalletFactory.prototype, "getWallet", 1);
311
345
  _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
312
346
  _commonsdkbase.WithLoggerContext.call(void 0, {
313
- logger: _chunkSWPJZ5JXcjs.walletsLogger,
347
+ logger: _chunkFQV77LH4cjs.walletsLogger,
314
348
  methodName: "walletFactory.createWallet",
315
349
  buildContext(_thisArg, args) {
316
350
  const walletArgs = args[0];
@@ -1,12 +1,12 @@
1
+ import {
2
+ StellarNonCustodialSigner
3
+ } from "./chunk-N65K6TUY.js";
1
4
  import {
2
5
  EVMNonCustodialSigner
3
- } from "./chunk-UWKMOJ4D.js";
6
+ } from "./chunk-YF4DYTBM.js";
4
7
  import {
5
8
  SolanaNonCustodialSigner
6
- } from "./chunk-ZJZO6LQ3.js";
7
- import {
8
- StellarNonCustodialSigner
9
- } from "./chunk-KIS2P5DM.js";
9
+ } from "./chunk-7EZZGCYI.js";
10
10
  import {
11
11
  EVMApiKeySigner
12
12
  } from "./chunk-7GOUUPS4.js";
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunkADCODBBFcjs = require('./chunk-ADCODBBF.cjs');
4
+ var _chunk5CBGJLA4cjs = require('./chunk-5CBGJLA4.cjs');
5
5
 
6
6
  // src/logger/init.ts
7
7
 
@@ -20,8 +20,8 @@ function initWalletsLogger(apiKey) {
20
20
  }
21
21
  const { environment, projectId } = validationResult;
22
22
  walletsLogger.init({
23
- packageName: _chunkADCODBBFcjs.SDK_NAME,
24
- packageVersion: _chunkADCODBBFcjs.SDK_VERSION,
23
+ packageName: _chunk5CBGJLA4cjs.SDK_NAME,
24
+ packageVersion: _chunk5CBGJLA4cjs.SDK_VERSION,
25
25
  environment,
26
26
  projectId,
27
27
  platform