@gearbox-protocol/sdk 18.4.0 → 18.4.1-aave.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +2 -4
- package/dist/cjs/offchain/GearboxAPI.js +0 -7
- package/dist/cjs/offchain/index.js +0 -3
- 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 -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 +84 -2
- package/dist/cjs/onchain/accounts/intents/testing/market.js +1 -0
- package/dist/cjs/onchain/accounts/intents/testing/sdk-mock.js +3 -2
- package/dist/cjs/onchain/accounts/intents/utils/ledger.js +8 -0
- package/dist/cjs/onchain/chain/chains.js +4 -0
- package/dist/cjs/onchain/index.js +25 -1
- package/dist/cjs/onchain/market/ZapperRegister.js +1 -1
- package/dist/cjs/onchain/market/adapters/abi/aave/iAaveHorizonBridge.js +94 -0
- package/dist/cjs/onchain/market/adapters/abi/aave/iAaveOracle.js +20 -0
- package/dist/cjs/onchain/market/adapters/abi/aave/iAaveV3Pool.js +278 -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 +11 -0
- package/dist/cjs/onchain/market/adapters/abi/actionAbi.js +1 -0
- package/dist/cjs/onchain/market/adapters/abi/adapters/iAaveHorizonBridgeAdapter.js +224 -0
- package/dist/cjs/onchain/market/adapters/abi/adapters/iAaveV3PoolAdapter.js +177 -0
- package/dist/cjs/onchain/market/adapters/abi/adapters/index.js +4 -0
- package/dist/cjs/onchain/market/adapters/abi/conctructorAbi.js +2 -0
- package/dist/cjs/onchain/market/adapters/abi/index.js +17 -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 +218 -0
- package/dist/cjs/onchain/market/adapters/contracts/AaveV3PoolAdapterContract.js +213 -0
- package/dist/cjs/onchain/market/adapters/contracts/AbstractAdapter.js +8 -0
- package/dist/cjs/onchain/market/adapters/contracts/SecuritizeRedemptionGatewayAdapterContract.js +42 -5
- package/dist/cjs/onchain/market/adapters/contracts/index.js +4 -0
- package/dist/cjs/onchain/market/adapters/createAdapter.js +4 -0
- package/dist/cjs/onchain/market/adapters/index.js +20 -0
- package/dist/cjs/onchain/market/adapters/types.js +2 -0
- package/dist/cjs/onchain/market/index.js +20 -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 +178 -0
- 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/loadAdapterReplayState.js +17 -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 +33 -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/GearboxSDK.js +0 -9
- 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 +98 -0
- package/dist/cjs/sdk/preview/PreviewNamespace.js +42 -0
- 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 +3 -4
- package/dist/esm/offchain/GearboxAPI.js +0 -7
- package/dist/esm/offchain/index.js +1 -3
- 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 -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 +86 -4
- package/dist/esm/onchain/accounts/intents/testing/market.js +1 -0
- package/dist/esm/onchain/accounts/intents/testing/sdk-mock.js +3 -2
- package/dist/esm/onchain/accounts/intents/utils/ledger.js +8 -0
- package/dist/esm/onchain/chain/chains.js +4 -0
- package/dist/esm/onchain/index.js +14 -2
- package/dist/esm/onchain/market/ZapperRegister.js +1 -1
- package/dist/esm/onchain/market/adapters/abi/aave/iAaveHorizonBridge.js +93 -0
- package/dist/esm/onchain/market/adapters/abi/aave/iAaveOracle.js +19 -0
- package/dist/esm/onchain/market/adapters/abi/aave/iAaveV3Pool.js +277 -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 +6 -0
- package/dist/esm/onchain/market/adapters/abi/actionAbi.js +1 -0
- package/dist/esm/onchain/market/adapters/abi/adapters/iAaveHorizonBridgeAdapter.js +223 -0
- package/dist/esm/onchain/market/adapters/abi/adapters/iAaveV3PoolAdapter.js +176 -0
- package/dist/esm/onchain/market/adapters/abi/adapters/index.js +3 -1
- package/dist/esm/onchain/market/adapters/abi/conctructorAbi.js +2 -0
- package/dist/esm/onchain/market/adapters/abi/index.js +10 -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 +217 -0
- package/dist/esm/onchain/market/adapters/contracts/AaveV3PoolAdapterContract.js +212 -0
- package/dist/esm/onchain/market/adapters/contracts/AbstractAdapter.js +8 -0
- package/dist/esm/onchain/market/adapters/contracts/SecuritizeRedemptionGatewayAdapterContract.js +43 -6
- package/dist/esm/onchain/market/adapters/contracts/index.js +3 -1
- package/dist/esm/onchain/market/adapters/createAdapter.js +4 -0
- package/dist/esm/onchain/market/adapters/index.js +11 -1
- package/dist/esm/onchain/market/adapters/types.js +2 -0
- package/dist/esm/onchain/market/index.js +11 -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 +177 -0
- 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/loadAdapterReplayState.js +16 -0
- 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 +33 -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/GearboxSDK.js +0 -9
- 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 +99 -1
- package/dist/esm/sdk/preview/PreviewNamespace.js +42 -0
- package/dist/types/abi/rwa/iSecuritizeRWAFactory.d.ts +14 -0
- package/dist/types/model/aave.d.ts +89 -0
- package/dist/types/model/analytics.d.ts +2 -2
- 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 +6 -7
- package/dist/types/model/positions.d.ts +1 -1
- package/dist/types/model/previews.d.ts +31 -0
- package/dist/types/offchain/AbstractOffchainNamespace.d.ts +1 -1
- package/dist/types/offchain/GearboxAPI.d.ts +0 -6
- package/dist/types/offchain/analytics/OffchainAnalytics.d.ts +1 -1
- package/dist/types/offchain/analytics/types.d.ts +1 -1
- package/dist/types/offchain/index.d.ts +1 -3
- package/dist/types/offchain/opportunities/OffchainOpportunities.d.ts +1 -1
- package/dist/types/offchain/opportunities/types.d.ts +1 -1
- package/dist/types/offchain/positions/OffchainPositions.d.ts +1 -1
- package/dist/types/offchain/positions/types.d.ts +1 -1
- 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 +41 -1
- package/dist/types/onchain/accounts/intents/plan.d.ts +32 -3
- package/dist/types/onchain/accounts/intents/readAaveHoldings.d.ts +16 -0
- package/dist/types/onchain/accounts/intents/testing/market.d.ts +4 -0
- package/dist/types/onchain/accounts/intents/testing/sdk-mock.d.ts +4 -0
- package/dist/types/onchain/accounts/intents/types.d.ts +42 -0
- package/dist/types/onchain/index.d.ts +16 -4
- package/dist/types/onchain/market/adapters/abi/aave/iAaveHorizonBridge.d.ts +83 -0
- package/dist/types/onchain/market/adapters/abi/aave/iAaveOracle.d.ts +22 -0
- package/dist/types/onchain/market/adapters/abi/aave/iAaveV3Pool.d.ts +229 -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 +6 -0
- package/dist/types/onchain/market/adapters/abi/adapters/iAaveHorizonBridgeAdapter.d.ts +207 -0
- package/dist/types/onchain/market/adapters/abi/adapters/iAaveV3PoolAdapter.d.ts +172 -0
- package/dist/types/onchain/market/adapters/abi/adapters/index.d.ts +3 -1
- package/dist/types/onchain/market/adapters/abi/index.d.ts +10 -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 +361 -0
- package/dist/types/onchain/market/adapters/contracts/AaveV3PoolAdapterContract.d.ts +455 -0
- package/dist/types/onchain/market/adapters/contracts/AbstractAdapter.d.ts +8 -0
- package/dist/types/onchain/market/adapters/contracts/SecuritizeRedemptionGatewayAdapterContract.d.ts +19 -4
- package/dist/types/onchain/market/adapters/contracts/index.d.ts +3 -1
- package/dist/types/onchain/market/adapters/index.d.ts +11 -1
- package/dist/types/onchain/market/adapters/types.d.ts +3 -1
- package/dist/types/onchain/market/index.d.ts +11 -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 +46 -0
- 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/preview/preview/loadAdapterReplayState.d.ts +13 -0
- 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/GearboxSDK.d.ts +1 -8
- package/dist/types/sdk/analytics/AnalyticsNamespace.d.ts +1 -1
- package/dist/types/sdk/analytics/types.d.ts +1 -1
- package/dist/types/sdk/execute/types.d.ts +7 -5
- package/dist/types/sdk/index.d.ts +3 -3
- package/dist/types/sdk/opportunities/OpportunitiesNamespace.d.ts +1 -1
- package/dist/types/sdk/opportunities/types.d.ts +1 -1
- package/dist/types/sdk/positions/PositionsNamespace.d.ts +7 -2
- package/dist/types/sdk/positions/types.d.ts +10 -2
- package/dist/types/sdk/prepare/PrepareApi.d.ts +11 -3
- package/dist/types/sdk/prepare/index.d.ts +2 -2
- package/dist/types/sdk/prepare/types.d.ts +116 -1
- package/dist/types/sdk/preview/PreviewNamespace.d.ts +5 -1
- package/dist/types/sdk/preview/types.d.ts +12 -1
- package/dist/types/sdk/types.d.ts +0 -20
- package/package.json +1 -1
- package/dist/cjs/model/notices.schema.js +0 -25
- package/dist/cjs/offchain/notices/OffchainNotices.js +0 -27
- package/dist/cjs/offchain/notices/index.js +0 -3
- package/dist/esm/model/notices.schema.js +0 -23
- package/dist/esm/offchain/notices/OffchainNotices.js +0 -26
- package/dist/esm/offchain/notices/index.js +0 -1
- package/dist/types/model/notices.d.ts +0 -28
- package/dist/types/model/notices.schema.d.ts +0 -22
- package/dist/types/offchain/notices/OffchainNotices.d.ts +0 -18
- package/dist/types/offchain/notices/index.d.ts +0 -2
- /package/dist/cjs/model/{notices.js → aave.js} +0 -0
- /package/dist/esm/model/{notices.js → aave.js} +0 -0
|
@@ -5,6 +5,7 @@ import { RWAOperationArgs } from "./rwa.js";
|
|
|
5
5
|
import { UnpriceableTokenError } from "./errors/oracle-errors.js";
|
|
6
6
|
import "./errors/index.js";
|
|
7
7
|
import { BorrowRateBreakdown } from "./positions.js";
|
|
8
|
+
import { AaveBridgeBorrow, AavePositionProjection } from "./aave.js";
|
|
8
9
|
import { Address, Hex } from "viem";
|
|
9
10
|
//#region src/model/previews.d.ts
|
|
10
11
|
/**
|
|
@@ -405,6 +406,26 @@ export interface OpenStrategyPositionPreview extends OpenStrategyPositionProject
|
|
|
405
406
|
* flow.
|
|
406
407
|
*/
|
|
407
408
|
midasGreenlistsAccount?: boolean;
|
|
409
|
+
/**
|
|
410
|
+
* Loans the Horizon bridge takes as the account owner when the opening
|
|
411
|
+
* moves to Aave within its own transaction; the other fields then describe
|
|
412
|
+
* the account as it stands just before the move. Absent when it takes none.
|
|
413
|
+
*/
|
|
414
|
+
aaveBorrows?: AaveBridgeBorrow[];
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* What an Aave Horizon opening that already exists would do — the counterpart
|
|
418
|
+
* of `prepare.openAavePosition`, read off calldata rather than planned into it.
|
|
419
|
+
*
|
|
420
|
+
* The fields it shares with {@link OpenStrategyPositionPreview} describe the
|
|
421
|
+
* Gearbox credit account the position is built in, before it moves to Aave.
|
|
422
|
+
**/
|
|
423
|
+
export interface OpenAavePositionPreview extends OpenStrategyPositionPreview {
|
|
424
|
+
/**
|
|
425
|
+
* The position once it has moved to Aave. Built from the same floor balances
|
|
426
|
+
* as the `est` fields, so it is the worst case the opening can settle at.
|
|
427
|
+
*/
|
|
428
|
+
aave: AavePositionProjection;
|
|
408
429
|
}
|
|
409
430
|
/**
|
|
410
431
|
* What a transaction on an existing account would do — the counterpart of the
|
|
@@ -440,6 +461,11 @@ export interface AdjustStrategyPositionPreview extends EstimatedProjection, Acco
|
|
|
440
461
|
* multicall claims a delayed withdrawal
|
|
441
462
|
*/
|
|
442
463
|
intent?: DelayedIntent;
|
|
464
|
+
/**
|
|
465
|
+
* Loans the Horizon bridge takes as the account owner in this transaction;
|
|
466
|
+
* absent when it takes none.
|
|
467
|
+
*/
|
|
468
|
+
aaveBorrows?: AaveBridgeBorrow[];
|
|
443
469
|
/**
|
|
444
470
|
* The oracle could not price a token; it contributes nothing to the values.
|
|
445
471
|
*/
|
|
@@ -533,6 +559,11 @@ export interface RepayStrategyPositionPreview extends EstimatedProjection {
|
|
|
533
559
|
* multicall claims a delayed withdrawal
|
|
534
560
|
*/
|
|
535
561
|
intent?: DelayedIntent;
|
|
562
|
+
/**
|
|
563
|
+
* Loans the Horizon bridge takes as the account owner in this transaction,
|
|
564
|
+
* the ones a move to Aave repays with; absent when it takes none.
|
|
565
|
+
*/
|
|
566
|
+
aaveBorrows?: AaveBridgeBorrow[];
|
|
536
567
|
/**
|
|
537
568
|
* The oracle could not price a token; it contributes nothing to the values.
|
|
538
569
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ILogger } from "../onchain/types/logger.js";
|
|
2
2
|
import { ChainId } from "../model/primitives.js";
|
|
3
|
-
import { ChartBundle, ChartMetric, ChartRange } from "../model/charts.js";
|
|
4
3
|
import { ChainScopedFilter } from "../model/filters.js";
|
|
4
|
+
import { ChartBundle, ChartMetric, ChartRange } from "../model/charts.js";
|
|
5
5
|
import { DataResponse } from "../model/response.js";
|
|
6
6
|
import { GearboxAPIOptions } from "./types.js";
|
|
7
7
|
import { z } from "zod/v4";
|
|
@@ -2,8 +2,6 @@ import { ChainId } from "../model/primitives.js";
|
|
|
2
2
|
import { GearboxAPIOptions } from "./types.js";
|
|
3
3
|
import { OffchainAnalytics } from "./analytics/OffchainAnalytics.js";
|
|
4
4
|
import "./analytics/index.js";
|
|
5
|
-
import { OffchainNotices } from "./notices/OffchainNotices.js";
|
|
6
|
-
import "./notices/index.js";
|
|
7
5
|
import { OffchainOpportunities } from "./opportunities/OffchainOpportunities.js";
|
|
8
6
|
import "./opportunities/index.js";
|
|
9
7
|
import { OffchainPositions } from "./positions/OffchainPositions.js";
|
|
@@ -41,10 +39,6 @@ export declare class GearboxAPI {
|
|
|
41
39
|
* Namespace for the positions a wallet holds.
|
|
42
40
|
**/
|
|
43
41
|
readonly positions: OffchainPositions;
|
|
44
|
-
/**
|
|
45
|
-
* Namespace for the notices the backend attaches to entities.
|
|
46
|
-
**/
|
|
47
|
-
readonly notices: OffchainNotices;
|
|
48
42
|
constructor(options: GearboxAPIOptions);
|
|
49
43
|
}
|
|
50
44
|
//#endregion
|
|
@@ -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 { GearboxAPIOptions } from "../types.js";
|
|
5
5
|
import { AbstractOffchainNamespace } from "../AbstractOffchainNamespace.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 { AnalyticsPositionFilterOptions, AnalyticsPositionListOptions, AnalyticsPositionPage } from "../../model/analytics.js";
|
|
4
4
|
import { DataResponse } from "../../model/response.js";
|
|
5
5
|
//#region src/offchain/analytics/types.d.ts
|
|
@@ -4,8 +4,6 @@ import { IOffchainAnalytics, IOffchainAnalyticsPositions } from "./analytics/typ
|
|
|
4
4
|
import { OffchainAnalyticsPositions } from "./analytics/OffchainAnalyticsPositions.js";
|
|
5
5
|
import { OffchainAnalytics } from "./analytics/OffchainAnalytics.js";
|
|
6
6
|
import "./analytics/index.js";
|
|
7
|
-
import { OffchainNotices } from "./notices/OffchainNotices.js";
|
|
8
|
-
import "./notices/index.js";
|
|
9
7
|
import { IOffchainOpportunities, OpportunityChartMetricFor } from "./opportunities/types.js";
|
|
10
8
|
import { OffchainOpportunities } from "./opportunities/OffchainOpportunities.js";
|
|
11
9
|
import "./opportunities/index.js";
|
|
@@ -24,4 +22,4 @@ import { backendMessage } from "./errors/backendMessage.js";
|
|
|
24
22
|
import { ErrorCause, errorCause } from "./errors/errorCause.js";
|
|
25
23
|
import { readResponseBody } from "./errors/readResponseBody.js";
|
|
26
24
|
import "./errors/index.js";
|
|
27
|
-
export { AbstractOffchainNamespace, ErrorCause, GearboxAPI, GearboxAPIOptions, IOffchainAnalytics, IOffchainAnalyticsPositions, IOffchainOpportunities, IOffchainPositions, OffchainAnalytics, OffchainAnalyticsPositions, OffchainGetRequest, OffchainInvalidJsonError, OffchainNotConfiguredError, OffchainNotImplementedError,
|
|
25
|
+
export { AbstractOffchainNamespace, ErrorCause, GearboxAPI, GearboxAPIOptions, IOffchainAnalytics, IOffchainAnalyticsPositions, IOffchainOpportunities, IOffchainPositions, OffchainAnalytics, OffchainAnalyticsPositions, OffchainGetRequest, OffchainInvalidJsonError, OffchainNotConfiguredError, OffchainNotImplementedError, OffchainOpportunities, OffchainPositions, OffchainQuery, OffchainRequestFailedError, OffchainStatusError, OffchainTransportError, OffchainTransportErrorParams, OffchainValidationError, OpportunityChartMetricFor, PositionChartMetricFor, backendMessage, errorCause, readResponseBody };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ChartBundle, ChartRange } from "../../model/charts.js";
|
|
2
1
|
import { Opportunity, OpportunityFilter, OpportunityKey, OpportunityTotals, PoolOpportunityDetail, PoolOpportunityKey, StrategyOpportunityDetail, StrategyOpportunityKey } from "../../model/opportunities.js";
|
|
2
|
+
import { ChartBundle, ChartRange } from "../../model/charts.js";
|
|
3
3
|
import { DataResponse } from "../../model/response.js";
|
|
4
4
|
import { GearboxAPIOptions } from "../types.js";
|
|
5
5
|
import { AbstractOffchainNamespace } from "../AbstractOffchainNamespace.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ChartBundle, ChartRange, PoolOpportunityChartMetric, StrategyOpportunityChartMetric } from "../../model/charts.js";
|
|
2
1
|
import { Opportunity, OpportunityFilter, OpportunityKey, OpportunityTotals, PoolOpportunityDetail, PoolOpportunityKey, StrategyOpportunityDetail, StrategyOpportunityKey } from "../../model/opportunities.js";
|
|
2
|
+
import { ChartBundle, ChartRange, PoolOpportunityChartMetric, StrategyOpportunityChartMetric } from "../../model/charts.js";
|
|
3
3
|
import { DataResponse } from "../../model/response.js";
|
|
4
4
|
//#region src/offchain/opportunities/types.d.ts
|
|
5
5
|
export type OpportunityChartMetricFor<K extends OpportunityKey> = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ChartBundle, ChartRange } from "../../model/charts.js";
|
|
2
1
|
import { Position, PositionKey, PositionTransaction, PositionsTotals, StrategyPositionKey } from "../../model/positions.js";
|
|
2
|
+
import { ChartBundle, ChartRange } from "../../model/charts.js";
|
|
3
3
|
import { DataResponse } from "../../model/response.js";
|
|
4
4
|
import { ListPositionsPropsBase } from "../../onchain/positions/types.js";
|
|
5
5
|
import { GearboxAPIOptions } from "../types.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ChartBundle, ChartRange, PoolPositionChartMetric, StrategyPositionChartMetric } from "../../model/charts.js";
|
|
2
1
|
import { Position, PositionKey, PositionTransaction, PositionsTotals, StrategyPositionKey } 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 { ListPositionsPropsBase } from "../../onchain/positions/types.js";
|
|
5
5
|
import { Address } from "viem";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SDKConstruct } from "../../base/SDKConstruct.js";
|
|
2
2
|
import "../../base/index.js";
|
|
3
|
-
import { AccountToCheck, GetConnectedBotsResponse, SetBotProps, SetBotResult } from "./types.js";
|
|
3
|
+
import { AccountToCheck, GetConnectedBotsResponse, MarketBot, SetBotProps, SetBotResult } from "./types.js";
|
|
4
4
|
import { Address } from "viem";
|
|
5
5
|
//#region src/onchain/accounts/bots/AccountBotsService.d.ts
|
|
6
6
|
/**
|
|
@@ -11,6 +11,16 @@ import { Address } from "viem";
|
|
|
11
11
|
**/
|
|
12
12
|
export declare class AccountBotsService extends SDKConstruct {
|
|
13
13
|
#private;
|
|
14
|
+
/**
|
|
15
|
+
* The bots a market configurator lists among its periphery contracts.
|
|
16
|
+
*
|
|
17
|
+
* Read once per configurator and kept for the service's lifetime: the list
|
|
18
|
+
* changes only when the curator adds or removes a bot. A failed read is not
|
|
19
|
+
* kept, so the next call tries again.
|
|
20
|
+
*
|
|
21
|
+
* @param marketConfigurator - Configurator to list the bots of.
|
|
22
|
+
**/
|
|
23
|
+
getMarketBots(marketConfigurator: Address): Promise<readonly MarketBot[]>;
|
|
14
24
|
/**
|
|
15
25
|
* Reads the bots connected to each of the given credit accounts.
|
|
16
26
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AccountToCheck, BotStatusCall, BotsDirectResponse, CMSlice, ConnectedBotsCall, ConnectedBotsPerAccount, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, MulticallWithFailure, SetBotProps, SetBotResult } from "./types.js";
|
|
1
|
+
import { AccountToCheck, BotStatusCall, BotsDirectResponse, CMSlice, ConnectedBotsCall, ConnectedBotsPerAccount, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, MarketBot, MulticallWithFailure, SetBotProps, SetBotResult } from "./types.js";
|
|
2
2
|
import { AccountBotsService } from "./AccountBotsService.js";
|
|
3
3
|
import { PeripheryCompressorV310Contract } from "./PeripheryCompressorV310Contract.js";
|
|
4
|
-
export { AccountBotsService, AccountToCheck, BotStatusCall, BotsDirectResponse, CMSlice, ConnectedBotsCall, ConnectedBotsPerAccount, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, MulticallWithFailure, PeripheryCompressorV310Contract, SetBotProps, SetBotResult };
|
|
4
|
+
export { AccountBotsService, AccountToCheck, BotStatusCall, BotsDirectResponse, CMSlice, ConnectedBotsCall, ConnectedBotsPerAccount, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, MarketBot, MulticallWithFailure, PeripheryCompressorV310Contract, SetBotProps, SetBotResult };
|
|
@@ -5,7 +5,7 @@ import { RouterCASlice } from "../../router/types.js";
|
|
|
5
5
|
import "../../router/index.js";
|
|
6
6
|
import "../../base/index.js";
|
|
7
7
|
import { CreditAccountOperationResult, CreditManagerOperationResult } from "../types.js";
|
|
8
|
-
import { Address, ContractFunctionParameters } from "viem";
|
|
8
|
+
import { Address, ContractFunctionParameters, ContractFunctionReturnType } from "viem";
|
|
9
9
|
//#region src/onchain/accounts/bots/types.d.ts
|
|
10
10
|
/**
|
|
11
11
|
* @internal
|
|
@@ -13,6 +13,12 @@ import { Address, ContractFunctionParameters } from "viem";
|
|
|
13
13
|
* it can be batched with calls to other contracts.
|
|
14
14
|
**/
|
|
15
15
|
export type ConnectedBotsCall = ContractFunctionParameters<typeof peripheryCompressorAbi, "pure" | "view", "getConnectedBots">;
|
|
16
|
+
/**
|
|
17
|
+
* A bot a market configurator lists among its periphery contracts, as the
|
|
18
|
+
* periphery compressor's `getBots` reports it: the bot's own version, contract
|
|
19
|
+
* type and serialized state, and the permissions it requires.
|
|
20
|
+
**/
|
|
21
|
+
export type MarketBot = ContractFunctionReturnType<typeof peripheryCompressorAbi, "pure" | "view", "getBots">[number];
|
|
16
22
|
/**
|
|
17
23
|
* @internal
|
|
18
24
|
* Descriptor of a `getBotStatus` call on a bot list, so that it can be batched
|
|
@@ -14,14 +14,14 @@ import { WithdrawalCompressorV311Contract } from "./withdrawal-compressor/Withdr
|
|
|
14
14
|
import { WithdrawalCompressorV313Contract } from "./withdrawal-compressor/WithdrawalCompressorV313Contract.js";
|
|
15
15
|
import "./withdrawal-compressor/index.js";
|
|
16
16
|
import { AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, ClaimFarmRewardsProps, CreditAccountOperationResult, CreditManagerOperationResult, EncodableCreditAccountOperation, GetApprovalAddressProps, ICreditAccountsService, OpenCAProps, PreviewDelayedWithdrawalProps, Rewards } from "./types.js";
|
|
17
|
-
import { AccountToCheck, BotStatusCall, BotsDirectResponse, CMSlice, ConnectedBotsCall, ConnectedBotsPerAccount, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, MulticallWithFailure, SetBotProps, SetBotResult } from "./bots/types.js";
|
|
17
|
+
import { AccountToCheck, BotStatusCall, BotsDirectResponse, CMSlice, ConnectedBotsCall, ConnectedBotsPerAccount, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, MarketBot, MulticallWithFailure, SetBotProps, SetBotResult } from "./bots/types.js";
|
|
18
18
|
import { AccountBotsService } from "./bots/AccountBotsService.js";
|
|
19
19
|
import { PeripheryCompressorV310Contract } from "./bots/PeripheryCompressorV310Contract.js";
|
|
20
20
|
import "./bots/index.js";
|
|
21
21
|
import { CreditAccountsServiceV310 } from "./CreditAccountsServiceV310.js";
|
|
22
22
|
import { CalcDefaultQuotaProps, CalcQuotaUpdateProps, CalcRecommendedQuotaProps, DIRECT_TRANSFERS_QUOTA, MaxAmountForQuotaProps, calcDefaultQuota, calcQuotaUpdate, calcRecommendedQuota, maxAmountForQuota, roundUpQuota } from "./quota-utils.js";
|
|
23
23
|
import { AccountCalculatorOperation } from "./intents/operations.js";
|
|
24
|
-
import { AddCollateralIntent, AdjustLeverageIntent, ClaimRemainder, CreditAccountSlice, DelayableIntent, DelayedRoute, DelayedStart, DelayedStartResult, DepositStrategyIntent, ExecutionCost, FinishIntentProps, FinishIntentResult, InstantRoute, IntentPreviewResult, IntentRoutesResult, OperationState, PathLossRate, RefusedIntent, RepayStrategyIntent, ResumableIntent, RouteErrors, StartIntent, UpdateQuotaIntent, WithPartialState, WithdrawAssetIntent, WithdrawCeilings, WithdrawStrategyIntent } from "./intents/types.js";
|
|
24
|
+
import { AaveHoldings, AddCollateralIntent, AdjustLeverageIntent, ClaimRemainder, CloseAavePositionIntent, CreditAccountSlice, DelayableIntent, DelayedRoute, DelayedStart, DelayedStartResult, DepositStrategyIntent, ExecutionCost, FinishIntentProps, FinishIntentResult, InstantRoute, IntentPreviewResult, IntentRoutesResult, OperationState, PathLossRate, RedeemingIntent, RefusedIntent, RepayStrategyIntent, ResumableIntent, RouteErrors, StartIntent, UpdateQuotaIntent, WithPartialState, WithdrawAssetIntent, WithdrawCeilings, WithdrawStrategyIntent } from "./intents/types.js";
|
|
25
25
|
import { BorrowProps, BorrowState } from "./intents/borrow.js";
|
|
26
26
|
import { LeverageBand } from "./intents/leverage-band.js";
|
|
27
27
|
import { OpenStrategyProps, OpenStrategyState } from "./intents/open-strategy.js";
|
|
@@ -34,4 +34,4 @@ import { OptimalPartialLiquidation, OptimalPartialLiquidationProps, PartialLiqui
|
|
|
34
34
|
import { LiquidationsService } from "./liquidations/LiquidationsService.js";
|
|
35
35
|
import { MultichainLiquidationsService } from "./liquidations/MultichainLiquidationsService.js";
|
|
36
36
|
import "./liquidations/index.js";
|
|
37
|
-
export { AbstractWithdrawalCompressorContract, AccountBotsService, type AccountCalculatorOperation, AccountToCheck, type AddCollateralIntent, type AdjustLeverageIntent, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, BorrowPreviewResult, type BorrowProps, type BorrowState, BotStatusCall, BotsDirectResponse, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, BuildPartialLiquidationTxProps, BuildPartialLiquidationTxPropsBase, CMSlice, CalcDefaultQuotaProps, CalcQuotaUpdateProps, CalcRecommendedQuotaProps, ClaimFarmRewardsProps, type ClaimRemainder, ClaimableWithdrawal, ConnectedBotsCall, ConnectedBotsPerAccount, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountDataCall, CreditAccountFilter, CreditAccountOperationResult, CreditAccountOperationsService, CreditAccountReadOptions, type CreditAccountSlice, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsServiceV310, CreditAccountsTarget, CreditManagerFilter, CreditManagerOperationResult, CurrentWithdrawals, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DIRECT_TRANSFERS_QUOTA, type DelayableIntent, DelayedIntentExtended, type DelayedRoute, type DelayedStart, type DelayedStartResult, type DepositStrategyIntent, EmptyAccountPreviewResult, EncodableCreditAccountOperation, type ExecutionCost, type FinishIntentProps, type FinishIntentResult, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetExternalAccountCurrentWithdrawalsProps, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetPartialLiquidationDetailsProps, GetPartialLiquidationDetailsPropsBase, GetWithdrawalRequestResultProps, ICreditAccountsService, IRedemptionLoggerContract, IWithdrawalCompressorContract, type InstantRoute, type IntentPreviewResult, type IntentRoutesResult, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, type LeverageBand, LiquidationsService, LoadRWALiquidatorsProps, MaxAmountForQuotaProps, MulticallWithFailure, MultichainLiquidationsService, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, OnchainRequestableWithdrawal, OpenCAProps, OpenStrategyPreviewResult, type OpenStrategyProps, type OpenStrategyState, type OperationState, OptimalPartialLiquidation, OptimalPartialLiquidationProps, PartialLiquidationParams, PartialLiquidationParamsProps, type PathLossRate, PendingWithdrawal, PeripheryCompressorV310Contract, PreviewDelayedWithdrawalProps, RWALiquidatorInfo, RedemptionLog, RedemptionLoggerV310Contract, type RefusedIntent, type RepayStrategyIntent, RequestableWithdrawal, type ResumableIntent, Rewards, type RouteErrors, SetBotProps, SetBotResult, type StartIntent, type UpdateQuotaIntent, type WithPartialState, type WithdrawAssetIntent, type WithdrawCeilings, type WithdrawStrategyIntent, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, calcDefaultQuota, calcQuotaUpdate, calcRecommendedQuota, createRedemptionLogger, createWithdrawalCompressor, decodeDelayedIntent, encodeDelayedIntent, fetchCreditAccountSlice, getWithdrawalCompressorAddress, iCreditAccountAbi, isPhantomToken, maxAmountForQuota, optimalPartialLiquidation, partialLiquidationParams, roundUpQuota, toClaimableWithdrawal, toCreditAccountSlice, toPendingWithdrawal, toRequestableWithdrawal, toWithdrawalStatus };
|
|
37
|
+
export { type AaveHoldings, AbstractWithdrawalCompressorContract, AccountBotsService, type AccountCalculatorOperation, AccountToCheck, type AddCollateralIntent, type AdjustLeverageIntent, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, BorrowPreviewResult, type BorrowProps, type BorrowState, BotStatusCall, BotsDirectResponse, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, BuildPartialLiquidationTxProps, BuildPartialLiquidationTxPropsBase, CMSlice, CalcDefaultQuotaProps, CalcQuotaUpdateProps, CalcRecommendedQuotaProps, ClaimFarmRewardsProps, type ClaimRemainder, ClaimableWithdrawal, type CloseAavePositionIntent, ConnectedBotsCall, ConnectedBotsPerAccount, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountDataCall, CreditAccountFilter, CreditAccountOperationResult, CreditAccountOperationsService, CreditAccountReadOptions, type CreditAccountSlice, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsServiceV310, CreditAccountsTarget, CreditManagerFilter, CreditManagerOperationResult, CurrentWithdrawals, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DIRECT_TRANSFERS_QUOTA, type DelayableIntent, DelayedIntentExtended, type DelayedRoute, type DelayedStart, type DelayedStartResult, type DepositStrategyIntent, EmptyAccountPreviewResult, EncodableCreditAccountOperation, type ExecutionCost, type FinishIntentProps, type FinishIntentResult, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetExternalAccountCurrentWithdrawalsProps, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetPartialLiquidationDetailsProps, GetPartialLiquidationDetailsPropsBase, GetWithdrawalRequestResultProps, ICreditAccountsService, IRedemptionLoggerContract, IWithdrawalCompressorContract, type InstantRoute, type IntentPreviewResult, type IntentRoutesResult, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, type LeverageBand, LiquidationsService, LoadRWALiquidatorsProps, MarketBot, MaxAmountForQuotaProps, MulticallWithFailure, MultichainLiquidationsService, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, OnchainRequestableWithdrawal, OpenCAProps, OpenStrategyPreviewResult, type OpenStrategyProps, type OpenStrategyState, type OperationState, OptimalPartialLiquidation, OptimalPartialLiquidationProps, PartialLiquidationParams, PartialLiquidationParamsProps, type PathLossRate, PendingWithdrawal, PeripheryCompressorV310Contract, PreviewDelayedWithdrawalProps, RWALiquidatorInfo, type RedeemingIntent, RedemptionLog, RedemptionLoggerV310Contract, type RefusedIntent, type RepayStrategyIntent, RequestableWithdrawal, type ResumableIntent, Rewards, type RouteErrors, SetBotProps, SetBotResult, type StartIntent, type UpdateQuotaIntent, type WithPartialState, type WithdrawAssetIntent, type WithdrawCeilings, type WithdrawStrategyIntent, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, calcDefaultQuota, calcQuotaUpdate, calcRecommendedQuota, createRedemptionLogger, createWithdrawalCompressor, decodeDelayedIntent, encodeDelayedIntent, fetchCreditAccountSlice, getWithdrawalCompressorAddress, iCreditAccountAbi, isPhantomToken, maxAmountForQuota, optimalPartialLiquidation, partialLiquidationParams, roundUpQuota, toClaimableWithdrawal, toCreditAccountSlice, toPendingWithdrawal, toRequestableWithdrawal, toWithdrawalStatus };
|
|
@@ -3,7 +3,7 @@ import "../../../model/index.js";
|
|
|
3
3
|
import { SDKConstruct } from "../../base/SDKConstruct.js";
|
|
4
4
|
import { IntentValidationError } from "../../validation/raise.js";
|
|
5
5
|
import { AccountCalculatorOperation } from "./operations.js";
|
|
6
|
-
import { AddCollateralIntent, AdjustLeverageIntent, ClaimRemainder, CreditAccountSlice, DelayableIntent, DelayedRoute, DelayedStart, DelayedStartResult, DepositStrategyIntent, ExecutionCost, FinishIntentProps, FinishIntentResult, InstantRoute, IntentPreviewResult, IntentRoutesResult, OperationState, PathLossRate, RefusedIntent, RepayStrategyIntent, ResumableIntent, RouteErrors, StartIntent, StartIntentProps, UpdateQuotaIntent, WithPartialState, WithdrawAssetIntent, WithdrawCeilings, WithdrawStrategyIntent } from "./types.js";
|
|
6
|
+
import { AaveHoldings, AddCollateralIntent, AdjustLeverageIntent, ClaimRemainder, CloseAavePositionIntent, CreditAccountSlice, DelayableIntent, DelayedRoute, DelayedStart, DelayedStartResult, DepositStrategyIntent, ExecutionCost, FinishIntentProps, FinishIntentResult, InstantRoute, IntentPreviewResult, IntentRoutesResult, OperationState, PathLossRate, RedeemingIntent, RefusedIntent, RepayStrategyIntent, ResumableIntent, RouteErrors, StartIntent, StartIntentProps, UpdateQuotaIntent, WithPartialState, WithdrawAssetIntent, WithdrawCeilings, WithdrawStrategyIntent } from "./types.js";
|
|
7
7
|
import { BorrowProps, BorrowState } from "./borrow.js";
|
|
8
8
|
import { LeverageBand, LeverageBandProps } from "./leverage-band.js";
|
|
9
9
|
import { MaxBorrowProps } from "./maxBorrow.js";
|
|
@@ -190,7 +190,25 @@ export declare class CreditAccountOperationsService extends SDKConstruct {
|
|
|
190
190
|
* does not exist for the account at all
|
|
191
191
|
*/
|
|
192
192
|
startDelayedIntent(props: StartIntentProps & {
|
|
193
|
-
intent:
|
|
193
|
+
intent: RedeemingIntent;
|
|
194
|
+
}): Promise<DelayedStartResult>;
|
|
195
|
+
/**
|
|
196
|
+
* Previews leaving `owner`'s Aave Horizon position in `token` in one
|
|
197
|
+
* transaction, see {@link CloseAavePositionIntent}.
|
|
198
|
+
*
|
|
199
|
+
* What the owner holds and owes on Aave is read here, at the block the SDK
|
|
200
|
+
* stands at; the rest is {@link startDelayedIntent}, tail included.
|
|
201
|
+
*
|
|
202
|
+
* @param props - Account slice, quota reserve and slippage, the RWA, the
|
|
203
|
+
* wallet the exit pays, and the owner the bridge resolves for the account:
|
|
204
|
+
* the investor of an RWA factory account, the borrower otherwise
|
|
205
|
+
* @returns The request transaction, the state the exit ends in and what it
|
|
206
|
+
* recorded for the tail, or `{ ok: false, error }`
|
|
207
|
+
*/
|
|
208
|
+
closeAavePositionIntent(props: StartIntentProps & {
|
|
209
|
+
token: Address;
|
|
210
|
+
to: Address;
|
|
211
|
+
owner: Address;
|
|
194
212
|
}): Promise<DelayedStartResult>;
|
|
195
213
|
/**
|
|
196
214
|
* Previews a delayable intent both ways at once: settled by the router now,
|
|
@@ -286,4 +304,4 @@ export declare class CreditAccountOperationsService extends SDKConstruct {
|
|
|
286
304
|
borrowIntent(props: BorrowProps): Promise<BorrowPreviewResult>;
|
|
287
305
|
}
|
|
288
306
|
//#endregion
|
|
289
|
-
export { type AccountCalculatorOperation, type AddCollateralIntent, type AdjustLeverageIntent, type BorrowProps, type BorrowState, type ClaimRemainder, type CreditAccountSlice, type DelayableIntent, type DelayedRoute, type DelayedStart, type DelayedStartResult, type DepositStrategyIntent, type ExecutionCost, type FinishIntentProps, type FinishIntentResult, type InstantRoute, type IntentPreviewResult, type IntentRoutesResult, type LeverageBand, type OpenStrategyProps, type OpenStrategyState, type OperationState, type PathLossRate, type RefusedIntent, type RepayStrategyIntent, type ResumableIntent, type RouteErrors, type StartIntent, type UpdateQuotaIntent, type WithPartialState, type WithdrawAssetIntent, type WithdrawCeilings, type WithdrawStrategyIntent, fetchCreditAccountSlice, isPhantomToken, toCreditAccountSlice };
|
|
307
|
+
export { type AaveHoldings, type AccountCalculatorOperation, type AddCollateralIntent, type AdjustLeverageIntent, type BorrowProps, type BorrowState, type ClaimRemainder, type CloseAavePositionIntent, type CreditAccountSlice, type DelayableIntent, type DelayedRoute, type DelayedStart, type DelayedStartResult, type DepositStrategyIntent, type ExecutionCost, type FinishIntentProps, type FinishIntentResult, type InstantRoute, type IntentPreviewResult, type IntentRoutesResult, type LeverageBand, type OpenStrategyProps, type OpenStrategyState, type OperationState, type PathLossRate, type RedeemingIntent, type RefusedIntent, type RepayStrategyIntent, type ResumableIntent, type RouteErrors, type StartIntent, type UpdateQuotaIntent, type WithPartialState, type WithdrawAssetIntent, type WithdrawCeilings, type WithdrawStrategyIntent, fetchCreditAccountSlice, isPhantomToken, toCreditAccountSlice };
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { ClaimableWithdrawal, RequestableWithdrawal, WithdrawalOutput } from "../withdrawal-compressor/types.js";
|
|
2
2
|
import { Asset } from "../../base/types.js";
|
|
3
|
+
import { AaveHorizonBridgeAdapterContract } from "../../market/adapters/contracts/AaveHorizonBridgeAdapterContract.js";
|
|
4
|
+
import { AaveV3PoolAdapterContract } from "../../market/adapters/contracts/AaveV3PoolAdapterContract.js";
|
|
5
|
+
import "../../market/adapters/index.js";
|
|
3
6
|
import { MultiCall } from "../../types/transactions.js";
|
|
4
7
|
import { OnchainSDK } from "../../OnchainSDK.js";
|
|
5
8
|
import { EncodableCreditAccountOperation } from "../types.js";
|
|
@@ -16,7 +19,7 @@ import { Address } from "viem";
|
|
|
16
19
|
* plus the quoted amounts the preview and the tests read, plus the RWA legs
|
|
17
20
|
* that come from their own assemblers rather than from `assembleCaOperations`.
|
|
18
21
|
*/
|
|
19
|
-
export type AccountCalculatorOperation = AddCollateralOperation | IncreaseDebtOperation | DecreaseDebtOperation | SwapOperation | WithdrawCollateralOperation | QuotaUpdateOperation | WrapRwaCollateralOperation | UnwrapRwaCollateralOperation | StartDelayedWithdrawalOperation | ClaimDelayedWithdrawalOperation;
|
|
22
|
+
export type AccountCalculatorOperation = AddCollateralOperation | IncreaseDebtOperation | DecreaseDebtOperation | SwapOperation | WithdrawCollateralOperation | QuotaUpdateOperation | WrapRwaCollateralOperation | UnwrapRwaCollateralOperation | StartDelayedWithdrawalOperation | ClaimDelayedWithdrawalOperation | AaveClosePositionOperation | AaveWithdrawOperation;
|
|
20
23
|
/**
|
|
21
24
|
* Compile-time proof that the engine's operations really are the SDK's own
|
|
22
25
|
* encodable ones with the quoted amounts attached, so the two cannot drift into
|
|
@@ -211,6 +214,43 @@ export declare function buildClaimDelayedWithdrawalOperation(input: {
|
|
|
211
214
|
creditAccount: CreditAccountSlice;
|
|
212
215
|
sdk: OnchainSDK;
|
|
213
216
|
}): ClaimDelayedWithdrawalOperation;
|
|
217
|
+
/**
|
|
218
|
+
* Repays `repayAmount` of the owner's Aave debt out of the account and brings
|
|
219
|
+
* `aTokenAmount` of the owner's aTokens into it, through the Horizon bridge.
|
|
220
|
+
*/
|
|
221
|
+
export interface AaveClosePositionOperation {
|
|
222
|
+
type: "aaveClosePosition";
|
|
223
|
+
aToken: Address;
|
|
224
|
+
aTokenAmount: bigint;
|
|
225
|
+
debtToken: Address;
|
|
226
|
+
repayAmount: bigint;
|
|
227
|
+
calls: MultiCall[];
|
|
228
|
+
}
|
|
229
|
+
export declare function buildAaveClosePositionOperation(input: {
|
|
230
|
+
adapter: AaveHorizonBridgeAdapterContract;
|
|
231
|
+
aToken: Address;
|
|
232
|
+
aTokenAmount: bigint;
|
|
233
|
+
debtToken: Address;
|
|
234
|
+
repayAmount: bigint;
|
|
235
|
+
}): AaveClosePositionOperation;
|
|
236
|
+
/**
|
|
237
|
+
* Withdraws an asset from the Aave pool for every aToken of it on the account,
|
|
238
|
+
* one for one. The call names no amount, as the supply does, and `amount` is
|
|
239
|
+
* the balance the projection was built on.
|
|
240
|
+
*/
|
|
241
|
+
export interface AaveWithdrawOperation {
|
|
242
|
+
type: "aaveWithdraw";
|
|
243
|
+
token: Address;
|
|
244
|
+
aToken: Address;
|
|
245
|
+
amount: bigint;
|
|
246
|
+
calls: MultiCall[];
|
|
247
|
+
}
|
|
248
|
+
export declare function buildAaveWithdrawOperation(input: {
|
|
249
|
+
adapter: AaveV3PoolAdapterContract;
|
|
250
|
+
token: Address;
|
|
251
|
+
aToken: Address;
|
|
252
|
+
amount: bigint;
|
|
253
|
+
}): AaveWithdrawOperation;
|
|
214
254
|
/**
|
|
215
255
|
* What a request or a claim puts on the account right away, as opposed to what
|
|
216
256
|
* only the phantom token represents.
|
|
@@ -3,7 +3,7 @@ import { OperationLimitOptions } from "../../../model/errors/operation-errors.js
|
|
|
3
3
|
import "../../../model/index.js";
|
|
4
4
|
import { ClaimableWithdrawal } from "../withdrawal-compressor/types.js";
|
|
5
5
|
import { OnchainSDK } from "../../OnchainSDK.js";
|
|
6
|
-
import { AddCollateralIntent, AdjustLeverageIntent, BorrowAndWithdrawIntent, DepositStrategyIntent, RepayStrategyIntent, UpdateQuotaIntent, WithdrawAssetIntent, WithdrawStrategyIntent } from "./types.js";
|
|
6
|
+
import { AddCollateralIntent, AdjustLeverageIntent, BorrowAndWithdrawIntent, CloseAavePositionIntent, DepositStrategyIntent, RepayStrategyIntent, UpdateQuotaIntent, WithdrawAssetIntent, WithdrawStrategyIntent } from "./types.js";
|
|
7
7
|
import { DebtLimits } from "./math.js";
|
|
8
8
|
import { Address } from "viem";
|
|
9
9
|
//#region src/onchain/accounts/intents/plan.d.ts
|
|
@@ -83,12 +83,15 @@ export type Step = {
|
|
|
83
83
|
} |
|
|
84
84
|
/**
|
|
85
85
|
* Hands whatever is left on the account to `to`, each balance in the token it
|
|
86
|
-
* stands in. Only
|
|
87
|
-
* before it happen to leave, which no planner can name in
|
|
86
|
+
* stands in. Only a plan that leaves no debt asks for this: the amounts are
|
|
87
|
+
* whatever the legs before it happen to leave, which no planner can name in
|
|
88
|
+
* advance. `token` limits it to that balance, the underlying of an RWA
|
|
89
|
+
* market leaving as the asset it wraps.
|
|
88
90
|
*/
|
|
89
91
|
{
|
|
90
92
|
kind: "sweep";
|
|
91
93
|
to: Address;
|
|
94
|
+
token?: Address;
|
|
92
95
|
} |
|
|
93
96
|
/**
|
|
94
97
|
* Drops every quota the account holds, in the same transaction and before
|
|
@@ -108,6 +111,22 @@ export type Step = {
|
|
|
108
111
|
kind: "updateQuota";
|
|
109
112
|
token: Address;
|
|
110
113
|
quota: bigint | undefined;
|
|
114
|
+
} |
|
|
115
|
+
/**
|
|
116
|
+
* Repays `repay` of the owner's Aave debt out of the account, in the asset
|
|
117
|
+
* Aave lends, and brings `aTokenAmount` of the owner's aTokens of `token`
|
|
118
|
+
* back into the account through the Horizon bridge.
|
|
119
|
+
*/
|
|
120
|
+
{
|
|
121
|
+
kind: "aaveClosePosition";
|
|
122
|
+
token: Address;
|
|
123
|
+
repay: bigint;
|
|
124
|
+
aTokenAmount: bigint;
|
|
125
|
+
} |
|
|
126
|
+
/** Withdraws `token` from the Aave pool for every aToken of it on the account. */
|
|
127
|
+
{
|
|
128
|
+
kind: "aaveWithdraw";
|
|
129
|
+
token: Address;
|
|
111
130
|
};
|
|
112
131
|
/** What a planner is allowed to know about the account. */
|
|
113
132
|
export interface AccountView {
|
|
@@ -150,6 +169,16 @@ export declare function planDeposit(intent: Omit<DepositStrategyIntent, "type">,
|
|
|
150
169
|
* rather than the amount quoted here.
|
|
151
170
|
*/
|
|
152
171
|
export declare function planRepay(intent: Omit<RepayStrategyIntent, "type">, view: AccountView): Step[];
|
|
172
|
+
/**
|
|
173
|
+
* The owner's Aave position comes back and leaves: the account borrows what
|
|
174
|
+
* the owner owes on Aave, the bridge repays it and returns the aTokens, the
|
|
175
|
+
* pool turns them back into the RWA, and the RWA is requested for redemption
|
|
176
|
+
* with an exit recorded for the tail — all in one transaction.
|
|
177
|
+
*
|
|
178
|
+
* The repayment is the debt plus {@link CLOSE_AAVE_WINDOW} of interest at the
|
|
179
|
+
* current rate, see {@link CloseAavePositionIntent}.
|
|
180
|
+
*/
|
|
181
|
+
export declare function planCloseAavePosition(intent: Omit<CloseAavePositionIntent, "type">, view: AccountView): Step[];
|
|
153
182
|
/**
|
|
154
183
|
* One token's quota changes; no balance moves and debt is untouched.
|
|
155
184
|
*
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { OnchainSDK } from "../../OnchainSDK.js";
|
|
2
|
+
import { AaveHoldings } from "./types.js";
|
|
3
|
+
import "../../index.js";
|
|
4
|
+
import { Address } from "viem";
|
|
5
|
+
//#region src/onchain/accounts/intents/readAaveHoldings.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* What `owner` holds and owes on the Aave pool the credit manager supplies
|
|
8
|
+
* `token` to: its aTokens of `token`, and its variable debt in the asset the
|
|
9
|
+
* Horizon bridge lends there — the underlying, or the asset an RWA underlying
|
|
10
|
+
* wraps.
|
|
11
|
+
*
|
|
12
|
+
* Refused with `unsupportedCollateralToken` when no Aave pool adapter of the
|
|
13
|
+
* credit manager lists `token`.
|
|
14
|
+
*/
|
|
15
|
+
export declare function readAaveHoldings(sdk: OnchainSDK, creditManager: Address, owner: Address, token: Address): Promise<AaveHoldings>;
|
|
16
|
+
//#endregion
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { IAdapterContract } from "../../../market/adapters/types.js";
|
|
2
|
+
import "../../../market/adapters/index.js";
|
|
1
3
|
import { OnchainSDK } from "../../../OnchainSDK.js";
|
|
2
4
|
import { CreditAccountSlice } from "../types.js";
|
|
3
5
|
import "../../../index.js";
|
|
@@ -83,6 +85,8 @@ export interface MarketSdkExtras {
|
|
|
83
85
|
/** What a routed swap returns; linear when omitted. */
|
|
84
86
|
routeQuote?: (amount: bigint) => bigint;
|
|
85
87
|
routeFloor?: (amount: bigint) => bigint;
|
|
88
|
+
/** Adapters the credit manager lists. */
|
|
89
|
+
adapters?: IAdapterContract[];
|
|
86
90
|
}
|
|
87
91
|
/** Mock SDK on the shared fixture market. */
|
|
88
92
|
declare function buildMarketSdk(extras?: MarketSdkExtras): OnchainSDK;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Curator } from "../../../../model/curators.js";
|
|
2
2
|
import "../../../../model/index.js";
|
|
3
|
+
import { IAdapterContract } from "../../../market/adapters/types.js";
|
|
4
|
+
import "../../../market/adapters/index.js";
|
|
3
5
|
import { MultiCall } from "../../../types/transactions.js";
|
|
4
6
|
import { OnchainSDK } from "../../../OnchainSDK.js";
|
|
5
7
|
import { CreditAccountSlice } from "../types.js";
|
|
@@ -147,6 +149,8 @@ interface BuildMockSdkArgs {
|
|
|
147
149
|
* keeps the projected state and the amounts in the calls one number.
|
|
148
150
|
*/
|
|
149
151
|
routeFloor?: (amount: bigint) => bigint;
|
|
152
|
+
/** Adapters the credit manager lists; none when omitted. */
|
|
153
|
+
adapters?: IAdapterContract[];
|
|
150
154
|
}
|
|
151
155
|
/** One redemption venue of the mock compressor. */
|
|
152
156
|
export interface MockDelayedVenue {
|
|
@@ -441,6 +441,43 @@ export interface RepayStrategyIntent {
|
|
|
441
441
|
/** Native value to attach when paying with the native coin. */
|
|
442
442
|
value?: bigint;
|
|
443
443
|
}
|
|
444
|
+
/**
|
|
445
|
+
* The owner's Horizon position in one RWA, as the pool reports it now.
|
|
446
|
+
*/
|
|
447
|
+
export interface AaveHoldings {
|
|
448
|
+
/** The pool's aToken of the RWA. */
|
|
449
|
+
aToken: Address;
|
|
450
|
+
/** Asset the owner owes: the underlying, or the asset an RWA underlying wraps. */
|
|
451
|
+
debtToken: Address;
|
|
452
|
+
/** The owner's aToken balance. */
|
|
453
|
+
supplied: bigint;
|
|
454
|
+
/** The owner's variable debt in {@link debtToken}, interest included. */
|
|
455
|
+
owed: bigint;
|
|
456
|
+
/** The reserve's current variable borrow rate, in ray per year. */
|
|
457
|
+
borrowRate: bigint;
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Leaves the owner's Aave Horizon position in one transaction: the way out of
|
|
461
|
+
* what an Aave opening built.
|
|
462
|
+
*
|
|
463
|
+
* The account borrows the owner's Aave debt, the Horizon bridge repays it and
|
|
464
|
+
* hands every aToken of `token` the owner holds to the account, the pool turns
|
|
465
|
+
* them back into `token`, and the whole balance of `token` is requested for
|
|
466
|
+
* redemption at its gateway. The request records an exit, so once the
|
|
467
|
+
* redemption matures the tail settles the loan and sends the rest to `to`.
|
|
468
|
+
*
|
|
469
|
+
* Aave debt grows every second and the bridge keeps what Aave does not take,
|
|
470
|
+
* so the repayment covers an hour of interest at the current rate, and that
|
|
471
|
+
* much less of it is what the bridge keeps from a transaction landing sooner.
|
|
472
|
+
*/
|
|
473
|
+
export interface CloseAavePositionIntent {
|
|
474
|
+
type: "CLOSE_AAVE_POSITION";
|
|
475
|
+
/** RWA the owner holds on Aave, as the pool lists it. */
|
|
476
|
+
token: Address;
|
|
477
|
+
/** Wallet the exit sends what is left to. */
|
|
478
|
+
to: Address;
|
|
479
|
+
holdings: AaveHoldings;
|
|
480
|
+
}
|
|
444
481
|
/**
|
|
445
482
|
* Intent 2.1 — withdraw part of the position's net value at fixed leverage.
|
|
446
483
|
*
|
|
@@ -566,6 +603,11 @@ export type StartIntent = AddCollateralIntent | WithdrawAssetIntent | BorrowAndW
|
|
|
566
603
|
* that sell a position asset. The others buy one, and buying settles at once.
|
|
567
604
|
*/
|
|
568
605
|
export type DelayableIntent = AdjustLeverageIntent | WithdrawStrategyIntent;
|
|
606
|
+
/**
|
|
607
|
+
* The intents a redemption can start: the two that sell a position asset, and
|
|
608
|
+
* the exit from Aave, which always redeems the RWA it brings back.
|
|
609
|
+
*/
|
|
610
|
+
export type RedeemingIntent = DelayableIntent | CloseAavePositionIntent;
|
|
569
611
|
/**
|
|
570
612
|
* A delayed intent this engine knows how to finish — every one of them.
|
|
571
613
|
*
|