mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-14 06:02:36 +03:00
Fix poolOnly
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@orionprotocol/sdk",
|
||||
"version": "0.11.1",
|
||||
"version": "0.11.2",
|
||||
"description": "Orion Protocol SDK",
|
||||
"main": "./lib/esm/index.js",
|
||||
"module": "./lib/esm/index.js",
|
||||
|
||||
@@ -126,7 +126,7 @@ export default async function swapMarket({
|
||||
options?.poolOnly ? ['ORION_POOL'] : undefined,
|
||||
);
|
||||
|
||||
if (options?.poolOnly === true && options.poolOnly !== swapInfo.isThroughPoolOptimal) {
|
||||
if (swapInfo.orderInfo !== null && options?.poolOnly === true && options.poolOnly !== swapInfo.isThroughPoolOptimal) {
|
||||
throw new Error(`Unexpected Orion Aggregator response. Please, contact support. Report swap request id: ${swapInfo.id}`);
|
||||
}
|
||||
|
||||
@@ -142,7 +142,11 @@ export default async function swapMarket({
|
||||
|
||||
const percent = new BigNumber(slippagePercent).div(100);
|
||||
|
||||
const isThroughPoolOptimal = options?.developer?.route === 'pool' ?? swapInfo.isThroughPoolOptimal;
|
||||
let isThroughPoolOptimal: boolean;
|
||||
if (options?.developer?.route !== undefined) {
|
||||
isThroughPoolOptimal = options.developer.route === 'pool';
|
||||
} else if (options?.poolOnly) isThroughPoolOptimal = true;
|
||||
else isThroughPoolOptimal = swapInfo.isThroughPoolOptimal;
|
||||
|
||||
if (isThroughPoolOptimal) {
|
||||
options?.logger?.('Swap through pool');
|
||||
|
||||
Reference in New Issue
Block a user