@merkl/api 0.10.157 → 0.10.159
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.
- package/dist/src/eden/index.d.ts +57 -18
- package/dist/src/index.d.ts +25 -18
- package/dist/src/modules/v4/enso/enso.model.d.ts +24 -0
- package/dist/src/modules/v4/enso/enso.model.js +24 -0
- package/dist/src/modules/v4/reward/reward.controller.d.ts +25 -18
- package/dist/src/modules/v4/reward/reward.controller.js +10 -1
- package/dist/src/modules/v4/reward/reward.model.d.ts +8 -0
- package/dist/src/modules/v4/reward/reward.model.js +9 -0
- package/dist/src/modules/v4/reward/reward.repository.d.ts +6 -1
- package/dist/src/modules/v4/reward/reward.repository.js +14 -0
- package/dist/src/modules/v4/reward/reward.service.d.ts +2 -1
- package/dist/src/modules/v4/reward/reward.service.js +18 -0
- package/dist/src/modules/v4/router.d.ts +25 -18
- package/dist/src/modules/v4/token/token.repository.d.ts +1 -1
- package/dist/src/modules/v4/token/token.service.d.ts +2 -2
- package/dist/src/routes/v3/blacklist.d.ts +25 -18
- package/dist/src/routes/v3/campaignUnclaimed.js +5 -8
- package/dist/src/routes/v3/campaigns.d.ts +25 -18
- package/dist/src/routes/v3/campaignsInfo.d.ts +25 -18
- package/dist/src/routes/v3/campaignsRewardsReport.js +16 -16
- package/dist/src/routes/v3/claims.d.ts +1 -1
- package/dist/src/routes/v3/multiChainPositions.d.ts +25 -18
- package/dist/src/routes/v3/opportunity.d.ts +25 -18
- package/dist/src/routes/v3/positions.d.ts +25 -18
- package/dist/src/routes/v3/rewards.d.ts +25 -23
- package/dist/src/routes/v3/rewards.js +10 -4
- package/dist/src/routes/v3/rewardsReport.d.ts +8 -4
- package/dist/src/routes/v3/rewardsReport.js +20 -34
- package/dist/src/routes/v3/updates.d.ts +25 -18
- package/dist/src/routes/v3/userRewards.d.ts +25 -18
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/src/routes/v3/ERC20Campaigns.d.ts +0 -2240
- package/dist/src/routes/v3/ERC20Campaigns.js +0 -63
- package/dist/src/routes/v3/rootForTimestamp.d.ts +0 -53
- package/dist/src/routes/v3/rootForTimestamp.js +0 -47
package/dist/src/eden/index.d.ts
CHANGED
@@ -867,6 +867,22 @@ declare const eden: {
|
|
867
867
|
}>>;
|
868
868
|
};
|
869
869
|
};
|
870
|
+
unclaim: {
|
871
|
+
index: {
|
872
|
+
get: (options: {
|
873
|
+
headers?: Record<string, unknown> | undefined;
|
874
|
+
query: {
|
875
|
+
chainId: number;
|
876
|
+
campaignIds: string[];
|
877
|
+
};
|
878
|
+
fetch?: RequestInit | undefined;
|
879
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
880
|
+
200: {
|
881
|
+
[x: string]: string;
|
882
|
+
};
|
883
|
+
}>>;
|
884
|
+
};
|
885
|
+
};
|
870
886
|
};
|
871
887
|
chains: ((params: {
|
872
888
|
chainId: string | number;
|
@@ -2650,9 +2666,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
2650
2666
|
};
|
2651
2667
|
};
|
2652
2668
|
};
|
2653
|
-
}
|
2654
|
-
} & {
|
2655
|
-
rewards: {
|
2669
|
+
} & {
|
2656
2670
|
total: {
|
2657
2671
|
get: {
|
2658
2672
|
body: unknown;
|
@@ -2672,9 +2686,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
2672
2686
|
};
|
2673
2687
|
};
|
2674
2688
|
};
|
2675
|
-
}
|
2676
|
-
} & {
|
2677
|
-
rewards: {
|
2689
|
+
} & {
|
2678
2690
|
engine: {
|
2679
2691
|
post: {
|
2680
2692
|
body: {
|
@@ -2696,9 +2708,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
2696
2708
|
};
|
2697
2709
|
};
|
2698
2710
|
};
|
2699
|
-
}
|
2700
|
-
} & {
|
2701
|
-
rewards: {
|
2711
|
+
} & {
|
2702
2712
|
engine: {
|
2703
2713
|
breakdowns: {
|
2704
2714
|
post: {
|
@@ -2731,9 +2741,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
2731
2741
|
};
|
2732
2742
|
};
|
2733
2743
|
};
|
2734
|
-
}
|
2735
|
-
} & {
|
2736
|
-
rewards: {
|
2744
|
+
} & {
|
2737
2745
|
engine: {
|
2738
2746
|
pendings: {
|
2739
2747
|
post: {
|
@@ -2768,9 +2776,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
2768
2776
|
};
|
2769
2777
|
};
|
2770
2778
|
};
|
2771
|
-
}
|
2772
|
-
} & {
|
2773
|
-
rewards: {
|
2779
|
+
} & {
|
2774
2780
|
count: {
|
2775
2781
|
get: {
|
2776
2782
|
body: unknown;
|
@@ -2789,9 +2795,7 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
2789
2795
|
};
|
2790
2796
|
};
|
2791
2797
|
};
|
2792
|
-
}
|
2793
|
-
} & {
|
2794
|
-
rewards: {
|
2798
|
+
} & {
|
2795
2799
|
count: {
|
2796
2800
|
chains: {
|
2797
2801
|
get: {
|
@@ -2812,6 +2816,25 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
2812
2816
|
};
|
2813
2817
|
};
|
2814
2818
|
};
|
2819
|
+
} & {
|
2820
|
+
unclaim: {
|
2821
|
+
index: {
|
2822
|
+
get: {
|
2823
|
+
body: unknown;
|
2824
|
+
params: {};
|
2825
|
+
query: {
|
2826
|
+
chainId: number;
|
2827
|
+
campaignIds: string[];
|
2828
|
+
};
|
2829
|
+
headers: unknown;
|
2830
|
+
response: {
|
2831
|
+
200: {
|
2832
|
+
[x: string]: string;
|
2833
|
+
};
|
2834
|
+
};
|
2835
|
+
};
|
2836
|
+
};
|
2837
|
+
};
|
2815
2838
|
};
|
2816
2839
|
};
|
2817
2840
|
} & {
|
@@ -4858,6 +4881,22 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
4858
4881
|
}>>;
|
4859
4882
|
};
|
4860
4883
|
};
|
4884
|
+
unclaim: {
|
4885
|
+
index: {
|
4886
|
+
get: (options: {
|
4887
|
+
headers?: Record<string, unknown> | undefined;
|
4888
|
+
query: {
|
4889
|
+
chainId: number;
|
4890
|
+
campaignIds: string[];
|
4891
|
+
};
|
4892
|
+
fetch?: RequestInit | undefined;
|
4893
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
4894
|
+
200: {
|
4895
|
+
[x: string]: string;
|
4896
|
+
};
|
4897
|
+
}>>;
|
4898
|
+
};
|
4899
|
+
};
|
4861
4900
|
};
|
4862
4901
|
chains: ((params: {
|
4863
4902
|
chainId: string | number;
|
package/dist/src/index.d.ts
CHANGED
@@ -872,9 +872,7 @@ declare const app: Elysia<"", 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 app: Elysia<"", 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 app: Elysia<"", 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 app: Elysia<"", 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 app: Elysia<"", 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 app: Elysia<"", 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 app: Elysia<"", 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,7 +1,31 @@
|
|
1
1
|
export declare const slugToProtocolId: {
|
2
2
|
readonly "uniswap-v2": "uniswap-v2";
|
3
3
|
readonly "aave-v2": "aave";
|
4
|
+
readonly "aave-v3": "aave";
|
5
|
+
readonly "aave-static-atokens": "aave";
|
4
6
|
readonly "camelot-v2": "camelot";
|
7
|
+
readonly "meta-morpho": "morpho";
|
8
|
+
readonly "morpho-blue-vaults": "morpho";
|
9
|
+
readonly "balancer-v2": "balancer";
|
10
|
+
readonly "balancer-gauge": "balancer";
|
11
|
+
readonly "aura-lp": "aura";
|
12
|
+
readonly aura: "aura";
|
13
|
+
readonly beefy: "beefy";
|
14
|
+
readonly "compound-v3": "compound";
|
15
|
+
readonly "curve-gauge": "curve";
|
16
|
+
readonly "euler-v2": "euler";
|
17
|
+
readonly fluid: "fluid";
|
18
|
+
readonly fraxlend: "frax";
|
19
|
+
readonly "frax-ether": "frax";
|
20
|
+
readonly "gearbox-v3": "gearbox";
|
21
|
+
readonly gearbox: "gearbox";
|
22
|
+
readonly moonwell: "moonwell";
|
23
|
+
readonly "pancakeswap-amm-v3": "pancakeswap-v3";
|
24
|
+
readonly "quickswap-dex": "quickswap-uni";
|
25
|
+
readonly "silo-protected": "silo";
|
26
|
+
readonly silo: "silo";
|
27
|
+
readonly "velodrome-v2-staking": "velodrome";
|
28
|
+
readonly zerolend: "zero";
|
5
29
|
};
|
6
30
|
export type EnsoSlug = keyof typeof slugToProtocolId;
|
7
31
|
export declare const apiTypes: {
|
@@ -2,7 +2,31 @@ import { t } from "elysia";
|
|
2
2
|
export const slugToProtocolId = {
|
3
3
|
"uniswap-v2": "uniswap-v2",
|
4
4
|
"aave-v2": "aave",
|
5
|
+
"aave-v3": "aave",
|
6
|
+
"aave-static-atokens": "aave",
|
5
7
|
"camelot-v2": "camelot",
|
8
|
+
"meta-morpho": "morpho",
|
9
|
+
"morpho-blue-vaults": "morpho",
|
10
|
+
"balancer-v2": "balancer",
|
11
|
+
"balancer-gauge": "balancer",
|
12
|
+
"aura-lp": "aura",
|
13
|
+
aura: "aura",
|
14
|
+
beefy: "beefy",
|
15
|
+
"compound-v3": "compound",
|
16
|
+
"curve-gauge": "curve",
|
17
|
+
"euler-v2": "euler",
|
18
|
+
fluid: "fluid",
|
19
|
+
fraxlend: "frax",
|
20
|
+
"frax-ether": "frax",
|
21
|
+
"gearbox-v3": "gearbox",
|
22
|
+
gearbox: "gearbox",
|
23
|
+
moonwell: "moonwell",
|
24
|
+
"pancakeswap-amm-v3": "pancakeswap-v3",
|
25
|
+
"quickswap-dex": "quickswap-uni",
|
26
|
+
"silo-protected": "silo",
|
27
|
+
silo: "silo",
|
28
|
+
"velodrome-v2-staking": "velodrome",
|
29
|
+
zerolend: "zero",
|
6
30
|
};
|
7
31
|
export const apiTypes = {
|
8
32
|
"/v1/protocols": {
|
@@ -29,9 +29,7 @@ export declare const RewardController: Elysia<"/rewards", false, {
|
|
29
29
|
};
|
30
30
|
};
|
31
31
|
};
|
32
|
-
}
|
33
|
-
} & {
|
34
|
-
rewards: {
|
32
|
+
} & {
|
35
33
|
total: {
|
36
34
|
get: {
|
37
35
|
body: unknown;
|
@@ -51,9 +49,7 @@ export declare const RewardController: Elysia<"/rewards", false, {
|
|
51
49
|
};
|
52
50
|
};
|
53
51
|
};
|
54
|
-
}
|
55
|
-
} & {
|
56
|
-
rewards: {
|
52
|
+
} & {
|
57
53
|
engine: {
|
58
54
|
post: {
|
59
55
|
body: {
|
@@ -75,9 +71,7 @@ export declare const RewardController: Elysia<"/rewards", false, {
|
|
75
71
|
};
|
76
72
|
};
|
77
73
|
};
|
78
|
-
}
|
79
|
-
} & {
|
80
|
-
rewards: {
|
74
|
+
} & {
|
81
75
|
engine: {
|
82
76
|
breakdowns: {
|
83
77
|
post: {
|
@@ -110,9 +104,7 @@ export declare const RewardController: Elysia<"/rewards", false, {
|
|
110
104
|
};
|
111
105
|
};
|
112
106
|
};
|
113
|
-
}
|
114
|
-
} & {
|
115
|
-
rewards: {
|
107
|
+
} & {
|
116
108
|
engine: {
|
117
109
|
pendings: {
|
118
110
|
post: {
|
@@ -147,9 +139,7 @@ export declare const RewardController: Elysia<"/rewards", false, {
|
|
147
139
|
};
|
148
140
|
};
|
149
141
|
};
|
150
|
-
}
|
151
|
-
} & {
|
152
|
-
rewards: {
|
142
|
+
} & {
|
153
143
|
count: {
|
154
144
|
get: {
|
155
145
|
body: unknown;
|
@@ -168,9 +158,7 @@ export declare const RewardController: Elysia<"/rewards", false, {
|
|
168
158
|
};
|
169
159
|
};
|
170
160
|
};
|
171
|
-
}
|
172
|
-
} & {
|
173
|
-
rewards: {
|
161
|
+
} & {
|
174
162
|
count: {
|
175
163
|
chains: {
|
176
164
|
get: {
|
@@ -191,6 +179,25 @@ export declare const RewardController: Elysia<"/rewards", false, {
|
|
191
179
|
};
|
192
180
|
};
|
193
181
|
};
|
182
|
+
} & {
|
183
|
+
unclaim: {
|
184
|
+
index: {
|
185
|
+
get: {
|
186
|
+
body: unknown;
|
187
|
+
params: {};
|
188
|
+
query: {
|
189
|
+
chainId: number;
|
190
|
+
campaignIds: string[];
|
191
|
+
};
|
192
|
+
headers: unknown;
|
193
|
+
response: {
|
194
|
+
200: {
|
195
|
+
[x: string]: string;
|
196
|
+
};
|
197
|
+
};
|
198
|
+
};
|
199
|
+
};
|
200
|
+
};
|
194
201
|
};
|
195
202
|
}, {
|
196
203
|
derive: {};
|
@@ -2,7 +2,7 @@ import { BackOfficeGuard } from "../../../guards/BackOffice.guard";
|
|
2
2
|
import { AuthorizationHeadersDto, EngineGuard } from "../../../guards/Engine.guard";
|
3
3
|
import { throwOnUnsupportedChainId } from "../../../utils/throw";
|
4
4
|
import Elysia from "elysia";
|
5
|
-
import { CampaignIdDto, CreateManyBreakdownDto, CreateManyRewardDto, UpdatePendingDto } from "./reward.model";
|
5
|
+
import { CampaignIdDto, CampaignIdWithoutPageDto, CreateManyBreakdownDto, CreateManyRewardDto, UpdatePendingDto, } from "./reward.model";
|
6
6
|
import { RewardService } from "./reward.service";
|
7
7
|
// ─── Rewards Controller ──────────────────────────────────────────────────────
|
8
8
|
export const RewardController = new Elysia({ prefix: "/rewards", detail: { tags: ["Rewards"] } })
|
@@ -49,4 +49,13 @@ export const RewardController = new Elysia({ prefix: "/rewards", detail: { tags:
|
|
49
49
|
.get("/count/chains", async () => await RewardService.countAllchains(), {
|
50
50
|
headers: AuthorizationHeadersDto,
|
51
51
|
beforeHandle: BackOfficeGuard,
|
52
|
+
})
|
53
|
+
// ─── Unclaimed Data routes ───────────────────────────────────────────
|
54
|
+
.group("/unclaim", app => {
|
55
|
+
return app.get("/", async ({ query }) => await RewardService.getUnclaimed(query), {
|
56
|
+
query: CampaignIdWithoutPageDto,
|
57
|
+
beforeHandle: ({ query }) => {
|
58
|
+
throwOnUnsupportedChainId(query.chainId);
|
59
|
+
},
|
60
|
+
});
|
52
61
|
});
|
@@ -109,6 +109,10 @@ export declare const UserRewardQueryDto: import("@sinclair/typebox").TObject<{
|
|
109
109
|
export declare const RewardsPerChainDto: import("@sinclair/typebox").TObject<{
|
110
110
|
chainId: import("@sinclair/typebox").TNumber;
|
111
111
|
}>;
|
112
|
+
export declare const CampaignIdWithoutPageDto: import("@sinclair/typebox").TObject<{
|
113
|
+
chainId: import("@sinclair/typebox").TNumber;
|
114
|
+
campaignIds: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>]>, string[]>;
|
115
|
+
}>;
|
112
116
|
export declare const CampaignIdListDto: import("@sinclair/typebox").TObject<{
|
113
117
|
chainId: import("@sinclair/typebox").TNumber;
|
114
118
|
campaignIds: import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>]>, string[]>;
|
@@ -161,6 +165,10 @@ export type RewardEntity = typeof RewardDto.static;
|
|
161
165
|
export type RewardPerChainModel = typeof RewardsPerChainDto.static;
|
162
166
|
export type UpdatePendingModel = typeof UpdatePendingDto.static;
|
163
167
|
export type PendingEntity = typeof PendingDto.static;
|
168
|
+
export type CampaignIdWithoutPageModel = {
|
169
|
+
chainId: number;
|
170
|
+
campaignIds: string[];
|
171
|
+
};
|
164
172
|
export type CampaignIdListModel = typeof CampaignIdListDto.static;
|
165
173
|
export type CampaignIdModel = typeof CampaignIdDto.static;
|
166
174
|
export type UserRewardV3Model = typeof UserRewardV3Dto.static;
|
@@ -57,6 +57,15 @@ export const UserRewardQueryDto = t.Object({
|
|
57
57
|
export const RewardsPerChainDto = t.Object({
|
58
58
|
chainId: t.Numeric(),
|
59
59
|
});
|
60
|
+
export const CampaignIdWithoutPageDto = t.Object({
|
61
|
+
chainId: t.Numeric(),
|
62
|
+
campaignIds: t
|
63
|
+
.Transform(t.Union([t.String(), t.Array(t.String())]))
|
64
|
+
.Decode(value => {
|
65
|
+
return typeof value === "string" ? value.split(",") : value;
|
66
|
+
})
|
67
|
+
.Encode(value => [...value]),
|
68
|
+
});
|
60
69
|
export const CampaignIdListDto = t.Object({
|
61
70
|
chainId: t.Numeric(),
|
62
71
|
campaignIds: t
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { Prisma } from "../../../../database/api/.generated";
|
2
|
-
import type { BreakdownForCampaignsRaw, CampaignIdModel, CreateManyBreakdownModel, CreateManyRewardModel, PendingEntity } from "./reward.model";
|
2
|
+
import type { BreakdownForCampaignsRaw, CampaignIdModel, CampaignIdWithoutPageModel, CreateManyBreakdownModel, CreateManyRewardModel, PendingEntity } from "./reward.model";
|
3
3
|
export declare abstract class RewardRepository {
|
4
4
|
static createManyReward(rewards: CreateManyRewardModel): Promise<Prisma.BatchPayload>;
|
5
5
|
static createManyBreakdown(data: CreateManyBreakdownModel): Promise<Prisma.BatchPayload>;
|
@@ -149,6 +149,11 @@ export declare abstract class RewardRepository {
|
|
149
149
|
campaignId: string;
|
150
150
|
amount: bigint;
|
151
151
|
}>;
|
152
|
+
static getUnclaimed(x: CampaignIdWithoutPageModel): Promise<{
|
153
|
+
campaignId: string;
|
154
|
+
amount: string;
|
155
|
+
claimed: string;
|
156
|
+
}[]>;
|
152
157
|
static count(campaignId: string, root: string): Promise<{
|
153
158
|
count: number;
|
154
159
|
}>;
|
@@ -223,6 +223,20 @@ export class RewardRepository {
|
|
223
223
|
}, { campaignId, amount: 0n });
|
224
224
|
return reducedData;
|
225
225
|
}
|
226
|
+
static async getUnclaimed(x) {
|
227
|
+
return await apiDbClient.rewardBreakdown.findMany({
|
228
|
+
select: {
|
229
|
+
claimed: true,
|
230
|
+
amount: true,
|
231
|
+
campaignId: true,
|
232
|
+
},
|
233
|
+
where: {
|
234
|
+
campaignId: {
|
235
|
+
in: x.campaignIds.map(campaignId => CampaignService.hashId({ distributionChain: x.chainId, campaignId })),
|
236
|
+
},
|
237
|
+
},
|
238
|
+
});
|
239
|
+
}
|
226
240
|
static async count(campaignId, root) {
|
227
241
|
const count = await apiDbClient.rewardBreakdown.count({
|
228
242
|
where: {
|
@@ -2,7 +2,7 @@ import type { CacheKeys } from "../../../cache/keys";
|
|
2
2
|
import type { Chain } from "../../../../database/api/.generated";
|
3
3
|
import { Campaign, type CampaignDynamicData, type ChainId } from "@sdk";
|
4
4
|
import { type LightOpportunityFromDB, type Opportunity } from "../opportunity";
|
5
|
-
import type { CampaignIdModel, CreateManyBreakdownModel, CreateManyRewardModel, DailyRewardsRecord, RewardBreakdown, UpdatePendingModel } from "./reward.model";
|
5
|
+
import type { CampaignIdModel, CampaignIdWithoutPageModel, CreateManyBreakdownModel, CreateManyRewardModel, DailyRewardsRecord, RewardBreakdown, UpdatePendingModel } from "./reward.model";
|
6
6
|
import { RewardRepository } from "./reward.repository";
|
7
7
|
export declare abstract class RewardService {
|
8
8
|
static hashId(root: string, recipient: string, rewardTokenId: string): string;
|
@@ -532,5 +532,6 @@ export declare abstract class RewardService {
|
|
532
532
|
campaignId: string;
|
533
533
|
amount: bigint;
|
534
534
|
}>;
|
535
|
+
static getUnclaimed(x: CampaignIdWithoutPageModel): Promise<Record<string, string>>;
|
535
536
|
static extractDailyRewardsRecordFromDynamicData<C extends Campaign>(type: C, dynamicData: CampaignDynamicData<C>[], timestamp?: bigint): Promise<DailyRewardsRecord["model"]>;
|
536
537
|
}
|
@@ -259,6 +259,19 @@ export class RewardService {
|
|
259
259
|
const root = await MerklRootService.fetch(query.chainId);
|
260
260
|
return RewardRepository.total(CampaignService.hashId({ distributionChain: query.chainId, campaignId: query.campaignId }), root.live);
|
261
261
|
}
|
262
|
+
static async getUnclaimed(x) {
|
263
|
+
const campaignToCampaignIds = x.campaignIds.reduce((acc, campaignId) => {
|
264
|
+
acc[CampaignService.hashId({ distributionChain: x.chainId, campaignId })] = campaignId;
|
265
|
+
return acc;
|
266
|
+
}, {});
|
267
|
+
const data = await RewardRepository.getUnclaimed(x);
|
268
|
+
return data.reduce((acc, { amount, campaignId }) => {
|
269
|
+
if (!acc[campaignToCampaignIds[campaignId]])
|
270
|
+
acc[campaignToCampaignIds[campaignId]] = "0";
|
271
|
+
acc[campaignToCampaignIds[campaignId]] = (BigInt(acc[campaignToCampaignIds[campaignId]]) + BigInt(amount)).toString();
|
272
|
+
return acc;
|
273
|
+
}, {});
|
274
|
+
}
|
262
275
|
static async extractDailyRewardsRecordFromDynamicData(type, dynamicData, timestamp = BigInt(moment().unix())) {
|
263
276
|
const typesWithoutApr = [Campaign.INVALID];
|
264
277
|
if (typesWithoutApr.includes(type))
|
@@ -272,6 +285,11 @@ export class RewardService {
|
|
272
285
|
breakdowns.push({
|
273
286
|
campaignId: CampaignService.hashId({ campaignId, distributionChain: chainId }),
|
274
287
|
value: campaignDailyValue,
|
288
|
+
amount: dailyAmount,
|
289
|
+
token: await TokenService.findUniqueOrThrow({
|
290
|
+
address,
|
291
|
+
chainId,
|
292
|
+
}),
|
275
293
|
});
|
276
294
|
}
|
277
295
|
return {
|
@@ -854,9 +854,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
854
854
|
};
|
855
855
|
};
|
856
856
|
};
|
857
|
-
}
|
858
|
-
} & {
|
859
|
-
rewards: {
|
857
|
+
} & {
|
860
858
|
total: {
|
861
859
|
get: {
|
862
860
|
body: unknown;
|
@@ -876,9 +874,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
876
874
|
};
|
877
875
|
};
|
878
876
|
};
|
879
|
-
}
|
880
|
-
} & {
|
881
|
-
rewards: {
|
877
|
+
} & {
|
882
878
|
engine: {
|
883
879
|
post: {
|
884
880
|
body: {
|
@@ -900,9 +896,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
900
896
|
};
|
901
897
|
};
|
902
898
|
};
|
903
|
-
}
|
904
|
-
} & {
|
905
|
-
rewards: {
|
899
|
+
} & {
|
906
900
|
engine: {
|
907
901
|
breakdowns: {
|
908
902
|
post: {
|
@@ -935,9 +929,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
935
929
|
};
|
936
930
|
};
|
937
931
|
};
|
938
|
-
}
|
939
|
-
} & {
|
940
|
-
rewards: {
|
932
|
+
} & {
|
941
933
|
engine: {
|
942
934
|
pendings: {
|
943
935
|
post: {
|
@@ -972,9 +964,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
972
964
|
};
|
973
965
|
};
|
974
966
|
};
|
975
|
-
}
|
976
|
-
} & {
|
977
|
-
rewards: {
|
967
|
+
} & {
|
978
968
|
count: {
|
979
969
|
get: {
|
980
970
|
body: unknown;
|
@@ -993,9 +983,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
993
983
|
};
|
994
984
|
};
|
995
985
|
};
|
996
|
-
}
|
997
|
-
} & {
|
998
|
-
rewards: {
|
986
|
+
} & {
|
999
987
|
count: {
|
1000
988
|
chains: {
|
1001
989
|
get: {
|
@@ -1016,6 +1004,25 @@ export declare const v4: Elysia<"/v4", false, {
|
|
1016
1004
|
};
|
1017
1005
|
};
|
1018
1006
|
};
|
1007
|
+
} & {
|
1008
|
+
unclaim: {
|
1009
|
+
index: {
|
1010
|
+
get: {
|
1011
|
+
body: unknown;
|
1012
|
+
params: {};
|
1013
|
+
query: {
|
1014
|
+
chainId: number;
|
1015
|
+
campaignIds: string[];
|
1016
|
+
};
|
1017
|
+
headers: unknown;
|
1018
|
+
response: {
|
1019
|
+
200: {
|
1020
|
+
[x: string]: string;
|
1021
|
+
};
|
1022
|
+
};
|
1023
|
+
};
|
1024
|
+
};
|
1025
|
+
};
|
1019
1026
|
};
|
1020
1027
|
};
|
1021
1028
|
} & {
|
@@ -24,7 +24,7 @@ export declare abstract class TokenRepository {
|
|
24
24
|
* @param chainId
|
25
25
|
* @param address
|
26
26
|
*/
|
27
|
-
static findUniqueOrThrow(id: string): Promise<Token["model"]
|
27
|
+
static findUniqueOrThrow(id: string): Promise<Token["model"]>;
|
28
28
|
/**
|
29
29
|
* Read token from database by its symbol
|
30
30
|
* @param symbol
|
@@ -109,7 +109,7 @@ export declare abstract class TokenService {
|
|
109
109
|
* @param chainId
|
110
110
|
* @param address
|
111
111
|
*/
|
112
|
-
static findUniqueOrThrow(token: TokenUnique): Promise<
|
112
|
+
static findUniqueOrThrow(token: TokenUnique): Promise<{
|
113
113
|
symbol: string;
|
114
114
|
name: string | null;
|
115
115
|
id: string;
|
@@ -120,7 +120,7 @@ export declare abstract class TokenService {
|
|
120
120
|
verified: boolean;
|
121
121
|
} & {
|
122
122
|
price?: number | null | undefined;
|
123
|
-
}
|
123
|
+
}>;
|
124
124
|
/**
|
125
125
|
* Get the list of tokens satisfying the query
|
126
126
|
* @param query
|