1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 09:57:02 +01: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 GitHub
parent 9f17e2f94b
commit bdf3b8486b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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,