OP-3735 referrals rating (#87)

This commit is contained in:
demidn
2023-04-07 04:56:27 +03:00
committed by GitHub
parent 9584eb2edc
commit c445d5c65e
5 changed files with 39 additions and 92 deletions

View File

@@ -7,6 +7,7 @@ import {
globalAnalyticsSchema,
rewardsClaimedSchema,
linkSchema,
ratingSchema,
} from './schemas/index.js';
type CreateLinkPayloadType = {
@@ -152,6 +153,14 @@ class ReferralSystem {
},
errorSchema
);
getRating = () =>
fetchWithValidation(
`${this.apiUrl}/referer/ve/rating-table-leaderboard`,
ratingSchema,
{},
errorSchema
);
}
export * as schemas from './schemas/index.js';

View File

@@ -5,3 +5,4 @@ export { default as miniStatsSchema } from './miniStatsSchema.js';
export { default as rewardsMappingSchema } from './rewardsMappingSchema.js';
export { default as rewardsClaimedSchema } from './rewardsClaimedSchema.js';
export { default as globalAnalyticsSchema } from './globalAnalyticsSchema.js';
export { default as ratingSchema } from './ratingSchema.js';

View File

@@ -0,0 +1,26 @@
import { z } from 'zod';
const ratingSchema = z.object({
info: z.object({
weekly_boost_budget: z.string(),
weekly_boost_budget_fmt: z.number(),
time_left_for_the_reward: z.number(),
time_left_for_the_reward_local: z.string(),
time_left_for_the_reward_utc: z.string(),
personal_info: z.any(),
}),
list: z.array(z.object({
rank_id: z.number(),
wallet: z.string(),
staked_ve_orn: z.string(),
staked_ve_orn_fmt: z.number(),
weighted_volume: z.string(),
weighted_volume_fmt: z.number(),
total_weight: z.string(),
total_weight_fmt: z.number(),
reward: z.string(),
reward_fmt: z.number()
})),
});
export default ratingSchema;