@merkl/api 0.20.46 → 0.20.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/database/api/.generated/drizzle/schema.d.ts +44 -1
- package/dist/database/api/.generated/drizzle/schema.js +3 -2
- package/dist/database/api/.generated/drizzle/schema.ts +3 -2
- package/dist/database/api/.generated/edge.js +7 -7
- package/dist/database/api/.generated/index-browser.js +9 -1
- package/dist/database/api/.generated/index.d.ts +97 -5
- package/dist/database/api/.generated/index.js +7 -7
- package/dist/database/api/.generated/package.json +1 -1
- package/dist/database/api/.generated/schema.prisma +13 -13
- package/dist/database/api/.generated/wasm.js +9 -1
- package/dist/src/eden/index.d.ts +351 -15
- package/dist/src/engine/dynamicData/implementations/Clamm.js +30 -31
- package/dist/src/index.d.ts +87 -3
- package/dist/src/jobs/update-dynamic-data.js +1 -1
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +3 -0
- package/dist/src/modules/v4/campaign/campaign.repository.d.ts +5 -0
- package/dist/src/modules/v4/campaign/campaign.service.d.ts +9 -0
- package/dist/src/modules/v4/dynamicData/dynamicData.controller.d.ts +2 -0
- package/dist/src/modules/v4/dynamicData/dynamicData.controller.js +1 -1
- package/dist/src/modules/v4/dynamicData/dynamicData.model.d.ts +2 -0
- package/dist/src/modules/v4/dynamicData/dynamicData.model.js +2 -0
- package/dist/src/modules/v4/dynamicData/dynamicData.service.d.ts +1 -1
- package/dist/src/modules/v4/dynamicData/dynamicData.service.js +4 -4
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +80 -0
- package/dist/src/modules/v4/opportunity/opportunity.controller.js +16 -3
- package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +26 -4
- package/dist/src/modules/v4/opportunity/opportunity.model.js +8 -1
- package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +16 -40
- package/dist/src/modules/v4/opportunity/opportunity.repository.js +72 -181
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +44 -25
- package/dist/src/modules/v4/opportunity/opportunity.service.js +15 -33
- package/dist/src/modules/v4/programPayload/programPayload.repository.js +9 -3
- package/dist/src/modules/v4/protocol/protocol.repository.d.ts +1 -0
- package/dist/src/modules/v4/reward/reward.repository.d.ts +1 -0
- package/dist/src/modules/v4/reward/reward.service.d.ts +7 -0
- package/dist/src/modules/v4/router.d.ts +87 -3
- package/dist/src/modules/v4/token/token.controller.d.ts +0 -3
- package/dist/src/modules/v4/token/token.model.d.ts +0 -3
- package/dist/src/modules/v4/token/token.model.js +0 -1
- package/dist/src/modules/v4/token/token.service.js +5 -5
- package/dist/src/modules/v4/user/user.controller.d.ts +2 -0
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
@@ -5,8 +5,7 @@ import { CampaignService } from "@/modules/v4/campaign";
|
|
5
5
|
import { CampaignRepository } from "@/modules/v4/campaign/campaign.repository";
|
6
6
|
import { TokenService } from "@/modules/v4/token/token.service";
|
7
7
|
import { UserService } from "@/modules/v4/user/user.service";
|
8
|
-
import {
|
9
|
-
import { Prisma, Status } from "@db/api";
|
8
|
+
import { Status } from "@db/api";
|
10
9
|
import { Campaign as CampaignEnum } from "@sdk";
|
11
10
|
import moment from "moment";
|
12
11
|
import { metadataBuilderFactory } from "../../../engine/opportunityMetadata/factory";
|
@@ -16,6 +15,18 @@ export class OpportunityService {
|
|
16
15
|
static hashId(opportunity) {
|
17
16
|
return Bun.hash(`${opportunity.chainId}${opportunity.type}${opportunity.identifier}`).toString();
|
18
17
|
}
|
18
|
+
static async override(id, data) {
|
19
|
+
const opportunity = await OpportunityRepository.findUniqueOrThrow(id);
|
20
|
+
const overrides = opportunity.manualOverrides ?? [];
|
21
|
+
overrides.push(...Object.keys(data).filter(k => k !== undefined && !overrides.includes(k)));
|
22
|
+
return await OpportunityRepository.update(id, { ...data, manualOverrides: overrides });
|
23
|
+
}
|
24
|
+
static async deleteOverrides(id, overridesToDelete) {
|
25
|
+
const opportunity = await OpportunityRepository.findUniqueOrThrow(id);
|
26
|
+
const overrides = opportunity.manualOverrides ?? [];
|
27
|
+
const newOverrides = overrides.filter(override => !overridesToDelete.includes(override));
|
28
|
+
return await OpportunityRepository.update(id, { manualOverrides: newOverrides });
|
29
|
+
}
|
19
30
|
/**
|
20
31
|
* create an opportunity without campaigns
|
21
32
|
* @param newOpp the new opportunity to create
|
@@ -85,15 +96,11 @@ export class OpportunityService {
|
|
85
96
|
await OpportunityRepository.create(opportunity, upsert);
|
86
97
|
return opportunity;
|
87
98
|
}
|
88
|
-
static async updateStatus(opportunityId, status) {
|
89
|
-
return await OpportunityRepository.update(opportunityId, { status });
|
90
|
-
}
|
91
99
|
/**
|
92
100
|
* deletes and recreates an opportunity with fresh data
|
93
101
|
*/
|
94
102
|
static async recreate(opportunityId, campaignId) {
|
95
|
-
const
|
96
|
-
const opportunity = await OpportunityRepository.findUnique(id);
|
103
|
+
const opportunity = await OpportunityRepository.findUnique(opportunityId);
|
97
104
|
if (!opportunity)
|
98
105
|
throw new NotFoundError();
|
99
106
|
const sortedCampaigns = opportunity?.Campaigns.filter(campaign => campaignId ? campaign.campaignId === campaignId : true).sort((a, b) => Number(b.endTimestamp) - Number(a.endTimestamp));
|
@@ -116,28 +123,6 @@ export class OpportunityService {
|
|
116
123
|
}, true // Upserting
|
117
124
|
);
|
118
125
|
}
|
119
|
-
static async updateMetadata(chain) {
|
120
|
-
try {
|
121
|
-
const opportunities = await OpportunityRepository.findMany({
|
122
|
-
chainId: chain.toString(),
|
123
|
-
campaigns: true,
|
124
|
-
});
|
125
|
-
// ─── Check And Update Opportunity Status ─────────────
|
126
|
-
for (const opp of opportunities) {
|
127
|
-
const { live: activeCampaigns, soon: futureCampaigns } = CampaignService.splitOnStatus(opp.Campaigns);
|
128
|
-
if (activeCampaigns.length === 0) {
|
129
|
-
await OpportunityRepository.updateStatus(opp.id, futureCampaigns.length === 0 ? "PAST" : "SOON").catch(err => log.error("Cannot update opportunity status", err, "opportunities"));
|
130
|
-
}
|
131
|
-
if (opp.status !== "LIVE" && activeCampaigns.length !== 0)
|
132
|
-
await OpportunityRepository.updateStatus(opp.id, "LIVE").catch(err => log.error("Cannot update opportunity status to LIVE", err, "opportunities"));
|
133
|
-
}
|
134
|
-
}
|
135
|
-
catch (err) {
|
136
|
-
if (err instanceof Prisma.PrismaClientKnownRequestError && err.code === "P2025")
|
137
|
-
throw new NotFoundError();
|
138
|
-
throw err;
|
139
|
-
}
|
140
|
-
}
|
141
126
|
/**
|
142
127
|
* Finds opportunities based on filters of its campaigns
|
143
128
|
* @notice campaigns are filtered as well
|
@@ -190,9 +175,6 @@ export class OpportunityService {
|
|
190
175
|
});
|
191
176
|
}, chainId);
|
192
177
|
}
|
193
|
-
static async getAllIds() {
|
194
|
-
return await OpportunityRepository.getAllIdsForDynamicOpp();
|
195
|
-
}
|
196
178
|
static formatResponse(opportunity) {
|
197
179
|
const { DailyRewardsRecords, AprRecords, TvlRecords, Campaigns, ...opp } = opportunity;
|
198
180
|
const aprRecord = opp.status === "LIVE"
|
@@ -237,7 +219,7 @@ export class OpportunityService {
|
|
237
219
|
return formated;
|
238
220
|
}
|
239
221
|
static formatResponseBase(opportunity) {
|
240
|
-
let { mainProtocolId, id, Tokens, Chain, Protocols, MainProtocol, ...opp } = opportunity;
|
222
|
+
let { mainProtocolId, id, Tokens, Chain, Protocols, MainProtocol, manualOverrides, ...opp } = opportunity;
|
241
223
|
if (mainProtocolId === "unknown") {
|
242
224
|
MainProtocol = null;
|
243
225
|
}
|
@@ -722,7 +722,9 @@ const EtherlinkInterfaceCampaigns = {
|
|
722
722
|
campaignType: Campaign.EVENT_BASED,
|
723
723
|
contract: "0xd0bc067cf877f7b76ceb331891331d9e6acda1a7",
|
724
724
|
eventID: id("OrderPlaced(address,uint64,bool,uint128,uint72,uint128,uint128,uint128,uint128,uint128,bool,bool)"),
|
725
|
-
topicToData: [
|
725
|
+
topicToData: [
|
726
|
+
{ topicIndex: 1, decodeKeyTopic: "address", dataIndex: 6, multiplier: (13n * 10n ** 20n).toString() },
|
727
|
+
],
|
726
728
|
computeScoreParameters: {
|
727
729
|
computeMethod: ComputeScoreMethod.cappedScorePercentageHistorical,
|
728
730
|
computeSettings: {
|
@@ -752,7 +754,9 @@ const EtherlinkInterfaceCampaigns = {
|
|
752
754
|
campaignType: Campaign.EVENT_BASED,
|
753
755
|
contract: "0x65ea4dd7f789c71c0f57ed84b3bdc3062898d3cb",
|
754
756
|
eventID: id("OrderPlaced(address,uint64,bool,uint128,uint72,uint128,uint128,uint128,uint128,uint128,bool,bool)"),
|
755
|
-
topicToData: [
|
757
|
+
topicToData: [
|
758
|
+
{ topicIndex: 1, decodeKeyTopic: "address", dataIndex: 6, multiplier: (13n * 10n ** 20n).toString() },
|
759
|
+
],
|
756
760
|
computeScoreParameters: {
|
757
761
|
computeMethod: ComputeScoreMethod.cappedScorePercentageHistorical,
|
758
762
|
computeSettings: {
|
@@ -782,7 +786,9 @@ const EtherlinkInterfaceCampaigns = {
|
|
782
786
|
campaignType: Campaign.EVENT_BASED,
|
783
787
|
contract: "0xbb6b01d94e3f6ebae8647cb56d544f57928ab758",
|
784
788
|
eventID: id("OrderPlaced(address,uint64,bool,uint128,uint72,uint128,uint128,uint128,uint128,uint128,bool,bool)"),
|
785
|
-
topicToData: [
|
789
|
+
topicToData: [
|
790
|
+
{ topicIndex: 1, decodeKeyTopic: "address", dataIndex: 6, multiplier: (13n * 10n ** 20n).toString() },
|
791
|
+
],
|
786
792
|
computeScoreParameters: {
|
787
793
|
computeMethod: ComputeScoreMethod.cappedScorePercentageHistorical,
|
788
794
|
computeSettings: {
|
@@ -53,6 +53,7 @@ export declare abstract class ProtocolRepository {
|
|
53
53
|
tags: string[];
|
54
54
|
identifier: string;
|
55
55
|
action: import("@db/api").$Enums.OpportunityAction;
|
56
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
56
57
|
chainId: number;
|
57
58
|
depositUrl: string | null;
|
58
59
|
explorerAddress: string | null;
|
@@ -67,6 +67,7 @@ export declare abstract class RewardRepository {
|
|
67
67
|
tags: string[];
|
68
68
|
identifier: string;
|
69
69
|
action: import("@db/api").$Enums.OpportunityAction;
|
70
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
70
71
|
chainId: number;
|
71
72
|
depositUrl: string | null;
|
72
73
|
explorerAddress: string | null;
|
@@ -113,6 +113,7 @@ export declare abstract class RewardService {
|
|
113
113
|
tags: string[];
|
114
114
|
identifier: string;
|
115
115
|
action: import("@db/api").$Enums.OpportunityAction;
|
116
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
116
117
|
chainId: number;
|
117
118
|
depositUrl: string | null;
|
118
119
|
explorerAddress: string | null;
|
@@ -228,6 +229,7 @@ export declare abstract class RewardService {
|
|
228
229
|
tags: string[];
|
229
230
|
identifier: string;
|
230
231
|
action: import("@db/api").$Enums.OpportunityAction;
|
232
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
231
233
|
chainId: number;
|
232
234
|
depositUrl: string | null;
|
233
235
|
explorerAddress: string | null;
|
@@ -309,6 +311,7 @@ export declare abstract class RewardService {
|
|
309
311
|
tags: string[];
|
310
312
|
identifier: string;
|
311
313
|
action: import("@db/api").$Enums.OpportunityAction;
|
314
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
312
315
|
chainId: number;
|
313
316
|
depositUrl: string | null;
|
314
317
|
explorerAddress: string | null;
|
@@ -394,6 +397,7 @@ export declare abstract class RewardService {
|
|
394
397
|
tags: string[];
|
395
398
|
identifier: string;
|
396
399
|
action: import("@db/api").$Enums.OpportunityAction;
|
400
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
397
401
|
chainId: number;
|
398
402
|
depositUrl: string | null;
|
399
403
|
explorerAddress: string | null;
|
@@ -508,6 +512,7 @@ export declare abstract class RewardService {
|
|
508
512
|
tags: string[];
|
509
513
|
identifier: string;
|
510
514
|
action: import("@db/api").$Enums.OpportunityAction;
|
515
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
511
516
|
chainId: number;
|
512
517
|
depositUrl: string | null;
|
513
518
|
explorerAddress: string | null;
|
@@ -604,6 +609,7 @@ export declare abstract class RewardService {
|
|
604
609
|
tags: string[];
|
605
610
|
identifier: string;
|
606
611
|
action: import("@db/api").$Enums.OpportunityAction;
|
612
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
607
613
|
chainId: number;
|
608
614
|
depositUrl: string | null;
|
609
615
|
explorerAddress: string | null;
|
@@ -698,6 +704,7 @@ export declare abstract class RewardService {
|
|
698
704
|
tags: string[];
|
699
705
|
identifier: string;
|
700
706
|
action: import("@db/api").$Enums.OpportunityAction;
|
707
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
701
708
|
chainId: number;
|
702
709
|
depositUrl: string | null;
|
703
710
|
explorerAddress: string | null;
|
@@ -61,6 +61,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
61
61
|
tags: string[];
|
62
62
|
identifier: string;
|
63
63
|
action: import("@db/api").$Enums.OpportunityAction;
|
64
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
64
65
|
chainId: number;
|
65
66
|
depositUrl: string | null;
|
66
67
|
explorerAddress: string | null;
|
@@ -73,6 +74,83 @@ export declare const v4: Elysia<"/v4", false, {
|
|
73
74
|
};
|
74
75
|
};
|
75
76
|
};
|
77
|
+
} & {
|
78
|
+
opportunities: {
|
79
|
+
":id": {
|
80
|
+
override: {
|
81
|
+
patch: {
|
82
|
+
body: {
|
83
|
+
name?: string | undefined;
|
84
|
+
action?: "POOL" | "HOLD" | "DROP" | "LEND" | "BORROW" | "LONG" | "SHORT" | "SWAP" | "INVALID" | undefined;
|
85
|
+
depositUrl?: string | undefined;
|
86
|
+
explorerAddress?: string | undefined;
|
87
|
+
};
|
88
|
+
params: {
|
89
|
+
id: string;
|
90
|
+
};
|
91
|
+
query: unknown;
|
92
|
+
headers: {
|
93
|
+
authorization: string;
|
94
|
+
};
|
95
|
+
response: {
|
96
|
+
200: {
|
97
|
+
id: string;
|
98
|
+
name: string;
|
99
|
+
type: string;
|
100
|
+
status: import("@db/api").$Enums.Status;
|
101
|
+
tags: string[];
|
102
|
+
identifier: string;
|
103
|
+
action: import("@db/api").$Enums.OpportunityAction;
|
104
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
105
|
+
chainId: number;
|
106
|
+
depositUrl: string | null;
|
107
|
+
explorerAddress: string | null;
|
108
|
+
mainProtocolId: string | null;
|
109
|
+
tvl: number;
|
110
|
+
apr: number;
|
111
|
+
dailyRewards: number;
|
112
|
+
};
|
113
|
+
};
|
114
|
+
};
|
115
|
+
};
|
116
|
+
};
|
117
|
+
};
|
118
|
+
} & {
|
119
|
+
opportunities: {
|
120
|
+
":id": {
|
121
|
+
override: {
|
122
|
+
delete: {
|
123
|
+
body: ("name" | "action" | "depositUrl" | "explorerAddress")[];
|
124
|
+
params: {
|
125
|
+
id: string;
|
126
|
+
};
|
127
|
+
query: unknown;
|
128
|
+
headers: {
|
129
|
+
authorization: string;
|
130
|
+
};
|
131
|
+
response: {
|
132
|
+
200: {
|
133
|
+
id: string;
|
134
|
+
name: string;
|
135
|
+
type: string;
|
136
|
+
status: import("@db/api").$Enums.Status;
|
137
|
+
tags: string[];
|
138
|
+
identifier: string;
|
139
|
+
action: import("@db/api").$Enums.OpportunityAction;
|
140
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
141
|
+
chainId: number;
|
142
|
+
depositUrl: string | null;
|
143
|
+
explorerAddress: string | null;
|
144
|
+
mainProtocolId: string | null;
|
145
|
+
tvl: number;
|
146
|
+
apr: number;
|
147
|
+
dailyRewards: number;
|
148
|
+
};
|
149
|
+
};
|
150
|
+
};
|
151
|
+
};
|
152
|
+
};
|
153
|
+
};
|
76
154
|
} & {
|
77
155
|
opportunities: {
|
78
156
|
":id": {
|
@@ -253,6 +331,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
253
331
|
tags: string[];
|
254
332
|
identifier: string;
|
255
333
|
action: import("@db/api").$Enums.OpportunityAction;
|
334
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
256
335
|
chainId: number;
|
257
336
|
depositUrl: string | null;
|
258
337
|
explorerAddress: string | null;
|
@@ -964,6 +1043,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
964
1043
|
tags: string[];
|
965
1044
|
identifier: string;
|
966
1045
|
action: import("@db/api").$Enums.OpportunityAction;
|
1046
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
967
1047
|
chainId: number;
|
968
1048
|
depositUrl: string | null;
|
969
1049
|
explorerAddress: string | null;
|
@@ -1295,6 +1375,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
1295
1375
|
tags: string[];
|
1296
1376
|
identifier: string;
|
1297
1377
|
action: import("@db/api").$Enums.OpportunityAction;
|
1378
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
1298
1379
|
chainId: number;
|
1299
1380
|
depositUrl: string | null;
|
1300
1381
|
explorerAddress: string | null;
|
@@ -1378,6 +1459,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
1378
1459
|
tags: string[];
|
1379
1460
|
identifier: string;
|
1380
1461
|
action: import("@db/api").$Enums.OpportunityAction;
|
1462
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
1381
1463
|
chainId: number;
|
1382
1464
|
depositUrl: string | null;
|
1383
1465
|
explorerAddress: string | null;
|
@@ -1562,6 +1644,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
1562
1644
|
tags: string[];
|
1563
1645
|
identifier: string;
|
1564
1646
|
action: import("@db/api").$Enums.OpportunityAction;
|
1647
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
1565
1648
|
chainId: number;
|
1566
1649
|
depositUrl: string | null;
|
1567
1650
|
explorerAddress: string | null;
|
@@ -2213,9 +2296,6 @@ export declare const v4: Elysia<"/v4", false, {
|
|
2213
2296
|
plain_text: string;
|
2214
2297
|
}[];
|
2215
2298
|
};
|
2216
|
-
Verified: {
|
2217
|
-
checkbox: boolean;
|
2218
|
-
};
|
2219
2299
|
"CoinGecko API ID (Recommended)": {
|
2220
2300
|
rich_text: {
|
2221
2301
|
plain_text: string;
|
@@ -3246,6 +3326,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
3246
3326
|
tags: string[];
|
3247
3327
|
identifier: string;
|
3248
3328
|
action: import("@db/api").$Enums.OpportunityAction;
|
3329
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
3249
3330
|
chainId: number;
|
3250
3331
|
depositUrl: string | null;
|
3251
3332
|
explorerAddress: string | null;
|
@@ -3364,6 +3445,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
3364
3445
|
tags: string[];
|
3365
3446
|
identifier: string;
|
3366
3447
|
action: import("@db/api").$Enums.OpportunityAction;
|
3448
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
3367
3449
|
chainId: number;
|
3368
3450
|
depositUrl: string | null;
|
3369
3451
|
explorerAddress: string | null;
|
@@ -3824,6 +3906,8 @@ export declare const v4: Elysia<"/v4", false, {
|
|
3824
3906
|
decimals?: number | undefined;
|
3825
3907
|
chainId: number;
|
3826
3908
|
tokenAddress: string;
|
3909
|
+
rewardTokenAddress: string;
|
3910
|
+
symbolRewardToken: string;
|
3827
3911
|
};
|
3828
3912
|
headers: {
|
3829
3913
|
authorization: string;
|
@@ -100,9 +100,6 @@ export declare const NotionWebhookDto: import("@sinclair/typebox").TObject<{
|
|
100
100
|
plain_text: import("@sinclair/typebox").TString;
|
101
101
|
}>>;
|
102
102
|
}>;
|
103
|
-
Verified: import("@sinclair/typebox").TObject<{
|
104
|
-
checkbox: import("@sinclair/typebox").TBoolean;
|
105
|
-
}>;
|
106
103
|
"CoinGecko API ID (Recommended)": import("@sinclair/typebox").TObject<{
|
107
104
|
rich_text: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
108
105
|
plain_text: import("@sinclair/typebox").TString;
|
@@ -75,7 +75,6 @@ export const NotionWebhookDto = t.Object({
|
|
75
75
|
}),
|
76
76
|
"Chain ID (Required)": t.Object({ number: t.Numeric() }),
|
77
77
|
"Symbol (Optional)": t.Object({ rich_text: t.Array(t.Object({ plain_text: t.String() })) }),
|
78
|
-
Verified: t.Object({ checkbox: t.Boolean() }),
|
79
78
|
"CoinGecko API ID (Recommended)": t.Object({ rich_text: t.Array(t.Object({ plain_text: t.String() })) }),
|
80
79
|
}),
|
81
80
|
}),
|
@@ -259,7 +259,6 @@ export class TokenService {
|
|
259
259
|
}
|
260
260
|
static async notionWebhook(body) {
|
261
261
|
const env = process.env.ENV === "prod" ? "production" : process.env.ENV;
|
262
|
-
const bucket = new BucketService(`merkl-${env}-tokens`, `angle-${env}-1`);
|
263
262
|
const properties = body.data.properties;
|
264
263
|
const file = properties["Icon (Required)"].files[0];
|
265
264
|
const iconURL = "external" in file ? file.external.url : file.file.url;
|
@@ -270,7 +269,6 @@ export class TokenService {
|
|
270
269
|
const chainId = properties["Chain ID (Required)"].number;
|
271
270
|
throwOnUnsupportedChainId(chainId);
|
272
271
|
const displaySymbol = properties["Symbol (Optional)"].rich_text[0]?.plain_text;
|
273
|
-
const isVerified = properties.Verified.checkbox;
|
274
272
|
const coingeckoApiId = properties["CoinGecko API ID (Recommended)"].rich_text[0]?.plain_text;
|
275
273
|
const [token] = await TokenService.findManyOrCreate([
|
276
274
|
{
|
@@ -281,11 +279,13 @@ export class TokenService {
|
|
281
279
|
if (!token || !token.name)
|
282
280
|
throw new HttpError(`Failed to fetch on-chain data for token ${token?.symbol} (${address} on chainId ${chainId}).`);
|
283
281
|
try {
|
284
|
-
await IconService.pullPush(iconURL,
|
282
|
+
await IconService.pullPush(iconURL, new BucketService(`merkl-${env}-tokens`, `angle-${env}-1`), {
|
283
|
+
name: `${chainId}/${address}`,
|
284
|
+
});
|
285
285
|
token.icon = `${process.env.GCS_ENDPOINT}/merkl-${env}-tokens/${chainId}/${address}.${extension}`;
|
286
286
|
}
|
287
287
|
catch (err) {
|
288
|
-
|
288
|
+
log.error(`[${token.id} (${chainId} | ${address})] Failed to pull / push from Notion to GCP. Using Notion URI for now.`, err);
|
289
289
|
token.icon = iconURL;
|
290
290
|
}
|
291
291
|
if (coingeckoApiId) {
|
@@ -305,7 +305,7 @@ export class TokenService {
|
|
305
305
|
icon: token.icon,
|
306
306
|
displaySymbol: displaySymbol && displaySymbol !== "" ? displaySymbol : token.symbol,
|
307
307
|
name: token.name,
|
308
|
-
verified:
|
308
|
+
verified: true,
|
309
309
|
});
|
310
310
|
}
|
311
311
|
/**
|
@@ -182,6 +182,7 @@ export declare const UserController: Elysia<"/users", false, {
|
|
182
182
|
tags: string[];
|
183
183
|
identifier: string;
|
184
184
|
action: import("@db/api").$Enums.OpportunityAction;
|
185
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
185
186
|
chainId: number;
|
186
187
|
depositUrl: string | null;
|
187
188
|
explorerAddress: string | null;
|
@@ -300,6 +301,7 @@ export declare const UserController: Elysia<"/users", false, {
|
|
300
301
|
tags: string[];
|
301
302
|
identifier: string;
|
302
303
|
action: import("@db/api").$Enums.OpportunityAction;
|
304
|
+
manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
|
303
305
|
chainId: number;
|
304
306
|
depositUrl: string | null;
|
305
307
|
explorerAddress: string | null;
|