@haven-fi/solauto-sdk 1.0.122 → 1.0.124

Sign up to get free protection for your applications and to get access to all the features.
@@ -62,7 +62,7 @@ export declare abstract class SolautoClient extends TxHandler {
62
62
  protocolInteraction(args: SolautoActionArgs): TransactionBuilder;
63
63
  abstract flashBorrow(flashLoanDetails: FlashLoanDetails, destinationTokenAccount: PublicKey): TransactionBuilder;
64
64
  abstract flashRepay(flashLoanDetails: FlashLoanDetails): TransactionBuilder;
65
- abstract rebalance(rebalanceStep: "A" | "B", swapDetails: JupSwapDetails, rebalanceType: SolautoRebalanceTypeArgs, flashLoan?: FlashLoanDetails, targetLiqUtilizationRateBps?: number, limitGapBps?: number): TransactionBuilder;
65
+ abstract rebalance(rebalanceStep: "A" | "B", swapDetails: JupSwapDetails, rebalanceType: SolautoRebalanceTypeArgs, slippageBps: number, flashLoan?: FlashLoanDetails, targetLiqUtilizationRateBps?: number, limitGapBps?: number): TransactionBuilder;
66
66
  getFreshPositionState(): Promise<PositionState | undefined>;
67
67
  }
68
68
  //# sourceMappingURL=solautoClient.d.ts.map
@@ -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,EAOnB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,aAAa,EAEd,MAAM,iDAAiD,CAAC;AACzD,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,wBAAwB,EACxB,yBAAyB,EACzB,gCAAgC,EAChC,sBAAsB,EAMvB,MAAM,cAAc,CAAC;AAOtB,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAKvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAMnE,OAAO,EAAE,mBAAm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E,gCAAgC,EAChD,GAAG,CAAC,EAAE,kBAAkB,GACvB,kBAAkB;IAuBrB,gBAAgB,CAAC,IAAI,EAAE,sBAAsB,GAAG,kBAAkB;IA2DlE,eAAe,IAAI,kBAAkB;IAYrC,WAAW,IAAI,kBAAkB;IA4BjC,QAAQ,CAAC,OAAO,IAAI,kBAAkB;IAEtC,mBAAmB,CAAC,IAAI,EAAE,iBAAiB,GAAG,kBAAkB;IAuFhE,QAAQ,CAAC,WAAW,CAClB,gBAAgB,EAAE,gBAAgB,EAClC,uBAAuB,EAAE,SAAS,GACjC,kBAAkB;IAErB,QAAQ,CAAC,UAAU,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,kBAAkB;IAE3E,QAAQ,CAAC,SAAS,CAChB,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;IAEf,qBAAqB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;CAalE"}
@@ -37,7 +37,7 @@ export declare class SolautoMarginfiClient extends SolautoClient {
37
37
  protocolInteraction(args: SolautoActionArgs): TransactionBuilder;
38
38
  private marginfiProtocolInteractionIx;
39
39
  private marginfiSolautoProtocolInteractionIx;
40
- rebalance(rebalanceStep: "A" | "B", swapDetails: JupSwapDetails, rebalanceType: SolautoRebalanceTypeArgs, flashLoan?: FlashLoanDetails, targetLiqUtilizationRateBps?: number, limitGapBps?: number): TransactionBuilder;
40
+ rebalance(rebalanceStep: "A" | "B", swapDetails: JupSwapDetails, rebalanceType: SolautoRebalanceTypeArgs, slippageBps: number, flashLoan?: FlashLoanDetails, targetLiqUtilizationRateBps?: number, limitGapBps?: number): TransactionBuilder;
41
41
  flashBorrow(flashLoanDetails: FlashLoanDetails, destinationTokenAccount: PublicKey): TransactionBuilder;
42
42
  flashRepay(flashLoanDetails: FlashLoanDetails): TransactionBuilder;
43
43
  createIntermediaryMarginfiAccount(): TransactionBuilder;
@@ -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,EACb,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;IA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S/C,YAAY,CACV,aAAa,CAAC,EAAE,gCAAgC,EAChD,GAAG,CAAC,EAAE,kBAAkB,GACvB,kBAAkB;IAMrB,OAAO,CAAC,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,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"}
@@ -269,7 +269,7 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
269
269
  solautoAction: args,
270
270
  });
271
271
  }
272
- rebalance(rebalanceStep, swapDetails, rebalanceType, flashLoan, targetLiqUtilizationRateBps, limitGapBps) {
272
+ rebalance(rebalanceStep, swapDetails, rebalanceType, slippageBps, flashLoan, targetLiqUtilizationRateBps, limitGapBps) {
273
273
  const inputIsSupply = swapDetails.inputMint.equals(this.supplyMint);
274
274
  const outputIsSupply = swapDetails.outputMint.equals(this.supplyMint);
275
275
  const needSupplyAccounts = (inputIsSupply && rebalanceStep === "A") ||
@@ -316,6 +316,7 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
316
316
  rebalanceType,
317
317
  targetLiqUtilizationRateBps: targetLiqUtilizationRateBps ?? null,
318
318
  limitGapBps: limitGapBps ?? null,
319
+ slippageBps: slippageBps ?? 0
319
320
  });
320
321
  }
321
322
  flashBorrow(flashLoanDetails, destinationTokenAccount) {
@@ -419,7 +420,7 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
419
420
  const supplyPrice = constants_1.PRICES[(freshState?.supply.mint ?? web3_js_1.PublicKey.default).toString()].price;
420
421
  const debtPrice = constants_1.PRICES[(freshState?.debt.mint ?? web3_js_1.PublicKey.default).toString()].price;
421
422
  console.log("Supply price: ", supplyPrice);
422
- console.log("Debt price: ", supplyPrice);
423
+ console.log("Debt price: ", debtPrice);
423
424
  console.log("Fresh state", freshState);
424
425
  console.log("Liq threshold bps:", freshState.liqUtilizationRateBps);
425
426
  console.log("Liq utilization rate bps:", freshState.liqUtilizationRateBps);
@@ -36,11 +36,13 @@ export type MarginfiRebalanceInstructionAccounts = {
36
36
  };
37
37
  export type MarginfiRebalanceInstructionData = {
38
38
  discriminator: number;
39
+ slippageBps: number;
39
40
  rebalanceType: SolautoRebalanceType;
40
41
  targetLiqUtilizationRateBps: Option<number>;
41
42
  limitGapBps: Option<number>;
42
43
  };
43
44
  export type MarginfiRebalanceInstructionDataArgs = {
45
+ slippageBps: number;
44
46
  rebalanceType: SolautoRebalanceTypeArgs;
45
47
  targetLiqUtilizationRateBps: OptionOrNullable<number>;
46
48
  limitGapBps: OptionOrNullable<number>;
@@ -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,MA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C;IACpC,2BAA2B,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IAC5C,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,oCAAoC,GAAG;IACjD,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,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,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,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,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,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AAE,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"}
@@ -16,6 +16,7 @@ const types_1 = require("../types");
16
16
  function getMarginfiRebalanceInstructionDataSerializer() {
17
17
  return (0, serializers_1.mapSerializer)((0, serializers_1.struct)([
18
18
  ['discriminator', (0, serializers_1.u8)()],
19
+ ['slippageBps', (0, serializers_1.u16)()],
19
20
  ['rebalanceType', (0, types_1.getSolautoRebalanceTypeSerializer)()],
20
21
  ['targetLiqUtilizationRateBps', (0, serializers_1.option)((0, serializers_1.u16)())],
21
22
  ['limitGapBps', (0, serializers_1.option)((0, serializers_1.u16)())],
@@ -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,EASd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAuMzD,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,aAAa,EACrB,EAAE,EAAE,kBAAkB,EACtB,sBAAsB,EAAE,MAAM,EAAE,GAC/B,OAAO,CAAC,kBAAkB,CAAC,CA+G7B;AAkLD,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,aAAa,EACrB,EAAE,EAAE,kBAAkB,GACrB,OAAO,CAAC,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAAC,CA4BnD;AAED,wBAAsB,gCAAgC,CACpD,MAAM,EAAE,aAAa,EACrB,2BAA2B,CAAC,EAAE,MAAM,EACpC,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC;IACT,EAAE,EAAE,kBAAkB,CAAC;IACvB,oBAAoB,EAAE,MAAM,EAAE,CAAC;CAChC,GACG,SAAS,CACZ,CAwHA;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,EASd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AA6MzD,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,CA4BnD;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,CA4HA;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"}
@@ -119,7 +119,9 @@ async function rebalanceChoresBefore(client, tx, accountsGettingCreated) {
119
119
  if (rebalanceInstructions.length === 0) {
120
120
  return (0, umi_1.transactionBuilder)();
121
121
  }
122
- const usesAccount = (key) => tx.getInstructions().some((t) => t.keys.some((k) => (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(k.pubkey).equals(key)));
122
+ const usesAccount = (key) => tx
123
+ .getInstructions()
124
+ .some((t) => t.keys.some((k) => (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(k.pubkey).equals(key)));
123
125
  const checkReferralSupplyTa = client.referredBySupplyTa && usesAccount(client.referredBySupplyTa);
124
126
  const checkSolautoFeesTa = usesAccount(client.solautoFeesSupplyTa);
125
127
  const checkIntermediaryMfiAccount = client.lendingPlatform === generated_1.LendingPlatform.Marginfi &&
@@ -182,6 +184,7 @@ function getRebalanceInstructions(tx) {
182
184
  try {
183
185
  const serializer = (0, generated_1.getMarginfiRebalanceInstructionDataSerializer)();
184
186
  const discriminator = serializer.serialize({
187
+ slippageBps: 0,
185
188
  limitGapBps: 0,
186
189
  rebalanceType: generated_1.SolautoRebalanceType.None,
187
190
  targetLiqUtilizationRateBps: 0,
@@ -346,11 +349,11 @@ async function buildSolautoRebalanceTransaction(client, targetLiqUtilizationRate
346
349
  client.flashBorrow(flashLoan, (0, accountUtils_1.getTokenAccount)((0, umi_web3js_adapters_1.toWeb3JsPublicKey)(client.signer.publicKey), swapDetails.inputMint)),
347
350
  ...(addFirstRebalance
348
351
  ? [
349
- client.rebalance("A", swapDetails, rebalanceType, flashLoan, targetLiqUtilizationRateBps),
352
+ client.rebalance("A", swapDetails, rebalanceType, jupQuote.slippageBps, flashLoan, targetLiqUtilizationRateBps),
350
353
  ]
351
354
  : []),
352
355
  swapIx,
353
- client.rebalance("B", swapDetails, rebalanceType, flashLoan, targetLiqUtilizationRateBps),
356
+ client.rebalance("B", swapDetails, rebalanceType, jupQuote.slippageBps, flashLoan, targetLiqUtilizationRateBps),
354
357
  client.flashRepay(flashLoan),
355
358
  ]);
356
359
  }
@@ -359,9 +362,9 @@ async function buildSolautoRebalanceTransaction(client, targetLiqUtilizationRate
359
362
  tx = tx.add([
360
363
  setupInstructions,
361
364
  tokenLedgerIx,
362
- client.rebalance("A", swapDetails, rebalanceType, undefined, targetLiqUtilizationRateBps),
365
+ client.rebalance("A", swapDetails, rebalanceType, jupQuote.slippageBps, undefined, targetLiqUtilizationRateBps),
363
366
  swapIx,
364
- client.rebalance("B", swapDetails, rebalanceType, undefined, targetLiqUtilizationRateBps),
367
+ client.rebalance("B", swapDetails, rebalanceType, jupQuote.slippageBps, undefined, targetLiqUtilizationRateBps),
365
368
  ]);
366
369
  }
367
370
  if (client.solautoPositionState.liqUtilizationRateBps >
@@ -41,7 +41,6 @@ declare class TransactionSet {
41
41
  export declare enum TransactionStatus {
42
42
  Skipped = "Skipped",
43
43
  Processing = "Processing",
44
- AwaitingSignature = "Awaiting Signature",
45
44
  Queued = "Queued",
46
45
  Successful = "Successful"
47
46
  }
@@ -1 +1 @@
1
- {"version":3,"file":"transactionsManager.d.ts","sourceRoot":"","sources":["../../src/transactions/transactionsManager.ts"],"names":[],"mappings":"AACA,OAAO,EACL,uBAAuB,EAEvB,kBAAkB,EAClB,GAAG,EACJ,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAKzD,OAAO,EACL,aAAa,EAEd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AA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,YAAY,EAAE,eAAe,EAAE,EAC/B,eAAe,CAAC,EAAE,kBAAkB;IA+EhC,IAAI,CACR,KAAK,EAAE,eAAe,EAAE,EACxB,eAAe,CAAC,EAAE,kBAAkB,EACpC,WAAW,CAAC,EAAE,OAAO;CA0GxB"}
@@ -111,7 +111,6 @@ var TransactionStatus;
111
111
  (function (TransactionStatus) {
112
112
  TransactionStatus["Skipped"] = "Skipped";
113
113
  TransactionStatus["Processing"] = "Processing";
114
- TransactionStatus["AwaitingSignature"] = "Awaiting Signature";
115
114
  TransactionStatus["Queued"] = "Queued";
116
115
  TransactionStatus["Successful"] = "Successful";
117
116
  })(TransactionStatus || (exports.TransactionStatus = TransactionStatus = {}));
@@ -198,7 +197,7 @@ class TransactionsManager {
198
197
  updateLookupTable.updateLutTx.getInstructions().length > 0 &&
199
198
  updateLookupTable?.needsToBeIsolated) {
200
199
  this.updateStatus(updateLutTxName, TransactionStatus.Processing);
201
- await (0, generalUtils_1.retryWithExponentialBackoff)(async (attemptNum) => await (0, solanaUtils_1.sendSingleOptimizedTransaction)(this.txHandler.umi, this.txHandler.connection, updateLookupTable.updateLutTx, this.txType, attemptNum, prioritySetting, () => this.updateStatus(updateLutTxName, TransactionStatus.AwaitingSignature)), 3, 150, this.errorsToThrow);
200
+ await (0, generalUtils_1.retryWithExponentialBackoff)(async (attemptNum) => await (0, solanaUtils_1.sendSingleOptimizedTransaction)(this.txHandler.umi, this.txHandler.connection, updateLookupTable.updateLutTx, this.txType, attemptNum, prioritySetting), 3, 150, this.errorsToThrow);
202
201
  this.updateStatus(updateLutTxName, TransactionStatus.Successful);
203
202
  }
204
203
  this.lookupTables.defaultLuts = client.defaultLookupTables();
@@ -296,7 +295,7 @@ class TransactionsManager {
296
295
  if (this.txHandler.localTest) {
297
296
  await this.debugAccounts(itemSet, tx);
298
297
  }
299
- const txSig = await (0, solanaUtils_1.sendSingleOptimizedTransaction)(this.txHandler.umi, this.txHandler.connection, tx, this.txType, attemptNum, prioritySetting, () => this.updateStatus(itemSet.name(), TransactionStatus.AwaitingSignature));
298
+ const txSig = await (0, solanaUtils_1.sendSingleOptimizedTransaction)(this.txHandler.umi, this.txHandler.connection, tx, this.txType, attemptNum, prioritySetting);
300
299
  this.updateStatus(itemSet.name(), TransactionStatus.Successful, txSig ? bs58_1.default.encode(txSig) : undefined);
301
300
  }
302
301
  }, 4, 150, this.errorsToThrow);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.122",
3
+ "version": "1.0.124",
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",
@@ -581,9 +581,10 @@ export abstract class SolautoClient extends TxHandler {
581
581
  rebalanceStep: "A" | "B",
582
582
  swapDetails: JupSwapDetails,
583
583
  rebalanceType: SolautoRebalanceTypeArgs,
584
+ slippageBps: number,
584
585
  flashLoan?: FlashLoanDetails,
585
586
  targetLiqUtilizationRateBps?: number,
586
- limitGapBps?: number
587
+ limitGapBps?: number,
587
588
  ): TransactionBuilder;
588
589
 
589
590
  async getFreshPositionState(): Promise<PositionState | undefined> {
@@ -427,9 +427,10 @@ export class SolautoMarginfiClient extends SolautoClient {
427
427
  rebalanceStep: "A" | "B",
428
428
  swapDetails: JupSwapDetails,
429
429
  rebalanceType: SolautoRebalanceTypeArgs,
430
+ slippageBps: number,
430
431
  flashLoan?: FlashLoanDetails,
431
432
  targetLiqUtilizationRateBps?: number,
432
- limitGapBps?: number
433
+ limitGapBps?: number,
433
434
  ): TransactionBuilder {
434
435
  const inputIsSupply = swapDetails.inputMint.equals(this.supplyMint);
435
436
  const outputIsSupply = swapDetails.outputMint.equals(this.supplyMint);
@@ -486,6 +487,7 @@ export class SolautoMarginfiClient extends SolautoClient {
486
487
  rebalanceType,
487
488
  targetLiqUtilizationRateBps: targetLiqUtilizationRateBps ?? null,
488
489
  limitGapBps: limitGapBps ?? null,
490
+ slippageBps: slippageBps ?? 0
489
491
  });
490
492
  }
491
493
 
@@ -630,7 +632,7 @@ export class SolautoMarginfiClient extends SolautoClient {
630
632
  const supplyPrice = PRICES[(freshState?.supply.mint ?? PublicKey.default).toString()].price;
631
633
  const debtPrice = PRICES[(freshState?.debt.mint ?? PublicKey.default).toString()].price;
632
634
  console.log("Supply price: ", supplyPrice);
633
- console.log("Debt price: ", supplyPrice);
635
+ console.log("Debt price: ", debtPrice);
634
636
  console.log("Fresh state", freshState);
635
637
  console.log("Liq threshold bps:", freshState.liqUtilizationRateBps);
636
638
  console.log("Liq utilization rate bps:", freshState.liqUtilizationRateBps);
@@ -66,12 +66,14 @@ export type MarginfiRebalanceInstructionAccounts = {
66
66
  // Data.
67
67
  export type MarginfiRebalanceInstructionData = {
68
68
  discriminator: number;
69
+ slippageBps: number;
69
70
  rebalanceType: SolautoRebalanceType;
70
71
  targetLiqUtilizationRateBps: Option<number>;
71
72
  limitGapBps: Option<number>;
72
73
  };
73
74
 
74
75
  export type MarginfiRebalanceInstructionDataArgs = {
76
+ slippageBps: number;
75
77
  rebalanceType: SolautoRebalanceTypeArgs;
76
78
  targetLiqUtilizationRateBps: OptionOrNullable<number>;
77
79
  limitGapBps: OptionOrNullable<number>;
@@ -89,6 +91,7 @@ export function getMarginfiRebalanceInstructionDataSerializer(): Serializer<
89
91
  struct<MarginfiRebalanceInstructionData>(
90
92
  [
91
93
  ['discriminator', u8()],
94
+ ['slippageBps', u16()],
92
95
  ['rebalanceType', getSolautoRebalanceTypeSerializer()],
93
96
  ['targetLiqUtilizationRateBps', option(u16())],
94
97
  ['limitGapBps', option(u16())],
@@ -111,12 +111,18 @@ async function transactionChoresBefore(
111
111
  client.referralStateManager.referralStateData === null ||
112
112
  (client.referredByState !== undefined &&
113
113
  client.referralStateManager.referralStateData?.referredByState ===
114
- publicKey(PublicKey.default)) ||
114
+ publicKey(PublicKey.default)) ||
115
115
  (client.authorityLutAddress !== undefined &&
116
116
  client.referralStateManager.referralStateData!.lookupTable ==
117
- publicKey(PublicKey.default))
117
+ publicKey(PublicKey.default))
118
118
  ) {
119
- chores = chores.add(client.referralStateManager.updateReferralStatesIx(undefined, client.referredByAuthority, client.authorityLutAddress));
119
+ chores = chores.add(
120
+ client.referralStateManager.updateReferralStatesIx(
121
+ undefined,
122
+ client.referredByAuthority,
123
+ client.authorityLutAddress
124
+ )
125
+ );
120
126
  }
121
127
 
122
128
  if (client.selfManaged) {
@@ -233,10 +239,10 @@ export async function rebalanceChoresBefore(
233
239
  }
234
240
 
235
241
  const usesAccount = (key: PublicKey) =>
236
- tx.getInstructions().some((t) =>
237
- t.keys.some((k) => toWeb3JsPublicKey(k.pubkey).equals(key))
238
- );
239
-
242
+ tx
243
+ .getInstructions()
244
+ .some((t) => t.keys.some((k) => toWeb3JsPublicKey(k.pubkey).equals(key)));
245
+
240
246
  const checkReferralSupplyTa =
241
247
  client.referredBySupplyTa && usesAccount(client.referredBySupplyTa);
242
248
  const checkSolautoFeesTa = usesAccount(client.solautoFeesSupplyTa);
@@ -371,6 +377,7 @@ function getRebalanceInstructions(tx: TransactionBuilder): Instruction[] {
371
377
  try {
372
378
  const serializer = getMarginfiRebalanceInstructionDataSerializer();
373
379
  const discriminator = serializer.serialize({
380
+ slippageBps: 0,
374
381
  limitGapBps: 0,
375
382
  rebalanceType: SolautoRebalanceType.None,
376
383
  targetLiqUtilizationRateBps: 0,
@@ -379,7 +386,7 @@ function getRebalanceInstructions(tx: TransactionBuilder): Instruction[] {
379
386
  if (data.discriminator === discriminator) {
380
387
  return true;
381
388
  }
382
- } catch { }
389
+ } catch {}
383
390
  return false;
384
391
  }
385
392
  });
@@ -400,7 +407,7 @@ function getSolautoActions(tx: TransactionBuilder): SolautoAction[] {
400
407
  if (data.discriminator === discriminator) {
401
408
  solautoActions?.push(data.solautoAction);
402
409
  }
403
- } catch { }
410
+ } catch {}
404
411
  }
405
412
 
406
413
  if (x.programId === MARGINFI_PROGRAM_ID) {
@@ -423,7 +430,7 @@ function getSolautoActions(tx: TransactionBuilder): SolautoAction[] {
423
430
  fields: [data.amount],
424
431
  });
425
432
  }
426
- } catch { }
433
+ } catch {}
427
434
 
428
435
  try {
429
436
  const serializer = getLendingAccountBorrowInstructionDataSerializer();
@@ -444,7 +451,7 @@ function getSolautoActions(tx: TransactionBuilder): SolautoAction[] {
444
451
  fields: [data.amount],
445
452
  });
446
453
  }
447
- } catch { }
454
+ } catch {}
448
455
 
449
456
  try {
450
457
  const serializer = getLendingAccountWithdrawInstructionDataSerializer();
@@ -466,16 +473,16 @@ function getSolautoActions(tx: TransactionBuilder): SolautoAction[] {
466
473
  fields: [
467
474
  data.withdrawAll
468
475
  ? {
469
- __kind: "All",
470
- }
476
+ __kind: "All",
477
+ }
471
478
  : {
472
- __kind: "Some",
473
- fields: [data.amount],
474
- },
479
+ __kind: "Some",
480
+ fields: [data.amount],
481
+ },
475
482
  ],
476
483
  });
477
484
  }
478
- } catch { }
485
+ } catch {}
479
486
 
480
487
  try {
481
488
  const serializer = getLendingAccountRepayInstructionDataSerializer();
@@ -497,16 +504,16 @@ function getSolautoActions(tx: TransactionBuilder): SolautoAction[] {
497
504
  fields: [
498
505
  data.repayAll
499
506
  ? {
500
- __kind: "All",
501
- }
507
+ __kind: "All",
508
+ }
502
509
  : {
503
- __kind: "Some",
504
- fields: [data.amount],
505
- },
510
+ __kind: "Some",
511
+ fields: [data.amount],
512
+ },
506
513
  ],
507
514
  });
508
515
  }
509
- } catch { }
516
+ } catch {}
510
517
  }
511
518
 
512
519
  // TODO support other platforms
@@ -552,10 +559,11 @@ export async function buildSolautoRebalanceTransaction(
552
559
  client: SolautoClient,
553
560
  targetLiqUtilizationRateBps?: number,
554
561
  attemptNum?: number
555
- ): Promise<{
556
- tx: TransactionBuilder;
557
- lookupTableAddresses: string[];
558
- }
562
+ ): Promise<
563
+ | {
564
+ tx: TransactionBuilder;
565
+ lookupTableAddresses: string[];
566
+ }
559
567
  | undefined
560
568
  > {
561
569
  client.solautoPositionState = await client.getFreshPositionState();
@@ -620,20 +628,22 @@ export async function buildSolautoRebalanceTransaction(
620
628
  ),
621
629
  ...(addFirstRebalance
622
630
  ? [
623
- client.rebalance(
624
- "A",
625
- swapDetails,
626
- rebalanceType,
627
- flashLoan,
628
- targetLiqUtilizationRateBps
629
- ),
630
- ]
631
+ client.rebalance(
632
+ "A",
633
+ swapDetails,
634
+ rebalanceType,
635
+ jupQuote.slippageBps,
636
+ flashLoan,
637
+ targetLiqUtilizationRateBps
638
+ ),
639
+ ]
631
640
  : []),
632
641
  swapIx,
633
642
  client.rebalance(
634
643
  "B",
635
644
  swapDetails,
636
645
  rebalanceType,
646
+ jupQuote.slippageBps,
637
647
  flashLoan,
638
648
  targetLiqUtilizationRateBps
639
649
  ),
@@ -648,6 +658,7 @@ export async function buildSolautoRebalanceTransaction(
648
658
  "A",
649
659
  swapDetails,
650
660
  rebalanceType,
661
+ jupQuote.slippageBps,
651
662
  undefined,
652
663
  targetLiqUtilizationRateBps
653
664
  ),
@@ -656,6 +667,7 @@ export async function buildSolautoRebalanceTransaction(
656
667
  "B",
657
668
  swapDetails,
658
669
  rebalanceType,
670
+ jupQuote.slippageBps,
659
671
  undefined,
660
672
  targetLiqUtilizationRateBps
661
673
  ),
@@ -166,7 +166,6 @@ class TransactionSet {
166
166
  export enum TransactionStatus {
167
167
  Skipped = "Skipped",
168
168
  Processing = "Processing",
169
- AwaitingSignature = "Awaiting Signature",
170
169
  Queued = "Queued",
171
170
  Successful = "Successful",
172
171
  }
@@ -294,12 +293,7 @@ export class TransactionsManager {
294
293
  updateLookupTable.updateLutTx,
295
294
  this.txType,
296
295
  attemptNum,
297
- prioritySetting,
298
- () =>
299
- this.updateStatus(
300
- updateLutTxName,
301
- TransactionStatus.AwaitingSignature
302
- )
296
+ prioritySetting
303
297
  ),
304
298
  3,
305
299
  150,
@@ -450,12 +444,7 @@ export class TransactionsManager {
450
444
  tx,
451
445
  this.txType,
452
446
  attemptNum,
453
- prioritySetting,
454
- () =>
455
- this.updateStatus(
456
- itemSet!.name(),
457
- TransactionStatus.AwaitingSignature
458
- )
447
+ prioritySetting
459
448
  );
460
449
  this.updateStatus(
461
450
  itemSet.name(),