Fixed poolOnly

This commit is contained in:
Aleksandr Kraiz
2022-08-19 11:30:04 +04:00
parent 64d68082ab
commit 1b47358b6f
3 changed files with 10 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@orionprotocol/sdk",
"version": "0.14.0-rc.0",
"version": "0.14.0-rc.1",
"description": "Orion Protocol SDK",
"main": "./lib/esm/index.js",
"module": "./lib/esm/index.js",

View File

@@ -62,7 +62,7 @@ export default async function getSwapMarketFeeInfo({
assetOut,
amount.toString(),
false,
options?.poolOnly ? ['ORION_POOL'] : undefined,
options?.poolOnly ? 'pools' : undefined,
);
if (swapInfo.orderInfo !== null && options?.poolOnly === true && options.poolOnly !== swapInfo.isThroughPoolOptimal) {

View File

@@ -152,7 +152,7 @@ class OrionAggregator {
assetOut: string,
amount: string,
instantSettlement?: boolean,
exchanges?: Exchange[],
exchanges?: Exchange[] | 'cex' | 'pools',
) => {
const url = new URL(`${this.apiUrl}/api/v1/swap`);
url.searchParams.append('assetIn', assetIn);
@@ -163,9 +163,13 @@ class OrionAggregator {
url.searchParams.append('amountOut', amount);
}
if (exchanges) {
exchanges.forEach((exchange) => {
url.searchParams.append('exchanges', exchange);
});
if (Array.isArray(exchanges)) {
exchanges.forEach((exchange) => {
url.searchParams.append('exchanges', exchange);
});
} else {
url.searchParams.append('exchanges', exchanges);
}
}
if (instantSettlement) {
url.searchParams.append('instantSettlement', 'true');