mirror of https://github.com/BTCPrivate/copay.git
available address
This commit is contained in:
parent
2fc3a8e8fa
commit
2fbd075206
|
@ -214,13 +214,13 @@
|
||||||
<script type="text/ng-template" id="addresses.html">
|
<script type="text/ng-template" id="addresses.html">
|
||||||
<div class="addresses" data-ng-controller="AddressesController">
|
<div class="addresses" data-ng-controller="AddressesController">
|
||||||
<div ng-show='$root.wallet.publicKeyRing.isComplete()'>
|
<div ng-show='$root.wallet.publicKeyRing.isComplete()'>
|
||||||
<h3>Address</h3>
|
<h3>Addresses (available to spend)</h3>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="large-6 columns">
|
<div class="large-6 columns">
|
||||||
<a class="panel db" ng-repeat="addr in addrs" ng-click="selectAddr(addr)">{{addr}}
|
<a class="panel db" ng-repeat="addr in addrs" ng-click="selectAddr(addr)">{{addr}}
|
||||||
|
|
||||||
<span ng-if="!isMain[addr]">(change)</span>
|
<span ng-if="!isMain[addr]">(change)</span>
|
||||||
<span class="right">{{balanceByAddr[addr] || 0}} <i class="fi-bitcoin"></i></span></a>
|
<span class="right">({{balanceByAddr[addr] || 0}} <i class="fi-bitcoin"></i>)</span></a>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="large-3 columns line-dashed-v text-center">
|
<div class="large-3 columns line-dashed-v text-center">
|
||||||
|
|
|
@ -27,11 +27,7 @@ angular.module('copay.header').controller('HeaderController',
|
||||||
$rootScope.$watch('wallet', function(wallet) {
|
$rootScope.$watch('wallet', function(wallet) {
|
||||||
if (wallet) {
|
if (wallet) {
|
||||||
controllerUtils.setSocketHandlers();
|
controllerUtils.setSocketHandlers();
|
||||||
$rootScope.wallet.getBalance(function(balance) {
|
controllerUtils.updateBalance();
|
||||||
$rootScope.$apply(function() {
|
|
||||||
$rootScope.totalBalance = balance;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,6 @@ var bitcore = require('bitcore');
|
||||||
angular.module('copay.transactions').controller('TransactionsController',
|
angular.module('copay.transactions').controller('TransactionsController',
|
||||||
function($scope, $rootScope, $location) {
|
function($scope, $rootScope, $location) {
|
||||||
$scope.title = 'Transactions';
|
$scope.title = 'Transactions';
|
||||||
|
|
||||||
$scope.oneAtATime = true;
|
|
||||||
|
|
||||||
var _updateTxs = function() {
|
var _updateTxs = function() {
|
||||||
console.log('[transactions.js.10:_updateTxs:]'); //TODO
|
console.log('[transactions.js.10:_updateTxs:]'); //TODO
|
||||||
var w =$rootScope.wallet;
|
var w =$rootScope.wallet;
|
||||||
|
@ -32,6 +29,7 @@ console.log('[transactions.js.10:_updateTxs:]'); //TODO
|
||||||
i.missingSignatures = tx.countInputMissingSignatures(0);
|
i.missingSignatures = tx.countInputMissingSignatures(0);
|
||||||
txs.push(i);
|
txs.push(i);
|
||||||
});
|
});
|
||||||
|
console.log('[transactions.js.35:txs:]',txs); //TODO
|
||||||
$scope.txs = txs;
|
$scope.txs = txs;
|
||||||
w.removeListener('txProposalsUpdated',_updateTxs)
|
w.removeListener('txProposalsUpdated',_updateTxs)
|
||||||
w.once('txProposalsUpdated',_updateTxs);
|
w.once('txProposalsUpdated',_updateTxs);
|
||||||
|
@ -69,4 +67,5 @@ console.log('[transactions.js.68:txid:] SENTTX CALLBACK',txid); //TODO
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_updateTxs();
|
||||||
});
|
});
|
||||||
|
|
|
@ -27,33 +27,34 @@ angular.module('copay.controllerUtils').factory('controllerUtils', function ($ro
|
||||||
});
|
});
|
||||||
|
|
||||||
w.on('created', function() {
|
w.on('created', function() {
|
||||||
console.log('[controllerUtils.js.30:created:] RECV '); //TODO
|
|
||||||
$location.path('peer');
|
$location.path('peer');
|
||||||
$rootScope.wallet = w;
|
$rootScope.wallet = w;
|
||||||
|
root.updateBalance();
|
||||||
$rootScope.wallet.getBalance(false,function(balance) {
|
|
||||||
$rootScope.totalBalance = balance;
|
|
||||||
});
|
|
||||||
$rootScope.wallet.getBalance(true,function(balance) {
|
|
||||||
$rootScope.availableBalance = balance;
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
});
|
||||||
w.on('refresh', function() {
|
w.on('refresh', function() {
|
||||||
console.log('[controllerUtils.js] Refreshing'); //TODO
|
console.log('[controllerUtils.js] Refreshing'); //TODO
|
||||||
$rootScope.$digest();
|
root.updateBalance();
|
||||||
});
|
});
|
||||||
w.on('openError', root.onErrorDigest);
|
w.on('openError', root.onErrorDigest);
|
||||||
w.on('close', root.onErrorDigest);
|
w.on('close', root.onErrorDigest);
|
||||||
|
|
||||||
console.log('[controllerUtils.js.45] CALLING NETSTART FROM setupUxHandlers'); //TODO
|
|
||||||
w.netStart();
|
w.netStart();
|
||||||
console.log('[controllerUtils.js.45] setupUxHandlers END'); //TODO
|
};
|
||||||
|
|
||||||
|
root.updateBalance = function() {
|
||||||
|
var w = $rootScope.wallet;
|
||||||
|
w.getBalance(false,function(balance, balanceByAddr) {
|
||||||
|
$rootScope.totalBalance = balance;
|
||||||
|
$rootScope.balanceByAddr = balanceByAddr;
|
||||||
|
console.log('New balance:', balance);
|
||||||
|
w.getBalance(true,function(balance) {
|
||||||
|
$rootScope.availableBalance = balance;
|
||||||
|
$rootScope.$digest();
|
||||||
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
root.setSocketHandlers = function() {
|
root.setSocketHandlers = function() {
|
||||||
Socket.removeAllListeners();
|
Socket.removeAllListeners();
|
||||||
var w = $rootScope.wallet;
|
|
||||||
|
|
||||||
var addrs = $rootScope.wallet.getAddressesStr();
|
var addrs = $rootScope.wallet.getAddressesStr();
|
||||||
for(var i = 0; i < addrs.length; i++) {
|
for(var i = 0; i < addrs.length; i++) {
|
||||||
|
@ -64,14 +65,7 @@ console.log('[controllerUtils.js.45] setupUxHandlers END'); //TODO
|
||||||
addrs.forEach(function(addr) {
|
addrs.forEach(function(addr) {
|
||||||
Socket.on(addr, function(txid) {
|
Socket.on(addr, function(txid) {
|
||||||
console.log('Received!', txid);
|
console.log('Received!', txid);
|
||||||
w.getBalance(false,function(balance, balanceByAddr) {
|
root.updateBalance();
|
||||||
$rootScope.totalBalance = balance;
|
|
||||||
$rootScope.balanceByAddr = balanceByAddr;
|
|
||||||
console.log('New balance:', balance);
|
|
||||||
w.getBalance(true,function(balance) {
|
|
||||||
$rootScope.availableBalance = balance;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue