@merkl/api 0.10.177 → 0.10.181
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/database/api/.generated/edge.js +6 -6
- package/dist/database/api/.generated/index-browser.js +4 -4
- package/dist/database/api/.generated/index.d.ts +2 -2
- package/dist/database/api/.generated/index.js +6 -6
- package/dist/database/api/.generated/libquery_engine-debian-openssl-1.1.x.so.node +0 -0
- package/dist/database/api/.generated/libquery_engine-linux-arm64-openssl-1.1.x.so.node +0 -0
- package/dist/database/api/.generated/libquery_engine-linux-musl-arm64-openssl-3.0.x.so.node +0 -0
- package/dist/database/api/.generated/package.json +1 -1
- package/dist/database/api/.generated/runtime/edge-esm.js +15 -15
- package/dist/database/api/.generated/runtime/edge.js +16 -16
- package/dist/database/api/.generated/runtime/library.d.ts +23 -34
- package/dist/database/api/.generated/runtime/library.js +56 -56
- package/dist/database/api/.generated/runtime/react-native.js +23 -23
- package/dist/database/api/.generated/runtime/wasm.js +15 -15
- package/dist/database/api/.generated/wasm.js +4 -4
- package/dist/database/engine/.generated/edge.js +6 -6
- package/dist/database/engine/.generated/index-browser.js +4 -4
- package/dist/database/engine/.generated/index.d.ts +2 -2
- package/dist/database/engine/.generated/index.js +6 -6
- package/dist/database/engine/.generated/libquery_engine-debian-openssl-1.1.x.so.node +0 -0
- package/dist/database/engine/.generated/libquery_engine-linux-arm64-openssl-1.1.x.so.node +0 -0
- package/dist/database/engine/.generated/libquery_engine-linux-musl-arm64-openssl-3.0.x.so.node +0 -0
- package/dist/database/engine/.generated/package.json +1 -1
- package/dist/database/engine/.generated/runtime/edge-esm.js +15 -15
- package/dist/database/engine/.generated/runtime/edge.js +16 -16
- package/dist/database/engine/.generated/runtime/library.d.ts +23 -34
- package/dist/database/engine/.generated/runtime/library.js +56 -56
- package/dist/database/engine/.generated/runtime/react-native.js +23 -23
- package/dist/database/engine/.generated/runtime/wasm.js +15 -15
- package/dist/database/engine/.generated/wasm.js +4 -4
- package/dist/src/eden/index.d.ts +348 -63
- package/dist/src/index.d.ts +140 -21
- package/dist/src/index.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/CLAMMDynamicData.js +2 -2
- package/dist/src/libs/campaigns/campaignTypes/ERC20DynamicDataRefacto.js +3 -3
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.d.ts +2 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.js +4 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/AuraProcessor.d.ts +1 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/AuraProcessor.js +12 -3
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/PendleProcessor.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/PendleProcessor.js +1 -3
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/StakingProcessor.d.ts +39 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/StakingProcessor.js +45 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/processorMapping.js +2 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1RefactoFinal.d.ts +2 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1RefactoFinal.js +25 -1
- package/dist/src/modules/v4/bucket/bucket.service.d.ts +5 -0
- package/dist/src/modules/v4/bucket/bucket.service.js +11 -0
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +11 -13
- package/dist/src/modules/v4/campaign/campaign.controller.js +3 -3
- package/dist/src/modules/v4/campaign/campaign.repository.js +1 -1
- package/dist/src/modules/v4/chain/chain.controller.d.ts +24 -0
- package/dist/src/modules/v4/chain/chain.controller.js +8 -2
- package/dist/src/modules/v4/chain/chain.model.d.ts +4 -0
- package/dist/src/modules/v4/chain/chain.model.js +4 -0
- package/dist/src/modules/v4/chain/chain.repository.d.ts +6 -1
- package/dist/src/modules/v4/chain/chain.repository.js +3 -0
- package/dist/src/modules/v4/chain/chain.service.d.ts +6 -1
- package/dist/src/modules/v4/chain/chain.service.js +7 -0
- package/dist/src/modules/v4/enso/enso.service.d.ts +1 -1
- package/dist/src/modules/v4/interaction/interaction.controller.d.ts +1 -1
- package/dist/src/modules/v4/{position → liquidity}/implementations/AjnaPositionFetcher.d.ts +1 -1
- package/dist/src/modules/v4/{position → liquidity}/implementations/BadgerPositionFetcher.d.ts +1 -1
- package/dist/src/modules/v4/{position → liquidity}/implementations/ClammPositionFetcher.d.ts +1 -1
- package/dist/src/modules/v4/{position → liquidity}/implementations/DolomitePositionFetcher.d.ts +1 -1
- package/dist/src/modules/v4/{position → liquidity}/implementations/DolomitePositionFetcher.js +2 -2
- package/dist/src/modules/v4/{position → liquidity}/implementations/ERC20PositionFetcher.d.ts +1 -1
- package/dist/src/modules/v4/{position → liquidity}/implementations/EulerPositionFetcher.d.ts +1 -1
- package/dist/src/modules/v4/liquidity/index.d.ts +2 -0
- package/dist/src/modules/v4/liquidity/index.js +2 -0
- package/dist/src/modules/v4/{position/position.controller.d.ts → liquidity/liquidity.controller.d.ts} +3 -3
- package/dist/src/modules/v4/{position/position.controller.js → liquidity/liquidity.controller.js} +4 -4
- package/dist/src/modules/v4/{position/position.repository.d.ts → liquidity/liquidity.repository.d.ts} +1 -1
- package/dist/src/modules/v4/{position/position.repository.js → liquidity/liquidity.repository.js} +1 -1
- package/dist/src/modules/v4/liquidity/liquidity.service.d.ts +5 -0
- package/dist/src/modules/v4/{position/position.service.js → liquidity/liquidity.service.js} +2 -2
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +34 -0
- package/dist/src/modules/v4/opportunity/opportunity.controller.js +11 -2
- package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +8 -0
- package/dist/src/modules/v4/opportunity/opportunity.model.js +5 -0
- package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +29 -1
- package/dist/src/modules/v4/opportunity/opportunity.repository.js +6 -0
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +15 -1
- package/dist/src/modules/v4/opportunity/opportunity.service.js +7 -6
- package/dist/src/modules/v4/protocol/protocol.controller.d.ts +30 -1
- package/dist/src/modules/v4/protocol/protocol.controller.js +9 -2
- package/dist/src/modules/v4/protocol/protocol.model.d.ts +10 -1
- package/dist/src/modules/v4/protocol/protocol.model.js +9 -0
- package/dist/src/modules/v4/protocol/protocol.repository.d.ts +9 -1
- package/dist/src/modules/v4/protocol/protocol.repository.js +4 -1
- package/dist/src/modules/v4/protocol/protocol.service.d.ts +11 -3
- package/dist/src/modules/v4/protocol/protocol.service.js +38 -32
- package/dist/src/modules/v4/reward/subservices/converter.js +2 -2
- package/dist/src/modules/v4/router.d.ts +140 -21
- package/dist/src/modules/v4/router.js +2 -2
- package/dist/src/modules/v4/token/token.controller.d.ts +38 -4
- package/dist/src/modules/v4/token/token.controller.js +11 -3
- package/dist/src/modules/v4/token/token.model.d.ts +9 -0
- package/dist/src/modules/v4/token/token.model.js +7 -0
- package/dist/src/modules/v4/token/token.repository.d.ts +14 -1
- package/dist/src/modules/v4/token/token.repository.js +3 -0
- package/dist/src/modules/v4/token/token.service.d.ts +18 -5
- package/dist/src/modules/v4/token/token.service.js +9 -2
- package/dist/src/routes/v3/blacklist.d.ts +140 -21
- package/dist/src/routes/v3/campaigns.d.ts +140 -21
- package/dist/src/routes/v3/campaignsInfo.d.ts +140 -21
- package/dist/src/routes/v3/multiChainPositions.d.ts +140 -21
- package/dist/src/routes/v3/opportunity.d.ts +140 -21
- package/dist/src/routes/v3/positions.d.ts +140 -21
- package/dist/src/routes/v3/rewards.d.ts +140 -21
- package/dist/src/routes/v3/updates.d.ts +140 -21
- package/dist/src/routes/v3/userRewards.d.ts +140 -21
- package/dist/src/utils/decodeCalls.js +5 -1
- package/dist/src/utils/encodeCalls.js +13 -1
- package/dist/src/utils/generateCardName.js +3 -1
- package/dist/src/utils/logger.d.ts +12 -6
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +24 -24
- package/dist/src/modules/v4/position/index.d.ts +0 -2
- package/dist/src/modules/v4/position/index.js +0 -2
- package/dist/src/modules/v4/position/position.service.d.ts +0 -5
- /package/dist/src/modules/v4/{position → liquidity}/implementations/AjnaPositionFetcher.js +0 -0
- /package/dist/src/modules/v4/{position → liquidity}/implementations/BadgerPositionFetcher.js +0 -0
- /package/dist/src/modules/v4/{position → liquidity}/implementations/ClammPositionFetcher.js +0 -0
- /package/dist/src/modules/v4/{position → liquidity}/implementations/ERC20PositionFetcher.js +0 -0
- /package/dist/src/modules/v4/{position → liquidity}/implementations/EulerPositionFetcher.js +0 -0
- /package/dist/src/modules/v4/{position/position.model.d.ts → liquidity/liquidity.model.d.ts} +0 -0
- /package/dist/src/modules/v4/{position/position.model.js → liquidity/liquidity.model.js} +0 -0
@@ -26,6 +26,8 @@ const protocolTypes = [
|
|
26
26
|
"zero",
|
27
27
|
"koi",
|
28
28
|
"supswap-v3",
|
29
|
+
"zkswap",
|
30
|
+
"thirdtrade",
|
29
31
|
// ─── LP DEX ──────────────────────────────────────────────────────────
|
30
32
|
"uniswap-v2",
|
31
33
|
"velodrome",
|
@@ -69,3 +71,10 @@ export const GetProtocolsQueryDto = t.Object({
|
|
69
71
|
items: t.Optional(t.Numeric()),
|
70
72
|
});
|
71
73
|
export const GetProtocolParamsDto = t.Object({ id: t.String() });
|
74
|
+
export const UpdateProtocolDto = t.Object({
|
75
|
+
icon: t.Optional(t.String({ format: "uri" })),
|
76
|
+
url: t.Optional(t.String({ format: "uri" })),
|
77
|
+
description: t.Optional(t.String()),
|
78
|
+
// iconFile: t.Optional(t.File()),
|
79
|
+
});
|
80
|
+
export const ProtocolIdDto = t.Object({ id: t.String() });
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { GetProtocolsQueryModel, Protocol } from "./protocol.model";
|
1
|
+
import type { GetProtocolsQueryModel, Protocol, UpdateProtocolModel } from "./protocol.model";
|
2
2
|
export declare abstract class ProtocolRepository {
|
3
3
|
#private;
|
4
4
|
static create(template: Protocol["action"]["create"]["args"]): Promise<{
|
@@ -34,4 +34,12 @@ export declare abstract class ProtocolRepository {
|
|
34
34
|
icon: string;
|
35
35
|
}[]>;
|
36
36
|
static countMany(query: GetProtocolsQueryModel): Promise<number>;
|
37
|
+
static update(id: string, data: UpdateProtocolModel): Promise<{
|
38
|
+
name: string;
|
39
|
+
url: string;
|
40
|
+
description: string;
|
41
|
+
id: string;
|
42
|
+
tags: import("../../../../database/api/.generated").$Enums.ProtocolTag[];
|
43
|
+
icon: string;
|
44
|
+
}>;
|
37
45
|
}
|
@@ -15,7 +15,7 @@ export class ProtocolRepository {
|
|
15
15
|
where: {
|
16
16
|
name: query.name ? { contains: query.name, mode: "insensitive" } : undefined,
|
17
17
|
tags: query.tags ? { hasEvery: query.tags } : undefined,
|
18
|
-
id: query.id ? { in: query.id } : undefined,
|
18
|
+
id: typeof query.id === "string" ? query.id : !!query.id ? { in: query.id } : undefined,
|
19
19
|
},
|
20
20
|
};
|
21
21
|
}
|
@@ -34,4 +34,7 @@ export class ProtocolRepository {
|
|
34
34
|
const args = ProtocolRepository.#transformQueryToPrismaFilters(query);
|
35
35
|
return await apiDbClient.protocol.count(args);
|
36
36
|
}
|
37
|
+
static async update(id, data) {
|
38
|
+
return await apiDbClient.protocol.update({ where: { id }, data });
|
39
|
+
}
|
37
40
|
}
|
@@ -1,10 +1,18 @@
|
|
1
1
|
import { AMM as AMMV3 } from "@sdk";
|
2
|
-
import type { GetProtocolsQueryModel, Protocol, ProtocolId } from "./protocol.model";
|
2
|
+
import type { GetProtocolsQueryModel, Protocol, ProtocolId, UpdateProtocolModel } from "./protocol.model";
|
3
3
|
export declare abstract class ProtocolService {
|
4
4
|
static getIdFromAmmV3(amm: AMMV3): ProtocolId;
|
5
|
-
static
|
6
|
-
static findMany(query: GetProtocolsQueryModel): Promise<Protocol["model"][] | null>;
|
5
|
+
static findMany(query: GetProtocolsQueryModel): Promise<Protocol["model"][]>;
|
7
6
|
static countMany(query: GetProtocolsQueryModel): Promise<number>;
|
8
7
|
static getFromId(id: ProtocolId | string): Promise<Protocol["model"] | null>;
|
9
8
|
static getFromName(name: string): Promise<Protocol["model"] | null>;
|
9
|
+
static update(id: string, data: UpdateProtocolModel): Promise<{
|
10
|
+
name: string;
|
11
|
+
url: string;
|
12
|
+
description: string;
|
13
|
+
id: string;
|
14
|
+
tags: import("../../../../database/api/.generated").$Enums.ProtocolTag[];
|
15
|
+
icon: string;
|
16
|
+
}>;
|
17
|
+
static changeLogoUrls(): Promise<void>;
|
10
18
|
}
|
@@ -1,4 +1,7 @@
|
|
1
|
+
import { log } from "../../../utils/logger";
|
1
2
|
import { AMM as AMMV3 } from "@sdk";
|
3
|
+
import { ChainService } from "../chain";
|
4
|
+
import { TokenService } from "../token";
|
2
5
|
import { ProtocolRepository } from "./protocol.repository";
|
3
6
|
// ─── Protocols Services ──────────────────────────────────────────────────────
|
4
7
|
export class ProtocolService {
|
@@ -28,40 +31,11 @@ export class ProtocolService {
|
|
28
31
|
[AMMV3.ZERO]: "zero",
|
29
32
|
[AMMV3.KOI]: "koi",
|
30
33
|
[AMMV3.SupswapV3]: "supswap-v3",
|
34
|
+
[AMMV3.AERODROME]: "aerodrome",
|
35
|
+
[AMMV3.zkSwap]: "zkswap",
|
36
|
+
[AMMV3.ThirdTrade]: "thirdtrade",
|
31
37
|
}[amm];
|
32
38
|
}
|
33
|
-
static getIdFromErc20Type(_type) {
|
34
|
-
return {
|
35
|
-
uniswapv2: "uniswap-v2",
|
36
|
-
velodrome: "velodrome",
|
37
|
-
aerodrome: "aerodrome",
|
38
|
-
balancerGauge: "balancer",
|
39
|
-
balancerPool: "balancer",
|
40
|
-
curve: "curve",
|
41
|
-
aura: "aura",
|
42
|
-
akron: "akron",
|
43
|
-
dragonswap: "dragonswap",
|
44
|
-
poolside: "poolside",
|
45
|
-
koi: "koi",
|
46
|
-
radiant_borrow: "radiant",
|
47
|
-
radiant_lend: "radiant",
|
48
|
-
aave_borrowing: "radiant",
|
49
|
-
euler_borrow: "euler",
|
50
|
-
euler_lend: "euler",
|
51
|
-
gearbox: "gearbox",
|
52
|
-
compound: "compound",
|
53
|
-
aave_lending: "aave",
|
54
|
-
sturdy_aggregator: "sturdy",
|
55
|
-
sturdy_silo: "sturdy",
|
56
|
-
fraxlend: "frax",
|
57
|
-
moonwell: "moonwell",
|
58
|
-
ionic: "ionic",
|
59
|
-
fluid: "fluid",
|
60
|
-
silostaking: "silo",
|
61
|
-
layerbank: "layerbank",
|
62
|
-
beefy: "beefy",
|
63
|
-
}[_type];
|
64
|
-
}
|
65
39
|
static async findMany(query) {
|
66
40
|
return ProtocolRepository.findMany(query);
|
67
41
|
}
|
@@ -75,4 +49,36 @@ export class ProtocolService {
|
|
75
49
|
static async getFromName(name) {
|
76
50
|
return (await ProtocolRepository.findManyByName(name))[0];
|
77
51
|
}
|
52
|
+
static async update(id, data) {
|
53
|
+
// let iconUri = data.icon;
|
54
|
+
// if (data.iconFile) {
|
55
|
+
// iconUri = await BucketService.upload("merkl-assets", `/protocols/${id}`, data.iconFile.stream(), true);
|
56
|
+
// }
|
57
|
+
return await ProtocolRepository.update(id, data);
|
58
|
+
}
|
59
|
+
static async changeLogoUrls() {
|
60
|
+
const oldUrl = "https://storage.googleapis.com/merkl-assets/";
|
61
|
+
const newUrl = "https://raw.githubusercontent.com/AngleProtocol/angle-token-list/main/src/assets/";
|
62
|
+
const protocols = await ProtocolService.findMany({ items: 10_000 });
|
63
|
+
for (const protocol of protocols) {
|
64
|
+
if (protocol.icon.includes(oldUrl)) {
|
65
|
+
await ProtocolService.update(protocol.id, { icon: protocol.icon.replace(oldUrl, newUrl) });
|
66
|
+
log.info(`Updated protocol ${protocol.id} icon`);
|
67
|
+
}
|
68
|
+
}
|
69
|
+
const chains = await ChainService.findMany();
|
70
|
+
for (const chain of chains) {
|
71
|
+
if (chain.icon.includes(oldUrl)) {
|
72
|
+
await ChainService.update(chain.id, { icon: chain.icon.replace(oldUrl, newUrl) });
|
73
|
+
log.info(`Updated chain ${chain.id} icon`);
|
74
|
+
}
|
75
|
+
}
|
76
|
+
const tokens = await TokenService.findMany({});
|
77
|
+
for (const token of tokens) {
|
78
|
+
if (token.icon.includes(oldUrl)) {
|
79
|
+
await TokenService.update(token.id, { icon: token.icon.replace(oldUrl, newUrl) });
|
80
|
+
log.info(`Updated token ${token.id} icon`);
|
81
|
+
}
|
82
|
+
}
|
83
|
+
}
|
78
84
|
}
|
@@ -77,8 +77,8 @@ export class RewardConvertorService {
|
|
77
77
|
accumulated: "0",
|
78
78
|
unclaimed: "0",
|
79
79
|
pending: "0",
|
80
|
-
auxiliaryData1: breakdown.auxiliaryData1 === "" ? "0" : breakdown.auxiliaryData1 ?? "0",
|
81
|
-
auxiliaryData2: breakdown.auxiliaryData2 === "" ? "0" : breakdown.auxiliaryData2 ?? "0",
|
80
|
+
auxiliaryData1: breakdown.auxiliaryData1 === "" ? "0" : (breakdown.auxiliaryData1 ?? "0"),
|
81
|
+
auxiliaryData2: breakdown.auxiliaryData2 === "" ? "0" : (breakdown.auxiliaryData2 ?? "0"),
|
82
82
|
decimals: token.decimals,
|
83
83
|
mainParameter: breakdown.opportunity.identifier,
|
84
84
|
symbol: token.symbol,
|
@@ -477,6 +477,40 @@ export declare const v4: Elysia<"/v4", false, {
|
|
477
477
|
};
|
478
478
|
};
|
479
479
|
};
|
480
|
+
} & {
|
481
|
+
opportunities: {
|
482
|
+
":id": {
|
483
|
+
patch: {
|
484
|
+
body: {
|
485
|
+
name?: string | undefined;
|
486
|
+
tags?: string[] | undefined;
|
487
|
+
};
|
488
|
+
params: {
|
489
|
+
id: string;
|
490
|
+
};
|
491
|
+
query: unknown;
|
492
|
+
headers: {
|
493
|
+
authorization: string;
|
494
|
+
};
|
495
|
+
response: {
|
496
|
+
200: {
|
497
|
+
name: string;
|
498
|
+
type: import("../../../database/api/.generated").$Enums.CampaignType;
|
499
|
+
id: string;
|
500
|
+
status: import("../../../database/api/.generated").$Enums.Status;
|
501
|
+
tags: string[];
|
502
|
+
identifier: string;
|
503
|
+
chainId: number;
|
504
|
+
action: import("../../../database/api/.generated").$Enums.OpportunityAction;
|
505
|
+
mainProtocolId: string | null;
|
506
|
+
tvl: number;
|
507
|
+
apr: number;
|
508
|
+
dailyRewards: number;
|
509
|
+
};
|
510
|
+
};
|
511
|
+
};
|
512
|
+
};
|
513
|
+
};
|
480
514
|
};
|
481
515
|
} & {
|
482
516
|
v4: {
|
@@ -660,19 +694,17 @@ export declare const v4: Elysia<"/v4", false, {
|
|
660
694
|
} & {
|
661
695
|
"campaigns-to-process": {
|
662
696
|
engine: {
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
200: string;
|
675
|
-
};
|
697
|
+
post: {
|
698
|
+
body: unknown;
|
699
|
+
params: {};
|
700
|
+
query: {
|
701
|
+
chainId: number;
|
702
|
+
};
|
703
|
+
headers: {
|
704
|
+
authorization: string;
|
705
|
+
};
|
706
|
+
response: {
|
707
|
+
200: string;
|
676
708
|
};
|
677
709
|
};
|
678
710
|
};
|
@@ -725,7 +757,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
725
757
|
id: string;
|
726
758
|
tags: import("../../../database/api/.generated").$Enums.ProtocolTag[];
|
727
759
|
icon: string;
|
728
|
-
} & {})[]
|
760
|
+
} & {})[];
|
729
761
|
};
|
730
762
|
};
|
731
763
|
};
|
@@ -744,6 +776,35 @@ export declare const v4: Elysia<"/v4", false, {
|
|
744
776
|
};
|
745
777
|
};
|
746
778
|
};
|
779
|
+
} & {
|
780
|
+
protocols: {
|
781
|
+
":id": {
|
782
|
+
patch: {
|
783
|
+
body: {
|
784
|
+
url?: string | undefined;
|
785
|
+
description?: string | undefined;
|
786
|
+
icon?: string | undefined;
|
787
|
+
};
|
788
|
+
params: {
|
789
|
+
id: string;
|
790
|
+
};
|
791
|
+
query: unknown;
|
792
|
+
headers: {
|
793
|
+
authorization: string;
|
794
|
+
};
|
795
|
+
response: {
|
796
|
+
200: {
|
797
|
+
name: string;
|
798
|
+
url: string;
|
799
|
+
description: string;
|
800
|
+
id: string;
|
801
|
+
tags: import("../../../database/api/.generated").$Enums.ProtocolTag[];
|
802
|
+
icon: string;
|
803
|
+
};
|
804
|
+
};
|
805
|
+
};
|
806
|
+
};
|
807
|
+
};
|
747
808
|
};
|
748
809
|
} & {
|
749
810
|
v4: {
|
@@ -822,7 +883,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
822
883
|
};
|
823
884
|
headers: unknown;
|
824
885
|
response: {
|
825
|
-
200: {
|
886
|
+
200: ({
|
826
887
|
symbol: string;
|
827
888
|
name: string | null;
|
828
889
|
id: string;
|
@@ -830,11 +891,11 @@ export declare const v4: Elysia<"/v4", false, {
|
|
830
891
|
address: string;
|
831
892
|
icon: string;
|
832
893
|
decimals: number;
|
833
|
-
displaySymbol: string;
|
834
894
|
verified: boolean;
|
835
895
|
isTest: boolean;
|
836
|
-
|
837
|
-
|
896
|
+
} & {
|
897
|
+
price?: number | null | undefined;
|
898
|
+
})[];
|
838
899
|
};
|
839
900
|
};
|
840
901
|
};
|
@@ -860,6 +921,40 @@ export declare const v4: Elysia<"/v4", false, {
|
|
860
921
|
};
|
861
922
|
};
|
862
923
|
};
|
924
|
+
} & {
|
925
|
+
tokens: {
|
926
|
+
":id": {
|
927
|
+
patch: {
|
928
|
+
body: {
|
929
|
+
icon?: string | undefined;
|
930
|
+
displaySymbol?: string | undefined;
|
931
|
+
isTest?: boolean | undefined;
|
932
|
+
};
|
933
|
+
params: {
|
934
|
+
id: string;
|
935
|
+
};
|
936
|
+
query: unknown;
|
937
|
+
headers: {
|
938
|
+
authorization: string;
|
939
|
+
};
|
940
|
+
response: {
|
941
|
+
200: {
|
942
|
+
symbol: string;
|
943
|
+
name: string | null;
|
944
|
+
id: string;
|
945
|
+
chainId: number;
|
946
|
+
address: string;
|
947
|
+
icon: string;
|
948
|
+
decimals: number;
|
949
|
+
displaySymbol: string;
|
950
|
+
verified: boolean;
|
951
|
+
isTest: boolean;
|
952
|
+
price: number | null;
|
953
|
+
};
|
954
|
+
};
|
955
|
+
};
|
956
|
+
};
|
957
|
+
};
|
863
958
|
};
|
864
959
|
} & {
|
865
960
|
v4: {
|
@@ -1139,6 +1234,30 @@ export declare const v4: Elysia<"/v4", false, {
|
|
1139
1234
|
};
|
1140
1235
|
};
|
1141
1236
|
};
|
1237
|
+
} & {
|
1238
|
+
chains: {
|
1239
|
+
":chainId": {
|
1240
|
+
patch: {
|
1241
|
+
body: {
|
1242
|
+
icon?: string | undefined;
|
1243
|
+
};
|
1244
|
+
params: {
|
1245
|
+
chainId: number;
|
1246
|
+
};
|
1247
|
+
query: unknown;
|
1248
|
+
headers: {
|
1249
|
+
authorization: string;
|
1250
|
+
};
|
1251
|
+
response: {
|
1252
|
+
200: {
|
1253
|
+
name: string;
|
1254
|
+
id: number;
|
1255
|
+
icon: string;
|
1256
|
+
};
|
1257
|
+
};
|
1258
|
+
};
|
1259
|
+
};
|
1260
|
+
};
|
1142
1261
|
};
|
1143
1262
|
} & {
|
1144
1263
|
v4: {
|
@@ -1839,7 +1958,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
1839
1958
|
id: string;
|
1840
1959
|
tags: import("../../../database/api/.generated").$Enums.ProtocolTag[];
|
1841
1960
|
icon: string;
|
1842
|
-
} & {})[]
|
1961
|
+
} & {})[];
|
1843
1962
|
};
|
1844
1963
|
};
|
1845
1964
|
};
|
@@ -2230,7 +2349,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
2230
2349
|
};
|
2231
2350
|
} & {
|
2232
2351
|
v4: {
|
2233
|
-
|
2352
|
+
liquidity: {
|
2234
2353
|
index: {
|
2235
2354
|
get: {
|
2236
2355
|
body: unknown;
|
@@ -2241,7 +2360,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
2241
2360
|
};
|
2242
2361
|
headers: unknown;
|
2243
2362
|
response: {
|
2244
|
-
200:
|
2363
|
+
200: import("./liquidity").PositionT[];
|
2245
2364
|
};
|
2246
2365
|
};
|
2247
2366
|
};
|
@@ -17,8 +17,8 @@ import { PrismaInstrumentation } from "@prisma/instrumentation";
|
|
17
17
|
import Elysia from "elysia";
|
18
18
|
import { DynamicDataController } from "./dynamicData";
|
19
19
|
import { InteractionController } from "./interaction/interaction.controller";
|
20
|
+
import { LiquidityController } from "./liquidity/liquidity.controller";
|
20
21
|
import { MerklRootController } from "./merklRoot";
|
21
|
-
import { PositionController } from "./position/position.controller";
|
22
22
|
import { StatusController } from "./status";
|
23
23
|
import { UserController } from "./user";
|
24
24
|
// ─── V4 Router ───────────────────────────────────────────────────────────────
|
@@ -59,4 +59,4 @@ export const v4 = new Elysia({ tags: ["v4"], prefix: "/v4" })
|
|
59
59
|
.use(AccountingController)
|
60
60
|
.use(DynamicDataController)
|
61
61
|
.use(StatusController)
|
62
|
-
.use(
|
62
|
+
.use(LiquidityController);
|
@@ -87,7 +87,7 @@ export declare const TokenController: Elysia<"/tokens", false, {
|
|
87
87
|
};
|
88
88
|
headers: unknown;
|
89
89
|
response: {
|
90
|
-
200: {
|
90
|
+
200: ({
|
91
91
|
symbol: string;
|
92
92
|
name: string | null;
|
93
93
|
id: string;
|
@@ -95,11 +95,11 @@ export declare const TokenController: Elysia<"/tokens", false, {
|
|
95
95
|
address: string;
|
96
96
|
icon: string;
|
97
97
|
decimals: number;
|
98
|
-
displaySymbol: string;
|
99
98
|
verified: boolean;
|
100
99
|
isTest: boolean;
|
101
|
-
|
102
|
-
|
100
|
+
} & {
|
101
|
+
price?: number | null | undefined;
|
102
|
+
})[];
|
103
103
|
};
|
104
104
|
};
|
105
105
|
};
|
@@ -125,6 +125,40 @@ export declare const TokenController: Elysia<"/tokens", false, {
|
|
125
125
|
};
|
126
126
|
};
|
127
127
|
};
|
128
|
+
} & {
|
129
|
+
tokens: {
|
130
|
+
":id": {
|
131
|
+
patch: {
|
132
|
+
body: {
|
133
|
+
icon?: string | undefined;
|
134
|
+
displaySymbol?: string | undefined;
|
135
|
+
isTest?: boolean | undefined;
|
136
|
+
};
|
137
|
+
params: {
|
138
|
+
id: string;
|
139
|
+
};
|
140
|
+
query: unknown;
|
141
|
+
headers: {
|
142
|
+
authorization: string;
|
143
|
+
};
|
144
|
+
response: {
|
145
|
+
200: {
|
146
|
+
symbol: string;
|
147
|
+
name: string | null;
|
148
|
+
id: string;
|
149
|
+
chainId: number;
|
150
|
+
address: string;
|
151
|
+
icon: string;
|
152
|
+
decimals: number;
|
153
|
+
displaySymbol: string;
|
154
|
+
verified: boolean;
|
155
|
+
isTest: boolean;
|
156
|
+
price: number | null;
|
157
|
+
};
|
158
|
+
};
|
159
|
+
};
|
160
|
+
};
|
161
|
+
};
|
128
162
|
}, {
|
129
163
|
derive: {};
|
130
164
|
resolve: {};
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { NotFoundError } from "../../../errors/NotFound.error";
|
2
|
+
import { AuthorizationHeadersDto, BackOfficeGuard } from "../../../guards/BackOffice.guard";
|
2
3
|
import Elysia from "elysia";
|
3
|
-
import { FindUniqueTokenDto, GetTokenBalanceDto, GetTokenQueryDto } from "./token.model";
|
4
|
+
import { FindUniqueTokenDto, GetTokenBalanceDto, GetTokenQueryDto, TokenIdDto, UpdateTokenDto } from "./token.model";
|
4
5
|
import { TokenService } from "./token.service";
|
5
6
|
// ─── Tokens Controller ───────────────────────────────────────────────────────
|
6
7
|
export const TokenController = new Elysia({ prefix: "/tokens", detail: { tags: ["Tokens"] } })
|
@@ -25,5 +26,12 @@ export const TokenController = new Elysia({ prefix: "/tokens", detail: { tags: [
|
|
25
26
|
})
|
26
27
|
// ─── Get Many Tokens ─────────────────────────────────────────────────
|
27
28
|
.get("/", async ({ query }) => await TokenService.findMany(query), { query: GetTokenQueryDto })
|
28
|
-
// ─── Count Tokens
|
29
|
-
.get("/count", async ({ query }) => await TokenService.countMany(query), { query: GetTokenQueryDto })
|
29
|
+
// ─── Count Tokens ────────────────────────────────────────────────────
|
30
|
+
.get("/count", async ({ query }) => await TokenService.countMany(query), { query: GetTokenQueryDto })
|
31
|
+
// ─── Update IsTest Status ────────────────────────────────────────────
|
32
|
+
.patch("/:id", async ({ params, body }) => await TokenService.update(params.id, body), {
|
33
|
+
params: TokenIdDto,
|
34
|
+
body: UpdateTokenDto,
|
35
|
+
headers: AuthorizationHeadersDto,
|
36
|
+
beforeHandle: BackOfficeGuard,
|
37
|
+
});
|
@@ -32,5 +32,14 @@ export declare const GetTokenBalanceDto: import("@sinclair/typebox").TObject<{
|
|
32
32
|
tokenAddress: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
33
33
|
additionalTokenAddresses: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
34
34
|
}>;
|
35
|
+
export declare const TokenIdDto: import("@sinclair/typebox").TObject<{
|
36
|
+
id: import("@sinclair/typebox").TString;
|
37
|
+
}>;
|
38
|
+
export declare const UpdateTokenDto: import("@sinclair/typebox").TObject<{
|
39
|
+
isTest: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
40
|
+
icon: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
41
|
+
displaySymbol: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
42
|
+
}>;
|
35
43
|
export type TokenModel = typeof TokenDto.static;
|
36
44
|
export type GetTokenQueryModel = typeof GetTokenQueryDto.static;
|
45
|
+
export type UpdateTokenModel = typeof UpdateTokenDto.static;
|
@@ -22,3 +22,10 @@ export const GetTokenBalanceDto = t.Object({
|
|
22
22
|
tokenAddress: t.Optional(t.String({ description: "If provided, the default verified token balances won't be included" })),
|
23
23
|
additionalTokenAddresses: t.Optional(t.Array(t.String())),
|
24
24
|
});
|
25
|
+
export const TokenIdDto = t.Object({ id: t.String() });
|
26
|
+
export const UpdateTokenDto = t.Object({
|
27
|
+
isTest: t.Optional(t.Boolean()),
|
28
|
+
icon: t.Optional(t.String({ format: "uri" })),
|
29
|
+
// iconFile: t.Optional(t.File()),
|
30
|
+
displaySymbol: t.Optional(t.String()),
|
31
|
+
});
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { type ChainId } from "@sdk";
|
2
|
-
import type { GetTokenQueryModel, Token, TokenModel } from "./token.model";
|
2
|
+
import type { GetTokenQueryModel, Token, TokenModel, UpdateTokenModel } from "./token.model";
|
3
3
|
export declare abstract class TokenRepository {
|
4
4
|
#private;
|
5
5
|
/**
|
@@ -68,4 +68,17 @@ export declare abstract class TokenRepository {
|
|
68
68
|
* @param token
|
69
69
|
*/
|
70
70
|
static create(token: Token["model"]): Promise<Token["model"] | undefined>;
|
71
|
+
static update(id: string, data: UpdateTokenModel): Promise<{
|
72
|
+
symbol: string;
|
73
|
+
name: string | null;
|
74
|
+
id: string;
|
75
|
+
chainId: number;
|
76
|
+
address: string;
|
77
|
+
icon: string;
|
78
|
+
decimals: number;
|
79
|
+
displaySymbol: string;
|
80
|
+
verified: boolean;
|
81
|
+
isTest: boolean;
|
82
|
+
price: number | null;
|
83
|
+
}>;
|
71
84
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { GetTokenQueryModel, Token, TokenModel, TokenUnique } from "./";
|
1
|
+
import type { GetTokenQueryModel, Token, TokenModel, TokenUnique, UpdateTokenModel } from "./";
|
2
2
|
import type { Pricer } from "../../../utils/pricer";
|
3
3
|
import { Prisma } from "../../../../database/api/.generated";
|
4
4
|
import { type ChainId } from "@sdk";
|
@@ -133,7 +133,7 @@ export declare abstract class TokenService {
|
|
133
133
|
* @param query
|
134
134
|
* @returns A list of tokens
|
135
135
|
*/
|
136
|
-
static findMany(query: GetTokenQueryModel): Promise<{
|
136
|
+
static findMany(query: GetTokenQueryModel): Promise<({
|
137
137
|
symbol: string;
|
138
138
|
name: string | null;
|
139
139
|
id: string;
|
@@ -141,11 +141,11 @@ export declare abstract class TokenService {
|
|
141
141
|
address: string;
|
142
142
|
icon: string;
|
143
143
|
decimals: number;
|
144
|
-
displaySymbol: string;
|
145
144
|
verified: boolean;
|
146
145
|
isTest: boolean;
|
147
|
-
|
148
|
-
|
146
|
+
} & {
|
147
|
+
price?: number | null | undefined;
|
148
|
+
})[]>;
|
149
149
|
/**
|
150
150
|
* Get value of tokens
|
151
151
|
* @param tokenAmounts address/chain + amount of token
|
@@ -170,4 +170,17 @@ export declare abstract class TokenService {
|
|
170
170
|
* @param address
|
171
171
|
*/
|
172
172
|
static getManyOrCreate(tokens: TokenModel[]): Promise<(Token["model"] | undefined)[]>;
|
173
|
+
static update(id: string, data: UpdateTokenModel): Promise<{
|
174
|
+
symbol: string;
|
175
|
+
name: string | null;
|
176
|
+
id: string;
|
177
|
+
chainId: number;
|
178
|
+
address: string;
|
179
|
+
icon: string;
|
180
|
+
decimals: number;
|
181
|
+
displaySymbol: string;
|
182
|
+
verified: boolean;
|
183
|
+
isTest: boolean;
|
184
|
+
price: number | null;
|
185
|
+
}>;
|
173
186
|
}
|
@@ -47,7 +47,7 @@ export class TokenService {
|
|
47
47
|
* @param additionalTokens balances along with the verified ones
|
48
48
|
*/
|
49
49
|
static async fetchVerifiedBalances(chainId, userAddress, additionalTokenAddresses) {
|
50
|
-
const verifiedTokens =
|
50
|
+
const verifiedTokens = await TokenService.findMany({ chainId: chainId, verified: true });
|
51
51
|
const additionalTokens = !!additionalTokenAddresses?.length
|
52
52
|
? await TokenService.getManyOrCreate(additionalTokenAddresses?.map(address => ({ chainId, address })))
|
53
53
|
: [];
|
@@ -222,7 +222,7 @@ export class TokenService {
|
|
222
222
|
* @returns A list of tokens
|
223
223
|
*/
|
224
224
|
static async findMany(query) {
|
225
|
-
return await TokenRepository.findMany(query);
|
225
|
+
return (await TokenRepository.findMany(query)).map(TokenService.format);
|
226
226
|
}
|
227
227
|
/**
|
228
228
|
* Get value of tokens
|
@@ -274,4 +274,11 @@ export class TokenService {
|
|
274
274
|
}
|
275
275
|
}));
|
276
276
|
}
|
277
|
+
static async update(id, data) {
|
278
|
+
// let iconUri = data.icon;
|
279
|
+
// if (data.iconFile) {
|
280
|
+
// iconUri = await BucketService.upload("merkl-assets", `/tokens/${id}`, data.iconFile.stream(), true);
|
281
|
+
// }
|
282
|
+
return await TokenRepository.update(id, data);
|
283
|
+
}
|
277
284
|
}
|