diff options
author | kumavis <kumavis@users.noreply.github.com> | 2017-01-25 07:39:33 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-25 07:39:33 +0800 |
commit | 70b8e640f0170281b92ac610e063351a74d5333d (patch) | |
tree | b87831b7cf4acb06a0bca115b12e8be64210f455 /app/scripts/metamask-controller.js | |
parent | 463a56ff54b0d850c86348e260e5f7c17b138ccb (diff) | |
parent | 23c2b0b9a5d3f222bfeba7bcff5cf5a57367ffc8 (diff) | |
download | tangerine-wallet-browser-70b8e640f0170281b92ac610e063351a74d5333d.tar tangerine-wallet-browser-70b8e640f0170281b92ac610e063351a74d5333d.tar.gz tangerine-wallet-browser-70b8e640f0170281b92ac610e063351a74d5333d.tar.bz2 tangerine-wallet-browser-70b8e640f0170281b92ac610e063351a74d5333d.tar.lz tangerine-wallet-browser-70b8e640f0170281b92ac610e063351a74d5333d.tar.xz tangerine-wallet-browser-70b8e640f0170281b92ac610e063351a74d5333d.tar.zst tangerine-wallet-browser-70b8e640f0170281b92ac610e063351a74d5333d.zip |
Merge branch 'dev' into i#1048
Diffstat (limited to 'app/scripts/metamask-controller.js')
-rw-r--r-- | app/scripts/metamask-controller.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index a1bb9a923..5c663255a 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -14,6 +14,7 @@ const extension = require('./lib/extension') const autoFaucet = require('./lib/auto-faucet') const nodeify = require('./lib/nodeify') const IdStoreMigrator = require('./lib/idStore-migrator') +const accountImporter = require('./account-import-strategies') const version = require('../manifest.json').version module.exports = class MetamaskController extends EventEmitter { @@ -140,6 +141,16 @@ module.exports = class MetamaskController extends EventEmitter { if (!primaryKeyring) return cb(new Error('MetamaskController - No HD Key Tree found')) promiseToCallback(keyringController.addNewAccount(primaryKeyring))(cb) }, + importAccountWithStrategy: (strategy, args, cb) => { + accountImporter.importAccount(strategy, args) + .then((privateKey) => { + return keyringController.addNewKeyring('Simple Key Pair', [ privateKey ]) + }) + .then(keyring => keyring.getAccounts()) + .then((accounts) => keyringController.setSelectedAccount(accounts[0])) + .then(() => { cb(null, keyringController.fullUpdate()) }) + .catch((reason) => { cb(reason) }) + }, setSelectedAccount: nodeify(keyringController.setSelectedAccount).bind(keyringController), saveAccountLabel: nodeify(keyringController.saveAccountLabel).bind(keyringController), exportAccount: nodeify(keyringController.exportAccount).bind(keyringController), |