@merkl/api 0.10.151 → 0.10.153
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/src/eden/index.d.ts +9 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.d.ts +2 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.js +4 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/MaverickBPProcessor.js +0 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/ZkSwapThreePoolProcessor.d.ts +53 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/ZkSwapThreePoolProcessor.js +55 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/processorMapping.js +2 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1RefactoFinal.js +2 -0
- package/dist/src/modules/v4/cache/cache.repository.js +36 -3
- package/dist/src/modules/v4/chainInteraction/chainInteraction.service.d.ts +2 -0
- package/dist/src/modules/v4/chainInteraction/chainInteraction.service.js +4 -0
- package/dist/src/modules/v4/chainInteraction/index.d.ts +1 -0
- package/dist/src/modules/v4/chainInteraction/index.js +1 -0
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +3 -0
- package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +2 -1
- package/dist/src/modules/v4/opportunity/opportunity.model.js +2 -1
- package/dist/src/modules/v4/opportunity/opportunity.repository.js +1 -0
- package/dist/src/modules/v4/router.d.ts +3 -0
- package/dist/src/modules/v4/tracer/index.d.ts +1 -0
- package/dist/src/modules/v4/tracer/index.js +1 -0
- package/dist/src/modules/v4/tracer/tracer.service.d.ts +3 -0
- package/dist/src/modules/v4/tracer/tracer.service.js +30 -0
- package/dist/src/routes/v3/ERC20Campaigns.d.ts +3 -0
- package/dist/src/routes/v3/blacklist.d.ts +3 -0
- package/dist/src/routes/v3/campaigns.d.ts +3 -0
- package/dist/src/routes/v3/campaignsInfo.d.ts +3 -0
- package/dist/src/routes/v3/multiChainPositions.d.ts +3 -0
- package/dist/src/routes/v3/opportunity.d.ts +3 -0
- package/dist/src/routes/v3/positions.d.ts +3 -0
- package/dist/src/routes/v3/rewards.d.ts +3 -0
- package/dist/src/routes/v3/updates.d.ts +3 -0
- package/dist/src/routes/v3/userRewards.d.ts +3 -0
- package/dist/src/utils/decodeCalls.js +7 -1
- package/dist/src/utils/encodeCalls.js +19 -1
- package/dist/src/utils/generateCardName.js +3 -1
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/src/eden/index.d.ts
CHANGED
@@ -269,6 +269,7 @@ declare const eden: {
|
|
269
269
|
action?: string | undefined;
|
270
270
|
mainProtocolId?: string | undefined;
|
271
271
|
order?: undefined;
|
272
|
+
minimumTvl?: number | undefined;
|
272
273
|
};
|
273
274
|
fetch?: RequestInit | undefined;
|
274
275
|
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
@@ -372,6 +373,7 @@ declare const eden: {
|
|
372
373
|
action?: string | undefined;
|
373
374
|
mainProtocolId?: string | undefined;
|
374
375
|
order?: undefined;
|
376
|
+
minimumTvl?: number | undefined;
|
375
377
|
};
|
376
378
|
fetch?: RequestInit | undefined;
|
377
379
|
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
@@ -395,6 +397,7 @@ declare const eden: {
|
|
395
397
|
action?: string | undefined;
|
396
398
|
mainProtocolId?: string | undefined;
|
397
399
|
order?: undefined;
|
400
|
+
minimumTvl?: number | undefined;
|
398
401
|
};
|
399
402
|
fetch?: RequestInit | undefined;
|
400
403
|
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
@@ -2074,6 +2077,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
2074
2077
|
action?: string | undefined;
|
2075
2078
|
mainProtocolId?: string | undefined;
|
2076
2079
|
order?: undefined;
|
2080
|
+
minimumTvl?: number | undefined;
|
2077
2081
|
};
|
2078
2082
|
headers: unknown;
|
2079
2083
|
response: {
|
@@ -2182,6 +2186,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
2182
2186
|
action?: string | undefined;
|
2183
2187
|
mainProtocolId?: string | undefined;
|
2184
2188
|
order?: undefined;
|
2189
|
+
minimumTvl?: number | undefined;
|
2185
2190
|
};
|
2186
2191
|
headers: unknown;
|
2187
2192
|
response: {
|
@@ -2211,6 +2216,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
2211
2216
|
action?: string | undefined;
|
2212
2217
|
mainProtocolId?: string | undefined;
|
2213
2218
|
order?: undefined;
|
2219
|
+
minimumTvl?: number | undefined;
|
2214
2220
|
};
|
2215
2221
|
headers: unknown;
|
2216
2222
|
response: {
|
@@ -4216,6 +4222,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
4216
4222
|
action?: string | undefined;
|
4217
4223
|
mainProtocolId?: string | undefined;
|
4218
4224
|
order?: undefined;
|
4225
|
+
minimumTvl?: number | undefined;
|
4219
4226
|
};
|
4220
4227
|
fetch?: RequestInit | undefined;
|
4221
4228
|
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
@@ -4319,6 +4326,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
4319
4326
|
action?: string | undefined;
|
4320
4327
|
mainProtocolId?: string | undefined;
|
4321
4328
|
order?: undefined;
|
4329
|
+
minimumTvl?: number | undefined;
|
4322
4330
|
};
|
4323
4331
|
fetch?: RequestInit | undefined;
|
4324
4332
|
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
@@ -4342,6 +4350,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
4342
4350
|
action?: string | undefined;
|
4343
4351
|
mainProtocolId?: string | undefined;
|
4344
4352
|
order?: undefined;
|
4353
|
+
minimumTvl?: number | undefined;
|
4345
4354
|
};
|
4346
4355
|
fetch?: RequestInit | undefined;
|
4347
4356
|
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
package/dist/src/index.d.ts
CHANGED
@@ -319,6 +319,7 @@ declare const app: Elysia<"", false, {
|
|
319
319
|
action?: string | undefined;
|
320
320
|
mainProtocolId?: string | undefined;
|
321
321
|
order?: undefined;
|
322
|
+
minimumTvl?: number | undefined;
|
322
323
|
};
|
323
324
|
headers: unknown;
|
324
325
|
response: {
|
@@ -427,6 +428,7 @@ declare const app: Elysia<"", false, {
|
|
427
428
|
action?: string | undefined;
|
428
429
|
mainProtocolId?: string | undefined;
|
429
430
|
order?: undefined;
|
431
|
+
minimumTvl?: number | undefined;
|
430
432
|
};
|
431
433
|
headers: unknown;
|
432
434
|
response: {
|
@@ -456,6 +458,7 @@ declare const app: Elysia<"", false, {
|
|
456
458
|
action?: string | undefined;
|
457
459
|
mainProtocolId?: string | undefined;
|
458
460
|
order?: undefined;
|
461
|
+
minimumTvl?: number | undefined;
|
459
462
|
};
|
460
463
|
headers: unknown;
|
461
464
|
response: {
|
@@ -50,7 +50,8 @@ export declare enum tokenType {
|
|
50
50
|
rfx = "rfx",
|
51
51
|
woofi = "woofi",
|
52
52
|
pendle = "pendle",
|
53
|
-
maverickBoostedPosition = "maverickBoostedPosition"
|
53
|
+
maverickBoostedPosition = "maverickBoostedPosition",
|
54
|
+
zkSwapThreePool = "zkSwapThreePool"
|
54
55
|
}
|
55
56
|
export declare const tokenTypeToProtocol: {
|
56
57
|
[key in tokenType]: {
|
@@ -52,6 +52,7 @@ export var tokenType;
|
|
52
52
|
tokenType["woofi"] = "woofi";
|
53
53
|
tokenType["pendle"] = "pendle";
|
54
54
|
tokenType["maverickBoostedPosition"] = "maverickBoostedPosition";
|
55
|
+
tokenType["zkSwapThreePool"] = "zkSwapThreePool";
|
55
56
|
})(tokenType || (tokenType = {}));
|
56
57
|
export const tokenTypeToProtocol = {
|
57
58
|
[tokenType.aave_borrowing]: { protocol: "Aave" },
|
@@ -111,4 +112,7 @@ export const tokenTypeToProtocol = {
|
|
111
112
|
[tokenType.maverickBoostedPosition]: {
|
112
113
|
protocol: "Maverick",
|
113
114
|
},
|
115
|
+
[tokenType.zkSwapThreePool]: {
|
116
|
+
protocol: "ZKSwap",
|
117
|
+
},
|
114
118
|
};
|
package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/MaverickBPProcessor.js
CHANGED
@@ -54,7 +54,6 @@ export class MaverickBPProcessor extends GenericProcessor {
|
|
54
54
|
const amountB = BN2Number(typeInfo.amountB, decimalsTokenB);
|
55
55
|
const tokenAPRice = (await pricer.get({ symbol: typeInfo.symbolTokenA })) ?? 0;
|
56
56
|
const tokenBPrice = (await pricer.get({ symbol: typeInfo.symbolTokenB })) ?? 0;
|
57
|
-
// Not rebased (ie divided by 10edecimals)
|
58
57
|
const tvl = tokenAPRice * amountA + tokenBPrice * amountB;
|
59
58
|
const priceTargetToken = tvl / totalSupply;
|
60
59
|
const { bpInfoReturnData, ...rest } = typeInfo;
|
package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/ZkSwapThreePoolProcessor.d.ts
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
import type { Pricer } from "../../../../../utils/pricer";
|
2
|
+
import { type Campaign, type CampaignParameters } from "@sdk";
|
3
|
+
import type { tokenType } from "../helpers/tokenType";
|
4
|
+
import { GenericProcessor, type dataType, type mandatoryCallKeys } from "./GenericProcessor";
|
5
|
+
type callType = {
|
6
|
+
key: keyof dataRawzkSwapThreePool;
|
7
|
+
call: string;
|
8
|
+
target: keyof callKeysZkswapThreePool;
|
9
|
+
metaData?: keyof callKeysZkswapThreePool;
|
10
|
+
};
|
11
|
+
type callKeysZkswapThreePool = mandatoryCallKeys & {
|
12
|
+
balances: string;
|
13
|
+
coins: string;
|
14
|
+
minter: string;
|
15
|
+
pool: string;
|
16
|
+
token0Address: string;
|
17
|
+
token0Index: string;
|
18
|
+
token1Address: string;
|
19
|
+
token1Index: string;
|
20
|
+
token2Address: string;
|
21
|
+
token2Index: string;
|
22
|
+
};
|
23
|
+
type dataRawzkSwapThreePool = callKeysZkswapThreePool & {
|
24
|
+
balance0: string;
|
25
|
+
balance1: string;
|
26
|
+
balance2: string;
|
27
|
+
symbolToken0: string;
|
28
|
+
symbolToken1: string;
|
29
|
+
symbolToken2: string;
|
30
|
+
decimalsToken0: string;
|
31
|
+
decimalsToken1: string;
|
32
|
+
decimalsToken2: string;
|
33
|
+
};
|
34
|
+
type dataTypeZkSwapThreePool = dataType & {
|
35
|
+
pool: string;
|
36
|
+
symbolToken0: string;
|
37
|
+
symbolToken1: string;
|
38
|
+
symbolToken2: string;
|
39
|
+
token0Address: string;
|
40
|
+
token1Address: string;
|
41
|
+
token2Address: string;
|
42
|
+
};
|
43
|
+
export declare class ZkSwapThreePoolProcessor extends GenericProcessor<callKeysZkswapThreePool, dataRawzkSwapThreePool, dataTypeZkSwapThreePool> {
|
44
|
+
rounds: {
|
45
|
+
round1: callType[];
|
46
|
+
round2: callType[];
|
47
|
+
round3: callType[];
|
48
|
+
round4: callType[];
|
49
|
+
};
|
50
|
+
processingRound2(typeInfo: dataRawzkSwapThreePool): void;
|
51
|
+
processingRound5(_index: number, type: tokenType, typeInfo: dataRawzkSwapThreePool, _calls: string[], campaign: CampaignParameters<Campaign.ERC20> | CampaignParameters<Campaign.EULER>, pricer: Pricer): Promise<dataTypeZkSwapThreePool>;
|
52
|
+
}
|
53
|
+
export {};
|
package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/ZkSwapThreePoolProcessor.js
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
import { generateCardName } from "../../../../../utils/generateCardName";
|
2
|
+
import { BN2Number } from "@sdk";
|
3
|
+
import { GenericProcessor } from "./GenericProcessor";
|
4
|
+
export class ZkSwapThreePoolProcessor extends GenericProcessor {
|
5
|
+
rounds = {
|
6
|
+
round1: [{ key: "pool", call: "minter", target: "tokenAddress" }],
|
7
|
+
round2: [
|
8
|
+
{ key: "token0Address", call: "coins", target: "pool", metaData: "token0Index" },
|
9
|
+
{ key: "balance0", call: "balances", target: "pool", metaData: "token0Index" },
|
10
|
+
{ key: "token1Address", call: "coins", target: "pool", metaData: "token1Index" },
|
11
|
+
{ key: "balance1", call: "balances", target: "pool", metaData: "token1Index" },
|
12
|
+
{ key: "token2Address", call: "coins", target: "pool", metaData: "token2Index" },
|
13
|
+
{ key: "balance2", call: "balances", target: "pool", metaData: "token2Index" },
|
14
|
+
],
|
15
|
+
round3: [
|
16
|
+
{ key: "symbolToken0", call: "symbol", target: "token0Address" },
|
17
|
+
{ key: "symbolToken1", call: "symbol", target: "token1Address" },
|
18
|
+
{ key: "symbolToken2", call: "symbol", target: "token2Address" },
|
19
|
+
{ key: "decimalsToken0", call: "decimals", target: "token0Address" },
|
20
|
+
{ key: "decimalsToken1", call: "decimals", target: "token1Address" },
|
21
|
+
{ key: "decimalsToken2", call: "decimals", target: "token2Address" },
|
22
|
+
],
|
23
|
+
round4: [{ key: "totalSupply", call: "totalSupply", target: "tokenAddress" }],
|
24
|
+
};
|
25
|
+
processingRound2(typeInfo) {
|
26
|
+
typeInfo.token0Index = "0";
|
27
|
+
typeInfo.token1Index = "1";
|
28
|
+
typeInfo.token2Index = "2";
|
29
|
+
}
|
30
|
+
async processingRound5(_index, type, typeInfo, _calls, campaign, pricer) {
|
31
|
+
const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
|
32
|
+
const decimals0 = Number(typeInfo.decimalsToken0);
|
33
|
+
const decimals1 = Number(typeInfo.decimalsToken1);
|
34
|
+
const decimals2 = Number(typeInfo.decimalsToken2);
|
35
|
+
const amount0 = BN2Number(typeInfo.balance0, decimals0);
|
36
|
+
const amount1 = BN2Number(typeInfo.balance1, decimals1);
|
37
|
+
const amount2 = BN2Number(typeInfo.balance2, decimals2);
|
38
|
+
// FIXMEME issue with token0Price
|
39
|
+
const token0Price = (await pricer.get({ symbol: typeInfo.symbolToken0 })) ?? 0;
|
40
|
+
const token1Price = (await pricer.get({ symbol: typeInfo.symbolToken1 })) ?? 0;
|
41
|
+
const token2Price = (await pricer.get({ symbol: typeInfo.symbolToken2 })) ?? 0;
|
42
|
+
const tvl = token0Price * amount0 + token1Price * amount1 + token2Price * amount2;
|
43
|
+
const priceTargetToken = tvl / totalSupply;
|
44
|
+
const { balance0, balance1, balance2, decimalsToken0, decimalsToken1, decimalsToken2, ...rest } = typeInfo;
|
45
|
+
return {
|
46
|
+
...rest,
|
47
|
+
blacklistedSupply,
|
48
|
+
cardName: generateCardName(type, typeInfo, campaign),
|
49
|
+
priceTargetToken: priceTargetToken,
|
50
|
+
totalSupply,
|
51
|
+
tvl,
|
52
|
+
whitelistedSupplyTargetToken,
|
53
|
+
};
|
54
|
+
}
|
55
|
+
}
|
@@ -23,6 +23,7 @@ import { SturdySiloProcessor } from "./SturdySiloProcessor";
|
|
23
23
|
import { TorosProcessor } from "./TorosProcessor";
|
24
24
|
import { UniswapProcessor } from "./UniswapProcessor";
|
25
25
|
import { WoofiProcessor } from "./WoofiProcessor";
|
26
|
+
import { ZkSwapThreePoolProcessor } from "./ZkSwapThreePoolProcessor";
|
26
27
|
import { CurveProcessor } from "./curveProcessor";
|
27
28
|
export const processorMapping = {
|
28
29
|
[tokenType.uniswapv2]: UniswapProcessor,
|
@@ -76,4 +77,5 @@ export const processorMapping = {
|
|
76
77
|
[tokenType.rfx]: RfxProcessor,
|
77
78
|
[tokenType.woofi]: WoofiProcessor,
|
78
79
|
[tokenType.maverickBoostedPosition]: MaverickBPProcessor,
|
80
|
+
[tokenType.zkSwapThreePool]: ZkSwapThreePoolProcessor,
|
79
81
|
};
|
@@ -83,6 +83,8 @@ function satisfiesNameConditions(name, type) {
|
|
83
83
|
return lowerCaseName.includes("woofi");
|
84
84
|
case tokenType.maverickBoostedPosition:
|
85
85
|
return lowerCaseName.includes("maverick");
|
86
|
+
case tokenType.zkSwapThreePool:
|
87
|
+
return lowerCaseName.includes("zf");
|
86
88
|
default:
|
87
89
|
return false;
|
88
90
|
}
|
@@ -1,10 +1,43 @@
|
|
1
|
-
import { REDIS_READ_TIMEOUT, REDIS_RETRIES, redisClient } from "../../../cache/redis";
|
1
|
+
import { REDIS_READ_TIMEOUT, REDIS_RETRIES, REDIS_WRITE_TIMEOUT, redisClient } from "../../../cache/redis";
|
2
|
+
import { record } from "@elysiajs/opentelemetry";
|
2
3
|
import { withRetry, withTimeout } from "@sdk";
|
3
4
|
export class CacheRepository {
|
4
5
|
static async set(ttl, key, value) {
|
5
|
-
await
|
6
|
+
await record("redis.set", async (span) => {
|
7
|
+
span.setAttribute("db.system", "redis");
|
8
|
+
span.setAttribute("net.transport", "ip_tcp");
|
9
|
+
span.setAttribute("db.statement", `set ${key} ${value} ${ttl}`);
|
10
|
+
const startTime = Date.now();
|
11
|
+
try {
|
12
|
+
const result = await withRetry(withTimeout, [redisClient.set(key, value, { EX: ttl }), REDIS_WRITE_TIMEOUT], REDIS_RETRIES);
|
13
|
+
span.setAttribute("db.redis.response_time", Date.now() - startTime);
|
14
|
+
return result;
|
15
|
+
}
|
16
|
+
catch (error) {
|
17
|
+
span.setStatus({ code: 2 }); // OpenTelemetry StatusCode.ERROR
|
18
|
+
span.setAttribute("error.message", error.message);
|
19
|
+
span.recordException(error);
|
20
|
+
throw error;
|
21
|
+
}
|
22
|
+
});
|
6
23
|
}
|
7
24
|
static async get(key) {
|
8
|
-
return await
|
25
|
+
return await record("redis.get", async (span) => {
|
26
|
+
span.setAttribute("db.system", "redis");
|
27
|
+
span.setAttribute("net.transport", "ip_tcp");
|
28
|
+
span.setAttribute("db.statement", `get ${key}`);
|
29
|
+
const startTime = Date.now();
|
30
|
+
try {
|
31
|
+
const result = await withRetry(withTimeout, [redisClient.get(key), REDIS_READ_TIMEOUT], REDIS_RETRIES);
|
32
|
+
span.setAttribute("db.redis.response_time", Date.now() - startTime);
|
33
|
+
return result;
|
34
|
+
}
|
35
|
+
catch (error) {
|
36
|
+
span.setStatus({ code: 2 }); // OpenTelemetry StatusCode.ERROR
|
37
|
+
span.setAttribute("error.message", error.message);
|
38
|
+
span.recordException(error);
|
39
|
+
throw error;
|
40
|
+
}
|
41
|
+
});
|
9
42
|
}
|
10
43
|
}
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import { ChainInteractionService } from "@sdk";
|
2
|
+
import { TracerService } from "../tracer";
|
3
|
+
const ChainInteractionServiceWrapper = TracerService.createTracedProxy(ChainInteractionService, "ChainInteractionService");
|
4
|
+
export { ChainInteractionServiceWrapper as ChainInteractionService };
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from "./chainInteraction.service";
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from "./chainInteraction.service";
|
@@ -292,6 +292,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
292
292
|
action?: string | undefined;
|
293
293
|
mainProtocolId?: string | undefined;
|
294
294
|
order?: undefined;
|
295
|
+
minimumTvl?: number | undefined;
|
295
296
|
};
|
296
297
|
headers: unknown;
|
297
298
|
response: {
|
@@ -400,6 +401,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
400
401
|
action?: string | undefined;
|
401
402
|
mainProtocolId?: string | undefined;
|
402
403
|
order?: undefined;
|
404
|
+
minimumTvl?: number | undefined;
|
403
405
|
};
|
404
406
|
headers: unknown;
|
405
407
|
response: {
|
@@ -429,6 +431,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
429
431
|
action?: string | undefined;
|
430
432
|
mainProtocolId?: string | undefined;
|
431
433
|
order?: undefined;
|
434
|
+
minimumTvl?: number | undefined;
|
432
435
|
};
|
433
436
|
headers: unknown;
|
434
437
|
response: {
|
@@ -53,6 +53,7 @@ export declare const GetOpportunitiesQueryDto: import("@sinclair/typebox").TObje
|
|
53
53
|
INVALID: "INVALID";
|
54
54
|
}>, import("@sinclair/typebox").TRegExp]>>;
|
55
55
|
tags: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
56
|
+
minimumTvl: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
56
57
|
tokens: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
57
58
|
status: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TEnum<{
|
58
59
|
NONE: "NONE";
|
@@ -62,7 +63,7 @@ export declare const GetOpportunitiesQueryDto: import("@sinclair/typebox").TObje
|
|
62
63
|
}>, import("@sinclair/typebox").TRegExp]>>;
|
63
64
|
sort: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<"tvl" | "apr" | "rewards">[]>>;
|
64
65
|
order: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<"asc" | "desc">[]>>;
|
65
|
-
mainProtocolId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").
|
66
|
+
mainProtocolId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRegExp>;
|
66
67
|
page: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
67
68
|
items: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
68
69
|
}>;
|
@@ -15,11 +15,12 @@ export const GetOpportunitiesQueryDto = t.Object({
|
|
15
15
|
//TODO: find a systemic way of handling query param arrays
|
16
16
|
action: t.Optional(t.Union([t.Enum(OpportunityAction), t.RegExp(/^(POOL|HOLD|DROP|LEND|BORROW)+(,(POOL|HOLD|DROP|LEND|BORROW)+)*$/)])),
|
17
17
|
tags: t.Optional(t.String()),
|
18
|
+
minimumTvl: t.Optional(t.Number()),
|
18
19
|
tokens: t.Optional(t.String({ title: "Symbol" })),
|
19
20
|
status: t.Optional(t.Union([t.Enum(Status), t.RegExp(/^(LIVE|PAST|SOON)+(,(LIVE|PAST|SOON)+)*$/)])),
|
20
21
|
sort: t.Optional(t.Union(["apr", "tvl", "rewards"].map(v => t.Literal(v)))),
|
21
22
|
order: t.Optional(t.Union(["desc", "asc"].map(v => t.Literal(v)))),
|
22
|
-
mainProtocolId: t.Optional(t.
|
23
|
+
mainProtocolId: t.Optional(t.RegExp(/^\d+(,\d+)*$/)),
|
23
24
|
page: t.Optional(t.Numeric()), // 0-indexed
|
24
25
|
items: t.Optional(t.Numeric()), // items per page
|
25
26
|
});
|
@@ -132,6 +132,7 @@ export class OpportunityRepository {
|
|
132
132
|
AND: [
|
133
133
|
...(tokensFilters ?? []),
|
134
134
|
{ tags: !filters.tags ? undefined : { has: filters.tags } },
|
135
|
+
{ tvl: filters.minimumTvl ? { gte: filters.minimumTvl } : undefined },
|
135
136
|
{ chainId: !chainIds ? undefined : { in: chainIds } },
|
136
137
|
{ name: !filters.name ? undefined : { contains: filters.name, mode: "insensitive" } },
|
137
138
|
{
|
@@ -301,6 +301,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
301
301
|
action?: string | undefined;
|
302
302
|
mainProtocolId?: string | undefined;
|
303
303
|
order?: undefined;
|
304
|
+
minimumTvl?: number | undefined;
|
304
305
|
};
|
305
306
|
headers: unknown;
|
306
307
|
response: {
|
@@ -409,6 +410,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
409
410
|
action?: string | undefined;
|
410
411
|
mainProtocolId?: string | undefined;
|
411
412
|
order?: undefined;
|
413
|
+
minimumTvl?: number | undefined;
|
412
414
|
};
|
413
415
|
headers: unknown;
|
414
416
|
response: {
|
@@ -438,6 +440,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
438
440
|
action?: string | undefined;
|
439
441
|
mainProtocolId?: string | undefined;
|
440
442
|
order?: undefined;
|
443
|
+
minimumTvl?: number | undefined;
|
441
444
|
};
|
442
445
|
headers: unknown;
|
443
446
|
response: {
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from "./tracer.service";
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from "./tracer.service";
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import { record } from "@elysiajs/opentelemetry";
|
2
|
+
export class TracerService {
|
3
|
+
static createTracedProxy(target, serviceName) {
|
4
|
+
return new Proxy(target, {
|
5
|
+
get(target, property, receiver) {
|
6
|
+
const originalMethod = Reflect.get(target, property, receiver);
|
7
|
+
if (typeof originalMethod === "function") {
|
8
|
+
return function (...args) {
|
9
|
+
return record(`${serviceName}.${property}`, async (span) => {
|
10
|
+
// Add relevant attributes to the span
|
11
|
+
span.setAttribute("service.name", serviceName);
|
12
|
+
span.setAttribute("service.method", property);
|
13
|
+
try {
|
14
|
+
const result = await originalMethod.apply(this, args);
|
15
|
+
return result;
|
16
|
+
}
|
17
|
+
catch (error) {
|
18
|
+
span.setStatus({ code: 2 }); // OpenTelemetry StatusCode.ERROR
|
19
|
+
span.setAttribute("error.message", error.message);
|
20
|
+
span.recordException(error);
|
21
|
+
throw error;
|
22
|
+
}
|
23
|
+
});
|
24
|
+
};
|
25
|
+
}
|
26
|
+
return originalMethod;
|
27
|
+
},
|
28
|
+
});
|
29
|
+
}
|
30
|
+
}
|
@@ -327,6 +327,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
|
|
327
327
|
action?: string | undefined;
|
328
328
|
mainProtocolId?: string | undefined;
|
329
329
|
order?: undefined;
|
330
|
+
minimumTvl?: number | undefined;
|
330
331
|
};
|
331
332
|
headers: unknown;
|
332
333
|
response: {
|
@@ -435,6 +436,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
|
|
435
436
|
action?: string | undefined;
|
436
437
|
mainProtocolId?: string | undefined;
|
437
438
|
order?: undefined;
|
439
|
+
minimumTvl?: number | undefined;
|
438
440
|
};
|
439
441
|
headers: unknown;
|
440
442
|
response: {
|
@@ -464,6 +466,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
|
|
464
466
|
action?: string | undefined;
|
465
467
|
mainProtocolId?: string | undefined;
|
466
468
|
order?: undefined;
|
469
|
+
minimumTvl?: number | undefined;
|
467
470
|
};
|
468
471
|
headers: unknown;
|
469
472
|
response: {
|
@@ -325,6 +325,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
|
|
325
325
|
action?: string | undefined;
|
326
326
|
mainProtocolId?: string | undefined;
|
327
327
|
order?: undefined;
|
328
|
+
minimumTvl?: number | undefined;
|
328
329
|
};
|
329
330
|
headers: unknown;
|
330
331
|
response: {
|
@@ -433,6 +434,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
|
|
433
434
|
action?: string | undefined;
|
434
435
|
mainProtocolId?: string | undefined;
|
435
436
|
order?: undefined;
|
437
|
+
minimumTvl?: number | undefined;
|
436
438
|
};
|
437
439
|
headers: unknown;
|
438
440
|
response: {
|
@@ -462,6 +464,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
|
|
462
464
|
action?: string | undefined;
|
463
465
|
mainProtocolId?: string | undefined;
|
464
466
|
order?: undefined;
|
467
|
+
minimumTvl?: number | undefined;
|
465
468
|
};
|
466
469
|
headers: unknown;
|
467
470
|
response: {
|
@@ -328,6 +328,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
|
|
328
328
|
action?: string | undefined;
|
329
329
|
mainProtocolId?: string | undefined;
|
330
330
|
order?: undefined;
|
331
|
+
minimumTvl?: number | undefined;
|
331
332
|
};
|
332
333
|
headers: unknown;
|
333
334
|
response: {
|
@@ -436,6 +437,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
|
|
436
437
|
action?: string | undefined;
|
437
438
|
mainProtocolId?: string | undefined;
|
438
439
|
order?: undefined;
|
440
|
+
minimumTvl?: number | undefined;
|
439
441
|
};
|
440
442
|
headers: unknown;
|
441
443
|
response: {
|
@@ -465,6 +467,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
|
|
465
467
|
action?: string | undefined;
|
466
468
|
mainProtocolId?: string | undefined;
|
467
469
|
order?: undefined;
|
470
|
+
minimumTvl?: number | undefined;
|
468
471
|
};
|
469
472
|
headers: unknown;
|
470
473
|
response: {
|
@@ -319,6 +319,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
|
|
319
319
|
action?: string | undefined;
|
320
320
|
mainProtocolId?: string | undefined;
|
321
321
|
order?: undefined;
|
322
|
+
minimumTvl?: number | undefined;
|
322
323
|
};
|
323
324
|
headers: unknown;
|
324
325
|
response: {
|
@@ -427,6 +428,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
|
|
427
428
|
action?: string | undefined;
|
428
429
|
mainProtocolId?: string | undefined;
|
429
430
|
order?: undefined;
|
431
|
+
minimumTvl?: number | undefined;
|
430
432
|
};
|
431
433
|
headers: unknown;
|
432
434
|
response: {
|
@@ -456,6 +458,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
|
|
456
458
|
action?: string | undefined;
|
457
459
|
mainProtocolId?: string | undefined;
|
458
460
|
order?: undefined;
|
461
|
+
minimumTvl?: number | undefined;
|
459
462
|
};
|
460
463
|
headers: unknown;
|
461
464
|
response: {
|
@@ -324,6 +324,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
|
|
324
324
|
action?: string | undefined;
|
325
325
|
mainProtocolId?: string | undefined;
|
326
326
|
order?: undefined;
|
327
|
+
minimumTvl?: number | undefined;
|
327
328
|
};
|
328
329
|
headers: unknown;
|
329
330
|
response: {
|
@@ -432,6 +433,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
|
|
432
433
|
action?: string | undefined;
|
433
434
|
mainProtocolId?: string | undefined;
|
434
435
|
order?: undefined;
|
436
|
+
minimumTvl?: number | undefined;
|
435
437
|
};
|
436
438
|
headers: unknown;
|
437
439
|
response: {
|
@@ -461,6 +463,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
|
|
461
463
|
action?: string | undefined;
|
462
464
|
mainProtocolId?: string | undefined;
|
463
465
|
order?: undefined;
|
466
|
+
minimumTvl?: number | undefined;
|
464
467
|
};
|
465
468
|
headers: unknown;
|
466
469
|
response: {
|
@@ -342,6 +342,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
|
|
342
342
|
action?: string | undefined;
|
343
343
|
mainProtocolId?: string | undefined;
|
344
344
|
order?: undefined;
|
345
|
+
minimumTvl?: number | undefined;
|
345
346
|
};
|
346
347
|
headers: unknown;
|
347
348
|
response: {
|
@@ -450,6 +451,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
|
|
450
451
|
action?: string | undefined;
|
451
452
|
mainProtocolId?: string | undefined;
|
452
453
|
order?: undefined;
|
454
|
+
minimumTvl?: number | undefined;
|
453
455
|
};
|
454
456
|
headers: unknown;
|
455
457
|
response: {
|
@@ -479,6 +481,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
|
|
479
481
|
action?: string | undefined;
|
480
482
|
mainProtocolId?: string | undefined;
|
481
483
|
order?: undefined;
|
484
|
+
minimumTvl?: number | undefined;
|
482
485
|
};
|
483
486
|
headers: unknown;
|
484
487
|
response: {
|
@@ -343,6 +343,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
|
|
343
343
|
action?: string | undefined;
|
344
344
|
mainProtocolId?: string | undefined;
|
345
345
|
order?: undefined;
|
346
|
+
minimumTvl?: number | undefined;
|
346
347
|
};
|
347
348
|
headers: unknown;
|
348
349
|
response: {
|
@@ -451,6 +452,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
|
|
451
452
|
action?: string | undefined;
|
452
453
|
mainProtocolId?: string | undefined;
|
453
454
|
order?: undefined;
|
455
|
+
minimumTvl?: number | undefined;
|
454
456
|
};
|
455
457
|
headers: unknown;
|
456
458
|
response: {
|
@@ -480,6 +482,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
|
|
480
482
|
action?: string | undefined;
|
481
483
|
mainProtocolId?: string | undefined;
|
482
484
|
order?: undefined;
|
485
|
+
minimumTvl?: number | undefined;
|
483
486
|
};
|
484
487
|
headers: unknown;
|
485
488
|
response: {
|