@drift-labs/sdk 2.91.0-beta.5 → 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 +1 -1
- package/lib/constants/numericConstants.js +1 -1
- package/lib/constants/spotMarkets.js +2 -1
- package/lib/openbook/openbookV2Subscriber.js +5 -3
- package/package.json +1 -1
- package/src/constants/numericConstants.ts +1 -1
- package/src/constants/spotMarkets.ts +4 -1
- package/src/openbook/openbookV2Subscriber.ts +3 -3
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.91.0-beta.
|
|
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(
|
|
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
|
{
|
|
@@ -305,7 +306,7 @@ exports.MainnetSpotMarkets = [
|
|
|
305
306
|
symbol: 'PYUSD',
|
|
306
307
|
marketIndex: 22,
|
|
307
308
|
oracle: new web3_js_1.PublicKey('HpMoKp3TCd3QT4MWYUKk2zCBwmhr5Df45fB6wdxYqEeh'),
|
|
308
|
-
oracleSource: __1.OracleSource.
|
|
309
|
+
oracleSource: __1.OracleSource.PYTH_PULL,
|
|
309
310
|
mint: new web3_js_1.PublicKey('2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo'),
|
|
310
311
|
precision: new __1.BN(10).pow(numericConstants_1.SIX),
|
|
311
312
|
precisionExp: numericConstants_1.SIX,
|
|
@@ -51,14 +51,16 @@ class OpenbookV2Subscriber {
|
|
|
51
51
|
this.subscribed = true;
|
|
52
52
|
}
|
|
53
53
|
getBestBid() {
|
|
54
|
-
|
|
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
|
-
|
|
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
|
@@ -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(
|
|
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
|
},
|
|
@@ -377,7 +380,7 @@ export const MainnetSpotMarkets: SpotMarketConfig[] = [
|
|
|
377
380
|
symbol: 'PYUSD',
|
|
378
381
|
marketIndex: 22,
|
|
379
382
|
oracle: new PublicKey('HpMoKp3TCd3QT4MWYUKk2zCBwmhr5Df45fB6wdxYqEeh'),
|
|
380
|
-
oracleSource: OracleSource.
|
|
383
|
+
oracleSource: OracleSource.PYTH_PULL,
|
|
381
384
|
mint: new PublicKey('2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo'),
|
|
382
385
|
precision: new BN(10).pow(SIX),
|
|
383
386
|
precisionExp: SIX,
|
|
@@ -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
|
|
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
|
|
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
|
|
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 {
|