aegis-swap-widget 0.9.0 → 0.10.1
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 +60 -0
- package/README.md +125 -53
- package/dist/aegis-swap-widget.js +16247 -11935
- package/dist/components/Sparkline.d.ts +5 -1
- package/dist/format.d.ts +11 -0
- package/dist/hooks/useSubmitSwap.d.ts +46 -3
- package/dist/hooks/useSubmittedReceiptRecovery.d.ts +25 -0
- package/dist/hooks/useTokenAllowance.d.ts +5 -1
- package/dist/index.d.ts +3 -1
- package/dist/presets/wolf-game.js +138 -0
- package/dist/presets/wolfGame.d.ts +119 -0
- package/dist/styles.css +1 -1
- package/dist/submittedSwapContext.d.ts +19 -0
- package/dist/toast/useSwipeDismiss.d.ts +3 -1
- package/dist/transactionProgress.d.ts +1 -1
- package/dist/widget/AmountField.d.ts +1 -1
- package/dist/widget/AmountUnitToggle.d.ts +12 -0
- package/dist/widget/ProgressRail.d.ts +3 -1
- package/dist/widget/SwapFormBody.d.ts +2 -1
- package/dist/widget/SwapWidgetShell.d.ts +3 -1
- package/dist/widget/TransactionStepList.d.ts +5 -0
- package/dist/widget/engine-controller/engineActionExpiry.d.ts +11 -0
- package/dist/widget/engine-controller/engineCtaLabel.d.ts +6 -1
- package/dist/widget/engine-controller/engineDisplay.d.ts +77 -3
- package/dist/widget/engine-controller/engineLendCopy.d.ts +157 -0
- package/dist/widget/engine-controller/engineLifecycle.d.ts +15 -19
- package/dist/widget/engine-controller/enginePermissionFamilies.d.ts +13 -1
- package/dist/widget/engine-controller/enginePositionManageCopy.d.ts +16 -6
- package/dist/widget/engine-controller/engineRequoteGuard.d.ts +5 -0
- package/dist/widget/engine-controller/engineTransactionProgress.d.ts +9 -4
- package/dist/widget/engine-controller/engineYieldAmount.d.ts +27 -0
- package/dist/widget/engine-controller/useEngineBuySwapProps.d.ts +3 -1
- package/dist/widget/engine-controller/useEnginePositionActions.d.ts +52 -2
- package/dist/widget/engine-controller/useEnginePositions.d.ts +15 -3
- package/dist/widget/engine-controller/useEngineSubmit.d.ts +54 -6
- package/dist/widget/engine-ui/EngineBuyPanel.d.ts +7 -2
- package/dist/widget/engine-ui/EngineLendPositionCard.d.ts +24 -2
- package/dist/widget/engine-ui/EngineMarketDialog.d.ts +3 -1
- package/dist/widget/engine-ui/EnginePermissionRailRow.d.ts +1 -0
- package/dist/widget/engine-ui/EnginePositionManageDialog.d.ts +4 -1
- package/dist/widget/engine-ui/EngineReservedShell.d.ts +3 -1
- package/dist/widget/engine-ui/EngineSimpleYieldPanel.d.ts +14 -0
- package/dist/widget/engine-ui/EngineStorePanel.d.ts +14 -0
- package/dist/widget/engine-ui/EngineTransactionReceipt.d.ts +8 -1
- package/dist/widget/engine-ui/enginePermissionCopy.d.ts +12 -3
- package/dist/widget/engine-ui/useLendCopy.d.ts +24 -0
- package/dist/widget/transactionSteps.d.ts +44 -0
- package/dist/widget/types.d.ts +118 -11
- package/dist/widget/useAggregatedSwapController.d.ts +1 -1
- package/dist/widget/useEngineController.d.ts +56 -3
- package/dist/widget/useStatusSurface.d.ts +17 -1
- package/dist/widget/useSwapController.d.ts +12 -2
- package/dist/widget/viewState.d.ts +5 -2
- package/package.json +8 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,65 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.10.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 57b9f65: Wolf Game launch feedback: the Wolf preset stops rendering the game-signal strip above the surfaces (weather and community readouts live in the game), the store sheet keeps a drafted quantity when flipping Buy/Sell and defaults its balance readout to resource units behind a '#'/'$' toggle, and the simple-yield form defaults to token-unit entry, labels the field "Deposit Amount" with a "Deposit" submit in the Wolf preset, and shows the available balance in dollars and units together.
|
|
8
|
+
|
|
9
|
+
## 0.10.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 3429c86: Launch the focused Wolf Game Trade and Earn integration without coupling the
|
|
14
|
+
SDK packages to the playground host.
|
|
15
|
+
|
|
16
|
+
Core now exports `summarizeEngineSimpleYieldPosition` for React-free lender
|
|
17
|
+
share valuation, add-funds projection, and realized historical weekly growth.
|
|
18
|
+
It uses live shares when available, falls back to trusted indexed shares, and
|
|
19
|
+
never presents the market's modeled `lendApyPct` as realized earnings. Core also
|
|
20
|
+
classifies RPC simulation failures for wallet-safe preflight messaging and
|
|
21
|
+
re-quotes direct swaps after permissions settle before submission.
|
|
22
|
+
|
|
23
|
+
Widget adds the Store buy presentation and the `simple-yield` Earn
|
|
24
|
+
presentation, including compact position growth, historical earnings context,
|
|
25
|
+
transparent partial withdrawals, stable loading states, and transaction-step
|
|
26
|
+
progress. The new `aegis-swap-widget/presets/wolf-game` export provides the
|
|
27
|
+
four-resource catalogue, focused defaults, and a helper that keeps the Store
|
|
28
|
+
pool and Earn market synchronized from one controlled resource.
|
|
29
|
+
|
|
30
|
+
The generic opt-in capabilities remain available to other hosts:
|
|
31
|
+
`surfaceLabels` renames exposed tabs, `lendPresentation` selects a built-in
|
|
32
|
+
plain-language presentation, and `onInteractionLockChange` reports when host
|
|
33
|
+
navigation must stay fixed.
|
|
34
|
+
|
|
35
|
+
Add the opt-in `showTransactionSteps` prop to Swap and Engine. It renders a
|
|
36
|
+
compact ordered wallet journey only while an action is active, with the total
|
|
37
|
+
step count, completed steps, current wallet or network wait, and the next step.
|
|
38
|
+
The Wolf Game preset enables it for Trade and Earn.
|
|
39
|
+
|
|
40
|
+
Trade rechecks price after wallet permissions without weakening the reviewed
|
|
41
|
+
protection or exceeding the signed spend cap. Receipt recovery keeps an
|
|
42
|
+
unconfirmed permission transaction on its permission step instead of implying
|
|
43
|
+
that the final Trade or Earn action was submitted.
|
|
44
|
+
|
|
45
|
+
`lendPresentation` selects a built-in lexicon, exported as `AegisEngineLendCopy`
|
|
46
|
+
and overridable per string through the new `lendCopy` prop. Hosts supply their
|
|
47
|
+
own vocabulary rather than inheriting another integration's.
|
|
48
|
+
|
|
49
|
+
`marketId` and `defaultMarketId` now compare `evm_`-prefixed ids case
|
|
50
|
+
insensitively inside the widget, so externally supplied casing cannot lose a
|
|
51
|
+
controlled market selection. Uncontrolled hosts are unaffected — both sides of
|
|
52
|
+
that comparison come from the same market list.
|
|
53
|
+
|
|
54
|
+
Use these in the Wolf Game preview to launch a focused Trade and Earn flow,
|
|
55
|
+
keep one resource selected across both actions, and leave the game dashboard
|
|
56
|
+
context behind an explicit optional Showroom mode.
|
|
57
|
+
|
|
58
|
+
### Patch Changes
|
|
59
|
+
|
|
60
|
+
- Updated dependencies [3429c86]
|
|
61
|
+
- @aegis-engine/core@0.6.0
|
|
62
|
+
|
|
3
63
|
## 0.9.0
|
|
4
64
|
|
|
5
65
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -60,6 +60,83 @@ export function Engine({ account, provider }) {
|
|
|
60
60
|
}
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
+
## Wolf Game Trade and Earn preset
|
|
64
|
+
|
|
65
|
+
The Wolf preset reproduces the focused gamer flow: a resource Store under
|
|
66
|
+
**Trade** and one-token full-range liquidity under **Earn**. It hides DeFi
|
|
67
|
+
plumbing by default, but it does not hide execution protection or withdrawal
|
|
68
|
+
outputs.
|
|
69
|
+
|
|
70
|
+
The preset is React-free and is available from a small dedicated export. The
|
|
71
|
+
host still owns wallet connection, data routes, selected resource, navigation,
|
|
72
|
+
and lifecycle callbacks:
|
|
73
|
+
|
|
74
|
+
```tsx
|
|
75
|
+
import * as React from 'react'
|
|
76
|
+
import { AegisEngineWidget } from 'aegis-swap-widget'
|
|
77
|
+
import {
|
|
78
|
+
WOLF_GAME_ENGINE_WIDGET_PRESET,
|
|
79
|
+
WOLF_GAME_RESOURCE_ORDER,
|
|
80
|
+
wolfGameResourceWidgetProps,
|
|
81
|
+
type WolfGameResourceSymbol
|
|
82
|
+
} from 'aegis-swap-widget/presets/wolf-game'
|
|
83
|
+
import 'aegis-swap-widget/styles.css'
|
|
84
|
+
|
|
85
|
+
export function WolfTradeAndEarn({ account, provider }) {
|
|
86
|
+
const [resource, setResource] = React.useState<WolfGameResourceSymbol>('GRASS')
|
|
87
|
+
const [interactionLocked, setInteractionLocked] = React.useState(false)
|
|
88
|
+
const resourceProps = React.useMemo(
|
|
89
|
+
() => wolfGameResourceWidgetProps(resource, setResource),
|
|
90
|
+
[resource]
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
<AegisEngineWidget
|
|
95
|
+
{...WOLF_GAME_ENGINE_WIDGET_PRESET}
|
|
96
|
+
{...resourceProps}
|
|
97
|
+
account={account}
|
|
98
|
+
provider={provider}
|
|
99
|
+
chains={engineChains}
|
|
100
|
+
engineDataSource={{ kind: 'rest', baseUrl: '/api/engine/wolf' }}
|
|
101
|
+
backendBaseUrl="/api/aegis"
|
|
102
|
+
onInteractionLockChange={setInteractionLocked}
|
|
103
|
+
resourceNavigation={
|
|
104
|
+
<nav aria-label="Resource">
|
|
105
|
+
{WOLF_GAME_RESOURCE_ORDER.map((symbol) => (
|
|
106
|
+
<button
|
|
107
|
+
key={symbol}
|
|
108
|
+
type="button"
|
|
109
|
+
aria-pressed={resource === symbol}
|
|
110
|
+
disabled={interactionLocked}
|
|
111
|
+
onClick={() => setResource(symbol)}
|
|
112
|
+
>
|
|
113
|
+
{symbol}
|
|
114
|
+
</button>
|
|
115
|
+
))}
|
|
116
|
+
</nav>
|
|
117
|
+
}
|
|
118
|
+
/>
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
`engineDataSource` must expose Wolf-scoped Engine markets, positions, activity,
|
|
124
|
+
and history. `backendBaseUrl` is a separate Swap data plane and must expose
|
|
125
|
+
`/v1/config`, `/v1/markets`, `/v1/tokens`, and token price history. Do not point
|
|
126
|
+
both props at a route that implements only the Engine endpoints.
|
|
127
|
+
|
|
128
|
+
`wolfGameResourceWidgetProps` controls the Store pool and Earn market from one
|
|
129
|
+
resource. It ignores an unknown Store pool instead of selecting an unrelated
|
|
130
|
+
market. Spread the preset first, then the controlled resource props, and put
|
|
131
|
+
host callbacks last when they intentionally override a default.
|
|
132
|
+
|
|
133
|
+
The Wolf preset defaults `partnerContextVariant` to `embedded`, so it renders no
|
|
134
|
+
standing game context above Trade and Earn. The published widget does not call
|
|
135
|
+
Wolf Game itself. Hosts that opt into `partnerContextVariant="signal"` or
|
|
136
|
+
`"showroom"` pass their server-normalized data through `partnerContext`; the
|
|
137
|
+
signal places one game-condition line directly below the surface tabs. The
|
|
138
|
+
Playground exposes the same choice as **Off / Game signal / Details hub**.
|
|
139
|
+
|
|
63
140
|
## Trade surface
|
|
64
141
|
|
|
65
142
|
`'trade'` is opt-in. The default tab set is `['buy', 'borrow', 'lend',
|
|
@@ -164,26 +241,22 @@ submits a transaction or changes Aegis market data:
|
|
|
164
241
|
|
|
165
242
|
```tsx
|
|
166
243
|
import { AegisEngineWidget } from 'aegis-swap-widget'
|
|
167
|
-
import type {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
resourceUse: 'consumed'
|
|
183
|
-
}
|
|
184
|
-
} satisfies PartnerContext
|
|
244
|
+
import type {
|
|
245
|
+
PartnerActionRequirement,
|
|
246
|
+
PartnerContext,
|
|
247
|
+
} from 'aegis-swap-widget/partner-context'
|
|
248
|
+
|
|
249
|
+
export function GameMarket({
|
|
250
|
+
actionRequirement,
|
|
251
|
+
}: {
|
|
252
|
+
// Load this from authoritative, authenticated game state.
|
|
253
|
+
actionRequirement: PartnerActionRequirement
|
|
254
|
+
}) {
|
|
255
|
+
const partnerContext = {
|
|
256
|
+
partner: { id: 'your-game', name: 'Your Game' },
|
|
257
|
+
actionRequirement,
|
|
258
|
+
} satisfies PartnerContext
|
|
185
259
|
|
|
186
|
-
export function GameMarket() {
|
|
187
260
|
return (
|
|
188
261
|
<AegisEngineWidget
|
|
189
262
|
partnerContext={partnerContext}
|
|
@@ -220,31 +293,20 @@ to that event without duplicating its resource or amount:
|
|
|
220
293
|
|
|
221
294
|
```tsx
|
|
222
295
|
import { partnerLaunchIntentForRequirement } from 'aegis-swap-widget/partner-context'
|
|
296
|
+
import type { PartnerActionRequirement } from 'aegis-swap-widget/partner-context'
|
|
223
297
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
)
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
The equivalent launch intent is:
|
|
232
|
-
|
|
233
|
-
```ts
|
|
234
|
-
{
|
|
235
|
-
requestId: 'new-id-for-this-click',
|
|
236
|
-
source: 'action-requirement',
|
|
237
|
-
requirementId: 'upgrade-barn-water',
|
|
238
|
-
surface: 'borrow',
|
|
239
|
-
resource: {
|
|
240
|
-
chainId: 1,
|
|
241
|
-
address: '0x828B22c9ea1c20B551EeFC6198174C4bb7a8CBF6',
|
|
242
|
-
symbol: 'WATER',
|
|
243
|
-
},
|
|
244
|
-
amount: '340',
|
|
298
|
+
function createLaunchIntent(actionRequirement: PartnerActionRequirement) {
|
|
299
|
+
return partnerLaunchIntentForRequirement(
|
|
300
|
+
actionRequirement,
|
|
301
|
+
'borrow',
|
|
302
|
+
crypto.randomUUID()
|
|
303
|
+
)
|
|
245
304
|
}
|
|
246
305
|
```
|
|
247
306
|
|
|
307
|
+
The launch intent copies the validated requirement ID, resource, and shortfall.
|
|
308
|
+
Do not hardcode a sample game cost into this path.
|
|
309
|
+
|
|
248
310
|
Pass that value through `partnerLaunchIntent` and clear it after
|
|
249
311
|
`onPartnerLaunchIntentApplied`. Use a new `requestId` for each external click.
|
|
250
312
|
Borrow fills the debt token's “I need” field. Buy uses the matching direct pool
|
|
@@ -255,11 +317,13 @@ match.
|
|
|
255
317
|
Use `partnerContextVariant="embedded"` inside an existing product shell. It is
|
|
256
318
|
silent unless the host supplies an `actionRequirement`; then the widget places
|
|
257
319
|
one compact purpose row beside the active Buy or Borrow transaction content.
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
`
|
|
262
|
-
|
|
320
|
+
Use `partnerContextVariant="signal"` for one environment line without partner
|
|
321
|
+
identity, balances, activities, freshness, actions, or another dashboard.
|
|
322
|
+
Partner identity and every supplied block remain available in the default
|
|
323
|
+
`showroom` variant. If the host already owns resource selection, pass the
|
|
324
|
+
selected token through `marketResource`. The widget resolves its eligible
|
|
325
|
+
Lend/Borrow market from live Engine discovery on the active chain by exact
|
|
326
|
+
address and symbol:
|
|
263
327
|
|
|
264
328
|
```tsx
|
|
265
329
|
const wolfResources = {
|
|
@@ -290,11 +354,12 @@ widget should own selection. The nested Buy surface remains independently
|
|
|
290
354
|
controlled through `buySwapConfig`; one-shot partner Buy intents already
|
|
291
355
|
resolve their matching direct pool.
|
|
292
356
|
|
|
293
|
-
Wolf
|
|
294
|
-
|
|
295
|
-
resources, energy
|
|
296
|
-
|
|
297
|
-
from aggregate weather or
|
|
357
|
+
The current Wolf signal integration provides weather for a selected community.
|
|
358
|
+
The optional showroom adds game-wide balances. Neither mode includes
|
|
359
|
+
wallet-specific inventory, claimable resources, energy percentage, or a
|
|
360
|
+
concrete action requirement. A Wolf host must create `actionRequirement` only
|
|
361
|
+
from authoritative game state. Do not derive it from aggregate weather or
|
|
362
|
+
inventory alone.
|
|
298
363
|
|
|
299
364
|
The Engine discovery surface defaults to Amplifi's public production REST API.
|
|
300
365
|
The production source implements
|
|
@@ -338,7 +403,8 @@ and is not inferred from `inCapEvent`.
|
|
|
338
403
|
full-width sheet inside the widget's own bounds — the row stays live and
|
|
339
404
|
pressing it again (or Escape, or tapping the scrim) brings the sheet back down,
|
|
340
405
|
and the widget's height never changes. `'down'` expands the breakdown inline
|
|
341
|
-
below the CTA, growing the widget.
|
|
406
|
+
below the CTA, growing the widget. `'none'` removes the disclosure when the host
|
|
407
|
+
already explains the action or wants the smallest flow.
|
|
342
408
|
|
|
343
409
|
A lend or borrow renders one transaction lifecycle card in the form's outcome
|
|
344
410
|
slot: Review (feasible quote) → Pending (in flight) → Confirmed (mined). The
|
|
@@ -349,6 +415,10 @@ the card header on confirm. `defaultTransactionDetailsOpen` (default `true`)
|
|
|
349
415
|
sets whether the card's metric breakdown starts expanded; the Details row keeps
|
|
350
416
|
its single trigger for the quote breakdown sheet.
|
|
351
417
|
|
|
418
|
+
`lendPresentation="lp-fees"` uses the lighter game-facing lifecycle. The CTA
|
|
419
|
+
shows the pending state without repeating the reviewed amount and market, and
|
|
420
|
+
confirmation reduces to `Added` plus the transaction link.
|
|
421
|
+
|
|
352
422
|
Product semantics are deliberately conservative:
|
|
353
423
|
|
|
354
424
|
- A borrow requires an upfront collateral deposit.
|
|
@@ -1051,6 +1121,7 @@ No other props changed. See the [CHANGELOG](./CHANGELOG.md) for the full entry.
|
|
|
1051
1121
|
- `approvalMode`: controlled Engine approval mode (`'exact'` or `'max'`). Omit it to initialize internal state from `defaultApprovalMode`.
|
|
1052
1122
|
- `onApprovalModeChange`: fired when the Engine approval mode changes. A controlled host must update `approvalMode` in response.
|
|
1053
1123
|
- `showExecutionDetails`: whether to render the collapsible drawer for trade details and, after a confirmed swap, the session-local Latest tx receipt. Defaults to `true`.
|
|
1124
|
+
- `showTransactionSteps`: whether to show a compact completed/current/next checklist while a Trade, Earn, or Borrow transaction is active. Defaults to `false`; the Wolf Game preset enables it.
|
|
1054
1125
|
- `defaultExecutionDetailsOpen`: whether that settings drawer starts expanded. Defaults to `false`.
|
|
1055
1126
|
- `executionDetailsOpen`: controlled open state for the Trade details drawer. Omit this for the widget's internal open/closed state.
|
|
1056
1127
|
- `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.
|
|
@@ -1109,8 +1180,9 @@ pnpm --filter aegis-swap-widget dev
|
|
|
1109
1180
|
|
|
1110
1181
|
Releases are automated with [changesets](https://github.com/changesets/changesets)
|
|
1111
1182
|
from the monorepo root — no manual `npm version`/`npm publish`. `dist/` is not
|
|
1112
|
-
committed
|
|
1113
|
-
|
|
1183
|
+
committed. The Release workflow builds and validates every package once, then
|
|
1184
|
+
disables package lifecycle scripts while Changesets publishes packages concurrently.
|
|
1185
|
+
Local `pnpm pack:check` still runs each package's `prepack` build sequentially.
|
|
1114
1186
|
|
|
1115
1187
|
```bash
|
|
1116
1188
|
pnpm changeset # in your PR: pick aegis-swap-widget + bump, write the entry
|