mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-15 22:52:36 +03:00
OP-2529 Add new pools routes (#23)
* OP-2529 Add new pools routes * OP-2529 Add new pools routes
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -8,3 +8,6 @@ export { default as infoSchema } from './infoSchema';
|
||||
export { default as poolsConfigSchema } from './poolsConfigSchema';
|
||||
export { default as poolsInfoSchema } from './poolsInfoSchema';
|
||||
export { default as atomicSummarySchema } from './atomicSummarySchema';
|
||||
export { default as poolsLpAndStakedSchema } from './poolsLpAndStakedSchema';
|
||||
export { default as userVotesSchema } from './userVotesSchema';
|
||||
export { default as userEarnedSchema } from './userEarnedSchema';
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
const poolsLpAndStakedSchema = z.record(
|
||||
z.object({
|
||||
unstakedLPBalance: z.string(),
|
||||
stakedLPBalance: z.string(),
|
||||
}),
|
||||
);
|
||||
|
||||
export default poolsLpAndStakedSchema;
|
||||
7
src/services/OrionBlockchain/schemas/userEarnedSchema.ts
Normal file
7
src/services/OrionBlockchain/schemas/userEarnedSchema.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
const userEarnedSchema = z.record(
|
||||
z.string(),
|
||||
);
|
||||
|
||||
export default userEarnedSchema;
|
||||
7
src/services/OrionBlockchain/schemas/userVotesSchema.ts
Normal file
7
src/services/OrionBlockchain/schemas/userVotesSchema.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
const userVotesSchema = z.record(
|
||||
z.string(),
|
||||
);
|
||||
|
||||
export default userVotesSchema;
|
||||
Reference in New Issue
Block a user