@merkl/api 0.16.6 → 0.16.8
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/backgroundJobs/jobs/campaignsCacheUpdater.js +3 -1
- package/dist/src/backgroundJobs/jobs/priceUpdater.js +1 -1
- package/dist/src/eden/index.d.ts +182 -177
- package/dist/src/index.d.ts +38 -37
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/BalancerV3PoolProcessor.js +9 -1
- package/dist/src/libs/getTokensList.d.ts +0 -10
- package/dist/src/libs/getTokensList.js +1 -21
- package/dist/src/libs/merklChainData.js +4 -24
- package/dist/src/libs/tokens/balances.js +2 -2
- package/dist/src/modules/v4/accounting/accounting.controller.d.ts +2 -2
- package/dist/src/modules/v4/accounting/accounting.repository.d.ts +16 -16
- package/dist/src/modules/v4/accounting/accounting.service.d.ts +2 -2
- package/dist/src/modules/v4/boost/boost.service.js +6 -2
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +3 -3
- package/dist/src/modules/v4/campaign/campaign.model.d.ts +1 -1
- package/dist/src/modules/v4/campaign/campaign.model.js +1 -1
- package/dist/src/modules/v4/campaign/campaign.repository.d.ts +15 -15
- package/dist/src/modules/v4/campaign/campaign.service.d.ts +1 -1
- package/dist/src/modules/v4/claims/claims.controller.d.ts +1 -1
- package/dist/src/modules/v4/computedValue/computedValue.controller.d.ts +1 -1
- package/dist/src/modules/v4/dynamicData/dynamicData.controller.d.ts +2 -2
- package/dist/src/modules/v4/dynamicData/dynamicData.service.d.ts +8 -11
- package/dist/src/modules/v4/dynamicData/dynamicData.service.js +0 -8
- package/dist/src/modules/v4/liquidity/implementations/AjnaPositionFetcher.d.ts +1 -1
- package/dist/src/modules/v4/liquidity/implementations/DolomitePositionFetcher.d.ts +1 -1
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +5 -5
- package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +5 -5
- package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +87 -87
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +5 -5
- package/dist/src/modules/v4/reward/reward.controller.d.ts +3 -3
- package/dist/src/modules/v4/reward/reward.model.d.ts +1 -1
- package/dist/src/modules/v4/reward/reward.model.js +1 -1
- package/dist/src/modules/v4/reward/reward.repository.d.ts +3 -3
- package/dist/src/modules/v4/reward/reward.service.d.ts +7 -7
- package/dist/src/modules/v4/router.d.ts +32 -31
- package/dist/src/modules/v4/router.js +20 -20
- package/dist/src/modules/v4/status/status.controller.d.ts +12 -12
- package/dist/src/modules/v4/status/status.repository.d.ts +12 -12
- package/dist/src/modules/v4/status/status.service.d.ts +12 -12
- package/dist/src/modules/v4/token/token.controller.d.ts +1 -0
- package/dist/src/modules/v4/token/token.model.d.ts +1 -0
- package/dist/src/modules/v4/token/token.model.js +1 -0
- package/dist/src/modules/v4/token/token.service.d.ts +13 -0
- package/dist/src/modules/v4/token/token.service.js +6 -17
- package/dist/src/modules/v4/user/user.controller.d.ts +3 -3
- package/dist/src/routes/v3/lostyield.js +6 -3
- package/dist/src/routes/v3/opportunity.d.ts +1 -1
- package/dist/src/routes/v3/rewards.d.ts +1 -1
- package/dist/src/routes/v3/rewardsReport.d.ts +1 -1
- package/dist/src/routes/v3/router.d.ts +4 -4
- package/dist/src/routes/v3/userRewards.d.ts +1 -1
- package/dist/src/utils/generateCardName.js +0 -4
- package/dist/src/utils/prices/priceService.js +1 -1
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/src/modules/v4/dynamicData/index.d.ts +0 -3
- package/dist/src/modules/v4/dynamicData/index.js +0 -3
- package/dist/src/modules/v4/index.d.ts +0 -4
- package/dist/src/modules/v4/index.js +0 -4
- package/dist/src/modules/v4/liquidity/index.d.ts +0 -2
- package/dist/src/modules/v4/liquidity/index.js +0 -2
@@ -53,18 +53,6 @@ export declare class StatusService {
|
|
53
53
|
computedUntil: bigint;
|
54
54
|
startTimestamp: bigint;
|
55
55
|
endTimestamp: bigint;
|
56
|
-
CampaignStatus: {
|
57
|
-
error: string;
|
58
|
-
details: import("database/api/.generated/runtime/library").JsonValue;
|
59
|
-
status: import("../../../../database/api/.generated").$Enums.RunStatus;
|
60
|
-
campaignId: string;
|
61
|
-
computedUntil: bigint;
|
62
|
-
processingStarted: bigint;
|
63
|
-
}[];
|
64
|
-
Opportunity: {
|
65
|
-
name: string;
|
66
|
-
id: string;
|
67
|
-
};
|
68
56
|
computeChainId: number;
|
69
57
|
distributionChainId: number;
|
70
58
|
campaignId: string;
|
@@ -73,5 +61,17 @@ export declare class StatusService {
|
|
73
61
|
address: string;
|
74
62
|
isTest: boolean;
|
75
63
|
};
|
64
|
+
Opportunity: {
|
65
|
+
name: string;
|
66
|
+
id: string;
|
67
|
+
};
|
68
|
+
CampaignStatus: {
|
69
|
+
error: string;
|
70
|
+
details: import("database/api/.generated/runtime/library").JsonValue;
|
71
|
+
status: import("../../../../database/api/.generated").$Enums.RunStatus;
|
72
|
+
campaignId: string;
|
73
|
+
computedUntil: bigint;
|
74
|
+
processingStarted: bigint;
|
75
|
+
}[];
|
76
76
|
}[]>;
|
77
77
|
}
|
@@ -113,6 +113,7 @@ export declare const TokenController: Elysia<"/tokens", false, {
|
|
113
113
|
params: {};
|
114
114
|
query: {
|
115
115
|
tokenAddress?: string | undefined;
|
116
|
+
verified?: boolean | undefined;
|
116
117
|
additionalTokenAddresses?: string[] | undefined;
|
117
118
|
chainId: number;
|
118
119
|
userAddress: string;
|
@@ -47,6 +47,7 @@ export declare const TokenDto: import("@sinclair/typebox").TObject<{
|
|
47
47
|
export declare const GetTokenBalanceDto: import("@sinclair/typebox").TObject<{
|
48
48
|
chainId: import("@sinclair/typebox").TNumber;
|
49
49
|
userAddress: import("@sinclair/typebox").TString;
|
50
|
+
verified: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
50
51
|
tokenAddress: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
51
52
|
additionalTokenAddresses: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
52
53
|
}>;
|
@@ -36,6 +36,7 @@ export const TokenDto = t.Object({
|
|
36
36
|
export const GetTokenBalanceDto = t.Object({
|
37
37
|
chainId: t.Numeric(),
|
38
38
|
userAddress: t.String(),
|
39
|
+
verified: t.Optional(t.Boolean()),
|
39
40
|
tokenAddress: t.Optional(t.String({ description: "If provided, the default verified token balances won't be included" })),
|
40
41
|
additionalTokenAddresses: t.Optional(t.Array(t.String())),
|
41
42
|
});
|
@@ -163,6 +163,19 @@ export declare abstract class TokenService {
|
|
163
163
|
} & {
|
164
164
|
price?: number | null | undefined;
|
165
165
|
})[]>;
|
166
|
+
static findManyObjectPerAddress(query: GetTokenQueryModel): Promise<Record<string, {
|
167
|
+
symbol: string;
|
168
|
+
name: string | null;
|
169
|
+
id: string;
|
170
|
+
icon: string;
|
171
|
+
chainId: number;
|
172
|
+
address: string;
|
173
|
+
decimals: number;
|
174
|
+
verified: boolean;
|
175
|
+
isTest: boolean;
|
176
|
+
} & {
|
177
|
+
price?: number | null | undefined;
|
178
|
+
}>>;
|
166
179
|
/**
|
167
180
|
* Get value of tokens
|
168
181
|
* @param tokenAmounts address/chain + amount of token
|
@@ -139,23 +139,6 @@ export class TokenService {
|
|
139
139
|
catch (e) {
|
140
140
|
console.error(e);
|
141
141
|
}
|
142
|
-
try {
|
143
|
-
const res = await TokenRepository.create({
|
144
|
-
id: TokenService.hashId({ chainId: Number.parseInt(chain), address: token.address }),
|
145
|
-
chainId: Number.parseInt(chain),
|
146
|
-
address: token.address,
|
147
|
-
name: token.name,
|
148
|
-
symbol: token.symbol,
|
149
|
-
verified: true,
|
150
|
-
decimals: token.decimals,
|
151
|
-
icon: token.logoURI,
|
152
|
-
isTest: false,
|
153
|
-
});
|
154
|
-
log.local(`Token created: ${res?.symbol} on ${NETWORK_LABELS[Number.parseInt(chain)]}`);
|
155
|
-
}
|
156
|
-
catch (e) {
|
157
|
-
console.error(e);
|
158
|
-
}
|
159
142
|
}
|
160
143
|
try {
|
161
144
|
await apiDbClient.token.update({
|
@@ -236,6 +219,12 @@ export class TokenService {
|
|
236
219
|
static async findMany(query) {
|
237
220
|
return (await TokenRepository.findMany(query)).map(TokenService.format);
|
238
221
|
}
|
222
|
+
static async findManyObjectPerAddress(query) {
|
223
|
+
return (await TokenService.findMany(query)).reduce((acc, token) => {
|
224
|
+
acc[token.address] = token;
|
225
|
+
return acc;
|
226
|
+
}, {});
|
227
|
+
}
|
239
228
|
/**
|
240
229
|
* Get value of tokens
|
241
230
|
* @param tokenAmounts address/chain + amount of token
|
@@ -193,12 +193,12 @@ export declare const UserController: Elysia<"/users", false, {
|
|
193
193
|
claimed: bigint;
|
194
194
|
amount: bigint;
|
195
195
|
pending: bigint;
|
196
|
-
recipient: string;
|
197
196
|
root: string;
|
197
|
+
recipient: string;
|
198
198
|
proofs: string[];
|
199
199
|
}, "breakdowns"> & {
|
200
200
|
breakdowns: {
|
201
|
-
opportunity: import("
|
201
|
+
opportunity: import("../opportunity").Opportunity["model"];
|
202
202
|
claimed: bigint;
|
203
203
|
amount: bigint;
|
204
204
|
pending: bigint;
|
@@ -306,8 +306,8 @@ export declare const UserController: Elysia<"/users", false, {
|
|
306
306
|
claimed: bigint;
|
307
307
|
amount: bigint;
|
308
308
|
pending: bigint;
|
309
|
-
recipient: string;
|
310
309
|
root: string;
|
310
|
+
recipient: string;
|
311
311
|
proofs: string[];
|
312
312
|
}, "breakdowns"> & {
|
313
313
|
breakdowns: {
|
@@ -1,11 +1,11 @@
|
|
1
1
|
import { Redis } from "../../cache";
|
2
|
+
import { TokenService } from "../../modules/v4/token";
|
2
3
|
import { getLastBlockBeforeWithCache } from "../../utils/lastBlockBefore";
|
3
4
|
import { BN2Number, ChainId, DAY, ERC20Interface } from "@sdk";
|
4
5
|
import { t } from "elysia";
|
5
6
|
import { utils } from "ethers";
|
6
7
|
import moment from "moment";
|
7
8
|
import checkQueryAddressValidity from "../../hooks/checkQueryAddressValidity";
|
8
|
-
import { getTokensListWithCache } from "../../libs/getTokensList";
|
9
9
|
import { batchMulticallCallWithRetry } from "../../utils/generic";
|
10
10
|
import { log } from "../../utils/logger";
|
11
11
|
import { providers } from "../../utils/providers";
|
@@ -32,13 +32,16 @@ const CONSTANTS = {
|
|
32
32
|
],
|
33
33
|
};
|
34
34
|
const getLostYield = async (user) => {
|
35
|
-
const tokenList = await getTokensListWithCache();
|
36
35
|
const result = {};
|
37
36
|
const now = moment().unix();
|
38
37
|
const LOOKBACK = 30 * DAY;
|
39
38
|
const AVERAGING_PERIOD = 2 * DAY;
|
40
39
|
const promises = Object.keys(CONSTANTS).map(chainId => (async () => {
|
41
40
|
try {
|
41
|
+
const tokenList = await TokenService.findManyObjectPerAddress({
|
42
|
+
chainId: Number.parseInt(chainId),
|
43
|
+
verified: true,
|
44
|
+
});
|
42
45
|
result[chainId] = {};
|
43
46
|
for (const token of CONSTANTS[Number.parseInt(chainId)]) {
|
44
47
|
result[chainId][token] = { total: 0, yield: 0 };
|
@@ -64,7 +67,7 @@ const getLostYield = async (user) => {
|
|
64
67
|
const results = await batchMulticallCallWithRetry(Number.parseInt(chainId), { calls, blockNumber });
|
65
68
|
let i = 0;
|
66
69
|
for (const token of CONSTANTS[Number.parseInt(chainId)]) {
|
67
|
-
const tokenDetails = tokenList[
|
70
|
+
const tokenDetails = tokenList[utils.getAddress(token)];
|
68
71
|
const balance = ERC20Interface.decodeFunctionResult("balanceOf", results[i++].returnData)[0];
|
69
72
|
result[chainId][token].total += BN2Number(balance, tokenDetails.decimals);
|
70
73
|
}
|
@@ -43,9 +43,9 @@ declare const _default: (app: Elysia) => Elysia<"", false, {
|
|
43
43
|
type?: undefined;
|
44
44
|
tag?: string | undefined;
|
45
45
|
chainId?: undefined;
|
46
|
-
mainParameter?: string | undefined;
|
47
46
|
action?: undefined;
|
48
47
|
campaigns?: boolean | undefined;
|
48
|
+
mainParameter?: string | undefined;
|
49
49
|
testTokens?: boolean | undefined;
|
50
50
|
};
|
51
51
|
headers: unknown;
|
@@ -25,8 +25,8 @@ declare const _default: (app: Elysia) => Elysia<"", false, {
|
|
25
25
|
params: {};
|
26
26
|
query: {
|
27
27
|
from?: number | undefined;
|
28
|
-
to?: number | undefined;
|
29
28
|
mainParameter?: string | undefined;
|
29
|
+
to?: number | undefined;
|
30
30
|
chainId: number;
|
31
31
|
campaignId: string;
|
32
32
|
};
|
@@ -412,9 +412,9 @@ export declare const v3: Elysia<"/v3", false, {
|
|
412
412
|
type?: undefined;
|
413
413
|
tag?: string | undefined;
|
414
414
|
chainId?: undefined;
|
415
|
-
mainParameter?: string | undefined;
|
416
415
|
action?: undefined;
|
417
416
|
campaigns?: boolean | undefined;
|
417
|
+
mainParameter?: string | undefined;
|
418
418
|
testTokens?: boolean | undefined;
|
419
419
|
};
|
420
420
|
headers: unknown;
|
@@ -608,8 +608,8 @@ export declare const v3: Elysia<"/v3", false, {
|
|
608
608
|
pending?: string | undefined;
|
609
609
|
symbol: string;
|
610
610
|
token: string;
|
611
|
-
mainParameter: string;
|
612
611
|
decimals: number;
|
612
|
+
mainParameter: string;
|
613
613
|
unclaimed: string;
|
614
614
|
accumulated: string;
|
615
615
|
};
|
@@ -639,8 +639,8 @@ export declare const v3: Elysia<"/v3", false, {
|
|
639
639
|
params: {};
|
640
640
|
query: {
|
641
641
|
from?: number | undefined;
|
642
|
-
to?: number | undefined;
|
643
642
|
mainParameter?: string | undefined;
|
643
|
+
to?: number | undefined;
|
644
644
|
chainId: number;
|
645
645
|
campaignId: string;
|
646
646
|
};
|
@@ -743,9 +743,9 @@ export declare const v3: Elysia<"/v3", false, {
|
|
743
743
|
body: unknown;
|
744
744
|
params: {};
|
745
745
|
query: {
|
746
|
-
mainParameter?: string | undefined;
|
747
746
|
rewardToken?: string | undefined;
|
748
747
|
proof?: string | undefined;
|
748
|
+
mainParameter?: string | undefined;
|
749
749
|
reloadChainId?: number | undefined;
|
750
750
|
chainId: never;
|
751
751
|
user: string;
|
@@ -25,9 +25,9 @@ declare const _default: (app: Elysia) => Elysia<"", false, {
|
|
25
25
|
body: unknown;
|
26
26
|
params: {};
|
27
27
|
query: {
|
28
|
-
mainParameter?: string | undefined;
|
29
28
|
rewardToken?: string | undefined;
|
30
29
|
proof?: string | undefined;
|
30
|
+
mainParameter?: string | undefined;
|
31
31
|
reloadChainId?: number | undefined;
|
32
32
|
chainId: never;
|
33
33
|
user: string;
|
@@ -35,10 +35,6 @@ export function generateCardName(type, typeInfo, campaign, symbols = [""], displ
|
|
35
35
|
return cardName;
|
36
36
|
}
|
37
37
|
case tokenType.balancerV3: {
|
38
|
-
const symbols = [];
|
39
|
-
for (let i = 0; i < typeInfo.numberTokens; i++) {
|
40
|
-
symbols.push(typeInfo[`symbolToken${i}`]);
|
41
|
-
}
|
42
38
|
if (campaign.computeChainId === ChainId.SONIC) {
|
43
39
|
typeInfo.protocol = "Beets";
|
44
40
|
}
|
@@ -263,7 +263,7 @@ export default class PriceService {
|
|
263
263
|
this._prices[`r${xUpper}`] = this._prices[x];
|
264
264
|
this._prices[`variableDebt${xUpper}`] = this._prices[x];
|
265
265
|
}
|
266
|
-
/** Fill all BorrowStaker prices */
|
266
|
+
/** Deprecated - Fill all BorrowStaker prices */
|
267
267
|
const tokens = await getTokensListWithCache();
|
268
268
|
for (const chainIdString of Object.keys(tokens)) {
|
269
269
|
const chainId = Number.parseInt(chainIdString);
|