Skip to content

Commit

Permalink
Merge pull request #275 from oraichain/feat/smart-router-osmosis-pool
Browse files Browse the repository at this point in the history
fix bug simulate alpha smart router
  • Loading branch information
haunv3 authored May 28, 2024
2 parents a144f7b + 6539171 commit e028213
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/universal-swap/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oraichain/oraidex-universal-swap",
"version": "1.0.88",
"version": "1.0.89",
"main": "build/index.js",
"files": [
"build/"
Expand Down
5 changes: 4 additions & 1 deletion packages/universal-swap/src/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,7 @@ export class UniversalSwapHelper {
let amount;
let routes = [];
let routeSwapOps;
let decimals = 6;
if (query?.routerOption?.useSmartRoute || query?.routerOption?.useAlphaSmartRoute) {
const simulateRes: SmartRouterResponse = await UniversalSwapHelper.simulateSwapUsingSmartRoute({
fromInfo: query.originalFromInfo,
Expand All @@ -697,6 +698,7 @@ export class UniversalSwapHelper {
routes = simulateRes?.routesSwap;
amount = simulateRes.returnAmount;
routeSwapOps = simulateRes?.routes;
decimals = query.originalToInfo.decimals;
} else {
const fromInfo = getTokenOnOraichain(query.originalFromInfo.coinGeckoId);
const toInfo = getTokenOnOraichain(query.originalToInfo.coinGeckoId);
Expand All @@ -712,10 +714,11 @@ export class UniversalSwapHelper {
routerClient: query.routerClient
})
).amount;
decimals = toInfo.decimals;
}
return {
amount,
displayAmount: toDisplay(amount, getTokenOnOraichain(query.originalToInfo.coinGeckoId)?.decimals),
displayAmount: toDisplay(amount, decimals),
routes,
routeSwapOps
};
Expand Down

0 comments on commit e028213

Please sign in to comment.