@merkl/api 0.21.23 → 0.21.25
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 +36 -36
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/implementations/processorMapping.js +2 -0
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/subtypesRound1.js +4 -0
- package/dist/src/engine/deprecated/erc20SubTypeProcessors/tokenTypeToProtocolAndAction.js +2 -0
- package/dist/src/engine/implementations/Erc20/subTypes/index.d.ts +2 -0
- package/dist/src/engine/implementations/Erc20/subTypes/index.js +2 -0
- package/dist/src/engine/implementations/JsonAirdrop/metadata.d.ts +2 -2
- package/dist/src/index.d.ts +12 -12
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +1 -1
- package/dist/src/modules/v4/campaign/campaign.service.d.ts +1 -1
- package/dist/src/modules/v4/campaign/campaign.test.controller.d.ts +2 -2
- package/dist/src/modules/v4/chain/chain.model.d.ts +1 -1
- package/dist/src/modules/v4/chain/chain.model.js +1 -4
- package/dist/src/modules/v4/claims/claims.controller.d.ts +1 -1
- package/dist/src/modules/v4/claims/claims.controller.js +4 -3
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +2 -2
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +3 -3
- package/dist/src/modules/v4/programPayload/programPayload.repository.d.ts +132 -9
- package/dist/src/modules/v4/programPayload/programPayload.repository.js +215 -50
- package/dist/src/modules/v4/protocol/protocol.model.d.ts +1 -1
- package/dist/src/modules/v4/protocol/protocol.model.js +1 -0
- package/dist/src/modules/v4/reward/reward.controller.d.ts +3 -3
- package/dist/src/modules/v4/reward/reward.controller.js +1 -0
- package/dist/src/modules/v4/reward/reward.model.d.ts +1 -8
- package/dist/src/modules/v4/reward/reward.model.js +1 -13
- package/dist/src/modules/v4/router.d.ts +11 -11
- package/dist/src/modules/v4/user/user.controller.d.ts +2 -2
- package/dist/src/modules/v4/user/user.controller.js +8 -11
- package/dist/src/modules/v4/user/user.model.d.ts +2 -2
- package/dist/src/modules/v4/user/user.model.js +2 -8
- package/dist/src/routes/v3/campaigns.d.ts +1 -1
- package/dist/src/routes/v3/router.d.ts +1 -1
- package/dist/src/utils/decodeCalls.js +2 -0
- package/dist/src/utils/encodeCalls.js +2 -0
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
@@ -7,20 +7,16 @@ import { UserService } from "./user.service";
|
|
7
7
|
export const UserController = new Elysia({ prefix: "/users", detail: { tags: ["Users"] } })
|
8
8
|
// ─── Get User's Rewards With Breakdown ──────────────────────────────
|
9
9
|
.get("/:address/rewards", async ({ params, query }) => {
|
10
|
-
const rewardsByChain = await RewardService.getUserRewardsByChain(params.address, false,
|
10
|
+
const rewardsByChain = await RewardService.getUserRewardsByChain(params.address, false, query.chainId.map(Number), !!query.reloadChainId ? query.reloadChainId : null, !!query.test ? query.test : false, !!query.claimableOnly);
|
11
11
|
return RewardService.removeOpportunityFromRewardBreakdown(rewardsByChain);
|
12
12
|
}, {
|
13
13
|
params: UserUniqueDto,
|
14
14
|
query: UserRewardRouteDto,
|
15
15
|
beforeHandle: ({ query, params }) => {
|
16
16
|
params.address = throwOnInvalidRequiredAddress(params.address);
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
else {
|
21
|
-
for (const chainId of query.chainId) {
|
22
|
-
throwOnUnsupportedChainId(chainId);
|
23
|
-
}
|
17
|
+
query.chainId = query.chainId.flatMap(x => x.split(","));
|
18
|
+
for (const chainId of query.chainId) {
|
19
|
+
throwOnUnsupportedChainId(Number(chainId));
|
24
20
|
}
|
25
21
|
if (!!query.reloadChainId)
|
26
22
|
throwOnUnsupportedChainId(query.reloadChainId);
|
@@ -42,7 +38,7 @@ export const UserController = new Elysia({ prefix: "/users", detail: { tags: ["U
|
|
42
38
|
.get("/:address", async ({ params }) => await UserService.findUniqueOrThrow(params.address))
|
43
39
|
// ─── Get User's Rewards With Breakdown And Details for our FE ────────
|
44
40
|
.get("/:address/rewards/breakdowns", async ({ params, query }) => {
|
45
|
-
const rewardsByChain = await RewardService.getUserRewardsByChain(params.address, true, query?.chainIds, query.reloadChainId ?? null, !!query.test ? query.test : false, !!query.claimableOnly);
|
41
|
+
const rewardsByChain = await RewardService.getUserRewardsByChain(params.address, true, query?.chainIds?.map(Number), query.reloadChainId ?? null, !!query.test ? query.test : false, !!query.claimableOnly);
|
46
42
|
return RewardService.splitRewardsBreakdownByOpportunity(rewardsByChain);
|
47
43
|
}, {
|
48
44
|
params: UserUniqueDto,
|
@@ -51,8 +47,9 @@ export const UserController = new Elysia({ prefix: "/users", detail: { tags: ["U
|
|
51
47
|
params.address = throwOnInvalidRequiredAddress(params.address);
|
52
48
|
if (!!query.reloadChainId)
|
53
49
|
throwOnUnsupportedChainId(query.reloadChainId);
|
54
|
-
|
55
|
-
|
50
|
+
query.chainIds = query.chainIds.flatMap(x => x.split(","));
|
51
|
+
for (const chainId of query.chainIds) {
|
52
|
+
throwOnUnsupportedChainId(Number(chainId));
|
56
53
|
}
|
57
54
|
},
|
58
55
|
})
|
@@ -7,7 +7,7 @@ import type { Resource } from "@/modules/v4/prisma";
|
|
7
7
|
export type User = Resource<"User">;
|
8
8
|
export type Creator = Resource<"Creator">;
|
9
9
|
export declare const UserRewardRouteDto: import("@sinclair/typebox").TObject<{
|
10
|
-
chainId: import("@sinclair/typebox").
|
10
|
+
chainId: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
11
11
|
reloadChainId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
12
12
|
test: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
13
13
|
claimableOnly: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
@@ -44,7 +44,7 @@ export declare const UserUniqueDto: import("@sinclair/typebox").TObject<{
|
|
44
44
|
address: import("@sinclair/typebox").TString;
|
45
45
|
}>;
|
46
46
|
export declare const OptionalChainIdDto: import("@sinclair/typebox").TObject<{
|
47
|
-
chainIds: import("@sinclair/typebox").
|
47
|
+
chainIds: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
48
48
|
reloadChainId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
49
49
|
test: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
50
50
|
claimableOnly: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
@@ -2,10 +2,7 @@ import { ChainResourceDto } from "@/modules/v4/chain/chain.model";
|
|
2
2
|
import { t } from "elysia";
|
3
3
|
// ─── Dtos ────────────────────────────────────────────────────────────────────
|
4
4
|
export const UserRewardRouteDto = t.Object({
|
5
|
-
chainId: t
|
6
|
-
.Transform(t.Union([t.String(), t.Array(t.Numeric())]))
|
7
|
-
.Decode(value => (typeof value === "string" ? value.split(",").map(v => Number.parseInt(v)) : value))
|
8
|
-
.Encode(value => [...value]),
|
5
|
+
chainId: t.Array(t.String()),
|
9
6
|
reloadChainId: t.Optional(t.Numeric({
|
10
7
|
description: "An optional chainId to bypass the cache and check if there was very recently a claim on this chain",
|
11
8
|
})),
|
@@ -42,10 +39,7 @@ export const UserUniqueDto = t.Object({
|
|
42
39
|
address: t.String(),
|
43
40
|
});
|
44
41
|
export const OptionalChainIdDto = t.Object({
|
45
|
-
chainIds: t.
|
46
|
-
.Transform(t.Union([t.String(), t.Array(t.Numeric())]))
|
47
|
-
.Decode(value => (typeof value === "string" ? value.split(",").map(v => Number.parseInt(v)) : value))
|
48
|
-
.Encode(value => [...value])),
|
42
|
+
chainIds: t.Array(t.String()),
|
49
43
|
reloadChainId: t.Optional(t.Numeric()),
|
50
44
|
test: t.Optional(t.Boolean({ description: "Include test token rewards" })),
|
51
45
|
claimableOnly: t.Optional(t.Boolean({ description: "Include only claimable rewards (to avoid transferring zero amounts)" })),
|
@@ -33,7 +33,7 @@ declare const _default: (app: Elysia) => Elysia<"", false, {
|
|
33
33
|
body: unknown;
|
34
34
|
params: {};
|
35
35
|
query: {
|
36
|
-
types?: string | number |
|
36
|
+
types?: string | number | string[] | number[] | undefined;
|
37
37
|
chainIds?: string | string[] | undefined;
|
38
38
|
creatorTag?: string | undefined;
|
39
39
|
live?: boolean | undefined;
|
@@ -74,7 +74,7 @@ export declare const v3: Elysia<"/v3", false, {
|
|
74
74
|
body: unknown;
|
75
75
|
params: {};
|
76
76
|
query: {
|
77
|
-
types?: string | number |
|
77
|
+
types?: string | number | string[] | number[] | undefined;
|
78
78
|
chainIds?: string | string[] | undefined;
|
79
79
|
creatorTag?: string | undefined;
|
80
80
|
live?: boolean | undefined;
|
@@ -102,6 +102,8 @@ export function decodeReturnValue(returnData, key, type) {
|
|
102
102
|
case Erc20SubType.zerolend_borrowing:
|
103
103
|
case Erc20SubType.lnd_lending:
|
104
104
|
case Erc20SubType.lnd_borrowing:
|
105
|
+
case Erc20SubType.dlend_lending:
|
106
|
+
case Erc20SubType.dlend_borrowing:
|
105
107
|
case Erc20SubType.avalon_lending:
|
106
108
|
case Erc20SubType.avalon_borrowing:
|
107
109
|
case Erc20SubType.superlend_lending:
|
@@ -163,6 +163,8 @@ export function createCall(target, key, type, metaData) {
|
|
163
163
|
case Erc20SubType.zerolend_borrowing:
|
164
164
|
case Erc20SubType.lnd_lending:
|
165
165
|
case Erc20SubType.lnd_borrowing:
|
166
|
+
case Erc20SubType.dlend_lending:
|
167
|
+
case Erc20SubType.dlend_borrowing:
|
166
168
|
case Erc20SubType.avalon_lending:
|
167
169
|
case Erc20SubType.avalon_borrowing:
|
168
170
|
case Erc20SubType.superlend_lending:
|