mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 18:00:18 +01:00
Use Array.includes
This commit is contained in:
parent
fb94c1bae7
commit
f2066432ba
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user