mirror of https://github.com/BTCPrivate/copay.git
fix conflicts
This commit is contained in:
commit
8325c2b02a
|
@ -88,6 +88,11 @@ html, body {height: 100%;}
|
||||||
width: 25%;
|
width: 25%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.top-bar-section .label.alert {
|
||||||
|
vertical-align: super;
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
.header {
|
.header {
|
||||||
margin-bottom: 30px;
|
margin-bottom: 30px;
|
||||||
}
|
}
|
||||||
|
|
28
index.html
28
index.html
|
@ -42,6 +42,7 @@
|
||||||
<span ng-if="!$root.loading">{{availableBalance || 0}}</span>
|
<span ng-if="!$root.loading">{{availableBalance || 0}}</span>
|
||||||
<i class="fi-bitcoin"></i>
|
<i class="fi-bitcoin"></i>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -56,7 +57,9 @@
|
||||||
<section class="top-bar-section {{isCollapsed && 'hide_menu' || 'show_menu'}}">
|
<section class="top-bar-section {{isCollapsed && 'hide_menu' || 'show_menu'}}">
|
||||||
<ul>
|
<ul>
|
||||||
<li data-ng-repeat="item in menu" ui-route="/{{item.link}}" class="text-center" data-ng-class="{active: isActive(item)}">
|
<li data-ng-repeat="item in menu" ui-route="/{{item.link}}" class="text-center" data-ng-class="{active: isActive(item)}">
|
||||||
<a href="{{item.link}}"> <i class="{{item.icon}}"></i> {{item.title}}</a>
|
<a href="{{item.link}}"> <i class="{{item.icon}}"></i> {{item.title}}
|
||||||
|
<span class="label alert round" ng-if="item.link=='#/transactions' && $root.pendingTxCount > 0">{{$root.pendingTxCount}}</span>
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
|
@ -387,10 +390,10 @@
|
||||||
<div class="row m15">
|
<div class="row m15">
|
||||||
<div class="large-4 columns" ng-show="!tx.sentTs" style="padding-left: 5px;">
|
<div class="large-4 columns" ng-show="!tx.sentTs" style="padding-left: 5px;">
|
||||||
<div ng-show="!tx.signedByUs && !tx.rejectedByUs && !tx.finallyRejected && tx.missingSignatures">
|
<div ng-show="!tx.signedByUs && !tx.rejectedByUs && !tx.finallyRejected && tx.missingSignatures">
|
||||||
<button class="secondary radius m10r" ng-click="sign(tx.ntxid)" ng-disabled="loading" loading="Signing">
|
<button class="secondary radius m10r" ng-click="sign(tx.ntxid)" ng-disabled="loading">
|
||||||
<i class="fi-check"></i> Sign
|
<i class="fi-check"></i> Sign
|
||||||
</button>
|
</button>
|
||||||
<button class="warning radius" ng-click="reject(tx.ntxid)" ng-disabled="loading" loading>
|
<button class="warning radius" ng-click="reject(tx.ntxid)" ng-disabled="loading">
|
||||||
<i class="fi-x" ></i> Reject
|
<i class="fi-x" ></i> Reject
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -602,7 +605,6 @@
|
||||||
<input type="number" ng-model="blockchainPort">
|
<input type="number" ng-model="blockchainPort">
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Socket</legend>
|
<legend>Socket</legend>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
@ -626,8 +628,22 @@
|
||||||
</div>
|
</div>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- / <div class="large-4 columns box-backup">Backup to Dropbox</div>
|
<!-- UNSUPPORTED -->
|
||||||
// <div class="large-4 columns box-backup">Backup to email</div> -->
|
<script type="text/ng-template" id="unsupported.html">
|
||||||
|
<h2 class="text-center">Browser unsupported</h2>
|
||||||
|
<h3 class="text-center">
|
||||||
|
Copay uses webRTC for peer-to-peer communications,
|
||||||
|
but your browser does not support it.
|
||||||
|
Please use
|
||||||
|
a current version of Google Chrome, Mozilla Firefox, or Opera.
|
||||||
|
<br><br>
|
||||||
|
|
||||||
|
For more information
|
||||||
|
on supported browsers please check <a href="http://www.webrtc.org/">http://www.webrtc.org/</a>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
<!-- NOT FOUND -->
|
<!-- NOT FOUND -->
|
||||||
<script type="text/ng-template" id="404.html">
|
<script type="text/ng-template" id="404.html">
|
||||||
<h2 class="text-center">404</h2>
|
<h2 class="text-center">404</h2>
|
||||||
|
|
|
@ -23,6 +23,7 @@ angular.module('copay.header').controller('HeaderController',
|
||||||
|
|
||||||
$rootScope.$watch('wallet', function(wallet) {
|
$rootScope.$watch('wallet', function(wallet) {
|
||||||
if (wallet) {
|
if (wallet) {
|
||||||
|
controllerUtils.updateTxs();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,46 +1,11 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copay.transactions').controller('TransactionsController',
|
angular.module('copay.transactions').controller('TransactionsController',
|
||||||
function($scope, $rootScope, $location) {
|
function($scope, $rootScope, controllerUtils) {
|
||||||
var bitcore = require('bitcore');
|
|
||||||
|
|
||||||
$scope.title = 'Transactions';
|
$scope.title = 'Transactions';
|
||||||
$scope.loading = false;
|
$scope.loading = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var _updateTxs = function() {
|
|
||||||
var w =$rootScope.wallet;
|
|
||||||
if (!w) return;
|
|
||||||
|
|
||||||
var inT = w.getTxProposals();
|
|
||||||
var txs = [];
|
|
||||||
|
|
||||||
inT.forEach(function(i){
|
|
||||||
var tx = i.builder.build();
|
|
||||||
var outs = [];
|
|
||||||
|
|
||||||
tx.outs.forEach(function(o) {
|
|
||||||
var addr = bitcore.Address.fromScriptPubKey(o.getScript(), config.networkName)[0].toString();
|
|
||||||
if (!w.addressIsOwn(addr, {excludeMain:true})) {
|
|
||||||
outs.push({
|
|
||||||
address: addr,
|
|
||||||
value: bitcore.util.valueToBigInt(o.getValue())/bitcore.util.COIN,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// extra fields
|
|
||||||
i.outs = outs;
|
|
||||||
i.fee = i.builder.feeSat/bitcore.util.COIN;
|
|
||||||
i.missingSignatures = tx.countInputMissingSignatures(0);
|
|
||||||
txs.push(i);
|
|
||||||
});
|
|
||||||
$scope.txs = txs;
|
|
||||||
w.removeListener('txProposalsUpdated',_updateTxs)
|
|
||||||
w.once('txProposalsUpdated',_updateTxs);
|
|
||||||
$scope.loading = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.send = function (ntxid) {
|
$scope.send = function (ntxid) {
|
||||||
$scope.loading = true;
|
$scope.loading = true;
|
||||||
var w = $rootScope.wallet;
|
var w = $rootScope.wallet;
|
||||||
|
@ -50,7 +15,8 @@ angular.module('copay.transactions').controller('TransactionsController',
|
||||||
? {type:'success', message: 'Transaction broadcasted. txid: ' + txid}
|
? {type:'success', message: 'Transaction broadcasted. txid: ' + txid}
|
||||||
: {type:'error', message: 'There was an error sending the Transaction'}
|
: {type:'error', message: 'There was an error sending the Transaction'}
|
||||||
;
|
;
|
||||||
_updateTxs();
|
controllerUtils.updateTxs();
|
||||||
|
$scope.loading = false;
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -62,17 +28,19 @@ angular.module('copay.transactions').controller('TransactionsController',
|
||||||
|
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
$rootScope.flashMessage = {type:'error', message: 'There was an error signing the Transaction'};
|
$rootScope.flashMessage = {type:'error', message: 'There was an error signing the Transaction'};
|
||||||
_updateTxs();
|
controllerUtils.updateTxs();
|
||||||
|
$scope.loading = false;
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var p = w.txProposals.getTxProposal(ntxid);
|
var p = w.txProposals.getTxProposal(ntxid);
|
||||||
if (p.builder.isFullySigned()) {
|
if (p.builder.isFullySigned()) {
|
||||||
$scope.send(ntxid);
|
$scope.send(ntxid);
|
||||||
_updateTxs();
|
controllerUtils.updateTxs();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
_updateTxs();
|
controllerUtils.updateTxs();
|
||||||
|
$scope.loading = false;
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -100,18 +68,7 @@ angular.module('copay.transactions').controller('TransactionsController',
|
||||||
var w = $rootScope.wallet;
|
var w = $rootScope.wallet;
|
||||||
w.reject(ntxid);
|
w.reject(ntxid);
|
||||||
$rootScope.flashMessage = {type:'warning', message: 'Transaction rejected by you'};
|
$rootScope.flashMessage = {type:'warning', message: 'Transaction rejected by you'};
|
||||||
_updateTxs();
|
$scope.loading = false;
|
||||||
// $rootScope.$digest();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
_updateTxs();
|
|
||||||
|
|
||||||
var w = $rootScope.wallet;
|
|
||||||
if (w) {
|
|
||||||
w.on('txProposalsUpdated', function() {
|
|
||||||
console.log('[transactions.js.108: txProposalsUpdated:]'); //TODO
|
|
||||||
_updateTxs();
|
|
||||||
$rootScope.$digest();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -346,7 +346,7 @@ Wallet.prototype.reject = function(ntxid) {
|
||||||
txp.rejectedBy[myId] = Date.now();
|
txp.rejectedBy[myId] = Date.now();
|
||||||
this.sendTxProposals();
|
this.sendTxProposals();
|
||||||
this.store();
|
this.store();
|
||||||
this.emit('refresh');
|
this.emit('txProposalsUpdated');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -367,7 +367,7 @@ Wallet.prototype.sign = function(ntxid) {
|
||||||
txp.signedBy[myId] = Date.now();
|
txp.signedBy[myId] = Date.now();
|
||||||
this.sendTxProposals();
|
this.sendTxProposals();
|
||||||
this.store();
|
this.store();
|
||||||
this.emit('refresh');
|
this.emit('txProposalsUpdated');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -505,6 +505,7 @@ Wallet.prototype.createTx = function(toAddress, amountSatStr, opts, cb) {
|
||||||
self.sendPublicKeyRing(); // Change Address
|
self.sendPublicKeyRing(); // Change Address
|
||||||
self.sendTxProposals();
|
self.sendTxProposals();
|
||||||
self.store();
|
self.store();
|
||||||
|
self.emit('txProposalsUpdated');
|
||||||
}
|
}
|
||||||
return cb();
|
return cb();
|
||||||
});
|
});
|
||||||
|
|
|
@ -46,6 +46,9 @@ angular
|
||||||
templateUrl: 'settings.html',
|
templateUrl: 'settings.html',
|
||||||
validate: false
|
validate: false
|
||||||
})
|
})
|
||||||
|
.when('/unsupported', {
|
||||||
|
templateUrl: 'unsupported.html'
|
||||||
|
})
|
||||||
.otherwise({
|
.otherwise({
|
||||||
templateUrl: '404.html'
|
templateUrl: '404.html'
|
||||||
});
|
});
|
||||||
|
@ -61,8 +64,14 @@ angular
|
||||||
})
|
})
|
||||||
.run(function($rootScope, $location) {
|
.run(function($rootScope, $location) {
|
||||||
$rootScope.$on('$routeChangeStart', function(event, next, current) {
|
$rootScope.$on('$routeChangeStart', function(event, next, current) {
|
||||||
|
|
||||||
|
if (!util.supports.data) {
|
||||||
|
$location.path('unsupported');
|
||||||
|
}
|
||||||
|
else {
|
||||||
if ((!$rootScope.wallet || !$rootScope.wallet.id) && next.validate) {
|
if ((!$rootScope.wallet || !$rootScope.wallet.id) && next.validate) {
|
||||||
$location.path('signin');
|
$location.path('signin');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -82,6 +82,10 @@ angular.module('copay.controllerUtils')
|
||||||
root.updateBalance();
|
root.updateBalance();
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
});
|
});
|
||||||
|
w.on('txProposalsUpdated', function() {
|
||||||
|
root.updateTxs();
|
||||||
|
root.updateBalance();
|
||||||
|
});
|
||||||
w.on('openError', root.onErrorDigest);
|
w.on('openError', root.onErrorDigest);
|
||||||
w.on('connect', function(peerID) {
|
w.on('connect', function(peerID) {
|
||||||
if (peerID) {
|
if (peerID) {
|
||||||
|
@ -104,7 +108,6 @@ angular.module('copay.controllerUtils')
|
||||||
if ($rootScope.addrInfos.length === 0) return;
|
if ($rootScope.addrInfos.length === 0) return;
|
||||||
$rootScope.loading = true;
|
$rootScope.loading = true;
|
||||||
w.getBalance(false, function(balance, balanceByAddr) {
|
w.getBalance(false, function(balance, balanceByAddr) {
|
||||||
console.log('New total balance:', balance);
|
|
||||||
$rootScope.totalBalance = balance;
|
$rootScope.totalBalance = balance;
|
||||||
$rootScope.balanceByAddr = balanceByAddr;
|
$rootScope.balanceByAddr = balanceByAddr;
|
||||||
$rootScope.selectedAddr = $rootScope.addrInfos[0].address.toString();
|
$rootScope.selectedAddr = $rootScope.addrInfos[0].address.toString();
|
||||||
|
@ -113,13 +116,53 @@ angular.module('copay.controllerUtils')
|
||||||
if (cb) cb();
|
if (cb) cb();
|
||||||
});
|
});
|
||||||
w.getBalance(true, function(balance) {
|
w.getBalance(true, function(balance) {
|
||||||
console.log('New available balance:', balance);
|
|
||||||
$rootScope.availableBalance = balance;
|
$rootScope.availableBalance = balance;
|
||||||
$rootScope.loading = false;
|
$rootScope.loading = false;
|
||||||
|
$rootScope.$digest();
|
||||||
if (cb) cb();
|
if (cb) cb();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
root.updateTxs = function() {
|
||||||
|
var bitcore = require('bitcore');
|
||||||
|
var w = $rootScope.wallet;
|
||||||
|
if (!w) return;
|
||||||
|
|
||||||
|
var inT = w.getTxProposals();
|
||||||
|
var txs = [];
|
||||||
|
|
||||||
|
inT.forEach(function(i){
|
||||||
|
var tx = i.builder.build();
|
||||||
|
var outs = [];
|
||||||
|
|
||||||
|
tx.outs.forEach(function(o) {
|
||||||
|
var addr = bitcore.Address.fromScriptPubKey(o.getScript(), config.networkName)[0].toString();
|
||||||
|
if (!w.addressIsOwn(addr, {excludeMain:true})) {
|
||||||
|
outs.push({
|
||||||
|
address: addr,
|
||||||
|
value: bitcore.util.valueToBigInt(o.getValue())/bitcore.util.COIN,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// extra fields
|
||||||
|
i.outs = outs;
|
||||||
|
i.fee = i.builder.feeSat/bitcore.util.COIN;
|
||||||
|
i.missingSignatures = tx.countInputMissingSignatures(0);
|
||||||
|
txs.push(i);
|
||||||
|
});
|
||||||
|
$rootScope.txs = txs;
|
||||||
|
var pending = 0;
|
||||||
|
for(var i=0; i<txs.length;i++) {
|
||||||
|
if (!txs[i].finallyRejected && !txs[i].sentTs) {
|
||||||
|
pending++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$rootScope.pendingTxCount = pending;
|
||||||
|
w.removeListener('txProposalsUpdated',root.updateTxs)
|
||||||
|
w.once('txProposalsUpdated',root.updateTxs);
|
||||||
|
$rootScope.loading = false;
|
||||||
|
};
|
||||||
|
|
||||||
root.setSocketHandlers = function() {
|
root.setSocketHandlers = function() {
|
||||||
// TODO: optimize this?
|
// TODO: optimize this?
|
||||||
Socket.removeAllListeners();
|
Socket.removeAllListeners();
|
||||||
|
|
|
@ -42,6 +42,7 @@ var createBundle = function(opts) {
|
||||||
b.require('./copay', {
|
b.require('./copay', {
|
||||||
expose: 'copay'
|
expose: 'copay'
|
||||||
});
|
});
|
||||||
|
b.external('bitcore');
|
||||||
b.require('./js/models/core/WalletFactory');
|
b.require('./js/models/core/WalletFactory');
|
||||||
b.require('./js/models/core/Wallet');
|
b.require('./js/models/core/Wallet');
|
||||||
b.require('./js/models/core/Wallet', {
|
b.require('./js/models/core/Wallet', {
|
||||||
|
|
Loading…
Reference in New Issue