@gearbox-protocol/sdk 18.4.1-aave.1 → 18.4.1-aave.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/abi/rwa/iSecuritizeRWAFactory.js +15 -0
- package/dist/cjs/model/errors/index.js +1 -0
- package/dist/cjs/model/errors/operation-errors.js +9 -0
- package/dist/cjs/model/index.js +1 -0
- package/dist/cjs/onchain/accounts/bots/AccountBotsService.js +29 -0
- package/dist/cjs/onchain/accounts/bots/PeripheryCompressorV310Contract.js +2 -1
- package/dist/cjs/onchain/accounts/index.js +1 -1
- package/dist/cjs/onchain/accounts/intents/index.js +33 -1
- package/dist/cjs/onchain/accounts/intents/operations.js +13 -13
- package/dist/cjs/onchain/accounts/intents/plan.js +45 -23
- package/dist/cjs/onchain/accounts/intents/readAaveHoldings.js +56 -0
- package/dist/cjs/onchain/accounts/intents/realize.js +61 -23
- package/dist/cjs/onchain/accounts/intents/testing/sdk-mock.js +1 -1
- package/dist/cjs/onchain/accounts/intents/utils/ledger.js +6 -6
- package/dist/cjs/onchain/index.js +13 -1
- package/dist/cjs/onchain/market/ZapperRegister.js +1 -1
- package/dist/cjs/onchain/market/adapters/abi/aave/iAaveOracle.js +20 -0
- package/dist/cjs/onchain/market/adapters/abi/aave/iAaveV3Pool.js +166 -0
- package/dist/cjs/onchain/market/adapters/abi/aave/iPoolAddressesProvider.js +11 -0
- package/dist/cjs/onchain/market/adapters/abi/aave/iVariableDebtToken.js +17 -0
- package/dist/cjs/onchain/market/adapters/abi/aave/index.js +6 -0
- package/dist/cjs/onchain/market/adapters/abi/adapters/iAaveHorizonBridgeAdapter.js +27 -0
- package/dist/cjs/onchain/market/adapters/abi/index.js +8 -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 +100 -12
- package/dist/cjs/onchain/market/adapters/contracts/AaveV3PoolAdapterContract.js +19 -11
- package/dist/cjs/onchain/market/adapters/contracts/SecuritizeRedemptionGatewayAdapterContract.js +42 -5
- package/dist/cjs/onchain/market/adapters/index.js +8 -0
- package/dist/cjs/onchain/market/index.js +8 -0
- package/dist/cjs/onchain/market/rwa/securitize/SecuritizeRWAFactory.js +9 -0
- package/dist/cjs/onchain/positions/MultichainPositionsService.js +15 -0
- package/dist/cjs/onchain/positions/PositionsService.js +31 -0
- package/dist/cjs/onchain/positions/aaveMoveCalls.js +45 -0
- package/dist/cjs/onchain/positions/projectAavePosition.js +164 -26
- package/dist/cjs/onchain/positions/readAavePosition.js +152 -0
- package/dist/cjs/onchain/preview/index.js +2 -0
- package/dist/cjs/onchain/preview/preview/aaveBridgeBorrows.js +24 -0
- package/dist/cjs/onchain/preview/preview/aaveMoveStart.js +27 -0
- package/dist/cjs/onchain/preview/preview/index.js +2 -0
- package/dist/cjs/onchain/preview/preview/previewAdjustStrategyPosition.js +3 -0
- package/dist/cjs/onchain/preview/preview/previewExitOrRepayStrategyPosition.js +5 -2
- package/dist/cjs/onchain/preview/preview/previewOpenStrategyPosition.js +4 -1
- package/dist/cjs/onchain/preview/preview/previewOperation.js +31 -8
- package/dist/cjs/onchain/validation/bundles/checkAaveDelegation.js +54 -0
- package/dist/cjs/onchain/validation/bundles/checkCreditOperation.js +36 -11
- package/dist/cjs/onchain/validation/bundles/index.js +2 -0
- package/dist/cjs/onchain/validation/checkOperation.js +16 -4
- package/dist/cjs/onchain/validation/index.js +2 -0
- package/dist/cjs/sdk/execute/ExecuteApi.js +1 -0
- package/dist/cjs/sdk/positions/PositionsNamespace.js +6 -0
- package/dist/cjs/sdk/prepare/PrepareApi.js +68 -9
- package/dist/cjs/sdk/preview/PreviewNamespace.js +11 -2
- package/dist/esm/abi/rwa/iSecuritizeRWAFactory.js +15 -0
- package/dist/esm/model/errors/index.js +2 -2
- package/dist/esm/model/errors/operation-errors.js +9 -1
- package/dist/esm/model/index.js +2 -2
- package/dist/esm/onchain/accounts/bots/AccountBotsService.js +29 -0
- package/dist/esm/onchain/accounts/bots/PeripheryCompressorV310Contract.js +1 -1
- package/dist/esm/onchain/accounts/index.js +1 -1
- package/dist/esm/onchain/accounts/intents/index.js +34 -2
- package/dist/esm/onchain/accounts/intents/operations.js +12 -12
- package/dist/esm/onchain/accounts/intents/plan.js +46 -24
- package/dist/esm/onchain/accounts/intents/readAaveHoldings.js +55 -0
- package/dist/esm/onchain/accounts/intents/realize.js +62 -24
- package/dist/esm/onchain/accounts/intents/testing/sdk-mock.js +1 -1
- package/dist/esm/onchain/accounts/intents/utils/ledger.js +6 -6
- package/dist/esm/onchain/index.js +8 -2
- package/dist/esm/onchain/market/ZapperRegister.js +1 -1
- package/dist/esm/onchain/market/adapters/abi/aave/iAaveOracle.js +19 -0
- package/dist/esm/onchain/market/adapters/abi/aave/iAaveV3Pool.js +166 -0
- package/dist/esm/onchain/market/adapters/abi/aave/iPoolAddressesProvider.js +10 -0
- package/dist/esm/onchain/market/adapters/abi/aave/iVariableDebtToken.js +16 -0
- package/dist/esm/onchain/market/adapters/abi/aave/index.js +4 -1
- package/dist/esm/onchain/market/adapters/abi/adapters/iAaveHorizonBridgeAdapter.js +27 -0
- package/dist/esm/onchain/market/adapters/abi/index.js +5 -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 +101 -13
- package/dist/esm/onchain/market/adapters/contracts/AaveV3PoolAdapterContract.js +20 -12
- package/dist/esm/onchain/market/adapters/contracts/SecuritizeRedemptionGatewayAdapterContract.js +43 -6
- package/dist/esm/onchain/market/adapters/index.js +5 -1
- package/dist/esm/onchain/market/index.js +5 -1
- package/dist/esm/onchain/market/rwa/securitize/SecuritizeRWAFactory.js +9 -0
- package/dist/esm/onchain/positions/MultichainPositionsService.js +15 -0
- package/dist/esm/onchain/positions/PositionsService.js +31 -0
- package/dist/esm/onchain/positions/aaveMoveCalls.js +44 -0
- package/dist/esm/onchain/positions/projectAavePosition.js +165 -27
- package/dist/esm/onchain/positions/readAavePosition.js +151 -0
- package/dist/esm/onchain/preview/index.js +2 -1
- package/dist/esm/onchain/preview/preview/aaveBridgeBorrows.js +23 -0
- package/dist/esm/onchain/preview/preview/aaveMoveStart.js +26 -0
- package/dist/esm/onchain/preview/preview/index.js +2 -1
- package/dist/esm/onchain/preview/preview/previewAdjustStrategyPosition.js +3 -0
- package/dist/esm/onchain/preview/preview/previewExitOrRepayStrategyPosition.js +5 -2
- package/dist/esm/onchain/preview/preview/previewOpenStrategyPosition.js +4 -1
- package/dist/esm/onchain/preview/preview/previewOperation.js +31 -8
- package/dist/esm/onchain/validation/bundles/checkAaveDelegation.js +53 -0
- package/dist/esm/onchain/validation/bundles/checkCreditOperation.js +36 -11
- package/dist/esm/onchain/validation/bundles/index.js +2 -1
- package/dist/esm/onchain/validation/checkOperation.js +16 -4
- package/dist/esm/onchain/validation/index.js +2 -1
- package/dist/esm/sdk/execute/ExecuteApi.js +1 -0
- package/dist/esm/sdk/positions/PositionsNamespace.js +6 -0
- package/dist/esm/sdk/prepare/PrepareApi.js +69 -10
- package/dist/esm/sdk/preview/PreviewNamespace.js +11 -2
- package/dist/types/abi/rwa/iSecuritizeRWAFactory.d.ts +14 -0
- package/dist/types/model/aave.d.ts +60 -3
- package/dist/types/model/errors/index.d.ts +2 -2
- package/dist/types/model/errors/operation-errors.d.ts +19 -0
- package/dist/types/model/index.d.ts +5 -5
- package/dist/types/model/opportunities.d.ts +1 -1
- package/dist/types/model/previews.d.ts +18 -2
- package/dist/types/onchain/accounts/bots/AccountBotsService.d.ts +11 -1
- package/dist/types/onchain/accounts/bots/index.d.ts +2 -2
- package/dist/types/onchain/accounts/bots/types.d.ts +7 -1
- package/dist/types/onchain/accounts/index.d.ts +3 -3
- package/dist/types/onchain/accounts/intents/index.d.ts +21 -3
- package/dist/types/onchain/accounts/intents/operations.d.ts +27 -23
- package/dist/types/onchain/accounts/intents/plan.d.ts +23 -19
- package/dist/types/onchain/accounts/intents/readAaveHoldings.d.ts +16 -0
- package/dist/types/onchain/accounts/intents/types.d.ts +37 -14
- package/dist/types/onchain/index.d.ts +10 -4
- package/dist/types/onchain/market/adapters/abi/aave/iAaveOracle.d.ts +22 -0
- package/dist/types/onchain/market/adapters/abi/aave/iAaveV3Pool.d.ts +139 -0
- package/dist/types/onchain/market/adapters/abi/aave/iPoolAddressesProvider.d.ts +11 -0
- package/dist/types/onchain/market/adapters/abi/aave/iVariableDebtToken.d.ts +17 -0
- package/dist/types/onchain/market/adapters/abi/aave/index.d.ts +4 -1
- package/dist/types/onchain/market/adapters/abi/adapters/iAaveHorizonBridgeAdapter.d.ts +21 -0
- package/dist/types/onchain/market/adapters/abi/index.d.ts +5 -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 +59 -10
- package/dist/types/onchain/market/adapters/contracts/AaveV3PoolAdapterContract.d.ts +147 -4
- package/dist/types/onchain/market/adapters/contracts/SecuritizeRedemptionGatewayAdapterContract.d.ts +19 -4
- package/dist/types/onchain/market/adapters/index.d.ts +5 -1
- package/dist/types/onchain/market/index.d.ts +5 -1
- package/dist/types/onchain/market/rwa/securitize/SecuritizeRWAFactory.d.ts +20 -0
- package/dist/types/onchain/market/rwa/types.d.ts +6 -0
- 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/aaveMoveCalls.d.ts +30 -0
- package/dist/types/onchain/positions/index.d.ts +2 -2
- package/dist/types/onchain/positions/projectAavePosition.d.ts +34 -4
- package/dist/types/onchain/positions/readAavePosition.d.ts +22 -0
- package/dist/types/onchain/positions/types.d.ts +25 -0
- package/dist/types/onchain/preview/index.d.ts +2 -1
- package/dist/types/onchain/preview/preview/aaveBridgeBorrows.d.ts +15 -0
- package/dist/types/onchain/preview/preview/aaveMoveStart.d.ts +18 -0
- package/dist/types/onchain/preview/preview/index.d.ts +2 -1
- package/dist/types/onchain/validation/bundles/checkAaveDelegation.d.ts +21 -0
- package/dist/types/onchain/validation/bundles/checkCreditOperation.d.ts +2 -2
- package/dist/types/onchain/validation/bundles/index.d.ts +2 -1
- package/dist/types/onchain/validation/index.d.ts +2 -1
- package/dist/types/sdk/execute/types.d.ts +7 -5
- 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 +4 -4
- package/dist/types/sdk/prepare/index.d.ts +2 -2
- package/dist/types/sdk/prepare/types.d.ts +88 -28
- package/dist/types/sdk/preview/types.d.ts +4 -2
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { aaveBridgeBorrows } from "./aaveBridgeBorrows.js";
|
|
1
2
|
import { CreditAccountState, CreditAccountStateProps } from "./CreditAccountState.js";
|
|
2
3
|
import { DetectedDelayedOperation, detectDelayedOperation } from "./detectDelayedOperation.js";
|
|
3
4
|
import { buildDelayedStrategyPositionOperationPreview } from "./buildDelayedStrategyPositionOperationPreview.js";
|
|
@@ -10,4 +11,4 @@ import { ReplayMulticallResult, ReplayableOperation, replayMulticall } from "./r
|
|
|
10
11
|
import { previewAdjustStrategyPosition } from "./previewAdjustStrategyPosition.js";
|
|
11
12
|
import { CloseOrRepayOperation, previewExitOrRepayStrategyPosition } from "./previewExitOrRepayStrategyPosition.js";
|
|
12
13
|
import { PreviewOperationError, previewOperation } from "./previewOperation.js";
|
|
13
|
-
export { CloseOrRepayOperation, CreditAccountState, CreditAccountStateProps, DetectedDelayedClaim, DetectedDelayedOperation, PreviewOperationError, ReplayMulticallResult, ReplayState, ReplayableOperation, buildDelayedStrategyPositionOperationPreview, classifyCloseOrRepay, detectDelayedClaim, detectDelayedOperation, estimateClaimableAt, isCloseOrRepay, makeReplayState, midasGreenlistsAccount, previewAdjustStrategyPosition, previewExitOrRepayStrategyPosition, previewOperation, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent };
|
|
14
|
+
export { CloseOrRepayOperation, CreditAccountState, CreditAccountStateProps, DetectedDelayedClaim, DetectedDelayedOperation, PreviewOperationError, ReplayMulticallResult, ReplayState, ReplayableOperation, aaveBridgeBorrows, buildDelayedStrategyPositionOperationPreview, classifyCloseOrRepay, detectDelayedClaim, detectDelayedOperation, estimateClaimableAt, isCloseOrRepay, makeReplayState, midasGreenlistsAccount, previewAdjustStrategyPosition, previewExitOrRepayStrategyPosition, previewOperation, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { InsufficientBorrowAllowanceError } from "../../../model/errors/operation-errors.js";
|
|
2
|
+
import { UnexpectedFailureError } from "../../../model/errors/prepare-errors.js";
|
|
3
|
+
import { AaveBridgeBorrow } from "../../../model/aave.js";
|
|
4
|
+
import "../../../model/index.js";
|
|
5
|
+
import { OnchainSDK } from "../../OnchainSDK.js";
|
|
6
|
+
import { Address } from "viem";
|
|
7
|
+
//#region src/onchain/validation/bundles/checkAaveDelegation.d.ts
|
|
8
|
+
export interface CheckAaveDelegationInput {
|
|
9
|
+
sdk: OnchainSDK;
|
|
10
|
+
/** Account owner the bridge borrows as. */
|
|
11
|
+
owner: Address;
|
|
12
|
+
borrow: AaveBridgeBorrow;
|
|
13
|
+
blockNumber?: bigint;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* `owner` has delegated the bridge at least the borrowed amount on the
|
|
17
|
+
* variable debt token of the borrowed token, in the pool the bridge borrows
|
|
18
|
+
* from.
|
|
19
|
+
*/
|
|
20
|
+
export declare function checkAaveDelegation(input: CheckAaveDelegationInput): Promise<(InsufficientBorrowAllowanceError | UnexpectedFailureError)[]>;
|
|
21
|
+
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AccountNotMidasGreenlistedError, DebtOutOfRangeError, ForbiddenTokenError, InsufficientCollateralError, InsufficientPoolLiquidityError, QuotaAboveMaxError, QuotaCountExceededError, QuotaLimitReachedError, RWAOpenRequirementsError } from "../../../model/errors/operation-errors.js";
|
|
1
|
+
import { AccountNotMidasGreenlistedError, DebtOutOfRangeError, ForbiddenTokenError, InsufficientBorrowAllowanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, QuotaAboveMaxError, QuotaCountExceededError, QuotaLimitReachedError, RWAOpenRequirementsError } from "../../../model/errors/operation-errors.js";
|
|
2
2
|
import { AdjustStrategyPositionPreview, OpenStrategyPositionPreview } from "../../../model/previews.js";
|
|
3
3
|
import "../../../model/index.js";
|
|
4
4
|
import { OnchainSDK } from "../../OnchainSDK.js";
|
|
@@ -8,7 +8,7 @@ import { MarketStateError } from "./checkMarket.js";
|
|
|
8
8
|
import { Address } from "viem";
|
|
9
9
|
//#region src/onchain/validation/bundles/checkCreditOperation.d.ts
|
|
10
10
|
/** {@inheritDoc checkCreditOperation} */
|
|
11
|
-
export type CreditOperationError = MarketStateError | DebtOutOfRangeError | InsufficientPoolLiquidityError | ForbiddenTokenError | QuotaCountExceededError | QuotaAboveMaxError | QuotaLimitReachedError | InsufficientCollateralError | WalletFundingError | RWAOpenRequirementsError | AccountNotMidasGreenlistedError;
|
|
11
|
+
export type CreditOperationError = MarketStateError | DebtOutOfRangeError | InsufficientPoolLiquidityError | ForbiddenTokenError | QuotaCountExceededError | QuotaAboveMaxError | QuotaLimitReachedError | InsufficientCollateralError | WalletFundingError | RWAOpenRequirementsError | AccountNotMidasGreenlistedError | InsufficientBorrowAllowanceError;
|
|
12
12
|
/** The two previews that carry a position for the thresholds to weigh. */
|
|
13
13
|
export type CreditOperationPreview = OpenStrategyPositionPreview | AdjustStrategyPositionPreview;
|
|
14
14
|
export interface CreditOperationArgs extends HealthFactorThresholds {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CheckAaveDelegationInput, checkAaveDelegation } from "./checkAaveDelegation.js";
|
|
1
2
|
import { checkAccountQuotas } from "./checkAccountQuotas.js";
|
|
2
3
|
import { CheckWalletInput, WalletFundingError, checkWallet } from "./checkWallet.js";
|
|
3
4
|
import { CheckCollateralFundingInput, CollateralFundingPreview, checkCollateralFunding } from "./checkCollateralFunding.js";
|
|
@@ -17,4 +18,4 @@ import { CheckRWAOpeningInput, RWAOpeningError, checkRWAOpening } from "./checkR
|
|
|
17
18
|
import { CheckRWAOpenRequirementsInput, checkRWAOpenRequirements } from "./checkRWAOpenRequirements.js";
|
|
18
19
|
import { CheckWalletAllowanceInput, checkWalletAllowance } from "./checkWalletAllowance.js";
|
|
19
20
|
import { CheckWalletBalanceInput, checkWalletBalance } from "./checkWalletBalance.js";
|
|
20
|
-
export { CheckCollateralFundingInput, CheckLiquidationEligibilityInput, CheckLiquidationFundingInput, CheckMidasAccountGreenlistInput, CheckPoolFundingInput, CheckRWAOpenRequirementsInput, CheckRWAOpeningInput, CheckWalletAllowanceInput, CheckWalletBalanceInput, CheckWalletInput, CollateralFundingPreview, CreditOperationArgs, CreditOperationError, CreditOperationPreview, HealthFactorThresholds, LiquidationEligibilityError, MarketStateError, PoolOperationArgs, PoolOperationError, QuotaUpdateError, RWAOpeningError, WalletFundingError, WeighedFactors, checkAccountQuotas, checkCollateralFunding, checkCreditOperation, checkHealthFactors, checkIncreaseDebt, checkIncreaseQuota, checkLiquidationEligibility, checkLiquidationFunding, checkMarket, checkMidasAccountGreenlist, checkObtained, checkPoolFunding, checkPoolOperation, checkQuotaUpdates, checkRWAOpenRequirements, checkRWAOpening, checkWallet, checkWalletAllowance, checkWalletBalance };
|
|
21
|
+
export { CheckAaveDelegationInput, CheckCollateralFundingInput, CheckLiquidationEligibilityInput, CheckLiquidationFundingInput, CheckMidasAccountGreenlistInput, CheckPoolFundingInput, CheckRWAOpenRequirementsInput, CheckRWAOpeningInput, CheckWalletAllowanceInput, CheckWalletBalanceInput, CheckWalletInput, CollateralFundingPreview, CreditOperationArgs, CreditOperationError, CreditOperationPreview, HealthFactorThresholds, LiquidationEligibilityError, MarketStateError, PoolOperationArgs, PoolOperationError, QuotaUpdateError, RWAOpeningError, WalletFundingError, WeighedFactors, checkAaveDelegation, checkAccountQuotas, checkCollateralFunding, checkCreditOperation, checkHealthFactors, checkIncreaseDebt, checkIncreaseQuota, checkLiquidationEligibility, checkLiquidationFunding, checkMarket, checkMidasAccountGreenlist, checkObtained, checkPoolFunding, checkPoolOperation, checkQuotaUpdates, checkRWAOpenRequirements, checkRWAOpening, checkWallet, checkWalletAllowance, checkWalletBalance };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IntentValidationError, raise } from "./raise.js";
|
|
2
|
+
import { CheckAaveDelegationInput, checkAaveDelegation } from "./bundles/checkAaveDelegation.js";
|
|
2
3
|
import { checkAccountQuotas } from "./bundles/checkAccountQuotas.js";
|
|
3
4
|
import { CheckWalletInput, WalletFundingError, checkWallet } from "./bundles/checkWallet.js";
|
|
4
5
|
import { CheckCollateralFundingInput, CollateralFundingPreview, checkCollateralFunding } from "./bundles/checkCollateralFunding.js";
|
|
@@ -47,4 +48,4 @@ import { amountOf } from "./helpers/amount.js";
|
|
|
47
48
|
import { MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_SAFE_HEALTH_FACTOR_FORM } from "./helpers/health-factor-limits.js";
|
|
48
49
|
import { toToken, toTokenAmount } from "./helpers/token.js";
|
|
49
50
|
import "./helpers/index.js";
|
|
50
|
-
export { BorrowLimitArgs, CheckCollateralFundingInput, CheckLiquidationEligibilityInput, CheckLiquidationFundingInput, CheckLiquidationInput, CheckLiquidationOptions, CheckMidasAccountGreenlistInput, CheckOperationInput, CheckOperationOptions, CheckPoolFundingInput, CheckRWAOpenRequirementsInput, CheckRWAOpeningInput, CheckSimulationInput, CheckWalletAllowanceInput, CheckWalletBalanceInput, CheckWalletInput, CollateralFundingPreview, CollateralisedArgs, CreditAccountFrozenArgs, CreditManagerPausedArgs, CreditOperationArgs, CreditOperationError, CreditOperationPreview, CreditSimulationInput, DebtLimitsArgs, EmergencyLiquidatorArgs, ForbiddenTokenArgs, HealthFactorThresholds, type IntentValidationError, LeverageArgs, LiquidationEligibilityError, LiquidationValidationError, LiquidatorEligibleArgs, MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_SAFE_HEALTH_FACTOR_FORM, MarketExpiredArgs, MarketStateError, MaxQuotaArgs, OperationValidationError, PartiallyLiquidatableArgs, PoolLiquidityArgs, PoolOperationArgs, PoolOperationError, PoolPausedArgs, PoolSunsetArgs, QuotaActiveArgs, QuotaChangeArgs, QuotaCountArgs, QuotaLimitArgs, QuotaUpdateError, RWAOpeningError, ReservePriceLimitedArgs, SimulationValidationError, WalletFundingError, WeighedFactors, amountOf, checkAccountQuotas, checkBorrowLimit, checkCollateralFunding, checkCollateralised, checkCreditAccountFrozen, checkCreditManagerPaused, checkCreditOperation, checkDebtLimits, checkEmergencyLiquidator, checkForbiddenToken, checkHealthFactors, checkIncreaseDebt, checkIncreaseQuota, checkLeverage, checkLiquidation, checkLiquidationEligibility, checkLiquidationFunding, checkLiquidatorEligible, checkMarket, checkMarketExpired, checkMaxQuota, checkMidasAccountGreenlist, checkObtained, checkOperation, checkPartiallyLiquidatable, checkPoolFunding, checkPoolLiquidity, checkPoolOperation, checkPoolPaused, checkPoolSunset, checkQuotaActive, checkQuotaChange, checkQuotaCount, checkQuotaLimit, checkQuotaUpdates, checkRWAOpenRequirements, checkRWAOpening, checkReservePriceLimited, checkSimulation, checkWallet, checkWalletAllowance, checkWalletBalance, raise, toToken, toTokenAmount };
|
|
51
|
+
export { BorrowLimitArgs, CheckAaveDelegationInput, CheckCollateralFundingInput, CheckLiquidationEligibilityInput, CheckLiquidationFundingInput, CheckLiquidationInput, CheckLiquidationOptions, CheckMidasAccountGreenlistInput, CheckOperationInput, CheckOperationOptions, CheckPoolFundingInput, CheckRWAOpenRequirementsInput, CheckRWAOpeningInput, CheckSimulationInput, CheckWalletAllowanceInput, CheckWalletBalanceInput, CheckWalletInput, CollateralFundingPreview, CollateralisedArgs, CreditAccountFrozenArgs, CreditManagerPausedArgs, CreditOperationArgs, CreditOperationError, CreditOperationPreview, CreditSimulationInput, DebtLimitsArgs, EmergencyLiquidatorArgs, ForbiddenTokenArgs, HealthFactorThresholds, type IntentValidationError, LeverageArgs, LiquidationEligibilityError, LiquidationValidationError, LiquidatorEligibleArgs, MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_SAFE_HEALTH_FACTOR_FORM, MarketExpiredArgs, MarketStateError, MaxQuotaArgs, OperationValidationError, PartiallyLiquidatableArgs, PoolLiquidityArgs, PoolOperationArgs, PoolOperationError, PoolPausedArgs, PoolSunsetArgs, QuotaActiveArgs, QuotaChangeArgs, QuotaCountArgs, QuotaLimitArgs, QuotaUpdateError, RWAOpeningError, ReservePriceLimitedArgs, SimulationValidationError, WalletFundingError, WeighedFactors, amountOf, checkAaveDelegation, checkAccountQuotas, checkBorrowLimit, checkCollateralFunding, checkCollateralised, checkCreditAccountFrozen, checkCreditManagerPaused, checkCreditOperation, checkDebtLimits, checkEmergencyLiquidator, checkForbiddenToken, checkHealthFactors, checkIncreaseDebt, checkIncreaseQuota, checkLeverage, checkLiquidation, checkLiquidationEligibility, checkLiquidationFunding, checkLiquidatorEligible, checkMarket, checkMarketExpired, checkMaxQuota, checkMidasAccountGreenlist, checkObtained, checkOperation, checkPartiallyLiquidatable, checkPoolFunding, checkPoolLiquidity, checkPoolOperation, checkPoolPaused, checkPoolSunset, checkQuotaActive, checkQuotaChange, checkQuotaCount, checkQuotaLimit, checkQuotaUpdates, checkRWAOpenRequirements, checkRWAOpening, checkReservePriceLimited, checkSimulation, checkWallet, checkWalletAllowance, checkWalletBalance, raise, toToken, toTokenAmount };
|
|
@@ -5,7 +5,7 @@ import "../../model/index.js";
|
|
|
5
5
|
import { Asset } from "../../onchain/base/types.js";
|
|
6
6
|
import { RawTx } from "../../onchain/types/transactions.js";
|
|
7
7
|
import "../../onchain/index.js";
|
|
8
|
-
import { BorrowResult, EmptyCreditAccountResult, LpResult, OpenStrategyResult, StrategyResult } from "../prepare/types.js";
|
|
8
|
+
import { BorrowResult, EmptyCreditAccountResult, LpResult, OpenAavePositionResult, OpenStrategyResult, StrategyResult } from "../prepare/types.js";
|
|
9
9
|
import "../prepare/index.js";
|
|
10
10
|
import { Address } from "viem";
|
|
11
11
|
//#region src/sdk/execute/types.d.ts
|
|
@@ -26,16 +26,18 @@ export interface PoolPrepareRequest {
|
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
* Opening a new position, from a viable
|
|
29
|
-
* {@link IOpportunitiesPrepare.openNewStrategy}
|
|
30
|
-
*
|
|
31
|
-
*
|
|
29
|
+
* {@link IOpportunitiesPrepare.openNewStrategy} or
|
|
30
|
+
* {@link IOpportunitiesPrepare.openAavePosition} result; the latter's
|
|
31
|
+
* `moveCalls` end the same multicall. The prepared state values collateral in
|
|
32
|
+
* underlying only, so the wallet's actual collateral assets and the native
|
|
33
|
+
* value to attach come from the caller.
|
|
32
34
|
**/
|
|
33
35
|
export interface OpenPrepareRequest {
|
|
34
36
|
kind: "open";
|
|
35
37
|
chainId: ChainId;
|
|
36
38
|
creditManager: Address;
|
|
37
39
|
wallet: Address;
|
|
38
|
-
sim: SDKResult<OpenStrategyResult>;
|
|
40
|
+
sim: SDKResult<OpenStrategyResult | OpenAavePositionResult>;
|
|
39
41
|
/** What leaves the wallet, token by token. */
|
|
40
42
|
collateral: Asset[];
|
|
41
43
|
/** Native value to attach when paying a wrapped-native market in the coin. */
|
|
@@ -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,
|
|
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";
|
|
@@ -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,
|
|
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,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,
|
|
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
|
|
@@ -77,7 +77,7 @@ export declare class PrepareApi extends MultichainConstruct implements IOpportun
|
|
|
77
77
|
/**
|
|
78
78
|
* {@inheritDoc IOpportunitiesPrepare.openAavePosition}
|
|
79
79
|
**/
|
|
80
|
-
openAavePosition(strategy: StrategyInput, params:
|
|
80
|
+
openAavePosition(strategy: StrategyInput, params: OpenAavePositionParams): Promise<SDKReturn<OpenAavePositionResult, (OpenStrategyError | UnsupportedCollateralTokenError) & WithPartialState<OpenAavePositionState>>>;
|
|
81
81
|
/**
|
|
82
82
|
* {@inheritDoc IOpportunitiesPrepare.borrow}
|
|
83
83
|
**/
|
|
@@ -103,9 +103,9 @@ export declare class PrepareApi extends MultichainConstruct implements IOpportun
|
|
|
103
103
|
**/
|
|
104
104
|
maxRepay(position: PositionInput): Promise<bigint>;
|
|
105
105
|
/**
|
|
106
|
-
* {@inheritDoc IOpportunitiesPrepare.
|
|
106
|
+
* {@inheritDoc IOpportunitiesPrepare.closeAavePosition}
|
|
107
107
|
**/
|
|
108
|
-
|
|
108
|
+
closeAavePosition(position: PositionInput, params: CloseAavePositionParams): Promise<SDKReturn<DelayedStrategyResult, (AccountFlowError | CreditAccountNotEmptyError | DebtOutOfRangeError | UnsupportedCollateralTokenError | InsufficientPoolLiquidityError | NoDelayedRouteError | MultipleDelayedWithdrawalsError | WithdrawalInProgressError) & WithPartialState<OperationState>>>;
|
|
109
109
|
/**
|
|
110
110
|
* {@inheritDoc IOpportunitiesPrepare.adjustLeverage}
|
|
111
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,
|
|
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,
|
|
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 };
|
|
@@ -260,12 +260,20 @@ export interface OpenStrategyResult {
|
|
|
260
260
|
}
|
|
261
261
|
/**
|
|
262
262
|
* Where an Aave Horizon opening arrives: the credit account the position is
|
|
263
|
-
* built in
|
|
264
|
-
*
|
|
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.
|
|
265
266
|
**/
|
|
266
267
|
export interface OpenAavePositionState extends OpenStrategyState {
|
|
267
268
|
/** The position once it has moved to Aave. */
|
|
268
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[];
|
|
269
277
|
}
|
|
270
278
|
/**
|
|
271
279
|
* What opening a leveraged position on Aave Horizon comes to: the transaction
|
|
@@ -394,9 +402,11 @@ export interface RepayStrategyParams extends PrepareOptions {
|
|
|
394
402
|
/** Native value to attach when paying a wrapped-native market in the coin. */
|
|
395
403
|
value?: bigint;
|
|
396
404
|
}
|
|
397
|
-
export interface
|
|
398
|
-
/** RWA
|
|
405
|
+
export interface CloseAavePositionParams extends PrepareOptions {
|
|
406
|
+
/** RWA the account owner holds on Aave Horizon; all of it comes back. */
|
|
399
407
|
token: Address;
|
|
408
|
+
/** Wallet the exit sends what is left to, as the asset on an RWA market. */
|
|
409
|
+
to: Address;
|
|
400
410
|
}
|
|
401
411
|
export interface AdjustLeverageParams extends PrepareOptions {
|
|
402
412
|
/**
|
|
@@ -463,6 +473,14 @@ export interface OpenStrategyParams extends PrepareOptions {
|
|
|
463
473
|
**/
|
|
464
474
|
creditAccount?: Address;
|
|
465
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
|
+
}
|
|
466
484
|
export interface BorrowParams extends PrepareOptions {
|
|
467
485
|
/**
|
|
468
486
|
* Token the wallet puts up as collateral. Must be a collateral token of the
|
|
@@ -657,12 +675,38 @@ export interface IOpportunitiesPrepare {
|
|
|
657
675
|
/**
|
|
658
676
|
* Opening a leveraged position on Aave Horizon from wallet collateral.
|
|
659
677
|
*
|
|
660
|
-
* The
|
|
661
|
-
*
|
|
662
|
-
*
|
|
663
|
-
*
|
|
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`.
|
|
664
708
|
**/
|
|
665
|
-
openAavePosition(strategy: StrategyInput, params:
|
|
709
|
+
openAavePosition(strategy: StrategyInput, params: OpenAavePositionParams): Promise<SDKReturn<OpenAavePositionResult, (OpenStrategyError | UnsupportedCollateralTokenError) & WithPartialState<OpenAavePositionState>>>;
|
|
666
710
|
/**
|
|
667
711
|
* Handing a wallet an account that holds nothing: no collateral, no debt, no
|
|
668
712
|
* quotas and no route quoted. It exists so a wallet can hold an account
|
|
@@ -784,25 +828,41 @@ export interface IOpportunitiesPrepare {
|
|
|
784
828
|
**/
|
|
785
829
|
maxRepay(position: PositionInput): Promise<bigint>;
|
|
786
830
|
/**
|
|
787
|
-
* The
|
|
788
|
-
*
|
|
789
|
-
*
|
|
790
|
-
*
|
|
791
|
-
*
|
|
792
|
-
*
|
|
793
|
-
* the
|
|
794
|
-
*
|
|
795
|
-
*
|
|
796
|
-
*
|
|
797
|
-
*
|
|
798
|
-
*
|
|
799
|
-
*
|
|
800
|
-
*
|
|
801
|
-
*
|
|
802
|
-
*
|
|
803
|
-
*
|
|
804
|
-
|
|
805
|
-
|
|
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>>>;
|
|
806
866
|
/**
|
|
807
867
|
* Retargeting leverage at fixed collateral: debt moves, own funds do not.
|
|
808
868
|
*
|
|
@@ -31,8 +31,10 @@ export interface IPreview {
|
|
|
31
31
|
* credit account the position is built in while the mint settles, and the
|
|
32
32
|
* position it becomes on Aave after that.
|
|
33
33
|
*
|
|
34
|
-
* Calldata that is not an account opening
|
|
35
|
-
* `unsupportedOperation`.
|
|
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.
|
|
36
38
|
**/
|
|
37
39
|
openAavePosition(input: PreviewOperationInput, options?: PreviewOperationOptions): Promise<SDKReturn<OpenAavePositionPreview, PreviewOperationError>>;
|
|
38
40
|
/**
|