@merkl/api 1.0.46 → 1.0.48

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.
@@ -1258,90 +1258,6 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", {
1258
1258
  };
1259
1259
  };
1260
1260
  };
1261
- } & {
1262
- opportunities: {
1263
- post: {
1264
- body: {
1265
- name?: string | undefined;
1266
- description?: string | undefined;
1267
- depositUrl?: string | undefined;
1268
- explorerAddress?: string | undefined;
1269
- howToSteps?: string[] | undefined;
1270
- tags?: string[] | undefined;
1271
- protocols?: string[] | undefined;
1272
- mainProtocol?: string | undefined;
1273
- tokens: {
1274
- address: string;
1275
- chainId: number;
1276
- }[];
1277
- status: "NONE" | "PAST" | "LIVE" | "SOON";
1278
- chainId: number;
1279
- action: "POOL" | "INVALID" | "HOLD" | "DROP" | "LEND" | "BORROW" | "LONG" | "SHORT" | "SWAP";
1280
- type: string;
1281
- identifier: string;
1282
- };
1283
- params: {};
1284
- query: unknown;
1285
- headers: {
1286
- authorization: string;
1287
- };
1288
- response: {
1289
- 200: {
1290
- Tokens: {
1291
- symbol: string;
1292
- name: string | null;
1293
- decimals: number;
1294
- price: number | null;
1295
- address: string;
1296
- id: string;
1297
- chainId: number;
1298
- icon: string;
1299
- isNative: boolean;
1300
- isPoint: boolean;
1301
- isPreTGE: boolean;
1302
- isTest: boolean;
1303
- verified: boolean;
1304
- displaySymbol: string;
1305
- }[];
1306
- Protocols: {
1307
- name: string;
1308
- description: string;
1309
- id: string;
1310
- url: string;
1311
- icon: string;
1312
- tags: string[];
1313
- }[];
1314
- name: string;
1315
- apr: number;
1316
- tvl: number;
1317
- description: string;
1318
- id: string;
1319
- status: import("@package/databases").Status;
1320
- chainId: number;
1321
- action: import("@package/databases").OpportunityAction;
1322
- type: string;
1323
- depositUrl: string | null;
1324
- explorerAddress: string | null;
1325
- howToSteps: string[];
1326
- mainProtocolId: string | null;
1327
- manualOverrides: import("@package/databases").OpportunityManualOverride[];
1328
- identifier: string;
1329
- dailyRewards: number;
1330
- tags: string[];
1331
- lastCampaignCreatedAt: Date;
1332
- };
1333
- 422: {
1334
- type: "validation";
1335
- on: string;
1336
- summary?: string;
1337
- message?: string;
1338
- found?: unknown;
1339
- property?: string;
1340
- expected?: string;
1341
- };
1342
- };
1343
- };
1344
- };
1345
1261
  } & {
1346
1262
  opportunities: {
1347
1263
  ":id": {
@@ -11624,85 +11540,6 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", {
11624
11540
  }>>;
11625
11541
  }) & {};
11626
11542
  };
11627
- post: (body: {
11628
- name?: string | undefined;
11629
- description?: string | undefined;
11630
- depositUrl?: string | undefined;
11631
- explorerAddress?: string | undefined;
11632
- howToSteps?: string[] | undefined;
11633
- tags?: string[] | undefined;
11634
- protocols?: string[] | undefined;
11635
- mainProtocol?: string | undefined;
11636
- tokens: {
11637
- address: string;
11638
- chainId: number;
11639
- }[];
11640
- status: "NONE" | "PAST" | "LIVE" | "SOON";
11641
- chainId: number;
11642
- action: "POOL" | "INVALID" | "HOLD" | "DROP" | "LEND" | "BORROW" | "LONG" | "SHORT" | "SWAP";
11643
- type: string;
11644
- identifier: string;
11645
- }, options: {
11646
- headers: {
11647
- authorization: string;
11648
- };
11649
- query?: Record<string, unknown> | undefined;
11650
- fetch?: RequestInit | undefined;
11651
- }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
11652
- 200: {
11653
- Tokens: {
11654
- symbol: string;
11655
- name: string | null;
11656
- decimals: number;
11657
- price: number | null;
11658
- address: string;
11659
- id: string;
11660
- chainId: number;
11661
- icon: string;
11662
- isNative: boolean;
11663
- isPoint: boolean;
11664
- isPreTGE: boolean;
11665
- isTest: boolean;
11666
- verified: boolean;
11667
- displaySymbol: string;
11668
- }[];
11669
- Protocols: {
11670
- name: string;
11671
- description: string;
11672
- id: string;
11673
- url: string;
11674
- icon: string;
11675
- tags: string[];
11676
- }[];
11677
- name: string;
11678
- apr: number;
11679
- tvl: number;
11680
- description: string;
11681
- id: string;
11682
- status: import("@package/databases").Status;
11683
- chainId: number;
11684
- action: import("@package/databases").OpportunityAction;
11685
- type: string;
11686
- depositUrl: string | null;
11687
- explorerAddress: string | null;
11688
- howToSteps: string[];
11689
- mainProtocolId: string | null;
11690
- manualOverrides: import("@package/databases").OpportunityManualOverride[];
11691
- identifier: string;
11692
- dailyRewards: number;
11693
- tags: string[];
11694
- lastCampaignCreatedAt: Date;
11695
- };
11696
- 422: {
11697
- type: "validation";
11698
- on: string;
11699
- summary?: string;
11700
- message?: string;
11701
- found?: unknown;
11702
- property?: string;
11703
- expected?: string;
11704
- };
11705
- }>>;
11706
11543
  };
11707
11544
  campaigns: ((params: {
11708
11545
  id: string | number;
@@ -1259,90 +1259,6 @@ declare const app: Elysia<"", {
1259
1259
  };
1260
1260
  };
1261
1261
  };
1262
- } & {
1263
- opportunities: {
1264
- post: {
1265
- body: {
1266
- name?: string | undefined;
1267
- description?: string | undefined;
1268
- depositUrl?: string | undefined;
1269
- explorerAddress?: string | undefined;
1270
- howToSteps?: string[] | undefined;
1271
- tags?: string[] | undefined;
1272
- protocols?: string[] | undefined;
1273
- mainProtocol?: string | undefined;
1274
- tokens: {
1275
- address: string;
1276
- chainId: number;
1277
- }[];
1278
- status: "NONE" | "PAST" | "LIVE" | "SOON";
1279
- chainId: number;
1280
- action: "POOL" | "INVALID" | "HOLD" | "DROP" | "LEND" | "BORROW" | "LONG" | "SHORT" | "SWAP";
1281
- type: string;
1282
- identifier: string;
1283
- };
1284
- params: {};
1285
- query: unknown;
1286
- headers: {
1287
- authorization: string;
1288
- };
1289
- response: {
1290
- 200: {
1291
- Tokens: {
1292
- symbol: string;
1293
- name: string | null;
1294
- decimals: number;
1295
- price: number | null;
1296
- address: string;
1297
- id: string;
1298
- chainId: number;
1299
- icon: string;
1300
- isNative: boolean;
1301
- isPoint: boolean;
1302
- isPreTGE: boolean;
1303
- isTest: boolean;
1304
- verified: boolean;
1305
- displaySymbol: string;
1306
- }[];
1307
- Protocols: {
1308
- name: string;
1309
- description: string;
1310
- id: string;
1311
- url: string;
1312
- icon: string;
1313
- tags: string[];
1314
- }[];
1315
- name: string;
1316
- apr: number;
1317
- tvl: number;
1318
- description: string;
1319
- id: string;
1320
- status: import("@package/databases").Status;
1321
- chainId: number;
1322
- action: import("@package/databases").OpportunityAction;
1323
- type: string;
1324
- depositUrl: string | null;
1325
- explorerAddress: string | null;
1326
- howToSteps: string[];
1327
- mainProtocolId: string | null;
1328
- manualOverrides: import("@package/databases").OpportunityManualOverride[];
1329
- identifier: string;
1330
- dailyRewards: number;
1331
- tags: string[];
1332
- lastCampaignCreatedAt: Date;
1333
- };
1334
- 422: {
1335
- type: "validation";
1336
- on: string;
1337
- summary?: string;
1338
- message?: string;
1339
- found?: unknown;
1340
- property?: string;
1341
- expected?: string;
1342
- };
1343
- };
1344
- };
1345
- };
1346
1262
  } & {
1347
1263
  opportunities: {
1348
1264
  ":id": {
@@ -0,0 +1,6 @@
1
+ import type { CampaignParameters, Campaign as CampaignType } from "@angleprotocol/sdk/ts";
2
+ import type { CampaignWithParams } from "../../../modules/v4/campaign/campaign.model";
3
+ import type { OpportunityService } from "../../../modules/v4/opportunity/opportunity.service";
4
+ export declare abstract class CampaignConvertor {
5
+ static convertToV3<C extends CampaignType>(campaignType: C, campaign: Exclude<Awaited<ReturnType<(typeof OpportunityService)["findMany"]>>[number]["campaigns"], undefined>[number] | Omit<CampaignWithParams<C>, "manualOverrides">, opportunityIdentifier: string): CampaignParameters<C>;
6
+ }
@@ -0,0 +1,84 @@
1
+ import type { CampaignRepository } from "./campaign.repository";
2
+ export declare abstract class CampaignFormatter {
3
+ static format(campaign: NonNullable<Awaited<ReturnType<(typeof CampaignRepository)["findMany"]>>>[number]): {
4
+ params: any;
5
+ chain: {
6
+ name: string;
7
+ id: number;
8
+ icon: string;
9
+ };
10
+ endTimestamp: number;
11
+ startTimestamp: number;
12
+ rewardToken: {
13
+ symbol: string;
14
+ name: string | null;
15
+ decimals: number;
16
+ address: string;
17
+ id: string;
18
+ chainId: number;
19
+ icon: string;
20
+ isNative: boolean;
21
+ isPoint: boolean;
22
+ isPreTGE: boolean;
23
+ isTest: boolean;
24
+ verified: boolean;
25
+ } & {
26
+ price?: number | null | undefined;
27
+ isTokenWrapper?: boolean | undefined;
28
+ tokenWrapperAddress?: string | undefined;
29
+ };
30
+ distributionChain: {
31
+ name: string;
32
+ id: number;
33
+ icon: string;
34
+ } | undefined;
35
+ campaignStatus: {
36
+ computedUntil: number;
37
+ processingStarted: number;
38
+ campaignId: string;
39
+ error: string;
40
+ status: import("@package/databases").RunStatus;
41
+ details: import("@prisma/client/runtime/library").JsonValue;
42
+ } | undefined;
43
+ creatorAddress: string;
44
+ creator: {
45
+ address: string;
46
+ tags: string[];
47
+ creatorId: string | null;
48
+ };
49
+ createdAt: string;
50
+ description: string | undefined;
51
+ parentCampaignId: string | undefined;
52
+ rootCampaignId: string | undefined;
53
+ Opportunity: {
54
+ name: string;
55
+ apr: number;
56
+ tvl: number;
57
+ description: string;
58
+ id: string;
59
+ status: import("@package/databases").Status;
60
+ chainId: number;
61
+ action: import("@package/databases").OpportunityAction;
62
+ type: string;
63
+ depositUrl: string | null;
64
+ explorerAddress: string | null;
65
+ howToSteps: string[];
66
+ mainProtocolId: string | null;
67
+ manualOverrides: import("@package/databases").OpportunityManualOverride[];
68
+ identifier: string;
69
+ dailyRewards: number;
70
+ tags: string[];
71
+ lastCampaignCreatedAt: Date;
72
+ };
73
+ campaignId: string;
74
+ id: string;
75
+ amount: string;
76
+ type: string;
77
+ computeChainId: number;
78
+ distributionChainId: number;
79
+ opportunityId: string;
80
+ distributionType: import("@package/databases").DistributionType;
81
+ subType: number | null;
82
+ rewardTokenId: string;
83
+ };
84
+ }
@@ -172,7 +172,7 @@ export declare const UpdateMetaDataCampaignDto: import("@sinclair/typebox").TObj
172
172
  campaignId: import("@sinclair/typebox").TString;
173
173
  url: import("@sinclair/typebox").TString;
174
174
  }>;
175
- export declare const GetCampaignQueryDto: import("@sinclair/typebox").TObject<{
175
+ export declare const FindCampaignDto: import("@sinclair/typebox").TObject<{
176
176
  id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
177
177
  creatorTag: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
178
178
  creatorAddress: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
@@ -218,8 +218,11 @@ export type UpdateMetaDataCampaignModel = typeof UpdateMetaDataCampaignDto.stati
218
218
  url: string;
219
219
  };
220
220
  export type TransactionModel = typeof TransactionDto.static;
221
- export type extendedUpdateCampaignModel = UpdateCampaignModel & {
222
- opportunityId: string;
223
- };
224
- export type GetCampaignQueryModel = typeof GetCampaignQueryDto.static;
221
+ export type FindCampaignModel = typeof FindCampaignDto.static;
222
+ export type findCampaignWithStatusModel = Partial<{
223
+ computeChainId: number;
224
+ distributionChainId: number;
225
+ type: string;
226
+ creatorAddress: string;
227
+ }>;
225
228
  export type CampaignConfigMinimalModel = typeof CampaignConfigMinimal.static;
@@ -1,8 +1,8 @@
1
1
  import { type ChainId } from "@angleprotocol/sdk/ts";
2
2
  import { type CampaignManualOverride } from "@package/databases/api";
3
- import type { Campaign, CampaignUnique, CampaignWithParams, GetCampaignQueryModel } from "../../../modules/v4/campaign/campaign.model";
3
+ import type { Campaign, CampaignUnique, CampaignWithParams, FindCampaignModel, findCampaignWithStatusModel } from "../../../modules/v4/campaign/campaign.model";
4
4
  export declare abstract class CampaignRepository {
5
- static transformQueryToPrismaFilters(query: Omit<GetCampaignQueryModel, "page" | "items">): {
5
+ static transformQueryToPrismaFilters(query: Omit<FindCampaignModel, "page" | "items">): {
6
6
  where: {
7
7
  createdAt: {
8
8
  gte: Date;
@@ -358,12 +358,7 @@ export declare abstract class CampaignRepository {
358
358
  *
359
359
  * @dev Excludes test campaigns
360
360
  */
361
- static getPastCampaigns(query?: {
362
- computeChainId?: number;
363
- type?: string;
364
- creatorId?: string;
365
- creatorAddress?: string;
366
- }): Promise<({
361
+ static getPastCampaigns(query?: findCampaignWithStatusModel): Promise<({
367
362
  Opportunity: {
368
363
  name: string;
369
364
  apr: number;
@@ -413,12 +408,7 @@ export declare abstract class CampaignRepository {
413
408
  *
414
409
  * @dev Excludes test campaigns
415
410
  */
416
- static getFutureCampaigns(query?: {
417
- computeChainId?: number;
418
- type?: string;
419
- creatorId?: string;
420
- creatorAddress?: string;
421
- }): Promise<({
411
+ static getFutureCampaigns(query?: findCampaignWithStatusModel): Promise<({
422
412
  Opportunity: {
423
413
  name: string;
424
414
  apr: number;
@@ -468,13 +458,7 @@ export declare abstract class CampaignRepository {
468
458
  *
469
459
  * @dev Excludes test campaigns
470
460
  */
471
- static getLiveCampaigns(query?: {
472
- distributionChainId?: number;
473
- computeChainId?: number;
474
- type?: string;
475
- creatorId?: string;
476
- creatorAddress?: string;
477
- }): Promise<({
461
+ static getLiveCampaigns(query?: findCampaignWithStatusModel): Promise<({
478
462
  RewardToken: {
479
463
  symbol: string;
480
464
  name: string | null;
@@ -554,11 +538,7 @@ export declare abstract class CampaignRepository {
554
538
  rootCampaignId: string | null;
555
539
  parentCampaignId: string | null;
556
540
  })[]>;
557
- static countLives(query?: {
558
- distributionChainId?: number;
559
- computeChainId?: number;
560
- type?: string;
561
- }, includeSubCampaigns?: boolean): Promise<number>;
541
+ static countLives(query?: findCampaignWithStatusModel, includeSubCampaigns?: boolean): Promise<number>;
562
542
  /**
563
543
  * Upserts a campaign in the database. If the campaign already exists, it updates the existing record;
564
544
  * otherwise, it creates a new one.
@@ -771,7 +751,7 @@ export declare abstract class CampaignRepository {
771
751
  processingStarted: bigint;
772
752
  }[];
773
753
  }[]>;
774
- static findMany(query: GetCampaignQueryModel): Promise<({
754
+ static findMany(query: FindCampaignModel): Promise<({
775
755
  ComputeChain: {
776
756
  name: string;
777
757
  id: number;
@@ -852,7 +832,7 @@ export declare abstract class CampaignRepository {
852
832
  rootCampaignId: string | null;
853
833
  parentCampaignId: string | null;
854
834
  })[]>;
855
- static findFirst(query: Omit<GetCampaignQueryModel, "page" | "items">): Promise<({
835
+ static findFirst(query: Omit<FindCampaignModel, "page" | "items">): Promise<({
856
836
  ComputeChain: {
857
837
  name: string;
858
838
  id: number;
@@ -933,7 +913,7 @@ export declare abstract class CampaignRepository {
933
913
  rootCampaignId: string | null;
934
914
  parentCampaignId: string | null;
935
915
  }) | null>;
936
- static countMany(query: Omit<GetCampaignQueryModel, "page" | "items">): Promise<number>;
916
+ static countMany(query: Omit<FindCampaignModel, "page" | "items">): Promise<number>;
937
917
  static findChains(): Promise<Record<string, ChainId>>;
938
918
  static addManualOverride(id: string, field: CampaignManualOverride): Promise<void>;
939
919
  static removeManualOverride(id: string, field: CampaignManualOverride): Promise<void>;