@drift-labs/sdk 2.75.0-beta.1 → 2.75.0-beta.3

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.
@@ -186,8 +186,14 @@ class AdminClient extends driftClient_1.DriftClient {
186
186
  });
187
187
  }
188
188
  async deleteInitializedPerpMarket(marketIndex) {
189
+ const deleteInitializeMarketIx = await this.getDeleteInitializedPerpMarketIx(marketIndex);
190
+ const tx = await this.buildTransaction(deleteInitializeMarketIx);
191
+ const { txSig } = await this.sendTransaction(tx, [], this.opts);
192
+ return txSig;
193
+ }
194
+ async getDeleteInitializedPerpMarketIx(marketIndex) {
189
195
  const perpMarketPublicKey = await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, marketIndex);
190
- const deleteInitializeMarketIx = await this.program.instruction.deleteInitializedPerpMarket(marketIndex, {
196
+ return await this.program.instruction.deleteInitializedPerpMarket(marketIndex, {
191
197
  accounts: {
192
198
  state: await this.getStatePublicKey(),
193
199
  admin: this.isSubscribed
@@ -196,16 +202,19 @@ class AdminClient extends driftClient_1.DriftClient {
196
202
  perpMarket: perpMarketPublicKey,
197
203
  },
198
204
  });
199
- const tx = await this.buildTransaction(deleteInitializeMarketIx);
205
+ }
206
+ async moveAmmPrice(perpMarketIndex, baseAssetReserve, quoteAssetReserve, sqrtK) {
207
+ const moveAmmPriceIx = await this.getMoveAmmPriceIx(perpMarketIndex, baseAssetReserve, quoteAssetReserve, sqrtK);
208
+ const tx = await this.buildTransaction(moveAmmPriceIx);
200
209
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
201
210
  return txSig;
202
211
  }
203
- async moveAmmPrice(perpMarketIndex, baseAssetReserve, quoteAssetReserve, sqrtK) {
212
+ async getMoveAmmPriceIx(perpMarketIndex, baseAssetReserve, quoteAssetReserve, sqrtK) {
204
213
  const marketPublicKey = await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex);
205
214
  if (sqrtK == undefined) {
206
215
  sqrtK = (0, utils_1.squareRootBN)(baseAssetReserve.mul(quoteAssetReserve));
207
216
  }
208
- const moveAmmPriceIx = await this.program.instruction.moveAmmPrice(baseAssetReserve, quoteAssetReserve, sqrtK, {
217
+ return await this.program.instruction.moveAmmPrice(baseAssetReserve, quoteAssetReserve, sqrtK, {
209
218
  accounts: {
210
219
  state: await this.getStatePublicKey(),
211
220
  admin: this.isSubscribed
@@ -214,12 +223,15 @@ class AdminClient extends driftClient_1.DriftClient {
214
223
  perpMarket: marketPublicKey,
215
224
  },
216
225
  });
217
- const tx = await this.buildTransaction(moveAmmPriceIx);
226
+ }
227
+ async updateK(perpMarketIndex, sqrtK) {
228
+ const updateKIx = await this.getUpdateKIx(perpMarketIndex, sqrtK);
229
+ const tx = await this.buildTransaction(updateKIx);
218
230
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
219
231
  return txSig;
220
232
  }
221
- async updateK(perpMarketIndex, sqrtK) {
222
- const updateKIx = await this.program.instruction.updateK(sqrtK, {
233
+ async getUpdateKIx(perpMarketIndex, sqrtK) {
234
+ return await this.program.instruction.updateK(sqrtK, {
223
235
  accounts: {
224
236
  state: await this.getStatePublicKey(),
225
237
  admin: this.isSubscribed
@@ -229,13 +241,16 @@ class AdminClient extends driftClient_1.DriftClient {
229
241
  oracle: this.getPerpMarketAccount(perpMarketIndex).amm.oracle,
230
242
  },
231
243
  });
232
- const tx = await this.buildTransaction(updateKIx);
244
+ }
245
+ async recenterPerpMarketAmm(perpMarketIndex, pegMultiplier, sqrtK) {
246
+ const recenterPerpMarketAmmIx = await this.getRecenterPerpMarketAmmIx(perpMarketIndex, pegMultiplier, sqrtK);
247
+ const tx = await this.buildTransaction(recenterPerpMarketAmmIx);
233
248
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
234
249
  return txSig;
235
250
  }
236
- async recenterPerpMarketAmm(perpMarketIndex, pegMultiplier, sqrtK) {
251
+ async getRecenterPerpMarketAmmIx(perpMarketIndex, pegMultiplier, sqrtK) {
237
252
  const marketPublicKey = await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex);
238
- const recenterPerpMarketAmmIx = await this.program.instruction.recenterPerpMarketAmm(pegMultiplier, sqrtK, {
253
+ return await this.program.instruction.recenterPerpMarketAmm(pegMultiplier, sqrtK, {
239
254
  accounts: {
240
255
  state: await this.getStatePublicKey(),
241
256
  admin: this.isSubscribed
@@ -244,12 +259,15 @@ class AdminClient extends driftClient_1.DriftClient {
244
259
  perpMarket: marketPublicKey,
245
260
  },
246
261
  });
247
- const tx = await this.buildTransaction(recenterPerpMarketAmmIx);
262
+ }
263
+ async updatePerpMarketConcentrationScale(perpMarketIndex, concentrationScale) {
264
+ const updatePerpMarketConcentrationCoefIx = await this.getUpdatePerpMarketConcentrationScaleIx(perpMarketIndex, concentrationScale);
265
+ const tx = await this.buildTransaction(updatePerpMarketConcentrationCoefIx);
248
266
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
249
267
  return txSig;
250
268
  }
251
- async updatePerpMarketConcentrationScale(perpMarketIndex, concentrationScale) {
252
- const updatePerpMarketConcentrationCoefIx = await this.program.instruction.updatePerpMarketConcentrationCoef(concentrationScale, {
269
+ async getUpdatePerpMarketConcentrationScaleIx(perpMarketIndex, concentrationScale) {
270
+ return await this.program.instruction.updatePerpMarketConcentrationCoef(concentrationScale, {
253
271
  accounts: {
254
272
  state: await this.getStatePublicKey(),
255
273
  admin: this.isSubscribed
@@ -258,17 +276,20 @@ class AdminClient extends driftClient_1.DriftClient {
258
276
  perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
259
277
  },
260
278
  });
261
- const tx = await this.buildTransaction(updatePerpMarketConcentrationCoefIx);
279
+ }
280
+ async moveAmmToPrice(perpMarketIndex, targetPrice) {
281
+ const moveAmmPriceIx = await this.getMoveAmmToPriceIx(perpMarketIndex, targetPrice);
282
+ const tx = await this.buildTransaction(moveAmmPriceIx);
262
283
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
263
284
  return txSig;
264
285
  }
265
- async moveAmmToPrice(perpMarketIndex, targetPrice) {
286
+ async getMoveAmmToPriceIx(perpMarketIndex, targetPrice) {
266
287
  const perpMarket = this.getPerpMarketAccount(perpMarketIndex);
267
288
  const [direction, tradeSize, _] = (0, trade_1.calculateTargetPriceTrade)(perpMarket, targetPrice, new anchor_1.BN(1000), 'quote', undefined //todo
268
289
  );
269
290
  const [newQuoteAssetAmount, newBaseAssetAmount] = (0, amm_1.calculateAmmReservesAfterSwap)(perpMarket.amm, 'quote', tradeSize, (0, amm_1.getSwapDirection)('quote', direction));
270
291
  const perpMarketPublicKey = await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex);
271
- const moveAmmPriceIx = await this.program.instruction.moveAmmPrice(newBaseAssetAmount, newQuoteAssetAmount, perpMarket.amm.sqrtK, {
292
+ return await this.program.instruction.moveAmmPrice(newBaseAssetAmount, newQuoteAssetAmount, perpMarket.amm.sqrtK, {
272
293
  accounts: {
273
294
  state: await this.getStatePublicKey(),
274
295
  admin: this.isSubscribed
@@ -277,14 +298,17 @@ class AdminClient extends driftClient_1.DriftClient {
277
298
  perpMarket: perpMarketPublicKey,
278
299
  },
279
300
  });
280
- const tx = await this.buildTransaction(moveAmmPriceIx);
301
+ }
302
+ async repegAmmCurve(newPeg, perpMarketIndex) {
303
+ const repegAmmCurveIx = await this.getRepegAmmCurveIx(newPeg, perpMarketIndex);
304
+ const tx = await this.buildTransaction(repegAmmCurveIx);
281
305
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
282
306
  return txSig;
283
307
  }
284
- async repegAmmCurve(newPeg, perpMarketIndex) {
308
+ async getRepegAmmCurveIx(newPeg, perpMarketIndex) {
285
309
  const perpMarketPublicKey = await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex);
286
310
  const ammData = this.getPerpMarketAccount(perpMarketIndex).amm;
287
- const repegAmmCurveIx = await this.program.instruction.repegAmmCurve(newPeg, {
311
+ return await this.program.instruction.repegAmmCurve(newPeg, {
288
312
  accounts: {
289
313
  state: await this.getStatePublicKey(),
290
314
  admin: this.isSubscribed
@@ -294,14 +318,17 @@ class AdminClient extends driftClient_1.DriftClient {
294
318
  perpMarket: perpMarketPublicKey,
295
319
  },
296
320
  });
297
- const tx = await this.buildTransaction(repegAmmCurveIx);
321
+ }
322
+ async updatePerpMarketAmmOracleTwap(perpMarketIndex) {
323
+ const updatePerpMarketAmmOracleTwapIx = await this.getUpdatePerpMarketAmmOracleTwapIx(perpMarketIndex);
324
+ const tx = await this.buildTransaction(updatePerpMarketAmmOracleTwapIx);
298
325
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
299
326
  return txSig;
300
327
  }
301
- async updatePerpMarketAmmOracleTwap(perpMarketIndex) {
328
+ async getUpdatePerpMarketAmmOracleTwapIx(perpMarketIndex) {
302
329
  const ammData = this.getPerpMarketAccount(perpMarketIndex).amm;
303
330
  const perpMarketPublicKey = await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex);
304
- const updatePerpMarketAmmOracleTwapIx = await this.program.instruction.updatePerpMarketAmmOracleTwap({
331
+ return await this.program.instruction.updatePerpMarketAmmOracleTwap({
305
332
  accounts: {
306
333
  state: await this.getStatePublicKey(),
307
334
  admin: this.isSubscribed
@@ -311,14 +338,17 @@ class AdminClient extends driftClient_1.DriftClient {
311
338
  perpMarket: perpMarketPublicKey,
312
339
  },
313
340
  });
314
- const tx = await this.buildTransaction(updatePerpMarketAmmOracleTwapIx);
341
+ }
342
+ async resetPerpMarketAmmOracleTwap(perpMarketIndex) {
343
+ const resetPerpMarketAmmOracleTwapIx = await this.getResetPerpMarketAmmOracleTwapIx(perpMarketIndex);
344
+ const tx = await this.buildTransaction(resetPerpMarketAmmOracleTwapIx);
315
345
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
316
346
  return txSig;
317
347
  }
318
- async resetPerpMarketAmmOracleTwap(perpMarketIndex) {
348
+ async getResetPerpMarketAmmOracleTwapIx(perpMarketIndex) {
319
349
  const ammData = this.getPerpMarketAccount(perpMarketIndex).amm;
320
350
  const perpMarketPublicKey = await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex);
321
- const resetPerpMarketAmmOracleTwapIx = await this.program.instruction.resetPerpMarketAmmOracleTwap({
351
+ return await this.program.instruction.resetPerpMarketAmmOracleTwap({
322
352
  accounts: {
323
353
  state: await this.getStatePublicKey(),
324
354
  admin: this.isSubscribed
@@ -328,13 +358,16 @@ class AdminClient extends driftClient_1.DriftClient {
328
358
  perpMarket: perpMarketPublicKey,
329
359
  },
330
360
  });
331
- const tx = await this.buildTransaction(resetPerpMarketAmmOracleTwapIx);
361
+ }
362
+ async depositIntoPerpMarketFeePool(perpMarketIndex, amount, sourceVault) {
363
+ const depositIntoPerpMarketFeePoolIx = await this.getDepositIntoPerpMarketFeePoolIx(perpMarketIndex, amount, sourceVault);
364
+ const tx = await this.buildTransaction(depositIntoPerpMarketFeePoolIx);
332
365
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
333
366
  return txSig;
334
367
  }
335
- async depositIntoPerpMarketFeePool(perpMarketIndex, amount, sourceVault) {
368
+ async getDepositIntoPerpMarketFeePoolIx(perpMarketIndex, amount, sourceVault) {
336
369
  const spotMarket = this.getQuoteSpotMarketAccount();
337
- const depositIntoPerpMarketFeePoolIx = await this.program.instruction.depositIntoPerpMarketFeePool(amount, {
370
+ return await this.program.instruction.depositIntoPerpMarketFeePool(amount, {
338
371
  accounts: {
339
372
  admin: this.isSubscribed
340
373
  ? this.getStateAccount().admin
@@ -348,41 +381,31 @@ class AdminClient extends driftClient_1.DriftClient {
348
381
  tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
349
382
  },
350
383
  });
351
- const tx = await this.buildTransaction(depositIntoPerpMarketFeePoolIx);
352
- const { txSig } = await this.sendTransaction(tx, [], this.opts);
353
- return txSig;
354
384
  }
355
385
  async updateAdmin(admin) {
356
- const updateAdminIx = await this.program.instruction.updateAdmin(admin, {
357
- accounts: {
358
- admin: this.isSubscribed
359
- ? this.getStateAccount().admin
360
- : this.wallet.publicKey,
361
- state: await this.getStatePublicKey(),
362
- },
363
- });
386
+ const updateAdminIx = await this.getUpdateAdminIx(admin);
364
387
  const tx = await this.buildTransaction(updateAdminIx);
365
388
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
366
389
  return txSig;
367
390
  }
368
- async updatePerpMarketCurveUpdateIntensity(perpMarketIndex, curveUpdateIntensity) {
369
- // assert(curveUpdateIntensity >= 0 && curveUpdateIntensity <= 100);
370
- // assert(Number.isInteger(curveUpdateIntensity));
371
- const updatePerpMarketCurveUpdateIntensityIx = await this.program.instruction.updatePerpMarketCurveUpdateIntensity(curveUpdateIntensity, {
391
+ async getUpdateAdminIx(admin) {
392
+ return await this.program.instruction.updateAdmin(admin, {
372
393
  accounts: {
373
394
  admin: this.isSubscribed
374
395
  ? this.getStateAccount().admin
375
396
  : this.wallet.publicKey,
376
397
  state: await this.getStatePublicKey(),
377
- perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
378
398
  },
379
399
  });
400
+ }
401
+ async updatePerpMarketCurveUpdateIntensity(perpMarketIndex, curveUpdateIntensity) {
402
+ const updatePerpMarketCurveUpdateIntensityIx = await this.getUpdatePerpMarketCurveUpdateIntensityIx(perpMarketIndex, curveUpdateIntensity);
380
403
  const tx = await this.buildTransaction(updatePerpMarketCurveUpdateIntensityIx);
381
404
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
382
405
  return txSig;
383
406
  }
384
- async updatePerpMarketTargetBaseAssetAmountPerLp(perpMarketIndex, targetBaseAssetAmountPerLP) {
385
- const updatePerpMarketTargetBaseAssetAmountPerLpIx = await this.program.instruction.updatePerpMarketTargetBaseAssetAmountPerLp(targetBaseAssetAmountPerLP, {
407
+ async getUpdatePerpMarketCurveUpdateIntensityIx(perpMarketIndex, curveUpdateIntensity) {
408
+ return await this.program.instruction.updatePerpMarketCurveUpdateIntensity(curveUpdateIntensity, {
386
409
  accounts: {
387
410
  admin: this.isSubscribed
388
411
  ? this.getStateAccount().admin
@@ -391,12 +414,15 @@ class AdminClient extends driftClient_1.DriftClient {
391
414
  perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
392
415
  },
393
416
  });
417
+ }
418
+ async updatePerpMarketTargetBaseAssetAmountPerLp(perpMarketIndex, targetBaseAssetAmountPerLP) {
419
+ const updatePerpMarketTargetBaseAssetAmountPerLpIx = await this.getUpdatePerpMarketTargetBaseAssetAmountPerLpIx(perpMarketIndex, targetBaseAssetAmountPerLP);
394
420
  const tx = await this.buildTransaction(updatePerpMarketTargetBaseAssetAmountPerLpIx);
395
421
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
396
422
  return txSig;
397
423
  }
398
- async updatePerpMarketMarginRatio(perpMarketIndex, marginRatioInitial, marginRatioMaintenance) {
399
- const updatePerpMarketMarginRatioIx = await this.program.instruction.updatePerpMarketMarginRatio(marginRatioInitial, marginRatioMaintenance, {
424
+ async getUpdatePerpMarketTargetBaseAssetAmountPerLpIx(perpMarketIndex, targetBaseAssetAmountPerLP) {
425
+ return await this.program.instruction.updatePerpMarketTargetBaseAssetAmountPerLp(targetBaseAssetAmountPerLP, {
400
426
  accounts: {
401
427
  admin: this.isSubscribed
402
428
  ? this.getStateAccount().admin
@@ -405,12 +431,15 @@ class AdminClient extends driftClient_1.DriftClient {
405
431
  perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
406
432
  },
407
433
  });
434
+ }
435
+ async updatePerpMarketMarginRatio(perpMarketIndex, marginRatioInitial, marginRatioMaintenance) {
436
+ const updatePerpMarketMarginRatioIx = await this.getUpdatePerpMarketMarginRatioIx(perpMarketIndex, marginRatioInitial, marginRatioMaintenance);
408
437
  const tx = await this.buildTransaction(updatePerpMarketMarginRatioIx);
409
438
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
410
439
  return txSig;
411
440
  }
412
- async updatePerpMarketImfFactor(perpMarketIndex, imfFactor, unrealizedPnlImfFactor) {
413
- const updatePerpMarketImfFactorIx = await this.program.instruction.updatePerpMarketImfFactor(imfFactor, unrealizedPnlImfFactor, {
441
+ async getUpdatePerpMarketMarginRatioIx(perpMarketIndex, marginRatioInitial, marginRatioMaintenance) {
442
+ return await this.program.instruction.updatePerpMarketMarginRatio(marginRatioInitial, marginRatioMaintenance, {
414
443
  accounts: {
415
444
  admin: this.isSubscribed
416
445
  ? this.getStateAccount().admin
@@ -419,12 +448,15 @@ class AdminClient extends driftClient_1.DriftClient {
419
448
  perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
420
449
  },
421
450
  });
451
+ }
452
+ async updatePerpMarketImfFactor(perpMarketIndex, imfFactor, unrealizedPnlImfFactor) {
453
+ const updatePerpMarketImfFactorIx = await this.getUpdatePerpMarketImfFactorIx(perpMarketIndex, imfFactor, unrealizedPnlImfFactor);
422
454
  const tx = await this.buildTransaction(updatePerpMarketImfFactorIx);
423
455
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
424
456
  return txSig;
425
457
  }
426
- async updatePerpMarketBaseSpread(perpMarketIndex, baseSpread) {
427
- const updatePerpMarketBaseSpreadIx = await this.program.instruction.updatePerpMarketBaseSpread(baseSpread, {
458
+ async getUpdatePerpMarketImfFactorIx(perpMarketIndex, imfFactor, unrealizedPnlImfFactor) {
459
+ return await this.program.instruction.updatePerpMarketImfFactor(imfFactor, unrealizedPnlImfFactor, {
428
460
  accounts: {
429
461
  admin: this.isSubscribed
430
462
  ? this.getStateAccount().admin
@@ -433,12 +465,15 @@ class AdminClient extends driftClient_1.DriftClient {
433
465
  perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
434
466
  },
435
467
  });
468
+ }
469
+ async updatePerpMarketBaseSpread(perpMarketIndex, baseSpread) {
470
+ const updatePerpMarketBaseSpreadIx = await this.getUpdatePerpMarketBaseSpreadIx(perpMarketIndex, baseSpread);
436
471
  const tx = await this.buildTransaction(updatePerpMarketBaseSpreadIx);
437
472
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
438
473
  return txSig;
439
474
  }
440
- async updateAmmJitIntensity(perpMarketIndex, ammJitIntensity) {
441
- const updateAmmJitIntensityIx = await this.program.instruction.updateAmmJitIntensity(ammJitIntensity, {
475
+ async getUpdatePerpMarketBaseSpreadIx(perpMarketIndex, baseSpread) {
476
+ return await this.program.instruction.updatePerpMarketBaseSpread(baseSpread, {
442
477
  accounts: {
443
478
  admin: this.isSubscribed
444
479
  ? this.getStateAccount().admin
@@ -447,13 +482,15 @@ class AdminClient extends driftClient_1.DriftClient {
447
482
  perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
448
483
  },
449
484
  });
485
+ }
486
+ async updateAmmJitIntensity(perpMarketIndex, ammJitIntensity) {
487
+ const updateAmmJitIntensityIx = await this.getUpdateAmmJitIntensityIx(perpMarketIndex, ammJitIntensity);
450
488
  const tx = await this.buildTransaction(updateAmmJitIntensityIx);
451
489
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
452
490
  return txSig;
453
491
  }
454
- async updatePerpMarketName(perpMarketIndex, name) {
455
- const nameBuffer = (0, userName_1.encodeName)(name);
456
- const updatePerpMarketNameIx = await this.program.instruction.updatePerpMarketName(nameBuffer, {
492
+ async getUpdateAmmJitIntensityIx(perpMarketIndex, ammJitIntensity) {
493
+ return await this.program.instruction.updateAmmJitIntensity(ammJitIntensity, {
457
494
  accounts: {
458
495
  admin: this.isSubscribed
459
496
  ? this.getStateAccount().admin
@@ -462,43 +499,52 @@ class AdminClient extends driftClient_1.DriftClient {
462
499
  perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
463
500
  },
464
501
  });
502
+ }
503
+ async updatePerpMarketName(perpMarketIndex, name) {
504
+ const updatePerpMarketNameIx = await this.getUpdatePerpMarketNameIx(perpMarketIndex, name);
465
505
  const tx = await this.buildTransaction(updatePerpMarketNameIx);
466
506
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
467
507
  return txSig;
468
508
  }
469
- async updateSpotMarketName(spotMarketIndex, name) {
509
+ async getUpdatePerpMarketNameIx(perpMarketIndex, name) {
470
510
  const nameBuffer = (0, userName_1.encodeName)(name);
471
- const updateSpotMarketNameIx = await this.program.instruction.updateSpotMarketName(nameBuffer, {
511
+ return await this.program.instruction.updatePerpMarketName(nameBuffer, {
472
512
  accounts: {
473
513
  admin: this.isSubscribed
474
514
  ? this.getStateAccount().admin
475
515
  : this.wallet.publicKey,
476
516
  state: await this.getStatePublicKey(),
477
- spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
517
+ perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
478
518
  },
479
519
  });
520
+ }
521
+ async updateSpotMarketName(spotMarketIndex, name) {
522
+ const updateSpotMarketNameIx = await this.getUpdateSpotMarketNameIx(spotMarketIndex, name);
480
523
  const tx = await this.buildTransaction(updateSpotMarketNameIx);
481
524
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
482
525
  return txSig;
483
526
  }
484
- async updatePerpMarketPerLpBase(perpMarketIndex, perLpBase) {
485
- const perpMarketPublicKey = await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex);
486
- const updatePerpMarketPerLpBaseIx = await this.program.instruction.updatePerpMarketPerLpBase(perLpBase, {
527
+ async getUpdateSpotMarketNameIx(spotMarketIndex, name) {
528
+ const nameBuffer = (0, userName_1.encodeName)(name);
529
+ return await this.program.instruction.updateSpotMarketName(nameBuffer, {
487
530
  accounts: {
488
531
  admin: this.isSubscribed
489
532
  ? this.getStateAccount().admin
490
533
  : this.wallet.publicKey,
491
534
  state: await this.getStatePublicKey(),
492
- perpMarket: perpMarketPublicKey,
535
+ spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
493
536
  },
494
537
  });
538
+ }
539
+ async updatePerpMarketPerLpBase(perpMarketIndex, perLpBase) {
540
+ const updatePerpMarketPerLpBaseIx = await this.getUpdatePerpMarketPerLpBaseIx(perpMarketIndex, perLpBase);
495
541
  const tx = await this.buildTransaction(updatePerpMarketPerLpBaseIx);
496
542
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
497
543
  return txSig;
498
544
  }
499
- async updatePerpMarketMaxSpread(perpMarketIndex, maxSpread) {
545
+ async getUpdatePerpMarketPerLpBaseIx(perpMarketIndex, perLpBase) {
500
546
  const perpMarketPublicKey = await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex);
501
- const updatePerpMarketMaxSpreadIx = await this.program.instruction.updatePerpMarketMaxSpread(maxSpread, {
547
+ return await this.program.instruction.updatePerpMarketPerLpBase(perLpBase, {
502
548
  accounts: {
503
549
  admin: this.isSubscribed
504
550
  ? this.getStateAccount().admin
@@ -507,25 +553,33 @@ class AdminClient extends driftClient_1.DriftClient {
507
553
  perpMarket: perpMarketPublicKey,
508
554
  },
509
555
  });
556
+ }
557
+ async updatePerpMarketMaxSpread(perpMarketIndex, maxSpread) {
558
+ const updatePerpMarketMaxSpreadIx = await this.getUpdatePerpMarketMaxSpreadIx(perpMarketIndex, maxSpread);
510
559
  const tx = await this.buildTransaction(updatePerpMarketMaxSpreadIx);
511
560
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
512
561
  return txSig;
513
562
  }
514
- async updatePerpFeeStructure(feeStructure) {
515
- const updatePerpFeeStructureIx = this.program.instruction.updatePerpFeeStructure(feeStructure, {
563
+ async getUpdatePerpMarketMaxSpreadIx(perpMarketIndex, maxSpread) {
564
+ const perpMarketPublicKey = await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex);
565
+ return await this.program.instruction.updatePerpMarketMaxSpread(maxSpread, {
516
566
  accounts: {
517
567
  admin: this.isSubscribed
518
568
  ? this.getStateAccount().admin
519
569
  : this.wallet.publicKey,
520
570
  state: await this.getStatePublicKey(),
571
+ perpMarket: perpMarketPublicKey,
521
572
  },
522
573
  });
574
+ }
575
+ async updatePerpFeeStructure(feeStructure) {
576
+ const updatePerpFeeStructureIx = await this.getUpdatePerpFeeStructureIx(feeStructure);
523
577
  const tx = await this.buildTransaction(updatePerpFeeStructureIx);
524
578
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
525
579
  return txSig;
526
580
  }
527
- async updateSpotFeeStructure(feeStructure) {
528
- const updateSpotFeeStructureIx = await this.program.instruction.updateSpotFeeStructure(feeStructure, {
581
+ async getUpdatePerpFeeStructureIx(feeStructure) {
582
+ return this.program.instruction.updatePerpFeeStructure(feeStructure, {
529
583
  accounts: {
530
584
  admin: this.isSubscribed
531
585
  ? this.getStateAccount().admin
@@ -533,12 +587,15 @@ class AdminClient extends driftClient_1.DriftClient {
533
587
  state: await this.getStatePublicKey(),
534
588
  },
535
589
  });
590
+ }
591
+ async updateSpotFeeStructure(feeStructure) {
592
+ const updateSpotFeeStructureIx = await this.getUpdateSpotFeeStructureIx(feeStructure);
536
593
  const tx = await this.buildTransaction(updateSpotFeeStructureIx);
537
594
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
538
595
  return txSig;
539
596
  }
540
- async updateInitialPctToLiquidate(initialPctToLiquidate) {
541
- const updateInitialPctToLiquidateIx = await this.program.instruction.updateInitialPctToLiquidate(initialPctToLiquidate, {
597
+ async getUpdateSpotFeeStructureIx(feeStructure) {
598
+ return await this.program.instruction.updateSpotFeeStructure(feeStructure, {
542
599
  accounts: {
543
600
  admin: this.isSubscribed
544
601
  ? this.getStateAccount().admin
@@ -546,12 +603,15 @@ class AdminClient extends driftClient_1.DriftClient {
546
603
  state: await this.getStatePublicKey(),
547
604
  },
548
605
  });
606
+ }
607
+ async updateInitialPctToLiquidate(initialPctToLiquidate) {
608
+ const updateInitialPctToLiquidateIx = await this.getUpdateInitialPctToLiquidateIx(initialPctToLiquidate);
549
609
  const tx = await this.buildTransaction(updateInitialPctToLiquidateIx);
550
610
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
551
611
  return txSig;
552
612
  }
553
- async updateLiquidationDuration(liquidationDuration) {
554
- const updateLiquidationDurationIx = await this.program.instruction.updateLiquidationDuration(liquidationDuration, {
613
+ async getUpdateInitialPctToLiquidateIx(initialPctToLiquidate) {
614
+ return await this.program.instruction.updateInitialPctToLiquidate(initialPctToLiquidate, {
555
615
  accounts: {
556
616
  admin: this.isSubscribed
557
617
  ? this.getStateAccount().admin
@@ -559,12 +619,15 @@ class AdminClient extends driftClient_1.DriftClient {
559
619
  state: await this.getStatePublicKey(),
560
620
  },
561
621
  });
622
+ }
623
+ async updateLiquidationDuration(liquidationDuration) {
624
+ const updateLiquidationDurationIx = await this.getUpdateLiquidationDurationIx(liquidationDuration);
562
625
  const tx = await this.buildTransaction(updateLiquidationDurationIx);
563
626
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
564
627
  return txSig;
565
628
  }
566
- async updateLiquidationMarginBufferRatio(updateLiquidationMarginBufferRatio) {
567
- const updateLiquidationMarginBufferRatioIx = await this.program.instruction.updateLiquidationMarginBufferRatio(updateLiquidationMarginBufferRatio, {
629
+ async getUpdateLiquidationDurationIx(liquidationDuration) {
630
+ return await this.program.instruction.updateLiquidationDuration(liquidationDuration, {
568
631
  accounts: {
569
632
  admin: this.isSubscribed
570
633
  ? this.getStateAccount().admin
@@ -572,12 +635,15 @@ class AdminClient extends driftClient_1.DriftClient {
572
635
  state: await this.getStatePublicKey(),
573
636
  },
574
637
  });
638
+ }
639
+ async updateLiquidationMarginBufferRatio(updateLiquidationMarginBufferRatio) {
640
+ const updateLiquidationMarginBufferRatioIx = await this.getUpdateLiquidationMarginBufferRatioIx(updateLiquidationMarginBufferRatio);
575
641
  const tx = await this.buildTransaction(updateLiquidationMarginBufferRatioIx);
576
642
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
577
643
  return txSig;
578
644
  }
579
- async updateOracleGuardRails(oracleGuardRails) {
580
- const updateOracleGuardRailsIx = await this.program.instruction.updateOracleGuardRails(oracleGuardRails, {
645
+ async getUpdateLiquidationMarginBufferRatioIx(updateLiquidationMarginBufferRatio) {
646
+ return await this.program.instruction.updateLiquidationMarginBufferRatio(updateLiquidationMarginBufferRatio, {
581
647
  accounts: {
582
648
  admin: this.isSubscribed
583
649
  ? this.getStateAccount().admin
@@ -585,12 +651,15 @@ class AdminClient extends driftClient_1.DriftClient {
585
651
  state: await this.getStatePublicKey(),
586
652
  },
587
653
  });
654
+ }
655
+ async updateOracleGuardRails(oracleGuardRails) {
656
+ const updateOracleGuardRailsIx = await this.getUpdateOracleGuardRailsIx(oracleGuardRails);
588
657
  const tx = await this.buildTransaction(updateOracleGuardRailsIx);
589
658
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
590
659
  return txSig;
591
660
  }
592
- async updateStateSettlementDuration(settlementDuration) {
593
- const updateStateSettlementDurationIx = await this.program.instruction.updateStateSettlementDuration(settlementDuration, {
661
+ async getUpdateOracleGuardRailsIx(oracleGuardRails) {
662
+ return await this.program.instruction.updateOracleGuardRails(oracleGuardRails, {
594
663
  accounts: {
595
664
  admin: this.isSubscribed
596
665
  ? this.getStateAccount().admin
@@ -598,12 +667,15 @@ class AdminClient extends driftClient_1.DriftClient {
598
667
  state: await this.getStatePublicKey(),
599
668
  },
600
669
  });
670
+ }
671
+ async updateStateSettlementDuration(settlementDuration) {
672
+ const updateStateSettlementDurationIx = await this.getUpdateStateSettlementDurationIx(settlementDuration);
601
673
  const tx = await this.buildTransaction(updateStateSettlementDurationIx);
602
674
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
603
675
  return txSig;
604
676
  }
605
- async updateStateMaxNumberOfSubAccounts(maxNumberOfSubAccounts) {
606
- const updateStateMaxNumberOfSubAccountsIx = await this.program.instruction.updateStateMaxNumberOfSubAccounts(maxNumberOfSubAccounts, {
677
+ async getUpdateStateSettlementDurationIx(settlementDuration) {
678
+ return await this.program.instruction.updateStateSettlementDuration(settlementDuration, {
607
679
  accounts: {
608
680
  admin: this.isSubscribed
609
681
  ? this.getStateAccount().admin
@@ -611,12 +683,15 @@ class AdminClient extends driftClient_1.DriftClient {
611
683
  state: await this.getStatePublicKey(),
612
684
  },
613
685
  });
686
+ }
687
+ async updateStateMaxNumberOfSubAccounts(maxNumberOfSubAccounts) {
688
+ const updateStateMaxNumberOfSubAccountsIx = await this.getUpdateStateMaxNumberOfSubAccountsIx(maxNumberOfSubAccounts);
614
689
  const tx = await this.buildTransaction(updateStateMaxNumberOfSubAccountsIx);
615
690
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
616
691
  return txSig;
617
692
  }
618
- async updateStateMaxInitializeUserFee(maxInitializeUserFee) {
619
- const updateStateMaxInitializeUserFeeIx = await this.program.instruction.updateStateMaxInitializeUserFee(maxInitializeUserFee, {
693
+ async getUpdateStateMaxNumberOfSubAccountsIx(maxNumberOfSubAccounts) {
694
+ return await this.program.instruction.updateStateMaxNumberOfSubAccounts(maxNumberOfSubAccounts, {
620
695
  accounts: {
621
696
  admin: this.isSubscribed
622
697
  ? this.getStateAccount().admin
@@ -624,26 +699,31 @@ class AdminClient extends driftClient_1.DriftClient {
624
699
  state: await this.getStatePublicKey(),
625
700
  },
626
701
  });
702
+ }
703
+ async updateStateMaxInitializeUserFee(maxInitializeUserFee) {
704
+ const updateStateMaxInitializeUserFeeIx = await this.getUpdateStateMaxInitializeUserFeeIx(maxInitializeUserFee);
627
705
  const tx = await this.buildTransaction(updateStateMaxInitializeUserFeeIx);
628
706
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
629
707
  return txSig;
630
708
  }
631
- async updateWithdrawGuardThreshold(spotMarketIndex, withdrawGuardThreshold) {
632
- const updateWithdrawGuardThresholdIx = await this.program.instruction.updateWithdrawGuardThreshold(withdrawGuardThreshold, {
709
+ async getUpdateStateMaxInitializeUserFeeIx(maxInitializeUserFee) {
710
+ return await this.program.instruction.updateStateMaxInitializeUserFee(maxInitializeUserFee, {
633
711
  accounts: {
634
712
  admin: this.isSubscribed
635
713
  ? this.getStateAccount().admin
636
714
  : this.wallet.publicKey,
637
715
  state: await this.getStatePublicKey(),
638
- spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
639
716
  },
640
717
  });
718
+ }
719
+ async updateWithdrawGuardThreshold(spotMarketIndex, withdrawGuardThreshold) {
720
+ const updateWithdrawGuardThresholdIx = await this.getUpdateWithdrawGuardThresholdIx(spotMarketIndex, withdrawGuardThreshold);
641
721
  const tx = await this.buildTransaction(updateWithdrawGuardThresholdIx);
642
722
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
643
723
  return txSig;
644
724
  }
645
- async updateSpotMarketIfFactor(spotMarketIndex, userIfFactor, totalIfFactor) {
646
- const updateSpotMarketIfFactorIx = await this.program.instruction.updateSpotMarketIfFactor(spotMarketIndex, userIfFactor, totalIfFactor, {
725
+ async getUpdateWithdrawGuardThresholdIx(spotMarketIndex, withdrawGuardThreshold) {
726
+ return await this.program.instruction.updateWithdrawGuardThreshold(withdrawGuardThreshold, {
647
727
  accounts: {
648
728
  admin: this.isSubscribed
649
729
  ? this.getStateAccount().admin
@@ -652,12 +732,15 @@ class AdminClient extends driftClient_1.DriftClient {
652
732
  spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
653
733
  },
654
734
  });
735
+ }
736
+ async updateSpotMarketIfFactor(spotMarketIndex, userIfFactor, totalIfFactor) {
737
+ const updateSpotMarketIfFactorIx = await this.getUpdateSpotMarketIfFactorIx(spotMarketIndex, userIfFactor, totalIfFactor);
655
738
  const tx = await this.buildTransaction(updateSpotMarketIfFactorIx);
656
739
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
657
740
  return txSig;
658
741
  }
659
- async updateSpotMarketRevenueSettlePeriod(spotMarketIndex, revenueSettlePeriod) {
660
- const updateSpotMarketRevenueSettlePeriodIx = await this.program.instruction.updateSpotMarketRevenueSettlePeriod(revenueSettlePeriod, {
742
+ async getUpdateSpotMarketIfFactorIx(spotMarketIndex, userIfFactor, totalIfFactor) {
743
+ return await this.program.instruction.updateSpotMarketIfFactor(spotMarketIndex, userIfFactor, totalIfFactor, {
661
744
  accounts: {
662
745
  admin: this.isSubscribed
663
746
  ? this.getStateAccount().admin
@@ -666,12 +749,15 @@ class AdminClient extends driftClient_1.DriftClient {
666
749
  spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
667
750
  },
668
751
  });
752
+ }
753
+ async updateSpotMarketRevenueSettlePeriod(spotMarketIndex, revenueSettlePeriod) {
754
+ const updateSpotMarketRevenueSettlePeriodIx = await this.getUpdateSpotMarketRevenueSettlePeriodIx(spotMarketIndex, revenueSettlePeriod);
669
755
  const tx = await this.buildTransaction(updateSpotMarketRevenueSettlePeriodIx);
670
756
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
671
757
  return txSig;
672
758
  }
673
- async updateSpotMarketMaxTokenDeposits(spotMarketIndex, maxTokenDeposits) {
674
- const updateSpotMarketMaxTokenDepositsIx = this.program.instruction.updateSpotMarketMaxTokenDeposits(maxTokenDeposits, {
759
+ async getUpdateSpotMarketRevenueSettlePeriodIx(spotMarketIndex, revenueSettlePeriod) {
760
+ return await this.program.instruction.updateSpotMarketRevenueSettlePeriod(revenueSettlePeriod, {
675
761
  accounts: {
676
762
  admin: this.isSubscribed
677
763
  ? this.getStateAccount().admin
@@ -680,12 +766,15 @@ class AdminClient extends driftClient_1.DriftClient {
680
766
  spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
681
767
  },
682
768
  });
769
+ }
770
+ async updateSpotMarketMaxTokenDeposits(spotMarketIndex, maxTokenDeposits) {
771
+ const updateSpotMarketMaxTokenDepositsIx = await this.getUpdateSpotMarketMaxTokenDepositsIx(spotMarketIndex, maxTokenDeposits);
683
772
  const tx = await this.buildTransaction(updateSpotMarketMaxTokenDepositsIx);
684
773
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
685
774
  return txSig;
686
775
  }
687
- async updateSpotMarketScaleInitialAssetWeightStart(spotMarketIndex, scaleInitialAssetWeightStart) {
688
- const updateSpotMarketScaleInitialAssetWeightStartIx = this.program.instruction.updateSpotMarketScaleInitialAssetWeightStart(scaleInitialAssetWeightStart, {
776
+ async getUpdateSpotMarketMaxTokenDepositsIx(spotMarketIndex, maxTokenDeposits) {
777
+ return this.program.instruction.updateSpotMarketMaxTokenDeposits(maxTokenDeposits, {
689
778
  accounts: {
690
779
  admin: this.isSubscribed
691
780
  ? this.getStateAccount().admin
@@ -694,12 +783,15 @@ class AdminClient extends driftClient_1.DriftClient {
694
783
  spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
695
784
  },
696
785
  });
786
+ }
787
+ async updateSpotMarketScaleInitialAssetWeightStart(spotMarketIndex, scaleInitialAssetWeightStart) {
788
+ const updateSpotMarketScaleInitialAssetWeightStartIx = await this.getUpdateSpotMarketScaleInitialAssetWeightStartIx(spotMarketIndex, scaleInitialAssetWeightStart);
697
789
  const tx = await this.buildTransaction(updateSpotMarketScaleInitialAssetWeightStartIx);
698
790
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
699
791
  return txSig;
700
792
  }
701
- async updateInsuranceFundUnstakingPeriod(spotMarketIndex, insuranceWithdrawEscrowPeriod) {
702
- const updateInsuranceFundUnstakingPeriodIx = await this.program.instruction.updateInsuranceFundUnstakingPeriod(insuranceWithdrawEscrowPeriod, {
793
+ async getUpdateSpotMarketScaleInitialAssetWeightStartIx(spotMarketIndex, scaleInitialAssetWeightStart) {
794
+ return this.program.instruction.updateSpotMarketScaleInitialAssetWeightStart(scaleInitialAssetWeightStart, {
703
795
  accounts: {
704
796
  admin: this.isSubscribed
705
797
  ? this.getStateAccount().admin
@@ -708,54 +800,66 @@ class AdminClient extends driftClient_1.DriftClient {
708
800
  spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
709
801
  },
710
802
  });
803
+ }
804
+ async updateInsuranceFundUnstakingPeriod(spotMarketIndex, insuranceWithdrawEscrowPeriod) {
805
+ const updateInsuranceFundUnstakingPeriodIx = await this.getUpdateInsuranceFundUnstakingPeriodIx(spotMarketIndex, insuranceWithdrawEscrowPeriod);
711
806
  const tx = await this.buildTransaction(updateInsuranceFundUnstakingPeriodIx);
712
807
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
713
808
  return txSig;
714
809
  }
715
- async updateLpCooldownTime(cooldownTime) {
716
- const updateLpCooldownTimeIx = await this.program.instruction.updateLpCooldownTime(cooldownTime, {
810
+ async getUpdateInsuranceFundUnstakingPeriodIx(spotMarketIndex, insuranceWithdrawEscrowPeriod) {
811
+ return await this.program.instruction.updateInsuranceFundUnstakingPeriod(insuranceWithdrawEscrowPeriod, {
717
812
  accounts: {
718
813
  admin: this.isSubscribed
719
814
  ? this.getStateAccount().admin
720
815
  : this.wallet.publicKey,
721
816
  state: await this.getStatePublicKey(),
817
+ spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
722
818
  },
723
819
  });
820
+ }
821
+ async updateLpCooldownTime(cooldownTime) {
822
+ const updateLpCooldownTimeIx = await this.getUpdateLpCooldownTimeIx(cooldownTime);
724
823
  const tx = await this.buildTransaction(updateLpCooldownTimeIx);
725
824
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
726
825
  return txSig;
727
826
  }
728
- async updatePerpMarketOracle(perpMarketIndex, oracle, oracleSource) {
729
- const updatePerpMarketOracleIx = await this.program.instruction.updatePerpMarketOracle(oracle, oracleSource, {
827
+ async getUpdateLpCooldownTimeIx(cooldownTime) {
828
+ return await this.program.instruction.updateLpCooldownTime(cooldownTime, {
730
829
  accounts: {
731
830
  admin: this.isSubscribed
732
831
  ? this.getStateAccount().admin
733
832
  : this.wallet.publicKey,
734
833
  state: await this.getStatePublicKey(),
735
- perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
736
- oracle: oracle,
737
834
  },
738
835
  });
836
+ }
837
+ async updatePerpMarketOracle(perpMarketIndex, oracle, oracleSource) {
838
+ const updatePerpMarketOracleIx = await this.getUpdatePerpMarketOracleIx(perpMarketIndex, oracle, oracleSource);
739
839
  const tx = await this.buildTransaction(updatePerpMarketOracleIx);
740
840
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
741
841
  return txSig;
742
842
  }
743
- async updatePerpMarketStepSizeAndTickSize(perpMarketIndex, stepSize, tickSize) {
744
- const updatePerpMarketStepSizeAndTickSizeIx = await this.program.instruction.updatePerpMarketStepSizeAndTickSize(stepSize, tickSize, {
843
+ async getUpdatePerpMarketOracleIx(perpMarketIndex, oracle, oracleSource) {
844
+ return await this.program.instruction.updatePerpMarketOracle(oracle, oracleSource, {
745
845
  accounts: {
746
846
  admin: this.isSubscribed
747
847
  ? this.getStateAccount().admin
748
848
  : this.wallet.publicKey,
749
849
  state: await this.getStatePublicKey(),
750
850
  perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
851
+ oracle: oracle,
751
852
  },
752
853
  });
854
+ }
855
+ async updatePerpMarketStepSizeAndTickSize(perpMarketIndex, stepSize, tickSize) {
856
+ const updatePerpMarketStepSizeAndTickSizeIx = await this.getUpdatePerpMarketStepSizeAndTickSizeIx(perpMarketIndex, stepSize, tickSize);
753
857
  const tx = await this.buildTransaction(updatePerpMarketStepSizeAndTickSizeIx);
754
858
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
755
859
  return txSig;
756
860
  }
757
- async updatePerpMarketMinOrderSize(perpMarketIndex, orderSize) {
758
- const updatePerpMarketMinOrderSizeIx = await this.program.instruction.updatePerpMarketMinOrderSize(orderSize, {
861
+ async getUpdatePerpMarketStepSizeAndTickSizeIx(perpMarketIndex, stepSize, tickSize) {
862
+ return await this.program.instruction.updatePerpMarketStepSizeAndTickSize(stepSize, tickSize, {
759
863
  accounts: {
760
864
  admin: this.isSubscribed
761
865
  ? this.getStateAccount().admin
@@ -764,24 +868,41 @@ class AdminClient extends driftClient_1.DriftClient {
764
868
  perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
765
869
  },
766
870
  });
871
+ }
872
+ async updatePerpMarketMinOrderSize(perpMarketIndex, orderSize) {
873
+ const updatePerpMarketMinOrderSizeIx = await this.getUpdatePerpMarketMinOrderSizeIx(perpMarketIndex, orderSize);
767
874
  const tx = await this.buildTransaction(updatePerpMarketMinOrderSizeIx);
768
875
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
769
876
  return txSig;
770
877
  }
771
- async updateSpotMarketStepSizeAndTickSize(spotMarketIndex, stepSize, tickSize) {
772
- const updateSpotMarketStepSizeAndTickSizeIx = await this.program.instruction.updateSpotMarketStepSizeAndTickSize(stepSize, tickSize, {
878
+ async getUpdatePerpMarketMinOrderSizeIx(perpMarketIndex, orderSize) {
879
+ return await this.program.instruction.updatePerpMarketMinOrderSize(orderSize, {
773
880
  accounts: {
774
881
  admin: this.isSubscribed
775
882
  ? this.getStateAccount().admin
776
883
  : this.wallet.publicKey,
777
884
  state: await this.getStatePublicKey(),
778
- spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
885
+ perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
779
886
  },
780
887
  });
888
+ }
889
+ async updateSpotMarketStepSizeAndTickSize(spotMarketIndex, stepSize, tickSize) {
890
+ const updateSpotMarketStepSizeAndTickSizeIx = await this.getUpdateSpotMarketStepSizeAndTickSizeIx(spotMarketIndex, stepSize, tickSize);
781
891
  const tx = await this.buildTransaction(updateSpotMarketStepSizeAndTickSizeIx);
782
892
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
783
893
  return txSig;
784
894
  }
895
+ async getUpdateSpotMarketStepSizeAndTickSizeIx(spotMarketIndex, stepSize, tickSize) {
896
+ return await this.program.instruction.updateSpotMarketStepSizeAndTickSize(stepSize, tickSize, {
897
+ accounts: {
898
+ admin: this.isSubscribed
899
+ ? this.getStateAccount().admin
900
+ : this.wallet.publicKey,
901
+ state: await this.getStatePublicKey(),
902
+ spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
903
+ },
904
+ });
905
+ }
785
906
  async updateSpotMarketMinOrderSize(spotMarketIndex, orderSize) {
786
907
  const updateSpotMarketMinOrderSizeIx = await this.program.instruction.updateSpotMarketMinOrderSize(orderSize, {
787
908
  accounts: {
@@ -796,63 +917,86 @@ class AdminClient extends driftClient_1.DriftClient {
796
917
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
797
918
  return txSig;
798
919
  }
799
- async updatePerpMarketExpiry(perpMarketIndex, expiryTs) {
800
- const updatePerpMarketExpiryIx = await this.program.instruction.updatePerpMarketExpiry(expiryTs, {
920
+ async getUpdateSpotMarketMinOrderSizeIx(spotMarketIndex, orderSize) {
921
+ return await this.program.instruction.updateSpotMarketMinOrderSize(orderSize, {
801
922
  accounts: {
802
923
  admin: this.isSubscribed
803
924
  ? this.getStateAccount().admin
804
925
  : this.wallet.publicKey,
805
926
  state: await this.getStatePublicKey(),
806
- perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
927
+ spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
807
928
  },
808
929
  });
930
+ }
931
+ async updatePerpMarketExpiry(perpMarketIndex, expiryTs) {
932
+ const updatePerpMarketExpiryIx = await this.getUpdatePerpMarketExpiryIx(perpMarketIndex, expiryTs);
809
933
  const tx = await this.buildTransaction(updatePerpMarketExpiryIx);
810
934
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
811
935
  return txSig;
812
936
  }
813
- async updateSpotMarketOracle(spotMarketIndex, oracle, oracleSource) {
814
- const updateSpotMarketOracleIx = await this.program.instruction.updateSpotMarketOracle(oracle, oracleSource, {
937
+ async getUpdatePerpMarketExpiryIx(perpMarketIndex, expiryTs) {
938
+ return await this.program.instruction.updatePerpMarketExpiry(expiryTs, {
815
939
  accounts: {
816
940
  admin: this.isSubscribed
817
941
  ? this.getStateAccount().admin
818
942
  : this.wallet.publicKey,
819
943
  state: await this.getStatePublicKey(),
820
- spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
821
- oracle: oracle,
944
+ perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
822
945
  },
823
946
  });
947
+ }
948
+ async updateSpotMarketOracle(spotMarketIndex, oracle, oracleSource) {
949
+ const updateSpotMarketOracleIx = await this.getUpdateSpotMarketOracleIx(spotMarketIndex, oracle, oracleSource);
824
950
  const tx = await this.buildTransaction(updateSpotMarketOracleIx);
825
951
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
826
952
  return txSig;
827
953
  }
828
- async updateSpotMarketOrdersEnabled(spotMarketIndex, ordersEnabled) {
829
- const updateSpotMarketOrdersEnabledIx = await this.program.instruction.updateSpotMarketOrdersEnabled(ordersEnabled, {
954
+ async getUpdateSpotMarketOracleIx(spotMarketIndex, oracle, oracleSource) {
955
+ return await this.program.instruction.updateSpotMarketOracle(oracle, oracleSource, {
830
956
  accounts: {
831
957
  admin: this.isSubscribed
832
958
  ? this.getStateAccount().admin
833
959
  : this.wallet.publicKey,
834
960
  state: await this.getStatePublicKey(),
835
961
  spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
962
+ oracle: oracle,
836
963
  },
837
964
  });
965
+ }
966
+ async updateSpotMarketOrdersEnabled(spotMarketIndex, ordersEnabled) {
967
+ const updateSpotMarketOrdersEnabledIx = await this.getUpdateSpotMarketOrdersEnabledIx(spotMarketIndex, ordersEnabled);
838
968
  const tx = await this.buildTransaction(updateSpotMarketOrdersEnabledIx);
839
969
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
840
970
  return txSig;
841
971
  }
842
- async updateSerumFulfillmentConfigStatus(serumFulfillmentConfig, status) {
843
- const updateSerumFulfillmentConfigStatusIx = await this.program.instruction.updateSerumFulfillmentConfigStatus(status, {
972
+ async getUpdateSpotMarketOrdersEnabledIx(spotMarketIndex, ordersEnabled) {
973
+ return await this.program.instruction.updateSpotMarketOrdersEnabled(ordersEnabled, {
844
974
  accounts: {
845
975
  admin: this.isSubscribed
846
976
  ? this.getStateAccount().admin
847
977
  : this.wallet.publicKey,
848
978
  state: await this.getStatePublicKey(),
849
- serumFulfillmentConfig,
979
+ spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
850
980
  },
851
981
  });
982
+ }
983
+ async updateSerumFulfillmentConfigStatus(serumFulfillmentConfig, status) {
984
+ const updateSerumFulfillmentConfigStatusIx = await this.getUpdateSerumFulfillmentConfigStatusIx(serumFulfillmentConfig, status);
852
985
  const tx = await this.buildTransaction(updateSerumFulfillmentConfigStatusIx);
853
986
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
854
987
  return txSig;
855
988
  }
989
+ async getUpdateSerumFulfillmentConfigStatusIx(serumFulfillmentConfig, status) {
990
+ return await this.program.instruction.updateSerumFulfillmentConfigStatus(status, {
991
+ accounts: {
992
+ admin: this.isSubscribed
993
+ ? this.getStateAccount().admin
994
+ : this.wallet.publicKey,
995
+ state: await this.getStatePublicKey(),
996
+ serumFulfillmentConfig,
997
+ },
998
+ });
999
+ }
856
1000
  async updatePhoenixFulfillmentConfigStatus(phoenixFulfillmentConfig, status) {
857
1001
  const updatePhoenixFulfillmentConfigStatusIx = await this.program.instruction.phoenixFulfillmentConfigStatus(status, {
858
1002
  accounts: {
@@ -867,35 +1011,42 @@ class AdminClient extends driftClient_1.DriftClient {
867
1011
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
868
1012
  return txSig;
869
1013
  }
870
- async updateSpotMarketExpiry(spotMarketIndex, expiryTs) {
871
- const updateSpotMarketExpiryIx = await this.program.instruction.updateSpotMarketExpiry(expiryTs, {
1014
+ async getUpdatePhoenixFulfillmentConfigStatusIx(phoenixFulfillmentConfig, status) {
1015
+ return await this.program.instruction.phoenixFulfillmentConfigStatus(status, {
872
1016
  accounts: {
873
1017
  admin: this.isSubscribed
874
1018
  ? this.getStateAccount().admin
875
1019
  : this.wallet.publicKey,
876
1020
  state: await this.getStatePublicKey(),
877
- spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
1021
+ phoenixFulfillmentConfig,
878
1022
  },
879
1023
  });
1024
+ }
1025
+ async updateSpotMarketExpiry(spotMarketIndex, expiryTs) {
1026
+ const updateSpotMarketExpiryIx = await this.getUpdateSpotMarketExpiryIx(spotMarketIndex, expiryTs);
880
1027
  const tx = await this.buildTransaction(updateSpotMarketExpiryIx);
881
1028
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
882
1029
  return txSig;
883
1030
  }
884
- async updateWhitelistMint(whitelistMint) {
885
- const updateWhitelistMintIx = await this.program.instruction.updateWhitelistMint(whitelistMint, {
1031
+ async getUpdateSpotMarketExpiryIx(spotMarketIndex, expiryTs) {
1032
+ return await this.program.instruction.updateSpotMarketExpiry(expiryTs, {
886
1033
  accounts: {
887
1034
  admin: this.isSubscribed
888
1035
  ? this.getStateAccount().admin
889
1036
  : this.wallet.publicKey,
890
1037
  state: await this.getStatePublicKey(),
1038
+ spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
891
1039
  },
892
1040
  });
1041
+ }
1042
+ async updateWhitelistMint(whitelistMint) {
1043
+ const updateWhitelistMintIx = await this.getUpdateWhitelistMintIx(whitelistMint);
893
1044
  const tx = await this.buildTransaction(updateWhitelistMintIx);
894
1045
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
895
1046
  return txSig;
896
1047
  }
897
- async updateDiscountMint(discountMint) {
898
- const updateDiscountMintIx = await this.program.instruction.updateDiscountMint(discountMint, {
1048
+ async getUpdateWhitelistMintIx(whitelistMint) {
1049
+ return await this.program.instruction.updateWhitelistMint(whitelistMint, {
899
1050
  accounts: {
900
1051
  admin: this.isSubscribed
901
1052
  ? this.getStateAccount().admin
@@ -903,26 +1054,31 @@ class AdminClient extends driftClient_1.DriftClient {
903
1054
  state: await this.getStatePublicKey(),
904
1055
  },
905
1056
  });
1057
+ }
1058
+ async updateDiscountMint(discountMint) {
1059
+ const updateDiscountMintIx = await this.getUpdateDiscountMintIx(discountMint);
906
1060
  const tx = await this.buildTransaction(updateDiscountMintIx);
907
1061
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
908
1062
  return txSig;
909
1063
  }
910
- async updateSpotMarketMarginWeights(spotMarketIndex, initialAssetWeight, maintenanceAssetWeight, initialLiabilityWeight, maintenanceLiabilityWeight, imfFactor = 0) {
911
- const updateSpotMarketMarginWeightsIx = await this.program.instruction.updateSpotMarketMarginWeights(initialAssetWeight, maintenanceAssetWeight, initialLiabilityWeight, maintenanceLiabilityWeight, imfFactor, {
1064
+ async getUpdateDiscountMintIx(discountMint) {
1065
+ return await this.program.instruction.updateDiscountMint(discountMint, {
912
1066
  accounts: {
913
1067
  admin: this.isSubscribed
914
1068
  ? this.getStateAccount().admin
915
1069
  : this.wallet.publicKey,
916
1070
  state: await this.getStatePublicKey(),
917
- spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
918
1071
  },
919
1072
  });
1073
+ }
1074
+ async updateSpotMarketMarginWeights(spotMarketIndex, initialAssetWeight, maintenanceAssetWeight, initialLiabilityWeight, maintenanceLiabilityWeight, imfFactor = 0) {
1075
+ const updateSpotMarketMarginWeightsIx = await this.getUpdateSpotMarketMarginWeightsIx(spotMarketIndex, initialAssetWeight, maintenanceAssetWeight, initialLiabilityWeight, maintenanceLiabilityWeight, imfFactor);
920
1076
  const tx = await this.buildTransaction(updateSpotMarketMarginWeightsIx);
921
1077
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
922
1078
  return txSig;
923
1079
  }
924
- async updateSpotMarketBorrowRate(spotMarketIndex, optimalUtilization, optimalBorrowRate, optimalMaxRate) {
925
- const updateSpotMarketBorrowRateIx = await this.program.instruction.updateSpotMarketBorrowRate(optimalUtilization, optimalBorrowRate, optimalMaxRate, {
1080
+ async getUpdateSpotMarketMarginWeightsIx(spotMarketIndex, initialAssetWeight, maintenanceAssetWeight, initialLiabilityWeight, maintenanceLiabilityWeight, imfFactor = 0) {
1081
+ return await this.program.instruction.updateSpotMarketMarginWeights(initialAssetWeight, maintenanceAssetWeight, initialLiabilityWeight, maintenanceLiabilityWeight, imfFactor, {
926
1082
  accounts: {
927
1083
  admin: this.isSubscribed
928
1084
  ? this.getStateAccount().admin
@@ -931,12 +1087,15 @@ class AdminClient extends driftClient_1.DriftClient {
931
1087
  spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
932
1088
  },
933
1089
  });
1090
+ }
1091
+ async updateSpotMarketBorrowRate(spotMarketIndex, optimalUtilization, optimalBorrowRate, optimalMaxRate) {
1092
+ const updateSpotMarketBorrowRateIx = await this.getUpdateSpotMarketBorrowRateIx(spotMarketIndex, optimalUtilization, optimalBorrowRate, optimalMaxRate);
934
1093
  const tx = await this.buildTransaction(updateSpotMarketBorrowRateIx);
935
1094
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
936
1095
  return txSig;
937
1096
  }
938
- async updateSpotMarketAssetTier(spotMarketIndex, assetTier) {
939
- const updateSpotMarketAssetTierIx = await this.program.instruction.updateSpotMarketAssetTier(assetTier, {
1097
+ async getUpdateSpotMarketBorrowRateIx(spotMarketIndex, optimalUtilization, optimalBorrowRate, optimalMaxRate) {
1098
+ return await this.program.instruction.updateSpotMarketBorrowRate(optimalUtilization, optimalBorrowRate, optimalMaxRate, {
940
1099
  accounts: {
941
1100
  admin: this.isSubscribed
942
1101
  ? this.getStateAccount().admin
@@ -945,12 +1104,15 @@ class AdminClient extends driftClient_1.DriftClient {
945
1104
  spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
946
1105
  },
947
1106
  });
1107
+ }
1108
+ async updateSpotMarketAssetTier(spotMarketIndex, assetTier) {
1109
+ const updateSpotMarketAssetTierIx = await this.getUpdateSpotMarketAssetTierIx(spotMarketIndex, assetTier);
948
1110
  const tx = await this.buildTransaction(updateSpotMarketAssetTierIx);
949
1111
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
950
1112
  return txSig;
951
1113
  }
952
- async updateSpotMarketStatus(spotMarketIndex, marketStatus) {
953
- const updateSpotMarketStatusIx = await this.program.instruction.updateSpotMarketStatus(marketStatus, {
1114
+ async getUpdateSpotMarketAssetTierIx(spotMarketIndex, assetTier) {
1115
+ return await this.program.instruction.updateSpotMarketAssetTier(assetTier, {
954
1116
  accounts: {
955
1117
  admin: this.isSubscribed
956
1118
  ? this.getStateAccount().admin
@@ -959,12 +1121,15 @@ class AdminClient extends driftClient_1.DriftClient {
959
1121
  spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
960
1122
  },
961
1123
  });
1124
+ }
1125
+ async updateSpotMarketStatus(spotMarketIndex, marketStatus) {
1126
+ const updateSpotMarketStatusIx = await this.getUpdateSpotMarketStatusIx(spotMarketIndex, marketStatus);
962
1127
  const tx = await this.buildTransaction(updateSpotMarketStatusIx);
963
1128
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
964
1129
  return txSig;
965
1130
  }
966
- async updateSpotMarketPausedOperations(spotMarketIndex, pausedOperations) {
967
- const updateSpotMarketPausedOperationsIx = await this.program.instruction.updateSpotMarketPausedOperations(pausedOperations, {
1131
+ async getUpdateSpotMarketStatusIx(spotMarketIndex, marketStatus) {
1132
+ return await this.program.instruction.updateSpotMarketStatus(marketStatus, {
968
1133
  accounts: {
969
1134
  admin: this.isSubscribed
970
1135
  ? this.getStateAccount().admin
@@ -973,26 +1138,32 @@ class AdminClient extends driftClient_1.DriftClient {
973
1138
  spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
974
1139
  },
975
1140
  });
1141
+ }
1142
+ async updateSpotMarketPausedOperations(spotMarketIndex, pausedOperations) {
1143
+ const updateSpotMarketPausedOperationsIx = await this.getUpdateSpotMarketPausedOperationsIx(spotMarketIndex, pausedOperations);
976
1144
  const tx = await this.buildTransaction(updateSpotMarketPausedOperationsIx);
977
1145
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
978
1146
  return txSig;
979
1147
  }
980
- async updatePerpMarketStatus(perpMarketIndex, marketStatus) {
981
- const updatePerpMarketStatusIx = await this.program.instruction.updatePerpMarketStatus(marketStatus, {
1148
+ async getUpdateSpotMarketPausedOperationsIx(spotMarketIndex, pausedOperations) {
1149
+ return await this.program.instruction.updateSpotMarketPausedOperations(pausedOperations, {
982
1150
  accounts: {
983
1151
  admin: this.isSubscribed
984
1152
  ? this.getStateAccount().admin
985
1153
  : this.wallet.publicKey,
986
1154
  state: await this.getStatePublicKey(),
987
- perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
1155
+ spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
988
1156
  },
989
1157
  });
1158
+ }
1159
+ async updatePerpMarketStatus(perpMarketIndex, marketStatus) {
1160
+ const updatePerpMarketStatusIx = await this.getUpdatePerpMarketStatusIx(perpMarketIndex, marketStatus);
990
1161
  const tx = await this.buildTransaction(updatePerpMarketStatusIx);
991
1162
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
992
1163
  return txSig;
993
1164
  }
994
- async updatePerpMarketPausedOperations(perpMarketIndex, pausedOperations) {
995
- const updatePerpMarketPausedOperationsIx = await this.program.instruction.updatePerpMarketPausedOperations(pausedOperations, {
1165
+ async getUpdatePerpMarketStatusIx(perpMarketIndex, marketStatus) {
1166
+ return await this.program.instruction.updatePerpMarketStatus(marketStatus, {
996
1167
  accounts: {
997
1168
  admin: this.isSubscribed
998
1169
  ? this.getStateAccount().admin
@@ -1001,12 +1172,15 @@ class AdminClient extends driftClient_1.DriftClient {
1001
1172
  perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
1002
1173
  },
1003
1174
  });
1175
+ }
1176
+ async updatePerpMarketPausedOperations(perpMarketIndex, pausedOperations) {
1177
+ const updatePerpMarketPausedOperationsIx = await this.getUpdatePerpMarketPausedOperationsIx(perpMarketIndex, pausedOperations);
1004
1178
  const tx = await this.buildTransaction(updatePerpMarketPausedOperationsIx);
1005
1179
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
1006
1180
  return txSig;
1007
1181
  }
1008
- async updatePerpMarketContractTier(perpMarketIndex, contractTier) {
1009
- const updatePerpMarketContractTierIx = await this.program.instruction.updatePerpMarketContractTier(contractTier, {
1182
+ async getUpdatePerpMarketPausedOperationsIx(perpMarketIndex, pausedOperations) {
1183
+ return await this.program.instruction.updatePerpMarketPausedOperations(pausedOperations, {
1010
1184
  accounts: {
1011
1185
  admin: this.isSubscribed
1012
1186
  ? this.getStateAccount().admin
@@ -1015,25 +1189,32 @@ class AdminClient extends driftClient_1.DriftClient {
1015
1189
  perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
1016
1190
  },
1017
1191
  });
1192
+ }
1193
+ async updatePerpMarketContractTier(perpMarketIndex, contractTier) {
1194
+ const updatePerpMarketContractTierIx = await this.getUpdatePerpMarketContractTierIx(perpMarketIndex, contractTier);
1018
1195
  const tx = await this.buildTransaction(updatePerpMarketContractTierIx);
1019
1196
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
1020
1197
  return txSig;
1021
1198
  }
1022
- async updateExchangeStatus(exchangeStatus) {
1023
- const updateExchangeStatusIx = await this.program.instruction.updateExchangeStatus(exchangeStatus, {
1199
+ async getUpdatePerpMarketContractTierIx(perpMarketIndex, contractTier) {
1200
+ return await this.program.instruction.updatePerpMarketContractTier(contractTier, {
1024
1201
  accounts: {
1025
1202
  admin: this.isSubscribed
1026
1203
  ? this.getStateAccount().admin
1027
1204
  : this.wallet.publicKey,
1028
1205
  state: await this.getStatePublicKey(),
1206
+ perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
1029
1207
  },
1030
1208
  });
1209
+ }
1210
+ async updateExchangeStatus(exchangeStatus) {
1211
+ const updateExchangeStatusIx = await this.getUpdateExchangeStatusIx(exchangeStatus);
1031
1212
  const tx = await this.buildTransaction(updateExchangeStatusIx);
1032
1213
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
1033
1214
  return txSig;
1034
1215
  }
1035
- async updatePerpAuctionDuration(minDuration) {
1036
- const updatePerpAuctionDurationIx = await this.program.instruction.updatePerpAuctionDuration(typeof minDuration === 'number' ? minDuration : minDuration.toNumber(), {
1216
+ async getUpdateExchangeStatusIx(exchangeStatus) {
1217
+ return await this.program.instruction.updateExchangeStatus(exchangeStatus, {
1037
1218
  accounts: {
1038
1219
  admin: this.isSubscribed
1039
1220
  ? this.getStateAccount().admin
@@ -1041,12 +1222,15 @@ class AdminClient extends driftClient_1.DriftClient {
1041
1222
  state: await this.getStatePublicKey(),
1042
1223
  },
1043
1224
  });
1225
+ }
1226
+ async updatePerpAuctionDuration(minDuration) {
1227
+ const updatePerpAuctionDurationIx = await this.getUpdatePerpAuctionDurationIx(minDuration);
1044
1228
  const tx = await this.buildTransaction(updatePerpAuctionDurationIx);
1045
1229
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
1046
1230
  return txSig;
1047
1231
  }
1048
- async updateSpotAuctionDuration(defaultAuctionDuration) {
1049
- const updateSpotAuctionDurationIx = await this.program.instruction.updateSpotAuctionDuration(defaultAuctionDuration, {
1232
+ async getUpdatePerpAuctionDurationIx(minDuration) {
1233
+ return await this.program.instruction.updatePerpAuctionDuration(typeof minDuration === 'number' ? minDuration : minDuration.toNumber(), {
1050
1234
  accounts: {
1051
1235
  admin: this.isSubscribed
1052
1236
  ? this.getStateAccount().admin
@@ -1054,54 +1238,65 @@ class AdminClient extends driftClient_1.DriftClient {
1054
1238
  state: await this.getStatePublicKey(),
1055
1239
  },
1056
1240
  });
1241
+ }
1242
+ async updateSpotAuctionDuration(defaultAuctionDuration) {
1243
+ const updateSpotAuctionDurationIx = await this.getUpdateSpotAuctionDurationIx(defaultAuctionDuration);
1057
1244
  const tx = await this.buildTransaction(updateSpotAuctionDurationIx);
1058
1245
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
1059
1246
  return txSig;
1060
1247
  }
1061
- async updatePerpMarketMaxFillReserveFraction(perpMarketIndex, maxBaseAssetAmountRatio) {
1062
- const updatePerpMarketMaxFillReserveFractionIx = await this.program.instruction.updatePerpMarketMaxFillReserveFraction(maxBaseAssetAmountRatio, {
1248
+ async getUpdateSpotAuctionDurationIx(defaultAuctionDuration) {
1249
+ return await this.program.instruction.updateSpotAuctionDuration(defaultAuctionDuration, {
1063
1250
  accounts: {
1064
1251
  admin: this.isSubscribed
1065
1252
  ? this.getStateAccount().admin
1066
1253
  : this.wallet.publicKey,
1067
1254
  state: await this.getStatePublicKey(),
1068
- perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
1069
1255
  },
1070
1256
  });
1257
+ }
1258
+ async updatePerpMarketMaxFillReserveFraction(perpMarketIndex, maxBaseAssetAmountRatio) {
1259
+ const updatePerpMarketMaxFillReserveFractionIx = await this.getUpdatePerpMarketMaxFillReserveFractionIx(perpMarketIndex, maxBaseAssetAmountRatio);
1071
1260
  const tx = await this.buildTransaction(updatePerpMarketMaxFillReserveFractionIx);
1072
1261
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
1073
1262
  return txSig;
1074
1263
  }
1075
- async updateMaxSlippageRatio(perpMarketIndex, maxSlippageRatio) {
1076
- const updateMaxSlippageRatioIx = await this.program.instruction.updateMaxSlippageRatio(maxSlippageRatio, {
1264
+ async getUpdatePerpMarketMaxFillReserveFractionIx(perpMarketIndex, maxBaseAssetAmountRatio) {
1265
+ return await this.program.instruction.updatePerpMarketMaxFillReserveFraction(maxBaseAssetAmountRatio, {
1077
1266
  accounts: {
1078
1267
  admin: this.isSubscribed
1079
1268
  ? this.getStateAccount().admin
1080
1269
  : this.wallet.publicKey,
1081
1270
  state: await this.getStatePublicKey(),
1082
- perpMarket: this.getPerpMarketAccount(perpMarketIndex).pubkey,
1271
+ perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
1083
1272
  },
1084
1273
  });
1274
+ }
1275
+ async updateMaxSlippageRatio(perpMarketIndex, maxSlippageRatio) {
1276
+ const updateMaxSlippageRatioIx = await this.getUpdateMaxSlippageRatioIx(perpMarketIndex, maxSlippageRatio);
1085
1277
  const tx = await this.buildTransaction(updateMaxSlippageRatioIx);
1086
1278
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
1087
1279
  return txSig;
1088
1280
  }
1089
- async updatePerpMarketUnrealizedAssetWeight(perpMarketIndex, unrealizedInitialAssetWeight, unrealizedMaintenanceAssetWeight) {
1090
- const updatePerpMarketUnrealizedAssetWeightIx = await this.program.instruction.updatePerpMarketUnrealizedAssetWeight(unrealizedInitialAssetWeight, unrealizedMaintenanceAssetWeight, {
1281
+ async getUpdateMaxSlippageRatioIx(perpMarketIndex, maxSlippageRatio) {
1282
+ return await this.program.instruction.updateMaxSlippageRatio(maxSlippageRatio, {
1091
1283
  accounts: {
1092
1284
  admin: this.isSubscribed
1093
1285
  ? this.getStateAccount().admin
1094
1286
  : this.wallet.publicKey,
1095
1287
  state: await this.getStatePublicKey(),
1096
- perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
1288
+ perpMarket: this.getPerpMarketAccount(perpMarketIndex).pubkey,
1097
1289
  },
1098
1290
  });
1291
+ }
1292
+ async updatePerpMarketUnrealizedAssetWeight(perpMarketIndex, unrealizedInitialAssetWeight, unrealizedMaintenanceAssetWeight) {
1293
+ const updatePerpMarketUnrealizedAssetWeightIx = await this.getUpdatePerpMarketUnrealizedAssetWeightIx(perpMarketIndex, unrealizedInitialAssetWeight, unrealizedMaintenanceAssetWeight);
1099
1294
  const tx = await this.buildTransaction(updatePerpMarketUnrealizedAssetWeightIx);
1100
1295
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
1101
1296
  return txSig;
1102
1297
  }
1103
- async updatePerpMarketMaxImbalances(perpMarketIndex, unrealizedMaxImbalance, maxRevenueWithdrawPerPeriod, quoteMaxInsurance) {
1104
- const updatePerpMarketMaxImabalancesIx = await this.program.instruction.updatePerpMarketMaxImbalances(unrealizedMaxImbalance, maxRevenueWithdrawPerPeriod, quoteMaxInsurance, {
1298
+ async getUpdatePerpMarketUnrealizedAssetWeightIx(perpMarketIndex, unrealizedInitialAssetWeight, unrealizedMaintenanceAssetWeight) {
1299
+ return await this.program.instruction.updatePerpMarketUnrealizedAssetWeight(unrealizedInitialAssetWeight, unrealizedMaintenanceAssetWeight, {
1105
1300
  accounts: {
1106
1301
  admin: this.isSubscribed
1107
1302
  ? this.getStateAccount().admin
@@ -1110,12 +1305,15 @@ class AdminClient extends driftClient_1.DriftClient {
1110
1305
  perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
1111
1306
  },
1112
1307
  });
1308
+ }
1309
+ async updatePerpMarketMaxImbalances(perpMarketIndex, unrealizedMaxImbalance, maxRevenueWithdrawPerPeriod, quoteMaxInsurance) {
1310
+ const updatePerpMarketMaxImabalancesIx = await this.getUpdatePerpMarketMaxImbalancesIx(perpMarketIndex, unrealizedMaxImbalance, maxRevenueWithdrawPerPeriod, quoteMaxInsurance);
1113
1311
  const tx = await this.buildTransaction(updatePerpMarketMaxImabalancesIx);
1114
1312
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
1115
1313
  return txSig;
1116
1314
  }
1117
- async updatePerpMarketMaxOpenInterest(perpMarketIndex, maxOpenInterest) {
1118
- const updatePerpMarketMaxOpenInterestIx = await this.program.instruction.updatePerpMarketMaxOpenInterest(maxOpenInterest, {
1315
+ async getUpdatePerpMarketMaxImbalancesIx(perpMarketIndex, unrealizedMaxImbalance, maxRevenueWithdrawPerPeriod, quoteMaxInsurance) {
1316
+ return await this.program.instruction.updatePerpMarketMaxImbalances(unrealizedMaxImbalance, maxRevenueWithdrawPerPeriod, quoteMaxInsurance, {
1119
1317
  accounts: {
1120
1318
  admin: this.isSubscribed
1121
1319
  ? this.getStateAccount().admin
@@ -1124,12 +1322,15 @@ class AdminClient extends driftClient_1.DriftClient {
1124
1322
  perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
1125
1323
  },
1126
1324
  });
1325
+ }
1326
+ async updatePerpMarketMaxOpenInterest(perpMarketIndex, maxOpenInterest) {
1327
+ const updatePerpMarketMaxOpenInterestIx = await this.getUpdatePerpMarketMaxOpenInterestIx(perpMarketIndex, maxOpenInterest);
1127
1328
  const tx = await this.buildTransaction(updatePerpMarketMaxOpenInterestIx);
1128
1329
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
1129
1330
  return txSig;
1130
1331
  }
1131
- async updatePerpMarketFeeAdjustment(perpMarketIndex, feeAdjustment) {
1132
- const updatepPerpMarketFeeAdjustmentIx = await this.program.instruction.updatePerpMarketFeeAdjustment(feeAdjustment, {
1332
+ async getUpdatePerpMarketMaxOpenInterestIx(perpMarketIndex, maxOpenInterest) {
1333
+ return await this.program.instruction.updatePerpMarketMaxOpenInterest(maxOpenInterest, {
1133
1334
  accounts: {
1134
1335
  admin: this.isSubscribed
1135
1336
  ? this.getStateAccount().admin
@@ -1138,82 +1339,111 @@ class AdminClient extends driftClient_1.DriftClient {
1138
1339
  perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
1139
1340
  },
1140
1341
  });
1342
+ }
1343
+ async updatePerpMarketFeeAdjustment(perpMarketIndex, feeAdjustment) {
1344
+ const updatepPerpMarketFeeAdjustmentIx = await this.getUpdatePerpMarketFeeAdjustmentIx(perpMarketIndex, feeAdjustment);
1141
1345
  const tx = await this.buildTransaction(updatepPerpMarketFeeAdjustmentIx);
1142
1346
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
1143
1347
  return txSig;
1144
1348
  }
1145
- async updateSerumVault(srmVault) {
1146
- const updateSerumVaultIx = await this.program.instruction.updateSerumVault(srmVault, {
1349
+ async getUpdatePerpMarketFeeAdjustmentIx(perpMarketIndex, feeAdjustment) {
1350
+ return await this.program.instruction.updatePerpMarketFeeAdjustment(feeAdjustment, {
1147
1351
  accounts: {
1148
1352
  admin: this.isSubscribed
1149
1353
  ? this.getStateAccount().admin
1150
1354
  : this.wallet.publicKey,
1151
1355
  state: await this.getStatePublicKey(),
1152
- srmVault: srmVault,
1356
+ perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
1153
1357
  },
1154
1358
  });
1359
+ }
1360
+ async updateSerumVault(srmVault) {
1361
+ const updateSerumVaultIx = await this.getUpdateSerumVaultIx(srmVault);
1155
1362
  const tx = await this.buildTransaction(updateSerumVaultIx);
1156
1363
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
1157
1364
  return txSig;
1158
1365
  }
1159
- async updatePerpMarketLiquidationFee(perpMarketIndex, liquidatorFee, ifLiquidationFee) {
1160
- const updatePerpMarketLiquidationFeeIx = await this.program.instruction.updatePerpMarketLiquidationFee(liquidatorFee, ifLiquidationFee, {
1366
+ async getUpdateSerumVaultIx(srmVault) {
1367
+ return await this.program.instruction.updateSerumVault(srmVault, {
1161
1368
  accounts: {
1162
1369
  admin: this.isSubscribed
1163
1370
  ? this.getStateAccount().admin
1164
1371
  : this.wallet.publicKey,
1165
1372
  state: await this.getStatePublicKey(),
1166
- perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
1373
+ srmVault: srmVault,
1167
1374
  },
1168
1375
  });
1376
+ }
1377
+ async updatePerpMarketLiquidationFee(perpMarketIndex, liquidatorFee, ifLiquidationFee) {
1378
+ const updatePerpMarketLiquidationFeeIx = await this.getUpdatePerpMarketLiquidationFeeIx(perpMarketIndex, liquidatorFee, ifLiquidationFee);
1169
1379
  const tx = await this.buildTransaction(updatePerpMarketLiquidationFeeIx);
1170
1380
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
1171
1381
  return txSig;
1172
1382
  }
1173
- async updateSpotMarketLiquidationFee(spotMarketIndex, liquidatorFee, ifLiquidationFee) {
1174
- const updateSpotMarketLiquidationFeeIx = await this.program.instruction.updateSpotMarketLiquidationFee(liquidatorFee, ifLiquidationFee, {
1383
+ async getUpdatePerpMarketLiquidationFeeIx(perpMarketIndex, liquidatorFee, ifLiquidationFee) {
1384
+ return await this.program.instruction.updatePerpMarketLiquidationFee(liquidatorFee, ifLiquidationFee, {
1175
1385
  accounts: {
1176
1386
  admin: this.isSubscribed
1177
1387
  ? this.getStateAccount().admin
1178
1388
  : this.wallet.publicKey,
1179
1389
  state: await this.getStatePublicKey(),
1180
- spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
1390
+ perpMarket: await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex),
1181
1391
  },
1182
1392
  });
1393
+ }
1394
+ async updateSpotMarketLiquidationFee(spotMarketIndex, liquidatorFee, ifLiquidationFee) {
1395
+ const updateSpotMarketLiquidationFeeIx = await this.getUpdateSpotMarketLiquidationFeeIx(spotMarketIndex, liquidatorFee, ifLiquidationFee);
1183
1396
  const tx = await this.buildTransaction(updateSpotMarketLiquidationFeeIx);
1184
1397
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
1185
1398
  return txSig;
1186
1399
  }
1187
- async initializeProtocolIfSharesTransferConfig() {
1188
- const initializeProtocolIfSharesTransferConfigIx = await this.program.instruction.initializeProtocolIfSharesTransferConfig({
1400
+ async getUpdateSpotMarketLiquidationFeeIx(spotMarketIndex, liquidatorFee, ifLiquidationFee) {
1401
+ return await this.program.instruction.updateSpotMarketLiquidationFee(liquidatorFee, ifLiquidationFee, {
1189
1402
  accounts: {
1190
1403
  admin: this.isSubscribed
1191
1404
  ? this.getStateAccount().admin
1192
1405
  : this.wallet.publicKey,
1193
1406
  state: await this.getStatePublicKey(),
1194
- rent: web3_js_1.SYSVAR_RENT_PUBKEY,
1195
- systemProgram: anchor.web3.SystemProgram.programId,
1196
- protocolIfSharesTransferConfig: (0, pda_1.getProtocolIfSharesTransferConfigPublicKey)(this.program.programId),
1407
+ spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
1197
1408
  },
1198
1409
  });
1410
+ }
1411
+ async initializeProtocolIfSharesTransferConfig() {
1412
+ const initializeProtocolIfSharesTransferConfigIx = await this.getInitializeProtocolIfSharesTransferConfigIx();
1199
1413
  const tx = await this.buildTransaction(initializeProtocolIfSharesTransferConfigIx);
1200
1414
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
1201
1415
  return txSig;
1202
1416
  }
1203
- async updateProtocolIfSharesTransferConfig(whitelistedSigners, maxTransferPerEpoch) {
1204
- const updateProtocolIfSharesTransferConfigIx = await this.program.instruction.updateProtocolIfSharesTransferConfig(whitelistedSigners || null, maxTransferPerEpoch, {
1417
+ async getInitializeProtocolIfSharesTransferConfigIx() {
1418
+ return await this.program.instruction.initializeProtocolIfSharesTransferConfig({
1205
1419
  accounts: {
1206
1420
  admin: this.isSubscribed
1207
1421
  ? this.getStateAccount().admin
1208
1422
  : this.wallet.publicKey,
1209
1423
  state: await this.getStatePublicKey(),
1424
+ rent: web3_js_1.SYSVAR_RENT_PUBKEY,
1425
+ systemProgram: anchor.web3.SystemProgram.programId,
1210
1426
  protocolIfSharesTransferConfig: (0, pda_1.getProtocolIfSharesTransferConfigPublicKey)(this.program.programId),
1211
1427
  },
1212
1428
  });
1429
+ }
1430
+ async updateProtocolIfSharesTransferConfig(whitelistedSigners, maxTransferPerEpoch) {
1431
+ const updateProtocolIfSharesTransferConfigIx = await this.getUpdateProtocolIfSharesTransferConfigIx(whitelistedSigners, maxTransferPerEpoch);
1213
1432
  const tx = await this.buildTransaction(updateProtocolIfSharesTransferConfigIx);
1214
1433
  const { txSig } = await this.sendTransaction(tx, [], this.opts);
1215
1434
  return txSig;
1216
1435
  }
1436
+ async getUpdateProtocolIfSharesTransferConfigIx(whitelistedSigners, maxTransferPerEpoch) {
1437
+ return await this.program.instruction.updateProtocolIfSharesTransferConfig(whitelistedSigners || null, maxTransferPerEpoch, {
1438
+ accounts: {
1439
+ admin: this.isSubscribed
1440
+ ? this.getStateAccount().admin
1441
+ : this.wallet.publicKey,
1442
+ state: await this.getStatePublicKey(),
1443
+ protocolIfSharesTransferConfig: (0, pda_1.getProtocolIfSharesTransferConfigPublicKey)(this.program.programId),
1444
+ },
1445
+ });
1446
+ }
1217
1447
  async initializePrelaunchOracle(perpMarketIndex, price, maxPrice) {
1218
1448
  const initializePrelaunchOracleIx = await this.getInitializePrelaunchOracleIx(perpMarketIndex, price, maxPrice);
1219
1449
  const tx = await this.buildTransaction(initializePrelaunchOracleIx);