diff --git a/css/main.css b/css/main.css index fb69c1d96..2ac4d575c 100644 --- a/css/main.css +++ b/css/main.css @@ -221,12 +221,19 @@ small.has-error { .totalAmount { - font-weight: bold; line-height: 120%; margin-top:2px; } +/* Turn Off Number Input Spinners */ +input[type=number]::-webkit-inner-spin-button, +input[type=number]::-webkit-outer-spin-button { + -webkit-appearance: none; + margin: 0; +} + + .small { font-size: 60%; line-height: inherit; diff --git a/index.html b/index.html index 5345fdf3e..fbb762c54 100644 --- a/index.html +++ b/index.html @@ -21,7 +21,7 @@
- + {{$root.wallet.getName()}}
@@ -669,7 +669,10 @@ Total amount for this transaction:
- {{amount + defaultFee |number}} bits + {{amount + defaultFee |number}} bits + + {{((amount + defaultFee)/1e6).toFixed(3) |number}} BTC +
Including fee of {{defaultFee|number}} bits @@ -687,7 +690,7 @@
+ name="comment" placeholder="Leave a private message to your copayers" ng-model="commentText" ng-maxlength="100">
diff --git a/js/controllers/send.js b/js/controllers/send.js index 74524a9da..e99c670f0 100644 --- a/js/controllers/send.js +++ b/js/controllers/send.js @@ -50,9 +50,11 @@ angular.module('copayApp.controllers').controller('SendController', var address = form.address.$modelValue; var amount = (form.amount.$modelValue * 100) | 0; + var commentText = form.comment.$modelValue; var w = $rootScope.wallet; - w.createTx(address, amount, comment, function() { + + w.createTx(address, amount, commentText, function() { $scope.loading = false; $rootScope.$flashMessage = { message: 'The transaction proposal has been created', diff --git a/js/models/blockchain/Insight.js b/js/models/blockchain/Insight.js index 92f31bc47..897dd22c8 100644 --- a/js/models/blockchain/Insight.js +++ b/js/models/blockchain/Insight.js @@ -183,34 +183,35 @@ Insight.prototype._request = function(options, callback) { request.timeout = 5000; request.ontimeout = function() { setTimeout(function() { - return self._request(options,callback); + return self._request(options, callback); }, self.retryDelay); return callback(new Error('Insight request timeout')); }; request.onreadystatechange = function() { - if (request.readyState === 4) { - if (request.status === 200 || request.status === 304) { - try { - var ret = JSON.parse(request.responseText); - return callback(null, ret); - } catch (e) { - return callback(new Error('CRITICAL: Wrong response from insight')); - } - } - // User error - else if (request.status >= 400 && request.status < 499) { - return callback(new Error('CRITICAL: Bad request to insight. Probably wrong transaction to broadcast?.')); - } - else { - var err= 'Error code: ' + request.status + ' - Status: ' + request.statusText - + ' - Description: ' + request.responseText; - setTimeout(function() { - return self._request(options,callback); - }, self.retryDelay); - return callback(new Error(err)); + if (request.readyState !== 4) return; + var ret, errTxt, e; + + if (request.status === 200 || request.status === 304) { + try { + ret = JSON.parse(request.responseText); + } catch (e2) { + errTxt = 'CRITICAL: Wrong response from insight' + e2; } + } else if (request.status >= 400 && request.status < 499) { + errTxt = 'CRITICAL: Bad request to insight. Probably wrong transaction to broadcast?.'; + } else { + errTxt = 'Error code: ' + request.status + ' - Status: ' + request.statusText + ' - Description: ' + request.responseText; + setTimeout(function() { + console.log('### Retrying Insight Request....'); + return self._request(options, callback); + }, self.retryDelay); } + if (errTxt) { + console.log("INSIGHT ERROR:", e); + e = new Error(errTxt); + } + return callback(e, ret); }; if (options.method === 'POST') { @@ -218,9 +219,7 @@ Insight.prototype._request = function(options, callback) { } request.send(options.data || null); - } - - else { + } else { var http = require('http'); var req = http.request(options, function(response) { var ret; diff --git a/js/models/core/TxProposals.js b/js/models/core/TxProposals.js index f25b2b9a7..09c5e9304 100644 --- a/js/models/core/TxProposals.js +++ b/js/models/core/TxProposals.js @@ -24,6 +24,8 @@ function TxProposal(opts) { } TxProposal.prototype.toObj = function() { + +console.log('[TxProposals.js.27]',this); //TODO var o = JSON.parse(JSON.stringify(this)); delete o['builder']; o.builderObj = this.builder.toObj(); diff --git a/js/models/core/Wallet.js b/js/models/core/Wallet.js index bd40e46d1..5526e951e 100644 --- a/js/models/core/Wallet.js +++ b/js/models/core/Wallet.js @@ -572,6 +572,10 @@ Wallet.prototype.getBalance = function(cb) { if (!BIT) throw new Error('BIT not defined. A newer version of bitcore is needed'); + console.log('[Wallet.js.574] getBalance'); //TODO + + + this.getUnspent(function(err, safeUnspent, unspent) { if (err) { return cb(err); @@ -604,6 +608,7 @@ Wallet.prototype.getBalance = function(cb) { Wallet.prototype.getUnspent = function(cb) { var self = this; this.blockchain.getUnspent(this.getAddressesStr(), function(err, unspentList) { + console.log('[Wallet.js.606:unspentList:]', unspentList); //TODO if (err) { return cb(err); @@ -637,6 +642,7 @@ Wallet.prototype.createTx = function(toAddress, amountSatStr, comment, opts, cb) } this.getUnspent(function(err, safeUnspent) { + console.log('[Wallet.js.639:safeUnspent:]', safeUnspent); //TODO var ntxid = self.createTxSync(toAddress, amountSatStr, comment, safeUnspent, opts); if (ntxid) { self.sendIndexes(); diff --git a/js/services/controllerUtils.js b/js/services/controllerUtils.js index 0e2ef443f..f1c3f5d1d 100644 --- a/js/services/controllerUtils.js +++ b/js/services/controllerUtils.js @@ -108,6 +108,8 @@ angular.module('copayApp.services') root.updateTxs({onlyPending:true}); // give sometime to the tx to propagate. $timeout(function() { + +console.log('[controllerUtils.js.111] UPDATE BALANCE'); //TODO root.updateBalance(function(){ if (!dontDigest) { $rootScope.$digest(); @@ -142,7 +144,11 @@ angular.module('copayApp.services') $rootScope.balanceByAddr = {}; $rootScope.updatingBalance = true; + +console.log('[controllerUtils.js.147] GET'); //TODO w.getBalance(function(err, balance, balanceByAddr, safeBalance) { + +console.log('[controllerUtils.js.150]', err, balance); //TODO if (err) { console.error('Error: ' + err.message); //TODO root._setCommError();