OP-3702 Add governance pools

This commit is contained in:
Dmitry Leleko
2023-04-05 02:06:34 +03:00
parent 9584eb2edc
commit d830996741
5 changed files with 32 additions and 92 deletions

View File

@@ -12,6 +12,7 @@ import {
cfdContractsSchema,
cfdHistorySchema,
governanceContractsSchema,
governancePoolsSchema,
} from './schemas/index.js';
import type redeemOrderSchema from '../OrionAggregator/schemas/redeemOrderSchema.js';
import { sourceAtomicHistorySchema, targetAtomicHistorySchema } from './schemas/atomicHistorySchema.js';
@@ -106,6 +107,7 @@ 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);
}
get orionBlockchainWsUrl() {
@@ -429,6 +431,11 @@ class OrionBlockchain {
`${this.apiUrl}/api/governance/info`,
governanceContractsSchema,
);
getGovernancePools = () => fetchWithValidation(
`${this.apiUrl}/api/governance/pools`,
governancePoolsSchema,
);
}
export * as schemas from './schemas/index.js';

View File

@@ -0,0 +1,21 @@
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(),
farm_address: z.string(),
pool_tokens: z.tuple([z.string(), z.string()]),
pool_rewards: z.tuple([z.string(), z.string()]),
liquidity_locked: z.number(),
base_apy: z.number(),
max_apy: z.number(),
reward_per_week: z.number(),
})
);
export default governancePoolsSchema;

View File

@@ -15,3 +15,4 @@ 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';