@merkl/api 0.10.212 → 0.10.214
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/src/eden/index.d.ts +9 -6
- package/dist/src/index.d.ts +3 -2
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/curveNPoolProcessor.js +7 -2
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/subtypesRound1.js +2 -3
- package/dist/src/modules/v4/router.d.ts +2 -1
- package/dist/src/modules/v4/user/user.controller.d.ts +2 -1
- package/dist/src/modules/v4/user/user.controller.js +6 -4
- package/dist/src/modules/v4/user/user.model.d.ts +2 -1
- package/dist/src/modules/v4/user/user.model.js +5 -1
- package/dist/src/routes/v2/merkl.d.ts +1 -1
- package/dist/src/routes/v2/router.d.ts +1 -1
- package/dist/src/utils/decodeCalls.js +6 -1
- package/dist/src/utils/generateCardName.js +3 -0
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/src/eden/index.d.ts
CHANGED
@@ -78,8 +78,8 @@ declare const eden: {
|
|
78
78
|
headers?: Record<string, unknown> | undefined;
|
79
79
|
query: {
|
80
80
|
user?: string | undefined;
|
81
|
-
AMMs?: string | string[] | undefined;
|
82
81
|
chainIds?: number | number[] | undefined;
|
82
|
+
AMMs?: string | string[] | undefined;
|
83
83
|
onlyLive?: string | undefined;
|
84
84
|
"AMMs[]"?: string | string[] | undefined;
|
85
85
|
"AMMs[0]"?: string | undefined;
|
@@ -1403,7 +1403,8 @@ declare const eden: {
|
|
1403
1403
|
get: (options: {
|
1404
1404
|
headers?: Record<string, unknown> | undefined;
|
1405
1405
|
query: {
|
1406
|
-
|
1406
|
+
chainIds?: number[] | undefined;
|
1407
|
+
reloadChainId?: number | undefined;
|
1407
1408
|
};
|
1408
1409
|
fetch?: RequestInit | undefined;
|
1409
1410
|
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
@@ -2858,8 +2859,8 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
2858
2859
|
params: {};
|
2859
2860
|
query: {
|
2860
2861
|
user?: string | undefined;
|
2861
|
-
AMMs?: string | string[] | undefined;
|
2862
2862
|
chainIds?: number | number[] | undefined;
|
2863
|
+
AMMs?: string | string[] | undefined;
|
2863
2864
|
onlyLive?: string | undefined;
|
2864
2865
|
"AMMs[]"?: string | string[] | undefined;
|
2865
2866
|
"AMMs[0]"?: string | undefined;
|
@@ -4519,7 +4520,8 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
4519
4520
|
address: string;
|
4520
4521
|
};
|
4521
4522
|
query: {
|
4522
|
-
|
4523
|
+
chainIds?: number[] | undefined;
|
4524
|
+
reloadChainId?: number | undefined;
|
4523
4525
|
};
|
4524
4526
|
headers: unknown;
|
4525
4527
|
response: {
|
@@ -6254,8 +6256,8 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
6254
6256
|
headers?: Record<string, unknown> | undefined;
|
6255
6257
|
query: {
|
6256
6258
|
user?: string | undefined;
|
6257
|
-
AMMs?: string | string[] | undefined;
|
6258
6259
|
chainIds?: number | number[] | undefined;
|
6260
|
+
AMMs?: string | string[] | undefined;
|
6259
6261
|
onlyLive?: string | undefined;
|
6260
6262
|
"AMMs[]"?: string | string[] | undefined;
|
6261
6263
|
"AMMs[0]"?: string | undefined;
|
@@ -7579,7 +7581,8 @@ export declare const MerklApi: (domain: string | import("elysia").default<"", fa
|
|
7579
7581
|
get: (options: {
|
7580
7582
|
headers?: Record<string, unknown> | undefined;
|
7581
7583
|
query: {
|
7582
|
-
|
7584
|
+
chainIds?: number[] | undefined;
|
7585
|
+
reloadChainId?: number | undefined;
|
7583
7586
|
};
|
7584
7587
|
fetch?: RequestInit | undefined;
|
7585
7588
|
}) => Promise<import("@elysiajs/eden").Treaty.TreatyResponse<{
|
package/dist/src/index.d.ts
CHANGED
@@ -123,8 +123,8 @@ declare const app: Elysia<"", false, {
|
|
123
123
|
params: {};
|
124
124
|
query: {
|
125
125
|
user?: string | undefined;
|
126
|
-
AMMs?: string | string[] | undefined;
|
127
126
|
chainIds?: number | number[] | undefined;
|
127
|
+
AMMs?: string | string[] | undefined;
|
128
128
|
onlyLive?: string | undefined;
|
129
129
|
"AMMs[]"?: string | string[] | undefined;
|
130
130
|
"AMMs[0]"?: string | undefined;
|
@@ -1784,7 +1784,8 @@ declare const app: Elysia<"", false, {
|
|
1784
1784
|
address: string;
|
1785
1785
|
};
|
1786
1786
|
query: {
|
1787
|
-
|
1787
|
+
chainIds?: number[] | undefined;
|
1788
|
+
reloadChainId?: number | undefined;
|
1788
1789
|
};
|
1789
1790
|
headers: unknown;
|
1790
1791
|
response: {
|
package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/curveNPoolProcessor.js
CHANGED
@@ -59,9 +59,14 @@ export class CurveNPoolProcessor extends GenericProcessor {
|
|
59
59
|
for (let i = 0; i < typeInfo.numberTokens; i++) {
|
60
60
|
const symbol = typeInfo[`symbolToken${i}`];
|
61
61
|
const parsedSymbol = symbol.split("_")[0].slice(1);
|
62
|
-
let price = (await pricer.get({ symbol:
|
62
|
+
let price = (await pricer.get({ symbol: symbol })) ?? 0;
|
63
63
|
if (price === 0) {
|
64
|
-
|
64
|
+
// For cross curve
|
65
|
+
const parsedSymbol = symbol.split("_")[0].slice(1);
|
66
|
+
price = (await pricer.get({ symbol: parsedSymbol })) ?? 0;
|
67
|
+
if (price === 0) {
|
68
|
+
price = (await pricer.get({ symbol: hardcodedSymbol })) ?? 0;
|
69
|
+
}
|
65
70
|
}
|
66
71
|
const decimals = Number(typeInfo[`decimalsToken${i}`]);
|
67
72
|
const amount = BN2Number(typeInfo[`balanceToken${i}`], decimals);
|
@@ -43,10 +43,9 @@ function satisfiesNameConditions(name, type) {
|
|
43
43
|
return (lowerCaseName === "crvusd/frax" ||
|
44
44
|
lowerCaseName === "ezeth/wfrxeth" ||
|
45
45
|
lowerCaseName === "pufeth/wsteth" ||
|
46
|
-
lowerCaseName === "hai/lusd"
|
47
|
-
lowerCaseName === "eywa/usdt");
|
46
|
+
lowerCaseName === "hai/lusd");
|
48
47
|
case tokenType.crosscurve:
|
49
|
-
return lowerCaseName.startsWith("crosscurve");
|
48
|
+
return lowerCaseName.startsWith("crosscurve") || lowerCaseName === "eywa/usdt";
|
50
49
|
case tokenType.silostaking:
|
51
50
|
return lowerCaseName === "isei";
|
52
51
|
case tokenType.beefy:
|
@@ -1662,7 +1662,8 @@ export declare const v4: Elysia<"/v4", false, {
|
|
1662
1662
|
address: string;
|
1663
1663
|
};
|
1664
1664
|
query: {
|
1665
|
-
|
1665
|
+
chainIds?: number[] | undefined;
|
1666
|
+
reloadChainId?: number | undefined;
|
1666
1667
|
};
|
1667
1668
|
headers: unknown;
|
1668
1669
|
response: {
|
@@ -19,17 +19,19 @@ export const UserController = new Elysia({ prefix: "/users", detail: { tags: ["U
|
|
19
19
|
})
|
20
20
|
// ─── Get User's Rewards With Breakdown And Details for our FE ────────
|
21
21
|
.get("/:address/rewards/breakdowns", async ({ params, query }) => {
|
22
|
-
const rewardsByChain = await RewardService.getUserRewardsByChain(params.address, true,
|
22
|
+
const rewardsByChain = await RewardService.getUserRewardsByChain(params.address, true, query?.chainIds, query.reloadChainId ?? null);
|
23
23
|
return RewardService.splitRewardsBreakdownByOpportunity(rewardsByChain);
|
24
24
|
}, {
|
25
25
|
params: UserUniqueDto,
|
26
26
|
query: OptionalChainIdDto,
|
27
27
|
beforeHandle: ({ params, query }) => {
|
28
28
|
params.address = throwOnInvalidRequiredAddress(params.address);
|
29
|
-
if (!!query.
|
30
|
-
throwOnUnsupportedChainId(query.
|
29
|
+
if (!!query.reloadChainId)
|
30
|
+
throwOnUnsupportedChainId(query.reloadChainId);
|
31
|
+
for (const chainId of query?.chainIds ?? []) {
|
32
|
+
throwOnUnsupportedChainId(chainId);
|
33
|
+
}
|
31
34
|
},
|
32
|
-
detail: { hide: true },
|
33
35
|
})
|
34
36
|
// ─── Get User's Rewards With Breakdown ──────────────────────────────
|
35
37
|
.get("/:address/rewards", async ({ params, query }) => {
|
@@ -39,7 +39,8 @@ export declare const UserUniqueDto: import("@sinclair/typebox").TObject<{
|
|
39
39
|
address: import("@sinclair/typebox").TString;
|
40
40
|
}>;
|
41
41
|
export declare const OptionalChainIdDto: import("@sinclair/typebox").TObject<{
|
42
|
-
|
42
|
+
chainIds: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TTransform<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TNumber>]>, number[]>>;
|
43
|
+
reloadChainId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
43
44
|
}>;
|
44
45
|
export declare const UserDto: import("@sinclair/typebox").TObject<{
|
45
46
|
address: import("@sinclair/typebox").TString;
|
@@ -31,7 +31,11 @@ export const UserUniqueDto = t.Object({
|
|
31
31
|
address: t.String(),
|
32
32
|
});
|
33
33
|
export const OptionalChainIdDto = t.Object({
|
34
|
-
|
34
|
+
chainIds: t.Optional(t
|
35
|
+
.Transform(t.Union([t.String(), t.Array(t.Numeric())]))
|
36
|
+
.Decode(value => (typeof value === "string" ? value.split(",").map(v => Number.parseInt(v)) : value))
|
37
|
+
.Encode(value => [...value])),
|
38
|
+
reloadChainId: t.Optional(t.Numeric()),
|
35
39
|
});
|
36
40
|
export const UserDto = t.Object({
|
37
41
|
address: t.String(),
|
@@ -28,8 +28,8 @@ declare const _default: (app: Elysia) => Elysia<"", false, {
|
|
28
28
|
params: {};
|
29
29
|
query: {
|
30
30
|
user?: string | undefined;
|
31
|
-
AMMs?: string | string[] | undefined;
|
32
31
|
chainIds?: number | number[] | undefined;
|
32
|
+
AMMs?: string | string[] | undefined;
|
33
33
|
onlyLive?: string | undefined;
|
34
34
|
"AMMs[]"?: string | string[] | undefined;
|
35
35
|
"AMMs[0]"?: string | undefined;
|
@@ -19,8 +19,8 @@ export declare const v2: Elysia<"/v2", false, {
|
|
19
19
|
params: {};
|
20
20
|
query: {
|
21
21
|
user?: string | undefined;
|
22
|
-
AMMs?: string | string[] | undefined;
|
23
22
|
chainIds?: number | number[] | undefined;
|
23
|
+
AMMs?: string | string[] | undefined;
|
24
24
|
onlyLive?: string | undefined;
|
25
25
|
"AMMs[]"?: string | string[] | undefined;
|
26
26
|
"AMMs[0]"?: string | undefined;
|
@@ -129,7 +129,12 @@ export function decodeCall(calls, index, key, type) {
|
|
129
129
|
case "coin2":
|
130
130
|
return CurveInterface.decodeFunctionResult("coins", returnData)[0];
|
131
131
|
case "N_COINS":
|
132
|
-
|
132
|
+
try {
|
133
|
+
return CurveStableSwapNGInterface.decodeFunctionResult("N_COINS", returnData)[0];
|
134
|
+
}
|
135
|
+
catch (e) {
|
136
|
+
return 2;
|
137
|
+
}
|
133
138
|
case "balances":
|
134
139
|
return CurveStableSwapNGInterface.decodeFunctionResult("balances", returnData)[0];
|
135
140
|
case "calcNetShareValue":
|
@@ -102,6 +102,9 @@ export function generateCardName(type, typeInfo, campaign, symbols = [""]) {
|
|
102
102
|
case tokenType.cpmmGamma:
|
103
103
|
return `Provide ${typeInfo.symbolToken0}/${typeInfo.symbolToken1} on ${typeInfo.protocol}`;
|
104
104
|
case tokenType.crosscurve:
|
105
|
+
if (typeInfo.name.toLowerCase() === "eywa/usdt") {
|
106
|
+
return `Curve ${typeInfo.name}`;
|
107
|
+
}
|
105
108
|
return `${typeInfo.name}`;
|
106
109
|
default:
|
107
110
|
return `Hold ${typeInfo.name} (${campaign.campaignParameters.symbolTargetToken})`;
|