@merkl/api 0.10.132 → 0.10.133

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.
Files changed (34) hide show
  1. package/dist/src/constants.d.ts +1 -0
  2. package/dist/src/constants.js +1 -0
  3. package/dist/src/eden/index.d.ts +16 -25
  4. package/dist/src/index.d.ts +4 -7
  5. package/dist/src/libs/campaigns/campaignTypes/ERC20DynamicDataRefacto.js +4 -8
  6. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.d.ts +3 -2
  7. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.js +11 -3
  8. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/MaverickBPProcessor.d.ts +50 -0
  9. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/MaverickBPProcessor.js +75 -0
  10. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/processorMapping.js +2 -0
  11. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1RefactoFinal.js +2 -0
  12. package/dist/src/modules/v4/enso/enso.service.d.ts +1 -0
  13. package/dist/src/modules/v4/participate/participate.controller.d.ts +1 -0
  14. package/dist/src/modules/v4/protocol/protocol.controller.d.ts +3 -7
  15. package/dist/src/modules/v4/protocol/protocol.controller.js +4 -9
  16. package/dist/src/modules/v4/protocol/protocol.model.d.ts +2 -2
  17. package/dist/src/modules/v4/protocol/protocol.model.js +4 -1
  18. package/dist/src/modules/v4/protocol/protocol.service.js +4 -3
  19. package/dist/src/modules/v4/router.d.ts +4 -7
  20. package/dist/src/routes/v3/ERC20Campaigns.d.ts +4 -7
  21. package/dist/src/routes/v3/blacklist.d.ts +4 -7
  22. package/dist/src/routes/v3/campaigns.d.ts +4 -7
  23. package/dist/src/routes/v3/campaignsInfo.d.ts +4 -7
  24. package/dist/src/routes/v3/multiChainPositions.d.ts +4 -7
  25. package/dist/src/routes/v3/opportunity.d.ts +4 -7
  26. package/dist/src/routes/v3/positions.d.ts +4 -7
  27. package/dist/src/routes/v3/rewards.d.ts +4 -7
  28. package/dist/src/routes/v3/updates.d.ts +4 -7
  29. package/dist/src/routes/v3/userRewards.d.ts +4 -7
  30. package/dist/src/utils/decodeCalls.js +3 -1
  31. package/dist/src/utils/encodeCalls.js +7 -1
  32. package/dist/src/utils/generateCardName.js +2 -0
  33. package/dist/tsconfig.package.tsbuildinfo +1 -1
  34. package/package.json +2 -1
@@ -348,3 +348,4 @@ export declare const constantChain: {
348
348
  glcr?: undefined;
349
349
  };
350
350
  };
351
+ export declare const MAVERICK_ZKSYNC_BP_LENS_ADDRESS = "0xd32CE31CaC98CAC0631764B8286358c0606D87F9";
@@ -117,3 +117,4 @@ export const constantChain = {
117
117
  cake: "0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82",
118
118
  },
119
119
  };
120
+ export const MAVERICK_ZKSYNC_BP_LENS_ADDRESS = "0xd32CE31CaC98CAC0631764B8286358c0606D87F9";
@@ -550,6 +550,7 @@ declare const eden: {
550
550
  name: string;
551
551
  url: string;
552
552
  description: string;
553
+ id: string;
553
554
  tags: import("../../database/api/.generated").$Enums.ProtocolTag[];
554
555
  icon: string;
555
556
  } | null;
@@ -571,23 +572,18 @@ declare const eden: {
571
572
  name: string;
572
573
  url: string;
573
574
  description: string;
575
+ id: string;
574
576
  tags: import("../../database/api/.generated").$Enums.ProtocolTag[];
575
577
  icon: string;
576
578
  } & {})[] | null;
577
579
  }>>;
578
580
  };
579
581
  count: {
580
- get: (options: {
582
+ get: (options?: {
581
583
  headers?: Record<string, unknown> | undefined;
582
- query: {
583
- name?: string | undefined;
584
- id?: string[] | undefined;
585
- items?: number | undefined;
586
- tags?: ("AMM" | "ALM" | "DEX" | "LENDING")[] | undefined;
587
- page?: number | undefined;
588
- };
584
+ query?: Record<string, unknown> | undefined;
589
585
  fetch?: RequestInit | undefined;
590
- }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
586
+ } | undefined) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
591
587
  200: number;
592
588
  }>>;
593
589
  };
@@ -1430,6 +1426,7 @@ declare const eden: {
1430
1426
  name: string;
1431
1427
  url: string;
1432
1428
  description: string;
1429
+ id: string;
1433
1430
  tags: import("../../database/api/.generated").$Enums.ProtocolTag[];
1434
1431
  icon: string;
1435
1432
  } & {})[] | null;
@@ -2422,6 +2419,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
2422
2419
  name: string;
2423
2420
  url: string;
2424
2421
  description: string;
2422
+ id: string;
2425
2423
  tags: import("../../database/api/.generated").$Enums.ProtocolTag[];
2426
2424
  icon: string;
2427
2425
  } | null;
@@ -2448,6 +2446,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
2448
2446
  name: string;
2449
2447
  url: string;
2450
2448
  description: string;
2449
+ id: string;
2451
2450
  tags: import("../../database/api/.generated").$Enums.ProtocolTag[];
2452
2451
  icon: string;
2453
2452
  } & {})[] | null;
@@ -2461,13 +2460,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
2461
2460
  get: {
2462
2461
  body: unknown;
2463
2462
  params: {};
2464
- query: {
2465
- name?: string | undefined;
2466
- id?: string[] | undefined;
2467
- items?: number | undefined;
2468
- tags?: ("AMM" | "ALM" | "DEX" | "LENDING")[] | undefined;
2469
- page?: number | undefined;
2470
- };
2463
+ query: unknown;
2471
2464
  headers: unknown;
2472
2465
  response: {
2473
2466
  200: number;
@@ -3547,6 +3540,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
3547
3540
  name: string;
3548
3541
  url: string;
3549
3542
  description: string;
3543
+ id: string;
3550
3544
  tags: import("../../database/api/.generated").$Enums.ProtocolTag[];
3551
3545
  icon: string;
3552
3546
  } & {})[] | null;
@@ -4557,6 +4551,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
4557
4551
  name: string;
4558
4552
  url: string;
4559
4553
  description: string;
4554
+ id: string;
4560
4555
  tags: import("../../database/api/.generated").$Enums.ProtocolTag[];
4561
4556
  icon: string;
4562
4557
  } | null;
@@ -4578,23 +4573,18 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
4578
4573
  name: string;
4579
4574
  url: string;
4580
4575
  description: string;
4576
+ id: string;
4581
4577
  tags: import("../../database/api/.generated").$Enums.ProtocolTag[];
4582
4578
  icon: string;
4583
4579
  } & {})[] | null;
4584
4580
  }>>;
4585
4581
  };
4586
4582
  count: {
4587
- get: (options: {
4583
+ get: (options?: {
4588
4584
  headers?: Record<string, unknown> | undefined;
4589
- query: {
4590
- name?: string | undefined;
4591
- id?: string[] | undefined;
4592
- items?: number | undefined;
4593
- tags?: ("AMM" | "ALM" | "DEX" | "LENDING")[] | undefined;
4594
- page?: number | undefined;
4595
- };
4585
+ query?: Record<string, unknown> | undefined;
4596
4586
  fetch?: RequestInit | undefined;
4597
- }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
4587
+ } | undefined) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
4598
4588
  200: number;
4599
4589
  }>>;
4600
4590
  };
@@ -5437,6 +5427,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
5437
5427
  name: string;
5438
5428
  url: string;
5439
5429
  description: string;
5430
+ id: string;
5440
5431
  tags: import("../../database/api/.generated").$Enums.ProtocolTag[];
5441
5432
  icon: string;
5442
5433
  } & {})[] | null;
@@ -639,6 +639,7 @@ declare const app: Elysia<"", false, {
639
639
  name: string;
640
640
  url: string;
641
641
  description: string;
642
+ id: string;
642
643
  tags: import("../database/api/.generated").$Enums.ProtocolTag[];
643
644
  icon: string;
644
645
  } | null;
@@ -665,6 +666,7 @@ declare const app: Elysia<"", false, {
665
666
  name: string;
666
667
  url: string;
667
668
  description: string;
669
+ id: string;
668
670
  tags: import("../database/api/.generated").$Enums.ProtocolTag[];
669
671
  icon: string;
670
672
  } & {})[] | null;
@@ -678,13 +680,7 @@ declare const app: Elysia<"", false, {
678
680
  get: {
679
681
  body: unknown;
680
682
  params: {};
681
- query: {
682
- name?: string | undefined;
683
- id?: string[] | undefined;
684
- items?: number | undefined;
685
- tags?: ("AMM" | "ALM" | "DEX" | "LENDING")[] | undefined;
686
- page?: number | undefined;
687
- };
683
+ query: unknown;
688
684
  headers: unknown;
689
685
  response: {
690
686
  200: number;
@@ -1764,6 +1760,7 @@ declare const app: Elysia<"", false, {
1764
1760
  name: string;
1765
1761
  url: string;
1766
1762
  description: string;
1763
+ id: string;
1767
1764
  tags: import("../database/api/.generated").$Enums.ProtocolTag[];
1768
1765
  icon: string;
1769
1766
  } & {})[] | null;
@@ -33,23 +33,19 @@ export async function ERC20DynamicDataRefacto(chainId, campaigns) {
33
33
  allowFailure: true,
34
34
  callData: FactoryInterface.encodeFunctionData("factory"),
35
35
  target: campaign.campaignParameters.targetToken,
36
- });
37
- callsRounds1.push({
36
+ }, {
38
37
  allowFailure: true,
39
38
  callData: MetamorphoInterface.encodeFunctionData("MORPHO"),
40
39
  target: campaign.campaignParameters.targetToken,
41
- });
42
- callsRounds1.push({
40
+ }, {
43
41
  allowFailure: true,
44
42
  callData: ERC20Interface.encodeFunctionData("name"),
45
43
  target: campaign.campaignParameters.targetToken,
46
- });
47
- callsRounds1.push({
44
+ }, {
48
45
  allowFailure: true,
49
46
  callData: BalancerPoolInterface.encodeFunctionData("getPoolId"),
50
47
  target: campaign.campaignParameters.targetToken,
51
- });
52
- callsRounds1.push({
48
+ }, {
53
49
  allowFailure: true,
54
50
  callData: EnzymeInterface.encodeFunctionData("getCreator"),
55
51
  target: campaign.campaignParameters.targetToken,
@@ -46,10 +46,11 @@ export declare enum tokenType {
46
46
  koi = "koi",
47
47
  baseswap = "baseswap",
48
48
  zkswap = "zkswap",
49
- pendle = "pendle",
50
49
  ironcladStaking = "ironcladStaking",
51
50
  rfx = "rfx",
52
- woofi = "woofi"
51
+ woofi = "woofi",
52
+ pendle = "pendle",
53
+ maverickBoostedPosition = "maverickBoostedPosition"
53
54
  }
54
55
  export declare const tokenTypeToProtocol: {
55
56
  [key in tokenType]: {
@@ -47,10 +47,11 @@ export var tokenType;
47
47
  tokenType["koi"] = "koi";
48
48
  tokenType["baseswap"] = "baseswap";
49
49
  tokenType["zkswap"] = "zkswap";
50
- tokenType["pendle"] = "pendle";
51
50
  tokenType["ironcladStaking"] = "ironcladStaking";
52
51
  tokenType["rfx"] = "rfx";
53
52
  tokenType["woofi"] = "woofi";
53
+ tokenType["pendle"] = "pendle";
54
+ tokenType["maverickBoostedPosition"] = "maverickBoostedPosition";
54
55
  })(tokenType || (tokenType = {}));
55
56
  export const tokenTypeToProtocol = {
56
57
  [tokenType.aave_borrowing]: { protocol: "Aave" },
@@ -100,7 +101,14 @@ export const tokenTypeToProtocol = {
100
101
  [tokenType.zerolend_borrowing]: { protocol: "ZeroLend" },
101
102
  [tokenType.zerolend_lending]: { protocol: "ZeroLend" },
102
103
  [tokenType.zkswap]: { protocol: "ZKSwap" },
103
- [tokenType.ironcladStaking]: { protocol: "Ironclad" },
104
104
  [tokenType.rfx]: { protocol: "RFX" },
105
- [tokenType.woofi]: { protocol: "Woofi" },
105
+ [tokenType.woofi]: {
106
+ protocol: "Woofi",
107
+ },
108
+ [tokenType.ironcladStaking]: {
109
+ protocol: "Ironclad",
110
+ },
111
+ [tokenType.maverickBoostedPosition]: {
112
+ protocol: "Maverick",
113
+ },
106
114
  };
@@ -0,0 +1,50 @@
1
+ import type { Pricer } from "../../../../../utils/pricer";
2
+ import { type Campaign, type CampaignParameters } from "@sdk";
3
+ import type { tokenType } from "../helpers/tokenType";
4
+ import { GenericProcessor, type dataType, type mandatoryCallKeys } from "./GenericProcessor";
5
+ type callType = {
6
+ key: keyof dataRawMaverickBP;
7
+ call: string;
8
+ target: keyof callKeysMaverickBP;
9
+ metaData?: keyof callKeysMaverickBP;
10
+ };
11
+ type callKeysMaverickBP = mandatoryCallKeys & {
12
+ boostedPositionInformation: string;
13
+ tokenA: string;
14
+ tokenB: string;
15
+ lensAddress: string;
16
+ };
17
+ type dataRawMaverickBP = callKeysMaverickBP & {
18
+ amountA: string;
19
+ amountB: string;
20
+ decimalsTokenA: string;
21
+ decimalsTokenB: string;
22
+ bpInfoReturnData: {
23
+ [key: string]: string | number;
24
+ };
25
+ symbolTokenA: string;
26
+ symbolTokenB: string;
27
+ };
28
+ type dataTypeMaverickBP = dataType & {
29
+ amountA: number;
30
+ amountB: number;
31
+ decimalsTokenA: number;
32
+ decimalsTokenB: number;
33
+ lensAddress: string;
34
+ symbolTokenA: string;
35
+ symbolTokenB: string;
36
+ tokenA: string;
37
+ tokenB: string;
38
+ };
39
+ export declare class MaverickBPProcessor extends GenericProcessor<callKeysMaverickBP, dataRawMaverickBP, dataTypeMaverickBP> {
40
+ rounds: {
41
+ round1: callType[];
42
+ round2: callType[];
43
+ round3: callType[];
44
+ round4: callType[];
45
+ };
46
+ processingRound1(typeInfo: dataRawMaverickBP): void;
47
+ processingRound2(typeInfo: dataRawMaverickBP): void;
48
+ processingRound5(_index: number, type: tokenType, typeInfo: dataRawMaverickBP, _calls: string[], campaign: CampaignParameters<Campaign.ERC20> | CampaignParameters<Campaign.EULER>, pricer: Pricer): Promise<dataTypeMaverickBP>;
49
+ }
50
+ export {};
@@ -0,0 +1,75 @@
1
+ import { MAVERICK_ZKSYNC_BP_LENS_ADDRESS } from "../../../../../constants";
2
+ import { generateCardName } from "../../../../../utils/generateCardName";
3
+ import { BN2Number } from "@sdk";
4
+ import { GenericProcessor } from "./GenericProcessor";
5
+ export class MaverickBPProcessor extends GenericProcessor {
6
+ rounds = {
7
+ round1: [
8
+ {
9
+ key: "bpInfoReturnData",
10
+ call: "boostedPositionInformation",
11
+ target: "lensAddress",
12
+ metaData: "tokenAddress",
13
+ },
14
+ ],
15
+ round2: [
16
+ {
17
+ key: "symbolTokenA",
18
+ call: "symbol",
19
+ target: "tokenA",
20
+ },
21
+ {
22
+ key: "symbolTokenB",
23
+ call: "symbol",
24
+ target: "tokenB",
25
+ },
26
+ {
27
+ key: "decimalsTokenA",
28
+ call: "decimals",
29
+ target: "tokenA",
30
+ },
31
+ {
32
+ key: "decimalsTokenB",
33
+ call: "decimals",
34
+ target: "tokenB",
35
+ },
36
+ ],
37
+ round3: [],
38
+ round4: [{ key: "totalSupply", call: "totalSupply", target: "tokenAddress" }],
39
+ };
40
+ processingRound1(typeInfo) {
41
+ typeInfo.lensAddress = MAVERICK_ZKSYNC_BP_LENS_ADDRESS;
42
+ }
43
+ processingRound2(typeInfo) {
44
+ typeInfo.tokenA = typeInfo.bpInfoReturnData.tokenA;
45
+ typeInfo.tokenB = typeInfo.bpInfoReturnData.tokenB;
46
+ typeInfo.amountA = typeInfo.bpInfoReturnData.amountA.toString();
47
+ typeInfo.amountB = typeInfo.bpInfoReturnData.amountB.toString();
48
+ }
49
+ async processingRound5(_index, type, typeInfo, _calls, campaign, pricer) {
50
+ const { whitelistedSupplyTargetToken, totalSupply, blacklistedSupply } = this.handleWhiteListBlacklistRound5(typeInfo, campaign);
51
+ const decimalsTokenA = Number(typeInfo.decimalsTokenA);
52
+ const decimalsTokenB = Number(typeInfo.decimalsTokenB);
53
+ const amountA = BN2Number(typeInfo.amountA, decimalsTokenA);
54
+ const amountB = BN2Number(typeInfo.amountB, decimalsTokenB);
55
+ const tokenAPRice = (await pricer.get({ symbol: typeInfo.symbolTokenA })) ?? 0;
56
+ const tokenBPrice = (await pricer.get({ symbol: typeInfo.symbolTokenB })) ?? 0;
57
+ // Not rebased (ie divided by 10edecimals)
58
+ const tvl = tokenAPRice * amountA + tokenBPrice * amountB;
59
+ const priceTargetToken = tvl / totalSupply;
60
+ const { bpInfoReturnData, ...rest } = typeInfo;
61
+ return {
62
+ ...rest,
63
+ blacklistedSupply,
64
+ amountA,
65
+ amountB,
66
+ decimalsTokenA,
67
+ decimalsTokenB,
68
+ cardName: generateCardName(type, typeInfo, campaign),
69
+ priceTargetToken: priceTargetToken,
70
+ totalSupply,
71
+ tvl,
72
+ whitelistedSupplyTargetToken,
73
+ };
74
+ }
75
+ }
@@ -13,6 +13,7 @@ import { FluidProcessor } from "./FluidProcessor";
13
13
  import { FraxProcessor } from "./FraxProcessor";
14
14
  import { GearboxProcessor } from "./GearboxProcessor";
15
15
  import { GenericProcessor } from "./GenericProcessor";
16
+ import { MaverickBPProcessor } from "./MaverickBPProcessor";
16
17
  import { MetamorphoProcessor } from "./MetamorphoProcessor";
17
18
  import { PendleProcessor } from "./PendleProcessor";
18
19
  import { RadiantProcessor } from "./RadiantProcessor";
@@ -74,4 +75,5 @@ export const processorMapping = {
74
75
  [tokenType.ironcladStaking]: GenericProcessor,
75
76
  [tokenType.rfx]: RfxProcessor,
76
77
  [tokenType.woofi]: WoofiProcessor,
78
+ [tokenType.maverickBoostedPosition]: MaverickBPProcessor,
77
79
  };
@@ -81,6 +81,8 @@ function satisfiesNameConditions(name, type) {
81
81
  return lowerCaseName === "ironclad token";
82
82
  case tokenType.woofi:
83
83
  return lowerCaseName.includes("woofi");
84
+ case tokenType.maverickBoostedPosition:
85
+ return lowerCaseName.includes("maverick");
84
86
  default:
85
87
  return false;
86
88
  }
@@ -9,6 +9,7 @@ export declare abstract class EnsoService {
9
9
  name: string;
10
10
  url: string;
11
11
  description: string;
12
+ id: string;
12
13
  tags: import("../../../../database/api/.generated").$Enums.ProtocolTag[];
13
14
  icon: string;
14
15
  } & {})[] | null>;
@@ -44,6 +44,7 @@ export declare const ParticipateController: Elysia<"/participate", false, {
44
44
  name: string;
45
45
  url: string;
46
46
  description: string;
47
+ id: string;
47
48
  tags: import("../../../../database/api/.generated").$Enums.ProtocolTag[];
48
49
  icon: string;
49
50
  } & {})[] | null;
@@ -26,6 +26,7 @@ export declare const ProtocolController: Elysia<"/protocols", false, {
26
26
  name: string;
27
27
  url: string;
28
28
  description: string;
29
+ id: string;
29
30
  tags: import("../../../../database/api/.generated").$Enums.ProtocolTag[];
30
31
  icon: string;
31
32
  } | null;
@@ -52,6 +53,7 @@ export declare const ProtocolController: Elysia<"/protocols", false, {
52
53
  name: string;
53
54
  url: string;
54
55
  description: string;
56
+ id: string;
55
57
  tags: import("../../../../database/api/.generated").$Enums.ProtocolTag[];
56
58
  icon: string;
57
59
  } & {})[] | null;
@@ -65,13 +67,7 @@ export declare const ProtocolController: Elysia<"/protocols", false, {
65
67
  get: {
66
68
  body: unknown;
67
69
  params: {};
68
- query: {
69
- name?: string | undefined;
70
- id?: string[] | undefined;
71
- items?: number | undefined;
72
- tags?: ("AMM" | "ALM" | "DEX" | "LENDING")[] | undefined;
73
- page?: number | undefined;
74
- };
70
+ query: unknown;
75
71
  headers: unknown;
76
72
  response: {
77
73
  200: number;
@@ -3,7 +3,7 @@ import { GetProtocolsQueryDto } from "./protocol.model";
3
3
  import { ProtocolService } from "./protocol.service";
4
4
  // ─── Protocols Controller ────────────────────────────────────────────────────
5
5
  export const ProtocolController = new Elysia({ prefix: "/protocols", detail: { tags: ["Protocols"] } })
6
- // ─── Get A Protocol By Its Id ────────────────────────────────────────
6
+ // ─── Get A Protocol By Its Id/Name ────────────────────────────────────────
7
7
  .get("/:id", async ({ params }) => {
8
8
  const fromId = await ProtocolService.getFromId(params.id);
9
9
  if (fromId)
@@ -11,13 +11,8 @@ export const ProtocolController = new Elysia({ prefix: "/protocols", detail: { t
11
11
  return await ProtocolService.getFromName(params.id);
12
12
  })
13
13
  // ─── Get Many Protocols ──────────────────────────────────────────────
14
- .get("/", async ({ query }) => {
15
- return await ProtocolService.findMany(query);
16
- }, {
14
+ .get("/", async ({ query }) => await ProtocolService.findMany(query), {
17
15
  query: GetProtocolsQueryDto,
18
16
  })
19
- .get("/count", async ({ query }) => {
20
- return await ProtocolService.countMany(query);
21
- }, {
22
- query: GetProtocolsQueryDto,
23
- });
17
+ // ─── Count Protocols ──────────────────────────────────────────────
18
+ .get("/count", async ({ query }) => await ProtocolService.countMany(query));
@@ -4,11 +4,11 @@ import type { Resource } from "../prisma";
4
4
  * @description Target description of rewards campaigns
5
5
  * @see {@link Resource}
6
6
  */
7
- export type Protocol = Resource<"Protocol", "id">;
7
+ export type Protocol = Resource<"Protocol">;
8
8
  declare const protocolTypes: readonly ["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", "uniswap-v2", "velodrome", "aerodrome", "balancer", "curve", "aura", "akron", "beefy", "dragonswap", "poolside", "koi", "radiant", "aave", "euler", "gearbox", "compound", "sturdy", "frax", "ionic", "moonwell", "fluid", "silo", "morpho", "coumpound", "dolomite", "badger", "ajna", "layerbank"];
9
9
  export type ProtocolId = (typeof protocolTypes)[number];
10
10
  export declare const GetProtocolsQueryDto: import("@sinclair/typebox").TObject<{
11
- id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
11
+ id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>]>, string[]>>;
12
12
  name: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
13
13
  tags: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TEnum<{
14
14
  AMM: "AMM";
@@ -59,7 +59,10 @@ const protocolTypes = [
59
59
  ];
60
60
  // ─── DTOs ────────────────────────────────────────────────────────────────────
61
61
  export const GetProtocolsQueryDto = t.Object({
62
- id: t.Optional(t.Array(t.String())),
62
+ id: t.Optional(t
63
+ .Transform(t.Union([t.String(), t.Array(t.String())]))
64
+ .Decode(value => (typeof value === "string" ? value.split(",") : value))
65
+ .Encode(value => [...value])),
63
66
  name: t.Optional(t.String()),
64
67
  tags: t.Optional(t.Array(t.Enum(ProtocolTag))),
65
68
  page: t.Optional(t.Numeric()),
@@ -63,14 +63,15 @@ export class ProtocolService {
63
63
  }[_type];
64
64
  }
65
65
  static async findMany(query) {
66
- return await ProtocolRepository.findMany(query);
66
+ return ProtocolRepository.findMany(query);
67
67
  }
68
68
  static async countMany(query) {
69
- return await ProtocolRepository.countMany(query);
69
+ return ProtocolRepository.countMany(query);
70
70
  }
71
71
  static async getFromId(id) {
72
- return await ProtocolRepository.read(id);
72
+ return ProtocolRepository.read(id);
73
73
  }
74
+ // Todo : Should be a findfirst by name here
74
75
  static async getFromName(name) {
75
76
  return (await ProtocolRepository.findManyByName(name))[0];
76
77
  }
@@ -621,6 +621,7 @@ export declare const v4: Elysia<"/v4", false, {
621
621
  name: string;
622
622
  url: string;
623
623
  description: string;
624
+ id: string;
624
625
  tags: import("../../../database/api/.generated").$Enums.ProtocolTag[];
625
626
  icon: string;
626
627
  } | null;
@@ -647,6 +648,7 @@ export declare const v4: Elysia<"/v4", false, {
647
648
  name: string;
648
649
  url: string;
649
650
  description: string;
651
+ id: string;
650
652
  tags: import("../../../database/api/.generated").$Enums.ProtocolTag[];
651
653
  icon: string;
652
654
  } & {})[] | null;
@@ -660,13 +662,7 @@ export declare const v4: Elysia<"/v4", false, {
660
662
  get: {
661
663
  body: unknown;
662
664
  params: {};
663
- query: {
664
- name?: string | undefined;
665
- id?: string[] | undefined;
666
- items?: number | undefined;
667
- tags?: ("AMM" | "ALM" | "DEX" | "LENDING")[] | undefined;
668
- page?: number | undefined;
669
- };
665
+ query: unknown;
670
666
  headers: unknown;
671
667
  response: {
672
668
  200: number;
@@ -1746,6 +1742,7 @@ export declare const v4: Elysia<"/v4", false, {
1746
1742
  name: string;
1747
1743
  url: string;
1748
1744
  description: string;
1745
+ id: string;
1749
1746
  tags: import("../../../database/api/.generated").$Enums.ProtocolTag[];
1750
1747
  icon: string;
1751
1748
  } & {})[] | null;
@@ -647,6 +647,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
647
647
  name: string;
648
648
  url: string;
649
649
  description: string;
650
+ id: string;
650
651
  tags: import("../../../database/api/.generated").$Enums.ProtocolTag[];
651
652
  icon: string;
652
653
  } | null;
@@ -673,6 +674,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
673
674
  name: string;
674
675
  url: string;
675
676
  description: string;
677
+ id: string;
676
678
  tags: import("../../../database/api/.generated").$Enums.ProtocolTag[];
677
679
  icon: string;
678
680
  } & {})[] | null;
@@ -686,13 +688,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
686
688
  get: {
687
689
  body: unknown;
688
690
  params: {};
689
- query: {
690
- name?: string | undefined;
691
- id?: string[] | undefined;
692
- items?: number | undefined;
693
- tags?: ("AMM" | "ALM" | "DEX" | "LENDING")[] | undefined;
694
- page?: number | undefined;
695
- };
691
+ query: unknown;
696
692
  headers: unknown;
697
693
  response: {
698
694
  200: number;
@@ -1772,6 +1768,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1772
1768
  name: string;
1773
1769
  url: string;
1774
1770
  description: string;
1771
+ id: string;
1775
1772
  tags: import("../../../database/api/.generated").$Enums.ProtocolTag[];
1776
1773
  icon: string;
1777
1774
  } & {})[] | null;
@@ -645,6 +645,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
645
645
  name: string;
646
646
  url: string;
647
647
  description: string;
648
+ id: string;
648
649
  tags: import("../../../database/api/.generated").$Enums.ProtocolTag[];
649
650
  icon: string;
650
651
  } | null;
@@ -671,6 +672,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
671
672
  name: string;
672
673
  url: string;
673
674
  description: string;
675
+ id: string;
674
676
  tags: import("../../../database/api/.generated").$Enums.ProtocolTag[];
675
677
  icon: string;
676
678
  } & {})[] | null;
@@ -684,13 +686,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
684
686
  get: {
685
687
  body: unknown;
686
688
  params: {};
687
- query: {
688
- name?: string | undefined;
689
- id?: string[] | undefined;
690
- items?: number | undefined;
691
- tags?: ("AMM" | "ALM" | "DEX" | "LENDING")[] | undefined;
692
- page?: number | undefined;
693
- };
689
+ query: unknown;
694
690
  headers: unknown;
695
691
  response: {
696
692
  200: number;
@@ -1770,6 +1766,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1770
1766
  name: string;
1771
1767
  url: string;
1772
1768
  description: string;
1769
+ id: string;
1773
1770
  tags: import("../../../database/api/.generated").$Enums.ProtocolTag[];
1774
1771
  icon: string;
1775
1772
  } & {})[] | null;