Skip to content

Commit

Permalink
Merge pull request #260 from oraichain/fix/return-swap-ops-in-handle-…
Browse files Browse the repository at this point in the history
…simulate-swap

 Return swapOps in handleSimulateSwap
  • Loading branch information
trung2891 authored May 4, 2024
2 parents 06345d8 + 4bd0d4f commit 8ea703c
Show file tree
Hide file tree
Showing 3 changed files with 6 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.75",
"version": "1.0.76",
"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 @@ -656,6 +656,7 @@ export class UniversalSwapHelper {
);
let amount;
let routes = [];
let routeSwapOps;
if (query.useSmartRoute) {
const { returnAmount, routesSwap }: SmartRouterResponse = await UniversalSwapHelper.simulateSwapUsingSmartRoute({
fromInfo,
Expand All @@ -664,6 +665,7 @@ export class UniversalSwapHelper {
});
routes = routesSwap;
amount = returnAmount;
routeSwapOps = routeSwapOps;
} else {
amount = (
await UniversalSwapHelper.simulateSwap({
Expand All @@ -677,7 +679,8 @@ export class UniversalSwapHelper {
return {
amount,
displayAmount: toDisplay(amount, getTokenOnOraichain(toInfo.coinGeckoId)?.decimals),
routes
routes,
routeSwapOps
};
};

Expand Down
1 change: 1 addition & 0 deletions packages/universal-swap/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export interface SimulateResponse {
amount: Uint128;
displayAmount: number;
routes?: SmartRouteSwapAPIOperations[];
routeSwapOps?: SmartRouteSwapOperations;
}

export interface SwapData {
Expand Down

0 comments on commit 8ea703c

Please sign in to comment.