@drift-labs/jit-proxy 0.3.0 → 0.4.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.
@@ -31,5 +31,5 @@ export declare class JitProxyClient {
31
31
  programId: PublicKey;
32
32
  });
33
33
  jit(params: JitIxParams, txParams?: TxParams): Promise<TxSigAndSlot>;
34
- getJitIx({ takerKey, takerStatsKey, taker, takerOrderId, maxPosition, minPosition, bid, ask, postOnly, priceType, }: JitIxParams): Promise<TransactionInstruction>;
34
+ getJitIx({ takerKey, takerStatsKey, taker, takerOrderId, maxPosition, minPosition, bid, ask, postOnly, priceType, referrerInfo, }: JitIxParams): Promise<TransactionInstruction>;
35
35
  }
@@ -19,7 +19,7 @@ class JitProxyClient {
19
19
  const tx = await this.driftClient.buildTransaction([ix], txParams);
20
20
  return await this.driftClient.sendTransaction(tx);
21
21
  }
22
- async getJitIx({ takerKey, takerStatsKey, taker, takerOrderId, maxPosition, minPosition, bid, ask, postOnly = null, priceType = PriceType.LIMIT, }) {
22
+ async getJitIx({ takerKey, takerStatsKey, taker, takerOrderId, maxPosition, minPosition, bid, ask, postOnly = null, priceType = PriceType.LIMIT, referrerInfo, }) {
23
23
  const order = taker.orders.find((order) => order.orderId === takerOrderId);
24
24
  const remainingAccounts = this.driftClient.getRemainingAccounts({
25
25
  userAccounts: [taker, this.driftClient.getUserAccount()],
@@ -30,6 +30,18 @@ class JitProxyClient {
30
30
  ? [order.marketIndex]
31
31
  : [],
32
32
  });
33
+ if (referrerInfo) {
34
+ remainingAccounts.push({
35
+ pubkey: referrerInfo.referrer,
36
+ isWritable: true,
37
+ isSigner: false,
38
+ });
39
+ remainingAccounts.push({
40
+ pubkey: referrerInfo.referrerStats,
41
+ isWritable: true,
42
+ isSigner: false,
43
+ });
44
+ }
33
45
  if (sdk_1.isVariant(order.marketType, 'spot')) {
34
46
  remainingAccounts.push({
35
47
  pubkey: this.driftClient.getSpotMarketAccount(order.marketIndex).vault,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/jit-proxy",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "dependencies": {
5
5
  "@coral-xyz/anchor": "^0.26.0",
6
6
  "@solana/web3.js": "1.73.2",
@@ -67,6 +67,7 @@ export class JitProxyClient {
67
67
  ask,
68
68
  postOnly = null,
69
69
  priceType = PriceType.LIMIT,
70
+ referrerInfo,
70
71
  }: JitIxParams): Promise<TransactionInstruction> {
71
72
  const order = taker.orders.find((order) => order.orderId === takerOrderId);
72
73
  const remainingAccounts = this.driftClient.getRemainingAccounts({
@@ -79,6 +80,19 @@ export class JitProxyClient {
79
80
  : [],
80
81
  });
81
82
 
83
+ if (referrerInfo) {
84
+ remainingAccounts.push({
85
+ pubkey: referrerInfo.referrer,
86
+ isWritable: true,
87
+ isSigner: false,
88
+ });
89
+ remainingAccounts.push({
90
+ pubkey: referrerInfo.referrerStats,
91
+ isWritable: true,
92
+ isSigner: false,
93
+ });
94
+ }
95
+
82
96
  if (isVariant(order.marketType, 'spot')) {
83
97
  remainingAccounts.push({
84
98
  pubkey: this.driftClient.getSpotMarketAccount(order.marketIndex).vault,