@merkl/api 0.10.391 → 0.10.392

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.
Files changed (147) hide show
  1. package/dist/database/api/.generated/edge.js +9 -7
  2. package/dist/database/api/.generated/index-browser.js +4 -4
  3. package/dist/database/api/.generated/index.d.ts +3687 -491
  4. package/dist/database/api/.generated/index.js +9 -7
  5. package/dist/database/api/.generated/libquery_engine-debian-openssl-3.0.x.so.node +0 -0
  6. package/dist/database/api/.generated/libquery_engine-linux-arm64-openssl-1.1.x.so.node +0 -0
  7. package/dist/database/api/.generated/libquery_engine-linux-musl-arm64-openssl-3.0.x.so.node +0 -0
  8. package/dist/database/api/.generated/package.json +1 -1
  9. package/dist/database/api/.generated/runtime/edge-esm.js +18 -18
  10. package/dist/database/api/.generated/runtime/edge.js +18 -18
  11. package/dist/database/api/.generated/runtime/index-browser.d.ts +1 -1
  12. package/dist/database/api/.generated/runtime/library.d.ts +107 -38
  13. package/dist/database/api/.generated/runtime/library.js +53 -53
  14. package/dist/database/api/.generated/runtime/react-native.js +26 -26
  15. package/dist/database/api/.generated/runtime/wasm.js +19 -19
  16. package/dist/database/api/.generated/wasm.js +4 -4
  17. package/dist/database/engine/.generated/edge.js +9 -7
  18. package/dist/database/engine/.generated/index-browser.js +4 -4
  19. package/dist/database/engine/.generated/index.d.ts +1891 -257
  20. package/dist/database/engine/.generated/index.js +9 -7
  21. package/dist/database/engine/.generated/libquery_engine-debian-openssl-3.0.x.so.node +0 -0
  22. package/dist/database/engine/.generated/libquery_engine-linux-arm64-openssl-1.1.x.so.node +0 -0
  23. package/dist/database/engine/.generated/libquery_engine-linux-musl-arm64-openssl-3.0.x.so.node +0 -0
  24. package/dist/database/engine/.generated/package.json +1 -1
  25. package/dist/database/engine/.generated/runtime/edge-esm.js +18 -18
  26. package/dist/database/engine/.generated/runtime/edge.js +18 -18
  27. package/dist/database/engine/.generated/runtime/index-browser.d.ts +1 -1
  28. package/dist/database/engine/.generated/runtime/library.d.ts +107 -38
  29. package/dist/database/engine/.generated/runtime/library.js +53 -53
  30. package/dist/database/engine/.generated/runtime/react-native.js +26 -26
  31. package/dist/database/engine/.generated/runtime/wasm.js +19 -19
  32. package/dist/database/engine/.generated/wasm.js +4 -4
  33. package/dist/src/backgroundJobs/jobs/campaignsCacheUpdater.d.ts +12 -2
  34. package/dist/src/backgroundJobs/jobs/health.d.ts +12 -2
  35. package/dist/src/backgroundJobs/jobs/opportunityUpdater.d.ts +3 -2
  36. package/dist/src/backgroundJobs/jobs/priceUpdater.d.ts +3 -2
  37. package/dist/src/backgroundJobs/jobs/sync.d.ts +12 -2
  38. package/dist/src/eden/index.d.ts +4021 -117
  39. package/dist/src/entities/opportunity.js +1 -1
  40. package/dist/src/hooks/checkQueryAddressValidity.d.ts +3 -2
  41. package/dist/src/hooks/checkQueryChainIdValidity.d.ts +3 -2
  42. package/dist/src/index.d.ts +1343 -49
  43. package/dist/src/internal/controllers/endingCampaigns.d.ts +12 -2
  44. package/dist/src/internal/controllers/unclaimed.d.ts +12 -2
  45. package/dist/src/jobs/etl/pendings.js +1 -1
  46. package/dist/src/jobs/etl/reward-breakdowns.js +55 -52
  47. package/dist/src/jobs/etl/rewards.js +37 -35
  48. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.d.ts +5 -1
  49. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.js +8 -0
  50. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/AaveProcessor.js +2 -3
  51. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/processorMapping.js +4 -0
  52. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1.js +8 -0
  53. package/dist/src/modules/v4/accounting/accounting.controller.d.ts +66 -2
  54. package/dist/src/modules/v4/blacklist/blacklist.controller.d.ts +30 -2
  55. package/dist/src/modules/v4/boost/boost.controller.d.ts +12 -2
  56. package/dist/src/modules/v4/bucket/bucket.service.d.ts +1 -1
  57. package/dist/src/modules/v4/bucket/bucket.service.js +5 -0
  58. package/dist/src/modules/v4/campaign/campaign.controller.d.ts +78 -5
  59. package/dist/src/modules/v4/campaign/campaign.repository.d.ts +6 -6
  60. package/dist/src/modules/v4/campaign/campaign.service.d.ts +4 -4
  61. package/dist/src/modules/v4/chain/chain.controller.d.ts +39 -2
  62. package/dist/src/modules/v4/claims/claims.controller.d.ts +12 -2
  63. package/dist/src/modules/v4/computedValue/computedValue.controller.d.ts +39 -2
  64. package/dist/src/modules/v4/creator/creator.controller.d.ts +39 -2
  65. package/dist/src/modules/v4/dungeonKeeper/dungeonKeeper.controller.d.ts +3 -2
  66. package/dist/src/modules/v4/dynamicData/dynamicData.controller.d.ts +31 -3
  67. package/dist/src/modules/v4/enso/enso.service.d.ts +1 -1
  68. package/dist/src/modules/v4/explorer/explorer.controller.d.ts +12 -2
  69. package/dist/src/modules/v4/interaction/interaction.controller.d.ts +31 -3
  70. package/dist/src/modules/v4/liquidity/liquidity.controller.d.ts +12 -2
  71. package/dist/src/modules/v4/merklRoot/merklRoot.controller.d.ts +21 -2
  72. package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +118 -18
  73. package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +1 -1
  74. package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +30 -30
  75. package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +12 -12
  76. package/dist/src/modules/v4/price/price.controller.d.ts +48 -2
  77. package/dist/src/modules/v4/programPayload/programPayload.controller.d.ts +75 -2
  78. package/dist/src/modules/v4/programPayload/programPayload.repository.d.ts +0 -1
  79. package/dist/src/modules/v4/programPayload/programPayload.repository.js +3 -10
  80. package/dist/src/modules/v4/protocol/protocol.controller.d.ts +46 -9
  81. package/dist/src/modules/v4/protocol/protocol.repository.d.ts +5 -5
  82. package/dist/src/modules/v4/protocol/protocol.service.d.ts +2 -2
  83. package/dist/src/modules/v4/reward/reward.controller.d.ts +111 -2
  84. package/dist/src/modules/v4/reward/reward.repository.d.ts +3 -3
  85. package/dist/src/modules/v4/reward/reward.service.d.ts +18 -18
  86. package/dist/src/modules/v4/router.d.ts +973 -36
  87. package/dist/src/modules/v4/status/status.controller.d.ts +48 -2
  88. package/dist/src/modules/v4/token/token.controller.d.ts +75 -2
  89. package/dist/src/modules/v4/uniswapV4/uniswapV4.controller.d.ts +12 -2
  90. package/dist/src/modules/v4/user/user.controller.d.ts +90 -8
  91. package/dist/src/plugins/error-handling.plugin.d.ts +3 -2
  92. package/dist/src/plugins/logger.plugin.d.ts +3 -2
  93. package/dist/src/routes/v1/allowances.d.ts +12 -2
  94. package/dist/src/routes/v1/balances.d.ts +12 -2
  95. package/dist/src/routes/v1/prices.d.ts +12 -2
  96. package/dist/src/routes/v1/router.d.ts +39 -2
  97. package/dist/src/routes/v1/tokens.d.ts +12 -2
  98. package/dist/src/routes/v2/merkl.d.ts +12 -2
  99. package/dist/src/routes/v2/router.d.ts +12 -2
  100. package/dist/src/routes/v3/app.d.ts +12 -2
  101. package/dist/src/routes/v3/blacklist.d.ts +12 -2
  102. package/dist/src/routes/v3/campaign/delay.d.ts +12 -2
  103. package/dist/src/routes/v3/campaignClaims.d.ts +12 -2
  104. package/dist/src/routes/v3/campaignReport.d.ts +12 -2
  105. package/dist/src/routes/v3/campaignUnclaimed.d.ts +12 -2
  106. package/dist/src/routes/v3/campaigns.d.ts +12 -2
  107. package/dist/src/routes/v3/campaignsForMainParameter.d.ts +12 -2
  108. package/dist/src/routes/v3/campaignsInfo.d.ts +12 -2
  109. package/dist/src/routes/v3/campaignsRewardsReport.d.ts +12 -2
  110. package/dist/src/routes/v3/claims.d.ts +12 -2
  111. package/dist/src/routes/v3/compoundV2.d.ts +12 -2
  112. package/dist/src/routes/v3/createCampaign.d.ts +12 -2
  113. package/dist/src/routes/v3/dolomite.d.ts +12 -2
  114. package/dist/src/routes/v3/euler.d.ts +12 -2
  115. package/dist/src/routes/v3/exports/campaigns.d.ts +12 -2
  116. package/dist/src/routes/v3/fetch.d.ts +12 -2
  117. package/dist/src/routes/v3/health.d.ts +12 -2
  118. package/dist/src/routes/v3/lostyield.d.ts +12 -2
  119. package/dist/src/routes/v3/merkl.d.ts +3 -2
  120. package/dist/src/routes/v3/morphoMarkets.d.ts +12 -2
  121. package/dist/src/routes/v3/morphoVaults.d.ts +12 -2
  122. package/dist/src/routes/v3/multiChainPositions.d.ts +12 -2
  123. package/dist/src/routes/v3/opportunity.d.ts +12 -2
  124. package/dist/src/routes/v3/overview.d.ts +12 -2
  125. package/dist/src/routes/v3/parse.d.ts +12 -2
  126. package/dist/src/routes/v3/payload.d.ts +12 -2
  127. package/dist/src/routes/v3/poolInfo.d.ts +12 -2
  128. package/dist/src/routes/v3/positions.d.ts +12 -2
  129. package/dist/src/routes/v3/radiant.d.ts +12 -2
  130. package/dist/src/routes/v3/recipients.d.ts +12 -2
  131. package/dist/src/routes/v3/rewards.d.ts +12 -2
  132. package/dist/src/routes/v3/rewardsReport.d.ts +12 -2
  133. package/dist/src/routes/v3/router.d.ts +328 -3
  134. package/dist/src/routes/v3/silo.d.ts +12 -2
  135. package/dist/src/routes/v3/token.d.ts +12 -2
  136. package/dist/src/routes/v3/tokenUnclaimed.d.ts +12 -2
  137. package/dist/src/routes/v3/twt/participants.d.ts +12 -2
  138. package/dist/src/routes/v3/uniswapv4.d.ts +12 -2
  139. package/dist/src/routes/v3/updates.d.ts +12 -2
  140. package/dist/src/routes/v3/userRewards.d.ts +12 -2
  141. package/dist/src/utils/decodeCalls.js +12 -3
  142. package/dist/src/utils/encodeCalls.js +20 -7
  143. package/dist/src/utils/error.d.ts +3 -2
  144. package/dist/src/utils/generateCardName.js +4 -0
  145. package/dist/src/utils/logger.d.ts +29 -5
  146. package/dist/tsconfig.package.tsbuildinfo +1 -1
  147. package/package.json +24 -24
@@ -1,16 +1,17 @@
1
1
  import { type Elysia } from "elysia";
2
- export declare const endingCampaignsController: (app: Elysia) => Elysia<"", false, {
2
+ export declare const endingCampaignsController: (app: Elysia) => Elysia<"", {
3
3
  decorator: {};
4
4
  store: {};
5
5
  derive: {};
6
6
  resolve: {};
7
7
  }, {
8
- type: {};
8
+ typebox: import("@sinclair/typebox").TModule<{}>;
9
9
  error: {};
10
10
  }, {
11
11
  schema: {};
12
12
  macro: {};
13
13
  macroFn: {};
14
+ parser: {};
14
15
  }, {
15
16
  v3: {
16
17
  internal: {
@@ -27,6 +28,15 @@ export declare const endingCampaignsController: (app: Elysia) => Elysia<"", fals
27
28
  headers: unknown;
28
29
  response: {
29
30
  200: any[];
31
+ 422: {
32
+ type: "validation";
33
+ on: string;
34
+ summary?: string;
35
+ message?: string;
36
+ found?: unknown;
37
+ property?: string;
38
+ expected?: string;
39
+ };
30
40
  };
31
41
  };
32
42
  };
@@ -1,17 +1,18 @@
1
1
  import { type Elysia } from "elysia";
2
2
  import { type TotalUnclaimedOutput } from "../../utils/queries/unclaimed";
3
- export declare const unclaimedController: (app: Elysia) => Elysia<"", false, {
3
+ export declare const unclaimedController: (app: Elysia) => Elysia<"", {
4
4
  decorator: {};
5
5
  store: {};
6
6
  derive: {};
7
7
  resolve: {};
8
8
  }, {
9
- type: {};
9
+ typebox: import("@sinclair/typebox").TModule<{}>;
10
10
  error: {};
11
11
  }, {
12
12
  schema: {};
13
13
  macro: {};
14
14
  macroFn: {};
15
+ parser: {};
15
16
  }, {
16
17
  v3: {
17
18
  internal: {
@@ -28,6 +29,15 @@ export declare const unclaimedController: (app: Elysia) => Elysia<"", false, {
28
29
  200: (TotalUnclaimedOutput & {
29
30
  usdValue?: number;
30
31
  })[];
32
+ 422: {
33
+ type: "validation";
34
+ on: string;
35
+ summary?: string;
36
+ message?: string;
37
+ found?: unknown;
38
+ property?: string;
39
+ expected?: string;
40
+ };
31
41
  };
32
42
  };
33
43
  };
@@ -1,4 +1,4 @@
1
- // ─── Pendings ETL ─────────────────────────────────────────────────────────────
1
+ // ─── Pending Rewards Etl ─────────────────────────────────────────────────────
2
2
  if (!process.env.ENV || !process.env.FILENAME)
3
3
  throw new Error("[ENV]: missing variable");
4
4
  import { BucketService } from "../../modules/v4/bucket/bucket.service";
@@ -1,66 +1,66 @@
1
1
  // ─── Reward Breakdowns ETL ───────────────────────────────────────────────────
2
2
  if (!process.env.ENV || !process.env.CHAIN_ID || !process.env.ROOT)
3
3
  throw new Error("[ENV]: missing variable");
4
- import { BucketService } from "../../modules/v4/bucket/bucket.service";
5
- import { log } from "../../utils/logger";
6
4
  import { apiDbClient } from "../../utils/prisma";
7
- import { withRetry } from "@sdk";
5
+ import { S3Client } from "bun";
8
6
  import moment from "moment";
9
- // ─── Constants ───────────────────────────────────────────────
10
- const BATCH_SIZE = 30_000;
11
7
  // ─── Global Variables ────────────────────────────────────────
12
- const rewardBreakdownsToCreate = [[]];
8
+ const gcsClient = new S3Client({
9
+ accessKeyId: process.env.GCS_ACCESS_ID,
10
+ secretAccessKey: process.env.GCS_SECRET,
11
+ endpoint: process.env.GCS_ENDPOINT,
12
+ bucket: `merkl-rewards-lake-${process.env.ENV}`,
13
+ });
14
+ const file = gcsClient.file(`breakdowns/${process.env.CHAIN_ID}-${process.env.ROOT}.gz`);
13
15
  const failedBatches = [];
14
16
  // ─── Extract ─────────────────────────────────────────────────────────────────
15
17
  const extract = async () => {
16
- let currentBatchIndex = 0;
18
+ if (!file.exists())
19
+ throw new Error("File does not exist.");
20
+ let data = [];
21
+ const textDecoder = new TextDecoder();
22
+ let buffer = "";
23
+ const stream = file.stream();
17
24
  let count = 0;
18
- await BucketService.readStreamFromBucket(`breakdowns/${process.env.CHAIN_ID}-${process.env.ROOT}.gz`, `merkl-rewards-lake-${process.env.ENV}`, `merkl-data-${process.env.ENV}`, async (x) => {
19
- const breakdowns = JSON.parse(x);
20
- for (const breakdown of breakdowns) {
21
- rewardBreakdownsToCreate[currentBatchIndex].push(transform(breakdown));
22
- if (rewardBreakdownsToCreate[currentBatchIndex].length >= BATCH_SIZE) {
23
- try {
24
- count += await withRetry(load, [rewardBreakdownsToCreate[currentBatchIndex]], 5, 10_000);
25
- }
26
- catch (err) {
27
- console.error(`Failed to insert a batch, adding it to the fail queue.\n${err}`);
28
- failedBatches.push(currentBatchIndex);
29
- }
30
- currentBatchIndex++;
31
- rewardBreakdownsToCreate.push([]);
32
- }
25
+ for await (const chunk of stream) {
26
+ buffer += textDecoder.decode(chunk);
27
+ const lines = buffer.split("\n");
28
+ buffer = lines.pop() || "";
29
+ for (const line of lines)
30
+ if (line.trim())
31
+ data = transform(JSON.parse(line));
32
+ try {
33
+ count += await load(data);
34
+ data.length = 0;
35
+ }
36
+ catch (err) {
37
+ console.error(`Failed to insert a batch, adding it to the fail queue.\n${err}`);
38
+ failedBatches.push(data);
39
+ data.length = 0;
33
40
  }
34
- return;
35
- });
36
- // ─── Current Batch Not In DB Yet ─────────────────────────────────────
37
- try {
38
- const count = await load(rewardBreakdownsToCreate[currentBatchIndex]);
39
- if (count !== 0)
40
- log.info(`Successfully inserted a batch of ${count} rewards`);
41
- }
42
- catch (err) {
43
- console.error(`Failed to insert a batch, adding it to the fail queue.\n${err}`);
44
- failedBatches.push(currentBatchIndex);
45
41
  }
46
42
  return count;
47
43
  };
48
44
  // ─── Transform ───────────────────────────────────────────────────────────────
49
- const transform = (rewardBreakdown) => {
50
- const campaignId = Bun.hash(`${process.env.CHAIN_ID}${rewardBreakdown.campaignId}`).toString();
51
- const rewardTokenId = Bun.hash(`${process.env.CHAIN_ID}${rewardBreakdown.token}`).toString();
52
- const rewardId = Bun.hash(`${process.env.ROOT}${rewardBreakdown.recipient}${rewardTokenId}`).toString();
53
- return {
54
- rewardId,
55
- protocolId: rewardBreakdown.protocolId ? rewardBreakdown.protocolId : undefined,
56
- campaignId,
57
- reason: rewardBreakdown.reason ? rewardBreakdown.reason : "",
58
- amount: rewardBreakdown.amount,
59
- claimed: rewardBreakdown.claimed,
60
- pending: rewardBreakdown.pending,
61
- auxiliaryData1: rewardBreakdown.auxiliaryData1 ?? "",
62
- auxiliaryData2: rewardBreakdown.auxiliaryData2 ?? "",
63
- };
45
+ const transform = (rewardBreakdowns) => {
46
+ const transformedRewardBreakdowns = [];
47
+ for (const rewardBreakdown of rewardBreakdowns) {
48
+ const campaignId = Bun.hash(`${process.env.CHAIN_ID}${rewardBreakdown.campaignId}`).toString();
49
+ const rewardTokenId = Bun.hash(`${process.env.CHAIN_ID}${rewardBreakdown.token}`).toString();
50
+ const rewardId = Bun.hash(`${process.env.ROOT}${rewardBreakdown.recipient}${rewardTokenId}`).toString();
51
+ transformedRewardBreakdowns.push({
52
+ rewardId,
53
+ protocolId: rewardBreakdown.protocolId ? rewardBreakdown.protocolId : undefined,
54
+ campaignId,
55
+ reason: rewardBreakdown.reason ? rewardBreakdown.reason : "",
56
+ amount: rewardBreakdown.amount,
57
+ claimed: rewardBreakdown.claimed,
58
+ pending: rewardBreakdown.pending,
59
+ auxiliaryData1: rewardBreakdown.auxiliaryData1 ?? "",
60
+ auxiliaryData2: rewardBreakdown.auxiliaryData2 ?? "",
61
+ });
62
+ }
63
+ return transformedRewardBreakdowns;
64
64
  };
65
65
  // ─── Load ────────────────────────────────────────────────────────────────────
66
66
  const load = async (rewardBreakdowns) => {
@@ -73,11 +73,14 @@ const load = async (rewardBreakdowns) => {
73
73
  export const main = async () => {
74
74
  const start = moment().unix();
75
75
  const count = await extract();
76
- log.info(`✅ Successfully created ${count} new records in ${moment().unix() - start} sec`);
77
- if (failedBatches.length !== 0)
78
- log.info(`${failedBatches.length}/${rewardBreakdownsToCreate.length} batches failed.`);
76
+ console.log(`✅ Successfully created ${count} new records in ${moment().unix() - start} sec`);
77
+ if (failedBatches.length !== 0) {
78
+ console.log(`${failedBatches.length} batches failed.`);
79
+ process.exit(1);
80
+ }
79
81
  if (failedBatches.length === 0) {
80
- await BucketService.deleteFile(`rewards/${process.env.CHAIN_ID}-${process.env.ROOT}.gz`, `merkl-rewards-lake-${process.env.ENV}`, `merkl-data-${process.env.ENV}`);
82
+ await file.delete();
83
+ console.log("Object deleted");
81
84
  }
82
85
  };
83
86
  main();
@@ -1,45 +1,44 @@
1
1
  // ─── Rewards ETL ─────────────────────────────────────────────────────────────
2
2
  if (!process.env.ENV || !process.env.CHAIN_ID || !process.env.ROOT)
3
3
  throw new Error("[ENV]: missing variable");
4
- import { BucketService } from "../../modules/v4/bucket/bucket.service";
5
- import { log } from "../../utils/logger";
6
4
  import { apiDbClient } from "../../utils/prisma";
7
- import { withRetry } from "@sdk";
5
+ import { S3Client } from "bun";
8
6
  import moment from "moment";
9
- // ─── Constants ───────────────────────────────────────────────
10
- const BATCH_SIZE = 20_000;
11
7
  // ─── Global Variables ────────────────────────────────────────
12
- const rewardsToCreate = [[]];
8
+ const gcsClient = new S3Client({
9
+ accessKeyId: process.env.GCS_ACCESS_ID,
10
+ secretAccessKey: process.env.GCS_SECRET,
11
+ endpoint: process.env.GCS_ENDPOINT,
12
+ bucket: `merkl-rewards-lake-${process.env.ENV}`,
13
+ });
14
+ const file = gcsClient.file(`rewards/${process.env.CHAIN_ID}-${process.env.ROOT}.gz`);
13
15
  const failedBatches = [];
14
16
  // ─── Extract ─────────────────────────────────────────────────────────────────
15
17
  const extract = async () => {
18
+ if (!file.exists())
19
+ throw new Error("File does not exist.");
20
+ const data = [];
21
+ const textDecoder = new TextDecoder();
22
+ let buffer = "";
23
+ const stream = file.stream();
16
24
  let count = 0;
17
- let currentBatchIndex = 0;
18
- await BucketService.readStreamFromBucket(`rewards/${process.env.CHAIN_ID}-${process.env.ROOT}.gz`, `merkl-rewards-lake-${process.env.ENV}`, `merkl-data-${process.env.ENV}`, async (x) => {
19
- rewardsToCreate[currentBatchIndex].push(transform(JSON.parse(x)));
20
- if (rewardsToCreate[currentBatchIndex].length >= BATCH_SIZE) {
21
- try {
22
- count += await withRetry(load, [rewardsToCreate[currentBatchIndex]], 5, 10_000);
23
- log.info(`Successfully inserted a batch of ${count} rewards`);
24
- }
25
- catch (err) {
26
- console.error(`Failed to insert a batch, adding it to the fail queue.\n${err}`);
27
- failedBatches.push(currentBatchIndex);
28
- }
29
- currentBatchIndex++;
30
- rewardsToCreate.push([]);
25
+ for await (const chunk of stream) {
26
+ buffer += textDecoder.decode(chunk);
27
+ const lines = buffer.split("\n");
28
+ buffer = lines.pop() || "";
29
+ for (const line of lines) {
30
+ if (line.trim())
31
+ data.push(transform(JSON.parse(line)));
32
+ }
33
+ try {
34
+ count += await load(data);
35
+ data.length = 0;
36
+ }
37
+ catch (err) {
38
+ console.error(`Failed to insert a batch, adding it to the fail queue.\n${err}`);
39
+ failedBatches.push(data);
40
+ data.length = 0;
31
41
  }
32
- return;
33
- });
34
- // ─── Current Batch Not In DB Yet ─────────────────────────────────────
35
- try {
36
- const count = await load(rewardsToCreate[currentBatchIndex]);
37
- if (count !== 0)
38
- log.info(`Successfully inserted a batch of ${count} rewards`);
39
- }
40
- catch (err) {
41
- console.error(`Failed to insert a batch, adding it to the fail queue.\n${err}`);
42
- failedBatches.push(currentBatchIndex);
43
42
  }
44
43
  return count;
45
44
  };
@@ -93,11 +92,14 @@ export const main = async () => {
93
92
  });
94
93
  // ─── Start Rewards ETL ───────────────────────────────────────────────
95
94
  const count = await extract();
96
- log.info(`✅ Successfully created ${count} new records in ${moment().unix() - start} sec`);
97
- if (failedBatches.length !== 0)
98
- log.info(`${failedBatches.length}/${rewardsToCreate.length} batches failed.`);
95
+ console.log(`✅ Successfully created ${count} new records in ${moment().unix() - start} sec`);
96
+ if (failedBatches.length !== 0) {
97
+ console.log(`${failedBatches.length} batches failed.`);
98
+ process.exit(1);
99
+ }
99
100
  if (failedBatches.length === 0) {
100
- await BucketService.deleteFile(`rewards/${process.env.CHAIN_ID}-${process.env.ROOT}.gz`, `merkl-rewards-lake-${process.env.ENV}`, `merkl-data-${process.env.ENV}`);
101
+ await file.delete();
102
+ console.log("Object deleted");
101
103
  }
102
104
  };
103
105
  main();
@@ -74,7 +74,11 @@ export declare enum tokenType {
74
74
  superlend_borrowing = "superlend_borrowing",
75
75
  superlend_lending = "superlend_lending",
76
76
  cian = "cian",
77
- concrete = "concrete"
77
+ concrete = "concrete",
78
+ lendle_borrowing = "lendle_borrowing",
79
+ lendle_lending = "lendle_lending",
80
+ takotako_borrowing = "takotako_borrowing",
81
+ takotako_lending = "takotako_lending"
78
82
  }
79
83
  export declare const tokenTypeToProtocol: {
80
84
  [key in tokenType]: {
@@ -76,6 +76,10 @@ export var tokenType;
76
76
  tokenType["superlend_lending"] = "superlend_lending";
77
77
  tokenType["cian"] = "cian";
78
78
  tokenType["concrete"] = "concrete";
79
+ tokenType["lendle_borrowing"] = "lendle_borrowing";
80
+ tokenType["lendle_lending"] = "lendle_lending";
81
+ tokenType["takotako_borrowing"] = "takotako_borrowing";
82
+ tokenType["takotako_lending"] = "takotako_lending";
79
83
  })(tokenType || (tokenType = {}));
80
84
  export const tokenTypeToProtocol = {
81
85
  [tokenType.aave_borrowing]: { protocol: "Aave" },
@@ -183,4 +187,8 @@ export const tokenTypeToProtocol = {
183
187
  [tokenType.superlend_lending]: { protocol: "Superlend" },
184
188
  [tokenType.cian]: { protocol: "Cian" },
185
189
  [tokenType.concrete]: { protocol: "Concrete" },
190
+ [tokenType.lendle_borrowing]: { protocol: "Lendle" },
191
+ [tokenType.lendle_lending]: { protocol: "Lendle" },
192
+ [tokenType.takotako_borrowing]: { protocol: "TakoTako" },
193
+ [tokenType.takotako_lending]: { protocol: "TakoTako" },
186
194
  };
@@ -10,9 +10,8 @@ export class AaveProcessor extends GenericProcessor {
10
10
  // // override computeRound1(): void {}
11
11
  async processingRound5(_index, type, typeInfo, _calls, campaign, pricer) {
12
12
  const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
13
- const priceUnderlying = (await pricer.get({ symbol: typeInfo.symbolUnderlyingToken })) ?? 0;
14
- const tvl = priceUnderlying * totalSupply;
15
- const priceTargetToken = priceUnderlying;
13
+ const priceTargetToken = (await pricer.get({ symbol: typeInfo.symbolUnderlyingToken })) ?? 0;
14
+ const tvl = priceTargetToken * totalSupply;
16
15
  return {
17
16
  ...typeInfo,
18
17
  whitelistedSupplyTargetToken,
@@ -112,4 +112,8 @@ export const processorMapping = {
112
112
  [tokenType.superlend_borrowing]: AaveProcessor,
113
113
  [tokenType.cian]: ERC4626Processor,
114
114
  [tokenType.concrete]: ERC4626Processor,
115
+ [tokenType.lendle_borrowing]: AaveProcessor,
116
+ [tokenType.lendle_lending]: AaveProcessor,
117
+ [tokenType.takotako_lending]: AaveProcessor,
118
+ [tokenType.takotako_borrowing]: AaveProcessor,
115
119
  };
@@ -120,6 +120,14 @@ function satisfiesNameConditions(name, type) {
120
120
  return lowerCaseName.includes("superlend") && lowerCaseName.includes("debt");
121
121
  case tokenType.superlend_lending:
122
122
  return lowerCaseName.includes("superlend");
123
+ case tokenType.lendle_borrowing:
124
+ return lowerCaseName.includes("lendle") && lowerCaseName.includes("debt");
125
+ case tokenType.lendle_lending:
126
+ return lowerCaseName.includes("lendle");
127
+ case tokenType.takotako_borrowing:
128
+ return lowerCaseName.includes("takotako") && lowerCaseName.includes("debt");
129
+ case tokenType.takotako_lending:
130
+ return lowerCaseName.includes("takotako");
123
131
  case tokenType.cian:
124
132
  return lowerCaseName.includes("cian");
125
133
  case tokenType.concrete:
@@ -1,16 +1,17 @@
1
1
  import Elysia from "elysia";
2
- export declare const AccountingController: Elysia<"/accounting", false, {
2
+ export declare const AccountingController: Elysia<"/accounting", {
3
3
  decorator: {};
4
4
  store: {};
5
5
  derive: {};
6
6
  resolve: {};
7
7
  }, {
8
- type: {};
8
+ typebox: import("@sinclair/typebox").TModule<{}>;
9
9
  error: {};
10
10
  }, {
11
11
  schema: {};
12
12
  macro: {};
13
13
  macroFn: {};
14
+ parser: {};
14
15
  }, {
15
16
  accounting: {
16
17
  index: {
@@ -37,6 +38,15 @@ export declare const AccountingController: Elysia<"/accounting", false, {
37
38
  amountOut: string;
38
39
  datetime: Date;
39
40
  }[];
41
+ 422: {
42
+ type: "validation";
43
+ on: string;
44
+ summary?: string;
45
+ message?: string;
46
+ found?: unknown;
47
+ property?: string;
48
+ expected?: string;
49
+ };
40
50
  };
41
51
  };
42
52
  };
@@ -59,6 +69,15 @@ export declare const AccountingController: Elysia<"/accounting", false, {
59
69
  };
60
70
  };
61
71
  };
72
+ 422: {
73
+ type: "validation";
74
+ on: string;
75
+ summary?: string;
76
+ message?: string;
77
+ found?: unknown;
78
+ property?: string;
79
+ expected?: string;
80
+ };
62
81
  };
63
82
  };
64
83
  };
@@ -83,6 +102,15 @@ export declare const AccountingController: Elysia<"/accounting", false, {
83
102
  from: string;
84
103
  to: string;
85
104
  };
105
+ 422: {
106
+ type: "validation";
107
+ on: string;
108
+ summary?: string;
109
+ message?: string;
110
+ found?: unknown;
111
+ property?: string;
112
+ expected?: string;
113
+ };
86
114
  };
87
115
  };
88
116
  };
@@ -106,6 +134,15 @@ export declare const AccountingController: Elysia<"/accounting", false, {
106
134
  200: {
107
135
  totalAmount: number;
108
136
  };
137
+ 422: {
138
+ type: "validation";
139
+ on: string;
140
+ summary?: string;
141
+ message?: string;
142
+ found?: unknown;
143
+ property?: string;
144
+ expected?: string;
145
+ };
109
146
  };
110
147
  };
111
148
  };
@@ -135,6 +172,15 @@ export declare const AccountingController: Elysia<"/accounting", false, {
135
172
  from: string;
136
173
  to: string;
137
174
  };
175
+ 422: {
176
+ type: "validation";
177
+ on: string;
178
+ summary?: string;
179
+ message?: string;
180
+ found?: unknown;
181
+ property?: string;
182
+ expected?: string;
183
+ };
138
184
  };
139
185
  };
140
186
  };
@@ -162,6 +208,15 @@ export declare const AccountingController: Elysia<"/accounting", false, {
162
208
  totalAmount: number;
163
209
  totalAmountUSD: number;
164
210
  };
211
+ 422: {
212
+ type: "validation";
213
+ on: string;
214
+ summary?: string;
215
+ message?: string;
216
+ found?: unknown;
217
+ property?: string;
218
+ expected?: string;
219
+ };
165
220
  };
166
221
  };
167
222
  };
@@ -193,6 +248,15 @@ export declare const AccountingController: Elysia<"/accounting", false, {
193
248
  from: string;
194
249
  to: string;
195
250
  };
251
+ 422: {
252
+ type: "validation";
253
+ on: string;
254
+ summary?: string;
255
+ message?: string;
256
+ found?: unknown;
257
+ property?: string;
258
+ expected?: string;
259
+ };
196
260
  };
197
261
  };
198
262
  };
@@ -1,16 +1,17 @@
1
1
  import Elysia from "elysia";
2
- export declare const BlacklistController: Elysia<"/blacklists", false, {
2
+ export declare const BlacklistController: Elysia<"/blacklists", {
3
3
  decorator: {};
4
4
  store: {};
5
5
  derive: {};
6
6
  resolve: {};
7
7
  }, {
8
- type: {};
8
+ typebox: import("@sinclair/typebox").TModule<{}>;
9
9
  error: {};
10
10
  }, {
11
11
  schema: {};
12
12
  macro: {};
13
13
  macroFn: {};
14
+ parser: {};
14
15
  }, {
15
16
  blacklists: {
16
17
  index: {
@@ -59,6 +60,15 @@ export declare const BlacklistController: Elysia<"/blacklists", false, {
59
60
  headers: unknown;
60
61
  response: {
61
62
  200: boolean;
63
+ 422: {
64
+ type: "validation";
65
+ on: string;
66
+ summary?: string;
67
+ message?: string;
68
+ found?: unknown;
69
+ property?: string;
70
+ expected?: string;
71
+ };
62
72
  };
63
73
  };
64
74
  };
@@ -88,6 +98,15 @@ export declare const BlacklistController: Elysia<"/blacklists", false, {
88
98
  arrestTimestamp: bigint;
89
99
  arrestDetails: import("database/api/.generated/runtime/library").JsonValue;
90
100
  };
101
+ 422: {
102
+ type: "validation";
103
+ on: string;
104
+ summary?: string;
105
+ message?: string;
106
+ found?: unknown;
107
+ property?: string;
108
+ expected?: string;
109
+ };
91
110
  };
92
111
  };
93
112
  };
@@ -107,6 +126,15 @@ export declare const BlacklistController: Elysia<"/blacklists", false, {
107
126
  };
108
127
  response: {
109
128
  200: boolean;
129
+ 422: {
130
+ type: "validation";
131
+ on: string;
132
+ summary?: string;
133
+ message?: string;
134
+ found?: unknown;
135
+ property?: string;
136
+ expected?: string;
137
+ };
110
138
  };
111
139
  };
112
140
  };
@@ -1,16 +1,17 @@
1
1
  import Elysia from "elysia";
2
- export declare const BoostController: Elysia<"/boosts", false, {
2
+ export declare const BoostController: Elysia<"/boosts", {
3
3
  decorator: {};
4
4
  store: {};
5
5
  derive: {};
6
6
  resolve: {};
7
7
  }, {
8
- type: {};
8
+ typebox: import("@sinclair/typebox").TModule<{}>;
9
9
  error: {};
10
10
  }, {
11
11
  schema: {};
12
12
  macro: {};
13
13
  macroFn: {};
14
+ parser: {};
14
15
  }, {
15
16
  boosts: {
16
17
  euler: {
@@ -29,6 +30,15 @@ export declare const BoostController: Elysia<"/boosts", false, {
29
30
  address: string;
30
31
  boost: string;
31
32
  }[];
33
+ 422: {
34
+ type: "validation";
35
+ on: string;
36
+ summary?: string;
37
+ message?: string;
38
+ found?: unknown;
39
+ property?: string;
40
+ expected?: string;
41
+ };
32
42
  };
33
43
  };
34
44
  };
@@ -1,5 +1,5 @@
1
1
  import type { SaveData } from "node_modules/@google-cloud/storage/build/esm/src/file";
2
- export declare abstract class BucketService {
2
+ export declare class BucketService {
3
3
  static upload(bucketName: string, filename: string, data: SaveData, isPublic: boolean): Promise<string>;
4
4
  static writeStreamToBucket<T>(data: T[], fileName: string, bucketName: string, projectID?: string, hook?: (data: T) => string, isPublic?: boolean, withLog?: boolean): Promise<void>;
5
5
  static readStreamFromBucket<T>(fileName: string, bucketName: string, projectID?: string, hook?: (line: string) => T, withLog?: boolean): Promise<T[]>;