From dcd903904eb9e243ee80b1c0e752bd73e98f3c99 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Mon, 21 Apr 2014 07:27:45 -0300 Subject: [PATCH 1/3] multiple ux fixes --- css/main.css | 2 ++ index.html | 39 +++++++++++++++++++-------------- js/controllers/transactions.js | 22 +++++-------------- js/models/core/TxProposals.js | 9 +++++--- js/models/core/Wallet.js | 33 ++++++++++++++-------------- js/models/core/WalletFactory.js | 2 +- 6 files changed, 53 insertions(+), 54 deletions(-) diff --git a/css/main.css b/css/main.css index 8c6913c2e..635c5efb2 100644 --- a/css/main.css +++ b/css/main.css @@ -243,3 +243,5 @@ button.secondary:hover { background-color: #FFDF00 !important;} .m30v {margin: 30px 0;} .m30a {margin: 30px auto;} .br100 {border-radius: 100%;} + + diff --git a/index.html b/index.html index 04fee0a18..040204a05 100644 --- a/index.html +++ b/index.html @@ -18,8 +18,8 @@
Wallet ID: {{$root.wallet.id}}
-

{{totalBalance}} BTC

-

0 BTC

+

{{totalBalance}}

+

0

@@ -215,11 +215,11 @@

Address

-

{{balanceByAddr[addr]}} BTC

+

{{balanceByAddr[addr]}}

Create a New Address

@@ -241,7 +241,7 @@
- ntxid: {{tx.ntxid}} + Proposal ID: {{tx.ntxid}}
created at {{tx.createdTs | date:'medium'}} @@ -251,20 +251,23 @@
- - - - - - - - +
CreatorTo address
- - - + + + + +
{{tx.creator}}{{o.value}} BTC{{o.address}}{{o.value}} + {{o.address}}
+ You + {{peer}} + : + + {{action}} + +
@@ -272,7 +275,7 @@
-
+
Signed by you already
@@ -294,7 +297,9 @@ + Sent at {{tx.sentTs | date:'medium'}} + TXID: tx.sentTxid One signature missing diff --git a/js/controllers/transactions.js b/js/controllers/transactions.js index 39bf65282..6c7847262 100644 --- a/js/controllers/transactions.js +++ b/js/controllers/transactions.js @@ -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); }; diff --git a/js/models/core/TxProposals.js b/js/models/core/TxProposals.js index 28f9dadbe..20c8ee6aa 100644 --- a/js/models/core/TxProposals.js +++ b/js/models/core/TxProposals.js @@ -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();; }; @@ -143,8 +145,9 @@ 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++; } diff --git a/js/models/core/Wallet.js b/js/models/core/Wallet.js index e82bff825..869b851c3 100644 --- a/js/models/core/Wallet.js +++ b/js/models/core/Wallet.js @@ -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 Date: Mon, 21 Apr 2014 07:30:46 -0300 Subject: [PATCH 2/3] remove console.logs --- js/models/core/PrivateKey.js | 2 -- js/models/core/TxProposals.js | 10 ++-------- js/models/core/Wallet.js | 2 +- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/js/models/core/PrivateKey.js b/js/models/core/PrivateKey.js index 66102e8db..bf8cfa9de 100644 --- a/js/models/core/PrivateKey.js +++ b/js/models/core/PrivateKey.js @@ -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, diff --git a/js/models/core/TxProposals.js b/js/models/core/TxProposals.js index 20c8ee6aa..e3f087af7 100644 --- a/js/models/core/TxProposals.js +++ b/js/models/core/TxProposals.js @@ -66,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; @@ -129,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]) { @@ -152,7 +150,6 @@ console.log('[TxProposals.js.127:v0:]',v0, v1); //TODO } }); -console.log('[TxProposals.js.131:hasChanged:]',hasChanged); //TODO return hasChanged; }; @@ -171,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); }; diff --git a/js/models/core/Wallet.js b/js/models/core/Wallet.js index 869b851c3..388656018 100644 --- a/js/models/core/Wallet.js +++ b/js/models/core/Wallet.js @@ -357,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(); From 342b9bd937d2b2514d7911cd143661d4dea56d36 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Mon, 21 Apr 2014 07:47:35 -0300 Subject: [PATCH 3/3] buttons fix --- index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 040204a05..f9d0510eb 100644 --- a/index.html +++ b/index.html @@ -279,7 +279,7 @@
Signed by you already
-
+
@@ -299,7 +299,7 @@ Sent at {{tx.sentTs | date:'medium'}} - TXID: tx.sentTxid + TXID: {{tx.sentTxid}} One signature missing