@dynamic-labs-wallet/core 0.0.0-preview.57 → 0.0.1-paolo-1

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
@@ -1,17 +1,74 @@
1
1
  'use strict';
2
2
 
3
+ var uuid = require('uuid');
3
4
  var axios = require('axios');
5
+ var forwardMpcClient = require('@dynamic-labs-wallet/forward-mpc-client');
6
+ var createHttpError = require('http-errors');
4
7
 
5
- const DYNAMIC_AUTH_PROD_BASE_API_URL = 'https://app.dynamicauth.com';
8
+ var ENVIRONMENT_ENUM = /*#__PURE__*/ function(ENVIRONMENT_ENUM) {
9
+ ENVIRONMENT_ENUM["development"] = "development";
10
+ ENVIRONMENT_ENUM["preprod"] = "preprod";
11
+ ENVIRONMENT_ENUM["production"] = "production";
12
+ return ENVIRONMENT_ENUM;
13
+ }({});
14
+ const DynamicRequestIdHeader = 'x-dyn-request-id';
15
+ const DynamicClientSessionSignature = 'x-dyn-client-session-signature';
16
+ const DynamicMfaTokenHeader = 'x-mfa-auth-token';
17
+ const DynamicForwardMPCHeader = 'x-forward-mpc-client';
18
+ const DynamicTraceIdHeader = 'x-dyn-trace-id';
19
+ const DynamicTraceElapsedTimeHeader = 'x-dyn-trace-elapsed-time';
20
+ /**
21
+ * Dynamic auth base API URL to redcoast API
22
+ * NOTE: For coookie auth, we should use the configured baseApiUrl
23
+ */ const DYNAMIC_AUTH_PROD_BASE_API_URL = 'https://app.dynamicauth.com';
6
24
  const DYNAMIC_AUTH_PREPROD_BASE_API_URL = 'https://app.dynamic-preprod.xyz';
7
- const DYNAMIC_CLIENT_RELAY_PROD_BASE_API_URL = 'https://app-dynamicauth-com-app-6e12fc400995.relay.evervault.app';
8
- const DYNAMIC_CLIENT_RELAY_PREPROD_BASE_API_URL = 'https://app-dynamic-preprod-xyz-app-32d15525a875.relay.evervault.app';
9
- const MPC_RELAY_PROD_API_URL = 'relay.dynamicauth.com';
25
+ const DYNAMIC_AUTH_DEV_BASE_API_URL = 'http://localhost:4200';
26
+ const DYNAMIC_AUTH_BASE_API_URL_MAP = {
27
+ ["production"]: DYNAMIC_AUTH_PROD_BASE_API_URL,
28
+ ["preprod"]: DYNAMIC_AUTH_PREPROD_BASE_API_URL,
29
+ ["development"]: DYNAMIC_AUTH_DEV_BASE_API_URL
30
+ };
31
+ /**
32
+ * Evervault keyshare encryption relay
33
+ * Note: Not used for cookie auth, we use the configured baseKeyshareRelayApiUrl
34
+ */ const DYNAMIC_KEYSHARES_RELAY_PROD_BASE_API_URL = 'https://waas-keyshares-relay.dynamicauth.com';
35
+ const DYNAMIC_KEYSHARES_RELAY_PREPROD_BASE_API_URL = 'https://waas-keyshares-relay.dynamic-preprod.xyz';
36
+ const DYNAMIC_KEYSHARES_RELAY_MAP = {
37
+ ["production"]: DYNAMIC_KEYSHARES_RELAY_PROD_BASE_API_URL,
38
+ ["preprod"]: DYNAMIC_KEYSHARES_RELAY_PREPROD_BASE_API_URL,
39
+ ["development"]: DYNAMIC_KEYSHARES_RELAY_PREPROD_BASE_API_URL
40
+ };
41
+ /**
42
+ * Dymamic MPC relay where the MPC operations are performed (NOT keyshare relay in Evervault)
43
+ */ const MPC_RELAY_PROD_API_URL = 'relay.dynamicauth.com';
10
44
  const MPC_RELAY_PREPROD_API_URL = 'relay.dynamic-preprod.xyz';
45
+ const MPC_RELAY_DEV_API_URL = 'http://localhost:4200';
46
+ const MPC_RELAY_URL_MAP = {
47
+ ["production"]: MPC_RELAY_PROD_API_URL,
48
+ ["preprod"]: MPC_RELAY_PREPROD_API_URL,
49
+ ["development"]: MPC_RELAY_DEV_API_URL
50
+ };
51
+ const RELAY_APP_ID_HEADER = 'X-Evervault-App-Id';
52
+ const PROD_RELAY_APP_ID = 'app_6e12fc400995';
53
+ const PREPROD_RELAY_APP_ID = 'app_32d15525a875';
54
+ const DYNAMIC_CLIENT_RELAY_REDCOAST_APP_ID_MAP = {
55
+ ["production"]: PROD_RELAY_APP_ID,
56
+ ["preprod"]: PREPROD_RELAY_APP_ID,
57
+ ["development"]: undefined
58
+ };
59
+ const RELAY_API_KEY_HEADER = 'X-Evervault-Api-Key';
60
+ // This is the API key for the relay API. Its must be public to use MTLs
61
+ const PROD_RELAY_API_KEY = 'ev:key:1:7kRuVm1sE1J5FjGz2ijufy0IkATzrBKEvde0IMLW1dt3xbFcdTdOKHO0vNnJeAjAD:YmAPOP:Jh7DdD';
62
+ const PREPROD_RELAY_API_KEY = 'ev:key:1:7j2jIPMzlcKlpDz1RTV6Vadsm8sgmj1VHZzJXqW9ie1dgmyzKmccEGI8BBWU0PaXv:XfF7Ri:ivvRp1';
63
+ const DYNAMIC_CLIENT_RELAY_REDCOAST_API_KEY_MAP = {
64
+ ["production"]: PROD_RELAY_API_KEY,
65
+ ["preprod"]: PREPROD_RELAY_API_KEY,
66
+ ["development"]: undefined
67
+ };
11
68
  const SOLANA_RPC_URL = 'https://api.devnet.solana.com';
12
69
  const chain = {
13
70
  EVM: 'EVM',
14
- SOL: 'SOL',
71
+ SVM: 'SVM',
15
72
  COSMOS: 'COSMOS',
16
73
  BTC: 'BTC',
17
74
  FLOW: 'FLOW',
@@ -34,21 +91,49 @@ var BackupLocation = /*#__PURE__*/ function(BackupLocation) {
34
91
  BackupLocation["ICLOUD"] = "iCloud";
35
92
  BackupLocation["USER"] = "user";
36
93
  BackupLocation["EXTERNAL"] = "external";
94
+ BackupLocation["DELEGATED"] = "delegated";
37
95
  return BackupLocation;
38
96
  }({});
39
- // TODO: replace with apiClient proxy and move this to apiClient when ready
40
- const IFRAME_DOMAIN_PREPROD = 'https://waas.dynamic-preprod.xyz';
41
- const IFRAME_DOMAIN_PROD = 'https://waas.dynamicauth.com';
42
- const ChainEnumToVerifiedCredentialName = {
97
+ const IFRAME_DOMAIN_MAP = {
98
+ development: 'http://localhost:4200',
99
+ preprod: 'https://app.dynamic-preprod.xyz',
100
+ production: 'https://app.dynamicauth.com'
101
+ };
102
+ const chainEnumToVerifiedCredentialName = {
43
103
  BTC: 'bip122',
44
104
  EVM: 'eip155',
45
105
  FLOW: 'flow',
46
- SOL: 'solana'
106
+ SVM: 'solana'
47
107
  };
48
- const VerifiedCredentialNameToChainEnum = {
108
+ const verifiedCredentialNameToChainEnum = {
49
109
  bip122: 'BTC',
50
110
  eip155: 'EVM',
51
- solana: 'SOL'
111
+ solana: 'SVM',
112
+ sui: 'SUI'
113
+ };
114
+ const DELEGATED_SHARE_COUNT = 1;
115
+ const FEATURE_FLAGS = {
116
+ ENABLE_DELEGATED_KEY_SHARES_FLAG: 'enable-delegated-key-shares',
117
+ ENABLE_FORWARD_MPC_CLIENT_FLAG: 'enable-forward-mpc-client'
118
+ };
119
+ const DYNAMIC_FORWARD_MPC_PROD_ENCLAVE_URL = 'wss://forward-mpc-client-prod.app-bf095f298b04.enclave.evervault.com/ws';
120
+ const DYNAMIC_FORWARD_MPC_PREPROD_ENCLAVE_URL = 'wss://forward-mpc-client-preprod.app-560a39ebfe3b.enclave.evervault.com/ws';
121
+ const DYNAMIC_FORWARD_MPC_DEV_ENCLAVE_URL = 'ws://localhost:8008/ws';
122
+ const DYNAMIC_FORWARD_MPC_ENCLAVE_URL_MAP = {
123
+ ["production"]: DYNAMIC_FORWARD_MPC_PROD_ENCLAVE_URL,
124
+ ["preprod"]: DYNAMIC_FORWARD_MPC_PREPROD_ENCLAVE_URL,
125
+ ["development"]: DYNAMIC_FORWARD_MPC_DEV_ENCLAVE_URL
126
+ };
127
+ const DYNAMIC_FORWARD_MPC_ENCLAVE_ATTESTATION_CONFIG_MAP = {
128
+ ["production"]: {
129
+ expectedPcr8: '484fd412249304fe7659b2a9a4869504f0e4502d8abb4f88183e65416b4f62354e4eda60e80a5b2e9d730ab0d804f83e',
130
+ strictCertValidation: true
131
+ },
132
+ ["preprod"]: {
133
+ expectedPcr8: 'acc59ec98dbf7ecb43f9a6b9890866141868c079aa879e05e3675e1a10e187259a64951e72cc531541b02dbdcd780770',
134
+ strictCertValidation: true
135
+ },
136
+ ["development"]: undefined
52
137
  };
53
138
 
54
139
  var SigningAlgorithm = /*#__PURE__*/ function(SigningAlgorithm) {
@@ -94,7 +179,7 @@ const MPC_CHAIN_CONFIG = {
94
179
  ],
95
180
  signingAlgorithm: "ECDSA"
96
181
  },
97
- SOL: {
182
+ SVM: {
98
183
  // Uses Ed25519
99
184
  derivationPath: [
100
185
  44,
@@ -131,6 +216,17 @@ const MPC_CHAIN_CONFIG = {
131
216
  0
132
217
  ],
133
218
  signingAlgorithm: "ED25519"
219
+ },
220
+ SUI: {
221
+ // Uses Ed25519
222
+ derivationPath: [
223
+ 44,
224
+ 784,
225
+ 0,
226
+ 0,
227
+ 0
228
+ ],
229
+ signingAlgorithm: "ED25519"
134
230
  }
135
231
  };
136
232
  var ThresholdSignatureScheme = /*#__PURE__*/ function(ThresholdSignatureScheme) {
@@ -377,26 +473,40 @@ const getDynamicServerThreshold = (thresholdSignatureScheme)=>{
377
473
  throw new Error(`Unsupported reshare from ${oldThresholdSignatureScheme} to ${newThresholdSignatureScheme}`);
378
474
  }
379
475
  };
380
-
381
- class BaseClient {
382
- constructor({ environmentId, baseApiUrl, authToken, baseClientRelayApiUrl }){
383
- const headers = {};
384
- headers['Authorization'] = authToken ? `Bearer ${authToken}` : undefined;
385
- this.environmentId = environmentId;
386
- const isProd = typeof baseApiUrl === 'undefined' || DYNAMIC_AUTH_PROD_BASE_API_URL === baseApiUrl;
387
- this.baseApiUrl = isProd ? DYNAMIC_AUTH_PROD_BASE_API_URL : baseApiUrl || DYNAMIC_AUTH_PREPROD_BASE_API_URL;
388
- this.apiClient = axios.create({
389
- baseURL: this.baseApiUrl,
390
- headers
391
- });
392
- this.clientRelayBaseApiUrl = isProd ? DYNAMIC_CLIENT_RELAY_PROD_BASE_API_URL : baseClientRelayApiUrl || DYNAMIC_CLIENT_RELAY_PREPROD_BASE_API_URL;
393
- this.clientRelayApiClient = axios.create({
394
- baseURL: this.clientRelayBaseApiUrl,
395
- headers
396
- });
476
+ const URL_PATTERNS = {
477
+ [ENVIRONMENT_ENUM.development]: /^http:\/\/localhost:\d+$/,
478
+ [ENVIRONMENT_ENUM.preprod]: /-preprod/,
479
+ [ENVIRONMENT_ENUM.production]: /^(?!.*dynamic-preprod)(?!http:\/\/localhost:\d+).*/
480
+ };
481
+ function getEnvironmentFromUrl(url) {
482
+ if (!url) {
483
+ return ENVIRONMENT_ENUM.production;
397
484
  }
485
+ if (URL_PATTERNS[ENVIRONMENT_ENUM.development].test(url)) {
486
+ return ENVIRONMENT_ENUM.development;
487
+ }
488
+ if (URL_PATTERNS[ENVIRONMENT_ENUM.preprod].test(url)) {
489
+ return ENVIRONMENT_ENUM.preprod;
490
+ }
491
+ return ENVIRONMENT_ENUM.production;
398
492
  }
399
493
 
494
+ function _extends() {
495
+ _extends = Object.assign || function assign(target) {
496
+ for(var i = 1; i < arguments.length; i++){
497
+ var source = arguments[i];
498
+ for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
499
+ }
500
+ return target;
501
+ };
502
+ return _extends.apply(this, arguments);
503
+ }
504
+
505
+ var AuthMode = /*#__PURE__*/ function(AuthMode) {
506
+ AuthMode["HEADER"] = "header";
507
+ AuthMode["COOKIE"] = "cookie";
508
+ return AuthMode;
509
+ }({});
400
510
  var SuccessEventType = /*#__PURE__*/ function(SuccessEventType) {
401
511
  SuccessEventType["KeygenComplete"] = "keygen_complete";
402
512
  SuccessEventType["RoomCreated"] = "room_created";
@@ -404,6 +514,9 @@ var SuccessEventType = /*#__PURE__*/ function(SuccessEventType) {
404
514
  return SuccessEventType;
405
515
  }({});
406
516
 
517
+ const getElapsedTime = (startTime)=>{
518
+ return startTime ? (Date.now() - startTime).toString() : undefined;
519
+ };
407
520
  /**
408
521
  * Creates a promise that resolves when a specific event is received from an event stream.
409
522
  * Adds a timeout to prevent hanging and races the two promises.
@@ -412,16 +525,22 @@ var SuccessEventType = /*#__PURE__*/ function(SuccessEventType) {
412
525
  * @param apiClient The axios instance to use for API calls
413
526
  * @param options The configuration options
414
527
  * @returns A promise that resolves with the event data or rejects on timeout
415
- */ const createEventStreamPromise = ({ apiClient, endpoint, body, successEventType, timeoutMs = 30000, timeoutMessage, onError, onCeremonyComplete })=>{
528
+ */ const createEventStreamPromise = ({ apiClient, dynamicRequestId, endpoint, body, successEventType, timeoutMs = 30000, timeoutMessage, onError, onCeremonyComplete, mfaToken, forwardMPCClientEnabled, traceContext })=>{
529
+ const headers = {
530
+ Accept: 'text/event-stream',
531
+ 'Cache-Control': 'no-cache',
532
+ Connection: 'keep-alive',
533
+ [DynamicRequestIdHeader]: dynamicRequestId,
534
+ [DynamicMfaTokenHeader]: mfaToken,
535
+ [DynamicForwardMPCHeader]: forwardMPCClientEnabled,
536
+ [DynamicTraceIdHeader]: traceContext == null ? void 0 : traceContext.traceId,
537
+ [DynamicTraceElapsedTimeHeader]: getElapsedTime(traceContext == null ? void 0 : traceContext.startTime)
538
+ };
416
539
  // Create a promise that will resolve when the success event is received
417
540
  const eventPromise = new Promise((resolve, reject)=>{
418
541
  apiClient.post(endpoint, body, {
419
542
  responseType: 'stream',
420
- headers: {
421
- Accept: 'text/event-stream',
422
- 'Cache-Control': 'no-cache',
423
- Connection: 'keep-alive'
424
- },
543
+ headers: _extends({}, headers),
425
544
  adapter: 'fetch'
426
545
  }).then(createSuccessErrorEventStreamHandler({
427
546
  onError,
@@ -474,8 +593,9 @@ var SuccessEventType = /*#__PURE__*/ function(SuccessEventType) {
474
593
  onCeremonyComplete == null ? void 0 : onCeremonyComplete(accountAddress, walletId);
475
594
  }
476
595
  if (event.type === 'error') {
477
- reject(createErrorFromEventData(event.data));
478
- onError == null ? void 0 : onError(createErrorFromEventData(event.data));
596
+ const error = createErrorFromEventData(event.data);
597
+ reject(error);
598
+ onError == null ? void 0 : onError(error);
479
599
  }
480
600
  }
481
601
  processStream();
@@ -535,99 +655,275 @@ var SuccessEventType = /*#__PURE__*/ function(SuccessEventType) {
535
655
  return events;
536
656
  };
537
657
 
658
+ var version = "0.0.1";
659
+
660
+ class BaseClient {
661
+ syncAuthToken(authToken) {
662
+ if (this.authMode === AuthMode.COOKIE) {
663
+ return;
664
+ }
665
+ if (!authToken) {
666
+ throw new Error('Auth token is required for header authentication');
667
+ }
668
+ const authHeader = `Bearer ${authToken}`;
669
+ this.apiClient.defaults.headers['Authorization'] = authHeader;
670
+ this.clientRelayApiClient.defaults.headers['Authorization'] = authHeader;
671
+ this.apiClient.defaults.headers.common['Authorization'] = authHeader;
672
+ this.clientRelayApiClient.defaults.headers.common['Authorization'] = authHeader;
673
+ if (this.apiClient.defaults.headers['Authorization'] !== authHeader || this.clientRelayApiClient.defaults.headers['Authorization'] !== authHeader) {
674
+ throw new Error('Failed to sync auth token, auth header is not set to the expected auth token after sync, there is likely a race condition, contact Dynamic devs to investigate');
675
+ }
676
+ }
677
+ constructor({ environmentId, baseApiUrl, authToken, baseClientKeysharesRelayApiUrl, authMode = AuthMode.HEADER, // Represents the version of the client SDK used by developer
678
+ sdkVersion, forwardMPCClient }){
679
+ const headers = {};
680
+ // Only set Authorization header if using header auth mode and token is provided
681
+ if (authMode === AuthMode.HEADER && authToken) {
682
+ headers['Authorization'] = `Bearer ${authToken}`;
683
+ }
684
+ headers['x-dyn-wallet-sdk-version'] = version;
685
+ headers['x-dyn-version'] = sdkVersion;
686
+ this.environmentId = environmentId;
687
+ this.authMode = authMode;
688
+ const environment = getEnvironmentFromUrl(baseApiUrl);
689
+ this.baseApiUrl = baseApiUrl != null ? baseApiUrl : DYNAMIC_AUTH_BASE_API_URL_MAP[environment];
690
+ // Configure axios to include credentials for cookie auth
691
+ const axiosConfig = _extends({
692
+ baseURL: this.baseApiUrl,
693
+ headers
694
+ }, authMode === AuthMode.COOKIE ? {
695
+ withCredentials: true
696
+ } : {});
697
+ this.apiClient = axios.create(axiosConfig);
698
+ this.clientKeysharesRelayBaseApiUrl = baseClientKeysharesRelayApiUrl != null ? baseClientKeysharesRelayApiUrl : DYNAMIC_KEYSHARES_RELAY_MAP[environment];
699
+ this.clientRelayApiClient = axios.create({
700
+ baseURL: this.clientKeysharesRelayBaseApiUrl,
701
+ headers: _extends({}, headers, {
702
+ ['x-dyn-environment']: environment,
703
+ ['x-dyn-client-keyshare-relay-api-url']: baseClientKeysharesRelayApiUrl,
704
+ [RELAY_API_KEY_HEADER]: DYNAMIC_CLIENT_RELAY_REDCOAST_API_KEY_MAP[environment],
705
+ [RELAY_APP_ID_HEADER]: DYNAMIC_CLIENT_RELAY_REDCOAST_APP_ID_MAP[environment]
706
+ })
707
+ });
708
+ console.log('--------------------------------');
709
+ console.log('clientKeysharesRelayBaseApiUrl', this.clientKeysharesRelayBaseApiUrl);
710
+ console.log('environment', environment);
711
+ console.log('baseClientKeysharesRelayApiUrl', baseClientKeysharesRelayApiUrl);
712
+ console.log('--------------------------------');
713
+ // Use provided ForwardMPCClient or create a new one
714
+ if (forwardMPCClient) {
715
+ this.forwardMPCClient = forwardMPCClient;
716
+ } else {
717
+ const forwardMPCEnclaveUrl = DYNAMIC_FORWARD_MPC_ENCLAVE_URL_MAP[environment];
718
+ const attestationConfig = DYNAMIC_FORWARD_MPC_ENCLAVE_ATTESTATION_CONFIG_MAP[environment];
719
+ this.forwardMPCClient = new forwardMpcClient.ForwardMPCClient(forwardMPCEnclaveUrl != null ? forwardMPCEnclaveUrl : '', {
720
+ reconnectInterval: 5000,
721
+ reconnectAttempts: 5,
722
+ connectionTimeout: 10000,
723
+ heartbeatInterval: 30000,
724
+ attestationConfig
725
+ });
726
+ }
727
+ }
728
+ }
729
+
538
730
  class DynamicApiClient extends BaseClient {
539
731
  async authenticateApiToken({ environmentId }) {
540
- return this.apiClient.post(`/api/v0/environments/${environmentId}/waas/authenticate`);
732
+ return this.apiClient.post(`/api/v0/environments/${environmentId}/waas/authenticate`, undefined, {
733
+ headers: {
734
+ [DynamicRequestIdHeader]: uuid.v4().replace('-', '')
735
+ }
736
+ });
541
737
  }
542
- async createWalletAccount({ chainName, clientKeygenIds, thresholdSignatureScheme, onError, onCeremonyComplete }) {
738
+ async createWalletAccount({ chainName, clientKeygenIds, dynamicRequestId, thresholdSignatureScheme, skipLock, onError, onCeremonyComplete, traceContext }) {
543
739
  return createEventStreamPromise({
544
740
  apiClient: this.apiClient,
741
+ dynamicRequestId,
545
742
  endpoint: `/api/v0/sdk/${this.environmentId}/waas/create`,
546
- body: {
743
+ body: _extends({
547
744
  chain: chainName,
548
745
  clientKeygenIds,
549
746
  thresholdSignatureScheme
550
- },
747
+ }, skipLock ? {
748
+ skipLock
749
+ } : {}),
551
750
  successEventType: SuccessEventType.KeygenComplete,
552
751
  timeoutMessage: 'Wallet creation timed out',
553
752
  onError,
554
- onCeremonyComplete
753
+ onCeremonyComplete,
754
+ traceContext
555
755
  });
556
756
  }
557
- async signMessage({ walletId, message, onError }) {
757
+ async signMessage({ dynamicRequestId, walletId, message, onError, isFormatted, mfaToken, context, forwardMPCClientEnabled, traceContext }) {
558
758
  return createEventStreamPromise({
559
759
  apiClient: this.apiClient,
760
+ dynamicRequestId,
560
761
  endpoint: `/api/v0/sdk/${this.environmentId}/waas/${walletId}/signMessage`,
561
762
  body: {
562
- message
763
+ message,
764
+ isFormatted,
765
+ context
563
766
  },
564
767
  successEventType: SuccessEventType.RoomCreated,
565
768
  timeoutMessage: 'Message signing timed out',
566
- onError
769
+ onError,
770
+ mfaToken,
771
+ forwardMPCClientEnabled,
772
+ traceContext
567
773
  });
568
774
  }
569
- async refreshWalletAccountShares({ walletId, onError }) {
775
+ async refreshWalletAccountShares({ dynamicRequestId, walletId, onError, mfaToken, traceContext }) {
570
776
  return createEventStreamPromise({
571
777
  apiClient: this.apiClient,
778
+ dynamicRequestId,
572
779
  endpoint: `/api/v0/sdk/${this.environmentId}/waas/${walletId}/refresh`,
573
780
  body: undefined,
574
781
  successEventType: SuccessEventType.RoomCreated,
575
782
  timeoutMessage: 'Refresh timed out',
576
- onError
783
+ onError,
784
+ mfaToken,
785
+ traceContext
577
786
  });
578
787
  }
579
- async reshare({ walletId, clientKeygenIds, oldThresholdSignatureScheme, newThresholdSignatureScheme, onError }) {
788
+ async reshare({ walletId, dynamicRequestId, clientKeygenIds, oldThresholdSignatureScheme, newThresholdSignatureScheme, delegateToProjectEnvironment, revokeDelegation, mfaToken, onError, traceContext }) {
580
789
  return createEventStreamPromise({
581
790
  apiClient: this.apiClient,
791
+ dynamicRequestId,
582
792
  endpoint: `/api/v0/sdk/${this.environmentId}/waas/${walletId}/reshare`,
583
793
  body: {
584
794
  clientKeygenIds,
795
+ delegateToProjectEnvironment,
796
+ newThresholdSignatureScheme,
585
797
  oldThresholdSignatureScheme,
586
- newThresholdSignatureScheme
798
+ revokeDelegation
587
799
  },
588
800
  successEventType: SuccessEventType.RoomCreated,
589
801
  timeoutMessage: 'Reshare timed out',
590
- onError
802
+ onError,
803
+ mfaToken,
804
+ traceContext
591
805
  });
592
806
  }
593
- async exportKey({ walletId, exportId, onError }) {
807
+ async exportKey({ mfaToken, dynamicRequestId, walletId, exportId, onError, traceContext }) {
594
808
  return createEventStreamPromise({
595
809
  apiClient: this.apiClient,
810
+ dynamicRequestId,
596
811
  endpoint: `/api/v0/sdk/${this.environmentId}/waas/${walletId}/privateKey/export`,
597
812
  body: {
598
813
  exportId
599
814
  },
600
815
  successEventType: SuccessEventType.RoomCreated,
601
816
  timeoutMessage: 'Key export timed out',
602
- onError
817
+ onError,
818
+ mfaToken,
819
+ traceContext
603
820
  });
604
821
  }
605
- async storeEncryptedBackupByWallet({ walletId, encryptedKeyShares, passwordEncrypted }) {
822
+ async getDelegatedEncryptionKey({ environmentId, traceContext }) {
823
+ const { data } = await this.apiClient.get(`/api/v0/sdk/${environmentId}/waas/delegatedAccess/encryptionPublicKey`, {
824
+ headers: {
825
+ [DynamicRequestIdHeader]: uuid.v4().replace('-', ''),
826
+ [DynamicTraceIdHeader]: traceContext == null ? void 0 : traceContext.traceId,
827
+ [DynamicTraceElapsedTimeHeader]: getElapsedTime(traceContext == null ? void 0 : traceContext.startTime)
828
+ }
829
+ });
830
+ return data;
831
+ }
832
+ async publishDelegatedKeyShare({ walletId, encryptedKeyShare, signedSessionId, requiresSignedSessionId = false, dynamicRequestId, traceContext }) {
833
+ if (requiresSignedSessionId && !signedSessionId) {
834
+ throw new Error('Signed session ID is required');
835
+ }
836
+ const apiClient = this.apiClient;
837
+ const { data, status } = await apiClient.post(`/api/v0/sdk/${this.environmentId}/waas/${walletId}/delegatedAccess/delivery`, {
838
+ encryptedDelegatedShare: encryptedKeyShare
839
+ }, {
840
+ headers: {
841
+ [DynamicRequestIdHeader]: dynamicRequestId,
842
+ [DynamicClientSessionSignature]: signedSessionId,
843
+ [DynamicTraceIdHeader]: traceContext == null ? void 0 : traceContext.traceId,
844
+ [DynamicTraceElapsedTimeHeader]: getElapsedTime(traceContext == null ? void 0 : traceContext.startTime)
845
+ }
846
+ });
847
+ return {
848
+ data,
849
+ status
850
+ };
851
+ }
852
+ async storeEncryptedBackupByWallet({ walletId, encryptedKeyShares, passwordEncrypted, signedSessionId, encryptionVersion, requiresSignedSessionId = false, authMode = AuthMode.HEADER, dynamicRequestId, traceContext }) {
853
+ if (requiresSignedSessionId && !signedSessionId) {
854
+ throw new Error('Signed session ID is required');
855
+ }
606
856
  const { data } = await this.clientRelayApiClient.post(`/api/v0/sdk/${this.environmentId}/waas/${walletId}/keyShares/backup`, {
607
857
  // TODO: decide on whether to store encryptedAccountCredentials or encryptedKeyShares as backup
608
858
  encryptedAccountCredentials: encryptedKeyShares,
609
- passwordEncrypted
859
+ passwordEncrypted,
860
+ encryptionVersion
861
+ }, {
862
+ headers: {
863
+ [DynamicRequestIdHeader]: dynamicRequestId,
864
+ [DynamicClientSessionSignature]: signedSessionId,
865
+ [DynamicTraceIdHeader]: traceContext == null ? void 0 : traceContext.traceId,
866
+ [DynamicTraceElapsedTimeHeader]: getElapsedTime(traceContext == null ? void 0 : traceContext.startTime)
867
+ },
868
+ withCredentials: authMode === AuthMode.COOKIE ? true : undefined
610
869
  });
611
870
  return data;
612
871
  }
872
+ // TODO: is this still used? if not, remove it
613
873
  async markKeySharesAsBackedUpGoogleDrive({ walletId }) {
614
- const { data } = await this.clientRelayApiClient.post(`/api/v0/sdk/${this.environmentId}/waas/${walletId}/keyShares/backup/googleDrive`, {});
874
+ const { data } = await this.clientRelayApiClient.post(`/api/v0/sdk/${this.environmentId}/waas/${walletId}/keyShares/backup/googleDrive`, {}, {
875
+ headers: {
876
+ [DynamicRequestIdHeader]: uuid.v4().replace('-', '')
877
+ }
878
+ });
879
+ return data;
880
+ }
881
+ async markKeySharesAsBackedUp({ walletId, locations, dynamicRequestId, traceContext }) {
882
+ const { data } = await this.apiClient.post(`/api/v0/sdk/${this.environmentId}/waas/${walletId}/keyShares/backup/locations`, {
883
+ locations
884
+ }, {
885
+ headers: {
886
+ [DynamicRequestIdHeader]: dynamicRequestId,
887
+ [DynamicTraceIdHeader]: traceContext == null ? void 0 : traceContext.traceId,
888
+ [DynamicTraceElapsedTimeHeader]: getElapsedTime(traceContext == null ? void 0 : traceContext.startTime)
889
+ }
890
+ });
615
891
  return data;
616
892
  }
617
- async recoverEncryptedBackupByWallet({ walletId, keyShareIds }) {
893
+ async recoverEncryptedBackupByWallet({ walletId, keyShareIds, signedSessionId, mfaToken, requiresSignedSessionId = false, authMode = AuthMode.HEADER, traceContext }) {
894
+ if (requiresSignedSessionId && !signedSessionId) {
895
+ throw new Error('Signed session ID is required');
896
+ }
897
+ // TODO: add signed messsage to body?
618
898
  const { data } = await this.clientRelayApiClient.post(`/api/v0/sdk/${this.environmentId}/waas/${walletId}/keyShares/recover`, keyShareIds ? {
619
899
  keyShareIds
620
- } : undefined);
900
+ } : undefined, {
901
+ headers: {
902
+ [DynamicRequestIdHeader]: uuid.v4().replace('-', ''),
903
+ [DynamicClientSessionSignature]: signedSessionId,
904
+ [DynamicMfaTokenHeader]: mfaToken,
905
+ [DynamicTraceIdHeader]: traceContext == null ? void 0 : traceContext.traceId,
906
+ [DynamicTraceElapsedTimeHeader]: getElapsedTime(traceContext == null ? void 0 : traceContext.startTime)
907
+ },
908
+ withCredentials: authMode === AuthMode.COOKIE ? true : undefined
909
+ });
621
910
  return data;
622
911
  }
623
- async getAccessToken({ oauthAccountId }) {
624
- const { data } = await this.apiClient.get(`/api/v0/sdk/${this.environmentId}/oauthAccounts/${oauthAccountId}/accessToken`);
912
+ async getAccessToken({ oauthAccountId, traceContext }) {
913
+ const { data } = await this.apiClient.get(`/api/v0/sdk/${this.environmentId}/oauthAccounts/${oauthAccountId}/accessToken`, {
914
+ headers: {
915
+ [DynamicRequestIdHeader]: uuid.v4().replace('-', ''),
916
+ [DynamicTraceIdHeader]: traceContext == null ? void 0 : traceContext.traceId,
917
+ [DynamicTraceElapsedTimeHeader]: getElapsedTime(traceContext == null ? void 0 : traceContext.startTime)
918
+ }
919
+ });
625
920
  return data.accessToken;
626
921
  }
627
922
  // TODO: return array instead considering cases where server has multiple parties
628
- async importPrivateKey({ chainName, clientKeygenIds, thresholdSignatureScheme, onError, onCeremonyComplete }) {
923
+ async importPrivateKey({ chainName, dynamicRequestId, clientKeygenIds, thresholdSignatureScheme, onError, onCeremonyComplete, traceContext }) {
629
924
  return createEventStreamPromise({
630
925
  apiClient: this.apiClient,
926
+ dynamicRequestId,
631
927
  endpoint: `/api/v0/sdk/${this.environmentId}/waas/privateKey/import`,
632
928
  body: {
633
929
  chain: chainName,
@@ -637,17 +933,24 @@ class DynamicApiClient extends BaseClient {
637
933
  successEventType: SuccessEventType.KeygenComplete,
638
934
  timeoutMessage: 'Key import timed out',
639
935
  onError,
640
- onCeremonyComplete
936
+ onCeremonyComplete,
937
+ traceContext
641
938
  });
642
939
  }
643
940
  // TODO: consider removing the retry logics if we switch to server-sent events
644
- async getUser() {
941
+ async getUser(dynamicRequestId, traceContext) {
645
942
  let attempts = 0;
646
943
  const maxAttempts = 5;
647
944
  const retryInterval = 1000; // 1 second interval for each retry
648
945
  while(attempts < maxAttempts){
649
946
  try {
650
- const { data } = await this.apiClient.get(`/api/v0/sdk/${this.environmentId}/users`);
947
+ const { data } = await this.apiClient.get(`/api/v0/sdk/${this.environmentId}/users`, {
948
+ headers: {
949
+ [DynamicRequestIdHeader]: dynamicRequestId,
950
+ [DynamicTraceIdHeader]: traceContext == null ? void 0 : traceContext.traceId,
951
+ [DynamicTraceElapsedTimeHeader]: getElapsedTime(traceContext == null ? void 0 : traceContext.startTime)
952
+ }
953
+ });
651
954
  return data;
652
955
  } catch (error) {
653
956
  attempts++;
@@ -659,13 +962,19 @@ class DynamicApiClient extends BaseClient {
659
962
  }
660
963
  }
661
964
  // TODO: consider removing the retry logics if we switch to server-sent events
662
- async refreshUser() {
965
+ async refreshUser(traceContext) {
663
966
  let attempts = 0;
664
967
  const maxAttempts = 5;
665
968
  const retryInterval = 1000; // 1 second interval for each retry
666
969
  while(attempts < maxAttempts){
667
970
  try {
668
- const { data } = await this.apiClient.post(`/api/v0/sdk/${this.environmentId}/refresh`, undefined);
971
+ const { data } = await this.apiClient.post(`/api/v0/sdk/${this.environmentId}/refresh`, undefined, {
972
+ headers: {
973
+ [DynamicRequestIdHeader]: uuid.v4().replace('-', ''),
974
+ [DynamicTraceIdHeader]: traceContext == null ? void 0 : traceContext.traceId,
975
+ [DynamicTraceElapsedTimeHeader]: getElapsedTime(traceContext == null ? void 0 : traceContext.startTime)
976
+ }
977
+ });
669
978
  return data;
670
979
  } catch (error) {
671
980
  attempts++;
@@ -676,40 +985,237 @@ class DynamicApiClient extends BaseClient {
676
985
  }
677
986
  }
678
987
  }
679
- constructor({ environmentId, authToken, baseApiUrl }){
988
+ async getEnvironmentSettings(traceContext) {
989
+ const { data } = await this.apiClient.get(`/api/v0/sdk/${this.environmentId}/settings`, {
990
+ headers: {
991
+ [DynamicRequestIdHeader]: uuid.v4().replace('-', ''),
992
+ [DynamicTraceIdHeader]: traceContext == null ? void 0 : traceContext.traceId,
993
+ [DynamicTraceElapsedTimeHeader]: getElapsedTime(traceContext == null ? void 0 : traceContext.startTime)
994
+ }
995
+ });
996
+ return data;
997
+ }
998
+ async getWaasWalletById({ walletId, traceContext }) {
999
+ const { data } = await this.apiClient.get(`/api/v0/environments/${this.environmentId}/waas/${walletId}`, {
1000
+ headers: {
1001
+ [DynamicRequestIdHeader]: uuid.v4().replace('-', ''),
1002
+ [DynamicTraceIdHeader]: traceContext == null ? void 0 : traceContext.traceId,
1003
+ [DynamicTraceElapsedTimeHeader]: getElapsedTime(traceContext == null ? void 0 : traceContext.startTime)
1004
+ }
1005
+ });
1006
+ return data;
1007
+ }
1008
+ /**
1009
+ * Fetch a single WaaS wallet by ID using the /sdk/{environmentId}/waas/{walletId} endpoint.
1010
+ * This endpoint returns user information with verified credentials filtered to only include the specified WaaS wallet.
1011
+ */ async getWaasWalletByAddress({ walletAddress, traceContext }) {
1012
+ const { data } = await this.apiClient.get(`/api/v0/sdk/${this.environmentId}/waas/byWalletAddress/${walletAddress}`, {
1013
+ headers: {
1014
+ [DynamicRequestIdHeader]: uuid.v4().replace('-', ''),
1015
+ [DynamicTraceIdHeader]: traceContext == null ? void 0 : traceContext.traceId,
1016
+ [DynamicTraceElapsedTimeHeader]: getElapsedTime(traceContext == null ? void 0 : traceContext.startTime)
1017
+ }
1018
+ });
1019
+ return data;
1020
+ }
1021
+ async delegatedSignMessage({ walletId, message, isFormatted, dynamicRequestId, onError, context, traceContext }) {
1022
+ return createEventStreamPromise({
1023
+ apiClient: this.apiClient,
1024
+ dynamicRequestId,
1025
+ endpoint: `/api/v0/environments/${this.environmentId}/waas/${walletId}/delegatedAccess/signMessage`,
1026
+ body: {
1027
+ message,
1028
+ isFormatted,
1029
+ context
1030
+ },
1031
+ successEventType: SuccessEventType.RoomCreated,
1032
+ timeoutMessage: 'Delegated sign message timed out',
1033
+ onError,
1034
+ traceContext
1035
+ });
1036
+ }
1037
+ constructor({ environmentId, authToken, baseApiUrl, authMode = AuthMode.HEADER, // Represents the version of the client SDK used by developer
1038
+ sdkVersion, forwardMPCClient, baseClientKeysharesRelayApiUrl }){
680
1039
  super({
681
1040
  environmentId,
682
- authToken,
683
- baseApiUrl
1041
+ authToken: authToken || '',
1042
+ baseApiUrl,
1043
+ authMode,
1044
+ sdkVersion,
1045
+ forwardMPCClient,
1046
+ baseClientKeysharesRelayApiUrl
684
1047
  });
685
1048
  }
686
1049
  }
687
1050
 
1051
+ const SDK_NAMESPACE = {
1052
+ REACT: 'WalletKit',
1053
+ CLIENT: 'ClientSDK'
1054
+ };
1055
+ /**
1056
+ * Parses a potentially namespaced SDK version string
1057
+ * @param sdkVersion - The SDK version string, optionally namespaced
1058
+ * @returns Parsed SDK version with namespace and version
1059
+ * @example
1060
+ * parseNamespacedVersion("WalletKit/1.0.0") // { namespace: "WalletKit", version: "1.0.0", raw: "WalletKit/1.0.0" }
1061
+ * parseNamespacedVersion("1.0.0") // { namespace: "WalletKit", version: "1.0.0", raw: "1.0.0" }
1062
+ */ function parseNamespacedVersion(sdkVersion) {
1063
+ if (!sdkVersion || sdkVersion === '') {
1064
+ return null;
1065
+ }
1066
+ // Check if the version contains a namespace
1067
+ const colonIndex = sdkVersion.indexOf('/');
1068
+ if (colonIndex !== -1) {
1069
+ const namespace = sdkVersion.substring(0, colonIndex);
1070
+ const version = sdkVersion.substring(colonIndex + 1);
1071
+ // Validate namespace
1072
+ if (!Object.values(SDK_NAMESPACE).includes(namespace)) {
1073
+ return {
1074
+ namespace: SDK_NAMESPACE.REACT,
1075
+ version,
1076
+ raw: sdkVersion
1077
+ };
1078
+ }
1079
+ return {
1080
+ namespace: namespace,
1081
+ version,
1082
+ raw: sdkVersion
1083
+ };
1084
+ }
1085
+ // No namespace found, default to react-sdk for backward compatibility
1086
+ return {
1087
+ namespace: 'WalletKit',
1088
+ version: sdkVersion,
1089
+ raw: sdkVersion
1090
+ };
1091
+ }
1092
+ /**
1093
+ * Formats a parsed SDK version back to string format
1094
+ * @param parsedVersion - The parsed SDK version object
1095
+ * @returns Formatted SDK version string
1096
+ */ function formatNamespacedVersion(parsedVersion) {
1097
+ return `${parsedVersion.namespace}/${parsedVersion.version}`;
1098
+ }
1099
+ /**
1100
+ * Gets the version string without namespace
1101
+ * @param sdkVersion - The SDK version string, optionally namespaced
1102
+ * @returns Version string without namespace
1103
+ */ function getVersionWithoutNamespace(sdkVersion) {
1104
+ const parsed = parseNamespacedVersion(sdkVersion);
1105
+ return parsed ? parsed.version : null;
1106
+ }
1107
+ /**
1108
+ * Gets the namespace from a potentially namespaced SDK version
1109
+ * @param sdkVersion - The SDK version string, optionally namespaced
1110
+ * @returns The namespace or default namespace
1111
+ */ function getVersionNamespace(sdkVersion) {
1112
+ const parsed = parseNamespacedVersion(sdkVersion);
1113
+ return parsed ? parsed.namespace : null;
1114
+ }
1115
+
1116
+ const serializeMessageForForwardMPC = ({ message, isFormatted = false, chainName })=>{
1117
+ let serializedMessage = message;
1118
+ if (isFormatted && chainName === 'EVM') {
1119
+ if (typeof message === 'string') {
1120
+ // Handle hex string (with or without 0x prefix)
1121
+ const cleanHex = message.startsWith('0x') ? message.slice(2) : message;
1122
+ serializedMessage = cleanHex;
1123
+ } else if (message instanceof Uint8Array) {
1124
+ serializedMessage = Buffer.from(message).toString('hex');
1125
+ } else if (message instanceof MessageHash) {
1126
+ serializedMessage = message.toHex();
1127
+ } else {
1128
+ throw new Error('Unsupported formatted message format');
1129
+ }
1130
+ }
1131
+ return serializedMessage;
1132
+ };
1133
+
1134
+ const handleAxiosError = (error, message, context, logger)=>{
1135
+ var _error_response, _error_response1, _error_response2;
1136
+ logger.error('[DynamicWaasWalletClient] Axios error: ', {
1137
+ message,
1138
+ error: (_error_response = error.response) == null ? void 0 : _error_response.data,
1139
+ status: (_error_response1 = error.response) == null ? void 0 : _error_response1.status,
1140
+ context
1141
+ });
1142
+ switch((_error_response2 = error.response) == null ? void 0 : _error_response2.status){
1143
+ case 400:
1144
+ throw createHttpError(400, 'Invalid request');
1145
+ case 401:
1146
+ throw createHttpError(401, 'Authorization header or cookie is required');
1147
+ case 403:
1148
+ throw createHttpError(403, 'Forbidden');
1149
+ case 422:
1150
+ throw createHttpError(422, 'Unprocessable content');
1151
+ case 500:
1152
+ throw createHttpError(500, 'Internal server error');
1153
+ default:
1154
+ throw createHttpError(500, 'Internal server error');
1155
+ }
1156
+ };
1157
+
1158
+ exports.AuthMode = AuthMode;
688
1159
  exports.BITCOIN_DERIVATION_PATHS = BITCOIN_DERIVATION_PATHS;
689
1160
  exports.BackupLocation = BackupLocation;
690
- exports.ChainEnumToVerifiedCredentialName = ChainEnumToVerifiedCredentialName;
691
1161
  exports.CreateRoomPartiesOptions = CreateRoomPartiesOptions;
1162
+ exports.DELEGATED_SHARE_COUNT = DELEGATED_SHARE_COUNT;
1163
+ exports.DYNAMIC_AUTH_BASE_API_URL_MAP = DYNAMIC_AUTH_BASE_API_URL_MAP;
1164
+ exports.DYNAMIC_AUTH_DEV_BASE_API_URL = DYNAMIC_AUTH_DEV_BASE_API_URL;
692
1165
  exports.DYNAMIC_AUTH_PREPROD_BASE_API_URL = DYNAMIC_AUTH_PREPROD_BASE_API_URL;
693
1166
  exports.DYNAMIC_AUTH_PROD_BASE_API_URL = DYNAMIC_AUTH_PROD_BASE_API_URL;
694
- exports.DYNAMIC_CLIENT_RELAY_PREPROD_BASE_API_URL = DYNAMIC_CLIENT_RELAY_PREPROD_BASE_API_URL;
695
- exports.DYNAMIC_CLIENT_RELAY_PROD_BASE_API_URL = DYNAMIC_CLIENT_RELAY_PROD_BASE_API_URL;
1167
+ exports.DYNAMIC_CLIENT_RELAY_REDCOAST_API_KEY_MAP = DYNAMIC_CLIENT_RELAY_REDCOAST_API_KEY_MAP;
1168
+ exports.DYNAMIC_CLIENT_RELAY_REDCOAST_APP_ID_MAP = DYNAMIC_CLIENT_RELAY_REDCOAST_APP_ID_MAP;
1169
+ exports.DYNAMIC_FORWARD_MPC_DEV_ENCLAVE_URL = DYNAMIC_FORWARD_MPC_DEV_ENCLAVE_URL;
1170
+ exports.DYNAMIC_FORWARD_MPC_ENCLAVE_ATTESTATION_CONFIG_MAP = DYNAMIC_FORWARD_MPC_ENCLAVE_ATTESTATION_CONFIG_MAP;
1171
+ exports.DYNAMIC_FORWARD_MPC_ENCLAVE_URL_MAP = DYNAMIC_FORWARD_MPC_ENCLAVE_URL_MAP;
1172
+ exports.DYNAMIC_FORWARD_MPC_PREPROD_ENCLAVE_URL = DYNAMIC_FORWARD_MPC_PREPROD_ENCLAVE_URL;
1173
+ exports.DYNAMIC_FORWARD_MPC_PROD_ENCLAVE_URL = DYNAMIC_FORWARD_MPC_PROD_ENCLAVE_URL;
1174
+ exports.DYNAMIC_KEYSHARES_RELAY_MAP = DYNAMIC_KEYSHARES_RELAY_MAP;
1175
+ exports.DYNAMIC_KEYSHARES_RELAY_PREPROD_BASE_API_URL = DYNAMIC_KEYSHARES_RELAY_PREPROD_BASE_API_URL;
1176
+ exports.DYNAMIC_KEYSHARES_RELAY_PROD_BASE_API_URL = DYNAMIC_KEYSHARES_RELAY_PROD_BASE_API_URL;
696
1177
  exports.DynamicApiClient = DynamicApiClient;
697
- exports.IFRAME_DOMAIN_PREPROD = IFRAME_DOMAIN_PREPROD;
698
- exports.IFRAME_DOMAIN_PROD = IFRAME_DOMAIN_PROD;
1178
+ exports.DynamicClientSessionSignature = DynamicClientSessionSignature;
1179
+ exports.DynamicForwardMPCHeader = DynamicForwardMPCHeader;
1180
+ exports.DynamicMfaTokenHeader = DynamicMfaTokenHeader;
1181
+ exports.DynamicRequestIdHeader = DynamicRequestIdHeader;
1182
+ exports.DynamicTraceElapsedTimeHeader = DynamicTraceElapsedTimeHeader;
1183
+ exports.DynamicTraceIdHeader = DynamicTraceIdHeader;
1184
+ exports.ENVIRONMENT_ENUM = ENVIRONMENT_ENUM;
1185
+ exports.FEATURE_FLAGS = FEATURE_FLAGS;
1186
+ exports.IFRAME_DOMAIN_MAP = IFRAME_DOMAIN_MAP;
699
1187
  exports.MPC_CHAIN_CONFIG = MPC_CHAIN_CONFIG;
700
1188
  exports.MPC_CONFIG = MPC_CONFIG;
1189
+ exports.MPC_RELAY_DEV_API_URL = MPC_RELAY_DEV_API_URL;
701
1190
  exports.MPC_RELAY_PREPROD_API_URL = MPC_RELAY_PREPROD_API_URL;
702
1191
  exports.MPC_RELAY_PROD_API_URL = MPC_RELAY_PROD_API_URL;
1192
+ exports.MPC_RELAY_URL_MAP = MPC_RELAY_URL_MAP;
1193
+ exports.PREPROD_RELAY_API_KEY = PREPROD_RELAY_API_KEY;
1194
+ exports.PREPROD_RELAY_APP_ID = PREPROD_RELAY_APP_ID;
1195
+ exports.PROD_RELAY_API_KEY = PROD_RELAY_API_KEY;
1196
+ exports.PROD_RELAY_APP_ID = PROD_RELAY_APP_ID;
1197
+ exports.RELAY_API_KEY_HEADER = RELAY_API_KEY_HEADER;
1198
+ exports.RELAY_APP_ID_HEADER = RELAY_APP_ID_HEADER;
1199
+ exports.SDK_NAMESPACE = SDK_NAMESPACE;
703
1200
  exports.SOLANA_RPC_URL = SOLANA_RPC_URL;
704
1201
  exports.SigningAlgorithm = SigningAlgorithm;
705
1202
  exports.SuccessEventType = SuccessEventType;
706
1203
  exports.ThresholdSignatureScheme = ThresholdSignatureScheme;
707
- exports.VerifiedCredentialNameToChainEnum = VerifiedCredentialNameToChainEnum;
1204
+ exports.URL_PATTERNS = URL_PATTERNS;
708
1205
  exports.WalletOperation = WalletOperation;
709
1206
  exports.chain = chain;
1207
+ exports.chainEnumToVerifiedCredentialName = chainEnumToVerifiedCredentialName;
1208
+ exports.formatNamespacedVersion = formatNamespacedVersion;
710
1209
  exports.getClientThreshold = getClientThreshold;
711
1210
  exports.getDynamicServerThreshold = getDynamicServerThreshold;
1211
+ exports.getEnvironmentFromUrl = getEnvironmentFromUrl;
712
1212
  exports.getMPCChainConfig = getMPCChainConfig;
713
1213
  exports.getReshareConfig = getReshareConfig;
714
1214
  exports.getServerWalletReshareConfig = getServerWalletReshareConfig;
715
1215
  exports.getTSSConfig = getTSSConfig;
1216
+ exports.getVersionNamespace = getVersionNamespace;
1217
+ exports.getVersionWithoutNamespace = getVersionWithoutNamespace;
1218
+ exports.handleAxiosError = handleAxiosError;
1219
+ exports.parseNamespacedVersion = parseNamespacedVersion;
1220
+ exports.serializeMessageForForwardMPC = serializeMessageForForwardMPC;
1221
+ exports.verifiedCredentialNameToChainEnum = verifiedCredentialNameToChainEnum;