@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.
- package/dist/database/api/.generated/edge.js +6 -3
- package/dist/database/api/.generated/index-browser.js +3 -0
- package/dist/database/api/.generated/index.d.ts +113 -0
- package/dist/database/api/.generated/index.js +6 -3
- package/dist/database/api/.generated/package.json +1 -1
- package/dist/database/api/.generated/schema.prisma +17 -15
- package/dist/database/api/.generated/wasm.js +3 -0
- package/dist/src/cache/declaration.d.ts +0 -30
- package/dist/src/cache/declaration.js +0 -30
- package/dist/src/eden/index.d.ts +167 -15
- package/dist/src/index.d.ts +59 -5
- package/dist/src/libs/campaigns/campaignTypes/CLAMMDynamicData.js +2 -2
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/factoryFinder.js +2 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.d.ts +3 -1
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/helpers/tokenType.js +8 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/PendleYTProcessor.d.ts +29 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/PendleYTProcessor.js +31 -0
- package/dist/src/libs/campaigns/campaignTypes/ERC20SubTypes/processor/processorMapping.js +3 -0
- package/dist/src/libs/positions/clamm/index.d.ts +1 -2
- package/dist/src/libs/positions/clamm/index.js +322 -330
- package/dist/src/libs/positions/clamm/thegraph/fetchAlmPositions.d.ts +1 -1
- package/dist/src/libs/positions/clamm/thegraph/fetchAlmPositions.js +1 -1
- package/dist/src/libs/positions/clamm/thegraph/fetchAmmPositions.d.ts +1 -1
- package/dist/src/libs/positions/clamm/thegraph/fetchAmmPositions.js +2 -2
- package/dist/src/libs/positions/clamm/thegraph/fetchFarmedPositions.d.ts +1 -2
- package/dist/src/libs/positions/clamm/thegraph/fetchFarmedPositions.js +1 -4
- package/dist/src/libs/positions/euler/index.js +2 -3
- package/dist/src/libs/positions/index.js +1 -1
- package/dist/src/modules/v4/campaign/campaign.controller.d.ts +6 -2
- package/dist/src/modules/v4/campaign/campaign.model.d.ts +1 -0
- package/dist/src/modules/v4/campaign/campaign.model.js +1 -0
- package/dist/src/modules/v4/campaign/campaign.repository.d.ts +2 -0
- package/dist/src/modules/v4/campaign/campaign.repository.js +2 -1
- package/dist/src/modules/v4/campaign/campaign.service.d.ts +10 -5
- package/dist/src/modules/v4/campaign/campaign.service.js +10 -2
- package/dist/src/modules/v4/opportunity/opportunity.controller.d.ts +20 -3
- package/dist/src/modules/v4/opportunity/opportunity.model.d.ts +2 -1
- package/dist/src/modules/v4/opportunity/opportunity.model.js +1 -0
- package/dist/src/modules/v4/opportunity/opportunity.repository.d.ts +83 -5
- package/dist/src/modules/v4/opportunity/opportunity.repository.js +31 -0
- package/dist/src/modules/v4/opportunity/opportunity.service.d.ts +162 -8
- package/dist/src/modules/v4/opportunity/opportunity.service.js +11 -0
- package/dist/src/modules/v4/position/implementations/AjnaPositionFetcher.d.ts +6 -0
- package/dist/src/modules/v4/position/implementations/AjnaPositionFetcher.js +90 -0
- package/dist/src/modules/v4/position/implementations/BadgerPositionFetcher.d.ts +6 -0
- package/dist/src/modules/v4/position/implementations/BadgerPositionFetcher.js +69 -0
- package/dist/src/modules/v4/position/implementations/ClammPositionFetcher.d.ts +6 -0
- package/dist/src/modules/v4/position/implementations/ClammPositionFetcher.js +71 -0
- package/dist/src/modules/v4/position/implementations/DolomitePositionFetcher.d.ts +6 -0
- package/dist/src/modules/v4/position/implementations/DolomitePositionFetcher.js +45 -0
- package/dist/src/modules/v4/position/implementations/ERC20PositionFetcher.d.ts +6 -0
- package/dist/src/modules/v4/position/implementations/ERC20PositionFetcher.js +47 -0
- package/dist/src/modules/v4/position/implementations/EulerPositionFetcher.d.ts +6 -0
- package/dist/src/modules/v4/position/implementations/EulerPositionFetcher.js +40 -0
- package/dist/src/modules/v4/position/index.d.ts +2 -0
- package/dist/src/modules/v4/position/index.js +2 -0
- package/dist/src/modules/v4/position/position.controller.d.ts +39 -0
- package/dist/src/modules/v4/position/position.controller.js +16 -0
- package/dist/src/modules/v4/position/position.model.d.ts +25 -0
- package/dist/src/modules/v4/position/position.model.js +5 -0
- package/dist/src/modules/v4/position/position.repository.d.ts +14 -0
- package/dist/src/modules/v4/position/position.repository.js +6 -0
- package/dist/src/modules/v4/position/position.service.d.ts +5 -0
- package/dist/src/modules/v4/position/position.service.js +34 -0
- package/dist/src/modules/v4/price/price.controller.js +1 -1
- package/dist/src/modules/v4/price/price.service.d.ts +1 -1
- package/dist/src/modules/v4/price/price.service.js +3 -3
- package/dist/src/modules/v4/reward/reward.repository.d.ts +4 -0
- package/dist/src/modules/v4/reward/reward.service.d.ts +27 -0
- package/dist/src/modules/v4/reward/reward.service.js +5 -2
- package/dist/src/modules/v4/router.d.ts +59 -5
- package/dist/src/modules/v4/router.js +3 -1
- package/dist/src/modules/v4/token/token.controller.d.ts +6 -0
- package/dist/src/modules/v4/token/token.service.d.ts +12 -0
- package/dist/src/modules/v4/user/user.controller.d.ts +8 -0
- package/dist/src/routes/v1/prices.js +2 -4
- package/dist/src/routes/v3/blacklist.d.ts +59 -5
- package/dist/src/routes/v3/campaigns.d.ts +60 -6
- package/dist/src/routes/v3/campaignsInfo.d.ts +59 -5
- package/dist/src/routes/v3/multiChainPositions.d.ts +59 -5
- package/dist/src/routes/v3/opportunity.d.ts +59 -5
- package/dist/src/routes/v3/positions.d.ts +59 -5
- package/dist/src/routes/v3/recipients.d.ts +6 -2
- package/dist/src/routes/v3/recipients.js +14 -8
- package/dist/src/routes/v3/rewards.d.ts +59 -5
- package/dist/src/routes/v3/updates.d.ts +59 -5
- package/dist/src/routes/v3/userRewards.d.ts +59 -5
- package/dist/src/utils/decodeCalls.js +4 -1
- package/dist/src/utils/encodeCalls.js +4 -1
- package/dist/src/utils/generateCardName.js +2 -0
- package/dist/src/utils/prices/services/erc4626Service.js +10 -4
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/src/libs/reports/campaignReport.d.ts +0 -9
- package/dist/src/libs/reports/campaignReport.js +0 -37
- package/dist/src/libs/reports/mainParameterRewards.d.ts +0 -3
- package/dist/src/libs/reports/mainParameterRewards.js +0 -48
@@ -0,0 +1,6 @@
|
|
1
|
+
import { type MerklChainId } from "@sdk";
|
2
|
+
import type { Opportunity } from "../../opportunity";
|
3
|
+
import type { PositionFetcher, PositionT } from "../position.model";
|
4
|
+
export declare class EulerPositionFetcher implements PositionFetcher {
|
5
|
+
fetchPositions: (chainId: MerklChainId, user: string, opportunities: Opportunity["model"][]) => Promise<PositionT[]>;
|
6
|
+
}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import { BN2Number, Campaign, ChainInteractionService, ERC20Interface } from "@sdk";
|
2
|
+
const campaignType = Campaign.EULER;
|
3
|
+
export class EulerPositionFetcher {
|
4
|
+
fetchPositions = async (chainId, user, opportunities) => {
|
5
|
+
opportunities = opportunities.filter(o => o.type === Campaign[campaignType] && o.tokens?.length > 0 && o.chainId === chainId);
|
6
|
+
const calls = [];
|
7
|
+
for (const opportunity of opportunities) {
|
8
|
+
// Call per opportunity
|
9
|
+
for (const token of opportunity.tokens) {
|
10
|
+
calls.push({
|
11
|
+
allowFailure: true,
|
12
|
+
callData: ERC20Interface.encodeFunctionData("balanceOf", [user]),
|
13
|
+
target: token.address,
|
14
|
+
});
|
15
|
+
}
|
16
|
+
}
|
17
|
+
const res = await ChainInteractionService(chainId).fetchState(calls);
|
18
|
+
const result = [];
|
19
|
+
for (const [index, opportunity] of opportunities.entries()) {
|
20
|
+
// Decoding calls per opportunity
|
21
|
+
for (const [subIndex, token] of opportunity.tokens.entries()) {
|
22
|
+
const balance = ERC20Interface.decodeFunctionResult("balanceOf", res[index + subIndex].returnData)[0].toString();
|
23
|
+
if (BigInt(balance) > 0n) {
|
24
|
+
const position = {
|
25
|
+
flags: {},
|
26
|
+
opportunity,
|
27
|
+
tokens: [
|
28
|
+
{
|
29
|
+
token,
|
30
|
+
breakdown: [{ type: "balance", value: BN2Number(balance, token.decimals) }],
|
31
|
+
},
|
32
|
+
],
|
33
|
+
};
|
34
|
+
result.push(position);
|
35
|
+
}
|
36
|
+
}
|
37
|
+
}
|
38
|
+
return result;
|
39
|
+
};
|
40
|
+
}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import { Elysia } from "elysia";
|
2
|
+
export declare const PositionController: Elysia<"/positions", false, {
|
3
|
+
decorator: {};
|
4
|
+
store: {};
|
5
|
+
derive: {};
|
6
|
+
resolve: {};
|
7
|
+
}, {
|
8
|
+
type: {};
|
9
|
+
error: {};
|
10
|
+
}, {
|
11
|
+
schema: {};
|
12
|
+
macro: {};
|
13
|
+
macroFn: {};
|
14
|
+
}, {
|
15
|
+
positions: {
|
16
|
+
index: {
|
17
|
+
get: {
|
18
|
+
body: unknown;
|
19
|
+
params: {};
|
20
|
+
query: {
|
21
|
+
chainId: number;
|
22
|
+
address: string;
|
23
|
+
};
|
24
|
+
headers: unknown;
|
25
|
+
response: {
|
26
|
+
200: any[];
|
27
|
+
};
|
28
|
+
};
|
29
|
+
};
|
30
|
+
};
|
31
|
+
}, {
|
32
|
+
derive: {};
|
33
|
+
resolve: {};
|
34
|
+
schema: {};
|
35
|
+
}, {
|
36
|
+
derive: {};
|
37
|
+
resolve: {};
|
38
|
+
schema: {};
|
39
|
+
}>;
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { throwOnInvalidRequiredAddress, throwOnUnsupportedChainId } from "../../../utils/throw";
|
2
|
+
import { Elysia } from "elysia";
|
3
|
+
import { PositionsInputDto } from "./position.model";
|
4
|
+
import { PositionService } from "./position.service";
|
5
|
+
// ─── Positions Controller ──────────────────────────────────────────────
|
6
|
+
export const PositionController = new Elysia({ prefix: "/positions", detail: { tags: ["Positions"] } })
|
7
|
+
// ─── Get User Positions on a Chain ───────────────────────────────────
|
8
|
+
.get("/", async ({ query }) => {
|
9
|
+
return await PositionService.fetchPositions(query);
|
10
|
+
}, {
|
11
|
+
query: PositionsInputDto,
|
12
|
+
beforeHandle: ({ query }) => {
|
13
|
+
throwOnUnsupportedChainId(query.chainId);
|
14
|
+
query.address = throwOnInvalidRequiredAddress(query.address);
|
15
|
+
},
|
16
|
+
});
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import type { MerklChainId } from "@sdk";
|
2
|
+
import type { Opportunity } from "../opportunity";
|
3
|
+
export type PositionT = {
|
4
|
+
flags: {
|
5
|
+
range?: string;
|
6
|
+
id?: string;
|
7
|
+
link?: string;
|
8
|
+
};
|
9
|
+
opportunity: Opportunity["model"];
|
10
|
+
tokens: {
|
11
|
+
token: Opportunity["model"]["tokens"][0];
|
12
|
+
breakdown: {
|
13
|
+
type: string;
|
14
|
+
value: number;
|
15
|
+
}[];
|
16
|
+
}[];
|
17
|
+
};
|
18
|
+
export interface PositionFetcher {
|
19
|
+
fetchPositions(chainId: MerklChainId, user: string, opportunity: Opportunity["model"][]): Promise<PositionT[]>;
|
20
|
+
}
|
21
|
+
export declare const PositionsInputDto: import("@sinclair/typebox").TObject<{
|
22
|
+
chainId: import("@sinclair/typebox").TNumber;
|
23
|
+
address: import("@sinclair/typebox").TString;
|
24
|
+
}>;
|
25
|
+
export type PositionsInputModel = typeof PositionsInputDto.static;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import type { MerklChainId } from "@sdk";
|
2
|
+
export declare class PositionRepository {
|
3
|
+
static findManyDolomitePositions(chainId: MerklChainId, user: string): Promise<{
|
4
|
+
balance: string;
|
5
|
+
token: {
|
6
|
+
id: string;
|
7
|
+
marketId: string;
|
8
|
+
symbol: string;
|
9
|
+
decimals: string;
|
10
|
+
borrowLiquidity: string;
|
11
|
+
supplyLiquidity: string;
|
12
|
+
};
|
13
|
+
}[]>;
|
14
|
+
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import { MERKL_USER_POSITION_FETCHING_GLOBAL_TIMEOUT } from "../../../constants";
|
2
|
+
import { Campaign, withTimeout } from "@sdk";
|
3
|
+
import { OpportunityService } from "../opportunity";
|
4
|
+
import { AjnaPositionFetcher } from "./implementations/AjnaPositionFetcher";
|
5
|
+
import { BadgerPositionFetcher } from "./implementations/BadgerPositionFetcher";
|
6
|
+
import { ClammPositionFetcher } from "./implementations/ClammPositionFetcher";
|
7
|
+
import { DolomitePositionFetcher } from "./implementations/DolomitePositionFetcher";
|
8
|
+
import { ERC20PositionFetcher } from "./implementations/ERC20PositionFetcher";
|
9
|
+
import { EulerPositionFetcher } from "./implementations/EulerPositionFetcher";
|
10
|
+
export class PositionService {
|
11
|
+
static #fetchers = {
|
12
|
+
[Campaign.ERC20]: new ERC20PositionFetcher(),
|
13
|
+
[Campaign.EULER]: new EulerPositionFetcher(),
|
14
|
+
[Campaign.AJNA]: new AjnaPositionFetcher(),
|
15
|
+
[Campaign.BADGER]: new BadgerPositionFetcher(),
|
16
|
+
[Campaign.CLAMM]: new ClammPositionFetcher(),
|
17
|
+
[Campaign.DOLOMITE]: new DolomitePositionFetcher(),
|
18
|
+
};
|
19
|
+
static async fetchPositions(query) {
|
20
|
+
const opportunities = await OpportunityService.findLiveWithFirstCampaign(query.chainId);
|
21
|
+
const promises = [];
|
22
|
+
for (const campaignType of Object.keys(Campaign)) {
|
23
|
+
const fetcher = PositionService.#fetchers[Number.parseInt(campaignType)];
|
24
|
+
if (fetcher) {
|
25
|
+
promises.push(withTimeout(fetcher.fetchPositions(query.chainId, query.address, opportunities.filter(o => !!o)), MERKL_USER_POSITION_FETCHING_GLOBAL_TIMEOUT));
|
26
|
+
}
|
27
|
+
}
|
28
|
+
const settledPromises = await Promise.allSettled(promises);
|
29
|
+
for (const errors of settledPromises.filter(p => p.status === "rejected")) {
|
30
|
+
console.error(errors.reason);
|
31
|
+
}
|
32
|
+
return settledPromises.filter(p => p.status === "fulfilled").flatMap(p => p.value);
|
33
|
+
}
|
34
|
+
}
|
@@ -9,7 +9,7 @@ export const PriceController = new Elysia({ prefix: "/prices", detail: { tags: [
|
|
9
9
|
.get("/", async () => await PriceService.findMany())
|
10
10
|
.get("/array", async () => await PriceService.findManyArray())
|
11
11
|
// ─── Get Price By Token Symbol ───────────────────────────────────────
|
12
|
-
.get("/symbol/:symbol", async ({ params }) => await PriceService.
|
12
|
+
.get("/symbol/:symbol", async ({ params }) => await PriceService.fetchPriceBySymbol(params.symbol), {
|
13
13
|
params: PriceSourceIdentifier,
|
14
14
|
})
|
15
15
|
// ─── Price Sources Group ─────────────────────────────────────────────
|
@@ -8,7 +8,7 @@ export declare class PriceService {
|
|
8
8
|
token: string;
|
9
9
|
}[]>;
|
10
10
|
/** Fetches a single price */
|
11
|
-
static
|
11
|
+
static fetchPriceBySymbol(symbol: string): Promise<number>;
|
12
12
|
static getPriceSourceBySymbol(symbol: string): Promise<{
|
13
13
|
symbol: string;
|
14
14
|
method: import("../../../../database/api/.generated").$Enums.PriceSourceMethod;
|
@@ -11,7 +11,7 @@ export class PriceService {
|
|
11
11
|
return (await Pricer.load()).getArray();
|
12
12
|
}
|
13
13
|
/** Fetches a single price */
|
14
|
-
static async
|
14
|
+
static async fetchPriceBySymbol(symbol) {
|
15
15
|
const priceSource = await PriceRepository.findBySymbolOrThrow(symbol);
|
16
16
|
if (!priceSource) {
|
17
17
|
throw new Error(`Price source with symbol ${symbol} not found`);
|
@@ -20,7 +20,7 @@ export class PriceService {
|
|
20
20
|
return priceSource.args.value;
|
21
21
|
}
|
22
22
|
if (priceSource.method === PriceSourceMethod.EQUAL_TO) {
|
23
|
-
return PriceService.
|
23
|
+
return PriceService.fetchPriceBySymbol(priceSource.args.token);
|
24
24
|
}
|
25
25
|
return (await PriceFetcherFactory.instance.get(priceSource.method).getPrice([priceSource]))?.[0]?.rate;
|
26
26
|
}
|
@@ -33,7 +33,7 @@ export class PriceService {
|
|
33
33
|
}
|
34
34
|
static async createPriceSource(priceSource) {
|
35
35
|
const created = await PriceRepository.create(priceSource);
|
36
|
-
return await PriceService.
|
36
|
+
return await PriceService.fetchPriceBySymbol(created.symbol);
|
37
37
|
}
|
38
38
|
static async updatePriceSource(symbol, newPriceSource) {
|
39
39
|
return await PriceRepository.updateBySymbol(symbol, newPriceSource);
|
@@ -12,7 +12,9 @@ export declare abstract class RewardRepository {
|
|
12
12
|
address: string;
|
13
13
|
icon: string;
|
14
14
|
decimals: number;
|
15
|
+
displaySymbol: string;
|
15
16
|
verified: boolean;
|
17
|
+
isTest: boolean;
|
16
18
|
price: number | null;
|
17
19
|
};
|
18
20
|
Breakdown: ({
|
@@ -32,7 +34,9 @@ export declare abstract class RewardRepository {
|
|
32
34
|
address: string;
|
33
35
|
icon: string;
|
34
36
|
decimals: number;
|
37
|
+
displaySymbol: string;
|
35
38
|
verified: boolean;
|
39
|
+
isTest: boolean;
|
36
40
|
price: number | null;
|
37
41
|
}[];
|
38
42
|
Protocols: {
|
@@ -29,7 +29,9 @@ export declare abstract class RewardService {
|
|
29
29
|
address: string;
|
30
30
|
icon: string;
|
31
31
|
decimals: number;
|
32
|
+
displaySymbol: string;
|
32
33
|
verified: boolean;
|
34
|
+
isTest: boolean;
|
33
35
|
price: number | null;
|
34
36
|
}[];
|
35
37
|
Protocols: {
|
@@ -83,7 +85,9 @@ export declare abstract class RewardService {
|
|
83
85
|
address: string;
|
84
86
|
icon: string;
|
85
87
|
decimals: number;
|
88
|
+
displaySymbol: string;
|
86
89
|
verified: boolean;
|
90
|
+
isTest: boolean;
|
87
91
|
price: number | null;
|
88
92
|
};
|
89
93
|
breakdowns: {
|
@@ -102,7 +106,9 @@ export declare abstract class RewardService {
|
|
102
106
|
address: string;
|
103
107
|
icon: string;
|
104
108
|
decimals: number;
|
109
|
+
displaySymbol: string;
|
105
110
|
verified: boolean;
|
111
|
+
isTest: boolean;
|
106
112
|
price: number | null;
|
107
113
|
}[];
|
108
114
|
Protocols: {
|
@@ -159,7 +165,9 @@ export declare abstract class RewardService {
|
|
159
165
|
address: string;
|
160
166
|
icon: string;
|
161
167
|
decimals: number;
|
168
|
+
displaySymbol: string;
|
162
169
|
verified: boolean;
|
170
|
+
isTest: boolean;
|
163
171
|
price: number | null;
|
164
172
|
};
|
165
173
|
Breakdown: ({
|
@@ -179,7 +187,9 @@ export declare abstract class RewardService {
|
|
179
187
|
address: string;
|
180
188
|
icon: string;
|
181
189
|
decimals: number;
|
190
|
+
displaySymbol: string;
|
182
191
|
verified: boolean;
|
192
|
+
isTest: boolean;
|
183
193
|
price: number | null;
|
184
194
|
}[];
|
185
195
|
Protocols: {
|
@@ -265,7 +275,9 @@ export declare abstract class RewardService {
|
|
265
275
|
address: string;
|
266
276
|
icon: string;
|
267
277
|
decimals: number;
|
278
|
+
displaySymbol: string;
|
268
279
|
verified: boolean;
|
280
|
+
isTest: boolean;
|
269
281
|
price: number | null;
|
270
282
|
};
|
271
283
|
breakdowns: {
|
@@ -284,7 +296,9 @@ export declare abstract class RewardService {
|
|
284
296
|
address: string;
|
285
297
|
icon: string;
|
286
298
|
decimals: number;
|
299
|
+
displaySymbol: string;
|
287
300
|
verified: boolean;
|
301
|
+
isTest: boolean;
|
288
302
|
price: number | null;
|
289
303
|
}[];
|
290
304
|
Protocols: {
|
@@ -355,7 +369,9 @@ export declare abstract class RewardService {
|
|
355
369
|
address: string;
|
356
370
|
icon: string;
|
357
371
|
decimals: number;
|
372
|
+
displaySymbol: string;
|
358
373
|
verified: boolean;
|
374
|
+
isTest: boolean;
|
359
375
|
price: number | null;
|
360
376
|
};
|
361
377
|
breakdowns: {
|
@@ -374,7 +390,9 @@ export declare abstract class RewardService {
|
|
374
390
|
address: string;
|
375
391
|
icon: string;
|
376
392
|
decimals: number;
|
393
|
+
displaySymbol: string;
|
377
394
|
verified: boolean;
|
395
|
+
isTest: boolean;
|
378
396
|
price: number | null;
|
379
397
|
}[];
|
380
398
|
Protocols: {
|
@@ -442,7 +460,9 @@ export declare abstract class RewardService {
|
|
442
460
|
address: string;
|
443
461
|
icon: string;
|
444
462
|
decimals: number;
|
463
|
+
displaySymbol: string;
|
445
464
|
verified: boolean;
|
465
|
+
isTest: boolean;
|
446
466
|
price: number | null;
|
447
467
|
};
|
448
468
|
Breakdown: ({
|
@@ -462,7 +482,9 @@ export declare abstract class RewardService {
|
|
462
482
|
address: string;
|
463
483
|
icon: string;
|
464
484
|
decimals: number;
|
485
|
+
displaySymbol: string;
|
465
486
|
verified: boolean;
|
487
|
+
isTest: boolean;
|
466
488
|
price: number | null;
|
467
489
|
}[];
|
468
490
|
Protocols: {
|
@@ -532,6 +554,11 @@ export declare abstract class RewardService {
|
|
532
554
|
campaignId: string;
|
533
555
|
amount: bigint;
|
534
556
|
}>;
|
557
|
+
static getAmountAndClaimedForCampaigns(x: CampaignIdWithoutPageModel): Promise<{
|
558
|
+
campaignId: string;
|
559
|
+
amount: string;
|
560
|
+
claimed: string;
|
561
|
+
}[]>;
|
535
562
|
static getUnclaimed(x: CampaignIdWithoutPageModel): Promise<Record<string, string>>;
|
536
563
|
static extractDailyRewardsRecordFromDynamicData<C extends Campaign>(type: C, dynamicData: CampaignDynamicData<C>[], timestamp?: bigint): Promise<DailyRewardsRecord["model"]>;
|
537
564
|
}
|
@@ -259,13 +259,16 @@ export class RewardService {
|
|
259
259
|
const root = await MerklRootService.fetch(query.chainId);
|
260
260
|
return RewardRepository.total(CampaignService.hashId({ distributionChain: query.chainId, campaignId: query.campaignId }), root.live);
|
261
261
|
}
|
262
|
+
static async getAmountAndClaimedForCampaigns(x) {
|
263
|
+
const currentRoot = await MerklRootService.fetch(x.chainId);
|
264
|
+
return await RewardRepository.getAmountAndClaimedForCampaigns(currentRoot.live, x);
|
265
|
+
}
|
262
266
|
static async getUnclaimed(x) {
|
263
267
|
const campaignToCampaignIds = x.campaignIds.reduce((acc, campaignId) => {
|
264
268
|
acc[CampaignService.hashId({ distributionChain: x.chainId, campaignId })] = campaignId;
|
265
269
|
return acc;
|
266
270
|
}, {});
|
267
|
-
const
|
268
|
-
const data = await RewardRepository.getAmountAndClaimedForCampaigns(currentRoot.live, x);
|
271
|
+
const data = await RewardService.getAmountAndClaimedForCampaigns(x);
|
269
272
|
return data.reduce((acc, { amount, campaignId, claimed }) => {
|
270
273
|
if (!acc[campaignToCampaignIds[campaignId]])
|
271
274
|
acc[campaignToCampaignIds[campaignId]] = "0";
|
@@ -101,7 +101,9 @@ export declare const v4: Elysia<"/v4", false, {
|
|
101
101
|
address: string;
|
102
102
|
icon: string;
|
103
103
|
decimals: number;
|
104
|
+
displaySymbol: string;
|
104
105
|
verified: boolean;
|
106
|
+
isTest: boolean;
|
105
107
|
price: number | null;
|
106
108
|
};
|
107
109
|
amount: bigint;
|
@@ -116,7 +118,9 @@ export declare const v4: Elysia<"/v4", false, {
|
|
116
118
|
address: string;
|
117
119
|
icon: string;
|
118
120
|
decimals: number;
|
121
|
+
displaySymbol: string;
|
119
122
|
verified: boolean;
|
123
|
+
isTest: boolean;
|
120
124
|
price: number | null;
|
121
125
|
}[];
|
122
126
|
chain: {
|
@@ -200,7 +204,9 @@ export declare const v4: Elysia<"/v4", false, {
|
|
200
204
|
address: string;
|
201
205
|
icon: string;
|
202
206
|
decimals: number;
|
207
|
+
displaySymbol: string;
|
203
208
|
verified: boolean;
|
209
|
+
isTest: boolean;
|
204
210
|
price: number | null;
|
205
211
|
};
|
206
212
|
amount: bigint;
|
@@ -215,7 +221,9 @@ export declare const v4: Elysia<"/v4", false, {
|
|
215
221
|
address: string;
|
216
222
|
icon: string;
|
217
223
|
decimals: number;
|
224
|
+
displaySymbol: string;
|
218
225
|
verified: boolean;
|
226
|
+
isTest: boolean;
|
219
227
|
price: number | null;
|
220
228
|
}[];
|
221
229
|
chain: {
|
@@ -241,7 +249,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
241
249
|
tvl: number;
|
242
250
|
apr: number;
|
243
251
|
dailyRewards: number;
|
244
|
-
campaigns:
|
252
|
+
campaigns: {
|
245
253
|
params: any;
|
246
254
|
chain: {
|
247
255
|
name: string;
|
@@ -256,7 +264,9 @@ export declare const v4: Elysia<"/v4", false, {
|
|
256
264
|
address: string;
|
257
265
|
icon: string;
|
258
266
|
decimals: number;
|
267
|
+
displaySymbol: string;
|
259
268
|
verified: boolean;
|
269
|
+
isTest: boolean;
|
260
270
|
price: number | null;
|
261
271
|
};
|
262
272
|
distributionChain: {
|
@@ -284,7 +294,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
284
294
|
amount: string;
|
285
295
|
opportunityId: string;
|
286
296
|
creatorAddress: string;
|
287
|
-
}
|
297
|
+
}[];
|
288
298
|
} | null | undefined;
|
289
299
|
};
|
290
300
|
};
|
@@ -309,6 +319,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
309
319
|
action?: string | undefined;
|
310
320
|
mainProtocolId?: string | undefined;
|
311
321
|
order?: undefined;
|
322
|
+
test?: boolean | undefined;
|
312
323
|
minimumTvl?: number | undefined;
|
313
324
|
};
|
314
325
|
headers: unknown;
|
@@ -354,7 +365,9 @@ export declare const v4: Elysia<"/v4", false, {
|
|
354
365
|
address: string;
|
355
366
|
icon: string;
|
356
367
|
decimals: number;
|
368
|
+
displaySymbol: string;
|
357
369
|
verified: boolean;
|
370
|
+
isTest: boolean;
|
358
371
|
price: number | null;
|
359
372
|
};
|
360
373
|
amount: bigint;
|
@@ -369,7 +382,9 @@ export declare const v4: Elysia<"/v4", false, {
|
|
369
382
|
address: string;
|
370
383
|
icon: string;
|
371
384
|
decimals: number;
|
385
|
+
displaySymbol: string;
|
372
386
|
verified: boolean;
|
387
|
+
isTest: boolean;
|
373
388
|
price: number | null;
|
374
389
|
}[];
|
375
390
|
chain: {
|
@@ -418,6 +433,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
418
433
|
action?: string | undefined;
|
419
434
|
mainProtocolId?: string | undefined;
|
420
435
|
order?: undefined;
|
436
|
+
test?: boolean | undefined;
|
421
437
|
minimumTvl?: number | undefined;
|
422
438
|
};
|
423
439
|
headers: unknown;
|
@@ -448,12 +464,13 @@ export declare const v4: Elysia<"/v4", false, {
|
|
448
464
|
action?: string | undefined;
|
449
465
|
mainProtocolId?: string | undefined;
|
450
466
|
order?: undefined;
|
467
|
+
test?: boolean | undefined;
|
451
468
|
minimumTvl?: number | undefined;
|
452
469
|
};
|
453
470
|
headers: unknown;
|
454
471
|
response: {
|
455
472
|
200: {
|
456
|
-
sum:
|
473
|
+
sum: number | null;
|
457
474
|
};
|
458
475
|
};
|
459
476
|
};
|
@@ -523,10 +540,11 @@ export declare const v4: Elysia<"/v4", false, {
|
|
523
540
|
campaignId?: string | undefined;
|
524
541
|
opportunityId?: string | undefined;
|
525
542
|
tokenSymbol?: string | undefined;
|
543
|
+
test?: boolean | undefined;
|
526
544
|
};
|
527
545
|
headers: unknown;
|
528
546
|
response: {
|
529
|
-
200:
|
547
|
+
200: {
|
530
548
|
params: any;
|
531
549
|
chain: {
|
532
550
|
name: string;
|
@@ -541,7 +559,9 @@ export declare const v4: Elysia<"/v4", false, {
|
|
541
559
|
address: string;
|
542
560
|
icon: string;
|
543
561
|
decimals: number;
|
562
|
+
displaySymbol: string;
|
544
563
|
verified: boolean;
|
564
|
+
isTest: boolean;
|
545
565
|
price: number | null;
|
546
566
|
};
|
547
567
|
distributionChain: {
|
@@ -569,7 +589,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
569
589
|
amount: string;
|
570
590
|
opportunityId: string;
|
571
591
|
creatorAddress: string;
|
572
|
-
}
|
592
|
+
}[];
|
573
593
|
};
|
574
594
|
};
|
575
595
|
};
|
@@ -591,6 +611,7 @@ export declare const v4: Elysia<"/v4", false, {
|
|
591
611
|
campaignId?: string | undefined;
|
592
612
|
opportunityId?: string | undefined;
|
593
613
|
tokenSymbol?: string | undefined;
|
614
|
+
test?: boolean | undefined;
|
594
615
|
};
|
595
616
|
headers: unknown;
|
596
617
|
response: {
|
@@ -744,7 +765,9 @@ export declare const v4: Elysia<"/v4", false, {
|
|
744
765
|
address: string;
|
745
766
|
icon: string;
|
746
767
|
decimals: number;
|
768
|
+
displaySymbol: string;
|
747
769
|
verified: boolean;
|
770
|
+
isTest: boolean;
|
748
771
|
price?: number | null | undefined;
|
749
772
|
} | undefined;
|
750
773
|
};
|
@@ -773,7 +796,9 @@ export declare const v4: Elysia<"/v4", false, {
|
|
773
796
|
address: string;
|
774
797
|
icon: string;
|
775
798
|
decimals: number;
|
799
|
+
displaySymbol: string;
|
776
800
|
verified: boolean;
|
801
|
+
isTest: boolean;
|
777
802
|
} & {
|
778
803
|
price?: number | null | undefined;
|
779
804
|
} & {
|
@@ -806,7 +831,9 @@ export declare const v4: Elysia<"/v4", false, {
|
|
806
831
|
address: string;
|
807
832
|
icon: string;
|
808
833
|
decimals: number;
|
834
|
+
displaySymbol: string;
|
809
835
|
verified: boolean;
|
836
|
+
isTest: boolean;
|
810
837
|
} & {
|
811
838
|
price?: number | null | undefined;
|
812
839
|
})[];
|
@@ -1469,7 +1496,9 @@ export declare const v4: Elysia<"/v4", false, {
|
|
1469
1496
|
address: string;
|
1470
1497
|
icon: string;
|
1471
1498
|
decimals: number;
|
1499
|
+
displaySymbol: string;
|
1472
1500
|
verified: boolean;
|
1501
|
+
isTest: boolean;
|
1473
1502
|
price: number | null;
|
1474
1503
|
};
|
1475
1504
|
breakdowns: {
|
@@ -1488,7 +1517,9 @@ export declare const v4: Elysia<"/v4", false, {
|
|
1488
1517
|
address: string;
|
1489
1518
|
icon: string;
|
1490
1519
|
decimals: number;
|
1520
|
+
displaySymbol: string;
|
1491
1521
|
verified: boolean;
|
1522
|
+
isTest: boolean;
|
1492
1523
|
price: number | null;
|
1493
1524
|
}[];
|
1494
1525
|
Protocols: {
|
@@ -1579,7 +1610,9 @@ export declare const v4: Elysia<"/v4", false, {
|
|
1579
1610
|
address: string;
|
1580
1611
|
icon: string;
|
1581
1612
|
decimals: number;
|
1613
|
+
displaySymbol: string;
|
1582
1614
|
verified: boolean;
|
1615
|
+
isTest: boolean;
|
1583
1616
|
price: number | null;
|
1584
1617
|
};
|
1585
1618
|
breakdowns: {
|
@@ -1598,7 +1631,9 @@ export declare const v4: Elysia<"/v4", false, {
|
|
1598
1631
|
address: string;
|
1599
1632
|
icon: string;
|
1600
1633
|
decimals: number;
|
1634
|
+
displaySymbol: string;
|
1601
1635
|
verified: boolean;
|
1636
|
+
isTest: boolean;
|
1602
1637
|
price: number | null;
|
1603
1638
|
}[];
|
1604
1639
|
Protocols: {
|
@@ -2194,6 +2229,25 @@ export declare const v4: Elysia<"/v4", false, {
|
|
2194
2229
|
};
|
2195
2230
|
};
|
2196
2231
|
};
|
2232
|
+
} & {
|
2233
|
+
v4: {
|
2234
|
+
positions: {
|
2235
|
+
index: {
|
2236
|
+
get: {
|
2237
|
+
body: unknown;
|
2238
|
+
params: {};
|
2239
|
+
query: {
|
2240
|
+
chainId: number;
|
2241
|
+
address: string;
|
2242
|
+
};
|
2243
|
+
headers: unknown;
|
2244
|
+
response: {
|
2245
|
+
200: any[];
|
2246
|
+
};
|
2247
|
+
};
|
2248
|
+
};
|
2249
|
+
};
|
2250
|
+
};
|
2197
2251
|
}, {
|
2198
2252
|
derive: {};
|
2199
2253
|
resolve: {};
|