Skip to content

Commit

Permalink
fix: display hook details only in Hooks store confirm modal
Browse files Browse the repository at this point in the history
  • Loading branch information
shoom3301 authored and alfetopito committed Jan 7, 2025
1 parent 5098421 commit 11c6863
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
TradeConfirmation,
TradeConfirmModal,
useIsEoaEthFlow,
useIsHooksTradeType,
useOrderSubmittedContent,
useReceiveAmountInfo,
useShouldPayGas,
Expand Down Expand Up @@ -71,6 +72,7 @@ export function ConfirmSwapModalSetup(props: ConfirmSwapModalSetupProps) {
const appData = useAppData()
const [userDeadline] = useUserTransactionTTL()
const [isPartialApprove] = usePartialApprove()
const isHooksTradeType = useIsHooksTradeType()

const slippageAdjustedSellAmount = trade?.maximumAmountIn(allowedSlippage)
const isExactIn = trade?.tradeType === TradeType.EXACT_INPUT
Expand Down Expand Up @@ -127,6 +129,7 @@ export function ConfirmSwapModalSetup(props: ConfirmSwapModalSetupProps) {
appData={appData || undefined}
slippageAdjustedSellAmount={slippageAdjustedSellAmount}
isPartialApprove={isPartialApprove}
displayHookDetails={isHooksTradeType}
>
{(restContent) => (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export interface TradeConfirmationProps {
children?: (restContent: ReactElement) => ReactElement
slippageAdjustedSellAmount?: CurrencyAmount<Currency>
isPartialApprove?: boolean
displayHookDetails?: boolean
}

export function TradeConfirmation(props: TradeConfirmationProps) {
Expand Down Expand Up @@ -81,6 +82,7 @@ export function TradeConfirmation(props: TradeConfirmationProps) {
appData,
isPartialApprove,
slippageAdjustedSellAmount,
displayHookDetails,
} = frozenProps || props

/**
Expand Down Expand Up @@ -131,7 +133,7 @@ export function TradeConfirmation(props: TradeConfirmationProps) {
onConfirm()
}

const hookDetailsElement = (
const hookDetailsElement = displayHookDetails ? (
<>
{appData && (
<OrderHooksDetails
Expand All @@ -144,7 +146,7 @@ export function TradeConfirmation(props: TradeConfirmationProps) {
</OrderHooksDetails>
)}
</>
)
) : null

return (
<styledEl.WidgetWrapper onKeyDown={(e) => e.key === 'Escape' && onDismiss()}>
Expand Down

0 comments on commit 11c6863

Please sign in to comment.