@drift-labs/sdk 2.82.0-beta.2 → 2.82.0-beta.20

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 (127) hide show
  1. package/README.md +65 -47
  2. package/VERSION +1 -1
  3. package/lib/accounts/types.d.ts +4 -3
  4. package/lib/accounts/webSocketAccountSubscriber.d.ts +3 -3
  5. package/lib/accounts/webSocketAccountSubscriber.js +16 -9
  6. package/lib/accounts/webSocketDriftClientAccountSubscriber.d.ts +3 -3
  7. package/lib/accounts/webSocketDriftClientAccountSubscriber.js +5 -5
  8. package/lib/accounts/webSocketInsuranceFundStakeAccountSubscriber.d.ts +2 -2
  9. package/lib/accounts/webSocketInsuranceFundStakeAccountSubscriber.js +5 -3
  10. package/lib/accounts/webSocketProgramAccountSubscriber.d.ts +3 -3
  11. package/lib/accounts/webSocketProgramAccountSubscriber.js +15 -9
  12. package/lib/accounts/webSocketUserAccountSubscriber.d.ts +3 -3
  13. package/lib/accounts/webSocketUserAccountSubscriber.js +3 -3
  14. package/lib/accounts/webSocketUserStatsAccountSubsriber.d.ts +3 -3
  15. package/lib/accounts/webSocketUserStatsAccountSubsriber.js +3 -3
  16. package/lib/auctionSubscriber/auctionSubscriber.d.ts +2 -2
  17. package/lib/auctionSubscriber/auctionSubscriber.js +3 -3
  18. package/lib/auctionSubscriber/types.d.ts +1 -0
  19. package/lib/clock/clockSubscriber.d.ts +29 -0
  20. package/lib/clock/clockSubscriber.js +74 -0
  21. package/lib/constants/perpMarkets.js +2 -2
  22. package/lib/constants/spotMarkets.js +11 -0
  23. package/lib/dlob/DLOB.js +2 -2
  24. package/lib/dlob/orderBookLevels.js +1 -0
  25. package/lib/driftClient.d.ts +21 -14
  26. package/lib/driftClient.js +192 -255
  27. package/lib/driftClientConfig.d.ts +3 -0
  28. package/lib/index.d.ts +2 -0
  29. package/lib/index.js +2 -0
  30. package/lib/jupiter/jupiterClient.d.ts +2 -1
  31. package/lib/jupiter/jupiterClient.js +10 -6
  32. package/lib/math/exchangeStatus.d.ts +2 -2
  33. package/lib/math/orders.d.ts +1 -1
  34. package/lib/math/orders.js +2 -2
  35. package/lib/orderSubscriber/OrderSubscriber.js +6 -3
  36. package/lib/orderSubscriber/WebsocketSubscription.d.ts +4 -3
  37. package/lib/orderSubscriber/WebsocketSubscription.js +3 -3
  38. package/lib/orderSubscriber/types.d.ts +1 -0
  39. package/lib/priorityFee/driftPriorityFeeMethod.d.ts +13 -3
  40. package/lib/priorityFee/driftPriorityFeeMethod.js +2 -2
  41. package/lib/priorityFee/index.d.ts +2 -0
  42. package/lib/priorityFee/index.js +2 -0
  43. package/lib/priorityFee/priorityFeeSubscriber.d.ts +1 -4
  44. package/lib/priorityFee/priorityFeeSubscriber.js +5 -4
  45. package/lib/priorityFee/priorityFeeSubscriberMap.d.ts +48 -0
  46. package/lib/priorityFee/priorityFeeSubscriberMap.js +88 -0
  47. package/lib/priorityFee/types.d.ts +8 -3
  48. package/lib/priorityFee/types.js +2 -1
  49. package/lib/tx/baseTxSender.d.ts +8 -6
  50. package/lib/tx/baseTxSender.js +9 -51
  51. package/lib/tx/fastSingleTxSender.d.ts +6 -6
  52. package/lib/tx/fastSingleTxSender.js +3 -31
  53. package/lib/tx/forwardOnlyTxSender.d.ts +4 -2
  54. package/lib/tx/forwardOnlyTxSender.js +2 -1
  55. package/lib/tx/retryTxSender.d.ts +4 -2
  56. package/lib/tx/retryTxSender.js +2 -1
  57. package/lib/tx/txHandler.d.ts +138 -0
  58. package/lib/tx/txHandler.js +396 -0
  59. package/lib/tx/txParamProcessor.d.ts +6 -10
  60. package/lib/tx/txParamProcessor.js +13 -17
  61. package/lib/tx/types.d.ts +8 -7
  62. package/lib/tx/types.js +12 -1
  63. package/lib/tx/whileValidTxSender.d.ts +7 -6
  64. package/lib/tx/whileValidTxSender.js +7 -28
  65. package/lib/types.d.ts +24 -4
  66. package/lib/types.js +10 -1
  67. package/lib/user.d.ts +0 -10
  68. package/lib/user.js +6 -29
  69. package/lib/userConfig.d.ts +1 -0
  70. package/lib/userMap/WebsocketSubscription.d.ts +4 -3
  71. package/lib/userMap/WebsocketSubscription.js +3 -3
  72. package/lib/userMap/userMap.js +4 -1
  73. package/lib/userMap/userMapConfig.d.ts +1 -0
  74. package/lib/userStats.js +6 -3
  75. package/lib/userStatsConfig.d.ts +1 -0
  76. package/lib/util/chainClock.d.ts +17 -0
  77. package/lib/util/chainClock.js +29 -0
  78. package/package.json +3 -3
  79. package/src/accounts/types.ts +5 -4
  80. package/src/accounts/webSocketAccountSubscriber.ts +35 -23
  81. package/src/accounts/webSocketDriftClientAccountSubscriber.ts +7 -6
  82. package/src/accounts/webSocketInsuranceFundStakeAccountSubscriber.ts +6 -4
  83. package/src/accounts/webSocketProgramAccountSubscriber.ts +32 -22
  84. package/src/accounts/webSocketUserAccountSubscriber.ts +5 -4
  85. package/src/accounts/webSocketUserStatsAccountSubsriber.ts +5 -4
  86. package/src/auctionSubscriber/auctionSubscriber.ts +10 -4
  87. package/src/auctionSubscriber/types.ts +1 -0
  88. package/src/clock/clockSubscriber.ts +113 -0
  89. package/src/constants/perpMarkets.ts +2 -2
  90. package/src/constants/spotMarkets.ts +13 -0
  91. package/src/dlob/DLOB.ts +2 -2
  92. package/src/dlob/orderBookLevels.ts +2 -0
  93. package/src/driftClient.ts +295 -386
  94. package/src/driftClientConfig.ts +3 -0
  95. package/src/index.ts +2 -0
  96. package/src/jupiter/jupiterClient.ts +15 -6
  97. package/src/math/exchangeStatus.ts +2 -1
  98. package/src/math/orders.ts +3 -2
  99. package/src/orderSubscriber/OrderSubscriber.ts +4 -1
  100. package/src/orderSubscriber/WebsocketSubscription.ts +6 -5
  101. package/src/orderSubscriber/types.ts +1 -0
  102. package/src/priorityFee/driftPriorityFeeMethod.ts +16 -4
  103. package/src/priorityFee/index.ts +2 -0
  104. package/src/priorityFee/priorityFeeSubscriber.ts +7 -7
  105. package/src/priorityFee/priorityFeeSubscriberMap.ts +112 -0
  106. package/src/priorityFee/types.ts +16 -3
  107. package/src/tx/baseTxSender.ts +29 -79
  108. package/src/tx/fastSingleTxSender.ts +10 -55
  109. package/src/tx/forwardOnlyTxSender.ts +5 -1
  110. package/src/tx/retryTxSender.ts +5 -1
  111. package/src/tx/txHandler.ts +625 -0
  112. package/src/tx/txParamProcessor.ts +16 -28
  113. package/src/tx/types.ts +14 -18
  114. package/src/tx/whileValidTxSender.ts +24 -48
  115. package/src/types.ts +26 -2
  116. package/src/user.ts +7 -32
  117. package/src/userConfig.ts +1 -0
  118. package/src/userMap/WebsocketSubscription.ts +6 -5
  119. package/src/userMap/userMap.ts +4 -1
  120. package/src/userMap/userMapConfig.ts +1 -0
  121. package/src/userStats.ts +4 -1
  122. package/src/userStatsConfig.ts +1 -0
  123. package/src/util/chainClock.ts +41 -0
  124. package/tests/dlob/helpers.ts +3 -0
  125. package/lib/tx/utils.d.ts +0 -6
  126. package/lib/tx/utils.js +0 -39
  127. package/src/tx/utils.ts +0 -64
@@ -5,19 +5,19 @@ const types_1 = require("./types");
5
5
  const events_1 = require("events");
6
6
  const webSocketAccountSubscriber_1 = require("./webSocketAccountSubscriber");
7
7
  class WebSocketUserStatsAccountSubscriber {
8
- constructor(program, userStatsAccountPublicKey, reconnectTimeoutMs, commitment) {
8
+ constructor(program, userStatsAccountPublicKey, resubOpts, commitment) {
9
9
  this.isSubscribed = false;
10
10
  this.program = program;
11
11
  this.userStatsAccountPublicKey = userStatsAccountPublicKey;
12
12
  this.eventEmitter = new events_1.EventEmitter();
13
- this.reconnectTimeoutMs = reconnectTimeoutMs;
13
+ this.resubOpts = resubOpts;
14
14
  this.commitment = commitment;
15
15
  }
16
16
  async subscribe(userStatsAccount) {
17
17
  if (this.isSubscribed) {
18
18
  return true;
19
19
  }
20
- this.userStatsAccountSubscriber = new webSocketAccountSubscriber_1.WebSocketAccountSubscriber('userStats', this.program, this.userStatsAccountPublicKey, undefined, this.reconnectTimeoutMs, this.commitment);
20
+ this.userStatsAccountSubscriber = new webSocketAccountSubscriber_1.WebSocketAccountSubscriber('userStats', this.program, this.userStatsAccountPublicKey, undefined, this.resubOpts, this.commitment);
21
21
  if (userStatsAccount) {
22
22
  this.userStatsAccountSubscriber.setData(userStatsAccount);
23
23
  }
@@ -5,10 +5,10 @@ import { EventEmitter } from 'events';
5
5
  export declare class AuctionSubscriber {
6
6
  private driftClient;
7
7
  private opts;
8
- private resubTimeoutMs?;
8
+ private resubOpts?;
9
9
  eventEmitter: StrictEventEmitter<EventEmitter, AuctionSubscriberEvents>;
10
10
  private subscriber;
11
- constructor({ driftClient, opts, resubTimeoutMs }: AuctionSubscriberConfig);
11
+ constructor({ driftClient, opts, resubTimeoutMs, logResubMessages, }: AuctionSubscriberConfig);
12
12
  subscribe(): Promise<void>;
13
13
  unsubscribe(): Promise<void>;
14
14
  }
@@ -5,18 +5,18 @@ const memcmp_1 = require("../memcmp");
5
5
  const events_1 = require("events");
6
6
  const webSocketProgramAccountSubscriber_1 = require("../accounts/webSocketProgramAccountSubscriber");
7
7
  class AuctionSubscriber {
8
- constructor({ driftClient, opts, resubTimeoutMs }) {
8
+ constructor({ driftClient, opts, resubTimeoutMs, logResubMessages, }) {
9
9
  this.driftClient = driftClient;
10
10
  this.opts = opts || this.driftClient.opts;
11
11
  this.eventEmitter = new events_1.EventEmitter();
12
- this.resubTimeoutMs = resubTimeoutMs;
12
+ this.resubOpts = { resubTimeoutMs, logResubMessages };
13
13
  }
14
14
  async subscribe() {
15
15
  if (!this.subscriber) {
16
16
  this.subscriber = new webSocketProgramAccountSubscriber_1.WebSocketProgramAccountSubscriber('AuctionSubscriber', 'User', this.driftClient.program, this.driftClient.program.account.user.coder.accounts.decode.bind(this.driftClient.program.account.user.coder.accounts), {
17
17
  filters: [(0, memcmp_1.getUserFilter)(), (0, memcmp_1.getUserWithAuctionFilter)()],
18
18
  commitment: this.opts.commitment,
19
- }, this.resubTimeoutMs);
19
+ }, this.resubOpts);
20
20
  }
21
21
  await this.subscriber.subscribe((accountId, data, context) => {
22
22
  this.eventEmitter.emit('onAccountUpdate', data, accountId, context.slot);
@@ -5,6 +5,7 @@ export type AuctionSubscriberConfig = {
5
5
  driftClient: DriftClient;
6
6
  opts?: ConfirmOptions;
7
7
  resubTimeoutMs?: number;
8
+ logResubMessages?: boolean;
8
9
  };
9
10
  export interface AuctionSubscriberEvents {
10
11
  onAccountUpdate: (account: UserAccount, pubkey: PublicKey, slot: number) => void;
@@ -0,0 +1,29 @@
1
+ /// <reference types="node" />
2
+ import { Commitment, Connection } from '@solana/web3.js';
3
+ import { EventEmitter } from 'events';
4
+ import StrictEventEmitter from 'strict-event-emitter-types/types/src';
5
+ type ClockSubscriberConfig = {
6
+ commitment: Commitment;
7
+ resubTimeoutMs?: number;
8
+ };
9
+ export interface ClockSubscriberEvent {
10
+ clockUpdate: (ts: number) => void;
11
+ }
12
+ export declare class ClockSubscriber {
13
+ private connection;
14
+ private latestSlot;
15
+ currentTs: number;
16
+ private subscriptionId;
17
+ commitment: Commitment;
18
+ eventEmitter: StrictEventEmitter<EventEmitter, ClockSubscriberEvent>;
19
+ private timeoutId?;
20
+ private resubTimeoutMs?;
21
+ private isUnsubscribing;
22
+ private receivingData;
23
+ constructor(connection: Connection, config?: ClockSubscriberConfig);
24
+ subscribe(): Promise<void>;
25
+ private setTimeout;
26
+ getUnixTs(): number;
27
+ unsubscribe(onResub?: boolean): Promise<void>;
28
+ }
29
+ export {};
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ClockSubscriber = void 0;
4
+ const web3_js_1 = require("@solana/web3.js");
5
+ const events_1 = require("events");
6
+ const __1 = require("..");
7
+ class ClockSubscriber {
8
+ constructor(connection, config) {
9
+ this.connection = connection;
10
+ this.isUnsubscribing = false;
11
+ this.receivingData = false;
12
+ this.eventEmitter = new events_1.EventEmitter();
13
+ this.resubTimeoutMs = config === null || config === void 0 ? void 0 : config.resubTimeoutMs;
14
+ this.commitment = (config === null || config === void 0 ? void 0 : config.commitment) || 'confirmed';
15
+ if (this.resubTimeoutMs < 1000) {
16
+ console.log('resubTimeoutMs should be at least 1000ms to avoid spamming resub');
17
+ }
18
+ }
19
+ async subscribe() {
20
+ if (this.subscriptionId != null) {
21
+ return;
22
+ }
23
+ this.subscriptionId = this.connection.onAccountChange(web3_js_1.SYSVAR_CLOCK_PUBKEY, (acctInfo, context) => {
24
+ if (!this.latestSlot || this.latestSlot < context.slot) {
25
+ if (this.resubTimeoutMs && !this.isUnsubscribing) {
26
+ this.receivingData = true;
27
+ clearTimeout(this.timeoutId);
28
+ this.setTimeout();
29
+ }
30
+ this.latestSlot = context.slot;
31
+ this.currentTs = new __1.BN(acctInfo.data.subarray(32, 39), undefined, 'le').toNumber();
32
+ this.eventEmitter.emit('clockUpdate', this.currentTs);
33
+ }
34
+ }, this.commitment);
35
+ if (this.resubTimeoutMs) {
36
+ this.receivingData = true;
37
+ this.setTimeout();
38
+ }
39
+ }
40
+ setTimeout() {
41
+ this.timeoutId = setTimeout(async () => {
42
+ if (this.isUnsubscribing) {
43
+ // If we are in the process of unsubscribing, do not attempt to resubscribe
44
+ return;
45
+ }
46
+ if (this.receivingData) {
47
+ console.log(`No new slot in ${this.resubTimeoutMs}ms, slot subscriber resubscribing`);
48
+ await this.unsubscribe(true);
49
+ this.receivingData = false;
50
+ await this.subscribe();
51
+ }
52
+ }, this.resubTimeoutMs);
53
+ }
54
+ getUnixTs() {
55
+ return this.currentTs;
56
+ }
57
+ async unsubscribe(onResub = false) {
58
+ if (!onResub) {
59
+ this.resubTimeoutMs = undefined;
60
+ }
61
+ this.isUnsubscribing = true;
62
+ clearTimeout(this.timeoutId);
63
+ this.timeoutId = undefined;
64
+ if (this.subscriptionId != null) {
65
+ await this.connection.removeAccountChangeListener(this.subscriptionId);
66
+ this.subscriptionId = undefined;
67
+ this.isUnsubscribing = false;
68
+ }
69
+ else {
70
+ this.isUnsubscribing = false;
71
+ }
72
+ }
73
+ }
74
+ exports.ClockSubscriber = ClockSubscriber;
@@ -542,9 +542,9 @@ exports.MainnetPerpMarkets = [
542
542
  symbol: 'KMNO-PERP',
543
543
  baseAssetSymbol: 'KMNO',
544
544
  marketIndex: 28,
545
- oracle: new web3_js_1.PublicKey('sDAQaZQJQ4RXAxH3x526mbEXyQZT15ktkL84d7hmk7M'),
545
+ oracle: new web3_js_1.PublicKey('6ynsvjkE2UoiRScbDx7ZxbBsyn7wyvg5P1vENvhtkG1C'),
546
546
  launchTs: 1712240681000,
547
- oracleSource: __1.OracleSource.Prelaunch,
547
+ oracleSource: __1.OracleSource.SWITCHBOARD,
548
548
  },
549
549
  {
550
550
  fullName: 'Tensor',
@@ -197,6 +197,17 @@ exports.MainnetSpotMarkets = [
197
197
  phoenixMarket: new web3_js_1.PublicKey('AbJCZ9TAJiby5AY3cHcXS2gUdENC6mtsm6m7XpC2ZMvE'),
198
198
  launchTs: 1712593532000,
199
199
  },
200
+ {
201
+ symbol: 'DRIFT',
202
+ marketIndex: 15,
203
+ oracle: new web3_js_1.PublicKey('PeNpQeGEm9UEFJ6MBCMauY4WW4h3YxoESPWbsqVKucE'),
204
+ oracleSource: __1.OracleSource.SWITCHBOARD,
205
+ mint: new web3_js_1.PublicKey('DriFtupJYLTosbwoN8koMbEYSx54aFAVLddWsbksjwg7'),
206
+ precision: new __1.BN(10).pow(numericConstants_1.SIX),
207
+ precisionExp: numericConstants_1.SIX,
208
+ phoenixMarket: new web3_js_1.PublicKey('8BV6rrWsUabnTDA3dE6A69oUDJAj3hMhtBHTJyXB7czp'),
209
+ launchTs: 1715860800000,
210
+ },
200
211
  ];
201
212
  exports.SpotMarkets = {
202
213
  devnet: exports.DevnetSpotMarkets,
package/lib/dlob/DLOB.js CHANGED
@@ -528,7 +528,7 @@ class DLOB {
528
528
  ];
529
529
  for (const bidGenerator of bidGenerators) {
530
530
  for (const bid of bidGenerator) {
531
- if ((0, __1.isOrderExpired)(bid.order, ts, true)) {
531
+ if ((0, __1.isOrderExpired)(bid.order, ts, true, 25)) {
532
532
  nodesToFill.push({
533
533
  node: bid,
534
534
  makerNodes: [],
@@ -538,7 +538,7 @@ class DLOB {
538
538
  }
539
539
  for (const askGenerator of askGenerators) {
540
540
  for (const ask of askGenerator) {
541
- if ((0, __1.isOrderExpired)(ask.order, ts, true)) {
541
+ if ((0, __1.isOrderExpired)(ask.order, ts, true, 25)) {
542
542
  nodesToFill.push({
543
543
  node: ask,
544
544
  makerNodes: [],
@@ -246,6 +246,7 @@ function groupL2Levels(levels, grouping, direction, depth) {
246
246
  currentLevel.sources[source] = size;
247
247
  }
248
248
  }
249
+ groupedLevels[groupedLevels.length - 1] = currentLevel;
249
250
  }
250
251
  else {
251
252
  const groupedLevel = {
@@ -3,11 +3,12 @@
3
3
  import { AnchorProvider, BN, Program, ProgramAccount } from '@coral-xyz/anchor';
4
4
  import { StateAccount, IWallet, PositionDirection, UserAccount, PerpMarketAccount, OrderParams, Order, SpotMarketAccount, SpotPosition, MakerInfo, TakerInfo, OptionalOrderParams, ReferrerInfo, MarketType, TxParams, SerumV3FulfillmentConfigAccount, ReferrerNameAccount, OrderTriggerCondition, PerpMarketExtendedInfo, UserStatsAccount, PhoenixV1FulfillmentConfigAccount, ModifyOrderPolicy, SwapReduceOnly } from './types';
5
5
  import * as anchor from '@coral-xyz/anchor';
6
- import { Connection, PublicKey, TransactionSignature, ConfirmOptions, Transaction, TransactionInstruction, AccountMeta, Signer, AddressLookupTableAccount, TransactionVersion, VersionedTransaction } from '@solana/web3.js';
6
+ import { Connection, PublicKey, TransactionSignature, ConfirmOptions, Transaction, TransactionInstruction, AccountMeta, Signer, AddressLookupTableAccount, TransactionVersion, VersionedTransaction, BlockhashWithExpiryBlockHeight } from '@solana/web3.js';
7
7
  import { TokenFaucet } from './tokenFaucet';
8
8
  import { EventEmitter } from 'events';
9
9
  import StrictEventEmitter from 'strict-event-emitter-types';
10
- import { DriftClientAccountSubscriber, DriftClientAccountEvents, DataAndSlot, DriftClientMetricsEvents } from './accounts/types';
10
+ import { DriftClientAccountSubscriber, DriftClientAccountEvents, DataAndSlot } from './accounts/types';
11
+ import { DriftClientMetricsEvents } from './types';
11
12
  import { TxSender, TxSigAndSlot } from './tx/types';
12
13
  import { OraclePriceData } from './oracles/types';
13
14
  import { DriftClientConfig } from './driftClientConfig';
@@ -16,6 +17,7 @@ import { UserSubscriptionConfig } from './userConfig';
16
17
  import { UserStats } from './userStats';
17
18
  import { JupiterClient, QuoteResponse, Route, SwapMode } from './jupiter/jupiterClient';
18
19
  import { UserStatsSubscriptionConfig } from './userStatsConfig';
20
+ import { TxHandler } from './tx/txHandler';
19
21
  type RemainingAccountParams = {
20
22
  userAccounts: UserAccount[];
21
23
  writablePerpMarketIndexes?: number[];
@@ -57,6 +59,7 @@ export declare class DriftClient {
57
59
  txVersion: TransactionVersion;
58
60
  txParams: TxParams;
59
61
  enableMetricsEvents?: boolean;
62
+ txHandler: TxHandler;
60
63
  get isSubscribed(): boolean;
61
64
  set isSubscribed(val: boolean);
62
65
  constructor(config: DriftClientConfig);
@@ -112,7 +115,6 @@ export declare class DriftClient {
112
115
  * Adds and subscribes to users based on params set by the constructor or by updateWallet.
113
116
  */
114
117
  addAndSubscribeToUsers(): Promise<boolean>;
115
- private getProcessedTransactionParams;
116
118
  initializeUserAccount(subAccountId?: number, name?: string, referrerInfo?: ReferrerInfo, txParams?: TxParams): Promise<[TransactionSignature, PublicKey]>;
117
119
  getInitializeUserInstructions(subAccountId?: number, name?: string, referrerInfo?: ReferrerInfo): Promise<[PublicKey, TransactionInstruction]>;
118
120
  getInitializeUserStatsIx(): Promise<TransactionInstruction>;
@@ -289,7 +291,7 @@ export declare class DriftClient {
289
291
  * @deprecated use {@link placePerpOrder} or {@link placeAndTakePerpOrder} instead
290
292
  */
291
293
  openPosition(direction: PositionDirection, amount: BN, marketIndex: number, limitPrice?: BN, subAccountId?: number): Promise<TransactionSignature>;
292
- sendSignedTx(tx: Transaction): Promise<TransactionSignature>;
294
+ sendSignedTx(tx: Transaction, opts?: ConfirmOptions): Promise<TransactionSignature>;
293
295
  /**
294
296
  * Sends a market order and returns a signed tx which can fill the order against the vamm, which the caller can use to fill their own order if required.
295
297
  * @param orderParams
@@ -657,6 +659,16 @@ export declare class DriftClient {
657
659
  getDepositIntoSpotMarketRevenuePoolIx(marketIndex: number, amount: BN, userTokenAccountPublicKey: PublicKey): Promise<TransactionInstruction>;
658
660
  depositIntoSpotMarketRevenuePool(marketIndex: number, amount: BN, userTokenAccountPublicKey: PublicKey): Promise<TransactionSignature>;
659
661
  getPerpMarketExtendedInfo(marketIndex: number): PerpMarketExtendedInfo;
662
+ /**
663
+ * Calculates taker / maker fee (as a percentage, e.g. .001 = 10 basis points) for particular marketType
664
+ * @param marketType
665
+ * @param positionMarketIndex
666
+ * @returns : {takerFee: number, makerFee: number} Precision None
667
+ */
668
+ getMarketFees(marketType: MarketType, marketIndex?: number, user?: User): {
669
+ takerFee: number;
670
+ makerFee: number;
671
+ };
660
672
  /**
661
673
  * Returns the market index and type for a given market name
662
674
  * E.g. "SOL-PERP" -> { marketIndex: 0, marketType: MarketType.PERP }
@@ -670,15 +682,10 @@ export declare class DriftClient {
670
682
  private handleSignedTransaction;
671
683
  private isVersionedTransaction;
672
684
  sendTransaction(tx: Transaction | VersionedTransaction, additionalSigners?: Array<Signer>, opts?: ConfirmOptions, preSigned?: boolean): Promise<TxSigAndSlot>;
673
- /**
674
- *
675
- * @param instructions
676
- * @param txParams
677
- * @param txVersion
678
- * @param lookupTables
679
- * @param forceVersionedTransaction Return a VersionedTransaction instance even if the version of the transaction is Legacy
680
- * @returns
681
- */
682
- buildTransaction(instructions: TransactionInstruction | TransactionInstruction[], txParams?: TxParams, txVersion?: TransactionVersion, lookupTables?: AddressLookupTableAccount[], forceVersionedTransaction?: boolean): Promise<Transaction | VersionedTransaction>;
685
+ buildTransaction(instructions: TransactionInstruction | TransactionInstruction[], txParams?: TxParams, txVersion?: TransactionVersion, lookupTables?: AddressLookupTableAccount[], forceVersionedTransaction?: boolean, recentBlockHash?: BlockhashWithExpiryBlockHeight): Promise<Transaction | VersionedTransaction>;
686
+ buildBulkTransactions(instructions: (TransactionInstruction | TransactionInstruction[])[], txParams?: TxParams, txVersion?: TransactionVersion, lookupTables?: AddressLookupTableAccount[], forceVersionedTransaction?: boolean): Promise<(Transaction | VersionedTransaction)[]>;
687
+ buildAndSignBulkTransactions(instructions: (TransactionInstruction | TransactionInstruction[])[], keys: string[], txParams?: TxParams, txVersion?: TransactionVersion, lookupTables?: AddressLookupTableAccount[], forceVersionedTransaction?: boolean): Promise<{
688
+ [key: string]: anchor.web3.Transaction | anchor.web3.VersionedTransaction;
689
+ }>;
683
690
  }
684
691
  export {};