2020-04-20 16:36:02 +02:00
|
|
|
import blacklist from './recipient-blacklist'
|
2018-05-30 15:53:18 +02:00
|
|
|
|
|
|
|
/**
|
2020-04-20 20:59:41 +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) {
|
2018-05-30 17:38:27 +02:00
|
|
|
const mainnetId = 1
|
|
|
|
if (networkId !== mainnetId) {
|
2018-05-30 15:53:18 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
const accountToCheck = account.toLowerCase()
|
2020-04-20 16:36:02 +02:00
|
|
|
if (blacklist.includes(accountToCheck)) {
|
2018-05-30 21:15:59 +02:00
|
|
|
throw new Error('Recipient is a public account')
|
2018-05-30 15:53:18 +02:00
|
|
|
}
|
2018-05-30 17:38:27 +02:00
|
|
|
}
|