@merkl/api 0.10.247 → 0.10.249

Sign up to get free protection for your applications and to get access to all the features.
@@ -1436,6 +1436,7 @@ declare const eden: {
1436
1436
  get: (options: {
1437
1437
  headers?: Record<string, unknown> | undefined;
1438
1438
  query: {
1439
+ test?: boolean | undefined;
1439
1440
  chainIds?: number[] | undefined;
1440
1441
  reloadChainId?: number | undefined;
1441
1442
  };
@@ -1541,6 +1542,7 @@ declare const eden: {
1541
1542
  get: (options: {
1542
1543
  headers?: Record<string, unknown> | undefined;
1543
1544
  query: {
1545
+ test?: boolean | undefined;
1544
1546
  reloadChainId?: number | undefined;
1545
1547
  chainId: number[];
1546
1548
  };
@@ -4564,6 +4566,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
4564
4566
  address: string;
4565
4567
  };
4566
4568
  query: {
4569
+ test?: boolean | undefined;
4567
4570
  chainIds?: number[] | undefined;
4568
4571
  reloadChainId?: number | undefined;
4569
4572
  };
@@ -4680,6 +4683,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
4680
4683
  address: string;
4681
4684
  };
4682
4685
  query: {
4686
+ test?: boolean | undefined;
4683
4687
  reloadChainId?: number | undefined;
4684
4688
  chainId: number[];
4685
4689
  };
@@ -7624,6 +7628,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
7624
7628
  get: (options: {
7625
7629
  headers?: Record<string, unknown> | undefined;
7626
7630
  query: {
7631
+ test?: boolean | undefined;
7627
7632
  chainIds?: number[] | undefined;
7628
7633
  reloadChainId?: number | undefined;
7629
7634
  };
@@ -7729,6 +7734,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
7729
7734
  get: (options: {
7730
7735
  headers?: Record<string, unknown> | undefined;
7731
7736
  query: {
7737
+ test?: boolean | undefined;
7732
7738
  reloadChainId?: number | undefined;
7733
7739
  chainId: number[];
7734
7740
  };
@@ -217,6 +217,7 @@ export const extractOpportunities = {
217
217
  "maverickBoostedPosition",
218
218
  "zkSwapThreePool",
219
219
  "syncswap",
220
+ "rfx",
220
221
  ],
221
222
  borrow: ["radiant_borrow", "aave_borrowing", "euler_borrow", "zerolend_borrowing"],
222
223
  lend: [
@@ -247,6 +248,12 @@ export const extractOpportunities = {
247
248
  .filter(tkn => tkn);
248
249
  if (["curve"].includes(campaign.type ?? ""))
249
250
  return Object.values(typeInfo.poolTokens ?? {}).filter(tkn => tkn);
251
+ if (["rfx"].includes(campaign.type ?? "")) {
252
+ return [typeInfo.symbolShortToken, typeInfo.symbolLongToken];
253
+ }
254
+ if (["maverickBoostedPosition"].includes(campaign.type ?? "")) {
255
+ return [typeInfo.symbolTokenA, typeInfo.symbolTokenB];
256
+ }
250
257
  return [typeInfo.symbolToken0, typeInfo.symbolToken1];
251
258
  },
252
259
  lend: () => (campaign.type === "compound" ? [typeInfo.symbolBaseToken] : [typeInfo.symbolUnderlyingToken]),
@@ -1824,6 +1824,7 @@ declare const app: Elysia<"", false, {
1824
1824
  address: string;
1825
1825
  };
1826
1826
  query: {
1827
+ test?: boolean | undefined;
1827
1828
  chainIds?: number[] | undefined;
1828
1829
  reloadChainId?: number | undefined;
1829
1830
  };
@@ -1940,6 +1941,7 @@ declare const app: Elysia<"", false, {
1940
1941
  address: string;
1941
1942
  };
1942
1943
  query: {
1944
+ test?: boolean | undefined;
1943
1945
  reloadChainId?: number | undefined;
1944
1946
  chainId: number[];
1945
1947
  };
@@ -147,7 +147,7 @@ export async function ERC20DynamicData(chainId, campaigns) {
147
147
  campaign.campaignParameters.duration /
148
148
  (whitelistedSupplyTargetToken * priceTargetToken),
149
149
  totalSupplyTargetToken,
150
- tvl: getTVL(tokenTypesByCampaign[campaign.campaignId].typeInfo.type, totalSupplyTargetToken, whitelistedSupplyTargetToken, priceTargetToken),
150
+ tvl: getTVL(tokenTypesByCampaign[campaign.campaignId].typeInfo.type, tokenTypesByCampaign[campaign.campaignId].typeInfo.totalSupply, whitelistedSupplyTargetToken, priceTargetToken),
151
151
  type: tokenTypesByCampaign[campaign.campaignId].type,
152
152
  typeInfo: tokenTypesByCampaign[campaign.campaignId].typeInfo,
153
153
  priceRewardToken: priceRewardToken,
@@ -23,7 +23,10 @@ type callKeysRfx = mandatoryCallKeys & {
23
23
  metaDataLong: string;
24
24
  };
25
25
  type dataRawTemplate = callKeysRfx & {};
26
- type dataTypeRfx = dataType & {};
26
+ type dataTypeRfx = dataType & {
27
+ symbolShortToken: string;
28
+ symbolLongToken: string;
29
+ };
27
30
  export declare class RfxProcessor extends GenericProcessor<callKeysRfx, dataRawTemplate, dataTypeRfx> {
28
31
  rounds: {
29
32
  round1: callType[];
@@ -59,6 +59,8 @@ export class RfxProcessor extends GenericProcessor {
59
59
  cardName: generateCardName(type, typeInfo, campaign),
60
60
  priceTargetToken: priceTargetToken, // Add the appropriate value here
61
61
  tvl,
62
+ symbolShortToken: typeInfo.symbolShortToken,
63
+ symbolLongToken: typeInfo.symbolLongToken,
62
64
  };
63
65
  }
64
66
  }
@@ -13,7 +13,7 @@ type callKeysBeefy = mandatoryCallKeys & {
13
13
  underlying: string;
14
14
  pricePerShare: string;
15
15
  totalSupplyUnderlying: string;
16
- symbolUnderlying: string;
16
+ symbolUnderlyingToken: string;
17
17
  };
18
18
  type dataRawBeefy = callKeysBeefy & {};
19
19
  type dataTypeBeefy = dataType & {
@@ -8,7 +8,7 @@ export class WoofiProcessor extends GenericProcessor {
8
8
  { key: "underlying", call: "want", target: "tokenAddress" },
9
9
  ],
10
10
  round2: [
11
- { key: "symbolUnderlying", call: "symbol", target: "underlying" },
11
+ { key: "symbolUnderlyingToken", call: "symbol", target: "underlying" },
12
12
  { key: "totalSupply", call: "totalSupply", target: "tokenAddress" },
13
13
  { key: "decimalsToken", call: "decimals", target: "underlying" },
14
14
  ],
@@ -18,7 +18,7 @@ export class WoofiProcessor extends GenericProcessor {
18
18
  // override computeRound1(): void {}
19
19
  async processingRound5(index, type, typeInfo, calls, campaign, pricer) {
20
20
  const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
21
- const priceToken = (await pricer.get({ symbol: typeInfo.symbolUnderlying })) ?? 0;
21
+ const priceToken = (await pricer.get({ symbol: typeInfo.symbolUnderlyingToken })) ?? 0;
22
22
  let normalizedFactor = 1;
23
23
  if (Number(typeInfo.decimalsToken) < campaign.campaignParameters.decimalsTargetToken) {
24
24
  normalizedFactor = 10 ** (campaign.campaignParameters.decimalsTargetToken - Number(typeInfo.decimalsToken));
@@ -35,6 +35,7 @@ export const getErc20Metadata = async (chainId, campaignId, rewardToken, amount,
35
35
  "maverickBoostedPosition",
36
36
  "zkSwapThreePool",
37
37
  "syncswap",
38
+ "rfx",
38
39
  ],
39
40
  BORROW: ["radiant_borrow", "aave_borrowing", "euler_borrow", "zerolend_borrowing"],
40
41
  LEND: [
@@ -5,7 +5,7 @@ import type { Resource } from "../prisma";
5
5
  * @see {@link Resource}
6
6
  */
7
7
  export type Protocol = Resource<"Protocol">;
8
- declare const protocolTypes: readonly ["arthswap", "baseswap", "camelot", "crust", "fenix", "horiza", "izumi", "kim", "pancakeswap-v3", "quickswap-algebra", "quickswap-uni", "ramses", "retro", "stryke", "stryke-pcs", "stryke-sushi", "sushiswap-v3", "swapr", "thruster", "uniswap-v3", "voltage", "zero", "koi", "supswap-v3", "zkswap", "thirdtrade", "uniswap-v2", "velodrome", "aerodrome", "balancer", "curve", "aura", "akron", "beefy", "dragonswap", "poolside", "koi", "syncswap-v3", "neptune", "zkSwapThreePool", "syncswap", "radiant", "aave", "euler", "gearbox", "compound", "sturdy", "frax", "ionic", "moonwell", "fluid", "silo", "morpho", "coumpound", "dolomite", "badger", "ajna", "layerbank", "ion", "venus", "woofi", "reactor_fusion", "eigenlayer"];
8
+ declare const protocolTypes: readonly ["arthswap", "baseswap", "camelot", "crust", "fenix", "horiza", "izumi", "kim", "pancakeswap-v3", "quickswap-algebra", "quickswap-uni", "ramses", "retro", "stryke", "stryke-pcs", "stryke-sushi", "sushiswap-v3", "swapr", "thruster", "uniswap-v3", "voltage", "zero", "koi", "supswap-v3", "zkswap", "thirdtrade", "uniswap-v2", "velodrome", "aerodrome", "balancer", "curve", "aura", "akron", "beefy", "dragonswap", "poolside", "koi", "syncswap-v3", "neptune", "zkSwapThreePool", "syncswap", "rfx", "radiant", "aave", "euler", "gearbox", "compound", "sturdy", "frax", "ionic", "moonwell", "fluid", "silo", "morpho", "coumpound", "dolomite", "badger", "ajna", "layerbank", "ion", "venus", "woofi", "reactor_fusion", "eigenlayer"];
9
9
  export type ProtocolId = (typeof protocolTypes)[number];
10
10
  export declare const ProtocolResourceDto: import("@sinclair/typebox").TObject<{
11
11
  id: import("@sinclair/typebox").TString;
@@ -43,6 +43,7 @@ const protocolTypes = [
43
43
  "neptune",
44
44
  "zkSwapThreePool",
45
45
  "syncswap",
46
+ "rfx",
46
47
  // ─── LP Lending ──────────────────────────────────────────────────────
47
48
  "radiant",
48
49
  "aave",
@@ -4,7 +4,7 @@ import type { BreakdownForCampaignsRaw, CampaignIdModel, CampaignIdWithoutPageMo
4
4
  export declare abstract class RewardRepository {
5
5
  static createManyReward(rewards: CreateManyRewardModel): Promise<Prisma.BatchPayload>;
6
6
  static createManyBreakdown(data: CreateManyBreakdownModel): Promise<Prisma.BatchPayload>;
7
- static getByRecipient(recipient: string, roots: string[], withToken: boolean, chainFilter?: ChainId[]): Promise<({
7
+ static getByRecipient(recipient: string, roots: string[], withToken: boolean, withTestTokens: boolean, chainFilter?: ChainId[]): Promise<({
8
8
  RewardToken: {
9
9
  symbol: string;
10
10
  name: string | null;
@@ -52,14 +52,19 @@ export class RewardRepository {
52
52
  data: breakdownsToCreate,
53
53
  });
54
54
  }
55
- static async getByRecipient(recipient, roots, withToken, chainFilter) {
55
+ static async getByRecipient(recipient, roots, withToken, withTestTokens, chainFilter) {
56
56
  return await apiDbClient.reward.findMany({
57
57
  where: {
58
58
  root: {
59
59
  in: roots,
60
60
  },
61
61
  recipient,
62
- ...(!!chainFilter?.length ? { RewardToken: { chainId: { in: chainFilter } } } : undefined),
62
+ RewardToken: !!chainFilter?.length || !withTestTokens
63
+ ? {
64
+ chainId: !!chainFilter?.length ? { in: chainFilter } : undefined,
65
+ isTest: withTestTokens ? undefined : false,
66
+ }
67
+ : undefined,
63
68
  },
64
69
  include: {
65
70
  Breakdown: {
@@ -158,7 +158,7 @@ export declare abstract class RewardService {
158
158
  proofs: string[];
159
159
  }[];
160
160
  static createManyBreakdown(data: CreateManyBreakdownModel): Promise<import("../../../../database/api/.generated").Prisma.BatchPayload | undefined>;
161
- static getByRecipient(recipient: string, roots: string[], withToken?: boolean, chainFilter?: ChainId[]): Promise<({
161
+ static getByRecipient(recipient: string, roots: string[], withToken?: boolean, withTestTokens?: boolean, chainFilter?: ChainId[]): Promise<({
162
162
  RewardToken: {
163
163
  symbol: string;
164
164
  name: string | null;
@@ -543,7 +543,7 @@ export declare abstract class RewardService {
543
543
  root: string;
544
544
  proofs: string[];
545
545
  })[]>;
546
- static getUserRewardsByChain(user: string, withToken: boolean, chainFilter?: ChainId[], connectedChainId?: MerklChainId | null): Promise<{
546
+ static getUserRewardsByChain(user: string, withToken: boolean, chainFilter?: ChainId[], connectedChainId?: MerklChainId | null, withTestTokens?: boolean): Promise<{
547
547
  chain: Chain;
548
548
  rewards: Awaited<ReturnType<(typeof RewardService)["format"]>>;
549
549
  }[]>;
@@ -83,8 +83,8 @@ export class RewardService {
83
83
  log.error(`createManyBreakdown - error creating many breakdowns for campaigns ${foundCampaigns.join(", ")}`, e);
84
84
  }
85
85
  }
86
- static async getByRecipient(recipient, roots, withToken = false, chainFilter) {
87
- return RewardRepository.getByRecipient(recipient, roots, withToken, chainFilter);
86
+ static async getByRecipient(recipient, roots, withToken = false, withTestTokens = false, chainFilter) {
87
+ return RewardRepository.getByRecipient(recipient, roots, withToken, withTestTokens, chainFilter);
88
88
  }
89
89
  /**
90
90
  * Groups a breakdown array by their corresponding opportunities
@@ -172,7 +172,7 @@ export class RewardService {
172
172
  }
173
173
  return rewards;
174
174
  }
175
- static async getUserRewardsByChain(user, withToken, chainFilter = [], connectedChainId = null) {
175
+ static async getUserRewardsByChain(user, withToken, chainFilter = [], connectedChainId = null, withTestTokens = false) {
176
176
  const chains = await ChainService.findMany();
177
177
  let chainIds = !chainFilter || !chainFilter.length
178
178
  ? chains.map(({ id }) => id)
@@ -190,7 +190,7 @@ export class RewardService {
190
190
  .filter(({ status }) => status === "fulfilled")
191
191
  .map(x => x.value);
192
192
  /** Load rewards from api DB */
193
- const rewards = (await RewardService.getByRecipient(user, merkleRoots.map(({ live }) => live), withToken)).filter(reward => chainIds.includes(reward.RewardToken.chainId));
193
+ const rewards = (await RewardService.getByRecipient(user, merkleRoots.map(({ live }) => live), withToken, withTestTokens)).filter(reward => chainIds.includes(reward.RewardToken.chainId));
194
194
  const promises = [];
195
195
  for (const [index, chainId] of chainIds.entries()) {
196
196
  const chain = chains.find(chain => chain.id === chainId);
@@ -1702,6 +1702,7 @@ export declare const v4: Elysia<"/v4", false, {
1702
1702
  address: string;
1703
1703
  };
1704
1704
  query: {
1705
+ test?: boolean | undefined;
1705
1706
  chainIds?: number[] | undefined;
1706
1707
  reloadChainId?: number | undefined;
1707
1708
  };
@@ -1818,6 +1819,7 @@ export declare const v4: Elysia<"/v4", false, {
1818
1819
  address: string;
1819
1820
  };
1820
1821
  query: {
1822
+ test?: boolean | undefined;
1821
1823
  reloadChainId?: number | undefined;
1822
1824
  chainId: number[];
1823
1825
  };
@@ -83,6 +83,7 @@ export declare const UserController: Elysia<"/users", false, {
83
83
  address: string;
84
84
  };
85
85
  query: {
86
+ test?: boolean | undefined;
86
87
  chainIds?: number[] | undefined;
87
88
  reloadChainId?: number | undefined;
88
89
  };
@@ -199,6 +200,7 @@ export declare const UserController: Elysia<"/users", false, {
199
200
  address: string;
200
201
  };
201
202
  query: {
203
+ test?: boolean | undefined;
202
204
  reloadChainId?: number | undefined;
203
205
  chainId: number[];
204
206
  };
@@ -18,7 +18,7 @@ export const UserController = new Elysia({ prefix: "/users", detail: { tags: ["U
18
18
  })
19
19
  // ─── Get User's Rewards With Breakdown And Details for our FE ────────
20
20
  .get("/:address/rewards/breakdowns", async ({ params, query }) => {
21
- const rewardsByChain = await RewardService.getUserRewardsByChain(params.address, true, query?.chainIds, query.reloadChainId ?? null);
21
+ const rewardsByChain = await RewardService.getUserRewardsByChain(params.address, true, query?.chainIds, query.reloadChainId ?? null, !!query.test ? query.test : false);
22
22
  return RewardService.splitRewardsBreakdownByOpportunity(rewardsByChain);
23
23
  }, {
24
24
  params: UserUniqueDto,
@@ -35,7 +35,7 @@ export const UserController = new Elysia({ prefix: "/users", detail: { tags: ["U
35
35
  })
36
36
  // ─── Get User's Rewards With Breakdown ──────────────────────────────
37
37
  .get("/:address/rewards", async ({ params, query }) => {
38
- const rewardsByChain = await RewardService.getUserRewardsByChain(params.address, false, typeof query.chainId === "number" ? [query.chainId] : query.chainId, !!query.reloadChainId ? query.reloadChainId : null);
38
+ const rewardsByChain = await RewardService.getUserRewardsByChain(params.address, false, typeof query.chainId === "number" ? [query.chainId] : query.chainId, !!query.reloadChainId ? query.reloadChainId : null, !!query.test ? query.test : false);
39
39
  return RewardService.removeOpportunityFromRewardBreakdown(rewardsByChain);
40
40
  }, {
41
41
  params: UserUniqueDto,
@@ -8,6 +8,7 @@ export type User = Resource<"User">;
8
8
  export declare const UserRewardRouteDto: import("@sinclair/typebox").TObject<{
9
9
  chainId: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TNumber>]>, number[]>;
10
10
  reloadChainId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
11
+ test: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
11
12
  }>;
12
13
  export declare const UserRewardsResourceDto: import("@sinclair/typebox").TObject<{
13
14
  chain: import("@sinclair/typebox").TObject<{
@@ -45,6 +46,7 @@ export declare const UserUniqueDto: import("@sinclair/typebox").TObject<{
45
46
  export declare const OptionalChainIdDto: import("@sinclair/typebox").TObject<{
46
47
  chainIds: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TNumber>]>, number[]>>;
47
48
  reloadChainId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
49
+ test: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
48
50
  }>;
49
51
  export declare const UserDto: import("@sinclair/typebox").TObject<{
50
52
  address: import("@sinclair/typebox").TString;
@@ -9,6 +9,7 @@ export const UserRewardRouteDto = t.Object({
9
9
  reloadChainId: t.Optional(t.Numeric({
10
10
  description: "An optional chainId to bypass the cache and check if there was very recently a claim on this chain",
11
11
  })),
12
+ test: t.Optional(t.Boolean({ description: "Include test token rewards" })),
12
13
  }, {
13
14
  description: "A required comma separated list of chain ids.<br>You can get the list of all supported chains by calling [GET /v4/chains](#tag/chains/GET/v4/chains/)",
14
15
  });
@@ -47,6 +48,7 @@ export const OptionalChainIdDto = t.Object({
47
48
  .Decode(value => (typeof value === "string" ? value.split(",").map(v => Number.parseInt(v)) : value))
48
49
  .Encode(value => [...value])),
49
50
  reloadChainId: t.Optional(t.Numeric()),
51
+ test: t.Optional(t.Boolean({ description: "Include test token rewards" })),
50
52
  });
51
53
  export const UserDto = t.Object({
52
54
  address: t.String(),
@@ -42,7 +42,7 @@ export function generateCardName(type, typeInfo, campaign, symbols = [""]) {
42
42
  return `Lend ${cardToken} on ${typeInfo.protocol}`;
43
43
  }
44
44
  case tokenType.rfx:
45
- return `Supply ${typeInfo.symbolShortToken}/${typeInfo.symbolLongToken} on ${typeInfo.protocol}`;
45
+ return `${typeInfo.protocol} ${typeInfo.symbolShortToken}/${typeInfo.symbolLongToken}`;
46
46
  case tokenType.radiant_borrow:
47
47
  case tokenType.aave_borrowing:
48
48
  case tokenType.yei_borrowing:
@@ -87,7 +87,7 @@ export function generateCardName(type, typeInfo, campaign, symbols = [""]) {
87
87
  case tokenType.ironcladStaking:
88
88
  return `Stake ${campaign.campaignParameters.symbolTargetToken} on ${typeInfo.protocol}`;
89
89
  case tokenType.woofi:
90
- return `Supercharge ${typeInfo.symbolUnderlying} on ${typeInfo.protocol}`;
90
+ return `Supercharge ${typeInfo.symbolUnderlyingToken} on ${typeInfo.protocol}`;
91
91
  case tokenType.maverickBoostedPosition:
92
92
  return `Maverick Boosted Position ${campaign.campaignParameters.symbolTargetToken}`;
93
93
  case tokenType.zkSwapThreePool: