@clonegod/ttd-sol-common 1.0.137 → 1.0.140
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.
|
@@ -25,7 +25,7 @@ const subscribe_wallet_transaction = (geyser_ws_url, wallet_token_account_list,
|
|
|
25
25
|
(0, dist_1.log_warn)(`user_token_account_list is empty, nothing to subscribe`);
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
|
-
yield (0, dist_1.sleep)(
|
|
28
|
+
yield (0, dist_1.sleep)(parseInt(process.env.SUBSCRIBE_WS_WAIT_SECONDS || '3000'));
|
|
29
29
|
var ws_client = new ws_1.default(geyser_ws_url);
|
|
30
30
|
function subscribe_account_transaction() {
|
|
31
31
|
(0, dist_1.log_info)(`subscribe_account_transaction`, wallet_token_account_list);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function get_latest_jito_tip(speed: string, fee_max_cap: number): Promise<number>;
|
|
1
|
+
export declare function get_latest_jito_tip(speed: string, fee_max_cap: number, tip_up_ratio?: number): Promise<number>;
|
|
@@ -47,8 +47,8 @@ function get_jito_tip_floor() {
|
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
|
-
function get_latest_jito_tip(
|
|
51
|
-
return __awaiter(this,
|
|
50
|
+
function get_latest_jito_tip(speed_1, fee_max_cap_1) {
|
|
51
|
+
return __awaiter(this, arguments, void 0, function* (speed, fee_max_cap, tip_up_ratio = 1.3) {
|
|
52
52
|
let tip_sol = JITO_TIP_DEFAULT;
|
|
53
53
|
let jito_tip_floor = yield get_jito_tip_floor_from_cache();
|
|
54
54
|
if (!jito_tip_floor) {
|
|
@@ -71,13 +71,14 @@ function get_latest_jito_tip(speed, fee_max_cap) {
|
|
|
71
71
|
if (tip_sol > JITO_TIP_MAX) {
|
|
72
72
|
tip_sol = JITO_TIP_MAX;
|
|
73
73
|
}
|
|
74
|
-
let tip_lamports = Math.ceil((tip_sol *
|
|
74
|
+
let tip_lamports = Math.ceil((tip_sol * tip_up_ratio) * web3_js_1.LAMPORTS_PER_SOL);
|
|
75
75
|
if (tip_lamports > fee_max_cap) {
|
|
76
76
|
tip_lamports = fee_max_cap;
|
|
77
77
|
}
|
|
78
78
|
(0, dist_1.log_info)('get_latest_jito_tip', {
|
|
79
79
|
jito_tip_floor,
|
|
80
80
|
tip_sol,
|
|
81
|
+
tip_up_ratio,
|
|
81
82
|
tip_lamports
|
|
82
83
|
});
|
|
83
84
|
return tip_lamports;
|
|
@@ -72,7 +72,10 @@ function get_priority_fee_and_tip(trade_strategy) {
|
|
|
72
72
|
}
|
|
73
73
|
function calculate_gas_fee(trade_strategy) {
|
|
74
74
|
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
-
let { speed, fee_mode, fee_exact, fee_max_cap, broadcast_type } = trade_strategy;
|
|
75
|
+
let { speed, fee_mode, fee_exact, fee_max_cap, tip_up_ratio, broadcast_type } = trade_strategy;
|
|
76
|
+
if (isNaN(tip_up_ratio) || tip_up_ratio < 1) {
|
|
77
|
+
tip_up_ratio = 1;
|
|
78
|
+
}
|
|
76
79
|
let gas_fee = 1000;
|
|
77
80
|
switch (fee_mode) {
|
|
78
81
|
case "exact":
|
|
@@ -80,7 +83,7 @@ function calculate_gas_fee(trade_strategy) {
|
|
|
80
83
|
break;
|
|
81
84
|
case "max_cap":
|
|
82
85
|
if (broadcast_type === 'jito') {
|
|
83
|
-
gas_fee = yield (0, get_jito_tip_floor_1.get_latest_jito_tip)(speed, fee_max_cap);
|
|
86
|
+
gas_fee = yield (0, get_jito_tip_floor_1.get_latest_jito_tip)(speed, fee_max_cap, tip_up_ratio);
|
|
84
87
|
}
|
|
85
88
|
else {
|
|
86
89
|
gas_fee = get_dynamic_fee_by_speed(speed, 50000, fee_max_cap);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clonegod/ttd-sol-common",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.140",
|
|
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.0.
|
|
16
|
+
"@clonegod/ttd-common": "^1.0.170",
|
|
17
17
|
"@irys/sdk": "^0.2.10",
|
|
18
18
|
"@metaplex-foundation/mpl-token-metadata": "^2.5.2",
|
|
19
19
|
"@solana/web3.js": "1.91.6",
|