WIP: ledger P2PKH

This commit is contained in:
Matias Alejo Garcia 2015-09-11 15:43:42 -03:00
commit 78e6120e55
11 changed files with 74 additions and 32 deletions

View file

@ -35,8 +35,6 @@ angular.module('copayApp.controllers').controller('createController',
$scope.requiredCopayers = Math.min(parseInt(n / 2 + 1), maxReq);
};
this.externalIndexValues = lodash.range(0, ledger.MAX_SLOT);
$scope.externalIndex = 0;
this.TCValues = lodash.range(2, defaults.limits.totalCopayers + 1);
$scope.totalCopayers = defaults.wallet.totalCopayers;
@ -80,7 +78,8 @@ angular.module('copayApp.controllers').controller('createController',
if (form.hwLedger.$modelValue) {
self.ledger = true;
ledger.getInfoForNewWallet($scope.externalIndex, function(err, lopts) {
// TODO : account
ledger.getInfoForNewWallet(0, function(err, lopts) {
self.ledger = false;
if (err) {
self.error = err;

View file

@ -7,8 +7,6 @@ angular.module('copayApp.controllers').controller('importController',
this.isSafari = isMobile.Safari();
this.isCordova = isCordova;
this.externalIndexValues = lodash.range(0, ledger.MAX_SLOT);
$scope.externalIndex = 0;
var reader = new FileReader();
window.ignoreMobilePause = true;
@ -199,7 +197,8 @@ angular.module('copayApp.controllers').controller('importController',
return;
}
self.ledger = true;
ledger.getInfoForNewWallet($scope.externalIndex, function(err, lopts) {
// TODO account
ledger.getInfoForNewWallet(0, function(err, lopts) {
self.ledger = false;
if (err) {
self.error = err;

View file

@ -4,8 +4,6 @@ angular.module('copayApp.controllers').controller('joinController',
function($scope, $rootScope, $timeout, go, isMobile, notification, profileService, isCordova, isChromeApp, $modal, gettext, lodash, ledger) {
var self = this;
this.externalIndexValues = lodash.range(0,ledger.MAX_SLOT);
$scope.externalIndex = 0;
this.isChromeApp = function() {
return isChromeApp;
@ -176,7 +174,8 @@ angular.module('copayApp.controllers').controller('joinController',
if (form.hwLedger.$modelValue) {
self.ledger = true;
ledger.getInfoForNewWallet($scope.externalIndex, function(err, lopts) {
// TODO account
ledger.getInfoForNewWallet(0, function(err, lopts) {
self.ledger = false;
if (err) {
self.error = err;

View file

@ -17,7 +17,8 @@ angular.module('copayApp.controllers').controller('preferencesController',
if (fc) {
$scope.encrypt = fc.hasPrivKeyEncrypted();
this.externalSource = fc.getPrivKeyExternalSourceName() == 'ledger' ? "Ledger" : null;
this.externalIndex = fc.getExternalIndex();
// TODO externalAccount
//this.externalIndex = fc.getExternalIndex();
}
var unwatchSpendUnconfirmed = $scope.$watch('spendUnconfirmed', function(newVal, oldVal) {

View file

@ -264,7 +264,8 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
self.setOngoingProcess(gettext('Requesting Ledger Wallet to sign'));
$scope.loading = true;
$scope.error = null;
ledger.signTx(txp, fc.getExternalIndex(), function(result) {
// TODO account
ledger.signTx(txp, 0, function(result) {
if (result.success) {
txp.signatures = [];
for (var i=0; i<result.signatures.length; i++) {
@ -836,7 +837,8 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
if (fc.getPrivKeyExternalSourceName() == 'ledger') {
$log.debug('Requesting Ledger Chrome app to sign the transaction');
self.setOngoingProcess(gettext('Requesting Ledger Wallet to sign'));
ledger.signTx(txp, fc.getExternalIndex(), function(result) {
// TODO account
ledger.signTx(txp, 0, function(result) {
if (result.success) {
txp.signatures = [];
for (var i=0; i<result.signatures.length; i++) {