@pioneer-platform/markets 8.3.2 → 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.
Files changed (2) hide show
  1. package/lib/index.js +10 -6
  2. 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:
@@ -176,7 +176,6 @@ var build_balances = function (marketInfoCoinCap, marketInfoCoinGecko, pubkeys)
176
176
  entry.alias = [];
177
177
  entry.alias.push('PRO');
178
178
  entry.source = "uniswap";
179
- entry.name = "swaps>";
180
179
  entry.symbol = "PRO";
181
180
  }
182
181
  else {
@@ -212,14 +211,19 @@ var build_balances = function (marketInfoCoinCap, marketInfoCoinGecko, pubkeys)
212
211
  entry.source = "coingecko";
213
212
  }
214
213
  }
215
- if (entry.priceUsd) {
216
- valueUsd = entry.balance * entry.priceUsd;
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
217
219
  entry.valueUsd = String(valueUsd);
218
- //valueUsd
219
- totalValueUsd = Number(totalValueUsd) + Number(valueUsd);
220
+ // Add valueUsd to totalValueUsd, ensure totalValueUsd is a number
221
+ totalValueUsd += valueUsd;
222
+ // Push the entry to the output balances
220
223
  outputBalances.push(entry);
221
224
  }
222
225
  else {
226
+ // Push the entry to unPricedTokens if priceUsd is not valid
223
227
  unPricedTokens.push(entry);
224
228
  }
225
229
  //get value
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pioneer-platform/markets",
3
- "version": "8.3.2",
3
+ "version": "8.3.4",
4
4
  "main": "./lib/index.js",
5
5
  "types": "./lib/index.d.ts",
6
6
  "dependencies": {