@drift-labs/sdk 2.96.0-beta.3 → 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 CHANGED
@@ -1 +1 @@
1
- 2.96.0-beta.3
1
+ 2.96.0-beta.5
@@ -94,7 +94,7 @@ exports.MainnetSpotMarkets = [
94
94
  precision: new __1.BN(10).pow(numericConstants_1.EIGHT),
95
95
  precisionExp: numericConstants_1.EIGHT,
96
96
  serumMarket: new web3_js_1.PublicKey('3BAKsQd3RuhZKES2DGysMhjBdwjZYKYmxRqnSMtZ4KSN'),
97
- pythFeedId: '0xe62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43',
97
+ pythFeedId: '0xc9d8b075a5c69303365ae23633d4e085199bf5c520a3b90fed1322a0342ffc33',
98
98
  },
99
99
  {
100
100
  symbol: 'wETH',
@@ -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 logProviderConfig = this.options
40
- .logProviderConfig;
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, logProviderConfig.frequency, logProviderConfig.batchSize);
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/sdk",
3
- "version": "2.96.0-beta.3",
3
+ "version": "2.96.0-beta.5",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "author": "crispheaney",
@@ -133,7 +133,7 @@ export const MainnetSpotMarkets: SpotMarketConfig[] = [
133
133
  precisionExp: EIGHT,
134
134
  serumMarket: new PublicKey('3BAKsQd3RuhZKES2DGysMhjBdwjZYKYmxRqnSMtZ4KSN'),
135
135
  pythFeedId:
136
- '0xe62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43',
136
+ '0xc9d8b075a5c69303365ae23633d4e085199bf5c520a3b90fed1322a0342ffc33',
137
137
  },
138
138
  {
139
139
  symbol: 'wETH',
@@ -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
- logProviderConfig.resubTimeoutMs
64
+ (
65
+ this.options.logProviderConfig as WebSocketLogProviderConfig
66
+ ).resubTimeoutMs
66
67
  );
67
68
  } else if (this.currentProviderType === 'polling') {
68
- const logProviderConfig = this.options
69
- .logProviderConfig as PollingLogProviderConfig;
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
- logProviderConfig.frequency,
76
- logProviderConfig.batchSize
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
  );