@merkl/api 0.10.158 → 0.10.160

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. package/dist/src/eden/index.d.ts +57 -18
  2. package/dist/src/index.d.ts +25 -18
  3. package/dist/src/modules/v4/reward/reward.controller.d.ts +25 -18
  4. package/dist/src/modules/v4/reward/reward.controller.js +10 -1
  5. package/dist/src/modules/v4/reward/reward.model.d.ts +8 -0
  6. package/dist/src/modules/v4/reward/reward.model.js +9 -0
  7. package/dist/src/modules/v4/reward/reward.repository.d.ts +6 -1
  8. package/dist/src/modules/v4/reward/reward.repository.js +14 -0
  9. package/dist/src/modules/v4/reward/reward.service.d.ts +2 -1
  10. package/dist/src/modules/v4/reward/reward.service.js +18 -0
  11. package/dist/src/modules/v4/router.d.ts +25 -18
  12. package/dist/src/modules/v4/status/status.service.js +4 -1
  13. package/dist/src/modules/v4/token/token.repository.d.ts +1 -1
  14. package/dist/src/modules/v4/token/token.service.d.ts +2 -2
  15. package/dist/src/routes/v3/blacklist.d.ts +25 -18
  16. package/dist/src/routes/v3/campaignUnclaimed.js +5 -8
  17. package/dist/src/routes/v3/campaigns.d.ts +25 -18
  18. package/dist/src/routes/v3/campaignsInfo.d.ts +25 -18
  19. package/dist/src/routes/v3/campaignsRewardsReport.js +16 -16
  20. package/dist/src/routes/v3/claims.d.ts +1 -1
  21. package/dist/src/routes/v3/multiChainPositions.d.ts +25 -18
  22. package/dist/src/routes/v3/opportunity.d.ts +25 -18
  23. package/dist/src/routes/v3/positions.d.ts +25 -18
  24. package/dist/src/routes/v3/rewards.d.ts +25 -23
  25. package/dist/src/routes/v3/rewards.js +10 -4
  26. package/dist/src/routes/v3/rewardsReport.d.ts +8 -4
  27. package/dist/src/routes/v3/rewardsReport.js +20 -34
  28. package/dist/src/routes/v3/updates.d.ts +25 -18
  29. package/dist/src/routes/v3/userRewards.d.ts +25 -18
  30. package/dist/tsconfig.package.tsbuildinfo +1 -1
  31. package/package.json +1 -1
  32. package/dist/src/routes/v3/ERC20Campaigns.d.ts +0 -2240
  33. package/dist/src/routes/v3/ERC20Campaigns.js +0 -63
  34. package/dist/src/routes/v3/rootForTimestamp.d.ts +0 -53
  35. package/dist/src/routes/v3/rootForTimestamp.js +0 -47
@@ -1,63 +0,0 @@
1
- import { Redis } from "../../cache";
2
- import param from "../../types/parameters";
3
- import { ANGLE_NETWORKS, Campaign, ChainId, isSupportedChain, registry, } from "@sdk";
4
- import { t } from "elysia";
5
- import { UnsupportedNetwork } from "../../utils/error";
6
- export const query = t.Object({
7
- chainIds: t.Optional(t.Union([t.String(), t.Array(t.String())])),
8
- types: t.Optional(t.Union([t.Numeric(), t.Array(t.Numeric()), t.String(), t.Array(t.String())])),
9
- live: t.Optional(t.BooleanString()),
10
- creatorTag: t.Optional(t.String()),
11
- });
12
- export const response = t.Record(t.Union(ANGLE_NETWORKS.merkl.map(chain => t.Literal(`${chain}`))), t.Optional(t.Record(t.String({ title: "id" }), t.Record(t.String({ title: "CampaignId" }), t.Object({
13
- chainId: param.Chain.type,
14
- campaignId: t.String(),
15
- tags: t.Optional(t.Array(t.String())),
16
- creator: t.String(),
17
- rewardToken: t.String(),
18
- mainParameter: t.String(),
19
- campaignParameters: t.Object({}),
20
- campaignType: param.Type.type,
21
- })))));
22
- export default (app) => app.get("", async ({ query, set }) => {
23
- const rawChainIds = query.chainIds;
24
- let chainIds;
25
- if (!rawChainIds) {
26
- chainIds = Object.keys(ChainId)
27
- .map(k => Number.parseInt(k))
28
- .filter(k => isSupportedChain(k, "merkl"));
29
- }
30
- else if (typeof rawChainIds === "string") {
31
- chainIds = [Number.parseInt(rawChainIds)];
32
- }
33
- else {
34
- chainIds = rawChainIds.map(chainId => Number.parseInt(chainId));
35
- }
36
- for (const chainId of chainIds) {
37
- if (!!chainId &&
38
- (!isSupportedChain(chainId, "merkl") ||
39
- !registry(chainId)?.Merkl?.DistributionCreator ||
40
- !registry(chainId)?.Merkl?.Distributor ||
41
- !registry(chainId)?.Merkl?.CoreMerkl)) {
42
- throw new UnsupportedNetwork(chainId);
43
- }
44
- }
45
- const cacheKeys = chainIds.map(chainId => `Campaigns_${chainId}`);
46
- const dynamicData = (await Redis.getMany(cacheKeys)).reduce((prev, chainData, index) => {
47
- if (!!chainData) {
48
- prev[chainIds[index]] = Object.keys(chainData).reduce((prev, curr) => {
49
- if (Number.parseInt(curr.split("_")[0]) === Campaign.ERC20) {
50
- prev[curr] = chainData[curr];
51
- }
52
- return prev;
53
- }, {});
54
- }
55
- return prev;
56
- }, {});
57
- return dynamicData;
58
- }, {
59
- query: t.Object({
60
- chainIds: t.Optional(t.Union([t.String(), t.Array(t.String())])),
61
- }),
62
- tags: ["Campaigns"],
63
- });
@@ -1,53 +0,0 @@
1
- import { type Elysia } from "elysia";
2
- export declare const query: import("@sinclair/typebox").TObject<{
3
- chainId: import("@sinclair/typebox").TNumber;
4
- timestamp: import("@sinclair/typebox").TNumber;
5
- }>;
6
- export declare const response: import("@sinclair/typebox").TObject<{
7
- chainId: import("@sinclair/typebox").TUnion<import("elysia").TSchema[]>;
8
- epoch: import("@sinclair/typebox").TNumber;
9
- root: import("@sinclair/typebox").TString;
10
- timestamp: import("@sinclair/typebox").TNumber;
11
- }>;
12
- declare const _default: (app: Elysia) => Elysia<"", false, {
13
- decorator: {};
14
- store: {};
15
- derive: {};
16
- resolve: {};
17
- }, {
18
- type: {};
19
- error: {};
20
- }, {
21
- schema: {};
22
- macro: {};
23
- macroFn: {};
24
- }, {
25
- index: {
26
- get: {
27
- body: unknown;
28
- params: {};
29
- query: {
30
- timestamp: number;
31
- chainId: number;
32
- };
33
- headers: unknown;
34
- response: {
35
- 200: {
36
- timestamp: number;
37
- chainId: number;
38
- root: string;
39
- epoch: number;
40
- } | null;
41
- };
42
- };
43
- };
44
- }, {
45
- derive: {};
46
- resolve: {};
47
- schema: {};
48
- }, {
49
- derive: {};
50
- resolve: {};
51
- schema: {};
52
- }>;
53
- export default _default;
@@ -1,47 +0,0 @@
1
- import param from "../../types/parameters";
2
- import { engineDbClient } from "../../utils/prisma";
3
- import { t } from "elysia";
4
- import checkQueryChainIdValidity from "../../hooks/checkQueryChainIdValidity";
5
- export const query = t.Object({
6
- chainId: t.Numeric(),
7
- timestamp: t.Numeric(),
8
- });
9
- export const response = t.Object({
10
- chainId: param.Chain.type,
11
- epoch: t.Number(),
12
- root: t.String(),
13
- timestamp: t.Number(),
14
- });
15
- export default (app) => app.use(checkQueryChainIdValidity()).get("", async ({ query }) => {
16
- const chainId = query.chainId;
17
- // Query all campaigns
18
- let root = await engineDbClient.merklRoots.findFirst({
19
- orderBy: {
20
- timestamp: "desc",
21
- },
22
- where: {
23
- chainId: chainId,
24
- timestamp: {
25
- lte: query.timestamp,
26
- },
27
- },
28
- });
29
- if (!root) {
30
- // Find the root with the lowest timestamp
31
- root = await engineDbClient.merklRoots.findFirst({
32
- orderBy: {
33
- timestamp: "asc",
34
- },
35
- where: {
36
- chainId: chainId,
37
- },
38
- });
39
- }
40
- return root;
41
- }, {
42
- transform({ query }) {
43
- query.chainId = !query.chainId ? undefined : Number.parseInt(query.chainId);
44
- },
45
- query,
46
- tags: ["Merkl"],
47
- });