@clonegod/ttd-sol-common 1.0.138 → 1.0.141

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.
@@ -42,7 +42,7 @@ class TradeContext {
42
42
  this.order_msg.amount = uiAmount;
43
43
  (0, dist_1.log_warn)(`Fix input token's amount decimal: from ${amount} to ${uiAmount}`);
44
44
  }
45
- this.slippage_bps = Math.min(100, Math.max(30, this.trade_runtime.settings.slippage_bps));
45
+ this.slippage_bps = Math.min(300, Math.max(50, this.trade_runtime.settings.slippage_bps));
46
46
  this.aToB = this.pool_info.is_reverse_token ? !this.order_msg.aToB : this.order_msg.aToB;
47
47
  this.solana_trade_runtime = yield (0, send_tx_1.create_solana_trade_runtime)(this.connection, this.trade_runtime, this.pool_info);
48
48
  });
@@ -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(speed, fee_max_cap) {
51
- return __awaiter(this, void 0, void 0, function* () {
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 * 1.01) * web3_js_1.LAMPORTS_PER_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.138",
3
+ "version": "1.0.141",
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.169",
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",