Browse Source

code cleanup p2 #3

master
Petr Balashov 8 years ago
parent
commit
aa9da9e2ab
  1. 12
      assets/scripts/atomicexplorer.js
  2. 83
      assets/scripts/dashboard/DashboardBasilisk.js
  3. 62
      assets/scripts/dashboard/DashboardDEX.js
  4. 98
      assets/scripts/dashboard/DashboardEDEX.js

12
assets/scripts/atomicexplorer.js

@ -41,7 +41,7 @@ var AtomicExplorer = function() {
'method': 'history',
'vals': {
'coin': atomic_explorer_select_coin_val,
'addresses': [atomic_explorer_input_data_val]
'addresses': [ atomic_explorer_input_data_val ]
}
};
break;
@ -50,7 +50,7 @@ var AtomicExplorer = function() {
'userpass': tmpIguanaRPCAuth,
'coin': atomic_explorer_select_coin_val,
'method': 'getbalance',
'params': [atomic_explorer_input_data_val]
'params': [ atomic_explorer_input_data_val ]
};
break;
case 'listunspent':
@ -58,7 +58,11 @@ var AtomicExplorer = function() {
'userpass': tmpIguanaRPCAuth,
'coin': atomic_explorer_select_coin_val,
'method': 'listunspent',
'params': [1, 9999999, [atomic_explorer_input_data_val]]
'params': [
1,
9999999,
[ atomic_explorer_input_data_val ]
]
};
break;
case 'txid':
@ -66,7 +70,7 @@ var AtomicExplorer = function() {
'userpass': tmpIguanaRPCAuth,
'coin': atomic_explorer_select_coin_val,
'method': 'getrawtransaction',
'params': [atomic_explorer_input_data_val]
'params': [ atomic_explorer_input_data_val ]
};
break;
case 'blockash':

83
assets/scripts/dashboard/DashboardBasilisk.js

@ -4,6 +4,7 @@ function ShowBasiliskFetchDataProgress(coin) {
Shepherd_GetBasiliskCache()
.then(function(result) {
var _data = JSON.parse(result),
NOT_FOUND = 'NOT FOUND',
query = _data.result.basilisk,
coin_exists = true,
addresses_exists = true,
@ -11,47 +12,34 @@ function ShowBasiliskFetchDataProgress(coin) {
listtransactions_exists = true,
listunspent_exists = true,
refresh_exists = true,
getbalance_status = 'NOT FOUND',
listtransactions_status = 'NOT FOUND',
listunspent_status = 'NOT FOUND',
refresh_status = 'NOT FOUND',
getbalance_status = NOT_FOUND,
listtransactions_status = NOT_FOUND,
listunspent_status = NOT_FOUND,
refresh_status = NOT_FOUND,
res_data;
//console.log(query)
res_data = {
'addresses': false,
'getbalance': false,
'listtransactions': false,
'listunspent': false,
'refresh': false
}
if (!query) {
//console.log('data not found.')
res_data = {
'coin': false,
'addresses': false,
'getbalance': false,
'listtransactions': false,
'listunspent': false,
'refresh': false
};
res_data.coin = false;
//console.log(res_data)
} else if (!query[coin]) {
//console.log(coin + ' not found.')
coin_exists = false;
res_data = {
'coin': coin_exists,
'addresses': false,
'getbalance': false,
'listtransactions': false,
'listunspent': false,
'refresh': false
};
res_data.coin = coin_exists;
//console.log(res_data)
} else if (!('addresses' in query[coin])) {
//console.log(coin + ' addresses not found.')
addresses_exists = false;
res_data = {
'coin': coin_exists,
'addresses': false,
'getbalance': false,
'listtransactions': false,
'listunspent': false,
'refresh': false
};
res_data.coin = coin_exists;
//console.log(res_data)
} else {
Promise.all(query[coin].addresses.map((coinaddr_value,coinaddr_index) => {
@ -134,7 +122,7 @@ function ShowBasiliskFetchDataProgress(coin) {
case 'done':
tmp_listunspent_lable_color = 'success';
break;
case 'NOT FOUND':
case NOT_FOUND:
tmp_listunspent_lable_color = 'danger';
break;
}
@ -152,7 +140,7 @@ function ShowBasiliskFetchDataProgress(coin) {
tmp_listtransactions_lable_color = 'success';
$('#edexcoin_dashboard_basilisk_refresh_status').hide();
break;
case 'NOT FOUND':
case NOT_FOUND:
tmp_listtransactions_lable_color = 'danger';
$('#edexcoin_dashboard_basilisk_refresh_status').show();
break;
@ -171,7 +159,7 @@ function ShowBasiliskFetchDataProgress(coin) {
tmp_getbalance_lable_color = 'success';
$('#edexcoin_dashboard_basilisk_refresh_status').hide();
break;
case 'NOT FOUND':
case NOT_FOUND:
tmp_getbalance_lable_color = 'danger';
$('#edexcoin_dashboard_basilisk_refresh_status').show();
break;
@ -190,27 +178,28 @@ function ShowBasiliskFetchDataProgress(coin) {
tmp_refresh_lable_color = 'success';
$('#edexcoin_dashboard_basilisk_refresh_status').hide();
break;
case 'NOT FOUND':
case NOT_FOUND:
tmp_refresh_lable_color = 'danger';
//$('#edexcoin_dashboard_basilisk_refresh_status').show();
break;
}
BasiliskFetchData += '<tr>';
BasiliskFetchData += '<td>' + result_val.addr_value.substring(0,5) + '...</td>';
BasiliskFetchData += '<td>' +
'<span class="label label-' + tmp_listunspent_lable_color + ' text-uppercase">' + result_val.listunspent_status + '</span>' +
'</td>';
BasiliskFetchData += '<td>' +
'<span class="label label-' + tmp_listtransactions_lable_color + ' text-uppercase">' + result_val.listtransactions_status + '</span>' +
'</td>';
BasiliskFetchData += '<td>' +
'<span class="label label-' + tmp_getbalance_lable_color + ' text-uppercase">' + result_val.getbalance_status + '</span>' +
'</td>';
BasiliskFetchData += '<td>' +
'<span class="label label-' + tmp_refresh_lable_color + ' text-uppercase">' + result_val.refresh_status + '</span>' +
'</td>';
BasiliskFetchData += '</tr>';
BasiliskFetchData +=
'<tr>';
'<td>' + result_val.addr_value.substring(0,5) + '...</td>' +
'<td>' +
'<span class="label label-' + tmp_listunspent_lable_color + ' text-uppercase">' + result_val.listunspent_status + '</span>' +
'</td>' +
'<td>' +
'<span class="label label-' + tmp_listtransactions_lable_color + ' text-uppercase">' + result_val.listtransactions_status + '</span>' +
'</td>' +
'<td>' +
'<span class="label label-' + tmp_getbalance_lable_color + ' text-uppercase">' + result_val.getbalance_status + '</span>' +
'</td>' +
'<td>' +
'<span class="label label-' + tmp_refresh_lable_color + ' text-uppercase">' + result_val.refresh_status + '</span>' +
'</td>' +
'</tr>';
$('.tbl_edexcoin_dashboard_basilisk_refresh_status tbody').html(BasiliskFetchData);
//console.log(result_val.refresh_status)

62
assets/scripts/dashboard/DashboardDEX.js

@ -1,6 +1,6 @@
function getDEXCoinBalance(coin) {
getDEXGetBalance_cache(coin).then(function(result) {
console.log(result)
console.log(result);
});
}
@ -86,34 +86,34 @@ function getDEXGetBalance_cache(coin) {
NProgress.start();
return new Promise((resolve) => {
Shepherd_CheckBasiliskCacheData(coin)
.then(function(result) {
//console.log(result);
//console.log(result.coin);
Shepherd_CheckBasiliskCacheData(coin)
.then(function(result) {
//console.log(result);
//console.log(result.coin);
if (result.coin == false || result.addresses == false) {
var call_data = {
'allcoins': false,
'coin': coin,
'calls': 'listtransactions:getbalance:refresh'
};
//console.log(call_data)
Shepherd_FetchBasiliskData(call_data)
.then(function(result) {
console.log(result);
});
} else if (result.getbalance == false) {
var call_data = {
'allcoins': false,
'coin': coin,
'calls': 'getbalance:listtransactions'
};
//console.log(call_data);
Shepherd_FetchBasiliskData(call_data).then(function(result) {
console.log(result);
});
}
})
if (result.coin == false || result.addresses == false) {
var call_data = {
'allcoins': false,
'coin': coin,
'calls': 'listtransactions:getbalance:refresh'
};
//console.log(call_data)
Shepherd_FetchBasiliskData(call_data)
.then(function(result) {
console.log(result);
});
} else if (result.getbalance == false) {
var call_data = {
'allcoins': false,
'coin': coin,
'calls': 'getbalance:listtransactions'
};
//console.log(call_data);
Shepherd_FetchBasiliskData(call_data).then(function(result) {
console.log(result);
});
}
});
Shepherd_GetBasiliskCache()
.then(function(result) {
@ -166,7 +166,7 @@ function getDEXGetBalance_cache(coin) {
function getDEXGetBalance2(coin) {
NProgress.done(true);
NProgress.configure({
template: templates.nprogressBar
template: templates.nprogressBar
});
NProgress.start();
@ -177,7 +177,7 @@ function getDEXGetBalance2(coin) {
'agent': 'SuperNET',
'method': 'activehandle'
},
tmp_coin_addr = null
tmp_coin_addr = null,
ajax_call_1= $.ajax({
data: JSON.stringify(ajax_data_1),
url: 'http://127.0.0.1:' + config.iguanaPort,
@ -251,7 +251,7 @@ function getDEXGetBalance2(coin) {
};
}
resolve(tmp_addr_total_balance_output)
resolve(tmp_addr_total_balance_output);
NProgress.done();
})
.fail(function(xhr, textStatus, error) {

98
assets/scripts/dashboard/DashboardEDEX.js

@ -97,39 +97,15 @@ function EdexGetTxList(coin) {
Promise.all(data.result.map((coinaddr_value,coinaddr_index) => {
if ( active_edexcoinmodecode == 'Basilisk' ) {
if ( coin == 'BTC' ||
coin == 'BTCD' ||
coin == 'LTC' ||
coin == 'DOGE' ||
coin == 'DGB' ||
coin == 'SYS' ||
coin == 'MZC' ||
coin == 'UNO' ||
coin == 'ZET' ||
coin == 'BTM' ||
coin == 'CARB' ||
coin == 'ANC' ||
coin == 'FRK') {
params = {
'userpass': tmpIguanaRPCAuth,
'agent': 'dex',
'method': 'listtransactions',
'address': coinaddr_value,
'count': 100,
'skip': 0,
'symbol': coin
};
} else {
params = {
'userpass': tmpIguanaRPCAuth,
'agent': 'dex',
'method': 'listtransactions',
'address': coinaddr_value,
'count': 100,
'skip': 0,
'symbol': coin
};
}
params = {
'userpass': tmpIguanaRPCAuth,
'agent': 'dex',
'method': 'listtransactions',
'address': coinaddr_value,
'count': 100,
'skip': 0,
'symbol': coin
};
} else {
params = {
'userpass': tmpIguanaRPCAuth,
@ -243,7 +219,7 @@ function EdexGetTxList(coin) {
tmp_amount = '<span class="label label-dark">' + _lang[defaultLang].DASHBOARD.UNKNOWN + '</span>';
}
var tmp_addr = null
var tmp_addr = null;
if (!('paid' in result_data[index])) {
tmp_addr = '<i class="icon fa-bullseye"></i> <span class="label label-dark">' + _lang[defaultLang].DASHBOARD.ZADDR_NOT_LISTED + '!</span>';
}
@ -609,7 +585,7 @@ function clearEdexSendFieldData() {
function EdexListAllAddr(coin) {
NProgress.done(true);
NProgress.configure({
template: templates.nprogressBar
template: templates.nprogressBar
});
NProgress.start();
@ -822,7 +798,7 @@ function edexCoinBtnAction() {
.then(function(result) {
$('#edexcoin_active_addr').text(result);
$('#edexcoin_active_addr_clipboard').attr('data-clipboard-text', result);
})
});
$('#edexcoin_active_addr_clipboard').click(function() {
alertify.success(_lang[defaultLang].DASHBOARD.ADDR_COPIED + '.');
@ -994,55 +970,7 @@ function edexCoinBtnAction() {
sessionStorage.setItem('edexTmpRefresh', 'start');
$( '#nav-zcash-wallet' ).trigger( 'click' );
}
if (selected_coin == 'SUPERNET' ||
selected_coin == 'REVS' ||
selected_coin == 'REVS' ||
selected_coin == 'DEX' ||
selected_coin == 'PANGEA' ||
selected_coin == 'JUMBLR' ||
selected_coin == 'BET' ||
selected_coin == 'CRYPTO' ||
selected_coin == 'HODL' ||
selected_coin == 'SHARK' ||
selected_coin == 'BOTS' ||
selected_coin == 'MGW' ||
selected_coin == 'MVP' ||
selected_coin == 'WIRELESS' ||
selected_coin == 'KV' ||
selected_coin == 'CEAL' ||
selected_coin == 'MESH' ||
selected_coin == 'USD' ||
selected_coin == 'RON' ||
selected_coin == 'EUR' ||
selected_coin == 'JPY' ||
selected_coin == 'GBP' ||
selected_coin == 'AUD' ||
selected_coin == 'CAD' ||
selected_coin == 'CHF' ||
selected_coin == 'NZD' ||
selected_coin == 'CNY' ||
selected_coin == 'RUB' ||
selected_coin == 'MXN' ||
selected_coin == 'BRL' ||
selected_coin == 'INR' ||
selected_coin == 'HKD' ||
selected_coin == 'TRY' ||
selected_coin == 'ZAR' ||
selected_coin == 'PLN' ||
selected_coin == 'NOK' ||
selected_coin == 'SEK' ||
selected_coin == 'DKK' ||
selected_coin == 'CZK' ||
selected_coin == 'HUF' ||
selected_coin == 'ILS' ||
selected_coin == 'KRW' ||
selected_coin == 'MYR' ||
selected_coin == 'PHP' ||
selected_coin == 'SGD' ||
selected_coin == 'THB' ||
selected_coin == 'BGN' ||
selected_coin == 'IDR' ||
selected_coin == 'HRK') {
if (checkAC(selected_coin)) {
sessionStorage.setItem('edexTmpMode', selected_coinmode);
sessionStorage.setItem('edexTmpRefresh', 'start');
assetchain_pax_menu_actions(selected_coin);

Loading…
Cancel
Save