1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00
metamask-extension/app/scripts/controllers/transactions/lib/recipient-blacklist-checker.js

25 lines
504 B
JavaScript
Raw Normal View History

import Config from './recipient-blacklist.js'
2018-05-30 15:53:18 +02:00
/** @module*/
export default {
2018-05-30 15:53:18 +02:00
checkAccount,
}
/**
2018-05-30 17:42:41 +02:00
* Checks if a specified account on a specified network is blacklisted.
@param {number} networkId
@param {string} account
2018-05-30 15:53:18 +02:00
*/
function checkAccount (networkId, account) {
2018-05-30 15:53:18 +02:00
const mainnetId = 1
if (networkId !== mainnetId) {
2018-05-30 15:53:18 +02:00
return
}
const accountToCheck = account.toLowerCase()
if (Config.blacklist.includes(accountToCheck)) {
throw new Error('Recipient is a public account')
2018-05-30 15:53:18 +02:00
}
}