From f4878513af030246d0b2f6b6cb7c35ed4d1a922f Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Thu, 21 Jan 2016 02:56:40 -0300 Subject: [PATCH 1/8] Initial send confirmation popup --- public/views/includes/confirm-tx.html | 42 +++++++++++++++++++++++++++ public/views/walletHome.html | 2 ++ 2 files changed, 44 insertions(+) create mode 100644 public/views/includes/confirm-tx.html diff --git a/public/views/includes/confirm-tx.html b/public/views/includes/confirm-tx.html new file mode 100644 index 000000000..8dc2268b2 --- /dev/null +++ b/public/views/includes/confirm-tx.html @@ -0,0 +1,42 @@ + +
+
+ +
+
+
+

Confirm transaction

+ +
    +
  • + Amount + {{home.confirmTxPopup.amountStr}} + {{home.confirmTxPopup.alternativeAmountStr}} + +
  • +
  • + Fee + {{home.confirmTxPopup.feeStr}} +
  • +
+ +
+
+
+
+ +
+
+ +
+
+
diff --git a/public/views/walletHome.html b/public/views/walletHome.html index eba6ccf03..5c60bcfeb 100644 --- a/public/views/walletHome.html +++ b/public/views/walletHome.html @@ -511,6 +511,8 @@
+
+
From df834c50c3576d1fa2c010a8d0d4aa1c2c8d6e4e Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Wed, 27 Jan 2016 16:41:12 -0300 Subject: [PATCH 2/8] Complete flow of confirmation popup before send a tx --- public/index.html | 1 + public/views/includes/alert.html | 2 +- public/views/includes/confirm-tx.html | 68 +++++++------- public/views/includes/password.html | 2 +- public/views/modals/txp-details.html | 10 ++- public/views/walletHome.html | 2 - src/css/main.css | 28 +++++- src/js/controllers/confirmTx.js | 13 +++ src/js/controllers/index.js | 14 ++- src/js/controllers/walletHome.js | 123 ++++++++++++++++---------- src/js/services/txFormatService.js | 1 + src/js/services/txSignService.js | 37 +++++++- 12 files changed, 203 insertions(+), 98 deletions(-) create mode 100644 src/js/controllers/confirmTx.js diff --git a/public/index.html b/public/index.html index 56a114dec..a385dbe5e 100644 --- a/public/index.html +++ b/public/index.html @@ -27,6 +27,7 @@
+
+
diff --git a/public/views/includes/confirm-tx.html b/public/views/includes/confirm-tx.html index 8dc2268b2..98b507b19 100644 --- a/public/views/includes/confirm-tx.html +++ b/public/views/includes/confirm-tx.html @@ -1,42 +1,40 @@ +
-
-
+
-
-
-
-

Confirm transaction

- -
    -
  • - Amount - {{home.confirmTxPopup.amountStr}} - {{home.confirmTxPopup.alternativeAmountStr}} - -
  • -
  • - Fee - {{home.confirmTxPopup.feeStr}} -
  • -
- -
+
+

Confirm transaction

-
-
- +
+
{{tx.amountStr}}
+
{{tx.alternativeAmountStr}}
+ +
+ + + + Multiple recipients +
-
- +
+ Fee: {{tx.feeStr}} +
+
+
+ +
+
+ +
diff --git a/public/views/includes/password.html b/public/views/includes/password.html index 6df98bbce..3866c86f4 100644 --- a/public/views/includes/password.html +++ b/public/views/includes/password.html @@ -1,5 +1,5 @@ -
+
-
+
{{error|translate}}
-
- The payment was removed by creator +
+
+ The payment was removed by creator +
-
+
-
-
diff --git a/src/css/main.css b/src/css/main.css index c3ee54f83..ea456aad2 100644 --- a/src/css/main.css +++ b/src/css/main.css @@ -1373,9 +1373,30 @@ input.ng-invalid-match, input.ng-invalid-match:focus { } } +/* Confirmation popup */ + +.confirmTxModal { + background: white; + border-radius: 5px; + position: absolute; + width: 90%; + left: 0; + right: 0; + margin: 15% auto; + z-index: 1100; + text-align: center; +} + +.confirmHead { + padding: 10px; + border-top-left-radius: 5px; + border-top-right-radius: 5px; +} + +/*******************/ + .alertModal { background: #FFFFFF; - box-shadow: 0px 0px 6px 0px rgba(0,0,0,0.50); border-radius: 5px; position: absolute; width: 90%; @@ -1386,7 +1407,6 @@ input.ng-invalid-match, input.ng-invalid-match:focus { .passModal { background: #FFFFFF; - box-shadow: 0px 0px 6px 0px rgba(0,0,0,0.50); border-radius: 5px; position: absolute; width: 90%; @@ -1395,12 +1415,12 @@ input.ng-invalid-match, input.ng-invalid-match:focus { z-index: 1100; } -.passModalMask { +.modalMask { position: absolute; width: 100%; height: 100%; z-index: 1099; - opacity:0.3; + opacity:0.8; background: black; } diff --git a/src/js/controllers/confirmTx.js b/src/js/controllers/confirmTx.js new file mode 100644 index 000000000..05dfa8b02 --- /dev/null +++ b/src/js/controllers/confirmTx.js @@ -0,0 +1,13 @@ +'use strict'; + +angular.module('copayApp.controllers').controller('confirmTxController', function() { + + this.close = function(cb) { + return cb(); + }; + + this.accept = function(cb) { + return cb(true); + }; + +}); diff --git a/src/js/controllers/index.js b/src/js/controllers/index.js index 928c830e9..2df9bb817 100644 --- a/src/js/controllers/index.js +++ b/src/js/controllers/index.js @@ -391,7 +391,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r self.setFeeAndSendMax = function(cb) { - self.feeToSendMaxStr = null; self.availableMaxBalance = null; self.currentFeePerKb = null; @@ -1453,6 +1452,19 @@ angular.module('copayApp.controllers').controller('indexController', function($r self.setTab(tab, reset); }); + $rootScope.$on('Local/NeedConfirmation', function(event, txp, cb) { + self.confirmTx = { + txp : txFormatService.processTx(txp), + callback: function(accept) { + self.confirmTx = null; + return cb(accept); + } + }; + $timeout(function() { + $rootScope.$apply(); + }); + }); + $rootScope.$on('Local/NeedsPassword', function(event, isSetup, cb) { self.askPassword = { isSetup: isSetup, diff --git a/src/js/controllers/walletHome.js b/src/js/controllers/walletHome.js index 737849652..688f4566a 100644 --- a/src/js/controllers/walletHome.js +++ b/src/js/controllers/walletHome.js @@ -771,6 +771,8 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi var currentSpendUnconfirmed = configWallet.spendUnconfirmed; var currentFeeLevel = walletSettings.feeLevel || 'normal'; + var outputs = []; + this.resetError(); if (isCordova && this.isWindowsPhoneApp) { @@ -793,14 +795,6 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi return self.setSendError(gettext(msg)); } - var getFee = function(cb) { - if (self.lockedCurrentFeePerKb) { - cb(null, self.lockedCurrentFeePerKb); - } else { - feeService.getCurrentFeeValue(currentFeeLevel, cb); - } - }; - $timeout(function() { var paypro = self._paypro; var address, amount; @@ -808,57 +802,88 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi address = form.address.$modelValue; amount = parseInt((form.amount.$modelValue * unitToSat).toFixed(0)); + outputs.push({ + 'toAddress' : address, + 'amount': amount, + 'message': comment + }); + txSignService.prepare(function(err) { if (err) { return self.setSendError(err); } + + var opts = { + toAddress: address, + amount: amount, + outputs: outputs, + message: comment, + payProUrl: paypro ? paypro.url : null, + lockedCurrentFeePerKb: self.lockedCurrentFeePerKb + }; + self.setOngoingProcess(gettextCatalog.getString('Creating transaction')); - getFee(function(err, feePerKb) { - if (err) $log.debug(err); - fc.sendTxProposal({ - toAddress: address, - amount: amount, - message: comment, - payProUrl: paypro ? paypro.url : null, - feePerKb: feePerKb, - excludeUnconfirmedUtxos: currentSpendUnconfirmed ? false : true - }, function(err, txp) { - if (err) { - self.setOngoingProcess(); - return self.setSendError(err); - } + txSignService.createTx(opts, function(err, txp) { + self.setOngoingProcess(); + if (err) { + return self.setSendError(err); + } - if (!fc.canSign() && !fc.isPrivKeyExternal()) { - self.setOngoingProcess(); - $log.info('No signing proposal: No private key') - self.resetForm(); - txStatus.notify(txp, function() { - return $scope.$emit('Local/TxProposalAction'); - }); - return; - } - - txSignService.signAndBroadcast(txp, { - reporterFn: self.setOngoingProcess.bind(self) - }, function(err, txp) { - self.resetForm(); - if (err) { - self.error = err.message ? err.message : gettext('The payment was created but could not be completed. Please try again from home screen'); - $scope.$emit('Local/TxProposalAction'); - $timeout(function() { - $scope.$digest(); - }, 1); - } else { - go.walletHome(); - txStatus.notify(txp, function() { - $scope.$emit('Local/TxProposalAction', txp.status == 'broadcasted'); - }); - }; + if (!fc.canSign() && !fc.isPrivKeyExternal()) { + self.setOngoingProcess(); + $log.info('No signing proposal: No private key'); + self.resetForm(); + txStatus.notify(txp, function() { + return $scope.$emit('Local/TxProposalAction'); }); - }); + return; + } else { + $rootScope.$emit('Local/NeedConfirmation', txp, function(accept) { + if (accept) self.acceptTx(txp); + else self.resetForm(); + }); + } }); + }); }, 100); + }; + + this.acceptTx = function(txp) { + var self = this; + this.confirmTxPopup = null; + this.setOngoingProcess(gettextCatalog.getString('Sending transaction')); + txSignService.publishTx(txp.id, function(err) { + self.setOngoingProcess(); + if (err) { + $log.debug(err); + self.setSendError(err); + } else { + self.resetForm(); + // self.signAndBroadcastTx(txp); + } + }); + }; + + this.signAndBroadcastTx = function() { + var self = this; + txSignService.signAndBroadcast(txp, { + reporterFn: self.setOngoingProcess.bind(self) + }, function(err, txp) { + self.resetForm(); + if (err) { + self.error = err.message ? err.message : gettext('The payment was created but could not be completed. Please try again from home screen'); + $scope.$emit('Local/TxProposalAction'); + $timeout(function() { + $scope.$digest(); + }, 1); + } else { + go.walletHome(); + txStatus.notify(txp, function() { + $scope.$emit('Local/TxProposalAction', txp.status == 'broadcasted'); + }); + }; + }); }; this.setForm = function(to, amount, comment) { diff --git a/src/js/services/txFormatService.js b/src/js/services/txFormatService.js index 71bd41825..ede78468c 100644 --- a/src/js/services/txFormatService.js +++ b/src/js/services/txFormatService.js @@ -30,6 +30,7 @@ angular.module('copayApp.services').factory('txFormatService', function(profileS tx.hasMultiplesOutputs = true; tx.recipientCount = outputs; } + tx.toAddress = tx.outputs[0].toAddress; tx.amount = lodash.reduce(tx.outputs, function(total, o) { o.amountStr = formatAmountStr(o.amount); o.alternativeAmountStr = formatAlternativeStr(o.amount); diff --git a/src/js/services/txSignService.js b/src/js/services/txSignService.js index e32f79920..daf9e0ca1 100644 --- a/src/js/services/txSignService.js +++ b/src/js/services/txSignService.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.services').factory('txSignService', function($rootScope, profileService, gettextCatalog, lodash, trezor, ledger, configService, bwsError, $log) { +angular.module('copayApp.services').factory('txSignService', function($rootScope, profileService, gettextCatalog, lodash, trezor, ledger, configService, bwsError, $log, feeService) { var root = {}; var reportSigningStatus = function(opts) { @@ -85,8 +85,43 @@ angular.module('copayApp.services').factory('txSignService', function($rootScope }; return cb(); + }); }); + }; + + root.createTx = function(opts, cb) { + var fc = profileService.focusedClient; + var config = configService.getSync(); + var configWallet = config.wallet; + var walletSettings = configWallet.settings; + + var currentSpendUnconfirmed = configWallet.spendUnconfirmed; + var currentFeeLevel = walletSettings.feeLevel || 'normal'; + + var getFee = function(cb) { + if (opts.lockedCurrentFeePerKb) { + cb(null, opts.lockedCurrentFeePerKb); + } else { + feeService.getCurrentFeeValue(currentFeeLevel, cb); + } + }; + + getFee(function(err, feePerKb) { + if (err) $log.debug(err); + fc.createTxProposal(opts, function(err, txp) { + if (err) return cb(err); + else return cb(null, txp); + }); + }); + }; + + root.publishTx = function(txId, cb) { + var fc = profileService.focusedClient; + fc.publishTxProposal(txId, function(err) { + if (err) return cb(err); + else return cb(); + }); }; var _signWithLedger = function(txp, cb) { From 473142b85046dc811b8b80a92d4117bde23b230a Mon Sep 17 00:00:00 2001 From: Gustavo Cortez Date: Fri, 29 Jan 2016 11:30:52 -0300 Subject: [PATCH 3/8] Adds feePerKb --- src/js/controllers/walletHome.js | 2 +- src/js/services/txSignService.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/js/controllers/walletHome.js b/src/js/controllers/walletHome.js index 688f4566a..451814934 100644 --- a/src/js/controllers/walletHome.js +++ b/src/js/controllers/walletHome.js @@ -853,7 +853,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi var self = this; this.confirmTxPopup = null; this.setOngoingProcess(gettextCatalog.getString('Sending transaction')); - txSignService.publishTx(txp.id, function(err) { + txSignService.publishTx(txp, function(err) { self.setOngoingProcess(); if (err) { $log.debug(err); diff --git a/src/js/services/txSignService.js b/src/js/services/txSignService.js index daf9e0ca1..3dd8d9726 100644 --- a/src/js/services/txSignService.js +++ b/src/js/services/txSignService.js @@ -109,6 +109,8 @@ angular.module('copayApp.services').factory('txSignService', function($rootScope getFee(function(err, feePerKb) { if (err) $log.debug(err); + opts.feePerKb = feePerKb; + opts.excludeUnconfirmedUtxos = currentSpendUnconfirmed ? false : true; fc.createTxProposal(opts, function(err, txp) { if (err) return cb(err); else return cb(null, txp); @@ -116,9 +118,9 @@ angular.module('copayApp.services').factory('txSignService', function($rootScope }); }; - root.publishTx = function(txId, cb) { + root.publishTx = function(txp, cb) { var fc = profileService.focusedClient; - fc.publishTxProposal(txId, function(err) { + fc.publishTxProposal({txp: txp}, function(err) { if (err) return cb(err); else return cb(); }); From 5dec3249d1866a3d9cc1331aef386de28ed5478f Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Fri, 29 Jan 2016 16:39:32 -0300 Subject: [PATCH 4/8] Updates bitcore-wallet-client and fix functions --- package.json | 2 +- src/js/controllers/walletHome.js | 86 ++++++++++++++++---------------- src/js/services/txSignService.js | 4 +- 3 files changed, 45 insertions(+), 47 deletions(-) diff --git a/package.json b/package.json index bc60bfd79..18238f84a 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "url": "https://github.com/bitpay/copay/issues" }, "dependencies": { - "bitcore-wallet-client": "1.5.0", + "bitcore-wallet-client": "2.1.0", "express": "^4.11.2", "fs": "0.0.2", "grunt": "^0.4.5", diff --git a/src/js/controllers/walletHome.js b/src/js/controllers/walletHome.js index 451814934..a2d8503e8 100644 --- a/src/js/controllers/walletHome.js +++ b/src/js/controllers/walletHome.js @@ -808,69 +808,67 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi 'message': comment }); - txSignService.prepare(function(err) { + var opts = { + toAddress: address, + amount: amount, + outputs: outputs, + message: comment, + payProUrl: paypro ? paypro.url : null, + lockedCurrentFeePerKb: self.lockedCurrentFeePerKb + }; + + self.setOngoingProcess(gettextCatalog.getString('Creating transaction')); + txSignService.createTx(opts, function(err, txp) { + self.setOngoingProcess(); if (err) { return self.setSendError(err); } - var opts = { - toAddress: address, - amount: amount, - outputs: outputs, - message: comment, - payProUrl: paypro ? paypro.url : null, - lockedCurrentFeePerKb: self.lockedCurrentFeePerKb - }; - - self.setOngoingProcess(gettextCatalog.getString('Creating transaction')); - txSignService.createTx(opts, function(err, txp) { + if (!fc.canSign() && !fc.isPrivKeyExternal()) { self.setOngoingProcess(); - if (err) { - return self.setSendError(err); - } - - if (!fc.canSign() && !fc.isPrivKeyExternal()) { - self.setOngoingProcess(); - $log.info('No signing proposal: No private key'); - self.resetForm(); - txStatus.notify(txp, function() { - return $scope.$emit('Local/TxProposalAction'); - }); - return; - } else { - $rootScope.$emit('Local/NeedConfirmation', txp, function(accept) { - if (accept) self.acceptTx(txp); - else self.resetForm(); - }); - } - }); - + $log.info('No signing proposal: No private key'); + self.resetForm(); + txStatus.notify(txp, function() { + return $scope.$emit('Local/TxProposalAction'); + }); + return; + } else { + $rootScope.$emit('Local/NeedConfirmation', txp, function(accept) { + if (accept) self.acceptTx(txp); + else self.resetForm(); + }); + } }); + }, 100); }; this.acceptTx = function(txp) { var self = this; - this.confirmTxPopup = null; - this.setOngoingProcess(gettextCatalog.getString('Sending transaction')); - txSignService.publishTx(txp, function(err) { - self.setOngoingProcess(); + txSignService.prepare(function(err) { if (err) { - $log.debug(err); - self.setSendError(err); - } else { - self.resetForm(); - // self.signAndBroadcastTx(txp); + return self.setSendError(err); } + self.setOngoingProcess(gettextCatalog.getString('Sending transaction')); + txSignService.publishTx(txp, function(err, txpPublished) { + if (err) { + self.setOngoingProcess(); + self.setSendError(err); + } else { + self.prepareSignAndBroadcastTx(txpPublished); + } + }); }); }; - this.signAndBroadcastTx = function() { + this.prepareSignAndBroadcastTx = function(txp) { + var fc = profileService.focusedClient; var self = this; - txSignService.signAndBroadcast(txp, { + txSignService.prepareAndSignAndBroadcast(txp, { reporterFn: self.setOngoingProcess.bind(self) }, function(err, txp) { self.resetForm(); + if (err) { self.error = err.message ? err.message : gettext('The payment was created but could not be completed. Please try again from home screen'); $scope.$emit('Local/TxProposalAction'); @@ -882,7 +880,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi txStatus.notify(txp, function() { $scope.$emit('Local/TxProposalAction', txp.status == 'broadcasted'); }); - }; + } }); }; diff --git a/src/js/services/txSignService.js b/src/js/services/txSignService.js index 3dd8d9726..af54aca70 100644 --- a/src/js/services/txSignService.js +++ b/src/js/services/txSignService.js @@ -120,9 +120,9 @@ angular.module('copayApp.services').factory('txSignService', function($rootScope root.publishTx = function(txp, cb) { var fc = profileService.focusedClient; - fc.publishTxProposal({txp: txp}, function(err) { + fc.publishTxProposal({txp: txp}, function(err, txp) { if (err) return cb(err); - else return cb(); + else return cb(null, txp); }); }; From 9cc275af5f946441d6d33844716514ab8a0b9513 Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Fri, 29 Jan 2016 17:00:57 -0300 Subject: [PATCH 5/8] Support new proposals with array of outputs --- src/js/controllers/index.js | 1 - src/js/services/txFormatService.js | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/js/controllers/index.js b/src/js/controllers/index.js index 2df9bb817..23bf5b7a4 100644 --- a/src/js/controllers/index.js +++ b/src/js/controllers/index.js @@ -517,7 +517,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r message: 'test multi-output', fee: 1000, createdOn: new Date() / 1000, - type: 'multiple_output', outputs: [] }; function addOutput(n) { diff --git a/src/js/services/txFormatService.js b/src/js/services/txFormatService.js index ede78468c..7ca66dd5c 100644 --- a/src/js/services/txFormatService.js +++ b/src/js/services/txFormatService.js @@ -26,11 +26,10 @@ angular.module('copayApp.services').factory('txFormatService', function(profileS var outputs = lodash.isArray(tx.outputs) ? tx.outputs.length : 0; if (outputs && tx.action != 'received') { - if ((tx.type && tx.type == 'multiple_output') || (tx.proposalType && tx.proposalType == 'multiple_output')) { + if (outputs > 1) { tx.hasMultiplesOutputs = true; tx.recipientCount = outputs; } - tx.toAddress = tx.outputs[0].toAddress; tx.amount = lodash.reduce(tx.outputs, function(total, o) { o.amountStr = formatAmountStr(o.amount); o.alternativeAmountStr = formatAlternativeStr(o.amount); @@ -38,6 +37,7 @@ angular.module('copayApp.services').factory('txFormatService', function(profileS }, 0); } + tx.toAddress = tx.outputs[0].toAddress; // Get first address for single transactions tx.amountStr = formatAmountStr(tx.amount); tx.alternativeAmountStr = formatAlternativeStr(tx.amount); tx.feeStr = formatFeeStr(tx.fee || tx.fees); From df09e07ded85e875588db7f823cacfe28c5eded5 Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Thu, 11 Feb 2016 13:56:57 -0500 Subject: [PATCH 6/8] Refactor processTx --- src/js/services/txFormatService.js | 31 +++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/src/js/services/txFormatService.js b/src/js/services/txFormatService.js index 7ca66dd5c..9623753e8 100644 --- a/src/js/services/txFormatService.js +++ b/src/js/services/txFormatService.js @@ -24,20 +24,25 @@ angular.module('copayApp.services').factory('txFormatService', function(profileS root.processTx = function(tx) { if (!tx) return; - var outputs = lodash.isArray(tx.outputs) ? tx.outputs.length : 0; - if (outputs && tx.action != 'received') { - if (outputs > 1) { - tx.hasMultiplesOutputs = true; - tx.recipientCount = outputs; - } - tx.amount = lodash.reduce(tx.outputs, function(total, o) { - o.amountStr = formatAmountStr(o.amount); - o.alternativeAmountStr = formatAlternativeStr(o.amount); - return total + o.amount; - }, 0); - } + // New transaction output format + if (tx.outputs) { + + var outputsNr = tx.outputs.length; + + if (tx.action != 'received') { + if (outputsNr > 1) { + tx.recipientCount = outputsNr; + tx.hasMultiplesOutputs = true; + } + tx.amount = lodash.reduce(tx.outputs, function(total, o) { + o.amountStr = formatAmountStr(o.amount); + o.alternativeAmountStr = formatAlternativeStr(o.amount); + return total + o.amount; + }, 0); + } + tx.toAddress = tx.outputs[0].toAddress; + } - tx.toAddress = tx.outputs[0].toAddress; // Get first address for single transactions tx.amountStr = formatAmountStr(tx.amount); tx.alternativeAmountStr = formatAlternativeStr(tx.amount); tx.feeStr = formatFeeStr(tx.fee || tx.fees); From 90fba0de7a36ae18e4379c109d6f09f060bc4624 Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Thu, 11 Feb 2016 14:00:03 -0500 Subject: [PATCH 7/8] Fix typo --- src/js/controllers/index.js | 2 +- src/js/controllers/walletHome.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/controllers/index.js b/src/js/controllers/index.js index 23bf5b7a4..51b15863d 100644 --- a/src/js/controllers/index.js +++ b/src/js/controllers/index.js @@ -1451,7 +1451,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r self.setTab(tab, reset); }); - $rootScope.$on('Local/NeedConfirmation', function(event, txp, cb) { + $rootScope.$on('Local/NeedsConfirmation', function(event, txp, cb) { self.confirmTx = { txp : txFormatService.processTx(txp), callback: function(accept) { diff --git a/src/js/controllers/walletHome.js b/src/js/controllers/walletHome.js index a2d8503e8..0a08a00f7 100644 --- a/src/js/controllers/walletHome.js +++ b/src/js/controllers/walletHome.js @@ -833,7 +833,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi }); return; } else { - $rootScope.$emit('Local/NeedConfirmation', txp, function(accept) { + $rootScope.$emit('Local/NeedsConfirmation', txp, function(accept) { if (accept) self.acceptTx(txp); else self.resetForm(); }); From c471afb6d98630eaf8fbc3af8bf0a493da5d709d Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Thu, 11 Feb 2016 14:06:30 -0500 Subject: [PATCH 8/8] Renamed service --- src/js/controllers/preferences.js | 4 ++-- src/js/controllers/sellGlidera.js | 6 +++--- src/js/controllers/walletHome.js | 12 ++++++------ src/js/services/{txSignService.js => txService.js} | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) rename src/js/services/{txSignService.js => txService.js} (97%) diff --git a/src/js/controllers/preferences.js b/src/js/controllers/preferences.js index ce69f5903..4fb045216 100644 --- a/src/js/controllers/preferences.js +++ b/src/js/controllers/preferences.js @@ -1,7 +1,7 @@ 'use strict'; angular.module('copayApp.controllers').controller('preferencesController', - function($scope, $rootScope, $timeout, $log, configService, profileService, txSignService) { + function($scope, $rootScope, $timeout, $log, configService, profileService, txService) { var fc = profileService.focusedClient; $scope.deleted = false; @@ -75,7 +75,7 @@ angular.module('copayApp.controllers').controller('preferencesController', }; opts.touchIdFor[walletId] = newVal; - txSignService.setTouchId(function(err) { + txService.setTouchId(function(err) { if (err) { $log.debug(err); $timeout(function() { diff --git a/src/js/controllers/sellGlidera.js b/src/js/controllers/sellGlidera.js index a3bc09b62..3f4f9f612 100644 --- a/src/js/controllers/sellGlidera.js +++ b/src/js/controllers/sellGlidera.js @@ -1,7 +1,7 @@ 'use strict'; angular.module('copayApp.controllers').controller('sellGlideraController', - function($scope, $timeout, $log, $modal, configService, profileService, addressService, feeService, glideraService, bwsError, lodash, isChromeApp, animationService, txSignService) { + function($scope, $timeout, $log, $modal, configService, profileService, addressService, feeService, glideraService, bwsError, lodash, isChromeApp, animationService, txService) { var self = this; var config = configService.getSync(); @@ -130,7 +130,7 @@ angular.module('copayApp.controllers').controller('sellGlideraController', self.error = null; - txSignService.prepare(function(err) { + txService.prepare(function(err) { if (err) { self.error = err; return; @@ -174,7 +174,7 @@ angular.module('copayApp.controllers').controller('sellGlideraController', return; } - txSignService.sign(txp, function(err, txp) { + txService.sign(txp, function(err, txp) { if (err) { self.loading = null; self.error = err; diff --git a/src/js/controllers/walletHome.js b/src/js/controllers/walletHome.js index 0a08a00f7..2fddf78c4 100644 --- a/src/js/controllers/walletHome.js +++ b/src/js/controllers/walletHome.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('walletHomeController', function($scope, $rootScope, $timeout, $filter, $modal, $log, notification, txStatus, isCordova, isMobile, profileService, lodash, configService, rateService, storageService, bitcore, isChromeApp, gettext, gettextCatalog, nodeWebkit, addressService, ledger, bwsError, confirmDialog, txFormatService, animationService, addressbookService, go, feeService, txSignService) { +angular.module('copayApp.controllers').controller('walletHomeController', function($scope, $rootScope, $timeout, $filter, $modal, $log, notification, txStatus, isCordova, isMobile, profileService, lodash, configService, rateService, storageService, bitcore, isChromeApp, gettext, gettextCatalog, nodeWebkit, addressService, ledger, bwsError, confirmDialog, txFormatService, animationService, addressbookService, go, feeService, txService) { var self = this; window.ignoreMobilePause = false; @@ -324,7 +324,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi $scope.error = null; $scope.loading = true; - txSignService.prepareAndSignAndBroadcast(txp, { + txService.prepareAndSignAndBroadcast(txp, { reporterFn: self.setOngoingProcess.bind(self) }, function(err, txp) { $scope.loading = false; @@ -818,7 +818,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi }; self.setOngoingProcess(gettextCatalog.getString('Creating transaction')); - txSignService.createTx(opts, function(err, txp) { + txService.createTx(opts, function(err, txp) { self.setOngoingProcess(); if (err) { return self.setSendError(err); @@ -845,12 +845,12 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi this.acceptTx = function(txp) { var self = this; - txSignService.prepare(function(err) { + txService.prepare(function(err) { if (err) { return self.setSendError(err); } self.setOngoingProcess(gettextCatalog.getString('Sending transaction')); - txSignService.publishTx(txp, function(err, txpPublished) { + txService.publishTx(txp, function(err, txpPublished) { if (err) { self.setOngoingProcess(); self.setSendError(err); @@ -864,7 +864,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi this.prepareSignAndBroadcastTx = function(txp) { var fc = profileService.focusedClient; var self = this; - txSignService.prepareAndSignAndBroadcast(txp, { + txService.prepareAndSignAndBroadcast(txp, { reporterFn: self.setOngoingProcess.bind(self) }, function(err, txp) { self.resetForm(); diff --git a/src/js/services/txSignService.js b/src/js/services/txService.js similarity index 97% rename from src/js/services/txSignService.js rename to src/js/services/txService.js index af54aca70..97cb78089 100644 --- a/src/js/services/txSignService.js +++ b/src/js/services/txService.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.services').factory('txSignService', function($rootScope, profileService, gettextCatalog, lodash, trezor, ledger, configService, bwsError, $log, feeService) { +angular.module('copayApp.services').factory('txService', function($rootScope, profileService, gettextCatalog, lodash, trezor, ledger, configService, bwsError, $log, feeService) { var root = {}; var reportSigningStatus = function(opts) {