fix conflict

This commit is contained in:
Mario Colque 2014-04-21 09:26:33 -03:00
commit 319417552a
7 changed files with 57 additions and 66 deletions

View File

@ -243,3 +243,5 @@ button.secondary:hover { background-color: #FFDF00 !important;}
.m30v {margin: 30px 0;}
.m30a {margin: 30px auto;}
.br100 {border-radius: 100%;}

View File

@ -18,8 +18,8 @@
</figure>
<div class="text-right" ng-show="$root.wallet">
<h5 ng-show="$root.wallet.id">Wallet ID: {{$root.wallet.id}}</h5>
<p ng-show="totalBalance">{{totalBalance}} BTC</p>
<p ng-show="!totalBalance">0 BTC</p>
<p ng-show="totalBalance">{{totalBalance}} <i class="fi-bitcoin"></i></p>
<p ng-show="!totalBalance">0 <i class="fi-bitcoin"></i></p>
</div>
</div>
@ -215,11 +215,11 @@
<h3>Address</h3>
<div class="row">
<div class="large-6 columns">
<a class="panel db" ng-repeat="addr in addrs" ng-click="selectAddr(addr)">{{addr}} <span class="right">{{$root.balanceByAddr[addr] || 0}} BTC &gt;</span></a>
<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>
</div>
<div class="large-3 columns line-dashed-v text-center">
<qrcode size="160" data="{{selectedAddr}}"></qrcode>
<p class="m10t" ng-repeat="addr in addrs" ng-if="selectedAddr==addr"> <strong> {{balanceByAddr[addr]}} BTC </strong> </p>
<p class="m10t" ng-repeat="addr in addrs" ng-if="selectedAddr==addr"> <strong> {{balanceByAddr[addr]}} <i class="fi-bitcoin"></i> </strong> </p>
</div>
<div class="large-3 columns text-center">
<p> Create a New <strong> Address </strong> </p>
@ -241,7 +241,7 @@
<div class="txheader">
<div class="row">
<div class="large-8 columns">
ntxid: {{tx.ntxid}}
Proposal ID: {{tx.ntxid}}
</div>
<div class="large-4 columns text-right">
created at {{tx.createdTs | date:'medium'}}
@ -251,20 +251,23 @@
<div class="row">
<div class="large-12 columns">
<table>
<thead>
<tr>
<th>Creator</th>
<th class="text-center"><i class="fi-arrow-right"></i></th>
<th>To address</th>
</tr>
</thead>
<table style="width:100%">
<tbody>
<tr ng-repeat="o in tx.outs">
<td>{{tx.creator}}</td>
<td class="text-center">{{o.value}} BTC</td>
<td>{{o.address}}</td>
<td class="text-right size-24">{{o.value}} <i class="fi-bitcoin"></i></td>
<td class="text-center size-48"> <i class="fi-arrow-right size-40">
<td class="text-left size-24">{{o.address}}</td>
</tr>
<tr ng-repeat="(peer, actions) in tx.peerActions">
<td colspan="3" >
<span ng-if="peer == $root.wallet.network.peerId"> You</span>
<span ng-if="peer != $root.wallet.network.peerId"> {{peer}}</span>
:
<span ng-repeat="(action, ts) in actions">
<a title="{{ts | date:'medium'}}"> {{action}}</a>
</span>
</tr>
</tbody>
</table>
</div>
@ -272,11 +275,11 @@
<div class="txbottom">
<div class="row">
<div class="large-6 columns">
<div class="large-6 columns" ng-show="!tx.sentTs">
<div ng-show="tx.signedByUs">
<i class="fi-check size-40"></i> Signed by you already
</div>
<div ng-show="!tx.signedByUs">
<div ng-show="!tx.signedByUs && tx.missingSignatures">
<button class="secondary round" ng-click="sign(tx.ntxid)">
<i class="fi-check"></i> Sign
</button>
@ -294,7 +297,9 @@
</span>
<span ng-show="!tx.missingSignatures && tx.sentTs">
<i class="fi-arrow-right size-40"></i>
Sent at {{tx.sentTs | date:'medium'}}
TXID: {{tx.sentTxid}}
</span>
<span ng-show="tx.missingSignatures==1">
One signature missing

View File

@ -14,11 +14,7 @@ console.log('[transactions.js.10:_updateTxs:]'); //TODO
var txs = [];
inT.forEach(function(i){
var b = i.txp.builder;
var tx = b.build();
var one = {
feeSat: b.feeSat,
};
var tx = i.builder.build();
var outs = [];
tx.outs.forEach(function(o) {
@ -30,19 +26,13 @@ console.log('[transactions.js.10:_updateTxs:]'); //TODO
});
}
});
one.outs = outs;
// TOD: check missingSignatures === in al inputs?
one.missingSignatures = tx.countInputMissingSignatures(0);
one.signedByUs = i.signedByUs;
one.ntxid = i.ntxid;
one.creator = i.txp.creator;
one.createdTs = i.txp.createdTs;
one.sentTs = i.txp.sentTs;
txs.push(one);
// extra fields
i.outs = outs;
i.fee = i.feeSat/bitcore.util.COIN;
i.missingSignatures = tx.countInputMissingSignatures(0);
txs.push(i);
});
$scope.txs = txs;
console.log('[transactions.js.55] SET HANDL+'); //TODO
w.removeListener('txProposalsUpdated',_updateTxs)
w.once('txProposalsUpdated',_updateTxs);
};

View File

@ -32,8 +32,6 @@ PrivateKey.fromObj = function(obj) {
};
PrivateKey.prototype.toObj = function() {
console.log('[PrivateKey.js.35] TODO TODO: PRIV: ', this.getExtendedPrivateKeyString()); //TODO
return {
extendedPrivateKeyString: this.getExtendedPrivateKeyString(),
networkName: this.network.name,

View File

@ -20,6 +20,7 @@ function TxProposal(opts) {
this.signedBy = opts.signedBy || {};
this.builder = opts.builder;
this.sentTs = opts.sentTs || null;
this.sentTxid = opts.sentTxid || null;
}
TxProposal.prototype.toObj = function() {
@ -30,7 +31,8 @@ TxProposal.prototype.toObj = function() {
};
TxProposal.prototype.setSent = function() {
TxProposal.prototype.setSent = function(sentTxid) {
this.sentTxid = txid;
this.sentTs = Date.now();;
};
@ -64,7 +66,6 @@ TxProposals.fromObj = function(o) {
o.txps.forEach(function(o2) {
var t = TxProposal.fromObj(o2);
var id = t.builder.build().getNormalizedHash().toString('hex');
console.log('[TxProposals.js.65:id:]',id, o2); //TODO
ret.txps[id] = t;
});
return ret;
@ -127,7 +128,6 @@ TxProposals.prototype._mergeMetadata = function(myTxps, theirTxps, mergeInfo) {
Object.keys(toMerge).forEach(function(hash) {
var v0 = myTxps[hash];
var v1 = toMerge[hash];
console.log('[TxProposals.js.127:v0:]',v0, v1); //TODO
Object.keys(v1.seenBy).forEach(function(k) {
if (!v0.seenBy[k] || v0.seenBy[k] !== v1.seenBy[k]) {
@ -143,13 +143,13 @@ console.log('[TxProposals.js.127:v0:]',v0, v1); //TODO
}
});
if (!v0.sentTs && v1.sentTs) {
v0.sentTs = v1.sentTs;
if (!v0.sentTxid && v1.sentTxid) {
v0.sentTs = v1.sentTs;
v0.sentTxid = v1.sentTxid;
hasChanged++;
}
});
console.log('[TxProposals.js.131:hasChanged:]',hasChanged); //TODO
return hasChanged;
};
@ -168,20 +168,17 @@ TxProposals.prototype._mergeBuilder = function(myTxps, theirTxps, mergeInfo) {
var after = JSON.stringify(v0.toObj());
if (after !== before) hasChanged ++;
}
console.log('[TxProposals.js.149:hasChanged:]',hasChanged); //TODO
};
TxProposals.prototype.add = function(data) {
var id = data.builder.build().getNormalizedHash().toString('hex');
console.log('[TxProposals.js.175:data: ADD]',data); //TODO
this.txps[id] = new TxProposal(data);
};
TxProposals.prototype.setSent = function(ntxid) {
TxProposals.prototype.setSent = function(ntxid,txid) {
//sent TxProposals are local an not broadcasted.
console.log('[TxProposals.js.147] SET SENT:', ntxid); //TODO
this.txps[ntxid].setSent();
this.txps[ntxid].setSent(txid);
};

View File

@ -77,12 +77,7 @@ Wallet.prototype._handleTxProposals = function(senderId, data, isInbound) {
var recipients;
var inTxp = copay.TxProposals.fromObj(data.txProposals);
var mergeInfo = this.txProposals.merge(inTxp, true);
console.log('[Wallet.js.79:inTxp:]',inTxp); //TODO
var addSeen = this.addSeenToTxProposals();
console.log('[Wallet.js.81]', addSeen, mergeInfo); //TODO
// if ((mergeInfo.merged && !data.isBroadcast) || addSeen) {
if (mergeInfo.hasChanged || addSeen) {
this.log('### BROADCASTING txProposals. ' );
recipients = null;
@ -168,7 +163,6 @@ Wallet.prototype.getMyPeerId = function() {
};
Wallet.prototype.netStart = function() {
console.log('[Wallet.js.159:netStart:]'); //TODO
var self = this;
var net = this.network;
net.removeAllListeners();
@ -188,7 +182,6 @@ console.log('[Wallet.js.159:netStart:]'); //TODO
peerId: myPeerId
};
net.start(function() {
console.log('[Wallet.js.177] NET START: emit CREATED'); //TODO
self.emit('created');
for (var i=0; i<self.publicKeyRing.registeredCopayers(); i++) {
var otherPeerId = self.getPeerId(i);
@ -296,9 +289,24 @@ Wallet.prototype.getTxProposals = function() {
var ret = [];
for(var k in this.txProposals.txps) {
var txp = this.txProposals.txps[k];
var i = {txp:txp};
var i = JSON.parse(JSON.stringify(txp));
i.builder = txp.builder;
i.ntxid = k;
i.signedByUs = txp.signedBy[this.getMyPeerId()]?true:false;
i.peerActions = {};
for(var p in txp.seenBy){
i.peerActions[p]={seen: txp.seenBy[p]};
}
for(var p in txp.signedBy){
i.peerActions[p]= i.peerActions[p] || {};
i.peerActions[p].sign = txp.signedBy[p];
}
var c = txp.creator;
i.peerActions[c] = i.peerActions[c] || {};
i.peerActions[c].create = txp.createdTs;
ret.push(i);
}
return ret;
@ -349,7 +357,7 @@ Wallet.prototype.sendTx = function(ntxid, cb) {
this.blockchain.sendRawTransaction(txHex, function(txid) {
self.log('BITCOND txid:',txid); //TODO
if (txid) {
self.txProposals.setSent(ntxid);
self.txProposals.setSent(ntxid, txid);
}
self.sendTxProposals();
self.store();
@ -363,10 +371,8 @@ Wallet.prototype.addSeenToTxProposals = function() {
for(var k in this.txProposals.txps) {
var txp = this.txProposals.txps[k];
console.log('[Wallet.js.364:txp:] ADD SEEN',txp); //TODO
if (!txp.seenBy[myId]) {
console.log('[Wallet.js.367] ADDING'); //TODO
txp.seenBy[myId] = Date.now();
ret = true;
}
@ -446,12 +452,9 @@ Wallet.prototype.createTx = function(toAddress, amountSatStr, opts, cb) {
}
self.getUnspent(function(unspentList) {
// TODO check enough funds, etc.
console.log('[Wallet.js.452]', self); //TODO
self.createTxSync(toAddress, amountSatStr, unspentList, opts);
self.sendPublicKeyRing(); // Change Address
self.sendTxProposals();
console.log('[Wallet.js.452]', self); //TODO
self.store();
return cb();
});
@ -488,8 +491,6 @@ Wallet.prototype.createTxSync = function(toAddress, amountSatStr, utxos, opts) {
if (priv) me[myId] = now;
console.log('[Wallet.js.485:me:]',myId, me); //TODO
var data = {
signedBy: (priv && b.signaturesAdded ? me : {}),
seenBy: (priv ? me : {}),
@ -498,8 +499,6 @@ console.log('[Wallet.js.485:me:]',myId, me); //TODO
builder: b,
};
console.log('[Wallet.js.499:data:]',data); //TODO
this.txProposals.add(data);
};

View File

@ -135,7 +135,7 @@ WalletFactory.prototype.getWalletIds = function() {
WalletFactory.prototype.remove = function(walletId) {
// TODO remove wallet contents
console.log('TODO: remove wallet contents');
this.log('TODO: remove wallet contents');
};