@merkl/api 0.19.22 → 0.19.24

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 (52) hide show
  1. package/dist/src/eden/index.d.ts +55 -55
  2. package/dist/src/engine/erc20SubTypeProcessors/GenericProcessor.js +2 -2
  3. package/dist/src/engine/erc20SubTypeProcessors/helpers/tokenType.d.ts +5 -5
  4. package/dist/src/engine/erc20SubTypeProcessors/helpers/tokenType.js +103 -94
  5. package/dist/src/engine/opportunityMetadata/implementations/Ajna.d.ts +2 -1
  6. package/dist/src/engine/opportunityMetadata/implementations/Ambient.d.ts +2 -1
  7. package/dist/src/engine/opportunityMetadata/implementations/Badger.d.ts +2 -1
  8. package/dist/src/engine/opportunityMetadata/implementations/Clamm.d.ts +2 -1
  9. package/dist/src/engine/opportunityMetadata/implementations/Clamm.js +17 -4
  10. package/dist/src/engine/opportunityMetadata/implementations/Compound.js +2 -1
  11. package/dist/src/engine/opportunityMetadata/implementations/Default.d.ts +0 -1
  12. package/dist/src/engine/opportunityMetadata/implementations/Default.js +0 -1
  13. package/dist/src/engine/opportunityMetadata/implementations/Dolomite.d.ts +2 -1
  14. package/dist/src/engine/opportunityMetadata/implementations/EigenLayer.d.ts +2 -1
  15. package/dist/src/engine/opportunityMetadata/implementations/Encompassing.js +5 -0
  16. package/dist/src/engine/opportunityMetadata/implementations/Euler.d.ts +2 -1
  17. package/dist/src/engine/opportunityMetadata/implementations/EventBased.d.ts +1 -1
  18. package/dist/src/engine/opportunityMetadata/implementations/EventBased.js +7 -6
  19. package/dist/src/engine/opportunityMetadata/implementations/Hyperdrive.d.ts +2 -1
  20. package/dist/src/engine/opportunityMetadata/implementations/Ion.d.ts +2 -1
  21. package/dist/src/engine/opportunityMetadata/implementations/JsonAirdrop.d.ts +2 -2
  22. package/dist/src/engine/opportunityMetadata/implementations/Morpho.d.ts +2 -1
  23. package/dist/src/engine/opportunityMetadata/implementations/Radiant.d.ts +2 -1
  24. package/dist/src/engine/opportunityMetadata/implementations/Silo.d.ts +2 -1
  25. package/dist/src/engine/opportunityMetadata/implementations/UniswapV4.d.ts +2 -1
  26. package/dist/src/engine/opportunityMetadata/implementations/Vest.d.ts +2 -1
  27. package/dist/src/index.d.ts +11 -11
  28. package/dist/src/modules/v4/campaign/campaign.controller.d.ts +1 -1
  29. package/dist/src/modules/v4/enso/enso.model.d.ts +2 -2
  30. package/dist/src/modules/v4/enso/enso.model.js +2 -2
  31. package/dist/src/modules/v4/interaction/interaction.model.d.ts +1 -1
  32. package/dist/src/modules/v4/interaction/interaction.model.js +3 -3
  33. package/dist/src/modules/v4/kyberzap/kyberzap.model.d.ts +4 -4
  34. package/dist/src/modules/v4/kyberzap/kyberzap.model.js +4 -4
  35. package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +1 -1
  36. package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +3 -3
  37. package/dist/src/modules/v4/protocol/protocol.model.d.ts +2 -3
  38. package/dist/src/modules/v4/protocol/protocol.model.js +49 -9
  39. package/dist/src/modules/v4/protocol/protocol.repository.js +12 -0
  40. package/dist/src/modules/v4/protocol/protocol.service.js +0 -4
  41. package/dist/src/modules/v4/router.d.ts +11 -11
  42. package/dist/src/modules/v4/status/status.service.js +6 -0
  43. package/dist/src/modules/v4/token/token.controller.d.ts +9 -9
  44. package/dist/src/modules/v4/token/token.model.d.ts +5 -5
  45. package/dist/src/modules/v4/token/token.model.js +7 -5
  46. package/dist/src/modules/v4/token/token.service.js +5 -5
  47. package/dist/src/utils/caseChanges.d.ts +1 -0
  48. package/dist/src/utils/caseChanges.js +3 -0
  49. package/dist/tsconfig.package.tsbuildinfo +1 -1
  50. package/package.json +1 -1
  51. package/dist/database/api/seeder/resources/protocol.d.ts +0 -373
  52. package/dist/database/api/seeder/resources/protocol.js +0 -344
@@ -1,18 +1,18 @@
1
1
  import { t } from "elysia";
2
- const protocolTypes = [
3
- // ─── AMM ─────────────────────────────────────────────────────────────
2
+ export const protocolIdList = [
3
+ // ─── DEX ─────────────────────────────────────────────────────────────
4
4
  "uniswap",
5
5
  "ambient",
6
6
  "arthswap",
7
- "baseswap",
7
+ "base-swap",
8
8
  "camelot",
9
9
  "crust",
10
10
  "fenix",
11
11
  "horiza",
12
12
  "izumi",
13
13
  "kim",
14
- "pancakeswap",
15
- "quickswap",
14
+ "pancake-swap",
15
+ "quick-swap",
16
16
  "ramses",
17
17
  "retro",
18
18
  "stryke",
@@ -23,9 +23,9 @@ const protocolTypes = [
23
23
  "zero",
24
24
  "koi",
25
25
  "supswap",
26
- "zkswap",
26
+ "zk-swap",
27
27
  "thirdtrade",
28
- // ─── LP DEX ──────────────────────────────────────────────────────────
28
+ "swap-x",
29
29
  "velodrome",
30
30
  "aerodrome",
31
31
  "balancer",
@@ -43,9 +43,16 @@ const protocolTypes = [
43
43
  "zkSwapThreePool",
44
44
  "syncswap",
45
45
  "rfx",
46
- // ─── LP Lending ──────────────────────────────────────────────────────
46
+ "ra",
47
+ "maverick",
48
+ "trader-joe",
49
+ "velodrome",
50
+ "hanji",
51
+ // ─── Lending ──────────────────────────────────────────────────────
47
52
  "radiant",
48
53
  "aave",
54
+ "fraxlend",
55
+ "ironclad",
49
56
  "euler",
50
57
  "gearbox",
51
58
  "compound",
@@ -75,7 +82,40 @@ const protocolTypes = [
75
82
  "veda",
76
83
  "kyo",
77
84
  "sonex",
78
- "velodrome",
85
+ "lendle",
86
+ "tako-tako",
87
+ "equalizer",
88
+ "spectra",
89
+ "beraborrow",
90
+ "superlend",
91
+ "avalon",
92
+ // ─── Staking ──────────────────────────────────────────────────────
93
+ "angles",
94
+ // ─── Yield Aggregator ──────────────────────────────────────────────
95
+ "enzyme",
96
+ "toros",
97
+ "vicuna",
98
+ "bunni",
99
+ "beratrax",
100
+ "concrete",
101
+ "cian",
102
+ // ─── Fixed Yield ──────────────────────────────────────────────
103
+ "pendle",
104
+ "splice",
105
+ "sturdy",
106
+ "yei",
107
+ // ─── Option Trading ────────────────────────────────────────────────
108
+ "filament",
109
+ "gammaswap",
110
+ // ─── Synthetic Assets ────────────────────────────────────────────────
111
+ "maha",
112
+ "tempest",
113
+ "uranium",
114
+ "hanji",
115
+ // ─── Others ──────────────────────────────────────────────────────
116
+ "holdstation",
117
+ "katana",
118
+ "satlayer",
79
119
  ];
80
120
  // ─── DTOs ────────────────────────────────────────────────────────────────────
81
121
  export const ProtocolResourceDto = t.Object({
@@ -15,6 +15,18 @@ export class ProtocolRepository {
15
15
  });
16
16
  }
17
17
  static async changeId(oldId, newId) {
18
+ if (!(await ProtocolRepository.findMany({ id: newId }))[0]) {
19
+ await apiDbClient.protocol.create({
20
+ data: {
21
+ id: newId,
22
+ name: newId,
23
+ icon: "",
24
+ url: "",
25
+ description: "",
26
+ tags: [],
27
+ },
28
+ });
29
+ }
18
30
  await apiDbClient.opportunity.updateMany({
19
31
  where: {
20
32
  mainProtocolId: oldId,
@@ -28,10 +28,6 @@ export class ProtocolService {
28
28
  return await ProtocolRepository.create(data);
29
29
  }
30
30
  static async update(id, data) {
31
- // let iconUri = data.icon;
32
- // if (data.iconFile) {
33
- // iconUri = await BucketService.upload("merkl-assets", `/protocols/${id}`, data.iconFile.stream(), true);
34
- // }
35
31
  return await ProtocolRepository.update(id, data);
36
32
  }
37
33
  static async changeLogoUrls() {
@@ -108,7 +108,7 @@ export declare const v4: Elysia<"/v4", false, {
108
108
  } & {
109
109
  price?: number | null | undefined;
110
110
  })[];
111
- mainProtocol: string | undefined;
111
+ mainProtocol: "splice" | "morpho" | "euler" | "ambient" | "uniswap" | "arthswap" | "base-swap" | "camelot" | "crust" | "fenix" | "horiza" | "izumi" | "kim" | "pancake-swap" | "quick-swap" | "ramses" | "retro" | "stryke" | "sushiswap" | "swapr" | "thruster" | "voltage" | "zero" | "koi" | "supswap" | "zk-swap" | "thirdtrade" | "swap-x" | "velodrome" | "aerodrome" | "balancer" | "curve" | "cross_curve" | "curveNPool" | "aura" | "akron" | "beefy" | "dragonswap" | "poolside" | "syncswap" | "neptune" | "zkSwapThreePool" | "rfx" | "ra" | "maverick" | "trader-joe" | "hanji" | "radiant" | "aave" | "fraxlend" | "ironclad" | "gearbox" | "compound" | "sturdy" | "frax" | "ionic" | "moonwell" | "fluid" | "silo" | "coumpound" | "dolomite" | "badger" | "ajna" | "layerbank" | "ion" | "venus" | "woofi" | "reactor_fusion" | "eigenlayer" | "vest" | "zerolend" | "hyperdrive" | "gamma" | "oku" | "hourglass" | "veda" | "kyo" | "sonex" | "lendle" | "tako-tako" | "equalizer" | "spectra" | "beraborrow" | "superlend" | "avalon" | "angles" | "enzyme" | "toros" | "vicuna" | "bunni" | "beratrax" | "concrete" | "cian" | "pendle" | "yei" | "filament" | "gammaswap" | "maha" | "tempest" | "uranium" | "holdstation" | "katana" | "satlayer" | undefined;
112
112
  depositUrl: any;
113
113
  tags: string[];
114
114
  };
@@ -1173,7 +1173,7 @@ export declare const v4: Elysia<"/v4", false, {
1173
1173
  } & {
1174
1174
  price?: number | null | undefined;
1175
1175
  })[][];
1176
- mainProtocol: string | undefined;
1176
+ mainProtocol: "splice" | "morpho" | "euler" | "ambient" | "uniswap" | "arthswap" | "base-swap" | "camelot" | "crust" | "fenix" | "horiza" | "izumi" | "kim" | "pancake-swap" | "quick-swap" | "ramses" | "retro" | "stryke" | "sushiswap" | "swapr" | "thruster" | "voltage" | "zero" | "koi" | "supswap" | "zk-swap" | "thirdtrade" | "swap-x" | "velodrome" | "aerodrome" | "balancer" | "curve" | "cross_curve" | "curveNPool" | "aura" | "akron" | "beefy" | "dragonswap" | "poolside" | "syncswap" | "neptune" | "zkSwapThreePool" | "rfx" | "ra" | "maverick" | "trader-joe" | "hanji" | "radiant" | "aave" | "fraxlend" | "ironclad" | "gearbox" | "compound" | "sturdy" | "frax" | "ionic" | "moonwell" | "fluid" | "silo" | "coumpound" | "dolomite" | "badger" | "ajna" | "layerbank" | "ion" | "venus" | "woofi" | "reactor_fusion" | "eigenlayer" | "vest" | "zerolend" | "hyperdrive" | "gamma" | "oku" | "hourglass" | "veda" | "kyo" | "sonex" | "lendle" | "tako-tako" | "equalizer" | "spectra" | "beraborrow" | "superlend" | "avalon" | "angles" | "enzyme" | "toros" | "vicuna" | "bunni" | "beratrax" | "concrete" | "cian" | "pendle" | "yei" | "filament" | "gammaswap" | "maha" | "tempest" | "uranium" | "holdstation" | "katana" | "satlayer" | undefined;
1177
1177
  depositUrl: any;
1178
1178
  tags: string[];
1179
1179
  };
@@ -2152,30 +2152,30 @@ export declare const v4: Elysia<"/v4", false, {
2152
2152
  body: {
2153
2153
  data: {
2154
2154
  properties: {
2155
- Symbol: {
2156
- rich_text: {
2157
- plain_text: string;
2158
- }[];
2159
- };
2160
- Icon: {
2155
+ "Icon (Required)": {
2161
2156
  files: {
2162
2157
  file: {
2163
2158
  url: string;
2164
2159
  };
2165
2160
  }[];
2166
2161
  };
2167
- Address: {
2162
+ "Address (in checksum format) (Required)": {
2168
2163
  rich_text: {
2169
2164
  plain_text: string;
2170
2165
  }[];
2171
2166
  };
2172
- "Chain ID": {
2167
+ "Chain ID (Required)": {
2173
2168
  number: number;
2174
2169
  };
2170
+ "Symbol (Optional)": {
2171
+ rich_text: {
2172
+ plain_text: string;
2173
+ }[];
2174
+ };
2175
2175
  Verified: {
2176
2176
  checkbox: boolean;
2177
2177
  };
2178
- "CoinGecko API ID": {
2178
+ "CoinGecko API ID (Recommended)": {
2179
2179
  rich_text: {
2180
2180
  plain_text: string;
2181
2181
  }[];
@@ -101,7 +101,13 @@ export class StatusService {
101
101
  const delayedCampaignResult = delayedCampaignArray[index];
102
102
  const liveCampaignResult = liveCampaignArray[index];
103
103
  const delayedCampaigns = delayedCampaignResult.status === "rejected" ? [] : delayedCampaignResult.value;
104
+ if (delayedCampaignResult.status === "rejected") {
105
+ log.warn(`delayed campaigns fetching failed on ${NETWORK_LABELS[chainId]}: ${delayedCampaignResult.reason}`);
106
+ }
104
107
  const liveCampaigns = liveCampaignResult.status === "rejected" ? 0 : liveCampaignResult.value;
108
+ if (liveCampaignResult.status === "rejected") {
109
+ log.warn(`live campaigns fetching failed on ${NETWORK_LABELS[chainId]}: ${liveCampaignResult.reason}`);
110
+ }
105
111
  if (!registry(chainId)?.Merkl?.DistributionCreator || !registry(chainId)?.Merkl?.Distributor) {
106
112
  log.warn(`Missing registry for ${NETWORK_LABELS[chainId]}`);
107
113
  continue;
@@ -292,30 +292,30 @@ export declare const TokenController: Elysia<"/tokens", false, {
292
292
  body: {
293
293
  data: {
294
294
  properties: {
295
- Symbol: {
296
- rich_text: {
297
- plain_text: string;
298
- }[];
299
- };
300
- Icon: {
295
+ "Icon (Required)": {
301
296
  files: {
302
297
  file: {
303
298
  url: string;
304
299
  };
305
300
  }[];
306
301
  };
307
- Address: {
302
+ "Address (in checksum format) (Required)": {
308
303
  rich_text: {
309
304
  plain_text: string;
310
305
  }[];
311
306
  };
312
- "Chain ID": {
307
+ "Chain ID (Required)": {
313
308
  number: number;
314
309
  };
310
+ "Symbol (Optional)": {
311
+ rich_text: {
312
+ plain_text: string;
313
+ }[];
314
+ };
315
315
  Verified: {
316
316
  checkbox: boolean;
317
317
  };
318
- "CoinGecko API ID": {
318
+ "CoinGecko API ID (Recommended)": {
319
319
  rich_text: {
320
320
  plain_text: string;
321
321
  }[];
@@ -75,22 +75,22 @@ export declare const CreateTokenDto: import("@sinclair/typebox").TObject<{
75
75
  export declare const NotionWebhookDto: import("@sinclair/typebox").TObject<{
76
76
  data: import("@sinclair/typebox").TObject<{
77
77
  properties: import("@sinclair/typebox").TObject<{
78
- Icon: import("@sinclair/typebox").TObject<{
78
+ "Icon (Required)": import("@sinclair/typebox").TObject<{
79
79
  files: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
80
80
  file: import("@sinclair/typebox").TObject<{
81
81
  url: import("@sinclair/typebox").TString;
82
82
  }>;
83
83
  }>>;
84
84
  }>;
85
- Address: import("@sinclair/typebox").TObject<{
85
+ "Address (in checksum format) (Required)": import("@sinclair/typebox").TObject<{
86
86
  rich_text: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
87
87
  plain_text: import("@sinclair/typebox").TString;
88
88
  }>>;
89
89
  }>;
90
- "Chain ID": import("@sinclair/typebox").TObject<{
90
+ "Chain ID (Required)": import("@sinclair/typebox").TObject<{
91
91
  number: import("@sinclair/typebox").TNumber;
92
92
  }>;
93
- Symbol: import("@sinclair/typebox").TObject<{
93
+ "Symbol (Optional)": import("@sinclair/typebox").TObject<{
94
94
  rich_text: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
95
95
  plain_text: import("@sinclair/typebox").TString;
96
96
  }>>;
@@ -98,7 +98,7 @@ export declare const NotionWebhookDto: import("@sinclair/typebox").TObject<{
98
98
  Verified: import("@sinclair/typebox").TObject<{
99
99
  checkbox: import("@sinclair/typebox").TBoolean;
100
100
  }>;
101
- "CoinGecko API ID": import("@sinclair/typebox").TObject<{
101
+ "CoinGecko API ID (Recommended)": import("@sinclair/typebox").TObject<{
102
102
  rich_text: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
103
103
  plain_text: import("@sinclair/typebox").TString;
104
104
  }>>;
@@ -63,12 +63,14 @@ export const CreateTokenDto = t.Object({
63
63
  export const NotionWebhookDto = t.Object({
64
64
  data: t.Object({
65
65
  properties: t.Object({
66
- Icon: t.Object({ files: t.Array(t.Object({ file: t.Object({ url: t.String() }) })) }),
67
- Address: t.Object({ rich_text: t.Array(t.Object({ plain_text: t.String() })) }),
68
- "Chain ID": t.Object({ number: t.Numeric() }),
69
- Symbol: t.Object({ rich_text: t.Array(t.Object({ plain_text: t.String() })) }),
66
+ "Icon (Required)": t.Object({ files: t.Array(t.Object({ file: t.Object({ url: t.String() }) })) }),
67
+ "Address (in checksum format) (Required)": t.Object({
68
+ rich_text: t.Array(t.Object({ plain_text: t.String() })),
69
+ }),
70
+ "Chain ID (Required)": t.Object({ number: t.Numeric() }),
71
+ "Symbol (Optional)": t.Object({ rich_text: t.Array(t.Object({ plain_text: t.String() })) }),
70
72
  Verified: t.Object({ checkbox: t.Boolean() }),
71
- "CoinGecko API ID": t.Object({ rich_text: t.Array(t.Object({ plain_text: t.String() })) }),
73
+ "CoinGecko API ID (Recommended)": t.Object({ rich_text: t.Array(t.Object({ plain_text: t.String() })) }),
72
74
  }),
73
75
  }),
74
76
  }, { additionalProperties: true });
@@ -281,16 +281,16 @@ export class TokenService {
281
281
  const env = process.env.ENV === "prod" ? "production" : process.env.ENV;
282
282
  const bucket = new BucketService(`merkl-${env}-tokens`, `angle-${env}-1`);
283
283
  const properties = body.data.properties;
284
- const icon = properties.Icon.files?.[0]?.file.url;
284
+ const icon = properties["Icon (Required)"].files?.[0]?.file.url;
285
285
  const iconFile = await fetch(icon);
286
286
  const mimeType = iconFile.headers.get("content-type");
287
287
  const extension = mimeType.split("/")[1].split("+")[0];
288
- const address = throwOnInvalidRequiredAddress(properties.Address.rich_text[0].plain_text);
289
- const chainId = properties["Chain ID"].number;
288
+ const address = throwOnInvalidRequiredAddress(properties["Address (in checksum format) (Required)"].rich_text[0].plain_text);
289
+ const chainId = properties["Chain ID (Required)"].number;
290
290
  throwOnUnsupportedChainId(chainId);
291
- const displaySymbol = properties.Symbol.rich_text[0]?.plain_text;
291
+ const displaySymbol = properties["Symbol (Optional)"].rich_text[0]?.plain_text;
292
292
  const isVerified = properties.Verified.checkbox;
293
- const coingeckoApiId = properties["CoinGecko API ID"].rich_text[0]?.plain_text;
293
+ const coingeckoApiId = properties["CoinGecko API ID (Recommended)"].rich_text[0]?.plain_text;
294
294
  const byteArray = await iconFile.bytes(); // Unknown type error here probably due to bun/types
295
295
  const [token] = await TokenService.findManyOrCreate([
296
296
  {
@@ -1,3 +1,4 @@
1
1
  export declare function camelToKebabCase(str: string): string;
2
2
  export declare function kebabToCamelCase(str: string): string;
3
3
  export declare function kebabToPascalCase(str: string): string;
4
+ export declare function capitalize(str: string): string;
@@ -10,3 +10,6 @@ export function kebabToPascalCase(str) {
10
10
  .map(word => word.charAt(0).toUpperCase() + word.slice(1))
11
11
  .join("");
12
12
  }
13
+ export function capitalize(str) {
14
+ return str.charAt(0).toUpperCase() + str.slice(1);
15
+ }