diff --git a/assets/scripts/dashboard.js b/assets/scripts/dashboard.js
index 80aeb56..0b95a74 100644
--- a/assets/scripts/dashboard.js
+++ b/assets/scripts/dashboard.js
@@ -122,6 +122,16 @@ var Dashboard = function() {
}
var handle_edex_send = function() {
+ $('.btn_refresh_edexcoin_send').click(function() {
+ var active_edexcoin = $('[data-edexcoin]').attr('data-edexcoin');
+ var call_data = {"allcoins": false,"coin":'KMD',"calls":"refresh"}
+ console.log(call_data)
+ Shepherd_FetchBasiliskData(call_data).then(function(result){
+ console.log(result)
+ toastr.info('Refreshing Wallet Funds.', 'Wallet Notification');
+ })
+ });
+
$('#btn_edexcoin_send').click(function() {
$('#btn_edexcoin_dashboard').show();
$('#btn_edexcoin_send').hide();
@@ -2639,9 +2649,9 @@ function ShowBasiliskFetchDataProgress(coin) {
})
})).then(result => {
//console.log(result)
- //res_data.coin = coin_exists
- //res_data.addresses = addresses_exists
- BasiliskFetchData = ''
+ //var res_data.coin = coin_exists
+ //var res_data.addresses = addresses_exists
+ var BasiliskFetchData = ''
$.each(result, function(result_index, result_val) {
//console.log(result_index)
@@ -2670,45 +2680,57 @@ function ShowBasiliskFetchDataProgress(coin) {
switch (result_val.listtransactions_status) {
case 'waiting':
tmp_listtransactions_lable_color = 'dark'
+ $('#edexcoin_dashboard_basilisk_refresh_status').show()
break;
case 'in progress':
tmp_listtransactions_lable_color = 'primary'
+ $('#edexcoin_dashboard_basilisk_refresh_status').show()
break;
case 'done':
tmp_listtransactions_lable_color = 'success'
+ $('#edexcoin_dashboard_basilisk_refresh_status').hide()
break;
case 'NOT FOUND':
tmp_listtransactions_lable_color = 'danger'
+ $('#edexcoin_dashboard_basilisk_refresh_status').show()
break;
}
switch (result_val.getbalance_status) {
case 'waiting':
tmp_getbalance_lable_color = 'dark'
+ $('#edexcoin_dashboard_basilisk_refresh_status').show()
break;
case 'in progress':
tmp_getbalance_lable_color = 'primary'
+ $('#edexcoin_dashboard_basilisk_refresh_status').show()
break;
case 'done':
tmp_getbalance_lable_color = 'success'
+ $('#edexcoin_dashboard_basilisk_refresh_status').hide()
break;
case 'NOT FOUND':
tmp_getbalance_lable_color = 'danger'
+ $('#edexcoin_dashboard_basilisk_refresh_status').show()
break;
}
switch (result_val.refresh_status) {
case 'waiting':
tmp_refresh_lable_color = 'dark'
+ $('#edexcoin_dashboard_basilisk_refresh_status').show()
break;
case 'in progress':
tmp_refresh_lable_color = 'primary'
+ $('#edexcoin_dashboard_basilisk_refresh_status').show()
break;
case 'done':
tmp_refresh_lable_color = 'success'
+ $('#edexcoin_dashboard_basilisk_refresh_status').hide()
break;
case 'NOT FOUND':
tmp_refresh_lable_color = 'danger'
+ //$('#edexcoin_dashboard_basilisk_refresh_status').show()
break;
}
@@ -2721,12 +2743,13 @@ function ShowBasiliskFetchDataProgress(coin) {
BasiliskFetchData += '
'+result_val.refresh_status+' | ';
BasiliskFetchData += '';
$('.tbl_edexcoin_dashboard_basilisk_refresh_status tbody').html(BasiliskFetchData);
+ //console.log(result_val.refresh_status)
- if (result[result.length-1] == result_val && result_val.listtransactions_status !== 'done' && result_val.getbalance_status !== 'done' && result_val.refresh_status !== 'done' ) {
+ /*if (result[result.length-1] == result_val && result_val.listtransactions_status !== 'done' && result_val.getbalance_status !== 'done' && result_val.refresh_status !== 'done' ) {
$('#edexcoin_dashboard_basilisk_refresh_status').show()
} else {
$('#edexcoin_dashboard_basilisk_refresh_status').hide()
- }
+ }*/
})
})
}
diff --git a/assets/scripts/iguana_api.js b/assets/scripts/iguana_api.js
index 1cc890f..83177f3 100644
--- a/assets/scripts/iguana_api.js
+++ b/assets/scripts/iguana_api.js
@@ -1262,7 +1262,8 @@ function EDEXSendutxoRawTx(data) {
var gettxiddata = function() {
return new Promise(function(resolve, reject) {
- EDEXgettransaction(ajax_data_dexrawtx.coin,result.rawtx).then(function(result){
+ toastr.info('Getting txid info for updating funds data.', 'Wallet Notification');
+ EDEXgettransaction(ajax_data_dexrawtx.coin,dexrwatx_result).then(function(result){
//console.log(result)
resolve(result)
})
@@ -1271,8 +1272,8 @@ function EDEXSendutxoRawTx(data) {
var process_refresh_utxos = function(gettxdata) {
return new Promise(function(resolve, reject) {
- console.log(gettxdata)
- console.log(utxos_set)
+ //console.log(gettxdata)
+ //console.log(utxos_set)
EDEX_ProcessRefreshData(gettxdata,utxos_set).then(function(new_utxos_set){
console.log(new_utxos_set)
resolve(new_utxos_set)
@@ -1280,9 +1281,41 @@ function EDEXSendutxoRawTx(data) {
});
}
+ var get_data_cache_contents = function(new_utxos_set) {
+ return new Promise(function(resolve, reject) {
+ console.log(new_utxos_set)
+ console.log(send_data)
+ console.log(send_data.sendfrom)
+ Shepherd_GroomData_Get().then(function(result){
+ console.log(result)
+ console.log(result.basilisk.KMD[send_data.sendfrom].refresh)
+ delete result.basilisk.KMD[send_data.sendfrom].refresh.data
+ console.log(result.basilisk.KMD[send_data.sendfrom].refresh)
+ result.basilisk.KMD[send_data.sendfrom].refresh.data = new_utxos_set
+ console.log(result.basilisk.KMD[send_data.sendfrom].refresh)
+ var save_this_data = result
+ resolve(result);
+ })
+ });
+ }
+
+ var save_new_cache_data = function(save_this_data) {
+ return new Promise(function(resolve, reject) {
+ console.log(save_this_data)
+ Shepherd_GroomData_Post(save_this_data).then(function(result){
+ console.log(result)
+ resolve(result);
+ })
+ });
+ }
+
gettxiddata()
.then(function(gettxdata) {
return process_refresh_utxos(gettxdata);
+ }).then(function(new_utxos_set) {
+ return get_data_cache_contents(new_utxos_set)
+ }).then(function(save_this_data) {
+ return save_new_cache_data(save_this_data)
});
//var call_data = {"allcoins": false,"coin":ajax_data_dexrawtx.coin,"calls":"refresh"}
@@ -1519,8 +1552,26 @@ function EDEXgettransaction(coin,txid) {
'vout':1,
'txid': txid
};
- console.log(ajax_data)
- var AjaxOutputData = IguanaAJAX('http://127.0.0.1:7778',ajax_data).done(function(data) {
+ //console.log(ajax_data)
+ $.ajax({
+ type: 'POST',
+ data: JSON.stringify(ajax_data),
+ url: 'http://127.0.0.1:7778'
+ }).then(function(data) {
+ //console.log(data)
+ res_data = JSON.parse(data)
+ //console.log(res_data)
+ resolve(res_data)
+ }).fail(function(xhr, textStatus, error) {
+ // handle request failures
+ console.log(xhr.statusText);
+ if ( xhr.readyState == 0 ) {
+ }
+ console.log(textStatus);
+ console.log(error);
+ });
+
+ /*var AjaxOutputData = IguanaAJAX('http://127.0.0.1:7778',ajax_data).done(function(data) {
AjaxOutputData = JSON.parse(AjaxOutputData.responseText)
resolve(AjaxOutputData);
}).fail(function(xhr, textStatus, error) {
@@ -1530,7 +1581,7 @@ function EDEXgettransaction(coin,txid) {
}
console.log(textStatus);
console.log(error);
- });
+ });*/
})
}
@@ -2285,7 +2336,7 @@ function Iguana_DEXsendrawtx(data) {
data: JSON.stringify(ajax_data),
url: 'http://127.0.0.1:7778',
type: 'POST',
- dataType: 'json'
+ //dataType: 'json'
}).then(result => {
console.log(result);
resolve(result);
@@ -2449,10 +2500,16 @@ function EDEX_DEXgetinfoAll() {
}
function EDEX_ProcessRefreshData(gettxdata,refreshdata){
+ console.log(gettxdata)
+ console.log(refreshdata)
return new Promise((resolve, reject) => {
Promise.all(gettxdata.vin.map((vin_value,vin_index) => {
+ console.log(vin_index)
+ console.log(vin_value)
return new Promise((resolve, reject) => {
Promise.all(refreshdata.map((refresh_value,refresh_index) => {
+ console.log(refresh_index)
+ console.log(refresh_value)
if (refreshdata[refresh_index] !== undefined && refresh_value.txid == vin_value.txid) {
delete refreshdata[refresh_index]
refreshdata = refreshdata
@@ -2462,6 +2519,7 @@ function EDEX_ProcessRefreshData(gettxdata,refreshdata){
})
})).then(result=>{
var res_data = result[result.length - 1];
+ console.log(res_data)
var refresh_final = []
$.each(res_data,function(index){
@@ -2653,6 +2711,55 @@ function Shepherd_FetchBasiliskData(req_data) {
});
}
+
+function Shepherd_GroomData_Get() {
+ return new Promise((resolve) => {
+ var parse_session_data = sessionStorage.getItem('IguanaActiveAccount');
+ parse_session_data = JSON.parse(JSON.parse(parse_session_data));
+ var request_method = '';
+ var session_pubkey = parse_session_data.pubkey;
+ var ajax_data = {'filename': session_pubkey};
+
+ var req_url = 'http://127.0.0.1:17777/shepherd/groom';
+ console.log(ajax_data)
+
+ $.ajax({
+ type: 'GET',
+ data: ajax_data,
+ url: req_url,
+ contentType: 'application/json', // send as JSON
+ }).done(function(data) {
+ var res_data = JSON.parse(data)
+ resolve(res_data.result);
+ });
+ });
+}
+
+function Shepherd_GroomData_Post(req_data) {
+ return new Promise((resolve) => {
+ var parse_session_data = sessionStorage.getItem('IguanaActiveAccount');
+ parse_session_data = JSON.parse(JSON.parse(parse_session_data));
+ var request_method = '';
+ var session_pubkey = parse_session_data.pubkey;
+
+ console.log(req_data)
+ var ajax_data = {'filename': session_pubkey,'payload':req_data};
+
+ var req_url = 'http://127.0.0.1:17777/shepherd/groom';
+ console.log(ajax_data)
+
+ $.ajax({
+ type: 'POST',
+ data: ajax_data,
+ url: req_url,
+ dataType: 'json'
+ }).done(function(data) {
+ var res_data = JSON.parse(data)
+ resolve(res_data);
+ });
+ });
+}
+
function Shepherd_GetBasiliskCache() {
return new Promise((resolve) => {
var parse_session_data = sessionStorage.getItem('IguanaActiveAccount');
@@ -2759,4 +2866,4 @@ function Shepherd_CheckBasiliskCacheData(coin) {
}
});
});
-}
\ No newline at end of file
+}
diff --git a/index.html b/index.html
index d33a206..c3464cd 100755
--- a/index.html
+++ b/index.html
@@ -965,11 +965,10 @@