@aegis-engine/core 0.6.0 → 0.7.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/README.md CHANGED
@@ -582,3 +582,20 @@ concurrent package publishes from rebuilding shared workspace artifacts.
582
582
  pnpm build
583
583
  pnpm pack:check
584
584
  ```
585
+
586
+ ## Borrow collateral sizing
587
+
588
+ `quoteEngineBorrowCapacity` reports `collateralFloor` as a settled result:
589
+ `not-requested`, `ready-positive`, `ready-zero`, `infeasible`, or `unavailable`.
590
+ Unavailable results include a reason and whether a fresh read may help. A null
591
+ closed-form result is terminal for that request; it does not mean the request is
592
+ still running. Zero means no additional collateral is needed at the sizing
593
+ inputs; it is not permission to submit a new borrow. Its `outputSource`
594
+ distinguishes existing idle tokens from new debt or an unknown legacy result.
595
+ Only confirmed idle output supports a withdrawal review through the normal
596
+ protected quote and authorization flow.
597
+ `minimumNoSwapCollateralIn` remains available for compatibility, and
598
+ `resolveEngineBorrowCollateralFloor` adapts older capacity snapshots.
599
+
600
+ The result's `frame` identifies the market read used for sizing. Caller-supplied
601
+ vault inputs and any executable transaction still require fresh validation.
@@ -46,6 +46,8 @@ export declare function executeDirectPoolSwap(args: {
46
46
  slippageBps: number;
47
47
  displayedQuote?: DirectSwapQuote | null;
48
48
  approvalMode?: AegisSwapApprovalMode;
49
+ /** Finite cap for the next token and Permit2 approvals. Must cover the reviewed spend. */
50
+ approvalAmount?: bigint;
49
51
  signal?: AbortSignal;
50
52
  onWalletChainId?: (chainId: number | null) => void;
51
53
  } & AegisSwapActionCallbacks): Promise<AegisSwapActionResult<DirectSwapQuote>>;
@@ -23,6 +23,7 @@ export declare function approveKyberSwapInput(args: {
23
23
  amount: bigint;
24
24
  approvalMode?: AegisSwapApprovalMode;
25
25
  onStatus?: AegisSwapActionCallbacks['onStatus'];
26
+ onApprovalProgress?: AegisSwapActionCallbacks['onApprovalProgress'];
26
27
  }): Promise<KyberSwapApprovalResult>;
27
28
  export declare function executeKyberSwap(args: {
28
29
  wallet: WalletSession;
@@ -26,6 +26,8 @@ export type AegisSwapApprovalRequest = {
26
26
  * adds a second prompt, and only it sees that reset's receipt.
27
27
  */
28
28
  export type AegisSwapApprovalProgress = {
29
+ /** Broadcast approval awaiting its receipt; absent before signing and after settlement. */
30
+ pendingHash?: Hex;
29
31
  /** Prompts the approval step opens: 0, 1, or 2 when a zero-reset precedes it. */
30
32
  planned: number;
31
33
  /** How many of `planned` have landed on-chain. */
@@ -40,6 +42,8 @@ export type AegisSwapApprovalProgress = {
40
42
  * signatures fail closed, so this is a count rather than a boolean.
41
43
  */
42
44
  export type AegisSwapAuthorizationProgress = {
45
+ /** On-chain Permit2 fallback awaiting its receipt; signatures have no hash. */
46
+ pendingHash?: Hex;
43
47
  /** Prompts this authorization step will open from the executor's live state. */
44
48
  planned: number;
45
49
  /** Prompts already completed by the wallet/user. */
@@ -50,15 +54,16 @@ export type AegisSwapActionCallbacks<TSwapDetails = AegisSwapSubmitDetails> = {
50
54
  onTxHash?: (hash: Hex | null) => void;
51
55
  onSubmitted?: (hash: Hex, swap?: TSwapDetails) => void;
52
56
  /**
53
- * Fires with the plan before the first approval prompt opens, then again
54
- * after each approval transaction mines. Once allowance resolution is
57
+ * Fires with the plan before the first approval prompt opens, when each
58
+ * approval is broadcast, and after it mines. Once allowance resolution is
55
59
  * reached, no required approval reports `{ planned: 0, completed: 0 }`.
56
60
  * Earlier chain-validation or quote failures can stop before this callback.
57
61
  */
58
62
  onApprovalProgress?: (progress: AegisSwapApprovalProgress) => void;
59
63
  /**
60
64
  * Fires before the first Permit2 authorization prompt, whenever the plan
61
- * changes, and after each completed prompt. A reusable standing cap reports
65
+ * changes, when an on-chain fallback is broadcast, and after each completed
66
+ * prompt. A reusable standing cap reports
62
67
  * `{ planned: 0, completed: 0 }`.
63
68
  */
64
69
  onAuthorizationProgress?: (progress: AegisSwapAuthorizationProgress) => void;
@@ -1,10 +1,10 @@
1
- import { A as s, b as i, c as r, d as t, e as n, f as o, g as c, h as E, i as S, j as A, k as g, l as d, m as _, n as l, o as p, p as b, q as P, r as T, t as u, u as h, v as m, w as k, x as I, y as R, z as C, B as w, C as G, D as B, E as D, F as N, G as M, H as y, K as v, I as W, J as U, M as O, L as F, N as L, O as f, P as K, S as H, Q as V, T as x, U as Q, R as q, V as z, W as X, X as Y, Y as j, Z, _ as J, $, a0 as aa, a1 as ea, a2 as sa, a3 as ia, a4 as ra, a5 as ta, a6 as na, a7 as oa, a8 as ca, a9 as Ea, aa as Sa, ab as Aa, ac as ga, ad as da, ae as _a, af as la, ag as pa, ah as ba, ai as Pa, aj as Ta, ak as ua, al as ha, am as ma, an as ka, ao as Ia, ap as Ra, aq as Ca, ar as wa, as as Ga, at as Ba, au as Da, av as Na, aw as Ma, ax as ya, ay as va, az as Wa, aA as Ua, aB as Oa, aC as Fa, aD as La, aE as fa, aF as Ka, aG as Ha, aH as Va, aI as xa, aJ as Qa, aK as qa, aL as za, aM as Xa, aN as Ya, aO as ja, aP as Za, aQ as Ja, aR as $a, aS as ae, aT as ee, aU as se, aV as ie, aW as re, aX as te, aY as ne, aZ as oe, a_ as ce, a$ as Ee, b0 as Se, b1 as Ae, b2 as ge, b3 as de, b4 as _e, b5 as le, b6 as pe, b7 as be, b8 as Pe, b9 as Te, ba as ue, bb as he, bc as me, bd as ke, be as Ie, bf as Re, bg as Ce, bh as we, bi as Ge, bj as Be, bk as De, bl as Ne, bm as Me, bn as ye, bo as ve, bp as We, bq as Ue, br as Oe, bs as Fe, bt as Le, bu as fe, bv as Ke, bw as He, bx as Ve, by as xe, bz as Qe, bA as qe, bB as ze, bC as Xe, bD as Ye, bE as je, bF as Ze, bG as Je, bH as $e, bI as as, bJ as es, bK as ss, bL as is, bM as rs, bN as ts, bO as ns, bP as os, bQ as cs, bR as Es, bS as Ss, bT as As, bU as gs, bV as ds, bW as _s, bX as ls, bY as ps, bZ as bs, b_ as Ps, b$ as Ts, c0 as us, c1 as hs, c2 as ms, c3 as ks, c4 as Is, c5 as Rs, c6 as Cs, c7 as ws, c8 as Gs, c9 as Bs, ca as Ds, cb as Ns, cc as Ms, cd as ys, ce as vs, cf as Ws, cg as Us, ch as Os, ci as Fs, cj as Ls } from "./index-D9EfUokZ.js";
1
+ import { A as s, b as i, c as r, d as n, e as t, f as o, g as c, h as E, i as S, j as A, k as g, l as d, m as l, n as _, o as p, p as b, q as P, r as T, t as u, u as h, v as m, w as k, x as R, y as I, z as C, B as w, C as G, D as B, E as D, F as N, G as M, H as v, K as y, I as W, J as U, M as O, L as F, N as L, O as f, P as K, S as H, Q as V, T as q, U as x, R as Q, V as z, W as X, X as Y, Y as j, Z, _ as J, $, a0 as aa, a1 as ea, a2 as sa, a3 as ia, a4 as ra, a5 as na, a6 as ta, a7 as oa, a8 as ca, a9 as Ea, aa as Sa, ab as Aa, ac as ga, ad as da, ae as la, af as _a, ag as pa, ah as ba, ai as Pa, aj as Ta, ak as ua, al as ha, am as ma, an as ka, ao as Ra, ap as Ia, aq as Ca, ar as wa, as as Ga, at as Ba, au as Da, av as Na, aw as Ma, ax as va, ay as ya, az as Wa, aA as Ua, aB as Oa, aC as Fa, aD as La, aE as fa, aF as Ka, aG as Ha, aH as Va, aI as qa, aJ as xa, aK as Qa, aL as za, aM as Xa, aN as Ya, aO as ja, aP as Za, aQ as Ja, aR as $a, aS as ae, aT as ee, aU as se, aV as ie, aW as re, aX as ne, aY as te, aZ as oe, a_ as ce, a$ as Ee, b0 as Se, b1 as Ae, b2 as ge, b3 as de, b4 as le, b5 as _e, b6 as pe, b7 as be, b8 as Pe, b9 as Te, ba as ue, bb as he, bc as me, bd as ke, be as Re, bf as Ie, bg as Ce, bh as we, bi as Ge, bj as Be, bk as De, bl as Ne, bm as Me, bn as ve, bo as ye, bp as We, bq as Ue, br as Oe, bs as Fe, bt as Le, bu as fe, bv as Ke, bw as He, bx as Ve, by as qe, bz as xe, bA as Qe, bB as ze, bC as Xe, bD as Ye, bE as je, bF as Ze, bG as Je, bH as $e, bI as as, bJ as es, bK as ss, bL as is, bM as rs, bN as ns, bO as ts, bP as os, bQ as cs, bR as Es, bS as Ss, bT as As, bU as gs, bV as ds, bW as ls, bX as _s, bY as ps, bZ as bs, b_ as Ps, b$ as Ts, c0 as us, c1 as hs, c2 as ms, c3 as ks, c4 as Rs, c5 as Is, c6 as Cs, c7 as ws, c8 as Gs, c9 as Bs, ca as Ds, cb as Ns, cc as Ms, cd as vs, ce as ys, cf as Ws, cg as Us, ch as Os, ci as Fs, cj as Ls, ck as fs, cl as Ks, cm as Hs, cn as Vs } from "./index-DofKgro2.js";
2
2
  export {
3
3
  s as AEGIS_BACKEND_PROD_BASE_URL,
4
4
  i as AEGIS_DYNAMIC_FEE_FLAG,
5
5
  r as AEGIS_SWAP_CHAINS,
6
- t as AEGIS_SWAP_CHAIN_ID,
7
- n as AEGIS_SWAP_DEFAULT_FEE_BPS,
6
+ n as AEGIS_SWAP_CHAIN_ID,
7
+ t as AEGIS_SWAP_DEFAULT_FEE_BPS,
8
8
  o as AEGIS_SWAP_DEFAULT_FEE_RECIPIENT,
9
9
  c as AEGIS_SWAP_DEFAULT_METADATA_ENDPOINT,
10
10
  E as AEGIS_SWAP_DEFAULT_RPC_URLS,
@@ -12,8 +12,8 @@ export {
12
12
  A as AEGIS_SWAP_MAINNET_CHAIN,
13
13
  g as AEGIS_SWAP_MAINNET_UNISWAP_V4_CONTRACTS,
14
14
  d as AEGIS_SWAP_PERMIT2,
15
- _ as AEGIS_SWAP_ROUTER,
16
- l as AEGIS_SWAP_TOKENS,
15
+ l as AEGIS_SWAP_ROUTER,
16
+ _ as AEGIS_SWAP_TOKENS,
17
17
  p as AEGIS_SWAP_TRUSTED_ROUTERS_BY_CHAIN,
18
18
  b as AEGIS_SWAP_V4_QUOTER,
19
19
  P as AGGREGATED_SWAP_CURATED_TOKENS,
@@ -22,8 +22,8 @@ export {
22
22
  h as AGGREGATED_SWAP_SUPPORTED_CHAIN_IDS,
23
23
  m as AGGREGATED_SWAP_TOKEN_PRESETS,
24
24
  k as AGGREGATED_SWAP_WOLFGAME_TOKENS,
25
- I as AGGREGATED_SWAP_WOLFGAME_TOKEN_LIST,
26
- R as AegisBackendApiError,
25
+ R as AGGREGATED_SWAP_WOLFGAME_TOKEN_LIST,
26
+ I as AegisBackendApiError,
27
27
  C as AegisBackendContractError,
28
28
  w as AegisContractGuardError,
29
29
  G as AegisEngineMarketNotReadyError,
@@ -31,8 +31,8 @@ export {
31
31
  D as AggregatedSwapCalldataError,
32
32
  N as DEFAULT_PERMIT_EXPIRATION_SECONDS,
33
33
  M as DirectPoolSwapPriceMovedError,
34
- y as ENGINE_UTILIZATION_CAP_PCT,
35
- v as KyberSwapApiError,
34
+ v as ENGINE_UTILIZATION_CAP_PCT,
35
+ y as KyberSwapApiError,
36
36
  W as KyberSwapContractError,
37
37
  U as KyberSwapPriceMovedError,
38
38
  O as MAX_UINT128,
@@ -42,9 +42,9 @@ export {
42
42
  K as PERMIT2_FAR_FUTURE_EXPIRATION,
43
43
  H as SWAP_TX_DEADLINE_SECONDS,
44
44
  V as SubmittedTransactionReceiptError,
45
- x as TransactionReceiptTimeoutError,
46
- Q as UNISWAP_V4_CONTRACTS_BY_CHAIN,
47
- q as USER_REJECTED_MESSAGE,
45
+ q as TransactionReceiptTimeoutError,
46
+ x as UNISWAP_V4_CONTRACTS_BY_CHAIN,
47
+ Q as USER_REJECTED_MESSAGE,
48
48
  z as UserFacingError,
49
49
  X as aegisBackendAddressAllowlistSchema,
50
50
  Y as aegisBackendAddressSchema,
@@ -57,8 +57,8 @@ export {
57
57
  sa as aegisBackendDecimalStringSchema,
58
58
  ia as aegisBackendFeeConfigSchema,
59
59
  ra as aegisBackendHealthResponseSchema,
60
- ta as aegisBackendHexSchema,
61
- na as aegisBackendIsoDateTimeSchema,
60
+ na as aegisBackendHexSchema,
61
+ ta as aegisBackendIsoDateTimeSchema,
62
62
  oa as aegisBackendMarketMetricsSchema,
63
63
  ca as aegisBackendMarketSchema,
64
64
  Ea as aegisBackendMarketStatusSchema,
@@ -66,8 +66,8 @@ export {
66
66
  Aa as aegisBackendQuoteDefaultsSchema,
67
67
  ga as aegisBackendQuoteModeSchema,
68
68
  da as aegisBackendSwapProviderSchema,
69
- _a as aegisBackendSwapQuoteRequestSchema,
70
- la as aegisBackendSwapQuoteResponseSchema,
69
+ la as aegisBackendSwapQuoteRequestSchema,
70
+ _a as aegisBackendSwapQuoteResponseSchema,
71
71
  pa as aegisBackendTokenSchema,
72
72
  ba as aegisBackendTokensResponseSchema,
73
73
  Pa as aegisPoolKeySchema,
@@ -76,8 +76,8 @@ export {
76
76
  ha as approveEnginePermit2ToRouter,
77
77
  ma as approveEngineTokenToPermit2,
78
78
  ka as approveErc20Spender,
79
- Ia as approveErc20ToPermit2,
80
- Ra as approveKyberSwapInput,
79
+ Ra as approveErc20ToPermit2,
80
+ Ia as approveKyberSwapInput,
81
81
  Ca as approvePermit2ToRouter,
82
82
  wa as assertCalldataHash,
83
83
  Ga as assertChainMatches,
@@ -85,8 +85,8 @@ export {
85
85
  Da as assertRouterAllowlisted,
86
86
  Na as assertSpenderAllowlisted,
87
87
  Ma as assertUint128,
88
- ya as attachEngineActivityLotDisplays,
89
- va as authorizeEnginePositionRouter,
88
+ va as attachEngineActivityLotDisplays,
89
+ ya as authorizeEnginePositionRouter,
90
90
  Wa as authorizeEngineVaultOperator,
91
91
  Ua as backendTokenToAegisSwapToken,
92
92
  Oa as backendTokensToAegisSwapTokens,
@@ -96,9 +96,9 @@ export {
96
96
  Ka as buildSignedPermitBatch,
97
97
  Ha as classifyEngineVaultActivity,
98
98
  Va as classifyError,
99
- xa as clearEngineMarketHistoryCache,
100
- Qa as clearEngineMarketsCache,
101
- qa as clearEnginePositionActivityCache,
99
+ qa as clearEngineMarketHistoryCache,
100
+ xa as clearEngineMarketsCache,
101
+ Qa as clearEnginePositionActivityCache,
102
102
  za as clearEnginePositionsCache,
103
103
  Xa as clearEnginePositionsV2ProbeCache,
104
104
  Ya as clearEngineReadCaches,
@@ -111,93 +111,97 @@ export {
111
111
  se as createAegisSwapChains,
112
112
  ie as createAegisSwapChainsFromBackendConfig,
113
113
  re as createAegisSwapMarketsFromPools,
114
- te as createAegisSwapPoolMarket,
115
- ne as createAegisSwapPoolsFromBackendMarkets,
114
+ ne as createAegisSwapPoolMarket,
115
+ te as createAegisSwapPoolsFromBackendMarkets,
116
116
  oe as createAegisSwapUniswapV4Contracts,
117
117
  ce as createSwapPublicClient,
118
118
  Ee as deriveEngineActivityLotDisplay,
119
119
  Se as deriveEngineTradePositionStrategy,
120
120
  Ae as engineIdleWithdrawPassesResidualLtv,
121
- ge as enginePermit2GrantSatisfies,
122
- de as enginePreviewMaxLtvPips,
121
+ ge as engineMarketsRestResponseSchema,
122
+ de as enginePermit2GrantSatisfies,
123
+ le as enginePreviewMaxLtvPips,
123
124
  _e as engineRouterForChain,
124
- le as engineTokenGrantSatisfies,
125
- pe as ensureWalletChain,
126
- be as errorMessage,
127
- Pe as estimateSwapGasWithBuffer,
128
- Te as executeDirectPoolSwap,
129
- ue as executeKyberSwap,
130
- he as executionLtvGuardPips,
131
- me as fetchAggregatedSwapQuote,
132
- ke as fetchDirectPoolSwapQuote,
125
+ pe as engineTokenGrantSatisfies,
126
+ be as ensureWalletChain,
127
+ Pe as errorMessage,
128
+ Te as estimateSwapGasWithBuffer,
129
+ ue as executeDirectPoolSwap,
130
+ he as executeKyberSwap,
131
+ me as executionLtvGuardPips,
132
+ ke as fetchAggregatedSwapQuote,
133
+ Re as fetchDirectPoolSwapQuote,
133
134
  Ie as fetchEngineLendActivity,
134
- Re as fetchEngineMarketHistory,
135
- Ce as fetchEngineMarkets,
136
- we as fetchEnginePositionActivitySnapshot,
137
- Ge as fetchEnginePositionsSnapshot,
138
- Be as fetchEngineVaultActivity,
139
- De as fetchGlobalTokenMetadata,
140
- Ne as fetchKyberSwapRoute,
141
- Me as fetchTokenPriceHistory,
135
+ Ce as fetchEngineMarketHistory,
136
+ we as fetchEngineMarkets,
137
+ Ge as fetchEnginePositionActivitySnapshot,
138
+ Be as fetchEnginePositionsSnapshot,
139
+ De as fetchEngineVaultActivity,
140
+ Ne as fetchGlobalTokenMetadata,
141
+ Me as fetchKyberSwapRoute,
142
+ ve as fetchTokenPriceHistory,
142
143
  ye as getExplorerUrl,
143
- ve as getInjectedProvider,
144
- We as getProviderAccount,
145
- Ue as getProviderChainId,
146
- Oe as getZeroForOne,
147
- Fe as isAegisEngineTradePositionIntent,
148
- Le as isBusy,
149
- fe as isDocumentVisible,
150
- Ke as isEip1193Provider,
151
- He as isNativeAssetAddress,
152
- Ve as isNativeToken,
144
+ We as getInjectedProvider,
145
+ Ue as getProviderAccount,
146
+ Oe as getProviderChainId,
147
+ Fe as getZeroForOne,
148
+ Le as isAegisEngineTradePositionIntent,
149
+ fe as isBusy,
150
+ Ke as isDocumentVisible,
151
+ He as isEip1193Provider,
152
+ Ve as isNativeAssetAddress,
153
+ qe as isNativeToken,
153
154
  xe as isRetryableAegisBackendApiError,
154
155
  Qe as isRetryableKyberSwapError,
155
- qe as isSubmittedTransactionReceiptError,
156
- ze as isUserRejectedError,
157
- Xe as missingEngineExecutionReason,
158
- Ye as normalizeAccount,
159
- je as normalizeAegisBackendBaseUrl,
160
- Ze as normalizeEngineMarkets,
161
- Je as normalizeWalletConnection,
162
- $e as outputFeeForQuote,
163
- as as peekTokenPriceHistory,
164
- es as pollUntil,
165
- ss as prepareEnginePermit,
166
- is as quoteEngineAddCollateral,
167
- rs as quoteEngineBorrow,
168
- ts as quoteEngineBorrowCapacity,
169
- ns as quoteEngineCloseVault,
170
- os as quoteEngineDeposit,
171
- cs as quoteEngineIdleWithdraw,
172
- Es as quoteEngineRedeem,
173
- Ss as quoteEngineRepay,
174
- As as quoteEngineTradeOpen,
175
- gs as quoteSpendAmount,
176
- ds as readEngineAuthorizationPlan,
177
- _s as readEngineBorrowQuoteContext,
178
- ls as readEngineLendQuoteContext,
179
- ps as readEngineMarketMark,
180
- bs as readEngineMarketSnapshot,
181
- Ps as readEnginePositionsHydration,
182
- Ts as readEngineVaultActivity,
183
- us as readEngineVaultRouterApproved,
184
- hs as readErc20Allowance,
185
- ms as readPermit2RouterAllowance,
186
- ks as reconcileSubmitQuote,
187
- Is as reconcileSubmittedReceipt,
188
- Rs as requestProviderAccount,
189
- Cs as resolveTokenIconUrl,
190
- ws as resolveWalletSession,
191
- Gs as retryOnError,
192
- Bs as sameQuote,
193
- Ds as sendEngineTransaction,
194
- Ns as subscribeProvider,
195
- Ms as summarizeEngineLendShareGrowth,
196
- ys as summarizeEngineSimpleYieldPosition,
197
- vs as summarizeTransactionReceipt,
198
- Ws as switchProviderChain,
199
- Us as transactionProgressView,
200
- Os as trustedEngineRegistryForChain,
201
- Fs as trustedEngineVersionForChain,
202
- Ls as waitForProviderChain
156
+ ze as isSubmittedTransactionReceiptError,
157
+ Xe as isUserRejectedError,
158
+ Ye as missingEngineExecutionReason,
159
+ je as normalizeAccount,
160
+ Ze as normalizeAegisBackendBaseUrl,
161
+ Je as normalizeEngineMarkets,
162
+ $e as normalizeWalletConnection,
163
+ as as outputFeeForQuote,
164
+ es as peekTokenPriceHistory,
165
+ ss as pollUntil,
166
+ is as prepareEnginePermit,
167
+ rs as progressRailSteps,
168
+ ns as quoteEngineAddCollateral,
169
+ ts as quoteEngineBorrow,
170
+ os as quoteEngineBorrowCapacity,
171
+ cs as quoteEngineCloseVault,
172
+ Es as quoteEngineDeposit,
173
+ Ss as quoteEngineIdleWithdraw,
174
+ As as quoteEngineRedeem,
175
+ gs as quoteEngineRepay,
176
+ ds as quoteEngineTradeOpen,
177
+ ls as quoteSpendAmount,
178
+ _s as readEngineAuthorizationPlan,
179
+ ps as readEngineBorrowQuoteContext,
180
+ bs as readEngineLendQuoteContext,
181
+ Ps as readEngineMarketMark,
182
+ Ts as readEngineMarketSnapshot,
183
+ us as readEnginePositionsHydration,
184
+ hs as readEngineVaultActivity,
185
+ ms as readEngineVaultRouterApproved,
186
+ ks as readErc20Allowance,
187
+ Rs as readPermit2RouterAllowance,
188
+ Is as reconcileSubmitQuote,
189
+ Cs as reconcileSubmittedReceipt,
190
+ ws as requestProviderAccount,
191
+ Gs as resolveEngineBorrowCollateralFloor,
192
+ Bs as resolveTokenIconUrl,
193
+ Ds as resolveWalletSession,
194
+ Ns as retryOnError,
195
+ Ms as sameQuote,
196
+ vs as sendEngineTransaction,
197
+ ys as subscribeProvider,
198
+ Ws as summarizeEngineLendShareGrowth,
199
+ Us as summarizeEngineSimpleYieldPosition,
200
+ Os as summarizeTransactionReceipt,
201
+ Fs as switchProviderChain,
202
+ Ls as transactionProgressView,
203
+ fs as transactionSequenceProgress,
204
+ Ks as trustedEngineRegistryForChain,
205
+ Hs as trustedEngineVersionForChain,
206
+ Vs as waitForProviderChain
203
207
  };
@@ -50,12 +50,16 @@ export type AegisEnginePositionRouterAuthorizationInput = {
50
50
  * executable quote after prerequisite receipts are mined.
51
51
  */
52
52
  export declare function readEngineAuthorizationPlan(args: AegisEngineAuthorizationPlanInput): Promise<AegisEngineAuthorizationPlan>;
53
+ /** Explicit allowance edits; transaction preparation keeps sufficient grants. */
54
+ type EngineAllowanceUpdateInput = AegisEngineApprovalInput & {
55
+ replaceAllowance?: boolean;
56
+ };
53
57
  /** Grants only the ERC-20 allowance from the token to Permit2. */
54
- export declare function approveEngineTokenToPermit2(args: AegisEngineApprovalInput): Promise<{
58
+ export declare function approveEngineTokenToPermit2(args: EngineAllowanceUpdateInput): Promise<{
55
59
  approvalHash: Hex | null;
56
60
  }>;
57
61
  /** Grants only the Permit2 spending cap from Permit2 to the Engine router. */
58
- export declare function approveEnginePermit2ToRouter(args: AegisEngineApprovalInput): Promise<void>;
62
+ export declare function approveEnginePermit2ToRouter(args: EngineAllowanceUpdateInput): Promise<void>;
59
63
  export declare function prepareEnginePermit(args: AegisEngineApprovalInput): Promise<{
60
64
  approvalHash: Hex | null;
61
65
  permit: AegisEngineSignedPermitBatch | null;
@@ -99,3 +103,4 @@ export declare function missingEngineExecutionReason(market: {
99
103
  v4StateView?: Address;
100
104
  v4Quoter?: Address;
101
105
  }): string | null;
106
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { AegisEngineBorrowCapacity, AegisEngineBorrowCollateralFloor } from './types.js';
2
+ /** Compatibility boundary for hosts holding capacity snapshots from older Core versions. */
3
+ export declare function resolveEngineBorrowCollateralFloor(capacity: AegisEngineBorrowCapacity): AegisEngineBorrowCollateralFloor;
@@ -0,0 +1,18 @@
1
+ import type { engineSdkRuntime } from './sdkRuntime.js';
2
+ type Sdk = typeof engineSdkRuntime;
3
+ type Market = Parameters<Sdk['computeBorrowCapacity']>[0]['market'];
4
+ type Vault = Parameters<Sdk['forwardFunctionNoSwap']>[0]['vault'];
5
+ /** No-swap borrowing creates LP-shaped debt. A USD collateral × LTV ratio
6
+ * overstates the delivered asset, so size against the SDK's actual forward
7
+ * path and integer utilization headroom, in the same frame as the quote. */
8
+ export declare function noSwapWalletBorrowLimit({ sdk, market, canonicalMarket, vault, deposit, upperBound, tauPips, slippageBps }: {
9
+ sdk: Pick<Sdk, 'forwardFunctionNoSwap' | 'utilizationHeadroomGammaNewLWad' | 'minDebtFloorRl'>;
10
+ market: Market;
11
+ canonicalMarket: Parameters<Sdk['forwardFunctionNoSwap']>[0]['market'];
12
+ vault: Vault;
13
+ deposit: bigint;
14
+ upperBound: bigint;
15
+ tauPips: number;
16
+ slippageBps: number;
17
+ }): bigint;
18
+ export {};
@@ -7,6 +7,7 @@ export * from './marketAdapter.js';
7
7
  export * from './registry.js';
8
8
  export * from './reads.js';
9
9
  export * from './quotes.js';
10
+ export * from './borrowCollateralFloor.js';
10
11
  export * from './actions.js';
11
12
  export * from './positionAmounts.js';
12
13
  export * from './positionStrategy.js';
@@ -456,6 +456,9 @@ export type AegisEngineRestSource = {
456
456
  */
457
457
  export type AegisEngineStaticSource = {
458
458
  kind: 'static';
459
+ /** Read current balances and vault state for supplied positions through the
460
+ * host's public client. Opt in for interactive simulation or host indexes. */
461
+ hydratePositions?: boolean;
459
462
  markets: AegisEngineMarket[];
460
463
  positions?: AegisEnginePosition[];
461
464
  lendPositions?: AegisEngineLendSharesPosition[];
@@ -632,6 +635,10 @@ export type AegisEngineBorrowCapacityInput = Omit<AegisEngineQuoteBase, 'owner'
632
635
  /** Optional output-first target. When supplied, the result includes the
633
636
  * collateral floor for the deterministic no-swap path. */
634
637
  borrowOut?: bigint;
638
+ /** Include wallet and market quick-fill limits in this same live frame. */
639
+ includeBorrowLimits?: boolean;
640
+ /** Spendable collateral after the native gas reserve; omitted when unknown. */
641
+ walletCollateralIn?: bigint;
635
642
  tauPips?: number;
636
643
  /** See `AegisEngineBorrowQuoteInput.tauPercentOfMaxLtv`. */
637
644
  tauPercentOfMaxLtv?: number;
@@ -1120,6 +1127,24 @@ export type AegisEngineVaultActivityEntry = {
1120
1127
  receivedRaw: bigint | null;
1121
1128
  receivedIsToken0: boolean | null;
1122
1129
  };
1130
+ /** Settled sizing result. A floor is planning data, never execution permission. */
1131
+ export type AegisEngineBorrowCollateralFloor = {
1132
+ status: 'not-requested';
1133
+ } | {
1134
+ status: 'ready-positive';
1135
+ amountIn: bigint;
1136
+ } | {
1137
+ status: 'ready-zero';
1138
+ amountIn: 0n;
1139
+ outputSource: 'existing-idle' | 'new-debt' | 'unknown';
1140
+ } | {
1141
+ status: 'infeasible';
1142
+ reason: 'utilization-capped';
1143
+ } | {
1144
+ status: 'unavailable';
1145
+ reason: 'closed-form-not-applicable' | 'forward-validation-unavailable' | 'legacy-no-floor';
1146
+ retryable: boolean;
1147
+ };
1123
1148
  export type AegisEngineBorrowCapacity = {
1124
1149
  kind: 'borrow-capacity';
1125
1150
  market: AegisEngineMarket;
@@ -1135,16 +1160,25 @@ export type AegisEngineBorrowCapacity = {
1135
1160
  tauPercentOfMaxLtv: number | null;
1136
1161
  /** Echoed output target used to derive `minimumNoSwapCollateralIn`. */
1137
1162
  borrowOut: bigint | null;
1138
- /** Minimum fresh-vault deposit that crosses the SDK's integer no-swap
1163
+ /** Minimum deposit for the supplied vault that crosses the SDK's integer no-swap
1139
1164
  * boundary. Null when no output target was supplied, no closed-form
1140
1165
  * no-swap solution exists, or the market is utilization-capped. */
1141
1166
  minimumNoSwapCollateralIn: bigint | null;
1167
+ /** Always emitted by quoteEngineBorrowCapacity; optional for older host snapshots. */
1168
+ collateralFloor?: AegisEngineBorrowCollateralFloor;
1169
+ /** Market frame used for sizing; vault inputs still need executable revalidation. */
1170
+ frame?: AegisEngineReadFrame;
1142
1171
  /** Equals `capacity.utilizationPre >= capacity.utilizationCap` at quote
1143
1172
  * time. Named (rather than derived by consumers) because the SDK's stage
1144
1173
  * classifier can mask a cap block behind preserve-vs-allow reachability
1145
1174
  * (`preserve-collateral-blocked`), so `bindingConstraint`/quote reasons
1146
1175
  * can't be trusted for it. When true no borrow executes for any deposit
1147
1176
  * and no collateral floor is published. */
1177
+ borrowLimits?: {
1178
+ walletCollateralIn: bigint | null;
1179
+ walletBorrowOut: bigint | null;
1180
+ marketBorrowOut: bigint;
1181
+ };
1148
1182
  utilizationCapped: boolean;
1149
1183
  capacity: {
1150
1184
  yMaxLtv: bigint;
@@ -1229,6 +1263,12 @@ export type AegisEngineAuthorizationPlan = {
1229
1263
  token: AegisEngineToken;
1230
1264
  amount: bigint;
1231
1265
  approvalMode: 'exact' | 'max';
1266
+ /** Read observations drive permission presentation only, never submission authority. */
1267
+ observations?: {
1268
+ erc20Allowance: bigint | null;
1269
+ permit2Allowance: readonly [bigint, number, number] | null;
1270
+ permit2AuthorizationMode: 'signature' | 'spending-cap';
1271
+ };
1232
1272
  router: Address;
1233
1273
  permit2: Address;
1234
1274
  vaultRegistry: Address;