@drift-labs/sdk 2.67.0-beta.3 → 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.3
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.oraclesToPoll.has(oracleInfo.publicKey.toString())) {
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
- const oracleToPoll = this.oraclesToPoll.get(oracleString);
258
- await this.addOracleToAccountLoader(oracleToPoll);
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
  }
@@ -56,7 +56,7 @@ class AdminClient extends driftClient_1.DriftClient {
56
56
  },
57
57
  });
58
58
  const tx = await this.buildTransaction(initializeIx);
59
- const { txSig } = await this.sendTransaction(tx, [], this.opts);
59
+ const { txSig } = await super.sendTransaction(tx, [], this.opts);
60
60
  return [txSig];
61
61
  }
62
62
  async initializeSpotMarket(mint, optimalUtilization, optimalRate, maxRate, oracle, oracleSource, initialAssetWeight, maintenanceAssetWeight, initialLiabilityWeight, maintenanceLiabilityWeight, imfFactor = 0, liquidatorFee = 0, activeStatus = true, name = userName_1.DEFAULT_MARKET_NAME) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/sdk",
3
- "version": "2.67.0-beta.3",
3
+ "version": "2.67.0-beta.5",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "author": "crispheaney",
@@ -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.oraclesToPoll.has(oracleInfo.publicKey.toString())
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
- const oracleToPoll = this.oraclesToPoll.get(oracleString);
407
- await this.addOracleToAccountLoader(oracleToPoll);
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
 
@@ -65,7 +65,7 @@ export class AdminClient extends DriftClient {
65
65
 
66
66
  const tx = await this.buildTransaction(initializeIx);
67
67
 
68
- const { txSig } = await this.sendTransaction(tx, [], this.opts);
68
+ const { txSig } = await super.sendTransaction(tx, [], this.opts);
69
69
 
70
70
  return [txSig];
71
71
  }