@dynamic-labs-wallet/browser 0.0.89 → 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 +211 -64
- package/index.esm.js +200 -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/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,7 +39,7 @@ 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
|
|
|
@@ -129,7 +131,7 @@ const timeoutPromise = ({ timeInMs, activity = 'Ceremony' })=>{
|
|
|
129
131
|
attempts++;
|
|
130
132
|
if (attempts === maxAttempts) {
|
|
131
133
|
logger.error(`Failed to execute ${operationName} after ${maxAttempts} attempts`, _extends({}, logContext, {
|
|
132
|
-
error
|
|
134
|
+
error: error instanceof Error ? error.message : 'Unknown error'
|
|
133
135
|
}));
|
|
134
136
|
throw error;
|
|
135
137
|
}
|
|
@@ -465,11 +467,11 @@ const localStorageWriteTest = {
|
|
|
465
467
|
jsonData: backupData
|
|
466
468
|
}));
|
|
467
469
|
} catch (error) {
|
|
468
|
-
logger.error('Failed to upload keyshares to Google Drive App Storage', {
|
|
470
|
+
logger.error('[DynamicWaasWalletClient] Failed to upload keyshares to Google Drive App Storage', {
|
|
469
471
|
accountAddress,
|
|
470
472
|
error
|
|
471
473
|
});
|
|
472
|
-
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)}`);
|
|
473
475
|
}
|
|
474
476
|
try {
|
|
475
477
|
await retryPromise(()=>uploadFileToGoogleDrivePersonal({
|
|
@@ -478,11 +480,34 @@ const localStorageWriteTest = {
|
|
|
478
480
|
jsonData: backupData
|
|
479
481
|
}));
|
|
480
482
|
} catch (error) {
|
|
481
|
-
logger.error('Failed to upload keyshares to Google Drive Personal', {
|
|
483
|
+
logger.error('[DynamicWaasWalletClient] Failed to upload keyshares to Google Drive Personal', {
|
|
482
484
|
accountAddress,
|
|
483
485
|
error
|
|
484
486
|
});
|
|
485
|
-
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');
|
|
486
511
|
}
|
|
487
512
|
};
|
|
488
513
|
|
|
@@ -492,10 +517,10 @@ class DynamicWalletClient {
|
|
|
492
517
|
return await this.initializePromise;
|
|
493
518
|
}
|
|
494
519
|
setLoggerEnvironmentId(this.environmentId);
|
|
495
|
-
this.logger.debug('Initializing Dynamic Waas Wallet SDK');
|
|
520
|
+
this.logger.debug('[DynamicWaasWalletClient] Initializing Dynamic Waas Wallet SDK');
|
|
496
521
|
this.initializePromise = this._initialize();
|
|
497
522
|
const result = await this.initializePromise;
|
|
498
|
-
this.logger.debug('Dynamic Waas Wallet SDK initialized');
|
|
523
|
+
this.logger.debug('[DynamicWaasWalletClient] Dynamic Waas Wallet SDK initialized');
|
|
499
524
|
return result;
|
|
500
525
|
}
|
|
501
526
|
/**
|
|
@@ -634,10 +659,18 @@ class DynamicWalletClient {
|
|
|
634
659
|
clientKeyShares
|
|
635
660
|
};
|
|
636
661
|
} catch (error) {
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
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);
|
|
640
669
|
}
|
|
670
|
+
this.logger.error(message, {
|
|
671
|
+
error,
|
|
672
|
+
context
|
|
673
|
+
});
|
|
641
674
|
throw error;
|
|
642
675
|
}
|
|
643
676
|
}
|
|
@@ -707,10 +740,18 @@ class DynamicWalletClient {
|
|
|
707
740
|
clientKeyShares: clientKeygenResults
|
|
708
741
|
};
|
|
709
742
|
} catch (error) {
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
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);
|
|
713
750
|
}
|
|
751
|
+
this.logger.error(message, {
|
|
752
|
+
error,
|
|
753
|
+
context
|
|
754
|
+
});
|
|
714
755
|
throw error;
|
|
715
756
|
}
|
|
716
757
|
}
|
|
@@ -743,7 +784,13 @@ class DynamicWalletClient {
|
|
|
743
784
|
const signature = await mpcSigner.sign(roomId, keyShare, formattedMessage, derivationPath);
|
|
744
785
|
return signature;
|
|
745
786
|
} catch (error) {
|
|
746
|
-
this.logger.error('[DynamicWaasWalletClient]
|
|
787
|
+
this.logger.error('[DynamicWaasWalletClient] Error in clientSign', {
|
|
788
|
+
error,
|
|
789
|
+
chainName,
|
|
790
|
+
roomId,
|
|
791
|
+
derivationPath,
|
|
792
|
+
isFormatted
|
|
793
|
+
});
|
|
747
794
|
throw error;
|
|
748
795
|
}
|
|
749
796
|
}
|
|
@@ -796,10 +843,20 @@ class DynamicWalletClient {
|
|
|
796
843
|
});
|
|
797
844
|
return signature;
|
|
798
845
|
} catch (error) {
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
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);
|
|
802
855
|
}
|
|
856
|
+
this.logger.error(message, {
|
|
857
|
+
error,
|
|
858
|
+
context
|
|
859
|
+
});
|
|
803
860
|
throw error;
|
|
804
861
|
}
|
|
805
862
|
}
|
|
@@ -844,10 +901,18 @@ class DynamicWalletClient {
|
|
|
844
901
|
signedSessionId
|
|
845
902
|
});
|
|
846
903
|
} catch (error) {
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
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);
|
|
850
911
|
}
|
|
912
|
+
this.logger.error(message, {
|
|
913
|
+
error,
|
|
914
|
+
context
|
|
915
|
+
});
|
|
851
916
|
throw error;
|
|
852
917
|
}
|
|
853
918
|
}
|
|
@@ -967,10 +1032,20 @@ class DynamicWalletClient {
|
|
|
967
1032
|
signedSessionId
|
|
968
1033
|
});
|
|
969
1034
|
} catch (error) {
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
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);
|
|
973
1044
|
}
|
|
1045
|
+
this.logger.error(message, {
|
|
1046
|
+
error,
|
|
1047
|
+
context
|
|
1048
|
+
});
|
|
974
1049
|
throw error;
|
|
975
1050
|
}
|
|
976
1051
|
}
|
|
@@ -1028,10 +1103,20 @@ class DynamicWalletClient {
|
|
|
1028
1103
|
derivedPrivateKey
|
|
1029
1104
|
};
|
|
1030
1105
|
} catch (error) {
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
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);
|
|
1034
1115
|
}
|
|
1116
|
+
this.logger.error(message, {
|
|
1117
|
+
error,
|
|
1118
|
+
context
|
|
1119
|
+
});
|
|
1035
1120
|
throw error;
|
|
1036
1121
|
}
|
|
1037
1122
|
}
|
|
@@ -1071,7 +1156,7 @@ class DynamicWalletClient {
|
|
|
1071
1156
|
rawPublicKey
|
|
1072
1157
|
};
|
|
1073
1158
|
} catch (error) {
|
|
1074
|
-
this.logger.error('[DynamicWaasWalletClient]
|
|
1159
|
+
this.logger.error('[DynamicWaasWalletClient] Error in offlineExportKey', error);
|
|
1075
1160
|
throw error;
|
|
1076
1161
|
}
|
|
1077
1162
|
}
|
|
@@ -1091,7 +1176,7 @@ class DynamicWalletClient {
|
|
|
1091
1176
|
var _this_storage;
|
|
1092
1177
|
const walletObject = await ((_this_storage = this.storage) == null ? void 0 : _this_storage.getItem(accountAddress));
|
|
1093
1178
|
if (!walletObject) {
|
|
1094
|
-
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}`);
|
|
1095
1180
|
return [];
|
|
1096
1181
|
}
|
|
1097
1182
|
try {
|
|
@@ -1103,7 +1188,7 @@ class DynamicWalletClient {
|
|
|
1103
1188
|
}
|
|
1104
1189
|
return (parsedWalletObject == null ? void 0 : parsedWalletObject.clientKeyShares) || [];
|
|
1105
1190
|
} catch (error) {
|
|
1106
|
-
this.logger.error(`Error parsing clientKeyShares: ${error} for accountAddress: ${accountAddress}`);
|
|
1191
|
+
this.logger.error(`[DynamicWaasWalletClient] Error parsing clientKeyShares: ${error} for accountAddress: ${accountAddress}`);
|
|
1107
1192
|
return [];
|
|
1108
1193
|
}
|
|
1109
1194
|
}
|
|
@@ -1145,6 +1230,7 @@ class DynamicWalletClient {
|
|
|
1145
1230
|
password
|
|
1146
1231
|
})));
|
|
1147
1232
|
if (!this.walletMap[accountAddress].walletId) {
|
|
1233
|
+
this.logger.error(`[DynamicWaasWalletClient] WalletId not found for accountAddress: ${accountAddress}`);
|
|
1148
1234
|
throw new Error(`WalletId not found for accountAddress: ${accountAddress}`);
|
|
1149
1235
|
}
|
|
1150
1236
|
// TODO(zfaizal2): throw error if signedSessionId is not provided after service deploy
|
|
@@ -1179,10 +1265,20 @@ class DynamicWalletClient {
|
|
|
1179
1265
|
await this.storage.setItem(this.storageKey, JSON.stringify(this.walletMap));
|
|
1180
1266
|
return data;
|
|
1181
1267
|
} catch (error) {
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
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);
|
|
1185
1277
|
}
|
|
1278
|
+
this.logger.error(message, {
|
|
1279
|
+
error,
|
|
1280
|
+
context
|
|
1281
|
+
});
|
|
1186
1282
|
throw error;
|
|
1187
1283
|
}
|
|
1188
1284
|
}
|
|
@@ -1195,11 +1291,7 @@ class DynamicWalletClient {
|
|
|
1195
1291
|
}), {
|
|
1196
1292
|
operationName: 'store encrypted backup',
|
|
1197
1293
|
logContext: {
|
|
1198
|
-
walletAddress: accountAddress
|
|
1199
|
-
keyShares: clientKeyShares == null ? void 0 : clientKeyShares.map((keyShare)=>this.encryptKeyShare({
|
|
1200
|
-
keyShare,
|
|
1201
|
-
password
|
|
1202
|
-
}))
|
|
1294
|
+
walletAddress: accountAddress
|
|
1203
1295
|
}
|
|
1204
1296
|
});
|
|
1205
1297
|
}
|
|
@@ -1243,10 +1335,16 @@ class DynamicWalletClient {
|
|
|
1243
1335
|
}
|
|
1244
1336
|
return oauthAccountId;
|
|
1245
1337
|
} catch (error) {
|
|
1246
|
-
|
|
1247
|
-
if (error instanceof
|
|
1248
|
-
|
|
1338
|
+
const message = "[DynamicWaasWalletClient] Error in getGoogleOauthAccountIdOrThrow";
|
|
1339
|
+
if (error instanceof axios.AxiosError) {
|
|
1340
|
+
handleAxiosError(error, message, {
|
|
1341
|
+
accountAddress
|
|
1342
|
+
});
|
|
1249
1343
|
}
|
|
1344
|
+
this.logger.error(message, {
|
|
1345
|
+
error,
|
|
1346
|
+
accountAddress
|
|
1347
|
+
});
|
|
1250
1348
|
throw error;
|
|
1251
1349
|
}
|
|
1252
1350
|
}
|
|
@@ -1308,7 +1406,22 @@ class DynamicWalletClient {
|
|
|
1308
1406
|
}
|
|
1309
1407
|
return decryptedKeyShares;
|
|
1310
1408
|
} catch (error) {
|
|
1311
|
-
|
|
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
|
+
});
|
|
1312
1425
|
throw error;
|
|
1313
1426
|
}
|
|
1314
1427
|
}
|
|
@@ -1368,10 +1481,19 @@ class DynamicWalletClient {
|
|
|
1368
1481
|
storageKey: this.storageKey
|
|
1369
1482
|
});
|
|
1370
1483
|
} catch (error) {
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
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);
|
|
1374
1492
|
}
|
|
1493
|
+
this.logger.error(message, {
|
|
1494
|
+
error,
|
|
1495
|
+
context
|
|
1496
|
+
});
|
|
1375
1497
|
throw error;
|
|
1376
1498
|
}
|
|
1377
1499
|
}
|
|
@@ -1397,7 +1519,7 @@ class DynamicWalletClient {
|
|
|
1397
1519
|
fileName
|
|
1398
1520
|
}));
|
|
1399
1521
|
} catch (error) {
|
|
1400
|
-
this.logger.error('Failed to download backup from Google Drive', {
|
|
1522
|
+
this.logger.error('[DynamicWaasWalletClient] Failed to download backup from Google Drive', {
|
|
1401
1523
|
accountAddress,
|
|
1402
1524
|
fileName,
|
|
1403
1525
|
error
|
|
@@ -1405,7 +1527,7 @@ class DynamicWalletClient {
|
|
|
1405
1527
|
throw new Error('Failed to restore backup from Google Drive');
|
|
1406
1528
|
}
|
|
1407
1529
|
if (!backupData) {
|
|
1408
|
-
this.logger.error('No backup file found', {
|
|
1530
|
+
this.logger.error('[DynamicWaasWalletClient] No backup file found', {
|
|
1409
1531
|
accountAddress,
|
|
1410
1532
|
fileName
|
|
1411
1533
|
});
|
|
@@ -1413,7 +1535,7 @@ class DynamicWalletClient {
|
|
|
1413
1535
|
}
|
|
1414
1536
|
// Validate the backup data structure
|
|
1415
1537
|
if (!backupData.keyShares || !backupData.metadata) {
|
|
1416
|
-
this.logger.error('Invalid backup format: missing keyShares or metadata', {
|
|
1538
|
+
this.logger.error('[DynamicWaasWalletClient] Invalid backup format: missing keyShares or metadata', {
|
|
1417
1539
|
accountAddress,
|
|
1418
1540
|
fileName
|
|
1419
1541
|
});
|
|
@@ -1431,10 +1553,19 @@ class DynamicWalletClient {
|
|
|
1431
1553
|
});
|
|
1432
1554
|
return decryptedKeyShares;
|
|
1433
1555
|
} catch (error) {
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
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);
|
|
1437
1564
|
}
|
|
1565
|
+
this.logger.error(message, {
|
|
1566
|
+
error,
|
|
1567
|
+
context
|
|
1568
|
+
});
|
|
1438
1569
|
throw error;
|
|
1439
1570
|
}
|
|
1440
1571
|
}
|
|
@@ -1620,10 +1751,16 @@ class DynamicWalletClient {
|
|
|
1620
1751
|
walletProperties: wallet == null ? void 0 : wallet.walletProperties
|
|
1621
1752
|
});
|
|
1622
1753
|
} catch (error) {
|
|
1623
|
-
|
|
1624
|
-
if (error instanceof
|
|
1625
|
-
|
|
1754
|
+
const message = "[DynamicWaasWalletClient] Error in getWalletClientKeyShareBackupInfo";
|
|
1755
|
+
if (error instanceof axios.AxiosError) {
|
|
1756
|
+
handleAxiosError(error, message, {
|
|
1757
|
+
accountAddress
|
|
1758
|
+
});
|
|
1626
1759
|
}
|
|
1760
|
+
this.logger.error(message, {
|
|
1761
|
+
error,
|
|
1762
|
+
accountAddress
|
|
1763
|
+
});
|
|
1627
1764
|
throw error;
|
|
1628
1765
|
}
|
|
1629
1766
|
}
|
|
@@ -1636,13 +1773,13 @@ class DynamicWalletClient {
|
|
|
1636
1773
|
shareCount
|
|
1637
1774
|
});
|
|
1638
1775
|
if (existingWalletCheck) {
|
|
1639
|
-
this.logger.debug(`Wallet ${accountAddress} already exists`);
|
|
1776
|
+
this.logger.debug(`[DynamicWaasWalletClient] Wallet ${accountAddress} already exists`);
|
|
1640
1777
|
return this.walletMap[accountAddress];
|
|
1641
1778
|
}
|
|
1642
1779
|
// Fetch and restore wallet from server
|
|
1643
1780
|
const user = await this.apiClient.getUser();
|
|
1644
1781
|
const wallet = (_user_verifiedCredentials = user.verifiedCredentials) == null ? void 0 : _user_verifiedCredentials.find((vc)=>vc.address.toLowerCase() === accountAddress.toLowerCase());
|
|
1645
|
-
this.logger.debug('Restoring wallet', wallet);
|
|
1782
|
+
this.logger.debug('[DynamicWaasWalletClient] Restoring wallet', wallet);
|
|
1646
1783
|
const walletProperties = wallet.walletProperties;
|
|
1647
1784
|
this.walletMap[accountAddress] = _extends({}, this.walletMap[accountAddress], {
|
|
1648
1785
|
walletId: wallet.id,
|
|
@@ -1673,7 +1810,7 @@ class DynamicWalletClient {
|
|
|
1673
1810
|
accountAddress,
|
|
1674
1811
|
clientKeyShares: mergeUniqueKeyShares(existingKeyShares, decryptedKeyShares)
|
|
1675
1812
|
});
|
|
1676
|
-
this.logger.debug('Recovered backup', decryptedKeyShares);
|
|
1813
|
+
this.logger.debug('[DynamicWaasWalletClient] Recovered backup', decryptedKeyShares);
|
|
1677
1814
|
}
|
|
1678
1815
|
const walletCount = Object.keys(this.walletMap).length;
|
|
1679
1816
|
if (walletCount === 0) {
|
|
@@ -1685,9 +1822,16 @@ class DynamicWalletClient {
|
|
|
1685
1822
|
}
|
|
1686
1823
|
return this.walletMap[accountAddress];
|
|
1687
1824
|
} catch (error) {
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
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);
|
|
1691
1835
|
}
|
|
1692
1836
|
throw error;
|
|
1693
1837
|
}
|
|
@@ -1726,10 +1870,13 @@ class DynamicWalletClient {
|
|
|
1726
1870
|
}, {});
|
|
1727
1871
|
return wallets;
|
|
1728
1872
|
} catch (error) {
|
|
1729
|
-
|
|
1730
|
-
if (error instanceof
|
|
1731
|
-
|
|
1873
|
+
const message = "[DynamicWaasWalletClient] Error in getWallets";
|
|
1874
|
+
if (error instanceof axios.AxiosError) {
|
|
1875
|
+
handleAxiosError(error, message, {});
|
|
1732
1876
|
}
|
|
1877
|
+
this.logger.error(message, {
|
|
1878
|
+
error
|
|
1879
|
+
});
|
|
1733
1880
|
throw error;
|
|
1734
1881
|
}
|
|
1735
1882
|
}
|
|
@@ -1749,7 +1896,7 @@ class DynamicWalletClient {
|
|
|
1749
1896
|
baseApiUrl
|
|
1750
1897
|
});
|
|
1751
1898
|
this.debug = Boolean(debug);
|
|
1752
|
-
this.logger.setLogLevel(this.debug ?
|
|
1899
|
+
this.logger.setLogLevel(this.debug ? logger$1.LogLevel.DEBUG : DEFAULT_LOG_LEVEL);
|
|
1753
1900
|
// setup storage
|
|
1754
1901
|
if (supportsLocalStorage()) {
|
|
1755
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,7 +39,7 @@ 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
|
|
|
@@ -129,7 +131,7 @@ const timeoutPromise = ({ timeInMs, activity = 'Ceremony' })=>{
|
|
|
129
131
|
attempts++;
|
|
130
132
|
if (attempts === maxAttempts) {
|
|
131
133
|
logger.error(`Failed to execute ${operationName} after ${maxAttempts} attempts`, _extends({}, logContext, {
|
|
132
|
-
error
|
|
134
|
+
error: error instanceof Error ? error.message : 'Unknown error'
|
|
133
135
|
}));
|
|
134
136
|
throw error;
|
|
135
137
|
}
|
|
@@ -465,11 +467,11 @@ const localStorageWriteTest = {
|
|
|
465
467
|
jsonData: backupData
|
|
466
468
|
}));
|
|
467
469
|
} catch (error) {
|
|
468
|
-
logger.error('Failed to upload keyshares to Google Drive App Storage', {
|
|
470
|
+
logger.error('[DynamicWaasWalletClient] Failed to upload keyshares to Google Drive App Storage', {
|
|
469
471
|
accountAddress,
|
|
470
472
|
error
|
|
471
473
|
});
|
|
472
|
-
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)}`);
|
|
473
475
|
}
|
|
474
476
|
try {
|
|
475
477
|
await retryPromise(()=>uploadFileToGoogleDrivePersonal({
|
|
@@ -478,11 +480,34 @@ const localStorageWriteTest = {
|
|
|
478
480
|
jsonData: backupData
|
|
479
481
|
}));
|
|
480
482
|
} catch (error) {
|
|
481
|
-
logger.error('Failed to upload keyshares to Google Drive Personal', {
|
|
483
|
+
logger.error('[DynamicWaasWalletClient] Failed to upload keyshares to Google Drive Personal', {
|
|
482
484
|
accountAddress,
|
|
483
485
|
error
|
|
484
486
|
});
|
|
485
|
-
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');
|
|
486
511
|
}
|
|
487
512
|
};
|
|
488
513
|
|
|
@@ -492,10 +517,10 @@ class DynamicWalletClient {
|
|
|
492
517
|
return await this.initializePromise;
|
|
493
518
|
}
|
|
494
519
|
setLoggerEnvironmentId(this.environmentId);
|
|
495
|
-
this.logger.debug('Initializing Dynamic Waas Wallet SDK');
|
|
520
|
+
this.logger.debug('[DynamicWaasWalletClient] Initializing Dynamic Waas Wallet SDK');
|
|
496
521
|
this.initializePromise = this._initialize();
|
|
497
522
|
const result = await this.initializePromise;
|
|
498
|
-
this.logger.debug('Dynamic Waas Wallet SDK initialized');
|
|
523
|
+
this.logger.debug('[DynamicWaasWalletClient] Dynamic Waas Wallet SDK initialized');
|
|
499
524
|
return result;
|
|
500
525
|
}
|
|
501
526
|
/**
|
|
@@ -634,10 +659,18 @@ class DynamicWalletClient {
|
|
|
634
659
|
clientKeyShares
|
|
635
660
|
};
|
|
636
661
|
} catch (error) {
|
|
637
|
-
|
|
662
|
+
const message = "[DynamicWaasWalletClient] Error in keyGen";
|
|
663
|
+
const context = {
|
|
664
|
+
chainName,
|
|
665
|
+
thresholdSignatureScheme
|
|
666
|
+
};
|
|
638
667
|
if (error instanceof AxiosError) {
|
|
639
|
-
handleAxiosError(error);
|
|
668
|
+
handleAxiosError(error, message, context);
|
|
640
669
|
}
|
|
670
|
+
this.logger.error(message, {
|
|
671
|
+
error,
|
|
672
|
+
context
|
|
673
|
+
});
|
|
641
674
|
throw error;
|
|
642
675
|
}
|
|
643
676
|
}
|
|
@@ -707,10 +740,18 @@ class DynamicWalletClient {
|
|
|
707
740
|
clientKeyShares: clientKeygenResults
|
|
708
741
|
};
|
|
709
742
|
} catch (error) {
|
|
710
|
-
|
|
743
|
+
const message = "[DynamicWaasWalletClient] Error in importRawPrivateKey";
|
|
744
|
+
const context = {
|
|
745
|
+
chainName,
|
|
746
|
+
thresholdSignatureScheme
|
|
747
|
+
};
|
|
711
748
|
if (error instanceof AxiosError) {
|
|
712
|
-
handleAxiosError(error);
|
|
749
|
+
handleAxiosError(error, message, context);
|
|
713
750
|
}
|
|
751
|
+
this.logger.error(message, {
|
|
752
|
+
error,
|
|
753
|
+
context
|
|
754
|
+
});
|
|
714
755
|
throw error;
|
|
715
756
|
}
|
|
716
757
|
}
|
|
@@ -743,7 +784,13 @@ class DynamicWalletClient {
|
|
|
743
784
|
const signature = await mpcSigner.sign(roomId, keyShare, formattedMessage, derivationPath);
|
|
744
785
|
return signature;
|
|
745
786
|
} catch (error) {
|
|
746
|
-
this.logger.error('[DynamicWaasWalletClient]
|
|
787
|
+
this.logger.error('[DynamicWaasWalletClient] Error in clientSign', {
|
|
788
|
+
error,
|
|
789
|
+
chainName,
|
|
790
|
+
roomId,
|
|
791
|
+
derivationPath,
|
|
792
|
+
isFormatted
|
|
793
|
+
});
|
|
747
794
|
throw error;
|
|
748
795
|
}
|
|
749
796
|
}
|
|
@@ -796,10 +843,20 @@ class DynamicWalletClient {
|
|
|
796
843
|
});
|
|
797
844
|
return signature;
|
|
798
845
|
} catch (error) {
|
|
799
|
-
|
|
846
|
+
const message = "[DynamicWaasWalletClient] Error in sign";
|
|
847
|
+
const context = {
|
|
848
|
+
accountAddress,
|
|
849
|
+
chainName,
|
|
850
|
+
isFormatted: isFormatted ? 'true' : 'false',
|
|
851
|
+
signedSessionId
|
|
852
|
+
};
|
|
800
853
|
if (error instanceof AxiosError) {
|
|
801
|
-
handleAxiosError(error);
|
|
854
|
+
handleAxiosError(error, message, context);
|
|
802
855
|
}
|
|
856
|
+
this.logger.error(message, {
|
|
857
|
+
error,
|
|
858
|
+
context
|
|
859
|
+
});
|
|
803
860
|
throw error;
|
|
804
861
|
}
|
|
805
862
|
}
|
|
@@ -844,10 +901,18 @@ class DynamicWalletClient {
|
|
|
844
901
|
signedSessionId
|
|
845
902
|
});
|
|
846
903
|
} catch (error) {
|
|
847
|
-
|
|
904
|
+
const message = "[DynamicWaasWalletClient] Error in refreshWalletAccountShares";
|
|
905
|
+
const context = {
|
|
906
|
+
accountAddress,
|
|
907
|
+
chainName
|
|
908
|
+
};
|
|
848
909
|
if (error instanceof AxiosError) {
|
|
849
|
-
handleAxiosError(error);
|
|
910
|
+
handleAxiosError(error, message, context);
|
|
850
911
|
}
|
|
912
|
+
this.logger.error(message, {
|
|
913
|
+
error,
|
|
914
|
+
context
|
|
915
|
+
});
|
|
851
916
|
throw error;
|
|
852
917
|
}
|
|
853
918
|
}
|
|
@@ -967,10 +1032,20 @@ class DynamicWalletClient {
|
|
|
967
1032
|
signedSessionId
|
|
968
1033
|
});
|
|
969
1034
|
} catch (error) {
|
|
970
|
-
|
|
1035
|
+
const message = "[DynamicWaasWalletClient] Error in reshare";
|
|
1036
|
+
const context = {
|
|
1037
|
+
accountAddress,
|
|
1038
|
+
chainName,
|
|
1039
|
+
oldThresholdSignatureScheme,
|
|
1040
|
+
newThresholdSignatureScheme
|
|
1041
|
+
};
|
|
971
1042
|
if (error instanceof AxiosError) {
|
|
972
|
-
handleAxiosError(error);
|
|
1043
|
+
handleAxiosError(error, message, context);
|
|
973
1044
|
}
|
|
1045
|
+
this.logger.error(message, {
|
|
1046
|
+
error,
|
|
1047
|
+
context
|
|
1048
|
+
});
|
|
974
1049
|
throw error;
|
|
975
1050
|
}
|
|
976
1051
|
}
|
|
@@ -1028,10 +1103,20 @@ class DynamicWalletClient {
|
|
|
1028
1103
|
derivedPrivateKey
|
|
1029
1104
|
};
|
|
1030
1105
|
} catch (error) {
|
|
1031
|
-
|
|
1106
|
+
const message = "[DynamicWaasWalletClient] Error in exportKey";
|
|
1107
|
+
const context = {
|
|
1108
|
+
accountAddress,
|
|
1109
|
+
chainName,
|
|
1110
|
+
password,
|
|
1111
|
+
signedSessionId
|
|
1112
|
+
};
|
|
1032
1113
|
if (error instanceof AxiosError) {
|
|
1033
|
-
handleAxiosError(error);
|
|
1114
|
+
handleAxiosError(error, message, context);
|
|
1034
1115
|
}
|
|
1116
|
+
this.logger.error(message, {
|
|
1117
|
+
error,
|
|
1118
|
+
context
|
|
1119
|
+
});
|
|
1035
1120
|
throw error;
|
|
1036
1121
|
}
|
|
1037
1122
|
}
|
|
@@ -1071,7 +1156,7 @@ class DynamicWalletClient {
|
|
|
1071
1156
|
rawPublicKey
|
|
1072
1157
|
};
|
|
1073
1158
|
} catch (error) {
|
|
1074
|
-
this.logger.error('[DynamicWaasWalletClient]
|
|
1159
|
+
this.logger.error('[DynamicWaasWalletClient] Error in offlineExportKey', error);
|
|
1075
1160
|
throw error;
|
|
1076
1161
|
}
|
|
1077
1162
|
}
|
|
@@ -1091,7 +1176,7 @@ class DynamicWalletClient {
|
|
|
1091
1176
|
var _this_storage;
|
|
1092
1177
|
const walletObject = await ((_this_storage = this.storage) == null ? void 0 : _this_storage.getItem(accountAddress));
|
|
1093
1178
|
if (!walletObject) {
|
|
1094
|
-
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}`);
|
|
1095
1180
|
return [];
|
|
1096
1181
|
}
|
|
1097
1182
|
try {
|
|
@@ -1103,7 +1188,7 @@ class DynamicWalletClient {
|
|
|
1103
1188
|
}
|
|
1104
1189
|
return (parsedWalletObject == null ? void 0 : parsedWalletObject.clientKeyShares) || [];
|
|
1105
1190
|
} catch (error) {
|
|
1106
|
-
this.logger.error(`Error parsing clientKeyShares: ${error} for accountAddress: ${accountAddress}`);
|
|
1191
|
+
this.logger.error(`[DynamicWaasWalletClient] Error parsing clientKeyShares: ${error} for accountAddress: ${accountAddress}`);
|
|
1107
1192
|
return [];
|
|
1108
1193
|
}
|
|
1109
1194
|
}
|
|
@@ -1145,6 +1230,7 @@ class DynamicWalletClient {
|
|
|
1145
1230
|
password
|
|
1146
1231
|
})));
|
|
1147
1232
|
if (!this.walletMap[accountAddress].walletId) {
|
|
1233
|
+
this.logger.error(`[DynamicWaasWalletClient] WalletId not found for accountAddress: ${accountAddress}`);
|
|
1148
1234
|
throw new Error(`WalletId not found for accountAddress: ${accountAddress}`);
|
|
1149
1235
|
}
|
|
1150
1236
|
// TODO(zfaizal2): throw error if signedSessionId is not provided after service deploy
|
|
@@ -1179,10 +1265,20 @@ class DynamicWalletClient {
|
|
|
1179
1265
|
await this.storage.setItem(this.storageKey, JSON.stringify(this.walletMap));
|
|
1180
1266
|
return data;
|
|
1181
1267
|
} catch (error) {
|
|
1182
|
-
|
|
1268
|
+
const message = "[DynamicWaasWalletClient] Error in storeEncryptedBackupByWallet";
|
|
1269
|
+
const context = {
|
|
1270
|
+
accountAddress,
|
|
1271
|
+
clientKeyShares,
|
|
1272
|
+
password,
|
|
1273
|
+
signedSessionId
|
|
1274
|
+
};
|
|
1183
1275
|
if (error instanceof AxiosError) {
|
|
1184
|
-
handleAxiosError(error);
|
|
1276
|
+
handleAxiosError(error, message, context);
|
|
1185
1277
|
}
|
|
1278
|
+
this.logger.error(message, {
|
|
1279
|
+
error,
|
|
1280
|
+
context
|
|
1281
|
+
});
|
|
1186
1282
|
throw error;
|
|
1187
1283
|
}
|
|
1188
1284
|
}
|
|
@@ -1195,11 +1291,7 @@ class DynamicWalletClient {
|
|
|
1195
1291
|
}), {
|
|
1196
1292
|
operationName: 'store encrypted backup',
|
|
1197
1293
|
logContext: {
|
|
1198
|
-
walletAddress: accountAddress
|
|
1199
|
-
keyShares: clientKeyShares == null ? void 0 : clientKeyShares.map((keyShare)=>this.encryptKeyShare({
|
|
1200
|
-
keyShare,
|
|
1201
|
-
password
|
|
1202
|
-
}))
|
|
1294
|
+
walletAddress: accountAddress
|
|
1203
1295
|
}
|
|
1204
1296
|
});
|
|
1205
1297
|
}
|
|
@@ -1243,10 +1335,16 @@ class DynamicWalletClient {
|
|
|
1243
1335
|
}
|
|
1244
1336
|
return oauthAccountId;
|
|
1245
1337
|
} catch (error) {
|
|
1246
|
-
|
|
1338
|
+
const message = "[DynamicWaasWalletClient] Error in getGoogleOauthAccountIdOrThrow";
|
|
1247
1339
|
if (error instanceof AxiosError) {
|
|
1248
|
-
handleAxiosError(error
|
|
1340
|
+
handleAxiosError(error, message, {
|
|
1341
|
+
accountAddress
|
|
1342
|
+
});
|
|
1249
1343
|
}
|
|
1344
|
+
this.logger.error(message, {
|
|
1345
|
+
error,
|
|
1346
|
+
accountAddress
|
|
1347
|
+
});
|
|
1250
1348
|
throw error;
|
|
1251
1349
|
}
|
|
1252
1350
|
}
|
|
@@ -1308,7 +1406,22 @@ class DynamicWalletClient {
|
|
|
1308
1406
|
}
|
|
1309
1407
|
return decryptedKeyShares;
|
|
1310
1408
|
} catch (error) {
|
|
1311
|
-
|
|
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
|
+
});
|
|
1312
1425
|
throw error;
|
|
1313
1426
|
}
|
|
1314
1427
|
}
|
|
@@ -1368,10 +1481,19 @@ class DynamicWalletClient {
|
|
|
1368
1481
|
storageKey: this.storageKey
|
|
1369
1482
|
});
|
|
1370
1483
|
} catch (error) {
|
|
1371
|
-
|
|
1484
|
+
const message = "[DynamicWaasWalletClient] Error in backupKeySharesToGoogleDrive";
|
|
1485
|
+
const context = {
|
|
1486
|
+
accountAddress,
|
|
1487
|
+
password,
|
|
1488
|
+
signedSessionId
|
|
1489
|
+
};
|
|
1372
1490
|
if (error instanceof AxiosError) {
|
|
1373
|
-
handleAxiosError(error);
|
|
1491
|
+
handleAxiosError(error, message, context);
|
|
1374
1492
|
}
|
|
1493
|
+
this.logger.error(message, {
|
|
1494
|
+
error,
|
|
1495
|
+
context
|
|
1496
|
+
});
|
|
1375
1497
|
throw error;
|
|
1376
1498
|
}
|
|
1377
1499
|
}
|
|
@@ -1397,7 +1519,7 @@ class DynamicWalletClient {
|
|
|
1397
1519
|
fileName
|
|
1398
1520
|
}));
|
|
1399
1521
|
} catch (error) {
|
|
1400
|
-
this.logger.error('Failed to download backup from Google Drive', {
|
|
1522
|
+
this.logger.error('[DynamicWaasWalletClient] Failed to download backup from Google Drive', {
|
|
1401
1523
|
accountAddress,
|
|
1402
1524
|
fileName,
|
|
1403
1525
|
error
|
|
@@ -1405,7 +1527,7 @@ class DynamicWalletClient {
|
|
|
1405
1527
|
throw new Error('Failed to restore backup from Google Drive');
|
|
1406
1528
|
}
|
|
1407
1529
|
if (!backupData) {
|
|
1408
|
-
this.logger.error('No backup file found', {
|
|
1530
|
+
this.logger.error('[DynamicWaasWalletClient] No backup file found', {
|
|
1409
1531
|
accountAddress,
|
|
1410
1532
|
fileName
|
|
1411
1533
|
});
|
|
@@ -1413,7 +1535,7 @@ class DynamicWalletClient {
|
|
|
1413
1535
|
}
|
|
1414
1536
|
// Validate the backup data structure
|
|
1415
1537
|
if (!backupData.keyShares || !backupData.metadata) {
|
|
1416
|
-
this.logger.error('Invalid backup format: missing keyShares or metadata', {
|
|
1538
|
+
this.logger.error('[DynamicWaasWalletClient] Invalid backup format: missing keyShares or metadata', {
|
|
1417
1539
|
accountAddress,
|
|
1418
1540
|
fileName
|
|
1419
1541
|
});
|
|
@@ -1431,10 +1553,19 @@ class DynamicWalletClient {
|
|
|
1431
1553
|
});
|
|
1432
1554
|
return decryptedKeyShares;
|
|
1433
1555
|
} catch (error) {
|
|
1434
|
-
|
|
1556
|
+
const message = "[DynamicWaasWalletClient] Error in restoreBackupFromGoogleDrive";
|
|
1557
|
+
const context = {
|
|
1558
|
+
accountAddress,
|
|
1559
|
+
password,
|
|
1560
|
+
signedSessionId
|
|
1561
|
+
};
|
|
1435
1562
|
if (error instanceof AxiosError) {
|
|
1436
|
-
handleAxiosError(error);
|
|
1563
|
+
handleAxiosError(error, message, context);
|
|
1437
1564
|
}
|
|
1565
|
+
this.logger.error(message, {
|
|
1566
|
+
error,
|
|
1567
|
+
context
|
|
1568
|
+
});
|
|
1438
1569
|
throw error;
|
|
1439
1570
|
}
|
|
1440
1571
|
}
|
|
@@ -1620,10 +1751,16 @@ class DynamicWalletClient {
|
|
|
1620
1751
|
walletProperties: wallet == null ? void 0 : wallet.walletProperties
|
|
1621
1752
|
});
|
|
1622
1753
|
} catch (error) {
|
|
1623
|
-
|
|
1754
|
+
const message = "[DynamicWaasWalletClient] Error in getWalletClientKeyShareBackupInfo";
|
|
1624
1755
|
if (error instanceof AxiosError) {
|
|
1625
|
-
handleAxiosError(error
|
|
1756
|
+
handleAxiosError(error, message, {
|
|
1757
|
+
accountAddress
|
|
1758
|
+
});
|
|
1626
1759
|
}
|
|
1760
|
+
this.logger.error(message, {
|
|
1761
|
+
error,
|
|
1762
|
+
accountAddress
|
|
1763
|
+
});
|
|
1627
1764
|
throw error;
|
|
1628
1765
|
}
|
|
1629
1766
|
}
|
|
@@ -1636,13 +1773,13 @@ class DynamicWalletClient {
|
|
|
1636
1773
|
shareCount
|
|
1637
1774
|
});
|
|
1638
1775
|
if (existingWalletCheck) {
|
|
1639
|
-
this.logger.debug(`Wallet ${accountAddress} already exists`);
|
|
1776
|
+
this.logger.debug(`[DynamicWaasWalletClient] Wallet ${accountAddress} already exists`);
|
|
1640
1777
|
return this.walletMap[accountAddress];
|
|
1641
1778
|
}
|
|
1642
1779
|
// Fetch and restore wallet from server
|
|
1643
1780
|
const user = await this.apiClient.getUser();
|
|
1644
1781
|
const wallet = (_user_verifiedCredentials = user.verifiedCredentials) == null ? void 0 : _user_verifiedCredentials.find((vc)=>vc.address.toLowerCase() === accountAddress.toLowerCase());
|
|
1645
|
-
this.logger.debug('Restoring wallet', wallet);
|
|
1782
|
+
this.logger.debug('[DynamicWaasWalletClient] Restoring wallet', wallet);
|
|
1646
1783
|
const walletProperties = wallet.walletProperties;
|
|
1647
1784
|
this.walletMap[accountAddress] = _extends({}, this.walletMap[accountAddress], {
|
|
1648
1785
|
walletId: wallet.id,
|
|
@@ -1673,7 +1810,7 @@ class DynamicWalletClient {
|
|
|
1673
1810
|
accountAddress,
|
|
1674
1811
|
clientKeyShares: mergeUniqueKeyShares(existingKeyShares, decryptedKeyShares)
|
|
1675
1812
|
});
|
|
1676
|
-
this.logger.debug('Recovered backup', decryptedKeyShares);
|
|
1813
|
+
this.logger.debug('[DynamicWaasWalletClient] Recovered backup', decryptedKeyShares);
|
|
1677
1814
|
}
|
|
1678
1815
|
const walletCount = Object.keys(this.walletMap).length;
|
|
1679
1816
|
if (walletCount === 0) {
|
|
@@ -1685,9 +1822,16 @@ class DynamicWalletClient {
|
|
|
1685
1822
|
}
|
|
1686
1823
|
return this.walletMap[accountAddress];
|
|
1687
1824
|
} catch (error) {
|
|
1688
|
-
|
|
1825
|
+
const message = "[DynamicWaasWalletClient] Error in getWallet";
|
|
1826
|
+
const context = {
|
|
1827
|
+
accountAddress,
|
|
1828
|
+
walletOperation,
|
|
1829
|
+
shareCount,
|
|
1830
|
+
password,
|
|
1831
|
+
signedSessionId
|
|
1832
|
+
};
|
|
1689
1833
|
if (error instanceof AxiosError) {
|
|
1690
|
-
handleAxiosError(error);
|
|
1834
|
+
handleAxiosError(error, message, context);
|
|
1691
1835
|
}
|
|
1692
1836
|
throw error;
|
|
1693
1837
|
}
|
|
@@ -1726,10 +1870,13 @@ class DynamicWalletClient {
|
|
|
1726
1870
|
}, {});
|
|
1727
1871
|
return wallets;
|
|
1728
1872
|
} catch (error) {
|
|
1729
|
-
|
|
1873
|
+
const message = "[DynamicWaasWalletClient] Error in getWallets";
|
|
1730
1874
|
if (error instanceof AxiosError) {
|
|
1731
|
-
handleAxiosError(error);
|
|
1875
|
+
handleAxiosError(error, message, {});
|
|
1732
1876
|
}
|
|
1877
|
+
this.logger.error(message, {
|
|
1878
|
+
error
|
|
1879
|
+
});
|
|
1733
1880
|
throw error;
|
|
1734
1881
|
}
|
|
1735
1882
|
}
|
|
@@ -1749,7 +1896,7 @@ class DynamicWalletClient {
|
|
|
1749
1896
|
baseApiUrl
|
|
1750
1897
|
});
|
|
1751
1898
|
this.debug = Boolean(debug);
|
|
1752
|
-
this.logger.setLogLevel(this.debug ?
|
|
1899
|
+
this.logger.setLogLevel(this.debug ? LogLevel.DEBUG : DEFAULT_LOG_LEVEL);
|
|
1753
1900
|
// setup storage
|
|
1754
1901
|
if (supportsLocalStorage()) {
|
|
1755
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,OAAO,EAGL,KAAK,gBAAgB,EAEtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAmBhD,qBAAa,mBAAmB;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IAEtB,SAAS,CAAC,iBAAiB,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAAQ;IACrE,SAAS,CAAC,MAAM,wCAAU;IAC1B,SAAS,CAAC,SAAS,EAAE,gBAAgB,CAAC;IACtC,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAM;IAC3D,SAAS,CAAC,OAAO,EAAE,gBAAgB,CAAC;IACpC,SAAS,CAAC,aAAa,EAAE;QAAE,CAAC,GAAG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,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/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../packages/src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EAC1B,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAExE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAS5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD,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,SAAS,eAAsC,CAAC;AAE7D,eAAO,MAAM,WAAW,QAAS,MAAM,YAKtC,CAAC;AAEF,eAAO,MAAM,+BAA+B,kDAGzC;IACD,wBAAwB,EAAE,wBAAwB,CAAC;IACnD,cAAc,EAAE,MAAM,CAAC;CACxB,WAEA,CAAC;AAEF,eAAO,MAAM,2BAA2B,YAAa;I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