@drift-labs/sdk 2.53.0-beta.4 → 2.53.0-beta.5
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/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.53.0-beta.
|
|
1
|
+
2.53.0-beta.5
|
|
@@ -12,13 +12,15 @@ export declare class FastSingleTxSender extends BaseTxSender {
|
|
|
12
12
|
additionalConnections: Connection[];
|
|
13
13
|
timoutCount: number;
|
|
14
14
|
blockhashQueue: string[];
|
|
15
|
-
|
|
15
|
+
skipConfirmation: boolean;
|
|
16
|
+
constructor({ connection, wallet, opts, timeout, blockhashRefreshInterval, additionalConnections, skipConfirmation, }: {
|
|
16
17
|
connection: Connection;
|
|
17
18
|
wallet: IWallet;
|
|
18
19
|
opts?: ConfirmOptions;
|
|
19
20
|
timeout?: number;
|
|
20
21
|
blockhashRefreshInterval?: number;
|
|
21
22
|
additionalConnections?: any;
|
|
23
|
+
skipConfirmation?: boolean;
|
|
22
24
|
});
|
|
23
25
|
startBlockhashRefreshLoop(): void;
|
|
24
26
|
addBlockhashToQueue(blockhash: string): void;
|
|
@@ -8,7 +8,7 @@ const DEFAULT_TIMEOUT = 35000;
|
|
|
8
8
|
const DEFAULT_BLOCKHASH_REFRESH = 500;
|
|
9
9
|
const MAX_BLOCKHASH_QUEUE_LENGTH = 100;
|
|
10
10
|
class FastSingleTxSender extends baseTxSender_1.BaseTxSender {
|
|
11
|
-
constructor({ connection, wallet, opts = anchor_1.AnchorProvider.defaultOptions(), timeout = DEFAULT_TIMEOUT, blockhashRefreshInterval = DEFAULT_BLOCKHASH_REFRESH, additionalConnections = new Array(), }) {
|
|
11
|
+
constructor({ connection, wallet, opts = anchor_1.AnchorProvider.defaultOptions(), timeout = DEFAULT_TIMEOUT, blockhashRefreshInterval = DEFAULT_BLOCKHASH_REFRESH, additionalConnections = new Array(), skipConfirmation = false, }) {
|
|
12
12
|
super({ connection, wallet, opts, timeout, additionalConnections });
|
|
13
13
|
this.timoutCount = 0;
|
|
14
14
|
this.blockhashQueue = [];
|
|
@@ -18,6 +18,7 @@ class FastSingleTxSender extends baseTxSender_1.BaseTxSender {
|
|
|
18
18
|
this.timeout = timeout;
|
|
19
19
|
this.blockhashRefreshInterval = blockhashRefreshInterval;
|
|
20
20
|
this.additionalConnections = additionalConnections;
|
|
21
|
+
this.skipConfirmation = skipConfirmation;
|
|
21
22
|
this.startBlockhashRefreshLoop();
|
|
22
23
|
}
|
|
23
24
|
startBlockhashRefreshLoop() {
|
|
@@ -87,13 +88,15 @@ class FastSingleTxSender extends baseTxSender_1.BaseTxSender {
|
|
|
87
88
|
});
|
|
88
89
|
this.sendToAdditionalConnections(rawTransaction, opts);
|
|
89
90
|
let slot;
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
91
|
+
if (!this.skipConfirmation) {
|
|
92
|
+
try {
|
|
93
|
+
const result = await this.confirmTransaction(txid, opts.commitment);
|
|
94
|
+
slot = result.context.slot;
|
|
95
|
+
}
|
|
96
|
+
catch (e) {
|
|
97
|
+
console.error(e);
|
|
98
|
+
throw e;
|
|
99
|
+
}
|
|
97
100
|
}
|
|
98
101
|
return { txSig: txid, slot };
|
|
99
102
|
}
|
package/package.json
CHANGED
|
@@ -27,6 +27,7 @@ export class FastSingleTxSender extends BaseTxSender {
|
|
|
27
27
|
additionalConnections: Connection[];
|
|
28
28
|
timoutCount = 0;
|
|
29
29
|
blockhashQueue: string[] = [];
|
|
30
|
+
skipConfirmation: boolean;
|
|
30
31
|
|
|
31
32
|
public constructor({
|
|
32
33
|
connection,
|
|
@@ -35,6 +36,7 @@ export class FastSingleTxSender extends BaseTxSender {
|
|
|
35
36
|
timeout = DEFAULT_TIMEOUT,
|
|
36
37
|
blockhashRefreshInterval = DEFAULT_BLOCKHASH_REFRESH,
|
|
37
38
|
additionalConnections = new Array<Connection>(),
|
|
39
|
+
skipConfirmation = false,
|
|
38
40
|
}: {
|
|
39
41
|
connection: Connection;
|
|
40
42
|
wallet: IWallet;
|
|
@@ -42,6 +44,7 @@ export class FastSingleTxSender extends BaseTxSender {
|
|
|
42
44
|
timeout?: number;
|
|
43
45
|
blockhashRefreshInterval?: number;
|
|
44
46
|
additionalConnections?;
|
|
47
|
+
skipConfirmation?: boolean;
|
|
45
48
|
}) {
|
|
46
49
|
super({ connection, wallet, opts, timeout, additionalConnections });
|
|
47
50
|
this.connection = connection;
|
|
@@ -50,6 +53,7 @@ export class FastSingleTxSender extends BaseTxSender {
|
|
|
50
53
|
this.timeout = timeout;
|
|
51
54
|
this.blockhashRefreshInterval = blockhashRefreshInterval;
|
|
52
55
|
this.additionalConnections = additionalConnections;
|
|
56
|
+
this.skipConfirmation = skipConfirmation;
|
|
53
57
|
this.startBlockhashRefreshLoop();
|
|
54
58
|
}
|
|
55
59
|
|
|
@@ -144,12 +148,14 @@ export class FastSingleTxSender extends BaseTxSender {
|
|
|
144
148
|
this.sendToAdditionalConnections(rawTransaction, opts);
|
|
145
149
|
|
|
146
150
|
let slot: number;
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
151
|
+
if (!this.skipConfirmation) {
|
|
152
|
+
try {
|
|
153
|
+
const result = await this.confirmTransaction(txid, opts.commitment);
|
|
154
|
+
slot = result.context.slot;
|
|
155
|
+
} catch (e) {
|
|
156
|
+
console.error(e);
|
|
157
|
+
throw e;
|
|
158
|
+
}
|
|
153
159
|
}
|
|
154
160
|
|
|
155
161
|
return { txSig: txid, slot };
|