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

Prevent confirm screen from showing method name from contract registry for txes created within MetaMask (#15472)

* Prevent confirm screen from showing method name from contract registry for txes created within MetaMask

* Ensure method name does not get sent in state when sending to a contract, with tx data, from metamask send screen
This commit is contained in:
Dan J Miller 2022-08-04 17:20:32 -02:30 committed by GitHub
parent fa336b5137
commit 4fdbc816c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 5 deletions

View File

@ -1054,7 +1054,10 @@ export default class ConfirmTransactionBase extends Component {
} = this.getNavigateTxData(); } = this.getNavigateTxData();
let functionType; let functionType;
if (txData.type === TRANSACTION_TYPES.CONTRACT_INTERACTION) { if (
txData.type === TRANSACTION_TYPES.CONTRACT_INTERACTION &&
txData.origin !== 'metamask'
) {
functionType = getMethodName(name); functionType = getMethodName(name);
} }

View File

@ -68,7 +68,7 @@ export default class ConfirmTransaction extends Component {
sendTo, sendTo,
history, history,
mostRecentOverviewPage, mostRecentOverviewPage,
transaction: { txParams: { data } = {} } = {}, transaction: { txParams: { data } = {}, origin } = {},
getContractMethodData, getContractMethodData,
transactionId, transactionId,
paramsTransactionId, paramsTransactionId,
@ -91,7 +91,9 @@ export default class ConfirmTransaction extends Component {
return; return;
} }
getContractMethodData(data); if (origin !== 'metamask') {
getContractMethodData(data);
}
const txId = transactionId || paramsTransactionId; const txId = transactionId || paramsTransactionId;
if (txId) { if (txId) {
@ -107,7 +109,7 @@ export default class ConfirmTransaction extends Component {
componentDidUpdate(prevProps) { componentDidUpdate(prevProps) {
const { const {
setTransactionToConfirm, setTransactionToConfirm,
transaction: { txData: { txParams: { data } = {} } = {} }, transaction: { txData: { txParams: { data } = {}, origin } = {} },
clearConfirmTransaction, clearConfirmTransaction,
getContractMethodData, getContractMethodData,
paramsTransactionId, paramsTransactionId,
@ -124,8 +126,10 @@ export default class ConfirmTransaction extends Component {
prevProps.paramsTransactionId !== paramsTransactionId prevProps.paramsTransactionId !== paramsTransactionId
) { ) {
clearConfirmTransaction(); clearConfirmTransaction();
getContractMethodData(data);
setTransactionToConfirm(paramsTransactionId); setTransactionToConfirm(paramsTransactionId);
if (origin !== 'metamask') {
getContractMethodData(data);
}
} else if ( } else if (
prevProps.transactionId && prevProps.transactionId &&
!transactionId && !transactionId &&