Browse Source

cleanup #4

master
pbca26 8 years ago
parent
commit
e091752308
  1. 147
      assets/scripts/coinwallets.js
  2. 442
      assets/scripts/dashboard.js

147
assets/scripts/coinwallets.js

@ -1,14 +1,8 @@
// DOM Ready =============================================================
$(document).ready(function() {
// button click
//console.log('EhLoe!');
//$('button[id="currency-send"]').on('click', function(){console.log($(this).data('currency'));});
// By default set USD as Fiat Currency if there's none selected already.
if ( localStorage.getItem('EasyDEX_FiatCurrency') == null ) {
var FiatCurrency = '';
FiatCurrency = 'USD';
var FiatCurrency = 'USD';
localStorage.setItem('EasyDEX_FiatCurrency', FiatCurrency);
}
});
@ -20,24 +14,26 @@ function sendCurrency(val) {
$('#mdl_currency_coin').text(val.currency);
$('#mdl_currency_balance').text($('span[data-currency="' + val.currency + '"][id="currency-balance"]').text());
//console.log($('span[data-currency="' + val.currency + '"][id="currency-balance"]').text());
$('#mdl_currency_sendto').attr("placeholder", "Enter " + val.currency + " address");
$('#mdl_currency_sendto').attr('placeholder', 'Enter ' + val.currency + ' address');
$('#mdl_currency_amount_label').text(val.currency);
$('#mdl_currency_total_coinname').text(val.currency);
var tmpIguanaRPCAuth = 'tmpIgRPCUser@'+sessionStorage.getItem('IguanaRPCAuth');
var getinfoValues = {'userpass':tmpIguanaRPCAuth,"coin":val.currency,"agent":"bitcoinrpc","method":"getinfo"};
var tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'),
getinfoValues = {
'userpass': tmpIguanaRPCAuth,
'coin': val.currency,
'agent': 'bitcoinrpc',
'method': 'getinfo'
};
$.ajax({
type: 'POST',
data: JSON.stringify(getinfoValues),
url: 'http://127.0.0.1:7778',
//dataType: 'text',
success: function(data, textStatus, jqXHR) {
var CoinInfoData = JSON.parse(data);
var label_color = '';
var label_icon = '';
var wallettblContent = '';
//console.log('== Coin Info Data OutPut ==');
//console.log(CoinInfoData.txfee);
var CoinInfoData = JSON.parse(data),
label_color = '',
label_icon = '',
wallettblContent = '';
$('#mdl_currency_fee').val(CoinInfoData.txfee);
},
@ -56,13 +52,19 @@ function ReceiveCurrency(rec_val) {
if ( sessionStorage.getItem('IguanaActiveAccount') === null ) {
console.log('=> No wallet logged in. No need to get Rates.');
} else {
var tmp_activhndl = JSON.parse(sessionStorage.getItem('IguanaActiveAccount'));
var tmp_activhndl = JSON.parse(sessionStorage.getItem('IguanaActiveAccount')),
coinAddr = JSON.parse(tmp_activhndl)[rec_val.currency];
$('#mdl_receive_coin_name').text(rec_val.currency)
$('#mdl_receive_coin_addr').text('');
$('#mdl_receive_coin_addr').val(JSON.parse(tmp_activhndl)[rec_val.currency]);
$('#mdl_receive_coin_addr').val(coinAddr);
$('#mdl_receive_coin_addr_qr_code').text('');
$('#mdl_receive_coin_addr_qr_code').qrcode({width: 120,height: 120,text: JSON.parse(tmp_activhndl)[rec_val.currency]});
$('#mdl_receive_coin_addr_qr_code').qrcode({
width: 120,
height: 120,
text: coinAddr
});
}
var clipboard = new Clipboard('.btn');
clipboard.on('success', function(e) {
console.log(e);
@ -73,12 +75,12 @@ function ReceiveCurrency(rec_val) {
}
$('#mdl_currency_amount').keyup(function() {
var sum_val1 = parseFloat($('#mdl_currency_amount').val())
var sum_val2 = parseFloat($('#mdl_currency_fee').val())
var total_of_currency_fee = sum_val1 + sum_val2;
var currency_fiat_value = '';
var fiat_symbol = '';
var mdl_send_btn = $('#mdl_currency_send_btn');
var sum_val1 = parseFloat($('#mdl_currency_amount').val()),
sum_val2 = parseFloat($('#mdl_currency_fee').val()),
total_of_currency_fee = sum_val1 + sum_val2,
currency_fiat_value = '',
fiat_symbol = '',
mdl_send_btn = $('#mdl_currency_send_btn');
if ( $('#mdl_currency_total_coinname').text() == 'BTCD' ) {
currency_fiat_value = localStorage.getItem('EasyDEX_BTCD_Fiat_pair_value');
@ -87,7 +89,9 @@ $('#mdl_currency_amount').keyup(function() {
currency_fiat_value = localStorage.getItem('EasyDEX_BTC_Fiat_pair_value');
}
if (localStorage.getItem('EasyDEX_FiatCurrency') == 'USD' || localStorage.getItem('EasyDEX_FiatCurrency') == 'NZD' || localStorage.getItem('EasyDEX_FiatCurrency') == 'AUD' ) {
if (localStorage.getItem('EasyDEX_FiatCurrency') == 'USD' ||
localStorage.getItem('EasyDEX_FiatCurrency') == 'NZD' ||
localStorage.getItem('EasyDEX_FiatCurrency') == 'AUD' ) {
fiat_symbol = '$';
}
if ( localStorage.getItem('EasyDEX_FiatCurrency') == 'INR' ) {
@ -135,7 +139,9 @@ $('#mdl_currency_fee').keyup(function() {
currency_fiat_value = localStorage.getItem('EasyDEX_BTC_Fiat_pair_value');
}
if (localStorage.getItem('EasyDEX_FiatCurrency') == 'USD' || localStorage.getItem('EasyDEX_FiatCurrency') == 'NZD' || localStorage.getItem('EasyDEX_FiatCurrency') == 'AUD' ) {
if (localStorage.getItem('EasyDEX_FiatCurrency') == 'USD' ||
localStorage.getItem('EasyDEX_FiatCurrency') == 'NZD' ||
localStorage.getItem('EasyDEX_FiatCurrency') == 'AUD' ) {
fiat_symbol = '$';
}
if ( localStorage.getItem('EasyDEX_FiatCurrency') == 'INR' ) {
@ -150,9 +156,8 @@ $('#mdl_currency_fee').keyup(function() {
if ( localStorage.getItem('EasyDEX_FiatCurrency') == 'EUR' ) {
fiat_symbol = '€';
}
var total_of_currency_fiat = total_of_currency_fee * currency_fiat_value;
//console.log($('#mdl_currency_amount').val());
//console.log(total_of_currency_fiat);
$('#mdl_currency_total_value').text(total_of_currency_fee.toFixed(8));
$('#mdl_currency_total_fiat_value').text(fiat_symbol + total_of_currency_fiat.toFixed(2));
});
@ -170,14 +175,12 @@ function ReceiveCoinMdlBtnClean() {
}
function ConfirmsendCurrency(confirm_val) {
var confirm_coinname = $('#mdl_currency_total_coinname').text();
var confirm_selected_from_addr = $('div[data-currency="' + confirm_coinname + '"][id="currency-addr"]').text();
var confirm_send_amount_fiat = '';
var confirm_send_amount_fee_fiat = '';
var currency_fiat_value = '';
var fiat_symbol = '';
var confirm_coinname = $('#mdl_currency_total_coinname').text(),
confirm_selected_from_addr = $('div[data-currency="' + confirm_coinname + '"][id="currency-addr"]').text(),
confirm_send_amount_fiat = '',
confirm_send_amount_fee_fiat = '',
currency_fiat_value = '',
fiat_symbol = '';
if ( $('#mdl_currency_total_coinname').text() == 'BTCD' ) {
currency_fiat_value = localStorage.getItem('EasyDEX_BTCD_Fiat_pair_value');
@ -186,7 +189,9 @@ function ConfirmsendCurrency(confirm_val) {
currency_fiat_value = localStorage.getItem('EasyDEX_BTC_Fiat_pair_value');
}
if (localStorage.getItem('EasyDEX_FiatCurrency') == 'USD' || localStorage.getItem('EasyDEX_FiatCurrency') == 'NZD' || localStorage.getItem('EasyDEX_FiatCurrency') == 'AUD' ) {
if (localStorage.getItem('EasyDEX_FiatCurrency') == 'USD' ||
localStorage.getItem('EasyDEX_FiatCurrency') == 'NZD' ||
localStorage.getItem('EasyDEX_FiatCurrency') == 'AUD' ) {
fiat_symbol = '$';
}
if ( localStorage.getItem('EasyDEX_FiatCurrency') == 'INR' ) {
@ -218,36 +223,56 @@ function ConfirmsendCurrency(confirm_val) {
function ExecuteSendCurrencyAPI() {
console.log('==> SendToAddress API Executed <==');
var confirm_coinname_to_send = $('#mdl_confirm_currency_coinname').text();
var confirm_send_amount = $('#mdl_confirm_currency_sendfrom_total_dedcut').text();
var confirm_sendto_address = $('#mdl_confirm_currency_sendto_addr').text();
var confirm_coinname_to_send = $('#mdl_confirm_currency_coinname').text(),
confirm_send_amount = $('#mdl_confirm_currency_sendfrom_total_dedcut').text(),
confirm_sendto_address = $('#mdl_confirm_currency_sendto_addr').text();
// Get parameters values from confirm dialog and send currency
var tmpIguanaRPCAuth = 'tmpIgRPCUser@'+sessionStorage.getItem('IguanaRPCAuth');
var sendtoaddrvalues = {'userpass':tmpIguanaRPCAuth,"coin": confirm_coinname_to_send,"method":"sendtoaddress","params":[confirm_sendto_address,confirm_send_amount,"EasyDEX","EasyDEXTransaction"]};
var tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'),
sendtoaddrvalues = {
'userpass': tmpIguanaRPCAuth,
'coin': confirm_coinname_to_send,
'method': 'sendtoaddress',
'params': [
confirm_sendto_address,
confirm_send_amount,
'EasyDEX',
'EasyDEXTransaction'
]
};
console.log(sendtoaddrvalues);
$.ajax({
type: 'POST',
data: JSON.stringify(sendtoaddrvalues),
url: 'http://127.0.0.1:7778',
//dataType: 'text',
success: function(data, textStatus, jqXHR) {
var SendToAddrData = JSON.parse(data);
var SendToAddrData = JSON.parse(data),
SendToAddrTxDataTitle;
console.log('== Data OutPut ==');
console.log(SendToAddrData);
if ( SendToAddrData.error != 'couldnt create rawtx' ) {
var SendToAddrTxDataTitle = "Transaction Failed";
SendToAddrTxDataTitle = 'Transaction Failed';
}
if ( SendToAddrData.sendrawtransaction == 'success' ) {
var SendToAddrTxDataTitle = "Transaction Successful";
SendToAddrTxDataTitle = 'Transaction Successful';
}
var SentToAddrTxData = "<font style='font-size: 13px; font-family: Menlo,Monaco,Consolas,\"Courier New\",monospace'><font style='font-weight: 800;'><b>Transaction ID:</font> </b>"+SendToAddrData.result+"</font>";
var SentToAddrTxData = '<font style="font-size: 13px; font-family: Menlo,Monaco,Consolas,Courier New,monospace">' +
'<font style="font-weight: 800">' +
'<b>Transaction ID:</b>'
'</font>' +
SendToAddrData.result +
'</font>';
bootbox.dialog({
title: SendToAddrTxDataTitle,
message: SentToAddrTxData
});
if ( SendToAddrData.sendrawtransaction == 'success' ) {
toastr.success("Transaction Sent", "Transaction Notification")
toastr.success('Transaction Sent', 'Transaction Notification')
}
},
error: function(xhr, textStatus, error) {
@ -255,7 +280,7 @@ function ExecuteSendCurrencyAPI() {
console.log(xhr.statusText);
console.log(textStatus);
console.log(error);
toastr.error("Unable to complete transaction", "Transaction Notification")
toastr.error('Unable to complete transaction', 'Transaction Notification')
}
});
@ -282,32 +307,28 @@ function ExecuteSendCurrencyAPI() {
CurrencyMdlBtnClean();
}
// Used this function to set desired Fiat Currency, selected from top menu bar of EasyDEX UI
function WalletFiatCurrency(fiat_currency_value) {
//console.log(fiat_currency_value);
var FiatCurrency = fiat_currency_value.fiatcurrency;
localStorage.setItem('EasyDEX_FiatCurrency', FiatCurrency);
//console.log(localStorage.getItem('EasyDEX_FiatCurrency'));
}
function Iguana_rmd160conv(rmd160conv_data) {
//console.log(rmd160conv_data);
//return rmd160conv_data;
// comment
var tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth');
var ajax_data = {'userpass':tmpIguanaRPCAuth,"agent":"SuperNET","method":"rmd160conv","rmd160": rmd160conv_data.rmd160,"coin": rmd160conv_data.coin};
var ajax_data = {
'userpass': tmpIguanaRPCAuth,
'agent': 'SuperNET',
'method': 'rmd160conv',
'rmd160': rmd160conv_data.rmd160,
'coin': rmd160conv_data.coin
};
console.log(ajax_data);
$.ajax({
type: 'POST',
data: JSON.stringify(ajax_data),
url: 'http://127.0.0.1:7778',
//dataType: 'text',
success: function(data, textStatus, jqXHR) {
var AjaxOutputData = JSON.parse(data);
console.log('== Data OutPut ==');

442
assets/scripts/dashboard.js

@ -1,30 +1,26 @@
var RunTotalFiatValue = '';
var ExecuteShowCoinHistory = '';
var active_edexcoin = '';
var tmp_send_to_addr = '';
var tmp_send_total_amount = '';
var edexcoin_send_form_validator = '';
var RunTotalFiatValue = '',
ExecuteShowCoinHistory = '',
active_edexcoin = '',
tmp_send_to_addr = '',
tmp_send_total_amount = '',
edexcoin_send_form_validator = '';
var Dashboard = function() {
toastr.options = {
"closeButton": true,
"debug": false,
"positionClass": "toast-top-right",
"showDuration": "15000",
"hideDuration": "1000",
"timeOut": "15000",
"extendedTimeOut": "1000",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut"
'closeButton': true,
'debug': false,
'positionClass': 'toast-top-right',
'showDuration': '15000',
'hideDuration': '1000',
'timeOut': '15000',
'extendedTimeOut': '1000',
'showEasing': 'swing',
'hideEasing': 'linear',
'showMethod': 'fadeIn',
'hideMethod': 'fadeOut'
}
var handle_edex_wallet = function() {
//var action_btn_code = getActiveEdexcoin();
$('#btn_edexcoin_wallet_dashboard').click(function() {
console.log('edex wallet dashbaord button clicked...');
console.log($(this).data());
@ -33,21 +29,20 @@ var Dashboard = function() {
var handle_edex_dashboard = function() {
$('.btn_refresh_edexcoin_dashboard').click(function() {
$( "#btn_edexcoin_dashboard" ).trigger( "click" );
$( '#btn_edexcoin_dashboard' ).trigger( 'click' );
});
$('#btn_edexcoin_dashboard').click(function() {
$('#btn_edexcoin_dashboard').hide();
$('#btn_edexcoin_send').show();
$('#btn_edexcoin_recieve').show();
var active_edexcoin = $('[data-edexcoin]').attr("data-edexcoin");
//console.log('EasyDEX dashbaord button clicked...');
//console.log($(this).data());
if ( sessionStorage.getItem('edexTmpMode') === "Full") {
sessionStorage.setItem('edexTmpRefresh', "start");
var active_edexcoin = $('[data-edexcoin]').attr('data-edexcoin');
if ( sessionStorage.getItem('edexTmpMode') === 'Full') {
sessionStorage.setItem('edexTmpRefresh', 'start');
}
if ( sessionStorage.getItem('edexTmpMode') === "Basilisk" || sessionStorage.getItem('edexTmpMode') === "Native" ) {
sessionStorage.setItem('edexTmpRefresh', "stop");
if ( sessionStorage.getItem('edexTmpMode') === 'Basilisk' || sessionStorage.getItem('edexTmpMode') === 'Native' ) {
sessionStorage.setItem('edexTmpRefresh', 'stop');
}
$('#edexcoin_dashoard_section').show();
$('#edexcoin_dashboardinfo').show();
@ -56,26 +51,26 @@ var Dashboard = function() {
$('#edexcoin_recieve_section').hide();
$('#edexcoin_settings').hide();
var selected_coinmode = sessionStorage.getItem('edexTmpMode')
var selected_coinmode = sessionStorage.getItem('edexTmpMode');
if ( selected_coinmode == 'Basilisk' ) {
getDEXGetBalance(active_edexcoin).then(function(result){
console.log(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)
$('#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(active_edexcoin);
$('#edex_total_balance_interest_coincode').text(active_edexcoin);
}
if ( result.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('-')
$('#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);
@ -89,7 +84,7 @@ var Dashboard = function() {
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" );
$('#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(active_edexcoin);
@ -99,7 +94,7 @@ var Dashboard = function() {
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" );
$('#edexcoin_getbalance_t').removeClass( 'col-lg-4' ).addClass( 'col-lg-12' );
$('#edex_interest_balance').text('-')
$('#edex_total_balance_interest').text('-')
}
@ -107,28 +102,22 @@ var Dashboard = function() {
$('#edex_total_balance').text(result[0].total);
$('#edex_total_balance_coincode').text(active_edexcoin);
//$('#edex_total_balance').text(result[0].total.toFixed(8));
//console.log(result[0].total)
} else {
$('#edex_total_balance').text('0');
}
});
}
EdexfillTxHistory(active_edexcoin);
//getCoinBalance(active_edexcoin);
//EdexfillTxHistory(active_edexcoin);
//clearEdexSendFieldData();
$('.edexcoin-send-form')[0].reset();
});
}
var handle_edex_send = function() {
$('#btn_edexcoin_send').click(function() {
//console.log(active_edexcoin);
$('#btn_edexcoin_dashboard').show();
$('#btn_edexcoin_send').hide();
$('#btn_edexcoin_recieve').show();
sessionStorage.setItem('edexTmpRefresh', "stop");
sessionStorage.setItem('edexTmpRefresh', 'stop');
$('#edexcoin_dashboardinfo').hide();
@ -152,36 +141,32 @@ var Dashboard = function() {
$('.showedexcoinaddrs').selectpicker('refresh');*/
//clearEdexSendFieldData();
$('.edexcoin-send-form')[0].reset();
var active_edexcoin = $('[data-edexcoin]').attr("data-edexcoin");
var selected_coinmode = sessionStorage.getItem('edexTmpMode')
var active_edexcoin = $('[data-edexcoin]').attr('data-edexcoin'),
selected_coinmode = sessionStorage.getItem('edexTmpMode');
if ( selected_coinmode == 'Full' ) {
EDEXgetinfo(active_edexcoin).then(function(result){
//console.log(result)
$('#edexcoin_fee').val(result.kbfee)
})
$('#edexcoin_fee').val(result.kbfee);
});
}
});
$('.showedexcoinaddrs').on('change', function(){
var selected = $(this).find("option:selected").val();
//console.log(selected);
//console.log($(this).find("option:selected").data('total'));
var selected = $(this).find('option:selected').val();
});
$('#edexcoin_amount').keyup(function() {
var sum_val1 = parseFloat($('#edexcoin_amount').val())
var sum_val2 = parseFloat($('#edexcoin_fee').val())
var total_minus_currency_fee = sum_val1 - sum_val2;
var mdl_send_btn = $('#edexcoin_send_coins_btn');
var sum_val1 = parseFloat($('#edexcoin_amount').val()),
sum_val2 = parseFloat($('#edexcoin_fee').val()),
total_minus_currency_fee = sum_val1 - sum_val2,
mdl_send_btn = $('#edexcoin_send_coins_btn');
//console.log($('#edexcoin_amount').val());
$('#edexcoin_total_value').text(total_minus_currency_fee.toFixed(8));
if ($('#edexcoin_send_from').val() != '- Select Transparent or Private KMD Address -' && $('#edexcoin_amount').val() != '' && $('#edexcoin_sendto') != '' && $('#edexcoin_fee') != '' ) {
if ( $('#edexcoin_send_from').val() != '- Select Transparent or Private KMD Address -' &&
$('#edexcoin_amount').val() != '' &&
$('#edexcoin_sendto') != '' &&
$('#edexcoin_fee') != '' ) {
mdl_send_btn.removeClass('disabled');
//mdl_send_btn.attr('data-dismiss','modal');
//mdl_send_btn.attr('data-target','#SendCoinModelStep2');
} else {
mdl_send_btn.addClass('disabled');
mdl_send_btn.removeAttr('data-dismiss');
@ -190,18 +175,18 @@ var Dashboard = function() {
});
$('#edexcoin_fee').keyup(function() {
var sum_val1 = parseFloat($('#edexcoin_amount').val())
var sum_val2 = parseFloat($('#edexcoin_fee').val())
var total_minus_currency_fee = sum_val1 - sum_val2;
var mdl_send_btn = $('#edexcoin_send_coins_btn');
var sum_val1 = parseFloat($('#edexcoin_amount').val()),
sum_val2 = parseFloat($('#edexcoin_fee').val()),
total_minus_currency_fee = sum_val1 - sum_val2,
mdl_send_btn = $('#edexcoin_send_coins_btn');
//console.log($('#edexcoin_amount').val());
$('#edexcoin_total_value').text(total_minus_currency_fee.toFixed(8));
if ($('#edexcoin_send_from').val() != '- Select Transparent or Private KMD Address -' && $('#edexcoin_amount').val() != '' && $('#edexcoin_sendto') != '' && $('#edexcoin_fee') != '' ) {
if ($('#edexcoin_send_from').val() != '- Select Transparent or Private KMD Address -' &&
$('#edexcoin_amount').val() != '' &&
$('#edexcoin_sendto') != '' &&
$('#edexcoin_fee') != '' ) {
mdl_send_btn.removeClass('disabled');
//mdl_send_btn.attr('data-dismiss','modal');
//mdl_send_btn.attr('data-target','#SendCoinModelStep2');
} else {
mdl_send_btn.addClass('disabled');
mdl_send_btn.removeAttr('data-dismiss');
@ -233,60 +218,58 @@ var Dashboard = function() {
messages: {
edexcoin_send_from: {
required: "From Address is required."
required: 'From Address is required.'
},
edexcoin_sendto: {
required: "To Address is required."
required: 'To Address is required.'
},
edexcoin_amount: {
required: "Please enter amount to send."
required: 'Please enter amount to send.'
},
edexcoin_fee: {
required: "Make sure you have fee entered. Default value is 0.0001."
required: 'Make sure you have fee entered. Default value is 0.0001.'
},
edexcoin_total_value: {
required: "Make sure you have both amount and fee entered to calculate final total."
required: 'Make sure you have both amount and fee entered to calculate final total.'
}
},
submitHandler: function(form) {
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>'
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();
console.log('Sent control here after clicked in form...');
EDEXMainAddr($('[data-edexcoin]').attr("data-edexcoin")).then(function(result){
//console.log(result)
EDEXMainAddr($('[data-edexcoin]').attr('data-edexcoin')).then(function(result){
$('#mdl_confirm_currency_sendfrom_addr').text(result);
})
});
$('#mdl_confirm_currency_sendto_addr').text($('#edexcoin_sendto').val());
$('#mdl_confirm_currency_send_amount').text($('#edexcoin_amount').val());
$('#mdl_confirm_currency_coinname').text($('[data-edexcoin]').attr("data-edexcoin"));
$('#mdl_confirm_currency_coinname').text($('[data-edexcoin]').attr('data-edexcoin'));
$('#mdl_confirm_currency_send_fee').text($('#edexcoin_fee').val());
$('#mdl_confirm_currency_coinname_fee').text($('[data-edexcoin]').attr("data-edexcoin"));
$('#mdl_confirm_currency_coinname_fee').text($('[data-edexcoin]').attr('data-edexcoin'));
$('#mdl_confirm_currency_sendfrom_total_dedcut').text($('#edexcoin_total_value').text());
$('#mdl_confirm_currency_coinname_total').text($('[data-edexcoin]').attr("data-edexcoin"));
$('#mdl_confirm_currency_coinname_total').text($('[data-edexcoin]').attr('data-edexcoin'));
//$('#SendCoinModelStep2').modal('show')
console.log('==> Before confirming tx to send');
console.log($('[data-edexcoin]').attr('data-edexcoin'));
console.log($('#edexcoin_sendto').val());
console.log($('#edexcoin_total_value').text());
console.log('==> Before confirming tx to send')
console.log($('[data-edexcoin]').attr("data-edexcoin"))
//console.log($('#edexcoin_send_from').val())
console.log($('#edexcoin_sendto').val())
console.log($('#edexcoin_total_value').text())
var active_edexcoin = $('[data-edexcoin]').attr('data-edexcoin'),
tmp_send_to_addr = $('#edexcoin_sendto').val(),
tmp_send_total_amount = $('#edexcoin_total_value').text();
var active_edexcoin = $('[data-edexcoin]').attr("data-edexcoin");
//var tmp_send_from_addr = $('#edexcoin_send_from').val();
var tmp_send_to_addr = $('#edexcoin_sendto').val();
var tmp_send_total_amount = $('#edexcoin_total_value').text();
$('#edexcoin-send-screen').hide();
$('#edexcoin-send-confirm-screen').show();
$('#edexcoin_send_step_1').removeClass( " current" ).addClass( "" );
$('#edexcoin_send_step_2').removeClass( "" ).addClass( " current" );
$('#edexcoin_send_step_3').removeClass( " current" ).addClass( "" );
$('#edexcoin_send_step_1').removeClass( 'current' ).addClass( '' );
$('#edexcoin_send_step_2').removeClass( '' ).addClass( 'current' );
$('#edexcoin_send_step_3').removeClass( 'current' ).addClass( '' );
NProgress.done();
}
@ -295,61 +278,63 @@ var Dashboard = function() {
$('#edexcoin_send_coins_btn').click(function() {
$('#edexcoin_send_coins_btn').prop('disabled', true);
console.log('==> After confirming tx to send')
var active_edexcoin = $('[data-edexcoin]').attr("data-edexcoin");
//var tmp_send_from_addr = $('#edexcoin_send_from').val();
var tmp_send_to_addr = $('#edexcoin_sendto').val();
var tmp_send_total_amount = $('#edexcoin_total_value').text();
var active_edexcoin = $('[data-edexcoin]').attr('data-edexcoin'),
tmp_send_to_addr = $('#edexcoin_sendto').val(),
tmp_send_total_amount = $('#edexcoin_total_value').text();
console.log(active_edexcoin)
console.log(tmp_send_to_addr)
console.log(tmp_send_total_amount)
var edexcoin_sendto_result_tbl = '';
edexcoin_sendto_result_tbl += '<tr class="info"><td>Info</td><td>The transaction submitted is processing. Once processed the transaction details will be displayed here.</td></tr>';
edexcoin_sendto_result_tbl += '<tr class="info">' +
'<td>Info</td>' +
'<td>The transaction submitted is processing. Once processed the transaction details will be displayed here.</td>' +
'</tr>';
$('#edexcoin_sendto_result tbody').html(edexcoin_sendto_result_tbl);
$('#edexcoin_send_coins_anothertx_btn').hide();
var tmp_json_data = {'coin':active_edexcoin,'sendtoaddr':tmp_send_to_addr,'amount':tmp_send_total_amount};
var tmp_json_data = {
'coin': active_edexcoin,
'sendtoaddr': tmp_send_to_addr,
'amount': tmp_send_total_amount
};
console.log(tmp_json_data);
EDEXSendToAddr(tmp_json_data);
//console.log(tmp_sendtoaddr_output);
//console.log(tmp_sendtoaddr_output[0]);
//$('#SendCoinModelStep2').modal('hide')
$('.edexcoin-send-form')[0].reset();
$('#edexcoin_total_value').text('0.000');
$('#edexcoin-send-confirm-screen').hide();
$('#edexcoin-send-txdetails-screen').show();
edexcoin_send_form_validator.resetForm();
$('#edexcoin_send_step_1').removeClass( " current" ).addClass( "" );
$('#edexcoin_send_step_2').removeClass( " current" ).addClass( "" );
$('#edexcoin_send_step_3').removeClass( "" ).addClass( " current" );
$('#edexcoin_send_step_1').removeClass( 'current' ).addClass( '' );
$('#edexcoin_send_step_2').removeClass( 'current' ).addClass( '' );
$('#edexcoin_send_step_3').removeClass( '' ).addClass( 'current' );
});
$('#edexcoin_send_coins_back_btn').click(function() {
$('#edexcoin-send-confirm-screen').hide();
$('#edexcoin-send-txdetails-screen').hide();
$('#edexcoin-send-screen').show();
var active_edexcoin = '';
var tmp_send_to_addr = '';
var tmp_send_total_amount = '';
var active_edexcoin = '',
tmp_send_to_addr = '',
tmp_send_total_amount = '';
edexcoin_send_form_validator.resetForm();
$('#edexcoin_send_step_1').removeClass( "" ).addClass( " current" );
$('#edexcoin_send_step_2').removeClass( " current" ).addClass( "" );
$('#edexcoin_send_step_3').removeClass( " current" ).addClass( "" );
$('#edexcoin_send_step_1').removeClass( '' ).addClass( 'current' );
$('#edexcoin_send_step_2').removeClass( 'current' ).addClass( '' );
$('#edexcoin_send_step_3').removeClass( 'current' ).addClass( '' );
});
$('#edexcoin_send_coins_anothertx_btn').click(function() {
$( "#edexcoin_send_coins_back_btn" ).trigger( "click" );
var active_edexcoin = '';
var tmp_send_to_addr = '';
var tmp_send_total_amount = '';
$( '#edexcoin_send_coins_back_btn' ).trigger( 'click' );
var active_edexcoin = '',
tmp_send_to_addr = '',
tmp_send_total_amount = '';
$('#edexcoin_send_coins_btn').prop('disabled', false);
edexcoin_send_form_validator.resetForm();
});
$('.edexcoin_sendto_result').on('click', '.edexcoin_sendto_output_result', function(e){
var selected_coin = $(this).data('edexcoin')
var selected_coin_mode = sessionStorage.getItem('edexTmpMode');
$( "#nav-iguana-atomic-explorer" ).trigger( "click" );
var selected_coin = $(this).data('edexcoin'),
selected_coin_mode = sessionStorage.getItem('edexTmpMode');
$( '#nav-iguana-atomic-explorer' ).trigger( 'click' );
$('#atomic_explorer_select_coin_options option[value=' + selected_coin + ']').attr('selected', 'selected');
if ( selected_coin_mode == 'Full') {
$('#atomic_explorer_select_command_options option[value=gettransaction]').attr('selected', 'selected');
@ -358,11 +343,8 @@ var Dashboard = function() {
$('#atomic_explorer_select_command_options option[value=dex_gettransaction]').attr('selected', 'selected');
}
$('#atomic_explorer_input_data').val($(this).data('sendtotxresult'))
$( "#atomic_explorer_getcoinpeers_btn" ).trigger( "click" );
$( '#atomic_explorer_getcoinpeers_btn' ).trigger( 'click' );
});
//$('.edexcoin_sendto_output_result').click(function() {
//});
}
var handle_edex_recieve = function() {
@ -370,9 +352,8 @@ var Dashboard = function() {
$('#btn_edexcoin_dashboard').show();
$('#btn_edexcoin_send').show();
$('#btn_edexcoin_recieve').hide();
var active_edexcoin = $('[data-edexcoin]').attr("data-edexcoin");
//console.log('wallet receive button clicked...');
sessionStorage.setItem('edexTmpRefresh', "stop");
var active_edexcoin = $('[data-edexcoin]').attr('data-edexcoin');
sessionStorage.setItem('edexTmpRefresh', 'stop');
$('#edexcoin_dashboardinfo').hide();
$('#edexcoin_dashoard_section').hide();
$('#edexcoin_send').hide();
@ -380,100 +361,178 @@ var Dashboard = function() {
$('#edexcoin_recieve_section').show();
$('#edexcoin_settings').hide();
EdexListAllAddr(active_edexcoin);
//clearEdexSendFieldData();
$('.edexcoin-send-form')[0].reset();
});
$('#edexcoin_get_new_addr').click(function() {
var active_edexcoin = $('[data-edexcoin]').attr("data-edexcoin");
var active_edexcoin = $('[data-edexcoin]').attr('data-edexcoin');
console.log('get new T address button clicked...');
EDEXgetnewaddress(active_edexcoin).then(function(result){
//console.log(result)
})
EdexListAllAddr(active_edexcoin);
toastr.info("Receiving Address list updated", "Wallet Notification");
toastr.info('Receiving Address list updated', 'Wallet Notification');
});
};
var handleWalletWidgets = function() {
var walletDivContent = '',
AddColumnDiv = 0;
$.each([
'native',
'basilisk',
'full'
], function( index, value ) {
var tmpIguanaRPCAuth = 'tmpIgRPCUser@' + sessionStorage.getItem('IguanaRPCAuth'),
ajax_data = {
'userpass': tmpIguanaRPCAuth,
'agent': 'InstantDEX',
'method': 'allcoins'
};
var walletDivContent = '';
var AddColumnDiv = 0
$.each([ 'native','basilisk', 'full' ], function( index, value ) {
var tmpIguanaRPCAuth = 'tmpIgRPCUser@'+sessionStorage.getItem('IguanaRPCAuth');
var ajax_data = {'userpass':tmpIguanaRPCAuth,"agent":"InstantDEX","method":"allcoins"};
//console.log(ajax_data);
$.ajax({
type: 'POST',
data: JSON.stringify(ajax_data),
url: 'http://127.0.0.1:7778',
//dataType: 'JSON',
success: function(data, textStatus, jqXHR) {
var AllcoinsDataOutput = JSON.parse(data);
//console.log('== AllCoins Data OutPut ==');
//console.log(value);
//console.log(AllcoinsDataOutput[value]);
$.each(AllcoinsDataOutput[value], function(index) {
var coinlogo = '';
var coinname = '';
var modecode = '';
var modetip = '';
var modecolor = '';
if ( value == 'native' ) { modecode = 'Native'; modetip = 'Native'; modecolor = 'primary'; }
if ( value == 'basilisk' ) { modecode = 'Basilisk'; modetip = 'Basilisk'; modecolor = 'info'; }
if ( value == 'full' ) { modecode = 'Full'; modetip = 'Full'; modecolor = 'success'; }
if ( value == 'virtual' ) { modecode = 'Virtual'; modetip = 'Virtual'; modecolor = 'danger'; }
if ( value == 'notarychains' ) { modecode = 'Notarychains'; modetip = 'Notarychains'; modecolor = 'dark'; }
if ( AllcoinsDataOutput[value][index] == 'BTC' ) { coinlogo = 'bitcoin'; coinname = 'Bitcoin'; }
if ( AllcoinsDataOutput[value][index] == 'BTCD' ) { coinlogo = 'bitcoindark'; coinname = 'BitcoinDark'; }
if ( AllcoinsDataOutput[value][index] == 'LTC' ) { coinlogo = 'litecoin'; coinname = 'Litecoin'; }
if ( AllcoinsDataOutput[value][index] == 'VPN' ) { coinlogo = 'vpncoin'; coinname = 'VPNcoin'; }
if ( AllcoinsDataOutput[value][index] == 'SYS' ) { coinlogo = 'syscoin'; coinname = 'Syscoin'; }
if ( AllcoinsDataOutput[value][index] == 'ZEC' ) { coinlogo = 'zcash'; coinname = 'Zcash'; }
if ( AllcoinsDataOutput[value][index] == 'NMC' ) { coinlogo = 'namecoin'; coinname = 'Namecoin'; }
if ( AllcoinsDataOutput[value][index] == 'DEX' ) { coinlogo = 'dex'; coinname = 'DEX'; }
if ( AllcoinsDataOutput[value][index] == 'DOGE' ) { coinlogo = 'dogecoin'; coinname = 'Dogecoin'; }
if ( AllcoinsDataOutput[value][index] == 'DGB' ) { coinlogo = 'digibyte'; coinname = 'Digibyte'; }
if ( AllcoinsDataOutput[value][index] == 'MZC' ) { coinlogo = 'mazacoin'; coinname = 'Mazacoin'; }
if ( AllcoinsDataOutput[value][index] == 'UNO' ) { coinlogo = 'unobtanium'; coinname = 'Unobtanium'; }
if ( AllcoinsDataOutput[value][index] == 'ZET' ) { coinlogo = 'zetacoin'; coinname = 'Zetacoin'; }
if ( AllcoinsDataOutput[value][index] == 'KMD' ) { coinlogo = 'komodo'; coinname = 'Komodo'; }
if ( AllcoinsDataOutput[value][index] == 'BTM' ) { coinlogo = 'bitmark'; coinname = 'Bitmark'; }
if ( AllcoinsDataOutput[value][index] == 'CARB' ) { coinlogo = 'carboncoin'; coinname = 'Carboncoin'; }
if ( AllcoinsDataOutput[value][index] == 'ANC' ) { coinlogo = 'anoncoin'; coinname = 'AnonCoin'; }
if ( AllcoinsDataOutput[value][index] == 'FRK' ) { coinlogo = 'franko'; coinname = 'Franko'; }
if ( AllcoinsDataOutput[value][index] == 'SUPERNET' ) { coinlogo = 'SUPERNET'; coinname = 'SUPERNET'; }
if ( AllcoinsDataOutput[value][index] == 'REVS' ) { coinlogo = 'REVS'; coinname = 'REVS'; }
if ( AllcoinsDataOutput[value][index] == 'USD' ) { coinlogo = 'USD'; coinname = 'USD'; }
//console.log(AllcoinsDataOutput[value][index]);
var coinlogo = '',
coinname = '',
modecode = '',
modetip = '',
modecolor = '';
switch (value) {
case 'native':
modecode = 'Native';
modetip = 'Native';
modecolor = 'primary';
break;
case 'basilisk':
modecode = 'Basilisk';
modetip = 'Basilisk';
modecolor = 'info';
break;
case 'full':
modecode = 'Full';
modetip = 'Full';
modecolor = 'success';
break;
case 'virtual':
modecode = 'Virtual';
modetip = 'Virtual';
modecolor = 'danger';
break;
case 'notarychains':
modecode = 'Notarychains';
modetip = 'Notarychains';
modecolor = 'dark';
break;
}
switch (AllcoinsDataOutput[value][index]) {
case 'BTC':
coinlogo = 'bitcoin';
coinname = 'Bitcoin';
break;
case 'BTCD':
coinlogo = 'bitcoindark';
coinname = 'BitcoinDark';
break;
case 'LTC':
coinlogo = 'litecoin';
coinname = 'Litecoin';
break;
case 'VPN':
coinlogo = 'vpncoin';
coinname = 'VPNcoin';
break;
case 'SYS':
coinlogo = 'syscoin';
coinname = 'Syscoin';
break;
case 'ZEC':
coinlogo = 'zcash';
coinname = 'Zcash';
break;
case 'NMC':
coinlogo = 'namecoin';
coinname = 'Namecoin';
break;
case 'DEX':
coinlogo = 'dex';
coinname = 'DEX';
break;
case 'DOGE':
coinlogo = 'dogecoin';
coinname = 'Dogecoin';
break;
case 'DGB':
coinlogo = 'digibyte';
coinname = 'Digibyte';
break;
case 'MZC':
coinlogo = 'mazacoin';
coinname = 'Mazacoin';
break;
case 'UNO':
coinlogo = 'unobtanium';
coinname = 'Unobtanium';
break;
case 'ZET':
coinlogo = 'zetacoin';
coinname = 'Zetacoin';
break;
case 'KMD':
coinlogo = 'komodo';
coinname = 'Komodo';
break;
case 'BTM':
coinlogo = 'bitmark';
coinname = 'Bitmark';
break;
case 'CARB':
coinlogo = 'carboncoin';
coinname = 'Carboncoin';
break;
case 'ANC':
coinlogo = 'anoncoin';
coinname = 'AnonCoin';
break;
case 'FRK':
coinlogo = 'franko';
coinname = 'Franko';
break;
case 'SUPERNET':
coinlogo = 'SUPERNET';
coinname = 'SUPERNET';
break;
case 'REVS':
coinlogo = 'REVS';
coinname = 'REVS';
break;
case 'USD':
coinlogo = 'USD';
coinname = 'USD';
break;
}
walletDivContent += '<!-- Wallet Widget ' + AllcoinsDataOutput[value][index] + ' -->';
walletDivContent += '<div class="list-group-item col-xlg-6 col-lg-12 wallet-widgets-info" data-edexcoincode="' + AllcoinsDataOutput[value][index] + '">';
walletDivContent += '<div class="widget widget-shadow">';
walletDivContent += '<div class="widget-content text-center bg-white padding-20 edexcoin-logo" data-edexcoincode="' + AllcoinsDataOutput[value][index] + '" data-edexcoinmodecode="' + modecode + '" data-edexcoinname="' + coinname + '">';
//walletDivContent += '<a href="#" class="avatar margin-bottom-5">';
walletDivContent += '<a class="avatar margin-bottom-5" href="javascript:void(0)" id="edexcoin-logo">';
walletDivContent += '<img class="img-responsive" src="assets/images/cryptologo/' + coinlogo + '.png" alt="' + coinname + '"/>';
walletDivContent += '<span class="badge up badge-' + modecolor + '" id="basfull" data-edexcoincode="' + AllcoinsDataOutput[value][index] + '" data-toggle="tooltip" data-placement="top" data-original-title="' + modetip + '">' + modecode + '</span>';
walletDivContent += '</a>';
walletDivContent += '<div class="coin-name">' + coinname + '</div>';
//walletDivContent += '<div class="coin-title margin-bottom-20 blue-grey-400"><span data-edexcoincode="'+AllcoinsDataOutput[value][index]+'" id="edexcoin-balance">-</span> '+AllcoinsDataOutput[value][index]+'</div>';
walletDivContent += '</div>';
walletDivContent += '</div>';
walletDivContent += '</div>';
walletDivContent += '<!-- End Wallet Widget ' + AllcoinsDataOutput[value][index] + ' -->';
$('.wallet-widgets-row').html(walletDivContent);
//getCoinBalance_altfn(AllcoinsDataOutput[value][index]);
$('.scrollbar-dynamic').scrollbar(); //Make sure widget-body has scrollbar for transactions history
$('[data-toggle="tooltip"]').tooltip(); //Make sure tooltips are working for wallet widgets and anywhere else in wallet.
//console.log(walletDivContent);
edexCoinBtnAction();
});
},
@ -485,9 +544,8 @@ var Dashboard = function() {
}
console.log(textStatus);
console.log(error);
//swal("Oops...", "Something went wrong!", "error");
if (xhr.readyState == '0' ) {
toastr.error("Unable to connect to Iguana", "Account Notification")
toastr.error('Unable to connect to Iguana', "Account Notification")
}
}
});

Loading…
Cancel
Save