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

12
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "@orionprotocol/sdk",
"version": "0.17.38",
"version": "0.18.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@orionprotocol/sdk",
"version": "0.17.38",
"version": "0.18.2",
"license": "ISC",
"dependencies": {
"@babel/runtime": "^7.21.0",
@@ -23,7 +23,7 @@
"just-clone": "^6.2.0",
"merge-anything": "^5.1.4",
"neverthrow": "^6.0.0",
"simple-typed-fetch": "^0.1.5",
"simple-typed-fetch": "^0.1.6",
"stream-browserify": "^3.0.0",
"tiny-invariant": "^1.3.1",
"ts-is-present": "^1.2.2",
@@ -9654,9 +9654,9 @@
"dev": true
},
"node_modules/simple-typed-fetch": {
"version": "0.1.5",
"resolved": "https://registry.npmjs.org/simple-typed-fetch/-/simple-typed-fetch-0.1.5.tgz",
"integrity": "sha512-yawet1W84IeViNWGt45YIfVPXz39/KqsiLQlgkPyURDe+S7ZX6cWfP+aKqwsKVyR2Q8gmum7ARIVS1M44bEg1g==",
"version": "0.1.6",
"resolved": "https://registry.npmjs.org/simple-typed-fetch/-/simple-typed-fetch-0.1.6.tgz",
"integrity": "sha512-Oh+8ft1ll3eGr7uMzG//ZZXWKhmRLEXSDBT7wC6tRQFBGhN1LhXv/zPikAWUKhx3HqP6St0Nhsk66pOe+B0xIA==",
"dependencies": {
"isomorphic-unfetch": "^4.0.2",
"neverthrow": "^6.0.0",

View File

@@ -1,6 +1,6 @@
{
"name": "@orionprotocol/sdk",
"version": "0.18.2",
"version": "0.18.3",
"description": "Orion Protocol SDK",
"main": "./lib/esm/index.js",
"module": "./lib/esm/index.js",
@@ -89,7 +89,7 @@
"just-clone": "^6.2.0",
"merge-anything": "^5.1.4",
"neverthrow": "^6.0.0",
"simple-typed-fetch": "^0.1.5",
"simple-typed-fetch": "^0.1.6",
"stream-browserify": "^3.0.0",
"tiny-invariant": "^1.3.1",
"ts-is-present": "^1.2.2",

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