OP-4534: Integrator pools (#188)

This commit is contained in:
Dmitry
2023-10-11 10:34:55 +03:00
committed by GitHub
parent 8bb5c18535
commit ec81a62d65
6 changed files with 14 additions and 22 deletions

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "@orionprotocol/sdk",
"version": "0.20.6",
"version": "0.20.8",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@orionprotocol/sdk",
"version": "0.20.6",
"version": "0.20.8",
"hasInstallScript": true,
"license": "ISC",
"dependencies": {

View File

@@ -1,6 +1,6 @@
{
"name": "@orionprotocol/sdk",
"version": "0.20.7",
"version": "0.20.8",
"description": "Orion Protocol SDK",
"main": "./lib/index.cjs",
"module": "./lib/index.js",

View File

@@ -18,7 +18,7 @@ import {
} from './schemas/index.js';
import type redeemOrderSchema from '../Aggregator/schemas/redeemOrderSchema.js';
import { sourceAtomicHistorySchema, targetAtomicHistorySchema } from './schemas/atomicHistorySchema.js';
import { makePartial } from '../../utils/index.js';
import { makePartial } from '../../utils';
import type { networkCodes } from '../../constants/index.js';
import { fetchWithValidation } from 'simple-typed-fetch';
import type { BasicAuthCredentials } from '../../types.js';
@@ -61,8 +61,8 @@ type AtomicSwapHistoryTargetQuery = AtomicSwapHistoryBaseQuery & {
}
type PlatformFees = {
assetIn?: string // TODO: return types from main branch
assetOut?: string
assetIn: string
assetOut: string
walletAddress?: string | undefined
fromWidget?: string | undefined
}
@@ -247,13 +247,8 @@ class BlockchainService {
) => {
const url = new URL(`${this.apiUrl}/api/platform-fees`);
if (assetIn !== undefined) { // TODO: make same as in main branch
url.searchParams.append('assetIn', assetIn);
}
if (assetOut !== undefined) {
url.searchParams.append('assetOut', assetOut);
}
url.searchParams.append('assetIn', assetIn);
url.searchParams.append('assetOut', assetOut);
if (walletAddress !== undefined) {
url.searchParams.append('walletAddress', walletAddress);

View File

@@ -1,3 +1 @@
export const AVAILABLE_POOL_FEE = ['0.01', '0.05', '0.3', '1'] as const;
export const INITIAL_VEORN_ADJUSTMENT_FACTOR = 5;
export const LOCK_START_TIME = 1690848000;// Aug 01 2023 00:00:00 UTC

View File

@@ -6,12 +6,12 @@ import {
listPoolResponseSchema,
testIncrementorSchema,
veORNInfoResponseSchema,
votingInfoResponseSchema,
} from './schemas/index.js';
votingInfoResponseSchema
} from './schemas';
import { fetchWithValidation } from 'simple-typed-fetch';
import { BigNumber } from 'bignumber.js';
import { DAY, WEEK_DAYS, YEAR } from '../../constants/index.js';
import { LOCK_START_TIME } from './constants.js';
import { DAY, WEEK_DAYS, YEAR } from '../../constants';
import { LOCK_START_TIME } from './constants';
type BasePayload = {
chainId: number
@@ -166,7 +166,7 @@ class IntegratorService {
readonly getPoolInfo = (
token0: string,
token1: string,
poolAddress: string
poolAddress?: string
) => {
return fetchWithValidation(this.apiUrl, getPoolResponseSchema, {
method: 'POST',

View File

@@ -1,6 +1,5 @@
import { z } from 'zod';
import { evmAddressSchema } from './util-schemas.js';
import { AVAILABLE_POOL_FEE } from '../constants.js';
import basicPoolInfo from './basic-pool-info-schema.js';
import infoSchema from './info-schema.js';
@@ -13,7 +12,7 @@ const getPoolResponseSchema = z.object({
totalLiquidity: z.number().nonnegative(),
WETH9: evmAddressSchema,
pools: z.record(z.enum(AVAILABLE_POOL_FEE), basicPoolInfo.nullable()),
pools: z.record(z.number(), basicPoolInfo.nullable()),
}),
info: infoSchema,
});