1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 19:26:13 +02:00

Fix GetEncryptionKey TypeError Cannot destructure property 'msgParams' of 'txData' (#17808)

* fix ConfirmEncryptionPublicKey txData

* encrypt/decrypt: fix missing txData state

* rm console.log
This commit is contained in:
Ariella Vu 2023-02-25 01:58:42 +07:00 committed by PeterYinusa
parent 591fe1a0a6
commit 97013d8028
4 changed files with 20 additions and 8 deletions

View File

@ -2,6 +2,7 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types';
import copyToClipboard from 'copy-to-clipboard';
import classnames from 'classnames';
import log from 'loglevel';
import AccountListItem from '../../components/app/account-list-item';
import Identicon from '../../components/ui/identicon';
@ -298,6 +299,11 @@ export default class ConfirmDecryptMessage extends Component {
};
render = () => {
if (!this.props.txData) {
log.warn('ConfirmDecryptMessage Page: Missing txData prop.');
return null;
}
return (
<div className="request-decrypt-message__container">
{this.renderHeader()}

View File

@ -27,11 +27,10 @@ function mapStateToProps(state) {
const txData = unconfirmedTransactions[0];
const {
msgParams: { from },
} = txData;
const fromAccount = getTargetAccountWithSendEtherInfo(state, from);
const fromAccount = getTargetAccountWithSendEtherInfo(
state,
txData?.msgParams?.from,
);
return {
txData,

View File

@ -1,5 +1,6 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import log from 'loglevel';
import AccountListItem from '../../components/app/account-list-item';
import Identicon from '../../components/ui/identicon';
@ -197,6 +198,11 @@ export default class ConfirmEncryptionPublicKey extends Component {
};
render = () => {
if (!this.props.txData) {
log.warn('ConfirmEncryptionPublicKey Page: Missing txData prop.');
return null;
}
return (
<div className="request-encryption-public-key__container">
{this.renderHeader()}

View File

@ -28,9 +28,10 @@ function mapStateToProps(state) {
const txData = unconfirmedTransactions[0];
const { msgParams: from } = txData;
const fromAccount = getTargetAccountWithSendEtherInfo(state, from);
const fromAccount = getTargetAccountWithSendEtherInfo(
state,
txData?.msgParams,
);
return {
txData,