mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-14 06:02:36 +03:00
Force route
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@orionprotocol/sdk",
|
||||
"version": "0.10.1",
|
||||
"version": "0.10.2",
|
||||
"description": "Orion Protocol SDK",
|
||||
"main": "./lib/esm/index.js",
|
||||
"module": "./lib/esm/index.js",
|
||||
|
||||
@@ -23,6 +23,9 @@ export type SwapMarketParams = {
|
||||
options?: {
|
||||
logger?: (message: string) => void,
|
||||
autoApprove?: boolean,
|
||||
developer: {
|
||||
route: 'aggregator' | 'pool',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,6 +52,7 @@ export default async function swapMarket({
|
||||
orionUnit,
|
||||
options,
|
||||
}: SwapMarketParams): Promise<Swap> {
|
||||
if (options?.developer) options?.logger?.('YOU SPECIFIED A DEVELOPER OPTIONS. BE CAREFUL!');
|
||||
if (amount === '') throw new Error('Amount can not be empty');
|
||||
if (assetIn === '') throw new Error('AssetIn can not be empty');
|
||||
if (assetOut === '') throw new Error('AssetOut can not be empty');
|
||||
@@ -125,7 +129,7 @@ export default async function swapMarket({
|
||||
|
||||
const percent = new BigNumber(slippagePercent).div(100);
|
||||
|
||||
const { isThroughPoolOptimal } = swapInfo;
|
||||
const isThroughPoolOptimal = options?.developer.route === 'pool' ?? swapInfo.isThroughPoolOptimal;
|
||||
|
||||
if (isThroughPoolOptimal) {
|
||||
options?.logger?.('Swap through pool');
|
||||
|
||||
Reference in New Issue
Block a user