2018-06-15 19:47:42 +02:00
|
|
|
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}
|
|
|
|
*/
|
2018-05-30 21:15:59 +02:00
|
|
|
function checkAccount (networkId, account) {
|
2018-05-30 15:53:18 +02:00
|
|
|
|
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()
|
2018-05-30 21:15:59 +02:00
|
|
|
if (Config.blacklist.includes(accountToCheck)) {
|
|
|
|
throw new Error('Recipient is a public account')
|
2018-05-30 15:53:18 +02:00
|
|
|
}
|
2018-05-30 17:38:27 +02:00
|
|
|
}
|