diff --git a/package-lock.json b/package-lock.json index 09e70ba..a4f2bd6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/package.json b/package.json index 18bd40b..064b553 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/services/OrionBlockchain/index.ts b/src/services/OrionBlockchain/index.ts index e8eec6c..0c5db43 100644 --- a/src/services/OrionBlockchain/index.ts +++ b/src/services/OrionBlockchain/index.ts @@ -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'; diff --git a/src/services/OrionBlockchain/schemas/governanceContractsSchema.ts b/src/services/OrionBlockchain/schemas/governanceContractsSchema.ts new file mode 100644 index 0000000..5c407ae --- /dev/null +++ b/src/services/OrionBlockchain/schemas/governanceContractsSchema.ts @@ -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; diff --git a/src/services/OrionBlockchain/schemas/index.ts b/src/services/OrionBlockchain/schemas/index.ts index 570f71a..297c77b 100644 --- a/src/services/OrionBlockchain/schemas/index.ts +++ b/src/services/OrionBlockchain/schemas/index.ts @@ -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';