@merkl/api 0.10.260 → 0.10.262
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.
- package/dist/src/eden/index.d.ts +13 -7
- package/dist/src/index.d.ts +3 -1
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +3 -1
- package/dist/src/modules/v4/opportunity/opportunity.controller.js +3 -2
- package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +1 -1
- package/dist/src/modules/v4/opportunity/opportunity.repository.js +8 -1
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +1 -1
- package/dist/src/modules/v4/opportunity/opportunity.service.js +2 -2
- package/dist/src/modules/v4/router.d.ts +3 -1
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/src/eden/index.d.ts
CHANGED
@@ -233,11 +233,13 @@ declare const eden: {
|
|
233
233
|
};
|
234
234
|
}>>;
|
235
235
|
campaigns: {
|
236
|
-
get: (options
|
236
|
+
get: (options: {
|
237
237
|
headers?: Record<string, unknown> | undefined;
|
238
|
-
query
|
238
|
+
query: {
|
239
|
+
test?: boolean | undefined;
|
240
|
+
};
|
239
241
|
fetch?: RequestInit | undefined;
|
240
|
-
}
|
242
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
241
243
|
200: {
|
242
244
|
protocol?: {
|
243
245
|
name: string;
|
@@ -3294,7 +3296,9 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
3294
3296
|
params: {
|
3295
3297
|
id: string;
|
3296
3298
|
};
|
3297
|
-
query:
|
3299
|
+
query: {
|
3300
|
+
test?: boolean | undefined;
|
3301
|
+
};
|
3298
3302
|
headers: unknown;
|
3299
3303
|
response: {
|
3300
3304
|
200: {
|
@@ -6548,11 +6552,13 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
6548
6552
|
};
|
6549
6553
|
}>>;
|
6550
6554
|
campaigns: {
|
6551
|
-
get: (options
|
6555
|
+
get: (options: {
|
6552
6556
|
headers?: Record<string, unknown> | undefined;
|
6553
|
-
query
|
6557
|
+
query: {
|
6558
|
+
test?: boolean | undefined;
|
6559
|
+
};
|
6554
6560
|
fetch?: RequestInit | undefined;
|
6555
|
-
}
|
6561
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
6556
6562
|
200: {
|
6557
6563
|
protocol?: {
|
6558
6564
|
name: string;
|
package/dist/src/index.d.ts
CHANGED
@@ -88,7 +88,7 @@ export const OpportunityController = new Elysia({
|
|
88
88
|
detail: { description: "Get a unique opportunity." },
|
89
89
|
})
|
90
90
|
// ─── Get An Opportunity By Id With Related Campaigns ─────────────────
|
91
|
-
.get("/:id/campaigns", async ({ params }) => {
|
91
|
+
.get("/:id/campaigns", async ({ query, params }) => {
|
92
92
|
try {
|
93
93
|
if (!params.id.includes("-"))
|
94
94
|
return await OpportunityService.getUniqueWithCampaignsOrThrow(params.id);
|
@@ -97,7 +97,7 @@ export const OpportunityController = new Elysia({
|
|
97
97
|
chainId: +chainId,
|
98
98
|
type: type,
|
99
99
|
identifier,
|
100
|
-
});
|
100
|
+
}, query.test ?? false);
|
101
101
|
// Todo: need to be refactor Parsing issue
|
102
102
|
const campaignsFormatted = oppWithCampaigns.campaigns.map(campaign => {
|
103
103
|
if (!campaign.distributionChain)
|
@@ -114,6 +114,7 @@ export const OpportunityController = new Elysia({
|
|
114
114
|
throw err;
|
115
115
|
}
|
116
116
|
}, {
|
117
|
+
query: GetOpportunityQueryDto,
|
117
118
|
params: OpportunityUniqueDto,
|
118
119
|
transform: transformId,
|
119
120
|
beforeHandle: validateId,
|
@@ -286,7 +286,7 @@ export declare abstract class OpportunityRepository {
|
|
286
286
|
apr: number;
|
287
287
|
dailyRewards: number;
|
288
288
|
}>;
|
289
|
-
static findUniqueOrThrowWithCampaigns(id: string): Promise<{
|
289
|
+
static findUniqueOrThrowWithCampaigns(id: string, withTest: boolean): Promise<{
|
290
290
|
Chain: {
|
291
291
|
Explorer: {
|
292
292
|
type: import("../../../../database/api/.generated").$Enums.ExplorerType;
|
@@ -137,7 +137,7 @@ export class OpportunityRepository {
|
|
137
137
|
where: { id },
|
138
138
|
});
|
139
139
|
}
|
140
|
-
static async findUniqueOrThrowWithCampaigns(id) {
|
140
|
+
static async findUniqueOrThrowWithCampaigns(id, withTest) {
|
141
141
|
const b = await apiDbClient.opportunity.findUniqueOrThrow({
|
142
142
|
include: {
|
143
143
|
...OpportunityRepository.#getRecordInclusion(),
|
@@ -147,6 +147,13 @@ export class OpportunityRepository {
|
|
147
147
|
},
|
148
148
|
},
|
149
149
|
Campaigns: {
|
150
|
+
where: withTest
|
151
|
+
? undefined
|
152
|
+
: {
|
153
|
+
RewardToken: {
|
154
|
+
isTest: false,
|
155
|
+
},
|
156
|
+
},
|
150
157
|
include: {
|
151
158
|
RewardToken: true,
|
152
159
|
ComputeChain: true,
|
@@ -80,7 +80,7 @@ export declare abstract class OpportunityService {
|
|
80
80
|
tags: string[];
|
81
81
|
}>;
|
82
82
|
static updateMetadata(chain: ChainId): Promise<void>;
|
83
|
-
static getUniqueWithCampaignsOrThrow(opportunityId: string | OpportunityUnique): Promise<OpportunityWithCampaignsResourceModel>;
|
83
|
+
static getUniqueWithCampaignsOrThrow(opportunityId: string | OpportunityUnique, withTest?: boolean): Promise<OpportunityWithCampaignsResourceModel>;
|
84
84
|
static getUniqueOrThrow(opportunityId: string | OpportunityUnique, withTest?: boolean): Promise<OpportunityResourceModel>;
|
85
85
|
/**
|
86
86
|
* Get the list of opportunities satisfying the query
|
@@ -157,9 +157,9 @@ export class OpportunityService {
|
|
157
157
|
throw err;
|
158
158
|
}
|
159
159
|
}
|
160
|
-
static async getUniqueWithCampaignsOrThrow(opportunityId) {
|
160
|
+
static async getUniqueWithCampaignsOrThrow(opportunityId, withTest = false) {
|
161
161
|
const id = typeof opportunityId === "string" ? opportunityId : OpportunityService.hashId(opportunityId);
|
162
|
-
const { Campaigns, ...opportunity } = await OpportunityRepository.findUniqueOrThrowWithCampaigns(id);
|
162
|
+
const { Campaigns, ...opportunity } = await OpportunityRepository.findUniqueOrThrowWithCampaigns(id, withTest);
|
163
163
|
const formatted = OpportunityService.formatResponse(opportunity);
|
164
164
|
return Object.assign(formatted, { campaigns: Campaigns.map(CampaignService.format) });
|
165
165
|
}
|