@dynamic-labs-wallet/browser 0.0.2 → 0.0.4

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.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import { SigningAlgorithm, RELAY_API_URL, getMPCChainConfig, MPC_CONFIG, ThresholdSignatureScheme, DynamicApiClient } from '@dynamic-labs-wallet/core';
1
+ import { SigningAlgorithm, RELAY_API_URL, getMPCChainConfig, MPC_CONFIG, getClientThreshold, getTSSConfig, DynamicApiClient } from '@dynamic-labs-wallet/core';
2
2
  export * from '@dynamic-labs-wallet/core';
3
3
  import { BIP340, Ed25519, Ecdsa, MessageHash } from '@dynamic-labs-wallet/lib-mpc-web';
4
4
  export { BIP340, BIP340InitKeygenResult, BIP340KeygenResult, Ecdsa, EcdsaInitKeygenResult, EcdsaKeygenResult, EcdsaPublicKey, EcdsaSignature, Ed25519, Ed25519InitKeygenResult, Ed25519KeygenResult, MessageHash } from '@dynamic-labs-wallet/lib-mpc-web';
@@ -182,12 +182,15 @@ const downloadFileFromGoogleDrive = async ({ accessToken, name })=>{
182
182
  const BACKUP_FILENAME = 'dynamicWalletSecretBackup.json';
183
183
 
184
184
  class DynamicWalletClient {
185
- async serverInitializeKeyGen({ chainName, clientPrimaryKeygenId, clientSecondaryKeygenId }) {
185
+ async serverInitializeKeyGen({ chainName, clientPrimaryKeygenId, clientSecondaryKeygenId, thresholdSignatureScheme }) {
186
186
  // Initilize keygen, create room, and create the wallet account on the server
187
187
  const data = await this.apiClient.createWalletAccount({
188
188
  chainName,
189
- clientPrimaryKeygenId,
190
- clientSecondaryKeygenId
189
+ clientKeygenIds: [
190
+ clientPrimaryKeygenId,
191
+ clientSecondaryKeygenId
192
+ ],
193
+ thresholdSignatureScheme
191
194
  });
192
195
  return data;
193
196
  }
@@ -216,13 +219,13 @@ class DynamicWalletClient {
216
219
  const chainConfig = getMPCChainConfig(chainName);
217
220
  let publicKey;
218
221
  if (mpcSigner instanceof Ecdsa) {
219
- publicKey = await mpcSigner.derivePubkey(keyShare != null ? keyShare : this.clientKeyshare, new Uint32Array(chainConfig.derivationPath));
222
+ publicKey = await mpcSigner.derivePubkey(keyShare, new Uint32Array(chainConfig.derivationPath));
220
223
  } else if (mpcSigner instanceof Ed25519) {
221
- publicKey = await mpcSigner.derivePubkey(keyShare != null ? keyShare : this.clientKeyshare, new Uint32Array(chainConfig.derivationPath));
224
+ publicKey = await mpcSigner.derivePubkey(keyShare, new Uint32Array(chainConfig.derivationPath));
222
225
  }
223
226
  return publicKey;
224
227
  }
225
- async clientKeyGen({ chainName, roomId, serverKeygenId, clientPrimaryKeygenInitResult, clientSecondaryKeygenInitResult }) {
228
+ async clientKeyGen({ chainName, roomId, serverKeygenIds, clientPrimaryKeygenInitResult, clientSecondaryKeygenInitResult, thresholdSignatureScheme }) {
226
229
  // Get the chain config and the mpc signer
227
230
  const chainConfig = getMPCChainConfig(chainName);
228
231
  const mpcSigner = getMPCSigner({
@@ -233,22 +236,21 @@ class DynamicWalletClient {
233
236
  const clientPrimaryKeygenId = clientPrimaryKeygenInitResult.keygenId;
234
237
  const clientSecondaryKeygenId = clientSecondaryKeygenInitResult.keygenId;
235
238
  const clientPrimaryKeygenIds = [
236
- serverKeygenId,
239
+ ...serverKeygenIds,
237
240
  clientSecondaryKeygenId
238
241
  ];
239
242
  const clientSecondaryKeygenIds = [
240
- serverKeygenId,
243
+ ...serverKeygenIds,
241
244
  clientPrimaryKeygenId
242
245
  ];
243
246
  // Get the MPC config for the threshold signature scheme
244
- const mpcConfig = MPC_CONFIG[ThresholdSignatureScheme.TWO_OF_THREE];
247
+ const mpcConfig = MPC_CONFIG[thresholdSignatureScheme];
245
248
  // All parties join the keygen room
246
249
  const keygenResults = await Promise.all([
247
250
  mpcSigner.keygen(roomId, mpcConfig.numberOfParties, mpcConfig.threshold, clientPrimaryKeygenInitResult, clientPrimaryKeygenIds),
248
251
  mpcSigner.keygen(roomId, mpcConfig.numberOfParties, mpcConfig.threshold, clientSecondaryKeygenInitResult, clientSecondaryKeygenIds)
249
252
  ]);
250
253
  const [clientPrimaryKeygenResult, clientSecondaryKeygenResult] = keygenResults;
251
- this.clientKeyshare = clientPrimaryKeygenResult;
252
254
  // Pick the derivation path of the public key you want to sign for
253
255
  const derivationPath = new Uint32Array(chainConfig.derivationPath);
254
256
  // Get the public key for the derivation path
@@ -266,7 +268,7 @@ class DynamicWalletClient {
266
268
  secondaryKeygenResult: clientSecondaryKeygenResult
267
269
  };
268
270
  }
269
- async keyGen({ chainName }) {
271
+ async keyGen({ chainName, thresholdSignatureScheme }) {
270
272
  try {
271
273
  const { clientPrimaryKeygenInitResult, clientSecondaryKeygenInitResult } = await this.clientInitializeKeyGen({
272
274
  chainName
@@ -274,14 +276,16 @@ class DynamicWalletClient {
274
276
  const data = await this.serverInitializeKeyGen({
275
277
  chainName,
276
278
  clientPrimaryKeygenId: clientPrimaryKeygenInitResult.keygenId,
277
- clientSecondaryKeygenId: clientSecondaryKeygenInitResult.keygenId
279
+ clientSecondaryKeygenId: clientSecondaryKeygenInitResult.keygenId,
280
+ thresholdSignatureScheme
278
281
  });
279
282
  const { rawPublicKey, primaryKeygenResult, secondaryKeygenResult } = await this.clientKeyGen({
280
283
  chainName,
281
284
  roomId: data.roomId,
282
- serverKeygenId: data.serverKeygenId,
285
+ serverKeygenIds: data.serverKeygenIds,
283
286
  clientPrimaryKeygenInitResult,
284
- clientSecondaryKeygenInitResult
287
+ clientSecondaryKeygenInitResult,
288
+ thresholdSignatureScheme
285
289
  });
286
290
  return {
287
291
  rawPublicKey,
@@ -293,70 +297,98 @@ class DynamicWalletClient {
293
297
  throw new Error('Error creating wallet account');
294
298
  }
295
299
  }
296
- async serverSign({ messageToSign }) {
300
+ async serverSign({ walletId, message }) {
297
301
  // Create the room and sign the message
298
302
  const data = await this.apiClient.signMessage({
299
- messageToSign
303
+ walletId,
304
+ message
300
305
  });
301
306
  return data;
302
307
  }
303
- async clientSign({ chainName, messageToSign, roomId }) {
304
- // Get the chain config and the mpc signer
305
- const chainConfig = getMPCChainConfig(chainName);
306
- const mpcSigner = getMPCSigner({
307
- chainName,
308
- baseRelayUrl: RELAY_API_URL
309
- });
310
- console.log('clientKeyshare', this.clientKeyshare);
311
- const derivationPath = new Uint32Array(chainConfig.derivationPath);
312
- const formattedMessage = mpcSigner instanceof Ecdsa ? MessageHash.sha256(messageToSign) : new TextEncoder().encode(messageToSign);
313
- const signature = await mpcSigner.sign(roomId, this.clientKeyshare, formattedMessage, derivationPath);
314
- return signature;
308
+ async clientSign({ chainName, message, roomId, keyShare }) {
309
+ try {
310
+ const chainConfig = getMPCChainConfig(chainName);
311
+ const mpcSigner = getMPCSigner({
312
+ chainName,
313
+ baseRelayUrl: RELAY_API_URL
314
+ });
315
+ const derivationPath = new Uint32Array(chainConfig.derivationPath);
316
+ let formattedMessage;
317
+ if (mpcSigner instanceof Ecdsa) {
318
+ formattedMessage = MessageHash.sha256(message);
319
+ } else if (mpcSigner instanceof Ed25519) {
320
+ formattedMessage = new TextEncoder().encode(message);
321
+ } else if (mpcSigner instanceof BIP340) {
322
+ formattedMessage = new TextEncoder().encode(message);
323
+ } else {
324
+ throw new Error('Unsupported signer type');
325
+ }
326
+ const signature = await mpcSigner.sign(roomId, keyShare, formattedMessage, derivationPath);
327
+ return signature;
328
+ } catch (error) {
329
+ console.error('Error in clientSign:', error);
330
+ throw error;
331
+ }
315
332
  }
316
- async sign({ chainName, messageToSign }) {
333
+ async sign({ accountAddress, message }) {
334
+ const wallet = await this.getWallet({
335
+ accountAddress
336
+ });
337
+ const chainName = wallet.chainName;
317
338
  // Perform the server sign
318
339
  const data = await this.serverSign({
319
- messageToSign
340
+ walletId: wallet.walletId,
341
+ message
320
342
  });
321
343
  // Perform the client sign and return the signature
322
344
  const signature = await this.clientSign({
323
345
  chainName,
324
- messageToSign,
325
- roomId: data.roomId
346
+ message,
347
+ roomId: data.roomId,
348
+ keyShare: wallet.clientKeyShares[0]
326
349
  });
327
350
  return signature;
328
351
  }
329
- async refreshWalletAccountShares({ chainName, clientPrimaryKeyshare, clientSecondaryKeyshare }) {
352
+ async refreshWalletAccountShares({ accountAddress }) {
353
+ const wallet = await this.getWallet({
354
+ accountAddress
355
+ });
356
+ const chainName = wallet.chainName;
330
357
  const mpcSigner = getMPCSigner({
331
358
  chainName,
332
359
  baseRelayUrl: RELAY_API_URL
333
360
  });
334
361
  // Create the room and refresh the shares
335
- const data = await this.apiClient.refreshWalletAccountShares();
362
+ const data = await this.apiClient.refreshWalletAccountShares({
363
+ walletId: wallet.walletId
364
+ });
336
365
  const roomId = data.roomId;
337
366
  const keygenResults = await Promise.all([
338
- mpcSigner.refresh(roomId, clientPrimaryKeyshare),
339
- mpcSigner.refresh(roomId, clientSecondaryKeyshare)
367
+ mpcSigner.refresh(roomId, wallet.clientKeyShares[0]),
368
+ mpcSigner.refresh(roomId, wallet.clientKeyShares[1])
340
369
  ]);
341
- this.clientKeyshare = keygenResults[0];
342
370
  return keygenResults;
343
371
  }
344
- async serverReshareRemainingParty({ clientPrimaryKeygenId, clientSecondaryKeygenId }) {
372
+ async serverReshareRemainingParty({ walletId, clientKeygenIds }) {
345
373
  const data = await this.apiClient.reshareRemainingParty({
346
- clientPrimaryKeygenId,
347
- clientSecondaryKeygenId
374
+ walletId,
375
+ clientKeygenIds
348
376
  });
349
377
  return data;
350
378
  }
351
- async getKeygenId({ chainName, clientKeyshare }) {
379
+ async getExportId({ chainName, clientKeyShare }) {
352
380
  const mpcSigner = getMPCSigner({
353
381
  chainName,
354
382
  baseRelayUrl: RELAY_API_URL
355
383
  });
356
- const exportId = await mpcSigner.exportID(clientKeyshare);
384
+ const exportId = await mpcSigner.exportID(clientKeyShare);
357
385
  return exportId;
358
386
  }
359
- async reshareRemainingParty({ chainName, clientKeyshare }) {
387
+ async reshareRemainingParty({ accountAddress, thresholdSignatureScheme }) {
388
+ const wallet = await this.getWallet({
389
+ accountAddress
390
+ });
391
+ const chainName = wallet.chainName;
360
392
  const mpcSigner = getMPCSigner({
361
393
  chainName,
362
394
  baseRelayUrl: RELAY_API_URL
@@ -364,18 +396,21 @@ class DynamicWalletClient {
364
396
  // Initialize the new party
365
397
  const newPartyInitKeygen = await mpcSigner.initKeygen();
366
398
  const newPartyInitKeygenId = newPartyInitKeygen.keygenId;
367
- const clientKeygenId = await this.getKeygenId({
399
+ const clientKeygenId = await this.getExportId({
368
400
  chainName,
369
- clientKeyshare
401
+ clientKeyShare: wallet.clientKeyShares[0]
370
402
  });
371
403
  // Create the room and reshare the server share
372
404
  const data = await this.serverReshareRemainingParty({
373
- clientPrimaryKeygenId: newPartyInitKeygenId,
374
- clientSecondaryKeygenId: clientKeygenId
405
+ walletId: wallet.walletId,
406
+ clientKeygenIds: [
407
+ newPartyInitKeygenId,
408
+ clientKeygenId
409
+ ]
375
410
  });
376
411
  const roomId = data.roomId;
377
412
  // Get the MPC config for the threshold signature scheme
378
- const mpcConfig = MPC_CONFIG[ThresholdSignatureScheme.TWO_OF_THREE];
413
+ const mpcConfig = MPC_CONFIG[thresholdSignatureScheme];
379
414
  const newClientPrimaryKeygenIds = [
380
415
  data.serverKeygenId,
381
416
  clientKeygenId
@@ -388,25 +423,29 @@ class DynamicWalletClient {
388
423
  console.log('clientSecondaryKeygenIds', clientSecondaryKeygenIds);
389
424
  const keygenResults = await Promise.all([
390
425
  mpcSigner.reshareNewParty(roomId, mpcConfig.threshold, mpcConfig.threshold, newPartyInitKeygen, newClientPrimaryKeygenIds),
391
- mpcSigner.reshareRemainingParty(roomId, mpcConfig.threshold, clientKeyshare, clientSecondaryKeygenIds)
426
+ mpcSigner.reshareRemainingParty(roomId, mpcConfig.threshold, wallet.clientKeyShares[1], clientSecondaryKeygenIds)
392
427
  ]);
393
- this.clientKeyshare = keygenResults[0];
394
428
  return keygenResults;
395
429
  }
396
- async exportPrivateKey({ chainName, clientKeyshare }) {
430
+ async exportPrivateKey({ accountAddress }) {
431
+ const wallet = await this.getWallet({
432
+ accountAddress
433
+ });
434
+ const chainName = wallet.chainName;
397
435
  const chainConfig = getMPCChainConfig(chainName);
398
436
  const mpcSigner = getMPCSigner({
399
437
  chainName,
400
438
  baseRelayUrl: RELAY_API_URL
401
439
  });
402
- const exportId = await this.getKeygenId({
440
+ const exportId = await this.getExportId({
403
441
  chainName,
404
- clientKeyshare
442
+ clientKeyShare: wallet.clientKeyShares[0]
405
443
  });
406
444
  const data = await this.apiClient.exportKey({
445
+ walletId: wallet.walletId,
407
446
  exportId
408
447
  });
409
- const keyExportRaw = await mpcSigner.exportFullPrivateKey(data.roomId, clientKeyshare, exportId);
448
+ const keyExportRaw = await mpcSigner.exportFullPrivateKey(data.roomId, wallet.clientKeyShares[0], exportId);
410
449
  if (!keyExportRaw) {
411
450
  throw new Error('Error exporting private key');
412
451
  }
@@ -423,7 +462,17 @@ class DynamicWalletClient {
423
462
  derivedPrivateKey
424
463
  };
425
464
  }
426
- async offlineExportPrivateKey({ chainName, keyShares }) {
465
+ //todo: if we already have the client threshold inside the walletMap then we do not need to remove the keyShares
466
+ async offlineExportPrivateKey({ chainName, keyShares, accountAddress }) {
467
+ const wallet = await this.getWallet({
468
+ accountAddress
469
+ });
470
+ const clientKeyShares = wallet.clientKeyShares;
471
+ const walletKeyShares = keyShares != null ? keyShares : clientKeyShares;
472
+ const clientThreshold = getClientThreshold(wallet.thresholdSignatureScheme);
473
+ if (!walletKeyShares || walletKeyShares.length !== clientThreshold) {
474
+ throw new Error('Must provide 2 key shares');
475
+ }
427
476
  const chainConfig = getMPCChainConfig(chainName);
428
477
  const mpcSigner = getMPCSigner({
429
478
  chainName,
@@ -456,13 +505,15 @@ class DynamicWalletClient {
456
505
  const serializedEncryptedKeyShare = Buffer.from(JSON.stringify(encryptedKeyShare)).toString('base64');
457
506
  return serializedEncryptedKeyShare;
458
507
  }
459
- async storeEncryptedBackup({ keyShare, password }) {
460
- const encryptedKeyShare = await this.encryptKeyShare({
461
- keyShare,
462
- password
463
- });
464
- const data = await this.apiClient.storeEncryptedBackup({
465
- keyShare: encryptedKeyShare
508
+ async storeEncryptedBackupByWallet({ walletId, keyShares, password }) {
509
+ const encryptedKeyShares = await Promise.all(keyShares.map((keyShare)=>this.encryptKeyShare({
510
+ keyShare,
511
+ password
512
+ })));
513
+ const data = await this.apiClient.storeEncryptedBackupByWallet({
514
+ walletId,
515
+ encryptedKeyShares,
516
+ passwordEncrypted: password ? true : false
466
517
  });
467
518
  return data;
468
519
  }
@@ -475,22 +526,38 @@ class DynamicWalletClient {
475
526
  const deserializedKeyShare = JSON.parse(decryptedKeyShare);
476
527
  return deserializedKeyShare;
477
528
  }
478
- async recoverEncryptedBackup({ password } = {}) {
479
- const data = await this.apiClient.recoverEncryptedBackup();
480
- const decryptedKeyShare = await this.decryptKeyShare({
481
- keyShare: data.keyShare,
482
- password: password != null ? password : this.environmentId
483
- });
484
- this.restoreBackupShare({
485
- keyShare: decryptedKeyShare
529
+ async recoverEncryptedBackupByWallet({ accountAddress, walletId, password, keyShareIds }) {
530
+ const data = await this.apiClient.recoverEncryptedBackupByWallet({
531
+ walletId,
532
+ keyShareIds
533
+ });
534
+ const decryptedKeyShares = await Promise.all(data.keyShares.map((keyShare)=>this.decryptKeyShare({
535
+ keyShare: keyShare.encryptedAccountCredential,
536
+ password: password != null ? password : this.environmentId
537
+ })));
538
+ decryptedKeyShares.forEach((keyShare)=>{
539
+ this.restoreBackupShare({
540
+ accountAddress,
541
+ walletId,
542
+ chainName: data.chainName,
543
+ keyShare,
544
+ thresholdSignatureScheme: data.thresholdSignatureScheme
545
+ });
486
546
  });
487
- return decryptedKeyShare;
488
- }
489
- restoreBackupShare({ keyShare }) {
490
- this.clientKeyshare = keyShare;
547
+ return decryptedKeyShares;
491
548
  }
492
- async getClientShare() {
493
- return this.clientKeyshare;
549
+ restoreBackupShare({ walletId, accountAddress, chainName, keyShare, thresholdSignatureScheme }) {
550
+ var _this_walletMap_accountAddress;
551
+ this.walletMap[accountAddress] = {
552
+ walletId,
553
+ chainName,
554
+ accountAddress,
555
+ clientKeyShares: [
556
+ ...((_this_walletMap_accountAddress = this.walletMap[accountAddress]) == null ? undefined : _this_walletMap_accountAddress.clientKeyShares) || [],
557
+ keyShare
558
+ ],
559
+ thresholdSignatureScheme
560
+ };
494
561
  }
495
562
  async backupFileToGoogleDrive({ oauthAccountId, fileName = BACKUP_FILENAME, jsonData, password }) {
496
563
  const encryptedKeyShare = await this.encryptKeyShare({
@@ -524,7 +591,8 @@ class DynamicWalletClient {
524
591
  });
525
592
  return decryptedKeyShare;
526
593
  }
527
- async importRawPrivateKey({ chainName, privateKey }) {
594
+ async importRawPrivateKey({ chainName, privateKey, thresholdSignatureScheme }) {
595
+ const chainConfig = getMPCChainConfig(chainName);
528
596
  const mpcSigner = getMPCSigner({
529
597
  chainName,
530
598
  baseRelayUrl: RELAY_API_URL
@@ -540,19 +608,22 @@ class DynamicWalletClient {
540
608
  // --- 1. init keygen for the server as a party
541
609
  // --- 2. open a room and return the roomId for the ceremony
542
610
  // --- 3. join the room as a party for the 2/3 ceremony
543
- const { roomId, serverKeygenId } = await this.apiClient.importPrivateKey({
611
+ const { roomId, serverKeygenIds } = await this.apiClient.importPrivateKey({
544
612
  chainName,
545
- clientPrimaryKeygenId,
546
- clientSecondaryKeygenId
613
+ clientKeygenIds: [
614
+ clientPrimaryKeygenId,
615
+ clientSecondaryKeygenId
616
+ ],
617
+ thresholdSignatureScheme
547
618
  });
548
- const threshold = MPC_CONFIG[ThresholdSignatureScheme.TWO_OF_THREE].threshold;
619
+ const { threshold } = getTSSConfig(thresholdSignatureScheme);
549
620
  // prep
550
621
  const importerKeygenIds = [
551
- serverKeygenId,
622
+ ...serverKeygenIds,
552
623
  clientSecondaryKeygenId
553
624
  ];
554
625
  const recipientKeygenIds = [
555
- serverKeygenId,
626
+ ...serverKeygenIds,
556
627
  clientPrimaryKeygenId
557
628
  ];
558
629
  // 3. Join the keygen room for the ceremony
@@ -560,15 +631,61 @@ class DynamicWalletClient {
560
631
  mpcSigner.importPrivateKeyImporter(roomId, threshold, privateKey, clientPrimaryKeygenInitResult, importerKeygenIds),
561
632
  mpcSigner.importPrivateKeyRecipient(roomId, threshold, clientSecondaryKeygenInitResult, recipientKeygenIds)
562
633
  ]);
563
- this.clientKeyshare = clientPrimaryKeygenResult;
564
- return [
565
- clientPrimaryKeygenResult,
566
- clientSecondaryKeygenResult
567
- ];
634
+ const derivationPath = new Uint32Array(chainConfig.derivationPath);
635
+ // Get the public key for the derivation path
636
+ let rawPublicKey;
637
+ if (mpcSigner instanceof Ecdsa) {
638
+ rawPublicKey = await mpcSigner.derivePubkey(clientPrimaryKeygenResult, derivationPath);
639
+ } else if (mpcSigner instanceof Ed25519) {
640
+ rawPublicKey = await mpcSigner.derivePubkey(clientPrimaryKeygenResult, derivationPath);
641
+ } else if (mpcSigner instanceof BIP340) {
642
+ rawPublicKey = await mpcSigner.deriveTweakPubkey(clientPrimaryKeygenResult, derivationPath);
643
+ }
644
+ return {
645
+ rawPublicKey,
646
+ primaryKeygenResult: clientPrimaryKeygenResult,
647
+ secondaryKeygenResult: clientSecondaryKeygenResult
648
+ };
649
+ }
650
+ async getWallet({ accountAddress }) {
651
+ if (accountAddress) {
652
+ if (this.walletMap[accountAddress]) {
653
+ return this.walletMap[accountAddress];
654
+ } else {
655
+ var _user_verifiedCredentials;
656
+ const user = await this.apiClient.getUser();
657
+ const wallet = (_user_verifiedCredentials = user.verifiedCredentials) == null ? undefined : _user_verifiedCredentials.find((vc)=>vc.address === accountAddress);
658
+ console.log('need to restore wallet', wallet);
659
+ const walletId = wallet.id;
660
+ const clientShares = wallet.walletProperties.keyShares.filter((ks)=>ks.backupLocation === 'dynamic');
661
+ console.log('clientShares', clientShares);
662
+ // restore backup
663
+ const decryptedKeyShares = await this.recoverEncryptedBackupByWallet({
664
+ walletId,
665
+ accountAddress,
666
+ password: this.environmentId
667
+ });
668
+ console.log('recovery decryptedKeyShares', decryptedKeyShares);
669
+ }
670
+ }
671
+ const walletCount = Object.keys(this.walletMap).length;
672
+ // if there are no wallets, throw an error
673
+ if (walletCount === 0) {
674
+ throw new Error('No wallets found');
675
+ }
676
+ // if there is only one wallet, return it by default
677
+ if (walletCount === 1) {
678
+ return Object.values(this.walletMap)[0];
679
+ }
680
+ if (!accountAddress) {
681
+ throw new Error('Must provide an account address');
682
+ }
683
+ return this.walletMap[accountAddress];
568
684
  }
569
- constructor({ environmentId, authToken, baseApiUrl, clientKeyshare }){
685
+ constructor({ environmentId, authToken, baseApiUrl }){
686
+ this.walletMap = {} // todo: store in session storage
687
+ ;
570
688
  this.environmentId = environmentId;
571
- this.clientKeyshare = clientKeyshare;
572
689
  this.apiClient = new DynamicApiClient({
573
690
  environmentId,
574
691
  authToken,
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@dynamic-labs-wallet/browser",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "dependencies": {
5
- "@dynamic-labs-wallet/core": "0.0.2",
6
- "@dynamic-labs-wallet/lib-mpc-web": "0.0.2"
5
+ "@dynamic-labs-wallet/core": "0.0.4",
6
+ "@dynamic-labs-wallet/lib-mpc-web": "0.0.4"
7
7
  },
8
8
  "publishConfig": {
9
9
  "access": "restricted"
@@ -1 +1 @@
1
- {"version":3,"file":"encryption.d.ts","sourceRoot":"","sources":["../../../src/backup/encryption.ts"],"names":[],"mappings":"AAiCA,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
+ {"version":3,"file":"encryption.d.ts","sourceRoot":"","sources":["../../src/backup/encryption.ts"],"names":[],"mappings":"AAiCA,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,uBAAuB,yCAIjC;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB,iBAkCA,CAAC;AAEF,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,MAAM,GAAG,IAAI,CAsBxB,CAAC"}
1
+ {"version":3,"file":"googleDrive.d.ts","sourceRoot":"","sources":["../../../src/backup/providers/googleDrive.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,uBAAuB,yCAIjC;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB,iBAkCA,CAAC;AAEF,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,MAAM,GAAG,IAAI,CAsBxB,CAAC"}
package/src/client.d.ts CHANGED
@@ -1,108 +1,125 @@
1
+ import { ThresholdSignatureScheme, DynamicApiClient } from '@dynamic-labs-wallet/core';
1
2
  import { EcdsaPublicKey, EcdsaKeygenResult, Ed25519KeygenResult, BIP340KeygenResult, EcdsaSignature } from '@dynamic-labs-wallet/lib-mpc-web';
2
- import { ClientInitKeygenResult, ClientKeyshare } from './mpc/types';
3
+ import { ClientInitKeygenResult, ClientKeyShare } from './mpc/types';
4
+ interface WalletProperties {
5
+ chainName: string;
6
+ walletId: string;
7
+ accountAddress: string;
8
+ clientKeyShares: ClientKeyShare[];
9
+ thresholdSignatureScheme: ThresholdSignatureScheme;
10
+ }
3
11
  export declare class DynamicWalletClient {
4
12
  environmentId: string;
5
- private apiClient;
6
- private clientKeyshare?;
7
- constructor({ environmentId, authToken, baseApiUrl, clientKeyshare, }: {
13
+ protected apiClient: DynamicApiClient;
14
+ protected walletMap: Record<string, WalletProperties>;
15
+ constructor({ environmentId, authToken, baseApiUrl, }: {
8
16
  environmentId: string;
9
17
  authToken: string;
10
18
  baseApiUrl?: string;
11
- clientKeyshare?: ClientKeyshare;
12
19
  });
13
- serverInitializeKeyGen({ chainName, clientPrimaryKeygenId, clientSecondaryKeygenId, }: {
20
+ serverInitializeKeyGen({ chainName, clientPrimaryKeygenId, clientSecondaryKeygenId, thresholdSignatureScheme, }: {
14
21
  chainName: string;
15
22
  clientPrimaryKeygenId: string;
16
23
  clientSecondaryKeygenId: string;
24
+ thresholdSignatureScheme: ThresholdSignatureScheme;
17
25
  }): Promise<any>;
18
26
  clientInitializeKeyGen({ chainName }: {
19
27
  chainName: string;
20
28
  }): Promise<{
21
- clientPrimaryKeygenInitResult: import("@dynamic-labs-wallet/lib-mpc-web").BIP340InitKeygenResult;
22
- clientSecondaryKeygenInitResult: import("@dynamic-labs-wallet/lib-mpc-web").BIP340InitKeygenResult;
29
+ clientPrimaryKeygenInitResult: import("@dynamic-labs-wallet/lib-mpc-internal").BIP340InitKeygenResult;
30
+ clientSecondaryKeygenInitResult: import("@dynamic-labs-wallet/lib-mpc-internal").BIP340InitKeygenResult;
23
31
  }>;
24
32
  derivePublicKey({ chainName, keyShare, }: {
25
33
  chainName: string;
26
- keyShare?: ClientKeyshare;
27
- }): Promise<Uint8Array | EcdsaPublicKey | undefined>;
28
- clientKeyGen({ chainName, roomId, serverKeygenId, clientPrimaryKeygenInitResult, clientSecondaryKeygenInitResult, }: {
34
+ keyShare: ClientKeyShare;
35
+ }): Promise<EcdsaPublicKey | Uint8Array | undefined>;
36
+ clientKeyGen({ chainName, roomId, serverKeygenIds, clientPrimaryKeygenInitResult, clientSecondaryKeygenInitResult, thresholdSignatureScheme, }: {
29
37
  chainName: string;
30
38
  roomId: string;
31
- serverKeygenId: string;
39
+ serverKeygenIds: string[];
32
40
  clientPrimaryKeygenInitResult: ClientInitKeygenResult;
33
41
  clientSecondaryKeygenInitResult: ClientInitKeygenResult;
42
+ thresholdSignatureScheme: ThresholdSignatureScheme;
34
43
  }): Promise<{
35
- rawPublicKey: Uint8Array | EcdsaPublicKey | undefined;
44
+ rawPublicKey: EcdsaPublicKey | Uint8Array | undefined;
36
45
  primaryKeygenResult: EcdsaKeygenResult | BIP340KeygenResult;
37
46
  secondaryKeygenResult: EcdsaKeygenResult | BIP340KeygenResult;
38
47
  }>;
39
- keyGen({ chainName }: {
48
+ keyGen({ chainName, thresholdSignatureScheme, }: {
40
49
  chainName: string;
50
+ thresholdSignatureScheme: ThresholdSignatureScheme;
41
51
  }): Promise<{
42
- rawPublicKey: Uint8Array | EcdsaPublicKey | undefined;
52
+ rawPublicKey: EcdsaPublicKey | Uint8Array | undefined;
43
53
  primaryKeygenResult: EcdsaKeygenResult | BIP340KeygenResult;
44
54
  secondaryKeygenResult: EcdsaKeygenResult | BIP340KeygenResult;
45
55
  }>;
46
- serverSign({ messageToSign }: {
47
- messageToSign: string;
56
+ serverSign({ walletId, message, }: {
57
+ walletId: string;
58
+ message: string;
48
59
  }): Promise<any>;
49
- clientSign({ chainName, messageToSign, roomId, }: {
60
+ clientSign({ chainName, message, roomId, keyShare, }: {
50
61
  chainName: string;
51
- messageToSign: string;
62
+ message: string;
52
63
  roomId: string;
64
+ keyShare: ClientKeyShare;
53
65
  }): Promise<Uint8Array | EcdsaSignature>;
54
- sign({ chainName, messageToSign, }: {
55
- chainName: string;
56
- messageToSign: string;
66
+ sign({ accountAddress, message, }: {
67
+ accountAddress?: string;
68
+ message: string;
57
69
  }): Promise<Uint8Array | EcdsaSignature>;
58
- refreshWalletAccountShares({ chainName, clientPrimaryKeyshare, clientSecondaryKeyshare, }: {
59
- chainName: string;
60
- clientPrimaryKeyshare: EcdsaKeygenResult | Ed25519KeygenResult | BIP340KeygenResult;
61
- clientSecondaryKeyshare: EcdsaKeygenResult | Ed25519KeygenResult | BIP340KeygenResult;
70
+ refreshWalletAccountShares({ accountAddress, }: {
71
+ accountAddress: string;
62
72
  }): Promise<[EcdsaKeygenResult | BIP340KeygenResult, EcdsaKeygenResult | BIP340KeygenResult]>;
63
- serverReshareRemainingParty({ clientPrimaryKeygenId, clientSecondaryKeygenId, }: {
64
- clientPrimaryKeygenId: string;
65
- clientSecondaryKeygenId: string;
73
+ serverReshareRemainingParty({ walletId, clientKeygenIds, }: {
74
+ walletId: string;
75
+ clientKeygenIds: string[];
66
76
  }): Promise<any>;
67
- getKeygenId({ chainName, clientKeyshare, }: {
77
+ getExportId({ chainName, clientKeyShare, }: {
68
78
  chainName: string;
69
- clientKeyshare: EcdsaKeygenResult | Ed25519KeygenResult | BIP340KeygenResult;
79
+ clientKeyShare: EcdsaKeygenResult | Ed25519KeygenResult | BIP340KeygenResult;
70
80
  }): Promise<string>;
71
- reshareRemainingParty({ chainName, clientKeyshare, }: {
72
- chainName: string;
73
- clientKeyshare: EcdsaKeygenResult | Ed25519KeygenResult | BIP340KeygenResult;
81
+ reshareRemainingParty({ accountAddress, thresholdSignatureScheme, }: {
82
+ accountAddress: string;
83
+ thresholdSignatureScheme: ThresholdSignatureScheme;
74
84
  }): Promise<[EcdsaKeygenResult | BIP340KeygenResult, EcdsaKeygenResult | BIP340KeygenResult]>;
75
- exportPrivateKey({ chainName, clientKeyshare, }: {
76
- chainName: string;
77
- clientKeyshare: EcdsaKeygenResult | Ed25519KeygenResult | BIP340KeygenResult;
85
+ exportPrivateKey({ accountAddress }: {
86
+ accountAddress: string;
78
87
  }): Promise<{
79
88
  derivedPrivateKey: string | undefined;
80
89
  }>;
81
- offlineExportPrivateKey({ chainName, keyShares, }: {
90
+ offlineExportPrivateKey({ chainName, keyShares, accountAddress, }: {
82
91
  chainName: string;
83
- keyShares: (EcdsaKeygenResult | Ed25519KeygenResult | BIP340KeygenResult)[];
92
+ keyShares?: ClientKeyShare[];
93
+ accountAddress?: string;
84
94
  }): Promise<{
85
95
  derivedPrivateKey: string | undefined;
86
96
  }>;
87
97
  encryptKeyShare({ keyShare, password, }: {
88
- keyShare: ClientKeyshare;
98
+ keyShare: ClientKeyShare;
89
99
  password?: string;
90
100
  }): Promise<string>;
91
- storeEncryptedBackup({ keyShare, password, }: {
92
- keyShare: ClientKeyshare;
101
+ storeEncryptedBackupByWallet({ walletId, keyShares, password, }: {
102
+ walletId: string;
103
+ keyShares: ClientKeyShare[];
93
104
  password?: string;
94
105
  }): Promise<any>;
95
106
  decryptKeyShare({ keyShare, password, }: {
96
107
  keyShare: string;
97
108
  password?: string;
98
109
  }): Promise<any>;
99
- recoverEncryptedBackup({ password }?: {
110
+ recoverEncryptedBackupByWallet({ accountAddress, walletId, password, keyShareIds, }: {
111
+ accountAddress: string;
112
+ walletId: string;
100
113
  password?: string;
101
- }): Promise<any>;
102
- restoreBackupShare({ keyShare }: {
103
- keyShare: ClientKeyshare;
114
+ keyShareIds?: string[];
115
+ }): Promise<any[]>;
116
+ restoreBackupShare({ walletId, accountAddress, chainName, keyShare, thresholdSignatureScheme, }: {
117
+ walletId: string;
118
+ accountAddress: string;
119
+ chainName: string;
120
+ keyShare: ClientKeyShare;
121
+ thresholdSignatureScheme: ThresholdSignatureScheme;
104
122
  }): void;
105
- getClientShare(): Promise<ClientKeyshare | undefined>;
106
123
  backupFileToGoogleDrive({ oauthAccountId, fileName, jsonData, password, }: {
107
124
  oauthAccountId: string;
108
125
  fileName?: string;
@@ -113,10 +130,19 @@ export declare class DynamicWalletClient {
113
130
  oauthAccountId: string;
114
131
  name?: string;
115
132
  password?: string;
116
- }): Promise<ClientKeyshare | null>;
117
- importRawPrivateKey({ chainName, privateKey }: {
133
+ }): Promise<ClientKeyShare | null>;
134
+ importRawPrivateKey({ chainName, privateKey, thresholdSignatureScheme, }: {
118
135
  chainName: string;
119
136
  privateKey: string;
120
- }): Promise<ClientKeyshare[]>;
137
+ thresholdSignatureScheme: ThresholdSignatureScheme;
138
+ }): Promise<{
139
+ rawPublicKey: EcdsaPublicKey | Uint8Array | undefined;
140
+ primaryKeygenResult: ClientKeyShare;
141
+ secondaryKeygenResult: ClientKeyShare;
142
+ }>;
143
+ getWallet({ accountAddress }: {
144
+ accountAddress?: string;
145
+ }): Promise<WalletProperties>;
121
146
  }
147
+ export {};
122
148
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAUA,OAAO,EAIL,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAElB,cAAc,EACf,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAOrE,qBAAa,mBAAmB;IACvB,aAAa,EAAE,MAAM,CAAC;IAE7B,OAAO,CAAC,SAAS,CAAmB;IACpC,OAAO,CAAC,cAAc,CAAC,CAAiB;gBAE5B,EACV,aAAa,EACb,SAAS,EACT,UAAU,EACV,cAAc,GACf,EAAE;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AAc,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,iBAAiB,CAAC;QAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB;IAgBK,4BAA4B,CAAC,EACjC,cAAc,EACd,IAAsB,EACtB,QAAQ,GACT,EAAE;QACD,cAAc,EAAE,MAAM,CAAC;QACvB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IAmB5B,mBAAmB,CAAC,EACxB,SAAS,EACT,UAAU,EACV,wBAAwB,GACzB,EAAE;QACD,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,EAAE,MAAM,CAAC;QACnB,wBAAwB,EAAE,wBAAwB,CAAC;KACpD,GAAG,OAAO,CAAC;QACV,YAAY,EAAE,cAAc,GAAG,UAAU,GAAG,SAAS,CAAC;QACtD,mBAAmB,EAAE,cAAc,CAAC;QACpC,qBAAqB,EAAE,cAAc,CAAC;KACvC,CAAC;IA4EI,SAAS,CAAC,EAAE,cAAc,EAAE,EAAE;QAAE,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE;CAyChE"}
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,mCAAmC,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../packages/src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,mCAAmC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAE1C,cAAc,aAAa,CAAC;AAE5B,cAAc,UAAU,CAAC;AAEzB,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAE1C,cAAc,aAAa,CAAC;AAE5B,cAAc,UAAU,CAAC;AAEzB,cAAc,aAAa,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/mpc/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,OAAO,EACP,MAAM,EACN,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EACjB,WAAW,EACX,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,EACtB,cAAc,EACf,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EACL,KAAK,EACL,OAAO,EACP,MAAM,EACN,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,WAAW,EACX,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,EACtB,cAAc,GACf,CAAC;AAEF,cAAc,OAAO,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mpc/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,OAAO,EACP,MAAM,EACN,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EACjB,WAAW,EACX,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,EACtB,cAAc,EACf,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EACL,KAAK,EACL,OAAO,EACP,MAAM,EACN,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,WAAW,EACX,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,EACtB,cAAc,GACf,CAAC;AAEF,cAAc,OAAO,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"mpc.d.ts","sourceRoot":"","sources":["../../../src/mpc/mpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,gBAAgB,EAEjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAE1E,eAAO,MAAM,qBAAqB,wCAG/B;IACD,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,6BAWA,CAAC;AAEF,eAAO,MAAM,YAAY,iCAGtB;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,6BAOA,CAAC"}
1
+ {"version":3,"file":"mpc.d.ts","sourceRoot":"","sources":["../../src/mpc/mpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,gBAAgB,EAEjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAE1E,eAAO,MAAM,qBAAqB,wCAG/B;IACD,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,6BAWA,CAAC;AAEF,eAAO,MAAM,YAAY,iCAGtB;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,6BAOA,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import type { BIP340InitKeygenResult, BIP340KeygenResult, Ed25519InitKeygenResult, EcdsaInitKeygenResult, EcdsaKeygenResult, Ed25519KeygenResult } from '@dynamic-labs-wallet/lib-mpc-web';
2
2
  export type ClientInitKeygenResult = EcdsaInitKeygenResult | Ed25519InitKeygenResult | BIP340InitKeygenResult;
3
- export type ClientKeyshare = EcdsaKeygenResult | Ed25519KeygenResult | BIP340KeygenResult;
3
+ export type ClientKeyShare = EcdsaKeygenResult | Ed25519KeygenResult | BIP340KeygenResult;
4
4
  export type { Ecdsa, Ed25519, BIP340, EcdsaPublicKey, EcdsaKeygenResult, Ed25519KeygenResult, BIP340KeygenResult, MessageHash, EcdsaSignature, } from '@dynamic-labs-wallet/lib-mpc-web';
5
5
  //# sourceMappingURL=types.d.ts.map
@@ -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,kCAAkC,CAAC;AAE1C,MAAM,MAAM,sBAAsB,GAC9B,qBAAqB,GACrB,uBAAuB,GACvB,sBAAsB,CAAC;AAE3B,MAAM,MAAM,cAAc,GACtB,iBAAiB,GACjB,mBAAmB,GACnB,kBAAkB,CAAC;AAGrB,YAAY,EACV,KAAK,EACL,OAAO,EACP,MAAM,EACN,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,WAAW,EACX,cAAc,GACf,MAAM,kCAAkC,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,kCAAkC,CAAC;AAE1C,MAAM,MAAM,sBAAsB,GAC9B,qBAAqB,GACrB,uBAAuB,GACvB,sBAAsB,CAAC;AAE3B,MAAM,MAAM,cAAc,GACtB,iBAAiB,GACjB,mBAAmB,GACnB,kBAAkB,CAAC;AAGrB,YAAY,EACV,KAAK,EACL,OAAO,EACP,MAAM,EACN,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,WAAW,EACX,cAAc,GACf,MAAM,kCAAkC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,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"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../packages/src/utils.ts"],"names":[],"mappings":"AAAA,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"}