@merkl/api 0.10.284 → 0.10.286

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.
@@ -24,6 +24,7 @@ export declare const campaignsCacheUpdater: Elysia<"", false, {
24
24
  body: unknown;
25
25
  params: {};
26
26
  query: {
27
+ campaignTypes?: number[] | undefined;
27
28
  chainId: string;
28
29
  };
29
30
  headers: unknown;
@@ -18,7 +18,7 @@ import { executeSimple } from "../../utils/execute";
18
18
  import { log } from "../../utils/logger";
19
19
  import { ALL_CAMPAIGNS_FOR_CHAIN_AFTER } from "../../utils/queries/allCampaigns";
20
20
  const highCampaignsChains = [ChainId.ARBITRUM, ChainId.POLYGON, ChainId.BLAST, ChainId.BASE];
21
- export const campaignsCacheUpdater = new Elysia().get("/v3/update", async ({ query, set }) => {
21
+ export const campaignsCacheUpdater = new Elysia().get("/v3/update", async ({ query }) => {
22
22
  const rawChainId = query.chainId;
23
23
  let chainId;
24
24
  if (typeof rawChainId === "string") {
@@ -58,15 +58,17 @@ export const campaignsCacheUpdater = new Elysia().get("/v3/update", async ({ que
58
58
  log.local(`Data length after filtering: ${staticData.length}`);
59
59
  if (!!staticData) {
60
60
  // Build list of existing campaign types for this chain
61
- const campaignTypes = !staticData
62
- ? []
63
- : staticData
64
- .map(campaign => campaign.campaignType)
65
- .reduce((prev, campaignType) => {
66
- if (!prev.includes(campaignType))
67
- prev.push(campaignType);
68
- return prev;
69
- }, []);
61
+ const campaignTypes = !!query.campaignTypes
62
+ ? query.campaignTypes
63
+ : !staticData
64
+ ? []
65
+ : staticData
66
+ .map(campaign => campaign.campaignType)
67
+ .reduce((prev, campaignType) => {
68
+ if (!prev.includes(campaignType))
69
+ prev.push(campaignType);
70
+ return prev;
71
+ }, []);
70
72
  // Fetch dynamic data for all these types
71
73
  const promisesPerType = campaignTypes.map(async (campaignType) => {
72
74
  const campaigns = staticData.filter(campaign => campaign.campaignType === campaignType);
@@ -156,5 +158,6 @@ export const campaignsCacheUpdater = new Elysia().get("/v3/update", async ({ que
156
158
  }, {
157
159
  query: t.Object({
158
160
  chainId: t.String(),
161
+ campaignTypes: t.Optional(t.Array(t.Numeric())),
159
162
  }),
160
163
  });
@@ -106,7 +106,7 @@ export class RewardConvertorService {
106
106
  const userType = {
107
107
  transactionData: rewardsV4[0].rewards.reduce((acc, reward) => {
108
108
  acc[reward.token.address] = {
109
- claim: (BigInt(reward.amount) - BigInt(reward.claimed)).toString(),
109
+ claim: BigInt(reward.amount).toString(),
110
110
  leaf: reward.proofs?.[0],
111
111
  proof: reward.proofs,
112
112
  token: reward.token.address,