@merkl/api 0.16.40 → 0.16.41
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/database/api/.generated/edge.js +2 -2
- package/dist/database/api/.generated/index.js +2 -2
- package/dist/database/api/.generated/package.json +1 -1
- package/dist/database/api/.generated/schema.prisma +4 -0
- package/dist/src/eden/index.d.ts +7600 -5065
- package/dist/src/entities/opportunity.js +4 -0
- package/dist/src/index.d.ts +753 -246
- package/dist/src/jobs/etl/update-dynamic-data.d.ts +1 -0
- package/dist/src/jobs/etl/update-dynamic-data.js +71 -0
- package/dist/src/libs/campaigns/campaignsDynamicData.d.ts +1 -1
- package/dist/src/libs/campaigns/campaignsDynamicData.js +22 -0
- package/dist/src/modules/v4/airflow/airflow.service.d.ts +3 -0
- package/dist/src/modules/v4/airflow/airflow.service.js +20 -0
- package/dist/src/modules/v4/campaign/campaign.repository.d.ts +81 -1
- package/dist/src/modules/v4/campaign/campaign.repository.js +57 -1
- package/dist/src/modules/v4/campaign/campaign.service.d.ts +57 -3
- package/dist/src/modules/v4/campaign/campaign.service.js +15 -6
- package/dist/src/modules/v4/campaign/index.d.ts +0 -1
- package/dist/src/modules/v4/campaign/index.js +0 -1
- package/dist/src/modules/v4/chain/chain.controller.d.ts +12 -36
- package/dist/src/modules/v4/chain/chain.controller.js +8 -6
- package/dist/src/modules/v4/chain/chain.model.d.ts +2 -0
- package/dist/src/modules/v4/chain/chain.model.js +2 -0
- package/dist/src/modules/v4/chain/chain.repository.d.ts +9 -11
- package/dist/src/modules/v4/chain/chain.repository.js +5 -18
- package/dist/src/modules/v4/chain/chain.service.d.ts +5 -0
- package/dist/src/modules/v4/chain/chain.service.js +4 -1
- package/dist/src/modules/v4/chain/index.d.ts +2 -1
- package/dist/src/modules/v4/chain/index.js +6 -1
- package/dist/src/modules/v4/computedValue/computedValue.repository.d.ts +1 -1
- package/dist/src/modules/v4/computedValue/computedValue.service.d.ts +1 -1
- package/dist/src/modules/v4/computedValue/index.d.ts +0 -1
- package/dist/src/modules/v4/computedValue/index.js +0 -1
- package/dist/src/modules/v4/dynamicData/dynamicData.service.js +1 -1
- package/dist/src/modules/v4/enso/enso.service.d.ts +1 -12
- package/dist/src/modules/v4/interaction/interaction.controller.d.ts +2 -12
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +703 -134
- package/dist/src/modules/v4/opportunity/opportunity.controller.js +2 -4
- package/dist/src/modules/v4/opportunity/opportunity.model.js +1 -1
- package/dist/src/modules/v4/opportunity/opportunity.repository.js +2 -1
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +0 -204
- package/dist/src/modules/v4/opportunity/opportunity.service.js +6 -4
- package/dist/src/modules/v4/opportunity/subservices/getVestMetaData.service.d.ts +1 -1
- package/dist/src/modules/v4/opportunity/subservices/getVestMetaData.service.js +1 -1
- package/dist/src/modules/v4/protocol/index.d.ts +2 -1
- package/dist/src/modules/v4/protocol/index.js +8 -1
- package/dist/src/modules/v4/protocol/protocol.controller.d.ts +10 -40
- package/dist/src/modules/v4/protocol/protocol.controller.js +11 -9
- package/dist/src/modules/v4/protocol/protocol.service.d.ts +7 -7
- package/dist/src/modules/v4/protocol/protocol.service.js +10 -10
- package/dist/src/modules/v4/reward/index.d.ts +0 -1
- package/dist/src/modules/v4/reward/index.js +0 -1
- package/dist/src/modules/v4/reward/reward.service.d.ts +5 -5
- package/dist/src/modules/v4/reward/reward.service.js +6 -7
- package/dist/src/modules/v4/router.d.ts +752 -245
- package/dist/src/modules/v4/status/index.d.ts +0 -1
- package/dist/src/modules/v4/status/index.js +0 -1
- package/dist/src/modules/v4/status/status.controller.d.ts +1 -1
- package/dist/src/modules/v4/status/status.repository.d.ts +1 -1
- package/dist/src/modules/v4/status/status.service.d.ts +2 -2
- package/dist/src/modules/v4/token/token.controller.d.ts +2 -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.repository.js +4 -1
- package/dist/src/modules/v4/token/token.service.d.ts +1 -0
- package/dist/src/modules/v4/token/token.service.js +10 -0
- package/dist/src/routes/v3/campaigns.d.ts +1 -1
- package/dist/src/routes/v3/router.d.ts +1 -1
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +2 -1
@@ -200,7 +200,7 @@ export declare const StatusController: Elysia<"/campaign-status", false, {
|
|
200
200
|
endOfDisputePeriod: number;
|
201
201
|
disputer: string;
|
202
202
|
liveCampaigns: number;
|
203
|
-
delayed: Awaited<ReturnType<typeof StatusService
|
203
|
+
delayed: Awaited<ReturnType<(typeof StatusService)["findManyDelay"]>>;
|
204
204
|
};
|
205
205
|
};
|
206
206
|
};
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import type { Prisma, RunStatus } from "../../../../database/api/.generated";
|
2
2
|
import { type CampaignUnique } from "../campaign";
|
3
3
|
import type { DelayModel, QueryCampaignStatus } from "./status.model";
|
4
|
-
export declare class StatusRepository {
|
4
|
+
export declare abstract class StatusRepository {
|
5
5
|
#private;
|
6
6
|
static findMany(query: QueryCampaignStatus): Promise<{
|
7
7
|
error: string;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { type CampaignUnique } from "../campaign";
|
2
2
|
import type { DelayModel, QueryCampaignStatus, UpdateStatusModel } from "./status.model";
|
3
|
-
export declare class StatusService {
|
3
|
+
export declare abstract class StatusService {
|
4
4
|
static findMany(query: QueryCampaignStatus): Promise<{
|
5
5
|
error: string;
|
6
6
|
details: import("database/api/.generated/runtime/library").JsonValue;
|
@@ -47,7 +47,7 @@ export declare class StatusService {
|
|
47
47
|
endOfDisputePeriod: number;
|
48
48
|
disputer: string;
|
49
49
|
liveCampaigns: number;
|
50
|
-
delayed: Awaited<ReturnType<typeof StatusService
|
50
|
+
delayed: Awaited<ReturnType<(typeof StatusService)["findManyDelay"]>>;
|
51
51
|
}>>;
|
52
52
|
static findManyDelay(query: DelayModel): Promise<{
|
53
53
|
delay: number;
|
@@ -140,6 +140,7 @@ export declare const TokenController: Elysia<"/tokens", false, {
|
|
140
140
|
query: {
|
141
141
|
symbol?: string | undefined;
|
142
142
|
name?: string | undefined;
|
143
|
+
id?: string[] | undefined;
|
143
144
|
chainId?: number | undefined;
|
144
145
|
address?: string | undefined;
|
145
146
|
displaySymbol?: string | undefined;
|
@@ -172,6 +173,7 @@ export declare const TokenController: Elysia<"/tokens", false, {
|
|
172
173
|
query: {
|
173
174
|
symbol?: string | undefined;
|
174
175
|
name?: string | undefined;
|
176
|
+
id?: string[] | undefined;
|
175
177
|
chainId?: number | undefined;
|
176
178
|
address?: string | undefined;
|
177
179
|
displaySymbol?: string | undefined;
|
@@ -32,6 +32,7 @@ export declare const FindUniqueTokenAllowanceDto: import("@sinclair/typebox").TO
|
|
32
32
|
spender: import("@sinclair/typebox").TString;
|
33
33
|
}>;
|
34
34
|
export declare const GetTokenQueryDto: import("@sinclair/typebox").TObject<{
|
35
|
+
id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
35
36
|
symbol: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
36
37
|
displaySymbol: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
37
38
|
chainId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
@@ -21,6 +21,7 @@ export const FindUniqueTokenAllowanceDto = t.Object({
|
|
21
21
|
spender: t.String(),
|
22
22
|
});
|
23
23
|
export const GetTokenQueryDto = t.Object({
|
24
|
+
id: t.Optional(t.Array(t.String())),
|
24
25
|
symbol: t.Optional(t.String()),
|
25
26
|
displaySymbol: t.Optional(t.String()), // To filter by displaySymbol or if null symbol
|
26
27
|
chainId: t.Optional(t.Numeric()),
|
@@ -32,12 +32,14 @@ export class TokenRepository {
|
|
32
32
|
return await apiDbClient.token.findUniqueOrThrow({ where: { id } });
|
33
33
|
}
|
34
34
|
static #transformQueryToPrismaFilters(query) {
|
35
|
+
const ids = query.id ? query.id.map(id => ({ id })) : [];
|
35
36
|
return {
|
36
37
|
where: {
|
37
38
|
OR: query.symbol
|
38
39
|
? [
|
39
40
|
{ symbol: { equals: query.symbol, mode: "insensitive" } },
|
40
41
|
{ displaySymbol: { equals: query.symbol, mode: "insensitive" } },
|
42
|
+
...ids,
|
41
43
|
]
|
42
44
|
: query.displaySymbol
|
43
45
|
? [
|
@@ -46,8 +48,9 @@ export class TokenRepository {
|
|
46
48
|
symbol: { equals: query.displaySymbol, mode: "insensitive" },
|
47
49
|
},
|
48
50
|
{ displaySymbol: { equals: query.displaySymbol, mode: "insensitive" } },
|
51
|
+
...ids,
|
49
52
|
]
|
50
|
-
:
|
53
|
+
: [...ids],
|
51
54
|
address: query.address ? { equals: query.address, mode: "insensitive" } : undefined,
|
52
55
|
chainId: query.chainId ? { equals: query.chainId } : undefined,
|
53
56
|
name: query.name ? { contains: query.name, mode: "insensitive" } : undefined,
|
@@ -175,6 +175,7 @@ export declare abstract class TokenService {
|
|
175
175
|
address: string;
|
176
176
|
chainId: number;
|
177
177
|
}[]): Promise<number>;
|
178
|
+
static getValueByTokenId(tokenAmountMap: Map<string, bigint>): Promise<number>;
|
178
179
|
/**
|
179
180
|
* Counts the number of tokens that complies to query
|
180
181
|
* @description used for pagination purposes
|
@@ -250,6 +250,16 @@ export class TokenService {
|
|
250
250
|
return sum + value;
|
251
251
|
}, 0);
|
252
252
|
}
|
253
|
+
static async getValueByTokenId(tokenAmountMap) {
|
254
|
+
const ids = Array.from(tokenAmountMap.keys());
|
255
|
+
const tokens = await TokenService.findMany({ id: ids });
|
256
|
+
if (tokens.length !== ids.length)
|
257
|
+
throw new Error("Cannot find one or more token(s) in the database.");
|
258
|
+
let totalValue = 0;
|
259
|
+
for (const token of tokens)
|
260
|
+
totalValue += (bigIntToNumber(tokenAmountMap.get(token.id) ?? 0n, token.decimals) ?? 0) * (token.price ?? 0);
|
261
|
+
return totalValue;
|
262
|
+
}
|
253
263
|
/**
|
254
264
|
* Counts the number of tokens that complies to query
|
255
265
|
* @description used for pagination purposes
|
@@ -27,8 +27,8 @@ declare const _default: (app: Elysia) => Elysia<"", false, {
|
|
27
27
|
query: {
|
28
28
|
types?: string | number | string[] | number[] | undefined;
|
29
29
|
chainIds?: string | string[] | undefined;
|
30
|
-
creatorTag?: string | undefined;
|
31
30
|
live?: boolean | undefined;
|
31
|
+
creatorTag?: string | undefined;
|
32
32
|
hideTestTokens?: string | undefined;
|
33
33
|
};
|
34
34
|
headers: unknown;
|
@@ -73,8 +73,8 @@ export declare const v3: Elysia<"/v3", false, {
|
|
73
73
|
query: {
|
74
74
|
types?: string | number | string[] | number[] | undefined;
|
75
75
|
chainIds?: string | string[] | undefined;
|
76
|
-
creatorTag?: string | undefined;
|
77
76
|
live?: boolean | undefined;
|
77
|
+
creatorTag?: string | undefined;
|
78
78
|
hideTestTokens?: string | undefined;
|
79
79
|
};
|
80
80
|
headers: unknown;
|