@merkl/api 0.20.88 → 0.20.90
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 +18 -12
- package/dist/src/engine/campaignTVL/factory.d.ts +3 -0
- package/dist/src/engine/campaignTVL/factory.js +9 -0
- package/dist/src/engine/dynamicData/implementations/EventBased.js +10 -3
- package/dist/src/errors/InvalidParameter.error.d.ts +4 -0
- package/dist/src/errors/InvalidParameter.error.js +7 -0
- package/dist/src/index.d.ts +6 -4
- package/dist/src/jobs/dynamic-data.js +7 -1
- package/dist/src/jobs/update-dynamic-data.js +17 -21
- package/dist/src/modules/v4/apr/apr.service.d.ts +3 -0
- package/dist/src/modules/v4/apr/apr.service.js +3 -0
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +1 -1
- package/dist/src/modules/v4/campaign/campaign.controller.js +1 -1
- package/dist/src/modules/v4/campaign/campaign.service.js +0 -3
- package/dist/src/modules/v4/campaign/campaign.test.controller.d.ts +3 -3
- package/dist/src/modules/v4/campaign/campaign.test.controller.js +12 -8
- package/dist/src/modules/v4/dynamicData/dynamicData.service.d.ts +14 -5
- package/dist/src/modules/v4/dynamicData/dynamicData.service.js +187 -83
- package/dist/src/modules/v4/opportunity/opportunity.controller.js +14 -1
- package/dist/src/modules/v4/opportunity/opportunity.service.js +1 -1
- package/dist/src/modules/v4/reward/reward.service.d.ts +4 -1
- package/dist/src/modules/v4/reward/reward.service.js +7 -5
- package/dist/src/modules/v4/router.d.ts +6 -4
- package/dist/src/modules/v4/token/token.service.d.ts +1 -1
- package/dist/src/modules/v4/token/token.service.js +3 -9
- package/dist/src/modules/v4/tvl/tvl.service.d.ts +3 -0
- package/dist/src/modules/v4/tvl/tvl.service.js +3 -0
- package/dist/src/modules/v4/user/user.controller.d.ts +2 -0
- package/dist/src/modules/v4/user/user.controller.js +2 -2
- package/dist/src/modules/v4/user/user.model.d.ts +2 -0
- package/dist/src/modules/v4/user/user.model.js +2 -0
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/src/backgroundJobs/index.d.ts +0 -1
- package/dist/src/backgroundJobs/index.js +0 -55
- package/dist/src/backgroundJobs/jobs/health.d.ts +0 -41
- package/dist/src/backgroundJobs/jobs/health.js +0 -15
- package/dist/src/backgroundJobs/jobs/opportunityUpdater.d.ts +0 -39
- package/dist/src/backgroundJobs/jobs/opportunityUpdater.js +0 -22
package/package.json
CHANGED
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,55 +0,0 @@
|
|
1
|
-
import { redisClient } from "@/cache/redis";
|
2
|
-
import { getEulerV2Vaults, updateEulerVaultsCollatInDatabase } from "@/engine/dynamicData/utils/getEulerV2Vaults";
|
3
|
-
import { CacheService } from "@/modules/v4/cache";
|
4
|
-
import { TTLPresets } from "@/modules/v4/cache/cache.model";
|
5
|
-
import { UniswapService } from "@/modules/v4/uniswap/uniswap.service";
|
6
|
-
import { log } from "@/utils/logger";
|
7
|
-
import { engineDbClient } from "@db";
|
8
|
-
import { swagger } from "@elysiajs/swagger";
|
9
|
-
import axios from "axios";
|
10
|
-
import { Elysia } from "elysia";
|
11
|
-
import { healthCheck } from "./jobs/health";
|
12
|
-
import { opportunityUpdater } from "./jobs/opportunityUpdater";
|
13
|
-
// Axios with bun workaround
|
14
|
-
axios.defaults.headers.common["Accept-Encoding"] = "gzip";
|
15
|
-
const PORT = process.env.PORT || 3000;
|
16
|
-
new Elysia({
|
17
|
-
serve: {
|
18
|
-
idleTimeout: 0,
|
19
|
-
},
|
20
|
-
})
|
21
|
-
.use(swagger())
|
22
|
-
.get("/", () => "Merkl API")
|
23
|
-
.use(opportunityUpdater) // /v3/updateOpportunity
|
24
|
-
.use(healthCheck) // /v3/health
|
25
|
-
.get("/eulerUpdate", async () => {
|
26
|
-
log.info("🔃 updating Euler vaults...");
|
27
|
-
await updateEulerVaultsCollatInDatabase();
|
28
|
-
await CacheService.set(TTLPresets.DAY_1, getEulerV2Vaults); // TODO: keeping it with Redis for debug purposes, will do the transition soon
|
29
|
-
})
|
30
|
-
.get("/uniswapv4Update", async () => {
|
31
|
-
log.info("🔃 updating UniswapV4 pools...");
|
32
|
-
await CacheService.set(TTLPresets.DAY_1, UniswapService.getUniswapV4Pools);
|
33
|
-
})
|
34
|
-
.onError(ctx => {
|
35
|
-
console.error(ctx.error.message);
|
36
|
-
console.error(ctx.error.stack);
|
37
|
-
if (ctx.code === "NOT_FOUND")
|
38
|
-
return new Response(JSON.stringify({
|
39
|
-
path: ctx.path,
|
40
|
-
error: ctx.code,
|
41
|
-
message: "Path does not exist",
|
42
|
-
}), {
|
43
|
-
status: 404,
|
44
|
-
});
|
45
|
-
return (ctx.set.status = "Internal Server Error");
|
46
|
-
})
|
47
|
-
.listen(PORT, ({ hostname, port }) => {
|
48
|
-
log.info(`🔄 Background Jobs started (${hostname}:${port})`);
|
49
|
-
});
|
50
|
-
// ─── Signal Handling ─────────────────────────────────────────────────────────
|
51
|
-
process.on("SIGTERM", () => {
|
52
|
-
engineDbClient.$disconnect();
|
53
|
-
redisClient.disconnect();
|
54
|
-
process.exit();
|
55
|
-
});
|
@@ -1,41 +0,0 @@
|
|
1
|
-
import type Elysia from "elysia";
|
2
|
-
export declare const response: import("@sinclair/typebox").TObject<{
|
3
|
-
success: import("@sinclair/typebox").TBoolean;
|
4
|
-
}>;
|
5
|
-
export declare const healthCheck: (app: Elysia) => Elysia<"", false, {
|
6
|
-
decorator: {};
|
7
|
-
store: {};
|
8
|
-
derive: {};
|
9
|
-
resolve: {};
|
10
|
-
}, {
|
11
|
-
type: {};
|
12
|
-
error: {};
|
13
|
-
}, {
|
14
|
-
schema: {};
|
15
|
-
macro: {};
|
16
|
-
macroFn: {};
|
17
|
-
}, {
|
18
|
-
v3: {
|
19
|
-
health: {
|
20
|
-
get: {
|
21
|
-
body: unknown;
|
22
|
-
params: {};
|
23
|
-
query: {};
|
24
|
-
headers: unknown;
|
25
|
-
response: {
|
26
|
-
200: {
|
27
|
-
success: boolean;
|
28
|
-
};
|
29
|
-
};
|
30
|
-
};
|
31
|
-
};
|
32
|
-
};
|
33
|
-
}, {
|
34
|
-
derive: {};
|
35
|
-
resolve: {};
|
36
|
-
schema: {};
|
37
|
-
}, {
|
38
|
-
derive: {};
|
39
|
-
resolve: {};
|
40
|
-
schema: {};
|
41
|
-
}>;
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import { Redis } from "@/cache";
|
2
|
-
import { t } from "elysia";
|
3
|
-
export const response = t.Object({ success: t.Boolean() });
|
4
|
-
export const healthCheck = (app) => {
|
5
|
-
return app.get("/v3/health", async () => {
|
6
|
-
// Check if the cache is working
|
7
|
-
await Redis.get("Prices");
|
8
|
-
return {
|
9
|
-
success: true,
|
10
|
-
};
|
11
|
-
}, {
|
12
|
-
query: t.Object({}),
|
13
|
-
tags: ["Onchain"],
|
14
|
-
});
|
15
|
-
};
|
@@ -1,39 +0,0 @@
|
|
1
|
-
import type Elysia from "elysia";
|
2
|
-
/**
|
3
|
-
* @deprecated Used only for the v3/opportunity route
|
4
|
-
*/
|
5
|
-
export declare const opportunityUpdater: (app: Elysia) => Elysia<"", false, {
|
6
|
-
decorator: {};
|
7
|
-
store: {};
|
8
|
-
derive: {};
|
9
|
-
resolve: {};
|
10
|
-
}, {
|
11
|
-
type: {};
|
12
|
-
error: {};
|
13
|
-
}, {
|
14
|
-
schema: {};
|
15
|
-
macro: {};
|
16
|
-
macroFn: {};
|
17
|
-
}, {
|
18
|
-
v3: {
|
19
|
-
updateOpportunities: {
|
20
|
-
get: {
|
21
|
-
body: unknown;
|
22
|
-
params: {};
|
23
|
-
query: unknown;
|
24
|
-
headers: unknown;
|
25
|
-
response: {
|
26
|
-
200: Response;
|
27
|
-
};
|
28
|
-
};
|
29
|
-
};
|
30
|
-
};
|
31
|
-
}, {
|
32
|
-
derive: {};
|
33
|
-
resolve: {};
|
34
|
-
schema: {};
|
35
|
-
}, {
|
36
|
-
derive: {};
|
37
|
-
resolve: {};
|
38
|
-
schema: {};
|
39
|
-
}>;
|
@@ -1,22 +0,0 @@
|
|
1
|
-
// @ts-nocheck
|
2
|
-
import { OpportunityConvertorService } from "@/modules/v4/opportunity/opportunity.converter";
|
3
|
-
import { log } from "../../utils/logger";
|
4
|
-
/**
|
5
|
-
* @deprecated Used only for the v3/opportunity route
|
6
|
-
*/
|
7
|
-
export const opportunityUpdater = (app) => {
|
8
|
-
return app.get("/v3/updateOpportunities", async () => {
|
9
|
-
log.info("✅ opportunity cache updated successfully");
|
10
|
-
await OpportunityConvertorService.logKeyAndTTLV3Opportunities(false, false, undefined, undefined);
|
11
|
-
await OpportunityConvertorService.setV3Opportunities(false, false, undefined, undefined);
|
12
|
-
log.info("✅ opportunity v3 cache updated successfully");
|
13
|
-
await OpportunityConvertorService.logKeyAndTTLV3Opportunities(false, true, undefined, undefined);
|
14
|
-
await OpportunityConvertorService.setV3Opportunities(false, true, undefined, undefined);
|
15
|
-
log.info("✅ opportunity v3 test cache updated successfully");
|
16
|
-
return new Response(JSON.stringify({
|
17
|
-
status: "success",
|
18
|
-
}), {
|
19
|
-
status: 200,
|
20
|
-
});
|
21
|
-
});
|
22
|
-
};
|