aegis-swap-widget 0.3.2 → 0.3.4
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 +37 -0
- package/README.md +114 -43
- package/dist/abis.d.ts +0 -73
- package/dist/aegis-swap-widget.js +3468 -2344
- package/dist/config/chains.d.ts +11 -0
- package/dist/config/constants.d.ts +8 -0
- package/dist/config/contracts.d.ts +6 -0
- package/dist/config/createMarket.d.ts +3 -0
- package/dist/config/index.d.ts +7 -0
- package/dist/config/markets.d.ts +3 -0
- package/dist/config/tokens.d.ts +11 -0
- package/dist/{config.d.ts → config/types.d.ts} +5 -26
- package/dist/core.d.ts +3 -15
- package/dist/core.js +4 -64
- package/dist/encoding.d.ts +0 -29
- package/dist/hooks/useSubmitSwap.d.ts +11 -29
- package/dist/hooks/useSwapQuote.d.ts +3 -2
- package/dist/index.d.ts +3 -1
- package/dist/markets-LIeOtFf_.js +229 -0
- package/dist/permit.d.ts +1 -47
- package/dist/quote/aggregatedSwapQuote.d.ts +5 -0
- package/dist/services/kyberSwap.d.ts +84 -0
- package/dist/styles.css +1 -1
- package/dist/types/aggregatedSwap.d.ts +29 -0
- package/dist/widget/AegisAggregatedSwapWidget.d.ts +3 -0
- package/dist/widget/AmountField.d.ts +5 -1
- package/dist/widget/SwapWidgetShell.d.ts +51 -0
- package/dist/widget/TokenSelector.d.ts +13 -0
- package/dist/widget/types.d.ts +23 -2
- package/dist/widget/useAggregatedSwapController.d.ts +74 -0
- package/dist/widget/useRailAutoReset.d.ts +11 -0
- package/dist/widget/useStatusSurface.d.ts +32 -0
- package/dist/widget/useSwapController.d.ts +13 -14
- package/dist/widget/useWidgetStyle.d.ts +13 -0
- package/dist/widget/viewState.d.ts +21 -1
- package/package.json +23 -21
- package/dist/polling-BI4pZg8Z.js +0 -1252
- package/dist/swap/authorizePermit.d.ts +0 -30
- package/dist/swap/executeSwapTransaction.d.ts +0 -39
- package/dist/swap/types.d.ts +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,13 +1,31 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- effa726: Consume shared logic from @aegis-engine/core via workspace dependency; new ./core subpath re-export; GRASS_USDC routes through the 30-tick reference pool
|
|
8
|
+
- Updated dependencies [effa726]
|
|
9
|
+
- @aegis-engine/core@0.1.2
|
|
10
|
+
|
|
3
11
|
All notable changes to this project are documented in this file.
|
|
4
12
|
|
|
5
13
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
14
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
15
|
|
|
16
|
+
## [0.3.3] - 2026-06-08
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- Re-pointed the bundled `GRASS_USDC` market to the 30-tick-spacing pool
|
|
21
|
+
(`0xc516dba7bd70aa2dcb986bb1c27208ea29ecd097fa0ce636611e88e54ae4444d`)
|
|
22
|
+
designated by the Aegis pools API as the reference pool holding the deep
|
|
23
|
+
liquidity.
|
|
24
|
+
|
|
8
25
|
## [0.3.2] - 2026-06-08
|
|
9
26
|
|
|
10
27
|
### Added
|
|
28
|
+
|
|
11
29
|
- Added controlled Trade details drawer state via `executionDetailsOpen` and
|
|
12
30
|
`onExecutionDetailsOpenChange`. Hosts can now coordinate the drawer with
|
|
13
31
|
their own layout while the widget keeps its existing uncontrolled
|
|
@@ -16,6 +34,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
16
34
|
## [0.3.1] - 2026-06-08
|
|
17
35
|
|
|
18
36
|
### Added
|
|
37
|
+
|
|
19
38
|
- Added a `Trade` / `Latest tx` switch inside the Trade details drawer. After a
|
|
20
39
|
successful swap, the drawer opens to a session-local receipt showing the
|
|
21
40
|
latest confirmed transaction's received amount, network fee, gas price, gas
|
|
@@ -24,6 +43,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
24
43
|
wallet-step hint before approval or Permit2 signing.
|
|
25
44
|
|
|
26
45
|
### Changed
|
|
46
|
+
|
|
27
47
|
- Softened the widget chrome by replacing several resting borders with tonal
|
|
28
48
|
elevation, quieter segmented controls, and a tighter Trade details surface.
|
|
29
49
|
- Reskinned the local demo surface so the playground reads like a host app demo
|
|
@@ -31,6 +51,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
31
51
|
- Resolved OS theme changes through `useSyncExternalStore`.
|
|
32
52
|
|
|
33
53
|
### Documentation
|
|
54
|
+
|
|
34
55
|
- Clarified the widget integration contract: production props stay real, while
|
|
35
56
|
demo wallets, fake transaction flows, scenario controls, and mock host shells
|
|
36
57
|
belong in the separate playground.
|
|
@@ -38,15 +59,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
38
59
|
## [0.3.0] - 2026-06-08
|
|
39
60
|
|
|
40
61
|
### Removed (breaking)
|
|
62
|
+
|
|
41
63
|
- `targets` prop — use `poolIds` (identical `string[]` shape).
|
|
42
64
|
- `markets` prop — use `pools`; `Object.values(markets)` migrates an existing map.
|
|
43
65
|
- `defaultDirection` values `'intoTarget'` / `'outOfTarget'` — use `'buy'` / `'sell'`.
|
|
44
66
|
|
|
45
67
|
### Changed (breaking)
|
|
68
|
+
|
|
46
69
|
- Renamed `showApprovalModeControl` → `showApprovalMode`, pairing it with
|
|
47
70
|
`defaultApprovalMode`.
|
|
48
71
|
|
|
49
72
|
### Migration
|
|
73
|
+
|
|
50
74
|
- `targets={ids}` → `poolIds={ids}`
|
|
51
75
|
- `markets={map}` → `pools={Object.values(map)}`
|
|
52
76
|
- `defaultDirection="intoTarget"` → `defaultDirection="buy"`
|
|
@@ -54,6 +78,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
54
78
|
- `showApprovalModeControl={x}` → `showApprovalMode={x}`
|
|
55
79
|
|
|
56
80
|
### Internal
|
|
81
|
+
|
|
57
82
|
- Refactored the widget into a `useSwapController` hook (state, derivation, and
|
|
58
83
|
hook orchestration) over a thin presentational component, decomposed the swap
|
|
59
84
|
money path into pure `src/swap/` modules (`authorizePermit`,
|
|
@@ -61,6 +86,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
61
86
|
single `useChangeEmitter` primitive. No public behavior change.
|
|
62
87
|
|
|
63
88
|
### Added
|
|
89
|
+
|
|
64
90
|
- Toast notifications as an alternative transaction-status surface: new
|
|
65
91
|
`statusSurface` prop (`'rail'` default, `'toast'`, `'both'`, `'none'`) plus
|
|
66
92
|
`toastPosition`. One toast per swap attempt morphs loading → success/error in
|
|
@@ -116,6 +142,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
116
142
|
`SubmitStatus`, `TransactionProgressState`, and the `isUserRejectedError` helper.
|
|
117
143
|
|
|
118
144
|
### Changed
|
|
145
|
+
|
|
119
146
|
- The branded header (`title`/`subtitle`) is now text-only: the Aegis logomark no longer
|
|
120
147
|
renders next to host-provided titles. Aegis attribution lives solely in the
|
|
121
148
|
"Powered by Aegis" footer.
|
|
@@ -147,6 +174,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
147
174
|
labels.
|
|
148
175
|
|
|
149
176
|
### Fixed
|
|
177
|
+
|
|
150
178
|
- Keyboard focus no longer reshapes controls: the global `:focus-visible` rule forced
|
|
151
179
|
a 6px border-radius onto every focused element, visibly squaring the circular flip
|
|
152
180
|
button; the ring now follows each element's own radius.
|
|
@@ -157,6 +185,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
157
185
|
## [0.2.0] - 2026-06-05
|
|
158
186
|
|
|
159
187
|
### Added
|
|
188
|
+
|
|
160
189
|
- Premium embeddable swap surface with collapsible trade details, route chip, token icons,
|
|
161
190
|
Ethereum light/dark assets, and host-controlled execution details.
|
|
162
191
|
- Exact-vs-max approval mode support, defaulting to exact approvals with Permit2 fallback.
|
|
@@ -166,6 +195,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
166
195
|
organized under `tests/`.
|
|
167
196
|
|
|
168
197
|
### Changed
|
|
198
|
+
|
|
169
199
|
- The public widget entrypoint now delegates to focused widget modules instead of carrying
|
|
170
200
|
the entire implementation in `src/index.tsx`.
|
|
171
201
|
- Quote and router encoding paths are hardened around calldata construction, stale quote
|
|
@@ -174,12 +204,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
174
204
|
- The default approval mode is `exact`; hosts can still opt into `max`.
|
|
175
205
|
|
|
176
206
|
### Deprecated
|
|
207
|
+
|
|
177
208
|
- `targets` remains available as a backwards-compatible alias for `poolIds` and will be
|
|
178
209
|
removed in `0.3.0`.
|
|
179
210
|
|
|
180
211
|
## [0.1.3] - 2026-06-05
|
|
181
212
|
|
|
182
213
|
### Added
|
|
214
|
+
|
|
183
215
|
- Per-chain internal fee: `fee` field on `AegisSwapChainConfig`, so the output-token
|
|
184
216
|
fee applies to any bundled chain that sets one (mainnet keeps its 50 bps fee).
|
|
185
217
|
- Package metadata (`license`, `repository`, `homepage`, `bugs`, `keywords`) and a
|
|
@@ -190,6 +222,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
190
222
|
tarballs always contain a fresh build.
|
|
191
223
|
|
|
192
224
|
### Changed
|
|
225
|
+
|
|
193
226
|
- `resolveWidgetFee` now reads the per-chain `fee` from the resolved chain config
|
|
194
227
|
instead of hardcoding Ethereum mainnet. Default mainnet behavior is unchanged.
|
|
195
228
|
- Swap submission re-quotes immediately before building calldata so the on-chain
|
|
@@ -200,6 +233,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
200
233
|
from the bundle).
|
|
201
234
|
|
|
202
235
|
### Removed
|
|
236
|
+
|
|
203
237
|
- `dist/` build artifacts are no longer committed to git (rebuilt on pack/publish).
|
|
204
238
|
|
|
205
239
|
## [0.1.2] - 2026-06-04
|
|
@@ -209,16 +243,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
209
243
|
> next published version.
|
|
210
244
|
|
|
211
245
|
### Added
|
|
246
|
+
|
|
212
247
|
- Adjustable internal widget swap fee, fixed to Ethereum mainnet (50 bps).
|
|
213
248
|
- Exact-output swaps and a 5-second quote refresh.
|
|
214
249
|
- Per-chain Uniswap v4 contract config (`UNISWAP_V4_CONTRACTS_BY_CHAIN`).
|
|
215
250
|
|
|
216
251
|
### Changed
|
|
252
|
+
|
|
217
253
|
- Display token amounts are rounded (local only; not in the published 0.1.2 tarball).
|
|
218
254
|
|
|
219
255
|
## [0.1.0] - 2026-06-04
|
|
220
256
|
|
|
221
257
|
### Added
|
|
258
|
+
|
|
222
259
|
- Initial embeddable direct-pool Aegis swap widget for WATER, WOOD, GRASS, and STONE.
|
|
223
260
|
- Generic pool widget API; ERC-20 → Permit2 approval and Permit2 batch signing.
|
|
224
261
|
|
package/README.md
CHANGED
|
@@ -4,9 +4,9 @@ Embeddable React swap widget for Aegis direct pools. Import the component, impor
|
|
|
4
4
|
|
|
5
5
|
The host app normally only renders `<AegisSwapWidget />`. Quoting, token approval, Permit2 signing, and swap submission are handled inside the widget.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
creates an exact-output swap. Active quotes refresh
|
|
9
|
-
amount is valid.
|
|
7
|
+
In the direct-pool widget, typing in the Sell field creates an exact-input swap
|
|
8
|
+
and typing in the Buy field creates an exact-output swap. Active quotes refresh
|
|
9
|
+
every five seconds while the amount is valid.
|
|
10
10
|
|
|
11
11
|
Widget swaps apply an internal output-token fee per configured chain. The bundled
|
|
12
12
|
Ethereum mainnet config carries a fixed 50 bps fee to
|
|
@@ -48,8 +48,9 @@ Token icons are hydrated from the same metadata table used by the Aegis website:
|
|
|
48
48
|
pool config, approvals, Permit2 authorization, swap submission, and callbacks.
|
|
49
49
|
|
|
50
50
|
Demo wallets, fake transaction flows, scenario controls, and mock host shells
|
|
51
|
-
belong in the
|
|
52
|
-
props, so an embedded widget cannot accidentally
|
|
51
|
+
belong in the playground app (`apps/playground` in this monorepo). They are not
|
|
52
|
+
exposed as production widget props, so an embedded widget cannot accidentally
|
|
53
|
+
run in a fake mode.
|
|
53
54
|
|
|
54
55
|
Hosts should customize through `pools`, `chains`, `rpcUrls`,
|
|
55
56
|
`metadataEndpoint`, wallet/provider callbacks, status surfaces, `accentColor`,
|
|
@@ -90,26 +91,19 @@ tokens — is documented in [DESIGN.md](./DESIGN.md).
|
|
|
90
91
|
|
|
91
92
|
## Configure Pools
|
|
92
93
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
Out of the box, `<AegisSwapWidget />` exposes the bundled WATER, WOOD, GRASS,
|
|
95
|
+
and STONE mainnet pools. Use `poolIds` when a host wants a different built-in
|
|
96
|
+
pool order or subset:
|
|
96
97
|
|
|
97
98
|
```tsx
|
|
98
|
-
import { AegisSwapWidget
|
|
99
|
+
import { AegisSwapWidget } from 'aegis-swap-widget'
|
|
99
100
|
import 'aegis-swap-widget/styles.css'
|
|
100
101
|
|
|
101
|
-
const pools = [
|
|
102
|
-
AEGIS_SWAP_MARKETS.WATER_USDC,
|
|
103
|
-
AEGIS_SWAP_MARKETS.WOOD_USDC,
|
|
104
|
-
AEGIS_SWAP_MARKETS.GRASS_USDC,
|
|
105
|
-
AEGIS_SWAP_MARKETS.STONE_USDC,
|
|
106
|
-
]
|
|
107
|
-
|
|
108
102
|
export function Swap() {
|
|
109
103
|
return (
|
|
110
104
|
<AegisSwapWidget
|
|
111
|
-
pools={pools}
|
|
112
105
|
defaultPoolId="WATER_USDC"
|
|
106
|
+
poolIds={['WATER_USDC', 'WOOD_USDC', 'GRASS_USDC', 'STONE_USDC']}
|
|
113
107
|
theme="dark"
|
|
114
108
|
accentColor="#31d48a"
|
|
115
109
|
/>
|
|
@@ -117,16 +111,68 @@ export function Swap() {
|
|
|
117
111
|
}
|
|
118
112
|
```
|
|
119
113
|
|
|
120
|
-
Use `defaultPoolId` to choose which pool opens first
|
|
114
|
+
Use `defaultPoolId` to choose which pool opens first:
|
|
121
115
|
|
|
122
116
|
```tsx
|
|
123
|
-
<AegisSwapWidget
|
|
124
|
-
pools={pools}
|
|
125
|
-
defaultPoolId="GRASS_USDC"
|
|
126
|
-
poolIds={['GRASS_USDC', 'WATER_USDC']}
|
|
127
|
-
/>
|
|
117
|
+
<AegisSwapWidget defaultPoolId="GRASS_USDC" />
|
|
128
118
|
```
|
|
129
119
|
|
|
120
|
+
## Aggregated Token Presets
|
|
121
|
+
|
|
122
|
+
`AegisAggregatedSwapWidget` exposes only the tokens passed through its `tokens`
|
|
123
|
+
prop. The bundled widget currently defaults to the Wolf Game preset:
|
|
124
|
+
|
|
125
|
+
- `USDC`
|
|
126
|
+
- `ETH`
|
|
127
|
+
- `WATER`
|
|
128
|
+
- `WOOD`
|
|
129
|
+
- `GRASS`
|
|
130
|
+
- `STONE`
|
|
131
|
+
|
|
132
|
+
The general Ethereum preset is exported for hosts that want the standard list:
|
|
133
|
+
|
|
134
|
+
- `USDC`
|
|
135
|
+
- `USDT`
|
|
136
|
+
- `WETH`
|
|
137
|
+
- `ETH`
|
|
138
|
+
- `WBTC`
|
|
139
|
+
- `stETH`
|
|
140
|
+
|
|
141
|
+
```tsx
|
|
142
|
+
import { AegisAggregatedSwapWidget } from 'aegis-swap-widget'
|
|
143
|
+
import {
|
|
144
|
+
AGGREGATED_SWAP_DEFAULT_TOKEN_LIST,
|
|
145
|
+
AGGREGATED_SWAP_WOLFGAME_TOKEN_LIST,
|
|
146
|
+
} from '@aegis-engine/core'
|
|
147
|
+
|
|
148
|
+
export function WolfGameSwap() {
|
|
149
|
+
return <AegisAggregatedSwapWidget tokens={AGGREGATED_SWAP_WOLFGAME_TOKEN_LIST} />
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export function DefaultEthereumSwap() {
|
|
153
|
+
return (
|
|
154
|
+
<AegisAggregatedSwapWidget
|
|
155
|
+
tokens={AGGREGATED_SWAP_DEFAULT_TOKEN_LIST}
|
|
156
|
+
defaultInputTokenSymbol="USDC"
|
|
157
|
+
defaultOutputTokenSymbol="USDT"
|
|
158
|
+
/>
|
|
159
|
+
)
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Kyber Exact-Output Limitation
|
|
164
|
+
|
|
165
|
+
`AegisAggregatedSwapWidget` is exact-input only. The KyberSwap Aggregator V1 EVM
|
|
166
|
+
route endpoint is built around `amountIn` route discovery and does not provide a
|
|
167
|
+
native exact-output route request, so the widget does not let users type a fixed
|
|
168
|
+
Buy amount for Kyber aggregated swaps.
|
|
169
|
+
|
|
170
|
+
Practically, the Sell field is editable and the Buy field displays the quoted
|
|
171
|
+
output. Direct-pool `AegisSwapWidget` can still support exact-output swaps
|
|
172
|
+
because it quotes and encodes against the Uniswap V4 pool directly.
|
|
173
|
+
|
|
174
|
+
Reference: [KyberSwap Aggregator API EVM swaps](https://docs.kyberswap.com/kyberswap-solutions/kyberswap-aggregator/aggregator-api-specification/evm-swaps).
|
|
175
|
+
|
|
130
176
|
## Fees
|
|
131
177
|
|
|
132
178
|
The widget applies an internal output-token fee per chain. Each bundled chain config
|
|
@@ -139,15 +185,42 @@ This fee is internal to the widget and is not configured by host sites — host
|
|
|
139
185
|
overrides cannot set or change it. Chains added later carry a fee only when their
|
|
140
186
|
bundled config provides one.
|
|
141
187
|
|
|
188
|
+
For `AegisAggregatedSwapWidget`, the fee is taken by the KyberSwap route itself.
|
|
189
|
+
On Ethereum mainnet, every aggregated route request includes these Kyber fee
|
|
190
|
+
parameters:
|
|
191
|
+
|
|
192
|
+
```text
|
|
193
|
+
feeAmount=50
|
|
194
|
+
chargeFeeBy=currency_out
|
|
195
|
+
isInBps=true
|
|
196
|
+
feeReceiver=0x8ea2C7de60ef1Cd4dcE64ea2DDDe2f99F0127eFC
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
`chargeFeeBy=currency_out` means the fee is collected in the output token. The
|
|
200
|
+
widget first asks Kyber for a route with those fee params, then passes Kyber's
|
|
201
|
+
returned `routeSummary` unchanged into `route/build`. The calldata returned by
|
|
202
|
+
Kyber is what the user's wallet signs, so fee collection is encoded in the
|
|
203
|
+
router transaction rather than handled by a separate widget transfer. The swap
|
|
204
|
+
recipient remains the user's wallet; the fee receiver receives the 50 bps
|
|
205
|
+
output-token fee from the routed swap.
|
|
206
|
+
|
|
207
|
+
The quoted output shown in the widget is the user's net output after Kyber's
|
|
208
|
+
fee handling. `onSubmitted` includes `feeAmount` and `feeBps` for host analytics,
|
|
209
|
+
but the widget does not render a separate fee row in Trade details.
|
|
210
|
+
|
|
211
|
+
For direct-pool `AegisSwapWidget`, the same internal output-token fee is encoded
|
|
212
|
+
directly into the Universal Router command. Exact-input direct swaps use a
|
|
213
|
+
`TAKE_PORTION` output leg before the user's output `TAKE`.
|
|
214
|
+
|
|
142
215
|
For custom assets, provide full pool and token metadata:
|
|
143
216
|
|
|
144
217
|
```tsx
|
|
218
|
+
import { AegisSwapWidget } from 'aegis-swap-widget'
|
|
145
219
|
import {
|
|
146
|
-
AegisSwapWidget,
|
|
147
220
|
AEGIS_DYNAMIC_FEE_FLAG,
|
|
148
221
|
AEGIS_SWAP_HOOK,
|
|
149
222
|
type AegisSwapPoolConfig,
|
|
150
|
-
} from 'aegis-
|
|
223
|
+
} from '@aegis-engine/core'
|
|
151
224
|
|
|
152
225
|
const pools: AegisSwapPoolConfig[] = [
|
|
153
226
|
{
|
|
@@ -204,14 +277,15 @@ import { mainnet } from 'viem/chains'
|
|
|
204
277
|
/>
|
|
205
278
|
```
|
|
206
279
|
|
|
207
|
-
Uniswap v4 deployments are configured per chain.
|
|
280
|
+
Uniswap v4 deployments are configured per chain. `@aegis-engine/core` exports
|
|
208
281
|
`UNISWAP_V4_CONTRACTS_BY_CHAIN` for the supported mainnet deployments listed in
|
|
209
282
|
the official Uniswap v4 deployment docs: Ethereum, Optimism, Unichain, Polygon,
|
|
210
283
|
Base, and Arbitrum.
|
|
211
284
|
|
|
212
285
|
```tsx
|
|
213
286
|
import { base } from 'viem/chains'
|
|
214
|
-
import {
|
|
287
|
+
import { AegisSwapWidget } from 'aegis-swap-widget'
|
|
288
|
+
import { UNISWAP_V4_CONTRACTS_BY_CHAIN } from '@aegis-engine/core'
|
|
215
289
|
|
|
216
290
|
<AegisSwapWidget
|
|
217
291
|
chainId={8453}
|
|
@@ -351,7 +425,7 @@ the pending/mining shimmer is always a full-width top-border sweep.
|
|
|
351
425
|
|
|
352
426
|
Errors never appear in `status` (the submit machine resets to `'idle'`); read
|
|
353
427
|
them from `progress === 'error'` plus `error`. For classifying the raw `Error`
|
|
354
|
-
from `onError`, `isUserRejectedError`
|
|
428
|
+
from `onError`, import `isUserRejectedError` from `@aegis-engine/core`.
|
|
355
429
|
|
|
356
430
|
Success clears itself after confirming (by default a 3s hold plus the 420ms
|
|
357
431
|
rail fade-out), the widget resets and emits a final
|
|
@@ -579,7 +653,7 @@ function Swap() {
|
|
|
579
653
|
|
|
580
654
|
## Default Markets
|
|
581
655
|
|
|
582
|
-
The
|
|
656
|
+
The widget includes built-in mainnet direct-pool configs for:
|
|
583
657
|
|
|
584
658
|
- `USDC / WATER`
|
|
585
659
|
- `USDC / WOOD`
|
|
@@ -587,8 +661,8 @@ The package ships mainnet direct-pool configs for:
|
|
|
587
661
|
- `USDC / STONE`
|
|
588
662
|
|
|
589
663
|
These use the Aegis mainnet router `0x00581261a1200956ea05d1810fF28ffd66D8E254`
|
|
590
|
-
and the Ethereum
|
|
591
|
-
|
|
664
|
+
and the Ethereum Uniswap v4 Permit2 and Quoter addresses from
|
|
665
|
+
`@aegis-engine/core`.
|
|
592
666
|
|
|
593
667
|
## License
|
|
594
668
|
|
|
@@ -597,23 +671,20 @@ MIT.
|
|
|
597
671
|
## Local Demo
|
|
598
672
|
|
|
599
673
|
```bash
|
|
600
|
-
|
|
601
|
-
|
|
674
|
+
pnpm install # at the monorepo root
|
|
675
|
+
pnpm --filter aegis-swap-widget dev
|
|
602
676
|
```
|
|
603
677
|
|
|
604
678
|
## Releasing
|
|
605
679
|
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
680
|
+
Releases are automated with [changesets](https://github.com/changesets/changesets)
|
|
681
|
+
from the monorepo root — no manual `npm version`/`npm publish`. `dist/` is not
|
|
682
|
+
committed; the `prepack` hook rebuilds it on every pack/publish, and
|
|
683
|
+
`prepublishOnly` runs the typecheck + test gate.
|
|
609
684
|
|
|
610
685
|
```bash
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
# Move CHANGELOG [Unreleased] entries under the new version heading.
|
|
615
|
-
npm version minor # e.g. 0.2.1 -> 0.3.0 for a breaking 0.x release; commits and tags vX.Y.Z
|
|
616
|
-
git push origin main --follow-tags
|
|
617
|
-
npm publish --access public # prepublishOnly gate + prepack build run automatically
|
|
686
|
+
pnpm changeset # in your PR: pick aegis-swap-widget + bump, write the entry
|
|
687
|
+
# Merge the PR; the Release workflow opens a "Version Packages" PR on main.
|
|
688
|
+
# Merging that PR publishes to npm via OIDC trusted publishing.
|
|
618
689
|
npm view aegis-swap-widget version
|
|
619
690
|
```
|
package/dist/abis.d.ts
CHANGED
|
@@ -1,76 +1,3 @@
|
|
|
1
|
-
export declare const AEGIS_ROUTER_ABI: readonly [{
|
|
2
|
-
readonly type: "function";
|
|
3
|
-
readonly name: "execute";
|
|
4
|
-
readonly stateMutability: "payable";
|
|
5
|
-
readonly inputs: readonly [{
|
|
6
|
-
readonly name: "batches";
|
|
7
|
-
readonly type: "tuple[]";
|
|
8
|
-
readonly components: readonly [{
|
|
9
|
-
readonly name: "requiresV4Unlock";
|
|
10
|
-
readonly type: "bool";
|
|
11
|
-
}, {
|
|
12
|
-
readonly name: "actions";
|
|
13
|
-
readonly type: "bytes";
|
|
14
|
-
}, {
|
|
15
|
-
readonly name: "params";
|
|
16
|
-
readonly type: "bytes[]";
|
|
17
|
-
}];
|
|
18
|
-
}, {
|
|
19
|
-
readonly name: "deadline";
|
|
20
|
-
readonly type: "uint256";
|
|
21
|
-
}];
|
|
22
|
-
readonly outputs: readonly [];
|
|
23
|
-
}, {
|
|
24
|
-
readonly type: "function";
|
|
25
|
-
readonly name: "multicall";
|
|
26
|
-
readonly stateMutability: "payable";
|
|
27
|
-
readonly inputs: readonly [{
|
|
28
|
-
readonly name: "data";
|
|
29
|
-
readonly type: "bytes[]";
|
|
30
|
-
}];
|
|
31
|
-
readonly outputs: readonly [{
|
|
32
|
-
readonly name: "results";
|
|
33
|
-
readonly type: "bytes[]";
|
|
34
|
-
}];
|
|
35
|
-
}, {
|
|
36
|
-
readonly type: "function";
|
|
37
|
-
readonly name: "permitBatch";
|
|
38
|
-
readonly stateMutability: "payable";
|
|
39
|
-
readonly inputs: readonly [{
|
|
40
|
-
readonly name: "owner";
|
|
41
|
-
readonly type: "address";
|
|
42
|
-
}, {
|
|
43
|
-
readonly name: "permitBatch";
|
|
44
|
-
readonly type: "tuple";
|
|
45
|
-
readonly components: readonly [{
|
|
46
|
-
readonly name: "details";
|
|
47
|
-
readonly type: "tuple[]";
|
|
48
|
-
readonly components: readonly [{
|
|
49
|
-
readonly name: "token";
|
|
50
|
-
readonly type: "address";
|
|
51
|
-
}, {
|
|
52
|
-
readonly name: "amount";
|
|
53
|
-
readonly type: "uint160";
|
|
54
|
-
}, {
|
|
55
|
-
readonly name: "expiration";
|
|
56
|
-
readonly type: "uint48";
|
|
57
|
-
}, {
|
|
58
|
-
readonly name: "nonce";
|
|
59
|
-
readonly type: "uint48";
|
|
60
|
-
}];
|
|
61
|
-
}, {
|
|
62
|
-
readonly name: "spender";
|
|
63
|
-
readonly type: "address";
|
|
64
|
-
}, {
|
|
65
|
-
readonly name: "sigDeadline";
|
|
66
|
-
readonly type: "uint256";
|
|
67
|
-
}];
|
|
68
|
-
}, {
|
|
69
|
-
readonly name: "signature";
|
|
70
|
-
readonly type: "bytes";
|
|
71
|
-
}];
|
|
72
|
-
readonly outputs: readonly [];
|
|
73
|
-
}];
|
|
74
1
|
export declare const PERMIT2_ABI: readonly [{
|
|
75
2
|
readonly type: "function";
|
|
76
3
|
readonly name: "approve";
|