@merkl/api 0.20.33 → 0.20.35

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 (74) hide show
  1. package/dist/src/eden/index.d.ts +73 -13
  2. package/dist/src/engine/erc20SubTypeProcessors/GenericProcessor.d.ts +4 -0
  3. package/dist/src/engine/erc20SubTypeProcessors/GenericProcessor.js +1 -0
  4. package/dist/src/engine/erc20SubTypeProcessors/helpers/spliceTVL.d.ts +1 -0
  5. package/dist/src/engine/erc20SubTypeProcessors/helpers/spliceTVL.js +2 -0
  6. package/dist/src/engine/erc20SubTypeProcessors/implementations/AaveProcessor.js +1 -0
  7. package/dist/src/engine/erc20SubTypeProcessors/implementations/AnglesLiquid.js +1 -0
  8. package/dist/src/engine/erc20SubTypeProcessors/implementations/AssetProcessor.js +1 -0
  9. package/dist/src/engine/erc20SubTypeProcessors/implementations/AuraProcessor.js +3 -0
  10. package/dist/src/engine/erc20SubTypeProcessors/implementations/BEXRewardGaugeProcessor.js +3 -0
  11. package/dist/src/engine/erc20SubTypeProcessors/implementations/BalancerGaugeProcessor.js +3 -0
  12. package/dist/src/engine/erc20SubTypeProcessors/implementations/BalancerPoolProcessor.js +7 -1
  13. package/dist/src/engine/erc20SubTypeProcessors/implementations/BalancerV3PoolProcessor.js +7 -1
  14. package/dist/src/engine/erc20SubTypeProcessors/implementations/BeefyProcessor.js +4 -0
  15. package/dist/src/engine/erc20SubTypeProcessors/implementations/BunniV2Processor.js +4 -0
  16. package/dist/src/engine/erc20SubTypeProcessors/implementations/CompoundProcessor.js +1 -0
  17. package/dist/src/engine/erc20SubTypeProcessors/implementations/ERC4626Processor.js +1 -0
  18. package/dist/src/engine/erc20SubTypeProcessors/implementations/EnzymeProcessor.js +1 -0
  19. package/dist/src/engine/erc20SubTypeProcessors/implementations/EqualizerGaugeProcessor.js +1 -0
  20. package/dist/src/engine/erc20SubTypeProcessors/implementations/EulerBorrowProcessor.js +1 -0
  21. package/dist/src/engine/erc20SubTypeProcessors/implementations/EulerLendProcessor.js +1 -0
  22. package/dist/src/engine/erc20SubTypeProcessors/implementations/FluidProcessor.js +1 -0
  23. package/dist/src/engine/erc20SubTypeProcessors/implementations/FraxProcessor.js +1 -0
  24. package/dist/src/engine/erc20SubTypeProcessors/implementations/GammaProcessor.js +4 -0
  25. package/dist/src/engine/erc20SubTypeProcessors/implementations/GearboxProcessor.js +1 -0
  26. package/dist/src/engine/erc20SubTypeProcessors/implementations/HanjiVaultProcessor.js +5 -0
  27. package/dist/src/engine/erc20SubTypeProcessors/implementations/HoldStationProcessor.d.ts +1 -1
  28. package/dist/src/engine/erc20SubTypeProcessors/implementations/HoldStationProcessor.js +3 -2
  29. package/dist/src/engine/erc20SubTypeProcessors/implementations/HourglassProcessor.js +1 -0
  30. package/dist/src/engine/erc20SubTypeProcessors/implementations/MaverickBPProcessor.d.ts +16 -16
  31. package/dist/src/engine/erc20SubTypeProcessors/implementations/MaverickBPProcessor.js +27 -23
  32. package/dist/src/engine/erc20SubTypeProcessors/implementations/MetamorphoProcessor.js +1 -0
  33. package/dist/src/engine/erc20SubTypeProcessors/implementations/NoLinkVaultProcessor.js +1 -0
  34. package/dist/src/engine/erc20SubTypeProcessors/implementations/PendleProcessor.js +1 -0
  35. package/dist/src/engine/erc20SubTypeProcessors/implementations/PendleYTProcessor.js +1 -0
  36. package/dist/src/engine/erc20SubTypeProcessors/implementations/RadiantProcessor.js +1 -0
  37. package/dist/src/engine/erc20SubTypeProcessors/implementations/RfxProcessor.js +4 -0
  38. package/dist/src/engine/erc20SubTypeProcessors/implementations/Satlayer.js +1 -0
  39. package/dist/src/engine/erc20SubTypeProcessors/implementations/SpectraProcessor.js +1 -0
  40. package/dist/src/engine/erc20SubTypeProcessors/implementations/SpectraYTProcessor.js +1 -0
  41. package/dist/src/engine/erc20SubTypeProcessors/implementations/SpliceProcessor.js +2 -1
  42. package/dist/src/engine/erc20SubTypeProcessors/implementations/SturdySiloProcessor.js +1 -0
  43. package/dist/src/engine/erc20SubTypeProcessors/implementations/TempestVaultProcessor.js +4 -0
  44. package/dist/src/engine/erc20SubTypeProcessors/implementations/TorosProcessor.js +2 -1
  45. package/dist/src/engine/erc20SubTypeProcessors/implementations/UniswapProcessor.js +4 -0
  46. package/dist/src/engine/erc20SubTypeProcessors/implementations/VicunaProcessor.js +1 -0
  47. package/dist/src/engine/erc20SubTypeProcessors/implementations/WoofiProcessor.js +1 -0
  48. package/dist/src/engine/erc20SubTypeProcessors/implementations/ZkSwapThreePoolProcessor.js +5 -0
  49. package/dist/src/engine/erc20SubTypeProcessors/implementations/curveNPoolProcessor.js +3 -0
  50. package/dist/src/engine/erc20SubTypeProcessors/implementations/curveProcessor.js +11 -0
  51. package/dist/src/engine/erc20SubTypeProcessors/implementations/stakedCurveProcessor.js +11 -0
  52. package/dist/src/engine/erc20SubTypeProcessors/implementations/xU308Processor.js +1 -0
  53. package/dist/src/engine/opportunityMetadata/implementations/Erc20.js +5 -38
  54. package/dist/src/index.d.ts +13 -1
  55. package/dist/src/modules/v4/chain/chain.controller.d.ts +2 -0
  56. package/dist/src/modules/v4/chain/chain.model.d.ts +1 -0
  57. package/dist/src/modules/v4/chain/chain.model.js +1 -0
  58. package/dist/src/modules/v4/chain/chain.repository.d.ts +11 -0
  59. package/dist/src/modules/v4/chain/chain.repository.js +4 -1
  60. package/dist/src/modules/v4/chain/chain.service.js +4 -2
  61. package/dist/src/modules/v4/opportunity/opportunity.service.js +4 -2
  62. package/dist/src/modules/v4/programPayload/programPayload.repository.js +3 -3
  63. package/dist/src/modules/v4/protocol/protocol.controller.d.ts +11 -1
  64. package/dist/src/modules/v4/protocol/protocol.controller.js +2 -1
  65. package/dist/src/modules/v4/protocol/protocol.model.d.ts +1 -0
  66. package/dist/src/modules/v4/protocol/protocol.model.js +1 -0
  67. package/dist/src/modules/v4/protocol/protocol.repository.js +33 -28
  68. package/dist/src/modules/v4/protocol/protocol.service.d.ts +1 -0
  69. package/dist/src/modules/v4/protocol/protocol.service.js +8 -1
  70. package/dist/src/modules/v4/router.d.ts +13 -1
  71. package/dist/src/utils/generateCardName.d.ts +1 -1
  72. package/dist/src/utils/generateCardName.js +3 -15
  73. package/dist/tsconfig.package.tsbuildinfo +1 -1
  74. package/package.json +1 -1
@@ -722,7 +722,7 @@ const EtherlinkInterfaceCampaigns = {
722
722
  campaignType: Campaign.EVENT_BASED,
723
723
  contract: "0xd0bc067cf877f7b76ceb331891331d9e6acda1a7",
724
724
  eventID: id("OrderPlaced(address,uint64,bool,uint128,uint72,uint128,uint128,uint128,uint128,uint128,bool,bool)"),
725
- topicToData: [{ topicIndex: 1, decodeKeyTopic: "address", dataIndex: 6, multiplier: (3n * 10n ** 19n).toString() }],
725
+ topicToData: [{ topicIndex: 1, decodeKeyTopic: "address", dataIndex: 6, multiplier: (3n * 10n ** 20n).toString() }],
726
726
  computeScoreParameters: {
727
727
  computeMethod: ComputeScoreMethod.cappedScorePercentageHistorical,
728
728
  computeSettings: {
@@ -752,7 +752,7 @@ const EtherlinkInterfaceCampaigns = {
752
752
  campaignType: Campaign.EVENT_BASED,
753
753
  contract: "0x65ea4dd7f789c71c0f57ed84b3bdc3062898d3cb",
754
754
  eventID: id("OrderPlaced(address,uint64,bool,uint128,uint72,uint128,uint128,uint128,uint128,uint128,bool,bool)"),
755
- topicToData: [{ topicIndex: 1, decodeKeyTopic: "address", dataIndex: 6, multiplier: (3n * 10n ** 19n).toString() }],
755
+ topicToData: [{ topicIndex: 1, decodeKeyTopic: "address", dataIndex: 6, multiplier: (3n * 10n ** 20n).toString() }],
756
756
  computeScoreParameters: {
757
757
  computeMethod: ComputeScoreMethod.cappedScorePercentageHistorical,
758
758
  computeSettings: {
@@ -782,7 +782,7 @@ const EtherlinkInterfaceCampaigns = {
782
782
  campaignType: Campaign.EVENT_BASED,
783
783
  contract: "0xbb6b01d94e3f6ebae8647cb56d544f57928ab758",
784
784
  eventID: id("OrderPlaced(address,uint64,bool,uint128,uint72,uint128,uint128,uint128,uint128,uint128,bool,bool)"),
785
- topicToData: [{ topicIndex: 1, decodeKeyTopic: "address", dataIndex: 6, multiplier: (3n * 10n ** 19n).toString() }],
785
+ topicToData: [{ topicIndex: 1, decodeKeyTopic: "address", dataIndex: 6, multiplier: (3n * 10n ** 20n).toString() }],
786
786
  computeScoreParameters: {
787
787
  computeMethod: ComputeScoreMethod.cappedScorePercentageHistorical,
788
788
  computeSettings: {
@@ -23,6 +23,7 @@ export declare const ProtocolController: Elysia<"/protocols", false, {
23
23
  items?: number | undefined;
24
24
  tags?: string[] | undefined;
25
25
  page?: number | undefined;
26
+ test?: boolean | undefined;
26
27
  ids?: string[] | undefined;
27
28
  opportunityTag?: string | undefined;
28
29
  };
@@ -50,7 +51,16 @@ export declare const ProtocolController: Elysia<"/protocols", false, {
50
51
  get: {
51
52
  body: unknown;
52
53
  params: {};
53
- query: unknown;
54
+ query: {
55
+ id?: string | undefined;
56
+ name?: string | undefined;
57
+ items?: number | undefined;
58
+ tags?: string[] | undefined;
59
+ page?: number | undefined;
60
+ test?: boolean | undefined;
61
+ ids?: string[] | undefined;
62
+ opportunityTag?: string | undefined;
63
+ };
54
64
  headers: unknown;
55
65
  response: {
56
66
  200: number;
@@ -12,7 +12,8 @@ export const ProtocolController = new Elysia({ prefix: "/protocols", detail: { t
12
12
  })
13
13
  // ─── Count Protocols ─────────────────────────────────────────────────
14
14
  .get("/count", async ({ query }) => await ProtocolService.countMany(query), {
15
- detail: { description: "Get the number of protocols correspoinding to the query." },
15
+ query: GetProtocolsQueryDto,
16
+ detail: { description: "Get the number of protocols corresponding to the query." },
16
17
  })
17
18
  // ─── Get A Protocol By Its Id Or Name ────────────────────────────────
18
19
  .get("/:id", async ({ params }) => {
@@ -21,6 +21,7 @@ export declare const ProtocolResourceDto: import("@sinclair/typebox").TObject<{
21
21
  }>;
22
22
  export declare const GetProtocolsQueryDto: import("@sinclair/typebox").TObject<{
23
23
  id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
24
+ test: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
24
25
  ids: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
25
26
  name: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
26
27
  tags: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
@@ -128,6 +128,7 @@ export const ProtocolResourceDto = t.Object({
128
128
  });
129
129
  export const GetProtocolsQueryDto = t.Object({
130
130
  id: t.Optional(t.String({ description: "Filter results by name. Useful for searching a protocol to verify its integration" })),
131
+ test: t.Optional(t.Boolean({ description: "Includes protocols that have only test opportunities", default: false })),
131
132
  ids: t.Optional(t.Array(t.String())),
132
133
  name: t.Optional(t.String({ description: "Search protocols by name" })),
133
134
  tags: t.Optional(t.Array(t.String())),
@@ -2,6 +2,39 @@ import { log } from "@/utils/logger";
2
2
  import { apiDbClient } from "@db";
3
3
  // ─── Protocols Repository ────────────────────────────────────────────────────
4
4
  export class ProtocolRepository {
5
+ static #transformQueryToPrismaFilters(query) {
6
+ return {
7
+ where: {
8
+ id: query.id
9
+ ? { contains: query.id, mode: "insensitive" }
10
+ : query.ids
11
+ ? { in: query.ids, mode: "insensitive" }
12
+ : undefined,
13
+ tags: query.tags ? { hasEvery: query.tags } : undefined,
14
+ name: query.name ? { contains: query.name, mode: "insensitive" } : undefined,
15
+ OR: query.opportunityTag // The opportunity tag specified can be either at the protocol level or the opportunity level
16
+ ? [
17
+ {
18
+ MainOpportunities: {
19
+ some: {
20
+ tags: {
21
+ has: query.opportunityTag,
22
+ },
23
+ },
24
+ },
25
+ },
26
+ { tags: { has: query.opportunityTag } },
27
+ ]
28
+ : !query.test
29
+ ? [
30
+ { MainOpportunities: { some: { Campaigns: { some: { RewardToken: { isTest: false } } } } } },
31
+ { Opportunities: { some: { Campaigns: { some: { RewardToken: { isTest: false } } } } } },
32
+ ]
33
+ : undefined,
34
+ // id: typeof query.id === "string" ? query.id : !!query.id ? { in: query.id } : undefined,
35
+ },
36
+ };
37
+ }
5
38
  static async create(data) {
6
39
  return await apiDbClient.protocol.create({
7
40
  data: {
@@ -91,34 +124,6 @@ export class ProtocolRepository {
91
124
  static async findManyByName(name) {
92
125
  return await apiDbClient.protocol.findMany({ where: { name: { equals: name } } });
93
126
  }
94
- static #transformQueryToPrismaFilters(query) {
95
- return {
96
- where: {
97
- id: query.id
98
- ? { contains: query.id, mode: "insensitive" }
99
- : query.ids
100
- ? { in: query.ids, mode: "insensitive" }
101
- : undefined,
102
- tags: query.tags ? { hasEvery: query.tags } : undefined,
103
- name: query.name ? { contains: query.name, mode: "insensitive" } : undefined,
104
- OR: query.opportunityTag // The opportunity tag specified can be either at the protocol level or the opportunity level
105
- ? [
106
- {
107
- MainOpportunities: {
108
- some: {
109
- tags: {
110
- has: query.opportunityTag,
111
- },
112
- },
113
- },
114
- },
115
- { tags: { has: query.opportunityTag } },
116
- ]
117
- : undefined,
118
- // id: typeof query.id === "string" ? query.id : !!query.id ? { in: query.id } : undefined,
119
- },
120
- };
121
- }
122
127
  static async findMany(query) {
123
128
  const { page: _page, items: _items } = query;
124
129
  const page = _page ? _page : 0;
@@ -1,5 +1,6 @@
1
1
  import type { CreateProtocolModel, GetProtocolsQueryModel, Protocol, ProtocolId, UpdateProtocolModel } from "./protocol.model";
2
2
  export declare abstract class ProtocolService {
3
+ #private;
3
4
  static findMany(query: GetProtocolsQueryModel): Promise<Protocol["model"][]>;
4
5
  static countMany(query: GetProtocolsQueryModel): Promise<number>;
5
6
  static getFromId(id: ProtocolId | string): Promise<Protocol["model"] | null>;
@@ -1,10 +1,12 @@
1
1
  import { ChainService } from "@/modules/v4/chain/chain.service";
2
2
  import { TokenService } from "@/modules/v4/token/token.service";
3
3
  import { log } from "@/utils/logger";
4
+ import { CacheService } from "../cache";
5
+ import { TTLPresets } from "../cache/cache.model";
4
6
  import { ProtocolRepository } from "./protocol.repository";
5
7
  // ─── Protocols Services ──────────────────────────────────────────────────────
6
8
  export class ProtocolService {
7
- static async findMany(query) {
9
+ static async #findMany(query) {
8
10
  const protocols = await ProtocolRepository.findMany(query);
9
11
  const enrichedProtocols = protocols.map(({ MainOpportunities, ...protocol }) => ({
10
12
  ...protocol,
@@ -14,6 +16,11 @@ export class ProtocolService {
14
16
  }));
15
17
  return enrichedProtocols;
16
18
  }
19
+ static async findMany(query) {
20
+ if (query.test)
21
+ return await ProtocolRepository.findMany(query);
22
+ return await CacheService.wrap(TTLPresets.MIN_10, ProtocolService.#findMany, query);
23
+ }
17
24
  static async countMany(query) {
18
25
  return ProtocolRepository.countMany(query);
19
26
  }
@@ -1762,6 +1762,7 @@ export declare const v4: Elysia<"/v4", false, {
1762
1762
  items?: number | undefined;
1763
1763
  tags?: string[] | undefined;
1764
1764
  page?: number | undefined;
1765
+ test?: boolean | undefined;
1765
1766
  ids?: string[] | undefined;
1766
1767
  opportunityTag?: string | undefined;
1767
1768
  };
@@ -1789,7 +1790,16 @@ export declare const v4: Elysia<"/v4", false, {
1789
1790
  get: {
1790
1791
  body: unknown;
1791
1792
  params: {};
1792
- query: unknown;
1793
+ query: {
1794
+ id?: string | undefined;
1795
+ name?: string | undefined;
1796
+ items?: number | undefined;
1797
+ tags?: string[] | undefined;
1798
+ page?: number | undefined;
1799
+ test?: boolean | undefined;
1800
+ ids?: string[] | undefined;
1801
+ opportunityTag?: string | undefined;
1802
+ };
1793
1803
  headers: unknown;
1794
1804
  response: {
1795
1805
  200: number;
@@ -2717,6 +2727,7 @@ export declare const v4: Elysia<"/v4", false, {
2717
2727
  params: {};
2718
2728
  query: {
2719
2729
  name?: string | undefined;
2730
+ test?: boolean | undefined;
2720
2731
  };
2721
2732
  headers: unknown;
2722
2733
  response: {
@@ -2743,6 +2754,7 @@ export declare const v4: Elysia<"/v4", false, {
2743
2754
  params: {};
2744
2755
  query: {
2745
2756
  name?: string | undefined;
2757
+ test?: boolean | undefined;
2746
2758
  };
2747
2759
  headers: unknown;
2748
2760
  response: {
@@ -1,5 +1,5 @@
1
1
  import { tokenType } from "@/engine/erc20SubTypeProcessors/helpers/tokenType";
2
- import { type Campaign, type CampaignParameters } from "@sdk";
2
+ import type { Campaign, CampaignParameters } from "@sdk";
3
3
  export declare const stakingContractToStakingSymbol: {
4
4
  [key: string]: string;
5
5
  };
@@ -1,5 +1,4 @@
1
1
  import { tokenType } from "@/engine/erc20SubTypeProcessors/helpers/tokenType";
2
- import { ChainId } from "@sdk";
3
2
  import { capitalize } from "lodash";
4
3
  export const stakingContractToStakingSymbol = {
5
4
  "0x18eeD20f71BEf84B605253C89A7576E3634134C0": "CyberStaking",
@@ -51,19 +50,9 @@ export function generateCardName(type, typeInfo, campaign, symbols = [""], displ
51
50
  case tokenType.beratrax_vault:
52
51
  return `Deposit ${symbols.join("-")} on ${capitalize(typeInfo.protocol)}`;
53
52
  case tokenType.balancerPool: {
54
- if (campaign.computeChainId === ChainId.SONIC) {
55
- typeInfo.protocol = "Beets";
56
- }
57
- let cardName = `Provide liquidity to ${capitalize(typeInfo.protocol)} ${symbols.join("-")}`;
58
- if (typeInfo.vault === "0xFB43069f6d0473B85686a85F4Ce4Fc1FD8F00875") {
59
- cardName = `Provide liquidity to Jellyverse Pool ${symbols.join("-")}`;
60
- }
61
- return cardName;
53
+ return `Provide liquidity to ${capitalize(typeInfo.protocol)} ${symbols.join("-")}`;
62
54
  }
63
55
  case tokenType.balancerV3: {
64
- if (campaign.computeChainId === ChainId.SONIC) {
65
- typeInfo.protocol = "Beets";
66
- }
67
56
  return `Provide liquidity to ${capitalize(typeInfo.protocol)} Boosted ${symbols.join("-")}`;
68
57
  }
69
58
  case tokenType.aura:
@@ -110,7 +99,8 @@ export function generateCardName(type, typeInfo, campaign, symbols = [""], displ
110
99
  case tokenType.venus:
111
100
  case tokenType.reactor_fusion:
112
101
  case tokenType.euler_lend:
113
- return `Supply ${typeInfo.symbolUnderlyingToken} on ${capitalize(typeInfo.protocol)}`;
102
+ case tokenType.fluid:
103
+ return `Lend ${typeInfo.symbolUnderlyingToken} on ${capitalize(typeInfo.protocol)}`;
114
104
  case tokenType.metamorpho:
115
105
  return `Supply to ${typeInfo.name} on ${capitalize(typeInfo.protocol)}`;
116
106
  case tokenType.sturdy_aggregator:
@@ -120,8 +110,6 @@ export function generateCardName(type, typeInfo, campaign, symbols = [""], displ
120
110
  case tokenType.curve:
121
111
  case tokenType.curve_2:
122
112
  return `Provide liquidity to ${capitalize(typeInfo.protocol)} ${Object.values(typeInfo.poolTokens).join("-")}`;
123
- case tokenType.fluid:
124
- return `Lend ${typeInfo.symbolUnderlyingToken} on ${capitalize(typeInfo.protocol)}`;
125
113
  case tokenType.enzyme:
126
114
  return `Supply to the ${typeInfo.name} on ${capitalize(typeInfo.protocol)}`;
127
115
  case tokenType.filament: