diff options
Use Array.includes
Diffstat (limited to 'app/scripts/metamask-controller.js')
-rw-r--r-- | app/scripts/metamask-controller.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 2cffa15c2..7d6f06f92 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -50,6 +50,7 @@ const seedPhraseVerifier = require('./lib/seed-phrase-verifier') const log = require('loglevel') const TrezorKeyring = require('eth-trezor-keyring') const LedgerBridgeKeyring = require('eth-ledger-bridge-keyring') +const HW_WALLETS_KEYRINGS = [TrezorKeyring.type, LedgerBridgeKeyring.type] const EthQuery = require('eth-query') const ethUtil = require('ethereumjs-util') const sigUtil = require('eth-sig-util') @@ -1021,15 +1022,14 @@ module.exports = class MetamaskController extends EventEmitter { log.info('MetaMaskController - eth_signTypedData') const msgId = msgParams.metamaskId const version = msgParams.version - const HW_WALLETS_KEYRINGS = [TrezorKeyring.type, LedgerBridgeKeyring.type] try { const cleanMsgParams = await this.typedMessageManager.approveMessage(msgParams) const address = sigUtil.normalize(cleanMsgParams.from) const keyring = await this.keyringController.getKeyringForAccount(address) let signature - // HW Wallet keyrings don't expose private keys so - // we need to handle it separately - if (HW_WALLETS_KEYRINGS.indexOf(keyring.type) === -1) { + // HW Wallet keyrings don't expose private keys + // so we need to handle it separately + if (!HW_WALLETS_KEYRINGS.includes(keyring.type)) { const wallet = keyring._getWalletForAccount(address) const privKey = ethUtil.toBuffer(wallet.getPrivateKey()) switch (version) { |