@drift-labs/sdk 2.106.0-beta.3 → 2.106.0-beta.5
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/bun.lockb +0 -0
- package/lib/browser/constants/spotMarkets.js +3 -2
- package/lib/browser/dlob/DLOB.d.ts +1 -0
- package/lib/browser/dlob/DLOB.js +11 -0
- package/lib/browser/driftClient.js +3 -1
- package/lib/browser/idl/drift.json +4 -4
- package/lib/node/constants/spotMarkets.js +3 -2
- package/lib/node/dlob/DLOB.d.ts +1 -0
- package/lib/node/dlob/DLOB.js +11 -0
- package/lib/node/driftClient.js +3 -1
- package/lib/node/idl/drift.json +4 -4
- package/package.json +1 -1
- package/src/constants/spotMarkets.ts +4 -2
- package/src/dlob/DLOB.ts +22 -0
- package/src/driftClient.ts +3 -1
- package/src/idl/drift.json +4 -4
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.106.0-beta.
|
|
1
|
+
2.106.0-beta.5
|
package/bun.lockb
CHANGED
|
Binary file
|
|
@@ -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',
|
|
@@ -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;
|
|
@@ -3184,8 +3184,10 @@ class DriftClient {
|
|
|
3184
3184
|
const takerOrderParamsMessage = this.encodeSwiftOrderParamsMessage(orderParamsMessage);
|
|
3185
3185
|
return this.signMessage(takerOrderParamsMessage);
|
|
3186
3186
|
}
|
|
3187
|
+
// encode the swift order for use in program Ix/signing
|
|
3187
3188
|
encodeSwiftOrderParamsMessage(orderParamsMessage) {
|
|
3188
|
-
|
|
3189
|
+
const borshBuf = this.program.coder.types.encode('SwiftOrderParamsMessage', orderParamsMessage);
|
|
3190
|
+
return Buffer.from(borshBuf.toString('hex'));
|
|
3189
3191
|
}
|
|
3190
3192
|
decodeSwiftOrderParamsMessage(encodedMessage) {
|
|
3191
3193
|
return this.program.coder.types.decode('SwiftOrderParamsMessage', encodedMessage);
|
|
@@ -11807,6 +11807,9 @@
|
|
|
11807
11807
|
},
|
|
11808
11808
|
{
|
|
11809
11809
|
"name": "MessageOffsetOverflow"
|
|
11810
|
+
},
|
|
11811
|
+
{
|
|
11812
|
+
"name": "InvalidMessageHex"
|
|
11810
11813
|
}
|
|
11811
11814
|
]
|
|
11812
11815
|
}
|
|
@@ -14473,8 +14476,5 @@
|
|
|
14473
14476
|
"name": "PythLazerMessagePriceFeedMismatch",
|
|
14474
14477
|
"msg": "Pyth lazer message does not correspond to correct fed id"
|
|
14475
14478
|
}
|
|
14476
|
-
]
|
|
14477
|
-
"metadata": {
|
|
14478
|
-
"address": "dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH"
|
|
14479
|
-
}
|
|
14479
|
+
]
|
|
14480
14480
|
}
|
|
@@ -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',
|
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/lib/node/driftClient.js
CHANGED
|
@@ -3184,8 +3184,10 @@ class DriftClient {
|
|
|
3184
3184
|
const takerOrderParamsMessage = this.encodeSwiftOrderParamsMessage(orderParamsMessage);
|
|
3185
3185
|
return this.signMessage(takerOrderParamsMessage);
|
|
3186
3186
|
}
|
|
3187
|
+
// encode the swift order for use in program Ix/signing
|
|
3187
3188
|
encodeSwiftOrderParamsMessage(orderParamsMessage) {
|
|
3188
|
-
|
|
3189
|
+
const borshBuf = this.program.coder.types.encode('SwiftOrderParamsMessage', orderParamsMessage);
|
|
3190
|
+
return Buffer.from(borshBuf.toString('hex'));
|
|
3189
3191
|
}
|
|
3190
3192
|
decodeSwiftOrderParamsMessage(encodedMessage) {
|
|
3191
3193
|
return this.program.coder.types.decode('SwiftOrderParamsMessage', encodedMessage);
|
package/lib/node/idl/drift.json
CHANGED
|
@@ -11807,6 +11807,9 @@
|
|
|
11807
11807
|
},
|
|
11808
11808
|
{
|
|
11809
11809
|
"name": "MessageOffsetOverflow"
|
|
11810
|
+
},
|
|
11811
|
+
{
|
|
11812
|
+
"name": "InvalidMessageHex"
|
|
11810
11813
|
}
|
|
11811
11814
|
]
|
|
11812
11815
|
}
|
|
@@ -14473,8 +14476,5 @@
|
|
|
14473
14476
|
"name": "PythLazerMessagePriceFeedMismatch",
|
|
14474
14477
|
"msg": "Pyth lazer message does not correspond to correct fed id"
|
|
14475
14478
|
}
|
|
14476
|
-
]
|
|
14477
|
-
"metadata": {
|
|
14478
|
-
"address": "dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH"
|
|
14479
|
-
}
|
|
14479
|
+
]
|
|
14480
14480
|
}
|
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',
|
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
|
package/src/driftClient.ts
CHANGED
|
@@ -5888,13 +5888,15 @@ export class DriftClient {
|
|
|
5888
5888
|
return this.signMessage(takerOrderParamsMessage);
|
|
5889
5889
|
}
|
|
5890
5890
|
|
|
5891
|
+
// encode the swift order for use in program Ix/signing
|
|
5891
5892
|
public encodeSwiftOrderParamsMessage(
|
|
5892
5893
|
orderParamsMessage: SwiftOrderParamsMessage
|
|
5893
5894
|
): Buffer {
|
|
5894
|
-
|
|
5895
|
+
const borshBuf = this.program.coder.types.encode(
|
|
5895
5896
|
'SwiftOrderParamsMessage',
|
|
5896
5897
|
orderParamsMessage
|
|
5897
5898
|
);
|
|
5899
|
+
return Buffer.from(borshBuf.toString('hex'));
|
|
5898
5900
|
}
|
|
5899
5901
|
|
|
5900
5902
|
public decodeSwiftOrderParamsMessage(
|
package/src/idl/drift.json
CHANGED
|
@@ -11807,6 +11807,9 @@
|
|
|
11807
11807
|
},
|
|
11808
11808
|
{
|
|
11809
11809
|
"name": "MessageOffsetOverflow"
|
|
11810
|
+
},
|
|
11811
|
+
{
|
|
11812
|
+
"name": "InvalidMessageHex"
|
|
11810
11813
|
}
|
|
11811
11814
|
]
|
|
11812
11815
|
}
|
|
@@ -14473,8 +14476,5 @@
|
|
|
14473
14476
|
"name": "PythLazerMessagePriceFeedMismatch",
|
|
14474
14477
|
"msg": "Pyth lazer message does not correspond to correct fed id"
|
|
14475
14478
|
}
|
|
14476
|
-
]
|
|
14477
|
-
"metadata": {
|
|
14478
|
-
"address": "dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH"
|
|
14479
|
-
}
|
|
14479
|
+
]
|
|
14480
14480
|
}
|