diff --git a/package.json b/package.json index 68cf9ba..67bd4d9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@orionprotocol/sdk", - "version": "0.20.9", + "version": "0.20.10-rc0", "description": "Orion Protocol SDK", "main": "./lib/index.cjs", "module": "./lib/index.js", diff --git a/src/services/Integrator/index.ts b/src/services/Integrator/index.ts index 8154e52..11ae81b 100644 --- a/src/services/Integrator/index.ts +++ b/src/services/Integrator/index.ts @@ -3,7 +3,8 @@ import { getPoolResponseSchema, listAmountResponseSchema, listNFTOrderResponseSchema, - listPoolResponseSchema, + listPoolV2ResponseSchema, + listPoolV3ResponseSchema, testIncrementorSchema, veORNInfoResponseSchema, votingInfoResponseSchema @@ -84,7 +85,8 @@ class IntegratorService { this.getEnvironment = this.getEnvironment.bind(this); this.listNFTOrder = this.listNFTOrder.bind(this); this.getPoolInfo = this.getPoolInfo.bind(this); - this.listPool = this.listPool.bind(this); + this.listPoolV2 = this.listPoolV2.bind(this); + this.listPoolV3 = this.listPoolV3.bind(this); this.veORNInfo = this.veORNInfo.bind(this); this.listAmount = this.listAmount.bind(this); this.getAmountByORN = this.getAmountByORN.bind(this); @@ -178,8 +180,19 @@ class IntegratorService { }); }; - readonly listPool = (address?: string) => { - return fetchWithValidation(this.apiUrl, listPoolResponseSchema, { + readonly listPoolV2 = (address?: string) => { + return fetchWithValidation(this.apiUrl, listPoolV2ResponseSchema, { + method: 'POST', + body: this.makeRPCPayload({ + model: 'OrionFarmV2', + method: 'listPool', + params: [address], + }), + }); + }; + + readonly listPoolV3 = (address?: string) => { + return fetchWithValidation(this.apiUrl, listPoolV3ResponseSchema, { method: 'POST', body: this.makeRPCPayload({ model: 'OrionFarmV3', diff --git a/src/services/Integrator/schemas/index.ts b/src/services/Integrator/schemas/index.ts index e6e03b6..2d3c364 100644 --- a/src/services/Integrator/schemas/index.ts +++ b/src/services/Integrator/schemas/index.ts @@ -1,7 +1,8 @@ export { default as environmentResponseSchema } from './environment-response-schema.js'; export { default as listNFTOrderResponseSchema } from './list-nft-order-response-schema.js'; export { default as getPoolResponseSchema } from './get-pool-response-schema.js'; -export { default as listPoolResponseSchema } from './list-pool-response-schema.js'; +export { default as listPoolV2ResponseSchema } from './list-pool-v2-response-schema.js'; +export { default as listPoolV3ResponseSchema } from './list-pool-v3-response-schema.js'; export { default as veORNInfoResponseSchema } from './veORN-info-schema.js'; export { default as listAmountResponseSchema } from './list-amount-schema.js'; export { default as votingInfoResponseSchema } from './voting-info-schema.js'; diff --git a/src/services/Integrator/schemas/list-pool-v2-response-schema.ts b/src/services/Integrator/schemas/list-pool-v2-response-schema.ts new file mode 100644 index 0000000..f8ad119 --- /dev/null +++ b/src/services/Integrator/schemas/list-pool-v2-response-schema.ts @@ -0,0 +1,56 @@ +import { z } from 'zod'; +import { evmAddressSchema } from './util-schemas.js'; +import basicPoolInfo from './basic-pool-info-schema.js'; +import infoSchema from './info-schema.js'; + +const poolOfListPoolSchema = z.object({ + pair: z.string(), + token0: z.string().nonempty(), + token1: z.string().nonempty(), + name: z.string(), + name0: z.string(), + name1: z.string(), + token0Address: evmAddressSchema, + token1Address: evmAddressSchema, + token0Decimals: z.number().int().nonnegative().max(18), + token1Decimals: z.number().int().nonnegative().max(18), + WETH9: evmAddressSchema, + farmAddress: z.string(), + weight: z.number(), + liquidity0: z.number(), + liquidity1: z.number(), + liquidityInUSD: z.number(), + token0Price: z.number(), + token1Price: z.number(), + totalLPSupply: z.number(), + totalLPStake: z.number(), + totalLPStakeInUSD: z.number(), + userLPStaked: z.number(), + userLPStakedInUSD: z.number(), + lpPriceInUSD: z.number(), + lpPriceInORN: z.number(), + userReward: z.number(), + weeklyReward: z.number(), + userAPR: z.number(), + lockMaxMultiplier: z.number(), + veornMaxMultiplier: z.number(), + veornBoostScaleFactor: z.number(), + lockTimeForMaxMultiplier: z.number(), + userBoost: z.number(), + userTimeDeposit: z.number(), + userLockTimeStart: z.number(), + userLockTimePeriod: z.number(), + userVeORN: z.number(), + userORN: z.number(), + + ...basicPoolInfo.shape, + + type: z.string().nonempty(), +}); + +const listPoolV2ResponseSchema = z.object({ + result: z.array(poolOfListPoolSchema), + info: infoSchema, +}); + +export default listPoolV2ResponseSchema; diff --git a/src/services/Integrator/schemas/list-pool-response-schema.ts b/src/services/Integrator/schemas/list-pool-v3-response-schema.ts similarity index 81% rename from src/services/Integrator/schemas/list-pool-response-schema.ts rename to src/services/Integrator/schemas/list-pool-v3-response-schema.ts index 2e19738..d529579 100644 --- a/src/services/Integrator/schemas/list-pool-response-schema.ts +++ b/src/services/Integrator/schemas/list-pool-v3-response-schema.ts @@ -6,6 +6,9 @@ import infoSchema from './info-schema.js'; const poolOfListPoolSchema = z.object({ token0: z.string().nonempty(), token1: z.string().nonempty(), + name: z.string(), + name0: z.string(), + name1: z.string(), token0Address: evmAddressSchema, token1Address: evmAddressSchema, @@ -18,9 +21,9 @@ const poolOfListPoolSchema = z.object({ type: z.string().nonempty(), }); -const listPoolResponseSchema = z.object({ +const listPoolV3ResponseSchema = z.object({ result: z.array(poolOfListPoolSchema), info: infoSchema, }); -export default listPoolResponseSchema; +export default listPoolV3ResponseSchema;