aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/controllers/transactions/lib/recipient-blacklist-checker.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/scripts/controllers/transactions/lib/recipient-blacklist-checker.js')
-rw-r--r--app/scripts/controllers/transactions/lib/recipient-blacklist-checker.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/app/scripts/controllers/transactions/lib/recipient-blacklist-checker.js b/app/scripts/controllers/transactions/lib/recipient-blacklist-checker.js
new file mode 100644
index 000000000..84c6df1f0
--- /dev/null
+++ b/app/scripts/controllers/transactions/lib/recipient-blacklist-checker.js
@@ -0,0 +1,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')
+ }
+}