@merkl/api 0.10.157 → 0.10.159

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) 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/enso/enso.model.d.ts +24 -0
  4. package/dist/src/modules/v4/enso/enso.model.js +24 -0
  5. package/dist/src/modules/v4/reward/reward.controller.d.ts +25 -18
  6. package/dist/src/modules/v4/reward/reward.controller.js +10 -1
  7. package/dist/src/modules/v4/reward/reward.model.d.ts +8 -0
  8. package/dist/src/modules/v4/reward/reward.model.js +9 -0
  9. package/dist/src/modules/v4/reward/reward.repository.d.ts +6 -1
  10. package/dist/src/modules/v4/reward/reward.repository.js +14 -0
  11. package/dist/src/modules/v4/reward/reward.service.d.ts +2 -1
  12. package/dist/src/modules/v4/reward/reward.service.js +18 -0
  13. package/dist/src/modules/v4/router.d.ts +25 -18
  14. package/dist/src/modules/v4/token/token.repository.d.ts +1 -1
  15. package/dist/src/modules/v4/token/token.service.d.ts +2 -2
  16. package/dist/src/routes/v3/blacklist.d.ts +25 -18
  17. package/dist/src/routes/v3/campaignUnclaimed.js +5 -8
  18. package/dist/src/routes/v3/campaigns.d.ts +25 -18
  19. package/dist/src/routes/v3/campaignsInfo.d.ts +25 -18
  20. package/dist/src/routes/v3/campaignsRewardsReport.js +16 -16
  21. package/dist/src/routes/v3/claims.d.ts +1 -1
  22. package/dist/src/routes/v3/multiChainPositions.d.ts +25 -18
  23. package/dist/src/routes/v3/opportunity.d.ts +25 -18
  24. package/dist/src/routes/v3/positions.d.ts +25 -18
  25. package/dist/src/routes/v3/rewards.d.ts +25 -23
  26. package/dist/src/routes/v3/rewards.js +10 -4
  27. package/dist/src/routes/v3/rewardsReport.d.ts +8 -4
  28. package/dist/src/routes/v3/rewardsReport.js +20 -34
  29. package/dist/src/routes/v3/updates.d.ts +25 -18
  30. package/dist/src/routes/v3/userRewards.d.ts +25 -18
  31. package/dist/tsconfig.package.tsbuildinfo +1 -1
  32. package/package.json +1 -1
  33. package/dist/src/routes/v3/ERC20Campaigns.d.ts +0 -2240
  34. package/dist/src/routes/v3/ERC20Campaigns.js +0 -63
  35. package/dist/src/routes/v3/rootForTimestamp.d.ts +0 -53
  36. package/dist/src/routes/v3/rootForTimestamp.js +0 -47
@@ -878,9 +878,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
878
878
  };
879
879
  };
880
880
  };
881
- };
882
- } & {
883
- rewards: {
881
+ } & {
884
882
  total: {
885
883
  get: {
886
884
  body: unknown;
@@ -900,9 +898,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
900
898
  };
901
899
  };
902
900
  };
903
- };
904
- } & {
905
- rewards: {
901
+ } & {
906
902
  engine: {
907
903
  post: {
908
904
  body: {
@@ -924,9 +920,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
924
920
  };
925
921
  };
926
922
  };
927
- };
928
- } & {
929
- rewards: {
923
+ } & {
930
924
  engine: {
931
925
  breakdowns: {
932
926
  post: {
@@ -959,9 +953,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
959
953
  };
960
954
  };
961
955
  };
962
- };
963
- } & {
964
- rewards: {
956
+ } & {
965
957
  engine: {
966
958
  pendings: {
967
959
  post: {
@@ -996,9 +988,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
996
988
  };
997
989
  };
998
990
  };
999
- };
1000
- } & {
1001
- rewards: {
991
+ } & {
1002
992
  count: {
1003
993
  get: {
1004
994
  body: unknown;
@@ -1017,9 +1007,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1017
1007
  };
1018
1008
  };
1019
1009
  };
1020
- };
1021
- } & {
1022
- rewards: {
1010
+ } & {
1023
1011
  count: {
1024
1012
  chains: {
1025
1013
  get: {
@@ -1040,6 +1028,25 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1040
1028
  };
1041
1029
  };
1042
1030
  };
1031
+ } & {
1032
+ unclaim: {
1033
+ index: {
1034
+ get: {
1035
+ body: unknown;
1036
+ params: {};
1037
+ query: {
1038
+ chainId: number;
1039
+ campaignIds: string[];
1040
+ };
1041
+ headers: unknown;
1042
+ response: {
1043
+ 200: {
1044
+ [x: string]: string;
1045
+ };
1046
+ };
1047
+ };
1048
+ };
1049
+ };
1043
1050
  };
1044
1051
  };
1045
1052
  } & {
@@ -1,7 +1,6 @@
1
- import { engineDbClient } from "../../utils/prisma";
1
+ import { RewardService } from "../../modules/v4/reward";
2
2
  import { t } from "elysia";
3
3
  import checkQueryChainIdValidity from "../../hooks/checkQueryChainIdValidity";
4
- import { UNCLAIMED_FOR_CAMPAIGNS } from "../../utils/queries/unclaimed";
5
4
  export const query = t.Object({
6
5
  campaignIds: t.String(),
7
6
  chainId: t.Numeric(),
@@ -16,12 +15,10 @@ export default (app) => app.use(checkQueryChainIdValidity()).get("", async ({ qu
16
15
  campaigns = [campaignIds];
17
16
  }
18
17
  const chainId = query.chainId;
19
- const unclaimed = await engineDbClient.$queryRaw(UNCLAIMED_FOR_CAMPAIGNS(chainId, campaigns));
20
- const res = {};
21
- for (const row of unclaimed) {
22
- res[row.campaignId] = BigInt(row.unclaimed).toString();
23
- }
24
- return res;
18
+ return await RewardService.getUnclaimed({
19
+ chainId,
20
+ campaignIds: campaigns,
21
+ });
25
22
  }, {
26
23
  query,
27
24
  tags: ["Campaigns"],
@@ -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
  } & {
@@ -872,9 +872,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
872
872
  };
873
873
  };
874
874
  };
875
- };
876
- } & {
877
- rewards: {
875
+ } & {
878
876
  total: {
879
877
  get: {
880
878
  body: unknown;
@@ -894,9 +892,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
894
892
  };
895
893
  };
896
894
  };
897
- };
898
- } & {
899
- rewards: {
895
+ } & {
900
896
  engine: {
901
897
  post: {
902
898
  body: {
@@ -918,9 +914,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
918
914
  };
919
915
  };
920
916
  };
921
- };
922
- } & {
923
- rewards: {
917
+ } & {
924
918
  engine: {
925
919
  breakdowns: {
926
920
  post: {
@@ -953,9 +947,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
953
947
  };
954
948
  };
955
949
  };
956
- };
957
- } & {
958
- rewards: {
950
+ } & {
959
951
  engine: {
960
952
  pendings: {
961
953
  post: {
@@ -990,9 +982,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
990
982
  };
991
983
  };
992
984
  };
993
- };
994
- } & {
995
- rewards: {
985
+ } & {
996
986
  count: {
997
987
  get: {
998
988
  body: unknown;
@@ -1011,9 +1001,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1011
1001
  };
1012
1002
  };
1013
1003
  };
1014
- };
1015
- } & {
1016
- rewards: {
1004
+ } & {
1017
1005
  count: {
1018
1006
  chains: {
1019
1007
  get: {
@@ -1034,6 +1022,25 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1034
1022
  };
1035
1023
  };
1036
1024
  };
1025
+ } & {
1026
+ unclaim: {
1027
+ index: {
1028
+ get: {
1029
+ body: unknown;
1030
+ params: {};
1031
+ query: {
1032
+ chainId: number;
1033
+ campaignIds: string[];
1034
+ };
1035
+ headers: unknown;
1036
+ response: {
1037
+ 200: {
1038
+ [x: string]: string;
1039
+ };
1040
+ };
1041
+ };
1042
+ };
1043
+ };
1037
1044
  };
1038
1045
  };
1039
1046
  } & {
@@ -1,6 +1,5 @@
1
+ import { RewardService } from "../../modules/v4/reward";
1
2
  import { t } from "elysia";
2
- import { merklChainDataWithCache } from "../../libs/merklChainData";
3
- import { getCampaignRewardsDeltaWithCache, getCampaignRewardsWithCache } from "../../libs/reports/campaignReport";
4
3
  import { ChainCampaignId } from "../../types/parameters/ChainCampaignId";
5
4
  import { Timestamp } from "../../types/parameters/Timestamp";
6
5
  export const query = t.Object({
@@ -15,25 +14,26 @@ export const query = t.Object({
15
14
  from: t.Optional(Timestamp.type),
16
15
  to: t.Optional(Timestamp.type),
17
16
  });
18
- export default (app) => app.get("", async ({ query: { chain_campaignIds, from, to }, set }) => {
17
+ export default (app) => app.get("", async ({ query: { chain_campaignIds } }) => {
19
18
  const rewards = [];
20
19
  const campaigns = chain_campaignIds.map(c_c => {
21
20
  const [chain, campaignId] = c_c.split("_");
22
21
  return [Number.parseInt(chain), campaignId];
23
22
  });
24
- const hasValidTimeframe = !!to && !!from;
25
- if (!hasValidTimeframe) {
26
- const uniqueChains = Array.from(campaigns.reduce((set, [chain]) => set.add(chain), new Set()));
27
- const roots = {};
28
- for (const chain of uniqueChains)
29
- roots[chain] = (await merklChainDataWithCache(chain)).merkleRoot;
30
- for (const [chain, campaignId] of campaigns)
31
- rewards.push(...(await getCampaignRewardsWithCache(chain, roots[chain] ?? "", campaignId?.toLowerCase())));
32
- }
33
- else {
34
- for (const [chain, campaignId] of campaigns) {
35
- rewards.push(...(await getCampaignRewardsDeltaWithCache(chain, from, to, campaignId?.toLowerCase())));
36
- }
23
+ for (const [chainId, campaignId] of campaigns) {
24
+ rewards.push(...(await RewardService.breakdownForCampaign({
25
+ campaignId,
26
+ chainId,
27
+ items: 10_000,
28
+ page: 0,
29
+ })).map(x => {
30
+ return {
31
+ recipient: x.recipient,
32
+ reason: x.reason,
33
+ rewardToken: x.Token.address,
34
+ amount: x.amount,
35
+ };
36
+ }));
37
37
  }
38
38
  return rewards;
39
39
  }, {
@@ -24,8 +24,8 @@ declare const _default: (app: Elysia) => Elysia<"", false, {
24
24
  params: {};
25
25
  query: {
26
26
  chainIds?: string | string[] | undefined;
27
- creatorTag?: string | undefined;
28
27
  byReason?: boolean | undefined;
28
+ creatorTag?: string | undefined;
29
29
  user: string;
30
30
  };
31
31
  headers: unknown;
@@ -877,9 +877,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
877
877
  };
878
878
  };
879
879
  };
880
- };
881
- } & {
882
- rewards: {
880
+ } & {
883
881
  total: {
884
882
  get: {
885
883
  body: unknown;
@@ -899,9 +897,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
899
897
  };
900
898
  };
901
899
  };
902
- };
903
- } & {
904
- rewards: {
900
+ } & {
905
901
  engine: {
906
902
  post: {
907
903
  body: {
@@ -923,9 +919,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
923
919
  };
924
920
  };
925
921
  };
926
- };
927
- } & {
928
- rewards: {
922
+ } & {
929
923
  engine: {
930
924
  breakdowns: {
931
925
  post: {
@@ -958,9 +952,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
958
952
  };
959
953
  };
960
954
  };
961
- };
962
- } & {
963
- rewards: {
955
+ } & {
964
956
  engine: {
965
957
  pendings: {
966
958
  post: {
@@ -995,9 +987,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
995
987
  };
996
988
  };
997
989
  };
998
- };
999
- } & {
1000
- rewards: {
990
+ } & {
1001
991
  count: {
1002
992
  get: {
1003
993
  body: unknown;
@@ -1016,9 +1006,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1016
1006
  };
1017
1007
  };
1018
1008
  };
1019
- };
1020
- } & {
1021
- rewards: {
1009
+ } & {
1022
1010
  count: {
1023
1011
  chains: {
1024
1012
  get: {
@@ -1039,6 +1027,25 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1039
1027
  };
1040
1028
  };
1041
1029
  };
1030
+ } & {
1031
+ unclaim: {
1032
+ index: {
1033
+ get: {
1034
+ body: unknown;
1035
+ params: {};
1036
+ query: {
1037
+ chainId: number;
1038
+ campaignIds: string[];
1039
+ };
1040
+ headers: unknown;
1041
+ response: {
1042
+ 200: {
1043
+ [x: string]: string;
1044
+ };
1045
+ };
1046
+ };
1047
+ };
1048
+ };
1042
1049
  };
1043
1050
  };
1044
1051
  } & {
@@ -895,9 +895,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
895
895
  };
896
896
  };
897
897
  };
898
- };
899
- } & {
900
- rewards: {
898
+ } & {
901
899
  total: {
902
900
  get: {
903
901
  body: unknown;
@@ -917,9 +915,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
917
915
  };
918
916
  };
919
917
  };
920
- };
921
- } & {
922
- rewards: {
918
+ } & {
923
919
  engine: {
924
920
  post: {
925
921
  body: {
@@ -941,9 +937,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
941
937
  };
942
938
  };
943
939
  };
944
- };
945
- } & {
946
- rewards: {
940
+ } & {
947
941
  engine: {
948
942
  breakdowns: {
949
943
  post: {
@@ -976,9 +970,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
976
970
  };
977
971
  };
978
972
  };
979
- };
980
- } & {
981
- rewards: {
973
+ } & {
982
974
  engine: {
983
975
  pendings: {
984
976
  post: {
@@ -1013,9 +1005,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1013
1005
  };
1014
1006
  };
1015
1007
  };
1016
- };
1017
- } & {
1018
- rewards: {
1008
+ } & {
1019
1009
  count: {
1020
1010
  get: {
1021
1011
  body: unknown;
@@ -1034,9 +1024,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1034
1024
  };
1035
1025
  };
1036
1026
  };
1037
- };
1038
- } & {
1039
- rewards: {
1027
+ } & {
1040
1028
  count: {
1041
1029
  chains: {
1042
1030
  get: {
@@ -1057,6 +1045,25 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1057
1045
  };
1058
1046
  };
1059
1047
  };
1048
+ } & {
1049
+ unclaim: {
1050
+ index: {
1051
+ get: {
1052
+ body: unknown;
1053
+ params: {};
1054
+ query: {
1055
+ chainId: number;
1056
+ campaignIds: string[];
1057
+ };
1058
+ headers: unknown;
1059
+ response: {
1060
+ 200: {
1061
+ [x: string]: string;
1062
+ };
1063
+ };
1064
+ };
1065
+ };
1066
+ };
1060
1067
  };
1061
1068
  };
1062
1069
  } & {
@@ -896,9 +896,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
896
896
  };
897
897
  };
898
898
  };
899
- };
900
- } & {
901
- rewards: {
899
+ } & {
902
900
  total: {
903
901
  get: {
904
902
  body: unknown;
@@ -918,9 +916,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
918
916
  };
919
917
  };
920
918
  };
921
- };
922
- } & {
923
- rewards: {
919
+ } & {
924
920
  engine: {
925
921
  post: {
926
922
  body: {
@@ -942,9 +938,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
942
938
  };
943
939
  };
944
940
  };
945
- };
946
- } & {
947
- rewards: {
941
+ } & {
948
942
  engine: {
949
943
  breakdowns: {
950
944
  post: {
@@ -977,9 +971,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
977
971
  };
978
972
  };
979
973
  };
980
- };
981
- } & {
982
- rewards: {
974
+ } & {
983
975
  engine: {
984
976
  pendings: {
985
977
  post: {
@@ -1014,9 +1006,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1014
1006
  };
1015
1007
  };
1016
1008
  };
1017
- };
1018
- } & {
1019
- rewards: {
1009
+ } & {
1020
1010
  count: {
1021
1011
  get: {
1022
1012
  body: unknown;
@@ -1035,9 +1025,7 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1035
1025
  };
1036
1026
  };
1037
1027
  };
1038
- };
1039
- } & {
1040
- rewards: {
1028
+ } & {
1041
1029
  count: {
1042
1030
  chains: {
1043
1031
  get: {
@@ -1058,6 +1046,25 @@ declare const _default: (app: App) => import("elysia").default<"", false, {
1058
1046
  };
1059
1047
  };
1060
1048
  };
1049
+ } & {
1050
+ unclaim: {
1051
+ index: {
1052
+ get: {
1053
+ body: unknown;
1054
+ params: {};
1055
+ query: {
1056
+ chainId: number;
1057
+ campaignIds: string[];
1058
+ };
1059
+ headers: unknown;
1060
+ response: {
1061
+ 200: {
1062
+ [x: string]: string;
1063
+ };
1064
+ };
1065
+ };
1066
+ };
1067
+ };
1061
1068
  };
1062
1069
  };
1063
1070
  } & {