@gearbox-protocol/sdk 18.4.1-aave.1 → 18.4.1-aave.10

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 (163) hide show
  1. package/dist/cjs/abi/rwa/iSecuritizeRWAFactory.js +15 -0
  2. package/dist/cjs/model/errors/index.js +1 -0
  3. package/dist/cjs/model/errors/operation-errors.js +9 -0
  4. package/dist/cjs/model/index.js +1 -0
  5. package/dist/cjs/onchain/accounts/bots/AccountBotsService.js +29 -0
  6. package/dist/cjs/onchain/accounts/bots/PeripheryCompressorV310Contract.js +2 -1
  7. package/dist/cjs/onchain/accounts/index.js +1 -1
  8. package/dist/cjs/onchain/accounts/intents/index.js +33 -1
  9. package/dist/cjs/onchain/accounts/intents/operations.js +13 -13
  10. package/dist/cjs/onchain/accounts/intents/plan.js +45 -23
  11. package/dist/cjs/onchain/accounts/intents/readAaveHoldings.js +56 -0
  12. package/dist/cjs/onchain/accounts/intents/realize.js +61 -23
  13. package/dist/cjs/onchain/accounts/intents/testing/sdk-mock.js +1 -1
  14. package/dist/cjs/onchain/accounts/intents/utils/ledger.js +6 -6
  15. package/dist/cjs/onchain/index.js +13 -1
  16. package/dist/cjs/onchain/market/ZapperRegister.js +1 -1
  17. package/dist/cjs/onchain/market/adapters/abi/aave/iAaveOracle.js +20 -0
  18. package/dist/cjs/onchain/market/adapters/abi/aave/iAaveV3Pool.js +166 -0
  19. package/dist/cjs/onchain/market/adapters/abi/aave/iPoolAddressesProvider.js +11 -0
  20. package/dist/cjs/onchain/market/adapters/abi/aave/iVariableDebtToken.js +17 -0
  21. package/dist/cjs/onchain/market/adapters/abi/aave/index.js +6 -0
  22. package/dist/cjs/onchain/market/adapters/abi/adapters/iAaveHorizonBridgeAdapter.js +27 -0
  23. package/dist/cjs/onchain/market/adapters/abi/index.js +8 -0
  24. package/dist/cjs/onchain/market/adapters/abi/securitize/iSecuritizeNAVProvider.js +15 -0
  25. package/dist/cjs/onchain/market/adapters/abi/securitize/index.js +2 -0
  26. package/dist/cjs/onchain/market/adapters/contracts/AaveHorizonBridgeAdapterContract.js +100 -12
  27. package/dist/cjs/onchain/market/adapters/contracts/AaveV3PoolAdapterContract.js +19 -11
  28. package/dist/cjs/onchain/market/adapters/contracts/SecuritizeRedemptionGatewayAdapterContract.js +42 -5
  29. package/dist/cjs/onchain/market/adapters/index.js +8 -0
  30. package/dist/cjs/onchain/market/index.js +8 -0
  31. package/dist/cjs/onchain/market/rwa/securitize/SecuritizeRWAFactory.js +9 -0
  32. package/dist/cjs/onchain/positions/MultichainPositionsService.js +15 -0
  33. package/dist/cjs/onchain/positions/PositionsService.js +31 -0
  34. package/dist/cjs/onchain/positions/aaveMoveCalls.js +45 -0
  35. package/dist/cjs/onchain/positions/projectAavePosition.js +164 -26
  36. package/dist/cjs/onchain/positions/readAavePosition.js +152 -0
  37. package/dist/cjs/onchain/preview/index.js +2 -0
  38. package/dist/cjs/onchain/preview/preview/aaveBridgeBorrows.js +24 -0
  39. package/dist/cjs/onchain/preview/preview/aaveMoveStart.js +27 -0
  40. package/dist/cjs/onchain/preview/preview/index.js +2 -0
  41. package/dist/cjs/onchain/preview/preview/previewAdjustStrategyPosition.js +3 -0
  42. package/dist/cjs/onchain/preview/preview/previewExitOrRepayStrategyPosition.js +5 -2
  43. package/dist/cjs/onchain/preview/preview/previewOpenStrategyPosition.js +4 -1
  44. package/dist/cjs/onchain/preview/preview/previewOperation.js +31 -8
  45. package/dist/cjs/onchain/validation/bundles/checkAaveDelegation.js +54 -0
  46. package/dist/cjs/onchain/validation/bundles/checkCreditOperation.js +36 -11
  47. package/dist/cjs/onchain/validation/bundles/index.js +2 -0
  48. package/dist/cjs/onchain/validation/checkOperation.js +16 -4
  49. package/dist/cjs/onchain/validation/index.js +2 -0
  50. package/dist/cjs/sdk/execute/ExecuteApi.js +1 -0
  51. package/dist/cjs/sdk/positions/PositionsNamespace.js +6 -0
  52. package/dist/cjs/sdk/prepare/PrepareApi.js +68 -9
  53. package/dist/cjs/sdk/preview/PreviewNamespace.js +11 -2
  54. package/dist/esm/abi/rwa/iSecuritizeRWAFactory.js +15 -0
  55. package/dist/esm/model/errors/index.js +2 -2
  56. package/dist/esm/model/errors/operation-errors.js +9 -1
  57. package/dist/esm/model/index.js +2 -2
  58. package/dist/esm/onchain/accounts/bots/AccountBotsService.js +29 -0
  59. package/dist/esm/onchain/accounts/bots/PeripheryCompressorV310Contract.js +1 -1
  60. package/dist/esm/onchain/accounts/index.js +1 -1
  61. package/dist/esm/onchain/accounts/intents/index.js +34 -2
  62. package/dist/esm/onchain/accounts/intents/operations.js +12 -12
  63. package/dist/esm/onchain/accounts/intents/plan.js +46 -24
  64. package/dist/esm/onchain/accounts/intents/readAaveHoldings.js +55 -0
  65. package/dist/esm/onchain/accounts/intents/realize.js +62 -24
  66. package/dist/esm/onchain/accounts/intents/testing/sdk-mock.js +1 -1
  67. package/dist/esm/onchain/accounts/intents/utils/ledger.js +6 -6
  68. package/dist/esm/onchain/index.js +8 -2
  69. package/dist/esm/onchain/market/ZapperRegister.js +1 -1
  70. package/dist/esm/onchain/market/adapters/abi/aave/iAaveOracle.js +19 -0
  71. package/dist/esm/onchain/market/adapters/abi/aave/iAaveV3Pool.js +166 -0
  72. package/dist/esm/onchain/market/adapters/abi/aave/iPoolAddressesProvider.js +10 -0
  73. package/dist/esm/onchain/market/adapters/abi/aave/iVariableDebtToken.js +16 -0
  74. package/dist/esm/onchain/market/adapters/abi/aave/index.js +4 -1
  75. package/dist/esm/onchain/market/adapters/abi/adapters/iAaveHorizonBridgeAdapter.js +27 -0
  76. package/dist/esm/onchain/market/adapters/abi/index.js +5 -1
  77. package/dist/esm/onchain/market/adapters/abi/securitize/iSecuritizeNAVProvider.js +14 -0
  78. package/dist/esm/onchain/market/adapters/abi/securitize/index.js +2 -1
  79. package/dist/esm/onchain/market/adapters/contracts/AaveHorizonBridgeAdapterContract.js +101 -13
  80. package/dist/esm/onchain/market/adapters/contracts/AaveV3PoolAdapterContract.js +20 -12
  81. package/dist/esm/onchain/market/adapters/contracts/SecuritizeRedemptionGatewayAdapterContract.js +43 -6
  82. package/dist/esm/onchain/market/adapters/index.js +5 -1
  83. package/dist/esm/onchain/market/index.js +5 -1
  84. package/dist/esm/onchain/market/rwa/securitize/SecuritizeRWAFactory.js +9 -0
  85. package/dist/esm/onchain/positions/MultichainPositionsService.js +15 -0
  86. package/dist/esm/onchain/positions/PositionsService.js +31 -0
  87. package/dist/esm/onchain/positions/aaveMoveCalls.js +44 -0
  88. package/dist/esm/onchain/positions/projectAavePosition.js +165 -27
  89. package/dist/esm/onchain/positions/readAavePosition.js +151 -0
  90. package/dist/esm/onchain/preview/index.js +2 -1
  91. package/dist/esm/onchain/preview/preview/aaveBridgeBorrows.js +23 -0
  92. package/dist/esm/onchain/preview/preview/aaveMoveStart.js +26 -0
  93. package/dist/esm/onchain/preview/preview/index.js +2 -1
  94. package/dist/esm/onchain/preview/preview/previewAdjustStrategyPosition.js +3 -0
  95. package/dist/esm/onchain/preview/preview/previewExitOrRepayStrategyPosition.js +5 -2
  96. package/dist/esm/onchain/preview/preview/previewOpenStrategyPosition.js +4 -1
  97. package/dist/esm/onchain/preview/preview/previewOperation.js +31 -8
  98. package/dist/esm/onchain/validation/bundles/checkAaveDelegation.js +53 -0
  99. package/dist/esm/onchain/validation/bundles/checkCreditOperation.js +36 -11
  100. package/dist/esm/onchain/validation/bundles/index.js +2 -1
  101. package/dist/esm/onchain/validation/checkOperation.js +16 -4
  102. package/dist/esm/onchain/validation/index.js +2 -1
  103. package/dist/esm/sdk/execute/ExecuteApi.js +1 -0
  104. package/dist/esm/sdk/positions/PositionsNamespace.js +6 -0
  105. package/dist/esm/sdk/prepare/PrepareApi.js +69 -10
  106. package/dist/esm/sdk/preview/PreviewNamespace.js +11 -2
  107. package/dist/types/abi/rwa/iSecuritizeRWAFactory.d.ts +14 -0
  108. package/dist/types/model/aave.d.ts +60 -3
  109. package/dist/types/model/errors/index.d.ts +2 -2
  110. package/dist/types/model/errors/operation-errors.d.ts +19 -0
  111. package/dist/types/model/index.d.ts +5 -5
  112. package/dist/types/model/opportunities.d.ts +1 -1
  113. package/dist/types/model/previews.d.ts +18 -2
  114. package/dist/types/onchain/accounts/bots/AccountBotsService.d.ts +11 -1
  115. package/dist/types/onchain/accounts/bots/index.d.ts +2 -2
  116. package/dist/types/onchain/accounts/bots/types.d.ts +7 -1
  117. package/dist/types/onchain/accounts/index.d.ts +3 -3
  118. package/dist/types/onchain/accounts/intents/index.d.ts +21 -3
  119. package/dist/types/onchain/accounts/intents/operations.d.ts +27 -23
  120. package/dist/types/onchain/accounts/intents/plan.d.ts +23 -19
  121. package/dist/types/onchain/accounts/intents/readAaveHoldings.d.ts +16 -0
  122. package/dist/types/onchain/accounts/intents/types.d.ts +37 -14
  123. package/dist/types/onchain/index.d.ts +10 -4
  124. package/dist/types/onchain/market/adapters/abi/aave/iAaveOracle.d.ts +22 -0
  125. package/dist/types/onchain/market/adapters/abi/aave/iAaveV3Pool.d.ts +139 -0
  126. package/dist/types/onchain/market/adapters/abi/aave/iPoolAddressesProvider.d.ts +11 -0
  127. package/dist/types/onchain/market/adapters/abi/aave/iVariableDebtToken.d.ts +17 -0
  128. package/dist/types/onchain/market/adapters/abi/aave/index.d.ts +4 -1
  129. package/dist/types/onchain/market/adapters/abi/adapters/iAaveHorizonBridgeAdapter.d.ts +21 -0
  130. package/dist/types/onchain/market/adapters/abi/index.d.ts +5 -1
  131. package/dist/types/onchain/market/adapters/abi/securitize/iSecuritizeNAVProvider.d.ts +13 -0
  132. package/dist/types/onchain/market/adapters/abi/securitize/index.d.ts +2 -1
  133. package/dist/types/onchain/market/adapters/contracts/AaveHorizonBridgeAdapterContract.d.ts +59 -10
  134. package/dist/types/onchain/market/adapters/contracts/AaveV3PoolAdapterContract.d.ts +147 -4
  135. package/dist/types/onchain/market/adapters/contracts/SecuritizeRedemptionGatewayAdapterContract.d.ts +19 -4
  136. package/dist/types/onchain/market/adapters/index.d.ts +5 -1
  137. package/dist/types/onchain/market/index.d.ts +5 -1
  138. package/dist/types/onchain/market/rwa/securitize/SecuritizeRWAFactory.d.ts +20 -0
  139. package/dist/types/onchain/market/rwa/types.d.ts +6 -0
  140. package/dist/types/onchain/positions/MultichainPositionsService.d.ts +7 -1
  141. package/dist/types/onchain/positions/PositionsService.d.ts +16 -2
  142. package/dist/types/onchain/positions/aaveMoveCalls.d.ts +30 -0
  143. package/dist/types/onchain/positions/index.d.ts +2 -2
  144. package/dist/types/onchain/positions/projectAavePosition.d.ts +34 -4
  145. package/dist/types/onchain/positions/readAavePosition.d.ts +22 -0
  146. package/dist/types/onchain/positions/types.d.ts +25 -0
  147. package/dist/types/onchain/preview/index.d.ts +2 -1
  148. package/dist/types/onchain/preview/preview/aaveBridgeBorrows.d.ts +15 -0
  149. package/dist/types/onchain/preview/preview/aaveMoveStart.d.ts +18 -0
  150. package/dist/types/onchain/preview/preview/index.d.ts +2 -1
  151. package/dist/types/onchain/validation/bundles/checkAaveDelegation.d.ts +21 -0
  152. package/dist/types/onchain/validation/bundles/checkCreditOperation.d.ts +2 -2
  153. package/dist/types/onchain/validation/bundles/index.d.ts +2 -1
  154. package/dist/types/onchain/validation/index.d.ts +2 -1
  155. package/dist/types/sdk/execute/types.d.ts +7 -5
  156. package/dist/types/sdk/index.d.ts +2 -2
  157. package/dist/types/sdk/positions/PositionsNamespace.d.ts +6 -1
  158. package/dist/types/sdk/positions/types.d.ts +9 -1
  159. package/dist/types/sdk/prepare/PrepareApi.d.ts +4 -4
  160. package/dist/types/sdk/prepare/index.d.ts +2 -2
  161. package/dist/types/sdk/prepare/types.d.ts +88 -28
  162. package/dist/types/sdk/preview/types.d.ts +4 -2
  163. package/package.json +1 -1
@@ -1,10 +1,21 @@
1
1
  import { Timestamp, TokenAmount } from "./primitives.js";
2
2
  import { AccountProjection } from "./previews.js";
3
+ import { StrategyPosition } from "./positions.js";
4
+ import { Address } from "viem";
3
5
  //#region src/model/aave.d.ts
6
+ /**
7
+ * A loan the Horizon bridge takes on Aave as the credit account owner. Aave
8
+ * lends it only up to what the owner delegated to the bridge on the variable
9
+ * debt token of the borrowed token (`approveDelegation`).
10
+ **/
11
+ export interface AaveBridgeBorrow {
12
+ bridge: Address;
13
+ amount: TokenAmount;
14
+ }
4
15
  /**
5
16
  * Where an opening lands once it has moved to Aave Horizon.
6
17
  *
7
- * An RWA collateral is minted asynchronously, so the leverage is built in a
18
+ * An RWA collateral may be minted asynchronously, so the leverage is built in a
8
19
  * Gearbox credit account first; once the mint settles, the minted collateral is
9
20
  * supplied to Aave, the Gearbox debt is refinanced there with the interest it
10
21
  * accrued in the meantime, and the credit account closes. This is that second
@@ -21,12 +32,58 @@ export interface AavePositionProjection extends Pick<AccountProjection, "totalVa
21
32
  **/
22
33
  mintPeriodInterest: TokenAmount;
23
34
  /**
24
- * How long the mint takes to settle, in seconds.
35
+ * How long the mint takes to settle, in seconds: the `withdrawalLength` of
36
+ * the RWA's delayed operation, `0` where the opening mints it outright.
25
37
  **/
26
38
  mintDuration: number;
27
39
  /**
28
- * Estimated unix seconds at which the position is live on Aave.
40
+ * Estimated unix seconds at which the position is live on Aave: the
41
+ * opening's own block where the mint is instant, and once the mint settles
42
+ * otherwise, when the finalizer bot moves it.
29
43
  **/
30
44
  estLiveAt: Timestamp;
45
+ /**
46
+ * Horizon bridge that borrows `totalDebt` as the owner when the position
47
+ * moves, see {@link AaveBridgeBorrow}.
48
+ **/
49
+ bridge: Address;
50
+ }
51
+ /**
52
+ * A position that lives on Aave Horizon: the RWA the account owner supplied to
53
+ * the Aave pool and the loan the Horizon bridge took against it in the owner's
54
+ * name. The credit account it was built in stays open with no debt, and the
55
+ * exit runs through such an account again. One pool holds one position per
56
+ * owner, however many accounts moved into it.
57
+ *
58
+ * Shaped like {@link StrategyPosition} so the two are shown alike. The shared
59
+ * fields mean what they mean there, read on Aave for the owner (the investor
60
+ * of an RWA account):
61
+ *
62
+ * - `creditManager` and `creditAccount` are an account of the owner the exit
63
+ * can run through, not necessarily the one the position was built in;
64
+ * - `collaterals` lists the RWA supplied to Aave in the RWA itself, not in its
65
+ * aToken, which Aave mints one for one; `quota` is always zero, since Aave
66
+ * charges none, and `withdrawals` is empty;
67
+ * - `totalDebt` is the variable debt owed on Aave, and `totalValue` the
68
+ * collateral at the Aave oracle's prices, both in the underlying;
69
+ * - `healthFactor` is Aave's, of everything the owner holds on the pool;
70
+ * - `borrowApy` and `borrowRate` are the pool's variable borrow rate, with no
71
+ * quota part.
72
+ **/
73
+ export interface AavePosition extends Omit<StrategyPosition, "kind" | "borrowApyAvg7D" | "netApy" | "netApyAvg7D" | "borrowRateAvg7D" | "pnl" | "error"> {
74
+ /**
75
+ * Tells this position from a credit account; not one of the
76
+ * {@link PositionKind}s `positions.list` returns.
77
+ **/
78
+ kind: "aave";
79
+ /**
80
+ * Aave pool the collateral is supplied to and the debt is owed on.
81
+ **/
82
+ pool: Address;
83
+ /**
84
+ * Horizon bridge that holds the owner's borrow delegation, see
85
+ * {@link AaveBridgeBorrow}.
86
+ **/
87
+ bridge: Address;
31
88
  }
32
89
  //#endregion
@@ -1,7 +1,7 @@
1
1
  import { IGearboxError } from "./base.js";
2
2
  import { CreditAccountFrozenError, LiquidatorNotEligibleError, NotEmergencyLiquidatorError, PartialLiquidationImpossibleError, creditAccountFrozen, liquidatorNotEligible, notEmergencyLiquidator, partialLiquidationImpossible } from "./liquidation-errors.js";
3
- import { AccountNotMidasGreenlistedError, BorrowLimitCause, CollateralLimits, CreditManagerPausedError, DebtOutOfRangeError, ForbiddenTokenError, InsufficientAllowanceError, InsufficientBalanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, LeverageLimits, LeverageOutOfRangeError, MarketExpiredError, OperationLimitOptions, PoolPausedError, PoolSunsetError, QuotaAboveMaxError, QuotaCountExceededError, QuotaInactiveError, QuotaInputLimits, QuotaLimitReachedError, QuotaUnchangedError, RWAOpenRequirementsError, ReservePriceLimitedError, accountNotMidasGreenlisted, creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, marketExpired, poolPaused, poolSunset, quotaAboveMax, quotaCountExceeded, quotaInactive, quotaLimitReached, quotaUnchanged, reservePriceLimited, rwaOpenRequirementsNotMet } from "./operation-errors.js";
3
+ import { AccountNotMidasGreenlistedError, BorrowLimitCause, CollateralLimits, CreditManagerPausedError, DebtOutOfRangeError, ForbiddenTokenError, InsufficientAllowanceError, InsufficientBalanceError, InsufficientBorrowAllowanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, LeverageLimits, LeverageOutOfRangeError, MarketExpiredError, OperationLimitOptions, PoolPausedError, PoolSunsetError, QuotaAboveMaxError, QuotaCountExceededError, QuotaInactiveError, QuotaInputLimits, QuotaLimitReachedError, QuotaUnchangedError, RWAOpenRequirementsError, ReservePriceLimitedError, accountNotMidasGreenlisted, creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientBorrowAllowance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, marketExpired, poolPaused, poolSunset, quotaAboveMax, quotaCountExceeded, quotaInactive, quotaLimitReached, quotaUnchanged, reservePriceLimited, rwaOpenRequirementsNotMet } from "./operation-errors.js";
4
4
  import { UnpriceableTokenError, unpriceableTokenError } from "./oracle-errors.js";
5
5
  import { CreditAccountNotEmptyError, CreditAccountNotFoundError, MultipleDelayedWithdrawalsError, NoDelayedRouteError, NoRecordedIntentError, NoStrategyTargetCollateralError, UnexpectedFailureError, UnsupportedCollateralTokenError, UnsupportedTokenPairError, WithdrawalInProgressError, creditAccountNotEmpty, creditAccountNotFound, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, unexpectedFailure, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress } from "./prepare-errors.js";
6
6
  import { InvalidDelayedIntentError, MalformedTransactionError, PoolOperationPreviewError, UnsupportedOperationError, UnsupportedPoolFunctionError, UnsupportedTargetError, UnsupportedZapperFunctionError, malformedTransaction } from "./preview-errors.js";
7
- export { AccountNotMidasGreenlistedError, BorrowLimitCause, CollateralLimits, CreditAccountFrozenError, CreditAccountNotEmptyError, CreditAccountNotFoundError, CreditManagerPausedError, DebtOutOfRangeError, ForbiddenTokenError, IGearboxError, InsufficientAllowanceError, InsufficientBalanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, InvalidDelayedIntentError, LeverageLimits, LeverageOutOfRangeError, LiquidatorNotEligibleError, MalformedTransactionError, MarketExpiredError, MultipleDelayedWithdrawalsError, NoDelayedRouteError, NoRecordedIntentError, NoStrategyTargetCollateralError, NotEmergencyLiquidatorError, OperationLimitOptions, PartialLiquidationImpossibleError, PoolOperationPreviewError, PoolPausedError, PoolSunsetError, QuotaAboveMaxError, QuotaCountExceededError, QuotaInactiveError, QuotaInputLimits, QuotaLimitReachedError, QuotaUnchangedError, RWAOpenRequirementsError, ReservePriceLimitedError, UnexpectedFailureError, UnpriceableTokenError, UnsupportedCollateralTokenError, UnsupportedOperationError, UnsupportedPoolFunctionError, UnsupportedTargetError, UnsupportedTokenPairError, UnsupportedZapperFunctionError, WithdrawalInProgressError, accountNotMidasGreenlisted, creditAccountFrozen, creditAccountNotEmpty, creditAccountNotFound, creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, liquidatorNotEligible, malformedTransaction, marketExpired, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, notEmergencyLiquidator, partialLiquidationImpossible, poolPaused, poolSunset, quotaAboveMax, quotaCountExceeded, quotaInactive, quotaLimitReached, quotaUnchanged, reservePriceLimited, rwaOpenRequirementsNotMet, unexpectedFailure, unpriceableTokenError, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress };
7
+ export { AccountNotMidasGreenlistedError, BorrowLimitCause, CollateralLimits, CreditAccountFrozenError, CreditAccountNotEmptyError, CreditAccountNotFoundError, CreditManagerPausedError, DebtOutOfRangeError, ForbiddenTokenError, IGearboxError, InsufficientAllowanceError, InsufficientBalanceError, InsufficientBorrowAllowanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, InvalidDelayedIntentError, LeverageLimits, LeverageOutOfRangeError, LiquidatorNotEligibleError, MalformedTransactionError, MarketExpiredError, MultipleDelayedWithdrawalsError, NoDelayedRouteError, NoRecordedIntentError, NoStrategyTargetCollateralError, NotEmergencyLiquidatorError, OperationLimitOptions, PartialLiquidationImpossibleError, PoolOperationPreviewError, PoolPausedError, PoolSunsetError, QuotaAboveMaxError, QuotaCountExceededError, QuotaInactiveError, QuotaInputLimits, QuotaLimitReachedError, QuotaUnchangedError, RWAOpenRequirementsError, ReservePriceLimitedError, UnexpectedFailureError, UnpriceableTokenError, UnsupportedCollateralTokenError, UnsupportedOperationError, UnsupportedPoolFunctionError, UnsupportedTargetError, UnsupportedTokenPairError, UnsupportedZapperFunctionError, WithdrawalInProgressError, accountNotMidasGreenlisted, creditAccountFrozen, creditAccountNotEmpty, creditAccountNotFound, creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientBorrowAllowance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, liquidatorNotEligible, malformedTransaction, marketExpired, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, notEmergencyLiquidator, partialLiquidationImpossible, poolPaused, poolSunset, quotaAboveMax, quotaCountExceeded, quotaInactive, quotaLimitReached, quotaUnchanged, reservePriceLimited, rwaOpenRequirementsNotMet, unexpectedFailure, unpriceableTokenError, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress };
@@ -317,6 +317,25 @@ export interface InsufficientAllowanceError extends IGearboxError {
317
317
  }
318
318
  /** {@inheritDoc InsufficientAllowanceError} */
319
319
  export declare function insufficientAllowance(args: Omit<InsufficientAllowanceError, "code" | "message">): InsufficientAllowanceError;
320
+ /**
321
+ * `owner` has not delegated `spender` enough credit on an Aave variable debt
322
+ * token for what the operation borrows as the owner — the `approveDelegation`
323
+ * counterpart of {@link InsufficientAllowanceError}.
324
+ **/
325
+ export interface InsufficientBorrowAllowanceError extends IGearboxError {
326
+ code: "insufficientBorrowAllowance";
327
+ owner: Address;
328
+ /** The Horizon bridge, which borrows as `owner`. */
329
+ spender: Address;
330
+ /** The variable debt token `approveDelegation` is called on. */
331
+ debtToken: Address;
332
+ /** In the borrowed token. */
333
+ required: TokenAmount;
334
+ /** What is delegated today. */
335
+ allowed: TokenAmount;
336
+ }
337
+ /** {@inheritDoc InsufficientBorrowAllowanceError} */
338
+ export declare function insufficientBorrowAllowance(args: Omit<InsufficientBorrowAllowanceError, "code" | "message">): InsufficientBorrowAllowanceError;
320
339
  /**
321
340
  * The RWA protocol still wants something from the borrower before this token
322
341
  * can be opened on.
@@ -1,20 +1,20 @@
1
1
  import { Amount, Asset, AssetType, Bps, ChainId, Leverage, Timestamp, Token, TokenAmount, TxCall, UnderlyingToken } from "./primitives.js";
2
2
  import { Curator, CuratorName } from "./curators.js";
3
+ import { ChainScopedFilter, FILTER_ALL, FilterAll, Filterable, isFilterSet } from "./filters.js";
3
4
  import { DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedWithdrawCollateralIntent } from "./delayed-intents.js";
4
5
  import { IGearboxError } from "./errors/base.js";
5
6
  import { CreditAccountFrozenError, LiquidatorNotEligibleError, NotEmergencyLiquidatorError, PartialLiquidationImpossibleError, creditAccountFrozen, liquidatorNotEligible, notEmergencyLiquidator, partialLiquidationImpossible } from "./errors/liquidation-errors.js";
6
7
  import { KYC_REGISTRATION_LINKS, KycProtocol, KycRequirement, MidasOpenAccountRequirements, RWAFactoryType, RWAMissingOpenAccountRequirements, RWAOpenAccountRequirements, RWAOperationArgs, RWAProtocol, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_PROTOCOLS, SECURITIZE_REGISTER_VAULT_TYPES, SecuritizeMissingOpenAccountRequirements, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature } from "./rwa.js";
7
- import { AccountNotMidasGreenlistedError, BorrowLimitCause, CollateralLimits, CreditManagerPausedError, DebtOutOfRangeError, ForbiddenTokenError, InsufficientAllowanceError, InsufficientBalanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, LeverageLimits, LeverageOutOfRangeError, MarketExpiredError, OperationLimitOptions, PoolPausedError, PoolSunsetError, QuotaAboveMaxError, QuotaCountExceededError, QuotaInactiveError, QuotaInputLimits, QuotaLimitReachedError, QuotaUnchangedError, RWAOpenRequirementsError, ReservePriceLimitedError, accountNotMidasGreenlisted, creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, marketExpired, poolPaused, poolSunset, quotaAboveMax, quotaCountExceeded, quotaInactive, quotaLimitReached, quotaUnchanged, reservePriceLimited, rwaOpenRequirementsNotMet } from "./errors/operation-errors.js";
8
+ import { AccountNotMidasGreenlistedError, BorrowLimitCause, CollateralLimits, CreditManagerPausedError, DebtOutOfRangeError, ForbiddenTokenError, InsufficientAllowanceError, InsufficientBalanceError, InsufficientBorrowAllowanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, LeverageLimits, LeverageOutOfRangeError, MarketExpiredError, OperationLimitOptions, PoolPausedError, PoolSunsetError, QuotaAboveMaxError, QuotaCountExceededError, QuotaInactiveError, QuotaInputLimits, QuotaLimitReachedError, QuotaUnchangedError, RWAOpenRequirementsError, ReservePriceLimitedError, accountNotMidasGreenlisted, creditManagerPaused, debtOutOfRange, forbiddenToken, insufficientAllowance, insufficientBalance, insufficientBorrowAllowance, insufficientCollateral, insufficientPoolLiquidity, leverageOutOfRange, marketExpired, poolPaused, poolSunset, quotaAboveMax, quotaCountExceeded, quotaInactive, quotaLimitReached, quotaUnchanged, reservePriceLimited, rwaOpenRequirementsNotMet } from "./errors/operation-errors.js";
8
9
  import { UnpriceableTokenError, unpriceableTokenError } from "./errors/oracle-errors.js";
9
10
  import { CreditAccountNotEmptyError, CreditAccountNotFoundError, MultipleDelayedWithdrawalsError, NoDelayedRouteError, NoRecordedIntentError, NoStrategyTargetCollateralError, UnexpectedFailureError, UnsupportedCollateralTokenError, UnsupportedTokenPairError, WithdrawalInProgressError, creditAccountNotEmpty, creditAccountNotFound, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, unexpectedFailure, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress } from "./errors/prepare-errors.js";
10
11
  import { InvalidDelayedIntentError, MalformedTransactionError, PoolOperationPreviewError, UnsupportedOperationError, UnsupportedPoolFunctionError, UnsupportedTargetError, UnsupportedZapperFunctionError, malformedTransaction } from "./errors/preview-errors.js";
11
12
  import "./errors/index.js";
12
- import { ChainScopedFilter, FILTER_ALL, FilterAll, Filterable, isFilterSet } from "./filters.js";
13
+ import { AccountHoldings, AccountMetrics, AccountProjection, AccountStateChange, AdjustStrategyPositionPreview, CreditOperationMarket, DelayedStrategyPositionOperationPreview, Estimated, EstimatedProjection, ExitStrategyPositionPreview, InstantStrategyPositionOperationPreview, OpenAavePositionPreview, OpenStrategyPositionPreview, OperationPreview, PoolOperationType, PoolPositionOperationPreview, PreviewOperationInput, PreviewOperationOptions, RepayStrategyPositionPreview, RoutedField, asEstimated } from "./previews.js";
13
14
  import { DelayedReceivedAsset, InstantReceivedAsset, LiquidatableAccount, LiquidatableAccountFilter, LiquidationApproval, LiquidationDetails, LiquidationPosition, ReceivedAsset, matchesLiquidatableAccountFilter } from "./liquidations.js";
14
15
  import { ApyBreakdown, Opportunity, OpportunityBase, OpportunityDetail, OpportunityFilter, OpportunityId, OpportunityKey, OpportunityKind, OpportunityTotals, PointRewards, PointsProgram, PoolOpportunity, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, PriceFeedData, PriceFeedSummary, QuotaAsset, RateCurve, RateCurvePoint, Rewards, StrategyOpportunity, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef, TokenRewards, matchesOpportunityFilter, opportunityId, poolOpportunityId, strategyOpportunityId } from "./opportunities.js";
15
16
  import { BorrowRateBreakdown, PnlBreakdown, PointsProgramPnL, PointsRewardsPnL, PoolPosition, PoolPositionKey, PoolPositionRef, Position, PositionCollateral, PositionFilter, PositionId, PositionKey, PositionKind, PositionTransaction, PositionTransactionKind, PositionsTotals, RewardsPnL, STRATEGY_POSITION_COLLATERAL_ERROR, StrategyPosition, StrategyPositionKey, StrategyPositionRef, TokenQuotaRate, TokenRewardsPnL, liquidationPositionId, matchesPositionFilter, poolPositionId, positionId, strategyPositionId } from "./positions.js";
16
- import { AccountHoldings, AccountMetrics, AccountProjection, AccountStateChange, AdjustStrategyPositionPreview, CreditOperationMarket, DelayedStrategyPositionOperationPreview, Estimated, EstimatedProjection, ExitStrategyPositionPreview, InstantStrategyPositionOperationPreview, OpenAavePositionPreview, OpenStrategyPositionPreview, OperationPreview, PoolOperationType, PoolPositionOperationPreview, PreviewOperationInput, PreviewOperationOptions, RepayStrategyPositionPreview, RoutedField, asEstimated } from "./previews.js";
17
- import { AavePositionProjection } from "./aave.js";
17
+ import { AaveBridgeBorrow, AavePosition, AavePositionProjection } from "./aave.js";
18
18
  import { CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, ChartBundle, ChartDenomination, ChartMetric, ChartQuery, ChartRange, ChartSeries, ChartSeriesOk, ChartSeriesUnavailable, ChartUnavailableCode, ChartUnit, ChartValue, ChartWindow, GridSampling, OpportunityChartMetric, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, PROTOCOL_CHART_METRICS, PoolOpportunityChartMetric, PoolPositionChartMetric, PositionChartMetric, ProtocolChartMetric, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, StrategyOpportunityChartMetric, StrategyPositionChartMetric } from "./charts.js";
19
19
  import { AnalyticsChartQuery, AnalyticsContractOption, AnalyticsContractRef, AnalyticsCuratorOption, AnalyticsLiquidationPosition, AnalyticsPoolPosition, AnalyticsPosition, AnalyticsPositionFilterOptions, AnalyticsPositionListOptions, AnalyticsPositionOwner, AnalyticsPositionPage, AnalyticsPositionSortField, AnalyticsSortDirection, AnalyticsStrategyPosition } from "./analytics.js";
20
20
  import { ANALYTICS_POSITIONS_DEFAULT_LIMIT, ANALYTICS_POSITIONS_MAX_LIMIT, analyticsChartQueryOptionsSchema, analyticsChartQueryParamsSchema, analyticsChartQuerySchema, analyticsContractOptionSchema, analyticsContractRefSchema, analyticsCuratorOptionSchema, analyticsPositionFilterOptionsQuerySchema, analyticsPositionFilterOptionsSchema, analyticsPositionListOptionsSchema, analyticsPositionListQueryParamsSchema, analyticsPositionListQuerySchema, analyticsPositionPageSchema, analyticsPositionSchema, analyticsPositionSortFieldSchema, analyticsSortDirectionSchema } from "./analytics.schema.js";
@@ -33,4 +33,4 @@ import { MerklReward, PointsReward, Reward } from "./rewards.js";
33
33
  import { kycRequirementSchema, rwaProtocolSchema } from "./rwa.schema.js";
34
34
  import { PositionClaimableWithdrawal, PositionPendingWithdrawal, PositionWithdrawals, WithdrawalOutputAmount } from "./withdrawals.js";
35
35
  import { positionClaimableWithdrawalSchema, positionPendingWithdrawalSchema, positionWithdrawalsSchema, withdrawalOutputAmountSchema } from "./withdrawals.schema.js";
36
- export { ANALYTICS_POSITIONS_DEFAULT_LIMIT, ANALYTICS_POSITIONS_MAX_LIMIT, AavePositionProjection, AccountHoldings, AccountMetrics, AccountNotMidasGreenlistedError, AccountProjection, AccountStateChange, AdjustStrategyPositionPreview, Amount, AnalyticsChartQuery, AnalyticsContractOption, AnalyticsContractRef, AnalyticsCuratorOption, AnalyticsLiquidationPosition, AnalyticsPoolPosition, AnalyticsPosition, AnalyticsPositionFilterOptions, AnalyticsPositionListOptions, AnalyticsPositionOwner, AnalyticsPositionPage, AnalyticsPositionSortField, AnalyticsSortDirection, AnalyticsStrategyPosition, ApyBreakdown, Asset, AssetType, BorrowLimitCause, BorrowRateBreakdown, Bps, CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, ChainFailed, ChainId, ChainMetadata, ChainScoped, ChainScopedFilter, ChainSucceeded, ChartBundle, ChartDenomination, ChartMetric, ChartQuery, ChartRange, ChartSeries, ChartSeriesOk, ChartSeriesUnavailable, ChartUnavailableCode, ChartUnit, ChartValue, ChartWindow, CollateralLimits, CompareTag, CompareTolerance, CreditAccountFrozenError, CreditAccountNotEmptyError, CreditAccountNotFoundError, CreditManagerPausedError, CreditOperationMarket, Curator, CuratorName, DataResponse, DataSource, DebtOutOfRangeError, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedReceivedAsset, DelayedStrategyPositionOperationPreview, DelayedWithdrawCollateralIntent, Estimated, EstimatedProjection, ExitStrategyPositionPreview, FILTER_ALL, FilterAll, Filterable, ForbiddenTokenError, GridSampling, IGearboxError, InstantReceivedAsset, InstantStrategyPositionOperationPreview, InsufficientAllowanceError, InsufficientBalanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, InvalidDelayedIntentError, KYC_REGISTRATION_LINKS, KycProtocol, KycRequirement, Leverage, LeverageLimits, LeverageOutOfRangeError, LiquidatableAccount, LiquidatableAccountFilter, LiquidationApproval, LiquidationDetails, LiquidationPosition, LiquidatorNotEligibleError, MalformedTransactionError, MarketExpiredError, MerklReward, MidasOpenAccountRequirements, MultipleDelayedWithdrawalsError, NoDelayedRouteError, NoRecordedIntentError, NoStrategyTargetCollateralError, NotEmergencyLiquidatorError, OpenAavePositionPreview, OpenStrategyPositionPreview, OperationLimitOptions, OperationPreview, Opportunity, OpportunityBase, OpportunityChartMetric, OpportunityDetail, OpportunityFilter, OpportunityId, OpportunityKey, OpportunityKind, OpportunityTotals, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, PROTOCOL_CHART_METRICS, PartialLiquidationImpossibleError, PnlBreakdown, PointRewards, PointsProgram, PointsProgramPnL, PointsReward, PointsRewardsPnL, PoolOperationPreviewError, PoolOperationType, PoolOpportunity, PoolOpportunityChartMetric, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, PoolPausedError, PoolPosition, PoolPositionChartMetric, PoolPositionKey, PoolPositionOperationPreview, PoolPositionRef, PoolSunsetError, Position, PositionChartMetric, PositionClaimableWithdrawal, PositionCollateral, PositionFilter, PositionId, PositionKey, PositionKind, PositionPendingWithdrawal, PositionTransaction, PositionTransactionKind, PositionWithdrawals, PositionsTotals, PreviewOperationInput, PreviewOperationOptions, PriceFeedData, PriceFeedSummary, ProtocolChartMetric, QuotaAboveMaxError, QuotaAsset, QuotaCountExceededError, QuotaInactiveError, QuotaInputLimits, QuotaLimitReachedError, QuotaUnchangedError, RWAFactoryType, RWAMissingOpenAccountRequirements, RWAOpenAccountRequirements, RWAOpenRequirementsError, RWAOperationArgs, RWAProtocol, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_PROTOCOLS, RateCurve, RateCurvePoint, ReceivedAsset, RepayStrategyPositionPreview, ReservePriceLimitedError, ResponseMetadata, Reward, Rewards, RewardsPnL, RoutedField, SDKError, SDKResult, SDKReturn, SECURITIZE_REGISTER_VAULT_TYPES, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, STRATEGY_POSITION_COLLATERAL_ERROR, SafeValue, SecuritizeMissingOpenAccountRequirements, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature, StrategyOpportunity, StrategyOpportunityChartMetric, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef, StrategyPosition, StrategyPositionChartMetric, StrategyPositionKey, StrategyPositionRef, Timestamp, Token, TokenAmount, TokenQuotaRate, TokenRewards, TokenRewardsPnL, ToleranceCompareTag, TxCall, UnderlyingToken, UnexpectedFailureError, UnpriceableTokenError, UnsupportedCollateralTokenError, UnsupportedOperationError, UnsupportedPoolFunctionError, UnsupportedTargetError, UnsupportedTokenPairError, UnsupportedZapperFunctionError, WithdrawalInProgressError, WithdrawalOutputAmount, accountNotMidasGreenlisted, amountSchema, analyticsChartQueryOptionsSchema, analyticsChartQueryParamsSchema, analyticsChartQuerySchema, analyticsContractOptionSchema, analyticsContractRefSchema, analyticsCuratorOptionSchema, analyticsPositionFilterOptionsQuerySchema, analyticsPositionFilterOptionsSchema, analyticsPositionListOptionsSchema, analyticsPositionListQueryParamsSchema, analyticsPositionListQuerySchema, analyticsPositionPageSchema, analyticsPositionSchema, analyticsPositionSortFieldSchema, analyticsSortDirectionSchema, apyBreakdownSchema, asEstimated, assetTypeSchema, backendPreferred, booleanParamSchema, borrowRateBreakdownSchema, bpsSchema, chainFailedSchema, chainIdSchema, chainMetadataSchema, chainSucceededSchema, chartBundleSchemaFor, chartDenominationSchema, chartMetricSchema, chartQueryCodec, chartQueryParamsSchema, chartQuerySchema, chartRangeSchema, chartSeriesSchema, chartValueSchema, chartWindowSchema, compareTagOf, creditAccountFrozen, creditAccountNotEmpty, creditAccountNotFound, creditManagerPaused, curatorNameSchema, curatorSchema, dataSourceSchema, debtOutOfRange, delayedReceivedAssetSchema, encodeFlag, filterAllSchema, filterable, forbiddenToken, instantReceivedAssetSchema, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, isFilterSet, kycRequirementSchema, leverageOutOfRange, leverageSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionId, liquidationPositionSchema, liquidatorNotEligible, malformedTransaction, marketExpired, matchesLiquidatableAccountFilter, matchesOpportunityFilter, matchesPositionFilter, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, notEmergencyLiquidator, offchainOnly, onchainOnly, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityId, opportunityKeySchema, opportunityKindSchema, opportunitySchema, opportunityTotalsSchema, partialLiquidationImpossible, pnlBreakdownSchema, pointRewardsSchema, pointsProgramPnLSchema, pointsProgramSchema, pointsRewardsPnLSchema, poolOpportunityChartMetricSchema, poolOpportunityDetailSchema, poolOpportunityId, poolOpportunityKeySchema, poolOpportunitySchema, poolPaused, poolPositionChartMetricSchema, poolPositionId, poolPositionKeySchema, poolPositionSchema, poolSunset, positionClaimableWithdrawalSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionId, positionKeySchema, positionKindSchema, positionPendingWithdrawalSchema, positionSchema, positionTransactionKindSchema, positionTransactionSchema, positionWithdrawalsSchema, positionsTotalsSchema, priceFeedDataSchema, priceFeedSummarySchema, protocolChartMetricSchema, quotaAboveMax, quotaAssetSchema, quotaCountExceeded, quotaInactive, quotaLimitReached, quotaUnchanged, rateCurvePointSchema, rateCurveSchema, receivedAssetSchema, reservePriceLimited, responseMetadataSchema, responseSchema, rewardsPnLSchema, rewardsSchema, rwaOpenRequirementsNotMet, rwaProtocolSchema, safeValue, sdkErr, sdkOk, strategyOpportunityChartMetricSchema, strategyOpportunityDetailSchema, strategyOpportunityId, strategyOpportunityKeySchema, strategyOpportunitySchema, strategyPositionChartMetricSchema, strategyPositionId, strategyPositionKeySchema, strategyPositionSchema, timestampSchema, tokenAmountSchema, tokenQuotaRateSchema, tokenRewardsPnLSchema, tokenRewardsSchema, tokenSchema, tolerance, txCallSchema, underlyingTokenSchema, unexpectedFailure, unpriceableTokenError, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress, withdrawalOutputAmountSchema };
36
+ export { ANALYTICS_POSITIONS_DEFAULT_LIMIT, ANALYTICS_POSITIONS_MAX_LIMIT, AaveBridgeBorrow, AavePosition, AavePositionProjection, AccountHoldings, AccountMetrics, AccountNotMidasGreenlistedError, AccountProjection, AccountStateChange, AdjustStrategyPositionPreview, Amount, AnalyticsChartQuery, AnalyticsContractOption, AnalyticsContractRef, AnalyticsCuratorOption, AnalyticsLiquidationPosition, AnalyticsPoolPosition, AnalyticsPosition, AnalyticsPositionFilterOptions, AnalyticsPositionListOptions, AnalyticsPositionOwner, AnalyticsPositionPage, AnalyticsPositionSortField, AnalyticsSortDirection, AnalyticsStrategyPosition, ApyBreakdown, Asset, AssetType, BorrowLimitCause, BorrowRateBreakdown, Bps, CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, ChainFailed, ChainId, ChainMetadata, ChainScoped, ChainScopedFilter, ChainSucceeded, ChartBundle, ChartDenomination, ChartMetric, ChartQuery, ChartRange, ChartSeries, ChartSeriesOk, ChartSeriesUnavailable, ChartUnavailableCode, ChartUnit, ChartValue, ChartWindow, CollateralLimits, CompareTag, CompareTolerance, CreditAccountFrozenError, CreditAccountNotEmptyError, CreditAccountNotFoundError, CreditManagerPausedError, CreditOperationMarket, Curator, CuratorName, DataResponse, DataSource, DebtOutOfRangeError, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedReceivedAsset, DelayedStrategyPositionOperationPreview, DelayedWithdrawCollateralIntent, Estimated, EstimatedProjection, ExitStrategyPositionPreview, FILTER_ALL, FilterAll, Filterable, ForbiddenTokenError, GridSampling, IGearboxError, InstantReceivedAsset, InstantStrategyPositionOperationPreview, InsufficientAllowanceError, InsufficientBalanceError, InsufficientBorrowAllowanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, InvalidDelayedIntentError, KYC_REGISTRATION_LINKS, KycProtocol, KycRequirement, Leverage, LeverageLimits, LeverageOutOfRangeError, LiquidatableAccount, LiquidatableAccountFilter, LiquidationApproval, LiquidationDetails, LiquidationPosition, LiquidatorNotEligibleError, MalformedTransactionError, MarketExpiredError, MerklReward, MidasOpenAccountRequirements, MultipleDelayedWithdrawalsError, NoDelayedRouteError, NoRecordedIntentError, NoStrategyTargetCollateralError, NotEmergencyLiquidatorError, OpenAavePositionPreview, OpenStrategyPositionPreview, OperationLimitOptions, OperationPreview, Opportunity, OpportunityBase, OpportunityChartMetric, OpportunityDetail, OpportunityFilter, OpportunityId, OpportunityKey, OpportunityKind, OpportunityTotals, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, PROTOCOL_CHART_METRICS, PartialLiquidationImpossibleError, PnlBreakdown, PointRewards, PointsProgram, PointsProgramPnL, PointsReward, PointsRewardsPnL, PoolOperationPreviewError, PoolOperationType, PoolOpportunity, PoolOpportunityChartMetric, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, PoolPausedError, PoolPosition, PoolPositionChartMetric, PoolPositionKey, PoolPositionOperationPreview, PoolPositionRef, PoolSunsetError, Position, PositionChartMetric, PositionClaimableWithdrawal, PositionCollateral, PositionFilter, PositionId, PositionKey, PositionKind, PositionPendingWithdrawal, PositionTransaction, PositionTransactionKind, PositionWithdrawals, PositionsTotals, PreviewOperationInput, PreviewOperationOptions, PriceFeedData, PriceFeedSummary, ProtocolChartMetric, QuotaAboveMaxError, QuotaAsset, QuotaCountExceededError, QuotaInactiveError, QuotaInputLimits, QuotaLimitReachedError, QuotaUnchangedError, RWAFactoryType, RWAMissingOpenAccountRequirements, RWAOpenAccountRequirements, RWAOpenRequirementsError, RWAOperationArgs, RWAProtocol, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_PROTOCOLS, RateCurve, RateCurvePoint, ReceivedAsset, RepayStrategyPositionPreview, ReservePriceLimitedError, ResponseMetadata, Reward, Rewards, RewardsPnL, RoutedField, SDKError, SDKResult, SDKReturn, SECURITIZE_REGISTER_VAULT_TYPES, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, STRATEGY_POSITION_COLLATERAL_ERROR, SafeValue, SecuritizeMissingOpenAccountRequirements, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature, StrategyOpportunity, StrategyOpportunityChartMetric, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef, StrategyPosition, StrategyPositionChartMetric, StrategyPositionKey, StrategyPositionRef, Timestamp, Token, TokenAmount, TokenQuotaRate, TokenRewards, TokenRewardsPnL, ToleranceCompareTag, TxCall, UnderlyingToken, UnexpectedFailureError, UnpriceableTokenError, UnsupportedCollateralTokenError, UnsupportedOperationError, UnsupportedPoolFunctionError, UnsupportedTargetError, UnsupportedTokenPairError, UnsupportedZapperFunctionError, WithdrawalInProgressError, WithdrawalOutputAmount, accountNotMidasGreenlisted, amountSchema, analyticsChartQueryOptionsSchema, analyticsChartQueryParamsSchema, analyticsChartQuerySchema, analyticsContractOptionSchema, analyticsContractRefSchema, analyticsCuratorOptionSchema, analyticsPositionFilterOptionsQuerySchema, analyticsPositionFilterOptionsSchema, analyticsPositionListOptionsSchema, analyticsPositionListQueryParamsSchema, analyticsPositionListQuerySchema, analyticsPositionPageSchema, analyticsPositionSchema, analyticsPositionSortFieldSchema, analyticsSortDirectionSchema, apyBreakdownSchema, asEstimated, assetTypeSchema, backendPreferred, booleanParamSchema, borrowRateBreakdownSchema, bpsSchema, chainFailedSchema, chainIdSchema, chainMetadataSchema, chainSucceededSchema, chartBundleSchemaFor, chartDenominationSchema, chartMetricSchema, chartQueryCodec, chartQueryParamsSchema, chartQuerySchema, chartRangeSchema, chartSeriesSchema, chartValueSchema, chartWindowSchema, compareTagOf, creditAccountFrozen, creditAccountNotEmpty, creditAccountNotFound, creditManagerPaused, curatorNameSchema, curatorSchema, dataSourceSchema, debtOutOfRange, delayedReceivedAssetSchema, encodeFlag, filterAllSchema, filterable, forbiddenToken, instantReceivedAssetSchema, insufficientAllowance, insufficientBalance, insufficientBorrowAllowance, insufficientCollateral, insufficientPoolLiquidity, isFilterSet, kycRequirementSchema, leverageOutOfRange, leverageSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionId, liquidationPositionSchema, liquidatorNotEligible, malformedTransaction, marketExpired, matchesLiquidatableAccountFilter, matchesOpportunityFilter, matchesPositionFilter, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, notEmergencyLiquidator, offchainOnly, onchainOnly, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityId, opportunityKeySchema, opportunityKindSchema, opportunitySchema, opportunityTotalsSchema, partialLiquidationImpossible, pnlBreakdownSchema, pointRewardsSchema, pointsProgramPnLSchema, pointsProgramSchema, pointsRewardsPnLSchema, poolOpportunityChartMetricSchema, poolOpportunityDetailSchema, poolOpportunityId, poolOpportunityKeySchema, poolOpportunitySchema, poolPaused, poolPositionChartMetricSchema, poolPositionId, poolPositionKeySchema, poolPositionSchema, poolSunset, positionClaimableWithdrawalSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionId, positionKeySchema, positionKindSchema, positionPendingWithdrawalSchema, positionSchema, positionTransactionKindSchema, positionTransactionSchema, positionWithdrawalsSchema, positionsTotalsSchema, priceFeedDataSchema, priceFeedSummarySchema, protocolChartMetricSchema, quotaAboveMax, quotaAssetSchema, quotaCountExceeded, quotaInactive, quotaLimitReached, quotaUnchanged, rateCurvePointSchema, rateCurveSchema, receivedAssetSchema, reservePriceLimited, responseMetadataSchema, responseSchema, rewardsPnLSchema, rewardsSchema, rwaOpenRequirementsNotMet, rwaProtocolSchema, safeValue, sdkErr, sdkOk, strategyOpportunityChartMetricSchema, strategyOpportunityDetailSchema, strategyOpportunityId, strategyOpportunityKeySchema, strategyOpportunitySchema, strategyPositionChartMetricSchema, strategyPositionId, strategyPositionKeySchema, strategyPositionSchema, timestampSchema, tokenAmountSchema, tokenQuotaRateSchema, tokenRewardsPnLSchema, tokenRewardsSchema, tokenSchema, tolerance, txCallSchema, underlyingTokenSchema, unexpectedFailure, unpriceableTokenError, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress, withdrawalOutputAmountSchema };
@@ -1,7 +1,7 @@
1
1
  import { Amount, AssetType, Bps, ChainId, Leverage, Timestamp, Token, UnderlyingToken } from "./primitives.js";
2
2
  import { Curator } from "./curators.js";
3
- import { KycRequirement } from "./rwa.js";
4
3
  import { ChainScopedFilter, Filterable } from "./filters.js";
4
+ import { KycRequirement } from "./rwa.js";
5
5
  import { Address } from "viem";
6
6
  //#region src/model/opportunities.d.ts
7
7
  /**
@@ -5,7 +5,7 @@ import { RWAOperationArgs } from "./rwa.js";
5
5
  import { UnpriceableTokenError } from "./errors/oracle-errors.js";
6
6
  import "./errors/index.js";
7
7
  import { BorrowRateBreakdown } from "./positions.js";
8
- import { AavePositionProjection } from "./aave.js";
8
+ import { AaveBridgeBorrow, AavePositionProjection } from "./aave.js";
9
9
  import { Address, Hex } from "viem";
10
10
  //#region src/model/previews.d.ts
11
11
  /**
@@ -406,13 +406,19 @@ export interface OpenStrategyPositionPreview extends OpenStrategyPositionProject
406
406
  * flow.
407
407
  */
408
408
  midasGreenlistsAccount?: boolean;
409
+ /**
410
+ * Loans the Horizon bridge takes as the account owner when the opening
411
+ * moves to Aave within its own transaction; the other fields then describe
412
+ * the account as it stands just before the move. Absent when it takes none.
413
+ */
414
+ aaveBorrows?: AaveBridgeBorrow[];
409
415
  }
410
416
  /**
411
417
  * What an Aave Horizon opening that already exists would do — the counterpart
412
418
  * of `prepare.openAavePosition`, read off calldata rather than planned into it.
413
419
  *
414
420
  * The fields it shares with {@link OpenStrategyPositionPreview} describe the
415
- * Gearbox credit account the position is built in while the mint settles.
421
+ * Gearbox credit account the position is built in, before it moves to Aave.
416
422
  **/
417
423
  export interface OpenAavePositionPreview extends OpenStrategyPositionPreview {
418
424
  /**
@@ -455,6 +461,11 @@ export interface AdjustStrategyPositionPreview extends EstimatedProjection, Acco
455
461
  * multicall claims a delayed withdrawal
456
462
  */
457
463
  intent?: DelayedIntent;
464
+ /**
465
+ * Loans the Horizon bridge takes as the account owner in this transaction;
466
+ * absent when it takes none.
467
+ */
468
+ aaveBorrows?: AaveBridgeBorrow[];
458
469
  /**
459
470
  * The oracle could not price a token; it contributes nothing to the values.
460
471
  */
@@ -548,6 +559,11 @@ export interface RepayStrategyPositionPreview extends EstimatedProjection {
548
559
  * multicall claims a delayed withdrawal
549
560
  */
550
561
  intent?: DelayedIntent;
562
+ /**
563
+ * Loans the Horizon bridge takes as the account owner in this transaction,
564
+ * the ones a move to Aave repays with; absent when it takes none.
565
+ */
566
+ aaveBorrows?: AaveBridgeBorrow[];
551
567
  /**
552
568
  * The oracle could not price a token; it contributes nothing to the values.
553
569
  */
@@ -1,6 +1,6 @@
1
1
  import { SDKConstruct } from "../../base/SDKConstruct.js";
2
2
  import "../../base/index.js";
3
- import { AccountToCheck, GetConnectedBotsResponse, SetBotProps, SetBotResult } from "./types.js";
3
+ import { AccountToCheck, GetConnectedBotsResponse, MarketBot, SetBotProps, SetBotResult } from "./types.js";
4
4
  import { Address } from "viem";
5
5
  //#region src/onchain/accounts/bots/AccountBotsService.d.ts
6
6
  /**
@@ -11,6 +11,16 @@ import { Address } from "viem";
11
11
  **/
12
12
  export declare class AccountBotsService extends SDKConstruct {
13
13
  #private;
14
+ /**
15
+ * The bots a market configurator lists among its periphery contracts.
16
+ *
17
+ * Read once per configurator and kept for the service's lifetime: the list
18
+ * changes only when the curator adds or removes a bot. A failed read is not
19
+ * kept, so the next call tries again.
20
+ *
21
+ * @param marketConfigurator - Configurator to list the bots of.
22
+ **/
23
+ getMarketBots(marketConfigurator: Address): Promise<readonly MarketBot[]>;
14
24
  /**
15
25
  * Reads the bots connected to each of the given credit accounts.
16
26
  *
@@ -1,4 +1,4 @@
1
- import { AccountToCheck, BotStatusCall, BotsDirectResponse, CMSlice, ConnectedBotsCall, ConnectedBotsPerAccount, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, MulticallWithFailure, SetBotProps, SetBotResult } from "./types.js";
1
+ import { AccountToCheck, BotStatusCall, BotsDirectResponse, CMSlice, ConnectedBotsCall, ConnectedBotsPerAccount, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, MarketBot, MulticallWithFailure, SetBotProps, SetBotResult } from "./types.js";
2
2
  import { AccountBotsService } from "./AccountBotsService.js";
3
3
  import { PeripheryCompressorV310Contract } from "./PeripheryCompressorV310Contract.js";
4
- export { AccountBotsService, AccountToCheck, BotStatusCall, BotsDirectResponse, CMSlice, ConnectedBotsCall, ConnectedBotsPerAccount, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, MulticallWithFailure, PeripheryCompressorV310Contract, SetBotProps, SetBotResult };
4
+ export { AccountBotsService, AccountToCheck, BotStatusCall, BotsDirectResponse, CMSlice, ConnectedBotsCall, ConnectedBotsPerAccount, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, MarketBot, MulticallWithFailure, PeripheryCompressorV310Contract, SetBotProps, SetBotResult };
@@ -5,7 +5,7 @@ import { RouterCASlice } from "../../router/types.js";
5
5
  import "../../router/index.js";
6
6
  import "../../base/index.js";
7
7
  import { CreditAccountOperationResult, CreditManagerOperationResult } from "../types.js";
8
- import { Address, ContractFunctionParameters } from "viem";
8
+ import { Address, ContractFunctionParameters, ContractFunctionReturnType } from "viem";
9
9
  //#region src/onchain/accounts/bots/types.d.ts
10
10
  /**
11
11
  * @internal
@@ -13,6 +13,12 @@ import { Address, ContractFunctionParameters } from "viem";
13
13
  * it can be batched with calls to other contracts.
14
14
  **/
15
15
  export type ConnectedBotsCall = ContractFunctionParameters<typeof peripheryCompressorAbi, "pure" | "view", "getConnectedBots">;
16
+ /**
17
+ * A bot a market configurator lists among its periphery contracts, as the
18
+ * periphery compressor's `getBots` reports it: the bot's own version, contract
19
+ * type and serialized state, and the permissions it requires.
20
+ **/
21
+ export type MarketBot = ContractFunctionReturnType<typeof peripheryCompressorAbi, "pure" | "view", "getBots">[number];
16
22
  /**
17
23
  * @internal
18
24
  * Descriptor of a `getBotStatus` call on a bot list, so that it can be batched
@@ -14,14 +14,14 @@ import { WithdrawalCompressorV311Contract } from "./withdrawal-compressor/Withdr
14
14
  import { WithdrawalCompressorV313Contract } from "./withdrawal-compressor/WithdrawalCompressorV313Contract.js";
15
15
  import "./withdrawal-compressor/index.js";
16
16
  import { AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, ClaimFarmRewardsProps, CreditAccountOperationResult, CreditManagerOperationResult, EncodableCreditAccountOperation, GetApprovalAddressProps, ICreditAccountsService, OpenCAProps, PreviewDelayedWithdrawalProps, Rewards } from "./types.js";
17
- import { AccountToCheck, BotStatusCall, BotsDirectResponse, CMSlice, ConnectedBotsCall, ConnectedBotsPerAccount, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, MulticallWithFailure, SetBotProps, SetBotResult } from "./bots/types.js";
17
+ import { AccountToCheck, BotStatusCall, BotsDirectResponse, CMSlice, ConnectedBotsCall, ConnectedBotsPerAccount, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, MarketBot, MulticallWithFailure, SetBotProps, SetBotResult } from "./bots/types.js";
18
18
  import { AccountBotsService } from "./bots/AccountBotsService.js";
19
19
  import { PeripheryCompressorV310Contract } from "./bots/PeripheryCompressorV310Contract.js";
20
20
  import "./bots/index.js";
21
21
  import { CreditAccountsServiceV310 } from "./CreditAccountsServiceV310.js";
22
22
  import { CalcDefaultQuotaProps, CalcQuotaUpdateProps, CalcRecommendedQuotaProps, DIRECT_TRANSFERS_QUOTA, MaxAmountForQuotaProps, calcDefaultQuota, calcQuotaUpdate, calcRecommendedQuota, maxAmountForQuota, roundUpQuota } from "./quota-utils.js";
23
23
  import { AccountCalculatorOperation } from "./intents/operations.js";
24
- import { AddCollateralIntent, AdjustLeverageIntent, ClaimRemainder, CreditAccountSlice, DelayableIntent, DelayedRoute, DelayedStart, DelayedStartResult, DepositStrategyIntent, ExecutionCost, FinishIntentProps, FinishIntentResult, InstantRoute, IntentPreviewResult, IntentRoutesResult, OperationState, PathLossRate, RefusedIntent, RepayStrategyIntent, ResumableIntent, RouteErrors, StartIntent, UpdateQuotaIntent, WithPartialState, WithdrawAssetIntent, WithdrawCeilings, WithdrawStrategyIntent } from "./intents/types.js";
24
+ import { AaveHoldings, AddCollateralIntent, AdjustLeverageIntent, ClaimRemainder, CloseAavePositionIntent, CreditAccountSlice, DelayableIntent, DelayedRoute, DelayedStart, DelayedStartResult, DepositStrategyIntent, ExecutionCost, FinishIntentProps, FinishIntentResult, InstantRoute, IntentPreviewResult, IntentRoutesResult, OperationState, PathLossRate, RedeemingIntent, RefusedIntent, RepayStrategyIntent, ResumableIntent, RouteErrors, StartIntent, UpdateQuotaIntent, WithPartialState, WithdrawAssetIntent, WithdrawCeilings, WithdrawStrategyIntent } from "./intents/types.js";
25
25
  import { BorrowProps, BorrowState } from "./intents/borrow.js";
26
26
  import { LeverageBand } from "./intents/leverage-band.js";
27
27
  import { OpenStrategyProps, OpenStrategyState } from "./intents/open-strategy.js";
@@ -34,4 +34,4 @@ import { OptimalPartialLiquidation, OptimalPartialLiquidationProps, PartialLiqui
34
34
  import { LiquidationsService } from "./liquidations/LiquidationsService.js";
35
35
  import { MultichainLiquidationsService } from "./liquidations/MultichainLiquidationsService.js";
36
36
  import "./liquidations/index.js";
37
- export { AbstractWithdrawalCompressorContract, AccountBotsService, type AccountCalculatorOperation, AccountToCheck, type AddCollateralIntent, type AdjustLeverageIntent, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, BorrowPreviewResult, type BorrowProps, type BorrowState, BotStatusCall, BotsDirectResponse, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, BuildPartialLiquidationTxProps, BuildPartialLiquidationTxPropsBase, CMSlice, CalcDefaultQuotaProps, CalcQuotaUpdateProps, CalcRecommendedQuotaProps, ClaimFarmRewardsProps, type ClaimRemainder, ClaimableWithdrawal, ConnectedBotsCall, ConnectedBotsPerAccount, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountDataCall, CreditAccountFilter, CreditAccountOperationResult, CreditAccountOperationsService, CreditAccountReadOptions, type CreditAccountSlice, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsServiceV310, CreditAccountsTarget, CreditManagerFilter, CreditManagerOperationResult, CurrentWithdrawals, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DIRECT_TRANSFERS_QUOTA, type DelayableIntent, DelayedIntentExtended, type DelayedRoute, type DelayedStart, type DelayedStartResult, type DepositStrategyIntent, EmptyAccountPreviewResult, EncodableCreditAccountOperation, type ExecutionCost, type FinishIntentProps, type FinishIntentResult, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetExternalAccountCurrentWithdrawalsProps, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetPartialLiquidationDetailsProps, GetPartialLiquidationDetailsPropsBase, GetWithdrawalRequestResultProps, ICreditAccountsService, IRedemptionLoggerContract, IWithdrawalCompressorContract, type InstantRoute, type IntentPreviewResult, type IntentRoutesResult, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, type LeverageBand, LiquidationsService, LoadRWALiquidatorsProps, MaxAmountForQuotaProps, MulticallWithFailure, MultichainLiquidationsService, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, OnchainRequestableWithdrawal, OpenCAProps, OpenStrategyPreviewResult, type OpenStrategyProps, type OpenStrategyState, type OperationState, OptimalPartialLiquidation, OptimalPartialLiquidationProps, PartialLiquidationParams, PartialLiquidationParamsProps, type PathLossRate, PendingWithdrawal, PeripheryCompressorV310Contract, PreviewDelayedWithdrawalProps, RWALiquidatorInfo, RedemptionLog, RedemptionLoggerV310Contract, type RefusedIntent, type RepayStrategyIntent, RequestableWithdrawal, type ResumableIntent, Rewards, type RouteErrors, SetBotProps, SetBotResult, type StartIntent, type UpdateQuotaIntent, type WithPartialState, type WithdrawAssetIntent, type WithdrawCeilings, type WithdrawStrategyIntent, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, calcDefaultQuota, calcQuotaUpdate, calcRecommendedQuota, createRedemptionLogger, createWithdrawalCompressor, decodeDelayedIntent, encodeDelayedIntent, fetchCreditAccountSlice, getWithdrawalCompressorAddress, iCreditAccountAbi, isPhantomToken, maxAmountForQuota, optimalPartialLiquidation, partialLiquidationParams, roundUpQuota, toClaimableWithdrawal, toCreditAccountSlice, toPendingWithdrawal, toRequestableWithdrawal, toWithdrawalStatus };
37
+ export { type AaveHoldings, AbstractWithdrawalCompressorContract, AccountBotsService, type AccountCalculatorOperation, AccountToCheck, type AddCollateralIntent, type AdjustLeverageIntent, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, BorrowPreviewResult, type BorrowProps, type BorrowState, BotStatusCall, BotsDirectResponse, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, BuildPartialLiquidationTxProps, BuildPartialLiquidationTxPropsBase, CMSlice, CalcDefaultQuotaProps, CalcQuotaUpdateProps, CalcRecommendedQuotaProps, ClaimFarmRewardsProps, type ClaimRemainder, ClaimableWithdrawal, type CloseAavePositionIntent, ConnectedBotsCall, ConnectedBotsPerAccount, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountDataCall, CreditAccountFilter, CreditAccountOperationResult, CreditAccountOperationsService, CreditAccountReadOptions, type CreditAccountSlice, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsServiceV310, CreditAccountsTarget, CreditManagerFilter, CreditManagerOperationResult, CurrentWithdrawals, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DIRECT_TRANSFERS_QUOTA, type DelayableIntent, DelayedIntentExtended, type DelayedRoute, type DelayedStart, type DelayedStartResult, type DepositStrategyIntent, EmptyAccountPreviewResult, EncodableCreditAccountOperation, type ExecutionCost, type FinishIntentProps, type FinishIntentResult, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetExternalAccountCurrentWithdrawalsProps, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetPartialLiquidationDetailsProps, GetPartialLiquidationDetailsPropsBase, GetWithdrawalRequestResultProps, ICreditAccountsService, IRedemptionLoggerContract, IWithdrawalCompressorContract, type InstantRoute, type IntentPreviewResult, type IntentRoutesResult, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, type LeverageBand, LiquidationsService, LoadRWALiquidatorsProps, MarketBot, MaxAmountForQuotaProps, MulticallWithFailure, MultichainLiquidationsService, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, OnchainRequestableWithdrawal, OpenCAProps, OpenStrategyPreviewResult, type OpenStrategyProps, type OpenStrategyState, type OperationState, OptimalPartialLiquidation, OptimalPartialLiquidationProps, PartialLiquidationParams, PartialLiquidationParamsProps, type PathLossRate, PendingWithdrawal, PeripheryCompressorV310Contract, PreviewDelayedWithdrawalProps, RWALiquidatorInfo, type RedeemingIntent, RedemptionLog, RedemptionLoggerV310Contract, type RefusedIntent, type RepayStrategyIntent, RequestableWithdrawal, type ResumableIntent, Rewards, type RouteErrors, SetBotProps, SetBotResult, type StartIntent, type UpdateQuotaIntent, type WithPartialState, type WithdrawAssetIntent, type WithdrawCeilings, type WithdrawStrategyIntent, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, calcDefaultQuota, calcQuotaUpdate, calcRecommendedQuota, createRedemptionLogger, createWithdrawalCompressor, decodeDelayedIntent, encodeDelayedIntent, fetchCreditAccountSlice, getWithdrawalCompressorAddress, iCreditAccountAbi, isPhantomToken, maxAmountForQuota, optimalPartialLiquidation, partialLiquidationParams, roundUpQuota, toClaimableWithdrawal, toCreditAccountSlice, toPendingWithdrawal, toRequestableWithdrawal, toWithdrawalStatus };
@@ -3,7 +3,7 @@ import "../../../model/index.js";
3
3
  import { SDKConstruct } from "../../base/SDKConstruct.js";
4
4
  import { IntentValidationError } from "../../validation/raise.js";
5
5
  import { AccountCalculatorOperation } from "./operations.js";
6
- import { AddCollateralIntent, AdjustLeverageIntent, ClaimRemainder, CreditAccountSlice, DelayableIntent, DelayedRoute, DelayedStart, DelayedStartResult, DepositStrategyIntent, ExecutionCost, FinishIntentProps, FinishIntentResult, InstantRoute, IntentPreviewResult, IntentRoutesResult, OperationState, PathLossRate, RefusedIntent, RepayStrategyIntent, ResumableIntent, RouteErrors, StartIntent, StartIntentProps, UpdateQuotaIntent, WithPartialState, WithdrawAssetIntent, WithdrawCeilings, WithdrawStrategyIntent } from "./types.js";
6
+ import { AaveHoldings, AddCollateralIntent, AdjustLeverageIntent, ClaimRemainder, CloseAavePositionIntent, CreditAccountSlice, DelayableIntent, DelayedRoute, DelayedStart, DelayedStartResult, DepositStrategyIntent, ExecutionCost, FinishIntentProps, FinishIntentResult, InstantRoute, IntentPreviewResult, IntentRoutesResult, OperationState, PathLossRate, RedeemingIntent, RefusedIntent, RepayStrategyIntent, ResumableIntent, RouteErrors, StartIntent, StartIntentProps, UpdateQuotaIntent, WithPartialState, WithdrawAssetIntent, WithdrawCeilings, WithdrawStrategyIntent } from "./types.js";
7
7
  import { BorrowProps, BorrowState } from "./borrow.js";
8
8
  import { LeverageBand, LeverageBandProps } from "./leverage-band.js";
9
9
  import { MaxBorrowProps } from "./maxBorrow.js";
@@ -190,7 +190,25 @@ export declare class CreditAccountOperationsService extends SDKConstruct {
190
190
  * does not exist for the account at all
191
191
  */
192
192
  startDelayedIntent(props: StartIntentProps & {
193
- intent: DelayableIntent;
193
+ intent: RedeemingIntent;
194
+ }): Promise<DelayedStartResult>;
195
+ /**
196
+ * Previews leaving `owner`'s Aave Horizon position in `token` in one
197
+ * transaction, see {@link CloseAavePositionIntent}.
198
+ *
199
+ * What the owner holds and owes on Aave is read here, at the block the SDK
200
+ * stands at; the rest is {@link startDelayedIntent}, tail included.
201
+ *
202
+ * @param props - Account slice, quota reserve and slippage, the RWA, the
203
+ * wallet the exit pays, and the owner the bridge resolves for the account:
204
+ * the investor of an RWA factory account, the borrower otherwise
205
+ * @returns The request transaction, the state the exit ends in and what it
206
+ * recorded for the tail, or `{ ok: false, error }`
207
+ */
208
+ closeAavePositionIntent(props: StartIntentProps & {
209
+ token: Address;
210
+ to: Address;
211
+ owner: Address;
194
212
  }): Promise<DelayedStartResult>;
195
213
  /**
196
214
  * Previews a delayable intent both ways at once: settled by the router now,
@@ -286,4 +304,4 @@ export declare class CreditAccountOperationsService extends SDKConstruct {
286
304
  borrowIntent(props: BorrowProps): Promise<BorrowPreviewResult>;
287
305
  }
288
306
  //#endregion
289
- export { type AccountCalculatorOperation, type AddCollateralIntent, type AdjustLeverageIntent, type BorrowProps, type BorrowState, type ClaimRemainder, type CreditAccountSlice, type DelayableIntent, type DelayedRoute, type DelayedStart, type DelayedStartResult, type DepositStrategyIntent, type ExecutionCost, type FinishIntentProps, type FinishIntentResult, type InstantRoute, type IntentPreviewResult, type IntentRoutesResult, type LeverageBand, type OpenStrategyProps, type OpenStrategyState, type OperationState, type PathLossRate, type RefusedIntent, type RepayStrategyIntent, type ResumableIntent, type RouteErrors, type StartIntent, type UpdateQuotaIntent, type WithPartialState, type WithdrawAssetIntent, type WithdrawCeilings, type WithdrawStrategyIntent, fetchCreditAccountSlice, isPhantomToken, toCreditAccountSlice };
307
+ export { type AaveHoldings, type AccountCalculatorOperation, type AddCollateralIntent, type AdjustLeverageIntent, type BorrowProps, type BorrowState, type ClaimRemainder, type CloseAavePositionIntent, type CreditAccountSlice, type DelayableIntent, type DelayedRoute, type DelayedStart, type DelayedStartResult, type DepositStrategyIntent, type ExecutionCost, type FinishIntentProps, type FinishIntentResult, type InstantRoute, type IntentPreviewResult, type IntentRoutesResult, type LeverageBand, type OpenStrategyProps, type OpenStrategyState, type OperationState, type PathLossRate, type RedeemingIntent, type RefusedIntent, type RepayStrategyIntent, type ResumableIntent, type RouteErrors, type StartIntent, type UpdateQuotaIntent, type WithPartialState, type WithdrawAssetIntent, type WithdrawCeilings, type WithdrawStrategyIntent, fetchCreditAccountSlice, isPhantomToken, toCreditAccountSlice };
@@ -19,7 +19,7 @@ import { Address } from "viem";
19
19
  * plus the quoted amounts the preview and the tests read, plus the RWA legs
20
20
  * that come from their own assemblers rather than from `assembleCaOperations`.
21
21
  */
22
- export type AccountCalculatorOperation = AddCollateralOperation | IncreaseDebtOperation | DecreaseDebtOperation | SwapOperation | WithdrawCollateralOperation | QuotaUpdateOperation | WrapRwaCollateralOperation | UnwrapRwaCollateralOperation | StartDelayedWithdrawalOperation | ClaimDelayedWithdrawalOperation | AaveSupplyOperation | AaveOpenPositionOperation;
22
+ export type AccountCalculatorOperation = AddCollateralOperation | IncreaseDebtOperation | DecreaseDebtOperation | SwapOperation | WithdrawCollateralOperation | QuotaUpdateOperation | WrapRwaCollateralOperation | UnwrapRwaCollateralOperation | StartDelayedWithdrawalOperation | ClaimDelayedWithdrawalOperation | AaveClosePositionOperation | AaveWithdrawOperation;
23
23
  /**
24
24
  * Compile-time proof that the engine's operations really are the SDK's own
25
25
  * encodable ones with the quoted amounts attached, so the two cannot drift into
@@ -214,39 +214,43 @@ export declare function buildClaimDelayedWithdrawalOperation(input: {
214
214
  creditAccount: CreditAccountSlice;
215
215
  sdk: OnchainSDK;
216
216
  }): ClaimDelayedWithdrawalOperation;
217
- /** Supplies an asset to the Aave pool; the aTokens are minted one for one. */
218
- export interface AaveSupplyOperation {
219
- type: "aaveSupply";
220
- token: Address;
221
- aToken: Address;
222
- amount: bigint;
223
- calls: MultiCall[];
224
- }
225
- export declare function buildAaveSupplyOperation(input: {
226
- adapter: AaveV3PoolAdapterContract;
227
- token: Address;
228
- aToken: Address;
229
- amount: bigint;
230
- }): AaveSupplyOperation;
231
217
  /**
232
- * Hands the aTokens to the account owner and borrows against them on the
233
- * owner's Aave position, into the account.
218
+ * Repays `repayAmount` of the owner's Aave debt out of the account and brings
219
+ * `aTokenAmount` of the owner's aTokens into it, through the Horizon bridge.
234
220
  */
235
- export interface AaveOpenPositionOperation {
236
- type: "aaveOpenPosition";
221
+ export interface AaveClosePositionOperation {
222
+ type: "aaveClosePosition";
237
223
  aToken: Address;
238
224
  aTokenAmount: bigint;
239
225
  debtToken: Address;
240
- borrowAmount: bigint;
226
+ repayAmount: bigint;
241
227
  calls: MultiCall[];
242
228
  }
243
- export declare function buildAaveOpenPositionOperation(input: {
229
+ export declare function buildAaveClosePositionOperation(input: {
244
230
  adapter: AaveHorizonBridgeAdapterContract;
245
231
  aToken: Address;
246
232
  aTokenAmount: bigint;
247
233
  debtToken: Address;
248
- borrowAmount: bigint;
249
- }): AaveOpenPositionOperation;
234
+ repayAmount: bigint;
235
+ }): AaveClosePositionOperation;
236
+ /**
237
+ * Withdraws an asset from the Aave pool for every aToken of it on the account,
238
+ * one for one. The call names no amount, as the supply does, and `amount` is
239
+ * the balance the projection was built on.
240
+ */
241
+ export interface AaveWithdrawOperation {
242
+ type: "aaveWithdraw";
243
+ token: Address;
244
+ aToken: Address;
245
+ amount: bigint;
246
+ calls: MultiCall[];
247
+ }
248
+ export declare function buildAaveWithdrawOperation(input: {
249
+ adapter: AaveV3PoolAdapterContract;
250
+ token: Address;
251
+ aToken: Address;
252
+ amount: bigint;
253
+ }): AaveWithdrawOperation;
250
254
  /**
251
255
  * What a request or a claim puts on the account right away, as opposed to what
252
256
  * only the phantom token represents.
@@ -3,7 +3,7 @@ import { OperationLimitOptions } from "../../../model/errors/operation-errors.js
3
3
  import "../../../model/index.js";
4
4
  import { ClaimableWithdrawal } from "../withdrawal-compressor/types.js";
5
5
  import { OnchainSDK } from "../../OnchainSDK.js";
6
- import { AddCollateralIntent, AdjustLeverageIntent, BorrowAndWithdrawIntent, DepositStrategyIntent, MoveToAaveIntent, RepayStrategyIntent, UpdateQuotaIntent, WithdrawAssetIntent, WithdrawStrategyIntent } from "./types.js";
6
+ import { AddCollateralIntent, AdjustLeverageIntent, BorrowAndWithdrawIntent, CloseAavePositionIntent, DepositStrategyIntent, RepayStrategyIntent, UpdateQuotaIntent, WithdrawAssetIntent, WithdrawStrategyIntent } from "./types.js";
7
7
  import { DebtLimits } from "./math.js";
8
8
  import { Address } from "viem";
9
9
  //#region src/onchain/accounts/intents/plan.d.ts
@@ -83,12 +83,15 @@ export type Step = {
83
83
  } |
84
84
  /**
85
85
  * Hands whatever is left on the account to `to`, each balance in the token it
86
- * stands in. Only an exit asks for this: the amounts are whatever the legs
87
- * before it happen to leave, which no planner can name in advance.
86
+ * stands in. Only a plan that leaves no debt asks for this: the amounts are
87
+ * whatever the legs before it happen to leave, which no planner can name in
88
+ * advance. `token` limits it to that balance, the underlying of an RWA
89
+ * market leaving as the asset it wraps.
88
90
  */
89
91
  {
90
92
  kind: "sweep";
91
93
  to: Address;
94
+ token?: Address;
92
95
  } |
93
96
  /**
94
97
  * Drops every quota the account holds, in the same transaction and before
@@ -109,20 +112,21 @@ export type Step = {
109
112
  token: Address;
110
113
  quota: bigint | undefined;
111
114
  } |
112
- /** Supplies `amount` of `token` to the Aave pool, for its aToken. */
115
+ /**
116
+ * Repays `repay` of the owner's Aave debt out of the account, in the asset
117
+ * Aave lends, and brings `aTokenAmount` of the owner's aTokens of `token`
118
+ * back into the account through the Horizon bridge.
119
+ */
113
120
  {
114
- kind: "aaveSupply";
121
+ kind: "aaveClosePosition";
115
122
  token: Address;
116
- amount: bigint;
123
+ repay: bigint;
124
+ aTokenAmount: bigint;
117
125
  } |
118
- /**
119
- * Hands every aToken of `token` the account holds to its owner through the
120
- * Horizon bridge, which borrows `borrow` of the underlying into the account.
121
- */
126
+ /** Withdraws `token` from the Aave pool for every aToken of it on the account. */
122
127
  {
123
- kind: "aaveOpenPosition";
128
+ kind: "aaveWithdraw";
124
129
  token: Address;
125
- borrow: bigint;
126
130
  };
127
131
  /** What a planner is allowed to know about the account. */
128
132
  export interface AccountView {
@@ -166,15 +170,15 @@ export declare function planDeposit(intent: Omit<DepositStrategyIntent, "type">,
166
170
  */
167
171
  export declare function planRepay(intent: Omit<RepayStrategyIntent, "type">, view: AccountView): Step[];
168
172
  /**
169
- * The position leaves for Aave Horizon: the RWA is supplied to the Aave pool,
170
- * its aTokens go to the owner with a loan against them, and that loan settles
171
- * the account's own.
173
+ * The owner's Aave position comes back and leaves: the account borrows what
174
+ * the owner owes on Aave, the bridge repays it and returns the aTokens, the
175
+ * pool turns them back into the RWA, and the RWA is requested for redemption
176
+ * with an exit recorded for the tail — all in one transaction.
172
177
  *
173
- * Aave lends the debt plus the {@link SETTLE_MARGIN} headroom, since the facade
174
- * is told to repay everything outstanding by the time the transaction lands;
175
- * what it does not take stays on the account.
178
+ * The repayment is the debt plus {@link CLOSE_AAVE_WINDOW} of interest at the
179
+ * current rate, see {@link CloseAavePositionIntent}.
176
180
  */
177
- export declare function planMoveToAave(intent: Omit<MoveToAaveIntent, "type">, view: AccountView): Step[];
181
+ export declare function planCloseAavePosition(intent: Omit<CloseAavePositionIntent, "type">, view: AccountView): Step[];
178
182
  /**
179
183
  * One token's quota changes; no balance moves and debt is untouched.
180
184
  *
@@ -0,0 +1,16 @@
1
+ import { OnchainSDK } from "../../OnchainSDK.js";
2
+ import { AaveHoldings } from "./types.js";
3
+ import "../../index.js";
4
+ import { Address } from "viem";
5
+ //#region src/onchain/accounts/intents/readAaveHoldings.d.ts
6
+ /**
7
+ * What `owner` holds and owes on the Aave pool the credit manager supplies
8
+ * `token` to: its aTokens of `token`, and its variable debt in the asset the
9
+ * Horizon bridge lends there — the underlying, or the asset an RWA underlying
10
+ * wraps.
11
+ *
12
+ * Refused with `unsupportedCollateralToken` when no Aave pool adapter of the
13
+ * credit manager lists `token`.
14
+ */
15
+ export declare function readAaveHoldings(sdk: OnchainSDK, creditManager: Address, owner: Address, token: Address): Promise<AaveHoldings>;
16
+ //#endregion