@merkl/api 0.10.307 → 0.10.308
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 +107 -95
- package/dist/src/index.d.ts +35 -31
- package/dist/src/modules/v4/reward/reward.controller.d.ts +35 -31
- package/dist/src/modules/v4/reward/reward.controller.js +66 -60
- package/dist/src/modules/v4/reward/reward.model.d.ts +3 -1
- package/dist/src/modules/v4/reward/reward.repository.d.ts +2 -2
- package/dist/src/modules/v4/reward/reward.repository.js +11 -23
- package/dist/src/modules/v4/reward/reward.service.d.ts +1 -1
- package/dist/src/modules/v4/router.d.ts +35 -31
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/src/eden/index.d.ts
CHANGED
@@ -1115,18 +1115,20 @@ declare const eden: {
|
|
1115
1115
|
};
|
1116
1116
|
};
|
1117
1117
|
token: {
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1118
|
+
index: {
|
1119
|
+
get: (options: {
|
1120
|
+
headers?: Record<string, unknown> | undefined;
|
1121
|
+
query: {
|
1122
|
+
items?: number | undefined;
|
1123
|
+
page?: number | undefined;
|
1124
|
+
chainId: number;
|
1125
|
+
address: string;
|
1126
|
+
};
|
1127
|
+
fetch?: RequestInit | undefined;
|
1128
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
1129
|
+
200: import("../modules/v4/reward").BreakdownForTokenRaw[];
|
1130
|
+
}>>;
|
1131
|
+
};
|
1130
1132
|
total: {
|
1131
1133
|
get: (options: {
|
1132
1134
|
headers?: Record<string, unknown> | undefined;
|
@@ -1162,26 +1164,28 @@ declare const eden: {
|
|
1162
1164
|
};
|
1163
1165
|
};
|
1164
1166
|
engine: {
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1167
|
+
index: {
|
1168
|
+
post: (body: {
|
1169
|
+
pending: string;
|
1170
|
+
recipient: string;
|
1171
|
+
distributionChainId: number;
|
1172
|
+
amount: string;
|
1173
|
+
root: string;
|
1174
|
+
claimed: string;
|
1175
|
+
proofs: string[];
|
1176
|
+
rewardToken: string;
|
1177
|
+
}[], options: {
|
1178
|
+
headers: {
|
1179
|
+
authorization: string;
|
1180
|
+
};
|
1181
|
+
query?: Record<string, unknown> | undefined;
|
1182
|
+
fetch?: RequestInit | undefined;
|
1183
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
1184
|
+
200: {
|
1185
|
+
count: number;
|
1186
|
+
};
|
1187
|
+
}>>;
|
1188
|
+
};
|
1185
1189
|
breakdowns: {
|
1186
1190
|
post: (body: {
|
1187
1191
|
distributionChainId: number;
|
@@ -4181,18 +4185,20 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
4181
4185
|
};
|
4182
4186
|
} & {
|
4183
4187
|
token: {
|
4184
|
-
|
4185
|
-
|
4186
|
-
|
4187
|
-
|
4188
|
-
|
4189
|
-
|
4190
|
-
|
4191
|
-
|
4192
|
-
|
4193
|
-
|
4194
|
-
|
4195
|
-
|
4188
|
+
index: {
|
4189
|
+
get: {
|
4190
|
+
body: unknown;
|
4191
|
+
params: {};
|
4192
|
+
query: {
|
4193
|
+
items?: number | undefined;
|
4194
|
+
page?: number | undefined;
|
4195
|
+
chainId: number;
|
4196
|
+
address: string;
|
4197
|
+
};
|
4198
|
+
headers: unknown;
|
4199
|
+
response: {
|
4200
|
+
200: import("../modules/v4/reward").BreakdownForTokenRaw[];
|
4201
|
+
};
|
4196
4202
|
};
|
4197
4203
|
};
|
4198
4204
|
};
|
@@ -4241,25 +4247,27 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
4241
4247
|
};
|
4242
4248
|
} & {
|
4243
4249
|
engine: {
|
4244
|
-
|
4245
|
-
|
4246
|
-
|
4247
|
-
|
4248
|
-
|
4249
|
-
|
4250
|
-
|
4251
|
-
|
4252
|
-
|
4253
|
-
|
4254
|
-
|
4255
|
-
|
4256
|
-
|
4257
|
-
|
4258
|
-
|
4259
|
-
|
4260
|
-
|
4261
|
-
|
4262
|
-
|
4250
|
+
index: {
|
4251
|
+
post: {
|
4252
|
+
body: {
|
4253
|
+
pending: string;
|
4254
|
+
recipient: string;
|
4255
|
+
distributionChainId: number;
|
4256
|
+
amount: string;
|
4257
|
+
root: string;
|
4258
|
+
claimed: string;
|
4259
|
+
proofs: string[];
|
4260
|
+
rewardToken: string;
|
4261
|
+
}[];
|
4262
|
+
params: {};
|
4263
|
+
query: unknown;
|
4264
|
+
headers: {
|
4265
|
+
authorization: string;
|
4266
|
+
};
|
4267
|
+
response: {
|
4268
|
+
200: {
|
4269
|
+
count: number;
|
4270
|
+
};
|
4263
4271
|
};
|
4264
4272
|
};
|
4265
4273
|
};
|
@@ -7592,18 +7600,20 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
7592
7600
|
};
|
7593
7601
|
};
|
7594
7602
|
token: {
|
7595
|
-
|
7596
|
-
|
7597
|
-
|
7598
|
-
|
7599
|
-
|
7600
|
-
|
7601
|
-
|
7602
|
-
|
7603
|
-
|
7604
|
-
|
7605
|
-
|
7606
|
-
|
7603
|
+
index: {
|
7604
|
+
get: (options: {
|
7605
|
+
headers?: Record<string, unknown> | undefined;
|
7606
|
+
query: {
|
7607
|
+
items?: number | undefined;
|
7608
|
+
page?: number | undefined;
|
7609
|
+
chainId: number;
|
7610
|
+
address: string;
|
7611
|
+
};
|
7612
|
+
fetch?: RequestInit | undefined;
|
7613
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
7614
|
+
200: import("../modules/v4/reward").BreakdownForTokenRaw[];
|
7615
|
+
}>>;
|
7616
|
+
};
|
7607
7617
|
total: {
|
7608
7618
|
get: (options: {
|
7609
7619
|
headers?: Record<string, unknown> | undefined;
|
@@ -7639,26 +7649,28 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
7639
7649
|
};
|
7640
7650
|
};
|
7641
7651
|
engine: {
|
7642
|
-
|
7643
|
-
|
7644
|
-
|
7645
|
-
|
7646
|
-
|
7647
|
-
|
7648
|
-
|
7649
|
-
|
7650
|
-
|
7651
|
-
|
7652
|
-
|
7653
|
-
|
7654
|
-
|
7655
|
-
|
7656
|
-
|
7657
|
-
|
7658
|
-
|
7659
|
-
|
7660
|
-
|
7661
|
-
|
7652
|
+
index: {
|
7653
|
+
post: (body: {
|
7654
|
+
pending: string;
|
7655
|
+
recipient: string;
|
7656
|
+
distributionChainId: number;
|
7657
|
+
amount: string;
|
7658
|
+
root: string;
|
7659
|
+
claimed: string;
|
7660
|
+
proofs: string[];
|
7661
|
+
rewardToken: string;
|
7662
|
+
}[], options: {
|
7663
|
+
headers: {
|
7664
|
+
authorization: string;
|
7665
|
+
};
|
7666
|
+
query?: Record<string, unknown> | undefined;
|
7667
|
+
fetch?: RequestInit | undefined;
|
7668
|
+
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
7669
|
+
200: {
|
7670
|
+
count: number;
|
7671
|
+
};
|
7672
|
+
}>>;
|
7673
|
+
};
|
7662
7674
|
breakdowns: {
|
7663
7675
|
post: (body: {
|
7664
7676
|
distributionChainId: number;
|
package/dist/src/index.d.ts
CHANGED
@@ -1312,18 +1312,20 @@ declare const app: Elysia<"", false, {
|
|
1312
1312
|
};
|
1313
1313
|
} & {
|
1314
1314
|
token: {
|
1315
|
-
|
1316
|
-
|
1317
|
-
|
1318
|
-
|
1319
|
-
|
1320
|
-
|
1321
|
-
|
1322
|
-
|
1323
|
-
|
1324
|
-
|
1325
|
-
|
1326
|
-
|
1315
|
+
index: {
|
1316
|
+
get: {
|
1317
|
+
body: unknown;
|
1318
|
+
params: {};
|
1319
|
+
query: {
|
1320
|
+
items?: number | undefined;
|
1321
|
+
page?: number | undefined;
|
1322
|
+
chainId: number;
|
1323
|
+
address: string;
|
1324
|
+
};
|
1325
|
+
headers: unknown;
|
1326
|
+
response: {
|
1327
|
+
200: import("./modules/v4/reward").BreakdownForTokenRaw[];
|
1328
|
+
};
|
1327
1329
|
};
|
1328
1330
|
};
|
1329
1331
|
};
|
@@ -1372,25 +1374,27 @@ declare const app: Elysia<"", false, {
|
|
1372
1374
|
};
|
1373
1375
|
} & {
|
1374
1376
|
engine: {
|
1375
|
-
|
1376
|
-
|
1377
|
-
|
1378
|
-
|
1379
|
-
|
1380
|
-
|
1381
|
-
|
1382
|
-
|
1383
|
-
|
1384
|
-
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
1388
|
-
|
1389
|
-
|
1390
|
-
|
1391
|
-
|
1392
|
-
|
1393
|
-
|
1377
|
+
index: {
|
1378
|
+
post: {
|
1379
|
+
body: {
|
1380
|
+
pending: string;
|
1381
|
+
recipient: string;
|
1382
|
+
distributionChainId: number;
|
1383
|
+
amount: string;
|
1384
|
+
root: string;
|
1385
|
+
claimed: string;
|
1386
|
+
proofs: string[];
|
1387
|
+
rewardToken: string;
|
1388
|
+
}[];
|
1389
|
+
params: {};
|
1390
|
+
query: unknown;
|
1391
|
+
headers: {
|
1392
|
+
authorization: string;
|
1393
|
+
};
|
1394
|
+
response: {
|
1395
|
+
200: {
|
1396
|
+
count: number;
|
1397
|
+
};
|
1394
1398
|
};
|
1395
1399
|
};
|
1396
1400
|
};
|
@@ -70,18 +70,20 @@ export declare const RewardController: Elysia<"/rewards", false, {
|
|
70
70
|
};
|
71
71
|
} & {
|
72
72
|
token: {
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
73
|
+
index: {
|
74
|
+
get: {
|
75
|
+
body: unknown;
|
76
|
+
params: {};
|
77
|
+
query: {
|
78
|
+
items?: number | undefined;
|
79
|
+
page?: number | undefined;
|
80
|
+
chainId: number;
|
81
|
+
address: string;
|
82
|
+
};
|
83
|
+
headers: unknown;
|
84
|
+
response: {
|
85
|
+
200: import("./reward.model").BreakdownForTokenRaw[];
|
86
|
+
};
|
85
87
|
};
|
86
88
|
};
|
87
89
|
};
|
@@ -130,25 +132,27 @@ export declare const RewardController: Elysia<"/rewards", false, {
|
|
130
132
|
};
|
131
133
|
} & {
|
132
134
|
engine: {
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
135
|
+
index: {
|
136
|
+
post: {
|
137
|
+
body: {
|
138
|
+
pending: string;
|
139
|
+
recipient: string;
|
140
|
+
distributionChainId: number;
|
141
|
+
amount: string;
|
142
|
+
root: string;
|
143
|
+
claimed: string;
|
144
|
+
proofs: string[];
|
145
|
+
rewardToken: string;
|
146
|
+
}[];
|
147
|
+
params: {};
|
148
|
+
query: unknown;
|
149
|
+
headers: {
|
150
|
+
authorization: string;
|
151
|
+
};
|
152
|
+
response: {
|
153
|
+
200: {
|
154
|
+
count: number;
|
155
|
+
};
|
152
156
|
};
|
153
157
|
};
|
154
158
|
};
|
@@ -32,67 +32,73 @@ export const RewardController = new Elysia({ prefix: "/rewards", detail: { tags:
|
|
32
32
|
},
|
33
33
|
detail: { hide: true },
|
34
34
|
})
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
query
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
}
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
query
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
}
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
query
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
}
|
62
|
-
|
63
|
-
|
64
|
-
headers: AuthorizationHeadersDto,
|
65
|
-
body: CreateManyRewardDto,
|
66
|
-
beforeHandle: EngineGuard,
|
67
|
-
detail: { hide: true },
|
68
|
-
})
|
69
|
-
// ─── Create Many Reward Breakdowns ───────────────────────────────────
|
70
|
-
.post("/engine/breakdowns", async ({ body }) => await RewardService.createManyBreakdown(body), {
|
71
|
-
headers: AuthorizationHeadersDto,
|
72
|
-
body: CreateManyBreakdownDto,
|
73
|
-
beforeHandle: EngineGuard,
|
74
|
-
detail: { hide: true },
|
75
|
-
})
|
76
|
-
// ─── Register new claims ──────────────────────────────────────────────
|
77
|
-
.post("/engine/claims", async ({ body }) => await RewardService.registerClaims(body), {
|
78
|
-
headers: AuthorizationHeadersDto,
|
79
|
-
body: RegisterClaimsDto,
|
80
|
-
beforeHandle: ({ headers, body }) => {
|
81
|
-
EngineGuard({ headers });
|
82
|
-
for (const claim of body) {
|
83
|
-
throwOnUnsupportedChainId(claim.chainId);
|
84
|
-
claim.token = throwOnInvalidRequiredAddress(claim.token);
|
85
|
-
claim.recipient = throwOnInvalidRequiredAddress(claim.recipient);
|
86
|
-
}
|
87
|
-
},
|
88
|
-
detail: { hide: true },
|
35
|
+
.group("/token", app => {
|
36
|
+
return (app
|
37
|
+
// ─── Get Reward Breakdowns For Token ───────────────────────────────
|
38
|
+
.get("/", async ({ query }) => await RewardService.breakdownForToken(query), {
|
39
|
+
query: TokenIdDto,
|
40
|
+
beforeHandle: ({ query }) => {
|
41
|
+
query.address = throwOnInvalidRequiredAddress(query.address);
|
42
|
+
throwOnUnsupportedChainId(query.chainId);
|
43
|
+
},
|
44
|
+
detail: { hide: true },
|
45
|
+
})
|
46
|
+
// ─── Get Total Amount Rewarded For Token ───────────────────────────
|
47
|
+
.get("/total", async ({ query }) => await RewardService.totalForToken(query), {
|
48
|
+
query: TokenIdDto,
|
49
|
+
beforeHandle: ({ query }) => {
|
50
|
+
query.address = throwOnInvalidRequiredAddress(query.address);
|
51
|
+
throwOnUnsupportedChainId(query.chainId);
|
52
|
+
},
|
53
|
+
detail: { hide: true },
|
54
|
+
})
|
55
|
+
// ─── Get Reward Count By Chain And Root For Token ───────────────────
|
56
|
+
.get("/count", async ({ query }) => await RewardService.countForToken(query), {
|
57
|
+
query: TokenIdDto,
|
58
|
+
beforeHandle: ({ query }) => {
|
59
|
+
query.address = throwOnInvalidRequiredAddress(query.address);
|
60
|
+
throwOnUnsupportedChainId(query.chainId);
|
61
|
+
},
|
62
|
+
detail: { hide: true },
|
63
|
+
}));
|
89
64
|
})
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
65
|
+
.group("/engine", app => {
|
66
|
+
return (app
|
67
|
+
// ─── Create Many Rewards ─────────────────────────────────────────────
|
68
|
+
.post("/", async ({ body }) => await RewardService.createManyReward(body), {
|
69
|
+
headers: AuthorizationHeadersDto,
|
70
|
+
body: CreateManyRewardDto,
|
71
|
+
beforeHandle: EngineGuard,
|
72
|
+
detail: { hide: true },
|
73
|
+
})
|
74
|
+
// ─── Create Many Reward Breakdowns ───────────────────────────────────
|
75
|
+
.post("/breakdowns", async ({ body }) => await RewardService.createManyBreakdown(body), {
|
76
|
+
headers: AuthorizationHeadersDto,
|
77
|
+
body: CreateManyBreakdownDto,
|
78
|
+
beforeHandle: EngineGuard,
|
79
|
+
detail: { hide: true },
|
80
|
+
})
|
81
|
+
// ─── Register new claims ──────────────────────────────────────────────
|
82
|
+
.post("/claims", async ({ body }) => await RewardService.registerClaims(body), {
|
83
|
+
headers: AuthorizationHeadersDto,
|
84
|
+
body: RegisterClaimsDto,
|
85
|
+
beforeHandle: ({ headers, body }) => {
|
86
|
+
EngineGuard({ headers });
|
87
|
+
for (const claim of body) {
|
88
|
+
throwOnUnsupportedChainId(claim.chainId);
|
89
|
+
claim.token = throwOnInvalidRequiredAddress(claim.token);
|
90
|
+
claim.recipient = throwOnInvalidRequiredAddress(claim.recipient);
|
91
|
+
}
|
92
|
+
},
|
93
|
+
detail: { hide: true },
|
94
|
+
})
|
95
|
+
// ─── Create Many Pending Rewards ─────────────────────────────────────
|
96
|
+
.post("/pendings", async ({ body }) => await RewardService.updatePendings(body), {
|
97
|
+
headers: AuthorizationHeadersDto,
|
98
|
+
body: UpdatePendingDto,
|
99
|
+
beforeHandle: EngineGuard,
|
100
|
+
detail: { hide: true },
|
101
|
+
}));
|
96
102
|
})
|
97
103
|
// ─── Get Reward Count By Chain And Root ──────────────────────────────
|
98
104
|
.get("/count/chains", async () => await RewardService.countAllchains(), {
|
@@ -229,11 +229,13 @@ export type CampaignIdModel = typeof CampaignIdDto.static;
|
|
229
229
|
export type TokenIdModel = typeof TokenIdDto.static;
|
230
230
|
export type UserRewardV3Model = typeof UserRewardV3Dto.static;
|
231
231
|
export type RewardV3Model = typeof RewardV3Dto.static;
|
232
|
-
export type
|
232
|
+
export type BreakdownForTokenRaw = {
|
233
233
|
amount: string;
|
234
234
|
pending: string;
|
235
235
|
claimed: string;
|
236
236
|
recipient: string;
|
237
|
+
};
|
238
|
+
export type BreakdownForCampaignsRaw = BreakdownForTokenRaw & {
|
237
239
|
campaignId: string;
|
238
240
|
reason: string;
|
239
241
|
rewardTokenAddress: string;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { Prisma } from "../../../../database/api/.generated";
|
2
2
|
import type { ChainId } from "@sdk";
|
3
|
-
import type { BreakdownForCampaignsRaw, CampaignIdModel, CampaignIdWithoutPageModel, CreateManyBreakdownModel, CreateManyRewardModel, PendingEntity, TokenIdModel } from "./reward.model";
|
3
|
+
import type { BreakdownForCampaignsRaw, BreakdownForTokenRaw, CampaignIdModel, CampaignIdWithoutPageModel, CreateManyBreakdownModel, CreateManyRewardModel, PendingEntity, TokenIdModel } from "./reward.model";
|
4
4
|
export declare abstract class RewardRepository {
|
5
5
|
static createManyReward(rewards: CreateManyRewardModel): Promise<Prisma.BatchPayload>;
|
6
6
|
static createManyBreakdown(data: CreateManyBreakdownModel): Promise<Prisma.BatchPayload>;
|
@@ -201,7 +201,7 @@ export declare abstract class RewardRepository {
|
|
201
201
|
static countForCampaign(campaignId: string, root: string): Promise<{
|
202
202
|
count: number;
|
203
203
|
}>;
|
204
|
-
static breakdownForToken(root: string, id: string, query: TokenIdModel): Promise<
|
204
|
+
static breakdownForToken(root: string, id: string, query: TokenIdModel): Promise<BreakdownForTokenRaw[]>;
|
205
205
|
static totalForToken(tokenId: string, root: string): Promise<{
|
206
206
|
tokenId: string;
|
207
207
|
amount: bigint;
|
@@ -314,40 +314,30 @@ export class RewardRepository {
|
|
314
314
|
const items = _items || 50;
|
315
315
|
const result = await apiDbClient.$queryRawUnsafe(`
|
316
316
|
SELECT
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
rb."pending",
|
317
|
+
r."amount",
|
318
|
+
r."claimed",
|
319
|
+
r."pending",
|
321
320
|
r."recipient",
|
322
|
-
r."campaignId",
|
323
|
-
t."address" as "rewardTokenAddress"
|
324
321
|
FROM
|
325
|
-
"
|
326
|
-
INNER JOIN
|
327
|
-
"Reward" r ON rb."rewardId" = r."id"
|
328
|
-
INNER JOIN
|
329
|
-
"Token" t ON r."rewardTokenId" = t."id"
|
322
|
+
"Reward" r
|
330
323
|
WHERE
|
331
324
|
r."root" = $1 AND r."rewardTokenId" = $2
|
332
325
|
ORDER BY
|
333
|
-
(
|
326
|
+
(r."amount"::numeric + r."pending"::numeric) DESC
|
334
327
|
LIMIT $3
|
335
328
|
OFFSET $4
|
336
329
|
`, root, id, items, items * page);
|
337
330
|
return result;
|
338
331
|
}
|
339
332
|
static async totalForToken(tokenId, root) {
|
340
|
-
const totalAmount = await apiDbClient.
|
333
|
+
const totalAmount = await apiDbClient.reward.findMany({
|
341
334
|
where: {
|
342
|
-
|
343
|
-
|
344
|
-
root,
|
345
|
-
},
|
335
|
+
rewardTokenId: tokenId,
|
336
|
+
root,
|
346
337
|
},
|
347
338
|
select: {
|
348
339
|
amount: true,
|
349
340
|
pending: true,
|
350
|
-
campaignId: true,
|
351
341
|
},
|
352
342
|
});
|
353
343
|
const reducedData = totalAmount.reduce((acc, { amount, pending }) => {
|
@@ -357,12 +347,10 @@ export class RewardRepository {
|
|
357
347
|
return reducedData;
|
358
348
|
}
|
359
349
|
static async countForToken(tokenId, root) {
|
360
|
-
const count = await apiDbClient.
|
350
|
+
const count = await apiDbClient.reward.count({
|
361
351
|
where: {
|
362
|
-
|
363
|
-
|
364
|
-
root,
|
365
|
-
},
|
352
|
+
rewardTokenId: tokenId,
|
353
|
+
root,
|
366
354
|
},
|
367
355
|
});
|
368
356
|
return { count };
|