Skip to content

Commit

Permalink
fix(orders-table): display allowance warning in Safe
Browse files Browse the repository at this point in the history
  • Loading branch information
shoom3301 committed Dec 16, 2024
1 parent c45b37d commit 44310e8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,10 @@ export function OrderRow({
}, [orderActions, order])
const alternativeOrderModalContext = useMemo(
() => orderActions.getAlternativeOrderModalContext(order),
[order, orderActions]
[order, orderActions],
)

const withAllowanceWarning = hasEnoughAllowance === false && hasValidPendingPermit === false
const withAllowanceWarning = hasEnoughAllowance === false && hasValidPendingPermit !== true
const withWarning =
(hasEnoughBalance === false || withAllowanceWarning) &&
// show the warning only for pending and scheduled orders
Expand Down Expand Up @@ -401,7 +401,7 @@ export function OrderRow({
function usePricesDifference(
prices: OrderRowProps['prices'],
spotPrice: OrderRowProps['spotPrice'],
isInverted: boolean
isInverted: boolean,
): PriceDifference {
const { estimatedExecutionPrice } = prices || {}

Expand All @@ -415,13 +415,13 @@ function usePricesDifference(
*/
function useFeeAmountDifference(
{ inputCurrencyAmount }: OrderRowProps['orderParams']['rateInfoParams'],
prices: OrderRowProps['prices']
prices: OrderRowProps['prices'],
): Percent | undefined {
const { feeAmount } = prices || {}

return useSafeMemo(
() => calculatePercentageInRelationToReference({ value: feeAmount, reference: inputCurrencyAmount }),
[feeAmount, inputCurrencyAmount]
[feeAmount, inputCurrencyAmount],
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const PERCENTAGE_FOR_PARTIAL_FILLS = new Percent(5, 10000) // 0.05%
export function getOrderParams(
chainId: SupportedChainId,
balancesAndAllowances: BalancesAndAllowances,
order: ParsedOrder
order: ParsedOrder,
): OrderParams {
const sellAmount = CurrencyAmount.fromRawAmount(order.inputToken, order.sellAmount)
const buyAmount = CurrencyAmount.fromRawAmount(order.outputToken, order.buyAmount)
Expand Down

0 comments on commit 44310e8

Please sign in to comment.