@aegis-engine/core 0.9.2 → 0.11.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/README.md CHANGED
@@ -597,6 +597,36 @@ const executableQuote = await fetchAggregatedSwapQuote(
597
597
  )
598
598
  ```
599
599
 
600
+ Aggregated quotes are available on chains 1, 56, 130 and 8453
601
+ (`AGGREGATED_SWAP_SUPPORTED_CHAIN_IDS`). To route only through Aegis pools
602
+ (Uniswap v4 pools with the Aegis hook), pass `{ liquiditySources: 'aegis' }` as
603
+ the last argument. Pass the same `liquiditySources` to `executeKyberSwap`:
604
+
605
+ ```ts
606
+ const aegisQuote = await fetchAggregatedSwapQuote(
607
+ inputToken, outputToken, amount, slippageBps, 'exactIn',
608
+ null, undefined, undefined, undefined,
609
+ { liquiditySources: 'aegis' }
610
+ )
611
+ ```
612
+
613
+ Aegis mode sends `includedSources=uniswap-v4-aegis` and requires every hop to
614
+ carry the `uniswap-v4-aegis` tag. It checks this before build and, in
615
+ `executeKyberSwap`, again before signing. If there is no all-Aegis path, or a
616
+ hop is tagged with any other source, it throws `NoAegisRouteError`
617
+ (`reason: 'no-route' | 'non-aegis-leg'`).
618
+
619
+ Ink (57073) has no Kyber coverage, so it uses an in-house provider that accepts
620
+ only `liquiditySources: 'aegis'` (`'any'` is rejected). It enumerates every path
621
+ of up to three hops through the shipped Ink pool catalogue, quotes all of them
622
+ (at most 32) in one Multicall3 `eth_call` to the V4 quoter, and takes the best
623
+ output net of the 50 bps fee. Pass a `publicClient` (the eighth argument) to
624
+ reuse your RPC. The swap goes to the Aegis router, which pulls input through
625
+ Permit2: `executeKyberSwap` approves Permit2 for the exact input, signs a
626
+ Permit2 grant for the router, re-quotes, and simulates before sending. The
627
+ calldata ends with a fixed `TAKE` of the reviewed minimum, so a short fill
628
+ reverts.
629
+
600
630
  ## KyberSwap Execution
601
631
 
602
632
  ```ts
@@ -681,6 +711,8 @@ Execution returns:
681
711
  - User rejection errors normalize through `errorMessage(error, fallback)`.
682
712
  - Kyber temporary failures can be mapped with
683
713
  `aggregatedSwapErrorMessage(error, fallback)`.
714
+ - `NoAegisRouteError`: Aegis-only routing found no all-Aegis path, or the
715
+ route included a hop outside Aegis pools.
684
716
 
685
717
  ## Publishing
686
718
 
package/dist/abis.d.ts CHANGED
@@ -114,6 +114,22 @@ export declare const PERMIT2_ABI: readonly [{
114
114
  readonly type: "uint48";
115
115
  }];
116
116
  }];
117
+ export declare const V4_PATH_KEY_COMPONENTS: readonly [{
118
+ readonly name: "intermediateCurrency";
119
+ readonly type: "address";
120
+ }, {
121
+ readonly name: "fee";
122
+ readonly type: "uint24";
123
+ }, {
124
+ readonly name: "tickSpacing";
125
+ readonly type: "int24";
126
+ }, {
127
+ readonly name: "hooks";
128
+ readonly type: "address";
129
+ }, {
130
+ readonly name: "hookData";
131
+ readonly type: "bytes";
132
+ }];
117
133
  export declare const UNISWAP_V4_QUOTER_ABI: readonly [{
118
134
  readonly type: "function";
119
135
  readonly name: "quoteExactInputSingle";
@@ -202,4 +218,45 @@ export declare const UNISWAP_V4_QUOTER_ABI: readonly [{
202
218
  readonly name: "gasEstimate";
203
219
  readonly type: "uint256";
204
220
  }];
221
+ }, {
222
+ readonly type: "function";
223
+ readonly name: "quoteExactInput";
224
+ readonly stateMutability: "nonpayable";
225
+ readonly inputs: readonly [{
226
+ readonly name: "params";
227
+ readonly type: "tuple";
228
+ readonly components: readonly [{
229
+ readonly name: "exactCurrency";
230
+ readonly type: "address";
231
+ }, {
232
+ readonly name: "path";
233
+ readonly type: "tuple[]";
234
+ readonly components: readonly [{
235
+ readonly name: "intermediateCurrency";
236
+ readonly type: "address";
237
+ }, {
238
+ readonly name: "fee";
239
+ readonly type: "uint24";
240
+ }, {
241
+ readonly name: "tickSpacing";
242
+ readonly type: "int24";
243
+ }, {
244
+ readonly name: "hooks";
245
+ readonly type: "address";
246
+ }, {
247
+ readonly name: "hookData";
248
+ readonly type: "bytes";
249
+ }];
250
+ }, {
251
+ readonly name: "exactAmount";
252
+ readonly type: "uint128";
253
+ }];
254
+ }];
255
+ readonly outputs: readonly [{
256
+ readonly name: "amountOut";
257
+ readonly type: "uint256";
258
+ }, {
259
+ readonly name: "gasEstimate";
260
+ readonly type: "uint256";
261
+ }];
205
262
  }];
package/dist/account.js CHANGED
@@ -1,5 +1,5 @@
1
- import { w as u, o as b, n as A, s as I, l as P, E as g, A as h, r as f, a as x, i as c, b as E, c as S, d as C, e as _, P as T, f as D } from "./transactionHistory-D3PDVGkr.js";
2
- import { g as M, h as j, j as J, k as O, m as U, p as G, q as Z, t as Q, u as V, v as W, x as X, y as Y, z as ee, B as ae, C as oe, D as se, F as ne, G as te, H as re } from "./transactionHistory-D3PDVGkr.js";
1
+ import { w as u, o as b, n as A, s as I, l as P, E as g, A as h, r as f, a as x, i as c, b as E, c as S, d as C, e as _, P as T, f as D } from "./transactionHistory-B-F6o9hW.js";
2
+ import { g as M, h as j, j as J, k as O, m as U, p as G, q as Z, t as Q, u as V, v as W, x as X, y as Y, z as ee, B as ae, C as oe, D as se, F as ne, G as te, H as re } from "./transactionHistory-B-F6o9hW.js";
3
3
  import { keccak256 as k, encodeAbiParameters as y } from "viem";
4
4
  const H = b({ version: P(1), snapshotId: I().uuid(), page: A().int().min(1).max(95) }).strict();
5
5
  function v(e) {
@@ -1,6 +1,7 @@
1
1
  import { type Address, type Hex, type PublicClient } from 'viem';
2
2
  import { UserFacingError } from '../errors.js';
3
3
  import type { AegisSwapChainConfig, AegisSwapToken } from '../config/index.js';
4
+ import type { AggregatedSwapLiquiditySources } from '../services/kyberSwap.js';
4
5
  import type { AegisSwapApprovalMode, WalletSession } from '../swap/types.js';
5
6
  import type { AggregatedSwapQuote } from '../types/aggregatedSwap.js';
6
7
  import type { AegisSwapActionCallbacks, AegisSwapActionResult } from './types.js';
@@ -36,6 +37,8 @@ export declare function executeKyberSwap(args: {
36
37
  slippageBps: number;
37
38
  displayedQuote?: AggregatedSwapQuote | null;
38
39
  approvalMode?: AegisSwapApprovalMode;
40
+ /** `'aegis'` routes only through Aegis pools and fails closed otherwise. Defaults to `'any'`. */
41
+ liquiditySources?: AggregatedSwapLiquiditySources;
39
42
  signal?: AbortSignal;
40
43
  onWalletChainId?: (chainId: number | null) => void;
41
44
  } & AegisSwapActionCallbacks): Promise<AegisSwapActionResult<AggregatedSwapQuote>>;