aegis-swap-widget 0.3.0 → 0.3.2

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
@@ -5,6 +5,36 @@ All notable changes to this project are documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.3.2] - 2026-06-08
9
+
10
+ ### Added
11
+ - Added controlled Trade details drawer state via `executionDetailsOpen` and
12
+ `onExecutionDetailsOpenChange`. Hosts can now coordinate the drawer with
13
+ their own layout while the widget keeps its existing uncontrolled
14
+ `defaultExecutionDetailsOpen` behavior when the controlled prop is omitted.
15
+
16
+ ## [0.3.1] - 2026-06-08
17
+
18
+ ### Added
19
+ - Added a `Trade` / `Latest tx` switch inside the Trade details drawer. After a
20
+ successful swap, the drawer opens to a session-local receipt showing the
21
+ latest confirmed transaction's received amount, network fee, gas price, gas
22
+ used, block, and explorer link.
23
+ - Added an in-flight quote shimmer on the quote-derived amount field and a
24
+ wallet-step hint before approval or Permit2 signing.
25
+
26
+ ### Changed
27
+ - Softened the widget chrome by replacing several resting borders with tonal
28
+ elevation, quieter segmented controls, and a tighter Trade details surface.
29
+ - Reskinned the local demo surface so the playground reads like a host app demo
30
+ instead of a secondary widget.
31
+ - Resolved OS theme changes through `useSyncExternalStore`.
32
+
33
+ ### Documentation
34
+ - Clarified the widget integration contract: production props stay real, while
35
+ demo wallets, fake transaction flows, scenario controls, and mock host shells
36
+ belong in the separate playground.
37
+
8
38
  ## [0.3.0] - 2026-06-08
9
39
 
10
40
  ### Removed (breaking)
@@ -192,7 +222,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
192
222
  - Initial embeddable direct-pool Aegis swap widget for WATER, WOOD, GRASS, and STONE.
193
223
  - Generic pool widget API; ERC-20 → Permit2 approval and Permit2 batch signing.
194
224
 
195
- [Unreleased]: https://github.com/amplifi-liquidity/aegis-widget/compare/v0.3.0...HEAD
225
+ [Unreleased]: https://github.com/amplifi-liquidity/aegis-widget/compare/v0.3.2...HEAD
226
+ [0.3.2]: https://github.com/amplifi-liquidity/aegis-widget/compare/v0.3.1...v0.3.2
227
+ [0.3.1]: https://github.com/amplifi-liquidity/aegis-widget/compare/v0.3.0...v0.3.1
196
228
  [0.3.0]: https://github.com/amplifi-liquidity/aegis-widget/compare/v0.2.0...v0.3.0
197
229
  [0.2.0]: https://github.com/amplifi-liquidity/aegis-widget/compare/v0.1.3...v0.2.0
198
230
  [0.1.3]: https://github.com/amplifi-liquidity/aegis-widget/compare/v0.1.2...v0.1.3
package/README.md CHANGED
@@ -42,31 +42,31 @@ Token icons are hydrated from the same metadata table used by the Aegis website:
42
42
  `GlobalToken.iconURL` from the Aegis metadata GraphQL API. The default endpoint is
43
43
  `https://aegis.markets/graphql/meta`.
44
44
 
45
- ## Headless Core
45
+ ## Integration Contract
46
46
 
47
- Use the root import for the React widget and CSS. Use the `/core` entry when a
48
- host, backend-backed client, or future query layer needs the swap primitives
49
- without importing the widget UI:
47
+ `aegis-swap-widget` is the production widget SDK. It uses real providers, RPCs,
48
+ pool config, approvals, Permit2 authorization, swap submission, and callbacks.
50
49
 
51
- ```ts
52
- import {
53
- AEGIS_SWAP_MARKETS,
54
- createSwapPublicClient,
55
- fetchDirectSwapQuote,
56
- } from 'aegis-swap-widget/core'
57
- ```
50
+ Demo wallets, fake transaction flows, scenario controls, and mock host shells
51
+ belong in the separate playground. They are not exposed as production widget
52
+ props, so an embedded widget cannot accidentally run in a fake mode.
58
53
 
59
- The core entry exports chain and pool config helpers, quote fetching, calldata
60
- encoding, Permit2 helpers, wallet/provider utilities, metadata fetchers, and the
61
- pure transaction-progress helpers. It does not import the React widget or the
62
- package stylesheet.
54
+ Hosts should customize through `pools`, `chains`, `rpcUrls`,
55
+ `metadataEndpoint`, wallet/provider callbacks, status surfaces, `accentColor`,
56
+ `accentTextColor`, `className`, `style`, `title`, and `subtitle`. The widget is
57
+ meant to blend into a host app without forking its internals.
63
58
 
64
- To render token icons with the widget's exact resolution order (config
65
- `iconUrl` → metadata endpoint → ICHI guess), use `resolveTokenIconUrl`:
59
+ Treat contract addresses as trusted integration config. Pool and chain config
60
+ can provide `router`, `permit2`, `quoter`, `poolKey`, and `poolId`; the widget
61
+ normalizes addresses and validates shape, but it cannot prove that a host's
62
+ override points at the intended Aegis or Uniswap deployment. Source those values
63
+ from your own audited config or backend, not from user input.
66
64
 
67
- ```ts
68
- import { resolveTokenIconUrl, fetchGlobalTokenMetadata } from 'aegis-swap-widget/core'
69
- ```
65
+ `onSubmitted`, `onSuccess`, `onError`, `onQuote`, `onStatusChange`, and
66
+ `onPoolChange` are the supported host signals. The in-widget "Latest tx" drawer
67
+ is a session-local UI receipt for the most recent confirmed swap; it is not a
68
+ transaction history API. If a host needs durable history, record
69
+ `onSubmitted`/`onSuccess` on the host side.
70
70
 
71
71
  ## Appearance
72
72
 
@@ -520,7 +520,7 @@ No other props changed. See the [CHANGELOG](./CHANGELOG.md) for the full entry.
520
520
  - `getProvider`: optional provider resolver for wallet libraries with async providers.
521
521
  - `onConnectWallet`: optional callback for opening the host wallet modal. It may return `{ provider, account }`.
522
522
  - `onSubmitted`: `(hash, swap?)` fired when the swap transaction is sent. `swap` carries mode, token symbols, amounts, and fee for analytics.
523
- - `onSuccess`: `({ hash, explorerUrl, swap? })` fired when the receipt confirms.
523
+ - `onSuccess`: `({ hash, explorerUrl, swap? })` fired when the receipt confirms. Receipt gas/block facts are rendered inside the widget's session-local Latest tx view, not exposed through this callback.
524
524
  - `onError`: `(error)` fired on approval/swap failures (after the widget shows its own message).
525
525
  - `onQuote`: `(quote)` fired on every quote refresh.
526
526
  - `onStatusChange`: `(snapshot)` fired on every lifecycle transition with what the top progress rail shows (see Transaction Status).
@@ -546,8 +546,10 @@ No other props changed. See the [CHANGELOG](./CHANGELOG.md) for the full entry.
546
546
  - `showPoolLink`: whether to render the direct-pool link when the active chain provides `poolExplorerUrl`.
547
547
  - `defaultApprovalMode`: `exact` approves only the current quote spend by default; `max` opts into the old unlimited ERC-20 to Permit2 approval behavior.
548
548
  - `showApprovalMode`: whether the details drawer exposes the Exact/Max approval toggle. Defaults to `true`.
549
- - `showExecutionDetails`: whether to render the collapsible settings drawer for slippage, approval mode, and route. Defaults to `true`.
549
+ - `showExecutionDetails`: whether to render the collapsible drawer for trade details and, after a confirmed swap, the session-local Latest tx receipt. Defaults to `true`.
550
550
  - `defaultExecutionDetailsOpen`: whether that settings drawer starts expanded. Defaults to `false`.
551
+ - `executionDetailsOpen`: controlled open state for the Trade details drawer. Omit this for the widget's internal open/closed state.
552
+ - `onExecutionDetailsOpenChange`: fired when the user toggles the drawer, switches to `Trade` / `Latest tx`, or a successful swap requests the Latest tx view. In controlled mode, update `executionDetailsOpen` in response to actually open or close the drawer.
551
553
  - `statusSurface`: where transaction status is surfaced — `'rail'` (default), `'toast'`, `'both'`, or `'none'`. The root `data-progress-state` attribute stays on regardless (see Toasts).
552
554
  - `toastPosition`: viewport corner for the widget-provided toaster. Defaults to `'bottom-right'`; ignored once a host mounts `<AegisSwapToaster />`.
553
555