fix conflics

This commit is contained in:
Matias Alejo Garcia 2014-06-13 19:45:00 -03:00
commit 194e5fed54
7 changed files with 55 additions and 30 deletions

View file

@ -221,12 +221,19 @@ small.has-error {
.totalAmount { .totalAmount {
font-weight: bold;
line-height: 120%; line-height: 120%;
margin-top:2px; 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 { .small {
font-size: 60%; font-size: 60%;
line-height: inherit; line-height: inherit;

View file

@ -21,7 +21,7 @@
</div> </div>
<div class="large-9 medium-9 small-9 columns text-center p10t" ng-show="$root.wallet"> <div class="large-9 medium-9 small-9 columns text-center p10t" ng-show="$root.wallet">
<div class="large-4 medium-4 columns line-dashed-v"> <div class="large-4 medium-4 columns line-dashed-v">
<a href="#/addresses" class="has-tip" tooltip-placement="bottom" tooltip="{{$root.wallet.id}}"> <a href="#/addresses" class="has-tip" tooltip-placement="bottom" tooltip="ID: {{$root.wallet.id}}">
<strong><span>{{$root.wallet.getName()}}</span></strong> <strong><span>{{$root.wallet.getName()}}</span></strong>
</a> </a>
<a class="button radius small-icon" title="Manual Refresh" <a class="button radius small-icon" title="Manual Refresh"
@ -655,7 +655,7 @@
<div class="small-9 columns"> <div class="small-9 columns">
<input type="number" id="amount" ng-disabled="loading" <input type="number" id="amount" ng-disabled="loading"
name="amount" placeholder="Amount" ng-model="amount" name="amount" placeholder="Amount" ng-model="amount"
min="0.0001" max="10000000" enough-amount required min="1" max="10000000000" enough-amount required
autocomplete="off" autocomplete="off"
> >
</div> </div>
@ -669,7 +669,10 @@
Total amount for this transaction: Total amount for this transaction:
</small> </small>
<div class="totalAmount"> <div class="totalAmount">
{{amount + defaultFee |number}}</b> bits <b>{{amount + defaultFee |number}}</b> bits
<small>
{{((amount + defaultFee)/1e6).toFixed(3) |number}} BTC
</small>
</div> </div>
<small> <small>
Including fee of {{defaultFee|number}} bits Including fee of {{defaultFee|number}} bits
@ -687,7 +690,7 @@
</label> </label>
<div class="small-12 columns"> <div class="small-12 columns">
<textarea id="comment" ng-disabled="loading" <textarea id="comment" ng-disabled="loading"
name="comment" placeholder="Leave a private message to your copayers" ng-model="comment" ng-maxlength="100"></textarea> name="comment" placeholder="Leave a private message to your copayers" ng-model="commentText" ng-maxlength="100"></textarea>
</div> </div>
</div> </div>
</div> </div>

View file

@ -50,9 +50,11 @@ angular.module('copayApp.controllers').controller('SendController',
var address = form.address.$modelValue; var address = form.address.$modelValue;
var amount = (form.amount.$modelValue * 100) | 0; var amount = (form.amount.$modelValue * 100) | 0;
var commentText = form.comment.$modelValue;
var w = $rootScope.wallet; var w = $rootScope.wallet;
w.createTx(address, amount, comment, function() {
w.createTx(address, amount, commentText, function() {
$scope.loading = false; $scope.loading = false;
$rootScope.$flashMessage = { $rootScope.$flashMessage = {
message: 'The transaction proposal has been created', message: 'The transaction proposal has been created',

View file

@ -183,34 +183,35 @@ Insight.prototype._request = function(options, callback) {
request.timeout = 5000; request.timeout = 5000;
request.ontimeout = function() { request.ontimeout = function() {
setTimeout(function() { setTimeout(function() {
return self._request(options,callback); return self._request(options, callback);
}, self.retryDelay); }, self.retryDelay);
return callback(new Error('Insight request timeout')); return callback(new Error('Insight request timeout'));
}; };
request.onreadystatechange = function() { request.onreadystatechange = function() {
if (request.readyState === 4) { if (request.readyState !== 4) return;
if (request.status === 200 || request.status === 304) { var ret, errTxt, e;
try {
var ret = JSON.parse(request.responseText); if (request.status === 200 || request.status === 304) {
return callback(null, ret); try {
} catch (e) { ret = JSON.parse(request.responseText);
return callback(new Error('CRITICAL: Wrong response from insight')); } catch (e2) {
} errTxt = 'CRITICAL: Wrong response from insight' + e2;
}
// 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));
} }
} 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') { if (options.method === 'POST') {
@ -218,9 +219,7 @@ Insight.prototype._request = function(options, callback) {
} }
request.send(options.data || null); request.send(options.data || null);
} } else {
else {
var http = require('http'); var http = require('http');
var req = http.request(options, function(response) { var req = http.request(options, function(response) {
var ret; var ret;

View file

@ -24,6 +24,8 @@ function TxProposal(opts) {
} }
TxProposal.prototype.toObj = function() { TxProposal.prototype.toObj = function() {
console.log('[TxProposals.js.27]',this); //TODO
var o = JSON.parse(JSON.stringify(this)); var o = JSON.parse(JSON.stringify(this));
delete o['builder']; delete o['builder'];
o.builderObj = this.builder.toObj(); o.builderObj = this.builder.toObj();

View file

@ -572,6 +572,10 @@ Wallet.prototype.getBalance = function(cb) {
if (!BIT) if (!BIT)
throw new Error('BIT not defined. A newer version of bitcore is needed'); 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) { this.getUnspent(function(err, safeUnspent, unspent) {
if (err) { if (err) {
return cb(err); return cb(err);
@ -604,6 +608,7 @@ Wallet.prototype.getBalance = function(cb) {
Wallet.prototype.getUnspent = function(cb) { Wallet.prototype.getUnspent = function(cb) {
var self = this; var self = this;
this.blockchain.getUnspent(this.getAddressesStr(), function(err, unspentList) { this.blockchain.getUnspent(this.getAddressesStr(), function(err, unspentList) {
console.log('[Wallet.js.606:unspentList:]', unspentList); //TODO
if (err) { if (err) {
return cb(err); return cb(err);
@ -637,6 +642,7 @@ Wallet.prototype.createTx = function(toAddress, amountSatStr, comment, opts, cb)
} }
this.getUnspent(function(err, safeUnspent) { this.getUnspent(function(err, safeUnspent) {
console.log('[Wallet.js.639:safeUnspent:]', safeUnspent); //TODO
var ntxid = self.createTxSync(toAddress, amountSatStr, comment, safeUnspent, opts); var ntxid = self.createTxSync(toAddress, amountSatStr, comment, safeUnspent, opts);
if (ntxid) { if (ntxid) {
self.sendIndexes(); self.sendIndexes();

View file

@ -108,6 +108,8 @@ angular.module('copayApp.services')
root.updateTxs({onlyPending:true}); root.updateTxs({onlyPending:true});
// give sometime to the tx to propagate. // give sometime to the tx to propagate.
$timeout(function() { $timeout(function() {
console.log('[controllerUtils.js.111] UPDATE BALANCE'); //TODO
root.updateBalance(function(){ root.updateBalance(function(){
if (!dontDigest) { if (!dontDigest) {
$rootScope.$digest(); $rootScope.$digest();
@ -142,7 +144,11 @@ angular.module('copayApp.services')
$rootScope.balanceByAddr = {}; $rootScope.balanceByAddr = {};
$rootScope.updatingBalance = true; $rootScope.updatingBalance = true;
console.log('[controllerUtils.js.147] GET'); //TODO
w.getBalance(function(err, balance, balanceByAddr, safeBalance) { w.getBalance(function(err, balance, balanceByAddr, safeBalance) {
console.log('[controllerUtils.js.150]', err, balance); //TODO
if (err) { if (err) {
console.error('Error: ' + err.message); //TODO console.error('Error: ' + err.message); //TODO
root._setCommError(); root._setCommError();