@merkl/api 0.20.20 → 0.20.22
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/database/index.js +1 -1
- package/dist/src/eden/index.d.ts +60 -0
- package/dist/src/index.d.ts +16 -0
- package/dist/src/jobs/update-dynamic-data.js +1 -1
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +16 -0
- package/dist/src/modules/v4/campaign/campaign.controller.js +14 -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/opportunity/opportunity.repository.d.ts +2 -1
- package/dist/src/modules/v4/opportunity/opportunity.repository.js +3 -1
- package/dist/src/modules/v4/programPayload/programPayload.repository.js +3 -0
- package/dist/src/modules/v4/router.d.ts +16 -0
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/database/index.js
CHANGED
@@ -2,7 +2,7 @@ import { PrismaClient as ApiPrismaClient } from "@db/api";
|
|
2
2
|
import { PrismaClient as EnginePrismaClient } from "@db/engine";
|
3
3
|
import { drizzle } from "drizzle-orm/prisma/pg";
|
4
4
|
export const apiDbClient = new ApiPrismaClient({
|
5
|
-
datasources: { db: { url: `${process.env.DATABASE_API_URL}&connection_limit=
|
5
|
+
datasources: { db: { url: `${process.env.DATABASE_API_URL}&connection_limit=150&pool_timeout=60` } },
|
6
6
|
}).$extends(drizzle());
|
7
7
|
export const engineDbClient = new EnginePrismaClient({
|
8
8
|
datasources: {
|
package/dist/src/eden/index.d.ts
CHANGED
@@ -1195,6 +1195,17 @@ declare const eden: {
|
|
1195
1195
|
}>>;
|
1196
1196
|
};
|
1197
1197
|
}) & {
|
1198
|
+
"dynamic-data": {
|
1199
|
+
post: (body: string[], options: {
|
1200
|
+
headers: {
|
1201
|
+
authorization: string;
|
1202
|
+
};
|
1203
|
+
query?: Record<string, unknown> | undefined;
|
1204
|
+
fetch?: RequestInit | undefined;
|
1205
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
1206
|
+
200: unknown[];
|
1207
|
+
}>>;
|
1208
|
+
};
|
1198
1209
|
metadata: {
|
1199
1210
|
get: (options: {
|
1200
1211
|
headers: {
|
@@ -4946,6 +4957,17 @@ declare const eden: {
|
|
4946
4957
|
}>>;
|
4947
4958
|
};
|
4948
4959
|
}) & {
|
4960
|
+
"dynamic-data": {
|
4961
|
+
post: (body: string[], options: {
|
4962
|
+
headers: {
|
4963
|
+
authorization: string;
|
4964
|
+
};
|
4965
|
+
query?: Record<string, unknown> | undefined;
|
4966
|
+
fetch?: RequestInit | undefined;
|
4967
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
4968
|
+
200: unknown[];
|
4969
|
+
}>>;
|
4970
|
+
};
|
4949
4971
|
metadata: {
|
4950
4972
|
get: (options: {
|
4951
4973
|
headers: {
|
@@ -9469,6 +9491,22 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
9469
9491
|
};
|
9470
9492
|
};
|
9471
9493
|
};
|
9494
|
+
} & {
|
9495
|
+
"dry-run": {
|
9496
|
+
"dynamic-data": {
|
9497
|
+
post: {
|
9498
|
+
body: string[];
|
9499
|
+
params: {};
|
9500
|
+
query: unknown;
|
9501
|
+
headers: {
|
9502
|
+
authorization: string;
|
9503
|
+
};
|
9504
|
+
response: {
|
9505
|
+
200: unknown[];
|
9506
|
+
};
|
9507
|
+
};
|
9508
|
+
};
|
9509
|
+
};
|
9472
9510
|
} & {
|
9473
9511
|
"dry-run": {
|
9474
9512
|
metadata: {
|
@@ -14965,6 +15003,17 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
14965
15003
|
}>>;
|
14966
15004
|
};
|
14967
15005
|
}) & {
|
15006
|
+
"dynamic-data": {
|
15007
|
+
post: (body: string[], options: {
|
15008
|
+
headers: {
|
15009
|
+
authorization: string;
|
15010
|
+
};
|
15011
|
+
query?: Record<string, unknown> | undefined;
|
15012
|
+
fetch?: RequestInit | undefined;
|
15013
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
15014
|
+
200: unknown[];
|
15015
|
+
}>>;
|
15016
|
+
};
|
14968
15017
|
metadata: {
|
14969
15018
|
get: (options: {
|
14970
15019
|
headers: {
|
@@ -18716,6 +18765,17 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
18716
18765
|
}>>;
|
18717
18766
|
};
|
18718
18767
|
}) & {
|
18768
|
+
"dynamic-data": {
|
18769
|
+
post: (body: string[], options: {
|
18770
|
+
headers: {
|
18771
|
+
authorization: string;
|
18772
|
+
};
|
18773
|
+
query?: Record<string, unknown> | undefined;
|
18774
|
+
fetch?: RequestInit | undefined;
|
18775
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
18776
|
+
200: unknown[];
|
18777
|
+
}>>;
|
18778
|
+
};
|
18719
18779
|
metadata: {
|
18720
18780
|
get: (options: {
|
18721
18781
|
headers: {
|
package/dist/src/index.d.ts
CHANGED
@@ -1280,6 +1280,22 @@ declare const app: Elysia<"", false, {
|
|
1280
1280
|
};
|
1281
1281
|
};
|
1282
1282
|
};
|
1283
|
+
} & {
|
1284
|
+
"dry-run": {
|
1285
|
+
"dynamic-data": {
|
1286
|
+
post: {
|
1287
|
+
body: string[];
|
1288
|
+
params: {};
|
1289
|
+
query: unknown;
|
1290
|
+
headers: {
|
1291
|
+
authorization: string;
|
1292
|
+
};
|
1293
|
+
response: {
|
1294
|
+
200: unknown[];
|
1295
|
+
};
|
1296
|
+
};
|
1297
|
+
};
|
1298
|
+
};
|
1283
1299
|
} & {
|
1284
1300
|
"dry-run": {
|
1285
1301
|
metadata: {
|
@@ -47,7 +47,7 @@ const main = async () => {
|
|
47
47
|
status = "SOON";
|
48
48
|
}
|
49
49
|
if (status === "PAST" && opportunity.apr !== 0)
|
50
|
-
await OpportunityService.update(opportunity.id, { status, apr: 0 });
|
50
|
+
await OpportunityService.update(opportunity.id, { status, apr: 0, dailyRewards: 0 });
|
51
51
|
if (opportunity.status !== status)
|
52
52
|
await OpportunityService.updateStatus(opportunity.id, status);
|
53
53
|
}
|
@@ -183,6 +183,22 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
|
|
183
183
|
};
|
184
184
|
};
|
185
185
|
};
|
186
|
+
} & {
|
187
|
+
"dry-run": {
|
188
|
+
"dynamic-data": {
|
189
|
+
post: {
|
190
|
+
body: string[];
|
191
|
+
params: {};
|
192
|
+
query: unknown;
|
193
|
+
headers: {
|
194
|
+
authorization: string;
|
195
|
+
};
|
196
|
+
response: {
|
197
|
+
200: unknown[];
|
198
|
+
};
|
199
|
+
};
|
200
|
+
};
|
201
|
+
};
|
186
202
|
} & {
|
187
203
|
"dry-run": {
|
188
204
|
metadata: {
|
@@ -8,7 +8,7 @@ import { throwOnUnsupportedChainId } from "src/utils/throw";
|
|
8
8
|
import { DynamicDataService } from "../dynamicData/dynamicData.service";
|
9
9
|
import { OpportunityService } from "../opportunity";
|
10
10
|
import { OpportunityConvertorService } from "../opportunity/opportunity.converter";
|
11
|
-
import { CampaignResourceDto, CampaignUniqueDto, CreateCampaignDto, GetCampaignQueryDto, RemoveManualOverrideDto, UpdateCampaignCreatorDto, UpdateCampaignDto, UpdateMetaDataCampaignDto, } from "./campaign.model";
|
11
|
+
import { CampaignResourceDto, CampaignUniqueDto, CampaignsDto, CreateCampaignDto, GetCampaignQueryDto, RemoveManualOverrideDto, UpdateCampaignCreatorDto, UpdateCampaignDto, UpdateMetaDataCampaignDto, } from "./campaign.model";
|
12
12
|
import { CampaignService } from "./campaign.service";
|
13
13
|
// ─── Campaigns Controller ────────────────────────────────────────────────────
|
14
14
|
export const CampaignController = new Elysia({ prefix: "/campaigns", detail: { tags: ["Campaigns"] } })
|
@@ -65,6 +65,19 @@ export const CampaignController = new Elysia({ prefix: "/campaigns", detail: { t
|
|
65
65
|
const campaignV3 = OpportunityConvertorService.convertV4CampaignToV3(Campaign[campaign.type], CampaignService.format(campaign), campaign.Opportunity.identifier);
|
66
66
|
return await DynamicDataService.updateForCampaigns([campaignV3], true);
|
67
67
|
}, { beforeHandle: BackOfficeGuard, headers: AuthorizationHeadersDto, detail: { hide: true } })
|
68
|
+
// ─── Test Dynamic data computation with a list of campaignId ───────────────────────
|
69
|
+
.post("/dynamic-data", async ({ body }) => {
|
70
|
+
const listCampaigns = [];
|
71
|
+
for (const campaignId of body) {
|
72
|
+
const id = (await CampaignService.findMany({ campaignId: campaignId, test: true }))?.[0]?.id;
|
73
|
+
if (!id)
|
74
|
+
throw new NotFoundError();
|
75
|
+
const campaign = await CampaignService.findUniqueOrThrow(id, true);
|
76
|
+
const campaignV3 = OpportunityConvertorService.convertV4CampaignToV3(Campaign[campaign.type], CampaignService.format(campaign), campaign.Opportunity.identifier);
|
77
|
+
listCampaigns.push(campaignV3);
|
78
|
+
}
|
79
|
+
return await DynamicDataService.updateForCampaigns(listCampaigns, true);
|
80
|
+
}, { beforeHandle: BackOfficeGuard, body: CampaignsDto, headers: AuthorizationHeadersDto, detail: { hide: true } })
|
68
81
|
// ─── Test Opportunity creation through a campaign Id and a chain ───────────────────────
|
69
82
|
// @dev Starts from the engine db to debug opportunity creation failing and preventing the api db to be filled
|
70
83
|
.get("/metadata", async ({ query }) => {
|
@@ -29,6 +29,7 @@ export declare const CampaignUniqueDto: import("@sinclair/typebox").TObject<{
|
|
29
29
|
distributionChain: import("@sinclair/typebox").TNumber;
|
30
30
|
campaignId: import("@sinclair/typebox").TString;
|
31
31
|
}>;
|
32
|
+
export declare const CampaignsDto: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
32
33
|
export declare const CampaignResourceDto: import("@sinclair/typebox").TObject<{
|
33
34
|
id: import("@sinclair/typebox").TString;
|
34
35
|
computeChainId: import("@sinclair/typebox").TNumber;
|
@@ -667,7 +667,8 @@ export declare abstract class OpportunityRepository {
|
|
667
667
|
/**
|
668
668
|
* @dev Live campaigns here can be:
|
669
669
|
* 1. Opportunities with status LIVE
|
670
|
-
* 2. Opportunities with campaigns that have endTimestamp > now
|
670
|
+
* 2. Opportunities with non-test campaigns that have endTimestamp > now
|
671
|
+
*
|
671
672
|
*/
|
672
673
|
static findLiveWithCampaigns(chainId: MerklChainId, take?: number): Promise<({
|
673
674
|
Chain: {
|
@@ -351,7 +351,8 @@ export class OpportunityRepository {
|
|
351
351
|
/**
|
352
352
|
* @dev Live campaigns here can be:
|
353
353
|
* 1. Opportunities with status LIVE
|
354
|
-
* 2. Opportunities with campaigns that have endTimestamp > now
|
354
|
+
* 2. Opportunities with non-test campaigns that have endTimestamp > now
|
355
|
+
*
|
355
356
|
*/
|
356
357
|
static async findLiveWithCampaigns(chainId, take) {
|
357
358
|
const now = moment().unix();
|
@@ -389,6 +390,7 @@ export class OpportunityRepository {
|
|
389
390
|
{
|
390
391
|
Campaigns: {
|
391
392
|
some: {
|
393
|
+
RewardToken: { isTest: false },
|
392
394
|
startTimestamp: {
|
393
395
|
lte: now,
|
394
396
|
},
|
@@ -3448,6 +3448,9 @@ const ModeInterfaceCampaigns = {
|
|
3448
3448
|
"0xe3C3A08AE41c36b204eF9a980f9eF5C579CC3f0f",
|
3449
3449
|
"0xd65EaCAed50706254b5001f22963C8615968AF7d",
|
3450
3450
|
"0xFdC4ba603B25Fbf2659a45cED114a205a4867457",
|
3451
|
+
"0xb837EDcf60C1CB6DF49111DF7fd28611b3321345",
|
3452
|
+
"0x0A19f7Ab7CF872A354994b82860d991d4451e39b",
|
3453
|
+
"0x210aECfbd69894DAF5006bF245F7235354E775C6",
|
3451
3454
|
],
|
3452
3455
|
url: "https://classic.bmx.trade/deli-shop/wrapper",
|
3453
3456
|
forwarders: [],
|
@@ -1150,6 +1150,22 @@ export declare const v4: Elysia<"/v4", false, {
|
|
1150
1150
|
};
|
1151
1151
|
};
|
1152
1152
|
};
|
1153
|
+
} & {
|
1154
|
+
"dry-run": {
|
1155
|
+
"dynamic-data": {
|
1156
|
+
post: {
|
1157
|
+
body: string[];
|
1158
|
+
params: {};
|
1159
|
+
query: unknown;
|
1160
|
+
headers: {
|
1161
|
+
authorization: string;
|
1162
|
+
};
|
1163
|
+
response: {
|
1164
|
+
200: unknown[];
|
1165
|
+
};
|
1166
|
+
};
|
1167
|
+
};
|
1168
|
+
};
|
1153
1169
|
} & {
|
1154
1170
|
"dry-run": {
|
1155
1171
|
metadata: {
|