OP-3565 Add governance contracts (#70)

This commit is contained in:
Dmitry
2023-03-14 19:12:10 +03:00
committed by GitHub
parent 9f8ffa2ef4
commit e04d3bfd94
5 changed files with 32 additions and 3 deletions

4
package-lock.json generated
View File

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

View File

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

View File

@@ -12,6 +12,7 @@ import {
pairStatusSchema,
cfdContractsSchema,
cfdHistorySchema,
governanceContractsSchema,
} from './schemas';
import type redeemOrderSchema from '../OrionAggregator/schemas/redeemOrderSchema';
import { sourceAtomicHistorySchema, targetAtomicHistorySchema } from './schemas/atomicHistorySchema';
@@ -104,6 +105,7 @@ class OrionBlockchain {
this.claimOrder = this.claimOrder.bind(this);
this.getCFDContracts = this.getCFDContracts.bind(this);
this.getCFDHistory = this.getCFDHistory.bind(this);
this.getGovernanceContracts = this.getGovernanceContracts.bind(this);
}
get orionBlockchainWsUrl() {
@@ -422,6 +424,11 @@ class OrionBlockchain {
return fetchWithValidation(url.toString(), cfdHistorySchema);
};
getGovernanceContracts = () => fetchWithValidation(
`${this.apiUrl}/api/governance/info`,
governanceContractsSchema,
);
}
export * as schemas from './schemas';

View File

@@ -0,0 +1,21 @@
import { z } from 'zod';
const governanceContractsSchema = z.array(
z.object({
controllerAddress: z.string(),
veORNAddress: z.string(),
veORNYieldDistributorV4Address: z.string(),
orionGaugeORNRewardsDistributorAddress: z.string(),
time_total: z.string(),
info: z.record(
z.string(),
z.object({
gaugeAddress: z.string(),
gaugeType: z.number(),
gaugeName: z.string(),
})
),
})
);
export default governanceContractsSchema;

View File

@@ -14,3 +14,4 @@ export { default as userVotesSchema } from './userVotesSchema';
export { default as userEarnedSchema } from './userEarnedSchema';
export { default as cfdContractsSchema } from './cfdContractsSchema';
export { default as cfdHistorySchema } from './cfdHistorySchema';
export { default as governanceContractsSchema } from './governanceContractsSchema';