@gearbox-protocol/sdk 18.4.1-aave.8 → 18.4.1-aave.9
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.
- package/dist/cjs/onchain/accounts/index.js +1 -1
- package/dist/cjs/onchain/accounts/intents/index.js +33 -0
- package/dist/cjs/onchain/accounts/intents/operations.js +21 -0
- package/dist/cjs/onchain/accounts/intents/plan.js +55 -0
- package/dist/cjs/onchain/accounts/intents/readAaveHoldings.js +56 -0
- package/dist/cjs/onchain/accounts/intents/realize.js +64 -1
- package/dist/cjs/onchain/accounts/intents/testing/sdk-mock.js +1 -1
- package/dist/cjs/onchain/accounts/intents/utils/ledger.js +8 -0
- package/dist/cjs/onchain/index.js +3 -1
- package/dist/cjs/onchain/market/adapters/abi/index.js +2 -0
- package/dist/cjs/onchain/market/adapters/abi/securitize/iSecuritizeNAVProvider.js +15 -0
- package/dist/cjs/onchain/market/adapters/abi/securitize/index.js +2 -0
- package/dist/cjs/onchain/market/adapters/contracts/AaveHorizonBridgeAdapterContract.js +21 -0
- package/dist/cjs/onchain/market/adapters/contracts/AaveV3PoolAdapterContract.js +14 -0
- package/dist/cjs/onchain/market/adapters/contracts/SecuritizeRedemptionGatewayAdapterContract.js +42 -5
- package/dist/cjs/onchain/market/adapters/index.js +2 -0
- package/dist/cjs/onchain/market/index.js +2 -0
- package/dist/cjs/onchain/positions/MultichainPositionsService.js +15 -0
- package/dist/cjs/onchain/positions/PositionsService.js +31 -0
- package/dist/cjs/onchain/positions/readAavePosition.js +152 -0
- package/dist/cjs/onchain/preview/preview/previewOperation.js +8 -5
- package/dist/cjs/sdk/positions/PositionsNamespace.js +6 -0
- package/dist/cjs/sdk/prepare/PrepareApi.js +43 -0
- package/dist/esm/dev/AccountOpener.js +1 -1
- package/dist/esm/dev/withdrawalUtils.js +1 -1
- package/dist/esm/history/trace/extractTransfers.js +1 -1
- package/dist/esm/onchain/accounts/CreditAccountsServiceV310.js +2 -2
- package/dist/esm/onchain/accounts/index.js +1 -1
- package/dist/esm/onchain/accounts/intents/index.js +34 -1
- package/dist/esm/onchain/accounts/intents/operations.js +20 -1
- package/dist/esm/onchain/accounts/intents/plan.js +56 -2
- package/dist/esm/onchain/accounts/intents/readAaveHoldings.js +55 -0
- package/dist/esm/onchain/accounts/intents/realize.js +65 -2
- package/dist/esm/onchain/accounts/intents/testing/sdk-mock.js +1 -1
- package/dist/esm/onchain/accounts/intents/utils/ledger.js +8 -0
- package/dist/esm/onchain/accounts/liquidations/LiquidationsService.js +1 -1
- package/dist/esm/onchain/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.js +1 -1
- package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.js +1 -1
- package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.js +1 -1
- package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js +1 -1
- package/dist/esm/onchain/base/TokensMeta.js +3 -3
- package/dist/esm/onchain/core/createAddressProvider.js +1 -1
- package/dist/esm/onchain/index.js +3 -2
- package/dist/esm/onchain/market/adapters/abi/index.js +2 -1
- package/dist/esm/onchain/market/adapters/abi/securitize/iSecuritizeNAVProvider.js +14 -0
- package/dist/esm/onchain/market/adapters/abi/securitize/index.js +2 -1
- package/dist/esm/onchain/market/adapters/contracts/AaveHorizonBridgeAdapterContract.js +21 -0
- package/dist/esm/onchain/market/adapters/contracts/AaveV3PoolAdapterContract.js +14 -0
- package/dist/esm/onchain/market/adapters/contracts/AccountMigratorAdapterContract.js +1 -1
- package/dist/esm/onchain/market/adapters/contracts/ERC4626AdapterContract.js +1 -1
- package/dist/esm/onchain/market/adapters/contracts/SecuritizeRedemptionGatewayAdapterContract.js +43 -6
- package/dist/esm/onchain/market/adapters/index.js +2 -1
- package/dist/esm/onchain/market/credit/CreditFacadeV310BaseContract.js +1 -1
- package/dist/esm/onchain/market/index.js +2 -1
- package/dist/esm/onchain/market/pool/PoolV310Contract.js +1 -1
- package/dist/esm/onchain/market/rwa/createDegenNFT.js +1 -1
- package/dist/esm/onchain/market/zapper/IETHZapperContract.js +1 -1
- package/dist/esm/onchain/market/zapper/ZapperContract.js +1 -1
- package/dist/esm/onchain/positions/MultichainPositionsService.js +15 -0
- package/dist/esm/onchain/positions/PositionsService.js +31 -0
- package/dist/esm/onchain/positions/readAavePosition.js +151 -0
- package/dist/esm/onchain/preview/preview/previewOperation.js +8 -5
- package/dist/esm/onchain/preview/preview/previewPoolPositionOperation.js +2 -2
- package/dist/esm/onchain/utils/viem/simulateWithPriceUpdates.js +1 -1
- package/dist/esm/sdk/positions/PositionsNamespace.js +6 -0
- package/dist/esm/sdk/prepare/PrepareApi.js +43 -0
- package/dist/types/model/aave.d.ts +39 -0
- package/dist/types/model/index.d.ts +4 -4
- package/dist/types/model/opportunities.d.ts +1 -1
- package/dist/types/onchain/accounts/index.d.ts +2 -2
- package/dist/types/onchain/accounts/intents/index.d.ts +21 -3
- package/dist/types/onchain/accounts/intents/operations.d.ts +38 -1
- package/dist/types/onchain/accounts/intents/plan.d.ts +27 -1
- package/dist/types/onchain/accounts/intents/readAaveHoldings.d.ts +16 -0
- package/dist/types/onchain/accounts/intents/types.d.ts +42 -0
- package/dist/types/onchain/index.d.ts +4 -3
- package/dist/types/onchain/market/adapters/abi/index.d.ts +2 -1
- package/dist/types/onchain/market/adapters/abi/securitize/iSecuritizeNAVProvider.d.ts +13 -0
- package/dist/types/onchain/market/adapters/abi/securitize/index.d.ts +2 -1
- package/dist/types/onchain/market/adapters/contracts/AaveHorizonBridgeAdapterContract.d.ts +7 -0
- package/dist/types/onchain/market/adapters/contracts/AaveV3PoolAdapterContract.d.ts +5 -0
- package/dist/types/onchain/market/adapters/contracts/SecuritizeRedemptionGatewayAdapterContract.d.ts +19 -4
- package/dist/types/onchain/market/adapters/index.d.ts +2 -1
- package/dist/types/onchain/market/index.d.ts +2 -1
- package/dist/types/onchain/positions/MultichainPositionsService.d.ts +7 -1
- package/dist/types/onchain/positions/PositionsService.d.ts +16 -2
- package/dist/types/onchain/positions/index.d.ts +2 -2
- package/dist/types/onchain/positions/readAavePosition.d.ts +22 -0
- package/dist/types/onchain/positions/types.d.ts +25 -0
- package/dist/types/sdk/index.d.ts +2 -2
- package/dist/types/sdk/positions/PositionsNamespace.d.ts +6 -1
- package/dist/types/sdk/positions/types.d.ts +9 -1
- package/dist/types/sdk/prepare/PrepareApi.d.ts +5 -1
- package/dist/types/sdk/prepare/index.d.ts +2 -2
- package/dist/types/sdk/prepare/types.d.ts +42 -0
- package/package.json +1 -1
|
@@ -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, MoveToAaveParams, OpenAavePositionParams, OpenAavePositionResult, OpenAavePositionState, OpenFlowError, OpenStrategyError, 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, 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";
|
|
@@ -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, 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 };
|
|
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, 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,9 +1,10 @@
|
|
|
1
1
|
import { PoolPositionRef, Position, PositionFilter, PositionTransaction, PositionsTotals, StrategyPositionRef } from "../../model/positions.js";
|
|
2
|
+
import { AavePosition } from "../../model/aave.js";
|
|
2
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
1
|
import { PoolPositionRef, Position, PositionFilter, PositionTransaction, PositionsTotals, StrategyPositionRef } from "../../model/positions.js";
|
|
2
|
+
import { AavePosition } from "../../model/aave.js";
|
|
2
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.
|
|
@@ -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, MoveToAaveParams, OpenAavePositionParams, OpenAavePositionResult, OpenAavePositionState, OpenFlowError, OpenStrategyError, 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, 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
|
|
@@ -106,6 +106,10 @@ export declare class PrepareApi extends MultichainConstruct implements IOpportun
|
|
|
106
106
|
* {@inheritDoc IOpportunitiesPrepare.moveToAave}
|
|
107
107
|
**/
|
|
108
108
|
moveToAave(position: PositionInput, params: MoveToAaveParams): Promise<SDKReturn<StrategyResult, (AccountFlowError | DebtOutOfRangeError | UnsupportedCollateralTokenError) & WithPartialState<OperationState>>>;
|
|
109
|
+
/**
|
|
110
|
+
* {@inheritDoc IOpportunitiesPrepare.closeAavePosition}
|
|
111
|
+
**/
|
|
112
|
+
closeAavePosition(position: PositionInput, params: CloseAavePositionParams): Promise<SDKReturn<DelayedStrategyResult, (AccountFlowError | CreditAccountNotEmptyError | DebtOutOfRangeError | UnsupportedCollateralTokenError | InsufficientPoolLiquidityError | NoDelayedRouteError | MultipleDelayedWithdrawalsError | WithdrawalInProgressError) & WithPartialState<OperationState>>>;
|
|
109
113
|
/**
|
|
110
114
|
* {@inheritDoc IOpportunitiesPrepare.adjustLeverage}
|
|
111
115
|
**/
|
|
@@ -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, MoveToAaveParams, OpenAavePositionParams, OpenAavePositionResult, OpenAavePositionState, OpenFlowError, OpenStrategyError, 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, 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, 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 };
|
|
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, 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 };
|
|
@@ -410,6 +410,12 @@ export interface MoveToAaveParams {
|
|
|
410
410
|
**/
|
|
411
411
|
claimable?: PositionClaimableWithdrawal;
|
|
412
412
|
}
|
|
413
|
+
export interface CloseAavePositionParams extends PrepareOptions {
|
|
414
|
+
/** RWA the account owner holds on Aave Horizon; all of it comes back. */
|
|
415
|
+
token: Address;
|
|
416
|
+
/** Wallet the exit sends what is left to, as the asset on an RWA market. */
|
|
417
|
+
to: Address;
|
|
418
|
+
}
|
|
413
419
|
export interface AdjustLeverageParams extends PrepareOptions {
|
|
414
420
|
/**
|
|
415
421
|
* Target total leverage scaled by `LEVERAGE_DECIMALS` (300n = 3x); 100n means
|
|
@@ -851,6 +857,42 @@ export interface IOpportunitiesPrepare {
|
|
|
851
857
|
* nothing.
|
|
852
858
|
**/
|
|
853
859
|
moveToAave(position: PositionInput, params: MoveToAaveParams): Promise<SDKReturn<StrategyResult, (AccountFlowError | DebtOutOfRangeError | UnsupportedCollateralTokenError) & WithPartialState<OperationState>>>;
|
|
860
|
+
/**
|
|
861
|
+
* The way out of an {@link openAavePosition}, in one transaction: the
|
|
862
|
+
* account owner's Aave Horizon position in `token` comes back to the credit
|
|
863
|
+
* account and is redeemed through the RWA's redemption gateway, which
|
|
864
|
+
* settles after a delay.
|
|
865
|
+
*
|
|
866
|
+
* The request transaction: the account borrows what the owner owes on Aave,
|
|
867
|
+
* the Horizon bridge repays it and hands every aToken of `token` the owner
|
|
868
|
+
* holds to the account, the pool turns them back into `token`, and the
|
|
869
|
+
* account's whole balance of `token` is requested for redemption. On an RWA
|
|
870
|
+
* market Aave is repaid in the asset the underlying wraps, which the loan is
|
|
871
|
+
* unwrapped into. The request records an exit: once the redemption has
|
|
872
|
+
* matured, {@link finalize} — or the Horizon finalizer bot, where the account
|
|
873
|
+
* granted it its permissions — claims it, settles the loan and sends the rest
|
|
874
|
+
* to `to`.
|
|
875
|
+
*
|
|
876
|
+
* Aave debt grows every second and the bridge keeps whatever Aave does not
|
|
877
|
+
* take, so the repayment is the debt read now plus an hour of interest at the
|
|
878
|
+
* current rate. A transaction landing sooner leaves the bridge the interest
|
|
879
|
+
* of the time it did not take; one landing later reverts, as Aave will not
|
|
880
|
+
* release the aTokens of a position left with debt.
|
|
881
|
+
*
|
|
882
|
+
* `state` is where the exit ends, the account settled and empty; the account
|
|
883
|
+
* as the request leaves it — the redemption in flight, the loan borrowed — is
|
|
884
|
+
* `delayed.afterRequest`, and `delayed.claimableAt` is when the tail can run.
|
|
885
|
+
*
|
|
886
|
+
* The account has to be the owner's in a credit manager with Aave adapters
|
|
887
|
+
* for `token`, owing nothing and holding no quota — the one an opening left
|
|
888
|
+
* empty once the position moved to Aave qualifies. Refused with
|
|
889
|
+
* `creditAccountNotEmpty` otherwise, with `unsupportedCollateralToken` when
|
|
890
|
+
* the owner holds no aToken of `token` or no adapter takes it, with
|
|
891
|
+
* `debtOutOfRange` when the owner owes nothing on Aave or the loan is outside
|
|
892
|
+
* the facade's limits, and with `noDelayedRoute` when `token` has no
|
|
893
|
+
* redemption that can take a balance arriving in the same transaction.
|
|
894
|
+
**/
|
|
895
|
+
closeAavePosition(position: PositionInput, params: CloseAavePositionParams): Promise<SDKReturn<DelayedStrategyResult, (AccountFlowError | CreditAccountNotEmptyError | DebtOutOfRangeError | UnsupportedCollateralTokenError | InsufficientPoolLiquidityError | NoDelayedRouteError | MultipleDelayedWithdrawalsError | WithdrawalInProgressError) & WithPartialState<OperationState>>>;
|
|
854
896
|
/**
|
|
855
897
|
* Retargeting leverage at fixed collateral: debt moves, own funds do not.
|
|
856
898
|
*
|