aegis-swap-widget 0.12.2 → 0.13.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 CHANGED
@@ -1,5 +1,66 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.13.0
4
+
5
+ ### Minor Changes
6
+
7
+ - af08d8a: Add Ink (57073) direct swaps. Core now ships an Ink chain config and trusts Ink's
8
+ AegisRouterV1 (`0xe2820f3DA0abC9C65B3727A7103E3F59c00D686E`, from the Engine
9
+ v1.0.3 manifest). It also catalogues the USD₮0-USDC and USD₮0-USDG pools and
10
+ exports `AEGIS_SWAP_INK_TOKENS` (USD₮0, USDC, USDG). Backend `/v1/config`
11
+ responses now keep the Ink contract registry and allowlist; before, they were
12
+ stripped. The widget adds the `USDT0_USDC_INK` and `USDT0_USDG_INK` built-in
13
+ markets. Only `USDT0_USDC_INK` is a default. The bundled Ink chain config retains the current backend
14
+ 50 bps output fee; backend discovery consumes its configured fee policy.
15
+
16
+ Add an optional per-chain `walletRpcUrls` prop (`{ [chainId]: string[] }`, and
17
+ `walletRpcUrls` on chain configs and `ProviderChainConfig`) that overrides the
18
+ URLs `wallet_addEthereumChain` offers. By default wallets are now offered the
19
+ chain's canonical public RPCs, so a host can read through its own proxy without
20
+ that proxy being saved into users' wallets. The aggregated widget honours it too.
21
+
22
+ The read client now caps JSON-RPC batches at 100 requests, times out after 5s
23
+ per endpoint when fallback URLs exist (10s for a single URL), retries the
24
+ fallback set once, and gathers concurrent contract reads into one Multicall3
25
+ call over a 16ms window.
26
+
27
+ Include Ink in the widget's backend discovery filter and Core's validated
28
+ quote request chain set. Backend-disabled markets and host chain restrictions
29
+ continue to apply; missing Ink backend configuration does not enable a static
30
+ fallback.
31
+
32
+ Respect explicit host wallet resolvers without injected-wallet fallback. A
33
+ controlled host may open its wallet modal and update props asynchronously;
34
+ this does not start an extension permission request or show a no-wallet error.
35
+ Standalone connections and explicitly returned host connections are unchanged.
36
+
37
+ Core wallet-session resolution also preserves an explicitly unresolved host
38
+ provider rather than selecting a different injected extension. Aggregated
39
+ Connect waits for the host modal instead of starting transaction-session
40
+ resolution, and Engine actions wait instead of failing with "Wallet not
41
+ connected."; explicit returned connections and standalone injection still work.
42
+
43
+ Pin the complete REST snapshot and generated request types to the committed Ink
44
+ API contract. Ink quote requests now use those types directly, without a
45
+ temporary assertion against the previous chain list. This source contract pin
46
+ does not enable Ink on an API environment that has not deployed the route.
47
+
48
+ Behaviour changes:
49
+
50
+ - A host-supplied `null` `provider` or a `getProvider` resolver no longer falls
51
+ back to `window.ethereum`.
52
+ - `wallet_addEthereumChain` offers the chain's canonical public RPCs instead of
53
+ the read `rpcUrls`; `rpcUrls` is used only for a chain without a canonical list.
54
+ - `walletRpcUrls` accepts only the per-chain record form.
55
+ - Read transport: JSON-RPC batches cap at 100, 5s per-endpoint timeout with
56
+ fallback URLs, one fallback retry, and a 16ms Multicall3 wait.
57
+ - `USDT0_USDC_INK` is a new default market.
58
+
59
+ ### Patch Changes
60
+
61
+ - Updated dependencies [af08d8a]
62
+ - @aegis-engine/core@0.9.0
63
+
3
64
  ## 0.12.2
4
65
 
5
66
  ### Patch Changes
package/README.md CHANGED
@@ -1197,6 +1197,7 @@ No other props changed. See the [CHANGELOG](./CHANGELOG.md) for the full entry.
1197
1197
  - `defaultSlippagePercent`: number (canonical) or numeric string, in percent. Defaults to `1`.
1198
1198
  - `maxEngineSwapPriceImpactBps`: maximum block-pinned price impact for Engine internal swaps, in basis points. Lend and Trade fail closed above it or when impact cannot be assessed. Defaults to `500` (5%); valid range is `0` through `10000`. This is an SDK/Widget gate, not a Router-level pool-price invariant.
1199
1199
  - `rpcUrls`: RPC fallback list for the active chain, or a `{ [chainId]: string[] }` map for multichain hosts.
1200
+ - `walletRpcUrls`: optional `{ [chainId]: string[] }` override for the URLs offered to `wallet_addEthereumChain` (the first is the one wallets save). By default wallets are offered the chain's canonical public RPCs, never `rpcUrls`, so a host read proxy stays out of users' wallets; `rpcUrls` is used only for a chain without a canonical list.
1200
1201
  - `backendBaseUrl`: REST origin for Swap discovery and token-price history, and for the Engine widget's nested Buy surface. Defaults to the Aegis production backend. Engine market and position discovery is controlled separately by `engineDataSource`.
1201
1202
  - `backendRequestTimeoutMs`: timeout for backend REST reads. Defaults to 30000 ms.
1202
1203
  - `metadataEndpoint`: optional metadata GraphQL endpoint for `GlobalToken.iconURL` token icons only. Set to `null` to disable icon hydration.
@@ -1253,6 +1254,14 @@ Tap uses a single workspace without top section tabs. The chart starts as a line
1253
1254
  - `statusSurface`: where transaction status is surfaced — `'rail'` (default), `'toast'`, `'both'`, or `'none'`. The root `data-progress-state` attribute stays on regardless (see Toasts).
1254
1255
  - `toastPosition`: viewport corner for the widget-provided toaster. Defaults to `'bottom-right'`; ignored once a host mounts `<AegisSwapToaster />`.
1255
1256
 
1257
+ When `getProvider` is supplied, it owns wallet selection. Returning `null`
1258
+ keeps the widget disconnected; resolver failure never switches to an injected
1259
+ extension. With a controlled `account` (including `null`), `onConnectWallet`
1260
+ may return nothing after opening the host's wallet modal. The widget then waits
1261
+ for updated account/provider props without requesting accounts itself. A host
1262
+ may instead return a provider or provider/account connection to complete the
1263
+ connection immediately. Standalone widgets retain their injected-wallet flow.
1264
+
1256
1265
  The widget intentionally does not inherit the host font; set the
1257
1266
  `--aegis-swap-font-family` CSS variable (via `style` or a stylesheet) to match
1258
1267
  the host typography.
@@ -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-CEotHPNT.js";
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-CvIQ_zY8.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,11 +1,11 @@
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-CEotHPNT.js";
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-CvIQ_zY8.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";
5
5
  export * from "@aegis-engine/core";
6
6
  import { AEGIS_SWAP_DEFAULT_METADATA_ENDPOINT as H, AEGIS_SWAP_TOKENS as K, fetchGlobalTokenMetadata as q, resolveTokenIconUrl as j } from "@aegis-engine/core";
7
7
  import { a as Q, m as V } from "./marketOrientation-B6SD7xSk.js";
8
- import { A as Y, a as Z, b as $ } from "./markets-CjYBjn94.js";
8
+ import { A as Y, a as Z, b as $ } from "./markets-Dea2-UUy.js";
9
9
  export {
10
10
  Y as AEGIS_SWAP_CHAIN_ID,
11
11
  H as AEGIS_SWAP_DEFAULT_METADATA_ENDPOINT,
@@ -1 +1 @@
1
- export { AEGIS_SWAP_BSC_CHAIN, AEGIS_SWAP_CHAINS, AEGIS_SWAP_DEFAULT_METADATA_ENDPOINT, AEGIS_SWAP_DEFAULT_RPC_URLS, AEGIS_SWAP_MAINNET_CHAIN, createAegisSwapChainConfig, createAegisSwapChains, getExplorerUrl } from '@aegis-engine/core';
1
+ export { AEGIS_SWAP_BSC_CHAIN, AEGIS_SWAP_CHAINS, AEGIS_SWAP_DEFAULT_METADATA_ENDPOINT, AEGIS_SWAP_DEFAULT_RPC_URLS, AEGIS_SWAP_INK_CHAIN, AEGIS_SWAP_MAINNET_CHAIN, createAegisSwapChainConfig, createAegisSwapChains, getExplorerUrl } from '@aegis-engine/core';
@@ -1,3 +1,4 @@
1
+ export { AEGIS_SWAP_INK_CHAIN_ID, AEGIS_SWAP_INK_HOOK, AEGIS_SWAP_INK_ROUTER } from '@aegis-engine/core';
1
2
  export declare const AEGIS_SWAP_CHAIN_ID = 1;
2
3
  export declare const AEGIS_SWAP_BSC_CHAIN_ID = 56;
3
4
  export declare const AEGIS_SWAP_ROUTER: `0x${string}`;
@@ -1 +1 @@
1
- export { AEGIS_SWAP_BSC_TOKENS, AEGIS_SWAP_TOKENS, AGGREGATED_SWAP_CURATED_TOKENS, AGGREGATED_SWAP_DEFAULT_TOKENS, AGGREGATED_SWAP_DEFAULT_TOKEN_LIST, AGGREGATED_SWAP_TOKEN_PRESETS, AGGREGATED_SWAP_WOLFGAME_TOKENS, AGGREGATED_SWAP_WOLFGAME_TOKEN_LIST } from '@aegis-engine/core';
1
+ export { AEGIS_SWAP_BSC_TOKENS, AEGIS_SWAP_INK_TOKENS, AEGIS_SWAP_TOKENS, AGGREGATED_SWAP_CURATED_TOKENS, AGGREGATED_SWAP_DEFAULT_TOKENS, AGGREGATED_SWAP_DEFAULT_TOKEN_LIST, AGGREGATED_SWAP_TOKEN_PRESETS, AGGREGATED_SWAP_WOLFGAME_TOKENS, AGGREGATED_SWAP_WOLFGAME_TOKEN_LIST } from '@aegis-engine/core';
@@ -1,4 +1,4 @@
1
1
  import type { AegisSwapBuiltInTokenSymbol } from '@aegis-engine/core';
2
2
  export type { AegisPoolKey, AegisSwapBscTokenSymbol, AegisSwapBuiltInTokenSymbol, AegisSwapChainConfig, AegisSwapChainConfigInput, AegisSwapFeeConfig, AegisSwapMarket, AegisSwapPoolConfig, AegisSwapToken, AegisSwapTokenSymbol, AegisSwapUniswapV4Contracts, AegisSwapUniswapV4ContractsInput, AggregatedSwapDefaultTokenSymbol, AggregatedSwapToken, AggregatedSwapTokenSymbol, AggregatedSwapWolfGameTokenSymbol } from '@aegis-engine/core';
3
3
  export type AegisSwapBuiltInAssetSymbol = Exclude<AegisSwapBuiltInTokenSymbol, 'USDC'>;
4
- export type AegisSwapBuiltInMarketId = 'WATER_USDC' | 'WOOD_USDC' | 'GRASS_USDC' | 'STONE_USDC' | 'BNCB_BNB' | 'QQQB_BNB' | 'NVDAB_USDC_BSC';
4
+ export type AegisSwapBuiltInMarketId = 'WATER_USDC' | 'WOOD_USDC' | 'GRASS_USDC' | 'STONE_USDC' | 'BNCB_BNB' | 'QQQB_BNB' | 'NVDAB_USDC_BSC' | 'USDT0_USDC_INK' | 'USDT0_USDG_INK';
package/dist/core.js CHANGED
@@ -1,7 +1,7 @@
1
1
  export * from "@aegis-engine/core";
2
2
  import { AEGIS_SWAP_DEFAULT_METADATA_ENDPOINT as o, AEGIS_SWAP_TOKENS as r, fetchGlobalTokenMetadata as e, resolveTokenIconUrl as S } from "@aegis-engine/core";
3
3
  import { a as E, m as I } from "./marketOrientation-B6SD7xSk.js";
4
- import { A as T, a as P, b as m } from "./markets-CjYBjn94.js";
4
+ import { A as T, a as P, b as m } from "./markets-Dea2-UUy.js";
5
5
  export {
6
6
  T as AEGIS_SWAP_CHAIN_ID,
7
7
  o as AEGIS_SWAP_DEFAULT_METADATA_ENDPOINT,
@@ -66,7 +66,7 @@ export declare function useSubmitSwap({ publicClient, activeChain, market, input
66
66
  setQuote: (quote: DirectSwapQuote | null) => void;
67
67
  owner: Address | null;
68
68
  getActiveProvider: () => Promise<Eip1193Provider | null>;
69
- connectWallet: () => Promise<ResolvedWalletConnection | null>;
69
+ connectWallet: () => Promise<ResolvedWalletConnection | null | undefined>;
70
70
  setWalletChainId: (chainId: number | null) => void;
71
71
  commitAllowance: (owner: Address, market: AegisSwapMarket, amount: bigint) => void;
72
72
  approvalMode: AegisSwapApprovalMode;
@@ -15,5 +15,5 @@ export declare function useWalletConnection({ provider, controlledAccount, accou
15
15
  walletChainId: number | null;
16
16
  setWalletChainId: (chainId: number | null) => void;
17
17
  getActiveProvider: () => Promise<Eip1193Provider | null>;
18
- connectWallet: () => Promise<ResolvedWalletConnection | null>;
18
+ connectWallet: () => Promise<ResolvedWalletConnection | null | undefined>;
19
19
  };