@pioneer-platform/markets 8.3.3 → 8.3.4
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/lib/index.js +10 -5
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -125,7 +125,7 @@ var get_pro_rate = function () {
|
|
|
125
125
|
};
|
|
126
126
|
var build_balances = function (marketInfoCoinCap, marketInfoCoinGecko, pubkeys) {
|
|
127
127
|
return __awaiter(this, void 0, void 0, function () {
|
|
128
|
-
var tag, valuesUsd, totalValueUsd, outputBalances, unknownTokens, unPricedTokens, proRate, i, entry, ethToUsdRate, proToUsdRate, coincap, coingecko, valueUsd, e_2;
|
|
128
|
+
var tag, valuesUsd, totalValueUsd, outputBalances, unknownTokens, unPricedTokens, proRate, i, entry, ethToUsdRate, proToUsdRate, coincap, coingecko, priceUsd, balance, valueUsd, e_2;
|
|
129
129
|
return __generator(this, function (_a) {
|
|
130
130
|
switch (_a.label) {
|
|
131
131
|
case 0:
|
|
@@ -211,14 +211,19 @@ var build_balances = function (marketInfoCoinCap, marketInfoCoinGecko, pubkeys)
|
|
|
211
211
|
entry.source = "coingecko";
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
|
-
|
|
215
|
-
|
|
214
|
+
priceUsd = Number(entry.priceUsd);
|
|
215
|
+
if (!isNaN(priceUsd) && priceUsd !== 0) {
|
|
216
|
+
balance = Number(entry.balance) || 0;
|
|
217
|
+
valueUsd = balance * priceUsd;
|
|
218
|
+
// Convert valueUsd to string and store back on the entry
|
|
216
219
|
entry.valueUsd = String(valueUsd);
|
|
217
|
-
//valueUsd
|
|
218
|
-
totalValueUsd
|
|
220
|
+
// Add valueUsd to totalValueUsd, ensure totalValueUsd is a number
|
|
221
|
+
totalValueUsd += valueUsd;
|
|
222
|
+
// Push the entry to the output balances
|
|
219
223
|
outputBalances.push(entry);
|
|
220
224
|
}
|
|
221
225
|
else {
|
|
226
|
+
// Push the entry to unPricedTokens if priceUsd is not valid
|
|
222
227
|
unPricedTokens.push(entry);
|
|
223
228
|
}
|
|
224
229
|
//get value
|