@drift-labs/sdk 2.67.0-beta.4 → 2.67.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.67.0-beta.
|
|
1
|
+
2.67.0-beta.5
|
|
@@ -249,13 +249,17 @@ class PollingDriftClientAccountSubscriber {
|
|
|
249
249
|
}
|
|
250
250
|
async addOracle(oracleInfo) {
|
|
251
251
|
if (oracleInfo.publicKey.equals(web3_js_1.PublicKey.default) ||
|
|
252
|
-
this.
|
|
252
|
+
this.oracles.has(oracleInfo.publicKey.toBase58())) {
|
|
253
253
|
return true;
|
|
254
254
|
}
|
|
255
|
-
this.addOracleToPoll(oracleInfo);
|
|
256
255
|
const oracleString = oracleInfo.publicKey.toBase58();
|
|
257
|
-
|
|
258
|
-
|
|
256
|
+
// this func can be called multiple times before the first pauseForOracleToBeAdded finishes
|
|
257
|
+
// avoid adding to oraclesToPoll multiple time
|
|
258
|
+
if (!this.oraclesToPoll.has(oracleString)) {
|
|
259
|
+
this.addOracleToPoll(oracleInfo);
|
|
260
|
+
const oracleToPoll = this.oraclesToPoll.get(oracleString);
|
|
261
|
+
await this.addOracleToAccountLoader(oracleToPoll);
|
|
262
|
+
}
|
|
259
263
|
await this.pauseForOracleToBeAdded(3, oracleString);
|
|
260
264
|
return true;
|
|
261
265
|
}
|
package/package.json
CHANGED
|
@@ -396,15 +396,19 @@ export class PollingDriftClientAccountSubscriber
|
|
|
396
396
|
async addOracle(oracleInfo: OracleInfo): Promise<boolean> {
|
|
397
397
|
if (
|
|
398
398
|
oracleInfo.publicKey.equals(PublicKey.default) ||
|
|
399
|
-
this.
|
|
399
|
+
this.oracles.has(oracleInfo.publicKey.toBase58())
|
|
400
400
|
) {
|
|
401
401
|
return true;
|
|
402
402
|
}
|
|
403
403
|
|
|
404
|
-
this.addOracleToPoll(oracleInfo);
|
|
405
404
|
const oracleString = oracleInfo.publicKey.toBase58();
|
|
406
|
-
|
|
407
|
-
|
|
405
|
+
// this func can be called multiple times before the first pauseForOracleToBeAdded finishes
|
|
406
|
+
// avoid adding to oraclesToPoll multiple time
|
|
407
|
+
if (!this.oraclesToPoll.has(oracleString)) {
|
|
408
|
+
this.addOracleToPoll(oracleInfo);
|
|
409
|
+
const oracleToPoll = this.oraclesToPoll.get(oracleString);
|
|
410
|
+
await this.addOracleToAccountLoader(oracleToPoll);
|
|
411
|
+
}
|
|
408
412
|
|
|
409
413
|
await this.pauseForOracleToBeAdded(3, oracleString);
|
|
410
414
|
|