@gearbox-protocol/sdk 18.4.0 → 18.4.1-aave.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/model/index.js +1 -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/intents/index.js +1 -0
- package/dist/cjs/onchain/accounts/intents/operations.js +21 -0
- package/dist/cjs/onchain/accounts/intents/plan.js +33 -0
- package/dist/cjs/onchain/accounts/intents/realize.js +44 -0
- package/dist/cjs/onchain/accounts/intents/testing/market.js +1 -0
- package/dist/cjs/onchain/accounts/intents/testing/sdk-mock.js +2 -1
- 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 +16 -0
- 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/index.js +9 -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 +13 -0
- package/dist/cjs/onchain/market/adapters/contracts/AaveHorizonBridgeAdapterContract.js +171 -0
- package/dist/cjs/onchain/market/adapters/contracts/AaveV3PoolAdapterContract.js +199 -0
- package/dist/cjs/onchain/market/adapters/contracts/AbstractAdapter.js +8 -0
- 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 +16 -0
- package/dist/cjs/onchain/market/adapters/types.js +2 -0
- package/dist/cjs/onchain/market/index.js +16 -0
- package/dist/cjs/onchain/positions/projectAavePosition.js +175 -0
- package/dist/cjs/onchain/preview/preview/loadAdapterReplayState.js +17 -0
- package/dist/cjs/onchain/preview/preview/previewOperation.js +2 -0
- package/dist/cjs/sdk/GearboxSDK.js +0 -9
- package/dist/cjs/sdk/prepare/PrepareApi.js +56 -0
- package/dist/cjs/sdk/preview/PreviewNamespace.js +42 -0
- package/dist/esm/model/index.js +2 -3
- 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/intents/index.js +2 -1
- package/dist/esm/onchain/accounts/intents/operations.js +20 -1
- package/dist/esm/onchain/accounts/intents/plan.js +33 -1
- package/dist/esm/onchain/accounts/intents/realize.js +46 -2
- package/dist/esm/onchain/accounts/intents/testing/market.js +1 -0
- package/dist/esm/onchain/accounts/intents/testing/sdk-mock.js +2 -1
- 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 +9 -1
- 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/index.js +5 -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 +8 -1
- package/dist/esm/onchain/market/adapters/contracts/AaveHorizonBridgeAdapterContract.js +170 -0
- package/dist/esm/onchain/market/adapters/contracts/AaveV3PoolAdapterContract.js +198 -0
- package/dist/esm/onchain/market/adapters/contracts/AbstractAdapter.js +8 -0
- 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 +9 -1
- package/dist/esm/onchain/market/adapters/types.js +2 -0
- package/dist/esm/onchain/market/index.js +9 -1
- package/dist/esm/onchain/positions/projectAavePosition.js +174 -0
- package/dist/esm/onchain/preview/preview/loadAdapterReplayState.js +16 -0
- package/dist/esm/onchain/preview/preview/previewOperation.js +2 -0
- package/dist/esm/sdk/GearboxSDK.js +0 -9
- package/dist/esm/sdk/prepare/PrepareApi.js +57 -1
- package/dist/esm/sdk/preview/PreviewNamespace.js +42 -0
- package/dist/types/model/aave.d.ts +34 -0
- package/dist/types/model/analytics.d.ts +2 -2
- package/dist/types/model/index.d.ts +6 -7
- package/dist/types/model/opportunities.d.ts +1 -1
- package/dist/types/model/positions.d.ts +1 -1
- package/dist/types/model/previews.d.ts +15 -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 +2 -2
- package/dist/types/onchain/accounts/intents/operations.d.ts +43 -1
- package/dist/types/onchain/accounts/intents/plan.d.ts +26 -1
- 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 +20 -1
- package/dist/types/onchain/index.d.ts +10 -2
- 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/index.d.ts +5 -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 +8 -1
- package/dist/types/onchain/market/adapters/contracts/AaveHorizonBridgeAdapterContract.d.ts +341 -0
- package/dist/types/onchain/market/adapters/contracts/AaveV3PoolAdapterContract.d.ts +450 -0
- package/dist/types/onchain/market/adapters/contracts/AbstractAdapter.d.ts +8 -0
- package/dist/types/onchain/market/adapters/contracts/index.d.ts +3 -1
- package/dist/types/onchain/market/adapters/index.d.ts +9 -1
- package/dist/types/onchain/market/adapters/types.d.ts +3 -1
- package/dist/types/onchain/market/index.d.ts +9 -1
- package/dist/types/onchain/positions/projectAavePosition.d.ts +45 -0
- package/dist/types/onchain/preview/preview/loadAdapterReplayState.d.ts +13 -0
- 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/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 +1 -1
- package/dist/types/sdk/positions/types.d.ts +1 -1
- 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 +83 -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
|
@@ -2,7 +2,8 @@ import { PERCENTAGE_FACTOR } from "../../onchain/constants/math.js";
|
|
|
2
2
|
import { hexEq } from "../../onchain/utils/hex.js";
|
|
3
3
|
import { MultichainConstruct } from "../../onchain/base/MultichainConstruct.js";
|
|
4
4
|
import "../../onchain/market/math.js";
|
|
5
|
-
import {
|
|
5
|
+
import { debtOutOfRange } from "../../model/errors/operation-errors.js";
|
|
6
|
+
import { creditAccountNotEmpty, creditAccountNotFound, noRecordedIntent, noStrategyTargetCollateral, unexpectedFailure, unsupportedCollateralToken, unsupportedTokenPair } from "../../model/errors/prepare-errors.js";
|
|
6
7
|
import { sdkErr, sdkOk } from "../../model/result.js";
|
|
7
8
|
import "../../model/index.js";
|
|
8
9
|
import { toToken } from "../../onchain/validation/helpers/token.js";
|
|
@@ -13,6 +14,7 @@ import { toCreditAccountSlice } from "../../onchain/accounts/intents/utils/credi
|
|
|
13
14
|
import { resolveQuotaUpdate } from "../../onchain/accounts/intents/resolveQuotaUpdate.js";
|
|
14
15
|
import { CreditAccountOperationsService } from "../../onchain/accounts/intents/index.js";
|
|
15
16
|
import "../../onchain/index.js";
|
|
17
|
+
import { projectAavePosition } from "../../onchain/positions/projectAavePosition.js";
|
|
16
18
|
import { withdrawableCollaterals } from "./withdrawable-collaterals.js";
|
|
17
19
|
import { isAddressEqual } from "viem";
|
|
18
20
|
//#region src/sdk/prepare/PrepareApi.ts
|
|
@@ -257,6 +259,51 @@ var PrepareApi = class extends MultichainConstruct {
|
|
|
257
259
|
}
|
|
258
260
|
}
|
|
259
261
|
/**
|
|
262
|
+
* {@inheritDoc IOpportunitiesPrepare.openAavePosition}
|
|
263
|
+
**/
|
|
264
|
+
async openAavePosition(strategy, params) {
|
|
265
|
+
const opened = await this.openNewStrategy(strategy, params);
|
|
266
|
+
if (!opened.ok) return opened;
|
|
267
|
+
const { state } = opened.data;
|
|
268
|
+
try {
|
|
269
|
+
const sdk = this.sdk.chain(strategy.chainId);
|
|
270
|
+
const projected = await projectAavePosition(sdk, {
|
|
271
|
+
creditManager: state.creditManager,
|
|
272
|
+
assets: state.averageAssets.map((a) => ({
|
|
273
|
+
token: a.token.address,
|
|
274
|
+
balance: a.value
|
|
275
|
+
})),
|
|
276
|
+
quotas: state.averageQuota,
|
|
277
|
+
totalDebt: state.totalDebt.value,
|
|
278
|
+
totalValue: state.totalValue.value
|
|
279
|
+
}, params.wallet);
|
|
280
|
+
const suite = sdk.marketRegister.findCreditManager(strategy.creditManager);
|
|
281
|
+
if (!projected) {
|
|
282
|
+
const target = params.targetToken ?? suite.strategy?.targetCollateral;
|
|
283
|
+
return refused(target ? unsupportedCollateralToken(toToken(sdk, target)) : noStrategyTargetCollateral(strategy.creditManager), state);
|
|
284
|
+
}
|
|
285
|
+
const { aave, maxDebt } = projected;
|
|
286
|
+
if (aave.totalDebt.value > maxDebt) {
|
|
287
|
+
const market = sdk.marketRegister.findByCreditManager(strategy.creditManager);
|
|
288
|
+
const { creditFacade } = suite;
|
|
289
|
+
return refused(debtOutOfRange({
|
|
290
|
+
requested: aave.totalDebt,
|
|
291
|
+
minDebt: market.toUnderlyingAmount(creditFacade.minDebt),
|
|
292
|
+
maxDebt: market.toUnderlyingAmount(maxDebt)
|
|
293
|
+
}), state);
|
|
294
|
+
}
|
|
295
|
+
return sdkOk({
|
|
296
|
+
...opened.data,
|
|
297
|
+
state: {
|
|
298
|
+
...state,
|
|
299
|
+
aave
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
} catch (e) {
|
|
303
|
+
return refused(unexpectedFailure(e), state);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
260
307
|
* {@inheritDoc IOpportunitiesPrepare.borrow}
|
|
261
308
|
**/
|
|
262
309
|
async borrow(strategy, params) {
|
|
@@ -344,6 +391,15 @@ var PrepareApi = class extends MultichainConstruct {
|
|
|
344
391
|
});
|
|
345
392
|
}
|
|
346
393
|
/**
|
|
394
|
+
* {@inheritDoc IOpportunitiesPrepare.moveToAave}
|
|
395
|
+
**/
|
|
396
|
+
async moveToAave(position, params) {
|
|
397
|
+
return this.#startIntent(position, {}, {
|
|
398
|
+
type: "MOVE_TO_AAVE",
|
|
399
|
+
token: params.token
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
347
403
|
* {@inheritDoc IOpportunitiesPrepare.adjustLeverage}
|
|
348
404
|
**/
|
|
349
405
|
async adjustLeverage(position, params) {
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import { sdkErr, sdkOk } from "../../model/result.js";
|
|
2
|
+
import "../../model/index.js";
|
|
1
3
|
import { checkOperation } from "../../onchain/validation/checkOperation.js";
|
|
2
4
|
import { checkSimulation } from "../../onchain/validation/checkSimulation.js";
|
|
5
|
+
import { parseOperationCalldata } from "../../onchain/preview/parse/parseOperationCalldata.js";
|
|
3
6
|
import { previewOperation } from "../../onchain/preview/preview/previewOperation.js";
|
|
4
7
|
import "../../onchain/index.js";
|
|
8
|
+
import { projectAavePosition } from "../../onchain/positions/projectAavePosition.js";
|
|
5
9
|
//#region src/sdk/preview/PreviewNamespace.ts
|
|
6
10
|
/**
|
|
7
11
|
* {@inheritDoc IPreview}
|
|
@@ -22,6 +26,44 @@ var PreviewNamespace = class {
|
|
|
22
26
|
return previewOperation(sdk, input, options);
|
|
23
27
|
}
|
|
24
28
|
/**
|
|
29
|
+
* {@inheritDoc IPreview.openAavePosition}
|
|
30
|
+
**/
|
|
31
|
+
async openAavePosition(input, options) {
|
|
32
|
+
const previewed = await this.previewOperation(input, options);
|
|
33
|
+
if (!previewed.ok) return previewed;
|
|
34
|
+
const preview = previewed.data;
|
|
35
|
+
if (preview.operation !== "OpenCreditAccount") return sdkErr({
|
|
36
|
+
code: "unsupportedOperation",
|
|
37
|
+
message: `operation "${preview.operation}" is not an Aave position opening`,
|
|
38
|
+
operation: preview.operation
|
|
39
|
+
});
|
|
40
|
+
const sdk = this.#onchain.chain(input.chainId);
|
|
41
|
+
const parsed = parseOperationCalldata(sdk, input);
|
|
42
|
+
const owner = parsed.ok && parsed.data.operation === "OpenCreditAccount" ? parsed.data.onBehalfOf : input.sender;
|
|
43
|
+
const projected = await projectAavePosition(sdk, {
|
|
44
|
+
creditManager: preview.creditManager,
|
|
45
|
+
assets: preview.estAssets.map((a) => ({
|
|
46
|
+
token: a.token.address,
|
|
47
|
+
balance: a.value
|
|
48
|
+
})),
|
|
49
|
+
quotas: preview.quotas.map((q) => ({
|
|
50
|
+
token: q.token.address,
|
|
51
|
+
balance: q.value
|
|
52
|
+
})),
|
|
53
|
+
totalDebt: preview.totalDebt.value,
|
|
54
|
+
totalValue: preview.estTotalValue.value
|
|
55
|
+
}, owner);
|
|
56
|
+
if (!projected) return sdkErr({
|
|
57
|
+
code: "unsupportedOperation",
|
|
58
|
+
message: `credit manager ${preview.creditManager} cannot move this opening to Aave`,
|
|
59
|
+
operation: preview.operation
|
|
60
|
+
});
|
|
61
|
+
return sdkOk({
|
|
62
|
+
...preview,
|
|
63
|
+
aave: projected.aave
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
25
67
|
* {@inheritDoc IPreview.checkOperation}
|
|
26
68
|
**/
|
|
27
69
|
async checkOperation(props, options) {
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Timestamp, TokenAmount } from "./primitives.js";
|
|
2
|
+
import { AccountProjection } from "./previews.js";
|
|
3
|
+
//#region src/model/aave.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Where an opening lands once it has moved to Aave Horizon.
|
|
6
|
+
*
|
|
7
|
+
* An RWA collateral may be minted asynchronously, so the leverage is built in a
|
|
8
|
+
* Gearbox credit account first; once the mint settles, the minted collateral is
|
|
9
|
+
* supplied to Aave, the Gearbox debt is refinanced there with the interest it
|
|
10
|
+
* accrued in the meantime, and the credit account closes. This is that second
|
|
11
|
+
* half — the account itself is described by the projection beside it.
|
|
12
|
+
*
|
|
13
|
+
* The shared fields mean what they mean on an {@link AccountProjection}, read
|
|
14
|
+
* on Aave: `assets` is the collateral supplied there, `totalDebt` includes
|
|
15
|
+
* {@link mintPeriodInterest}, and `netValue` is what the wallet ends up owning.
|
|
16
|
+
**/
|
|
17
|
+
export interface AavePositionProjection extends Pick<AccountProjection, "totalValue" | "totalDebt" | "netValue" | "assets" | "healthFactor" | "liquidationPrice" | "borrowRate" | "leverage"> {
|
|
18
|
+
/**
|
|
19
|
+
* Interest the Gearbox debt accrues while the mint settles, already part of
|
|
20
|
+
* `totalDebt`.
|
|
21
|
+
**/
|
|
22
|
+
mintPeriodInterest: TokenAmount;
|
|
23
|
+
/**
|
|
24
|
+
* How long the mint takes to settle, in seconds: the `withdrawalLength` of
|
|
25
|
+
* the RWA's delayed operation, `0` where the opening mints it outright.
|
|
26
|
+
**/
|
|
27
|
+
mintDuration: number;
|
|
28
|
+
/**
|
|
29
|
+
* Estimated unix seconds at which the position is live on Aave. The
|
|
30
|
+
* finalizer bot moves it a block after the mint settles at the earliest.
|
|
31
|
+
**/
|
|
32
|
+
estLiveAt: Timestamp;
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ChainId, Token, UnderlyingToken } from "./primitives.js";
|
|
2
|
-
import { ChartRange, ProtocolChartMetric } from "./charts.js";
|
|
3
2
|
import { Curator, CuratorName } from "./curators.js";
|
|
4
3
|
import { ChainScopedFilter, Filterable } from "./filters.js";
|
|
5
|
-
import { PoolPosition, PositionFilter, StrategyPosition } from "./positions.js";
|
|
6
4
|
import { LiquidationPosition } from "./liquidations.js";
|
|
5
|
+
import { PoolPosition, PositionFilter, StrategyPosition } from "./positions.js";
|
|
6
|
+
import { ChartRange, ProtocolChartMetric } from "./charts.js";
|
|
7
7
|
import { Address } from "viem";
|
|
8
8
|
//#region src/model/analytics.d.ts
|
|
9
9
|
/**
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { Amount, Asset, AssetType, Bps, ChainId, Leverage, Timestamp, Token, TokenAmount, TxCall, UnderlyingToken } from "./primitives.js";
|
|
2
|
-
import { CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, ChartBundle, ChartDenomination, ChartMetric, ChartQuery, ChartRange, ChartSeries, ChartSeriesOk, ChartSeriesUnavailable, ChartUnavailableCode, ChartUnit, ChartValue, ChartWindow, GridSampling, OpportunityChartMetric, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, PROTOCOL_CHART_METRICS, PoolOpportunityChartMetric, PoolPositionChartMetric, PositionChartMetric, ProtocolChartMetric, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, StrategyOpportunityChartMetric, StrategyPositionChartMetric } from "./charts.js";
|
|
3
2
|
import { Curator, CuratorName } from "./curators.js";
|
|
4
|
-
import { ChainScopedFilter, FILTER_ALL, FilterAll, Filterable, isFilterSet } from "./filters.js";
|
|
5
3
|
import { DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedWithdrawCollateralIntent } from "./delayed-intents.js";
|
|
6
4
|
import { IGearboxError } from "./errors/base.js";
|
|
7
5
|
import { CreditAccountFrozenError, LiquidatorNotEligibleError, NotEmergencyLiquidatorError, PartialLiquidationImpossibleError, creditAccountFrozen, liquidatorNotEligible, notEmergencyLiquidator, partialLiquidationImpossible } from "./errors/liquidation-errors.js";
|
|
@@ -11,10 +9,13 @@ import { UnpriceableTokenError, unpriceableTokenError } from "./errors/oracle-er
|
|
|
11
9
|
import { CreditAccountNotEmptyError, CreditAccountNotFoundError, MultipleDelayedWithdrawalsError, NoDelayedRouteError, NoRecordedIntentError, NoStrategyTargetCollateralError, UnexpectedFailureError, UnsupportedCollateralTokenError, UnsupportedTokenPairError, WithdrawalInProgressError, creditAccountNotEmpty, creditAccountNotFound, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, unexpectedFailure, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress } from "./errors/prepare-errors.js";
|
|
12
10
|
import { InvalidDelayedIntentError, MalformedTransactionError, PoolOperationPreviewError, UnsupportedOperationError, UnsupportedPoolFunctionError, UnsupportedTargetError, UnsupportedZapperFunctionError, malformedTransaction } from "./errors/preview-errors.js";
|
|
13
11
|
import "./errors/index.js";
|
|
12
|
+
import { ChainScopedFilter, FILTER_ALL, FilterAll, Filterable, isFilterSet } from "./filters.js";
|
|
13
|
+
import { DelayedReceivedAsset, InstantReceivedAsset, LiquidatableAccount, LiquidatableAccountFilter, LiquidationApproval, LiquidationDetails, LiquidationPosition, ReceivedAsset, matchesLiquidatableAccountFilter } from "./liquidations.js";
|
|
14
14
|
import { ApyBreakdown, Opportunity, OpportunityBase, OpportunityDetail, OpportunityFilter, OpportunityId, OpportunityKey, OpportunityKind, OpportunityTotals, PointRewards, PointsProgram, PoolOpportunity, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, PriceFeedData, PriceFeedSummary, QuotaAsset, RateCurve, RateCurvePoint, Rewards, StrategyOpportunity, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef, TokenRewards, matchesOpportunityFilter, opportunityId, poolOpportunityId, strategyOpportunityId } from "./opportunities.js";
|
|
15
15
|
import { BorrowRateBreakdown, PnlBreakdown, PointsProgramPnL, PointsRewardsPnL, PoolPosition, PoolPositionKey, PoolPositionRef, Position, PositionCollateral, PositionFilter, PositionId, PositionKey, PositionKind, PositionTransaction, PositionTransactionKind, PositionsTotals, RewardsPnL, STRATEGY_POSITION_COLLATERAL_ERROR, StrategyPosition, StrategyPositionKey, StrategyPositionRef, TokenQuotaRate, TokenRewardsPnL, liquidationPositionId, matchesPositionFilter, poolPositionId, positionId, strategyPositionId } from "./positions.js";
|
|
16
|
-
import { AccountHoldings, AccountMetrics, AccountProjection, AccountStateChange, AdjustStrategyPositionPreview, CreditOperationMarket, DelayedStrategyPositionOperationPreview, Estimated, EstimatedProjection, ExitStrategyPositionPreview, InstantStrategyPositionOperationPreview, OpenStrategyPositionPreview, OperationPreview, PoolOperationType, PoolPositionOperationPreview, PreviewOperationInput, PreviewOperationOptions, RepayStrategyPositionPreview, RoutedField, asEstimated } from "./previews.js";
|
|
17
|
-
import {
|
|
16
|
+
import { AccountHoldings, AccountMetrics, AccountProjection, AccountStateChange, AdjustStrategyPositionPreview, CreditOperationMarket, DelayedStrategyPositionOperationPreview, Estimated, EstimatedProjection, ExitStrategyPositionPreview, InstantStrategyPositionOperationPreview, OpenAavePositionPreview, OpenStrategyPositionPreview, OperationPreview, PoolOperationType, PoolPositionOperationPreview, PreviewOperationInput, PreviewOperationOptions, RepayStrategyPositionPreview, RoutedField, asEstimated } from "./previews.js";
|
|
17
|
+
import { AavePositionProjection } from "./aave.js";
|
|
18
|
+
import { CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, ChartBundle, ChartDenomination, ChartMetric, ChartQuery, ChartRange, ChartSeries, ChartSeriesOk, ChartSeriesUnavailable, ChartUnavailableCode, ChartUnit, ChartValue, ChartWindow, GridSampling, OpportunityChartMetric, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, PROTOCOL_CHART_METRICS, PoolOpportunityChartMetric, PoolPositionChartMetric, PositionChartMetric, ProtocolChartMetric, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, StrategyOpportunityChartMetric, StrategyPositionChartMetric } from "./charts.js";
|
|
18
19
|
import { AnalyticsChartQuery, AnalyticsContractOption, AnalyticsContractRef, AnalyticsCuratorOption, AnalyticsLiquidationPosition, AnalyticsPoolPosition, AnalyticsPosition, AnalyticsPositionFilterOptions, AnalyticsPositionListOptions, AnalyticsPositionOwner, AnalyticsPositionPage, AnalyticsPositionSortField, AnalyticsSortDirection, AnalyticsStrategyPosition } from "./analytics.js";
|
|
19
20
|
import { ANALYTICS_POSITIONS_DEFAULT_LIMIT, ANALYTICS_POSITIONS_MAX_LIMIT, analyticsChartQueryOptionsSchema, analyticsChartQueryParamsSchema, analyticsChartQuerySchema, analyticsContractOptionSchema, analyticsContractRefSchema, analyticsCuratorOptionSchema, analyticsPositionFilterOptionsQuerySchema, analyticsPositionFilterOptionsSchema, analyticsPositionListOptionsSchema, analyticsPositionListQueryParamsSchema, analyticsPositionListQuerySchema, analyticsPositionPageSchema, analyticsPositionSchema, analyticsPositionSortFieldSchema, analyticsSortDirectionSchema } from "./analytics.schema.js";
|
|
20
21
|
import { chartBundleSchemaFor, chartDenominationSchema, chartMetricSchema, chartQueryCodec, chartQueryParamsSchema, chartQuerySchema, chartRangeSchema, chartSeriesSchema, chartValueSchema, chartWindowSchema, poolOpportunityChartMetricSchema, poolPositionChartMetricSchema, protocolChartMetricSchema, strategyOpportunityChartMetricSchema, strategyPositionChartMetricSchema } from "./charts.schema.js";
|
|
@@ -22,8 +23,6 @@ import { CompareTag, CompareTolerance, ToleranceCompareTag, backendPreferred, co
|
|
|
22
23
|
import { curatorNameSchema, curatorSchema } from "./curators.schema.js";
|
|
23
24
|
import { booleanParamSchema, encodeFlag, filterAllSchema, filterable } from "./filters.schema.js";
|
|
24
25
|
import { delayedReceivedAssetSchema, instantReceivedAssetSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionSchema, receivedAssetSchema } from "./liquidations.schema.js";
|
|
25
|
-
import { Notice, NoticeKind, NoticeSubject } from "./notices.js";
|
|
26
|
-
import { noticeKindSchema, noticeSchema } from "./notices.schema.js";
|
|
27
26
|
import { apyBreakdownSchema, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityKeySchema, opportunityKindSchema, opportunitySchema, opportunityTotalsSchema, pointRewardsSchema, pointsProgramSchema, poolOpportunityDetailSchema, poolOpportunityKeySchema, poolOpportunitySchema, priceFeedDataSchema, priceFeedSummarySchema, quotaAssetSchema, rateCurvePointSchema, rateCurveSchema, rewardsSchema, strategyOpportunityDetailSchema, strategyOpportunityKeySchema, strategyOpportunitySchema, tokenRewardsSchema } from "./opportunities.schema.js";
|
|
28
27
|
import { borrowRateBreakdownSchema, pnlBreakdownSchema, pointsProgramPnLSchema, pointsRewardsPnLSchema, poolPositionKeySchema, poolPositionSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionKeySchema, positionKindSchema, positionSchema, positionTransactionKindSchema, positionTransactionSchema, positionsTotalsSchema, rewardsPnLSchema, strategyPositionKeySchema, strategyPositionSchema, tokenQuotaRateSchema, tokenRewardsPnLSchema } from "./positions.schema.js";
|
|
29
28
|
import { amountSchema, assetTypeSchema, bpsSchema, chainIdSchema, leverageSchema, timestampSchema, tokenAmountSchema, tokenSchema, txCallSchema, underlyingTokenSchema } from "./primitives.schema.js";
|
|
@@ -34,4 +33,4 @@ import { MerklReward, PointsReward, Reward } from "./rewards.js";
|
|
|
34
33
|
import { kycRequirementSchema, rwaProtocolSchema } from "./rwa.schema.js";
|
|
35
34
|
import { PositionClaimableWithdrawal, PositionPendingWithdrawal, PositionWithdrawals, WithdrawalOutputAmount } from "./withdrawals.js";
|
|
36
35
|
import { positionClaimableWithdrawalSchema, positionPendingWithdrawalSchema, positionWithdrawalsSchema, withdrawalOutputAmountSchema } from "./withdrawals.schema.js";
|
|
37
|
-
export { ANALYTICS_POSITIONS_DEFAULT_LIMIT, ANALYTICS_POSITIONS_MAX_LIMIT, AccountHoldings, AccountMetrics, AccountNotMidasGreenlistedError, AccountProjection, AccountStateChange, AdjustStrategyPositionPreview, Amount, AnalyticsChartQuery, AnalyticsContractOption, AnalyticsContractRef, AnalyticsCuratorOption, AnalyticsLiquidationPosition, AnalyticsPoolPosition, AnalyticsPosition, AnalyticsPositionFilterOptions, AnalyticsPositionListOptions, AnalyticsPositionOwner, AnalyticsPositionPage, AnalyticsPositionSortField, AnalyticsSortDirection, AnalyticsStrategyPosition, ApyBreakdown, Asset, AssetType, BorrowLimitCause, BorrowRateBreakdown, Bps, CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, ChainFailed, ChainId, ChainMetadata, ChainScoped, ChainScopedFilter, ChainSucceeded, ChartBundle, ChartDenomination, ChartMetric, ChartQuery, ChartRange, ChartSeries, ChartSeriesOk, ChartSeriesUnavailable, ChartUnavailableCode, ChartUnit, ChartValue, ChartWindow, CollateralLimits, CompareTag, CompareTolerance, CreditAccountFrozenError, CreditAccountNotEmptyError, CreditAccountNotFoundError, CreditManagerPausedError, CreditOperationMarket, Curator, CuratorName, DataResponse, DataSource, DebtOutOfRangeError, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedReceivedAsset, DelayedStrategyPositionOperationPreview, DelayedWithdrawCollateralIntent, Estimated, EstimatedProjection, ExitStrategyPositionPreview, FILTER_ALL, FilterAll, Filterable, ForbiddenTokenError, GridSampling, IGearboxError, InstantReceivedAsset, InstantStrategyPositionOperationPreview, InsufficientAllowanceError, InsufficientBalanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, InvalidDelayedIntentError, KYC_REGISTRATION_LINKS, KycProtocol, KycRequirement, Leverage, LeverageLimits, LeverageOutOfRangeError, LiquidatableAccount, LiquidatableAccountFilter, LiquidationApproval, LiquidationDetails, LiquidationPosition, LiquidatorNotEligibleError, MalformedTransactionError, MarketExpiredError, MerklReward, MidasOpenAccountRequirements, MultipleDelayedWithdrawalsError, NoDelayedRouteError, NoRecordedIntentError, NoStrategyTargetCollateralError, NotEmergencyLiquidatorError,
|
|
36
|
+
export { ANALYTICS_POSITIONS_DEFAULT_LIMIT, ANALYTICS_POSITIONS_MAX_LIMIT, AavePositionProjection, AccountHoldings, AccountMetrics, AccountNotMidasGreenlistedError, AccountProjection, AccountStateChange, AdjustStrategyPositionPreview, Amount, AnalyticsChartQuery, AnalyticsContractOption, AnalyticsContractRef, AnalyticsCuratorOption, AnalyticsLiquidationPosition, AnalyticsPoolPosition, AnalyticsPosition, AnalyticsPositionFilterOptions, AnalyticsPositionListOptions, AnalyticsPositionOwner, AnalyticsPositionPage, AnalyticsPositionSortField, AnalyticsSortDirection, AnalyticsStrategyPosition, ApyBreakdown, Asset, AssetType, BorrowLimitCause, BorrowRateBreakdown, Bps, CHART_METRIC_UNITS, CHART_RANGES, CHART_UNAVAILABLE_CODES, ChainFailed, ChainId, ChainMetadata, ChainScoped, ChainScopedFilter, ChainSucceeded, ChartBundle, ChartDenomination, ChartMetric, ChartQuery, ChartRange, ChartSeries, ChartSeriesOk, ChartSeriesUnavailable, ChartUnavailableCode, ChartUnit, ChartValue, ChartWindow, CollateralLimits, CompareTag, CompareTolerance, CreditAccountFrozenError, CreditAccountNotEmptyError, CreditAccountNotFoundError, CreditManagerPausedError, CreditOperationMarket, Curator, CuratorName, DataResponse, DataSource, DebtOutOfRangeError, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedReceivedAsset, DelayedStrategyPositionOperationPreview, DelayedWithdrawCollateralIntent, Estimated, EstimatedProjection, ExitStrategyPositionPreview, FILTER_ALL, FilterAll, Filterable, ForbiddenTokenError, GridSampling, IGearboxError, InstantReceivedAsset, InstantStrategyPositionOperationPreview, InsufficientAllowanceError, InsufficientBalanceError, InsufficientCollateralError, InsufficientPoolLiquidityError, InvalidDelayedIntentError, KYC_REGISTRATION_LINKS, KycProtocol, KycRequirement, Leverage, LeverageLimits, LeverageOutOfRangeError, LiquidatableAccount, LiquidatableAccountFilter, LiquidationApproval, LiquidationDetails, LiquidationPosition, LiquidatorNotEligibleError, MalformedTransactionError, MarketExpiredError, MerklReward, MidasOpenAccountRequirements, MultipleDelayedWithdrawalsError, NoDelayedRouteError, NoRecordedIntentError, NoStrategyTargetCollateralError, NotEmergencyLiquidatorError, OpenAavePositionPreview, OpenStrategyPositionPreview, OperationLimitOptions, OperationPreview, Opportunity, OpportunityBase, OpportunityChartMetric, OpportunityDetail, OpportunityFilter, OpportunityId, OpportunityKey, OpportunityKind, OpportunityTotals, POOL_OPPORTUNITY_CHART_METRICS, POOL_POSITION_CHART_METRICS, PROTOCOL_CHART_METRICS, PartialLiquidationImpossibleError, PnlBreakdown, PointRewards, PointsProgram, PointsProgramPnL, PointsReward, PointsRewardsPnL, PoolOperationPreviewError, PoolOperationType, PoolOpportunity, PoolOpportunityChartMetric, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, PoolPausedError, PoolPosition, PoolPositionChartMetric, PoolPositionKey, PoolPositionOperationPreview, PoolPositionRef, PoolSunsetError, Position, PositionChartMetric, PositionClaimableWithdrawal, PositionCollateral, PositionFilter, PositionId, PositionKey, PositionKind, PositionPendingWithdrawal, PositionTransaction, PositionTransactionKind, PositionWithdrawals, PositionsTotals, PreviewOperationInput, PreviewOperationOptions, PriceFeedData, PriceFeedSummary, ProtocolChartMetric, QuotaAboveMaxError, QuotaAsset, QuotaCountExceededError, QuotaInactiveError, QuotaInputLimits, QuotaLimitReachedError, QuotaUnchangedError, RWAFactoryType, RWAMissingOpenAccountRequirements, RWAOpenAccountRequirements, RWAOpenRequirementsError, RWAOperationArgs, RWAProtocol, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_PROTOCOLS, RateCurve, RateCurvePoint, ReceivedAsset, RepayStrategyPositionPreview, ReservePriceLimitedError, ResponseMetadata, Reward, Rewards, RewardsPnL, RoutedField, SDKError, SDKResult, SDKReturn, SECURITIZE_REGISTER_VAULT_TYPES, STRATEGY_OPPORTUNITY_CHART_METRICS, STRATEGY_POSITION_CHART_METRICS, STRATEGY_POSITION_COLLATERAL_ERROR, SafeValue, SecuritizeMissingOpenAccountRequirements, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature, StrategyOpportunity, StrategyOpportunityChartMetric, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef, StrategyPosition, StrategyPositionChartMetric, StrategyPositionKey, StrategyPositionRef, Timestamp, Token, TokenAmount, TokenQuotaRate, TokenRewards, TokenRewardsPnL, ToleranceCompareTag, TxCall, UnderlyingToken, UnexpectedFailureError, UnpriceableTokenError, UnsupportedCollateralTokenError, UnsupportedOperationError, UnsupportedPoolFunctionError, UnsupportedTargetError, UnsupportedTokenPairError, UnsupportedZapperFunctionError, WithdrawalInProgressError, WithdrawalOutputAmount, accountNotMidasGreenlisted, amountSchema, analyticsChartQueryOptionsSchema, analyticsChartQueryParamsSchema, analyticsChartQuerySchema, analyticsContractOptionSchema, analyticsContractRefSchema, analyticsCuratorOptionSchema, analyticsPositionFilterOptionsQuerySchema, analyticsPositionFilterOptionsSchema, analyticsPositionListOptionsSchema, analyticsPositionListQueryParamsSchema, analyticsPositionListQuerySchema, analyticsPositionPageSchema, analyticsPositionSchema, analyticsPositionSortFieldSchema, analyticsSortDirectionSchema, apyBreakdownSchema, asEstimated, assetTypeSchema, backendPreferred, booleanParamSchema, borrowRateBreakdownSchema, bpsSchema, chainFailedSchema, chainIdSchema, chainMetadataSchema, chainSucceededSchema, chartBundleSchemaFor, chartDenominationSchema, chartMetricSchema, chartQueryCodec, chartQueryParamsSchema, chartQuerySchema, chartRangeSchema, chartSeriesSchema, chartValueSchema, chartWindowSchema, compareTagOf, creditAccountFrozen, creditAccountNotEmpty, creditAccountNotFound, creditManagerPaused, curatorNameSchema, curatorSchema, dataSourceSchema, debtOutOfRange, delayedReceivedAssetSchema, encodeFlag, filterAllSchema, filterable, forbiddenToken, instantReceivedAssetSchema, insufficientAllowance, insufficientBalance, insufficientCollateral, insufficientPoolLiquidity, isFilterSet, kycRequirementSchema, leverageOutOfRange, leverageSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionId, liquidationPositionSchema, liquidatorNotEligible, malformedTransaction, marketExpired, matchesLiquidatableAccountFilter, matchesOpportunityFilter, matchesPositionFilter, multipleDelayedWithdrawals, noDelayedRoute, noRecordedIntent, noStrategyTargetCollateral, notEmergencyLiquidator, offchainOnly, onchainOnly, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityId, opportunityKeySchema, opportunityKindSchema, opportunitySchema, opportunityTotalsSchema, partialLiquidationImpossible, pnlBreakdownSchema, pointRewardsSchema, pointsProgramPnLSchema, pointsProgramSchema, pointsRewardsPnLSchema, poolOpportunityChartMetricSchema, poolOpportunityDetailSchema, poolOpportunityId, poolOpportunityKeySchema, poolOpportunitySchema, poolPaused, poolPositionChartMetricSchema, poolPositionId, poolPositionKeySchema, poolPositionSchema, poolSunset, positionClaimableWithdrawalSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionId, positionKeySchema, positionKindSchema, positionPendingWithdrawalSchema, positionSchema, positionTransactionKindSchema, positionTransactionSchema, positionWithdrawalsSchema, positionsTotalsSchema, priceFeedDataSchema, priceFeedSummarySchema, protocolChartMetricSchema, quotaAboveMax, quotaAssetSchema, quotaCountExceeded, quotaInactive, quotaLimitReached, quotaUnchanged, rateCurvePointSchema, rateCurveSchema, receivedAssetSchema, reservePriceLimited, responseMetadataSchema, responseSchema, rewardsPnLSchema, rewardsSchema, rwaOpenRequirementsNotMet, rwaProtocolSchema, safeValue, sdkErr, sdkOk, strategyOpportunityChartMetricSchema, strategyOpportunityDetailSchema, strategyOpportunityId, strategyOpportunityKeySchema, strategyOpportunitySchema, strategyPositionChartMetricSchema, strategyPositionId, strategyPositionKeySchema, strategyPositionSchema, timestampSchema, tokenAmountSchema, tokenQuotaRateSchema, tokenRewardsPnLSchema, tokenRewardsSchema, tokenSchema, tolerance, txCallSchema, underlyingTokenSchema, unexpectedFailure, unpriceableTokenError, unsupportedCollateralToken, unsupportedTokenPair, withdrawalInProgress, withdrawalOutputAmountSchema };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Amount, AssetType, Bps, ChainId, Leverage, Timestamp, Token, UnderlyingToken } from "./primitives.js";
|
|
2
2
|
import { Curator } from "./curators.js";
|
|
3
|
-
import { ChainScopedFilter, Filterable } from "./filters.js";
|
|
4
3
|
import { KycRequirement } from "./rwa.js";
|
|
4
|
+
import { ChainScopedFilter, Filterable } from "./filters.js";
|
|
5
5
|
import { Address } from "viem";
|
|
6
6
|
//#region src/model/opportunities.d.ts
|
|
7
7
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AssetType, Bps, ChainId, Leverage, Timestamp, Token, TokenAmount, UnderlyingToken } from "./primitives.js";
|
|
2
2
|
import { Curator } from "./curators.js";
|
|
3
3
|
import { ChainScopedFilter, Filterable } from "./filters.js";
|
|
4
|
-
import { ApyBreakdown, PointsProgram } from "./opportunities.js";
|
|
5
4
|
import { DelayedReceivedAsset, LiquidationPosition } from "./liquidations.js";
|
|
5
|
+
import { ApyBreakdown, PointsProgram } from "./opportunities.js";
|
|
6
6
|
import { Address, Hex } from "viem";
|
|
7
7
|
//#region src/model/positions.d.ts
|
|
8
8
|
/**
|
|
@@ -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 { AavePositionProjection } from "./aave.js";
|
|
8
9
|
import { Address, Hex } from "viem";
|
|
9
10
|
//#region src/model/previews.d.ts
|
|
10
11
|
/**
|
|
@@ -406,6 +407,20 @@ export interface OpenStrategyPositionPreview extends OpenStrategyPositionProject
|
|
|
406
407
|
*/
|
|
407
408
|
midasGreenlistsAccount?: boolean;
|
|
408
409
|
}
|
|
410
|
+
/**
|
|
411
|
+
* What an Aave Horizon opening that already exists would do — the counterpart
|
|
412
|
+
* of `prepare.openAavePosition`, read off calldata rather than planned into it.
|
|
413
|
+
*
|
|
414
|
+
* The fields it shares with {@link OpenStrategyPositionPreview} describe the
|
|
415
|
+
* Gearbox credit account the position is built in while the mint settles.
|
|
416
|
+
**/
|
|
417
|
+
export interface OpenAavePositionPreview extends OpenStrategyPositionPreview {
|
|
418
|
+
/**
|
|
419
|
+
* The position once it has moved to Aave. Built from the same floor balances
|
|
420
|
+
* as the `est` fields, so it is the worst case the opening can settle at.
|
|
421
|
+
*/
|
|
422
|
+
aave: AavePositionProjection;
|
|
423
|
+
}
|
|
409
424
|
/**
|
|
410
425
|
* What a transaction on an existing account would do — the counterpart of the
|
|
411
426
|
* `prepare` flows that adjust one (`depositStrategy`, `withdrawStrategy`,
|
|
@@ -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,7 +14,7 @@ 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";
|
|
@@ -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 { 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, 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, 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 };
|
|
@@ -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 | AaveSupplyOperation | AaveOpenPositionOperation;
|
|
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,45 @@ export declare function buildClaimDelayedWithdrawalOperation(input: {
|
|
|
211
214
|
creditAccount: CreditAccountSlice;
|
|
212
215
|
sdk: OnchainSDK;
|
|
213
216
|
}): ClaimDelayedWithdrawalOperation;
|
|
217
|
+
/**
|
|
218
|
+
* Supplies the whole balance of an asset to the Aave pool; the aTokens are
|
|
219
|
+
* minted one for one. The call names no amount, as the finalizer bot's does,
|
|
220
|
+
* and `amount` is the balance the projection was built on.
|
|
221
|
+
*/
|
|
222
|
+
export interface AaveSupplyOperation {
|
|
223
|
+
type: "aaveSupply";
|
|
224
|
+
token: Address;
|
|
225
|
+
aToken: Address;
|
|
226
|
+
amount: bigint;
|
|
227
|
+
calls: MultiCall[];
|
|
228
|
+
}
|
|
229
|
+
export declare function buildAaveSupplyOperation(input: {
|
|
230
|
+
adapter: AaveV3PoolAdapterContract;
|
|
231
|
+
token: Address;
|
|
232
|
+
aToken: Address;
|
|
233
|
+
amount: bigint;
|
|
234
|
+
}): AaveSupplyOperation;
|
|
235
|
+
/**
|
|
236
|
+
* Hands every aToken on the account to its owner and borrows against them on
|
|
237
|
+
* the owner's Aave position, into the account. The call names no aToken
|
|
238
|
+
* amount, so a supply that minted a wei less does not revert it;
|
|
239
|
+
* `aTokenAmount` is what the projection was built on.
|
|
240
|
+
*/
|
|
241
|
+
export interface AaveOpenPositionOperation {
|
|
242
|
+
type: "aaveOpenPosition";
|
|
243
|
+
aToken: Address;
|
|
244
|
+
aTokenAmount: bigint;
|
|
245
|
+
debtToken: Address;
|
|
246
|
+
borrowAmount: bigint;
|
|
247
|
+
calls: MultiCall[];
|
|
248
|
+
}
|
|
249
|
+
export declare function buildAaveOpenPositionOperation(input: {
|
|
250
|
+
adapter: AaveHorizonBridgeAdapterContract;
|
|
251
|
+
aToken: Address;
|
|
252
|
+
aTokenAmount: bigint;
|
|
253
|
+
debtToken: Address;
|
|
254
|
+
borrowAmount: bigint;
|
|
255
|
+
}): AaveOpenPositionOperation;
|
|
214
256
|
/**
|
|
215
257
|
* What a request or a claim puts on the account right away, as opposed to what
|
|
216
258
|
* only the phantom token represents.
|