@drift-labs/jit-proxy 0.10.69 → 0.10.70

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.
@@ -46,8 +46,9 @@ export declare class JitProxyClient {
46
46
  makerInfos: MakerInfo[];
47
47
  marketIndex: number;
48
48
  }, txParams?: TxParams): Promise<TxSigAndSlot>;
49
- getArbPerpIx({ makerInfos, marketIndex, }: {
49
+ getArbPerpIx({ makerInfos, marketIndex, referrerInfo, }: {
50
50
  makerInfos: MakerInfo[];
51
51
  marketIndex: number;
52
+ referrerInfo?: ReferrerInfo;
52
53
  }): Promise<TransactionInstruction>;
53
54
  }
@@ -113,7 +113,7 @@ class JitProxyClient {
113
113
  const tx = await this.driftClient.buildTransaction([ix], txParams);
114
114
  return await this.driftClient.sendTransaction(tx);
115
115
  }
116
- async getArbPerpIx({ makerInfos, marketIndex, }) {
116
+ async getArbPerpIx({ makerInfos, marketIndex, referrerInfo, }) {
117
117
  const userAccounts = [this.driftClient.getUserAccount()];
118
118
  for (const makerInfo of makerInfos) {
119
119
  userAccounts.push(makerInfo.makerUserAccount);
@@ -134,6 +134,21 @@ class JitProxyClient {
134
134
  isSigner: false,
135
135
  });
136
136
  }
137
+ if (referrerInfo) {
138
+ const referrerIsMaker = makerInfos.find((maker) => maker.maker.equals(referrerInfo.referrer)) !== undefined;
139
+ if (!referrerIsMaker) {
140
+ remainingAccounts.push({
141
+ pubkey: referrerInfo.referrer,
142
+ isWritable: true,
143
+ isSigner: false,
144
+ });
145
+ remainingAccounts.push({
146
+ pubkey: referrerInfo.referrerStats,
147
+ isWritable: true,
148
+ isSigner: false,
149
+ });
150
+ }
151
+ }
137
152
  return this.program.methods
138
153
  .arbPerp(marketIndex)
139
154
  .accounts({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/jit-proxy",
3
- "version": "0.10.69",
3
+ "version": "0.10.70",
4
4
  "scripts": {
5
5
  "clean": "rm -rf lib",
6
6
  "build": "yarn clean && tsc"
@@ -197,9 +197,11 @@ export class JitProxyClient {
197
197
  public async getArbPerpIx({
198
198
  makerInfos,
199
199
  marketIndex,
200
+ referrerInfo,
200
201
  }: {
201
202
  makerInfos: MakerInfo[];
202
203
  marketIndex: number;
204
+ referrerInfo?: ReferrerInfo;
203
205
  }): Promise<TransactionInstruction> {
204
206
  const userAccounts = [this.driftClient.getUserAccount()];
205
207
  for (const makerInfo of makerInfos) {
@@ -224,6 +226,25 @@ export class JitProxyClient {
224
226
  });
225
227
  }
226
228
 
229
+ if (referrerInfo) {
230
+ const referrerIsMaker =
231
+ makerInfos.find((maker) =>
232
+ maker.maker.equals(referrerInfo.referrer)
233
+ ) !== undefined;
234
+ if (!referrerIsMaker) {
235
+ remainingAccounts.push({
236
+ pubkey: referrerInfo.referrer,
237
+ isWritable: true,
238
+ isSigner: false,
239
+ });
240
+ remainingAccounts.push({
241
+ pubkey: referrerInfo.referrerStats,
242
+ isWritable: true,
243
+ isSigner: false,
244
+ });
245
+ }
246
+ }
247
+
227
248
  return this.program.methods
228
249
  .arbPerp(marketIndex)
229
250
  .accounts({