@merkl/api 0.16.40 → 0.16.42
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/campaignsForMainParameter.js +4 -0
- package/dist/src/routes/v3/router.d.ts +1 -1
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +2 -1
@@ -25,6 +25,8 @@ export const ChainArrayOptionalDto = t.Object({
|
|
25
25
|
});
|
26
26
|
export const UpdateChainDto = t.Object({
|
27
27
|
icon: t.Optional(t.String({ format: "uri" })),
|
28
|
+
dailyRewards: t.Optional(t.Number({})),
|
29
|
+
liveCampaigns: t.Optional(t.Number()),
|
28
30
|
// iconFile: t.Optional(t.File()),
|
29
31
|
});
|
30
32
|
export const CreateChainDto = t.Object({
|
@@ -1,7 +1,5 @@
|
|
1
|
-
import type { Campaign, CampaignParameters } from "@sdk";
|
2
1
|
import type { ChainSearchDto, CreateChainModel, UpdateChainModel } from "./chain.model";
|
3
|
-
export declare
|
4
|
-
#private;
|
2
|
+
export declare class ChainRepository {
|
5
3
|
/**
|
6
4
|
* @param id ChainId
|
7
5
|
* @returns
|
@@ -18,6 +16,14 @@ export declare abstract class ChainRepository {
|
|
18
16
|
id: number;
|
19
17
|
icon: string;
|
20
18
|
}) | null>;
|
19
|
+
static transformQueryToPrismaFilters(query: ChainSearchDto): {
|
20
|
+
where: {
|
21
|
+
name: {
|
22
|
+
contains: string;
|
23
|
+
mode: "insensitive";
|
24
|
+
} | undefined;
|
25
|
+
};
|
26
|
+
};
|
21
27
|
/** Returns many chains based on query
|
22
28
|
* @param query object with fields to search for
|
23
29
|
* @returns
|
@@ -61,14 +67,6 @@ export declare abstract class ChainRepository {
|
|
61
67
|
chainId: number;
|
62
68
|
}[];
|
63
69
|
}>;
|
64
|
-
/**
|
65
|
-
* Fetches the campaign dynamic data for a v3 campaign onchain
|
66
|
-
* @param chainId
|
67
|
-
* @param campaignType
|
68
|
-
* @param campaigns of v3 type
|
69
|
-
* @returns
|
70
|
-
*/
|
71
|
-
static fetchDynamicDataV3<C extends Campaign>(chainId: number, campaignType: C, campaigns: CampaignParameters<C>[]): Promise<any>;
|
72
70
|
static update(id: number, data: UpdateChainModel): Promise<{
|
73
71
|
name: string;
|
74
72
|
id: number;
|
@@ -1,5 +1,3 @@
|
|
1
|
-
import { campaignsDynamicData } from "../../../libs/campaigns/campaignsDynamicData";
|
2
|
-
import { executeSimple } from "../../../utils/execute";
|
3
1
|
import { apiDbClient } from "../../../utils/prisma";
|
4
2
|
import { ExplorerRepository } from "../explorer/explorer.repository";
|
5
3
|
export class ChainRepository {
|
@@ -9,9 +7,9 @@ export class ChainRepository {
|
|
9
7
|
*/
|
10
8
|
static async read(id) {
|
11
9
|
//TODO: tweak query to not have 5
|
12
|
-
return apiDbClient.chain.findUnique({ where: { id }, include: { Explorer: { take: 5 } } });
|
10
|
+
return await apiDbClient.chain.findUnique({ where: { id }, include: { Explorer: { take: 5 } } });
|
13
11
|
}
|
14
|
-
static
|
12
|
+
static transformQueryToPrismaFilters(query) {
|
15
13
|
return {
|
16
14
|
where: { name: query.name ? { contains: query.name, mode: "insensitive" } : undefined },
|
17
15
|
};
|
@@ -21,14 +19,14 @@ export class ChainRepository {
|
|
21
19
|
* @returns
|
22
20
|
*/
|
23
21
|
static async findMany(query) {
|
24
|
-
const args = ChainRepository
|
22
|
+
const args = ChainRepository.transformQueryToPrismaFilters(query);
|
25
23
|
return apiDbClient.chain.findMany({
|
26
24
|
include: { Explorer: { take: 5 } },
|
27
25
|
...args,
|
28
26
|
});
|
29
27
|
}
|
30
28
|
static async countMany(query) {
|
31
|
-
const args = ChainRepository
|
29
|
+
const args = ChainRepository.transformQueryToPrismaFilters(query);
|
32
30
|
return apiDbClient.chain.count({
|
33
31
|
...args,
|
34
32
|
});
|
@@ -57,7 +55,7 @@ export class ChainRepository {
|
|
57
55
|
return await ChainRepository.findUniqueOrThrow(data.id);
|
58
56
|
}
|
59
57
|
static async findUniqueOrThrow(id) {
|
60
|
-
return apiDbClient.chain.findUniqueOrThrow({
|
58
|
+
return await apiDbClient.chain.findUniqueOrThrow({
|
61
59
|
where: {
|
62
60
|
id,
|
63
61
|
},
|
@@ -66,17 +64,6 @@ export class ChainRepository {
|
|
66
64
|
},
|
67
65
|
});
|
68
66
|
}
|
69
|
-
/**
|
70
|
-
* Fetches the campaign dynamic data for a v3 campaign onchain
|
71
|
-
* @param chainId
|
72
|
-
* @param campaignType
|
73
|
-
* @param campaigns of v3 type
|
74
|
-
* @returns
|
75
|
-
*/
|
76
|
-
static async fetchDynamicDataV3(chainId, campaignType, campaigns) {
|
77
|
-
const calls = campaignsDynamicData(chainId, campaigns, campaignType);
|
78
|
-
return executeSimple(chainId, calls);
|
79
|
-
}
|
80
67
|
static async update(id, data) {
|
81
68
|
return await apiDbClient.chain.update({ where: { id }, data });
|
82
69
|
}
|
@@ -11,7 +11,7 @@ export class ChainService {
|
|
11
11
|
return await CacheService.wrap(TTLPresets.HOUR_4, ChainRepository.findMany, query);
|
12
12
|
}
|
13
13
|
static async countMany(query) {
|
14
|
-
return ChainRepository.countMany(query);
|
14
|
+
return await ChainRepository.countMany(query);
|
15
15
|
}
|
16
16
|
/** List all chainIds available in the databse
|
17
17
|
* @warning some chains may not be fully integrated yet
|
@@ -42,4 +42,7 @@ export class ChainService {
|
|
42
42
|
static async update(id, data) {
|
43
43
|
return await ChainRepository.update(id, data);
|
44
44
|
}
|
45
|
+
static async updateDailyRewards(id, dailyRewards) {
|
46
|
+
return await ChainRepository.update(id, { dailyRewards });
|
47
|
+
}
|
45
48
|
}
|
@@ -1,3 +1,8 @@
|
|
1
|
-
|
1
|
+
import { ChainRepository } from "./chain.repository";
|
2
|
+
import { ChainService } from "./chain.service";
|
2
3
|
export * from "./chain.service";
|
3
4
|
export * from "./chain.model";
|
5
|
+
export const initChainService = (dbClient) => {
|
6
|
+
const repository = new ChainRepository(dbClient);
|
7
|
+
return new ChainService(repository);
|
8
|
+
};
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { GetCampaignComputedValueModel, GetUserComputedValuesModel, UpsertCampaignComputedValueModel, UpsertUserComputedValuesModel } from "./computedValue.model";
|
2
|
-
export declare class ComputedValueRepository {
|
2
|
+
export declare abstract class ComputedValueRepository {
|
3
3
|
static findCampaignValue(params: GetCampaignComputedValueModel): Promise<{
|
4
4
|
averageBoost: number | null;
|
5
5
|
totalDistributedInUSD: number | null;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { GetCampaignComputedValueModel, GetUserComputedValuesModel, UpsertCampaignComputedValueModel, UpsertUserComputedValuesModel } from "./computedValue.model";
|
2
|
-
export declare class ComputedValueService {
|
2
|
+
export declare abstract class ComputedValueService {
|
3
3
|
static findCampaignValue(params: GetCampaignComputedValueModel): Promise<{
|
4
4
|
averageBoost: number | null;
|
5
5
|
totalDistributedInUSD: number | null;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { campaignsDynamicData } from "../../../libs/campaigns/campaignsDynamicData";
|
1
|
+
// import { campaignsDynamicData } from "../../../libs/campaigns/campaignsDynamicData";
|
2
2
|
import { CampaignRepository } from "../campaign/campaign.repository";
|
3
3
|
import { CampaignService } from "../campaign/campaign.service";
|
4
4
|
import { OpportunityService } from "../opportunity/opportunity.service";
|
@@ -5,18 +5,7 @@ export declare abstract class EnsoService {
|
|
5
5
|
#private;
|
6
6
|
static getSlug(protocolId: ProtocolId | string): EnsoSlug | undefined;
|
7
7
|
static getProtocolId(slug: EnsoSlug | string): ProtocolId | undefined;
|
8
|
-
static getCompatibleProtocols(query: GetInteractionProtocolsQuery): Promise<
|
9
|
-
name: string;
|
10
|
-
url: string;
|
11
|
-
description: string;
|
12
|
-
id: string;
|
13
|
-
tags: string[];
|
14
|
-
icon: string;
|
15
|
-
} & {
|
16
|
-
dailyRewards?: number | undefined;
|
17
|
-
numberOfLiveCampaigns?: number | undefined;
|
18
|
-
opportunityLiveTags?: string[] | undefined;
|
19
|
-
})[]>;
|
8
|
+
static getCompatibleProtocols(query: GetInteractionProtocolsQuery): Promise<any>;
|
20
9
|
static getTokens(chainId: number, slug: EnsoSlug, identifier?: string): Promise<{
|
21
10
|
type: "base" | "defi";
|
22
11
|
chainId: number;
|
@@ -40,18 +40,8 @@ export declare const InteractionController: Elysia<"/interaction", false, {
|
|
40
40
|
};
|
41
41
|
headers: unknown;
|
42
42
|
response: {
|
43
|
-
|
44
|
-
|
45
|
-
url: string;
|
46
|
-
description: string;
|
47
|
-
id: string;
|
48
|
-
tags: string[];
|
49
|
-
icon: string;
|
50
|
-
} & {
|
51
|
-
dailyRewards?: number | undefined;
|
52
|
-
numberOfLiveCampaigns?: number | undefined;
|
53
|
-
opportunityLiveTags?: string[] | undefined;
|
54
|
-
})[];
|
43
|
+
[x: string]: any;
|
44
|
+
200: any;
|
55
45
|
};
|
56
46
|
};
|
57
47
|
};
|