@gearbox-protocol/sdk 18.4.0 → 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 (231) 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 +2 -4
  5. package/dist/cjs/offchain/GearboxAPI.js +0 -7
  6. package/dist/cjs/offchain/index.js +0 -3
  7. package/dist/cjs/onchain/accounts/bots/AccountBotsService.js +29 -0
  8. package/dist/cjs/onchain/accounts/bots/PeripheryCompressorV310Contract.js +2 -1
  9. package/dist/cjs/onchain/accounts/index.js +1 -1
  10. package/dist/cjs/onchain/accounts/intents/index.js +33 -0
  11. package/dist/cjs/onchain/accounts/intents/operations.js +21 -0
  12. package/dist/cjs/onchain/accounts/intents/plan.js +55 -0
  13. package/dist/cjs/onchain/accounts/intents/readAaveHoldings.js +56 -0
  14. package/dist/cjs/onchain/accounts/intents/realize.js +84 -2
  15. package/dist/cjs/onchain/accounts/intents/testing/market.js +1 -0
  16. package/dist/cjs/onchain/accounts/intents/testing/sdk-mock.js +3 -2
  17. package/dist/cjs/onchain/accounts/intents/utils/ledger.js +8 -0
  18. package/dist/cjs/onchain/chain/chains.js +4 -0
  19. package/dist/cjs/onchain/index.js +25 -1
  20. package/dist/cjs/onchain/market/ZapperRegister.js +1 -1
  21. package/dist/cjs/onchain/market/adapters/abi/aave/iAaveHorizonBridge.js +94 -0
  22. package/dist/cjs/onchain/market/adapters/abi/aave/iAaveOracle.js +20 -0
  23. package/dist/cjs/onchain/market/adapters/abi/aave/iAaveV3Pool.js +278 -0
  24. package/dist/cjs/onchain/market/adapters/abi/aave/iPoolAddressesProvider.js +11 -0
  25. package/dist/cjs/onchain/market/adapters/abi/aave/iVariableDebtToken.js +17 -0
  26. package/dist/cjs/onchain/market/adapters/abi/aave/index.js +11 -0
  27. package/dist/cjs/onchain/market/adapters/abi/actionAbi.js +1 -0
  28. package/dist/cjs/onchain/market/adapters/abi/adapters/iAaveHorizonBridgeAdapter.js +224 -0
  29. package/dist/cjs/onchain/market/adapters/abi/adapters/iAaveV3PoolAdapter.js +177 -0
  30. package/dist/cjs/onchain/market/adapters/abi/adapters/index.js +4 -0
  31. package/dist/cjs/onchain/market/adapters/abi/conctructorAbi.js +2 -0
  32. package/dist/cjs/onchain/market/adapters/abi/index.js +17 -0
  33. package/dist/cjs/onchain/market/adapters/abi/securitize/iSecuritizeNAVProvider.js +15 -0
  34. package/dist/cjs/onchain/market/adapters/abi/securitize/index.js +2 -0
  35. package/dist/cjs/onchain/market/adapters/contracts/AaveHorizonBridgeAdapterContract.js +218 -0
  36. package/dist/cjs/onchain/market/adapters/contracts/AaveV3PoolAdapterContract.js +213 -0
  37. package/dist/cjs/onchain/market/adapters/contracts/AbstractAdapter.js +8 -0
  38. package/dist/cjs/onchain/market/adapters/contracts/SecuritizeRedemptionGatewayAdapterContract.js +42 -5
  39. package/dist/cjs/onchain/market/adapters/contracts/index.js +4 -0
  40. package/dist/cjs/onchain/market/adapters/createAdapter.js +4 -0
  41. package/dist/cjs/onchain/market/adapters/index.js +20 -0
  42. package/dist/cjs/onchain/market/adapters/types.js +2 -0
  43. package/dist/cjs/onchain/market/index.js +20 -0
  44. package/dist/cjs/onchain/market/rwa/securitize/SecuritizeRWAFactory.js +9 -0
  45. package/dist/cjs/onchain/positions/MultichainPositionsService.js +15 -0
  46. package/dist/cjs/onchain/positions/PositionsService.js +31 -0
  47. package/dist/cjs/onchain/positions/aaveMoveCalls.js +45 -0
  48. package/dist/cjs/onchain/positions/projectAavePosition.js +178 -0
  49. package/dist/cjs/onchain/positions/readAavePosition.js +152 -0
  50. package/dist/cjs/onchain/preview/index.js +2 -0
  51. package/dist/cjs/onchain/preview/preview/aaveBridgeBorrows.js +24 -0
  52. package/dist/cjs/onchain/preview/preview/aaveMoveStart.js +27 -0
  53. package/dist/cjs/onchain/preview/preview/index.js +2 -0
  54. package/dist/cjs/onchain/preview/preview/loadAdapterReplayState.js +17 -0
  55. package/dist/cjs/onchain/preview/preview/previewAdjustStrategyPosition.js +3 -0
  56. package/dist/cjs/onchain/preview/preview/previewExitOrRepayStrategyPosition.js +5 -2
  57. package/dist/cjs/onchain/preview/preview/previewOpenStrategyPosition.js +4 -1
  58. package/dist/cjs/onchain/preview/preview/previewOperation.js +33 -8
  59. package/dist/cjs/onchain/validation/bundles/checkAaveDelegation.js +54 -0
  60. package/dist/cjs/onchain/validation/bundles/checkCreditOperation.js +36 -11
  61. package/dist/cjs/onchain/validation/bundles/index.js +2 -0
  62. package/dist/cjs/onchain/validation/checkOperation.js +16 -4
  63. package/dist/cjs/onchain/validation/index.js +2 -0
  64. package/dist/cjs/sdk/GearboxSDK.js +0 -9
  65. package/dist/cjs/sdk/execute/ExecuteApi.js +1 -0
  66. package/dist/cjs/sdk/positions/PositionsNamespace.js +6 -0
  67. package/dist/cjs/sdk/prepare/PrepareApi.js +98 -0
  68. package/dist/cjs/sdk/preview/PreviewNamespace.js +42 -0
  69. package/dist/esm/abi/rwa/iSecuritizeRWAFactory.js +15 -0
  70. package/dist/esm/model/errors/index.js +2 -2
  71. package/dist/esm/model/errors/operation-errors.js +9 -1
  72. package/dist/esm/model/index.js +3 -4
  73. package/dist/esm/offchain/GearboxAPI.js +0 -7
  74. package/dist/esm/offchain/index.js +1 -3
  75. package/dist/esm/onchain/accounts/bots/AccountBotsService.js +29 -0
  76. package/dist/esm/onchain/accounts/bots/PeripheryCompressorV310Contract.js +1 -1
  77. package/dist/esm/onchain/accounts/index.js +1 -1
  78. package/dist/esm/onchain/accounts/intents/index.js +34 -1
  79. package/dist/esm/onchain/accounts/intents/operations.js +20 -1
  80. package/dist/esm/onchain/accounts/intents/plan.js +56 -2
  81. package/dist/esm/onchain/accounts/intents/readAaveHoldings.js +55 -0
  82. package/dist/esm/onchain/accounts/intents/realize.js +86 -4
  83. package/dist/esm/onchain/accounts/intents/testing/market.js +1 -0
  84. package/dist/esm/onchain/accounts/intents/testing/sdk-mock.js +3 -2
  85. package/dist/esm/onchain/accounts/intents/utils/ledger.js +8 -0
  86. package/dist/esm/onchain/chain/chains.js +4 -0
  87. package/dist/esm/onchain/index.js +14 -2
  88. package/dist/esm/onchain/market/ZapperRegister.js +1 -1
  89. package/dist/esm/onchain/market/adapters/abi/aave/iAaveHorizonBridge.js +93 -0
  90. package/dist/esm/onchain/market/adapters/abi/aave/iAaveOracle.js +19 -0
  91. package/dist/esm/onchain/market/adapters/abi/aave/iAaveV3Pool.js +277 -0
  92. package/dist/esm/onchain/market/adapters/abi/aave/iPoolAddressesProvider.js +10 -0
  93. package/dist/esm/onchain/market/adapters/abi/aave/iVariableDebtToken.js +16 -0
  94. package/dist/esm/onchain/market/adapters/abi/aave/index.js +6 -0
  95. package/dist/esm/onchain/market/adapters/abi/actionAbi.js +1 -0
  96. package/dist/esm/onchain/market/adapters/abi/adapters/iAaveHorizonBridgeAdapter.js +223 -0
  97. package/dist/esm/onchain/market/adapters/abi/adapters/iAaveV3PoolAdapter.js +176 -0
  98. package/dist/esm/onchain/market/adapters/abi/adapters/index.js +3 -1
  99. package/dist/esm/onchain/market/adapters/abi/conctructorAbi.js +2 -0
  100. package/dist/esm/onchain/market/adapters/abi/index.js +10 -1
  101. package/dist/esm/onchain/market/adapters/abi/securitize/iSecuritizeNAVProvider.js +14 -0
  102. package/dist/esm/onchain/market/adapters/abi/securitize/index.js +2 -1
  103. package/dist/esm/onchain/market/adapters/contracts/AaveHorizonBridgeAdapterContract.js +217 -0
  104. package/dist/esm/onchain/market/adapters/contracts/AaveV3PoolAdapterContract.js +212 -0
  105. package/dist/esm/onchain/market/adapters/contracts/AbstractAdapter.js +8 -0
  106. package/dist/esm/onchain/market/adapters/contracts/SecuritizeRedemptionGatewayAdapterContract.js +43 -6
  107. package/dist/esm/onchain/market/adapters/contracts/index.js +3 -1
  108. package/dist/esm/onchain/market/adapters/createAdapter.js +4 -0
  109. package/dist/esm/onchain/market/adapters/index.js +11 -1
  110. package/dist/esm/onchain/market/adapters/types.js +2 -0
  111. package/dist/esm/onchain/market/index.js +11 -1
  112. package/dist/esm/onchain/market/rwa/securitize/SecuritizeRWAFactory.js +9 -0
  113. package/dist/esm/onchain/positions/MultichainPositionsService.js +15 -0
  114. package/dist/esm/onchain/positions/PositionsService.js +31 -0
  115. package/dist/esm/onchain/positions/aaveMoveCalls.js +44 -0
  116. package/dist/esm/onchain/positions/projectAavePosition.js +177 -0
  117. package/dist/esm/onchain/positions/readAavePosition.js +151 -0
  118. package/dist/esm/onchain/preview/index.js +2 -1
  119. package/dist/esm/onchain/preview/preview/aaveBridgeBorrows.js +23 -0
  120. package/dist/esm/onchain/preview/preview/aaveMoveStart.js +26 -0
  121. package/dist/esm/onchain/preview/preview/index.js +2 -1
  122. package/dist/esm/onchain/preview/preview/loadAdapterReplayState.js +16 -0
  123. package/dist/esm/onchain/preview/preview/previewAdjustStrategyPosition.js +3 -0
  124. package/dist/esm/onchain/preview/preview/previewExitOrRepayStrategyPosition.js +5 -2
  125. package/dist/esm/onchain/preview/preview/previewOpenStrategyPosition.js +4 -1
  126. package/dist/esm/onchain/preview/preview/previewOperation.js +33 -8
  127. package/dist/esm/onchain/validation/bundles/checkAaveDelegation.js +53 -0
  128. package/dist/esm/onchain/validation/bundles/checkCreditOperation.js +36 -11
  129. package/dist/esm/onchain/validation/bundles/index.js +2 -1
  130. package/dist/esm/onchain/validation/checkOperation.js +16 -4
  131. package/dist/esm/onchain/validation/index.js +2 -1
  132. package/dist/esm/sdk/GearboxSDK.js +0 -9
  133. package/dist/esm/sdk/execute/ExecuteApi.js +1 -0
  134. package/dist/esm/sdk/positions/PositionsNamespace.js +6 -0
  135. package/dist/esm/sdk/prepare/PrepareApi.js +99 -1
  136. package/dist/esm/sdk/preview/PreviewNamespace.js +42 -0
  137. package/dist/types/abi/rwa/iSecuritizeRWAFactory.d.ts +14 -0
  138. package/dist/types/model/aave.d.ts +89 -0
  139. package/dist/types/model/analytics.d.ts +2 -2
  140. package/dist/types/model/errors/index.d.ts +2 -2
  141. package/dist/types/model/errors/operation-errors.d.ts +19 -0
  142. package/dist/types/model/index.d.ts +6 -7
  143. package/dist/types/model/positions.d.ts +1 -1
  144. package/dist/types/model/previews.d.ts +31 -0
  145. package/dist/types/offchain/AbstractOffchainNamespace.d.ts +1 -1
  146. package/dist/types/offchain/GearboxAPI.d.ts +0 -6
  147. package/dist/types/offchain/analytics/OffchainAnalytics.d.ts +1 -1
  148. package/dist/types/offchain/analytics/types.d.ts +1 -1
  149. package/dist/types/offchain/index.d.ts +1 -3
  150. package/dist/types/offchain/opportunities/OffchainOpportunities.d.ts +1 -1
  151. package/dist/types/offchain/opportunities/types.d.ts +1 -1
  152. package/dist/types/offchain/positions/OffchainPositions.d.ts +1 -1
  153. package/dist/types/offchain/positions/types.d.ts +1 -1
  154. package/dist/types/onchain/accounts/bots/AccountBotsService.d.ts +11 -1
  155. package/dist/types/onchain/accounts/bots/index.d.ts +2 -2
  156. package/dist/types/onchain/accounts/bots/types.d.ts +7 -1
  157. package/dist/types/onchain/accounts/index.d.ts +3 -3
  158. package/dist/types/onchain/accounts/intents/index.d.ts +21 -3
  159. package/dist/types/onchain/accounts/intents/operations.d.ts +41 -1
  160. package/dist/types/onchain/accounts/intents/plan.d.ts +32 -3
  161. package/dist/types/onchain/accounts/intents/readAaveHoldings.d.ts +16 -0
  162. package/dist/types/onchain/accounts/intents/testing/market.d.ts +4 -0
  163. package/dist/types/onchain/accounts/intents/testing/sdk-mock.d.ts +4 -0
  164. package/dist/types/onchain/accounts/intents/types.d.ts +42 -0
  165. package/dist/types/onchain/index.d.ts +16 -4
  166. package/dist/types/onchain/market/adapters/abi/aave/iAaveHorizonBridge.d.ts +83 -0
  167. package/dist/types/onchain/market/adapters/abi/aave/iAaveOracle.d.ts +22 -0
  168. package/dist/types/onchain/market/adapters/abi/aave/iAaveV3Pool.d.ts +229 -0
  169. package/dist/types/onchain/market/adapters/abi/aave/iPoolAddressesProvider.d.ts +11 -0
  170. package/dist/types/onchain/market/adapters/abi/aave/iVariableDebtToken.d.ts +17 -0
  171. package/dist/types/onchain/market/adapters/abi/aave/index.d.ts +6 -0
  172. package/dist/types/onchain/market/adapters/abi/adapters/iAaveHorizonBridgeAdapter.d.ts +207 -0
  173. package/dist/types/onchain/market/adapters/abi/adapters/iAaveV3PoolAdapter.d.ts +172 -0
  174. package/dist/types/onchain/market/adapters/abi/adapters/index.d.ts +3 -1
  175. package/dist/types/onchain/market/adapters/abi/index.d.ts +10 -1
  176. package/dist/types/onchain/market/adapters/abi/securitize/iSecuritizeNAVProvider.d.ts +13 -0
  177. package/dist/types/onchain/market/adapters/abi/securitize/index.d.ts +2 -1
  178. package/dist/types/onchain/market/adapters/contracts/AaveHorizonBridgeAdapterContract.d.ts +361 -0
  179. package/dist/types/onchain/market/adapters/contracts/AaveV3PoolAdapterContract.d.ts +455 -0
  180. package/dist/types/onchain/market/adapters/contracts/AbstractAdapter.d.ts +8 -0
  181. package/dist/types/onchain/market/adapters/contracts/SecuritizeRedemptionGatewayAdapterContract.d.ts +19 -4
  182. package/dist/types/onchain/market/adapters/contracts/index.d.ts +3 -1
  183. package/dist/types/onchain/market/adapters/index.d.ts +11 -1
  184. package/dist/types/onchain/market/adapters/types.d.ts +3 -1
  185. package/dist/types/onchain/market/index.d.ts +11 -1
  186. package/dist/types/onchain/market/rwa/securitize/SecuritizeRWAFactory.d.ts +20 -0
  187. package/dist/types/onchain/market/rwa/types.d.ts +6 -0
  188. package/dist/types/onchain/positions/MultichainPositionsService.d.ts +7 -1
  189. package/dist/types/onchain/positions/PositionsService.d.ts +16 -2
  190. package/dist/types/onchain/positions/aaveMoveCalls.d.ts +30 -0
  191. package/dist/types/onchain/positions/index.d.ts +2 -2
  192. package/dist/types/onchain/positions/projectAavePosition.d.ts +46 -0
  193. package/dist/types/onchain/positions/readAavePosition.d.ts +22 -0
  194. package/dist/types/onchain/positions/types.d.ts +25 -0
  195. package/dist/types/onchain/preview/index.d.ts +2 -1
  196. package/dist/types/onchain/preview/preview/aaveBridgeBorrows.d.ts +15 -0
  197. package/dist/types/onchain/preview/preview/aaveMoveStart.d.ts +18 -0
  198. package/dist/types/onchain/preview/preview/index.d.ts +2 -1
  199. package/dist/types/onchain/preview/preview/loadAdapterReplayState.d.ts +13 -0
  200. package/dist/types/onchain/validation/bundles/checkAaveDelegation.d.ts +21 -0
  201. package/dist/types/onchain/validation/bundles/checkCreditOperation.d.ts +2 -2
  202. package/dist/types/onchain/validation/bundles/index.d.ts +2 -1
  203. package/dist/types/onchain/validation/index.d.ts +2 -1
  204. package/dist/types/sdk/GearboxSDK.d.ts +1 -8
  205. package/dist/types/sdk/analytics/AnalyticsNamespace.d.ts +1 -1
  206. package/dist/types/sdk/analytics/types.d.ts +1 -1
  207. package/dist/types/sdk/execute/types.d.ts +7 -5
  208. package/dist/types/sdk/index.d.ts +3 -3
  209. package/dist/types/sdk/opportunities/OpportunitiesNamespace.d.ts +1 -1
  210. package/dist/types/sdk/opportunities/types.d.ts +1 -1
  211. package/dist/types/sdk/positions/PositionsNamespace.d.ts +7 -2
  212. package/dist/types/sdk/positions/types.d.ts +10 -2
  213. package/dist/types/sdk/prepare/PrepareApi.d.ts +11 -3
  214. package/dist/types/sdk/prepare/index.d.ts +2 -2
  215. package/dist/types/sdk/prepare/types.d.ts +116 -1
  216. package/dist/types/sdk/preview/PreviewNamespace.d.ts +5 -1
  217. package/dist/types/sdk/preview/types.d.ts +12 -1
  218. package/dist/types/sdk/types.d.ts +0 -20
  219. package/package.json +1 -1
  220. package/dist/cjs/model/notices.schema.js +0 -25
  221. package/dist/cjs/offchain/notices/OffchainNotices.js +0 -27
  222. package/dist/cjs/offchain/notices/index.js +0 -3
  223. package/dist/esm/model/notices.schema.js +0 -23
  224. package/dist/esm/offchain/notices/OffchainNotices.js +0 -26
  225. package/dist/esm/offchain/notices/index.js +0 -1
  226. package/dist/types/model/notices.d.ts +0 -28
  227. package/dist/types/model/notices.schema.d.ts +0 -22
  228. package/dist/types/offchain/notices/OffchainNotices.d.ts +0 -18
  229. package/dist/types/offchain/notices/index.d.ts +0 -2
  230. /package/dist/cjs/model/{notices.js → aave.js} +0 -0
  231. /package/dist/esm/model/{notices.js → aave.js} +0 -0
@@ -5,7 +5,7 @@ import { LeverageBand } from "../onchain/accounts/intents/leverage-band.js";
5
5
  import { PoolOperationError } from "../onchain/validation/bundles/checkPoolOperation.js";
6
6
  import { IAnalytics, IAnalyticsByMode } from "./analytics/types.js";
7
7
  import { ILiquidations, ILiquidationsByMode, IsEmergencyLiquidatorProps } from "./liquidations/types.js";
8
- import { AccountFlowError, AddCollateralParams, AdjustLeverageParams, BorrowAndWithdrawParams, BorrowParams, BorrowResult, DelayedStrategyResult, DepositStrategyParams, EmptyCreditAccountResult, FinalizeParams, FinalizeResult, IOpportunitiesPrepare, LpParams, LpRedeemParams, LpResult, LpState, MaxBorrowAndWithdrawOptions, MaxBorrowParams, MaxWithdrawCollateralOptions, OpenFlowError, OpenStrategyParams, OpenStrategyResult, PoolInput, PositionInput, PrepareOptions, QuotaBufferState, RepayStrategyParams, StrategyInput, StrategyResult, StrategyRoutesResult, UpdateQuotaParams, WithRouteErrors, WithdrawCollateralParams, WithdrawStrategyParams } from "./prepare/types.js";
8
+ import { AccountFlowError, AddCollateralParams, AdjustLeverageParams, BorrowAndWithdrawParams, BorrowParams, BorrowResult, CloseAavePositionParams, DelayedStrategyResult, DepositStrategyParams, EmptyCreditAccountResult, FinalizeParams, FinalizeResult, IOpportunitiesPrepare, LpParams, LpRedeemParams, LpResult, LpState, MaxBorrowAndWithdrawOptions, MaxBorrowParams, MaxWithdrawCollateralOptions, OpenAavePositionParams, OpenAavePositionResult, OpenAavePositionState, OpenFlowError, OpenStrategyError, OpenStrategyParams, OpenStrategyResult, PoolInput, PositionInput, PrepareOptions, QuotaBufferState, RepayStrategyParams, StrategyInput, StrategyResult, StrategyRoutesResult, UpdateQuotaParams, WithRouteErrors, WithdrawCollateralParams, WithdrawStrategyParams } from "./prepare/types.js";
9
9
  import { ChainOf, PrepareApi } from "./prepare/PrepareApi.js";
10
10
  import "./prepare/index.js";
11
11
  import { AccountPrepareRequest, BorrowPrepareRequest, IOpportunitiesExecute, OpenEmptyPrepareRequest, OpenPrepareRequest, PoolPrepareRequest, PrepareRequest } from "./execute/types.js";
@@ -19,7 +19,7 @@ import { IOpportunities, IOpportunitiesBase, IOpportunitiesByMode, IOpportunitie
19
19
  import { IPositionMergers, IPositions, IPositionsBase, IPositionsByMode, IPositionsOffchainBranch, IPositionsOffchainOnly, IPositionsOnchainBranch, IPositionsOnchainOnly } from "./positions/types.js";
20
20
  import { CheckOperationProps, IPreview, IPreviewByMode } from "./preview/types.js";
21
21
  import { IRewards, IRewardsByMode, RewardsKeys } from "./rewards/types.js";
22
- import { EnsureFreshChains, GearboxSDKOptions, IGearboxSDK, INotices, INoticesByMode, Mode, NamespaceOptions, OffchainByMode, OffchainSource, OnchainByMode, OnchainSource, PlainMultichainSDKOptions } from "./types.js";
22
+ import { EnsureFreshChains, GearboxSDKOptions, IGearboxSDK, Mode, NamespaceOptions, OffchainByMode, OffchainSource, OnchainByMode, OnchainSource, PlainMultichainSDKOptions } from "./types.js";
23
23
  import { AbstractNamespace, MergedQuery } from "./AbstractNamespace.js";
24
24
  import { AnalyticsNamespace } from "./analytics/AnalyticsNamespace.js";
25
25
  import "./analytics/index.js";
@@ -45,4 +45,4 @@ import { SourceUnavailableError } from "./errors/SourceUnavailableError.js";
45
45
  import { assertSameChains } from "./errors/assertSameChains.js";
46
46
  import { everyChainFailed } from "./errors/everyChainFailed.js";
47
47
  import "./errors/index.js";
48
- export { AbstractNamespace, AccountFlowError, AccountPrepareRequest, AddCollateralParams, AdjustLeverageParams, AllSourcesFailedError, AnalyticsNamespace, BorrowAndWithdrawParams, BorrowParams, BorrowPrepareRequest, BorrowResult, type BorrowState, ChainOf, ChainRef, CheckOperationProps, type CreditAccountNotEmptyError, type CreditAccountNotFoundError, DEFAULT_MAX_OFFCHAIN_LAG, DEFAULT_MAX_STATE_AGE, DelayedStrategyResult, DepositStrategyParams, EmptyCreditAccountResult, EnsureFreshChains, type EntityMerger, ExecuteApi, type ExecutionCost, type FilterResult, FinalizeParams, FinalizeResult, GearboxSDK, GearboxSDKOptions, IAnalytics, IAnalyticsByMode, IGearboxSDK, ILiquidations, ILiquidationsByMode, INotices, INoticesByMode, IOpportunities, IOpportunitiesBase, IOpportunitiesByMode, IOpportunitiesExecute, IOpportunitiesOffchainBranch, IOpportunitiesOffchainOnly, IOpportunitiesOnchainBranch, IOpportunitiesOnchainOnly, IOpportunitiesPrepare, IOpportunityMergers, IPositionMergers, IPositions, IPositionsBase, IPositionsByMode, IPositionsOffchainBranch, IPositionsOffchainOnly, IPositionsOnchainBranch, IPositionsOnchainOnly, IPreview, IPreviewByMode, type IRewards, type IRewardsByMode, IsEmergencyLiquidatorProps, type LeverageBand, LiquidationsNamespace, type ListMerger, LpParams, LpRedeemParams, LpResult, LpState, MaxBorrowAndWithdrawOptions, MaxBorrowParams, MaxWithdrawCollateralOptions, type MergeListResult, MergedQuery, MerklRequestFailedError, type MerkleXYZUserRewardsV4Response, MissingSourceError, Mode, type MultipleDelayedWithdrawalsError, NamespaceOptions, type NoDelayedRouteError, type NoRecordedIntentError, NoSourceServedError, type NoStrategyTargetCollateralError, OffchainByMode, OffchainSource, OnchainByMode, OnchainSource, OpenEmptyPrepareRequest, OpenFlowError, OpenPrepareRequest, OpenStrategyParams, OpenStrategyResult, type OperationState, OpportunitiesNamespace, type PathLossRate, PlainMultichainSDKOptions, PoolInput, type PoolOperationError, PoolPrepareRequest, PositionInput, PositionsNamespace, PrepareApi, PrepareOptions, PrepareRequest, PreviewNamespace, QuotaBufferState, RepayStrategyParams, type RewardsKeys, RewardsNamespace, type RouteErrors, SourceChainMismatchError, SourceUnavailableError, StrategyInput, StrategyResult, StrategyRoutesResult, TurtleRequestFailedError, type TurtleWalletRewards, type UnexpectedFailureError, type UnsupportedCollateralTokenError, type UnsupportedTokenPairError, UpdateQuotaParams, type WithPartialState, WithRouteErrors, type WithdrawCeilings, WithdrawCollateralParams, WithdrawStrategyParams, type WithdrawalInProgressError, assertSameChains, creditAccountNotEmpty, creditAccountNotFound, everyChainFailed, filterResponse, mergeChainList, mergeChainOne, noStrategyTargetCollateral, unexpectedFailure };
48
+ export { AbstractNamespace, AccountFlowError, AccountPrepareRequest, AddCollateralParams, AdjustLeverageParams, AllSourcesFailedError, AnalyticsNamespace, BorrowAndWithdrawParams, BorrowParams, BorrowPrepareRequest, BorrowResult, type BorrowState, ChainOf, ChainRef, CheckOperationProps, CloseAavePositionParams, type CreditAccountNotEmptyError, type CreditAccountNotFoundError, DEFAULT_MAX_OFFCHAIN_LAG, DEFAULT_MAX_STATE_AGE, DelayedStrategyResult, DepositStrategyParams, EmptyCreditAccountResult, EnsureFreshChains, type EntityMerger, ExecuteApi, type ExecutionCost, type FilterResult, FinalizeParams, FinalizeResult, GearboxSDK, GearboxSDKOptions, IAnalytics, IAnalyticsByMode, IGearboxSDK, ILiquidations, ILiquidationsByMode, IOpportunities, IOpportunitiesBase, IOpportunitiesByMode, IOpportunitiesExecute, IOpportunitiesOffchainBranch, IOpportunitiesOffchainOnly, IOpportunitiesOnchainBranch, IOpportunitiesOnchainOnly, IOpportunitiesPrepare, IOpportunityMergers, IPositionMergers, IPositions, IPositionsBase, IPositionsByMode, IPositionsOffchainBranch, IPositionsOffchainOnly, IPositionsOnchainBranch, IPositionsOnchainOnly, IPreview, IPreviewByMode, type IRewards, type IRewardsByMode, IsEmergencyLiquidatorProps, type LeverageBand, LiquidationsNamespace, type ListMerger, LpParams, LpRedeemParams, LpResult, LpState, MaxBorrowAndWithdrawOptions, MaxBorrowParams, MaxWithdrawCollateralOptions, type MergeListResult, MergedQuery, MerklRequestFailedError, type MerkleXYZUserRewardsV4Response, MissingSourceError, Mode, type MultipleDelayedWithdrawalsError, NamespaceOptions, type NoDelayedRouteError, type NoRecordedIntentError, NoSourceServedError, type NoStrategyTargetCollateralError, OffchainByMode, OffchainSource, OnchainByMode, OnchainSource, OpenAavePositionParams, OpenAavePositionResult, OpenAavePositionState, OpenEmptyPrepareRequest, OpenFlowError, OpenPrepareRequest, OpenStrategyError, OpenStrategyParams, OpenStrategyResult, type OperationState, OpportunitiesNamespace, type PathLossRate, PlainMultichainSDKOptions, PoolInput, type PoolOperationError, PoolPrepareRequest, PositionInput, PositionsNamespace, PrepareApi, PrepareOptions, PrepareRequest, PreviewNamespace, QuotaBufferState, RepayStrategyParams, type RewardsKeys, RewardsNamespace, type RouteErrors, SourceChainMismatchError, SourceUnavailableError, StrategyInput, StrategyResult, StrategyRoutesResult, TurtleRequestFailedError, type TurtleWalletRewards, type UnexpectedFailureError, type UnsupportedCollateralTokenError, type UnsupportedTokenPairError, UpdateQuotaParams, type WithPartialState, WithRouteErrors, type WithdrawCeilings, WithdrawCollateralParams, WithdrawStrategyParams, type WithdrawalInProgressError, assertSameChains, creditAccountNotEmpty, creditAccountNotFound, everyChainFailed, filterResponse, mergeChainList, mergeChainOne, noStrategyTargetCollateral, unexpectedFailure };
@@ -1,5 +1,5 @@
1
- import { ChartBundle, ChartRange, PoolOpportunityChartMetric, StrategyOpportunityChartMetric } from "../../model/charts.js";
2
1
  import { Opportunity, OpportunityFilter, OpportunityTotals, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef } from "../../model/opportunities.js";
2
+ import { ChartBundle, ChartRange, PoolOpportunityChartMetric, StrategyOpportunityChartMetric } from "../../model/charts.js";
3
3
  import { DataResponse } from "../../model/response.js";
4
4
  import "../../model/index.js";
5
5
  import { MultichainSDK } from "../../onchain/MultichainSDK.js";
@@ -1,5 +1,5 @@
1
- import { ChartBundle, ChartRange, PoolOpportunityChartMetric, StrategyOpportunityChartMetric } from "../../model/charts.js";
2
1
  import { Opportunity, OpportunityFilter, OpportunityTotals, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef } from "../../model/opportunities.js";
2
+ import { ChartBundle, ChartRange, PoolOpportunityChartMetric, StrategyOpportunityChartMetric } from "../../model/charts.js";
3
3
  import { DataResponse } from "../../model/response.js";
4
4
  import "../../model/index.js";
5
5
  import { IMultichainOpportunitiesService } from "../../onchain/opportunities/types.js";
@@ -1,9 +1,10 @@
1
- import { ChartBundle, ChartRange, PoolPositionChartMetric, StrategyPositionChartMetric } from "../../model/charts.js";
2
1
  import { PoolPositionRef, Position, PositionFilter, PositionTransaction, PositionsTotals, StrategyPositionRef } from "../../model/positions.js";
2
+ import { AavePosition } from "../../model/aave.js";
3
+ import { ChartBundle, ChartRange, PoolPositionChartMetric, StrategyPositionChartMetric } from "../../model/charts.js";
3
4
  import { DataResponse } from "../../model/response.js";
4
5
  import { PositionWithdrawals } from "../../model/withdrawals.js";
5
6
  import "../../model/index.js";
6
- import { GetCurrentWithdrawalsProps } from "../../onchain/positions/types.js";
7
+ import { GetCurrentWithdrawalsProps, ListAavePositionsProps } from "../../onchain/positions/types.js";
7
8
  import { MultichainSDK } from "../../onchain/MultichainSDK.js";
8
9
  import "../../onchain/index.js";
9
10
  import { GearboxAPI } from "../../offchain/GearboxAPI.js";
@@ -50,5 +51,9 @@ export declare class PositionsNamespace extends AbstractNamespace<MultichainSDK[
50
51
  * {@inheritDoc IPositionsOnchainOnly.getCurrentWithdrawals}
51
52
  **/
52
53
  getCurrentWithdrawals(props: GetCurrentWithdrawalsProps<true>): Promise<DataResponse<PositionWithdrawals>>;
54
+ /**
55
+ * {@inheritDoc IPositionsOnchainOnly.listAavePositions}
56
+ **/
57
+ listAavePositions(props: ListAavePositionsProps<true>): Promise<DataResponse<AavePosition[]>>;
53
58
  }
54
59
  //#endregion
@@ -1,9 +1,10 @@
1
- import { ChartBundle, ChartRange, PoolPositionChartMetric, StrategyPositionChartMetric } from "../../model/charts.js";
2
1
  import { PoolPositionRef, Position, PositionFilter, PositionTransaction, PositionsTotals, StrategyPositionRef } from "../../model/positions.js";
2
+ import { AavePosition } from "../../model/aave.js";
3
+ import { ChartBundle, ChartRange, PoolPositionChartMetric, StrategyPositionChartMetric } from "../../model/charts.js";
3
4
  import { DataResponse } from "../../model/response.js";
4
5
  import { PositionWithdrawals } from "../../model/withdrawals.js";
5
6
  import "../../model/index.js";
6
- import { GetCurrentWithdrawalsProps, IMultichainPositionsService } from "../../onchain/positions/types.js";
7
+ import { GetCurrentWithdrawalsProps, IMultichainPositionsService, ListAavePositionsProps } from "../../onchain/positions/types.js";
7
8
  import "../../onchain/index.js";
8
9
  import { IOffchainPositions } from "../../offchain/positions/types.js";
9
10
  import "../../offchain/index.js";
@@ -77,6 +78,13 @@ export interface IPositionsOnchainOnly {
77
78
  * name when they mature. Absent in `offchain` mode.
78
79
  **/
79
80
  getCurrentWithdrawals(props: GetCurrentWithdrawalsProps<true>): Promise<DataResponse<PositionWithdrawals>>;
81
+ /**
82
+ * Aave Horizon positions of a wallet, each shaped like the strategy
83
+ * position of a credit account, see {@link AavePosition}.
84
+ * They are not part of {@link IPositionsBase.list}. Absent in `offchain`
85
+ * mode.
86
+ **/
87
+ listAavePositions(props: ListAavePositionsProps<true>): Promise<DataResponse<AavePosition[]>>;
80
88
  }
81
89
  /**
82
90
  * The chain on its own, for a consumer that shows each source as it arrives.
@@ -1,6 +1,6 @@
1
1
  import { Bps, ChainId } from "../../model/primitives.js";
2
2
  import { CreditManagerPausedError, DebtOutOfRangeError, InsufficientPoolLiquidityError, LeverageOutOfRangeError, MarketExpiredError, QuotaAboveMaxError, QuotaInactiveError, QuotaUnchangedError } from "../../model/errors/operation-errors.js";
3
- import { CreditAccountNotEmptyError, CreditAccountNotFoundError, MultipleDelayedWithdrawalsError, NoDelayedRouteError, NoRecordedIntentError, NoStrategyTargetCollateralError, UnexpectedFailureError, UnsupportedCollateralTokenError, UnsupportedTokenPairError, WithdrawalInProgressError } from "../../model/errors/prepare-errors.js";
3
+ import { CreditAccountNotEmptyError, CreditAccountNotFoundError, MultipleDelayedWithdrawalsError, NoDelayedRouteError, NoRecordedIntentError, UnexpectedFailureError, UnsupportedCollateralTokenError, UnsupportedTokenPairError, WithdrawalInProgressError } from "../../model/errors/prepare-errors.js";
4
4
  import { Position, PositionCollateral, StrategyPosition } from "../../model/positions.js";
5
5
  import { SDKReturn } from "../../model/result.js";
6
6
  import "../../model/index.js";
@@ -14,7 +14,7 @@ import { LeverageBand } from "../../onchain/accounts/intents/leverage-band.js";
14
14
  import { OpenStrategyState } from "../../onchain/accounts/intents/open-strategy.js";
15
15
  import { PoolOperationError } from "../../onchain/validation/bundles/checkPoolOperation.js";
16
16
  import "../../onchain/index.js";
17
- import { AccountFlowError, AddCollateralParams, AdjustLeverageParams, BorrowAndWithdrawParams, BorrowParams, BorrowResult, DepositStrategyParams, EmptyCreditAccountResult, FinalizeParams, FinalizeResult, IOpportunitiesPrepare, LpParams, LpRedeemParams, LpResult, LpState, MaxBorrowAndWithdrawOptions, MaxBorrowParams, MaxWithdrawCollateralOptions, OpenFlowError, OpenStrategyParams, OpenStrategyResult, PoolInput, PositionInput, QuotaBufferState, RepayStrategyParams, StrategyInput, StrategyResult, StrategyRoutesResult, UpdateQuotaParams, WithRouteErrors, WithdrawCollateralParams, WithdrawStrategyParams } from "./types.js";
17
+ import { AccountFlowError, AddCollateralParams, AdjustLeverageParams, BorrowAndWithdrawParams, BorrowParams, BorrowResult, CloseAavePositionParams, DelayedStrategyResult, DepositStrategyParams, EmptyCreditAccountResult, FinalizeParams, FinalizeResult, IOpportunitiesPrepare, LpParams, LpRedeemParams, LpResult, LpState, MaxBorrowAndWithdrawOptions, MaxBorrowParams, MaxWithdrawCollateralOptions, OpenAavePositionParams, OpenAavePositionResult, OpenAavePositionState, OpenFlowError, OpenStrategyError, OpenStrategyParams, OpenStrategyResult, PoolInput, PositionInput, QuotaBufferState, RepayStrategyParams, StrategyInput, StrategyResult, StrategyRoutesResult, UpdateQuotaParams, WithRouteErrors, WithdrawCollateralParams, WithdrawStrategyParams } from "./types.js";
18
18
  import { EnsureFreshChains } from "../types.js";
19
19
  import { Address } from "viem";
20
20
  //#region src/sdk/prepare/PrepareApi.d.ts
@@ -73,7 +73,11 @@ export declare class PrepareApi extends MultichainConstruct implements IOpportun
73
73
  /**
74
74
  * {@inheritDoc IOpportunitiesPrepare.openNewStrategy}
75
75
  **/
76
- openNewStrategy(strategy: StrategyInput, params: OpenStrategyParams): Promise<SDKReturn<OpenStrategyResult, (OpenFlowError | DebtOutOfRangeError | LeverageOutOfRangeError | UnsupportedTokenPairError | InsufficientPoolLiquidityError | NoStrategyTargetCollateralError | CreditAccountNotFoundError | CreditAccountNotEmptyError) & WithPartialState<OpenStrategyState>>>;
76
+ openNewStrategy(strategy: StrategyInput, params: OpenStrategyParams): Promise<SDKReturn<OpenStrategyResult, OpenStrategyError & WithPartialState<OpenStrategyState>>>;
77
+ /**
78
+ * {@inheritDoc IOpportunitiesPrepare.openAavePosition}
79
+ **/
80
+ openAavePosition(strategy: StrategyInput, params: OpenAavePositionParams): Promise<SDKReturn<OpenAavePositionResult, (OpenStrategyError | UnsupportedCollateralTokenError) & WithPartialState<OpenAavePositionState>>>;
77
81
  /**
78
82
  * {@inheritDoc IOpportunitiesPrepare.borrow}
79
83
  **/
@@ -98,6 +102,10 @@ export declare class PrepareApi extends MultichainConstruct implements IOpportun
98
102
  * {@inheritDoc IOpportunitiesPrepare.maxRepay}
99
103
  **/
100
104
  maxRepay(position: PositionInput): Promise<bigint>;
105
+ /**
106
+ * {@inheritDoc IOpportunitiesPrepare.closeAavePosition}
107
+ **/
108
+ closeAavePosition(position: PositionInput, params: CloseAavePositionParams): Promise<SDKReturn<DelayedStrategyResult, (AccountFlowError | CreditAccountNotEmptyError | DebtOutOfRangeError | UnsupportedCollateralTokenError | InsufficientPoolLiquidityError | NoDelayedRouteError | MultipleDelayedWithdrawalsError | WithdrawalInProgressError) & WithPartialState<OperationState>>>;
101
109
  /**
102
110
  * {@inheritDoc IOpportunitiesPrepare.adjustLeverage}
103
111
  **/
@@ -4,6 +4,6 @@ import { ExecutionCost, OperationState, PathLossRate, RouteErrors, WithPartialSt
4
4
  import { BorrowState } from "../../onchain/accounts/intents/borrow.js";
5
5
  import { LeverageBand } from "../../onchain/accounts/intents/leverage-band.js";
6
6
  import { PoolOperationError } from "../../onchain/validation/bundles/checkPoolOperation.js";
7
- import { AccountFlowError, AddCollateralParams, AdjustLeverageParams, BorrowAndWithdrawParams, BorrowParams, BorrowResult, DelayedStrategyResult, DepositStrategyParams, EmptyCreditAccountResult, FinalizeParams, FinalizeResult, IOpportunitiesPrepare, LpParams, LpRedeemParams, LpResult, LpState, MaxBorrowAndWithdrawOptions, MaxBorrowParams, MaxWithdrawCollateralOptions, OpenFlowError, OpenStrategyParams, OpenStrategyResult, PoolInput, PositionInput, PrepareOptions, QuotaBufferState, RepayStrategyParams, StrategyInput, StrategyResult, StrategyRoutesResult, UpdateQuotaParams, WithRouteErrors, WithdrawCollateralParams, WithdrawStrategyParams } from "./types.js";
7
+ import { AccountFlowError, AddCollateralParams, AdjustLeverageParams, BorrowAndWithdrawParams, BorrowParams, BorrowResult, CloseAavePositionParams, DelayedStrategyResult, DepositStrategyParams, EmptyCreditAccountResult, FinalizeParams, FinalizeResult, IOpportunitiesPrepare, LpParams, LpRedeemParams, LpResult, LpState, MaxBorrowAndWithdrawOptions, MaxBorrowParams, MaxWithdrawCollateralOptions, OpenAavePositionParams, OpenAavePositionResult, OpenAavePositionState, OpenFlowError, OpenStrategyError, OpenStrategyParams, OpenStrategyResult, PoolInput, PositionInput, PrepareOptions, QuotaBufferState, RepayStrategyParams, StrategyInput, StrategyResult, StrategyRoutesResult, UpdateQuotaParams, WithRouteErrors, WithdrawCollateralParams, WithdrawStrategyParams } from "./types.js";
8
8
  import { ChainOf, PrepareApi } from "./PrepareApi.js";
9
- export { AccountFlowError, AddCollateralParams, AdjustLeverageParams, BorrowAndWithdrawParams, BorrowParams, BorrowResult, type BorrowState, ChainOf, type CreditAccountNotEmptyError, type CreditAccountNotFoundError, DelayedStrategyResult, DepositStrategyParams, EmptyCreditAccountResult, type ExecutionCost, FinalizeParams, FinalizeResult, IOpportunitiesPrepare, type LeverageBand, LpParams, LpRedeemParams, LpResult, LpState, MaxBorrowAndWithdrawOptions, MaxBorrowParams, MaxWithdrawCollateralOptions, type MultipleDelayedWithdrawalsError, type NoDelayedRouteError, type NoRecordedIntentError, type NoStrategyTargetCollateralError, OpenFlowError, OpenStrategyParams, OpenStrategyResult, type OperationState, type PathLossRate, PoolInput, type PoolOperationError, PositionInput, PrepareApi, PrepareOptions, QuotaBufferState, RepayStrategyParams, type RouteErrors, StrategyInput, StrategyResult, StrategyRoutesResult, type UnexpectedFailureError, type UnsupportedCollateralTokenError, type UnsupportedTokenPairError, UpdateQuotaParams, type WithPartialState, WithRouteErrors, type WithdrawCeilings, WithdrawCollateralParams, WithdrawStrategyParams, type WithdrawalInProgressError, creditAccountNotEmpty, creditAccountNotFound, noStrategyTargetCollateral, unexpectedFailure };
9
+ export { AccountFlowError, AddCollateralParams, AdjustLeverageParams, BorrowAndWithdrawParams, BorrowParams, BorrowResult, type BorrowState, ChainOf, CloseAavePositionParams, type CreditAccountNotEmptyError, type CreditAccountNotFoundError, DelayedStrategyResult, DepositStrategyParams, EmptyCreditAccountResult, type ExecutionCost, FinalizeParams, FinalizeResult, IOpportunitiesPrepare, type LeverageBand, LpParams, LpRedeemParams, LpResult, LpState, MaxBorrowAndWithdrawOptions, MaxBorrowParams, MaxWithdrawCollateralOptions, type MultipleDelayedWithdrawalsError, type NoDelayedRouteError, type NoRecordedIntentError, type NoStrategyTargetCollateralError, OpenAavePositionParams, OpenAavePositionResult, OpenAavePositionState, OpenFlowError, OpenStrategyError, OpenStrategyParams, OpenStrategyResult, type OperationState, type PathLossRate, PoolInput, type PoolOperationError, PositionInput, PrepareApi, PrepareOptions, QuotaBufferState, RepayStrategyParams, type RouteErrors, StrategyInput, StrategyResult, StrategyRoutesResult, type UnexpectedFailureError, type UnsupportedCollateralTokenError, type UnsupportedTokenPairError, UpdateQuotaParams, type WithPartialState, WithRouteErrors, type WithdrawCeilings, WithdrawCollateralParams, WithdrawStrategyParams, type WithdrawalInProgressError, creditAccountNotEmpty, creditAccountNotFound, noStrategyTargetCollateral, unexpectedFailure };
@@ -4,6 +4,7 @@ import { CreditManagerPausedError, DebtOutOfRangeError, ForbiddenTokenError, Ins
4
4
  import { CreditAccountNotEmptyError, CreditAccountNotFoundError, MultipleDelayedWithdrawalsError, NoDelayedRouteError, NoRecordedIntentError, NoStrategyTargetCollateralError, UnexpectedFailureError, UnsupportedCollateralTokenError, UnsupportedTokenPairError, WithdrawalInProgressError } from "../../model/errors/prepare-errors.js";
5
5
  import { PoolOpportunityKey, StrategyOpportunityKey } from "../../model/opportunities.js";
6
6
  import { Position, PositionCollateral, StrategyPosition, StrategyPositionKey } from "../../model/positions.js";
7
+ import { AavePositionProjection } from "../../model/aave.js";
7
8
  import { SDKReturn } from "../../model/result.js";
8
9
  import { PositionClaimableWithdrawal } from "../../model/withdrawals.js";
9
10
  import "../../model/index.js";
@@ -50,6 +51,11 @@ export interface MaxWithdrawCollateralOptions {
50
51
  export type AccountFlowError = CreditManagerPausedError | MarketExpiredError | ForbiddenTokenError | QuotaLimitReachedError | InsufficientCollateralError | ReservePriceLimitedError | InsufficientBalanceError | CreditAccountNotFoundError | UnexpectedFailureError;
51
52
  /** Same guards for the account-less open flow. */
52
53
  export type OpenFlowError = CreditManagerPausedError | MarketExpiredError | ForbiddenTokenError | QuotaLimitReachedError | InsufficientCollateralError | InsufficientBalanceError | UnexpectedFailureError;
54
+ /**
55
+ * What opening a leveraged position can answer with: the open-flow guards plus
56
+ * the opening's own codes.
57
+ **/
58
+ export type OpenStrategyError = OpenFlowError | DebtOutOfRangeError | LeverageOutOfRangeError | UnsupportedTokenPairError | InsufficientPoolLiquidityError | NoStrategyTargetCollateralError | CreditAccountNotFoundError | CreditAccountNotEmptyError;
53
59
  /**
54
60
  * What every error of a two-route request carries on top of its own code,
55
61
  * see {@link StrategyRoutesResult}.
@@ -252,6 +258,30 @@ export interface OpenStrategyResult {
252
258
  /** Unix seconds of {@link blockNumber}. */
253
259
  timestamp: Timestamp;
254
260
  }
261
+ /**
262
+ * Where an Aave Horizon opening arrives: the credit account the position is
263
+ * built in, as {@link OpenStrategyState} describes it, and the position it
264
+ * becomes on Aave — within the same transaction where the mint is instant,
265
+ * once the mint settles otherwise.
266
+ **/
267
+ export interface OpenAavePositionState extends OpenStrategyState {
268
+ /** The position once it has moved to Aave. */
269
+ aave: AavePositionProjection;
270
+ /**
271
+ * Calls that move the position to Aave at the end of the opening's own
272
+ * multicall; feeds `openCA.callsAfter`. Transport like `calls`. Empty while
273
+ * the mint is delayed (`aave.mintDuration > 0`): the finalizer bot moves the
274
+ * position once it settles.
275
+ **/
276
+ moveCalls: MultiCall[];
277
+ }
278
+ /**
279
+ * What opening a leveraged position on Aave Horizon comes to: the transaction
280
+ * is the same opening, so it is built from this result the same way.
281
+ **/
282
+ export interface OpenAavePositionResult extends OpenStrategyResult {
283
+ state: OpenAavePositionState;
284
+ }
255
285
  /**
256
286
  * What taking a loan against collateral comes to.
257
287
  *
@@ -372,6 +402,12 @@ export interface RepayStrategyParams extends PrepareOptions {
372
402
  /** Native value to attach when paying a wrapped-native market in the coin. */
373
403
  value?: bigint;
374
404
  }
405
+ export interface CloseAavePositionParams extends PrepareOptions {
406
+ /** RWA the account owner holds on Aave Horizon; all of it comes back. */
407
+ token: Address;
408
+ /** Wallet the exit sends what is left to, as the asset on an RWA market. */
409
+ to: Address;
410
+ }
375
411
  export interface AdjustLeverageParams extends PrepareOptions {
376
412
  /**
377
413
  * Target total leverage scaled by `LEVERAGE_DECIMALS` (300n = 3x); 100n means
@@ -437,6 +473,14 @@ export interface OpenStrategyParams extends PrepareOptions {
437
473
  **/
438
474
  creditAccount?: Address;
439
475
  }
476
+ export interface OpenAavePositionParams extends OpenStrategyParams {
477
+ /**
478
+ * Wallet the account is opened for. The Aave position is this wallet's own,
479
+ * so what it already holds and owes on the Horizon pool counts towards the
480
+ * health factor and the debt Aave lends.
481
+ **/
482
+ wallet: Address;
483
+ }
440
484
  export interface BorrowParams extends PrepareOptions {
441
485
  /**
442
486
  * Token the wallet puts up as collateral. Must be a collateral token of the
@@ -627,7 +671,42 @@ export interface IOpportunitiesPrepare {
627
671
  * `creditAccount` puts the position on an account the wallet already holds
628
672
  * rather than creating one.
629
673
  **/
630
- openNewStrategy(strategy: StrategyInput, params: OpenStrategyParams): Promise<SDKReturn<OpenStrategyResult, (OpenFlowError | DebtOutOfRangeError | LeverageOutOfRangeError | UnsupportedTokenPairError | InsufficientPoolLiquidityError | NoStrategyTargetCollateralError | CreditAccountNotFoundError | CreditAccountNotEmptyError) & WithPartialState<OpenStrategyState>>>;
674
+ openNewStrategy(strategy: StrategyInput, params: OpenStrategyParams): Promise<SDKReturn<OpenStrategyResult, OpenStrategyError & WithPartialState<OpenStrategyState>>>;
675
+ /**
676
+ * Opening a leveraged position on Aave Horizon from wallet collateral.
677
+ *
678
+ * The opening is the one {@link openNewStrategy} prepares — a Gearbox
679
+ * credit account borrows and buys the RWA collateral — and `state.aave`
680
+ * describes the position it becomes on Aave.
681
+ *
682
+ * Where the mint is instant (the withdrawal compressor lists no delayed
683
+ * operation for the RWA) the position moves to Aave in the same
684
+ * transaction: `state.moveCalls` end the opening's multicall, supplying the
685
+ * RWA to the Aave pool, handing the aTokens to the owner through the
686
+ * Horizon bridge, which borrows exactly what the account owes against them
687
+ * in the owner's name, and repaying the Gearbox debt in full. The account
688
+ * is left open and empty. The bridge borrows as the owner, so the
689
+ * transaction reverts unless the owner has delegated credit on Aave's
690
+ * variable debt token to the bridge; `checkOperation` reports a missing
691
+ * delegation as `insufficientBorrowAllowance`.
692
+ *
693
+ * Where the mint is delayed, the account subscribes to it and the
694
+ * finalizer bot moves the position once it settles; `state.moveCalls` is
695
+ * empty. The opening grants the bot its permissions on every credit manager
696
+ * with a Horizon bridge adapter, whichever of the two methods prepared it;
697
+ * the bot is the one the market configurator lists among its periphery
698
+ * contracts for that bridge, and with none listed the opening grants
699
+ * nothing. An account opened through an RWA factory gets the Securitize
700
+ * finalizer instead, and only where the factory allows it: its wallet
701
+ * rejects any other bot.
702
+ *
703
+ * Aave has to lend the whole Gearbox debt, so an opening whose debt is above
704
+ * what Aave lends against the collateral at its LTV is refused with
705
+ * `debtOutOfRange`, `maxDebt` being that amount. A market whose target
706
+ * collateral cannot be moved to Aave is refused with
707
+ * `unsupportedCollateralToken`.
708
+ **/
709
+ openAavePosition(strategy: StrategyInput, params: OpenAavePositionParams): Promise<SDKReturn<OpenAavePositionResult, (OpenStrategyError | UnsupportedCollateralTokenError) & WithPartialState<OpenAavePositionState>>>;
631
710
  /**
632
711
  * Handing a wallet an account that holds nothing: no collateral, no debt, no
633
712
  * quotas and no route quoted. It exists so a wallet can hold an account
@@ -748,6 +827,42 @@ export interface IOpportunitiesPrepare {
748
827
  * the SDK does not hold.
749
828
  **/
750
829
  maxRepay(position: PositionInput): Promise<bigint>;
830
+ /**
831
+ * The way out of an {@link openAavePosition}, in one transaction: the
832
+ * account owner's Aave Horizon position in `token` comes back to the credit
833
+ * account and is redeemed through the RWA's redemption gateway, which
834
+ * settles after a delay.
835
+ *
836
+ * The request transaction: the account borrows what the owner owes on Aave,
837
+ * the Horizon bridge repays it and hands every aToken of `token` the owner
838
+ * holds to the account, the pool turns them back into `token`, and the
839
+ * account's whole balance of `token` is requested for redemption. On an RWA
840
+ * market Aave is repaid in the asset the underlying wraps, which the loan is
841
+ * unwrapped into. The request records an exit: once the redemption has
842
+ * matured, {@link finalize} — or the Horizon finalizer bot, where the account
843
+ * granted it its permissions — claims it, settles the loan and sends the rest
844
+ * to `to`.
845
+ *
846
+ * Aave debt grows every second and the bridge keeps whatever Aave does not
847
+ * take, so the repayment is the debt read now plus an hour of interest at the
848
+ * current rate. A transaction landing sooner leaves the bridge the interest
849
+ * of the time it did not take; one landing later reverts, as Aave will not
850
+ * release the aTokens of a position left with debt.
851
+ *
852
+ * `state` is where the exit ends, the account settled and empty; the account
853
+ * as the request leaves it — the redemption in flight, the loan borrowed — is
854
+ * `delayed.afterRequest`, and `delayed.claimableAt` is when the tail can run.
855
+ *
856
+ * The account has to be the owner's in a credit manager with Aave adapters
857
+ * for `token`, owing nothing and holding no quota — the one an opening left
858
+ * empty once the position moved to Aave qualifies. Refused with
859
+ * `creditAccountNotEmpty` otherwise, with `unsupportedCollateralToken` when
860
+ * the owner holds no aToken of `token` or no adapter takes it, with
861
+ * `debtOutOfRange` when the owner owes nothing on Aave or the loan is outside
862
+ * the facade's limits, and with `noDelayedRoute` when `token` has no
863
+ * redemption that can take a balance arriving in the same transaction.
864
+ **/
865
+ closeAavePosition(position: PositionInput, params: CloseAavePositionParams): Promise<SDKReturn<DelayedStrategyResult, (AccountFlowError | CreditAccountNotEmptyError | DebtOutOfRangeError | UnsupportedCollateralTokenError | InsufficientPoolLiquidityError | NoDelayedRouteError | MultipleDelayedWithdrawalsError | WithdrawalInProgressError) & WithPartialState<OperationState>>>;
751
866
  /**
752
867
  * Retargeting leverage at fixed collateral: debt moves, own funds do not.
753
868
  *
@@ -1,4 +1,4 @@
1
- import { OperationPreview, PreviewOperationInput, PreviewOperationOptions } from "../../model/previews.js";
1
+ import { OpenAavePositionPreview, OperationPreview, PreviewOperationInput, PreviewOperationOptions } from "../../model/previews.js";
2
2
  import { SDKReturn } from "../../model/result.js";
3
3
  import "../../model/index.js";
4
4
  import { MultichainSDK } from "../../onchain/MultichainSDK.js";
@@ -20,6 +20,10 @@ export declare class PreviewNamespace implements IPreview {
20
20
  * {@inheritDoc IPreview.previewOperation}
21
21
  **/
22
22
  previewOperation(input: PreviewOperationInput, options?: PreviewOperationOptions): Promise<SDKReturn<OperationPreview, PreviewOperationError>>;
23
+ /**
24
+ * {@inheritDoc IPreview.openAavePosition}
25
+ **/
26
+ openAavePosition(input: PreviewOperationInput, options?: PreviewOperationOptions): Promise<SDKReturn<OpenAavePositionPreview, PreviewOperationError>>;
23
27
  /**
24
28
  * {@inheritDoc IPreview.checkOperation}
25
29
  **/
@@ -1,5 +1,5 @@
1
1
  import { ChainId } from "../../model/primitives.js";
2
- import { OperationPreview, PreviewOperationInput, PreviewOperationOptions } from "../../model/previews.js";
2
+ import { OpenAavePositionPreview, OperationPreview, PreviewOperationInput, PreviewOperationOptions } from "../../model/previews.js";
3
3
  import { SDKReturn } from "../../model/result.js";
4
4
  import "../../model/index.js";
5
5
  import { PreviewOperationError } from "../../onchain/preview/preview/previewOperation.js";
@@ -26,6 +26,17 @@ export interface IPreview {
26
26
  * human-displayable preview.
27
27
  **/
28
28
  previewOperation(input: PreviewOperationInput, options?: PreviewOperationOptions): Promise<SDKReturn<OperationPreview, PreviewOperationError>>;
29
+ /**
30
+ * Decodes an Aave Horizon opening and reports both halves of it: the
31
+ * credit account the position is built in while the mint settles, and the
32
+ * position it becomes on Aave after that.
33
+ *
34
+ * Calldata that is not an account opening, or opens on a credit manager
35
+ * that cannot move it to Aave, is refused with `unsupportedOperation`. The
36
+ * Aave position is the one of the opening's `onBehalfOf`, or of the sender
37
+ * where the calldata names no owner.
38
+ **/
39
+ openAavePosition(input: PreviewOperationInput, options?: PreviewOperationOptions): Promise<SDKReturn<OpenAavePositionPreview, PreviewOperationError>>;
29
40
  /**
30
41
  * Whether a parsed operation may be signed by `sender`: protocol state first,
31
42
  * then what the wallet has to approve, hold or sign.
@@ -1,7 +1,5 @@
1
1
  import { ILogger } from "../onchain/types/logger.js";
2
2
  import { ChainId } from "../model/primitives.js";
3
- import { Notice, NoticeSubject } from "../model/notices.js";
4
- import { DataResponse } from "../model/response.js";
5
3
  import "../model/index.js";
6
4
  import { NetworkType } from "../onchain/chain/chains.js";
7
5
  import { MultichainAttachOptions, MultichainSDK, MultichainSDKOptions } from "../onchain/MultichainSDK.js";
@@ -116,19 +114,6 @@ export interface OnchainByMode {
116
114
  offchain: undefined;
117
115
  both: MultichainSDK;
118
116
  }
119
- /**
120
- * The banners the backend attaches to a pool opportunity or a strategy
121
- * position, see {@link Notice}.
122
- **/
123
- export type INotices = (subject: NoticeSubject) => Promise<DataResponse<Notice[]>>;
124
- /**
125
- * `sdk.notices` per mode: a backend read, absent when the SDK reads no backend.
126
- **/
127
- export interface INoticesByMode {
128
- onchain: undefined;
129
- offchain: INotices;
130
- both: INotices;
131
- }
132
117
  /**
133
118
  * Public contract of {@link GearboxSDK}: every namespace and sub-construction,
134
119
  * gated by {@link Mode}. Escape hatches `onchain` and `offchain` are not part
@@ -179,11 +164,6 @@ export interface IGearboxSDK<M extends Mode = Mode> {
179
164
  * Namespace for claimable rewards. Absent in `offchain` mode.
180
165
  **/
181
166
  readonly rewards: IRewardsByMode[M];
182
- /**
183
- * The banners the backend attaches to a pool opportunity or a strategy
184
- * position, see {@link Notice}. Absent in `onchain` mode.
185
- **/
186
- readonly notices: INoticesByMode[M];
187
167
  }
188
168
  /**
189
169
  * Off-chain escape hatch per mode: absent when the SDK reads no backend.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "18.4.0",
3
+ "version": "18.4.1-aave.10",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,25 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_model_primitives_schema = require("./primitives.schema.js");
3
- let zod_v4 = require("zod/v4");
4
- //#region src/model/notices.schema.ts
5
- /**
6
- * {@link NoticeKind}
7
- **/
8
- const noticeKindSchema = zod_v4.z.union([
9
- zod_v4.z.literal("expired"),
10
- zod_v4.z.literal("externalRewards"),
11
- zod_v4.z.literal("extraApy"),
12
- zod_v4.z.literal("warning"),
13
- zod_v4.z.literal("disclaimer")
14
- ]);
15
- /**
16
- * {@link Notice}
17
- **/
18
- const noticeSchema = zod_v4.z.object({
19
- kind: noticeKindSchema,
20
- message: zod_v4.z.string(),
21
- token: require_model_primitives_schema.tokenSchema.optional()
22
- });
23
- //#endregion
24
- exports.noticeKindSchema = noticeKindSchema;
25
- exports.noticeSchema = noticeSchema;
@@ -1,27 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_model_notices_schema = require("../../model/notices.schema.js");
3
- const require_offchain_AbstractOffchainNamespace = require("../AbstractOffchainNamespace.js");
4
- let zod_v4 = require("zod/v4");
5
- //#region src/offchain/notices/OffchainNotices.ts
6
- /**
7
- * Backend counterpart of `sdk.notices`: banners the backend asks a consumer to
8
- * show for one entity, see {@link Notice}.
9
- **/
10
- var OffchainNotices = class extends require_offchain_AbstractOffchainNamespace.AbstractOffchainNamespace {
11
- #root = "/v2/notices";
12
- constructor(options) {
13
- super("OffchainNotices", options);
14
- }
15
- /**
16
- * The notices of one pool opportunity or one strategy position.
17
- **/
18
- async list(subject) {
19
- const [kind, address] = subject.kind === "pool" ? ["pool", subject.pool] : ["strategy", subject.creditAccount];
20
- return this.get({
21
- path: `${this.#root}/${kind}/${subject.chainId}/${address}`,
22
- schema: zod_v4.z.array(require_model_notices_schema.noticeSchema)
23
- });
24
- }
25
- };
26
- //#endregion
27
- exports.OffchainNotices = OffchainNotices;
@@ -1,3 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_offchain_notices_OffchainNotices = require("./OffchainNotices.js");
3
- exports.OffchainNotices = require_offchain_notices_OffchainNotices.OffchainNotices;
@@ -1,23 +0,0 @@
1
- import { tokenSchema } from "./primitives.schema.js";
2
- import { z } from "zod/v4";
3
- //#region src/model/notices.schema.ts
4
- /**
5
- * {@link NoticeKind}
6
- **/
7
- const noticeKindSchema = z.union([
8
- z.literal("expired"),
9
- z.literal("externalRewards"),
10
- z.literal("extraApy"),
11
- z.literal("warning"),
12
- z.literal("disclaimer")
13
- ]);
14
- /**
15
- * {@link Notice}
16
- **/
17
- const noticeSchema = z.object({
18
- kind: noticeKindSchema,
19
- message: z.string(),
20
- token: tokenSchema.optional()
21
- });
22
- //#endregion
23
- export { noticeKindSchema, noticeSchema };
@@ -1,26 +0,0 @@
1
- import { noticeSchema } from "../../model/notices.schema.js";
2
- import { AbstractOffchainNamespace } from "../AbstractOffchainNamespace.js";
3
- import { z } from "zod/v4";
4
- //#region src/offchain/notices/OffchainNotices.ts
5
- /**
6
- * Backend counterpart of `sdk.notices`: banners the backend asks a consumer to
7
- * show for one entity, see {@link Notice}.
8
- **/
9
- var OffchainNotices = class extends AbstractOffchainNamespace {
10
- #root = "/v2/notices";
11
- constructor(options) {
12
- super("OffchainNotices", options);
13
- }
14
- /**
15
- * The notices of one pool opportunity or one strategy position.
16
- **/
17
- async list(subject) {
18
- const [kind, address] = subject.kind === "pool" ? ["pool", subject.pool] : ["strategy", subject.creditAccount];
19
- return this.get({
20
- path: `${this.#root}/${kind}/${subject.chainId}/${address}`,
21
- schema: z.array(noticeSchema)
22
- });
23
- }
24
- };
25
- //#endregion
26
- export { OffchainNotices };
@@ -1 +0,0 @@
1
- export { OffchainNotices } from "./OffchainNotices.js";
@@ -1,28 +0,0 @@
1
- import { Token } from "./primitives.js";
2
- import { PoolOpportunity } from "./opportunities.js";
3
- import { StrategyPosition } from "./positions.js";
4
- //#region src/model/notices.d.ts
5
- /**
6
- * What a notice is about, and therefore how a consumer shows it.
7
- **/
8
- export type NoticeKind = "expired" | "externalRewards" | "extraApy" | "warning" | "disclaimer";
9
- /**
10
- * A banner the backend asks a consumer to show for a pool opportunity or a
11
- * strategy position: an expired account, rewards paid outside the protocol,
12
- * a caveat on the yield. The message is final text; the consumer adds
13
- * nothing.
14
- **/
15
- export interface Notice {
16
- kind: NoticeKind;
17
- message: string;
18
- /**
19
- * Token the notice is about, when it is about one (rewards, extra APY).
20
- **/
21
- token?: Token;
22
- }
23
- /**
24
- * What a notice is attached to: a pool opportunity or a strategy position —
25
- * the two entities a consumer shows banners for.
26
- **/
27
- export type NoticeSubject = PoolOpportunity | StrategyPosition;
28
- //#endregion
@@ -1,22 +0,0 @@
1
- import { z } from "zod/v4";
2
- //#region src/model/notices.schema.d.ts
3
- /**
4
- * {@link NoticeKind}
5
- **/
6
- export declare const noticeKindSchema: z.ZodUnion<readonly [z.ZodLiteral<"expired">, z.ZodLiteral<"externalRewards">, z.ZodLiteral<"extraApy">, z.ZodLiteral<"warning">, z.ZodLiteral<"disclaimer">]>;
7
- /**
8
- * {@link Notice}
9
- **/
10
- export declare const noticeSchema: z.ZodObject<{
11
- kind: z.ZodUnion<readonly [z.ZodLiteral<"expired">, z.ZodLiteral<"externalRewards">, z.ZodLiteral<"extraApy">, z.ZodLiteral<"warning">, z.ZodLiteral<"disclaimer">]>;
12
- message: z.ZodString;
13
- token: z.ZodOptional<z.ZodObject<{
14
- chainId: z.ZodNumber;
15
- address: z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>;
16
- symbol: z.ZodString;
17
- name: z.ZodString;
18
- decimals: z.ZodNumber;
19
- assetType: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>>;
20
- }, z.core.$strip>>;
21
- }, z.core.$strip>;
22
- //#endregion
@@ -1,18 +0,0 @@
1
- import { Notice, NoticeSubject } from "../../model/notices.js";
2
- import { DataResponse } from "../../model/response.js";
3
- import { GearboxAPIOptions } from "../types.js";
4
- import { AbstractOffchainNamespace } from "../AbstractOffchainNamespace.js";
5
- //#region src/offchain/notices/OffchainNotices.d.ts
6
- /**
7
- * Backend counterpart of `sdk.notices`: banners the backend asks a consumer to
8
- * show for one entity, see {@link Notice}.
9
- **/
10
- export declare class OffchainNotices extends AbstractOffchainNamespace {
11
- #private;
12
- constructor(options: GearboxAPIOptions);
13
- /**
14
- * The notices of one pool opportunity or one strategy position.
15
- **/
16
- list(subject: NoticeSubject): Promise<DataResponse<Notice[]>>;
17
- }
18
- //#endregion
@@ -1,2 +0,0 @@
1
- import { OffchainNotices } from "./OffchainNotices.js";
2
- export { OffchainNotices };
File without changes
File without changes