@aegis-engine/core 0.9.2 → 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 +21 -0
- package/dist/actions/kyberSwap.d.ts +3 -0
- package/dist/aegis-core.js +2417 -2350
- package/dist/config/constants.d.ts +1 -1
- 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/services/kyberSwap.d.ts +11 -1
- package/dist/types/aggregatedSwap.d.ts +7 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -597,6 +597,25 @@ 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
|
+
|
|
600
619
|
## KyberSwap Execution
|
|
601
620
|
|
|
602
621
|
```ts
|
|
@@ -681,6 +700,8 @@ Execution returns:
|
|
|
681
700
|
- User rejection errors normalize through `errorMessage(error, fallback)`.
|
|
682
701
|
- Kyber temporary failures can be mapped with
|
|
683
702
|
`aggregatedSwapErrorMessage(error, fallback)`.
|
|
703
|
+
- `NoAegisRouteError`: Aegis-only routing found no all-Aegis path, or the
|
|
704
|
+
route included a hop outside Aegis pools.
|
|
684
705
|
|
|
685
706
|
## Publishing
|
|
686
707
|
|
|
@@ -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>>;
|