@crossmint/wallets-sdk 0.18.15 → 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 (91) hide show
  1. package/dist/api/__tests__/test-utils.cjs +5 -5
  2. package/dist/api/__tests__/test-utils.js +3 -3
  3. package/dist/api/client.cjs +4 -4
  4. package/dist/api/client.js +3 -3
  5. package/dist/api/gen/types.gen.d.cts +8 -0
  6. package/dist/api/gen/types.gen.d.ts +8 -0
  7. package/dist/api/index.cjs +4 -4
  8. package/dist/api/index.js +3 -3
  9. package/dist/chains/chains.cjs +6 -2
  10. package/dist/chains/chains.d.cts +3 -1
  11. package/dist/chains/chains.d.ts +3 -1
  12. package/dist/chains/chains.js +5 -1
  13. package/dist/{chunk-5YX2BE4I.js → chunk-57HPJVTI.js} +8 -3
  14. package/dist/{chunk-PJTTM5QQ.cjs → chunk-5CBGJLA4.cjs} +1 -1
  15. package/dist/{chunk-YZOPFNY3.js → chunk-6EP3PLGP.js} +2 -2
  16. package/dist/{chunk-4ZFP3ST7.js → chunk-7EZZGCYI.js} +10 -1
  17. package/dist/{chunk-ZM437XPQ.js → chunk-7NKX266V.js} +39 -5
  18. package/dist/{chunk-GSDBCRGH.js → chunk-BBYNVHFR.js} +3 -3
  19. package/dist/{chunk-NFQT5TFO.cjs → chunk-C5F6IECX.cjs} +12 -12
  20. package/dist/{chunk-OWRKZD7H.cjs → chunk-DIM3X4IX.cjs} +9 -1
  21. package/dist/{chunk-QCTTQ4XE.cjs → chunk-EIZVQAZO.cjs} +54 -20
  22. package/dist/{chunk-V65OBC5I.js → chunk-ETCH6L2Y.js} +3 -3
  23. package/dist/{chunk-WMUNQJYD.cjs → chunk-FQV77LH4.cjs} +3 -3
  24. package/dist/{chunk-YT64AZL6.cjs → chunk-JLW3Q65G.cjs} +6 -6
  25. package/dist/{chunk-AKJOFUXU.cjs → chunk-JZQYCISB.cjs} +9 -9
  26. package/dist/{chunk-CJWHHO4B.js → chunk-KE6LX37B.js} +1 -1
  27. package/dist/{chunk-WQDGFD34.js → chunk-L5IMC3NM.js} +2 -2
  28. package/dist/{chunk-PHIXNAMT.js → chunk-N65K6TUY.js} +10 -1
  29. package/dist/{chunk-PADJ2CIV.cjs → chunk-NXST74TX.cjs} +80 -43
  30. package/dist/{chunk-BMXG52BZ.cjs → chunk-REP547HH.cjs} +36 -13
  31. package/dist/{chunk-LFUXRLJR.js → chunk-S2AKC2CK.js} +1 -1
  32. package/dist/{chunk-TOTOITTM.js → chunk-SUJQZWLJ.js} +2 -2
  33. package/dist/{chunk-AUNZEGWS.cjs → chunk-TCNXKNBQ.cjs} +7 -7
  34. package/dist/{chunk-AKAJ7UHQ.cjs → chunk-VNPL3HFN.cjs} +12 -3
  35. package/dist/{chunk-77HEKAFB.cjs → chunk-VWENCGQO.cjs} +12 -3
  36. package/dist/{chunk-VM6OLXBS.js → chunk-W3OYA42M.js} +32 -9
  37. package/dist/{chunk-OOVNMAQF.js → chunk-XEZBA7I2.js} +58 -21
  38. package/dist/{chunk-JDAWNKQ7.cjs → chunk-XQSMZXBR.cjs} +28 -23
  39. package/dist/{chunk-XVFUAZJY.js → chunk-XSMIDXUA.js} +9 -1
  40. package/dist/{chunk-SCU5YLUT.js → chunk-YF4DYTBM.js} +10 -1
  41. package/dist/{chunk-PRQOFWLH.cjs → chunk-YFOUZXSM.cjs} +12 -3
  42. package/dist/{chunk-OTI3LX45.cjs → chunk-YXFIZNFL.cjs} +9 -9
  43. package/dist/index.cjs +16 -16
  44. package/dist/index.js +15 -15
  45. package/dist/logger/index.cjs +3 -3
  46. package/dist/logger/index.js +2 -2
  47. package/dist/logger/init.cjs +3 -3
  48. package/dist/logger/init.js +2 -2
  49. package/dist/sdk.cjs +17 -12
  50. package/dist/sdk.js +16 -11
  51. package/dist/signers/index.cjs +8 -8
  52. package/dist/signers/index.js +7 -7
  53. package/dist/signers/non-custodial/index.cjs +7 -7
  54. package/dist/signers/non-custodial/index.js +6 -6
  55. package/dist/signers/non-custodial/ncs-evm-signer.cjs +5 -5
  56. package/dist/signers/non-custodial/ncs-evm-signer.js +4 -4
  57. package/dist/signers/non-custodial/ncs-signer.cjs +4 -4
  58. package/dist/signers/non-custodial/ncs-signer.js +3 -3
  59. package/dist/signers/non-custodial/ncs-solana-signer.cjs +5 -5
  60. package/dist/signers/non-custodial/ncs-solana-signer.js +4 -4
  61. package/dist/signers/non-custodial/ncs-stellar-signer.cjs +5 -5
  62. package/dist/signers/non-custodial/ncs-stellar-signer.js +4 -4
  63. package/dist/utils/constants.cjs +2 -2
  64. package/dist/utils/constants.js +1 -1
  65. package/dist/wallets/__tests__/test-helpers.cjs +10 -8
  66. package/dist/wallets/__tests__/test-helpers.d.cts +2 -1
  67. package/dist/wallets/__tests__/test-helpers.d.ts +2 -1
  68. package/dist/wallets/__tests__/test-helpers.js +9 -7
  69. package/dist/wallets/evm.cjs +10 -10
  70. package/dist/wallets/evm.d.cts +20 -0
  71. package/dist/wallets/evm.d.ts +20 -0
  72. package/dist/wallets/evm.js +9 -9
  73. package/dist/wallets/solana.cjs +9 -9
  74. package/dist/wallets/solana.d.cts +5 -0
  75. package/dist/wallets/solana.d.ts +5 -0
  76. package/dist/wallets/solana.js +8 -8
  77. package/dist/wallets/stellar.cjs +9 -9
  78. package/dist/wallets/stellar.d.cts +5 -0
  79. package/dist/wallets/stellar.d.ts +5 -0
  80. package/dist/wallets/stellar.js +8 -8
  81. package/dist/wallets/types.d.cts +5 -1
  82. package/dist/wallets/types.d.ts +5 -1
  83. package/dist/wallets/wallet-factory.cjs +15 -10
  84. package/dist/wallets/wallet-factory.d.cts +2 -0
  85. package/dist/wallets/wallet-factory.d.ts +2 -0
  86. package/dist/wallets/wallet-factory.js +14 -9
  87. package/dist/wallets/wallet.cjs +8 -8
  88. package/dist/wallets/wallet.d.cts +6 -2
  89. package/dist/wallets/wallet.d.ts +6 -2
  90. package/dist/wallets/wallet.js +7 -7
  91. package/package.json +4 -4
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-WJUPOCKJ.js";
7
7
  import {
8
8
  walletsLogger
9
- } from "./chunk-LFUXRLJR.js";
9
+ } from "./chunk-S2AKC2CK.js";
10
10
  import {
11
11
  __async,
12
12
  __decorateClass
@@ -64,7 +64,7 @@ var NonCustodialSigner = class {
64
64
  }
65
65
  initializeTEEConnection() {
66
66
  return __async(this, null, function* () {
67
- console.warn("TEE connection is not initialized, initializing now...");
67
+ walletsLogger.info("TEE connection not initialized, initializing now");
68
68
  const parsedAPIKey = validateAPIKey(this.config.crossmint.apiKey);
69
69
  if (!parsedAPIKey.isValid) {
70
70
  throw new Error("Invalid API key");
@@ -76,7 +76,7 @@ var NonCustodialSigner = class {
76
76
  if (this.config.clientTEEConnection == null) {
77
77
  throw new Error("Failed to initialize TEE connection");
78
78
  }
79
- console.log("TEE connection initialized successfully");
79
+ walletsLogger.info("TEE connection initialized successfully");
80
80
  });
81
81
  }
82
82
  handleAuthRequired() {
@@ -88,6 +88,8 @@ var NonCustodialSigner = class {
88
88
  `${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, sendEmailWithOtp, verifyOtp, reject) => { /* your UI logic */ }`
89
89
  );
90
90
  }
91
+ walletsLogger.info("get-status: sending request");
92
+ const startTime = Date.now();
91
93
  const signerResponse = yield clientTEEConnection.sendAction({
92
94
  event: "request:get-status",
93
95
  responseEvent: "response:get-status",
@@ -99,18 +101,26 @@ var NonCustodialSigner = class {
99
101
  },
100
102
  options: DEFAULT_EVENT_OPTIONS
101
103
  });
104
+ const durationMs = Date.now() - startTime;
102
105
  if ((signerResponse == null ? void 0 : signerResponse.status) !== "success") {
106
+ walletsLogger.error("get-status: failed", {
107
+ status: signerResponse == null ? void 0 : signerResponse.status,
108
+ error: signerResponse == null ? void 0 : signerResponse.error,
109
+ durationMs
110
+ });
103
111
  throw new Error(signerResponse == null ? void 0 : signerResponse.error);
104
112
  }
113
+ walletsLogger.info("get-status: response received", {
114
+ signerStatus: signerResponse.signerStatus,
115
+ durationMs
116
+ });
105
117
  if (signerResponse.signerStatus === "ready") {
106
118
  this._needsAuth = false;
107
119
  return;
108
120
  } else {
109
121
  this._needsAuth = true;
110
122
  }
111
- walletsLogger.info("Handling auth required", { signerResponse });
112
- walletsLogger.info("Needs auth", { needsAuth: this._needsAuth });
113
- walletsLogger.info("Config onAuthRequired", { onAuthRequired: this.config.onAuthRequired });
123
+ walletsLogger.info("Auth required, initiating OTP flow", { needsAuth: this._needsAuth });
114
124
  const { promise, resolve, reject } = this.createAuthPromise();
115
125
  this._authPromise = { promise, resolve, reject };
116
126
  if (this.config.onAuthRequired) {
@@ -176,6 +186,8 @@ var NonCustodialSigner = class {
176
186
  var _a, _b, _c;
177
187
  const handshakeParent = yield this.getTEEConnection();
178
188
  const authId = this.getAuthId();
189
+ walletsLogger.info("start-onboarding: sending request");
190
+ const startTime = Date.now();
179
191
  const response = yield handshakeParent.sendAction({
180
192
  event: "request:start-onboarding",
181
193
  responseEvent: "response:start-onboarding",
@@ -188,12 +200,17 @@ var NonCustodialSigner = class {
188
200
  },
189
201
  options: DEFAULT_EVENT_OPTIONS
190
202
  });
203
+ const durationMs = Date.now() - startTime;
204
+ walletsLogger.info("start-onboarding: response received", {
205
+ status: response == null ? void 0 : response.status,
206
+ durationMs
207
+ });
191
208
  if ((response == null ? void 0 : response.status) === "success" && response.signerStatus === "ready") {
192
209
  this._needsAuth = false;
193
210
  return;
194
211
  }
195
212
  if ((response == null ? void 0 : response.status) === "error") {
196
- console.error("[sendMessageWithOtp] Failed to send OTP:", response);
213
+ walletsLogger.error("start-onboarding: failed", { error: response.error });
197
214
  (_c = this._authPromise) == null ? void 0 : _c.reject(new Error(response.error || "Failed to initiate OTP process."));
198
215
  }
199
216
  });
@@ -210,6 +227,8 @@ var NonCustodialSigner = class {
210
227
  let response;
211
228
  try {
212
229
  const handshakeParent = yield this.getTEEConnection();
230
+ walletsLogger.info("complete-onboarding: sending request");
231
+ const startTime = Date.now();
213
232
  response = yield handshakeParent.sendAction({
214
233
  event: "request:complete-onboarding",
215
234
  responseEvent: "response:complete-onboarding",
@@ -224,8 +243,12 @@ var NonCustodialSigner = class {
224
243
  },
225
244
  options: DEFAULT_EVENT_OPTIONS
226
245
  });
246
+ walletsLogger.info("complete-onboarding: response received", {
247
+ status: response == null ? void 0 : response.status,
248
+ durationMs: Date.now() - startTime
249
+ });
227
250
  } catch (err) {
228
- console.error("[verifyOtp] Error sending OTP validation request:", err);
251
+ walletsLogger.error("complete-onboarding: error", { error: err });
229
252
  this._needsAuth = true;
230
253
  (_c = this._authPromise) == null ? void 0 : _c.reject(err);
231
254
  throw err;
@@ -246,7 +269,7 @@ var NonCustodialSigner = class {
246
269
  (_d = this._authPromise) == null ? void 0 : _d.resolve();
247
270
  return;
248
271
  }
249
- console.error("[verifyOtp] Failed to validate OTP:", JSON.stringify(response, null, 2));
272
+ walletsLogger.error("complete-onboarding: OTP validation failed", { status: response == null ? void 0 : response.status });
250
273
  this._needsAuth = true;
251
274
  const errorMessage = (response == null ? void 0 : response.status) === "error" ? response.error : "Failed to validate encrypted OTP";
252
275
  const error = new Error(errorMessage);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  NonCustodialSigner
3
- } from "./chunk-VM6OLXBS.js";
3
+ } from "./chunk-W3OYA42M.js";
4
4
  import {
5
5
  InvalidSignerError,
6
6
  SignatureFailedError,
@@ -18,10 +18,10 @@ import {
18
18
  } from "./chunk-SGINWAB6.js";
19
19
  import {
20
20
  walletsLogger
21
- } from "./chunk-LFUXRLJR.js";
21
+ } from "./chunk-S2AKC2CK.js";
22
22
  import {
23
23
  STATUS_POLLING_INTERVAL_MS
24
- } from "./chunk-CJWHHO4B.js";
24
+ } from "./chunk-KE6LX37B.js";
25
25
  import {
26
26
  __async,
27
27
  __decorateClass,
@@ -98,7 +98,10 @@ var Wallet = class {
98
98
  }
99
99
  stagingFund(amount, chain) {
100
100
  return __async(this, null, function* () {
101
- walletsLogger.info("wallet.stagingFund.start", { amount, chain: chain != null ? chain : this.chain });
101
+ walletsLogger.info("wallet.stagingFund.start", {
102
+ amount,
103
+ chain: chain != null ? chain : this.chain
104
+ });
102
105
  const response = yield this.apiClient.fundWallet(this.address, {
103
106
  amount,
104
107
  token: "usdxm",
@@ -107,7 +110,9 @@ var Wallet = class {
107
110
  chain: chain != null ? chain : this.chain
108
111
  });
109
112
  if ("error" in response) {
110
- walletsLogger.error("wallet.stagingFund.error", { error: response });
113
+ walletsLogger.error("wallet.stagingFund.error", {
114
+ error: response
115
+ });
111
116
  throw new Error(`Failed to fund wallet: ${JSON.stringify(response.message)}`);
112
117
  }
113
118
  walletsLogger.info("wallet.stagingFund.success");
@@ -128,7 +133,9 @@ var Wallet = class {
128
133
  } else if (this.chain === "stellar" && chainData != null && "contractId" in chainData) {
129
134
  chainSpecificField = { contractId: chainData.contractId };
130
135
  } else if (chainData != null && "contractAddress" in chainData) {
131
- chainSpecificField = { contractAddress: chainData.contractAddress };
136
+ chainSpecificField = {
137
+ contractAddress: chainData.contractAddress
138
+ };
132
139
  }
133
140
  return __spreadValues({
134
141
  symbol: (_b = tokenData.symbol) != null ? _b : "",
@@ -231,21 +238,29 @@ var Wallet = class {
231
238
  return __async(this, null, function* () {
232
239
  const recipient = toRecipientLocator(to);
233
240
  const tokenLocator = toTokenLocator(token, this.chain);
234
- walletsLogger.info("wallet.send.start", { recipient, token: tokenLocator, amount });
241
+ walletsLogger.info("wallet.send.start", __spreadValues({
242
+ recipient,
243
+ token: tokenLocator,
244
+ amount
245
+ }, (options == null ? void 0 : options.transactionType) != null ? { transactionType: options.transactionType } : {}));
235
246
  yield this.preAuthIfNeeded();
236
- const sendParams = __spreadValues({
247
+ const sendParams = __spreadValues(__spreadValues({
237
248
  recipient,
238
249
  amount
239
- }, (options == null ? void 0 : options.experimental_signer) != null ? { signer: options.experimental_signer } : {});
250
+ }, (options == null ? void 0 : options.experimental_signer) != null ? { signer: options.experimental_signer } : {}), (options == null ? void 0 : options.transactionType) != null ? { transactionType: options.transactionType } : {});
240
251
  const transactionCreationResponse = yield __privateGet(this, _apiClient).send(this.walletLocator, tokenLocator, sendParams);
241
252
  if ("message" in transactionCreationResponse) {
242
- walletsLogger.error("wallet.send.error", { error: transactionCreationResponse });
253
+ walletsLogger.error("wallet.send.error", {
254
+ error: transactionCreationResponse
255
+ });
243
256
  throw new TransactionNotCreatedError(
244
257
  `Failed to send token: ${JSON.stringify(transactionCreationResponse.message)}`
245
258
  );
246
259
  }
247
260
  if (options == null ? void 0 : options.experimental_prepareOnly) {
248
- walletsLogger.info("wallet.send.prepared", { transactionId: transactionCreationResponse.id });
261
+ walletsLogger.info("wallet.send.prepared", {
262
+ transactionId: transactionCreationResponse.id
263
+ });
249
264
  return {
250
265
  hash: void 0,
251
266
  explorerLink: void 0,
@@ -290,12 +305,16 @@ var Wallet = class {
290
305
  params.transactionId,
291
306
  params.options
292
307
  );
293
- walletsLogger.info("wallet.approve.success", { transactionId: params.transactionId });
308
+ walletsLogger.info("wallet.approve.success", {
309
+ transactionId: params.transactionId
310
+ });
294
311
  return result;
295
312
  }
296
313
  if (params.signatureId != null) {
297
314
  const result = yield this.approveSignatureAndWait(params.signatureId, params.options);
298
- walletsLogger.info("wallet.approve.success", { signatureId: params.signatureId });
315
+ walletsLogger.info("wallet.approve.success", {
316
+ signatureId: params.signatureId
317
+ });
299
318
  return result;
300
319
  }
301
320
  walletsLogger.error("wallet.approve.error", {
@@ -313,7 +332,9 @@ var Wallet = class {
313
332
  chain: this.chain === "solana" || this.chain === "stellar" ? void 0 : this.chain
314
333
  });
315
334
  if ("error" in response) {
316
- walletsLogger.error("wallet.addDelegatedSigner.error", { error: response });
335
+ walletsLogger.error("wallet.addDelegatedSigner.error", {
336
+ error: response
337
+ });
317
338
  throw new Error(`Failed to register signer: ${JSON.stringify(response.message)}`);
318
339
  }
319
340
  if (this.chain === "solana" || this.chain === "stellar") {
@@ -325,11 +346,15 @@ var Wallet = class {
325
346
  }
326
347
  const transactionId = response.transaction.id;
327
348
  if ((_a = params.options) == null ? void 0 : _a.experimental_prepareOnly) {
328
- walletsLogger.info("wallet.addDelegatedSigner.prepared", { transactionId });
349
+ walletsLogger.info("wallet.addDelegatedSigner.prepared", {
350
+ transactionId
351
+ });
329
352
  return { transactionId };
330
353
  }
331
354
  yield this.approveTransactionAndWait(transactionId);
332
- walletsLogger.info("wallet.addDelegatedSigner.success", { transactionId });
355
+ walletsLogger.info("wallet.addDelegatedSigner.success", {
356
+ transactionId
357
+ });
333
358
  return void 0;
334
359
  }
335
360
  if (!("chains" in response)) {
@@ -341,17 +366,23 @@ var Wallet = class {
341
366
  const chainResponse = (_b = response.chains) == null ? void 0 : _b[this.chain];
342
367
  if ((_c = params.options) == null ? void 0 : _c.experimental_prepareOnly) {
343
368
  const signatureId = (chainResponse == null ? void 0 : chainResponse.status) !== "success" ? chainResponse == null ? void 0 : chainResponse.id : void 0;
344
- walletsLogger.info("wallet.addDelegatedSigner.prepared", { signatureId });
369
+ walletsLogger.info("wallet.addDelegatedSigner.prepared", {
370
+ signatureId
371
+ });
345
372
  return { signatureId };
346
373
  }
347
374
  if ((chainResponse == null ? void 0 : chainResponse.status) === "awaiting-approval") {
348
375
  yield this.approveSignatureAndWait(chainResponse.id);
349
- walletsLogger.info("wallet.addDelegatedSigner.success", { signatureId: chainResponse.id });
376
+ walletsLogger.info("wallet.addDelegatedSigner.success", {
377
+ signatureId: chainResponse.id
378
+ });
350
379
  return void 0;
351
380
  }
352
381
  if ((chainResponse == null ? void 0 : chainResponse.status) === "pending") {
353
382
  yield this.waitForSignature(chainResponse.id);
354
- walletsLogger.info("wallet.addDelegatedSigner.success", { signatureId: chainResponse.id });
383
+ walletsLogger.info("wallet.addDelegatedSigner.success", {
384
+ signatureId: chainResponse.id
385
+ });
355
386
  return void 0;
356
387
  }
357
388
  walletsLogger.info("wallet.addDelegatedSigner.success");
@@ -364,7 +395,9 @@ var Wallet = class {
364
395
  walletsLogger.info("wallet.delegatedSigners.start");
365
396
  const walletResponse = yield __privateGet(this, _apiClient).getWallet(this.walletLocator);
366
397
  if ("error" in walletResponse) {
367
- walletsLogger.error("wallet.delegatedSigners.error", { error: walletResponse });
398
+ walletsLogger.error("wallet.delegatedSigners.error", {
399
+ error: walletResponse
400
+ });
368
401
  throw new WalletNotAvailableError(JSON.stringify(walletResponse));
369
402
  }
370
403
  if (walletResponse.type !== "smart" || walletResponse.chainType !== "evm" && walletResponse.chainType !== "solana" && walletResponse.chainType !== "stellar") {
@@ -380,7 +413,9 @@ var Wallet = class {
380
413
  signer: `external-wallet:${address}`
381
414
  };
382
415
  })) != null ? _c : [];
383
- walletsLogger.info("wallet.delegatedSigners.success", { count: signers.length });
416
+ walletsLogger.info("wallet.delegatedSigners.success", {
417
+ count: signers.length
418
+ });
384
419
  return signers;
385
420
  });
386
421
  }
@@ -509,6 +544,7 @@ var Wallet = class {
509
544
  }
510
545
  executeApproveTransactionWithErrorHandling(transactionId, approvals) {
511
546
  return __async(this, null, function* () {
547
+ walletsLogger.info("wallet.approve: submitting approval to API", { transactionId });
512
548
  const approvedTransaction = yield __privateGet(this, _apiClient).approveTransaction(this.walletLocator, transactionId, {
513
549
  approvals
514
550
  });
@@ -558,6 +594,7 @@ var Wallet = class {
558
594
  initialBackoffMs = STATUS_POLLING_INTERVAL_MS
559
595
  } = {}) {
560
596
  var _a;
597
+ walletsLogger.info("wallet.approve: waiting for transaction confirmation", { transactionId, timeoutMs });
561
598
  const startTime = Date.now();
562
599
  let transactionResponse;
563
600
  do {
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkPADJ2CIVcjs = require('./chunk-PADJ2CIV.cjs');
3
+ var _chunkNXST74TXcjs = require('./chunk-NXST74TX.cjs');
4
4
 
5
5
 
6
6
 
@@ -8,10 +8,10 @@ var _chunkPADJ2CIVcjs = require('./chunk-PADJ2CIV.cjs');
8
8
  var _chunkXC2V34TScjs = require('./chunk-XC2V34TS.cjs');
9
9
 
10
10
 
11
- var _chunkOWRKZD7Hcjs = require('./chunk-OWRKZD7H.cjs');
11
+ var _chunkDIM3X4IXcjs = require('./chunk-DIM3X4IX.cjs');
12
12
 
13
13
 
14
- var _chunkWMUNQJYDcjs = require('./chunk-WMUNQJYD.cjs');
14
+ var _chunkFQV77LH4cjs = require('./chunk-FQV77LH4.cjs');
15
15
 
16
16
 
17
17
 
@@ -20,7 +20,7 @@ var _chunkUO2J2ZB2cjs = require('./chunk-UO2J2ZB2.cjs');
20
20
  // src/wallets/evm.ts
21
21
  var _viem = require('viem');
22
22
  var _commonsdkbase = require('@crossmint/common-sdk-base');
23
- var _EVMWallet = class _EVMWallet extends _chunkPADJ2CIVcjs.Wallet {
23
+ var _EVMWallet = class _EVMWallet extends _chunkNXST74TXcjs.Wallet {
24
24
  constructor(wallet) {
25
25
  super(
26
26
  {
@@ -28,10 +28,10 @@ var _EVMWallet = class _EVMWallet extends _chunkPADJ2CIVcjs.Wallet {
28
28
  address: wallet.address,
29
29
  owner: wallet.owner,
30
30
  signer: wallet.signer,
31
- options: _chunkPADJ2CIVcjs.Wallet.getOptions(wallet),
31
+ options: _chunkNXST74TXcjs.Wallet.getOptions(wallet),
32
32
  alias: wallet.alias
33
33
  },
34
- _chunkPADJ2CIVcjs.Wallet.getApiClient(wallet)
34
+ _chunkNXST74TXcjs.Wallet.getApiClient(wallet)
35
35
  );
36
36
  }
37
37
  static from(wallet) {
@@ -43,12 +43,12 @@ var _EVMWallet = class _EVMWallet extends _chunkPADJ2CIVcjs.Wallet {
43
43
  sendTransaction(params) {
44
44
  return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
45
45
  var _a;
46
- _chunkWMUNQJYDcjs.walletsLogger.info("evmWallet.sendTransaction.start");
46
+ _chunkFQV77LH4cjs.walletsLogger.info("evmWallet.sendTransaction.start");
47
47
  yield this.preAuthIfNeeded();
48
48
  const builtTransaction = this.buildTransaction(params);
49
49
  const createdTransaction = yield this.createTransaction(builtTransaction, params.options);
50
50
  if ((_a = params.options) == null ? void 0 : _a.experimental_prepareOnly) {
51
- _chunkWMUNQJYDcjs.walletsLogger.info("evmWallet.sendTransaction.prepared", {
51
+ _chunkFQV77LH4cjs.walletsLogger.info("evmWallet.sendTransaction.prepared", {
52
52
  transactionId: createdTransaction.id
53
53
  });
54
54
  return {
@@ -58,7 +58,7 @@ var _EVMWallet = class _EVMWallet extends _chunkPADJ2CIVcjs.Wallet {
58
58
  };
59
59
  }
60
60
  const result = yield this.approveTransactionAndWait(createdTransaction.id);
61
- _chunkWMUNQJYDcjs.walletsLogger.info("evmWallet.sendTransaction.success", {
61
+ _chunkFQV77LH4cjs.walletsLogger.info("evmWallet.sendTransaction.success", {
62
62
  transactionId: createdTransaction.id,
63
63
  hash: result.hash
64
64
  });
@@ -68,7 +68,7 @@ var _EVMWallet = class _EVMWallet extends _chunkPADJ2CIVcjs.Wallet {
68
68
  signMessage(params) {
69
69
  return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
70
70
  var _a;
71
- _chunkWMUNQJYDcjs.walletsLogger.info("evmWallet.signMessage.start");
71
+ _chunkFQV77LH4cjs.walletsLogger.info("evmWallet.signMessage.start");
72
72
  yield this.preAuthIfNeeded();
73
73
  const signatureCreationResponse = yield this.apiClient.createSignature(this.walletLocator, {
74
74
  type: "message",
@@ -79,11 +79,11 @@ var _EVMWallet = class _EVMWallet extends _chunkPADJ2CIVcjs.Wallet {
79
79
  }
80
80
  });
81
81
  if ("error" in signatureCreationResponse) {
82
- _chunkWMUNQJYDcjs.walletsLogger.error("evmWallet.signMessage.error", { error: signatureCreationResponse });
82
+ _chunkFQV77LH4cjs.walletsLogger.error("evmWallet.signMessage.error", { error: signatureCreationResponse });
83
83
  throw new (0, _chunkXC2V34TScjs.SignatureNotCreatedError)(JSON.stringify(signatureCreationResponse));
84
84
  }
85
85
  if ((_a = params.options) == null ? void 0 : _a.experimental_prepareOnly) {
86
- _chunkWMUNQJYDcjs.walletsLogger.info("evmWallet.signMessage.prepared", {
86
+ _chunkFQV77LH4cjs.walletsLogger.info("evmWallet.signMessage.prepared", {
87
87
  signatureId: signatureCreationResponse.id
88
88
  });
89
89
  return {
@@ -92,23 +92,23 @@ var _EVMWallet = class _EVMWallet extends _chunkPADJ2CIVcjs.Wallet {
92
92
  };
93
93
  }
94
94
  const result = yield this.approveSignatureAndWait(signatureCreationResponse.id);
95
- _chunkWMUNQJYDcjs.walletsLogger.info("evmWallet.signMessage.success", { signatureId: signatureCreationResponse.id });
95
+ _chunkFQV77LH4cjs.walletsLogger.info("evmWallet.signMessage.success", { signatureId: signatureCreationResponse.id });
96
96
  return result;
97
97
  });
98
98
  }
99
99
  signTypedData(params) {
100
100
  return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
101
101
  var _a;
102
- _chunkWMUNQJYDcjs.walletsLogger.info("evmWallet.signTypedData.start");
102
+ _chunkFQV77LH4cjs.walletsLogger.info("evmWallet.signTypedData.start");
103
103
  yield this.preAuthIfNeeded();
104
104
  const { domain, message, primaryType, types, chain } = params;
105
105
  if (!domain || !message || !types || !chain) {
106
- _chunkWMUNQJYDcjs.walletsLogger.error("evmWallet.signTypedData.error", { error: "Invalid typed data" });
106
+ _chunkFQV77LH4cjs.walletsLogger.error("evmWallet.signTypedData.error", { error: "Invalid typed data" });
107
107
  throw new (0, _chunkXC2V34TScjs.InvalidTypedDataError)("Invalid typed data");
108
108
  }
109
109
  const { name, version, chainId, verifyingContract, salt } = domain;
110
110
  if (!name || !version || !chainId || !verifyingContract) {
111
- _chunkWMUNQJYDcjs.walletsLogger.error("evmWallet.signTypedData.error", { error: "Invalid typed data domain" });
111
+ _chunkFQV77LH4cjs.walletsLogger.error("evmWallet.signTypedData.error", { error: "Invalid typed data domain" });
112
112
  throw new (0, _chunkXC2V34TScjs.InvalidTypedDataError)("Invalid typed data domain");
113
113
  }
114
114
  const signatureCreationResponse = yield this.apiClient.createSignature(this.walletLocator, {
@@ -131,11 +131,11 @@ var _EVMWallet = class _EVMWallet extends _chunkPADJ2CIVcjs.Wallet {
131
131
  }
132
132
  });
133
133
  if ("error" in signatureCreationResponse) {
134
- _chunkWMUNQJYDcjs.walletsLogger.error("evmWallet.signTypedData.error", { error: signatureCreationResponse });
134
+ _chunkFQV77LH4cjs.walletsLogger.error("evmWallet.signTypedData.error", { error: signatureCreationResponse });
135
135
  throw new (0, _chunkXC2V34TScjs.SignatureNotCreatedError)(JSON.stringify(signatureCreationResponse));
136
136
  }
137
137
  if ((_a = params.options) == null ? void 0 : _a.experimental_prepareOnly) {
138
- _chunkWMUNQJYDcjs.walletsLogger.info("evmWallet.signTypedData.prepared", {
138
+ _chunkFQV77LH4cjs.walletsLogger.info("evmWallet.signTypedData.prepared", {
139
139
  signatureId: signatureCreationResponse.id
140
140
  });
141
141
  return {
@@ -144,15 +144,20 @@ var _EVMWallet = class _EVMWallet extends _chunkPADJ2CIVcjs.Wallet {
144
144
  };
145
145
  }
146
146
  const result = yield this.approveSignatureAndWait(signatureCreationResponse.id);
147
- _chunkWMUNQJYDcjs.walletsLogger.info("evmWallet.signTypedData.success", { signatureId: signatureCreationResponse.id });
147
+ _chunkFQV77LH4cjs.walletsLogger.info("evmWallet.signTypedData.success", { signatureId: signatureCreationResponse.id });
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 _viem.createPublicClient.call(void 0, {
154
159
  transport: (_a = params == null ? void 0 : params.transport) != null ? _a : _viem.http.call(void 0, ),
155
- chain: _chunkOWRKZD7Hcjs.toViemChain.call(void 0, this.chain)
160
+ chain: _chunkDIM3X4IXcjs.toViemChain.call(void 0, this.chain)
156
161
  });
157
162
  }
158
163
  createTransaction(transaction, options) {
@@ -200,7 +205,7 @@ var _EVMWallet = class _EVMWallet extends _chunkPADJ2CIVcjs.Wallet {
200
205
  };
201
206
  _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
202
207
  _commonsdkbase.WithLoggerContext.call(void 0, {
203
- logger: _chunkWMUNQJYDcjs.walletsLogger,
208
+ logger: _chunkFQV77LH4cjs.walletsLogger,
204
209
  methodName: "evmWallet.sendTransaction",
205
210
  buildContext(thisArg) {
206
211
  return { chain: thisArg.chain, address: thisArg.address };
@@ -209,7 +214,7 @@ _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
209
214
  ], _EVMWallet.prototype, "sendTransaction", 1);
210
215
  _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
211
216
  _commonsdkbase.WithLoggerContext.call(void 0, {
212
- logger: _chunkWMUNQJYDcjs.walletsLogger,
217
+ logger: _chunkFQV77LH4cjs.walletsLogger,
213
218
  methodName: "evmWallet.signMessage",
214
219
  buildContext(thisArg) {
215
220
  return { chain: thisArg.chain, address: thisArg.address };
@@ -218,7 +223,7 @@ _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
218
223
  ], _EVMWallet.prototype, "signMessage", 1);
219
224
  _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
220
225
  _commonsdkbase.WithLoggerContext.call(void 0, {
221
- logger: _chunkWMUNQJYDcjs.walletsLogger,
226
+ logger: _chunkFQV77LH4cjs.walletsLogger,
222
227
  methodName: "evmWallet.signTypedData",
223
228
  buildContext(thisArg) {
224
229
  return { chain: thisArg.chain, address: thisArg.address };
@@ -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
+ }
147
153
 
148
154
  export {
149
- toViemChain
155
+ toViemChain,
156
+ isTestnetChain,
157
+ isMainnetChain
150
158
  };
@@ -1,7 +1,10 @@
1
1
  import {
2
2
  DEFAULT_EVENT_OPTIONS,
3
3
  NonCustodialSigner
4
- } from "./chunk-VM6OLXBS.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";
@@ -31,6 +34,8 @@ var EVMNonCustodialSigner = class _EVMNonCustodialSigner extends NonCustodialSig
31
34
  yield this.handleAuthRequired();
32
35
  const jwt = this.getJwtOrThrow();
33
36
  const hexString = raw.replace("0x", "");
37
+ walletsLogger.info("sign: sending request", { keyType: "secp256k1" });
38
+ const startTime = Date.now();
34
39
  const res = yield (_a = this.config.clientTEEConnection) == null ? void 0 : _a.sendAction({
35
40
  event: "request:sign",
36
41
  responseEvent: "response:sign",
@@ -47,6 +52,10 @@ var EVMNonCustodialSigner = class _EVMNonCustodialSigner extends NonCustodialSig
47
52
  },
48
53
  options: DEFAULT_EVENT_OPTIONS
49
54
  });
55
+ walletsLogger.info("sign: response received", {
56
+ status: res == null ? void 0 : res.status,
57
+ durationMs: Date.now() - startTime
58
+ });
50
59
  if ((res == null ? void 0 : res.status) === "error") {
51
60
  throw new Error(res.error);
52
61
  }
@@ -1,13 +1,16 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunkBMXG52BZcjs = require('./chunk-BMXG52BZ.cjs');
4
+ var _chunkREP547HHcjs = require('./chunk-REP547HH.cjs');
5
+
6
+
7
+ var _chunkFQV77LH4cjs = require('./chunk-FQV77LH4.cjs');
5
8
 
6
9
 
7
10
  var _chunkUO2J2ZB2cjs = require('./chunk-UO2J2ZB2.cjs');
8
11
 
9
12
  // src/signers/non-custodial/ncs-stellar-signer.ts
10
- var StellarNonCustodialSigner = class _StellarNonCustodialSigner extends _chunkBMXG52BZcjs.NonCustodialSigner {
13
+ var StellarNonCustodialSigner = class _StellarNonCustodialSigner extends _chunkREP547HHcjs.NonCustodialSigner {
11
14
  constructor(config) {
12
15
  super(config);
13
16
  }
@@ -21,6 +24,8 @@ var StellarNonCustodialSigner = class _StellarNonCustodialSigner extends _chunkB
21
24
  var _a;
22
25
  yield this.handleAuthRequired();
23
26
  const jwt = this.getJwtOrThrow();
27
+ _chunkFQV77LH4cjs.walletsLogger.info("sign: sending request", { keyType: "ed25519" });
28
+ const startTime = Date.now();
24
29
  const res = yield (_a = this.config.clientTEEConnection) == null ? void 0 : _a.sendAction({
25
30
  event: "request:sign",
26
31
  responseEvent: "response:sign",
@@ -35,7 +40,11 @@ var StellarNonCustodialSigner = class _StellarNonCustodialSigner extends _chunkB
35
40
  encoding: "base64"
36
41
  }
37
42
  },
38
- options: _chunkBMXG52BZcjs.DEFAULT_EVENT_OPTIONS
43
+ options: _chunkREP547HHcjs.DEFAULT_EVENT_OPTIONS
44
+ });
45
+ _chunkFQV77LH4cjs.walletsLogger.info("sign: response received", {
46
+ status: res == null ? void 0 : res.status,
47
+ durationMs: Date.now() - startTime
39
48
  });
40
49
  if ((res == null ? void 0 : res.status) === "error") {
41
50
  throw new Error(res.error);
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2
2
 
3
- var _chunkPADJ2CIVcjs = require('./chunk-PADJ2CIV.cjs');
3
+ var _chunkNXST74TXcjs = require('./chunk-NXST74TX.cjs');
4
4
 
5
5
 
6
6
  var _chunkQ5KNPVYIcjs = require('./chunk-Q5KNPVYI.cjs');
@@ -9,7 +9,7 @@ var _chunkQ5KNPVYIcjs = require('./chunk-Q5KNPVYI.cjs');
9
9
  var _chunkXC2V34TScjs = require('./chunk-XC2V34TS.cjs');
10
10
 
11
11
 
12
- var _chunkWMUNQJYDcjs = require('./chunk-WMUNQJYD.cjs');
12
+ var _chunkFQV77LH4cjs = require('./chunk-FQV77LH4.cjs');
13
13
 
14
14
 
15
15
 
@@ -18,7 +18,7 @@ var _chunkUO2J2ZB2cjs = require('./chunk-UO2J2ZB2.cjs');
18
18
  // src/wallets/solana.ts
19
19
  var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);
20
20
  var _commonsdkbase = require('@crossmint/common-sdk-base');
21
- var _SolanaWallet = class _SolanaWallet extends _chunkPADJ2CIVcjs.Wallet {
21
+ var _SolanaWallet = class _SolanaWallet extends _chunkNXST74TXcjs.Wallet {
22
22
  constructor(wallet) {
23
23
  super(
24
24
  {
@@ -26,10 +26,10 @@ var _SolanaWallet = class _SolanaWallet extends _chunkPADJ2CIVcjs.Wallet {
26
26
  address: wallet.address,
27
27
  owner: wallet.owner,
28
28
  signer: wallet.signer,
29
- options: _chunkPADJ2CIVcjs.Wallet.getOptions(wallet),
29
+ options: _chunkNXST74TXcjs.Wallet.getOptions(wallet),
30
30
  alias: wallet.alias
31
31
  },
32
- _chunkPADJ2CIVcjs.Wallet.getApiClient(wallet)
32
+ _chunkNXST74TXcjs.Wallet.getApiClient(wallet)
33
33
  );
34
34
  }
35
35
  static from(wallet) {
@@ -41,11 +41,11 @@ var _SolanaWallet = class _SolanaWallet extends _chunkPADJ2CIVcjs.Wallet {
41
41
  sendTransaction(params) {
42
42
  return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
43
43
  var _a, _b;
44
- _chunkWMUNQJYDcjs.walletsLogger.info("solanaWallet.sendTransaction.start");
44
+ _chunkFQV77LH4cjs.walletsLogger.info("solanaWallet.sendTransaction.start");
45
45
  yield this.preAuthIfNeeded();
46
46
  const createdTransaction = yield this.createTransaction(params);
47
47
  if ((_a = params.options) == null ? void 0 : _a.experimental_prepareOnly) {
48
- _chunkWMUNQJYDcjs.walletsLogger.info("solanaWallet.sendTransaction.prepared", {
48
+ _chunkFQV77LH4cjs.walletsLogger.info("solanaWallet.sendTransaction.prepared", {
49
49
  transactionId: createdTransaction.id
50
50
  });
51
51
  return {
@@ -69,7 +69,7 @@ var _SolanaWallet = class _SolanaWallet extends _chunkPADJ2CIVcjs.Wallet {
69
69
  additionalSigners: _additionalSigners
70
70
  };
71
71
  const result = yield this.approveTransactionAndWait(createdTransaction.id, options);
72
- _chunkWMUNQJYDcjs.walletsLogger.info("solanaWallet.sendTransaction.success", {
72
+ _chunkFQV77LH4cjs.walletsLogger.info("solanaWallet.sendTransaction.success", {
73
73
  transactionId: createdTransaction.id,
74
74
  hash: result.hash
75
75
  });
@@ -101,7 +101,7 @@ var _SolanaWallet = class _SolanaWallet extends _chunkPADJ2CIVcjs.Wallet {
101
101
  };
102
102
  _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
103
103
  _commonsdkbase.WithLoggerContext.call(void 0, {
104
- logger: _chunkWMUNQJYDcjs.walletsLogger,
104
+ logger: _chunkFQV77LH4cjs.walletsLogger,
105
105
  methodName: "solanaWallet.sendTransaction",
106
106
  buildContext(thisArg) {
107
107
  return { chain: thisArg.chain, address: thisArg.address };