mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-17 00:31:34 +03:00
feature: added new endpoint and new scheme for poolList
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@orionprotocol/sdk",
|
||||
"version": "0.20.10-rc17",
|
||||
"version": "0.20.10-rc18",
|
||||
"description": "Orion Protocol SDK",
|
||||
"main": "./lib/index.cjs",
|
||||
"module": "./lib/index.js",
|
||||
|
||||
@@ -14,6 +14,7 @@ import { fetchWithValidation } from 'simple-typed-fetch';
|
||||
import { BigNumber } from 'bignumber.js';
|
||||
import { DAY, WEEK_DAYS, YEAR } from '../../constants';
|
||||
import { LOCK_START_TIME } from './constants';
|
||||
import listPoolResponseSchema from './schemas/list-pool-schema';
|
||||
|
||||
type BasePayload = {
|
||||
chainId: number
|
||||
@@ -86,6 +87,7 @@ class IntegratorService {
|
||||
this.getEnvironment = this.getEnvironment.bind(this);
|
||||
this.listNFTOrder = this.listNFTOrder.bind(this);
|
||||
this.getPoolInfo = this.getPoolInfo.bind(this);
|
||||
this.getListPool = this.getListPool.bind(this);
|
||||
this.listPoolV2 = this.listPoolV2.bind(this);
|
||||
this.poolV2Info = this.poolV2Info.bind(this);
|
||||
this.listPoolV3 = this.listPoolV3.bind(this);
|
||||
@@ -167,6 +169,17 @@ class IntegratorService {
|
||||
});
|
||||
};
|
||||
|
||||
readonly getListPool = (userAddress?: string) => {
|
||||
return fetchWithValidation(this.apiUrl, listPoolResponseSchema, {
|
||||
method: 'POST',
|
||||
body: this.makeRPCPayload({
|
||||
model: 'OrionVoting',
|
||||
method: 'listPool',
|
||||
params: [userAddress],
|
||||
}),
|
||||
});
|
||||
};
|
||||
|
||||
readonly getPoolInfo = (
|
||||
token0: string,
|
||||
token1: string,
|
||||
|
||||
11
src/services/Integrator/schemas/list-pool-schema.ts
Normal file
11
src/services/Integrator/schemas/list-pool-schema.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { z } from 'zod';
|
||||
import infoSchema from './info-schema';
|
||||
import { listPoolV2Schema } from './list-pool-v2-response-schema';
|
||||
import { listPoolV3Schema } from './list-pool-v3-response-schema';
|
||||
|
||||
const listPoolResponseSchema = z.object({
|
||||
result: z.array(listPoolV2Schema.or(listPoolV3Schema)),
|
||||
info: infoSchema,
|
||||
});
|
||||
|
||||
export default listPoolResponseSchema;
|
||||
@@ -3,7 +3,7 @@ import { evmAddressSchema } from './util-schemas.js';
|
||||
import basicPoolInfo from './basic-pool-info-schema.js';
|
||||
import infoSchema from './info-schema.js';
|
||||
|
||||
const poolOfListPoolSchema = z.object({
|
||||
export const listPoolV2Schema = z.object({
|
||||
pair: z.string(),
|
||||
token0: z.string().nonempty(),
|
||||
token1: z.string().nonempty(),
|
||||
@@ -55,7 +55,7 @@ const poolOfListPoolSchema = z.object({
|
||||
});
|
||||
|
||||
const listPoolV2ResponseSchema = z.object({
|
||||
result: z.array(poolOfListPoolSchema),
|
||||
result: z.array(listPoolV2Schema),
|
||||
info: infoSchema,
|
||||
});
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { evmAddressSchema } from './util-schemas.js';
|
||||
import basicPoolInfo from './basic-pool-info-schema.js';
|
||||
import infoSchema from './info-schema.js';
|
||||
|
||||
const poolOfListPoolSchema = z.object({
|
||||
export const listPoolV3Schema = z.object({
|
||||
token0: z.string().nonempty(),
|
||||
token1: z.string().nonempty(),
|
||||
name: z.string(),
|
||||
@@ -23,7 +23,7 @@ const poolOfListPoolSchema = z.object({
|
||||
});
|
||||
|
||||
const listPoolV3ResponseSchema = z.object({
|
||||
result: z.array(poolOfListPoolSchema),
|
||||
result: z.array(listPoolV3Schema),
|
||||
info: infoSchema,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user