@merkl/api 0.20.3 → 0.20.5

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 (47) hide show
  1. package/dist/database/api/.generated/drizzle/schema.d.ts +0 -102
  2. package/dist/database/api/.generated/drizzle/schema.js +5 -11
  3. package/dist/database/api/.generated/drizzle/schema.ts +5 -11
  4. package/dist/database/api/.generated/edge.js +8 -15
  5. package/dist/database/api/.generated/index-browser.js +5 -12
  6. package/dist/database/api/.generated/index.d.ts +149 -464
  7. package/dist/database/api/.generated/index.js +8 -15
  8. package/dist/database/api/.generated/package.json +1 -1
  9. package/dist/database/api/.generated/schema.prisma +5 -11
  10. package/dist/database/api/.generated/wasm.js +5 -12
  11. package/dist/src/cache/declaration.d.ts +2 -2
  12. package/dist/src/cache/declaration.js +2 -2
  13. package/dist/src/eden/index.d.ts +65 -90
  14. package/dist/src/engine/dynamicData/utils/getEulerV2Vaults.d.ts +0 -1
  15. package/dist/src/engine/dynamicData/utils/getEulerV2Vaults.js +77 -40
  16. package/dist/src/engine/erc20SubTypeProcessors/implementations/EulerLendProcessor.js +6 -1
  17. package/dist/src/index.d.ts +13 -18
  18. package/dist/src/jobs/update-euler-vaults.d.ts +1 -1
  19. package/dist/src/jobs/update-euler-vaults.js +5 -121
  20. package/dist/src/modules/v4/apr/apr.model.d.ts +3 -3
  21. package/dist/src/modules/v4/apr/apr.model.js +1 -1
  22. package/dist/src/modules/v4/computedValue/computedValue.controller.d.ts +1 -3
  23. package/dist/src/modules/v4/computedValue/computedValue.repository.d.ts +1 -3
  24. package/dist/src/modules/v4/computedValue/computedValue.repository.js +0 -2
  25. package/dist/src/modules/v4/computedValue/computedValue.service.d.ts +1 -3
  26. package/dist/src/modules/v4/icon/icon.model.d.ts +4 -0
  27. package/dist/src/modules/v4/icon/icon.model.js +1 -0
  28. package/dist/src/modules/v4/icon/icon.service.d.ts +5 -0
  29. package/dist/src/modules/v4/icon/icon.service.js +15 -0
  30. package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +12 -15
  31. package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +6 -6
  32. package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +17 -34
  33. package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +15 -24
  34. package/dist/src/modules/v4/programPayload/programPayload.repository.js +4 -0
  35. package/dist/src/modules/v4/reward/reward.model.d.ts +4 -4
  36. package/dist/src/modules/v4/reward/reward.model.js +1 -1
  37. package/dist/src/modules/v4/reward/reward.repository.d.ts +2 -4
  38. package/dist/src/modules/v4/reward/reward.service.d.ts +5 -10
  39. package/dist/src/modules/v4/reward/reward.service.js +1 -1
  40. package/dist/src/modules/v4/router.d.ts +13 -18
  41. package/dist/src/modules/v4/token/token.service.js +6 -9
  42. package/dist/src/modules/v4/tvl/tvl.model.d.ts +3 -3
  43. package/dist/src/modules/v4/tvl/tvl.model.js +1 -1
  44. package/dist/src/routes/v3/euler.d.ts +0 -6
  45. package/dist/src/routes/v3/euler.js +3 -3
  46. package/dist/tsconfig.package.tsbuildinfo +1 -1
  47. package/package.json +1 -1
@@ -155,9 +155,8 @@ export declare const v4: Elysia<"/v4", false, {
155
155
  cumulated: number;
156
156
  timestamp: bigint;
157
157
  breakdowns: {
158
- id: number;
158
+ id: string;
159
159
  type: import("@db/api").$Enums.AprType;
160
- uuid: string;
161
160
  identifier: string;
162
161
  value: number;
163
162
  aprRecordId: string;
@@ -168,9 +167,8 @@ export declare const v4: Elysia<"/v4", false, {
168
167
  total: number;
169
168
  timestamp: bigint;
170
169
  breakdowns: {
171
- id: number;
170
+ id: string;
172
171
  type: import("@db/api").$Enums.TvlType;
173
- uuid: string;
174
172
  identifier: string;
175
173
  value: number;
176
174
  tvlRecordId: string;
@@ -181,8 +179,7 @@ export declare const v4: Elysia<"/v4", false, {
181
179
  total: number;
182
180
  timestamp: bigint;
183
181
  breakdowns: {
184
- id: number;
185
- uuid: string;
182
+ id: string;
186
183
  value: number;
187
184
  campaignId: string;
188
185
  dailyRewardsRecordId: string;
@@ -383,7 +380,7 @@ export declare const v4: Elysia<"/v4", false, {
383
380
  timestamp: string | bigint;
384
381
  cumulated: number;
385
382
  breakdowns: {
386
- id: number;
383
+ id: string;
387
384
  type: "CAMPAIGN" | "TOKEN" | "PROTOCOL";
388
385
  identifier: string;
389
386
  value: number;
@@ -394,7 +391,7 @@ export declare const v4: Elysia<"/v4", false, {
394
391
  total: number;
395
392
  timestamp: string | bigint;
396
393
  breakdowns: {
397
- id: number;
394
+ id: string;
398
395
  type: "TOKEN" | "PROTOCOL";
399
396
  identifier: string;
400
397
  value: number;
@@ -406,7 +403,7 @@ export declare const v4: Elysia<"/v4", false, {
406
403
  total: number;
407
404
  timestamp: string | bigint;
408
405
  breakdowns: {
409
- id: number;
406
+ id: string;
410
407
  token: {
411
408
  price?: number | null | undefined;
412
409
  symbol: string;
@@ -514,7 +511,7 @@ export declare const v4: Elysia<"/v4", false, {
514
511
  timestamp: string | bigint;
515
512
  cumulated: number;
516
513
  breakdowns: {
517
- id: number;
514
+ id: string;
518
515
  type: "CAMPAIGN" | "TOKEN" | "PROTOCOL";
519
516
  identifier: string;
520
517
  value: number;
@@ -525,7 +522,7 @@ export declare const v4: Elysia<"/v4", false, {
525
522
  total: number;
526
523
  timestamp: string | bigint;
527
524
  breakdowns: {
528
- id: number;
525
+ id: string;
529
526
  type: "TOKEN" | "PROTOCOL";
530
527
  identifier: string;
531
528
  value: number;
@@ -537,7 +534,7 @@ export declare const v4: Elysia<"/v4", false, {
537
534
  total: number;
538
535
  timestamp: string | bigint;
539
536
  breakdowns: {
540
- id: number;
537
+ id: string;
541
538
  token: {
542
539
  price?: number | null | undefined;
543
540
  symbol: string;
@@ -679,7 +676,7 @@ export declare const v4: Elysia<"/v4", false, {
679
676
  timestamp: string | bigint;
680
677
  cumulated: number;
681
678
  breakdowns: {
682
- id: number;
679
+ id: string;
683
680
  type: "CAMPAIGN" | "TOKEN" | "PROTOCOL";
684
681
  identifier: string;
685
682
  value: number;
@@ -690,7 +687,7 @@ export declare const v4: Elysia<"/v4", false, {
690
687
  total: number;
691
688
  timestamp: string | bigint;
692
689
  breakdowns: {
693
- id: number;
690
+ id: string;
694
691
  type: "TOKEN" | "PROTOCOL";
695
692
  identifier: string;
696
693
  value: number;
@@ -702,7 +699,7 @@ export declare const v4: Elysia<"/v4", false, {
702
699
  total: number;
703
700
  timestamp: string | bigint;
704
701
  breakdowns: {
705
- id: number;
702
+ id: string;
706
703
  token: {
707
704
  price?: number | null | undefined;
708
705
  symbol: string;
@@ -4458,11 +4455,9 @@ export declare const v4: Elysia<"/v4", false, {
4458
4455
  headers: unknown;
4459
4456
  response: {
4460
4457
  200: {
4461
- id: number;
4458
+ id: string;
4462
4459
  reason: string;
4463
- uuid: string;
4464
4460
  campaignId: string;
4465
- stringId: string;
4466
4461
  boost: number | null;
4467
4462
  }[];
4468
4463
  };
@@ -10,6 +10,7 @@ import { getAddress, parseUnits } from "viem";
10
10
  import { BucketService } from "../bucket/bucket.service";
11
11
  import { CacheService } from "../cache";
12
12
  import { TTLPresets } from "../cache/cache.model";
13
+ import { IconService } from "../icon/icon.service";
13
14
  import { PriceService } from "../price";
14
15
  import { TokenRepository } from "./token.repository";
15
16
  export class TokenService {
@@ -291,9 +292,9 @@ export class TokenService {
291
292
  const bucket = new BucketService(`merkl-${env}-tokens`, `angle-${env}-1`);
292
293
  const properties = body.data.properties;
293
294
  const file = properties["Icon (Required)"].files[0];
294
- const icon = "external" in file ? file.external.url : file.file.url;
295
- const iconFile = await fetch(icon);
296
- const mimeType = iconFile.headers.get("content-type");
295
+ const iconURL = "external" in file ? file.external.url : file.file.url;
296
+ const icon = await fetch(iconURL);
297
+ const mimeType = icon.headers.get("content-type");
297
298
  const extension = mimeType.split("/")[1].split("+")[0];
298
299
  const address = throwOnInvalidRequiredAddress(properties["Address (in checksum format) (Required)"].rich_text[0].plain_text);
299
300
  const chainId = properties["Chain ID (Required)"].number;
@@ -301,7 +302,6 @@ export class TokenService {
301
302
  const displaySymbol = properties["Symbol (Optional)"].rich_text[0]?.plain_text;
302
303
  const isVerified = properties.Verified.checkbox;
303
304
  const coingeckoApiId = properties["CoinGecko API ID (Recommended)"].rich_text[0]?.plain_text;
304
- const byteArray = await iconFile.bytes(); // Unknown type error here probably due to bun/types
305
305
  const [token] = await TokenService.findManyOrCreate([
306
306
  {
307
307
  chainId,
@@ -311,15 +311,12 @@ export class TokenService {
311
311
  if (!token || !token.name)
312
312
  throw new HttpError(`Failed to fetch on-chain data for token ${token?.symbol} (${address} on chainId ${chainId}).`);
313
313
  try {
314
- await bucket.pushRaw(`${chainId}/${address}.${extension}`, byteArray, {
315
- type: mimeType,
316
- isPublic: true,
317
- });
314
+ await IconService.pullPush(iconURL, bucket, { name: `${chainId}/${address}` });
318
315
  token.icon = `${process.env.GCS_ENDPOINT}/merkl-${env}-tokens/${chainId}/${address}.${extension}`;
319
316
  }
320
317
  catch (err) {
321
318
  console.error(err);
322
- token.icon = icon;
319
+ token.icon = iconURL;
323
320
  }
324
321
  if (coingeckoApiId) {
325
322
  try {
@@ -12,9 +12,9 @@ export type TvlRecord = Resource<"TVLRecord", "id" | "opportunityId", {
12
12
  * @description Describes one tvl fraction of record
13
13
  * @see {@link Resource}
14
14
  */
15
- export type TvlBreakdown = Resource<"TVLBreakdown", "id" | "tvlRecordId" | "uuid">;
15
+ export type TvlBreakdown = Resource<"TVLBreakdown", "id" | "tvlRecordId">;
16
16
  export declare const TvlBreakdownResourceDto: import("@sinclair/typebox").TObject<{
17
- id: import("@sinclair/typebox").TNumber;
17
+ id: import("@sinclair/typebox").TString;
18
18
  type: import("@sinclair/typebox").TEnum<{
19
19
  TOKEN: "TOKEN";
20
20
  PROTOCOL: "PROTOCOL";
@@ -27,7 +27,7 @@ export declare const TvlRecordResourceDto: import("@sinclair/typebox").TObject<{
27
27
  total: import("@sinclair/typebox").TNumber;
28
28
  timestamp: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TBigInt, import("@sinclair/typebox").TString]>;
29
29
  breakdowns: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
30
- id: import("@sinclair/typebox").TNumber;
30
+ id: import("@sinclair/typebox").TString;
31
31
  type: import("@sinclair/typebox").TEnum<{
32
32
  TOKEN: "TOKEN";
33
33
  PROTOCOL: "PROTOCOL";
@@ -2,7 +2,7 @@ import { TvlType } from "@db/api";
2
2
  import { t } from "elysia";
3
3
  // ─── Dtos ────────────────────────────────────────────────────────────────────
4
4
  export const TvlBreakdownResourceDto = t.Object({
5
- id: t.Number(),
5
+ id: t.String(),
6
6
  type: t.Enum(TvlType),
7
7
  identifier: t.String(),
8
8
  value: t.Number(),
@@ -1,10 +1,4 @@
1
1
  import { type Elysia } from "elysia";
2
- export declare const response: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
3
- address: import("@sinclair/typebox").TString;
4
- asset: import("@sinclair/typebox").TString;
5
- chaind: import("@sinclair/typebox").TNumber;
6
- debtTokenAddress: import("@sinclair/typebox").TString;
7
- }>>;
8
2
  declare const _default: (app: Elysia) => Elysia<"", false, {
9
3
  decorator: {};
10
4
  store: {};
@@ -1,9 +1,9 @@
1
- import { getEulerV2VaultsWithCache, updateEulerVaultsCollatInDatabase, } from "@/engine/dynamicData/utils/getEulerV2Vaults";
1
+ import { Redis } from "@/cache";
2
+ import { getEulerV2Vaults, updateEulerVaultsCollatInDatabase } from "@/engine/dynamicData/utils/getEulerV2Vaults";
2
3
  import { t } from "elysia";
3
- export const response = t.Array(t.Object({ address: t.String(), asset: t.String(), chaind: t.Number(), debtTokenAddress: t.String() }));
4
4
  export default (app) => app
5
5
  .get("/euler", async () => {
6
- return await getEulerV2VaultsWithCache();
6
+ return await Redis.getOrSet("EulerV2Vaults", getEulerV2Vaults);
7
7
  }, {
8
8
  query: t.Object({}),
9
9
  tags: ["euler"],