1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-21 17:37:01 +01:00

Update useDraftTransactionGasValues (#19105)

* useDraftTransactionGasValues: update return value

* rn useDraftTransactionGasValues
-> useDraftTransactionWithTxParams
This commit is contained in:
Ariella Vu 2023-05-12 13:27:25 -05:00 committed by GitHub
parent 578f73b2ea
commit aa9ee8af6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 7 deletions

View File

@ -23,7 +23,7 @@ import {
TextVariant,
TextColor,
} from '../../../../helpers/constants/design-system';
import { useDraftTransactionGasValues } from '../../../../hooks/useDraftTransactionGasValues';
import { useDraftTransactionWithTxParams } from '../../../../hooks/useDraftTransactionWithTxParams';
import { getNativeCurrency } from '../../../../ducks/metamask/metamask';
import MultilayerFeeMessage from '../../multilayer-fee-message/multi-layer-fee-message';
import { Icon, IconName } from '../../../component-library';
@ -41,7 +41,7 @@ const ConfirmLegacyGasDisplay = () => {
const { useNativeCurrencyAsPrimaryCurrency } = useSelector(getPreferences);
const nativeCurrency = useSelector(getNativeCurrency);
const unapprovedTxs = useSelector(getUnapprovedTransactions);
const { transactionData } = useDraftTransactionGasValues();
const transactionData = useDraftTransactionWithTxParams();
const txData = useSelector((state) => txDataSelector(state));
const { id: transactionId, dappSuggestedGasFees } = txData;
const transaction = Object.keys(transactionData).length

View File

@ -20,13 +20,13 @@ import GasTiming from '../gas-timing/gas-timing.component';
import TransactionDetailItem from '../transaction-detail-item/transaction-detail-item.component';
import UserPreferencedCurrencyDisplay from '../user-preferenced-currency-display';
import { hexWEIToDecGWEI } from '../../../../shared/modules/conversion.utils';
import { useDraftTransactionGasValues } from '../../../hooks/useDraftTransactionGasValues';
import { useDraftTransactionWithTxParams } from '../../../hooks/useDraftTransactionWithTxParams';
import GasDetailsItemTitle from './gas-details-item-title';
const GasDetailsItem = ({ userAcknowledgedGasMissing = false }) => {
const t = useI18nContext();
const draftTransaction = useSelector(getCurrentDraftTransaction);
const { transactionData } = useDraftTransactionGasValues();
const transactionData = useDraftTransactionWithTxParams();
const {
hexMinimumTransactionFee: draftHexMinimumTransactionFee,

View File

@ -8,13 +8,14 @@ import { getUnapprovedTransactions } from '../selectors';
* the gas data from draftTransaction and unapprovedTx has to be reorganized
* to mimic the txdata.txParam from a confirmTransaction
*
* @returns {Object txData.txParams}
* @returns {object} The transaction data
*/
export const useDraftTransactionGasValues = () => {
export const useDraftTransactionWithTxParams = () => {
const draftTransaction = useSelector(getCurrentDraftTransaction);
const unapprovedTxs = useSelector(getUnapprovedTransactions);
let transactionData = {};
if (Object.keys(draftTransaction).length !== 0) {
const editingTransaction = unapprovedTxs[draftTransaction.id];
transactionData = {
@ -36,5 +37,5 @@ export const useDraftTransactionGasValues = () => {
};
}
return { transactionData };
return transactionData;
};