@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.
- package/dist/trade/tx_builder.js +15 -12
- package/package.json +1 -1
- package/src/trade/tx_builder.ts +23 -17
- package/src/types/index.ts +1 -0
package/dist/trade/tx_builder.js
CHANGED
|
@@ -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
|
-
|
|
52
|
-
if (
|
|
53
|
-
tip_lamports =
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
package/src/trade/tx_builder.ts
CHANGED
|
@@ -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
|
-
|
|
91
|
-
|
|
92
|
-
//
|
|
93
|
-
//
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
tip_lamports =
|
|
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
|
|