mirror of https://github.com/BTCPrivate/copay.git
fix conflict
This commit is contained in:
commit
ded325af46
|
@ -215,7 +215,11 @@
|
||||||
<h3>Address</h3>
|
<h3>Address</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}} <span class="right">{{balanceByAddr[addr] || 0}} <i class="fi-bitcoin"></i></span></a>
|
<a class="panel db" ng-repeat="addr in addrs" ng-click="selectAddr(addr)">{{addr}}
|
||||||
|
|
||||||
|
<span ng-if="!isMain[addr]">(change)</span>
|
||||||
|
<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">
|
||||||
<qrcode size="160" data="{{selectedAddr}}"></qrcode>
|
<qrcode size="160" data="{{selectedAddr}}"></qrcode>
|
||||||
|
|
|
@ -11,9 +11,10 @@ angular.module('copay.addresses').controller('AddressesController',
|
||||||
var _updateBalance = function () {
|
var _updateBalance = function () {
|
||||||
controllerUtils.setSocketHandlers();
|
controllerUtils.setSocketHandlers();
|
||||||
|
|
||||||
w.getBalance(function (balance, balanceByAddr) {
|
w.getBalance(function (balance, balanceByAddr, isMain) {
|
||||||
if (balanceByAddr && Object.keys(balanceByAddr).length) {
|
if (balanceByAddr && Object.keys(balanceByAddr).length) {
|
||||||
$rootScope.balanceByAddr = balanceByAddr;
|
$rootScope.balanceByAddr = balanceByAddr;
|
||||||
|
$scope.isMain = isMain;
|
||||||
$scope.addrs = Object.keys(balanceByAddr);
|
$scope.addrs = Object.keys(balanceByAddr);
|
||||||
$scope.selectedAddr = $scope.addrs[0];
|
$scope.selectedAddr = $scope.addrs[0];
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
|
|
|
@ -100,15 +100,9 @@ Insight.prototype._request = function(options, callback) {
|
||||||
if (request.readyState === 4) {
|
if (request.readyState === 4) {
|
||||||
console.log('[Insight.js.102]', request); //TODO
|
console.log('[Insight.js.102]', request); //TODO
|
||||||
if (request.status === 200) {
|
if (request.status === 200) {
|
||||||
try {
|
return callback(null, JSON.parse(request.responseText));
|
||||||
return callback(null, JSON.parse(request.responseText));
|
}
|
||||||
} catch (e) {
|
else {
|
||||||
|
|
||||||
console.log('[Insight.js.106]'); //TODO
|
|
||||||
return callback({message: 'Wrong response from insight'});
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
|
|
||||||
console.log('[Insight.js.111]'); //TODO
|
console.log('[Insight.js.111]'); //TODO
|
||||||
return callback({message: 'Error ' + request.status});
|
return callback({message: 'Error ' + request.status});
|
||||||
}
|
}
|
||||||
|
|
|
@ -212,6 +212,7 @@ PublicKeyRing.prototype.getAddresses = function(onlyMain) {
|
||||||
|
|
||||||
PublicKeyRing.prototype.getRedeemScriptMap = function () {
|
PublicKeyRing.prototype.getRedeemScriptMap = function () {
|
||||||
var ret = {};
|
var ret = {};
|
||||||
|
console.log('[PublicKeyRing.js.216]', this.changeAddressIndex, this.addressIndex); //TODO
|
||||||
|
|
||||||
for (var i=0; i<this.changeAddressIndex; i++) {
|
for (var i=0; i<this.changeAddressIndex; i++) {
|
||||||
ret[this.getAddress(i,true)] = this.getRedeemScript(i,true).getBuffer().toString('hex');
|
ret[this.getAddress(i,true)] = this.getRedeemScript(i,true).getBuffer().toString('hex');
|
||||||
|
|
|
@ -32,8 +32,8 @@ TxProposal.prototype.toObj = function() {
|
||||||
|
|
||||||
|
|
||||||
TxProposal.prototype.setSent = function(sentTxid) {
|
TxProposal.prototype.setSent = function(sentTxid) {
|
||||||
this.sentTxid = txid;
|
this.sentTxid = sentTxid;
|
||||||
this.sentTs = Date.now();;
|
this.sentTs = Date.now();
|
||||||
};
|
};
|
||||||
|
|
||||||
TxProposal.fromObj = function(o) {
|
TxProposal.fromObj = function(o) {
|
||||||
|
|
|
@ -277,8 +277,9 @@ Wallet.prototype.sendPublicKeyRing = function(recipients) {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Wallet.prototype.generateAddress = function() {
|
Wallet.prototype.generateAddress = function(isChange) {
|
||||||
var addr = this.publicKeyRing.generateAddress();
|
var addr = this.publicKeyRing.generateAddress(isChange);
|
||||||
|
console.log('[Wallet.js.281:addr:]',addr, this.publicKeyRing.toObj(), this.getAddresses()); //TODO
|
||||||
this.sendPublicKeyRing();
|
this.sendPublicKeyRing();
|
||||||
this.store(true);
|
this.store(true);
|
||||||
return addr;
|
return addr;
|
||||||
|
@ -327,6 +328,7 @@ Wallet.prototype.sign = function(ntxid) {
|
||||||
|
|
||||||
var pkr = self.publicKeyRing;
|
var pkr = self.publicKeyRing;
|
||||||
var keys = self.privateKey.getAll(pkr.addressIndex, pkr.changeAddressIndex);
|
var keys = self.privateKey.getAll(pkr.addressIndex, pkr.changeAddressIndex);
|
||||||
|
console.log('[Wallet.js.329:keys:]',keys); //TODO
|
||||||
|
|
||||||
var b = txp.builder;
|
var b = txp.builder;
|
||||||
var before = b.signaturesAdded;
|
var before = b.signaturesAdded;
|
||||||
|
@ -354,6 +356,7 @@ Wallet.prototype.sendTx = function(ntxid, cb) {
|
||||||
this.log('[Wallet.js.261:txHex:]',txHex); //TODO
|
this.log('[Wallet.js.261:txHex:]',txHex); //TODO
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
this.blockchain.sendRawTransaction(txHex, function(txid) {
|
this.blockchain.sendRawTransaction(txHex, function(txid) {
|
||||||
self.log('BITCOND txid:',txid); //TODO
|
self.log('BITCOND txid:',txid); //TODO
|
||||||
if (txid) {
|
if (txid) {
|
||||||
|
@ -410,6 +413,7 @@ Wallet.prototype.addressIsOwn = function(addrStr) {
|
||||||
Wallet.prototype.getBalance = function(cb) {
|
Wallet.prototype.getBalance = function(cb) {
|
||||||
var balance = 0;
|
var balance = 0;
|
||||||
var balanceByAddr = {};
|
var balanceByAddr = {};
|
||||||
|
var isMain = {};
|
||||||
var COIN = bitcore.util.COIN;
|
var COIN = bitcore.util.COIN;
|
||||||
var addresses = this.getAddressesStr(true);
|
var addresses = this.getAddressesStr(true);
|
||||||
|
|
||||||
|
@ -418,6 +422,7 @@ Wallet.prototype.getBalance = function(cb) {
|
||||||
// Prefill balanceByAddr with main address
|
// Prefill balanceByAddr with main address
|
||||||
addresses.forEach(function(a){
|
addresses.forEach(function(a){
|
||||||
balanceByAddr[a]=0;
|
balanceByAddr[a]=0;
|
||||||
|
isMain[a]=1;
|
||||||
});
|
});
|
||||||
this.getUnspent(function(utxos) {
|
this.getUnspent(function(utxos) {
|
||||||
for(var i=0;i<utxos.length; i++) {
|
for(var i=0;i<utxos.length; i++) {
|
||||||
|
@ -429,7 +434,7 @@ Wallet.prototype.getBalance = function(cb) {
|
||||||
for(var a in balanceByAddr){
|
for(var a in balanceByAddr){
|
||||||
balanceByAddr[a] = balanceByAddr[a]/COIN;
|
balanceByAddr[a] = balanceByAddr[a]/COIN;
|
||||||
};
|
};
|
||||||
return cb(balance / COIN, balanceByAddr);
|
return cb(balance / COIN, balanceByAddr, isMain);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -440,6 +445,7 @@ Wallet.prototype.getUnspent = function(cb) {
|
||||||
};
|
};
|
||||||
|
|
||||||
Wallet.prototype.createTx = function(toAddress, amountSatStr, opts, cb) {
|
Wallet.prototype.createTx = function(toAddress, amountSatStr, opts, cb) {
|
||||||
|
console.log('[Wallet.js.447:createTx:]'); //TODO
|
||||||
var self = this;
|
var self = this;
|
||||||
if (typeof opts === 'function') {
|
if (typeof opts === 'function') {
|
||||||
cb = opts;
|
cb = opts;
|
||||||
|
@ -472,8 +478,9 @@ Wallet.prototype.createTxSync = function(toAddress, amountSatStr, utxos, opts) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!opts.remainderOut) {
|
if (!opts.remainderOut) {
|
||||||
opts.remainderOut ={ address: pkr.generateAddress(true).toString() };
|
opts.remainderOut ={ address: this.generateAddress(true).toString() };
|
||||||
};
|
}
|
||||||
|
console.log('[Wallet.js.480:opts: CREATETXSYNC]',opts); //TODO
|
||||||
|
|
||||||
var b = new Builder(opts)
|
var b = new Builder(opts)
|
||||||
.setUnspent(utxos)
|
.setUnspent(utxos)
|
||||||
|
@ -483,8 +490,10 @@ Wallet.prototype.createTxSync = function(toAddress, amountSatStr, utxos, opts) {
|
||||||
|
|
||||||
var signRet;
|
var signRet;
|
||||||
if (priv) {
|
if (priv) {
|
||||||
|
console.log('[Wallet.js.486] aLL Priv', priv.getAll(pkr.addressIndex, pkr.changeAddressIndex)); //TODO
|
||||||
b.sign( priv.getAll(pkr.addressIndex, pkr.changeAddressIndex) );
|
b.sign( priv.getAll(pkr.addressIndex, pkr.changeAddressIndex) );
|
||||||
}
|
}
|
||||||
|
console.log('[Wallet.js.494]', b, b.build().serialize().toString('hex')); //TODO
|
||||||
var me = {};
|
var me = {};
|
||||||
var myId = this.getMyPeerId();
|
var myId = this.getMyPeerId();
|
||||||
var now = Date.now();
|
var now = Date.now();
|
||||||
|
|
Loading…
Reference in New Issue