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", "name": "@orionprotocol/sdk",
"version": "0.14.0-rc.0", "version": "0.14.0-rc.1",
"description": "Orion Protocol SDK", "description": "Orion Protocol SDK",
"main": "./lib/esm/index.js", "main": "./lib/esm/index.js",
"module": "./lib/esm/index.js", "module": "./lib/esm/index.js",

View File

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

View File

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