mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-17 00:31:34 +03:00
OP-3565 Add governance contracts (#70)
This commit is contained in:
4
package-lock.json
generated
4
package-lock.json
generated
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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;
|
||||
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user