@merkl/api 0.17.8 → 0.17.10
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 +187 -137
- package/dist/src/index.d.ts +36 -26
- package/dist/src/jobs/etl/update-dynamic-data.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/MORPHODynamicData.js +23 -31
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +12 -12
- package/dist/src/modules/v4/campaign/campaign.controller.js +1 -0
- package/dist/src/modules/v4/campaign/campaign.model.d.ts +19 -7
- package/dist/src/modules/v4/campaign/campaign.model.js +7 -2
- package/dist/src/modules/v4/campaign/campaign.service.d.ts +13 -13
- package/dist/src/modules/v4/campaign/campaign.service.js +6 -3
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +24 -14
- package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +9 -4
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +36 -26
- package/dist/src/modules/v4/router.d.ts +36 -26
- package/dist/src/modules/v4/status/status.model.d.ts +6 -3
- package/dist/src/modules/v4/status/status.model.js +2 -2
- package/dist/src/modules/v4/status/status.service.d.ts +9 -1
- package/dist/src/modules/v4/status/status.service.js +7 -0
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/src/index.d.ts
CHANGED
@@ -328,6 +328,8 @@ declare const app: Elysia<"", false, {
|
|
328
328
|
id: number;
|
329
329
|
icon: string;
|
330
330
|
};
|
331
|
+
endTimestamp: number;
|
332
|
+
startTimestamp: number;
|
331
333
|
rewardToken: {
|
332
334
|
symbol: string;
|
333
335
|
name: string | null;
|
@@ -347,15 +349,15 @@ declare const app: Elysia<"", false, {
|
|
347
349
|
icon: string;
|
348
350
|
} | undefined;
|
349
351
|
campaignStatus: {
|
352
|
+
computedUntil: number;
|
353
|
+
processingStarted: number;
|
350
354
|
error: string;
|
351
355
|
details: import("database/api/.generated/runtime/library").JsonValue;
|
352
356
|
status: import("../database/api/.generated").$Enums.RunStatus;
|
353
357
|
campaignId: string;
|
354
|
-
|
355
|
-
processingStarted: bigint;
|
356
|
-
};
|
358
|
+
} | undefined;
|
357
359
|
creatorAddress: string;
|
358
|
-
|
360
|
+
creator: {
|
359
361
|
tags: string[];
|
360
362
|
address: string;
|
361
363
|
creatorId: string | null;
|
@@ -363,8 +365,6 @@ declare const app: Elysia<"", false, {
|
|
363
365
|
type: string;
|
364
366
|
id: string;
|
365
367
|
subType: number | null;
|
366
|
-
startTimestamp: bigint;
|
367
|
-
endTimestamp: bigint;
|
368
368
|
computeChainId: number;
|
369
369
|
distributionChainId: number;
|
370
370
|
campaignId: string;
|
@@ -668,13 +668,18 @@ declare const app: Elysia<"", false, {
|
|
668
668
|
apr: number;
|
669
669
|
dailyRewards: number;
|
670
670
|
campaigns: {
|
671
|
+
creator?: {
|
672
|
+
tags?: string[] | undefined;
|
673
|
+
creatorId?: string | null | undefined;
|
674
|
+
address: string;
|
675
|
+
} | undefined;
|
671
676
|
campaignStatus?: {
|
672
677
|
error?: string | undefined;
|
673
678
|
details?: any;
|
674
679
|
status: string;
|
675
680
|
campaignId: string;
|
676
|
-
computedUntil: string |
|
677
|
-
processingStarted: string |
|
681
|
+
computedUntil: string | number;
|
682
|
+
processingStarted: string | number;
|
678
683
|
} | undefined;
|
679
684
|
distributionChain?: {
|
680
685
|
name: string;
|
@@ -690,8 +695,8 @@ declare const app: Elysia<"", false, {
|
|
690
695
|
id: number;
|
691
696
|
icon: string;
|
692
697
|
};
|
693
|
-
startTimestamp: string |
|
694
|
-
endTimestamp: string |
|
698
|
+
startTimestamp: string | number;
|
699
|
+
endTimestamp: string | number;
|
695
700
|
computeChainId: number;
|
696
701
|
distributionChainId: number;
|
697
702
|
campaignId: string;
|
@@ -825,13 +830,18 @@ declare const app: Elysia<"", false, {
|
|
825
830
|
apr: number;
|
826
831
|
dailyRewards: number;
|
827
832
|
campaigns: {
|
833
|
+
creator?: {
|
834
|
+
tags?: string[] | undefined;
|
835
|
+
creatorId?: string | null | undefined;
|
836
|
+
address: string;
|
837
|
+
} | undefined;
|
828
838
|
campaignStatus?: {
|
829
839
|
error?: string | undefined;
|
830
840
|
details?: any;
|
831
841
|
status: string;
|
832
842
|
campaignId: string;
|
833
|
-
computedUntil: string |
|
834
|
-
processingStarted: string |
|
843
|
+
computedUntil: string | number;
|
844
|
+
processingStarted: string | number;
|
835
845
|
} | undefined;
|
836
846
|
distributionChain?: {
|
837
847
|
name: string;
|
@@ -847,8 +857,8 @@ declare const app: Elysia<"", false, {
|
|
847
857
|
id: number;
|
848
858
|
icon: string;
|
849
859
|
};
|
850
|
-
startTimestamp: string |
|
851
|
-
endTimestamp: string |
|
860
|
+
startTimestamp: string | number;
|
861
|
+
endTimestamp: string | number;
|
852
862
|
computeChainId: number;
|
853
863
|
distributionChainId: number;
|
854
864
|
campaignId: string;
|
@@ -1167,6 +1177,8 @@ declare const app: Elysia<"", false, {
|
|
1167
1177
|
id: number;
|
1168
1178
|
icon: string;
|
1169
1179
|
};
|
1180
|
+
endTimestamp: number;
|
1181
|
+
startTimestamp: number;
|
1170
1182
|
rewardToken: {
|
1171
1183
|
symbol: string;
|
1172
1184
|
name: string | null;
|
@@ -1186,15 +1198,15 @@ declare const app: Elysia<"", false, {
|
|
1186
1198
|
icon: string;
|
1187
1199
|
} | undefined;
|
1188
1200
|
campaignStatus: {
|
1201
|
+
computedUntil: number;
|
1202
|
+
processingStarted: number;
|
1189
1203
|
error: string;
|
1190
1204
|
details: import("database/api/.generated/runtime/library").JsonValue;
|
1191
1205
|
status: import("../database/api/.generated").$Enums.RunStatus;
|
1192
1206
|
campaignId: string;
|
1193
|
-
|
1194
|
-
processingStarted: bigint;
|
1195
|
-
};
|
1207
|
+
} | undefined;
|
1196
1208
|
creatorAddress: string;
|
1197
|
-
|
1209
|
+
creator: {
|
1198
1210
|
tags: string[];
|
1199
1211
|
address: string;
|
1200
1212
|
creatorId: string | null;
|
@@ -1202,8 +1214,6 @@ declare const app: Elysia<"", false, {
|
|
1202
1214
|
type: string;
|
1203
1215
|
id: string;
|
1204
1216
|
subType: number | null;
|
1205
|
-
startTimestamp: bigint;
|
1206
|
-
endTimestamp: bigint;
|
1207
1217
|
computeChainId: number;
|
1208
1218
|
distributionChainId: number;
|
1209
1219
|
campaignId: string;
|
@@ -1231,6 +1241,8 @@ declare const app: Elysia<"", false, {
|
|
1231
1241
|
id: number;
|
1232
1242
|
icon: string;
|
1233
1243
|
};
|
1244
|
+
endTimestamp: number;
|
1245
|
+
startTimestamp: number;
|
1234
1246
|
rewardToken: {
|
1235
1247
|
symbol: string;
|
1236
1248
|
name: string | null;
|
@@ -1250,15 +1262,15 @@ declare const app: Elysia<"", false, {
|
|
1250
1262
|
icon: string;
|
1251
1263
|
} | undefined;
|
1252
1264
|
campaignStatus: {
|
1265
|
+
computedUntil: number;
|
1266
|
+
processingStarted: number;
|
1253
1267
|
error: string;
|
1254
1268
|
details: import("database/api/.generated/runtime/library").JsonValue;
|
1255
1269
|
status: import("../database/api/.generated").$Enums.RunStatus;
|
1256
1270
|
campaignId: string;
|
1257
|
-
|
1258
|
-
processingStarted: bigint;
|
1259
|
-
};
|
1271
|
+
} | undefined;
|
1260
1272
|
creatorAddress: string;
|
1261
|
-
|
1273
|
+
creator: {
|
1262
1274
|
tags: string[];
|
1263
1275
|
address: string;
|
1264
1276
|
creatorId: string | null;
|
@@ -1266,8 +1278,6 @@ declare const app: Elysia<"", false, {
|
|
1266
1278
|
type: string;
|
1267
1279
|
id: string;
|
1268
1280
|
subType: number | null;
|
1269
|
-
startTimestamp: bigint;
|
1270
|
-
endTimestamp: bigint;
|
1271
1281
|
computeChainId: number;
|
1272
1282
|
distributionChainId: number;
|
1273
1283
|
campaignId: string;
|
@@ -48,7 +48,7 @@ async function updateDynamicData(liveCampaigns, campaignType) {
|
|
48
48
|
const opportunityId = OpportunityService.hashId({
|
49
49
|
chainId,
|
50
50
|
identifier: mainParameter,
|
51
|
-
type:
|
51
|
+
type: CampaignEnum[campaignType],
|
52
52
|
});
|
53
53
|
await OpportunityRepository.updateRecords(opportunityId, apr, tvl, dailyRewards);
|
54
54
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { BN2Number, MorphoSubCampaignType, YEAR, } from "@sdk";
|
1
|
+
import { BN2Number, MetamorphoInterface, MorphoSubCampaignType, YEAR, } from "@sdk";
|
2
2
|
import { Pricer } from "../../../utils/pricer";
|
3
3
|
const axios = require("axios");
|
4
4
|
export async function MORPHODynamicData(chainId, campaigns) {
|
@@ -8,6 +8,19 @@ export async function MORPHODynamicData(chainId, campaigns) {
|
|
8
8
|
const headers = {
|
9
9
|
"content-type": "application/json",
|
10
10
|
};
|
11
|
+
for (const campaign of campaigns) {
|
12
|
+
if (campaign.subType === MorphoSubCampaignType.META) {
|
13
|
+
calls.push({
|
14
|
+
allowFailure: true,
|
15
|
+
callData: MetamorphoInterface.encodeFunctionData("totalAssets"),
|
16
|
+
target: campaign.campaignParameters.targetToken,
|
17
|
+
}, {
|
18
|
+
allowFailure: true,
|
19
|
+
callData: MetamorphoInterface.encodeFunctionData("totalSupply"),
|
20
|
+
target: campaign.campaignParameters.targetToken,
|
21
|
+
});
|
22
|
+
}
|
23
|
+
}
|
11
24
|
return {
|
12
25
|
cached: false,
|
13
26
|
call: {
|
@@ -23,36 +36,15 @@ export async function MORPHODynamicData(chainId, campaigns) {
|
|
23
36
|
})) ?? 0;
|
24
37
|
let tvl = 0;
|
25
38
|
let totalSupplyTargetToken = 0;
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
}
|
36
|
-
}
|
37
|
-
`,
|
38
|
-
variables: {
|
39
|
-
address: campaign.campaignParameters.targetToken,
|
40
|
-
chainId: campaign.computeChainId,
|
41
|
-
},
|
42
|
-
};
|
43
|
-
try {
|
44
|
-
const response = await axios({
|
45
|
-
url: endpoint,
|
46
|
-
method: "post",
|
47
|
-
headers: headers,
|
48
|
-
data: graphqlQueryVaults,
|
49
|
-
});
|
50
|
-
tvl = response.data.data.vaultByAddress.state.totalAssetsUsd;
|
51
|
-
totalSupplyTargetToken = response.data.data.vaultByAddress.state.totalAssets;
|
52
|
-
}
|
53
|
-
catch (e) {
|
54
|
-
console.log(e);
|
55
|
-
}
|
39
|
+
let index = 0;
|
40
|
+
if (campaign.subType === MorphoSubCampaignType.META) {
|
41
|
+
const totalAssets = BN2Number(MetamorphoInterface.decodeFunctionResult("totalAssets", result[index++])[0], campaign.campaignParameters.decimalsUnderlyingToken);
|
42
|
+
const totalSupply = BN2Number(MetamorphoInterface.decodeFunctionResult("totalSupply", result[index++])[0], campaign.campaignParameters.decimalsTargetToken);
|
43
|
+
const priceAsset = (await pricer.get({
|
44
|
+
symbol: campaign.campaignParameters.symbolUnderlyingToken,
|
45
|
+
})) ?? 0;
|
46
|
+
tvl = priceAsset * totalAssets;
|
47
|
+
totalSupplyTargetToken = totalSupply;
|
56
48
|
}
|
57
49
|
if (campaign.campaignSubType === MorphoSubCampaignType.SUPPLY_BLUE ||
|
58
50
|
campaign.campaignSubType === MorphoSubCampaignType.BORROWING_BLUE ||
|
@@ -138,6 +138,8 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
|
|
138
138
|
id: number;
|
139
139
|
icon: string;
|
140
140
|
};
|
141
|
+
endTimestamp: number;
|
142
|
+
startTimestamp: number;
|
141
143
|
rewardToken: {
|
142
144
|
symbol: string;
|
143
145
|
name: string | null;
|
@@ -157,15 +159,15 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
|
|
157
159
|
icon: string;
|
158
160
|
} | undefined;
|
159
161
|
campaignStatus: {
|
162
|
+
computedUntil: number;
|
163
|
+
processingStarted: number;
|
160
164
|
error: string;
|
161
165
|
details: import("database/api/.generated/runtime/library").JsonValue;
|
162
166
|
status: import("../../../../database/api/.generated").$Enums.RunStatus;
|
163
167
|
campaignId: string;
|
164
|
-
|
165
|
-
processingStarted: bigint;
|
166
|
-
};
|
168
|
+
} | undefined;
|
167
169
|
creatorAddress: string;
|
168
|
-
|
170
|
+
creator: {
|
169
171
|
tags: string[];
|
170
172
|
address: string;
|
171
173
|
creatorId: string | null;
|
@@ -173,8 +175,6 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
|
|
173
175
|
type: string;
|
174
176
|
id: string;
|
175
177
|
subType: number | null;
|
176
|
-
startTimestamp: bigint;
|
177
|
-
endTimestamp: bigint;
|
178
178
|
computeChainId: number;
|
179
179
|
distributionChainId: number;
|
180
180
|
campaignId: string;
|
@@ -202,6 +202,8 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
|
|
202
202
|
id: number;
|
203
203
|
icon: string;
|
204
204
|
};
|
205
|
+
endTimestamp: number;
|
206
|
+
startTimestamp: number;
|
205
207
|
rewardToken: {
|
206
208
|
symbol: string;
|
207
209
|
name: string | null;
|
@@ -221,15 +223,15 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
|
|
221
223
|
icon: string;
|
222
224
|
} | undefined;
|
223
225
|
campaignStatus: {
|
226
|
+
computedUntil: number;
|
227
|
+
processingStarted: number;
|
224
228
|
error: string;
|
225
229
|
details: import("database/api/.generated/runtime/library").JsonValue;
|
226
230
|
status: import("../../../../database/api/.generated").$Enums.RunStatus;
|
227
231
|
campaignId: string;
|
228
|
-
|
229
|
-
processingStarted: bigint;
|
230
|
-
};
|
232
|
+
} | undefined;
|
231
233
|
creatorAddress: string;
|
232
|
-
|
234
|
+
creator: {
|
233
235
|
tags: string[];
|
234
236
|
address: string;
|
235
237
|
creatorId: string | null;
|
@@ -237,8 +239,6 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
|
|
237
239
|
type: string;
|
238
240
|
id: string;
|
239
241
|
subType: number | null;
|
240
|
-
startTimestamp: bigint;
|
241
|
-
endTimestamp: bigint;
|
242
242
|
computeChainId: number;
|
243
243
|
distributionChainId: number;
|
244
244
|
campaignId: string;
|
@@ -45,6 +45,7 @@ export const CampaignController = new Elysia({ prefix: "/campaigns", detail: { t
|
|
45
45
|
return CampaignService.format(await CampaignService.findUniqueOrThrow({ distributionChain: +distributionChain, campaignId }));
|
46
46
|
}
|
47
47
|
catch (_err) {
|
48
|
+
console.log(_err);
|
48
49
|
throw new NotFoundError("Campaign not found.");
|
49
50
|
}
|
50
51
|
}, {
|
@@ -8,15 +8,22 @@ import { type Status } from "../status/status.model";
|
|
8
8
|
* @description Target description of rewards campaigns
|
9
9
|
* @see {@link Resource}
|
10
10
|
*/
|
11
|
-
export type Campaign = Resource<"Campaign", "opportunityId" | "rewardTokenId"
|
11
|
+
export type Campaign = Resource<"Campaign", "opportunityId" | "rewardTokenId", {
|
12
12
|
chain: Chain["model"];
|
13
13
|
rewardToken: Token["model"];
|
14
14
|
distributionChain?: Chain["model"];
|
15
15
|
campaignStatus?: Status["model"];
|
16
|
+
creator?: {
|
17
|
+
address: string;
|
18
|
+
tags?: string[];
|
19
|
+
creatorId: string | null;
|
20
|
+
};
|
21
|
+
endTimestamp: number;
|
22
|
+
startTimestamp: number;
|
16
23
|
}>;
|
17
|
-
export type CampaignWithParams<C extends CampaignEnum = CampaignEnum> = Campaign
|
24
|
+
export type CampaignWithParams<C extends CampaignEnum = CampaignEnum> = Campaign["model"] & {
|
18
25
|
params: CampaignParameters<C>["campaignParameters"];
|
19
|
-
}
|
26
|
+
};
|
20
27
|
export declare const CampaignUniqueDto: import("@sinclair/typebox").TObject<{
|
21
28
|
distributionChain: import("@sinclair/typebox").TNumber;
|
22
29
|
campaignId: import("@sinclair/typebox").TString;
|
@@ -31,9 +38,14 @@ export declare const CampaignResourceDto: import("@sinclair/typebox").TObject<{
|
|
31
38
|
rewardTokenId: import("@sinclair/typebox").TString;
|
32
39
|
amount: import("@sinclair/typebox").TString;
|
33
40
|
opportunityId: import("@sinclair/typebox").TString;
|
34
|
-
startTimestamp: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").
|
35
|
-
endTimestamp: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").
|
41
|
+
startTimestamp: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber]>;
|
42
|
+
endTimestamp: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber]>;
|
36
43
|
creatorAddress: import("@sinclair/typebox").TString;
|
44
|
+
creator: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
45
|
+
address: import("@sinclair/typebox").TString;
|
46
|
+
tags: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
47
|
+
creatorId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>>;
|
48
|
+
}>>;
|
37
49
|
params: import("@sinclair/typebox").TAny;
|
38
50
|
chain: import("@sinclair/typebox").TObject<{
|
39
51
|
id: import("@sinclair/typebox").TNumber;
|
@@ -59,8 +71,8 @@ export declare const CampaignResourceDto: import("@sinclair/typebox").TObject<{
|
|
59
71
|
}>>;
|
60
72
|
campaignStatus: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
61
73
|
campaignId: import("@sinclair/typebox").TString;
|
62
|
-
computedUntil: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").
|
63
|
-
processingStarted: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").
|
74
|
+
computedUntil: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber]>;
|
75
|
+
processingStarted: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber]>;
|
64
76
|
status: import("@sinclair/typebox").TString;
|
65
77
|
error: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
66
78
|
details: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>;
|
@@ -17,9 +17,14 @@ export const CampaignResourceDto = t.Object({
|
|
17
17
|
rewardTokenId: t.String(),
|
18
18
|
amount: t.String(),
|
19
19
|
opportunityId: t.String(),
|
20
|
-
startTimestamp: t.Union([t.
|
21
|
-
endTimestamp: t.Union([t.
|
20
|
+
startTimestamp: t.Union([t.String(), t.Numeric()]),
|
21
|
+
endTimestamp: t.Union([t.String(), t.Numeric()]),
|
22
22
|
creatorAddress: t.String(),
|
23
|
+
creator: t.Optional(t.Object({
|
24
|
+
address: t.String(),
|
25
|
+
tags: t.Optional(t.Array(t.String())),
|
26
|
+
creatorId: t.Optional(t.Nullable(t.String())),
|
27
|
+
})),
|
23
28
|
params: t.Any(),
|
24
29
|
chain: ChainResourceDto,
|
25
30
|
rewardToken: TokenResourceDto,
|
@@ -160,6 +160,8 @@ export declare abstract class CampaignService {
|
|
160
160
|
id: number;
|
161
161
|
icon: string;
|
162
162
|
};
|
163
|
+
endTimestamp: number;
|
164
|
+
startTimestamp: number;
|
163
165
|
rewardToken: {
|
164
166
|
symbol: string;
|
165
167
|
name: string | null;
|
@@ -179,15 +181,15 @@ export declare abstract class CampaignService {
|
|
179
181
|
icon: string;
|
180
182
|
} | undefined;
|
181
183
|
campaignStatus: {
|
184
|
+
computedUntil: number;
|
185
|
+
processingStarted: number;
|
182
186
|
error: string;
|
183
187
|
details: import("database/api/.generated/runtime/library").JsonValue;
|
184
188
|
status: import("../../../../database/api/.generated").$Enums.RunStatus;
|
185
189
|
campaignId: string;
|
186
|
-
|
187
|
-
processingStarted: bigint;
|
188
|
-
};
|
190
|
+
} | undefined;
|
189
191
|
creatorAddress: string;
|
190
|
-
|
192
|
+
creator: {
|
191
193
|
tags: string[];
|
192
194
|
address: string;
|
193
195
|
creatorId: string | null;
|
@@ -195,8 +197,6 @@ export declare abstract class CampaignService {
|
|
195
197
|
type: string;
|
196
198
|
id: string;
|
197
199
|
subType: number | null;
|
198
|
-
startTimestamp: bigint;
|
199
|
-
endTimestamp: bigint;
|
200
200
|
computeChainId: number;
|
201
201
|
distributionChainId: number;
|
202
202
|
campaignId: string;
|
@@ -344,6 +344,8 @@ export declare abstract class CampaignService {
|
|
344
344
|
id: number;
|
345
345
|
icon: string;
|
346
346
|
};
|
347
|
+
endTimestamp: number;
|
348
|
+
startTimestamp: number;
|
347
349
|
rewardToken: {
|
348
350
|
symbol: string;
|
349
351
|
name: string | null;
|
@@ -363,15 +365,15 @@ export declare abstract class CampaignService {
|
|
363
365
|
icon: string;
|
364
366
|
} | undefined;
|
365
367
|
campaignStatus: {
|
368
|
+
computedUntil: number;
|
369
|
+
processingStarted: number;
|
366
370
|
error: string;
|
367
371
|
details: import("database/api/.generated/runtime/library").JsonValue;
|
368
372
|
status: import("../../../../database/api/.generated").$Enums.RunStatus;
|
369
373
|
campaignId: string;
|
370
|
-
|
371
|
-
processingStarted: bigint;
|
372
|
-
};
|
374
|
+
} | undefined;
|
373
375
|
creatorAddress: string;
|
374
|
-
|
376
|
+
creator: {
|
375
377
|
tags: string[];
|
376
378
|
address: string;
|
377
379
|
creatorId: string | null;
|
@@ -379,8 +381,6 @@ export declare abstract class CampaignService {
|
|
379
381
|
type: string;
|
380
382
|
id: string;
|
381
383
|
subType: number | null;
|
382
|
-
startTimestamp: bigint;
|
383
|
-
endTimestamp: bigint;
|
384
384
|
computeChainId: number;
|
385
385
|
distributionChainId: number;
|
386
386
|
campaignId: string;
|
@@ -388,7 +388,7 @@ export declare abstract class CampaignService {
|
|
388
388
|
amount: string;
|
389
389
|
opportunityId: string;
|
390
390
|
};
|
391
|
-
static formatAsCampaignParameters<C extends CampaignEnum>(campaign: CampaignWithParams
|
391
|
+
static formatAsCampaignParameters<C extends CampaignEnum>(campaign: CampaignWithParams): CampaignParameters<C>;
|
392
392
|
/**
|
393
393
|
* Fetches the campaign dynamic data for a v3 campaign onchain
|
394
394
|
* @param chainId
|
@@ -256,16 +256,19 @@ export class CampaignService {
|
|
256
256
|
* TODO: remove CampaignService function in favor of prisma client extensions
|
257
257
|
*/
|
258
258
|
static format(campaign) {
|
259
|
-
const { DistributionChain, ComputeChain, RewardToken, params, CampaignStatus, ...c } = campaign;
|
259
|
+
const { DistributionChain, ComputeChain, Creator, RewardToken, params, CampaignStatus, ...c } = campaign;
|
260
260
|
return {
|
261
261
|
...c,
|
262
262
|
params: params,
|
263
263
|
chain: ComputeChain,
|
264
|
+
endTimestamp: Number(c.endTimestamp),
|
265
|
+
startTimestamp: Number(c.startTimestamp),
|
264
266
|
rewardToken: TokenService.format(RewardToken),
|
265
267
|
distributionChain: DistributionChain === null ? undefined : DistributionChain,
|
266
268
|
// Todo: need to be change to single 1 to 1 with campaign
|
267
|
-
campaignStatus: CampaignStatus?.[0],
|
268
|
-
creatorAddress:
|
269
|
+
campaignStatus: CampaignStatus?.[0] ? StatusService.format(CampaignStatus?.[0]) : undefined,
|
270
|
+
creatorAddress: Creator.address,
|
271
|
+
creator: Creator,
|
269
272
|
};
|
270
273
|
}
|
271
274
|
static formatAsCampaignParameters(campaign) {
|
@@ -183,6 +183,8 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
183
183
|
id: number;
|
184
184
|
icon: string;
|
185
185
|
};
|
186
|
+
endTimestamp: number;
|
187
|
+
startTimestamp: number;
|
186
188
|
rewardToken: {
|
187
189
|
symbol: string;
|
188
190
|
name: string | null;
|
@@ -202,15 +204,15 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
202
204
|
icon: string;
|
203
205
|
} | undefined;
|
204
206
|
campaignStatus: {
|
207
|
+
computedUntil: number;
|
208
|
+
processingStarted: number;
|
205
209
|
error: string;
|
206
210
|
details: import("database/api/.generated/runtime/library").JsonValue;
|
207
211
|
status: import("../../../../database/api/.generated").$Enums.RunStatus;
|
208
212
|
campaignId: string;
|
209
|
-
|
210
|
-
processingStarted: bigint;
|
211
|
-
};
|
213
|
+
} | undefined;
|
212
214
|
creatorAddress: string;
|
213
|
-
|
215
|
+
creator: {
|
214
216
|
tags: string[];
|
215
217
|
address: string;
|
216
218
|
creatorId: string | null;
|
@@ -218,8 +220,6 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
218
220
|
type: string;
|
219
221
|
id: string;
|
220
222
|
subType: number | null;
|
221
|
-
startTimestamp: bigint;
|
222
|
-
endTimestamp: bigint;
|
223
223
|
computeChainId: number;
|
224
224
|
distributionChainId: number;
|
225
225
|
campaignId: string;
|
@@ -523,13 +523,18 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
523
523
|
apr: number;
|
524
524
|
dailyRewards: number;
|
525
525
|
campaigns: {
|
526
|
+
creator?: {
|
527
|
+
tags?: string[] | undefined;
|
528
|
+
creatorId?: string | null | undefined;
|
529
|
+
address: string;
|
530
|
+
} | undefined;
|
526
531
|
campaignStatus?: {
|
527
532
|
error?: string | undefined;
|
528
533
|
details?: any;
|
529
534
|
status: string;
|
530
535
|
campaignId: string;
|
531
|
-
computedUntil: string |
|
532
|
-
processingStarted: string |
|
536
|
+
computedUntil: string | number;
|
537
|
+
processingStarted: string | number;
|
533
538
|
} | undefined;
|
534
539
|
distributionChain?: {
|
535
540
|
name: string;
|
@@ -545,8 +550,8 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
545
550
|
id: number;
|
546
551
|
icon: string;
|
547
552
|
};
|
548
|
-
startTimestamp: string |
|
549
|
-
endTimestamp: string |
|
553
|
+
startTimestamp: string | number;
|
554
|
+
endTimestamp: string | number;
|
550
555
|
computeChainId: number;
|
551
556
|
distributionChainId: number;
|
552
557
|
campaignId: string;
|
@@ -680,13 +685,18 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
680
685
|
apr: number;
|
681
686
|
dailyRewards: number;
|
682
687
|
campaigns: {
|
688
|
+
creator?: {
|
689
|
+
tags?: string[] | undefined;
|
690
|
+
creatorId?: string | null | undefined;
|
691
|
+
address: string;
|
692
|
+
} | undefined;
|
683
693
|
campaignStatus?: {
|
684
694
|
error?: string | undefined;
|
685
695
|
details?: any;
|
686
696
|
status: string;
|
687
697
|
campaignId: string;
|
688
|
-
computedUntil: string |
|
689
|
-
processingStarted: string |
|
698
|
+
computedUntil: string | number;
|
699
|
+
processingStarted: string | number;
|
690
700
|
} | undefined;
|
691
701
|
distributionChain?: {
|
692
702
|
name: string;
|
@@ -702,8 +712,8 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
702
712
|
id: number;
|
703
713
|
icon: string;
|
704
714
|
};
|
705
|
-
startTimestamp: string |
|
706
|
-
endTimestamp: string |
|
715
|
+
startTimestamp: string | number;
|
716
|
+
endTimestamp: string | number;
|
707
717
|
computeChainId: number;
|
708
718
|
distributionChainId: number;
|
709
719
|
campaignId: string;
|
@@ -233,9 +233,14 @@ export declare const OpportunityWithCampaignsResourceDto: import("@sinclair/type
|
|
233
233
|
rewardTokenId: import("@sinclair/typebox").TString;
|
234
234
|
amount: import("@sinclair/typebox").TString;
|
235
235
|
opportunityId: import("@sinclair/typebox").TString;
|
236
|
-
startTimestamp: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").
|
237
|
-
endTimestamp: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").
|
236
|
+
startTimestamp: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber]>;
|
237
|
+
endTimestamp: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber]>;
|
238
238
|
creatorAddress: import("@sinclair/typebox").TString;
|
239
|
+
creator: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
240
|
+
address: import("@sinclair/typebox").TString;
|
241
|
+
tags: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
242
|
+
creatorId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>>;
|
243
|
+
}>>;
|
239
244
|
params: import("@sinclair/typebox").TAny;
|
240
245
|
chain: import("@sinclair/typebox").TObject<{
|
241
246
|
id: import("@sinclair/typebox").TNumber;
|
@@ -261,8 +266,8 @@ export declare const OpportunityWithCampaignsResourceDto: import("@sinclair/type
|
|
261
266
|
}>>;
|
262
267
|
campaignStatus: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
|
263
268
|
campaignId: import("@sinclair/typebox").TString;
|
264
|
-
computedUntil: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").
|
265
|
-
processingStarted: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").
|
269
|
+
computedUntil: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber]>;
|
270
|
+
processingStarted: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber]>;
|
266
271
|
status: import("@sinclair/typebox").TString;
|
267
272
|
error: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
268
273
|
details: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>;
|