@dynamic-labs-wallet/browser 0.0.89 → 0.0.91
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 +203 -64
- package/index.esm.js +192 -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,19 @@ 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
|
+
};
|
|
852
|
+
if (error instanceof axios.AxiosError) {
|
|
853
|
+
handleAxiosError(error, message, context);
|
|
802
854
|
}
|
|
855
|
+
this.logger.error(message, {
|
|
856
|
+
error,
|
|
857
|
+
context
|
|
858
|
+
});
|
|
803
859
|
throw error;
|
|
804
860
|
}
|
|
805
861
|
}
|
|
@@ -844,10 +900,18 @@ class DynamicWalletClient {
|
|
|
844
900
|
signedSessionId
|
|
845
901
|
});
|
|
846
902
|
} catch (error) {
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
903
|
+
const message = "[DynamicWaasWalletClient] Error in refreshWalletAccountShares";
|
|
904
|
+
const context = {
|
|
905
|
+
accountAddress,
|
|
906
|
+
chainName
|
|
907
|
+
};
|
|
908
|
+
if (error instanceof axios.AxiosError) {
|
|
909
|
+
handleAxiosError(error, message, context);
|
|
850
910
|
}
|
|
911
|
+
this.logger.error(message, {
|
|
912
|
+
error,
|
|
913
|
+
context
|
|
914
|
+
});
|
|
851
915
|
throw error;
|
|
852
916
|
}
|
|
853
917
|
}
|
|
@@ -967,10 +1031,20 @@ class DynamicWalletClient {
|
|
|
967
1031
|
signedSessionId
|
|
968
1032
|
});
|
|
969
1033
|
} catch (error) {
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
1034
|
+
const message = "[DynamicWaasWalletClient] Error in reshare";
|
|
1035
|
+
const context = {
|
|
1036
|
+
accountAddress,
|
|
1037
|
+
chainName,
|
|
1038
|
+
oldThresholdSignatureScheme,
|
|
1039
|
+
newThresholdSignatureScheme
|
|
1040
|
+
};
|
|
1041
|
+
if (error instanceof axios.AxiosError) {
|
|
1042
|
+
handleAxiosError(error, message, context);
|
|
973
1043
|
}
|
|
1044
|
+
this.logger.error(message, {
|
|
1045
|
+
error,
|
|
1046
|
+
context
|
|
1047
|
+
});
|
|
974
1048
|
throw error;
|
|
975
1049
|
}
|
|
976
1050
|
}
|
|
@@ -1028,10 +1102,18 @@ class DynamicWalletClient {
|
|
|
1028
1102
|
derivedPrivateKey
|
|
1029
1103
|
};
|
|
1030
1104
|
} catch (error) {
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1105
|
+
const message = "[DynamicWaasWalletClient] Error in exportKey";
|
|
1106
|
+
const context = {
|
|
1107
|
+
accountAddress,
|
|
1108
|
+
chainName
|
|
1109
|
+
};
|
|
1110
|
+
if (error instanceof axios.AxiosError) {
|
|
1111
|
+
handleAxiosError(error, message, context);
|
|
1034
1112
|
}
|
|
1113
|
+
this.logger.error(message, {
|
|
1114
|
+
error,
|
|
1115
|
+
context
|
|
1116
|
+
});
|
|
1035
1117
|
throw error;
|
|
1036
1118
|
}
|
|
1037
1119
|
}
|
|
@@ -1071,7 +1153,7 @@ class DynamicWalletClient {
|
|
|
1071
1153
|
rawPublicKey
|
|
1072
1154
|
};
|
|
1073
1155
|
} catch (error) {
|
|
1074
|
-
this.logger.error('[DynamicWaasWalletClient]
|
|
1156
|
+
this.logger.error('[DynamicWaasWalletClient] Error in offlineExportKey', error);
|
|
1075
1157
|
throw error;
|
|
1076
1158
|
}
|
|
1077
1159
|
}
|
|
@@ -1091,7 +1173,7 @@ class DynamicWalletClient {
|
|
|
1091
1173
|
var _this_storage;
|
|
1092
1174
|
const walletObject = await ((_this_storage = this.storage) == null ? void 0 : _this_storage.getItem(accountAddress));
|
|
1093
1175
|
if (!walletObject) {
|
|
1094
|
-
this.logger.debug(`No item found in iframe local storage for accountAddress: ${accountAddress}`);
|
|
1176
|
+
this.logger.debug(`[DynamicWaasWalletClient] No item found in iframe local storage for accountAddress: ${accountAddress}`);
|
|
1095
1177
|
return [];
|
|
1096
1178
|
}
|
|
1097
1179
|
try {
|
|
@@ -1103,7 +1185,7 @@ class DynamicWalletClient {
|
|
|
1103
1185
|
}
|
|
1104
1186
|
return (parsedWalletObject == null ? void 0 : parsedWalletObject.clientKeyShares) || [];
|
|
1105
1187
|
} catch (error) {
|
|
1106
|
-
this.logger.error(`Error parsing clientKeyShares: ${error} for accountAddress: ${accountAddress}`);
|
|
1188
|
+
this.logger.error(`[DynamicWaasWalletClient] Error parsing clientKeyShares: ${error} for accountAddress: ${accountAddress}`);
|
|
1107
1189
|
return [];
|
|
1108
1190
|
}
|
|
1109
1191
|
}
|
|
@@ -1145,6 +1227,7 @@ class DynamicWalletClient {
|
|
|
1145
1227
|
password
|
|
1146
1228
|
})));
|
|
1147
1229
|
if (!this.walletMap[accountAddress].walletId) {
|
|
1230
|
+
this.logger.error(`[DynamicWaasWalletClient] WalletId not found for accountAddress: ${accountAddress}`);
|
|
1148
1231
|
throw new Error(`WalletId not found for accountAddress: ${accountAddress}`);
|
|
1149
1232
|
}
|
|
1150
1233
|
// TODO(zfaizal2): throw error if signedSessionId is not provided after service deploy
|
|
@@ -1179,10 +1262,17 @@ class DynamicWalletClient {
|
|
|
1179
1262
|
await this.storage.setItem(this.storageKey, JSON.stringify(this.walletMap));
|
|
1180
1263
|
return data;
|
|
1181
1264
|
} catch (error) {
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1265
|
+
const message = "[DynamicWaasWalletClient] Error in storeEncryptedBackupByWallet";
|
|
1266
|
+
const context = {
|
|
1267
|
+
accountAddress
|
|
1268
|
+
};
|
|
1269
|
+
if (error instanceof axios.AxiosError) {
|
|
1270
|
+
handleAxiosError(error, message, context);
|
|
1185
1271
|
}
|
|
1272
|
+
this.logger.error(message, {
|
|
1273
|
+
error: error instanceof Error ? error.message : 'Unknown error',
|
|
1274
|
+
context
|
|
1275
|
+
});
|
|
1186
1276
|
throw error;
|
|
1187
1277
|
}
|
|
1188
1278
|
}
|
|
@@ -1195,11 +1285,7 @@ class DynamicWalletClient {
|
|
|
1195
1285
|
}), {
|
|
1196
1286
|
operationName: 'store encrypted backup',
|
|
1197
1287
|
logContext: {
|
|
1198
|
-
walletAddress: accountAddress
|
|
1199
|
-
keyShares: clientKeyShares == null ? void 0 : clientKeyShares.map((keyShare)=>this.encryptKeyShare({
|
|
1200
|
-
keyShare,
|
|
1201
|
-
password
|
|
1202
|
-
}))
|
|
1288
|
+
walletAddress: accountAddress
|
|
1203
1289
|
}
|
|
1204
1290
|
});
|
|
1205
1291
|
}
|
|
@@ -1243,10 +1329,16 @@ class DynamicWalletClient {
|
|
|
1243
1329
|
}
|
|
1244
1330
|
return oauthAccountId;
|
|
1245
1331
|
} catch (error) {
|
|
1246
|
-
|
|
1247
|
-
if (error instanceof
|
|
1248
|
-
|
|
1332
|
+
const message = "[DynamicWaasWalletClient] Error in getGoogleOauthAccountIdOrThrow";
|
|
1333
|
+
if (error instanceof axios.AxiosError) {
|
|
1334
|
+
handleAxiosError(error, message, {
|
|
1335
|
+
accountAddress
|
|
1336
|
+
});
|
|
1249
1337
|
}
|
|
1338
|
+
this.logger.error(message, {
|
|
1339
|
+
error,
|
|
1340
|
+
accountAddress
|
|
1341
|
+
});
|
|
1250
1342
|
throw error;
|
|
1251
1343
|
}
|
|
1252
1344
|
}
|
|
@@ -1308,7 +1400,22 @@ class DynamicWalletClient {
|
|
|
1308
1400
|
}
|
|
1309
1401
|
return decryptedKeyShares;
|
|
1310
1402
|
} catch (error) {
|
|
1311
|
-
|
|
1403
|
+
const message = "[DynamicWaasWalletClient] Error in recoverEncryptedBackupByWallet";
|
|
1404
|
+
const context = {
|
|
1405
|
+
accountAddress,
|
|
1406
|
+
password,
|
|
1407
|
+
walletOperation,
|
|
1408
|
+
signedSessionId,
|
|
1409
|
+
shareCount,
|
|
1410
|
+
storeRecoveredShares
|
|
1411
|
+
};
|
|
1412
|
+
if (error instanceof axios.AxiosError) {
|
|
1413
|
+
handleAxiosError(error, message, context);
|
|
1414
|
+
}
|
|
1415
|
+
this.logger.error(message, {
|
|
1416
|
+
error,
|
|
1417
|
+
context
|
|
1418
|
+
});
|
|
1312
1419
|
throw error;
|
|
1313
1420
|
}
|
|
1314
1421
|
}
|
|
@@ -1368,10 +1475,19 @@ class DynamicWalletClient {
|
|
|
1368
1475
|
storageKey: this.storageKey
|
|
1369
1476
|
});
|
|
1370
1477
|
} catch (error) {
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1478
|
+
const message = "[DynamicWaasWalletClient] Error in backupKeySharesToGoogleDrive";
|
|
1479
|
+
const context = {
|
|
1480
|
+
accountAddress,
|
|
1481
|
+
password,
|
|
1482
|
+
signedSessionId
|
|
1483
|
+
};
|
|
1484
|
+
if (error instanceof axios.AxiosError) {
|
|
1485
|
+
handleAxiosError(error, message, context);
|
|
1374
1486
|
}
|
|
1487
|
+
this.logger.error(message, {
|
|
1488
|
+
error,
|
|
1489
|
+
context
|
|
1490
|
+
});
|
|
1375
1491
|
throw error;
|
|
1376
1492
|
}
|
|
1377
1493
|
}
|
|
@@ -1397,7 +1513,7 @@ class DynamicWalletClient {
|
|
|
1397
1513
|
fileName
|
|
1398
1514
|
}));
|
|
1399
1515
|
} catch (error) {
|
|
1400
|
-
this.logger.error('Failed to download backup from Google Drive', {
|
|
1516
|
+
this.logger.error('[DynamicWaasWalletClient] Failed to download backup from Google Drive', {
|
|
1401
1517
|
accountAddress,
|
|
1402
1518
|
fileName,
|
|
1403
1519
|
error
|
|
@@ -1405,7 +1521,7 @@ class DynamicWalletClient {
|
|
|
1405
1521
|
throw new Error('Failed to restore backup from Google Drive');
|
|
1406
1522
|
}
|
|
1407
1523
|
if (!backupData) {
|
|
1408
|
-
this.logger.error('No backup file found', {
|
|
1524
|
+
this.logger.error('[DynamicWaasWalletClient] No backup file found', {
|
|
1409
1525
|
accountAddress,
|
|
1410
1526
|
fileName
|
|
1411
1527
|
});
|
|
@@ -1413,7 +1529,7 @@ class DynamicWalletClient {
|
|
|
1413
1529
|
}
|
|
1414
1530
|
// Validate the backup data structure
|
|
1415
1531
|
if (!backupData.keyShares || !backupData.metadata) {
|
|
1416
|
-
this.logger.error('Invalid backup format: missing keyShares or metadata', {
|
|
1532
|
+
this.logger.error('[DynamicWaasWalletClient] Invalid backup format: missing keyShares or metadata', {
|
|
1417
1533
|
accountAddress,
|
|
1418
1534
|
fileName
|
|
1419
1535
|
});
|
|
@@ -1431,10 +1547,17 @@ class DynamicWalletClient {
|
|
|
1431
1547
|
});
|
|
1432
1548
|
return decryptedKeyShares;
|
|
1433
1549
|
} catch (error) {
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1550
|
+
const message = "[DynamicWaasWalletClient] Error in restoreBackupFromGoogleDrive";
|
|
1551
|
+
const context = {
|
|
1552
|
+
accountAddress
|
|
1553
|
+
};
|
|
1554
|
+
if (error instanceof axios.AxiosError) {
|
|
1555
|
+
handleAxiosError(error, message, context);
|
|
1437
1556
|
}
|
|
1557
|
+
this.logger.error(message, {
|
|
1558
|
+
error,
|
|
1559
|
+
context
|
|
1560
|
+
});
|
|
1438
1561
|
throw error;
|
|
1439
1562
|
}
|
|
1440
1563
|
}
|
|
@@ -1620,10 +1743,16 @@ class DynamicWalletClient {
|
|
|
1620
1743
|
walletProperties: wallet == null ? void 0 : wallet.walletProperties
|
|
1621
1744
|
});
|
|
1622
1745
|
} catch (error) {
|
|
1623
|
-
|
|
1624
|
-
if (error instanceof
|
|
1625
|
-
|
|
1746
|
+
const message = "[DynamicWaasWalletClient] Error in getWalletClientKeyShareBackupInfo";
|
|
1747
|
+
if (error instanceof axios.AxiosError) {
|
|
1748
|
+
handleAxiosError(error, message, {
|
|
1749
|
+
accountAddress
|
|
1750
|
+
});
|
|
1626
1751
|
}
|
|
1752
|
+
this.logger.error(message, {
|
|
1753
|
+
error,
|
|
1754
|
+
accountAddress
|
|
1755
|
+
});
|
|
1627
1756
|
throw error;
|
|
1628
1757
|
}
|
|
1629
1758
|
}
|
|
@@ -1636,13 +1765,13 @@ class DynamicWalletClient {
|
|
|
1636
1765
|
shareCount
|
|
1637
1766
|
});
|
|
1638
1767
|
if (existingWalletCheck) {
|
|
1639
|
-
this.logger.debug(`Wallet ${accountAddress} already exists`);
|
|
1768
|
+
this.logger.debug(`[DynamicWaasWalletClient] Wallet ${accountAddress} already exists`);
|
|
1640
1769
|
return this.walletMap[accountAddress];
|
|
1641
1770
|
}
|
|
1642
1771
|
// Fetch and restore wallet from server
|
|
1643
1772
|
const user = await this.apiClient.getUser();
|
|
1644
1773
|
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);
|
|
1774
|
+
this.logger.debug('[DynamicWaasWalletClient] Restoring wallet', wallet);
|
|
1646
1775
|
const walletProperties = wallet.walletProperties;
|
|
1647
1776
|
this.walletMap[accountAddress] = _extends({}, this.walletMap[accountAddress], {
|
|
1648
1777
|
walletId: wallet.id,
|
|
@@ -1673,7 +1802,7 @@ class DynamicWalletClient {
|
|
|
1673
1802
|
accountAddress,
|
|
1674
1803
|
clientKeyShares: mergeUniqueKeyShares(existingKeyShares, decryptedKeyShares)
|
|
1675
1804
|
});
|
|
1676
|
-
this.logger.debug('Recovered backup', decryptedKeyShares);
|
|
1805
|
+
this.logger.debug('[DynamicWaasWalletClient] Recovered backup', decryptedKeyShares);
|
|
1677
1806
|
}
|
|
1678
1807
|
const walletCount = Object.keys(this.walletMap).length;
|
|
1679
1808
|
if (walletCount === 0) {
|
|
@@ -1685,9 +1814,16 @@ class DynamicWalletClient {
|
|
|
1685
1814
|
}
|
|
1686
1815
|
return this.walletMap[accountAddress];
|
|
1687
1816
|
} catch (error) {
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1817
|
+
const message = "[DynamicWaasWalletClient] Error in getWallet";
|
|
1818
|
+
const context = {
|
|
1819
|
+
accountAddress,
|
|
1820
|
+
walletOperation,
|
|
1821
|
+
shareCount,
|
|
1822
|
+
password,
|
|
1823
|
+
signedSessionId
|
|
1824
|
+
};
|
|
1825
|
+
if (error instanceof axios.AxiosError) {
|
|
1826
|
+
handleAxiosError(error, message, context);
|
|
1691
1827
|
}
|
|
1692
1828
|
throw error;
|
|
1693
1829
|
}
|
|
@@ -1726,10 +1862,13 @@ class DynamicWalletClient {
|
|
|
1726
1862
|
}, {});
|
|
1727
1863
|
return wallets;
|
|
1728
1864
|
} catch (error) {
|
|
1729
|
-
|
|
1730
|
-
if (error instanceof
|
|
1731
|
-
|
|
1865
|
+
const message = "[DynamicWaasWalletClient] Error in getWallets";
|
|
1866
|
+
if (error instanceof axios.AxiosError) {
|
|
1867
|
+
handleAxiosError(error, message, {});
|
|
1732
1868
|
}
|
|
1869
|
+
this.logger.error(message, {
|
|
1870
|
+
error
|
|
1871
|
+
});
|
|
1733
1872
|
throw error;
|
|
1734
1873
|
}
|
|
1735
1874
|
}
|
|
@@ -1749,7 +1888,7 @@ class DynamicWalletClient {
|
|
|
1749
1888
|
baseApiUrl
|
|
1750
1889
|
});
|
|
1751
1890
|
this.debug = Boolean(debug);
|
|
1752
|
-
this.logger.setLogLevel(this.debug ?
|
|
1891
|
+
this.logger.setLogLevel(this.debug ? logger$1.LogLevel.DEBUG : DEFAULT_LOG_LEVEL);
|
|
1753
1892
|
// setup storage
|
|
1754
1893
|
if (supportsLocalStorage()) {
|
|
1755
1894
|
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,19 @@ 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
|
+
};
|
|
800
852
|
if (error instanceof AxiosError) {
|
|
801
|
-
handleAxiosError(error);
|
|
853
|
+
handleAxiosError(error, message, context);
|
|
802
854
|
}
|
|
855
|
+
this.logger.error(message, {
|
|
856
|
+
error,
|
|
857
|
+
context
|
|
858
|
+
});
|
|
803
859
|
throw error;
|
|
804
860
|
}
|
|
805
861
|
}
|
|
@@ -844,10 +900,18 @@ class DynamicWalletClient {
|
|
|
844
900
|
signedSessionId
|
|
845
901
|
});
|
|
846
902
|
} catch (error) {
|
|
847
|
-
|
|
903
|
+
const message = "[DynamicWaasWalletClient] Error in refreshWalletAccountShares";
|
|
904
|
+
const context = {
|
|
905
|
+
accountAddress,
|
|
906
|
+
chainName
|
|
907
|
+
};
|
|
848
908
|
if (error instanceof AxiosError) {
|
|
849
|
-
handleAxiosError(error);
|
|
909
|
+
handleAxiosError(error, message, context);
|
|
850
910
|
}
|
|
911
|
+
this.logger.error(message, {
|
|
912
|
+
error,
|
|
913
|
+
context
|
|
914
|
+
});
|
|
851
915
|
throw error;
|
|
852
916
|
}
|
|
853
917
|
}
|
|
@@ -967,10 +1031,20 @@ class DynamicWalletClient {
|
|
|
967
1031
|
signedSessionId
|
|
968
1032
|
});
|
|
969
1033
|
} catch (error) {
|
|
970
|
-
|
|
1034
|
+
const message = "[DynamicWaasWalletClient] Error in reshare";
|
|
1035
|
+
const context = {
|
|
1036
|
+
accountAddress,
|
|
1037
|
+
chainName,
|
|
1038
|
+
oldThresholdSignatureScheme,
|
|
1039
|
+
newThresholdSignatureScheme
|
|
1040
|
+
};
|
|
971
1041
|
if (error instanceof AxiosError) {
|
|
972
|
-
handleAxiosError(error);
|
|
1042
|
+
handleAxiosError(error, message, context);
|
|
973
1043
|
}
|
|
1044
|
+
this.logger.error(message, {
|
|
1045
|
+
error,
|
|
1046
|
+
context
|
|
1047
|
+
});
|
|
974
1048
|
throw error;
|
|
975
1049
|
}
|
|
976
1050
|
}
|
|
@@ -1028,10 +1102,18 @@ class DynamicWalletClient {
|
|
|
1028
1102
|
derivedPrivateKey
|
|
1029
1103
|
};
|
|
1030
1104
|
} catch (error) {
|
|
1031
|
-
|
|
1105
|
+
const message = "[DynamicWaasWalletClient] Error in exportKey";
|
|
1106
|
+
const context = {
|
|
1107
|
+
accountAddress,
|
|
1108
|
+
chainName
|
|
1109
|
+
};
|
|
1032
1110
|
if (error instanceof AxiosError) {
|
|
1033
|
-
handleAxiosError(error);
|
|
1111
|
+
handleAxiosError(error, message, context);
|
|
1034
1112
|
}
|
|
1113
|
+
this.logger.error(message, {
|
|
1114
|
+
error,
|
|
1115
|
+
context
|
|
1116
|
+
});
|
|
1035
1117
|
throw error;
|
|
1036
1118
|
}
|
|
1037
1119
|
}
|
|
@@ -1071,7 +1153,7 @@ class DynamicWalletClient {
|
|
|
1071
1153
|
rawPublicKey
|
|
1072
1154
|
};
|
|
1073
1155
|
} catch (error) {
|
|
1074
|
-
this.logger.error('[DynamicWaasWalletClient]
|
|
1156
|
+
this.logger.error('[DynamicWaasWalletClient] Error in offlineExportKey', error);
|
|
1075
1157
|
throw error;
|
|
1076
1158
|
}
|
|
1077
1159
|
}
|
|
@@ -1091,7 +1173,7 @@ class DynamicWalletClient {
|
|
|
1091
1173
|
var _this_storage;
|
|
1092
1174
|
const walletObject = await ((_this_storage = this.storage) == null ? void 0 : _this_storage.getItem(accountAddress));
|
|
1093
1175
|
if (!walletObject) {
|
|
1094
|
-
this.logger.debug(`No item found in iframe local storage for accountAddress: ${accountAddress}`);
|
|
1176
|
+
this.logger.debug(`[DynamicWaasWalletClient] No item found in iframe local storage for accountAddress: ${accountAddress}`);
|
|
1095
1177
|
return [];
|
|
1096
1178
|
}
|
|
1097
1179
|
try {
|
|
@@ -1103,7 +1185,7 @@ class DynamicWalletClient {
|
|
|
1103
1185
|
}
|
|
1104
1186
|
return (parsedWalletObject == null ? void 0 : parsedWalletObject.clientKeyShares) || [];
|
|
1105
1187
|
} catch (error) {
|
|
1106
|
-
this.logger.error(`Error parsing clientKeyShares: ${error} for accountAddress: ${accountAddress}`);
|
|
1188
|
+
this.logger.error(`[DynamicWaasWalletClient] Error parsing clientKeyShares: ${error} for accountAddress: ${accountAddress}`);
|
|
1107
1189
|
return [];
|
|
1108
1190
|
}
|
|
1109
1191
|
}
|
|
@@ -1145,6 +1227,7 @@ class DynamicWalletClient {
|
|
|
1145
1227
|
password
|
|
1146
1228
|
})));
|
|
1147
1229
|
if (!this.walletMap[accountAddress].walletId) {
|
|
1230
|
+
this.logger.error(`[DynamicWaasWalletClient] WalletId not found for accountAddress: ${accountAddress}`);
|
|
1148
1231
|
throw new Error(`WalletId not found for accountAddress: ${accountAddress}`);
|
|
1149
1232
|
}
|
|
1150
1233
|
// TODO(zfaizal2): throw error if signedSessionId is not provided after service deploy
|
|
@@ -1179,10 +1262,17 @@ class DynamicWalletClient {
|
|
|
1179
1262
|
await this.storage.setItem(this.storageKey, JSON.stringify(this.walletMap));
|
|
1180
1263
|
return data;
|
|
1181
1264
|
} catch (error) {
|
|
1182
|
-
|
|
1265
|
+
const message = "[DynamicWaasWalletClient] Error in storeEncryptedBackupByWallet";
|
|
1266
|
+
const context = {
|
|
1267
|
+
accountAddress
|
|
1268
|
+
};
|
|
1183
1269
|
if (error instanceof AxiosError) {
|
|
1184
|
-
handleAxiosError(error);
|
|
1270
|
+
handleAxiosError(error, message, context);
|
|
1185
1271
|
}
|
|
1272
|
+
this.logger.error(message, {
|
|
1273
|
+
error: error instanceof Error ? error.message : 'Unknown error',
|
|
1274
|
+
context
|
|
1275
|
+
});
|
|
1186
1276
|
throw error;
|
|
1187
1277
|
}
|
|
1188
1278
|
}
|
|
@@ -1195,11 +1285,7 @@ class DynamicWalletClient {
|
|
|
1195
1285
|
}), {
|
|
1196
1286
|
operationName: 'store encrypted backup',
|
|
1197
1287
|
logContext: {
|
|
1198
|
-
walletAddress: accountAddress
|
|
1199
|
-
keyShares: clientKeyShares == null ? void 0 : clientKeyShares.map((keyShare)=>this.encryptKeyShare({
|
|
1200
|
-
keyShare,
|
|
1201
|
-
password
|
|
1202
|
-
}))
|
|
1288
|
+
walletAddress: accountAddress
|
|
1203
1289
|
}
|
|
1204
1290
|
});
|
|
1205
1291
|
}
|
|
@@ -1243,10 +1329,16 @@ class DynamicWalletClient {
|
|
|
1243
1329
|
}
|
|
1244
1330
|
return oauthAccountId;
|
|
1245
1331
|
} catch (error) {
|
|
1246
|
-
|
|
1332
|
+
const message = "[DynamicWaasWalletClient] Error in getGoogleOauthAccountIdOrThrow";
|
|
1247
1333
|
if (error instanceof AxiosError) {
|
|
1248
|
-
handleAxiosError(error
|
|
1334
|
+
handleAxiosError(error, message, {
|
|
1335
|
+
accountAddress
|
|
1336
|
+
});
|
|
1249
1337
|
}
|
|
1338
|
+
this.logger.error(message, {
|
|
1339
|
+
error,
|
|
1340
|
+
accountAddress
|
|
1341
|
+
});
|
|
1250
1342
|
throw error;
|
|
1251
1343
|
}
|
|
1252
1344
|
}
|
|
@@ -1308,7 +1400,22 @@ class DynamicWalletClient {
|
|
|
1308
1400
|
}
|
|
1309
1401
|
return decryptedKeyShares;
|
|
1310
1402
|
} catch (error) {
|
|
1311
|
-
|
|
1403
|
+
const message = "[DynamicWaasWalletClient] Error in recoverEncryptedBackupByWallet";
|
|
1404
|
+
const context = {
|
|
1405
|
+
accountAddress,
|
|
1406
|
+
password,
|
|
1407
|
+
walletOperation,
|
|
1408
|
+
signedSessionId,
|
|
1409
|
+
shareCount,
|
|
1410
|
+
storeRecoveredShares
|
|
1411
|
+
};
|
|
1412
|
+
if (error instanceof AxiosError) {
|
|
1413
|
+
handleAxiosError(error, message, context);
|
|
1414
|
+
}
|
|
1415
|
+
this.logger.error(message, {
|
|
1416
|
+
error,
|
|
1417
|
+
context
|
|
1418
|
+
});
|
|
1312
1419
|
throw error;
|
|
1313
1420
|
}
|
|
1314
1421
|
}
|
|
@@ -1368,10 +1475,19 @@ class DynamicWalletClient {
|
|
|
1368
1475
|
storageKey: this.storageKey
|
|
1369
1476
|
});
|
|
1370
1477
|
} catch (error) {
|
|
1371
|
-
|
|
1478
|
+
const message = "[DynamicWaasWalletClient] Error in backupKeySharesToGoogleDrive";
|
|
1479
|
+
const context = {
|
|
1480
|
+
accountAddress,
|
|
1481
|
+
password,
|
|
1482
|
+
signedSessionId
|
|
1483
|
+
};
|
|
1372
1484
|
if (error instanceof AxiosError) {
|
|
1373
|
-
handleAxiosError(error);
|
|
1485
|
+
handleAxiosError(error, message, context);
|
|
1374
1486
|
}
|
|
1487
|
+
this.logger.error(message, {
|
|
1488
|
+
error,
|
|
1489
|
+
context
|
|
1490
|
+
});
|
|
1375
1491
|
throw error;
|
|
1376
1492
|
}
|
|
1377
1493
|
}
|
|
@@ -1397,7 +1513,7 @@ class DynamicWalletClient {
|
|
|
1397
1513
|
fileName
|
|
1398
1514
|
}));
|
|
1399
1515
|
} catch (error) {
|
|
1400
|
-
this.logger.error('Failed to download backup from Google Drive', {
|
|
1516
|
+
this.logger.error('[DynamicWaasWalletClient] Failed to download backup from Google Drive', {
|
|
1401
1517
|
accountAddress,
|
|
1402
1518
|
fileName,
|
|
1403
1519
|
error
|
|
@@ -1405,7 +1521,7 @@ class DynamicWalletClient {
|
|
|
1405
1521
|
throw new Error('Failed to restore backup from Google Drive');
|
|
1406
1522
|
}
|
|
1407
1523
|
if (!backupData) {
|
|
1408
|
-
this.logger.error('No backup file found', {
|
|
1524
|
+
this.logger.error('[DynamicWaasWalletClient] No backup file found', {
|
|
1409
1525
|
accountAddress,
|
|
1410
1526
|
fileName
|
|
1411
1527
|
});
|
|
@@ -1413,7 +1529,7 @@ class DynamicWalletClient {
|
|
|
1413
1529
|
}
|
|
1414
1530
|
// Validate the backup data structure
|
|
1415
1531
|
if (!backupData.keyShares || !backupData.metadata) {
|
|
1416
|
-
this.logger.error('Invalid backup format: missing keyShares or metadata', {
|
|
1532
|
+
this.logger.error('[DynamicWaasWalletClient] Invalid backup format: missing keyShares or metadata', {
|
|
1417
1533
|
accountAddress,
|
|
1418
1534
|
fileName
|
|
1419
1535
|
});
|
|
@@ -1431,10 +1547,17 @@ class DynamicWalletClient {
|
|
|
1431
1547
|
});
|
|
1432
1548
|
return decryptedKeyShares;
|
|
1433
1549
|
} catch (error) {
|
|
1434
|
-
|
|
1550
|
+
const message = "[DynamicWaasWalletClient] Error in restoreBackupFromGoogleDrive";
|
|
1551
|
+
const context = {
|
|
1552
|
+
accountAddress
|
|
1553
|
+
};
|
|
1435
1554
|
if (error instanceof AxiosError) {
|
|
1436
|
-
handleAxiosError(error);
|
|
1555
|
+
handleAxiosError(error, message, context);
|
|
1437
1556
|
}
|
|
1557
|
+
this.logger.error(message, {
|
|
1558
|
+
error,
|
|
1559
|
+
context
|
|
1560
|
+
});
|
|
1438
1561
|
throw error;
|
|
1439
1562
|
}
|
|
1440
1563
|
}
|
|
@@ -1620,10 +1743,16 @@ class DynamicWalletClient {
|
|
|
1620
1743
|
walletProperties: wallet == null ? void 0 : wallet.walletProperties
|
|
1621
1744
|
});
|
|
1622
1745
|
} catch (error) {
|
|
1623
|
-
|
|
1746
|
+
const message = "[DynamicWaasWalletClient] Error in getWalletClientKeyShareBackupInfo";
|
|
1624
1747
|
if (error instanceof AxiosError) {
|
|
1625
|
-
handleAxiosError(error
|
|
1748
|
+
handleAxiosError(error, message, {
|
|
1749
|
+
accountAddress
|
|
1750
|
+
});
|
|
1626
1751
|
}
|
|
1752
|
+
this.logger.error(message, {
|
|
1753
|
+
error,
|
|
1754
|
+
accountAddress
|
|
1755
|
+
});
|
|
1627
1756
|
throw error;
|
|
1628
1757
|
}
|
|
1629
1758
|
}
|
|
@@ -1636,13 +1765,13 @@ class DynamicWalletClient {
|
|
|
1636
1765
|
shareCount
|
|
1637
1766
|
});
|
|
1638
1767
|
if (existingWalletCheck) {
|
|
1639
|
-
this.logger.debug(`Wallet ${accountAddress} already exists`);
|
|
1768
|
+
this.logger.debug(`[DynamicWaasWalletClient] Wallet ${accountAddress} already exists`);
|
|
1640
1769
|
return this.walletMap[accountAddress];
|
|
1641
1770
|
}
|
|
1642
1771
|
// Fetch and restore wallet from server
|
|
1643
1772
|
const user = await this.apiClient.getUser();
|
|
1644
1773
|
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);
|
|
1774
|
+
this.logger.debug('[DynamicWaasWalletClient] Restoring wallet', wallet);
|
|
1646
1775
|
const walletProperties = wallet.walletProperties;
|
|
1647
1776
|
this.walletMap[accountAddress] = _extends({}, this.walletMap[accountAddress], {
|
|
1648
1777
|
walletId: wallet.id,
|
|
@@ -1673,7 +1802,7 @@ class DynamicWalletClient {
|
|
|
1673
1802
|
accountAddress,
|
|
1674
1803
|
clientKeyShares: mergeUniqueKeyShares(existingKeyShares, decryptedKeyShares)
|
|
1675
1804
|
});
|
|
1676
|
-
this.logger.debug('Recovered backup', decryptedKeyShares);
|
|
1805
|
+
this.logger.debug('[DynamicWaasWalletClient] Recovered backup', decryptedKeyShares);
|
|
1677
1806
|
}
|
|
1678
1807
|
const walletCount = Object.keys(this.walletMap).length;
|
|
1679
1808
|
if (walletCount === 0) {
|
|
@@ -1685,9 +1814,16 @@ class DynamicWalletClient {
|
|
|
1685
1814
|
}
|
|
1686
1815
|
return this.walletMap[accountAddress];
|
|
1687
1816
|
} catch (error) {
|
|
1688
|
-
|
|
1817
|
+
const message = "[DynamicWaasWalletClient] Error in getWallet";
|
|
1818
|
+
const context = {
|
|
1819
|
+
accountAddress,
|
|
1820
|
+
walletOperation,
|
|
1821
|
+
shareCount,
|
|
1822
|
+
password,
|
|
1823
|
+
signedSessionId
|
|
1824
|
+
};
|
|
1689
1825
|
if (error instanceof AxiosError) {
|
|
1690
|
-
handleAxiosError(error);
|
|
1826
|
+
handleAxiosError(error, message, context);
|
|
1691
1827
|
}
|
|
1692
1828
|
throw error;
|
|
1693
1829
|
}
|
|
@@ -1726,10 +1862,13 @@ class DynamicWalletClient {
|
|
|
1726
1862
|
}, {});
|
|
1727
1863
|
return wallets;
|
|
1728
1864
|
} catch (error) {
|
|
1729
|
-
|
|
1865
|
+
const message = "[DynamicWaasWalletClient] Error in getWallets";
|
|
1730
1866
|
if (error instanceof AxiosError) {
|
|
1731
|
-
handleAxiosError(error);
|
|
1867
|
+
handleAxiosError(error, message, {});
|
|
1732
1868
|
}
|
|
1869
|
+
this.logger.error(message, {
|
|
1870
|
+
error
|
|
1871
|
+
});
|
|
1733
1872
|
throw error;
|
|
1734
1873
|
}
|
|
1735
1874
|
}
|
|
@@ -1749,7 +1888,7 @@ class DynamicWalletClient {
|
|
|
1749
1888
|
baseApiUrl
|
|
1750
1889
|
});
|
|
1751
1890
|
this.debug = Boolean(debug);
|
|
1752
|
-
this.logger.setLogLevel(this.debug ?
|
|
1891
|
+
this.logger.setLogLevel(this.debug ? LogLevel.DEBUG : DEFAULT_LOG_LEVEL);
|
|
1753
1892
|
// setup storage
|
|
1754
1893
|
if (supportsLocalStorage()) {
|
|
1755
1894
|
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.91",
|
|
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.91",
|
|
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","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A8C,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,gBAAg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