@drift-labs/sdk 2.20.0-beta.0 → 2.20.0-beta.1

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.
Files changed (81) hide show
  1. package/lib/accounts/bulkAccountLoader.d.ts +2 -1
  2. package/lib/accounts/bulkAccountLoader.js +7 -7
  3. package/lib/accounts/fetch.d.ts +1 -0
  4. package/lib/accounts/fetch.js +8 -4
  5. package/lib/accounts/pollingDriftClientAccountSubscriber.js +7 -7
  6. package/lib/accounts/pollingTokenAccountSubscriber.js +2 -2
  7. package/lib/accounts/pollingUserAccountSubscriber.js +2 -2
  8. package/lib/accounts/pollingUserStatsAccountSubscriber.js +2 -2
  9. package/lib/accounts/types.d.ts +5 -4
  10. package/lib/accounts/webSocketAccountSubscriber.js +1 -1
  11. package/lib/accounts/webSocketDriftClientAccountSubscriber.js +3 -3
  12. package/lib/addresses/marketAddresses.js +1 -1
  13. package/lib/addresses/pda.js +5 -1
  14. package/lib/adminClient.js +61 -57
  15. package/lib/config.d.ts +2 -2
  16. package/lib/constants/perpMarkets.d.ts +1 -1
  17. package/lib/constants/spotMarkets.d.ts +1 -1
  18. package/lib/dlob/DLOB.d.ts +6 -5
  19. package/lib/dlob/DLOB.js +105 -75
  20. package/lib/dlob/DLOBNode.d.ts +2 -2
  21. package/lib/dlob/DLOBNode.js +7 -7
  22. package/lib/dlob/DLOBOrders.d.ts +2 -2
  23. package/lib/dlob/NodeList.d.ts +1 -1
  24. package/lib/dlob/NodeList.js +2 -2
  25. package/lib/driftClient.d.ts +3 -2
  26. package/lib/driftClient.js +114 -95
  27. package/lib/driftClientConfig.d.ts +3 -3
  28. package/lib/events/eventSubscriber.js +2 -2
  29. package/lib/events/fetchLogs.d.ts +2 -2
  30. package/lib/events/pollingLogProvider.js +1 -1
  31. package/lib/events/types.d.ts +14 -14
  32. package/lib/examples/loadDlob.js +2 -2
  33. package/lib/examples/makeTradeExample.js +9 -9
  34. package/lib/factory/bigNum.js +13 -13
  35. package/lib/factory/oracleClient.js +4 -4
  36. package/lib/idl/drift.json +1 -1
  37. package/lib/index.js +5 -1
  38. package/lib/math/amm.d.ts +1 -1
  39. package/lib/math/amm.js +23 -23
  40. package/lib/math/auction.js +6 -6
  41. package/lib/math/exchangeStatus.js +2 -2
  42. package/lib/math/funding.js +2 -2
  43. package/lib/math/margin.js +4 -4
  44. package/lib/math/market.js +15 -15
  45. package/lib/math/oracles.js +1 -1
  46. package/lib/math/orders.js +27 -24
  47. package/lib/math/position.js +5 -5
  48. package/lib/math/repeg.js +1 -1
  49. package/lib/math/spotBalance.js +9 -9
  50. package/lib/math/spotMarket.js +3 -3
  51. package/lib/math/spotPosition.js +3 -3
  52. package/lib/math/trade.d.ts +1 -1
  53. package/lib/math/trade.js +42 -42
  54. package/lib/math/utils.js +1 -1
  55. package/lib/oracles/oracleClientCache.js +1 -1
  56. package/lib/oracles/pythClient.js +1 -1
  57. package/lib/oracles/types.d.ts +2 -2
  58. package/lib/serum/types.d.ts +1 -1
  59. package/lib/slot/SlotSubscriber.d.ts +1 -1
  60. package/lib/tokenFaucet.js +5 -1
  61. package/lib/tx/retryTxSender.d.ts +1 -1
  62. package/lib/tx/retryTxSender.js +1 -1
  63. package/lib/tx/types.d.ts +1 -1
  64. package/lib/types.d.ts +65 -44
  65. package/lib/user.js +63 -63
  66. package/lib/userConfig.d.ts +2 -2
  67. package/lib/userMap/userMap.js +1 -1
  68. package/lib/userMap/userStatsMap.js +3 -3
  69. package/lib/userStats.js +2 -2
  70. package/lib/userStatsConfig.d.ts +2 -2
  71. package/package.json +1 -1
  72. package/src/accounts/bulkAccountLoader.ts +5 -5
  73. package/src/accounts/fetch.ts +8 -0
  74. package/src/dlob/DLOB.ts +55 -8
  75. package/src/driftClient.ts +28 -0
  76. package/src/idl/drift.json +1 -1
  77. package/src/math/orders.ts +5 -1
  78. package/src/types.ts +22 -0
  79. package/src/userMap/userStatsMap.ts +1 -4
  80. package/tests/amm/test.ts +24 -28
  81. package/tests/dlob/test.ts +67 -73
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -44,11 +48,18 @@ const config_1 = require("./config");
44
48
  const spotMarkets_1 = require("./constants/spotMarkets");
45
49
  const userStats_1 = require("./userStats");
46
50
  const spotPosition_1 = require("./math/spotPosition");
51
+ const market_1 = require("./math/market");
47
52
  /**
48
53
  * # DriftClient
49
54
  * This class is the main way to interact with Drift Protocol. It allows you to subscribe to the various accounts where the Market's state is stored, as well as: opening positions, liquidating, settling funding, depositing & withdrawing, and more.
50
55
  */
51
56
  class DriftClient {
57
+ get isSubscribed() {
58
+ return this._isSubscribed && this.accountSubscriber.isSubscribed;
59
+ }
60
+ set isSubscribed(val) {
61
+ this._isSubscribed = val;
62
+ }
52
63
  constructor(config) {
53
64
  var _a, _b, _c, _d, _e, _f, _g, _h;
54
65
  this.users = new Map();
@@ -76,7 +87,7 @@ class DriftClient {
76
87
  if (config.userStats) {
77
88
  this.userStats = new userStats_1.UserStats({
78
89
  driftClient: this,
79
- userStatsAccountPublicKey: pda_1.getUserStatsAccountPublicKey(this.program.programId, this.authority),
90
+ userStatsAccountPublicKey: (0, pda_1.getUserStatsAccountPublicKey)(this.program.programId, this.authority),
80
91
  accountSubscription: this.userAccountSubscriptionConfig,
81
92
  });
82
93
  }
@@ -84,7 +95,7 @@ class DriftClient {
84
95
  let spotMarketIndexes = config.spotMarketIndexes;
85
96
  let oracleInfos = config.oracleInfos;
86
97
  if (config.env) {
87
- const { perpMarketIndexes: envPerpMarketIndexes, spotMarketIndexes: envSpotMarketIndexes, oracleInfos: envOracleInfos, } = config_1.getMarketsAndOraclesForSubscription(config.env);
98
+ const { perpMarketIndexes: envPerpMarketIndexes, spotMarketIndexes: envSpotMarketIndexes, oracleInfos: envOracleInfos, } = (0, config_1.getMarketsAndOraclesForSubscription)(config.env);
88
99
  perpMarketIndexes = perpMarketIndexes
89
100
  ? perpMarketIndexes
90
101
  : envPerpMarketIndexes;
@@ -106,12 +117,6 @@ class DriftClient {
106
117
  this.eventEmitter = this.accountSubscriber.eventEmitter;
107
118
  this.txSender = new retryTxSender_1.RetryTxSender(this.provider, (_f = config.txSenderConfig) === null || _f === void 0 ? void 0 : _f.timeout, (_g = config.txSenderConfig) === null || _g === void 0 ? void 0 : _g.retrySleep, (_h = config.txSenderConfig) === null || _h === void 0 ? void 0 : _h.additionalConnections);
108
119
  }
109
- get isSubscribed() {
110
- return this._isSubscribed && this.accountSubscriber.isSubscribed;
111
- }
112
- set isSubscribed(val) {
113
- this._isSubscribed = val;
114
- }
115
120
  createUsers(subAccountIds, accountSubscriptionConfig) {
116
121
  for (const subAccountId of subAccountIds) {
117
122
  const user = this.createUser(subAccountId, accountSubscriptionConfig);
@@ -119,7 +124,7 @@ class DriftClient {
119
124
  }
120
125
  }
121
126
  createUser(subAccountId, accountSubscriptionConfig) {
122
- const userAccountPublicKey = pda_1.getUserAccountPublicKeySync(this.program.programId, this.authority, subAccountId);
127
+ const userAccountPublicKey = (0, pda_1.getUserAccountPublicKeySync)(this.program.programId, this.authority, subAccountId);
123
128
  return new user_1.User({
124
129
  driftClient: this,
125
130
  userAccountPublicKey,
@@ -164,14 +169,14 @@ class DriftClient {
164
169
  if (this.statePublicKey) {
165
170
  return this.statePublicKey;
166
171
  }
167
- this.statePublicKey = await pda_1.getDriftStateAccountPublicKey(this.program.programId);
172
+ this.statePublicKey = await (0, pda_1.getDriftStateAccountPublicKey)(this.program.programId);
168
173
  return this.statePublicKey;
169
174
  }
170
175
  getSignerPublicKey() {
171
176
  if (this.signerPublicKey) {
172
177
  return this.signerPublicKey;
173
178
  }
174
- this.signerPublicKey = pda_1.getDriftSignerPublicKey(this.program.programId);
179
+ this.signerPublicKey = (0, pda_1.getDriftSignerPublicKey)(this.program.programId);
175
180
  return this.signerPublicKey;
176
181
  }
177
182
  getStateAccount() {
@@ -232,7 +237,7 @@ class DriftClient {
232
237
  return this.accountSubscriber.getOraclePriceDataAndSlot(oraclePublicKey);
233
238
  }
234
239
  async getSerumV3FulfillmentConfig(serumMarket) {
235
- const address = await pda_1.getSerumFulfillmentConfigPublicKey(this.program.programId, serumMarket);
240
+ const address = await (0, pda_1.getSerumFulfillmentConfigPublicKey)(this.program.programId, serumMarket);
236
241
  return (await this.program.account.serumV3FulfillmentConfig.fetch(address));
237
242
  }
238
243
  async fetchMarketLookupTableAccount() {
@@ -263,7 +268,7 @@ class DriftClient {
263
268
  await this.userStats.unsubscribe();
264
269
  this.userStats = new userStats_1.UserStats({
265
270
  driftClient: this,
266
- userStatsAccountPublicKey: pda_1.getUserStatsAccountPublicKey(this.program.programId, this.authority),
271
+ userStatsAccountPublicKey: (0, pda_1.getUserStatsAccountPublicKey)(this.program.programId, this.authority),
267
272
  accountSubscription: this.userAccountSubscriptionConfig,
268
273
  });
269
274
  }
@@ -303,7 +308,7 @@ class DriftClient {
303
308
  return [txSig, userAccountPublicKey];
304
309
  }
305
310
  async getInitializeUserInstructions(subAccountId = 0, name = userName_1.DEFAULT_USER_NAME, referrerInfo) {
306
- const userAccountPublicKey = await pda_1.getUserAccountPublicKey(this.program.programId, this.wallet.publicKey, subAccountId);
311
+ const userAccountPublicKey = await (0, pda_1.getUserAccountPublicKey)(this.program.programId, this.wallet.publicKey, subAccountId);
307
312
  const remainingAccounts = new Array();
308
313
  if (referrerInfo !== undefined) {
309
314
  remainingAccounts.push({
@@ -326,7 +331,7 @@ class DriftClient {
326
331
  isSigner: false,
327
332
  });
328
333
  }
329
- const nameBuffer = userName_1.encodeName(name);
334
+ const nameBuffer = (0, userName_1.encodeName)(name);
330
335
  const initializeUserAccountIx = await this.program.instruction.initializeUser(subAccountId, nameBuffer, {
331
336
  accounts: {
332
337
  user: userAccountPublicKey,
@@ -354,8 +359,8 @@ class DriftClient {
354
359
  });
355
360
  }
356
361
  async updateUserName(name, subAccountId = 0) {
357
- const userAccountPublicKey = pda_1.getUserAccountPublicKeySync(this.program.programId, this.wallet.publicKey, subAccountId);
358
- const nameBuffer = userName_1.encodeName(name);
362
+ const userAccountPublicKey = (0, pda_1.getUserAccountPublicKeySync)(this.program.programId, this.wallet.publicKey, subAccountId);
363
+ const nameBuffer = (0, userName_1.encodeName)(name);
359
364
  const tx = await this.program.transaction.updateUserName(subAccountId, nameBuffer, {
360
365
  accounts: {
361
366
  user: userAccountPublicKey,
@@ -376,7 +381,7 @@ class DriftClient {
376
381
  return txSig;
377
382
  }
378
383
  async updateUserMarginTradingEnabled(marginTradingEnabled, subAccountId = 0) {
379
- const userAccountPublicKey = pda_1.getUserAccountPublicKeySync(this.program.programId, this.wallet.publicKey, subAccountId);
384
+ const userAccountPublicKey = (0, pda_1.getUserAccountPublicKeySync)(this.program.programId, this.wallet.publicKey, subAccountId);
380
385
  await this.addUser(subAccountId);
381
386
  const remainingAccounts = this.getRemainingAccounts({
382
387
  userAccounts: [this.getUserAccount(subAccountId)],
@@ -427,7 +432,7 @@ class DriftClient {
427
432
  }
428
433
  async deleteUser(subAccountId = 0, txParams) {
429
434
  var _a;
430
- const userAccountPublicKey = pda_1.getUserAccountPublicKeySync(this.program.programId, this.wallet.publicKey, subAccountId);
435
+ const userAccountPublicKey = (0, pda_1.getUserAccountPublicKeySync)(this.program.programId, this.wallet.publicKey, subAccountId);
431
436
  const ix = await this.program.instruction.deleteUser({
432
437
  accounts: {
433
438
  user: userAccountPublicKey,
@@ -436,7 +441,7 @@ class DriftClient {
436
441
  state: await this.getStatePublicKey(),
437
442
  },
438
443
  });
439
- const { txSig } = await this.sendTransaction(utils_1.wrapInTx(ix, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
444
+ const { txSig } = await this.sendTransaction((0, utils_1.wrapInTx)(ix, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
440
445
  await ((_a = this.users.get(subAccountId)) === null || _a === void 0 ? void 0 : _a.unsubscribe());
441
446
  this.users.delete(subAccountId);
442
447
  return txSig;
@@ -458,7 +463,7 @@ class DriftClient {
458
463
  if (this.userStatsAccountPublicKey) {
459
464
  return this.userStatsAccountPublicKey;
460
465
  }
461
- this.userStatsAccountPublicKey = pda_1.getUserStatsAccountPublicKey(this.program.programId, this.authority);
466
+ this.userStatsAccountPublicKey = (0, pda_1.getUserStatsAccountPublicKey)(this.program.programId, this.authority);
462
467
  return this.userStatsAccountPublicKey;
463
468
  }
464
469
  async getUserAccountPublicKey() {
@@ -484,7 +489,7 @@ class DriftClient {
484
489
  getQuoteAssetTokenAmount() {
485
490
  const spotMarket = this.getSpotMarketAccount(numericConstants_1.QUOTE_SPOT_MARKET_INDEX);
486
491
  const spotPosition = this.getSpotPosition(numericConstants_1.QUOTE_SPOT_MARKET_INDEX);
487
- return spotBalance_1.getTokenAmount(spotPosition.scaledBalance, spotMarket, spotPosition.balanceType);
492
+ return (0, spotBalance_1.getTokenAmount)(spotPosition.scaledBalance, spotMarket, spotPosition.balanceType);
488
493
  }
489
494
  getTokenAmount(marketIndex) {
490
495
  const spotPosition = this.getSpotPosition(marketIndex);
@@ -492,7 +497,7 @@ class DriftClient {
492
497
  return numericConstants_1.ZERO;
493
498
  }
494
499
  const spotMarket = this.getSpotMarketAccount(marketIndex);
495
- return spotBalance_1.getTokenAmount(spotPosition.scaledBalance, spotMarket, spotPosition.balanceType);
500
+ return (0, spotBalance_1.getTokenAmount)(spotPosition.scaledBalance, spotMarket, spotPosition.balanceType);
496
501
  }
497
502
  getRemainingAccounts(params) {
498
503
  var _a;
@@ -616,7 +621,7 @@ class DriftClient {
616
621
  const perpMarketAccountMap = new Map();
617
622
  for (const userAccount of userAccounts) {
618
623
  for (const spotPosition of userAccount.spotPositions) {
619
- if (!spotPosition_1.isSpotPositionAvailable(spotPosition)) {
624
+ if (!(0, spotPosition_1.isSpotPositionAvailable)(spotPosition)) {
620
625
  const spotMarket = this.getSpotMarketAccount(spotPosition.marketIndex);
621
626
  spotMarketAccountMap.set(spotPosition.marketIndex, {
622
627
  pubkey: spotMarket.pubkey,
@@ -641,7 +646,7 @@ class DriftClient {
641
646
  }
642
647
  }
643
648
  for (const position of userAccount.perpPositions) {
644
- if (!position_1.positionIsAvailable(position)) {
649
+ if (!(0, position_1.positionIsAvailable)(position)) {
645
650
  const market = this.getPerpMarketAccount(position.marketIndex);
646
651
  perpMarketAccountMap.set(position.marketIndex, {
647
652
  pubkey: market.pubkey,
@@ -700,7 +705,7 @@ class DriftClient {
700
705
  }
701
706
  async getDepositInstruction(amount, marketIndex, userTokenAccount, subAccountId, reduceOnly = false, userInitialized = true) {
702
707
  const userAccountPublicKey = subAccountId
703
- ? await pda_1.getUserAccountPublicKey(this.program.programId, this.authority, subAccountId)
708
+ ? await (0, pda_1.getUserAccountPublicKey)(this.program.programId, this.authority, subAccountId)
704
709
  : await this.getUserAccountPublicKey();
705
710
  let remainingAccounts = [];
706
711
  if (userInitialized) {
@@ -885,7 +890,7 @@ class DriftClient {
885
890
  });
886
891
  }
887
892
  async transferDeposit(amount, marketIndex, fromSubAccountId, toSubAccountId, txParams) {
888
- const { txSig, slot } = await this.sendTransaction(utils_1.wrapInTx(await this.getTransferDepositIx(amount, marketIndex, fromSubAccountId, toSubAccountId), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
893
+ const { txSig, slot } = await this.sendTransaction((0, utils_1.wrapInTx)(await this.getTransferDepositIx(amount, marketIndex, fromSubAccountId, toSubAccountId), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
889
894
  if (fromSubAccountId === this.activeSubAccountId ||
890
895
  toSubAccountId === this.activeSubAccountId) {
891
896
  this.spotMarketLastSlotCache.set(marketIndex, slot);
@@ -893,8 +898,8 @@ class DriftClient {
893
898
  return txSig;
894
899
  }
895
900
  async getTransferDepositIx(amount, marketIndex, fromSubAccountId, toSubAccountId) {
896
- const fromUser = await pda_1.getUserAccountPublicKey(this.program.programId, this.wallet.publicKey, fromSubAccountId);
897
- const toUser = await pda_1.getUserAccountPublicKey(this.program.programId, this.wallet.publicKey, toSubAccountId);
901
+ const fromUser = await (0, pda_1.getUserAccountPublicKey)(this.program.programId, this.wallet.publicKey, fromSubAccountId);
902
+ const toUser = await (0, pda_1.getUserAccountPublicKey)(this.program.programId, this.wallet.publicKey, toSubAccountId);
898
903
  let remainingAccounts;
899
904
  if (this.users.has(fromSubAccountId)) {
900
905
  remainingAccounts = this.getRemainingAccounts({
@@ -904,7 +909,7 @@ class DriftClient {
904
909
  });
905
910
  }
906
911
  else {
907
- const userAccountPublicKey = pda_1.getUserAccountPublicKeySync(this.program.programId, this.authority, fromSubAccountId);
912
+ const userAccountPublicKey = (0, pda_1.getUserAccountPublicKeySync)(this.program.programId, this.authority, fromSubAccountId);
908
913
  const fromUserAccount = (await this.program.account.user.fetch(userAccountPublicKey));
909
914
  remainingAccounts = this.getRemainingAccounts({
910
915
  userAccounts: [fromUserAccount],
@@ -925,7 +930,7 @@ class DriftClient {
925
930
  });
926
931
  }
927
932
  async updateSpotMarketCumulativeInterest(marketIndex, txParams) {
928
- const { txSig } = await this.sendTransaction(utils_1.wrapInTx(await this.updateSpotMarketCumulativeInterestIx(marketIndex), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
933
+ const { txSig } = await this.sendTransaction((0, utils_1.wrapInTx)(await this.updateSpotMarketCumulativeInterestIx(marketIndex), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
929
934
  return txSig;
930
935
  }
931
936
  async updateSpotMarketCumulativeInterestIx(marketIndex) {
@@ -939,7 +944,7 @@ class DriftClient {
939
944
  });
940
945
  }
941
946
  async settleLP(settleeUserAccountPublicKey, marketIndex, txParams) {
942
- const { txSig } = await this.sendTransaction(utils_1.wrapInTx(await this.settleLPIx(settleeUserAccountPublicKey, marketIndex), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
947
+ const { txSig } = await this.sendTransaction((0, utils_1.wrapInTx)(await this.settleLPIx(settleeUserAccountPublicKey, marketIndex), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
943
948
  return txSig;
944
949
  }
945
950
  async settleLPIx(settleeUserAccountPublicKey, marketIndex) {
@@ -957,11 +962,11 @@ class DriftClient {
957
962
  });
958
963
  }
959
964
  async removePerpLpShares(marketIndex, sharesToBurn, txParams) {
960
- const { txSig } = await this.sendTransaction(utils_1.wrapInTx(await this.getRemovePerpLpSharesIx(marketIndex, sharesToBurn), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
965
+ const { txSig } = await this.sendTransaction((0, utils_1.wrapInTx)(await this.getRemovePerpLpSharesIx(marketIndex, sharesToBurn), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
961
966
  return txSig;
962
967
  }
963
968
  async removePerpLpSharesInExpiringMarket(marketIndex, userAccountPublicKey, sharesToBurn, txParams) {
964
- const { txSig } = await this.sendTransaction(utils_1.wrapInTx(await this.getRemovePerpLpSharesInExpiringMarket(marketIndex, userAccountPublicKey, sharesToBurn), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
969
+ const { txSig } = await this.sendTransaction((0, utils_1.wrapInTx)(await this.getRemovePerpLpSharesInExpiringMarket(marketIndex, userAccountPublicKey, sharesToBurn), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
965
970
  return txSig;
966
971
  }
967
972
  async getRemovePerpLpSharesInExpiringMarket(marketIndex, userAccountPublicKey, sharesToBurn) {
@@ -1007,7 +1012,7 @@ class DriftClient {
1007
1012
  });
1008
1013
  }
1009
1014
  async addPerpLpShares(amount, marketIndex, txParams) {
1010
- const { txSig, slot } = await this.sendTransaction(utils_1.wrapInTx(await this.getAddPerpLpSharesIx(amount, marketIndex), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
1015
+ const { txSig, slot } = await this.sendTransaction((0, utils_1.wrapInTx)(await this.getAddPerpLpSharesIx(amount, marketIndex), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
1011
1016
  this.perpMarketLastSlotCache.set(marketIndex, slot);
1012
1017
  return txSig;
1013
1018
  }
@@ -1051,8 +1056,8 @@ class DriftClient {
1051
1056
  async sendMarketOrderAndGetSignedFillTx(orderParams, userAccountPublicKey, userAccount, makerInfo, txParams) {
1052
1057
  const marketIndex = orderParams.marketIndex;
1053
1058
  const orderId = userAccount.nextOrderId;
1054
- const marketOrderTx = utils_1.wrapInTx(await this.getPlacePerpOrderIx(orderParams), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice);
1055
- const fillTx = utils_1.wrapInTx(await this.getFillPerpOrderIx(userAccountPublicKey, userAccount, {
1059
+ const marketOrderTx = (0, utils_1.wrapInTx)(await this.getPlacePerpOrderIx(orderParams), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice);
1060
+ const fillTx = (0, utils_1.wrapInTx)(await this.getFillPerpOrderIx(userAccountPublicKey, userAccount, {
1056
1061
  orderId,
1057
1062
  marketIndex,
1058
1063
  }, makerInfo), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice);
@@ -1068,7 +1073,7 @@ class DriftClient {
1068
1073
  return { txSig, signedFillTx };
1069
1074
  }
1070
1075
  async placePerpOrder(orderParams, txParams) {
1071
- const { txSig, slot } = await this.sendTransaction(utils_1.wrapInTx(await this.getPlacePerpOrderIx(orderParams), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
1076
+ const { txSig, slot } = await this.sendTransaction((0, utils_1.wrapInTx)(await this.getPlacePerpOrderIx(orderParams), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
1072
1077
  this.perpMarketLastSlotCache.set(orderParams.marketIndex, slot);
1073
1078
  return txSig;
1074
1079
  }
@@ -1096,7 +1101,7 @@ class DriftClient {
1096
1101
  });
1097
1102
  }
1098
1103
  async updateAMMs(marketIndexes, txParams) {
1099
- const { txSig } = await this.sendTransaction(utils_1.wrapInTx(await this.getUpdateAMMsIx(marketIndexes), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
1104
+ const { txSig } = await this.sendTransaction((0, utils_1.wrapInTx)(await this.getUpdateAMMsIx(marketIndexes), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
1100
1105
  return txSig;
1101
1106
  }
1102
1107
  async getUpdateAMMsIx(marketIndexes) {
@@ -1130,7 +1135,7 @@ class DriftClient {
1130
1135
  });
1131
1136
  }
1132
1137
  async settleExpiredMarket(marketIndex, txParams) {
1133
- const { txSig } = await this.sendTransaction(utils_1.wrapInTx(await this.getSettleExpiredMarketIx(marketIndex), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
1138
+ const { txSig } = await this.sendTransaction((0, utils_1.wrapInTx)(await this.getSettleExpiredMarketIx(marketIndex), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
1134
1139
  return txSig;
1135
1140
  }
1136
1141
  async getSettleExpiredMarketIx(marketIndex) {
@@ -1165,8 +1170,8 @@ class DriftClient {
1165
1170
  });
1166
1171
  }
1167
1172
  async settleExpiredMarketPoolsToRevenuePool(perpMarketIndex, txParams) {
1168
- const perpMarketPublicKey = await pda_1.getPerpMarketPublicKey(this.program.programId, perpMarketIndex);
1169
- const spotMarketPublicKey = await pda_1.getSpotMarketPublicKey(this.program.programId, numericConstants_1.QUOTE_SPOT_MARKET_INDEX);
1173
+ const perpMarketPublicKey = await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex);
1174
+ const spotMarketPublicKey = await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, numericConstants_1.QUOTE_SPOT_MARKET_INDEX);
1170
1175
  const ix = await this.program.instruction.settleExpiredMarketPoolsToRevenuePool({
1171
1176
  accounts: {
1172
1177
  state: await this.getStatePublicKey(),
@@ -1175,11 +1180,11 @@ class DriftClient {
1175
1180
  perpMarket: perpMarketPublicKey,
1176
1181
  },
1177
1182
  });
1178
- const { txSig } = await this.sendTransaction(utils_1.wrapInTx(ix, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
1183
+ const { txSig } = await this.sendTransaction((0, utils_1.wrapInTx)(ix, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
1179
1184
  return txSig;
1180
1185
  }
1181
1186
  async cancelOrder(orderId, txParams) {
1182
- const { txSig } = await this.sendTransaction(utils_1.wrapInTx(await this.getCancelOrderIx(orderId), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
1187
+ const { txSig } = await this.sendTransaction((0, utils_1.wrapInTx)(await this.getCancelOrderIx(orderId), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
1183
1188
  return txSig;
1184
1189
  }
1185
1190
  async getCancelOrderIx(orderId) {
@@ -1198,7 +1203,7 @@ class DriftClient {
1198
1203
  });
1199
1204
  }
1200
1205
  async cancelOrderByUserId(userOrderId, txParams) {
1201
- const { txSig } = await this.sendTransaction(utils_1.wrapInTx(await this.getCancelOrderByUserIdIx(userOrderId), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
1206
+ const { txSig } = await this.sendTransaction((0, utils_1.wrapInTx)(await this.getCancelOrderByUserIdIx(userOrderId), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
1202
1207
  return txSig;
1203
1208
  }
1204
1209
  async getCancelOrderByUserIdIx(userOrderId) {
@@ -1220,7 +1225,7 @@ class DriftClient {
1220
1225
  });
1221
1226
  }
1222
1227
  async cancelOrders(marketType, marketIndex, direction, txParams) {
1223
- const { txSig } = await this.sendTransaction(utils_1.wrapInTx(await this.getCancelOrdersIx(marketType, marketIndex, direction), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
1228
+ const { txSig } = await this.sendTransaction((0, utils_1.wrapInTx)(await this.getCancelOrdersIx(marketType, marketIndex, direction), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
1224
1229
  return txSig;
1225
1230
  }
1226
1231
  async getCancelOrdersIx(marketType, marketIndex, direction) {
@@ -1228,10 +1233,10 @@ class DriftClient {
1228
1233
  let readablePerpMarketIndex = undefined;
1229
1234
  let readableSpotMarketIndexes = undefined;
1230
1235
  if (marketIndex) {
1231
- if (marketType && types_1.isVariant(marketType, 'perp')) {
1236
+ if (marketType && (0, types_1.isVariant)(marketType, 'perp')) {
1232
1237
  readablePerpMarketIndex = marketIndex;
1233
1238
  }
1234
- else if (marketType && types_1.isVariant(marketType, 'spot')) {
1239
+ else if (marketType && (0, types_1.isVariant)(marketType, 'spot')) {
1235
1240
  readableSpotMarketIndexes = [marketIndex];
1236
1241
  }
1237
1242
  }
@@ -1251,11 +1256,11 @@ class DriftClient {
1251
1256
  });
1252
1257
  }
1253
1258
  async fillPerpOrder(userAccountPublicKey, user, order, makerInfo, referrerInfo, txParams) {
1254
- const { txSig } = await this.sendTransaction(utils_1.wrapInTx(await this.getFillPerpOrderIx(userAccountPublicKey, user, order, makerInfo, referrerInfo), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
1259
+ const { txSig } = await this.sendTransaction((0, utils_1.wrapInTx)(await this.getFillPerpOrderIx(userAccountPublicKey, user, order, makerInfo, referrerInfo), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
1255
1260
  return txSig;
1256
1261
  }
1257
1262
  async getFillPerpOrderIx(userAccountPublicKey, userAccount, order, makerInfo, referrerInfo) {
1258
- const userStatsPublicKey = pda_1.getUserStatsAccountPublicKey(this.program.programId, userAccount.authority);
1263
+ const userStatsPublicKey = (0, pda_1.getUserStatsAccountPublicKey)(this.program.programId, userAccount.authority);
1259
1264
  const fillerPublicKey = await this.getUserAccountPublicKey();
1260
1265
  const fillerStatsPublicKey = this.getUserStatsAccountPublicKey();
1261
1266
  const marketIndex = order
@@ -1316,7 +1321,7 @@ class DriftClient {
1316
1321
  });
1317
1322
  }
1318
1323
  async placeSpotOrder(orderParams, txParams) {
1319
- const { txSig, slot } = await this.sendTransaction(utils_1.wrapInTx(await this.getPlaceSpotOrderIx(orderParams), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
1324
+ const { txSig, slot } = await this.sendTransaction((0, utils_1.wrapInTx)(await this.getPlaceSpotOrderIx(orderParams), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
1320
1325
  this.spotMarketLastSlotCache.set(orderParams.marketIndex, slot);
1321
1326
  this.spotMarketLastSlotCache.set(numericConstants_1.QUOTE_SPOT_MARKET_INDEX, slot);
1322
1327
  return txSig;
@@ -1343,11 +1348,11 @@ class DriftClient {
1343
1348
  });
1344
1349
  }
1345
1350
  async fillSpotOrder(userAccountPublicKey, user, order, fulfillmentConfig, makerInfo, referrerInfo, txParams) {
1346
- const { txSig } = await this.sendTransaction(utils_1.wrapInTx(await this.getFillSpotOrderIx(userAccountPublicKey, user, order, fulfillmentConfig, makerInfo, referrerInfo), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
1351
+ const { txSig } = await this.sendTransaction((0, utils_1.wrapInTx)(await this.getFillSpotOrderIx(userAccountPublicKey, user, order, fulfillmentConfig, makerInfo, referrerInfo), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
1347
1352
  return txSig;
1348
1353
  }
1349
1354
  async getFillSpotOrderIx(userAccountPublicKey, userAccount, order, fulfillmentConfig, makerInfo, referrerInfo) {
1350
- const userStatsPublicKey = pda_1.getUserStatsAccountPublicKey(this.program.programId, userAccount.authority);
1355
+ const userStatsPublicKey = (0, pda_1.getUserStatsAccountPublicKey)(this.program.programId, userAccount.authority);
1351
1356
  const fillerPublicKey = await this.getUserAccountPublicKey();
1352
1357
  const fillerStatsPublicKey = this.getUserStatsAccountPublicKey();
1353
1358
  const marketIndex = order
@@ -1469,7 +1474,7 @@ class DriftClient {
1469
1474
  isSigner: false,
1470
1475
  });
1471
1476
  remainingAccounts.push({
1472
- pubkey: pda_1.getSerumSignerPublicKey(fulfillmentConfig.serumProgramId, fulfillmentConfig.serumMarket, fulfillmentConfig.serumSignerNonce),
1477
+ pubkey: (0, pda_1.getSerumSignerPublicKey)(fulfillmentConfig.serumProgramId, fulfillmentConfig.serumMarket, fulfillmentConfig.serumSignerNonce),
1473
1478
  isWritable: false,
1474
1479
  isSigner: false,
1475
1480
  });
@@ -1500,13 +1505,13 @@ class DriftClient {
1500
1505
  });
1501
1506
  }
1502
1507
  async triggerOrder(userAccountPublicKey, user, order, txParams) {
1503
- const { txSig } = await this.sendTransaction(utils_1.wrapInTx(await this.getTriggerOrderIx(userAccountPublicKey, user, order), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
1508
+ const { txSig } = await this.sendTransaction((0, utils_1.wrapInTx)(await this.getTriggerOrderIx(userAccountPublicKey, user, order), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
1504
1509
  return txSig;
1505
1510
  }
1506
1511
  async getTriggerOrderIx(userAccountPublicKey, userAccount, order) {
1507
1512
  const fillerPublicKey = await this.getUserAccountPublicKey();
1508
1513
  let remainingAccountsParams;
1509
- if (types_1.isVariant(order.marketType, 'perp')) {
1514
+ if ((0, types_1.isVariant)(order.marketType, 'perp')) {
1510
1515
  remainingAccountsParams = {
1511
1516
  userAccounts: [userAccount],
1512
1517
  writablePerpMarketIndexes: [order.marketIndex],
@@ -1531,7 +1536,7 @@ class DriftClient {
1531
1536
  });
1532
1537
  }
1533
1538
  async forceCancelOrders(userAccountPublicKey, user, txParams) {
1534
- const { txSig } = await this.txSender.send(utils_1.wrapInTx(await this.getForceCancelOrdersIx(userAccountPublicKey, user), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
1539
+ const { txSig } = await this.txSender.send((0, utils_1.wrapInTx)(await this.getForceCancelOrdersIx(userAccountPublicKey, user), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
1535
1540
  return txSig;
1536
1541
  }
1537
1542
  async getForceCancelOrdersIx(userAccountPublicKey, userAccount) {
@@ -1551,7 +1556,7 @@ class DriftClient {
1551
1556
  });
1552
1557
  }
1553
1558
  async placeAndTakePerpOrder(orderParams, makerInfo, referrerInfo, txParams) {
1554
- const { txSig, slot } = await this.sendTransaction(utils_1.wrapInTx(await this.getPlaceAndTakePerpOrderIx(orderParams, makerInfo, referrerInfo), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
1559
+ const { txSig, slot } = await this.sendTransaction((0, utils_1.wrapInTx)(await this.getPlaceAndTakePerpOrderIx(orderParams, makerInfo, referrerInfo), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
1555
1560
  this.perpMarketLastSlotCache.set(orderParams.marketIndex, slot);
1556
1561
  return txSig;
1557
1562
  }
@@ -1605,7 +1610,7 @@ class DriftClient {
1605
1610
  });
1606
1611
  }
1607
1612
  async placeAndMakePerpOrder(orderParams, takerInfo, referrerInfo, txParams) {
1608
- const { txSig, slot } = await this.sendTransaction(utils_1.wrapInTx(await this.getPlaceAndMakePerpOrderIx(orderParams, takerInfo, referrerInfo), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
1613
+ const { txSig, slot } = await this.sendTransaction((0, utils_1.wrapInTx)(await this.getPlaceAndMakePerpOrderIx(orderParams, takerInfo, referrerInfo), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
1609
1614
  this.perpMarketLastSlotCache.set(orderParams.marketIndex, slot);
1610
1615
  return txSig;
1611
1616
  }
@@ -1644,7 +1649,7 @@ class DriftClient {
1644
1649
  });
1645
1650
  }
1646
1651
  async placeAndTakeSpotOrder(orderParams, fulfillmentConfig, makerInfo, referrerInfo, txParams) {
1647
- const { txSig, slot } = await this.sendTransaction(utils_1.wrapInTx(await this.getPlaceAndTakeSpotOrderIx(orderParams, fulfillmentConfig, makerInfo, referrerInfo), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
1652
+ const { txSig, slot } = await this.sendTransaction((0, utils_1.wrapInTx)(await this.getPlaceAndTakeSpotOrderIx(orderParams, fulfillmentConfig, makerInfo, referrerInfo), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
1648
1653
  this.spotMarketLastSlotCache.set(orderParams.marketIndex, slot);
1649
1654
  this.spotMarketLastSlotCache.set(numericConstants_1.QUOTE_SPOT_MARKET_INDEX, slot);
1650
1655
  return txSig;
@@ -1703,7 +1708,7 @@ class DriftClient {
1703
1708
  });
1704
1709
  }
1705
1710
  async placeAndMakeSpotOrder(orderParams, takerInfo, fulfillmentConfig, referrerInfo, txParams) {
1706
- const { txSig, slot } = await this.sendTransaction(utils_1.wrapInTx(await this.getPlaceAndMakeSpotOrderIx(orderParams, takerInfo, fulfillmentConfig, referrerInfo), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
1711
+ const { txSig, slot } = await this.sendTransaction((0, utils_1.wrapInTx)(await this.getPlaceAndMakeSpotOrderIx(orderParams, takerInfo, fulfillmentConfig, referrerInfo), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
1707
1712
  this.spotMarketLastSlotCache.set(orderParams.marketIndex, slot);
1708
1713
  this.spotMarketLastSlotCache.set(numericConstants_1.QUOTE_SPOT_MARKET_INDEX, slot);
1709
1714
  return txSig;
@@ -1759,7 +1764,7 @@ class DriftClient {
1759
1764
  return await this.placeAndTakePerpOrder({
1760
1765
  orderType: types_1.OrderType.MARKET,
1761
1766
  marketIndex,
1762
- direction: position_1.findDirectionToClose(userPosition),
1767
+ direction: (0, position_1.findDirectionToClose)(userPosition),
1763
1768
  baseAssetAmount: userPosition.baseAssetAmount.abs(),
1764
1769
  reduceOnly: true,
1765
1770
  price: limitPrice,
@@ -1823,11 +1828,11 @@ class DriftClient {
1823
1828
  }
1824
1829
  const cancelOrderIx = await this.getCancelOrderIx(orderId);
1825
1830
  const orderTypeHasTrigger = newOrderType
1826
- ? types_1.isOneOfVariant(newOrderType, ['triggerlimit', 'triggerMarket'])
1827
- : types_1.isOneOfVariant(openOrder.orderType, ['triggerLimit', 'triggerMarket']);
1831
+ ? (0, types_1.isOneOfVariant)(newOrderType, ['triggerlimit', 'triggerMarket'])
1832
+ : (0, types_1.isOneOfVariant)(openOrder.orderType, ['triggerLimit', 'triggerMarket']);
1828
1833
  const orderTypeHasLimitPrice = newOrderType
1829
- ? types_1.isOneOfVariant(newOrderType, ['triggerLimit', 'limit'])
1830
- : types_1.isOneOfVariant(openOrder.orderType, ['triggerLimit', 'limit']);
1834
+ ? (0, types_1.isOneOfVariant)(newOrderType, ['triggerLimit', 'limit'])
1835
+ : (0, types_1.isOneOfVariant)(openOrder.orderType, ['triggerLimit', 'limit']);
1831
1836
  const newOrderParams = {
1832
1837
  orderType: newOrderType || openOrder.orderType,
1833
1838
  marketType: openOrder.marketType,
@@ -1898,11 +1903,11 @@ class DriftClient {
1898
1903
  }
1899
1904
  const cancelOrderIx = await this.getCancelOrderByUserIdIx(userOrderId);
1900
1905
  const orderTypeHasTrigger = newOrderType
1901
- ? types_1.isOneOfVariant(newOrderType, ['triggerlimit', 'triggerMarket'])
1902
- : types_1.isOneOfVariant(openOrder.orderType, ['triggerLimit', 'triggerMarket']);
1906
+ ? (0, types_1.isOneOfVariant)(newOrderType, ['triggerlimit', 'triggerMarket'])
1907
+ : (0, types_1.isOneOfVariant)(openOrder.orderType, ['triggerLimit', 'triggerMarket']);
1903
1908
  const orderTypeHasLimitPrice = newOrderType
1904
- ? types_1.isOneOfVariant(newOrderType, ['triggerLimit', 'limit'])
1905
- : types_1.isOneOfVariant(openOrder.orderType, ['triggerLimit', 'limit']);
1909
+ ? (0, types_1.isOneOfVariant)(newOrderType, ['triggerLimit', 'limit'])
1910
+ : (0, types_1.isOneOfVariant)(openOrder.orderType, ['triggerLimit', 'limit']);
1906
1911
  const newOrderParams = {
1907
1912
  orderType: newOrderType || openOrder.orderType,
1908
1913
  marketType: openOrder.marketType,
@@ -1963,7 +1968,7 @@ class DriftClient {
1963
1968
  return txSig;
1964
1969
  }
1965
1970
  async settlePNL(settleeUserAccountPublicKey, settleeUserAccount, marketIndex, txParams) {
1966
- const { txSig } = await this.sendTransaction(utils_1.wrapInTx(await this.settlePNLIx(settleeUserAccountPublicKey, settleeUserAccount, marketIndex), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
1971
+ const { txSig } = await this.sendTransaction((0, utils_1.wrapInTx)(await this.settlePNLIx(settleeUserAccountPublicKey, settleeUserAccount, marketIndex), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
1967
1972
  return txSig;
1968
1973
  }
1969
1974
  async settlePNLIx(settleeUserAccountPublicKey, settleeUserAccount, marketIndex) {
@@ -1983,12 +1988,12 @@ class DriftClient {
1983
1988
  });
1984
1989
  }
1985
1990
  async liquidatePerp(userAccountPublicKey, userAccount, marketIndex, maxBaseAssetAmount, limitPrice, txParams) {
1986
- const { txSig, slot } = await this.sendTransaction(utils_1.wrapInTx(await this.getLiquidatePerpIx(userAccountPublicKey, userAccount, marketIndex, maxBaseAssetAmount, limitPrice), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
1991
+ const { txSig, slot } = await this.sendTransaction((0, utils_1.wrapInTx)(await this.getLiquidatePerpIx(userAccountPublicKey, userAccount, marketIndex, maxBaseAssetAmount, limitPrice), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
1987
1992
  this.perpMarketLastSlotCache.set(marketIndex, slot);
1988
1993
  return txSig;
1989
1994
  }
1990
1995
  async getLiquidatePerpIx(userAccountPublicKey, userAccount, marketIndex, maxBaseAssetAmount, limitPrice) {
1991
- const userStatsPublicKey = pda_1.getUserStatsAccountPublicKey(this.program.programId, userAccount.authority);
1996
+ const userStatsPublicKey = (0, pda_1.getUserStatsAccountPublicKey)(this.program.programId, userAccount.authority);
1992
1997
  const liquidatorPublicKey = await this.getUserAccountPublicKey();
1993
1998
  const liquidatorStatsPublicKey = this.getUserStatsAccountPublicKey();
1994
1999
  const remainingAccounts = this.getRemainingAccounts({
@@ -2009,13 +2014,13 @@ class DriftClient {
2009
2014
  });
2010
2015
  }
2011
2016
  async liquidateSpot(userAccountPublicKey, userAccount, assetMarketIndex, liabilityMarketIndex, maxLiabilityTransfer, limitPrice, txParams) {
2012
- const { txSig, slot } = await this.sendTransaction(utils_1.wrapInTx(await this.getLiquidateSpotIx(userAccountPublicKey, userAccount, assetMarketIndex, liabilityMarketIndex, maxLiabilityTransfer, limitPrice), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
2017
+ const { txSig, slot } = await this.sendTransaction((0, utils_1.wrapInTx)(await this.getLiquidateSpotIx(userAccountPublicKey, userAccount, assetMarketIndex, liabilityMarketIndex, maxLiabilityTransfer, limitPrice), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
2013
2018
  this.spotMarketLastSlotCache.set(assetMarketIndex, slot);
2014
2019
  this.spotMarketLastSlotCache.set(liabilityMarketIndex, slot);
2015
2020
  return txSig;
2016
2021
  }
2017
2022
  async getLiquidateSpotIx(userAccountPublicKey, userAccount, assetMarketIndex, liabilityMarketIndex, maxLiabilityTransfer, limitPrice) {
2018
- const userStatsPublicKey = pda_1.getUserStatsAccountPublicKey(this.program.programId, userAccount.authority);
2023
+ const userStatsPublicKey = (0, pda_1.getUserStatsAccountPublicKey)(this.program.programId, userAccount.authority);
2019
2024
  const liquidatorPublicKey = await this.getUserAccountPublicKey();
2020
2025
  const liquidatorStatsPublicKey = await this.getUserStatsAccountPublicKey();
2021
2026
  const remainingAccounts = this.getRemainingAccounts({
@@ -2036,13 +2041,13 @@ class DriftClient {
2036
2041
  });
2037
2042
  }
2038
2043
  async liquidateBorrowForPerpPnl(userAccountPublicKey, userAccount, perpMarketIndex, liabilityMarketIndex, maxLiabilityTransfer, limitPrice, txParams) {
2039
- const { txSig, slot } = await this.sendTransaction(utils_1.wrapInTx(await this.getLiquidateBorrowForPerpPnlIx(userAccountPublicKey, userAccount, perpMarketIndex, liabilityMarketIndex, maxLiabilityTransfer, limitPrice), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
2044
+ const { txSig, slot } = await this.sendTransaction((0, utils_1.wrapInTx)(await this.getLiquidateBorrowForPerpPnlIx(userAccountPublicKey, userAccount, perpMarketIndex, liabilityMarketIndex, maxLiabilityTransfer, limitPrice), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
2040
2045
  this.perpMarketLastSlotCache.set(perpMarketIndex, slot);
2041
2046
  this.spotMarketLastSlotCache.set(liabilityMarketIndex, slot);
2042
2047
  return txSig;
2043
2048
  }
2044
2049
  async getLiquidateBorrowForPerpPnlIx(userAccountPublicKey, userAccount, perpMarketIndex, liabilityMarketIndex, maxLiabilityTransfer, limitPrice) {
2045
- const userStatsPublicKey = pda_1.getUserStatsAccountPublicKey(this.program.programId, userAccount.authority);
2050
+ const userStatsPublicKey = (0, pda_1.getUserStatsAccountPublicKey)(this.program.programId, userAccount.authority);
2046
2051
  const liquidatorPublicKey = await this.getUserAccountPublicKey();
2047
2052
  const liquidatorStatsPublicKey = await this.getUserStatsAccountPublicKey();
2048
2053
  const remainingAccounts = this.getRemainingAccounts({
@@ -2063,13 +2068,13 @@ class DriftClient {
2063
2068
  });
2064
2069
  }
2065
2070
  async liquidatePerpPnlForDeposit(userAccountPublicKey, userAccount, perpMarketIndex, assetMarketIndex, maxPnlTransfer, limitPrice, txParams) {
2066
- const { txSig, slot } = await this.sendTransaction(utils_1.wrapInTx(await this.getLiquidatePerpPnlForDepositIx(userAccountPublicKey, userAccount, perpMarketIndex, assetMarketIndex, maxPnlTransfer, limitPrice), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
2071
+ const { txSig, slot } = await this.sendTransaction((0, utils_1.wrapInTx)(await this.getLiquidatePerpPnlForDepositIx(userAccountPublicKey, userAccount, perpMarketIndex, assetMarketIndex, maxPnlTransfer, limitPrice), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
2067
2072
  this.perpMarketLastSlotCache.set(perpMarketIndex, slot);
2068
2073
  this.spotMarketLastSlotCache.set(assetMarketIndex, slot);
2069
2074
  return txSig;
2070
2075
  }
2071
2076
  async getLiquidatePerpPnlForDepositIx(userAccountPublicKey, userAccount, perpMarketIndex, assetMarketIndex, maxPnlTransfer, limitPrice) {
2072
- const userStatsPublicKey = pda_1.getUserStatsAccountPublicKey(this.program.programId, userAccount.authority);
2077
+ const userStatsPublicKey = (0, pda_1.getUserStatsAccountPublicKey)(this.program.programId, userAccount.authority);
2073
2078
  const liquidatorPublicKey = await this.getUserAccountPublicKey();
2074
2079
  const liquidatorStatsPublicKey = await this.getUserStatsAccountPublicKey();
2075
2080
  const remainingAccounts = this.getRemainingAccounts({
@@ -2090,11 +2095,11 @@ class DriftClient {
2090
2095
  });
2091
2096
  }
2092
2097
  async resolvePerpBankruptcy(userAccountPublicKey, userAccount, marketIndex, txParams) {
2093
- const { txSig } = await this.sendTransaction(utils_1.wrapInTx(await this.getResolvePerpBankruptcyIx(userAccountPublicKey, userAccount, marketIndex), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
2098
+ const { txSig } = await this.sendTransaction((0, utils_1.wrapInTx)(await this.getResolvePerpBankruptcyIx(userAccountPublicKey, userAccount, marketIndex), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
2094
2099
  return txSig;
2095
2100
  }
2096
2101
  async getResolvePerpBankruptcyIx(userAccountPublicKey, userAccount, marketIndex) {
2097
- const userStatsPublicKey = pda_1.getUserStatsAccountPublicKey(this.program.programId, userAccount.authority);
2102
+ const userStatsPublicKey = (0, pda_1.getUserStatsAccountPublicKey)(this.program.programId, userAccount.authority);
2098
2103
  const liquidatorPublicKey = await this.getUserAccountPublicKey();
2099
2104
  const liquidatorStatsPublicKey = await this.getUserStatsAccountPublicKey();
2100
2105
  const remainingAccounts = this.getRemainingAccounts({
@@ -2120,11 +2125,11 @@ class DriftClient {
2120
2125
  });
2121
2126
  }
2122
2127
  async resolveSpotBankruptcy(userAccountPublicKey, userAccount, marketIndex, txParams) {
2123
- const { txSig } = await this.sendTransaction(utils_1.wrapInTx(await this.getResolveSpotBankruptcyIx(userAccountPublicKey, userAccount, marketIndex), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
2128
+ const { txSig } = await this.sendTransaction((0, utils_1.wrapInTx)(await this.getResolveSpotBankruptcyIx(userAccountPublicKey, userAccount, marketIndex), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
2124
2129
  return txSig;
2125
2130
  }
2126
2131
  async getResolveSpotBankruptcyIx(userAccountPublicKey, userAccount, marketIndex) {
2127
- const userStatsPublicKey = pda_1.getUserStatsAccountPublicKey(this.program.programId, userAccount.authority);
2132
+ const userStatsPublicKey = (0, pda_1.getUserStatsAccountPublicKey)(this.program.programId, userAccount.authority);
2128
2133
  const liquidatorPublicKey = await this.getUserAccountPublicKey();
2129
2134
  const liquidatorStatsPublicKey = await this.getUserStatsAccountPublicKey();
2130
2135
  const remainingAccounts = this.getRemainingAccounts({
@@ -2149,11 +2154,11 @@ class DriftClient {
2149
2154
  });
2150
2155
  }
2151
2156
  async updateFundingRate(perpMarketIndex, oracle, txParams) {
2152
- const { txSig } = await this.sendTransaction(utils_1.wrapInTx(await this.getUpdateFundingRateIx(perpMarketIndex, oracle), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
2157
+ const { txSig } = await this.sendTransaction((0, utils_1.wrapInTx)(await this.getUpdateFundingRateIx(perpMarketIndex, oracle), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
2153
2158
  return txSig;
2154
2159
  }
2155
2160
  async getUpdateFundingRateIx(perpMarketIndex, oracle) {
2156
- const perpMarketPublicKey = await pda_1.getPerpMarketPublicKey(this.program.programId, perpMarketIndex);
2161
+ const perpMarketPublicKey = await (0, pda_1.getPerpMarketPublicKey)(this.program.programId, perpMarketIndex);
2157
2162
  return await this.program.instruction.updateFundingRate(perpMarketIndex, {
2158
2163
  accounts: {
2159
2164
  state: await this.getStatePublicKey(),
@@ -2163,14 +2168,14 @@ class DriftClient {
2163
2168
  });
2164
2169
  }
2165
2170
  async settleFundingPayment(userAccountPublicKey, txParams) {
2166
- const { txSig } = await this.sendTransaction(utils_1.wrapInTx(await this.getSettleFundingPaymentIx(userAccountPublicKey), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
2171
+ const { txSig } = await this.sendTransaction((0, utils_1.wrapInTx)(await this.getSettleFundingPaymentIx(userAccountPublicKey), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
2167
2172
  return txSig;
2168
2173
  }
2169
2174
  async getSettleFundingPaymentIx(userAccountPublicKey) {
2170
2175
  const userAccount = (await this.program.account.user.fetch(userAccountPublicKey));
2171
2176
  const writablePerpMarketIndexes = [];
2172
2177
  for (const position of userAccount.perpPositions) {
2173
- if (!position_1.positionIsAvailable(position)) {
2178
+ if (!(0, position_1.positionIsAvailable)(position)) {
2174
2179
  writablePerpMarketIndexes.push(position.marketIndex);
2175
2180
  }
2176
2181
  }
@@ -2200,11 +2205,11 @@ class DriftClient {
2200
2205
  return oracleData;
2201
2206
  }
2202
2207
  async initializeInsuranceFundStake(marketIndex, txParams) {
2203
- const { txSig } = await this.sendTransaction(utils_1.wrapInTx(await this.getInitializeInsuranceFundStakeIx(marketIndex), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
2208
+ const { txSig } = await this.sendTransaction((0, utils_1.wrapInTx)(await this.getInitializeInsuranceFundStakeIx(marketIndex), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
2204
2209
  return txSig;
2205
2210
  }
2206
2211
  async getInitializeInsuranceFundStakeIx(marketIndex) {
2207
- const ifStakeAccountPublicKey = pda_1.getInsuranceFundStakeAccountPublicKey(this.program.programId, this.wallet.publicKey, marketIndex);
2212
+ const ifStakeAccountPublicKey = (0, pda_1.getInsuranceFundStakeAccountPublicKey)(this.program.programId, this.wallet.publicKey, marketIndex);
2208
2213
  return await this.program.instruction.initializeInsuranceFundStake(marketIndex, {
2209
2214
  accounts: {
2210
2215
  insuranceFundStake: ifStakeAccountPublicKey,
@@ -2220,7 +2225,7 @@ class DriftClient {
2220
2225
  }
2221
2226
  async addInsuranceFundStake(marketIndex, amount, collateralAccountPublicKey) {
2222
2227
  const spotMarket = this.getSpotMarketAccount(marketIndex);
2223
- const ifStakeAccountPublicKey = pda_1.getInsuranceFundStakeAccountPublicKey(this.program.programId, this.wallet.publicKey, marketIndex);
2228
+ const ifStakeAccountPublicKey = (0, pda_1.getInsuranceFundStakeAccountPublicKey)(this.program.programId, this.wallet.publicKey, marketIndex);
2224
2229
  const remainingAccounts = this.getRemainingAccounts({
2225
2230
  userAccounts: [this.getUserAccount()],
2226
2231
  useMarketLastSlotCache: true,
@@ -2246,7 +2251,7 @@ class DriftClient {
2246
2251
  }
2247
2252
  async requestRemoveInsuranceFundStake(marketIndex, amount) {
2248
2253
  const spotMarketAccount = this.getSpotMarketAccount(marketIndex);
2249
- const ifStakeAccountPublicKey = pda_1.getInsuranceFundStakeAccountPublicKey(this.program.programId, this.wallet.publicKey, marketIndex);
2254
+ const ifStakeAccountPublicKey = (0, pda_1.getInsuranceFundStakeAccountPublicKey)(this.program.programId, this.wallet.publicKey, marketIndex);
2250
2255
  const remainingAccounts = this.getRemainingAccounts({
2251
2256
  userAccounts: [this.getUserAccount()],
2252
2257
  useMarketLastSlotCache: true,
@@ -2268,7 +2273,7 @@ class DriftClient {
2268
2273
  }
2269
2274
  async cancelRequestRemoveInsuranceFundStake(marketIndex) {
2270
2275
  const spotMarketAccount = this.getSpotMarketAccount(marketIndex);
2271
- const ifStakeAccountPublicKey = pda_1.getInsuranceFundStakeAccountPublicKey(this.program.programId, this.wallet.publicKey, marketIndex);
2276
+ const ifStakeAccountPublicKey = (0, pda_1.getInsuranceFundStakeAccountPublicKey)(this.program.programId, this.wallet.publicKey, marketIndex);
2272
2277
  const remainingAccounts = this.getRemainingAccounts({
2273
2278
  userAccounts: [this.getUserAccount()],
2274
2279
  useMarketLastSlotCache: true,
@@ -2290,7 +2295,7 @@ class DriftClient {
2290
2295
  }
2291
2296
  async removeInsuranceFundStake(marketIndex, collateralAccountPublicKey) {
2292
2297
  const spotMarketAccount = this.getSpotMarketAccount(marketIndex);
2293
- const ifStakeAccountPublicKey = pda_1.getInsuranceFundStakeAccountPublicKey(this.program.programId, this.wallet.publicKey, marketIndex);
2298
+ const ifStakeAccountPublicKey = (0, pda_1.getInsuranceFundStakeAccountPublicKey)(this.program.programId, this.wallet.publicKey, marketIndex);
2294
2299
  const remainingAccounts = this.getRemainingAccounts({
2295
2300
  userAccounts: [this.getUserAccount()],
2296
2301
  useMarketLastSlotCache: true,
@@ -2335,7 +2340,7 @@ class DriftClient {
2335
2340
  return txSig;
2336
2341
  }
2337
2342
  async resolvePerpPnlDeficit(spotMarketIndex, perpMarketIndex, txParams) {
2338
- const { txSig } = await this.sendTransaction(utils_1.wrapInTx(await this.getResolvePerpPnlDeficitIx(spotMarketIndex, perpMarketIndex), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
2343
+ const { txSig } = await this.sendTransaction((0, utils_1.wrapInTx)(await this.getResolvePerpPnlDeficitIx(spotMarketIndex, perpMarketIndex), txParams === null || txParams === void 0 ? void 0 : txParams.computeUnits, txParams === null || txParams === void 0 ? void 0 : txParams.computeUnitsPrice), [], this.opts);
2339
2344
  return txSig;
2340
2345
  }
2341
2346
  async getResolvePerpPnlDeficitIx(spotMarketIndex, perpMarketIndex) {
@@ -2358,6 +2363,20 @@ class DriftClient {
2358
2363
  remainingAccounts: remainingAccounts,
2359
2364
  });
2360
2365
  }
2366
+ getPerpMarketExtendedInfo(marketIndex) {
2367
+ var _a, _b;
2368
+ const marketAccount = this.getPerpMarketAccount(marketIndex);
2369
+ const quoteAccount = this.getSpotMarketAccount(numericConstants_1.QUOTE_SPOT_MARKET_INDEX);
2370
+ const extendedInfo = {
2371
+ marketIndex,
2372
+ minOrderSize: (_a = marketAccount.amm) === null || _a === void 0 ? void 0 : _a.minOrderSize,
2373
+ marginMaintenance: marketAccount.marginRatioMaintenance,
2374
+ pnlPoolValue: (0, spotBalance_1.getTokenAmount)((_b = marketAccount.pnlPool) === null || _b === void 0 ? void 0 : _b.scaledBalance, quoteAccount, types_1.SpotBalanceType.DEPOSIT),
2375
+ contractTier: marketAccount.contractTier,
2376
+ availableInsurance: (0, market_1.calculateMarketMaxAvailableInsurance)(marketAccount, quoteAccount),
2377
+ };
2378
+ return extendedInfo;
2379
+ }
2361
2380
  sendTransaction(tx, additionalSigners, opts, preSigned) {
2362
2381
  return this.txSender.send(tx, additionalSigners, opts, preSigned);
2363
2382
  }