@dynamic-labs-wallet/node 0.0.310 → 0.0.312

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs.js CHANGED
@@ -1,29 +1,29 @@
1
1
  'use strict';
2
2
 
3
- var core$1 = require('#internal/core');
4
- var core = require('@dynamic-labs-wallet/core');
3
+ var core = require('#internal/core');
4
+ var core$1 = require('@dynamic-labs-wallet/core');
5
5
  var node = require('#internal/node');
6
+ var logger = require('@dynamic-labs/logger');
6
7
  var forwardMpcClient = require('@dynamic-labs-wallet/forward-mpc-client');
7
8
  var uuid = require('uuid');
8
9
  var crypto = require('crypto');
9
- var logger$1 = require('@dynamic-labs/logger');
10
10
  require('node:crypto');
11
11
 
12
12
  // Removed duplicate exports - these are already exported from #internal/core
13
- const getMPCSignatureScheme = ({ signingAlgorithm, baseRelayUrl = core.MPC_RELAY_PROD_API_URL })=>{
13
+ const getMPCSignatureScheme = ({ signingAlgorithm, baseRelayUrl = core$1.MPC_RELAY_PROD_API_URL })=>{
14
14
  switch(signingAlgorithm){
15
- case core.SigningAlgorithm.ECDSA:
15
+ case core$1.SigningAlgorithm.ECDSA:
16
16
  return new node.Ecdsa(baseRelayUrl);
17
- case core.SigningAlgorithm.ED25519:
17
+ case core$1.SigningAlgorithm.ED25519:
18
18
  return new node.ExportableEd25519(baseRelayUrl);
19
- case core.SigningAlgorithm.BIP340:
19
+ case core$1.SigningAlgorithm.BIP340:
20
20
  return new node.BIP340(baseRelayUrl);
21
21
  default:
22
22
  throw new Error(`Unsupported signing algorithm: ${signingAlgorithm}`);
23
23
  }
24
24
  };
25
25
  const getMPCSigner = ({ chainName, baseRelayUrl, bitcoinConfig })=>{
26
- const chainConfig = core.getMPCChainConfig(chainName, bitcoinConfig);
26
+ const chainConfig = core$1.getMPCChainConfig(chainName, bitcoinConfig);
27
27
  const signatureScheme = getMPCSignatureScheme({
28
28
  signingAlgorithm: chainConfig.signingAlgorithm,
29
29
  baseRelayUrl
@@ -42,8 +42,23 @@ function _extends() {
42
42
  return _extends.apply(this, arguments);
43
43
  }
44
44
 
45
- const logger = new logger$1.Logger('DynamicWaasWalletClient');
46
-
45
+ const createLogError = (clientTag)=>({ message, error, context })=>logError({
46
+ message,
47
+ error,
48
+ context,
49
+ clientTag
50
+ });
51
+ const logError = ({ message, error, context, clientTag = 'node' })=>{
52
+ if (core$1.isAxiosError(error)) {
53
+ core$1.handleAxiosError(error, message, context);
54
+ return;
55
+ }
56
+ core$1.Logger.error(`[DynamicWaasWalletClient] Error in ${clientTag} client`, {
57
+ message,
58
+ error: error instanceof Error ? error.message : String(error),
59
+ context
60
+ });
61
+ };
47
62
  const bytesToBase64 = (arr)=>{
48
63
  return btoa(Array.from(arr, (b)=>String.fromCharCode(b)).join(''));
49
64
  };
@@ -66,12 +81,12 @@ const isHexString = (str)=>{
66
81
  const getExternalServerKeyShareBackupInfo = (params)=>{
67
82
  var _params_walletProperties, _params_walletProperties_keyShares_;
68
83
  const backups = {
69
- [core.BackupLocation.DYNAMIC]: [],
70
- [core.BackupLocation.GOOGLE_DRIVE]: [],
71
- [core.BackupLocation.ICLOUD]: [],
72
- [core.BackupLocation.USER]: [],
73
- [core.BackupLocation.EXTERNAL]: [],
74
- [core.BackupLocation.DELEGATED]: []
84
+ [core$1.BackupLocation.DYNAMIC]: [],
85
+ [core$1.BackupLocation.GOOGLE_DRIVE]: [],
86
+ [core$1.BackupLocation.ICLOUD]: [],
87
+ [core$1.BackupLocation.USER]: [],
88
+ [core$1.BackupLocation.EXTERNAL]: [],
89
+ [core$1.BackupLocation.DELEGATED]: []
75
90
  };
76
91
  if (!(params == null ? void 0 : (_params_walletProperties = params.walletProperties) == null ? void 0 : _params_walletProperties.keyShares)) {
77
92
  return {
@@ -126,7 +141,7 @@ const getExternalServerKeyShareBackupInfo = (params)=>{
126
141
  } catch (error) {
127
142
  attempts++;
128
143
  if (attempts === maxAttempts) {
129
- logger.error(`Failed to execute ${operationName} after ${maxAttempts} attempts`, _extends({}, logContext, {
144
+ core$1.Logger.error(`Failed to execute ${operationName} after ${maxAttempts} attempts`, _extends({}, logContext, {
130
145
  error
131
146
  }));
132
147
  throw error;
@@ -299,8 +314,6 @@ const getKey = async ({ password, salt, encryptionConfig })=>{
299
314
  }
300
315
  };
301
316
 
302
- const DEFAULT_LOG_LEVEL = 'INFO';
303
-
304
317
  class DynamicWalletClient {
305
318
  ensureApiClientAuthenticated() {
306
319
  if (!this.isApiClientAuthenticated) {
@@ -308,21 +321,23 @@ class DynamicWalletClient {
308
321
  }
309
322
  }
310
323
  async authenticateApiToken(authToken) {
311
- const tmpClient = new core.DynamicApiClient({
324
+ const tmpClient = new core$1.DynamicApiClient({
312
325
  environmentId: this.environmentId,
313
326
  authToken,
314
- baseApiUrl: this.baseApiUrl
327
+ baseApiUrl: this.baseApiUrl,
328
+ logger: this.logger
315
329
  });
316
330
  const response = await tmpClient.authenticateApiToken({
317
331
  environmentId: this.environmentId
318
332
  });
319
333
  const jwtTokenAuth = response.data.encodedJwts.minifiedJwt;
320
334
  this.baseJWTAuthToken = jwtTokenAuth;
321
- this.apiClient = new core.DynamicApiClient({
335
+ this.apiClient = new core$1.DynamicApiClient({
322
336
  environmentId: this.environmentId,
323
337
  authToken: jwtTokenAuth,
324
338
  baseApiUrl: this.baseApiUrl,
325
- forwardMPCClient: this.resolvedForwardMPCClient
339
+ forwardMPCClient: this.resolvedForwardMPCClient,
340
+ logger: this.logger
326
341
  });
327
342
  this.isApiClientAuthenticated = true;
328
343
  }
@@ -353,7 +368,7 @@ class DynamicWalletClient {
353
368
  baseRelayUrl: this.baseMPCRelayApiUrl,
354
369
  bitcoinConfig
355
370
  });
356
- const clientThreshold = core.getClientThreshold(thresholdSignatureScheme);
371
+ const clientThreshold = core$1.getClientThreshold(thresholdSignatureScheme);
357
372
  const keygenInitResults = await Promise.all(Array(clientThreshold).fill(null).map(()=>mpcSigner.initKeygen()));
358
373
  return keygenInitResults;
359
374
  } catch (error) {
@@ -384,9 +399,9 @@ class DynamicWalletClient {
384
399
  }
385
400
  async forwardMPCExternalServerKeyGen({ chainName, roomId, dynamicServerKeygenIds, externalServerInitKeygenResults, thresholdSignatureScheme, bitcoinConfig }) {
386
401
  try {
387
- const chainConfig = core.getMPCChainConfig(chainName, bitcoinConfig);
402
+ const chainConfig = core$1.getMPCChainConfig(chainName, bitcoinConfig);
388
403
  const signingAlgo = chainConfig.signingAlgorithm;
389
- const mpcConfig = core.MPC_CONFIG[thresholdSignatureScheme];
404
+ const mpcConfig = core$1.MPC_CONFIG[thresholdSignatureScheme];
390
405
  const isEd25519 = typeof signingAlgo === 'string' && signingAlgo.toLowerCase().includes('ed25519');
391
406
  const serverKeygenResults = await Promise.all(externalServerInitKeygenResults.map(async (currentInit)=>{
392
407
  const otherExternalServerKeygenIds = externalServerInitKeygenResults.filter((init)=>init.keygenId !== currentInit.keygenId).map((init)=>init.keygenId);
@@ -410,7 +425,7 @@ class DynamicWalletClient {
410
425
  });
411
426
  }));
412
427
  const [serverKeygenResult] = serverKeygenResults;
413
- const chainConfigForDeriv = core.getMPCChainConfig(chainName, bitcoinConfig);
428
+ const chainConfigForDeriv = core$1.getMPCChainConfig(chainName, bitcoinConfig);
414
429
  const derivationPath = new Uint32Array(chainConfigForDeriv.derivationPath);
415
430
  const rawPublicKey = await this.derivePublicKey({
416
431
  chainName,
@@ -429,6 +444,8 @@ class DynamicWalletClient {
429
444
  environmentId: this.environmentId
430
445
  });
431
446
  throw error;
447
+ } finally{
448
+ this.apiClient.forwardMPCClient.disconnect();
432
449
  }
433
450
  }
434
451
  async externalServerKeyGen({ chainName, roomId, dynamicServerKeygenIds, externalServerInitKeygenResults, thresholdSignatureScheme, bitcoinConfig }) {
@@ -450,7 +467,7 @@ class DynamicWalletClient {
450
467
  bitcoinConfig
451
468
  });
452
469
  // Get the MPC config for the threshold signature scheme
453
- const mpcConfig = core.MPC_CONFIG[thresholdSignatureScheme];
470
+ const mpcConfig = core$1.MPC_CONFIG[thresholdSignatureScheme];
454
471
  // For each client keygen init result, create an array of other parties' keygenIds
455
472
  const serverKeygenResults = await Promise.all(externalServerInitKeygenResults.map((currentInit)=>{
456
473
  // Get all other client keygenIds (excluding current one)
@@ -470,7 +487,7 @@ class DynamicWalletClient {
470
487
  }));
471
488
  // only need one client keygen result to derive the public key
472
489
  const [serverKeygenResult] = serverKeygenResults;
473
- const chainConfig = core.getMPCChainConfig(chainName, bitcoinConfig);
490
+ const chainConfig = core$1.getMPCChainConfig(chainName, bitcoinConfig);
474
491
  const derivationPath = new Uint32Array(chainConfig.derivationPath);
475
492
  const rawPublicKey = await this.derivePublicKey({
476
493
  chainName,
@@ -545,7 +562,7 @@ class DynamicWalletClient {
545
562
  onError,
546
563
  onCeremonyComplete
547
564
  });
548
- const { threshold } = core.getTSSConfig(thresholdSignatureScheme);
565
+ const { threshold } = core$1.getTSSConfig(thresholdSignatureScheme);
549
566
  const externalServerKeygenResults = await Promise.all(externalServerKeygenInitResults.map(async (currentInit, index)=>{
550
567
  const otherExternalServerKeygenIds = externalServerKeygenInitResults.filter((init)=>init.keygenId !== currentInit.keygenId).map((init)=>init.keygenId);
551
568
  if (index === 0) {
@@ -612,14 +629,14 @@ class DynamicWalletClient {
612
629
  }
613
630
  async forwardMPCClientSign({ chainName, message, roomId, keyShare, derivationPath, formattedMessage, dynamicRequestId, isFormatted }) {
614
631
  try {
615
- const messageForForwardMPC = core.serializeMessageForForwardMPC({
632
+ const messageForForwardMPC = core$1.serializeMessageForForwardMPC({
616
633
  message,
617
634
  isFormatted,
618
635
  chainName
619
636
  });
620
- this.logger.info('Forward MPC enabled, signing message with forward MPC');
621
- const environment = core.getEnvironmentFromUrl(this.baseApiUrl);
622
- const defaultRelayUrl = core.MPC_RELAY_URL_MAP[environment];
637
+ this.logger.debug('Signing message with MPC Socket Client');
638
+ const environment = core$1.getEnvironmentFromUrl(this.baseApiUrl);
639
+ const defaultRelayUrl = core$1.MPC_RELAY_URL_MAP[environment];
623
640
  const { signature: signatureBytes } = await this.apiClient.forwardMPCClient.signMessage({
624
641
  keyshare: keyShare,
625
642
  message: chainName === 'SVM' ? formattedMessage : messageForForwardMPC,
@@ -646,6 +663,8 @@ class DynamicWalletClient {
646
663
  dynamicRequestId
647
664
  });
648
665
  throw error;
666
+ } finally{
667
+ this.apiClient.forwardMPCClient.disconnect();
649
668
  }
650
669
  }
651
670
  async sign({ accountAddress, externalServerKeyShares, message, chainName, password = undefined, isFormatted = false, context, onError, bitcoinConfig }) {
@@ -656,13 +675,13 @@ class DynamicWalletClient {
656
675
  });
657
676
  const wallet = await this.getWallet({
658
677
  accountAddress,
659
- walletOperation: core.WalletOperation.SIGN_MESSAGE,
678
+ walletOperation: core$1.WalletOperation.SIGN_MESSAGE,
660
679
  password
661
680
  });
662
681
  externalServerKeyShares = externalServerKeyShares != null ? externalServerKeyShares : wallet.externalServerKeyShares;
663
682
  if (!externalServerKeyShares) {
664
683
  var _wallet_externalServerKeySharesBackupInfo;
665
- const hasExternalKeyShareId = Object.values(((_wallet_externalServerKeySharesBackupInfo = wallet.externalServerKeySharesBackupInfo) == null ? void 0 : _wallet_externalServerKeySharesBackupInfo.backups) || {}).some((locations)=>locations.some((loc)=>loc.location === core.BackupLocation.EXTERNAL));
684
+ const hasExternalKeyShareId = Object.values(((_wallet_externalServerKeySharesBackupInfo = wallet.externalServerKeySharesBackupInfo) == null ? void 0 : _wallet_externalServerKeySharesBackupInfo.backups) || {}).some((locations)=>locations.some((loc)=>loc.location === core$1.BackupLocation.EXTERNAL));
666
685
  const errorMessage = 'External server key shares are required to sign a message';
667
686
  if (hasExternalKeyShareId) {
668
687
  this.logger.error(errorMessage);
@@ -722,7 +741,7 @@ class DynamicWalletClient {
722
741
  });
723
742
  const wallet = await this.getWallet({
724
743
  accountAddress,
725
- walletOperation: core.WalletOperation.REFRESH,
744
+ walletOperation: core$1.WalletOperation.REFRESH,
726
745
  password
727
746
  });
728
747
  const mpcSigner = getMPCSigner({
@@ -783,7 +802,7 @@ class DynamicWalletClient {
783
802
  bitcoinConfig
784
803
  });
785
804
  // Determine share counts based on threshold signature schemes
786
- const { newExternalServerShareCount, existingExternalServerShareCount } = core.getServerWalletReshareConfig({
805
+ const { newExternalServerShareCount, existingExternalServerShareCount } = core$1.getServerWalletReshareConfig({
787
806
  oldThresholdSignatureScheme,
788
807
  newThresholdSignatureScheme
789
808
  });
@@ -812,13 +831,13 @@ class DynamicWalletClient {
812
831
  accountAddress,
813
832
  password
814
833
  });
815
- const { existingExternalServerShareCount } = core.getServerWalletReshareConfig({
834
+ const { existingExternalServerShareCount } = core$1.getServerWalletReshareConfig({
816
835
  oldThresholdSignatureScheme,
817
836
  newThresholdSignatureScheme
818
837
  });
819
838
  const wallet = await this.getWallet({
820
839
  accountAddress,
821
- walletOperation: core.WalletOperation.RESHARE,
840
+ walletOperation: core$1.WalletOperation.RESHARE,
822
841
  shareCount: existingExternalServerShareCount,
823
842
  password
824
843
  });
@@ -847,8 +866,8 @@ class DynamicWalletClient {
847
866
  });
848
867
  const { roomId, serverKeygenIds: dynamicServerKeygenIds, newServerKeygenIds: newDynamicServerKeygenIds = [] } = data;
849
868
  // Get the MPC config for the threshold signature scheme
850
- const oldMpcConfig = core.MPC_CONFIG[oldThresholdSignatureScheme];
851
- const newMpcConfig = core.MPC_CONFIG[newThresholdSignatureScheme];
869
+ const oldMpcConfig = core$1.MPC_CONFIG[oldThresholdSignatureScheme];
870
+ const newMpcConfig = core$1.MPC_CONFIG[newThresholdSignatureScheme];
852
871
  const allPartyKeygenIds = [
853
872
  ...externalServerKeygenIds,
854
873
  ...dynamicServerKeygenIds,
@@ -882,7 +901,7 @@ class DynamicWalletClient {
882
901
  const wallet = await this.getWallet({
883
902
  accountAddress,
884
903
  password,
885
- walletOperation: core.WalletOperation.EXPORT_PRIVATE_KEY
904
+ walletOperation: core$1.WalletOperation.EXPORT_PRIVATE_KEY
886
905
  });
887
906
  externalServerKeyShares = externalServerKeyShares != null ? externalServerKeyShares : wallet.externalServerKeyShares;
888
907
  if (!externalServerKeyShares) {
@@ -937,7 +956,7 @@ class DynamicWalletClient {
937
956
  if (!keyExportRaw) {
938
957
  throw new Error('Error exporting private key: Export returned null');
939
958
  }
940
- const chainConfig = core.getMPCChainConfig(chainName);
959
+ const chainConfig = core$1.getMPCChainConfig(chainName);
941
960
  const walletDerivationPath = !derivationPath ? undefined : new Uint32Array(chainConfig.derivationPath);
942
961
  let derivedPrivateKey;
943
962
  if (mpcSigner instanceof node.Ecdsa) {
@@ -1020,7 +1039,7 @@ class DynamicWalletClient {
1020
1039
  bitcoinConfig
1021
1040
  });
1022
1041
  locations.push({
1023
- location: core.BackupLocation.DYNAMIC,
1042
+ location: core$1.BackupLocation.DYNAMIC,
1024
1043
  externalKeyShareId: data.keyShareIds[0],
1025
1044
  passwordEncrypted: passwordEncryptedFlag,
1026
1045
  keygenId
@@ -1032,7 +1051,7 @@ class DynamicWalletClient {
1032
1051
  bitcoinConfig
1033
1052
  });
1034
1053
  locations.push({
1035
- location: core.BackupLocation.EXTERNAL,
1054
+ location: core$1.BackupLocation.EXTERNAL,
1036
1055
  passwordEncrypted: passwordEncryptedFlag,
1037
1056
  keygenId
1038
1057
  });
@@ -1086,7 +1105,7 @@ class DynamicWalletClient {
1086
1105
  const wallet = await this.getWallet({
1087
1106
  accountAddress,
1088
1107
  password,
1089
- walletOperation: core.WalletOperation.REACH_THRESHOLD
1108
+ walletOperation: core$1.WalletOperation.REACH_THRESHOLD
1090
1109
  });
1091
1110
  // Check if the wallet has a dynamic backup and derive password encryption status from the first dynamic share
1092
1111
  const dynamicBackups = (wallet == null ? void 0 : (_wallet_externalServerKeySharesBackupInfo = wallet.externalServerKeySharesBackupInfo) == null ? void 0 : (_wallet_externalServerKeySharesBackupInfo_backups = _wallet_externalServerKeySharesBackupInfo.backups) == null ? void 0 : _wallet_externalServerKeySharesBackupInfo_backups.dynamic) || [];
@@ -1098,7 +1117,7 @@ class DynamicWalletClient {
1098
1117
  const recoveredShares = await this.recoverEncryptedBackupByWallet({
1099
1118
  accountAddress,
1100
1119
  password,
1101
- walletOperation: core.WalletOperation.REACH_THRESHOLD
1120
+ walletOperation: core$1.WalletOperation.REACH_THRESHOLD
1102
1121
  });
1103
1122
  return recoveredShares;
1104
1123
  }
@@ -1106,7 +1125,7 @@ class DynamicWalletClient {
1106
1125
  await this.getWallet({
1107
1126
  accountAddress,
1108
1127
  password: existingPassword,
1109
- walletOperation: core.WalletOperation.REACH_ALL_PARTIES
1128
+ walletOperation: core$1.WalletOperation.REACH_ALL_PARTIES
1110
1129
  });
1111
1130
  await this.storeEncryptedBackupByWallet({
1112
1131
  accountAddress,
@@ -1136,22 +1155,22 @@ class DynamicWalletClient {
1136
1155
  * @returns @requiredShareCount: The number of shares required to recover
1137
1156
  */ recoverStrategy({ externalServerKeySharesBackupInfo, thresholdSignatureScheme, walletOperation, shareCount = undefined }) {
1138
1157
  const { backups } = externalServerKeySharesBackupInfo;
1139
- const { clientThreshold } = core.MPC_CONFIG[thresholdSignatureScheme];
1140
- let requiredShareCount = walletOperation === core.WalletOperation.REFRESH || walletOperation === core.WalletOperation.REACH_ALL_PARTIES || walletOperation === core.WalletOperation.RESHARE ? clientThreshold : 1;
1158
+ const { clientThreshold } = core$1.MPC_CONFIG[thresholdSignatureScheme];
1159
+ let requiredShareCount = walletOperation === core$1.WalletOperation.REFRESH || walletOperation === core$1.WalletOperation.REACH_ALL_PARTIES || walletOperation === core$1.WalletOperation.RESHARE ? clientThreshold : 1;
1141
1160
  // Override requiredShareCount if shareCount is provided
1142
1161
  if (shareCount !== undefined) {
1143
1162
  requiredShareCount = shareCount;
1144
1163
  }
1145
- const dynamicShares = (backups[core.BackupLocation.DYNAMIC] || []).slice(0, requiredShareCount);
1146
- const externalShares = (backups[core.BackupLocation.EXTERNAL] || []).slice(0, requiredShareCount);
1164
+ const dynamicShares = (backups[core$1.BackupLocation.DYNAMIC] || []).slice(0, requiredShareCount);
1165
+ const externalShares = (backups[core$1.BackupLocation.EXTERNAL] || []).slice(0, requiredShareCount);
1147
1166
  // If we have DYNAMIC shares, use those; otherwise use EXTERNAL shares
1148
1167
  const sharesToUse = dynamicShares.length > 0 ? dynamicShares : externalShares;
1149
- const backupLocation = dynamicShares.length > 0 ? core.BackupLocation.DYNAMIC : core.BackupLocation.EXTERNAL;
1168
+ const backupLocation = dynamicShares.length > 0 ? core$1.BackupLocation.DYNAMIC : core$1.BackupLocation.EXTERNAL;
1150
1169
  return {
1151
1170
  shares: {
1152
1171
  // EXTERNAL shares don't have externalKeyShareId (they're not uploaded to the API),
1153
1172
  // so we use their id for counting purposes instead of calling getRequiredExternalKeyShareId.
1154
- [backupLocation]: backupLocation === core.BackupLocation.DYNAMIC ? sharesToUse.map(core.getRequiredExternalKeyShareId) : sharesToUse.map((ks)=>ks.id || '')
1173
+ [backupLocation]: backupLocation === core$1.BackupLocation.DYNAMIC ? sharesToUse.map(core$1.getRequiredExternalKeyShareId) : sharesToUse.map((ks)=>ks.id || '')
1155
1174
  },
1156
1175
  requiredShareCount
1157
1176
  };
@@ -1199,7 +1218,7 @@ class DynamicWalletClient {
1199
1218
  walletOperation,
1200
1219
  shareCount
1201
1220
  });
1202
- const dynamicKeyShareIds = shares[core.BackupLocation.DYNAMIC] || [];
1221
+ const dynamicKeyShareIds = shares[core$1.BackupLocation.DYNAMIC] || [];
1203
1222
  if (dynamicKeyShareIds.length === 0) {
1204
1223
  this.logger.debug('No DYNAMIC shares available for recovery');
1205
1224
  return [];
@@ -1209,7 +1228,7 @@ class DynamicWalletClient {
1209
1228
  externalKeyShareIds: dynamicKeyShareIds,
1210
1229
  requiresSignedSessionId: false
1211
1230
  });
1212
- const dynamicKeyShares = data.keyShares.filter((keyShare)=>keyShare.encryptedAccountCredential !== null && keyShare.backupLocation === core.BackupLocation.DYNAMIC);
1231
+ const dynamicKeyShares = data.keyShares.filter((keyShare)=>keyShare.encryptedAccountCredential !== null && keyShare.backupLocation === core$1.BackupLocation.DYNAMIC);
1213
1232
  var _wallet_externalServerKeySharesBackupInfo_passwordEncrypted;
1214
1233
  const isPasswordEncrypted = (_wallet_externalServerKeySharesBackupInfo_passwordEncrypted = (_wallet_externalServerKeySharesBackupInfo = wallet.externalServerKeySharesBackupInfo) == null ? void 0 : _wallet_externalServerKeySharesBackupInfo.passwordEncrypted) != null ? _wallet_externalServerKeySharesBackupInfo_passwordEncrypted : false;
1215
1234
  if (isPasswordEncrypted && !password) {
@@ -1242,7 +1261,7 @@ class DynamicWalletClient {
1242
1261
  * @param accountAddress - The account address of the wallet to check
1243
1262
  * @param walletOperation - The wallet operation that determines required fields
1244
1263
  * @returns boolean indicating if wallet needs to be re-fetched and restored from server
1245
- */ async checkWalletFields({ accountAddress, walletOperation = core.WalletOperation.REACH_THRESHOLD, shareCount }) {
1264
+ */ async checkWalletFields({ accountAddress, walletOperation = core$1.WalletOperation.REACH_THRESHOLD, shareCount }) {
1246
1265
  var _existingWallet_externalServerKeyShares;
1247
1266
  let keyshareCheck = false;
1248
1267
  let walletCheck = false;
@@ -1311,11 +1330,11 @@ class DynamicWalletClient {
1311
1330
  await this.getWallet({
1312
1331
  accountAddress,
1313
1332
  password,
1314
- walletOperation: core.WalletOperation.NO_OPERATION
1333
+ walletOperation: core$1.WalletOperation.NO_OPERATION
1315
1334
  });
1316
1335
  if (await this.requiresPasswordForOperation({
1317
1336
  accountAddress,
1318
- walletOperation: core.WalletOperation.NO_OPERATION
1337
+ walletOperation: core$1.WalletOperation.NO_OPERATION
1319
1338
  }) && !password) {
1320
1339
  throw new Error('Password is required for operation but not provided');
1321
1340
  }
@@ -1337,7 +1356,7 @@ class DynamicWalletClient {
1337
1356
  await this.recoverEncryptedBackupByWallet({
1338
1357
  accountAddress,
1339
1358
  password,
1340
- walletOperation: core.WalletOperation.NO_OPERATION
1359
+ walletOperation: core$1.WalletOperation.NO_OPERATION
1341
1360
  });
1342
1361
  } catch (error) {
1343
1362
  this.logger.error('Error in verifying password', error);
@@ -1352,7 +1371,7 @@ class DynamicWalletClient {
1352
1371
  }
1353
1372
  /**
1354
1373
  * check if the operation requires a password
1355
- */ async requiresPasswordForOperation({ accountAddress, walletOperation = core.WalletOperation.REACH_THRESHOLD }) {
1374
+ */ async requiresPasswordForOperation({ accountAddress, walletOperation = core$1.WalletOperation.REACH_THRESHOLD }) {
1356
1375
  const isEncrypted = await this.isPasswordEncrypted({
1357
1376
  accountAddress
1358
1377
  });
@@ -1366,12 +1385,12 @@ class DynamicWalletClient {
1366
1385
  }
1367
1386
  /**
1368
1387
  * check if the operation requires restoring backup shares
1369
- */ async requiresRestoreBackupSharesForOperation({ accountAddress, walletOperation = core.WalletOperation.REACH_THRESHOLD }) {
1388
+ */ async requiresRestoreBackupSharesForOperation({ accountAddress, walletOperation = core$1.WalletOperation.REACH_THRESHOLD }) {
1370
1389
  const externalServerKeySharesBackupInfo = await this.getWalletExternalServerKeyShareBackupInfo({
1371
1390
  accountAddress
1372
1391
  });
1373
1392
  const externalServerKeyShares = this.walletMap[accountAddress].externalServerKeyShares || [];
1374
- if (walletOperation === core.WalletOperation.REACH_ALL_PARTIES || walletOperation === core.WalletOperation.REFRESH || walletOperation === core.WalletOperation.RESHARE) {
1393
+ if (walletOperation === core$1.WalletOperation.REACH_ALL_PARTIES || walletOperation === core$1.WalletOperation.REFRESH || walletOperation === core$1.WalletOperation.RESHARE) {
1375
1394
  return true;
1376
1395
  }
1377
1396
  const { shares, requiredShareCount } = this.recoverStrategy({
@@ -1379,8 +1398,8 @@ class DynamicWalletClient {
1379
1398
  thresholdSignatureScheme: this.walletMap[accountAddress].thresholdSignatureScheme,
1380
1399
  walletOperation
1381
1400
  });
1382
- const dynamicKeyShareIds = shares[core.BackupLocation.DYNAMIC] || [];
1383
- const externalKeyShareIds = shares[core.BackupLocation.EXTERNAL] || [];
1401
+ const dynamicKeyShareIds = shares[core$1.BackupLocation.DYNAMIC] || [];
1402
+ const externalKeyShareIds = shares[core$1.BackupLocation.EXTERNAL] || [];
1384
1403
  // Check if we have enough shares from either location
1385
1404
  const totalAvailableShares = externalServerKeyShares.length + dynamicKeyShareIds.length + externalKeyShareIds.length;
1386
1405
  if (totalAvailableShares >= requiredShareCount) {
@@ -1400,7 +1419,7 @@ class DynamicWalletClient {
1400
1419
  wallet = fetchedWallet;
1401
1420
  }
1402
1421
  // Return existing backup info if it exists
1403
- if (((_wallet_externalServerKeySharesBackupInfo = wallet.externalServerKeySharesBackupInfo) == null ? void 0 : (_wallet_externalServerKeySharesBackupInfo_backups = _wallet_externalServerKeySharesBackupInfo.backups) == null ? void 0 : (_wallet_externalServerKeySharesBackupInfo_backups_BackupLocation_DYNAMIC = _wallet_externalServerKeySharesBackupInfo_backups[core.BackupLocation.DYNAMIC]) == null ? void 0 : _wallet_externalServerKeySharesBackupInfo_backups_BackupLocation_DYNAMIC.length) > 0) {
1422
+ if (((_wallet_externalServerKeySharesBackupInfo = wallet.externalServerKeySharesBackupInfo) == null ? void 0 : (_wallet_externalServerKeySharesBackupInfo_backups = _wallet_externalServerKeySharesBackupInfo.backups) == null ? void 0 : (_wallet_externalServerKeySharesBackupInfo_backups_BackupLocation_DYNAMIC = _wallet_externalServerKeySharesBackupInfo_backups[core$1.BackupLocation.DYNAMIC]) == null ? void 0 : _wallet_externalServerKeySharesBackupInfo_backups_BackupLocation_DYNAMIC.length) > 0) {
1404
1423
  return wallet.externalServerKeySharesBackupInfo;
1405
1424
  }
1406
1425
  // Get backup info from server
@@ -1410,7 +1429,7 @@ class DynamicWalletClient {
1410
1429
  walletProperties: walletData == null ? void 0 : walletData.walletProperties
1411
1430
  });
1412
1431
  }
1413
- async getWallet({ accountAddress, walletOperation = core.WalletOperation.NO_OPERATION, shareCount = undefined, password = undefined }) {
1432
+ async getWallet({ accountAddress, walletOperation = core$1.WalletOperation.NO_OPERATION, shareCount = undefined, password = undefined }) {
1414
1433
  try {
1415
1434
  this.ensureApiClientAuthenticated();
1416
1435
  const existingWalletCheck = await this.checkWalletFields({
@@ -1429,7 +1448,7 @@ class DynamicWalletClient {
1429
1448
  this.logger.debug('Restoring wallet', wallet);
1430
1449
  // The wallet is already processed, so we can use it directly
1431
1450
  this.walletMap[accountAddress] = wallet;
1432
- if (walletOperation !== core.WalletOperation.NO_OPERATION && await this.requiresRestoreBackupSharesForOperation({
1451
+ if (walletOperation !== core$1.WalletOperation.NO_OPERATION && await this.requiresRestoreBackupSharesForOperation({
1433
1452
  accountAddress,
1434
1453
  walletOperation
1435
1454
  })) {
@@ -1536,14 +1555,14 @@ class DynamicWalletClient {
1536
1555
  var _vc_walletProperties_thresholdSignatureScheme;
1537
1556
  return {
1538
1557
  walletId: vc.id,
1539
- chainName: core.verifiedCredentialNameToChainEnum[vc.chain],
1558
+ chainName: core$1.verifiedCredentialNameToChainEnum[vc.chain],
1540
1559
  accountAddress: vc.address,
1541
1560
  externalServerKeySharesBackupInfo: getExternalServerKeyShareBackupInfo({
1542
1561
  walletProperties: vc.walletProperties
1543
1562
  }),
1544
1563
  externalServerKeyShares: ((_this_walletMap_vc_address = this.walletMap[vc.address]) == null ? void 0 : _this_walletMap_vc_address.externalServerKeyShares) || [],
1545
1564
  derivationPath: (_vc_walletProperties = vc.walletProperties) == null ? void 0 : _vc_walletProperties.derivationPath,
1546
- thresholdSignatureScheme: (_vc_walletProperties_thresholdSignatureScheme = (_vc_walletProperties1 = vc.walletProperties) == null ? void 0 : _vc_walletProperties1.thresholdSignatureScheme) != null ? _vc_walletProperties_thresholdSignatureScheme : core.ThresholdSignatureScheme.TWO_OF_TWO
1565
+ thresholdSignatureScheme: (_vc_walletProperties_thresholdSignatureScheme = (_vc_walletProperties1 = vc.walletProperties) == null ? void 0 : _vc_walletProperties1.thresholdSignatureScheme) != null ? _vc_walletProperties_thresholdSignatureScheme : core$1.ThresholdSignatureScheme.TWO_OF_TWO
1547
1566
  };
1548
1567
  });
1549
1568
  this.walletMap = wallets.reduce((acc, wallet)=>{
@@ -1581,61 +1600,65 @@ class DynamicWalletClient {
1581
1600
  }
1582
1601
  });
1583
1602
  }
1584
- constructor({ environmentId, baseApiUrl, baseMPCRelayApiUrl, debug, forwardMPCClient, enableMPCAccelerator = true }){
1585
- this.logger = logger;
1603
+ constructor({ environmentId, baseApiUrl, baseMPCRelayApiUrl, debug, forwardMPCClient, enableMPCAccelerator = true, logger: logger$1 }){
1586
1604
  this.walletMap = {} // todo: store in session storage
1587
1605
  ;
1588
1606
  this.isApiClientAuthenticated = false;
1589
1607
  this.forwardMPCEnabled = true;
1608
+ if (logger$1) {
1609
+ this.logger = logger$1;
1610
+ } else {
1611
+ const defaultLogger = new logger.Logger('DynamicWaasWalletClient');
1612
+ defaultLogger.setLogLevel(debug ? 'DEBUG' : 'INFO');
1613
+ this.logger = defaultLogger;
1614
+ }
1615
+ core$1.Logger.configure(this.logger);
1590
1616
  this.environmentId = environmentId;
1591
- this.baseApiUrl = baseApiUrl != null ? baseApiUrl : core.DYNAMIC_AUTH_PROD_BASE_API_URL;
1592
- const environment = core.getEnvironmentFromUrl(baseApiUrl);
1593
- this.baseMPCRelayApiUrl = baseMPCRelayApiUrl != null ? baseMPCRelayApiUrl : core.MPC_RELAY_URL_MAP[environment];
1617
+ this.baseApiUrl = baseApiUrl != null ? baseApiUrl : core$1.DYNAMIC_AUTH_PROD_BASE_API_URL;
1618
+ const environment = core$1.getEnvironmentFromUrl(baseApiUrl);
1619
+ this.baseMPCRelayApiUrl = baseMPCRelayApiUrl != null ? baseMPCRelayApiUrl : core$1.MPC_RELAY_URL_MAP[environment];
1594
1620
  this.debug = Boolean(debug);
1595
- this.logger.setLogLevel(this.debug ? 'DEBUG' : DEFAULT_LOG_LEVEL);
1596
1621
  this.forwardMPCEnabled = enableMPCAccelerator || Boolean(forwardMPCClient);
1597
1622
  this.resolvedForwardMPCClient = forwardMPCClient != null ? forwardMPCClient : (()=>{
1598
1623
  if (!this.forwardMPCEnabled) return undefined;
1599
- const environment = core.getEnvironmentFromUrl(baseApiUrl);
1600
- const enclaveUrl = core.DYNAMIC_FORWARD_MPC_ENCLAVE_URL_MAP[environment];
1624
+ const environment = core$1.getEnvironmentFromUrl(baseApiUrl);
1625
+ const enclaveUrl = core$1.DYNAMIC_FORWARD_MPC_ENCLAVE_URL_MAP[environment];
1601
1626
  if (!enclaveUrl) throw new Error(`No ForwardMPC enclave URL configured for environment: ${environment}`);
1602
1627
  return new forwardMpcClient.ForwardMPCClientV2(enclaveUrl, {
1603
1628
  reconnectInterval: 5000,
1604
1629
  reconnectAttempts: 5,
1605
1630
  connectionTimeout: 10000,
1606
- attestationConfig: core.DYNAMIC_FORWARD_MPC_ENCLAVE_ATTESTATION_CONFIG_MAP[environment],
1631
+ attestationConfig: core$1.DYNAMIC_FORWARD_MPC_ENCLAVE_ATTESTATION_CONFIG_MAP[environment],
1607
1632
  logger: this.logger
1608
1633
  });
1609
1634
  })();
1610
1635
  // Initialize API client with forwardMPCClient
1611
- this.apiClient = new core.DynamicApiClient({
1636
+ this.apiClient = new core$1.DynamicApiClient({
1612
1637
  environmentId,
1613
1638
  baseApiUrl,
1614
- forwardMPCClient: this.resolvedForwardMPCClient
1639
+ forwardMPCClient: this.resolvedForwardMPCClient,
1640
+ logger: this.logger
1615
1641
  });
1616
- if (this.forwardMPCEnabled) {
1617
- this.apiClient.forwardMPCClient.connect().then(()=>{
1618
- this.logger.info('Optimistically Connected to ForwardMPC enclave', {
1619
- environmentId: this.environmentId
1620
- });
1621
- }).catch((error)=>{
1622
- this.logger.error('Error connecting to ForwardMPC enclave optimistically', {
1623
- error,
1624
- environmentId: this.environmentId
1625
- });
1626
- });
1627
- }
1628
1642
  }
1629
1643
  }
1630
1644
 
1631
- const createCore = ({ environmentId, baseApiUrl, baseMPCRelayApiUrl, debug = false })=>{
1632
- const coreLogger = logger;
1633
- coreLogger.setLogLevel(debug ? 'DEBUG' : DEFAULT_LOG_LEVEL);
1645
+ const createCore = ({ environmentId, baseApiUrl, baseMPCRelayApiUrl, debug = false, logger: logger$1 })=>{
1646
+ let coreLogger;
1647
+ if (logger$1) {
1648
+ coreLogger = logger$1;
1649
+ } else {
1650
+ const defaultLogger = new logger.Logger('DynamicWaasWalletClient');
1651
+ defaultLogger.setLogLevel(debug ? 'DEBUG' : 'INFO');
1652
+ coreLogger = defaultLogger;
1653
+ }
1654
+ core$1.Logger.configure(coreLogger);
1634
1655
  const createApiClient = (options = {})=>{
1635
- return new core.DynamicApiClient(_extends({
1656
+ return new core$1.DynamicApiClient(_extends({
1636
1657
  environmentId,
1637
1658
  baseApiUrl
1638
- }, options));
1659
+ }, options, {
1660
+ logger: coreLogger
1661
+ }));
1639
1662
  };
1640
1663
  return {
1641
1664
  environmentId,
@@ -1806,24 +1829,25 @@ const revokeDelegation = async (client, walletId)=>{
1806
1829
 
1807
1830
  Object.defineProperty(exports, "SOLANA_RPC_URL", {
1808
1831
  enumerable: true,
1809
- get: function () { return core.SOLANA_RPC_URL; }
1832
+ get: function () { return core$1.SOLANA_RPC_URL; }
1810
1833
  });
1811
1834
  Object.defineProperty(exports, "ThresholdSignatureScheme", {
1812
1835
  enumerable: true,
1813
- get: function () { return core.ThresholdSignatureScheme; }
1836
+ get: function () { return core$1.ThresholdSignatureScheme; }
1814
1837
  });
1815
1838
  Object.defineProperty(exports, "WalletOperation", {
1816
1839
  enumerable: true,
1817
- get: function () { return core.WalletOperation; }
1840
+ get: function () { return core$1.WalletOperation; }
1818
1841
  });
1819
1842
  Object.defineProperty(exports, "getMPCChainConfig", {
1820
1843
  enumerable: true,
1821
- get: function () { return core.getMPCChainConfig; }
1844
+ get: function () { return core$1.getMPCChainConfig; }
1822
1845
  });
1823
1846
  exports.DynamicWalletClient = DynamicWalletClient;
1824
1847
  exports.base64ToBytes = base64ToBytes;
1825
1848
  exports.bytesToBase64 = bytesToBase64;
1826
1849
  exports.createDelegatedWalletClient = createDelegatedWalletClient;
1850
+ exports.createLogError = createLogError;
1827
1851
  exports.delegatedSignMessage = delegatedSignMessage;
1828
1852
  exports.ensureBase64Padding = ensureBase64Padding;
1829
1853
  exports.formatEvmMessage = formatEvmMessage;
@@ -1832,13 +1856,14 @@ exports.getExternalServerKeyShareBackupInfo = getExternalServerKeyShareBackupInf
1832
1856
  exports.getMPCSignatureScheme = getMPCSignatureScheme;
1833
1857
  exports.getMPCSigner = getMPCSigner;
1834
1858
  exports.isHexString = isHexString;
1859
+ exports.logError = logError;
1835
1860
  exports.mergeUniqueKeyShares = mergeUniqueKeyShares;
1836
1861
  exports.retryPromise = retryPromise;
1837
1862
  exports.revokeDelegation = revokeDelegation;
1838
1863
  exports.stringToBytes = stringToBytes;
1839
- Object.keys(core$1).forEach(function (k) {
1864
+ Object.keys(core).forEach(function (k) {
1840
1865
  if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
1841
1866
  enumerable: true,
1842
- get: function () { return core$1[k]; }
1867
+ get: function () { return core[k]; }
1843
1868
  });
1844
1869
  });
package/index.esm.js CHANGED
@@ -1,11 +1,11 @@
1
1
  export * from '#internal/core';
2
- import { SigningAlgorithm, MPC_RELAY_PROD_API_URL, getMPCChainConfig, BackupLocation, DynamicApiClient, getClientThreshold, MPC_CONFIG, getTSSConfig, serializeMessageForForwardMPC, getEnvironmentFromUrl, MPC_RELAY_URL_MAP, WalletOperation, getServerWalletReshareConfig, getRequiredExternalKeyShareId, ThresholdSignatureScheme, verifiedCredentialNameToChainEnum, DYNAMIC_AUTH_PROD_BASE_API_URL, DYNAMIC_FORWARD_MPC_ENCLAVE_URL_MAP, DYNAMIC_FORWARD_MPC_ENCLAVE_ATTESTATION_CONFIG_MAP } from '@dynamic-labs-wallet/core';
2
+ import { SigningAlgorithm, MPC_RELAY_PROD_API_URL, getMPCChainConfig, BackupLocation, isAxiosError, handleAxiosError, Logger, DynamicApiClient, getClientThreshold, MPC_CONFIG, getTSSConfig, serializeMessageForForwardMPC, getEnvironmentFromUrl, MPC_RELAY_URL_MAP, WalletOperation, getServerWalletReshareConfig, getRequiredExternalKeyShareId, ThresholdSignatureScheme, verifiedCredentialNameToChainEnum, DYNAMIC_AUTH_PROD_BASE_API_URL, DYNAMIC_FORWARD_MPC_ENCLAVE_URL_MAP, DYNAMIC_FORWARD_MPC_ENCLAVE_ATTESTATION_CONFIG_MAP } from '@dynamic-labs-wallet/core';
3
3
  export { SOLANA_RPC_URL, ThresholdSignatureScheme, WalletOperation, getMPCChainConfig } from '@dynamic-labs-wallet/core';
4
4
  import { BIP340, ExportableEd25519, Ecdsa, MessageHash, EcdsaSignature, EcdsaKeygenResult, ExportableEd25519KeygenResult, BIP340KeygenResult } from '#internal/node';
5
+ import { Logger as Logger$1 } from '@dynamic-labs/logger';
5
6
  import { ForwardMPCClientV2 } from '@dynamic-labs-wallet/forward-mpc-client';
6
7
  import { v4 } from 'uuid';
7
8
  import crypto from 'crypto';
8
- import { Logger } from '@dynamic-labs/logger';
9
9
  import 'node:crypto';
10
10
 
11
11
  // Removed duplicate exports - these are already exported from #internal/core
@@ -41,8 +41,23 @@ function _extends() {
41
41
  return _extends.apply(this, arguments);
42
42
  }
43
43
 
44
- const logger = new Logger('DynamicWaasWalletClient');
45
-
44
+ const createLogError = (clientTag)=>({ message, error, context })=>logError({
45
+ message,
46
+ error,
47
+ context,
48
+ clientTag
49
+ });
50
+ const logError = ({ message, error, context, clientTag = 'node' })=>{
51
+ if (isAxiosError(error)) {
52
+ handleAxiosError(error, message, context);
53
+ return;
54
+ }
55
+ Logger.error(`[DynamicWaasWalletClient] Error in ${clientTag} client`, {
56
+ message,
57
+ error: error instanceof Error ? error.message : String(error),
58
+ context
59
+ });
60
+ };
46
61
  const bytesToBase64 = (arr)=>{
47
62
  return btoa(Array.from(arr, (b)=>String.fromCharCode(b)).join(''));
48
63
  };
@@ -125,7 +140,7 @@ const getExternalServerKeyShareBackupInfo = (params)=>{
125
140
  } catch (error) {
126
141
  attempts++;
127
142
  if (attempts === maxAttempts) {
128
- logger.error(`Failed to execute ${operationName} after ${maxAttempts} attempts`, _extends({}, logContext, {
143
+ Logger.error(`Failed to execute ${operationName} after ${maxAttempts} attempts`, _extends({}, logContext, {
129
144
  error
130
145
  }));
131
146
  throw error;
@@ -298,8 +313,6 @@ const getKey = async ({ password, salt, encryptionConfig })=>{
298
313
  }
299
314
  };
300
315
 
301
- const DEFAULT_LOG_LEVEL = 'INFO';
302
-
303
316
  class DynamicWalletClient {
304
317
  ensureApiClientAuthenticated() {
305
318
  if (!this.isApiClientAuthenticated) {
@@ -310,7 +323,8 @@ class DynamicWalletClient {
310
323
  const tmpClient = new DynamicApiClient({
311
324
  environmentId: this.environmentId,
312
325
  authToken,
313
- baseApiUrl: this.baseApiUrl
326
+ baseApiUrl: this.baseApiUrl,
327
+ logger: this.logger
314
328
  });
315
329
  const response = await tmpClient.authenticateApiToken({
316
330
  environmentId: this.environmentId
@@ -321,7 +335,8 @@ class DynamicWalletClient {
321
335
  environmentId: this.environmentId,
322
336
  authToken: jwtTokenAuth,
323
337
  baseApiUrl: this.baseApiUrl,
324
- forwardMPCClient: this.resolvedForwardMPCClient
338
+ forwardMPCClient: this.resolvedForwardMPCClient,
339
+ logger: this.logger
325
340
  });
326
341
  this.isApiClientAuthenticated = true;
327
342
  }
@@ -428,6 +443,8 @@ class DynamicWalletClient {
428
443
  environmentId: this.environmentId
429
444
  });
430
445
  throw error;
446
+ } finally{
447
+ this.apiClient.forwardMPCClient.disconnect();
431
448
  }
432
449
  }
433
450
  async externalServerKeyGen({ chainName, roomId, dynamicServerKeygenIds, externalServerInitKeygenResults, thresholdSignatureScheme, bitcoinConfig }) {
@@ -616,7 +633,7 @@ class DynamicWalletClient {
616
633
  isFormatted,
617
634
  chainName
618
635
  });
619
- this.logger.info('Forward MPC enabled, signing message with forward MPC');
636
+ this.logger.debug('Signing message with MPC Socket Client');
620
637
  const environment = getEnvironmentFromUrl(this.baseApiUrl);
621
638
  const defaultRelayUrl = MPC_RELAY_URL_MAP[environment];
622
639
  const { signature: signatureBytes } = await this.apiClient.forwardMPCClient.signMessage({
@@ -645,6 +662,8 @@ class DynamicWalletClient {
645
662
  dynamicRequestId
646
663
  });
647
664
  throw error;
665
+ } finally{
666
+ this.apiClient.forwardMPCClient.disconnect();
648
667
  }
649
668
  }
650
669
  async sign({ accountAddress, externalServerKeyShares, message, chainName, password = undefined, isFormatted = false, context, onError, bitcoinConfig }) {
@@ -1580,18 +1599,24 @@ class DynamicWalletClient {
1580
1599
  }
1581
1600
  });
1582
1601
  }
1583
- constructor({ environmentId, baseApiUrl, baseMPCRelayApiUrl, debug, forwardMPCClient, enableMPCAccelerator = true }){
1584
- this.logger = logger;
1602
+ constructor({ environmentId, baseApiUrl, baseMPCRelayApiUrl, debug, forwardMPCClient, enableMPCAccelerator = true, logger }){
1585
1603
  this.walletMap = {} // todo: store in session storage
1586
1604
  ;
1587
1605
  this.isApiClientAuthenticated = false;
1588
1606
  this.forwardMPCEnabled = true;
1607
+ if (logger) {
1608
+ this.logger = logger;
1609
+ } else {
1610
+ const defaultLogger = new Logger$1('DynamicWaasWalletClient');
1611
+ defaultLogger.setLogLevel(debug ? 'DEBUG' : 'INFO');
1612
+ this.logger = defaultLogger;
1613
+ }
1614
+ Logger.configure(this.logger);
1589
1615
  this.environmentId = environmentId;
1590
1616
  this.baseApiUrl = baseApiUrl != null ? baseApiUrl : DYNAMIC_AUTH_PROD_BASE_API_URL;
1591
1617
  const environment = getEnvironmentFromUrl(baseApiUrl);
1592
1618
  this.baseMPCRelayApiUrl = baseMPCRelayApiUrl != null ? baseMPCRelayApiUrl : MPC_RELAY_URL_MAP[environment];
1593
1619
  this.debug = Boolean(debug);
1594
- this.logger.setLogLevel(this.debug ? 'DEBUG' : DEFAULT_LOG_LEVEL);
1595
1620
  this.forwardMPCEnabled = enableMPCAccelerator || Boolean(forwardMPCClient);
1596
1621
  this.resolvedForwardMPCClient = forwardMPCClient != null ? forwardMPCClient : (()=>{
1597
1622
  if (!this.forwardMPCEnabled) return undefined;
@@ -1610,31 +1635,29 @@ class DynamicWalletClient {
1610
1635
  this.apiClient = new DynamicApiClient({
1611
1636
  environmentId,
1612
1637
  baseApiUrl,
1613
- forwardMPCClient: this.resolvedForwardMPCClient
1638
+ forwardMPCClient: this.resolvedForwardMPCClient,
1639
+ logger: this.logger
1614
1640
  });
1615
- if (this.forwardMPCEnabled) {
1616
- this.apiClient.forwardMPCClient.connect().then(()=>{
1617
- this.logger.info('Optimistically Connected to ForwardMPC enclave', {
1618
- environmentId: this.environmentId
1619
- });
1620
- }).catch((error)=>{
1621
- this.logger.error('Error connecting to ForwardMPC enclave optimistically', {
1622
- error,
1623
- environmentId: this.environmentId
1624
- });
1625
- });
1626
- }
1627
1641
  }
1628
1642
  }
1629
1643
 
1630
- const createCore = ({ environmentId, baseApiUrl, baseMPCRelayApiUrl, debug = false })=>{
1631
- const coreLogger = logger;
1632
- coreLogger.setLogLevel(debug ? 'DEBUG' : DEFAULT_LOG_LEVEL);
1644
+ const createCore = ({ environmentId, baseApiUrl, baseMPCRelayApiUrl, debug = false, logger })=>{
1645
+ let coreLogger;
1646
+ if (logger) {
1647
+ coreLogger = logger;
1648
+ } else {
1649
+ const defaultLogger = new Logger$1('DynamicWaasWalletClient');
1650
+ defaultLogger.setLogLevel(debug ? 'DEBUG' : 'INFO');
1651
+ coreLogger = defaultLogger;
1652
+ }
1653
+ Logger.configure(coreLogger);
1633
1654
  const createApiClient = (options = {})=>{
1634
1655
  return new DynamicApiClient(_extends({
1635
1656
  environmentId,
1636
1657
  baseApiUrl
1637
- }, options));
1658
+ }, options, {
1659
+ logger: coreLogger
1660
+ }));
1638
1661
  };
1639
1662
  return {
1640
1663
  environmentId,
@@ -1803,4 +1826,4 @@ const revokeDelegation = async (client, walletId)=>{
1803
1826
  }
1804
1827
  };
1805
1828
 
1806
- export { DynamicWalletClient, base64ToBytes, bytesToBase64, createDelegatedWalletClient, delegatedSignMessage, ensureBase64Padding, formatEvmMessage, formatMessage, getExternalServerKeyShareBackupInfo, getMPCSignatureScheme, getMPCSigner, isHexString, mergeUniqueKeyShares, retryPromise, revokeDelegation, stringToBytes };
1829
+ export { DynamicWalletClient, base64ToBytes, bytesToBase64, createDelegatedWalletClient, createLogError, delegatedSignMessage, ensureBase64Padding, formatEvmMessage, formatMessage, getExternalServerKeyShareBackupInfo, getMPCSignatureScheme, getMPCSigner, isHexString, logError, mergeUniqueKeyShares, retryPromise, revokeDelegation, stringToBytes };
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@dynamic-labs-wallet/node",
3
- "version": "0.0.310",
3
+ "version": "0.0.312",
4
4
  "license": "Licensed under the Dynamic Labs, Inc. Terms Of Service (https://www.dynamic.xyz/terms-conditions)",
5
5
  "type": "module",
6
6
  "dependencies": {
7
- "@dynamic-labs-wallet/core": "0.0.310",
8
- "@dynamic-labs-wallet/forward-mpc-client": "0.5.2",
7
+ "@dynamic-labs-wallet/core": "0.0.312",
8
+ "@dynamic-labs-wallet/forward-mpc-client": "0.5.4",
9
9
  "@dynamic-labs/logger": "^4.45.2",
10
10
  "@dynamic-labs/sdk-api-core": "^0.0.900",
11
11
  "uuid": "11.1.0",
package/src/client.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { BIP340KeygenResult, EcdsaKeygenResult, EcdsaSignature, MessageHash, type EcdsaPublicKey } from '#internal/node';
2
- import { BackupLocation, DynamicApiClient, ThresholdSignatureScheme, WalletOperation, type BitcoinConfig, type KeyShareBackupInfo, type RequestWithElevatedAccessToken } from '@dynamic-labs-wallet/core';
2
+ import { BackupLocation, DynamicApiClient, ThresholdSignatureScheme, type ILogger, WalletOperation, type BitcoinConfig, type KeyShareBackupInfo, type RequestWithElevatedAccessToken } from '@dynamic-labs-wallet/core';
3
3
  import { ForwardMPCClientV2 } from '@dynamic-labs-wallet/forward-mpc-client';
4
4
  import type { SignMessageContext } from '@dynamic-labs/sdk-api-core';
5
5
  import type { ServerKeyShare } from './mpc/index.js';
@@ -8,7 +8,7 @@ import type { DynamicWalletClientProps, WalletProperties } from './types.js';
8
8
  export declare class DynamicWalletClient {
9
9
  environmentId: string;
10
10
  debug: boolean;
11
- protected logger: import("@dynamic-labs/logger").Logger;
11
+ protected logger: ILogger;
12
12
  protected apiClient: DynamicApiClient;
13
13
  protected walletMap: Record<string, WalletProperties>;
14
14
  protected baseMPCRelayApiUrl?: string;
@@ -17,7 +17,7 @@ export declare class DynamicWalletClient {
17
17
  protected isApiClientAuthenticated: boolean;
18
18
  protected forwardMPCEnabled: boolean;
19
19
  protected resolvedForwardMPCClient: ForwardMPCClientV2 | undefined;
20
- constructor({ environmentId, baseApiUrl, baseMPCRelayApiUrl, debug, forwardMPCClient, enableMPCAccelerator, }: DynamicWalletClientProps);
20
+ constructor({ environmentId, baseApiUrl, baseMPCRelayApiUrl, debug, forwardMPCClient, enableMPCAccelerator, logger, }: DynamicWalletClientProps);
21
21
  private ensureApiClientAuthenticated;
22
22
  authenticateApiToken(authToken: string): Promise<void>;
23
23
  dynamicServerInitializeKeyGen({ chainName, externalServerKeygenIds, thresholdSignatureScheme, dynamicRequestId, skipLock, bitcoinConfig, onError, onCeremonyComplete, }: {
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../packages/src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,kBAAkB,EAElB,iBAAiB,EACjB,cAAc,EAGd,WAAW,EACX,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,cAAc,EAGd,gBAAgB,EAGhB,wBAAwB,EAExB,eAAe,EAUf,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,8BAA8B,EAEpC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,KAAK,EAAyB,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAI5F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAE7D,OAAO,KAAK,EAAE,wBAAwB,EAAE,gBAAgB,EAAE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ACnB;IA2DD;;;OAGG;IACG,kBAAkB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAqElF;;;OAGG;IACG,UAAU;IAgChB;;;;;;;;;OASG;IACH,SAAS,CAAC,wBAAwB,CAAC,EACjC,cAAc,EACd,QAAQ,EACR,SAAS,EACT,wBAAwB,EACxB,cAAc,EACd,eAAoB,GACrB,EAAE;QACD,cAAc,EAAE,MAAM,CAAC;QACvB,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,wBAAwB,EAAE,wBAAwB,CAAC;QACnD,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAC3C,GAAG,IAAI;CAqBT"}
@@ -1,15 +1,33 @@
1
- import { DynamicApiClient } from '@dynamic-labs-wallet/core';
2
- import { logger } from '../services/logger.js';
1
+ import { DynamicApiClient, type ILogger } from '@dynamic-labs-wallet/core';
3
2
  export type CoreConfig = {
4
3
  environmentId: string;
5
4
  baseApiUrl?: string;
6
5
  baseMPCRelayApiUrl?: string;
6
+ /**
7
+ * Enables verbose debug-level logging when `true`.
8
+ *
9
+ * Only applies to the built-in default logger. If you provide a custom
10
+ * `logger`, configure its verbosity directly — this flag has no effect on it.
11
+ *
12
+ * @default false
13
+ */
7
14
  debug?: boolean;
15
+ /**
16
+ * Custom logger for SDK diagnostic output.
17
+ *
18
+ * Accepts any object that implements `ILogger` (`debug`, `info`, `warn`, `error`).
19
+ * When provided, the SDK routes all internal logging through this instance.
20
+ * You are responsible for configuring its log level — the `debug` flag has
21
+ * no effect on custom loggers.
22
+ *
23
+ * When omitted, a built-in logger is used with verbosity controlled by `debug`.
24
+ */
25
+ logger?: ILogger;
8
26
  };
9
27
  export type Core = {
10
28
  environmentId: string;
11
29
  createApiClient: (options?: Partial<DynamicApiClientConfig>) => DynamicApiClient;
12
- logger: typeof logger;
30
+ logger: ILogger;
13
31
  baseMPCRelayApiUrl?: string;
14
32
  baseApiUrl?: string;
15
33
  debug: boolean;
@@ -21,5 +39,5 @@ export type DynamicApiClientConfig = {
21
39
  baseApiUrl?: string;
22
40
  sdkVersion?: string;
23
41
  };
24
- export declare const createCore: ({ environmentId, baseApiUrl, baseMPCRelayApiUrl, debug }: CoreConfig) => Core;
42
+ export declare const createCore: ({ environmentId, baseApiUrl, baseMPCRelayApiUrl, debug, logger, }: CoreConfig) => Core;
25
43
  //# sourceMappingURL=createCore.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createCore.d.ts","sourceRoot":"","sources":["../../src/core/createCore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAG/C,MAAM,MAAM,UAAU,GAAG;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,IAAI,GAAG;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,KAAK,gBAAgB,CAAC;IACjF,MAAM,EAAE,OAAO,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,UAAU,6DAAsE,UAAU,KAAG,IAoBzG,CAAC"}
1
+ {"version":3,"file":"createCore.d.ts","sourceRoot":"","sources":["../../src/core/createCore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAU,KAAK,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAGnF,MAAM,MAAM,UAAU,GAAG;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,IAAI,GAAG;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,KAAK,gBAAgB,CAAC;IACjF,MAAM,EAAE,OAAO,CAAC;IAChB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,UAAU,sEAMpB,UAAU,KAAG,IA4Bf,CAAC"}
package/src/types.d.ts CHANGED
@@ -1,13 +1,32 @@
1
- import type { ThresholdSignatureScheme, KeyShareBackupInfo } from '@dynamic-labs-wallet/core';
1
+ import type { ThresholdSignatureScheme, KeyShareBackupInfo, ILogger } from '@dynamic-labs-wallet/core';
2
2
  import type { ForwardMPCClientV2 } from '@dynamic-labs-wallet/forward-mpc-client';
3
3
  import type { ServerKeyShare } from './mpc/types.js';
4
4
  export interface DynamicWalletClientProps {
5
5
  environmentId: string;
6
6
  baseApiUrl?: string;
7
7
  baseMPCRelayApiUrl?: string;
8
+ /**
9
+ * Enables verbose debug-level logging when `true`.
10
+ *
11
+ * Only applies to the built-in default logger. If you provide a custom
12
+ * `logger`, configure its verbosity directly — this flag has no effect on it.
13
+ *
14
+ * @default false
15
+ */
8
16
  debug?: boolean;
9
17
  forwardMPCClient?: ForwardMPCClientV2;
10
18
  enableMPCAccelerator?: boolean;
19
+ /**
20
+ * Custom logger for SDK diagnostic output.
21
+ *
22
+ * Accepts any object that implements `ILogger` (`debug`, `info`, `warn`, `error`).
23
+ * When provided, the SDK routes all internal logging through this instance.
24
+ * You are responsible for configuring its log level — the `debug` flag has
25
+ * no effect on custom loggers.
26
+ *
27
+ * When omitted, a built-in logger is used with verbosity controlled by `debug`.
28
+ */
29
+ logger?: ILogger;
11
30
  }
12
31
  export interface WalletProperties {
13
32
  chainName: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../packages/src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC9F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAClF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,MAAM,WAAW,wBAAwB;IACvC,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,gBAAgB,CAAC,EAAE,kBAAkB,CAAC;IACtC,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,uBAAuB,EAAE,cAAc,EAAE,CAAC;IAC1C,wBAAwB,EAAE,wBAAwB,CAAC;IACnD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iCAAiC,EAAE,kBAAkB,CAAC;CACvD"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../packages/src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACvG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAClF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,MAAM,WAAW,wBAAwB;IACvC,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,gBAAgB,CAAC,EAAE,kBAAkB,CAAC;IACtC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,uBAAuB,EAAE,cAAc,EAAE,CAAC;IAC1C,wBAAwB,EAAE,wBAAwB,CAAC;IACnD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iCAAiC,EAAE,kBAAkB,CAAC;CACvD"}
package/src/utils.d.ts CHANGED
@@ -1,6 +1,17 @@
1
1
  import { MessageHash } from '#internal/node';
2
2
  import { type KeyShareBackupInfo, type WaasWalletProperties } from '@dynamic-labs-wallet/core';
3
3
  import type { ServerKeyShare } from './mpc/types.js';
4
+ export declare const createLogError: (clientTag: string) => ({ message, error, context }: {
5
+ message: string;
6
+ error: Error;
7
+ context: Record<string, unknown>;
8
+ }) => void;
9
+ export declare const logError: ({ message, error, context, clientTag, }: {
10
+ message: string;
11
+ error: Error;
12
+ context: Record<string, unknown>;
13
+ clientTag?: string;
14
+ }) => void;
4
15
  export declare const bytesToBase64: (arr: Uint8Array) => string;
5
16
  export declare const stringToBytes: (str: string) => Uint8Array;
6
17
  export declare const base64ToBytes: (base64: string) => Uint8Array;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../packages/src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAGL,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EAC1B,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGrD,eAAO,MAAM,aAAa,QAAS,UAAU,WAE5C,CAAC;AAEF,eAAO,MAAM,aAAa,QAAS,MAAM,eAExC,CAAC;AAEF,eAAO,MAAM,aAAa,WAAY,MAAM,eAE3C,CAAC;AAGF,eAAO,MAAM,mBAAmB,QAAS,MAAM,KAAG,MAEjD,CAAC;AAEF,eAAO,MAAM,WAAW,QAAS,MAAM,YAKtC,CAAC;AAEF,eAAO,MAAM,mCAAmC,YAAa;IAC3D,gBAAgB,EAAE,oBAAoB,CAAC;CACxC,KAAG,kBA2CH,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,sBACZ,cAAc,EAAE,gBACrB,cAAc,EAAE,KAC7B,cAAc,EAchB,CAAC;AAEF,UAAU,WAAW;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CA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MAAM,eAExC,CAAC;AAEF,eAAO,MAAM,aAAa,WAAY,MAAM,eAE3C,CAAC;AAGF,eAAO,MAAM,mBAAmB,QAAS,MAAM,KAAG,MAEjD,CAAC;AAEF,eAAO,MAAM,WAAW,QAAS,MAAM,YAKtC,CAAC;AAEF,eAAO,MAAM,mCAAmC,YAAa;IAC3D,gBAAgB,EAAE,oBAAoB,CAAC;CACxC,KAAG,kBA2CH,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,sBACZ,cAAc,EAAE,gBACrB,cAAc,EAAE,KAC7B,cAAc,EAchB,CAAC;AAEF,UAAU,WAAW;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAED;;;;;;;GAOG;AACH,wBAAsB,YAAY,CAAC,CAAC,EAClC,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAC3B,EAAE,WAAe,EAAE,aAAmB,EAAE,aAA2B,EAAE,UAAe,EAAE,GAAE,WAAgB,GACvG,OAAO,CAAC,CAAC,CAAC,CAuBZ;AACD,eAAO,MAAM,gBAAgB,YAAa,MAAM,GAAG,UAAU,gBAO5D,CAAC;AAyBF,eAAO,MAAM,aAAa,cAAe,MAAM,WAAW,MAAM,GAAG,UAAU,KAAG,MAAM,GAAG,UAAU,GAAG,WAarG,CAAC"}
@@ -1,3 +0,0 @@
1
- import { Logger } from '@dynamic-labs/logger';
2
- export declare const logger: Logger;
3
- //# sourceMappingURL=logger.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/services/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,eAAO,MAAM,MAAM,QAAwC,CAAC"}