@gearbox-protocol/sdk 14.12.0-next.72 → 14.12.0-next.74

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.
Files changed (67) hide show
  1. package/dist/cjs/dev/AccountOpener.js +2 -5
  2. package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +49 -533
  3. package/dist/cjs/sdk/accounts/index.js +0 -4
  4. package/dist/cjs/sdk/accounts/intents/operations/unwrap-rwa-collateral/index.js +1 -1
  5. package/dist/cjs/sdk/accounts/intents/operations/wrap-rwa-collateral/index.js +1 -1
  6. package/dist/cjs/sdk/accounts/intents/testing/sdk-mock.js +2 -2
  7. package/dist/cjs/sdk/accounts/liquidations/LiquidationsService.js +3 -3
  8. package/dist/cjs/sdk/accounts/liquidations/constants.js +0 -2
  9. package/dist/cjs/sdk/accounts/liquidations/index.js +0 -2
  10. package/dist/cjs/sdk/constants/index.js +1 -0
  11. package/dist/cjs/sdk/constants/math.js +5 -0
  12. package/dist/cjs/sdk/index.js +8 -4
  13. package/dist/cjs/sdk/market/MarketRegister.js +10 -0
  14. package/dist/cjs/sdk/market/credit/CreditFacadeV310Contract.js +181 -0
  15. package/dist/cjs/sdk/market/credit/CreditSuite.js +107 -1
  16. package/dist/cjs/sdk/{accounts → market/credit}/dominantCollateral.js +18 -4
  17. package/dist/cjs/sdk/market/credit/index.js +3 -0
  18. package/dist/cjs/sdk/market/index.js +3 -0
  19. package/dist/cjs/sdk/market/math.js +59 -0
  20. package/dist/cjs/sdk/market/oracle/PriceOracleV310Contract.js +2 -9
  21. package/dist/cjs/sdk/opportunities/index.js +4 -0
  22. package/dist/esm/dev/AccountOpener.js +2 -5
  23. package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +50 -534
  24. package/dist/esm/sdk/accounts/index.js +1 -3
  25. package/dist/esm/sdk/accounts/intents/operations/unwrap-rwa-collateral/index.js +1 -1
  26. package/dist/esm/sdk/accounts/intents/operations/wrap-rwa-collateral/index.js +1 -1
  27. package/dist/esm/sdk/accounts/intents/testing/sdk-mock.js +2 -2
  28. package/dist/esm/sdk/accounts/liquidations/LiquidationsService.js +2 -2
  29. package/dist/esm/sdk/accounts/liquidations/constants.js +1 -2
  30. package/dist/esm/sdk/accounts/liquidations/index.js +1 -2
  31. package/dist/esm/sdk/constants/index.js +2 -2
  32. package/dist/esm/sdk/constants/math.js +5 -1
  33. package/dist/esm/sdk/index.js +4 -5
  34. package/dist/esm/sdk/market/MarketRegister.js +10 -0
  35. package/dist/esm/sdk/market/credit/CreditFacadeV310Contract.js +181 -0
  36. package/dist/esm/sdk/market/credit/CreditSuite.js +108 -2
  37. package/dist/esm/sdk/{accounts → market/credit}/dominantCollateral.js +18 -5
  38. package/dist/esm/sdk/market/credit/index.js +2 -1
  39. package/dist/esm/sdk/market/index.js +2 -1
  40. package/dist/esm/sdk/market/math.js +56 -1
  41. package/dist/esm/sdk/market/oracle/PriceOracleV310Contract.js +3 -10
  42. package/dist/esm/sdk/opportunities/index.js +2 -2
  43. package/dist/types/sdk/OnchainSDK.d.ts +1 -1
  44. package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +11 -78
  45. package/dist/types/sdk/accounts/index.d.ts +2 -4
  46. package/dist/types/sdk/accounts/liquidations/constants.d.ts +1 -2
  47. package/dist/types/sdk/accounts/liquidations/index.d.ts +1 -2
  48. package/dist/types/sdk/accounts/types.d.ts +42 -346
  49. package/dist/types/sdk/constants/index.d.ts +2 -2
  50. package/dist/types/sdk/constants/math.d.ts +5 -1
  51. package/dist/types/sdk/index.d.ts +10 -11
  52. package/dist/types/sdk/market/MarketRegister.d.ts +7 -0
  53. package/dist/types/sdk/market/credit/CreditFacadeV310Contract.d.ts +47 -2
  54. package/dist/types/sdk/market/credit/CreditSuite.d.ts +24 -2
  55. package/dist/types/sdk/{accounts → market/credit}/dominantCollateral.d.ts +13 -6
  56. package/dist/types/sdk/market/credit/index.d.ts +3 -2
  57. package/dist/types/sdk/market/credit/types.d.ts +112 -2
  58. package/dist/types/sdk/market/index.d.ts +3 -2
  59. package/dist/types/sdk/market/math.d.ts +60 -1
  60. package/dist/types/sdk/market/oracle/PriceOracleV310Contract.d.ts +1 -0
  61. package/dist/types/sdk/market/rwa/securitize/SecuritizeRWAFactory.d.ts +1 -1
  62. package/dist/types/sdk/market/rwa/types.d.ts +1 -1
  63. package/dist/types/sdk/opportunities/index.d.ts +2 -2
  64. package/package.json +1 -1
  65. package/dist/cjs/sdk/accounts/constants.js +0 -12
  66. package/dist/esm/sdk/accounts/constants.js +0 -11
  67. package/dist/types/sdk/accounts/constants.d.ts +0 -11
@@ -129,5 +129,60 @@ function additionalBorrowApyBps(quotaRate, leverage) {
129
129
  if (!Number.isFinite(leverage)) return 0;
130
130
  return Math.round(quotaRate * Math.max(leverage - 1, 0));
131
131
  }
132
+ /**
133
+ * {@link PERCENTAGE_FACTOR} less a 0.1% safety buffer.
134
+ *
135
+ * Partial liquidation amounts are computed off prices that can drift between
136
+ * quoting and execution, so both the seized and the repaid amount are pulled
137
+ * this far away from the boundary the contracts would revert on.
138
+ **/
139
+ const PARTIAL_LIQUIDATION_BUFFER_BPS = 9990n;
140
+ /**
141
+ * Minimum collateral a partial liquidation must seize for a given repayment,
142
+ * derived from the liquidation discount and buffered by
143
+ * {@link PARTIAL_LIQUIDATION_BUFFER_BPS}.
144
+ *
145
+ * @param tokenAmount - Repaid amount converted from underlying into the seized
146
+ * token by the oracle.
147
+ * @param liquidationDiscount - Discount in effect for this account, in basis
148
+ * points (the expired variant once the credit manager has expired).
149
+ **/
150
+ function minSeizedAmount(tokenAmount, liquidationDiscount) {
151
+ return tokenAmount * PARTIAL_LIQUIDATION_BUFFER_BPS / BigInt(liquidationDiscount);
152
+ }
153
+ /**
154
+ * Amount of underlying whose repayment brings the account's health factor close
155
+ * to `optimalHF`, capped so the account keeps at least `minDebt` of debt.
156
+ *
157
+ * Ported from solidity:
158
+ * https://github.com/Gearbox-protocol/router-v3/blob/56e2d515ec6d9bb1e324e71c3708e59710779b24/contracts/liquidation/AbstractLiquidator.sol#L292
159
+ *
160
+ * @returns The repaid amount, or `0n` when the account is already healthy
161
+ * enough or carries less than the minimum debt.
162
+ * @throws If the discounted target health factor does not exceed the seized
163
+ * token's liquidation threshold, in which case no repayment improves the
164
+ * account.
165
+ **/
166
+ function optimalRepaidAmount({ totalDebt, twvUnderlying, minDebt, optimalHF, discount, ltTokenOut }) {
167
+ const denominator = discount * optimalHF / PERCENTAGE_FACTOR - ltTokenOut;
168
+ if (denominator <= 0n) throw new Error("cannot compute optimal repaid amount: invalid liquidation parameters (discount * hfOptimal <= ltTokenOut)");
169
+ const numerator = totalDebt * optimalHF - twvUnderlying * PERCENTAGE_FACTOR;
170
+ if (numerator <= 0n) return 0n;
171
+ const repaidAmount = numerator / denominator * discount / PERCENTAGE_FACTOR;
172
+ if (totalDebt < minDebt) return 0n;
173
+ const surplusDebt = totalDebt - minDebt;
174
+ if (repaidAmount > surplusDebt) return surplusDebt * PARTIAL_LIQUIDATION_BUFFER_BPS / PERCENTAGE_FACTOR;
175
+ return repaidAmount;
176
+ }
177
+ /**
178
+ * Health factor a partial liquidation should target, in basis points: just
179
+ * above 1, by enough to cover up to 1% of borrow cost so the account does not
180
+ * fall back under water immediately.
181
+ *
182
+ * @param borrowRate - Blended borrow rate of the account, in basis points.
183
+ **/
184
+ function optimalHFForPartialLiquidation(borrowRate) {
185
+ return PERCENTAGE_FACTOR + (borrowRate < 100n ? borrowRate : 100n);
186
+ }
132
187
  //#endregion
133
- export { additionalBorrowApyBps, borrowApyBps, healthFactorBps, maxLeverage, positionLeverage, rayToBps, usdToNumber, utilizationBps };
188
+ export { PARTIAL_LIQUIDATION_BUFFER_BPS, additionalBorrowApyBps, borrowApyBps, healthFactorBps, maxLeverage, minSeizedAmount, optimalHFForPartialLiquidation, optimalRepaidAmount, positionLeverage, rayToBps, usdToNumber, utilizationBps };
@@ -1,9 +1,8 @@
1
- import { iCreditFacadeMulticallV310Abi, iPriceOracleV310Abi } from "../../../abi/310/generated.js";
1
+ import { iPriceOracleV310Abi } from "../../../abi/310/generated.js";
2
2
  import { simulateWithPriceUpdates } from "../../utils/viem/simulateWithPriceUpdates.js";
3
3
  import { getRawPriceUpdates } from "../pricefeeds/getRawPriceUpdates.js";
4
4
  import "../pricefeeds/index.js";
5
5
  import { PriceOracleBaseContract } from "./PriceOracleBaseContract.js";
6
- import { encodeFunctionData } from "viem";
7
6
  //#region src/sdk/market/oracle/PriceOracleV310Contract.ts
8
7
  const abi = iPriceOracleV310Abi;
9
8
  var PriceOracleV310Contract = class extends PriceOracleBaseContract {
@@ -19,6 +18,7 @@ var PriceOracleV310Contract = class extends PriceOracleBaseContract {
19
18
  * @param creditFacade
20
19
  * @param updates
21
20
  * @returns
21
+ * @throws If `creditFacade` does not belong to a loaded market.
22
22
  */
23
23
  onDemandPriceUpdates(creditFacade, updates) {
24
24
  if (!updates) {
@@ -31,14 +31,7 @@ var PriceOracleV310Contract = class extends PriceOracleBaseContract {
31
31
  const raw = getRawPriceUpdates(updates);
32
32
  return {
33
33
  raw,
34
- multicall: [{
35
- target: creditFacade,
36
- callData: encodeFunctionData({
37
- abi: iCreditFacadeMulticallV310Abi,
38
- functionName: "onDemandPriceUpdates",
39
- args: [raw]
40
- })
41
- }]
34
+ multicall: [this.sdk.marketRegister.findCreditFacade(creditFacade).prepareOnDemandPriceUpdates(raw)]
42
35
  };
43
36
  }
44
37
  /**
@@ -1,4 +1,4 @@
1
- import { additionalBorrowApyBps, borrowApyBps, healthFactorBps, maxLeverage, positionLeverage, rayToBps, usdToNumber, utilizationBps } from "../market/math.js";
1
+ import { PARTIAL_LIQUIDATION_BUFFER_BPS, additionalBorrowApyBps, borrowApyBps, healthFactorBps, maxLeverage, minSeizedAmount, optimalHFForPartialLiquidation, optimalRepaidAmount, positionLeverage, rayToBps, usdToNumber, utilizationBps } from "../market/math.js";
2
2
  import { MultichainOpportunitiesService } from "./MultichainOpportunitiesService.js";
3
3
  import { OpportunitiesService } from "./OpportunitiesService.js";
4
- export { MultichainOpportunitiesService, OpportunitiesService, additionalBorrowApyBps, borrowApyBps, healthFactorBps, maxLeverage, positionLeverage, rayToBps, usdToNumber, utilizationBps };
4
+ export { MultichainOpportunitiesService, OpportunitiesService, PARTIAL_LIQUIDATION_BUFFER_BPS, additionalBorrowApyBps, borrowApyBps, healthFactorBps, maxLeverage, minSeizedAmount, optimalHFForPartialLiquidation, optimalRepaidAmount, positionLeverage, rayToBps, usdToNumber, utilizationBps };
@@ -6,10 +6,10 @@ import { VersionRange } from "./constants/versions.js";
6
6
  import "./constants/index.js";
7
7
  import { PluginsMap } from "./plugins/types.js";
8
8
  import "./plugins/index.js";
9
+ import { RWARegistry } from "./market/rwa/RWARegistry.js";
9
10
  import { IRouterContract } from "./router/types.js";
10
11
  import "./router/index.js";
11
12
  import { ICreditAccountsService } from "./accounts/types.js";
12
- import { RWARegistry } from "./market/rwa/RWARegistry.js";
13
13
  import { GearboxStateHuman } from "./types/state-human.js";
14
14
  import { PythOptions } from "./market/pricefeeds/updates/PythUpdater.js";
15
15
  import { RedstoneOptions } from "./market/pricefeeds/updates/RedstoneUpdater.js";
@@ -2,12 +2,12 @@ import { StrategyPosition } from "../../model/positions.js";
2
2
  import "../../model/index.js";
3
3
  import { RequestableWithdrawal } from "./withdrawal-compressor/types.js";
4
4
  import { Asset, CreditAccountData } from "../base/types.js";
5
+ import { RWAOpenAccountRequirements } from "../market/rwa/types.js";
6
+ import "../market/rwa/index.js";
5
7
  import { RouterCASlice } from "../router/types.js";
6
8
  import "../router/index.js";
7
9
  import "./withdrawal-compressor/index.js";
8
- import { AccountToCheck, AddCollateralProps, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, ChangeDeptProps, ClaimDelayedProps, ClaimFarmRewardsProps, CloseCreditAccountProps, CloseCreditAccountResult, CreditAccountOperationResult, CreditAccountTokensSlice, CreditManagerOperationResult, DefaultPartialLiquidationParams, ExecuteSwapProps, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsOptions, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, ICreditAccountsService, ListStrategyPositionsProps, OpenCAProps, PartiallyLiquidateProps, PermitResult, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, RepayAndLiquidateCreditAccountProps, RepayCreditAccountProps, Rewards, SetBotProps, StartDelayedWithdrawalProps, UpdateQuotasProps, WithdrawCollateralProps } from "./types.js";
9
- import { RWAOpenAccountRequirements } from "../market/rwa/types.js";
10
- import "../market/rwa/index.js";
10
+ import { AccountToCheck, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, ClaimFarmRewardsProps, CreditAccountOperationResult, CreditAccountTokensSlice, CreditManagerOperationResult, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsOptions, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, ICreditAccountsService, ListStrategyPositionsProps, OpenCAProps, PartiallyLiquidateProps, PermitResult, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, Rewards, SetBotProps } from "./types.js";
11
11
  import { PriceUpdate } from "../market/pricefeeds/types.js";
12
12
  import "../market/index.js";
13
13
  import { MultiCall, RawTx } from "../types/transactions.js";
@@ -72,38 +72,14 @@ declare class CreditAccountsServiceV310 extends SDKConstruct implements ICreditA
72
72
  * {@inheritDoc ICreditAccountsService.fullyLiquidate}
73
73
  **/
74
74
  fullyLiquidate(props: FullyLiquidateProps): Promise<FullyLiquidateResult>;
75
- /**
76
- * {@inheritDoc ICreditAccountsService.defaultPartialLiquidationParams}
77
- */
78
- defaultPartialLiquidationParams(ca: CreditAccountData): DefaultPartialLiquidationParams;
79
75
  /**
80
76
  * {@inheritDoc ICreditAccountsService.partiallyLiquidate}
81
77
  */
82
78
  partiallyLiquidate(props: PartiallyLiquidateProps): Promise<RawTx>;
83
- /**
84
- * {@inheritDoc ICreditAccountsService.closeCreditAccount}
85
- **/
86
- closeCreditAccount({ operation, assetsToWithdraw, creditAccount: ca, to, slippage, closePath }: CloseCreditAccountProps): Promise<CloseCreditAccountResult>;
87
79
  /**
88
80
  * {@inheritDoc ICreditAccountsService.assembleCloseCreditAccountCalls}
89
81
  */
90
82
  assembleCloseCreditAccountCalls({ creditAccount: ca, routerCalls, assetsToWithdraw, to }: AssembleCloseCreditAccountCallsProps): Promise<Array<MultiCall>>;
91
- /**
92
- * {@inheritDoc ICreditAccountsService.updateQuotas}
93
- **/
94
- updateQuotas({ minQuota, averageQuota, creditAccount }: UpdateQuotasProps): Promise<CreditAccountOperationResult>;
95
- /**
96
- * {@inheritDoc ICreditAccountsService.addCollateral}
97
- **/
98
- addCollateral({ creditAccount, asset, permit, ethAmount, minQuota, averageQuota }: AddCollateralProps): Promise<CreditAccountOperationResult>;
99
- /**
100
- * {@inheritDoc ICreditAccountsService.changeDebt}
101
- **/
102
- changeDebt({ creditAccount, amount, collateral }: ChangeDeptProps): Promise<CreditAccountOperationResult>;
103
- /**
104
- * {@inheritDoc ICreditAccountsService.executeSwap}
105
- **/
106
- executeSwap({ creditAccount, calls: swapCalls, minQuota, averageQuota }: ExecuteSwapProps): Promise<CreditAccountOperationResult>;
107
83
  /**
108
84
  * {@inheritDoc ICreditAccountsService.previewDelayedWithdrawal}
109
85
  **/
@@ -112,18 +88,10 @@ declare class CreditAccountsServiceV310 extends SDKConstruct implements ICreditA
112
88
  * {@inheritDoc ICreditAccountsService.getPendingWithdrawals}
113
89
  **/
114
90
  getPendingWithdrawals({ creditAccount }: GetPendingWithdrawalsProps): Promise<GetPendingWithdrawalsResult>;
115
- /**
116
- * {@inheritDoc ICreditAccountsService.startDelayedWithdrawal}
117
- **/
118
- startDelayedWithdrawal({ creditAccount, minQuota, averageQuota, preview }: StartDelayedWithdrawalProps): Promise<CreditAccountOperationResult>;
119
91
  /**
120
92
  * {@inheritDoc ICreditAccountsService.assembleStartDelayedWithdrawalCalls}
121
93
  **/
122
94
  assembleStartDelayedWithdrawalCalls({ creditFacade, preview }: AssembleStartDelayedWithdrawalCallsProps): Array<MultiCall>;
123
- /**
124
- * {@inheritDoc ICreditAccountsService.claimDelayed}
125
- **/
126
- claimDelayed({ creditAccount, minQuota, averageQuota, claimableNow }: ClaimDelayedProps): Promise<CreditAccountOperationResult>;
127
95
  /**
128
96
  * {@inheritDoc ICreditAccountsService.assembleClaimDelayedCalls}
129
97
  **/
@@ -139,15 +107,7 @@ declare class CreditAccountsServiceV310 extends SDKConstruct implements ICreditA
139
107
  /**
140
108
  * {@inheritDoc ICreditAccountsService.openCA}
141
109
  **/
142
- openCA(props: OpenCAProps): Promise<CreditAccountOperationResult>;
143
- /**
144
- * {@inheritDoc ICreditAccountsService.getBorrowRate}
145
- **/
146
- getBorrowRate(ca: CreditAccountData): bigint;
147
- /**
148
- * {@inheritDoc ICreditAccountsService.getOptimalHFForPartialLiquidation}
149
- **/
150
- getOptimalHFForPartialLiquidation(ca: CreditAccountData): bigint;
110
+ openCA(props: OpenCAProps): Promise<RawTx>;
151
111
  /**
152
112
  * Returns multicall entries to redeem (unwrap) RWA ERC-4626 vault shares into underlying for the given credit manager.
153
113
  * Used when withdrawing debt from a RWA market: redeems adapter vault shares so the underlying can be withdrawn.
@@ -156,7 +116,7 @@ declare class CreditAccountsServiceV310 extends SDKConstruct implements ICreditA
156
116
  * @param creditManager - Credit manager address
157
117
  * @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not RWA or no adapter is configured
158
118
  */
159
- getRWAUnwrapCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
119
+ assembleRWAUnwrapCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
160
120
  /**
161
121
  * Returns multicall entries to deposit (wrap) underlying into RWA ERC-4626 vault shares for the given credit manager.
162
122
  * Used when adding debt on a RWA market: deposits underlying into the adapter vault so shares are minted on the account.
@@ -165,7 +125,7 @@ declare class CreditAccountsServiceV310 extends SDKConstruct implements ICreditA
165
125
  * @param creditManager - Credit manager address
166
126
  * @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not RWA or no adapter is configured
167
127
  */
168
- getRWAWrapCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
128
+ assembleRWAWrapCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
169
129
  /**
170
130
  * Returns multicall entries to call redeemDiff on the RWA ERC-4626 adapter for the given credit manager.
171
131
  * Redeems the leftover vault shares (e.g. after repaying debt) so the account does not hold excess RWA vault tokens.
@@ -174,7 +134,7 @@ declare class CreditAccountsServiceV310 extends SDKConstruct implements ICreditA
174
134
  * @param creditManager - Credit manager address
175
135
  * @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not RWA or no adapter is configured
176
136
  */
177
- getRedeemDiffCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
137
+ assembleRedeemDiffCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
178
138
  /**
179
139
  * Returns multicall entries to call depositDiff on the RWA ERC-4626 adapter for the given credit manager.
180
140
  * Deposits the leftover underlying (e.g. after decreasing debt) into the vault so the account does not hold excess underlying.
@@ -183,48 +143,24 @@ declare class CreditAccountsServiceV310 extends SDKConstruct implements ICreditA
183
143
  * @param creditManager - Credit manager address
184
144
  * @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not RWA or no adapter is configured
185
145
  */
186
- getDepositDiffCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
146
+ assembleDepositDiffCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
187
147
  /**
188
148
  * {@inheritDoc ICreditAccountsService.setBot}
189
149
  */
190
150
  setBot({ botAddress, permissions: defaultPermissions, targetContract }: SetBotProps): Promise<CreditAccountOperationResult | CreditManagerOperationResult>;
191
- /**
192
- * {@inheritDoc ICreditAccountsService.withdrawCollateral}
193
- */
194
- withdrawCollateral({ creditAccount, assetsToWithdraw, to, minQuota, averageQuota }: WithdrawCollateralProps): Promise<CreditAccountOperationResult>;
195
- /**
196
- * {@inheritDoc ICreditAccountsService.repayCreditAccount}
197
- */
198
- repayCreditAccount(props: RepayCreditAccountProps): Promise<CreditAccountOperationResult>;
199
151
  /**
200
152
  * {@inheritDoc ICreditAccountsService.assembleRepayCreditAccountCalls}
201
153
  */
202
154
  assembleRepayCreditAccountCalls({ collateralAssets, assetsToWithdraw, creditAccount: ca, permits, to, tokensToClaim, calls: wrapCalls }: AssembleRepayCreditAccountCallsProps): Promise<Array<MultiCall>>;
203
- /**
204
- * {@inheritDoc ICreditAccountsService.repayAndLiquidateCreditAccount}
205
- */
206
- repayAndLiquidateCreditAccount({ collateralAssets, assetsToWithdraw, creditAccount: ca, permits, to, tokensToClaim }: RepayAndLiquidateCreditAccountProps): Promise<CreditAccountOperationResult>;
207
155
  /**
208
156
  * {@inheritDoc ICreditAccountsService.claimFarmRewards}
209
157
  */
210
- claimFarmRewards({ calls: externalCalls, creditAccount: ca, minQuota, averageQuota, tokensToClaim }: ClaimFarmRewardsProps): Promise<CreditAccountOperationResult>;
158
+ claimFarmRewards({ calls: externalCalls, creditAccount: ca, minQuota, averageQuota, tokensToClaim }: ClaimFarmRewardsProps): Promise<RawTx>;
211
159
  /**
212
160
  * Returns raw txs that are needed to update all price feeds so that all credit accounts (possibly from different markets) compute
213
161
  * {@inheritDoc ICreditAccountsService.getOnDemandPriceUpdates}
214
162
  **/
215
163
  getOnDemandPriceUpdates(account: CreditAccountTokensSlice, ignoreReservePrices?: boolean): Promise<PriceUpdate[]>;
216
- /**
217
- * {@inheritDoc ICreditAccountsService.multicall}
218
- */
219
- multicall(creditAccount: RouterCASlice, calls: MultiCall[], options?: {
220
- ignoreReservePrices?: boolean;
221
- }): Promise<RawTx>;
222
- /**
223
- * {@inheritDoc ICreditAccountsService.botMulticall}
224
- */
225
- botMulticall(creditAccount: RouterCASlice, calls: MultiCall[], options?: {
226
- ignoreReservePrices?: boolean;
227
- }): Promise<RawTx>;
228
164
  /**
229
165
  * {@inheritDoc ICreditAccountsService.prependPriceUpdates}
230
166
  */
@@ -241,14 +177,11 @@ declare class CreditAccountsServiceV310 extends SDKConstruct implements ICreditA
241
177
  executeCaUpdate(creditAccount: RouterCASlice, calls: MultiCall[], options?: {
242
178
  ignoreReservePrices?: boolean;
243
179
  ethAmount?: bigint;
244
- }): Promise<{
245
- tx: RawTx;
246
- calls: MultiCall[];
247
- }>;
180
+ }): Promise<RawTx>;
248
181
  /**
249
182
  * {@inheritDoc ICreditAccountsService.prepareUpdateQuotas}
250
183
  */
251
- prepareUpdateQuotas(creditFacade: Address, { averageQuota, minQuota }: PrepareUpdateQuotasProps): Array<MultiCall>;
184
+ prepareUpdateQuotas(creditFacade: Address, props: PrepareUpdateQuotasProps): Array<MultiCall>;
252
185
  /**
253
186
  * {@inheritDoc ICreditAccountsService.prepareWithdrawToken}
254
187
  */
@@ -10,10 +10,8 @@ import { WithdrawalCompressorV310Contract } from "./withdrawal-compressor/Withdr
10
10
  import { WithdrawalCompressorV311Contract } from "./withdrawal-compressor/WithdrawalCompressorV311Contract.js";
11
11
  import { WithdrawalCompressorV313Contract } from "./withdrawal-compressor/WithdrawalCompressorV313Contract.js";
12
12
  import "./withdrawal-compressor/index.js";
13
- import { AccountToCheck, AddCollateralProps, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, ChangeDeptProps, ClaimDelayedProps, ClaimFarmRewardsProps, CloseCreditAccountProps, CloseCreditAccountResult, CloseOptions, CreditAccountFilter, CreditAccountOperationResult, CreditAccountTokensSlice, CreditManagerFilter, CreditManagerOperationResult, DefaultPartialLiquidationParams, EncodableCreditAccountOperation, ExecuteSwapProps, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, ICreditAccountsService, ListStrategyPositionsProps, OpenCAProps, PartiallyLiquidateProps, PermitResult, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, RepayAndLiquidateCreditAccountProps, RepayCreditAccountProps, Rewards, SetBotProps, StartDelayedWithdrawalProps, UpdateQuotasProps, WithdrawCollateralProps } from "./types.js";
13
+ import { AccountToCheck, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, ClaimFarmRewardsProps, CloseCreditAccountResult, CreditAccountFilter, CreditAccountOperationResult, CreditAccountTokensSlice, CreditManagerFilter, CreditManagerOperationResult, EncodableCreditAccountOperation, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, ICreditAccountsService, ListStrategyPositionsProps, OpenCAProps, PartiallyLiquidateProps, PermitResult, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, Rewards, SetBotProps } from "./types.js";
14
14
  import { CreditAccountServiceOptions, CreditAccountsServiceV310 } from "./CreditAccountsServiceV310.js";
15
- import { DUST_THRESHOLD } from "./constants.js";
16
- import { dominantCollateral } from "./dominantCollateral.js";
17
15
  import { CreditAccountSlice, IntentPreviewResult } from "./intents/types.js";
18
16
  import { primaryInstantOutput } from "./intents/operations/claim-delayed/index.js";
19
17
  import { CreditAccountOperationsService } from "./intents/index.js";
@@ -22,4 +20,4 @@ import { BuildLiquidationTxProps, BuildLiquidationTxPropsBase, GetLiquidatableAc
22
20
  import { LiquidationsService } from "./liquidations/LiquidationsService.js";
23
21
  import { MultichainLiquidationsService } from "./liquidations/MultichainLiquidationsService.js";
24
22
  import "./liquidations/index.js";
25
- export { AbstractWithdrawalCompressorContract, AccountToCheck, AddCollateralProps, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, ChangeDeptProps, ClaimDelayedProps, ClaimFarmRewardsProps, ClaimableWithdrawal, CloseCreditAccountProps, CloseCreditAccountResult, CloseOptions, CreditAccountFilter, CreditAccountOperationResult, CreditAccountOperationsService, CreditAccountServiceOptions, type CreditAccountSlice, CreditAccountTokensSlice, CreditAccountsServiceV310, CreditManagerFilter, CreditManagerOperationResult, CurrentWithdrawals, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DUST_THRESHOLD, DefaultPartialLiquidationParams, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedIntentExtended, DelayedWithdrawCollateralIntent, EncodableCreditAccountOperation, ExecuteSwapProps, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetLiquidatableAccountsProps, GetLiquidatableAccountsPropsBase, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, GetWithdrawalRequestResultProps, ICreditAccountsService, IRedemptionLoggerContract, IWithdrawalCompressorContract, type IntentPreviewResult, InvalidDelayedIntentError, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LiquidationsService, ListStrategyPositionsProps, LoadRWALiquidatorsProps, MultichainLiquidationsService, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, OnchainRequestableWithdrawal, OpenCAProps, PartiallyLiquidateProps, PendingWithdrawal, PermitResult, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, RWALiquidatorInfo, RedemptionLog, RedemptionLoggerV310Contract, RepayAndLiquidateCreditAccountProps, RepayCreditAccountProps, RequestableWithdrawal, Rewards, SetBotProps, StartDelayedWithdrawalProps, UpdateQuotasProps, WithdrawCollateralProps, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, createRedemptionLogger, createWithdrawalCompressor, decodeDelayedIntent, dominantCollateral, encodeDelayedIntent, getWithdrawalCompressorAddress, iCreditAccountAbi, primaryInstantOutput, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal, toWithdrawalStatus };
23
+ export { AbstractWithdrawalCompressorContract, AccountToCheck, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, ClaimFarmRewardsProps, ClaimableWithdrawal, CloseCreditAccountResult, CreditAccountFilter, CreditAccountOperationResult, CreditAccountOperationsService, CreditAccountServiceOptions, type CreditAccountSlice, CreditAccountTokensSlice, CreditAccountsServiceV310, CreditManagerFilter, CreditManagerOperationResult, CurrentWithdrawals, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedIntentExtended, DelayedWithdrawCollateralIntent, EncodableCreditAccountOperation, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetLiquidatableAccountsProps, GetLiquidatableAccountsPropsBase, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, GetWithdrawalRequestResultProps, ICreditAccountsService, IRedemptionLoggerContract, IWithdrawalCompressorContract, type IntentPreviewResult, InvalidDelayedIntentError, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LiquidationsService, ListStrategyPositionsProps, LoadRWALiquidatorsProps, MultichainLiquidationsService, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, OnchainRequestableWithdrawal, OpenCAProps, PartiallyLiquidateProps, PendingWithdrawal, PermitResult, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, RWALiquidatorInfo, RedemptionLog, RedemptionLoggerV310Contract, RequestableWithdrawal, Rewards, SetBotProps, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, createRedemptionLogger, createWithdrawalCompressor, decodeDelayedIntent, encodeDelayedIntent, getWithdrawalCompressorAddress, iCreditAccountAbi, primaryInstantOutput, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal, toWithdrawalStatus };
@@ -1,4 +1,3 @@
1
- import { DUST_THRESHOLD } from "../constants.js";
2
1
  import { Address } from "viem";
3
2
  //#region src/sdk/accounts/liquidations/constants.d.ts
4
3
  declare const LIQUIDATION_COMPRESSOR_V313_ADDRESS: Address;
@@ -9,4 +8,4 @@ declare const LIQUIDATION_COMPRESSOR_V313_ADDRESS: Address;
9
8
  **/
10
9
  declare const LIQUIDATION_APPROVAL_BUFFER = 50n;
11
10
  //#endregion
12
- export { DUST_THRESHOLD, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS };
11
+ export { LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS };
@@ -1,6 +1,5 @@
1
- import { DUST_THRESHOLD } from "../constants.js";
2
1
  import { LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS } from "./constants.js";
3
2
  import { BuildLiquidationTxProps, BuildLiquidationTxPropsBase, GetLiquidatableAccountsProps, GetLiquidatableAccountsPropsBase, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, LoadRWALiquidatorsProps, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, RWALiquidatorInfo } from "./types.js";
4
3
  import { LiquidationsService } from "./LiquidationsService.js";
5
4
  import { MultichainLiquidationsService } from "./MultichainLiquidationsService.js";
6
- export { BuildLiquidationTxProps, BuildLiquidationTxPropsBase, DUST_THRESHOLD, GetLiquidatableAccountsProps, GetLiquidatableAccountsPropsBase, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LiquidationsService, LoadRWALiquidatorsProps, MultichainLiquidationsService, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, RWALiquidatorInfo };
5
+ export { BuildLiquidationTxProps, BuildLiquidationTxPropsBase, GetLiquidatableAccountsProps, GetLiquidatableAccountsPropsBase, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LiquidationsService, LoadRWALiquidatorsProps, MultichainLiquidationsService, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, RWALiquidatorInfo };