mirror of https://github.com/BTCPrivate/copay.git
commit
dc49a4dc68
|
@ -237,8 +237,8 @@ missing. Ask your copayers to join your session: <b>{{$root.wallet.network.peerI
|
|||
<div class="transactions" data-ng-controller="TransactionsController">
|
||||
<div class="row" ng-show='$root.wallet.publicKeyRing.isComplete()'>
|
||||
<div class="large-12 columns">
|
||||
<h3>Pending Transactions <small>({{txsoutput.length}})</small></h3>
|
||||
<div class="panel pending" ng-repeat="txp in txsoutput">
|
||||
<h3>Pending Transactions <small>({{txs.length}})</small></h3>
|
||||
<div class="panel pending" ng-repeat="txp in txs">
|
||||
{{txp}}
|
||||
<div class="row">
|
||||
<p class="large-5 columns"> Address 1</p>
|
||||
|
|
|
@ -19,7 +19,7 @@ angular.module('copay.home').controller('HomeController',
|
|||
if (!$rootScope.wallet || !$rootScope.wallet.id) {
|
||||
$location.path('signin');
|
||||
} else {
|
||||
$scope.addrs = $rootScope.wallet.getAddressesStr();
|
||||
$scope.addrs = $rootScope.wallet.getAddressesStr(true);
|
||||
$scope.selectedAddr = $scope.addrs[0];
|
||||
|
||||
_getBalance();
|
||||
|
|
|
@ -15,7 +15,7 @@ angular.module('copay.send').controller('SendController',
|
|||
|
||||
$scope.sendTest = function() {
|
||||
var w = $rootScope.wallet;
|
||||
w.createTx( '15q6HKjWHAksHcH91JW23BJEuzZgFwydBt', '12345',function() {
|
||||
w.createTx( 'mimoZNLcP2rrMRgdeX5PSnR7AjCqQveZZ4', '12345',function() {
|
||||
$rootScope.$digest();
|
||||
});
|
||||
};
|
||||
|
|
|
@ -6,25 +6,35 @@ angular.module('copay.transactions').controller('TransactionsController',
|
|||
|
||||
$scope.oneAtATime = true;
|
||||
|
||||
var _updateTxs = function() {
|
||||
var inT = $rootScope.wallet.getTxProposals();
|
||||
var ts = [];
|
||||
inT.forEach(function(i){
|
||||
var b =i.txp.builder;
|
||||
var tx = b.build();
|
||||
var one = {
|
||||
valueOutSat: b.valueOutSat,
|
||||
feeSat: b.feeSat,
|
||||
};
|
||||
var outs = [];
|
||||
var bitcore = require('bitcore');
|
||||
tx.outs.forEach(function(o) {
|
||||
var s = o.getScript();
|
||||
var aStr = bitcore.Address.fromScript(s, config.networkName).toString();
|
||||
outs.push({address: aStr, value: bitcore.util.valueToBigInt(o.getValue())});
|
||||
});
|
||||
one.outs = outs;
|
||||
ts.push(one);
|
||||
});
|
||||
$scope.txs = ts;
|
||||
};
|
||||
|
||||
|
||||
if (!$rootScope.wallet || !$rootScope.wallet.id) {
|
||||
$location.path('signin');
|
||||
}
|
||||
else {
|
||||
$scope.txsinput = [
|
||||
{
|
||||
fromAddr: "n3zUqNR7Bbbc4zJhPVj1vG2Lx66K3Xhzvb",
|
||||
toAddr: "msvv2mDfE298s7boXwALq4Dqv77K3TWRZ1",
|
||||
amount: 23.9982
|
||||
},
|
||||
{
|
||||
fromAddr: "my9wnLwwUrwpNfEgSrWY62ymEGf1edKf4J",
|
||||
toAddr: "monCusNiDuptf68rtr58hEjKpJt6cW6zwS",
|
||||
amount: 2.22
|
||||
}
|
||||
];
|
||||
|
||||
$scope.txsoutput = $rootScope.wallet.getTxProposals();
|
||||
|
||||
_updateTxs();
|
||||
var socket = Socket($scope);
|
||||
socket.on('connect', controllerUtils.handleTransactionByAddress($scope));
|
||||
}
|
||||
|
@ -33,6 +43,7 @@ angular.module('copay.transactions').controller('TransactionsController',
|
|||
var w = $rootScope.wallet;
|
||||
var ret = w.sign(ntxid);
|
||||
console.log('[transactions.js.28:ret:]',ret); //TODO
|
||||
$scope.txsoutput = $rootScope.wallet.getTxProposals();
|
||||
$rootScope.flashMessage = {type:'success', message: 'Transactions SEND! : ' + ret};
|
||||
_updateTxs();
|
||||
};
|
||||
});
|
||||
|
|
|
@ -109,8 +109,6 @@ Insight.prototype._request = function(options, callback) {
|
|||
|
||||
if (options.method === 'POST') {
|
||||
request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
||||
request.setRequestHeader('Content-length', options.data.length);
|
||||
request.setRequestHeader('Connection', 'close');
|
||||
request.send(options.data);
|
||||
} else {
|
||||
request.send(null);
|
||||
|
|
|
@ -192,16 +192,18 @@ PublicKeyRing.prototype.generateAddress = function(isChange) {
|
|||
|
||||
};
|
||||
|
||||
PublicKeyRing.prototype.getAddresses = function() {
|
||||
PublicKeyRing.prototype.getAddresses = function(onlyMain) {
|
||||
var ret = [];
|
||||
|
||||
for (var i=0; i<this.changeAddressIndex; i++) {
|
||||
ret.push(this.getAddress(i,true));
|
||||
}
|
||||
|
||||
for (var i=0; i<this.addressIndex; i++) {
|
||||
ret.push(this.getAddress(i,false));
|
||||
}
|
||||
|
||||
if (!onlyMain) {
|
||||
for (var i=0; i<this.changeAddressIndex; i++) {
|
||||
ret.push(this.getAddress(i,true));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
|
|
|
@ -194,7 +194,6 @@ Wallet.prototype.sendPublicKeyRing = function(recipients) {
|
|||
|
||||
Wallet.prototype.generateAddress = function() {
|
||||
var addr = this.publicKeyRing.generateAddress();
|
||||
this.store();
|
||||
this.sendPublicKeyRing();
|
||||
return addr;
|
||||
};
|
||||
|
@ -272,13 +271,13 @@ Wallet.prototype.addSeenToTxProposals = function() {
|
|||
};
|
||||
|
||||
|
||||
Wallet.prototype.getAddresses = function() {
|
||||
return this.publicKeyRing.getAddresses();
|
||||
Wallet.prototype.getAddresses = function(onlyMain) {
|
||||
return this.publicKeyRing.getAddresses(onlyMain);
|
||||
};
|
||||
|
||||
Wallet.prototype.getAddressesStr = function() {
|
||||
Wallet.prototype.getAddressesStr = function(onlyMain) {
|
||||
var ret = [];
|
||||
this.publicKeyRing.getAddresses().forEach(function(a) {
|
||||
this.publicKeyRing.getAddresses(onlyMain).forEach(function(a) {
|
||||
ret.push(a.toString());
|
||||
});
|
||||
return ret;
|
||||
|
@ -334,8 +333,8 @@ Wallet.prototype.createTx = function(toAddress, amountSatStr, opts, cb) {
|
|||
self.listUnspent(self.getAddressesStr(), function(utxos) {
|
||||
// TODO check enough funds, etc.
|
||||
self.createTxSync(toAddress, amountSatStr, utxos, opts);
|
||||
self.store();
|
||||
self.sendTxProposals();
|
||||
self.store();
|
||||
return cb();
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue