@dynamic-labs-wallet/browser 0.0.88 → 0.0.90
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 +215 -64
- package/index.esm.js +204 -53
- package/package.json +7 -2
- package/src/client.d.ts.map +1 -1
- package/src/constants.d.ts +2 -1
- package/src/constants.d.ts.map +1 -1
- package/src/services/axiosErrorResponse.d.ts +4 -0
- package/src/services/axiosErrorResponse.d.ts.map +1 -0
- package/src/services/logger.d.ts +2 -0
- package/src/services/logger.d.ts.map +1 -1
- package/src/utils.d.ts.map +1 -1
package/index.cjs.js
CHANGED
|
@@ -4,6 +4,8 @@ var core = require('@dynamic-labs-wallet/core');
|
|
|
4
4
|
var web = require('./internal/web');
|
|
5
5
|
var sdkApiCore = require('@dynamic-labs/sdk-api-core');
|
|
6
6
|
var logger$1 = require('@dynamic-labs/logger');
|
|
7
|
+
var axios = require('axios');
|
|
8
|
+
var createHttpError = require('http-errors');
|
|
7
9
|
|
|
8
10
|
function _extends() {
|
|
9
11
|
_extends = Object.assign || function assign(target) {
|
|
@@ -37,11 +39,14 @@ const getMPCSigner = ({ chainName, baseRelayUrl })=>{
|
|
|
37
39
|
return signatureScheme;
|
|
38
40
|
};
|
|
39
41
|
|
|
40
|
-
const DEFAULT_LOG_LEVEL =
|
|
42
|
+
const DEFAULT_LOG_LEVEL = logger$1.LogLevel.DEBUG; //todo: change back to info when done debugging
|
|
41
43
|
const STORAGE_KEY = 'dynamic-waas-wallet-client';
|
|
42
44
|
const CLIENT_KEYSHARE_EXPORT_FILENAME_PREFIX = 'dynamicWalletKeyShareBackup';
|
|
43
45
|
|
|
44
46
|
const logger = new logger$1.Logger('DynamicWaasWalletClient', logger$1.LogLevel.DEBUG);
|
|
47
|
+
const setLoggerEnvironmentId = (environmentId)=>{
|
|
48
|
+
logger$1.Logger.setEnvironmentId(environmentId);
|
|
49
|
+
};
|
|
45
50
|
|
|
46
51
|
const bytesToBase64 = (arr)=>{
|
|
47
52
|
return btoa(Array.from(arr, (b)=>String.fromCharCode(b)).join(''));
|
|
@@ -126,7 +131,7 @@ const timeoutPromise = ({ timeInMs, activity = 'Ceremony' })=>{
|
|
|
126
131
|
attempts++;
|
|
127
132
|
if (attempts === maxAttempts) {
|
|
128
133
|
logger.error(`Failed to execute ${operationName} after ${maxAttempts} attempts`, _extends({}, logContext, {
|
|
129
|
-
error
|
|
134
|
+
error: error instanceof Error ? error.message : 'Unknown error'
|
|
130
135
|
}));
|
|
131
136
|
throw error;
|
|
132
137
|
}
|
|
@@ -462,11 +467,11 @@ const localStorageWriteTest = {
|
|
|
462
467
|
jsonData: backupData
|
|
463
468
|
}));
|
|
464
469
|
} catch (error) {
|
|
465
|
-
logger.error('Failed to upload keyshares to Google Drive App Storage', {
|
|
470
|
+
logger.error('[DynamicWaasWalletClient] Failed to upload keyshares to Google Drive App Storage', {
|
|
466
471
|
accountAddress,
|
|
467
472
|
error
|
|
468
473
|
});
|
|
469
|
-
throw new Error(`Failed to backup keyshares to Google Drive App Storage: ${error instanceof Error ? error.message : String(error)}`);
|
|
474
|
+
throw new Error(`[DynamicWaasWalletClient] Failed to backup keyshares to Google Drive App Storage: ${error instanceof Error ? error.message : String(error)}`);
|
|
470
475
|
}
|
|
471
476
|
try {
|
|
472
477
|
await retryPromise(()=>uploadFileToGoogleDrivePersonal({
|
|
@@ -475,11 +480,34 @@ const localStorageWriteTest = {
|
|
|
475
480
|
jsonData: backupData
|
|
476
481
|
}));
|
|
477
482
|
} catch (error) {
|
|
478
|
-
logger.error('Failed to upload keyshares to Google Drive Personal', {
|
|
483
|
+
logger.error('[DynamicWaasWalletClient] Failed to upload keyshares to Google Drive Personal', {
|
|
479
484
|
accountAddress,
|
|
480
485
|
error
|
|
481
486
|
});
|
|
482
|
-
throw new Error(`Failed to backup keyshares to Google Drive Personal: ${error instanceof Error ? error.message : String(error)}`);
|
|
487
|
+
throw new Error(`[DynamicWaasWalletClient] Failed to backup keyshares to Google Drive Personal: ${error instanceof Error ? error.message : String(error)}`);
|
|
488
|
+
}
|
|
489
|
+
};
|
|
490
|
+
|
|
491
|
+
const handleAxiosError = (error, message, context)=>{
|
|
492
|
+
var _error_response, _error_response1;
|
|
493
|
+
logger.debug("[DynamicWaasWalletClient] Axios error: " + message, {
|
|
494
|
+
error: (_error_response = error.response) == null ? void 0 : _error_response.status,
|
|
495
|
+
message: error.message,
|
|
496
|
+
context
|
|
497
|
+
});
|
|
498
|
+
switch((_error_response1 = error.response) == null ? void 0 : _error_response1.status){
|
|
499
|
+
case 400:
|
|
500
|
+
throw createHttpError(400, 'Invalid request');
|
|
501
|
+
case 401:
|
|
502
|
+
throw createHttpError(401, 'Authorization header or cookie is required');
|
|
503
|
+
case 403:
|
|
504
|
+
throw createHttpError(403, 'Forbidden');
|
|
505
|
+
case 422:
|
|
506
|
+
throw createHttpError(422, 'Unprocessable content');
|
|
507
|
+
case 500:
|
|
508
|
+
throw createHttpError(500, 'Internal server error');
|
|
509
|
+
default:
|
|
510
|
+
throw createHttpError(500, 'Internal server error');
|
|
483
511
|
}
|
|
484
512
|
};
|
|
485
513
|
|
|
@@ -488,10 +516,11 @@ class DynamicWalletClient {
|
|
|
488
516
|
if (this.initializePromise) {
|
|
489
517
|
return await this.initializePromise;
|
|
490
518
|
}
|
|
491
|
-
this.
|
|
519
|
+
setLoggerEnvironmentId(this.environmentId);
|
|
520
|
+
this.logger.debug('[DynamicWaasWalletClient] Initializing Dynamic Waas Wallet SDK');
|
|
492
521
|
this.initializePromise = this._initialize();
|
|
493
522
|
const result = await this.initializePromise;
|
|
494
|
-
this.logger.debug('Dynamic Waas Wallet SDK initialized');
|
|
523
|
+
this.logger.debug('[DynamicWaasWalletClient] Dynamic Waas Wallet SDK initialized');
|
|
495
524
|
return result;
|
|
496
525
|
}
|
|
497
526
|
/**
|
|
@@ -630,10 +659,18 @@ class DynamicWalletClient {
|
|
|
630
659
|
clientKeyShares
|
|
631
660
|
};
|
|
632
661
|
} catch (error) {
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
662
|
+
const message = "[DynamicWaasWalletClient] Error in keyGen";
|
|
663
|
+
const context = {
|
|
664
|
+
chainName,
|
|
665
|
+
thresholdSignatureScheme
|
|
666
|
+
};
|
|
667
|
+
if (error instanceof axios.AxiosError) {
|
|
668
|
+
handleAxiosError(error, message, context);
|
|
636
669
|
}
|
|
670
|
+
this.logger.error(message, {
|
|
671
|
+
error,
|
|
672
|
+
context
|
|
673
|
+
});
|
|
637
674
|
throw error;
|
|
638
675
|
}
|
|
639
676
|
}
|
|
@@ -703,10 +740,18 @@ class DynamicWalletClient {
|
|
|
703
740
|
clientKeyShares: clientKeygenResults
|
|
704
741
|
};
|
|
705
742
|
} catch (error) {
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
743
|
+
const message = "[DynamicWaasWalletClient] Error in importRawPrivateKey";
|
|
744
|
+
const context = {
|
|
745
|
+
chainName,
|
|
746
|
+
thresholdSignatureScheme
|
|
747
|
+
};
|
|
748
|
+
if (error instanceof axios.AxiosError) {
|
|
749
|
+
handleAxiosError(error, message, context);
|
|
709
750
|
}
|
|
751
|
+
this.logger.error(message, {
|
|
752
|
+
error,
|
|
753
|
+
context
|
|
754
|
+
});
|
|
710
755
|
throw error;
|
|
711
756
|
}
|
|
712
757
|
}
|
|
@@ -739,7 +784,13 @@ class DynamicWalletClient {
|
|
|
739
784
|
const signature = await mpcSigner.sign(roomId, keyShare, formattedMessage, derivationPath);
|
|
740
785
|
return signature;
|
|
741
786
|
} catch (error) {
|
|
742
|
-
this.logger.error('[DynamicWaasWalletClient]
|
|
787
|
+
this.logger.error('[DynamicWaasWalletClient] Error in clientSign', {
|
|
788
|
+
error,
|
|
789
|
+
chainName,
|
|
790
|
+
roomId,
|
|
791
|
+
derivationPath,
|
|
792
|
+
isFormatted
|
|
793
|
+
});
|
|
743
794
|
throw error;
|
|
744
795
|
}
|
|
745
796
|
}
|
|
@@ -792,10 +843,20 @@ class DynamicWalletClient {
|
|
|
792
843
|
});
|
|
793
844
|
return signature;
|
|
794
845
|
} catch (error) {
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
846
|
+
const message = "[DynamicWaasWalletClient] Error in sign";
|
|
847
|
+
const context = {
|
|
848
|
+
accountAddress,
|
|
849
|
+
chainName,
|
|
850
|
+
isFormatted: isFormatted ? 'true' : 'false',
|
|
851
|
+
signedSessionId
|
|
852
|
+
};
|
|
853
|
+
if (error instanceof axios.AxiosError) {
|
|
854
|
+
handleAxiosError(error, message, context);
|
|
798
855
|
}
|
|
856
|
+
this.logger.error(message, {
|
|
857
|
+
error,
|
|
858
|
+
context
|
|
859
|
+
});
|
|
799
860
|
throw error;
|
|
800
861
|
}
|
|
801
862
|
}
|
|
@@ -840,10 +901,18 @@ class DynamicWalletClient {
|
|
|
840
901
|
signedSessionId
|
|
841
902
|
});
|
|
842
903
|
} catch (error) {
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
904
|
+
const message = "[DynamicWaasWalletClient] Error in refreshWalletAccountShares";
|
|
905
|
+
const context = {
|
|
906
|
+
accountAddress,
|
|
907
|
+
chainName
|
|
908
|
+
};
|
|
909
|
+
if (error instanceof axios.AxiosError) {
|
|
910
|
+
handleAxiosError(error, message, context);
|
|
846
911
|
}
|
|
912
|
+
this.logger.error(message, {
|
|
913
|
+
error,
|
|
914
|
+
context
|
|
915
|
+
});
|
|
847
916
|
throw error;
|
|
848
917
|
}
|
|
849
918
|
}
|
|
@@ -963,10 +1032,20 @@ class DynamicWalletClient {
|
|
|
963
1032
|
signedSessionId
|
|
964
1033
|
});
|
|
965
1034
|
} catch (error) {
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
1035
|
+
const message = "[DynamicWaasWalletClient] Error in reshare";
|
|
1036
|
+
const context = {
|
|
1037
|
+
accountAddress,
|
|
1038
|
+
chainName,
|
|
1039
|
+
oldThresholdSignatureScheme,
|
|
1040
|
+
newThresholdSignatureScheme
|
|
1041
|
+
};
|
|
1042
|
+
if (error instanceof axios.AxiosError) {
|
|
1043
|
+
handleAxiosError(error, message, context);
|
|
969
1044
|
}
|
|
1045
|
+
this.logger.error(message, {
|
|
1046
|
+
error,
|
|
1047
|
+
context
|
|
1048
|
+
});
|
|
970
1049
|
throw error;
|
|
971
1050
|
}
|
|
972
1051
|
}
|
|
@@ -1024,10 +1103,20 @@ class DynamicWalletClient {
|
|
|
1024
1103
|
derivedPrivateKey
|
|
1025
1104
|
};
|
|
1026
1105
|
} catch (error) {
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1106
|
+
const message = "[DynamicWaasWalletClient] Error in exportKey";
|
|
1107
|
+
const context = {
|
|
1108
|
+
accountAddress,
|
|
1109
|
+
chainName,
|
|
1110
|
+
password,
|
|
1111
|
+
signedSessionId
|
|
1112
|
+
};
|
|
1113
|
+
if (error instanceof axios.AxiosError) {
|
|
1114
|
+
handleAxiosError(error, message, context);
|
|
1030
1115
|
}
|
|
1116
|
+
this.logger.error(message, {
|
|
1117
|
+
error,
|
|
1118
|
+
context
|
|
1119
|
+
});
|
|
1031
1120
|
throw error;
|
|
1032
1121
|
}
|
|
1033
1122
|
}
|
|
@@ -1067,7 +1156,7 @@ class DynamicWalletClient {
|
|
|
1067
1156
|
rawPublicKey
|
|
1068
1157
|
};
|
|
1069
1158
|
} catch (error) {
|
|
1070
|
-
this.logger.error('[DynamicWaasWalletClient]
|
|
1159
|
+
this.logger.error('[DynamicWaasWalletClient] Error in offlineExportKey', error);
|
|
1071
1160
|
throw error;
|
|
1072
1161
|
}
|
|
1073
1162
|
}
|
|
@@ -1087,7 +1176,7 @@ class DynamicWalletClient {
|
|
|
1087
1176
|
var _this_storage;
|
|
1088
1177
|
const walletObject = await ((_this_storage = this.storage) == null ? void 0 : _this_storage.getItem(accountAddress));
|
|
1089
1178
|
if (!walletObject) {
|
|
1090
|
-
this.logger.debug(`No item found in iframe local storage for accountAddress: ${accountAddress}`);
|
|
1179
|
+
this.logger.debug(`[DynamicWaasWalletClient] No item found in iframe local storage for accountAddress: ${accountAddress}`);
|
|
1091
1180
|
return [];
|
|
1092
1181
|
}
|
|
1093
1182
|
try {
|
|
@@ -1099,7 +1188,7 @@ class DynamicWalletClient {
|
|
|
1099
1188
|
}
|
|
1100
1189
|
return (parsedWalletObject == null ? void 0 : parsedWalletObject.clientKeyShares) || [];
|
|
1101
1190
|
} catch (error) {
|
|
1102
|
-
this.logger.error(`Error parsing clientKeyShares: ${error} for accountAddress: ${accountAddress}`);
|
|
1191
|
+
this.logger.error(`[DynamicWaasWalletClient] Error parsing clientKeyShares: ${error} for accountAddress: ${accountAddress}`);
|
|
1103
1192
|
return [];
|
|
1104
1193
|
}
|
|
1105
1194
|
}
|
|
@@ -1141,6 +1230,7 @@ class DynamicWalletClient {
|
|
|
1141
1230
|
password
|
|
1142
1231
|
})));
|
|
1143
1232
|
if (!this.walletMap[accountAddress].walletId) {
|
|
1233
|
+
this.logger.error(`[DynamicWaasWalletClient] WalletId not found for accountAddress: ${accountAddress}`);
|
|
1144
1234
|
throw new Error(`WalletId not found for accountAddress: ${accountAddress}`);
|
|
1145
1235
|
}
|
|
1146
1236
|
// TODO(zfaizal2): throw error if signedSessionId is not provided after service deploy
|
|
@@ -1175,10 +1265,20 @@ class DynamicWalletClient {
|
|
|
1175
1265
|
await this.storage.setItem(this.storageKey, JSON.stringify(this.walletMap));
|
|
1176
1266
|
return data;
|
|
1177
1267
|
} catch (error) {
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1268
|
+
const message = "[DynamicWaasWalletClient] Error in storeEncryptedBackupByWallet";
|
|
1269
|
+
const context = {
|
|
1270
|
+
accountAddress,
|
|
1271
|
+
clientKeyShares,
|
|
1272
|
+
password,
|
|
1273
|
+
signedSessionId
|
|
1274
|
+
};
|
|
1275
|
+
if (error instanceof axios.AxiosError) {
|
|
1276
|
+
handleAxiosError(error, message, context);
|
|
1181
1277
|
}
|
|
1278
|
+
this.logger.error(message, {
|
|
1279
|
+
error,
|
|
1280
|
+
context
|
|
1281
|
+
});
|
|
1182
1282
|
throw error;
|
|
1183
1283
|
}
|
|
1184
1284
|
}
|
|
@@ -1191,11 +1291,7 @@ class DynamicWalletClient {
|
|
|
1191
1291
|
}), {
|
|
1192
1292
|
operationName: 'store encrypted backup',
|
|
1193
1293
|
logContext: {
|
|
1194
|
-
walletAddress: accountAddress
|
|
1195
|
-
keyShares: clientKeyShares == null ? void 0 : clientKeyShares.map((keyShare)=>this.encryptKeyShare({
|
|
1196
|
-
keyShare,
|
|
1197
|
-
password
|
|
1198
|
-
}))
|
|
1294
|
+
walletAddress: accountAddress
|
|
1199
1295
|
}
|
|
1200
1296
|
});
|
|
1201
1297
|
}
|
|
@@ -1239,10 +1335,16 @@ class DynamicWalletClient {
|
|
|
1239
1335
|
}
|
|
1240
1336
|
return oauthAccountId;
|
|
1241
1337
|
} catch (error) {
|
|
1242
|
-
|
|
1243
|
-
if (error instanceof
|
|
1244
|
-
|
|
1338
|
+
const message = "[DynamicWaasWalletClient] Error in getGoogleOauthAccountIdOrThrow";
|
|
1339
|
+
if (error instanceof axios.AxiosError) {
|
|
1340
|
+
handleAxiosError(error, message, {
|
|
1341
|
+
accountAddress
|
|
1342
|
+
});
|
|
1245
1343
|
}
|
|
1344
|
+
this.logger.error(message, {
|
|
1345
|
+
error,
|
|
1346
|
+
accountAddress
|
|
1347
|
+
});
|
|
1246
1348
|
throw error;
|
|
1247
1349
|
}
|
|
1248
1350
|
}
|
|
@@ -1304,7 +1406,22 @@ class DynamicWalletClient {
|
|
|
1304
1406
|
}
|
|
1305
1407
|
return decryptedKeyShares;
|
|
1306
1408
|
} catch (error) {
|
|
1307
|
-
|
|
1409
|
+
const message = "[DynamicWaasWalletClient] Error in recoverEncryptedBackupByWallet";
|
|
1410
|
+
const context = {
|
|
1411
|
+
accountAddress,
|
|
1412
|
+
password,
|
|
1413
|
+
walletOperation,
|
|
1414
|
+
signedSessionId,
|
|
1415
|
+
shareCount,
|
|
1416
|
+
storeRecoveredShares
|
|
1417
|
+
};
|
|
1418
|
+
if (error instanceof axios.AxiosError) {
|
|
1419
|
+
handleAxiosError(error, message, context);
|
|
1420
|
+
}
|
|
1421
|
+
this.logger.error(message, {
|
|
1422
|
+
error,
|
|
1423
|
+
context
|
|
1424
|
+
});
|
|
1308
1425
|
throw error;
|
|
1309
1426
|
}
|
|
1310
1427
|
}
|
|
@@ -1364,10 +1481,19 @@ class DynamicWalletClient {
|
|
|
1364
1481
|
storageKey: this.storageKey
|
|
1365
1482
|
});
|
|
1366
1483
|
} catch (error) {
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1484
|
+
const message = "[DynamicWaasWalletClient] Error in backupKeySharesToGoogleDrive";
|
|
1485
|
+
const context = {
|
|
1486
|
+
accountAddress,
|
|
1487
|
+
password,
|
|
1488
|
+
signedSessionId
|
|
1489
|
+
};
|
|
1490
|
+
if (error instanceof axios.AxiosError) {
|
|
1491
|
+
handleAxiosError(error, message, context);
|
|
1370
1492
|
}
|
|
1493
|
+
this.logger.error(message, {
|
|
1494
|
+
error,
|
|
1495
|
+
context
|
|
1496
|
+
});
|
|
1371
1497
|
throw error;
|
|
1372
1498
|
}
|
|
1373
1499
|
}
|
|
@@ -1393,7 +1519,7 @@ class DynamicWalletClient {
|
|
|
1393
1519
|
fileName
|
|
1394
1520
|
}));
|
|
1395
1521
|
} catch (error) {
|
|
1396
|
-
this.logger.error('Failed to download backup from Google Drive', {
|
|
1522
|
+
this.logger.error('[DynamicWaasWalletClient] Failed to download backup from Google Drive', {
|
|
1397
1523
|
accountAddress,
|
|
1398
1524
|
fileName,
|
|
1399
1525
|
error
|
|
@@ -1401,7 +1527,7 @@ class DynamicWalletClient {
|
|
|
1401
1527
|
throw new Error('Failed to restore backup from Google Drive');
|
|
1402
1528
|
}
|
|
1403
1529
|
if (!backupData) {
|
|
1404
|
-
this.logger.error('No backup file found', {
|
|
1530
|
+
this.logger.error('[DynamicWaasWalletClient] No backup file found', {
|
|
1405
1531
|
accountAddress,
|
|
1406
1532
|
fileName
|
|
1407
1533
|
});
|
|
@@ -1409,7 +1535,7 @@ class DynamicWalletClient {
|
|
|
1409
1535
|
}
|
|
1410
1536
|
// Validate the backup data structure
|
|
1411
1537
|
if (!backupData.keyShares || !backupData.metadata) {
|
|
1412
|
-
this.logger.error('Invalid backup format: missing keyShares or metadata', {
|
|
1538
|
+
this.logger.error('[DynamicWaasWalletClient] Invalid backup format: missing keyShares or metadata', {
|
|
1413
1539
|
accountAddress,
|
|
1414
1540
|
fileName
|
|
1415
1541
|
});
|
|
@@ -1427,10 +1553,19 @@ class DynamicWalletClient {
|
|
|
1427
1553
|
});
|
|
1428
1554
|
return decryptedKeyShares;
|
|
1429
1555
|
} catch (error) {
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1556
|
+
const message = "[DynamicWaasWalletClient] Error in restoreBackupFromGoogleDrive";
|
|
1557
|
+
const context = {
|
|
1558
|
+
accountAddress,
|
|
1559
|
+
password,
|
|
1560
|
+
signedSessionId
|
|
1561
|
+
};
|
|
1562
|
+
if (error instanceof axios.AxiosError) {
|
|
1563
|
+
handleAxiosError(error, message, context);
|
|
1433
1564
|
}
|
|
1565
|
+
this.logger.error(message, {
|
|
1566
|
+
error,
|
|
1567
|
+
context
|
|
1568
|
+
});
|
|
1434
1569
|
throw error;
|
|
1435
1570
|
}
|
|
1436
1571
|
}
|
|
@@ -1616,10 +1751,16 @@ class DynamicWalletClient {
|
|
|
1616
1751
|
walletProperties: wallet == null ? void 0 : wallet.walletProperties
|
|
1617
1752
|
});
|
|
1618
1753
|
} catch (error) {
|
|
1619
|
-
|
|
1620
|
-
if (error instanceof
|
|
1621
|
-
|
|
1754
|
+
const message = "[DynamicWaasWalletClient] Error in getWalletClientKeyShareBackupInfo";
|
|
1755
|
+
if (error instanceof axios.AxiosError) {
|
|
1756
|
+
handleAxiosError(error, message, {
|
|
1757
|
+
accountAddress
|
|
1758
|
+
});
|
|
1622
1759
|
}
|
|
1760
|
+
this.logger.error(message, {
|
|
1761
|
+
error,
|
|
1762
|
+
accountAddress
|
|
1763
|
+
});
|
|
1623
1764
|
throw error;
|
|
1624
1765
|
}
|
|
1625
1766
|
}
|
|
@@ -1632,13 +1773,13 @@ class DynamicWalletClient {
|
|
|
1632
1773
|
shareCount
|
|
1633
1774
|
});
|
|
1634
1775
|
if (existingWalletCheck) {
|
|
1635
|
-
this.logger.debug(`Wallet ${accountAddress} already exists`);
|
|
1776
|
+
this.logger.debug(`[DynamicWaasWalletClient] Wallet ${accountAddress} already exists`);
|
|
1636
1777
|
return this.walletMap[accountAddress];
|
|
1637
1778
|
}
|
|
1638
1779
|
// Fetch and restore wallet from server
|
|
1639
1780
|
const user = await this.apiClient.getUser();
|
|
1640
1781
|
const wallet = (_user_verifiedCredentials = user.verifiedCredentials) == null ? void 0 : _user_verifiedCredentials.find((vc)=>vc.address.toLowerCase() === accountAddress.toLowerCase());
|
|
1641
|
-
this.logger.debug('Restoring wallet', wallet);
|
|
1782
|
+
this.logger.debug('[DynamicWaasWalletClient] Restoring wallet', wallet);
|
|
1642
1783
|
const walletProperties = wallet.walletProperties;
|
|
1643
1784
|
this.walletMap[accountAddress] = _extends({}, this.walletMap[accountAddress], {
|
|
1644
1785
|
walletId: wallet.id,
|
|
@@ -1669,7 +1810,7 @@ class DynamicWalletClient {
|
|
|
1669
1810
|
accountAddress,
|
|
1670
1811
|
clientKeyShares: mergeUniqueKeyShares(existingKeyShares, decryptedKeyShares)
|
|
1671
1812
|
});
|
|
1672
|
-
this.logger.debug('Recovered backup', decryptedKeyShares);
|
|
1813
|
+
this.logger.debug('[DynamicWaasWalletClient] Recovered backup', decryptedKeyShares);
|
|
1673
1814
|
}
|
|
1674
1815
|
const walletCount = Object.keys(this.walletMap).length;
|
|
1675
1816
|
if (walletCount === 0) {
|
|
@@ -1681,9 +1822,16 @@ class DynamicWalletClient {
|
|
|
1681
1822
|
}
|
|
1682
1823
|
return this.walletMap[accountAddress];
|
|
1683
1824
|
} catch (error) {
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1825
|
+
const message = "[DynamicWaasWalletClient] Error in getWallet";
|
|
1826
|
+
const context = {
|
|
1827
|
+
accountAddress,
|
|
1828
|
+
walletOperation,
|
|
1829
|
+
shareCount,
|
|
1830
|
+
password,
|
|
1831
|
+
signedSessionId
|
|
1832
|
+
};
|
|
1833
|
+
if (error instanceof axios.AxiosError) {
|
|
1834
|
+
handleAxiosError(error, message, context);
|
|
1687
1835
|
}
|
|
1688
1836
|
throw error;
|
|
1689
1837
|
}
|
|
@@ -1722,10 +1870,13 @@ class DynamicWalletClient {
|
|
|
1722
1870
|
}, {});
|
|
1723
1871
|
return wallets;
|
|
1724
1872
|
} catch (error) {
|
|
1725
|
-
|
|
1726
|
-
if (error instanceof
|
|
1727
|
-
|
|
1873
|
+
const message = "[DynamicWaasWalletClient] Error in getWallets";
|
|
1874
|
+
if (error instanceof axios.AxiosError) {
|
|
1875
|
+
handleAxiosError(error, message, {});
|
|
1728
1876
|
}
|
|
1877
|
+
this.logger.error(message, {
|
|
1878
|
+
error
|
|
1879
|
+
});
|
|
1729
1880
|
throw error;
|
|
1730
1881
|
}
|
|
1731
1882
|
}
|
|
@@ -1745,7 +1896,7 @@ class DynamicWalletClient {
|
|
|
1745
1896
|
baseApiUrl
|
|
1746
1897
|
});
|
|
1747
1898
|
this.debug = Boolean(debug);
|
|
1748
|
-
this.logger.setLogLevel(this.debug ?
|
|
1899
|
+
this.logger.setLogLevel(this.debug ? logger$1.LogLevel.DEBUG : DEFAULT_LOG_LEVEL);
|
|
1749
1900
|
// setup storage
|
|
1750
1901
|
if (supportsLocalStorage()) {
|
|
1751
1902
|
this.storage = localStorageAdapter;
|
package/index.esm.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { SigningAlgorithm, MPC_RELAY_PROD_API_URL, getMPCChainConfig, BackupLocation, getClientThreshold, MPC_CONFIG,
|
|
1
|
+
import { SigningAlgorithm, MPC_RELAY_PROD_API_URL, getMPCChainConfig, BackupLocation, getClientThreshold, MPC_CONFIG, getTSSConfig, WalletOperation, getReshareConfig, DynamicApiClient, getEnvironmentFromUrl, IFRAME_DOMAIN_MAP } from '@dynamic-labs-wallet/core';
|
|
2
2
|
export * from '@dynamic-labs-wallet/core';
|
|
3
3
|
import { BIP340, ExportableEd25519, Ecdsa, MessageHash, EcdsaKeygenResult, ExportableEd25519KeygenResult, BIP340KeygenResult } from './internal/web';
|
|
4
4
|
export { BIP340, BIP340InitKeygenResult, BIP340KeygenResult, Ecdsa, EcdsaInitKeygenResult, EcdsaKeygenResult, EcdsaPublicKey, EcdsaSignature, Ed25519, Ed25519InitKeygenResult, Ed25519KeygenResult, MessageHash } from './internal/web';
|
|
5
5
|
import { ProviderEnum } from '@dynamic-labs/sdk-api-core';
|
|
6
|
-
import {
|
|
6
|
+
import { LogLevel, Logger } from '@dynamic-labs/logger';
|
|
7
|
+
import { AxiosError } from 'axios';
|
|
8
|
+
import createHttpError from 'http-errors';
|
|
7
9
|
|
|
8
10
|
function _extends() {
|
|
9
11
|
_extends = Object.assign || function assign(target) {
|
|
@@ -37,11 +39,14 @@ const getMPCSigner = ({ chainName, baseRelayUrl })=>{
|
|
|
37
39
|
return signatureScheme;
|
|
38
40
|
};
|
|
39
41
|
|
|
40
|
-
const DEFAULT_LOG_LEVEL =
|
|
42
|
+
const DEFAULT_LOG_LEVEL = LogLevel.DEBUG; //todo: change back to info when done debugging
|
|
41
43
|
const STORAGE_KEY = 'dynamic-waas-wallet-client';
|
|
42
44
|
const CLIENT_KEYSHARE_EXPORT_FILENAME_PREFIX = 'dynamicWalletKeyShareBackup';
|
|
43
45
|
|
|
44
46
|
const logger = new Logger('DynamicWaasWalletClient', LogLevel.DEBUG);
|
|
47
|
+
const setLoggerEnvironmentId = (environmentId)=>{
|
|
48
|
+
Logger.setEnvironmentId(environmentId);
|
|
49
|
+
};
|
|
45
50
|
|
|
46
51
|
const bytesToBase64 = (arr)=>{
|
|
47
52
|
return btoa(Array.from(arr, (b)=>String.fromCharCode(b)).join(''));
|
|
@@ -126,7 +131,7 @@ const timeoutPromise = ({ timeInMs, activity = 'Ceremony' })=>{
|
|
|
126
131
|
attempts++;
|
|
127
132
|
if (attempts === maxAttempts) {
|
|
128
133
|
logger.error(`Failed to execute ${operationName} after ${maxAttempts} attempts`, _extends({}, logContext, {
|
|
129
|
-
error
|
|
134
|
+
error: error instanceof Error ? error.message : 'Unknown error'
|
|
130
135
|
}));
|
|
131
136
|
throw error;
|
|
132
137
|
}
|
|
@@ -462,11 +467,11 @@ const localStorageWriteTest = {
|
|
|
462
467
|
jsonData: backupData
|
|
463
468
|
}));
|
|
464
469
|
} catch (error) {
|
|
465
|
-
logger.error('Failed to upload keyshares to Google Drive App Storage', {
|
|
470
|
+
logger.error('[DynamicWaasWalletClient] Failed to upload keyshares to Google Drive App Storage', {
|
|
466
471
|
accountAddress,
|
|
467
472
|
error
|
|
468
473
|
});
|
|
469
|
-
throw new Error(`Failed to backup keyshares to Google Drive App Storage: ${error instanceof Error ? error.message : String(error)}`);
|
|
474
|
+
throw new Error(`[DynamicWaasWalletClient] Failed to backup keyshares to Google Drive App Storage: ${error instanceof Error ? error.message : String(error)}`);
|
|
470
475
|
}
|
|
471
476
|
try {
|
|
472
477
|
await retryPromise(()=>uploadFileToGoogleDrivePersonal({
|
|
@@ -475,11 +480,34 @@ const localStorageWriteTest = {
|
|
|
475
480
|
jsonData: backupData
|
|
476
481
|
}));
|
|
477
482
|
} catch (error) {
|
|
478
|
-
logger.error('Failed to upload keyshares to Google Drive Personal', {
|
|
483
|
+
logger.error('[DynamicWaasWalletClient] Failed to upload keyshares to Google Drive Personal', {
|
|
479
484
|
accountAddress,
|
|
480
485
|
error
|
|
481
486
|
});
|
|
482
|
-
throw new Error(`Failed to backup keyshares to Google Drive Personal: ${error instanceof Error ? error.message : String(error)}`);
|
|
487
|
+
throw new Error(`[DynamicWaasWalletClient] Failed to backup keyshares to Google Drive Personal: ${error instanceof Error ? error.message : String(error)}`);
|
|
488
|
+
}
|
|
489
|
+
};
|
|
490
|
+
|
|
491
|
+
const handleAxiosError = (error, message, context)=>{
|
|
492
|
+
var _error_response, _error_response1;
|
|
493
|
+
logger.debug("[DynamicWaasWalletClient] Axios error: " + message, {
|
|
494
|
+
error: (_error_response = error.response) == null ? void 0 : _error_response.status,
|
|
495
|
+
message: error.message,
|
|
496
|
+
context
|
|
497
|
+
});
|
|
498
|
+
switch((_error_response1 = error.response) == null ? void 0 : _error_response1.status){
|
|
499
|
+
case 400:
|
|
500
|
+
throw createHttpError(400, 'Invalid request');
|
|
501
|
+
case 401:
|
|
502
|
+
throw createHttpError(401, 'Authorization header or cookie is required');
|
|
503
|
+
case 403:
|
|
504
|
+
throw createHttpError(403, 'Forbidden');
|
|
505
|
+
case 422:
|
|
506
|
+
throw createHttpError(422, 'Unprocessable content');
|
|
507
|
+
case 500:
|
|
508
|
+
throw createHttpError(500, 'Internal server error');
|
|
509
|
+
default:
|
|
510
|
+
throw createHttpError(500, 'Internal server error');
|
|
483
511
|
}
|
|
484
512
|
};
|
|
485
513
|
|
|
@@ -488,10 +516,11 @@ class DynamicWalletClient {
|
|
|
488
516
|
if (this.initializePromise) {
|
|
489
517
|
return await this.initializePromise;
|
|
490
518
|
}
|
|
491
|
-
this.
|
|
519
|
+
setLoggerEnvironmentId(this.environmentId);
|
|
520
|
+
this.logger.debug('[DynamicWaasWalletClient] Initializing Dynamic Waas Wallet SDK');
|
|
492
521
|
this.initializePromise = this._initialize();
|
|
493
522
|
const result = await this.initializePromise;
|
|
494
|
-
this.logger.debug('Dynamic Waas Wallet SDK initialized');
|
|
523
|
+
this.logger.debug('[DynamicWaasWalletClient] Dynamic Waas Wallet SDK initialized');
|
|
495
524
|
return result;
|
|
496
525
|
}
|
|
497
526
|
/**
|
|
@@ -630,10 +659,18 @@ class DynamicWalletClient {
|
|
|
630
659
|
clientKeyShares
|
|
631
660
|
};
|
|
632
661
|
} catch (error) {
|
|
633
|
-
|
|
662
|
+
const message = "[DynamicWaasWalletClient] Error in keyGen";
|
|
663
|
+
const context = {
|
|
664
|
+
chainName,
|
|
665
|
+
thresholdSignatureScheme
|
|
666
|
+
};
|
|
634
667
|
if (error instanceof AxiosError) {
|
|
635
|
-
handleAxiosError(error);
|
|
668
|
+
handleAxiosError(error, message, context);
|
|
636
669
|
}
|
|
670
|
+
this.logger.error(message, {
|
|
671
|
+
error,
|
|
672
|
+
context
|
|
673
|
+
});
|
|
637
674
|
throw error;
|
|
638
675
|
}
|
|
639
676
|
}
|
|
@@ -703,10 +740,18 @@ class DynamicWalletClient {
|
|
|
703
740
|
clientKeyShares: clientKeygenResults
|
|
704
741
|
};
|
|
705
742
|
} catch (error) {
|
|
706
|
-
|
|
743
|
+
const message = "[DynamicWaasWalletClient] Error in importRawPrivateKey";
|
|
744
|
+
const context = {
|
|
745
|
+
chainName,
|
|
746
|
+
thresholdSignatureScheme
|
|
747
|
+
};
|
|
707
748
|
if (error instanceof AxiosError) {
|
|
708
|
-
handleAxiosError(error);
|
|
749
|
+
handleAxiosError(error, message, context);
|
|
709
750
|
}
|
|
751
|
+
this.logger.error(message, {
|
|
752
|
+
error,
|
|
753
|
+
context
|
|
754
|
+
});
|
|
710
755
|
throw error;
|
|
711
756
|
}
|
|
712
757
|
}
|
|
@@ -739,7 +784,13 @@ class DynamicWalletClient {
|
|
|
739
784
|
const signature = await mpcSigner.sign(roomId, keyShare, formattedMessage, derivationPath);
|
|
740
785
|
return signature;
|
|
741
786
|
} catch (error) {
|
|
742
|
-
this.logger.error('[DynamicWaasWalletClient]
|
|
787
|
+
this.logger.error('[DynamicWaasWalletClient] Error in clientSign', {
|
|
788
|
+
error,
|
|
789
|
+
chainName,
|
|
790
|
+
roomId,
|
|
791
|
+
derivationPath,
|
|
792
|
+
isFormatted
|
|
793
|
+
});
|
|
743
794
|
throw error;
|
|
744
795
|
}
|
|
745
796
|
}
|
|
@@ -792,10 +843,20 @@ class DynamicWalletClient {
|
|
|
792
843
|
});
|
|
793
844
|
return signature;
|
|
794
845
|
} catch (error) {
|
|
795
|
-
|
|
846
|
+
const message = "[DynamicWaasWalletClient] Error in sign";
|
|
847
|
+
const context = {
|
|
848
|
+
accountAddress,
|
|
849
|
+
chainName,
|
|
850
|
+
isFormatted: isFormatted ? 'true' : 'false',
|
|
851
|
+
signedSessionId
|
|
852
|
+
};
|
|
796
853
|
if (error instanceof AxiosError) {
|
|
797
|
-
handleAxiosError(error);
|
|
854
|
+
handleAxiosError(error, message, context);
|
|
798
855
|
}
|
|
856
|
+
this.logger.error(message, {
|
|
857
|
+
error,
|
|
858
|
+
context
|
|
859
|
+
});
|
|
799
860
|
throw error;
|
|
800
861
|
}
|
|
801
862
|
}
|
|
@@ -840,10 +901,18 @@ class DynamicWalletClient {
|
|
|
840
901
|
signedSessionId
|
|
841
902
|
});
|
|
842
903
|
} catch (error) {
|
|
843
|
-
|
|
904
|
+
const message = "[DynamicWaasWalletClient] Error in refreshWalletAccountShares";
|
|
905
|
+
const context = {
|
|
906
|
+
accountAddress,
|
|
907
|
+
chainName
|
|
908
|
+
};
|
|
844
909
|
if (error instanceof AxiosError) {
|
|
845
|
-
handleAxiosError(error);
|
|
910
|
+
handleAxiosError(error, message, context);
|
|
846
911
|
}
|
|
912
|
+
this.logger.error(message, {
|
|
913
|
+
error,
|
|
914
|
+
context
|
|
915
|
+
});
|
|
847
916
|
throw error;
|
|
848
917
|
}
|
|
849
918
|
}
|
|
@@ -963,10 +1032,20 @@ class DynamicWalletClient {
|
|
|
963
1032
|
signedSessionId
|
|
964
1033
|
});
|
|
965
1034
|
} catch (error) {
|
|
966
|
-
|
|
1035
|
+
const message = "[DynamicWaasWalletClient] Error in reshare";
|
|
1036
|
+
const context = {
|
|
1037
|
+
accountAddress,
|
|
1038
|
+
chainName,
|
|
1039
|
+
oldThresholdSignatureScheme,
|
|
1040
|
+
newThresholdSignatureScheme
|
|
1041
|
+
};
|
|
967
1042
|
if (error instanceof AxiosError) {
|
|
968
|
-
handleAxiosError(error);
|
|
1043
|
+
handleAxiosError(error, message, context);
|
|
969
1044
|
}
|
|
1045
|
+
this.logger.error(message, {
|
|
1046
|
+
error,
|
|
1047
|
+
context
|
|
1048
|
+
});
|
|
970
1049
|
throw error;
|
|
971
1050
|
}
|
|
972
1051
|
}
|
|
@@ -1024,10 +1103,20 @@ class DynamicWalletClient {
|
|
|
1024
1103
|
derivedPrivateKey
|
|
1025
1104
|
};
|
|
1026
1105
|
} catch (error) {
|
|
1027
|
-
|
|
1106
|
+
const message = "[DynamicWaasWalletClient] Error in exportKey";
|
|
1107
|
+
const context = {
|
|
1108
|
+
accountAddress,
|
|
1109
|
+
chainName,
|
|
1110
|
+
password,
|
|
1111
|
+
signedSessionId
|
|
1112
|
+
};
|
|
1028
1113
|
if (error instanceof AxiosError) {
|
|
1029
|
-
handleAxiosError(error);
|
|
1114
|
+
handleAxiosError(error, message, context);
|
|
1030
1115
|
}
|
|
1116
|
+
this.logger.error(message, {
|
|
1117
|
+
error,
|
|
1118
|
+
context
|
|
1119
|
+
});
|
|
1031
1120
|
throw error;
|
|
1032
1121
|
}
|
|
1033
1122
|
}
|
|
@@ -1067,7 +1156,7 @@ class DynamicWalletClient {
|
|
|
1067
1156
|
rawPublicKey
|
|
1068
1157
|
};
|
|
1069
1158
|
} catch (error) {
|
|
1070
|
-
this.logger.error('[DynamicWaasWalletClient]
|
|
1159
|
+
this.logger.error('[DynamicWaasWalletClient] Error in offlineExportKey', error);
|
|
1071
1160
|
throw error;
|
|
1072
1161
|
}
|
|
1073
1162
|
}
|
|
@@ -1087,7 +1176,7 @@ class DynamicWalletClient {
|
|
|
1087
1176
|
var _this_storage;
|
|
1088
1177
|
const walletObject = await ((_this_storage = this.storage) == null ? void 0 : _this_storage.getItem(accountAddress));
|
|
1089
1178
|
if (!walletObject) {
|
|
1090
|
-
this.logger.debug(`No item found in iframe local storage for accountAddress: ${accountAddress}`);
|
|
1179
|
+
this.logger.debug(`[DynamicWaasWalletClient] No item found in iframe local storage for accountAddress: ${accountAddress}`);
|
|
1091
1180
|
return [];
|
|
1092
1181
|
}
|
|
1093
1182
|
try {
|
|
@@ -1099,7 +1188,7 @@ class DynamicWalletClient {
|
|
|
1099
1188
|
}
|
|
1100
1189
|
return (parsedWalletObject == null ? void 0 : parsedWalletObject.clientKeyShares) || [];
|
|
1101
1190
|
} catch (error) {
|
|
1102
|
-
this.logger.error(`Error parsing clientKeyShares: ${error} for accountAddress: ${accountAddress}`);
|
|
1191
|
+
this.logger.error(`[DynamicWaasWalletClient] Error parsing clientKeyShares: ${error} for accountAddress: ${accountAddress}`);
|
|
1103
1192
|
return [];
|
|
1104
1193
|
}
|
|
1105
1194
|
}
|
|
@@ -1141,6 +1230,7 @@ class DynamicWalletClient {
|
|
|
1141
1230
|
password
|
|
1142
1231
|
})));
|
|
1143
1232
|
if (!this.walletMap[accountAddress].walletId) {
|
|
1233
|
+
this.logger.error(`[DynamicWaasWalletClient] WalletId not found for accountAddress: ${accountAddress}`);
|
|
1144
1234
|
throw new Error(`WalletId not found for accountAddress: ${accountAddress}`);
|
|
1145
1235
|
}
|
|
1146
1236
|
// TODO(zfaizal2): throw error if signedSessionId is not provided after service deploy
|
|
@@ -1175,10 +1265,20 @@ class DynamicWalletClient {
|
|
|
1175
1265
|
await this.storage.setItem(this.storageKey, JSON.stringify(this.walletMap));
|
|
1176
1266
|
return data;
|
|
1177
1267
|
} catch (error) {
|
|
1178
|
-
|
|
1268
|
+
const message = "[DynamicWaasWalletClient] Error in storeEncryptedBackupByWallet";
|
|
1269
|
+
const context = {
|
|
1270
|
+
accountAddress,
|
|
1271
|
+
clientKeyShares,
|
|
1272
|
+
password,
|
|
1273
|
+
signedSessionId
|
|
1274
|
+
};
|
|
1179
1275
|
if (error instanceof AxiosError) {
|
|
1180
|
-
handleAxiosError(error);
|
|
1276
|
+
handleAxiosError(error, message, context);
|
|
1181
1277
|
}
|
|
1278
|
+
this.logger.error(message, {
|
|
1279
|
+
error,
|
|
1280
|
+
context
|
|
1281
|
+
});
|
|
1182
1282
|
throw error;
|
|
1183
1283
|
}
|
|
1184
1284
|
}
|
|
@@ -1191,11 +1291,7 @@ class DynamicWalletClient {
|
|
|
1191
1291
|
}), {
|
|
1192
1292
|
operationName: 'store encrypted backup',
|
|
1193
1293
|
logContext: {
|
|
1194
|
-
walletAddress: accountAddress
|
|
1195
|
-
keyShares: clientKeyShares == null ? void 0 : clientKeyShares.map((keyShare)=>this.encryptKeyShare({
|
|
1196
|
-
keyShare,
|
|
1197
|
-
password
|
|
1198
|
-
}))
|
|
1294
|
+
walletAddress: accountAddress
|
|
1199
1295
|
}
|
|
1200
1296
|
});
|
|
1201
1297
|
}
|
|
@@ -1239,10 +1335,16 @@ class DynamicWalletClient {
|
|
|
1239
1335
|
}
|
|
1240
1336
|
return oauthAccountId;
|
|
1241
1337
|
} catch (error) {
|
|
1242
|
-
|
|
1338
|
+
const message = "[DynamicWaasWalletClient] Error in getGoogleOauthAccountIdOrThrow";
|
|
1243
1339
|
if (error instanceof AxiosError) {
|
|
1244
|
-
handleAxiosError(error
|
|
1340
|
+
handleAxiosError(error, message, {
|
|
1341
|
+
accountAddress
|
|
1342
|
+
});
|
|
1245
1343
|
}
|
|
1344
|
+
this.logger.error(message, {
|
|
1345
|
+
error,
|
|
1346
|
+
accountAddress
|
|
1347
|
+
});
|
|
1246
1348
|
throw error;
|
|
1247
1349
|
}
|
|
1248
1350
|
}
|
|
@@ -1304,7 +1406,22 @@ class DynamicWalletClient {
|
|
|
1304
1406
|
}
|
|
1305
1407
|
return decryptedKeyShares;
|
|
1306
1408
|
} catch (error) {
|
|
1307
|
-
|
|
1409
|
+
const message = "[DynamicWaasWalletClient] Error in recoverEncryptedBackupByWallet";
|
|
1410
|
+
const context = {
|
|
1411
|
+
accountAddress,
|
|
1412
|
+
password,
|
|
1413
|
+
walletOperation,
|
|
1414
|
+
signedSessionId,
|
|
1415
|
+
shareCount,
|
|
1416
|
+
storeRecoveredShares
|
|
1417
|
+
};
|
|
1418
|
+
if (error instanceof AxiosError) {
|
|
1419
|
+
handleAxiosError(error, message, context);
|
|
1420
|
+
}
|
|
1421
|
+
this.logger.error(message, {
|
|
1422
|
+
error,
|
|
1423
|
+
context
|
|
1424
|
+
});
|
|
1308
1425
|
throw error;
|
|
1309
1426
|
}
|
|
1310
1427
|
}
|
|
@@ -1364,10 +1481,19 @@ class DynamicWalletClient {
|
|
|
1364
1481
|
storageKey: this.storageKey
|
|
1365
1482
|
});
|
|
1366
1483
|
} catch (error) {
|
|
1367
|
-
|
|
1484
|
+
const message = "[DynamicWaasWalletClient] Error in backupKeySharesToGoogleDrive";
|
|
1485
|
+
const context = {
|
|
1486
|
+
accountAddress,
|
|
1487
|
+
password,
|
|
1488
|
+
signedSessionId
|
|
1489
|
+
};
|
|
1368
1490
|
if (error instanceof AxiosError) {
|
|
1369
|
-
handleAxiosError(error);
|
|
1491
|
+
handleAxiosError(error, message, context);
|
|
1370
1492
|
}
|
|
1493
|
+
this.logger.error(message, {
|
|
1494
|
+
error,
|
|
1495
|
+
context
|
|
1496
|
+
});
|
|
1371
1497
|
throw error;
|
|
1372
1498
|
}
|
|
1373
1499
|
}
|
|
@@ -1393,7 +1519,7 @@ class DynamicWalletClient {
|
|
|
1393
1519
|
fileName
|
|
1394
1520
|
}));
|
|
1395
1521
|
} catch (error) {
|
|
1396
|
-
this.logger.error('Failed to download backup from Google Drive', {
|
|
1522
|
+
this.logger.error('[DynamicWaasWalletClient] Failed to download backup from Google Drive', {
|
|
1397
1523
|
accountAddress,
|
|
1398
1524
|
fileName,
|
|
1399
1525
|
error
|
|
@@ -1401,7 +1527,7 @@ class DynamicWalletClient {
|
|
|
1401
1527
|
throw new Error('Failed to restore backup from Google Drive');
|
|
1402
1528
|
}
|
|
1403
1529
|
if (!backupData) {
|
|
1404
|
-
this.logger.error('No backup file found', {
|
|
1530
|
+
this.logger.error('[DynamicWaasWalletClient] No backup file found', {
|
|
1405
1531
|
accountAddress,
|
|
1406
1532
|
fileName
|
|
1407
1533
|
});
|
|
@@ -1409,7 +1535,7 @@ class DynamicWalletClient {
|
|
|
1409
1535
|
}
|
|
1410
1536
|
// Validate the backup data structure
|
|
1411
1537
|
if (!backupData.keyShares || !backupData.metadata) {
|
|
1412
|
-
this.logger.error('Invalid backup format: missing keyShares or metadata', {
|
|
1538
|
+
this.logger.error('[DynamicWaasWalletClient] Invalid backup format: missing keyShares or metadata', {
|
|
1413
1539
|
accountAddress,
|
|
1414
1540
|
fileName
|
|
1415
1541
|
});
|
|
@@ -1427,10 +1553,19 @@ class DynamicWalletClient {
|
|
|
1427
1553
|
});
|
|
1428
1554
|
return decryptedKeyShares;
|
|
1429
1555
|
} catch (error) {
|
|
1430
|
-
|
|
1556
|
+
const message = "[DynamicWaasWalletClient] Error in restoreBackupFromGoogleDrive";
|
|
1557
|
+
const context = {
|
|
1558
|
+
accountAddress,
|
|
1559
|
+
password,
|
|
1560
|
+
signedSessionId
|
|
1561
|
+
};
|
|
1431
1562
|
if (error instanceof AxiosError) {
|
|
1432
|
-
handleAxiosError(error);
|
|
1563
|
+
handleAxiosError(error, message, context);
|
|
1433
1564
|
}
|
|
1565
|
+
this.logger.error(message, {
|
|
1566
|
+
error,
|
|
1567
|
+
context
|
|
1568
|
+
});
|
|
1434
1569
|
throw error;
|
|
1435
1570
|
}
|
|
1436
1571
|
}
|
|
@@ -1616,10 +1751,16 @@ class DynamicWalletClient {
|
|
|
1616
1751
|
walletProperties: wallet == null ? void 0 : wallet.walletProperties
|
|
1617
1752
|
});
|
|
1618
1753
|
} catch (error) {
|
|
1619
|
-
|
|
1754
|
+
const message = "[DynamicWaasWalletClient] Error in getWalletClientKeyShareBackupInfo";
|
|
1620
1755
|
if (error instanceof AxiosError) {
|
|
1621
|
-
handleAxiosError(error
|
|
1756
|
+
handleAxiosError(error, message, {
|
|
1757
|
+
accountAddress
|
|
1758
|
+
});
|
|
1622
1759
|
}
|
|
1760
|
+
this.logger.error(message, {
|
|
1761
|
+
error,
|
|
1762
|
+
accountAddress
|
|
1763
|
+
});
|
|
1623
1764
|
throw error;
|
|
1624
1765
|
}
|
|
1625
1766
|
}
|
|
@@ -1632,13 +1773,13 @@ class DynamicWalletClient {
|
|
|
1632
1773
|
shareCount
|
|
1633
1774
|
});
|
|
1634
1775
|
if (existingWalletCheck) {
|
|
1635
|
-
this.logger.debug(`Wallet ${accountAddress} already exists`);
|
|
1776
|
+
this.logger.debug(`[DynamicWaasWalletClient] Wallet ${accountAddress} already exists`);
|
|
1636
1777
|
return this.walletMap[accountAddress];
|
|
1637
1778
|
}
|
|
1638
1779
|
// Fetch and restore wallet from server
|
|
1639
1780
|
const user = await this.apiClient.getUser();
|
|
1640
1781
|
const wallet = (_user_verifiedCredentials = user.verifiedCredentials) == null ? void 0 : _user_verifiedCredentials.find((vc)=>vc.address.toLowerCase() === accountAddress.toLowerCase());
|
|
1641
|
-
this.logger.debug('Restoring wallet', wallet);
|
|
1782
|
+
this.logger.debug('[DynamicWaasWalletClient] Restoring wallet', wallet);
|
|
1642
1783
|
const walletProperties = wallet.walletProperties;
|
|
1643
1784
|
this.walletMap[accountAddress] = _extends({}, this.walletMap[accountAddress], {
|
|
1644
1785
|
walletId: wallet.id,
|
|
@@ -1669,7 +1810,7 @@ class DynamicWalletClient {
|
|
|
1669
1810
|
accountAddress,
|
|
1670
1811
|
clientKeyShares: mergeUniqueKeyShares(existingKeyShares, decryptedKeyShares)
|
|
1671
1812
|
});
|
|
1672
|
-
this.logger.debug('Recovered backup', decryptedKeyShares);
|
|
1813
|
+
this.logger.debug('[DynamicWaasWalletClient] Recovered backup', decryptedKeyShares);
|
|
1673
1814
|
}
|
|
1674
1815
|
const walletCount = Object.keys(this.walletMap).length;
|
|
1675
1816
|
if (walletCount === 0) {
|
|
@@ -1681,9 +1822,16 @@ class DynamicWalletClient {
|
|
|
1681
1822
|
}
|
|
1682
1823
|
return this.walletMap[accountAddress];
|
|
1683
1824
|
} catch (error) {
|
|
1684
|
-
|
|
1825
|
+
const message = "[DynamicWaasWalletClient] Error in getWallet";
|
|
1826
|
+
const context = {
|
|
1827
|
+
accountAddress,
|
|
1828
|
+
walletOperation,
|
|
1829
|
+
shareCount,
|
|
1830
|
+
password,
|
|
1831
|
+
signedSessionId
|
|
1832
|
+
};
|
|
1685
1833
|
if (error instanceof AxiosError) {
|
|
1686
|
-
handleAxiosError(error);
|
|
1834
|
+
handleAxiosError(error, message, context);
|
|
1687
1835
|
}
|
|
1688
1836
|
throw error;
|
|
1689
1837
|
}
|
|
@@ -1722,10 +1870,13 @@ class DynamicWalletClient {
|
|
|
1722
1870
|
}, {});
|
|
1723
1871
|
return wallets;
|
|
1724
1872
|
} catch (error) {
|
|
1725
|
-
|
|
1873
|
+
const message = "[DynamicWaasWalletClient] Error in getWallets";
|
|
1726
1874
|
if (error instanceof AxiosError) {
|
|
1727
|
-
handleAxiosError(error);
|
|
1875
|
+
handleAxiosError(error, message, {});
|
|
1728
1876
|
}
|
|
1877
|
+
this.logger.error(message, {
|
|
1878
|
+
error
|
|
1879
|
+
});
|
|
1729
1880
|
throw error;
|
|
1730
1881
|
}
|
|
1731
1882
|
}
|
|
@@ -1745,7 +1896,7 @@ class DynamicWalletClient {
|
|
|
1745
1896
|
baseApiUrl
|
|
1746
1897
|
});
|
|
1747
1898
|
this.debug = Boolean(debug);
|
|
1748
|
-
this.logger.setLogLevel(this.debug ?
|
|
1899
|
+
this.logger.setLogLevel(this.debug ? LogLevel.DEBUG : DEFAULT_LOG_LEVEL);
|
|
1749
1900
|
// setup storage
|
|
1750
1901
|
if (supportsLocalStorage()) {
|
|
1751
1902
|
this.storage = localStorageAdapter;
|
package/package.json
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs-wallet/browser",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.90",
|
|
4
4
|
"license": "Licensed under the Dynamic Labs, Inc. Terms Of Service (https://www.dynamic.xyz/terms-conditions)",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@dynamic-labs-wallet/core": "0.0.
|
|
6
|
+
"@dynamic-labs-wallet/core": "0.0.90",
|
|
7
7
|
"@dynamic-labs/logger": "^4.9.9",
|
|
8
8
|
"@dynamic-labs/sdk-api-core": "^0.0.663",
|
|
9
|
+
"axios": "1.9.0",
|
|
10
|
+
"http-errors": "2.0.0",
|
|
9
11
|
"@noble/hashes": "1.7.1"
|
|
10
12
|
},
|
|
11
13
|
"files": [
|
|
@@ -31,5 +33,8 @@
|
|
|
31
33
|
"require": "./index.cjs.js",
|
|
32
34
|
"default": "./index.cjs.js"
|
|
33
35
|
}
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@types/http-errors": "^2.0.0"
|
|
34
39
|
}
|
|
35
40
|
}
|
package/src/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../packages/src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,wBAAwB,EAC7B,gBAAgB,EAIhB,cAAc,EAEd,KAAK,wBAAwB,EAC7B,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,eAAe,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../packages/src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,wBAAwB,EAC7B,gBAAgB,EAIhB,cAAc,EAEd,KAAK,wBAAwB,EAC7B,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,eAAe,EAGhB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAEL,iBAAiB,EAEjB,KAAK,cAAc,EACnB,iBAAiB,EAEjB,kBAAkB,EAClB,KAAK,cAAc,EAEpB,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAQ1E,O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,cAAc,CAAC,EACnB,cAAc,EACd,QAAoB,EACpB,eAA8C,EAC9C,eAAe,GAChB,EAAE;QACD,cAAc,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,eAAe,CAAC,EAAE,eAAe,CAAC;QAClC,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B;IAgDK,mBAAmB,CAAC,EACxB,cAAc,GACf,EAAE;QACD,cAAc,EAAE,MAAM,CAAC;KACxB,GAAG,OAAO,CAAC,OAAO,CAAC;IAMpB;;OAEG;IACG,4BAA4B,CAAC,EACjC,cAAc,EACd,eAAiD,GAClD,EAAE;QACD,cAAc,EAAE,MAAM,CAAC;QACvB,eAAe,CAAC,EAAE,eAAe,CAAC;KACnC,GAAG,OAAO,CAAC,OAAO,CAAC;IAYpB;;OAEG;IACG,uCAAuC,CAAC,EAC5C,cAAc,EACd,eAAiD,GAClD,EAAE;QACD,cAAc,EAAE,MAAM,CAAC;QACvB,eAAe,CAAC,EAAE,eAAe,CAAC;KACnC,GAAG,OAAO,CAAC,OAAO,CAAC;IAgCd,iCAAiC,CAAC,EACtC,cAAc,GACf,EAAE;QACD,cAAc,EAAE,MAAM,CAAC;KACxB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAkCzB,SAAS,CAAC,EACd,cAAc,EACd,eAA8C,EAC9C,UAAsB,EACtB,QAAoB,EACpB,eAAe,GAChB,EAAE;QACD,cAAc,EAAE,MAAM,CAAC;QACvB,eAAe,CAAC,EAAE,eAAe,CAAC;QAClC,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B;IA8FK,UAAU;CA6CjB"}
|
package/src/constants.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { LogLevel } from '@dynamic-labs/logger';
|
|
2
|
+
export declare const DEFAULT_LOG_LEVEL = LogLevel.DEBUG;
|
|
2
3
|
export declare const STORAGE_KEY = "dynamic-waas-wallet-client";
|
|
3
4
|
export declare const BACKUP_FILENAME = "dynamicWalletKeyShareBackup.json";
|
|
4
5
|
export declare const CLIENT_KEYSHARE_EXPORT_FILENAME_PREFIX = "dynamicWalletKeyShareBackup";
|
package/src/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../packages/src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../packages/src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAEhD,eAAO,MAAM,WAAW,+BAA+B,CAAC;AAExD,eAAO,MAAM,eAAe,qCAAqC,CAAC;AAElE,eAAO,MAAM,sCAAsC,gCACpB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"axiosErrorResponse.d.ts","sourceRoot":"","sources":["../../src/services/axiosErrorResponse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAInC,eAAO,MAAM,gBAAgB,UAAW,UAAU,WAAW,MAAM,WAAW,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,UAoBpG,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
package/src/services/logger.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/services/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAY,MAAM,sBAAsB,CAAC;AAExD,eAAO,MAAM,MAAM,QAAwD,CAAC"}
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/services/logger.ts"],"names":[],"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