@drift-labs/sdk-browser 2.122.0-beta.2 → 2.122.0-beta.3
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/slot/SlotSubscriber.d.ts +1 -0
- package/lib/browser/slot/SlotSubscriber.js +9 -4
- package/lib/node/slot/SlotSubscriber.d.ts +1 -0
- package/lib/node/slot/SlotSubscriber.d.ts.map +1 -1
- package/lib/node/slot/SlotSubscriber.js +9 -4
- package/package.json +1 -1
- package/src/slot/SlotSubscriber.ts +11 -4
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.122.0-beta.
|
|
1
|
+
2.122.0-beta.3
|
|
@@ -19,6 +19,7 @@ export declare class SlotSubscriber {
|
|
|
19
19
|
receivingData: boolean;
|
|
20
20
|
constructor(connection: Connection, config?: SlotSubscriberConfig);
|
|
21
21
|
subscribe(): Promise<void>;
|
|
22
|
+
private updateCurrentSlot;
|
|
22
23
|
private setTimeout;
|
|
23
24
|
getSlot(): number;
|
|
24
25
|
unsubscribe(onResub?: boolean): Promise<void>;
|
|
@@ -17,16 +17,17 @@ class SlotSubscriber {
|
|
|
17
17
|
if (this.subscriptionId != null) {
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
const newSlot = await this.connection.getSlot('confirmed');
|
|
21
|
+
this.updateCurrentSlot(newSlot);
|
|
21
22
|
this.subscriptionId = this.connection.onSlotChange((slotInfo) => {
|
|
22
|
-
|
|
23
|
+
const newSlot = slotInfo.slot;
|
|
24
|
+
if (!this.currentSlot || this.currentSlot < newSlot) {
|
|
23
25
|
if (this.resubTimeoutMs && !this.isUnsubscribing) {
|
|
24
26
|
this.receivingData = true;
|
|
25
27
|
clearTimeout(this.timeoutId);
|
|
26
28
|
this.setTimeout();
|
|
27
29
|
}
|
|
28
|
-
this.
|
|
29
|
-
this.eventEmitter.emit('newSlot', slotInfo.slot);
|
|
30
|
+
this.updateCurrentSlot(newSlot);
|
|
30
31
|
}
|
|
31
32
|
});
|
|
32
33
|
if (this.resubTimeoutMs) {
|
|
@@ -34,6 +35,10 @@ class SlotSubscriber {
|
|
|
34
35
|
this.setTimeout();
|
|
35
36
|
}
|
|
36
37
|
}
|
|
38
|
+
updateCurrentSlot(slot) {
|
|
39
|
+
this.currentSlot = slot;
|
|
40
|
+
this.eventEmitter.emit('newSlot', slot);
|
|
41
|
+
}
|
|
37
42
|
setTimeout() {
|
|
38
43
|
this.timeoutId = setTimeout(async () => {
|
|
39
44
|
if (this.isUnsubscribing) {
|
|
@@ -19,6 +19,7 @@ export declare class SlotSubscriber {
|
|
|
19
19
|
receivingData: boolean;
|
|
20
20
|
constructor(connection: Connection, config?: SlotSubscriberConfig);
|
|
21
21
|
subscribe(): Promise<void>;
|
|
22
|
+
private updateCurrentSlot;
|
|
22
23
|
private setTimeout;
|
|
23
24
|
getSlot(): number;
|
|
24
25
|
unsubscribe(onResub?: boolean): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SlotSubscriber.d.ts","sourceRoot":"","sources":["../../../src/slot/SlotSubscriber.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,kBAAkB,MAAM,sCAAsC,CAAC;AAGtE,KAAK,oBAAoB,GAAG;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,WAAW,oBAAoB;IACpC,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED,qBAAa,cAAc;IAYzB,OAAO,CAAC,UAAU;IAXnB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,kBAAkB,CAAC,YAAY,EAAE,oBAAoB,CAAC,CAAC;IAGrE,SAA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|
|
17
17
|
if (this.subscriptionId != null) {
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
const newSlot = await this.connection.getSlot('confirmed');
|
|
21
|
+
this.updateCurrentSlot(newSlot);
|
|
21
22
|
this.subscriptionId = this.connection.onSlotChange((slotInfo) => {
|
|
22
|
-
|
|
23
|
+
const newSlot = slotInfo.slot;
|
|
24
|
+
if (!this.currentSlot || this.currentSlot < newSlot) {
|
|
23
25
|
if (this.resubTimeoutMs && !this.isUnsubscribing) {
|
|
24
26
|
this.receivingData = true;
|
|
25
27
|
clearTimeout(this.timeoutId);
|
|
26
28
|
this.setTimeout();
|
|
27
29
|
}
|
|
28
|
-
this.
|
|
29
|
-
this.eventEmitter.emit('newSlot', slotInfo.slot);
|
|
30
|
+
this.updateCurrentSlot(newSlot);
|
|
30
31
|
}
|
|
31
32
|
});
|
|
32
33
|
if (this.resubTimeoutMs) {
|
|
@@ -34,6 +35,10 @@ class SlotSubscriber {
|
|
|
34
35
|
this.setTimeout();
|
|
35
36
|
}
|
|
36
37
|
}
|
|
38
|
+
updateCurrentSlot(slot) {
|
|
39
|
+
this.currentSlot = slot;
|
|
40
|
+
this.eventEmitter.emit('newSlot', slot);
|
|
41
|
+
}
|
|
37
42
|
setTimeout() {
|
|
38
43
|
this.timeoutId = setTimeout(async () => {
|
|
39
44
|
if (this.isUnsubscribing) {
|
package/package.json
CHANGED
|
@@ -40,17 +40,19 @@ export class SlotSubscriber {
|
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
const newSlot = await this.connection.getSlot('confirmed');
|
|
44
|
+
this.updateCurrentSlot(newSlot);
|
|
44
45
|
|
|
45
46
|
this.subscriptionId = this.connection.onSlotChange((slotInfo) => {
|
|
46
|
-
|
|
47
|
+
const newSlot = slotInfo.slot;
|
|
48
|
+
|
|
49
|
+
if (!this.currentSlot || this.currentSlot < newSlot) {
|
|
47
50
|
if (this.resubTimeoutMs && !this.isUnsubscribing) {
|
|
48
51
|
this.receivingData = true;
|
|
49
52
|
clearTimeout(this.timeoutId);
|
|
50
53
|
this.setTimeout();
|
|
51
54
|
}
|
|
52
|
-
this.
|
|
53
|
-
this.eventEmitter.emit('newSlot', slotInfo.slot);
|
|
55
|
+
this.updateCurrentSlot(newSlot);
|
|
54
56
|
}
|
|
55
57
|
});
|
|
56
58
|
|
|
@@ -60,6 +62,11 @@ export class SlotSubscriber {
|
|
|
60
62
|
}
|
|
61
63
|
}
|
|
62
64
|
|
|
65
|
+
private updateCurrentSlot(slot: number) {
|
|
66
|
+
this.currentSlot = slot;
|
|
67
|
+
this.eventEmitter.emit('newSlot', slot);
|
|
68
|
+
}
|
|
69
|
+
|
|
63
70
|
private setTimeout(): void {
|
|
64
71
|
this.timeoutId = setTimeout(async () => {
|
|
65
72
|
if (this.isUnsubscribing) {
|