@gearbox-protocol/sdk 18.4.0 → 18.4.1-aave.2

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 (150) hide show
  1. package/dist/cjs/model/index.js +1 -4
  2. package/dist/cjs/offchain/GearboxAPI.js +0 -7
  3. package/dist/cjs/offchain/index.js +0 -3
  4. package/dist/cjs/onchain/accounts/bots/AccountBotsService.js +29 -0
  5. package/dist/cjs/onchain/accounts/bots/PeripheryCompressorV310Contract.js +2 -1
  6. package/dist/cjs/onchain/accounts/intents/index.js +1 -0
  7. package/dist/cjs/onchain/accounts/intents/operations.js +21 -0
  8. package/dist/cjs/onchain/accounts/intents/plan.js +33 -0
  9. package/dist/cjs/onchain/accounts/intents/realize.js +44 -0
  10. package/dist/cjs/onchain/accounts/intents/testing/market.js +1 -0
  11. package/dist/cjs/onchain/accounts/intents/testing/sdk-mock.js +2 -1
  12. package/dist/cjs/onchain/accounts/intents/utils/ledger.js +8 -0
  13. package/dist/cjs/onchain/chain/chains.js +4 -0
  14. package/dist/cjs/onchain/index.js +16 -0
  15. package/dist/cjs/onchain/market/ZapperRegister.js +1 -1
  16. package/dist/cjs/onchain/market/adapters/abi/aave/iAaveHorizonBridge.js +94 -0
  17. package/dist/cjs/onchain/market/adapters/abi/aave/iAaveOracle.js +20 -0
  18. package/dist/cjs/onchain/market/adapters/abi/aave/iAaveV3Pool.js +278 -0
  19. package/dist/cjs/onchain/market/adapters/abi/aave/iPoolAddressesProvider.js +11 -0
  20. package/dist/cjs/onchain/market/adapters/abi/aave/index.js +9 -0
  21. package/dist/cjs/onchain/market/adapters/abi/actionAbi.js +1 -0
  22. package/dist/cjs/onchain/market/adapters/abi/adapters/iAaveHorizonBridgeAdapter.js +224 -0
  23. package/dist/cjs/onchain/market/adapters/abi/adapters/iAaveV3PoolAdapter.js +177 -0
  24. package/dist/cjs/onchain/market/adapters/abi/adapters/index.js +4 -0
  25. package/dist/cjs/onchain/market/adapters/abi/conctructorAbi.js +2 -0
  26. package/dist/cjs/onchain/market/adapters/abi/index.js +13 -0
  27. package/dist/cjs/onchain/market/adapters/contracts/AaveHorizonBridgeAdapterContract.js +171 -0
  28. package/dist/cjs/onchain/market/adapters/contracts/AaveV3PoolAdapterContract.js +199 -0
  29. package/dist/cjs/onchain/market/adapters/contracts/AbstractAdapter.js +8 -0
  30. package/dist/cjs/onchain/market/adapters/contracts/index.js +4 -0
  31. package/dist/cjs/onchain/market/adapters/createAdapter.js +4 -0
  32. package/dist/cjs/onchain/market/adapters/index.js +16 -0
  33. package/dist/cjs/onchain/market/adapters/types.js +2 -0
  34. package/dist/cjs/onchain/market/index.js +16 -0
  35. package/dist/cjs/onchain/positions/projectAavePosition.js +175 -0
  36. package/dist/cjs/onchain/preview/preview/loadAdapterReplayState.js +17 -0
  37. package/dist/cjs/onchain/preview/preview/previewOperation.js +2 -0
  38. package/dist/cjs/sdk/GearboxSDK.js +0 -9
  39. package/dist/cjs/sdk/prepare/PrepareApi.js +56 -0
  40. package/dist/cjs/sdk/preview/PreviewNamespace.js +42 -0
  41. package/dist/esm/model/index.js +2 -3
  42. package/dist/esm/offchain/GearboxAPI.js +0 -7
  43. package/dist/esm/offchain/index.js +1 -3
  44. package/dist/esm/onchain/accounts/bots/AccountBotsService.js +29 -0
  45. package/dist/esm/onchain/accounts/bots/PeripheryCompressorV310Contract.js +1 -1
  46. package/dist/esm/onchain/accounts/intents/index.js +2 -1
  47. package/dist/esm/onchain/accounts/intents/operations.js +20 -1
  48. package/dist/esm/onchain/accounts/intents/plan.js +33 -1
  49. package/dist/esm/onchain/accounts/intents/realize.js +46 -2
  50. package/dist/esm/onchain/accounts/intents/testing/market.js +1 -0
  51. package/dist/esm/onchain/accounts/intents/testing/sdk-mock.js +2 -1
  52. package/dist/esm/onchain/accounts/intents/utils/ledger.js +8 -0
  53. package/dist/esm/onchain/chain/chains.js +4 -0
  54. package/dist/esm/onchain/index.js +9 -1
  55. package/dist/esm/onchain/market/ZapperRegister.js +1 -1
  56. package/dist/esm/onchain/market/adapters/abi/aave/iAaveHorizonBridge.js +93 -0
  57. package/dist/esm/onchain/market/adapters/abi/aave/iAaveOracle.js +19 -0
  58. package/dist/esm/onchain/market/adapters/abi/aave/iAaveV3Pool.js +277 -0
  59. package/dist/esm/onchain/market/adapters/abi/aave/iPoolAddressesProvider.js +10 -0
  60. package/dist/esm/onchain/market/adapters/abi/aave/index.js +5 -0
  61. package/dist/esm/onchain/market/adapters/abi/actionAbi.js +1 -0
  62. package/dist/esm/onchain/market/adapters/abi/adapters/iAaveHorizonBridgeAdapter.js +223 -0
  63. package/dist/esm/onchain/market/adapters/abi/adapters/iAaveV3PoolAdapter.js +176 -0
  64. package/dist/esm/onchain/market/adapters/abi/adapters/index.js +3 -1
  65. package/dist/esm/onchain/market/adapters/abi/conctructorAbi.js +2 -0
  66. package/dist/esm/onchain/market/adapters/abi/index.js +8 -1
  67. package/dist/esm/onchain/market/adapters/contracts/AaveHorizonBridgeAdapterContract.js +170 -0
  68. package/dist/esm/onchain/market/adapters/contracts/AaveV3PoolAdapterContract.js +198 -0
  69. package/dist/esm/onchain/market/adapters/contracts/AbstractAdapter.js +8 -0
  70. package/dist/esm/onchain/market/adapters/contracts/index.js +3 -1
  71. package/dist/esm/onchain/market/adapters/createAdapter.js +4 -0
  72. package/dist/esm/onchain/market/adapters/index.js +9 -1
  73. package/dist/esm/onchain/market/adapters/types.js +2 -0
  74. package/dist/esm/onchain/market/index.js +9 -1
  75. package/dist/esm/onchain/positions/projectAavePosition.js +174 -0
  76. package/dist/esm/onchain/preview/preview/loadAdapterReplayState.js +16 -0
  77. package/dist/esm/onchain/preview/preview/previewOperation.js +2 -0
  78. package/dist/esm/sdk/GearboxSDK.js +0 -9
  79. package/dist/esm/sdk/prepare/PrepareApi.js +57 -1
  80. package/dist/esm/sdk/preview/PreviewNamespace.js +42 -0
  81. package/dist/types/model/aave.d.ts +34 -0
  82. package/dist/types/model/analytics.d.ts +2 -2
  83. package/dist/types/model/index.d.ts +6 -7
  84. package/dist/types/model/opportunities.d.ts +1 -1
  85. package/dist/types/model/positions.d.ts +1 -1
  86. package/dist/types/model/previews.d.ts +15 -0
  87. package/dist/types/offchain/AbstractOffchainNamespace.d.ts +1 -1
  88. package/dist/types/offchain/GearboxAPI.d.ts +0 -6
  89. package/dist/types/offchain/analytics/OffchainAnalytics.d.ts +1 -1
  90. package/dist/types/offchain/analytics/types.d.ts +1 -1
  91. package/dist/types/offchain/index.d.ts +1 -3
  92. package/dist/types/offchain/opportunities/OffchainOpportunities.d.ts +1 -1
  93. package/dist/types/offchain/opportunities/types.d.ts +1 -1
  94. package/dist/types/offchain/positions/OffchainPositions.d.ts +1 -1
  95. package/dist/types/offchain/positions/types.d.ts +1 -1
  96. package/dist/types/onchain/accounts/bots/AccountBotsService.d.ts +11 -1
  97. package/dist/types/onchain/accounts/bots/index.d.ts +2 -2
  98. package/dist/types/onchain/accounts/bots/types.d.ts +7 -1
  99. package/dist/types/onchain/accounts/index.d.ts +2 -2
  100. package/dist/types/onchain/accounts/intents/operations.d.ts +43 -1
  101. package/dist/types/onchain/accounts/intents/plan.d.ts +26 -1
  102. package/dist/types/onchain/accounts/intents/testing/market.d.ts +4 -0
  103. package/dist/types/onchain/accounts/intents/testing/sdk-mock.d.ts +4 -0
  104. package/dist/types/onchain/accounts/intents/types.d.ts +20 -1
  105. package/dist/types/onchain/index.d.ts +10 -2
  106. package/dist/types/onchain/market/adapters/abi/aave/iAaveHorizonBridge.d.ts +83 -0
  107. package/dist/types/onchain/market/adapters/abi/aave/iAaveOracle.d.ts +22 -0
  108. package/dist/types/onchain/market/adapters/abi/aave/iAaveV3Pool.d.ts +229 -0
  109. package/dist/types/onchain/market/adapters/abi/aave/iPoolAddressesProvider.d.ts +11 -0
  110. package/dist/types/onchain/market/adapters/abi/aave/index.d.ts +5 -0
  111. package/dist/types/onchain/market/adapters/abi/adapters/iAaveHorizonBridgeAdapter.d.ts +207 -0
  112. package/dist/types/onchain/market/adapters/abi/adapters/iAaveV3PoolAdapter.d.ts +172 -0
  113. package/dist/types/onchain/market/adapters/abi/adapters/index.d.ts +3 -1
  114. package/dist/types/onchain/market/adapters/abi/index.d.ts +8 -1
  115. package/dist/types/onchain/market/adapters/contracts/AaveHorizonBridgeAdapterContract.d.ts +341 -0
  116. package/dist/types/onchain/market/adapters/contracts/AaveV3PoolAdapterContract.d.ts +450 -0
  117. package/dist/types/onchain/market/adapters/contracts/AbstractAdapter.d.ts +8 -0
  118. package/dist/types/onchain/market/adapters/contracts/index.d.ts +3 -1
  119. package/dist/types/onchain/market/adapters/index.d.ts +9 -1
  120. package/dist/types/onchain/market/adapters/types.d.ts +3 -1
  121. package/dist/types/onchain/market/index.d.ts +9 -1
  122. package/dist/types/onchain/positions/projectAavePosition.d.ts +45 -0
  123. package/dist/types/onchain/preview/preview/loadAdapterReplayState.d.ts +13 -0
  124. package/dist/types/sdk/GearboxSDK.d.ts +1 -8
  125. package/dist/types/sdk/analytics/AnalyticsNamespace.d.ts +1 -1
  126. package/dist/types/sdk/analytics/types.d.ts +1 -1
  127. package/dist/types/sdk/index.d.ts +3 -3
  128. package/dist/types/sdk/opportunities/OpportunitiesNamespace.d.ts +1 -1
  129. package/dist/types/sdk/opportunities/types.d.ts +1 -1
  130. package/dist/types/sdk/positions/PositionsNamespace.d.ts +1 -1
  131. package/dist/types/sdk/positions/types.d.ts +1 -1
  132. package/dist/types/sdk/prepare/PrepareApi.d.ts +11 -3
  133. package/dist/types/sdk/prepare/index.d.ts +2 -2
  134. package/dist/types/sdk/prepare/types.d.ts +83 -1
  135. package/dist/types/sdk/preview/PreviewNamespace.d.ts +5 -1
  136. package/dist/types/sdk/preview/types.d.ts +12 -1
  137. package/dist/types/sdk/types.d.ts +0 -20
  138. package/package.json +1 -1
  139. package/dist/cjs/model/notices.schema.js +0 -25
  140. package/dist/cjs/offchain/notices/OffchainNotices.js +0 -27
  141. package/dist/cjs/offchain/notices/index.js +0 -3
  142. package/dist/esm/model/notices.schema.js +0 -23
  143. package/dist/esm/offchain/notices/OffchainNotices.js +0 -26
  144. package/dist/esm/offchain/notices/index.js +0 -1
  145. package/dist/types/model/notices.d.ts +0 -28
  146. package/dist/types/model/notices.schema.d.ts +0 -22
  147. package/dist/types/offchain/notices/OffchainNotices.d.ts +0 -18
  148. package/dist/types/offchain/notices/index.d.ts +0 -2
  149. /package/dist/cjs/model/{notices.js → aave.js} +0 -0
  150. /package/dist/esm/model/{notices.js → aave.js} +0 -0
@@ -0,0 +1,13 @@
1
+ import { PluginsMap } from "../../plugins/types.js";
2
+ import { OnchainSDK } from "../../OnchainSDK.js";
3
+ import { InnerOperation } from "../parse/types-facades.js";
4
+ import "../parse/index.js";
5
+ import "../../index.js";
6
+ //#region src/onchain/preview/preview/loadAdapterReplayState.d.ts
7
+ /**
8
+ * Has every adapter called in `multicall` read what it needs to replay its
9
+ * call, see {@link AbstractAdapterContract.loadReplayState}. Runs before
10
+ * {@link replayInnerOperations}, which cannot wait on the chain.
11
+ */
12
+ export declare function loadAdapterReplayState<P extends PluginsMap>(sdk: OnchainSDK<P>, multicall: InnerOperation[]): Promise<void>;
13
+ //#endregion
@@ -6,7 +6,7 @@ import { IOpportunities } from "./opportunities/types.js";
6
6
  import { IPositions } from "./positions/types.js";
7
7
  import { IPreviewByMode } from "./preview/types.js";
8
8
  import { IRewardsByMode } from "./rewards/types.js";
9
- import { GearboxSDKOptions, IGearboxSDK, INoticesByMode, Mode, OffchainByMode, OnchainByMode } from "./types.js";
9
+ import { GearboxSDKOptions, IGearboxSDK, Mode, OffchainByMode, OnchainByMode } from "./types.js";
10
10
  import "./analytics/index.js";
11
11
  import "./liquidations/index.js";
12
12
  import "./opportunities/index.js";
@@ -74,13 +74,6 @@ export declare class GearboxSDK<const M extends Mode = Mode> implements IGearbox
74
74
  * Namespace for claimable rewards. Absent in `offchain` mode.
75
75
  **/
76
76
  readonly rewards: IRewardsByMode[M];
77
- /**
78
- * The banners the backend attaches to a pool opportunity or a strategy
79
- * position, see {@link Notice}. Top-level because the subject is either
80
- * kind of entity, so neither namespace owns it. Backend-only, hence gated
81
- * by mode like every other backend read: absent in `onchain` mode.
82
- **/
83
- readonly notices: INoticesByMode[M];
84
77
  constructor(options: GearboxSDKOptions<M>);
85
78
  /**
86
79
  * Attaches the on-chain SDK when this instance owns one; a no-op in `offchain`
@@ -1,5 +1,5 @@
1
- import { ChartBundle, ChartRange, ProtocolChartMetric } from "../../model/charts.js";
2
1
  import { ChainScopedFilter } from "../../model/filters.js";
2
+ import { ChartBundle, ChartRange, ProtocolChartMetric } from "../../model/charts.js";
3
3
  import { DataResponse } from "../../model/response.js";
4
4
  import { GearboxAPI } from "../../offchain/GearboxAPI.js";
5
5
  import "../../offchain/index.js";
@@ -1,5 +1,5 @@
1
- import { ChartBundle, ChartRange, ProtocolChartMetric } from "../../model/charts.js";
2
1
  import { ChainScopedFilter } from "../../model/filters.js";
2
+ import { ChartBundle, ChartRange, ProtocolChartMetric } from "../../model/charts.js";
3
3
  import { DataResponse } from "../../model/response.js";
4
4
  import { IOffchainAnalyticsPositions } from "../../offchain/analytics/types.js";
5
5
  import "../../offchain/index.js";
@@ -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, DelayedStrategyResult, DepositStrategyParams, EmptyCreditAccountResult, FinalizeParams, FinalizeResult, IOpportunitiesPrepare, LpParams, LpRedeemParams, LpResult, LpState, MaxBorrowAndWithdrawOptions, MaxBorrowParams, MaxWithdrawCollateralOptions, MoveToAaveParams, 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, 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, MoveToAaveParams, 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,5 +1,5 @@
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 { ChartBundle, ChartRange, PoolPositionChartMetric, StrategyPositionChartMetric } from "../../model/charts.js";
3
3
  import { DataResponse } from "../../model/response.js";
4
4
  import { PositionWithdrawals } from "../../model/withdrawals.js";
5
5
  import "../../model/index.js";
@@ -1,5 +1,5 @@
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 { ChartBundle, ChartRange, PoolPositionChartMetric, StrategyPositionChartMetric } from "../../model/charts.js";
3
3
  import { DataResponse } from "../../model/response.js";
4
4
  import { PositionWithdrawals } from "../../model/withdrawals.js";
5
5
  import "../../model/index.js";
@@ -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, DepositStrategyParams, EmptyCreditAccountResult, FinalizeParams, FinalizeResult, IOpportunitiesPrepare, LpParams, LpRedeemParams, LpResult, LpState, MaxBorrowAndWithdrawOptions, MaxBorrowParams, MaxWithdrawCollateralOptions, MoveToAaveParams, 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.moveToAave}
107
+ **/
108
+ moveToAave(position: PositionInput, params: MoveToAaveParams): Promise<SDKReturn<StrategyResult, (AccountFlowError | DebtOutOfRangeError | UnsupportedCollateralTokenError) & 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, DelayedStrategyResult, DepositStrategyParams, EmptyCreditAccountResult, FinalizeParams, FinalizeResult, IOpportunitiesPrepare, LpParams, LpRedeemParams, LpResult, LpState, MaxBorrowAndWithdrawOptions, MaxBorrowParams, MaxWithdrawCollateralOptions, MoveToAaveParams, 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, type CreditAccountNotEmptyError, type CreditAccountNotFoundError, DelayedStrategyResult, DepositStrategyParams, EmptyCreditAccountResult, type ExecutionCost, FinalizeParams, FinalizeResult, IOpportunitiesPrepare, type LeverageBand, LpParams, LpRedeemParams, LpResult, LpState, MaxBorrowAndWithdrawOptions, MaxBorrowParams, MaxWithdrawCollateralOptions, MoveToAaveParams, 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,22 @@ 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 while the mint settles, as {@link OpenStrategyState} describes it,
264
+ * and the position it becomes on Aave after that.
265
+ **/
266
+ export interface OpenAavePositionState extends OpenStrategyState {
267
+ /** The position once it has moved to Aave. */
268
+ aave: AavePositionProjection;
269
+ }
270
+ /**
271
+ * What opening a leveraged position on Aave Horizon comes to: the transaction
272
+ * is the same opening, so it is built from this result the same way.
273
+ **/
274
+ export interface OpenAavePositionResult extends OpenStrategyResult {
275
+ state: OpenAavePositionState;
276
+ }
255
277
  /**
256
278
  * What taking a loan against collateral comes to.
257
279
  *
@@ -372,6 +394,10 @@ export interface RepayStrategyParams extends PrepareOptions {
372
394
  /** Native value to attach when paying a wrapped-native market in the coin. */
373
395
  value?: bigint;
374
396
  }
397
+ export interface MoveToAaveParams {
398
+ /** RWA collateral on the account; its whole balance moves to Aave. */
399
+ token: Address;
400
+ }
375
401
  export interface AdjustLeverageParams extends PrepareOptions {
376
402
  /**
377
403
  * Target total leverage scaled by `LEVERAGE_DECIMALS` (300n = 3x); 100n means
@@ -437,6 +463,14 @@ export interface OpenStrategyParams extends PrepareOptions {
437
463
  **/
438
464
  creditAccount?: Address;
439
465
  }
466
+ export interface OpenAavePositionParams extends OpenStrategyParams {
467
+ /**
468
+ * Wallet the account is opened for. The Aave position is this wallet's own,
469
+ * so what it already holds and owes on the Horizon pool counts towards the
470
+ * health factor and the debt Aave lends.
471
+ **/
472
+ wallet: Address;
473
+ }
440
474
  export interface BorrowParams extends PrepareOptions {
441
475
  /**
442
476
  * Token the wallet puts up as collateral. Must be a collateral token of the
@@ -627,7 +661,31 @@ export interface IOpportunitiesPrepare {
627
661
  * `creditAccount` puts the position on an account the wallet already holds
628
662
  * rather than creating one.
629
663
  **/
630
- openNewStrategy(strategy: StrategyInput, params: OpenStrategyParams): Promise<SDKReturn<OpenStrategyResult, (OpenFlowError | DebtOutOfRangeError | LeverageOutOfRangeError | UnsupportedTokenPairError | InsufficientPoolLiquidityError | NoStrategyTargetCollateralError | CreditAccountNotFoundError | CreditAccountNotEmptyError) & WithPartialState<OpenStrategyState>>>;
664
+ openNewStrategy(strategy: StrategyInput, params: OpenStrategyParams): Promise<SDKReturn<OpenStrategyResult, OpenStrategyError & WithPartialState<OpenStrategyState>>>;
665
+ /**
666
+ * Opening a leveraged position on Aave Horizon from wallet collateral.
667
+ *
668
+ * The RWA collateral may be minted asynchronously, so the opening itself is
669
+ * the one {@link openNewStrategy} prepares: a Gearbox credit account borrows
670
+ * and subscribes to the mint. Once the mint settles — at once where the
671
+ * withdrawal compressor lists no delayed operation for the RWA — the
672
+ * position moves to Aave, and `state.aave` describes it there.
673
+ *
674
+ * The move is the finalizer bot's: the facade refuses to change an
675
+ * account's debt twice in a block, so it cannot ride on the opening even
676
+ * when the mint is instant. The opening grants the bot its permissions on
677
+ * every credit manager with a Horizon bridge adapter, whichever of the two
678
+ * methods prepared it; the bot is the one the market configurator lists
679
+ * among its periphery contracts for that bridge, and with none listed the
680
+ * opening grants nothing and the move is left to {@link moveToAave}.
681
+ *
682
+ * The bot borrows the whole Gearbox debt on Aave or reverts, so an opening
683
+ * whose debt is above what Aave lends against the collateral at its LTV is
684
+ * refused with `debtOutOfRange`, `maxDebt` being that amount. A market whose
685
+ * target collateral cannot be moved to Aave is refused with
686
+ * `unsupportedCollateralToken`.
687
+ **/
688
+ openAavePosition(strategy: StrategyInput, params: OpenAavePositionParams): Promise<SDKReturn<OpenAavePositionResult, (OpenStrategyError | UnsupportedCollateralTokenError) & WithPartialState<OpenAavePositionState>>>;
631
689
  /**
632
690
  * Handing a wallet an account that holds nothing: no collateral, no debt, no
633
691
  * quotas and no route quoted. It exists so a wallet can hold an account
@@ -748,6 +806,30 @@ export interface IOpportunitiesPrepare {
748
806
  * the SDK does not hold.
749
807
  **/
750
808
  maxRepay(position: PositionInput): Promise<bigint>;
809
+ /**
810
+ * The second half of an {@link openAavePosition}: once the RWA collateral
811
+ * has been minted, the position leaves the credit account for Aave Horizon.
812
+ *
813
+ * The finalizer bot does this by itself; this is the manual path, for an
814
+ * account the bot has not reached. It makes the bot's adapter calls, but the
815
+ * debt is read here rather than in the transaction, hence the margin.
816
+ *
817
+ * One transaction: the whole balance of `token` is supplied to the Aave
818
+ * pool, the aTokens go to the account owner through the Horizon bridge,
819
+ * which borrows the underlying on the owner's behalf into the account, and
820
+ * the Gearbox loan is repaid in full with its quotas. Aave lends the debt
821
+ * plus a 10bps margin for the interest still to come; whatever the facade
822
+ * does not take stays on the account. The state answered is the credit
823
+ * account's: owing nothing, holding that remainder.
824
+ *
825
+ * The bridge borrows as the owner, so the transaction reverts unless the
826
+ * owner has delegated credit on Aave's variable debt token to the bridge.
827
+ *
828
+ * Refused with `unsupportedCollateralToken` when `token` is not on the
829
+ * account or the credit manager has no Aave adapters that take it, and with
830
+ * `debtOutOfRange` when the account owes nothing.
831
+ **/
832
+ moveToAave(position: PositionInput, params: MoveToAaveParams): Promise<SDKReturn<StrategyResult, (AccountFlowError | DebtOutOfRangeError | UnsupportedCollateralTokenError) & WithPartialState<OperationState>>>;
751
833
  /**
752
834
  * Retargeting leverage at fixed collateral: debt moves, own funds do not.
753
835
  *
@@ -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.2",
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