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

20 lines
530 B
JavaScript
Raw Normal View History

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