@dynamic-labs-wallet/browser-wallet-client 0.0.0-pr384.2 → 0.0.0-pr526.0

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 CHANGED
@@ -71,8 +71,12 @@ class iframeMessageHandler {
71
71
  const response = await this.requestChannel.request('delegateKeyShares', request);
72
72
  this.handleIframeMessageResponseError(response);
73
73
  }
74
- async restoreBackupFromGoogleDrive(request) {
75
- const response = await this.requestChannel.request('restoreBackupFromGoogleDrive', request);
74
+ async revokeDelegation(request) {
75
+ const response = await this.requestChannel.request('revokeDelegation', request);
76
+ this.handleIframeMessageResponseError(response);
77
+ }
78
+ async exportClientKeysharesFromGoogleDrive(request) {
79
+ const response = await this.requestChannel.request('exportClientKeysharesFromGoogleDrive', request);
76
80
  this.handleIframeMessageResponseError(response);
77
81
  }
78
82
  async refreshWalletAccountShares(request) {
@@ -100,8 +104,8 @@ class iframeMessageHandler {
100
104
  this.handleIframeMessageResponseError(response);
101
105
  return response;
102
106
  }
103
- async sendAuthToken(token, authMode) {
104
- return this.requestChannel.request('sendAuthToken', token, authMode);
107
+ async sendAuthToken(token, authMode, traceContext) {
108
+ return this.requestChannel.request('sendAuthToken', token, authMode, traceContext);
105
109
  }
106
110
  async exportClientKeyshares(request) {
107
111
  const response = await this.requestChannel.request('exportClientKeyshares', request);
@@ -260,7 +264,7 @@ class IframeManager {
260
264
  return new Promise((resolve, reject)=>{
261
265
  const attemptLoad = ()=>{
262
266
  IframeManager.iframeLoadAttempts++;
263
- this.logger.info(`Loading iframe for waas wallet client... (attempt ${IframeManager.iframeLoadAttempts}/${IframeManager.maxRetryAttempts + 1})`, this.getIframeContext());
267
+ this.logger.debug(`Loading iframe for waas wallet client... (attempt ${IframeManager.iframeLoadAttempts}/${IframeManager.maxRetryAttempts + 1})`, this.getIframeContext());
264
268
  const iframe = document.createElement('iframe');
265
269
  let messageListener = null;
266
270
  const context = _extends({}, this.getIframeContext(), {
@@ -335,7 +339,7 @@ class IframeManager {
335
339
  IframeManager.iframeInstanceCount++;
336
340
  IframeManager.iframeLoadAttempts = 0; // Reset retry counter on success
337
341
  resolve();
338
- this.logger.info('Iframe loaded successfully...', this.getIframeContext());
342
+ this.logger.debug('Iframe loaded successfully...', this.getIframeContext());
339
343
  }
340
344
  };
341
345
  return messageListener;
@@ -354,14 +358,16 @@ class IframeManager {
354
358
  iframe.style.pointerEvents = 'none';
355
359
  }
356
360
  setIframeSource(iframe) {
357
- var _this_instanceId, _this_sdkVersion;
361
+ var _this_instanceId, _this_sdkVersion, _this_baseClientKeysharesRelayApiUrl;
358
362
  const params = new URLSearchParams({
359
363
  instanceId: (_this_instanceId = this.instanceId) != null ? _this_instanceId : '',
360
364
  hostOrigin: window.location.origin,
361
365
  environmentId: this.environmentId,
362
366
  baseApiUrl: this.baseApiUrl,
363
367
  baseMPCRelayApiUrl: this.baseMPCRelayApiUrl,
364
- sdkVersion: (_this_sdkVersion = this.sdkVersion) != null ? _this_sdkVersion : ''
368
+ sdkVersion: (_this_sdkVersion = this.sdkVersion) != null ? _this_sdkVersion : '',
369
+ debug: String(this.debug),
370
+ baseClientKeysharesRelayApiUrl: (_this_baseClientKeysharesRelayApiUrl = this.baseClientKeysharesRelayApiUrl) != null ? _this_baseClientKeysharesRelayApiUrl : ''
365
371
  });
366
372
  iframe.src = `${this.iframeDomain}/waas-v1/${this.environmentId}?${params.toString()}`;
367
373
  }
@@ -380,7 +386,7 @@ class IframeManager {
380
386
  chainName: this.chainName,
381
387
  iframeLoadTimeout: IframeManager.iframeLoadTimeout
382
388
  };
383
- this.logger.info(`Loading iframe for container...`, context);
389
+ this.logger.debug(`Loading iframe for container...`, context);
384
390
  const iframe = document.createElement('iframe');
385
391
  let messageListener = null;
386
392
  const iframeTimeoutId = setTimeout(()=>{
@@ -396,14 +402,16 @@ class IframeManager {
396
402
  iframe.setAttribute('title', 'Dynamic Wallet Storage');
397
403
  iframe.setAttribute('sandbox', 'allow-scripts allow-same-origin');
398
404
  iframe.setAttribute('referrerpolicy', 'origin');
399
- var _this_instanceId, _this_sdkVersion1;
405
+ var _this_instanceId, _this_sdkVersion1, _this_baseClientKeysharesRelayApiUrl;
400
406
  const params = new URLSearchParams({
401
407
  instanceId: (_this_instanceId = this.instanceId) != null ? _this_instanceId : '',
402
408
  hostOrigin: window.location.origin,
403
409
  environmentId: this.environmentId,
404
410
  baseApiUrl: this.baseApiUrl,
405
411
  baseMPCRelayApiUrl: this.baseMPCRelayApiUrl,
406
- sdkVersion: (_this_sdkVersion1 = this.sdkVersion) != null ? _this_sdkVersion1 : ''
412
+ sdkVersion: (_this_sdkVersion1 = this.sdkVersion) != null ? _this_sdkVersion1 : '',
413
+ debug: String(this.debug),
414
+ baseClientKeysharesRelayApiUrl: (_this_baseClientKeysharesRelayApiUrl = this.baseClientKeysharesRelayApiUrl) != null ? _this_baseClientKeysharesRelayApiUrl : ''
407
415
  });
408
416
  iframe.src = `${this.iframeDomain}/waas-v1/${this.environmentId}?${params.toString()}`;
409
417
  this.logger.debug('Creating iframe with src:', iframe.src);
@@ -433,7 +441,7 @@ class IframeManager {
433
441
  IframeManager.iframeInstanceCount++;
434
442
  resolve(iframe);
435
443
  var _this_sdkVersion;
436
- this.logger.info('Iframe loaded successfully...', {
444
+ this.logger.debug('Iframe loaded successfully...', {
437
445
  iframeDomain: this.iframeDomain,
438
446
  environmentId: this.environmentId,
439
447
  sdkVersion: (_this_sdkVersion = this.sdkVersion) != null ? _this_sdkVersion : '',
@@ -494,7 +502,7 @@ class IframeManager {
494
502
  this.iframe = null;
495
503
  }
496
504
  }
497
- constructor({ environmentId, baseApiUrl, baseMPCRelayApiUrl, chainName, sdkVersion, authMode = core.AuthMode.HEADER, authToken, debug }){
505
+ constructor({ environmentId, baseApiUrl, baseMPCRelayApiUrl, chainName, sdkVersion, authMode = core.AuthMode.HEADER, authToken, debug, baseClientKeysharesRelayApiUrl }){
498
506
  this.logger = logger;
499
507
  this.instanceId = null;
500
508
  this.iframeDomain = null;
@@ -508,6 +516,7 @@ class IframeManager {
508
516
  this.baseMPCRelayApiUrl = baseMPCRelayApiUrl;
509
517
  this.chainName = chainName;
510
518
  this.sdkVersion = sdkVersion;
519
+ this.baseClientKeysharesRelayApiUrl = baseClientKeysharesRelayApiUrl;
511
520
  const environment = core.getEnvironmentFromUrl(baseApiUrl);
512
521
  this.iframeDomain = core.IFRAME_DOMAIN_MAP[environment];
513
522
  if (this.authMode === core.AuthMode.COOKIE) {
@@ -527,96 +536,78 @@ IframeManager.sharedIframe = null;
527
536
  IframeManager.iframeInstanceCount = 0;
528
537
 
529
538
  class DynamicWalletClient extends IframeManager {
530
- async getWallets() {
539
+ async withHandler(operation) {
531
540
  await this.initializeMessageTransport();
532
541
  if (!this.iframeMessageHandler) {
533
542
  throw new Error('Iframe message handler not initialized');
534
543
  }
535
- return this.iframeMessageHandler.getWallets({
536
- chainName: this.chainName
537
- });
544
+ return operation(this.iframeMessageHandler);
538
545
  }
539
- async getWallet({ accountAddress, walletOperation = core.WalletOperation.NO_OPERATION, signedSessionId, authToken }) {
540
- await this.initializeMessageTransport();
541
- if (!this.iframeMessageHandler) {
542
- throw new Error('Iframe message handler not initialized');
543
- }
544
- return this.iframeMessageHandler.getWallet({
545
- chainName: this.chainName,
546
- accountAddress,
547
- walletOperation,
548
- signedSessionId,
549
- authToken
550
- });
546
+ async getWallets() {
547
+ return this.withHandler((handler)=>handler.getWallets({
548
+ chainName: this.chainName
549
+ }));
551
550
  }
552
- async createWalletAccount({ thresholdSignatureScheme, password = undefined, signedSessionId, authToken }) {
553
- await this.initializeMessageTransport();
554
- if (!this.iframeMessageHandler) {
555
- throw new Error('Iframe message handler not initialized');
556
- }
557
- return this.iframeMessageHandler.createWalletAccount({
558
- chainName: this.chainName,
559
- thresholdSignatureScheme,
560
- password,
561
- signedSessionId,
562
- authToken
563
- });
551
+ async getWallet({ accountAddress, walletOperation = core.WalletOperation.NO_OPERATION, signedSessionId, authToken }) {
552
+ return this.withHandler((handler)=>handler.getWallet({
553
+ chainName: this.chainName,
554
+ accountAddress,
555
+ walletOperation,
556
+ signedSessionId,
557
+ authToken
558
+ }));
559
+ }
560
+ async createWalletAccount({ thresholdSignatureScheme, password = undefined, signedSessionId, authToken, traceContext }) {
561
+ return this.withHandler((handler)=>handler.createWalletAccount({
562
+ chainName: this.chainName,
563
+ thresholdSignatureScheme,
564
+ password,
565
+ signedSessionId,
566
+ authToken,
567
+ traceContext
568
+ }));
564
569
  }
565
570
  async requiresPasswordForOperation({ accountAddress, walletOperation = core.WalletOperation.REACH_THRESHOLD, authToken }) {
566
- await this.initializeMessageTransport();
567
- if (!this.iframeMessageHandler) {
568
- throw new Error('Iframe message handler not initialized');
569
- }
570
- return this.iframeMessageHandler.requiresPasswordForOperation({
571
- chainName: this.chainName,
572
- accountAddress,
573
- walletOperation,
574
- authToken
575
- });
571
+ return this.withHandler((handler)=>handler.requiresPasswordForOperation({
572
+ chainName: this.chainName,
573
+ accountAddress,
574
+ walletOperation,
575
+ authToken
576
+ }));
576
577
  }
577
578
  async isPasswordEncrypted({ accountAddress, authToken }) {
578
- await this.initializeMessageTransport();
579
- if (!this.iframeMessageHandler) {
580
- throw new Error('Iframe message handler not initialized');
581
- }
582
- return this.iframeMessageHandler.isPasswordEncrypted({
583
- chainName: this.chainName,
584
- accountAddress,
585
- authToken
586
- });
579
+ return this.withHandler((handler)=>handler.isPasswordEncrypted({
580
+ chainName: this.chainName,
581
+ accountAddress,
582
+ authToken
583
+ }));
587
584
  }
588
- async signMessage({ message, accountAddress, password = undefined, signedSessionId, authToken, mfaToken, context }) {
589
- await this.initializeMessageTransport();
590
- if (!this.iframeMessageHandler) {
591
- throw new Error('Iframe message handler not initialized');
592
- }
585
+ async signMessage({ message, accountAddress, password = undefined, signedSessionId, authToken, mfaToken, context, traceContext }) {
593
586
  const contextString = JSON.stringify(context, (_key, value)=>typeof value === 'bigint' ? value.toString() : value);
594
- return this.iframeMessageHandler.signMessage({
595
- chainName: this.chainName,
596
- message,
597
- accountAddress,
598
- password,
599
- signedSessionId,
600
- authToken,
601
- mfaToken,
602
- context: contextString
603
- });
604
- }
605
- async signRawMessage({ message, accountAddress, password = undefined, signedSessionId, authToken, mfaToken, context }) {
606
- await this.initializeMessageTransport();
607
- if (!this.iframeMessageHandler) {
608
- throw new Error('Iframe message handler not initialized');
609
- }
610
- return this.iframeMessageHandler.signRawMessage({
611
- chainName: this.chainName,
612
- message,
613
- accountAddress,
614
- password,
615
- signedSessionId,
616
- authToken,
617
- mfaToken,
618
- context
619
- });
587
+ return this.withHandler((handler)=>handler.signMessage({
588
+ chainName: this.chainName,
589
+ message,
590
+ accountAddress,
591
+ password,
592
+ signedSessionId,
593
+ authToken,
594
+ mfaToken,
595
+ context: contextString,
596
+ traceContext
597
+ }));
598
+ }
599
+ async signRawMessage({ message, accountAddress, password = undefined, signedSessionId, authToken, mfaToken, context, traceContext }) {
600
+ return this.withHandler((handler)=>handler.signRawMessage({
601
+ chainName: this.chainName,
602
+ message,
603
+ accountAddress,
604
+ password,
605
+ signedSessionId,
606
+ authToken,
607
+ mfaToken,
608
+ context,
609
+ traceContext
610
+ }));
620
611
  }
621
612
  /**
622
613
  * Signs a transaction and returns the signature, @transaction is a string of the serialized transaction
@@ -628,110 +619,98 @@ class DynamicWalletClient extends IframeManager {
628
619
  * SUI:
629
620
  * const txBytes = await txb.build({ client });
630
621
  * const txString = Buffer.from(txBytes).toString("hex");
631
- */ async signTransaction({ senderAddress, transaction, password = undefined, signedSessionId, authToken, mfaToken, chainId }) {
632
- await this.initializeMessageTransport();
633
- if (!this.iframeMessageHandler) {
634
- throw new Error('Iframe message handler not initialized');
635
- }
636
- return this.iframeMessageHandler.signTransaction({
637
- chainName: this.chainName,
638
- senderAddress,
639
- transaction,
640
- password,
641
- signedSessionId,
642
- authToken,
643
- mfaToken,
644
- chainId
645
- });
646
- }
647
- async signTypedData({ accountAddress, typedData, password = undefined, signedSessionId, authToken, mfaToken }) {
648
- await this.initializeMessageTransport();
649
- if (!this.iframeMessageHandler) {
650
- throw new Error('Iframe message handler not initialized');
651
- }
652
- return this.iframeMessageHandler.signTypedData({
653
- chainName: this.chainName,
654
- accountAddress,
655
- typedData: JSON.stringify(typedData),
656
- password,
657
- signedSessionId,
658
- authToken,
659
- mfaToken
660
- });
661
- }
662
- async backupKeySharesToGoogleDrive({ accountAddress, password = undefined, signedSessionId, authToken }) {
663
- await this.initializeMessageTransport();
664
- if (!this.iframeMessageHandler) {
665
- throw new Error('Iframe message handler not initialized');
666
- }
667
- return this.iframeMessageHandler.backupKeySharesToGoogleDrive({
668
- chainName: this.chainName,
669
- accountAddress,
670
- password,
671
- signedSessionId,
672
- authToken
673
- });
674
- }
675
- async delegateKeyShares({ accountAddress, password, signedSessionId, authToken, mfaToken }) {
676
- await this.initializeMessageTransport();
677
- if (!this.iframeMessageHandler) {
678
- throw new Error('Iframe message handler not initialized');
679
- }
680
- return this.iframeMessageHandler.delegateKeyShares({
681
- chainName: this.chainName,
682
- accountAddress,
683
- password,
684
- signedSessionId,
685
- authToken,
686
- mfaToken
687
- });
688
- }
689
- async restoreBackupFromGoogleDrive({ accountAddress, displayContainer, password, signedSessionId, authToken }) {
690
- const { iframeDisplay } = await this.initializeIframeDisplayForContainer({
691
- container: displayContainer
692
- });
693
- if (!iframeDisplay) {
694
- throw new Error('Failed to initialize iframe handler with display functionality');
695
- }
696
- return iframeDisplay.restoreBackupFromGoogleDrive({
697
- chainName: this.chainName,
698
- accountAddress,
699
- password,
700
- signedSessionId,
701
- authToken
702
- });
703
- }
704
- async refreshWalletAccountShares({ accountAddress, password, signedSessionId, authToken, mfaToken }) {
705
- await this.initializeMessageTransport();
706
- if (!this.iframeMessageHandler) {
707
- throw new Error('Iframe message handler not initialized');
708
- }
709
- return this.iframeMessageHandler.refreshWalletAccountShares({
710
- chainName: this.chainName,
711
- accountAddress: accountAddress,
712
- password: password,
713
- signedSessionId,
714
- authToken,
715
- mfaToken
716
- });
717
- }
718
- async reshare({ accountAddress, oldThresholdSignatureScheme, newThresholdSignatureScheme, password, signedSessionId, authToken, mfaToken }) {
719
- await this.initializeMessageTransport();
720
- if (!this.iframeMessageHandler) {
721
- throw new Error('Iframe message handler not initialized');
722
- }
723
- return this.iframeMessageHandler.reshare({
724
- chainName: this.chainName,
725
- accountAddress,
726
- oldThresholdSignatureScheme,
727
- newThresholdSignatureScheme,
728
- password,
729
- signedSessionId,
730
- authToken,
731
- mfaToken
732
- });
733
- }
734
- async exportPrivateKey({ accountAddress, displayContainer, password, signedSessionId, authToken, mfaToken }) {
622
+ */ async signTransaction({ senderAddress, transaction, password = undefined, signedSessionId, authToken, mfaToken, chainId, traceContext }) {
623
+ return this.withHandler((handler)=>handler.signTransaction({
624
+ chainName: this.chainName,
625
+ senderAddress,
626
+ transaction,
627
+ password,
628
+ signedSessionId,
629
+ authToken,
630
+ mfaToken,
631
+ chainId,
632
+ traceContext
633
+ }));
634
+ }
635
+ async signTypedData({ accountAddress, typedData, password = undefined, signedSessionId, authToken, mfaToken, traceContext }) {
636
+ return this.withHandler((handler)=>handler.signTypedData({
637
+ chainName: this.chainName,
638
+ accountAddress,
639
+ typedData: JSON.stringify(typedData),
640
+ password,
641
+ signedSessionId,
642
+ authToken,
643
+ mfaToken,
644
+ traceContext
645
+ }));
646
+ }
647
+ async backupKeySharesToGoogleDrive({ accountAddress, password = undefined, signedSessionId, authToken, traceContext }) {
648
+ return this.withHandler((handler)=>handler.backupKeySharesToGoogleDrive({
649
+ chainName: this.chainName,
650
+ accountAddress,
651
+ password,
652
+ signedSessionId,
653
+ authToken,
654
+ traceContext
655
+ }));
656
+ }
657
+ async delegateKeyShares({ accountAddress, password, signedSessionId, authToken, mfaToken, traceContext }) {
658
+ return this.withHandler((handler)=>handler.delegateKeyShares({
659
+ chainName: this.chainName,
660
+ accountAddress,
661
+ password,
662
+ signedSessionId,
663
+ authToken,
664
+ mfaToken,
665
+ traceContext
666
+ }));
667
+ }
668
+ async revokeDelegation({ accountAddress, password, signedSessionId, authToken, mfaToken, traceContext }) {
669
+ return this.withHandler((handler)=>handler.revokeDelegation({
670
+ chainName: this.chainName,
671
+ accountAddress,
672
+ password,
673
+ signedSessionId,
674
+ authToken,
675
+ mfaToken,
676
+ traceContext
677
+ }));
678
+ }
679
+ async exportClientKeysharesFromGoogleDrive({ accountAddress, password, signedSessionId, authToken, traceContext }) {
680
+ return this.withHandler((handler)=>handler.exportClientKeysharesFromGoogleDrive({
681
+ chainName: this.chainName,
682
+ accountAddress,
683
+ password,
684
+ signedSessionId,
685
+ authToken,
686
+ traceContext
687
+ }));
688
+ }
689
+ async refreshWalletAccountShares({ accountAddress, password, signedSessionId, authToken, mfaToken, traceContext }) {
690
+ return this.withHandler((handler)=>handler.refreshWalletAccountShares({
691
+ chainName: this.chainName,
692
+ accountAddress,
693
+ password,
694
+ signedSessionId,
695
+ authToken,
696
+ mfaToken,
697
+ traceContext
698
+ }));
699
+ }
700
+ async reshare({ accountAddress, oldThresholdSignatureScheme, newThresholdSignatureScheme, password, signedSessionId, authToken, mfaToken, traceContext }) {
701
+ return this.withHandler((handler)=>handler.reshare({
702
+ chainName: this.chainName,
703
+ accountAddress,
704
+ oldThresholdSignatureScheme,
705
+ newThresholdSignatureScheme,
706
+ password,
707
+ signedSessionId,
708
+ authToken,
709
+ mfaToken,
710
+ traceContext
711
+ }));
712
+ }
713
+ async exportPrivateKey({ accountAddress, displayContainer, password, signedSessionId, authToken, mfaToken, traceContext }) {
735
714
  const { iframeDisplay } = await this.initializeIframeDisplayForContainer({
736
715
  container: displayContainer
737
716
  });
@@ -744,70 +723,56 @@ class DynamicWalletClient extends IframeManager {
744
723
  password,
745
724
  signedSessionId,
746
725
  authToken,
747
- mfaToken
748
- });
749
- }
750
- async verifyPassword({ accountAddress, password, walletOperation = core.WalletOperation.NO_OPERATION, signedSessionId, authToken }) {
751
- await this.initializeMessageTransport();
752
- if (!this.iframeMessageHandler) {
753
- throw new Error('Iframe message handler not initialized');
754
- }
755
- return this.iframeMessageHandler.verifyPassword({
756
- chainName: this.chainName,
757
- accountAddress,
758
- password,
759
- walletOperation,
760
- signedSessionId,
761
- authToken
762
- });
763
- }
764
- async updatePassword({ accountAddress, existingPassword, newPassword, signedSessionId, authToken }) {
765
- await this.initializeMessageTransport();
766
- if (!this.iframeMessageHandler) {
767
- throw new Error('Iframe message handler not initialized');
768
- }
769
- return this.iframeMessageHandler.updatePassword({
770
- chainName: this.chainName,
771
- accountAddress,
772
- existingPassword,
773
- newPassword,
774
- signedSessionId,
775
- authToken
776
- });
777
- }
778
- async importPrivateKey({ privateKey, thresholdSignatureScheme, signedSessionId, authToken }) {
779
- await this.initializeMessageTransport();
780
- if (!this.iframeMessageHandler) {
781
- throw new Error('Iframe message handler not initialized');
782
- }
783
- return this.iframeMessageHandler.importPrivateKey({
784
- chainName: this.chainName,
785
- privateKey,
786
- thresholdSignatureScheme,
787
- signedSessionId,
788
- authToken
726
+ mfaToken,
727
+ traceContext
789
728
  });
790
729
  }
791
- async exportClientKeyshares({ accountAddress, password, signedSessionId, authToken }) {
792
- await this.initializeMessageTransport();
793
- if (!this.iframeMessageHandler) {
794
- throw new Error('Iframe message handler not initialized');
795
- }
796
- return this.iframeMessageHandler.exportClientKeyshares({
797
- chainName: this.chainName,
798
- accountAddress,
799
- password,
800
- signedSessionId,
801
- authToken
802
- });
730
+ async verifyPassword({ accountAddress, password, walletOperation = core.WalletOperation.NO_OPERATION, signedSessionId, authToken, traceContext }) {
731
+ return this.withHandler((handler)=>handler.verifyPassword({
732
+ chainName: this.chainName,
733
+ accountAddress,
734
+ password,
735
+ walletOperation,
736
+ signedSessionId,
737
+ authToken,
738
+ traceContext
739
+ }));
740
+ }
741
+ async updatePassword({ accountAddress, existingPassword, newPassword, signedSessionId, authToken, traceContext }) {
742
+ return this.withHandler((handler)=>handler.updatePassword({
743
+ chainName: this.chainName,
744
+ accountAddress,
745
+ existingPassword,
746
+ newPassword,
747
+ signedSessionId,
748
+ authToken,
749
+ traceContext
750
+ }));
751
+ }
752
+ async importPrivateKey({ privateKey, thresholdSignatureScheme, signedSessionId, authToken, publicAddressCheck, traceContext }) {
753
+ return this.withHandler((handler)=>handler.importPrivateKey({
754
+ chainName: this.chainName,
755
+ privateKey,
756
+ thresholdSignatureScheme,
757
+ signedSessionId,
758
+ authToken,
759
+ publicAddressCheck,
760
+ traceContext
761
+ }));
762
+ }
763
+ async exportClientKeyshares({ accountAddress, password, signedSessionId, authToken, traceContext }) {
764
+ return this.withHandler((handler)=>handler.exportClientKeyshares({
765
+ chainName: this.chainName,
766
+ accountAddress,
767
+ password,
768
+ signedSessionId,
769
+ authToken,
770
+ traceContext
771
+ }));
803
772
  }
804
773
  /**
805
774
  * keyShares is stringified list of EcdsaKeygenResult[] and Ed25519KeygenResult[]
806
- */ async offlineExportPrivateKey({ keyShares, derivationPath }) {
807
- await this.initializeMessageTransport();
808
- if (!this.iframeMessageHandler) {
809
- throw new Error('Iframe message handler not initialized');
810
- }
775
+ */ async offlineExportPrivateKey({ keyShares, derivationPath, traceContext }) {
811
776
  const args = {
812
777
  chainName: this.chainName,
813
778
  keyShares,
@@ -816,12 +781,13 @@ class DynamicWalletClient extends IframeManager {
816
781
  const serializedArgs = JSON.stringify(args);
817
782
  const argsBuffer = new TextEncoder().encode(serializedArgs);
818
783
  const base64Args = Buffer.from(argsBuffer).toString('base64');
819
- return this.iframeMessageHandler.offlineExportPrivateKey({
820
- chainName: this.chainName,
821
- base64Args
822
- });
784
+ return this.withHandler((handler)=>handler.offlineExportPrivateKey({
785
+ chainName: this.chainName,
786
+ base64Args,
787
+ traceContext
788
+ }));
823
789
  }
824
- constructor({ environmentId, authToken, baseApiUrl, baseMPCRelayApiUrl, chainName, sdkVersion, debug, authMode = core.AuthMode.HEADER }){
790
+ constructor({ environmentId, authToken, baseApiUrl, baseMPCRelayApiUrl, baseClientKeysharesRelayApiUrl, chainName, sdkVersion, debug, authMode = core.AuthMode.HEADER }){
825
791
  super({
826
792
  environmentId,
827
793
  authToken,
@@ -830,7 +796,8 @@ class DynamicWalletClient extends IframeManager {
830
796
  chainName,
831
797
  sdkVersion,
832
798
  debug,
833
- authMode
799
+ authMode,
800
+ baseClientKeysharesRelayApiUrl
834
801
  });
835
802
  }
836
803
  }