@haven-fi/solauto-sdk 1.0.150 → 1.0.152

Sign up to get free protection for your applications and to get access to all the features.
@@ -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,OAAO,EAAE,SAAS,EAA8B,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAM1D,OAAO,EACL,kBAAkB,EAElB,aAAa,EAEb,iBAAiB,EACjB,wBAAwB,EACxB,gCAAgC,EAKjC,MAAM,cAAc,CAAC;AAGtB,OAAO,EAEL,eAAe,EAUhB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAWnE,MAAM,WAAW,yBAA0B,SAAQ,iBAAiB;IAClE,eAAe,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IACrC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,aAAa,CAAC,EAAE,SAAS,CAAC;CAC3B;AAED,qBAAa,qBAAsB,SAAQ,aAAa;IACtD,OAAO,CAAC,WAAW,CAAkB;IAE9B,eAAe,EAAG,SAAS,CAAC;IAE5B,sBAAsB,EAAE,MAAM,CAAa;IAC3C,eAAe,EAAG,SAAS,GAAG,MAAM,CAAC;IACrC,iBAAiB,EAAG,SAAS,CAAC;IAC9B,aAAa,EAAG,SAAS,CAAC;IAE1B,sBAAsB,EAAG,qBAAqB,CAAC;IAC/C,oBAAoB,EAAG,qBAAqB,CAAC;IAE7C,iBAAiB,EAAG,SAAS,CAAC;IAC9B,eAAe,EAAG,SAAS,CAAC;IAG5B,iCAAiC,CAAC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AC,EAAE,gCAAgC,EAChD,GAAG,CAAC,EAAE,kBAAkB,GACvB,kBAAkB;IAMrB,OAAO,CAAC,sBAAsB;IA+C9B,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,WAAW,EAAE,cAAc,EAC3B,aAAa,EAAE,wBAAwB,EACvC,WAAW,EAAE,MAAM,EACnB,SAAS,CAAC,EAAE,gBAAgB,EAC5B,2BAA2B,CAAC,EAAE,MAAM,EACpC,WAAW,CAAC,EAAE,MAAM,GACnB,kBAAkB;IA4DrB,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;CA4BlE"}
@@ -287,6 +287,7 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
287
287
  referredBySupplyTa: this.referredBySupplyTa
288
288
  ? (0, umi_1.publicKey)(this.referredBySupplyTa)
289
289
  : undefined,
290
+ positionAuthority: (0, umi_1.publicKey)(this.authority),
290
291
  solautoPosition: (0, umi_1.publicKey)(this.solautoPosition),
291
292
  marginfiGroup: (0, umi_1.publicKey)(this.marginfiGroup),
292
293
  marginfiAccount: (0, umi_1.publicKey)(this.marginfiAccountPk),
@@ -313,6 +314,7 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
313
314
  : undefined,
314
315
  rebalanceType,
315
316
  targetLiqUtilizationRateBps: targetLiqUtilizationRateBps ?? null,
317
+ targetInAmountBaseUnit: targetLiqUtilizationRateBps ? swapDetails.amount : null,
316
318
  limitGapBps: limitGapBps ?? null,
317
319
  slippageBps: slippageBps ?? 0
318
320
  });
@@ -17,6 +17,7 @@ export type MarginfiRebalanceInstructionAccounts = {
17
17
  solautoFeesSupplyTa?: PublicKey | Pda;
18
18
  authorityReferralState: PublicKey | Pda;
19
19
  referredBySupplyTa?: PublicKey | Pda;
20
+ positionAuthority: PublicKey | Pda;
20
21
  solautoPosition: PublicKey | Pda;
21
22
  marginfiGroup: PublicKey | Pda;
22
23
  marginfiAccount: PublicKey | Pda;
@@ -39,12 +40,14 @@ export type MarginfiRebalanceInstructionData = {
39
40
  slippageBps: number;
40
41
  rebalanceType: SolautoRebalanceType;
41
42
  targetLiqUtilizationRateBps: Option<number>;
43
+ targetInAmountBaseUnit: Option<bigint>;
42
44
  limitGapBps: Option<number>;
43
45
  };
44
46
  export type MarginfiRebalanceInstructionDataArgs = {
45
47
  slippageBps: number;
46
48
  rebalanceType: SolautoRebalanceTypeArgs;
47
49
  targetLiqUtilizationRateBps: OptionOrNullable<number>;
50
+ targetInAmountBaseUnit: OptionOrNullable<number | bigint>;
48
51
  limitGapBps: OptionOrNullable<number>;
49
52
  };
50
53
  export declare function getMarginfiRebalanceInstructionDataSerializer(): Serializer<MarginfiRebalanceInstructionDataArgs, MarginfiRebalanceInstructionData>;
@@ -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,EAMX,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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C;IAC5C,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,oCAAoC,GAAG;IACjD,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,wBAAwB,CAAC;IACxC,2BAA2B,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACtD,WAAW,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;CACvC,CAAC;AAEF,wBAAgB,6CAA6C,IAAI,UAAU,CACzE,oCAAoC,EACpC,gCAAgC,CACjC,CAqBA;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,CA6KpB"}
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,CA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wB,CAAC;IACxC,2BAA2B,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACtD,sBAAsB,EAAE,gBAAgB,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAC1D,WAAW,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;CACvC,CAAC;AAEF,wBAAgB,6CAA6C,IAAI,UAAU,CACzE,oCAAoC,EACpC,gCAAgC,CACjC,CAsBA;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"}
@@ -19,6 +19,7 @@ function getMarginfiRebalanceInstructionDataSerializer() {
19
19
  ['slippageBps', (0, serializers_1.u16)()],
20
20
  ['rebalanceType', (0, types_1.getSolautoRebalanceTypeSerializer)()],
21
21
  ['targetLiqUtilizationRateBps', (0, serializers_1.option)((0, serializers_1.u16)())],
22
+ ['targetInAmountBaseUnit', (0, serializers_1.option)((0, serializers_1.u64)())],
22
23
  ['limitGapBps', (0, serializers_1.option)((0, serializers_1.u16)())],
23
24
  ], { description: 'MarginfiRebalanceInstructionData' }), (value) => ({ ...value, discriminator: 9 }));
24
25
  }
@@ -68,83 +69,88 @@ function marginfiRebalance(context, input) {
68
69
  isWritable: true,
69
70
  value: input.referredBySupplyTa ?? null,
70
71
  },
71
- solautoPosition: {
72
+ positionAuthority: {
72
73
  index: 8,
73
74
  isWritable: true,
75
+ value: input.positionAuthority ?? null,
76
+ },
77
+ solautoPosition: {
78
+ index: 9,
79
+ isWritable: true,
74
80
  value: input.solautoPosition ?? null,
75
81
  },
76
82
  marginfiGroup: {
77
- index: 9,
83
+ index: 10,
78
84
  isWritable: false,
79
85
  value: input.marginfiGroup ?? null,
80
86
  },
81
87
  marginfiAccount: {
82
- index: 10,
88
+ index: 11,
83
89
  isWritable: true,
84
90
  value: input.marginfiAccount ?? null,
85
91
  },
86
92
  intermediaryTa: {
87
- index: 11,
93
+ index: 12,
88
94
  isWritable: true,
89
95
  value: input.intermediaryTa ?? null,
90
96
  },
91
97
  supplyBank: {
92
- index: 12,
98
+ index: 13,
93
99
  isWritable: true,
94
100
  value: input.supplyBank ?? null,
95
101
  },
96
102
  supplyPriceOracle: {
97
- index: 13,
103
+ index: 14,
98
104
  isWritable: false,
99
105
  value: input.supplyPriceOracle ?? null,
100
106
  },
101
107
  positionSupplyTa: {
102
- index: 14,
108
+ index: 15,
103
109
  isWritable: true,
104
110
  value: input.positionSupplyTa ?? null,
105
111
  },
106
112
  authoritySupplyTa: {
107
- index: 15,
113
+ index: 16,
108
114
  isWritable: true,
109
115
  value: input.authoritySupplyTa ?? null,
110
116
  },
111
117
  vaultSupplyTa: {
112
- index: 16,
118
+ index: 17,
113
119
  isWritable: true,
114
120
  value: input.vaultSupplyTa ?? null,
115
121
  },
116
122
  supplyVaultAuthority: {
117
- index: 17,
123
+ index: 18,
118
124
  isWritable: true,
119
125
  value: input.supplyVaultAuthority ?? null,
120
126
  },
121
127
  debtBank: {
122
- index: 18,
128
+ index: 19,
123
129
  isWritable: true,
124
130
  value: input.debtBank ?? null,
125
131
  },
126
132
  debtPriceOracle: {
127
- index: 19,
133
+ index: 20,
128
134
  isWritable: false,
129
135
  value: input.debtPriceOracle ?? null,
130
136
  },
131
137
  positionDebtTa: {
132
- index: 20,
138
+ index: 21,
133
139
  isWritable: true,
134
140
  value: input.positionDebtTa ?? null,
135
141
  },
136
142
  authorityDebtTa: {
137
- index: 21,
143
+ index: 22,
138
144
  isWritable: true,
139
145
  value: input.authorityDebtTa ?? null,
140
146
  },
141
147
  vaultDebtTa: {
142
- index: 22,
148
+ index: 23,
143
149
  isWritable: true,
144
150
  value: input.vaultDebtTa ?? null,
145
151
  },
146
152
  debtVaultAuthority: {
147
- index: 23,
153
+ index: 24,
148
154
  isWritable: true,
149
155
  value: input.debtVaultAuthority ?? null,
150
156
  },
@@ -1 +1 @@
1
- {"version":3,"file":"transactionUtils.d.ts","sourceRoot":"","sources":["../../src/transactions/transactionUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,kBAAkB,EAClB,GAAG,EAGJ,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,SAAS,EAA8B,MAAM,iBAAiB,CAAC;AAKxE,OAAO,EAEL,aAAa,EAUd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAyNzD,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,aAAa,EACrB,EAAE,EAAE,kBAAkB,EACtB,sBAAsB,EAAE,MAAM,EAAE,GAC/B,OAAO,CAAC,kBAAkB,CAAC,CA+G7B;AAmLD,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,aAAa,EACrB,EAAE,EAAE,kBAAkB,GACrB,OAAO,CAAC,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAAC,CA0BnD;AAED,wBAAsB,gCAAgC,CACpD,MAAM,EAAE,aAAa,EACrB,2BAA2B,CAAC,EAAE,MAAM,EACpC,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CACN;IACE,EAAE,EAAE,kBAAkB,CAAC;IACvB,oBAAoB,EAAE,MAAM,EAAE,CAAC;CAChC,GACD,SAAS,CACZ,CA6HA;AAED,wBAAsB,gCAAgC,CACpD,GAAG,EAAE,GAAG,EACR,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,SAAS,GACtB,OAAO,CAAC,CAAC,kBAAkB,EAAE,MAAM,EAAE,CAAC,GAAG,SAAS,CAAC,CAmCrD"}
1
+ {"version":3,"file":"transactionUtils.d.ts","sourceRoot":"","sources":["../../src/transactions/transactionUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,kBAAkB,EAClB,GAAG,EAGJ,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,SAAS,EAA8B,MAAM,iBAAiB,CAAC;AAKxE,OAAO,EAEL,aAAa,EAUd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAyNzD,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,aAAa,EACrB,EAAE,EAAE,kBAAkB,EACtB,sBAAsB,EAAE,MAAM,EAAE,GAC/B,OAAO,CAAC,kBAAkB,CAAC,CA+G7B;AAoLD,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,aAAa,EACrB,EAAE,EAAE,kBAAkB,GACrB,OAAO,CAAC,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAAC,CA0BnD;AAED,wBAAsB,gCAAgC,CACpD,MAAM,EAAE,aAAa,EACrB,2BAA2B,CAAC,EAAE,MAAM,EACpC,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CACN;IACE,EAAE,EAAE,kBAAkB,CAAC;IACvB,oBAAoB,EAAE,MAAM,EAAE,CAAC;CAChC,GACD,SAAS,CACZ,CA6HA;AAED,wBAAsB,gCAAgC,CACpD,GAAG,EAAE,GAAG,EACR,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,SAAS,GACtB,OAAO,CAAC,CAAC,kBAAkB,EAAE,MAAM,EAAE,CAAC,GAAG,SAAS,CAAC,CAmCrD"}
@@ -187,6 +187,7 @@ function getRebalanceInstructions(tx) {
187
187
  const discriminator = serializer.serialize({
188
188
  slippageBps: 0,
189
189
  limitGapBps: 0,
190
+ targetInAmountBaseUnit: 0,
190
191
  rebalanceType: generated_1.SolautoRebalanceType.None,
191
192
  targetLiqUtilizationRateBps: 0,
192
193
  })[0];
@@ -22,10 +22,10 @@ function getStandardTargetLiqUtilizationRateBps(state, settings) {
22
22
  const adjustedSettings = (0, generalUtils_1.getAdjustedSettingsFromAutomation)(settings, (0, generalUtils_2.currentUnixSeconds)());
23
23
  const repayFrom = settings.repayToBps + settings.repayGap;
24
24
  const boostFrom = adjustedSettings.boostToBps - settings.boostGap;
25
- if (state.liqUtilizationRateBps < boostFrom) {
25
+ if (state.liqUtilizationRateBps <= boostFrom) {
26
26
  return adjustedSettings.boostToBps;
27
27
  }
28
- else if (state.liqUtilizationRateBps > repayFrom) {
28
+ else if (state.liqUtilizationRateBps >= repayFrom) {
29
29
  return adjustedSettings.repayToBps;
30
30
  }
31
31
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.150",
3
+ "version": "1.0.152",
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",
@@ -457,6 +457,7 @@ export class SolautoMarginfiClient extends SolautoClient {
457
457
  referredBySupplyTa: this.referredBySupplyTa
458
458
  ? publicKey(this.referredBySupplyTa)
459
459
  : undefined,
460
+ positionAuthority: publicKey(this.authority),
460
461
  solautoPosition: publicKey(this.solautoPosition),
461
462
  marginfiGroup: publicKey(this.marginfiGroup),
462
463
  marginfiAccount: publicKey(this.marginfiAccountPk),
@@ -488,6 +489,7 @@ export class SolautoMarginfiClient extends SolautoClient {
488
489
  : undefined,
489
490
  rebalanceType,
490
491
  targetLiqUtilizationRateBps: targetLiqUtilizationRateBps ?? null,
492
+ targetInAmountBaseUnit: targetLiqUtilizationRateBps ? swapDetails.amount : null,
491
493
  limitGapBps: limitGapBps ?? null,
492
494
  slippageBps: slippageBps ?? 0
493
495
  });
@@ -22,6 +22,7 @@ import {
22
22
  option,
23
23
  struct,
24
24
  u16,
25
+ u64,
25
26
  u8,
26
27
  } from '@metaplex-foundation/umi/serializers';
27
28
  import {
@@ -45,6 +46,7 @@ export type MarginfiRebalanceInstructionAccounts = {
45
46
  solautoFeesSupplyTa?: PublicKey | Pda;
46
47
  authorityReferralState: PublicKey | Pda;
47
48
  referredBySupplyTa?: PublicKey | Pda;
49
+ positionAuthority: PublicKey | Pda;
48
50
  solautoPosition: PublicKey | Pda;
49
51
  marginfiGroup: PublicKey | Pda;
50
52
  marginfiAccount: PublicKey | Pda;
@@ -69,6 +71,7 @@ export type MarginfiRebalanceInstructionData = {
69
71
  slippageBps: number;
70
72
  rebalanceType: SolautoRebalanceType;
71
73
  targetLiqUtilizationRateBps: Option<number>;
74
+ targetInAmountBaseUnit: Option<bigint>;
72
75
  limitGapBps: Option<number>;
73
76
  };
74
77
 
@@ -76,6 +79,7 @@ export type MarginfiRebalanceInstructionDataArgs = {
76
79
  slippageBps: number;
77
80
  rebalanceType: SolautoRebalanceTypeArgs;
78
81
  targetLiqUtilizationRateBps: OptionOrNullable<number>;
82
+ targetInAmountBaseUnit: OptionOrNullable<number | bigint>;
79
83
  limitGapBps: OptionOrNullable<number>;
80
84
  };
81
85
 
@@ -94,6 +98,7 @@ export function getMarginfiRebalanceInstructionDataSerializer(): Serializer<
94
98
  ['slippageBps', u16()],
95
99
  ['rebalanceType', getSolautoRebalanceTypeSerializer()],
96
100
  ['targetLiqUtilizationRateBps', option(u16())],
101
+ ['targetInAmountBaseUnit', option(u64())],
97
102
  ['limitGapBps', option(u16())],
98
103
  ],
99
104
  { description: 'MarginfiRebalanceInstructionData' }
@@ -162,83 +167,88 @@ export function marginfiRebalance(
162
167
  isWritable: true as boolean,
163
168
  value: input.referredBySupplyTa ?? null,
164
169
  },
165
- solautoPosition: {
170
+ positionAuthority: {
166
171
  index: 8,
167
172
  isWritable: true as boolean,
173
+ value: input.positionAuthority ?? null,
174
+ },
175
+ solautoPosition: {
176
+ index: 9,
177
+ isWritable: true as boolean,
168
178
  value: input.solautoPosition ?? null,
169
179
  },
170
180
  marginfiGroup: {
171
- index: 9,
181
+ index: 10,
172
182
  isWritable: false as boolean,
173
183
  value: input.marginfiGroup ?? null,
174
184
  },
175
185
  marginfiAccount: {
176
- index: 10,
186
+ index: 11,
177
187
  isWritable: true as boolean,
178
188
  value: input.marginfiAccount ?? null,
179
189
  },
180
190
  intermediaryTa: {
181
- index: 11,
191
+ index: 12,
182
192
  isWritable: true as boolean,
183
193
  value: input.intermediaryTa ?? null,
184
194
  },
185
195
  supplyBank: {
186
- index: 12,
196
+ index: 13,
187
197
  isWritable: true as boolean,
188
198
  value: input.supplyBank ?? null,
189
199
  },
190
200
  supplyPriceOracle: {
191
- index: 13,
201
+ index: 14,
192
202
  isWritable: false as boolean,
193
203
  value: input.supplyPriceOracle ?? null,
194
204
  },
195
205
  positionSupplyTa: {
196
- index: 14,
206
+ index: 15,
197
207
  isWritable: true as boolean,
198
208
  value: input.positionSupplyTa ?? null,
199
209
  },
200
210
  authoritySupplyTa: {
201
- index: 15,
211
+ index: 16,
202
212
  isWritable: true as boolean,
203
213
  value: input.authoritySupplyTa ?? null,
204
214
  },
205
215
  vaultSupplyTa: {
206
- index: 16,
216
+ index: 17,
207
217
  isWritable: true as boolean,
208
218
  value: input.vaultSupplyTa ?? null,
209
219
  },
210
220
  supplyVaultAuthority: {
211
- index: 17,
221
+ index: 18,
212
222
  isWritable: true as boolean,
213
223
  value: input.supplyVaultAuthority ?? null,
214
224
  },
215
225
  debtBank: {
216
- index: 18,
226
+ index: 19,
217
227
  isWritable: true as boolean,
218
228
  value: input.debtBank ?? null,
219
229
  },
220
230
  debtPriceOracle: {
221
- index: 19,
231
+ index: 20,
222
232
  isWritable: false as boolean,
223
233
  value: input.debtPriceOracle ?? null,
224
234
  },
225
235
  positionDebtTa: {
226
- index: 20,
236
+ index: 21,
227
237
  isWritable: true as boolean,
228
238
  value: input.positionDebtTa ?? null,
229
239
  },
230
240
  authorityDebtTa: {
231
- index: 21,
241
+ index: 22,
232
242
  isWritable: true as boolean,
233
243
  value: input.authorityDebtTa ?? null,
234
244
  },
235
245
  vaultDebtTa: {
236
- index: 22,
246
+ index: 23,
237
247
  isWritable: true as boolean,
238
248
  value: input.vaultDebtTa ?? null,
239
249
  },
240
250
  debtVaultAuthority: {
241
- index: 23,
251
+ index: 24,
242
252
  isWritable: true as boolean,
243
253
  value: input.debtVaultAuthority ?? null,
244
254
  },
@@ -392,6 +392,7 @@ function getRebalanceInstructions(tx: TransactionBuilder): Instruction[] {
392
392
  const discriminator = serializer.serialize({
393
393
  slippageBps: 0,
394
394
  limitGapBps: 0,
395
+ targetInAmountBaseUnit: 0,
395
396
  rebalanceType: SolautoRebalanceType.None,
396
397
  targetLiqUtilizationRateBps: 0,
397
398
  })[0];
@@ -58,9 +58,9 @@ function getStandardTargetLiqUtilizationRateBps(
58
58
  const repayFrom = settings.repayToBps + settings.repayGap;
59
59
  const boostFrom = adjustedSettings.boostToBps - settings.boostGap;
60
60
 
61
- if (state.liqUtilizationRateBps < boostFrom) {
61
+ if (state.liqUtilizationRateBps <= boostFrom) {
62
62
  return adjustedSettings.boostToBps;
63
- } else if (state.liqUtilizationRateBps > repayFrom) {
63
+ } else if (state.liqUtilizationRateBps >= repayFrom) {
64
64
  return adjustedSettings.repayToBps;
65
65
  } else {
66
66
  throw new Error("Invalid rebalance condition");