diff --git a/app/scripts/controllers/transactions/index.js b/app/scripts/controllers/transactions/index.js index f09dc795f228..d768512c07c3 100644 --- a/app/scripts/controllers/transactions/index.js +++ b/app/scripts/controllers/transactions/index.js @@ -854,12 +854,12 @@ export default class TransactionController extends EventEmitter { : '0x0'; if (txMethodType && this.securityProviderRequest) { - const flagAsDangerous = await this.securityProviderRequest( + const securityProviderResponse = await this.securityProviderRequest( txMeta, txMethodType, ); - txMeta.flagAsDangerous = flagAsDangerous; + txMeta.securityProviderResponse = securityProviderResponse; } this.addTransaction(txMeta); diff --git a/app/scripts/controllers/transactions/index.test.js b/app/scripts/controllers/transactions/index.test.js index 0106f14ed5d6..0e921845e5c1 100644 --- a/app/scripts/controllers/transactions/index.test.js +++ b/app/scripts/controllers/transactions/index.test.js @@ -1354,6 +1354,21 @@ describe('Transaction Controller', function () { txController.txStateManager.getTransactions().length; assert.equal(transactionCount1 + 1, transactionCount2); }); + + it('should call securityProviderRequest and have flagAsDangerous inside txMeta', async function () { + const txMeta = await txController.addUnapprovedTransaction( + 'eth_sendTransaction', + { + from: selectedAddress, + to: recipientAddress, + }, + ); + + assert.ok( + 'securityProviderResponse' in txMeta, + 'should have a securityProviderResponse', + ); + }); }); describe('#signTransaction', function () { diff --git a/app/scripts/lib/message-manager.js b/app/scripts/lib/message-manager.js index 3916d586249e..ae1f0088b0bc 100644 --- a/app/scripts/lib/message-manager.js +++ b/app/scripts/lib/message-manager.js @@ -138,12 +138,12 @@ export default class MessageManager extends EventEmitter { }; this.addMsg(msgData); - const flagAsDangerous = await this.securityProviderRequest( + const securityProviderResponse = await this.securityProviderRequest( msgData, msgData.type, ); - msgData.flagAsDangerous = flagAsDangerous; + msgData.securityProviderResponse = securityProviderResponse; // signal update this.emit('update'); diff --git a/app/scripts/lib/personal-message-manager.js b/app/scripts/lib/personal-message-manager.js index 24bd8c7c3e0c..242dabb02230 100644 --- a/app/scripts/lib/personal-message-manager.js +++ b/app/scripts/lib/personal-message-manager.js @@ -165,12 +165,12 @@ export default class PersonalMessageManager extends EventEmitter { }; this.addMsg(msgData); - const flagAsDangerous = await this.securityProviderRequest( + const securityProviderResponse = await this.securityProviderRequest( msgData, msgData.type, ); - msgData.flagAsDangerous = flagAsDangerous; + msgData.securityProviderResponse = securityProviderResponse; // signal update this.emit('update'); diff --git a/app/scripts/lib/typed-message-manager.js b/app/scripts/lib/typed-message-manager.js index b9526d0f3386..75a5d7c80458 100644 --- a/app/scripts/lib/typed-message-manager.js +++ b/app/scripts/lib/typed-message-manager.js @@ -155,12 +155,12 @@ export default class TypedMessageManager extends EventEmitter { }; this.addMsg(msgData); - const flagAsDangerous = await this.securityProviderRequest( + const securityProviderResponse = await this.securityProviderRequest( msgData, msgData.type, ); - msgData.flagAsDangerous = flagAsDangerous; + msgData.securityProviderResponse = securityProviderResponse; // signal update this.emit('update'); diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 0464bb4e51bf..9b45ac231a02 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -4560,13 +4560,14 @@ export default class MetamaskController extends EventEmitter { if (transactionSecurityCheckEnabled) { try { - const { flagAsDangerous } = await securityProviderCheck( + const securityProviderResponse = await securityProviderCheck( requestData, methodName, chainId, currentLocale, ); - return flagAsDangerous; + + return securityProviderResponse; } catch (err) { log.error(err.message); throw err;