@clonegod/ttd-sol-common 2.0.42 → 2.0.43

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.
@@ -48,19 +48,22 @@ class SolTransactionBuilder {
48
48
  swapTx.recentBlockhash = this.recentBlockhash;
49
49
  swapTx.lastValidBlockHeight = this.recentBlockheight + max_block_offset;
50
50
  swapTx.feePayer = this.keypair.publicKey;
51
- let tip_lamports = context.trade_runtime.settings.strategy.sol_tip_fee;
52
- if (tip_lamports < 5000) {
53
- tip_lamports = 5000;
54
- }
55
- if (tip_lamports > 300000) {
56
- tip_lamports = 300000;
51
+ const { sol_bundle_only, sol_tip_fee } = context.trade_runtime.settings.strategy;
52
+ if (!sol_bundle_only) {
53
+ let tip_lamports = sol_tip_fee;
54
+ if (tip_lamports < 5000) {
55
+ tip_lamports = 5000;
56
+ }
57
+ if (tip_lamports > 300000) {
58
+ tip_lamports = 300000;
59
+ }
60
+ let tip_instruction = web3_js_1.SystemProgram.transfer({
61
+ fromPubkey: this.keypair.publicKey,
62
+ toPubkey: new web3_js_1.PublicKey(helius_1.HELIUS_TIP_ACCOUNTS[Math.floor(Math.random() * helius_1.HELIUS_TIP_ACCOUNTS.length)]),
63
+ lamports: tip_lamports,
64
+ });
65
+ swapTx.instructions.push(tip_instruction);
57
66
  }
58
- let tip_instruction = web3_js_1.SystemProgram.transfer({
59
- fromPubkey: this.keypair.publicKey,
60
- toPubkey: new web3_js_1.PublicKey(helius_1.HELIUS_TIP_ACCOUNTS[Math.floor(Math.random() * helius_1.HELIUS_TIP_ACCOUNTS.length)]),
61
- lamports: tip_lamports,
62
- });
63
- swapTx.instructions.push(tip_instruction);
64
67
  swapTx.sign(this.keypair);
65
68
  return swapTx;
66
69
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clonegod/ttd-sol-common",
3
- "version": "2.0.42",
3
+ "version": "2.0.43",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "types/index.d.ts",
@@ -87,24 +87,30 @@ export class SolTransactionBuilder {
87
87
  swapTx.lastValidBlockHeight = this.recentBlockheight + max_block_offset
88
88
  swapTx.feePayer = this.keypair.publicKey
89
89
 
90
- // Helius Sender 要求:
91
- // 1、swqos_only: 至少 5000 lamports 小费
92
- // -> transaction must send a tip of at least 5000 lamports to one of the following Helius wallets: [xxx, ...]
93
- // 2、swqos + jito: 至少 0.0002 SOL 小费 -> lamports = 0.0002 * LAMPORTS_PER_SOL
94
- // -> Requires minimum 0.0002 SOL tip.
95
- let tip_lamports = context.trade_runtime.settings.strategy.sol_tip_fee
96
- if(tip_lamports < 5000) {
97
- tip_lamports = 5000
98
- }
99
- if(tip_lamports > 300000) {
100
- tip_lamports = 300000
90
+ const {sol_bundle_only, sol_tip_fee} = context.trade_runtime.settings.strategy
91
+
92
+ // sol_bundle_only = false, 使用 Helius Sender
93
+ // sol_bundle_only = true, 使用 Jito Bundle - 不需要给Helius小费
94
+ if(!sol_bundle_only) {
95
+ // 使用 Helius Sender:
96
+ // 1、swqos_only: 至少 5000 lamports 小费
97
+ // -> transaction must send a tip of at least 5000 lamports to one of the following Helius wallets: [xxx, ...]
98
+ // 2、swqos + jito: 至少 0.0002 SOL 小费 -> lamports = 0.0002 * LAMPORTS_PER_SOL
99
+ // -> Requires minimum 0.0002 SOL tip.
100
+ let tip_lamports = sol_tip_fee
101
+ if(tip_lamports < 5000) {
102
+ tip_lamports = 5000
103
+ }
104
+ if(tip_lamports > 300000) {
105
+ tip_lamports = 300000
106
+ }
107
+ let tip_instruction = SystemProgram.transfer({
108
+ fromPubkey: this.keypair.publicKey,
109
+ toPubkey: new PublicKey(HELIUS_TIP_ACCOUNTS[Math.floor(Math.random() * HELIUS_TIP_ACCOUNTS.length)]),
110
+ lamports: tip_lamports,
111
+ })
112
+ swapTx.instructions.push(tip_instruction)
101
113
  }
102
- let tip_instruction = SystemProgram.transfer({
103
- fromPubkey: this.keypair.publicKey,
104
- toPubkey: new PublicKey(HELIUS_TIP_ACCOUNTS[Math.floor(Math.random() * HELIUS_TIP_ACCOUNTS.length)]),
105
- lamports: tip_lamports,
106
- })
107
- swapTx.instructions.push(tip_instruction)
108
114
 
109
115
  swapTx.sign(this.keypair)
110
116
 
@@ -58,6 +58,7 @@ export interface SolanaPoolAccountUpdateEventData {
58
58
  pool_name: string
59
59
  data: {
60
60
  slot: number
61
+ // tx_index: number
61
62
  tx_hash: string
62
63
  pool_account: string
63
64
  pool_account_data: string