@drift-labs/jit-proxy 0.10.194 → 0.10.196

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.
@@ -20,6 +20,8 @@ export declare abstract class BaseJitter {
20
20
  spotParams: Map<number, JitParams>;
21
21
  onGoingAuctions: Map<string, Promise<void>>;
22
22
  userFilter: UserFilter;
23
+ computeUnits: number;
24
+ computeUnitsPrice: number;
23
25
  constructor({ auctionSubscriber, jitProxyClient, driftClient, userStatsMap, }: {
24
26
  driftClient: DriftClient;
25
27
  auctionSubscriber: AuctionSubscriber;
@@ -32,4 +34,6 @@ export declare abstract class BaseJitter {
32
34
  updatePerpParams(marketIndex: number, params: JitParams): void;
33
35
  updateSpotParams(marketIndex: number, params: JitParams): void;
34
36
  setUserFilter(userFilter: UserFilter | undefined): void;
37
+ setComputeUnits(computeUnits: number): void;
38
+ setComputeUnitsPrice(computeUnitsPrice: number): void;
35
39
  }
@@ -10,6 +10,9 @@ class BaseJitter {
10
10
  this.auctionSubscriber = auctionSubscriber;
11
11
  this.driftClient = driftClient;
12
12
  this.jitProxyClient = jitProxyClient;
13
+ this.userStatsMap =
14
+ userStatsMap ||
15
+ new sdk_1.UserStatsMap(this.driftClient, new sdk_1.BulkAccountLoader(this.driftClient.connection, 'confirmed', 0));
13
16
  }
14
17
  async subscribe() {
15
18
  await this.driftClient.subscribe();
@@ -77,5 +80,11 @@ class BaseJitter {
77
80
  setUserFilter(userFilter) {
78
81
  this.userFilter = userFilter;
79
82
  }
83
+ setComputeUnits(computeUnits) {
84
+ this.computeUnits = computeUnits;
85
+ }
86
+ setComputeUnitsPrice(computeUnitsPrice) {
87
+ this.computeUnitsPrice = computeUnitsPrice;
88
+ }
80
89
  }
81
90
  exports.BaseJitter = BaseJitter;
@@ -22,6 +22,10 @@ class JitterShotgun extends baseJitter_1.BaseJitter {
22
22
  }
23
23
  const takerStats = await this.userStatsMap.mustGet(taker.authority.toString());
24
24
  const referrerInfo = takerStats.getReferrerInfo();
25
+ const txParams = {
26
+ computeUnits: this.computeUnits,
27
+ computeUnitsPrice: this.computeUnitsPrice,
28
+ };
25
29
  console.log(`Trying to fill ${orderSignature}`);
26
30
  try {
27
31
  const { txSig } = await this.jitProxyClient.jit({
@@ -37,7 +41,7 @@ class JitterShotgun extends baseJitter_1.BaseJitter {
37
41
  priceType: params.priceType,
38
42
  referrerInfo,
39
43
  subAccountId: params.subAccountId,
40
- });
44
+ }, txParams);
41
45
  console.log(`Filled ${orderSignature} txSig ${txSig}`);
42
46
  await sleep(10000);
43
47
  this.onGoingAuctions.delete(orderSignature);
@@ -95,6 +95,10 @@ class JitterSniper extends baseJitter_1.BaseJitter {
95
95
  let i = 0;
96
96
  while (i < 3) {
97
97
  try {
98
+ const txParams = {
99
+ computeUnits: this.computeUnits,
100
+ computeUnitsPrice: this.computeUnitsPrice,
101
+ };
98
102
  const { txSig } = await this.jitProxyClient.jit({
99
103
  takerKey,
100
104
  takerStatsKey,
@@ -108,7 +112,7 @@ class JitterSniper extends baseJitter_1.BaseJitter {
108
112
  priceType: params.priceType,
109
113
  referrerInfo,
110
114
  subAccountId: params.subAccountId,
111
- });
115
+ }, txParams);
112
116
  console.log(`Filled ${orderSignature} txSig ${txSig}`);
113
117
  await sleep(3000);
114
118
  this.onGoingAuctions.delete(orderSignature);
@@ -189,6 +189,9 @@ export type JitProxy = {
189
189
  },
190
190
  {
191
191
  name: 'TryPostOnly';
192
+ },
193
+ {
194
+ name: 'Slide';
192
195
  }
193
196
  ];
194
197
  };
@@ -262,6 +265,16 @@ export type JitProxy = {
262
265
  code: 6007;
263
266
  name: 'UnprofitableArb';
264
267
  msg: 'UnprofitableArb';
268
+ },
269
+ {
270
+ code: 6008;
271
+ name: 'PositionLimitBreached';
272
+ msg: 'PositionLimitBreached';
273
+ },
274
+ {
275
+ code: 6009;
276
+ name: 'NoFill';
277
+ msg: 'NoFill';
265
278
  }
266
279
  ];
267
280
  };
@@ -193,6 +193,9 @@ exports.IDL = {
193
193
  {
194
194
  name: 'TryPostOnly',
195
195
  },
196
+ {
197
+ name: 'Slide',
198
+ },
196
199
  ],
197
200
  },
198
201
  },
@@ -266,5 +269,15 @@ exports.IDL = {
266
269
  name: 'UnprofitableArb',
267
270
  msg: 'UnprofitableArb',
268
271
  },
272
+ {
273
+ code: 6008,
274
+ name: 'PositionLimitBreached',
275
+ msg: 'PositionLimitBreached',
276
+ },
277
+ {
278
+ code: 6009,
279
+ name: 'NoFill',
280
+ msg: 'NoFill',
281
+ },
269
282
  ],
270
283
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/jit-proxy",
3
- "version": "0.10.194",
3
+ "version": "0.10.196",
4
4
  "scripts": {
5
5
  "clean": "rm -rf lib",
6
6
  "build": "yarn clean && tsc"
@@ -48,6 +48,9 @@ export abstract class BaseJitter {
48
48
 
49
49
  userFilter: UserFilter;
50
50
 
51
+ computeUnits: number;
52
+ computeUnitsPrice: number;
53
+
51
54
  constructor({
52
55
  auctionSubscriber,
53
56
  jitProxyClient,
@@ -62,6 +65,13 @@ export abstract class BaseJitter {
62
65
  this.auctionSubscriber = auctionSubscriber;
63
66
  this.driftClient = driftClient;
64
67
  this.jitProxyClient = jitProxyClient;
68
+ this.userStatsMap =
69
+ userStatsMap ||
70
+ new UserStatsMap(this.driftClient, new BulkAccountLoader(
71
+ this.driftClient.connection,
72
+ 'confirmed',
73
+ 0
74
+ ));
65
75
  }
66
76
 
67
77
  async subscribe(): Promise<void> {
@@ -180,4 +190,12 @@ export abstract class BaseJitter {
180
190
  public setUserFilter(userFilter: UserFilter | undefined): void {
181
191
  this.userFilter = userFilter;
182
192
  }
193
+
194
+ public setComputeUnits(computeUnits: number): void {
195
+ this.computeUnits = computeUnits;
196
+ }
197
+
198
+ public setComputeUnitsPrice(computeUnitsPrice: number): void {
199
+ this.computeUnitsPrice = computeUnitsPrice;
200
+ }
183
201
  }
@@ -66,6 +66,11 @@ export class JitterShotgun extends BaseJitter {
66
66
  );
67
67
  const referrerInfo = takerStats.getReferrerInfo();
68
68
 
69
+ const txParams = {
70
+ computeUnits: this.computeUnits,
71
+ computeUnitsPrice: this.computeUnitsPrice,
72
+ };
73
+
69
74
  console.log(`Trying to fill ${orderSignature}`);
70
75
  try {
71
76
  const { txSig } = await this.jitProxyClient.jit({
@@ -81,7 +86,7 @@ export class JitterShotgun extends BaseJitter {
81
86
  priceType: params.priceType,
82
87
  referrerInfo,
83
88
  subAccountId: params.subAccountId,
84
- });
89
+ }, txParams);
85
90
 
86
91
  console.log(`Filled ${orderSignature} txSig ${txSig}`);
87
92
  await sleep(10000);
@@ -188,6 +188,10 @@ export class JitterSniper extends BaseJitter {
188
188
  let i = 0;
189
189
  while (i < 3) {
190
190
  try {
191
+ const txParams = {
192
+ computeUnits: this.computeUnits,
193
+ computeUnitsPrice: this.computeUnitsPrice,
194
+ }
191
195
  const { txSig } = await this.jitProxyClient.jit({
192
196
  takerKey,
193
197
  takerStatsKey,
@@ -201,7 +205,7 @@ export class JitterSniper extends BaseJitter {
201
205
  priceType: params.priceType,
202
206
  referrerInfo,
203
207
  subAccountId: params.subAccountId,
204
- });
208
+ }, txParams);
205
209
 
206
210
  console.log(`Filled ${orderSignature} txSig ${txSig}`);
207
211
  await sleep(3000);
@@ -189,6 +189,9 @@ export type JitProxy = {
189
189
  },
190
190
  {
191
191
  name: 'TryPostOnly';
192
+ },
193
+ {
194
+ name: 'Slide';
192
195
  }
193
196
  ];
194
197
  };
@@ -262,6 +265,16 @@ export type JitProxy = {
262
265
  code: 6007;
263
266
  name: 'UnprofitableArb';
264
267
  msg: 'UnprofitableArb';
268
+ },
269
+ {
270
+ code: 6008;
271
+ name: 'PositionLimitBreached';
272
+ msg: 'PositionLimitBreached';
273
+ },
274
+ {
275
+ code: 6009;
276
+ name: 'NoFill';
277
+ msg: 'NoFill';
265
278
  }
266
279
  ];
267
280
  };
@@ -458,6 +471,9 @@ export const IDL: JitProxy = {
458
471
  {
459
472
  name: 'TryPostOnly',
460
473
  },
474
+ {
475
+ name: 'Slide',
476
+ },
461
477
  ],
462
478
  },
463
479
  },
@@ -531,5 +547,15 @@ export const IDL: JitProxy = {
531
547
  name: 'UnprofitableArb',
532
548
  msg: 'UnprofitableArb',
533
549
  },
550
+ {
551
+ code: 6008,
552
+ name: 'PositionLimitBreached',
553
+ msg: 'PositionLimitBreached',
554
+ },
555
+ {
556
+ code: 6009,
557
+ name: 'NoFill',
558
+ msg: 'NoFill',
559
+ },
534
560
  ],
535
561
  };