@merkl/api 0.10.158 → 0.10.159

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. package/dist/src/eden/index.d.ts +57 -18
  2. package/dist/src/index.d.ts +25 -18
  3. package/dist/src/modules/v4/reward/reward.controller.d.ts +25 -18
  4. package/dist/src/modules/v4/reward/reward.controller.js +10 -1
  5. package/dist/src/modules/v4/reward/reward.model.d.ts +8 -0
  6. package/dist/src/modules/v4/reward/reward.model.js +9 -0
  7. package/dist/src/modules/v4/reward/reward.repository.d.ts +6 -1
  8. package/dist/src/modules/v4/reward/reward.repository.js +14 -0
  9. package/dist/src/modules/v4/reward/reward.service.d.ts +2 -1
  10. package/dist/src/modules/v4/reward/reward.service.js +18 -0
  11. package/dist/src/modules/v4/router.d.ts +25 -18
  12. package/dist/src/modules/v4/token/token.repository.d.ts +1 -1
  13. package/dist/src/modules/v4/token/token.service.d.ts +2 -2
  14. package/dist/src/routes/v3/blacklist.d.ts +25 -18
  15. package/dist/src/routes/v3/campaignUnclaimed.js +5 -8
  16. package/dist/src/routes/v3/campaigns.d.ts +25 -18
  17. package/dist/src/routes/v3/campaignsInfo.d.ts +25 -18
  18. package/dist/src/routes/v3/campaignsRewardsReport.js +16 -16
  19. package/dist/src/routes/v3/claims.d.ts +1 -1
  20. package/dist/src/routes/v3/multiChainPositions.d.ts +25 -18
  21. package/dist/src/routes/v3/opportunity.d.ts +25 -18
  22. package/dist/src/routes/v3/positions.d.ts +25 -18
  23. package/dist/src/routes/v3/rewards.d.ts +25 -23
  24. package/dist/src/routes/v3/rewards.js +10 -4
  25. package/dist/src/routes/v3/rewardsReport.d.ts +8 -4
  26. package/dist/src/routes/v3/rewardsReport.js +20 -34
  27. package/dist/src/routes/v3/updates.d.ts +25 -18
  28. package/dist/src/routes/v3/userRewards.d.ts +25 -18
  29. package/dist/tsconfig.package.tsbuildinfo +1 -1
  30. package/package.json +1 -1
  31. package/dist/src/routes/v3/ERC20Campaigns.d.ts +0 -2240
  32. package/dist/src/routes/v3/ERC20Campaigns.js +0 -63
  33. package/dist/src/routes/v3/rootForTimestamp.d.ts +0 -53
  34. package/dist/src/routes/v3/rootForTimestamp.js +0 -47
@@ -1,6 +1,6 @@
1
1
  import { type Elysia } from "elysia";
2
2
  export declare const query: import("@sinclair/typebox").TObject<{
3
- campaignId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
3
+ campaignId: import("@sinclair/typebox").TString;
4
4
  chainId: import("@sinclair/typebox").TNumber;
5
5
  from: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
6
6
  mainParameter: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
@@ -27,13 +27,17 @@ declare const _default: (app: Elysia) => Elysia<"", false, {
27
27
  from?: number | undefined;
28
28
  to?: number | undefined;
29
29
  mainParameter?: string | undefined;
30
- campaignId?: string | undefined;
31
30
  chainId: number;
31
+ campaignId: string;
32
32
  };
33
33
  headers: unknown;
34
34
  response: {
35
- [x: string]: any;
36
- 200: any;
35
+ 200: {
36
+ recipient: string;
37
+ reason: string;
38
+ rewardToken: string;
39
+ amount: string;
40
+ }[];
37
41
  };
38
42
  };
39
43
  };
@@ -1,50 +1,36 @@
1
+ import { RewardService } from "../../modules/v4/reward";
1
2
  import { t } from "elysia";
2
3
  import checkQueryChainIdValidity from "../../hooks/checkQueryChainIdValidity";
3
- import { merklChainDataWithCache } from "../../libs/merklChainData";
4
- import { getCampaignRewardsDeltaWithCache, getCampaignRewardsWithCache } from "../../libs/reports/campaignReport";
5
- import { getRewardsMainParameterDeltaWithCache, getRewardsMainParameterWithCache, } from "../../libs/reports/mainParameterRewards";
6
4
  import { InvalidParameter } from "../../utils/error";
7
5
  export const query = t.Object({
8
- campaignId: t.Optional(t.String()),
6
+ campaignId: t.String(),
9
7
  chainId: t.Numeric(),
10
8
  from: t.Optional(t.Numeric()),
11
9
  mainParameter: t.Optional(t.String()),
12
10
  to: t.Optional(t.Numeric()),
13
11
  });
14
- export default (app) => app.use(checkQueryChainIdValidity()).get("", async ({ query, set }) => {
15
- const mainParameter = query.mainParameter;
12
+ export default (app) => app.use(checkQueryChainIdValidity()).get("", async ({ query }) => {
16
13
  const campaignId = query.campaignId;
17
14
  const chainId = query.chainId;
18
15
  const from = query.from;
19
16
  const to = query.to;
20
- if ((!!to && !from) || (!to && !!from))
21
- throw new InvalidParameter("API for Merkl products by Angle Labs requires both from and to timestamps when to timestamp is provided");
22
- if (!!campaignId && !!mainParameter)
23
- throw new InvalidParameter("API for Merkl products by Angle Labs requires either a campaignId or a mainParameter, not both");
24
- if (!campaignId && !mainParameter)
25
- throw new InvalidParameter("API for Merkl products by Angle Labs requires either a campaignId or a mainParameter");
26
- if (!to && !from) {
27
- // Get the latest root and return the current rewards state
28
- const currentRoot = (await merklChainDataWithCache(chainId)).merkleRoot;
29
- if (!currentRoot) {
30
- return [];
31
- }
32
- if (!!campaignId) {
33
- return await getCampaignRewardsWithCache(chainId, currentRoot, campaignId);
34
- }
35
- if (!!mainParameter) {
36
- return await getRewardsMainParameterWithCache(chainId, currentRoot, mainParameter);
37
- }
38
- }
39
- if (!!to && !!from) {
40
- if (!!campaignId) {
41
- return await getCampaignRewardsDeltaWithCache(chainId, from, to, campaignId);
42
- }
43
- if (!!mainParameter) {
44
- return await getRewardsMainParameterDeltaWithCache(chainId, from, to, mainParameter);
45
- }
46
- }
47
- return [];
17
+ if (!!to || !!from)
18
+ throw new InvalidParameter("Passing timestamps to this route was disabled for now");
19
+ if (!!query.mainParameter)
20
+ throw new InvalidParameter("Using this route with a main parameter was temporarily disabled");
21
+ return (await RewardService.breakdownForCampaign({
22
+ campaignId,
23
+ chainId,
24
+ items: 10_000,
25
+ page: 0,
26
+ })).map(x => {
27
+ return {
28
+ recipient: x.recipient,
29
+ reason: x.reason,
30
+ rewardToken: x.Token.address,
31
+ amount: x.amount,
32
+ };
33
+ });
48
34
  }, {
49
35
  query,
50
36
  tags: ["Rewards"],
@@ -879,9 +879,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
879
879
  };
880
880
  };
881
881
  };
882
- };
883
- } & {
884
- rewards: {
882
+ } & {
885
883
  total: {
886
884
  get: {
887
885
  body: unknown;
@@ -901,9 +899,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
901
899
  };
902
900
  };
903
901
  };
904
- };
905
- } & {
906
- rewards: {
902
+ } & {
907
903
  engine: {
908
904
  post: {
909
905
  body: {
@@ -925,9 +921,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
925
921
  };
926
922
  };
927
923
  };
928
- };
929
- } & {
930
- rewards: {
924
+ } & {
931
925
  engine: {
932
926
  breakdowns: {
933
927
  post: {
@@ -960,9 +954,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
960
954
  };
961
955
  };
962
956
  };
963
- };
964
- } & {
965
- rewards: {
957
+ } & {
966
958
  engine: {
967
959
  pendings: {
968
960
  post: {
@@ -997,9 +989,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
997
989
  };
998
990
  };
999
991
  };
1000
- };
1001
- } & {
1002
- rewards: {
992
+ } & {
1003
993
  count: {
1004
994
  get: {
1005
995
  body: unknown;
@@ -1018,9 +1008,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1018
1008
  };
1019
1009
  };
1020
1010
  };
1021
- };
1022
- } & {
1023
- rewards: {
1011
+ } & {
1024
1012
  count: {
1025
1013
  chains: {
1026
1014
  get: {
@@ -1041,6 +1029,25 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1041
1029
  };
1042
1030
  };
1043
1031
  };
1032
+ } & {
1033
+ unclaim: {
1034
+ index: {
1035
+ get: {
1036
+ body: unknown;
1037
+ params: {};
1038
+ query: {
1039
+ chainId: number;
1040
+ campaignIds: string[];
1041
+ };
1042
+ headers: unknown;
1043
+ response: {
1044
+ 200: {
1045
+ [x: string]: string;
1046
+ };
1047
+ };
1048
+ };
1049
+ };
1050
+ };
1044
1051
  };
1045
1052
  };
1046
1053
  } & {
@@ -881,9 +881,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
881
881
  };
882
882
  };
883
883
  };
884
- };
885
- } & {
886
- rewards: {
884
+ } & {
887
885
  total: {
888
886
  get: {
889
887
  body: unknown;
@@ -903,9 +901,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
903
901
  };
904
902
  };
905
903
  };
906
- };
907
- } & {
908
- rewards: {
904
+ } & {
909
905
  engine: {
910
906
  post: {
911
907
  body: {
@@ -927,9 +923,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
927
923
  };
928
924
  };
929
925
  };
930
- };
931
- } & {
932
- rewards: {
926
+ } & {
933
927
  engine: {
934
928
  breakdowns: {
935
929
  post: {
@@ -962,9 +956,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
962
956
  };
963
957
  };
964
958
  };
965
- };
966
- } & {
967
- rewards: {
959
+ } & {
968
960
  engine: {
969
961
  pendings: {
970
962
  post: {
@@ -999,9 +991,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
999
991
  };
1000
992
  };
1001
993
  };
1002
- };
1003
- } & {
1004
- rewards: {
994
+ } & {
1005
995
  count: {
1006
996
  get: {
1007
997
  body: unknown;
@@ -1020,9 +1010,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1020
1010
  };
1021
1011
  };
1022
1012
  };
1023
- };
1024
- } & {
1025
- rewards: {
1013
+ } & {
1026
1014
  count: {
1027
1015
  chains: {
1028
1016
  get: {
@@ -1043,6 +1031,25 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1043
1031
  };
1044
1032
  };
1045
1033
  };
1034
+ } & {
1035
+ unclaim: {
1036
+ index: {
1037
+ get: {
1038
+ body: unknown;
1039
+ params: {};
1040
+ query: {
1041
+ chainId: number;
1042
+ campaignIds: string[];
1043
+ };
1044
+ headers: unknown;
1045
+ response: {
1046
+ 200: {
1047
+ [x: string]: string;
1048
+ };
1049
+ };
1050
+ };
1051
+ };
1052
+ };
1046
1053
  };
1047
1054
  };
1048
1055
  } & {