@riocrypto/common-server 1.0.2150 → 1.0.2151

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.
@@ -8,9 +8,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
11
14
  Object.defineProperty(exports, "__esModule", { value: true });
12
15
  exports.buildClusterClient = void 0;
13
16
  const common_1 = require("@riocrypto/common");
17
+ const https_1 = __importDefault(require("https"));
14
18
  const axios_with_logging_1 = require("./axios-with-logging");
15
19
  const secret_manager_client_1 = require("./secret-manager-client");
16
20
  class ClusterClient {
@@ -20,12 +24,19 @@ class ClusterClient {
20
24
  const axiosWithLogging = (0, axios_with_logging_1.buildAxiosWithLogging)();
21
25
  this.axios = axiosWithLogging;
22
26
  this.axios.defaults.baseURL = baseUrl;
27
+ // When running locally, disable certificate verification (for self-signed certs)
28
+ if (process.env.RIO_ENV === common_1.RioEnv.Local &&
29
+ baseUrl.startsWith("https://")) {
30
+ this.axios.defaults.httpsAgent = new https_1.default.Agent({
31
+ rejectUnauthorized: false,
32
+ });
33
+ }
23
34
  // Set the Host header based on environment
24
35
  const environment = process.env.RIO_ENV;
25
36
  let hostHeader;
26
37
  switch (environment) {
27
38
  case common_1.RioEnv.Local:
28
- hostHeader = "";
39
+ hostHeader = "app.local.rio.trade";
29
40
  break;
30
41
  case common_1.RioEnv.Development:
31
42
  hostHeader = "app.dev.rio.trade";
@@ -392,7 +403,7 @@ class ClusterClient {
392
403
  }
393
404
  placeEmarketsTrade({ amountToTrade, limitPrice, orderType, side, }) {
394
405
  return __awaiter(this, void 0, void 0, function* () {
395
- const response = yield this.axios.post(`${this.baseUrl}/api/emarkets/trades`, { amountToTrade, limitPrice, orderType, side }, {
406
+ const response = yield this.axios.post(`${this.baseUrl}/api/emarkets/bot/trades`, { amountToTrade, limitPrice, orderType, side }, {
396
407
  headers: {
397
408
  "x-cluster-api-key": this.clusterApiKey,
398
409
  },
@@ -402,7 +413,7 @@ class ClusterClient {
402
413
  }
403
414
  getEmarketsTrade(id) {
404
415
  return __awaiter(this, void 0, void 0, function* () {
405
- const response = yield this.axios.get(`${this.baseUrl}/api/emarkets/trades/${id}`, {
416
+ const response = yield this.axios.get(`${this.baseUrl}/api/emarkets/bot/trades/${id}`, {
406
417
  headers: {
407
418
  "x-cluster-api-key": this.clusterApiKey,
408
419
  },
@@ -418,7 +429,7 @@ const buildClusterClient = () => __awaiter(void 0, void 0, void 0, function* ()
418
429
  throw new common_1.SecretManagerError();
419
430
  }
420
431
  const baseUrl = process.env.RIO_ENV === common_1.RioEnv.Local
421
- ? "http://ingress-nginx-controller.ingress-nginx.svc.cluster.local"
432
+ ? "https://ingress-nginx-controller.ingress-nginx.svc.cluster.local"
422
433
  : process.env.RIO_ENV === common_1.RioEnv.Development
423
434
  ? "https://app.dev.rio.trade"
424
435
  : process.env.RIO_ENV === common_1.RioEnv.Production
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.2150",
3
+ "version": "1.0.2151",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",