@gearbox-protocol/sdk 15.1.0-next.6 → 15.1.0-next.7
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/common-utils/utils/apy/get-single-quota-borrow-rate.js +2 -0
- package/dist/cjs/common-utils/utils/creditAccount/calc-health-factor.js +24 -22
- package/dist/cjs/common-utils/utils/creditAccount/calc-quota-borrow-rate.js +2 -0
- package/dist/cjs/common-utils/utils/creditAccount/get-time-to-liquidation.js +5 -4
- package/dist/cjs/common-utils/utils/creditAccount/liquidation-price.js +21 -11
- package/dist/cjs/model/index.js +1 -0
- package/dist/cjs/model/positions.schema.js +13 -0
- package/dist/cjs/preview/preview/CreditAccountState.js +14 -1
- package/dist/cjs/preview/preview/buildDelayedPreview.js +16 -6
- package/dist/cjs/preview/preview/previewAdjustCreditAccount.js +9 -2
- package/dist/cjs/preview/preview/previewOpenCreditAccount.js +11 -3
- package/dist/cjs/preview/preview/previewOperation.js +1 -1
- package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +0 -6
- package/dist/cjs/sdk/accounts/credit-account-compressor/CreditAccountCompressor.js +2 -90
- package/dist/cjs/sdk/accounts/intents/testing/sdk-mock.js +31 -4
- package/dist/cjs/sdk/accounts/intents/utils/adjust-state-to-snapshot.js +18 -0
- package/dist/cjs/sdk/accounts/intents/utils/index.js +2 -0
- package/dist/cjs/sdk/accounts/liquidations/LiquidationsService.js +0 -3
- package/dist/cjs/sdk/index.js +12 -0
- package/dist/cjs/sdk/market/oracle/PriceOracleBaseContract.js +10 -3
- package/dist/cjs/sdk/positions/PositionsService.js +206 -1
- package/dist/cjs/sdk/positions/calcBorrowRate.js +43 -0
- package/dist/cjs/sdk/positions/calcHealthFactor.js +44 -0
- package/dist/cjs/sdk/positions/calcLiquidationPrice.js +23 -0
- package/dist/cjs/sdk/positions/calcLiquidationPriceForTarget.js +30 -0
- package/dist/cjs/sdk/positions/calcTimeToLiquidationMs.js +18 -0
- package/dist/cjs/sdk/positions/index.js +12 -1
- package/dist/cjs/sdk/positions/types.js +31 -0
- package/dist/esm/common-utils/utils/apy/get-single-quota-borrow-rate.js +2 -0
- package/dist/esm/common-utils/utils/creditAccount/calc-health-factor.js +24 -22
- package/dist/esm/common-utils/utils/creditAccount/calc-quota-borrow-rate.js +2 -0
- package/dist/esm/common-utils/utils/creditAccount/get-time-to-liquidation.js +5 -4
- package/dist/esm/common-utils/utils/creditAccount/liquidation-price.js +21 -11
- package/dist/esm/dev/AccountOpener.js +1 -1
- package/dist/esm/dev/withdrawalUtils.js +1 -1
- package/dist/esm/model/index.js +2 -2
- package/dist/esm/model/positions.schema.js +14 -2
- package/dist/esm/plugins/adapters/contracts/ERC4626AdapterContract.js +1 -1
- package/dist/esm/preview/preview/CreditAccountState.js +14 -1
- package/dist/esm/preview/preview/buildDelayedPreview.js +16 -6
- package/dist/esm/preview/preview/previewAdjustCreditAccount.js +9 -2
- package/dist/esm/preview/preview/previewOpenCreditAccount.js +11 -3
- package/dist/esm/preview/preview/previewOperation.js +1 -1
- package/dist/esm/preview/simulate/simulatePoolOperation.js +1 -1
- package/dist/esm/preview/trace/extractTransfers.js +1 -1
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +2 -8
- package/dist/esm/sdk/accounts/credit-account-compressor/CreditAccountCompressor.js +2 -90
- package/dist/esm/sdk/accounts/intents/testing/sdk-mock.js +31 -4
- package/dist/esm/sdk/accounts/intents/utils/adjust-state-to-snapshot.js +17 -0
- package/dist/esm/sdk/accounts/intents/utils/index.js +2 -1
- package/dist/esm/sdk/accounts/liquidations/LiquidationsService.js +1 -4
- package/dist/esm/sdk/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.js +1 -1
- package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.js +1 -1
- package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.js +1 -1
- package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js +1 -1
- package/dist/esm/sdk/base/TokensMeta.js +3 -3
- package/dist/esm/sdk/chain/detectNetwork.js +1 -1
- package/dist/esm/sdk/core/createAddressProvider.js +1 -1
- package/dist/esm/sdk/index.js +7 -1
- package/dist/esm/sdk/market/credit/CreditFacadeV310BaseContract.js +1 -1
- package/dist/esm/sdk/market/oracle/PriceOracleBaseContract.js +10 -3
- package/dist/esm/sdk/market/pool/PoolV310Contract.js +1 -1
- package/dist/esm/sdk/market/zapper/IETHZapperContract.js +1 -1
- package/dist/esm/sdk/market/zapper/ZapperContract.js +1 -1
- package/dist/esm/sdk/pools/PoolService.js +1 -1
- package/dist/esm/sdk/positions/PositionsService.js +206 -1
- package/dist/esm/sdk/positions/calcBorrowRate.js +42 -0
- package/dist/esm/sdk/positions/calcHealthFactor.js +43 -0
- package/dist/esm/sdk/positions/calcLiquidationPrice.js +22 -0
- package/dist/esm/sdk/positions/calcLiquidationPriceForTarget.js +29 -0
- package/dist/esm/sdk/positions/calcTimeToLiquidationMs.js +17 -0
- package/dist/esm/sdk/positions/index.js +7 -2
- package/dist/esm/sdk/positions/types.js +31 -1
- package/dist/esm/sdk/utils/viem/simulateWithPriceUpdates.js +1 -1
- package/dist/types/common-utils/utils/apy/get-single-quota-borrow-rate.d.ts +2 -0
- package/dist/types/common-utils/utils/creditAccount/calc-health-factor.d.ts +3 -0
- package/dist/types/common-utils/utils/creditAccount/calc-quota-borrow-rate.d.ts +2 -0
- package/dist/types/common-utils/utils/creditAccount/get-time-to-liquidation.d.ts +3 -0
- package/dist/types/common-utils/utils/creditAccount/liquidation-price.d.ts +3 -0
- package/dist/types/model/index.d.ts +3 -3
- package/dist/types/model/positions.d.ts +84 -1
- package/dist/types/model/positions.schema.d.ts +26 -1
- package/dist/types/preview/preview/CreditAccountState.d.ts +6 -0
- package/dist/types/preview/preview/buildDelayedPreview.d.ts +5 -1
- package/dist/types/preview/preview/types.d.ts +4 -2
- package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +1 -7
- package/dist/types/sdk/accounts/credit-account-compressor/CreditAccountCompressor.d.ts +3 -12
- package/dist/types/sdk/accounts/credit-account-compressor/index.d.ts +2 -2
- package/dist/types/sdk/accounts/credit-account-compressor/types.d.ts +1 -19
- package/dist/types/sdk/accounts/index.d.ts +2 -2
- package/dist/types/sdk/accounts/intents/testing/sdk-mock.d.ts +6 -0
- package/dist/types/sdk/accounts/intents/utils/adjust-state-to-snapshot.d.ts +13 -0
- package/dist/types/sdk/accounts/intents/utils/index.d.ts +2 -1
- package/dist/types/sdk/accounts/types.d.ts +1 -12
- package/dist/types/sdk/index.d.ts +8 -3
- package/dist/types/sdk/market/oracle/PriceOracleBaseContract.d.ts +4 -0
- package/dist/types/sdk/market/oracle/types.d.ts +8 -0
- package/dist/types/sdk/positions/PositionsService.d.ts +31 -2
- package/dist/types/sdk/positions/calcBorrowRate.d.ts +40 -0
- package/dist/types/sdk/positions/calcHealthFactor.d.ts +45 -0
- package/dist/types/sdk/positions/calcLiquidationPrice.d.ts +12 -0
- package/dist/types/sdk/positions/calcLiquidationPriceForTarget.d.ts +43 -0
- package/dist/types/sdk/positions/calcTimeToLiquidationMs.d.ts +15 -0
- package/dist/types/sdk/positions/index.d.ts +7 -2
- package/dist/types/sdk/positions/types.d.ts +58 -1
- package/package.json +1 -1
|
@@ -131,6 +131,67 @@ interface PoolPosition {
|
|
|
131
131
|
**/
|
|
132
132
|
pnl?: PnlBreakdown;
|
|
133
133
|
}
|
|
134
|
+
/**
|
|
135
|
+
* Cost of a position's debt broken down by source.
|
|
136
|
+
*
|
|
137
|
+
* The base rate is what the pool charges on the debt; each quoted collateral
|
|
138
|
+
* adds its own quota rate on top. Rates are reported in two normalizations:
|
|
139
|
+
* relative to the position's total value and relative to its debt.
|
|
140
|
+
**/
|
|
141
|
+
interface BorrowRateBreakdown {
|
|
142
|
+
/**
|
|
143
|
+
* Base rate plus quota rates, relative to the position's total value.
|
|
144
|
+
**/
|
|
145
|
+
total: Bps;
|
|
146
|
+
/**
|
|
147
|
+
* Base rate plus quota rates, relative to the debt. This is the rate the
|
|
148
|
+
* debt itself grows at, so it feeds {@link PositionMetrics.timeToLiquidation}.
|
|
149
|
+
**/
|
|
150
|
+
totalOnDebt: Bps;
|
|
151
|
+
/**
|
|
152
|
+
* Annual cost of the borrowed underlying itself: the pool's base rate plus
|
|
153
|
+
* the credit manager's interest fee. Same value `borrowApy` reports.
|
|
154
|
+
**/
|
|
155
|
+
base: Bps;
|
|
156
|
+
/**
|
|
157
|
+
* Per-token quota rate contribution, relative to the position's total value.
|
|
158
|
+
**/
|
|
159
|
+
quotas: Record<Address, Bps>;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Health and cost metrics of a credit account's state, actual or projected.
|
|
163
|
+
*
|
|
164
|
+
* Previews and operation states carry the whole group; on-chain positions
|
|
165
|
+
* report only the fields they lack natively, see {@link StrategyPosition}.
|
|
166
|
+
**/
|
|
167
|
+
interface PositionMetrics {
|
|
168
|
+
/**
|
|
169
|
+
* Health factor in basis points: below `10000` the account is liquidatable.
|
|
170
|
+
*
|
|
171
|
+
* @example `12500` for a health factor of 1.25
|
|
172
|
+
**/
|
|
173
|
+
healthFactor: Bps;
|
|
174
|
+
/**
|
|
175
|
+
* Net rate the whole position earns, collateral yield minus borrow cost.
|
|
176
|
+
**/
|
|
177
|
+
overallApy: Bps;
|
|
178
|
+
/**
|
|
179
|
+
* Cost of the debt, broken down by source.
|
|
180
|
+
**/
|
|
181
|
+
borrowRate: BorrowRateBreakdown;
|
|
182
|
+
/**
|
|
183
|
+
* Estimated milliseconds until the health factor decays to `10000` under
|
|
184
|
+
* the current borrow rate, or `null` when the debt carries no rate (or the
|
|
185
|
+
* account is already liquidatable).
|
|
186
|
+
**/
|
|
187
|
+
timeToLiquidation: bigint | null;
|
|
188
|
+
/**
|
|
189
|
+
* Price of the single non-underlying collateral at which the account
|
|
190
|
+
* becomes liquidatable, in the oracle's 8-decimal fixed point, or `null`
|
|
191
|
+
* when the account holds zero or several non-underlying assets.
|
|
192
|
+
**/
|
|
193
|
+
liquidationPrice: bigint | null;
|
|
194
|
+
}
|
|
134
195
|
/**
|
|
135
196
|
* An open credit account of a wallet.
|
|
136
197
|
**/
|
|
@@ -200,6 +261,28 @@ interface StrategyPosition {
|
|
|
200
261
|
* @example `12500` for a health factor of 1.25
|
|
201
262
|
**/
|
|
202
263
|
healthFactor: Bps;
|
|
264
|
+
/**
|
|
265
|
+
* Cost of the debt broken down into the pool's base rate and per-token
|
|
266
|
+
* quota rates.
|
|
267
|
+
*
|
|
268
|
+
* @mode onchain
|
|
269
|
+
**/
|
|
270
|
+
borrowRate?: BorrowRateBreakdown;
|
|
271
|
+
/**
|
|
272
|
+
* Estimated milliseconds until the health factor decays to `10000` under
|
|
273
|
+
* the current borrow rate, or `null` when it cannot be estimated.
|
|
274
|
+
*
|
|
275
|
+
* @mode onchain
|
|
276
|
+
**/
|
|
277
|
+
timeToLiquidation?: bigint | null;
|
|
278
|
+
/**
|
|
279
|
+
* Price of the single non-underlying collateral at which the account
|
|
280
|
+
* becomes liquidatable, in the oracle's 8-decimal fixed point, or `null`
|
|
281
|
+
* when the account holds zero or several non-underlying assets.
|
|
282
|
+
*
|
|
283
|
+
* @mode onchain
|
|
284
|
+
**/
|
|
285
|
+
liquidationPrice?: bigint | null;
|
|
203
286
|
/**
|
|
204
287
|
* What the position has earned so far.
|
|
205
288
|
*
|
|
@@ -343,4 +426,4 @@ interface StrategyPositionRef extends StrategyPositionKey {
|
|
|
343
426
|
**/
|
|
344
427
|
type PositionKey = PoolPositionRef | StrategyPositionRef;
|
|
345
428
|
//#endregion
|
|
346
|
-
export { PnlBreakdown, PointsProgramPnL, PointsRewardsPnL, PoolPosition, PoolPositionKey, PoolPositionRef, Position, PositionCollateral, PositionFilter, PositionId, PositionKey, PositionKind, RewardsPnL, StrategyPosition, StrategyPositionKey, StrategyPositionRef, TokenRewardsPnL, liquidationPositionId, matchesPositionFilter, poolPositionId, positionId, strategyPositionId };
|
|
429
|
+
export { BorrowRateBreakdown, PnlBreakdown, PointsProgramPnL, PointsRewardsPnL, PoolPosition, PoolPositionKey, PoolPositionRef, Position, PositionCollateral, PositionFilter, PositionId, PositionKey, PositionKind, PositionMetrics, RewardsPnL, StrategyPosition, StrategyPositionKey, StrategyPositionRef, TokenRewardsPnL, liquidationPositionId, matchesPositionFilter, poolPositionId, positionId, strategyPositionId };
|
|
@@ -255,6 +255,15 @@ declare const poolPositionSchema: z.ZodObject<{
|
|
|
255
255
|
}, z.core.$strip>], "kind">>;
|
|
256
256
|
}, z.core.$strip>>;
|
|
257
257
|
}, z.core.$strip>;
|
|
258
|
+
/**
|
|
259
|
+
* {@link BorrowRateBreakdown}
|
|
260
|
+
**/
|
|
261
|
+
declare const borrowRateBreakdownSchema: z.ZodObject<{
|
|
262
|
+
total: z.ZodNumber;
|
|
263
|
+
totalOnDebt: z.ZodNumber;
|
|
264
|
+
base: z.ZodNumber;
|
|
265
|
+
quotas: z.ZodRecord<z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>, z.ZodNumber>;
|
|
266
|
+
}, z.core.$strip>;
|
|
258
267
|
/**
|
|
259
268
|
* {@link StrategyPosition}
|
|
260
269
|
**/
|
|
@@ -323,6 +332,14 @@ declare const strategyPositionSchema: z.ZodObject<{
|
|
|
323
332
|
}, z.core.$strip>;
|
|
324
333
|
}, z.core.$strip>;
|
|
325
334
|
healthFactor: z.ZodNumber;
|
|
335
|
+
borrowRate: z.ZodOptional<z.ZodObject<{
|
|
336
|
+
total: z.ZodNumber;
|
|
337
|
+
totalOnDebt: z.ZodNumber;
|
|
338
|
+
base: z.ZodNumber;
|
|
339
|
+
quotas: z.ZodRecord<z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>, z.ZodNumber>;
|
|
340
|
+
}, z.core.$strip>>;
|
|
341
|
+
timeToLiquidation: z.ZodOptional<z.ZodNullable<z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>>>;
|
|
342
|
+
liquidationPrice: z.ZodOptional<z.ZodNullable<z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>>>;
|
|
326
343
|
pnl: z.ZodOptional<z.ZodObject<{
|
|
327
344
|
organic: z.ZodObject<{
|
|
328
345
|
value: z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>;
|
|
@@ -568,6 +585,14 @@ declare const positionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
568
585
|
}, z.core.$strip>;
|
|
569
586
|
}, z.core.$strip>;
|
|
570
587
|
healthFactor: z.ZodNumber;
|
|
588
|
+
borrowRate: z.ZodOptional<z.ZodObject<{
|
|
589
|
+
total: z.ZodNumber;
|
|
590
|
+
totalOnDebt: z.ZodNumber;
|
|
591
|
+
base: z.ZodNumber;
|
|
592
|
+
quotas: z.ZodRecord<z.ZodCodec<z.ZodString, z.ZodCustom<`0x${string}`, `0x${string}`>>, z.ZodNumber>;
|
|
593
|
+
}, z.core.$strip>>;
|
|
594
|
+
timeToLiquidation: z.ZodOptional<z.ZodNullable<z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>>>;
|
|
595
|
+
liquidationPrice: z.ZodOptional<z.ZodNullable<z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>>>;
|
|
571
596
|
pnl: z.ZodOptional<z.ZodObject<{
|
|
572
597
|
organic: z.ZodObject<{
|
|
573
598
|
value: z.ZodCodec<z.ZodUnion<[z.ZodString, z.ZodBigInt]>, z.ZodBigInt>;
|
|
@@ -756,4 +781,4 @@ declare const positionKeySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
756
781
|
kind: z.ZodLiteral<"strategy">;
|
|
757
782
|
}, z.core.$strip>], "kind">;
|
|
758
783
|
//#endregion
|
|
759
|
-
export { pnlBreakdownSchema, pointsProgramPnLSchema, pointsRewardsPnLSchema, poolPositionKeySchema, poolPositionSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionKeySchema, positionKindSchema, positionSchema, rewardsPnLSchema, strategyPositionKeySchema, strategyPositionSchema, tokenRewardsPnLSchema };
|
|
784
|
+
export { borrowRateBreakdownSchema, pnlBreakdownSchema, pointsProgramPnLSchema, pointsRewardsPnLSchema, poolPositionKeySchema, poolPositionSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionKeySchema, positionKindSchema, positionSchema, rewardsPnLSchema, strategyPositionKeySchema, strategyPositionSchema, tokenRewardsPnLSchema };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CreditAccountData } from "../../sdk/base/types.js";
|
|
2
2
|
import { AssetsMap } from "../../sdk/utils/AssetsMap.js";
|
|
3
|
+
import { AccountSnapshot } from "../../sdk/positions/types.js";
|
|
3
4
|
import "../../sdk/index.js";
|
|
4
5
|
import { Address } from "viem";
|
|
5
6
|
//#region src/preview/preview/CreditAccountState.d.ts
|
|
@@ -60,6 +61,11 @@ declare class CreditAccountState {
|
|
|
60
61
|
* balances and quotas (≤ 1 wei) filtered out.
|
|
61
62
|
*/
|
|
62
63
|
static fromCreditAccountData(ca: CreditAccountData): CreditAccountState;
|
|
64
|
+
/**
|
|
65
|
+
* Immutable snapshot of this projected state for `sdk.positions` metric
|
|
66
|
+
* methods: dust-filtered balances, all quotas, and {@link totalDebt}.
|
|
67
|
+
**/
|
|
68
|
+
toSnapshot(totalValue: bigint): AccountSnapshot;
|
|
63
69
|
clone(): CreditAccountState;
|
|
64
70
|
/**
|
|
65
71
|
* Borrows `amount` of underlying: debt, total debt and the underlying
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { OnchainSDK } from "../../sdk/OnchainSDK.js";
|
|
2
|
+
import "../../sdk/index.js";
|
|
1
3
|
import { CreditAccountState } from "./CreditAccountState.js";
|
|
2
4
|
import { DetectedDelayedOperation } from "./detectDelayedOperation.js";
|
|
3
5
|
import { InstantOperationPreview } from "./types.js";
|
|
@@ -26,7 +28,9 @@ type ConvertFn = (token: Address, to: Address, amount: bigint) => bigint;
|
|
|
26
28
|
* @param receivedToken - Token the `CLOSE_ACCOUNT` resume withdraws to the
|
|
27
29
|
* user: the unwrapped underlying (vault asset) for RWA markets, the
|
|
28
30
|
* underlying itself otherwise.
|
|
31
|
+
* @param sdk - Market data source for the position metrics of the resulting
|
|
32
|
+
* state; read synchronously, no network access.
|
|
29
33
|
*/
|
|
30
|
-
declare function buildDelayedPreview(afterInstant: CreditAccountState, before: CreditAccountState, detected: DetectedDelayedOperation, convert: ConvertFn, receivedToken: Address): InstantOperationPreview;
|
|
34
|
+
declare function buildDelayedPreview(afterInstant: CreditAccountState, before: CreditAccountState, detected: DetectedDelayedOperation, convert: ConvertFn, receivedToken: Address, sdk: OnchainSDK): InstantOperationPreview;
|
|
31
35
|
//#endregion
|
|
32
36
|
export { ConvertFn, buildDelayedPreview };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { DelayedIntent } from "../../sdk/accounts/withdrawal-compressor/types.js";
|
|
2
2
|
import { Asset } from "../../sdk/base/types.js";
|
|
3
|
+
import { PositionMetrics } from "../../model/positions.js";
|
|
4
|
+
import "../../model/index.js";
|
|
3
5
|
import "../../sdk/index.js";
|
|
4
6
|
import { PoolOperationType } from "../parse/types-pools.js";
|
|
5
7
|
import "../parse/index.js";
|
|
@@ -89,7 +91,7 @@ interface PoolOperationPreview {
|
|
|
89
91
|
*/
|
|
90
92
|
error?: OperationPreviewError;
|
|
91
93
|
}
|
|
92
|
-
interface OpenCreditAccountPreview {
|
|
94
|
+
interface OpenCreditAccountPreview extends PositionMetrics {
|
|
93
95
|
operation: "OpenCreditAccount" | "RWAOpenCreditAccount";
|
|
94
96
|
/**
|
|
95
97
|
* Credit manager the account is opened in
|
|
@@ -132,7 +134,7 @@ interface OpenCreditAccountPreview {
|
|
|
132
134
|
*/
|
|
133
135
|
error?: OperationPreviewError;
|
|
134
136
|
}
|
|
135
|
-
interface AdjustCreditAccountPreview {
|
|
137
|
+
interface AdjustCreditAccountPreview extends PositionMetrics {
|
|
136
138
|
operation: "AdjustCreditAccount";
|
|
137
139
|
/**
|
|
138
140
|
* Credit manager the account is opened in
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { RequestableWithdrawal } from "./withdrawal-compressor/types.js";
|
|
2
2
|
import { Asset, CreditAccountData, CreditAccountTokensSlice, PermitResult } from "../base/types.js";
|
|
3
|
-
import { StrategyPosition } from "../../model/positions.js";
|
|
4
|
-
import "../../model/index.js";
|
|
5
3
|
import { GetOpenAccountRequirementsProps, RWAOpenAccountRequirements } from "../market/rwa/types.js";
|
|
6
4
|
import "../market/rwa/index.js";
|
|
7
5
|
import { PriceUpdate } from "../market/pricefeeds/types.js";
|
|
@@ -14,7 +12,7 @@ import { OnchainSDK } from "../OnchainSDK.js";
|
|
|
14
12
|
import "../types/index.js";
|
|
15
13
|
import { SDKConstruct } from "../base/SDKConstruct.js";
|
|
16
14
|
import "../base/index.js";
|
|
17
|
-
import { GetCreditAccountsOptions
|
|
15
|
+
import { GetCreditAccountsOptions } from "./credit-account-compressor/types.js";
|
|
18
16
|
import "./credit-account-compressor/index.js";
|
|
19
17
|
import "./withdrawal-compressor/index.js";
|
|
20
18
|
import { AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, ClaimFarmRewardsProps, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, ICreditAccountsService, OpenCAProps, PartiallyLiquidateProps, PreviewDelayedWithdrawalProps, Rewards } from "./types.js";
|
|
@@ -50,10 +48,6 @@ declare class CreditAccountsServiceV310 extends SDKConstruct implements ICreditA
|
|
|
50
48
|
* {@inheritDoc ICreditAccountsService.getBorrowerCreditAccounts}
|
|
51
49
|
**/
|
|
52
50
|
getBorrowerCreditAccounts(borrower: Address, options?: GetCreditAccountsOptions, blockNumber?: bigint): Promise<Array<CreditAccountData<true>>>;
|
|
53
|
-
/**
|
|
54
|
-
* {@inheritDoc ICreditAccountsService.listPositions}
|
|
55
|
-
**/
|
|
56
|
-
listPositions(props: ListStrategyPositionsProps): Promise<StrategyPosition[]>;
|
|
57
51
|
/**
|
|
58
52
|
* {@inheritDoc ICreditAccountsService.getRewards}
|
|
59
53
|
**/
|
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
import { CreditAccountData } from "../../base/types.js";
|
|
2
|
-
import { StrategyPosition } from "../../../model/positions.js";
|
|
3
|
-
import "../../../model/index.js";
|
|
4
2
|
import { SDKConstruct } from "../../base/SDKConstruct.js";
|
|
5
3
|
import "../../base/index.js";
|
|
6
|
-
import { GetCreditAccountsOptions
|
|
4
|
+
import { GetCreditAccountsOptions } from "./types.js";
|
|
7
5
|
import { Address } from "viem";
|
|
8
6
|
//#region src/sdk/accounts/credit-account-compressor/CreditAccountCompressor.d.ts
|
|
9
7
|
/**
|
|
10
8
|
* Reads credit accounts of the current chain.
|
|
11
9
|
*
|
|
12
10
|
* Stitches the credit account compressor together with the RWA factories (for
|
|
13
|
-
* accounts owned via an investor EOA) and
|
|
14
|
-
*
|
|
15
|
-
* either as raw account data or as {@link StrategyPosition}s.
|
|
11
|
+
* accounts owned via an investor EOA), and describes the result as raw
|
|
12
|
+
* account data.
|
|
16
13
|
*
|
|
17
14
|
* TODO: create and deploy new compressor contract onchain to avoid all this stitching
|
|
18
15
|
**/
|
|
@@ -49,12 +46,6 @@ declare class CreditAccountCompressor extends SDKConstruct {
|
|
|
49
46
|
* @param blockNumber - Block to read at, defaults to the latest block.
|
|
50
47
|
**/
|
|
51
48
|
getBorrowerCreditAccounts(borrower: Address, options?: GetCreditAccountsOptions, blockNumber?: bigint): Promise<CreditAccountData<true>[]>;
|
|
52
|
-
/**
|
|
53
|
-
* Describes all credit accounts of a wallet as strategy positions.
|
|
54
|
-
*
|
|
55
|
-
* @param props - {@link ListStrategyPositionsProps}
|
|
56
|
-
**/
|
|
57
|
-
listPositions(props: ListStrategyPositionsProps): Promise<StrategyPosition[]>;
|
|
58
49
|
}
|
|
59
50
|
//#endregion
|
|
60
51
|
export { CreditAccountCompressor };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreditAccountDataCall, CreditAccountFilter, CreditAccountReadOptions, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsTarget, CreditManagerFilter, GetCreditAccountsArgs, GetCreditAccountsOptions
|
|
1
|
+
import { CreditAccountDataCall, CreditAccountFilter, CreditAccountReadOptions, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsTarget, CreditManagerFilter, GetCreditAccountsArgs, GetCreditAccountsOptions } from "./types.js";
|
|
2
2
|
import { CreditAccountCompressor } from "./CreditAccountCompressor.js";
|
|
3
3
|
import { CreditAccountCompressorV310Contract } from "./CreditAccountCompressorV310Contract.js";
|
|
4
|
-
export { CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountDataCall, CreditAccountFilter, CreditAccountReadOptions, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsTarget, CreditManagerFilter, GetCreditAccountsArgs, GetCreditAccountsOptions
|
|
4
|
+
export { CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountDataCall, CreditAccountFilter, CreditAccountReadOptions, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsTarget, CreditManagerFilter, GetCreditAccountsArgs, GetCreditAccountsOptions };
|
|
@@ -146,23 +146,5 @@ interface GetCreditAccountsOptions {
|
|
|
146
146
|
**/
|
|
147
147
|
ignoreReservePrices?: boolean;
|
|
148
148
|
}
|
|
149
|
-
/**
|
|
150
|
-
* Props for {@link CreditAccountCompressor.listPositions}.
|
|
151
|
-
**/
|
|
152
|
-
interface ListStrategyPositionsProps {
|
|
153
|
-
/**
|
|
154
|
-
* Wallet whose credit accounts to describe. RWA accounts are resolved from
|
|
155
|
-
* the investor EOA, see {@link CreditAccountCompressor.getBorrowerCreditAccounts}.
|
|
156
|
-
**/
|
|
157
|
-
owner: Address;
|
|
158
|
-
/**
|
|
159
|
-
* Whether to include accounts that carry no debt.
|
|
160
|
-
**/
|
|
161
|
-
includeZeroDebt: boolean;
|
|
162
|
-
/**
|
|
163
|
-
* Block to read at. Defaults to the latest block.
|
|
164
|
-
**/
|
|
165
|
-
blockNumber?: bigint;
|
|
166
|
-
}
|
|
167
149
|
//#endregion
|
|
168
|
-
export { CreditAccountDataCall, CreditAccountFilter, CreditAccountReadOptions, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsTarget, CreditManagerFilter, GetCreditAccountsArgs, GetCreditAccountsOptions
|
|
150
|
+
export { CreditAccountDataCall, CreditAccountFilter, CreditAccountReadOptions, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsTarget, CreditManagerFilter, GetCreditAccountsArgs, GetCreditAccountsOptions };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ClaimableWithdrawal, CurrentWithdrawals, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedIntentExtended, DelayedWithdrawCollateralIntent, GetExternalAccountCurrentWithdrawalsProps, GetWithdrawalRequestResultProps, IRedemptionLoggerContract, IWithdrawalCompressorContract, PendingWithdrawal, RedemptionLog, RequestableWithdrawal, WithdrawableAsset, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, toWithdrawalStatus } from "./withdrawal-compressor/types.js";
|
|
2
|
-
import { CreditAccountDataCall, CreditAccountFilter, CreditAccountReadOptions, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsTarget, CreditManagerFilter, GetCreditAccountsArgs, GetCreditAccountsOptions
|
|
2
|
+
import { CreditAccountDataCall, CreditAccountFilter, CreditAccountReadOptions, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsTarget, CreditManagerFilter, GetCreditAccountsArgs, GetCreditAccountsOptions } from "./credit-account-compressor/types.js";
|
|
3
3
|
import { CreditAccountCompressor } from "./credit-account-compressor/CreditAccountCompressor.js";
|
|
4
4
|
import { CreditAccountCompressorV310Contract } from "./credit-account-compressor/CreditAccountCompressorV310Contract.js";
|
|
5
5
|
import "./credit-account-compressor/index.js";
|
|
@@ -28,4 +28,4 @@ import { BuildLiquidationTxProps, BuildLiquidationTxPropsBase, GetLiquidatableAc
|
|
|
28
28
|
import { LiquidationsService } from "./liquidations/LiquidationsService.js";
|
|
29
29
|
import { MultichainLiquidationsService } from "./liquidations/MultichainLiquidationsService.js";
|
|
30
30
|
import "./liquidations/index.js";
|
|
31
|
-
export { AbstractWithdrawalCompressorContract, AccountBotsService, AccountToCheck, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, BotStatusCall, BotsDirectResponse, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, CMSlice, ClaimFarmRewardsProps, ClaimableWithdrawal, CloseCreditAccountResult, 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, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedIntentExtended, DelayedWithdrawCollateralIntent, EncodableCreditAccountOperation, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetExternalAccountCurrentWithdrawalsProps, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, GetWithdrawalRequestResultProps, ICreditAccountsService, IRedemptionLoggerContract, IWithdrawalCompressorContract, type IntentPreviewResult, InvalidDelayedIntentError, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LiquidationsService,
|
|
31
|
+
export { AbstractWithdrawalCompressorContract, AccountBotsService, AccountToCheck, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, BotStatusCall, BotsDirectResponse, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, CMSlice, ClaimFarmRewardsProps, ClaimableWithdrawal, CloseCreditAccountResult, 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, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedIntentExtended, DelayedWithdrawCollateralIntent, EncodableCreditAccountOperation, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetExternalAccountCurrentWithdrawalsProps, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, GetWithdrawalRequestResultProps, ICreditAccountsService, IRedemptionLoggerContract, IWithdrawalCompressorContract, type IntentPreviewResult, InvalidDelayedIntentError, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LiquidationsService, LoadRWALiquidatorsProps, MulticallWithFailure, MultichainLiquidationsService, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, OnchainRequestableWithdrawal, OpenCAProps, PartiallyLiquidateProps, PendingWithdrawal, PeripheryCompressorV310Contract, PreviewDelayedWithdrawalProps, RWALiquidatorInfo, RedemptionLog, RedemptionLoggerV310Contract, RequestableWithdrawal, Rewards, SetBotProps, SetBotResult, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, createRedemptionLogger, createWithdrawalCompressor, decodeDelayedIntent, encodeDelayedIntent, getWithdrawalCompressorAddress, iCreditAccountAbi, primaryInstantOutput, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal, toWithdrawalStatus };
|
|
@@ -62,6 +62,12 @@ interface BuildMockSdkArgs {
|
|
|
62
62
|
quotas: Record<Address, MockQuotaEntry>;
|
|
63
63
|
liquidationThresholds: Record<Address, number>;
|
|
64
64
|
maxDebt: bigint;
|
|
65
|
+
/** Facade `minDebt`; defaults to 0n so debt-range checks stay opt-in. */
|
|
66
|
+
minDebt?: bigint;
|
|
67
|
+
/** Pool base rate in ray; feeds `calcBorrowApy` of position metrics. */
|
|
68
|
+
baseInterestRate?: bigint;
|
|
69
|
+
/** Credit manager interest fee in Bps; feeds position metrics. */
|
|
70
|
+
feeInterest?: number;
|
|
65
71
|
creditManager: Address;
|
|
66
72
|
creditFacade: Address;
|
|
67
73
|
/** Market underlying token (`market.pool.underlying`). */
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AccountSnapshot } from "../../../positions/types.js";
|
|
2
|
+
import "../../../positions/index.js";
|
|
3
|
+
import { AdjustState } from "../types.js";
|
|
4
|
+
import { Address } from "viem";
|
|
5
|
+
//#region src/sdk/accounts/intents/utils/adjust-state-to-snapshot.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Maps an intents {@link AdjustState} onto the {@link AccountSnapshot} that
|
|
8
|
+
* position-metric functions take. `accountDebt` is treated as total debt
|
|
9
|
+
* (principal plus accrued interest and fees).
|
|
10
|
+
**/
|
|
11
|
+
declare function adjustStateToSnapshot(creditManager: Address, state: AdjustState): AccountSnapshot;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { adjustStateToSnapshot };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { adjustStateToSnapshot } from "./adjust-state-to-snapshot.js";
|
|
1
2
|
import { assembleOperationCalls } from "./assemble-operation-calls.js";
|
|
2
3
|
import { calcBorrowedAmountPlusInterestAndFees } from "./borrowed-amount-plus-interest-and-fees.js";
|
|
3
4
|
import { eq, toRouterCaSlice, toTargetDecimals } from "./common.js";
|
|
@@ -6,4 +7,4 @@ import { ConvertFn, simulateOperationAssets } from "./simulate-assets.js";
|
|
|
6
7
|
import { getQuotasForUpdate } from "./quotas-for-update.js";
|
|
7
8
|
import { SimulateStateReturn, simulateState } from "./simulate-adjust-state.js";
|
|
8
9
|
import { getOperationsWithQuotaUpdate } from "./with-quota-update.js";
|
|
9
|
-
export { ConvertFn, SimulateStateReturn, assembleOperationCalls, calcBorrowedAmountPlusInterestAndFees, convertAmount, eq, getOperationsWithQuotaUpdate, getQuotasForUpdate, simulateOperationAssets, simulateState, toRouterCaSlice, toTargetDecimals };
|
|
10
|
+
export { ConvertFn, SimulateStateReturn, adjustStateToSnapshot, assembleOperationCalls, calcBorrowedAmountPlusInterestAndFees, convertAmount, eq, getOperationsWithQuotaUpdate, getQuotasForUpdate, simulateOperationAssets, simulateState, toRouterCaSlice, toTargetDecimals };
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { ClaimableWithdrawal, DelayedIntent, PendingWithdrawal, RequestableWithdrawal } from "./withdrawal-compressor/types.js";
|
|
2
2
|
import { Asset, CreditAccountData, CreditAccountTokensSlice, PermitResult } from "../base/types.js";
|
|
3
|
-
import { StrategyPosition } from "../../model/positions.js";
|
|
4
|
-
import "../../model/index.js";
|
|
5
3
|
import { GetOpenAccountRequirementsProps, RWAOpenAccountRequirements, RWAOperationArgs } from "../market/rwa/types.js";
|
|
6
4
|
import "../market/rwa/index.js";
|
|
7
5
|
import { PriceUpdate } from "../market/pricefeeds/types.js";
|
|
@@ -15,7 +13,7 @@ import { OnchainSDK } from "../OnchainSDK.js";
|
|
|
15
13
|
import { Construct } from "../base/Construct.js";
|
|
16
14
|
import "../types/index.js";
|
|
17
15
|
import "../base/index.js";
|
|
18
|
-
import { GetCreditAccountsOptions
|
|
16
|
+
import { GetCreditAccountsOptions } from "./credit-account-compressor/types.js";
|
|
19
17
|
import "./credit-account-compressor/index.js";
|
|
20
18
|
import "./withdrawal-compressor/index.js";
|
|
21
19
|
import { AccountBotsService } from "./bots/AccountBotsService.js";
|
|
@@ -404,15 +402,6 @@ interface ICreditAccountsService extends Construct {
|
|
|
404
402
|
* @returns Credit accounts (with investor) sorted by health factor ascending
|
|
405
403
|
*/
|
|
406
404
|
getBorrowerCreditAccounts(borrower: Address, options?: GetCreditAccountsOptions, blockNumber?: bigint): Promise<Array<CreditAccountData<true>>>;
|
|
407
|
-
/**
|
|
408
|
-
* Describes the open credit accounts of a wallet as the shared read model's
|
|
409
|
-
* strategy positions.
|
|
410
|
-
*
|
|
411
|
-
* @param props - {@link ListStrategyPositionsProps}
|
|
412
|
-
* @returns One row per open account. Accounts whose collateral computation
|
|
413
|
-
* failed are excluded, because none of their amounts can be computed.
|
|
414
|
-
*/
|
|
415
|
-
listPositions(props: ListStrategyPositionsProps): Promise<StrategyPosition[]>;
|
|
416
405
|
/**
|
|
417
406
|
* Method to get all claimable rewards for credit account (ex. stkUSDS SKY rewards).
|
|
418
407
|
* Associates rewards by adapter + stakedPhantomToken.
|
|
@@ -112,7 +112,12 @@ import { ContractMethod, IPriceUpdateTx, MultiCall, RawTx } from "./types/transa
|
|
|
112
112
|
import { AddLiquidityProps, DepositMetadata, IPoolsService, ListPoolPositionsProps, MarketType, PoolServiceCall, PoolServiceCallResult, RemoveLiquidityProps, WithdrawalMetadata } from "./pools/types.js";
|
|
113
113
|
import { PoolService } from "./pools/PoolService.js";
|
|
114
114
|
import "./pools/index.js";
|
|
115
|
-
import { ListPositionsProps, ListPositionsPropsBase } from "./positions/types.js";
|
|
115
|
+
import { AccountSnapshot, ListPositionsProps, ListPositionsPropsBase, ListStrategyPositionsProps, accountSnapshotFromCreditAccountData } from "./positions/types.js";
|
|
116
|
+
import { CalcBorrowRateProps, calcBorrowRate } from "./positions/calcBorrowRate.js";
|
|
117
|
+
import { CalcHealthFactorProps, calcHealthFactor } from "./positions/calcHealthFactor.js";
|
|
118
|
+
import { CalcLiquidationPriceForTargetProps, CalcLiquidationPriceProps, calcLiquidationPriceForTarget } from "./positions/calcLiquidationPriceForTarget.js";
|
|
119
|
+
import { calcLiquidationPrice } from "./positions/calcLiquidationPrice.js";
|
|
120
|
+
import { calcTimeToLiquidationMs } from "./positions/calcTimeToLiquidationMs.js";
|
|
116
121
|
import { MultichainPositionsService } from "./positions/MultichainPositionsService.js";
|
|
117
122
|
import { PositionsService } from "./positions/PositionsService.js";
|
|
118
123
|
import "./positions/index.js";
|
|
@@ -146,7 +151,7 @@ import { ChainBlock, ChainBlockPin, ChainBlockSource, ChainQueryOneProps, ChainQ
|
|
|
146
151
|
import { PlaceholderContract } from "./base/PlaceholderContract.js";
|
|
147
152
|
import { SDKConstruct } from "./base/SDKConstruct.js";
|
|
148
153
|
import "./base/index.js";
|
|
149
|
-
import { CreditAccountDataCall, CreditAccountFilter, CreditAccountReadOptions, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsTarget, CreditManagerFilter, GetCreditAccountsArgs, GetCreditAccountsOptions
|
|
154
|
+
import { CreditAccountDataCall, CreditAccountFilter, CreditAccountReadOptions, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsTarget, CreditManagerFilter, GetCreditAccountsArgs, GetCreditAccountsOptions } from "./accounts/credit-account-compressor/types.js";
|
|
150
155
|
import { CreditAccountCompressor } from "./accounts/credit-account-compressor/CreditAccountCompressor.js";
|
|
151
156
|
import { CreditAccountCompressorV310Contract } from "./accounts/credit-account-compressor/CreditAccountCompressorV310Contract.js";
|
|
152
157
|
import { AbstractWithdrawalCompressorContract, OnchainRequestableWithdrawal, iCreditAccountAbi, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal } from "./accounts/withdrawal-compressor/AbstractWithdrawalCompressorContract.js";
|
|
@@ -173,4 +178,4 @@ import { LiquidationsService } from "./accounts/liquidations/LiquidationsService
|
|
|
173
178
|
import { MultichainLiquidationsService } from "./accounts/liquidations/MultichainLiquidationsService.js";
|
|
174
179
|
import "./accounts/index.js";
|
|
175
180
|
import { SDKOptions, attachOptionsSchema, onchainSDKOptionsSchema } from "./options.js";
|
|
176
|
-
export { ADDRESS_0X0, ADDRESS_PROVIDER_V310, AP_ACCOUNT_FACTORY, AP_ACL, AP_BOT_LIST, AP_BYTECODE_REPOSITORY, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_CREDIT_SUITE_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GAUGE_COMPRESSOR, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MARKET_CONFIGURATOR, AP_PARTIAL_LIQUIDATION_BOT, AP_PERIPHERY_COMPRESSOR, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_FEED_STORE, AP_PRICE_ORACLE, AP_REDEMPTION_LOGGER, AP_REWARDS_COMPRESSOR, AP_ROUTER, AP_RWA_COMPRESSOR, AP_TOKEN_COMPRESSOR, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AccountBotsService, AccountToCheck, AdapterData, AddLiquidityProps, AddressMap, AddressProviderAddresses, AddressProviderState, AddressProviderV310Contract, type AddressProviderV3StateHuman, AddressSet, type AliasLossPolicyStateHuman, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, AssertAssignable, Asset, type AssetPriceFeedStateHuman, AssetsMap, AttachOptions, BLOCKS_PER_WEEK_BY_NETWORK, BalanceDelta, BalancerStablePriceFeedContract, BalancerWeightedPriceFeedContract, type BalancerWeightedPriceFeedStateHuman, BaseContract, BaseContractArgs, type BaseContractStateHuman, BaseParams, BasePlugin, type BasePriceFeedStateHuman, BaseState, BigIntMath, type BlockNumberProps, type BotListStateHuman, BotPermissions, BotStatusCall, BotsDirectResponse, type BoundedOracleStateHuman, BoundedPriceFeedContract, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, CMSlice, ChainBlock, ChainBlockPin, ChainBlockSource, ChainConfig, ChainContractsRegister, ChainNotConfiguredError, ChainQueryOneProps, ChainQueryProps, ClaimFarmRewardsProps, ClaimableWithdrawal, ClientOptions, CloseCreditAccountResult, ClosePathBalances, CompositePriceFeedContract, CompressorZapperData, ConnectedBotData, ConnectedBotsCall, ConnectedBotsPerAccount, type ConstantOracleStateHuman, Construct, ConstructOptions, type ContractMethod, ContractOrInterface, ContractParseError, ContractParseErrorOptions, type CoreStateHuman, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountData, CreditAccountDataCall, CreditAccountDataPayload, CreditAccountFilter, CreditAccountOperationResult, CreditAccountOperationsService, CreditAccountReadOptions, type CreditAccountSlice, CreditAccountTokenQuota, CreditAccountTokensSlice, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsServiceV310, CreditAccountsTarget, CreditConfiguratorState, type CreditConfiguratorStateHuman, CreditConfiguratorV310Contract, CreditFacadeState, type CreditFacadeStateHuman, type abi as CreditFacadeV310Abi, abi as creditFacadeV310Abi, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerDebtParams, type CreditManagerDebtParamsHuman, CreditManagerFilter, CreditManagerOperationResult, CreditManagerState, type CreditManagerStateHuman, CreditManagerV310Contract, CreditSuite, CreditSuiteState, type CreditSuiteStateHuman, CurrentWithdrawals, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DStokenData, DUST_THRESHOLD, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedIntentExtended, DelayedWithdrawCollateralIntent, DelegatedMulticall, DepositMetadata, EncodableCreditAccountOperation, Erc4626PriceFeedContract, EstimateRawTxGasParameters, EtherscanURLParam, ExecuteMulticallBatchesOptions, ExpectedBalanceDeltasProps, ExpectedOutput, ExternalPriceFeedContract, type FetchRedstonePayloadsOptions, FilterDustUSDOptions, FindBestClosePathProps, FindClaimAllRewardsProps, FindManyToOnePathProps, FindOneTokenPathProps, FindOpenStrategyPathProps, FormatBNOptions, FullyLiquidateProps, FullyLiquidateResult, GaugeContract, GaugeData, GaugeParams, type GaugeParamsHuman, type GaugeStateHuman, type GearStakingV3StateHuman, GearboxChain, type GearboxState, type GearboxStateHuman, GetApprovalAddressProps, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetExternalAccountCurrentWithdrawalsProps, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, GetWithdrawalRequestResultProps, HydrateOptions, IAdapterContract, IAddressProviderContract, IBaseContract, ICreditAccountsService, ICreditConfiguratorContract, ICreditFacadeContract, ICreditManagerContract, IERC20ZapperContract, IETHZapperContract, IInterestRateModelContract, type ILogger, IOnchainSDKPlugin, IOnchainSDKPluginConstructor, IPluginState, IPoolContract, IPoolsService, IPriceFeedContract, IPriceOracleContract, type IPriceUpdateTx, IRWAFactory, IRateKeeperContract, IRedemptionLoggerContract, IRouterContract, IUpdatablePriceFeedContract, IWithdrawalCompressorContract, IZapperContract, type IntentPreviewResult, type InterestRateModelStateHuman, InterestRateModelType, InvalidDelayedIntentError, IsDustOptions, IsStrategyCollateralProps, LEVERAGE_DECIMALS, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LPMonopolizedPoolMeta, type LPPriceFeedStateHuman, LatestUpdate, LinearInterestRateModelContract, type LinearInterestRateModelStateHuman, LiquidationFees, LiquidationsService, ListPoolPositionsProps, ListPositionsProps, ListPositionsPropsBase, ListStrategyPositionsProps, LoadRWALiquidatorsProps, type LogFn, type LossPolicyStateHuman, MAX_INT, MAX_LEVERAGE_BUFFER_BPS, MAX_UINT16, MAX_UINT256, MIN_INT96, MULTICALL_ADDRESS, MarketData, MarketFilter, MarketRegister, MarketRegistryState, MarketRegistryStateHuman, type MarketStateHuman, MarketSuite, MarketType, MellowLRTPriceFeedContract, Methods, MidasLiquidatorContract, MissingSerializedParamsError, type MultiCall, MulticallBatch, MulticallWithFailure, MultichainAttachOptions, type MultichainChainIdsProps, MultichainConstruct, MultichainHydrateOptions, MultichainLiquidationsService, type MultichainNetworkProps, MultichainOpportunitiesService, MultichainPositionsService, MultichainSDK, MultichainSDKOptions, type MultichainState, type MultichainStateHuman, MultichainSyncStateOptions, NATIVE_ADDRESS, NON_STRATEGY_PHANTOM_TOKEN_TYPES, NOT_DEPLOYED, NO_VERSION, NetworkType, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, OnchainRequestableWithdrawal, OnchainSDK, OnchainSDKOptions, OpenCAProps, OpenStrategyResult, OpportunitiesService, OptimalRepaidAmountProps, PARTIAL_LIQUIDATION_BUFFER_BPS, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PERCENTAGE_FACTOR_1KK, PERIPHERY_CONTRACTS, PHANTOM_TOKEN_CONTRACT_TYPES, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, PRICE_DECIMALS, PRICE_DECIMALS_POW, ParsedCall, ParsedCallArgs, ParsedCallV2, ParsedZapperDeposit, ParsedZapperOperation, ParsedZapperRedeem, PartialLiquidationParams, PartialPriceFeedInitError, PartialPriceFeedTreeNode, PartialRecord, PartiallyLiquidateProps, PendingWithdrawal, PendleTWAPPTPriceFeed, PeripheryCompressorV310Contract, PeripheryContract, PermitResult, PhantomTokenContractType, PhantomTokenMeta, PickSomeRequired, PlaceholderAdapterContract, PlaceholderAdapterContractOptions, PlaceholderContract, PluginFactoriesMap, PluginFactory, PluginState, PluginStateVersionError, PluginStatesMap, PluginsMap, PoolQuotaKeeperContract, type PoolQuotaKeeperStateHuman, PoolService, PoolServiceCall, PoolServiceCallResult, PoolState, type PoolStateHuman, PoolSuite, type PoolSuiteStateHuman, PoolV310Contract, PositionsService, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, PriceFeedAnswer, PriceFeedConstructorArgs, PriceFeedContractType, PriceFeedMapEntry, PriceFeedRef, PriceFeedRegister, PriceFeedRegisterHooks, PriceFeedRegisterOptions, type PriceFeedStateHuman, PriceFeedTreeNode, PriceFeedUsageType, PriceFeedsForAccountOptions, PriceFeedsForTokensOptions, PriceOracleData, type PriceOracleStateHuman, PriceOracleV310Contract, PriceUpdate, PythPriceFeed, QuotaKeeperState, type QuotaParamsHuman, QuotaState, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, RWACompressorCall, RWACompressorInvestorData, RWACompressorResponse, RWADefaultTokenMeta, RWAFactoryData, RWAFactoryStateHuman, RWAFactoryType, RWAInvestorData, RWALiquidatorInfo, RWAMissingOpenAccountRequirements, RWAOnDemandLPMeta, RWAOnDemandLPMonopolizedMeta, RWAOnDemandLpContractType, RWAOnDemandTokenMeta, RWAOpenAccountRequirements, RWAOperationArgs, RWARegistry, RWAState, RWAStateHuman, RWATokenMeta, RWAUnderlyingContractType, RWAUnderlyingData, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND, RampEvent, RateKeeperState, type RateKeeperStateHuman, RateKeeperType, type RawTx, RedemptionLog, RedemptionLoggerV310Contract, RedstonePriceFeedContract, type RedstonePriceFeedStateHuman, RelaxedBaseParams, RemoveLiquidityProps, RequestableWithdrawal, RetryOptions, RewardInfo, Rewards, RouterCASlice, RouterCMSlice, RouterCloseResult, RouterResult, RouterRewardsResult, RouterV310Contract, SDKConstruct, SDKOptions, SECONDS_PER_YEAR, SECURITIZE_REGISTER_VAULT_TYPES, SLIPPAGE_DECIMALS, STATE_VERSION, SUPPORTED_NETWORKS, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeCreditAccountData, SecuritizeInvestorData, SecuritizeLiquidatorContract, SecuritizeMissingOpenAccountRequirements, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRWAFactory, SecuritizeRWAFactoryStateHuman, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature, SendRawTxParameters, SetBotProps, SetBotResult, SimpleTokenMeta, SimulateCallOptions, SimulateCallParameters, SimulateCallReturnType, SimulateMulticallParameters, SimulateMulticallReturnType, SimulateWithPriceUpdatesError, SimulateWithPriceUpdatesErrorParams, SimulateWithPriceUpdatesErrorType, SimulateWithPriceUpdatesParameters, SimulateWithPriceUpdatesReturnType, SimulationError, SimulationErrorType, StrategyRef, SunsetStrategy, SupportedValue, SwapOperation, SyncStateOptions, type TimestampedCalldata, TokenInfo, TokenMetaData, TokensMeta, TokensMetaState, type TumblerStateHuman, TypedObjectUtils, Unarray, UnsupportedZapperFunctionError, UpdatePriceFeedsResult, VERSION_RANGE_310, VersionRange, VotingContractStatus, WAD, WAD_DECIMALS_POW, WatchBlocksAsyncParameters, WatchBlocksAsyncReturnType, type WithBlock, type WithMultichain, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalMetadata, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, WstETHPriceFeedContract, YearnPriceFeedContract, ZapperContract, ZapperData, type ZapperStateHuman, ZeroPriceFeedContract, ZodAddress, ZodBigInt, ZodHex, assetsMap, attachOptionsSchema, botPermissionsToString, bytes32ToString, calcAdditionalBorrowApy, calcBorrowApy, calcMaxLeverage, calcPositionLeverage, calcUtilization, chains, childLogger, createAdapter, createAddressProvider, createPriceOracle, createRawTx, createRedemptionLogger, createRouter, createWithdrawalCompressor, createZapper, decodeDelayedIntent, detectNetwork, dominantCollateral, encodeDelayedIntent, estimateRawTxGas, etherscanApiUrl, etherscanUrl, executeDelegatedMulticalls, executeMulticallBatches, expectedBalanceDeltas, fetchRedstonePayloads, filterDust, filterDustUSD, findCuratorMarketConfigurator, fmtBinaryMask, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, generateCastTraceCall, getAssetType, getCastTraceArgs, getChain, getCuratorName, getFunctionSignature, getNetworkType, getRawPriceUpdates, getSimulateWithPriceUpdatesError, getWithdrawalCompressorAddress, halfRAY, healthFactorBps, hexEq, hydrateAddressProvider, iCreditAccountAbi, isDust, isLPPriceFeed, isPublicNetwork, isRWAFactory, isRWAToken, isStrategyCollateral, isSunsetPool, isSunsetStrategy, isSupportedNetwork, isUpdatablePriceFeed, isV310, isVersionRange, json_parse, json_stringify, minSeizedAmount, mustGetDominantCollateral, numberWithCommas, onchainSDKOptionsSchema, optimalHFForPartialLiquidation, optimalRepaidAmount, percentFmt, primaryInstantOutput, rayToBps, rayToNumber, retry, sendRawTx, shortAddress, shortHash, simulateCall, simulateMulticall, simulateWithPriceUpdates, toAddress, toBN, toBigInt, toChainIds, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal, toSignificant, toWithdrawalStatus, usdToNumber, watchBlocksAsync };
|
|
181
|
+
export { ADDRESS_0X0, ADDRESS_PROVIDER_V310, AP_ACCOUNT_FACTORY, AP_ACL, AP_BOT_LIST, AP_BYTECODE_REPOSITORY, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_CREDIT_SUITE_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GAUGE_COMPRESSOR, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MARKET_CONFIGURATOR, AP_PARTIAL_LIQUIDATION_BOT, AP_PERIPHERY_COMPRESSOR, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_FEED_STORE, AP_PRICE_ORACLE, AP_REDEMPTION_LOGGER, AP_REWARDS_COMPRESSOR, AP_ROUTER, AP_RWA_COMPRESSOR, AP_TOKEN_COMPRESSOR, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AccountBotsService, AccountSnapshot, AccountToCheck, AdapterData, AddLiquidityProps, AddressMap, AddressProviderAddresses, AddressProviderState, AddressProviderV310Contract, type AddressProviderV3StateHuman, AddressSet, type AliasLossPolicyStateHuman, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, AssertAssignable, Asset, type AssetPriceFeedStateHuman, AssetsMap, AttachOptions, BLOCKS_PER_WEEK_BY_NETWORK, BalanceDelta, BalancerStablePriceFeedContract, BalancerWeightedPriceFeedContract, type BalancerWeightedPriceFeedStateHuman, BaseContract, BaseContractArgs, type BaseContractStateHuman, BaseParams, BasePlugin, type BasePriceFeedStateHuman, BaseState, BigIntMath, type BlockNumberProps, type BotListStateHuman, BotPermissions, BotStatusCall, BotsDirectResponse, type BoundedOracleStateHuman, BoundedPriceFeedContract, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, CMSlice, CalcBorrowRateProps, CalcHealthFactorProps, CalcLiquidationPriceForTargetProps, CalcLiquidationPriceProps, ChainBlock, ChainBlockPin, ChainBlockSource, ChainConfig, ChainContractsRegister, ChainNotConfiguredError, ChainQueryOneProps, ChainQueryProps, ClaimFarmRewardsProps, ClaimableWithdrawal, ClientOptions, CloseCreditAccountResult, ClosePathBalances, CompositePriceFeedContract, CompressorZapperData, ConnectedBotData, ConnectedBotsCall, ConnectedBotsPerAccount, type ConstantOracleStateHuman, Construct, ConstructOptions, type ContractMethod, ContractOrInterface, ContractParseError, ContractParseErrorOptions, type CoreStateHuman, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountData, CreditAccountDataCall, CreditAccountDataPayload, CreditAccountFilter, CreditAccountOperationResult, CreditAccountOperationsService, CreditAccountReadOptions, type CreditAccountSlice, CreditAccountTokenQuota, CreditAccountTokensSlice, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsServiceV310, CreditAccountsTarget, CreditConfiguratorState, type CreditConfiguratorStateHuman, CreditConfiguratorV310Contract, CreditFacadeState, type CreditFacadeStateHuman, type abi as CreditFacadeV310Abi, abi as creditFacadeV310Abi, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerDebtParams, type CreditManagerDebtParamsHuman, CreditManagerFilter, CreditManagerOperationResult, CreditManagerState, type CreditManagerStateHuman, CreditManagerV310Contract, CreditSuite, CreditSuiteState, type CreditSuiteStateHuman, CurrentWithdrawals, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DStokenData, DUST_THRESHOLD, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedIntentExtended, DelayedWithdrawCollateralIntent, DelegatedMulticall, DepositMetadata, EncodableCreditAccountOperation, Erc4626PriceFeedContract, EstimateRawTxGasParameters, EtherscanURLParam, ExecuteMulticallBatchesOptions, ExpectedBalanceDeltasProps, ExpectedOutput, ExternalPriceFeedContract, type FetchRedstonePayloadsOptions, FilterDustUSDOptions, FindBestClosePathProps, FindClaimAllRewardsProps, FindManyToOnePathProps, FindOneTokenPathProps, FindOpenStrategyPathProps, FormatBNOptions, FullyLiquidateProps, FullyLiquidateResult, GaugeContract, GaugeData, GaugeParams, type GaugeParamsHuman, type GaugeStateHuman, type GearStakingV3StateHuman, GearboxChain, type GearboxState, type GearboxStateHuman, GetApprovalAddressProps, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetExternalAccountCurrentWithdrawalsProps, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, GetWithdrawalRequestResultProps, HydrateOptions, IAdapterContract, IAddressProviderContract, IBaseContract, ICreditAccountsService, ICreditConfiguratorContract, ICreditFacadeContract, ICreditManagerContract, IERC20ZapperContract, IETHZapperContract, IInterestRateModelContract, type ILogger, IOnchainSDKPlugin, IOnchainSDKPluginConstructor, IPluginState, IPoolContract, IPoolsService, IPriceFeedContract, IPriceOracleContract, type IPriceUpdateTx, IRWAFactory, IRateKeeperContract, IRedemptionLoggerContract, IRouterContract, IUpdatablePriceFeedContract, IWithdrawalCompressorContract, IZapperContract, type IntentPreviewResult, type InterestRateModelStateHuman, InterestRateModelType, InvalidDelayedIntentError, IsDustOptions, IsStrategyCollateralProps, LEVERAGE_DECIMALS, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LPMonopolizedPoolMeta, type LPPriceFeedStateHuman, LatestUpdate, LinearInterestRateModelContract, type LinearInterestRateModelStateHuman, LiquidationFees, LiquidationsService, ListPoolPositionsProps, ListPositionsProps, ListPositionsPropsBase, ListStrategyPositionsProps, LoadRWALiquidatorsProps, type LogFn, type LossPolicyStateHuman, MAX_INT, MAX_LEVERAGE_BUFFER_BPS, MAX_UINT16, MAX_UINT256, MIN_INT96, MULTICALL_ADDRESS, MarketData, MarketFilter, MarketRegister, MarketRegistryState, MarketRegistryStateHuman, type MarketStateHuman, MarketSuite, MarketType, MellowLRTPriceFeedContract, Methods, MidasLiquidatorContract, MissingSerializedParamsError, type MultiCall, MulticallBatch, MulticallWithFailure, MultichainAttachOptions, type MultichainChainIdsProps, MultichainConstruct, MultichainHydrateOptions, MultichainLiquidationsService, type MultichainNetworkProps, MultichainOpportunitiesService, MultichainPositionsService, MultichainSDK, MultichainSDKOptions, type MultichainState, type MultichainStateHuman, MultichainSyncStateOptions, NATIVE_ADDRESS, NON_STRATEGY_PHANTOM_TOKEN_TYPES, NOT_DEPLOYED, NO_VERSION, NetworkType, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, OnchainRequestableWithdrawal, OnchainSDK, OnchainSDKOptions, OpenCAProps, OpenStrategyResult, OpportunitiesService, OptimalRepaidAmountProps, PARTIAL_LIQUIDATION_BUFFER_BPS, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PERCENTAGE_FACTOR_1KK, PERIPHERY_CONTRACTS, PHANTOM_TOKEN_CONTRACT_TYPES, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, PRICE_DECIMALS, PRICE_DECIMALS_POW, ParsedCall, ParsedCallArgs, ParsedCallV2, ParsedZapperDeposit, ParsedZapperOperation, ParsedZapperRedeem, PartialLiquidationParams, PartialPriceFeedInitError, PartialPriceFeedTreeNode, PartialRecord, PartiallyLiquidateProps, PendingWithdrawal, PendleTWAPPTPriceFeed, PeripheryCompressorV310Contract, PeripheryContract, PermitResult, PhantomTokenContractType, PhantomTokenMeta, PickSomeRequired, PlaceholderAdapterContract, PlaceholderAdapterContractOptions, PlaceholderContract, PluginFactoriesMap, PluginFactory, PluginState, PluginStateVersionError, PluginStatesMap, PluginsMap, PoolQuotaKeeperContract, type PoolQuotaKeeperStateHuman, PoolService, PoolServiceCall, PoolServiceCallResult, PoolState, type PoolStateHuman, PoolSuite, type PoolSuiteStateHuman, PoolV310Contract, PositionsService, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, PriceFeedAnswer, PriceFeedConstructorArgs, PriceFeedContractType, PriceFeedMapEntry, PriceFeedRef, PriceFeedRegister, PriceFeedRegisterHooks, PriceFeedRegisterOptions, type PriceFeedStateHuman, PriceFeedTreeNode, PriceFeedUsageType, PriceFeedsForAccountOptions, PriceFeedsForTokensOptions, PriceOracleData, type PriceOracleStateHuman, PriceOracleV310Contract, PriceUpdate, PythPriceFeed, QuotaKeeperState, type QuotaParamsHuman, QuotaState, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, RWACompressorCall, RWACompressorInvestorData, RWACompressorResponse, RWADefaultTokenMeta, RWAFactoryData, RWAFactoryStateHuman, RWAFactoryType, RWAInvestorData, RWALiquidatorInfo, RWAMissingOpenAccountRequirements, RWAOnDemandLPMeta, RWAOnDemandLPMonopolizedMeta, RWAOnDemandLpContractType, RWAOnDemandTokenMeta, RWAOpenAccountRequirements, RWAOperationArgs, RWARegistry, RWAState, RWAStateHuman, RWATokenMeta, RWAUnderlyingContractType, RWAUnderlyingData, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND, RampEvent, RateKeeperState, type RateKeeperStateHuman, RateKeeperType, type RawTx, RedemptionLog, RedemptionLoggerV310Contract, RedstonePriceFeedContract, type RedstonePriceFeedStateHuman, RelaxedBaseParams, RemoveLiquidityProps, RequestableWithdrawal, RetryOptions, RewardInfo, Rewards, RouterCASlice, RouterCMSlice, RouterCloseResult, RouterResult, RouterRewardsResult, RouterV310Contract, SDKConstruct, SDKOptions, SECONDS_PER_YEAR, SECURITIZE_REGISTER_VAULT_TYPES, SLIPPAGE_DECIMALS, STATE_VERSION, SUPPORTED_NETWORKS, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeCreditAccountData, SecuritizeInvestorData, SecuritizeLiquidatorContract, SecuritizeMissingOpenAccountRequirements, SecuritizeOpenAccountRequirements, SecuritizeOperationArgs, SecuritizeRWAFactory, SecuritizeRWAFactoryStateHuman, SecuritizeRegisterMessage, SecuritizeRegisterVaultMessage, SecuritizeSignature, SendRawTxParameters, SetBotProps, SetBotResult, SimpleTokenMeta, SimulateCallOptions, SimulateCallParameters, SimulateCallReturnType, SimulateMulticallParameters, SimulateMulticallReturnType, SimulateWithPriceUpdatesError, SimulateWithPriceUpdatesErrorParams, SimulateWithPriceUpdatesErrorType, SimulateWithPriceUpdatesParameters, SimulateWithPriceUpdatesReturnType, SimulationError, SimulationErrorType, StrategyRef, SunsetStrategy, SupportedValue, SwapOperation, SyncStateOptions, type TimestampedCalldata, TokenInfo, TokenMetaData, TokensMeta, TokensMetaState, type TumblerStateHuman, TypedObjectUtils, Unarray, UnsupportedZapperFunctionError, UpdatePriceFeedsResult, VERSION_RANGE_310, VersionRange, VotingContractStatus, WAD, WAD_DECIMALS_POW, WatchBlocksAsyncParameters, WatchBlocksAsyncReturnType, type WithBlock, type WithMultichain, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalMetadata, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, WstETHPriceFeedContract, YearnPriceFeedContract, ZapperContract, ZapperData, type ZapperStateHuman, ZeroPriceFeedContract, ZodAddress, ZodBigInt, ZodHex, accountSnapshotFromCreditAccountData, assetsMap, attachOptionsSchema, botPermissionsToString, bytes32ToString, calcAdditionalBorrowApy, calcBorrowApy, calcBorrowRate, calcHealthFactor, calcLiquidationPrice, calcLiquidationPriceForTarget, calcMaxLeverage, calcPositionLeverage, calcTimeToLiquidationMs, calcUtilization, chains, childLogger, createAdapter, createAddressProvider, createPriceOracle, createRawTx, createRedemptionLogger, createRouter, createWithdrawalCompressor, createZapper, decodeDelayedIntent, detectNetwork, dominantCollateral, encodeDelayedIntent, estimateRawTxGas, etherscanApiUrl, etherscanUrl, executeDelegatedMulticalls, executeMulticallBatches, expectedBalanceDeltas, fetchRedstonePayloads, filterDust, filterDustUSD, findCuratorMarketConfigurator, fmtBinaryMask, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, generateCastTraceCall, getAssetType, getCastTraceArgs, getChain, getCuratorName, getFunctionSignature, getNetworkType, getRawPriceUpdates, getSimulateWithPriceUpdatesError, getWithdrawalCompressorAddress, halfRAY, healthFactorBps, hexEq, hydrateAddressProvider, iCreditAccountAbi, isDust, isLPPriceFeed, isPublicNetwork, isRWAFactory, isRWAToken, isStrategyCollateral, isSunsetPool, isSunsetStrategy, isSupportedNetwork, isUpdatablePriceFeed, isV310, isVersionRange, json_parse, json_stringify, minSeizedAmount, mustGetDominantCollateral, numberWithCommas, onchainSDKOptionsSchema, optimalHFForPartialLiquidation, optimalRepaidAmount, percentFmt, primaryInstantOutput, rayToBps, rayToNumber, retry, sendRawTx, shortAddress, shortHash, simulateCall, simulateMulticall, simulateWithPriceUpdates, toAddress, toBN, toBigInt, toChainIds, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal, toSignificant, toWithdrawalStatus, usdToNumber, watchBlocksAsync };
|
|
@@ -92,6 +92,10 @@ declare abstract class PriceOracleBaseContract<abi extends Abi | readonly unknow
|
|
|
92
92
|
* {@inheritDoc IPriceOracleContract.convertFromUSD}
|
|
93
93
|
**/
|
|
94
94
|
convertFromUSD(to: Address, amount: bigint, reserve?: boolean): bigint;
|
|
95
|
+
/**
|
|
96
|
+
* {@inheritDoc IPriceOracleContract.safeConvertToUSD}
|
|
97
|
+
**/
|
|
98
|
+
safeConvertToUSD(token: Address, amount: bigint): bigint | null;
|
|
95
99
|
/**
|
|
96
100
|
* {@inheritDoc IPriceOracleContract.safeUsdValue}
|
|
97
101
|
**/
|
|
@@ -134,6 +134,14 @@ interface IPriceOracleContract extends IBaseContract {
|
|
|
134
134
|
* @param reserve - Use reserve feeds instead of main.
|
|
135
135
|
**/
|
|
136
136
|
convertToUSD: (from: Address, amount: bigint, reserve?: boolean) => bigint;
|
|
137
|
+
/**
|
|
138
|
+
* Like {@link convertToUSD}, but returns `null` instead of throwing when
|
|
139
|
+
* the token cannot be priced (missing or unsuccessful feed).
|
|
140
|
+
*
|
|
141
|
+
* @param token - Token address.
|
|
142
|
+
* @param amount - Amount in token decimals.
|
|
143
|
+
**/
|
|
144
|
+
safeConvertToUSD: (token: Address, amount: bigint) => bigint | null;
|
|
137
145
|
/**
|
|
138
146
|
* Converts a USD amount to a token amount using latest known prices.
|
|
139
147
|
* @param to - Token address.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Bps } from "../../model/primitives.js";
|
|
2
|
+
import { BorrowRateBreakdown, Position, StrategyPosition } from "../../model/positions.js";
|
|
2
3
|
import "../../model/index.js";
|
|
3
|
-
import { ListPositionsProps } from "./types.js";
|
|
4
|
+
import { AccountSnapshot, ListPositionsProps, ListStrategyPositionsProps } from "./types.js";
|
|
4
5
|
import { SDKConstruct } from "../base/SDKConstruct.js";
|
|
5
6
|
import "../base/index.js";
|
|
6
7
|
//#region src/sdk/positions/PositionsService.d.ts
|
|
@@ -10,6 +11,7 @@ import "../base/index.js";
|
|
|
10
11
|
* took over by liquidating.
|
|
11
12
|
**/
|
|
12
13
|
declare class PositionsService extends SDKConstruct {
|
|
14
|
+
#private;
|
|
13
15
|
/**
|
|
14
16
|
* Every position of a wallet on this chain, optionally narrowed by
|
|
15
17
|
* {@link PositionFilter} (see {@link matchesPositionFilter} for what each
|
|
@@ -17,6 +19,33 @@ declare class PositionsService extends SDKConstruct {
|
|
|
17
19
|
* the call rather than the SDK's loaded snapshot.
|
|
18
20
|
**/
|
|
19
21
|
list(props: ListPositionsProps): Promise<Position[]>;
|
|
22
|
+
/**
|
|
23
|
+
* Describes all credit accounts of a wallet as strategy positions.
|
|
24
|
+
*
|
|
25
|
+
* @param props - {@link ListStrategyPositionsProps}
|
|
26
|
+
**/
|
|
27
|
+
listStrategyPositions(props: ListStrategyPositionsProps): Promise<StrategyPosition[]>;
|
|
28
|
+
/**
|
|
29
|
+
* Health factor of an account state, in basis points (`10000` = 1.0).
|
|
30
|
+
**/
|
|
31
|
+
healthFactor(snapshot: AccountSnapshot): Bps;
|
|
32
|
+
/**
|
|
33
|
+
* Cost of an account state's debt, broken down into the pool's base rate
|
|
34
|
+
* and per-token quota rates.
|
|
35
|
+
**/
|
|
36
|
+
borrowRate(snapshot: AccountSnapshot): BorrowRateBreakdown;
|
|
37
|
+
/**
|
|
38
|
+
* Estimated milliseconds until the account's health factor decays to
|
|
39
|
+
* `10000` under its current borrow rate, or `null` when the debt carries
|
|
40
|
+
* no rate (or the account is already liquidatable).
|
|
41
|
+
**/
|
|
42
|
+
timeToLiquidation(snapshot: AccountSnapshot): bigint | null;
|
|
43
|
+
/**
|
|
44
|
+
* Price of the single non-underlying collateral at which the account
|
|
45
|
+
* becomes liquidatable, or `null` when the account holds zero or several
|
|
46
|
+
* non-underlying assets.
|
|
47
|
+
**/
|
|
48
|
+
liquidationPrice(snapshot: AccountSnapshot): bigint | null;
|
|
20
49
|
}
|
|
21
50
|
//#endregion
|
|
22
51
|
export { PositionsService };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Bps } from "../../model/primitives.js";
|
|
2
|
+
import { BorrowRateBreakdown } from "../../model/positions.js";
|
|
3
|
+
import "../../model/index.js";
|
|
4
|
+
import { AccountSnapshot } from "./types.js";
|
|
5
|
+
import { Address } from "viem";
|
|
6
|
+
//#region src/sdk/positions/calcBorrowRate.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Inputs of {@link calcBorrowRate}.
|
|
9
|
+
**/
|
|
10
|
+
interface CalcBorrowRateProps {
|
|
11
|
+
snapshot: AccountSnapshot;
|
|
12
|
+
/**
|
|
13
|
+
* Pool base interest rate in ray.
|
|
14
|
+
**/
|
|
15
|
+
baseInterestRate: bigint;
|
|
16
|
+
/**
|
|
17
|
+
* Credit manager interest fee in basis points.
|
|
18
|
+
**/
|
|
19
|
+
feeInterest: number;
|
|
20
|
+
/**
|
|
21
|
+
* Active quota rates in basis points. Missing keys are treated as inactive
|
|
22
|
+
* (zero contribution), but a per-token entry is still reported.
|
|
23
|
+
**/
|
|
24
|
+
quotaRates: Record<Address, Bps>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Cost of an account state's debt, broken down into the pool's base rate and
|
|
28
|
+
* per-token quota rates.
|
|
29
|
+
*
|
|
30
|
+
* The base rate is the market's current borrow APY (the pool's base rate plus
|
|
31
|
+
* the credit manager's interest fee) — the same value `borrowApy` reports on
|
|
32
|
+
* a position; it is not recomputed for the projected pool liquidity. Quota
|
|
33
|
+
* contributions are `quotaBalance * quotaRate` with the interest fee on top,
|
|
34
|
+
* normalized against the total value (`total`, `quotas`) and against the
|
|
35
|
+
* debt (`totalOnDebt`, the rate the debt itself grows at). Formulas are in
|
|
36
|
+
* parity with the frontend's `BorrowRateUtils`.
|
|
37
|
+
**/
|
|
38
|
+
declare function calcBorrowRate(props: CalcBorrowRateProps): BorrowRateBreakdown;
|
|
39
|
+
//#endregion
|
|
40
|
+
export { CalcBorrowRateProps, calcBorrowRate };
|