@drift-labs/sdk-browser 2.112.0-beta.7 → 2.112.0-beta.9
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/dlob/DLOB.js +11 -2
- package/lib/browser/fastlane/fastlaneOrderSubscriber.d.ts +5 -0
- package/lib/node/dlob/DLOB.js +11 -2
- package/lib/node/fastlane/fastlaneOrderSubscriber.d.ts +5 -0
- package/package.json +1 -1
- package/src/dlob/DLOB.ts +15 -6
- package/src/fastlane/fastlaneOrderSubscriber.ts +5 -0
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.112.0-beta.
|
|
1
|
+
2.112.0-beta.9
|
package/lib/browser/dlob/DLOB.js
CHANGED
|
@@ -402,7 +402,16 @@ class DLOB {
|
|
|
402
402
|
const newTakerOrder = { ...takerOrder };
|
|
403
403
|
newTakerOrder.baseAssetAmountFilled =
|
|
404
404
|
takerOrder.baseAssetAmountFilled.add(baseFilled);
|
|
405
|
-
|
|
405
|
+
if (takerNode.isSignedMsg) {
|
|
406
|
+
const marketTypeStr = (0, __1.getVariant)(marketType);
|
|
407
|
+
const orderList = (0, __1.isVariant)(takerOrder.direction, 'long')
|
|
408
|
+
? this.orderLists.get(marketTypeStr).get(marketIndex).signedMsg.bid
|
|
409
|
+
: this.orderLists.get(marketTypeStr).get(marketIndex).signedMsg.ask;
|
|
410
|
+
orderList.update(newTakerOrder, takerNode.userAccount);
|
|
411
|
+
}
|
|
412
|
+
else {
|
|
413
|
+
this.getListForOnChainOrder(newTakerOrder, slot, takerNode.isProtectedMaker).update(newTakerOrder, takerNode.userAccount);
|
|
414
|
+
}
|
|
406
415
|
if (newTakerOrder.baseAssetAmountFilled.eq(takerOrder.baseAssetAmount)) {
|
|
407
416
|
break;
|
|
408
417
|
}
|
|
@@ -483,7 +492,7 @@ class DLOB {
|
|
|
483
492
|
this.orderLists
|
|
484
493
|
.get(marketTypeStr)
|
|
485
494
|
.get(marketIndex)
|
|
486
|
-
.signedMsg.
|
|
495
|
+
.signedMsg.ask.remove(ask.order, ask.userAccount);
|
|
487
496
|
}
|
|
488
497
|
else if ((0, __1.isOrderExpired)(ask.order, ts, true, 25)) {
|
|
489
498
|
nodesToFill.push({
|
|
@@ -6,6 +6,11 @@ export type FastlaneOrderSubscriberConfig = {
|
|
|
6
6
|
driftEnv: DriftEnv;
|
|
7
7
|
endpoint?: string;
|
|
8
8
|
marketIndexes: number[];
|
|
9
|
+
/**
|
|
10
|
+
In the future, this will be used for verifying $DRIFT stake as we add
|
|
11
|
+
authentication for delegate signers
|
|
12
|
+
For now, pass a new keypair or a keypair to an empty wallet
|
|
13
|
+
*/
|
|
9
14
|
keypair: Keypair;
|
|
10
15
|
};
|
|
11
16
|
export declare class FastlaneOrderSubscriber {
|
package/lib/node/dlob/DLOB.js
CHANGED
|
@@ -402,7 +402,16 @@ class DLOB {
|
|
|
402
402
|
const newTakerOrder = { ...takerOrder };
|
|
403
403
|
newTakerOrder.baseAssetAmountFilled =
|
|
404
404
|
takerOrder.baseAssetAmountFilled.add(baseFilled);
|
|
405
|
-
|
|
405
|
+
if (takerNode.isSignedMsg) {
|
|
406
|
+
const marketTypeStr = (0, __1.getVariant)(marketType);
|
|
407
|
+
const orderList = (0, __1.isVariant)(takerOrder.direction, 'long')
|
|
408
|
+
? this.orderLists.get(marketTypeStr).get(marketIndex).signedMsg.bid
|
|
409
|
+
: this.orderLists.get(marketTypeStr).get(marketIndex).signedMsg.ask;
|
|
410
|
+
orderList.update(newTakerOrder, takerNode.userAccount);
|
|
411
|
+
}
|
|
412
|
+
else {
|
|
413
|
+
this.getListForOnChainOrder(newTakerOrder, slot, takerNode.isProtectedMaker).update(newTakerOrder, takerNode.userAccount);
|
|
414
|
+
}
|
|
406
415
|
if (newTakerOrder.baseAssetAmountFilled.eq(takerOrder.baseAssetAmount)) {
|
|
407
416
|
break;
|
|
408
417
|
}
|
|
@@ -483,7 +492,7 @@ class DLOB {
|
|
|
483
492
|
this.orderLists
|
|
484
493
|
.get(marketTypeStr)
|
|
485
494
|
.get(marketIndex)
|
|
486
|
-
.signedMsg.
|
|
495
|
+
.signedMsg.ask.remove(ask.order, ask.userAccount);
|
|
487
496
|
}
|
|
488
497
|
else if ((0, __1.isOrderExpired)(ask.order, ts, true, 25)) {
|
|
489
498
|
nodesToFill.push({
|
|
@@ -6,6 +6,11 @@ export type FastlaneOrderSubscriberConfig = {
|
|
|
6
6
|
driftEnv: DriftEnv;
|
|
7
7
|
endpoint?: string;
|
|
8
8
|
marketIndexes: number[];
|
|
9
|
+
/**
|
|
10
|
+
In the future, this will be used for verifying $DRIFT stake as we add
|
|
11
|
+
authentication for delegate signers
|
|
12
|
+
For now, pass a new keypair or a keypair to an empty wallet
|
|
13
|
+
*/
|
|
9
14
|
keypair: Keypair;
|
|
10
15
|
};
|
|
11
16
|
export declare class FastlaneOrderSubscriber {
|
package/package.json
CHANGED
package/src/dlob/DLOB.ts
CHANGED
|
@@ -818,11 +818,20 @@ export class DLOB {
|
|
|
818
818
|
const newTakerOrder = { ...takerOrder };
|
|
819
819
|
newTakerOrder.baseAssetAmountFilled =
|
|
820
820
|
takerOrder.baseAssetAmountFilled.add(baseFilled);
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
821
|
+
|
|
822
|
+
if (takerNode.isSignedMsg) {
|
|
823
|
+
const marketTypeStr = getVariant(marketType) as MarketTypeStr;
|
|
824
|
+
const orderList = isVariant(takerOrder.direction, 'long')
|
|
825
|
+
? this.orderLists.get(marketTypeStr).get(marketIndex).signedMsg.bid
|
|
826
|
+
: this.orderLists.get(marketTypeStr).get(marketIndex).signedMsg.ask;
|
|
827
|
+
orderList.update(newTakerOrder, takerNode.userAccount);
|
|
828
|
+
} else {
|
|
829
|
+
this.getListForOnChainOrder(
|
|
830
|
+
newTakerOrder,
|
|
831
|
+
slot,
|
|
832
|
+
takerNode.isProtectedMaker
|
|
833
|
+
).update(newTakerOrder, takerNode.userAccount);
|
|
834
|
+
}
|
|
826
835
|
|
|
827
836
|
if (
|
|
828
837
|
newTakerOrder.baseAssetAmountFilled.eq(takerOrder.baseAssetAmount)
|
|
@@ -941,7 +950,7 @@ export class DLOB {
|
|
|
941
950
|
this.orderLists
|
|
942
951
|
.get(marketTypeStr)
|
|
943
952
|
.get(marketIndex)
|
|
944
|
-
.signedMsg.
|
|
953
|
+
.signedMsg.ask.remove(ask.order, ask.userAccount);
|
|
945
954
|
} else if (isOrderExpired(ask.order, ts, true, 25)) {
|
|
946
955
|
nodesToFill.push({
|
|
947
956
|
node: ask,
|
|
@@ -22,6 +22,11 @@ export type FastlaneOrderSubscriberConfig = {
|
|
|
22
22
|
driftEnv: DriftEnv;
|
|
23
23
|
endpoint?: string;
|
|
24
24
|
marketIndexes: number[];
|
|
25
|
+
/**
|
|
26
|
+
In the future, this will be used for verifying $DRIFT stake as we add
|
|
27
|
+
authentication for delegate signers
|
|
28
|
+
For now, pass a new keypair or a keypair to an empty wallet
|
|
29
|
+
*/
|
|
25
30
|
keypair: Keypair;
|
|
26
31
|
};
|
|
27
32
|
|