@drift-labs/jit-proxy 0.10.195 → 0.10.197
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/lib/jitter/baseJitter.d.ts +4 -0
- package/lib/jitter/baseJitter.js +9 -0
- package/lib/jitter/jitterShotgun.js +5 -1
- package/lib/jitter/jitterSniper.js +5 -1
- package/package.json +1 -1
- package/src/jitter/baseJitter.ts +18 -0
- package/src/jitter/jitterShotgun.ts +6 -1
- package/src/jitter/jitterSniper.ts +5 -1
|
@@ -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
|
}
|
package/lib/jitter/baseJitter.js
CHANGED
|
@@ -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);
|
package/package.json
CHANGED
package/src/jitter/baseJitter.ts
CHANGED
|
@@ -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);
|