@haven-fi/solauto-sdk 1.0.219 → 1.0.220

Sign up to get free protection for your applications and to get access to all the features.
@@ -29,12 +29,13 @@ export declare abstract class SolautoClient extends ReferralStateManager {
29
29
  debtMint: PublicKey;
30
30
  positionDebtTa: PublicKey;
31
31
  signerDebtTa: PublicKey;
32
- solautoFeesWallet: PublicKey;
33
32
  solautoFeesSupplyTa: PublicKey;
33
+ solautoFeesDebtTa: PublicKey;
34
34
  authorityLutAddress?: PublicKey;
35
35
  livePositionUpdates: LivePositionUpdates;
36
36
  initialize(args: SolautoClientArgs): Promise<void>;
37
37
  referredBySupplyTa(): PublicKey | undefined;
38
+ referredByDebtTa(): PublicKey | undefined;
38
39
  resetLiveTxUpdates(success?: boolean): Promise<void>;
39
40
  abstract protocolAccount(): PublicKey;
40
41
  defaultLookupTables(): string[];
@@ -1 +1 @@
1
- {"version":3,"file":"solautoClient.d.ts","sourceRoot":"","sources":["../../src/clients/solautoClient.ts"],"names":[],"mappings":"AAAA,OAAO,gCAAgC,CAAC;AACxC,OAAO,EAA6B,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EACL,MAAM,EACN,kBAAkB,EAMnB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,wBAAwB,EACxB,yBAAyB,EACzB,gCAAgC,EAEhC,sBAAsB,EAKvB,MAAM,cAAc,CAAC;AAUtB,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAMpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,WAAW,iBAAkB,SAAQ,wBAAwB;IACjE,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,UAAU,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AAE,gBAAgB,EAC5B,2BAA2B,CAAC,EAAE,MAAM,GACnC,kBAAkB;IAEf,qBAAqB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;CAalE"}
@@ -43,8 +43,8 @@ class SolautoClient extends referralStateManager_1.ReferralStateManager {
43
43
  : web3_js_1.PublicKey.default);
44
44
  this.positionDebtTa = (0, accountUtils_1.getTokenAccount)(this.solautoPosition, this.debtMint);
45
45
  this.signerDebtTa = (0, accountUtils_1.getTokenAccount)((0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey), this.debtMint);
46
- this.solautoFeesWallet = generalAccounts_1.SOLAUTO_FEES_WALLET;
47
- this.solautoFeesSupplyTa = (0, accountUtils_1.getTokenAccount)(this.solautoFeesWallet, this.supplyMint);
46
+ this.solautoFeesSupplyTa = (0, accountUtils_1.getTokenAccount)(generalAccounts_1.SOLAUTO_FEES_WALLET, this.supplyMint);
47
+ this.solautoFeesDebtTa = (0, accountUtils_1.getTokenAccount)(generalAccounts_1.SOLAUTO_FEES_WALLET, this.debtMint);
48
48
  this.authorityLutAddress =
49
49
  this.referralStateData?.lookupTable &&
50
50
  !(0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.referralStateData.lookupTable).equals(web3_js_1.PublicKey.default)
@@ -63,6 +63,12 @@ class SolautoClient extends referralStateManager_1.ReferralStateManager {
63
63
  }
64
64
  return undefined;
65
65
  }
66
+ referredByDebtTa() {
67
+ if (this.referredByState !== undefined) {
68
+ return (0, accountUtils_1.getTokenAccount)(this.referredByState, this.debtMint);
69
+ }
70
+ return undefined;
71
+ }
66
72
  async resetLiveTxUpdates(success) {
67
73
  if (success) {
68
74
  if (!this.solautoPositionData) {
@@ -1 +1 @@
1
- {"version":3,"file":"solautoMarginfiClient.d.ts","sourceRoot":"","sources":["../../src/clients/solautoMarginfiClient.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,MAAM,EACN,kBAAkB,EAMnB,MAAM,0BAA0B,CAAC;AAClC,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,sBAAsB;IA6C9B,OAAO,IAAI,kBAAkB;IAc7B,mBAAmB,CAAC,IAAI,EAAE,iBAAiB,GAAG,kBAAkB;IAUhE,OAAO,CAAC,6BAA6B;IAmErC,OAAO,CAAC,oCAAoC;IA0D5C,SAAS,CACP,aAAa,EAAE,GAAG,GAAG,GAAG,EACxB,QAAQ,EAAE,aAAa,EACvB,aAAa,EAAE,wBAAwB,EACvC,eAAe,EAAE,eAAe,EAChC,SAAS,CAAC,EAAE,gBAAgB,EAC5B,2BAA2B,CAAC,EAAE,MAAM,GACnC,kBAAkB;IAgFrB,WAAW,CACT,gBAAgB,EAAE,gBAAgB,EAClC,uBAAuB,EAAE,SAAS,GACjC,kBAAkB;IA2BrB,UAAU,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,kBAAkB;IAoFlE,iCAAiC,IAAI,kBAAkB;IASjD,qBAAqB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;CA6ClE"}
@@ -299,10 +299,16 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
299
299
  signer: this.signer,
300
300
  marginfiProgram: (0, umi_1.publicKey)(marginfi_sdk_1.MARGINFI_PROGRAM_ID),
301
301
  ixsSysvar: (0, umi_1.publicKey)(web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY),
302
- solautoFeesSupplyTa: rebalanceStep === "B" ? (0, umi_1.publicKey)(this.solautoFeesSupplyTa) : undefined,
302
+ solautoFeesTa: rebalanceStep === "B"
303
+ ? (0, umi_1.publicKey)(rebalanceValues.rebalanceDirection === generated_1.RebalanceDirection.Boost
304
+ ? this.solautoFeesSupplyTa
305
+ : this.solautoFeesDebtTa)
306
+ : undefined,
303
307
  authorityReferralState: (0, umi_1.publicKey)(this.referralState),
304
- referredBySupplyTa: this.referredBySupplyTa()
305
- ? (0, umi_1.publicKey)(this.referredBySupplyTa())
308
+ referredByTa: this.referredByState
309
+ ? (0, umi_1.publicKey)(rebalanceValues.rebalanceDirection === generated_1.RebalanceDirection.Boost
310
+ ? this.referredBySupplyTa()
311
+ : this.referredByDebtTa())
306
312
  : undefined,
307
313
  positionAuthority: rebalanceValues.rebalanceAction === "dca"
308
314
  ? (0, umi_1.publicKey)(this.authority)
@@ -14,9 +14,9 @@ export type MarginfiRebalanceInstructionAccounts = {
14
14
  systemProgram?: PublicKey | Pda;
15
15
  tokenProgram?: PublicKey | Pda;
16
16
  ixsSysvar: PublicKey | Pda;
17
- solautoFeesSupplyTa?: PublicKey | Pda;
17
+ solautoFeesTa?: PublicKey | Pda;
18
18
  authorityReferralState: PublicKey | Pda;
19
- referredBySupplyTa?: PublicKey | Pda;
19
+ referredByTa?: PublicKey | Pda;
20
20
  positionAuthority?: PublicKey | Pda;
21
21
  solautoPosition: PublicKey | Pda;
22
22
  marginfiGroup: PublicKey | Pda;
@@ -1 +1 @@
1
- {"version":3,"file":"marginfiRebalance.d.ts","sourceRoot":"","sources":["../../../src/generated/instructions/marginfiRebalance.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,OAAO,EACP,MAAM,EACN,gBAAgB,EAChB,GAAG,EACH,SAAS,EACT,MAAM,EACN,kBAAkB,EAEnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,UAAU,EAOX,MAAM,sCAAsC,CAAC;AAM9C,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EAEzB,MAAM,UAAU,CAAC;AAGlB,MAAM,MAAM,oCAAoC,GAAG;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,SAAS,GAAG,GAAG,CAAC;IACjC,aAAa,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAChC,YAAY,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAC/B,SAAS,EAAE,SAAS,GAAG,GAAG,CAAC;IAC3B,mBAAmB,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IACtC,sBAAsB,EAAE,SAAS,GAAG,GAAG,CAAC;IACxC,kBAAkB,CAAC,EAAE,S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CAAC;AAEF,wBAAgB,6CAA6C,IAAI,UAAU,CACzE,oCAAoC,EACpC,gCAAgC,CACjC,CAoBA;AAGD,MAAM,MAAM,gCAAgC,GAC1C,oCAAoC,CAAC;AAGvC,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,EAClC,KAAK,EAAE,oCAAoC,GAAG,gCAAgC,GAC7E,kBAAkB,CAkLpB"}
1
+ {"version":3,"file":"marginfiRebalance.d.ts","sourceRoot":"","sources":["../../../src/generated/instructions/marginfiRebalance.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,OAAO,EACP,MAAM,EACN,gBAAgB,EAChB,GAAG,EACH,SAAS,EACT,MAAM,EACN,kBAAkB,EAEnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,UAAU,EAOX,MAAM,sCAAsC,CAAC;AAM9C,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EAEzB,MAAM,UAAU,CAAC;AAGlB,MAAM,MAAM,oCAAoC,GAAG;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,SAAS,GAAG,GAAG,CAAC;IACjC,aAAa,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAChC,YAAY,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAC/B,SAAS,EAAE,SAAS,GAAG,GAAG,CAAC;IAC3B,aAAa,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAChC,sBAAsB,EAAE,SAAS,GAAG,GAAG,CAAC;IACxC,YAAY,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAC/B,iBAAiB,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IACpC,eAAe,EAAE,SAAS,GAAG,GAAG,CAAC;IACjC,aAAa,EAAE,SAAS,GAAG,GAAG,CAAC;IAC/B,eAAe,EAAE,SAAS,GAAG,GAAG,CAAC;IACjC,cAAc,CAAC,EAAE,SAAS,GAAG,GAAG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,gCAAgC,GAC7E,kBAAkB,CAkLpB"}
@@ -52,20 +52,20 @@ function marginfiRebalance(context, input) {
52
52
  isWritable: false,
53
53
  value: input.ixsSysvar ?? null,
54
54
  },
55
- solautoFeesSupplyTa: {
55
+ solautoFeesTa: {
56
56
  index: 5,
57
57
  isWritable: true,
58
- value: input.solautoFeesSupplyTa ?? null,
58
+ value: input.solautoFeesTa ?? null,
59
59
  },
60
60
  authorityReferralState: {
61
61
  index: 6,
62
62
  isWritable: false,
63
63
  value: input.authorityReferralState ?? null,
64
64
  },
65
- referredBySupplyTa: {
65
+ referredByTa: {
66
66
  index: 7,
67
67
  isWritable: true,
68
- value: input.referredBySupplyTa ?? null,
68
+ value: input.referredByTa ?? null,
69
69
  },
70
70
  positionAuthority: {
71
71
  index: 8,
@@ -1 +1 @@
1
- {"version":3,"file":"transactionUtils.d.ts","sourceRoot":"","sources":["../../src/transactions/transactionUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,kBAAkB,EAInB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,SAAS,EAA8B,MAAM,iBAAiB,CAAC;AAuBxE,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAyCzD,OAAO,EAAE,oBAAoB,EAAa,MAAM,YAAY,CAAC;AAO7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAqLjD,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,aAAa,EACrB,EAAE,EAAE,kBAAkB,EACtB,sBAAsB,EAAE,MAAM,EAAE,GAC/B,OAAO,CAAC,kBAAkB,CAAC,CAiH7B;AAkLD,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,aAAa,EACrB,EAAE,EAAE,kBAAkB,GACrB,OAAO,CAAC,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAAC,CA0BnD;AAED,wBAAsB,8BAA8B,CAAC,MAAM,EAAE,aAAa,oBA2CzE;AAED,wBAAsB,gCAAgC,CACpD,MAAM,EA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C,CACpD,eAAe,EAAE,oBAAoB,EACrC,YAAY,EAAE,SAAS,EACvB,eAAe,EAAE,SAAS,GACzB,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAsC5C;AAED,wBAAgB,YAAY,CAAC,EAAE,EAAE,kBAAkB,EAAE,KAAK,EAAE,GAAG;;;;EAwC9D"}
@@ -127,7 +127,9 @@ async function rebalanceChoresBefore(client, tx, accountsGettingCreated) {
127
127
  .getInstructions()
128
128
  .some((t) => t.keys.some((k) => (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(k.pubkey).equals(key)));
129
129
  const checkReferralSupplyTa = client.referredBySupplyTa() && usesAccount(client.referredBySupplyTa());
130
- const checkSolautoFeesTa = usesAccount(client.solautoFeesSupplyTa);
130
+ const checkReferralDebtTa = client.referredByDebtTa() && usesAccount(client.referredByDebtTa());
131
+ const checkSolautoFeesSupplyTa = usesAccount(client.solautoFeesSupplyTa);
132
+ const checkSolautoFeesDebtTa = usesAccount(client.solautoFeesDebtTa);
131
133
  const checkIntermediaryMfiAccount = client.lendingPlatform === generated_1.LendingPlatform.Marginfi &&
132
134
  usesAccount(client.intermediaryMarginfiAccountPk);
133
135
  const checkSignerSupplyTa = usesAccount(client.signerSupplyTa);
@@ -136,7 +138,7 @@ async function rebalanceChoresBefore(client, tx, accountsGettingCreated) {
136
138
  ...[
137
139
  checkReferralSupplyTa ? client.referredBySupplyTa() : web3_js_1.PublicKey.default,
138
140
  ],
139
- ...[checkSolautoFeesTa ? client.solautoFeesSupplyTa : web3_js_1.PublicKey.default],
141
+ ...[checkReferralDebtTa ? client.referredByDebtTa() : web3_js_1.PublicKey.default],
140
142
  ...[
141
143
  checkIntermediaryMfiAccount
142
144
  ? client.intermediaryMarginfiAccountPk
@@ -145,15 +147,15 @@ async function rebalanceChoresBefore(client, tx, accountsGettingCreated) {
145
147
  ...[checkSignerSupplyTa ? client.signerSupplyTa : web3_js_1.PublicKey.default],
146
148
  ...[checkSignerDebtTa ? client.signerDebtTa : web3_js_1.PublicKey.default],
147
149
  ];
148
- const [referredBySupplyTa, solautoFeesSupplyTa, intermediaryMarginfiAccount, signerSupplyTa, signerDebtTa,] = await client.umi.rpc.getAccounts(accountsNeeded.map((x) => (0, umi_1.publicKey)(x ?? web3_js_1.PublicKey.default)));
150
+ const [referredBySupplyTa, referredByDebtTa, intermediaryMarginfiAccount, signerSupplyTa, signerDebtTa,] = await client.umi.rpc.getAccounts(accountsNeeded.map((x) => (0, umi_1.publicKey)(x ?? web3_js_1.PublicKey.default)));
149
151
  let chores = (0, umi_1.transactionBuilder)();
150
152
  if (checkReferralSupplyTa && !(0, generalUtils_1.rpcAccountCreated)(referredBySupplyTa)) {
151
- client.log("Creating referred-by TA for ", client.supplyMint.toString());
153
+ client.log("Creating referred-by supply TA");
152
154
  chores = chores.add((0, solanaUtils_1.createAssociatedTokenAccountUmiIx)(client.signer, client.referredByState, client.supplyMint));
153
155
  }
154
- if (checkSolautoFeesTa && !(0, generalUtils_1.rpcAccountCreated)(solautoFeesSupplyTa)) {
155
- client.log("Creating Solauto fees TA for ", client.supplyMint.toString());
156
- chores = chores.add((0, solanaUtils_1.createAssociatedTokenAccountUmiIx)(client.signer, client.solautoFeesWallet, client.supplyMint));
156
+ if (checkReferralDebtTa && !(0, generalUtils_1.rpcAccountCreated)(referredByDebtTa)) {
157
+ client.log("Creating referred-by debt TA");
158
+ chores = chores.add((0, solanaUtils_1.createAssociatedTokenAccountUmiIx)(client.signer, client.referredByState, client.debtMint));
157
159
  }
158
160
  if (checkIntermediaryMfiAccount &&
159
161
  !(0, generalUtils_1.rpcAccountCreated)(intermediaryMarginfiAccount)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.219",
3
+ "version": "1.0.220",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "description": "Typescript SDK for the Solauto program on the Solana blockchain",
@@ -79,8 +79,8 @@ export abstract class SolautoClient extends ReferralStateManager {
79
79
  public positionDebtTa!: PublicKey;
80
80
  public signerDebtTa!: PublicKey;
81
81
 
82
- public solautoFeesWallet!: PublicKey;
83
82
  public solautoFeesSupplyTa!: PublicKey;
83
+ public solautoFeesDebtTa!: PublicKey;
84
84
 
85
85
  public authorityLutAddress?: PublicKey;
86
86
 
@@ -132,11 +132,14 @@ export abstract class SolautoClient extends ReferralStateManager {
132
132
  this.debtMint
133
133
  );
134
134
 
135
- this.solautoFeesWallet = SOLAUTO_FEES_WALLET;
136
135
  this.solautoFeesSupplyTa = getTokenAccount(
137
- this.solautoFeesWallet,
136
+ SOLAUTO_FEES_WALLET,
138
137
  this.supplyMint
139
138
  );
139
+ this.solautoFeesDebtTa = getTokenAccount(
140
+ SOLAUTO_FEES_WALLET,
141
+ this.debtMint
142
+ );
140
143
 
141
144
  this.authorityLutAddress =
142
145
  this.referralStateData?.lookupTable &&
@@ -166,6 +169,13 @@ export abstract class SolautoClient extends ReferralStateManager {
166
169
  }
167
170
  return undefined;
168
171
  }
172
+
173
+ referredByDebtTa(): PublicKey | undefined {
174
+ if (this.referredByState !== undefined) {
175
+ return getTokenAccount(this.referredByState, this.debtMint);
176
+ }
177
+ return undefined;
178
+ }
169
179
 
170
180
  async resetLiveTxUpdates(success?: boolean) {
171
181
  if (success) {
@@ -24,6 +24,7 @@ import {
24
24
  LendingPlatform,
25
25
  PositionState,
26
26
  PositionType,
27
+ RebalanceDirection,
27
28
  SolautoActionArgs,
28
29
  SolautoRebalanceTypeArgs,
29
30
  SolautoSettingsParametersInpArgs,
@@ -63,6 +64,7 @@ import {
63
64
  } from "../utils/marginfiUtils";
64
65
  import { bytesToI80F48, fromBaseUnit, toBps } from "../utils/numberUtils";
65
66
  import { QuoteResponse } from "@jup-ag/api";
67
+ import { SOLAUTO_FEES_WALLET } from "../constants";
66
68
 
67
69
  export interface SolautoMarginfiClientArgs extends SolautoClientArgs {
68
70
  marginfiAccount?: PublicKey | Signer;
@@ -479,11 +481,21 @@ export class SolautoMarginfiClient extends SolautoClient {
479
481
  signer: this.signer,
480
482
  marginfiProgram: publicKey(MARGINFI_PROGRAM_ID),
481
483
  ixsSysvar: publicKey(SYSVAR_INSTRUCTIONS_PUBKEY),
482
- solautoFeesSupplyTa:
483
- rebalanceStep === "B" ? publicKey(this.solautoFeesSupplyTa) : undefined,
484
+ solautoFeesTa:
485
+ rebalanceStep === "B"
486
+ ? publicKey(
487
+ rebalanceValues.rebalanceDirection === RebalanceDirection.Boost
488
+ ? this.solautoFeesSupplyTa
489
+ : this.solautoFeesDebtTa
490
+ )
491
+ : undefined,
484
492
  authorityReferralState: publicKey(this.referralState),
485
- referredBySupplyTa: this.referredBySupplyTa()
486
- ? publicKey(this.referredBySupplyTa()!)
493
+ referredByTa: this.referredByState
494
+ ? publicKey(
495
+ rebalanceValues.rebalanceDirection === RebalanceDirection.Boost
496
+ ? this.referredBySupplyTa()!
497
+ : this.referredByDebtTa()!
498
+ )
487
499
  : undefined,
488
500
  positionAuthority:
489
501
  rebalanceValues.rebalanceAction === "dca"
@@ -43,9 +43,9 @@ export type MarginfiRebalanceInstructionAccounts = {
43
43
  systemProgram?: PublicKey | Pda;
44
44
  tokenProgram?: PublicKey | Pda;
45
45
  ixsSysvar: PublicKey | Pda;
46
- solautoFeesSupplyTa?: PublicKey | Pda;
46
+ solautoFeesTa?: PublicKey | Pda;
47
47
  authorityReferralState: PublicKey | Pda;
48
- referredBySupplyTa?: PublicKey | Pda;
48
+ referredByTa?: PublicKey | Pda;
49
49
  positionAuthority?: PublicKey | Pda;
50
50
  solautoPosition: PublicKey | Pda;
51
51
  marginfiGroup: PublicKey | Pda;
@@ -146,20 +146,20 @@ export function marginfiRebalance(
146
146
  isWritable: false as boolean,
147
147
  value: input.ixsSysvar ?? null,
148
148
  },
149
- solautoFeesSupplyTa: {
149
+ solautoFeesTa: {
150
150
  index: 5,
151
151
  isWritable: true as boolean,
152
- value: input.solautoFeesSupplyTa ?? null,
152
+ value: input.solautoFeesTa ?? null,
153
153
  },
154
154
  authorityReferralState: {
155
155
  index: 6,
156
156
  isWritable: false as boolean,
157
157
  value: input.authorityReferralState ?? null,
158
158
  },
159
- referredBySupplyTa: {
159
+ referredByTa: {
160
160
  index: 7,
161
161
  isWritable: true as boolean,
162
- value: input.referredBySupplyTa ?? null,
162
+ value: input.referredByTa ?? null,
163
163
  },
164
164
  positionAuthority: {
165
165
  index: 8,
@@ -77,7 +77,7 @@ import {
77
77
  getJupiterErrorFromName,
78
78
  JUPITER_PROGRAM_ID,
79
79
  } from "../jupiter-sdk";
80
- import { PRICES } from "../constants";
80
+ import { PRICES, SOLAUTO_FEES_WALLET } from "../constants";
81
81
  import { TransactionItemInputs } from "../types";
82
82
 
83
83
  interface wSolTokenUsage {
@@ -276,7 +276,10 @@ export async function rebalanceChoresBefore(
276
276
 
277
277
  const checkReferralSupplyTa =
278
278
  client.referredBySupplyTa() && usesAccount(client.referredBySupplyTa()!);
279
- const checkSolautoFeesTa = usesAccount(client.solautoFeesSupplyTa);
279
+ const checkReferralDebtTa =
280
+ client.referredByDebtTa() && usesAccount(client.referredByDebtTa()!);
281
+ const checkSolautoFeesSupplyTa = usesAccount(client.solautoFeesSupplyTa);
282
+ const checkSolautoFeesDebtTa = usesAccount(client.solautoFeesDebtTa);
280
283
  const checkIntermediaryMfiAccount =
281
284
  client.lendingPlatform === LendingPlatform.Marginfi &&
282
285
  usesAccount(
@@ -289,7 +292,7 @@ export async function rebalanceChoresBefore(
289
292
  ...[
290
293
  checkReferralSupplyTa ? client.referredBySupplyTa() : PublicKey.default,
291
294
  ],
292
- ...[checkSolautoFeesTa ? client.solautoFeesSupplyTa : PublicKey.default],
295
+ ...[checkReferralDebtTa ? client.referredByDebtTa() : PublicKey.default],
293
296
  ...[
294
297
  checkIntermediaryMfiAccount
295
298
  ? (client as SolautoMarginfiClient).intermediaryMarginfiAccountPk
@@ -301,7 +304,7 @@ export async function rebalanceChoresBefore(
301
304
 
302
305
  const [
303
306
  referredBySupplyTa,
304
- solautoFeesSupplyTa,
307
+ referredByDebtTa,
305
308
  intermediaryMarginfiAccount,
306
309
  signerSupplyTa,
307
310
  signerDebtTa,
@@ -312,7 +315,7 @@ export async function rebalanceChoresBefore(
312
315
  let chores = transactionBuilder();
313
316
 
314
317
  if (checkReferralSupplyTa && !rpcAccountCreated(referredBySupplyTa)) {
315
- client.log("Creating referred-by TA for ", client.supplyMint.toString());
318
+ client.log("Creating referred-by supply TA");
316
319
  chores = chores.add(
317
320
  createAssociatedTokenAccountUmiIx(
318
321
  client.signer,
@@ -322,13 +325,13 @@ export async function rebalanceChoresBefore(
322
325
  );
323
326
  }
324
327
 
325
- if (checkSolautoFeesTa && !rpcAccountCreated(solautoFeesSupplyTa)) {
326
- client.log("Creating Solauto fees TA for ", client.supplyMint.toString());
328
+ if (checkReferralDebtTa && !rpcAccountCreated(referredByDebtTa)) {
329
+ client.log("Creating referred-by debt TA");
327
330
  chores = chores.add(
328
331
  createAssociatedTokenAccountUmiIx(
329
332
  client.signer,
330
- client.solautoFeesWallet,
331
- client.supplyMint
333
+ client.referredByState!,
334
+ client.debtMint
332
335
  )
333
336
  );
334
337
  }
@@ -25,10 +25,10 @@ import { buildHeliusApiUrl } from "../../src/utils";
25
25
  import { PriorityFeeSetting } from "../../src/types";
26
26
 
27
27
  describe("Solauto Marginfi tests", async () => {
28
- // const signer = setupTest();
29
- const signer = setupTest("solauto-manager");
28
+ const signer = setupTest();
29
+ // const signer = setupTest("solauto-manager");
30
30
 
31
- const payForTransactions = false;
31
+ const payForTransactions = true;
32
32
  const useJitoBundle = false;
33
33
  const positionId = 1;
34
34
 
@@ -128,7 +128,7 @@ describe("Solauto Marginfi tests", async () => {
128
128
  transactionItems.push(
129
129
  new TransactionItem(
130
130
  async (attemptNum) =>
131
- await buildSolautoRebalanceTransaction(client, undefined, attemptNum),
131
+ await buildSolautoRebalanceTransaction(client, 7000, attemptNum),
132
132
  "rebalance"
133
133
  )
134
134
  );
@@ -165,6 +165,6 @@ describe("Solauto Marginfi tests", async () => {
165
165
  undefined,
166
166
  !payForTransactions ? "only-simulate" : "normal",
167
167
  useJitoBundle,
168
- ).clientSend(transactionItems, PriorityFeeSetting.Default);
168
+ ).clientSend(transactionItems, PriorityFeeSetting.High);
169
169
  });
170
170
  });
@@ -22,17 +22,17 @@ describe("Assert lookup tables up-to-date", async () => {
22
22
 
23
23
  for (const group in MARGINFI_ACCOUNTS) {
24
24
  for (const key in MARGINFI_ACCOUNTS[group]) {
25
- if (key === DEFAULT_PUBKEY) {
25
+ if (key === PublicKey.default.toString()) {
26
26
  continue;
27
27
  }
28
28
 
29
- const tokenAccounts = MARGINFI_ACCOUNTS[key];
29
+ const accounts = MARGINFI_ACCOUNTS[group][key];
30
30
  const addresses = [
31
31
  new PublicKey(key),
32
- tokenAccounts.bank,
33
- tokenAccounts.liquidityVault,
34
- tokenAccounts.vaultAuthority,
35
- tokenAccounts.priceOracle,
32
+ accounts.bank,
33
+ accounts.liquidityVault,
34
+ accounts.vaultAuthority,
35
+ accounts.priceOracle,
36
36
  ];
37
37
 
38
38
  if (addresses.find((x) => !existingAccounts.includes(x.toString()))) {
@@ -37,6 +37,7 @@ import {
37
37
  safeGetPrice,
38
38
  } from "../../src/utils/generalUtils";
39
39
  import { USDC } from "../../src/constants/tokenConstants";
40
+ import { buildHeliusApiUrl } from "../../src/utils";
40
41
 
41
42
  const signer = setupTest(undefined, true);
42
43
 
@@ -108,7 +109,7 @@ async function getFakePosition(
108
109
  dca?: DCASettings
109
110
  ): Promise<SolautoClient> {
110
111
  const client = new SolautoMarginfiClient(
111
- process.env.HELIUS_API_KEY ?? "",
112
+ buildHeliusApiUrl(process.env.HELIUS_API_KEY!),
112
113
  true
113
114
  );
114
115
  await client.initialize({