Browse Source

split dashboard.js

master
Petr Balashov 8 years ago
parent
commit
f76c1ab6e0
  1. 1848
      assets/scripts/dashboard.js
  2. 148
      assets/scripts/dashboard/DashboardBasilisk.js
  3. 152
      assets/scripts/dashboard/DashboardCoinFiat.js
  4. 268
      assets/scripts/dashboard/DashboardDEX.js
  5. 423
      assets/scripts/dashboard/DashboardEDEX.js
  6. 4
      index.html

1848
assets/scripts/dashboard.js

File diff suppressed because it is too large

148
assets/scripts/dashboard/DashboardBasilisk.js

@ -1,72 +1,5 @@
function SwitchBasicliskFull(switch_data) {
var relay_value = '',
validate_value = '',
mode_value = '';
if ( switch_data.modecode == 'B' ) {
relay_value = 1;
validate_value = 1;
mode_value = 'Basilisk';
}
if ( switch_data.modecode == 'F' ) {
relay_value = 0;
validate_value = 0;
mode_value = 'Full';
}
var tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'),
SwitchCoinModeData = {
'userpass': tmpIguanaRPCAuth,
'poll': 100,
'immediate':100,
'active': 1,
'newcoin': switch_data.currency,
'startpend': 1,
'endpend': 1,
'services': 128,
'maxpeers': 16,
'RELAY': relay_value,
'VALIDATE': validate_value,
'portp2p': 14631
};
// Switch selected coins' mode
$.ajax({
type: 'GET',
data: SwitchCoinModeData,
url: 'http://127.0.0.1:7778/api/iguana/addcoin',
dataType: 'text',
success: function(data, textStatus, jqXHR) {
var SwitchCoinDataOutput = JSON.parse(data);
if (SwitchCoinDataOutput.result === 'coin added') {
console.log('coin added');
toastr.success(switch_data.currency + ' switched to ' + mode_value + ' Mode', 'Coin Notification');
} else if (SwitchCoinDataOutput.result === 'coin already there') {
console.log('coin already there');
//toastr.info("Looks like" + switch_data.currency + "already running.", "Coin Notification");
} else if (SwitchCoinDataOutput.result === null) {
console.log('coin already there');
//toastr.info("Looks like" + switch_data.currency + "already running.", "Coin Notification");
}
},
error: function(xhr, textStatus, error) {
console.log('failed starting BitcoinDark.');
console.log(xhr.statusText);
if ( xhr.readyState == 0 ) {
Iguana_ServiceUnavailable();
}
console.log(textStatus);
console.log(error);
if (xhr.readyState == '0' ) {
toastr.error('Unable to connect to Iguana', 'Account Notification');
}
}
});
}
function ShowBasiliskFetchDataProgress(coin) {
var active_edexcoinmodecode = sessionStorage.getItem('edexTmpMode');
var active_edexcoinmodecode = sessionStorage.getItem('edexTmpMode')
Shepherd_GetBasiliskCache().then(function(result){
var _data = JSON.parse(result)
@ -236,7 +169,7 @@ function ShowBasiliskFetchDataProgress(coin) {
BasiliskFetchData += '</tr>';
$('.tbl_edexcoin_dashboard_basilisk_refresh_status tbody').html(BasiliskFetchData);
if (result[result.length-1] == result_val && result_val.listtransactions_status !== 'done' && result_val.getbalance_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()
@ -245,5 +178,82 @@ function ShowBasiliskFetchDataProgress(coin) {
})
}
})
}
function SwitchBasicliskFull(switch_data) {
var relay_value = '',
validate_value = '',
mode_value = '';
if ( switch_data.modecode == 'B' ) {
relay_value = 1;
validate_value = 1;
mode_value = 'Basilisk';
}
if ( switch_data.modecode == 'F' ) {
relay_value = 0;
validate_value = 0;
mode_value = 'Full';
}
var tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'),
SwitchCoinModeData = {
'userpass': tmpIguanaRPCAuth,
'poll': 100,
'immediate':100,
'active': 1,
'newcoin': switch_data.currency,
'startpend': 1,
'endpend': 1,
'services': 128,
'maxpeers': 16,
'RELAY': relay_value,
'VALIDATE': validate_value,
'portp2p': 14631
};
// Switch selected coins' mode
$.ajax({
type: 'GET',
data: SwitchCoinModeData,
url: 'http://127.0.0.1:7778/api/iguana/addcoin',
dataType: 'text',
success: function(data, textStatus, jqXHR) {
var SwitchCoinDataOutput = JSON.parse(data);
if (SwitchCoinDataOutput.result === 'coin added') {
console.log('coin added');
toastr.success(switch_data.currency + ' switched to ' + mode_value + ' Mode', 'Coin Notification');
} else if (SwitchCoinDataOutput.result === 'coin already there') {
console.log('coin already there');
//toastr.info("Looks like" + switch_data.currency + "already running.", "Coin Notification");
} else if (SwitchCoinDataOutput.result === null) {
console.log('coin already there');
//toastr.info("Looks like" + switch_data.currency + "already running.", "Coin Notification");
}
},
error: function(xhr, textStatus, error) {
console.log('failed starting BitcoinDark.');
console.log(xhr.statusText);
if ( xhr.readyState == 0 ) {
Iguana_ServiceUnavailable();
}
console.log(textStatus);
console.log(error);
if (xhr.readyState == '0' ) {
toastr.error('Unable to connect to Iguana', 'Account Notification');
}
}
});
}
function getBasiliskCoinBalance(coin) {
EDEXMainAddr(coin).then(function(result){
console.log(result)
EDEX_DEXlistunspent(coin, result).then(function(result_listunspent) {
console.log(result_listunspent[0].amount);
$('span[data-edexcoincode="' + coin + '"][id="edexcoin-balance"]').text(result_listunspent[0].amount);
});
})
}

152
assets/scripts/dashboard/DashboardCoinFiat.js

@ -30,92 +30,11 @@ function getCoinBalance(coin) {
});
}
function getBasiliskCoinBalance(coin) {
EDEXMainAddr(coin).then(function(result){
console.log(result)
EDEX_DEXlistunspent(coin, result).then(function(result_listunspent) {
console.log(result_listunspent[0].amount);
$('span[data-edexcoincode="' + coin + '"][id="edexcoin-balance"]').text(result_listunspent[0].amount);
});
})
}
function StopShowCoinHistory() {
clearInterval(ExecuteShowCoinHistory);
console.log('Stopped executing History and ProgressBar API.');
}
function ShowCoinProgressBar(coin) {
var tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth');
getinfoValues = {
'userpass': tmpIguanaRPCAuth,
'coin': coin,
'agent': 'bitcoinrpc',
'method': 'getinfo',
'immediate': 100,
'timeout': 4000
};
$.ajax({
type: 'POST',
data: JSON.stringify(getinfoValues),
url: 'http://127.0.0.1:7778',
success: function(data, textStatus, jqXHR) {
var CoinInfoData = JSON.parse(data);
// TODO: refactor
if (typeof CoinInfoData.bundles == 'undefined') {
//console.log(coin+' is undefined');
} else {
if ( parseInt(CoinInfoData.RTheight) != 0 ) {
var coin_blocks = parseInt(CoinInfoData.blocks),
coin_blocks_plus1 = coin_blocks + 1;
sessionStorage.setItem('Activate' + coin + 'History', 'Yes');
$('div[data-edexcoin="'+coin+'"][id="currency-progressbars"]').show();
$('div[data-edexcoin="'+coin+'"][id="currency-bundles"]').width(parseFloat(CoinInfoData.bundles).toFixed(2) + '%');
$('span[data-edexcoin="'+coin+'"][id="currency-bundles-percent"]').text('(' + coin + ') ' + parseFloat(CoinInfoData.bundles).toFixed(2) + '% - ( ' + coin_blocks_plus1 + ' / '+ CoinInfoData.longestchain + ' ) ==>> RT' + CoinInfoData.RTheight);
$('div[data-edexcoin="'+coin+'"][id="additional-progress-bars"]').hide();
$('div[data-edexcoin="'+coin+'"][id="currency-bundles"]').removeClass( 'progress-bar-info' ).addClass( 'progress-bar-indicating progress-bar-success' );
$('#edex-footer').css('height', '11px');
resizeDashboardWindow();
$('#edexcoin-wallet-waitingrt-alert').hide();
}
if ( parseInt(CoinInfoData.RTheight) == 0 ) {
var coin_blocks = parseInt(CoinInfoData.blocks),
coin_blocks_plus1 = coin_blocks + 1;
sessionStorage.setItem('Activate' + coin + 'History', 'No');
console.log(coin + ': ' + CoinInfoData.bundles);
$('div[data-edexcoin="' + coin + '"][id="additional-progress-bars"]').show();
$('div[data-edexcoin="' + coin + '"][id="currency-progressbars"]').show();
$('div[data-edexcoin="' + coin + '"][id="currency-bundles"]').removeClass( 'progress-bar-indicating progress-bar-success' ).addClass( 'progress-bar-info' );
$('div[data-edexcoin="' + coin + '"][id="currency-bundles"]').width(parseFloat(CoinInfoData.bundles).toFixed(2) + '%');
$('span[data-edexcoin="' + coin + '"][id="currency-bundles-percent"]').text('(' + coin + ') ' + parseFloat(CoinInfoData.bundles).toFixed(2) + '% - ( ' + coin_blocks_plus1 + ' / ' + CoinInfoData.longestchain + ' )');
$('div[data-edexcoin="' + coin + '"][id="currency-utxo"]').width(parseFloat(CoinInfoData.utxo).toFixed(2) + '%');
$('span[data-edexcoin="' + coin + '"][id="currency-utxo-percent"]').text('(' + coin + ') ' + parseFloat(CoinInfoData.utxo).toFixed(2) + '%');
$('div[data-edexcoin="' + coin + '"][id="currency-balances"]').width(parseFloat(CoinInfoData.balances).toFixed(2) + '%');
$('span[data-edexcoin="' + coin + '"][id="currency-balances-percent"]').text('(' + coin + ') '+parseFloat(CoinInfoData.balances).toFixed(2) + '%');
$('div[data-edexcoin="' + coin + '"][id="currency-validated"]').width(parseFloat(CoinInfoData.validated).toFixed(2) + '%');
$('span[data-edexcoin="' + coin + '"][id="currency-validated-percent"]').text('(' + coin + ') '+parseFloat(CoinInfoData.validated).toFixed(2) + '%');
$('#edex-footer').css('height', '44px');
resizeDashboardWindow();
$('#edexcoin-wallet-waitingrt-alert').show();
}
}
},
error: function(xhr, textStatus, error) {
console.log('failed getting Coin History.');
console.log(xhr.statusText);
if ( xhr.readyState == 0 ) {
Iguana_ServiceUnavailable();
}
console.log(textStatus);
console.log(error);
}
});
}
function TotalFiatValue() {
var BTC_balance = $('span[data-currency="BTC"][id="currency-balance"]').text(),
BTCD_balance = $('span[data-currency="BTCD"][id="currency-balance"]').text(),
@ -194,4 +113,75 @@ function TotalFiatValue() {
function StopTotalFiatValue() {
clearInterval(RunTotalFiatValue);
console.log('Stopped executing Total Fiat Value API with Rates');
}
function ShowCoinProgressBar(coin) {
var tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth');
getinfoValues = {
'userpass': tmpIguanaRPCAuth,
'coin': coin,
'agent': 'bitcoinrpc',
'method': 'getinfo',
'immediate': 100,
'timeout': 4000
};
$.ajax({
type: 'POST',
data: JSON.stringify(getinfoValues),
url: 'http://127.0.0.1:7778',
success: function(data, textStatus, jqXHR) {
var CoinInfoData = JSON.parse(data);
// TODO: refactor
if (typeof CoinInfoData.bundles == 'undefined') {
//console.log(coin+' is undefined');
} else {
if ( parseInt(CoinInfoData.RTheight) != 0 ) {
var coin_blocks = parseInt(CoinInfoData.blocks),
coin_blocks_plus1 = coin_blocks + 1;
sessionStorage.setItem('Activate' + coin + 'History', 'Yes');
$('div[data-edexcoin="'+coin+'"][id="currency-progressbars"]').show();
$('div[data-edexcoin="'+coin+'"][id="currency-bundles"]').width(parseFloat(CoinInfoData.bundles).toFixed(2) + '%');
$('span[data-edexcoin="'+coin+'"][id="currency-bundles-percent"]').text('(' + coin + ') ' + parseFloat(CoinInfoData.bundles).toFixed(2) + '% - ( ' + coin_blocks_plus1 + ' / '+ CoinInfoData.longestchain + ' ) ==>> RT' + CoinInfoData.RTheight);
$('div[data-edexcoin="'+coin+'"][id="additional-progress-bars"]').hide();
$('div[data-edexcoin="'+coin+'"][id="currency-bundles"]').removeClass( 'progress-bar-info' ).addClass( 'progress-bar-indicating progress-bar-success' );
$('#edex-footer').css('height', '11px');
resizeDashboardWindow();
$('#edexcoin-wallet-waitingrt-alert').hide();
}
if ( parseInt(CoinInfoData.RTheight) == 0 ) {
var coin_blocks = parseInt(CoinInfoData.blocks),
coin_blocks_plus1 = coin_blocks + 1;
sessionStorage.setItem('Activate' + coin + 'History', 'No');
console.log(coin + ': ' + CoinInfoData.bundles);
$('div[data-edexcoin="' + coin + '"][id="additional-progress-bars"]').show();
$('div[data-edexcoin="' + coin + '"][id="currency-progressbars"]').show();
$('div[data-edexcoin="' + coin + '"][id="currency-bundles"]').removeClass( 'progress-bar-indicating progress-bar-success' ).addClass( 'progress-bar-info' );
$('div[data-edexcoin="' + coin + '"][id="currency-bundles"]').width(parseFloat(CoinInfoData.bundles).toFixed(2) + '%');
$('span[data-edexcoin="' + coin + '"][id="currency-bundles-percent"]').text('(' + coin + ') ' + parseFloat(CoinInfoData.bundles).toFixed(2) + '% - ( ' + coin_blocks_plus1 + ' / ' + CoinInfoData.longestchain + ' )');
$('div[data-edexcoin="' + coin + '"][id="currency-utxo"]').width(parseFloat(CoinInfoData.utxo).toFixed(2) + '%');
$('span[data-edexcoin="' + coin + '"][id="currency-utxo-percent"]').text('(' + coin + ') ' + parseFloat(CoinInfoData.utxo).toFixed(2) + '%');
$('div[data-edexcoin="' + coin + '"][id="currency-balances"]').width(parseFloat(CoinInfoData.balances).toFixed(2) + '%');
$('span[data-edexcoin="' + coin + '"][id="currency-balances-percent"]').text('(' + coin + ') '+parseFloat(CoinInfoData.balances).toFixed(2) + '%');
$('div[data-edexcoin="' + coin + '"][id="currency-validated"]').width(parseFloat(CoinInfoData.validated).toFixed(2) + '%');
$('span[data-edexcoin="' + coin + '"][id="currency-validated-percent"]').text('(' + coin + ') '+parseFloat(CoinInfoData.validated).toFixed(2) + '%');
$('#edex-footer').css('height', '44px');
resizeDashboardWindow();
$('#edexcoin-wallet-waitingrt-alert').show();
}
}
},
error: function(xhr, textStatus, error) {
console.log('failed getting Coin History.');
console.log(xhr.statusText);
if ( xhr.readyState == 0 ) {
Iguana_ServiceUnavailable();
}
console.log(textStatus);
console.log(error);
}
});
}

268
assets/scripts/dashboard/DashboardDEX.js

@ -1,269 +1,3 @@
function edexCoinBtnAction() {
$('.edexcoin-logo').click(function() {
$( '#edexcoin_send_coins_back_btn' ).trigger( 'click' );
$('#btn_edexcoin_dashboard').hide();
$('#btn_edexcoin_send').show();
$('#btn_edexcoin_recieve').show();
var selected_coin = $(this).data('edexcoincode'),
selected_coinmode = $(this).data('edexcoinmodecode'),
selected_coinname = $(this).data('edexcoinname');
$('#edexcoin_getbalance_interest').hide();
$('#edexcoin_getbalance_total_interest').hide();
$('#edexcoin_getbalance_t').removeClass( 'col-lg-4' ).addClass( 'col-lg-12' );
$('#edex_interest_balance').text('-');
$('#edex_total_balance_interest').text('-');
$('#edex_total_balance').text('-');
$('#edex_total_balance_coincode').text(selected_coin);
sessionStorage.setItem('edexTmpMode', selected_coinmode);
resizeDashboardWindow();
if ( selected_coinmode == 'Basilisk' ) {
$('#edex-footer').hide();
$('#btn_edexcoin_basilisk').show();
$('#edexcoin-wallet-waitingrt-alert').hide();
sessionStorage.setItem('edexTmpRefresh', 'start');
}
if ( selected_coinmode == 'Full' ) {
$('#edex-footer').show();
$('#btn_edexcoin_basilisk').hide();
sessionStorage.setItem('edexTmpRefresh', 'start');
}
if ( selected_coinmode !== 'Native' ) {
$('#edexcoin_dashoard_section').show();
$('#header-dashboard').show();
$('#wallet-widgets').show();
$('#edexcoin_dashboardinfo').show();
$('#no_wallet_selected').hide();
$('#edexcoin_send').hide();
$('#edexcoin_recieve_section').hide();
$('#edexcoin_settings').hide();
$('#currency-progressbars').show();
// get selected coin's code and populate in easydex wallet widget's html elements
var coincode = $(this).data('edexcoincode');
$.each($('[data-edexcoin]'), function(index, value) {
$('[data-edexcoin]').attr('data-edexcoin', coincode);
$('[data-edexcoin="' + coincode + '"]');
});
$.each($('[data-edexcoinmenu]'), function(index, value) {
$('[data-edexcoinmenu]').attr('data-edexcoinmenu', coincode);
$('[data-edexcoinmenu="' + coincode + '"]');
});
$('#edexcoin-active').text(selected_coinname);
$('#edex_total_balance_coincode').text(coincode);
// populate selected coin's address
EDEXMainAddr(selected_coin).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('Address Copied.');
});
var clipboard = new Clipboard('.clipboard-edexaddr');
clipboard.destroy();
var clipboard = null;
if ( clipboard != null ) {
clipboard.destroy();
}
var clipboard = new Clipboard('.clipboard-edexaddr');
clipboard.on('success', function(e) {
console.info('Action: ', e.action);
console.info('Text: ', e.text);
console.info('Trigger: ', e.trigger);
e.clearSelection();
});
clipboard.on('error', function(e) {
console.error('Action: ', e.action);
console.error('Trigger: ', e.trigger);
});
// populate selected coin's balance
if ( selected_coinmode == 'Basilisk' &&
selected_coin !== 'BTC' &&
selected_coin !== 'BTCD' &&
selected_coin !== 'LTC' &&
selected_coin !== 'DOGE' &&
selected_coin !== 'DGB' &&
selected_coin !== 'SYS' &&
selected_coin !== 'MZC' &&
selected_coin !== 'UNO' &&
selected_coin !== 'ZET' &&
selected_coin !== 'BTM' &&
selected_coin !== 'CARB' &&
selected_coin !== 'ANC' &&
selected_coin !== 'FRK') {
getDEXGetBalance_cache(selected_coin).then(function(result) {
if ( result.interest !== undefined && selected_coin == 'KMD') {
$('#edexcoin_getbalance_interest').show();
$('#edexcoin_getbalance_total_interest').show();
$('#edexcoin_getbalance_t').removeClass( 'col-lg-12' ).addClass( 'col-lg-4' );
$('#edex_interest_balance').text(result.interest);
$('#edex_total_balance_interest').text(result.totalbalance);
$('#edex_total_interest_coincode').text(selected_coin);
$('#edex_total_balance_interest_coincode').text(selected_coin);
}
if ( result.interest === undefined || selected_coin !== 'KMD') {
$('#edexcoin_getbalance_interest').hide();
$('#edexcoin_getbalance_total_interest').hide();
$('#edexcoin_getbalance_t').removeClass( 'col-lg-4' ).addClass( 'col-lg-12' );
$('#edex_interest_balance').text('-');
$('#edex_total_balance_interest').text('-');
}
$('#edex_total_balance').text(result.total);
$('#edex_total_balance_coincode').text(selected_coin);
});
} else if (selected_coinmode == 'Basilisk') {
getDEXGetBalance2(selected_coin).then(function(result) {
if ( result.interest !== undefined ) {
$('#edexcoin_getbalance_interest').show();
$('#edexcoin_getbalance_total_interest').show();
$('#edexcoin_getbalance_t').removeClass( 'col-lg-12' ).addClass( 'col-lg-4' );
$('#edex_interest_balance').text(result.interest);
$('#edex_total_balance_interest').text(result.totalbalance);
$('#edex_total_interest_coincode').text(selected_coin);
$('#edex_total_balance_interest_coincode').text(selected_coin);
}
if ( result.interest === undefined || selected_coin !== 'KMD') {
$('#edexcoin_getbalance_interest').hide();
$('#edexcoin_getbalance_total_interest').hide();
$('#edexcoin_getbalance_t').removeClass( 'col-lg-4' ).addClass( 'col-lg-12' );
$('#edex_interest_balance').text('-');
$('#edex_total_balance_interest').text('-');
}
$('#edex_total_balance').text(result.total);
$('#edex_total_balance_coincode').text(selected_coin);
});
} else {
EDEXlistunspent(selected_coin).then(function(result) {
if (result[0] != undefined) {
if ( result[0].interest !== undefined ) {
$('#edexcoin_getbalance_interest').show();
$('#edexcoin_getbalance_total_interest').show();
$('#edexcoin_getbalance_t').removeClass( 'col-lg-12' ).addClass( 'col-lg-4' );
$('#edex_interest_balance').text(result[0].interest);
$('#edex_total_balance_interest').text(result[0].totalbalance);
$('#edex_total_interest_coincode').text(selected_coin);
$('#edex_total_balance_interest_coincode').text(selected_coin);
}
if ( result[0].interest === undefined ) {
$('#edexcoin_getbalance_interest').hide();
$('#edexcoin_getbalance_total_interest').hide();
$('#edexcoin_getbalance_t').removeClass( 'col-lg-4' ).addClass( 'col-lg-12' );
$('#edex_interest_balance').text('-');
$('#edex_total_balance_interest').text('-');
}
$('#edex_total_balance').text(result[0].total);
$('#edex_total_balance_coincode').text(selected_coin);
} else {
$('#edex_total_balance').text('0');
}
});
}
EdexfillTxHistory(coincode);
} else {
$('#currency-progressbars').hide();
if ( selected_coin == 'KMD' ) {
sessionStorage.setItem('edexTmpMode', selected_coinmode);
sessionStorage.setItem('edexTmpRefresh', 'start');
$( '#nav-komodo-wallet' ).trigger( 'click' );
}
if ( selected_coin == 'ZEC' ) {
sessionStorage.setItem('edexTmpMode', selected_coinmode);
sessionStorage.setItem('edexTmpRefresh', 'start');
$( '#nav-zcash-wallet' ).trigger( 'click' );
}
}
});
}
function getActiveEdexcoin() {
var active_edexcoin = $('[data-edexcoin]').attr('data-edexcoin');
return active_edexcoin;
}
function EdexfillTxHistory(coin) {
$('#edexcoin_txhistory').data('panel-api').load();
NProgress.done(true);
NProgress.configure({
template: '<div class="bar nprogress-bar-header nprogress-bar-info" role="bar"></div>' +
'<div class="spinner" role="spinner">' +
'<div class="spinner-icon"></div>' +
'</div>'
});
NProgress.start();
var active_edexcoinmodecode = sessionStorage.getItem('edexTmpMode');
if ( active_edexcoinmodecode === 'Basilisk' ) {
EdexGetTxList_cache(coin).then(function(result) {
var edex_txhistory_table = '';
edex_txhistory_table = $('#edex-tx-history-tbl').DataTable({
data: result,
'order': [
[ 3, 'desc' ]
],
select: true,
retrieve: true
});
edex_txhistory_table.destroy();
edex_txhistory_table = $('#edex-tx-history-tbl').DataTable({
data: result,
'order': [
[ 3, 'desc' ]
],
select: true,
retrieve: true
});
$('#edexcoin_txhistory').data('panel-api').done();
$('.panel-loading').remove();
});
}
if ( active_edexcoinmodecode === 'Full' ) {
EdexGetTxList(coin).then(function(result){
var edex_txhistory_table = '';
edex_txhistory_table = $('#edex-tx-history-tbl').DataTable({
data: result,
'order': [
[ 3, 'desc' ]
],
select: true,
retrieve: true
});
edex_txhistory_table.destroy();
edex_txhistory_table = $('#edex-tx-history-tbl').DataTable({
data: result,
'order': [
[ 3, 'desc' ]
],
select: true,
retrieve: true
});
$('#edexcoin_txhistory').data('panel-api').done();
$('.panel-loading').remove();
});
}
}
function getDEXCoinBalance(coin) {
getDEXGetBalance_cache(coin).then(function(result) {
console.log(result)
@ -363,7 +97,7 @@ function getDEXGetBalance_cache(coin) {
var call_data = {
'allcoins': false,
'coin': coin,
'calls': 'listtransactions:getbalance'
'calls': 'listtransactions:getbalance:refresh'
};
//console.log(call_data)
Shepherd_FetchBasiliskData(call_data).then(function(result) {

423
assets/scripts/dashboard/DashboardEDEX.js

@ -56,7 +56,7 @@ function EdexGetTxList(coin) {
params = {
'userpass': tmpIguanaRPCAuth,
'agent': 'dex',
'method': 'listtransactions2',
'method': 'listtransactions',
'address': coinaddr_value,
'count': 100,
'skip': 0,
@ -186,10 +186,10 @@ function EdexGetTxList(coin) {
var tmp_secondsToString = secondsToString(result_data[index].timestamp);
if ( result_data[index].type == 'sent' ) {
tmp_category = '<i class="icon fa-arrow-circle-left"></i> OUT';
tmp_category = '<span class="label label-danger"><i class="icon fa-arrow-circle-left"></i> OUT</span>';
}
if ( result_data[index].type == 'received' ) {
tmp_category = '<i class="icon fa-arrow-circle-right"></i> IN';
tmp_category = '<span class="label label-success"><i class="icon fa-arrow-circle-right"></i> IN</span>';
}
if ( result_data[index].type == 'generate' ) {
tmp_category = '<i class="icon fa-cogs"></i> Mined';
@ -278,10 +278,10 @@ function EdexGetTxList_cache(coin) {
var tmp_secondsToString = secondsToString(result_data[index].timestamp);
if ( result_data[index].type == 'sent' ) {
tmp_category = '<i class="icon fa-arrow-circle-left"></i> OUT';
tmp_category = '<span class="label label-danger"><i class="icon fa-arrow-circle-left"></i> OUT</span>';
}
if ( result_data[index].type == 'received' ) {
tmp_category = '<i class="icon fa-arrow-circle-right"></i> IN';
tmp_category = '<span class="label label-success"><i class="icon fa-arrow-circle-right"></i> IN</span>';
}
if ( result_data[index].type == 'generate' ) {
tmp_category = '<i class="icon fa-cogs"></i> Mined';
@ -355,7 +355,7 @@ function EdexGetTxList_cache(coin) {
|| coin == 'FRK') {
var ajax_data_2 = {'userpass':tmpIguanaRPCAuth,"agent":"dex","method":"listtransactions","address":data[coin],"count":100,"skip":0,"symbol":coin}
} else {
var ajax_data_2 = {'userpass':tmpIguanaRPCAuth,"agent":"dex","method":"listtransactions2","address":data[coin],"count":100,"skip":0,"symbol":coin}
var ajax_data_2 = {'userpass':tmpIguanaRPCAuth,"agent":"dex","method":"listtransactions","address":data[coin],"count":100,"skip":0,"symbol":coin}
}
} else {
var ajax_data_2 = {'userpass':tmpIguanaRPCAuth,"coin":coin,"method":"listtransactions","params":[0, 9999999, []]}
@ -540,44 +540,129 @@ function EdexListAllAddr(coin) {
});
NProgress.start();
EDEXgetaddrbyaccount(coin).then(function(result) {
console.log(result);
var only_reciving_addr_data = [];
active_edexcoinmodecode = sessionStorage.getItem('edexTmpMode');
$.each(result, function(index, value) {
if (value.interest == undefined || coin !== 'KMD') {
console.log('interest is undefined');
tmp_interest = 'NA';
} else {
tmp_interest = value.interest;
}
only_reciving_addr_data.push([
value.label,
value.addr,
value.total,
tmp_interest
]);
});
console.log(only_reciving_addr_data);
if (active_edexcoinmodecode == 'Basilisk' && coin !== 'BTC' && coin !== 'SYS') {
EDEXgetaddrbyaccount_cache(coin).then(function(result) {
console.log(result);
var only_reciving_addr_data = [];
$.each(result, function(index, value) {
if (value.interest == undefined || coin !== 'KMD') {
console.log('interest is undefined');
tmp_interest = 'NA';
} else {
tmp_interest = value.interest;
}
only_reciving_addr_data.push([
value.label,
value.addr,
value.total,
tmp_interest
]);
});
console.log(only_reciving_addr_data);
var edexcoin_recieve_table = '';
var edexcoin_recieve_table = '';
edexcoin_recieve_table = $('#edexcoin-recieve-addr-tbl').DataTable({
data: only_reciving_addr_data,
select: false,
retrieve: true
edexcoin_recieve_table = $('#edexcoin-recieve-addr-tbl').DataTable({
data: only_reciving_addr_data,
select: false,
retrieve: true
});
edexcoin_recieve_table.destroy();
edexcoin_recieve_table = $('#edexcoin-recieve-addr-tbl').DataTable({
data: only_reciving_addr_data,
select: false,
retrieve: true
});
NProgress.done();
});
} else if (active_edexcoinmodecode == 'Basilisk' ) {
EDEXgetaddrbyaccount(coin).then(function(result){
console.log(result);
var only_reciving_addr_data = [];
$.each(result, function(index, value) {
if (value.interest == undefined || coin !== 'KMD') {
console.log('interest is undefined');
tmp_interest = 'NA';
} else {
tmp_interest = value.interest;
}
only_reciving_addr_data.push([
value.label,
value.addr,
value.total,
tmp_interest
]);
});
console.log(only_reciving_addr_data);
var edexcoin_recieve_table = '';
edexcoin_recieve_table = $('#edexcoin-recieve-addr-tbl').DataTable({
data: only_reciving_addr_data,
select: false,
retrieve: true
});
edexcoin_recieve_table.destroy();
edexcoin_recieve_table.destroy();
edexcoin_recieve_table = $('#edexcoin-recieve-addr-tbl').DataTable({
data: only_reciving_addr_data,
select: false,
retrieve: true
});
edexcoin_recieve_table = $('#edexcoin-recieve-addr-tbl').DataTable({
data: only_reciving_addr_data,
select: false,
retrieve: true
NProgress.done();
});
}
NProgress.done();
});
if (active_edexcoinmodecode == 'Full') {
EDEXgetaddrbyaccount(coin).then(function(result) {
console.log(result);
var only_reciving_addr_data = [];
$.each(result, function(index, value) {
if (value.interest == undefined || coin !== 'KMD') {
console.log('interest is undefined');
tmp_interest = 'NA';
} else {
tmp_interest = value.interest;
}
only_reciving_addr_data.push([
value.label,
value.addr,
value.total,
tmp_interest
]);
});
console.log(only_reciving_addr_data);
var edexcoin_recieve_table = '';
edexcoin_recieve_table = $('#edexcoin-recieve-addr-tbl').DataTable({
data: only_reciving_addr_data,
select: false,
retrieve: true
});
edexcoin_recieve_table.destroy();
edexcoin_recieve_table = $('#edexcoin-recieve-addr-tbl').DataTable({
data: only_reciving_addr_data,
select: false,
retrieve: true
});
NProgress.done();
});
}
}
function refreshEDEXCoinWalletList() {
@ -772,4 +857,270 @@ function refreshEDEXCoinWalletList() {
}
});
});
}
function edexCoinBtnAction() {
$('.edexcoin-logo').click(function() {
$( '#edexcoin_send_coins_back_btn' ).trigger( 'click' );
$('#btn_edexcoin_dashboard').hide();
$('#btn_edexcoin_send').show();
$('#btn_edexcoin_recieve').show();
var selected_coin = $(this).data('edexcoincode'),
selected_coinmode = $(this).data('edexcoinmodecode'),
selected_coinname = $(this).data('edexcoinname');
$('#edexcoin_getbalance_interest').hide();
$('#edexcoin_getbalance_total_interest').hide();
$('#edexcoin_getbalance_t').removeClass( 'col-lg-4' ).addClass( 'col-lg-12' );
$('#edex_interest_balance').text('-');
$('#edex_total_balance_interest').text('-');
$('#edex_total_balance').text('-');
$('#edex_total_balance_coincode').text(selected_coin);
sessionStorage.setItem('edexTmpMode', selected_coinmode);
resizeDashboardWindow();
if ( selected_coinmode == 'Basilisk' ) {
$('#edex-footer').hide();
$('#btn_edexcoin_basilisk').show();
$('#edexcoin-wallet-waitingrt-alert').hide();
sessionStorage.setItem('edexTmpRefresh', 'start');
}
if ( selected_coinmode == 'Full' ) {
$('#edex-footer').show();
$('#btn_edexcoin_basilisk').hide();
sessionStorage.setItem('edexTmpRefresh', 'start');
}
if ( selected_coinmode !== 'Native' ) {
$('#edexcoin_dashoard_section').show();
$('#header-dashboard').show();
$('#wallet-widgets').show();
$('#edexcoin_dashboardinfo').show();
$('#no_wallet_selected').hide();
$('#edexcoin_send').hide();
$('#edexcoin_recieve_section').hide();
$('#edexcoin_settings').hide();
$('#currency-progressbars').show();
// get selected coin's code and populate in easydex wallet widget's html elements
var coincode = $(this).data('edexcoincode');
$.each($('[data-edexcoin]'), function(index, value) {
$('[data-edexcoin]').attr('data-edexcoin', coincode);
$('[data-edexcoin="' + coincode + '"]');
});
$.each($('[data-edexcoinmenu]'), function(index, value) {
$('[data-edexcoinmenu]').attr('data-edexcoinmenu', coincode);
$('[data-edexcoinmenu="' + coincode + '"]');
});
$('#edexcoin-active').text(selected_coinname);
$('#edex_total_balance_coincode').text(coincode);
// populate selected coin's address
EDEXMainAddr(selected_coin).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('Address Copied.');
});
var clipboard = new Clipboard('.clipboard-edexaddr');
clipboard.destroy();
var clipboard = null;
if ( clipboard != null ) {
clipboard.destroy();
}
var clipboard = new Clipboard('.clipboard-edexaddr');
clipboard.on('success', function(e) {
console.info('Action: ', e.action);
console.info('Text: ', e.text);
console.info('Trigger: ', e.trigger);
e.clearSelection();
});
clipboard.on('error', function(e) {
console.error('Action: ', e.action);
console.error('Trigger: ', e.trigger);
});
// populate selected coin's balance
if ( selected_coinmode == 'Basilisk' &&
selected_coin !== 'BTC' &&
selected_coin !== 'BTCD' &&
selected_coin !== 'LTC' &&
selected_coin !== 'DOGE' &&
selected_coin !== 'DGB' &&
selected_coin !== 'SYS' &&
selected_coin !== 'MZC' &&
selected_coin !== 'UNO' &&
selected_coin !== 'ZET' &&
selected_coin !== 'BTM' &&
selected_coin !== 'CARB' &&
selected_coin !== 'ANC' &&
selected_coin !== 'FRK') {
getDEXGetBalance_cache(selected_coin).then(function(result) {
if ( result.interest !== undefined && selected_coin == 'KMD') {
$('#edexcoin_getbalance_interest').show();
$('#edexcoin_getbalance_total_interest').show();
$('#edexcoin_getbalance_t').removeClass( 'col-lg-12' ).addClass( 'col-lg-4' );
$('#edex_interest_balance').text(result.interest);
$('#edex_total_balance_interest').text(result.totalbalance);
$('#edex_total_interest_coincode').text(selected_coin);
$('#edex_total_balance_interest_coincode').text(selected_coin);
}
if ( result.interest === undefined || selected_coin !== 'KMD') {
$('#edexcoin_getbalance_interest').hide();
$('#edexcoin_getbalance_total_interest').hide();
$('#edexcoin_getbalance_t').removeClass( 'col-lg-4' ).addClass( 'col-lg-12' );
$('#edex_interest_balance').text('-');
$('#edex_total_balance_interest').text('-');
}
$('#edex_total_balance').text(result.total);
$('#edex_total_balance_coincode').text(selected_coin);
});
} else if (selected_coinmode == 'Basilisk') {
getDEXGetBalance2(selected_coin).then(function(result) {
if ( result.interest !== undefined ) {
$('#edexcoin_getbalance_interest').show();
$('#edexcoin_getbalance_total_interest').show();
$('#edexcoin_getbalance_t').removeClass( 'col-lg-12' ).addClass( 'col-lg-4' );
$('#edex_interest_balance').text(result.interest);
$('#edex_total_balance_interest').text(result.totalbalance);
$('#edex_total_interest_coincode').text(selected_coin);
$('#edex_total_balance_interest_coincode').text(selected_coin);
}
if ( result.interest === undefined || selected_coin !== 'KMD') {
$('#edexcoin_getbalance_interest').hide();
$('#edexcoin_getbalance_total_interest').hide();
$('#edexcoin_getbalance_t').removeClass( 'col-lg-4' ).addClass( 'col-lg-12' );
$('#edex_interest_balance').text('-');
$('#edex_total_balance_interest').text('-');
}
$('#edex_total_balance').text(result.total);
$('#edex_total_balance_coincode').text(selected_coin);
});
} else {
EDEXlistunspent(selected_coin).then(function(result) {
if (result[0] != undefined) {
if ( result[0].interest !== undefined ) {
$('#edexcoin_getbalance_interest').show();
$('#edexcoin_getbalance_total_interest').show();
$('#edexcoin_getbalance_t').removeClass( 'col-lg-12' ).addClass( 'col-lg-4' );
$('#edex_interest_balance').text(result[0].interest);
$('#edex_total_balance_interest').text(result[0].totalbalance);
$('#edex_total_interest_coincode').text(selected_coin);
$('#edex_total_balance_interest_coincode').text(selected_coin);
}
if ( result[0].interest === undefined ) {
$('#edexcoin_getbalance_interest').hide();
$('#edexcoin_getbalance_total_interest').hide();
$('#edexcoin_getbalance_t').removeClass( 'col-lg-4' ).addClass( 'col-lg-12' );
$('#edex_interest_balance').text('-');
$('#edex_total_balance_interest').text('-');
}
$('#edex_total_balance').text(result[0].total);
$('#edex_total_balance_coincode').text(selected_coin);
} else {
$('#edex_total_balance').text('0');
}
});
}
EdexfillTxHistory(coincode);
} else {
$('#currency-progressbars').hide();
if ( selected_coin == 'KMD' ) {
sessionStorage.setItem('edexTmpMode', selected_coinmode);
sessionStorage.setItem('edexTmpRefresh', 'start');
$( '#nav-komodo-wallet' ).trigger( 'click' );
}
if ( selected_coin == 'ZEC' ) {
sessionStorage.setItem('edexTmpMode', selected_coinmode);
sessionStorage.setItem('edexTmpRefresh', 'start');
$( '#nav-zcash-wallet' ).trigger( 'click' );
}
}
});
}
function getActiveEdexcoin() {
var active_edexcoin = $('[data-edexcoin]').attr('data-edexcoin');
return active_edexcoin;
}
function EdexfillTxHistory(coin) {
$('#edexcoin_txhistory').data('panel-api').load();
NProgress.done(true);
NProgress.configure({
template: '<div class="bar nprogress-bar-header nprogress-bar-info" role="bar"></div>' +
'<div class="spinner" role="spinner">' +
'<div class="spinner-icon"></div>' +
'</div>'
});
NProgress.start();
var active_edexcoinmodecode = sessionStorage.getItem('edexTmpMode');
if ( active_edexcoinmodecode === 'Basilisk' ) {
EdexGetTxList_cache(coin).then(function(result) {
var edex_txhistory_table = '';
edex_txhistory_table = $('#edex-tx-history-tbl').DataTable({
data: result,
'order': [
[ 3, 'desc' ]
],
select: true,
retrieve: true
});
edex_txhistory_table.destroy();
edex_txhistory_table = $('#edex-tx-history-tbl').DataTable({
data: result,
'order': [
[ 3, 'desc' ]
],
select: true,
retrieve: true
});
$('#edexcoin_txhistory').data('panel-api').done();
$('.panel-loading').remove();
});
}
if ( active_edexcoinmodecode === 'Full' ) {
EdexGetTxList(coin).then(function(result){
var edex_txhistory_table = '';
edex_txhistory_table = $('#edex-tx-history-tbl').DataTable({
data: result,
'order': [
[ 3, 'desc' ]
],
select: true,
retrieve: true
});
edex_txhistory_table.destroy();
edex_txhistory_table = $('#edex-tx-history-tbl').DataTable({
data: result,
'order': [
[ 3, 'desc' ]
],
select: true,
retrieve: true
});
$('#edexcoin_txhistory').data('panel-api').done();
$('.panel-loading').remove();
});
}
}

4
index.html

@ -2099,10 +2099,10 @@
<!-- Dashboard Scripts -->
<script src="assets/scripts/dashboard.js"></script>
<!--script src="assets/scripts/dashboard/DashboardEDEX.js"></script>
<script src="assets/scripts/dashboard/DashboardEDEX.js"></script>
<script src="assets/scripts/dashboard/DashboardDEX.js"></script>
<script src="assets/scripts/dashboard/DashboardBasilisk.js"></script>
<script src="assets/scripts/dashboard/DashboardCoinFiat.js"></script-->
<script src="assets/scripts/dashboard/DashboardCoinFiat.js"></script>
<!-- End Dashboard Scripts -->
<!--<script src="assets/scripts/coinwallets.js"></script>-->

Loading…
Cancel
Save