@dynamic-labs-wallet/core 0.0.57 → 0.0.58
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 +20 -18
- package/index.esm.js +19 -19
- package/package.json +1 -1
- package/src/api/client.d.ts.map +1 -1
- package/src/mpc/utils.d.ts +7 -0
- package/src/mpc/utils.d.ts.map +1 -1
package/index.cjs.js
CHANGED
|
@@ -411,6 +411,23 @@ const getDynamicServerThreshold = (thresholdSignatureScheme)=>{
|
|
|
411
411
|
throw new Error(`Unsupported reshare from ${oldThresholdSignatureScheme} to ${newThresholdSignatureScheme}`);
|
|
412
412
|
}
|
|
413
413
|
};
|
|
414
|
+
const URL_PATTERNS = {
|
|
415
|
+
[ENVIRONMENT_ENUM.development]: /^http:\/\/localhost:\d+$/,
|
|
416
|
+
[ENVIRONMENT_ENUM.preprod]: /dynamic-preprod/,
|
|
417
|
+
[ENVIRONMENT_ENUM.production]: /^(?!.*dynamic-preprod)(?!http:\/\/localhost:\d+).*/
|
|
418
|
+
};
|
|
419
|
+
function getEnvironmentFromUrl(url) {
|
|
420
|
+
if (!url) {
|
|
421
|
+
return ENVIRONMENT_ENUM.production;
|
|
422
|
+
}
|
|
423
|
+
if (URL_PATTERNS[ENVIRONMENT_ENUM.development].test(url)) {
|
|
424
|
+
return ENVIRONMENT_ENUM.development;
|
|
425
|
+
}
|
|
426
|
+
if (URL_PATTERNS[ENVIRONMENT_ENUM.preprod].test(url)) {
|
|
427
|
+
return ENVIRONMENT_ENUM.preprod;
|
|
428
|
+
}
|
|
429
|
+
return ENVIRONMENT_ENUM.production;
|
|
430
|
+
}
|
|
414
431
|
|
|
415
432
|
class BaseClient {
|
|
416
433
|
constructor({ environmentId, baseApiUrl, authToken, baseClientRelayApiUrl }){
|
|
@@ -418,24 +435,7 @@ class BaseClient {
|
|
|
418
435
|
headers['Authorization'] = authToken ? `Bearer ${authToken}` : undefined;
|
|
419
436
|
headers[DynamicRequestIdHeader] = uuid.v4();
|
|
420
437
|
this.environmentId = environmentId;
|
|
421
|
-
|
|
422
|
-
switch(baseApiUrl){
|
|
423
|
-
case undefined:
|
|
424
|
-
environment = ENVIRONMENT_ENUM.production;
|
|
425
|
-
break;
|
|
426
|
-
case DYNAMIC_AUTH_PROD_BASE_API_URL:
|
|
427
|
-
environment = ENVIRONMENT_ENUM.production;
|
|
428
|
-
break;
|
|
429
|
-
case DYNAMIC_AUTH_PREPROD_BASE_API_URL:
|
|
430
|
-
environment = ENVIRONMENT_ENUM.preprod;
|
|
431
|
-
break;
|
|
432
|
-
case DYNAMIC_AUTH_DEV_BASE_API_URL:
|
|
433
|
-
environment = ENVIRONMENT_ENUM.development;
|
|
434
|
-
break;
|
|
435
|
-
default:
|
|
436
|
-
environment = ENVIRONMENT_ENUM.development;
|
|
437
|
-
break;
|
|
438
|
-
}
|
|
438
|
+
const environment = getEnvironmentFromUrl(baseApiUrl);
|
|
439
439
|
this.baseApiUrl = baseApiUrl != null ? baseApiUrl : DYNAMIC_AUTH_BASE_API_URL_MAP[environment];
|
|
440
440
|
this.apiClient = axios.create({
|
|
441
441
|
baseURL: this.baseApiUrl,
|
|
@@ -762,11 +762,13 @@ exports.SOLANA_RPC_URL = SOLANA_RPC_URL;
|
|
|
762
762
|
exports.SigningAlgorithm = SigningAlgorithm;
|
|
763
763
|
exports.SuccessEventType = SuccessEventType;
|
|
764
764
|
exports.ThresholdSignatureScheme = ThresholdSignatureScheme;
|
|
765
|
+
exports.URL_PATTERNS = URL_PATTERNS;
|
|
765
766
|
exports.VerifiedCredentialNameToChainEnum = VerifiedCredentialNameToChainEnum;
|
|
766
767
|
exports.WalletOperation = WalletOperation;
|
|
767
768
|
exports.chain = chain;
|
|
768
769
|
exports.getClientThreshold = getClientThreshold;
|
|
769
770
|
exports.getDynamicServerThreshold = getDynamicServerThreshold;
|
|
771
|
+
exports.getEnvironmentFromUrl = getEnvironmentFromUrl;
|
|
770
772
|
exports.getMPCChainConfig = getMPCChainConfig;
|
|
771
773
|
exports.getReshareConfig = getReshareConfig;
|
|
772
774
|
exports.getServerWalletReshareConfig = getServerWalletReshareConfig;
|
package/index.esm.js
CHANGED
|
@@ -409,6 +409,23 @@ const getDynamicServerThreshold = (thresholdSignatureScheme)=>{
|
|
|
409
409
|
throw new Error(`Unsupported reshare from ${oldThresholdSignatureScheme} to ${newThresholdSignatureScheme}`);
|
|
410
410
|
}
|
|
411
411
|
};
|
|
412
|
+
const URL_PATTERNS = {
|
|
413
|
+
[ENVIRONMENT_ENUM.development]: /^http:\/\/localhost:\d+$/,
|
|
414
|
+
[ENVIRONMENT_ENUM.preprod]: /dynamic-preprod/,
|
|
415
|
+
[ENVIRONMENT_ENUM.production]: /^(?!.*dynamic-preprod)(?!http:\/\/localhost:\d+).*/
|
|
416
|
+
};
|
|
417
|
+
function getEnvironmentFromUrl(url) {
|
|
418
|
+
if (!url) {
|
|
419
|
+
return ENVIRONMENT_ENUM.production;
|
|
420
|
+
}
|
|
421
|
+
if (URL_PATTERNS[ENVIRONMENT_ENUM.development].test(url)) {
|
|
422
|
+
return ENVIRONMENT_ENUM.development;
|
|
423
|
+
}
|
|
424
|
+
if (URL_PATTERNS[ENVIRONMENT_ENUM.preprod].test(url)) {
|
|
425
|
+
return ENVIRONMENT_ENUM.preprod;
|
|
426
|
+
}
|
|
427
|
+
return ENVIRONMENT_ENUM.production;
|
|
428
|
+
}
|
|
412
429
|
|
|
413
430
|
class BaseClient {
|
|
414
431
|
constructor({ environmentId, baseApiUrl, authToken, baseClientRelayApiUrl }){
|
|
@@ -416,24 +433,7 @@ class BaseClient {
|
|
|
416
433
|
headers['Authorization'] = authToken ? `Bearer ${authToken}` : undefined;
|
|
417
434
|
headers[DynamicRequestIdHeader] = v4();
|
|
418
435
|
this.environmentId = environmentId;
|
|
419
|
-
|
|
420
|
-
switch(baseApiUrl){
|
|
421
|
-
case undefined:
|
|
422
|
-
environment = ENVIRONMENT_ENUM.production;
|
|
423
|
-
break;
|
|
424
|
-
case DYNAMIC_AUTH_PROD_BASE_API_URL:
|
|
425
|
-
environment = ENVIRONMENT_ENUM.production;
|
|
426
|
-
break;
|
|
427
|
-
case DYNAMIC_AUTH_PREPROD_BASE_API_URL:
|
|
428
|
-
environment = ENVIRONMENT_ENUM.preprod;
|
|
429
|
-
break;
|
|
430
|
-
case DYNAMIC_AUTH_DEV_BASE_API_URL:
|
|
431
|
-
environment = ENVIRONMENT_ENUM.development;
|
|
432
|
-
break;
|
|
433
|
-
default:
|
|
434
|
-
environment = ENVIRONMENT_ENUM.development;
|
|
435
|
-
break;
|
|
436
|
-
}
|
|
436
|
+
const environment = getEnvironmentFromUrl(baseApiUrl);
|
|
437
437
|
this.baseApiUrl = baseApiUrl != null ? baseApiUrl : DYNAMIC_AUTH_BASE_API_URL_MAP[environment];
|
|
438
438
|
this.apiClient = axios.create({
|
|
439
439
|
baseURL: this.baseApiUrl,
|
|
@@ -735,4 +735,4 @@ class DynamicApiClient extends BaseClient {
|
|
|
735
735
|
}
|
|
736
736
|
}
|
|
737
737
|
|
|
738
|
-
export { BITCOIN_DERIVATION_PATHS, BackupLocation, ChainEnumToVerifiedCredentialName, CreateRoomPartiesOptions, DYNAMIC_AUTH_BASE_API_URL_MAP, DYNAMIC_AUTH_DEV_BASE_API_URL, DYNAMIC_AUTH_PREPROD_BASE_API_URL, DYNAMIC_AUTH_PROD_BASE_API_URL, DYNAMIC_CLIENT_RELAY_DEV_BASE_API_URL, DYNAMIC_CLIENT_RELAY_MAP, DYNAMIC_CLIENT_RELAY_PREPROD_BASE_API_URL, DYNAMIC_CLIENT_RELAY_PROD_BASE_API_URL, DynamicApiClient, DynamicRequestIdHeader, ENVIRONMENT_ENUM, IFRAME_DOMAIN_MAP, MPC_CHAIN_CONFIG, MPC_CONFIG, MPC_RELAY_DEV_API_URL, MPC_RELAY_PREPROD_API_URL, MPC_RELAY_PROD_API_URL, SOLANA_RPC_URL, SigningAlgorithm, SuccessEventType, ThresholdSignatureScheme, VerifiedCredentialNameToChainEnum, WalletOperation, chain, getClientThreshold, getDynamicServerThreshold, getMPCChainConfig, getReshareConfig, getServerWalletReshareConfig, getTSSConfig };
|
|
738
|
+
export { BITCOIN_DERIVATION_PATHS, BackupLocation, ChainEnumToVerifiedCredentialName, CreateRoomPartiesOptions, DYNAMIC_AUTH_BASE_API_URL_MAP, DYNAMIC_AUTH_DEV_BASE_API_URL, DYNAMIC_AUTH_PREPROD_BASE_API_URL, DYNAMIC_AUTH_PROD_BASE_API_URL, DYNAMIC_CLIENT_RELAY_DEV_BASE_API_URL, DYNAMIC_CLIENT_RELAY_MAP, DYNAMIC_CLIENT_RELAY_PREPROD_BASE_API_URL, DYNAMIC_CLIENT_RELAY_PROD_BASE_API_URL, DynamicApiClient, DynamicRequestIdHeader, ENVIRONMENT_ENUM, IFRAME_DOMAIN_MAP, MPC_CHAIN_CONFIG, MPC_CONFIG, MPC_RELAY_DEV_API_URL, MPC_RELAY_PREPROD_API_URL, MPC_RELAY_PROD_API_URL, SOLANA_RPC_URL, SigningAlgorithm, SuccessEventType, ThresholdSignatureScheme, URL_PATTERNS, VerifiedCredentialNameToChainEnum, WalletOperation, chain, getClientThreshold, getDynamicServerThreshold, getEnvironmentFromUrl, getMPCChainConfig, getReshareConfig, getServerWalletReshareConfig, getTSSConfig };
|
package/package.json
CHANGED
package/src/api/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAQlD,qBAAa,UAAU;IACd,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,oBAAoB,EAAE,aAAa,CAAC;gBAE/B,EACV,aAAa,EACb,UAAU,EACV,SAAS,EACT,qBAAqB,GACtB,EAAE;QACD,aAAa,EAAE,MAAM,CAAC;QACtB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,MAAM,CAAC;QAClB,qBAAqB,CAAC,EAAE,MAAM,CAAC;KAChC;CAsBF"}
|
package/src/mpc/utils.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ThresholdSignatureScheme } from './constants';
|
|
2
|
+
import { ENVIRONMENT_ENUM } from '../constants';
|
|
2
3
|
export declare const getMPCChainConfig: (chainName: string) => {
|
|
3
4
|
derivationPath: number[];
|
|
4
5
|
signingAlgorithm: import("./constants").SigningAlgorithm;
|
|
@@ -49,4 +50,10 @@ export declare const getServerWalletReshareConfig: ({ oldThresholdSignatureSchem
|
|
|
49
50
|
existingDynamicServerShareCount: number;
|
|
50
51
|
newDynamicServerShareCount: number;
|
|
51
52
|
};
|
|
53
|
+
export declare const URL_PATTERNS: {
|
|
54
|
+
development: RegExp;
|
|
55
|
+
preprod: RegExp;
|
|
56
|
+
production: RegExp;
|
|
57
|
+
};
|
|
58
|
+
export declare function getEnvironmentFromUrl(url?: string): ENVIRONMENT_ENUM;
|
|
52
59
|
//# sourceMappingURL=utils.d.ts.map
|
package/src/mpc/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/mpc/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,wBAAwB,EACzB,MAAM,aAAa,CAAC;AAErB,eAAO,MAAM,iBAAiB,cAAe,MAAM;;;CAMlD,CAAC;AAEF,eAAO,MAAM,YAAY,6BACG,wBAAwB;;;CAInD,CAAC;AAEF,eAAO,MAAM,kBAAkB,6BACH,wBAAwB,WAGnD,CAAC;AAEF,eA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