@aegis-engine/core 0.5.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 +71 -3
- package/dist/actions/directPoolSwap.d.ts +3 -0
- package/dist/actions/kyberSwap.d.ts +1 -0
- package/dist/actions/types.d.ts +60 -0
- package/dist/aegis-core.js +165 -155
- package/dist/engine/actions.d.ts +7 -2
- package/dist/engine/borrowCollateralFloor.d.ts +3 -0
- package/dist/engine/borrowLimits.d.ts +18 -0
- package/dist/engine/index.d.ts +3 -0
- package/dist/engine/lendHistory.d.ts +21 -0
- package/dist/engine/simpleYield.d.ts +39 -0
- package/dist/engine/types.d.ts +63 -1
- package/dist/errors.d.ts +13 -2
- package/dist/{index-DuoaODpB.js → index-DofKgro2.js} +4204 -3703
- package/dist/index.d.ts +8 -4
- package/dist/permit.d.ts +6 -0
- package/dist/{sdkRuntime-DeaRALj3.js → sdkRuntime-BE3ZMb5o.js} +370 -369
- package/dist/swap/authorizePermit.d.ts +5 -1
- package/dist/swap/receiptWait.d.ts +26 -3
- package/dist/swap/sendSwapTransaction.d.ts +13 -0
- package/dist/swap/settlement.d.ts +4 -0
- package/dist/transactionProgress.d.ts +80 -3
- package/dist/wallet.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -122,6 +122,54 @@ remaining collateral stays in the vault until a separate withdrawal. A
|
|
|
122
122
|
one-token lend is a zap into a two-sided full-range LP, not single-token
|
|
123
123
|
lending.
|
|
124
124
|
|
|
125
|
+
### Simple-yield position summaries
|
|
126
|
+
|
|
127
|
+
Use `summarizeEngineSimpleYieldPosition` when a custom UI needs one honest,
|
|
128
|
+
React-free summary of an Engine lender-share position. The helper values live
|
|
129
|
+
shares first, falls back to trusted indexed shares, projects an optional added
|
|
130
|
+
USD amount, and converts realized share-price growth into a weekly estimate.
|
|
131
|
+
|
|
132
|
+
```ts
|
|
133
|
+
import {
|
|
134
|
+
readEnginePositionsHydration,
|
|
135
|
+
summarizeEngineSimpleYieldPosition
|
|
136
|
+
} from '@aegis-engine/core'
|
|
137
|
+
|
|
138
|
+
const market = markets[0]
|
|
139
|
+
const positionsHydration = await readEnginePositionsHydration({
|
|
140
|
+
publicClient,
|
|
141
|
+
chainId: market.chainId,
|
|
142
|
+
expectedAccount: account,
|
|
143
|
+
positions: positions.positions,
|
|
144
|
+
lendPositions: positions.lendPositions
|
|
145
|
+
})
|
|
146
|
+
const position = positions.lendPositions.find(
|
|
147
|
+
(entry) =>
|
|
148
|
+
entry.chainId === market.chainId &&
|
|
149
|
+
entry.poolId.toLowerCase() === market.poolId.toLowerCase()
|
|
150
|
+
) ?? null
|
|
151
|
+
const live = position
|
|
152
|
+
? positionsHydration.lendPositions.find(
|
|
153
|
+
(entry) => entry.positionId === position.id
|
|
154
|
+
)
|
|
155
|
+
: undefined
|
|
156
|
+
|
|
157
|
+
const summary = summarizeEngineSimpleYieldPosition({
|
|
158
|
+
market,
|
|
159
|
+
position,
|
|
160
|
+
hydration: live,
|
|
161
|
+
history: marketHistory,
|
|
162
|
+
additionalValueUsd: 100
|
|
163
|
+
})
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
`summary.valuation` identifies whether live or indexed shares produced the
|
|
167
|
+
current USD value. `summary.projection` is null when an existing position cannot
|
|
168
|
+
be valued, so an add-funds UI cannot mislabel it as a new deposit.
|
|
169
|
+
`summary.growth.weeklyEarningsPer100Usd` is a historical share-growth estimate,
|
|
170
|
+
not a promise. `market.metrics.lendApyPct` is the current modeled lender rate;
|
|
171
|
+
it is a different metric and is never substituted for realized history.
|
|
172
|
+
|
|
125
173
|
### Directional Engine positions
|
|
126
174
|
|
|
127
175
|
`quoteEngineTradeOpen` sizes a fresh-vault Long or Short against one
|
|
@@ -525,9 +573,29 @@ Execution returns:
|
|
|
525
573
|
|
|
526
574
|
## Publishing
|
|
527
575
|
|
|
528
|
-
|
|
529
|
-
|
|
576
|
+
Releases use Changesets and npm trusted publishing. The release workflow builds
|
|
577
|
+
all publishable packages once, validates their tarballs, then publishes the
|
|
578
|
+
prebuilt artifacts with package lifecycle scripts disabled. This prevents
|
|
579
|
+
concurrent package publishes from rebuilding shared workspace artifacts.
|
|
530
580
|
|
|
531
581
|
```sh
|
|
532
|
-
|
|
582
|
+
pnpm build
|
|
583
|
+
pnpm pack:check
|
|
533
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.
|
|
@@ -32,6 +32,7 @@ export declare function approveDirectPoolSwapInput(args: {
|
|
|
32
32
|
amount: bigint;
|
|
33
33
|
approvalMode?: AegisSwapApprovalMode;
|
|
34
34
|
onStatus?: AegisSwapActionCallbacks['onStatus'];
|
|
35
|
+
onApprovalProgress?: AegisSwapActionCallbacks['onApprovalProgress'];
|
|
35
36
|
}): Promise<DirectPoolSwapApprovalResult>;
|
|
36
37
|
export declare function executeDirectPoolSwap(args: {
|
|
37
38
|
wallet: WalletSession;
|
|
@@ -45,6 +46,8 @@ export declare function executeDirectPoolSwap(args: {
|
|
|
45
46
|
slippageBps: number;
|
|
46
47
|
displayedQuote?: DirectSwapQuote | null;
|
|
47
48
|
approvalMode?: AegisSwapApprovalMode;
|
|
49
|
+
/** Finite cap for the next token and Permit2 approvals. Must cover the reviewed spend. */
|
|
50
|
+
approvalAmount?: bigint;
|
|
48
51
|
signal?: AbortSignal;
|
|
49
52
|
onWalletChainId?: (chainId: number | null) => void;
|
|
50
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;
|
package/dist/actions/types.d.ts
CHANGED
|
@@ -3,10 +3,70 @@ import type { DirectSwapQuote } from '../quote.js';
|
|
|
3
3
|
import type { AegisSwapReceiptSummary, SubmitStatus } from '../transactionProgress.js';
|
|
4
4
|
import type { AggregatedSwapQuote } from '../types/aggregatedSwap.js';
|
|
5
5
|
import type { AegisSwapSubmitDetails } from '../swap/types.js';
|
|
6
|
+
/**
|
|
7
|
+
* The grant the approval prompt asks for, as the executor resolved it from the
|
|
8
|
+
* sizing rule. It travels with the progress report so a surface renders the
|
|
9
|
+
* number that will actually be signed instead of re-deriving one from form
|
|
10
|
+
* state — the input amount and the requested amount are the same only under
|
|
11
|
+
* 'exact' sizing. There is no `formatted` field: the unlimited case has no
|
|
12
|
+
* honest formatting and has to be rendered as a word.
|
|
13
|
+
*/
|
|
14
|
+
export type AegisSwapApprovalRequest = {
|
|
15
|
+
/** The exact value passed to `approve()`. */
|
|
16
|
+
value: bigint;
|
|
17
|
+
/** Decimals of the approved token, so `value` is renderable on its own. */
|
|
18
|
+
decimals: number;
|
|
19
|
+
/** True when `value` reads as no limit at all; render a word, not `value`. */
|
|
20
|
+
unlimited: boolean;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* The approval step's wallet prompts: how many it will open, how many the
|
|
24
|
+
* wallet has already confirmed, and what they ask for. Only the executor can
|
|
25
|
+
* answer any of it — its allowance read decides whether a USDT-style zero-reset
|
|
26
|
+
* adds a second prompt, and only it sees that reset's receipt.
|
|
27
|
+
*/
|
|
28
|
+
export type AegisSwapApprovalProgress = {
|
|
29
|
+
/** Broadcast approval awaiting its receipt; absent before signing and after settlement. */
|
|
30
|
+
pendingHash?: Hex;
|
|
31
|
+
/** Prompts the approval step opens: 0, 1, or 2 when a zero-reset precedes it. */
|
|
32
|
+
planned: number;
|
|
33
|
+
/** How many of `planned` have landed on-chain. */
|
|
34
|
+
completed: number;
|
|
35
|
+
/** Absent exactly when `planned` is 0 — nothing will be approved. */
|
|
36
|
+
request?: AegisSwapApprovalRequest;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Wallet prompts used to authorize Permit2 for the router. Usually this is one
|
|
40
|
+
* typed-data signature. A wallet that explicitly reports typed-data as
|
|
41
|
+
* unsupported uses one on-chain spending-cap prompt instead. Returned invalid
|
|
42
|
+
* signatures fail closed, so this is a count rather than a boolean.
|
|
43
|
+
*/
|
|
44
|
+
export type AegisSwapAuthorizationProgress = {
|
|
45
|
+
/** On-chain Permit2 fallback awaiting its receipt; signatures have no hash. */
|
|
46
|
+
pendingHash?: Hex;
|
|
47
|
+
/** Prompts this authorization step will open from the executor's live state. */
|
|
48
|
+
planned: number;
|
|
49
|
+
/** Prompts already completed by the wallet/user. */
|
|
50
|
+
completed: number;
|
|
51
|
+
};
|
|
6
52
|
export type AegisSwapActionCallbacks<TSwapDetails = AegisSwapSubmitDetails> = {
|
|
7
53
|
onStatus?: (status: SubmitStatus) => void;
|
|
8
54
|
onTxHash?: (hash: Hex | null) => void;
|
|
9
55
|
onSubmitted?: (hash: Hex, swap?: TSwapDetails) => void;
|
|
56
|
+
/**
|
|
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
|
|
59
|
+
* reached, no required approval reports `{ planned: 0, completed: 0 }`.
|
|
60
|
+
* Earlier chain-validation or quote failures can stop before this callback.
|
|
61
|
+
*/
|
|
62
|
+
onApprovalProgress?: (progress: AegisSwapApprovalProgress) => void;
|
|
63
|
+
/**
|
|
64
|
+
* Fires before the first Permit2 authorization prompt, whenever the plan
|
|
65
|
+
* changes, when an on-chain fallback is broadcast, and after each completed
|
|
66
|
+
* prompt. A reusable standing cap reports
|
|
67
|
+
* `{ planned: 0, completed: 0 }`.
|
|
68
|
+
*/
|
|
69
|
+
onAuthorizationProgress?: (progress: AegisSwapAuthorizationProgress) => void;
|
|
10
70
|
};
|
|
11
71
|
export type AegisSwapActionResult<TQuote = DirectSwapQuote | AggregatedSwapQuote> = {
|
|
12
72
|
hash: Hex;
|
package/dist/aegis-core.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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
|
|
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,
|
|
@@ -8,31 +8,31 @@ export {
|
|
|
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,
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
S as AEGIS_SWAP_HOOK,
|
|
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
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
l as AEGIS_SWAP_ROUTER,
|
|
16
|
+
_ as AEGIS_SWAP_TOKENS,
|
|
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,
|
|
20
20
|
T as AGGREGATED_SWAP_DEFAULT_TOKENS,
|
|
21
21
|
u as AGGREGATED_SWAP_DEFAULT_TOKEN_LIST,
|
|
22
22
|
h as AGGREGATED_SWAP_SUPPORTED_CHAIN_IDS,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
m as AGGREGATED_SWAP_TOKEN_PRESETS,
|
|
24
|
+
k as AGGREGATED_SWAP_WOLFGAME_TOKENS,
|
|
25
|
+
R as AGGREGATED_SWAP_WOLFGAME_TOKEN_LIST,
|
|
26
|
+
I as AegisBackendApiError,
|
|
27
|
+
C as AegisBackendContractError,
|
|
28
28
|
w as AegisContractGuardError,
|
|
29
29
|
G as AegisEngineMarketNotReadyError,
|
|
30
30
|
B as AggregatedSwapBuildMismatchError,
|
|
31
31
|
D as AggregatedSwapCalldataError,
|
|
32
32
|
N as DEFAULT_PERMIT_EXPIRATION_SECONDS,
|
|
33
33
|
M as DirectPoolSwapPriceMovedError,
|
|
34
|
-
|
|
35
|
-
|
|
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,
|
|
@@ -41,157 +41,167 @@ export {
|
|
|
41
41
|
f as NATIVE_TOKEN_ADDRESS,
|
|
42
42
|
K as PERMIT2_FAR_FUTURE_EXPIRATION,
|
|
43
43
|
H as SWAP_TX_DEADLINE_SECONDS,
|
|
44
|
-
V as
|
|
44
|
+
V as SubmittedTransactionReceiptError,
|
|
45
|
+
q as TransactionReceiptTimeoutError,
|
|
45
46
|
x as UNISWAP_V4_CONTRACTS_BY_CHAIN,
|
|
46
47
|
Q as USER_REJECTED_MESSAGE,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
48
|
+
z as UserFacingError,
|
|
49
|
+
X as aegisBackendAddressAllowlistSchema,
|
|
50
|
+
Y as aegisBackendAddressSchema,
|
|
51
|
+
j as aegisBackendAllowlistsByChainSchema,
|
|
52
|
+
Z as aegisBackendChainIdSchema,
|
|
53
|
+
J as aegisBackendChainSchema,
|
|
54
|
+
$ as aegisBackendConfigSchema,
|
|
55
|
+
aa as aegisBackendContractRegistrySchema,
|
|
56
|
+
ea as aegisBackendContractsByChainSchema,
|
|
57
|
+
sa as aegisBackendDecimalStringSchema,
|
|
58
|
+
ia as aegisBackendFeeConfigSchema,
|
|
59
|
+
ra as aegisBackendHealthResponseSchema,
|
|
60
|
+
na as aegisBackendHexSchema,
|
|
61
|
+
ta as aegisBackendIsoDateTimeSchema,
|
|
62
|
+
oa as aegisBackendMarketMetricsSchema,
|
|
63
|
+
ca as aegisBackendMarketSchema,
|
|
64
|
+
Ea as aegisBackendMarketStatusSchema,
|
|
65
|
+
Sa as aegisBackendMarketsResponseSchema,
|
|
65
66
|
Aa as aegisBackendQuoteDefaultsSchema,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
ga as aegisBackendQuoteModeSchema,
|
|
68
|
+
da as aegisBackendSwapProviderSchema,
|
|
69
|
+
la as aegisBackendSwapQuoteRequestSchema,
|
|
69
70
|
_a as aegisBackendSwapQuoteResponseSchema,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
71
|
+
pa as aegisBackendTokenSchema,
|
|
72
|
+
ba as aegisBackendTokensResponseSchema,
|
|
73
|
+
Pa as aegisPoolKeySchema,
|
|
74
|
+
Ta as aggregatedSwapErrorMessage,
|
|
75
|
+
ua as approveDirectPoolSwapInput,
|
|
76
|
+
ha as approveEnginePermit2ToRouter,
|
|
77
|
+
ma as approveEngineTokenToPermit2,
|
|
77
78
|
ka as approveErc20Spender,
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
79
|
+
Ra as approveErc20ToPermit2,
|
|
80
|
+
Ia as approveKyberSwapInput,
|
|
81
|
+
Ca as approvePermit2ToRouter,
|
|
82
|
+
wa as assertCalldataHash,
|
|
83
|
+
Ga as assertChainMatches,
|
|
84
|
+
Ba as assertQuoteFresh,
|
|
85
|
+
Da as assertRouterAllowlisted,
|
|
86
|
+
Na as assertSpenderAllowlisted,
|
|
87
|
+
Ma as assertUint128,
|
|
88
|
+
va as attachEngineActivityLotDisplays,
|
|
88
89
|
ya as authorizeEnginePositionRouter,
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
90
|
+
Wa as authorizeEngineVaultOperator,
|
|
91
|
+
Ua as backendTokenToAegisSwapToken,
|
|
92
|
+
Oa as backendTokensToAegisSwapTokens,
|
|
93
|
+
Fa as buildExactInSwapTransaction,
|
|
94
|
+
La as buildExactOutSwapTransaction,
|
|
95
|
+
fa as buildKyberSwapRoute,
|
|
96
|
+
Ka as buildSignedPermitBatch,
|
|
97
|
+
Ha as classifyEngineVaultActivity,
|
|
98
|
+
Va as classifyError,
|
|
99
|
+
qa as clearEngineMarketHistoryCache,
|
|
99
100
|
xa as clearEngineMarketsCache,
|
|
100
101
|
Qa as clearEnginePositionActivityCache,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
102
|
+
za as clearEnginePositionsCache,
|
|
103
|
+
Xa as clearEnginePositionsV2ProbeCache,
|
|
104
|
+
Ya as clearEngineReadCaches,
|
|
105
|
+
ja as clearTokenPriceHistoryCache,
|
|
106
|
+
Za as computeEngineIdleWithdrawPostLtvPips,
|
|
107
|
+
Ja as computeEngineMaxIdleWithdraw,
|
|
108
|
+
$a as computePoolId,
|
|
109
|
+
ae as createAegisBackendApiClient,
|
|
110
|
+
ee as createAegisSwapChainConfig,
|
|
111
|
+
se as createAegisSwapChains,
|
|
112
|
+
ie as createAegisSwapChainsFromBackendConfig,
|
|
113
|
+
re as createAegisSwapMarketsFromPools,
|
|
114
|
+
ne as createAegisSwapPoolMarket,
|
|
115
|
+
te as createAegisSwapPoolsFromBackendMarkets,
|
|
116
|
+
oe as createAegisSwapUniswapV4Contracts,
|
|
117
|
+
ce as createSwapPublicClient,
|
|
118
|
+
Ee as deriveEngineActivityLotDisplay,
|
|
119
|
+
Se as deriveEngineTradePositionStrategy,
|
|
119
120
|
Ae as engineIdleWithdrawPassesResidualLtv,
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
_e as
|
|
124
|
-
|
|
121
|
+
ge as engineMarketsRestResponseSchema,
|
|
122
|
+
de as enginePermit2GrantSatisfies,
|
|
123
|
+
le as enginePreviewMaxLtvPips,
|
|
124
|
+
_e as engineRouterForChain,
|
|
125
|
+
pe as engineTokenGrantSatisfies,
|
|
126
|
+
be as ensureWalletChain,
|
|
125
127
|
Pe as errorMessage,
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
128
|
+
Te as estimateSwapGasWithBuffer,
|
|
129
|
+
ue as executeDirectPoolSwap,
|
|
130
|
+
he as executeKyberSwap,
|
|
131
|
+
me as executionLtvGuardPips,
|
|
132
|
+
ke as fetchAggregatedSwapQuote,
|
|
133
|
+
Re as fetchDirectPoolSwapQuote,
|
|
132
134
|
Ie as fetchEngineLendActivity,
|
|
133
135
|
Ce as fetchEngineMarketHistory,
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
Ps as
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
Is as
|
|
187
|
-
Cs as
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
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,
|
|
143
|
+
ye as getExplorerUrl,
|
|
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,
|
|
154
|
+
xe as isRetryableAegisBackendApiError,
|
|
155
|
+
Qe as isRetryableKyberSwapError,
|
|
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
|
|
197
207
|
};
|
package/dist/engine/actions.d.ts
CHANGED
|
@@ -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:
|
|
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:
|
|
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 {};
|
package/dist/engine/index.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
export * from './types.js';
|
|
2
2
|
export * from './activityLotDisplay.js';
|
|
3
3
|
export * from './dataSource.js';
|
|
4
|
+
export * from './lendHistory.js';
|
|
5
|
+
export * from './simpleYield.js';
|
|
4
6
|
export * from './marketAdapter.js';
|
|
5
7
|
export * from './registry.js';
|
|
6
8
|
export * from './reads.js';
|
|
7
9
|
export * from './quotes.js';
|
|
10
|
+
export * from './borrowCollateralFloor.js';
|
|
8
11
|
export * from './actions.js';
|
|
9
12
|
export * from './positionAmounts.js';
|
|
10
13
|
export * from './positionStrategy.js';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { AegisEngineMetricHistory } from './types.js';
|
|
2
|
+
export type AegisEngineLendShareGrowthSummary = Readonly<{
|
|
3
|
+
startTimestamp: number;
|
|
4
|
+
endTimestamp: number;
|
|
5
|
+
coverageSeconds: number;
|
|
6
|
+
apyPct: number;
|
|
7
|
+
weeklyEarningsPer100Usd: number;
|
|
8
|
+
/** Historical average weekly dollars per $100, recalculated from the first
|
|
9
|
+
* usable share-price observation through each later observation. */
|
|
10
|
+
points: ReadonlyArray<Readonly<{
|
|
11
|
+
t: number;
|
|
12
|
+
v: number;
|
|
13
|
+
}>>;
|
|
14
|
+
}>;
|
|
15
|
+
/**
|
|
16
|
+
* Converts the Engine history plane's realized share-price growth into a
|
|
17
|
+
* player-readable historical earnings rate. This deliberately does not use
|
|
18
|
+
* `lendApyPct`: that field is the current borrower-interest model, while share
|
|
19
|
+
* growth records what actually accrued to one pool share during the window.
|
|
20
|
+
*/
|
|
21
|
+
export declare function summarizeEngineLendShareGrowth(history: AegisEngineMetricHistory): AegisEngineLendShareGrowthSummary | null;
|