aegis-swap-widget 0.13.1 → 0.14.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 +45 -0
- package/README.md +81 -1
- package/dist/{EngineTradeMarketChart-bxvPeAQ3.js → EngineTradeMarketChart-Tbh8S8n8.js} +1 -1
- package/dist/aegis-swap-widget.js +1 -1
- package/dist/{index-CvIQ_zY8.js → index-D7y-EnqT.js} +11947 -11967
- package/dist/styles.css +1 -1
- package/dist/widget/engine-controller/engineActionState.d.ts +3 -3
- package/dist/widget/engine-controller/engineDisplay.d.ts +5 -9
- package/dist/widget/engine-controller/enginePositionManageCopy.d.ts +2 -1
- package/dist/widget/engine-controller/engineQuoteFetch.d.ts +5 -1
- package/dist/widget/engine-controller/useEngineFills.d.ts +1 -2
- package/dist/widget/engine-ui/EngineBorrowLimits.d.ts +8 -0
- package/dist/widget/engine-ui/EngineNotice.d.ts +2 -0
- package/dist/widget/types.d.ts +6 -0
- package/dist/widget/useEngineController.d.ts +8 -4
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,50 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.14.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 8c80e3c: Add Aegis-only smart routing through KyberSwap. With `liquiditySources: 'aegis'`
|
|
8
|
+
on `fetchAggregatedSwapQuote` and `executeKyberSwap`, or with
|
|
9
|
+
`liquiditySources="aegis"` on `AegisAggregatedSwapWidget`, Kyber is asked only
|
|
10
|
+
for `uniswap-v4-aegis` liquidity. Every route hop must carry that tag, checked
|
|
11
|
+
before build and again before signing; otherwise the swap fails closed with
|
|
12
|
+
`NoAegisRouteError`. The widget shows "No Aegis route" when no all-Aegis path
|
|
13
|
+
exists. Aggregated routes now also run on BNB Smart Chain, Unichain and Base,
|
|
14
|
+
with the Kyber router bytecode pinned on each chain. Builds now reserve 1 bp of
|
|
15
|
+
the slippage tolerance, because Kyber's `/route/build` reprices about 1 wei
|
|
16
|
+
below `/routes`.
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies [8c80e3c]
|
|
21
|
+
- @aegis-engine/core@0.10.0
|
|
22
|
+
|
|
23
|
+
## 0.13.2
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- 5a3889f: Show SDK-derived collateral and market borrowing limits with explicit unavailable
|
|
28
|
+
and refreshing states. Explain selected markets that cannot borrow or lend, and
|
|
29
|
+
document the existing balanced-lending and protected review integration.
|
|
30
|
+
Custom sizing uses an SDK capacity quote without a market-liquidity fallback,
|
|
31
|
+
and keeps the collateral-capacity read independent of the Custom output draft.
|
|
32
|
+
Simple sizing preserves target-specific collateral floors and compatible limits,
|
|
33
|
+
including when returning to a freshly cached request.
|
|
34
|
+
|
|
35
|
+
Announce changing numeric borrowing limits without replaying unchanged labels.
|
|
36
|
+
Keep loan health indicators scoped to compatible inputs, shorten onboarding and
|
|
37
|
+
permission-dialog dismissal, and improve Engine account, review and trade-share
|
|
38
|
+
touch feedback and reduced-motion behavior.
|
|
39
|
+
|
|
40
|
+
Display independently quoted capacity before connection while keeping wallet
|
|
41
|
+
bounds unavailable. Allow Custom Borrow fills from a ready SDK token bound when
|
|
42
|
+
USD prices are unavailable; dollar-valued room and health remain unknown.
|
|
43
|
+
|
|
44
|
+
- Updated dependencies [2b83546]
|
|
45
|
+
- Updated dependencies [f2fc4c5]
|
|
46
|
+
- @aegis-engine/core@0.9.2
|
|
47
|
+
|
|
3
48
|
## 0.13.1
|
|
4
49
|
|
|
5
50
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -74,6 +74,65 @@ export function Engine({ account, provider }) {
|
|
|
74
74
|
}
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
+
### Borrow and Lend integration
|
|
78
|
+
|
|
79
|
+
Use the existing Engine surfaces for a lending-focused embed. Include Positions
|
|
80
|
+
so users can return to their loans and deposits:
|
|
81
|
+
|
|
82
|
+
```tsx
|
|
83
|
+
<AegisEngineWidget
|
|
84
|
+
account={account}
|
|
85
|
+
provider={provider}
|
|
86
|
+
chains={engineChains}
|
|
87
|
+
engineDataSource={{ kind: 'rest', baseUrl: '/api/engine' }}
|
|
88
|
+
surfaces={['buy', 'borrow', 'lend', 'positions']}
|
|
89
|
+
defaultSurface="borrow"
|
|
90
|
+
balancedLending={{ nativeGasReserve: hostNativeReserve }}
|
|
91
|
+
/>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
The market reader supplies `borrowEnabled` / `lendEnabled`; optional
|
|
95
|
+
`canBorrow` / `canLend` capability values must be `true` to enable the action.
|
|
96
|
+
Missing readiness fails closed. Listing a surface does not enable an
|
|
97
|
+
unready market. A selected market that cannot support the action has an explicit
|
|
98
|
+
unavailable state; existing positions can still be inspected in Positions.
|
|
99
|
+
|
|
100
|
+
Simple Borrow shows the SDK's wallet/collateral limit separately from its market
|
|
101
|
+
limit in the Borrowing limit disclosure. Independently quoted limits can appear
|
|
102
|
+
before connecting; wallet-specific bounds remain unavailable until the wallet
|
|
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
|
|
105
|
+
price is unavailable; dollar-denominated room and health stay unavailable. Editing
|
|
106
|
+
the Custom borrow amount refreshes its
|
|
107
|
+
execution quote without repeating the collateral-capacity read. Simple Borrow
|
|
108
|
+
retains compatible limits while requesting a new target-specific collateral floor.
|
|
109
|
+
Changes to the wallet, market,
|
|
110
|
+
collateral, token side, vault or risk settings invalidate those limits immediately;
|
|
111
|
+
failed or stale capacity cannot describe current utilization. Submission always
|
|
112
|
+
requires a fresh quote for the requested amount.
|
|
113
|
+
|
|
114
|
+
The Custom capacity meter may retain its last fill during a compatible collateral
|
|
115
|
+
refresh. Wallet, network, market, pool, token-side, flow or risk changes reset it.
|
|
116
|
+
This visual continuity never makes unknown capacity executable. Updated numeric
|
|
117
|
+
borrowing limits are announced politely together with their labels.
|
|
118
|
+
|
|
119
|
+
The tighter known limit explains the constraint. Missing prices, failed reads,
|
|
120
|
+
wallet changes and a refreshing capacity quote never turn market liquidity into
|
|
121
|
+
the user's borrowing power. The amount review uses the Engine quote's collateral,
|
|
122
|
+
received assets, projected LTV and current/projected variable rate; the selected
|
|
123
|
+
term is a cost assumption, not a fixed-rate loan or liquidation countdown.
|
|
124
|
+
|
|
125
|
+
Single-token Lend includes any internal balancing swap in its protected review.
|
|
126
|
+
Opting into `balancedLending` adds Both tokens and reuses the same protected
|
|
127
|
+
spend caps, minimum share output, native reserve and transaction recovery. See
|
|
128
|
+
[balanced lending](../../docs/balanced-lending.md) for the two-input semantics.
|
|
129
|
+
The playground exposes these through **Tabs** and **Both-token lending**.
|
|
130
|
+
|
|
131
|
+
The widget owns authorization, refreshed-quote review and final simulation.
|
|
132
|
+
Hosts should preserve the mounted widget during an interaction and use
|
|
133
|
+
`onInteractionLockChange` to suspend conflicting navigation. Successful wallet
|
|
134
|
+
authorization does not mean the loan or deposit has been submitted or confirmed.
|
|
135
|
+
|
|
77
136
|
## Wolf Game Trade and Earn preset
|
|
78
137
|
|
|
79
138
|
The Wolf preset reproduces the focused gamer flow: a resource Store under
|
|
@@ -744,6 +803,27 @@ because it quotes and encodes against the Uniswap V4 pool directly.
|
|
|
744
803
|
|
|
745
804
|
Reference: [KyberSwap Aggregator API EVM swaps](https://docs.kyberswap.com/kyberswap-solutions/kyberswap-aggregator/aggregator-api-specification/evm-swaps).
|
|
746
805
|
|
|
806
|
+
## Aegis-Only Smart Routing
|
|
807
|
+
|
|
808
|
+
Aggregated routes run on Ethereum (1), BNB Smart Chain (56), Unichain (130) and
|
|
809
|
+
Base (8453). Unichain and Base are not bundled chain configs, so pass them
|
|
810
|
+
through `chains` as for the direct widget.
|
|
811
|
+
|
|
812
|
+
Set `liquiditySources="aegis"` to route only through Aegis pools (Uniswap v4
|
|
813
|
+
pools that use the Aegis hook), including multi-hop paths such as
|
|
814
|
+
token → USDC → token. The default, `'any'`, keeps KyberSwap's full source set.
|
|
815
|
+
|
|
816
|
+
```tsx
|
|
817
|
+
<AegisAggregatedSwapWidget chainId={130} chains={{ 130: unichainConfig }} tokens={tokens} liquiditySources="aegis" />
|
|
818
|
+
```
|
|
819
|
+
|
|
820
|
+
In Aegis mode the widget asks Kyber for `includedSources=uniswap-v4-aegis`,
|
|
821
|
+
then refuses any route in which a hop is not tagged `uniswap-v4-aegis`. It
|
|
822
|
+
checks once before the route is built and again before the wallet is asked to
|
|
823
|
+
sign. When no all-Aegis path exists, the widget shows "No Aegis route" and
|
|
824
|
+
cannot submit. Every existing calldata check still applies. Ink is not
|
|
825
|
+
supported by Kyber yet.
|
|
826
|
+
|
|
747
827
|
## Fees
|
|
748
828
|
|
|
749
829
|
The widget applies an internal output-token fee per chain. Each bundled chain config
|
|
@@ -758,7 +838,7 @@ bundled config provides one.
|
|
|
758
838
|
|
|
759
839
|
For `AegisAggregatedSwapWidget`, the fee is taken by the KyberSwap route itself.
|
|
760
840
|
On Ethereum mainnet, every aggregated route request includes these Kyber fee
|
|
761
|
-
parameters:
|
|
841
|
+
parameters (routes on BSC, Unichain and Base carry no Kyber fee):
|
|
762
842
|
|
|
763
843
|
```text
|
|
764
844
|
feeAmount=50
|
|
@@ -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-
|
|
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-D7y-EnqT.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-
|
|
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-D7y-EnqT.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";
|