Skip to content

Commit

Permalink
route split
Browse files Browse the repository at this point in the history
  • Loading branch information
joaquinsoza committed Jun 26, 2024
1 parent 0f33f54 commit 84cc6da
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/functions/generateRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { useSorobanReact } from '@soroban-react/core';
import { AppContext } from 'contexts';
import { useFactory } from 'hooks';
import { useContext, useMemo } from 'react';
import { CurrencyAmount, Networks, Protocols, Router, Token, TradeType } from 'soroswap-router-sdk';
import { fetchAllPhoenixPairs, fetchAllSoroswapPairs } from 'services/pairs';
import { CurrencyAmount, Networks, Protocols, Router, Token, TradeType } from 'soroswap-router-sdk';

export interface GenerateRouteProps {
amountTokenAddress: string;
Expand Down Expand Up @@ -79,9 +79,12 @@ export const useRouterSDK = () => {
const quoteCurrency = fromAddressToToken(quoteTokenAddress);

if (isAggregator) {
// console.log('Returning routeSplit');
// console.log(await router.routeSplit(currencyAmount, quoteCurrency, tradeType));
return router.routeSplit(currencyAmount, quoteCurrency, tradeType);
}

// console.log('returning route');
return router.route(currencyAmount, quoteCurrency, tradeType, factory, sorobanContext as any);
};

Expand Down
4 changes: 2 additions & 2 deletions src/state/swap/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ export function useDerivedSwapInfo(state: SwapState) {

//if amountin is more than reserves | expectedoutput is infinity
if (
trade.trade?.outputAmount?.value.includes('Infinity') ||
trade.trade?.outputAmount?.value.includes('-')
trade.trade?.outputAmount?.value?.includes('Infinity') ||
trade.trade?.outputAmount?.value?.includes('-')
) {
inputError = 'Insufficient liquidity for this trade.';
}
Expand Down

0 comments on commit 84cc6da

Please sign in to comment.