@aegis-engine/core 0.3.0 → 0.4.0
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/aegis-core.js +3053 -2880
- package/dist/engine/index.d.ts +1 -0
- package/dist/engine/positionAmounts.d.ts +37 -0
- package/dist/engine/quotes.d.ts +2 -1
- package/dist/engine/reads.d.ts +2 -0
- package/dist/engine/types.d.ts +13 -4
- package/dist/sdkRuntime-Dqr9JFXP.js +17959 -0
- package/package.json +2 -2
- package/dist/sdkRuntime-CCRVvSwD.js +0 -16052
package/dist/engine/index.d.ts
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** Conservative cap to size a withdrawal preview against. */
|
|
2
|
+
export declare function enginePreviewMaxLtvPips(marketMaxLtvPips: number): number;
|
|
3
|
+
export type AegisEngineIdleWithdrawSide = 'token0' | 'token1';
|
|
4
|
+
export type AegisEngineIdleWithdrawAmountInput = {
|
|
5
|
+
/** Same-frame live idle token amounts. */
|
|
6
|
+
idle0: bigint;
|
|
7
|
+
idle1: bigint;
|
|
8
|
+
/**
|
|
9
|
+
* Same-frame accrued debt in L units, rounded up by position hydration.
|
|
10
|
+
* Using the rounded-up value makes this preview no less conservative than
|
|
11
|
+
* the Engine's exact rL × borrow-index residual check.
|
|
12
|
+
*/
|
|
13
|
+
debtLLatest: bigint;
|
|
14
|
+
maxLtvPips: number;
|
|
15
|
+
side: AegisEngineIdleWithdrawSide;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Mirrors the idle-only residual-LTV inequality used by the Engine lifecycle
|
|
19
|
+
* quote. Engine idle balances are int128-packed, so their product fits uint256
|
|
20
|
+
* and `floor(sqrt(idle0 × idle1)) >= requiredFloor` is exactly equivalent to
|
|
21
|
+
* `idle0 × idle1 >= requiredFloor²`.
|
|
22
|
+
*/
|
|
23
|
+
export declare function engineIdleWithdrawPassesResidualLtv(input: AegisEngineIdleWithdrawAmountInput): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Maximum independently withdrawable idle amount for one selected token.
|
|
26
|
+
* The opposite token remains untouched. This is a conservative preview; the
|
|
27
|
+
* exact amount is always re-quoted from a fresh block before submission.
|
|
28
|
+
*/
|
|
29
|
+
export declare function computeEngineMaxIdleWithdraw(input: AegisEngineIdleWithdrawAmountInput): bigint;
|
|
30
|
+
/**
|
|
31
|
+
* Projected idle-only LTV after one exact withdrawal. Returns null for a
|
|
32
|
+
* debt-free vault or an invalid/zero-collateral post-state. The exact action
|
|
33
|
+
* remains quote-driven; this is display math over the same hydrated frame.
|
|
34
|
+
*/
|
|
35
|
+
export declare function computeEngineIdleWithdrawPostLtvPips(input: AegisEngineIdleWithdrawAmountInput & {
|
|
36
|
+
withdrawAmount: bigint;
|
|
37
|
+
}): number | null;
|
package/dist/engine/quotes.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { AegisEngineBorrowCapacity, AegisEngineBorrowCapacityInput, AegisEngineBorrowQuote, AegisEngineBorrowQuoteInput, AegisEngineCloseQuoteInput, AegisEngineDepositQuote, AegisEngineDepositQuoteInput, AegisEngineIdleWithdrawQuoteInput, AegisEnginePositionActionQuote, AegisEngineRedeemQuoteInput, AegisEngineRepayQuoteInput } from './types.js';
|
|
1
|
+
import type { AegisEngineBorrowCapacity, AegisEngineBorrowCapacityInput, AegisEngineBorrowQuote, AegisEngineBorrowQuoteInput, AegisEngineAddCollateralQuoteInput, AegisEngineCloseQuoteInput, AegisEngineDepositQuote, AegisEngineDepositQuoteInput, AegisEngineIdleWithdrawQuoteInput, AegisEnginePositionActionQuote, AegisEngineRedeemQuoteInput, AegisEngineRepayQuoteInput } from './types.js';
|
|
2
2
|
export declare function quoteEngineDeposit(input: AegisEngineDepositQuoteInput): Promise<AegisEngineDepositQuote>;
|
|
3
3
|
export declare function quoteEngineBorrow(input: AegisEngineBorrowQuoteInput): Promise<AegisEngineBorrowQuote>;
|
|
4
|
+
export declare function quoteEngineAddCollateral(input: AegisEngineAddCollateralQuoteInput): Promise<AegisEnginePositionActionQuote>;
|
|
4
5
|
export declare function quoteEngineBorrowCapacity(input: AegisEngineBorrowCapacityInput): Promise<AegisEngineBorrowCapacity>;
|
|
5
6
|
export declare function quoteEngineRepay(input: AegisEngineRepayQuoteInput): Promise<AegisEnginePositionActionQuote>;
|
|
6
7
|
export declare function quoteEngineCloseVault(input: AegisEngineCloseQuoteInput): Promise<AegisEnginePositionActionQuote>;
|
package/dist/engine/reads.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ export declare function readEngineMarketSnapshot(input: AegisEngineMarketReadInp
|
|
|
9
9
|
export declare function readEngineBorrowQuoteContext(input: AegisEngineMarketReadInput, execution?: {
|
|
10
10
|
owner: Address;
|
|
11
11
|
vaultId?: bigint;
|
|
12
|
+
}, options?: {
|
|
13
|
+
forceRefresh?: boolean;
|
|
12
14
|
}): Promise<AegisEngineBorrowQuoteContext>;
|
|
13
15
|
/**
|
|
14
16
|
* Hydrates REST/subgraph-discovered borrow and lender positions in one
|
package/dist/engine/types.d.ts
CHANGED
|
@@ -430,7 +430,7 @@ export type AegisEngineReadFrame = {
|
|
|
430
430
|
/** Local wall-clock time when the frame was assembled, in Unix milliseconds. */
|
|
431
431
|
observedAt: number;
|
|
432
432
|
};
|
|
433
|
-
export type AegisEngineVersion = 'v0.4.0' | 'v1.0.2';
|
|
433
|
+
export type AegisEngineVersion = 'v0.4.0' | 'v1.0.2' | 'v1.0.3';
|
|
434
434
|
export type AegisEngineBorrowMarketContext = {
|
|
435
435
|
poolId: Hex;
|
|
436
436
|
poolKey: AegisEngineMarket['poolKey'];
|
|
@@ -681,7 +681,7 @@ export type AegisEngineBorrowQuote = {
|
|
|
681
681
|
costProjection: AegisEngineBorrowCostProjection;
|
|
682
682
|
tx: AegisEnginePreparedTransaction | null;
|
|
683
683
|
};
|
|
684
|
-
export type AegisEnginePositionActionKind = 'repay' | 'close' | 'withdraw' | 'redeem';
|
|
684
|
+
export type AegisEnginePositionActionKind = 'add-collateral' | 'repay' | 'close' | 'withdraw' | 'redeem';
|
|
685
685
|
export type AegisEngineBorrowPositionTarget = {
|
|
686
686
|
kind: 'borrow_vault';
|
|
687
687
|
positionId: string;
|
|
@@ -749,8 +749,9 @@ export type AegisEnginePositionActionQuote = {
|
|
|
749
749
|
shareBalance: bigint | null;
|
|
750
750
|
postShareBalance: bigint | null;
|
|
751
751
|
/**
|
|
752
|
-
* Live, block-pinned lend exit
|
|
753
|
-
* requested with `shares: "available"`.
|
|
752
|
+
* Live, block-pinned lend exit amount. Present only for redeem quotes
|
|
753
|
+
* requested with `shares: "available"`. An authorization-gated amount is
|
|
754
|
+
* re-quoted against the SDK's synchronized Router preflight after approval.
|
|
754
755
|
*/
|
|
755
756
|
redeemAvailability?: {
|
|
756
757
|
/** Whether the live frame can return the whole position or only part. */
|
|
@@ -780,6 +781,14 @@ export type AegisEngineRepayQuoteInput = AegisEnginePositionActionQuoteBase & {
|
|
|
780
781
|
repayRl?: bigint | 'full';
|
|
781
782
|
slippageBps: number;
|
|
782
783
|
};
|
|
784
|
+
export type AegisEngineAddCollateralQuoteInput = AegisEngineQuoteBase & {
|
|
785
|
+
target: AegisEngineBorrowPositionTarget;
|
|
786
|
+
/** Live existing-vault state. Add collateral never opens a fresh vault. */
|
|
787
|
+
vault: AegisEngineBorrowVaultContext;
|
|
788
|
+
collateralIn: bigint;
|
|
789
|
+
/** Bypass the short read cache after an authorization transaction lands. */
|
|
790
|
+
forceExecutionEvidenceRefresh?: boolean;
|
|
791
|
+
};
|
|
783
792
|
export type AegisEngineCloseQuoteInput = AegisEnginePositionActionQuoteBase & {
|
|
784
793
|
target: AegisEngineBorrowPositionTarget;
|
|
785
794
|
};
|