From ebed263f0b2af4739504bedccfb932854f6f9295 Mon Sep 17 00:00:00 2001 From: Aleksandr Kraiz Date: Sat, 3 Sep 2022 14:47:36 +0400 Subject: [PATCH] Fix: pools instead ORION_POOL --- README.md | 4 ++-- package.json | 2 +- src/OrionUnit/Exchange/swapMarket.ts | 2 +- src/constants/exchanges.ts | 14 ++++++++++++++ src/types.ts | 5 ++--- 5 files changed, 20 insertions(+), 7 deletions(-) create mode 100644 src/constants/exchanges.ts diff --git a/README.md b/README.md index 79618c2..0d844db 100644 --- a/README.md +++ b/README.md @@ -274,8 +274,8 @@ const swapInfo = await simpleFetch(orionUnit.orionAggregator.getSwapInfo)( "exactSpend", // type "ORN", // asset in "USDT", // asset out - 25.23453457, // amount - ["ORION_POOL"] // Exchanges. OPTIONAL! Specify ['ORION_POOL'] if you want "pool only" swap execution + 25.23453457 // amount + // Exchanges. OPTIONAL! Specify 'pools' if you want "pool only" swap execution. Specify 'cex' if you want "cex only" execution ); ``` diff --git a/package.json b/package.json index e6a930f..a39b74e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@orionprotocol/sdk", - "version": "0.15.3", + "version": "0.15.4", "description": "Orion Protocol SDK", "main": "./lib/esm/index.js", "module": "./lib/esm/index.js", diff --git a/src/OrionUnit/Exchange/swapMarket.ts b/src/OrionUnit/Exchange/swapMarket.ts index 0007ec5..fb016cf 100644 --- a/src/OrionUnit/Exchange/swapMarket.ts +++ b/src/OrionUnit/Exchange/swapMarket.ts @@ -126,7 +126,7 @@ export default async function swapMarket({ assetOut, amount.toString(), options?.instantSettlement, - options?.poolOnly ? ['ORION_POOL'] : undefined, + options?.poolOnly ? 'pools' : undefined, ); const { exchanges: swapExchanges } = swapInfo; diff --git a/src/constants/exchanges.ts b/src/constants/exchanges.ts new file mode 100644 index 0000000..ba62370 --- /dev/null +++ b/src/constants/exchanges.ts @@ -0,0 +1,14 @@ +export default [ + // CEXes + 'ASCENDEX', + 'OKX', + 'BINANCE', + 'KUCOIN', + + // DEXes + 'SPOOKYSWAP', + 'PANCAKESWAP', + 'UNISWAP', + 'QUICKSWAP', + 'ORION_POOL', +] as const; diff --git a/src/types.ts b/src/types.ts index 5d62a31..cd78807 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,4 +1,5 @@ import BigNumber from 'bignumber.js'; +import exchanges from './constants/exchanges'; import orderStatuses from './constants/orderStatuses'; import subOrderStatuses from './constants/subOrderStatuses'; @@ -197,6 +198,4 @@ export type BalanceIssue = { readonly fixes?: Fix[], } -const availableExchanges = ['ORION_POOL', 'ASCENDEX', 'BINANCE', 'KUCOIN'] as const; - -export type Exchange = typeof availableExchanges[number]; +export type Exchange = typeof exchanges[number];