@drift-labs/jit-proxy 0.13.8 → 0.13.10
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/jitProxyClient.d.ts
CHANGED
|
@@ -45,7 +45,7 @@ export declare class JitProxyClient {
|
|
|
45
45
|
programId: PublicKey;
|
|
46
46
|
});
|
|
47
47
|
jit(params: JitIxParams, txParams?: TxParams): Promise<TxSigAndSlot>;
|
|
48
|
-
jitSwift(params: JitSwiftIxParams, txParams?: TxParams
|
|
48
|
+
jitSwift(params: JitSwiftIxParams, txParams?: TxParams): Promise<TxSigAndSlot>;
|
|
49
49
|
getJitIx({ takerKey, takerStatsKey, taker, takerOrderId, maxPosition, minPosition, bid, ask, postOnly, priceType, referrerInfo, subAccountId, }: JitIxParams): Promise<TransactionInstruction>;
|
|
50
50
|
getJitSwiftIx({ takerKey, takerStatsKey, taker, maxPosition, minPosition, bid, ask, postOnly, priceType, referrerInfo, subAccountId, uuid, marketIndex, }: JitSwiftIxParams): Promise<TransactionInstruction>;
|
|
51
51
|
getCheckOrderConstraintIx({ subAccountId, orderConstraints, }: {
|
package/lib/jitProxyClient.js
CHANGED
|
@@ -19,15 +19,15 @@ class JitProxyClient {
|
|
|
19
19
|
const tx = await this.driftClient.buildTransaction([ix], txParams);
|
|
20
20
|
return await this.driftClient.sendTransaction(tx);
|
|
21
21
|
}
|
|
22
|
-
async jitSwift(params, txParams
|
|
22
|
+
async jitSwift(params, txParams) {
|
|
23
23
|
const swiftTakerIxs = await this.driftClient.getPlaceSwiftTakerPerpOrderIxs(params.signedSwiftOrderParams, params.marketIndex, {
|
|
24
24
|
taker: params.takerKey,
|
|
25
25
|
takerStats: params.takerStatsKey,
|
|
26
26
|
takerUserAccount: params.taker,
|
|
27
27
|
signingAuthority: params.authorityToUse,
|
|
28
|
-
},
|
|
28
|
+
}, undefined, 3);
|
|
29
29
|
const ix = await this.getJitSwiftIx(params);
|
|
30
|
-
const tx = await this.driftClient.buildTransaction([...swiftTakerIxs, ix], txParams);
|
|
30
|
+
const tx = await this.driftClient.buildTransaction([...swiftTakerIxs, ix], txParams, 0);
|
|
31
31
|
return await this.driftClient.sendTransaction(tx);
|
|
32
32
|
}
|
|
33
33
|
async getJitIx({ takerKey, takerStatsKey, taker, takerOrderId, maxPosition, minPosition, bid, ask, postOnly = null, priceType = PriceType.LIMIT, referrerInfo, subAccountId, }) {
|
package/lib/jitter/baseJitter.js
CHANGED
|
@@ -84,6 +84,7 @@ class BaseJitter {
|
|
|
84
84
|
const swiftOrderParamsBuf = Buffer.from(orderMessageRaw['order_message'], 'hex');
|
|
85
85
|
const { swiftOrderParams, subAccountId: takerSubaccountId, } = this.driftClient.decodeSwiftOrderParamsMessage(swiftOrderParamsBuf);
|
|
86
86
|
const takerAuthority = new web3_js_1.PublicKey(orderMessageRaw['taker_authority']);
|
|
87
|
+
const signingAuthority = new web3_js_1.PublicKey(orderMessageRaw['signing_authority']);
|
|
87
88
|
const takerUserPubkey = await (0, sdk_1.getUserAccountPublicKey)(this.driftClient.program.programId, takerAuthority, takerSubaccountId);
|
|
88
89
|
const takerUserPubkeyString = takerUserPubkey.toBase58();
|
|
89
90
|
const takerUserAccount = (await this.swiftOrderSubscriber.userMap.mustGet(takerUserPubkey.toString())).getUserAccount();
|
|
@@ -137,7 +138,7 @@ class BaseJitter {
|
|
|
137
138
|
if (swiftOrder.baseAssetAmount.lt(perpMarketAccount.amm.minOrderSize)) {
|
|
138
139
|
return;
|
|
139
140
|
}
|
|
140
|
-
const promise = this.createTrySwiftFill(
|
|
141
|
+
const promise = this.createTrySwiftFill(signingAuthority, {
|
|
141
142
|
orderParams: swiftOrderParamsBufHex,
|
|
142
143
|
signature: Buffer.from(orderMessageRaw['order_signature'], 'base64'),
|
|
143
144
|
}, (0, tweetnacl_util_1.decodeUTF8)(orderMessageRaw['uuid']), takerUserAccount, takerUserPubkey, (0, sdk_1.getUserStatsAccountPublicKey)(this.driftClient.program.programId, takerUserAccount.authority), swiftOrder, orderSignature, orderMessageRaw['market_index']).bind(this)();
|
package/package.json
CHANGED
package/src/jitProxyClient.ts
CHANGED
|
@@ -77,8 +77,7 @@ export class JitProxyClient {
|
|
|
77
77
|
|
|
78
78
|
public async jitSwift(
|
|
79
79
|
params: JitSwiftIxParams,
|
|
80
|
-
txParams?: TxParams
|
|
81
|
-
precedingIxs?: TransactionInstruction[]
|
|
80
|
+
txParams?: TxParams
|
|
82
81
|
): Promise<TxSigAndSlot> {
|
|
83
82
|
const swiftTakerIxs = await this.driftClient.getPlaceSwiftTakerPerpOrderIxs(
|
|
84
83
|
params.signedSwiftOrderParams,
|
|
@@ -89,13 +88,15 @@ export class JitProxyClient {
|
|
|
89
88
|
takerUserAccount: params.taker,
|
|
90
89
|
signingAuthority: params.authorityToUse,
|
|
91
90
|
},
|
|
92
|
-
|
|
91
|
+
undefined,
|
|
92
|
+
3
|
|
93
93
|
);
|
|
94
94
|
|
|
95
95
|
const ix = await this.getJitSwiftIx(params);
|
|
96
96
|
const tx = await this.driftClient.buildTransaction(
|
|
97
97
|
[...swiftTakerIxs, ix],
|
|
98
|
-
txParams
|
|
98
|
+
txParams,
|
|
99
|
+
0
|
|
99
100
|
);
|
|
100
101
|
return await this.driftClient.sendTransaction(tx);
|
|
101
102
|
}
|
package/src/jitter/baseJitter.ts
CHANGED
|
@@ -208,6 +208,9 @@ export abstract class BaseJitter {
|
|
|
208
208
|
const takerAuthority = new PublicKey(
|
|
209
209
|
orderMessageRaw['taker_authority']
|
|
210
210
|
);
|
|
211
|
+
const signingAuthority = new PublicKey(
|
|
212
|
+
orderMessageRaw['signing_authority']
|
|
213
|
+
);
|
|
211
214
|
const takerUserPubkey = await getUserAccountPublicKey(
|
|
212
215
|
this.driftClient.program.programId,
|
|
213
216
|
takerAuthority,
|
|
@@ -289,7 +292,7 @@ export abstract class BaseJitter {
|
|
|
289
292
|
}
|
|
290
293
|
|
|
291
294
|
const promise = this.createTrySwiftFill(
|
|
292
|
-
|
|
295
|
+
signingAuthority,
|
|
293
296
|
{
|
|
294
297
|
orderParams: swiftOrderParamsBufHex,
|
|
295
298
|
signature: Buffer.from(
|