@merkl/api 0.19.28 → 0.19.30

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.
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "prisma-client-842a82af94b845e9a454c9ffa27bcbc996a240638fa2aaa44c3d8222e1d1f139",
2
+ "name": "prisma-client-89044a06b757b61d6512ccc35177e2e669c5861f63b5ed81f474812c9058bea8",
3
3
  "main": "index.js",
4
4
  "types": "index.d.ts",
5
5
  "browser": "index-browser.js",
@@ -73,7 +73,7 @@ model CampaignComputedValue {
73
73
  }
74
74
 
75
75
  model UserComputedValue {
76
- id Int @id @default(autoincrement())
76
+ id Int @id @default(autoincrement()) // TODO Migrate to something smarter than Int ids
77
77
  campaignId String
78
78
  Campaign Campaign @relation(fields: [campaignId], references: [id])
79
79
  address String @db.Char(42)
@@ -193,7 +193,7 @@ model AprRecord {
193
193
  }
194
194
 
195
195
  model AprBreakdown {
196
- id Int @id @default(autoincrement())
196
+ id Int @id @default(autoincrement()) // TODO Migrate to something smarter than Int ids
197
197
  identifier String
198
198
  type AprType
199
199
  value Float
@@ -217,7 +217,7 @@ model TVLRecord {
217
217
  }
218
218
 
219
219
  model TVLBreakdown {
220
- id Int @id @default(autoincrement())
220
+ id Int @id @default(autoincrement()) // TODO Migrate to something smarter than Int ids
221
221
  identifier String
222
222
  type TvlType
223
223
  value Float
@@ -242,7 +242,7 @@ model DailyRewardsRecord {
242
242
  }
243
243
 
244
244
  model DailyRewardsBreakdown {
245
- id Int @id @default(autoincrement())
245
+ id Int @id @default(autoincrement()) // TODO Migrate to something smarter than Int ids
246
246
  value Float
247
247
  campaignId String
248
248
  Campaign Campaign @relation(fields: [campaignId], references: [id])
@@ -292,7 +292,7 @@ model Reward {
292
292
  }
293
293
 
294
294
  model RewardBreakdown {
295
- id Int @id @default(autoincrement())
295
+ id BigInt @id @default(autoincrement())
296
296
  Protocol Protocol? @relation(fields: [protocolId], references: [id])
297
297
  protocolId String?
298
298
  reason String
@@ -1,4 +1,4 @@
1
- import type { ChainId } from "@sdk";
1
+ import { type ChainId } from "@sdk";
2
2
  import type { CreateRootModel, RootByTimestampModel } from "./merklRoot.model";
3
3
  export declare class MerklRootService {
4
4
  static firstRoot(chainId: ChainId): Promise<{
@@ -18,13 +18,7 @@ export declare class MerklRootService {
18
18
  * @param chainId to fetch roots for
19
19
  * @returns object with live and last tree roots
20
20
  */
21
- static fetch(chainId: ChainId): Promise<{
22
- live: any;
23
- tree: any;
24
- lastTree: any;
25
- endOfDisputePeriod: any;
26
- disputer: any;
27
- }>;
21
+ static fetch(chainId: ChainId): Promise<any>;
28
22
  /**
29
23
  * Fetch all roots for the provided chains
30
24
  * @param chainIds to fetch roots for
@@ -1,3 +1,5 @@
1
+ import { log } from "@/utils/logger";
2
+ import { NETWORK_LABELS, withTimeout } from "@sdk";
1
3
  import { CacheService } from "../cache";
2
4
  import { TTLPresets } from "../cache/cache.model";
3
5
  import { ChainService } from "../chain/chain.service";
@@ -15,7 +17,17 @@ export class MerklRootService {
15
17
  * @returns object with live and last tree roots
16
18
  */
17
19
  static async fetch(chainId) {
18
- return await CacheService.wrap(TTLPresets.MIN_1, MerklRootRepository.fetch, chainId);
20
+ try {
21
+ return await withTimeout(CacheService.wrap(TTLPresets.MIN_1, MerklRootRepository.fetch, chainId), 5_000);
22
+ }
23
+ catch (e) {
24
+ if (e.message === "Timed out after 3000ms") {
25
+ const errorMessage = `fetching Merkle Root for chain ${NETWORK_LABELS[chainId]} timed out`;
26
+ log.warn(errorMessage);
27
+ throw new Error(errorMessage);
28
+ }
29
+ throw e;
30
+ }
19
31
  }
20
32
  /**
21
33
  * Fetch all roots for the provided chains
@@ -77,7 +77,7 @@ export declare abstract class RewardRepository {
77
77
  };
78
78
  } & {
79
79
  pending: string;
80
- id: number;
80
+ id: bigint;
81
81
  reason: string;
82
82
  campaignId: string;
83
83
  amount: string;
@@ -102,7 +102,7 @@ export declare abstract class RewardRepository {
102
102
  };
103
103
  } & {
104
104
  pending: string;
105
- id: number;
105
+ id: bigint;
106
106
  reason: string;
107
107
  campaignId: string;
108
108
  amount: string;
@@ -234,7 +234,7 @@ export declare abstract class RewardService {
234
234
  };
235
235
  } & {
236
236
  pending: string;
237
- id: number;
237
+ id: bigint;
238
238
  reason: string;
239
239
  campaignId: string;
240
240
  amount: string;
@@ -535,7 +535,7 @@ export declare abstract class RewardService {
535
535
  };
536
536
  } & {
537
537
  pending: string;
538
- id: number;
538
+ id: bigint;
539
539
  reason: string;
540
540
  campaignId: string;
541
541
  amount: string;