@clonegod/ttd-sol-common 1.0.85 → 1.0.86

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.
@@ -1 +1 @@
1
- export declare function get_current_jito_tip(speed: string): Promise<number>;
1
+ export declare function get_latest_jito_tip(speed: string, fee_max_cap: number): Promise<number>;
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.get_current_jito_tip = get_current_jito_tip;
12
+ exports.get_latest_jito_tip = get_latest_jito_tip;
13
13
  const dist_1 = require("@clonegod/ttd-common/dist");
14
14
  const web3_js_1 = require("@solana/web3.js");
15
15
  var jito_tip_pct;
@@ -23,12 +23,13 @@ function get_jito_tip_floor() {
23
23
  (0, dist_1.log_info)(`get_jito_tip_floor`, jito_tip_pct);
24
24
  });
25
25
  }
26
- function refreshJitoTipsPct() {
26
+ function refresh_jito_tip_floor() {
27
27
  setInterval(() => __awaiter(this, void 0, void 0, function* () {
28
28
  get_jito_tip_floor();
29
29
  }), 1 * 60 * 1000);
30
30
  }
31
- function get_current_jito_tip(speed) {
31
+ refresh_jito_tip_floor();
32
+ function get_latest_jito_tip(speed, fee_max_cap) {
32
33
  return __awaiter(this, void 0, void 0, function* () {
33
34
  let tip_sol = JITO_TIP_DEFAULT;
34
35
  if (!jito_tip_pct) {
@@ -50,6 +51,9 @@ function get_current_jito_tip(speed) {
50
51
  tip_sol = JITO_TIP_MAX;
51
52
  }
52
53
  let tip_lamports = Math.ceil((tip_sol * 1.02) * web3_js_1.LAMPORTS_PER_SOL);
54
+ if (tip_lamports > fee_max_cap) {
55
+ tip_lamports = fee_max_cap;
56
+ }
53
57
  return tip_lamports;
54
58
  });
55
59
  }
@@ -80,7 +80,7 @@ function calculate_gas_fee(trade_strategy) {
80
80
  break;
81
81
  case "max_cap":
82
82
  if (broadcast_type === 'jito') {
83
- gas_fee = yield (0, get_jito_tip_floor_1.get_current_jito_tip)(speed);
83
+ gas_fee = yield (0, get_jito_tip_floor_1.get_latest_jito_tip)(speed, fee_max_cap);
84
84
  }
85
85
  else {
86
86
  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.85",
3
+ "version": "1.0.86",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "types/index.d.ts",