@riocrypto/common-server 1.0.1308 → 1.0.1310

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.
@@ -1,6 +1,5 @@
1
1
  import { Fiat } from "@riocrypto/common";
2
- export declare const getExchangeRates: (from: Fiat, to: Fiat, noMarkups: boolean) => Promise<{
2
+ export declare const getExchangeRates: (from: Fiat, to: Fiat) => Promise<{
3
3
  conversionRate: number;
4
4
  conversionRateWithMarkups?: number | undefined;
5
- safestPrice?: number | undefined;
6
5
  }>;
@@ -13,18 +13,12 @@ exports.getExchangeRates = void 0;
13
13
  const common_1 = require("@riocrypto/common");
14
14
  const currency_api_client_1 = require("../clients/currency-api-client");
15
15
  const kapstar_client_1 = require("../clients/kapstar-client");
16
- const QUOTE_DURATION_MINUTES = 10;
17
- const getExchangeRates = (from, to, noMarkups) => __awaiter(void 0, void 0, void 0, function* () {
16
+ const getExchangeRates = (from, to) => __awaiter(void 0, void 0, void 0, function* () {
18
17
  const currencyAPIClient = yield (0, currency_api_client_1.buildCurrencyAPIClient)();
19
18
  const kapstarClient = yield (0, kapstar_client_1.buildKapstarClient)();
20
19
  const conversionRate = to === common_1.Fiat.BRL
21
20
  ? yield kapstarClient.getBRLExchangeRateUSD()
22
21
  : yield currencyAPIClient.convert(from, to);
23
- if (noMarkups) {
24
- return {
25
- conversionRate,
26
- };
27
- }
28
22
  let conversionRateWithMarkups = conversionRate;
29
23
  // Time based markups
30
24
  if (from === common_1.Fiat.PEN || to === common_1.Fiat.PEN) {
@@ -3,6 +3,7 @@ interface MarketDataAttrs {
3
3
  conversionRatesToUSD: {
4
4
  [key: string]: {
5
5
  value: number;
6
+ valueWithMarkups: number;
6
7
  lastUpdated: Date;
7
8
  };
8
9
  };
@@ -16,11 +17,17 @@ interface MarketDataModel extends Model<MarketDataDoc> {
16
17
  }
17
18
  interface MarketDataDoc extends Document {
18
19
  _id: string;
19
- lastUpdated: Date;
20
20
  conversionRatesToUSD: {
21
- [key: string]: number;
21
+ [key: string]: {
22
+ value: number;
23
+ valueWithMarkups: number;
24
+ lastUpdated: Date;
25
+ };
26
+ };
27
+ totalFireblocksLiquidityUSD: {
28
+ value: number;
29
+ lastUpdated: Date;
22
30
  };
23
- totalFireblocksLiquidityUSD: number;
24
31
  }
25
32
  declare const buildMarketData: (mongoose: Mongoose) => MarketDataModel;
26
33
  export { buildMarketData, MarketDataDoc };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.1308",
3
+ "version": "1.0.1310",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -27,7 +27,7 @@
27
27
  "@everapi/currencyapi-js": "^1.0.6",
28
28
  "@google-cloud/storage": "^6.9.5",
29
29
  "@google-cloud/vision": "^4.0.2",
30
- "@riocrypto/common": "^1.0.1176",
30
+ "@riocrypto/common": "^1.0.1177",
31
31
  "@types/express": "^4.17.13",
32
32
  "axios": "^0.27.2",
33
33
  "ccxt": "^3.0.30",