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: Disable confirm button if transactionMeta is undefined #12273

Merged
Changes from 1 commit
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
20 changes: 15 additions & 5 deletions app/components/Views/confirmations/SendFlow/Confirm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { connect } from 'react-redux';
import { getSendFlowTitle } from '../../../../UI/Navbar';
import PropTypes from 'prop-types';
import Eth from '@metamask/ethjs-query';
import { isEmpty } from 'lodash';
import {
renderFromWei,
renderFromTokenMinimalUnit,
Expand Down Expand Up @@ -486,11 +487,18 @@ class Confirm extends PureComponent {
const { TransactionController } = Engine.context;
const transactionParams = this.prepareTransactionToSend();

const { result, transactionMeta } =
await TransactionController.addTransaction(transactionParams, {
deviceConfirmedOn: WalletDevice.MM_MOBILE,
origin: TransactionTypes.MMM,
});
let result, transactionMeta;
try {
({ result, transactionMeta } = await TransactionController.addTransaction(
transactionParams,
{
deviceConfirmedOn: WalletDevice.MM_MOBILE,
origin: TransactionTypes.MMM,
},
));
} catch (error) {
Logger.error(error, 'error while adding transaction (Confirm)');
matthewwalsh0 marked this conversation as resolved.
Show resolved Hide resolved
}

setTransactionId(transactionMeta.id);

Expand Down Expand Up @@ -1305,6 +1313,7 @@ class Confirm extends PureComponent {
EIP1559GasObject,
EIP1559GasTransaction,
legacyGasObject,
transactionMeta,
} = this.state;
const colors = this.context.colors || mockTheme.colors;
const styles = createStyles(colors);
Expand Down Expand Up @@ -1477,6 +1486,7 @@ class Confirm extends PureComponent {
<StyledButton
type={'confirm'}
disabled={
isEmpty(transactionMeta) ||
transactionConfirmed ||
!gasEstimationReady ||
Boolean(errorMessage) ||
Expand Down
Loading