@dynamic-labs-wallet/core 0.0.4 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.esm.js CHANGED
@@ -1,7 +1,10 @@
1
1
  import axios from 'axios';
2
2
 
3
- const RELAY_API_URL = 'relay.dynamic-preprod.xyz';
4
- const DYNAMIC_AUTH_BASE_API_URL = 'https://app.dynamicauth.com';
3
+ const isProd = process.env.NODE_ENV === 'production';
4
+ const isPreProd = process.env.NODE_ENV === 'preprod';
5
+ const DYNAMIC_AUTH_BASE_API_URL = isProd ? 'https://app.dynamicauth.com' : isPreProd ? 'https://app.dynamic-preprod.xyz' : 'http://localhost:4200';
6
+ const DYNAMIC_CLIENT_RELAY_BASE_API_URL = isProd ? 'https://app-dynamicauth-com-app-6e12fc400995.relay.evervault.app' : isPreProd ? 'https://app-dynamic-preprod-xyz-app-32d15525a875.relay.evervault.app' : DYNAMIC_AUTH_BASE_API_URL;
7
+ const MPC_RELAY_API_URL = isProd ? 'mpc-relay.dynamic-prod.xyz' : 'relay.dynamic-preprod.xyz';
5
8
 
6
9
  var SigningAlgorithm = /*#__PURE__*/ function(SigningAlgorithm) {
7
10
  SigningAlgorithm["ECDSA"] = "ECDSA";
@@ -142,6 +145,11 @@ class BaseClient {
142
145
  baseURL: this.baseApiUrl,
143
146
  headers
144
147
  });
148
+ this.clientRelayBaseApiUrl = DYNAMIC_CLIENT_RELAY_BASE_API_URL;
149
+ this.clientRelayApiClient = axios.create({
150
+ baseURL: this.clientRelayBaseApiUrl,
151
+ headers
152
+ });
145
153
  }
146
154
  }
147
155
 
@@ -178,7 +186,7 @@ class DynamicApiClient extends BaseClient {
178
186
  return data;
179
187
  }
180
188
  async storeEncryptedBackupByWallet({ walletId, encryptedKeyShares, passwordEncrypted }) {
181
- const { data } = await this.apiClient.post(`/api/v0/sdk/${this.environmentId}/waas/${walletId}/keyShares/backup`, {
189
+ const { data } = await this.clientRelayApiClient.post(`/api/v0/sdk/${this.environmentId}/waas/${walletId}/keyShares/backup`, {
182
190
  // TODO: decide on whether to store encryptedAccountCredentials or encryptedKeyShares as backup
183
191
  encryptedAccountCredentials: encryptedKeyShares,
184
192
  passwordEncrypted
@@ -186,7 +194,7 @@ class DynamicApiClient extends BaseClient {
186
194
  return data;
187
195
  }
188
196
  async recoverEncryptedBackupByWallet({ walletId, keyShareIds }) {
189
- const { data } = await this.apiClient.post(`/api/v0/sdk/${this.environmentId}/waas/${walletId}/keyShares/recover`, keyShareIds ? {
197
+ const { data } = await this.clientRelayApiClient.post(`/api/v0/sdk/${this.environmentId}/waas/${walletId}/keyShares/recover`, keyShareIds ? {
190
198
  keyShareIds
191
199
  } : undefined);
192
200
  return data;
@@ -222,4 +230,4 @@ class DynamicApiClient extends BaseClient {
222
230
  }
223
231
  }
224
232
 
225
- export { BITCOIN_DERIVATION_PATHS, DYNAMIC_AUTH_BASE_API_URL, DynamicApiClient, MPC_CHAIN_CONFIG, MPC_CONFIG, RELAY_API_URL, SigningAlgorithm, ThresholdSignatureScheme, getClientThreshold, getDynamicServerThreshold, getMPCChainConfig, getTSSConfig };
233
+ export { BITCOIN_DERIVATION_PATHS, DYNAMIC_AUTH_BASE_API_URL, DYNAMIC_CLIENT_RELAY_BASE_API_URL, DynamicApiClient, MPC_CHAIN_CONFIG, MPC_CONFIG, MPC_RELAY_API_URL, SigningAlgorithm, ThresholdSignatureScheme, getClientThreshold, getDynamicServerThreshold, getMPCChainConfig, getTSSConfig };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs-wallet/core",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "dependencies": {
5
5
  "axios": "1.7.9"
6
6
  },
@@ -3,6 +3,8 @@ export declare class BaseClient {
3
3
  apiClient: AxiosInstance;
4
4
  baseApiUrl: string;
5
5
  environmentId: string;
6
+ clientRelayBaseApiUrl: string;
7
+ clientRelayApiClient: AxiosInstance;
6
8
  constructor({ environmentId, baseApiUrl, authToken, }: {
7
9
  environmentId: string;
8
10
  baseApiUrl?: string;
@@ -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;AAGlD,qBAAa,UAAU;IACd,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;gBAEjB,EACV,aAAa,EACb,UAAU,EACV,SAAS,GACV,EAAE;QACD,aAAa,EAAE,MAAM,CAAC;QACtB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB;CAWF"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAMlD,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;gBAC/B,EACV,aAAa,EACb,UAAU,EACV,SAAS,GACV,EAAE;QACD,aAAa,EAAE,MAAM,CAAC;QACtB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB;CAgBF"}
@@ -1,3 +1,4 @@
1
- export declare const RELAY_API_URL = "relay.dynamic-preprod.xyz";
2
- export declare const DYNAMIC_AUTH_BASE_API_URL = "https://app.dynamicauth.com";
1
+ export declare const DYNAMIC_AUTH_BASE_API_URL: string;
2
+ export declare const DYNAMIC_CLIENT_RELAY_BASE_API_URL: string;
3
+ export declare const MPC_RELAY_API_URL: string;
3
4
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../packages/src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,8BAA8B,CAAC;AAEzD,eAAO,MAAM,yBAAyB,gCAAgC,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../packages/src/constants.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,yBAAyB,QAIX,CAAC;AAE5B,eAAO,MAAM,iCAAiC,QAIjB,CAAC;AAE9B,eAAO,MAAM,iBAAiB,QAEC,CAAC"}