aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/controllers/transactions/lib/recipient-blacklist-checker.js
blob: e4df2367ed6d3eb8fdd460f893622ce3526585e9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const Config = require('./recipient-blacklist.js')

/** @module*/
module.exports = {
  checkAccount,
}

/**
 * Checks if a specified account on a specified network is blacklisted.
  @param networkId {number}
  @param account {string}
*/
function checkAccount (networkId, account) {

  const mainnetId = 1
  if (networkId !== mainnetId) {
    return
  }

  const accountToCheck = account.toLowerCase()
  if (Config.blacklist.includes(accountToCheck)) {
    throw new Error('Recipient is a public account')
  }
}