STF to ESM

This commit is contained in:
Aleksandr Kraiz
2023-04-03 20:17:38 +04:00
parent 665bd568a4
commit bfa88fabaa
16 changed files with 22 additions and 49 deletions

View File

@@ -2,11 +2,9 @@ import { ethers } from 'ethers';
import type OrionUnit from '../../OrionUnit/index.js';
import type { SupportedChainId } from '../../types.js';
import { isValidChainId } from '../../utils/index.js';
import stf from 'simple-typed-fetch';
import { simpleFetch } from 'simple-typed-fetch';
import bsonObjectId from 'bson-objectid';
const { simpleFetch } = stf;
const ObjectID = bsonObjectId.default
const getHistory = async (units: OrionUnit[], address: string, limit = 1000) => {

View File

@@ -17,9 +17,7 @@ import type { SupportedChainId } from '../../types.js';
import type Orion from '../index.js';
import type { z } from 'zod';
import type { placeAtomicSwapSchema } from '../../services/OrionAggregator/schemas/index.js';
import stf from 'simple-typed-fetch';
const { simpleFetch } = stf;
import { simpleFetch } from 'simple-typed-fetch';
type Params = {
assetName: string

View File

@@ -9,9 +9,7 @@ import type { SupportedChainId, DeepPartial, VerboseOrionUnitConfig, KnownEnv }
import { isValidChainId } from '../utils/index.js';
import swap from './bridge/swap.js';
import getHistory from './bridge/getHistory.js';
import stf from 'simple-typed-fetch';
const { simpleFetch } = stf;
import { simpleFetch } from 'simple-typed-fetch';
type EnvConfig = {
analyticsAPI: string

View File

@@ -9,9 +9,7 @@ import {
} from '../../constants/index.js';
import { denormalizeNumber, normalizeNumber } from '../../utils/index.js';
import getNativeCryptocurrency from '../../utils/getNativeCryptocurrency.js';
import stf from 'simple-typed-fetch';
const { simpleFetch } = stf;
import { simpleFetch } from 'simple-typed-fetch';
export type DepositParams = {
asset: string

View File

@@ -1,14 +1,12 @@
import { BigNumber } from 'bignumber.js';
import { ethers } from 'ethers';
import stf from 'simple-typed-fetch';
import { simpleFetch } from 'simple-typed-fetch';
import { NATIVE_CURRENCY_PRECISION, SWAP_THROUGH_ORION_POOL_GAS_LIMIT } from '../../constants/index.js';
import type { OrionAggregator } from '../../services/OrionAggregator/index.js';
import type { OrionBlockchain } from '../../services/OrionBlockchain/index.js';
import { calculateFeeInFeeAsset, denormalizeNumber, getNativeCryptocurrency } from '../../utils/index.js';
const { simpleFetch } = stf;
export type GetSwapInfoParams = {
type: 'exactSpend' | 'exactReceive'
assetIn: string

View File

@@ -11,9 +11,7 @@ import { calculateFeeInFeeAsset, denormalizeNumber, normalizeNumber } from '../.
import { signOrder } from '../../crypt/index.js';
import type orderSchema from '../../services/OrionAggregator/schemas/orderSchema.js';
import type { z } from 'zod';
import stf from 'simple-typed-fetch';
const { simpleFetch } = stf;
import { simpleFetch } from 'simple-typed-fetch';
export type SwapLimitParams = {
type: 'exactSpend' | 'exactReceive'

View File

@@ -11,9 +11,7 @@ import { signOrder } from '../../crypt/index.js';
import type orderSchema from '../../services/OrionAggregator/schemas/orderSchema.js';
import type { z } from 'zod';
import type { SwapLimitParams } from './swapLimit.js';
import stf from 'simple-typed-fetch';
const { simpleFetch } = stf;
import { simpleFetch } from 'simple-typed-fetch';
export type SwapMarketParams = Omit<SwapLimitParams, 'price'> & {
slippagePercent: BigNumber.Value

View File

@@ -9,9 +9,7 @@ import {
} from '../../constants/index.js';
import { denormalizeNumber, normalizeNumber } from '../../utils/index.js';
import getNativeCryptocurrency from '../../utils/getNativeCryptocurrency.js';
import stf from 'simple-typed-fetch';
const { simpleFetch } = stf;
import { simpleFetch } from 'simple-typed-fetch';
export type WithdrawParams = {
asset: string

View File

@@ -1,7 +1,7 @@
import { Exchange__factory, IUniswapV2Pair__factory, IUniswapV2Router__factory } from '@orionprotocol/contracts';
import { BigNumber } from 'bignumber.js';
import { ethers } from 'ethers';
import stf from 'simple-typed-fetch';
import { simpleFetch } from 'simple-typed-fetch';
import type OrionUnit from '../index.js';
import BalanceGuard from '../../BalanceGuard.js';
import { ADD_LIQUIDITY_GAS_LIMIT, INTERNAL_ORION_PRECISION, NATIVE_CURRENCY_PRECISION } from '../../constants/index.js';
@@ -9,8 +9,6 @@ import { denormalizeNumber, normalizeNumber } from '../../utils/index.js';
import getBalances from '../../utils/getBalances.js';
import getNativeCryptocurrency from '../../utils/getNativeCryptocurrency.js';
const { simpleFetch } = stf;
const ADD_LIQUIDITY_SLIPPAGE = 0.05;
export type AddLiquidityParams = {

View File

@@ -9,8 +9,7 @@ import {
createHttpTerminator,
} from 'http-terminator';
import { ethers } from 'ethers';
import stf from 'simple-typed-fetch';
const { simpleFetch } = stf;
import { simpleFetch } from 'simple-typed-fetch';
jest.setTimeout(10000);
const createServer = (externalHost: string) => {

View File

@@ -19,9 +19,7 @@ import httpToWS from '../../utils/httpToWS.js';
import { ethers } from 'ethers';
import orderSchema from './schemas/orderSchema.js';
import { exchanges } from '../../constants/index.js';
import stf from 'simple-typed-fetch';
const { fetchWithValidation } = stf;
import { fetchWithValidation } from 'simple-typed-fetch';
class OrionAggregator {
private readonly apiUrl: string;

View File

@@ -17,9 +17,7 @@ import type redeemOrderSchema from '../OrionAggregator/schemas/redeemOrderSchema
import { sourceAtomicHistorySchema, targetAtomicHistorySchema } from './schemas/atomicHistorySchema.js';
import { makePartial } from '../../utils/index.js';
import type { networkCodes } from '../../constants/index.js';
import stf from 'simple-typed-fetch';
const { fetchWithValidation } = stf;
import { fetchWithValidation } from 'simple-typed-fetch';
type IAdminAuthHeaders = {
auth: string

View File

@@ -1,11 +1,9 @@
import stf from 'simple-typed-fetch';
import { fetchWithValidation } from 'simple-typed-fetch';
import type { Exchange } from '../../types.js';
import { statisticsOverviewSchema, topPairsStatisticsSchema } from './schemas/index.js';
import candlesSchema from './schemas/candlesSchema.js';
import { PriceFeedWS } from './ws/index.js';
const { fetchWithValidation } = stf;
class PriceFeed {
private readonly apiUrl: string;

View File

@@ -1,4 +1,4 @@
import stf from 'simple-typed-fetch';
import { fetchWithValidation } from 'simple-typed-fetch';
import {
errorSchema,
miniStatsSchema,
@@ -9,8 +9,6 @@ import {
linkSchema,
} from './schemas/index.js';
const { fetchWithValidation } = stf;
type CreateLinkPayloadType = {
referer: string
link_option: number