@drift-labs/sdk 2.106.0-beta.2 → 2.106.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 +1 -1
- package/lib/browser/constants/spotMarkets.js +27 -2
- package/lib/browser/dlob/DLOB.d.ts +1 -0
- package/lib/browser/dlob/DLOB.js +11 -0
- package/lib/node/constants/spotMarkets.js +27 -2
- package/lib/node/dlob/DLOB.d.ts +1 -0
- package/lib/node/dlob/DLOB.js +11 -0
- package/package.json +1 -1
- package/src/constants/spotMarkets.ts +30 -2
- package/src/dlob/DLOB.ts +22 -0
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.106.0-beta.
|
|
1
|
+
2.106.0-beta.4
|
|
@@ -310,12 +310,13 @@ exports.MainnetSpotMarkets = [
|
|
|
310
310
|
symbol: 'dSOL',
|
|
311
311
|
marketIndex: 17,
|
|
312
312
|
poolId: 0,
|
|
313
|
-
oracle: new web3_js_1.PublicKey('
|
|
314
|
-
oracleSource: __1.OracleSource.
|
|
313
|
+
oracle: new web3_js_1.PublicKey('4YstsHafLyDbYFxmJbgoEr33iJJEp6rNPgLTQRgXDkG2'),
|
|
314
|
+
oracleSource: __1.OracleSource.PYTH_PULL,
|
|
315
315
|
mint: new web3_js_1.PublicKey('Dso1bDeDjCQxTrWHqUUi63oBvV7Mdm6WaobLbQ7gnPQ'),
|
|
316
316
|
precision: new __1.BN(10).pow(numericConstants_1.NINE),
|
|
317
317
|
precisionExp: numericConstants_1.NINE,
|
|
318
318
|
launchTs: 1716595200000,
|
|
319
|
+
pythFeedId: '0x41f858bae36e7ee3f4a3a6d4f176f0893d4a261460a52763350d00f8648195ee',
|
|
319
320
|
},
|
|
320
321
|
{
|
|
321
322
|
symbol: 'USDY',
|
|
@@ -488,6 +489,30 @@ exports.MainnetSpotMarkets = [
|
|
|
488
489
|
openbookMarket: new web3_js_1.PublicKey('D3gZwng2MgZGjktYcKpbR8Bz8653i4qCgzHCf5E4TcZb'),
|
|
489
490
|
launchTs: 1734717937000,
|
|
490
491
|
},
|
|
492
|
+
{
|
|
493
|
+
symbol: 'JLP',
|
|
494
|
+
marketIndex: 33,
|
|
495
|
+
poolId: 1,
|
|
496
|
+
oracle: new web3_js_1.PublicKey('5Mb11e5rt1Sp6A286B145E4TmgMzsM2UX9nCF2vas5bs'),
|
|
497
|
+
oracleSource: __1.OracleSource.PYTH_PULL,
|
|
498
|
+
mint: new web3_js_1.PublicKey('27G8MtK7VtTcCHkpASjSDdkWWYfoqT6ggEuKidVJidD4'),
|
|
499
|
+
precision: new __1.BN(10).pow(numericConstants_1.SIX),
|
|
500
|
+
precisionExp: numericConstants_1.SIX,
|
|
501
|
+
pythFeedId: '0xc811abc82b4bad1f9bd711a2773ccaa935b03ecef974236942cec5e0eb845a3a',
|
|
502
|
+
launchTs: 1735255852000,
|
|
503
|
+
},
|
|
504
|
+
{
|
|
505
|
+
symbol: 'USDC',
|
|
506
|
+
marketIndex: 34,
|
|
507
|
+
poolId: 1,
|
|
508
|
+
oracle: new web3_js_1.PublicKey('En8hkHLkRe9d9DraYmBTrus518BvmVH448YcvmrFM6Ce'),
|
|
509
|
+
oracleSource: __1.OracleSource.PYTH_STABLE_COIN_PULL,
|
|
510
|
+
mint: new web3_js_1.PublicKey('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'),
|
|
511
|
+
precision: new __1.BN(10).pow(numericConstants_1.SIX),
|
|
512
|
+
precisionExp: numericConstants_1.SIX,
|
|
513
|
+
pythFeedId: '0xeaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a',
|
|
514
|
+
launchTs: 1735255852000,
|
|
515
|
+
},
|
|
491
516
|
];
|
|
492
517
|
exports.SpotMarkets = {
|
|
493
518
|
devnet: exports.DevnetSpotMarkets,
|
|
@@ -66,6 +66,7 @@ export declare class DLOB {
|
|
|
66
66
|
insertOrder(order: Order, userAccount: string, slot: number, isUserProtectedMaker: boolean, onInsert?: OrderBookCallback): void;
|
|
67
67
|
insertSwiftOrder(order: Order, userAccount: string, isUserProtectedMaker: boolean, onInsert?: OrderBookCallback): void;
|
|
68
68
|
addOrderList(marketType: MarketTypeStr, marketIndex: number): void;
|
|
69
|
+
delete(order: Order, userAccount: PublicKey, slot: number, onDelete?: OrderBookCallback): void;
|
|
69
70
|
getListForOnChainOrder(order: Order, slot: number): NodeList<any> | undefined;
|
|
70
71
|
updateRestingLimitOrders(slot: number): void;
|
|
71
72
|
updateRestingLimitOrdersForMarketType(slot: number, marketTypeStr: MarketTypeStr): void;
|
package/lib/browser/dlob/DLOB.js
CHANGED
|
@@ -138,6 +138,17 @@ class DLOB {
|
|
|
138
138
|
},
|
|
139
139
|
});
|
|
140
140
|
}
|
|
141
|
+
delete(order, userAccount, slot, onDelete) {
|
|
142
|
+
var _a;
|
|
143
|
+
if ((0, __1.isVariant)(order.status, 'init')) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
this.updateRestingLimitOrders(slot);
|
|
147
|
+
(_a = this.getListForOnChainOrder(order, slot)) === null || _a === void 0 ? void 0 : _a.remove(order, userAccount.toString());
|
|
148
|
+
if (onDelete) {
|
|
149
|
+
onDelete();
|
|
150
|
+
}
|
|
151
|
+
}
|
|
141
152
|
getListForOnChainOrder(order, slot) {
|
|
142
153
|
const isInactiveTriggerOrder = (0, __1.mustBeTriggered)(order) && !(0, __1.isTriggered)(order);
|
|
143
154
|
let type;
|
|
@@ -310,12 +310,13 @@ exports.MainnetSpotMarkets = [
|
|
|
310
310
|
symbol: 'dSOL',
|
|
311
311
|
marketIndex: 17,
|
|
312
312
|
poolId: 0,
|
|
313
|
-
oracle: new web3_js_1.PublicKey('
|
|
314
|
-
oracleSource: __1.OracleSource.
|
|
313
|
+
oracle: new web3_js_1.PublicKey('4YstsHafLyDbYFxmJbgoEr33iJJEp6rNPgLTQRgXDkG2'),
|
|
314
|
+
oracleSource: __1.OracleSource.PYTH_PULL,
|
|
315
315
|
mint: new web3_js_1.PublicKey('Dso1bDeDjCQxTrWHqUUi63oBvV7Mdm6WaobLbQ7gnPQ'),
|
|
316
316
|
precision: new __1.BN(10).pow(numericConstants_1.NINE),
|
|
317
317
|
precisionExp: numericConstants_1.NINE,
|
|
318
318
|
launchTs: 1716595200000,
|
|
319
|
+
pythFeedId: '0x41f858bae36e7ee3f4a3a6d4f176f0893d4a261460a52763350d00f8648195ee',
|
|
319
320
|
},
|
|
320
321
|
{
|
|
321
322
|
symbol: 'USDY',
|
|
@@ -488,6 +489,30 @@ exports.MainnetSpotMarkets = [
|
|
|
488
489
|
openbookMarket: new web3_js_1.PublicKey('D3gZwng2MgZGjktYcKpbR8Bz8653i4qCgzHCf5E4TcZb'),
|
|
489
490
|
launchTs: 1734717937000,
|
|
490
491
|
},
|
|
492
|
+
{
|
|
493
|
+
symbol: 'JLP',
|
|
494
|
+
marketIndex: 33,
|
|
495
|
+
poolId: 1,
|
|
496
|
+
oracle: new web3_js_1.PublicKey('5Mb11e5rt1Sp6A286B145E4TmgMzsM2UX9nCF2vas5bs'),
|
|
497
|
+
oracleSource: __1.OracleSource.PYTH_PULL,
|
|
498
|
+
mint: new web3_js_1.PublicKey('27G8MtK7VtTcCHkpASjSDdkWWYfoqT6ggEuKidVJidD4'),
|
|
499
|
+
precision: new __1.BN(10).pow(numericConstants_1.SIX),
|
|
500
|
+
precisionExp: numericConstants_1.SIX,
|
|
501
|
+
pythFeedId: '0xc811abc82b4bad1f9bd711a2773ccaa935b03ecef974236942cec5e0eb845a3a',
|
|
502
|
+
launchTs: 1735255852000,
|
|
503
|
+
},
|
|
504
|
+
{
|
|
505
|
+
symbol: 'USDC',
|
|
506
|
+
marketIndex: 34,
|
|
507
|
+
poolId: 1,
|
|
508
|
+
oracle: new web3_js_1.PublicKey('En8hkHLkRe9d9DraYmBTrus518BvmVH448YcvmrFM6Ce'),
|
|
509
|
+
oracleSource: __1.OracleSource.PYTH_STABLE_COIN_PULL,
|
|
510
|
+
mint: new web3_js_1.PublicKey('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'),
|
|
511
|
+
precision: new __1.BN(10).pow(numericConstants_1.SIX),
|
|
512
|
+
precisionExp: numericConstants_1.SIX,
|
|
513
|
+
pythFeedId: '0xeaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a',
|
|
514
|
+
launchTs: 1735255852000,
|
|
515
|
+
},
|
|
491
516
|
];
|
|
492
517
|
exports.SpotMarkets = {
|
|
493
518
|
devnet: exports.DevnetSpotMarkets,
|
package/lib/node/dlob/DLOB.d.ts
CHANGED
|
@@ -66,6 +66,7 @@ export declare class DLOB {
|
|
|
66
66
|
insertOrder(order: Order, userAccount: string, slot: number, isUserProtectedMaker: boolean, onInsert?: OrderBookCallback): void;
|
|
67
67
|
insertSwiftOrder(order: Order, userAccount: string, isUserProtectedMaker: boolean, onInsert?: OrderBookCallback): void;
|
|
68
68
|
addOrderList(marketType: MarketTypeStr, marketIndex: number): void;
|
|
69
|
+
delete(order: Order, userAccount: PublicKey, slot: number, onDelete?: OrderBookCallback): void;
|
|
69
70
|
getListForOnChainOrder(order: Order, slot: number): NodeList<any> | undefined;
|
|
70
71
|
updateRestingLimitOrders(slot: number): void;
|
|
71
72
|
updateRestingLimitOrdersForMarketType(slot: number, marketTypeStr: MarketTypeStr): void;
|
package/lib/node/dlob/DLOB.js
CHANGED
|
@@ -138,6 +138,17 @@ class DLOB {
|
|
|
138
138
|
},
|
|
139
139
|
});
|
|
140
140
|
}
|
|
141
|
+
delete(order, userAccount, slot, onDelete) {
|
|
142
|
+
var _a;
|
|
143
|
+
if ((0, __1.isVariant)(order.status, 'init')) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
this.updateRestingLimitOrders(slot);
|
|
147
|
+
(_a = this.getListForOnChainOrder(order, slot)) === null || _a === void 0 ? void 0 : _a.remove(order, userAccount.toString());
|
|
148
|
+
if (onDelete) {
|
|
149
|
+
onDelete();
|
|
150
|
+
}
|
|
151
|
+
}
|
|
141
152
|
getListForOnChainOrder(order, slot) {
|
|
142
153
|
const isInactiveTriggerOrder = (0, __1.mustBeTriggered)(order) && !(0, __1.isTriggered)(order);
|
|
143
154
|
let type;
|
package/package.json
CHANGED
|
@@ -390,12 +390,14 @@ export const MainnetSpotMarkets: SpotMarketConfig[] = [
|
|
|
390
390
|
symbol: 'dSOL',
|
|
391
391
|
marketIndex: 17,
|
|
392
392
|
poolId: 0,
|
|
393
|
-
oracle: new PublicKey('
|
|
394
|
-
oracleSource: OracleSource.
|
|
393
|
+
oracle: new PublicKey('4YstsHafLyDbYFxmJbgoEr33iJJEp6rNPgLTQRgXDkG2'),
|
|
394
|
+
oracleSource: OracleSource.PYTH_PULL,
|
|
395
395
|
mint: new PublicKey('Dso1bDeDjCQxTrWHqUUi63oBvV7Mdm6WaobLbQ7gnPQ'),
|
|
396
396
|
precision: new BN(10).pow(NINE),
|
|
397
397
|
precisionExp: NINE,
|
|
398
398
|
launchTs: 1716595200000,
|
|
399
|
+
pythFeedId:
|
|
400
|
+
'0x41f858bae36e7ee3f4a3a6d4f176f0893d4a261460a52763350d00f8648195ee',
|
|
399
401
|
},
|
|
400
402
|
{
|
|
401
403
|
symbol: 'USDY',
|
|
@@ -587,6 +589,32 @@ export const MainnetSpotMarkets: SpotMarketConfig[] = [
|
|
|
587
589
|
),
|
|
588
590
|
launchTs: 1734717937000,
|
|
589
591
|
},
|
|
592
|
+
{
|
|
593
|
+
symbol: 'JLP',
|
|
594
|
+
marketIndex: 33,
|
|
595
|
+
poolId: 1,
|
|
596
|
+
oracle: new PublicKey('5Mb11e5rt1Sp6A286B145E4TmgMzsM2UX9nCF2vas5bs'),
|
|
597
|
+
oracleSource: OracleSource.PYTH_PULL,
|
|
598
|
+
mint: new PublicKey('27G8MtK7VtTcCHkpASjSDdkWWYfoqT6ggEuKidVJidD4'),
|
|
599
|
+
precision: new BN(10).pow(SIX),
|
|
600
|
+
precisionExp: SIX,
|
|
601
|
+
pythFeedId:
|
|
602
|
+
'0xc811abc82b4bad1f9bd711a2773ccaa935b03ecef974236942cec5e0eb845a3a',
|
|
603
|
+
launchTs: 1735255852000,
|
|
604
|
+
},
|
|
605
|
+
{
|
|
606
|
+
symbol: 'USDC',
|
|
607
|
+
marketIndex: 34,
|
|
608
|
+
poolId: 1,
|
|
609
|
+
oracle: new PublicKey('En8hkHLkRe9d9DraYmBTrus518BvmVH448YcvmrFM6Ce'),
|
|
610
|
+
oracleSource: OracleSource.PYTH_STABLE_COIN_PULL,
|
|
611
|
+
mint: new PublicKey('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'),
|
|
612
|
+
precision: new BN(10).pow(SIX),
|
|
613
|
+
precisionExp: SIX,
|
|
614
|
+
pythFeedId:
|
|
615
|
+
'0xeaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a',
|
|
616
|
+
launchTs: 1735255852000,
|
|
617
|
+
},
|
|
590
618
|
];
|
|
591
619
|
|
|
592
620
|
export const SpotMarkets: { [key in DriftEnv]: SpotMarketConfig[] } = {
|
package/src/dlob/DLOB.ts
CHANGED
|
@@ -270,6 +270,28 @@ export class DLOB {
|
|
|
270
270
|
});
|
|
271
271
|
}
|
|
272
272
|
|
|
273
|
+
public delete(
|
|
274
|
+
order: Order,
|
|
275
|
+
userAccount: PublicKey,
|
|
276
|
+
slot: number,
|
|
277
|
+
onDelete?: OrderBookCallback
|
|
278
|
+
): void {
|
|
279
|
+
if (isVariant(order.status, 'init')) {
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
this.updateRestingLimitOrders(slot);
|
|
284
|
+
|
|
285
|
+
this.getListForOnChainOrder(order, slot)?.remove(
|
|
286
|
+
order,
|
|
287
|
+
userAccount.toString()
|
|
288
|
+
);
|
|
289
|
+
|
|
290
|
+
if (onDelete) {
|
|
291
|
+
onDelete();
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
273
295
|
public getListForOnChainOrder(
|
|
274
296
|
order: Order,
|
|
275
297
|
slot: number
|