Skip to content
Open
Changes from all 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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Hex, add0x } from '@metamask/utils';

Check failure on line 1 in ui/pages/confirmations/components/confirm/info/hooks/useGasFeeToken.ts

View workflow job for this annotation

GitHub Actions / test-lint / Test lint

'add0x' is defined but never used
import {
BatchTransactionParams,
GasFeeToken,
Expand All @@ -21,7 +21,6 @@
import { useFeeCalculations } from './useFeeCalculations';

export const RATE_WEI_NATIVE = '0xDE0B6B3A7640000'; // 1x10^18
export const METAMASK_FEE_PERCENTAGE = 0.35;

export function useGasFeeToken({ tokenAddress }: { tokenAddress?: Hex }) {
const { currentConfirmation: transactionMeta } =
Expand All @@ -41,9 +40,7 @@

const { amount, decimals } = gasFeeToken ?? { amount: '0x0', decimals: 0 };

const metaMaskFee = add0x(
new BigNumber(amount).times(METAMASK_FEE_PERCENTAGE).toString(16),
);
const metaMaskFee = gasFeeToken?.fee;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: MetaMask Fee Display Fails for Native Tokens

The metaMaskFee is undefined for native token transactions. This occurs because useNativeGasFeeToken() doesn't provide a fee property, which the new logic expects. This breaks the MetaMask fee display when falling back to native tokens, as a fee was always calculated previously.

Fix in Cursor Fix in Web


const amountFormatted = formatAmount(
locale,
Expand Down
Loading