@drift-labs/sdk 2.82.0-beta.0 → 2.82.0-beta.1

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.82.0-beta.0
1
+ 2.82.0-beta.1
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="node" />
2
3
  import { ConfirmationStrategy, TxSigAndSlot } from './types';
3
4
  import { ConfirmOptions, Signer, Transaction, Connection, VersionedTransaction, TransactionInstruction, AddressLookupTableAccount, Commitment } from '@solana/web3.js';
4
5
  import { IWallet } from '../types';
@@ -14,6 +15,7 @@ export declare class FastSingleTxSender extends BaseTxSender {
14
15
  recentBlockhash: string;
15
16
  skipConfirmation: boolean;
16
17
  blockhashCommitment: Commitment;
18
+ blockhashIntervalId: NodeJS.Timer;
17
19
  constructor({ connection, wallet, opts, timeout, blockhashRefreshInterval, additionalConnections, skipConfirmation, blockhashCommitment, confirmationStrategy, }: {
18
20
  connection: Connection;
19
21
  wallet: IWallet;
@@ -29,14 +29,16 @@ class FastSingleTxSender extends baseTxSender_1.BaseTxSender {
29
29
  this.startBlockhashRefreshLoop();
30
30
  }
31
31
  startBlockhashRefreshLoop() {
32
- setInterval(async () => {
33
- try {
34
- this.recentBlockhash = (await this.connection.getLatestBlockhash(this.blockhashCommitment)).blockhash;
35
- }
36
- catch (e) {
37
- console.error('Error in startBlockhashRefreshLoop: ', e);
38
- }
39
- }, this.blockhashRefreshInterval);
32
+ if (this.blockhashRefreshInterval > 0) {
33
+ this.blockhashIntervalId = setInterval(async () => {
34
+ try {
35
+ this.recentBlockhash = (await this.connection.getLatestBlockhash(this.blockhashCommitment)).blockhash;
36
+ }
37
+ catch (e) {
38
+ console.error('Error in startBlockhashRefreshLoop: ', e);
39
+ }
40
+ }, this.blockhashRefreshInterval);
41
+ }
40
42
  }
41
43
  async prepareTx(tx, additionalSigners, _opts, preSigned) {
42
44
  return super.prepareTx(tx, additionalSigners, _opts, preSigned);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/sdk",
3
- "version": "2.82.0-beta.0",
3
+ "version": "2.82.0-beta.1",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "author": "crispheaney",
@@ -29,6 +29,7 @@ export class FastSingleTxSender extends BaseTxSender {
29
29
  recentBlockhash: string;
30
30
  skipConfirmation: boolean;
31
31
  blockhashCommitment: Commitment;
32
+ blockhashIntervalId: NodeJS.Timer;
32
33
 
33
34
  public constructor({
34
35
  connection,
@@ -71,15 +72,17 @@ export class FastSingleTxSender extends BaseTxSender {
71
72
  }
72
73
 
73
74
  startBlockhashRefreshLoop(): void {
74
- setInterval(async () => {
75
- try {
76
- this.recentBlockhash = (
77
- await this.connection.getLatestBlockhash(this.blockhashCommitment)
78
- ).blockhash;
79
- } catch (e) {
80
- console.error('Error in startBlockhashRefreshLoop: ', e);
81
- }
82
- }, this.blockhashRefreshInterval);
75
+ if (this.blockhashRefreshInterval > 0) {
76
+ this.blockhashIntervalId = setInterval(async () => {
77
+ try {
78
+ this.recentBlockhash = (
79
+ await this.connection.getLatestBlockhash(this.blockhashCommitment)
80
+ ).blockhash;
81
+ } catch (e) {
82
+ console.error('Error in startBlockhashRefreshLoop: ', e);
83
+ }
84
+ }, this.blockhashRefreshInterval);
85
+ }
83
86
  }
84
87
 
85
88
  async prepareTx(