@merkl/api 0.20.116 → 0.20.118
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 +450 -18
- package/dist/src/engine/deprecated/dynamicData/factory.js +1 -1
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/NoLinkVaultProcessor.js +1 -1
- package/dist/src/engine/implementations/MultiLog/metadata.d.ts +8 -0
- package/dist/src/engine/implementations/MultiLog/metadata.js +36 -0
- package/dist/src/engine/implementations/MultiLog/tvl.d.ts +7 -0
- package/dist/src/engine/implementations/MultiLog/tvl.js +19 -0
- package/dist/src/engine/metadata/factory.js +2 -1
- package/dist/src/engine/tvl/factory.js +2 -0
- package/dist/src/index.d.ts +150 -6
- package/dist/src/jobs/update-dynamic-data.js +2 -2
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +25 -1
- package/dist/src/modules/v4/campaign/campaign.service.d.ts +28 -3
- package/dist/src/modules/v4/campaign/campaign.test.controller.d.ts +50 -2
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +75 -3
- package/dist/src/modules/v4/opportunity/opportunity.controller.js +2 -0
- package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +26 -1
- package/dist/src/modules/v4/opportunity/opportunity.repository.js +1 -1
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +110 -10
- package/dist/src/modules/v4/opportunity/opportunity.service.js +1 -1
- package/dist/src/modules/v4/router.d.ts +150 -6
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
@@ -1,6 +1,7 @@
|
|
1
1
|
import { HttpErrorDto, NotFoundError, NotFoundErrorDto } from "@/errors";
|
2
2
|
import { BackOfficeGuard } from "@/guards/BackOffice.guard";
|
3
3
|
import { AuthorizationHeadersDto, TokenAuthGuard } from "@/guards/TokenAuth.guard";
|
4
|
+
import { log } from "@/utils/logger";
|
4
5
|
import { ChainId } from "@sdk";
|
5
6
|
import Elysia, { t } from "elysia";
|
6
7
|
import { GetCampaignQueryDto } from "../campaign";
|
@@ -49,6 +50,7 @@ export const OpportunityController = new Elysia({
|
|
49
50
|
}));
|
50
51
|
}
|
51
52
|
catch (err) {
|
53
|
+
log.error("error recreating opportunity", err);
|
52
54
|
if (err.code && err.code === "P2025")
|
53
55
|
throw new NotFoundError();
|
54
56
|
throw err;
|
@@ -10,6 +10,31 @@ export declare abstract class OpportunityRepository {
|
|
10
10
|
static create(newOpp: CreateOpportunityModel & {
|
11
11
|
id: string;
|
12
12
|
}, upsert?: boolean): Promise<{
|
13
|
+
Tokens: {
|
14
|
+
symbol: string;
|
15
|
+
id: string;
|
16
|
+
name: string | null;
|
17
|
+
icon: string;
|
18
|
+
address: string;
|
19
|
+
chainId: number;
|
20
|
+
decimals: number;
|
21
|
+
displaySymbol: string;
|
22
|
+
verified: boolean;
|
23
|
+
isTest: boolean;
|
24
|
+
isPoint: boolean;
|
25
|
+
isPreTGE: boolean;
|
26
|
+
isNative: boolean;
|
27
|
+
price: number | null;
|
28
|
+
}[];
|
29
|
+
Protocols: {
|
30
|
+
id: string;
|
31
|
+
name: string;
|
32
|
+
url: string;
|
33
|
+
description: string;
|
34
|
+
tags: string[];
|
35
|
+
icon: string;
|
36
|
+
}[];
|
37
|
+
} & {
|
13
38
|
id: string;
|
14
39
|
name: string;
|
15
40
|
type: string;
|
@@ -26,7 +51,7 @@ export declare abstract class OpportunityRepository {
|
|
26
51
|
apr: number;
|
27
52
|
dailyRewards: number;
|
28
53
|
lastCampaignCreatedAt: Date;
|
29
|
-
}
|
54
|
+
}>;
|
30
55
|
static findUnique(id: string): Promise<({
|
31
56
|
Chain: {
|
32
57
|
id: number;
|
@@ -265,7 +265,7 @@ export class OpportunityRepository {
|
|
265
265
|
});
|
266
266
|
else
|
267
267
|
await apiDbClient.opportunity.create({ data });
|
268
|
-
return await
|
268
|
+
return await OpportunityRepository.findUniqueOrThrow(newOpp.id, true, true);
|
269
269
|
}
|
270
270
|
// ─── Find ────────────────────────────────────────────────────────────
|
271
271
|
static async findUnique(id) {
|
@@ -24,7 +24,32 @@ export declare abstract class OpportunityService {
|
|
24
24
|
dailyRewards: number;
|
25
25
|
lastCampaignCreatedAt: Date;
|
26
26
|
}>;
|
27
|
-
static deleteOverrides(id: string, overridesToDelete: OpportunityManualOverride[]): Promise<{
|
27
|
+
static deleteOverrides(id: string, overridesToDelete: OpportunityManualOverride[]): Promise<({
|
28
|
+
Tokens: {
|
29
|
+
symbol: string;
|
30
|
+
id: string;
|
31
|
+
name: string | null;
|
32
|
+
icon: string;
|
33
|
+
address: string;
|
34
|
+
chainId: number;
|
35
|
+
decimals: number;
|
36
|
+
displaySymbol: string;
|
37
|
+
verified: boolean;
|
38
|
+
isTest: boolean;
|
39
|
+
isPoint: boolean;
|
40
|
+
isPreTGE: boolean;
|
41
|
+
isNative: boolean;
|
42
|
+
price: number | null;
|
43
|
+
}[];
|
44
|
+
Protocols: {
|
45
|
+
id: string;
|
46
|
+
name: string;
|
47
|
+
url: string;
|
48
|
+
description: string;
|
49
|
+
tags: string[];
|
50
|
+
icon: string;
|
51
|
+
}[];
|
52
|
+
} & {
|
28
53
|
id: string;
|
29
54
|
name: string;
|
30
55
|
type: string;
|
@@ -41,7 +66,7 @@ export declare abstract class OpportunityService {
|
|
41
66
|
apr: number;
|
42
67
|
dailyRewards: number;
|
43
68
|
lastCampaignCreatedAt: Date;
|
44
|
-
} | {
|
69
|
+
}) | {
|
45
70
|
id: string;
|
46
71
|
chainId: number;
|
47
72
|
type: string;
|
@@ -69,13 +94,38 @@ export declare abstract class OpportunityService {
|
|
69
94
|
depositUrl: string | undefined;
|
70
95
|
explorerAddress: string | undefined;
|
71
96
|
tags: string[];
|
72
|
-
}
|
97
|
+
}>;
|
73
98
|
/**
|
74
99
|
* create an opportunity without campaigns
|
75
100
|
* @param newOpp the new opportunity to create
|
76
101
|
* @returns {Promise<Opportunity|undefined>}
|
77
102
|
*/
|
78
103
|
static create(newOpp: CreateOpportunityModel): Promise<{
|
104
|
+
Tokens: {
|
105
|
+
symbol: string;
|
106
|
+
id: string;
|
107
|
+
name: string | null;
|
108
|
+
icon: string;
|
109
|
+
address: string;
|
110
|
+
chainId: number;
|
111
|
+
decimals: number;
|
112
|
+
displaySymbol: string;
|
113
|
+
verified: boolean;
|
114
|
+
isTest: boolean;
|
115
|
+
isPoint: boolean;
|
116
|
+
isPreTGE: boolean;
|
117
|
+
isNative: boolean;
|
118
|
+
price: number | null;
|
119
|
+
}[];
|
120
|
+
Protocols: {
|
121
|
+
id: string;
|
122
|
+
name: string;
|
123
|
+
url: string;
|
124
|
+
description: string;
|
125
|
+
tags: string[];
|
126
|
+
icon: string;
|
127
|
+
}[];
|
128
|
+
} & {
|
79
129
|
id: string;
|
80
130
|
name: string;
|
81
131
|
type: string;
|
@@ -92,13 +142,38 @@ export declare abstract class OpportunityService {
|
|
92
142
|
apr: number;
|
93
143
|
dailyRewards: number;
|
94
144
|
lastCampaignCreatedAt: Date;
|
95
|
-
}
|
145
|
+
}>;
|
96
146
|
/**
|
97
147
|
* @param upsert whether to update the opportunity if it already exists in database
|
98
148
|
* @param dryRun whether to skip the opportunity table interaction and just return the computed opportunity
|
99
149
|
* @returns the opportunity entity computed
|
100
150
|
*/
|
101
|
-
static createFromCampaign(campaign: Omit<CampaignWithParams, "manualOverrides">, opportunityIdentifier: string, upsert?: boolean, dryRun?: boolean): Promise<{
|
151
|
+
static createFromCampaign(campaign: Omit<CampaignWithParams, "manualOverrides">, opportunityIdentifier: string, upsert?: boolean, dryRun?: boolean): Promise<({
|
152
|
+
Tokens: {
|
153
|
+
symbol: string;
|
154
|
+
id: string;
|
155
|
+
name: string | null;
|
156
|
+
icon: string;
|
157
|
+
address: string;
|
158
|
+
chainId: number;
|
159
|
+
decimals: number;
|
160
|
+
displaySymbol: string;
|
161
|
+
verified: boolean;
|
162
|
+
isTest: boolean;
|
163
|
+
isPoint: boolean;
|
164
|
+
isPreTGE: boolean;
|
165
|
+
isNative: boolean;
|
166
|
+
price: number | null;
|
167
|
+
}[];
|
168
|
+
Protocols: {
|
169
|
+
id: string;
|
170
|
+
name: string;
|
171
|
+
url: string;
|
172
|
+
description: string;
|
173
|
+
tags: string[];
|
174
|
+
icon: string;
|
175
|
+
}[];
|
176
|
+
} & {
|
102
177
|
id: string;
|
103
178
|
name: string;
|
104
179
|
type: string;
|
@@ -115,7 +190,7 @@ export declare abstract class OpportunityService {
|
|
115
190
|
apr: number;
|
116
191
|
dailyRewards: number;
|
117
192
|
lastCampaignCreatedAt: Date;
|
118
|
-
} | {
|
193
|
+
}) | {
|
119
194
|
id: string;
|
120
195
|
chainId: number;
|
121
196
|
type: string;
|
@@ -143,11 +218,36 @@ export declare abstract class OpportunityService {
|
|
143
218
|
depositUrl: string | undefined;
|
144
219
|
explorerAddress: string | undefined;
|
145
220
|
tags: string[];
|
146
|
-
}
|
221
|
+
}>;
|
147
222
|
/**
|
148
223
|
* deletes and recreates an opportunity with fresh data
|
149
224
|
*/
|
150
|
-
static recreate(opportunityId: string, campaignId?: string): Promise<{
|
225
|
+
static recreate(opportunityId: string, campaignId?: string): Promise<({
|
226
|
+
Tokens: {
|
227
|
+
symbol: string;
|
228
|
+
id: string;
|
229
|
+
name: string | null;
|
230
|
+
icon: string;
|
231
|
+
address: string;
|
232
|
+
chainId: number;
|
233
|
+
decimals: number;
|
234
|
+
displaySymbol: string;
|
235
|
+
verified: boolean;
|
236
|
+
isTest: boolean;
|
237
|
+
isPoint: boolean;
|
238
|
+
isPreTGE: boolean;
|
239
|
+
isNative: boolean;
|
240
|
+
price: number | null;
|
241
|
+
}[];
|
242
|
+
Protocols: {
|
243
|
+
id: string;
|
244
|
+
name: string;
|
245
|
+
url: string;
|
246
|
+
description: string;
|
247
|
+
tags: string[];
|
248
|
+
icon: string;
|
249
|
+
}[];
|
250
|
+
} & {
|
151
251
|
id: string;
|
152
252
|
name: string;
|
153
253
|
type: string;
|
@@ -164,7 +264,7 @@ export declare abstract class OpportunityService {
|
|
164
264
|
apr: number;
|
165
265
|
dailyRewards: number;
|
166
266
|
lastCampaignCreatedAt: Date;
|
167
|
-
} | {
|
267
|
+
}) | {
|
168
268
|
id: string;
|
169
269
|
chainId: number;
|
170
270
|
type: string;
|
@@ -192,7 +292,7 @@ export declare abstract class OpportunityService {
|
|
192
292
|
depositUrl: string | undefined;
|
193
293
|
explorerAddress: string | undefined;
|
194
294
|
tags: string[];
|
195
|
-
}
|
295
|
+
}>;
|
196
296
|
/**
|
197
297
|
* Finds opportunities based on filters of its campaigns
|
198
298
|
* @notice campaigns are filtered as well
|
@@ -108,7 +108,7 @@ export class OpportunityService {
|
|
108
108
|
const firstCampaigns = sortedCampaigns.filter(campaign => campaign.startTimestamp <= BigInt(moment().unix()));
|
109
109
|
if (firstCampaigns.length > 0)
|
110
110
|
firstCampaign = firstCampaigns[0];
|
111
|
-
return await OpportunityService.createFromCampaign(CampaignService.format(await CampaignService.findUniqueOrThrow(firstCampaign.
|
111
|
+
return await OpportunityService.createFromCampaign(CampaignService.format(await CampaignService.findUniqueOrThrow(firstCampaign.id)), opportunity.identifier, true // Upserting
|
112
112
|
);
|
113
113
|
}
|
114
114
|
/**
|
@@ -54,6 +54,30 @@ export declare const v4: Elysia<"/v4", false, {
|
|
54
54
|
};
|
55
55
|
response: {
|
56
56
|
200: {
|
57
|
+
Tokens: {
|
58
|
+
symbol: string;
|
59
|
+
id: string;
|
60
|
+
name: string | null;
|
61
|
+
icon: string;
|
62
|
+
address: string;
|
63
|
+
chainId: number;
|
64
|
+
decimals: number;
|
65
|
+
displaySymbol: string;
|
66
|
+
verified: boolean;
|
67
|
+
isTest: boolean;
|
68
|
+
isPoint: boolean;
|
69
|
+
isPreTGE: boolean;
|
70
|
+
isNative: boolean;
|
71
|
+
price: number | null;
|
72
|
+
}[];
|
73
|
+
Protocols: {
|
74
|
+
id: string;
|
75
|
+
name: string;
|
76
|
+
url: string;
|
77
|
+
description: string;
|
78
|
+
tags: string[];
|
79
|
+
icon: string;
|
80
|
+
}[];
|
57
81
|
id: string;
|
58
82
|
name: string;
|
59
83
|
type: string;
|
@@ -70,7 +94,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
70
94
|
apr: number;
|
71
95
|
dailyRewards: number;
|
72
96
|
lastCampaignCreatedAt: Date;
|
73
|
-
}
|
97
|
+
};
|
74
98
|
};
|
75
99
|
};
|
76
100
|
};
|
@@ -132,6 +156,30 @@ export declare const v4: Elysia<"/v4", false, {
|
|
132
156
|
};
|
133
157
|
response: {
|
134
158
|
200: {
|
159
|
+
Tokens: {
|
160
|
+
symbol: string;
|
161
|
+
id: string;
|
162
|
+
name: string | null;
|
163
|
+
icon: string;
|
164
|
+
address: string;
|
165
|
+
chainId: number;
|
166
|
+
decimals: number;
|
167
|
+
displaySymbol: string;
|
168
|
+
verified: boolean;
|
169
|
+
isTest: boolean;
|
170
|
+
isPoint: boolean;
|
171
|
+
isPreTGE: boolean;
|
172
|
+
isNative: boolean;
|
173
|
+
price: number | null;
|
174
|
+
}[];
|
175
|
+
Protocols: {
|
176
|
+
id: string;
|
177
|
+
name: string;
|
178
|
+
url: string;
|
179
|
+
description: string;
|
180
|
+
tags: string[];
|
181
|
+
icon: string;
|
182
|
+
}[];
|
135
183
|
id: string;
|
136
184
|
name: string;
|
137
185
|
type: string;
|
@@ -176,7 +224,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
176
224
|
depositUrl: string | undefined;
|
177
225
|
explorerAddress: string | undefined;
|
178
226
|
tags: string[];
|
179
|
-
}
|
227
|
+
};
|
180
228
|
};
|
181
229
|
};
|
182
230
|
};
|
@@ -197,6 +245,30 @@ export declare const v4: Elysia<"/v4", false, {
|
|
197
245
|
};
|
198
246
|
response: {
|
199
247
|
200: {
|
248
|
+
Tokens: {
|
249
|
+
symbol: string;
|
250
|
+
id: string;
|
251
|
+
name: string | null;
|
252
|
+
icon: string;
|
253
|
+
address: string;
|
254
|
+
chainId: number;
|
255
|
+
decimals: number;
|
256
|
+
displaySymbol: string;
|
257
|
+
verified: boolean;
|
258
|
+
isTest: boolean;
|
259
|
+
isPoint: boolean;
|
260
|
+
isPreTGE: boolean;
|
261
|
+
isNative: boolean;
|
262
|
+
price: number | null;
|
263
|
+
}[];
|
264
|
+
Protocols: {
|
265
|
+
id: string;
|
266
|
+
name: string;
|
267
|
+
url: string;
|
268
|
+
description: string;
|
269
|
+
tags: string[];
|
270
|
+
icon: string;
|
271
|
+
}[];
|
200
272
|
id: string;
|
201
273
|
name: string;
|
202
274
|
type: string;
|
@@ -241,7 +313,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
241
313
|
depositUrl: string | undefined;
|
242
314
|
explorerAddress: string | undefined;
|
243
315
|
tags: string[];
|
244
|
-
}
|
316
|
+
};
|
245
317
|
};
|
246
318
|
};
|
247
319
|
};
|
@@ -1130,6 +1202,30 @@ export declare const v4: Elysia<"/v4", false, {
|
|
1130
1202
|
};
|
1131
1203
|
response: {
|
1132
1204
|
200: {
|
1205
|
+
Tokens: {
|
1206
|
+
symbol: string;
|
1207
|
+
id: string;
|
1208
|
+
name: string | null;
|
1209
|
+
icon: string;
|
1210
|
+
address: string;
|
1211
|
+
chainId: number;
|
1212
|
+
decimals: number;
|
1213
|
+
displaySymbol: string;
|
1214
|
+
verified: boolean;
|
1215
|
+
isTest: boolean;
|
1216
|
+
isPoint: boolean;
|
1217
|
+
isPreTGE: boolean;
|
1218
|
+
isNative: boolean;
|
1219
|
+
price: number | null;
|
1220
|
+
}[];
|
1221
|
+
Protocols: {
|
1222
|
+
id: string;
|
1223
|
+
name: string;
|
1224
|
+
url: string;
|
1225
|
+
description: string;
|
1226
|
+
tags: string[];
|
1227
|
+
icon: string;
|
1228
|
+
}[];
|
1133
1229
|
id: string;
|
1134
1230
|
name: string;
|
1135
1231
|
type: string;
|
@@ -1174,7 +1270,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
1174
1270
|
depositUrl: string | undefined;
|
1175
1271
|
explorerAddress: string | undefined;
|
1176
1272
|
tags: string[];
|
1177
|
-
} |
|
1273
|
+
} | undefined;
|
1178
1274
|
};
|
1179
1275
|
};
|
1180
1276
|
};
|
@@ -1973,6 +2069,30 @@ export declare const v4: Elysia<"/v4", false, {
|
|
1973
2069
|
};
|
1974
2070
|
response: {
|
1975
2071
|
200: {
|
2072
|
+
Tokens: {
|
2073
|
+
symbol: string;
|
2074
|
+
id: string;
|
2075
|
+
name: string | null;
|
2076
|
+
icon: string;
|
2077
|
+
address: string;
|
2078
|
+
chainId: number;
|
2079
|
+
decimals: number;
|
2080
|
+
displaySymbol: string;
|
2081
|
+
verified: boolean;
|
2082
|
+
isTest: boolean;
|
2083
|
+
isPoint: boolean;
|
2084
|
+
isPreTGE: boolean;
|
2085
|
+
isNative: boolean;
|
2086
|
+
price: number | null;
|
2087
|
+
}[];
|
2088
|
+
Protocols: {
|
2089
|
+
id: string;
|
2090
|
+
name: string;
|
2091
|
+
url: string;
|
2092
|
+
description: string;
|
2093
|
+
tags: string[];
|
2094
|
+
icon: string;
|
2095
|
+
}[];
|
1976
2096
|
id: string;
|
1977
2097
|
name: string;
|
1978
2098
|
type: string;
|
@@ -2017,7 +2137,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
2017
2137
|
depositUrl: string | undefined;
|
2018
2138
|
explorerAddress: string | undefined;
|
2019
2139
|
tags: string[];
|
2020
|
-
} |
|
2140
|
+
} | undefined;
|
2021
2141
|
};
|
2022
2142
|
};
|
2023
2143
|
};
|
@@ -2037,6 +2157,30 @@ export declare const v4: Elysia<"/v4", false, {
|
|
2037
2157
|
};
|
2038
2158
|
response: {
|
2039
2159
|
200: {
|
2160
|
+
Tokens: {
|
2161
|
+
symbol: string;
|
2162
|
+
id: string;
|
2163
|
+
name: string | null;
|
2164
|
+
icon: string;
|
2165
|
+
address: string;
|
2166
|
+
chainId: number;
|
2167
|
+
decimals: number;
|
2168
|
+
displaySymbol: string;
|
2169
|
+
verified: boolean;
|
2170
|
+
isTest: boolean;
|
2171
|
+
isPoint: boolean;
|
2172
|
+
isPreTGE: boolean;
|
2173
|
+
isNative: boolean;
|
2174
|
+
price: number | null;
|
2175
|
+
}[];
|
2176
|
+
Protocols: {
|
2177
|
+
id: string;
|
2178
|
+
name: string;
|
2179
|
+
url: string;
|
2180
|
+
description: string;
|
2181
|
+
tags: string[];
|
2182
|
+
icon: string;
|
2183
|
+
}[];
|
2040
2184
|
id: string;
|
2041
2185
|
name: string;
|
2042
2186
|
type: string;
|
@@ -2081,7 +2225,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
2081
2225
|
depositUrl: string | undefined;
|
2082
2226
|
explorerAddress: string | undefined;
|
2083
2227
|
tags: string[];
|
2084
|
-
} |
|
2228
|
+
} | undefined;
|
2085
2229
|
};
|
2086
2230
|
};
|
2087
2231
|
};
|