@drift-labs/sdk 2.74.0-beta.3 → 2.74.0-beta.4

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.74.0-beta.3
1
+ 2.74.0-beta.4
@@ -1,9 +1,10 @@
1
- import { BlockhashWithExpiryBlockHeight } from '@solana/web3.js';
1
+ import { BlockhashWithExpiryBlockHeight, Context } from '@solana/web3.js';
2
2
  import { BlockhashSubscriberConfig } from './types';
3
3
  export declare class BlockhashSubscriber {
4
4
  private connection;
5
5
  private isSubscribed;
6
6
  private latestBlockHeight;
7
+ private latestBlockHeightContext;
7
8
  private blockhashes;
8
9
  private updateBlockhashIntervalId;
9
10
  private commitment;
@@ -11,6 +12,7 @@ export declare class BlockhashSubscriber {
11
12
  constructor(config: BlockhashSubscriberConfig);
12
13
  getBlockhashCacheSize(): number;
13
14
  getLatestBlockHeight(): number;
15
+ getLatestBlockHeightContext(): Context | undefined;
14
16
  getLatestBlockhash(offset?: number): BlockhashWithExpiryBlockHeight | undefined;
15
17
  pruneBlockhashes(): void;
16
18
  updateBlockhash(): Promise<void>;
@@ -20,6 +20,9 @@ class BlockhashSubscriber {
20
20
  getLatestBlockHeight() {
21
21
  return this.latestBlockHeight;
22
22
  }
23
+ getLatestBlockHeightContext() {
24
+ return this.latestBlockHeightContext;
25
+ }
23
26
  getLatestBlockhash(offset) {
24
27
  if (this.blockhashes.length === 0) {
25
28
  return undefined;
@@ -40,6 +43,7 @@ class BlockhashSubscriber {
40
43
  this.connection.getBlockHeight({ commitment: this.commitment }),
41
44
  ]);
42
45
  this.latestBlockHeight = lastConfirmedBlockHeight;
46
+ this.latestBlockHeightContext = resp.context;
43
47
  // avoid caching duplicate blockhashes
44
48
  if (this.blockhashes.length > 0) {
45
49
  if (resp.value.blockhash ===
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/sdk",
3
- "version": "2.74.0-beta.3",
3
+ "version": "2.74.0-beta.4",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "author": "crispheaney",
@@ -2,6 +2,7 @@ import {
2
2
  BlockhashWithExpiryBlockHeight,
3
3
  Commitment,
4
4
  Connection,
5
+ Context,
5
6
  } from '@solana/web3.js';
6
7
  import { BlockhashSubscriberConfig } from './types';
7
8
 
@@ -9,6 +10,7 @@ export class BlockhashSubscriber {
9
10
  private connection: Connection;
10
11
  private isSubscribed = false;
11
12
  private latestBlockHeight: number;
13
+ private latestBlockHeightContext: Context | undefined;
12
14
  private blockhashes: Array<BlockhashWithExpiryBlockHeight> = [];
13
15
  private updateBlockhashIntervalId: NodeJS.Timeout | undefined;
14
16
  private commitment: Commitment;
@@ -33,6 +35,10 @@ export class BlockhashSubscriber {
33
35
  return this.latestBlockHeight;
34
36
  }
35
37
 
38
+ getLatestBlockHeightContext(): Context | undefined {
39
+ return this.latestBlockHeightContext;
40
+ }
41
+
36
42
  getLatestBlockhash(
37
43
  offset?: number
38
44
  ): BlockhashWithExpiryBlockHeight | undefined {
@@ -63,6 +69,7 @@ export class BlockhashSubscriber {
63
69
  this.connection.getBlockHeight({ commitment: this.commitment }),
64
70
  ]);
65
71
  this.latestBlockHeight = lastConfirmedBlockHeight;
72
+ this.latestBlockHeightContext = resp.context;
66
73
 
67
74
  // avoid caching duplicate blockhashes
68
75
  if (this.blockhashes.length > 0) {