aegis-swap-widget 0.8.0 → 0.10.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.
Files changed (118) hide show
  1. package/CHANGELOG.md +122 -0
  2. package/DESIGN.md +2 -1
  3. package/README.md +272 -95
  4. package/dist/aegis-swap-widget.js +23255 -12175
  5. package/dist/components/Slider.d.ts +6 -2
  6. package/dist/components/Sparkline.d.ts +5 -1
  7. package/dist/components/icons.d.ts +2 -0
  8. package/dist/errors.d.ts +2 -3
  9. package/dist/format.d.ts +13 -0
  10. package/dist/hooks/useLatest.d.ts +2 -0
  11. package/dist/hooks/useRetryOnRefocus.d.ts +11 -0
  12. package/dist/hooks/useSubmitSwap.d.ts +46 -3
  13. package/dist/hooks/useSubmittedReceiptRecovery.d.ts +25 -0
  14. package/dist/hooks/useTokenAllowance.d.ts +7 -1
  15. package/dist/index.d.ts +6 -1
  16. package/dist/presets/wolf-game.js +131 -0
  17. package/dist/presets/wolfGame.d.ts +116 -0
  18. package/dist/styles.css +1 -1
  19. package/dist/submittedSwapContext.d.ts +19 -0
  20. package/dist/toast/useSwipeDismiss.d.ts +8 -1
  21. package/dist/transactionProgress.d.ts +1 -1
  22. package/dist/widget/AegisLeverageWidget.d.ts +8 -0
  23. package/dist/widget/AmountField.d.ts +1 -1
  24. package/dist/widget/AmountUnitToggle.d.ts +10 -0
  25. package/dist/widget/EngineAmountBox.d.ts +6 -1
  26. package/dist/widget/ProgressRail.d.ts +3 -1
  27. package/dist/widget/SwapFormBody.d.ts +2 -1
  28. package/dist/widget/SwapWidgetShell.d.ts +5 -1
  29. package/dist/widget/TokenPriceHistoryStrip.d.ts +8 -2
  30. package/dist/widget/TransactionStepList.d.ts +5 -0
  31. package/dist/widget/engine-controller/displayCache.d.ts +7 -1
  32. package/dist/widget/engine-controller/engineActionExpiry.d.ts +20 -1
  33. package/dist/widget/engine-controller/engineActionState.d.ts +22 -2
  34. package/dist/widget/engine-controller/engineCtaLabel.d.ts +17 -7
  35. package/dist/widget/engine-controller/engineDisplay.d.ts +85 -3
  36. package/dist/widget/engine-controller/engineLendCopy.d.ts +157 -0
  37. package/dist/widget/engine-controller/engineLifecycle.d.ts +15 -19
  38. package/dist/widget/engine-controller/engineOptions.d.ts +13 -1
  39. package/dist/widget/engine-controller/enginePermissionFamilies.d.ts +106 -0
  40. package/dist/widget/engine-controller/enginePositionBook.d.ts +66 -0
  41. package/dist/widget/engine-controller/enginePositionManageCopy.d.ts +61 -0
  42. package/dist/widget/engine-controller/engineQuoteFetch.d.ts +27 -6
  43. package/dist/widget/engine-controller/engineRequoteGuard.d.ts +5 -0
  44. package/dist/widget/engine-controller/engineTokenPull.d.ts +13 -0
  45. package/dist/widget/engine-controller/engineTradePositionStorage.d.ts +9 -0
  46. package/dist/widget/engine-controller/engineTransactionProgress.d.ts +17 -3
  47. package/dist/widget/engine-controller/engineTransactionView.d.ts +10 -1
  48. package/dist/widget/engine-controller/engineYieldAmount.d.ts +27 -0
  49. package/dist/widget/engine-controller/useEngineActionDrafts.d.ts +3 -3
  50. package/dist/widget/engine-controller/useEngineActivity.d.ts +1 -1
  51. package/dist/widget/engine-controller/useEngineAuthorizationPlan.d.ts +44 -0
  52. package/dist/widget/engine-controller/useEngineBuySwapProps.d.ts +3 -1
  53. package/dist/widget/engine-controller/useEngineMarketMarks.d.ts +18 -0
  54. package/dist/widget/engine-controller/useEnginePermissionSetup.d.ts +34 -0
  55. package/dist/widget/engine-controller/useEnginePositionActions.d.ts +75 -2
  56. package/dist/widget/engine-controller/useEnginePositionStrategies.d.ts +20 -0
  57. package/dist/widget/engine-controller/useEnginePositions.d.ts +48 -6
  58. package/dist/widget/engine-controller/useEngineSubmit.d.ts +58 -7
  59. package/dist/widget/engine-controller/useEngineTradePermissions.d.ts +81 -0
  60. package/dist/widget/engine-controller/useEngineTradeSubmit.d.ts +49 -0
  61. package/dist/widget/engine-ui/EngineBodySkeleton.d.ts +4 -0
  62. package/dist/widget/engine-ui/EngineBuyPanel.d.ts +7 -2
  63. package/dist/widget/engine-ui/EngineCollateralRow.d.ts +8 -0
  64. package/dist/widget/engine-ui/EngineCollateralRowSkeleton.d.ts +3 -0
  65. package/dist/widget/engine-ui/EngineDetailsBreakdown.d.ts +7 -0
  66. package/dist/widget/engine-ui/EngineEstimateReveal.d.ts +4 -0
  67. package/dist/widget/engine-ui/EngineLendPositionCard.d.ts +24 -2
  68. package/dist/widget/engine-ui/EngineLeverageControl.d.ts +22 -0
  69. package/dist/widget/engine-ui/EngineMarketDialog.d.ts +3 -1
  70. package/dist/widget/engine-ui/EngineNotice.d.ts +15 -0
  71. package/dist/widget/engine-ui/EngineOnboardingActivePermissions.d.ts +9 -0
  72. package/dist/widget/engine-ui/EngineOnboardingAuthorize.d.ts +18 -0
  73. package/dist/widget/engine-ui/EngineOnboardingFooter.d.ts +20 -0
  74. package/dist/widget/engine-ui/EngineOnboardingProgress.d.ts +12 -0
  75. package/dist/widget/engine-ui/EngineOnboardingReview.d.ts +19 -0
  76. package/dist/widget/engine-ui/EngineOnboardingSuccess.d.ts +15 -0
  77. package/dist/widget/engine-ui/EngineOverlaySheet.d.ts +18 -0
  78. package/dist/widget/engine-ui/EnginePartnerContext.d.ts +43 -0
  79. package/dist/widget/engine-ui/EnginePermissionRail.d.ts +21 -0
  80. package/dist/widget/engine-ui/EnginePermissionRailRow.d.ts +43 -0
  81. package/dist/widget/engine-ui/EnginePositionBookFacts.d.ts +5 -0
  82. package/dist/widget/engine-ui/EnginePositionManageDialog.d.ts +12 -2
  83. package/dist/widget/engine-ui/EnginePositionsPanel.d.ts +5 -3
  84. package/dist/widget/engine-ui/EngineQuotePending.d.ts +1 -0
  85. package/dist/widget/engine-ui/EngineReservedShell.d.ts +18 -0
  86. package/dist/widget/engine-ui/EngineRiskMeter.d.ts +7 -7
  87. package/dist/widget/engine-ui/EngineSegmentedControl.d.ts +12 -0
  88. package/dist/widget/engine-ui/EngineSimpleYieldPanel.d.ts +10 -0
  89. package/dist/widget/engine-ui/EngineStepStateIcon.d.ts +5 -0
  90. package/dist/widget/engine-ui/EngineStorePanel.d.ts +14 -0
  91. package/dist/widget/engine-ui/EngineTradeEstimate.d.ts +11 -0
  92. package/dist/widget/engine-ui/EngineTradeOnboarding.d.ts +49 -0
  93. package/dist/widget/engine-ui/EngineTradePermissions.d.ts +44 -0
  94. package/dist/widget/engine-ui/EngineTradePermissionsPanels.d.ts +62 -0
  95. package/dist/widget/engine-ui/EngineTransactionReceipt.d.ts +8 -1
  96. package/dist/widget/engine-ui/EngineTxDetailsPending.d.ts +1 -0
  97. package/dist/widget/engine-ui/TokenPairMark.d.ts +3 -3
  98. package/dist/widget/engine-ui/engineOnboardingPanelTypes.d.ts +6 -0
  99. package/dist/widget/engine-ui/enginePermissionCopy.d.ts +28 -0
  100. package/dist/widget/engine-ui/enginePermissionRailGeometry.d.ts +28 -0
  101. package/dist/widget/engine-ui/useEngineTradeEducation.d.ts +22 -0
  102. package/dist/widget/engine-ui/useLendCopy.d.ts +24 -0
  103. package/dist/widget/engine-ui/useOverlayClose.d.ts +1 -0
  104. package/dist/widget/engineTradeViewModel.d.ts +21 -0
  105. package/dist/widget/focusTrap.d.ts +1 -1
  106. package/dist/widget/transactionSteps.d.ts +44 -0
  107. package/dist/widget/types.d.ts +270 -15
  108. package/dist/widget/useAggregatedSwapController.d.ts +1 -1
  109. package/dist/widget/useEngineController.d.ts +3269 -5
  110. package/dist/widget/useSheetEntrance.d.ts +1 -1
  111. package/dist/widget/useStatusSurface.d.ts +17 -1
  112. package/dist/widget/useSwapController.d.ts +13 -3
  113. package/dist/widget/useWidgetStyle.d.ts +2 -1
  114. package/dist/widget/viewState.d.ts +19 -2
  115. package/package.json +8 -2
  116. package/dist/encoding.d.ts +0 -2
  117. package/dist/quote/aggregatedSwapQuote.d.ts +0 -1
  118. package/dist/services/kyberSwap.d.ts +0 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,127 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.10.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 3429c86: Launch the focused Wolf Game Trade and Earn integration without coupling the
8
+ SDK packages to the playground host.
9
+
10
+ Core now exports `summarizeEngineSimpleYieldPosition` for React-free lender
11
+ share valuation, add-funds projection, and realized historical weekly growth.
12
+ It uses live shares when available, falls back to trusted indexed shares, and
13
+ never presents the market's modeled `lendApyPct` as realized earnings. Core also
14
+ classifies RPC simulation failures for wallet-safe preflight messaging and
15
+ re-quotes direct swaps after permissions settle before submission.
16
+
17
+ Widget adds the Store buy presentation and the `simple-yield` Earn
18
+ presentation, including compact position growth, historical earnings context,
19
+ transparent partial withdrawals, stable loading states, and transaction-step
20
+ progress. The new `aegis-swap-widget/presets/wolf-game` export provides the
21
+ four-resource catalogue, focused defaults, and a helper that keeps the Store
22
+ pool and Earn market synchronized from one controlled resource.
23
+
24
+ The generic opt-in capabilities remain available to other hosts:
25
+ `surfaceLabels` renames exposed tabs, `lendPresentation` selects a built-in
26
+ plain-language presentation, and `onInteractionLockChange` reports when host
27
+ navigation must stay fixed.
28
+
29
+ Add the opt-in `showTransactionSteps` prop to Swap and Engine. It renders a
30
+ compact ordered wallet journey only while an action is active, with the total
31
+ step count, completed steps, current wallet or network wait, and the next step.
32
+ The Wolf Game preset enables it for Trade and Earn.
33
+
34
+ Trade rechecks price after wallet permissions without weakening the reviewed
35
+ protection or exceeding the signed spend cap. Receipt recovery keeps an
36
+ unconfirmed permission transaction on its permission step instead of implying
37
+ that the final Trade or Earn action was submitted.
38
+
39
+ `lendPresentation` selects a built-in lexicon, exported as `AegisEngineLendCopy`
40
+ and overridable per string through the new `lendCopy` prop. Hosts supply their
41
+ own vocabulary rather than inheriting another integration's.
42
+
43
+ `marketId` and `defaultMarketId` now compare `evm_`-prefixed ids case
44
+ insensitively inside the widget, so externally supplied casing cannot lose a
45
+ controlled market selection. Uncontrolled hosts are unaffected — both sides of
46
+ that comparison come from the same market list.
47
+
48
+ Use these in the Wolf Game preview to launch a focused Trade and Earn flow,
49
+ keep one resource selected across both actions, and leave the game dashboard
50
+ context behind an explicit optional Showroom mode.
51
+
52
+ ### Patch Changes
53
+
54
+ - Updated dependencies [3429c86]
55
+ - @aegis-engine/core@0.6.0
56
+
57
+ ## 0.9.0
58
+
59
+ ### Minor Changes
60
+
61
+ - c76ba41: Add Engine Long/Short trading.
62
+
63
+ Core sizes a directional position against one block-pinned Engine state and v4
64
+ route, then opens it in a single atomic router call. The swap settles inside the
65
+ transaction, so the wallet signs only the authorizations it must.
66
+
67
+ The widget gains an opt-in `'trade'` surface and a dedicated one-view
68
+ `AegisLeverageWidget`. Leverage limits come from the quote, alongside the
69
+ trader-facing risk facts for the position. Authorization reports its request
70
+ count per chain, and a review step is mandatory before submission but stays
71
+ customizable. Permissions are granted in sequence, each with its own checkpoint;
72
+ after a partial failure the revoke guidance for what was already granted stays
73
+ on screen. A successful open links through to Positions.
74
+
75
+ Position identity survives a reload: the strategy is reconstructed from indexed
76
+ opening actions, with optional bounded persistence of the reviewed target
77
+ scenario.
78
+
79
+ - 1e7a963: Keep the Leverage Positions surface trader-first and evidence-backed.
80
+
81
+ Only positions with strict indexed Long/Short evidence appear in the Leverage
82
+ widget. Ordinary borrow vaults remain in the portfolio presentation and are no
83
+ longer relabelled as trades while classification loads or fails. Stored opening
84
+ intents enrich matching indexed strategies but never classify a vault alone.
85
+
86
+ The collapsed trade row removes the borrow-rate runway, LTV bar, and
87
+ credit-product language. It shows direction, pair, opening-plan leverage, and a
88
+ signed underlying price move only while a fresh on-chain pool mark is available.
89
+ It does not call that move PnL or return. The detail keeps the reviewed
90
+ entry→target plan, and live debt/equity use the Engine liquidity-debt valuation
91
+ instead of deriving dollars or leverage from the protocol LTV ratio.
92
+ When NFT/LP collateral is attached and cannot be valued from the live idle
93
+ balances, the widget omits total equity rather than presenting a partial value.
94
+
95
+ "Last activity" now appears only when something actually happened after the
96
+ open. On an untouched lot it restated the opening date the collapsed row already
97
+ carries — one fact wearing two formats.
98
+
99
+ ### Patch Changes
100
+
101
+ - 1e7a963: Unify the failure taxonomy and remove dead-end error states.
102
+
103
+ Core now owns one error classifier: `classifyError` returns curated copy plus a
104
+ failure `kind` and `retryable` flag, `UserFacingError` accepts both, and
105
+ `errorMessage` stays as a message-only compat wrapper. Wallet-cancelled sends
106
+ and not-ready Engine markets keep their curated copy instead of collapsing to a
107
+ generic fallback, and a not-ready market is marked non-retryable so retry CTAs
108
+ suppress.
109
+
110
+ The widget re-exports the core classifier (removing its diverged fork), catches
111
+ core's `TransactionReceiptTimeoutError` (hash included, explorer-link
112
+ messaging) instead of viem's unreachable timeout, retries failed Engine market
113
+ discovery via a Try again button and on refocus, turns a failed allowance check
114
+ into an enabled Try again CTA, labels fallback-served Engine data as
115
+ "last known" with a retry, derives inline errors from one precedence object
116
+ (submit failures outrank background quote failures), and keeps raw backend
117
+ error text out of the inline alert (widget log only).
118
+
119
+ - 1e7a963: Hug Engine onboarding sheets to their content and end leverage opens on a trading success screen with See position and Open another.
120
+ - Updated dependencies [1e7a963]
121
+ - Updated dependencies [c76ba41]
122
+ - Updated dependencies [1e7a963]
123
+ - @aegis-engine/core@0.5.0
124
+
3
125
  ## 0.8.0
4
126
 
5
127
  ### Minor Changes
package/DESIGN.md CHANGED
@@ -45,7 +45,8 @@ carry across both themes. `theme="auto"` follows `prefers-color-scheme`.
45
45
 
46
46
  ## Motion
47
47
 
48
- All motion is CSS and respects `prefers-reduced-motion` automatically.
48
+ Motion uses CSS and the browser Web Animations API. No third-party animation
49
+ runtime ships with the widget, and `prefers-reduced-motion` is respected.
49
50
 
50
51
  | Token | Default | Role |
51
52
  | --- | --- | --- |