OP-3702 Add governancePoolSchema

This commit is contained in:
Dmitry Leleko
2023-04-11 02:13:10 +03:00
parent e847e5a913
commit bbf054bc74
5 changed files with 29 additions and 3 deletions

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "@orionprotocol/sdk",
"version": "0.18.13-rc2",
"version": "0.18.13-rc3",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@orionprotocol/sdk",
"version": "0.18.13-rc2",
"version": "0.18.13-rc3",
"license": "ISC",
"dependencies": {
"@babel/runtime": "^7.21.0",

View File

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

View File

@@ -13,6 +13,7 @@ import {
cfdHistorySchema,
governanceContractsSchema,
governancePoolsSchema,
governancePoolSchema,
} from './schemas/index.js';
import type redeemOrderSchema from '../OrionAggregator/schemas/redeemOrderSchema.js';
import { sourceAtomicHistorySchema, targetAtomicHistorySchema } from './schemas/atomicHistorySchema.js';
@@ -108,6 +109,7 @@ class OrionBlockchain {
this.getCFDHistory = this.getCFDHistory.bind(this);
this.getGovernanceContracts = this.getGovernanceContracts.bind(this);
this.getGovernancePools = this.getGovernancePools.bind(this);
this.getGovernancePool = this.getGovernancePool.bind(this);
}
get orionBlockchainWsUrl() {
@@ -436,6 +438,11 @@ class OrionBlockchain {
`${this.apiUrl}/api/governance/pools`,
governancePoolsSchema,
);
getGovernancePool = (address: string) => fetchWithValidation(
`${this.apiUrl}/api/governance/pools/${address}`,
governancePoolSchema,
);
}
export * as schemas from './schemas/index.js';

View File

@@ -0,0 +1,18 @@
import { z } from 'zod';
const governancePoolSchema = z.object({
base_apr: z.number(),
max_apr: z.number(),
tvl: z.string(),
lp_supply: z.string(),
lp_staked: z.string(),
lp_staked_with_boost: z.string(),
lp_price: z.string(),
reward_per_period: z.number(),
lock_time_for_max_multiplier: z.string(),
lock_max_multiplier: z.string(),
veorn_max_multiplier: z.string(),
veorn_boost_scale_factor: z.string(),
});
export default governancePoolSchema;

View File

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