Skip to content

Commit

Permalink
fix: Compute route fee usd costs
Browse files Browse the repository at this point in the history
  • Loading branch information
LautaroPetaccio committed Mar 13, 2024
1 parent 6d4021f commit e47d366
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ const PaymentSelector = (props: Props) => {
return !isFetchingBalance ? <span className={styles.balance}>{balance}</span> : <div className={styles.balanceSkeleton} />
}, [wallet, isFetchingBalance, selectedChain, selectedToken, selectedTokenBalance])

const usdRouteFeeCost = useMemo(() => routeFeeCost && getUsdRouteCost(routeFeeCost, providerTokens), [routeFeeCost, providerTokens])

return (
<div className={styles.payWithContainer} data-testid={PAY_WITH_DATA_TEST_ID}>
{canSelectChainAndToken ? (
Expand Down Expand Up @@ -172,8 +174,8 @@ const PaymentSelector = (props: Props) => {
)}
{gasCost && gasCost.totalUSDPrice ? (
<span className={styles.fromAmountUSD}>≈ ${gasCost.totalUSDPrice.toFixed(4)}</span>
) : !!routeFeeCost && providerTokens.find(t => t.symbol === routeFeeCost.token.symbol)?.usdPrice ? (
<span className={styles.fromAmountUSD}>≈ ${getUsdRouteCost(routeFeeCost, providerTokens)}</span>
) : usdRouteFeeCost ? (
<span className={styles.fromAmountUSD}>≈ ${usdRouteFeeCost}</span>
) : null}
</div>
</div>
Expand Down

0 comments on commit e47d366

Please sign in to comment.