@merkl/api 0.17.16 → 0.17.17
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 +76 -326
- package/dist/src/entities/opportunity.d.ts +3 -0
- package/dist/src/entities/opportunity.js +12 -4
- package/dist/src/errors/HttpError.d.ts +2 -2
- package/dist/src/index.d.ts +20 -74
- package/dist/src/jobs/etl/update-dynamic-data.js +2 -80
- package/dist/src/libs/getTokensList.d.ts +3 -0
- package/dist/src/libs/getTokensList.js +3 -1
- package/dist/src/libs/positions/clamm/thegraph/index.d.ts +3 -0
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +18 -0
- package/dist/src/modules/v4/campaign/campaign.controller.js +24 -0
- package/dist/src/modules/v4/campaign/campaign.repository.d.ts +16 -1
- package/dist/src/modules/v4/campaign/campaign.repository.js +2 -1
- package/dist/src/modules/v4/campaign/campaign.service.d.ts +16 -1
- package/dist/src/modules/v4/campaign/campaign.service.js +2 -2
- package/dist/src/modules/v4/dynamicData/dynamicData.controller.d.ts +0 -72
- package/dist/src/modules/v4/dynamicData/dynamicData.controller.js +1 -16
- package/dist/src/modules/v4/dynamicData/dynamicData.service.d.ts +4 -9
- package/dist/src/modules/v4/dynamicData/dynamicData.service.js +77 -81
- package/dist/src/modules/v4/router.d.ts +18 -72
- package/dist/src/routes/v3/app.d.ts +3 -0
- package/dist/src/routes/v3/app.js +3 -1
- package/dist/src/routes/v3/campaign/delay.d.ts +3 -0
- package/dist/src/routes/v3/campaign/delay.js +3 -1
- package/dist/src/routes/v3/campaignUnclaimed.d.ts +3 -0
- package/dist/src/routes/v3/campaignUnclaimed.js +3 -1
- package/dist/src/routes/v3/campaigns.d.ts +1 -1
- package/dist/src/routes/v3/campaignsForMainParameter.d.ts +3 -0
- package/dist/src/routes/v3/campaignsRewardsReport.d.ts +3 -0
- package/dist/src/routes/v3/campaignsRewardsReport.js +3 -1
- package/dist/src/routes/v3/recipients.d.ts +3 -0
- package/dist/src/routes/v3/recipients.js +3 -1
- package/dist/src/routes/v3/rewards.d.ts +3 -0
- package/dist/src/routes/v3/rewards.js +3 -1
- package/dist/src/routes/v3/rewardsReport.d.ts +3 -0
- package/dist/src/routes/v3/rewardsReport.js +3 -1
- package/dist/src/routes/v3/router.d.ts +2 -2
- package/dist/src/routes/v3/updates.d.ts +3 -0
- package/dist/src/routes/v3/userRewards.d.ts +5 -2
- package/dist/src/routes/v3/userRewards.js +4 -3
- package/dist/src/utils/prices/priceService.js +3 -1
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/src/index.d.ts
CHANGED
@@ -1145,6 +1145,24 @@ declare const app: Elysia<"", false, {
|
|
1145
1145
|
};
|
1146
1146
|
};
|
1147
1147
|
};
|
1148
|
+
} & {
|
1149
|
+
":campaignId": {
|
1150
|
+
"dynamic-data": {
|
1151
|
+
put: {
|
1152
|
+
body: unknown;
|
1153
|
+
params: {
|
1154
|
+
campaignId: string;
|
1155
|
+
};
|
1156
|
+
query: unknown;
|
1157
|
+
headers: {
|
1158
|
+
authorization: string;
|
1159
|
+
};
|
1160
|
+
response: {
|
1161
|
+
200: unknown[];
|
1162
|
+
};
|
1163
|
+
};
|
1164
|
+
};
|
1165
|
+
};
|
1148
1166
|
} & {
|
1149
1167
|
index: {
|
1150
1168
|
get: {
|
@@ -3313,78 +3331,6 @@ declare const app: Elysia<"", false, {
|
|
3313
3331
|
};
|
3314
3332
|
};
|
3315
3333
|
};
|
3316
|
-
} & {
|
3317
|
-
"dynamic-data": {
|
3318
|
-
"from-config": {
|
3319
|
-
post: {
|
3320
|
-
body: {
|
3321
|
-
id?: string | undefined;
|
3322
|
-
tags?: string[] | undefined;
|
3323
|
-
identifier?: string | undefined;
|
3324
|
-
subType?: number | undefined;
|
3325
|
-
chain?: {} | undefined;
|
3326
|
-
chainId?: number | undefined;
|
3327
|
-
startTimestamp?: string | undefined;
|
3328
|
-
endTimestamp?: string | undefined;
|
3329
|
-
distributionChainId?: number | undefined;
|
3330
|
-
campaignId?: string | undefined;
|
3331
|
-
rewardTokenId?: string | undefined;
|
3332
|
-
amount?: string | undefined;
|
3333
|
-
opportunityId?: string | undefined;
|
3334
|
-
creatorAddress?: string | undefined;
|
3335
|
-
campaignStatus?: {} | undefined;
|
3336
|
-
rewardToken?: {} | undefined;
|
3337
|
-
rewardTokenAddress?: string | undefined;
|
3338
|
-
distributionChain?: {} | undefined;
|
3339
|
-
opportunityIdentifier?: string | undefined;
|
3340
|
-
type: string;
|
3341
|
-
params: {};
|
3342
|
-
computeChainId: number;
|
3343
|
-
};
|
3344
|
-
params: {};
|
3345
|
-
query: unknown;
|
3346
|
-
headers: {
|
3347
|
-
authorization: string;
|
3348
|
-
};
|
3349
|
-
response: {
|
3350
|
-
200: any[];
|
3351
|
-
};
|
3352
|
-
};
|
3353
|
-
};
|
3354
|
-
};
|
3355
|
-
} & {
|
3356
|
-
"dynamic-data": {
|
3357
|
-
"from-existing": {
|
3358
|
-
get: {
|
3359
|
-
body: unknown;
|
3360
|
-
params: {};
|
3361
|
-
query: {
|
3362
|
-
type?: string | undefined;
|
3363
|
-
items?: number | undefined;
|
3364
|
-
subType?: number | undefined;
|
3365
|
-
page?: number | undefined;
|
3366
|
-
chainId?: number | undefined;
|
3367
|
-
startTimestamp?: string | undefined;
|
3368
|
-
endTimestamp?: string | undefined;
|
3369
|
-
tokenAddress?: string | undefined;
|
3370
|
-
campaignId?: string | undefined;
|
3371
|
-
opportunityId?: string | undefined;
|
3372
|
-
creatorAddress?: string | undefined;
|
3373
|
-
creatorId?: string | undefined;
|
3374
|
-
mainParameter?: string | undefined;
|
3375
|
-
test?: boolean | undefined;
|
3376
|
-
creatorTag?: string | undefined;
|
3377
|
-
tokenSymbol?: string | undefined;
|
3378
|
-
};
|
3379
|
-
headers: {
|
3380
|
-
authorization: string;
|
3381
|
-
};
|
3382
|
-
response: {
|
3383
|
-
200: any[];
|
3384
|
-
};
|
3385
|
-
};
|
3386
|
-
};
|
3387
|
-
};
|
3388
3334
|
};
|
3389
3335
|
} & {
|
3390
3336
|
v4: {
|
@@ -4275,8 +4221,8 @@ declare const app: Elysia<"", false, {
|
|
4275
4221
|
query: {
|
4276
4222
|
types?: string | number | string[] | number[] | undefined;
|
4277
4223
|
chainIds?: string | string[] | undefined;
|
4278
|
-
live?: boolean | undefined;
|
4279
4224
|
creatorTag?: string | undefined;
|
4225
|
+
live?: boolean | undefined;
|
4280
4226
|
hideTestTokens?: string | undefined;
|
4281
4227
|
};
|
4282
4228
|
headers: unknown;
|
@@ -4905,7 +4851,7 @@ declare const app: Elysia<"", false, {
|
|
4905
4851
|
proof?: string | undefined;
|
4906
4852
|
mainParameter?: string | undefined;
|
4907
4853
|
reloadChainId?: number | undefined;
|
4908
|
-
chainId:
|
4854
|
+
chainId: number;
|
4909
4855
|
user: string;
|
4910
4856
|
};
|
4911
4857
|
headers: unknown;
|
@@ -1,12 +1,6 @@
|
|
1
|
-
import { campaignsDynamicData } from "../../libs/campaigns/campaignsDynamicData";
|
2
|
-
import { AprService } from "../../modules/v4/apr";
|
3
1
|
import { CampaignService } from "../../modules/v4/campaign";
|
2
|
+
import { DynamicDataService } from "../../modules/v4/dynamicData/dynamicData.service";
|
4
3
|
import { OpportunityService } from "../../modules/v4/opportunity";
|
5
|
-
import { OpportunityRepository } from "../../modules/v4/opportunity/opportunity.repository";
|
6
|
-
import { RewardService } from "../../modules/v4/reward";
|
7
|
-
import { TvlService } from "../../modules/v4/tvl";
|
8
|
-
import { executeSimple } from "../../utils/execute";
|
9
|
-
import { log } from "../../utils/logger";
|
10
4
|
import { Campaign as CampaignEnum } from "@sdk";
|
11
5
|
import moment from "moment";
|
12
6
|
// ─── Required Env Variables ──────────────────────────────────────────────────
|
@@ -14,78 +8,6 @@ const chainId = Number(process.env.CHAIN_ID);
|
|
14
8
|
if (!chainId)
|
15
9
|
throw new Error("Environment variable CHAIN_ID is required.");
|
16
10
|
// ─── Update Dynamic Data (APR / TVL / Daily Rewards) ─────────────────────────
|
17
|
-
async function updateDynamicData(liveCampaigns, campaignType) {
|
18
|
-
// Input: list of campaigns of same type
|
19
|
-
// Output: for each campaign, APR, TVL, Daily Rewards
|
20
|
-
// Constraint: needs to use multicalls to reduce RPC calls and speed
|
21
|
-
// - Needs to be robust to a single campaign's call failing
|
22
|
-
// - Needs to be quite easy for the engine team to setup new campaign types
|
23
|
-
// abstract GenericDynamicDataComputer
|
24
|
-
// compute(chainId, type, campaigns) => { apr, tvl, dailyRewards } with breakdowns
|
25
|
-
// UNISWAP V4
|
26
|
-
// Round 1 - (chainId, type, campaigns) -> tokens of the pools
|
27
|
-
// Round 2 - (chainId, type, campaigns, output of previous round) -> balance in tokens of forwarders
|
28
|
-
// Round 3 - ...
|
29
|
-
// Round Final - (chainId, type, campaigns, output of previous round) -> { apr, tvl, dailyRewards }
|
30
|
-
const dynamicData = await executeSimple(chainId, campaignsDynamicData(chainId, liveCampaigns, campaignType));
|
31
|
-
const oppMap = {};
|
32
|
-
for (const data of dynamicData) {
|
33
|
-
if (!!data) {
|
34
|
-
// Main Parameter OVERRIDING
|
35
|
-
if (data.campaignType === CampaignEnum.SILO && data.campaignParameters.whitelist?.length === 1)
|
36
|
-
data.mainParameter = `${data.mainParameter}-${data.campaignParameters.whitelist[0]}`;
|
37
|
-
if (!oppMap[`${data.campaignType}_${data.mainParameter}`])
|
38
|
-
oppMap[`${data.campaignType}_${data.mainParameter}`] = {};
|
39
|
-
oppMap[`${data.campaignType}_${data.mainParameter}`][data.campaignId] = data;
|
40
|
-
}
|
41
|
-
}
|
42
|
-
for (const entry of Object.entries(oppMap)) {
|
43
|
-
const [type, mainParameter] = entry[0].split("_");
|
44
|
-
try {
|
45
|
-
const apr = AprService.extractFromDynamicData(+type, Object.values(entry[1]));
|
46
|
-
const tvl = TvlService.extractFromDynamicData(+type, Object.values(entry[1]));
|
47
|
-
const dailyRewards = await RewardService.extractDailyRewardsRecordFromDynamicData(+type, Object.values(entry[1]));
|
48
|
-
const opportunityId = OpportunityService.hashId({
|
49
|
-
chainId,
|
50
|
-
identifier: mainParameter,
|
51
|
-
type: CampaignEnum[campaignType],
|
52
|
-
});
|
53
|
-
await OpportunityRepository.updateRecords(opportunityId, apr, tvl, dailyRewards);
|
54
|
-
}
|
55
|
-
catch (err) {
|
56
|
-
console.error(err);
|
57
|
-
}
|
58
|
-
}
|
59
|
-
}
|
60
|
-
// ─── Get And Transform Live Campaigns Into A Map ─────────────────────────────
|
61
|
-
const buildMapByType = async (campaignsToUpdate) => {
|
62
|
-
const campaignTypeToCampaigns = new Map();
|
63
|
-
for (const campaign of campaignsToUpdate) {
|
64
|
-
const type = campaign.campaignType;
|
65
|
-
let campaigns = campaignTypeToCampaigns.get(campaign.campaignType);
|
66
|
-
if (!campaigns)
|
67
|
-
campaigns = [campaign];
|
68
|
-
else
|
69
|
-
campaigns.push(campaign);
|
70
|
-
campaignTypeToCampaigns.set(type, campaigns);
|
71
|
-
}
|
72
|
-
return campaignTypeToCampaigns;
|
73
|
-
};
|
74
|
-
// ─── Main function / entry point ─────────────────────────────────────────────
|
75
|
-
const updateCampaigns = async (campaignsToUpdate) => {
|
76
|
-
// 1. Get a map of campaigns by campaign type
|
77
|
-
const campaignTypeToCampaigns = await buildMapByType(campaignsToUpdate);
|
78
|
-
// 2. Call updateDynamicData with each entries of the map (process by campaign type)
|
79
|
-
for (const [campaignType, campaigns] of campaignTypeToCampaigns.entries()) {
|
80
|
-
log.info(`updating dynamic data for ${campaigns.length} campaigns of type ${CampaignEnum[campaignType]}`);
|
81
|
-
try {
|
82
|
-
await updateDynamicData(campaigns, campaignType);
|
83
|
-
}
|
84
|
-
catch (err) {
|
85
|
-
console.error(`Failed to update dynamic data for campaign type ${CampaignEnum[campaignType]}`, err);
|
86
|
-
}
|
87
|
-
}
|
88
|
-
};
|
89
11
|
const main = async () => {
|
90
12
|
const liveCampaigns = (await CampaignService.getLiveCampaigns({ computeChainId: chainId })).map(c => {
|
91
13
|
return {
|
@@ -104,7 +26,7 @@ const main = async () => {
|
|
104
26
|
index: 0,
|
105
27
|
};
|
106
28
|
});
|
107
|
-
await
|
29
|
+
await DynamicDataService.updateForCampaigns(liveCampaigns);
|
108
30
|
// Update status of opportunities
|
109
31
|
// 1. Get current live opportunities
|
110
32
|
const liveOpportunities = await OpportunityService.findLiveWithCampaigns(chainId);
|
@@ -106,6 +106,24 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
|
|
106
106
|
};
|
107
107
|
};
|
108
108
|
};
|
109
|
+
} & {
|
110
|
+
":campaignId": {
|
111
|
+
"dynamic-data": {
|
112
|
+
put: {
|
113
|
+
body: unknown;
|
114
|
+
params: {
|
115
|
+
campaignId: string;
|
116
|
+
};
|
117
|
+
query: unknown;
|
118
|
+
headers: {
|
119
|
+
authorization: string;
|
120
|
+
};
|
121
|
+
response: {
|
122
|
+
200: unknown[];
|
123
|
+
};
|
124
|
+
};
|
125
|
+
};
|
126
|
+
};
|
109
127
|
} & {
|
110
128
|
index: {
|
111
129
|
get: {
|
@@ -4,6 +4,8 @@ import { AuthorizationHeadersDto, EngineGuard } from "../../../guards/Engine.gua
|
|
4
4
|
import { ChainUniqueDto } from "../chain/chain.model";
|
5
5
|
import Elysia, { t } from "elysia";
|
6
6
|
import { throwOnUnsupportedChainId } from "src/utils/throw";
|
7
|
+
import { Campaign } from "@sdk";
|
8
|
+
import { DynamicDataService } from "../dynamicData/dynamicData.service";
|
7
9
|
import { CampaignResourceDto, CreateCampaignDto, GetCampaignQueryDto, UpdateCampaignDto, UpdateMetaDataCampaignDto, } from "./campaign.model";
|
8
10
|
import { CampaignService } from "./campaign.service";
|
9
11
|
// ─── Campaigns Controller ────────────────────────────────────────────────────
|
@@ -27,6 +29,28 @@ export const CampaignController = new Elysia({ prefix: "/campaigns", detail: { t
|
|
27
29
|
body: UpdateMetaDataCampaignDto,
|
28
30
|
detail: { hide: true },
|
29
31
|
})
|
32
|
+
.put("/:campaignId/dynamic-data", async ({ params }) => {
|
33
|
+
const id = (await CampaignService.findMany({ campaignId: params.campaignId }))[0].id;
|
34
|
+
if (!id)
|
35
|
+
throw new NotFoundError();
|
36
|
+
const campaign = await CampaignService.findUniqueOrThrow(id, true);
|
37
|
+
const campaignV3 = {
|
38
|
+
amount: campaign.amount,
|
39
|
+
campaignId: campaign.campaignId,
|
40
|
+
mainParameter: campaign.Opportunity.identifier,
|
41
|
+
campaignParameters: campaign.params,
|
42
|
+
campaignSubType: campaign.subType,
|
43
|
+
campaignType: Campaign[campaign.type],
|
44
|
+
chainId: campaign.distributionChainId,
|
45
|
+
computeChainId: campaign.computeChainId,
|
46
|
+
creator: campaign.creatorAddress,
|
47
|
+
endTimestamp: Number(campaign.endTimestamp),
|
48
|
+
rewardToken: campaign.RewardToken.address,
|
49
|
+
startTimestamp: Number(campaign.startTimestamp),
|
50
|
+
index: 0,
|
51
|
+
};
|
52
|
+
return await DynamicDataService.updateForCampaigns([campaignV3]);
|
53
|
+
}, { beforeHandle: BackOfficeGuard, headers: AuthorizationHeadersDto, detail: { hide: true } })
|
30
54
|
// ─── Get Many Campaigns ──────────────────────────────────────────────
|
31
55
|
.get("/", async ({ query }) => await CampaignService.findMany(query), {
|
32
56
|
query: GetCampaignQueryDto,
|
@@ -268,7 +268,7 @@ export declare abstract class CampaignRepository {
|
|
268
268
|
opportunityId: string;
|
269
269
|
creatorAddress: string;
|
270
270
|
} | null>;
|
271
|
-
static findUniqueOrThrow(id: string): Promise<{
|
271
|
+
static findUniqueOrThrow(id: string, withOpportunity: boolean): Promise<{
|
272
272
|
ComputeChain: {
|
273
273
|
name: string;
|
274
274
|
id: number;
|
@@ -292,6 +292,21 @@ export declare abstract class CampaignRepository {
|
|
292
292
|
isTest: boolean;
|
293
293
|
price: number | null;
|
294
294
|
};
|
295
|
+
Opportunity: {
|
296
|
+
name: string;
|
297
|
+
type: string;
|
298
|
+
id: string;
|
299
|
+
status: import("../../../../database/api/.generated").$Enums.Status;
|
300
|
+
tags: string[];
|
301
|
+
identifier: string;
|
302
|
+
chainId: number;
|
303
|
+
action: import("../../../../database/api/.generated").$Enums.OpportunityAction;
|
304
|
+
depositUrl: string | null;
|
305
|
+
mainProtocolId: string | null;
|
306
|
+
tvl: number;
|
307
|
+
apr: number;
|
308
|
+
dailyRewards: number;
|
309
|
+
};
|
295
310
|
Creator: {
|
296
311
|
tags: string[];
|
297
312
|
address: string;
|
@@ -308,9 +308,10 @@ export class CampaignRepository {
|
|
308
308
|
},
|
309
309
|
});
|
310
310
|
}
|
311
|
-
static async findUniqueOrThrow(id) {
|
311
|
+
static async findUniqueOrThrow(id, withOpportunity) {
|
312
312
|
return await apiDbClient.campaign.findUniqueOrThrow({
|
313
313
|
include: {
|
314
|
+
Opportunity: withOpportunity,
|
314
315
|
DistributionChain: true,
|
315
316
|
ComputeChain: true,
|
316
317
|
RewardToken: true,
|
@@ -228,7 +228,7 @@ export declare abstract class CampaignService {
|
|
228
228
|
opportunityId: string;
|
229
229
|
creatorAddress: string;
|
230
230
|
} | null>;
|
231
|
-
static findUniqueOrThrow(campaign: CampaignUnique | string): Promise<{
|
231
|
+
static findUniqueOrThrow(campaign: CampaignUnique | string, withOpportunity?: boolean): Promise<{
|
232
232
|
ComputeChain: {
|
233
233
|
name: string;
|
234
234
|
id: number;
|
@@ -252,6 +252,21 @@ export declare abstract class CampaignService {
|
|
252
252
|
isTest: boolean;
|
253
253
|
price: number | null;
|
254
254
|
};
|
255
|
+
Opportunity: {
|
256
|
+
name: string;
|
257
|
+
type: string;
|
258
|
+
id: string;
|
259
|
+
status: import("../../../../database/api/.generated").$Enums.Status;
|
260
|
+
tags: string[];
|
261
|
+
identifier: string;
|
262
|
+
chainId: number;
|
263
|
+
action: import("../../../../database/api/.generated").$Enums.OpportunityAction;
|
264
|
+
depositUrl: string | null;
|
265
|
+
mainProtocolId: string | null;
|
266
|
+
tvl: number;
|
267
|
+
apr: number;
|
268
|
+
dailyRewards: number;
|
269
|
+
};
|
255
270
|
Creator: {
|
256
271
|
tags: string[];
|
257
272
|
address: string;
|
@@ -159,9 +159,9 @@ export class CampaignService {
|
|
159
159
|
const id = typeof campaign === "string" ? campaign : CampaignService.hashId(campaign);
|
160
160
|
return await CampaignRepository.findUnique(id);
|
161
161
|
}
|
162
|
-
static async findUniqueOrThrow(campaign) {
|
162
|
+
static async findUniqueOrThrow(campaign, withOpportunity = false) {
|
163
163
|
const id = typeof campaign === "string" ? campaign : CampaignService.hashId(campaign);
|
164
|
-
return await CampaignRepository.findUniqueOrThrow(id);
|
164
|
+
return await CampaignRepository.findUniqueOrThrow(id, withOpportunity);
|
165
165
|
}
|
166
166
|
static async findCampaignsToProcess(distributionChainId) {
|
167
167
|
return (await CampaignRepository.findCampaignsToProcess(distributionChainId))
|
@@ -38,78 +38,6 @@ export declare const DynamicDataController: Elysia<"/dynamic-data", false, {
|
|
38
38
|
};
|
39
39
|
};
|
40
40
|
};
|
41
|
-
} & {
|
42
|
-
"dynamic-data": {
|
43
|
-
"from-config": {
|
44
|
-
post: {
|
45
|
-
body: {
|
46
|
-
id?: string | undefined;
|
47
|
-
tags?: string[] | undefined;
|
48
|
-
identifier?: string | undefined;
|
49
|
-
subType?: number | undefined;
|
50
|
-
chain?: {} | undefined;
|
51
|
-
chainId?: number | undefined;
|
52
|
-
startTimestamp?: string | undefined;
|
53
|
-
endTimestamp?: string | undefined;
|
54
|
-
distributionChainId?: number | undefined;
|
55
|
-
campaignId?: string | undefined;
|
56
|
-
rewardTokenId?: string | undefined;
|
57
|
-
amount?: string | undefined;
|
58
|
-
opportunityId?: string | undefined;
|
59
|
-
creatorAddress?: string | undefined;
|
60
|
-
campaignStatus?: {} | undefined;
|
61
|
-
rewardToken?: {} | undefined;
|
62
|
-
rewardTokenAddress?: string | undefined;
|
63
|
-
distributionChain?: {} | undefined;
|
64
|
-
opportunityIdentifier?: string | undefined;
|
65
|
-
type: string;
|
66
|
-
params: {};
|
67
|
-
computeChainId: number;
|
68
|
-
};
|
69
|
-
params: {};
|
70
|
-
query: unknown;
|
71
|
-
headers: {
|
72
|
-
authorization: string;
|
73
|
-
};
|
74
|
-
response: {
|
75
|
-
200: any[];
|
76
|
-
};
|
77
|
-
};
|
78
|
-
};
|
79
|
-
};
|
80
|
-
} & {
|
81
|
-
"dynamic-data": {
|
82
|
-
"from-existing": {
|
83
|
-
get: {
|
84
|
-
body: unknown;
|
85
|
-
params: {};
|
86
|
-
query: {
|
87
|
-
type?: string | undefined;
|
88
|
-
items?: number | undefined;
|
89
|
-
subType?: number | undefined;
|
90
|
-
page?: number | undefined;
|
91
|
-
chainId?: number | undefined;
|
92
|
-
startTimestamp?: string | undefined;
|
93
|
-
endTimestamp?: string | undefined;
|
94
|
-
tokenAddress?: string | undefined;
|
95
|
-
campaignId?: string | undefined;
|
96
|
-
opportunityId?: string | undefined;
|
97
|
-
creatorAddress?: string | undefined;
|
98
|
-
creatorId?: string | undefined;
|
99
|
-
mainParameter?: string | undefined;
|
100
|
-
test?: boolean | undefined;
|
101
|
-
creatorTag?: string | undefined;
|
102
|
-
tokenSymbol?: string | undefined;
|
103
|
-
};
|
104
|
-
headers: {
|
105
|
-
authorization: string;
|
106
|
-
};
|
107
|
-
response: {
|
108
|
-
200: any[];
|
109
|
-
};
|
110
|
-
};
|
111
|
-
};
|
112
|
-
};
|
113
41
|
}, {
|
114
42
|
derive: {};
|
115
43
|
resolve: {};
|
@@ -1,8 +1,7 @@
|
|
1
1
|
import { AuthorizationHeadersDto, BackOfficeGuard } from "../../../guards/BackOffice.guard";
|
2
2
|
import Elysia from "elysia";
|
3
3
|
import { throwOnUnsupportedChainId } from "src/utils/throw";
|
4
|
-
import {
|
5
|
-
import { DynamicDataSourceIdentifier, SimplifiedCampaignDto } from "./dynamicData.model";
|
4
|
+
import { DynamicDataSourceIdentifier } from "./dynamicData.model";
|
6
5
|
import { DynamicDataService } from "./dynamicData.service";
|
7
6
|
// ─── DynamicDatas Controller ───────────────────────────────────────────────────────
|
8
7
|
export const DynamicDataController = new Elysia({
|
@@ -17,18 +16,4 @@ export const DynamicDataController = new Elysia({
|
|
17
16
|
await BackOfficeGuard({ headers });
|
18
17
|
throwOnUnsupportedChainId(query.chainId);
|
19
18
|
},
|
20
|
-
})
|
21
|
-
.post("/from-config", async ({ body }) => await DynamicDataService.queryDynamicData(body), {
|
22
|
-
body: SimplifiedCampaignDto,
|
23
|
-
headers: AuthorizationHeadersDto,
|
24
|
-
beforeHandle: async ({ headers }) => {
|
25
|
-
await BackOfficeGuard({ headers });
|
26
|
-
},
|
27
|
-
})
|
28
|
-
.get("/from-existing", async ({ query }) => await DynamicDataService.queryDynamicDataFromManyCampaignId(query), {
|
29
|
-
query: GetCampaignQueryDto,
|
30
|
-
headers: AuthorizationHeadersDto,
|
31
|
-
beforeHandle: async ({ headers }) => {
|
32
|
-
await BackOfficeGuard({ headers });
|
33
|
-
},
|
34
19
|
});
|
@@ -1,8 +1,6 @@
|
|
1
|
-
import { type ChainId } from "@sdk";
|
2
|
-
import
|
3
|
-
import type { FilledCampaignDtoModel, SimplifiedCampaignDtoModel } from "./dynamicData.model";
|
1
|
+
import { Campaign, type CampaignParameters, type ChainId } from "@sdk";
|
2
|
+
import { Campaign as CampaignEnum } from "@sdk";
|
4
3
|
export declare class DynamicDataService {
|
5
|
-
#private;
|
6
4
|
static queryERC20DynamicData(chainId: ChainId, tokenAddress: string, decimals?: number): Promise<{
|
7
5
|
tvl: number;
|
8
6
|
totalSupply: number;
|
@@ -11,9 +9,6 @@ export declare class DynamicDataService {
|
|
11
9
|
priceTargetToken: number;
|
12
10
|
type: string;
|
13
11
|
}>;
|
14
|
-
static
|
15
|
-
static
|
16
|
-
static queryDynamicData(campaign: SimplifiedCampaignDtoModel): Promise<any[]>;
|
17
|
-
static queryDynamicDataFromCampaignId(query: GetCampaignQueryModel): Promise<any[]>;
|
18
|
-
static queryDynamicDataFromManyCampaignId(query: GetCampaignQueryModel): Promise<any[]>;
|
12
|
+
static updateForCampaignType(campaigns: CampaignParameters<CampaignEnum>[], type: Campaign): Promise<unknown[]>;
|
13
|
+
static updateForCampaigns(campaigns: CampaignParameters<CampaignEnum>[]): Promise<unknown[]>;
|
19
14
|
}
|