OP-2529 Add new pools routes (#23)

* OP-2529 Add new pools routes

* OP-2529 Add new pools routes
This commit is contained in:
Dmitry
2022-08-22 15:23:43 +03:00
committed by GitHub
parent 8454366828
commit c8a0373db2
6 changed files with 49 additions and 1 deletions

View File

@@ -6,6 +6,9 @@ import {
poolsConfigSchema, poolsInfoSchema, infoSchema, historySchema,
addPoolSchema, adminPoolsListSchema,
atomicSummarySchema,
poolsLpAndStakedSchema,
userVotesSchema,
userEarnedSchema,
} from './schemas';
import redeemOrderSchema from '../OrionAggregator/schemas/redeemOrderSchema';
import { sourceAtomicHistorySchema, targetAtomicHistorySchema } from './schemas/atomicHistorySchema';
@@ -62,6 +65,9 @@ class OrionBlockchain {
this.getInfo = this.getInfo.bind(this);
this.getPoolsConfig = this.getPoolsConfig.bind(this);
this.getPoolsInfo = this.getPoolsInfo.bind(this);
this.getPoolsLpAndStaked = this.getPoolsLpAndStaked.bind(this);
this.getUserVotes = this.getUserVotes.bind(this);
this.getUserEarned = this.getUserEarned.bind(this);
this.getHistory = this.getHistory.bind(this);
this.getPrices = this.getPrices.bind(this);
this.getTokensFee = this.getTokensFee.bind(this);
@@ -143,6 +149,21 @@ class OrionBlockchain {
poolsInfoSchema,
);
getPoolsLpAndStaked = (address: string) => fetchWithValidation(
`${this.apiUrl}/api/pools/user-lp/${address}`,
poolsLpAndStakedSchema,
);
getUserVotes = (address: string) => fetchWithValidation(
`${this.apiUrl}/api/pools/user-votes/${address}`,
userVotesSchema,
);
getUserEarned = (address: string) => fetchWithValidation(
`${this.apiUrl}/api/pools/user-earned/${address}`,
userEarnedSchema,
);
getHistory = (address: string) => fetchWithValidation(
`${this.apiUrl}/api/history/${address}`,
historySchema,