@clonegod/ttd-sol-common 1.1.6 → 1.1.8
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.
|
@@ -690,7 +690,7 @@ class RpcClient {
|
|
|
690
690
|
serializedTipTx,
|
|
691
691
|
serializedMainTx
|
|
692
692
|
].join(',');
|
|
693
|
-
const max_retry = Number(process.env.JITO_MAX_RETRIES || '
|
|
693
|
+
const max_retry = Number(process.env.JITO_MAX_RETRIES || '2');
|
|
694
694
|
this.redirectTransactionToExternalServers(txid, encoded_tx, encoding, group_id, max_retry);
|
|
695
695
|
const send_result = yield (0, dist_1.postJSON)(send_tx_jito_url, {
|
|
696
696
|
encoding,
|
|
@@ -739,7 +739,6 @@ class RpcClient {
|
|
|
739
739
|
const hosts = region_group.split(',');
|
|
740
740
|
const host = hosts[(0, dist_1.generateRandomNumber)(0, hosts.length - 1)];
|
|
741
741
|
const url = `http://${host}/solana/send_tx`;
|
|
742
|
-
(0, dist_1.log_info)(`redirect tx ${txid} to ${url}`);
|
|
743
742
|
(0, dist_1.postJSON)(url, {
|
|
744
743
|
encoding,
|
|
745
744
|
encoded_tx,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FormattedTokenPrice } from "./types";
|
|
2
2
|
export declare const get_token_price_info: (mints: string[]) => Promise<Map<string, FormattedTokenPrice>>;
|
|
3
3
|
export declare const get_token_price_info_from_raydium: (mints: string[]) => Promise<Map<string, FormattedTokenPrice>>;
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const get_token_price_info_from_jupiter_v3: (mints: string[]) => Promise<Map<string, FormattedTokenPrice>>;
|
|
5
5
|
export declare const get_token_price_info_from_jupiter_v1: (mints: string[]) => Promise<Map<string, FormattedTokenPrice>>;
|
|
6
6
|
export declare const get_token_price_info_from_coingecko: (mints: string[]) => Promise<Map<string, FormattedTokenPrice>>;
|
|
@@ -12,14 +12,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.get_token_price_info_from_coingecko = exports.get_token_price_info_from_jupiter_v1 = exports.
|
|
15
|
+
exports.get_token_price_info_from_coingecko = exports.get_token_price_info_from_jupiter_v1 = exports.get_token_price_info_from_jupiter_v3 = exports.get_token_price_info_from_raydium = exports.get_token_price_info = void 0;
|
|
16
16
|
const dist_1 = require("@clonegod/ttd-common/dist");
|
|
17
17
|
const axios_1 = __importDefault(require("axios"));
|
|
18
18
|
const get_token_price_info = (mints) => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
19
|
let price_map = yield (0, exports.get_token_price_info_from_raydium)(mints);
|
|
20
20
|
let not_found_arr = mints.filter(address => !price_map.has(address));
|
|
21
21
|
if (not_found_arr.length > 0) {
|
|
22
|
-
let _price_map = yield (0, exports.
|
|
22
|
+
let _price_map = yield (0, exports.get_token_price_info_from_jupiter_v3)(not_found_arr);
|
|
23
23
|
for (let [key, value] of _price_map) {
|
|
24
24
|
if (value) {
|
|
25
25
|
price_map.set(key, value);
|
|
@@ -75,22 +75,22 @@ const get_token_price_info_from_raydium = (mints) => __awaiter(void 0, void 0, v
|
|
|
75
75
|
return price_map;
|
|
76
76
|
});
|
|
77
77
|
exports.get_token_price_info_from_raydium = get_token_price_info_from_raydium;
|
|
78
|
-
const
|
|
78
|
+
const get_token_price_info_from_jupiter_v3 = (mints) => __awaiter(void 0, void 0, void 0, function* () {
|
|
79
79
|
let price_map = new Map();
|
|
80
80
|
let ids_list = (0, dist_1.chunkArray)(mints, 10);
|
|
81
81
|
for (let ids of ids_list) {
|
|
82
82
|
try {
|
|
83
|
-
let url = `https://api.jup.ag/price/
|
|
84
|
-
const res = (yield axios_1.default.get(url)).data;
|
|
85
|
-
(0, dist_1.log_debug)(`
|
|
83
|
+
let url = `https://lite-api.jup.ag/price/v3?ids=${ids.join(',')}`;
|
|
84
|
+
const res = (yield axios_1.default.get(url, { headers: { 'Content-Type': 'application/json' } })).data;
|
|
85
|
+
(0, dist_1.log_debug)(`get_token_price_info_from_jupiter_v3, res=`, res);
|
|
86
86
|
let failed_mints = [];
|
|
87
87
|
for (let address of ids) {
|
|
88
|
-
let price_obj = res
|
|
89
|
-
if (!price_obj || !price_obj['
|
|
88
|
+
let price_obj = res[address];
|
|
89
|
+
if (!price_obj || !price_obj['usdPrice']) {
|
|
90
90
|
failed_mints.push(address);
|
|
91
91
|
continue;
|
|
92
92
|
}
|
|
93
|
-
let price = price_obj['
|
|
93
|
+
let price = price_obj['usdPrice'];
|
|
94
94
|
price_map.set(address, {
|
|
95
95
|
symbol: '',
|
|
96
96
|
address,
|
|
@@ -100,17 +100,17 @@ const get_token_price_info_from_jupiter_v2 = (mints) => __awaiter(void 0, void 0
|
|
|
100
100
|
}
|
|
101
101
|
let failed_count = failed_mints.length;
|
|
102
102
|
if (failed_mints.length > 0) {
|
|
103
|
-
(0, dist_1.log_warn)(`
|
|
103
|
+
(0, dist_1.log_warn)(`get_token_price_info_from_jupiter_v3 failed! failed_count=${failed_count}, failed_mints: `, failed_mints);
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
catch (err) {
|
|
107
|
-
(0, dist_1.log_error)(`
|
|
107
|
+
(0, dist_1.log_error)(`get_token_price_info_from_jupiter_v3 error!`, err);
|
|
108
108
|
}
|
|
109
109
|
yield (0, dist_1.sleep)(1000);
|
|
110
110
|
}
|
|
111
111
|
return price_map;
|
|
112
112
|
});
|
|
113
|
-
exports.
|
|
113
|
+
exports.get_token_price_info_from_jupiter_v3 = get_token_price_info_from_jupiter_v3;
|
|
114
114
|
const get_token_price_info_from_jupiter_v1 = (mints) => __awaiter(void 0, void 0, void 0, function* () {
|
|
115
115
|
let price_map = new Map();
|
|
116
116
|
let ids_list = (0, dist_1.chunkArray)(mints, 10);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clonegod/ttd-sol-common",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.8",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "types/index.d.ts",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"push": "npm run build && npm publish"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@clonegod/ttd-common": "1.1.
|
|
16
|
+
"@clonegod/ttd-common": "1.1.49",
|
|
17
17
|
"@metaplex-foundation/mpl-token-metadata": "^2.5.2",
|
|
18
18
|
"@solana/web3.js": "1.91.6",
|
|
19
19
|
"rpc-websockets": "7.10.0",
|