@drift-labs/sdk 2.48.0-beta.24 → 2.48.0-beta.26
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.48.0-beta.
|
|
1
|
+
2.48.0-beta.26
|
|
@@ -8,6 +8,7 @@ const DLOB_1 = require("../dlob/DLOB");
|
|
|
8
8
|
const PollingSubscription_1 = require("./PollingSubscription");
|
|
9
9
|
const WebsocketSubscription_1 = require("./WebsocketSubscription");
|
|
10
10
|
const events_1 = require("events");
|
|
11
|
+
const index_1 = require("../index");
|
|
11
12
|
class OrderSubscriber {
|
|
12
13
|
constructor(config) {
|
|
13
14
|
this.usersAccounts = new Map();
|
|
@@ -85,6 +86,11 @@ class OrderSubscriber {
|
|
|
85
86
|
if (dataType === 'raw') {
|
|
86
87
|
// @ts-ignore
|
|
87
88
|
const buffer = buffer_1.Buffer.from(data[0], data[1]);
|
|
89
|
+
const newLastActiveSlot = new index_1.BN(buffer.subarray(4328, 4328 + 8), undefined, 'le');
|
|
90
|
+
if (slotAndUserAccount.userAccount &&
|
|
91
|
+
slotAndUserAccount.userAccount.lastActiveSlot.gt(newLastActiveSlot)) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
88
94
|
userAccount =
|
|
89
95
|
this.driftClient.program.account.user.coder.accounts.decodeUnchecked('User', buffer);
|
|
90
96
|
}
|
package/package.json
CHANGED
|
@@ -9,6 +9,7 @@ import { PollingSubscription } from './PollingSubscription';
|
|
|
9
9
|
import { WebsocketSubscription } from './WebsocketSubscription';
|
|
10
10
|
import StrictEventEmitter from 'strict-event-emitter-types';
|
|
11
11
|
import { EventEmitter } from 'events';
|
|
12
|
+
import { BN } from '../index';
|
|
12
13
|
|
|
13
14
|
export class OrderSubscriber {
|
|
14
15
|
driftClient: DriftClient;
|
|
@@ -126,6 +127,18 @@ export class OrderSubscriber {
|
|
|
126
127
|
// @ts-ignore
|
|
127
128
|
const buffer = Buffer.from(data[0], data[1]);
|
|
128
129
|
|
|
130
|
+
const newLastActiveSlot = new BN(
|
|
131
|
+
buffer.subarray(4328, 4328 + 8),
|
|
132
|
+
undefined,
|
|
133
|
+
'le'
|
|
134
|
+
);
|
|
135
|
+
if (
|
|
136
|
+
slotAndUserAccount.userAccount &&
|
|
137
|
+
slotAndUserAccount.userAccount.lastActiveSlot.gt(newLastActiveSlot)
|
|
138
|
+
) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
|
|
129
142
|
userAccount =
|
|
130
143
|
this.driftClient.program.account.user.coder.accounts.decodeUnchecked(
|
|
131
144
|
'User',
|