@merkl/api 0.10.221 → 0.10.223

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.
@@ -2704,6 +2704,7 @@ declare const eden: {
2704
2704
  mainParameter?: string | undefined;
2705
2705
  rewardToken?: string | undefined;
2706
2706
  proof?: string | undefined;
2707
+ reloadChainId?: number | undefined;
2707
2708
  chainId: never;
2708
2709
  user: string;
2709
2710
  };
@@ -6150,6 +6151,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
6150
6151
  mainParameter?: string | undefined;
6151
6152
  rewardToken?: string | undefined;
6152
6153
  proof?: string | undefined;
6154
+ reloadChainId?: number | undefined;
6153
6155
  chainId: never;
6154
6156
  user: string;
6155
6157
  };
@@ -8888,6 +8890,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
8888
8890
  mainParameter?: string | undefined;
8889
8891
  rewardToken?: string | undefined;
8890
8892
  proof?: string | undefined;
8893
+ reloadChainId?: number | undefined;
8891
8894
  chainId: never;
8892
8895
  user: string;
8893
8896
  };
@@ -3411,6 +3411,7 @@ declare const app: Elysia<"", false, {
3411
3411
  mainParameter?: string | undefined;
3412
3412
  rewardToken?: string | undefined;
3413
3413
  proof?: string | undefined;
3414
+ reloadChainId?: number | undefined;
3414
3415
  chainId: never;
3415
3416
  user: string;
3416
3417
  };
@@ -69,11 +69,20 @@ export const OpportunityController = new Elysia({
69
69
  if (!params.id.includes("-"))
70
70
  return await OpportunityService.getUniqueWithCampaignsOrThrow(params.id);
71
71
  const [chainId, type, identifier] = params.id.split("-");
72
- return await OpportunityService.getUniqueWithCampaignsOrThrow({
72
+ const oppWithCampaigns = await OpportunityService.getUniqueWithCampaignsOrThrow({
73
73
  chainId: +chainId,
74
74
  type: type,
75
75
  identifier,
76
76
  });
77
+ // Todo: need to be refactor Parsing issue
78
+ const campaignsFormatted = oppWithCampaigns.campaigns.map(campaign => {
79
+ if (!campaign.distributionChain)
80
+ return campaign;
81
+ const distributionChain = campaign.distributionChain;
82
+ const { Explorer } = distributionChain;
83
+ return { ...campaign, distributionChain: { ...campaign.distributionChain, explorers: Explorer } };
84
+ });
85
+ return { ...oppWithCampaigns, campaigns: campaignsFormatted };
77
86
  }
78
87
  catch (err) {
79
88
  if (err.code && err.code === "P2025")
@@ -98,7 +107,6 @@ export const OpportunityController = new Elysia({
98
107
  params: OpportunityAggregateFieldDto,
99
108
  query: GetOpportunitiesQueryDto,
100
109
  response: AggregationResourceDto,
101
- detail: { hide: true },
102
110
  })
103
111
  // ─── Update An Opportunity ───────────────────────────────────────────
104
112
  .patch("/:id", async ({ params, body }) => await OpportunityService.update(params.id, body), {
@@ -126,6 +126,13 @@ export declare abstract class OpportunityRepository {
126
126
  }>;
127
127
  static findUniqueOrThrowWithCampaigns(id: string): Promise<{
128
128
  Chain: {
129
+ Explorer: {
130
+ type: import("../../../../database/api/.generated").$Enums.ExplorerType;
131
+ url: string;
132
+ id: string;
133
+ chainId: number;
134
+ }[];
135
+ } & {
129
136
  name: string;
130
137
  id: number;
131
138
  icon: string;
@@ -137,6 +144,13 @@ export declare abstract class OpportunityRepository {
137
144
  icon: string;
138
145
  };
139
146
  DistributionChain: {
147
+ Explorer: {
148
+ type: import("../../../../database/api/.generated").$Enums.ExplorerType;
149
+ url: string;
150
+ id: string;
151
+ chainId: number;
152
+ }[];
153
+ } & {
140
154
  name: string;
141
155
  id: number;
142
156
  icon: string;
@@ -83,12 +83,20 @@ export class OpportunityRepository {
83
83
  const b = await apiDbClient.opportunity.findUniqueOrThrow({
84
84
  include: {
85
85
  ...OpportunityRepository.#getRecordInclusion(),
86
- Chain: true,
86
+ Chain: {
87
+ include: {
88
+ Explorer: true,
89
+ },
90
+ },
87
91
  Campaigns: {
88
92
  include: {
89
93
  RewardToken: true,
90
94
  ComputeChain: true,
91
- DistributionChain: true,
95
+ DistributionChain: {
96
+ include: {
97
+ Explorer: true,
98
+ },
99
+ },
92
100
  CampaignStatus: true, // [][0]
93
101
  },
94
102
  orderBy: {
@@ -736,6 +736,7 @@ export declare const v3: Elysia<"/v3", false, {
736
736
  mainParameter?: string | undefined;
737
737
  rewardToken?: string | undefined;
738
738
  proof?: string | undefined;
739
+ reloadChainId?: number | undefined;
739
740
  chainId: never;
740
741
  user: string;
741
742
  };
@@ -1,6 +1,7 @@
1
1
  import type Elysia from "elysia";
2
2
  export declare const query: import("@sinclair/typebox").TObject<{
3
3
  chainId: import("@sinclair/typebox").TUnion<import("elysia").TSchema[]>;
4
+ reloadChainId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
4
5
  mainParameter: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
5
6
  proof: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
6
7
  rewardToken: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
@@ -27,6 +28,7 @@ declare const _default: (app: Elysia) => Elysia<"", false, {
27
28
  mainParameter?: string | undefined;
28
29
  rewardToken?: string | undefined;
29
30
  proof?: string | undefined;
31
+ reloadChainId?: number | undefined;
30
32
  chainId: never;
31
33
  user: string;
32
34
  };
@@ -9,6 +9,7 @@ import { utils } from "ethers";
9
9
  import checkQueryChainIdValidity from "../../hooks/checkQueryChainIdValidity";
10
10
  export const query = t.Object({
11
11
  chainId: param.Chain.type,
12
+ reloadChainId: t.Optional(t.Number()),
12
13
  mainParameter: t.Optional(t.String()),
13
14
  proof: t.Optional(t.String()),
14
15
  rewardToken: t.Optional(t.String()),
@@ -44,7 +45,7 @@ export default (app) => app
44
45
  }
45
46
  }
46
47
  // @Warning: this is not taking into account the mainParameter filter
47
- const v4Res = await RewardService.getUserRewardsByChain(user, false, [chainId]);
48
+ const v4Res = await RewardService.getUserRewardsByChain(user, false, [chainId], query.reloadChainId ?? null);
48
49
  const v3Res = RewardConvertorService.convertV4toUserRewardV3(v4Res, proof);
49
50
  return v3Res;
50
51
  }, {