@merkl/api 0.21.32 → 0.21.34

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 (51) hide show
  1. package/dist/database/api/.generated/drizzle/schema.d.ts +7 -7
  2. package/dist/database/api/.generated/drizzle/schema.js +1 -1
  3. package/dist/database/api/.generated/drizzle/schema.ts +1 -1
  4. package/dist/database/api/.generated/edge.js +5 -4
  5. package/dist/database/api/.generated/index-browser.js +2 -1
  6. package/dist/database/api/.generated/index.d.ts +2 -1
  7. package/dist/database/api/.generated/index.js +5 -4
  8. package/dist/database/api/.generated/package.json +1 -1
  9. package/dist/database/api/.generated/schema.prisma +1 -0
  10. package/dist/database/api/.generated/wasm.js +2 -1
  11. package/dist/src/eden/index.d.ts +185 -3
  12. package/dist/src/engine/deprecated/erc20SubTypeProcessors/helpers/factoryFinder.js +1 -1
  13. package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/curveProcessor.js +6 -2
  14. package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/processorMapping.js +1 -0
  15. package/dist/src/engine/deprecated/erc20SubTypeProcessors/tokenTypeToProtocolAndAction.js +4 -0
  16. package/dist/src/engine/implementations/Erc20/subTypes/implementations/euler/tvl.js +5 -1
  17. package/dist/src/engine/implementations/Erc20/subTypes/index.d.ts +2 -1
  18. package/dist/src/engine/implementations/Erc20/subTypes/index.js +1 -0
  19. package/dist/src/guards/BackOffice.guard.d.ts +1 -1
  20. package/dist/src/guards/BackOffice.guard.js +1 -1
  21. package/dist/src/guards/Engine.guard.d.ts +1 -1
  22. package/dist/src/guards/Engine.guard.js +2 -3
  23. package/dist/src/guards/VerifyJwt.guard.d.ts +10 -0
  24. package/dist/src/guards/VerifyJwt.guard.js +13 -0
  25. package/dist/src/index.d.ts +73 -1
  26. package/dist/src/index.js +2 -0
  27. package/dist/src/modules/v4/accounting/accounting.controller.js +7 -13
  28. package/dist/src/modules/v4/authentication/authentication.controller.d.ts +52 -0
  29. package/dist/src/modules/v4/authentication/authentication.controller.js +23 -0
  30. package/dist/src/modules/v4/authentication/authentication.model.d.ts +10 -0
  31. package/dist/src/modules/v4/authentication/authentication.model.js +6 -0
  32. package/dist/src/modules/v4/authentication/authentication.service.d.ts +10 -0
  33. package/dist/src/modules/v4/authentication/authentication.service.js +31 -0
  34. package/dist/src/modules/v4/blacklist/blacklist.controller.js +2 -2
  35. package/dist/src/modules/v4/cache/cache.repository.d.ts +3 -0
  36. package/dist/src/modules/v4/cache/cache.repository.js +9 -0
  37. package/dist/src/modules/v4/cache/cache.service.d.ts +3 -0
  38. package/dist/src/modules/v4/cache/cache.service.js +9 -0
  39. package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +44 -2
  40. package/dist/src/modules/v4/opportunity/opportunity.controller.js +6 -6
  41. package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +5 -0
  42. package/dist/src/modules/v4/opportunity/opportunity.model.js +4 -0
  43. package/dist/src/modules/v4/reward/reward.controller.js +13 -4
  44. package/dist/src/modules/v4/router.d.ts +73 -1
  45. package/dist/src/modules/v4/router.js +3 -1
  46. package/dist/src/modules/v4/token/token.controller.js +1 -1
  47. package/dist/src/modules/v4/uniswap/uniswap.controller.js +1 -1
  48. package/dist/src/utils/decodeCalls.js +15 -5
  49. package/dist/src/utils/generateCardName.js +1 -0
  50. package/dist/tsconfig.package.tsbuildinfo +1 -1
  51. package/package.json +4 -3
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "prisma-client-7e7d6e095f074ae7cfafd3ca1abf380620c34ab8cc04d65d8d045130f98bf463",
2
+ "name": "prisma-client-c0e609530597e00e918aff9847ee58596f0c8dc697a79aefd68c0c9a7afa5c06",
3
3
  "main": "index.js",
4
4
  "types": "index.d.ts",
5
5
  "browser": "index-browser.js",
@@ -470,6 +470,7 @@ enum OpportunityManualOverride {
470
470
  action
471
471
  description
472
472
  howToSteps
473
+ mainProtocolId
473
474
  }
474
475
 
475
476
  enum DistributionType {
@@ -604,7 +604,8 @@ exports.OpportunityManualOverride = exports.$Enums.OpportunityManualOverride = {
604
604
  explorerAddress: 'explorerAddress',
605
605
  action: 'action',
606
606
  description: 'description',
607
- howToSteps: 'howToSteps'
607
+ howToSteps: 'howToSteps',
608
+ mainProtocolId: 'mainProtocolId'
608
609
  };
609
610
 
610
611
  exports.AprType = exports.$Enums.AprType = {
@@ -461,6 +461,36 @@ declare const eden: {
461
461
  tags: string[];
462
462
  };
463
463
  }>>;
464
+ patch: (body: {
465
+ tags?: string[] | undefined;
466
+ }, options: {
467
+ headers: {
468
+ authorization: string;
469
+ };
470
+ query?: Record<string, unknown> | undefined;
471
+ fetch?: RequestInit | undefined;
472
+ }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
473
+ 200: {
474
+ status: import("@db/api").$Enums.Status;
475
+ type: string;
476
+ name: string;
477
+ description: string;
478
+ id: string;
479
+ tags: string[];
480
+ identifier: string;
481
+ action: import("@db/api").$Enums.OpportunityAction;
482
+ manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
483
+ chainId: number;
484
+ howToSteps: string[];
485
+ depositUrl: string | null;
486
+ explorerAddress: string | null;
487
+ mainProtocolId: string | null;
488
+ tvl: number;
489
+ apr: number;
490
+ dailyRewards: number;
491
+ lastCampaignCreatedAt: Date;
492
+ };
493
+ }>>;
464
494
  override: {
465
495
  patch: (body: {
466
496
  name?: string | undefined;
@@ -469,6 +499,7 @@ declare const eden: {
469
499
  howToSteps?: string[] | undefined;
470
500
  depositUrl?: string | undefined;
471
501
  explorerAddress?: string | undefined;
502
+ mainProtocolId?: string | undefined;
472
503
  }, options: {
473
504
  headers: {
474
505
  authorization: string;
@@ -497,7 +528,7 @@ declare const eden: {
497
528
  lastCampaignCreatedAt: Date;
498
529
  };
499
530
  }>>;
500
- delete: (body: ("name" | "description" | "action" | "howToSteps" | "depositUrl" | "explorerAddress")[], options: {
531
+ delete: (body: ("name" | "description" | "action" | "howToSteps" | "depositUrl" | "explorerAddress" | "mainProtocolId")[], options: {
501
532
  headers: {
502
533
  authorization: string;
503
534
  };
@@ -4951,6 +4982,30 @@ declare const eden: {
4951
4982
  };
4952
4983
  };
4953
4984
  };
4985
+ authlogin: {
4986
+ post: (body: {
4987
+ message: string;
4988
+ address: string;
4989
+ signature: string;
4990
+ }, options?: {
4991
+ headers?: Record<string, unknown> | undefined;
4992
+ query?: Record<string, unknown> | undefined;
4993
+ fetch?: RequestInit | undefined;
4994
+ } | undefined) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
4995
+ 200: void;
4996
+ }>>;
4997
+ };
4998
+ auth: {
4999
+ revoke: {
5000
+ delete: (body?: unknown, options?: {
5001
+ headers?: Record<string, unknown> | undefined;
5002
+ query?: Record<string, unknown> | undefined;
5003
+ fetch?: RequestInit | undefined;
5004
+ } | undefined) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
5005
+ 200: void;
5006
+ }>>;
5007
+ };
5008
+ };
4954
5009
  };
4955
5010
  v3: {
4956
5011
  app: {
@@ -6857,6 +6912,45 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
6857
6912
  };
6858
6913
  };
6859
6914
  };
6915
+ } & {
6916
+ opportunities: {
6917
+ ":id": {
6918
+ patch: {
6919
+ body: {
6920
+ tags?: string[] | undefined;
6921
+ };
6922
+ params: {
6923
+ id: string;
6924
+ };
6925
+ query: unknown;
6926
+ headers: {
6927
+ authorization: string;
6928
+ };
6929
+ response: {
6930
+ 200: {
6931
+ status: import("@db/api").$Enums.Status;
6932
+ type: string;
6933
+ name: string;
6934
+ description: string;
6935
+ id: string;
6936
+ tags: string[];
6937
+ identifier: string;
6938
+ action: import("@db/api").$Enums.OpportunityAction;
6939
+ manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
6940
+ chainId: number;
6941
+ howToSteps: string[];
6942
+ depositUrl: string | null;
6943
+ explorerAddress: string | null;
6944
+ mainProtocolId: string | null;
6945
+ tvl: number;
6946
+ apr: number;
6947
+ dailyRewards: number;
6948
+ lastCampaignCreatedAt: Date;
6949
+ };
6950
+ };
6951
+ };
6952
+ };
6953
+ };
6860
6954
  } & {
6861
6955
  opportunities: {
6862
6956
  ":id": {
@@ -6869,6 +6963,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
6869
6963
  howToSteps?: string[] | undefined;
6870
6964
  depositUrl?: string | undefined;
6871
6965
  explorerAddress?: string | undefined;
6966
+ mainProtocolId?: string | undefined;
6872
6967
  };
6873
6968
  params: {
6874
6969
  id: string;
@@ -6908,7 +7003,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
6908
7003
  ":id": {
6909
7004
  override: {
6910
7005
  delete: {
6911
- body: ("name" | "description" | "action" | "howToSteps" | "depositUrl" | "explorerAddress")[];
7006
+ body: ("name" | "description" | "action" | "howToSteps" | "depositUrl" | "explorerAddress" | "mainProtocolId")[];
6912
7007
  params: {
6913
7008
  id: string;
6914
7009
  };
@@ -11623,6 +11718,38 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
11623
11718
  };
11624
11719
  };
11625
11720
  };
11721
+ } & {
11722
+ v4: {
11723
+ authlogin: {
11724
+ post: {
11725
+ body: {
11726
+ message: string;
11727
+ address: string;
11728
+ signature: string;
11729
+ };
11730
+ params: {};
11731
+ query: unknown;
11732
+ headers: unknown;
11733
+ response: {
11734
+ 200: void;
11735
+ };
11736
+ };
11737
+ };
11738
+ } & {
11739
+ auth: {
11740
+ revoke: {
11741
+ delete: {
11742
+ body: unknown;
11743
+ params: {};
11744
+ query: unknown;
11745
+ headers: unknown;
11746
+ response: {
11747
+ 200: void;
11748
+ };
11749
+ };
11750
+ };
11751
+ };
11752
+ };
11626
11753
  } & {
11627
11754
  v3: {
11628
11755
  app: {
@@ -12897,6 +13024,36 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
12897
13024
  tags: string[];
12898
13025
  };
12899
13026
  }>>;
13027
+ patch: (body: {
13028
+ tags?: string[] | undefined;
13029
+ }, options: {
13030
+ headers: {
13031
+ authorization: string;
13032
+ };
13033
+ query?: Record<string, unknown> | undefined;
13034
+ fetch?: RequestInit | undefined;
13035
+ }) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
13036
+ 200: {
13037
+ status: import("@db/api").$Enums.Status;
13038
+ type: string;
13039
+ name: string;
13040
+ description: string;
13041
+ id: string;
13042
+ tags: string[];
13043
+ identifier: string;
13044
+ action: import("@db/api").$Enums.OpportunityAction;
13045
+ manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
13046
+ chainId: number;
13047
+ howToSteps: string[];
13048
+ depositUrl: string | null;
13049
+ explorerAddress: string | null;
13050
+ mainProtocolId: string | null;
13051
+ tvl: number;
13052
+ apr: number;
13053
+ dailyRewards: number;
13054
+ lastCampaignCreatedAt: Date;
13055
+ };
13056
+ }>>;
12900
13057
  override: {
12901
13058
  patch: (body: {
12902
13059
  name?: string | undefined;
@@ -12905,6 +13062,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
12905
13062
  howToSteps?: string[] | undefined;
12906
13063
  depositUrl?: string | undefined;
12907
13064
  explorerAddress?: string | undefined;
13065
+ mainProtocolId?: string | undefined;
12908
13066
  }, options: {
12909
13067
  headers: {
12910
13068
  authorization: string;
@@ -12933,7 +13091,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
12933
13091
  lastCampaignCreatedAt: Date;
12934
13092
  };
12935
13093
  }>>;
12936
- delete: (body: ("name" | "description" | "action" | "howToSteps" | "depositUrl" | "explorerAddress")[], options: {
13094
+ delete: (body: ("name" | "description" | "action" | "howToSteps" | "depositUrl" | "explorerAddress" | "mainProtocolId")[], options: {
12937
13095
  headers: {
12938
13096
  authorization: string;
12939
13097
  };
@@ -17387,6 +17545,30 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
17387
17545
  };
17388
17546
  };
17389
17547
  };
17548
+ authlogin: {
17549
+ post: (body: {
17550
+ message: string;
17551
+ address: string;
17552
+ signature: string;
17553
+ }, options?: {
17554
+ headers?: Record<string, unknown> | undefined;
17555
+ query?: Record<string, unknown> | undefined;
17556
+ fetch?: RequestInit | undefined;
17557
+ } | undefined) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
17558
+ 200: void;
17559
+ }>>;
17560
+ };
17561
+ auth: {
17562
+ revoke: {
17563
+ delete: (body?: unknown, options?: {
17564
+ headers?: Record<string, unknown> | undefined;
17565
+ query?: Record<string, unknown> | undefined;
17566
+ fetch?: RequestInit | undefined;
17567
+ } | undefined) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
17568
+ 200: void;
17569
+ }>>;
17570
+ };
17571
+ };
17390
17572
  };
17391
17573
  v3: {
17392
17574
  app: {
@@ -26,7 +26,7 @@ const factoryAddresses = {
26
26
  "0x5Ea9DD3b6f042A34Df818C6c1324BC5A7c61427a": Erc20SubType.curve, // Curve Corn 2crypto Factory
27
27
  "0xd7E72f3615aa65b92A4DBdC211E296a35512988B": Erc20SubType.curveNPool, // Curve Corn Stableswap Factory
28
28
  "0x7Ca46A636b02D4aBC66883D7FF164bDE506DC66a": Erc20SubType.curveNPool, // Curve Corn 3crypto Factory
29
- "0xbC0797015fcFc47d9C1856639CaE50D0e69FbEE8": Erc20SubType.curveNPool, // Curve Arbitrum 3crypto Factory
29
+ "0xbC0797015fcFc47d9C1856639CaE50D0e69FbEE8": Erc20SubType.curveTricrypto, // Curve Arbitrum 3crypto Factory
30
30
  "0xA5961898870943c68037F6848d2D866Ed2016bcB": Erc20SubType.curveNPool, // Curve Base
31
31
  "0xB255D6A720BB7c39fee173cE22113397119cB930": Erc20SubType.katana, // Katana Ronin
32
32
  "0x29372c22459a4e373851798bFd6808e71EA34A71": Erc20SubType.punchswap, // Punchswap Flow EVM
@@ -2,6 +2,7 @@ import { Erc20SubType } from "@/engine/implementations/Erc20/subTypes";
2
2
  import { generateCardName } from "@/utils/generateCardName";
3
3
  import { BN2Number } from "@sdk";
4
4
  import { GenericProcessor } from "../GenericProcessor";
5
+ import { getCrossCurveTokenPrice } from "../helpers/getCrossCurveTokenPrice";
5
6
  export class CurveProcessor extends GenericProcessor {
6
7
  rounds = {
7
8
  round1: [
@@ -50,8 +51,11 @@ export class CurveProcessor extends GenericProcessor {
50
51
  }
51
52
  if (type === Erc20SubType.curve_2) {
52
53
  const prices = [];
53
- for (const symbol of Object.values(typeInfo.poolTokens)) {
54
- const price = (await pricer.get({ symbol: symbol })) ?? 0;
54
+ for (const [address, symbol] of Object.entries(typeInfo.poolTokens)) {
55
+ let price = (await pricer.get({ symbol: symbol })) ?? 0;
56
+ if (price === 0) {
57
+ price = await getCrossCurveTokenPrice(address);
58
+ }
55
59
  prices.push(price);
56
60
  }
57
61
  let minPrice = Math.min(...prices);
@@ -155,4 +155,5 @@ export const processorMapping = {
155
155
  [Erc20SubType.stability]: StabilityProcessor,
156
156
  [Erc20SubType.stability_lending]: AaveProcessor,
157
157
  [Erc20SubType.hyperswap]: UniswapProcessor,
158
+ [Erc20SubType.curveTricrypto]: CurveNPoolProcessor,
158
159
  };
@@ -128,6 +128,10 @@ export const tokenTypeToProtocolAndAction = {
128
128
  protocol: "curve",
129
129
  action: OpportunityAction.POOL,
130
130
  },
131
+ [Erc20SubType.curveTricrypto]: {
132
+ protocol: "curve",
133
+ action: OpportunityAction.POOL,
134
+ },
131
135
  [Erc20SubType.sake_borrowing]: {
132
136
  protocol: "sake",
133
137
  action: OpportunityAction.BORROW,
@@ -37,7 +37,11 @@ export class EulerTVLBuilder {
37
37
  if (!underlyingToken.decimals || !underlyingToken.price) {
38
38
  throw new Error(`Missing decimals or price for token ${underlylingTokenAddress}`);
39
39
  }
40
- const tvl = bigIntToNumber(totalAssets, underlyingToken.decimals) * underlyingToken.price;
40
+ let tvl = bigIntToNumber(totalAssets, underlyingToken.decimals) * underlyingToken.price;
41
+ // If TVL is zero, set to 0.01
42
+ if (tvl === 0) {
43
+ tvl = 0.01;
44
+ }
41
45
  tvls.push({
42
46
  campaign,
43
47
  tvl,
@@ -113,5 +113,6 @@ export declare enum Erc20SubType {
113
113
  stability_lending = "stability_lending",
114
114
  lendle_vaults = "lendle_vaults",
115
115
  termmax = "termmax",
116
- hyperswap = "hyperswap"
116
+ hyperswap = "hyperswap",
117
+ curveTricrypto = "curveTricrypto"
117
118
  }
@@ -113,4 +113,5 @@ export var Erc20SubType;
113
113
  Erc20SubType["lendle_vaults"] = "lendle_vaults";
114
114
  Erc20SubType["termmax"] = "termmax";
115
115
  Erc20SubType["hyperswap"] = "hyperswap";
116
+ Erc20SubType["curveTricrypto"] = "curveTricrypto";
116
117
  })(Erc20SubType || (Erc20SubType = {}));
@@ -4,4 +4,4 @@ export declare const AuthorizationHeadersDto: import("@sinclair/typebox").TObjec
4
4
  export type AuthorizationHeaders = typeof AuthorizationHeadersDto.static;
5
5
  export declare function BackOfficeGuard({ headers }: {
6
6
  headers: AuthorizationHeaders;
7
- }): Promise<void>;
7
+ }): void;
@@ -3,7 +3,7 @@ import { t } from "elysia";
3
3
  export const AuthorizationHeadersDto = t.Object({
4
4
  authorization: t.String(),
5
5
  });
6
- export async function BackOfficeGuard({ headers }) {
6
+ export function BackOfficeGuard({ headers }) {
7
7
  if (headers.authorization !== `Bearer ${process.env.BACKOFFICE_SECRET}`) {
8
8
  throw new UnauthorizedError();
9
9
  }
@@ -4,4 +4,4 @@ export declare const AuthorizationHeadersDto: import("@sinclair/typebox").TObjec
4
4
  export type AuthorizationHeaders = typeof AuthorizationHeadersDto.static;
5
5
  export declare function EngineGuard({ headers }: {
6
6
  headers: AuthorizationHeaders;
7
- }): Promise<void>;
7
+ }): void;
@@ -3,8 +3,7 @@ import { t } from "elysia";
3
3
  export const AuthorizationHeadersDto = t.Object({
4
4
  authorization: t.String(),
5
5
  });
6
- export async function EngineGuard({ headers }) {
7
- if (headers.authorization !== `Bearer ${process.env.ENGINE_SECRET}`) {
6
+ export function EngineGuard({ headers }) {
7
+ if (headers.authorization !== `Bearer ${process.env.ENGINE_SECRET}`)
8
8
  throw new UnauthorizedError();
9
- }
10
9
  }
@@ -0,0 +1,10 @@
1
+ export declare const JwtCookieDto: import("@sinclair/typebox").TObject<{
2
+ jwt: import("@sinclair/typebox").TString;
3
+ }>;
4
+ export declare function VerifyJwtGuard({ cookie }: {
5
+ cookie: {
6
+ jwt: {
7
+ value: string;
8
+ };
9
+ };
10
+ }): Promise<void>;
@@ -0,0 +1,13 @@
1
+ import { UnauthorizedError } from "@/errors";
2
+ import { CacheService } from "@/modules/v4/cache/cache.service";
3
+ import { t } from "elysia";
4
+ import { jwtVerify } from "jose";
5
+ export const JwtCookieDto = t.Cookie({
6
+ jwt: t.String(),
7
+ });
8
+ const JWT_SECRET = new TextEncoder().encode(process.env.JWT_SECRET);
9
+ export async function VerifyJwtGuard({ cookie }) {
10
+ const decodedJwt = await jwtVerify(cookie.jwt.value, JWT_SECRET);
11
+ if (!decodedJwt.payload.jti || (await CacheService.sIsMember("token:revoked", decodedJwt.payload.jti)))
12
+ throw new UnauthorizedError("Failed to verify JWT.");
13
+ }
@@ -1280,6 +1280,45 @@ declare const app: Elysia<"", false, {
1280
1280
  };
1281
1281
  };
1282
1282
  };
1283
+ } & {
1284
+ opportunities: {
1285
+ ":id": {
1286
+ patch: {
1287
+ body: {
1288
+ tags?: string[] | undefined;
1289
+ };
1290
+ params: {
1291
+ id: string;
1292
+ };
1293
+ query: unknown;
1294
+ headers: {
1295
+ authorization: string;
1296
+ };
1297
+ response: {
1298
+ 200: {
1299
+ status: import("@db/api").$Enums.Status;
1300
+ type: string;
1301
+ name: string;
1302
+ description: string;
1303
+ id: string;
1304
+ tags: string[];
1305
+ identifier: string;
1306
+ action: import("@db/api").$Enums.OpportunityAction;
1307
+ manualOverrides: import("@db/api").$Enums.OpportunityManualOverride[];
1308
+ chainId: number;
1309
+ howToSteps: string[];
1310
+ depositUrl: string | null;
1311
+ explorerAddress: string | null;
1312
+ mainProtocolId: string | null;
1313
+ tvl: number;
1314
+ apr: number;
1315
+ dailyRewards: number;
1316
+ lastCampaignCreatedAt: Date;
1317
+ };
1318
+ };
1319
+ };
1320
+ };
1321
+ };
1283
1322
  } & {
1284
1323
  opportunities: {
1285
1324
  ":id": {
@@ -1292,6 +1331,7 @@ declare const app: Elysia<"", false, {
1292
1331
  howToSteps?: string[] | undefined;
1293
1332
  depositUrl?: string | undefined;
1294
1333
  explorerAddress?: string | undefined;
1334
+ mainProtocolId?: string | undefined;
1295
1335
  };
1296
1336
  params: {
1297
1337
  id: string;
@@ -1331,7 +1371,7 @@ declare const app: Elysia<"", false, {
1331
1371
  ":id": {
1332
1372
  override: {
1333
1373
  delete: {
1334
- body: ("name" | "description" | "action" | "howToSteps" | "depositUrl" | "explorerAddress")[];
1374
+ body: ("name" | "description" | "action" | "howToSteps" | "depositUrl" | "explorerAddress" | "mainProtocolId")[];
1335
1375
  params: {
1336
1376
  id: string;
1337
1377
  };
@@ -6046,6 +6086,38 @@ declare const app: Elysia<"", false, {
6046
6086
  };
6047
6087
  };
6048
6088
  };
6089
+ } & {
6090
+ v4: {
6091
+ authlogin: {
6092
+ post: {
6093
+ body: {
6094
+ message: string;
6095
+ address: string;
6096
+ signature: string;
6097
+ };
6098
+ params: {};
6099
+ query: unknown;
6100
+ headers: unknown;
6101
+ response: {
6102
+ 200: void;
6103
+ };
6104
+ };
6105
+ };
6106
+ } & {
6107
+ auth: {
6108
+ revoke: {
6109
+ delete: {
6110
+ body: unknown;
6111
+ params: {};
6112
+ query: unknown;
6113
+ headers: unknown;
6114
+ response: {
6115
+ 200: void;
6116
+ };
6117
+ };
6118
+ };
6119
+ };
6120
+ };
6049
6121
  } & {
6050
6122
  v3: {
6051
6123
  app: {
package/dist/src/index.js CHANGED
@@ -10,6 +10,8 @@ import { v2 } from "./routes/v2/router";
10
10
  import { v3 } from "./routes/v3/router";
11
11
  import { errorHandler } from "./utils/error";
12
12
  import { log } from "./utils/logger";
13
+ if (!process.env.JWT_SECRET)
14
+ throw new Error("Environment variable JWT_SECRET is missing.");
13
15
  // Axios with bun workaround
14
16
  axios.defaults.headers.common["Accept-Encoding"] = "gzip";
15
17
  const PORT = process.env.PORT || 3000;
@@ -7,30 +7,24 @@ export const AccountingController = new Elysia({ prefix: "/accounting", detail:
7
7
  .get("/", async ({ query }) => await AccountingService.findMany(query), {
8
8
  query: GetTransactionsQueryModel,
9
9
  headers: AuthorizationHeadersDto,
10
- beforeHandle: async ({ headers }) => {
11
- await BackOfficeGuard({ headers });
12
- },
10
+ beforeHandle: BackOfficeGuard,
13
11
  })
14
12
  .group("/revenues", app => {
15
13
  return app
16
14
  .get("", async () => await AccountingService.getAllRevenueBreakdownByChain(), {
17
15
  headers: AuthorizationHeadersDto,
18
- beforeHandle: async ({ headers }) => {
19
- await BackOfficeGuard({ headers });
20
- },
16
+ beforeHandle: BackOfficeGuard,
21
17
  })
22
18
  .get("/per-month/:year/:month", async ({ params }) => await AccountingService.getMonthlyRevenue(params.year, params.month), {
23
19
  params: DateDto,
24
20
  headers: AuthorizationHeadersDto,
25
- beforeHandle: async ({ headers }) => {
26
- await BackOfficeGuard({ headers });
27
- },
21
+ beforeHandle: BackOfficeGuard,
28
22
  })
29
23
  .get("/chains/:chainId", async ({ params }) => await AccountingService.getRevenueByChain(params.chainId), {
30
24
  params: ChainDto,
31
25
  headers: AuthorizationHeadersDto,
32
26
  beforeHandle: async ({ params, headers }) => {
33
- await BackOfficeGuard({ headers });
27
+ BackOfficeGuard({ headers });
34
28
  throwOnUnsupportedChainId(params.chainId);
35
29
  },
36
30
  })
@@ -38,7 +32,7 @@ export const AccountingController = new Elysia({ prefix: "/accounting", detail:
38
32
  params: RevenuesDto,
39
33
  headers: AuthorizationHeadersDto,
40
34
  beforeHandle: async ({ params, headers }) => {
41
- await BackOfficeGuard({ headers });
35
+ BackOfficeGuard({ headers });
42
36
  throwOnUnsupportedChainId(params.chainId);
43
37
  },
44
38
  });
@@ -50,7 +44,7 @@ export const AccountingController = new Elysia({ prefix: "/accounting", detail:
50
44
  params: TokensDto,
51
45
  headers: AuthorizationHeadersDto,
52
46
  beforeHandle: async ({ params, headers }) => {
53
- await BackOfficeGuard({ headers });
47
+ BackOfficeGuard({ headers });
54
48
  params.tokenAddress = throwOnInvalidRequiredAddress(params.tokenAddress);
55
49
  throwOnUnsupportedChainId(params.chainId);
56
50
  },
@@ -59,7 +53,7 @@ export const AccountingController = new Elysia({ prefix: "/accounting", detail:
59
53
  params: TokensDateDto,
60
54
  headers: AuthorizationHeadersDto,
61
55
  beforeHandle: async ({ params, headers }) => {
62
- await BackOfficeGuard({ headers });
56
+ BackOfficeGuard({ headers });
63
57
  params.tokenAddress = throwOnInvalidRequiredAddress(params.tokenAddress);
64
58
  throwOnUnsupportedChainId(params.chainId);
65
59
  },
@@ -0,0 +1,52 @@
1
+ import Elysia from "elysia";
2
+ export declare const AuthController: Elysia<"/auth", false, {
3
+ decorator: {};
4
+ store: {};
5
+ derive: {};
6
+ resolve: {};
7
+ }, {
8
+ type: {};
9
+ error: {};
10
+ }, {
11
+ schema: {};
12
+ macro: {};
13
+ macroFn: {};
14
+ }, {
15
+ authlogin: {
16
+ post: {
17
+ body: {
18
+ message: string;
19
+ address: string;
20
+ signature: string;
21
+ };
22
+ params: {};
23
+ query: unknown;
24
+ headers: unknown;
25
+ response: {
26
+ 200: void;
27
+ };
28
+ };
29
+ };
30
+ } & {
31
+ auth: {
32
+ revoke: {
33
+ delete: {
34
+ body: unknown;
35
+ params: {};
36
+ query: unknown;
37
+ headers: unknown;
38
+ response: {
39
+ 200: void;
40
+ };
41
+ };
42
+ };
43
+ };
44
+ }, {
45
+ derive: {};
46
+ resolve: {};
47
+ schema: {};
48
+ }, {
49
+ derive: {};
50
+ resolve: {};
51
+ schema: {};
52
+ }>;