@aegis-engine/core 0.12.0 → 0.13.1
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 +26 -2
- package/dist/account.js +1 -129
- package/dist/actions/kyberSwap.d.ts +5 -0
- package/dist/aegis-core.js +71 -10334
- package/dist/contract/generated/aegis-swap.d.ts +167 -10
- package/dist/contract/generated/market-data.d.ts +333 -21
- package/dist/engine/account/portfolioSchemas.d.ts +2 -1
- package/dist/engine/registry.d.ts +15 -0
- package/dist/engine/types.d.ts +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/quote/aggregatedSwapQuote.d.ts +13 -3
- package/dist/sdkRuntime-CMBWjHxv.js +1593 -0
- package/dist/transactionHistory-C8KRA_tE.js +149 -0
- package/dist/types/aggregatedSwap.d.ts +21 -0
- package/package.json +1 -1
- package/dist/sdkRuntime-Dcfu-Hbw.js +0 -18757
- package/dist/transactionHistory-B-F6o9hW.js +0 -6994
|
@@ -47,7 +47,10 @@ export interface paths {
|
|
|
47
47
|
path?: never;
|
|
48
48
|
cookie?: never;
|
|
49
49
|
};
|
|
50
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* List curated tokens for a chain
|
|
52
|
+
* @description Returns curated token metadata, including priceUsd, for the chain. Responses are shared-cacheable for 60 seconds with a 60-second stale-while-revalidate window, so priceUsd can lag the price writer by about two minutes.
|
|
53
|
+
*/
|
|
51
54
|
get: operations["listTokens"];
|
|
52
55
|
put?: never;
|
|
53
56
|
post?: never;
|
|
@@ -66,7 +69,7 @@ export interface paths {
|
|
|
66
69
|
};
|
|
67
70
|
/**
|
|
68
71
|
* List curated tokens by address
|
|
69
|
-
* @description Filters curated token metadata to the requested comma-separated EVM token addresses. Matching is case-insensitive and unknown addresses are omitted.
|
|
72
|
+
* @description Filters curated token metadata to the requested comma-separated EVM token addresses. Matching is case-insensitive and unknown addresses are omitted. Responses are shared-cacheable for 60 seconds with a 60-second stale-while-revalidate window, so priceUsd can lag the price writer by about two minutes.
|
|
70
73
|
*/
|
|
71
74
|
get: operations["listTokensByAddress"];
|
|
72
75
|
put?: never;
|
|
@@ -166,7 +169,7 @@ export interface paths {
|
|
|
166
169
|
};
|
|
167
170
|
/**
|
|
168
171
|
* Get pool candles or a labelled token reference line
|
|
169
|
-
* @description Returns processor-owned Uniswap v4 pair candles for 1d, 7d, 30d, 90d, or 180d. The 1d window uses exact five-minute Swap-event candles.
|
|
172
|
+
* @description Returns processor-owned Uniswap v4 pair candles for 1d, 7d, 30d, 90d, or 180d. The 1d window uses exact five-minute Swap-event candles. By default, the 7d window uses copied Uniswap PoolHourData; 30d, 90d, and 180d use copied PoolDayData. aggregation=exact_swaps explicitly selects qualified dense PoolManager RPC rollups for those longer windows, retaining swapCount and first/last swap provenance with no copied USD fields. Without that parameter, longer RPC rollups are unavailable to preserve existing client validators. A requested representation that is not stored returns 404 before reading buckets, with no automatic source substitution. Prices remain canonical token1 per token0 (quote_per_base). Exact five-minute rows expose swapCount and first/last swap provenance. Upstream aggregate rows expose txCount under its real meaning and may include volumeUSD, feesUSD, and tvlUSD. Dense exact-swap coverage reports missing stored buckets as indexing gaps. Sparse upstream series treat absent keys as quiet intervals; malformed stored rows are dropped and reported as invalid_row gaps. Metadata or requested-representation absence returns 404. HTTP 200 and metadata-absent 404 responses are shared-cacheable for 30 seconds. This display series is not an execution quote or transaction input. The Lambda does not call a subgraph or RPC. basis=token_market_reference explicitly selects a display-only line of matching TokenHourData or TokenDayData close ratios for 7d/30d/90d/180d. The reference has no 1d/5m series, no pair OHLC, and no automatic fallback. Component close trades need not be simultaneous. Historical venue independence is unknown and must not be presented as independent fair value.
|
|
170
173
|
*/
|
|
171
174
|
get: operations["getEngineMarketCandles"];
|
|
172
175
|
put?: never;
|
|
@@ -186,7 +189,7 @@ export interface paths {
|
|
|
186
189
|
};
|
|
187
190
|
/**
|
|
188
191
|
* List curated Aegis swap markets for a chain
|
|
189
|
-
* @description Returns the backend-owned source of truth for market status, labels, pool keys, display metrics, and warnings. Metrics are display data and are not execution inputs.
|
|
192
|
+
* @description Returns the backend-owned source of truth for market status, labels, pool keys, display metrics, and warnings. Metrics are display data and are not execution inputs. Swap status requires a visible, unpaused market; on Ink it also requires a positive recorded uint128 V4 liquidity snapshot.
|
|
190
193
|
*/
|
|
191
194
|
get: operations["listMarkets"];
|
|
192
195
|
put?: never;
|
|
@@ -197,6 +200,26 @@ export interface paths {
|
|
|
197
200
|
patch?: never;
|
|
198
201
|
trace?: never;
|
|
199
202
|
};
|
|
203
|
+
"/v1/markets/v2": {
|
|
204
|
+
parameters: {
|
|
205
|
+
query?: never;
|
|
206
|
+
header?: never;
|
|
207
|
+
path?: never;
|
|
208
|
+
cookie?: never;
|
|
209
|
+
};
|
|
210
|
+
/**
|
|
211
|
+
* List curated Aegis v4 pools with explicit metric availability
|
|
212
|
+
* @description Opt-in market reads for all curated-data chains. Unavailable or unproven metrics are null; measured zero remains zero. TVL availability is independent of rolling history. A retained Lens TVL marked stale keeps its last value; observations.tvl reports its source time (null when unknown) and the recorded stale flag (any recorded value other than false is stale), not an age-based freshness verdict. observations is optional and additive: clients must tolerate its absence. Indexed fee APR and history require explicit v4HistoryAvailable=true or, when the flag is absent, v4-subgraph provenance. Ink volume can independently use qualified first-party PoolManager RPC volume (producer policy version 1, window end at most three hours old); its USD valuation is an estimate, unqualified values remain null, and it does not enable fee APR. Optional metrics.flowHistory adds processor-recorded Uniswap LiquidityService analytics on Ink: policyVersion 1, matching chain/pool identity, seven complete UTC daily volumeUsd/feesUsd points and their sums, windowStart/windowEnd/resolution in Unix seconds, and asOf as provider fetch time (not an indexed head or canonicality proof). The current completed seven-day window ending at today UTC midnight and fetched within three hours is admitted; before 00:30 UTC, the immediately previous window is also admitted with its actual dates unchanged and the same fetch-age limit. Malformed, stale or incomplete history is omitted without hiding TVL. This adds no polling. Charts use flowHistory.volumeUsd and its daily points. Both market versions retain rolling 168h indexed/RPC volumeUsd7d; daily history never overrides a rolling positive, zero or unavailable value (0 in frozen v1, null in v2). Fees are provider USD estimates, not verified LP earnings. Without indexed history, feeApr7d may derive from flowHistory; see metrics.feeApr7dSource. Provider flow history is v2-only. Data-only chains return disabled swap status and swap-unavailable; this route does not enable quoting or execution. Swap status requires a visible, unpaused market; on Ink it also requires a positive recorded uint128 V4 liquidity snapshot. feeApr7d is annualized percentage points and dynamic-fee APR is an estimate, not realized LP earnings. Existing core clients must continue using /v1/markets until they support this nullable contract.
|
|
213
|
+
*/
|
|
214
|
+
get: operations["listMarketsV2"];
|
|
215
|
+
put?: never;
|
|
216
|
+
post?: never;
|
|
217
|
+
delete?: never;
|
|
218
|
+
options?: never;
|
|
219
|
+
head?: never;
|
|
220
|
+
patch?: never;
|
|
221
|
+
trace?: never;
|
|
222
|
+
};
|
|
200
223
|
"/v1/engine/markets": {
|
|
201
224
|
parameters: {
|
|
202
225
|
query?: never;
|
|
@@ -528,7 +551,7 @@ export interface paths {
|
|
|
528
551
|
put?: never;
|
|
529
552
|
/**
|
|
530
553
|
* Create an indicative swap quote
|
|
531
|
-
* @description Returns a fast, non-executable price estimate for first paint. Clients must re-quote on-chain before building or signing a transaction. Only aegis-direct-v4 markets are quoted by this backend; Kyber is quoted client-side.
|
|
554
|
+
* @description Returns a fast, non-executable price estimate for first paint. Clients must re-quote on-chain before building or signing a transaction. Only aegis-direct-v4 markets are quoted by this backend; Kyber is quoted client-side. On Ink, returns 400 Market is disabled for swaps when the market is not enabled; other chains return 200 indicative estimates for disabled markets.
|
|
532
555
|
*/
|
|
533
556
|
post: operations["createIndicativeSwapQuote"];
|
|
534
557
|
delete?: never;
|
|
@@ -582,7 +605,7 @@ export interface components {
|
|
|
582
605
|
* @example 130
|
|
583
606
|
* @enum {string}
|
|
584
607
|
*/
|
|
585
|
-
ChainIdQuery: "1" | "56" | "130" | "8453";
|
|
608
|
+
ChainIdQuery: "1" | "56" | "130" | "8453" | "57073";
|
|
586
609
|
/**
|
|
587
610
|
* @example 4663
|
|
588
611
|
* @enum {string}
|
|
@@ -592,7 +615,7 @@ export interface components {
|
|
|
592
615
|
* @example 4663
|
|
593
616
|
* @enum {string}
|
|
594
617
|
*/
|
|
595
|
-
DataChainIdQuery: "1" | "56" | "130" | "8453" | "
|
|
618
|
+
DataChainIdQuery: "1" | "56" | "130" | "8453" | "57073" | "4663";
|
|
596
619
|
HealthResponse: {
|
|
597
620
|
/** @enum {boolean} */
|
|
598
621
|
ok: true;
|
|
@@ -609,7 +632,7 @@ export interface components {
|
|
|
609
632
|
* @example 130
|
|
610
633
|
* @enum {integer}
|
|
611
634
|
*/
|
|
612
|
-
chainId: 1 | 56 | 130 | 8453;
|
|
635
|
+
chainId: 1 | 56 | 130 | 8453 | 57073;
|
|
613
636
|
slug: string;
|
|
614
637
|
name: string;
|
|
615
638
|
};
|
|
@@ -652,6 +675,12 @@ export interface components {
|
|
|
652
675
|
v4Quoter?: string;
|
|
653
676
|
v4PoolManager?: string;
|
|
654
677
|
};
|
|
678
|
+
57073: {
|
|
679
|
+
aegisRouter?: string;
|
|
680
|
+
permit2?: string;
|
|
681
|
+
v4Quoter?: string;
|
|
682
|
+
v4PoolManager?: string;
|
|
683
|
+
};
|
|
655
684
|
};
|
|
656
685
|
SwapAllowlists: {
|
|
657
686
|
routers: string[];
|
|
@@ -674,6 +703,10 @@ export interface components {
|
|
|
674
703
|
routers: string[];
|
|
675
704
|
spenders: string[];
|
|
676
705
|
};
|
|
706
|
+
57073: {
|
|
707
|
+
routers: string[];
|
|
708
|
+
spenders: string[];
|
|
709
|
+
};
|
|
677
710
|
};
|
|
678
711
|
SwapFee: {
|
|
679
712
|
/** @enum {number} */
|
|
@@ -689,7 +722,7 @@ export interface components {
|
|
|
689
722
|
* @example 130
|
|
690
723
|
* @enum {integer}
|
|
691
724
|
*/
|
|
692
|
-
chainId: 1 | 56 | 130 | 8453;
|
|
725
|
+
chainId: 1 | 56 | 130 | 8453 | 57073;
|
|
693
726
|
slug: string;
|
|
694
727
|
name: string;
|
|
695
728
|
}[];
|
|
@@ -727,6 +760,12 @@ export interface components {
|
|
|
727
760
|
v4Quoter?: string;
|
|
728
761
|
v4PoolManager?: string;
|
|
729
762
|
};
|
|
763
|
+
57073: {
|
|
764
|
+
aegisRouter?: string;
|
|
765
|
+
permit2?: string;
|
|
766
|
+
v4Quoter?: string;
|
|
767
|
+
v4PoolManager?: string;
|
|
768
|
+
};
|
|
730
769
|
};
|
|
731
770
|
allowlists: {
|
|
732
771
|
1: {
|
|
@@ -745,6 +784,10 @@ export interface components {
|
|
|
745
784
|
routers: string[];
|
|
746
785
|
spenders: string[];
|
|
747
786
|
};
|
|
787
|
+
57073: {
|
|
788
|
+
routers: string[];
|
|
789
|
+
spenders: string[];
|
|
790
|
+
};
|
|
748
791
|
};
|
|
749
792
|
fee: {
|
|
750
793
|
/** @enum {number} */
|
|
@@ -759,7 +802,7 @@ export interface components {
|
|
|
759
802
|
* @example 4663
|
|
760
803
|
* @enum {integer}
|
|
761
804
|
*/
|
|
762
|
-
chainId: 1 | 56 | 130 | 8453 |
|
|
805
|
+
chainId: 1 | 56 | 130 | 8453 | 57073 | 4663;
|
|
763
806
|
address: string;
|
|
764
807
|
symbol: string;
|
|
765
808
|
displayName: string;
|
|
@@ -775,7 +818,7 @@ export interface components {
|
|
|
775
818
|
* @example 4663
|
|
776
819
|
* @enum {integer}
|
|
777
820
|
*/
|
|
778
|
-
chainId: 1 | 56 | 130 | 8453 |
|
|
821
|
+
chainId: 1 | 56 | 130 | 8453 | 57073 | 4663;
|
|
779
822
|
address: string;
|
|
780
823
|
symbol: string;
|
|
781
824
|
displayName: string;
|
|
@@ -807,7 +850,7 @@ export interface components {
|
|
|
807
850
|
* @example 130
|
|
808
851
|
* @enum {integer}
|
|
809
852
|
*/
|
|
810
|
-
chainId: 1 | 56 | 130 | 8453;
|
|
853
|
+
chainId: 1 | 56 | 130 | 8453 | 57073;
|
|
811
854
|
/** @enum {string} */
|
|
812
855
|
status: "enabled" | "disabled";
|
|
813
856
|
/** @enum {string} */
|
|
@@ -841,7 +884,7 @@ export interface components {
|
|
|
841
884
|
* @example 130
|
|
842
885
|
* @enum {integer}
|
|
843
886
|
*/
|
|
844
|
-
chainId: 1 | 56 | 130 | 8453;
|
|
887
|
+
chainId: 1 | 56 | 130 | 8453 | 57073;
|
|
845
888
|
/** @enum {string} */
|
|
846
889
|
status: "enabled" | "disabled";
|
|
847
890
|
/** @enum {string} */
|
|
@@ -869,6 +912,243 @@ export interface components {
|
|
|
869
912
|
};
|
|
870
913
|
warnings: ("paused" | "surge-active" | "cap-event")[];
|
|
871
914
|
}[];
|
|
915
|
+
MarketMetricsV2: {
|
|
916
|
+
tvlUsd: number | null;
|
|
917
|
+
volumeUsd7d: number | null;
|
|
918
|
+
/** @description Annualized percentage points (12.3 means 12.3%). From indexed history when available; otherwise derived from flowHistory (see feeApr7dSource). An estimate, not realized LP earnings. Null when unavailable; measured zero stays zero. */
|
|
919
|
+
feeApr7d: number | null;
|
|
920
|
+
/**
|
|
921
|
+
* @description Present only when feeApr7d is derived from flowHistory: its feesUsd over windowStart..windowEnd annualized over non-stale, dated Lens TVL, in percentage points: feesUsd / 7 * 365 / tvlUsd * 100. Gross pool fees (including any protocol share) over current TVL, so a pool whose TVL changed during the window can be skewed. Absent, with feeApr7d null, for stale, undated, future-dated, unavailable or zero TVL, or a rate above 1000 (withheld as implausible); also absent when feeApr7d comes from indexed history.
|
|
922
|
+
* @enum {string}
|
|
923
|
+
*/
|
|
924
|
+
feeApr7dSource?: "flow-history";
|
|
925
|
+
/** @description Optional Ink daily volume and fee history from Uniswap provider analytics over the last seven completed UTC days. Omitted when unavailable, stale, malformed or incomplete. Provider estimates; does not affect volumeUsd7d. Without indexed history, its feesUsd derives feeApr7d (see feeApr7dSource). */
|
|
926
|
+
flowHistory?: {
|
|
927
|
+
/**
|
|
928
|
+
* @description Ink chain ID.
|
|
929
|
+
* @enum {number}
|
|
930
|
+
*/
|
|
931
|
+
chainId: 57073;
|
|
932
|
+
/** @description Uniswap v4 pool ID (bytes32 PoolKey hash). */
|
|
933
|
+
poolId: string;
|
|
934
|
+
/**
|
|
935
|
+
* @description Uniswap LiquidityService pool history, recorded by the processor.
|
|
936
|
+
* @enum {string}
|
|
937
|
+
*/
|
|
938
|
+
source: "uniswap-liquidity-service";
|
|
939
|
+
/**
|
|
940
|
+
* @description Producer policy version; consumers gate on this value.
|
|
941
|
+
* @enum {number}
|
|
942
|
+
*/
|
|
943
|
+
policyVersion: 1;
|
|
944
|
+
/** @description Unix seconds when the processor fetched the provider. A fetch time, not an indexed chain head or completeness proof; admitted for at most three hours. */
|
|
945
|
+
asOf: number;
|
|
946
|
+
/** @description Inclusive window start in Unix seconds (UTC midnight), windowEnd minus seven days. */
|
|
947
|
+
windowStart: number;
|
|
948
|
+
/** @description Exclusive window end in Unix seconds: the UTC midnight ending the last completed day. Today is excluded. The current window is admitted, plus the previous one before 00:30 UTC. */
|
|
949
|
+
windowEnd: number;
|
|
950
|
+
/**
|
|
951
|
+
* @description Seconds per daily point (86400).
|
|
952
|
+
* @enum {number}
|
|
953
|
+
*/
|
|
954
|
+
resolution: 86400;
|
|
955
|
+
/** @description Sum of the seven daily volumeUsd points. Uniswap provider estimate of swap volume in USD (historical analytics valuation). Separate from the rolling 168-hour volumeUsd7d. */
|
|
956
|
+
volumeUsd: number;
|
|
957
|
+
/** @description Sum of the seven daily feesUsd points. Uniswap provider estimate of swap fees in USD, including any protocol share; not LP fees, wallet earnings or APR. */
|
|
958
|
+
feesUsd: number;
|
|
959
|
+
/** @description Seven contiguous completed UTC days, oldest first, from windowStart. */
|
|
960
|
+
daily: {
|
|
961
|
+
/** @description UTC midnight starting this day, in Unix seconds. */
|
|
962
|
+
timestamp: number;
|
|
963
|
+
/** @description Uniswap provider estimate of swap volume in USD (historical analytics valuation). */
|
|
964
|
+
volumeUsd: number;
|
|
965
|
+
/** @description Uniswap provider estimate of swap fees in USD, including any protocol share; not LP fees, wallet earnings or APR. */
|
|
966
|
+
feesUsd: number;
|
|
967
|
+
}[];
|
|
968
|
+
};
|
|
969
|
+
};
|
|
970
|
+
MarketV2: {
|
|
971
|
+
id: string;
|
|
972
|
+
/**
|
|
973
|
+
* @example 4663
|
|
974
|
+
* @enum {integer}
|
|
975
|
+
*/
|
|
976
|
+
chainId: 1 | 56 | 130 | 8453 | 57073 | 4663;
|
|
977
|
+
/** @enum {string} */
|
|
978
|
+
status: "enabled" | "disabled";
|
|
979
|
+
/** @enum {string} */
|
|
980
|
+
kind: "aegis-direct-v4";
|
|
981
|
+
label: string;
|
|
982
|
+
baseToken: string;
|
|
983
|
+
quoteToken: string;
|
|
984
|
+
/** @example 0x9073b65a558bdf9d0d7d0c82b468128acb847de72f5ad776bd8a4aab98781584 */
|
|
985
|
+
poolId: string;
|
|
986
|
+
poolKey: {
|
|
987
|
+
currency0: string;
|
|
988
|
+
currency1: string;
|
|
989
|
+
/**
|
|
990
|
+
* @description Uniswap v4 fee value. 8388608 indicates dynamic fee.
|
|
991
|
+
* @example 8388608
|
|
992
|
+
*/
|
|
993
|
+
fee: number;
|
|
994
|
+
tickSpacing: number;
|
|
995
|
+
hooks: string;
|
|
996
|
+
};
|
|
997
|
+
metrics: {
|
|
998
|
+
tvlUsd: number | null;
|
|
999
|
+
volumeUsd7d: number | null;
|
|
1000
|
+
/** @description Annualized percentage points (12.3 means 12.3%). From indexed history when available; otherwise derived from flowHistory (see feeApr7dSource). An estimate, not realized LP earnings. Null when unavailable; measured zero stays zero. */
|
|
1001
|
+
feeApr7d: number | null;
|
|
1002
|
+
/**
|
|
1003
|
+
* @description Present only when feeApr7d is derived from flowHistory: its feesUsd over windowStart..windowEnd annualized over non-stale, dated Lens TVL, in percentage points: feesUsd / 7 * 365 / tvlUsd * 100. Gross pool fees (including any protocol share) over current TVL, so a pool whose TVL changed during the window can be skewed. Absent, with feeApr7d null, for stale, undated, future-dated, unavailable or zero TVL, or a rate above 1000 (withheld as implausible); also absent when feeApr7d comes from indexed history.
|
|
1004
|
+
* @enum {string}
|
|
1005
|
+
*/
|
|
1006
|
+
feeApr7dSource?: "flow-history";
|
|
1007
|
+
/** @description Optional Ink daily volume and fee history from Uniswap provider analytics over the last seven completed UTC days. Omitted when unavailable, stale, malformed or incomplete. Provider estimates; does not affect volumeUsd7d. Without indexed history, its feesUsd derives feeApr7d (see feeApr7dSource). */
|
|
1008
|
+
flowHistory?: {
|
|
1009
|
+
/**
|
|
1010
|
+
* @description Ink chain ID.
|
|
1011
|
+
* @enum {number}
|
|
1012
|
+
*/
|
|
1013
|
+
chainId: 57073;
|
|
1014
|
+
/** @description Uniswap v4 pool ID (bytes32 PoolKey hash). */
|
|
1015
|
+
poolId: string;
|
|
1016
|
+
/**
|
|
1017
|
+
* @description Uniswap LiquidityService pool history, recorded by the processor.
|
|
1018
|
+
* @enum {string}
|
|
1019
|
+
*/
|
|
1020
|
+
source: "uniswap-liquidity-service";
|
|
1021
|
+
/**
|
|
1022
|
+
* @description Producer policy version; consumers gate on this value.
|
|
1023
|
+
* @enum {number}
|
|
1024
|
+
*/
|
|
1025
|
+
policyVersion: 1;
|
|
1026
|
+
/** @description Unix seconds when the processor fetched the provider. A fetch time, not an indexed chain head or completeness proof; admitted for at most three hours. */
|
|
1027
|
+
asOf: number;
|
|
1028
|
+
/** @description Inclusive window start in Unix seconds (UTC midnight), windowEnd minus seven days. */
|
|
1029
|
+
windowStart: number;
|
|
1030
|
+
/** @description Exclusive window end in Unix seconds: the UTC midnight ending the last completed day. Today is excluded. The current window is admitted, plus the previous one before 00:30 UTC. */
|
|
1031
|
+
windowEnd: number;
|
|
1032
|
+
/**
|
|
1033
|
+
* @description Seconds per daily point (86400).
|
|
1034
|
+
* @enum {number}
|
|
1035
|
+
*/
|
|
1036
|
+
resolution: 86400;
|
|
1037
|
+
/** @description Sum of the seven daily volumeUsd points. Uniswap provider estimate of swap volume in USD (historical analytics valuation). Separate from the rolling 168-hour volumeUsd7d. */
|
|
1038
|
+
volumeUsd: number;
|
|
1039
|
+
/** @description Sum of the seven daily feesUsd points. Uniswap provider estimate of swap fees in USD, including any protocol share; not LP fees, wallet earnings or APR. */
|
|
1040
|
+
feesUsd: number;
|
|
1041
|
+
/** @description Seven contiguous completed UTC days, oldest first, from windowStart. */
|
|
1042
|
+
daily: {
|
|
1043
|
+
/** @description UTC midnight starting this day, in Unix seconds. */
|
|
1044
|
+
timestamp: number;
|
|
1045
|
+
/** @description Uniswap provider estimate of swap volume in USD (historical analytics valuation). */
|
|
1046
|
+
volumeUsd: number;
|
|
1047
|
+
/** @description Uniswap provider estimate of swap fees in USD, including any protocol share; not LP fees, wallet earnings or APR. */
|
|
1048
|
+
feesUsd: number;
|
|
1049
|
+
}[];
|
|
1050
|
+
};
|
|
1051
|
+
};
|
|
1052
|
+
warnings: ("paused" | "surge-active" | "cap-event" | "swap-unavailable")[];
|
|
1053
|
+
observations?: {
|
|
1054
|
+
tvl: {
|
|
1055
|
+
/** Format: date-time */
|
|
1056
|
+
updatedAt: string | null;
|
|
1057
|
+
stale: boolean;
|
|
1058
|
+
};
|
|
1059
|
+
};
|
|
1060
|
+
};
|
|
1061
|
+
MarketListV2: {
|
|
1062
|
+
id: string;
|
|
1063
|
+
/**
|
|
1064
|
+
* @example 4663
|
|
1065
|
+
* @enum {integer}
|
|
1066
|
+
*/
|
|
1067
|
+
chainId: 1 | 56 | 130 | 8453 | 57073 | 4663;
|
|
1068
|
+
/** @enum {string} */
|
|
1069
|
+
status: "enabled" | "disabled";
|
|
1070
|
+
/** @enum {string} */
|
|
1071
|
+
kind: "aegis-direct-v4";
|
|
1072
|
+
label: string;
|
|
1073
|
+
baseToken: string;
|
|
1074
|
+
quoteToken: string;
|
|
1075
|
+
/** @example 0x9073b65a558bdf9d0d7d0c82b468128acb847de72f5ad776bd8a4aab98781584 */
|
|
1076
|
+
poolId: string;
|
|
1077
|
+
poolKey: {
|
|
1078
|
+
currency0: string;
|
|
1079
|
+
currency1: string;
|
|
1080
|
+
/**
|
|
1081
|
+
* @description Uniswap v4 fee value. 8388608 indicates dynamic fee.
|
|
1082
|
+
* @example 8388608
|
|
1083
|
+
*/
|
|
1084
|
+
fee: number;
|
|
1085
|
+
tickSpacing: number;
|
|
1086
|
+
hooks: string;
|
|
1087
|
+
};
|
|
1088
|
+
metrics: {
|
|
1089
|
+
tvlUsd: number | null;
|
|
1090
|
+
volumeUsd7d: number | null;
|
|
1091
|
+
/** @description Annualized percentage points (12.3 means 12.3%). From indexed history when available; otherwise derived from flowHistory (see feeApr7dSource). An estimate, not realized LP earnings. Null when unavailable; measured zero stays zero. */
|
|
1092
|
+
feeApr7d: number | null;
|
|
1093
|
+
/**
|
|
1094
|
+
* @description Present only when feeApr7d is derived from flowHistory: its feesUsd over windowStart..windowEnd annualized over non-stale, dated Lens TVL, in percentage points: feesUsd / 7 * 365 / tvlUsd * 100. Gross pool fees (including any protocol share) over current TVL, so a pool whose TVL changed during the window can be skewed. Absent, with feeApr7d null, for stale, undated, future-dated, unavailable or zero TVL, or a rate above 1000 (withheld as implausible); also absent when feeApr7d comes from indexed history.
|
|
1095
|
+
* @enum {string}
|
|
1096
|
+
*/
|
|
1097
|
+
feeApr7dSource?: "flow-history";
|
|
1098
|
+
/** @description Optional Ink daily volume and fee history from Uniswap provider analytics over the last seven completed UTC days. Omitted when unavailable, stale, malformed or incomplete. Provider estimates; does not affect volumeUsd7d. Without indexed history, its feesUsd derives feeApr7d (see feeApr7dSource). */
|
|
1099
|
+
flowHistory?: {
|
|
1100
|
+
/**
|
|
1101
|
+
* @description Ink chain ID.
|
|
1102
|
+
* @enum {number}
|
|
1103
|
+
*/
|
|
1104
|
+
chainId: 57073;
|
|
1105
|
+
/** @description Uniswap v4 pool ID (bytes32 PoolKey hash). */
|
|
1106
|
+
poolId: string;
|
|
1107
|
+
/**
|
|
1108
|
+
* @description Uniswap LiquidityService pool history, recorded by the processor.
|
|
1109
|
+
* @enum {string}
|
|
1110
|
+
*/
|
|
1111
|
+
source: "uniswap-liquidity-service";
|
|
1112
|
+
/**
|
|
1113
|
+
* @description Producer policy version; consumers gate on this value.
|
|
1114
|
+
* @enum {number}
|
|
1115
|
+
*/
|
|
1116
|
+
policyVersion: 1;
|
|
1117
|
+
/** @description Unix seconds when the processor fetched the provider. A fetch time, not an indexed chain head or completeness proof; admitted for at most three hours. */
|
|
1118
|
+
asOf: number;
|
|
1119
|
+
/** @description Inclusive window start in Unix seconds (UTC midnight), windowEnd minus seven days. */
|
|
1120
|
+
windowStart: number;
|
|
1121
|
+
/** @description Exclusive window end in Unix seconds: the UTC midnight ending the last completed day. Today is excluded. The current window is admitted, plus the previous one before 00:30 UTC. */
|
|
1122
|
+
windowEnd: number;
|
|
1123
|
+
/**
|
|
1124
|
+
* @description Seconds per daily point (86400).
|
|
1125
|
+
* @enum {number}
|
|
1126
|
+
*/
|
|
1127
|
+
resolution: 86400;
|
|
1128
|
+
/** @description Sum of the seven daily volumeUsd points. Uniswap provider estimate of swap volume in USD (historical analytics valuation). Separate from the rolling 168-hour volumeUsd7d. */
|
|
1129
|
+
volumeUsd: number;
|
|
1130
|
+
/** @description Sum of the seven daily feesUsd points. Uniswap provider estimate of swap fees in USD, including any protocol share; not LP fees, wallet earnings or APR. */
|
|
1131
|
+
feesUsd: number;
|
|
1132
|
+
/** @description Seven contiguous completed UTC days, oldest first, from windowStart. */
|
|
1133
|
+
daily: {
|
|
1134
|
+
/** @description UTC midnight starting this day, in Unix seconds. */
|
|
1135
|
+
timestamp: number;
|
|
1136
|
+
/** @description Uniswap provider estimate of swap volume in USD (historical analytics valuation). */
|
|
1137
|
+
volumeUsd: number;
|
|
1138
|
+
/** @description Uniswap provider estimate of swap fees in USD, including any protocol share; not LP fees, wallet earnings or APR. */
|
|
1139
|
+
feesUsd: number;
|
|
1140
|
+
}[];
|
|
1141
|
+
};
|
|
1142
|
+
};
|
|
1143
|
+
warnings: ("paused" | "surge-active" | "cap-event" | "swap-unavailable")[];
|
|
1144
|
+
observations?: {
|
|
1145
|
+
tvl: {
|
|
1146
|
+
/** Format: date-time */
|
|
1147
|
+
updatedAt: string | null;
|
|
1148
|
+
stale: boolean;
|
|
1149
|
+
};
|
|
1150
|
+
};
|
|
1151
|
+
}[];
|
|
872
1152
|
EngineToken: {
|
|
873
1153
|
/**
|
|
874
1154
|
* @example 4663
|
|
@@ -5912,7 +6192,7 @@ export interface components {
|
|
|
5912
6192
|
* @example 130
|
|
5913
6193
|
* @enum {integer}
|
|
5914
6194
|
*/
|
|
5915
|
-
chainId: 1 | 56 | 130 | 8453;
|
|
6195
|
+
chainId: 1 | 56 | 130 | 8453 | 57073;
|
|
5916
6196
|
/**
|
|
5917
6197
|
* @example aegis-direct-v4
|
|
5918
6198
|
* @enum {string}
|
|
@@ -5935,7 +6215,7 @@ export interface components {
|
|
|
5935
6215
|
* @example 130
|
|
5936
6216
|
* @enum {integer}
|
|
5937
6217
|
*/
|
|
5938
|
-
chainId: 1 | 56 | 130 | 8453;
|
|
6218
|
+
chainId: 1 | 56 | 130 | 8453 | 57073;
|
|
5939
6219
|
/**
|
|
5940
6220
|
* @example aegis-direct-v4
|
|
5941
6221
|
* @enum {string}
|
|
@@ -6971,6 +7251,7 @@ export interface operations {
|
|
|
6971
7251
|
/** @description Curated token metadata */
|
|
6972
7252
|
200: {
|
|
6973
7253
|
headers: {
|
|
7254
|
+
"Cache-Control"?: "public, max-age=60, stale-while-revalidate=60";
|
|
6974
7255
|
[name: string]: unknown;
|
|
6975
7256
|
};
|
|
6976
7257
|
content: {
|
|
@@ -7005,6 +7286,7 @@ export interface operations {
|
|
|
7005
7286
|
/** @description Curated token metadata */
|
|
7006
7287
|
200: {
|
|
7007
7288
|
headers: {
|
|
7289
|
+
"Cache-Control"?: "public, max-age=60, stale-while-revalidate=60";
|
|
7008
7290
|
[name: string]: unknown;
|
|
7009
7291
|
};
|
|
7010
7292
|
content: {
|
|
@@ -7167,6 +7449,8 @@ export interface operations {
|
|
|
7167
7449
|
window?: components["parameters"]["EngineCandleWindowQuery"];
|
|
7168
7450
|
/** @description pool is the default. token_market_reference selects a display-only line of matching hourly/daily token USD close ratios for 7d/30d/90d/180d; 1d is unsupported. No automatic fallback. */
|
|
7169
7451
|
basis?: components["parameters"]["EngineCandleBasisQuery"];
|
|
7452
|
+
/** @description Opt into exact swap candles. For 7d/30d/90d/180d, requires qualified dense pool_manager_rpc rollups; absent keeps copied Uniswap semantics. Existing exact 1d/5m remains unchanged. Incompatible with token_market_reference. Never synthesizes OHLC for quiet buckets. */
|
|
7453
|
+
aggregation?: "exact_swaps";
|
|
7170
7454
|
/** @description price_line opts into a versioned envelope with the unchanged history response and verified price-hold segments. Only pool/1d is supported. No value is inferred before a retained close or verified pool-state checkpoint; seed lookback is bounded to one additional day. */
|
|
7171
7455
|
format?: "candles" | "price_line";
|
|
7172
7456
|
};
|
|
@@ -7224,6 +7508,34 @@ export interface operations {
|
|
|
7224
7508
|
500: components["responses"]["ServerError"];
|
|
7225
7509
|
};
|
|
7226
7510
|
};
|
|
7511
|
+
listMarketsV2: {
|
|
7512
|
+
parameters: {
|
|
7513
|
+
query: {
|
|
7514
|
+
/**
|
|
7515
|
+
* @description Curated-data chain ID as a string query parameter. JSON response bodies use numeric chainId values.
|
|
7516
|
+
* @example 4663
|
|
7517
|
+
*/
|
|
7518
|
+
chainId: components["parameters"]["DataChainIdQuery"];
|
|
7519
|
+
};
|
|
7520
|
+
header?: never;
|
|
7521
|
+
path?: never;
|
|
7522
|
+
cookie?: never;
|
|
7523
|
+
};
|
|
7524
|
+
requestBody?: never;
|
|
7525
|
+
responses: {
|
|
7526
|
+
/** @description Curated v4 pools */
|
|
7527
|
+
200: {
|
|
7528
|
+
headers: {
|
|
7529
|
+
[name: string]: unknown;
|
|
7530
|
+
};
|
|
7531
|
+
content: {
|
|
7532
|
+
"application/json": components["schemas"]["MarketListV2"];
|
|
7533
|
+
};
|
|
7534
|
+
};
|
|
7535
|
+
400: components["responses"]["BadRequest"];
|
|
7536
|
+
500: components["responses"]["ServerError"];
|
|
7537
|
+
};
|
|
7538
|
+
};
|
|
7227
7539
|
listEngineMarkets: {
|
|
7228
7540
|
parameters: {
|
|
7229
7541
|
query: {
|
|
@@ -7556,7 +7868,7 @@ export interface operations {
|
|
|
7556
7868
|
getEnginePositionAccounting: {
|
|
7557
7869
|
parameters: {
|
|
7558
7870
|
query: {
|
|
7559
|
-
chainId: "1" | "56" | "130" | "8453" | "4663";
|
|
7871
|
+
chainId: "1" | "56" | "130" | "8453" | "4663" | "57073";
|
|
7560
7872
|
account: string;
|
|
7561
7873
|
poolId: string;
|
|
7562
7874
|
kind: "lend_shares" | "borrow_vault";
|
|
@@ -7746,7 +8058,7 @@ export interface operations {
|
|
|
7746
8058
|
*/
|
|
7747
8059
|
account: components["parameters"]["AccountQuery"];
|
|
7748
8060
|
/**
|
|
7749
|
-
* @description One to
|
|
8061
|
+
* @description One to six distinct supported chains, including Ink (57073); order is normalized.
|
|
7750
8062
|
* @example 8453,4663
|
|
7751
8063
|
*/
|
|
7752
8064
|
chainIds: string;
|
|
@@ -7814,7 +8126,7 @@ export interface operations {
|
|
|
7814
8126
|
};
|
|
7815
8127
|
header?: never;
|
|
7816
8128
|
path: {
|
|
7817
|
-
chainId: 1 | 56 | 130 | 8453 | 4663;
|
|
8129
|
+
chainId: 1 | 56 | 130 | 8453 | 4663 | 57073;
|
|
7818
8130
|
txHash: string;
|
|
7819
8131
|
};
|
|
7820
8132
|
cookie?: never;
|
|
@@ -7879,7 +8191,7 @@ export interface operations {
|
|
|
7879
8191
|
};
|
|
7880
8192
|
header?: never;
|
|
7881
8193
|
path: {
|
|
7882
|
-
chainId: 1 | 56 | 130 | 8453 | 4663;
|
|
8194
|
+
chainId: 1 | 56 | 130 | 8453 | 4663 | 57073;
|
|
7883
8195
|
txHash: string;
|
|
7884
8196
|
};
|
|
7885
8197
|
cookie?: never;
|
|
@@ -8077,7 +8389,7 @@ export interface operations {
|
|
|
8077
8389
|
*/
|
|
8078
8390
|
account: components["parameters"]["AccountQuery"];
|
|
8079
8391
|
/**
|
|
8080
|
-
* @description One to
|
|
8392
|
+
* @description One to six distinct supported chains, comma separated: 1,56,130,8453,4663,57073. Order is normalized.
|
|
8081
8393
|
* @example 8453,4663
|
|
8082
8394
|
*/
|
|
8083
8395
|
chainIds: string;
|
|
@@ -8135,7 +8447,7 @@ export interface operations {
|
|
|
8135
8447
|
*/
|
|
8136
8448
|
account: components["parameters"]["AccountQuery"];
|
|
8137
8449
|
/**
|
|
8138
|
-
* @description One to
|
|
8450
|
+
* @description One to six distinct supported chains, comma separated: 1,56,130,8453,4663,57073. Order is normalized.
|
|
8139
8451
|
* @example 8453,4663
|
|
8140
8452
|
*/
|
|
8141
8453
|
chainIds: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const PORTFOLIO_MODEL: "engine-portfolio-v1";
|
|
3
|
-
export declare const PORTFOLIO_CHAINS: readonly [1, 56, 130, 8453, 4663];
|
|
3
|
+
export declare const PORTFOLIO_CHAINS: readonly [1, 56, 130, 8453, 4663, 57073];
|
|
4
|
+
export declare const PORTFOLIO_MAX_POSITIONS: number;
|
|
4
5
|
export declare const PortfolioQuerySchema: z.ZodObject<{
|
|
5
6
|
account: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
6
7
|
chainIds: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<number[], string>>, z.ZodTransform<number[], number[]>>;
|
|
@@ -22,6 +22,21 @@ export type AegisEngineChainAddresses = {
|
|
|
22
22
|
permit2: Address;
|
|
23
23
|
weth9: Address;
|
|
24
24
|
};
|
|
25
|
+
export declare function parseAdditionalEngineDeployments(raw: unknown): Map<string, {
|
|
26
|
+
chainId: number;
|
|
27
|
+
version: AegisEngineVersion;
|
|
28
|
+
addresses: AegisEngineChainAddresses;
|
|
29
|
+
}>;
|
|
30
|
+
export declare function trustedEngineDeploymentForMarket(market: {
|
|
31
|
+
chainId: number;
|
|
32
|
+
poolKey: {
|
|
33
|
+
hooks: Address;
|
|
34
|
+
};
|
|
35
|
+
}): {
|
|
36
|
+
version: AegisEngineVersion;
|
|
37
|
+
addresses: AegisEngineChainAddresses;
|
|
38
|
+
name: string;
|
|
39
|
+
} | null;
|
|
25
40
|
export declare function trustedEngineVersionForChain(chainId: number): AegisEngineVersion | null;
|
|
26
41
|
export declare function trustedEngineRegistryForChain(chainId: number): AegisEngineChainAddresses | null;
|
|
27
42
|
export declare function engineRouterForChain(chainId: number): Address;
|
package/dist/engine/types.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -7,9 +7,9 @@ export type { DirectSwapQuote, ReconciledSubmitQuote, SwapQuoteMode } from './qu
|
|
|
7
7
|
export { AggregatedSwapBuildMismatchError, aggregatedSwapErrorMessage, assertAggregatedQuoteLiquidity, fetchAggregatedSwapQuote } from './quote/aggregatedSwapQuote.js';
|
|
8
8
|
export { NoAegisRouteError, assertAegisOnlyRouteLegs } from './quote/routeProvider.js';
|
|
9
9
|
export type { NoAegisRouteReason } from './quote/routeProvider.js';
|
|
10
|
-
export type { AggregatedSwapExecutionIntent } from './quote/aggregatedSwapQuote.js';
|
|
10
|
+
export type { AggregatedSwapExecutionIntent, AggregatedSwapQuoteOptions } from './quote/aggregatedSwapQuote.js';
|
|
11
11
|
export { AggregatedSwapCalldataError } from './quote/kyberCalldata.js';
|
|
12
|
-
export type { AggregatedSwapQuote, AggregatedSwapRoute, HopInfo } from './types/aggregatedSwap.js';
|
|
12
|
+
export type { AggregatedSwapQuote, AggregatedSwapRoute, AggregatedSwapRouteLeg, AggregatedSwapRoutePath, HopInfo } from './types/aggregatedSwap.js';
|
|
13
13
|
export { KYBER_AEGIS_LIQUIDITY_SOURCE, KyberSwapApiError, KyberSwapContractError, KyberSwapResourceLimitError, buildKyberSwapRoute, fetchKyberSwapRoute, isRetryableKyberSwapError } from './services/kyberSwap.js';
|
|
14
14
|
export type { AggregatedSwapLiquiditySources, KyberSwapBuild, KyberSwapError, KyberSwapFeeParams, KyberSwapRoute, KyberSwapRouteLeg, KyberSwapRouteSummary } from './services/kyberSwap.js';
|
|
15
15
|
export { approveErc20Spender, approveErc20ToPermit2, approvePermit2ToRouter, buildSignedPermitBatch, DEFAULT_PERMIT_EXPIRATION_SECONDS, hasUsablePermit2Allowance, isUnlimitedErc20Approval, isUnlimitedPermit2Approval, MAX_UINT160, MAX_UINT256, PERMIT2_FAR_FUTURE_EXPIRATION, readErc20Allowance, readPermit2RouterAllowance, SWAP_TX_DEADLINE_SECONDS, UNLIMITED_ERC20_FLOOR, UNLIMITED_PERMIT2_FLOOR } from './permit.js';
|
|
@@ -21,6 +21,18 @@ export type AggregatedSwapExecutionIntent = Readonly<{
|
|
|
21
21
|
/** Signed Permit2 grant for routers that pull input through Permit2. */
|
|
22
22
|
permit?: SignedPermitBatch | null;
|
|
23
23
|
}>;
|
|
24
|
+
/** Options for {@link fetchAggregatedSwapQuote}. */
|
|
25
|
+
export type AggregatedSwapQuoteOptions = {
|
|
26
|
+
liquiditySources?: AggregatedSwapLiquiditySources;
|
|
27
|
+
/**
|
|
28
|
+
* Output fee in bps from the deployment's `/v1/config` (`fee.outputFeeBps`),
|
|
29
|
+
* an integer from 0 to 200. Omit it when config is unavailable to keep the
|
|
30
|
+
* bundled default ({@link AGGREGATED_SWAP_FEE_BPS}); 0 charges no fee.
|
|
31
|
+
*/
|
|
32
|
+
outputFeeBps?: number;
|
|
33
|
+
};
|
|
34
|
+
/** The fee bps a quote on `chainId` must carry under `outputFeeBps`. */
|
|
35
|
+
export declare function expectedAggregatedFeeBps(chainId: number, outputFeeBps: number | undefined): number;
|
|
24
36
|
export declare function assertAggregatedRouterTrusted(router: Address, chainId: number): void;
|
|
25
37
|
/**
|
|
26
38
|
* Re-checks, immediately before signing, that an executable quote was built
|
|
@@ -30,6 +42,4 @@ export declare function assertAggregatedRouterTrusted(router: Address, chainId:
|
|
|
30
42
|
export declare function assertAggregatedQuoteLiquidity(quote: Pick<AggregatedSwapQuote, 'hops' | 'liquiditySources'>, liquiditySources: AggregatedSwapLiquiditySources): void;
|
|
31
43
|
export declare function fetchAggregatedSwapQuote(inputToken: AegisSwapToken, outputToken: AegisSwapToken, amount: bigint, slippageBps: number, mode?: 'exactIn' | 'exactOut', account?: Address | null, signal?: AbortSignal,
|
|
32
44
|
/** Read client; the on-chain Ink provider quotes through it. */
|
|
33
|
-
publicClient?: PublicClient, executionIntent?: AggregatedSwapExecutionIntent, options?:
|
|
34
|
-
liquiditySources?: AggregatedSwapLiquiditySources;
|
|
35
|
-
}): Promise<AggregatedSwapQuote>;
|
|
45
|
+
publicClient?: PublicClient, executionIntent?: AggregatedSwapExecutionIntent, options?: AggregatedSwapQuoteOptions): Promise<AggregatedSwapQuote>;
|