OP-4214 Add /api/pools-v3/info

This commit is contained in:
Dmitry Leleko
2023-07-31 17:58:51 +03:00
parent 58dfb58067
commit 6102f02f1a
4 changed files with 22 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@orionprotocol/sdk",
"version": "0.19.40",
"version": "0.19.40-rc1",
"description": "Orion Protocol SDK",
"main": "./lib/index.cjs",
"module": "./lib/index.js",

View File

@@ -2,6 +2,7 @@ import { z } from 'zod';
import {
IDOSchema, atomicHistorySchema,
poolsConfigSchema, poolsInfoSchema, infoSchema, historySchema,
poolsV3InfoSchema,
type addPoolSchema, adminPoolsListSchema, adminPoolSchema,
atomicSummarySchema,
poolsLpAndStakedSchema,
@@ -80,6 +81,7 @@ class BlockchainService {
this.getPoolsLpAndStaked = this.getPoolsLpAndStaked.bind(this);
this.getUserVotes = this.getUserVotes.bind(this);
this.getUserEarned = this.getUserEarned.bind(this);
this.getPoolsV3Info = this.getPoolsV3Info.bind(this);
this.getHistory = this.getHistory.bind(this);
this.getPrices = this.getPrices.bind(this);
this.getTokensFee = this.getTokensFee.bind(this);
@@ -200,6 +202,12 @@ class BlockchainService {
{ headers: this.basicAuthHeaders }
);
getPoolsV3Info = () => fetchWithValidation(
`${this.apiUrl}/api/pools-v3/info`,
poolsV3InfoSchema,
{ headers: this.basicAuthHeaders }
);
getHistory = (address: string) => fetchWithValidation(
`${this.apiUrl}/api/history/${address}`,
historySchema,
@@ -325,18 +333,18 @@ class BlockchainService {
checkAuth = (headers: IAdminAuthHeaders) => fetchWithValidation(`${this.apiUrl}/api/auth/check`, z.object({
auth: z.boolean(),
}), { headers: { ...headers, ...this.basicAuthHeaders }});
}), { headers: { ...headers, ...this.basicAuthHeaders } });
getPool = (address: string, headers: IAdminAuthHeaders) => fetchWithValidation(
`${this.apiUrl}/api/pools/${address}`,
adminPoolSchema,
{ headers: { ...headers, ...this.basicAuthHeaders }},
{ headers: { ...headers, ...this.basicAuthHeaders } },
);
getPoolsList = (headers: IAdminAuthHeaders) => fetchWithValidation(
`${this.apiUrl}/api/pools/list`,
adminPoolsListSchema,
{ headers: { ...headers, ...this.basicAuthHeaders }},
{ headers: { ...headers, ...this.basicAuthHeaders } },
);
editPool = (address: string, data: IEditPool, headers: IAdminAuthHeaders) => fetchWithValidation(

View File

@@ -16,3 +16,4 @@ export { default as governanceContractsSchema } from './governanceContractsSchem
export { default as governancePoolsSchema } from './governancePoolsSchema.js';
export { default as governancePoolSchema } from './governancePoolSchema.js';
export { default as governanceChainsInfoSchema } from './governanceChainsInfoSchema.js';
export { default as poolsV3InfoSchema } from './poolsV3InfoSchema.js';

View File

@@ -0,0 +1,9 @@
import { z } from 'zod';
const poolsV3InfoSchema = z.object({
OrionV3Factory: z.string(),
OrionV3Pool: z.string(),
OrionV3NFTManager: z.string(),
});
export default poolsV3InfoSchema;