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