1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-24 11:01:41 +01:00
metamask-extension/app/scripts/controllers/transactions/lib/recipient-blacklist-checker.js

25 lines
511 B
JavaScript
Raw Normal View History

const Config = require('./recipient-blacklist.js')
2018-05-30 15:53:18 +02:00
/** @module*/
module.exports = {
checkAccount,
}
/**
2018-05-30 17:42:41 +02:00
* Checks if a specified account on a specified network is blacklisted.
2018-05-30 15:53:18 +02:00
@param networkId {number}
@param account {string}
*/
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
}
}