Commit 3aaa3fef authored by Moody Salem's avatar Moody Salem

fix: wrap/unwrap should not show computed trade details

parent bc243e1c
......@@ -33,11 +33,13 @@ export default function useWrapCallback(
return useMemo(() => {
if (!wethContract || !chainId || !inputCurrency || !outputCurrency) return NOT_APPLICABLE
const weth = WETH9[chainId]
if (!weth) return NOT_APPLICABLE
const hasInputAmount = Boolean(inputAmount?.greaterThan('0'))
const sufficientBalance = inputAmount && balance && !balance.lessThan(inputAmount)
if (inputCurrency.isNative && outputCurrency.equals(WETH9[chainId])) {
if (inputCurrency.isNative && weth.equals(outputCurrency)) {
return {
wrapType: WrapType.WRAP,
execute:
......@@ -53,7 +55,7 @@ export default function useWrapCallback(
: undefined,
inputError: sufficientBalance ? undefined : hasInputAmount ? 'Insufficient ETH balance' : 'Enter ETH amount',
}
} else if (WETH9[chainId].equals(inputCurrency) && outputCurrency.isNative) {
} else if (weth.equals(inputCurrency) && outputCurrency.isNative) {
return {
wrapType: WrapType.UNWRAP,
execute:
......
......@@ -122,6 +122,7 @@ export default function Swap({ history }: RouteComponentProps) {
inputError: wrapInputError,
} = useWrapCallback(currencies[Field.INPUT], currencies[Field.OUTPUT], typedValue)
const showWrap: boolean = wrapType !== WrapType.NOT_APPLICABLE
console.log(showWrap)
const { address: recipientAddress } = useENSAddress(recipient)
const parsedAmounts = useMemo(
......@@ -428,6 +429,7 @@ export default function Swap({ history }: RouteComponentProps) {
</>
) : null}
{showWrap ? null : (
<Row style={{ justifyContent: !trade ? 'center' : 'space-between' }}>
<RowFixed>
{[V3TradeState.VALID, V3TradeState.SYNCING, V3TradeState.NO_ROUTE_FOUND].includes(v3TradeState) &&
......@@ -492,6 +494,7 @@ export default function Swap({ history }: RouteComponentProps) {
</RowFixed>
) : null}
</Row>
)}
<BottomGrouping>
{swapIsUnsupported ? (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment