@drift-labs/sdk 2.53.0-beta.8 → 2.54.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/VERSION CHANGED
@@ -1 +1 @@
1
- 2.53.0-beta.8
1
+ 2.54.0-beta.0
package/bun.lockb CHANGED
Binary file
@@ -58,7 +58,7 @@ export declare class DLOB {
58
58
  initFromOrders(dlobOrders: DLOBOrders, slot: number): boolean;
59
59
  handleOrderRecord(record: OrderRecord, slot: number): void;
60
60
  handleOrderActionRecord(record: OrderActionRecord, slot: number): void;
61
- insertOrder(order: Order, userAccount: PublicKey, slot: number, onInsert?: OrderBookCallback): void;
61
+ insertOrder(order: Order, userAccount: string, slot: number, onInsert?: OrderBookCallback): void;
62
62
  addOrderList(marketType: MarketTypeStr, marketIndex: number): void;
63
63
  updateOrder(order: Order, userAccount: PublicKey, slot: number, cumulativeBaseAssetAmountFilled: BN, onUpdate?: OrderBookCallback): void;
64
64
  trigger(order: Order, userAccount: PublicKey, slot: number, onTrigger?: OrderBookCallback): void;
package/lib/dlob/DLOB.js CHANGED
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DLOB = void 0;
4
4
  const NodeList_1 = require("./NodeList");
5
5
  const __1 = require("..");
6
+ const web3_js_1 = require("@solana/web3.js");
6
7
  const exchangeStatus_1 = require("../math/exchangeStatus");
7
8
  const orderBookLevels_1 = require("./orderBookLevels");
8
9
  const SUPPORTED_ORDER_TYPES = [
@@ -60,8 +61,9 @@ class DLOB {
60
61
  for (const user of userMap.values()) {
61
62
  const userAccount = user.getUserAccount();
62
63
  const userAccountPubkey = user.getUserAccountPublicKey();
64
+ const userAccountPubkeyString = userAccountPubkey.toString();
63
65
  for (const order of userAccount.orders) {
64
- this.insertOrder(order, userAccountPubkey, slot);
66
+ this.insertOrder(order, userAccountPubkeyString, slot);
65
67
  }
66
68
  }
67
69
  this.initialized = true;
@@ -72,13 +74,13 @@ class DLOB {
72
74
  return false;
73
75
  }
74
76
  for (const { user, order } of dlobOrders) {
75
- this.insertOrder(order, user, slot);
77
+ this.insertOrder(order, user.toString(), slot);
76
78
  }
77
79
  this.initialized = true;
78
80
  return true;
79
81
  }
80
82
  handleOrderRecord(record, slot) {
81
- this.insertOrder(record.order, record.user, slot);
83
+ this.insertOrder(record.order, record.user.toString(), slot);
82
84
  }
83
85
  handleOrderActionRecord(record, slot) {
84
86
  if ((0, __1.isOneOfVariant)(record.action, ['place', 'expire'])) {
@@ -187,7 +189,7 @@ class DLOB {
187
189
  ...order,
188
190
  };
189
191
  newOrder.baseAssetAmountFilled = cumulativeBaseAssetAmountFilled;
190
- (_a = this.getListForOrder(order, slot)) === null || _a === void 0 ? void 0 : _a.update(newOrder, userAccount);
192
+ (_a = this.getListForOrder(order, slot)) === null || _a === void 0 ? void 0 : _a.update(newOrder, userAccount.toString());
191
193
  if (onUpdate) {
192
194
  onUpdate();
193
195
  }
@@ -204,8 +206,8 @@ class DLOB {
204
206
  const marketType = (0, __1.getVariant)(order.marketType);
205
207
  const triggerList = this.orderLists.get(marketType).get(order.marketIndex)
206
208
  .trigger[(0, __1.isVariant)(order.triggerCondition, 'above') ? 'above' : 'below'];
207
- triggerList.remove(order, userAccount);
208
- (_a = this.getListForOrder(order, slot)) === null || _a === void 0 ? void 0 : _a.insert(order, marketType, userAccount);
209
+ triggerList.remove(order, userAccount.toString());
210
+ (_a = this.getListForOrder(order, slot)) === null || _a === void 0 ? void 0 : _a.insert(order, marketType, userAccount.toString());
209
211
  if (onTrigger) {
210
212
  onTrigger();
211
213
  }
@@ -216,7 +218,7 @@ class DLOB {
216
218
  return;
217
219
  }
218
220
  this.updateRestingLimitOrders(slot);
219
- (_a = this.getListForOrder(order, slot)) === null || _a === void 0 ? void 0 : _a.remove(order, userAccount);
221
+ (_a = this.getListForOrder(order, slot)) === null || _a === void 0 ? void 0 : _a.remove(order, userAccount.toString());
220
222
  if (onDelete) {
221
223
  onDelete();
222
224
  }
@@ -287,7 +289,7 @@ class DLOB {
287
289
  }
288
290
  }
289
291
  getOrder(orderId, userAccount) {
290
- const orderSignature = (0, NodeList_1.getOrderSignature)(orderId, userAccount);
292
+ const orderSignature = (0, NodeList_1.getOrderSignature)(orderId, userAccount.toString());
291
293
  for (const nodeList of this.getNodeLists()) {
292
294
  const node = nodeList.get(orderSignature);
293
295
  if (node) {
@@ -445,7 +447,7 @@ class DLOB {
445
447
  const makerNodeGenerator = makerNodeGeneratorFn(marketIndex, slot, marketType, oraclePriceData);
446
448
  for (const makerNode of makerNodeGenerator) {
447
449
  // Can't match orders from the same user
448
- const sameUser = takerNode.userAccount.equals(makerNode.userAccount);
450
+ const sameUser = takerNode.userAccount === makerNode.userAccount;
449
451
  if (sameUser) {
450
452
  continue;
451
453
  }
@@ -757,7 +759,7 @@ class DLOB {
757
759
  const bidOrder = bidNode.order;
758
760
  const askOrder = askNode.order;
759
761
  // Can't match orders from the same user
760
- const sameUser = bidNode.userAccount.equals(askNode.userAccount);
762
+ const sameUser = bidNode.userAccount === askNode.userAccount;
761
763
  if (sameUser) {
762
764
  continue;
763
765
  }
@@ -985,7 +987,7 @@ class DLOB {
985
987
  for (const nodeList of this.getNodeLists()) {
986
988
  for (const node of nodeList.getGenerator()) {
987
989
  dlobOrders.push({
988
- user: node.userAccount,
990
+ user: new web3_js_1.PublicKey(node.userAccount),
989
991
  order: node.order,
990
992
  });
991
993
  }
@@ -1067,7 +1069,7 @@ class DLOB {
1067
1069
  asks.push({
1068
1070
  price: ask.getPrice(oraclePriceData, slot),
1069
1071
  size: ask.order.baseAssetAmount.sub(ask.order.baseAssetAmountFilled),
1070
- maker: ask.userAccount,
1072
+ maker: new web3_js_1.PublicKey(ask.userAccount),
1071
1073
  orderId: ask.order.orderId,
1072
1074
  });
1073
1075
  }
@@ -1076,7 +1078,7 @@ class DLOB {
1076
1078
  bids.push({
1077
1079
  price: bid.getPrice(oraclePriceData, slot),
1078
1080
  size: bid.order.baseAssetAmount.sub(bid.order.baseAssetAmountFilled),
1079
- maker: bid.userAccount,
1081
+ maker: new web3_js_1.PublicKey(bid.userAccount),
1080
1082
  orderId: bid.order.orderId,
1081
1083
  });
1082
1084
  }
@@ -1132,7 +1134,7 @@ class DLOB {
1132
1134
  : this.getRestingLimitAsks(marketIndex, slot, marketType, oraclePriceData);
1133
1135
  for (const node of generator) {
1134
1136
  if (!makers.has(node.userAccount.toString())) {
1135
- makers.set(node.userAccount.toString(), node.userAccount);
1137
+ makers.set(node.userAccount.toString(), new web3_js_1.PublicKey(node.userAccount));
1136
1138
  }
1137
1139
  if (makers.size === numMakers) {
1138
1140
  break;
@@ -1,21 +1,20 @@
1
1
  /// <reference types="bn.js" />
2
2
  import { BN, OraclePriceData, Order } from '..';
3
- import { PublicKey } from '@solana/web3.js';
4
3
  export interface DLOBNode {
5
4
  getPrice(oraclePriceData: OraclePriceData, slot: number): BN;
6
5
  isVammNode(): boolean;
7
6
  order: Order | undefined;
8
7
  isBaseFilled(): boolean;
9
8
  haveFilled: boolean;
10
- userAccount: PublicKey | undefined;
9
+ userAccount: string | undefined;
11
10
  }
12
11
  export declare abstract class OrderNode implements DLOBNode {
13
12
  order: Order;
14
- userAccount: PublicKey;
13
+ userAccount: string;
15
14
  sortValue: BN;
16
15
  haveFilled: boolean;
17
16
  haveTrigger: boolean;
18
- constructor(order: Order, userAccount: PublicKey);
17
+ constructor(order: Order, userAccount: string);
19
18
  abstract getSortValue(order: Order): BN;
20
19
  getLabel(): string;
21
20
  getPrice(oraclePriceData: OraclePriceData, slot: number): BN;
@@ -55,4 +54,4 @@ export type DLOBNodeMap = {
55
54
  trigger: TriggerOrderNode;
56
55
  };
57
56
  export type DLOBNodeType = 'restingLimit' | 'takingLimit' | 'floatingLimit' | 'market' | ('trigger' & keyof DLOBNodeMap);
58
- export declare function createNode<T extends DLOBNodeType>(nodeType: T, order: Order, userAccount: PublicKey): DLOBNodeMap[T];
57
+ export declare function createNode<T extends DLOBNodeType>(nodeType: T, order: Order, userAccount: string): DLOBNodeMap[T];
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createNode = exports.TriggerOrderNode = exports.MarketOrderNode = exports.FloatingLimitOrderNode = exports.RestingLimitOrderNode = exports.TakingLimitOrderNode = exports.OrderNode = void 0;
4
4
  const __1 = require("..");
5
+ // import { PublicKey } from '@solana/web3.js';
5
6
  const NodeList_1 = require("./NodeList");
6
7
  class OrderNode {
7
8
  constructor(order, userAccount) {
@@ -1,9 +1,8 @@
1
1
  /// <reference types="bn.js" />
2
2
  import { BN, MarketTypeStr, Order } from '..';
3
- import { PublicKey } from '@solana/web3.js';
4
3
  import { DLOBNode, DLOBNodeMap } from './DLOBNode';
5
4
  export type SortDirection = 'asc' | 'desc';
6
- export declare function getOrderSignature(orderId: number, userAccount: PublicKey): string;
5
+ export declare function getOrderSignature(orderId: number, userAccount: string): string;
7
6
  export interface DLOBNodeGenerator {
8
7
  getGenerator(): Generator<DLOBNode>;
9
8
  }
@@ -15,12 +14,12 @@ export declare class NodeList<NodeType extends keyof DLOBNodeMap> implements DLO
15
14
  nodeMap: Map<string, DLOBNodeMap[NodeType]>;
16
15
  constructor(nodeType: NodeType, sortDirection: SortDirection);
17
16
  clear(): void;
18
- insert(order: Order, marketType: MarketTypeStr, userAccount: PublicKey): void;
17
+ insert(order: Order, marketType: MarketTypeStr, userAccount: string): void;
19
18
  prependNode(currentNode: DLOBNodeMap[NodeType], newNode: DLOBNodeMap[NodeType]): boolean;
20
- update(order: Order, userAccount: PublicKey): void;
21
- remove(order: Order, userAccount: PublicKey): void;
19
+ update(order: Order, userAccount: string): void;
20
+ remove(order: Order, userAccount: string): void;
22
21
  getGenerator(): Generator<DLOBNode>;
23
- has(order: Order, userAccount: PublicKey): boolean;
22
+ has(order: Order, userAccount: string): boolean;
24
23
  get(orderSignature: string): DLOBNodeMap[NodeType] | undefined;
25
24
  print(): void;
26
25
  printTop(): void;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getVammNodeGenerator = exports.NodeList = exports.getOrderSignature = void 0;
4
4
  const __1 = require("..");
5
+ // import { PublicKey } from '@solana/web3.js';
5
6
  const DLOBNode_1 = require("./DLOBNode");
6
7
  function getOrderSignature(orderId, userAccount) {
7
8
  return `${userAccount.toString()}-${orderId.toString()}`;
@@ -245,7 +245,7 @@ export declare class DriftClient {
245
245
  * @param associatedTokenAddress - the token account to withdraw to. can be the wallet public key if using native sol
246
246
  * @param reduceOnly
247
247
  */
248
- withdraw(amount: BN, marketIndex: number, associatedTokenAddress: PublicKey, reduceOnly?: boolean, subAccountId?: number): Promise<TransactionSignature>;
248
+ withdraw(amount: BN, marketIndex: number, associatedTokenAddress: PublicKey, reduceOnly?: boolean, subAccountId?: number, txParams?: TxParams): Promise<TransactionSignature>;
249
249
  getWithdrawIx(amount: BN, marketIndex: number, userTokenAccount: PublicKey, reduceOnly?: boolean, subAccountId?: number): Promise<TransactionInstruction>;
250
250
  /**
251
251
  * Withdraws from the fromSubAccount and deposits into the toSubAccount
@@ -1169,7 +1169,7 @@ class DriftClient {
1169
1169
  * @param associatedTokenAddress - the token account to withdraw to. can be the wallet public key if using native sol
1170
1170
  * @param reduceOnly
1171
1171
  */
1172
- async withdraw(amount, marketIndex, associatedTokenAddress, reduceOnly = false, subAccountId) {
1172
+ async withdraw(amount, marketIndex, associatedTokenAddress, reduceOnly = false, subAccountId, txParams) {
1173
1173
  const withdrawIxs = [];
1174
1174
  const additionalSigners = [];
1175
1175
  const spotMarketAccount = this.getSpotMarketAccount(marketIndex);
@@ -1195,6 +1195,7 @@ class DriftClient {
1195
1195
  withdrawIxs.push((0, spl_token_1.createCloseAccountInstruction)(associatedTokenAddress, authority, authority, []));
1196
1196
  }
1197
1197
  const tx = await this.buildTransaction(withdrawIxs, {
1198
+ ...(txParams !== null && txParams !== void 0 ? txParams : this.txParams),
1198
1199
  computeUnits: 1400000,
1199
1200
  });
1200
1201
  const { txSig, slot } = await this.sendTransaction(tx, additionalSigners, this.opts);
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.52.0",
2
+ "version": "2.53.0",
3
3
  "name": "drift",
4
4
  "instructions": [
5
5
  {
@@ -131,9 +131,8 @@ class OrderSubscriber {
131
131
  async getDLOB(slot) {
132
132
  const dlob = new DLOB_1.DLOB();
133
133
  for (const [key, { userAccount }] of this.usersAccounts.entries()) {
134
- const userAccountPubkey = new web3_js_1.PublicKey(key);
135
134
  for (const order of userAccount.orders) {
136
- dlob.insertOrder(order, userAccountPubkey, slot);
135
+ dlob.insertOrder(order, key, slot);
137
136
  }
138
137
  }
139
138
  return dlob;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/sdk",
3
- "version": "2.53.0-beta.8",
3
+ "version": "2.54.0-beta.0",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "author": "crispheaney",
package/src/dlob/DLOB.ts CHANGED
@@ -157,9 +157,10 @@ export class DLOB {
157
157
  for (const user of userMap.values()) {
158
158
  const userAccount = user.getUserAccount();
159
159
  const userAccountPubkey = user.getUserAccountPublicKey();
160
+ const userAccountPubkeyString = userAccountPubkey.toString();
160
161
 
161
162
  for (const order of userAccount.orders) {
162
- this.insertOrder(order, userAccountPubkey, slot);
163
+ this.insertOrder(order, userAccountPubkeyString, slot);
163
164
  }
164
165
  }
165
166
 
@@ -173,7 +174,7 @@ export class DLOB {
173
174
  }
174
175
 
175
176
  for (const { user, order } of dlobOrders) {
176
- this.insertOrder(order, user, slot);
177
+ this.insertOrder(order, user.toString(), slot);
177
178
  }
178
179
 
179
180
  this.initialized = true;
@@ -181,7 +182,7 @@ export class DLOB {
181
182
  }
182
183
 
183
184
  public handleOrderRecord(record: OrderRecord, slot: number): void {
184
- this.insertOrder(record.order, record.user, slot);
185
+ this.insertOrder(record.order, record.user.toString(), slot);
185
186
  }
186
187
 
187
188
  public handleOrderActionRecord(
@@ -249,7 +250,7 @@ export class DLOB {
249
250
 
250
251
  public insertOrder(
251
252
  order: Order,
252
- userAccount: PublicKey,
253
+ userAccount: string,
253
254
  slot: number,
254
255
  onInsert?: OrderBookCallback
255
256
  ): void {
@@ -327,7 +328,7 @@ export class DLOB {
327
328
  };
328
329
  newOrder.baseAssetAmountFilled = cumulativeBaseAssetAmountFilled;
329
330
 
330
- this.getListForOrder(order, slot)?.update(newOrder, userAccount);
331
+ this.getListForOrder(order, slot)?.update(newOrder, userAccount.toString());
331
332
 
332
333
  if (onUpdate) {
333
334
  onUpdate();
@@ -354,9 +355,13 @@ export class DLOB {
354
355
 
355
356
  const triggerList = this.orderLists.get(marketType).get(order.marketIndex)
356
357
  .trigger[isVariant(order.triggerCondition, 'above') ? 'above' : 'below'];
357
- triggerList.remove(order, userAccount);
358
+ triggerList.remove(order, userAccount.toString());
358
359
 
359
- this.getListForOrder(order, slot)?.insert(order, marketType, userAccount);
360
+ this.getListForOrder(order, slot)?.insert(
361
+ order,
362
+ marketType,
363
+ userAccount.toString()
364
+ );
360
365
  if (onTrigger) {
361
366
  onTrigger();
362
367
  }
@@ -374,7 +379,7 @@ export class DLOB {
374
379
 
375
380
  this.updateRestingLimitOrders(slot);
376
381
 
377
- this.getListForOrder(order, slot)?.remove(order, userAccount);
382
+ this.getListForOrder(order, slot)?.remove(order, userAccount.toString());
378
383
  if (onDelete) {
379
384
  onDelete();
380
385
  }
@@ -472,7 +477,7 @@ export class DLOB {
472
477
  }
473
478
 
474
479
  public getOrder(orderId: number, userAccount: PublicKey): Order | undefined {
475
- const orderSignature = getOrderSignature(orderId, userAccount);
480
+ const orderSignature = getOrderSignature(orderId, userAccount.toString());
476
481
  for (const nodeList of this.getNodeLists()) {
477
482
  const node = nodeList.get(orderSignature);
478
483
  if (node) {
@@ -852,7 +857,7 @@ export class DLOB {
852
857
 
853
858
  for (const makerNode of makerNodeGenerator) {
854
859
  // Can't match orders from the same user
855
- const sameUser = takerNode.userAccount.equals(makerNode.userAccount);
860
+ const sameUser = takerNode.userAccount === makerNode.userAccount;
856
861
  if (sameUser) {
857
862
  continue;
858
863
  }
@@ -1377,7 +1382,7 @@ export class DLOB {
1377
1382
  const askOrder = askNode.order;
1378
1383
 
1379
1384
  // Can't match orders from the same user
1380
- const sameUser = bidNode.userAccount.equals(askNode.userAccount);
1385
+ const sameUser = bidNode.userAccount === askNode.userAccount;
1381
1386
  if (sameUser) {
1382
1387
  continue;
1383
1388
  }
@@ -1760,7 +1765,7 @@ export class DLOB {
1760
1765
  for (const nodeList of this.getNodeLists()) {
1761
1766
  for (const node of nodeList.getGenerator()) {
1762
1767
  dlobOrders.push({
1763
- user: node.userAccount,
1768
+ user: new PublicKey(node.userAccount),
1764
1769
  order: node.order,
1765
1770
  });
1766
1771
  }
@@ -1902,7 +1907,7 @@ export class DLOB {
1902
1907
  asks.push({
1903
1908
  price: ask.getPrice(oraclePriceData, slot),
1904
1909
  size: ask.order.baseAssetAmount.sub(ask.order.baseAssetAmountFilled),
1905
- maker: ask.userAccount,
1910
+ maker: new PublicKey(ask.userAccount),
1906
1911
  orderId: ask.order.orderId,
1907
1912
  });
1908
1913
  }
@@ -1918,7 +1923,7 @@ export class DLOB {
1918
1923
  bids.push({
1919
1924
  price: bid.getPrice(oraclePriceData, slot),
1920
1925
  size: bid.order.baseAssetAmount.sub(bid.order.baseAssetAmountFilled),
1921
- maker: bid.userAccount,
1926
+ maker: new PublicKey(bid.userAccount),
1922
1927
  orderId: bid.order.orderId,
1923
1928
  });
1924
1929
  }
@@ -2028,7 +2033,10 @@ export class DLOB {
2028
2033
 
2029
2034
  for (const node of generator) {
2030
2035
  if (!makers.has(node.userAccount.toString())) {
2031
- makers.set(node.userAccount.toString(), node.userAccount);
2036
+ makers.set(
2037
+ node.userAccount.toString(),
2038
+ new PublicKey(node.userAccount)
2039
+ );
2032
2040
  }
2033
2041
 
2034
2042
  if (makers.size === numMakers) {
@@ -9,7 +9,7 @@ import {
9
9
  Order,
10
10
  ZERO,
11
11
  } from '..';
12
- import { PublicKey } from '@solana/web3.js';
12
+ // import { PublicKey } from '@solana/web3.js';
13
13
  import { getOrderSignature } from './NodeList';
14
14
 
15
15
  export interface DLOBNode {
@@ -18,17 +18,17 @@ export interface DLOBNode {
18
18
  order: Order | undefined;
19
19
  isBaseFilled(): boolean;
20
20
  haveFilled: boolean;
21
- userAccount: PublicKey | undefined;
21
+ userAccount: string | undefined;
22
22
  }
23
23
 
24
24
  export abstract class OrderNode implements DLOBNode {
25
25
  order: Order;
26
- userAccount: PublicKey;
26
+ userAccount: string;
27
27
  sortValue: BN;
28
28
  haveFilled = false;
29
29
  haveTrigger = false;
30
30
 
31
- constructor(order: Order, userAccount: PublicKey) {
31
+ constructor(order: Order, userAccount: string) {
32
32
  // Copy the order over to the node
33
33
  this.order = { ...order };
34
34
  this.userAccount = userAccount;
@@ -140,7 +140,7 @@ export type DLOBNodeType =
140
140
  export function createNode<T extends DLOBNodeType>(
141
141
  nodeType: T,
142
142
  order: Order,
143
- userAccount: PublicKey
143
+ userAccount: string
144
144
  ): DLOBNodeMap[T] {
145
145
  switch (nodeType) {
146
146
  case 'floatingLimit':
@@ -1,12 +1,12 @@
1
1
  import { BN, isVariant, MarketTypeStr, Order } from '..';
2
- import { PublicKey } from '@solana/web3.js';
2
+ // import { PublicKey } from '@solana/web3.js';
3
3
  import { createNode, DLOBNode, DLOBNodeMap } from './DLOBNode';
4
4
 
5
5
  export type SortDirection = 'asc' | 'desc';
6
6
 
7
7
  export function getOrderSignature(
8
8
  orderId: number,
9
- userAccount: PublicKey
9
+ userAccount: string
10
10
  ): string {
11
11
  return `${userAccount.toString()}-${orderId.toString()}`;
12
12
  }
@@ -36,7 +36,7 @@ export class NodeList<NodeType extends keyof DLOBNodeMap>
36
36
  public insert(
37
37
  order: Order,
38
38
  marketType: MarketTypeStr,
39
- userAccount: PublicKey
39
+ userAccount: string
40
40
  ): void {
41
41
  if (isVariant(order.status, 'init')) {
42
42
  return;
@@ -101,7 +101,7 @@ export class NodeList<NodeType extends keyof DLOBNodeMap>
101
101
  }
102
102
  }
103
103
 
104
- public update(order: Order, userAccount: PublicKey): void {
104
+ public update(order: Order, userAccount: string): void {
105
105
  const orderId = getOrderSignature(order.orderId, userAccount);
106
106
  if (this.nodeMap.has(orderId)) {
107
107
  const node = this.nodeMap.get(orderId);
@@ -110,7 +110,7 @@ export class NodeList<NodeType extends keyof DLOBNodeMap>
110
110
  }
111
111
  }
112
112
 
113
- public remove(order: Order, userAccount: PublicKey): void {
113
+ public remove(order: Order, userAccount: string): void {
114
114
  const orderId = getOrderSignature(order.orderId, userAccount);
115
115
  if (this.nodeMap.has(orderId)) {
116
116
  const node = this.nodeMap.get(orderId);
@@ -142,7 +142,7 @@ export class NodeList<NodeType extends keyof DLOBNodeMap>
142
142
  }
143
143
  }
144
144
 
145
- public has(order: Order, userAccount: PublicKey): boolean {
145
+ public has(order: Order, userAccount: string): boolean {
146
146
  return this.nodeMap.has(getOrderSignature(order.orderId, userAccount));
147
147
  }
148
148
 
@@ -2049,7 +2049,8 @@ export class DriftClient {
2049
2049
  marketIndex: number,
2050
2050
  associatedTokenAddress: PublicKey,
2051
2051
  reduceOnly = false,
2052
- subAccountId?: number
2052
+ subAccountId?: number,
2053
+ txParams?: TxParams
2053
2054
  ): Promise<TransactionSignature> {
2054
2055
  const withdrawIxs = [];
2055
2056
 
@@ -2112,6 +2113,7 @@ export class DriftClient {
2112
2113
  }
2113
2114
 
2114
2115
  const tx = await this.buildTransaction(withdrawIxs, {
2116
+ ...(txParams ?? this.txParams),
2115
2117
  computeUnits: 1_400_000,
2116
2118
  });
2117
2119
  const { txSig, slot } = await this.sendTransaction(
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.52.0",
2
+ "version": "2.53.0",
3
3
  "name": "drift",
4
4
  "instructions": [
5
5
  {
@@ -200,9 +200,8 @@ export class OrderSubscriber {
200
200
  public async getDLOB(slot: number): Promise<DLOB> {
201
201
  const dlob = new DLOB();
202
202
  for (const [key, { userAccount }] of this.usersAccounts.entries()) {
203
- const userAccountPubkey = new PublicKey(key);
204
203
  for (const order of userAccount.orders) {
205
- dlob.insertOrder(order, userAccountPubkey, slot);
204
+ dlob.insertOrder(order, key, slot);
206
205
  }
207
206
  }
208
207
  return dlob;