diff --git a/.changeset/silver-moons-laugh.md b/.changeset/silver-moons-laugh.md new file mode 100644 index 000000000..7e4248f64 --- /dev/null +++ b/.changeset/silver-moons-laugh.md @@ -0,0 +1,5 @@ +--- +'minifront': minor +--- + +remove non-native-fee-warning from minifront diff --git a/apps/minifront/src/components/send/send-form/index.tsx b/apps/minifront/src/components/send/send-form/index.tsx index 1a6e40d06..3412fb1da 100644 --- a/apps/minifront/src/components/send/send-form/index.tsx +++ b/apps/minifront/src/components/send/send-form/index.tsx @@ -8,7 +8,6 @@ import { penumbraAddrValidation } from '../helpers'; import InputToken from '../../shared/input-token'; import { GasFee } from '../../shared/gas-fee'; import { useBalancesResponses, useStakingTokenMetadata } from '../../../state/shared'; -import { NonNativeFeeWarning } from '../../shared/non-native-fee-warning'; import { transferableBalancesResponsesSelector } from '../../../state/send/helpers'; import { useRefreshFee } from '../../v2/transfer-layout/send-page/use-refresh-fee'; @@ -94,12 +93,6 @@ export const SendForm = () => { loading={transferableBalancesResponses?.loading} /> - - { - const account = getAddressIndex.optional(source)?.account; - if (typeof account === 'undefined') { - return false; - } - - const hasUmInAccount = hasStakingToken(balancesResponses, stakingAssetMetadata, source); - if (hasUmInAccount) { - return false; - } - - const accountAssets = balancesResponses.filter( - balance => getAddressIndex.optional(balance)?.account === account, - ); - // Finds the alt tokens in the user's account balances that can be used for fees - const hasAltTokens = accountAssets.some(balance => { - const amount = getAmount(balance); - const hasBalance = amount.lo !== 0n || amount.hi !== 0n; - if (!hasBalance) { - return false; - } - - return gasPrices.some(price => - price.assetId?.equals(getAssetIdFromBalancesResponse.optional(balance)), - ); - }); - - return hasAltTokens; -}; - -/** - * Renders a non-native fee warning if - * 1. the user does not have any balance (in the selected account) of the staking token to use for fees - * 2. the user does not have sufficient balances in alternative tokens to cover the fees - */ -export const NonNativeFeeWarning = ({ - amount, - balancesResponses, - source, - wrap = children => children, -}: { - /** - * The amount that the user is putting into this transaction, which will help - * determine whether the warning should render. - */ - amount: number; - /** - * The user's balances that are relevant to this transaction, from which - * `` will determine whether to render. - */ - balancesResponses: BalancesResponse[] | undefined; - /** - * A source token – helps determine whether the user has UM token - * in the same account as `source` to use for fees. - */ - source: BalancesResponse | undefined; - /* - * Since this component determines for itself whether to render, a parent - * component can't optionally render wrapper markup depending on whether this - * component will render or not. To work around this, parent components can - * pass a `wrap` function that takes a `children` argument, and provide - * wrapper markup that will only be rendered if this component renders. - * - * @example - * ```tsx - *
{children}
} - * /> - * ``` - */ - wrap?: (children: ReactNode) => ReactNode; -}) => { - const { data } = useGasPrices(); - const stakingTokenMetadata = useStakingTokenMetadata(); - const shouldRender = - !!amount && - hasRelevantAltTokenBalance({ - source, - balancesResponses: balancesResponses ?? [], - gasPrices: data ?? [], - stakingAssetMetadata: stakingTokenMetadata.data, - }); - if (!shouldRender) { - return null; - } - - return wrap( -
- Privacy Warning: - - You are using an alternative token for transaction fees, which may pose a privacy risk. It - is recommended to use the native token (UM) for better privacy and security. - -
, - ); -}; diff --git a/apps/minifront/src/components/swap/swap-form/token-swap-input.tsx b/apps/minifront/src/components/swap/swap-form/token-swap-input.tsx index 9893c5cc8..c3221c053 100644 --- a/apps/minifront/src/components/swap/swap-form/token-swap-input.tsx +++ b/apps/minifront/src/components/swap/swap-form/token-swap-input.tsx @@ -13,7 +13,6 @@ import { AssetSelector } from '../../shared/selectors/asset-selector'; import BalanceSelector from '../../shared/selectors/balance-selector'; import { zeroValueView } from '../../../utils/zero-value-view'; import { isValidAmount } from '../../../state/helpers'; -import { NonNativeFeeWarning } from '../../shared/non-native-fee-warning'; import { NumberInput } from '../../shared/number-input'; import { useAssets, useBalancesResponses } from '../../../state/shared'; import { getBalanceByMatchingMetadataAndAddressIndex } from '../../../state/swap/getters'; @@ -140,19 +139,6 @@ export const TokenSwapInput = () => { - - ( - <> - {/* This div adds an empty line */} -
- {children} - - )} - /> ); };