@dynamic-labs-wallet/browser 0.0.46 → 0.0.47
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 +51 -4
- package/index.esm.js +51 -5
- package/package.json +2 -2
- package/src/backup/encryption.d.ts.map +1 -1
- package/src/backup/providers/googleDrive.d.ts.map +1 -1
- package/src/client.d.ts +10 -4
- package/src/client.d.ts.map +1 -1
- package/src/constants.d.ts.map +1 -1
- package/src/mpc/types.d.ts.map +1 -1
- package/src/utils.d.ts +20 -4
- package/src/utils.d.ts.map +1 -1
package/index.cjs.js
CHANGED
|
@@ -40,6 +40,8 @@ const DEFAULT_LOG_LEVEL = 'INFO';
|
|
|
40
40
|
const STORAGE_KEY = 'dynamic-waas-wallet-client';
|
|
41
41
|
const CLIENT_KEYSHARE_EXPORT_FILENAME_PREFIX = 'dynamicWalletKeyShareBackup';
|
|
42
42
|
|
|
43
|
+
const logger = new logger$1.Logger('DynamicWaasWalletClient');
|
|
44
|
+
|
|
43
45
|
const bytesToBase64 = (arr)=>{
|
|
44
46
|
return btoa(Array.from(arr, (b)=>String.fromCharCode(b)).join(''));
|
|
45
47
|
};
|
|
@@ -107,6 +109,32 @@ const getClientKeyShareBackupInfo = (params)=>{
|
|
|
107
109
|
const timeoutPromise = ({ timeInMs, activity = 'Ceremony' })=>{
|
|
108
110
|
return new Promise((_, reject)=>setTimeout(()=>reject(new Error(`${activity} did not complete in ${timeInMs}ms`)), timeInMs));
|
|
109
111
|
};
|
|
112
|
+
/**
|
|
113
|
+
* Generic helper function to retry a promise-based operations
|
|
114
|
+
*
|
|
115
|
+
* @param operation - The async operation to retry
|
|
116
|
+
* @param config - Configuration options for retry behavior
|
|
117
|
+
* @returns Promise with the operation result
|
|
118
|
+
* @throws Last error encountered after all retries are exhausted
|
|
119
|
+
*/ async function retryPromise(operation, { maxAttempts = 5, retryInterval = 500, operationName = 'operation', logContext = {} } = {}) {
|
|
120
|
+
let attempts = 0;
|
|
121
|
+
while(attempts < maxAttempts){
|
|
122
|
+
try {
|
|
123
|
+
return await operation();
|
|
124
|
+
} catch (error) {
|
|
125
|
+
attempts++;
|
|
126
|
+
if (attempts === maxAttempts) {
|
|
127
|
+
logger.error(`Failed to execute ${operationName} after ${maxAttempts} attempts`, _extends({}, logContext, {
|
|
128
|
+
error
|
|
129
|
+
}));
|
|
130
|
+
throw error;
|
|
131
|
+
}
|
|
132
|
+
await new Promise((resolve)=>setTimeout(resolve, retryInterval));
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
// TypeScript needs this even though it's unreachable
|
|
136
|
+
throw new Error('Unreachable code');
|
|
137
|
+
}
|
|
110
138
|
|
|
111
139
|
const PBKDF2_ALGORITHM = 'PBKDF2';
|
|
112
140
|
const PBKDF2_ITERATIONS = 100000;
|
|
@@ -363,8 +391,6 @@ var WalletOperation = /*#__PURE__*/ function(WalletOperation) {
|
|
|
363
391
|
return WalletOperation;
|
|
364
392
|
}({});
|
|
365
393
|
|
|
366
|
-
const logger = new logger$1.Logger('DynamicWaasWalletClient');
|
|
367
|
-
|
|
368
394
|
class DynamicWalletClient {
|
|
369
395
|
async initialize() {
|
|
370
396
|
if (this.initializePromise) {
|
|
@@ -796,11 +822,15 @@ class DynamicWalletClient {
|
|
|
796
822
|
* @param {Object} params - The parameters for the backup operation
|
|
797
823
|
* @param {string} params.accountAddress - The account address of the wallet to backup
|
|
798
824
|
* @param {string} [params.password] - Optional password for encrypting the key shares
|
|
799
|
-
*/ async storeEncryptedBackupByWallet({ accountAddress, password = undefined }) {
|
|
800
|
-
const
|
|
825
|
+
*/ async storeEncryptedBackupByWallet({ accountAddress, clientKeyShares = undefined, password = undefined }) {
|
|
826
|
+
const keySharesToBackup = clientKeyShares != null ? clientKeyShares : this.walletMap[accountAddress].clientKeyShares;
|
|
827
|
+
const encryptedKeyShares = await Promise.all(keySharesToBackup.map((keyShare)=>this.encryptKeyShare({
|
|
801
828
|
keyShare,
|
|
802
829
|
password
|
|
803
830
|
})));
|
|
831
|
+
if (!this.walletMap[accountAddress].walletId) {
|
|
832
|
+
throw new Error(`WalletId not found for accountAddress: ${accountAddress}`);
|
|
833
|
+
}
|
|
804
834
|
const data = await this.apiClient.storeEncryptedBackupByWallet({
|
|
805
835
|
walletId: this.walletMap[accountAddress].walletId,
|
|
806
836
|
encryptedKeyShares,
|
|
@@ -834,6 +864,22 @@ class DynamicWalletClient {
|
|
|
834
864
|
await this.storage.setItem(this.storageKey, JSON.stringify(this.walletMap));
|
|
835
865
|
return data;
|
|
836
866
|
}
|
|
867
|
+
async storeEncryptedBackupByWalletWithRetry({ accountAddress, clientKeyShares, password }) {
|
|
868
|
+
await retryPromise(()=>this.storeEncryptedBackupByWallet({
|
|
869
|
+
accountAddress,
|
|
870
|
+
clientKeyShares,
|
|
871
|
+
password
|
|
872
|
+
}), {
|
|
873
|
+
operationName: 'store encrypted backup',
|
|
874
|
+
logContext: {
|
|
875
|
+
walletAddress: accountAddress,
|
|
876
|
+
keyShares: clientKeyShares == null ? void 0 : clientKeyShares.map((keyShare)=>this.encryptKeyShare({
|
|
877
|
+
keyShare,
|
|
878
|
+
password
|
|
879
|
+
}))
|
|
880
|
+
}
|
|
881
|
+
});
|
|
882
|
+
}
|
|
837
883
|
async updatePassword({ accountAddress, existingPassword, newPassword }) {
|
|
838
884
|
await this.getWallet({
|
|
839
885
|
accountAddress,
|
|
@@ -1402,6 +1448,7 @@ exports.getMPCSigner = getMPCSigner;
|
|
|
1402
1448
|
exports.isBrowser = isBrowser;
|
|
1403
1449
|
exports.isHexString = isHexString;
|
|
1404
1450
|
exports.mergeUniqueKeyShares = mergeUniqueKeyShares;
|
|
1451
|
+
exports.retryPromise = retryPromise;
|
|
1405
1452
|
exports.stringToBytes = stringToBytes;
|
|
1406
1453
|
exports.timeoutPromise = timeoutPromise;
|
|
1407
1454
|
Object.keys(core).forEach(function (k) {
|
package/index.esm.js
CHANGED
|
@@ -40,6 +40,8 @@ const DEFAULT_LOG_LEVEL = 'INFO';
|
|
|
40
40
|
const STORAGE_KEY = 'dynamic-waas-wallet-client';
|
|
41
41
|
const CLIENT_KEYSHARE_EXPORT_FILENAME_PREFIX = 'dynamicWalletKeyShareBackup';
|
|
42
42
|
|
|
43
|
+
const logger = new Logger('DynamicWaasWalletClient');
|
|
44
|
+
|
|
43
45
|
const bytesToBase64 = (arr)=>{
|
|
44
46
|
return btoa(Array.from(arr, (b)=>String.fromCharCode(b)).join(''));
|
|
45
47
|
};
|
|
@@ -107,6 +109,32 @@ const getClientKeyShareBackupInfo = (params)=>{
|
|
|
107
109
|
const timeoutPromise = ({ timeInMs, activity = 'Ceremony' })=>{
|
|
108
110
|
return new Promise((_, reject)=>setTimeout(()=>reject(new Error(`${activity} did not complete in ${timeInMs}ms`)), timeInMs));
|
|
109
111
|
};
|
|
112
|
+
/**
|
|
113
|
+
* Generic helper function to retry a promise-based operations
|
|
114
|
+
*
|
|
115
|
+
* @param operation - The async operation to retry
|
|
116
|
+
* @param config - Configuration options for retry behavior
|
|
117
|
+
* @returns Promise with the operation result
|
|
118
|
+
* @throws Last error encountered after all retries are exhausted
|
|
119
|
+
*/ async function retryPromise(operation, { maxAttempts = 5, retryInterval = 500, operationName = 'operation', logContext = {} } = {}) {
|
|
120
|
+
let attempts = 0;
|
|
121
|
+
while(attempts < maxAttempts){
|
|
122
|
+
try {
|
|
123
|
+
return await operation();
|
|
124
|
+
} catch (error) {
|
|
125
|
+
attempts++;
|
|
126
|
+
if (attempts === maxAttempts) {
|
|
127
|
+
logger.error(`Failed to execute ${operationName} after ${maxAttempts} attempts`, _extends({}, logContext, {
|
|
128
|
+
error
|
|
129
|
+
}));
|
|
130
|
+
throw error;
|
|
131
|
+
}
|
|
132
|
+
await new Promise((resolve)=>setTimeout(resolve, retryInterval));
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
// TypeScript needs this even though it's unreachable
|
|
136
|
+
throw new Error('Unreachable code');
|
|
137
|
+
}
|
|
110
138
|
|
|
111
139
|
const PBKDF2_ALGORITHM = 'PBKDF2';
|
|
112
140
|
const PBKDF2_ITERATIONS = 100000;
|
|
@@ -363,8 +391,6 @@ var WalletOperation = /*#__PURE__*/ function(WalletOperation) {
|
|
|
363
391
|
return WalletOperation;
|
|
364
392
|
}({});
|
|
365
393
|
|
|
366
|
-
const logger = new Logger('DynamicWaasWalletClient');
|
|
367
|
-
|
|
368
394
|
class DynamicWalletClient {
|
|
369
395
|
async initialize() {
|
|
370
396
|
if (this.initializePromise) {
|
|
@@ -796,11 +822,15 @@ class DynamicWalletClient {
|
|
|
796
822
|
* @param {Object} params - The parameters for the backup operation
|
|
797
823
|
* @param {string} params.accountAddress - The account address of the wallet to backup
|
|
798
824
|
* @param {string} [params.password] - Optional password for encrypting the key shares
|
|
799
|
-
*/ async storeEncryptedBackupByWallet({ accountAddress, password = undefined }) {
|
|
800
|
-
const
|
|
825
|
+
*/ async storeEncryptedBackupByWallet({ accountAddress, clientKeyShares = undefined, password = undefined }) {
|
|
826
|
+
const keySharesToBackup = clientKeyShares != null ? clientKeyShares : this.walletMap[accountAddress].clientKeyShares;
|
|
827
|
+
const encryptedKeyShares = await Promise.all(keySharesToBackup.map((keyShare)=>this.encryptKeyShare({
|
|
801
828
|
keyShare,
|
|
802
829
|
password
|
|
803
830
|
})));
|
|
831
|
+
if (!this.walletMap[accountAddress].walletId) {
|
|
832
|
+
throw new Error(`WalletId not found for accountAddress: ${accountAddress}`);
|
|
833
|
+
}
|
|
804
834
|
const data = await this.apiClient.storeEncryptedBackupByWallet({
|
|
805
835
|
walletId: this.walletMap[accountAddress].walletId,
|
|
806
836
|
encryptedKeyShares,
|
|
@@ -834,6 +864,22 @@ class DynamicWalletClient {
|
|
|
834
864
|
await this.storage.setItem(this.storageKey, JSON.stringify(this.walletMap));
|
|
835
865
|
return data;
|
|
836
866
|
}
|
|
867
|
+
async storeEncryptedBackupByWalletWithRetry({ accountAddress, clientKeyShares, password }) {
|
|
868
|
+
await retryPromise(()=>this.storeEncryptedBackupByWallet({
|
|
869
|
+
accountAddress,
|
|
870
|
+
clientKeyShares,
|
|
871
|
+
password
|
|
872
|
+
}), {
|
|
873
|
+
operationName: 'store encrypted backup',
|
|
874
|
+
logContext: {
|
|
875
|
+
walletAddress: accountAddress,
|
|
876
|
+
keyShares: clientKeyShares == null ? void 0 : clientKeyShares.map((keyShare)=>this.encryptKeyShare({
|
|
877
|
+
keyShare,
|
|
878
|
+
password
|
|
879
|
+
}))
|
|
880
|
+
}
|
|
881
|
+
});
|
|
882
|
+
}
|
|
837
883
|
async updatePassword({ accountAddress, existingPassword, newPassword }) {
|
|
838
884
|
await this.getWallet({
|
|
839
885
|
accountAddress,
|
|
@@ -1342,4 +1388,4 @@ class DynamicWalletClient {
|
|
|
1342
1388
|
}
|
|
1343
1389
|
}
|
|
1344
1390
|
|
|
1345
|
-
export { DynamicWalletClient, WalletOperation, base64ToBytes, bytesToBase64, ensureBase64Padding, getClientKeyShareBackupInfo, getClientKeyShareExportFileName, getMPCSignatureScheme, getMPCSigner, isBrowser, isHexString, mergeUniqueKeyShares, stringToBytes, timeoutPromise };
|
|
1391
|
+
export { DynamicWalletClient, WalletOperation, base64ToBytes, bytesToBase64, ensureBase64Padding, getClientKeyShareBackupInfo, getClientKeyShareExportFileName, getMPCSignatureScheme, getMPCSigner, isBrowser, isHexString, mergeUniqueKeyShares, retryPromise, stringToBytes, timeoutPromise };
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs-wallet/browser",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.47",
|
|
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.47",
|
|
7
7
|
"@dynamic-labs/logger": "^4.5.1"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encryption.d.ts","sourceRoot":"","sources":["../../src/backup/encryption.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,gBAAgB,WAAW,CAAC;AACzC,eAAO,MAAM,iBAAiB,SAAS,CAAC;AACxC,eAAO,MAAM,qBAAqB,YAAY,CAAC;AAE/C,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAC3C,eAAO,MAAM,cAAc,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"encryption.d.ts","sourceRoot":"","sources":["../../src/backup/encryption.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,gBAAgB,WAAW,CAAC;AACzC,eAAO,MAAM,iBAAiB,SAAS,CAAC;AACxC,eAAO,MAAM,qBAAqB,YAAY,CAAC;AAE/C,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAC3C,eAAO,MAAM,cAAc,MAAM,CAAC;AAiClC,eAAO,MAAM,WAAW,wBAGrB;IACD,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB;;;;EA4BA,CAAC;AAEF,eAAO,MAAM,WAAW,wBAGrB;IACD,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACnD,QAAQ,EAAE,MAAM,CAAC;CAClB,oBA0BA,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"googleDrive.d.ts","sourceRoot":"","sources":["../../../src/backup/providers/googleDrive.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iCAAiC,yCAI3C;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;CACnB,iBAOA,CAAC;AAEF,eAAO,MAAM,+BAA+B,yCAIzC;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;CACnB,iBAOA,CAAC;
|
|
1
|
+
{"version":3,"file":"googleDrive.d.ts","sourceRoot":"","sources":["../../../src/backup/providers/googleDrive.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iCAAiC,yCAI3C;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;CACnB,iBAOA,CAAC;AAEF,eAAO,MAAM,+BAA+B,yCAIzC;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;CACnB,iBAOA,CAAC;AAgDF,eAAO,MAAM,wBAAwB,2BAGlC;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd,iBAsBA,CAAC;AAEF,eAAO,MAAM,2BAA2B,2BAGrC;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd,KAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAiCzB,CAAC"}
|
package/src/client.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ export declare class DynamicWalletClient {
|
|
|
27
27
|
clientKeygenIds: string[];
|
|
28
28
|
thresholdSignatureScheme: ThresholdSignatureScheme;
|
|
29
29
|
onError?: (error: Error) => void;
|
|
30
|
-
onCeremonyComplete?: () => void;
|
|
30
|
+
onCeremonyComplete?: (accountAddress: string, walletId: string) => void;
|
|
31
31
|
}): Promise<import("build/core/src/types").KeygenCompleteResponse>;
|
|
32
32
|
clientInitializeKeyGen({ chainName, thresholdSignatureScheme, }: {
|
|
33
33
|
chainName: string;
|
|
@@ -52,7 +52,7 @@ export declare class DynamicWalletClient {
|
|
|
52
52
|
chainName: string;
|
|
53
53
|
thresholdSignatureScheme: ThresholdSignatureScheme;
|
|
54
54
|
onError?: (error: Error) => void;
|
|
55
|
-
onCeremonyComplete?: () => void;
|
|
55
|
+
onCeremonyComplete?: (accountAddress: string, walletId: string) => void;
|
|
56
56
|
}): Promise<{
|
|
57
57
|
rawPublicKey: EcdsaPublicKey | Uint8Array | undefined;
|
|
58
58
|
clientKeyShares: ClientKeyShare[];
|
|
@@ -151,10 +151,16 @@ export declare class DynamicWalletClient {
|
|
|
151
151
|
* @param {string} params.accountAddress - The account address of the wallet to backup
|
|
152
152
|
* @param {string} [params.password] - Optional password for encrypting the key shares
|
|
153
153
|
*/
|
|
154
|
-
storeEncryptedBackupByWallet({ accountAddress, password, }: {
|
|
154
|
+
storeEncryptedBackupByWallet({ accountAddress, clientKeyShares, password, }: {
|
|
155
155
|
accountAddress: string;
|
|
156
|
+
clientKeyShares?: ClientKeyShare[];
|
|
156
157
|
password?: string;
|
|
157
158
|
}): Promise<any>;
|
|
159
|
+
storeEncryptedBackupByWalletWithRetry({ accountAddress, clientKeyShares, password, }: {
|
|
160
|
+
accountAddress: string;
|
|
161
|
+
clientKeyShares?: ClientKeyShare[];
|
|
162
|
+
password?: string;
|
|
163
|
+
}): Promise<void>;
|
|
158
164
|
updatePassword({ accountAddress, existingPassword, newPassword, }: {
|
|
159
165
|
accountAddress: string;
|
|
160
166
|
existingPassword?: string;
|
|
@@ -210,7 +216,7 @@ export declare class DynamicWalletClient {
|
|
|
210
216
|
privateKey: string;
|
|
211
217
|
thresholdSignatureScheme: ThresholdSignatureScheme;
|
|
212
218
|
onError?: (error: Error) => void;
|
|
213
|
-
onCeremonyComplete?: () => void;
|
|
219
|
+
onCeremonyComplete?: (accountAddress: string, walletId: string) => void;
|
|
214
220
|
}): Promise<{
|
|
215
221
|
rawPublicKey: EcdsaPublicKey | Uint8Array | undefined;
|
|
216
222
|
clientKeyShares: ClientKeyShare[];
|
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,wBAAwB,EACxB,gBAAgB,EAIhB,cAAc,EACf,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAIL,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAElB,cAAc,EACf,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAoBrE,OAAO,EAGL,gBAAgB,EAEjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAEL,wBAAwB,EACxB,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EAChB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../packages/src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,wBAAwB,EACxB,gBAAgB,EAIhB,cAAc,EACf,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAIL,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAElB,cAAc,EACf,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAoBrE,OAAO,EAGL,gBAAgB,EAEjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAEL,wBAAwB,EACxB,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EAChB,MAAM,SAAS,CAAC;AAUjB,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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AAC,OAAO,CAAC;IA+Bd,iCAAiC,CAAC,EACtC,cAAc,GACf,EAAE;QACD,cAAc,EAAE,MAAM,CAAC;KACxB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAoBzB,SAAS,CAAC,EACd,cAAc,EACd,eAA8C,EAC9C,UAAsB,EACtB,QAAoB,GACrB,EAAE;QACD,cAAc,EAAE,MAAM,CAAC;QACvB,eAAe,CAAC,EAAE,eAAe,CAAC;QAClC,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB;IAgEK,UAAU;CAoCjB"}
|
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,SAAS,CAAC;AAExC,eAAO,MAAM,WAAW,+BAA+B,CAAC;AAExD,eAAO,MAAM,eAAe,qCAAqC,CAAC;AAElE,eAAO,MAAM,sCAAsC,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../packages/src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,SAAS,CAAC;AAExC,eAAO,MAAM,WAAW,+BAA+B,CAAC;AAExD,eAAO,MAAM,eAAe,qCAAqC,CAAC;AAElE,eAAO,MAAM,sCAAsC,gCACpB,CAAC;AAEhC,eAAO,MAAM,iCAAiC,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAKtE,CAAC;AAEF,eAAO,MAAM,iCAAiC,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAItE,CAAC"}
|
package/src/mpc/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/mpc/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,kBAAkB,EAClB,uBAAuB,EACvB,qBAAqB,EACrB,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,eAAe,CAAC;AAEvB,MAAM,MAAM,sBAAsB,GAC9B,qBAAqB,GACrB,uBAAuB,GACvB,sBAAsB,CAAC;AAE3B,MAAM,MAAM,cAAc,GACtB,iBAAiB,GACjB,mBAAmB,GACnB,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/mpc/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,kBAAkB,EAClB,uBAAuB,EACvB,qBAAqB,EACrB,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,eAAe,CAAC;AAEvB,MAAM,MAAM,sBAAsB,GAC9B,qBAAqB,GACrB,uBAAuB,GACvB,sBAAsB,CAAC;AAE3B,MAAM,MAAM,cAAc,GACtB,iBAAiB,GACjB,mBAAmB,GACnB,kBAAkB,CAAC;AAEvB,YAAY,EACV,KAAK,EACL,OAAO,EACP,MAAM,EACN,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,WAAW,EACX,cAAc,GACf,MAAM,eAAe,CAAC"}
|
package/src/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ThresholdSignatureScheme } from
|
|
2
|
-
import { KeyShareBackupInfo, WaasWalletProperties } from
|
|
3
|
-
import { ClientKeyShare } from
|
|
1
|
+
import { ThresholdSignatureScheme } from '@dynamic-labs-wallet/core';
|
|
2
|
+
import { KeyShareBackupInfo, WaasWalletProperties } from './types';
|
|
3
|
+
import { ClientKeyShare } from './mpc/types';
|
|
4
4
|
export declare const bytesToBase64: (arr: Uint8Array) => string;
|
|
5
5
|
export declare const stringToBytes: (str: string) => Uint8Array;
|
|
6
6
|
export declare const base64ToBytes: (base64: string) => Uint8Array;
|
|
@@ -21,8 +21,24 @@ export declare const getClientKeyShareBackupInfo: (params?: {
|
|
|
21
21
|
* @returns Array of merged unique keyshares
|
|
22
22
|
*/
|
|
23
23
|
export declare const mergeUniqueKeyShares: (existingKeyShares: ClientKeyShare[], newKeyShares: ClientKeyShare[]) => ClientKeyShare[];
|
|
24
|
-
export declare const timeoutPromise: ({ timeInMs, activity }: {
|
|
24
|
+
export declare const timeoutPromise: ({ timeInMs, activity, }: {
|
|
25
25
|
timeInMs: number;
|
|
26
26
|
activity?: string;
|
|
27
27
|
}) => Promise<unknown>;
|
|
28
|
+
interface RetryConfig {
|
|
29
|
+
maxAttempts?: number;
|
|
30
|
+
retryInterval?: number;
|
|
31
|
+
operationName?: string;
|
|
32
|
+
logContext?: Record<string, unknown>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Generic helper function to retry a promise-based operations
|
|
36
|
+
*
|
|
37
|
+
* @param operation - The async operation to retry
|
|
38
|
+
* @param config - Configuration options for retry behavior
|
|
39
|
+
* @returns Promise with the operation result
|
|
40
|
+
* @throws Last error encountered after all retries are exhausted
|
|
41
|
+
*/
|
|
42
|
+
export declare function retryPromise<T>(operation: () => Promise<T>, { maxAttempts, retryInterval, operationName, logContext, }?: RetryConfig): Promise<T>;
|
|
43
|
+
export {};
|
|
28
44
|
//# sourceMappingURL=utils.d.ts.map
|
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,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../packages/src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,wBAAwB,EACzB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG7C,eAAO,MAAM,aAAa,QAAS,UAAU,WAE5C,CAAC;AAEF,eA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