aegis-swap-widget 0.15.0 → 0.17.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/CHANGELOG.md CHANGED
@@ -1,5 +1,59 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.17.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 04a2e9d: Show the path behind aggregated swap quotes. `AggregatedSwapQuote` gains
8
+ display-only `routePaths` (each path's input share and its pool legs, as Kyber
9
+ or the Ink router reported them); it is omitted unless every path is complete
10
+ and chained, matches the quoted endpoints, and conserves known input allocations;
11
+ execution never reads it. `AegisAggregatedSwapWidget` adds a
12
+ Route row to Trade details that previews the path with real token artwork and
13
+ opens a diagram of the input, intermediate tokens and pools, with ribbons sized
14
+ by each path's share and colored from that artwork. Intermediate tokens outside
15
+ the token list resolve their symbol and icon through the token metadata
16
+ service. The diagram draws in along the flow, streams liquidity through
17
+ whatever pool or token is inspected by hover, tap or keyboard, morphs when only
18
+ the split shares change, and stays still under reduced motion. A refresh that
19
+ re-routes the same amounts now redraws it. The Route row is on by default;
20
+ hosts pass `showRoutePreview={false}` to hide it and skip the intermediate-token
21
+ metadata request.
22
+
23
+ Split percentages stay nonnegative and total 100% after rounding. Escape also
24
+ dismisses a hovered pool note while focus remains on the Route toggle, and both
25
+ system and host reduced-motion settings reveal the diagram with opacity only.
26
+
27
+ ### Patch Changes
28
+
29
+ - 7246abf: `AegisAggregatedSwapWidget` quotes and executes aggregated swaps with the
30
+ deployment fee from `/v1/config` (`fee.outputFeeBps`). The displayed quote is
31
+ keyed on the resolved fee and execution passes that same fee, so the two never
32
+ disagree. Quoting waits briefly for config on first load; with no backend, a
33
+ failed config read, or a slow one (over 3 s), it keeps the bundled 50 bps.
34
+ - Updated dependencies [04a2e9d]
35
+ - Updated dependencies [90c5b68]
36
+ - Updated dependencies [9af37b3]
37
+ - Updated dependencies [4c32cc7]
38
+ - @aegis-engine/core@0.13.0
39
+
40
+ ## 0.16.0
41
+
42
+ ### Minor Changes
43
+
44
+ - 4af9f9c: Open action-specific loan and deposit reviews from live positions without authorizing or submitting. Reuse quoted Engine state for ordinary-loan collateral and repayment previews, qualify missing NFT valuation, and keep fresh position review controls usable while balances refresh.
45
+
46
+ Show withdrawal guidance only when the live market and position can support its review. Start collateral withdrawal on a funded idle token, explain balance versus collateral-risk bounds, distinguish confirmed transactions from delayed position data, and label receipt-gas costs as execution fees.
47
+
48
+ - b235549: Breaking: `AggregatedSwapQuote.priceImpact` is now `number | null` (was `number`). Consumers that call methods on it (for example `quote.priceImpact.toFixed()`), including Widget onQuote callback handlers, must handle `null` first. An omitted provider impact is preserved as null instead of inventing zero. Kyber routes, which report no impact field, now derive it from Kyber's amountInUsd/amountOutUsd with the Aegis output fee added back (covers market impact and pool fees; excludes the Aegis fee and gas) and stay null when those values are missing or zero; Ink routes report null. The Widget shows unknown impact as "Unavailable" with a warning tone while retaining explicit zero and existing nonzero tones.
49
+
50
+ ### Patch Changes
51
+
52
+ - e4d675e: Clear a previously displayed Aegis quote when a background refresh or fresh submit quote reports no Aegis route or rejects a non-Aegis leg. Show the unavailable state and disable swapping until a valid route returns, while retaining quotes during transient refresh failures.
53
+ - dd93234: Round borrowing limits down in the headline and limits ledger so compact token amounts never exceed the SDK's executable wallet, market or effective capacity.
54
+ - Updated dependencies [b235549]
55
+ - @aegis-engine/core@0.12.0
56
+
3
57
  ## 0.15.0
4
58
 
5
59
  ### Minor Changes
package/README.md CHANGED
@@ -101,7 +101,8 @@ Simple Borrow shows the SDK's wallet/collateral limit separately from its market
101
101
  limit in the Borrowing limit disclosure. Independently quoted limits can appear
102
102
  before connecting; wallet-specific bounds remain unavailable until the wallet
103
103
  balance is known. Custom Borrow shows the effective limit for the entered
104
- collateral. Its slider and Max action use the SDK token bound even when a dollar
104
+ collateral. Numeric limit summaries round down so the displayed cap never exceeds
105
+ the SDK token bound. Its slider and Max action use the SDK token bound even when a dollar
105
106
  price is unavailable; dollar-denominated room and health stay unavailable. Editing
106
107
  the Custom borrow amount refreshes its
107
108
  execution quote without repeating the collateral-capacity read. Simple Borrow
@@ -133,6 +134,37 @@ Hosts should preserve the mounted widget during an interaction and use
133
134
  `onInteractionLockChange` to suspend conflicting navigation. Successful wallet
134
135
  authorization does not mean the loan or deposit has been submitted or confirmed.
135
136
 
137
+ ### Managing positions
138
+
139
+ The Positions surface offers Add collateral, Repay loan, Withdraw collateral,
140
+ Close loan and Withdraw deposit directly from the corresponding live position.
141
+ Each shortcut opens the existing manager with that action selected. Opening a
142
+ review does not authorize or submit it. Unavailable markets and missing live
143
+ position data do not expose these shortcuts. Loan and deposit shortcuts stay
144
+ available during a refresh while their previous live balances are still fresh;
145
+ the manager verifies action-specific readiness and refreshes its quote before execution.
146
+
147
+ Loan reviews reuse the current Engine state and the selected action to show
148
+ collateral and debt after the change, alongside the existing Engine risk preview.
149
+ Repayment uses the quote's projected state, never a proportional slider estimate.
150
+ When NFT collateral cannot be valued, the loan review labels its idle balances
151
+ as token collateral and withholds an incomplete total USD value.
152
+ Collateral withdrawal explains whether the current conservative bound is limited
153
+ by the Engine collateral requirement or by the position's token balance.
154
+
155
+ A deposit's displayed value is not a promise that it can all be withdrawn now.
156
+ The withdrawal manager reads current redeemable shares, supports a partial
157
+ selection, shows the minimum token outputs and checks liquidity again before
158
+ submission. A changed liquidity bound requires review instead of silently
159
+ shrinking the requested withdrawal.
160
+
161
+ Keep the transaction hash, chain receipt and refreshed position data distinct in
162
+ host UI. The widget's confirmation callback reports the receipt; the API/indexer
163
+ may catch up later. A confirmed transaction awaiting position data offers a
164
+ lookup retry, not another transaction. Pending hashes remain scoped to the
165
+ original wallet and chain across reloads; recovery checks the submitted
166
+ hash and does not reconstruct an executable intent from storage.
167
+
136
168
  ## Wolf Game Trade and Earn preset
137
169
 
138
170
  The Wolf preset reproduces the focused gamer flow: a resource Store under
@@ -828,6 +860,20 @@ in-house provider instead: up to three hops over the bundled Ink Aegis pools,
828
860
  quoted in one Multicall3 call, settled on the Aegis router through Permit2.
829
861
  Ink requires `liquiditySources="aegis"`; `'any'` shows an error.
830
862
 
863
+ When the current quote reports its path, **Trade details** adds a **Route** row
864
+ that previews the tokens the swap passes through. Opening it draws the input,
865
+ each intermediate token, the pools between them and, for split routes, each
866
+ path's share of the input. Hover, tap or focus a pool for its source, or a token
867
+ to light up every path through it; **Technical details** lists each pool id.
868
+ Intermediate tokens outside your `tokens` list take their symbol and artwork
869
+ from the same token metadata service as the pair (one batched request, cached
870
+ for the session). The diagram otherwise makes no requests, follows the current
871
+ quote only, honours reduced motion, and is omitted when the provider reports no
872
+ complete path or more than five parallel paths.
873
+
874
+ The Route row is on by default. Pass `showRoutePreview={false}` to hide it; the
875
+ widget then also skips the intermediate-token metadata request.
876
+
831
877
  ## Fees
832
878
 
833
879
  The widget applies an internal output-token fee per chain. Each bundled chain config
@@ -1,7 +1,7 @@
1
1
  import { jsxs as h, jsx as i, Fragment as Pe } from "react/jsx-runtime";
2
2
  import * as E from "react";
3
3
  import { useState as H, useEffect as ue, useRef as F, useId as kt, useMemo as ce } from "react";
4
- import { E as St, u as _t, a as Ye, b as $t, c as Ft, d as Pt, e as Ot, F as mt, f as gt, g as ft, C as Ut, h as Ht, i as pt, j as Vt } from "./index-B0agjrrs.js";
4
+ import { E as St, u as _t, a as Ye, b as $t, c as Ft, d as Pt, e as Ot, F as mt, f as gt, g as ft, C as Ut, h as Ht, i as pt, j as Vt } from "./index-BcjYe1-F.js";
5
5
  import { enginePoolPriceSegments as Xt, splitEngineMarketCandleSegments as Yt, fetchTokenPriceHistory as jt } from "@aegis-engine/core";
6
6
  import { m as Wt } from "./marketOrientation-B6SD7xSk.js";
7
7
  function qt({
@@ -1,4 +1,4 @@
1
- import { A as s, k as i, l as o, m as n, n as r, o as t, p as A, q as E, r as g, s as u, t as S, S as _, v as c, k as m, w as l, x as P, y as p, z as d, B as W } from "./index-B0agjrrs.js";
1
+ import { A as s, k as i, l as o, m as n, n as r, o as t, p as A, q as E, r as g, s as u, t as S, S as _, v as c, k as m, w as l, x as P, y as p, z as d, B as W } from "./index-BcjYe1-F.js";
2
2
  import { u as R, a as T, b as G, c as I, d as O, e as L, f as x, g as D } from "./useEngineActivity-BkhItrUI.js";
3
3
  import { WOLF_GAME_ENGINE_WIDGET_PRESET as k, WOLF_GAME_RESOURCES as v, WOLF_GAME_RESOURCE_ORDER as w, resolveWolfGameResource as M, wolfGameResourceWidgetProps as y } from "./presets/wolf-game.js";
4
4
  import { normalizePartnerActionRequirement as N, normalizePartnerResourceAmount as z, partnerLaunchIntentForRequirement as C, partnerResourceAssetKey as U } from "./partner-context.js";
@@ -0,0 +1,20 @@
1
+ /**
2
+ * The deployment output fee from `/v1/config` (`fee.outputFeeBps`) for the
3
+ * aggregated swap path.
4
+ *
5
+ * - `settled` is false only while the first config read for this backend is
6
+ * pending, and never for longer than {@link OUTPUT_FEE_CONFIG_WAIT_MS}:
7
+ * quoting waits for it so the first displayed quote already carries the
8
+ * deployment fee, but a slow or broken backend never blocks quoting.
9
+ * - `outputFeeBps` is `undefined` when there is no backend, the read failed,
10
+ * or the wait ran out; core then applies its bundled default (50 bps).
11
+ */
12
+ export type BackendOutputFee = {
13
+ settled: boolean;
14
+ outputFeeBps: number | undefined;
15
+ };
16
+ export declare function __clearBackendOutputFeeCacheForTests(): void;
17
+ export declare function useBackendOutputFee({ baseUrl, timeoutMs }: {
18
+ baseUrl: string | null;
19
+ timeoutMs?: number;
20
+ }): BackendOutputFee;