@merkl/api 0.10.168 → 0.10.170

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. package/dist/database/api/.generated/edge.js +6 -3
  2. package/dist/database/api/.generated/index-browser.js +3 -0
  3. package/dist/database/api/.generated/index.d.ts +113 -0
  4. package/dist/database/api/.generated/index.js +6 -3
  5. package/dist/database/api/.generated/package.json +1 -1
  6. package/dist/database/api/.generated/schema.prisma +17 -15
  7. package/dist/database/api/.generated/wasm.js +3 -0
  8. package/dist/src/cache/declaration.d.ts +0 -30
  9. package/dist/src/cache/declaration.js +0 -30
  10. package/dist/src/eden/index.d.ts +167 -15
  11. package/dist/src/index.d.ts +59 -5
  12. package/dist/src/libs/campaigns/campaignTypes/CLAMMDynamicData.js +2 -2
  13. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/factoryFinder.js +2 -0
  14. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.d.ts +3 -1
  15. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.js +8 -0
  16. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/PendleYTProcessor.d.ts +29 -0
  17. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/PendleYTProcessor.js +31 -0
  18. package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/processorMapping.js +3 -0
  19. package/dist/src/libs/positions/clamm/index.d.ts +1 -2
  20. package/dist/src/libs/positions/clamm/index.js +322 -330
  21. package/dist/src/libs/positions/clamm/thegraph/fetchAlmPositions.d.ts +1 -1
  22. package/dist/src/libs/positions/clamm/thegraph/fetchAlmPositions.js +1 -1
  23. package/dist/src/libs/positions/clamm/thegraph/fetchAmmPositions.d.ts +1 -1
  24. package/dist/src/libs/positions/clamm/thegraph/fetchAmmPositions.js +2 -2
  25. package/dist/src/libs/positions/clamm/thegraph/fetchFarmedPositions.d.ts +1 -2
  26. package/dist/src/libs/positions/clamm/thegraph/fetchFarmedPositions.js +1 -4
  27. package/dist/src/libs/positions/euler/index.js +2 -3
  28. package/dist/src/libs/positions/index.js +1 -1
  29. package/dist/src/modules/v4/campaign/campaign.controller.d.ts +6 -2
  30. package/dist/src/modules/v4/campaign/campaign.model.d.ts +1 -0
  31. package/dist/src/modules/v4/campaign/campaign.model.js +1 -0
  32. package/dist/src/modules/v4/campaign/campaign.repository.d.ts +2 -0
  33. package/dist/src/modules/v4/campaign/campaign.repository.js +2 -1
  34. package/dist/src/modules/v4/campaign/campaign.service.d.ts +10 -5
  35. package/dist/src/modules/v4/campaign/campaign.service.js +10 -2
  36. package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +20 -3
  37. package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +2 -1
  38. package/dist/src/modules/v4/opportunity/opportunity.model.js +1 -0
  39. package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +83 -5
  40. package/dist/src/modules/v4/opportunity/opportunity.repository.js +31 -0
  41. package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +162 -8
  42. package/dist/src/modules/v4/opportunity/opportunity.service.js +11 -0
  43. package/dist/src/modules/v4/position/implementations/AjnaPositionFetcher.d.ts +6 -0
  44. package/dist/src/modules/v4/position/implementations/AjnaPositionFetcher.js +90 -0
  45. package/dist/src/modules/v4/position/implementations/BadgerPositionFetcher.d.ts +6 -0
  46. package/dist/src/modules/v4/position/implementations/BadgerPositionFetcher.js +69 -0
  47. package/dist/src/modules/v4/position/implementations/ClammPositionFetcher.d.ts +6 -0
  48. package/dist/src/modules/v4/position/implementations/ClammPositionFetcher.js +71 -0
  49. package/dist/src/modules/v4/position/implementations/DolomitePositionFetcher.d.ts +6 -0
  50. package/dist/src/modules/v4/position/implementations/DolomitePositionFetcher.js +45 -0
  51. package/dist/src/modules/v4/position/implementations/ERC20PositionFetcher.d.ts +6 -0
  52. package/dist/src/modules/v4/position/implementations/ERC20PositionFetcher.js +47 -0
  53. package/dist/src/modules/v4/position/implementations/EulerPositionFetcher.d.ts +6 -0
  54. package/dist/src/modules/v4/position/implementations/EulerPositionFetcher.js +40 -0
  55. package/dist/src/modules/v4/position/index.d.ts +2 -0
  56. package/dist/src/modules/v4/position/index.js +2 -0
  57. package/dist/src/modules/v4/position/position.controller.d.ts +39 -0
  58. package/dist/src/modules/v4/position/position.controller.js +16 -0
  59. package/dist/src/modules/v4/position/position.model.d.ts +25 -0
  60. package/dist/src/modules/v4/position/position.model.js +5 -0
  61. package/dist/src/modules/v4/position/position.repository.d.ts +14 -0
  62. package/dist/src/modules/v4/position/position.repository.js +6 -0
  63. package/dist/src/modules/v4/position/position.service.d.ts +5 -0
  64. package/dist/src/modules/v4/position/position.service.js +34 -0
  65. package/dist/src/modules/v4/price/price.controller.js +1 -1
  66. package/dist/src/modules/v4/price/price.service.d.ts +1 -1
  67. package/dist/src/modules/v4/price/price.service.js +3 -3
  68. package/dist/src/modules/v4/reward/reward.repository.d.ts +4 -0
  69. package/dist/src/modules/v4/reward/reward.service.d.ts +27 -0
  70. package/dist/src/modules/v4/reward/reward.service.js +5 -2
  71. package/dist/src/modules/v4/router.d.ts +59 -5
  72. package/dist/src/modules/v4/router.js +3 -1
  73. package/dist/src/modules/v4/token/token.controller.d.ts +6 -0
  74. package/dist/src/modules/v4/token/token.service.d.ts +12 -0
  75. package/dist/src/modules/v4/user/user.controller.d.ts +8 -0
  76. package/dist/src/routes/v1/prices.js +2 -4
  77. package/dist/src/routes/v3/blacklist.d.ts +59 -5
  78. package/dist/src/routes/v3/campaigns.d.ts +60 -6
  79. package/dist/src/routes/v3/campaignsInfo.d.ts +59 -5
  80. package/dist/src/routes/v3/multiChainPositions.d.ts +59 -5
  81. package/dist/src/routes/v3/opportunity.d.ts +59 -5
  82. package/dist/src/routes/v3/positions.d.ts +59 -5
  83. package/dist/src/routes/v3/recipients.d.ts +6 -2
  84. package/dist/src/routes/v3/recipients.js +14 -8
  85. package/dist/src/routes/v3/rewards.d.ts +59 -5
  86. package/dist/src/routes/v3/updates.d.ts +59 -5
  87. package/dist/src/routes/v3/userRewards.d.ts +59 -5
  88. package/dist/src/utils/decodeCalls.js +4 -1
  89. package/dist/src/utils/encodeCalls.js +4 -1
  90. package/dist/src/utils/generateCardName.js +2 -0
  91. package/dist/src/utils/prices/services/erc4626Service.js +10 -4
  92. package/dist/tsconfig.package.tsbuildinfo +1 -1
  93. package/package.json +1 -1
  94. package/dist/src/libs/reports/campaignReport.d.ts +0 -9
  95. package/dist/src/libs/reports/campaignReport.js +0 -37
  96. package/dist/src/libs/reports/mainParameterRewards.d.ts +0 -3
  97. package/dist/src/libs/reports/mainParameterRewards.js +0 -48
package/package.json CHANGED
@@ -90,5 +90,5 @@
90
90
  "access": "public",
91
91
  "registry": "https://registry.npmjs.org/"
92
92
  },
93
- "version": "v0.10.168"
93
+ "version": "v0.10.170"
94
94
  }
@@ -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
- };