From 23e1a98f4f10966653da15553ecbdcc0e8c59289 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Sat, 27 Aug 2016 16:11:23 -0700 Subject: [PATCH] browser: show tx details. --- browser/index.html | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/browser/index.html b/browser/index.html index 6843ca2f..8c440bfb 100644 --- a/browser/index.html +++ b/browser/index.html @@ -234,25 +234,34 @@ more bitcoin magic). html += 'Extended Private Key: ' + key.xprivkey + '
'; html += 'Mnemonic: ' + key.mnemonic.phrase + '
'; wallet.getBalance(function(err, balance) { - if (balance) { - html += 'Confirmed Balance: ' + utils.btc(balance.confirmed) + '
'; - html += 'Unconfirmed Balance: ' + utils.btc(balance.unconfirmed) + '
'; - html += 'Balance: ' + utils.btc(balance.total) + '
'; - } + if (err) + throw err; + + html += 'Confirmed Balance: ' + utils.btc(balance.confirmed) + '
'; + html += 'Unconfirmed Balance: ' + utils.btc(balance.unconfirmed) + '
'; + html += 'Balance: ' + utils.btc(balance.total) + '
'; + wallet.getHistory(function(err, txs) { - html += 'TXs:\n'; - wdiv.innerHTML = html; - if (txs) { + if (err) + throw err; + + wallet.toDetails(txs, function(err, txs) { + if (err) + throw err; + + html += 'TXs:\n'; + wdiv.innerHTML = html; + txs.forEach(function(tx) { - var el = create('' + tx.rhash + ''); + var el = create('' + tx.hash + ''); wdiv.appendChild(el); el.onmouseup = function(ev) { - show(tx); + show(tx.toJSON()); ev.stopPropagation(); return false; }; }); - } + }); }); }); }