@drift-labs/sdk 2.95.0-beta.18 → 2.95.0-beta.19
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.95.0-beta.
|
|
1
|
+
2.95.0-beta.19
|
|
@@ -82,7 +82,9 @@ class WebSocketDriftClientAccountSubscriber {
|
|
|
82
82
|
if (!this.initialPerpMarketAccountData) {
|
|
83
83
|
const perpMarketPublicKeys = this.perpMarketIndexes.map((marketIndex) => (0, pda_1.getPerpMarketPublicKeySync)(this.program.programId, marketIndex));
|
|
84
84
|
const perpMarketAccountInfos = await connection.getMultipleAccountsInfo(perpMarketPublicKeys);
|
|
85
|
-
this.initialPerpMarketAccountData = new Map(perpMarketAccountInfos
|
|
85
|
+
this.initialPerpMarketAccountData = new Map(perpMarketAccountInfos
|
|
86
|
+
.filter((accountInfo) => !!accountInfo.data)
|
|
87
|
+
.map((accountInfo) => {
|
|
86
88
|
const perpMarket = this.program.coder.accounts.decode('PerpMarket', accountInfo.data);
|
|
87
89
|
return [perpMarket.marketIndex, perpMarket];
|
|
88
90
|
}));
|
|
@@ -90,13 +92,17 @@ class WebSocketDriftClientAccountSubscriber {
|
|
|
90
92
|
if (!this.initialSpotMarketAccountData) {
|
|
91
93
|
const spotMarketPublicKeys = this.spotMarketIndexes.map((marketIndex) => (0, pda_1.getSpotMarketPublicKeySync)(this.program.programId, marketIndex));
|
|
92
94
|
const spotMarketAccountInfos = await connection.getMultipleAccountsInfo(spotMarketPublicKeys);
|
|
93
|
-
this.initialSpotMarketAccountData = new Map(spotMarketAccountInfos
|
|
95
|
+
this.initialSpotMarketAccountData = new Map(spotMarketAccountInfos
|
|
96
|
+
.filter((accountInfo) => !!accountInfo.data)
|
|
97
|
+
.map((accountInfo) => {
|
|
94
98
|
const spotMarket = this.program.coder.accounts.decode('SpotMarket', accountInfo.data);
|
|
95
99
|
return [spotMarket.marketIndex, spotMarket];
|
|
96
100
|
}));
|
|
97
101
|
}
|
|
98
102
|
const oracleAccountInfos = await connection.getMultipleAccountsInfo(this.oracleInfos.map((oracleInfo) => oracleInfo.publicKey));
|
|
99
|
-
this.initialOraclePriceData = new Map(this.oracleInfos
|
|
103
|
+
this.initialOraclePriceData = new Map(this.oracleInfos
|
|
104
|
+
.filter((_, i) => !!oracleAccountInfos[i])
|
|
105
|
+
.map((oracleInfo, i) => {
|
|
100
106
|
const oracleClient = this.oracleClientCache.get(oracleInfo.source, connection, this.program);
|
|
101
107
|
const oraclePriceData = oracleClient.getOraclePriceDataFromBuffer(oracleAccountInfos[i].data);
|
|
102
108
|
return [oracleInfo.publicKey.toString(), oraclePriceData];
|
package/package.json
CHANGED
|
@@ -174,13 +174,15 @@ export class WebSocketDriftClientAccountSubscriber
|
|
|
174
174
|
perpMarketPublicKeys
|
|
175
175
|
);
|
|
176
176
|
this.initialPerpMarketAccountData = new Map(
|
|
177
|
-
perpMarketAccountInfos
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
177
|
+
perpMarketAccountInfos
|
|
178
|
+
.filter((accountInfo) => !!accountInfo.data)
|
|
179
|
+
.map((accountInfo) => {
|
|
180
|
+
const perpMarket = this.program.coder.accounts.decode(
|
|
181
|
+
'PerpMarket',
|
|
182
|
+
accountInfo.data
|
|
183
|
+
);
|
|
184
|
+
return [perpMarket.marketIndex, perpMarket];
|
|
185
|
+
})
|
|
184
186
|
);
|
|
185
187
|
}
|
|
186
188
|
|
|
@@ -192,13 +194,15 @@ export class WebSocketDriftClientAccountSubscriber
|
|
|
192
194
|
spotMarketPublicKeys
|
|
193
195
|
);
|
|
194
196
|
this.initialSpotMarketAccountData = new Map(
|
|
195
|
-
spotMarketAccountInfos
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
197
|
+
spotMarketAccountInfos
|
|
198
|
+
.filter((accountInfo) => !!accountInfo.data)
|
|
199
|
+
.map((accountInfo) => {
|
|
200
|
+
const spotMarket = this.program.coder.accounts.decode(
|
|
201
|
+
'SpotMarket',
|
|
202
|
+
accountInfo.data
|
|
203
|
+
);
|
|
204
|
+
return [spotMarket.marketIndex, spotMarket];
|
|
205
|
+
})
|
|
202
206
|
);
|
|
203
207
|
}
|
|
204
208
|
|
|
@@ -206,17 +210,19 @@ export class WebSocketDriftClientAccountSubscriber
|
|
|
206
210
|
this.oracleInfos.map((oracleInfo) => oracleInfo.publicKey)
|
|
207
211
|
);
|
|
208
212
|
this.initialOraclePriceData = new Map(
|
|
209
|
-
this.oracleInfos
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
213
|
+
this.oracleInfos
|
|
214
|
+
.filter((_, i) => !!oracleAccountInfos[i])
|
|
215
|
+
.map((oracleInfo, i) => {
|
|
216
|
+
const oracleClient = this.oracleClientCache.get(
|
|
217
|
+
oracleInfo.source,
|
|
218
|
+
connection,
|
|
219
|
+
this.program
|
|
220
|
+
);
|
|
221
|
+
const oraclePriceData = oracleClient.getOraclePriceDataFromBuffer(
|
|
222
|
+
oracleAccountInfos[i].data
|
|
223
|
+
);
|
|
224
|
+
return [oracleInfo.publicKey.toString(), oraclePriceData];
|
|
225
|
+
})
|
|
220
226
|
);
|
|
221
227
|
}
|
|
222
228
|
|