@drift-labs/sdk 2.91.0-beta.6 → 2.91.0-beta.7

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.91.0-beta.6
1
+ 2.91.0-beta.7
@@ -71,4 +71,4 @@ exports.IDLE_TIME_SLOTS = 9000;
71
71
  exports.SLOT_TIME_ESTIMATE_MS = 400;
72
72
  exports.DUST_POSITION_SIZE = exports.QUOTE_PRECISION.divn(100); // Dust position is any position smaller than 1c
73
73
  exports.FUEL_WINDOW = new __1.BN(60 * 60 * 24 * 28); // 28 days
74
- exports.FUEL_START_TS = new __1.BN(1723075200); // unix timestamp
74
+ exports.FUEL_START_TS = new __1.BN(1723147200); // unix timestamp
@@ -175,6 +175,7 @@ exports.MainnetSpotMarkets = [
175
175
  precisionExp: numericConstants_1.SIX,
176
176
  serumMarket: new web3_js_1.PublicKey('2BtDHBTCTUxvdur498ZEcMgimasaFrY5GzLv8wS8XgCb'),
177
177
  phoenixMarket: new web3_js_1.PublicKey('6ojSigXF7nDPyhFRgmn3V9ywhYseKF9J32ZrranMGVSX'),
178
+ openbookMarket: new web3_js_1.PublicKey('CwGmEwYFo7u5D7vghGwtcCbRToWosytaZa3Ys3JAto6J'),
178
179
  pythFeedId: '0x4ca4beeca86f0d164160323817a4e42b10010a724c2217c6ee41b54cd4cc61fc',
179
180
  },
180
181
  {
@@ -51,14 +51,16 @@ class OpenbookV2Subscriber {
51
51
  this.subscribed = true;
52
52
  }
53
53
  getBestBid() {
54
- const bestBid = this.market.bids.best();
54
+ var _a;
55
+ const bestBid = (_a = this.market.bids) === null || _a === void 0 ? void 0 : _a.best();
55
56
  if (bestBid === undefined) {
56
57
  return undefined;
57
58
  }
58
59
  return new anchor_1.BN(Math.floor(bestBid.price * numericConstants_1.PRICE_PRECISION.toNumber()));
59
60
  }
60
61
  getBestAsk() {
61
- const bestAsk = this.market.asks.best();
62
+ var _a;
63
+ const bestAsk = (_a = this.market.asks) === null || _a === void 0 ? void 0 : _a.best();
62
64
  if (bestAsk === undefined) {
63
65
  return undefined;
64
66
  }
@@ -74,7 +76,7 @@ class OpenbookV2Subscriber {
74
76
  const basePrecision = Math.ceil(1 / this.market.baseNativeFactor.toNumber());
75
77
  const pricePrecision = numericConstants_1.PRICE_PRECISION.toNumber();
76
78
  const levels = side === 'bids' ? this.market.bids : this.market.asks;
77
- for (const order of levels.items()) {
79
+ for (const order of levels === null || levels === void 0 ? void 0 : levels.items()) {
78
80
  const size = new anchor_1.BN(order.size * basePrecision);
79
81
  const price = new anchor_1.BN(order.price * pricePrecision);
80
82
  yield {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/sdk",
3
- "version": "2.91.0-beta.6",
3
+ "version": "2.91.0-beta.7",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "author": "crispheaney",
@@ -108,4 +108,4 @@ export const SLOT_TIME_ESTIMATE_MS = 400;
108
108
  export const DUST_POSITION_SIZE = QUOTE_PRECISION.divn(100); // Dust position is any position smaller than 1c
109
109
 
110
110
  export const FUEL_WINDOW = new BN(60 * 60 * 24 * 28); // 28 days
111
- export const FUEL_START_TS = new BN(1723075200); // unix timestamp
111
+ export const FUEL_START_TS = new BN(1723147200); // unix timestamp
@@ -228,6 +228,9 @@ export const MainnetSpotMarkets: SpotMarketConfig[] = [
228
228
  phoenixMarket: new PublicKey(
229
229
  '6ojSigXF7nDPyhFRgmn3V9ywhYseKF9J32ZrranMGVSX'
230
230
  ),
231
+ openbookMarket: new PublicKey(
232
+ 'CwGmEwYFo7u5D7vghGwtcCbRToWosytaZa3Ys3JAto6J'
233
+ ),
231
234
  pythFeedId:
232
235
  '0x4ca4beeca86f0d164160323817a4e42b10010a724c2217c6ee41b54cd4cc61fc',
233
236
  },
@@ -96,7 +96,7 @@ export class OpenbookV2Subscriber implements L2OrderBookGenerator {
96
96
  }
97
97
 
98
98
  public getBestBid(): BN | undefined {
99
- const bestBid = this.market.bids.best();
99
+ const bestBid = this.market.bids?.best();
100
100
 
101
101
  if (bestBid === undefined) {
102
102
  return undefined;
@@ -106,7 +106,7 @@ export class OpenbookV2Subscriber implements L2OrderBookGenerator {
106
106
  }
107
107
 
108
108
  public getBestAsk(): BN | undefined {
109
- const bestAsk = this.market.asks.best();
109
+ const bestAsk = this.market.asks?.best();
110
110
 
111
111
  if (bestAsk === undefined) {
112
112
  return undefined;
@@ -131,7 +131,7 @@ export class OpenbookV2Subscriber implements L2OrderBookGenerator {
131
131
 
132
132
  const levels = side === 'bids' ? this.market.bids : this.market.asks;
133
133
 
134
- for (const order of levels.items()) {
134
+ for (const order of levels?.items()) {
135
135
  const size = new BN(order.size * basePrecision);
136
136
  const price = new BN(order.price * pricePrecision);
137
137
  yield {