@merkl/api 0.10.306 → 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/database/api/.generated/edge.js +9 -3
- package/dist/database/api/.generated/index-browser.js +6 -0
- package/dist/database/api/.generated/index.d.ts +156 -0
- package/dist/database/api/.generated/index.js +9 -3
- package/dist/database/api/.generated/package.json +1 -1
- package/dist/database/api/.generated/schema.prisma +3 -0
- package/dist/database/api/.generated/wasm.js +6 -0
- package/dist/src/eden/index.d.ts +107 -86
- package/dist/src/index.d.ts +35 -28
- package/dist/src/modules/v4/reward/reward.controller.d.ts +35 -28
- package/dist/src/modules/v4/reward/reward.controller.js +66 -60
- package/dist/src/modules/v4/reward/reward.model.d.ts +9 -1
- package/dist/src/modules/v4/reward/reward.model.js +3 -0
- package/dist/src/modules/v4/reward/reward.repository.d.ts +38 -24
- package/dist/src/modules/v4/reward/reward.repository.js +54 -65
- package/dist/src/modules/v4/reward/reward.service.d.ts +9 -3
- package/dist/src/modules/v4/reward/reward.service.js +43 -6
- package/dist/src/modules/v4/router.d.ts +35 -28
- 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,23 +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
|
-
|
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
|
+
};
|
1182
1189
|
breakdowns: {
|
1183
1190
|
post: (body: {
|
1184
1191
|
distributionChainId: number;
|
@@ -4178,18 +4185,20 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
4178
4185
|
};
|
4179
4186
|
} & {
|
4180
4187
|
token: {
|
4181
|
-
|
4182
|
-
|
4183
|
-
|
4184
|
-
|
4185
|
-
|
4186
|
-
|
4187
|
-
|
4188
|
-
|
4189
|
-
|
4190
|
-
|
4191
|
-
|
4192
|
-
|
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
|
+
};
|
4193
4202
|
};
|
4194
4203
|
};
|
4195
4204
|
};
|
@@ -4238,22 +4247,27 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
4238
4247
|
};
|
4239
4248
|
} & {
|
4240
4249
|
engine: {
|
4241
|
-
|
4242
|
-
|
4243
|
-
|
4244
|
-
|
4245
|
-
|
4246
|
-
|
4247
|
-
|
4248
|
-
|
4249
|
-
|
4250
|
-
|
4251
|
-
|
4252
|
-
|
4253
|
-
|
4254
|
-
|
4255
|
-
|
4256
|
-
|
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
|
+
};
|
4257
4271
|
};
|
4258
4272
|
};
|
4259
4273
|
};
|
@@ -7586,18 +7600,20 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
7586
7600
|
};
|
7587
7601
|
};
|
7588
7602
|
token: {
|
7589
|
-
|
7590
|
-
|
7591
|
-
|
7592
|
-
|
7593
|
-
|
7594
|
-
|
7595
|
-
|
7596
|
-
|
7597
|
-
|
7598
|
-
|
7599
|
-
|
7600
|
-
|
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
|
+
};
|
7601
7617
|
total: {
|
7602
7618
|
get: (options: {
|
7603
7619
|
headers?: Record<string, unknown> | undefined;
|
@@ -7633,23 +7649,28 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
7633
7649
|
};
|
7634
7650
|
};
|
7635
7651
|
engine: {
|
7636
|
-
|
7637
|
-
|
7638
|
-
|
7639
|
-
|
7640
|
-
|
7641
|
-
|
7642
|
-
|
7643
|
-
|
7644
|
-
|
7645
|
-
|
7646
|
-
|
7647
|
-
|
7648
|
-
|
7649
|
-
|
7650
|
-
|
7651
|
-
|
7652
|
-
|
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
|
+
};
|
7653
7674
|
breakdowns: {
|
7654
7675
|
post: (body: {
|
7655
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,22 +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
|
-
|
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
|
+
};
|
1391
1398
|
};
|
1392
1399
|
};
|
1393
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,22 +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
|
-
|
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
|
+
};
|
149
156
|
};
|
150
157
|
};
|
151
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(), {
|
@@ -99,6 +99,9 @@ declare const RewardDto: import("@sinclair/typebox").TObject<{
|
|
99
99
|
recipient: import("@sinclair/typebox").TString;
|
100
100
|
distributionChainId: import("@sinclair/typebox").TNumber;
|
101
101
|
rewardToken: import("@sinclair/typebox").TString;
|
102
|
+
amount: import("@sinclair/typebox").TString;
|
103
|
+
claimed: import("@sinclair/typebox").TString;
|
104
|
+
pending: import("@sinclair/typebox").TString;
|
102
105
|
proofs: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
103
106
|
}>;
|
104
107
|
export declare const CreateManyRewardDto: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
@@ -106,6 +109,9 @@ export declare const CreateManyRewardDto: import("@sinclair/typebox").TArray<imp
|
|
106
109
|
recipient: import("@sinclair/typebox").TString;
|
107
110
|
distributionChainId: import("@sinclair/typebox").TNumber;
|
108
111
|
rewardToken: import("@sinclair/typebox").TString;
|
112
|
+
amount: import("@sinclair/typebox").TString;
|
113
|
+
claimed: import("@sinclair/typebox").TString;
|
114
|
+
pending: import("@sinclair/typebox").TString;
|
109
115
|
proofs: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
110
116
|
}>>;
|
111
117
|
export declare const RegisterClaimsDto: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
@@ -223,11 +229,13 @@ export type CampaignIdModel = typeof CampaignIdDto.static;
|
|
223
229
|
export type TokenIdModel = typeof TokenIdDto.static;
|
224
230
|
export type UserRewardV3Model = typeof UserRewardV3Dto.static;
|
225
231
|
export type RewardV3Model = typeof RewardV3Dto.static;
|
226
|
-
export type
|
232
|
+
export type BreakdownForTokenRaw = {
|
227
233
|
amount: string;
|
228
234
|
pending: string;
|
229
235
|
claimed: string;
|
230
236
|
recipient: string;
|
237
|
+
};
|
238
|
+
export type BreakdownForCampaignsRaw = BreakdownForTokenRaw & {
|
231
239
|
campaignId: string;
|
232
240
|
reason: string;
|
233
241
|
rewardTokenAddress: string;
|
@@ -37,6 +37,9 @@ const RewardDto = t.Object({
|
|
37
37
|
recipient: t.String(),
|
38
38
|
distributionChainId: t.Number(),
|
39
39
|
rewardToken: t.String(),
|
40
|
+
amount: t.String(),
|
41
|
+
claimed: t.String(),
|
42
|
+
pending: t.String(),
|
40
43
|
proofs: t.Array(t.String()),
|
41
44
|
});
|
42
45
|
export const CreateManyRewardDto = t.Array(RewardDto);
|