@clonegod/ttd-sol-common 2.0.16 → 2.0.17
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/send/helius.d.ts +1 -1
- package/dist/trade/send/helius.js +2 -3
- package/dist/trade/send/send_tx.d.ts +1 -1
- package/dist/trade/send/send_tx.js +2 -2
- package/dist/trade/tx_builder.js +1 -1
- package/package.json +1 -1
- package/src/trade/send/helius.ts +13 -4
- package/src/trade/send/send_tx.ts +2 -2
- package/src/trade/tx_builder.ts +2 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Transaction } from "@solana/web3.js";
|
|
2
2
|
export declare const HELIUS_JITO_TIP_ACCOUNTS: string[];
|
|
3
|
-
export declare const sendTxWithHelius: (signedTransaction: Transaction,
|
|
3
|
+
export declare const sendTxWithHelius: (signedTransaction: Transaction, tip_helius_jito: boolean) => Promise<string>;
|
|
@@ -17,9 +17,9 @@ exports.HELIUS_JITO_TIP_ACCOUNTS = [
|
|
|
17
17
|
"4vieeGHPYPG2MmyPRcYjdiDmmhN3ww7hsFNap8pVN3Ey",
|
|
18
18
|
"4TQLFNWK8AovT1gFvda5jfw2oJeRMKEmw7aH6MGBJ3or"
|
|
19
19
|
];
|
|
20
|
-
const sendTxWithHelius = async (signedTransaction,
|
|
20
|
+
const sendTxWithHelius = async (signedTransaction, tip_helius_jito) => {
|
|
21
21
|
let url = 'http://tyo-sender.helius-rpc.com/fast';
|
|
22
|
-
if (!
|
|
22
|
+
if (!tip_helius_jito) {
|
|
23
23
|
url = url + "?swqos_only=true";
|
|
24
24
|
}
|
|
25
25
|
const response = await axios_1.default.post(url, {
|
|
@@ -35,7 +35,6 @@ const sendTxWithHelius = async (signedTransaction, send_jito = true) => {
|
|
|
35
35
|
}
|
|
36
36
|
]
|
|
37
37
|
});
|
|
38
|
-
console.dir(response.data, { depth: null });
|
|
39
38
|
return response.data.result;
|
|
40
39
|
};
|
|
41
40
|
exports.sendTxWithHelius = sendTxWithHelius;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Transaction } from '@solana/web3.js';
|
|
2
2
|
export declare class TransactionSender {
|
|
3
3
|
constructor();
|
|
4
|
-
sendTransaction(singedTransactions: Transaction[]): Promise<string>;
|
|
4
|
+
sendTransaction(singedTransactions: Transaction[], tip_helius_jito: boolean): Promise<string>;
|
|
5
5
|
sendBundle(signedTransactions: Transaction[]): Promise<string>;
|
|
6
6
|
}
|
|
@@ -5,9 +5,9 @@ const helius_1 = require("./helius");
|
|
|
5
5
|
class TransactionSender {
|
|
6
6
|
constructor() {
|
|
7
7
|
}
|
|
8
|
-
async sendTransaction(singedTransactions) {
|
|
8
|
+
async sendTransaction(singedTransactions, tip_helius_jito) {
|
|
9
9
|
if (singedTransactions.length === 1) {
|
|
10
|
-
return await (0, helius_1.sendTxWithHelius)(singedTransactions[0]);
|
|
10
|
+
return await (0, helius_1.sendTxWithHelius)(singedTransactions[0], tip_helius_jito);
|
|
11
11
|
}
|
|
12
12
|
else {
|
|
13
13
|
return await this.sendBundle(singedTransactions);
|
package/dist/trade/tx_builder.js
CHANGED
|
@@ -56,7 +56,7 @@ class SolTransactionBuilder {
|
|
|
56
56
|
return swapTx;
|
|
57
57
|
}
|
|
58
58
|
getHeliusJitoTipInstruction(context) {
|
|
59
|
-
let tip_lamports = Math.
|
|
59
|
+
let tip_lamports = Math.min(context.trade_runtime.settings.strategy.sol_tip_fee, 0.0002 * web3_js_1.LAMPORTS_PER_SOL);
|
|
60
60
|
return web3_js_1.SystemProgram.transfer({
|
|
61
61
|
fromPubkey: this.keypair.publicKey,
|
|
62
62
|
toPubkey: new web3_js_1.PublicKey(helius_1.HELIUS_JITO_TIP_ACCOUNTS[Math.floor(Math.random() * helius_1.HELIUS_JITO_TIP_ACCOUNTS.length)]),
|
package/package.json
CHANGED
package/src/trade/send/helius.ts
CHANGED
|
@@ -14,9 +14,12 @@ export const HELIUS_JITO_TIP_ACCOUNTS = [
|
|
|
14
14
|
"4TQLFNWK8AovT1gFvda5jfw2oJeRMKEmw7aH6MGBJ3or"
|
|
15
15
|
]
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Jito + SWQOS
|
|
19
|
+
*/
|
|
20
|
+
export const sendTxWithHelius = async (signedTransaction: Transaction, tip_helius_jito:boolean): Promise<string> => {
|
|
18
21
|
let url = 'http://tyo-sender.helius-rpc.com/fast'
|
|
19
|
-
if(!
|
|
22
|
+
if(!tip_helius_jito) {
|
|
20
23
|
url = url + "?swqos_only=true"
|
|
21
24
|
}
|
|
22
25
|
const response = await axios.post<{ result: string }>(url, {
|
|
@@ -32,7 +35,13 @@ export const sendTxWithHelius = async (signedTransaction: Transaction, send_jito
|
|
|
32
35
|
}
|
|
33
36
|
]
|
|
34
37
|
})
|
|
35
|
-
|
|
36
|
-
|
|
38
|
+
|
|
39
|
+
// {
|
|
40
|
+
// jsonrpc: '2.0',
|
|
41
|
+
// id: '1764747765426',
|
|
42
|
+
// result: '49b7P6SQ5rEDTwGbZs3xAt1QVmx3asSh74TSzoKd9Hsi7owc4KxGadUpyHrSoQDVABUzHqjauTab4EVmf5C2VhvP'
|
|
43
|
+
// }
|
|
44
|
+
// console.dir(response.data, { depth: null })
|
|
45
|
+
|
|
37
46
|
return response.data.result;
|
|
38
47
|
}
|
|
@@ -17,9 +17,9 @@ export class TransactionSender {
|
|
|
17
17
|
constructor() {
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
async sendTransaction(singedTransactions: Transaction[]): Promise<string> {
|
|
20
|
+
async sendTransaction(singedTransactions: Transaction[], tip_helius_jito:boolean): Promise<string> {
|
|
21
21
|
if(singedTransactions.length === 1) {
|
|
22
|
-
return await sendTxWithHelius(singedTransactions[0])
|
|
22
|
+
return await sendTxWithHelius(singedTransactions[0], tip_helius_jito)
|
|
23
23
|
} else {
|
|
24
24
|
return await this.sendBundle(singedTransactions)
|
|
25
25
|
}
|
package/src/trade/tx_builder.ts
CHANGED
|
@@ -91,7 +91,8 @@ export class SolTransactionBuilder {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
getHeliusJitoTipInstruction(context: TradeContext): TransactionInstruction {
|
|
94
|
-
|
|
94
|
+
// Requires minimum 0.0002 SOL tip. (Helius)
|
|
95
|
+
let tip_lamports = Math.min(context.trade_runtime.settings.strategy.sol_tip_fee, 0.0002 * LAMPORTS_PER_SOL)
|
|
95
96
|
return SystemProgram.transfer({
|
|
96
97
|
fromPubkey: this.keypair.publicKey,
|
|
97
98
|
toPubkey: new PublicKey(HELIUS_JITO_TIP_ACCOUNTS[Math.floor(Math.random() * HELIUS_JITO_TIP_ACCOUNTS.length)]),
|