@merkl/api 0.10.177 → 0.10.180

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. package/dist/database/api/.generated/edge.js +6 -6
  2. package/dist/database/api/.generated/index-browser.js +4 -4
  3. package/dist/database/api/.generated/index.d.ts +2 -2
  4. package/dist/database/api/.generated/index.js +6 -6
  5. package/dist/database/api/.generated/libquery_engine-debian-openssl-1.1.x.so.node +0 -0
  6. package/dist/database/api/.generated/libquery_engine-linux-arm64-openssl-1.1.x.so.node +0 -0
  7. package/dist/database/api/.generated/libquery_engine-linux-musl-arm64-openssl-3.0.x.so.node +0 -0
  8. package/dist/database/api/.generated/package.json +1 -1
  9. package/dist/database/api/.generated/runtime/edge-esm.js +15 -15
  10. package/dist/database/api/.generated/runtime/edge.js +16 -16
  11. package/dist/database/api/.generated/runtime/library.d.ts +23 -34
  12. package/dist/database/api/.generated/runtime/library.js +56 -56
  13. package/dist/database/api/.generated/runtime/react-native.js +23 -23
  14. package/dist/database/api/.generated/runtime/wasm.js +15 -15
  15. package/dist/database/api/.generated/wasm.js +4 -4
  16. package/dist/database/engine/.generated/edge.js +6 -6
  17. package/dist/database/engine/.generated/index-browser.js +4 -4
  18. package/dist/database/engine/.generated/index.d.ts +2 -2
  19. package/dist/database/engine/.generated/index.js +6 -6
  20. package/dist/database/engine/.generated/libquery_engine-debian-openssl-1.1.x.so.node +0 -0
  21. package/dist/database/engine/.generated/libquery_engine-linux-arm64-openssl-1.1.x.so.node +0 -0
  22. package/dist/database/engine/.generated/libquery_engine-linux-musl-arm64-openssl-3.0.x.so.node +0 -0
  23. package/dist/database/engine/.generated/package.json +1 -1
  24. package/dist/database/engine/.generated/runtime/edge-esm.js +15 -15
  25. package/dist/database/engine/.generated/runtime/edge.js +16 -16
  26. package/dist/database/engine/.generated/runtime/library.d.ts +23 -34
  27. package/dist/database/engine/.generated/runtime/library.js +56 -56
  28. package/dist/database/engine/.generated/runtime/react-native.js +23 -23
  29. package/dist/database/engine/.generated/runtime/wasm.js +15 -15
  30. package/dist/database/engine/.generated/wasm.js +4 -4
  31. package/dist/src/eden/index.d.ts +336 -51
  32. package/dist/src/index.d.ts +136 -17
  33. package/dist/src/index.js +1 -1
  34. package/dist/src/libs/campaigns/campaignTypes/CLAMMDynamicData.js +2 -2
  35. package/dist/src/modules/v4/bucket/bucket.service.d.ts +5 -0
  36. package/dist/src/modules/v4/bucket/bucket.service.js +11 -0
  37. package/dist/src/modules/v4/campaign/campaign.controller.d.ts +11 -13
  38. package/dist/src/modules/v4/campaign/campaign.controller.js +3 -3
  39. package/dist/src/modules/v4/campaign/campaign.repository.js +1 -1
  40. package/dist/src/modules/v4/chain/chain.controller.d.ts +24 -0
  41. package/dist/src/modules/v4/chain/chain.controller.js +8 -2
  42. package/dist/src/modules/v4/chain/chain.model.d.ts +4 -0
  43. package/dist/src/modules/v4/chain/chain.model.js +4 -0
  44. package/dist/src/modules/v4/chain/chain.repository.d.ts +6 -1
  45. package/dist/src/modules/v4/chain/chain.repository.js +3 -0
  46. package/dist/src/modules/v4/chain/chain.service.d.ts +6 -1
  47. package/dist/src/modules/v4/chain/chain.service.js +7 -0
  48. package/dist/src/modules/v4/enso/enso.service.d.ts +1 -1
  49. package/dist/src/modules/v4/interaction/interaction.controller.d.ts +1 -1
  50. package/dist/src/modules/v4/{position → liquidity}/implementations/AjnaPositionFetcher.d.ts +1 -1
  51. package/dist/src/modules/v4/{position → liquidity}/implementations/BadgerPositionFetcher.d.ts +1 -1
  52. package/dist/src/modules/v4/{position → liquidity}/implementations/ClammPositionFetcher.d.ts +1 -1
  53. package/dist/src/modules/v4/{position → liquidity}/implementations/DolomitePositionFetcher.d.ts +1 -1
  54. package/dist/src/modules/v4/{position → liquidity}/implementations/DolomitePositionFetcher.js +2 -2
  55. package/dist/src/modules/v4/{position → liquidity}/implementations/ERC20PositionFetcher.d.ts +1 -1
  56. package/dist/src/modules/v4/{position → liquidity}/implementations/EulerPositionFetcher.d.ts +1 -1
  57. package/dist/src/modules/v4/liquidity/index.d.ts +2 -0
  58. package/dist/src/modules/v4/liquidity/index.js +2 -0
  59. package/dist/src/modules/v4/{position/position.controller.d.ts → liquidity/liquidity.controller.d.ts} +3 -3
  60. package/dist/src/modules/v4/{position/position.controller.js → liquidity/liquidity.controller.js} +4 -4
  61. package/dist/src/modules/v4/{position/position.repository.d.ts → liquidity/liquidity.repository.d.ts} +1 -1
  62. package/dist/src/modules/v4/{position/position.repository.js → liquidity/liquidity.repository.js} +1 -1
  63. package/dist/src/modules/v4/liquidity/liquidity.service.d.ts +5 -0
  64. package/dist/src/modules/v4/{position/position.service.js → liquidity/liquidity.service.js} +2 -2
  65. package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +34 -0
  66. package/dist/src/modules/v4/opportunity/opportunity.controller.js +11 -2
  67. package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +8 -0
  68. package/dist/src/modules/v4/opportunity/opportunity.model.js +5 -0
  69. package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +29 -1
  70. package/dist/src/modules/v4/opportunity/opportunity.repository.js +6 -0
  71. package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +15 -1
  72. package/dist/src/modules/v4/opportunity/opportunity.service.js +7 -6
  73. package/dist/src/modules/v4/protocol/protocol.controller.d.ts +30 -1
  74. package/dist/src/modules/v4/protocol/protocol.controller.js +9 -2
  75. package/dist/src/modules/v4/protocol/protocol.model.d.ts +10 -1
  76. package/dist/src/modules/v4/protocol/protocol.model.js +9 -0
  77. package/dist/src/modules/v4/protocol/protocol.repository.d.ts +9 -1
  78. package/dist/src/modules/v4/protocol/protocol.repository.js +4 -1
  79. package/dist/src/modules/v4/protocol/protocol.service.d.ts +11 -3
  80. package/dist/src/modules/v4/protocol/protocol.service.js +38 -32
  81. package/dist/src/modules/v4/reward/subservices/converter.js +2 -2
  82. package/dist/src/modules/v4/router.d.ts +136 -17
  83. package/dist/src/modules/v4/router.js +2 -2
  84. package/dist/src/modules/v4/token/token.controller.d.ts +34 -0
  85. package/dist/src/modules/v4/token/token.controller.js +11 -3
  86. package/dist/src/modules/v4/token/token.model.d.ts +9 -0
  87. package/dist/src/modules/v4/token/token.model.js +7 -0
  88. package/dist/src/modules/v4/token/token.repository.d.ts +14 -1
  89. package/dist/src/modules/v4/token/token.repository.js +3 -0
  90. package/dist/src/modules/v4/token/token.service.d.ts +14 -1
  91. package/dist/src/modules/v4/token/token.service.js +7 -0
  92. package/dist/src/routes/v3/blacklist.d.ts +136 -17
  93. package/dist/src/routes/v3/campaigns.d.ts +136 -17
  94. package/dist/src/routes/v3/campaignsInfo.d.ts +136 -17
  95. package/dist/src/routes/v3/multiChainPositions.d.ts +136 -17
  96. package/dist/src/routes/v3/opportunity.d.ts +136 -17
  97. package/dist/src/routes/v3/positions.d.ts +136 -17
  98. package/dist/src/routes/v3/rewards.d.ts +136 -17
  99. package/dist/src/routes/v3/updates.d.ts +136 -17
  100. package/dist/src/routes/v3/userRewards.d.ts +136 -17
  101. package/dist/src/utils/logger.d.ts +12 -6
  102. package/dist/tsconfig.package.tsbuildinfo +1 -1
  103. package/package.json +24 -24
  104. package/dist/src/modules/v4/position/index.d.ts +0 -2
  105. package/dist/src/modules/v4/position/index.js +0 -2
  106. package/dist/src/modules/v4/position/position.service.d.ts +0 -5
  107. /package/dist/src/modules/v4/{position → liquidity}/implementations/AjnaPositionFetcher.js +0 -0
  108. /package/dist/src/modules/v4/{position → liquidity}/implementations/BadgerPositionFetcher.js +0 -0
  109. /package/dist/src/modules/v4/{position → liquidity}/implementations/ClammPositionFetcher.js +0 -0
  110. /package/dist/src/modules/v4/{position → liquidity}/implementations/ERC20PositionFetcher.js +0 -0
  111. /package/dist/src/modules/v4/{position → liquidity}/implementations/EulerPositionFetcher.js +0 -0
  112. /package/dist/src/modules/v4/{position/position.model.d.ts → liquidity/liquidity.model.d.ts} +0 -0
  113. /package/dist/src/modules/v4/{position/position.model.js → liquidity/liquidity.model.js} +0 -0
@@ -495,6 +495,40 @@ declare const app: Elysia<"", false, {
495
495
  };
496
496
  };
497
497
  };
498
+ } & {
499
+ opportunities: {
500
+ ":id": {
501
+ patch: {
502
+ body: {
503
+ name?: string | undefined;
504
+ tags?: string[] | undefined;
505
+ };
506
+ params: {
507
+ id: string;
508
+ };
509
+ query: unknown;
510
+ headers: {
511
+ authorization: string;
512
+ };
513
+ response: {
514
+ 200: {
515
+ name: string;
516
+ type: import("../database/api/.generated").$Enums.CampaignType;
517
+ id: string;
518
+ status: import("../database/api/.generated").$Enums.Status;
519
+ tags: string[];
520
+ identifier: string;
521
+ chainId: number;
522
+ action: import("../database/api/.generated").$Enums.OpportunityAction;
523
+ mainProtocolId: string | null;
524
+ tvl: number;
525
+ apr: number;
526
+ dailyRewards: number;
527
+ };
528
+ };
529
+ };
530
+ };
531
+ };
498
532
  };
499
533
  } & {
500
534
  v4: {
@@ -678,19 +712,17 @@ declare const app: Elysia<"", false, {
678
712
  } & {
679
713
  "campaigns-to-process": {
680
714
  engine: {
681
- "": {
682
- post: {
683
- body: unknown;
684
- params: {};
685
- query: {
686
- chainId: number;
687
- };
688
- headers: {
689
- authorization: string;
690
- };
691
- response: {
692
- 200: string;
693
- };
715
+ post: {
716
+ body: unknown;
717
+ params: {};
718
+ query: {
719
+ chainId: number;
720
+ };
721
+ headers: {
722
+ authorization: string;
723
+ };
724
+ response: {
725
+ 200: string;
694
726
  };
695
727
  };
696
728
  };
@@ -743,7 +775,7 @@ declare const app: Elysia<"", false, {
743
775
  id: string;
744
776
  tags: import("../database/api/.generated").$Enums.ProtocolTag[];
745
777
  icon: string;
746
- } & {})[] | null;
778
+ } & {})[];
747
779
  };
748
780
  };
749
781
  };
@@ -762,6 +794,35 @@ declare const app: Elysia<"", false, {
762
794
  };
763
795
  };
764
796
  };
797
+ } & {
798
+ protocols: {
799
+ ":id": {
800
+ patch: {
801
+ body: {
802
+ url?: string | undefined;
803
+ description?: string | undefined;
804
+ icon?: string | undefined;
805
+ };
806
+ params: {
807
+ id: string;
808
+ };
809
+ query: unknown;
810
+ headers: {
811
+ authorization: string;
812
+ };
813
+ response: {
814
+ 200: {
815
+ name: string;
816
+ url: string;
817
+ description: string;
818
+ id: string;
819
+ tags: import("../database/api/.generated").$Enums.ProtocolTag[];
820
+ icon: string;
821
+ };
822
+ };
823
+ };
824
+ };
825
+ };
765
826
  };
766
827
  } & {
767
828
  v4: {
@@ -878,6 +939,40 @@ declare const app: Elysia<"", false, {
878
939
  };
879
940
  };
880
941
  };
942
+ } & {
943
+ tokens: {
944
+ ":id": {
945
+ patch: {
946
+ body: {
947
+ icon?: string | undefined;
948
+ displaySymbol?: string | undefined;
949
+ isTest?: boolean | undefined;
950
+ };
951
+ params: {
952
+ id: string;
953
+ };
954
+ query: unknown;
955
+ headers: {
956
+ authorization: string;
957
+ };
958
+ response: {
959
+ 200: {
960
+ symbol: string;
961
+ name: string | null;
962
+ id: string;
963
+ chainId: number;
964
+ address: string;
965
+ icon: string;
966
+ decimals: number;
967
+ displaySymbol: string;
968
+ verified: boolean;
969
+ isTest: boolean;
970
+ price: number | null;
971
+ };
972
+ };
973
+ };
974
+ };
975
+ };
881
976
  };
882
977
  } & {
883
978
  v4: {
@@ -1157,6 +1252,30 @@ declare const app: Elysia<"", false, {
1157
1252
  };
1158
1253
  };
1159
1254
  };
1255
+ } & {
1256
+ chains: {
1257
+ ":chainId": {
1258
+ patch: {
1259
+ body: {
1260
+ icon?: string | undefined;
1261
+ };
1262
+ params: {
1263
+ chainId: number;
1264
+ };
1265
+ query: unknown;
1266
+ headers: {
1267
+ authorization: string;
1268
+ };
1269
+ response: {
1270
+ 200: {
1271
+ name: string;
1272
+ id: number;
1273
+ icon: string;
1274
+ };
1275
+ };
1276
+ };
1277
+ };
1278
+ };
1160
1279
  };
1161
1280
  } & {
1162
1281
  v4: {
@@ -1857,7 +1976,7 @@ declare const app: Elysia<"", false, {
1857
1976
  id: string;
1858
1977
  tags: import("../database/api/.generated").$Enums.ProtocolTag[];
1859
1978
  icon: string;
1860
- } & {})[] | null;
1979
+ } & {})[];
1861
1980
  };
1862
1981
  };
1863
1982
  };
@@ -2248,7 +2367,7 @@ declare const app: Elysia<"", false, {
2248
2367
  };
2249
2368
  } & {
2250
2369
  v4: {
2251
- positions: {
2370
+ liquidity: {
2252
2371
  index: {
2253
2372
  get: {
2254
2373
  body: unknown;
@@ -2259,7 +2378,7 @@ declare const app: Elysia<"", false, {
2259
2378
  };
2260
2379
  headers: unknown;
2261
2380
  response: {
2262
- 200: any[];
2381
+ 200: import("./modules/v4/liquidity").PositionT[];
2263
2382
  };
2264
2383
  };
2265
2384
  };
package/dist/src/index.js CHANGED
@@ -24,7 +24,7 @@ const app = new Elysia({
24
24
  email: "contact@merkl.money",
25
25
  name: "Angle Labs",
26
26
  },
27
- description: "API to access data related to merkl campaigns, built and maintained by Angle Labs. This API is provided as is, without any warranty of any kind.",
27
+ description: "API to access data related to Merkl campaigns, built and maintained by Angle Labs. This API is provided as is, without any warranty of any kind.",
28
28
  license: {
29
29
  name: "UNLICENSED",
30
30
  },
@@ -341,7 +341,7 @@ export async function CLAMMDynamicData(chainId, campaigns) {
341
341
  const balance0 = BN2Number(amount0, decimalsToken0);
342
342
  const balance1 = BN2Number(amount1, decimalsToken1);
343
343
  const totalLiquidity = BN2Number(position.liquidity);
344
- const inRangeLiquidity = balance0 > 0 && balance1 > 0 ? BN2Number(position.liquidity) ?? 0 : 0;
344
+ const inRangeLiquidity = balance0 > 0 && balance1 > 0 ? (BN2Number(position.liquidity) ?? 0) : 0;
345
345
  almTotalLiquidity += totalLiquidity;
346
346
  almInRangeLiquidity += inRangeLiquidity;
347
347
  almBalance0 += balance0;
@@ -504,7 +504,7 @@ export async function CLAMMDynamicData(chainId, campaigns) {
504
504
  const balance0 = BN2Number(amount0, decimalsToken0);
505
505
  const balance1 = BN2Number(amount1, decimalsToken1);
506
506
  const totalLiquidity = BN2Number(position.liquidity);
507
- const inRangeLiquidity = balance0 > 0 && balance1 > 0 ? BN2Number(position.liquidity) ?? 0 : 0;
507
+ const inRangeLiquidity = balance0 > 0 && balance1 > 0 ? (BN2Number(position.liquidity) ?? 0) : 0;
508
508
  almTotalLiquidity += totalLiquidity;
509
509
  almInRangeLiquidity += inRangeLiquidity;
510
510
  almBalance0 += balance0;
@@ -0,0 +1,5 @@
1
+ import type { SaveData } from "node_modules/@google-cloud/storage/build/esm/src/file";
2
+ export declare abstract class BucketService {
3
+ private static storage;
4
+ static upload(bucketName: string, filename: string, data: SaveData, isPublic: boolean): Promise<string>;
5
+ }
@@ -0,0 +1,11 @@
1
+ import { Storage } from "@google-cloud/storage";
2
+ export class BucketService {
3
+ static storage = new Storage({ projectId: "angle-production-1" });
4
+ static async upload(bucketName, filename, data, isPublic) {
5
+ const file = await BucketService.storage.bucket(bucketName).file(filename);
6
+ await file.save(data);
7
+ if (isPublic)
8
+ await file.makePublic();
9
+ return `https://storage.googleapis.com/${bucketName}/${filename}`;
10
+ }
11
+ }
@@ -192,19 +192,17 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
192
192
  } & {
193
193
  "campaigns-to-process": {
194
194
  engine: {
195
- "": {
196
- post: {
197
- body: unknown;
198
- params: {};
199
- query: {
200
- chainId: number;
201
- };
202
- headers: {
203
- authorization: string;
204
- };
205
- response: {
206
- 200: string;
207
- };
195
+ post: {
196
+ body: unknown;
197
+ params: {};
198
+ query: {
199
+ chainId: number;
200
+ };
201
+ headers: {
202
+ authorization: string;
203
+ };
204
+ response: {
205
+ 200: string;
208
206
  };
209
207
  };
210
208
  };
@@ -26,15 +26,15 @@ export const CampaignController = new Elysia({ prefix: "/campaigns", detail: { t
26
26
  throwOnUnsupportedChainId(query.chainId);
27
27
  },
28
28
  })
29
- // ─── Get Count of CampaignsToProcess ─────────────────────────────────
29
+ // ─── Get Count Of CampaignsToProcess ─────────
30
30
  .get("/count", async ({ query }) => (await CampaignService.findCampaignsToProcess(query.chainId)).length, {
31
31
  query: ChainUniqueDto,
32
32
  beforeHandle: ({ query }) => {
33
33
  throwOnUnsupportedChainId(query.chainId);
34
34
  },
35
35
  })
36
- // ─── Returns a CampaignId to Process and flags it as PROCESSING ──────-
37
- .post("/engine/", async ({ query }) => await CampaignService.pickCampaignToProcess(query.chainId), {
36
+ // ─── Marks A Campaignid As Processing ────────
37
+ .post("/engine", async ({ query }) => await CampaignService.pickCampaignToProcess(query.chainId), {
38
38
  query: ChainUniqueDto,
39
39
  beforeHandle: async ({ query, headers }) => {
40
40
  await EngineGuard({ headers });
@@ -80,7 +80,7 @@ export class CampaignRepository {
80
80
  where: { id: opportunityId },
81
81
  create: {
82
82
  id: opportunityId,
83
- Chain: { connect: { id: campaign.chainId } },
83
+ Chain: { connect: { id: campaign.computeChainId } },
84
84
  type: campaignType,
85
85
  identifier: campaign.opportunityIdentifier, // mainParameter
86
86
  name: metadata.name,
@@ -98,6 +98,30 @@ export declare const ChainController: Elysia<"/chains", false, {
98
98
  };
99
99
  };
100
100
  };
101
+ } & {
102
+ chains: {
103
+ ":chainId": {
104
+ patch: {
105
+ body: {
106
+ icon?: string | undefined;
107
+ };
108
+ params: {
109
+ chainId: number;
110
+ };
111
+ query: unknown;
112
+ headers: {
113
+ authorization: string;
114
+ };
115
+ response: {
116
+ 200: {
117
+ name: string;
118
+ id: number;
119
+ icon: string;
120
+ };
121
+ };
122
+ };
123
+ };
124
+ };
101
125
  }, {
102
126
  derive: {};
103
127
  resolve: {};
@@ -1,8 +1,8 @@
1
- import { AuthorizationHeadersDto } from "../../../guards/BackOffice.guard";
1
+ import { AuthorizationHeadersDto, BackOfficeGuard } from "../../../guards/BackOffice.guard";
2
2
  import { TokenAuthGuard } from "../../../guards/TokenAuth.guard";
3
3
  import Elysia from "elysia";
4
4
  import { ExplorerService } from "../explorer";
5
- import { ChainUniqueDto, CreateChainExplorerDto, GetChainQueryDto } from "./chain.model";
5
+ import { ChainUniqueDto, CreateChainExplorerDto, GetChainQueryDto, UpdateChainDto } from "./chain.model";
6
6
  import { ChainService } from "./chain.service";
7
7
  // ─── Chains Controller ───────────────────────────────────────────────────────
8
8
  export const ChainController = new Elysia({ prefix: "/chains", detail: { tags: ["Chains"] } })
@@ -35,4 +35,10 @@ export const ChainController = new Elysia({ prefix: "/chains", detail: { tags: [
35
35
  body: CreateChainExplorerDto,
36
36
  detail: { hide: true },
37
37
  });
38
+ })
39
+ .patch("/:chainId", async ({ params, body }) => await ChainService.update(params.chainId, body), {
40
+ params: ChainUniqueDto,
41
+ body: UpdateChainDto,
42
+ headers: AuthorizationHeadersDto,
43
+ beforeHandle: BackOfficeGuard,
38
44
  });
@@ -22,6 +22,10 @@ export declare const CreateChainExplorerDto: import("@sinclair/typebox").TObject
22
22
  chainId: import("@sinclair/typebox").TNumber;
23
23
  url: import("@sinclair/typebox").TString;
24
24
  }>;
25
+ export declare const UpdateChainDto: import("@sinclair/typebox").TObject<{
26
+ icon: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
27
+ }>;
25
28
  export type ChainUniqueModel = typeof ChainUniqueDto.static;
26
29
  export type ChainSearchDto = typeof GetChainQueryDto.static;
27
30
  export type ChainsArrayModel = typeof ChainArrayDto.static;
31
+ export type UpdateChainModel = typeof UpdateChainDto.static;
@@ -18,3 +18,7 @@ export const CreateChainExplorerDto = t.Object({
18
18
  chainId: t.Number(),
19
19
  url: t.String(),
20
20
  });
21
+ export const UpdateChainDto = t.Object({
22
+ icon: t.Optional(t.String({ format: "uri" })),
23
+ // iconFile: t.Optional(t.File()),
24
+ });
@@ -1,5 +1,5 @@
1
1
  import type { Campaign, CampaignParameters } from "@sdk";
2
- import type { Chain, ChainSearchDto } from "./chain.model";
2
+ import type { Chain, ChainSearchDto, UpdateChainModel } from "./chain.model";
3
3
  export declare abstract class ChainRepository {
4
4
  #private;
5
5
  /**
@@ -63,4 +63,9 @@ export declare abstract class ChainRepository {
63
63
  * @returns
64
64
  */
65
65
  static fetchDynamicDataV3<CampaignType extends Campaign>(chainId: number, campaignType: CampaignType, campaigns: CampaignParameters<CampaignType>[]): Promise<any>;
66
+ static update(id: number, data: UpdateChainModel): Promise<{
67
+ name: string;
68
+ id: number;
69
+ icon: string;
70
+ }>;
66
71
  }
@@ -61,4 +61,7 @@ export class ChainRepository {
61
61
  const calls = campaignsDynamicData(chainId, campaigns, campaignType);
62
62
  return executeSimple(chainId, calls);
63
63
  }
64
+ static async update(id, data) {
65
+ return await apiDbClient.chain.update({ where: { id }, data });
66
+ }
64
67
  }
@@ -1,4 +1,4 @@
1
- import type { ChainSearchDto } from "./chain.model";
1
+ import type { ChainSearchDto, UpdateChainModel } from "./chain.model";
2
2
  export declare abstract class ChainService {
3
3
  static get(chainId: number): Promise<({
4
4
  Explorer: {
@@ -39,4 +39,9 @@ export declare abstract class ChainService {
39
39
  * @returns an array of chainId
40
40
  */
41
41
  static getSupportedIds(): Promise<number[]>;
42
+ static update(id: number, data: UpdateChainModel): Promise<{
43
+ name: string;
44
+ id: number;
45
+ icon: string;
46
+ }>;
42
47
  }
@@ -39,4 +39,11 @@ export class ChainService {
39
39
  }
40
40
  return supportedIds;
41
41
  }
42
+ static async update(id, data) {
43
+ // let iconUri = data.icon;
44
+ // if (data.iconFile) {
45
+ // iconUri = await BucketService.upload("merkl-assets", `/chains/${id}`, data.iconFile.stream(), true);
46
+ // }
47
+ return await ChainRepository.update(id, data);
48
+ }
42
49
  }
@@ -12,7 +12,7 @@ export declare abstract class EnsoService {
12
12
  id: string;
13
13
  tags: import("../../../../database/api/.generated").$Enums.ProtocolTag[];
14
14
  icon: string;
15
- } & {})[] | null>;
15
+ } & {})[]>;
16
16
  static getTokens(chainId: number, slug: EnsoSlug, identifier?: string): Promise<{
17
17
  type: "base" | "defi";
18
18
  chainId: number;
@@ -47,7 +47,7 @@ export declare const InteractionController: Elysia<"/interaction", false, {
47
47
  id: string;
48
48
  tags: import("../../../../database/api/.generated").$Enums.ProtocolTag[];
49
49
  icon: string;
50
- } & {})[] | null;
50
+ } & {})[];
51
51
  };
52
52
  };
53
53
  };
@@ -1,6 +1,6 @@
1
1
  import { type MerklChainId } from "@sdk";
2
2
  import type { Opportunity } from "../../opportunity";
3
- import type { PositionFetcher } from "../position.model";
3
+ import type { PositionFetcher } from "../liquidity.model";
4
4
  export declare class AjnaPositionFetcher implements PositionFetcher {
5
5
  fetchPositions: (chainId: MerklChainId, user: string, opportunities: Opportunity["model"][]) => Promise<import("..").PositionT[]>;
6
6
  }
@@ -1,6 +1,6 @@
1
1
  import { type MerklChainId } from "@sdk";
2
2
  import type { Opportunity } from "../../opportunity";
3
- import type { PositionFetcher, PositionT } from "../position.model";
3
+ import type { PositionFetcher, PositionT } from "../liquidity.model";
4
4
  export declare class BadgerPositionFetcher implements PositionFetcher {
5
5
  fetchPositions: (chainId: MerklChainId, user: string, opportunities: Opportunity["model"][]) => Promise<PositionT[]>;
6
6
  }
@@ -1,6 +1,6 @@
1
1
  import { type MerklChainId } from "@sdk";
2
2
  import type { Opportunity } from "../../opportunity";
3
- import type { PositionFetcher, PositionT } from "../position.model";
3
+ import type { PositionFetcher, PositionT } from "../liquidity.model";
4
4
  export declare class ClammPositionFetcher implements PositionFetcher {
5
5
  fetchPositions: (chainId: MerklChainId, user: string, opportunities: Opportunity["model"][]) => Promise<PositionT[]>;
6
6
  }
@@ -1,6 +1,6 @@
1
1
  import { type MerklChainId } from "@sdk";
2
2
  import type { Opportunity } from "../../opportunity";
3
- import type { PositionFetcher } from "../position.model";
3
+ import type { PositionFetcher } from "../liquidity.model";
4
4
  export declare class DolomitePositionFetcher implements PositionFetcher {
5
5
  fetchPositions: (chainId: MerklChainId, user: string, opportunities: Opportunity["model"][]) => Promise<import("..").PositionT[]>;
6
6
  }
@@ -1,12 +1,12 @@
1
1
  import { Campaign } from "@sdk";
2
2
  import { utils } from "ethers";
3
3
  import { CampaignService } from "../../campaign";
4
- import { PositionRepository } from "../position.repository";
4
+ import { LiquidityRepository } from "../liquidity.repository";
5
5
  const campaignType = Campaign.DOLOMITE;
6
6
  export class DolomitePositionFetcher {
7
7
  fetchPositions = async (chainId, user, opportunities) => {
8
8
  opportunities = opportunities.filter(o => o.type === Campaign[campaignType] && o.tokens?.length > 0 && o.chainId === chainId);
9
- const dolomitePositions = await PositionRepository.findManyDolomitePositions(chainId, user);
9
+ const dolomitePositions = await LiquidityRepository.findManyDolomitePositions(chainId, user);
10
10
  // Generic calls
11
11
  for (const opportunity of opportunities) {
12
12
  // Call per opportunity
@@ -1,6 +1,6 @@
1
1
  import { type MerklChainId } from "@sdk";
2
2
  import type { Opportunity } from "../../opportunity";
3
- import type { PositionFetcher, PositionT } from "../position.model";
3
+ import type { PositionFetcher, PositionT } from "../liquidity.model";
4
4
  export declare class ERC20PositionFetcher implements PositionFetcher {
5
5
  fetchPositions: (chainId: MerklChainId, user: string, opportunities: Opportunity["model"][]) => Promise<PositionT[]>;
6
6
  }
@@ -1,6 +1,6 @@
1
1
  import { type MerklChainId } from "@sdk";
2
2
  import type { Opportunity } from "../../opportunity";
3
- import type { PositionFetcher, PositionT } from "../position.model";
3
+ import type { PositionFetcher, PositionT } from "../liquidity.model";
4
4
  export declare class EulerPositionFetcher implements PositionFetcher {
5
5
  fetchPositions: (chainId: MerklChainId, user: string, opportunities: Opportunity["model"][]) => Promise<PositionT[]>;
6
6
  }
@@ -0,0 +1,2 @@
1
+ export * from "./liquidity.model";
2
+ export * from "./liquidity.service";
@@ -0,0 +1,2 @@
1
+ export * from "./liquidity.model";
2
+ export * from "./liquidity.service";
@@ -1,5 +1,5 @@
1
1
  import { Elysia } from "elysia";
2
- export declare const PositionController: Elysia<"/positions", false, {
2
+ export declare const LiquidityController: Elysia<"/liquidity", false, {
3
3
  decorator: {};
4
4
  store: {};
5
5
  derive: {};
@@ -12,7 +12,7 @@ export declare const PositionController: Elysia<"/positions", false, {
12
12
  macro: {};
13
13
  macroFn: {};
14
14
  }, {
15
- positions: {
15
+ liquidity: {
16
16
  index: {
17
17
  get: {
18
18
  body: unknown;
@@ -23,7 +23,7 @@ export declare const PositionController: Elysia<"/positions", false, {
23
23
  };
24
24
  headers: unknown;
25
25
  response: {
26
- 200: any[];
26
+ 200: import("./liquidity.model").PositionT[];
27
27
  };
28
28
  };
29
29
  };
@@ -1,12 +1,12 @@
1
1
  import { throwOnInvalidRequiredAddress, throwOnUnsupportedChainId } from "../../../utils/throw";
2
2
  import { Elysia } from "elysia";
3
- import { PositionsInputDto } from "./position.model";
4
- import { PositionService } from "./position.service";
3
+ import { PositionsInputDto } from "./liquidity.model";
4
+ import { LiquidityService } from "./liquidity.service";
5
5
  // ─── Positions Controller ──────────────────────────────────────────────
6
- export const PositionController = new Elysia({ prefix: "/positions", detail: { tags: ["Positions"] } })
6
+ export const LiquidityController = new Elysia({ prefix: "/liquidity", detail: { tags: ["Positions"] } })
7
7
  // ─── Get User Positions on a Chain ───────────────────────────────────
8
8
  .get("/", async ({ query }) => {
9
- return await PositionService.fetchPositions(query);
9
+ return await LiquidityService.fetchPositions(query);
10
10
  }, {
11
11
  query: PositionsInputDto,
12
12
  beforeHandle: ({ query }) => {
@@ -1,5 +1,5 @@
1
1
  import type { MerklChainId } from "@sdk";
2
- export declare class PositionRepository {
2
+ export declare class LiquidityRepository {
3
3
  static findManyDolomitePositions(chainId: MerklChainId, user: string): Promise<{
4
4
  balance: string;
5
5
  token: {
@@ -1,5 +1,5 @@
1
1
  import axios from "axios";
2
- export class PositionRepository {
2
+ export class LiquidityRepository {
3
3
  static async findManyDolomitePositions(chainId, user) {
4
4
  return (await axios.get(`https://api.dolomite.io/balances/${chainId}/users/${user}`)).data.Result;
5
5
  }
@@ -0,0 +1,5 @@
1
+ import type { PositionT, PositionsInputModel } from "./liquidity.model";
2
+ export declare class LiquidityService {
3
+ #private;
4
+ static fetchPositions(query: PositionsInputModel): Promise<PositionT[]>;
5
+ }
@@ -7,7 +7,7 @@ import { ClammPositionFetcher } from "./implementations/ClammPositionFetcher";
7
7
  import { DolomitePositionFetcher } from "./implementations/DolomitePositionFetcher";
8
8
  import { ERC20PositionFetcher } from "./implementations/ERC20PositionFetcher";
9
9
  import { EulerPositionFetcher } from "./implementations/EulerPositionFetcher";
10
- export class PositionService {
10
+ export class LiquidityService {
11
11
  static #fetchers = {
12
12
  [Campaign.ERC20]: new ERC20PositionFetcher(),
13
13
  [Campaign.EULER]: new EulerPositionFetcher(),
@@ -20,7 +20,7 @@ export class PositionService {
20
20
  const opportunities = await OpportunityService.findLiveWithFirstCampaign(query.chainId);
21
21
  const promises = [];
22
22
  for (const campaignType of Object.keys(Campaign)) {
23
- const fetcher = PositionService.#fetchers[Number.parseInt(campaignType)];
23
+ const fetcher = LiquidityService.#fetchers[Number.parseInt(campaignType)];
24
24
  if (fetcher) {
25
25
  promises.push(withTimeout(fetcher.fetchPositions(query.chainId, query.address, opportunities.filter(o => !!o)), MERKL_USER_POSITION_FETCHING_GLOBAL_TIMEOUT));
26
26
  }