@aegis-engine/core 0.9.1 → 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.
- package/README.md +31 -2
- package/dist/account.js +2 -2
- package/dist/actions/kyberSwap.d.ts +3 -0
- package/dist/aegis-core.js +2557 -2481
- package/dist/config/constants.d.ts +1 -1
- package/dist/encoding.d.ts +2 -0
- package/dist/index.d.ts +5 -3
- package/dist/quote/aggregatedSwapQuote.d.ts +10 -1
- package/dist/quote/routeProvider.d.ts +54 -0
- package/dist/quote.d.ts +3 -3
- package/dist/{sdkRuntime-CIhmlpGl.js → sdkRuntime-UJvZ2vPs.js} +1 -1
- package/dist/services/kyberSwap.d.ts +11 -1
- package/dist/transactionHistory-D3PDVGkr.js +6994 -0
- package/dist/types/aggregatedSwap.d.ts +7 -0
- package/package.json +2 -2
- package/dist/transactionHistory-BhNsDpNJ.js +0 -5919
package/README.md
CHANGED
|
@@ -525,8 +525,16 @@ const quote = await fetchDirectPoolSwapQuote({
|
|
|
525
525
|
```
|
|
526
526
|
|
|
527
527
|
Amounts are raw token base units. `slippageBps: 100` means 1%.
|
|
528
|
-
|
|
529
|
-
|
|
528
|
+
Exact-output execution enforces the input ceiling and required net receipt after
|
|
529
|
+
fees, or reverts atomically. The low-level builder takes gross `amountOut`;
|
|
530
|
+
optional `amountOutNet` must equal gross output minus the fee. Percentage fees
|
|
531
|
+
become a fixed amount against requested gross output. Remaining output credit
|
|
532
|
+
is then collected; a standard single-hop exact-output fill has no surplus.
|
|
533
|
+
Native input change is swept to `recipient`, which may differ from the payer.
|
|
534
|
+
Use the payer as recipient when that account should receive both output and
|
|
535
|
+
native change. General multihop exact output requires separate per-hop router
|
|
536
|
+
fulfillment checks. The high-level helpers apply the configured Aegis output fee.
|
|
537
|
+
All low-level builders reject negative fixed output fees before encoding calldata.
|
|
530
538
|
|
|
531
539
|
## Direct Pool Execution
|
|
532
540
|
|
|
@@ -589,6 +597,25 @@ const executableQuote = await fetchAggregatedSwapQuote(
|
|
|
589
597
|
)
|
|
590
598
|
```
|
|
591
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
|
+
|
|
592
619
|
## KyberSwap Execution
|
|
593
620
|
|
|
594
621
|
```ts
|
|
@@ -673,6 +700,8 @@ Execution returns:
|
|
|
673
700
|
- User rejection errors normalize through `errorMessage(error, fallback)`.
|
|
674
701
|
- Kyber temporary failures can be mapped with
|
|
675
702
|
`aggregatedSwapErrorMessage(error, fallback)`.
|
|
703
|
+
- `NoAegisRouteError`: Aegis-only routing found no all-Aegis path, or the
|
|
704
|
+
route included a hop outside Aegis pools.
|
|
676
705
|
|
|
677
706
|
## Publishing
|
|
678
707
|
|
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-
|
|
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-
|
|
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";
|
|
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>>;
|