@merkl/api 0.10.237 → 0.10.239
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 +1 -1
- package/dist/src/entities/campaign.js +2 -1
- package/dist/src/modules/v4/campaign/campaign.service.js +2 -1
- package/dist/src/modules/v4/enso/enso.model.d.ts +1 -1
- package/dist/src/modules/v4/enso/enso.model.js +1 -1
- package/dist/src/modules/v4/kyberzap/kyberzap.model.d.ts +1 -1
- package/dist/src/modules/v4/kyberzap/kyberzap.model.js +1 -1
- package/dist/src/modules/v4/kyberzap/kyberzap.service.js +1 -1
- package/dist/src/modules/v4/reward/reward.service.js +2 -1
- package/dist/tsconfig.package.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/src/eden/index.d.ts
CHANGED
|
@@ -8919,5 +8919,5 @@ export type Campaign<C extends CampaignType = CampaignType> = CampaignResource<C
|
|
|
8919
8919
|
export type Chain = FromPromise<Api["v4"]["chains"]["index"]["get"]>;
|
|
8920
8920
|
export type Explorer = FromPromise<Api["v4"]["chains"]["index"]["get"]>["explorers"][number];
|
|
8921
8921
|
export type Token = FromPromise<Api["v4"]["tokens"]["index"]["get"]>;
|
|
8922
|
-
export type Reward = NonNullable<Awaited<ReturnType<ReturnType<Api["v4"]["users"]>["rewards"]["
|
|
8922
|
+
export type Reward = NonNullable<Awaited<ReturnType<ReturnType<Api["v4"]["users"]>["rewards"]["breakdowns"]["get"]>>["data"]>[number];
|
|
8923
8923
|
export {};
|
|
@@ -91,8 +91,9 @@ export function getRewardTokens(campaigns) {
|
|
|
91
91
|
const rewardTokens = {};
|
|
92
92
|
campaigns.forEach(({ amount, rewardToken, campaignParameters: { symbolRewardToken: symbol }, ...c }) => {
|
|
93
93
|
const timespan = Math.abs(c.endTimestamp - c.startTimestamp);
|
|
94
|
+
const isWithinTimespan = moment().unix() > c.startTimestamp && moment().unix() < c.endTimestamp;
|
|
94
95
|
const dayspan = Math.max(Math.floor(timespan / (60 * 60 * 24)), 1);
|
|
95
|
-
const dailyAmount = BigInt(amount) / BigInt(dayspan);
|
|
96
|
+
const dailyAmount = isWithinTimespan ? BigInt(amount) / BigInt(dayspan) : 0n;
|
|
96
97
|
if (!rewardTokens[symbol])
|
|
97
98
|
rewardTokens[symbol] = { amount: dailyAmount, address: rewardToken };
|
|
98
99
|
else
|
|
@@ -206,8 +206,9 @@ export class CampaignService {
|
|
|
206
206
|
*/
|
|
207
207
|
static getDailyAmount(start, end, amount) {
|
|
208
208
|
const timespan = Math.abs(Number(end - start));
|
|
209
|
+
const isWithinTimespan = moment().unix() > start && moment().unix() < end;
|
|
209
210
|
const dayspan = Math.max(1, Math.floor(timespan / (60 * 60 * 24)));
|
|
210
|
-
const dailyAmount = BigInt(amount) / BigInt(dayspan);
|
|
211
|
+
const dailyAmount = isWithinTimespan ? BigInt(amount) / BigInt(dayspan) : 0n;
|
|
211
212
|
return dailyAmount;
|
|
212
213
|
}
|
|
213
214
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const slugToProtocolId: {
|
|
2
2
|
readonly "uniswap-v2": "uniswap-v2";
|
|
3
|
-
readonly "aave-v2": "aave";
|
|
4
3
|
readonly "aave-v3": "aave";
|
|
4
|
+
readonly "aave-v2": "aave";
|
|
5
5
|
readonly "aave-static-atokens": "aave";
|
|
6
6
|
readonly "camelot-v2": "camelot";
|
|
7
7
|
readonly "meta-morpho": "morpho";
|
|
@@ -28,7 +28,7 @@ export declare const apiTypes: {
|
|
|
28
28
|
amountIn: import("@sinclair/typebox").TString;
|
|
29
29
|
feeAddress: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
30
30
|
feePcm: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
31
|
-
|
|
31
|
+
slippage: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
32
32
|
}>;
|
|
33
33
|
readonly response: import("@sinclair/typebox").TObject<{
|
|
34
34
|
message: import("@sinclair/typebox").TString;
|
|
@@ -40,7 +40,7 @@ export const apiTypes = {
|
|
|
40
40
|
amountIn: t.String(),
|
|
41
41
|
feeAddress: t.Optional(t.String()),
|
|
42
42
|
feePcm: t.Optional(t.Number()),
|
|
43
|
-
|
|
43
|
+
slippage: t.Optional(t.Number()),
|
|
44
44
|
}),
|
|
45
45
|
response: t.Object({
|
|
46
46
|
message: t.String({ example: "OK" }),
|
|
@@ -312,8 +312,9 @@ export class RewardService {
|
|
|
312
312
|
const breakdowns = [];
|
|
313
313
|
for (const { amount, rewardToken: address, chainId, startTimestamp: start, endTimestamp: end, campaignId, } of dynamicData) {
|
|
314
314
|
const timespan = Math.abs(end - start);
|
|
315
|
+
const isWithinTimespan = moment().unix() > start && moment().unix() < end;
|
|
315
316
|
const dayspan = Math.max(1, Math.floor(timespan / (60 * 60 * 24)));
|
|
316
|
-
const dailyAmount =
|
|
317
|
+
const dailyAmount = isWithinTimespan ? BigInt(amount) / BigInt(dayspan) : BigInt(0);
|
|
317
318
|
const campaignDailyValue = await TokenService.getValue([{ amount: dailyAmount, address, chainId }]);
|
|
318
319
|
breakdowns.push({
|
|
319
320
|
campaignId: CampaignService.hashId({ campaignId, distributionChain: chainId }),
|