@merkl/api 0.21.2 → 0.21.3

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-24907169b43f344bde6ac20175605e498a6fb5eda95173ac3ce0f4aabbd74a8a",
2
+ "name": "prisma-client-6cac236bc33c091ad7bbf269867a230554156600fd1cccb97855a48ad1719a85",
3
3
  "main": "index.js",
4
4
  "types": "index.d.ts",
5
5
  "browser": "index-browser.js",
@@ -280,10 +280,11 @@ model User {
280
280
  }
281
281
 
282
282
  model Creator {
283
- id String @id
284
- icon String?
285
- name String
286
- Users User[]
283
+ id String @id
284
+ icon String?
285
+ name String
286
+ rebateFee Int @default(0)
287
+ Users User[]
287
288
  }
288
289
 
289
290
  model Reward {
@@ -281,7 +281,8 @@ exports.Prisma.UserScalarFieldEnum = {
281
281
  exports.Prisma.CreatorScalarFieldEnum = {
282
282
  id: 'id',
283
283
  icon: 'icon',
284
- name: 'name'
284
+ name: 'name',
285
+ rebateFee: 'rebateFee'
285
286
  };
286
287
 
287
288
  exports.Prisma.RewardScalarFieldEnum = {
@@ -3354,6 +3354,7 @@ declare const eden: {
3354
3354
  id: string;
3355
3355
  addresses: string[];
3356
3356
  icon?: string | undefined;
3357
+ rebateFee?: number | undefined;
3357
3358
  } | null;
3358
3359
  }>>;
3359
3360
  };
@@ -4510,6 +4511,7 @@ declare const eden: {
4510
4511
  id: string;
4511
4512
  addresses: string[];
4512
4513
  icon?: string | undefined;
4514
+ rebateFee?: number | undefined;
4513
4515
  };
4514
4516
  }>>;
4515
4517
  patch: (body: {
@@ -4527,8 +4529,27 @@ declare const eden: {
4527
4529
  name: string;
4528
4530
  id: string;
4529
4531
  icon: string | null;
4532
+ rebateFee: number;
4530
4533
  };
4531
4534
  }>>;
4535
+ rebate: {
4536
+ patch: (body: {
4537
+ rebate: number;
4538
+ }, options: {
4539
+ headers: {
4540
+ authorization: string;
4541
+ };
4542
+ query?: Record<string, unknown> | undefined;
4543
+ fetch?: RequestInit | undefined;
4544
+ }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
4545
+ 200: {
4546
+ name: string;
4547
+ id: string;
4548
+ icon: string | null;
4549
+ rebateFee: number;
4550
+ };
4551
+ }>>;
4552
+ };
4532
4553
  }) & {
4533
4554
  index: {
4534
4555
  get: (options: {
@@ -4546,10 +4567,12 @@ declare const eden: {
4546
4567
  addresses: string[];
4547
4568
  } & {
4548
4569
  icon?: string | undefined;
4570
+ rebateFee?: number | undefined;
4549
4571
  })[];
4550
4572
  }>>;
4551
4573
  post: (body: {
4552
4574
  icon?: string | undefined;
4575
+ rebateFee?: number | undefined;
4553
4576
  name: string;
4554
4577
  id: string;
4555
4578
  addresses: string[];
@@ -4564,6 +4587,7 @@ declare const eden: {
4564
4587
  name: string;
4565
4588
  id: string;
4566
4589
  icon: string | null;
4590
+ rebateFee: number;
4567
4591
  };
4568
4592
  }>>;
4569
4593
  };
@@ -9493,6 +9517,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
9493
9517
  id: string;
9494
9518
  addresses: string[];
9495
9519
  icon?: string | undefined;
9520
+ rebateFee?: number | undefined;
9496
9521
  } | null;
9497
9522
  };
9498
9523
  };
@@ -10900,6 +10925,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
10900
10925
  addresses: string[];
10901
10926
  } & {
10902
10927
  icon?: string | undefined;
10928
+ rebateFee?: number | undefined;
10903
10929
  })[];
10904
10930
  };
10905
10931
  };
@@ -10921,6 +10947,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
10921
10947
  id: string;
10922
10948
  addresses: string[];
10923
10949
  icon?: string | undefined;
10950
+ rebateFee?: number | undefined;
10924
10951
  };
10925
10952
  };
10926
10953
  };
@@ -10932,6 +10959,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
10932
10959
  post: {
10933
10960
  body: {
10934
10961
  icon?: string | undefined;
10962
+ rebateFee?: number | undefined;
10935
10963
  name: string;
10936
10964
  id: string;
10937
10965
  addresses: string[];
@@ -10946,6 +10974,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
10946
10974
  name: string;
10947
10975
  id: string;
10948
10976
  icon: string | null;
10977
+ rebateFee: number;
10949
10978
  };
10950
10979
  };
10951
10980
  };
@@ -10972,6 +11001,34 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
10972
11001
  name: string;
10973
11002
  id: string;
10974
11003
  icon: string | null;
11004
+ rebateFee: number;
11005
+ };
11006
+ };
11007
+ };
11008
+ };
11009
+ };
11010
+ } & {
11011
+ creators: {
11012
+ ":id": {
11013
+ rebate: {
11014
+ patch: {
11015
+ body: {
11016
+ rebate: number;
11017
+ };
11018
+ params: {
11019
+ id: string;
11020
+ };
11021
+ query: unknown;
11022
+ headers: {
11023
+ authorization: string;
11024
+ };
11025
+ response: {
11026
+ 200: {
11027
+ name: string;
11028
+ id: string;
11029
+ icon: string | null;
11030
+ rebateFee: number;
11031
+ };
10975
11032
  };
10976
11033
  };
10977
11034
  };
@@ -15405,6 +15462,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
15405
15462
  id: string;
15406
15463
  addresses: string[];
15407
15464
  icon?: string | undefined;
15465
+ rebateFee?: number | undefined;
15408
15466
  } | null;
15409
15467
  }>>;
15410
15468
  };
@@ -16561,6 +16619,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
16561
16619
  id: string;
16562
16620
  addresses: string[];
16563
16621
  icon?: string | undefined;
16622
+ rebateFee?: number | undefined;
16564
16623
  };
16565
16624
  }>>;
16566
16625
  patch: (body: {
@@ -16578,8 +16637,27 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
16578
16637
  name: string;
16579
16638
  id: string;
16580
16639
  icon: string | null;
16640
+ rebateFee: number;
16581
16641
  };
16582
16642
  }>>;
16643
+ rebate: {
16644
+ patch: (body: {
16645
+ rebate: number;
16646
+ }, options: {
16647
+ headers: {
16648
+ authorization: string;
16649
+ };
16650
+ query?: Record<string, unknown> | undefined;
16651
+ fetch?: RequestInit | undefined;
16652
+ }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
16653
+ 200: {
16654
+ name: string;
16655
+ id: string;
16656
+ icon: string | null;
16657
+ rebateFee: number;
16658
+ };
16659
+ }>>;
16660
+ };
16583
16661
  }) & {
16584
16662
  index: {
16585
16663
  get: (options: {
@@ -16597,10 +16675,12 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
16597
16675
  addresses: string[];
16598
16676
  } & {
16599
16677
  icon?: string | undefined;
16678
+ rebateFee?: number | undefined;
16600
16679
  })[];
16601
16680
  }>>;
16602
16681
  post: (body: {
16603
16682
  icon?: string | undefined;
16683
+ rebateFee?: number | undefined;
16604
16684
  name: string;
16605
16685
  id: string;
16606
16686
  addresses: string[];
@@ -16615,6 +16695,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
16615
16695
  name: string;
16616
16696
  id: string;
16617
16697
  icon: string | null;
16698
+ rebateFee: number;
16618
16699
  };
16619
16700
  }>>;
16620
16701
  };
@@ -4099,6 +4099,7 @@ declare const app: Elysia<"", false, {
4099
4099
  id: string;
4100
4100
  addresses: string[];
4101
4101
  icon?: string | undefined;
4102
+ rebateFee?: number | undefined;
4102
4103
  } | null;
4103
4104
  };
4104
4105
  };
@@ -5506,6 +5507,7 @@ declare const app: Elysia<"", false, {
5506
5507
  addresses: string[];
5507
5508
  } & {
5508
5509
  icon?: string | undefined;
5510
+ rebateFee?: number | undefined;
5509
5511
  })[];
5510
5512
  };
5511
5513
  };
@@ -5527,6 +5529,7 @@ declare const app: Elysia<"", false, {
5527
5529
  id: string;
5528
5530
  addresses: string[];
5529
5531
  icon?: string | undefined;
5532
+ rebateFee?: number | undefined;
5530
5533
  };
5531
5534
  };
5532
5535
  };
@@ -5538,6 +5541,7 @@ declare const app: Elysia<"", false, {
5538
5541
  post: {
5539
5542
  body: {
5540
5543
  icon?: string | undefined;
5544
+ rebateFee?: number | undefined;
5541
5545
  name: string;
5542
5546
  id: string;
5543
5547
  addresses: string[];
@@ -5552,6 +5556,7 @@ declare const app: Elysia<"", false, {
5552
5556
  name: string;
5553
5557
  id: string;
5554
5558
  icon: string | null;
5559
+ rebateFee: number;
5555
5560
  };
5556
5561
  };
5557
5562
  };
@@ -5578,6 +5583,34 @@ declare const app: Elysia<"", false, {
5578
5583
  name: string;
5579
5584
  id: string;
5580
5585
  icon: string | null;
5586
+ rebateFee: number;
5587
+ };
5588
+ };
5589
+ };
5590
+ };
5591
+ };
5592
+ } & {
5593
+ creators: {
5594
+ ":id": {
5595
+ rebate: {
5596
+ patch: {
5597
+ body: {
5598
+ rebate: number;
5599
+ };
5600
+ params: {
5601
+ id: string;
5602
+ };
5603
+ query: unknown;
5604
+ headers: {
5605
+ authorization: string;
5606
+ };
5607
+ response: {
5608
+ 200: {
5609
+ name: string;
5610
+ id: string;
5611
+ icon: string | null;
5612
+ rebateFee: number;
5613
+ };
5581
5614
  };
5582
5615
  };
5583
5616
  };
@@ -85,7 +85,7 @@ const load = async (rewardBreakdowns, skipSubCampaignReasons = false) => {
85
85
  if (!skipSubCampaignReasons && breakdown.reason.includes("~")) {
86
86
  // subcampaign reason will have the form <campaignId>_<protocol>_<reason> outputted by the processor>
87
87
  const subcampaignReason = breakdown.reason.split("~")[breakdown.reason.split("~").length - 1];
88
- breakdown.reason = subcampaignReason.split("_").slice(2).join("_");
88
+ breakdown.reason = subcampaignReason.split("_")[2];
89
89
  breakdown.subCampaignId = subcampaignReason.split("_")[0];
90
90
  }
91
91
  return {
@@ -30,6 +30,7 @@ export declare const CreatorController: Elysia<"/creators", false, {
30
30
  addresses: string[];
31
31
  } & {
32
32
  icon?: string | undefined;
33
+ rebateFee?: number | undefined;
33
34
  })[];
34
35
  };
35
36
  };
@@ -51,6 +52,7 @@ export declare const CreatorController: Elysia<"/creators", false, {
51
52
  id: string;
52
53
  addresses: string[];
53
54
  icon?: string | undefined;
55
+ rebateFee?: number | undefined;
54
56
  };
55
57
  };
56
58
  };
@@ -62,6 +64,7 @@ export declare const CreatorController: Elysia<"/creators", false, {
62
64
  post: {
63
65
  body: {
64
66
  icon?: string | undefined;
67
+ rebateFee?: number | undefined;
65
68
  name: string;
66
69
  id: string;
67
70
  addresses: string[];
@@ -76,6 +79,7 @@ export declare const CreatorController: Elysia<"/creators", false, {
76
79
  name: string;
77
80
  id: string;
78
81
  icon: string | null;
82
+ rebateFee: number;
79
83
  };
80
84
  };
81
85
  };
@@ -102,6 +106,34 @@ export declare const CreatorController: Elysia<"/creators", false, {
102
106
  name: string;
103
107
  id: string;
104
108
  icon: string | null;
109
+ rebateFee: number;
110
+ };
111
+ };
112
+ };
113
+ };
114
+ };
115
+ } & {
116
+ creators: {
117
+ ":id": {
118
+ rebate: {
119
+ patch: {
120
+ body: {
121
+ rebate: number;
122
+ };
123
+ params: {
124
+ id: string;
125
+ };
126
+ query: unknown;
127
+ headers: {
128
+ authorization: string;
129
+ };
130
+ response: {
131
+ 200: {
132
+ name: string;
133
+ id: string;
134
+ icon: string | null;
135
+ rebateFee: number;
136
+ };
105
137
  };
106
138
  };
107
139
  };
@@ -1,7 +1,7 @@
1
1
  import { NotFoundError } from "@/errors";
2
2
  import { AuthorizationHeadersDto, BackOfficeGuard } from "@/guards/BackOffice.guard";
3
3
  import { Elysia } from "elysia";
4
- import { CreatorDto, GetManyCreatorQuery, UpdateCreatorDto } from "./creator.model";
4
+ import { CreatorDto, GetManyCreatorQuery, UpdateCreatorDto, UpdateCreatorRebateDto } from "./creator.model";
5
5
  import { CreatorService } from "./creator.service";
6
6
  // ─── Creators Controller ────────────────────────────────────────────────────────
7
7
  export const CreatorController = new Elysia({ prefix: "/creators", detail: { tags: ["Creator"] } })
@@ -27,4 +27,10 @@ export const CreatorController = new Elysia({ prefix: "/creators", detail: { tag
27
27
  headers: AuthorizationHeadersDto,
28
28
  body: UpdateCreatorDto,
29
29
  beforeHandle: BackOfficeGuard,
30
+ })
31
+ // ─── Update Creator's Rebate Fee ──────────────────────────────────────────────
32
+ .patch("/:id/rebate", async ({ params: { id }, body }) => CreatorService.updateRebate(id, body.rebate), {
33
+ headers: AuthorizationHeadersDto,
34
+ body: UpdateCreatorRebateDto,
35
+ beforeHandle: BackOfficeGuard,
30
36
  });
@@ -7,12 +7,14 @@ import type { Resource } from "@/modules/v4/prisma";
7
7
  export type Creator = Resource<"Creator", "icon", {
8
8
  icon?: string;
9
9
  addresses: string[];
10
+ rebateFee?: number;
10
11
  }>;
11
12
  export declare const CreatorDto: import("@sinclair/typebox").TObject<{
12
13
  addresses: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
13
14
  icon: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
14
15
  id: import("@sinclair/typebox").TString;
15
16
  name: import("@sinclair/typebox").TString;
17
+ rebateFee: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
16
18
  }>;
17
19
  export declare const GetManyCreatorQuery: import("@sinclair/typebox").TObject<{
18
20
  address: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
@@ -24,6 +26,10 @@ export declare const UpdateCreatorDto: import("@sinclair/typebox").TObject<{
24
26
  icon: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
25
27
  name: import("@sinclair/typebox").TString;
26
28
  }>;
29
+ export declare const UpdateCreatorRebateDto: import("@sinclair/typebox").TObject<{
30
+ rebate: import("@sinclair/typebox").TNumber;
31
+ }>;
27
32
  export type CreatorModel = typeof CreatorDto.static;
28
33
  export type GetManyCreatorModel = typeof GetManyCreatorQuery.static;
29
34
  export type UpdateCreatorDto = typeof UpdateCreatorDto.static;
35
+ export type UpdateCreatorRebateDto = typeof UpdateCreatorRebateDto.static;
@@ -5,6 +5,7 @@ export const CreatorDto = t.Object({
5
5
  icon: t.Optional(t.String()),
6
6
  id: t.String(),
7
7
  name: t.String(),
8
+ rebateFee: t.Optional(t.Number({ maximum: 100, minimum: 0 })),
8
9
  });
9
10
  export const GetManyCreatorQuery = t.Object({
10
11
  address: t.Optional(t.String()),
@@ -16,3 +17,6 @@ export const UpdateCreatorDto = t.Object({
16
17
  icon: t.Optional(t.String()),
17
18
  name: t.String(),
18
19
  });
20
+ export const UpdateCreatorRebateDto = t.Object({
21
+ rebate: t.Number({ maximum: 100, minimum: 0 }),
22
+ });
@@ -10,11 +10,13 @@ export declare abstract class CreatorRepository {
10
10
  name: string;
11
11
  id: string;
12
12
  icon: string | null;
13
+ rebateFee: number;
13
14
  }) | null>;
14
15
  static findUniqueFromAddress(address: string): Promise<{
15
16
  name: string;
16
17
  id: string;
17
18
  icon: string | null;
19
+ rebateFee: number;
18
20
  } | null>;
19
21
  static findMany(query: GetManyCreatorModel): Promise<({
20
22
  Users: {
@@ -26,15 +28,24 @@ export declare abstract class CreatorRepository {
26
28
  name: string;
27
29
  id: string;
28
30
  icon: string | null;
31
+ rebateFee: number;
29
32
  })[]>;
30
33
  static create({ addresses, ...creator }: Creator["model"]): Promise<{
31
34
  name: string;
32
35
  id: string;
33
36
  icon: string | null;
37
+ rebateFee: number;
34
38
  }>;
35
39
  static update(id: Creator["model"]["id"], { addresses, ...creator }: UpdateCreatorDto): Promise<{
36
40
  name: string;
37
41
  id: string;
38
42
  icon: string | null;
43
+ rebateFee: number;
44
+ }>;
45
+ static updateRebate(id: Creator["model"]["id"], rebate: number): Promise<{
46
+ name: string;
47
+ id: string;
48
+ icon: string | null;
49
+ rebateFee: number;
39
50
  }>;
40
51
  }
@@ -60,4 +60,7 @@ export class CreatorRepository {
60
60
  },
61
61
  });
62
62
  }
63
+ static async updateRebate(id, rebate) {
64
+ return await apiDbClient.creator.update({ where: { id }, data: { rebateFee: rebate } });
65
+ }
63
66
  }
@@ -1,4 +1,4 @@
1
- import type { Creator, GetManyCreatorModel, UpdateCreatorDto } from "./creator.model";
1
+ import type { Creator, GetManyCreatorModel, UpdateCreatorDto, UpdateCreatorRebateDto } from "./creator.model";
2
2
  export declare abstract class CreatorService {
3
3
  /**
4
4
  * Format creator into its model
@@ -21,6 +21,7 @@ export declare abstract class CreatorService {
21
21
  name: string;
22
22
  id: string;
23
23
  icon: string | null;
24
+ rebateFee: number;
24
25
  }) | null>;
25
26
  /**
26
27
  * Finds many creator
@@ -37,6 +38,7 @@ export declare abstract class CreatorService {
37
38
  name: string;
38
39
  id: string;
39
40
  icon: string | null;
41
+ rebateFee: number;
40
42
  })[]>;
41
43
  /**
42
44
  * Creates a creator
@@ -46,6 +48,7 @@ export declare abstract class CreatorService {
46
48
  name: string;
47
49
  id: string;
48
50
  icon: string | null;
51
+ rebateFee: number;
49
52
  }>;
50
53
  /**
51
54
  * Updates data on a creator
@@ -57,5 +60,12 @@ export declare abstract class CreatorService {
57
60
  name: string;
58
61
  id: string;
59
62
  icon: string | null;
63
+ rebateFee: number;
64
+ }>;
65
+ static updateRebate(id: Creator["model"]["id"], rebate: UpdateCreatorRebateDto["rebate"]): Promise<{
66
+ name: string;
67
+ id: string;
68
+ icon: string | null;
69
+ rebateFee: number;
60
70
  }>;
61
71
  }
@@ -41,4 +41,7 @@ export class CreatorService {
41
41
  static async update(id, creator) {
42
42
  return await CreatorRepository.update(id, creator);
43
43
  }
44
+ static async updateRebate(id, rebate) {
45
+ return await CreatorRepository.updateRebate(id, rebate);
46
+ }
44
47
  }
@@ -3969,6 +3969,7 @@ export declare const v4: Elysia<"/v4", false, {
3969
3969
  id: string;
3970
3970
  addresses: string[];
3971
3971
  icon?: string | undefined;
3972
+ rebateFee?: number | undefined;
3972
3973
  } | null;
3973
3974
  };
3974
3975
  };
@@ -5376,6 +5377,7 @@ export declare const v4: Elysia<"/v4", false, {
5376
5377
  addresses: string[];
5377
5378
  } & {
5378
5379
  icon?: string | undefined;
5380
+ rebateFee?: number | undefined;
5379
5381
  })[];
5380
5382
  };
5381
5383
  };
@@ -5397,6 +5399,7 @@ export declare const v4: Elysia<"/v4", false, {
5397
5399
  id: string;
5398
5400
  addresses: string[];
5399
5401
  icon?: string | undefined;
5402
+ rebateFee?: number | undefined;
5400
5403
  };
5401
5404
  };
5402
5405
  };
@@ -5408,6 +5411,7 @@ export declare const v4: Elysia<"/v4", false, {
5408
5411
  post: {
5409
5412
  body: {
5410
5413
  icon?: string | undefined;
5414
+ rebateFee?: number | undefined;
5411
5415
  name: string;
5412
5416
  id: string;
5413
5417
  addresses: string[];
@@ -5422,6 +5426,7 @@ export declare const v4: Elysia<"/v4", false, {
5422
5426
  name: string;
5423
5427
  id: string;
5424
5428
  icon: string | null;
5429
+ rebateFee: number;
5425
5430
  };
5426
5431
  };
5427
5432
  };
@@ -5448,6 +5453,34 @@ export declare const v4: Elysia<"/v4", false, {
5448
5453
  name: string;
5449
5454
  id: string;
5450
5455
  icon: string | null;
5456
+ rebateFee: number;
5457
+ };
5458
+ };
5459
+ };
5460
+ };
5461
+ };
5462
+ } & {
5463
+ creators: {
5464
+ ":id": {
5465
+ rebate: {
5466
+ patch: {
5467
+ body: {
5468
+ rebate: number;
5469
+ };
5470
+ params: {
5471
+ id: string;
5472
+ };
5473
+ query: unknown;
5474
+ headers: {
5475
+ authorization: string;
5476
+ };
5477
+ response: {
5478
+ 200: {
5479
+ name: string;
5480
+ id: string;
5481
+ icon: string | null;
5482
+ rebateFee: number;
5483
+ };
5451
5484
  };
5452
5485
  };
5453
5486
  };
@@ -92,6 +92,7 @@ export declare const UserController: Elysia<"/users", false, {
92
92
  id: string;
93
93
  addresses: string[];
94
94
  icon?: string | undefined;
95
+ rebateFee?: number | undefined;
95
96
  } | null;
96
97
  };
97
98
  };