@riocrypto/common-server 1.0.1011 → 1.0.1013
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,5 +1,5 @@
|
|
|
1
1
|
import { Fiat } from "@riocrypto/common";
|
|
2
|
-
export declare const getExchangeRates: (from: Fiat, to: Fiat, volatilitySafeguard
|
|
2
|
+
export declare const getExchangeRates: (from: Fiat, to: Fiat, volatilitySafeguard: boolean) => Promise<{
|
|
3
3
|
conversionRate: number;
|
|
4
4
|
conversionRateWithVolatilityMarkup: number;
|
|
5
5
|
conversionRateWithRioMarkup: number;
|
|
@@ -14,7 +14,7 @@ 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
16
|
const QUOTE_DURATION_MINUTES = 10;
|
|
17
|
-
const getExchangeRates = (from, to, volatilitySafeguard
|
|
17
|
+
const getExchangeRates = (from, to, volatilitySafeguard) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
18
|
const currencyAPIClient = yield (0, currency_api_client_1.buildCurrencyAPIClient)();
|
|
19
19
|
const kapstarClient = yield (0, kapstar_client_1.buildKapstarClient)();
|
|
20
20
|
const conversionRate = to === common_1.Fiat.BRL
|
|
@@ -124,15 +124,15 @@ const getPlatformAndPartnerFees = (mongoose, conversionRateToUSD, amountFiat, fi
|
|
|
124
124
|
if (discount > range.fee) {
|
|
125
125
|
throw new common_1.GenericInputError("Discount cannot be greater than platform fee");
|
|
126
126
|
}
|
|
127
|
-
else if (markup) {
|
|
128
|
-
const netFee = range.fee + markup;
|
|
129
|
-
platformFeeFiat = amountFiat * netFee;
|
|
130
|
-
}
|
|
131
127
|
else {
|
|
132
128
|
const netFee = range.fee - discount;
|
|
133
129
|
platformFeeFiat = amountFiat * netFee;
|
|
134
130
|
}
|
|
135
131
|
}
|
|
132
|
+
else if (markup) {
|
|
133
|
+
const netFee = range.fee + markup;
|
|
134
|
+
platformFeeFiat = amountFiat * netFee;
|
|
135
|
+
}
|
|
136
136
|
else {
|
|
137
137
|
platformFeeFiat = amountFiat * range.fee;
|
|
138
138
|
}
|