@drift-labs/sdk 2.10.0-beta.1 → 2.10.0-beta.2

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.
@@ -214,19 +214,28 @@ class PollingDriftClientAccountSubscriber {
214
214
  this.isSubscribed = false;
215
215
  }
216
216
  async addSpotMarket(marketIndex) {
217
+ const marketPublicKey = await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, marketIndex);
218
+ if (this.accountsToPoll.has(marketPublicKey.toString())) {
219
+ return true;
220
+ }
217
221
  await this.addSpotMarketAccountToPoll(marketIndex);
218
- const accountToPoll = this.accountsToPoll.get(marketIndex.toString());
222
+ const accountToPoll = this.accountsToPoll.get(marketPublicKey.toString());
219
223
  await this.addAccountToAccountLoader(accountToPoll);
220
224
  return true;
221
225
  }
222
226
  async addPerpMarket(marketIndex) {
227
+ const marketPublicKey = await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, marketIndex);
228
+ if (this.accountsToPoll.has(marketPublicKey.toString())) {
229
+ return true;
230
+ }
223
231
  await this.addPerpMarketAccountToPoll(marketIndex);
224
- const accountToPoll = this.accountsToPoll.get(marketIndex.toString());
232
+ const accountToPoll = this.accountsToPoll.get(marketPublicKey.toString());
225
233
  await this.addAccountToAccountLoader(accountToPoll);
226
234
  return true;
227
235
  }
228
236
  async addOracle(oracleInfo) {
229
- if (oracleInfo.publicKey.equals(web3_js_1.PublicKey.default)) {
237
+ if (oracleInfo.publicKey.equals(web3_js_1.PublicKey.default) ||
238
+ this.oraclesToPoll.has(oracleInfo.publicKey.toString())) {
230
239
  return true;
231
240
  }
232
241
  this.addOracleToPoll(oracleInfo);
@@ -54,7 +54,7 @@ class AdminClient extends driftClient_1.DriftClient {
54
54
  tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
55
55
  },
56
56
  });
57
- const { txSig: initializeTxSig } = await this.txSender.send(initializeTx, [], this.opts);
57
+ const { txSig: initializeTxSig } = await super.sendTransaction(initializeTx, [], this.opts);
58
58
  return [initializeTxSig];
59
59
  }
60
60
  async initializeSpotMarket(mint, optimalUtilization, optimalRate, maxRate, oracle, oracleSource, initialAssetWeight, maintenanceAssetWeight, initialLiabilityWeight, maintenanceLiabilityWeight, imfFactor = 0, liquidatorFee = 0, activeStatus = true, name = userName_1.DEFAULT_MARKET_NAME) {
@@ -78,7 +78,7 @@ class AdminClient extends driftClient_1.DriftClient {
78
78
  tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
79
79
  },
80
80
  });
81
- const { txSig } = await this.txSender.send(initializeTx, [], this.opts);
81
+ const { txSig } = await this.sendTransaction(initializeTx, [], this.opts);
82
82
  await this.accountSubscriber.addSpotMarket(spotMarketIndex);
83
83
  await this.accountSubscriber.addOracle({
84
84
  source: oracleSource,
@@ -89,7 +89,7 @@ class AdminClient extends driftClient_1.DriftClient {
89
89
  async initializeSerumFulfillmentConfig(marketIndex, serumMarket, serumProgram) {
90
90
  const serumOpenOrders = (0, pda_1.getSerumOpenOrdersPublicKey)(this.program.programId, serumMarket);
91
91
  const serumFulfillmentConfig = (0, pda_1.getSerumFulfillmentConfigPublicKey)(this.program.programId, serumMarket);
92
- return await this.program.rpc.initializeSerumFulfillmentConfig(marketIndex, {
92
+ const tx = await this.program.transaction.initializeSerumFulfillmentConfig(marketIndex, {
93
93
  accounts: {
94
94
  admin: this.wallet.publicKey,
95
95
  state: await this.getStatePublicKey(),
@@ -104,9 +104,12 @@ class AdminClient extends driftClient_1.DriftClient {
104
104
  serumFulfillmentConfig,
105
105
  },
106
106
  });
107
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
108
+ return txSig;
107
109
  }
108
110
  async initializePerpMarket(priceOracle, baseAssetReserve, quoteAssetReserve, periodicity, pegMultiplier = numericConstants_1.PEG_PRECISION, oracleSource = types_1.OracleSource.PYTH, marginRatioInitial = 2000, marginRatioMaintenance = 500, liquidatorFee = 0, activeStatus = true, name = userName_1.DEFAULT_MARKET_NAME) {
109
- const perpMarketPublicKey = await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, this.getStateAccount().numberOfMarkets);
111
+ const currentPerpMarketIndex = this.getStateAccount().numberOfMarkets;
112
+ const perpMarketPublicKey = await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, currentPerpMarketIndex);
110
113
  const nameBuffer = (0, userName_1.encodeName)(name);
111
114
  const initializeMarketTx = await this.program.transaction.initializePerpMarket(baseAssetReserve, quoteAssetReserve, periodicity, pegMultiplier, oracleSource, marginRatioInitial, marginRatioMaintenance, liquidatorFee, activeStatus, nameBuffer, {
112
115
  accounts: {
@@ -118,8 +121,11 @@ class AdminClient extends driftClient_1.DriftClient {
118
121
  systemProgram: anchor.web3.SystemProgram.programId,
119
122
  },
120
123
  });
121
- const { txSig } = await this.txSender.send(initializeMarketTx, [], this.opts);
122
- await this.accountSubscriber.addPerpMarket(this.getStateAccount().numberOfMarkets);
124
+ const { txSig } = await this.sendTransaction(initializeMarketTx, [], this.opts);
125
+ while (this.getStateAccount().numberOfMarkets <= currentPerpMarketIndex) {
126
+ await this.fetchAccounts();
127
+ }
128
+ await this.accountSubscriber.addPerpMarket(currentPerpMarketIndex);
123
129
  await this.accountSubscriber.addOracle({
124
130
  source: oracleSource,
125
131
  publicKey: priceOracle,
@@ -131,16 +137,18 @@ class AdminClient extends driftClient_1.DriftClient {
131
137
  if (sqrtK == undefined) {
132
138
  sqrtK = (0, utils_1.squareRootBN)(baseAssetReserve.mul(quoteAssetReserve));
133
139
  }
134
- return await this.program.rpc.moveAmmPrice(baseAssetReserve, quoteAssetReserve, sqrtK, {
140
+ const tx = await this.program.transaction.moveAmmPrice(baseAssetReserve, quoteAssetReserve, sqrtK, {
135
141
  accounts: {
136
142
  state: await this.getStatePublicKey(),
137
143
  admin: this.wallet.publicKey,
138
144
  perpMarket: marketPublicKey,
139
145
  },
140
146
  });
147
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
148
+ return txSig;
141
149
  }
142
150
  async updateK(perpMarketIndex, sqrtK) {
143
- return await this.program.rpc.updateK(sqrtK, {
151
+ const tx = await this.program.transaction.updateK(sqrtK, {
144
152
  accounts: {
145
153
  state: await this.getStatePublicKey(),
146
154
  admin: this.wallet.publicKey,
@@ -148,6 +156,8 @@ class AdminClient extends driftClient_1.DriftClient {
148
156
  oracle: this.getPerpMarketAccount(perpMarketIndex).amm.oracle,
149
157
  },
150
158
  });
159
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
160
+ return txSig;
151
161
  }
152
162
  async updatePerpMarketConcentrationScale(perpMarketIndex, concentrationScale) {
153
163
  return await this.program.rpc.updatePerpMarketConcentrationCoef(concentrationScale, {
@@ -164,18 +174,20 @@ class AdminClient extends driftClient_1.DriftClient {
164
174
  );
165
175
  const [newQuoteAssetAmount, newBaseAssetAmount] = (0, amm_1.calculateAmmReservesAfterSwap)(perpMarket.amm, 'quote', tradeSize, (0, amm_1.getSwapDirection)('quote', direction));
166
176
  const perpMarketPublicKey = await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex);
167
- return await this.program.rpc.moveAmmPrice(newBaseAssetAmount, newQuoteAssetAmount, perpMarket.amm.sqrtK, {
177
+ const tx = await this.program.transaction.moveAmmPrice(newBaseAssetAmount, newQuoteAssetAmount, perpMarket.amm.sqrtK, {
168
178
  accounts: {
169
179
  state: await this.getStatePublicKey(),
170
180
  admin: this.wallet.publicKey,
171
181
  perpMarket: perpMarketPublicKey,
172
182
  },
173
183
  });
184
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
185
+ return txSig;
174
186
  }
175
187
  async repegAmmCurve(newPeg, perpMarketIndex) {
176
188
  const perpMarketPublicKey = await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex);
177
189
  const ammData = this.getPerpMarketAccount(perpMarketIndex).amm;
178
- return await this.program.rpc.repegAmmCurve(newPeg, {
190
+ const tx = await this.program.transaction.repegAmmCurve(newPeg, {
179
191
  accounts: {
180
192
  state: await this.getStatePublicKey(),
181
193
  admin: this.wallet.publicKey,
@@ -183,6 +195,8 @@ class AdminClient extends driftClient_1.DriftClient {
183
195
  perpMarket: perpMarketPublicKey,
184
196
  },
185
197
  });
198
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
199
+ return txSig;
186
200
  }
187
201
  async updatePerpMarketAmmOracleTwap(perpMarketIndex) {
188
202
  const ammData = this.getPerpMarketAccount(perpMarketIndex).amm;
@@ -210,7 +224,7 @@ class AdminClient extends driftClient_1.DriftClient {
210
224
  }
211
225
  async depositIntoPerpMarketFeePool(perpMarketIndex, amount, sourceVault) {
212
226
  const spotMarket = this.getQuoteSpotMarketAccount();
213
- return await this.program.rpc.depositIntoPerpMarketFeePool(amount, {
227
+ const tx = await this.program.transaction.depositIntoPerpMarketFeePool(amount, {
214
228
  accounts: {
215
229
  admin: this.wallet.publicKey,
216
230
  state: await this.getStatePublicKey(),
@@ -222,14 +236,18 @@ class AdminClient extends driftClient_1.DriftClient {
222
236
  tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
223
237
  },
224
238
  });
239
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
240
+ return txSig;
225
241
  }
226
242
  async updateAdmin(admin) {
227
- return await this.program.rpc.updateAdmin(admin, {
243
+ const tx = await this.program.transaction.updateAdmin(admin, {
228
244
  accounts: {
229
245
  admin: this.wallet.publicKey,
230
246
  state: await this.getStatePublicKey(),
231
247
  },
232
248
  });
249
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
250
+ return txSig;
233
251
  }
234
252
  async updatePerpMarketCurveUpdateIntensity(perpMarketIndex, curveUpdateIntensity) {
235
253
  // assert(curveUpdateIntensity >= 0 && curveUpdateIntensity <= 100);
@@ -243,13 +261,15 @@ class AdminClient extends driftClient_1.DriftClient {
243
261
  });
244
262
  }
245
263
  async updatePerpMarketMarginRatio(perpMarketIndex, marginRatioInitial, marginRatioMaintenance) {
246
- return await this.program.rpc.updatePerpMarketMarginRatio(marginRatioInitial, marginRatioMaintenance, {
264
+ const tx = await this.program.transaction.updatePerpMarketMarginRatio(marginRatioInitial, marginRatioMaintenance, {
247
265
  accounts: {
248
266
  admin: this.wallet.publicKey,
249
267
  state: await this.getStatePublicKey(),
250
268
  perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
251
269
  },
252
270
  });
271
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
272
+ return txSig;
253
273
  }
254
274
  async updatePerpMarketImfFactor(perpMarketIndex, imfFactor, unrealizedPnlImfFactor) {
255
275
  return await this.program.rpc.updatePerpMarketImfFactor(imfFactor, unrealizedPnlImfFactor, {
@@ -261,32 +281,38 @@ class AdminClient extends driftClient_1.DriftClient {
261
281
  });
262
282
  }
263
283
  async updatePerpMarketBaseSpread(perpMarketIndex, baseSpread) {
264
- return await this.program.rpc.updatePerpMarketBaseSpread(baseSpread, {
284
+ const tx = await this.program.transaction.updatePerpMarketBaseSpread(baseSpread, {
265
285
  accounts: {
266
286
  admin: this.wallet.publicKey,
267
287
  state: await this.getStatePublicKey(),
268
288
  perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
269
289
  },
270
290
  });
291
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
292
+ return txSig;
271
293
  }
272
294
  async updateAmmJitIntensity(perpMarketIndex, ammJitIntensity) {
273
- return await this.program.rpc.updateAmmJitIntensity(ammJitIntensity, {
295
+ const tx = await this.program.transaction.updateAmmJitIntensity(ammJitIntensity, {
274
296
  accounts: {
275
297
  admin: this.wallet.publicKey,
276
298
  state: await this.getStatePublicKey(),
277
299
  perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
278
300
  },
279
301
  });
302
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
303
+ return txSig;
280
304
  }
281
305
  async updatePerpMarketName(perpMarketIndex, name) {
282
306
  const nameBuffer = (0, userName_1.encodeName)(name);
283
- return await this.program.rpc.updatePerpMarketName(nameBuffer, {
307
+ const tx = await this.program.transaction.updatePerpMarketName(nameBuffer, {
284
308
  accounts: {
285
309
  admin: this.wallet.publicKey,
286
310
  state: await this.getStatePublicKey(),
287
311
  perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
288
312
  },
289
313
  });
314
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
315
+ return txSig;
290
316
  }
291
317
  async updateSpotMarketName(spotMarketIndex, name) {
292
318
  const nameBuffer = (0, userName_1.encodeName)(name);
@@ -309,20 +335,24 @@ class AdminClient extends driftClient_1.DriftClient {
309
335
  });
310
336
  }
311
337
  async updatePerpFeeStructure(feeStructure) {
312
- return await this.program.rpc.updatePerpFeeStructure(feeStructure, {
338
+ const tx = this.program.transaction.updatePerpFeeStructure(feeStructure, {
313
339
  accounts: {
314
340
  admin: this.wallet.publicKey,
315
341
  state: await this.getStatePublicKey(),
316
342
  },
317
343
  });
344
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
345
+ return txSig;
318
346
  }
319
347
  async updateSpotFeeStructure(feeStructure) {
320
- return await this.program.rpc.updateSpotFeeStructure(feeStructure, {
348
+ const tx = await this.program.transaction.updateSpotFeeStructure(feeStructure, {
321
349
  accounts: {
322
350
  admin: this.wallet.publicKey,
323
351
  state: await this.getStatePublicKey(),
324
352
  },
325
353
  });
354
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
355
+ return txSig;
326
356
  }
327
357
  async updateInitialPctToLiquidate(initialPctToLiquidate) {
328
358
  return await this.program.rpc.updateInitialPctToLiquidate(initialPctToLiquidate, {
@@ -341,12 +371,14 @@ class AdminClient extends driftClient_1.DriftClient {
341
371
  });
342
372
  }
343
373
  async updateOracleGuardRails(oracleGuardRails) {
344
- return await this.program.rpc.updateOracleGuardRails(oracleGuardRails, {
374
+ const tx = await this.program.transaction.updateOracleGuardRails(oracleGuardRails, {
345
375
  accounts: {
346
376
  admin: this.wallet.publicKey,
347
377
  state: await this.getStatePublicKey(),
348
378
  },
349
379
  });
380
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
381
+ return txSig;
350
382
  }
351
383
  async updateStateSettlementDuration(settlementDuration) {
352
384
  return await this.program.rpc.updateStateSettlementDuration(settlementDuration, {
@@ -357,60 +389,72 @@ class AdminClient extends driftClient_1.DriftClient {
357
389
  });
358
390
  }
359
391
  async updateWithdrawGuardThreshold(spotMarketIndex, withdrawGuardThreshold) {
360
- return await this.program.rpc.updateWithdrawGuardThreshold(withdrawGuardThreshold, {
392
+ const tx = await this.program.transaction.updateWithdrawGuardThreshold(withdrawGuardThreshold, {
361
393
  accounts: {
362
394
  admin: this.wallet.publicKey,
363
395
  state: await this.getStatePublicKey(),
364
396
  spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
365
397
  },
366
398
  });
399
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
400
+ return txSig;
367
401
  }
368
402
  async updateSpotMarketIfFactor(spotMarketIndex, userIfFactor, totalIfFactor) {
369
- return await this.program.rpc.updateSpotMarketIfFactor(spotMarketIndex, userIfFactor, totalIfFactor, {
403
+ const tx = await this.program.transaction.updateSpotMarketIfFactor(spotMarketIndex, userIfFactor, totalIfFactor, {
370
404
  accounts: {
371
405
  admin: this.wallet.publicKey,
372
406
  state: await this.getStatePublicKey(),
373
407
  spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
374
408
  },
375
409
  });
410
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
411
+ return txSig;
376
412
  }
377
413
  async updateSpotMarketRevenueSettlePeriod(spotMarketIndex, revenueSettlePeriod) {
378
- return await this.program.rpc.updateSpotMarketRevenueSettlePeriod(revenueSettlePeriod, {
414
+ const tx = await this.program.transaction.updateSpotMarketRevenueSettlePeriod(revenueSettlePeriod, {
379
415
  accounts: {
380
416
  admin: this.wallet.publicKey,
381
417
  state: await this.getStatePublicKey(),
382
418
  spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
383
419
  },
384
420
  });
421
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
422
+ return txSig;
385
423
  }
386
424
  async updateSpotMarketMaxTokenDeposits(spotMarketIndex, maxTokenDeposits) {
387
- return await this.program.rpc.updateSpotMarketMaxTokenDeposits(maxTokenDeposits, {
425
+ const tx = this.program.transaction.updateSpotMarketMaxTokenDeposits(maxTokenDeposits, {
388
426
  accounts: {
389
427
  admin: this.wallet.publicKey,
390
428
  state: await this.getStatePublicKey(),
391
429
  spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
392
430
  },
393
431
  });
432
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
433
+ return txSig;
394
434
  }
395
435
  async updateInsuranceFundUnstakingPeriod(spotMarketIndex, insuranceWithdrawEscrowPeriod) {
396
- return await this.program.rpc.updateInsuranceFundUnstakingPeriod(insuranceWithdrawEscrowPeriod, {
436
+ const tx = await this.program.transaction.updateInsuranceFundUnstakingPeriod(insuranceWithdrawEscrowPeriod, {
397
437
  accounts: {
398
438
  admin: this.wallet.publicKey,
399
439
  state: await this.getStatePublicKey(),
400
440
  spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
401
441
  },
402
442
  });
443
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
444
+ return txSig;
403
445
  }
404
446
  async updateLpCooldownTime(cooldownTime) {
405
- return await this.program.rpc.updateLpCooldownTime(cooldownTime, {
447
+ const tx = await this.program.transaction.updateLpCooldownTime(cooldownTime, {
406
448
  accounts: {
407
449
  admin: this.wallet.publicKey,
408
450
  state: await this.getStatePublicKey(),
409
451
  },
410
452
  });
453
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
454
+ return txSig;
411
455
  }
412
456
  async updatePerpMarketOracle(perpMarketIndex, oracle, oracleSource) {
413
- return await this.program.rpc.updatePerpMarketOracle(oracle, oracleSource, {
457
+ const tx = await this.program.transaction.updatePerpMarketOracle(oracle, oracleSource, {
414
458
  accounts: {
415
459
  admin: this.wallet.publicKey,
416
460
  state: await this.getStatePublicKey(),
@@ -418,15 +462,19 @@ class AdminClient extends driftClient_1.DriftClient {
418
462
  oracle: oracle,
419
463
  },
420
464
  });
465
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
466
+ return txSig;
421
467
  }
422
468
  async updatePerpMarketStepSizeAndTickSize(perpMarketIndex, stepSize, tickSize) {
423
- return await this.program.rpc.updatePerpMarketStepSizeAndTickSize(stepSize, tickSize, {
469
+ const tx = await this.program.transaction.updatePerpMarketStepSizeAndTickSize(stepSize, tickSize, {
424
470
  accounts: {
425
471
  admin: this.wallet.publicKey,
426
472
  state: await this.getStatePublicKey(),
427
473
  perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
428
474
  },
429
475
  });
476
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
477
+ return txSig;
430
478
  }
431
479
  async updatePerpMarketMinOrderSize(perpMarketIndex, orderSize) {
432
480
  return await this.program.rpc.updatePerpMarketMinOrderSize(orderSize, {
@@ -502,20 +550,24 @@ class AdminClient extends driftClient_1.DriftClient {
502
550
  });
503
551
  }
504
552
  async updateWhitelistMint(whitelistMint) {
505
- return await this.program.rpc.updateWhitelistMint(whitelistMint, {
553
+ const tx = await this.program.transaction.updateWhitelistMint(whitelistMint, {
506
554
  accounts: {
507
555
  admin: this.wallet.publicKey,
508
556
  state: await this.getStatePublicKey(),
509
557
  },
510
558
  });
559
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
560
+ return txSig;
511
561
  }
512
562
  async updateDiscountMint(discountMint) {
513
- return await this.program.rpc.updateDiscountMint(discountMint, {
563
+ const tx = await this.program.transaction.updateDiscountMint(discountMint, {
514
564
  accounts: {
515
565
  admin: this.wallet.publicKey,
516
566
  state: await this.getStatePublicKey(),
517
567
  },
518
568
  });
569
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
570
+ return txSig;
519
571
  }
520
572
  async updateSpotMarketMarginWeights(spotMarketIndex, initialAssetWeight, maintenanceAssetWeight, initialLiabilityWeight, maintenanceLiabilityWeight, imfFactor = 0) {
521
573
  return await this.program.rpc.updateSpotMarketMarginWeights(initialAssetWeight, maintenanceAssetWeight, initialLiabilityWeight, maintenanceLiabilityWeight, imfFactor, {
@@ -536,48 +588,58 @@ class AdminClient extends driftClient_1.DriftClient {
536
588
  });
537
589
  }
538
590
  async updateSpotMarketAssetTier(spotMarketIndex, assetTier) {
539
- return await this.program.rpc.updateSpotMarketAssetTier(assetTier, {
591
+ const tx = await this.program.transaction.updateSpotMarketAssetTier(assetTier, {
540
592
  accounts: {
541
593
  admin: this.wallet.publicKey,
542
594
  state: await this.getStatePublicKey(),
543
595
  spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
544
596
  },
545
597
  });
598
+ const { txSig } = await this.sendTransaction(tx);
599
+ return txSig;
546
600
  }
547
601
  async updateSpotMarketStatus(spotMarketIndex, marketStatus) {
548
- return await this.program.rpc.updateSpotMarketStatus(marketStatus, {
602
+ const tx = await this.program.transaction.updateSpotMarketStatus(marketStatus, {
549
603
  accounts: {
550
604
  admin: this.wallet.publicKey,
551
605
  state: await this.getStatePublicKey(),
552
606
  spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
553
607
  },
554
608
  });
609
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
610
+ return txSig;
555
611
  }
556
612
  async updatePerpMarketStatus(perpMarketIndex, marketStatus) {
557
- return await this.program.rpc.updatePerpMarketStatus(marketStatus, {
613
+ const tx = await this.program.transaction.updatePerpMarketStatus(marketStatus, {
558
614
  accounts: {
559
615
  admin: this.wallet.publicKey,
560
616
  state: await this.getStatePublicKey(),
561
617
  perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
562
618
  },
563
619
  });
620
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
621
+ return txSig;
564
622
  }
565
623
  async updatePerpMarketContractTier(perpMarketIndex, contractTier) {
566
- return await this.program.rpc.updatePerpMarketContractTier(contractTier, {
624
+ const tx = await this.program.transaction.updatePerpMarketContractTier(contractTier, {
567
625
  accounts: {
568
626
  admin: this.wallet.publicKey,
569
627
  state: await this.getStatePublicKey(),
570
628
  perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
571
629
  },
572
630
  });
631
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
632
+ return txSig;
573
633
  }
574
634
  async updateExchangeStatus(exchangeStatus) {
575
- return await this.program.rpc.updateExchangeStatus(exchangeStatus, {
635
+ const tx = await this.program.transaction.updateExchangeStatus(exchangeStatus, {
576
636
  accounts: {
577
637
  admin: this.wallet.publicKey,
578
638
  state: await this.getStatePublicKey(),
579
639
  },
580
640
  });
641
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
642
+ return txSig;
581
643
  }
582
644
  async updatePerpAuctionDuration(minDuration) {
583
645
  return await this.program.rpc.updatePerpAuctionDuration(typeof minDuration === 'number' ? minDuration : minDuration.toNumber(), {
@@ -3,12 +3,12 @@
3
3
  import { AnchorProvider, BN, Program } from '@project-serum/anchor';
4
4
  import { StateAccount, IWallet, PositionDirection, UserAccount, PerpMarketAccount, OrderParams, Order, SpotMarketAccount, SpotPosition, MakerInfo, TakerInfo, OptionalOrderParams, ReferrerInfo, MarketType, SerumV3FulfillmentConfigAccount } from './types';
5
5
  import * as anchor from '@project-serum/anchor';
6
- import { Connection, PublicKey, TransactionSignature, ConfirmOptions, Transaction, TransactionInstruction, AccountMeta } from '@solana/web3.js';
6
+ import { Connection, PublicKey, TransactionSignature, ConfirmOptions, Transaction, TransactionInstruction, AccountMeta, Signer } from '@solana/web3.js';
7
7
  import { TokenFaucet } from './tokenFaucet';
8
8
  import { EventEmitter } from 'events';
9
9
  import StrictEventEmitter from 'strict-event-emitter-types';
10
10
  import { DriftClientAccountSubscriber, DriftClientAccountEvents, DataAndSlot } from './accounts/types';
11
- import { TxSender } from './tx/types';
11
+ import { TxSender, TxSigAndSlot } from './tx/types';
12
12
  import { OraclePriceData } from './oracles/types';
13
13
  import { DriftClientConfig } from './driftClientConfig';
14
14
  import { User } from './user';
@@ -253,5 +253,6 @@ export declare class DriftClient {
253
253
  settleRevenueToInsuranceFund(marketIndex: number): Promise<TransactionSignature>;
254
254
  resolvePerpPnlDeficit(spotMarketIndex: number, perpMarketIndex: number): Promise<TransactionSignature>;
255
255
  getResolvePerpPnlDeficitIx(spotMarketIndex: number, perpMarketIndex: number): Promise<TransactionInstruction>;
256
+ sendTransaction(tx: Transaction, additionalSigners?: Array<Signer>, opts?: ConfirmOptions, preSigned?: boolean): Promise<TxSigAndSlot>;
256
257
  }
257
258
  export {};