mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-16 07:02:36 +03:00
feature: schemas were updated and new endpoint was added
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
Reference in New Issue
Block a user