This commit is contained in:
Kirill Litvinov
2024-06-20 13:21:45 +03:00
parent b5d0e3f6c6
commit f91f87e376
4 changed files with 6 additions and 52 deletions

View File

@@ -1,7 +1,6 @@
import {
environmentResponseSchema,
getPointsAtResponseSchema,
getPointsInfoResponseSchema,
getPoolResponseSchema,
listAmountResponseSchema,
listNFTOrderResponseSchema,
@@ -53,12 +52,6 @@ type VeORNInfoPayload = BasePayload & {
params: [string]
};
type GetPointsInfoPayload = BasePayload & {
model: 'veORN'
method: 'pointsInfo'
params: [string]
};
type GetPointsAtPayload = BasePayload & {
model: 'veORN'
method: 'pointsInfo'
@@ -82,7 +75,6 @@ type Payload =
| GetPoolInfoPayload
| ListPoolPayload
| VeORNInfoPayload
| GetPointsInfoPayload
| GetPointsAtPayload
| ListAmountPayload
| GetAmountByORNPayload;
@@ -108,7 +100,6 @@ class IndexerService {
this.poolV2Info = this.poolV2Info.bind(this);
this.listPoolV3 = this.listPoolV3.bind(this);
this.veORNInfo = this.veORNInfo.bind(this);
this.getPointsInfo = this.getPointsInfo.bind(this);
this.getPointsAt = this.getPointsAt.bind(this);
this.listAmount = this.listAmount.bind(this);
this.getAmountByORN = this.getAmountByORN.bind(this);
@@ -136,18 +127,7 @@ class IndexerService {
});
};
readonly getPointsInfo = (address: string) => {
return fetchWithValidation(this.apiUrl, getPointsInfoResponseSchema, {
method: 'POST',
body: this.makeRPCPayload({
model: 'veORN',
method: 'pointsInfo',
params: [address],
}),
});
};
readonly getPointsAt = (timestamp = Date.now(), page?: number, pageSize?: number) => {
readonly getPointsAt = (timestamp = Date.now(), page = 1, pageSize = 1000) => {
return fetchWithValidation(this.apiUrl, getPointsAtResponseSchema, {
method: 'POST',
body: this.makeRPCPayload({

View File

@@ -1,27 +0,0 @@
import { z } from 'zod';
import { evmAddressSchema } from './util-schemas.js';
import infoSchema from './info-schema.js';
const getPointsResultSchema = z.object({
avgAPR: z.number(),
minAPR: z.number(),
maxAPR: z.number(),
veTokenAddress: evmAddressSchema,
totalPointsLocked: z.number(),
totalPoints: z.number(),
weeklyReward: z.number(),
userAPR: z.number(),
userPoints: z.number(),
userPointsLocked: z.number(),
userLockEndDate: z.number(),
userReward: z.number(),
userWeeklyReward: z.number(),
userMinLockPeriod: z.number(),
});
const getPointsInfoSchema = z.object({
result: getPointsResultSchema,
info: infoSchema,
}).nullable();
export default getPointsInfoSchema;

View File

@@ -9,5 +9,4 @@ export { default as veORNInfoResponseSchema } from './veORN-info-schema';
export { default as listAmountResponseSchema } from './list-amount-schema';
export { default as votingInfoResponseSchema } from './voting-info-schema';
export { default as testIncrementorSchema } from './test-incrementor-schema';
export { default as getPointsInfoResponseSchema } from './get-points-info-schema';
export { default as getPointsAtResponseSchema } from './get-points-at-schema';

View File

@@ -1,6 +1,6 @@
import { z } from 'zod';
import { evmAddressSchema } from './util-schemas.js';
import infoSchema from './info-schema.js';
import { z } from "zod";
import { evmAddressSchema } from "./util-schemas.js";
import infoSchema from "./info-schema.js";
const veORNResultSchema = z.object({
avgAPR: z.number(),
@@ -17,6 +17,8 @@ const veORNResultSchema = z.object({
userReward: z.number(),
userWeeklyReward: z.number(),
userMinLockPeriod: z.number(),
dropLock: z.boolean(),
pointsReward: z.number(),
});
const veORNInfoSchema = z.object({