Skip to content

Commit

Permalink
fix: allow using symbols in url builder
Browse files Browse the repository at this point in the history
  • Loading branch information
chybisov committed Oct 21, 2022
1 parent c6cecbd commit f84b340
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ export const SelectTokenCardHeader = styled(CardHeader, {
textOverflow: 'ellipsis',
whiteSpace: 'nowrap',
overflow: 'hidden',
width: compact ? 92 : 224,
width: compact ? (selected ? 92 : 142) : 224,
fontWeight: selected ? 500 : 400,
fontSize: selected ? '1.125rem' : '1rem',
},
[`.${cardHeaderClasses.subheader}`]: {
textOverflow: 'ellipsis',
Expand Down
13 changes: 7 additions & 6 deletions packages/widget/src/hooks/useSwapRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,25 @@ export const useSwapRoutes = () => {
],
});
const [fromTokenAmount] = useDebouncedWatch([SwapFormKey.FromAmount], 320);
const { token } = useToken(fromChainId, fromTokenAddress);
const { token: fromToken } = useToken(fromChainId, fromTokenAddress);
const { token: toToken } = useToken(toChainId, toTokenAddress);
const isEnabled =
// Boolean(account.address) &&
!isNaN(fromChainId) &&
!isNaN(toChainId) &&
Boolean(token?.address) &&
Boolean(toTokenAddress) &&
Boolean(fromToken?.address) &&
Boolean(toToken?.address) &&
!isNaN(fromTokenAmount) &&
Number(fromTokenAmount) > 0 &&
!Number.isNaN(slippage);
const queryKey = [
'routes',
account.address,
fromChainId,
token?.address,
fromToken?.address,
fromTokenAmount,
toChainId,
toTokenAddress,
toToken?.address,
toAddress,
slippage,
enabledBridges,
Expand Down Expand Up @@ -91,7 +92,7 @@ export const useSwapRoutes = () => {
toWalletAddress = isAddress(toAddress) ? toAddress : fromAddress;
}
const fromAmount = Big(
Number(fromTokenAmount) * 10 ** (token?.decimals ?? 0),
Number(fromTokenAmount) * 10 ** (fromToken?.decimals ?? 0),
).toString();
const formattedSlippage = parseFloat(slippage) / 100;
return lifi.getRoutes(
Expand Down

0 comments on commit f84b340

Please sign in to comment.