@merkl/api 0.10.387 → 0.10.389
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 -0
- package/dist/src/index.d.ts +5 -0
- package/dist/src/libs/campaigns/campaignTypes/CLAMMDynamicData.js +6 -9
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +2 -0
- 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 +1 -0
- package/dist/src/modules/v4/campaign/campaign.repository.js +2 -1
- package/dist/src/modules/v4/campaign/campaign.service.js +4 -0
- package/dist/src/modules/v4/dynamicData/dynamicData.controller.d.ts +1 -0
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +2 -0
- package/dist/src/modules/v4/opportunity/opportunity.controller.js +2 -2
- package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +4 -0
- package/dist/src/modules/v4/opportunity/opportunity.model.js +7 -0
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +25 -1
- package/dist/src/modules/v4/opportunity/opportunity.service.js +32 -2
- package/dist/src/modules/v4/opportunity/subservices/getClammMetadata.service.js +2 -2
- package/dist/src/modules/v4/router.d.ts +5 -0
- package/dist/src/utils/generateCardName.js +9 -1
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/src/eden/index.d.ts
CHANGED
@@ -596,6 +596,7 @@ declare const eden: {
|
|
596
596
|
mainParameter?: string | undefined;
|
597
597
|
campaignId?: string | undefined;
|
598
598
|
opportunityId?: string | undefined;
|
599
|
+
creatorAddress?: string | undefined;
|
599
600
|
creatorId?: string | undefined;
|
600
601
|
test?: boolean | undefined;
|
601
602
|
creatorTag?: string | undefined;
|
@@ -933,6 +934,7 @@ declare const eden: {
|
|
933
934
|
mainParameter?: string | undefined;
|
934
935
|
campaignId?: string | undefined;
|
935
936
|
opportunityId?: string | undefined;
|
937
|
+
creatorAddress?: string | undefined;
|
936
938
|
creatorId?: string | undefined;
|
937
939
|
test?: boolean | undefined;
|
938
940
|
creatorTag?: string | undefined;
|
@@ -1003,6 +1005,7 @@ declare const eden: {
|
|
1003
1005
|
mainParameter?: string | undefined;
|
1004
1006
|
campaignId?: string | undefined;
|
1005
1007
|
opportunityId?: string | undefined;
|
1008
|
+
creatorAddress?: string | undefined;
|
1006
1009
|
creatorId?: string | undefined;
|
1007
1010
|
test?: boolean | undefined;
|
1008
1011
|
creatorTag?: string | undefined;
|
@@ -2487,6 +2490,7 @@ declare const eden: {
|
|
2487
2490
|
mainParameter?: string | undefined;
|
2488
2491
|
campaignId?: string | undefined;
|
2489
2492
|
opportunityId?: string | undefined;
|
2493
|
+
creatorAddress?: string | undefined;
|
2490
2494
|
creatorId?: string | undefined;
|
2491
2495
|
test?: boolean | undefined;
|
2492
2496
|
creatorTag?: string | undefined;
|
@@ -3828,6 +3832,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
3828
3832
|
post: {
|
3829
3833
|
body: unknown;
|
3830
3834
|
params: {
|
3835
|
+
campaignId?: string | undefined;
|
3831
3836
|
id: string;
|
3832
3837
|
};
|
3833
3838
|
query: unknown;
|
@@ -4138,6 +4143,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
4138
4143
|
mainParameter?: string | undefined;
|
4139
4144
|
campaignId?: string | undefined;
|
4140
4145
|
opportunityId?: string | undefined;
|
4146
|
+
creatorAddress?: string | undefined;
|
4141
4147
|
creatorId?: string | undefined;
|
4142
4148
|
test?: boolean | undefined;
|
4143
4149
|
creatorTag?: string | undefined;
|
@@ -4706,6 +4712,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
4706
4712
|
mainParameter?: string | undefined;
|
4707
4713
|
campaignId?: string | undefined;
|
4708
4714
|
opportunityId?: string | undefined;
|
4715
|
+
creatorAddress?: string | undefined;
|
4709
4716
|
creatorId?: string | undefined;
|
4710
4717
|
test?: boolean | undefined;
|
4711
4718
|
creatorTag?: string | undefined;
|
@@ -4779,6 +4786,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
4779
4786
|
mainParameter?: string | undefined;
|
4780
4787
|
campaignId?: string | undefined;
|
4781
4788
|
opportunityId?: string | undefined;
|
4789
|
+
creatorAddress?: string | undefined;
|
4782
4790
|
creatorId?: string | undefined;
|
4783
4791
|
test?: boolean | undefined;
|
4784
4792
|
creatorTag?: string | undefined;
|
@@ -6691,6 +6699,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
6691
6699
|
mainParameter?: string | undefined;
|
6692
6700
|
campaignId?: string | undefined;
|
6693
6701
|
opportunityId?: string | undefined;
|
6702
|
+
creatorAddress?: string | undefined;
|
6694
6703
|
creatorId?: string | undefined;
|
6695
6704
|
test?: boolean | undefined;
|
6696
6705
|
creatorTag?: string | undefined;
|
@@ -8763,6 +8772,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
8763
8772
|
mainParameter?: string | undefined;
|
8764
8773
|
campaignId?: string | undefined;
|
8765
8774
|
opportunityId?: string | undefined;
|
8775
|
+
creatorAddress?: string | undefined;
|
8766
8776
|
creatorId?: string | undefined;
|
8767
8777
|
test?: boolean | undefined;
|
8768
8778
|
creatorTag?: string | undefined;
|
@@ -9100,6 +9110,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
9100
9110
|
mainParameter?: string | undefined;
|
9101
9111
|
campaignId?: string | undefined;
|
9102
9112
|
opportunityId?: string | undefined;
|
9113
|
+
creatorAddress?: string | undefined;
|
9103
9114
|
creatorId?: string | undefined;
|
9104
9115
|
test?: boolean | undefined;
|
9105
9116
|
creatorTag?: string | undefined;
|
@@ -9170,6 +9181,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
9170
9181
|
mainParameter?: string | undefined;
|
9171
9182
|
campaignId?: string | undefined;
|
9172
9183
|
opportunityId?: string | undefined;
|
9184
|
+
creatorAddress?: string | undefined;
|
9173
9185
|
creatorId?: string | undefined;
|
9174
9186
|
test?: boolean | undefined;
|
9175
9187
|
creatorTag?: string | undefined;
|
@@ -10654,6 +10666,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
10654
10666
|
mainParameter?: string | undefined;
|
10655
10667
|
campaignId?: string | undefined;
|
10656
10668
|
opportunityId?: string | undefined;
|
10669
|
+
creatorAddress?: string | undefined;
|
10657
10670
|
creatorId?: string | undefined;
|
10658
10671
|
test?: boolean | undefined;
|
10659
10672
|
creatorTag?: string | undefined;
|
package/dist/src/index.d.ts
CHANGED
@@ -193,6 +193,7 @@ declare const app: Elysia<"", false, {
|
|
193
193
|
post: {
|
194
194
|
body: unknown;
|
195
195
|
params: {
|
196
|
+
campaignId?: string | undefined;
|
196
197
|
id: string;
|
197
198
|
};
|
198
199
|
query: unknown;
|
@@ -503,6 +504,7 @@ declare const app: Elysia<"", false, {
|
|
503
504
|
mainParameter?: string | undefined;
|
504
505
|
campaignId?: string | undefined;
|
505
506
|
opportunityId?: string | undefined;
|
507
|
+
creatorAddress?: string | undefined;
|
506
508
|
creatorId?: string | undefined;
|
507
509
|
test?: boolean | undefined;
|
508
510
|
creatorTag?: string | undefined;
|
@@ -1071,6 +1073,7 @@ declare const app: Elysia<"", false, {
|
|
1071
1073
|
mainParameter?: string | undefined;
|
1072
1074
|
campaignId?: string | undefined;
|
1073
1075
|
opportunityId?: string | undefined;
|
1076
|
+
creatorAddress?: string | undefined;
|
1074
1077
|
creatorId?: string | undefined;
|
1075
1078
|
test?: boolean | undefined;
|
1076
1079
|
creatorTag?: string | undefined;
|
@@ -1144,6 +1147,7 @@ declare const app: Elysia<"", false, {
|
|
1144
1147
|
mainParameter?: string | undefined;
|
1145
1148
|
campaignId?: string | undefined;
|
1146
1149
|
opportunityId?: string | undefined;
|
1150
|
+
creatorAddress?: string | undefined;
|
1147
1151
|
creatorId?: string | undefined;
|
1148
1152
|
test?: boolean | undefined;
|
1149
1153
|
creatorTag?: string | undefined;
|
@@ -3056,6 +3060,7 @@ declare const app: Elysia<"", false, {
|
|
3056
3060
|
mainParameter?: string | undefined;
|
3057
3061
|
campaignId?: string | undefined;
|
3058
3062
|
opportunityId?: string | undefined;
|
3063
|
+
creatorAddress?: string | undefined;
|
3059
3064
|
creatorId?: string | undefined;
|
3060
3065
|
test?: boolean | undefined;
|
3061
3066
|
creatorTag?: string | undefined;
|
@@ -599,16 +599,13 @@ export async function CLAMMDynamicData(chainId, campaigns) {
|
|
599
599
|
blacklistedBalance1 = poolBalanceToken1;
|
600
600
|
blacklistedLiquidity = poolTotalLiquidity;
|
601
601
|
// Get all beefy staker is whitelisted, get a list of all senders
|
602
|
-
|
603
|
-
const
|
604
|
-
|
605
|
-
|
606
|
-
let targetToMatch = "";
|
607
|
-
for (const alm of almDetails.filter(a => a.type === ALM.BeefyStaker)) {
|
608
|
-
if (alm.sender === c.campaignParameters.whitelist[0]) {
|
609
|
-
targetToMatch = alm.target;
|
610
|
-
}
|
602
|
+
let targetToMatch = "";
|
603
|
+
for (const alm of almDetails.filter(a => a.type === ALM.BeefyStaker)) {
|
604
|
+
if (c.campaignParameters.whitelist.includes(alm.sender)) {
|
605
|
+
targetToMatch = alm.target;
|
611
606
|
}
|
607
|
+
}
|
608
|
+
if (targetToMatch !== "") {
|
612
609
|
for (const alm of almDetails.filter(a => a.type === ALM.Beefy)) {
|
613
610
|
if (targetToMatch === alm.sender.toLowerCase()) {
|
614
611
|
c.campaignParameters.whitelist.push(alm.owner);
|
@@ -123,6 +123,7 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
|
|
123
123
|
mainParameter?: string | undefined;
|
124
124
|
campaignId?: string | undefined;
|
125
125
|
opportunityId?: string | undefined;
|
126
|
+
creatorAddress?: string | undefined;
|
126
127
|
creatorId?: string | undefined;
|
127
128
|
test?: boolean | undefined;
|
128
129
|
creatorTag?: string | undefined;
|
@@ -196,6 +197,7 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
|
|
196
197
|
mainParameter?: string | undefined;
|
197
198
|
campaignId?: string | undefined;
|
198
199
|
opportunityId?: string | undefined;
|
200
|
+
creatorAddress?: string | undefined;
|
199
201
|
creatorId?: string | undefined;
|
200
202
|
test?: boolean | undefined;
|
201
203
|
creatorTag?: string | undefined;
|
@@ -122,6 +122,7 @@ export declare const UpdateMetaDataCampaignDto: import("@sinclair/typebox").TObj
|
|
122
122
|
}>;
|
123
123
|
export declare const GetCampaignQueryDto: import("@sinclair/typebox").TObject<{
|
124
124
|
creatorTag: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
125
|
+
creatorAddress: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
125
126
|
creatorId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
126
127
|
chainId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
127
128
|
type: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TEnum<{
|
@@ -83,6 +83,7 @@ export const UpdateMetaDataCampaignDto = t.Object({
|
|
83
83
|
});
|
84
84
|
export const GetCampaignQueryDto = t.Object({
|
85
85
|
creatorTag: t.Optional(t.String({ description: "Filter campaigns created by a user who has a specific tag" })),
|
86
|
+
creatorAddress: t.Optional(t.String()),
|
86
87
|
creatorId: t.Optional(t.String({ description: "Filter campaigns created by a user who is registered as a merkl creator" })),
|
87
88
|
chainId: t.Optional(t.Numeric({
|
88
89
|
description: "Filter by chain.<br>You can get the list of all supported chains by calling [GET /v4/chains](#tag/chains/GET/v4/chains/)",
|
@@ -18,6 +18,7 @@ export declare abstract class CampaignRepository {
|
|
18
18
|
} | undefined;
|
19
19
|
subType: number | undefined;
|
20
20
|
type: "INVALID" | "ERC20" | "CLAMM" | "ERC20_SNAPSHOT" | "JSON_AIRDROP" | "SILO" | "RADIANT" | "MORPHO" | "DOLOMITE" | "BADGER" | "COMPOUND" | "AJNA" | "EULER" | "UNISWAP_V4" | "ION" | "EIGENLAYER" | "ERC20TRANSFERS" | "ERC20LOGPROCESSOR" | "ERC20REBASELOGPROCESSOR" | "VEST" | "ERC20_FIX_APR" | "HYPERDRIVELOGPROCESSOR" | "HYPERDRIVELOGFIXPROCESSOR" | undefined;
|
21
|
+
creatorAddress: string | undefined;
|
21
22
|
RewardToken: {
|
22
23
|
address: string | undefined;
|
23
24
|
symbol: string | undefined;
|
@@ -9,7 +9,7 @@ import { OpportunityService } from "../opportunity";
|
|
9
9
|
import { TokenService } from "../token";
|
10
10
|
export class CampaignRepository {
|
11
11
|
static transformQueryToPrismaFilters(query) {
|
12
|
-
const { creatorTag, creatorId, chainId, endTimestamp, opportunityId, mainParameter, campaignId, startTimestamp, subType, type, tokenAddress, tokenSymbol, test, } = query;
|
12
|
+
const { creatorTag, creatorId, creatorAddress, chainId, endTimestamp, opportunityId, mainParameter, campaignId, startTimestamp, subType, type, tokenAddress, tokenSymbol, test, } = query;
|
13
13
|
const getTagFilter = () => {
|
14
14
|
if (creatorTag && creatorId)
|
15
15
|
return {
|
@@ -32,6 +32,7 @@ export class CampaignRepository {
|
|
32
32
|
startTimestamp: startTimestamp ? { gte: +startTimestamp } : undefined,
|
33
33
|
subType,
|
34
34
|
type,
|
35
|
+
creatorAddress,
|
35
36
|
RewardToken: {
|
36
37
|
address: tokenAddress ? tokenAddress : undefined,
|
37
38
|
symbol: tokenSymbol ? tokenSymbol : undefined,
|
@@ -92,6 +92,10 @@ export class CampaignService {
|
|
92
92
|
await OpportunityService.createFromCampaign(campaign);
|
93
93
|
campaignsToInsert.push({ id, ...campaign });
|
94
94
|
}
|
95
|
+
// } else {
|
96
|
+
// console.log("Updating status from campaign");
|
97
|
+
// await OpportunityService.updateStatusFromCampaign(campaign);
|
98
|
+
// }
|
95
99
|
}
|
96
100
|
catch (err) {
|
97
101
|
log.error(`Cannot get Opportunity metadata for campaign ${campaign.campaignId} of type ${campaign.type}`, err);
|
@@ -95,6 +95,7 @@ export declare const DynamicDataController: Elysia<"/dynamic-data", false, {
|
|
95
95
|
mainParameter?: string | undefined;
|
96
96
|
campaignId?: string | undefined;
|
97
97
|
opportunityId?: string | undefined;
|
98
|
+
creatorAddress?: string | undefined;
|
98
99
|
creatorId?: string | undefined;
|
99
100
|
test?: boolean | undefined;
|
100
101
|
creatorTag?: string | undefined;
|
@@ -62,6 +62,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
62
62
|
post: {
|
63
63
|
body: unknown;
|
64
64
|
params: {
|
65
|
+
campaignId?: string | undefined;
|
65
66
|
id: string;
|
66
67
|
};
|
67
68
|
query: unknown;
|
@@ -372,6 +373,7 @@ export declare const OpportunityController: Elysia<"/opportunities", false, {
|
|
372
373
|
mainParameter?: string | undefined;
|
373
374
|
campaignId?: string | undefined;
|
374
375
|
opportunityId?: string | undefined;
|
376
|
+
creatorAddress?: string | undefined;
|
375
377
|
creatorId?: string | undefined;
|
376
378
|
test?: boolean | undefined;
|
377
379
|
creatorTag?: string | undefined;
|
@@ -3,7 +3,7 @@ import { BackOfficeGuard } from "../../../guards/BackOffice.guard";
|
|
3
3
|
import { AuthorizationHeadersDto, TokenAuthGuard } from "../../../guards/TokenAuth.guard";
|
4
4
|
import Elysia, { t } from "elysia";
|
5
5
|
import { GetCampaignQueryDto } from "../campaign";
|
6
|
-
import { CreateOpportunityDto, GetOpportunitiesQueryDto, GetOpportunityQueryDto, OpportunityAggregateFieldDto, OpportunityIdDto, OpportunityResourceDto, OpportunityUniqueDto, OpportunityWithCampaignsResourceDto, UpdateOpportunityDto, } from "./opportunity.model";
|
6
|
+
import { CreateOpportunityDto, GetOpportunitiesQueryDto, GetOpportunityQueryDto, OpportunityAggregateFieldDto, OpportunityIdDto, OpportunityResourceDto, OpportunityUniqueDto, OpportunityUniqueUpdateDto, OpportunityWithCampaignsResourceDto, UpdateOpportunityDto, } from "./opportunity.model";
|
7
7
|
import { OpportunityService } from "./opportunity.service";
|
8
8
|
import { transformId } from "./transform-id.pipe";
|
9
9
|
import { validateId } from "./validate-id.pipe";
|
@@ -41,7 +41,7 @@ export const OpportunityController = new Elysia({
|
|
41
41
|
}, {
|
42
42
|
beforeHandle: BackOfficeGuard,
|
43
43
|
headers: AuthorizationHeadersDto,
|
44
|
-
params:
|
44
|
+
params: OpportunityUniqueUpdateDto,
|
45
45
|
detail: { hide: true },
|
46
46
|
})
|
47
47
|
// ─── Get All Opportunities ───────────────────────────────────────────
|
@@ -272,6 +272,10 @@ export declare const OpportunityWithCampaignsResourceDto: import("@sinclair/type
|
|
272
272
|
export declare const OpportunityUniqueDto: import("@sinclair/typebox").TObject<{
|
273
273
|
id: import("@sinclair/typebox").TString;
|
274
274
|
}>;
|
275
|
+
export declare const OpportunityUniqueUpdateDto: import("@sinclair/typebox").TObject<{
|
276
|
+
id: import("@sinclair/typebox").TString;
|
277
|
+
campaignId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
278
|
+
}>;
|
275
279
|
export declare const AggregationResourceDto: import("@sinclair/typebox").TObject<{
|
276
280
|
sum: import("@sinclair/typebox").TNumber;
|
277
281
|
}>;
|
@@ -38,6 +38,13 @@ export const OpportunityUniqueDto = t.Object({
|
|
38
38
|
description: "The id of the opportunity. You can find opportunities including their id at [GET /v4/opportunities](#tag/opportunities/GET/v4/opportunities/)",
|
39
39
|
}),
|
40
40
|
});
|
41
|
+
export const OpportunityUniqueUpdateDto = t.Object({
|
42
|
+
id: t.String({
|
43
|
+
pattern: "(([0-9]*)-([0-9A-Z]*)-(0x([0-9A-Za-z])*))|([0-9]{1,20})",
|
44
|
+
description: "The id of the opportunity. You can find opportunities including their id at [GET /v4/opportunities](#tag/opportunities/GET/v4/opportunities/)",
|
45
|
+
}),
|
46
|
+
campaignId: t.Optional(t.String({ description: "The id of the campaign you want to reparse with" })),
|
47
|
+
});
|
41
48
|
export const AggregationResourceDto = t.Object({
|
42
49
|
sum: t.Number(),
|
43
50
|
});
|
@@ -63,10 +63,34 @@ export declare abstract class OpportunityService {
|
|
63
63
|
depositUrl: any;
|
64
64
|
tags: string[];
|
65
65
|
}>;
|
66
|
+
static updateStatusFromCampaign(campaign: Omit<CreateCampaignModel, "id">, upsert?: boolean): Promise<{
|
67
|
+
id: string;
|
68
|
+
chainId: number;
|
69
|
+
type: import("../../../../database/api/.generated").$Enums.CampaignType;
|
70
|
+
identifier: string;
|
71
|
+
name: string;
|
72
|
+
status: "PAST" | "LIVE" | "SOON";
|
73
|
+
action: import("../../../../database/api/.generated").$Enums.OpportunityAction;
|
74
|
+
tokens: {
|
75
|
+
price?: number | null | undefined;
|
76
|
+
symbol: string;
|
77
|
+
name: string | null;
|
78
|
+
id: string;
|
79
|
+
icon: string;
|
80
|
+
chainId: number;
|
81
|
+
address: string;
|
82
|
+
decimals: number;
|
83
|
+
verified: boolean;
|
84
|
+
isTest: boolean;
|
85
|
+
}[];
|
86
|
+
mainProtocol: "morpho" | "arthswap" | "baseswap" | "camelot" | "crust" | "fenix" | "horiza" | "izumi" | "kim" | "pancakeswap-v3" | "quickswap-algebra" | "quickswap-uni" | "ramses" | "retro" | "stryke" | "stryke-pcs" | "stryke-sushi" | "sushiswap-v3" | "swapr" | "thruster" | "uniswap-v3" | "voltage" | "zero" | "koi" | "supswap-v3" | "zkswap" | "thirdtrade" | "uniswap-v2" | "velodrome" | "aerodrome" | "balancer" | "curve" | "cross_curve" | "curveNPool" | "aura" | "akron" | "beefy" | "dragonswap" | "poolside" | "syncswap-v3" | "neptune" | "zkSwapThreePool" | "syncswap" | "rfx" | "radiant" | "aave" | "euler" | "gearbox" | "compound" | "sturdy" | "frax" | "ionic" | "moonwell" | "fluid" | "silo" | "coumpound" | "dolomite" | "badger" | "ajna" | "layerbank" | "ion" | "venus" | "woofi" | "reactor_fusion" | "eigenlayer" | "vest" | "zerolend" | "hyperdrive" | undefined;
|
87
|
+
depositUrl: string | undefined;
|
88
|
+
tags: string[];
|
89
|
+
}>;
|
66
90
|
/**
|
67
91
|
* deletes and recreates an opportunity with fresh data
|
68
92
|
*/
|
69
|
-
static recreate(opportunityId: string | OpportunityUnique): Promise<{
|
93
|
+
static recreate(opportunityId: string | OpportunityUnique, campaignId?: string): Promise<{
|
70
94
|
id: string;
|
71
95
|
chainId: number;
|
72
96
|
type: import("../../../../database/api/.generated").$Enums.CampaignType;
|
@@ -152,15 +152,45 @@ export class OpportunityService {
|
|
152
152
|
await OpportunityRepository.create(opportunity, upsert);
|
153
153
|
return opportunity;
|
154
154
|
}
|
155
|
+
static async updateStatusFromCampaign(campaign, upsert = true) {
|
156
|
+
const campaignType = CampaignService.getTypeFromV3(campaign.type);
|
157
|
+
const metadata = await OpportunityService.#getMetadata(campaign);
|
158
|
+
const opportunityId = OpportunityService.hashId({
|
159
|
+
chainId: campaign.computeChainId,
|
160
|
+
identifier: campaign.opportunityIdentifier,
|
161
|
+
type: campaignType,
|
162
|
+
});
|
163
|
+
const currentOpportunity = await OpportunityService.getUniqueOrThrow(opportunityId, true);
|
164
|
+
const now = moment().unix();
|
165
|
+
const opportunity = {
|
166
|
+
id: opportunityId,
|
167
|
+
chainId: campaign.computeChainId,
|
168
|
+
type: campaignType,
|
169
|
+
identifier: campaign.opportunityIdentifier, // mainParameter
|
170
|
+
name: currentOpportunity.name,
|
171
|
+
status: now >= +campaign.startTimestamp && now < +campaign.endTimestamp
|
172
|
+
? Status.LIVE
|
173
|
+
: now > +campaign.endTimestamp
|
174
|
+
? Status.PAST
|
175
|
+
: Status.SOON,
|
176
|
+
action: metadata.action,
|
177
|
+
tokens: currentOpportunity.tokens,
|
178
|
+
mainProtocol: metadata.mainProtocol,
|
179
|
+
depositUrl: currentOpportunity.depositUrl,
|
180
|
+
tags: currentOpportunity.tags,
|
181
|
+
};
|
182
|
+
await OpportunityRepository.create(opportunity, upsert);
|
183
|
+
return opportunity;
|
184
|
+
}
|
155
185
|
/**
|
156
186
|
* deletes and recreates an opportunity with fresh data
|
157
187
|
*/
|
158
|
-
static async recreate(opportunityId) {
|
188
|
+
static async recreate(opportunityId, campaignId) {
|
159
189
|
const id = typeof opportunityId === "string" ? opportunityId : OpportunityService.hashId(opportunityId);
|
160
190
|
const opportunity = await OpportunityRepository.findUnique(id);
|
161
191
|
if (!opportunity)
|
162
192
|
throw new NotFoundError();
|
163
|
-
const firstCampaign = opportunity?.Campaigns[0];
|
193
|
+
const firstCampaign = opportunity?.Campaigns.filter(campaign => campaignId ? campaign.campaignId === campaignId : true)[0];
|
164
194
|
return await OpportunityService.createFromCampaign({
|
165
195
|
...firstCampaign,
|
166
196
|
type: campaignTypeToEnumMap[firstCampaign.type],
|
@@ -26,13 +26,13 @@ export const getClammMetadata = (chainId, params) => {
|
|
26
26
|
if (params.whitelist.length > 0) {
|
27
27
|
for (const whitelist of params.whitelist) {
|
28
28
|
if (whitelistNameString.length > 0) {
|
29
|
-
whitelistNameString += "or
|
29
|
+
whitelistNameString += "or";
|
30
30
|
}
|
31
31
|
const forwarder = params.forwarders.find(x => getAddress(x.sender) === getAddress(whitelist));
|
32
32
|
const forwarderType = forwarder?.type;
|
33
33
|
const forwarderName = !!forwarderType ? almName(forwarderType) : null;
|
34
34
|
if (!!forwarderName) {
|
35
|
-
whitelistNameString += ` ${forwarderName}`;
|
35
|
+
whitelistNameString += ` ${forwarderName} `;
|
36
36
|
}
|
37
37
|
}
|
38
38
|
}
|
@@ -71,6 +71,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
71
71
|
post: {
|
72
72
|
body: unknown;
|
73
73
|
params: {
|
74
|
+
campaignId?: string | undefined;
|
74
75
|
id: string;
|
75
76
|
};
|
76
77
|
query: unknown;
|
@@ -381,6 +382,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
381
382
|
mainParameter?: string | undefined;
|
382
383
|
campaignId?: string | undefined;
|
383
384
|
opportunityId?: string | undefined;
|
385
|
+
creatorAddress?: string | undefined;
|
384
386
|
creatorId?: string | undefined;
|
385
387
|
test?: boolean | undefined;
|
386
388
|
creatorTag?: string | undefined;
|
@@ -949,6 +951,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
949
951
|
mainParameter?: string | undefined;
|
950
952
|
campaignId?: string | undefined;
|
951
953
|
opportunityId?: string | undefined;
|
954
|
+
creatorAddress?: string | undefined;
|
952
955
|
creatorId?: string | undefined;
|
953
956
|
test?: boolean | undefined;
|
954
957
|
creatorTag?: string | undefined;
|
@@ -1022,6 +1025,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
1022
1025
|
mainParameter?: string | undefined;
|
1023
1026
|
campaignId?: string | undefined;
|
1024
1027
|
opportunityId?: string | undefined;
|
1028
|
+
creatorAddress?: string | undefined;
|
1025
1029
|
creatorId?: string | undefined;
|
1026
1030
|
test?: boolean | undefined;
|
1027
1031
|
creatorTag?: string | undefined;
|
@@ -2934,6 +2938,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
2934
2938
|
mainParameter?: string | undefined;
|
2935
2939
|
campaignId?: string | undefined;
|
2936
2940
|
opportunityId?: string | undefined;
|
2941
|
+
creatorAddress?: string | undefined;
|
2937
2942
|
creatorId?: string | undefined;
|
2938
2943
|
test?: boolean | undefined;
|
2939
2944
|
creatorTag?: string | undefined;
|
@@ -129,6 +129,14 @@ export function generateCardName(type, typeInfo, campaign, symbols = [""]) {
|
|
129
129
|
case tokenType.cian:
|
130
130
|
return `Deposit ${typeInfo.symbolAsset} into ${typeInfo.name.replace("Ether.Fi", "Veda")}`;
|
131
131
|
default:
|
132
|
-
|
132
|
+
// OVERRIDE
|
133
|
+
switch (typeInfo.tokenAddress) {
|
134
|
+
case "0x3a8099D8FE5C072bB035381003993393072D3ec7":
|
135
|
+
return `Hold pufETH on DeSyn (dpufETH)`;
|
136
|
+
case "0x1f2aa9680910aC5a4527FA72001dC249943f60b4 ":
|
137
|
+
return `Hold pufETH on Karak (pufETH)`;
|
138
|
+
default:
|
139
|
+
return `Hold ${typeInfo.name} (${campaign.campaignParameters.symbolTargetToken})`;
|
140
|
+
}
|
133
141
|
}
|
134
142
|
}
|