@clonegod/ttd-sol-common 1.0.160 → 1.0.161
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/dist/token/get_token_price.js +19 -14
- package/package.json +1 -1
|
@@ -31,7 +31,7 @@ const get_token_price_info = (mints) => __awaiter(void 0, void 0, void 0, functi
|
|
|
31
31
|
}
|
|
32
32
|
not_found_arr = mints.filter(address => !price_map.has(address));
|
|
33
33
|
if (not_found_arr.length > 0) {
|
|
34
|
-
let _price_map = yield (0, exports.
|
|
34
|
+
let _price_map = yield (0, exports.get_token_price_info_from_coingecko)(not_found_arr);
|
|
35
35
|
for (let [key, value] of _price_map) {
|
|
36
36
|
if (value) {
|
|
37
37
|
price_map.set(key, value);
|
|
@@ -81,21 +81,26 @@ const get_token_price_info_from_jupiter = (mints) => __awaiter(void 0, void 0, v
|
|
|
81
81
|
for (let ids of ids_list) {
|
|
82
82
|
try {
|
|
83
83
|
let url = `https://api.jup.ag/price/v2?ids=${ids.join(',')}`;
|
|
84
|
-
const
|
|
85
|
-
(0, dist_1.log_debug)(
|
|
84
|
+
const res = (yield axios_1.default.get(url)).data;
|
|
85
|
+
(0, dist_1.log_debug)(`get_token_price_info_from_jupiter, res=`, res);
|
|
86
|
+
let failed_mints = [];
|
|
86
87
|
for (let address of ids) {
|
|
87
|
-
let
|
|
88
|
-
if (price) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
address,
|
|
92
|
-
price,
|
|
93
|
-
update_time: (0, dist_1.getCurDateTime)()
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
(0, dist_1.log_warn)(`get_token_price_info_from_jupiter failed! address=${address}, price=${price}`);
|
|
88
|
+
let price_obj = res.data[address];
|
|
89
|
+
if (!price_obj || !price_obj['price']) {
|
|
90
|
+
failed_mints.push(address);
|
|
91
|
+
continue;
|
|
98
92
|
}
|
|
93
|
+
let price = price_obj['price'];
|
|
94
|
+
price_map.set(address, {
|
|
95
|
+
symbol: '',
|
|
96
|
+
address,
|
|
97
|
+
price,
|
|
98
|
+
update_time: (0, dist_1.getCurDateTime)()
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
let failed_count = failed_mints.length;
|
|
102
|
+
if (failed_mints.length > 0) {
|
|
103
|
+
(0, dist_1.log_warn)(`get_token_price_info_from_jupiter failed! failed_count=${failed_count}, failed_mints: `, failed_mints);
|
|
99
104
|
}
|
|
100
105
|
}
|
|
101
106
|
catch (err) {
|