@merkl/api 0.21.19 → 0.21.20
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 +1437 -1415
- package/dist/src/engine/deprecated/dynamicData/implementations/Erc20.js +1 -18
- package/dist/src/engine/implementations/Clamm/metadata.js +1 -0
- package/dist/src/index.d.ts +968 -960
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +8 -1
- package/dist/src/modules/v4/campaign/campaign.model.d.ts +1 -0
- package/dist/src/modules/v4/campaign/campaign.model.js +1 -0
- package/dist/src/modules/v4/campaign/campaign.repository.d.ts +18 -0
- package/dist/src/modules/v4/campaign/campaign.repository.js +15 -1
- package/dist/src/modules/v4/campaign/campaign.service.d.ts +2 -1
- package/dist/src/modules/v4/campaign/campaign.service.js +9 -4
- package/dist/src/modules/v4/creator/creator.controller.d.ts +3 -2
- package/dist/src/modules/v4/creator/creator.service.d.ts +3 -2
- package/dist/src/modules/v4/creator/creator.service.js +9 -2
- package/dist/src/modules/v4/dynamicData/dynamicData.service.js +2 -10
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +970 -960
- package/dist/src/modules/v4/opportunity/opportunity.controller.js +32 -46
- package/dist/src/modules/v4/protocol/protocol.controller.d.ts +10 -1
- package/dist/src/modules/v4/protocol/protocol.controller.js +4 -15
- package/dist/src/modules/v4/router.d.ts +968 -960
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
@@ -1,6 +1,6 @@
|
|
1
1
|
import { HttpErrorDto, NotFoundError, NotFoundErrorDto } from "@/errors";
|
2
2
|
import { BackOfficeGuard } from "@/guards/BackOffice.guard";
|
3
|
-
import { AuthorizationHeadersDto
|
3
|
+
import { AuthorizationHeadersDto } from "@/guards/TokenAuth.guard";
|
4
4
|
import { GetCampaignQueryDto } from "@/modules/v4/campaign/campaign.model";
|
5
5
|
import { log } from "@/utils/logger";
|
6
6
|
import { throwOnUnsupportedActionList } from "@/utils/throw";
|
@@ -16,51 +16,6 @@ export const OpportunityController = new Elysia({
|
|
16
16
|
detail: {
|
17
17
|
tags: ["Opportunities"],
|
18
18
|
},
|
19
|
-
})
|
20
|
-
// ─── Create An Opportunity ───────────────────────────────────────────
|
21
|
-
.post("/", async ({ body }) => await OpportunityService.create(body), {
|
22
|
-
beforeHandle: TokenAuthGuard,
|
23
|
-
headers: AuthorizationHeadersDto,
|
24
|
-
body: CreateOpportunityDto,
|
25
|
-
detail: { hide: true },
|
26
|
-
})
|
27
|
-
// ─── Override An Opportunity Field ───────────────────────────────────
|
28
|
-
.patch("/:id/override", async ({ params, body }) => await OpportunityService.override(params.id, body), {
|
29
|
-
headers: AuthorizationHeadersDto,
|
30
|
-
params: OpportunityUniqueDto,
|
31
|
-
body: OpportunityOverrideDto,
|
32
|
-
beforeHandle: BackOfficeGuard,
|
33
|
-
})
|
34
|
-
.delete("/:id/override", async ({ params, body }) => await OpportunityService.deleteOverrides(params.id, body), {
|
35
|
-
headers: AuthorizationHeadersDto,
|
36
|
-
params: OpportunityUniqueDto,
|
37
|
-
body: OpportunityDeleteOverrideDto,
|
38
|
-
beforeHandle: BackOfficeGuard,
|
39
|
-
detail: { hide: true },
|
40
|
-
})
|
41
|
-
// ─── Tries to reparse An Opportunity ─────────────────────────────────
|
42
|
-
.post("/:id", async ({ params }) => {
|
43
|
-
try {
|
44
|
-
if (!params.id.includes("-"))
|
45
|
-
return await OpportunityService.recreate(params.id);
|
46
|
-
const [chainId, type, identifier] = params.id.split("-");
|
47
|
-
return await OpportunityService.recreate(OpportunityService.hashId({
|
48
|
-
chainId: +chainId,
|
49
|
-
type: type,
|
50
|
-
identifier,
|
51
|
-
}));
|
52
|
-
}
|
53
|
-
catch (err) {
|
54
|
-
log.error("error recreating opportunity", err);
|
55
|
-
if (err.code && err.code === "P2025")
|
56
|
-
throw new NotFoundError();
|
57
|
-
throw err;
|
58
|
-
}
|
59
|
-
}, {
|
60
|
-
beforeHandle: BackOfficeGuard,
|
61
|
-
headers: AuthorizationHeadersDto,
|
62
|
-
params: OpportunityUniqueUpdateDto,
|
63
|
-
detail: { hide: true },
|
64
19
|
})
|
65
20
|
// ─── Get All Opportunities ───────────────────────────────────────────
|
66
21
|
.get("/", async ({ query }) => OpportunityService.findMany(query), {
|
@@ -200,4 +155,35 @@ export const OpportunityController = new Elysia({
|
|
200
155
|
if (!!query.action)
|
201
156
|
throwOnUnsupportedActionList(query.action);
|
202
157
|
},
|
158
|
+
})
|
159
|
+
.guard({ detail: { hide: true }, beforeHandle: BackOfficeGuard, headers: AuthorizationHeadersDto })
|
160
|
+
// ─── Create An Opportunity ───────────────────────────────────────────
|
161
|
+
.post("/", async ({ body }) => await OpportunityService.create(body), { body: CreateOpportunityDto })
|
162
|
+
// ─── Tries to reparse An Opportunity ─────────────────────────────────
|
163
|
+
.post("/:id", async ({ params }) => {
|
164
|
+
try {
|
165
|
+
if (!params.id.includes("-"))
|
166
|
+
return await OpportunityService.recreate(params.id);
|
167
|
+
const [chainId, type, identifier] = params.id.split("-");
|
168
|
+
return await OpportunityService.recreate(OpportunityService.hashId({
|
169
|
+
chainId: +chainId,
|
170
|
+
type: type,
|
171
|
+
identifier,
|
172
|
+
}));
|
173
|
+
}
|
174
|
+
catch (err) {
|
175
|
+
log.error("error recreating opportunity", err);
|
176
|
+
if (err.code && err.code === "P2025")
|
177
|
+
throw new NotFoundError();
|
178
|
+
throw err;
|
179
|
+
}
|
180
|
+
}, { params: OpportunityUniqueUpdateDto })
|
181
|
+
// ─── Override An Opportunity Field ───────────────────────────────────
|
182
|
+
.patch("/:id/override", async ({ params, body }) => await OpportunityService.override(params.id, body), {
|
183
|
+
params: OpportunityUniqueDto,
|
184
|
+
body: OpportunityOverrideDto,
|
185
|
+
})
|
186
|
+
.delete("/:id/override", async ({ params, body }) => await OpportunityService.deleteOverrides(params.id, body), {
|
187
|
+
params: OpportunityUniqueDto,
|
188
|
+
body: OpportunityDeleteOverrideDto,
|
203
189
|
});
|
@@ -224,5 +224,14 @@ export declare const ProtocolController: Elysia<"/protocols", false, {
|
|
224
224
|
}, {
|
225
225
|
derive: {};
|
226
226
|
resolve: {};
|
227
|
-
schema: {
|
227
|
+
schema: {
|
228
|
+
body: unknown;
|
229
|
+
headers: {
|
230
|
+
authorization: string;
|
231
|
+
};
|
232
|
+
query: unknown;
|
233
|
+
params: unknown;
|
234
|
+
cookie: unknown;
|
235
|
+
response: {};
|
236
|
+
};
|
228
237
|
}>;
|
@@ -21,22 +21,15 @@ export const ProtocolController = new Elysia({ prefix: "/protocols", detail: { t
|
|
21
21
|
if (fromId)
|
22
22
|
return fromId;
|
23
23
|
return (await ProtocolService.findMany({ name: params.id }))?.[0];
|
24
|
-
}
|
24
|
+
})
|
25
|
+
.guard({ detail: { hide: true }, headers: AuthorizationHeadersDto, beforeHandle: BackOfficeGuard })
|
25
26
|
// ─── Update A Protocol ───────────────────────────────────────────────
|
26
27
|
.patch("/:id", async ({ params, body }) => await ProtocolService.update(params.id, body), {
|
27
28
|
params: ProtocolIdDto,
|
28
29
|
body: UpdateProtocolDto,
|
29
|
-
headers: AuthorizationHeadersDto,
|
30
|
-
beforeHandle: BackOfficeGuard,
|
31
|
-
detail: { hide: true },
|
32
30
|
})
|
33
31
|
// ─── Create A Protocol ───────────────────────────────────────────────
|
34
|
-
.post("/", async ({ body }) => await ProtocolService.create(body), {
|
35
|
-
body: CreateProtocolDto,
|
36
|
-
headers: AuthorizationHeadersDto,
|
37
|
-
beforeHandle: BackOfficeGuard,
|
38
|
-
detail: { hide: true },
|
39
|
-
})
|
32
|
+
.post("/", async ({ body }) => await ProtocolService.create(body), { body: CreateProtocolDto })
|
40
33
|
.group("/webhooks", app => app.post("/notion", async ({ body }) => ProtocolService.upsert({
|
41
34
|
id: body.data.properties.id.title[0].text.content,
|
42
35
|
description: body.data.properties.description.rich_text[0].text.content,
|
@@ -46,8 +39,4 @@ export const ProtocolController = new Elysia({ prefix: "/protocols", detail: { t
|
|
46
39
|
name: body.data.properties.name.rich_text[0].text.content,
|
47
40
|
tags: body.data.properties.tags.rich_text[0]?.text.content.split(","),
|
48
41
|
url: body.data.properties.url.url,
|
49
|
-
}), {
|
50
|
-
headers: AuthorizationHeadersDto,
|
51
|
-
beforeHandle: BackOfficeGuard,
|
52
|
-
body: NotionWebhookAddProtocolDto,
|
53
|
-
}));
|
42
|
+
}), { body: NotionWebhookAddProtocolDto }));
|