aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/controllers/transactions/lib/recipient-blacklist-checker.js
blob: 84c6df1f0a9000d6461b60ae8999a738bbabbbca (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-config.json')

/** @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')
  }
}