display wallet icon, m&n, account number - refactor

This commit is contained in:
Javier 2017-01-04 19:22:33 -03:00 committed by Matias Alejo Garcia
commit 6fc0ed2327
No known key found for this signature in database
GPG key ID: 02470DB551277AB3
3 changed files with 24 additions and 31 deletions

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.services')
.factory('hwWallet', function($log, bwcService) {
.factory('hwWallet', function($log, bwcService) {
var root = {};
// Ledger magic number to get xPub without user confirmation
@ -11,8 +11,7 @@ angular.module('copayApp.services')
root.LIVENET_PATH = 0;
root._err = function(data) {
var msg = 'Hardware Wallet Error: ' + (data.error || data.message || 'unknown');
$log.warn(msg);
var msg = data.error || data.message || 'unknown';
return msg;
};
@ -21,13 +20,13 @@ angular.module('copayApp.services')
if (!isMultisig) return root.UNISIG_ROOTPATH;
// Compat
if (device == 'ledger' && account ==0) return root.UNISIG_ROOTPATH;
if (device == 'ledger' && account == 0) return root.UNISIG_ROOTPATH;
return root.MULTISIG_ROOTPATH;
};
root.getAddressPath = function(device, isMultisig, account) {
return root.getRootPath(device,isMultisig,account) + "'/" + root.LIVENET_PATH + "'/" + account + "'";
return root.getRootPath(device, isMultisig, account) + "'/" + root.LIVENET_PATH + "'/" + account + "'";
}
root.getEntropyPath = function(device, isMultisig, account) {
@ -35,9 +34,9 @@ angular.module('copayApp.services')
// Old ledger wallet compat
if (device == 'ledger' && account == 0)
return root.ENTROPY_INDEX_PATH + "0'";
return root.ENTROPY_INDEX_PATH + "0'";
return root.ENTROPY_INDEX_PATH + root.getRootPath(device,isMultisig,account) + "'/" + account + "'";
return root.ENTROPY_INDEX_PATH + root.getRootPath(device, isMultisig, account) + "'/" + account + "'";
};
root.pubKeyToEntropySource = function(xPubKey) {