@clonegod/ttd-sol-common 1.0.79 → 1.0.81
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.
|
@@ -8,6 +8,9 @@ const constants_1 = require("../common/constants");
|
|
|
8
8
|
function create_solana_trade_runtime(connection, trade_runtime, pool_info) {
|
|
9
9
|
let trade_strategy = trade_runtime.settings.strategy;
|
|
10
10
|
let { total_gas, priority_fee, tip_amount } = get_priority_fee_and_tip(trade_strategy);
|
|
11
|
+
console.log({
|
|
12
|
+
total_gas, priority_fee, tip_amount
|
|
13
|
+
});
|
|
11
14
|
let { cu_limit, use_jito_plugin } = pool_info;
|
|
12
15
|
if (isNaN(cu_limit) || cu_limit < 35000) {
|
|
13
16
|
cu_limit = 35000;
|
|
@@ -38,6 +41,7 @@ function create_solana_trade_runtime(connection, trade_runtime, pool_info) {
|
|
|
38
41
|
return solana_trade_runtime;
|
|
39
42
|
}
|
|
40
43
|
function get_priority_fee_and_tip(trade_strategy) {
|
|
44
|
+
let tip_ratio = trade_strategy.tip_ratio;
|
|
41
45
|
let priority_fee = 0;
|
|
42
46
|
let tip_amount = 0;
|
|
43
47
|
let total_gas = calculate_gas_fee(trade_strategy);
|
|
@@ -45,13 +49,12 @@ function get_priority_fee_and_tip(trade_strategy) {
|
|
|
45
49
|
priority_fee = total_gas;
|
|
46
50
|
tip_amount = 0;
|
|
47
51
|
}
|
|
48
|
-
if (trade_strategy.broadcast_type === 'jito') {
|
|
52
|
+
else if (trade_strategy.broadcast_type === 'jito') {
|
|
49
53
|
priority_fee = 0;
|
|
50
54
|
tip_amount = total_gas;
|
|
51
55
|
}
|
|
52
56
|
else if (trade_strategy.broadcast_type === 'mixed') {
|
|
53
|
-
|
|
54
|
-
if (Number.isNaN(tip_ratio) || tip_ratio <= 0) {
|
|
57
|
+
if (Number.isNaN(tip_ratio) || Number.isFinite(tip_ratio) || tip_ratio < 0 || tip_ratio > 1) {
|
|
55
58
|
tip_ratio = 0.3;
|
|
56
59
|
}
|
|
57
60
|
tip_amount = Math.ceil(total_gas * tip_ratio);
|
|
@@ -59,6 +62,7 @@ function get_priority_fee_and_tip(trade_strategy) {
|
|
|
59
62
|
}
|
|
60
63
|
return {
|
|
61
64
|
total_gas,
|
|
65
|
+
tip_ratio,
|
|
62
66
|
priority_fee,
|
|
63
67
|
tip_amount
|
|
64
68
|
};
|