@merkl/api 0.20.24 → 0.20.26
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/dist/src/eden/index.d.ts +97 -16
- package/dist/src/engine/dynamicData/utils/getUniswapV4Pools.d.ts +4 -2
- package/dist/src/engine/dynamicData/utils/getUniswapV4Pools.js +13 -8
- package/dist/src/engine/opportunityMetadata/implementations/Clamm.d.ts +2 -2
- package/dist/src/engine/opportunityMetadata/implementations/Clamm.js +51 -111
- package/dist/src/index.d.ts +41 -8
- package/dist/src/modules/v4/uniswapV4/uniswapV4.model.d.ts +3 -0
- package/dist/src/modules/v4/uniswapV4/uniswapV4.model.js +5 -0
- package/dist/src/routes/v3/router.d.ts +41 -8
- package/dist/src/routes/v3/uniswapv4.d.ts +42 -15
- package/dist/src/routes/v3/uniswapv4.js +28 -8
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/src/eden/index.d.ts
CHANGED
@@ -8190,15 +8190,39 @@ declare const eden: {
|
|
8190
8190
|
};
|
8191
8191
|
}>>;
|
8192
8192
|
};
|
8193
|
-
uniswapv4: {
|
8194
|
-
|
8193
|
+
uniswapv4: ((params: {
|
8194
|
+
chainId: string | number;
|
8195
|
+
}) => {
|
8196
|
+
get: (options?: {
|
8195
8197
|
headers?: Record<string, unknown> | undefined;
|
8196
|
-
query
|
8198
|
+
query?: Record<string, unknown> | undefined;
|
8197
8199
|
fetch?: RequestInit | undefined;
|
8198
|
-
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
8200
|
+
} | undefined) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
8199
8201
|
[x: string]: any;
|
8200
8202
|
200: any;
|
8201
8203
|
}>>;
|
8204
|
+
}) & {
|
8205
|
+
index: {
|
8206
|
+
get: (options?: {
|
8207
|
+
headers?: Record<string, unknown> | undefined;
|
8208
|
+
query?: Record<string, unknown> | undefined;
|
8209
|
+
fetch?: RequestInit | undefined;
|
8210
|
+
} | undefined) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
8211
|
+
[x: string]: any;
|
8212
|
+
200: any;
|
8213
|
+
}>>;
|
8214
|
+
};
|
8215
|
+
pool: ((params: {
|
8216
|
+
poolId: string | number;
|
8217
|
+
}) => {
|
8218
|
+
get: (options?: {
|
8219
|
+
headers?: Record<string, unknown> | undefined;
|
8220
|
+
query?: Record<string, unknown> | undefined;
|
8221
|
+
fetch?: RequestInit | undefined;
|
8222
|
+
} | undefined) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
8223
|
+
200: UniswapV4PoolType[];
|
8224
|
+
}>>;
|
8225
|
+
}) & {};
|
8202
8226
|
};
|
8203
8227
|
};
|
8204
8228
|
};
|
@@ -13788,14 +13812,47 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
13788
13812
|
} & {
|
13789
13813
|
v3: {
|
13790
13814
|
uniswapv4: {
|
13791
|
-
|
13792
|
-
|
13793
|
-
|
13794
|
-
|
13795
|
-
|
13796
|
-
|
13797
|
-
|
13798
|
-
|
13815
|
+
index: {
|
13816
|
+
get: {
|
13817
|
+
body: unknown;
|
13818
|
+
params: {};
|
13819
|
+
query: unknown;
|
13820
|
+
headers: unknown;
|
13821
|
+
response: {
|
13822
|
+
[x: string]: any;
|
13823
|
+
200: any;
|
13824
|
+
};
|
13825
|
+
};
|
13826
|
+
};
|
13827
|
+
} & {
|
13828
|
+
":chainId": {
|
13829
|
+
get: {
|
13830
|
+
body: unknown;
|
13831
|
+
params: {
|
13832
|
+
chainId: number;
|
13833
|
+
};
|
13834
|
+
query: unknown;
|
13835
|
+
headers: unknown;
|
13836
|
+
response: {
|
13837
|
+
[x: string]: any;
|
13838
|
+
200: any;
|
13839
|
+
};
|
13840
|
+
};
|
13841
|
+
};
|
13842
|
+
} & {
|
13843
|
+
pool: {
|
13844
|
+
":poolId": {
|
13845
|
+
get: {
|
13846
|
+
body: unknown;
|
13847
|
+
params: {
|
13848
|
+
poolId: string;
|
13849
|
+
};
|
13850
|
+
query: unknown;
|
13851
|
+
headers: unknown;
|
13852
|
+
response: {
|
13853
|
+
200: UniswapV4PoolType[];
|
13854
|
+
};
|
13855
|
+
};
|
13799
13856
|
};
|
13800
13857
|
};
|
13801
13858
|
};
|
@@ -21998,15 +22055,39 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
21998
22055
|
};
|
21999
22056
|
}>>;
|
22000
22057
|
};
|
22001
|
-
uniswapv4: {
|
22002
|
-
|
22058
|
+
uniswapv4: ((params: {
|
22059
|
+
chainId: string | number;
|
22060
|
+
}) => {
|
22061
|
+
get: (options?: {
|
22003
22062
|
headers?: Record<string, unknown> | undefined;
|
22004
|
-
query
|
22063
|
+
query?: Record<string, unknown> | undefined;
|
22005
22064
|
fetch?: RequestInit | undefined;
|
22006
|
-
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
22065
|
+
} | undefined) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
22007
22066
|
[x: string]: any;
|
22008
22067
|
200: any;
|
22009
22068
|
}>>;
|
22069
|
+
}) & {
|
22070
|
+
index: {
|
22071
|
+
get: (options?: {
|
22072
|
+
headers?: Record<string, unknown> | undefined;
|
22073
|
+
query?: Record<string, unknown> | undefined;
|
22074
|
+
fetch?: RequestInit | undefined;
|
22075
|
+
} | undefined) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
22076
|
+
[x: string]: any;
|
22077
|
+
200: any;
|
22078
|
+
}>>;
|
22079
|
+
};
|
22080
|
+
pool: ((params: {
|
22081
|
+
poolId: string | number;
|
22082
|
+
}) => {
|
22083
|
+
get: (options?: {
|
22084
|
+
headers?: Record<string, unknown> | undefined;
|
22085
|
+
query?: Record<string, unknown> | undefined;
|
22086
|
+
fetch?: RequestInit | undefined;
|
22087
|
+
} | undefined) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
22088
|
+
200: UniswapV4PoolType[];
|
22089
|
+
}>>;
|
22090
|
+
}) & {};
|
22010
22091
|
};
|
22011
22092
|
};
|
22012
22093
|
};
|
@@ -1,8 +1,10 @@
|
|
1
1
|
import { type MerklChainId, type UniswapV4PoolType } from "@sdk";
|
2
|
+
export declare const UniV4ChainIdArray: MerklChainId[];
|
3
|
+
type UniV4ChainId = (typeof UniV4ChainIdArray)[number];
|
2
4
|
export type UniswapV4PoolsReturnType = {
|
3
5
|
[chainId in MerklChainId]?: {
|
4
6
|
[poolId: string]: UniswapV4PoolType;
|
5
7
|
};
|
6
8
|
};
|
7
|
-
export declare function getUniswapV4Pools(): Promise<UniswapV4PoolsReturnType>;
|
8
|
-
export
|
9
|
+
export declare function getUniswapV4Pools(chainId?: UniV4ChainId): Promise<UniswapV4PoolsReturnType>;
|
10
|
+
export {};
|
@@ -1,24 +1,30 @@
|
|
1
|
-
import { Redis } from "@/cache";
|
2
1
|
import { log } from "@/utils/logger";
|
3
2
|
import { providers } from "@/utils/providers";
|
4
3
|
import { apiDbClient } from "@db";
|
5
4
|
import { ChainInteractionService, ERC20Interface, NETWORK_LABELS, NULL_ADDRESS, UniswapV4Addresses, UniswapV4PoolManagerInterface, getContractCreationBlock, } from "@sdk";
|
6
5
|
import { safeFetchLogs } from "./fetchLogs";
|
7
6
|
import { LoggedEntityType } from "./getEulerV2Vaults";
|
8
|
-
const
|
9
|
-
export async function getUniswapV4Pools() {
|
7
|
+
export const UniV4ChainIdArray = Object.keys(UniswapV4Addresses).map((x) => Number(x));
|
8
|
+
export async function getUniswapV4Pools(chainId) {
|
9
|
+
let chainIdArray;
|
10
|
+
if (!!chainId) {
|
11
|
+
chainIdArray = [chainId];
|
12
|
+
}
|
13
|
+
else {
|
14
|
+
chainIdArray = UniV4ChainIdArray;
|
15
|
+
}
|
10
16
|
const pools = {};
|
11
17
|
// 0_ Fetch all euler vaults from database
|
12
18
|
const storedPools = await apiDbClient.logged.findMany({
|
13
19
|
where: { type: LoggedEntityType.UNISWAP_V4 },
|
14
20
|
});
|
15
|
-
const res = await Promise.all(
|
21
|
+
const res = await Promise.all(chainIdArray.map(async (chainId) => {
|
16
22
|
chainId = chainId;
|
17
23
|
const perChainIdRes = {};
|
18
24
|
const poolManagerAddress = UniswapV4Addresses[chainId]?.PoolManager ?? NULL_ADDRESS;
|
19
25
|
const jsonRPCprovider = providers[chainId];
|
20
26
|
try {
|
21
|
-
// 1_ Get latest
|
27
|
+
// 1_ Get latest uniswapV4 pools for `chainId`
|
22
28
|
const storedPoolsPerChain = storedPools.filter(pool => pool.chainId === chainId);
|
23
29
|
log.info(`found ${storedPoolsPerChain.length} already stored pools on ${NETWORK_LABELS[chainId]}`);
|
24
30
|
let fromBlock;
|
@@ -137,13 +143,13 @@ export async function getUniswapV4Pools() {
|
|
137
143
|
}
|
138
144
|
return perChainIdRes;
|
139
145
|
}));
|
140
|
-
|
146
|
+
chainIdArray.forEach((chainId, i) => {
|
141
147
|
if (!!res[i])
|
142
148
|
pools[chainId] = res[i];
|
143
149
|
});
|
144
150
|
// Update the API database
|
145
151
|
const tableData = Object.values(pools).flatMap(pools => Object.values(pools));
|
146
|
-
for (const chainId of
|
152
|
+
for (const chainId of chainIdArray) {
|
147
153
|
if (tableData.filter(p => p.chainId === chainId).length > 0) {
|
148
154
|
try {
|
149
155
|
await apiDbClient.logged.createMany({
|
@@ -180,4 +186,3 @@ export async function getUniswapV4Pools() {
|
|
180
186
|
log.info("👋 exiting getUniswapV4Pools");
|
181
187
|
return pools;
|
182
188
|
}
|
183
|
-
export const getUniswapV4PoolsWithCache = async () => await Redis.getOrSet("UniswapV4Pools", getUniswapV4Pools);
|
@@ -36,9 +36,9 @@ export declare class ClammMetadata implements MetadataBuilder<campaignType> {
|
|
36
36
|
address: any;
|
37
37
|
}[];
|
38
38
|
mainProtocol: ProtocolId;
|
39
|
-
depositUrl: string
|
39
|
+
depositUrl: string;
|
40
40
|
explorerAddress: `0x${string}`;
|
41
41
|
}>;
|
42
|
-
static generateUrl(computeChainId: ChainId, params: CampaignParameters<campaignType>["campaignParameters"]): string
|
42
|
+
static generateUrl(computeChainId: ChainId, params: CampaignParameters<campaignType>["campaignParameters"]): string;
|
43
43
|
}
|
44
44
|
export {};
|
@@ -105,118 +105,58 @@ export class ClammMetadata {
|
|
105
105
|
};
|
106
106
|
}
|
107
107
|
static generateUrl(computeChainId, params) {
|
108
|
-
|
109
|
-
|
108
|
+
const sanitizeChain = (computeChain) => NETWORK_LABELS[computeChain]?.toLowerCase().replaceAll(" ", "");
|
109
|
+
const sanitizeFee = (poolFee) => Number(poolFee) * 10000;
|
110
|
+
const ammLinkMap = {
|
111
|
+
UniswapV3: ({ poolAddress }) => {
|
110
112
|
const availableOnOku = Object.keys(uniswapV3OkuChains).includes(computeChainId?.toString());
|
111
|
-
if (availableOnOku)
|
113
|
+
if (availableOnOku)
|
112
114
|
return `https://oku.trade/app/${uniswapV3OkuChains[computeChainId]}/liquidity/${params.poolAddress} `;
|
113
|
-
}
|
114
|
-
return `https://app.uniswap.org/explore/pools/${
|
115
|
-
|
116
|
-
|
117
|
-
}
|
118
|
-
|
119
|
-
|
120
|
-
}
|
121
|
-
|
122
|
-
|
123
|
-
}
|
124
|
-
|
125
|
-
|
126
|
-
}
|
127
|
-
|
128
|
-
|
129
|
-
}
|
130
|
-
|
131
|
-
|
132
|
-
}
|
133
|
-
|
134
|
-
|
135
|
-
}
|
136
|
-
|
137
|
-
|
138
|
-
}
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
}
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
}
|
160
|
-
case AMM.Thruster: {
|
161
|
-
return "https://app.thruster.finance/add";
|
162
|
-
}
|
163
|
-
case AMM.Kim: {
|
164
|
-
return "https://app.kim.exchange/positions";
|
165
|
-
}
|
166
|
-
case AMM.Stryke: {
|
167
|
-
return "https://www.stryke.xyz/en/dashboard";
|
168
|
-
}
|
169
|
-
case AMM.StrykePCS: {
|
170
|
-
return `https://pancakeswap.stryke.xyz/${params.symbolToken0}-${params.symbolToken1}?mode=LP`;
|
171
|
-
}
|
172
|
-
case AMM.StrykeSushi: {
|
173
|
-
return `https://sushiswap.stryke.xyz/${params.symbolToken0}-${params.symbolToken1}?mode=LP`;
|
174
|
-
}
|
175
|
-
case AMM.ARTHSWAP: {
|
176
|
-
return "https://app.arthswap.org/#/pools";
|
177
|
-
}
|
178
|
-
case AMM.Fenix: {
|
179
|
-
return "https://www.fenixfinance.io/";
|
180
|
-
}
|
181
|
-
case AMM.Ramses: {
|
182
|
-
return "https://app.ramses.exchange/swap";
|
183
|
-
}
|
184
|
-
case AMM.Voltage: {
|
185
|
-
return `https://app.voltage.finance/add/${params.token0?.toLowerCase()}/${params.token1?.toLowerCase()}?version=v3&feeAmount=${Number(params.poolFee) * 10000}`;
|
186
|
-
}
|
187
|
-
case AMM.Izumi: {
|
188
|
-
return `https://${computeChainId === ChainId.ROOTSTOCK ? "woodswap.org" : "izumi.finance"}/trade/add-liquidity/?token0=${params.token0}&token1=${params.token1}&chainId=${computeChainId}&fee=${Number(params.poolFee) * 10000}`;
|
189
|
-
}
|
190
|
-
case AMM.KOI: {
|
191
|
-
return `https://dapp.koi.finance/pool/v3/new/${params.token0?.toLowerCase()}/${params.token1?.toLowerCase()}`;
|
192
|
-
}
|
193
|
-
case AMM.SupswapV3: {
|
194
|
-
return `https://supswap.xyz/add/${params.token0?.toLowerCase()}/${params.token1?.toLowerCase()}/${Number.parseInt(params.poolFee) * 10000}`;
|
195
|
-
}
|
196
|
-
case AMM.zkSwap: {
|
197
|
-
return `https://www.zkswap.finance/add/${params.token0?.toLowerCase()}/${params.token1?.toLowerCase()}/2000?chain=${computeChainId}`;
|
198
|
-
}
|
199
|
-
case AMM.SyncswapV3: {
|
200
|
-
return "https://www.syncswap.xyz/pools";
|
201
|
-
}
|
202
|
-
case AMM.Neptune: {
|
203
|
-
return "https://app.nep.finance/add/";
|
204
|
-
}
|
205
|
-
case AMM.SwapX: {
|
206
|
-
return "https://swapx.fi/earn";
|
207
|
-
}
|
208
|
-
case AMM.Velodrome: {
|
209
|
-
return "https://app.velodrome.finance/";
|
210
|
-
}
|
211
|
-
case AMM.AERODROME: {
|
212
|
-
return "https://app.aerodrome.finance/";
|
213
|
-
}
|
214
|
-
case AMM.ThirdTrade: {
|
215
|
-
return "https://app.thirdtrade.xyz/";
|
216
|
-
}
|
217
|
-
case AMM.Katana: {
|
218
|
-
return "https://app.roninchain.com/liquidity";
|
219
|
-
}
|
220
|
-
}
|
115
|
+
const chainLabel = computeChainId === ChainId.MAINNET ? "ethereum/" : `${sanitizeChain(computeChainId)}/`;
|
116
|
+
return `https://app.uniswap.org/explore/pools/${chainLabel}${poolAddress?.toLowerCase()}`;
|
117
|
+
},
|
118
|
+
//Pool address mappings
|
119
|
+
Sonex: ({ poolAddress }) => `https://app.sonex.so/explore/pools/${poolAddress}`,
|
120
|
+
KYO: ({ poolAddress }) => `https://app.kyo.finance/liquidity/${poolAddress}`,
|
121
|
+
SushiSwapV3: ({ poolAddress }) => `https://www.sushi.com/${sushiswapv3Chains[computeChainId] ?? sanitizeChain(computeChainId)}/pool/v3/${poolAddress}`,
|
122
|
+
Swapr: ({ poolAddress }) => `https://v3.swapr.eth.limo/#/info/pools/${poolAddress}`,
|
123
|
+
Crust: ({ poolAddress }) => `https://v1.crust.finance/liquidity/${poolAddress}`,
|
124
|
+
ThirdTrade: ({ poolAddress }) => `https://third.trade/pool/${poolAddress}`,
|
125
|
+
Katana: ({ poolAddress }) => `https://app.roninchain.com/liquidity/${poolAddress}`,
|
126
|
+
SyncswapV3: ({ poolAddress }) => `https://syncswap.xyz/pool/${poolAddress}`,
|
127
|
+
//Token address mappings
|
128
|
+
Camelot: ({ token0, token1 }) => `https://app.camelot.exchange/liquidity?type=v3&token1=${token0}&token2=${token1}`,
|
129
|
+
QuickswapAlgebra: ({ token0, token1 }) => `https://quickswap.exchange/#/pools?currency0=${token0}¤cy1=${token1}`,
|
130
|
+
QuickswapUni: ({ token0, token1 }) => `https://quickswap.exchange/#/pools?currency0=${token0}¤cy1=${token1}`,
|
131
|
+
QuickswapAlgebraV1_2: ({ token0, token1 }) => `https://quickswap.exchange/#/pools?currency0=${token0}¤cy1=${token1}`,
|
132
|
+
AERODROME: ({ token0, token1 }) => `https://aerodrome.finance/pools?token0=${token0}&token1=${token1}&type=1&chain=${computeChainId}`,
|
133
|
+
KOI: ({ token0, token1 }) => `https://dapp.koi.finance/pool/v3/new/${token0}/${token1}`,
|
134
|
+
zkSwap: ({ token0, token1 }) => `https://www.zkswap.finance/add/${token0}/${token1}/2000?chain=${computeChainId}`,
|
135
|
+
Velodrome: ({ token0, token1 }) => `https://velodrome.finance/pools?token0=${token0}&token1=${token1}&type=1&chain=${computeChainId}`,
|
136
|
+
//Token address and pool fess
|
137
|
+
PancakeSwapV3: ({ token0, token1, poolFee }) => `https://pancakeswap.finance/add/${token0}/${token1}/${sanitizeFee(poolFee)}?chain=${pancakeswapChains[computeChainId] ?? sanitizeChain(computeChainId)}`,
|
138
|
+
BaseSwap: ({ token0, token1, poolFee }) => `https://${computeChainId === ChainId.MODE ? "swapmode" : "baseswap"}.fi/addV3?currencyIdA=${token0}¤cyIdB=${token1}&feeAmount=${sanitizeFee(poolFee)}`,
|
139
|
+
Voltage: ({ token0, token1, poolFee }) => `https://app.voltage.finance/add/${token0}/${token1}?version=v3&feeAmount=${sanitizeFee(poolFee)}`,
|
140
|
+
Izumi: ({ token0, token1, poolFee }) => `https://${computeChainId === ChainId.ROOTSTOCK ? "woodswap.org" : "izumi.finance"}/trade/add-liquidity/?token0=${token0}&token1=${token1}&chainId=${computeChainId}&fee=${Number(poolFee) * 10000}`,
|
141
|
+
SupswapV3: ({ token0, token1, poolFee }) => `https://supswap.xyz/add/${token0}/${token1}/${sanitizeFee(poolFee)}`,
|
142
|
+
Iguana: ({ token0, token1, poolFee }) => `https://www.iguanadex.com/add/${token0}/${token1}/${sanitizeFee(poolFee)}?chain=${sanitizeChain(computeChainId)}`,
|
143
|
+
//Token symbols
|
144
|
+
Stryke: ({ symbolToken0, symbolToken1 }) => `https://www.stryke.xyz/en/trade/arbitrum/${symbolToken0}-${symbolToken1}`,
|
145
|
+
StrykePCS: ({ symbolToken0, symbolToken1 }) => `https://pancakeswap.stryke.xyz/${symbolToken0}-${symbolToken1}?mode=LP`,
|
146
|
+
StrykeSushi: ({ symbolToken0, symbolToken1 }) => `https://sushiswap.stryke.xyz/${symbolToken0}-${symbolToken1}?mode=LP`,
|
147
|
+
//Token symbols and pool fees
|
148
|
+
Neptune: ({ symbolToken0, symbolToken1, poolFee }) => `https://app.nep.finance/add/${symbolToken0}/${symbolToken1}/${sanitizeFee(poolFee)}`,
|
149
|
+
//Protocols without unique links for pools
|
150
|
+
Retro: () => "https://retro.finance/liquidity/managev3",
|
151
|
+
Horiza: () => "https:/app.horiza.io/liquidity",
|
152
|
+
Thruster: () => "https://app.thruster.finance/add",
|
153
|
+
Kim: () => "https://app.kim.exchange/positions",
|
154
|
+
ARTHSWAP: () => "https://app.arthswap.org/#/pools",
|
155
|
+
Fenix: () => "https://www.fenixfinance.io/",
|
156
|
+
Ramses: () => "https://app.ramses.exchange/swap",
|
157
|
+
SwapX: () => "https://swapx.fi/earn",
|
158
|
+
ZERO: () => "https://www.zkzero.fi/",
|
159
|
+
};
|
160
|
+
return ammLinkMap[params.amm]?.(params)?.toLowerCase();
|
221
161
|
}
|
222
162
|
}
|
package/dist/src/index.d.ts
CHANGED
@@ -5577,14 +5577,47 @@ declare const app: Elysia<"", false, {
|
|
5577
5577
|
} & {
|
5578
5578
|
v3: {
|
5579
5579
|
uniswapv4: {
|
5580
|
-
|
5581
|
-
|
5582
|
-
|
5583
|
-
|
5584
|
-
|
5585
|
-
|
5586
|
-
|
5587
|
-
|
5580
|
+
index: {
|
5581
|
+
get: {
|
5582
|
+
body: unknown;
|
5583
|
+
params: {};
|
5584
|
+
query: unknown;
|
5585
|
+
headers: unknown;
|
5586
|
+
response: {
|
5587
|
+
[x: string]: any;
|
5588
|
+
200: any;
|
5589
|
+
};
|
5590
|
+
};
|
5591
|
+
};
|
5592
|
+
} & {
|
5593
|
+
":chainId": {
|
5594
|
+
get: {
|
5595
|
+
body: unknown;
|
5596
|
+
params: {
|
5597
|
+
chainId: number;
|
5598
|
+
};
|
5599
|
+
query: unknown;
|
5600
|
+
headers: unknown;
|
5601
|
+
response: {
|
5602
|
+
[x: string]: any;
|
5603
|
+
200: any;
|
5604
|
+
};
|
5605
|
+
};
|
5606
|
+
};
|
5607
|
+
} & {
|
5608
|
+
pool: {
|
5609
|
+
":poolId": {
|
5610
|
+
get: {
|
5611
|
+
body: unknown;
|
5612
|
+
params: {
|
5613
|
+
poolId: string;
|
5614
|
+
};
|
5615
|
+
query: unknown;
|
5616
|
+
headers: unknown;
|
5617
|
+
response: {
|
5618
|
+
200: UniswapV4PoolType[];
|
5619
|
+
};
|
5620
|
+
};
|
5588
5621
|
};
|
5589
5622
|
};
|
5590
5623
|
};
|
@@ -1,6 +1,9 @@
|
|
1
1
|
import type { apiDbClient } from "@db";
|
2
2
|
import type { Prisma } from "@db/api";
|
3
3
|
import type { MerklChainId, UniswapV4PoolType } from "@sdk";
|
4
|
+
export declare const Bytes32Dto: import("@sinclair/typebox").TObject<{
|
5
|
+
poolId: import("@sinclair/typebox").TRegExp;
|
6
|
+
}>;
|
4
7
|
export declare const UniswapV4PoolsDto: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TObject<{
|
5
8
|
poolKey: import("@sinclair/typebox").TObject<{
|
6
9
|
currency0: import("@sinclair/typebox").TString;
|
@@ -14,4 +14,9 @@ const UniswapV4PoolDto = t.Object({
|
|
14
14
|
symbolCurrency0: t.String(),
|
15
15
|
symbolCurrency1: t.String(),
|
16
16
|
});
|
17
|
+
export const Bytes32Dto = t.Object({
|
18
|
+
poolId: t.RegExp(/^0x[a-fA-F0-9]{64}$/, {
|
19
|
+
description: "A 32-byte hexadecimal string (bytes32)",
|
20
|
+
}),
|
21
|
+
});
|
17
22
|
export const UniswapV4PoolsDto = t.Record(t.String(), UniswapV4PoolDto);
|
@@ -769,14 +769,47 @@ export declare const v3: Elysia<"/v3", false, {
|
|
769
769
|
} & {
|
770
770
|
v3: {
|
771
771
|
uniswapv4: {
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
772
|
+
index: {
|
773
|
+
get: {
|
774
|
+
body: unknown;
|
775
|
+
params: {};
|
776
|
+
query: unknown;
|
777
|
+
headers: unknown;
|
778
|
+
response: {
|
779
|
+
[x: string]: any;
|
780
|
+
200: any;
|
781
|
+
};
|
782
|
+
};
|
783
|
+
};
|
784
|
+
} & {
|
785
|
+
":chainId": {
|
786
|
+
get: {
|
787
|
+
body: unknown;
|
788
|
+
params: {
|
789
|
+
chainId: number;
|
790
|
+
};
|
791
|
+
query: unknown;
|
792
|
+
headers: unknown;
|
793
|
+
response: {
|
794
|
+
[x: string]: any;
|
795
|
+
200: any;
|
796
|
+
};
|
797
|
+
};
|
798
|
+
};
|
799
|
+
} & {
|
800
|
+
pool: {
|
801
|
+
":poolId": {
|
802
|
+
get: {
|
803
|
+
body: unknown;
|
804
|
+
params: {
|
805
|
+
poolId: string;
|
806
|
+
};
|
807
|
+
query: unknown;
|
808
|
+
headers: unknown;
|
809
|
+
response: {
|
810
|
+
200: UniswapV4PoolType[];
|
811
|
+
};
|
812
|
+
};
|
780
813
|
};
|
781
814
|
};
|
782
815
|
};
|
@@ -1,10 +1,4 @@
|
|
1
|
-
import {
|
2
|
-
export declare const response: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
3
|
-
address: import("@sinclair/typebox").TString;
|
4
|
-
asset: import("@sinclair/typebox").TString;
|
5
|
-
chaind: import("@sinclair/typebox").TNumber;
|
6
|
-
debtTokenAddress: import("@sinclair/typebox").TString;
|
7
|
-
}>>;
|
1
|
+
import type { Elysia } from "elysia";
|
8
2
|
declare const _default: (app: Elysia) => Elysia<"", false, {
|
9
3
|
decorator: {};
|
10
4
|
store: {};
|
@@ -19,14 +13,47 @@ declare const _default: (app: Elysia) => Elysia<"", false, {
|
|
19
13
|
macroFn: {};
|
20
14
|
}, {
|
21
15
|
uniswapv4: {
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
16
|
+
index: {
|
17
|
+
get: {
|
18
|
+
body: unknown;
|
19
|
+
params: {};
|
20
|
+
query: unknown;
|
21
|
+
headers: unknown;
|
22
|
+
response: {
|
23
|
+
[x: string]: any;
|
24
|
+
200: any;
|
25
|
+
};
|
26
|
+
};
|
27
|
+
};
|
28
|
+
} & {
|
29
|
+
":chainId": {
|
30
|
+
get: {
|
31
|
+
body: unknown;
|
32
|
+
params: {
|
33
|
+
chainId: number;
|
34
|
+
};
|
35
|
+
query: unknown;
|
36
|
+
headers: unknown;
|
37
|
+
response: {
|
38
|
+
[x: string]: any;
|
39
|
+
200: any;
|
40
|
+
};
|
41
|
+
};
|
42
|
+
};
|
43
|
+
} & {
|
44
|
+
pool: {
|
45
|
+
":poolId": {
|
46
|
+
get: {
|
47
|
+
body: unknown;
|
48
|
+
params: {
|
49
|
+
poolId: string;
|
50
|
+
};
|
51
|
+
query: unknown;
|
52
|
+
headers: unknown;
|
53
|
+
response: {
|
54
|
+
200: UniswapV4PoolType[];
|
55
|
+
};
|
56
|
+
};
|
30
57
|
};
|
31
58
|
};
|
32
59
|
};
|
@@ -1,9 +1,29 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
import { Redis } from "@/cache";
|
2
|
+
import { UniV4ChainIdArray, getUniswapV4Pools } from "@/engine/dynamicData/utils/getUniswapV4Pools";
|
3
|
+
import { ChainUniqueDto } from "@/modules/v4/chain/chain.model";
|
4
|
+
import { Bytes32Dto } from "@/modules/v4/uniswapV4";
|
5
|
+
import { UnsupportedNetwork } from "@/utils/error";
|
6
|
+
export default (app) => app.group("/uniswapv4", router => router
|
7
|
+
.get("/", async () => {
|
8
|
+
return await Redis.getOrSet("UniswapV4Pools", getUniswapV4Pools);
|
6
9
|
}, {
|
7
|
-
|
8
|
-
|
9
|
-
})
|
10
|
+
tags: ["uniswapv4"],
|
11
|
+
})
|
12
|
+
.get("/:chainId", async ({ params }) => {
|
13
|
+
return (await Redis.getOrSet("UniswapV4Pools", getUniswapV4Pools, params.chainId))[params.chainId];
|
14
|
+
}, {
|
15
|
+
params: ChainUniqueDto,
|
16
|
+
beforeHandle: ({ params }) => {
|
17
|
+
if (!UniV4ChainIdArray.includes(params.chainId))
|
18
|
+
throw new UnsupportedNetwork(params.chainId);
|
19
|
+
},
|
20
|
+
tags: ["uniswapv4"],
|
21
|
+
})
|
22
|
+
.get("/pool/:poolId", async ({ params }) => {
|
23
|
+
return Object.values((await Redis.getOrSet("UniswapV4Pools", getUniswapV4Pools)))
|
24
|
+
.flatMap(x => (x ? Object.values(x) : []))
|
25
|
+
.filter(p => p.poolId === params.poolId);
|
26
|
+
}, {
|
27
|
+
params: Bytes32Dto,
|
28
|
+
tags: ["uniswapv4"],
|
29
|
+
}));
|