@merkl/api 0.10.167 → 0.10.169
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/src/cache/declaration.d.ts +0 -30
- package/dist/src/cache/declaration.js +0 -30
- package/dist/src/eden/index.d.ts +59 -12
- package/dist/src/index.d.ts +23 -4
- package/dist/src/libs/campaigns/campaignTypes/CLAMMDynamicData.js +2 -2
- package/dist/src/libs/positions/clamm/index.d.ts +1 -2
- package/dist/src/libs/positions/clamm/index.js +322 -330
- package/dist/src/libs/positions/clamm/thegraph/fetchAlmPositions.d.ts +1 -1
- package/dist/src/libs/positions/clamm/thegraph/fetchAlmPositions.js +1 -1
- package/dist/src/libs/positions/clamm/thegraph/fetchAmmPositions.d.ts +1 -1
- package/dist/src/libs/positions/clamm/thegraph/fetchAmmPositions.js +2 -2
- package/dist/src/libs/positions/clamm/thegraph/fetchFarmedPositions.d.ts +1 -2
- package/dist/src/libs/positions/clamm/thegraph/fetchFarmedPositions.js +1 -4
- package/dist/src/libs/positions/euler/index.js +2 -3
- package/dist/src/libs/positions/index.js +1 -1
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +2 -2
- package/dist/src/modules/v4/campaign/campaign.service.d.ts +6 -5
- package/dist/src/modules/v4/campaign/campaign.service.js +10 -2
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +2 -2
- package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +159 -0
- package/dist/src/modules/v4/opportunity/opportunity.repository.js +29 -0
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +131 -3
- package/dist/src/modules/v4/opportunity/opportunity.service.js +11 -0
- package/dist/src/modules/v4/position/implementations/AjnaPositionFetcher.d.ts +6 -0
- package/dist/src/modules/v4/position/implementations/AjnaPositionFetcher.js +90 -0
- package/dist/src/modules/v4/position/implementations/BadgerPositionFetcher.d.ts +6 -0
- package/dist/src/modules/v4/position/implementations/BadgerPositionFetcher.js +69 -0
- package/dist/src/modules/v4/position/implementations/ClammPositionFetcher.d.ts +6 -0
- package/dist/src/modules/v4/position/implementations/ClammPositionFetcher.js +71 -0
- package/dist/src/modules/v4/position/implementations/DolomitePositionFetcher.d.ts +6 -0
- package/dist/src/modules/v4/position/implementations/DolomitePositionFetcher.js +45 -0
- package/dist/src/modules/v4/position/implementations/ERC20PositionFetcher.d.ts +6 -0
- package/dist/src/modules/v4/position/implementations/ERC20PositionFetcher.js +47 -0
- package/dist/src/modules/v4/position/implementations/EulerPositionFetcher.d.ts +6 -0
- package/dist/src/modules/v4/position/implementations/EulerPositionFetcher.js +40 -0
- package/dist/src/modules/v4/position/index.d.ts +2 -0
- package/dist/src/modules/v4/position/index.js +2 -0
- package/dist/src/modules/v4/position/position.controller.d.ts +39 -0
- package/dist/src/modules/v4/position/position.controller.js +16 -0
- package/dist/src/modules/v4/position/position.model.d.ts +25 -0
- package/dist/src/modules/v4/position/position.model.js +5 -0
- package/dist/src/modules/v4/position/position.repository.d.ts +14 -0
- package/dist/src/modules/v4/position/position.repository.js +6 -0
- package/dist/src/modules/v4/position/position.service.d.ts +5 -0
- package/dist/src/modules/v4/position/position.service.js +34 -0
- package/dist/src/modules/v4/reward/reward.service.d.ts +5 -0
- package/dist/src/modules/v4/reward/reward.service.js +5 -2
- package/dist/src/modules/v4/router.d.ts +23 -4
- package/dist/src/modules/v4/router.js +3 -1
- package/dist/src/routes/v1/prices.js +2 -4
- package/dist/src/routes/v3/blacklist.d.ts +23 -4
- package/dist/src/routes/v3/campaigns.d.ts +24 -5
- package/dist/src/routes/v3/campaignsInfo.d.ts +23 -4
- package/dist/src/routes/v3/multiChainPositions.d.ts +23 -4
- package/dist/src/routes/v3/opportunity.d.ts +23 -4
- package/dist/src/routes/v3/positions.d.ts +23 -4
- package/dist/src/routes/v3/recipients.d.ts +6 -2
- package/dist/src/routes/v3/recipients.js +14 -8
- package/dist/src/routes/v3/rewards.d.ts +23 -4
- package/dist/src/routes/v3/updates.d.ts +23 -4
- package/dist/src/routes/v3/userRewards.d.ts +23 -4
- package/dist/src/utils/prices/services/erc4626Service.js +4 -4
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/src/libs/reports/campaignReport.d.ts +0 -9
- package/dist/src/libs/reports/campaignReport.js +0 -37
- package/dist/src/libs/reports/mainParameterRewards.d.ts +0 -3
- package/dist/src/libs/reports/mainParameterRewards.js +0 -48
package/package.json
CHANGED
@@ -1,9 +0,0 @@
|
|
1
|
-
import type { ChainId } from "@sdk";
|
2
|
-
export type CampaignRewardsT = {
|
3
|
-
recipient: string;
|
4
|
-
reason: string;
|
5
|
-
rewardToken: string;
|
6
|
-
amount: string;
|
7
|
-
}[];
|
8
|
-
export declare const getCampaignRewardsWithCache: (chainId: ChainId, root: string, campaignId: string) => Promise<any>;
|
9
|
-
export declare const getCampaignRewardsDeltaWithCache: (chainId: ChainId, from: number, to: number, campaignId: string) => Promise<any>;
|
@@ -1,37 +0,0 @@
|
|
1
|
-
import { Redis } from "../../cache";
|
2
|
-
import { MerklRootService } from "../../modules/v4/merklRoot";
|
3
|
-
import { hashArray } from "../../utils/hashArray";
|
4
|
-
import { engineDbClient } from "../../utils/prisma";
|
5
|
-
import { CAMPAIGN_REWARDS_DELTA, LATEST_CAMPAIGNS_REWARDS, } from "../../utils/queries/rewardsAmount";
|
6
|
-
async function getCampaignRewards(chainId, root, campaignId) {
|
7
|
-
return await engineDbClient.$queryRaw(LATEST_CAMPAIGNS_REWARDS(chainId, root, [campaignId]));
|
8
|
-
}
|
9
|
-
export const getCampaignRewardsWithCache = async (chainId, root, campaignId) => {
|
10
|
-
return await Redis.getOrSet(`CampaignRewards_${hashArray([chainId, root, campaignId])}`, getCampaignRewards, chainId, root, campaignId);
|
11
|
-
};
|
12
|
-
async function getCampaignRewardsDelta(chainId, from, to, campaignId) {
|
13
|
-
const roots = await MerklRootService.rootForTimestamp({
|
14
|
-
chainId,
|
15
|
-
fromTimestamp: from.toString(),
|
16
|
-
toTimestamp: to.toString(),
|
17
|
-
});
|
18
|
-
let toRoot;
|
19
|
-
let fromRoot;
|
20
|
-
if (roots.length === 2) {
|
21
|
-
toRoot = roots[0].root;
|
22
|
-
fromRoot = roots[1].root;
|
23
|
-
}
|
24
|
-
else if (roots.length === 1) {
|
25
|
-
// This means that the from timestamp is before the first root so we can simply return the state at the toRoot
|
26
|
-
toRoot = roots[0].root;
|
27
|
-
const rewardsData = await engineDbClient.$queryRaw(LATEST_CAMPAIGNS_REWARDS(chainId, toRoot, [campaignId]));
|
28
|
-
return rewardsData;
|
29
|
-
}
|
30
|
-
else {
|
31
|
-
return [];
|
32
|
-
}
|
33
|
-
return (await engineDbClient.$queryRaw(CAMPAIGN_REWARDS_DELTA(chainId, campaignId, fromRoot, toRoot)));
|
34
|
-
}
|
35
|
-
export const getCampaignRewardsDeltaWithCache = async (chainId, from, to, campaignId) => {
|
36
|
-
return await Redis.getOrSet(`CampaignRewardsDelta_${hashArray([chainId, from, to, campaignId])}`, getCampaignRewardsDelta, chainId, from, to, campaignId);
|
37
|
-
};
|
@@ -1,3 +0,0 @@
|
|
1
|
-
import type { ChainId } from "@sdk";
|
2
|
-
export declare const getRewardsMainParameterWithCache: (chainId: ChainId, root: string, mainParameter: string) => Promise<any>;
|
3
|
-
export declare const getRewardsMainParameterDeltaWithCache: (chainId: ChainId, from: number, to: number, mainParameter: string) => Promise<any>;
|
@@ -1,48 +0,0 @@
|
|
1
|
-
import { Redis } from "../../cache";
|
2
|
-
import { MerklRootService } from "../../modules/v4/merklRoot";
|
3
|
-
import { hashArray } from "../../utils/hashArray";
|
4
|
-
import { engineDbClient } from "../../utils/prisma";
|
5
|
-
import { CAMPAIGNS_FOR_MAIN_PARAMETER, } from "../../utils/queries/mainParameterCampaigns";
|
6
|
-
import { LATEST_CAMPAIGNS_REWARDS, REWARDS_DELTA, } from "../../utils/queries/rewardsAmount";
|
7
|
-
async function getRewardsMainParameter(chainId, root, mainParameter) {
|
8
|
-
const rawCampaigns = await engineDbClient.$queryRaw(CAMPAIGNS_FOR_MAIN_PARAMETER(chainId, mainParameter));
|
9
|
-
const campaignIds = rawCampaigns.map(campaign => campaign.campaignId);
|
10
|
-
if (campaignIds.length === 0) {
|
11
|
-
return [];
|
12
|
-
}
|
13
|
-
return await engineDbClient.$queryRaw(LATEST_CAMPAIGNS_REWARDS(chainId, root, campaignIds));
|
14
|
-
}
|
15
|
-
export const getRewardsMainParameterWithCache = async (chainId, root, mainParameter) => {
|
16
|
-
return await Redis.getOrSet(`RewardsMainParameter_${hashArray([chainId, root, mainParameter])}`, getRewardsMainParameter, chainId, root, mainParameter);
|
17
|
-
};
|
18
|
-
async function getRewardsMainParameterDelta(chainId, from, to, mainParameter) {
|
19
|
-
const roots = await MerklRootService.rootForTimestamp({
|
20
|
-
chainId,
|
21
|
-
fromTimestamp: from.toString(),
|
22
|
-
toTimestamp: to.toString(),
|
23
|
-
});
|
24
|
-
const rawCampaigns = await engineDbClient.$queryRaw(CAMPAIGNS_FOR_MAIN_PARAMETER(chainId, mainParameter));
|
25
|
-
const campaignIds = rawCampaigns.map(campaign => campaign.campaignId);
|
26
|
-
if (campaignIds.length === 0) {
|
27
|
-
return [];
|
28
|
-
}
|
29
|
-
let toRoot;
|
30
|
-
let fromRoot;
|
31
|
-
if (roots.length === 2) {
|
32
|
-
toRoot = roots[0].root;
|
33
|
-
fromRoot = roots[1].root;
|
34
|
-
}
|
35
|
-
else if (roots.length === 1) {
|
36
|
-
// This means that the from timestamp is before the first root so we can simply return the state at the toRoot
|
37
|
-
toRoot = roots[0].root;
|
38
|
-
const rewardsData = await engineDbClient.$queryRaw(LATEST_CAMPAIGNS_REWARDS(chainId, toRoot, campaignIds));
|
39
|
-
return rewardsData;
|
40
|
-
}
|
41
|
-
else {
|
42
|
-
return [];
|
43
|
-
}
|
44
|
-
return (await engineDbClient.$queryRaw(REWARDS_DELTA(chainId, campaignIds, fromRoot, toRoot)));
|
45
|
-
}
|
46
|
-
export const getRewardsMainParameterDeltaWithCache = async (chainId, from, to, mainParameter) => {
|
47
|
-
return await Redis.getOrSet(`RewardsMainParameterDelta_${hashArray([chainId, from, to, mainParameter])}`, getRewardsMainParameterDelta, chainId, from, to, mainParameter);
|
48
|
-
};
|