@drift-labs/sdk 2.97.0-beta.26 → 2.97.0-beta.27
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 +1 -1
- package/lib/browser/tx/baseTxSender.d.ts +3 -1
- package/lib/browser/tx/baseTxSender.js +8 -3
- package/lib/browser/tx/fastSingleTxSender.d.ts +2 -1
- package/lib/browser/tx/fastSingleTxSender.js +2 -1
- package/lib/browser/tx/forwardOnlyTxSender.d.ts +2 -1
- package/lib/browser/tx/forwardOnlyTxSender.js +2 -1
- package/lib/browser/tx/retryTxSender.d.ts +2 -1
- package/lib/browser/tx/retryTxSender.js +2 -1
- package/lib/browser/tx/whileValidTxSender.d.ts +2 -1
- package/lib/browser/tx/whileValidTxSender.js +2 -1
- package/lib/node/tx/baseTxSender.d.ts +3 -1
- package/lib/node/tx/baseTxSender.js +8 -3
- package/lib/node/tx/fastSingleTxSender.d.ts +2 -1
- package/lib/node/tx/fastSingleTxSender.js +2 -1
- package/lib/node/tx/forwardOnlyTxSender.d.ts +2 -1
- package/lib/node/tx/forwardOnlyTxSender.js +2 -1
- package/lib/node/tx/retryTxSender.d.ts +2 -1
- package/lib/node/tx/retryTxSender.js +2 -1
- package/lib/node/tx/whileValidTxSender.d.ts +2 -1
- package/lib/node/tx/whileValidTxSender.js +2 -1
- package/package.json +1 -1
- package/src/tx/baseTxSender.ts +20 -12
- package/src/tx/fastSingleTxSender.ts +3 -0
- package/src/tx/forwardOnlyTxSender.ts +3 -0
- package/src/tx/retryTxSender.ts +3 -0
- package/src/tx/whileValidTxSender.ts +3 -0
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.97.0-beta.
|
|
1
|
+
2.97.0-beta.27
|
|
@@ -16,12 +16,13 @@ export declare abstract class BaseTxSender implements TxSender {
|
|
|
16
16
|
additionalTxSenderCallbacks: ((base58EncodedTx: string) => void)[];
|
|
17
17
|
txHandler: TxHandler;
|
|
18
18
|
trackTxLandRate?: boolean;
|
|
19
|
+
throwOnTimeoutError: boolean;
|
|
19
20
|
lookbackWindowMinutes: number;
|
|
20
21
|
txSigCache?: NodeCache;
|
|
21
22
|
txLandRate: number;
|
|
22
23
|
lastPriorityFeeSuggestion: number;
|
|
23
24
|
landRateToFeeFunc: (landRate: number) => number;
|
|
24
|
-
constructor({ connection, wallet, opts, timeout, additionalConnections, confirmationStrategy, additionalTxSenderCallbacks, trackTxLandRate, txHandler, txLandRateLookbackWindowMinutes, landRateToFeeFunc, }: {
|
|
25
|
+
constructor({ connection, wallet, opts, timeout, additionalConnections, confirmationStrategy, additionalTxSenderCallbacks, trackTxLandRate, txHandler, txLandRateLookbackWindowMinutes, landRateToFeeFunc, throwOnTimeoutError, }: {
|
|
25
26
|
connection: Connection;
|
|
26
27
|
wallet: IWallet;
|
|
27
28
|
opts?: ConfirmOptions;
|
|
@@ -33,6 +34,7 @@ export declare abstract class BaseTxSender implements TxSender {
|
|
|
33
34
|
trackTxLandRate?: boolean;
|
|
34
35
|
txLandRateLookbackWindowMinutes?: number;
|
|
35
36
|
landRateToFeeFunc?: (landRate: number) => number;
|
|
37
|
+
throwOnTimeoutError?: boolean;
|
|
36
38
|
});
|
|
37
39
|
send(tx: Transaction, additionalSigners?: Array<Signer>, opts?: ConfirmOptions, preSigned?: boolean): Promise<TxSigAndSlot>;
|
|
38
40
|
prepareTx(tx: Transaction, additionalSigners: Array<Signer>, opts: ConfirmOptions, preSigned?: boolean): Promise<Transaction>;
|
|
@@ -16,7 +16,7 @@ const BASELINE_TX_LAND_RATE = 0.9;
|
|
|
16
16
|
const DEFAULT_TIMEOUT = 35000;
|
|
17
17
|
const DEFAULT_TX_LAND_RATE_LOOKBACK_WINDOW_MINUTES = 10;
|
|
18
18
|
class BaseTxSender {
|
|
19
|
-
constructor({ connection, wallet, opts = config_1.DEFAULT_CONFIRMATION_OPTS, timeout = DEFAULT_TIMEOUT, additionalConnections = new Array(), confirmationStrategy = types_1.ConfirmationStrategy.Combo, additionalTxSenderCallbacks, trackTxLandRate, txHandler, txLandRateLookbackWindowMinutes = DEFAULT_TX_LAND_RATE_LOOKBACK_WINDOW_MINUTES, landRateToFeeFunc, }) {
|
|
19
|
+
constructor({ connection, wallet, opts = config_1.DEFAULT_CONFIRMATION_OPTS, timeout = DEFAULT_TIMEOUT, additionalConnections = new Array(), confirmationStrategy = types_1.ConfirmationStrategy.Combo, additionalTxSenderCallbacks, trackTxLandRate, txHandler, txLandRateLookbackWindowMinutes = DEFAULT_TX_LAND_RATE_LOOKBACK_WINDOW_MINUTES, landRateToFeeFunc, throwOnTimeoutError = true, }) {
|
|
20
20
|
this.timeoutCount = 0;
|
|
21
21
|
this.txLandRate = 0;
|
|
22
22
|
this.lastPriorityFeeSuggestion = 1;
|
|
@@ -43,6 +43,7 @@ class BaseTxSender {
|
|
|
43
43
|
}
|
|
44
44
|
this.landRateToFeeFunc =
|
|
45
45
|
landRateToFeeFunc !== null && landRateToFeeFunc !== void 0 ? landRateToFeeFunc : this.defaultLandRateToFeeFunc.bind(this);
|
|
46
|
+
this.throwOnTimeoutError = throwOnTimeoutError;
|
|
46
47
|
}
|
|
47
48
|
async send(tx, additionalSigners, opts, preSigned) {
|
|
48
49
|
if (additionalSigners === undefined) {
|
|
@@ -166,7 +167,9 @@ class BaseTxSender {
|
|
|
166
167
|
}
|
|
167
168
|
this.timeoutCount += 1;
|
|
168
169
|
const duration = (Date.now() - start) / 1000;
|
|
169
|
-
|
|
170
|
+
if (this.throwOnTimeoutError) {
|
|
171
|
+
throw new types_1.TxSendError(`Transaction was not confirmed in ${duration.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${signature} using the Solana Explorer or CLI tools.`, txConstants_1.NOT_CONFIRMED_ERROR_CODE);
|
|
172
|
+
}
|
|
170
173
|
}
|
|
171
174
|
return response;
|
|
172
175
|
}
|
|
@@ -192,7 +195,9 @@ class BaseTxSender {
|
|
|
192
195
|
// Transaction not confirmed within 30 seconds
|
|
193
196
|
this.timeoutCount += 1;
|
|
194
197
|
const duration = (Date.now() - start) / 1000;
|
|
195
|
-
|
|
198
|
+
if (this.throwOnTimeoutError) {
|
|
199
|
+
throw new types_1.TxSendError(`Transaction was not confirmed in ${duration.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${signature} using the Solana Explorer or CLI tools.`, txConstants_1.NOT_CONFIRMED_ERROR_CODE);
|
|
200
|
+
}
|
|
196
201
|
}
|
|
197
202
|
async confirmTransaction(signature, commitment) {
|
|
198
203
|
if (this.confirmationStrategy === types_1.ConfirmationStrategy.WebSocket ||
|
|
@@ -19,7 +19,7 @@ export declare class FastSingleTxSender extends BaseTxSender {
|
|
|
19
19
|
confirmInBackground: boolean;
|
|
20
20
|
blockhashCommitment: Commitment;
|
|
21
21
|
blockhashIntervalId: NodeJS.Timer;
|
|
22
|
-
constructor({ connection, wallet, opts, timeout, blockhashRefreshInterval, additionalConnections, skipConfirmation, confirmInBackground, blockhashCommitment, confirmationStrategy, trackTxLandRate, txHandler, txLandRateLookbackWindowMinutes, landRateToFeeFunc, }: {
|
|
22
|
+
constructor({ connection, wallet, opts, timeout, blockhashRefreshInterval, additionalConnections, skipConfirmation, confirmInBackground, blockhashCommitment, confirmationStrategy, trackTxLandRate, txHandler, txLandRateLookbackWindowMinutes, landRateToFeeFunc, throwOnTimeoutError, }: {
|
|
23
23
|
connection: Connection;
|
|
24
24
|
wallet: IWallet;
|
|
25
25
|
opts?: ConfirmOptions;
|
|
@@ -34,6 +34,7 @@ export declare class FastSingleTxSender extends BaseTxSender {
|
|
|
34
34
|
txHandler?: TxHandler;
|
|
35
35
|
txLandRateLookbackWindowMinutes?: number;
|
|
36
36
|
landRateToFeeFunc?: (landRate: number) => number;
|
|
37
|
+
throwOnTimeoutError?: boolean;
|
|
37
38
|
});
|
|
38
39
|
startBlockhashRefreshLoop(): void;
|
|
39
40
|
sendRawTransaction(rawTransaction: Buffer | Uint8Array, opts: ConfirmOptions): Promise<TxSigAndSlot>;
|
|
@@ -7,7 +7,7 @@ const config_1 = require("../config");
|
|
|
7
7
|
const DEFAULT_TIMEOUT = 35000;
|
|
8
8
|
const DEFAULT_BLOCKHASH_REFRESH = 10000;
|
|
9
9
|
class FastSingleTxSender extends baseTxSender_1.BaseTxSender {
|
|
10
|
-
constructor({ connection, wallet, opts = { ...config_1.DEFAULT_CONFIRMATION_OPTS, maxRetries: 0 }, timeout = DEFAULT_TIMEOUT, blockhashRefreshInterval = DEFAULT_BLOCKHASH_REFRESH, additionalConnections = new Array(), skipConfirmation = false, confirmInBackground = false, blockhashCommitment = 'finalized', confirmationStrategy = types_1.ConfirmationStrategy.Combo, trackTxLandRate, txHandler, txLandRateLookbackWindowMinutes, landRateToFeeFunc, }) {
|
|
10
|
+
constructor({ connection, wallet, opts = { ...config_1.DEFAULT_CONFIRMATION_OPTS, maxRetries: 0 }, timeout = DEFAULT_TIMEOUT, blockhashRefreshInterval = DEFAULT_BLOCKHASH_REFRESH, additionalConnections = new Array(), skipConfirmation = false, confirmInBackground = false, blockhashCommitment = 'finalized', confirmationStrategy = types_1.ConfirmationStrategy.Combo, trackTxLandRate, txHandler, txLandRateLookbackWindowMinutes, landRateToFeeFunc, throwOnTimeoutError = true, }) {
|
|
11
11
|
super({
|
|
12
12
|
connection,
|
|
13
13
|
wallet,
|
|
@@ -19,6 +19,7 @@ class FastSingleTxSender extends baseTxSender_1.BaseTxSender {
|
|
|
19
19
|
trackTxLandRate,
|
|
20
20
|
txLandRateLookbackWindowMinutes,
|
|
21
21
|
landRateToFeeFunc,
|
|
22
|
+
throwOnTimeoutError,
|
|
22
23
|
});
|
|
23
24
|
this.timoutCount = 0;
|
|
24
25
|
this.connection = connection;
|
|
@@ -16,7 +16,7 @@ export declare class ForwardOnlyTxSender extends BaseTxSender {
|
|
|
16
16
|
retrySleep: number;
|
|
17
17
|
additionalConnections: Connection[];
|
|
18
18
|
timoutCount: number;
|
|
19
|
-
constructor({ connection, wallet, opts, timeout, retrySleep, confirmationStrategy, additionalTxSenderCallbacks, txHandler, trackTxLandRate, txLandRateLookbackWindowMinutes, landRateToFeeFunc, }: {
|
|
19
|
+
constructor({ connection, wallet, opts, timeout, retrySleep, confirmationStrategy, additionalTxSenderCallbacks, txHandler, trackTxLandRate, txLandRateLookbackWindowMinutes, landRateToFeeFunc, throwOnTimeoutError, }: {
|
|
20
20
|
connection: Connection;
|
|
21
21
|
wallet: IWallet;
|
|
22
22
|
opts?: ConfirmOptions;
|
|
@@ -28,6 +28,7 @@ export declare class ForwardOnlyTxSender extends BaseTxSender {
|
|
|
28
28
|
trackTxLandRate?: boolean;
|
|
29
29
|
txLandRateLookbackWindowMinutes?: number;
|
|
30
30
|
landRateToFeeFunc?: (landRate: number) => number;
|
|
31
|
+
throwOnTimeoutError?: boolean;
|
|
31
32
|
});
|
|
32
33
|
sleep(reference: ResolveReference): Promise<void>;
|
|
33
34
|
sendToAdditionalConnections(rawTx: Buffer | Uint8Array, _opts: ConfirmOptions): void;
|
|
@@ -12,7 +12,7 @@ const config_1 = require("../config");
|
|
|
12
12
|
const DEFAULT_TIMEOUT = 35000;
|
|
13
13
|
const DEFAULT_RETRY = 5000;
|
|
14
14
|
class ForwardOnlyTxSender extends baseTxSender_1.BaseTxSender {
|
|
15
|
-
constructor({ connection, wallet, opts = { ...config_1.DEFAULT_CONFIRMATION_OPTS, maxRetries: 0 }, timeout = DEFAULT_TIMEOUT, retrySleep = DEFAULT_RETRY, confirmationStrategy = types_1.ConfirmationStrategy.Combo, additionalTxSenderCallbacks = [], txHandler, trackTxLandRate, txLandRateLookbackWindowMinutes, landRateToFeeFunc, }) {
|
|
15
|
+
constructor({ connection, wallet, opts = { ...config_1.DEFAULT_CONFIRMATION_OPTS, maxRetries: 0 }, timeout = DEFAULT_TIMEOUT, retrySleep = DEFAULT_RETRY, confirmationStrategy = types_1.ConfirmationStrategy.Combo, additionalTxSenderCallbacks = [], txHandler, trackTxLandRate, txLandRateLookbackWindowMinutes, landRateToFeeFunc, throwOnTimeoutError = true, }) {
|
|
16
16
|
super({
|
|
17
17
|
connection,
|
|
18
18
|
wallet,
|
|
@@ -25,6 +25,7 @@ class ForwardOnlyTxSender extends baseTxSender_1.BaseTxSender {
|
|
|
25
25
|
trackTxLandRate,
|
|
26
26
|
txLandRateLookbackWindowMinutes,
|
|
27
27
|
landRateToFeeFunc,
|
|
28
|
+
throwOnTimeoutError,
|
|
28
29
|
});
|
|
29
30
|
this.timoutCount = 0;
|
|
30
31
|
this.connection = connection;
|
|
@@ -16,7 +16,7 @@ export declare class RetryTxSender extends BaseTxSender {
|
|
|
16
16
|
retrySleep: number;
|
|
17
17
|
additionalConnections: Connection[];
|
|
18
18
|
timoutCount: number;
|
|
19
|
-
constructor({ connection, wallet, opts, timeout, retrySleep, additionalConnections, confirmationStrategy, additionalTxSenderCallbacks, txHandler, trackTxLandRate, txLandRateLookbackWindowMinutes, landRateToFeeFunc, }: {
|
|
19
|
+
constructor({ connection, wallet, opts, timeout, retrySleep, additionalConnections, confirmationStrategy, additionalTxSenderCallbacks, txHandler, trackTxLandRate, txLandRateLookbackWindowMinutes, landRateToFeeFunc, throwOnTimeoutError, }: {
|
|
20
20
|
connection: Connection;
|
|
21
21
|
wallet: IWallet;
|
|
22
22
|
opts?: ConfirmOptions;
|
|
@@ -29,6 +29,7 @@ export declare class RetryTxSender extends BaseTxSender {
|
|
|
29
29
|
trackTxLandRate?: boolean;
|
|
30
30
|
txLandRateLookbackWindowMinutes?: number;
|
|
31
31
|
landRateToFeeFunc?: (landRate: number) => number;
|
|
32
|
+
throwOnTimeoutError?: boolean;
|
|
32
33
|
});
|
|
33
34
|
sleep(reference: ResolveReference): Promise<void>;
|
|
34
35
|
sendRawTransaction(rawTransaction: Buffer | Uint8Array, opts: ConfirmOptions): Promise<TxSigAndSlot>;
|
|
@@ -7,7 +7,7 @@ const config_1 = require("../config");
|
|
|
7
7
|
const DEFAULT_TIMEOUT = 35000;
|
|
8
8
|
const DEFAULT_RETRY = 2000;
|
|
9
9
|
class RetryTxSender extends baseTxSender_1.BaseTxSender {
|
|
10
|
-
constructor({ connection, wallet, opts = { ...config_1.DEFAULT_CONFIRMATION_OPTS, maxRetries: 0 }, timeout = DEFAULT_TIMEOUT, retrySleep = DEFAULT_RETRY, additionalConnections = new Array(), confirmationStrategy = types_1.ConfirmationStrategy.Combo, additionalTxSenderCallbacks = [], txHandler, trackTxLandRate, txLandRateLookbackWindowMinutes, landRateToFeeFunc, }) {
|
|
10
|
+
constructor({ connection, wallet, opts = { ...config_1.DEFAULT_CONFIRMATION_OPTS, maxRetries: 0 }, timeout = DEFAULT_TIMEOUT, retrySleep = DEFAULT_RETRY, additionalConnections = new Array(), confirmationStrategy = types_1.ConfirmationStrategy.Combo, additionalTxSenderCallbacks = [], txHandler, trackTxLandRate, txLandRateLookbackWindowMinutes, landRateToFeeFunc, throwOnTimeoutError = true, }) {
|
|
11
11
|
super({
|
|
12
12
|
connection,
|
|
13
13
|
wallet,
|
|
@@ -20,6 +20,7 @@ class RetryTxSender extends baseTxSender_1.BaseTxSender {
|
|
|
20
20
|
trackTxLandRate,
|
|
21
21
|
txLandRateLookbackWindowMinutes,
|
|
22
22
|
landRateToFeeFunc,
|
|
23
|
+
throwOnTimeoutError,
|
|
23
24
|
});
|
|
24
25
|
this.timoutCount = 0;
|
|
25
26
|
this.connection = connection;
|
|
@@ -22,7 +22,7 @@ export declare class WhileValidTxSender extends BaseTxSender {
|
|
|
22
22
|
}>;
|
|
23
23
|
useBlockHeightOffset: boolean;
|
|
24
24
|
private checkAndSetUseBlockHeightOffset;
|
|
25
|
-
constructor({ connection, wallet, opts, retrySleep, additionalConnections, confirmationStrategy, additionalTxSenderCallbacks, txHandler, trackTxLandRate, txLandRateLookbackWindowMinutes, landRateToFeeFunc, }: {
|
|
25
|
+
constructor({ connection, wallet, opts, retrySleep, additionalConnections, confirmationStrategy, additionalTxSenderCallbacks, txHandler, trackTxLandRate, txLandRateLookbackWindowMinutes, landRateToFeeFunc, throwOnTimeoutError, }: {
|
|
26
26
|
connection: Connection;
|
|
27
27
|
wallet: IWallet;
|
|
28
28
|
opts?: ConfirmOptions;
|
|
@@ -34,6 +34,7 @@ export declare class WhileValidTxSender extends BaseTxSender {
|
|
|
34
34
|
trackTxLandRate?: boolean;
|
|
35
35
|
txLandRateLookbackWindowMinutes?: number;
|
|
36
36
|
landRateToFeeFunc?: (landRate: number) => number;
|
|
37
|
+
throwOnTimeoutError?: boolean;
|
|
37
38
|
});
|
|
38
39
|
sleep(reference: ResolveReference): Promise<void>;
|
|
39
40
|
prepareTx(tx: Transaction, additionalSigners: Array<Signer>, opts: ConfirmOptions, preSigned?: boolean): Promise<Transaction>;
|
|
@@ -30,7 +30,7 @@ class WhileValidTxSender extends baseTxSender_1.BaseTxSender {
|
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
|
-
constructor({ connection, wallet, opts = { ...config_1.DEFAULT_CONFIRMATION_OPTS, maxRetries: 0 }, retrySleep = DEFAULT_RETRY, additionalConnections = new Array(), confirmationStrategy = types_1.ConfirmationStrategy.Combo, additionalTxSenderCallbacks = [], txHandler, trackTxLandRate, txLandRateLookbackWindowMinutes, landRateToFeeFunc, }) {
|
|
33
|
+
constructor({ connection, wallet, opts = { ...config_1.DEFAULT_CONFIRMATION_OPTS, maxRetries: 0 }, retrySleep = DEFAULT_RETRY, additionalConnections = new Array(), confirmationStrategy = types_1.ConfirmationStrategy.Combo, additionalTxSenderCallbacks = [], txHandler, trackTxLandRate, txLandRateLookbackWindowMinutes, landRateToFeeFunc, throwOnTimeoutError = true, }) {
|
|
34
34
|
super({
|
|
35
35
|
connection,
|
|
36
36
|
wallet,
|
|
@@ -42,6 +42,7 @@ class WhileValidTxSender extends baseTxSender_1.BaseTxSender {
|
|
|
42
42
|
txLandRateLookbackWindowMinutes,
|
|
43
43
|
confirmationStrategy,
|
|
44
44
|
landRateToFeeFunc,
|
|
45
|
+
throwOnTimeoutError,
|
|
45
46
|
});
|
|
46
47
|
this.timoutCount = 0;
|
|
47
48
|
this.untilValid = new Map();
|
|
@@ -16,12 +16,13 @@ export declare abstract class BaseTxSender implements TxSender {
|
|
|
16
16
|
additionalTxSenderCallbacks: ((base58EncodedTx: string) => void)[];
|
|
17
17
|
txHandler: TxHandler;
|
|
18
18
|
trackTxLandRate?: boolean;
|
|
19
|
+
throwOnTimeoutError: boolean;
|
|
19
20
|
lookbackWindowMinutes: number;
|
|
20
21
|
txSigCache?: NodeCache;
|
|
21
22
|
txLandRate: number;
|
|
22
23
|
lastPriorityFeeSuggestion: number;
|
|
23
24
|
landRateToFeeFunc: (landRate: number) => number;
|
|
24
|
-
constructor({ connection, wallet, opts, timeout, additionalConnections, confirmationStrategy, additionalTxSenderCallbacks, trackTxLandRate, txHandler, txLandRateLookbackWindowMinutes, landRateToFeeFunc, }: {
|
|
25
|
+
constructor({ connection, wallet, opts, timeout, additionalConnections, confirmationStrategy, additionalTxSenderCallbacks, trackTxLandRate, txHandler, txLandRateLookbackWindowMinutes, landRateToFeeFunc, throwOnTimeoutError, }: {
|
|
25
26
|
connection: Connection;
|
|
26
27
|
wallet: IWallet;
|
|
27
28
|
opts?: ConfirmOptions;
|
|
@@ -33,6 +34,7 @@ export declare abstract class BaseTxSender implements TxSender {
|
|
|
33
34
|
trackTxLandRate?: boolean;
|
|
34
35
|
txLandRateLookbackWindowMinutes?: number;
|
|
35
36
|
landRateToFeeFunc?: (landRate: number) => number;
|
|
37
|
+
throwOnTimeoutError?: boolean;
|
|
36
38
|
});
|
|
37
39
|
send(tx: Transaction, additionalSigners?: Array<Signer>, opts?: ConfirmOptions, preSigned?: boolean): Promise<TxSigAndSlot>;
|
|
38
40
|
prepareTx(tx: Transaction, additionalSigners: Array<Signer>, opts: ConfirmOptions, preSigned?: boolean): Promise<Transaction>;
|
|
@@ -16,7 +16,7 @@ const BASELINE_TX_LAND_RATE = 0.9;
|
|
|
16
16
|
const DEFAULT_TIMEOUT = 35000;
|
|
17
17
|
const DEFAULT_TX_LAND_RATE_LOOKBACK_WINDOW_MINUTES = 10;
|
|
18
18
|
class BaseTxSender {
|
|
19
|
-
constructor({ connection, wallet, opts = config_1.DEFAULT_CONFIRMATION_OPTS, timeout = DEFAULT_TIMEOUT, additionalConnections = new Array(), confirmationStrategy = types_1.ConfirmationStrategy.Combo, additionalTxSenderCallbacks, trackTxLandRate, txHandler, txLandRateLookbackWindowMinutes = DEFAULT_TX_LAND_RATE_LOOKBACK_WINDOW_MINUTES, landRateToFeeFunc, }) {
|
|
19
|
+
constructor({ connection, wallet, opts = config_1.DEFAULT_CONFIRMATION_OPTS, timeout = DEFAULT_TIMEOUT, additionalConnections = new Array(), confirmationStrategy = types_1.ConfirmationStrategy.Combo, additionalTxSenderCallbacks, trackTxLandRate, txHandler, txLandRateLookbackWindowMinutes = DEFAULT_TX_LAND_RATE_LOOKBACK_WINDOW_MINUTES, landRateToFeeFunc, throwOnTimeoutError = true, }) {
|
|
20
20
|
this.timeoutCount = 0;
|
|
21
21
|
this.txLandRate = 0;
|
|
22
22
|
this.lastPriorityFeeSuggestion = 1;
|
|
@@ -43,6 +43,7 @@ class BaseTxSender {
|
|
|
43
43
|
}
|
|
44
44
|
this.landRateToFeeFunc =
|
|
45
45
|
landRateToFeeFunc !== null && landRateToFeeFunc !== void 0 ? landRateToFeeFunc : this.defaultLandRateToFeeFunc.bind(this);
|
|
46
|
+
this.throwOnTimeoutError = throwOnTimeoutError;
|
|
46
47
|
}
|
|
47
48
|
async send(tx, additionalSigners, opts, preSigned) {
|
|
48
49
|
if (additionalSigners === undefined) {
|
|
@@ -166,7 +167,9 @@ class BaseTxSender {
|
|
|
166
167
|
}
|
|
167
168
|
this.timeoutCount += 1;
|
|
168
169
|
const duration = (Date.now() - start) / 1000;
|
|
169
|
-
|
|
170
|
+
if (this.throwOnTimeoutError) {
|
|
171
|
+
throw new types_1.TxSendError(`Transaction was not confirmed in ${duration.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${signature} using the Solana Explorer or CLI tools.`, txConstants_1.NOT_CONFIRMED_ERROR_CODE);
|
|
172
|
+
}
|
|
170
173
|
}
|
|
171
174
|
return response;
|
|
172
175
|
}
|
|
@@ -192,7 +195,9 @@ class BaseTxSender {
|
|
|
192
195
|
// Transaction not confirmed within 30 seconds
|
|
193
196
|
this.timeoutCount += 1;
|
|
194
197
|
const duration = (Date.now() - start) / 1000;
|
|
195
|
-
|
|
198
|
+
if (this.throwOnTimeoutError) {
|
|
199
|
+
throw new types_1.TxSendError(`Transaction was not confirmed in ${duration.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${signature} using the Solana Explorer or CLI tools.`, txConstants_1.NOT_CONFIRMED_ERROR_CODE);
|
|
200
|
+
}
|
|
196
201
|
}
|
|
197
202
|
async confirmTransaction(signature, commitment) {
|
|
198
203
|
if (this.confirmationStrategy === types_1.ConfirmationStrategy.WebSocket ||
|
|
@@ -19,7 +19,7 @@ export declare class FastSingleTxSender extends BaseTxSender {
|
|
|
19
19
|
confirmInBackground: boolean;
|
|
20
20
|
blockhashCommitment: Commitment;
|
|
21
21
|
blockhashIntervalId: NodeJS.Timer;
|
|
22
|
-
constructor({ connection, wallet, opts, timeout, blockhashRefreshInterval, additionalConnections, skipConfirmation, confirmInBackground, blockhashCommitment, confirmationStrategy, trackTxLandRate, txHandler, txLandRateLookbackWindowMinutes, landRateToFeeFunc, }: {
|
|
22
|
+
constructor({ connection, wallet, opts, timeout, blockhashRefreshInterval, additionalConnections, skipConfirmation, confirmInBackground, blockhashCommitment, confirmationStrategy, trackTxLandRate, txHandler, txLandRateLookbackWindowMinutes, landRateToFeeFunc, throwOnTimeoutError, }: {
|
|
23
23
|
connection: Connection;
|
|
24
24
|
wallet: IWallet;
|
|
25
25
|
opts?: ConfirmOptions;
|
|
@@ -34,6 +34,7 @@ export declare class FastSingleTxSender extends BaseTxSender {
|
|
|
34
34
|
txHandler?: TxHandler;
|
|
35
35
|
txLandRateLookbackWindowMinutes?: number;
|
|
36
36
|
landRateToFeeFunc?: (landRate: number) => number;
|
|
37
|
+
throwOnTimeoutError?: boolean;
|
|
37
38
|
});
|
|
38
39
|
startBlockhashRefreshLoop(): void;
|
|
39
40
|
sendRawTransaction(rawTransaction: Buffer | Uint8Array, opts: ConfirmOptions): Promise<TxSigAndSlot>;
|
|
@@ -7,7 +7,7 @@ const config_1 = require("../config");
|
|
|
7
7
|
const DEFAULT_TIMEOUT = 35000;
|
|
8
8
|
const DEFAULT_BLOCKHASH_REFRESH = 10000;
|
|
9
9
|
class FastSingleTxSender extends baseTxSender_1.BaseTxSender {
|
|
10
|
-
constructor({ connection, wallet, opts = { ...config_1.DEFAULT_CONFIRMATION_OPTS, maxRetries: 0 }, timeout = DEFAULT_TIMEOUT, blockhashRefreshInterval = DEFAULT_BLOCKHASH_REFRESH, additionalConnections = new Array(), skipConfirmation = false, confirmInBackground = false, blockhashCommitment = 'finalized', confirmationStrategy = types_1.ConfirmationStrategy.Combo, trackTxLandRate, txHandler, txLandRateLookbackWindowMinutes, landRateToFeeFunc, }) {
|
|
10
|
+
constructor({ connection, wallet, opts = { ...config_1.DEFAULT_CONFIRMATION_OPTS, maxRetries: 0 }, timeout = DEFAULT_TIMEOUT, blockhashRefreshInterval = DEFAULT_BLOCKHASH_REFRESH, additionalConnections = new Array(), skipConfirmation = false, confirmInBackground = false, blockhashCommitment = 'finalized', confirmationStrategy = types_1.ConfirmationStrategy.Combo, trackTxLandRate, txHandler, txLandRateLookbackWindowMinutes, landRateToFeeFunc, throwOnTimeoutError = true, }) {
|
|
11
11
|
super({
|
|
12
12
|
connection,
|
|
13
13
|
wallet,
|
|
@@ -19,6 +19,7 @@ class FastSingleTxSender extends baseTxSender_1.BaseTxSender {
|
|
|
19
19
|
trackTxLandRate,
|
|
20
20
|
txLandRateLookbackWindowMinutes,
|
|
21
21
|
landRateToFeeFunc,
|
|
22
|
+
throwOnTimeoutError,
|
|
22
23
|
});
|
|
23
24
|
this.timoutCount = 0;
|
|
24
25
|
this.connection = connection;
|
|
@@ -16,7 +16,7 @@ export declare class ForwardOnlyTxSender extends BaseTxSender {
|
|
|
16
16
|
retrySleep: number;
|
|
17
17
|
additionalConnections: Connection[];
|
|
18
18
|
timoutCount: number;
|
|
19
|
-
constructor({ connection, wallet, opts, timeout, retrySleep, confirmationStrategy, additionalTxSenderCallbacks, txHandler, trackTxLandRate, txLandRateLookbackWindowMinutes, landRateToFeeFunc, }: {
|
|
19
|
+
constructor({ connection, wallet, opts, timeout, retrySleep, confirmationStrategy, additionalTxSenderCallbacks, txHandler, trackTxLandRate, txLandRateLookbackWindowMinutes, landRateToFeeFunc, throwOnTimeoutError, }: {
|
|
20
20
|
connection: Connection;
|
|
21
21
|
wallet: IWallet;
|
|
22
22
|
opts?: ConfirmOptions;
|
|
@@ -28,6 +28,7 @@ export declare class ForwardOnlyTxSender extends BaseTxSender {
|
|
|
28
28
|
trackTxLandRate?: boolean;
|
|
29
29
|
txLandRateLookbackWindowMinutes?: number;
|
|
30
30
|
landRateToFeeFunc?: (landRate: number) => number;
|
|
31
|
+
throwOnTimeoutError?: boolean;
|
|
31
32
|
});
|
|
32
33
|
sleep(reference: ResolveReference): Promise<void>;
|
|
33
34
|
sendToAdditionalConnections(rawTx: Buffer | Uint8Array, _opts: ConfirmOptions): void;
|
|
@@ -12,7 +12,7 @@ const config_1 = require("../config");
|
|
|
12
12
|
const DEFAULT_TIMEOUT = 35000;
|
|
13
13
|
const DEFAULT_RETRY = 5000;
|
|
14
14
|
class ForwardOnlyTxSender extends baseTxSender_1.BaseTxSender {
|
|
15
|
-
constructor({ connection, wallet, opts = { ...config_1.DEFAULT_CONFIRMATION_OPTS, maxRetries: 0 }, timeout = DEFAULT_TIMEOUT, retrySleep = DEFAULT_RETRY, confirmationStrategy = types_1.ConfirmationStrategy.Combo, additionalTxSenderCallbacks = [], txHandler, trackTxLandRate, txLandRateLookbackWindowMinutes, landRateToFeeFunc, }) {
|
|
15
|
+
constructor({ connection, wallet, opts = { ...config_1.DEFAULT_CONFIRMATION_OPTS, maxRetries: 0 }, timeout = DEFAULT_TIMEOUT, retrySleep = DEFAULT_RETRY, confirmationStrategy = types_1.ConfirmationStrategy.Combo, additionalTxSenderCallbacks = [], txHandler, trackTxLandRate, txLandRateLookbackWindowMinutes, landRateToFeeFunc, throwOnTimeoutError = true, }) {
|
|
16
16
|
super({
|
|
17
17
|
connection,
|
|
18
18
|
wallet,
|
|
@@ -25,6 +25,7 @@ class ForwardOnlyTxSender extends baseTxSender_1.BaseTxSender {
|
|
|
25
25
|
trackTxLandRate,
|
|
26
26
|
txLandRateLookbackWindowMinutes,
|
|
27
27
|
landRateToFeeFunc,
|
|
28
|
+
throwOnTimeoutError,
|
|
28
29
|
});
|
|
29
30
|
this.timoutCount = 0;
|
|
30
31
|
this.connection = connection;
|
|
@@ -16,7 +16,7 @@ export declare class RetryTxSender extends BaseTxSender {
|
|
|
16
16
|
retrySleep: number;
|
|
17
17
|
additionalConnections: Connection[];
|
|
18
18
|
timoutCount: number;
|
|
19
|
-
constructor({ connection, wallet, opts, timeout, retrySleep, additionalConnections, confirmationStrategy, additionalTxSenderCallbacks, txHandler, trackTxLandRate, txLandRateLookbackWindowMinutes, landRateToFeeFunc, }: {
|
|
19
|
+
constructor({ connection, wallet, opts, timeout, retrySleep, additionalConnections, confirmationStrategy, additionalTxSenderCallbacks, txHandler, trackTxLandRate, txLandRateLookbackWindowMinutes, landRateToFeeFunc, throwOnTimeoutError, }: {
|
|
20
20
|
connection: Connection;
|
|
21
21
|
wallet: IWallet;
|
|
22
22
|
opts?: ConfirmOptions;
|
|
@@ -29,6 +29,7 @@ export declare class RetryTxSender extends BaseTxSender {
|
|
|
29
29
|
trackTxLandRate?: boolean;
|
|
30
30
|
txLandRateLookbackWindowMinutes?: number;
|
|
31
31
|
landRateToFeeFunc?: (landRate: number) => number;
|
|
32
|
+
throwOnTimeoutError?: boolean;
|
|
32
33
|
});
|
|
33
34
|
sleep(reference: ResolveReference): Promise<void>;
|
|
34
35
|
sendRawTransaction(rawTransaction: Buffer | Uint8Array, opts: ConfirmOptions): Promise<TxSigAndSlot>;
|
|
@@ -7,7 +7,7 @@ const config_1 = require("../config");
|
|
|
7
7
|
const DEFAULT_TIMEOUT = 35000;
|
|
8
8
|
const DEFAULT_RETRY = 2000;
|
|
9
9
|
class RetryTxSender extends baseTxSender_1.BaseTxSender {
|
|
10
|
-
constructor({ connection, wallet, opts = { ...config_1.DEFAULT_CONFIRMATION_OPTS, maxRetries: 0 }, timeout = DEFAULT_TIMEOUT, retrySleep = DEFAULT_RETRY, additionalConnections = new Array(), confirmationStrategy = types_1.ConfirmationStrategy.Combo, additionalTxSenderCallbacks = [], txHandler, trackTxLandRate, txLandRateLookbackWindowMinutes, landRateToFeeFunc, }) {
|
|
10
|
+
constructor({ connection, wallet, opts = { ...config_1.DEFAULT_CONFIRMATION_OPTS, maxRetries: 0 }, timeout = DEFAULT_TIMEOUT, retrySleep = DEFAULT_RETRY, additionalConnections = new Array(), confirmationStrategy = types_1.ConfirmationStrategy.Combo, additionalTxSenderCallbacks = [], txHandler, trackTxLandRate, txLandRateLookbackWindowMinutes, landRateToFeeFunc, throwOnTimeoutError = true, }) {
|
|
11
11
|
super({
|
|
12
12
|
connection,
|
|
13
13
|
wallet,
|
|
@@ -20,6 +20,7 @@ class RetryTxSender extends baseTxSender_1.BaseTxSender {
|
|
|
20
20
|
trackTxLandRate,
|
|
21
21
|
txLandRateLookbackWindowMinutes,
|
|
22
22
|
landRateToFeeFunc,
|
|
23
|
+
throwOnTimeoutError,
|
|
23
24
|
});
|
|
24
25
|
this.timoutCount = 0;
|
|
25
26
|
this.connection = connection;
|
|
@@ -22,7 +22,7 @@ export declare class WhileValidTxSender extends BaseTxSender {
|
|
|
22
22
|
}>;
|
|
23
23
|
useBlockHeightOffset: boolean;
|
|
24
24
|
private checkAndSetUseBlockHeightOffset;
|
|
25
|
-
constructor({ connection, wallet, opts, retrySleep, additionalConnections, confirmationStrategy, additionalTxSenderCallbacks, txHandler, trackTxLandRate, txLandRateLookbackWindowMinutes, landRateToFeeFunc, }: {
|
|
25
|
+
constructor({ connection, wallet, opts, retrySleep, additionalConnections, confirmationStrategy, additionalTxSenderCallbacks, txHandler, trackTxLandRate, txLandRateLookbackWindowMinutes, landRateToFeeFunc, throwOnTimeoutError, }: {
|
|
26
26
|
connection: Connection;
|
|
27
27
|
wallet: IWallet;
|
|
28
28
|
opts?: ConfirmOptions;
|
|
@@ -34,6 +34,7 @@ export declare class WhileValidTxSender extends BaseTxSender {
|
|
|
34
34
|
trackTxLandRate?: boolean;
|
|
35
35
|
txLandRateLookbackWindowMinutes?: number;
|
|
36
36
|
landRateToFeeFunc?: (landRate: number) => number;
|
|
37
|
+
throwOnTimeoutError?: boolean;
|
|
37
38
|
});
|
|
38
39
|
sleep(reference: ResolveReference): Promise<void>;
|
|
39
40
|
prepareTx(tx: Transaction, additionalSigners: Array<Signer>, opts: ConfirmOptions, preSigned?: boolean): Promise<Transaction>;
|
|
@@ -30,7 +30,7 @@ class WhileValidTxSender extends baseTxSender_1.BaseTxSender {
|
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
|
-
constructor({ connection, wallet, opts = { ...config_1.DEFAULT_CONFIRMATION_OPTS, maxRetries: 0 }, retrySleep = DEFAULT_RETRY, additionalConnections = new Array(), confirmationStrategy = types_1.ConfirmationStrategy.Combo, additionalTxSenderCallbacks = [], txHandler, trackTxLandRate, txLandRateLookbackWindowMinutes, landRateToFeeFunc, }) {
|
|
33
|
+
constructor({ connection, wallet, opts = { ...config_1.DEFAULT_CONFIRMATION_OPTS, maxRetries: 0 }, retrySleep = DEFAULT_RETRY, additionalConnections = new Array(), confirmationStrategy = types_1.ConfirmationStrategy.Combo, additionalTxSenderCallbacks = [], txHandler, trackTxLandRate, txLandRateLookbackWindowMinutes, landRateToFeeFunc, throwOnTimeoutError = true, }) {
|
|
34
34
|
super({
|
|
35
35
|
connection,
|
|
36
36
|
wallet,
|
|
@@ -42,6 +42,7 @@ class WhileValidTxSender extends baseTxSender_1.BaseTxSender {
|
|
|
42
42
|
txLandRateLookbackWindowMinutes,
|
|
43
43
|
confirmationStrategy,
|
|
44
44
|
landRateToFeeFunc,
|
|
45
|
+
throwOnTimeoutError,
|
|
45
46
|
});
|
|
46
47
|
this.timoutCount = 0;
|
|
47
48
|
this.untilValid = new Map();
|
package/package.json
CHANGED
package/src/tx/baseTxSender.ts
CHANGED
|
@@ -43,6 +43,7 @@ export abstract class BaseTxSender implements TxSender {
|
|
|
43
43
|
additionalTxSenderCallbacks: ((base58EncodedTx: string) => void)[];
|
|
44
44
|
txHandler: TxHandler;
|
|
45
45
|
trackTxLandRate?: boolean;
|
|
46
|
+
throwOnTimeoutError: boolean;
|
|
46
47
|
|
|
47
48
|
// For landing rate calcs
|
|
48
49
|
lookbackWindowMinutes: number;
|
|
@@ -63,6 +64,7 @@ export abstract class BaseTxSender implements TxSender {
|
|
|
63
64
|
txHandler,
|
|
64
65
|
txLandRateLookbackWindowMinutes = DEFAULT_TX_LAND_RATE_LOOKBACK_WINDOW_MINUTES,
|
|
65
66
|
landRateToFeeFunc,
|
|
67
|
+
throwOnTimeoutError = true,
|
|
66
68
|
}: {
|
|
67
69
|
connection: Connection;
|
|
68
70
|
wallet: IWallet;
|
|
@@ -75,6 +77,7 @@ export abstract class BaseTxSender implements TxSender {
|
|
|
75
77
|
trackTxLandRate?: boolean;
|
|
76
78
|
txLandRateLookbackWindowMinutes?: number;
|
|
77
79
|
landRateToFeeFunc?: (landRate: number) => number;
|
|
80
|
+
throwOnTimeoutError?: boolean;
|
|
78
81
|
}) {
|
|
79
82
|
this.connection = connection;
|
|
80
83
|
this.wallet = wallet;
|
|
@@ -100,6 +103,7 @@ export abstract class BaseTxSender implements TxSender {
|
|
|
100
103
|
}
|
|
101
104
|
this.landRateToFeeFunc =
|
|
102
105
|
landRateToFeeFunc ?? this.defaultLandRateToFeeFunc.bind(this);
|
|
106
|
+
this.throwOnTimeoutError = throwOnTimeoutError;
|
|
103
107
|
}
|
|
104
108
|
|
|
105
109
|
async send(
|
|
@@ -283,12 +287,14 @@ export abstract class BaseTxSender implements TxSender {
|
|
|
283
287
|
}
|
|
284
288
|
this.timeoutCount += 1;
|
|
285
289
|
const duration = (Date.now() - start) / 1000;
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
290
|
+
if (this.throwOnTimeoutError) {
|
|
291
|
+
throw new TxSendError(
|
|
292
|
+
`Transaction was not confirmed in ${duration.toFixed(
|
|
293
|
+
2
|
|
294
|
+
)} seconds. It is unknown if it succeeded or failed. Check signature ${signature} using the Solana Explorer or CLI tools.`,
|
|
295
|
+
NOT_CONFIRMED_ERROR_CODE
|
|
296
|
+
);
|
|
297
|
+
}
|
|
292
298
|
}
|
|
293
299
|
|
|
294
300
|
return response;
|
|
@@ -326,12 +332,14 @@ export abstract class BaseTxSender implements TxSender {
|
|
|
326
332
|
// Transaction not confirmed within 30 seconds
|
|
327
333
|
this.timeoutCount += 1;
|
|
328
334
|
const duration = (Date.now() - start) / 1000;
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
+
if (this.throwOnTimeoutError) {
|
|
336
|
+
throw new TxSendError(
|
|
337
|
+
`Transaction was not confirmed in ${duration.toFixed(
|
|
338
|
+
2
|
|
339
|
+
)} seconds. It is unknown if it succeeded or failed. Check signature ${signature} using the Solana Explorer or CLI tools.`,
|
|
340
|
+
NOT_CONFIRMED_ERROR_CODE
|
|
341
|
+
);
|
|
342
|
+
}
|
|
335
343
|
}
|
|
336
344
|
|
|
337
345
|
async confirmTransaction(
|
|
@@ -43,6 +43,7 @@ export class FastSingleTxSender extends BaseTxSender {
|
|
|
43
43
|
txHandler,
|
|
44
44
|
txLandRateLookbackWindowMinutes,
|
|
45
45
|
landRateToFeeFunc,
|
|
46
|
+
throwOnTimeoutError = true,
|
|
46
47
|
}: {
|
|
47
48
|
connection: Connection;
|
|
48
49
|
wallet: IWallet;
|
|
@@ -58,6 +59,7 @@ export class FastSingleTxSender extends BaseTxSender {
|
|
|
58
59
|
txHandler?: TxHandler;
|
|
59
60
|
txLandRateLookbackWindowMinutes?: number;
|
|
60
61
|
landRateToFeeFunc?: (landRate: number) => number;
|
|
62
|
+
throwOnTimeoutError?: boolean;
|
|
61
63
|
}) {
|
|
62
64
|
super({
|
|
63
65
|
connection,
|
|
@@ -70,6 +72,7 @@ export class FastSingleTxSender extends BaseTxSender {
|
|
|
70
72
|
trackTxLandRate,
|
|
71
73
|
txLandRateLookbackWindowMinutes,
|
|
72
74
|
landRateToFeeFunc,
|
|
75
|
+
throwOnTimeoutError,
|
|
73
76
|
});
|
|
74
77
|
this.connection = connection;
|
|
75
78
|
this.wallet = wallet;
|
|
@@ -38,6 +38,7 @@ export class ForwardOnlyTxSender extends BaseTxSender {
|
|
|
38
38
|
trackTxLandRate,
|
|
39
39
|
txLandRateLookbackWindowMinutes,
|
|
40
40
|
landRateToFeeFunc,
|
|
41
|
+
throwOnTimeoutError = true,
|
|
41
42
|
}: {
|
|
42
43
|
connection: Connection;
|
|
43
44
|
wallet: IWallet;
|
|
@@ -50,6 +51,7 @@ export class ForwardOnlyTxSender extends BaseTxSender {
|
|
|
50
51
|
trackTxLandRate?: boolean;
|
|
51
52
|
txLandRateLookbackWindowMinutes?: number;
|
|
52
53
|
landRateToFeeFunc?: (landRate: number) => number;
|
|
54
|
+
throwOnTimeoutError?: boolean;
|
|
53
55
|
}) {
|
|
54
56
|
super({
|
|
55
57
|
connection,
|
|
@@ -63,6 +65,7 @@ export class ForwardOnlyTxSender extends BaseTxSender {
|
|
|
63
65
|
trackTxLandRate,
|
|
64
66
|
txLandRateLookbackWindowMinutes,
|
|
65
67
|
landRateToFeeFunc,
|
|
68
|
+
throwOnTimeoutError,
|
|
66
69
|
});
|
|
67
70
|
this.connection = connection;
|
|
68
71
|
this.wallet = wallet;
|
package/src/tx/retryTxSender.ts
CHANGED
|
@@ -34,6 +34,7 @@ export class RetryTxSender extends BaseTxSender {
|
|
|
34
34
|
trackTxLandRate,
|
|
35
35
|
txLandRateLookbackWindowMinutes,
|
|
36
36
|
landRateToFeeFunc,
|
|
37
|
+
throwOnTimeoutError = true,
|
|
37
38
|
}: {
|
|
38
39
|
connection: Connection;
|
|
39
40
|
wallet: IWallet;
|
|
@@ -47,6 +48,7 @@ export class RetryTxSender extends BaseTxSender {
|
|
|
47
48
|
trackTxLandRate?: boolean;
|
|
48
49
|
txLandRateLookbackWindowMinutes?: number;
|
|
49
50
|
landRateToFeeFunc?: (landRate: number) => number;
|
|
51
|
+
throwOnTimeoutError?: boolean;
|
|
50
52
|
}) {
|
|
51
53
|
super({
|
|
52
54
|
connection,
|
|
@@ -60,6 +62,7 @@ export class RetryTxSender extends BaseTxSender {
|
|
|
60
62
|
trackTxLandRate,
|
|
61
63
|
txLandRateLookbackWindowMinutes,
|
|
62
64
|
landRateToFeeFunc,
|
|
65
|
+
throwOnTimeoutError,
|
|
63
66
|
});
|
|
64
67
|
this.connection = connection;
|
|
65
68
|
this.wallet = wallet;
|
|
@@ -68,6 +68,7 @@ export class WhileValidTxSender extends BaseTxSender {
|
|
|
68
68
|
trackTxLandRate,
|
|
69
69
|
txLandRateLookbackWindowMinutes,
|
|
70
70
|
landRateToFeeFunc,
|
|
71
|
+
throwOnTimeoutError = true,
|
|
71
72
|
}: {
|
|
72
73
|
connection: Connection;
|
|
73
74
|
wallet: IWallet;
|
|
@@ -80,6 +81,7 @@ export class WhileValidTxSender extends BaseTxSender {
|
|
|
80
81
|
trackTxLandRate?: boolean;
|
|
81
82
|
txLandRateLookbackWindowMinutes?: number;
|
|
82
83
|
landRateToFeeFunc?: (landRate: number) => number;
|
|
84
|
+
throwOnTimeoutError?: boolean;
|
|
83
85
|
}) {
|
|
84
86
|
super({
|
|
85
87
|
connection,
|
|
@@ -92,6 +94,7 @@ export class WhileValidTxSender extends BaseTxSender {
|
|
|
92
94
|
txLandRateLookbackWindowMinutes,
|
|
93
95
|
confirmationStrategy,
|
|
94
96
|
landRateToFeeFunc,
|
|
97
|
+
throwOnTimeoutError,
|
|
95
98
|
});
|
|
96
99
|
this.retrySleep = retrySleep;
|
|
97
100
|
|