@drift-labs/sdk 2.96.0-beta.4 → 2.96.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/lib/events/eventSubscriber.js +9 -8
- package/package.json +1 -1
- package/src/events/eventSubscriber.ts +17 -11
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.96.0-beta.
|
|
1
|
+
2.96.0-beta.5
|
|
@@ -28,23 +28,24 @@ class EventSubscriber {
|
|
|
28
28
|
this.initializeLogProvider();
|
|
29
29
|
}
|
|
30
30
|
initializeLogProvider(subscribe = false) {
|
|
31
|
+
const logProviderConfig = this.options.logProviderConfig;
|
|
31
32
|
if (this.currentProviderType === 'websocket') {
|
|
32
|
-
const logProviderConfig = this.options
|
|
33
|
-
.logProviderConfig;
|
|
34
33
|
this.logProvider = new webSocketLogProvider_1.WebSocketLogProvider(
|
|
35
34
|
// @ts-ignore
|
|
36
|
-
this.connection, this.address, this.options.commitment, logProviderConfig.resubTimeoutMs);
|
|
35
|
+
this.connection, this.address, this.options.commitment, this.options.logProviderConfig.resubTimeoutMs);
|
|
37
36
|
}
|
|
38
37
|
else if (this.currentProviderType === 'polling') {
|
|
39
|
-
const
|
|
40
|
-
.
|
|
38
|
+
const frequency = 'frequency' in logProviderConfig
|
|
39
|
+
? logProviderConfig.frequency
|
|
40
|
+
: logProviderConfig.fallbackFrequency;
|
|
41
|
+
const batchSize = 'batchSize' in logProviderConfig
|
|
42
|
+
? logProviderConfig.batchSize
|
|
43
|
+
: logProviderConfig.fallbackBatchSize;
|
|
41
44
|
this.logProvider = new pollingLogProvider_1.PollingLogProvider(
|
|
42
45
|
// @ts-ignore
|
|
43
|
-
this.connection, this.address, this.options.commitment,
|
|
46
|
+
this.connection, this.address, this.options.commitment, frequency, batchSize);
|
|
44
47
|
}
|
|
45
48
|
else if (this.currentProviderType === 'events-server') {
|
|
46
|
-
const logProviderConfig = this.options
|
|
47
|
-
.logProviderConfig;
|
|
48
49
|
this.logProvider = new eventsServerLogProvider_1.EventsServerLogProvider(logProviderConfig.url, this.options.eventTypes, this.options.address ? this.options.address.toString() : undefined);
|
|
49
50
|
}
|
|
50
51
|
else {
|
package/package.json
CHANGED
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
LogProvider,
|
|
10
10
|
EventSubscriberEvents,
|
|
11
11
|
WebSocketLogProviderConfig,
|
|
12
|
-
PollingLogProviderConfig,
|
|
13
12
|
EventsServerLogProviderConfig,
|
|
14
13
|
LogProviderType,
|
|
15
14
|
StreamingLogProviderConfig,
|
|
@@ -54,32 +53,39 @@ export class EventSubscriber {
|
|
|
54
53
|
}
|
|
55
54
|
|
|
56
55
|
private initializeLogProvider(subscribe = false) {
|
|
56
|
+
const logProviderConfig = this.options.logProviderConfig;
|
|
57
|
+
|
|
57
58
|
if (this.currentProviderType === 'websocket') {
|
|
58
|
-
const logProviderConfig = this.options
|
|
59
|
-
.logProviderConfig as WebSocketLogProviderConfig;
|
|
60
59
|
this.logProvider = new WebSocketLogProvider(
|
|
61
60
|
// @ts-ignore
|
|
62
61
|
this.connection,
|
|
63
62
|
this.address,
|
|
64
63
|
this.options.commitment,
|
|
65
|
-
|
|
64
|
+
(
|
|
65
|
+
this.options.logProviderConfig as WebSocketLogProviderConfig
|
|
66
|
+
).resubTimeoutMs
|
|
66
67
|
);
|
|
67
68
|
} else if (this.currentProviderType === 'polling') {
|
|
68
|
-
const
|
|
69
|
-
|
|
69
|
+
const frequency =
|
|
70
|
+
'frequency' in logProviderConfig
|
|
71
|
+
? logProviderConfig.frequency
|
|
72
|
+
: (logProviderConfig as StreamingLogProviderConfig).fallbackFrequency;
|
|
73
|
+
const batchSize =
|
|
74
|
+
'batchSize' in logProviderConfig
|
|
75
|
+
? logProviderConfig.batchSize
|
|
76
|
+
: (logProviderConfig as StreamingLogProviderConfig).fallbackBatchSize;
|
|
77
|
+
|
|
70
78
|
this.logProvider = new PollingLogProvider(
|
|
71
79
|
// @ts-ignore
|
|
72
80
|
this.connection,
|
|
73
81
|
this.address,
|
|
74
82
|
this.options.commitment,
|
|
75
|
-
|
|
76
|
-
|
|
83
|
+
frequency,
|
|
84
|
+
batchSize
|
|
77
85
|
);
|
|
78
86
|
} else if (this.currentProviderType === 'events-server') {
|
|
79
|
-
const logProviderConfig = this.options
|
|
80
|
-
.logProviderConfig as EventsServerLogProviderConfig;
|
|
81
87
|
this.logProvider = new EventsServerLogProvider(
|
|
82
|
-
logProviderConfig.url,
|
|
88
|
+
(logProviderConfig as EventsServerLogProviderConfig).url,
|
|
83
89
|
this.options.eventTypes,
|
|
84
90
|
this.options.address ? this.options.address.toString() : undefined
|
|
85
91
|
);
|