@merkl/api 0.10.137 → 0.10.139
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/eden/index.d.ts +291 -520
- package/dist/src/index.d.ts +99 -186
- package/dist/src/index.js +1 -1
- package/dist/src/libs/campaigns/campaignTypes/CompoundDynamicData.js +21 -7
- package/dist/src/libs/deprecated-merklv3/index.js +1 -1
- package/dist/src/libs/positions/compound/index.d.ts +0 -2
- package/dist/src/libs/positions/compound/index.js +3 -6
- package/dist/src/modules/v4/blacklist/blacklist.controller.d.ts +0 -21
- package/dist/src/modules/v4/blacklist/blacklist.controller.js +2 -2
- package/dist/src/modules/v4/blacklist/blacklist.repository.d.ts +0 -8
- package/dist/src/modules/v4/blacklist/blacklist.repository.js +1 -4
- package/dist/src/modules/v4/blacklist/blacklist.service.d.ts +1 -9
- package/dist/src/modules/v4/blacklist/blacklist.service.js +1 -4
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +3 -3
- package/dist/src/modules/v4/campaign/campaign.controller.js +8 -6
- package/dist/src/modules/v4/campaign/campaign.service.js +1 -2
- package/dist/src/modules/v4/chain/chain.controller.js +2 -1
- package/dist/src/modules/v4/dynamicData/dynamicData.controller.d.ts +20 -26
- package/dist/src/modules/v4/dynamicData/dynamicData.controller.js +5 -5
- package/dist/src/modules/v4/enso/enso.service.d.ts +1 -1
- package/dist/src/modules/v4/{participate/participate.controller.d.ts → interaction/interaction.controller.d.ts} +6 -6
- package/dist/src/modules/v4/{participate/participate.controller.js → interaction/interaction.controller.js} +12 -13
- package/dist/src/modules/v4/{participate/participate.model.d.ts → interaction/interaction.model.d.ts} +12 -12
- package/dist/src/modules/v4/{participate/participate.model.js → interaction/interaction.model.js} +3 -3
- package/dist/src/modules/v4/{participate/participate.service.d.ts → interaction/interaction.service.d.ts} +5 -5
- package/dist/src/modules/v4/{participate/participate.service.js → interaction/interaction.service.js} +3 -3
- package/dist/src/modules/v4/merklRoot/merklRoot.controller.d.ts +2 -2
- package/dist/src/modules/v4/merklRoot/merklRoot.controller.js +2 -2
- package/dist/src/modules/v4/opportunity/opportunity.controller.js +5 -1
- package/dist/src/modules/v4/price/price.controller.js +3 -0
- package/dist/src/modules/v4/reward/reward.controller.d.ts +31 -29
- package/dist/src/modules/v4/reward/reward.controller.js +3 -3
- package/dist/src/modules/v4/reward/{rewardConvertor.service.d.ts → subservices/converter.d.ts} +2 -2
- package/dist/src/modules/v4/reward/{rewardConvertor.service.js → subservices/converter.js} +1 -1
- package/dist/src/modules/v4/router.d.ts +99 -186
- package/dist/src/modules/v4/router.js +2 -2
- package/dist/src/modules/v4/status/status.controller.d.ts +40 -102
- package/dist/src/modules/v4/status/status.controller.js +16 -22
- package/dist/src/modules/v4/status/status.model.d.ts +33 -26
- package/dist/src/modules/v4/status/status.model.js +9 -20
- package/dist/src/modules/v4/status/status.repository.d.ts +12 -42
- package/dist/src/modules/v4/status/status.repository.js +10 -22
- package/dist/src/modules/v4/status/status.service.d.ts +4 -36
- package/dist/src/modules/v4/status/status.service.js +9 -18
- package/dist/src/modules/v4/uniswapV4/uniswapV4.controller.d.ts +1 -1
- package/dist/src/modules/v4/uniswapV4/uniswapV4.controller.js +1 -1
- package/dist/src/modules/v4/user/user.controller.js +3 -2
- package/dist/src/routes/v3/ERC20Campaigns.d.ts +99 -186
- package/dist/src/routes/v3/blacklist.d.ts +99 -186
- package/dist/src/routes/v3/campaigns.d.ts +99 -186
- package/dist/src/routes/v3/campaignsInfo.d.ts +99 -186
- package/dist/src/routes/v3/multiChainPositions.d.ts +99 -186
- package/dist/src/routes/v3/opportunity.d.ts +99 -186
- package/dist/src/routes/v3/positions.d.ts +99 -186
- package/dist/src/routes/v3/rewards.d.ts +99 -186
- package/dist/src/routes/v3/rewards.js +1 -1
- package/dist/src/routes/v3/updates.d.ts +99 -186
- package/dist/src/routes/v3/userRewards.d.ts +99 -186
- package/dist/src/routes/v3/userRewards.js +1 -1
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +4 -5
- package/dist/src/modules/v4/apr/apr.repository.d.ts +0 -0
- package/dist/src/modules/v4/apr/apr.repository.js +0 -1
- package/dist/src/modules/v4/tvl/tvl.repository.d.ts +0 -0
- package/dist/src/modules/v4/tvl/tvl.repository.js +0 -1
@@ -140,7 +140,7 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
|
|
140
140
|
};
|
141
141
|
};
|
142
142
|
} & {
|
143
|
-
|
143
|
+
"campaigns-to-process": {
|
144
144
|
index: {
|
145
145
|
get: {
|
146
146
|
body: unknown;
|
@@ -162,7 +162,7 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
|
|
162
162
|
};
|
163
163
|
};
|
164
164
|
} & {
|
165
|
-
|
165
|
+
"campaigns-to-process": {
|
166
166
|
count: {
|
167
167
|
get: {
|
168
168
|
body: unknown;
|
@@ -178,7 +178,7 @@ export declare const CampaignController: Elysia<"/campaigns", false, {
|
|
178
178
|
};
|
179
179
|
};
|
180
180
|
} & {
|
181
|
-
|
181
|
+
"campaigns-to-process": {
|
182
182
|
index: {
|
183
183
|
post: {
|
184
184
|
body: unknown;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { AuthorizationHeadersDto, EngineGuard } from "../../../guards/Engine.guard";
|
2
2
|
import Elysia from "elysia";
|
3
3
|
import { throwOnUnsupportedChainId } from "src/utils/throw";
|
4
|
-
import {
|
4
|
+
import { ChainUniqueDto } from "../chain";
|
5
5
|
import { CreateCampaignDto, GetCampaignQueryDto } from "./campaign.model";
|
6
6
|
import { CampaignService } from "./campaign.service";
|
7
7
|
// ─── Campaigns Controller ────────────────────────────────────────────────────
|
@@ -11,34 +11,36 @@ export const CampaignController = new Elysia({ prefix: "/campaigns", detail: { t
|
|
11
11
|
beforeHandle: EngineGuard,
|
12
12
|
headers: AuthorizationHeadersDto,
|
13
13
|
body: CreateCampaignDto,
|
14
|
+
detail: { hide: true },
|
14
15
|
})
|
15
16
|
// ─── Get Many Campaigns ──────────────────────────────────────────────
|
16
17
|
.get("/", async ({ query }) => await CampaignService.findMany(query), { query: GetCampaignQueryDto })
|
17
18
|
// ─── Get Total Campaigns Count ───────────────────────────────────────
|
18
19
|
.get("/count", async ({ query }) => await CampaignService.countMany(query), { query: GetCampaignQueryDto })
|
19
|
-
.group("/
|
20
|
+
.group("/campaigns-to-process", app => {
|
20
21
|
return (app
|
21
|
-
// ─── Get
|
22
|
+
// ─── Get The List Of Campaigns To Process ────
|
22
23
|
.get("/", async ({ query }) => await CampaignService.findCampaignsToProcess(query.chainId), {
|
23
|
-
query:
|
24
|
+
query: ChainUniqueDto,
|
24
25
|
beforeHandle: ({ query }) => {
|
25
26
|
throwOnUnsupportedChainId(query.chainId);
|
26
27
|
},
|
27
28
|
})
|
28
29
|
// ─── Get Count of CampaignsToProcess ─────────────────────────────────
|
29
30
|
.get("/count", async ({ query }) => (await CampaignService.findCampaignsToProcess(query.chainId)).length, {
|
30
|
-
query:
|
31
|
+
query: ChainUniqueDto,
|
31
32
|
beforeHandle: ({ query }) => {
|
32
33
|
throwOnUnsupportedChainId(query.chainId);
|
33
34
|
},
|
34
35
|
})
|
35
36
|
// ─── Returns a CampaignId to Process and flags it as PROCESSING ──────-
|
36
37
|
.post("/", async ({ query }) => await CampaignService.pickCampaignToProcess(query.chainId), {
|
37
|
-
query:
|
38
|
+
query: ChainUniqueDto,
|
38
39
|
beforeHandle: async ({ query, headers }) => {
|
39
40
|
await EngineGuard({ headers });
|
40
41
|
throwOnUnsupportedChainId(query.chainId);
|
41
42
|
},
|
42
43
|
headers: AuthorizationHeadersDto,
|
44
|
+
detail: { hide: true },
|
43
45
|
}));
|
44
46
|
});
|
@@ -27,11 +27,12 @@ export const ChainController = new Elysia({ prefix: "/chains", detail: { tags: [
|
|
27
27
|
.get("/count", async ({ query }) => await ChainService.countMany(query), {
|
28
28
|
query: GetChainQueryDto,
|
29
29
|
})
|
30
|
-
// ─── Get All Supported Chains ────────────────────────────────────────
|
31
30
|
.group("/explorers", app => {
|
31
|
+
// ─── Create An Explorer ──────────────────────────────────────
|
32
32
|
return app.post("", async ({ body: { chainId, type, url } }) => await ExplorerService.create(chainId, type, url), {
|
33
33
|
beforeHandle: TokenAuthGuard,
|
34
34
|
headers: AuthorizationHeadersDto,
|
35
35
|
body: CreateChainExplorerDto,
|
36
|
+
detail: { hide: true },
|
36
37
|
});
|
37
38
|
});
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import Elysia from "elysia";
|
2
|
-
export declare const DynamicDataController: Elysia<"/
|
2
|
+
export declare const DynamicDataController: Elysia<"/dynamic-data", false, {
|
3
3
|
decorator: {};
|
4
4
|
store: {};
|
5
5
|
derive: {};
|
@@ -12,31 +12,25 @@ export declare const DynamicDataController: Elysia<"/dynamicData", false, {
|
|
12
12
|
macro: {};
|
13
13
|
macroFn: {};
|
14
14
|
}, {
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
cardName: string;
|
35
|
-
blacklistedSupply: number;
|
36
|
-
priceTargetToken: number;
|
37
|
-
};
|
38
|
-
};
|
39
|
-
};
|
15
|
+
"dynamic-data": {
|
16
|
+
index: {
|
17
|
+
get: {
|
18
|
+
body: unknown;
|
19
|
+
params: {};
|
20
|
+
query: {
|
21
|
+
chainId: number;
|
22
|
+
tokenAddress: string;
|
23
|
+
};
|
24
|
+
headers: {
|
25
|
+
authorization: string;
|
26
|
+
};
|
27
|
+
response: {
|
28
|
+
200: {
|
29
|
+
tvl: number;
|
30
|
+
totalSupply: number;
|
31
|
+
cardName: string;
|
32
|
+
blacklistedSupply: number;
|
33
|
+
priceTargetToken: number;
|
40
34
|
};
|
41
35
|
};
|
42
36
|
};
|
@@ -4,13 +4,13 @@ import { throwOnUnsupportedChainId } from "src/utils/throw";
|
|
4
4
|
import { DynamicDataSourceIdentifier } from "./dynamicData.model";
|
5
5
|
import { DynamicDataService } from "./dynamicData.service";
|
6
6
|
// ─── DynamicDatas Controller ───────────────────────────────────────────────────────
|
7
|
-
export const DynamicDataController = new Elysia({ prefix: "/
|
7
|
+
export const DynamicDataController = new Elysia({ prefix: "/dynamic-data", detail: { tags: ["DynamicData"] } })
|
8
8
|
// ─── Get type Info By Token Address ───────────────────────────────────────
|
9
|
-
.get("/
|
10
|
-
|
9
|
+
.get("/", async ({ query }) => await DynamicDataService.queryERC20DynamicData(query.chainId, query.tokenAddress), {
|
10
|
+
query: DynamicDataSourceIdentifier,
|
11
11
|
headers: AuthorizationHeadersDto,
|
12
|
-
beforeHandle: ({
|
12
|
+
beforeHandle: ({ query, headers }) => {
|
13
13
|
BackOfficeGuard({ headers });
|
14
|
-
throwOnUnsupportedChainId(
|
14
|
+
throwOnUnsupportedChainId(query.chainId);
|
15
15
|
},
|
16
16
|
});
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { GetParticipateProtocolsQuery } from "../
|
1
|
+
import type { GetParticipateProtocolsQuery } from "../interaction/interaction.model";
|
2
2
|
import { type ProtocolId } from "../protocol";
|
3
3
|
import { type EnsoApi, type EnsoSlug } from "./enso.model";
|
4
4
|
export declare abstract class EnsoService {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import Elysia from "elysia";
|
2
|
-
export declare const
|
2
|
+
export declare const InteractionController: Elysia<"/interaction", false, {
|
3
3
|
decorator: {};
|
4
4
|
store: {};
|
5
5
|
derive: {};
|
@@ -12,7 +12,7 @@ export declare const ParticipateController: Elysia<"/participate", false, {
|
|
12
12
|
macro: {};
|
13
13
|
macroFn: {};
|
14
14
|
}, {
|
15
|
-
|
15
|
+
interaction: {
|
16
16
|
targets: {
|
17
17
|
get: {
|
18
18
|
body: unknown;
|
@@ -24,13 +24,13 @@ export declare const ParticipateController: Elysia<"/participate", false, {
|
|
24
24
|
};
|
25
25
|
headers: unknown;
|
26
26
|
response: {
|
27
|
-
200: import("./
|
27
|
+
200: import("./interaction.model").InteractionTarget[] | undefined;
|
28
28
|
};
|
29
29
|
};
|
30
30
|
};
|
31
31
|
};
|
32
32
|
} & {
|
33
|
-
|
33
|
+
interaction: {
|
34
34
|
protocols: {
|
35
35
|
get: {
|
36
36
|
body: unknown;
|
@@ -53,7 +53,7 @@ export declare const ParticipateController: Elysia<"/participate", false, {
|
|
53
53
|
};
|
54
54
|
};
|
55
55
|
} & {
|
56
|
-
|
56
|
+
interaction: {
|
57
57
|
quote: {
|
58
58
|
get: {
|
59
59
|
body: unknown;
|
@@ -79,7 +79,7 @@ export declare const ParticipateController: Elysia<"/participate", false, {
|
|
79
79
|
};
|
80
80
|
};
|
81
81
|
} & {
|
82
|
-
|
82
|
+
interaction: {
|
83
83
|
transaction: {
|
84
84
|
get: {
|
85
85
|
body: unknown;
|
@@ -1,16 +1,15 @@
|
|
1
1
|
import Elysia from "elysia";
|
2
2
|
import { EnsoService } from "../enso/enso.service";
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
// ───
|
6
|
-
export const
|
7
|
-
// ─── Get All Targets ───────────────────────────────────────────────
|
3
|
+
import { GetInteractionProtocolsQueryDto, GetInteractionQuoteQueryDto, GetInteractionTargetsQueryDto, } from "./interaction.model";
|
4
|
+
import { InteractionService } from "./interaction.service";
|
5
|
+
// ─── Interaction Controller ──────────────────────────────────────────────────
|
6
|
+
export const InteractionController = new Elysia({ prefix: "/interaction", detail: { tags: ["Interaction"] } })
|
8
7
|
.get("/targets", async ({ query: { protocolId, chainId, identifier } }) => {
|
9
8
|
if (identifier)
|
10
|
-
return await
|
11
|
-
return await
|
9
|
+
return await InteractionService.getTarget(chainId, protocolId, identifier);
|
10
|
+
return await InteractionService.getTargets(chainId, protocolId);
|
12
11
|
}, {
|
13
|
-
query:
|
12
|
+
query: GetInteractionTargetsQueryDto,
|
14
13
|
detail: {
|
15
14
|
summary: "Available interaction targets for a protocol",
|
16
15
|
description: "Retrieves all the pool/token/contract",
|
@@ -18,7 +17,7 @@ export const ParticipateController = new Elysia({ prefix: "/participate", detail
|
|
18
17
|
})
|
19
18
|
// ─── Get All Compatible Protocols ───────────────────────────────────────
|
20
19
|
.get("/protocols", async ({ query }) => await EnsoService.getCompatibleProtocols(query), {
|
21
|
-
query:
|
20
|
+
query: GetInteractionProtocolsQueryDto,
|
22
21
|
detail: {
|
23
22
|
summary: "Interactable protocols",
|
24
23
|
description: "Retrieves protocols integrated by merkl which supports being interacted with",
|
@@ -26,7 +25,7 @@ export const ParticipateController = new Elysia({ prefix: "/participate", detail
|
|
26
25
|
})
|
27
26
|
// ─── Get Quote ───────────────────────────────────────────────────────
|
28
27
|
.get("/quote", async ({ query: { protocolId, chainId, identifier, userAddress, fromAmount, fromTokenAddress } }) => {
|
29
|
-
const [target] = (await
|
28
|
+
const [target] = (await InteractionService.getTarget(chainId, protocolId, identifier)) ?? [];
|
30
29
|
//TODO: throw error
|
31
30
|
if (!target)
|
32
31
|
return;
|
@@ -39,7 +38,7 @@ export const ParticipateController = new Elysia({ prefix: "/participate", detail
|
|
39
38
|
chainId,
|
40
39
|
});
|
41
40
|
}, {
|
42
|
-
query:
|
41
|
+
query: GetInteractionQuoteQueryDto,
|
43
42
|
detail: {
|
44
43
|
summary: "Preview participate transaction",
|
45
44
|
description: "",
|
@@ -47,7 +46,7 @@ export const ParticipateController = new Elysia({ prefix: "/participate", detail
|
|
47
46
|
})
|
48
47
|
// ─── Get Transaction ─────────────────────────────────────────────────
|
49
48
|
.get("/transaction", async ({ query: { protocolId, chainId, identifier, userAddress, fromAmount, fromTokenAddress } }) => {
|
50
|
-
const [target] = (await
|
49
|
+
const [target] = (await InteractionService.getTarget(chainId, protocolId, identifier)) ?? [];
|
51
50
|
//TODO: throw error
|
52
51
|
if (!target)
|
53
52
|
return;
|
@@ -60,7 +59,7 @@ export const ParticipateController = new Elysia({ prefix: "/participate", detail
|
|
60
59
|
chainId,
|
61
60
|
});
|
62
61
|
}, {
|
63
|
-
query:
|
62
|
+
query: GetInteractionQuoteQueryDto,
|
64
63
|
detail: {
|
65
64
|
summary: "Get participate transaction",
|
66
65
|
description: "",
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import type { Token } from "../token";
|
2
2
|
export declare const participateInputTypes: readonly ["tokenAmount", "token"];
|
3
|
-
export type
|
4
|
-
export type
|
3
|
+
export type InteractionInputType = (typeof participateInputTypes)[number];
|
4
|
+
export type InteractionInput<T extends InteractionInputType = InteractionInputType> = {
|
5
5
|
tokenAmount: {
|
6
6
|
chain: number[];
|
7
7
|
address: string[];
|
@@ -12,32 +12,32 @@ export type ParticipateInput<T extends ParticipateInputType = ParticipateInputTy
|
|
12
12
|
};
|
13
13
|
}[T];
|
14
14
|
export declare const participateTypes: readonly ["link", "deposit", "withdraw"];
|
15
|
-
export type
|
16
|
-
export type
|
15
|
+
export type InteractionType = (typeof participateTypes)[number];
|
16
|
+
export type InteractionSchema<T extends InteractionType> = {
|
17
17
|
link: {
|
18
18
|
link: string;
|
19
19
|
};
|
20
20
|
deposit: {
|
21
|
-
inputs:
|
21
|
+
inputs: InteractionInput[];
|
22
22
|
};
|
23
23
|
withdraw: {
|
24
24
|
d: string;
|
25
25
|
};
|
26
26
|
}[T];
|
27
|
-
export type
|
27
|
+
export type InteractionTarget = {
|
28
28
|
identifier: string;
|
29
29
|
name: string;
|
30
30
|
tokens: Token["model"][];
|
31
31
|
};
|
32
|
-
export type
|
33
|
-
[T in
|
32
|
+
export type InteractionSchemas = {
|
33
|
+
[T in InteractionType]?: InteractionSchema<T>;
|
34
34
|
};
|
35
|
-
export declare const
|
35
|
+
export declare const GetInteractionTargetsQueryDto: import("@sinclair/typebox").TObject<{
|
36
36
|
chainId: import("@sinclair/typebox").TNumber;
|
37
37
|
protocolId: import("@sinclair/typebox").TString;
|
38
38
|
identifier: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
39
39
|
}>;
|
40
|
-
export declare const
|
40
|
+
export declare const GetInteractionQuoteQueryDto: import("@sinclair/typebox").TObject<{
|
41
41
|
chainId: import("@sinclair/typebox").TNumber;
|
42
42
|
protocolId: import("@sinclair/typebox").TString;
|
43
43
|
identifier: import("@sinclair/typebox").TString;
|
@@ -45,7 +45,7 @@ export declare const GetParticipateQuoteQueryDto: import("@sinclair/typebox").TO
|
|
45
45
|
fromTokenAddress: import("@sinclair/typebox").TString;
|
46
46
|
fromAmount: import("@sinclair/typebox").TString;
|
47
47
|
}>;
|
48
|
-
export declare const
|
48
|
+
export declare const GetInteractionProtocolsQueryDto: import("@sinclair/typebox").TObject<{
|
49
49
|
chainId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
50
50
|
}>;
|
51
|
-
export type
|
51
|
+
export type GetInteractionProtocolsQuery = typeof GetInteractionProtocolsQueryDto.static;
|
package/dist/src/modules/v4/{participate/participate.model.js → interaction/interaction.model.js}
RENAMED
@@ -2,14 +2,14 @@ import protocol from "database/api/seeder/resources/protocol";
|
|
2
2
|
import { t } from "elysia";
|
3
3
|
export const participateInputTypes = ["tokenAmount", "token"];
|
4
4
|
export const participateTypes = ["link", "deposit", "withdraw"];
|
5
|
-
export const
|
5
|
+
export const GetInteractionTargetsQueryDto = t.Object({
|
6
6
|
chainId: t.Numeric(),
|
7
7
|
protocolId: t.String({
|
8
8
|
examples: Object.values(protocol).reduce((obj, i) => Object.assign(obj, { [i.name]: { value: i.id } }), {}),
|
9
9
|
}),
|
10
10
|
identifier: t.Optional(t.String()),
|
11
11
|
});
|
12
|
-
export const
|
12
|
+
export const GetInteractionQuoteQueryDto = t.Object({
|
13
13
|
chainId: t.Numeric(),
|
14
14
|
protocolId: t.String({
|
15
15
|
examples: Object.values(protocol).reduce((obj, i) => Object.assign(obj, { [i.name]: { value: i.id } }), {}),
|
@@ -19,6 +19,6 @@ export const GetParticipateQuoteQueryDto = t.Object({
|
|
19
19
|
fromTokenAddress: t.String(),
|
20
20
|
fromAmount: t.String(),
|
21
21
|
});
|
22
|
-
export const
|
22
|
+
export const GetInteractionProtocolsQueryDto = t.Object({
|
23
23
|
chainId: t.Optional(t.Numeric()),
|
24
24
|
});
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { EnsoService } from "../enso/enso.service";
|
2
2
|
import type { ProtocolId } from "../protocol";
|
3
|
-
import type {
|
4
|
-
export declare abstract class
|
5
|
-
static getTarget(chainId: number, protocolId: ProtocolId, identifier: string): Promise<
|
6
|
-
static getTargetsFromEnsoTokens(tokens: Awaited<ReturnType<typeof EnsoService.getTokens>>): Promise<
|
7
|
-
static getTargets(chainId: number, protocolId: ProtocolId): Promise<
|
3
|
+
import type { InteractionTarget } from "./interaction.model";
|
4
|
+
export declare abstract class InteractionService {
|
5
|
+
static getTarget(chainId: number, protocolId: ProtocolId, identifier: string): Promise<InteractionTarget[] | undefined>;
|
6
|
+
static getTargetsFromEnsoTokens(tokens: Awaited<ReturnType<typeof EnsoService.getTokens>>): Promise<InteractionTarget[]>;
|
7
|
+
static getTargets(chainId: number, protocolId: ProtocolId): Promise<InteractionTarget[] | undefined>;
|
8
8
|
}
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import { EnsoService } from "../enso/enso.service";
|
2
2
|
import { TokenService } from "../token";
|
3
|
-
export class
|
3
|
+
export class InteractionService {
|
4
4
|
static async getTarget(chainId, protocolId, identifier) {
|
5
5
|
const slug = EnsoService.getSlug(protocolId);
|
6
6
|
if (!slug)
|
7
7
|
return;
|
8
8
|
const tokens = await EnsoService.getTokens(chainId, slug, identifier);
|
9
|
-
return await
|
9
|
+
return await InteractionService.getTargetsFromEnsoTokens(tokens);
|
10
10
|
}
|
11
11
|
static async getTargetsFromEnsoTokens(tokens) {
|
12
12
|
const targets = [];
|
@@ -28,6 +28,6 @@ export class ParticipateService {
|
|
28
28
|
if (!slug)
|
29
29
|
return;
|
30
30
|
const tokens = await EnsoService.getTokens(chainId, slug);
|
31
|
-
return await
|
31
|
+
return await InteractionService.getTargetsFromEnsoTokens(tokens);
|
32
32
|
}
|
33
33
|
}
|
@@ -13,7 +13,7 @@ export declare const MerklRootController: Elysia<"/roots", false, {
|
|
13
13
|
macroFn: {};
|
14
14
|
}, {
|
15
15
|
roots: {
|
16
|
-
|
16
|
+
index: {
|
17
17
|
get: {
|
18
18
|
body: unknown;
|
19
19
|
params: {};
|
@@ -36,7 +36,7 @@ export declare const MerklRootController: Elysia<"/roots", false, {
|
|
36
36
|
};
|
37
37
|
} & {
|
38
38
|
roots: {
|
39
|
-
|
39
|
+
live: {
|
40
40
|
get: {
|
41
41
|
body: unknown;
|
42
42
|
params: {};
|
@@ -5,11 +5,11 @@ import { MerklRootService } from "./merklRoot.service";
|
|
5
5
|
// ─── Merkl Roots Controller ──────────────────────────────────────────────────
|
6
6
|
export const MerklRootController = new Elysia({ prefix: "/roots", detail: { tags: ["Roots"] } })
|
7
7
|
// ─── Get Merkl Root By Timestamp ─────────────────────────────────────
|
8
|
-
.get("/
|
8
|
+
.get("/", async ({ query }) => await MerklRootService.rootForTimestamp(query), {
|
9
9
|
query: RootByTimestampsDto,
|
10
10
|
beforeHandle: async ({ query }) => {
|
11
11
|
throwOnUnsupportedChainId(query.chainId);
|
12
12
|
},
|
13
13
|
})
|
14
14
|
// ─── Get all live Merkl Roots ─────────────────────────────────────────
|
15
|
-
.get("/", async () => await MerklRootService.fetchAll());
|
15
|
+
.get("/live", async () => await MerklRootService.fetchAll());
|
@@ -6,12 +6,16 @@ import { OpportunityService } from "./opportunity.service";
|
|
6
6
|
import { transformId } from "./transform-id.pipe";
|
7
7
|
import { validateId } from "./validate-id.pipe";
|
8
8
|
// ─── Opportunities Controller ────────────────────────────────────────────────
|
9
|
-
export const OpportunityController = new Elysia({
|
9
|
+
export const OpportunityController = new Elysia({
|
10
|
+
prefix: "/opportunities",
|
11
|
+
detail: { tags: ["Opportunities"] },
|
12
|
+
})
|
10
13
|
// ─── Create An Opportunity ───────────────────────────────────────────
|
11
14
|
.post("/", async ({ body }) => await OpportunityService.create(body), {
|
12
15
|
beforeHandle: TokenAuthGuard,
|
13
16
|
headers: AuthorizationHeadersDto,
|
14
17
|
body: CreateOpportunityDto,
|
18
|
+
detail: { hide: true },
|
15
19
|
})
|
16
20
|
// ─── Get An Opportunity By Id ────────────────────────────────────────
|
17
21
|
.get("/:id", async ({ params }) => {
|
@@ -35,6 +35,7 @@ export const PriceController = new Elysia({ prefix: "/prices", detail: { tags: [
|
|
35
35
|
headers: AuthorizationHeadersDto,
|
36
36
|
body: CreatePriceSourceDto,
|
37
37
|
beforeHandle: BackOfficeGuard,
|
38
|
+
detail: { hide: true },
|
38
39
|
})
|
39
40
|
// ─── Update A Price Source ───────────────────
|
40
41
|
.patch("/symbol/:symbol", async ({ params, body }) => await PriceService.updatePriceSource(params.symbol, body), {
|
@@ -42,11 +43,13 @@ export const PriceController = new Elysia({ prefix: "/prices", detail: { tags: [
|
|
42
43
|
params: PriceSourceIdentifier,
|
43
44
|
body: UpdatePriceSourceDto,
|
44
45
|
beforeHandle: BackOfficeGuard,
|
46
|
+
detail: { hide: true },
|
45
47
|
})
|
46
48
|
// ─── Delete A Price Source ───────────────────
|
47
49
|
.delete("/symbol/:symbol", async ({ params }) => await PriceService.deletePriceSource(params.symbol), {
|
48
50
|
headers: AuthorizationHeadersDto,
|
49
51
|
params: PriceSourceIdentifier,
|
50
52
|
beforeHandle: BackOfficeGuard,
|
53
|
+
detail: { hide: true },
|
51
54
|
}));
|
52
55
|
});
|
@@ -113,35 +113,37 @@ export declare const RewardController: Elysia<"/rewards", false, {
|
|
113
113
|
};
|
114
114
|
} & {
|
115
115
|
rewards: {
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
116
|
+
engine: {
|
117
|
+
pendings: {
|
118
|
+
post: {
|
119
|
+
body: {
|
120
|
+
distributionChainId: number;
|
121
|
+
campaignId: string;
|
122
|
+
root: string;
|
123
|
+
rewardToken: string;
|
124
|
+
toUpdate: {
|
125
|
+
auxiliaryData1?: string | undefined;
|
126
|
+
auxiliaryData2?: string | undefined;
|
127
|
+
reason: string;
|
128
|
+
pending: string;
|
129
|
+
recipient: string;
|
130
|
+
}[];
|
131
|
+
toCreate: {
|
132
|
+
auxiliaryData1?: string | undefined;
|
133
|
+
auxiliaryData2?: string | undefined;
|
134
|
+
reason: string;
|
135
|
+
pending: string;
|
136
|
+
recipient: string;
|
137
|
+
}[];
|
138
|
+
};
|
139
|
+
params: {};
|
140
|
+
query: unknown;
|
141
|
+
headers: {
|
142
|
+
authorization: string;
|
143
|
+
};
|
144
|
+
response: {
|
145
|
+
200: boolean;
|
146
|
+
};
|
145
147
|
};
|
146
148
|
};
|
147
149
|
};
|
@@ -33,19 +33,19 @@ export const RewardController = new Elysia({ prefix: "/rewards", detail: { tags:
|
|
33
33
|
beforeHandle: EngineGuard,
|
34
34
|
})
|
35
35
|
// ─── Create Many Pending Rewards ─────────────────────────────────────
|
36
|
-
.post("/pendings", async ({ body }) => await RewardService.updatePendings(body), {
|
36
|
+
.post("/engine/pendings", async ({ body }) => await RewardService.updatePendings(body), {
|
37
37
|
headers: AuthorizationHeadersDto,
|
38
38
|
body: UpdatePendingDto,
|
39
39
|
beforeHandle: EngineGuard,
|
40
40
|
})
|
41
|
-
// ─── Get Reward Count By Chain And Root
|
41
|
+
// ─── Get Reward Count By Chain And Root ──────────────────────────────
|
42
42
|
.get("/count", async ({ query }) => await RewardService.count(query), {
|
43
43
|
query: CampaignIdDto,
|
44
44
|
beforeHandle: ({ query }) => {
|
45
45
|
throwOnUnsupportedChainId(query.chainId);
|
46
46
|
},
|
47
47
|
})
|
48
|
-
// ─── Get Reward Count By Chain And Root
|
48
|
+
// ─── Get Reward Count By Chain And Root ──────────────────────────────
|
49
49
|
.get("/count/chains", async () => await RewardService.countAllchains(), {
|
50
50
|
headers: AuthorizationHeadersDto,
|
51
51
|
beforeHandle: BackOfficeGuard,
|
package/dist/src/modules/v4/reward/{rewardConvertor.service.d.ts → subservices/converter.d.ts}
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { MerklAPIType, MerklChainId } from "@sdk";
|
2
|
-
import type { RewardV3Model, UserRewardV3Model } from "
|
3
|
-
import { RewardService } from "
|
2
|
+
import type { RewardV3Model, UserRewardV3Model } from "../reward.model";
|
3
|
+
import { RewardService } from "../reward.service";
|
4
4
|
export declare abstract class RewardConvertorService {
|
5
5
|
/**
|
6
6
|
* Convert the v4 reward data to the v3 model used in the v3/userRewards route
|