@pioneer-platform/markets 8.1.32 → 8.1.36
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 +13 -4
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -79,6 +79,7 @@ axiosRetry(axios, {
|
|
|
79
79
|
},
|
|
80
80
|
});
|
|
81
81
|
var log = require("@pioneer-platform/loggerdog")();
|
|
82
|
+
var _a = require("@pioneer-platform/pioneer-coins"), getExplorerAddressUrl = _a.getExplorerAddressUrl, needsMemoByNetwork = _a.needsMemoByNetwork, COIN_MAP_LONG = _a.COIN_MAP_LONG;
|
|
82
83
|
var URL_COINCAP = "https://api.coincap.io/v2/";
|
|
83
84
|
var URL_COINGECKO = "https://api.coingecko.com/api/v3/";
|
|
84
85
|
var COINGECKO_API_KEY = process.env['COINGECKO_API_KEY'];
|
|
@@ -109,7 +110,7 @@ module.exports = {
|
|
|
109
110
|
};
|
|
110
111
|
var build_balances = function (marketInfoCoinCap, marketInfoCoinGecko, pubkeys, context) {
|
|
111
112
|
return __awaiter(this, void 0, void 0, function () {
|
|
112
|
-
var tag, valuesUsd, totalValueUsd, allNames, balances, hydratedPubkeys, i, pubkey, hydratedPubkey, j, entry, symbol, coinInfoCoinCap, coinInfoCoinGecko, rateUsdCoinCap, rateUsdCoinGecko, relDiff, percent, chosenRate, valueUsd, balance, coincapInfo, coinGeckoInfo, e_1;
|
|
113
|
+
var tag, valuesUsd, totalValueUsd, allNames, balances, hydratedPubkeys, i, pubkey, hydratedPubkey, j, entry, symbol, network, needsMemo, coinInfoCoinCap, coinInfoCoinGecko, rateUsdCoinCap, rateUsdCoinGecko, relDiff, percent, chosenRate, valueUsd, balance, coincapInfo, coinGeckoInfo, e_1;
|
|
113
114
|
return __generator(this, function (_a) {
|
|
114
115
|
switch (_a.label) {
|
|
115
116
|
case 0:
|
|
@@ -152,6 +153,14 @@ var build_balances = function (marketInfoCoinCap, marketInfoCoinGecko, pubkeys,
|
|
|
152
153
|
//clone
|
|
153
154
|
log.debug(tag, "entry: ", entry);
|
|
154
155
|
symbol = entry.asset;
|
|
156
|
+
network = COIN_MAP_LONG[symbol];
|
|
157
|
+
if (network) {
|
|
158
|
+
//address explorer URL
|
|
159
|
+
entry.addressUrl = getExplorerAddressUrl(entry.address, network, symbol, false);
|
|
160
|
+
needsMemo = needsMemoByNetwork(network);
|
|
161
|
+
if (needsMemo)
|
|
162
|
+
entry.needsMemo = true;
|
|
163
|
+
}
|
|
155
164
|
coinInfoCoinCap = marketInfoCoinCap[symbol];
|
|
156
165
|
log.debug(tag, "coinInfoCoinCap: ", coinInfoCoinCap);
|
|
157
166
|
coinInfoCoinGecko = marketInfoCoinGecko[symbol];
|
|
@@ -199,9 +208,9 @@ var build_balances = function (marketInfoCoinCap, marketInfoCoinGecko, pubkeys,
|
|
|
199
208
|
balance = JSON.parse(JSON.stringify(pubkey));
|
|
200
209
|
delete balance.balances;
|
|
201
210
|
balance = __assign(__assign({}, balance), entry);
|
|
202
|
-
log.
|
|
203
|
-
log.
|
|
204
|
-
log.
|
|
211
|
+
log.debug(tag, "context: at (init):", context);
|
|
212
|
+
log.debug(tag, "pubkey: at (init):", pubkey);
|
|
213
|
+
log.debug(tag, "balance: (init):", balance);
|
|
205
214
|
if (!balance.context) {
|
|
206
215
|
balance.context = context;
|
|
207
216
|
}
|