@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 +227 -260
- package/index.esm.js +227 -260
- package/package.json +2 -2
- package/src/client/client.d.ts +24 -22
- package/src/client/client.d.ts.map +1 -1
- package/src/client/iframeManager/IframeManager.d.ts +3 -1
- package/src/client/iframeManager/IframeManager.d.ts.map +1 -1
- package/src/services/iframeMessageHandler.d.ts +23 -22
- package/src/services/iframeMessageHandler.d.ts.map +1 -1
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
|
|
75
|
-
const response = await this.requestChannel.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.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
|
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
|
|
536
|
-
chainName: this.chainName
|
|
537
|
-
});
|
|
544
|
+
return operation(this.iframeMessageHandler);
|
|
538
545
|
}
|
|
539
|
-
async
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
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
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
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
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
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
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
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.
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
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
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
return this.
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
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
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
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.
|
|
820
|
-
|
|
821
|
-
|
|
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
|
}
|