Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: unwrap and wq stats #513

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion features/withdrawals/claim/form/transaction-info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ import { DataTableRow } from '@lidofinance/lido-ui';
import { useClaimFormData } from '../claim-form-context';
import { useClaimTxPrice } from 'features/withdrawals/hooks/useWithdrawTxPrice';
import { FormatPrice } from 'shared/formatters';
import { useDappStatus } from 'shared/hooks/use-dapp-status';

export const TransactionInfo = () => {
const { isDappActive, isAccountActiveOnL2 } = useDappStatus();

const { selectedRequests } = useClaimFormData();
const { claimTxPriceInUsd, loading: claimTxPriceLoading } =
useClaimTxPrice(selectedRequests);
Expand All @@ -13,7 +16,11 @@ export const TransactionInfo = () => {
title="Max transaction cost"
loading={claimTxPriceLoading}
>
<FormatPrice amount={claimTxPriceInUsd} />
{!isDappActive || isAccountActiveOnL2 ? (
'-'
) : (
<FormatPrice amount={claimTxPriceInUsd} />
)}
</DataTableRow>
);
};
16 changes: 13 additions & 3 deletions features/withdrawals/request/form/transaction-info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@ import {
} from '../request-form-context';

export const TransactionInfo = () => {
const { isDappActive } = useDappStatus();
const {
isDappActive,
isWalletConnected,
isDappActiveAndNetworksMatched,
isAccountActiveOnL2,
} = useDappStatus();

const { isApprovalFlow, isApprovalFlowLoading, allowance } =
useRequestFormData();
const token = useWatch<RequestFormInputType, 'token'>({ name: 'token' });
Expand Down Expand Up @@ -51,13 +57,17 @@ export const TransactionInfo = () => {
data-testid="maxTxCost"
loading={requestTxPriceLoading}
>
<FormatPrice amount={requestTxPriceInUsd} />
{isWalletConnected && !isDappActiveAndNetworksMatched ? (
Jeday marked this conversation as resolved.
Show resolved Hide resolved
'-'
) : (
<FormatPrice amount={requestTxPriceInUsd} />
)}
</DataTableRow>
<AllowanceDataTableRow
data-testid="allowance"
token={token}
allowance={allowance}
isBlank={!isDappActive}
isBlank={!isDappActive || isAccountActiveOnL2}
loading={isApprovalFlowLoading}
/>
{token === TOKENS.STETH ? (
Expand Down
5 changes: 5 additions & 0 deletions features/wsteth/unwrap/unwrap-form/unwrap-stats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { useApproveGasLimit } from 'features/wsteth/wrap/hooks/use-approve-gas-l

export const UnwrapStats = () => {
const {
isDappActive,
isWalletConnected,
isAccountActiveOnL2,
isDappActiveAndNetworksMatched,
Expand Down Expand Up @@ -84,6 +85,10 @@ export const UnwrapStats = () => {
allowance={BigNumber.from(allowance || '0')}
loading={isAllowanceLoading}
token={TOKENS.WSTETH}
isBlank={
!isDappActive ||
(isWalletConnected && !isDappActiveAndNetworksMatched)
}
/>
)}
</DataTable>
Expand Down
Loading