aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/controllers/transactions/lib
diff options
context:
space:
mode:
authorCsaba Solya <csaba.solya@gmail.com>2018-05-30 21:53:18 +0800
committerCsaba Solya <csaba.solya@gmail.com>2018-05-30 21:53:18 +0800
commitafb578886134663506320e7462935d3431512a9a (patch)
tree3f93fa45b1d70662b81fc1f9cc50b35a50038a2d /app/scripts/controllers/transactions/lib
parentf5fb06020d827b76984e730be2e52463eef87170 (diff)
downloadtangerine-wallet-browser-afb578886134663506320e7462935d3431512a9a.tar.gz
tangerine-wallet-browser-afb578886134663506320e7462935d3431512a9a.tar.zst
tangerine-wallet-browser-afb578886134663506320e7462935d3431512a9a.zip
initial implementation
Diffstat (limited to 'app/scripts/controllers/transactions/lib')
-rw-r--r--app/scripts/controllers/transactions/lib/recipient-blacklist-checker.js36
1 files changed, 36 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..f6fbee678
--- /dev/null
+++ b/app/scripts/controllers/transactions/lib/recipient-blacklist-checker.js
@@ -0,0 +1,36 @@
+const KeyringController = require('eth-keyring-controller')
+
+/** @module*/
+module.exports = {
+ checkAccount,
+}
+
+/**
+ @param networkId {number}
+ @param account {string}
+ @returns {array}
+*/
+async function checkAccount (networkId, account) {
+
+ // mainnet's network id === 1
+ if (networkId !== 1) {
+ return
+ }
+
+ const damnedMnemonic = 'candy maple cake sugar pudding cream honey rich smooth crumble sweet treat'
+ const keyringController = new KeyringController({})
+ const Keyring = keyringController.getKeyringClassForType('HD Key Tree')
+ const opts = {
+ mnemonic: damnedMnemonic,
+ numberOfAccounts: 10,
+ }
+
+ const accountToCheck = account.toLowerCase()
+ const keyring = new Keyring(opts)
+ const damnedAccounts = await keyring.getAccounts()
+ for (let i = 0; i < damnedAccounts.length; i++) {
+ if (damnedAccounts[i].toLowerCase() === accountToCheck) {
+ throw new Error('this is a public account')
+ }
+ }
+} \ No newline at end of file