This commit is contained in:
Demid
2023-04-14 18:13:58 +03:00
5 changed files with 7857 additions and 31 deletions

7828
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -12,6 +12,8 @@ import {
cfdContractsSchema,
cfdHistorySchema,
governanceContractsSchema,
governancePoolsSchema,
governancePoolSchema,
} from './schemas/index.js';
import type redeemOrderSchema from '../OrionAggregator/schemas/redeemOrderSchema.js';
import { sourceAtomicHistorySchema, targetAtomicHistorySchema } from './schemas/atomicHistorySchema.js';
@@ -106,6 +108,8 @@ class OrionBlockchain {
this.getCFDContracts = this.getCFDContracts.bind(this);
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() {
@@ -429,6 +433,16 @@ class OrionBlockchain {
`${this.apiUrl}/api/governance/info`,
governanceContractsSchema,
);
getGovernancePools = () => fetchWithValidation(
`${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.union([z.null(), z.number()]),
max_apr: z.union([z.null(), z.number()]),
tvl: z.string(),
lp_supply: z.string(),
lp_staked: z.string(),
lp_staked_with_boost: z.string(),
lp_price_in_usd: z.string(),
reward_per_period: z.string(),
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

@@ -0,0 +1,26 @@
import { z } from 'zod';
const governancePoolsSchema = z.array(
z.object({
identifier: z.string(),
chain: z.string(),
platform: z.string(),
logo: z.string(),
pair: z.string(),
lp_address: z.string(),
lp_staked_with_boost: z.string(),
lp_total_supply: z.string(),
lp_price_in_usd: z.string(),
farm_address: z.string(),
pool_tokens: z.tuple([z.string(), z.string()]),
pool_rewards: z.array(z.string()),
tvl: z.string(),
base_apr: z.union([z.null(), z.number()]),
max_apr: z.union([z.null(), z.number()]),
reward_per_period: z.string(),
weight: z.string(),
liquidity: z.string(),
})
);
export default governancePoolsSchema;

View File

@@ -15,3 +15,5 @@ export { default as userEarnedSchema } from './userEarnedSchema.js';
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';