@clonegod/ttd-sol-common 2.0.45 → 2.0.46
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,7 +1,7 @@
|
|
|
1
1
|
import { Transaction, VersionedTransaction } from '@solana/web3.js';
|
|
2
2
|
export declare class TransactionSender {
|
|
3
3
|
constructor();
|
|
4
|
-
sendTransaction(singedTransaction: Transaction, swqos_only
|
|
5
|
-
sendBundle(mainTx: Transaction, tipTx: Transaction, use_multi_ips?: boolean): Promise<string>;
|
|
4
|
+
sendTransaction(singedTransaction: Transaction | VersionedTransaction, swqos_only?: boolean): Promise<string>;
|
|
5
|
+
sendBundle(mainTx: Transaction | VersionedTransaction, tipTx: Transaction | VersionedTransaction, use_multi_ips?: boolean): Promise<string>;
|
|
6
6
|
}
|
|
7
7
|
export declare function serializeTransactionBase64(tx: Transaction | VersionedTransaction): string;
|
|
@@ -9,9 +9,9 @@ const common_1 = require("../../common");
|
|
|
9
9
|
class TransactionSender {
|
|
10
10
|
constructor() {
|
|
11
11
|
}
|
|
12
|
-
async sendTransaction(singedTransaction, swqos_only) {
|
|
13
|
-
const
|
|
14
|
-
return await (0, helius_1.sendTxWithHelius)(
|
|
12
|
+
async sendTransaction(singedTransaction, swqos_only = true) {
|
|
13
|
+
const singedTxBase64 = serializeTransactionBase64(singedTransaction);
|
|
14
|
+
return await (0, helius_1.sendTxWithHelius)(singedTxBase64, swqos_only);
|
|
15
15
|
}
|
|
16
16
|
async sendBundle(mainTx, tipTx, use_multi_ips = false) {
|
|
17
17
|
const mainTxBase64 = serializeTransactionBase64(mainTx);
|
package/package.json
CHANGED
|
@@ -12,12 +12,31 @@ export class TransactionSender {
|
|
|
12
12
|
constructor() {
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
/**
|
|
16
|
+
* 使用Helius Sender 发送交易
|
|
17
|
+
* - swqos_only=true, 需给 helius 发送至少5000lamports的通道使用费
|
|
18
|
+
* - swqos_only=false, 需给helius 发送至少0.0002SOL的小费,会同时向jito发送交易
|
|
19
|
+
*
|
|
20
|
+
* @param singedTransaction 签名后的交易
|
|
21
|
+
* @param swqos_only true:swqos ;false: swqos + jito
|
|
22
|
+
* @returns txhash
|
|
23
|
+
*/
|
|
24
|
+
async sendTransaction(singedTransaction: Transaction | VersionedTransaction, swqos_only:boolean=true): Promise<string> {
|
|
25
|
+
const singedTxBase64 = serializeTransactionBase64(singedTransaction)
|
|
26
|
+
return await sendTxWithHelius(singedTxBase64, swqos_only)
|
|
18
27
|
}
|
|
19
28
|
|
|
20
|
-
|
|
29
|
+
/**
|
|
30
|
+
* 使用Jito Bundle 发送交易
|
|
31
|
+
* - use_multi_ips=true, 使用多台服务器向jito提交交易(缓解jito的限流)
|
|
32
|
+
* - use_multi_ips=false, 本地直接向jito提交交易
|
|
33
|
+
*
|
|
34
|
+
* @param mainTx 主交易
|
|
35
|
+
* @param tipTx 小费交易
|
|
36
|
+
* @param use_multi_ips true:多节点;false: 单节点
|
|
37
|
+
* @returns bundleId
|
|
38
|
+
*/
|
|
39
|
+
async sendBundle(mainTx: Transaction | VersionedTransaction, tipTx: Transaction | VersionedTransaction, use_multi_ips: boolean=false): Promise<string> {
|
|
21
40
|
const mainTxBase64 = serializeTransactionBase64(mainTx)
|
|
22
41
|
const tipTxBase64 = serializeTransactionBase64(tipTx)
|
|
23
42
|
if(use_multi_ips) {
|