diff --git a/package-lock.json b/package-lock.json index 0c73a86..39fb3c5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/package.json b/package.json index 036af11..022dc6c 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/Orion/bridge/getHistory.ts b/src/Orion/bridge/getHistory.ts index 18f6c24..3b04e8f 100644 --- a/src/Orion/bridge/getHistory.ts +++ b/src/Orion/bridge/getHistory.ts @@ -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) => { diff --git a/src/Orion/bridge/swap.ts b/src/Orion/bridge/swap.ts index ade37aa..65ec975 100644 --- a/src/Orion/bridge/swap.ts +++ b/src/Orion/bridge/swap.ts @@ -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 diff --git a/src/Orion/index.ts b/src/Orion/index.ts index cbfe4e0..34dee2f 100644 --- a/src/Orion/index.ts +++ b/src/Orion/index.ts @@ -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 diff --git a/src/OrionUnit/Exchange/deposit.ts b/src/OrionUnit/Exchange/deposit.ts index ec88125..f2be122 100644 --- a/src/OrionUnit/Exchange/deposit.ts +++ b/src/OrionUnit/Exchange/deposit.ts @@ -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 diff --git a/src/OrionUnit/Exchange/getSwapInfo.ts b/src/OrionUnit/Exchange/getSwapInfo.ts index 70bf5e0..d173218 100644 --- a/src/OrionUnit/Exchange/getSwapInfo.ts +++ b/src/OrionUnit/Exchange/getSwapInfo.ts @@ -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 diff --git a/src/OrionUnit/Exchange/swapLimit.ts b/src/OrionUnit/Exchange/swapLimit.ts index 202e73c..affff6d 100644 --- a/src/OrionUnit/Exchange/swapLimit.ts +++ b/src/OrionUnit/Exchange/swapLimit.ts @@ -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' diff --git a/src/OrionUnit/Exchange/swapMarket.ts b/src/OrionUnit/Exchange/swapMarket.ts index 81ed1cd..7575708 100644 --- a/src/OrionUnit/Exchange/swapMarket.ts +++ b/src/OrionUnit/Exchange/swapMarket.ts @@ -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 & { slippagePercent: BigNumber.Value diff --git a/src/OrionUnit/Exchange/withdraw.ts b/src/OrionUnit/Exchange/withdraw.ts index dc46c5b..0d913f9 100644 --- a/src/OrionUnit/Exchange/withdraw.ts +++ b/src/OrionUnit/Exchange/withdraw.ts @@ -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 diff --git a/src/OrionUnit/FarmingManager/index.ts b/src/OrionUnit/FarmingManager/index.ts index d591258..bcdf4c0 100644 --- a/src/OrionUnit/FarmingManager/index.ts +++ b/src/OrionUnit/FarmingManager/index.ts @@ -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 = { diff --git a/src/__tests__/basic.test.ts b/src/__tests__/basic.test.ts index 7882323..64a6f32 100644 --- a/src/__tests__/basic.test.ts +++ b/src/__tests__/basic.test.ts @@ -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) => { diff --git a/src/services/OrionAggregator/index.ts b/src/services/OrionAggregator/index.ts index 5bdb2b2..dba6f9f 100644 --- a/src/services/OrionAggregator/index.ts +++ b/src/services/OrionAggregator/index.ts @@ -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; diff --git a/src/services/OrionBlockchain/index.ts b/src/services/OrionBlockchain/index.ts index 64886e8..a42ce49 100644 --- a/src/services/OrionBlockchain/index.ts +++ b/src/services/OrionBlockchain/index.ts @@ -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 diff --git a/src/services/PriceFeed/index.ts b/src/services/PriceFeed/index.ts index 0f3f5c3..a6d5345 100644 --- a/src/services/PriceFeed/index.ts +++ b/src/services/PriceFeed/index.ts @@ -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; diff --git a/src/services/ReferralSystem/index.ts b/src/services/ReferralSystem/index.ts index ab163d2..ea87bf3 100644 --- a/src/services/ReferralSystem/index.ts +++ b/src/services/ReferralSystem/index.ts @@ -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