adds trezor support to isDevel

This commit is contained in:
Matias Alejo Garcia 2015-11-05 16:00:38 -03:00
commit 5abf35c68c
5 changed files with 52 additions and 37 deletions

View file

@ -0,0 +1,5 @@
'use strict';
angular.module('copayApp.services').factory('isDevel', function(nodeWebkit, isChromeApp, isMobile) {
return !isMobile.any() && !isChromeApp && !nodeWebkit.isDefined();
});

View file

@ -175,6 +175,13 @@ angular.module('copayApp.services')
var walletClient = bwcService.getClient();
var network = opts.networkName || 'livenet';
// TODO refactor this and use bwc contants?
var derivationStrategy = 'BIP44';
if (opts.fromHardware && opts.n > 1) {
derivationStrategy = 'BIP48';
}
if (opts.mnemonic) {
try {
opts.mnemonic = root._normalizeMnemonic(opts.mnemonic);
@ -182,14 +189,9 @@ angular.module('copayApp.services')
network: network,
passphrase: opts.passphrase,
account: opts.account || 0,
derivationStrategy: derivationStrategy,
});
// </ Nasty
if (opts.fromHardware && opts.n>1) {
//walletClient.credentials.derivationStrategy ==
}
// Nasty>
} catch (ex) {
$log.info(ex);
return cb(gettext('Could not create: Invalid wallet seed'));
@ -204,7 +206,8 @@ angular.module('copayApp.services')
} else if (opts.extendedPublicKey) {
try {
walletClient.seedFromExtendedPublicKey(opts.extendedPublicKey, opts.externalSource, opts.entropySource, {
account: opts.account || 0,
account: opts.account || 0,
derivationStrategy: derivationStrategy,
});
} catch (ex) {
$log.warn("Creating wallet from Extended Public Key Arg:", ex, opts);
@ -368,7 +371,7 @@ angular.module('copayApp.services')
root.setWalletClients();
root.setAndStoreFocus(walletId, function() {
storageService.storeProfile(root.profile, function(err){
storageService.storeProfile(root.profile, function(err) {
return cb(err, walletId);
});
});