@merkl/api 0.20.168 → 0.20.169

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.
@@ -77,29 +77,25 @@ export declare const OpportunityResourceDto: import("@sinclair/typebox").TObject
77
77
  cumulated: import("@sinclair/typebox").TNumber;
78
78
  timestamp: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TBigInt, import("@sinclair/typebox").TString]>;
79
79
  breakdowns: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
80
- id: import("@sinclair/typebox").TString;
80
+ identifier: import("@sinclair/typebox").TString;
81
81
  type: import("@sinclair/typebox").TEnum<{
82
82
  CAMPAIGN: "CAMPAIGN";
83
83
  TOKEN: "TOKEN";
84
84
  PROTOCOL: "PROTOCOL";
85
85
  }>;
86
- identifier: import("@sinclair/typebox").TString;
87
86
  value: import("@sinclair/typebox").TNumber;
88
- aprRecordId: import("@sinclair/typebox").TString;
89
87
  }>>;
90
88
  }>>;
91
89
  tvlRecord: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
92
90
  total: import("@sinclair/typebox").TNumber;
93
91
  timestamp: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TBigInt, import("@sinclair/typebox").TString]>;
94
92
  breakdowns: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
95
- id: import("@sinclair/typebox").TString;
93
+ identifier: import("@sinclair/typebox").TString;
96
94
  type: import("@sinclair/typebox").TEnum<{
97
95
  TOKEN: "TOKEN";
98
96
  PROTOCOL: "PROTOCOL";
99
97
  }>;
100
- identifier: import("@sinclair/typebox").TString;
101
98
  value: import("@sinclair/typebox").TNumber;
102
- tvlRecordId: import("@sinclair/typebox").TString;
103
99
  }>>;
104
100
  }>>;
105
101
  rewardsRecord: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
@@ -193,29 +189,25 @@ export declare const OpportunityWithCampaignsResourceDto: import("@sinclair/type
193
189
  cumulated: import("@sinclair/typebox").TNumber;
194
190
  timestamp: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TBigInt, import("@sinclair/typebox").TString]>;
195
191
  breakdowns: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
196
- id: import("@sinclair/typebox").TString;
192
+ identifier: import("@sinclair/typebox").TString;
197
193
  type: import("@sinclair/typebox").TEnum<{
198
194
  CAMPAIGN: "CAMPAIGN";
199
195
  TOKEN: "TOKEN";
200
196
  PROTOCOL: "PROTOCOL";
201
197
  }>;
202
- identifier: import("@sinclair/typebox").TString;
203
198
  value: import("@sinclair/typebox").TNumber;
204
- aprRecordId: import("@sinclair/typebox").TString;
205
199
  }>>;
206
200
  }>>;
207
201
  tvlRecord: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
208
202
  total: import("@sinclair/typebox").TNumber;
209
203
  timestamp: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TBigInt, import("@sinclair/typebox").TString]>;
210
204
  breakdowns: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
211
- id: import("@sinclair/typebox").TString;
205
+ identifier: import("@sinclair/typebox").TString;
212
206
  type: import("@sinclair/typebox").TEnum<{
213
207
  TOKEN: "TOKEN";
214
208
  PROTOCOL: "PROTOCOL";
215
209
  }>;
216
- identifier: import("@sinclair/typebox").TString;
217
210
  value: import("@sinclair/typebox").TNumber;
218
- tvlRecordId: import("@sinclair/typebox").TString;
219
211
  }>>;
220
212
  }>>;
221
213
  rewardsRecord: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
@@ -347,10 +347,8 @@ export declare abstract class OpportunityService {
347
347
  cumulated: number;
348
348
  breakdowns: {
349
349
  type: "CAMPAIGN" | "TOKEN" | "PROTOCOL";
350
- id: string;
351
350
  identifier: string;
352
351
  value: number;
353
- aprRecordId: string;
354
352
  }[];
355
353
  } | undefined;
356
354
  tvlRecord?: {
@@ -358,10 +356,8 @@ export declare abstract class OpportunityService {
358
356
  timestamp: string | bigint;
359
357
  breakdowns: {
360
358
  type: "TOKEN" | "PROTOCOL";
361
- id: string;
362
359
  identifier: string;
363
360
  value: number;
364
- tvlRecordId: string;
365
361
  }[];
366
362
  } | undefined;
367
363
  rewardsRecord?: {
@@ -495,10 +491,8 @@ export declare abstract class OpportunityService {
495
491
  cumulated: number;
496
492
  breakdowns: {
497
493
  type: "CAMPAIGN" | "TOKEN" | "PROTOCOL";
498
- id: string;
499
494
  identifier: string;
500
495
  value: number;
501
- aprRecordId: string;
502
496
  }[];
503
497
  } | undefined;
504
498
  tvlRecord?: {
@@ -506,10 +500,8 @@ export declare abstract class OpportunityService {
506
500
  timestamp: string | bigint;
507
501
  breakdowns: {
508
502
  type: "TOKEN" | "PROTOCOL";
509
- id: string;
510
503
  identifier: string;
511
504
  value: number;
512
- tvlRecordId: string;
513
505
  }[];
514
506
  } | undefined;
515
507
  rewardsRecord?: {
@@ -626,7 +618,7 @@ export declare abstract class OpportunityService {
626
618
  };
627
619
  }[];
628
620
  }>;
629
- static getUniqueOrThrow(opportunityId: string | OpportunityUnique, withTest?: boolean, withPoints?: boolean): Promise<OpportunityResourceModel>;
621
+ static findUniqueOrThrow(opportunityId: string | OpportunityUnique, withTest?: boolean, withPoints?: boolean): Promise<OpportunityResourceModel>;
630
622
  /**
631
623
  * Get the list of opportunities satisfying the query
632
624
  * @param query
@@ -192,7 +192,7 @@ export class OpportunityService {
192
192
  const opportunity = await OpportunityRepository.findUniqueOrThrow(id, withTest, withTest ? withTest : withPoints, true);
193
193
  return OpportunityService.formatResponse(opportunity);
194
194
  }
195
- static async getUniqueOrThrow(opportunityId, withTest = false, withPoints = false) {
195
+ static async findUniqueOrThrow(opportunityId, withTest = false, withPoints = false) {
196
196
  const id = typeof opportunityId === "string" ? opportunityId : OpportunityService.hashId(opportunityId);
197
197
  const opportunity = await OpportunityRepository.findUniqueOrThrow(id, withTest, withTest ? withTest : withPoints);
198
198
  return OpportunityService.formatResponse(opportunity);
@@ -194,6 +194,9 @@ export class ProgramPayloadService {
194
194
  const totalAmount = Object.values(body).reduce((sum, amount) => sum + BigInt(amount), 0n);
195
195
  const minimumAmountPerHour = await ProgramPayloadService.getMinimumAmount(query.rewardToken, query.distributionChainId);
196
196
  const numberOfHours = (BigInt(query.endTimestamp) - BigInt(query.startTimestamp)) / 3600n;
197
+ if (numberOfHours < 1n) {
198
+ throw new Error("Duration is less than 1 hour");
199
+ }
197
200
  if (!minimumAmountPerHour) {
198
201
  throw new Error("Token not found");
199
202
  }