@portal-hq/utils 0.2.15 → 0.2.17
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.
|
@@ -41,7 +41,6 @@ const convertCryptoToLocal = (value, from = 'ETH', countryCode) => __awaiter(voi
|
|
|
41
41
|
const response = yield fetch(url);
|
|
42
42
|
const data = yield response.json();
|
|
43
43
|
const convertedValue = Math.round((value * data[to]) * 10000) / 10000;
|
|
44
|
-
console.log("Converted value: ", convertedValue);
|
|
45
44
|
return convertedValue;
|
|
46
45
|
});
|
|
47
46
|
exports.convertCryptoToLocal = convertCryptoToLocal;
|
|
@@ -58,9 +57,7 @@ const convertLocalToCrypto = (value, to = 'ETH', countryCode) => __awaiter(void
|
|
|
58
57
|
const url = `https://min-api.cryptocompare.com/data/price?fsym=${from}&tsyms=${to}`;
|
|
59
58
|
const response = yield fetch(url);
|
|
60
59
|
const data = yield response.json();
|
|
61
|
-
console.log(data);
|
|
62
60
|
const convertedValue = Math.round((value / (1 / data[to]) + Number.EPSILON) * 10000) / 10000;
|
|
63
|
-
console.log("Converted value: ", convertedValue);
|
|
64
61
|
return convertedValue;
|
|
65
62
|
});
|
|
66
63
|
exports.convertLocalToCrypto = convertLocalToCrypto;
|
|
@@ -37,7 +37,6 @@ export const convertCryptoToLocal = (value, from = 'ETH', countryCode) => __awai
|
|
|
37
37
|
const response = yield fetch(url);
|
|
38
38
|
const data = yield response.json();
|
|
39
39
|
const convertedValue = Math.round((value * data[to]) * 10000) / 10000;
|
|
40
|
-
console.log("Converted value: ", convertedValue);
|
|
41
40
|
return convertedValue;
|
|
42
41
|
});
|
|
43
42
|
export const convertLocalToCrypto = (value, to = 'ETH', countryCode) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -53,8 +52,6 @@ export const convertLocalToCrypto = (value, to = 'ETH', countryCode) => __awaite
|
|
|
53
52
|
const url = `https://min-api.cryptocompare.com/data/price?fsym=${from}&tsyms=${to}`;
|
|
54
53
|
const response = yield fetch(url);
|
|
55
54
|
const data = yield response.json();
|
|
56
|
-
console.log(data);
|
|
57
55
|
const convertedValue = Math.round((value / (1 / data[to]) + Number.EPSILON) * 10000) / 10000;
|
|
58
|
-
console.log("Converted value: ", convertedValue);
|
|
59
56
|
return convertedValue;
|
|
60
57
|
});
|
package/package.json
CHANGED
package/src/currency/index.ts
CHANGED
|
@@ -52,7 +52,6 @@ export const convertCryptoToLocal = async (
|
|
|
52
52
|
|
|
53
53
|
const convertedValue =
|
|
54
54
|
Math.round((value * data[to]) * 10000) / 10000
|
|
55
|
-
console.log("Converted value: ", convertedValue);
|
|
56
55
|
|
|
57
56
|
return convertedValue
|
|
58
57
|
}
|
|
@@ -80,12 +79,9 @@ export const convertLocalToCrypto = async (
|
|
|
80
79
|
const url = `https://min-api.cryptocompare.com/data/price?fsym=${from}&tsyms=${to}`
|
|
81
80
|
const response = await fetch(url)
|
|
82
81
|
const data = await response.json()
|
|
83
|
-
console.log(data);
|
|
84
|
-
|
|
85
82
|
|
|
86
83
|
const convertedValue =
|
|
87
84
|
Math.round((value / (1 / data[to]) + Number.EPSILON) * 10000) / 10000
|
|
88
|
-
console.log("Converted value: ", convertedValue);
|
|
89
85
|
|
|
90
86
|
return convertedValue
|
|
91
87
|
}
|