diff --git a/package-lock.json b/package-lock.json index 800671f..e5cdf1f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@orionprotocol/sdk", - "version": "0.18.3", + "version": "0.18.7-rc0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@orionprotocol/sdk", - "version": "0.18.3", + "version": "0.18.7-rc0", "license": "ISC", "dependencies": { "@babel/runtime": "^7.21.0", @@ -3212,23 +3212,6 @@ "node": ">=10" } }, - "node_modules/@typescript-eslint/scope-manager": { - "version": "5.57.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.57.0.tgz", - "integrity": "sha512-NANBNOQvllPlizl9LatX8+MHi7bx7WGIWYjPHDmQe5Si/0YEYfxSljJpoTyTWFTgRy3X8gLYSE4xQ2U+aCozSw==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "5.57.0", - "@typescript-eslint/visitor-keys": "5.57.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, "node_modules/@typescript-eslint/type-utils": { "version": "5.57.1", "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.57.1.tgz", @@ -3328,61 +3311,6 @@ "node": ">=10" } }, - "node_modules/@typescript-eslint/types": { - "version": "5.57.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.57.0.tgz", - "integrity": "sha512-mxsod+aZRSyLT+jiqHw1KK6xrANm19/+VFALVFP5qa/aiJnlP38qpyaTd0fEKhWvQk6YeNZ5LGwI1pDpBRBhtQ==", - "dev": true, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/typescript-estree": { - "version": "5.57.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.57.0.tgz", - "integrity": "sha512-LTzQ23TV82KpO8HPnWuxM2V7ieXW8O142I7hQTxWIHDcCEIjtkat6H96PFkYBQqGFLW/G/eVVOB9Z8rcvdY/Vw==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "5.57.0", - "@typescript-eslint/visitor-keys": "5.57.0", - "debug": "^4.3.4", - "globby": "^11.1.0", - "is-glob": "^4.0.3", - "semver": "^7.3.7", - "tsutils": "^3.21.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", - "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", - "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/@typescript-eslint/utils": { "version": "5.57.1", "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.57.1.tgz", @@ -3498,23 +3426,6 @@ "node": ">=10" } }, - "node_modules/@typescript-eslint/visitor-keys": { - "version": "5.57.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.57.0.tgz", - "integrity": "sha512-ery2g3k0hv5BLiKpPuwYt9KBkAp2ugT6VvyShXdLOkax895EC55sP0Tx5L0fZaQueiK3fBLvHVvEl3jFS5ia+g==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "5.57.0", - "eslint-visitor-keys": "^3.3.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, "node_modules/@webassemblyjs/ast": { "version": "1.11.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.1.tgz", diff --git a/package.json b/package.json index 5166046..5e449b7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@orionprotocol/sdk", - "version": "0.18.6", + "version": "0.18.7-rc0", "description": "Orion Protocol SDK", "main": "./lib/index.cjs", "module": "./lib/index.js", diff --git a/src/services/OrionBlockchain/index.ts b/src/services/OrionBlockchain/index.ts index a42ce49..e8f3680 100644 --- a/src/services/OrionBlockchain/index.ts +++ b/src/services/OrionBlockchain/index.ts @@ -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'; diff --git a/src/services/OrionBlockchain/schemas/governancePoolsSchema.ts b/src/services/OrionBlockchain/schemas/governancePoolsSchema.ts new file mode 100644 index 0000000..a2cf5f5 --- /dev/null +++ b/src/services/OrionBlockchain/schemas/governancePoolsSchema.ts @@ -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; diff --git a/src/services/OrionBlockchain/schemas/index.ts b/src/services/OrionBlockchain/schemas/index.ts index 3d5bfec..e862163 100644 --- a/src/services/OrionBlockchain/schemas/index.ts +++ b/src/services/OrionBlockchain/schemas/index.ts @@ -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';