mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-04-11 05:28:06 +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:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@orionprotocol/sdk",
|
"name": "@orionprotocol/sdk",
|
||||||
"version": "0.14.0",
|
"version": "0.14.1-rc.0",
|
||||||
"description": "Orion Protocol SDK",
|
"description": "Orion Protocol SDK",
|
||||||
"main": "./lib/esm/index.js",
|
"main": "./lib/esm/index.js",
|
||||||
"module": "./lib/esm/index.js",
|
"module": "./lib/esm/index.js",
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ import {
|
|||||||
poolsConfigSchema, poolsInfoSchema, infoSchema, historySchema,
|
poolsConfigSchema, poolsInfoSchema, infoSchema, historySchema,
|
||||||
addPoolSchema, adminPoolsListSchema,
|
addPoolSchema, adminPoolsListSchema,
|
||||||
atomicSummarySchema,
|
atomicSummarySchema,
|
||||||
|
poolsLpAndStakedSchema,
|
||||||
|
userVotesSchema,
|
||||||
|
userEarnedSchema,
|
||||||
} from './schemas';
|
} from './schemas';
|
||||||
import redeemOrderSchema from '../OrionAggregator/schemas/redeemOrderSchema';
|
import redeemOrderSchema from '../OrionAggregator/schemas/redeemOrderSchema';
|
||||||
import { sourceAtomicHistorySchema, targetAtomicHistorySchema } from './schemas/atomicHistorySchema';
|
import { sourceAtomicHistorySchema, targetAtomicHistorySchema } from './schemas/atomicHistorySchema';
|
||||||
@@ -62,6 +65,9 @@ class OrionBlockchain {
|
|||||||
this.getInfo = this.getInfo.bind(this);
|
this.getInfo = this.getInfo.bind(this);
|
||||||
this.getPoolsConfig = this.getPoolsConfig.bind(this);
|
this.getPoolsConfig = this.getPoolsConfig.bind(this);
|
||||||
this.getPoolsInfo = this.getPoolsInfo.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.getHistory = this.getHistory.bind(this);
|
||||||
this.getPrices = this.getPrices.bind(this);
|
this.getPrices = this.getPrices.bind(this);
|
||||||
this.getTokensFee = this.getTokensFee.bind(this);
|
this.getTokensFee = this.getTokensFee.bind(this);
|
||||||
@@ -143,6 +149,21 @@ class OrionBlockchain {
|
|||||||
poolsInfoSchema,
|
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(
|
getHistory = (address: string) => fetchWithValidation(
|
||||||
`${this.apiUrl}/api/history/${address}`,
|
`${this.apiUrl}/api/history/${address}`,
|
||||||
historySchema,
|
historySchema,
|
||||||
|
|||||||
@@ -8,3 +8,6 @@ export { default as infoSchema } from './infoSchema';
|
|||||||
export { default as poolsConfigSchema } from './poolsConfigSchema';
|
export { default as poolsConfigSchema } from './poolsConfigSchema';
|
||||||
export { default as poolsInfoSchema } from './poolsInfoSchema';
|
export { default as poolsInfoSchema } from './poolsInfoSchema';
|
||||||
export { default as atomicSummarySchema } from './atomicSummarySchema';
|
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