From 5594b3118afd4b9d1de9b70c10812487b7bc3761 Mon Sep 17 00:00:00 2001 From: satindergrewal Date: Tue, 5 Dec 2017 21:14:50 +1300 Subject: [PATCH] Electrum mode listunspent display fixed --- gui/js/simpledexactions.js | 50 +++++++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 17 deletions(-) diff --git a/gui/js/simpledexactions.js b/gui/js/simpledexactions.js index 6ae740a..19bda4a 100644 --- a/gui/js/simpledexactions.js +++ b/gui/js/simpledexactions.js @@ -1245,14 +1245,22 @@ function check_coin_listunspent(coin_listunspent_data) { }).done(function(coin_listunspent_output_data) { // If successful console.log(coin_listunspent_output_data); + console.log(coin_listunspent_output_data[0].hasOwnProperty('account')); $('.dex_showlist_unspents_tbl tbody').empty(); var show_list_unspents_tbl_tr = ''; show_list_unspents_tbl_tr += ''; show_list_unspents_tbl_tr += 'Index'; - show_list_unspents_tbl_tr += 'Coin Info'; - show_list_unspents_tbl_tr += 'Value info'; - show_list_unspents_tbl_tr += 'Transaction Info'; + if (coin_listunspent_output_data[0].hasOwnProperty('account') == true) { + show_list_unspents_tbl_tr += 'Coin Info'; + show_list_unspents_tbl_tr += 'Value info'; + show_list_unspents_tbl_tr += 'Transaction Info'; + } else { + show_list_unspents_tbl_tr += 'Height'; + show_list_unspents_tbl_tr += 'Tx Hash'; + show_list_unspents_tbl_tr += 'Tx Pos'; + show_list_unspents_tbl_tr += 'Value'; + } show_list_unspents_tbl_tr += ''; $('.dex_showlist_unspents_tbl tbody').append(show_list_unspents_tbl_tr); $.each(coin_listunspent_output_data, function(index, val) { @@ -1268,20 +1276,28 @@ function check_coin_listunspent(coin_listunspent_data) { show_list_unspents_tbl_tr = ''; show_list_unspents_tbl_tr += ''; show_list_unspents_tbl_tr += '' + index + ''; - show_list_unspents_tbl_tr += ` - Coin: `+ coin_listunspent_data.coin +`
- Account: `+ val.account +`
- Address: `+ val.address +`
- `; - show_list_unspents_tbl_tr += ` - Amount: `+ (parseFloat(val.amount)).toFixed(8) + ' ' + coin_listunspent_data.coin +`
- Confirmations: `+ val.confirmations +`
- Interest: `+ utxo_interest +`
- `; - show_list_unspents_tbl_tr += ` - scriptPubKey: `+ val.scriptPubKey +`
- TxID: `+ val.txid +`
- `; + if (coin_listunspent_output_data[0].hasOwnProperty('account') == true) { + show_list_unspents_tbl_tr += ` + Coin: `+ coin_listunspent_data.coin +`
+ Account: `+ val.account +`
+ Address: `+ val.address +`
+ `; + show_list_unspents_tbl_tr += ` + Amount: `+ (parseFloat(val.amount)).toFixed(8) + ' ' + coin_listunspent_data.coin +`
+ Confirmations: `+ val.confirmations +`
+ Interest: `+ utxo_interest +`
+ `; + show_list_unspents_tbl_tr += ` + scriptPubKey: `+ val.scriptPubKey +`
+ TxID: `+ val.txid +`
+ `; + } else { + show_list_unspents_tbl_tr += `` + val.height + ``; + show_list_unspents_tbl_tr += `` + val.tx_hash + ``; + show_list_unspents_tbl_tr += `` + val.tx_pos + ``; + show_list_unspents_tbl_tr += `` + (parseFloat(val.value)).toFixed(8) + ' ' + coin_listunspent_data.coin + ``; + } + show_list_unspents_tbl_tr += ''; $('.dex_showlist_unspents_tbl tbody').append(show_list_unspents_tbl_tr);