mirror of https://github.com/BTCPrivate/copay.git
adds trezor support to isDevel
This commit is contained in:
parent
d805d3484b
commit
5abf35c68c
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('createController',
|
angular.module('copayApp.controllers').controller('createController',
|
||||||
function($scope, $rootScope, $location, $timeout, $log, lodash, go, profileService, configService, isCordova, gettext, ledger, trezor, isMobile, isChromeApp) {
|
function($scope, $rootScope, $location, $timeout, $log, lodash, go, profileService, configService, isCordova, gettext, ledger, trezor, isMobile, isChromeApp, isDevel) {
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
var defaults = configService.getDefaults();
|
var defaults = configService.getDefaults();
|
||||||
|
@ -50,19 +50,19 @@ angular.module('copayApp.controllers').controller('createController',
|
||||||
label: gettext('Specify Seed...'),
|
label: gettext('Specify Seed...'),
|
||||||
}];
|
}];
|
||||||
$scope.seedSource = self.seedOptions[0];
|
$scope.seedSource = self.seedOptions[0];
|
||||||
if (!isChromeApp) return;
|
|
||||||
|
|
||||||
if (n > 1)
|
if (n > 1 && isChromeApp)
|
||||||
self.seedOptions.push({
|
self.seedOptions.push({
|
||||||
id: 'ledger',
|
id: 'ledger',
|
||||||
label: gettext('Ledger Hardware Wallet'),
|
label: gettext('Ledger Hardware Wallet'),
|
||||||
});
|
});
|
||||||
|
|
||||||
self.seedOptions.push({
|
if (isChromeApp || isDevel) {
|
||||||
id: 'trezor',
|
self.seedOptions.push({
|
||||||
label: gettext('Trezor Hardware Wallet'),
|
id: 'trezor',
|
||||||
});
|
label: gettext('Trezor Hardware Wallet'),
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.TCValues = lodash.range(2, defaults.limits.totalCopayers + 1);
|
this.TCValues = lodash.range(2, defaults.limits.totalCopayers + 1);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('importController',
|
angular.module('copayApp.controllers').controller('importController',
|
||||||
function($scope, $rootScope, $location, $timeout, $log, profileService, configService, notification, go, sjcl, gettext, lodash, ledger, trezor, isChromeApp) {
|
function($scope, $rootScope, $location, $timeout, $log, profileService, configService, notification, go, sjcl, gettext, lodash, ledger, trezor, isChromeApp, isDevel) {
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
var reader = new FileReader();
|
var reader = new FileReader();
|
||||||
|
@ -19,18 +19,21 @@ angular.module('copayApp.controllers').controller('importController',
|
||||||
|
|
||||||
var updateSeedSourceSelect = function() {
|
var updateSeedSourceSelect = function() {
|
||||||
self.seedOptions = [];
|
self.seedOptions = [];
|
||||||
if (!isChromeApp) return;
|
|
||||||
|
|
||||||
self.seedOptions.push({
|
if (isChromeApp) {
|
||||||
id: 'ledger',
|
self.seedOptions.push({
|
||||||
label: gettext('Ledger Hardware Wallet'),
|
id: 'ledger',
|
||||||
});
|
label: gettext('Ledger Hardware Wallet'),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
self.seedOptions.push({
|
if (isChromeApp || isDevel) {
|
||||||
id: 'trezor',
|
self.seedOptions.push({
|
||||||
label: gettext('Trezor Hardware Wallet'),
|
id: 'trezor',
|
||||||
});
|
label: gettext('Trezor Hardware Wallet'),
|
||||||
$scope.seedSource = self.seedOptions[0];
|
});
|
||||||
|
$scope.seedSource = self.seedOptions[0];
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('joinController',
|
angular.module('copayApp.controllers').controller('joinController',
|
||||||
function($scope, $rootScope, $timeout, go, notification, profileService, configService, isCordova, storageService, applicationService, $modal, gettext, lodash, ledger, trezor, isChromeApp) {
|
function($scope, $rootScope, $timeout, go, notification, profileService, configService, isCordova, storageService, applicationService, $modal, gettext, lodash, ledger, trezor, isChromeApp, isDevel) {
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
var defaults = configService.getDefaults();
|
var defaults = configService.getDefaults();
|
||||||
|
@ -25,17 +25,21 @@ angular.module('copayApp.controllers').controller('joinController',
|
||||||
label: gettext('Specify Seed...'),
|
label: gettext('Specify Seed...'),
|
||||||
}];
|
}];
|
||||||
$scope.seedSource = self.seedOptions[0];
|
$scope.seedSource = self.seedOptions[0];
|
||||||
if (!isChromeApp) return;
|
|
||||||
|
|
||||||
self.seedOptions.push({
|
|
||||||
id: 'ledger',
|
|
||||||
label: gettext('Ledger Hardware Wallet'),
|
|
||||||
});
|
|
||||||
|
|
||||||
self.seedOptions.push({
|
if (isChromeApp) {
|
||||||
id: 'trezor',
|
self.seedOptions.push({
|
||||||
label: gettext('Trezor Hardware Wallet'),
|
id: 'ledger',
|
||||||
});
|
label: gettext('Ledger Hardware Wallet'),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isChromeApp || isDevel) {
|
||||||
|
self.seedOptions.push({
|
||||||
|
id: 'trezor',
|
||||||
|
label: gettext('Trezor Hardware Wallet'),
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.setSeedSource = function(src) {
|
this.setSeedSource = function(src) {
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('copayApp.services').factory('isDevel', function(nodeWebkit, isChromeApp, isMobile) {
|
||||||
|
return !isMobile.any() && !isChromeApp && !nodeWebkit.isDefined();
|
||||||
|
});
|
|
@ -175,6 +175,13 @@ angular.module('copayApp.services')
|
||||||
var walletClient = bwcService.getClient();
|
var walletClient = bwcService.getClient();
|
||||||
var network = opts.networkName || 'livenet';
|
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) {
|
if (opts.mnemonic) {
|
||||||
try {
|
try {
|
||||||
opts.mnemonic = root._normalizeMnemonic(opts.mnemonic);
|
opts.mnemonic = root._normalizeMnemonic(opts.mnemonic);
|
||||||
|
@ -182,14 +189,9 @@ angular.module('copayApp.services')
|
||||||
network: network,
|
network: network,
|
||||||
passphrase: opts.passphrase,
|
passphrase: opts.passphrase,
|
||||||
account: opts.account || 0,
|
account: opts.account || 0,
|
||||||
|
derivationStrategy: derivationStrategy,
|
||||||
});
|
});
|
||||||
|
|
||||||
// </ Nasty
|
|
||||||
if (opts.fromHardware && opts.n>1) {
|
|
||||||
//walletClient.credentials.derivationStrategy ==
|
|
||||||
}
|
|
||||||
// Nasty>
|
|
||||||
|
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
$log.info(ex);
|
$log.info(ex);
|
||||||
return cb(gettext('Could not create: Invalid wallet seed'));
|
return cb(gettext('Could not create: Invalid wallet seed'));
|
||||||
|
@ -205,6 +207,7 @@ angular.module('copayApp.services')
|
||||||
try {
|
try {
|
||||||
walletClient.seedFromExtendedPublicKey(opts.extendedPublicKey, opts.externalSource, opts.entropySource, {
|
walletClient.seedFromExtendedPublicKey(opts.extendedPublicKey, opts.externalSource, opts.entropySource, {
|
||||||
account: opts.account || 0,
|
account: opts.account || 0,
|
||||||
|
derivationStrategy: derivationStrategy,
|
||||||
});
|
});
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
$log.warn("Creating wallet from Extended Public Key Arg:", ex, opts);
|
$log.warn("Creating wallet from Extended Public Key Arg:", ex, opts);
|
||||||
|
@ -368,7 +371,7 @@ angular.module('copayApp.services')
|
||||||
root.setWalletClients();
|
root.setWalletClients();
|
||||||
|
|
||||||
root.setAndStoreFocus(walletId, function() {
|
root.setAndStoreFocus(walletId, function() {
|
||||||
storageService.storeProfile(root.profile, function(err){
|
storageService.storeProfile(root.profile, function(err) {
|
||||||
return cb(err, walletId);
|
return cb(err, walletId);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue