@merkl/api 0.10.158 → 0.10.160

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) 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/status/status.service.js +4 -1
  13. package/dist/src/modules/v4/token/token.repository.d.ts +1 -1
  14. package/dist/src/modules/v4/token/token.service.d.ts +2 -2
  15. package/dist/src/routes/v3/blacklist.d.ts +25 -18
  16. package/dist/src/routes/v3/campaignUnclaimed.js +5 -8
  17. package/dist/src/routes/v3/campaigns.d.ts +25 -18
  18. package/dist/src/routes/v3/campaignsInfo.d.ts +25 -18
  19. package/dist/src/routes/v3/campaignsRewardsReport.js +16 -16
  20. package/dist/src/routes/v3/claims.d.ts +1 -1
  21. package/dist/src/routes/v3/multiChainPositions.d.ts +25 -18
  22. package/dist/src/routes/v3/opportunity.d.ts +25 -18
  23. package/dist/src/routes/v3/positions.d.ts +25 -18
  24. package/dist/src/routes/v3/rewards.d.ts +25 -23
  25. package/dist/src/routes/v3/rewards.js +10 -4
  26. package/dist/src/routes/v3/rewardsReport.d.ts +8 -4
  27. package/dist/src/routes/v3/rewardsReport.js +20 -34
  28. package/dist/src/routes/v3/updates.d.ts +25 -18
  29. package/dist/src/routes/v3/userRewards.d.ts +25 -18
  30. package/dist/tsconfig.package.tsbuildinfo +1 -1
  31. package/package.json +1 -1
  32. package/dist/src/routes/v3/ERC20Campaigns.d.ts +0 -2240
  33. package/dist/src/routes/v3/ERC20Campaigns.js +0 -63
  34. package/dist/src/routes/v3/rootForTimestamp.d.ts +0 -53
  35. package/dist/src/routes/v3/rootForTimestamp.js +0 -47
@@ -1,10 +1,5 @@
1
1
  import type { App } from "../../index";
2
2
  import { RewardService } from "../../modules/v4/reward";
3
- export declare const query: import("@sinclair/typebox").TObject<{
4
- chainIds: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>]>>;
5
- user: import("@sinclair/typebox").TString;
6
- creatorTag: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
7
- }>;
8
3
  declare const _default: (app: App) => import("elysia").default<"", false, {
9
4
  decorator: {};
10
5
  store: {};
@@ -878,9 +873,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
878
873
  };
879
874
  };
880
875
  };
881
- };
882
- } & {
883
- rewards: {
876
+ } & {
884
877
  total: {
885
878
  get: {
886
879
  body: unknown;
@@ -900,9 +893,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
900
893
  };
901
894
  };
902
895
  };
903
- };
904
- } & {
905
- rewards: {
896
+ } & {
906
897
  engine: {
907
898
  post: {
908
899
  body: {
@@ -924,9 +915,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
924
915
  };
925
916
  };
926
917
  };
927
- };
928
- } & {
929
- rewards: {
918
+ } & {
930
919
  engine: {
931
920
  breakdowns: {
932
921
  post: {
@@ -959,9 +948,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
959
948
  };
960
949
  };
961
950
  };
962
- };
963
- } & {
964
- rewards: {
951
+ } & {
965
952
  engine: {
966
953
  pendings: {
967
954
  post: {
@@ -996,9 +983,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
996
983
  };
997
984
  };
998
985
  };
999
- };
1000
- } & {
1001
- rewards: {
986
+ } & {
1002
987
  count: {
1003
988
  get: {
1004
989
  body: unknown;
@@ -1017,9 +1002,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1017
1002
  };
1018
1003
  };
1019
1004
  };
1020
- };
1021
- } & {
1022
- rewards: {
1005
+ } & {
1023
1006
  count: {
1024
1007
  chains: {
1025
1008
  get: {
@@ -1040,6 +1023,25 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1040
1023
  };
1041
1024
  };
1042
1025
  };
1026
+ } & {
1027
+ unclaim: {
1028
+ index: {
1029
+ get: {
1030
+ body: unknown;
1031
+ params: {};
1032
+ query: {
1033
+ chainId: number;
1034
+ campaignIds: string[];
1035
+ };
1036
+ headers: unknown;
1037
+ response: {
1038
+ 200: {
1039
+ [x: string]: string;
1040
+ };
1041
+ };
1042
+ };
1043
+ };
1044
+ };
1043
1045
  };
1044
1046
  };
1045
1047
  } & {
@@ -1,14 +1,14 @@
1
1
  import { RewardService } from "../../modules/v4/reward";
2
2
  import { RewardConvertorService } from "../../modules/v4/reward/subservices/converter";
3
+ import { throwOnInvalidRequiredAddress } from "../../utils/throw";
3
4
  import { ChainId, isSupportedChain } from "@sdk";
4
5
  import { t } from "elysia";
5
- import checkQueryAddressValidity from "../../hooks/checkQueryAddressValidity";
6
- export const query = t.Object({
6
+ const QueryDto = t.Object({
7
7
  chainIds: t.Optional(t.Union([t.String(), t.Array(t.String())])),
8
8
  user: t.String(),
9
9
  creatorTag: t.Optional(t.String()),
10
10
  });
11
- export default (app) => app.use(checkQueryAddressValidity()).get("", async ({ query }) => {
11
+ export default (app) => app.get("", async ({ query }) => {
12
12
  let rawChainIds = query.chainIds;
13
13
  if (typeof rawChainIds === "string" && rawChainIds.includes(",")) {
14
14
  rawChainIds = rawChainIds.split(",");
@@ -30,4 +30,10 @@ export default (app) => app.use(checkQueryAddressValidity()).get("", async ({ qu
30
30
  const v4Res = await RewardService.getUserRewardsByChain(user, false, chainIds);
31
31
  const v3Res = RewardConvertorService.convertV4toRewardV3(v4Res);
32
32
  return v3Res;
33
- }, { query, tags: ["Rewards"] });
33
+ }, {
34
+ query: QueryDto,
35
+ tags: ["Rewards"],
36
+ beforeHandle: ({ query }) => {
37
+ throwOnInvalidRequiredAddress(query.user);
38
+ },
39
+ });
@@ -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
  } & {